@kanso-labs/react-native-kanso-ui 0.7.0 → 0.9.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 (150) hide show
  1. package/README.md +37 -0
  2. package/dist/badge/index.js +9 -68
  3. package/dist/badge/index.js.map +1 -1
  4. package/dist/button/index.d.ts +2 -1
  5. package/dist/button/index.js +1 -1
  6. package/dist/button/index.js.map +1 -1
  7. package/dist/button/palettes.d.ts +2 -0
  8. package/dist/button/pending.js +17 -21
  9. package/dist/button/pending.js.map +1 -1
  10. package/dist/calendar/index.js +1 -1
  11. package/dist/components/autocomplete/index.js +28 -26
  12. package/dist/components/autocomplete/index.js.map +1 -1
  13. package/dist/components/avatar/index.d.ts +2 -2
  14. package/dist/components/avatar/index.js +2 -2
  15. package/dist/components/avatar/index.js.map +1 -1
  16. package/dist/components/badge/index.d.ts +48 -0
  17. package/dist/components/badge/index.js +122 -0
  18. package/dist/components/badge/index.js.map +1 -0
  19. package/dist/{badge → components/badge}/styles.js +10 -6
  20. package/dist/components/badge/styles.js.map +1 -0
  21. package/dist/components/breadcrumbs/index.d.ts +66 -0
  22. package/dist/components/breadcrumbs/index.js +285 -0
  23. package/dist/components/breadcrumbs/index.js.map +1 -0
  24. package/dist/components/calendar/index.d.ts +1 -1
  25. package/dist/components/calendar/index.js +77 -38
  26. package/dist/components/calendar/index.js.map +1 -1
  27. package/dist/components/checkbox/index.d.ts +7 -1
  28. package/dist/components/checkbox/index.js +183 -138
  29. package/dist/components/checkbox/index.js.map +1 -1
  30. package/dist/components/checkbox-group/index.d.ts +93 -0
  31. package/dist/components/checkbox-group/index.js +306 -0
  32. package/dist/components/checkbox-group/index.js.map +1 -0
  33. package/dist/components/chip-group/index.d.ts +4 -3
  34. package/dist/components/chip-group/index.js +47 -45
  35. package/dist/components/chip-group/index.js.map +1 -1
  36. package/dist/components/code/index.d.ts +25 -0
  37. package/dist/components/code/index.js +87 -0
  38. package/dist/components/code/index.js.map +1 -0
  39. package/dist/components/container/index.d.ts +47 -0
  40. package/dist/components/container/index.js +85 -0
  41. package/dist/components/container/index.js.map +1 -0
  42. package/dist/components/copy-field/index.d.ts +5 -5
  43. package/dist/components/copy-field/index.js +30 -28
  44. package/dist/components/copy-field/index.js.map +1 -1
  45. package/dist/components/currency/index.d.ts +2 -2
  46. package/dist/components/currency/index.js +3 -1
  47. package/dist/components/currency/index.js.map +1 -1
  48. package/dist/components/fab/index.d.ts +80 -0
  49. package/dist/components/fab/index.js +231 -0
  50. package/dist/components/fab/index.js.map +1 -0
  51. package/dist/components/fab-menu/index.d.ts +120 -0
  52. package/dist/components/fab-menu/index.js +640 -0
  53. package/dist/components/fab-menu/index.js.map +1 -0
  54. package/dist/components/feed/index.d.ts +57 -0
  55. package/dist/components/feed/index.js +167 -0
  56. package/dist/components/feed/index.js.map +1 -0
  57. package/dist/components/keycap/index.d.ts +27 -0
  58. package/dist/components/keycap/index.js +136 -0
  59. package/dist/components/keycap/index.js.map +1 -0
  60. package/dist/components/list/index.d.ts +6 -5
  61. package/dist/components/list/index.js +97 -106
  62. package/dist/components/list/index.js.map +1 -1
  63. package/dist/components/menu/index.d.ts +4 -3
  64. package/dist/components/menu/index.js +33 -40
  65. package/dist/components/menu/index.js.map +1 -1
  66. package/dist/components/meter/index.d.ts +2 -1
  67. package/dist/components/meter/index.js +9 -7
  68. package/dist/components/meter/index.js.map +1 -1
  69. package/dist/components/number-field/index.d.ts +7 -3
  70. package/dist/components/number-field/index.js +214 -192
  71. package/dist/components/number-field/index.js.map +1 -1
  72. package/dist/components/product-icon/index.d.ts +2 -2
  73. package/dist/components/product-icon/index.js +2 -2
  74. package/dist/components/product-icon/index.js.map +1 -1
  75. package/dist/components/progress-indicator/index.d.ts +2 -1
  76. package/dist/components/progress-indicator/index.js +15 -13
  77. package/dist/components/progress-indicator/index.js.map +1 -1
  78. package/dist/components/search-field/index.d.ts +3 -3
  79. package/dist/components/search-field/index.js +105 -104
  80. package/dist/components/search-field/index.js.map +1 -1
  81. package/dist/components/separator/index.d.ts +3 -2
  82. package/dist/components/separator/index.js +29 -26
  83. package/dist/components/separator/index.js.map +1 -1
  84. package/dist/components/sheet/index.d.ts +2 -2
  85. package/dist/components/sheet/index.js +22 -26
  86. package/dist/components/sheet/index.js.map +1 -1
  87. package/dist/components/snackbar/index.d.ts +3 -3
  88. package/dist/components/snackbar/index.js +36 -34
  89. package/dist/components/snackbar/index.js.map +1 -1
  90. package/dist/components/supporting-pane/index.d.ts +44 -0
  91. package/dist/components/supporting-pane/index.js +109 -0
  92. package/dist/components/supporting-pane/index.js.map +1 -0
  93. package/dist/components/tag/index.d.ts +58 -0
  94. package/dist/components/tag/index.js +205 -0
  95. package/dist/components/tag/index.js.map +1 -0
  96. package/dist/components/text/index.d.ts +1 -1
  97. package/dist/components/text/index.js +49 -21
  98. package/dist/components/text/index.js.map +1 -1
  99. package/dist/components/text-area/index.d.ts +145 -0
  100. package/dist/components/text-area/index.js +231 -0
  101. package/dist/components/text-area/index.js.map +1 -0
  102. package/dist/components/text-field/index.d.ts +6 -3
  103. package/dist/components/text-field/index.js +3 -0
  104. package/dist/components/text-field/index.js.map +1 -1
  105. package/dist/components/toolbar/index.d.ts +53 -0
  106. package/dist/components/toolbar/index.js +185 -0
  107. package/dist/components/toolbar/index.js.map +1 -0
  108. package/dist/control/group.js +23 -0
  109. package/dist/control/group.js.map +1 -0
  110. package/dist/fab/index.d.ts +19 -0
  111. package/dist/fab/index.js +147 -0
  112. package/dist/fab/index.js.map +1 -0
  113. package/dist/field/index.js +123 -79
  114. package/dist/field/index.js.map +1 -1
  115. package/dist/field/styles.js +18 -0
  116. package/dist/field/styles.js.map +1 -1
  117. package/dist/form/index.d.ts +1 -2
  118. package/dist/form/index.js +1 -1
  119. package/dist/form/index.js.map +1 -1
  120. package/dist/i18n/index.js +12 -1
  121. package/dist/i18n/index.js.map +1 -1
  122. package/dist/i18n/messages.js +367 -0
  123. package/dist/i18n/messages.js.map +1 -1
  124. package/dist/i18n/provider.d.ts +53 -0
  125. package/dist/i18n/provider.js +96 -0
  126. package/dist/i18n/provider.js.map +1 -0
  127. package/dist/index.d.ts +19 -4
  128. package/dist/index.js +17 -3
  129. package/dist/indicator/index.js +1 -2
  130. package/dist/indicator/index.js.map +1 -1
  131. package/dist/mark/index.js +77 -117
  132. package/dist/mark/index.js.map +1 -1
  133. package/dist/mark/initials.js.map +1 -1
  134. package/dist/modal/index.js +59 -46
  135. package/dist/modal/index.js.map +1 -1
  136. package/dist/navigation/index.js +8 -5
  137. package/dist/navigation/index.js.map +1 -1
  138. package/dist/number/count.js +15 -0
  139. package/dist/number/count.js.map +1 -0
  140. package/dist/number/locale.js.map +1 -1
  141. package/dist/overlay/host.js +30 -21
  142. package/dist/overlay/host.js.map +1 -1
  143. package/dist/overlay/placement.js +3 -1
  144. package/dist/overlay/placement.js.map +1 -1
  145. package/dist/separator/index.js +7 -0
  146. package/dist/separator/index.js.map +1 -0
  147. package/dist/typography/size.js +14 -0
  148. package/dist/typography/size.js.map +1 -0
  149. package/package.json +1 -1
  150. package/dist/badge/styles.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","StyleProp","ViewProps","ViewStyle","ToggleState","useId","Pressable","View","useToggleState","CheckboxTone","ResolvedTheme","ControlLabel","ControlMessage","describedBy","LAYER_SIZE","messageOf","CheckboxBox","controlStylesOf","hitSlop","usePressFeedback","useTheme","composeStyles","CheckboxProps","Omit","children","defaultSelected","description","error","isDisabled","isIndeterminate","isReadOnly","isSelected","onChange","ref","style","LAYERS","Readonly","Record","hover","pressed","marked","unmarked","Checkbox","t0","$","_c","ariaLabel","props","t1","t2","t3","undefined","theme","t4","state","messageId","colors","radii","interactive","tone","t5","t6","circle","borderRadius","t7","t8","t9","color","corners","disabled","disc","pressedColor","feedback","active","hovered","ring","t10","t11","t12","handlers","t13","Symbol","for","t14","toggleOf","t15","t16","row","t17","t18","t19","layer","t20","t21","t22","t23","toggle","_c"],"sources":["../../../src/components/checkbox/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type { StyleProp, ViewProps, ViewStyle } from 'react-native'\nimport type { ToggleState } from 'react-stately/useToggleState'\n\nimport { useId } from 'react'\nimport { Pressable, View } from 'react-native'\nimport { useToggleState } from 'react-stately/useToggleState'\n\nimport type { CheckboxTone } from '../../control/checkbox-box'\nimport type { ResolvedTheme } from '../../theme/scope'\n\nimport {\n ControlLabel,\n ControlMessage,\n describedBy,\n LAYER_SIZE,\n messageOf,\n} from '../../control'\nimport { CheckboxBox } from '../../control/checkbox-box'\nimport { controlStylesOf } from '../../control/styles'\nimport { hitSlop, usePressFeedback } from '../../press'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles } from '../../theme/styles'\n\n// The checkbox page, as kanso-ui's Checkbox draws it: an 18dp box with a 2dp\n// corner and an 18dp glyph, inside a 40dp state layer, with a 48dp target.\n// Unselected, the box is a 2dp rule in on surface variant that turns on\n// surface while hovered, pressed or focused; selected or indeterminate, it\n// fills with primary and the glyph takes on primary. The error pair is error\n// and on error, and disabled is on surface at the disabled opacity for the\n// rule or the fill, with the glyph in surface. The state layer is on surface\n// over an unselected box and primary over a selected one while hovered, and\n// the two swap once pressed.\n//\n// The box eases between its colours over the motion tokens' short duration\n// on the standard curve, as web's transition does, and at once for a reader\n// who asks the device for reduced motion. The glyph arrives with the fill.\n//\n// The row, the label and the line under it are src/control's, which Radio\n// and Switch draw through as well. The whole row is the `Pressable`, so a\n// press on the label toggles the box, as a press on web's label does. The\n// line under it is outside the row, as web's is outside its label.\n//\n// The corner is a literal: the page's 2dp is a step the shape scale does not\n// carry.\n\ntype CheckboxProps = Omit<ViewProps, 'children' | 'style'> & {\n /**\n * The label, beside the box. A checkbox that a row labels some other way\n * leaves it out and passes `aria-label` instead.\n */\n readonly children?: ReactNode\n /**\n * Whether the checkbox starts selected, when it keeps its own state.\n * @default false\n */\n readonly defaultSelected?: boolean\n /**\n * A hint under the label. 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 value, in words. Its presence is what puts\n * the checkbox in its error state: the message and the error colours both\n * follow from it.\n */\n readonly error?: string\n /**\n * Draws the checkbox disabled, and takes no presses.\n * @default false\n */\n readonly isDisabled?: boolean\n /**\n * Draws the dash for a box that stands for a partly selected set, and\n * reports the box as mixed to a screen reader. It is the call site's to\n * clear: a press still changes `isSelected` underneath.\n * @default false\n */\n readonly isIndeterminate?: boolean\n /**\n * Shows the state without letting a press change it.\n * @default false\n */\n readonly isReadOnly?: boolean\n /**\n * Whether the checkbox is selected, for a call site holding the state\n * itself with `onChange`.\n */\n readonly isSelected?: boolean\n /** Called with the new state whenever a press changes it. */\n readonly onChange?: (isSelected: boolean) => void\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n}\n\n// The state layer's colour roles, hovered or focused and pressed. Error is\n// error throughout; otherwise the two swap once pressed.\nconst LAYERS: Readonly<\n Record<\n CheckboxTone,\n {\n readonly hover: keyof ResolvedTheme['colors']\n readonly pressed: keyof ResolvedTheme['colors']\n }\n >\n> = {\n error: { hover: 'error', pressed: 'error' },\n marked: { hover: 'primary', pressed: 'onSurface' },\n unmarked: { hover: 'onSurface', pressed: 'primary' },\n}\n\n/**\n * A checkbox with its label, and optionally a description or an error under\n * it. Its state is React Stately's, as web's is: pass `isSelected` with\n * `onChange` to control it, or `defaultSelected` to let it keep its own.\n * `isIndeterminate` draws the dash for a box that stands for a partly\n * selected set.\n *\n * ```tsx\n * <Checkbox defaultSelected description=\"Supporting line\">\n * Label\n * </Checkbox>\n * ```\n *\n * A screen reader hears it as a checkbox named by its label, checked,\n * unchecked or mixed, followed by the line under it. A press anywhere on the\n * box or the label toggles it, and the row takes presses over the 48dp target\n * the page asks of the box. `style`, `ref` and `testID` land on the view\n * holding the row and the line under it, which is the element a layout\n * positions.\n */\nfunction Checkbox({\n 'aria-label': ariaLabel,\n children,\n defaultSelected,\n description,\n error,\n isDisabled = false,\n isIndeterminate = false,\n isReadOnly = false,\n isSelected,\n onChange,\n style,\n ...props\n}: CheckboxProps) {\n const theme = useTheme()\n const state = useToggleState({\n defaultSelected,\n isReadOnly,\n isSelected,\n onChange,\n })\n const messageId = useId()\n\n const { colors, radii } = theme\n const marked = state.isSelected || isIndeterminate\n const interactive = !isDisabled && !isReadOnly\n const tone: CheckboxTone =\n error === undefined ? (marked ? 'marked' : 'unmarked') : 'error'\n\n const feedback = usePressFeedback({\n color: colors[LAYERS[tone].hover],\n corners: { borderRadius: radii.circle },\n disabled: !interactive,\n disc: LAYER_SIZE,\n pressedColor: colors[LAYERS[tone].pressed],\n })\n const active =\n feedback.hovered || feedback.pressed || feedback.ring !== undefined\n\n return (\n <View {...props} style={style}>\n <Pressable\n aria-checked={isIndeterminate ? 'mixed' : state.isSelected}\n aria-label={ariaLabel}\n role=\"checkbox\"\n {...describedBy(messageId, messageOf(description, error))}\n {...feedback.handlers}\n disabled={isDisabled}\n hitSlop={hitSlop(LAYER_SIZE, LAYER_SIZE)}\n onPress={toggleOf(state)}\n style={controlStylesOf(theme).row}\n >\n <View\n style={composeStyles<ViewStyle>(\n controlStylesOf(theme).disc,\n feedback.ring,\n )}\n >\n {feedback.layer}\n <CheckboxBox\n active={active}\n isDisabled={isDisabled}\n isIndeterminate={isIndeterminate}\n isSelected={state.isSelected}\n tone={tone}\n within={LAYER_SIZE}\n />\n </View>\n <ControlLabel isDisabled={isDisabled}>{children}</ControlLabel>\n </Pressable>\n <ControlMessage description={description} error={error} id={messageId} />\n </View>\n )\n}\n\n// A press's toggle. Built by a call rather than declared in the component,\n// which is what react-perf's jsx-no-new-function-as-prop is after; the React\n// Compiler memoises the result on its input.\nfunction toggleOf(state: ToggleState) {\n return () => {\n state.toggle()\n }\n}\n\nexport { Checkbox }\nexport type { CheckboxProps }\n"],"mappings":";;;;;;;;;;;;AAkGA,MAAMqC,SAQF;CACFR,OAAO;EAAEW,OAAO;EA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P,MAAA;GAAU,GACX+B;GAAqD,GACrDC;GACMlD,UAAAA;GACD,SAAAoD;GACA,SAAAG;GACF,OAAAG;GATT,UAAA,CAWEI,KAgBAE,GA3BQ;;EA4BEhD,EAAA,MAAAE;EAAAF,EAAA,MAAA4B,SAAAO;EAAAnC,EAAA,MAAAhB;EAAAgB,EAAA,MAAAgC;EAAAhC,EAAA,MAAAiC;EAAAjC,EAAA,MAAAuC;EAAAvC,EAAA,MAAAyC,IAAAE;EAAA3C,EAAA,MAAA8C;EAAA9C,EAAA,MAAAgD;EAAAhD,EAAA,MAAAiD;CAAA,OAAAA,MAAAjD,EAAA;CAAA,IAAAkD;CAAA,IAAAlD,EAAA,QAAAlB,eAAAkB,EAAA,QAAAjB,SAAAiB,EAAA,QAAAW,WAAA;EACZuC,MAAA,oBAAC,gBAAD;GAA6BpE;GAAoBC;GAAW4B,IAAAA;EAAS,CAAA;EAAIX,EAAA,MAAAlB;EAAAkB,EAAA,MAAAjB;EAAAiB,EAAA,MAAAW;EAAAX,EAAA,MAAAkD;CAAA,OAAAA,MAAAlD,EAAA;CAAA,IAAAmD;CAAA,IAAAnD,EAAA,QAAAG,SAAAH,EAAA,QAAAV,SAAAU,EAAA,QAAAiD,OAAAjD,EAAA,QAAAkD,KAAA;EA9B3EC,MAAA,qBAAC,MAAD;GAAK,GAAKhD;GAAcb;GAAxB,UAAA,CACE2D,KA6BAC,GA9BG;;EA+BElD,EAAA,MAAAG;EAAAH,EAAA,MAAAV;EAAAU,EAAA,MAAAiD;EAAAjD,EAAA,MAAAkD;EAAAlD,EAAA,MAAAmD;CAAA,OAAAA,MAAAnD,EAAA;CAAA,OA/BPmD;AA+BO;AAOX,SAASX,SAAS9B,OAAoB;CACpC,aAAa;EACXA,MAAM0C,OAAO;CACf;AACF"}
1
+ {"version":3,"file":"index.js","names":["ComponentRef","ReactNode","Ref","StyleProp","ViewProps","ViewStyle","ToggleState","ToggleStateOptions","use","useEffect","useId","useRef","Pressable","View","useToggleState","CheckboxTone","CheckboxGroupContextValue","ResolvedTheme","ControlLabel","ControlMessage","describedBy","LAYER_SIZE","messageOf","CheckboxBox","CheckboxGroupContext","controlStylesOf","hitSlop","usePressFeedback","useTheme","composeStyles","CheckboxProps","Omit","children","defaultSelected","description","error","isDisabled","isIndeterminate","isReadOnly","isSelected","onChange","ref","style","value","LAYERS","Readonly","Record","hover","pressed","marked","unmarked","Checkbox","t0","$","_c","ariaLabel","props","t1","t2","t3","ownDisabled","undefined","ownReadOnly","theme","group","messageId","control","members","Error","t4","memberOf","state","t5","t6","add","remove","colors","radii","interactive","invalid","isInvalid","tone","t7","t8","circle","borderRadius","t9","t10","t11","color","corners","disabled","disc","pressedColor","feedback","active","hovered","ring","t12","t13","t14","handlers","t15","Symbol","for","t16","toggleOf","t17","t18","row","t19","t20","t21","layer","t22","t23","t24","t25","Pick","set","toggle","_c"],"sources":["../../../src/components/checkbox/index.tsx"],"sourcesContent":["import type { ComponentRef, ReactNode, Ref } from 'react'\nimport type { StyleProp, ViewProps, ViewStyle } from 'react-native'\nimport type {\n ToggleState,\n ToggleStateOptions,\n} from 'react-stately/useToggleState'\n\nimport { use, useEffect, useId, useRef } from 'react'\nimport { Pressable, View } from 'react-native'\nimport { useToggleState } from 'react-stately/useToggleState'\n\nimport type { CheckboxTone } from '../../control/checkbox-box'\nimport type { CheckboxGroupContextValue } from '../../control/group'\nimport type { ResolvedTheme } from '../../theme/scope'\n\nimport {\n ControlLabel,\n ControlMessage,\n describedBy,\n LAYER_SIZE,\n messageOf,\n} from '../../control'\nimport { CheckboxBox } from '../../control/checkbox-box'\nimport { CheckboxGroupContext } from '../../control/group'\nimport { controlStylesOf } from '../../control/styles'\nimport { hitSlop, usePressFeedback } from '../../press'\nimport { useTheme } from '../../theme/scope'\nimport { composeStyles } from '../../theme/styles'\n\n// The checkbox page, as kanso-ui's Checkbox draws it: an 18dp box with a 2dp\n// corner and an 18dp glyph, inside a 40dp state layer, with a 48dp target.\n// Unselected, the box is a 2dp rule in on surface variant that turns on\n// surface while hovered, pressed or focused; selected or indeterminate, it\n// fills with primary and the glyph takes on primary. The error pair is error\n// and on error, and disabled is on surface at the disabled opacity for the\n// rule or the fill, with the glyph in surface. The state layer is on surface\n// over an unselected box and primary over a selected one while hovered, and\n// the two swap once pressed.\n//\n// The box eases between its colours over the motion tokens' short duration\n// on the standard curve, as web's transition does, and at once for a reader\n// who asks the device for reduced motion. The glyph arrives with the fill.\n//\n// The row, the label and the line under it are src/control's, which Radio\n// and Switch draw through as well. The whole row is the `Pressable`, so a\n// press on the label toggles the box, as a press on web's label does. The\n// line under it is outside the row, as web's is outside its label.\n//\n// Inside a CheckboxGroup the selection is the group's, as web's Checkbox\n// reads React Aria's group state: the box stands for the entry its `value`\n// names, a press selects or clears that entry, and the group's disabled,\n// read-only and error states reach the box as its own would.\n//\n// The corner is a literal: the page's 2dp is a step the shape scale does not\n// carry.\n\ntype CheckboxProps = Omit<ViewProps, 'children' | 'style'> & {\n /**\n * The label, beside the box. A checkbox that a row labels some other way\n * leaves it out and passes `aria-label` instead.\n */\n readonly children?: ReactNode\n /**\n * Whether the checkbox starts selected, when it keeps its own state.\n * @default false\n */\n readonly defaultSelected?: boolean\n /**\n * A hint under the label. 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 value, in words. Its presence is what puts\n * the checkbox in its error state: the message and the error colours both\n * follow from it.\n */\n readonly error?: string\n /**\n * Draws the checkbox disabled, and takes no presses.\n * @default false\n */\n readonly isDisabled?: boolean\n /**\n * Draws the dash for a box that stands for a partly selected set, and\n * reports the box as mixed to a screen reader. It is the call site's to\n * clear: a press still changes `isSelected` underneath.\n * @default false\n */\n readonly isIndeterminate?: boolean\n /**\n * Shows the state without letting a press change it.\n * @default false\n */\n readonly isReadOnly?: boolean\n /**\n * Whether the checkbox is selected, for a call site holding the state\n * itself with `onChange`.\n */\n readonly isSelected?: boolean\n /** Called with the new state whenever a press changes it. */\n readonly onChange?: (isSelected: boolean) => void\n readonly ref?: Ref<ComponentRef<typeof View>>\n readonly style?: StyleProp<ViewStyle>\n /**\n * The entry this checkbox stands for inside a `CheckboxGroup`, which the\n * group's value holds while it is selected. Required there, and unused\n * outside one.\n */\n readonly value?: string\n}\n\n// The state layer's colour roles, hovered or focused and pressed. Error is\n// error throughout; otherwise the two swap once pressed.\nconst LAYERS: Readonly<\n Record<\n CheckboxTone,\n {\n readonly hover: keyof ResolvedTheme['colors']\n readonly pressed: keyof ResolvedTheme['colors']\n }\n >\n> = {\n error: { hover: 'error', pressed: 'error' },\n marked: { hover: 'primary', pressed: 'onSurface' },\n unmarked: { hover: 'onSurface', pressed: 'primary' },\n}\n\n/**\n * A checkbox with its label, and optionally a description or an error under\n * it. Its state is React Stately's, as web's is: pass `isSelected` with\n * `onChange` to control it, or `defaultSelected` to let it keep its own.\n * `isIndeterminate` draws the dash for a box that stands for a partly\n * selected set.\n *\n * ```tsx\n * <Checkbox defaultSelected description=\"Supporting line\">\n * Label\n * </Checkbox>\n * ```\n *\n * A screen reader hears it as a checkbox named by its label, checked,\n * unchecked or mixed, followed by the line under it. A press anywhere on the\n * box or the label toggles it, and the row takes presses over the 48dp target\n * the page asks of the box. `style`, `ref` and `testID` land on the view\n * holding the row and the line under it, which is the element a layout\n * positions.\n */\nfunction Checkbox({\n 'aria-label': ariaLabel,\n children,\n defaultSelected,\n description,\n error,\n isDisabled: ownDisabled = false,\n isIndeterminate = false,\n isReadOnly: ownReadOnly = false,\n isSelected,\n onChange,\n style,\n value,\n ...props\n}: CheckboxProps) {\n const theme = useTheme()\n const group = use(CheckboxGroupContext)\n const messageId = useId()\n const control = useRef<ComponentRef<typeof Pressable>>(null)\n const members = group?.members\n\n if (group !== null && value === undefined) {\n throw new Error(\n 'A Checkbox inside a CheckboxGroup names the entry it stands for with `value`.',\n )\n }\n\n const isDisabled = ownDisabled || (group?.isDisabled ?? false)\n const isReadOnly = ownReadOnly || (group?.isReadOnly ?? false)\n const state = useToggleState(\n group === null || value === undefined\n ? { defaultSelected, isReadOnly, isSelected, onChange }\n : memberOf(group, value, { isReadOnly, onChange }),\n )\n\n // Joins the group's list of checkboxes once, in the order the tree mounts\n // them, so a native form holding the group back focuses the first.\n useEffect(() => {\n members?.add(messageId, control)\n return () => {\n members?.remove(messageId)\n }\n }, [members, messageId])\n\n const { colors, radii } = theme\n const marked = state.isSelected || isIndeterminate\n const interactive = !isDisabled && !isReadOnly\n const invalid = error !== undefined || (group?.isInvalid ?? false)\n const tone: CheckboxTone = invalid ? 'error' : marked ? 'marked' : 'unmarked'\n\n const feedback = usePressFeedback({\n color: colors[LAYERS[tone].hover],\n corners: { borderRadius: radii.circle },\n disabled: !interactive,\n disc: LAYER_SIZE,\n pressedColor: colors[LAYERS[tone].pressed],\n })\n const active =\n feedback.hovered || feedback.pressed || feedback.ring !== undefined\n\n return (\n <View {...props} style={style}>\n <Pressable\n aria-checked={isIndeterminate ? 'mixed' : state.isSelected}\n aria-label={ariaLabel}\n role=\"checkbox\"\n {...describedBy(messageId, messageOf(description, error))}\n {...feedback.handlers}\n disabled={isDisabled}\n hitSlop={hitSlop(LAYER_SIZE, LAYER_SIZE)}\n onPress={toggleOf(state)}\n ref={control}\n style={controlStylesOf(theme).row}\n >\n <View\n style={composeStyles<ViewStyle>(\n controlStylesOf(theme).disc,\n feedback.ring,\n )}\n >\n {feedback.layer}\n <CheckboxBox\n active={active}\n isDisabled={isDisabled}\n isIndeterminate={isIndeterminate}\n isSelected={state.isSelected}\n tone={tone}\n within={LAYER_SIZE}\n />\n </View>\n <ControlLabel isDisabled={isDisabled}>{children}</ControlLabel>\n </Pressable>\n <ControlMessage description={description} error={error} id={messageId} />\n </View>\n )\n}\n\n// The toggle state of a checkbox in a group: selected while the group's\n// value holds its entry, and a change made to the group's value, reported to\n// the checkbox's own `onChange` as well, as React Aria's group item does.\nfunction memberOf(\n group: CheckboxGroupContextValue,\n value: string,\n {\n isReadOnly,\n onChange,\n }: Pick<ToggleStateOptions, 'onChange'> & { readonly isReadOnly: boolean },\n): ToggleStateOptions {\n return {\n isReadOnly,\n isSelected: group.isSelected(value),\n onChange: (isSelected) => {\n group.set(value, isSelected)\n onChange?.(isSelected)\n },\n }\n}\n\n// A press's toggle. Built by a call rather than declared in the component,\n// which is what react-perf's jsx-no-new-function-as-prop is after; the React\n// Compiler memoises the result on its input.\nfunction toggleOf(state: ToggleState) {\n return () => {\n state.toggle()\n }\n}\n\nexport { Checkbox }\nexport type { CheckboxProps }\n"],"mappings":";;;;;;;;;;;;;AAkHA,MAAM4C,SAQF;CACFT,OAAO;EAAEY,OAAO;EAASC,SAAS;CAAQ;CAC1CC,QAAQ;EAAEF,OAAO;EAAWC,SAAS;CAAY;CACjDE,UAAU;EAAEH,OAAO;EAAaC,SAAS;CAAU;AACrD;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAAG,SAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAvB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAI;CAAA,IAAAC;CAAA,IAAAgB;CAAA,IAAAd;CAAA,IAAAe;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAhB;CAAA,IAAAU,EAAA,OAAAD,IAAA;EAAkB,CAAA,CAAA,cAAAG,WAAAvB,UAAAC,iBAAAC,aAAAC,OAAAC,YAAAqB,IAAApB,iBAAAqB,IAAApB,YAAAqB,IAAApB,YAAAC,UAAAE,OAAAC,OAAA,GAAAa,SAAAJ;EAcFC,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAArB;EAAAqB,EAAA,KAAApB;EAAAoB,EAAA,KAAAnB;EAAAmB,EAAA,KAAAlB;EAAAkB,EAAA,KAAAd;EAAAc,EAAA,KAAAb;EAAAa,EAAA,KAAAG;EAAAH,EAAA,KAAAX;EAAAW,EAAA,MAAAI;EAAAJ,EAAA,MAAAK;EAAAL,EAAA,MAAAM;EAAAN,EAAA,MAAAV;CAAA,O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WI,KAAK;EAClCH,WAAWD,eAAe;GACxByB,MAAMuD,IAAI5E,OAAOJ,UAAU;GAC3BC,WAAWD,UAAU;EACvB;CACF;AACF;AAKA,SAASmE,SAASnC,OAAoB;CACpC,aAAa;EACXA,MAAMiD,OAAO;CACf;AACF"}
@@ -0,0 +1,93 @@
1
+ import { ValidationResult } from "../../form/index.js";
2
+ import { StyleProp, View, ViewProps, ViewStyle } from "react-native";
3
+ import { ComponentRef, ReactNode, Ref } from "react";
4
+ //#region src/components/checkbox-group/index.d.ts
5
+ type CheckboxGroupProps = Omit<ViewProps, 'children' | 'style'> & {
6
+ /** The checkboxes, each with a `value` of its own. */
7
+ readonly children?: ReactNode;
8
+ /** The entries selected at first, when the group keeps its own value. */
9
+ readonly defaultValue?: readonly string[];
10
+ /**
11
+ * A hint under the group. Replaced by `error` when there is one, so the
12
+ * two never stack.
13
+ */
14
+ readonly description?: string;
15
+ /**
16
+ * The problem with the current selection, in words. Its presence is what
17
+ * puts the group in its error state: the message, the label's colour and
18
+ * every box's error colours follow from it.
19
+ *
20
+ * Outside a `Form` the line under the group arrives with the message, so
21
+ * the group grows when this does and moves what is under it. A `Form`
22
+ * holds that space from the start; so does a permanent `description`.
23
+ */
24
+ readonly error?: string;
25
+ /**
26
+ * Draws every checkbox disabled, and takes no presses.
27
+ * @default false
28
+ */
29
+ readonly isDisabled?: boolean;
30
+ /**
31
+ * Shows the selection without letting a press change it.
32
+ * @default false
33
+ */
34
+ readonly isReadOnly?: boolean;
35
+ /**
36
+ * Marks the group's label, and has a `native` form hold submission back
37
+ * while nothing is selected.
38
+ * @default false
39
+ */
40
+ readonly isRequired?: boolean;
41
+ /**
42
+ * What the group is for. Required rather than optional: a group of
43
+ * checkboxes with no name is a set of boxes a screen reader cannot
44
+ * introduce.
45
+ */
46
+ readonly label: string;
47
+ /**
48
+ * The name the form around the group knows it by, which its
49
+ * `validationErrors` are keyed on. A form hands `onSubmit` one string per
50
+ * name, so a group's selection is not among those values: read it through
51
+ * `onChange`, or hold it with `value`.
52
+ */
53
+ readonly name?: string;
54
+ /** Called with the newly selected entries whenever a press changes them. */
55
+ readonly onChange?: (value: string[]) => void;
56
+ readonly ref?: Ref<ComponentRef<typeof View>>;
57
+ readonly style?: StyleProp<ViewStyle>;
58
+ /**
59
+ * Checks the selection, returning its problem in words, or `true`, `null`
60
+ * or `undefined` when there is none. Shown as it changes, or under a
61
+ * `native` form once a submission is tried.
62
+ */
63
+ readonly validate?: (value: readonly string[]) => ValidationResult;
64
+ /**
65
+ * The selected entries, for a call site holding the value itself with
66
+ * `onChange`.
67
+ */
68
+ readonly value?: readonly string[];
69
+ };
70
+ /**
71
+ * A labelled set of checkboxes with one value between them. The value is
72
+ * React Stately's, as web's is React Aria's: pass `value` with `onChange` to
73
+ * control it, or `defaultValue` to let the group keep its own, and each
74
+ * `Checkbox` inside names the entry it stands for with `value`. Disabled,
75
+ * read-only and the error state reach every checkbox from here.
76
+ *
77
+ * ```tsx
78
+ * <CheckboxGroup defaultValue={['first']} label="Label">
79
+ * <Checkbox value="first">First item</Checkbox>
80
+ * <Checkbox value="second">Second item</Checkbox>
81
+ * </CheckboxGroup>
82
+ * ```
83
+ *
84
+ * A screen reader hears it as a group named by its label. On the web the
85
+ * line under it describes the group, as web's does; on iOS and Android it is
86
+ * read after the checkboxes, where it sits, and an error is announced as it
87
+ * arrives. `style`, `ref` and `testID` land on the group as a whole, which is
88
+ * the element a layout positions.
89
+ */
90
+ declare function CheckboxGroup({ children, defaultValue, description, error, isDisabled, isReadOnly, isRequired, label, name, onChange, style, validate, value, ...props }: CheckboxGroupProps): import("react").JSX.Element;
91
+ //#endregion
92
+ export { CheckboxGroup, type CheckboxGroupProps };
93
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,306 @@
1
+ import { useTheme } from "../../theme/scope.js";
2
+ import { composeStyles, themedStyles } from "../../theme/styles.js";
3
+ import { useTypeRole } from "../../typography/roles.js";
4
+ import { withOpacity } from "../../theme/color.js";
5
+ import { useFieldValidation, useInsideForm } from "../../form/index.js";
6
+ import { messageOf } from "../../control/index.js";
7
+ import { CheckboxGroupContext, createMembers } from "../../control/group.js";
8
+ import { useErrorAnnouncement } from "../../field/index.js";
9
+ import { c } from "react/compiler-runtime";
10
+ import { Platform, StyleSheet, Text, View, useWindowDimensions } from "react-native";
11
+ import { useId, useState } from "react";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ import { useCheckboxGroupState } from "react-stately/useCheckboxGroupState";
14
+ //#region src/components/checkbox-group/index.tsx
15
+ const REQUIRED_MARK = "*";
16
+ const ATOMIC = { "aria-atomic": true };
17
+ const stylesOf = themedStyles(({ colors, spacing, stateLayerOpacity }) => StyleSheet.create({
18
+ items: { flexDirection: "column" },
19
+ label: { color: colors.onSurfaceVariant },
20
+ labelDisabled: { color: withOpacity(colors.onSurface, stateLayerOpacity.disabledContent) },
21
+ labelError: { color: colors.error },
22
+ message: { color: colors.onSurfaceVariant },
23
+ messageError: { color: colors.error },
24
+ messageLine: { marginTop: spacing.xs },
25
+ messageLineCollapsed: {
26
+ marginTop: 0,
27
+ position: "absolute"
28
+ },
29
+ outOfFlow: { position: "absolute" },
30
+ root: {
31
+ flexDirection: "column",
32
+ rowGap: spacing.xs
33
+ }
34
+ }));
35
+ /**
36
+ * A labelled set of checkboxes with one value between them. The value is
37
+ * React Stately's, as web's is React Aria's: pass `value` with `onChange` to
38
+ * control it, or `defaultValue` to let the group keep its own, and each
39
+ * `Checkbox` inside names the entry it stands for with `value`. Disabled,
40
+ * read-only and the error state reach every checkbox from here.
41
+ *
42
+ * ```tsx
43
+ * <CheckboxGroup defaultValue={['first']} label="Label">
44
+ * <Checkbox value="first">First item</Checkbox>
45
+ * <Checkbox value="second">Second item</Checkbox>
46
+ * </CheckboxGroup>
47
+ * ```
48
+ *
49
+ * A screen reader hears it as a group named by its label. On the web the
50
+ * line under it describes the group, as web's does; on iOS and Android it is
51
+ * read after the checkboxes, where it sits, and an error is announced as it
52
+ * arrives. `style`, `ref` and `testID` land on the group as a whole, which is
53
+ * the element a layout positions.
54
+ */
55
+ function CheckboxGroup(t0) {
56
+ const $ = c(61);
57
+ let children;
58
+ let defaultValue;
59
+ let description;
60
+ let error;
61
+ let label;
62
+ let name;
63
+ let onChange;
64
+ let props;
65
+ let style;
66
+ let t1;
67
+ let t2;
68
+ let t3;
69
+ let validate;
70
+ let value;
71
+ if ($[0] !== t0) {
72
+ ({children, defaultValue, description, error, isDisabled: t1, isReadOnly: t2, isRequired: t3, label, name, onChange, style, validate, value, ...props} = t0);
73
+ $[0] = t0;
74
+ $[1] = children;
75
+ $[2] = defaultValue;
76
+ $[3] = description;
77
+ $[4] = error;
78
+ $[5] = label;
79
+ $[6] = name;
80
+ $[7] = onChange;
81
+ $[8] = props;
82
+ $[9] = style;
83
+ $[10] = t1;
84
+ $[11] = t2;
85
+ $[12] = t3;
86
+ $[13] = validate;
87
+ $[14] = value;
88
+ } else {
89
+ children = $[1];
90
+ defaultValue = $[2];
91
+ description = $[3];
92
+ error = $[4];
93
+ label = $[5];
94
+ name = $[6];
95
+ onChange = $[7];
96
+ props = $[8];
97
+ style = $[9];
98
+ t1 = $[10];
99
+ t2 = $[11];
100
+ t3 = $[12];
101
+ validate = $[13];
102
+ value = $[14];
103
+ }
104
+ const isDisabled = t1 === void 0 ? false : t1;
105
+ const isReadOnly = t2 === void 0 ? false : t2;
106
+ const isRequired = t3 === void 0 ? false : t3;
107
+ const theme = useTheme();
108
+ let t4;
109
+ if ($[15] !== defaultValue) {
110
+ t4 = copyOf(defaultValue);
111
+ $[15] = defaultValue;
112
+ $[16] = t4;
113
+ } else t4 = $[16];
114
+ let t5;
115
+ if ($[17] !== value) {
116
+ t5 = copyOf(value);
117
+ $[17] = value;
118
+ $[18] = t5;
119
+ } else t5 = $[18];
120
+ let t6;
121
+ if ($[19] !== isDisabled || $[20] !== isReadOnly || $[21] !== onChange || $[22] !== t4 || $[23] !== t5) {
122
+ t6 = {
123
+ defaultValue: t4,
124
+ isDisabled,
125
+ isReadOnly,
126
+ onChange,
127
+ value: t5
128
+ };
129
+ $[19] = isDisabled;
130
+ $[20] = isReadOnly;
131
+ $[21] = onChange;
132
+ $[22] = t4;
133
+ $[23] = t5;
134
+ $[24] = t6;
135
+ } else t6 = $[24];
136
+ const state = useCheckboxGroupState(t6);
137
+ const [members] = useState(createMembers);
138
+ const t7 = state.value.length === 0;
139
+ let t8;
140
+ if ($[25] !== error || $[26] !== isDisabled || $[27] !== isReadOnly || $[28] !== isRequired || $[29] !== members || $[30] !== name || $[31] !== state.value || $[32] !== t7 || $[33] !== validate) {
141
+ t8 = {
142
+ control: members,
143
+ error,
144
+ isDisabled,
145
+ isEmpty: t7,
146
+ isReadOnly,
147
+ isRequired,
148
+ name,
149
+ submitted: void 0,
150
+ validate,
151
+ value: state.value
152
+ };
153
+ $[25] = error;
154
+ $[26] = isDisabled;
155
+ $[27] = isReadOnly;
156
+ $[28] = isRequired;
157
+ $[29] = members;
158
+ $[30] = name;
159
+ $[31] = state.value;
160
+ $[32] = t7;
161
+ $[33] = validate;
162
+ $[34] = t8;
163
+ } else t8 = $[34];
164
+ const validation = useFieldValidation(t8);
165
+ const labelId = useId();
166
+ const messageId = useId();
167
+ const labelRole = useTypeRole("labelLarge");
168
+ const messageRole = useTypeRole("bodySmall");
169
+ const insideForm = useInsideForm();
170
+ const { fontScale } = useWindowDimensions();
171
+ const own = stylesOf(theme);
172
+ const shown = validation.error;
173
+ const invalid = shown !== void 0;
174
+ const message = messageOf(description, shown);
175
+ const holdsLine = insideForm || message !== void 0;
176
+ let t9;
177
+ if ($[35] !== invalid || $[36] !== members || $[37] !== state || $[38] !== validation) {
178
+ t9 = contextOf(state, members, validation, invalid);
179
+ $[35] = invalid;
180
+ $[36] = members;
181
+ $[37] = state;
182
+ $[38] = validation;
183
+ $[39] = t9;
184
+ } else t9 = $[39];
185
+ const context = t9;
186
+ const messageStyle = composeStyles(messageRole, own.message, invalid ? own.messageError : void 0);
187
+ useErrorAnnouncement(shown);
188
+ const t10 = lineOf(messageId, message);
189
+ const t11 = composeStyles(own.root, style);
190
+ let t12;
191
+ if ($[40] !== children || $[41] !== context) {
192
+ t12 = /* @__PURE__ */ jsx(CheckboxGroupContext, {
193
+ value: context,
194
+ children
195
+ });
196
+ $[40] = children;
197
+ $[41] = context;
198
+ $[42] = t12;
199
+ } else t12 = $[42];
200
+ const T0 = View;
201
+ const t13 = composeStyles(own.messageLine, holdsLine ? minHeightOf(theme.typography.bodySmallLineHeight * fontScale) : own.messageLineCollapsed);
202
+ const t14 = invalid && shown !== "" ? void 0 : own.outOfFlow;
203
+ let t15;
204
+ if ($[43] !== invalid || $[44] !== messageId || $[45] !== messageStyle || $[46] !== shown) {
205
+ t15 = invalid && shown !== "" ? /* @__PURE__ */ jsx(Text, {
206
+ id: messageId,
207
+ style: messageStyle,
208
+ children: shown
209
+ }) : null;
210
+ $[43] = invalid;
211
+ $[44] = messageId;
212
+ $[45] = messageStyle;
213
+ $[46] = shown;
214
+ $[47] = t15;
215
+ } else t15 = $[47];
216
+ let t16;
217
+ if ($[48] !== t14 || $[49] !== t15) {
218
+ t16 = /* @__PURE__ */ jsx(View, {
219
+ "aria-live": "polite",
220
+ ...Platform.OS === "web" ? ATOMIC : void 0,
221
+ style: t14,
222
+ children: t15
223
+ });
224
+ $[48] = t14;
225
+ $[49] = t15;
226
+ $[50] = t16;
227
+ } else t16 = $[50];
228
+ let t17;
229
+ if ($[51] !== description || $[52] !== invalid || $[53] !== messageId || $[54] !== messageStyle) {
230
+ t17 = invalid || description === void 0 ? null : /* @__PURE__ */ jsx(Text, {
231
+ id: messageId,
232
+ style: messageStyle,
233
+ children: description
234
+ });
235
+ $[51] = description;
236
+ $[52] = invalid;
237
+ $[53] = messageId;
238
+ $[54] = messageStyle;
239
+ $[55] = t17;
240
+ } else t17 = $[55];
241
+ let t18;
242
+ if ($[56] !== T0 || $[57] !== t13 || $[58] !== t16 || $[59] !== t17) {
243
+ t18 = /* @__PURE__ */ jsxs(T0, {
244
+ style: t13,
245
+ children: [t16, t17]
246
+ });
247
+ $[56] = T0;
248
+ $[57] = t13;
249
+ $[58] = t16;
250
+ $[59] = t17;
251
+ $[60] = t18;
252
+ } else t18 = $[60];
253
+ return /* @__PURE__ */ jsxs(View, {
254
+ ...props,
255
+ "aria-labelledby": labelId,
256
+ role: "group",
257
+ ...t10,
258
+ style: t11,
259
+ children: [
260
+ /* @__PURE__ */ jsxs(Text, {
261
+ id: labelId,
262
+ style: composeStyles(labelRole, own.label, isDisabled ? own.labelDisabled : void 0, invalid ? own.labelError : void 0),
263
+ children: [label, isRequired ? REQUIRED_MARK : null]
264
+ }),
265
+ /* @__PURE__ */ jsx(View, {
266
+ style: own.items,
267
+ children: t12
268
+ }),
269
+ t18
270
+ ]
271
+ });
272
+ }
273
+ function contextOf(state, members, { onBlur, onEdit }, isInvalid) {
274
+ return {
275
+ isDisabled: state.isDisabled,
276
+ isInvalid,
277
+ isReadOnly: state.isReadOnly,
278
+ isSelected: (entry) => state.isSelected(entry),
279
+ members,
280
+ set: (entry, isSelected) => {
281
+ if (isSelected) state.addValue(entry);
282
+ else state.removeValue(entry);
283
+ onEdit();
284
+ onBlur();
285
+ }
286
+ };
287
+ }
288
+ function copyOf(entries) {
289
+ return entries === void 0 ? void 0 : [...entries];
290
+ }
291
+ /**
292
+ * How the group is described by the line under it. On the web it points at
293
+ * the line with `aria-describedby`, as web's group does. iOS and Android
294
+ * focus the checkboxes rather than the group, so there the line is left
295
+ * where a screen reader reaches it in order, after the last checkbox.
296
+ */
297
+ function lineOf(id, message) {
298
+ return Platform.OS === "web" && message !== void 0 ? { "aria-describedby": id } : void 0;
299
+ }
300
+ function minHeightOf(minHeight) {
301
+ return { minHeight };
302
+ }
303
+ //#endregion
304
+ export { CheckboxGroup };
305
+
306
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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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CAAA,OAAAA,MAAAjD,EAAA;CAAA,OA9CT,qBAAC,MAAD;EAAK,GACCE;EACamB,mBAAAA;EACZ,MAAA;EAAO,GACRc;EACG,OAAAE;EALT,UAAA;GAOE,qBAACyB,MAAD;IACMzC,IAAAA;IACG,OAAApE,cACLsE,WACAI,IAAG9D,OACHH,aAAaiE,IAAG3C,gBAAhBsB,KAAAA,GACAuB,UAAUF,IAAGxC,aAAbmB,KAAAA,CACF;IAPF,UAAA,CASGzC,OACAD,aAAAQ,gBAAA,IAVQ;;GAYX,oBAAC,MAAD;IAAa,OAAAuD,IAAG/C;IACd0D,UAAAA;GADG,CAAA;GAGLW;EAtBG;;AA+CE;AAQX,SAASjB,UACPpB,OACAC,SACA,EACEqC,QACAC,UAEFC,WAC2B;CAC3B,OAAO;EACL1F,YAAYkD,MAAMlD;EAClB0F;EACAzF,YAAYiD,MAAMjD;EAClB0F,aAAaC,UAAU1C,MAAMyC,WAAWC,KAAK;EAC7CzC;EACA0C,MAAMD,OAAOD,eAAe;GAC1B,IAAIA,YACFzC,MAAM4C,SAASF,KAAK;QAEpB1C,MAAM6C,YAAYH,KAAK;GAEzBH,OAAO;GACPD,OAAO;EACT;CACF;AACF;AAIA,SAASzC,OAAOiD,SAAwC;CACtD,OAAOA,YAAYpD,KAAAA,IAAYA,KAAAA,IAAY,CAAC,GAAGoD,OAAO;AACxD;;;;;;;AAQA,SAAStB,OAAOuB,IAAYvE,SAA6B;CACvD,OAAOlD,SAAS6G,OAAO,SAAS3D,YAAYkB,KAAAA,IACxC,EAAE,oBAAoBqD,GAAG,IACzBrD,KAAAA;AACN;AAEA,SAASmC,YAAYmB,WAA8B;CACjD,OAAO,EAAEA,UAAU;AACrB"}
@@ -77,8 +77,9 @@ type ChipGroupProps<T extends object = object> = Omit<ViewProps, 'children' | 's
77
77
  /**
78
78
  * What the close target on each chip is called, for a screen reader. The
79
79
  * chip's own text follows it, so this is the verb rather than the whole
80
- * phrase: "Remove" becomes "Remove First item".
81
- * @default 'Remove'
80
+ * phrase: "Remove" becomes "Remove First item". Left out, it is the word
81
+ * React Aria gives web's in the `I18nProvider`'s locale, or the device's
82
+ * outside one, "Remove" in English.
82
83
  */
83
84
  readonly removeLabel?: string;
84
85
  /** What the row draws once it holds no chips. */
@@ -117,7 +118,7 @@ type ChipGroupProps<T extends object = object> = Omit<ViewProps, 'children' | 's
117
118
  * where it sits. `style`, `ref` and `testID` land on the group as a whole,
118
119
  * which is the element a layout positions.
119
120
  */
120
- declare function ChipGroup<T extends object = object>({ children, defaultSelectedKeys, description, disabledKeys, disallowEmptySelection, error, items, label, onRemove, onSelectionChange, removeLabel, renderEmptyState, selectedKeys, selectionMode, style, ...props }: ChipGroupProps<T>): import("react").JSX.Element;
121
+ declare function ChipGroup<T extends object = object>({ children, defaultSelectedKeys, description, disabledKeys, disallowEmptySelection, error, items, label, onRemove, onSelectionChange, removeLabel: ownRemoveLabel, renderEmptyState, selectedKeys, selectionMode, style, ...props }: ChipGroupProps<T>): import("react").JSX.Element;
121
122
  declare namespace ChipGroup {
122
123
  var Chip: typeof ChipGroupChip;
123
124
  }