diff --git a/docs/migration/v0.4.x-to-v0.5.x.md b/docs/migration/v0.4.x-to-v0.5.x.md new file mode 100644 index 00000000000..07e91ec3eb1 --- /dev/null +++ b/docs/migration/v0.4.x-to-v0.5.x.md @@ -0,0 +1,3 @@ +## Migration Beta (0.4.x) ➡ Beta (0.5.x) + +No breaking changes diff --git a/docs/migration/v0.5.x-to-v0.6.x.md b/docs/migration/v0.5.x-to-v0.6.x.md new file mode 100644 index 00000000000..4d4e493b408 --- /dev/null +++ b/docs/migration/v0.5.x-to-v0.6.x.md @@ -0,0 +1,18 @@ +## Migration Beta (0.5.x) ➡ Beta (0.6.x) + +### Components + +We changed some properties for components to align with Figma properties: + +#### Accordion-Item + +- `content` ➡️ `text` + +#### Notification + +- `behaviour="closeable|permanent"` ➡️ `closeable="true/false"`- Defaults to `false` + +#### Form-Components (Input, Select, Checkbox, Radio, Switch, Textarea) + +- `variant="hidden"` ➡️ `showLabel="true/false"` - Defaults to `true` +- `customValidity` ➡️ `validation` diff --git a/packages/components/src/components/accordion-item/accordion-item.lite.tsx b/packages/components/src/components/accordion-item/accordion-item.lite.tsx index 73c5f774a3d..2a8405667ed 100644 --- a/packages/components/src/components/accordion-item/accordion-item.lite.tsx +++ b/packages/components/src/components/accordion-item/accordion-item.lite.tsx @@ -53,8 +53,8 @@ export default function DBAccordionItem(props: DBAccordionItemProps) {
- - {props.content} + + {props.text}
diff --git a/packages/components/src/components/accordion-item/model.ts b/packages/components/src/components/accordion-item/model.ts index c66135fa6eb..b52dc5144cb 100644 --- a/packages/components/src/components/accordion-item/model.ts +++ b/packages/components/src/components/accordion-item/model.ts @@ -1,15 +1,12 @@ import { GlobalProps, GlobalState, + TextProps, ToggleEventProps, ToggleEventState } from '../../shared/model'; export type DBAccordionItemDefaultProps = { - /** - * Alternative for passing only a string instead of children - */ - content?: string; /** * Initial state for the accordion item */ @@ -34,7 +31,8 @@ export type DBAccordionItemDefaultProps = { export type DBAccordionItemProps = DBAccordionItemDefaultProps & GlobalProps & - ToggleEventProps; + ToggleEventProps & + TextProps; export type DBAccordionItemDefaultState = { _open: boolean; diff --git a/packages/components/src/components/brand/brand.lite.tsx b/packages/components/src/components/brand/brand.lite.tsx index 0fac1db160b..c5e4135f7c0 100644 --- a/packages/components/src/components/brand/brand.lite.tsx +++ b/packages/components/src/components/brand/brand.lite.tsx @@ -1,5 +1,5 @@ import { Show, useMetadata, useRef, useStore } from '@builder.io/mitosis'; -import { cls, getHideIcon } from '../../utils'; +import { cls, getHideProp } from '../../utils'; import { DBBrandProps, DBBrandState } from './model'; import { DEFAULT_ICON } from '../../shared/constants'; @@ -15,7 +15,7 @@ export default function DBBrand(props: DBBrandProps) {
diff --git a/packages/components/src/components/button/button.lite.tsx b/packages/components/src/components/button/button.lite.tsx index 396f04321ae..13a1b5ecb7c 100644 --- a/packages/components/src/components/button/button.lite.tsx +++ b/packages/components/src/components/button/button.lite.tsx @@ -1,6 +1,6 @@ import { Show, useMetadata, useRef, useStore } from '@builder.io/mitosis'; import type { DBButtonProps, DBButtonState } from './model'; -import { cls, getBooleanAsString, getHideIcon } from '../../utils'; +import { cls, getBooleanAsString, getHideProp } from '../../utils'; import { ClickEvent } from '../../shared/model'; useMetadata({}); @@ -27,7 +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-hide-icon={getHideProp(props.showIcon)} data-size={props.size} data-state={props.state} data-width={props.width} diff --git a/packages/components/src/components/checkbox/checkbox.lite.tsx b/packages/components/src/components/checkbox/checkbox.lite.tsx index 8acd9cf9ac0..a01a882bc4f 100644 --- a/packages/components/src/components/checkbox/checkbox.lite.tsx +++ b/packages/components/src/components/checkbox/checkbox.lite.tsx @@ -8,7 +8,14 @@ import { useTarget } from '@builder.io/mitosis'; import { DBCheckboxProps, DBCheckboxState } from './model'; -import { cls, delay, hasVoiceOver, uuid } from '../../utils'; +import { + cls, + delay, + getBooleanAsString, + getHideProp, + hasVoiceOver, + uuid +} from '../../utils'; import { DEFAULT_INVALID_MESSAGE, DEFAULT_INVALID_MESSAGE_ID_SUFFIX, @@ -51,7 +58,7 @@ export default function DBCheckbox(props: DBCheckboxProps) { }); /* For a11y reasons we need to map the correct message with the checkbox */ - if (!ref?.validity.valid || props.customValidity === 'invalid') { + if (!ref?.validity.valid || props.validation === 'invalid') { state._descByIds = state._invalidMessageId; if (hasVoiceOver()) { state._voiceOverFallback = @@ -61,7 +68,7 @@ export default function DBCheckbox(props: DBCheckboxProps) { delay(() => (state._voiceOverFallback = ''), 1000); } } else if ( - props.customValidity === 'valid' || + props.validation === 'valid' || (ref?.validity.valid && props.required) ) { state._descByIds = state._validMessageId; @@ -146,11 +153,11 @@ export default function DBCheckbox(props: DBCheckboxProps) {
+ data-hide-label={getHideProp(props.showLabel)}>