@kanso-labs/kanso-ui 0.47.5 → 0.48.1

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 (194) hide show
  1. package/dist/button/hooks.js +38 -4
  2. package/dist/button/hooks.js.map +1 -1
  3. package/dist/button/index.js +80 -67
  4. package/dist/button/index.js.map +1 -1
  5. package/dist/calendar/index.js +5 -5
  6. package/dist/calendar/styles.js +5 -5
  7. package/dist/calendar/styles.js.map +1 -1
  8. package/dist/chip/label.js +1 -1
  9. package/dist/chip/styles.js +1 -1
  10. package/dist/chip/styles.js.map +1 -1
  11. package/dist/collection/context.js +6 -0
  12. package/dist/collection/context.js.map +1 -0
  13. package/dist/collection/index.js +2 -2
  14. package/dist/collection/styles.js +29 -6
  15. package/dist/collection/styles.js.map +1 -1
  16. package/dist/components/app-bar/index.d.ts +1 -1
  17. package/dist/components/app-bar/index.js +2 -2
  18. package/dist/components/autocomplete/index.js +2 -2
  19. package/dist/components/avatar/index.d.ts +1 -1
  20. package/dist/components/avatar/index.js +1 -1
  21. package/dist/components/badge/index.js +3 -3
  22. package/dist/components/breadcrumbs/index.js +2 -2
  23. package/dist/components/button/index.d.ts +1 -1
  24. package/dist/components/button/index.js +3 -3
  25. package/dist/components/button/index.js.map +1 -1
  26. package/dist/components/button-group/index.d.ts +1 -1
  27. package/dist/components/button-group/index.js +3 -3
  28. package/dist/components/calendar/index.js +11 -4
  29. package/dist/components/calendar/index.js.map +1 -1
  30. package/dist/components/card/index.js +2 -2
  31. package/dist/components/carousel/index.d.ts +1 -1
  32. package/dist/components/carousel/index.js +2 -2
  33. package/dist/components/checkbox/index.js +13 -10
  34. package/dist/components/checkbox/index.js.map +1 -1
  35. package/dist/components/checkbox-group/index.js +4 -3
  36. package/dist/components/checkbox-group/index.js.map +1 -1
  37. package/dist/components/chip/index.js +2 -2
  38. package/dist/components/chip-group/index.js +72 -69
  39. package/dist/components/chip-group/index.js.map +1 -1
  40. package/dist/components/code/index.js +1 -1
  41. package/dist/components/color-area/index.js +2 -2
  42. package/dist/components/color-field/index.d.ts +1 -1
  43. package/dist/components/color-field/index.js +2 -2
  44. package/dist/components/color-picker/index.js +2 -2
  45. package/dist/components/color-slider/index.js +3 -3
  46. package/dist/components/color-swatch/index.js +3 -3
  47. package/dist/components/color-swatch-picker/index.js +3 -2
  48. package/dist/components/color-swatch-picker/index.js.map +1 -1
  49. package/dist/components/color-wheel/index.js +2 -2
  50. package/dist/components/combo-box/index.d.ts +1 -1
  51. package/dist/components/combo-box/index.js +8 -4
  52. package/dist/components/combo-box/index.js.map +1 -1
  53. package/dist/components/container/index.js +1 -1
  54. package/dist/components/copy-field/index.js +2 -2
  55. package/dist/components/currency/index.js +3 -3
  56. package/dist/components/date-field/index.d.ts +1 -1
  57. package/dist/components/date-field/index.js +2 -2
  58. package/dist/components/date-picker/index.d.ts +2 -2
  59. package/dist/components/date-picker/index.js +5 -5
  60. package/dist/components/date-range-picker/index.d.ts +2 -2
  61. package/dist/components/date-range-picker/index.js +3 -3
  62. package/dist/components/dialog/index.js +4 -4
  63. package/dist/components/disclosure/index.js +3 -3
  64. package/dist/components/disclosure-group/index.js +3 -3
  65. package/dist/components/drop-zone/index.js +2 -2
  66. package/dist/components/drop-zone/styles.js +11 -11
  67. package/dist/components/drop-zone/styles.js.map +1 -1
  68. package/dist/components/fab/index.d.ts +1 -1
  69. package/dist/components/fab/index.js +1 -1
  70. package/dist/components/fab-menu/index.d.ts +2 -2
  71. package/dist/components/fab-menu/index.js +6 -6
  72. package/dist/components/fab-menu/index.js.map +1 -1
  73. package/dist/components/feed/index.js +1 -1
  74. package/dist/components/form/index.js +2 -2
  75. package/dist/components/icon-button/index.d.ts +1 -1
  76. package/dist/components/icon-button/index.js +3 -3
  77. package/dist/components/icon-button/index.js.map +1 -1
  78. package/dist/components/keycap/index.js +2 -2
  79. package/dist/components/link/index.js +2 -2
  80. package/dist/components/list/index.js +61 -14
  81. package/dist/components/list/index.js.map +1 -1
  82. package/dist/components/list-box/index.js +84 -105
  83. package/dist/components/list-box/index.js.map +1 -1
  84. package/dist/components/list-detail/index.d.ts +1 -1
  85. package/dist/components/list-detail/index.js +1 -1
  86. package/dist/components/list-item/index.js +1 -1
  87. package/dist/components/loading-indicator/index.js +2 -2
  88. package/dist/components/menu/index.d.ts +2 -2
  89. package/dist/components/menu/index.js +3 -3
  90. package/dist/components/meter/index.d.ts +1 -1
  91. package/dist/components/meter/index.js +2 -2
  92. package/dist/components/navigation-bar/index.d.ts +1 -1
  93. package/dist/components/navigation-bar/index.js +2 -2
  94. package/dist/components/navigation-rail/index.d.ts +1 -1
  95. package/dist/components/navigation-rail/index.js +6 -6
  96. package/dist/components/navigation-rail/index.js.map +1 -1
  97. package/dist/components/navigation-tree/index.js +2 -2
  98. package/dist/components/number-field/index.d.ts +1 -1
  99. package/dist/components/number-field/index.js +5 -5
  100. package/dist/components/number-field/index.js.map +1 -1
  101. package/dist/components/popover/index.d.ts +1 -1
  102. package/dist/components/popover/index.js +7 -7
  103. package/dist/components/popover/index.js.map +1 -1
  104. package/dist/components/product-icon/index.d.ts +1 -1
  105. package/dist/components/product-icon/index.js +1 -1
  106. package/dist/components/progress-indicator/index.d.ts +1 -1
  107. package/dist/components/progress-indicator/index.js +2 -2
  108. package/dist/components/radio-group/index.js +14 -13
  109. package/dist/components/radio-group/index.js.map +1 -1
  110. package/dist/components/range-calendar/index.js +3 -3
  111. package/dist/components/search-field/index.js +6 -6
  112. package/dist/components/search-field/index.js.map +1 -1
  113. package/dist/components/search-view/index.d.ts +1 -1
  114. package/dist/components/search-view/index.js +2 -2
  115. package/dist/components/segmented-button/index.d.ts +1 -1
  116. package/dist/components/segmented-button/index.js +3 -3
  117. package/dist/components/select/index.d.ts +1 -1
  118. package/dist/components/select/index.js +8 -4
  119. package/dist/components/select/index.js.map +1 -1
  120. package/dist/components/separator/index.js +3 -3
  121. package/dist/components/sheet/index.js +4 -4
  122. package/dist/components/sheet/index.js.map +1 -1
  123. package/dist/components/slider/index.js +4 -4
  124. package/dist/components/slider/index.js.map +1 -1
  125. package/dist/components/snackbar/index.js +6 -6
  126. package/dist/components/snackbar/index.js.map +1 -1
  127. package/dist/components/split-button/index.d.ts +1 -1
  128. package/dist/components/split-button/index.js +56 -44
  129. package/dist/components/split-button/index.js.map +1 -1
  130. package/dist/components/stack/index.js +2 -2
  131. package/dist/components/supporting-pane/index.d.ts +1 -1
  132. package/dist/components/supporting-pane/index.js +1 -1
  133. package/dist/components/switch/index.d.ts +1 -1
  134. package/dist/components/switch/index.js +3 -3
  135. package/dist/components/table/index.js +61 -48
  136. package/dist/components/table/index.js.map +1 -1
  137. package/dist/components/tabs/index.js +84 -33
  138. package/dist/components/tabs/index.js.map +1 -1
  139. package/dist/components/tag/index.js +1 -1
  140. package/dist/components/text/index.js +1 -1
  141. package/dist/components/text-area/index.d.ts +1 -1
  142. package/dist/components/text-area/index.js +2 -2
  143. package/dist/components/text-field/index.d.ts +1 -1
  144. package/dist/components/text-field/index.js +2 -2
  145. package/dist/components/time-field/index.d.ts +1 -1
  146. package/dist/components/time-field/index.js +2 -2
  147. package/dist/components/time-picker/index.d.ts +1 -1
  148. package/dist/components/time-picker/index.js +9 -9
  149. package/dist/components/time-picker/index.js.map +1 -1
  150. package/dist/components/token-field/index.d.ts +1 -1
  151. package/dist/components/token-field/index.js +3 -3
  152. package/dist/components/toolbar/index.js +3 -3
  153. package/dist/components/tooltip/index.d.ts +1 -1
  154. package/dist/components/tooltip/index.js +2 -2
  155. package/dist/components/tree/index.js +81 -24
  156. package/dist/components/tree/index.js.map +1 -1
  157. package/dist/control/index.js +2 -2
  158. package/dist/drag/hooks.js +2 -2
  159. package/dist/drag/index.js +2 -2
  160. package/dist/field/index.js +106 -107
  161. package/dist/field/index.js.map +1 -1
  162. package/dist/field/styles.js +1 -1
  163. package/dist/field/styles.js.map +1 -1
  164. package/dist/glyphs/index.js +1 -1
  165. package/dist/hooks/useClippedTitle.js +1 -1
  166. package/dist/hooks/useEnlargedText.js +1 -1
  167. package/dist/hooks/useRipple.js +2 -2
  168. package/dist/hooks/useScrollEdges.js +73 -0
  169. package/dist/hooks/useScrollEdges.js.map +1 -0
  170. package/dist/i18n/index.js +2 -2
  171. package/dist/index.js +1 -1
  172. package/dist/indicator/index.js +2 -2
  173. package/dist/mark/index.js +2 -2
  174. package/dist/navigation/index.js +3 -3
  175. package/dist/navigation/styles.js +5 -5
  176. package/dist/navigation/styles.js.map +1 -1
  177. package/dist/overlay/index.js +1 -1
  178. package/dist/render/useRender.js +1 -1
  179. package/dist/row/index.js +2 -2
  180. package/dist/row/styles.js +7 -7
  181. package/dist/row/styles.js.map +1 -1
  182. package/dist/segments/index.js +1 -1
  183. package/dist/segments/literal.js +3 -3
  184. package/dist/styles/color.js +16 -16
  185. package/dist/styles/color.js.map +1 -1
  186. package/dist/styles/focus.js +4 -4
  187. package/dist/styles/focus.js.map +1 -1
  188. package/dist/styles/overlay.js +3 -3
  189. package/dist/styles/overlay.js.map +1 -1
  190. package/dist/styles/scroll-fade.js +33 -0
  191. package/dist/styles/scroll-fade.js.map +1 -0
  192. package/dist/styles.css +61 -20
  193. package/dist/theme-scope.js +4 -4
  194. package/package.json +8 -8
@@ -1,5 +1,8 @@
1
1
  "use client";
2
+ import { c } from "react/compiler-runtime";
2
3
  import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
4
+ import { createContext, useContext } from "react";
5
+ import { Button, Tag, TagGroup, TagList } from "react-aria-components";
3
6
  import { chipGlyph, chipLabel, chipPropsFor, chipRemoveClassName } from "../../chip/index.js";
4
7
  import { chipStyles } from "../../chip/styles.js";
5
8
  import { textOf } from "../../collection/text.js";
@@ -10,10 +13,7 @@ import { CloseGlyph } from "../../glyphs/index.js";
10
13
  import { useRipple } from "../../hooks/useRipple.js";
11
14
  import { focus } from "../../styles/focus.js";
12
15
  import { mergeStatefulStyles, mergeStyles } from "../../styles/merge.js";
13
- import { c } from "react/compiler-runtime";
14
- import { createContext, useContext } from "react";
15
16
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
16
- import { Button, Tag, TagGroup, TagList } from "react-aria-components";
17
17
  // src/components/chip-group/index.tsx
18
18
  const styles = { list: {
19
19
  kGNEyG: "x6s0dn4",
@@ -44,8 +44,6 @@ function chipContent(children, icon, removeLabel, surface, acts) {
44
44
  }
45
45
  const RemoveLabelContext = createContext(void 0);
46
46
  const GroupActionContext = createContext(false);
47
- const LABEL_STATE_VALID = { isInvalid: false };
48
- const LABEL_STATE_INVALID = { isInvalid: true };
49
47
  function actingChipPropsFor(state) {
50
48
  return chipPropsFor(state, { kind: kindOf(state) });
51
49
  }
@@ -80,7 +78,7 @@ function actingChipPropsFor(state) {
80
78
  * which is the element a layout positions.
81
79
  */
82
80
  function ChipGroup(t0) {
83
- const $ = c(39);
81
+ const $ = c(41);
84
82
  let T0;
85
83
  let children;
86
84
  let description;
@@ -105,7 +103,13 @@ function ChipGroup(t0) {
105
103
  renderEmptyState = t11;
106
104
  props$1 = t12;
107
105
  const escapeKeyBehavior = t7 === void 0 ? "none" : t7;
108
- invalid = invalidFrom(error);
106
+ let t13;
107
+ if ($[14] !== error) {
108
+ t13 = invalidFrom(error);
109
+ $[14] = error;
110
+ $[15] = t13;
111
+ } else t13 = $[15];
112
+ invalid = t13;
109
113
  T0 = TagGroup;
110
114
  t1 = escapeKeyBehavior;
111
115
  t2 = props$1;
@@ -139,90 +143,89 @@ function ChipGroup(t0) {
139
143
  t2 = $[12];
140
144
  t3 = $[13];
141
145
  }
142
- const t4 = invalid ? LABEL_STATE_INVALID : LABEL_STATE_VALID;
143
- let t5;
144
- if ($[14] !== label || $[15] !== t4) {
145
- t5 = /* @__PURE__ */ jsx(FieldLabel, {
146
- state: t4,
146
+ let t4;
147
+ if ($[16] !== invalid || $[17] !== label) {
148
+ t4 = /* @__PURE__ */ jsx(FieldLabel, {
149
+ isInvalid: invalid,
147
150
  variant: "group",
148
151
  children: label
149
152
  });
150
- $[14] = label;
151
- $[15] = t4;
152
- $[16] = t5;
153
- } else t5 = $[16];
154
- const t6 = props$1.onAction !== void 0;
153
+ $[16] = invalid;
154
+ $[17] = label;
155
+ $[18] = t4;
156
+ } else t4 = $[18];
157
+ const t5 = props$1.onAction !== void 0;
158
+ let t6;
159
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
160
+ t6 = props(styles.list, focus.ring);
161
+ $[19] = t6;
162
+ } else t6 = $[19];
155
163
  let t7;
156
- if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
157
- t7 = props(styles.list, focus.ring);
158
- $[17] = t7;
159
- } else t7 = $[17];
160
- let t8;
161
- if ($[18] !== children || $[19] !== items || $[20] !== renderEmptyState) {
162
- t8 = /* @__PURE__ */ jsx(TagList, {
164
+ if ($[20] !== children || $[21] !== items || $[22] !== renderEmptyState) {
165
+ t7 = /* @__PURE__ */ jsx(TagList, {
163
166
  items,
164
167
  renderEmptyState,
165
- ...t7,
168
+ ...t6,
166
169
  children
167
170
  });
168
- $[18] = children;
169
- $[19] = items;
170
- $[20] = renderEmptyState;
171
- $[21] = t8;
172
- } else t8 = $[21];
171
+ $[20] = children;
172
+ $[21] = items;
173
+ $[22] = renderEmptyState;
174
+ $[23] = t7;
175
+ } else t7 = $[23];
176
+ let t8;
177
+ if ($[24] !== t5 || $[25] !== t7) {
178
+ t8 = /* @__PURE__ */ jsx(GroupActionContext, {
179
+ value: t5,
180
+ children: t7
181
+ });
182
+ $[24] = t5;
183
+ $[25] = t7;
184
+ $[26] = t8;
185
+ } else t8 = $[26];
173
186
  let t9;
174
- if ($[22] !== t6 || $[23] !== t8) {
175
- t9 = /* @__PURE__ */ jsx(GroupActionContext, {
176
- value: t6,
187
+ if ($[27] !== removeLabel || $[28] !== t8) {
188
+ t9 = /* @__PURE__ */ jsx(RemoveLabelContext, {
189
+ value: removeLabel,
177
190
  children: t8
178
191
  });
179
- $[22] = t6;
180
- $[23] = t8;
181
- $[24] = t9;
182
- } else t9 = $[24];
192
+ $[27] = removeLabel;
193
+ $[28] = t8;
194
+ $[29] = t9;
195
+ } else t9 = $[29];
183
196
  let t10;
184
- if ($[25] !== removeLabel || $[26] !== t9) {
185
- t10 = /* @__PURE__ */ jsx(RemoveLabelContext, {
186
- value: removeLabel,
187
- children: t9
188
- });
189
- $[25] = removeLabel;
190
- $[26] = t9;
191
- $[27] = t10;
192
- } else t10 = $[27];
193
- let t11;
194
- if ($[28] !== description || $[29] !== error) {
195
- t11 = /* @__PURE__ */ jsx(FieldMessage, {
197
+ if ($[30] !== description || $[31] !== error) {
198
+ t10 = /* @__PURE__ */ jsx(FieldMessage, {
196
199
  description,
197
200
  error,
198
201
  inset: false
199
202
  });
200
- $[28] = description;
201
- $[29] = error;
202
- $[30] = t11;
203
- } else t11 = $[30];
204
- let t12;
205
- if ($[31] !== T0 || $[32] !== t1 || $[33] !== t10 || $[34] !== t11 || $[35] !== t2 || $[36] !== t3 || $[37] !== t5) {
206
- t12 = /* @__PURE__ */ jsxs(T0, {
203
+ $[30] = description;
204
+ $[31] = error;
205
+ $[32] = t10;
206
+ } else t10 = $[32];
207
+ let t11;
208
+ if ($[33] !== T0 || $[34] !== t1 || $[35] !== t10 || $[36] !== t2 || $[37] !== t3 || $[38] !== t4 || $[39] !== t9) {
209
+ t11 = /* @__PURE__ */ jsxs(T0, {
207
210
  escapeKeyBehavior: t1,
208
211
  ...t2,
209
212
  ...t3,
210
213
  children: [
211
- t5,
212
- t10,
213
- t11
214
+ t4,
215
+ t9,
216
+ t10
214
217
  ]
215
218
  });
216
- $[31] = T0;
217
- $[32] = t1;
218
- $[33] = t10;
219
- $[34] = t11;
220
- $[35] = t2;
221
- $[36] = t3;
222
- $[37] = t5;
223
- $[38] = t12;
224
- } else t12 = $[38];
225
- return t12;
219
+ $[33] = T0;
220
+ $[34] = t1;
221
+ $[35] = t10;
222
+ $[36] = t2;
223
+ $[37] = t3;
224
+ $[38] = t4;
225
+ $[39] = t9;
226
+ $[40] = t11;
227
+ } else t11 = $[40];
228
+ return t11;
226
229
  }
227
230
  /**
228
231
  * One chip. Give every chip an `id` — that is the key selection and removal
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_c","stylex","createContext","useContext","RACTag","RACTagGroup","chipGlyph","chipLabel","chipPropsFor","chipRemoveClassName","chipStyles","textOf","invalidFrom","groupStyles","useRipple","focus","mergeStatefulStyles","mergeStyles","styles","list","kGNEyG","kaIpWk","kB7OPa","k1xSpc","kwnvtZ","kOIVth","kAzted","kg3NbH","$$css","children","icon","textValue","description","error","escapeKeyBehavior","label","removeLabel","chipContent","surface","acts","state","selectionMode","isDisabled","props","surfaceCorners","allowsRemoving","removeGlyph","RemoveLabelContext","undefined","GroupActionContext","LABEL_STATE_VALID","isInvalid","LABEL_STATE_INVALID","actingChipPropsFor","kind","kindOf","ChipGroup","t0","$","T0","invalid","items","renderEmptyState","t1","t2","t3","t4","t5","t6","t7","t8","t9","t10","t11","t12","root","onAction","Symbol","for","ring","ChipGroupChip","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","href","ripple","handlers","groupChipPropsFor","inert","Chip","RACButton","RACTagList"],"sources":["../../../src/components/chip-group/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactElement, ReactNode, RefAttributes } from 'react';\nimport type { TagGroupProps as RACTagGroupProps, TagListProps as RACTagListProps, TagProps as RACTagProps, TagRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext } from 'react';\nimport { Button as RACButton, Tag as RACTag, TagGroup as RACTagGroup, TagList as RACTagList } from 'react-aria-components';\nimport { chipGlyph, chipLabel, chipPropsFor, chipRemoveClassName } from '../../chip';\nimport { chipStyles } from '../../chip/styles';\nimport { textOf } from '../../collection/text';\nimport { FieldLabel, FieldMessage } from '../../field';\nimport { invalidFrom } from '../../field/root';\nimport { groupStyles } from '../../field/styles';\nimport { CloseGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { radii, sizing, spacing } from '../../tokens/design.tokens.stylex';\n\n// The chips page's filter and input chips as a set: one or more chosen from a\n// row, each one removable. The pill is the chip module's in `src/chip`,\n// shared with the standalone Chip, so the two cannot drift; what is here is\n// the group around them.\n//\n// Three things it adds over a row of Chips.\n//\n// **It is a group, not a row of buttons.** React Aria's `TagGroup` names the\n// set, describes it, points it at its error, and moves between its chips\n// with the arrow keys rather than making each one a tab stop — which\n// is what a set of a dozen filters needs. The label, the supporting line and\n// the error are the field chrome's, so a group reads like the fields beside\n// it, exactly as CheckboxGroup and RadioGroup do.\n//\n// **A chip can be removed.** Give the group `onRemove` and each chip draws\n// the page's trailing close target, an 18dp glyph in a target of its own so a\n// press there removes rather than toggles. Backspace and Delete remove the\n// focused chip too, which is React Aria's. A chosen chip's check sits at the\n// other end, so a chip that is both selected and removable carries one glyph\n// on each side of its label.\n//\n// **Selection is the group's, not each chip's.** `selectionMode` and\n// `selectedKeys` live on the group, so a set that chooses one of its chips\n// and a set that chooses several are the same component with a different\n// word. A chip on its own that toggles nothing else is still Chip.\n//\n// **Escape leaves the selection alone.** React Aria's collections clear the\n// selection on Escape and stop the key there, which suits a list whose\n// selection is what an action is about to act on. A set of chips holds a\n// value, as a checkbox group does, and usually sits in a Sheet, Dialog or\n// Popover, where Escape is what dismisses it: clearing it there wiped the\n// reader's filters and took a second press to close. So the group passes\n// React Aria's `escapeKeyBehavior` as `none` unless told `clearSelection`.\n//\n// **A chip a press does nothing to does not look pressable.** In a group\n// that selects nothing, a chip with no action of its own or the group's is\n// a control only for its close target. It draws the arrow cursor, no layer\n// and no ripple, and its close target keeps the pointer. A disabled chip's\n// close target takes the chip's `not-allowed` with it.\n//\n// One thing is worth knowing about how this maps onto React Aria. A chip's\n// text value is read off its children and found only when they are a plain\n// string, and a chip here is always an element — the label sits beside a\n// close target. So a plain-string label is passed through as the text value,\n// which is what typeahead and a screen reader's announcement are made of;\n// see ListBox.Item, where the same thing bit.\n\nconst styles = {\n list: {\n kGNEyG: \"x6s0dn4\",\n kaIpWk: \"x1xdvaa9\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kwnvtZ: \"x1a02dak\",\n kOIVth: \"x126z3so\",\n kAzted: \"xlzjxrf\",\n kg3NbH: \"x91pird xnjsko4\",\n $$css: true\n }\n};\ntype ChipGroupChipProps = {\n /**\n * The chip's label. Text, numbers, or a mix of the two — `Label {3}` —\n * also name the chip; a label holding an element needs `textValue`.\n */\n children?: ReactNode;\n /** A function may compute the class from the chip's render state. */\n className?: RACTagProps['className'];\n /**\n * An icon before the label, in the page's 18dp slot and the primary role.\n * The check takes its place while the chip is chosen, so the chip keeps\n * its width. An icon drawn in `em` takes its size from the slot.\n */\n icon?: ReactNode;\n /** A function may compute the style from the chip's render state. */\n style?: RACTagProps['style'];\n /**\n * The chip's name as text, which is what a screen reader announces for\n * its row. Read from the label when that is text or numbers, so it is\n * needed only when the label holds an element — emphasis, a count in a\n * badge — and React Aria warns in the console when such a chip has none.\n * Given, it wins over the text read from the label.\n */\n textValue?: string;\n} & Omit<RACTagProps, 'children' | 'className' | 'style' | 'textValue'>;\ntype ChipGroupProps<T extends object = object> = {\n /**\n * The chips, each with an `id` of its own. With `items`, a function from an\n * item to its chip, which React Aria calls for each item in turn.\n */\n children?: ((item: T) => ReactElement) | ReactNode;\n /**\n * A hint under the group. Replaced by `error` when there is one, so the\n * two never stack.\n */\n 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 label and the message take the\n * error colour, the grid's `aria-describedby` names the message, and the\n * message is read out politely as it appears. The grid carries no\n * `aria-invalid`, which ARIA does not allow on a grid, so the message is\n * the whole of what a screen reader is told.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * What Escape does on a chip. `none`, the default, keeps the selection and\n * lets the key through to whatever is around the group, so a group in a\n * Sheet, Dialog or Popover closes it on the first press. `clearSelection`\n * empties the selection first, as React Aria's own default does, and lets\n * a second press through.\n *\n * @default 'none'\n */\n escapeKeyBehavior?: 'clearSelection' | 'none';\n /**\n * What the group is for. Required rather than optional: a set of chips\n * with no name is a row a screen reader cannot introduce.\n */\n label: string;\n /**\n * What the close target on each chip is called, for a screen reader. React\n * Aria adds the chip's own label after it, so this is the verb rather than\n * the whole phrase — \"Remove\" becomes \"Remove First item\". Left out, React\n * Aria names it in the reader's locale — \"Remove\" in English.\n */\n removeLabel?: string;\n} & Omit<RACTagGroupProps, 'children' | 'escapeKeyBehavior'> & Pick<RACTagListProps<T>, 'items' | 'renderEmptyState'>;\n\n// What the chip draws, from React Aria's render state. Built by a call rather\n// than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result on\n// its inputs.\n//\n// The check and the icon it replaces are the chip module's, so a chip in a\n// group and a chip on its own draw the same ones. The close target is drawn\n// only where the group allows removing, which React Aria reports rather than\n// the call site saying so on every chip.\n//\n// The ripple is drawn only on a chip a press does something to, and not\n// disabled: one the group lets be selected, or one with an action, its own\n// or the group's. Any other chip in a group that selects nothing is a\n// control only for its close target, and React Aria reports neither hover\n// nor press on it, so a ripple there would answer a press that changes\n// nothing. `acts` is the action half, which the render state does not carry.\n//\n// It sits in a box of its own carrying the chip's corner, since React Aria's\n// cell between the chip and this content would otherwise hand the ripple a\n// square one to inherit; see the header of src/chip/styles.ts.\nfunction chipContent(children: ReactNode, icon: ReactNode, removeLabel: string | undefined, surface: ReactNode, acts: boolean) {\n return (state: TagRenderProps) => <>\n {chipGlyph(state, icon, state.selectionMode !== 'none')}\n {chipLabel(children)}\n {(acts || state.selectionMode !== 'none') && !state.isDisabled ? <span {...stylex.props(chipStyles.surfaceCorners)}>{surface}</span> : null}\n {state.allowsRemoving ? <RACButton aria-label={removeLabel} className={chipRemoveClassName} slot=\"remove\">\n <CloseGlyph {...stylex.props(chipStyles.removeGlyph)} />\n </RACButton> : null}\n </>;\n}\n\n// What each chip calls its close target. A context rather than a prop on the\n// chip, since it is the group's decision and repeating it on every chip is\n// how the two drift. Undefined unless the group is given one, which leaves\n// the name React Aria gives in the reader's locale.\nconst RemoveLabelContext = createContext<string | undefined>(undefined);\n\n// Whether the group was given `onAction`, which makes every chip in it\n// pressable whether or not it selects. A context for the reason the close\n// target's name is one.\nconst GroupActionContext = createContext(false);\n\n// Hoisted so neither is a new object on every render.\nconst LABEL_STATE_VALID = {\n isInvalid: false\n};\nconst LABEL_STATE_INVALID = {\n isInvalid: true\n};\n\n// The pill of a chip with an action, which a press always reaches.\nfunction actingChipPropsFor(state: TagRenderProps) {\n return chipPropsFor(state, {\n kind: kindOf(state)\n });\n}\n\n/**\n * A labelled set of chips, one or more of which can be chosen, each of which\n * can be removed. Selection is React Aria's: set `selectionMode` to `single`\n * or `multiple` and pass `selectedKeys` with `onSelectionChange` to control\n * it, or `defaultSelectedKeys` to let it keep its own.\n *\n * ```tsx\n * <ChipGroup label=\"Label\" selectionMode=\"multiple\" onRemove={remove}>\n * <ChipGroup.Chip id=\"first\">First item</ChipGroup.Chip>\n * </ChipGroup>\n * ```\n *\n * Give the group `onRemove` and each chip draws a close target. The arrow\n * keys move between chips, so a set of many is one tab stop rather than many.\n *\n * A chip is never wider than its row, so a label with no room ends in an\n * ellipsis rather than wrapping, and shows its full text in the browser's\n * tooltip on hover.\n *\n * Escape on a chip keeps the selection and reaches whatever is around the\n * group, so a group in a Sheet, Dialog or Popover closes it. Pass\n * `escapeKeyBehavior=\"clearSelection\"` for React Aria's own default, which\n * empties the selection on the first press and lets the second through.\n *\n * A chip that toggles nothing else is Chip; this is for a set that shares a\n * value.\n *\n * The call site's `className` and `style` land on the group as a whole,\n * which is the element a layout positions.\n */\nfunction ChipGroup<T extends object = object>({\n children,\n description,\n error,\n escapeKeyBehavior = 'none',\n items,\n label,\n removeLabel,\n renderEmptyState,\n ...props\n}: ChipGroupProps<T> & RefAttributes<HTMLDivElement>) {\n const invalid = invalidFrom(error);\n return <RACTagGroup escapeKeyBehavior={escapeKeyBehavior} {...props} {...mergeStyles(stylex.props(groupStyles.root), props)}>\n {/* React Aria's tag group has no disabled state of its own — a chip is\n disabled through the group's `disabledKeys` — so the label follows\n validity alone. */}\n <FieldLabel state={invalid ? LABEL_STATE_INVALID : LABEL_STATE_VALID} variant=\"group\">\n {label}\n </FieldLabel>\n <RemoveLabelContext value={removeLabel}>\n <GroupActionContext value={props.onAction !== undefined}>\n <RACTagList<T> items={items} renderEmptyState={renderEmptyState} {...stylex.props(styles.list, focus.ring)}>\n {children}\n </RACTagList>\n </GroupActionContext>\n </RemoveLabelContext>\n <FieldMessage description={description} error={error} inset={false} />\n </RACTagGroup>;\n}\n\n/**\n * One chip. Give every chip an `id` — that is the key selection and removal\n * are reported by.\n */\nfunction ChipGroupChip({\n children,\n icon,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n ...props\n}: ChipGroupChipProps & RefAttributes<HTMLDivElement>) {\n const removeLabel = useContext(RemoveLabelContext);\n // An action of its own, a link or the group's makes a chip pressable even\n // in a group that selects nothing, as React Aria treats it.\n const acts = useContext(GroupActionContext) || props.onAction !== undefined || props.href !== undefined;\n // The press ripple a list's rows draw — see ListItem there. A chip in a\n // group is a collection row, whose clicks React Aria keeps for itself, so\n // the press ends when the pointer is released rather than on a click.\n const ripple = useRipple<HTMLDivElement>(true, {\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n }, true);\n return <RACTag textValue={props.textValue ?? textOf(children)} {...ripple.handlers} {...props} {...mergeStatefulStyles(acts ? actingChipPropsFor : groupChipPropsFor, props)}>\n {chipContent(children, icon, removeLabel, ripple.surface, acts)}\n </RACTag>;\n}\n\n// The pill a standalone Chip draws, from `src/chip`, touch target included:\n// every chip's reaches halfway across the gap its rows wrap at. Inert where\n// the group selects nothing and the chip has no action — see the header.\nfunction groupChipPropsFor(state: TagRenderProps) {\n return chipPropsFor(state, {\n inert: state.selectionMode === 'none',\n kind: kindOf(state)\n });\n}\n\n// Which of the page's chips a group's chip is: an input chip once it can be\n// removed, and a filter chip until then, which is what decides whether a\n// selected one lifts under a hovering pointer.\nfunction kindOf(state: TagRenderProps) {\n return state.allowsRemoving ? 'input' : 'filter';\n}\nChipGroup.Chip = ChipGroupChip;\nexport type { ChipGroupChipProps, ChipGroupProps };\nexport { ChipGroupChip };\nexport default ChipGroup;"],"mappings":";;;;;;;;;;;;;;;;;AAmEA,MAAMkB,SAAS,EACbC,MAAM;CACJC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AA8FA,SAASS,YAAYR,UAAqBC,MAAiBM,aAAiCE,SAAoBC,MAAe;CAC7H,QAAQC,UAA0B,qBAAA,YAAA,EAAA,UAAA;EAC7BlC,UAAUkC,OAAOV,MAAMU,MAAMC,kBAAkB,MAAM;EACrDlC,UAAUsB,QAAQ;GACjBU,QAAQC,MAAMC,kBAAkB,WAAW,CAACD,MAAME,aAAa,oBAAC,QAAD;GAAM,GAAIzC,MAAaS,WAAWkC,cAAc;GAAIN,UAAAA;EAAc,CAAA,IAAI;EACtIE,MAAMK,iBAAiB,oBAAC+C,QAAD;GAAW,cAAYxD;GAAa,WAAW3B;GAAqB,MAAK;GAC7F,UAAA,oBAAC,YAAD,EAAY,GAAIR,MAAaS,WAAWoC,WAAW,EAAE,CAAA;EAC5C,CAAA,IAAI;CACnB,EAAA,CAAA;AACJ;AAMA,MAAMC,qBAAqB7C,cAAkC8C,KAAAA,CAAS;AAKtE,MAAMC,qBAAqB/C,cAAc,KAAK;AAG9C,MAAMgD,oBAAoB,EACxBC,WAAW,MACb;AACA,MAAMC,sBAAsB,EAC1BD,WAAW,KACb;AAGA,SAASE,mBAAmBb,OAAuB;CACjD,OAAOhC,aA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GAAe,GAAMtB;GAAK,GAAMuB;GAC9FC,UAAAA;EADS,CAAA;EAEHT,EAAA,MAAAC;EAAAD,EAAA,MAAAf;EAAAe,EAAA,MAAA6B,OAAAC;EAAA9B,EAAA,MAAAM;EAAAN,EAAA,MAAAQ;EAAAR,EAAA,MAAAS;EAAAT,EAAA,MAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,OAFJU;AAEI;AAMb,SAASqB,kBAAkBjD,OAAuB;CAChD,OAAOhC,aAAagC,OAAO;EACzBkD,OAAOlD,MAAMC,kBAAkB;EAC/Ba,MAAMC,OAAOf,KAAK;CACpB,CAAC;AACH;AAKA,SAASe,OAAOf,OAAuB;CACrC,OAAOA,MAAMK,iBAAiB,UAAU;AAC1C;AACAW,UAAUmC,OAAOX"}
1
+ {"version":3,"file":"index.js","names":["_c","stylex","createContext","useContext","RACTag","RACTagGroup","chipGlyph","chipLabel","chipPropsFor","chipRemoveClassName","chipStyles","textOf","invalidFrom","groupStyles","useRipple","focus","mergeStatefulStyles","mergeStyles","styles","list","kGNEyG","kaIpWk","kB7OPa","k1xSpc","kwnvtZ","kOIVth","kAzted","kg3NbH","$$css","children","icon","textValue","description","error","escapeKeyBehavior","label","removeLabel","chipContent","surface","acts","state","selectionMode","isDisabled","props","surfaceCorners","allowsRemoving","removeGlyph","RemoveLabelContext","undefined","GroupActionContext","actingChipPropsFor","kind","kindOf","ChipGroup","t0","$","T0","invalid","items","renderEmptyState","t1","t2","t3","t4","t5","t6","t7","t8","t9","t10","t11","t12","t13","root","onAction","Symbol","for","ring","ChipGroupChip","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","href","ripple","handlers","groupChipPropsFor","inert","Chip","RACButton","RACTagList"],"sources":["../../../src/components/chip-group/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactElement, ReactNode, RefAttributes } from 'react';\nimport type { TagGroupProps as RACTagGroupProps, TagListProps as RACTagListProps, TagProps as RACTagProps, TagRenderProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext } from 'react';\nimport { Button as RACButton, Tag as RACTag, TagGroup as RACTagGroup, TagList as RACTagList } from 'react-aria-components';\nimport { chipGlyph, chipLabel, chipPropsFor, chipRemoveClassName } from '../../chip';\nimport { chipStyles } from '../../chip/styles';\nimport { textOf } from '../../collection/text';\nimport { FieldLabel, FieldMessage } from '../../field';\nimport { invalidFrom } from '../../field/root';\nimport { groupStyles } from '../../field/styles';\nimport { CloseGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { radii, sizing, spacing } from '../../tokens/design.tokens.stylex';\n\n// The chips page's filter and input chips as a set: one or more chosen from a\n// row, each one removable. The pill is the chip module's in `src/chip`,\n// shared with the standalone Chip, so the two cannot drift; what is here is\n// the group around them.\n//\n// Three things it adds over a row of Chips.\n//\n// **It is a group, not a row of buttons.** React Aria's `TagGroup` names the\n// set, describes it, points it at its error, and moves between its chips\n// with the arrow keys rather than making each one a tab stop — which\n// is what a set of a dozen filters needs. The label, the supporting line and\n// the error are the field chrome's, so a group reads like the fields beside\n// it, exactly as CheckboxGroup and RadioGroup do.\n//\n// **A chip can be removed.** Give the group `onRemove` and each chip draws\n// the page's trailing close target, an 18dp glyph in a target of its own so a\n// press there removes rather than toggles. Backspace and Delete remove the\n// focused chip too, which is React Aria's. A chosen chip's check sits at the\n// other end, so a chip that is both selected and removable carries one glyph\n// on each side of its label.\n//\n// **Selection is the group's, not each chip's.** `selectionMode` and\n// `selectedKeys` live on the group, so a set that chooses one of its chips\n// and a set that chooses several are the same component with a different\n// word. A chip on its own that toggles nothing else is still Chip.\n//\n// **Escape leaves the selection alone.** React Aria's collections clear the\n// selection on Escape and stop the key there, which suits a list whose\n// selection is what an action is about to act on. A set of chips holds a\n// value, as a checkbox group does, and usually sits in a Sheet, Dialog or\n// Popover, where Escape is what dismisses it: clearing it there wiped the\n// reader's filters and took a second press to close. So the group passes\n// React Aria's `escapeKeyBehavior` as `none` unless told `clearSelection`.\n//\n// **A chip a press does nothing to does not look pressable.** In a group\n// that selects nothing, a chip with no action of its own or the group's is\n// a control only for its close target. It draws the arrow cursor, no layer\n// and no ripple, and its close target keeps the pointer. A disabled chip's\n// close target takes the chip's `not-allowed` with it.\n//\n// One thing is worth knowing about how this maps onto React Aria. A chip's\n// text value is read off its children and found only when they are a plain\n// string, and a chip here is always an element — the label sits beside a\n// close target. So a plain-string label is passed through as the text value,\n// which is what typeahead and a screen reader's announcement are made of;\n// see ListBox.Item, where the same thing bit.\n\nconst styles = {\n list: {\n kGNEyG: \"x6s0dn4\",\n kaIpWk: \"x1xdvaa9\",\n kB7OPa: \"x9f619\",\n k1xSpc: \"x78zum5\",\n kwnvtZ: \"x1a02dak\",\n kOIVth: \"x126z3so\",\n kAzted: \"xlzjxrf\",\n kg3NbH: \"x91pird xnjsko4\",\n $$css: true\n }\n};\ntype ChipGroupChipProps = {\n /**\n * The chip's label. Text, numbers, or a mix of the two — `Label {3}` —\n * also name the chip; a label holding an element needs `textValue`.\n */\n children?: ReactNode;\n /** A function may compute the class from the chip's render state. */\n className?: RACTagProps['className'];\n /**\n * An icon before the label, in the page's 18dp slot and the primary role.\n * The check takes its place while the chip is chosen, so the chip keeps\n * its width. An icon drawn in `em` takes its size from the slot.\n */\n icon?: ReactNode;\n /** A function may compute the style from the chip's render state. */\n style?: RACTagProps['style'];\n /**\n * The chip's name as text, which is what a screen reader announces for\n * its row. Read from the label when that is text or numbers, so it is\n * needed only when the label holds an element — emphasis, a count in a\n * badge — and React Aria warns in the console when such a chip has none.\n * Given, it wins over the text read from the label.\n */\n textValue?: string;\n} & Omit<RACTagProps, 'children' | 'className' | 'style' | 'textValue'>;\ntype ChipGroupProps<T extends object = object> = {\n /**\n * The chips, each with an `id` of its own. With `items`, a function from an\n * item to its chip, which React Aria calls for each item in turn.\n */\n children?: ((item: T) => ReactElement) | ReactNode;\n /**\n * A hint under the group. Replaced by `error` when there is one, so the\n * two never stack.\n */\n 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 label and the message take the\n * error colour, the grid's `aria-describedby` names the message, and the\n * message is read out politely as it appears. The grid carries no\n * `aria-invalid`, which ARIA does not allow on a grid, so the message is\n * the whole of what a screen reader is told.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * What Escape does on a chip. `none`, the default, keeps the selection and\n * lets the key through to whatever is around the group, so a group in a\n * Sheet, Dialog or Popover closes it on the first press. `clearSelection`\n * empties the selection first, as React Aria's own default does, and lets\n * a second press through.\n *\n * @default 'none'\n */\n escapeKeyBehavior?: 'clearSelection' | 'none';\n /**\n * What the group is for. Required rather than optional: a set of chips\n * with no name is a row a screen reader cannot introduce.\n */\n label: string;\n /**\n * What the close target on each chip is called, for a screen reader. React\n * Aria adds the chip's own label after it, so this is the verb rather than\n * the whole phrase — \"Remove\" becomes \"Remove First item\". Left out, React\n * Aria names it in the reader's locale — \"Remove\" in English.\n */\n removeLabel?: string;\n} & Omit<RACTagGroupProps, 'children' | 'escapeKeyBehavior'> & Pick<RACTagListProps<T>, 'items' | 'renderEmptyState'>;\n\n// What the chip draws, from React Aria's render state. Built by a call rather\n// than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after; the React Compiler memoises the result on\n// its inputs.\n//\n// The check and the icon it replaces are the chip module's, so a chip in a\n// group and a chip on its own draw the same ones. The close target is drawn\n// only where the group allows removing, which React Aria reports rather than\n// the call site saying so on every chip.\n//\n// The ripple is drawn only on a chip a press does something to, and not\n// disabled: one the group lets be selected, or one with an action, its own\n// or the group's. Any other chip in a group that selects nothing is a\n// control only for its close target, and React Aria reports neither hover\n// nor press on it, so a ripple there would answer a press that changes\n// nothing. `acts` is the action half, which the render state does not carry.\n//\n// It sits in a box of its own carrying the chip's corner, since React Aria's\n// cell between the chip and this content would otherwise hand the ripple a\n// square one to inherit; see the header of src/chip/styles.ts.\nfunction chipContent(children: ReactNode, icon: ReactNode, removeLabel: string | undefined, surface: ReactNode, acts: boolean) {\n return (state: TagRenderProps) => <>\n {chipGlyph(state, icon, state.selectionMode !== 'none')}\n {chipLabel(children)}\n {(acts || state.selectionMode !== 'none') && !state.isDisabled ? <span {...stylex.props(chipStyles.surfaceCorners)}>{surface}</span> : null}\n {state.allowsRemoving ? <RACButton aria-label={removeLabel} className={chipRemoveClassName} slot=\"remove\">\n <CloseGlyph {...stylex.props(chipStyles.removeGlyph)} />\n </RACButton> : null}\n </>;\n}\n\n// What each chip calls its close target. A context rather than a prop on the\n// chip, since it is the group's decision and repeating it on every chip is\n// how the two drift. Undefined unless the group is given one, which leaves\n// the name React Aria gives in the reader's locale.\nconst RemoveLabelContext = createContext<string | undefined>(undefined);\n\n// Whether the group was given `onAction`, which makes every chip in it\n// pressable whether or not it selects. A context for the reason the close\n// target's name is one.\nconst GroupActionContext = createContext(false);\n\n// The pill of a chip with an action, which a press always reaches.\nfunction actingChipPropsFor(state: TagRenderProps) {\n return chipPropsFor(state, {\n kind: kindOf(state)\n });\n}\n\n/**\n * A labelled set of chips, one or more of which can be chosen, each of which\n * can be removed. Selection is React Aria's: set `selectionMode` to `single`\n * or `multiple` and pass `selectedKeys` with `onSelectionChange` to control\n * it, or `defaultSelectedKeys` to let it keep its own.\n *\n * ```tsx\n * <ChipGroup label=\"Label\" selectionMode=\"multiple\" onRemove={remove}>\n * <ChipGroup.Chip id=\"first\">First item</ChipGroup.Chip>\n * </ChipGroup>\n * ```\n *\n * Give the group `onRemove` and each chip draws a close target. The arrow\n * keys move between chips, so a set of many is one tab stop rather than many.\n *\n * A chip is never wider than its row, so a label with no room ends in an\n * ellipsis rather than wrapping, and shows its full text in the browser's\n * tooltip on hover.\n *\n * Escape on a chip keeps the selection and reaches whatever is around the\n * group, so a group in a Sheet, Dialog or Popover closes it. Pass\n * `escapeKeyBehavior=\"clearSelection\"` for React Aria's own default, which\n * empties the selection on the first press and lets the second through.\n *\n * A chip that toggles nothing else is Chip; this is for a set that shares a\n * value.\n *\n * The call site's `className` and `style` land on the group as a whole,\n * which is the element a layout positions.\n */\nfunction ChipGroup<T extends object = object>({\n children,\n description,\n error,\n escapeKeyBehavior = 'none',\n items,\n label,\n removeLabel,\n renderEmptyState,\n ...props\n}: ChipGroupProps<T> & RefAttributes<HTMLDivElement>) {\n const invalid = invalidFrom(error);\n return <RACTagGroup escapeKeyBehavior={escapeKeyBehavior} {...props} {...mergeStyles(stylex.props(groupStyles.root), props)}>\n {/* React Aria's tag group has no disabled state of its own — a chip is\n disabled through the group's `disabledKeys` — so the label follows\n validity alone. */}\n <FieldLabel isInvalid={invalid} variant=\"group\">\n {label}\n </FieldLabel>\n <RemoveLabelContext value={removeLabel}>\n <GroupActionContext value={props.onAction !== undefined}>\n <RACTagList<T> items={items} renderEmptyState={renderEmptyState} {...stylex.props(styles.list, focus.ring)}>\n {children}\n </RACTagList>\n </GroupActionContext>\n </RemoveLabelContext>\n <FieldMessage description={description} error={error} inset={false} />\n </RACTagGroup>;\n}\n\n/**\n * One chip. Give every chip an `id` — that is the key selection and removal\n * are reported by.\n */\nfunction ChipGroupChip({\n children,\n icon,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n ...props\n}: ChipGroupChipProps & RefAttributes<HTMLDivElement>) {\n const removeLabel = useContext(RemoveLabelContext);\n // An action of its own, a link or the group's makes a chip pressable even\n // in a group that selects nothing, as React Aria treats it.\n const acts = useContext(GroupActionContext) || props.onAction !== undefined || props.href !== undefined;\n // The press ripple a list's rows draw — see ListItem there. A chip in a\n // group is a collection row, whose clicks React Aria keeps for itself, so\n // the press ends when the pointer is released rather than on a click.\n const ripple = useRipple<HTMLDivElement>(true, {\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n }, true);\n return <RACTag textValue={props.textValue ?? textOf(children)} {...ripple.handlers} {...props} {...mergeStatefulStyles(acts ? actingChipPropsFor : groupChipPropsFor, props)}>\n {chipContent(children, icon, removeLabel, ripple.surface, acts)}\n </RACTag>;\n}\n\n// The pill a standalone Chip draws, from `src/chip`, touch target included:\n// every chip's reaches halfway across the gap its rows wrap at. Inert where\n// the group selects nothing and the chip has no action — see the header.\nfunction groupChipPropsFor(state: TagRenderProps) {\n return chipPropsFor(state, {\n inert: state.selectionMode === 'none',\n kind: kindOf(state)\n });\n}\n\n// Which of the page's chips a group's chip is: an input chip once it can be\n// removed, and a filter chip until then, which is what decides whether a\n// selected one lifts under a hovering pointer.\nfunction kindOf(state: TagRenderProps) {\n return state.allowsRemoving ? 'input' : 'filter';\n}\nChipGroup.Chip = ChipGroupChip;\nexport type { ChipGroupChipProps, ChipGroupProps };\nexport { ChipGroupChip };\nexport default ChipGroup;"],"mappings":";;;;;;;;;;;;;;;;;AAmEA,MAAMkB,SAAS,EACbC,MAAM;CACJC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AA8FA,SAASS,YAAYR,UAAqBC,MAAiBM,aAAiCE,SAAoBC,MAAe;CAC7H,QAAQC,UAA0B,qBAAA,YAAA,EAAA,UAAA;EAC7BlC,UAAUkC,OAAOV,MAAMU,MAAMC,kBAAkB,MAAM;EACrDlC,UAAUsB,QAAQ;GACjBU,QAAQC,MAAMC,kBAAkB,WAAW,CAACD,MAAME,aAAa,oBAAC,QAAD;GAAM,GAAIzC,MAAaS,WAAWkC,cAAc;GAAIN,UAAAA;EAAc,CAAA,IAAI;EACtIE,MAAMK,iBAAiB,oBAAC6C,QAAD;GAAW,cAAYtD;GAAa,WAAW3B;GAAqB,MAAK;GAC7F,UAAA,oBAAC,YAAD,EAAY,GAAIR,MAAaS,WAAWoC,WAAW,EAAE,CAAA;EAC5C,CAA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iB,EAAA,MAAAS;CAAA,OAAAA,KAAAT,EAAA;CAAA,IAAAU;CAAA,IAAAV,EAAA,QAAAC,MAAAD,EAAA,QAAAZ,SAAAY,EAAA,QAAA8B,OAAAC,YAAA/B,EAAA,QAAAM,MAAAN,EAAA,QAAAQ,MAAAR,EAAA,QAAAS,IAAA;EAD5DC,KAAA,oBAAC,IAAD;GAAmB,WAAAJ;GAAmC,GAAMC;GAAe,GAAMnB;GAAK,GAAMoB;GAC9FC,UAAAA;EADS,CAAA;EAEHT,EAAA,MAAAC;EAAAD,EAAA,MAAAZ;EAAAY,EAAA,MAAA8B,OAAAC;EAAA/B,EAAA,MAAAM;EAAAN,EAAA,MAAAQ;EAAAR,EAAA,MAAAS;EAAAT,EAAA,MAAAU;CAAA,OAAAA,KAAAV,EAAA;CAAA,OAFJU;AAEI;AAMb,SAASsB,kBAAkB/C,OAAuB;CAChD,OAAOhC,aAAagC,OAAO;EACzBgD,OAAOhD,MAAMC,kBAAkB;EAC/BU,MAAMC,OAAOZ,KAAK;CACpB,CAAC;AACH;AAKA,SAASY,OAAOZ,OAAuB;CACrC,OAAOA,MAAMK,iBAAiB,UAAU;AAC1C;AACAQ,UAAUoC,OAAOX"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
+ import { c } from "react/compiler-runtime";
2
3
  import { useRender } from "../../render/useRender.js";
3
4
  import { mergeStyles } from "../../styles/merge.js";
4
- import { c } from "react/compiler-runtime";
5
5
  // src/components/code/index.tsx
6
6
  /**
7
7
  * A fragment of code, a path, or an identifier set in the mono face. It
@@ -1,9 +1,9 @@
1
1
  "use client";
2
+ import { c } from "react/compiler-runtime";
3
+ import { ColorArea as ColorArea$1, ColorThumb } from "react-aria-components";
2
4
  import { thumbClassName } from "../../styles/color.js";
3
5
  import { mergeStyles } from "../../styles/merge.js";
4
- import { c } from "react/compiler-runtime";
5
6
  import { jsx } from "react/jsx-runtime";
6
- import { ColorArea as ColorArea$1, ColorThumb } from "react-aria-components";
7
7
  // src/components/color-area/index.tsx
8
8
  /**
9
9
  * Two channels of a colour as a plane, with a handle where they meet. The
@@ -1,6 +1,6 @@
1
- import { FieldVariant } from "../../field/index.js";
2
1
  import { ReactNode, Ref, RefAttributes } from "react";
3
2
  import { ColorFieldProps as ColorFieldProps$1 } from "react-aria-components";
3
+ import { FieldVariant } from "../../field/index.js";
4
4
  type ColorFieldProps = {
5
5
  /** A function may compute the class from the field's render state. */
6
6
  className?: ColorFieldProps$1['className'];
@@ -1,11 +1,11 @@
1
1
  "use client";
2
+ import { c } from "react/compiler-runtime";
2
3
  import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
4
+ import { ColorField as ColorField$1 } from "react-aria-components";
3
5
  import { FieldBox, FieldInput, FieldMessage } from "../../field/index.js";
4
6
  import { fieldStyles, invalidFrom, useFieldValidationBehavior } from "../../field/root.js";
5
7
  import { mergeStatefulStyles } from "../../styles/merge.js";
6
- import { c } from "react/compiler-runtime";
7
8
  import { jsx, jsxs } from "react/jsx-runtime";
8
- import { ColorField as ColorField$1 } from "react-aria-components";
9
9
  // src/components/color-field/index.tsx
10
10
  /**
11
11
  * A colour typed into a field. The value is React Aria's — pass `value` with
@@ -1,5 +1,7 @@
1
1
  "use client";
2
+ import { c } from "react/compiler-runtime";
2
3
  import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
4
+ import { Button, ColorPicker as ColorPicker$1, Dialog, DialogTrigger, Popover, parseColor, useLocale } from "react-aria-components";
3
5
  import { focus } from "../../styles/focus.js";
4
6
  import { mergeStatefulStyles } from "../../styles/merge.js";
5
7
  import { overlay } from "../../styles/overlay.js";
@@ -9,9 +11,7 @@ import ColorArea$1 from "../color-area/index.js";
9
11
  import ColorField$1 from "../color-field/index.js";
10
12
  import ColorSlider$1 from "../color-slider/index.js";
11
13
  import ColorSwatch$1 from "../color-swatch/index.js";
12
- import { c } from "react/compiler-runtime";
13
14
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
- import { Button, ColorPicker as ColorPicker$1, Dialog, DialogTrigger, Popover, parseColor, useLocale } from "react-aria-components";
15
15
  // src/components/color-picker/index.tsx
16
16
  const styles = {
17
17
  triggerSwatch: {
@@ -1,14 +1,14 @@
1
1
  "use client";
2
+ import { c } from "react/compiler-runtime";
2
3
  import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
4
+ import { useContext } from "react";
5
+ import { ColorSlider as ColorSlider$1, ColorSliderStateContext, ColorThumb, SliderOutput, SliderTrack, useLocale } from "react-aria-components";
3
6
  import { FieldLabel } from "../../field/index.js";
4
7
  import { groupStyles } from "../../field/styles.js";
5
8
  import { chequer } from "../../styles/chequer.js";
6
9
  import { thumbClassName, verticalThumbClassName } from "../../styles/color.js";
7
10
  import { mergeStatefulStyles } from "../../styles/merge.js";
8
- import { c } from "react/compiler-runtime";
9
- import { useContext } from "react";
10
11
  import { jsx, jsxs } from "react/jsx-runtime";
11
- import { ColorSlider as ColorSlider$1, ColorSliderStateContext, ColorThumb, SliderOutput, SliderTrack, useLocale } from "react-aria-components";
12
12
  // src/components/color-slider/index.tsx
13
13
  const styles = {
14
14
  root: {
@@ -1,12 +1,12 @@
1
1
  "use client";
2
+ import { c } from "react/compiler-runtime";
2
3
  import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
4
+ import { useContext } from "react";
5
+ import { ColorSwatch as ColorSwatch$1 } from "react-aria-components";
3
6
  import { chequer } from "../../styles/chequer.js";
4
7
  import { mergeStyles } from "../../styles/merge.js";
5
8
  import { SwatchSquareContext } from "../../swatch/index.js";
6
- import { c } from "react/compiler-runtime";
7
- import { useContext } from "react";
8
9
  import { jsx } from "react/jsx-runtime";
9
- import { ColorSwatch as ColorSwatch$1 } from "react-aria-components";
10
10
  // src/components/color-swatch/index.tsx
11
11
  const styles = { ground: {
12
12
  kZKoxP: "x1vqgdyp",
@@ -1,12 +1,12 @@
1
1
  "use client";
2
+ import { c } from "react/compiler-runtime";
2
3
  import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
4
+ import { ColorSwatchPicker as ColorSwatchPicker$1, ColorSwatchPickerItem as ColorSwatchPickerItem$1 } from "react-aria-components";
3
5
  import { focus } from "../../styles/focus.js";
4
6
  import { mergeStatefulStyles } from "../../styles/merge.js";
5
7
  import { colors } from "../../tokens/design.tokens.stylex.js";
6
8
  import ColorSwatch$1 from "../color-swatch/index.js";
7
- import { c } from "react/compiler-runtime";
8
9
  import { jsx } from "react/jsx-runtime";
9
- import { ColorSwatchPicker as ColorSwatchPicker$1, ColorSwatchPickerItem as ColorSwatchPickerItem$1 } from "react-aria-components";
10
10
  // src/components/color-swatch-picker/index.tsx
11
11
  `${colors.surface}${colors.onSurface}${colors.surface}`;
12
12
  const styles = {
@@ -42,6 +42,7 @@ const styles = {
42
42
  },
43
43
  itemFocused: {
44
44
  kInvED: "x8wkva7",
45
+ kMeerF: "x1de99jn",
45
46
  $$css: true
46
47
  },
47
48
  itemHovered: {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_c","stylex","ColorSwatchPicker","ColorSwatchPickerItem","RACColorSwatchPickerItem","focus","mergeStatefulStyles","colors","surface","onSurface","styles","item","kUfP38","kbwMcY","kPGmMm","kWgvks","k5JduY","kv0HGH","kloYau","kwXMNM","kaIpWk","kB7OPa","kkrTdU","k1xSpc","k3XXqK","kVAEAm","$$css","itemDisabled","k3DiCg","kPB484","kQmYQc","kgeoSG","ku0W4C","kFcpXp","km8f2m","kEoFBp","kxmVGU","itemFocused","kInvED","itemHovered","kXtpa","itemPressed","itemSelected","children","className","props","$","t0","t1","T0","t2","t3","itemStyles","state","0","1","isDisabled","t4","isFocusVisible","isHovered","isPressed","isSelected","ringVisible","Item","RACColorSwatchPicker","ColorSwatch"],"sources":["../../../src/components/color-swatch-picker/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { ColorSwatchPickerItemProps as RACColorSwatchPickerItemProps, ColorSwatchPickerProps as RACColorSwatchPickerProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ColorSwatchPicker as RACColorSwatchPicker, ColorSwatchPickerItem as RACColorSwatchPickerItem } from 'react-aria-components';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\nimport ColorSwatch from '../color-swatch';\n\n// A row of colours to choose one from. React Aria makes it a listbox of\n// swatches, so it is a selection control rather than a palette: arrow keys\n// move between colours and one of them is selected.\n//\n// The design carries no page for this either, so what an item looks like\n// when it is chosen is the library's own. Three choices, each with its\n// reason.\n//\n// **Selection is a ring around the swatch, not a mark on it.** A tick drawn\n// over a colour has to be readable against every colour in the row, which no\n// single ink is; a ring sits outside the swatch and needs only to read\n// against the surface behind it.\n//\n// **The ring is 3px of on-surface, and offset.** It sits 2px out from the\n// swatch so the colour stays whole — a ring drawn on the swatch would eat\n// pixels of the thing being chosen. It is not the focus ring's colour or\n// weight on purpose: the arrow keys move focus without choosing, so one\n// swatch is chosen while another is focused, and when both rings were 2px of\n// primary only their distance from the swatch told them apart. Focus keeps\n// the library's ring, the one every other control draws, so the selection\n// ring is the one that differs, heavier and in on-surface.\n//\n// **Focus and selection are drawn by different properties.** An element has\n// one outline, so with both drawn in it the second replaced the first, and a\n// keyboard arrowing onto the chosen colour saw a swatch that looked\n// unchosen. The focus ring is the item's outline, 6px out; the selection\n// ring is a border on a box laid 5px around the swatch, inside it, with 1px\n// clear between the two. Both are properties forced colours keep, which a\n// box shadow is not, and there the difference in weight is what is left.\n//\n// **Hover and press are a ring too, in the slot selection would take.** Every\n// other interactive element here answers the pointer with a state layer, but\n// a state layer is a fill and a swatch's fill is the colour being chosen:\n// behind it the tint is hidden, over it the tint changes the colour. So an\n// unselected swatch under the pointer takes a ring at the selection ring's\n// outer edge, 2px wide and in the outline roles, so it cannot be read\n// as chosen — outline variant while a pointer is over it, and outline while a\n// touch or a pen holds it. Those are the only presses anyone sees: React Aria\n// chooses a swatch the moment a mouse or a key presses it, and on release for\n// a touch, so that press is the one a reader waits through before the swatch\n// is theirs. Under forced colours both roles become one system colour, so the\n// ring turns dashed there, where the selection ring stays solid.\n//\n// **A colour that cannot be chosen is struck through, as well as faded.**\n// Faded alone it read as a paler colour, and a pale colour is as good an\n// option as any. The slash is drawn over the swatch, where the first choice\n// says no single ink reads against every colour, so it is two: an on-surface\n// line edged in surface, and whichever of the two the colour beneath is\n// nearer to, the other reads against it. The fade is on the item's contents\n// rather than the item, so the slash over them keeps its full strength.\n\nconst FORCED_COLORS = '@media (forced-colors: active)';\n\n// The slash, corner to corner across a square: a 2px line of ink with 1.5px\n// of edge either side, measured across the line rather than along the\n// square's side. Written out twice, once per pair of colours, since StyleX\n// evaluates a constant but not a function building one.\nconst SLASH = `linear-gradient(to top right, transparent calc(50% - 2.5px), ${colors.surface} calc(50% - 2.5px) calc(50% - 1px), ${colors.onSurface} calc(50% - 1px) calc(50% + 1px), ${colors.surface} calc(50% + 1px) calc(50% + 2.5px), transparent calc(50% + 2.5px))`;\nconst SLASH_FORCED = 'linear-gradient(to top right, transparent calc(50% - 2.5px), Canvas calc(50% - 2.5px) calc(50% - 1px), GrayText calc(50% - 1px) calc(50% + 1px), Canvas calc(50% + 1px) calc(50% + 2.5px), transparent calc(50% + 2.5px))';\nconst styles = {\n item: {\n kUfP38: \"xdzrvcx\",\n kbwMcY: \"x1v5kskh\",\n kPGmMm: \"x1941vk7\",\n kWgvks: \"xx38sju\",\n k5JduY: \"x1s928wv\",\n kv0HGH: \"xzkkzs7\",\n kloYau: \"x2q1x1w\",\n kwXMNM: \"x1j6awrg\",\n kaIpWk: \"x1tfhd1\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n k3XXqK: \"x1t137rt\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n itemDisabled: {\n k3DiCg: \"xkqgyyi x1vz15c4\",\n kPB484: \"x13uuyx9\",\n kQmYQc: \"xtql2tq\",\n kgeoSG: \"x1cpjm7i\",\n ku0W4C: \"x13rwrtk\",\n kFcpXp: \"xxx281p\",\n km8f2m: \"xkk1bqk\",\n kEoFBp: \"x1hmns74\",\n kxmVGU: \"x12maryy\",\n kkrTdU: \"xt0e3qv\",\n $$css: true\n },\n itemFocused: {\n kInvED: \"x8wkva7\",\n $$css: true\n },\n itemHovered: {\n kXtpa: \"x1ek9lwj\",\n kbwMcY: \"x86avzo xssfeg4\",\n $$css: true\n },\n itemPressed: {\n kXtpa: \"xrwozs3\",\n kbwMcY: \"x86avzo xssfeg4\",\n $$css: true\n },\n itemSelected: {\n kXtpa: \"xmi6dwc\",\n kbwMcY: \"x86avzo\",\n kPGmMm: \"x14wq4lv\",\n $$css: true\n }\n};\ntype ColorSwatchPickerItemProps = Omit<RACColorSwatchPickerItemProps, 'children' | 'className' | 'style'> & {\n /** What the item draws. A `ColorSwatch` with no `color` of its own by default. */\n children?: ReactNode;\n /** A function may compute the class from the item's render state. */\n className?: RACColorSwatchPickerItemProps['className'];\n /** A function may compute the style from the item's render state. */\n style?: RACColorSwatchPickerItemProps['style'];\n};\ntype ColorSwatchPickerProps = Omit<RACColorSwatchPickerProps, 'className' | 'style'> & {\n /** A function may compute the class from the picker's render state. */\n className?: RACColorSwatchPickerProps['className'];\n /** A function may compute the style from the picker's render state. */\n style?: RACColorSwatchPickerProps['style'];\n};\n\n/**\n * A row of colours to choose one from, drawn as swatches. The value is React\n * Aria's — pass `value` with `onChange` to control it, or `defaultValue` —\n * as a CSS colour string or a `Color` from `parseColor`, which this package\n * re-exports.\n *\n * ```tsx\n * <ColorSwatchPicker defaultValue=\"#6750A4\">\n * <ColorSwatchPicker.Item color=\"#6750A4\" />\n * <ColorSwatchPicker.Item color=\"#625B71\" />\n * </ColorSwatchPicker>\n * ```\n *\n * It is a listbox, so arrow keys move between colours and the chosen one\n * carries a ring. Name it with `aria-label` or `aria-labelledby`; React Aria\n * calls it \"Color swatches\" otherwise.\n *\n * The call site's `className` and `style` land on the picker, which is the\n * element a layout positions.\n */\nfunction ColorSwatchPicker(props: ColorSwatchPickerProps & RefAttributes<HTMLDivElement>) {\n return <RACColorSwatchPicker {...props} {...mergeStatefulStyles({\n className: \"x9f619 x78zum5 x1a02dak x126z3so x1t137rt\"\n }, props)} />;\n}\n\n/**\n * One swatch in a {@link ColorSwatchPicker}. Renders a `ColorSwatch` of its\n * own `color` unless given different children.\n */\nfunction ColorSwatchPickerItem({\n children,\n ...props\n}: ColorSwatchPickerItemProps & RefAttributes<HTMLDivElement>) {\n return <RACColorSwatchPickerItem {...props} {...mergeStatefulStyles(itemStyles, props)}>\n {state => <span {...{\n 0: {\n className: \"x9f619 x3nfvp2\"\n },\n 1: {\n className: \"x9f619 x3nfvp2 x1ppv7y9\"\n }\n }[!!state.isDisabled << 0]}>\n {children ?? <ColorSwatch />}\n </span>}\n </RACColorSwatchPickerItem>;\n}\n\n// The item's styles, from React Aria's render state. StyleX cannot target\n// `[data-selected]` on the element it is styling, so the state comes from\n// what React Aria hands the className.\n//\n// The order matters where two styles draw on one property. The hover and\n// press rings come before `selected`, which draws on the same border, so a\n// chosen swatch keeps the ring that says so. Focus is the library's ring and\n// then `focused`, which moves it out; both draw on the outline, which\n// nothing else touches but the item's resting `none`, so a swatch that is\n// chosen and focused keeps both. `disabled` is last, so it takes the cursor\n// with it, and draws the slash; React Aria reports neither hover nor press\n// on one.\nfunction itemStyles(state: {\n isDisabled: boolean;\n isFocusVisible: boolean;\n isHovered: boolean;\n isPressed: boolean;\n isSelected: boolean;\n}) {\n return stylex.props(styles.item, state.isHovered && styles.itemHovered, state.isPressed && styles.itemPressed, state.isSelected && styles.itemSelected, state.isFocusVisible && [focus.ringVisible, styles.itemFocused], state.isDisabled && styles.itemDisabled);\n}\nColorSwatchPicker.Item = ColorSwatchPickerItem;\nexport type { ColorSwatchPickerItemProps, ColorSwatchPickerProps };\nexport { ColorSwatchPicker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6B,aAAac,MAAMO,aAAalD,OAAO+B,aAAaY,MAAMQ,cAAcnD,OAAOgC,cAAcW,MAAMK,kBAAkB,CAACrD,MAAMyD,aAAapD,OAAO2B,WAAW,GAAGgB,MAAMG,cAAc9C,OAAOiB,YAAY;AAClQ;AACAzB,kBAAkB6D,OAAO5D"}
1
+ {"version":3,"file":"index.js","names":["_c","stylex","ColorSwatchPicker","ColorSwatchPickerItem","RACColorSwatchPickerItem","focus","mergeStatefulStyles","colors","surface","onSurface","styles","item","kUfP38","kbwMcY","kPGmMm","kWgvks","k5JduY","kv0HGH","kloYau","kwXMNM","kaIpWk","kB7OPa","kkrTdU","k1xSpc","k3XXqK","kVAEAm","$$css","itemDisabled","k3DiCg","kPB484","kQmYQc","kgeoSG","ku0W4C","kFcpXp","km8f2m","kEoFBp","kxmVGU","itemFocused","kInvED","kMeerF","itemHovered","kXtpa","itemPressed","itemSelected","children","className","props","$","t0","t1","T0","t2","t3","itemStyles","state","0","1","isDisabled","t4","isFocusVisible","isHovered","isPressed","isSelected","ringVisible","Item","RACColorSwatchPicker","ColorSwatch"],"sources":["../../../src/components/color-swatch-picker/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { ColorSwatchPickerItemProps as RACColorSwatchPickerItemProps, ColorSwatchPickerProps as RACColorSwatchPickerProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { ColorSwatchPicker as RACColorSwatchPicker, ColorSwatchPickerItem as RACColorSwatchPickerItem } from 'react-aria-components';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, radii, spacing, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\nimport ColorSwatch from '../color-swatch';\n\n// A row of colours to choose one from. React Aria makes it a listbox of\n// swatches, so it is a selection control rather than a palette: arrow keys\n// move between colours and one of them is selected.\n//\n// The design carries no page for this either, so what an item looks like\n// when it is chosen is the library's own. Three choices, each with its\n// reason.\n//\n// **Selection is a ring around the swatch, not a mark on it.** A tick drawn\n// over a colour has to be readable against every colour in the row, which no\n// single ink is; a ring sits outside the swatch and needs only to read\n// against the surface behind it.\n//\n// **The ring is 3px of on-surface, and offset.** It sits 2px out from the\n// swatch so the colour stays whole — a ring drawn on the swatch would eat\n// pixels of the thing being chosen. It is not the focus ring's colour or\n// weight on purpose: the arrow keys move focus without choosing, so one\n// swatch is chosen while another is focused, and when both rings were 2px of\n// primary only their distance from the swatch told them apart. Focus takes\n// the library's ring in its secondary role, so the two differ in colour.\n// They differ in weight too, and that is the one place a swatch's focus ring\n// departs from the library's 3dp: it stays at 2px, lighter than the\n// selection ring, since under forced colours both rings take system colours\n// and the weight is what is left to tell them apart. Drawn at 3px, the two\n// would differ there only in their distance from the swatch, which is what\n// the 2px rings of primary did.\n//\n// **Focus and selection are drawn by different properties.** An element has\n// one outline, so with both drawn in it the second replaced the first, and a\n// keyboard arrowing onto the chosen colour saw a swatch that looked\n// unchosen. The focus ring is the item's outline, 6px out; the selection\n// ring is a border on a box laid 5px around the swatch, inside it, with 1px\n// clear between the two. Both are properties forced colours keep, which a\n// box shadow is not, and there the difference in weight is what is left.\n//\n// **Hover and press are a ring too, in the slot selection would take.** Every\n// other interactive element here answers the pointer with a state layer, but\n// a state layer is a fill and a swatch's fill is the colour being chosen:\n// behind it the tint is hidden, over it the tint changes the colour. So an\n// unselected swatch under the pointer takes a ring at the selection ring's\n// outer edge, 2px wide and in the outline roles, so it cannot be read\n// as chosen — outline variant while a pointer is over it, and outline while a\n// touch or a pen holds it. Those are the only presses anyone sees: React Aria\n// chooses a swatch the moment a mouse or a key presses it, and on release for\n// a touch, so that press is the one a reader waits through before the swatch\n// is theirs. Under forced colours both roles become one system colour, so the\n// ring turns dashed there, where the selection ring stays solid.\n//\n// **A colour that cannot be chosen is struck through, as well as faded.**\n// Faded alone it read as a paler colour, and a pale colour is as good an\n// option as any. The slash is drawn over the swatch, where the first choice\n// says no single ink reads against every colour, so it is two: an on-surface\n// line edged in surface, and whichever of the two the colour beneath is\n// nearer to, the other reads against it. The fade is on the item's contents\n// rather than the item, so the slash over them keeps its full strength.\n\nconst FORCED_COLORS = '@media (forced-colors: active)';\n\n// The slash, corner to corner across a square: a 2px line of ink with 1.5px\n// of edge either side, measured across the line rather than along the\n// square's side. Written out twice, once per pair of colours, since StyleX\n// evaluates a constant but not a function building one.\nconst SLASH = `linear-gradient(to top right, transparent calc(50% - 2.5px), ${colors.surface} calc(50% - 2.5px) calc(50% - 1px), ${colors.onSurface} calc(50% - 1px) calc(50% + 1px), ${colors.surface} calc(50% + 1px) calc(50% + 2.5px), transparent calc(50% + 2.5px))`;\nconst SLASH_FORCED = 'linear-gradient(to top right, transparent calc(50% - 2.5px), Canvas calc(50% - 2.5px) calc(50% - 1px), GrayText calc(50% - 1px) calc(50% + 1px), Canvas calc(50% + 1px) calc(50% + 2.5px), transparent calc(50% + 2.5px))';\nconst styles = {\n item: {\n kUfP38: \"xdzrvcx\",\n kbwMcY: \"x1v5kskh\",\n kPGmMm: \"x1941vk7\",\n kWgvks: \"xx38sju\",\n k5JduY: \"x1s928wv\",\n kv0HGH: \"xzkkzs7\",\n kloYau: \"x2q1x1w\",\n kwXMNM: \"x1j6awrg\",\n kaIpWk: \"x1tfhd1\",\n kB7OPa: \"x9f619\",\n kkrTdU: \"x1ypdohk\",\n k1xSpc: \"x3nfvp2\",\n k3XXqK: \"x1t137rt\",\n kVAEAm: \"x1n2onr6\",\n $$css: true\n },\n itemDisabled: {\n k3DiCg: \"xkqgyyi x1vz15c4\",\n kPB484: \"x13uuyx9\",\n kQmYQc: \"xtql2tq\",\n kgeoSG: \"x1cpjm7i\",\n ku0W4C: \"x13rwrtk\",\n kFcpXp: \"xxx281p\",\n km8f2m: \"xkk1bqk\",\n kEoFBp: \"x1hmns74\",\n kxmVGU: \"x12maryy\",\n kkrTdU: \"xt0e3qv\",\n $$css: true\n },\n itemFocused: {\n kInvED: \"x8wkva7\",\n kMeerF: \"x1de99jn\",\n $$css: true\n },\n itemHovered: {\n kXtpa: \"x1ek9lwj\",\n kbwMcY: \"x86avzo xssfeg4\",\n $$css: true\n },\n itemPressed: {\n kXtpa: \"xrwozs3\",\n kbwMcY: \"x86avzo xssfeg4\",\n $$css: true\n },\n itemSelected: {\n kXtpa: \"xmi6dwc\",\n kbwMcY: \"x86avzo\",\n kPGmMm: \"x14wq4lv\",\n $$css: true\n }\n};\ntype ColorSwatchPickerItemProps = Omit<RACColorSwatchPickerItemProps, 'children' | 'className' | 'style'> & {\n /** What the item draws. A `ColorSwatch` with no `color` of its own by default. */\n children?: ReactNode;\n /** A function may compute the class from the item's render state. */\n className?: RACColorSwatchPickerItemProps['className'];\n /** A function may compute the style from the item's render state. */\n style?: RACColorSwatchPickerItemProps['style'];\n};\ntype ColorSwatchPickerProps = Omit<RACColorSwatchPickerProps, 'className' | 'style'> & {\n /** A function may compute the class from the picker's render state. */\n className?: RACColorSwatchPickerProps['className'];\n /** A function may compute the style from the picker's render state. */\n style?: RACColorSwatchPickerProps['style'];\n};\n\n/**\n * A row of colours to choose one from, drawn as swatches. The value is React\n * Aria's — pass `value` with `onChange` to control it, or `defaultValue` —\n * as a CSS colour string or a `Color` from `parseColor`, which this package\n * re-exports.\n *\n * ```tsx\n * <ColorSwatchPicker defaultValue=\"#6750A4\">\n * <ColorSwatchPicker.Item color=\"#6750A4\" />\n * <ColorSwatchPicker.Item color=\"#625B71\" />\n * </ColorSwatchPicker>\n * ```\n *\n * It is a listbox, so arrow keys move between colours and the chosen one\n * carries a ring. Name it with `aria-label` or `aria-labelledby`; React Aria\n * calls it \"Color swatches\" otherwise.\n *\n * The call site's `className` and `style` land on the picker, which is the\n * element a layout positions.\n */\nfunction ColorSwatchPicker(props: ColorSwatchPickerProps & RefAttributes<HTMLDivElement>) {\n return <RACColorSwatchPicker {...props} {...mergeStatefulStyles({\n className: \"x9f619 x78zum5 x1a02dak x126z3so x1t137rt\"\n }, props)} />;\n}\n\n/**\n * One swatch in a {@link ColorSwatchPicker}. Renders a `ColorSwatch` of its\n * own `color` unless given different children.\n */\nfunction ColorSwatchPickerItem({\n children,\n ...props\n}: ColorSwatchPickerItemProps & RefAttributes<HTMLDivElement>) {\n return <RACColorSwatchPickerItem {...props} {...mergeStatefulStyles(itemStyles, props)}>\n {state => <span {...{\n 0: {\n className: \"x9f619 x3nfvp2\"\n },\n 1: {\n className: \"x9f619 x3nfvp2 x1ppv7y9\"\n }\n }[!!state.isDisabled << 0]}>\n {children ?? <ColorSwatch />}\n </span>}\n </RACColorSwatchPickerItem>;\n}\n\n// The item's styles, from React Aria's render state. StyleX cannot target\n// `[data-selected]` on the element it is styling, so the state comes from\n// what React Aria hands the className.\n//\n// The order matters where two styles draw on one property. The hover and\n// press rings come before `selected`, which draws on the same border, so a\n// chosen swatch keeps the ring that says so. Focus is the library's ring and\n// then `focused`, which moves it out; both draw on the outline, which\n// nothing else touches but the item's resting `none`, so a swatch that is\n// chosen and focused keeps both. `disabled` is last, so it takes the cursor\n// with it, and draws the slash; React Aria reports neither hover nor press\n// on one.\nfunction itemStyles(state: {\n isDisabled: boolean;\n isFocusVisible: boolean;\n isHovered: boolean;\n isPressed: boolean;\n isSelected: boolean;\n}) {\n return stylex.props(styles.item, state.isHovered && styles.itemHovered, state.isPressed && styles.itemPressed, state.isSelected && styles.itemSelected, state.isFocusVisible && [focus.ringVisible, styles.itemFocused], state.isDisabled && styles.itemDisabled);\n}\nColorSwatchPicker.Item = ColorSwatchPickerItem;\nexport type { ColorSwatchPickerItemProps, ColorSwatchPickerProps };\nexport { ColorSwatchPickerItem };\nexport default ColorSwatchPicker;"],"mappings":";;;;;;;;;;AA0Ec,GAAgEO,OAAOC,UAA8CD,OAAOE,YAA8CF,OAAOC;AAE/L,MAAME,SAAS;CACbC,MAAM;EACJC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ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1
1
  "use client";
2
+ import { c } from "react/compiler-runtime";
2
3
  import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
4
+ import { ColorThumb, ColorWheel as ColorWheel$1, ColorWheelTrack } from "react-aria-components";
3
5
  import { thumbClassName } from "../../styles/color.js";
4
6
  import { mergeStatefulStyles } from "../../styles/merge.js";
5
- import { c } from "react/compiler-runtime";
6
7
  import { jsx, jsxs } from "react/jsx-runtime";
7
- import { ColorThumb, ColorWheel as ColorWheel$1, ColorWheelTrack } from "react-aria-components";
8
8
  // src/components/color-wheel/index.tsx
9
9
  const DEFAULT_OUTER_RADIUS = 100;
10
10
  const DEFAULT_THICKNESS = 16;
@@ -1,6 +1,6 @@
1
- import { FieldVariant } from "../../field/index.js";
2
1
  import { ReactElement, ReactNode, Ref, RefAttributes } from "react";
3
2
  import { ComboBoxProps as ComboBoxProps$1 } from "react-aria-components";
3
+ import { FieldVariant } from "../../field/index.js";
4
4
  type ComboBoxProps<T extends object = object, M extends ComboBoxSelectionMode = 'single'> = {
5
5
  /**
6
6
  * Whether the list stays open when a search leaves nothing in it, showing
@@ -1,5 +1,9 @@
1
1
  "use client";
2
+ import { c } from "react/compiler-runtime";
2
3
  import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
4
+ import { useContext, useRef } from "react";
5
+ import { Button, ComboBox as ComboBox$1, ComboBoxStateContext, ComboBoxValue, Popover } from "react-aria-components";
6
+ import { OptionRowContext } from "../../collection/context.js";
3
7
  import { FieldBox, FieldInput, FieldMessage, FieldValue } from "../../field/index.js";
4
8
  import { fieldStyles, invalidFrom, useFieldValidationBehavior } from "../../field/root.js";
5
9
  import { ChevronEndGlyph } from "../../glyphs/index.js";
@@ -7,10 +11,7 @@ import { focus } from "../../styles/focus.js";
7
11
  import { mergeStatefulStyles } from "../../styles/merge.js";
8
12
  import { overlay, popupOrigin } from "../../styles/overlay.js";
9
13
  import ListBox$1 from "../list-box/index.js";
10
- import { c } from "react/compiler-runtime";
11
- import { useContext, useRef } from "react";
12
14
  import { jsx, jsxs } from "react/jsx-runtime";
13
- import { Button, ComboBox as ComboBox$1, ComboBoxStateContext, ComboBoxValue, Popover } from "react-aria-components";
14
15
  // src/components/combo-box/index.tsx
15
16
  const TOGGLE = /* @__PURE__ */ jsx(ComboToggle, {});
16
17
  const styles = {
@@ -150,7 +151,10 @@ function ComboBox(t0) {
150
151
  } else t11 = $[16];
151
152
  let t12;
152
153
  if ($[17] !== options) {
153
- t12 = /* @__PURE__ */ jsx(ListBox$1, { children: options });
154
+ t12 = /* @__PURE__ */ jsx(OptionRowContext, {
155
+ value: "menu",
156
+ children: /* @__PURE__ */ jsx(ListBox$1, { children: options })
157
+ });
154
158
  $[17] = options;
155
159
  $[18] = t12;
156
160
  } else t12 = $[18];