@ankhorage/zora 27.10.6 → 27.11.0

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/dist/capabilities/index.js +17 -1
  4. package/dist/capabilities/index.js.map +3 -3
  5. package/dist/features/form/select/adapters/inbound/Select.native.js +1 -1
  6. package/dist/features/form/select/adapters/inbound/Select.native.js.map +1 -1
  7. package/dist/features/form/select/adapters/inbound/Select.web.js +1 -1
  8. package/dist/features/form/select/adapters/inbound/Select.web.js.map +1 -1
  9. package/dist/features/form/select/composition/SelectOptionRow.d.ts.map +1 -1
  10. package/dist/features/form/select/composition/SelectOptionRow.js +20 -0
  11. package/dist/features/form/select/composition/SelectOptionRow.js.map +1 -1
  12. package/dist/features/form/select/composition/SelectTrigger.d.ts +2 -1
  13. package/dist/features/form/select/composition/SelectTrigger.d.ts.map +1 -1
  14. package/dist/features/form/select/composition/SelectTrigger.js +22 -1
  15. package/dist/features/form/select/composition/SelectTrigger.js.map +1 -1
  16. package/dist/features/form/select/selectMeta.d.ts +17 -0
  17. package/dist/features/form/select/selectMeta.d.ts.map +1 -1
  18. package/dist/features/form/select/selectMeta.js +16 -0
  19. package/dist/features/form/select/selectMeta.js.map +1 -1
  20. package/dist/types/select.d.ts +8 -0
  21. package/dist/types/select.d.ts.map +1 -1
  22. package/dist/types/select.js.map +1 -1
  23. package/package.json +8 -3
  24. package/src/features/form/select/adapters/inbound/Select.native.tsx +6 -1
  25. package/src/features/form/select/adapters/inbound/Select.web.tsx +6 -1
  26. package/src/features/form/select/composition/SelectOptionRow.tsx +42 -0
  27. package/src/features/form/select/composition/SelectTrigger.tsx +50 -0
  28. package/src/features/form/select/public.test.ts +33 -1
  29. package/src/features/form/select/selectMeta.ts +16 -0
  30. package/src/metadata/repository.json +30 -0
  31. package/src/metadata/repository.test.ts +29 -0
  32. package/src/types/select.ts +8 -0
  33. package/src/webPackageExports.test.ts +28 -0
  34. package/web-dist/components/select/Select.dependency-2.d.ts +9 -0
  35. package/web-dist/components/select/Select.dependency-3.d.ts +23 -0
  36. package/web-dist/components/select/Select.js +108 -4
  37. package/web-dist/components/select/Select.types-0.d.ts +9 -0
  38. package/web-dist/index.d.ts +4 -0
  39. package/web-dist/index.js +4 -0
  40. package/web-dist/manifest.json +5 -0
@@ -31,7 +31,7 @@ function SelectInner({ themeId: _themeId, mode: _mode, ...props }) {
31
31
  });
32
32
  }, [disabled, listData, passive, present, readOnly, renderOption]);
33
33
  return (<SelectField props={props}>
34
- <SelectTrigger displayLabel={selectedOption?.label} onPress={openSelect} props={props}/>
34
+ <SelectTrigger displayLabel={selectedOption?.label} leadingMedia={selectedOption?.leadingMedia} onPress={openSelect} props={props}/>
35
35
  </SelectField>);
36
36
  }
37
37
  const styles = StyleSheet.create({
@@ -1 +1 @@
1
- {"version":3,"file":"Select.native.js","sourceRoot":"","sources":["../../../../../../src/features/form/select/adapters/inbound/Select.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA2B,UAAU,EAAE,MAAM,cAAc,CAAC;AAGnE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAEpC,iFAAiF;AACjF,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;AAEtD,iFAAiF;AACjF,SAAS,WAAW,CAAiC,EACnD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AE5C,OAAO,CAAC;YACN,WAAW,EAAE,QAAQ;YACrB,qBAAqB,EAAE,uBAAuB;YAC9C,OAAO,EAAE,CACP,CAAC,mBAAmB,CAClB,qBAAqB,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAC1C,IAAI,CAAC,CAAC,QAAQ,CAAC,CACf,YAAY,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CACnC,UAAU,CAAC,CAAC,YAAY,CAAC,EACzB,CACH;SACF,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;IAEnE,OAAO,CACL,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CACxB;MAAA,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,EACxF;IAAA,EAAE,WAAW,CAAC,CACf,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,WAAW,EAAE;QACX,OAAO,EAAE,EAAE;KACZ;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { type ListRenderItemInfo, StyleSheet } from 'react-native';\n\nimport type { SelectOption, SelectProps } from '../../../../../types/select';\nimport { BottomSheetFlatList, useBottomSheet } from '../../../../bottom-sheet/public';\nimport { withZoraThemeScope } from '../../../../theme/adapters/inbound/withZoraThemeScope';\nimport { SelectField } from '../../composition/SelectField';\nimport { SelectOptionRow } from '../../composition/SelectOptionRow';\nimport { SelectTrigger } from '../../composition/SelectTrigger';\nimport { useSelectController } from '../../composition/useSelectController';\n\nconst SELECT_SHEET_MAX_HEIGHT = 480;\n\n/*** Renders Select with BottomSheetFlatList presentation on native platforms. */\nexport const Select = withZoraThemeScope(SelectInner);\n\n/*** Connects shared Select state and controls to the native BottomSheet host. */\nfunction SelectInner<TValue extends string = string>({\n themeId: _themeId,\n mode: _mode,\n ...props\n}: SelectProps<TValue>) {\n const { dismiss, present } = useBottomSheet();\n const { select, selectedOption, value } = useSelectController(props);\n const passive = props.interactionPolicy === 'passive';\n const { disabled, interactionPolicy, options, readOnly, testID } = props;\n const listData = React.useMemo(() => [...options], [options]);\n\n const handleSelect = React.useCallback(\n (nextValue: TValue) => {\n select(nextValue);\n dismiss();\n },\n [dismiss, select],\n );\n\n const renderOption = React.useCallback(\n ({ item }: ListRenderItemInfo<SelectOption<TValue>>) => (\n <SelectOptionRow\n interactionPolicy={interactionPolicy}\n onSelect={handleSelect}\n option={item}\n selected={value === item.value}\n testID={testID}\n />\n ),\n [handleSelect, interactionPolicy, testID, value],\n );\n\n const openSelect = React.useCallback(() => {\n if (disabled || readOnly || passive) return;\n\n present({\n contentMode: 'direct',\n maxDynamicContentSize: SELECT_SHEET_MAX_HEIGHT,\n content: (\n <BottomSheetFlatList\n contentContainerStyle={styles.listContent}\n data={listData}\n keyExtractor={(item) => item.value}\n renderItem={renderOption}\n />\n ),\n });\n }, [disabled, listData, passive, present, readOnly, renderOption]);\n\n return (\n <SelectField props={props}>\n <SelectTrigger displayLabel={selectedOption?.label} onPress={openSelect} props={props} />\n </SelectField>\n );\n}\n\nconst styles = StyleSheet.create({\n listContent: {\n padding: 16,\n },\n});\n"]}
1
+ {"version":3,"file":"Select.native.js","sourceRoot":"","sources":["../../../../../../src/features/form/select/adapters/inbound/Select.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA2B,UAAU,EAAE,MAAM,cAAc,CAAC;AAGnE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,M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from 'react';\nimport { type ListRenderItemInfo, StyleSheet } from 'react-native';\n\nimport type { SelectOption, SelectProps } from '../../../../../types/select';\nimport { BottomSheetFlatList, useBottomSheet } from '../../../../bottom-sheet/public';\nimport { withZoraThemeScope } from '../../../../theme/adapters/inbound/withZoraThemeScope';\nimport { SelectField } from '../../composition/SelectField';\nimport { SelectOptionRow } from '../../composition/SelectOptionRow';\nimport { SelectTrigger } from '../../composition/SelectTrigger';\nimport { useSelectController } from '../../composition/useSelectController';\n\nconst SELECT_SHEET_MAX_HEIGHT = 480;\n\n/*** Renders Select with BottomSheetFlatList presentation on native platforms. */\nexport const Select = withZoraThemeScope(SelectInner);\n\n/*** Connects shared Select state and controls to the native BottomSheet host. */\nfunction SelectInner<TValue extends string = string>({\n themeId: _themeId,\n mode: _mode,\n ...props\n}: SelectProps<TValue>) {\n const { dismiss, present } = useBottomSheet();\n const { select, selectedOption, value } = useSelectController(props);\n const passive = props.interactionPolicy === 'passive';\n const { disabled, interactionPolicy, options, readOnly, testID } = props;\n const listData = React.useMemo(() => [...options], [options]);\n\n const handleSelect = React.useCallback(\n (nextValue: TValue) => {\n select(nextValue);\n dismiss();\n },\n [dismiss, select],\n );\n\n const renderOption = React.useCallback(\n ({ item }: ListRenderItemInfo<SelectOption<TValue>>) => (\n <SelectOptionRow\n interactionPolicy={interactionPolicy}\n onSelect={handleSelect}\n option={item}\n selected={value === item.value}\n testID={testID}\n />\n ),\n [handleSelect, interactionPolicy, testID, value],\n );\n\n const openSelect = React.useCallback(() => {\n if (disabled || readOnly || passive) return;\n\n present({\n contentMode: 'direct',\n maxDynamicContentSize: SELECT_SHEET_MAX_HEIGHT,\n content: (\n <BottomSheetFlatList\n contentContainerStyle={styles.listContent}\n data={listData}\n keyExtractor={(item) => item.value}\n renderItem={renderOption}\n />\n ),\n });\n }, [disabled, listData, passive, present, readOnly, renderOption]);\n\n return (\n <SelectField props={props}>\n <SelectTrigger\n displayLabel={selectedOption?.label}\n leadingMedia={selectedOption?.leadingMedia}\n onPress={openSelect}\n props={props}\n />\n </SelectField>\n );\n}\n\nconst styles = StyleSheet.create({\n listContent: {\n padding: 16,\n },\n});\n"]}
@@ -19,7 +19,7 @@ function SelectInner({ themeId: _themeId, mode: _mode, ...props }) {
19
19
  setOpen(false);
20
20
  }, [select]);
21
21
  return (<SelectField props={props}>
22
- <Popover anchor={({ toggle }) => (<SelectTrigger displayLabel={selectedOption?.label} onPress={toggle} props={props}/>)} interactionPolicy={props.interactionPolicy} onOpenChange={setOpen} open={open} placement="bottom-start" testID={testID ? `${testID}-popover` : undefined}>
22
+ <Popover anchor={({ toggle }) => (<SelectTrigger displayLabel={selectedOption?.label} leadingMedia={selectedOption?.leadingMedia} onPress={toggle} props={props}/>)} interactionPolicy={props.interactionPolicy} onOpenChange={setOpen} open={open} placement="bottom-start" testID={testID ? `${testID}-popover` : undefined}>
23
23
  <Surface variant="raised">
24
24
  <View gap="xs" p="xs">
25
25
  {options.map((option) => (<SelectOptionRow interactionPolicy={interactionPolicy} key={option.value} onSelect={selectAndClose} option={option} selected={value === option.value} testID={testID}/>))}
@@ -1 +1 @@
1
- {"version":3,"file":"Select.web.js","sourceRoot":"","sources":["../../../../../../src/features/form/select/adapters/inbound/Select.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;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C,OAAO,CAAC,QAAQ,CACvB;UAAA,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CACnB;YAAA,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACvB,CAAC,eAAe,CACd,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAClB,QAAQ,CAAC,CAAC,cAAc,CAAC,CACzB,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC,CACjC,MAAM,CAAC,CAAC,MAAM,CAAC,EACf,CACH,CAAC,CACJ;UAAA,EAAE,IAAI,CACR;QAAA,EAAE,OAAO,CACX;MAAA,EAAE,OAAO,CACX;IAAA,EAAE,WAAW,CAAC,CACf,CAAC;AACJ,CAAC","sourcesContent":["import { Popover } from '@ankhorage/surface';\nimport React from 'react';\n\nimport type { SelectProps } from '../../../../../types/select';\nimport { View } from '../../../../layout/public';\nimport { Surface } from '../../../../surface/public';\nimport { withZoraThemeScope } from '../../../../theme/adapters/inbound/withZoraThemeScope';\nimport { SelectField } from '../../composition/SelectField';\nimport { SelectOptionRow } from '../../composition/SelectOptionRow';\nimport { SelectTrigger } from '../../composition/SelectTrigger';\nimport { useSelectController } from '../../composition/useSelectController';\n\n/*** Renders Select with anchored Popover presentation on web. */\nexport const Select = withZoraThemeScope(SelectInner);\n\n/*** Connects shared Select state and controls to the web Popover host. */\nfunction SelectInner<TValue extends string = string>({\n themeId: _themeId,\n mode: _mode,\n ...props\n}: SelectProps<TValue>) {\n const [open, setOpen] = React.useState(false);\n const { select, selectedOption, value } = useSelectController(props);\n const { interactionPolicy, options, testID } = props;\n\n const selectAndClose = React.useCallback(\n (nextValue: TValue) => {\n select(nextValue);\n setOpen(false);\n },\n [select],\n );\n\n return (\n <SelectField props={props}>\n <Popover\n anchor={({ toggle }) => (\n <SelectTrigger displayLabel={selectedOption?.label} onPress={toggle} props={props} />\n )}\n interactionPolicy={props.interactionPolicy}\n onOpenChange={setOpen}\n open={open}\n placement=\"bottom-start\"\n testID={testID ? `${testID}-popover` : undefined}\n >\n <Surface variant=\"raised\">\n <View gap=\"xs\" p=\"xs\">\n {options.map((option) => (\n <SelectOptionRow\n interactionPolicy={interactionPolicy}\n key={option.value}\n onSelect={selectAndClose}\n option={option}\n selected={value === option.value}\n testID={testID}\n />\n ))}\n </View>\n </Surface>\n </Popover>\n </SelectField>\n );\n}\n"]}
1
+ {"version":3,"file":"Select.web.js","sourceRoot":"","sources":["../../../../../../src/features/form/select/adapters/inbound/Select.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAE5E,iEAAiE;AACjE,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,WAAW,CAAC,CAAC;AAEtD,0EAA0E;AAC1E,SAAS,WAAW,CAAiC,EACnD,OAAO,EAAE,QAAQ,EACjB,IAAI,EAAE,KAAK,EACX,GAAG,KAAK,EACY;IACpB,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,K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AAC,CAAC,cAAc,CAAC,CACzB,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC,CACjC,MAAM,CAAC,CAAC,MAAM,CAAC,EACf,CACH,CAAC,CACJ;UAAA,EAAE,IAAI,CACR;QAAA,EAAE,OAAO,CACX;MAAA,EAAE,OAAO,CACX;IAAA,EAAE,WAAW,CAAC,CACf,CAAC;AACJ,CAAC","sourcesContent":["import { Popover } from '@ankhorage/surface';\nimport React from 'react';\n\nimport type { SelectProps } from '../../../../../types/select';\nimport { View } from '../../../../layout/public';\nimport { Surface } from '../../../../surface/public';\nimport { withZoraThemeScope } from '../../../../theme/adapters/inbound/withZoraThemeScope';\nimport { SelectField } from '../../composition/SelectField';\nimport { SelectOptionRow } from '../../composition/SelectOptionRow';\nimport { SelectTrigger } from '../../composition/SelectTrigger';\nimport { useSelectController } from '../../composition/useSelectController';\n\n/*** Renders Select with anchored Popover presentation on web. */\nexport const Select = withZoraThemeScope(SelectInner);\n\n/*** Connects shared Select state and controls to the web Popover host. */\nfunction SelectInner<TValue extends string = string>({\n themeId: _themeId,\n mode: _mode,\n ...props\n}: SelectProps<TValue>) {\n const [open, setOpen] = React.useState(false);\n const { select, selectedOption, value } = useSelectController(props);\n const { interactionPolicy, options, testID } = props;\n\n const selectAndClose = React.useCallback(\n (nextValue: TValue) => {\n select(nextValue);\n setOpen(false);\n },\n [select],\n );\n\n return (\n <SelectField props={props}>\n <Popover\n anchor={({ toggle }) => (\n <SelectTrigger\n displayLabel={selectedOption?.label}\n leadingMedia={selectedOption?.leadingMedia}\n onPress={toggle}\n props={props}\n />\n )}\n interactionPolicy={props.interactionPolicy}\n onOpenChange={setOpen}\n open={open}\n placement=\"bottom-start\"\n testID={testID ? `${testID}-popover` : undefined}\n >\n <Surface variant=\"raised\">\n <View gap=\"xs\" p=\"xs\">\n {options.map((option) => (\n <SelectOptionRow\n interactionPolicy={interactionPolicy}\n key={option.value}\n onSelect={selectAndClose}\n option={option}\n selected={value === option.value}\n testID={testID}\n />\n ))}\n </View>\n </Surface>\n </Popover>\n </SelectField>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"SelectOptionRow.d.ts","sourceRoot":"","sources":["../../../../../src/features/form/select/composition/SelectOptionRow.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAK1E,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,MAAM,SAAS,MAAM,EAAE,EACrD,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,GACP,EAAE,oBAAoB,CAAC,MAAM,CAAC,+BAe9B;AAED,UAAU,oBAAoB,CAAC,MAAM,SAAS,MAAM;IAClD,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,mBAAmB,CAAC,CAAC;IAC5D,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B"}
1
+ {"version":3,"file":"SelectOptionRow.d.ts","sourceRoot":"","sources":["../../../../../src/features/form/select/composition/SelectOptionRow.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAU1E,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,MAAM,SAAS,MAAM,EAAE,EACrD,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,GACP,EAAE,oBAAoB,CAAC,MAAM,CAAC,+BAkD9B;AAED,UAAU,oBAAoB,CAAC,MAAM,SAAS,MAAM;IAClD,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,mBAAmB,CAAC,CAAC;IAC5D,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IAC7B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B"}
@@ -1,7 +1,27 @@
1
+ import { Pressable } from '@ankhorage/surface';
1
2
  import { Button } from '../../../button/public';
3
+ import { Icon } from '../../../icon/public';
4
+ import { Image } from '../../../image/public';
5
+ import { View } from '../../../layout/public';
6
+ import { useZoraTheme } from '../../../theme/composition/useZoraTheme';
7
+ import { Text } from '../../../typography/public';
2
8
  const SELECTED_ICON = { name: 'checkmark' };
3
9
  /*** Renders one Select option with shared web/native selection semantics. */
4
10
  export function SelectOptionRow({ interactionPolicy, onSelect, option, selected, testID, }) {
11
+ const { theme } = useZoraTheme();
12
+ if (option.leadingMedia) {
13
+ return (<Pressable accessibilityLabel={option.label} disabled={option.disabled} interactionPolicy={interactionPolicy} onPress={() => onSelect(option.value)} style={{ alignSelf: 'stretch' }} testID={testID ? `${testID}-option-${option.value}` : undefined}>
14
+ <View align="center" bg={selected ? theme.semantics.action.primary.softBg : 'transparent'} direction="row" gap="s" minHeight={44} px="m" radius="m">
15
+ <Image alt="" height={28} radius="s" source={option.leadingMedia} width={28}/>
16
+ <View flex={1}>
17
+ <Text color={selected ? 'primary' : undefined} numberOfLines={1} variant="label">
18
+ {option.label}
19
+ </Text>
20
+ </View>
21
+ {selected ? (<Icon color={theme.semantics.action.primary.base} name="checkmark" size={18}/>) : null}
22
+ </View>
23
+ </Pressable>);
24
+ }
5
25
  return (<Button color={selected ? 'primary' : 'neutral'} disabled={option.disabled} fullWidth interactionPolicy={interactionPolicy} onPress={() => onSelect(option.value)} testID={testID ? `${testID}-option-${option.value}` : undefined} trailingIcon={selected ? SELECTED_ICON : undefined} variant={selected ? 'soft' : 'ghost'}>
6
26
  {option.label}
7
27
  </Button>);
@@ -1 +1 @@
1
- {"version":3,"file":"SelectOptionRow.js","sourceRoot":"","sources":["../../../../../src/features/form/select/composition/SelectOptionRow.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,aAAa,GAAG,EAAE,IAAI,EAAE,WAAW,EAAW,CAAC;AAErD,6EAA6E;AAC7E,MAAM,UAAU,eAAe,CAAwB,EACrD,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,GACuB;IAC7B,OAAO,CACL,CAAC,MAAM,CACL,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CACxC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAC1B,SAAS,CACT,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CACtC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,WAAW,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAChE,YAAY,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CACnD,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAErC;MAAA,CAAC,MAAM,CAAC,KAAK,CACf;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC","sourcesContent":["import type { SelectOption, SelectProps } from '../../../../types/select';\nimport { Button } from '../../../button/public';\n\nconst SELECTED_ICON = { name: 'checkmark' } as const;\n\n/*** Renders one Select option with shared web/native selection semantics. */\nexport function SelectOptionRow<TValue extends string>({\n interactionPolicy,\n onSelect,\n option,\n selected,\n testID,\n}: SelectOptionRowProps<TValue>) {\n return (\n <Button\n color={selected ? 'primary' : 'neutral'}\n disabled={option.disabled}\n fullWidth\n interactionPolicy={interactionPolicy}\n onPress={() => onSelect(option.value)}\n testID={testID ? `${testID}-option-${option.value}` : undefined}\n trailingIcon={selected ? SELECTED_ICON : undefined}\n variant={selected ? 'soft' : 'ghost'}\n >\n {option.label}\n </Button>\n );\n}\n\ninterface SelectOptionRowProps<TValue extends string> {\n interactionPolicy: SelectProps<TValue>['interactionPolicy'];\n onSelect: (value: TValue) => void;\n option: SelectOption<TValue>;\n selected: boolean;\n testID: string | undefined;\n}\n"]}
1
+ {"version":3,"file":"SelectOptionRow.js","sourceRoot":"","sources":["../../../../../src/features/form/select/composition/SelectOptionRow.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,MAAM,aAAa,GAAG,EAAE,IAAI,EAAE,WAAW,EAAW,CAAC;AAErD,6EAA6E;AAC7E,MAAM,UAAU,eAAe,CAAwB,EACrD,iBAAiB,EACjB,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,MAAM,GACuB;IAC7B,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,CAAC;IAEjC,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACxB,OAAO,CACL,CAAC,SAAS,CACR,kBAAkB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CACjC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAC1B,iBAAiB,CAAC,CAAC,iBAAi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,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAG,CAChF,CAAC,CAAC,CAAC,IAAI,CACV;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,SAAS,CAAC,CACb,CAAC;IACJ,CAAC;IAED,OAAO,CACL,CAAC,MAAM,CACL,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CACxC,QAAQ,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAC1B,SAAS,CACT,iBAAiB,CAAC,CAAC,iBAAiB,CAAC,CACrC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CACtC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,WAAW,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAChE,YAAY,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CACnD,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAErC;MAAA,CAAC,MAAM,CAAC,KAAK,CACf;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC","sourcesContent":["import { Pressable } from '@ankhorage/surface';\n\nimport type { SelectOption, SelectProps } from '../../../../types/select';\nimport { Button } from '../../../button/public';\nimport { Icon } from '../../../icon/public';\nimport { Image } from '../../../image/public';\nimport { View } from '../../../layout/public';\nimport { useZoraTheme } from '../../../theme/composition/useZoraTheme';\nimport { Text } from '../../../typography/public';\n\nconst SELECTED_ICON = { name: 'checkmark' } as const;\n\n/*** Renders one Select option with shared web/native selection semantics. */\nexport function SelectOptionRow<TValue extends string>({\n interactionPolicy,\n onSelect,\n option,\n selected,\n testID,\n}: SelectOptionRowProps<TValue>) {\n const { theme } = useZoraTheme();\n\n if (option.leadingMedia) {\n return (\n <Pressable\n accessibilityLabel={option.label}\n disabled={option.disabled}\n interactionPolicy={interactionPolicy}\n onPress={() => onSelect(option.value)}\n style={{ alignSelf: 'stretch' }}\n testID={testID ? `${testID}-option-${option.value}` : undefined}\n >\n <View\n align=\"center\"\n bg={selected ? theme.semantics.action.primary.softBg : 'transparent'}\n direction=\"row\"\n gap=\"s\"\n minHeight={44}\n px=\"m\"\n radius=\"m\"\n >\n <Image alt=\"\" height={28} radius=\"s\" source={option.leadingMedia} width={28} />\n <View flex={1}>\n <Text color={selected ? 'primary' : undefined} numberOfLines={1} variant=\"label\">\n {option.label}\n </Text>\n </View>\n {selected ? (\n <Icon color={theme.semantics.action.primary.base} name=\"checkmark\" size={18} />\n ) : null}\n </View>\n </Pressable>\n );\n }\n\n return (\n <Button\n color={selected ? 'primary' : 'neutral'}\n disabled={option.disabled}\n fullWidth\n interactionPolicy={interactionPolicy}\n onPress={() => onSelect(option.value)}\n testID={testID ? `${testID}-option-${option.value}` : undefined}\n trailingIcon={selected ? SELECTED_ICON : undefined}\n variant={selected ? 'soft' : 'ghost'}\n >\n {option.label}\n </Button>\n );\n}\n\ninterface SelectOptionRowProps<TValue extends string> {\n interactionPolicy: SelectProps<TValue>['interactionPolicy'];\n onSelect: (value: TValue) => void;\n option: SelectOption<TValue>;\n selected: boolean;\n testID: string | undefined;\n}\n"]}
@@ -1,8 +1,9 @@
1
1
  import type { SelectProps } from '../../../../types/select';
2
2
  /*** Renders the shared Select trigger with the resolved option label or placeholder. */
3
- export declare function SelectTrigger<TValue extends string>({ displayLabel, onPress, props, }: SelectTriggerProps<TValue>): import("react").JSX.Element;
3
+ export declare function SelectTrigger<TValue extends string>({ displayLabel, leadingMedia, onPress, props, }: SelectTriggerProps<TValue>): import("react").JSX.Element;
4
4
  interface SelectTriggerProps<TValue extends string> {
5
5
  displayLabel: string | undefined;
6
+ leadingMedia: SelectProps<TValue>['leadingMedia'];
6
7
  onPress: () => void;
7
8
  props: SelectProps<TValue>;
8
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SelectTrigger.d.ts","sourceRoot":"","sources":["../../../../../src/features/form/select/composition/SelectTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAK5D,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,MAAM,SAAS,MAAM,EAAE,EACnD,YAAY,EACZ,OAAO,EACP,KAAK,GACN,EAAE,kBAAkB,CAAC,MAAM,CAAC,+BAiB5B;AAED,UAAU,kBAAkB,CAAC,MAAM,SAAS,MAAM;IAChD,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC5B"}
1
+ {"version":3,"file":"SelectTrigger.d.ts","sourceRoot":"","sources":["../../../../../src/features/form/select/composition/SelectTrigger.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAU5D,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,MAAM,SAAS,MAAM,EAAE,EACnD,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,KAAK,GACN,EAAE,kBAAkB,CAAC,MAAM,CAAC,+BA0D5B;AAED,UAAU,kBAAkB,CAAC,MAAM,SAAS,MAAM;IAChD,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;IAClD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC5B"}
@@ -1,7 +1,28 @@
1
+ import { Pressable } from '@ankhorage/surface';
1
2
  import { Button } from '../../../button/public';
3
+ import { Icon } from '../../../icon/public';
4
+ import { Image } from '../../../image/public';
5
+ import { View } from '../../../layout/public';
6
+ import { useZoraTheme } from '../../../theme/composition/useZoraTheme';
7
+ import { Text } from '../../../typography/public';
2
8
  const SELECT_CHEVRON_ICON = { name: 'chevron-down' };
3
9
  /*** Renders the shared Select trigger with the resolved option label or placeholder. */
4
- export function SelectTrigger({ displayLabel, onPress, props, }) {
10
+ export function SelectTrigger({ displayLabel, leadingMedia, onPress, props, }) {
11
+ const { theme } = useZoraTheme();
12
+ const media = leadingMedia ?? props.leadingMedia;
13
+ if (media) {
14
+ return (<Pressable accessibilityLabel={displayLabel ?? props.placeholder ?? 'Select'} disabled={props.disabled} interactionPolicy={props.interactionPolicy} onPress={props.readOnly ? undefined : onPress} style={{ alignSelf: 'stretch' }} testID={props.testID ? `${props.testID}-trigger` : undefined}>
15
+ <View align="center" bg={props.invalid ? theme.semantics.error.softBg : theme.semantics.neutral.surface} borderColor={props.invalid ? theme.semantics.error.base : theme.semantics.neutral.divider} borderWidth={1} direction="row" gap="s" minHeight={44} px="m" radius="m">
16
+ <Image alt="" height={28} radius="s" source={media} width={28}/>
17
+ <View flex={1}>
18
+ <Text emphasis={displayLabel ? 'default' : 'muted'} numberOfLines={1} variant="label" weight={props.labelWeight ?? 'semiBold'}>
19
+ {displayLabel ?? props.placeholder ?? 'Select'}
20
+ </Text>
21
+ </View>
22
+ <Icon name="chevron-down" size={18}/>
23
+ </View>
24
+ </Pressable>);
25
+ }
5
26
  return (<Button color={props.invalid ? 'danger' : 'neutral'} disabled={props.disabled} fullWidth interactionPolicy={props.interactionPolicy} leadingIcon={props.leadingIcon} labelWeight={props.labelWeight ?? 'semiBold'} onPress={props.readOnly ? undefined : onPress} testID={props.testID ? `${props.testID}-trigger` : undefined} trailingIcon={SELECT_CHEVRON_ICON} variant="outline">
6
27
  {displayLabel ?? props.placeholder ?? 'Select'}
7
28
  </Button>);
@@ -1 +1 @@
1
- {"version":3,"file":"SelectTrigger.js","sourceRoot":"","sources":["../../../../../src/features/form/select/composition/SelectTrigger.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,mBAAmB,GAAG,EAAE,IAAI,EAAE,cAAc,EAAW,CAAC;AAE9D,wFAAwF;AACxF,MAAM,UAAU,aAAa,CAAwB,EACnD,YAAY,EACZ,OAAO,EACP,KAAK,GACsB;IAC3B,OAAO,CACL,CAAC,MAAM,CACL,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAC5C,QAAQ,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CACzB,SAAS,CACT,iBAAiB,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAC3C,WAAW,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAC/B,WAAW,CAAC,CAAC,KAAK,CAAC,WAAW,IAAI,UAAU,CAAC,CAC7C,OAAO,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAC9C,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAC7D,YAAY,CAAC,CAAC,mBAAmB,CAAC,CAClC,OAAO,CAAC,SAAS,CAEjB;MAAA,CAAC,YAAY,IAAI,KAAK,CAAC,WAAW,IAAI,QAAQ,CAChD;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC","sourcesContent":["import type { SelectProps } from '../../../../types/select';\nimport { Button } from '../../../button/public';\n\nconst SELECT_CHEVRON_ICON = { name: 'chevron-down' } as const;\n\n/*** Renders the shared Select trigger with the resolved option label or placeholder. */\nexport function SelectTrigger<TValue extends string>({\n displayLabel,\n onPress,\n props,\n}: SelectTriggerProps<TValue>) {\n return (\n <Button\n color={props.invalid ? 'danger' : 'neutral'}\n disabled={props.disabled}\n fullWidth\n interactionPolicy={props.interactionPolicy}\n leadingIcon={props.leadingIcon}\n labelWeight={props.labelWeight ?? 'semiBold'}\n onPress={props.readOnly ? undefined : onPress}\n testID={props.testID ? `${props.testID}-trigger` : undefined}\n trailingIcon={SELECT_CHEVRON_ICON}\n variant=\"outline\"\n >\n {displayLabel ?? props.placeholder ?? 'Select'}\n </Button>\n );\n}\n\ninterface SelectTriggerProps<TValue extends string> {\n displayLabel: string | undefined;\n onPress: () => void;\n props: SelectProps<TValue>;\n}\n"]}
1
+ {"version":3,"file":"SelectTrigger.js","sourceRoot":"","sources":["../../../../../src/features/form/select/composition/SelectTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAG/C,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAElD,MAAM,mBAAmB,GAAG,EAAE,IAAI,EAAE,cAAc,EAAW,CAAC;AAE9D,wFAAwF;AACxF,MAAM,UAAU,aAAa,CAAwB,EACnD,YAAY,EACZ,YAAY,EACZ,OAAO,EACP,KAAK,GACsB;IAC3B,MAAM,EAAE,KAAK,EAAE,GAAG,YAAY,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,YAAY,IAAI,KAAK,CAAC,YAAY,CAAC;IAEjD,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,CACL,CAAC,SAAS,CACR,kBAAkB,CAAC,CAAC,YAAY,IAAI,KAAK,CAAC,WAAW,IAAI,QAAQ,CAAC,CAClE,QAAQ,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CACzB,iBAAiB,CAAC,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AAC,CAAC,CAAC,CACjB,OAAO,CAAC,OAAO,CACf,MAAM,CAAC,CAAC,KAAK,CAAC,WAAW,IAAI,UAAU,CAAC,CAExC;cAAA,CAAC,YAAY,IAAI,KAAK,CAAC,WAAW,IAAI,QAAQ,CAChD;YAAA,EAAE,IAAI,CACR;UAAA,EAAE,IAAI,CACN;UAAA,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EACrC;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,SAAS,CAAC,CACb,CAAC;IACJ,CAAC;IAED,OAAO,CACL,CAAC,MAAM,CACL,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAC5C,QAAQ,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CACzB,SAAS,CACT,iBAAiB,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAC3C,WAAW,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAC/B,WAAW,CAAC,CAAC,KAAK,CAAC,WAAW,IAAI,UAAU,CAAC,CAC7C,OAAO,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAC9C,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAC7D,YAAY,CAAC,CAAC,mBAAmB,CAAC,CAClC,OAAO,CAAC,SAAS,CAEjB;MAAA,CAAC,YAAY,IAAI,KAAK,CAAC,WAAW,IAAI,QAAQ,CAChD;IAAA,EAAE,MAAM,CAAC,CACV,CAAC;AACJ,CAAC","sourcesContent":["import { Pressable } from '@ankhorage/surface';\n\nimport type { SelectProps } from '../../../../types/select';\nimport { Button } from '../../../button/public';\nimport { Icon } from '../../../icon/public';\nimport { Image } from '../../../image/public';\nimport { View } from '../../../layout/public';\nimport { useZoraTheme } from '../../../theme/composition/useZoraTheme';\nimport { Text } from '../../../typography/public';\n\nconst SELECT_CHEVRON_ICON = { name: 'chevron-down' } as const;\n\n/*** Renders the shared Select trigger with the resolved option label or placeholder. */\nexport function SelectTrigger<TValue extends string>({\n displayLabel,\n leadingMedia,\n onPress,\n props,\n}: SelectTriggerProps<TValue>) {\n const { theme } = useZoraTheme();\n const media = leadingMedia ?? props.leadingMedia;\n\n if (media) {\n return (\n <Pressable\n accessibilityLabel={displayLabel ?? props.placeholder ?? 'Select'}\n disabled={props.disabled}\n interactionPolicy={props.interactionPolicy}\n onPress={props.readOnly ? undefined : onPress}\n style={{ alignSelf: 'stretch' }}\n testID={props.testID ? `${props.testID}-trigger` : undefined}\n >\n <View\n align=\"center\"\n bg={props.invalid ? theme.semantics.error.softBg : theme.semantics.neutral.surface}\n borderColor={props.invalid ? theme.semantics.error.base : theme.semantics.neutral.divider}\n borderWidth={1}\n direction=\"row\"\n gap=\"s\"\n minHeight={44}\n px=\"m\"\n radius=\"m\"\n >\n <Image alt=\"\" height={28} radius=\"s\" source={media} width={28} />\n <View flex={1}>\n <Text\n emphasis={displayLabel ? 'default' : 'muted'}\n numberOfLines={1}\n variant=\"label\"\n weight={props.labelWeight ?? 'semiBold'}\n >\n {displayLabel ?? props.placeholder ?? 'Select'}\n </Text>\n </View>\n <Icon name=\"chevron-down\" size={18} />\n </View>\n </Pressable>\n );\n }\n\n return (\n <Button\n color={props.invalid ? 'danger' : 'neutral'}\n disabled={props.disabled}\n fullWidth\n interactionPolicy={props.interactionPolicy}\n leadingIcon={props.leadingIcon}\n labelWeight={props.labelWeight ?? 'semiBold'}\n onPress={props.readOnly ? undefined : onPress}\n testID={props.testID ? `${props.testID}-trigger` : undefined}\n trailingIcon={SELECT_CHEVRON_ICON}\n variant=\"outline\"\n >\n {displayLabel ?? props.placeholder ?? 'Select'}\n </Button>\n );\n}\n\ninterface SelectTriggerProps<TValue extends string> {\n displayLabel: string | undefined;\n leadingMedia: SelectProps<TValue>['leadingMedia'];\n onPress: () => void;\n props: SelectProps<TValue>;\n}\n"]}
@@ -108,6 +108,14 @@ export declare const selectMeta: {
108
108
  readonly category: "Content";
109
109
  readonly label: "Label";
110
110
  };
111
+ }, {
112
+ readonly key: "leadingMedia";
113
+ readonly schema: {
114
+ readonly type: "media";
115
+ readonly category: "Content";
116
+ readonly label: "Leading image";
117
+ readonly mediaKinds: readonly ["image"];
118
+ };
111
119
  }, {
112
120
  readonly key: "disabled";
113
121
  readonly schema: {
@@ -163,6 +171,15 @@ export declare const selectMeta: {
163
171
  readonly authority: "instance";
164
172
  };
165
173
  };
174
+ readonly leadingMedia: {
175
+ readonly type: "media";
176
+ readonly category: "Content";
177
+ readonly label: "Leading image";
178
+ readonly mediaKinds: readonly ["image"];
179
+ readonly authoring: {
180
+ readonly authority: "instance";
181
+ };
182
+ };
166
183
  readonly labelWeight: {
167
184
  readonly type: "string";
168
185
  readonly category: "Style";
@@ -1 +1 @@
1
- {"version":3,"file":"selectMeta.d.ts","sourceRoot":"","sources":["../../../../src/features/form/select/selectMeta.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsKe,CAAC"}
1
+ {"version":3,"file":"selectMeta.d.ts","sourceRoot":"","sources":["../../../../src/features/form/select/selectMeta.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsLe,CAAC"}
@@ -82,6 +82,15 @@ export const selectMeta = {
82
82
  key: 'label',
83
83
  schema: { type: 'string', category: 'Content', label: 'Label' },
84
84
  },
85
+ {
86
+ key: 'leadingMedia',
87
+ schema: {
88
+ type: 'media',
89
+ category: 'Content',
90
+ label: 'Leading image',
91
+ mediaKinds: ['image'],
92
+ },
93
+ },
85
94
  {
86
95
  key: 'disabled',
87
96
  schema: {
@@ -126,6 +135,13 @@ export const selectMeta = {
126
135
  mediaKinds: ['image'],
127
136
  authoring: { authority: 'instance' },
128
137
  },
138
+ leadingMedia: {
139
+ type: 'media',
140
+ category: 'Content',
141
+ label: 'Leading image',
142
+ mediaKinds: ['image'],
143
+ authoring: { authority: 'instance' },
144
+ },
129
145
  labelWeight: {
130
146
  type: 'string',
131
147
  category: 'Style',
@@ -1 +1 @@
1
- {"version":3,"file":"selectMeta.js","sourceRoot":"","sources":["../../../../src/features/form/select/selectMeta.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,WAAW;IACrB,WAAW,EACT,sGAAsG;IACxG,kBAAkB,EAAE,IAAI;IACxB,eAAe,EAAE,EAAE;IACnB,SAAS,EAAE;QACT,KAAK,EAAE,QAAQ;QACf,YAAY,EAAE;YACZ,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,QAAQ;YACrB,YAAY,EAAE,UAAU;YACxB,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,EAAE;gBAC5C,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE;gBAC7C,EAAE,KAAK,EAAE,UAA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jB,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,WAAW,EAAE;YACX,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,SAAS;YACnB,KAAK,EAAE,kBAAkB;YACzB,UAAU,EAAE,CAAC,OAAO,CAAC;YACrB,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,cAAc;YACrB,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC;YAC1B,OAAO,EAAE,UAAU;YACnB,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,WAAW;YAClB,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;QACD,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;KACF;CACmC,CAAC","sourcesContent":["import type { ZoraComponentMeta } from '../../../types/authoring';\n\nexport const selectMeta = {\n name: 'Select',\n category: 'component',\n description:\n 'Single-value form selection with Popover presentation on web and BottomSheet presentation on native.',\n directManifestNode: true,\n allowedChildren: [],\n blueprint: {\n label: 'Select',\n defaultProps: {\n label: 'Option',\n placeholder: 'Select',\n defaultValue: 'option-b',\n options: [\n { value: 'option-a', label: 'First option' },\n { value: 'option-b', label: 'Second option' },\n { value: 'option-c', label: 'Third option' },\n ],\n disabled: false,\n readOnly: false,\n invalid: false,\n },\n },\n bindings: {\n props: {\n value: {\n label: 'Value',\n description: 'Currently selected option value.',\n value: { type: 'string' },\n acceptsFallback: true,\n acceptsTransforms: true,\n },\n disabled: {\n label: 'Disabled',\n description: 'Whether the select is disabled.',\n value: { type: 'boolean' },\n acceptsFallback: true,\n acceptsTransforms: true,\n },\n },\n events: {\n valueChange: {\n label: 'Value change',\n description: 'Runs when the selected option value changes.',\n payload: {\n eventType: 'select.valueChange',\n fields: [{ path: 'value', type: 'string', label: 'Value' }],\n },\n },\n },\n },\n events: {\n valueChange: {\n label: 'Value change',\n eventType: 'select.valueChange',\n description: 'Emitted when the selected option value changes.',\n payloadFields: [{ path: 'value', type: 'string', label: 'Value' }],\n },\n },\n props: {\n defaultValue: {\n type: 'string',\n category: 'State',\n label: 'Initial value',\n authoring: { authority: 'instance' },\n },\n value: {\n type: 'string',\n category: 'State',\n label: 'Value',\n authoring: { authority: 'instance' },\n },\n options: {\n type: 'array',\n category: 'Content',\n label: 'Options',\n itemSchema: [\n {\n key: 'value',\n schema: { type: 'string', category: 'Content', label: 'Value' },\n },\n {\n key: 'label',\n schema: { type: 'string', category: 'Content', label: 'Label' },\n },\n {\n key: 'disabled',\n schema: {\n type: 'boolean',\n category: 'State',\n label: 'Disabled',\n default: false,\n },\n },\n ],\n authoring: { authority: 'instance' },\n },\n label: {\n type: 'string',\n category: 'Content',\n label: 'Label',\n authoring: { authority: 'instance' },\n },\n helperText: {\n type: 'string',\n category: 'Content',\n label: 'Helper text',\n authoring: { authority: 'instance' },\n },\n errorText: {\n type: 'string',\n category: 'Content',\n label: 'Error text',\n authoring: { authority: 'instance' },\n },\n placeholder: {\n type: 'string',\n category: 'Content',\n label: 'Placeholder',\n default: 'Select',\n authoring: { authority: 'instance' },\n },\n leadingIcon: {\n type: 'media',\n category: 'Content',\n label: 'Leading SVG icon',\n mediaKinds: ['image'],\n authoring: { authority: 'instance' },\n },\n labelWeight: {\n type: 'string',\n category: 'Style',\n label: 'Label weight',\n enum: ['semiBold', 'bold'],\n default: 'semiBold',\n authoring: { authority: 'instance' },\n },\n required: {\n type: 'boolean',\n category: 'State',\n label: 'Required',\n default: false,\n authoring: { authority: 'instance' },\n },\n disabled: {\n type: 'boolean',\n category: 'State',\n label: 'Disabled',\n default: false,\n authoring: { authority: 'instance' },\n },\n readOnly: {\n type: 'boolean',\n category: 'State',\n label: 'Read only',\n default: false,\n authoring: { authority: 'instance' },\n },\n invalid: {\n type: 'boolean',\n category: 'State',\n label: 'Invalid',\n default: false,\n authoring: { authority: 'instance' },\n },\n },\n} as const satisfies ZoraComponentMeta;\n"]}
1
+ {"version":3,"file":"selectMeta.js","sourceRoot":"","sources":["../../../../src/features/form/select/selectMeta.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,WAAW;IACrB,WAAW,EACT,sGAAsG;IACxG,kBAAkB,EAAE,IAAI;IACxB,eAAe,EAAE,EAAE;IACnB,SAAS,EAAE;QACT,KAAK,EAAE,QAAQ;QACf,YAAY,EAAE;YACZ,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,QAAQ;YACrB,YAAY,EAAE,UAAU;YACxB,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,EAAE;gBAC5C,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,eAAe,EAAE;gBAC7C,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,cAAc,EAAE;aAC7C;YACD,QAAQ,EAAE,KAAK;YACf,QAAQ,EAAE,KA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;YACP,IAAI,EAAE,SAAS;YACf,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,SAAS;YAChB,OAAO,EAAE,KAAK;YACd,SAAS,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE;SACrC;KACF;CACmC,CAAC","sourcesContent":["import type { ZoraComponentMeta } from '../../../types/authoring';\n\nexport const selectMeta = {\n name: 'Select',\n category: 'component',\n description:\n 'Single-value form selection with Popover presentation on web and BottomSheet presentation on native.',\n directManifestNode: true,\n allowedChildren: [],\n blueprint: {\n label: 'Select',\n defaultProps: {\n label: 'Option',\n placeholder: 'Select',\n defaultValue: 'option-b',\n options: [\n { value: 'option-a', label: 'First option' },\n { value: 'option-b', label: 'Second option' },\n { value: 'option-c', label: 'Third option' },\n ],\n disabled: false,\n readOnly: false,\n invalid: false,\n },\n },\n bindings: {\n props: {\n value: {\n label: 'Value',\n description: 'Currently selected option value.',\n value: { type: 'string' },\n acceptsFallback: true,\n acceptsTransforms: true,\n },\n disabled: {\n label: 'Disabled',\n description: 'Whether the select is disabled.',\n value: { type: 'boolean' },\n acceptsFallback: true,\n acceptsTransforms: true,\n },\n },\n events: {\n valueChange: {\n label: 'Value change',\n description: 'Runs when the selected option value changes.',\n payload: {\n eventType: 'select.valueChange',\n fields: [{ path: 'value', type: 'string', label: 'Value' }],\n },\n },\n },\n },\n events: {\n valueChange: {\n label: 'Value change',\n eventType: 'select.valueChange',\n description: 'Emitted when the selected option value changes.',\n payloadFields: [{ path: 'value', type: 'string', label: 'Value' }],\n },\n },\n props: {\n defaultValue: {\n type: 'string',\n category: 'State',\n label: 'Initial value',\n authoring: { authority: 'instance' },\n },\n value: {\n type: 'string',\n category: 'State',\n label: 'Value',\n authoring: { authority: 'instance' },\n },\n options: {\n type: 'array',\n category: 'Content',\n label: 'Options',\n itemSchema: [\n {\n key: 'value',\n schema: { type: 'string', category: 'Content', label: 'Value' },\n },\n {\n key: 'label',\n schema: { type: 'string', category: 'Content', label: 'Label' },\n },\n {\n key: 'leadingMedia',\n schema: {\n type: 'media',\n category: 'Content',\n label: 'Leading image',\n mediaKinds: ['image'],\n },\n },\n {\n key: 'disabled',\n schema: {\n type: 'boolean',\n category: 'State',\n label: 'Disabled',\n default: false,\n },\n },\n ],\n authoring: { authority: 'instance' },\n },\n label: {\n type: 'string',\n category: 'Content',\n label: 'Label',\n authoring: { authority: 'instance' },\n },\n helperText: {\n type: 'string',\n category: 'Content',\n label: 'Helper text',\n authoring: { authority: 'instance' },\n },\n errorText: {\n type: 'string',\n category: 'Content',\n label: 'Error text',\n authoring: { authority: 'instance' },\n },\n placeholder: {\n type: 'string',\n category: 'Content',\n label: 'Placeholder',\n default: 'Select',\n authoring: { authority: 'instance' },\n },\n leadingIcon: {\n type: 'media',\n category: 'Content',\n label: 'Leading SVG icon',\n mediaKinds: ['image'],\n authoring: { authority: 'instance' },\n },\n leadingMedia: {\n type: 'media',\n category: 'Content',\n label: 'Leading image',\n mediaKinds: ['image'],\n authoring: { authority: 'instance' },\n },\n labelWeight: {\n type: 'string',\n category: 'Style',\n label: 'Label weight',\n enum: ['semiBold', 'bold'],\n default: 'semiBold',\n authoring: { authority: 'instance' },\n },\n required: {\n type: 'boolean',\n category: 'State',\n label: 'Required',\n default: false,\n authoring: { authority: 'instance' },\n },\n disabled: {\n type: 'boolean',\n category: 'State',\n label: 'Disabled',\n default: false,\n authoring: { authority: 'instance' },\n },\n readOnly: {\n type: 'boolean',\n category: 'State',\n label: 'Read only',\n default: false,\n authoring: { authority: 'instance' },\n },\n invalid: {\n type: 'boolean',\n category: 'State',\n label: 'Invalid',\n default: false,\n authoring: { authority: 'instance' },\n },\n },\n} as const satisfies ZoraComponentMeta;\n"]}
@@ -1,8 +1,11 @@
1
1
  import type { ButtonIconSpec, ButtonLabelWeight } from '@ankhorage/surface';
2
2
  import type { ZoraBaseProps } from './base';
3
+ import type { ImageProps } from './image';
3
4
  export interface SelectOption<TValue extends string = string> {
4
5
  value: TValue;
5
6
  label: string;
7
+ /** Optional image rendered before this option label and in the trigger when selected. */
8
+ leadingMedia?: ImageProps['source'];
6
9
  disabled?: boolean;
7
10
  }
8
11
  export interface SelectProps<TValue extends string = string> extends ZoraBaseProps {
@@ -16,6 +19,11 @@ export interface SelectProps<TValue extends string = string> extends ZoraBasePro
16
19
  placeholder?: string;
17
20
  /** Optional Surface icon source rendered before the trigger label. */
18
21
  leadingIcon?: ButtonIconSpec;
22
+ /**
23
+ * Optional image rendered before the trigger label. A selected option's leadingMedia takes
24
+ * precedence. When present, media takes precedence over leadingIcon.
25
+ */
26
+ leadingMedia?: ImageProps['source'];
19
27
  /** Optional Surface Button label emphasis; defaults to semiBold. */
20
28
  labelWeight?: ButtonLabelWeight;
21
29
  required?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../src/types/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,MAAM,WAAW,YAAY,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,WAAW,CAAC,MAAM,SAAS,MAAM,GAAG,MAAM,CAAE,SAAQ,aAAa;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,SAAS,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC;IACzC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,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,CAAC,EAAE,cAAc,CAAC;IAC7B;;;OAGG;IACH,YAAY,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IACpC,oEAAoE;IACpE,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/types/select.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonIconSpec, ButtonLabelWeight } from '@ankhorage/surface';\n\nimport type { ZoraBaseProps } from './base';\n\nexport interface SelectOption<TValue extends string = string> {\n value: TValue;\n label: string;\n disabled?: boolean;\n}\n\nexport interface SelectProps<TValue extends string = string> extends ZoraBaseProps {\n value?: TValue;\n defaultValue?: TValue;\n options: readonly SelectOption<TValue>[];\n onValueChange?: (value: TValue) => void;\n label?: string;\n helperText?: string;\n errorText?: string;\n placeholder?: string;\n /** Optional Surface icon source rendered before the trigger label. */\n leadingIcon?: ButtonIconSpec;\n /** Optional Surface Button label emphasis; defaults to semiBold. */\n labelWeight?: ButtonLabelWeight;\n required?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n invalid?: boolean;\n testID?: string;\n}\n"]}
1
+ {"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/types/select.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonIconSpec, ButtonLabelWeight } from '@ankhorage/surface';\n\nimport type { ZoraBaseProps } from './base';\nimport type { ImageProps } from './image';\n\nexport interface SelectOption<TValue extends string = string> {\n value: TValue;\n label: string;\n /** Optional image rendered before this option label and in the trigger when selected. */\n leadingMedia?: ImageProps['source'];\n disabled?: boolean;\n}\n\nexport interface SelectProps<TValue extends string = string> extends ZoraBaseProps {\n value?: TValue;\n defaultValue?: TValue;\n options: readonly SelectOption<TValue>[];\n onValueChange?: (value: TValue) => void;\n label?: string;\n helperText?: string;\n errorText?: string;\n placeholder?: string;\n /** Optional Surface icon source rendered before the trigger label. */\n leadingIcon?: ButtonIconSpec;\n /**\n * Optional image rendered before the trigger label. A selected option's leadingMedia takes\n * precedence. When present, media takes precedence over leadingIcon.\n */\n leadingMedia?: ImageProps['source'];\n /** Optional Surface Button label emphasis; defaults to semiBold. */\n labelWeight?: ButtonLabelWeight;\n required?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n invalid?: boolean;\n testID?: string;\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ankhorage/zora",
3
3
  "type": "module",
4
- "version": "27.10.6",
4
+ "version": "27.11.0",
5
5
  "description": "Opinionated React Native and React Native Web UI kit built on @ankhorage/surface.",
6
6
  "homepage": "https://github.com/ankhorage/zora#readme",
7
7
  "bugs": {
@@ -140,6 +140,11 @@
140
140
  "import": "./dist/authoring.js",
141
141
  "default": "./dist/authoring.js"
142
142
  },
143
+ "./web": {
144
+ "types": "./web-dist/index.d.ts",
145
+ "import": "./web-dist/index.js",
146
+ "default": "./web-dist/index.js"
147
+ },
143
148
  "./web/runtime": {
144
149
  "types": "./web-dist/runtime/ZoraProvider.d.ts",
145
150
  "import": "./web-dist/runtime/ZoraProvider.js",
@@ -191,8 +196,8 @@
191
196
  "@react-native-vector-icons/material-design-icons": "^14.0.0",
192
197
  "@types/bun": "^1.4.2",
193
198
  "@types/culori": "^4.0.1",
194
- "@types/node": "^26.6.6",
195
- "@types/react": "^19.3.0",
199
+ "@types/node": "^26.6.10",
200
+ "@types/react": "^19.3.1",
196
201
  "@types/react-dom": "^19.3.0",
197
202
  "@types/react-native-web": "^0.19.3",
198
203
  "cytoscape": "^3.35.0",
@@ -66,7 +66,12 @@ function SelectInner<TValue extends string = string>({
66
66
 
67
67
  return (
68
68
  <SelectField props={props}>
69
- <SelectTrigger displayLabel={selectedOption?.label} onPress={openSelect} props={props} />
69
+ <SelectTrigger
70
+ displayLabel={selectedOption?.label}
71
+ leadingMedia={selectedOption?.leadingMedia}
72
+ onPress={openSelect}
73
+ props={props}
74
+ />
70
75
  </SelectField>
71
76
  );
72
77
  }
@@ -35,7 +35,12 @@ function SelectInner<TValue extends string = string>({
35
35
  <SelectField props={props}>
36
36
  <Popover
37
37
  anchor={({ toggle }) => (
38
- <SelectTrigger displayLabel={selectedOption?.label} onPress={toggle} props={props} />
38
+ <SelectTrigger
39
+ displayLabel={selectedOption?.label}
40
+ leadingMedia={selectedOption?.leadingMedia}
41
+ onPress={toggle}
42
+ props={props}
43
+ />
39
44
  )}
40
45
  interactionPolicy={props.interactionPolicy}
41
46
  onOpenChange={setOpen}
@@ -1,5 +1,12 @@
1
+ import { Pressable } from '@ankhorage/surface';
2
+
1
3
  import type { SelectOption, SelectProps } from '../../../../types/select';
2
4
  import { Button } from '../../../button/public';
5
+ import { Icon } from '../../../icon/public';
6
+ import { Image } from '../../../image/public';
7
+ import { View } from '../../../layout/public';
8
+ import { useZoraTheme } from '../../../theme/composition/useZoraTheme';
9
+ import { Text } from '../../../typography/public';
3
10
 
4
11
  const SELECTED_ICON = { name: 'checkmark' } as const;
5
12
 
@@ -11,6 +18,41 @@ export function SelectOptionRow<TValue extends string>({
11
18
  selected,
12
19
  testID,
13
20
  }: SelectOptionRowProps<TValue>) {
21
+ const { theme } = useZoraTheme();
22
+
23
+ if (option.leadingMedia) {
24
+ return (
25
+ <Pressable
26
+ accessibilityLabel={option.label}
27
+ disabled={option.disabled}
28
+ interactionPolicy={interactionPolicy}
29
+ onPress={() => onSelect(option.value)}
30
+ style={{ alignSelf: 'stretch' }}
31
+ testID={testID ? `${testID}-option-${option.value}` : undefined}
32
+ >
33
+ <View
34
+ align="center"
35
+ bg={selected ? theme.semantics.action.primary.softBg : 'transparent'}
36
+ direction="row"
37
+ gap="s"
38
+ minHeight={44}
39
+ px="m"
40
+ radius="m"
41
+ >
42
+ <Image alt="" height={28} radius="s" source={option.leadingMedia} width={28} />
43
+ <View flex={1}>
44
+ <Text color={selected ? 'primary' : undefined} numberOfLines={1} variant="label">
45
+ {option.label}
46
+ </Text>
47
+ </View>
48
+ {selected ? (
49
+ <Icon color={theme.semantics.action.primary.base} name="checkmark" size={18} />
50
+ ) : null}
51
+ </View>
52
+ </Pressable>
53
+ );
54
+ }
55
+
14
56
  return (
15
57
  <Button
16
58
  color={selected ? 'primary' : 'neutral'}
@@ -1,14 +1,63 @@
1
+ import { Pressable } from '@ankhorage/surface';
2
+
1
3
  import type { SelectProps } from '../../../../types/select';
2
4
  import { Button } from '../../../button/public';
5
+ import { Icon } from '../../../icon/public';
6
+ import { Image } from '../../../image/public';
7
+ import { View } from '../../../layout/public';
8
+ import { useZoraTheme } from '../../../theme/composition/useZoraTheme';
9
+ import { Text } from '../../../typography/public';
3
10
 
4
11
  const SELECT_CHEVRON_ICON = { name: 'chevron-down' } as const;
5
12
 
6
13
  /*** Renders the shared Select trigger with the resolved option label or placeholder. */
7
14
  export function SelectTrigger<TValue extends string>({
8
15
  displayLabel,
16
+ leadingMedia,
9
17
  onPress,
10
18
  props,
11
19
  }: SelectTriggerProps<TValue>) {
20
+ const { theme } = useZoraTheme();
21
+ const media = leadingMedia ?? props.leadingMedia;
22
+
23
+ if (media) {
24
+ return (
25
+ <Pressable
26
+ accessibilityLabel={displayLabel ?? props.placeholder ?? 'Select'}
27
+ disabled={props.disabled}
28
+ interactionPolicy={props.interactionPolicy}
29
+ onPress={props.readOnly ? undefined : onPress}
30
+ style={{ alignSelf: 'stretch' }}
31
+ testID={props.testID ? `${props.testID}-trigger` : undefined}
32
+ >
33
+ <View
34
+ align="center"
35
+ bg={props.invalid ? theme.semantics.error.softBg : theme.semantics.neutral.surface}
36
+ borderColor={props.invalid ? theme.semantics.error.base : theme.semantics.neutral.divider}
37
+ borderWidth={1}
38
+ direction="row"
39
+ gap="s"
40
+ minHeight={44}
41
+ px="m"
42
+ radius="m"
43
+ >
44
+ <Image alt="" height={28} radius="s" source={media} width={28} />
45
+ <View flex={1}>
46
+ <Text
47
+ emphasis={displayLabel ? 'default' : 'muted'}
48
+ numberOfLines={1}
49
+ variant="label"
50
+ weight={props.labelWeight ?? 'semiBold'}
51
+ >
52
+ {displayLabel ?? props.placeholder ?? 'Select'}
53
+ </Text>
54
+ </View>
55
+ <Icon name="chevron-down" size={18} />
56
+ </View>
57
+ </Pressable>
58
+ );
59
+ }
60
+
12
61
  return (
13
62
  <Button
14
63
  color={props.invalid ? 'danger' : 'neutral'}
@@ -29,6 +78,7 @@ export function SelectTrigger<TValue extends string>({
29
78
 
30
79
  interface SelectTriggerProps<TValue extends string> {
31
80
  displayLabel: string | undefined;
81
+ leadingMedia: SelectProps<TValue>['leadingMedia'];
32
82
  onPress: () => void;
33
83
  props: SelectProps<TValue>;
34
84
  }
@@ -21,6 +21,25 @@ test('Select registers the optional leading icon as instance-owned media metadat
21
21
  });
22
22
  });
23
23
 
24
+ test('Select registers leading images for the trigger and individual options', () => {
25
+ expect(selectMeta.props.leadingMedia).toEqual({
26
+ type: 'media',
27
+ category: 'Content',
28
+ label: 'Leading image',
29
+ mediaKinds: ['image'],
30
+ authoring: { authority: 'instance' },
31
+ });
32
+ expect(selectMeta.props.options.itemSchema).toContainEqual({
33
+ key: 'leadingMedia',
34
+ schema: {
35
+ type: 'media',
36
+ category: 'Content',
37
+ label: 'Leading image',
38
+ mediaKinds: ['image'],
39
+ },
40
+ });
41
+ });
42
+
24
43
  test('Select registers optional trigger label emphasis as serializable metadata', () => {
25
44
  expect(selectMeta.props.labelWeight).toEqual({
26
45
  type: 'string',
@@ -52,10 +71,12 @@ test('Select uses web Popover and native BottomSheetFlatList presentation', asyn
52
71
  expect(web).toContain("import { Popover } from '@ankhorage/surface';");
53
72
  expect(native).toContain('<BottomSheetFlatList');
54
73
  expect(native).toContain("contentMode: 'direct'");
74
+ expect(web).toContain('leadingMedia={selectedOption?.leadingMedia}');
75
+ expect(native).toContain('leadingMedia={selectedOption?.leadingMedia}');
55
76
  expect(`${neutral}\n${web}\n${native}`).not.toContain('@react-native-picker/picker');
56
77
  });
57
78
 
58
- test('Select supports default weight, bold emphasis, SVG icons, and their combination', async () => {
79
+ test('Select supports label emphasis, SVG icons, and leading images', async () => {
59
80
  const props: SelectProps = {
60
81
  options: [{ label: 'Workspace', value: 'workspace' }],
61
82
  };
@@ -69,11 +90,22 @@ test('Select supports default weight, bold emphasis, SVG icons, and their combin
69
90
  { ...props, leadingIcon: svgIcon },
70
91
  { ...props, labelWeight: 'bold', leadingIcon: svgIcon },
71
92
  ] satisfies readonly SelectProps[];
93
+ const imageSource = { uri: 'https://cdn.example.test/atlas-option.png' } as const;
94
+ const mediaConfigurations = [
95
+ { ...props, leadingMedia: imageSource },
96
+ { ...props, options: [{ label: 'Workspace', value: 'workspace', leadingMedia: imageSource }] },
97
+ ] satisfies readonly SelectProps[];
72
98
  const selectTrigger = await Bun.file(
73
99
  'src/features/form/select/composition/SelectTrigger.tsx',
74
100
  ).text();
101
+ const selectOptionRow = await Bun.file(
102
+ 'src/features/form/select/composition/SelectOptionRow.tsx',
103
+ ).text();
75
104
 
76
105
  expect(configurations).toHaveLength(4);
106
+ expect(mediaConfigurations).toHaveLength(2);
77
107
  expect(selectTrigger).toContain("labelWeight={props.labelWeight ?? 'semiBold'}");
78
108
  expect(selectTrigger).toContain('leadingIcon={props.leadingIcon}');
109
+ expect(selectTrigger).toContain('source={media}');
110
+ expect(selectOptionRow).toContain('source={option.leadingMedia}');
79
111
  });