@metamask-previews/design-system-react-native 0.56.2-preview-473aecb → 0.56.2-preview-91ce2ce2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/KeyValueSelect/KeyValueSelect.types.cjs.map +1 -1
- package/dist/components/KeyValueSelect/KeyValueSelect.types.d.cts +1 -1
- package/dist/components/KeyValueSelect/KeyValueSelect.types.d.cts.map +1 -1
- package/dist/components/KeyValueSelect/KeyValueSelect.types.d.mts +1 -1
- package/dist/components/KeyValueSelect/KeyValueSelect.types.d.mts.map +1 -1
- package/dist/components/KeyValueSelect/KeyValueSelect.types.mjs.map +1 -1
- package/dist/components/SelectButton/SelectButton.cjs +10 -3
- package/dist/components/SelectButton/SelectButton.cjs.map +1 -1
- package/dist/components/SelectButton/SelectButton.d.cts +1 -1
- package/dist/components/SelectButton/SelectButton.d.cts.map +1 -1
- package/dist/components/SelectButton/SelectButton.d.mts +1 -1
- package/dist/components/SelectButton/SelectButton.d.mts.map +1 -1
- package/dist/components/SelectButton/SelectButton.mjs +10 -3
- package/dist/components/SelectButton/SelectButton.mjs.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyValueSelect.types.cjs","sourceRoot":"","sources":["../../../src/components/KeyValueSelect/KeyValueSelect.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n KeyValueSelectPropsShared,\n KeyValueSelectSelectButtonPropsShared,\n} from '@metamask-previews/design-system-shared';\nimport type { PressableProps } from 'react-native';\n\nimport type { ButtonIconProps } from '../ButtonIcon/ButtonIcon.types';\nimport type { IconProps } from '../Icon/Icon.types';\nimport type { KeyValueRowProps } from '../KeyValueRow/KeyValueRow.types';\nimport type { TextProps } from '../Text/Text.types';\n\n/**\n * SelectButton-only props for KeyValueSelect (RN).\n * Size is always Md and variant is always Secondary.\n */\nexport type KeyValueSelectSelectButtonProps =\n KeyValueSelectSelectButtonPropsShared & {\n /**\n * Optional props passed to the SelectButton trailing arrow Icon when a trailing\n * arrow is shown (excluding `name`, which is derived from the resolved direction).\n */\n endArrowDirectionIconProps?: Partial<Omit<IconProps, 'name'>>;\n };\n\n/**\n * KeyValueRow shell / ViewProps escape hatch.\n * Owned KeyValueSelect content props are omitted so the public API stays the source of truth.\n */\nexport type KeyValueSelectKeyValueRowProps = Omit<\n KeyValueRowProps,\n | 'keyLabel'\n | 'keyStartAccessory'\n | 'keyEndAccessory'\n | 'keyTextProps'\n | 'keyEndButtonIconProps'\n | 'value'\n | 'valueStartAccessory'\n | 'valueEndAccessory'\n | 'valueTextProps'\n | 'valueEndButtonIconProps'\n | 'variant'\n>;\n\n/**\n * KeyValueSelect component props.\n *\n * Pressable KeyValueRow with a SelectButton value. Value-side KeyValueRow props\n * map onto SelectButton; SelectButton-only options use `selectButtonProps`.\n * Use `keyValueRowProps` for inner KeyValueRow shell props (e.g. `testID`, `twClassName`).\n */\nexport type KeyValueSelectProps = Omit<\n KeyValueSelectPropsShared,\n 'selectButtonProps'\n> &\n Omit<PressableProps, 'children' | 'disabled'> & {\n /** Optional props for the key Text when key is a string. */\n keyTextProps?: Partial<Omit<TextProps, 'children'>>;\n /** When set, renders a ButtonIcon as the key endAccessory (takes precedence over keyEndAccessory). */\n keyEndButtonIconProps?: Partial<ButtonIconProps>;\n /** Optional props for the SelectButton label Text. Mapped from KeyValueRow `valueTextProps`. */\n valueTextProps?: Partial<Omit<TextProps, 'children'>>;\n /** SelectButton-only props (placeholder and caret controls). */\n selectButtonProps: KeyValueSelectSelectButtonProps;\n /**\n * Optional props forwarded to the inner KeyValueRow (e.g. `testID`, `twClassName`, `style`,\n * accessibility props). Owned content props are set by KeyValueSelect and are not available here.\n */\n keyValueRowProps?: KeyValueSelectKeyValueRowProps;\n /** Optional Tailwind class names applied to the outer Pressable. */\n twClassName?: string;\n };\n"]}
|
|
1
|
+
{"version":3,"file":"KeyValueSelect.types.cjs","sourceRoot":"","sources":["../../../src/components/KeyValueSelect/KeyValueSelect.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n KeyValueSelectPropsShared,\n KeyValueSelectSelectButtonPropsShared,\n} from '@metamask-previews/design-system-shared';\nimport type { PressableProps } from 'react-native';\n\nimport type { ButtonIconProps } from '../ButtonIcon/ButtonIcon.types';\nimport type { IconProps } from '../Icon/Icon.types';\nimport type { KeyValueRowProps } from '../KeyValueRow/KeyValueRow.types';\nimport type { TextProps } from '../Text/Text.types';\n\n/**\n * SelectButton-only props for KeyValueSelect (RN).\n * Size is always Md and variant is always Secondary.\n */\nexport type KeyValueSelectSelectButtonProps =\n KeyValueSelectSelectButtonPropsShared & {\n /**\n * Optional props passed to the SelectButton trailing arrow Icon when a trailing\n * arrow is shown (excluding `name`, which is derived from the resolved direction).\n */\n endArrowDirectionIconProps?: Partial<Omit<IconProps, 'name'>>;\n };\n\n/**\n * KeyValueRow shell / ViewProps escape hatch.\n * Owned KeyValueSelect content props are omitted so the public API stays the source of truth.\n */\nexport type KeyValueSelectKeyValueRowProps = Omit<\n KeyValueRowProps,\n | 'keyLabel'\n | 'keyStartAccessory'\n | 'keyEndAccessory'\n | 'keyTextProps'\n | 'keyEndButtonIconProps'\n | 'value'\n | 'valueStartAccessory'\n | 'valueEndAccessory'\n | 'valueTextProps'\n | 'valueEndButtonIconProps'\n | 'variant'\n>;\n\n/**\n * KeyValueSelect component props.\n *\n * Pressable KeyValueRow with a SelectButton value. Value-side KeyValueRow props\n * map onto SelectButton; SelectButton-only options use `selectButtonProps`.\n * Use `keyValueRowProps` for inner KeyValueRow shell props (e.g. `testID`, `twClassName`).\n */\nexport type KeyValueSelectProps = Omit<\n KeyValueSelectPropsShared,\n 'selectButtonProps'\n> &\n Omit<PressableProps, 'children' | 'disabled'> & {\n /** Optional props for the key Text when key is a string. */\n keyTextProps?: Partial<Omit<TextProps, 'children'>>;\n /** When set, renders a ButtonIcon as the key endAccessory (takes precedence over keyEndAccessory). */\n keyEndButtonIconProps?: Partial<ButtonIconProps>;\n /** Optional props for the SelectButton label Text. Mapped from KeyValueRow `valueTextProps`. */\n valueTextProps?: Partial<Omit<TextProps, 'children'>>;\n /** SelectButton-only props (placeholder and caret controls). `placeholder` is optional; when the resolved label is empty, no label is rendered. */\n selectButtonProps: KeyValueSelectSelectButtonProps;\n /**\n * Optional props forwarded to the inner KeyValueRow (e.g. `testID`, `twClassName`, `style`,\n * accessibility props). Owned content props are set by KeyValueSelect and are not available here.\n */\n keyValueRowProps?: KeyValueSelectKeyValueRowProps;\n /** Optional Tailwind class names applied to the outer Pressable. */\n twClassName?: string;\n };\n"]}
|
|
@@ -34,7 +34,7 @@ export type KeyValueSelectProps = Omit<KeyValueSelectPropsShared, 'selectButtonP
|
|
|
34
34
|
keyEndButtonIconProps?: Partial<ButtonIconProps>;
|
|
35
35
|
/** Optional props for the SelectButton label Text. Mapped from KeyValueRow `valueTextProps`. */
|
|
36
36
|
valueTextProps?: Partial<Omit<TextProps, 'children'>>;
|
|
37
|
-
/** SelectButton-only props (placeholder and caret controls). */
|
|
37
|
+
/** SelectButton-only props (placeholder and caret controls). `placeholder` is optional; when the resolved label is empty, no label is rendered. */
|
|
38
38
|
selectButtonProps: KeyValueSelectSelectButtonProps;
|
|
39
39
|
/**
|
|
40
40
|
* Optional props forwarded to the inner KeyValueRow (e.g. `testID`, `twClassName`, `style`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyValueSelect.types.d.cts","sourceRoot":"","sources":["../../../src/components/KeyValueSelect/KeyValueSelect.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,qCAAqC,EACtC,gDAAgD;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,2CAAuC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA2B;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,6CAAyC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA2B;AAEpD;;;GAGG;AACH,MAAM,MAAM,+BAA+B,GACzC,qCAAqC,GAAG;IACtC;;;OAGG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;CAC/D,CAAC;AAEJ;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAC/C,gBAAgB,EACd,UAAU,GACV,mBAAmB,GACnB,iBAAiB,GACjB,cAAc,GACd,uBAAuB,GACvB,OAAO,GACP,qBAAqB,GACrB,mBAAmB,GACnB,gBAAgB,GAChB,yBAAyB,GACzB,SAAS,CACZ,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,yBAAyB,EACzB,mBAAmB,CACpB,GACC,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,UAAU,CAAC,GAAG;IAC9C,4DAA4D;IAC5D,YAAY,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACpD,sGAAsG;IACtG,qBAAqB,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjD,gGAAgG;IAChG,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACtD,
|
|
1
|
+
{"version":3,"file":"KeyValueSelect.types.d.cts","sourceRoot":"","sources":["../../../src/components/KeyValueSelect/KeyValueSelect.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,qCAAqC,EACtC,gDAAgD;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,2CAAuC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA2B;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,6CAAyC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA2B;AAEpD;;;GAGG;AACH,MAAM,MAAM,+BAA+B,GACzC,qCAAqC,GAAG;IACtC;;;OAGG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;CAC/D,CAAC;AAEJ;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAC/C,gBAAgB,EACd,UAAU,GACV,mBAAmB,GACnB,iBAAiB,GACjB,cAAc,GACd,uBAAuB,GACvB,OAAO,GACP,qBAAqB,GACrB,mBAAmB,GACnB,gBAAgB,GAChB,yBAAyB,GACzB,SAAS,CACZ,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,yBAAyB,EACzB,mBAAmB,CACpB,GACC,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,UAAU,CAAC,GAAG;IAC9C,4DAA4D;IAC5D,YAAY,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACpD,sGAAsG;IACtG,qBAAqB,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjD,gGAAgG;IAChG,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACtD,mJAAmJ;IACnJ,iBAAiB,EAAE,+BAA+B,CAAC;IACnD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,8BAA8B,CAAC;IAClD,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -34,7 +34,7 @@ export type KeyValueSelectProps = Omit<KeyValueSelectPropsShared, 'selectButtonP
|
|
|
34
34
|
keyEndButtonIconProps?: Partial<ButtonIconProps>;
|
|
35
35
|
/** Optional props for the SelectButton label Text. Mapped from KeyValueRow `valueTextProps`. */
|
|
36
36
|
valueTextProps?: Partial<Omit<TextProps, 'children'>>;
|
|
37
|
-
/** SelectButton-only props (placeholder and caret controls). */
|
|
37
|
+
/** SelectButton-only props (placeholder and caret controls). `placeholder` is optional; when the resolved label is empty, no label is rendered. */
|
|
38
38
|
selectButtonProps: KeyValueSelectSelectButtonProps;
|
|
39
39
|
/**
|
|
40
40
|
* Optional props forwarded to the inner KeyValueRow (e.g. `testID`, `twClassName`, `style`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyValueSelect.types.d.mts","sourceRoot":"","sources":["../../../src/components/KeyValueSelect/KeyValueSelect.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,qCAAqC,EACtC,gDAAgD;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,2CAAuC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA2B;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,6CAAyC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA2B;AAEpD;;;GAGG;AACH,MAAM,MAAM,+BAA+B,GACzC,qCAAqC,GAAG;IACtC;;;OAGG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;CAC/D,CAAC;AAEJ;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAC/C,gBAAgB,EACd,UAAU,GACV,mBAAmB,GACnB,iBAAiB,GACjB,cAAc,GACd,uBAAuB,GACvB,OAAO,GACP,qBAAqB,GACrB,mBAAmB,GACnB,gBAAgB,GAChB,yBAAyB,GACzB,SAAS,CACZ,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,yBAAyB,EACzB,mBAAmB,CACpB,GACC,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,UAAU,CAAC,GAAG;IAC9C,4DAA4D;IAC5D,YAAY,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACpD,sGAAsG;IACtG,qBAAqB,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjD,gGAAgG;IAChG,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACtD,
|
|
1
|
+
{"version":3,"file":"KeyValueSelect.types.d.mts","sourceRoot":"","sources":["../../../src/components/KeyValueSelect/KeyValueSelect.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,qCAAqC,EACtC,gDAAgD;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,qBAAqB;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,2CAAuC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA2B;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,6CAAyC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,+BAA2B;AAEpD;;;GAGG;AACH,MAAM,MAAM,+BAA+B,GACzC,qCAAqC,GAAG;IACtC;;;OAGG;IACH,0BAA0B,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC;CAC/D,CAAC;AAEJ;;;GAGG;AACH,MAAM,MAAM,8BAA8B,GAAG,IAAI,CAC/C,gBAAgB,EACd,UAAU,GACV,mBAAmB,GACnB,iBAAiB,GACjB,cAAc,GACd,uBAAuB,GACvB,OAAO,GACP,qBAAqB,GACrB,mBAAmB,GACnB,gBAAgB,GAChB,yBAAyB,GACzB,SAAS,CACZ,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,yBAAyB,EACzB,mBAAmB,CACpB,GACC,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,UAAU,CAAC,GAAG;IAC9C,4DAA4D;IAC5D,YAAY,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACpD,sGAAsG;IACtG,qBAAqB,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACjD,gGAAgG;IAChG,cAAc,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IACtD,mJAAmJ;IACnJ,iBAAiB,EAAE,+BAA+B,CAAC;IACnD;;;OAGG;IACH,gBAAgB,CAAC,EAAE,8BAA8B,CAAC;IAClD,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeyValueSelect.types.mjs","sourceRoot":"","sources":["../../../src/components/KeyValueSelect/KeyValueSelect.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n KeyValueSelectPropsShared,\n KeyValueSelectSelectButtonPropsShared,\n} from '@metamask-previews/design-system-shared';\nimport type { PressableProps } from 'react-native';\n\nimport type { ButtonIconProps } from '../ButtonIcon/ButtonIcon.types';\nimport type { IconProps } from '../Icon/Icon.types';\nimport type { KeyValueRowProps } from '../KeyValueRow/KeyValueRow.types';\nimport type { TextProps } from '../Text/Text.types';\n\n/**\n * SelectButton-only props for KeyValueSelect (RN).\n * Size is always Md and variant is always Secondary.\n */\nexport type KeyValueSelectSelectButtonProps =\n KeyValueSelectSelectButtonPropsShared & {\n /**\n * Optional props passed to the SelectButton trailing arrow Icon when a trailing\n * arrow is shown (excluding `name`, which is derived from the resolved direction).\n */\n endArrowDirectionIconProps?: Partial<Omit<IconProps, 'name'>>;\n };\n\n/**\n * KeyValueRow shell / ViewProps escape hatch.\n * Owned KeyValueSelect content props are omitted so the public API stays the source of truth.\n */\nexport type KeyValueSelectKeyValueRowProps = Omit<\n KeyValueRowProps,\n | 'keyLabel'\n | 'keyStartAccessory'\n | 'keyEndAccessory'\n | 'keyTextProps'\n | 'keyEndButtonIconProps'\n | 'value'\n | 'valueStartAccessory'\n | 'valueEndAccessory'\n | 'valueTextProps'\n | 'valueEndButtonIconProps'\n | 'variant'\n>;\n\n/**\n * KeyValueSelect component props.\n *\n * Pressable KeyValueRow with a SelectButton value. Value-side KeyValueRow props\n * map onto SelectButton; SelectButton-only options use `selectButtonProps`.\n * Use `keyValueRowProps` for inner KeyValueRow shell props (e.g. `testID`, `twClassName`).\n */\nexport type KeyValueSelectProps = Omit<\n KeyValueSelectPropsShared,\n 'selectButtonProps'\n> &\n Omit<PressableProps, 'children' | 'disabled'> & {\n /** Optional props for the key Text when key is a string. */\n keyTextProps?: Partial<Omit<TextProps, 'children'>>;\n /** When set, renders a ButtonIcon as the key endAccessory (takes precedence over keyEndAccessory). */\n keyEndButtonIconProps?: Partial<ButtonIconProps>;\n /** Optional props for the SelectButton label Text. Mapped from KeyValueRow `valueTextProps`. */\n valueTextProps?: Partial<Omit<TextProps, 'children'>>;\n /** SelectButton-only props (placeholder and caret controls). */\n selectButtonProps: KeyValueSelectSelectButtonProps;\n /**\n * Optional props forwarded to the inner KeyValueRow (e.g. `testID`, `twClassName`, `style`,\n * accessibility props). Owned content props are set by KeyValueSelect and are not available here.\n */\n keyValueRowProps?: KeyValueSelectKeyValueRowProps;\n /** Optional Tailwind class names applied to the outer Pressable. */\n twClassName?: string;\n };\n"]}
|
|
1
|
+
{"version":3,"file":"KeyValueSelect.types.mjs","sourceRoot":"","sources":["../../../src/components/KeyValueSelect/KeyValueSelect.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n KeyValueSelectPropsShared,\n KeyValueSelectSelectButtonPropsShared,\n} from '@metamask-previews/design-system-shared';\nimport type { PressableProps } from 'react-native';\n\nimport type { ButtonIconProps } from '../ButtonIcon/ButtonIcon.types';\nimport type { IconProps } from '../Icon/Icon.types';\nimport type { KeyValueRowProps } from '../KeyValueRow/KeyValueRow.types';\nimport type { TextProps } from '../Text/Text.types';\n\n/**\n * SelectButton-only props for KeyValueSelect (RN).\n * Size is always Md and variant is always Secondary.\n */\nexport type KeyValueSelectSelectButtonProps =\n KeyValueSelectSelectButtonPropsShared & {\n /**\n * Optional props passed to the SelectButton trailing arrow Icon when a trailing\n * arrow is shown (excluding `name`, which is derived from the resolved direction).\n */\n endArrowDirectionIconProps?: Partial<Omit<IconProps, 'name'>>;\n };\n\n/**\n * KeyValueRow shell / ViewProps escape hatch.\n * Owned KeyValueSelect content props are omitted so the public API stays the source of truth.\n */\nexport type KeyValueSelectKeyValueRowProps = Omit<\n KeyValueRowProps,\n | 'keyLabel'\n | 'keyStartAccessory'\n | 'keyEndAccessory'\n | 'keyTextProps'\n | 'keyEndButtonIconProps'\n | 'value'\n | 'valueStartAccessory'\n | 'valueEndAccessory'\n | 'valueTextProps'\n | 'valueEndButtonIconProps'\n | 'variant'\n>;\n\n/**\n * KeyValueSelect component props.\n *\n * Pressable KeyValueRow with a SelectButton value. Value-side KeyValueRow props\n * map onto SelectButton; SelectButton-only options use `selectButtonProps`.\n * Use `keyValueRowProps` for inner KeyValueRow shell props (e.g. `testID`, `twClassName`).\n */\nexport type KeyValueSelectProps = Omit<\n KeyValueSelectPropsShared,\n 'selectButtonProps'\n> &\n Omit<PressableProps, 'children' | 'disabled'> & {\n /** Optional props for the key Text when key is a string. */\n keyTextProps?: Partial<Omit<TextProps, 'children'>>;\n /** When set, renders a ButtonIcon as the key endAccessory (takes precedence over keyEndAccessory). */\n keyEndButtonIconProps?: Partial<ButtonIconProps>;\n /** Optional props for the SelectButton label Text. Mapped from KeyValueRow `valueTextProps`. */\n valueTextProps?: Partial<Omit<TextProps, 'children'>>;\n /** SelectButton-only props (placeholder and caret controls). `placeholder` is optional; when the resolved label is empty, no label is rendered. */\n selectButtonProps: KeyValueSelectSelectButtonProps;\n /**\n * Optional props forwarded to the inner KeyValueRow (e.g. `testID`, `twClassName`, `style`,\n * accessibility props). Owned content props are set by KeyValueSelect and are not available here.\n */\n keyValueRowProps?: KeyValueSelectKeyValueRowProps;\n /** Optional Tailwind class names applied to the outer Pressable. */\n twClassName?: string;\n };\n"]}
|
|
@@ -10,9 +10,16 @@ const ButtonBase_1 = require("../ButtonBase/index.cjs");
|
|
|
10
10
|
const Icon_1 = require("../Icon/index.cjs");
|
|
11
11
|
const Text_1 = require("../Text/index.cjs");
|
|
12
12
|
const SelectButton_constants_1 = require("./SelectButton.constants.cjs");
|
|
13
|
-
const SelectButton = ({ placeholder, value, textProps, startAccessory, endArrowDirection, endAccessory, hideEndArrow = false, isDisabled = false, isFullWidth = false, endArrowDirectionIconProps, variant = design_system_shared_1.SelectButtonVariant.Primary, isLoading = false, size = design_system_shared_1.SelectButtonSize.Sm, twClassName = '', style, ...buttonBaseRest }) => {
|
|
13
|
+
const SelectButton = ({ placeholder, value, textProps, startAccessory, endArrowDirection, endAccessory, hideEndArrow = false, isDisabled = false, isFullWidth = false, endArrowDirectionIconProps, variant = design_system_shared_1.SelectButtonVariant.Primary, isLoading = false, size = design_system_shared_1.SelectButtonSize.Sm, twClassName = '', style, accessibilityLabel, ...buttonBaseRest }) => {
|
|
14
14
|
const labelContent = value ?? placeholder;
|
|
15
|
+
const hasLabel = Boolean(labelContent);
|
|
16
|
+
if (__DEV__ && !hasLabel && !accessibilityLabel) {
|
|
17
|
+
console.warn('SelectButton: no label is rendered because `value` and `placeholder` are missing or empty. Provide an `accessibilityLabel` so the control has an accessible name.');
|
|
18
|
+
}
|
|
15
19
|
const resolvedTextProps = {
|
|
20
|
+
// One-line ellipsis by default; callers override it through `textProps`.
|
|
21
|
+
numberOfLines: 1,
|
|
22
|
+
ellipsizeMode: 'tail',
|
|
16
23
|
...textProps,
|
|
17
24
|
twClassName: (0, design_system_shared_1.mergeTwClassName)(
|
|
18
25
|
// Ensure the label actually grows to push the end arrow when full width.
|
|
@@ -30,7 +37,7 @@ const SelectButton = ({ placeholder, value, textProps, startAccessory, endArrowD
|
|
|
30
37
|
if (hideEndArrow) {
|
|
31
38
|
resolvedEndArrowDirection = undefined;
|
|
32
39
|
}
|
|
33
|
-
else if (endArrowDirection !== undefined
|
|
40
|
+
else if (endArrowDirection !== undefined) {
|
|
34
41
|
resolvedEndArrowDirection = endArrowDirection;
|
|
35
42
|
}
|
|
36
43
|
else if (endAccessory) {
|
|
@@ -39,7 +46,7 @@ const SelectButton = ({ placeholder, value, textProps, startAccessory, endArrowD
|
|
|
39
46
|
else {
|
|
40
47
|
resolvedEndArrowDirection = design_system_shared_1.SelectButtonEndArrow.Down;
|
|
41
48
|
}
|
|
42
|
-
return (<ButtonBase_1.ButtonBase {...buttonBaseRest} size={size} isDisabled={isDisabled} isFullWidth={isFullWidth} isLoading={isLoading} children={labelContent} textProps={{
|
|
49
|
+
return (<ButtonBase_1.ButtonBase {...buttonBaseRest} size={size} isDisabled={isDisabled} isFullWidth={isFullWidth} isLoading={isLoading} accessibilityLabel={accessibilityLabel} children={hasLabel ? labelContent : undefined} textProps={{
|
|
43
50
|
...(variant === design_system_shared_1.SelectButtonVariant.Tertiary
|
|
44
51
|
? { color: Text_1.TextColor.TextAlternative }
|
|
45
52
|
: {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectButton.cjs","sourceRoot":"","sources":["../../../src/components/SelectButton/SelectButton.tsx"],"names":[],"mappings":";;;;;;AAAA,kFAKiD;AACjD,kDAA0B;AAE1B,wDAA2C;AAC3C,4CAAoC;AACpC,4CAAoC;AAEpC,yEAA6F;AAGtF,MAAM,YAAY,GAAG,CAAC,EAC3B,WAAW,EACX,KAAK,EACL,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,YAAY,GAAG,KAAK,EACpB,UAAU,GAAG,KAAK,EAClB,WAAW,GAAG,KAAK,EACnB,0BAA0B,EAC1B,OAAO,GAAG,0CAAmB,CAAC,OAAO,EACrC,SAAS,GAAG,KAAK,EACjB,IAAI,GAAG,uCAAgB,CAAC,EAAE,EAC1B,WAAW,GAAG,EAAE,EAChB,KAAK,EACL,GAAG,cAAc,EACC,EAAE,EAAE;IACtB,MAAM,YAAY,GAAG,KAAK,IAAI,WAAW,CAAC;IAC1C,MAAM,iBAAiB,GAAG;QACxB,GAAG,SAAS;QACZ,WAAW,EAAE,IAAA,uCAAgB;QAC3B,yEAAyE;QACzE,0EAA0E;QAC1E,iDAAiD;QACjD,WAAW,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,WAAW,EACnD,SAAS,EAAE,WAAW,CACvB;KACF,CAAC;IACF,MAAM,2BAA2B,GAAG,WAAW;QAC7C,CAAC,CAAC;YACE,GAAG,cAAc,CAAC,mBAAmB;YACrC,WAAW,EAAE,IAAA,uCAAgB,EAC3B,QAAQ,EACR,cAAc,CAAC,mBAAmB,EAAE,WAAW,CAChD;SACF;QACH,CAAC,CAAC,cAAc,CAAC,mBAAmB,CAAC;IAEvC,IAAI,yBAA2D,CAAC;IAChE,IAAI,YAAY,EAAE,CAAC;QACjB,yBAAyB,GAAG,SAAS,CAAC;IACxC,CAAC;SAAM,IAAI,iBAAiB,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"SelectButton.cjs","sourceRoot":"","sources":["../../../src/components/SelectButton/SelectButton.tsx"],"names":[],"mappings":";;;;;;AAAA,kFAKiD;AACjD,kDAA0B;AAE1B,wDAA2C;AAC3C,4CAAoC;AACpC,4CAAoC;AAEpC,yEAA6F;AAGtF,MAAM,YAAY,GAAG,CAAC,EAC3B,WAAW,EACX,KAAK,EACL,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,YAAY,GAAG,KAAK,EACpB,UAAU,GAAG,KAAK,EAClB,WAAW,GAAG,KAAK,EACnB,0BAA0B,EAC1B,OAAO,GAAG,0CAAmB,CAAC,OAAO,EACrC,SAAS,GAAG,KAAK,EACjB,IAAI,GAAG,uCAAgB,CAAC,EAAE,EAC1B,WAAW,GAAG,EAAE,EAChB,KAAK,EACL,kBAAkB,EAClB,GAAG,cAAc,EACC,EAAE,EAAE;IACtB,MAAM,YAAY,GAAG,KAAK,IAAI,WAAW,CAAC;I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C,kBAAkB,CAAC,CAAC,CAAC,UAAU,8BAC/D,OAAO,WAAW,KAAK,UAAU;gBAC/B,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC;gBACtB,CAAC,CAAC,WACN,EACN,CAAC,CACD,aAAa,CAAC,CAAC,GAAG,EAAE,CAClB,OAAO,KAAK,0CAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAClD,CAAC,CACD,aAAa,CAAC,CAAC,GAAG,EAAE,CAClB,OAAO,KAAK,0CAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAClD,CAAC,CACD,KAAK,CAAC,CAAC,KAAK,CAAC,EACb,CACH,CAAC;AACJ,CAAC,CAAC;AAxHW,QAAA,YAAY,gBAwHvB;AAEF,oBAAY,CAAC,WAAW,GAAG,cAAc,CAAC","sourcesContent":["import {\n mergeTwClassName,\n SelectButtonEndArrow,\n SelectButtonSize,\n SelectButtonVariant,\n} from '@metamask-previews/design-system-shared';\nimport React from 'react';\n\nimport { ButtonBase } from '../ButtonBase';\nimport { IconColor } from '../Icon';\nimport { TextColor } from '../Text';\n\nimport { MAP_SELECTBUTTON_END_ARROW_DIRECTION_TO_ICON_NAME } from './SelectButton.constants';\nimport type { SelectButtonProps } from './SelectButton.types';\n\nexport const SelectButton = ({\n placeholder,\n value,\n textProps,\n startAccessory,\n endArrowDirection,\n endAccessory,\n hideEndArrow = false,\n isDisabled = false,\n isFullWidth = false,\n endArrowDirectionIconProps,\n variant = SelectButtonVariant.Primary,\n isLoading = false,\n size = SelectButtonSize.Sm,\n twClassName = '',\n style,\n accessibilityLabel,\n ...buttonBaseRest\n}: SelectButtonProps) => {\n const labelContent = value ?? placeholder;\n const hasLabel = Boolean(labelContent);\n\n if (__DEV__ && !hasLabel && !accessibilityLabel) {\n console.warn(\n 'SelectButton: no label is rendered because `value` and `placeholder` are missing or empty. Provide an `accessibilityLabel` so the control has an accessible name.',\n );\n }\n\n const resolvedTextProps = {\n // One-line ellipsis by default; callers override it through `textProps`.\n numberOfLines: 1,\n ellipsizeMode: 'tail' as const,\n ...textProps,\n twClassName: mergeTwClassName(\n // Ensure the label actually grows to push the end arrow when full width.\n // ButtonBase applies 'grow-0' by default; add 'grow' here to override it.\n // Keep 'flex-1' for existing expectations/tests.\n isFullWidth ? 'text-left flex-1 grow' : 'text-left',\n textProps?.twClassName,\n ),\n };\n const resolvedContentWrapperProps = isFullWidth\n ? {\n ...buttonBaseRest.contentWrapperProps,\n twClassName: mergeTwClassName(\n 'w-full',\n buttonBaseRest.contentWrapperProps?.twClassName,\n ),\n }\n : buttonBaseRest.contentWrapperProps;\n\n let resolvedEndArrowDirection: SelectButtonEndArrow | undefined;\n if (hideEndArrow) {\n resolvedEndArrowDirection = undefined;\n } else if (endArrowDirection !== undefined) {\n resolvedEndArrowDirection = endArrowDirection;\n } else if (endAccessory) {\n resolvedEndArrowDirection = undefined;\n } else {\n resolvedEndArrowDirection = SelectButtonEndArrow.Down;\n }\n\n return (\n <ButtonBase\n {...buttonBaseRest}\n size={size}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isLoading={isLoading}\n accessibilityLabel={accessibilityLabel}\n children={hasLabel ? labelContent : undefined}\n textProps={{\n ...(variant === SelectButtonVariant.Tertiary\n ? { color: TextColor.TextAlternative }\n : {}),\n ...resolvedTextProps,\n }}\n contentWrapperProps={resolvedContentWrapperProps}\n startAccessory={startAccessory}\n endAccessory={resolvedEndArrowDirection ? undefined : endAccessory}\n endIconName={\n resolvedEndArrowDirection\n ? MAP_SELECTBUTTON_END_ARROW_DIRECTION_TO_ICON_NAME[\n resolvedEndArrowDirection\n ]\n : undefined\n }\n endIconProps={\n resolvedEndArrowDirection\n ? {\n ...(variant === SelectButtonVariant.Tertiary\n ? { color: IconColor.IconAlternative }\n : {}),\n ...endArrowDirectionIconProps,\n }\n : undefined\n }\n twClassName={(pressed) =>\n variant === SelectButtonVariant.Secondary ||\n variant === SelectButtonVariant.Tertiary\n ? `min-w-0 ${pressed || isLoading ? 'bg-pressed' : 'bg-transparent'} border-0 ${\n typeof twClassName === 'function'\n ? twClassName(pressed)\n : twClassName\n }`\n : `min-w-0 ${pressed || isLoading ? 'bg-muted-pressed' : 'bg-muted'} border-transparent border ${\n typeof twClassName === 'function'\n ? twClassName(pressed)\n : twClassName\n }`\n }\n textClassName={() =>\n variant === SelectButtonVariant.Tertiary ? '' : 'text-default'\n }\n iconClassName={() =>\n variant === SelectButtonVariant.Tertiary ? '' : 'text-default'\n }\n style={style}\n />\n );\n};\n\nSelectButton.displayName = 'SelectButton';\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { SelectButtonProps } from "./SelectButton.types.cjs";
|
|
3
3
|
export declare const SelectButton: {
|
|
4
|
-
({ placeholder, value, textProps, startAccessory, endArrowDirection, endAccessory, hideEndArrow, isDisabled, isFullWidth, endArrowDirectionIconProps, variant, isLoading, size, twClassName, style, ...buttonBaseRest }: SelectButtonProps): React.JSX.Element;
|
|
4
|
+
({ placeholder, value, textProps, startAccessory, endArrowDirection, endAccessory, hideEndArrow, isDisabled, isFullWidth, endArrowDirectionIconProps, variant, isLoading, size, twClassName, style, accessibilityLabel, ...buttonBaseRest }: SelectButtonProps): React.JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
7
7
|
//# sourceMappingURL=SelectButton.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectButton.d.cts","sourceRoot":"","sources":["../../../src/components/SelectButton/SelectButton.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,cAAc;AAO1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,iCAA6B;AAE9D,eAAO,MAAM,YAAY;
|
|
1
|
+
{"version":3,"file":"SelectButton.d.cts","sourceRoot":"","sources":["../../../src/components/SelectButton/SelectButton.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,cAAc;AAO1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,iCAA6B;AAE9D,eAAO,MAAM,YAAY;iPAkBtB,iBAAiB;;CAsGnB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { SelectButtonProps } from "./SelectButton.types.mjs";
|
|
3
3
|
export declare const SelectButton: {
|
|
4
|
-
({ placeholder, value, textProps, startAccessory, endArrowDirection, endAccessory, hideEndArrow, isDisabled, isFullWidth, endArrowDirectionIconProps, variant, isLoading, size, twClassName, style, ...buttonBaseRest }: SelectButtonProps): React.JSX.Element;
|
|
4
|
+
({ placeholder, value, textProps, startAccessory, endArrowDirection, endAccessory, hideEndArrow, isDisabled, isFullWidth, endArrowDirectionIconProps, variant, isLoading, size, twClassName, style, accessibilityLabel, ...buttonBaseRest }: SelectButtonProps): React.JSX.Element;
|
|
5
5
|
displayName: string;
|
|
6
6
|
};
|
|
7
7
|
//# sourceMappingURL=SelectButton.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectButton.d.mts","sourceRoot":"","sources":["../../../src/components/SelectButton/SelectButton.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,cAAc;AAO1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,iCAA6B;AAE9D,eAAO,MAAM,YAAY;
|
|
1
|
+
{"version":3,"file":"SelectButton.d.mts","sourceRoot":"","sources":["../../../src/components/SelectButton/SelectButton.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,cAAc;AAO1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,iCAA6B;AAE9D,eAAO,MAAM,YAAY;iPAkBtB,iBAAiB;;CAsGnB,CAAC"}
|
|
@@ -11,9 +11,16 @@ import { ButtonBase } from "../ButtonBase/index.mjs";
|
|
|
11
11
|
import { IconColor } from "../Icon/index.mjs";
|
|
12
12
|
import { TextColor } from "../Text/index.mjs";
|
|
13
13
|
import { MAP_SELECTBUTTON_END_ARROW_DIRECTION_TO_ICON_NAME } from "./SelectButton.constants.mjs";
|
|
14
|
-
export const SelectButton = ({ placeholder, value, textProps, startAccessory, endArrowDirection, endAccessory, hideEndArrow = false, isDisabled = false, isFullWidth = false, endArrowDirectionIconProps, variant = SelectButtonVariant.Primary, isLoading = false, size = SelectButtonSize.Sm, twClassName = '', style, ...buttonBaseRest }) => {
|
|
14
|
+
export const SelectButton = ({ placeholder, value, textProps, startAccessory, endArrowDirection, endAccessory, hideEndArrow = false, isDisabled = false, isFullWidth = false, endArrowDirectionIconProps, variant = SelectButtonVariant.Primary, isLoading = false, size = SelectButtonSize.Sm, twClassName = '', style, accessibilityLabel, ...buttonBaseRest }) => {
|
|
15
15
|
const labelContent = value ?? placeholder;
|
|
16
|
+
const hasLabel = Boolean(labelContent);
|
|
17
|
+
if (__DEV__ && !hasLabel && !accessibilityLabel) {
|
|
18
|
+
console.warn('SelectButton: no label is rendered because `value` and `placeholder` are missing or empty. Provide an `accessibilityLabel` so the control has an accessible name.');
|
|
19
|
+
}
|
|
16
20
|
const resolvedTextProps = {
|
|
21
|
+
// One-line ellipsis by default; callers override it through `textProps`.
|
|
22
|
+
numberOfLines: 1,
|
|
23
|
+
ellipsizeMode: 'tail',
|
|
17
24
|
...textProps,
|
|
18
25
|
twClassName: mergeTwClassName(
|
|
19
26
|
// Ensure the label actually grows to push the end arrow when full width.
|
|
@@ -31,7 +38,7 @@ export const SelectButton = ({ placeholder, value, textProps, startAccessory, en
|
|
|
31
38
|
if (hideEndArrow) {
|
|
32
39
|
resolvedEndArrowDirection = undefined;
|
|
33
40
|
}
|
|
34
|
-
else if (endArrowDirection !== undefined
|
|
41
|
+
else if (endArrowDirection !== undefined) {
|
|
35
42
|
resolvedEndArrowDirection = endArrowDirection;
|
|
36
43
|
}
|
|
37
44
|
else if (endAccessory) {
|
|
@@ -40,7 +47,7 @@ export const SelectButton = ({ placeholder, value, textProps, startAccessory, en
|
|
|
40
47
|
else {
|
|
41
48
|
resolvedEndArrowDirection = SelectButtonEndArrow.Down;
|
|
42
49
|
}
|
|
43
|
-
return (<ButtonBase {...buttonBaseRest} size={size} isDisabled={isDisabled} isFullWidth={isFullWidth} isLoading={isLoading} children={labelContent} textProps={{
|
|
50
|
+
return (<ButtonBase {...buttonBaseRest} size={size} isDisabled={isDisabled} isFullWidth={isFullWidth} isLoading={isLoading} accessibilityLabel={accessibilityLabel} children={hasLabel ? labelContent : undefined} textProps={{
|
|
44
51
|
...(variant === SelectButtonVariant.Tertiary
|
|
45
52
|
? { color: TextColor.TextAlternative }
|
|
46
53
|
: {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectButton.mjs","sourceRoot":"","sources":["../../../src/components/SelectButton/SelectButton.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACpB,gDAAgD;AACjD,OAAO,MAAK,cAAc;;AAE1B,OAAO,EAAE,UAAU,EAAE,gCAAsB;AAC3C,OAAO,EAAE,SAAS,EAAE,0BAAgB;AACpC,OAAO,EAAE,SAAS,EAAE,0BAAgB;AAEpC,OAAO,EAAE,iDAAiD,EAAE,qCAAiC;AAG7F,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,WAAW,EACX,KAAK,EACL,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,YAAY,GAAG,KAAK,EACpB,UAAU,GAAG,KAAK,EAClB,WAAW,GAAG,KAAK,EACnB,0BAA0B,EAC1B,OAAO,GAAG,mBAAmB,CAAC,OAAO,EACrC,SAAS,GAAG,KAAK,EACjB,IAAI,GAAG,gBAAgB,CAAC,EAAE,EAC1B,WAAW,GAAG,EAAE,EAChB,KAAK,EACL,GAAG,cAAc,EACC,EAAE,EAAE;IACtB,MAAM,YAAY,GAAG,KAAK,IAAI,WAAW,CAAC;IAC1C,MAAM,iBAAiB,GAAG;QACxB,GAAG,SAAS;QACZ,WAAW,EAAE,gBAAgB;QAC3B,yEAAyE;QACzE,0EAA0E;QAC1E,iDAAiD;QACjD,WAAW,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,WAAW,EACnD,SAAS,EAAE,WAAW,CACvB;KACF,CAAC;IACF,MAAM,2BAA2B,GAAG,WAAW;QAC7C,CAAC,CAAC;YACE,GAAG,cAAc,CAAC,mBAAmB;YACrC,WAAW,EAAE,gBAAgB,CAC3B,QAAQ,EACR,cAAc,CAAC,mBAAmB,EAAE,WAAW,CAChD;SACF;QACH,CAAC,CAAC,cAAc,CAAC,mBAAmB,CAAC;IAEvC,IAAI,yBAA2D,CAAC;IAChE,IAAI,YAAY,EAAE,CAAC;QACjB,yBAAyB,GAAG,SAAS,CAAC;IACxC,CAAC;SAAM,IAAI,iBAAiB,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"SelectButton.mjs","sourceRoot":"","sources":["../../../src/components/SelectButton/SelectButton.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACpB,gDAAgD;AACjD,OAAO,MAAK,cAAc;;AAE1B,OAAO,EAAE,UAAU,EAAE,gCAAsB;AAC3C,OAAO,EAAE,SAAS,EAAE,0BAAgB;AACpC,OAAO,EAAE,SAAS,EAAE,0BAAgB;AAEpC,OAAO,EAAE,iDAAiD,EAAE,qCAAiC;AAG7F,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,WAAW,EACX,KAAK,EACL,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,YAAY,GAAG,KAAK,EACpB,UAAU,GAAG,KAAK,EAClB,WAAW,GAAG,KAAK,EACnB,0BAA0B,EAC1B,OAAO,GAAG,mBAAmB,CAAC,OAAO,EACrC,SAAS,GAAG,KAAK,EACjB,IAAI,GAAG,gBAAgB,CAAC,EAAE,EAC1B,WAAW,GAAG,EAAE,EAChB,KAAK,EACL,kBAAkB,EAClB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EAAE;YACJ,CAAC,CAAC,WAAW,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,UAAU,8BAC/D,OAAO,WAAW,KAAK,UAAU;gBAC/B,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC;gBACtB,CAAC,CAAC,WACN,EACN,CAAC,CACD,aAAa,CAAC,CAAC,GAAG,EAAE,CAClB,OAAO,KAAK,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAClD,CAAC,CACD,aAAa,CAAC,CAAC,GAAG,EAAE,CAClB,OAAO,KAAK,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAClD,CAAC,CACD,KAAK,CAAC,CAAC,KAAK,CAAC,EACb,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC","sourcesContent":["import {\n mergeTwClassName,\n SelectButtonEndArrow,\n SelectButtonSize,\n SelectButtonVariant,\n} from '@metamask-previews/design-system-shared';\nimport React from 'react';\n\nimport { ButtonBase } from '../ButtonBase';\nimport { IconColor } from '../Icon';\nimport { TextColor } from '../Text';\n\nimport { MAP_SELECTBUTTON_END_ARROW_DIRECTION_TO_ICON_NAME } from './SelectButton.constants';\nimport type { SelectButtonProps } from './SelectButton.types';\n\nexport const SelectButton = ({\n placeholder,\n value,\n textProps,\n startAccessory,\n endArrowDirection,\n endAccessory,\n hideEndArrow = false,\n isDisabled = false,\n isFullWidth = false,\n endArrowDirectionIconProps,\n variant = SelectButtonVariant.Primary,\n isLoading = false,\n size = SelectButtonSize.Sm,\n twClassName = '',\n style,\n accessibilityLabel,\n ...buttonBaseRest\n}: SelectButtonProps) => {\n const labelContent = value ?? placeholder;\n const hasLabel = Boolean(labelContent);\n\n if (__DEV__ && !hasLabel && !accessibilityLabel) {\n console.warn(\n 'SelectButton: no label is rendered because `value` and `placeholder` are missing or empty. Provide an `accessibilityLabel` so the control has an accessible name.',\n );\n }\n\n const resolvedTextProps = {\n // One-line ellipsis by default; callers override it through `textProps`.\n numberOfLines: 1,\n ellipsizeMode: 'tail' as const,\n ...textProps,\n twClassName: mergeTwClassName(\n // Ensure the label actually grows to push the end arrow when full width.\n // ButtonBase applies 'grow-0' by default; add 'grow' here to override it.\n // Keep 'flex-1' for existing expectations/tests.\n isFullWidth ? 'text-left flex-1 grow' : 'text-left',\n textProps?.twClassName,\n ),\n };\n const resolvedContentWrapperProps = isFullWidth\n ? {\n ...buttonBaseRest.contentWrapperProps,\n twClassName: mergeTwClassName(\n 'w-full',\n buttonBaseRest.contentWrapperProps?.twClassName,\n ),\n }\n : buttonBaseRest.contentWrapperProps;\n\n let resolvedEndArrowDirection: SelectButtonEndArrow | undefined;\n if (hideEndArrow) {\n resolvedEndArrowDirection = undefined;\n } else if (endArrowDirection !== undefined) {\n resolvedEndArrowDirection = endArrowDirection;\n } else if (endAccessory) {\n resolvedEndArrowDirection = undefined;\n } else {\n resolvedEndArrowDirection = SelectButtonEndArrow.Down;\n }\n\n return (\n <ButtonBase\n {...buttonBaseRest}\n size={size}\n isDisabled={isDisabled}\n isFullWidth={isFullWidth}\n isLoading={isLoading}\n accessibilityLabel={accessibilityLabel}\n children={hasLabel ? labelContent : undefined}\n textProps={{\n ...(variant === SelectButtonVariant.Tertiary\n ? { color: TextColor.TextAlternative }\n : {}),\n ...resolvedTextProps,\n }}\n contentWrapperProps={resolvedContentWrapperProps}\n startAccessory={startAccessory}\n endAccessory={resolvedEndArrowDirection ? undefined : endAccessory}\n endIconName={\n resolvedEndArrowDirection\n ? MAP_SELECTBUTTON_END_ARROW_DIRECTION_TO_ICON_NAME[\n resolvedEndArrowDirection\n ]\n : undefined\n }\n endIconProps={\n resolvedEndArrowDirection\n ? {\n ...(variant === SelectButtonVariant.Tertiary\n ? { color: IconColor.IconAlternative }\n : {}),\n ...endArrowDirectionIconProps,\n }\n : undefined\n }\n twClassName={(pressed) =>\n variant === SelectButtonVariant.Secondary ||\n variant === SelectButtonVariant.Tertiary\n ? `min-w-0 ${pressed || isLoading ? 'bg-pressed' : 'bg-transparent'} border-0 ${\n typeof twClassName === 'function'\n ? twClassName(pressed)\n : twClassName\n }`\n : `min-w-0 ${pressed || isLoading ? 'bg-muted-pressed' : 'bg-muted'} border-transparent border ${\n typeof twClassName === 'function'\n ? twClassName(pressed)\n : twClassName\n }`\n }\n textClassName={() =>\n variant === SelectButtonVariant.Tertiary ? '' : 'text-default'\n }\n iconClassName={() =>\n variant === SelectButtonVariant.Tertiary ? '' : 'text-default'\n }\n style={style}\n />\n );\n};\n\nSelectButton.displayName = 'SelectButton';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask-previews/design-system-react-native",
|
|
3
|
-
"version": "0.56.2-preview-
|
|
3
|
+
"version": "0.56.2-preview-91ce2ce2",
|
|
4
4
|
"description": "Design System React Native",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@metamask-previews/design-system-shared": "0.45.1-preview-
|
|
50
|
+
"@metamask-previews/design-system-shared": "0.45.1-preview-91ce2ce2",
|
|
51
51
|
"react-native-jazzicon": "^0.1.2"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"@babel/preset-typescript": "^7.23.3",
|
|
58
58
|
"@figma/code-connect": "^1.4.9",
|
|
59
59
|
"@gorhom/bottom-sheet": "^5.1.3",
|
|
60
|
-
"@metamask-previews/design-system-twrnc-preset": "0.14.0-preview-
|
|
61
|
-
"@metamask-previews/design-tokens": "13.0.0-preview-
|
|
60
|
+
"@metamask-previews/design-system-twrnc-preset": "0.14.0-preview-91ce2ce2",
|
|
61
|
+
"@metamask-previews/design-tokens": "13.0.0-preview-91ce2ce2",
|
|
62
62
|
"@metamask/auto-changelog": "^7.1.0",
|
|
63
63
|
"@metamask/utils": "^11.12.1",
|
|
64
64
|
"@react-native/babel-preset": "0.86.3",
|