@kanso-labs/react-native-kanso-ui 0.9.0 → 0.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 (217) hide show
  1. package/README.md +4 -3
  2. package/dist/autocomplete/index.js +15 -1
  3. package/dist/autocomplete/index.js.map +1 -1
  4. package/dist/button/group.d.ts +5 -0
  5. package/dist/button/group.js +115 -0
  6. package/dist/button/group.js.map +1 -0
  7. package/dist/button/index.d.ts +4 -1
  8. package/dist/button/index.js +44 -22
  9. package/dist/button/index.js.map +1 -1
  10. package/dist/button/slots.js +2 -1
  11. package/dist/button/slots.js.map +1 -1
  12. package/dist/calendar/index.js +351 -182
  13. package/dist/calendar/index.js.map +1 -1
  14. package/dist/calendar/styles.js +33 -2
  15. package/dist/calendar/styles.js.map +1 -1
  16. package/dist/carousel/arrangement.d.ts +5 -0
  17. package/dist/carousel/arrangement.js +123 -0
  18. package/dist/carousel/arrangement.js.map +1 -0
  19. package/dist/chequer/index.js +95 -0
  20. package/dist/chequer/index.js.map +1 -0
  21. package/dist/collection/index.d.ts +157 -0
  22. package/dist/collection/index.js +1358 -0
  23. package/dist/collection/index.js.map +1 -0
  24. package/dist/color-thumb/index.js +56 -0
  25. package/dist/color-thumb/index.js.map +1 -0
  26. package/dist/components/button/index.d.ts +4 -2
  27. package/dist/components/button/index.js +227 -188
  28. package/dist/components/button/index.js.map +1 -1
  29. package/dist/components/button-group/index.d.ts +87 -0
  30. package/dist/components/button-group/index.js +275 -0
  31. package/dist/components/button-group/index.js.map +1 -0
  32. package/dist/components/calendar/index.d.ts +11 -3
  33. package/dist/components/calendar/index.js +60 -45
  34. package/dist/components/calendar/index.js.map +1 -1
  35. package/dist/components/carousel/index.d.ts +72 -0
  36. package/dist/components/carousel/index.js +496 -0
  37. package/dist/components/carousel/index.js.map +1 -0
  38. package/dist/components/checkbox-group/index.d.ts +3 -4
  39. package/dist/components/checkbox-group/index.js +1 -1
  40. package/dist/components/checkbox-group/index.js.map +1 -1
  41. package/dist/components/chip/index.d.ts +4 -1
  42. package/dist/components/chip/index.js +229 -161
  43. package/dist/components/chip/index.js.map +1 -1
  44. package/dist/components/color-area/index.d.ts +85 -0
  45. package/dist/components/color-area/index.js +630 -0
  46. package/dist/components/color-area/index.js.map +1 -0
  47. package/dist/components/color-field/index.d.ts +144 -0
  48. package/dist/components/color-field/index.js +516 -0
  49. package/dist/components/color-field/index.js.map +1 -0
  50. package/dist/components/color-picker/index.d.ts +74 -0
  51. package/dist/components/color-picker/index.js +317 -0
  52. package/dist/components/color-picker/index.js.map +1 -0
  53. package/dist/components/color-slider/index.d.ts +82 -0
  54. package/dist/components/color-slider/index.js +456 -0
  55. package/dist/components/color-slider/index.js.map +1 -0
  56. package/dist/components/color-swatch/index.d.ts +46 -0
  57. package/dist/components/color-swatch/index.js +127 -0
  58. package/dist/components/color-swatch/index.js.map +1 -0
  59. package/dist/components/color-swatch-picker/index.d.ts +81 -0
  60. package/dist/components/color-swatch-picker/index.js +287 -0
  61. package/dist/components/color-swatch-picker/index.js.map +1 -0
  62. package/dist/components/color-wheel/index.d.ts +71 -0
  63. package/dist/components/color-wheel/index.js +407 -0
  64. package/dist/components/color-wheel/index.js.map +1 -0
  65. package/dist/components/combo-box/index.d.ts +193 -0
  66. package/dist/components/combo-box/index.js +616 -0
  67. package/dist/components/combo-box/index.js.map +1 -0
  68. package/dist/components/date-field/index.d.ts +120 -0
  69. package/dist/components/date-field/index.js +111 -0
  70. package/dist/components/date-field/index.js.map +1 -0
  71. package/dist/components/date-picker/index.d.ts +130 -0
  72. package/dist/components/date-picker/index.js +310 -0
  73. package/dist/components/date-picker/index.js.map +1 -0
  74. package/dist/components/date-range-picker/index.d.ts +139 -0
  75. package/dist/components/date-range-picker/index.js +421 -0
  76. package/dist/components/date-range-picker/index.js.map +1 -0
  77. package/dist/components/dialog/index.d.ts +5 -5
  78. package/dist/components/dialog/index.js +5 -5
  79. package/dist/components/dialog/index.js.map +1 -1
  80. package/dist/components/disclosure/index.d.ts +94 -0
  81. package/dist/components/disclosure/index.js +365 -0
  82. package/dist/components/disclosure/index.js.map +1 -0
  83. package/dist/components/disclosure-group/index.d.ts +61 -0
  84. package/dist/components/disclosure-group/index.js +100 -0
  85. package/dist/components/disclosure-group/index.js.map +1 -0
  86. package/dist/components/drop-zone/index.d.ts +113 -0
  87. package/dist/components/drop-zone/index.js +304 -0
  88. package/dist/components/drop-zone/index.js.map +1 -0
  89. package/dist/components/fab/index.d.ts +1 -1
  90. package/dist/components/fab/index.js +91 -76
  91. package/dist/components/fab/index.js.map +1 -1
  92. package/dist/components/form/index.d.ts +3 -2
  93. package/dist/components/form/index.js.map +1 -1
  94. package/dist/components/icon-button/index.d.ts +4 -2
  95. package/dist/components/icon-button/index.js +204 -171
  96. package/dist/components/icon-button/index.js.map +1 -1
  97. package/dist/components/list/index.d.ts +15 -158
  98. package/dist/components/list/index.js +21 -1047
  99. package/dist/components/list/index.js.map +1 -1
  100. package/dist/components/list-box/index.d.ts +73 -0
  101. package/dist/components/list-box/index.js +82 -0
  102. package/dist/components/list-box/index.js.map +1 -0
  103. package/dist/components/loading-indicator/index.d.ts +32 -0
  104. package/dist/components/loading-indicator/index.js +174 -0
  105. package/dist/components/loading-indicator/index.js.map +1 -0
  106. package/dist/components/menu/index.d.ts +3 -3
  107. package/dist/components/menu/index.js +3 -3
  108. package/dist/components/menu/index.js.map +1 -1
  109. package/dist/components/navigation-tree/index.d.ts +117 -0
  110. package/dist/components/navigation-tree/index.js +135 -0
  111. package/dist/components/navigation-tree/index.js.map +1 -0
  112. package/dist/components/number-field/index.js +132 -143
  113. package/dist/components/number-field/index.js.map +1 -1
  114. package/dist/components/popover/index.d.ts +2 -2
  115. package/dist/components/popover/index.js +2 -2
  116. package/dist/components/popover/index.js.map +1 -1
  117. package/dist/components/range-calendar/index.d.ts +69 -0
  118. package/dist/components/range-calendar/index.js +144 -0
  119. package/dist/components/range-calendar/index.js.map +1 -0
  120. package/dist/components/search-view/index.d.ts +79 -0
  121. package/dist/components/search-view/index.js +571 -0
  122. package/dist/components/search-view/index.js.map +1 -0
  123. package/dist/components/select/index.d.ts +152 -0
  124. package/dist/components/select/index.js +419 -0
  125. package/dist/components/select/index.js.map +1 -0
  126. package/dist/components/sheet/index.d.ts +16 -7
  127. package/dist/components/sheet/index.js +157 -152
  128. package/dist/components/sheet/index.js.map +1 -1
  129. package/dist/components/slider/index.d.ts +111 -0
  130. package/dist/components/slider/index.js +673 -0
  131. package/dist/components/slider/index.js.map +1 -0
  132. package/dist/components/split-button/index.d.ts +77 -0
  133. package/dist/components/split-button/index.js +354 -0
  134. package/dist/components/split-button/index.js.map +1 -0
  135. package/dist/components/table/index.d.ts +391 -0
  136. package/dist/components/table/index.js +1708 -0
  137. package/dist/components/table/index.js.map +1 -0
  138. package/dist/components/tabs/index.d.ts +196 -0
  139. package/dist/components/tabs/index.js +1137 -0
  140. package/dist/components/tabs/index.js.map +1 -0
  141. package/dist/components/time-field/index.d.ts +43 -0
  142. package/dist/components/time-field/index.js +107 -0
  143. package/dist/components/time-field/index.js.map +1 -0
  144. package/dist/components/time-picker/index.d.ts +65 -0
  145. package/dist/components/time-picker/index.js +1168 -0
  146. package/dist/components/time-picker/index.js.map +1 -0
  147. package/dist/components/token-field/index.d.ts +105 -0
  148. package/dist/components/token-field/index.js +574 -0
  149. package/dist/components/token-field/index.js.map +1 -0
  150. package/dist/components/tooltip/index.d.ts +102 -0
  151. package/dist/components/tooltip/index.js +223 -0
  152. package/dist/components/tooltip/index.js.map +1 -0
  153. package/dist/components/tree/index.d.ts +112 -0
  154. package/dist/components/tree/index.js +157 -0
  155. package/dist/components/tree/index.js.map +1 -0
  156. package/dist/disclosure/chevron.js +75 -0
  157. package/dist/disclosure/chevron.js.map +1 -0
  158. package/dist/disclosure/index.js +7 -0
  159. package/dist/disclosure/index.js.map +1 -0
  160. package/dist/drop/index.d.ts +54 -0
  161. package/dist/drop/index.js +161 -0
  162. package/dist/drop/index.js.map +1 -0
  163. package/dist/field/chevron.js +74 -0
  164. package/dist/field/chevron.js.map +1 -0
  165. package/dist/field/index.d.ts +2 -1
  166. package/dist/field/index.js +359 -154
  167. package/dist/field/index.js.map +1 -1
  168. package/dist/field/styles.js +18 -1
  169. package/dist/field/styles.js.map +1 -1
  170. package/dist/files/index.d.ts +18 -0
  171. package/dist/files/index.js +107 -0
  172. package/dist/files/index.js.map +1 -0
  173. package/dist/form/index.d.ts +5 -2
  174. package/dist/form/index.js +64 -85
  175. package/dist/form/index.js.map +1 -1
  176. package/dist/glyphs/index.js +128 -1
  177. package/dist/glyphs/index.js.map +1 -1
  178. package/dist/i18n/index.js +36 -1
  179. package/dist/i18n/index.js.map +1 -1
  180. package/dist/i18n/messages.js +1734 -34
  181. package/dist/i18n/messages.js.map +1 -1
  182. package/dist/index.d.ts +37 -3
  183. package/dist/index.js +36 -3
  184. package/dist/indicator/paths.js +23 -1
  185. package/dist/indicator/paths.js.map +1 -1
  186. package/dist/modal/index.js +92 -77
  187. package/dist/modal/index.js.map +1 -1
  188. package/dist/number/keyboard.js +16 -0
  189. package/dist/number/keyboard.js.map +1 -0
  190. package/dist/overlay/anchored.js +68 -38
  191. package/dist/overlay/anchored.js.map +1 -1
  192. package/dist/overlay/keyboard.js +57 -0
  193. package/dist/overlay/keyboard.js.map +1 -0
  194. package/dist/overlay/panel.js +173 -19
  195. package/dist/overlay/panel.js.map +1 -1
  196. package/dist/overlay/placement.js +13 -1
  197. package/dist/overlay/placement.js.map +1 -1
  198. package/dist/picker/index.js +322 -0
  199. package/dist/picker/index.js.map +1 -0
  200. package/dist/press/index.d.ts +2 -0
  201. package/dist/press/index.js +102 -100
  202. package/dist/press/index.js.map +1 -1
  203. package/dist/row/index.js +77 -69
  204. package/dist/row/index.js.map +1 -1
  205. package/dist/row/styles.js +13 -2
  206. package/dist/row/styles.js.map +1 -1
  207. package/dist/segments/field.js +277 -0
  208. package/dist/segments/field.js.map +1 -0
  209. package/dist/segments/index.js +574 -0
  210. package/dist/segments/index.js.map +1 -0
  211. package/dist/segments/styles.js +24 -0
  212. package/dist/segments/styles.js.map +1 -0
  213. package/dist/slider/index.js +145 -0
  214. package/dist/slider/index.js.map +1 -0
  215. package/dist/swatch/index.js +56 -0
  216. package/dist/swatch/index.js.map +1 -0
  217. package/package.json +11 -2
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","StyleProp","TextStyle","ViewProps","ViewStyle","CheckboxGroupState","useId","useState","Text","NativeText","Platform","StyleSheet","useWindowDimensions","View","useCheckboxGroupState","CheckboxGroupContextValue","ValidationResult","messageOf","CheckboxGroupContext","createMembers","useErrorAnnouncement","useFieldValidation","useInsideForm","withOpacity","useTheme","composeStyles","themedStyles","useTypeRole","CheckboxGroupProps","Omit","children","defaultValue","description","error","isDisabled","isReadOnly","isRequired","label","name","onChange","value","ref","style","validate","REQUIRED_MARK","ATOMIC","const","stylesOf","colors","spacing","stateLayerOpacity","create","items","flexDirection","color","onSurfaceVariant","labelDisabled","onSurface","disabledContent","labelError","message","messageError","messageLine","marginTop","xs","messageLineCollapsed","position","outOfFlow","root","rowGap","CheckboxGroup","t0","$","_c","props","t1","t2","t3","undefined","theme","t4","copyOf","t5","t6","state","members","t7","length","t8","control","isEmpty","submitted","validation","labelId","messageId","labelRole","messageRole","insideForm","fontScale","own","shown","invalid","holdsLine","t9","contextOf","context","messageStyle","t10","lineOf","t11","t12","T0","t13","minHeightOf","typography","bodySmallLineHeight","t14","t15","t16","OS","t17","t18","onBlur","onEdit","isInvalid","isSelected","entry","set","addValue","removeValue","entries","id","minHeight","_c","NativeText"],"sources":["../../../src/components/checkbox-group/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type { StyleProp, TextStyle, ViewProps, ViewStyle } from 'react-native'\nimport type { CheckboxGroupState } from 'react-stately/useCheckboxGroupState'\n\nimport { useId, useState } from 'react'\nimport {\n Text as NativeText,\n Platform,\n StyleSheet,\n useWindowDimensions,\n View,\n} from 'react-native'\nimport { useCheckboxGroupState } from 'react-stately/useCheckboxGroupState'\n\nimport type { CheckboxGroupContextValue } from '../../control/group'\nimport type { ValidationResult } from '../../form'\n\nimport { messageOf } from '../../control'\nimport { CheckboxGroupContext, createMembers } from '../../control/group'\nimport { useErrorAnnouncement } from '../../field'\nimport { useFieldValidation, useInsideForm } from '../../form'\nimport { withOpacity } from '../../theme/color'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\nimport { useTypeRole } from '../../typography/roles'\n\n// kanso-ui's CheckboxGroup: a labelled set of checkboxes sharing one value.\n// The checkbox page draws the boxes; the group is what the pattern asks for\n// around them, a group named by its label, described by the line under it\n// and invalid as a whole, and its label and that line are the field chrome's,\n// so a group reads like the fields beside it.\n//\n// The group is a column: its label in label large, the checkboxes, and the\n// line under them, 4dp apart, with the line a further 4dp down, as web's\n// field chrome sets them out and RadioGroup does here. The label is on\n// surface variant, error while the group has one, and on surface at the\n// disabled opacity while disabled, with the required mark a field's label\n// carries. The line is not inset, since a group has no box to line it up\n// with.\n//\n// The value is React Stately's, as web's is React Aria's, and the group hands\n// it to its checkboxes through src/control/group, as RadioGroup hands its\n// buttons theirs. Its validation is src/form's, as a field's is: `isRequired`,\n// `validate`, and the form's errors under the group's `name`. A native Form\n// holding it back focuses its first checkbox.\n//\n// Inside a Form the line is held from the start, as web's is, so an error\n// arriving on submit moves nothing under the group. Outside one it takes\n// space only while there is something in it, and stays mounted for the live\n// region inside it, which has to be in place before the error it announces.\n\ntype CheckboxGroupProps = Omit<ViewProps, 'children' | 'style'> & {\n /** The checkboxes, each with a `value` of its own. */\n readonly children?: ReactNode\n /** The entries selected at first, when the group keeps its own value. */\n readonly defaultValue?: readonly string[]\n /**\n * A hint under the group. Replaced by `error` when there is one, so the\n * two never stack.\n */\n readonly description?: string\n /**\n * The problem with the current selection, in words. Its presence is what\n * puts the group in its error state: the message, the label's colour and\n * every box's error colours follow from it.\n *\n * Outside a `Form` the line under the group arrives with the message, so\n * the group grows when this does and moves what is under it. A `Form`\n * holds that space from the start; so does a permanent `description`.\n */\n readonly error?: string\n /**\n * Draws every checkbox disabled, and takes no presses.\n * @default false\n */\n readonly isDisabled?: boolean\n /**\n * Shows the selection without letting a press change it.\n * @default false\n */\n readonly isReadOnly?: boolean\n /**\n * Marks the group's label, and has a `native` form hold submission back\n * while nothing is selected.\n * @default false\n */\n readonly isRequired?: boolean\n /**\n * What the group is for. Required rather than optional: a group of\n * checkboxes with no name is a set of boxes a screen reader cannot\n * introduce.\n */\n readonly label: string\n /**\n * The name the form around the group knows it by, which its\n * `validationErrors` are keyed on. A form hands `onSubmit` one string per\n * name, so a group's selection is not among those values: read it through\n * `onChange`, or hold it with `value`.\n */\n readonly name?: string\n /** Called with the newly selected entries whenever a press changes them. */\n readonly onChange?: (value: string[]) => void\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n /**\n * Checks the selection, returning its problem in words, or `true`, `null`\n * or `undefined` when there is none. Shown as it changes, or under a\n * `native` form once a submission is tried.\n */\n readonly validate?: (value: readonly string[]) => ValidationResult\n /**\n * The selected entries, for a call site holding the value itself with\n * `onChange`.\n */\n readonly value?: readonly string[]\n}\n\n// What marks a required group's label, as a field's label marks one.\nconst REQUIRED_MARK = '*'\n\n// What has a live region on the web read its whole content again whenever\n// any of it changes, as the field's line does.\nconst ATOMIC = { 'aria-atomic': true } as const\n\nconst stylesOf = themedStyles(({ colors, spacing, stateLayerOpacity }) =>\n StyleSheet.create({\n // The group's checkboxes, one under another.\n items: {\n flexDirection: 'column',\n },\n label: {\n color: colors.onSurfaceVariant,\n },\n labelDisabled: {\n color: withOpacity(colors.onSurface, stateLayerOpacity.disabledContent),\n },\n labelError: {\n color: colors.error,\n },\n message: {\n color: colors.onSurfaceVariant,\n },\n messageError: {\n color: colors.error,\n },\n messageLine: {\n marginTop: spacing.xs,\n },\n // The line with nothing to show: out of the flow, so the group ends at\n // its last checkbox, and still there for the live region inside it.\n messageLineCollapsed: {\n marginTop: 0,\n position: 'absolute',\n },\n // The live region with nothing in it, which takes no place in the line.\n outOfFlow: {\n position: 'absolute',\n },\n root: {\n flexDirection: 'column',\n rowGap: spacing.xs,\n },\n }),\n)\n\n/**\n * A labelled set of checkboxes with one value between them. The value is\n * React Stately's, as web's is React Aria's: pass `value` with `onChange` to\n * control it, or `defaultValue` to let the group keep its own, and each\n * `Checkbox` inside names the entry it stands for with `value`. Disabled,\n * read-only and the error state reach every checkbox from here.\n *\n * ```tsx\n * <CheckboxGroup defaultValue={['first']} label=\"Label\">\n * <Checkbox value=\"first\">First item</Checkbox>\n * <Checkbox value=\"second\">Second item</Checkbox>\n * </CheckboxGroup>\n * ```\n *\n * A screen reader hears it as a group named by its label. On the web the\n * line under it describes the group, as web's does; on iOS and Android it is\n * read after the checkboxes, where it sits, and an error is announced as it\n * arrives. `style`, `ref` and `testID` land on the group as a whole, which is\n * the element a layout positions.\n */\nfunction CheckboxGroup({\n children,\n defaultValue,\n description,\n error,\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n label,\n name,\n onChange,\n style,\n validate,\n value,\n ...props\n}: CheckboxGroupProps) {\n const theme = useTheme()\n const state = useCheckboxGroupState({\n defaultValue: copyOf(defaultValue),\n isDisabled,\n isReadOnly,\n onChange,\n value: copyOf(value),\n })\n const [members] = useState(createMembers)\n const validation = useFieldValidation({\n control: members,\n error,\n isDisabled,\n isEmpty: state.value.length === 0,\n isReadOnly,\n isRequired,\n name,\n submitted: undefined,\n validate,\n value: state.value,\n })\n const labelId = useId()\n const messageId = useId()\n const labelRole = useTypeRole('labelLarge')\n const messageRole = useTypeRole('bodySmall')\n const insideForm = useInsideForm()\n const { fontScale } = useWindowDimensions()\n\n const own = stylesOf(theme)\n const shown = validation.error\n const invalid = shown !== undefined\n const message = messageOf(description, shown)\n const holdsLine = insideForm || message !== undefined\n const context = contextOf(state, members, validation, invalid)\n const messageStyle = composeStyles<TextStyle>(\n messageRole,\n own.message,\n invalid ? own.messageError : undefined,\n )\n\n useErrorAnnouncement(shown)\n\n return (\n <View\n {...props}\n aria-labelledby={labelId}\n role=\"group\"\n {...lineOf(messageId, message)}\n style={composeStyles<ViewStyle>(own.root, style)}\n >\n <NativeText\n id={labelId}\n style={composeStyles<TextStyle>(\n labelRole,\n own.label,\n isDisabled ? own.labelDisabled : undefined,\n invalid ? own.labelError : undefined,\n )}\n >\n {label}\n {isRequired ? REQUIRED_MARK : null}\n </NativeText>\n <View style={own.items}>\n <CheckboxGroupContext value={context}>{children}</CheckboxGroupContext>\n </View>\n <View\n style={composeStyles<ViewStyle>(\n own.messageLine,\n holdsLine\n ? minHeightOf(theme.typography.bodySmallLineHeight * fontScale)\n : own.messageLineCollapsed,\n )}\n >\n <View\n aria-live=\"polite\"\n {...(Platform.OS === 'web' ? ATOMIC : undefined)}\n style={invalid && shown !== '' ? undefined : own.outOfFlow}\n >\n {invalid && shown !== '' ? (\n <NativeText id={messageId} style={messageStyle}>\n {shown}\n </NativeText>\n ) : null}\n </View>\n {invalid || description === undefined ? null : (\n <NativeText id={messageId} style={messageStyle}>\n {description}\n </NativeText>\n )}\n </View>\n </View>\n )\n}\n\n// What the group tells its checkboxes. A press selects or clears an entry\n// and then counts as the edit and the commit both, since a checkbox changes\n// the value at once rather than as a control loses focus, which is what a\n// native form shows an error after.\nfunction contextOf(\n state: CheckboxGroupState,\n members: CheckboxGroupContextValue['members'],\n {\n onBlur,\n onEdit,\n }: { readonly onBlur: () => void; readonly onEdit: () => void },\n isInvalid: boolean,\n): CheckboxGroupContextValue {\n return {\n isDisabled: state.isDisabled,\n isInvalid,\n isReadOnly: state.isReadOnly,\n isSelected: (entry) => state.isSelected(entry),\n members,\n set: (entry, isSelected) => {\n if (isSelected) {\n state.addValue(entry)\n } else {\n state.removeValue(entry)\n }\n onEdit()\n onBlur()\n },\n }\n}\n\n// A list the call site may hold as read-only, as the mutable copy React\n// Stately takes.\nfunction copyOf(entries: readonly string[] | undefined) {\n return entries === undefined ? undefined : [...entries]\n}\n\n/**\n * How the group is described by the line under it. On the web it points at\n * the line with `aria-describedby`, as web's group does. iOS and Android\n * focus the checkboxes rather than the group, so there the line is left\n * where a screen reader reaches it in order, after the last checkbox.\n */\nfunction lineOf(id: string, message: string | undefined) {\n return Platform.OS === 'web' && message !== undefined\n ? { 'aria-describedby': id }\n : undefined\n}\n\nfunction minHeightOf(minHeight: number): ViewStyle {\n return { minHeight }\n}\n\nexport { CheckboxGroup }\nexport type { CheckboxGroupProps }\n"],"mappings":";;;;;;;;;;;;;;AAsHA,MAAM8C,gBAAgB;AAItB,MAAMC,SAAS,EAAE,eAAe,KAAK;AAErC,MAAME,WAAWrB,cAAc,EAAEsB,QAAQC,SAASC,wBAChDvC,WAAWwC,OAAO;CAEhBC,OAAO,EACLC,eAAe,SACjB;CACAhB,OAAO,EACLiB,OAAON,OAAOO,iBAChB;CACAC,eAAe,EACbF,OAAO/B,YAAYyB,OAAOS,WAAWP,kBAAkBQ,eAAe,EACxE;CACAC,YAAY,EACVL,OAAON,OAAOf,MAChB;CACA2B,SAAS,EACPN,OAAON,OAAOO,iBAChB;CACAM,cAAc,EACZP,OAAON,OAAOf,MAChB;CACA6B,aAAa,EACXC,WAAWd,QAAQe,GACrB;CAGAC,sBAAsB;EACpBF,WAAW;EACXG,UAAU;CACZ;CAEAC,WAAW,EACTD,UAAU,WACZ;CACAE,MAAM;EACJf,eAAe;EACfgB,QAAQpB,QAAQe;CAClB;AACF,CAAC,CACH;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAAM,cAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAA3C;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAI;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAmC;CAAA,IAAAhC;CAAA,IAAAiC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAlC;CAAA,IAAAH;CAAA,IAAAgC,EAAA,O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AAAA,IACxC,EAAE,oBAAoBqD,GAAG,IACzBrD,KAAAA;AACN;AAEA,SAASmC,YAAYmB,WAA8B;CACjD,OAAO,EAAEA,UAAU;AACrB"}
1
+ {"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","StyleProp","TextStyle","ViewProps","ViewStyle","CheckboxGroupState","useId","useState","Text","NativeText","Platform","StyleSheet","useWindowDimensions","View","useCheckboxGroupState","CheckboxGroupContextValue","ValidationResult","messageOf","CheckboxGroupContext","createMembers","useErrorAnnouncement","useFieldValidation","useInsideForm","withOpacity","useTheme","composeStyles","themedStyles","useTypeRole","CheckboxGroupProps","Omit","children","defaultValue","description","error","isDisabled","isReadOnly","isRequired","label","name","onChange","value","ref","style","validate","REQUIRED_MARK","ATOMIC","const","stylesOf","colors","spacing","stateLayerOpacity","create","items","flexDirection","color","onSurfaceVariant","labelDisabled","onSurface","disabledContent","labelError","message","messageError","messageLine","marginTop","xs","messageLineCollapsed","position","outOfFlow","root","rowGap","CheckboxGroup","t0","$","_c","props","t1","t2","t3","undefined","theme","t4","copyOf","t5","t6","state","members","t7","length","t8","control","isEmpty","submitted","validation","labelId","messageId","labelRole","messageRole","insideForm","fontScale","own","shown","invalid","holdsLine","t9","contextOf","context","messageStyle","t10","lineOf","t11","t12","T0","t13","minHeightOf","typography","bodySmallLineHeight","t14","t15","t16","OS","t17","t18","onBlur","onEdit","isInvalid","isSelected","entry","set","addValue","removeValue","entries","id","minHeight","_c","NativeText"],"sources":["../../../src/components/checkbox-group/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type { StyleProp, TextStyle, ViewProps, ViewStyle } from 'react-native'\nimport type { CheckboxGroupState } from 'react-stately/useCheckboxGroupState'\n\nimport { useId, useState } from 'react'\nimport {\n Text as NativeText,\n Platform,\n StyleSheet,\n useWindowDimensions,\n View,\n} from 'react-native'\nimport { useCheckboxGroupState } from 'react-stately/useCheckboxGroupState'\n\nimport type { CheckboxGroupContextValue } from '../../control/group'\nimport type { ValidationResult } from '../../form'\n\nimport { messageOf } from '../../control'\nimport { CheckboxGroupContext, createMembers } from '../../control/group'\nimport { useErrorAnnouncement } from '../../field'\nimport { useFieldValidation, useInsideForm } from '../../form'\nimport { withOpacity } from '../../theme/color'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles, themedStyles } from '../../theme/styles'\nimport { useTypeRole } from '../../typography/roles'\n\n// kanso-ui's CheckboxGroup: a labelled set of checkboxes sharing one value.\n// The checkbox page draws the boxes; the group is what the pattern asks for\n// around them, a group named by its label, described by the line under it\n// and invalid as a whole, and its label and that line are the field chrome's,\n// so a group reads like the fields beside it.\n//\n// The group is a column: its label in label large, the checkboxes, and the\n// line under them, 4dp apart, with the line a further 4dp down, as web's\n// field chrome sets them out and RadioGroup does here. The label is on\n// surface variant, error while the group has one, and on surface at the\n// disabled opacity while disabled, with the required mark a field's label\n// carries. The line is not inset, since a group has no box to line it up\n// with.\n//\n// The value is React Stately's, as web's is React Aria's, and the group hands\n// it to its checkboxes through src/control/group, as RadioGroup hands its\n// buttons theirs. Its validation is src/form's, as a field's is: `isRequired`,\n// `validate`, and the form's errors under the group's `name`. A native Form\n// holding it back focuses its first checkbox. A Form submits the selection\n// under the group's `name` as a list, where a web form sends one entry per\n// ticked box under it.\n//\n// Inside a Form the line is held from the start, as web's is, so an error\n// arriving on submit moves nothing under the group. Outside one it takes\n// space only while there is something in it, and stays mounted for the live\n// region inside it, which has to be in place before the error it announces.\n\ntype CheckboxGroupProps = Omit<ViewProps, 'children' | 'style'> & {\n /** The checkboxes, each with a `value` of its own. */\n readonly children?: ReactNode\n /** The entries selected at first, when the group keeps its own value. */\n readonly defaultValue?: readonly string[]\n /**\n * A hint under the group. Replaced by `error` when there is one, so the\n * two never stack.\n */\n readonly description?: string\n /**\n * The problem with the current selection, in words. Its presence is what\n * puts the group in its error state: the message, the label's colour and\n * every box's error colours follow from it.\n *\n * Outside a `Form` the line under the group arrives with the message, so\n * the group grows when this does and moves what is under it. A `Form`\n * holds that space from the start; so does a permanent `description`.\n */\n readonly error?: string\n /**\n * Draws every checkbox disabled, and takes no presses.\n * @default false\n */\n readonly isDisabled?: boolean\n /**\n * Shows the selection without letting a press change it.\n * @default false\n */\n readonly isReadOnly?: boolean\n /**\n * Marks the group's label, and has a `native` form hold submission back\n * while nothing is selected.\n * @default false\n */\n readonly isRequired?: boolean\n /**\n * What the group is for. Required rather than optional: a group of\n * checkboxes with no name is a set of boxes a screen reader cannot\n * introduce.\n */\n readonly label: string\n /**\n * The name the form around the group knows it by: its `onSubmit` is handed\n * the ticked entries' values as a list under it, an empty one while none\n * is ticked, and its `validationErrors` are keyed on it.\n */\n readonly name?: string\n /** Called with the newly selected entries whenever a press changes them. */\n readonly onChange?: (value: string[]) => void\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n /**\n * Checks the selection, returning its problem in words, or `true`, `null`\n * or `undefined` when there is none. Shown as it changes, or under a\n * `native` form once a submission is tried.\n */\n readonly validate?: (value: readonly string[]) => ValidationResult\n /**\n * The selected entries, for a call site holding the value itself with\n * `onChange`.\n */\n readonly value?: readonly string[]\n}\n\n// What marks a required group's label, as a field's label marks one.\nconst REQUIRED_MARK = '*'\n\n// What has a live region on the web read its whole content again whenever\n// any of it changes, as the field's line does.\nconst ATOMIC = { 'aria-atomic': true } as const\n\nconst stylesOf = themedStyles(({ colors, spacing, stateLayerOpacity }) =>\n StyleSheet.create({\n // The group's checkboxes, one under another.\n items: {\n flexDirection: 'column',\n },\n label: {\n color: colors.onSurfaceVariant,\n },\n labelDisabled: {\n color: withOpacity(colors.onSurface, stateLayerOpacity.disabledContent),\n },\n labelError: {\n color: colors.error,\n },\n message: {\n color: colors.onSurfaceVariant,\n },\n messageError: {\n color: colors.error,\n },\n messageLine: {\n marginTop: spacing.xs,\n },\n // The line with nothing to show: out of the flow, so the group ends at\n // its last checkbox, and still there for the live region inside it.\n messageLineCollapsed: {\n marginTop: 0,\n position: 'absolute',\n },\n // The live region with nothing in it, which takes no place in the line.\n outOfFlow: {\n position: 'absolute',\n },\n root: {\n flexDirection: 'column',\n rowGap: spacing.xs,\n },\n }),\n)\n\n/**\n * A labelled set of checkboxes with one value between them. The value is\n * React Stately's, as web's is React Aria's: pass `value` with `onChange` to\n * control it, or `defaultValue` to let the group keep its own, and each\n * `Checkbox` inside names the entry it stands for with `value`. Disabled,\n * read-only and the error state reach every checkbox from here.\n *\n * ```tsx\n * <CheckboxGroup defaultValue={['first']} label=\"Label\">\n * <Checkbox value=\"first\">First item</Checkbox>\n * <Checkbox value=\"second\">Second item</Checkbox>\n * </CheckboxGroup>\n * ```\n *\n * A screen reader hears it as a group named by its label. On the web the\n * line under it describes the group, as web's does; on iOS and Android it is\n * read after the checkboxes, where it sits, and an error is announced as it\n * arrives. `style`, `ref` and `testID` land on the group as a whole, which is\n * the element a layout positions.\n */\nfunction CheckboxGroup({\n children,\n defaultValue,\n description,\n error,\n isDisabled = false,\n isReadOnly = false,\n isRequired = false,\n label,\n name,\n onChange,\n style,\n validate,\n value,\n ...props\n}: CheckboxGroupProps) {\n const theme = useTheme()\n const state = useCheckboxGroupState({\n defaultValue: copyOf(defaultValue),\n isDisabled,\n isReadOnly,\n onChange,\n value: copyOf(value),\n })\n const [members] = useState(createMembers)\n const validation = useFieldValidation({\n control: members,\n error,\n isDisabled,\n isEmpty: state.value.length === 0,\n isReadOnly,\n isRequired,\n name,\n submitted: state.value,\n validate,\n value: state.value,\n })\n const labelId = useId()\n const messageId = useId()\n const labelRole = useTypeRole('labelLarge')\n const messageRole = useTypeRole('bodySmall')\n const insideForm = useInsideForm()\n const { fontScale } = useWindowDimensions()\n\n const own = stylesOf(theme)\n const shown = validation.error\n const invalid = shown !== undefined\n const message = messageOf(description, shown)\n const holdsLine = insideForm || message !== undefined\n const context = contextOf(state, members, validation, invalid)\n const messageStyle = composeStyles<TextStyle>(\n messageRole,\n own.message,\n invalid ? own.messageError : undefined,\n )\n\n useErrorAnnouncement(shown)\n\n return (\n <View\n {...props}\n aria-labelledby={labelId}\n role=\"group\"\n {...lineOf(messageId, message)}\n style={composeStyles<ViewStyle>(own.root, style)}\n >\n <NativeText\n id={labelId}\n style={composeStyles<TextStyle>(\n labelRole,\n own.label,\n isDisabled ? own.labelDisabled : undefined,\n invalid ? own.labelError : undefined,\n )}\n >\n {label}\n {isRequired ? REQUIRED_MARK : null}\n </NativeText>\n <View style={own.items}>\n <CheckboxGroupContext value={context}>{children}</CheckboxGroupContext>\n </View>\n <View\n style={composeStyles<ViewStyle>(\n own.messageLine,\n holdsLine\n ? minHeightOf(theme.typography.bodySmallLineHeight * fontScale)\n : own.messageLineCollapsed,\n )}\n >\n <View\n aria-live=\"polite\"\n {...(Platform.OS === 'web' ? ATOMIC : undefined)}\n style={invalid && shown !== '' ? undefined : own.outOfFlow}\n >\n {invalid && shown !== '' ? (\n <NativeText id={messageId} style={messageStyle}>\n {shown}\n </NativeText>\n ) : null}\n </View>\n {invalid || description === undefined ? null : (\n <NativeText id={messageId} style={messageStyle}>\n {description}\n </NativeText>\n )}\n </View>\n </View>\n )\n}\n\n// What the group tells its checkboxes. A press selects or clears an entry\n// and then counts as the edit and the commit both, since a checkbox changes\n// the value at once rather than as a control loses focus, which is what a\n// native form shows an error after.\nfunction contextOf(\n state: CheckboxGroupState,\n members: CheckboxGroupContextValue['members'],\n {\n onBlur,\n onEdit,\n }: { readonly onBlur: () => void; readonly onEdit: () => void },\n isInvalid: boolean,\n): CheckboxGroupContextValue {\n return {\n isDisabled: state.isDisabled,\n isInvalid,\n isReadOnly: state.isReadOnly,\n isSelected: (entry) => state.isSelected(entry),\n members,\n set: (entry, isSelected) => {\n if (isSelected) {\n state.addValue(entry)\n } else {\n state.removeValue(entry)\n }\n onEdit()\n onBlur()\n },\n }\n}\n\n// A list the call site may hold as read-only, as the mutable copy React\n// Stately takes.\nfunction copyOf(entries: readonly string[] | undefined) {\n return entries === undefined ? undefined : [...entries]\n}\n\n/**\n * How the group is described by the line under it. On the web it points at\n * the line with `aria-describedby`, as web's group does. iOS and Android\n * focus the checkboxes rather than the group, so there the line is left\n * where a screen reader reaches it in order, after the last checkbox.\n */\nfunction lineOf(id: string, message: string | undefined) {\n return Platform.OS === 'web' && message !== undefined\n ? { 'aria-describedby': id }\n : undefined\n}\n\nfunction minHeightOf(minHeight: number): ViewStyle {\n return { minHeight }\n}\n\nexport { CheckboxGroup }\nexport type { CheckboxGroupProps }\n"],"mappings":";;;;;;;;;;;;;;AAuHA,MAAM8C,gBAAgB;AAItB,MAAMC,SAAS,EAAE,eAAe,KAAK;AAErC,MAAME,WAAWrB,cAAc,EAAEsB,QAAQC,SAASC,wBAChDvC,WAAWwC,OAAO;CAEhBC,OAAO,EACLC,eAAe,SACjB;CACAhB,OAAO,EACLiB,OAAON,OAAOO,iBAChB;CACAC,eAAe,EACbF,OAAO/B,YAAYyB,OAAOS,WAAWP,kBAAkBQ,eAAe,EACxE;CACAC,YAAY,EACVL,OAAON,OAAOf,MAChB;CACA2B,SAAS,EACPN,OAAON,OAAOO,iBAChB;CACAM,cAAc,EACZP,OAAON,OAAOf,MAChB;CACA6B,aAAa,EACXC,WAAWd,QAAQe,GACrB;CAGAC,sBAAsB;EACpBF,WAAW;EACXG,UAAU;CACZ;CAEAC,WAAW,EACTD,UAAU,WACZ;CACAE,MAAM;EACJf,eAAe;EACfgB,QAAQpB,QAAQe;CAClB;AACF,CAAC,CACH;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAAM,cAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAA3C;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAI;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAmC;CAAA,IAAAhC;CAAA,IAAAiC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAlC;CAAA,IAAAH;CAAA,IAAAgC,EAAA,OAAAD,IAAA;EAAuB,CAAA,CAAAzC,UAAAC,cAAAC,aAAAC,O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AAEA,SAASmC,YAAYmB,WAA8B;CACjD,OAAO,EAAEA,UAAU;AACrB"}
@@ -75,10 +75,13 @@ type ChipVariant = 'assist' | 'filter' | 'suggestion';
75
75
  * `variant="assist"` and `variant="suggestion"` draw the page's two action
76
76
  * chips instead: plain buttons, pressed with `onPress`, never selected.
77
77
  *
78
+ * A chip placed directly inside `Menu`, `Popover`, `Dialog` or `Sheet` is its
79
+ * trigger, as a `Button` is, and a press on it opens what it is placed in.
80
+ *
78
81
  * A column stretches a chip across it, as it does any view; a row of chips is
79
82
  * a row that wraps. `style`, `ref` and `testID` land on the `Pressable`.
80
83
  */
81
- declare function Chip({ children, defaultSelected, elevated, hitSlop, icon, isDisabled, isSelected, onBlur, onChange, onFocus, onHoverIn, onHoverOut, onLayout, onPress, onPressIn, onPressOut, style, variant, ...props }: ChipProps): import("react").JSX.Element;
84
+ declare function Chip({ accessibilityHint, children, defaultSelected, delayLongPress, elevated, hitSlop, icon, isDisabled, isSelected, onBlur, onChange, onFocus, onHoverIn, onHoverOut, onLayout, onLongPress, onPress, onPressIn, onPressOut, ref, style, variant, ...props }: ChipProps): import("react").JSX.Element;
82
85
  //#endregion
83
86
  export { Chip, type ChipActionProps, type ChipFilterProps, type ChipProps, type ChipVariant };
84
87
  //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { useTheme } from "../../theme/scope.js";
2
2
  import { composeStyles } from "../../theme/styles.js";
3
3
  import { usePressFeedback } from "../../press/index.js";
4
- import { AnimatedPressable, toggleState, useButtonAction } from "../../button/index.js";
4
+ import { AnimatedPressable, toggleState, useButtonAction, useSlotTrigger } from "../../button/index.js";
5
5
  import { shadowsOf, stylesOf } from "../../chip/styles.js";
6
6
  import { ChipGlyph, ChipLabel, measureThen, paintOf, targetOf, useEasedColors } from "../../chip/index.js";
7
7
  import { c } from "react/compiler-runtime";
@@ -20,13 +20,18 @@ import { jsx, jsxs } from "react/jsx-runtime";
20
20
  * `variant="assist"` and `variant="suggestion"` draw the page's two action
21
21
  * chips instead: plain buttons, pressed with `onPress`, never selected.
22
22
  *
23
+ * A chip placed directly inside `Menu`, `Popover`, `Dialog` or `Sheet` is its
24
+ * trigger, as a `Button` is, and a press on it opens what it is placed in.
25
+ *
23
26
  * A column stretches a chip across it, as it does any view; a row of chips is
24
27
  * a row that wraps. `style`, `ref` and `testID` land on the `Pressable`.
25
28
  */
26
29
  function Chip(t0) {
27
- const $ = c(80);
30
+ const $ = c(102);
31
+ let accessibilityHint;
28
32
  let children;
29
33
  let defaultSelected;
34
+ let delayLongPress;
30
35
  let hitSlop;
31
36
  let icon;
32
37
  let isSelected;
@@ -36,56 +41,66 @@ function Chip(t0) {
36
41
  let onHoverIn;
37
42
  let onHoverOut;
38
43
  let onLayout;
44
+ let onLongPress;
39
45
  let onPress;
40
46
  let onPressIn;
41
47
  let onPressOut;
42
48
  let props;
49
+ let ref;
43
50
  let style;
44
51
  let t1;
45
52
  let t2;
46
53
  let t3;
47
54
  if ($[0] !== t0) {
48
- ({children, defaultSelected, elevated: t1, hitSlop, icon, isDisabled: t2, isSelected, onBlur, onChange, onFocus, onHoverIn, onHoverOut, onLayout, onPress, onPressIn, onPressOut, style, variant: t3, ...props} = t0);
55
+ ({accessibilityHint, children, defaultSelected, delayLongPress, elevated: t1, hitSlop, icon, isDisabled: t2, isSelected, onBlur, onChange, onFocus, onHoverIn, onHoverOut, onLayout, onLongPress, onPress, onPressIn, onPressOut, ref, style, variant: t3, ...props} = t0);
49
56
  $[0] = t0;
50
- $[1] = children;
51
- $[2] = defaultSelected;
52
- $[3] = hitSlop;
53
- $[4] = icon;
54
- $[5] = isSelected;
55
- $[6] = onBlur;
56
- $[7] = onChange;
57
- $[8] = onFocus;
58
- $[9] = onHoverIn;
59
- $[10] = onHoverOut;
60
- $[11] = onLayout;
61
- $[12] = onPress;
62
- $[13] = onPressIn;
63
- $[14] = onPressOut;
64
- $[15] = props;
65
- $[16] = style;
66
- $[17] = t1;
67
- $[18] = t2;
68
- $[19] = t3;
57
+ $[1] = accessibilityHint;
58
+ $[2] = children;
59
+ $[3] = defaultSelected;
60
+ $[4] = delayLongPress;
61
+ $[5] = hitSlop;
62
+ $[6] = icon;
63
+ $[7] = isSelected;
64
+ $[8] = onBlur;
65
+ $[9] = onChange;
66
+ $[10] = onFocus;
67
+ $[11] = onHoverIn;
68
+ $[12] = onHoverOut;
69
+ $[13] = onLayout;
70
+ $[14] = onLongPress;
71
+ $[15] = onPress;
72
+ $[16] = onPressIn;
73
+ $[17] = onPressOut;
74
+ $[18] = props;
75
+ $[19] = ref;
76
+ $[20] = style;
77
+ $[21] = t1;
78
+ $[22] = t2;
79
+ $[23] = t3;
69
80
  } else {
70
- children = $[1];
71
- defaultSelected = $[2];
72
- hitSlop = $[3];
73
- icon = $[4];
74
- isSelected = $[5];
75
- onBlur = $[6];
76
- onChange = $[7];
77
- onFocus = $[8];
78
- onHoverIn = $[9];
79
- onHoverOut = $[10];
80
- onLayout = $[11];
81
- onPress = $[12];
82
- onPressIn = $[13];
83
- onPressOut = $[14];
84
- props = $[15];
85
- style = $[16];
86
- t1 = $[17];
87
- t2 = $[18];
88
- t3 = $[19];
81
+ accessibilityHint = $[1];
82
+ children = $[2];
83
+ defaultSelected = $[3];
84
+ delayLongPress = $[4];
85
+ hitSlop = $[5];
86
+ icon = $[6];
87
+ isSelected = $[7];
88
+ onBlur = $[8];
89
+ onChange = $[9];
90
+ onFocus = $[10];
91
+ onHoverIn = $[11];
92
+ onHoverOut = $[12];
93
+ onLayout = $[13];
94
+ onLongPress = $[14];
95
+ onPress = $[15];
96
+ onPressIn = $[16];
97
+ onPressOut = $[17];
98
+ props = $[18];
99
+ ref = $[19];
100
+ style = $[20];
101
+ t1 = $[21];
102
+ t2 = $[22];
103
+ t3 = $[23];
89
104
  }
90
105
  const elevated = t1 === void 0 ? false : t1;
91
106
  const isDisabled = t2 === void 0 ? false : t2;
@@ -94,7 +109,7 @@ function Chip(t0) {
94
109
  const [width, setWidth] = useState(48);
95
110
  const isToggle = variant === "filter";
96
111
  let t4;
97
- if ($[20] !== defaultSelected || $[21] !== isSelected || $[22] !== isToggle || $[23] !== onChange || $[24] !== onPress) {
112
+ if ($[24] !== defaultSelected || $[25] !== isSelected || $[26] !== isToggle || $[27] !== onChange || $[28] !== onPress) {
98
113
  t4 = {
99
114
  defaultSelected,
100
115
  href: void 0,
@@ -102,154 +117,207 @@ function Chip(t0) {
102
117
  isToggle,
103
118
  onChange,
104
119
  onPress,
120
+ slot: "default",
105
121
  type: void 0
106
122
  };
107
- $[20] = defaultSelected;
108
- $[21] = isSelected;
109
- $[22] = isToggle;
110
- $[23] = onChange;
111
- $[24] = onPress;
112
- $[25] = t4;
113
- } else t4 = $[25];
123
+ $[24] = defaultSelected;
124
+ $[25] = isSelected;
125
+ $[26] = isToggle;
126
+ $[27] = onChange;
127
+ $[28] = onPress;
128
+ $[29] = t4;
129
+ } else t4 = $[29];
114
130
  const action = useButtonAction(t4);
115
- const t5 = variant === "assist";
116
- let t6;
117
- if ($[26] !== action.selected || $[27] !== elevated || $[28] !== isDisabled || $[29] !== t5 || $[30] !== theme) {
118
- t6 = paintOf(theme, {
119
- assist: t5,
131
+ let t5;
132
+ if ($[30] !== accessibilityHint || $[31] !== delayLongPress || $[32] !== onHoverIn || $[33] !== onHoverOut || $[34] !== onLongPress || $[35] !== onPressIn || $[36] !== onPressOut || $[37] !== ref) {
133
+ t5 = {
134
+ accessibilityHint,
135
+ delayLongPress,
136
+ href: void 0,
137
+ onHoverIn,
138
+ onHoverOut,
139
+ onLongPress,
140
+ onPressIn,
141
+ onPressOut,
142
+ ref,
143
+ slot: void 0
144
+ };
145
+ $[30] = accessibilityHint;
146
+ $[31] = delayLongPress;
147
+ $[32] = onHoverIn;
148
+ $[33] = onHoverOut;
149
+ $[34] = onLongPress;
150
+ $[35] = onPressIn;
151
+ $[36] = onPressOut;
152
+ $[37] = ref;
153
+ $[38] = t5;
154
+ } else t5 = $[38];
155
+ const t6 = useSlotTrigger(t5);
156
+ let hoverIn;
157
+ let hoverOut;
158
+ let longPress;
159
+ let pressIn;
160
+ let pressOut;
161
+ let triggerProps;
162
+ if ($[39] !== t6) {
163
+ ({onHoverIn: hoverIn, onHoverOut: hoverOut, onLongPress: longPress, onPressIn: pressIn, onPressOut: pressOut, ...triggerProps} = t6);
164
+ $[39] = t6;
165
+ $[40] = hoverIn;
166
+ $[41] = hoverOut;
167
+ $[42] = longPress;
168
+ $[43] = pressIn;
169
+ $[44] = pressOut;
170
+ $[45] = triggerProps;
171
+ } else {
172
+ hoverIn = $[40];
173
+ hoverOut = $[41];
174
+ longPress = $[42];
175
+ pressIn = $[43];
176
+ pressOut = $[44];
177
+ triggerProps = $[45];
178
+ }
179
+ const t7 = variant === "assist";
180
+ let t8;
181
+ if ($[46] !== action.selected || $[47] !== elevated || $[48] !== isDisabled || $[49] !== t7 || $[50] !== theme) {
182
+ t8 = paintOf(theme, {
183
+ assist: t7,
120
184
  disabled: isDisabled,
121
185
  elevated,
122
186
  selected: action.selected
123
187
  });
124
- $[26] = action.selected;
125
- $[27] = elevated;
126
- $[28] = isDisabled;
127
- $[29] = t5;
128
- $[30] = theme;
129
- $[31] = t6;
130
- } else t6 = $[31];
131
- const paint = t6;
188
+ $[46] = action.selected;
189
+ $[47] = elevated;
190
+ $[48] = isDisabled;
191
+ $[49] = t7;
192
+ $[50] = theme;
193
+ $[51] = t8;
194
+ } else t8 = $[51];
195
+ const paint = t8;
132
196
  const eased = useEasedColors(paint);
133
- let t7;
134
- if ($[32] !== theme.radii.sm) {
135
- t7 = { borderRadius: theme.radii.sm };
136
- $[32] = theme.radii.sm;
137
- $[33] = t7;
138
- } else t7 = $[33];
139
- let t8;
140
- if ($[34] !== isDisabled || $[35] !== onBlur || $[36] !== onFocus || $[37] !== onHoverIn || $[38] !== onHoverOut || $[39] !== onPressIn || $[40] !== onPressOut || $[41] !== paint.layer || $[42] !== t7) {
141
- t8 = {
197
+ let t9;
198
+ if ($[52] !== theme.radii.sm) {
199
+ t9 = { borderRadius: theme.radii.sm };
200
+ $[52] = theme.radii.sm;
201
+ $[53] = t9;
202
+ } else t9 = $[53];
203
+ let t10;
204
+ if ($[54] !== hoverIn || $[55] !== hoverOut || $[56] !== isDisabled || $[57] !== onBlur || $[58] !== onFocus || $[59] !== paint.layer || $[60] !== pressIn || $[61] !== pressOut || $[62] !== t9) {
205
+ t10 = {
142
206
  color: paint.layer,
143
- corners: t7,
207
+ corners: t9,
144
208
  disabled: isDisabled,
145
209
  onBlur,
146
210
  onFocus,
147
- onHoverIn,
148
- onHoverOut,
149
- onPressIn,
150
- onPressOut
211
+ onHoverIn: hoverIn,
212
+ onHoverOut: hoverOut,
213
+ onPressIn: pressIn,
214
+ onPressOut: pressOut
151
215
  };
152
- $[34] = isDisabled;
153
- $[35] = onBlur;
154
- $[36] = onFocus;
155
- $[37] = onHoverIn;
156
- $[38] = onHoverOut;
157
- $[39] = onPressIn;
158
- $[40] = onPressOut;
159
- $[41] = paint.layer;
160
- $[42] = t7;
161
- $[43] = t8;
162
- } else t8 = $[43];
163
- const feedback = usePressFeedback(t8);
164
- let t9;
165
- if ($[44] !== action.selected || $[45] !== isToggle) {
166
- t9 = isToggle ? toggleState(action.selected) : void 0;
167
- $[44] = action.selected;
168
- $[45] = isToggle;
169
- $[46] = t9;
170
- } else t9 = $[46];
171
- const t10 = feedback.handlers;
216
+ $[54] = hoverIn;
217
+ $[55] = hoverOut;
218
+ $[56] = isDisabled;
219
+ $[57] = onBlur;
220
+ $[58] = onFocus;
221
+ $[59] = paint.layer;
222
+ $[60] = pressIn;
223
+ $[61] = pressOut;
224
+ $[62] = t9;
225
+ $[63] = t10;
226
+ } else t10 = $[63];
227
+ const feedback = usePressFeedback(t10);
172
228
  let t11;
173
- if ($[47] !== hitSlop || $[48] !== theme || $[49] !== width) {
174
- t11 = hitSlop ?? targetOf(width, theme);
175
- $[47] = hitSlop;
176
- $[48] = theme;
177
- $[49] = width;
178
- $[50] = t11;
179
- } else t11 = $[50];
180
- let t12;
181
- if ($[51] !== onLayout) {
182
- t12 = measureThen(setWidth, onLayout);
183
- $[51] = onLayout;
184
- $[52] = t12;
185
- } else t12 = $[52];
186
- const t13 = action.onPress;
229
+ if ($[64] !== action.selected || $[65] !== isToggle) {
230
+ t11 = isToggle ? toggleState(action.selected) : void 0;
231
+ $[64] = action.selected;
232
+ $[65] = isToggle;
233
+ $[66] = t11;
234
+ } else t11 = $[66];
235
+ const t12 = feedback.handlers;
236
+ let t13;
237
+ if ($[67] !== hitSlop || $[68] !== theme || $[69] !== width) {
238
+ t13 = hitSlop ?? targetOf(width, theme);
239
+ $[67] = hitSlop;
240
+ $[68] = theme;
241
+ $[69] = width;
242
+ $[70] = t13;
243
+ } else t13 = $[70];
187
244
  let t14;
188
- if ($[53] !== eased.container || $[54] !== elevated || $[55] !== feedback.hovered || $[56] !== feedback.ring || $[57] !== isDisabled || $[58] !== style || $[59] !== theme) {
189
- t14 = composeStyles(stylesOf(theme).pill, eased.container, elevated && !isDisabled ? shadowsOf(theme)[feedback.hovered ? "elevation2" : "elevation1"] : void 0, feedback.ring, style);
190
- $[53] = eased.container;
191
- $[54] = elevated;
192
- $[55] = feedback.hovered;
193
- $[56] = feedback.ring;
194
- $[57] = isDisabled;
195
- $[58] = style;
196
- $[59] = theme;
197
- $[60] = t14;
198
- } else t14 = $[60];
199
- let t15;
200
- if ($[61] !== action.selected || $[62] !== icon || $[63] !== paint.glyph) {
201
- t15 = /* @__PURE__ */ jsx(ChipGlyph, {
245
+ if ($[71] !== onLayout) {
246
+ t14 = measureThen(setWidth, onLayout);
247
+ $[71] = onLayout;
248
+ $[72] = t14;
249
+ } else t14 = $[72];
250
+ const t15 = action.onPress;
251
+ let t16;
252
+ if ($[73] !== eased.container || $[74] !== elevated || $[75] !== feedback.hovered || $[76] !== feedback.ring || $[77] !== isDisabled || $[78] !== style || $[79] !== theme) {
253
+ t16 = composeStyles(stylesOf(theme).pill, eased.container, elevated && !isDisabled ? shadowsOf(theme)[feedback.hovered ? "elevation2" : "elevation1"] : void 0, feedback.ring, style);
254
+ $[73] = eased.container;
255
+ $[74] = elevated;
256
+ $[75] = feedback.hovered;
257
+ $[76] = feedback.ring;
258
+ $[77] = isDisabled;
259
+ $[78] = style;
260
+ $[79] = theme;
261
+ $[80] = t16;
262
+ } else t16 = $[80];
263
+ let t17;
264
+ if ($[81] !== action.selected || $[82] !== icon || $[83] !== paint.glyph) {
265
+ t17 = /* @__PURE__ */ jsx(ChipGlyph, {
202
266
  color: paint.glyph,
203
267
  icon,
204
268
  selected: action.selected
205
269
  });
206
- $[61] = action.selected;
207
- $[62] = icon;
208
- $[63] = paint.glyph;
209
- $[64] = t15;
210
- } else t15 = $[64];
211
- let t16;
212
- if ($[65] !== children || $[66] !== eased.label) {
213
- t16 = /* @__PURE__ */ jsx(ChipLabel, {
270
+ $[81] = action.selected;
271
+ $[82] = icon;
272
+ $[83] = paint.glyph;
273
+ $[84] = t17;
274
+ } else t17 = $[84];
275
+ let t18;
276
+ if ($[85] !== children || $[86] !== eased.label) {
277
+ t18 = /* @__PURE__ */ jsx(ChipLabel, {
214
278
  color: eased.label,
215
279
  children
216
280
  });
217
- $[65] = children;
218
- $[66] = eased.label;
219
- $[67] = t16;
220
- } else t16 = $[67];
221
- let t17;
222
- if ($[68] !== action.onPress || $[69] !== feedback.handlers || $[70] !== feedback.layer || $[71] !== isDisabled || $[72] !== props || $[73] !== t11 || $[74] !== t12 || $[75] !== t14 || $[76] !== t15 || $[77] !== t16 || $[78] !== t9) {
223
- t17 = /* @__PURE__ */ jsxs(AnimatedPressable, {
281
+ $[85] = children;
282
+ $[86] = eased.label;
283
+ $[87] = t18;
284
+ } else t18 = $[87];
285
+ let t19;
286
+ if ($[88] !== action.onPress || $[89] !== feedback.handlers || $[90] !== feedback.layer || $[91] !== isDisabled || $[92] !== longPress || $[93] !== props || $[94] !== t11 || $[95] !== t13 || $[96] !== t14 || $[97] !== t16 || $[98] !== t17 || $[99] !== t18 || $[100] !== triggerProps) {
287
+ t19 = /* @__PURE__ */ jsxs(AnimatedPressable, {
224
288
  role: "button",
225
- ...t9,
289
+ ...t11,
226
290
  ...props,
227
- ...t10,
291
+ ...triggerProps,
292
+ ...t12,
228
293
  disabled: isDisabled,
229
- hitSlop: t11,
230
- onLayout: t12,
231
- onPress: t13,
232
- style: t14,
294
+ hitSlop: t13,
295
+ onLayout: t14,
296
+ onLongPress: longPress,
297
+ onPress: t15,
298
+ style: t16,
233
299
  children: [
234
300
  feedback.layer,
235
- t15,
236
- t16
301
+ t17,
302
+ t18
237
303
  ]
238
304
  });
239
- $[68] = action.onPress;
240
- $[69] = feedback.handlers;
241
- $[70] = feedback.layer;
242
- $[71] = isDisabled;
243
- $[72] = props;
244
- $[73] = t11;
245
- $[74] = t12;
246
- $[75] = t14;
247
- $[76] = t15;
248
- $[77] = t16;
249
- $[78] = t9;
250
- $[79] = t17;
251
- } else t17 = $[79];
252
- return t17;
305
+ $[88] = action.onPress;
306
+ $[89] = feedback.handlers;
307
+ $[90] = feedback.layer;
308
+ $[91] = isDisabled;
309
+ $[92] = longPress;
310
+ $[93] = props;
311
+ $[94] = t11;
312
+ $[95] = t13;
313
+ $[96] = t14;
314
+ $[97] = t16;
315
+ $[98] = t17;
316
+ $[99] = t18;
317
+ $[100] = triggerProps;
318
+ $[101] = t19;
319
+ } else t19 = $[101];
320
+ return t19;
253
321
  }
254
322
  //#endregion
255
323
  export { Chip };