diff --git a/__snapshots__/brand/patternhub/brand-properties-should-match-screenshot.png b/__snapshots__/brand/patternhub/brand-properties-should-match-screenshot.png index 37ef710488c..d3bc3bb1095 100644 Binary files a/__snapshots__/brand/patternhub/brand-properties-should-match-screenshot.png and b/__snapshots__/brand/patternhub/brand-properties-should-match-screenshot.png differ diff --git a/__snapshots__/button/patternhub/button-properties-should-match-screenshot.png b/__snapshots__/button/patternhub/button-properties-should-match-screenshot.png index 0f6f631ddcf..76edfefc764 100644 Binary files a/__snapshots__/button/patternhub/button-properties-should-match-screenshot.png and b/__snapshots__/button/patternhub/button-properties-should-match-screenshot.png differ diff --git a/__snapshots__/header/showcase/chromium-highContrast/DBHeader-should-match-screenshot-1/DBHeader-should-match-screenshot.png b/__snapshots__/header/showcase/chromium-highContrast/DBHeader-should-match-screenshot-1/DBHeader-should-match-screenshot.png index 8d76c4ffc15..257494752e6 100644 Binary files a/__snapshots__/header/showcase/chromium-highContrast/DBHeader-should-match-screenshot-1/DBHeader-should-match-screenshot.png and b/__snapshots__/header/showcase/chromium-highContrast/DBHeader-should-match-screenshot-1/DBHeader-should-match-screenshot.png differ diff --git a/__snapshots__/header/showcase/chromium/DBHeader-should-match-screenshot-1/DBHeader-should-match-screenshot.png b/__snapshots__/header/showcase/chromium/DBHeader-should-match-screenshot-1/DBHeader-should-match-screenshot.png index adc5c88f1bf..ea22a4d38e4 100644 Binary files a/__snapshots__/header/showcase/chromium/DBHeader-should-match-screenshot-1/DBHeader-should-match-screenshot.png and b/__snapshots__/header/showcase/chromium/DBHeader-should-match-screenshot-1/DBHeader-should-match-screenshot.png differ diff --git a/__snapshots__/header/showcase/firefox/DBHeader-should-match-screenshot-1/DBHeader-should-match-screenshot.png b/__snapshots__/header/showcase/firefox/DBHeader-should-match-screenshot-1/DBHeader-should-match-screenshot.png index 217c4f79095..4d724d2f747 100644 Binary files a/__snapshots__/header/showcase/firefox/DBHeader-should-match-screenshot-1/DBHeader-should-match-screenshot.png and b/__snapshots__/header/showcase/firefox/DBHeader-should-match-screenshot-1/DBHeader-should-match-screenshot.png differ diff --git a/__snapshots__/infotext/patternhub/infotext-properties-should-match-screenshot.png b/__snapshots__/infotext/patternhub/infotext-properties-should-match-screenshot.png index 813b4d55116..8b04709805d 100644 Binary files a/__snapshots__/infotext/patternhub/infotext-properties-should-match-screenshot.png and b/__snapshots__/infotext/patternhub/infotext-properties-should-match-screenshot.png differ diff --git a/__snapshots__/link/patternhub/link-properties-should-match-screenshot.png b/__snapshots__/link/patternhub/link-properties-should-match-screenshot.png index 75cb1f33a25..df2b23e04a2 100644 Binary files a/__snapshots__/link/patternhub/link-properties-should-match-screenshot.png and b/__snapshots__/link/patternhub/link-properties-should-match-screenshot.png differ diff --git a/__snapshots__/link/showcase/chromium-highContrast/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png b/__snapshots__/link/showcase/chromium-highContrast/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png index 9eaf8455612..cfe5f7711d9 100644 Binary files a/__snapshots__/link/showcase/chromium-highContrast/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png and b/__snapshots__/link/showcase/chromium-highContrast/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png differ diff --git a/__snapshots__/link/showcase/chromium-highContrast/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml b/__snapshots__/link/showcase/chromium-highContrast/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml index 69ac1e07622..85d58f7b390 100644 --- a/__snapshots__/link/showcase/chromium-highContrast/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml +++ b/__snapshots__/link/showcase/chromium-highContrast/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml @@ -15,4 +15,5 @@ - link "Small arrow_right\" / \"" - link "Content arrow_up_right\" / \"" - link "(Default) Internal arrow_right\" / \"" - - link "External arrow_up_right\" / \"" \ No newline at end of file + - link "External arrow_up_right\" / \"" + - link "Show Icon" \ No newline at end of file diff --git a/__snapshots__/link/showcase/chromium/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png b/__snapshots__/link/showcase/chromium/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png index ffd671aeb20..5c4553913e5 100644 Binary files a/__snapshots__/link/showcase/chromium/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png and b/__snapshots__/link/showcase/chromium/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png differ diff --git a/__snapshots__/link/showcase/chromium/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml b/__snapshots__/link/showcase/chromium/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml index 69ac1e07622..85d58f7b390 100644 --- a/__snapshots__/link/showcase/chromium/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml +++ b/__snapshots__/link/showcase/chromium/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml @@ -15,4 +15,5 @@ - link "Small arrow_right\" / \"" - link "Content arrow_up_right\" / \"" - link "(Default) Internal arrow_right\" / \"" - - link "External arrow_up_right\" / \"" \ No newline at end of file + - link "External arrow_up_right\" / \"" + - link "Show Icon" \ No newline at end of file diff --git a/__snapshots__/link/showcase/firefox/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png b/__snapshots__/link/showcase/firefox/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png index 3b70119be56..140b6552ce6 100644 Binary files a/__snapshots__/link/showcase/firefox/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png and b/__snapshots__/link/showcase/firefox/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png differ diff --git a/__snapshots__/link/showcase/firefox/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml b/__snapshots__/link/showcase/firefox/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml index 69ac1e07622..85d58f7b390 100644 --- a/__snapshots__/link/showcase/firefox/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml +++ b/__snapshots__/link/showcase/firefox/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml @@ -15,4 +15,5 @@ - link "Small arrow_right\" / \"" - link "Content arrow_up_right\" / \"" - link "(Default) Internal arrow_right\" / \"" - - link "External arrow_up_right\" / \"" \ No newline at end of file + - link "External arrow_up_right\" / \"" + - link "Show Icon" \ No newline at end of file diff --git a/__snapshots__/link/showcase/mobile-chrome/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png b/__snapshots__/link/showcase/mobile-chrome/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png index 971fd945999..c10d7f77611 100644 Binary files a/__snapshots__/link/showcase/mobile-chrome/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png and b/__snapshots__/link/showcase/mobile-chrome/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png differ diff --git a/__snapshots__/link/showcase/mobile-chrome/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml b/__snapshots__/link/showcase/mobile-chrome/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml index 69ac1e07622..85d58f7b390 100644 --- a/__snapshots__/link/showcase/mobile-chrome/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml +++ b/__snapshots__/link/showcase/mobile-chrome/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml @@ -15,4 +15,5 @@ - link "Small arrow_right\" / \"" - link "Content arrow_up_right\" / \"" - link "(Default) Internal arrow_right\" / \"" - - link "External arrow_up_right\" / \"" \ No newline at end of file + - link "External arrow_up_right\" / \"" + - link "Show Icon" \ No newline at end of file diff --git a/__snapshots__/link/showcase/mobile-safari/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png b/__snapshots__/link/showcase/mobile-safari/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png index f66ec6b6091..d96a9f5019b 100644 Binary files a/__snapshots__/link/showcase/mobile-safari/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png and b/__snapshots__/link/showcase/mobile-safari/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png differ diff --git a/__snapshots__/link/showcase/mobile-safari/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml b/__snapshots__/link/showcase/mobile-safari/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml index 69ac1e07622..85d58f7b390 100644 --- a/__snapshots__/link/showcase/mobile-safari/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml +++ b/__snapshots__/link/showcase/mobile-safari/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml @@ -15,4 +15,5 @@ - link "Small arrow_right\" / \"" - link "Content arrow_up_right\" / \"" - link "(Default) Internal arrow_right\" / \"" - - link "External arrow_up_right\" / \"" \ No newline at end of file + - link "External arrow_up_right\" / \"" + - link "Show Icon" \ No newline at end of file diff --git a/__snapshots__/link/showcase/webkit/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png b/__snapshots__/link/showcase/webkit/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png index 0421c2ebfdf..e7c530a83a3 100644 Binary files a/__snapshots__/link/showcase/webkit/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png and b/__snapshots__/link/showcase/webkit/DBLink-should-match-screenshot-1/DBLink-should-match-screenshot.png differ diff --git a/__snapshots__/link/showcase/webkit/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml b/__snapshots__/link/showcase/webkit/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml index 69ac1e07622..85d58f7b390 100644 --- a/__snapshots__/link/showcase/webkit/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml +++ b/__snapshots__/link/showcase/webkit/should-have-same-aria-snapshot/DBLink-should-have-same-aria-snapshot.yaml @@ -15,4 +15,5 @@ - link "Small arrow_right\" / \"" - link "Content arrow_up_right\" / \"" - link "(Default) Internal arrow_right\" / \"" - - link "External arrow_up_right\" / \"" \ No newline at end of file + - link "External arrow_up_right\" / \"" + - link "Show Icon" \ No newline at end of file diff --git a/__snapshots__/notification/patternhub/notification-properties-should-match-screenshot.png b/__snapshots__/notification/patternhub/notification-properties-should-match-screenshot.png index 2bcee43beaa..7dc803f53d3 100644 Binary files a/__snapshots__/notification/patternhub/notification-properties-should-match-screenshot.png and b/__snapshots__/notification/patternhub/notification-properties-should-match-screenshot.png differ diff --git a/__snapshots__/tab-item/patternhub/tab-item-properties-should-match-screenshot.png b/__snapshots__/tab-item/patternhub/tab-item-properties-should-match-screenshot.png index 9eda293c68a..9bf95392ff6 100644 Binary files a/__snapshots__/tab-item/patternhub/tab-item-properties-should-match-screenshot.png and b/__snapshots__/tab-item/patternhub/tab-item-properties-should-match-screenshot.png differ diff --git a/__snapshots__/tag/component/chromium/DBTag-should-be-a-checkbox-checked.png b/__snapshots__/tag/component/chromium/DBTag-should-be-a-checkbox-checked.png index d955b6d3610..8bc5f8cb0bd 100644 Binary files a/__snapshots__/tag/component/chromium/DBTag-should-be-a-checkbox-checked.png and b/__snapshots__/tag/component/chromium/DBTag-should-be-a-checkbox-checked.png differ diff --git a/__snapshots__/tag/component/firefox/DBTag-should-be-a-checkbox-checked.png b/__snapshots__/tag/component/firefox/DBTag-should-be-a-checkbox-checked.png index 03bd8627b3c..303ed8f4376 100644 Binary files a/__snapshots__/tag/component/firefox/DBTag-should-be-a-checkbox-checked.png and b/__snapshots__/tag/component/firefox/DBTag-should-be-a-checkbox-checked.png differ diff --git a/__snapshots__/tag/component/mobile-chrome/DBTag-should-be-a-checkbox-checked.png b/__snapshots__/tag/component/mobile-chrome/DBTag-should-be-a-checkbox-checked.png index d955b6d3610..8bc5f8cb0bd 100644 Binary files a/__snapshots__/tag/component/mobile-chrome/DBTag-should-be-a-checkbox-checked.png and b/__snapshots__/tag/component/mobile-chrome/DBTag-should-be-a-checkbox-checked.png differ diff --git a/docs/development.md b/docs/development.md index ab4b9466c22..a62ede7d9ec 100644 --- a/docs/development.md +++ b/docs/development.md @@ -36,5 +36,5 @@ npx playwright test --update-snapshots You can also use `docker-compose` to test or regenerate screenshots. -- testing: `docker-compose -f ./e2e/docker-compose.yml up` -- update screenshots: `docker-compose -f ./e2e/docker-compose.regenerate.yml up` +- testing: `docker-compose -f ./e2e/docker-compose.yml up` +- update screenshots: `docker-compose -f ./e2e/docker-compose.regenerate.yml up` diff --git a/packages/components/scripts/utils/index.ts b/packages/components/scripts/utils/index.ts index 2e01b14a794..7ea0b19c7a1 100644 --- a/packages/components/scripts/utils/index.ts +++ b/packages/components/scripts/utils/index.ts @@ -21,6 +21,11 @@ export const runReplacements = ( replacements = [...replacements, ...component.overwrites.global]; } + replacements.push({ + from: ',\n' + ',', + to: ',' + }); + for (const replacement of replacements) { const option = { files: file, diff --git a/packages/components/src/components/badge/badge.lite.tsx b/packages/components/src/components/badge/badge.lite.tsx index 402e6449f3b..c0a11fe0e57 100644 --- a/packages/components/src/components/badge/badge.lite.tsx +++ b/packages/components/src/components/badge/badge.lite.tsx @@ -1,6 +1,7 @@ import { onMount, onUpdate, + Show, useMetadata, useRef, useStore @@ -51,7 +52,9 @@ export default function DBBadge(props: DBBadgeProps) { props.placement?.startsWith('corner') && (props.label ?? DEFAULT_LABEL) }> - {props.children} + + {props.text} + ); } diff --git a/packages/components/src/components/badge/model.ts b/packages/components/src/components/badge/model.ts index 9307b8d2732..3773cfe1936 100644 --- a/packages/components/src/components/badge/model.ts +++ b/packages/components/src/components/badge/model.ts @@ -4,7 +4,8 @@ import { GlobalState, InitializedState, SemanticProps, - SizeProps + SizeProps, + TextProps } from '../../shared/model'; export const BadgePlacementList = [ @@ -34,7 +35,8 @@ export type DBBadgeProps = DBBadgeDefaultProps & GlobalProps & SemanticProps & SizeProps & - EmphasisProps; + EmphasisProps & + TextProps; export type DBBadgeDefaultState = {}; diff --git a/packages/components/src/components/brand/brand.lite.tsx b/packages/components/src/components/brand/brand.lite.tsx index 96e995aef9e..0fac1db160b 100644 --- a/packages/components/src/components/brand/brand.lite.tsx +++ b/packages/components/src/components/brand/brand.lite.tsx @@ -1,5 +1,5 @@ -import { useMetadata, useRef, useStore } from '@builder.io/mitosis'; -import { cls } from '../../utils'; +import { Show, useMetadata, useRef, useStore } from '@builder.io/mitosis'; +import { cls, getHideIcon } from '../../utils'; import { DBBrandProps, DBBrandState } from './model'; import { DEFAULT_ICON } from '../../shared/constants'; @@ -15,9 +15,12 @@ export default function DBBrand(props: DBBrandProps) {
- {props.children} + + {props.text} +
); } diff --git a/packages/components/src/components/brand/model.ts b/packages/components/src/components/brand/model.ts index c18d7387b9f..2b6b2f5ce87 100644 --- a/packages/components/src/components/brand/model.ts +++ b/packages/components/src/components/brand/model.ts @@ -1,13 +1,23 @@ -import { GlobalProps, GlobalState, IconProps } from '../../shared/model'; +import { + GlobalProps, + GlobalState, + IconProps, + ShowIconProps, + TextProps +} from '../../shared/model'; export type DBBrandDefaultProps = { /** - * Disable the default logo svg to pass in a custom `img` + * @deprecated: Disable the default logo svg to pass in a custom `img` */ hideLogo?: boolean; }; -export type DBBrandProps = DBBrandDefaultProps & GlobalProps & IconProps; +export type DBBrandProps = DBBrandDefaultProps & + GlobalProps & + IconProps & + ShowIconProps & + TextProps; export type DBBrandDefaultState = {}; diff --git a/packages/components/src/components/button/button.lite.tsx b/packages/components/src/components/button/button.lite.tsx index ef0d1b20f83..396f04321ae 100644 --- a/packages/components/src/components/button/button.lite.tsx +++ b/packages/components/src/components/button/button.lite.tsx @@ -1,6 +1,6 @@ -import { useMetadata, useRef, useStore } from '@builder.io/mitosis'; +import { Show, useMetadata, useRef, useStore } from '@builder.io/mitosis'; import type { DBButtonProps, DBButtonState } from './model'; -import { cls, getBooleanAsString } from '../../utils'; +import { cls, getBooleanAsString, getHideIcon } from '../../utils'; import { ClickEvent } from '../../shared/model'; useMetadata({}); @@ -27,6 +27,7 @@ export default function DBButton(props: DBButtonProps) { disabled={props.disabled} aria-label={props.label} data-icon={props.icon} + data-hide-icon={getHideIcon(props.showIcon)} data-size={props.size} data-state={props.state} data-width={props.width} @@ -40,7 +41,9 @@ export default function DBButton(props: DBButtonProps) { onClick={(event: ClickEvent) => state.handleClick(event) }> - {props.children} + + {props.text} + ); } diff --git a/packages/components/src/components/button/model.ts b/packages/components/src/components/button/model.ts index 469b2cf6094..752342f7b7d 100644 --- a/packages/components/src/components/button/model.ts +++ b/packages/components/src/components/button/model.ts @@ -4,7 +4,9 @@ import { GlobalProps, GlobalState, IconProps, + ShowIconProps, SizeProps, + TextProps, WidthProps } from '../../shared/model'; @@ -79,7 +81,9 @@ export type DBButtonProps = DBButtonDefaultProps & ClickEventProps & IconProps & WidthProps & - SizeProps; + SizeProps & + ShowIconProps & + TextProps; export type DBButtonDefaultState = {}; diff --git a/packages/components/src/components/checkbox/checkbox.lite.tsx b/packages/components/src/components/checkbox/checkbox.lite.tsx index 40e0083c26c..8acd9cf9ac0 100644 --- a/packages/components/src/components/checkbox/checkbox.lite.tsx +++ b/packages/components/src/components/checkbox/checkbox.lite.tsx @@ -17,7 +17,10 @@ import { DEFAULT_VALID_MESSAGE_ID_SUFFIX } from '../../shared/constants'; import { ChangeEvent, InteractionEvent } from '../../shared/model'; -import { handleFrameworkEvent } from '../../utils/form-components'; +import { + handleFrameworkEvent, + messageVisible +} from '../../utils/form-components'; import DBInfotext from '../infotext/infotext.lite'; useMetadata({}); @@ -167,13 +170,12 @@ export default function DBCheckbox(props: DBCheckboxProps) { } aria-describedby={state._descByIds} /> - - {props.label} + + {props.label} - {props.children} - +