@kanso-labs/kanso-ui 0.43.6 → 0.44.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 (158) hide show
  1. package/README.md +1 -0
  2. package/dist/calendar/index.js +34 -10
  3. package/dist/calendar/index.js.map +1 -1
  4. package/dist/calendar/styles.js +30 -0
  5. package/dist/calendar/styles.js.map +1 -1
  6. package/dist/chip/index.js +27 -18
  7. package/dist/chip/index.js.map +1 -1
  8. package/dist/chip/label.js +32 -0
  9. package/dist/chip/label.js.map +1 -0
  10. package/dist/chip/styles.js +32 -2
  11. package/dist/chip/styles.js.map +1 -1
  12. package/dist/collection/text.js +24 -3
  13. package/dist/collection/text.js.map +1 -1
  14. package/dist/components/button/index.js.map +1 -1
  15. package/dist/components/calendar/index.d.ts +8 -1
  16. package/dist/components/calendar/index.js +129 -73
  17. package/dist/components/calendar/index.js.map +1 -1
  18. package/dist/components/checkbox/index.js +29 -30
  19. package/dist/components/checkbox/index.js.map +1 -1
  20. package/dist/components/checkbox-group/index.js +4 -2
  21. package/dist/components/checkbox-group/index.js.map +1 -1
  22. package/dist/components/chip/index.js +1 -1
  23. package/dist/components/chip/index.js.map +1 -1
  24. package/dist/components/chip-group/index.d.ts +35 -5
  25. package/dist/components/chip-group/index.js +137 -97
  26. package/dist/components/chip-group/index.js.map +1 -1
  27. package/dist/components/copy-field/index.js +1 -1
  28. package/dist/components/copy-field/index.js.map +1 -1
  29. package/dist/components/currency/index.d.ts +64 -6
  30. package/dist/components/currency/index.js +117 -40
  31. package/dist/components/currency/index.js.map +1 -1
  32. package/dist/components/date-picker/index.js +1 -1
  33. package/dist/components/dialog/index.d.ts +3 -1
  34. package/dist/components/dialog/index.js +121 -81
  35. package/dist/components/dialog/index.js.map +1 -1
  36. package/dist/components/disclosure-group/index.js +1 -1
  37. package/dist/components/disclosure-group/index.js.map +1 -1
  38. package/dist/components/icon-button/index.js +18 -1
  39. package/dist/components/icon-button/index.js.map +1 -1
  40. package/dist/components/index.d.ts +2 -2
  41. package/dist/components/keycap/index.d.ts +3 -0
  42. package/dist/components/keycap/index.js +30 -44
  43. package/dist/components/keycap/index.js.map +1 -1
  44. package/dist/components/list/index.d.ts +16 -2
  45. package/dist/components/list/index.js +124 -69
  46. package/dist/components/list/index.js.map +1 -1
  47. package/dist/components/list-detail/index.d.ts +11 -3
  48. package/dist/components/list-detail/index.js +13 -6
  49. package/dist/components/list-detail/index.js.map +1 -1
  50. package/dist/components/list-item/index.d.ts +16 -1
  51. package/dist/components/list-item/index.js.map +1 -1
  52. package/dist/components/menu/index.d.ts +6 -2
  53. package/dist/components/menu/index.js +22 -15
  54. package/dist/components/menu/index.js.map +1 -1
  55. package/dist/components/meter/index.d.ts +4 -1
  56. package/dist/components/meter/index.js +6 -0
  57. package/dist/components/meter/index.js.map +1 -1
  58. package/dist/components/navigation-bar/index.d.ts +14 -4
  59. package/dist/components/navigation-bar/index.js +77 -50
  60. package/dist/components/navigation-bar/index.js.map +1 -1
  61. package/dist/components/navigation-rail/index.d.ts +3 -2
  62. package/dist/components/navigation-rail/index.js +59 -52
  63. package/dist/components/navigation-rail/index.js.map +1 -1
  64. package/dist/components/navigation-tree/index.js +4 -1
  65. package/dist/components/navigation-tree/index.js.map +1 -1
  66. package/dist/components/number-field/index.d.ts +3 -2
  67. package/dist/components/number-field/index.js +91 -115
  68. package/dist/components/number-field/index.js.map +1 -1
  69. package/dist/components/popover/index.d.ts +3 -1
  70. package/dist/components/popover/index.js +102 -100
  71. package/dist/components/popover/index.js.map +1 -1
  72. package/dist/components/progress-indicator/index.d.ts +4 -2
  73. package/dist/components/progress-indicator/index.js +4 -3
  74. package/dist/components/progress-indicator/index.js.map +1 -1
  75. package/dist/components/radio-group/index.js +34 -24
  76. package/dist/components/radio-group/index.js.map +1 -1
  77. package/dist/components/search-field/index.d.ts +11 -1
  78. package/dist/components/search-field/index.js +32 -28
  79. package/dist/components/search-field/index.js.map +1 -1
  80. package/dist/components/segmented-button/index.d.ts +9 -2
  81. package/dist/components/segmented-button/index.js +1 -1
  82. package/dist/components/segmented-button/index.js.map +1 -1
  83. package/dist/components/separator/index.d.ts +19 -7
  84. package/dist/components/separator/index.js +36 -13
  85. package/dist/components/separator/index.js.map +1 -1
  86. package/dist/components/sheet/index.js +72 -61
  87. package/dist/components/sheet/index.js.map +1 -1
  88. package/dist/components/snackbar/index.d.ts +4 -1
  89. package/dist/components/snackbar/index.js +140 -55
  90. package/dist/components/snackbar/index.js.map +1 -1
  91. package/dist/components/stack/index.d.ts +6 -3
  92. package/dist/components/stack/index.js +48 -31
  93. package/dist/components/stack/index.js.map +1 -1
  94. package/dist/components/switch/index.d.ts +16 -6
  95. package/dist/components/switch/index.js +115 -62
  96. package/dist/components/switch/index.js.map +1 -1
  97. package/dist/components/text-area/index.d.ts +10 -1
  98. package/dist/components/text-area/index.js +21 -19
  99. package/dist/components/text-area/index.js.map +1 -1
  100. package/dist/components/text-field/index.d.ts +16 -2
  101. package/dist/components/text-field/index.js +49 -43
  102. package/dist/components/text-field/index.js.map +1 -1
  103. package/dist/components/time-picker/index.js +42 -38
  104. package/dist/components/time-picker/index.js.map +1 -1
  105. package/dist/components/tooltip/index.d.ts +3 -1
  106. package/dist/components/tooltip/index.js.map +1 -1
  107. package/dist/components/tree/index.d.ts +15 -3
  108. package/dist/components/tree/index.js +41 -28
  109. package/dist/components/tree/index.js.map +1 -1
  110. package/dist/control/index.js +26 -23
  111. package/dist/control/index.js.map +1 -1
  112. package/dist/control/styles.js +8 -1
  113. package/dist/control/styles.js.map +1 -1
  114. package/dist/field/index.js +149 -131
  115. package/dist/field/index.js.map +1 -1
  116. package/dist/field/styles.js +14 -1
  117. package/dist/field/styles.js.map +1 -1
  118. package/dist/glyphs/index.js +37 -1
  119. package/dist/glyphs/index.js.map +1 -1
  120. package/dist/hooks/useClippedTitle.js +44 -0
  121. package/dist/hooks/useClippedTitle.js.map +1 -0
  122. package/dist/hooks/useRipple.js +6 -5
  123. package/dist/hooks/useRipple.js.map +1 -1
  124. package/dist/hooks/useScrollStop.js +133 -0
  125. package/dist/hooks/useScrollStop.js.map +1 -0
  126. package/dist/i18n/index.js +1 -0
  127. package/dist/i18n/index.js.map +1 -1
  128. package/dist/i18n/messages.js +34 -0
  129. package/dist/i18n/messages.js.map +1 -1
  130. package/dist/index.d.ts +2 -2
  131. package/dist/indicator/index.js +18 -16
  132. package/dist/indicator/index.js.map +1 -1
  133. package/dist/indicator/styles.js +3 -0
  134. package/dist/indicator/styles.js.map +1 -1
  135. package/dist/keycap/context.js +7 -0
  136. package/dist/keycap/context.js.map +1 -0
  137. package/dist/navigation/index.d.ts +16 -2
  138. package/dist/navigation/index.js +145 -44
  139. package/dist/navigation/index.js.map +1 -1
  140. package/dist/navigation/styles.js +79 -16
  141. package/dist/navigation/styles.js.map +1 -1
  142. package/dist/overlay/modal.js +7 -0
  143. package/dist/overlay/modal.js.map +1 -0
  144. package/dist/row/index.js +92 -89
  145. package/dist/row/index.js.map +1 -1
  146. package/dist/row/styles.js +24 -1
  147. package/dist/row/styles.js.map +1 -1
  148. package/dist/styles/overlay.d.ts +6 -2
  149. package/dist/styles/overlay.js +9 -1
  150. package/dist/styles/overlay.js.map +1 -1
  151. package/dist/styles.css +177 -20
  152. package/dist/theme-scope.d.ts +5 -1
  153. package/dist/theme-scope.js +100 -51
  154. package/dist/theme-scope.js.map +1 -1
  155. package/dist/tokens/design.tokens.stylex.js.map +1 -1
  156. package/package.json +21 -20
  157. package/dist/hooks/useScrollable.js +0 -69
  158. package/dist/hooks/useScrollable.js.map +0 -1
@@ -13,6 +13,8 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
13
  import { GridList, GridListHeader, GridListItem, GridListLoadMoreItem, GridListSection } from "react-aria-components";
14
14
  //#region src/components/list/index.tsx
15
15
  const SelectLabelContext = createContext(void 0);
16
+ const RowsActContext = createContext(false);
17
+ const NESTED_CONTROL = "a[href], button, input, label, select, textarea, [role=\"button\"], [role=\"checkbox\"], [role=\"link\"], [role=\"switch\"]";
16
18
  function itemContent(children, leading, overline, supporting, trailing, selectLabel, ripple) {
17
19
  return (state) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(RowContent, {
18
20
  isDisabled: state.isDisabled,
@@ -24,6 +26,10 @@ function itemContent(children, leading, overline, supporting, trailing, selectLa
24
26
  children
25
27
  }), state.isDisabled ? null : ripple] });
26
28
  }
29
+ function landsOnControl(event) {
30
+ const control = event.target instanceof Element ? event.target.closest(NESTED_CONTROL) : null;
31
+ return event.currentTarget.contains(control) && control !== event.currentTarget;
32
+ }
27
33
  /**
28
34
  * The selection checkbox, then whatever the row was given. Its return type is
29
35
  * written out rather than inferred: `ReactNode` is a union that includes a
@@ -43,6 +49,10 @@ function leadingFor(state, leading, selectLabel) {
43
49
  * `defaultSelectedKeys` to let it keep its own. A list that only responds to
44
50
  * a press takes `onAction` on the row instead.
45
51
  *
52
+ * A `multiple` list draws a checkbox on every row. A `single` one draws none
53
+ * and marks the chosen row alone, since a checkbox promises a choice that
54
+ * leaves the others standing; `selectionBehavior` overrides either.
55
+ *
46
56
  * ListItem is the static row — one row, presenting, on its own. This is the
47
57
  * collection that draws the same row and adds selection, keyboard navigation
48
58
  * between rows, sections and a load-more sentinel.
@@ -55,55 +65,86 @@ function leadingFor(state, leading, selectLabel) {
55
65
  * the element a layout positions.
56
66
  */
57
67
  function List(t0) {
58
- const $ = c(14);
68
+ const $ = c(23);
59
69
  let T0;
60
70
  let T1;
71
+ let T2;
72
+ let props;
73
+ let selectionBehavior;
61
74
  let t1;
62
75
  let t2;
63
76
  let t3;
77
+ let t4;
64
78
  if ($[0] !== t0) {
65
- const { selectLabel, ...props } = t0;
66
- T1 = SelectLabelContext;
67
- t3 = selectLabel;
79
+ const { selectionBehavior: t5, selectLabel, ...t6 } = t0;
80
+ selectionBehavior = t5;
81
+ props = t6;
82
+ const rowsAct = (props.selectionMode ?? "none") !== "none" || props.onAction !== void 0 || props.dragAndDropHooks?.useDraggableCollectionState !== void 0;
83
+ T2 = SelectLabelContext;
84
+ t4 = selectLabel;
85
+ T1 = RowsActContext;
86
+ t3 = rowsAct;
68
87
  T0 = GridList;
69
88
  t1 = props;
70
89
  t2 = mergeStatefulStyles(containerClasses, props);
71
90
  $[0] = t0;
72
91
  $[1] = T0;
73
92
  $[2] = T1;
74
- $[3] = t1;
75
- $[4] = t2;
76
- $[5] = t3;
93
+ $[3] = T2;
94
+ $[4] = props;
95
+ $[5] = selectionBehavior;
96
+ $[6] = t1;
97
+ $[7] = t2;
98
+ $[8] = t3;
99
+ $[9] = t4;
77
100
  } else {
78
101
  T0 = $[1];
79
102
  T1 = $[2];
80
- t1 = $[3];
81
- t2 = $[4];
82
- t3 = $[5];
103
+ T2 = $[3];
104
+ props = $[4];
105
+ selectionBehavior = $[5];
106
+ t1 = $[6];
107
+ t2 = $[7];
108
+ t3 = $[8];
109
+ t4 = $[9];
83
110
  }
84
- let t4;
85
- if ($[6] !== T0 || $[7] !== t1 || $[8] !== t2) {
86
- t4 = /* @__PURE__ */ jsx(T0, {
111
+ const t5 = selectionBehavior ?? (props.selectionMode === "single" ? "replace" : "toggle");
112
+ let t6;
113
+ if ($[10] !== T0 || $[11] !== t1 || $[12] !== t2 || $[13] !== t5) {
114
+ t6 = /* @__PURE__ */ jsx(T0, {
87
115
  ...t1,
88
- ...t2
116
+ ...t2,
117
+ selectionBehavior: t5
89
118
  });
90
- $[6] = T0;
91
- $[7] = t1;
92
- $[8] = t2;
93
- $[9] = t4;
94
- } else t4 = $[9];
95
- let t5;
96
- if ($[10] !== T1 || $[11] !== t3 || $[12] !== t4) {
97
- t5 = /* @__PURE__ */ jsx(T1, {
119
+ $[10] = T0;
120
+ $[11] = t1;
121
+ $[12] = t2;
122
+ $[13] = t5;
123
+ $[14] = t6;
124
+ } else t6 = $[14];
125
+ let t7;
126
+ if ($[15] !== T1 || $[16] !== t3 || $[17] !== t6) {
127
+ t7 = /* @__PURE__ */ jsx(T1, {
98
128
  value: t3,
99
- children: t4
129
+ children: t6
100
130
  });
101
- $[10] = T1;
102
- $[11] = t3;
103
- $[12] = t4;
104
- $[13] = t5;
105
- } else t5 = $[13];
106
- return t5;
131
+ $[15] = T1;
132
+ $[16] = t3;
133
+ $[17] = t6;
134
+ $[18] = t7;
135
+ } else t7 = $[18];
136
+ let t8;
137
+ if ($[19] !== T2 || $[20] !== t4 || $[21] !== t7) {
138
+ t8 = /* @__PURE__ */ jsx(T2, {
139
+ value: t4,
140
+ children: t7
141
+ });
142
+ $[19] = T2;
143
+ $[20] = t4;
144
+ $[21] = t7;
145
+ $[22] = t8;
146
+ } else t8 = $[22];
147
+ return t8;
107
148
  }
108
149
  /**
109
150
  * The row the list shows while it is fetching more. React Aria calls
@@ -166,66 +207,74 @@ function ListLoadMore(t0) {
166
207
  * holds, from the state React Aria reports rather than from a prop here.
167
208
  */
168
209
  function ListRow(t0) {
169
- const $ = c(24);
210
+ const $ = c(27);
170
211
  const { children, leading, onContextMenu, onPointerCancel, onPointerDown, onPointerLeave, onPointerUp, overline, supporting, textValue, trailing, ...props } = t0;
171
212
  const selectLabel = useContext(SelectLabelContext);
213
+ const acts = useContext(RowsActContext) || props.onAction !== void 0 || props.href !== void 0;
172
214
  let t1;
173
- if ($[0] !== onContextMenu || $[1] !== onPointerCancel || $[2] !== onPointerDown || $[3] !== onPointerLeave || $[4] !== onPointerUp) {
215
+ if ($[0] !== onContextMenu || $[1] !== onPointerCancel || $[2] !== onPointerLeave || $[3] !== onPointerUp) {
174
216
  t1 = {
175
217
  onContextMenu,
176
218
  onPointerCancel,
177
- onPointerDown,
178
219
  onPointerLeave,
179
220
  onPointerUp
180
221
  };
181
222
  $[0] = onContextMenu;
182
223
  $[1] = onPointerCancel;
183
- $[2] = onPointerDown;
184
- $[3] = onPointerLeave;
185
- $[4] = onPointerUp;
186
- $[5] = t1;
187
- } else t1 = $[5];
188
- const ripple = useRipple(true, t1, true);
224
+ $[2] = onPointerLeave;
225
+ $[3] = onPointerUp;
226
+ $[4] = t1;
227
+ } else t1 = $[4];
228
+ const ripple = useRipple(acts, t1, true);
189
229
  const T0 = GridListItem;
190
230
  let t2;
191
- if ($[6] !== children || $[7] !== textValue) {
231
+ if ($[5] !== children || $[6] !== textValue) {
192
232
  t2 = textValue ?? textOf(children);
193
- $[6] = children;
194
- $[7] = textValue;
195
- $[8] = t2;
196
- } else t2 = $[8];
233
+ $[5] = children;
234
+ $[6] = textValue;
235
+ $[7] = t2;
236
+ } else t2 = $[7];
197
237
  const t3 = ripple.handlers;
198
- const t4 = mergeStatefulStyles(rowItemStyles(supporting, overline), props);
199
- let t5;
200
- if ($[9] !== children || $[10] !== leading || $[11] !== overline || $[12] !== ripple.surface || $[13] !== selectLabel || $[14] !== supporting || $[15] !== trailing) {
201
- t5 = itemContent(children, leading, overline, supporting, trailing, selectLabel, ripple.surface);
202
- $[9] = children;
203
- $[10] = leading;
204
- $[11] = overline;
205
- $[12] = ripple.surface;
206
- $[13] = selectLabel;
207
- $[14] = supporting;
208
- $[15] = trailing;
209
- $[16] = t5;
210
- } else t5 = $[16];
238
+ let t4;
239
+ if ($[8] !== onPointerDown || $[9] !== ripple.handlers.onPointerDown) {
240
+ t4 = startsRipple(ripple.handlers.onPointerDown, onPointerDown);
241
+ $[8] = onPointerDown;
242
+ $[9] = ripple.handlers.onPointerDown;
243
+ $[10] = t4;
244
+ } else t4 = $[10];
245
+ const t5 = mergeStatefulStyles(rowItemStyles(supporting, overline), props);
211
246
  let t6;
212
- if ($[17] !== T0 || $[18] !== props || $[19] !== ripple.handlers || $[20] !== t2 || $[21] !== t4 || $[22] !== t5) {
213
- t6 = /* @__PURE__ */ jsx(T0, {
247
+ if ($[11] !== children || $[12] !== leading || $[13] !== overline || $[14] !== ripple.surface || $[15] !== selectLabel || $[16] !== supporting || $[17] !== trailing) {
248
+ t6 = itemContent(children, leading, overline, supporting, trailing, selectLabel, ripple.surface);
249
+ $[11] = children;
250
+ $[12] = leading;
251
+ $[13] = overline;
252
+ $[14] = ripple.surface;
253
+ $[15] = selectLabel;
254
+ $[16] = supporting;
255
+ $[17] = trailing;
256
+ $[18] = t6;
257
+ } else t6 = $[18];
258
+ let t7;
259
+ if ($[19] !== T0 || $[20] !== props || $[21] !== ripple.handlers || $[22] !== t2 || $[23] !== t4 || $[24] !== t5 || $[25] !== t6) {
260
+ t7 = /* @__PURE__ */ jsx(T0, {
214
261
  textValue: t2,
215
262
  ...t3,
263
+ onPointerDown: t4,
216
264
  ...props,
217
- ...t4,
218
- children: t5
265
+ ...t5,
266
+ children: t6
219
267
  });
220
- $[17] = T0;
221
- $[18] = props;
222
- $[19] = ripple.handlers;
223
- $[20] = t2;
224
- $[21] = t4;
225
- $[22] = t5;
226
- $[23] = t6;
227
- } else t6 = $[23];
228
- return t6;
268
+ $[19] = T0;
269
+ $[20] = props;
270
+ $[21] = ripple.handlers;
271
+ $[22] = t2;
272
+ $[23] = t4;
273
+ $[24] = t5;
274
+ $[25] = t6;
275
+ $[26] = t7;
276
+ } else t7 = $[26];
277
+ return t7;
229
278
  }
230
279
  /**
231
280
  * A named group of rows. `header` names it, and is what a screen reader
@@ -283,6 +332,12 @@ function ListSection(t0) {
283
332
  } else t4 = $[13];
284
333
  return t4;
285
334
  }
335
+ function startsRipple(ripple, own) {
336
+ return (event) => {
337
+ if (!landsOnControl(event)) ripple?.(event);
338
+ own?.(event);
339
+ };
340
+ }
286
341
  List.Item = ListRow;
287
342
  List.LoadMore = ListLoadMore;
288
343
  List.Section = ListSection;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","GridListItemRenderProps","GridListItemProps","RACGridListItemProps","GridListLoadMoreItemProps","RACGridListLoadMoreItemProps","GridListProps","RACGridListProps","GridListSectionProps","RACGridListSectionProps","stylex","createContext","useContext","GridList","RACGridList","GridListHeader","RACGridListHeader","GridListItem","RACGridListItem","GridListLoadMoreItem","RACGridListLoadMoreItem","GridListSection","RACGridListSection","CollectionLoadMore","collectionStyles","containerClasses","rowItemStyles","textOf","useRipple","RowContent","mergeStatefulStyles","mergeStyles","Checkbox","SelectLabelContext","undefined","ListLoadMoreProps","Omit","label","ListProps","className","T","selectLabel","style","ListRowProps","children","leading","overline","supporting","trailing","ListSectionProps","header","itemContent","ripple","state","isDisabled","isSelected","leadingFor","selectionBehavior","selectionMode","List","t0","$","T0","T1","t1","t2","t3","props","t4","t5","ListLoadMore","loading","ListRow","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","textValue","handlers","surface","t6","ListSection","section","Item","LoadMore","Section","_c","RACGridList","props","RACGridListLoadMoreItem","stylex.props","RACGridListItem","RACGridListSection","RACGridListHeader"],"sources":["../../../src/components/list/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { GridListItemRenderProps, GridListItemProps as RACGridListItemProps, GridListLoadMoreItemProps as RACGridListLoadMoreItemProps, GridListProps as RACGridListProps, GridListSectionProps as RACGridListSectionProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext } from 'react';\nimport { GridList as RACGridList, GridListHeader as RACGridListHeader, GridListItem as RACGridListItem, GridListLoadMoreItem as RACGridListLoadMoreItem, GridListSection as RACGridListSection } from 'react-aria-components';\nimport { CollectionLoadMore } from '../../collection';\nimport { collectionStyles, containerClasses, rowItemStyles } from '../../collection/styles';\nimport { textOf } from '../../collection/text';\nimport { useRipple } from '../../hooks/useRipple';\nimport { RowContent } from '../../row';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport Checkbox from '../checkbox';\n\n// The lists page's interactive list. Each row is the row every list here\n// draws — `src/row`, shared with ListItem and ListBox — so the 56dp floor,\n// the body-large headline, the body-medium supporting line, the state layers\n// and the disabled treatment are all that module's.\n//\n// ListItem is the static row: one row, on its own, presenting. This is the\n// collection that draws the same row and adds selection, keyboard navigation\n// between rows, sections and a load-more sentinel. A page with one row uses\n// ListItem; a page with a list of them uses this.\n//\n// It is ListBox's shape over a different React Aria primitive, and the\n// difference is what the primitive allows inside a row. A listbox option is\n// a leaf: a screen reader reads its text and nothing inside it can be\n// focused, so a row with a checkbox or a button in it is not an option. A\n// grid list's row is a row of cells, and its contents can be reached and\n// operated. That is what a list with a checkbox on every row needs, and it\n// is why this exists beside ListBox rather than instead of it.\n//\n// Three things are this component's own.\n//\n// **A selecting list draws a checkbox.** React Aria reports the selection\n// mode and behaviour on each row, so a list that toggles draws one without\n// the call site saying so on every item — and it is the library's Checkbox\n// rather than a glyph, so it looks like every other checkbox on the page.\n//\n// **The checkbox is drawn first, before whatever the row was given.** The\n// page draws it leading on a plain row and trailing beside an avatar; one\n// place, always the same, is what keeps a column of rows reading down.\n//\n// **Drag and drop passes straight through.** `dragAndDropHooks` is React\n// Aria's and is not wrapped, since what a list can be dropped on is the\n// page's business rather than the row's.\n\n// What each row's selection checkbox is called. A context rather than a prop\n// on the row, since it is the list's decision and repeating it on every row\n// is how the two drift. Undefined unless the list is given one, which\n// leaves the name React Aria gives in the reader's locale.\nconst SelectLabelContext = createContext<string | undefined>(undefined);\ntype ListLoadMoreProps = Omit<RACGridListLoadMoreItemProps, 'children'> & {\n /**\n * What the row says while it is loading. Read by a screen reader; the ring\n * itself carries no text.\n * Left out, it is the word for it in the I18nProvider's locale — \"Loading\n * more\" in English.\n */\n label?: string;\n};\ntype ListProps<T extends object = object> = {\n /** A function may compute the class from the list's render state. */\n className?: RACGridListProps<T>['className'];\n /**\n * What each row's selection checkbox is called, for a screen reader. The\n * row's own text is what names the row; this names the box inside it.\n * Left out, React Aria names it in the reader's locale — \"Select\" in\n * English.\n */\n selectLabel?: string;\n /** A function may compute the style from the list's render state. */\n style?: RACGridListProps<T>['style'];\n} & Omit<RACGridListProps<T>, 'className' | 'style'>;\n\n// `Row` rather than `Item`, though the component is `List.Item`, because\n// `ListItemProps` is the standalone `ListItem` component's and both are\n// exported from the package. The two overlap on four props, so a call site\n// reaching for the obvious name got something that typechecked until it\n// passed `textValue`, and an error pointing at `onClick` rather than at the\n// name. `row` is what this file and `src/row` call the thing anyway.\ntype ListRowProps<T extends object = object> = {\n /** The row's headline — the one thing it is mostly about. */\n children?: ReactNode;\n /** A function may compute the class from the row's render state. */\n className?: RACGridListItemProps<T>['className'];\n /** Content before the headline: an avatar, an icon. */\n leading?: ReactNode;\n /**\n * A line above the headline, in the page's label-small and the same muted\n * role the supporting line takes — a category, a date, a status. Given\n * alongside `supporting` it makes the row the page's three-line item.\n */\n overline?: ReactNode;\n /** A function may compute the style from the row's render state. */\n style?: RACGridListItemProps<T>['style'];\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n /** Content after the headline, such as an amount or a control. */\n trailing?: ReactNode;\n} & Omit<RACGridListItemProps<T>, 'children' | 'className' | 'style'>;\ntype ListSectionProps<T extends object = object> = Omit<RACGridListSectionProps<T>, 'children'> & {\n /**\n * The rows in the section. A section built from data puts React Aria's\n * `Collection` in here rather than a render function, since the header is\n * an element beside them.\n */\n children?: ReactNode;\n /**\n * The section's heading, rendered through React Aria's header so the\n * section is named by it. A section without one is a group with no name.\n */\n header?: ReactNode;\n};\n\n// What the row 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 state decides two things: whether a selection checkbox is drawn, and\n// which colour the supporting line takes — the muted role holds only while\n// the row is drawn on the surface.\nfunction itemContent(children: ReactNode, leading: ReactNode, overline: ReactNode, supporting: ReactNode, trailing: ReactNode, selectLabel: string | undefined, ripple: ReactNode) {\n return (state: GridListItemRenderProps) => <>\n <RowContent isDisabled={state.isDisabled} isSelected={state.isSelected} leading={leadingFor(state, leading, selectLabel)} overline={overline} supporting={supporting} trailing={trailing}>\n {children}\n </RowContent>\n {state.isDisabled ? null : ripple}\n </>;\n}\n\n// StyleX cannot target `[data-selected]` on the element it is styling, so a\n// row's state comes from the render state React Aria hands its className.\n// The order matters: `disabled` is applied last so its ground and colour\n// win over the selected container's. The state layers come from the render\n// state as well — see `focusVisible` in src/row/styles.ts — and React Aria\n// reports none of them on a disabled row, so nothing has to outrank them.\n//\n// A supporting line moves the row from the page's one-line container height\n// to its two-line one, which is a floor rather than something the row's own\n// box arrives at — see `twoLine` in `src/row/styles.ts`. Taken as an\n// argument rather than read from the render state, since React Aria reports\n// what a row is doing and not what it holds; the row is built by a call for\n// the same reason `itemContent` is.\n/**\n * The selection checkbox, then whatever the row was given. Its return type is\n * written out rather than inferred: `ReactNode` is a union that includes a\n * promise, and a function inferred as returning one has to be `async`.\n */\nfunction leadingFor(state: GridListItemRenderProps, leading: ReactNode, selectLabel: string | undefined): ReactNode {\n if (state.selectionBehavior !== 'toggle' || state.selectionMode === 'none') {\n return leading;\n }\n return <>\n <Checkbox aria-label={selectLabel} slot=\"selection\" />\n {leading}\n </>;\n}\n\n/**\n * A list of rows one or more of which can be selected. Selection is React\n * Aria's: set `selectionMode` to `single` or `multiple`, and pass\n * `selectedKeys` with `onSelectionChange` to control it or\n * `defaultSelectedKeys` to let it keep its own. A list that only responds to\n * a press takes `onAction` on the row instead.\n *\n * ListItem is the static row — one row, presenting, on its own. This is the\n * collection that draws the same row and adds selection, keyboard navigation\n * between rows, sections and a load-more sentinel.\n *\n * Composed from parts, since a row's slots take arbitrary content:\n * `List.Item`, `List.Section` and `List.LoadMore`. Name the list with\n * `aria-label` or `aria-labelledby` — nothing here labels it for you.\n *\n * The call site's `className` and `style` land on the container, which is\n * the element a layout positions.\n */\nfunction List<T extends object>({\n selectLabel,\n ...props\n}: ListProps<T> & RefAttributes<HTMLDivElement>) {\n return <SelectLabelContext value={selectLabel}>\n <RACGridList {...props} {...mergeStatefulStyles(containerClasses, props)} />\n </SelectLabelContext>;\n}\n\n/**\n * The row the list shows while it is fetching more. React Aria calls\n * `onLoadMore` when this comes into view, and draws it only while\n * `isLoading`.\n */\nfunction ListLoadMore({\n label,\n ...props\n}: ListLoadMoreProps & RefAttributes<HTMLDivElement>) {\n return <RACGridListLoadMoreItem {...props} {...mergeStyles(stylex.props(collectionStyles.loading), props)}>\n <CollectionLoadMore diameter=\"24px\" label={label} />\n </RACGridListLoadMoreItem>;\n}\n\n/**\n * One row. Its slots are the row's: `leading`, the headline as children,\n * `supporting` under it, and `trailing`. Give every row an `id` — that is\n * the key selection is reported by.\n *\n * A list that selects with checkboxes draws one before whatever `leading`\n * holds, from the state React Aria reports rather than from a prop here.\n */\nfunction ListRow<T extends object = object>({\n children,\n leading,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n overline,\n supporting,\n textValue,\n trailing,\n ...props\n}: ListRowProps<T> & RefAttributes<HTMLDivElement>) {\n const selectLabel = useContext(SelectLabelContext);\n // The press ripple ListItem draws, so a row looks the same pressed in a\n // list as on its own. The call site's pointer handlers are handed to the\n // hook to merge, for the reason ListItem gives. React Aria keeps a row's\n // clicks for its own press handling, so the press ends on the release.\n const ripple = useRipple<HTMLDivElement>(true, {\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n }, true);\n return <RACGridListItem textValue={textValue ?? textOf(children)} {...ripple.handlers} {...props} {...mergeStatefulStyles(rowItemStyles(supporting, overline), props)}>\n {itemContent(children, leading, overline, supporting, trailing, selectLabel, ripple.surface)}\n </RACGridListItem>;\n}\n\n/**\n * A named group of rows. `header` names it, and is what a screen reader\n * reads before the rows inside.\n */\nfunction ListSection<T extends object = object>({\n children,\n header,\n ...props\n}: ListSectionProps<T> & RefAttributes<HTMLDivElement>) {\n return <RACGridListSection {...props} {...mergeStyles(stylex.props(collectionStyles.section), props)}>\n {header === undefined ? null : <RACGridListHeader {...stylex.props(collectionStyles.header)}>\n {header}\n </RACGridListHeader>}\n {children}\n </RACGridListSection>;\n}\nList.Item = ListRow;\nList.LoadMore = ListLoadMore;\nList.Section = ListSection;\nexport type { ListLoadMoreProps, ListProps, ListRowProps, ListSectionProps };\nexport { ListLoadMore, ListRow, ListSection };\nexport default List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AAAhB,QAAAkB,IAAA,GAAAD,YAAAP;EAAAhB,WAAAsB;EAAAhB,SAAAkB;EAKtCN,KAAAxC;EAAuB6C,KAAAA;EAAWF,KAAAlC,YAAYrB,MAAac,iBAAgB2D,OAAQ,GAAGhB,OAAK;EAACN,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAjB;EAAAiB,EAAA,KAAAX;EAAAW,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAA;EAAAH,KAAAD,EAAA;EAAAjB,WAAAiB,EAAA;EAAAX,SAAAW,EAAA;EAAAG,KAAAH,EAAA;EAAAI,KAAAJ,EAAA;CAAA;CAAA,IAAAK;CAAA,IAAAL,EAAA,OAAAX,QAAA;EAC/FgB,KAAAhB,WAAWhB,KAAAA,IAAX,OAA8B,oBAAC4D,gBAAD;GAAkB,GAAKpF,MAAac,iBAAgB0B,MAAO;GACrFA,UAAAA;EAD4C,CAAA;EAE3BW,EAAA,KAAAX;EAAAW,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,OAAAC,MAAAD,EAAA,OAAAjB,YAAAiB,EAAA,QAAAG,MAAAH,EAAA,QAAAI,MAAAJ,EAAA,QAAAK,IAAA;EAHnBE,KAAA,qBAAC,IAAD;GAAmB,GAAKD;GAAK,GAAMF;GAAnC,UAAA,CACFC,IAGAtB,QAJqB;;EAKHiB,EAAA,KAAAC;EAAAD,EAAA,KAAAjB;EAAAiB,EAAA,MAAAG;EAAAH,EAAA,MAAAI;EAAAJ,EAAA,MAAAK;EAAAL,EAAA,MAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,OALhBO;AAKgB;AAEzBT,KAAKyB,OAAOZ;AACZb,KAAK0B,WAAWf;AAChBX,KAAK2B,UAAUJ"}
1
+ {"version":3,"file":"index.js","names":["c","_c","PointerEvent","PointerEventHandler","ReactNode","RefAttributes","GridListItemRenderProps","GridListItemProps","RACGridListItemProps","GridListLoadMoreItemProps","RACGridListLoadMoreItemProps","GridListProps","RACGridListProps","GridListSectionProps","RACGridListSectionProps","stylex","createContext","useContext","GridList","RACGridList","GridListHeader","RACGridListHeader","GridListItem","RACGridListItem","GridListLoadMoreItem","RACGridListLoadMoreItem","GridListSection","RACGridListSection","CollectionLoadMore","collectionStyles","containerClasses","rowItemStyles","textOf","useRipple","RowContent","mergeStatefulStyles","mergeStyles","Checkbox","SelectLabelContext","undefined","RowsActContext","NESTED_CONTROL","ListLoadMoreProps","Omit","label","ListProps","className","T","selectionBehavior","selectLabel","style","ListRowProps","children","leading","overline","supporting","trailing","ListSectionProps","header","itemContent","ripple","state","isDisabled","isSelected","leadingFor","landsOnControl","event","HTMLDivElement","control","target","Element","closest","currentTarget","contains","selectionMode","List","t0","$","T0","T1","T2","props","t1","t2","t3","t4","t5","t6","rowsAct","onAction","dragAndDropHooks","useDraggableCollectionState","t7","t8","ListLoadMore","loading","ListRow","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","textValue","acts","href","handlers","startsRipple","surface","ListSection","section","own","Item","LoadMore","Section","_c","RACGridList","props","RACGridListLoadMoreItem","stylex.props","RACGridListItem","RACGridListSection","RACGridListHeader"],"sources":["../../../src/components/list/index.tsx"],"sourcesContent":["'use client';\n\nimport type { PointerEvent, PointerEventHandler, ReactNode, RefAttributes } from 'react';\nimport type { GridListItemRenderProps, GridListItemProps as RACGridListItemProps, GridListLoadMoreItemProps as RACGridListLoadMoreItemProps, GridListProps as RACGridListProps, GridListSectionProps as RACGridListSectionProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext } from 'react';\nimport { GridList as RACGridList, GridListHeader as RACGridListHeader, GridListItem as RACGridListItem, GridListLoadMoreItem as RACGridListLoadMoreItem, GridListSection as RACGridListSection } from 'react-aria-components';\nimport { CollectionLoadMore } from '../../collection';\nimport { collectionStyles, containerClasses, rowItemStyles } from '../../collection/styles';\nimport { textOf } from '../../collection/text';\nimport { useRipple } from '../../hooks/useRipple';\nimport { RowContent } from '../../row';\nimport { mergeStatefulStyles, mergeStyles } from '../../styles/merge';\nimport Checkbox from '../checkbox';\n\n// The lists page's interactive list. Each row is the row every list here\n// draws — `src/row`, shared with ListItem and ListBox — so the 56dp floor,\n// the body-large headline, the body-medium supporting line, the state layers\n// and the disabled treatment are all that module's.\n//\n// ListItem is the static row: one row, on its own, presenting. This is the\n// collection that draws the same row and adds selection, keyboard navigation\n// between rows, sections and a load-more sentinel. A page with one row uses\n// ListItem; a page with a list of them uses this.\n//\n// It is ListBox's shape over a different React Aria primitive, and the\n// difference is what the primitive allows inside a row. A listbox option is\n// a leaf: a screen reader reads its text and nothing inside it can be\n// focused, so a row with a checkbox or a button in it is not an option. A\n// grid list's row is a row of cells, and its contents can be reached and\n// operated. That is what a list with a checkbox on every row needs, and it\n// is why this exists beside ListBox rather than instead of it.\n//\n// Three things are this component's own.\n//\n// **A selecting list draws a checkbox.** React Aria reports the selection\n// mode and behaviour on each row, so a list that toggles draws one without\n// the call site saying so on every item — and it is the library's Checkbox\n// rather than a glyph, so it looks like every other checkbox on the page.\n//\n// **The checkbox is drawn first, before whatever the row was given.** The\n// page draws it leading on a plain row and trailing beside an avatar; one\n// place, always the same, is what keeps a column of rows reading down.\n//\n// **Drag and drop passes straight through.** `dragAndDropHooks` is React\n// Aria's and is not wrapped, since what a list can be dropped on is the\n// page's business rather than the row's.\n\n// What each row's selection checkbox is called. A context rather than a prop\n// on the row, since it is the list's decision and repeating it on every row\n// is how the two drift. Undefined unless the list is given one, which\n// leaves the name React Aria gives in the reader's locale.\nconst SelectLabelContext = createContext<string | undefined>(undefined);\n\n// Whether the list makes every row act on a press: it selects, it has an\n// `onAction` of its own, or its rows drag. A row given an `onAction` or an\n// `href` acts whatever this says. A context for the reason SelectLabelContext\n// is one: it is the list's to decide, and a row reads it rather than taking\n// it again as a prop.\nconst RowsActContext = createContext(false);\n\n// What a press inside a row leaves to the element it lands on: a control of\n// the row's own content, which answers the press itself. A label is in the\n// list because a native checkbox or radio is pressed through the label\n// around it. React Aria's own controls, this library's Switch and Checkbox\n// among them, stop the pointerdown of a press they take, so the row never\n// hears one.\nconst NESTED_CONTROL = 'a[href], button, input, label, select, textarea, [role=\"button\"], [role=\"checkbox\"], [role=\"link\"], [role=\"switch\"]';\ntype ListLoadMoreProps = Omit<RACGridListLoadMoreItemProps, 'children'> & {\n /**\n * What the row says while it is loading. Read by a screen reader; the ring\n * itself carries no text.\n * Left out, it is the word for it in the I18nProvider's locale — \"Loading\n * more\" in English.\n */\n label?: string;\n};\ntype ListProps<T extends object = object> = {\n /** A function may compute the class from the list's render state. */\n className?: RACGridListProps<T>['className'];\n /**\n * How a press selects. `toggle` draws a checkbox on every row, and a press\n * adds that row to the selection or takes it out. `replace` draws none, a\n * press makes that row the selection, and the arrow keys carry the\n * selection with the focus; where rows also take an action, a click\n * selects and a double click acts. Left out, a `single` list replaces and\n * any other toggles, since a single choice drawn as checkboxes unticks one\n * box whenever another is ticked.\n */\n selectionBehavior?: RACGridListProps<T>['selectionBehavior'];\n /**\n * What each row's selection checkbox is called, for a screen reader. The\n * row's own text is what names the row; this names the box inside it.\n * Left out, React Aria names it in the reader's locale — \"Select\" in\n * English.\n */\n selectLabel?: string;\n /** A function may compute the style from the list's render state. */\n style?: RACGridListProps<T>['style'];\n} & Omit<RACGridListProps<T>, 'className' | 'selectionBehavior' | 'style'>;\n\n// `Row` rather than `Item`, though the component is `List.Item`, because\n// `ListItemProps` is the standalone `ListItem` component's and both are\n// exported from the package. The two overlap on four props, so a call site\n// reaching for the obvious name got something that typechecked until it\n// passed `textValue`, and an error pointing at `onClick` rather than at the\n// name. `row` is what this file and `src/row` call the thing anyway.\ntype ListRowProps<T extends object = object> = {\n /** The row's headline — the one thing it is mostly about. */\n children?: ReactNode;\n /** A function may compute the class from the row's render state. */\n className?: RACGridListItemProps<T>['className'];\n /** Content before the headline: an avatar, an icon. */\n leading?: ReactNode;\n /**\n * A line above the headline, in the page's label-small and the same muted\n * role the supporting line takes — a category, a date, a status. Given\n * alongside `supporting` it makes the row the page's three-line item.\n */\n overline?: ReactNode;\n /** A function may compute the style from the row's render state. */\n style?: RACGridListItemProps<T>['style'];\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n /** Content after the headline, such as an amount or a control. */\n trailing?: ReactNode;\n} & Omit<RACGridListItemProps<T>, 'children' | 'className' | 'style'>;\ntype ListSectionProps<T extends object = object> = Omit<RACGridListSectionProps<T>, 'children'> & {\n /**\n * The rows in the section. A section built from data puts React Aria's\n * `Collection` in here rather than a render function, since the header is\n * an element beside them.\n */\n children?: ReactNode;\n /**\n * The section's heading, rendered through React Aria's header so the\n * section is named by it. A section without one is a group with no name.\n */\n header?: ReactNode;\n};\n\n// What the row 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 state decides two things: whether a selection checkbox is drawn, and\n// which colour the supporting line takes — the muted role holds only while\n// the row is drawn on the surface.\nfunction itemContent(children: ReactNode, leading: ReactNode, overline: ReactNode, supporting: ReactNode, trailing: ReactNode, selectLabel: string | undefined, ripple: ReactNode) {\n return (state: GridListItemRenderProps) => <>\n <RowContent isDisabled={state.isDisabled} isSelected={state.isSelected} leading={leadingFor(state, leading, selectLabel)} overline={overline} supporting={supporting} trailing={trailing}>\n {children}\n </RowContent>\n {state.isDisabled ? null : ripple}\n </>;\n}\n\n// Whether a press on the row began on a control inside it rather than on the\n// row itself. `contains` answers false for no control at all, and true for\n// the row itself, which the second half rules out.\nfunction landsOnControl(event: PointerEvent<HTMLDivElement>) {\n const control = event.target instanceof Element ? event.target.closest(NESTED_CONTROL) : null;\n return event.currentTarget.contains(control) && control !== event.currentTarget;\n}\n\n// StyleX cannot target `[data-selected]` on the element it is styling, so a\n// row's state comes from the render state React Aria hands its className.\n// The order matters: `disabled` is applied last so its ground and colour\n// win over the selected container's. The state layers come from the render\n// state as well — see `focusVisible` in src/row/styles.ts — and React Aria\n// reports none of them on a disabled row, so nothing has to outrank them.\n//\n// A supporting line moves the row from the page's one-line container height\n// to its two-line one, which is a floor rather than something the row's own\n// box arrives at — see `twoLine` in `src/row/styles.ts`. Taken as an\n// argument rather than read from the render state, since React Aria reports\n// what a row is doing and not what it holds; the row is built by a call for\n// the same reason `itemContent` is.\n/**\n * The selection checkbox, then whatever the row was given. Its return type is\n * written out rather than inferred: `ReactNode` is a union that includes a\n * promise, and a function inferred as returning one has to be `async`.\n */\nfunction leadingFor(state: GridListItemRenderProps, leading: ReactNode, selectLabel: string | undefined): ReactNode {\n if (state.selectionBehavior !== 'toggle' || state.selectionMode === 'none') {\n return leading;\n }\n return <>\n <Checkbox aria-label={selectLabel} slot=\"selection\" />\n {leading}\n </>;\n}\n\n/**\n * A list of rows one or more of which can be selected. Selection is React\n * Aria's: set `selectionMode` to `single` or `multiple`, and pass\n * `selectedKeys` with `onSelectionChange` to control it or\n * `defaultSelectedKeys` to let it keep its own. A list that only responds to\n * a press takes `onAction` on the row instead.\n *\n * A `multiple` list draws a checkbox on every row. A `single` one draws none\n * and marks the chosen row alone, since a checkbox promises a choice that\n * leaves the others standing; `selectionBehavior` overrides either.\n *\n * ListItem is the static row — one row, presenting, on its own. This is the\n * collection that draws the same row and adds selection, keyboard navigation\n * between rows, sections and a load-more sentinel.\n *\n * Composed from parts, since a row's slots take arbitrary content:\n * `List.Item`, `List.Section` and `List.LoadMore`. Name the list with\n * `aria-label` or `aria-labelledby` — nothing here labels it for you.\n *\n * The call site's `className` and `style` land on the container, which is\n * the element a layout positions.\n */\nfunction List<T extends object>({\n selectionBehavior,\n selectLabel,\n ...props\n}: ListProps<T> & RefAttributes<HTMLDivElement>) {\n // React Aria's own reading of a draggable collection: hooks that can build\n // the drag state.\n const rowsAct = (props.selectionMode ?? 'none') !== 'none' || props.onAction !== undefined || props.dragAndDropHooks?.useDraggableCollectionState !== undefined;\n return <SelectLabelContext value={selectLabel}>\n <RowsActContext value={rowsAct}>\n <RACGridList {...props} {...mergeStatefulStyles(containerClasses, props)}\n // React Aria's own default is `toggle` in every mode. Read with `??`\n // rather than placed before the spread, so a wrapper forwarding an\n // unset prop still gets the default.\n selectionBehavior={selectionBehavior ?? (props.selectionMode === 'single' ? 'replace' : 'toggle')} />\n </RowsActContext>\n </SelectLabelContext>;\n}\n\n/**\n * The row the list shows while it is fetching more. React Aria calls\n * `onLoadMore` when this comes into view, and draws it only while\n * `isLoading`.\n */\nfunction ListLoadMore({\n label,\n ...props\n}: ListLoadMoreProps & RefAttributes<HTMLDivElement>) {\n return <RACGridListLoadMoreItem {...props} {...mergeStyles(stylex.props(collectionStyles.loading), props)}>\n <CollectionLoadMore diameter=\"24px\" label={label} />\n </RACGridListLoadMoreItem>;\n}\n\n/**\n * One row. Its slots are the row's: `leading`, the headline as children,\n * `supporting` under it, and `trailing`. Give every row an `id` — that is\n * the key selection is reported by.\n *\n * A list that selects with checkboxes draws one before whatever `leading`\n * holds, from the state React Aria reports rather than from a prop here.\n */\nfunction ListRow<T extends object = object>({\n children,\n leading,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n overline,\n supporting,\n textValue,\n trailing,\n ...props\n}: ListRowProps<T> & RefAttributes<HTMLDivElement>) {\n const selectLabel = useContext(SelectLabelContext);\n const acts = useContext(RowsActContext) || props.onAction !== undefined || props.href !== undefined;\n // The press ripple ListItem draws, so a row looks the same pressed in a\n // list as on its own, and only on a row a press acts on, as ListItem draws\n // it only on an interactive one: a row that does nothing on a press should\n // not look as though it did. The call site's pointer handlers are handed to\n // the hook to merge, for the reason ListItem gives, apart from the press\n // itself, which `startsRipple` hands on. React Aria keeps a row's clicks\n // for its own press handling, so the press ends on the release.\n const ripple = useRipple<HTMLDivElement>(acts, {\n onContextMenu,\n onPointerCancel,\n onPointerLeave,\n onPointerUp\n }, true);\n return <RACGridListItem textValue={textValue ?? textOf(children)} {...ripple.handlers} onPointerDown={startsRipple(ripple.handlers.onPointerDown, onPointerDown)} {...props} {...mergeStatefulStyles(rowItemStyles(supporting, overline), props)}>\n {itemContent(children, leading, overline, supporting, trailing, selectLabel, ripple.surface)}\n </RACGridListItem>;\n}\n\n/**\n * A named group of rows. `header` names it, and is what a screen reader\n * reads before the rows inside.\n */\nfunction ListSection<T extends object = object>({\n children,\n header,\n ...props\n}: ListSectionProps<T> & RefAttributes<HTMLDivElement>) {\n return <RACGridListSection {...props} {...mergeStyles(stylex.props(collectionStyles.section), props)}>\n {header === undefined ? null : <RACGridListHeader {...stylex.props(collectionStyles.header)}>\n {header}\n </RACGridListHeader>}\n {children}\n </RACGridListSection>;\n}\n\n// The row's press: the ripple's, unless it lands on a control inside the\n// row, which answers it itself — a trailing button pressed spread the row's\n// ripple across the whole row. The call site's own handler runs either way,\n// after the ripple's, as the hook orders the two. Built by a call rather than\n// written at the prop, for the reason `itemContent` gives.\nfunction startsRipple(ripple: PointerEventHandler<HTMLDivElement> | undefined, own: PointerEventHandler<HTMLDivElement> | undefined) {\n return (event: PointerEvent<HTMLDivElement>) => {\n if (!landsOnControl(event)) {\n ripple?.(event);\n }\n own?.(event);\n };\n}\nList.Item = ListRow;\nList.LoadMore = ListLoadMore;\nList.Section = ListSection;\nexport type { ListLoadMoreProps, ListProps, ListRowProps, ListSectionProps };\nexport { ListLoadMore, ListRow, ListSection };\nexport default List;"],"mappings":";;;;;;;;;;;;;;AAoDA,MAAMsC,qBAAqBtB,cAAkCuB,KAAAA,CAAS;AAOtE,MAAMC,iBAAiBxB,cAAc,KAAK;AAQ1C,MAAMyB,iBAAiB;AAkFvB,SAASkB,YAAYP,UAAqBC,SAAoBC,UAAqBC,YAAuBC,UAAqBP,aAAiCW,QAAmB;CACjL,QAAQC,UAAmC,qBAAA,YAAA,EAAA,UAAA,CACvC,oBAAC,YAAD;EAAY,YAAYA,MAAMC;EAAY,YAAYD,MAAME;EAAY,SAASC,WAAWH,OAAOR,SAASJ,WAAW;EAAaK;EAAsBC;EAAsB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AACJ,EAAA,KAAAD;EAAAC,EAAA,KAAAC;EAAAD,EAAA,KAAAzB;EAAAyB,EAAA,KAAAnB;EAAAmB,EAAA,KAAAK;EAAAL,EAAA,KAAAM;CAAA,OAAA;EAAAL,KAAAD,EAAA;EAAAzB,WAAAyB,EAAA;EAAAnB,SAAAmB,EAAA;EAAAK,KAAAL,EAAA;EAAAM,KAAAN,EAAA;CAAA;CAAA,IAAAO;CAAA,IAAAP,EAAA,OAAAnB,QAAA;EAC/F0B,KAAA1B,WAAWnB,KAAAA,IAAX,OAA8B,oBAACkF,gBAAD;GAAkB,GAAK1G,MAAac,iBAAgB6B,MAAO;GACrFA,UAAAA;EAD4C,CAAA;EAE3BmB,EAAA,KAAAnB;EAAAmB,EAAA,KAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,OAAAC,MAAAD,EAAA,OAAAzB,YAAAyB,EAAA,QAAAK,MAAAL,EAAA,QAAAM,MAAAN,EAAA,QAAAO,IAAA;EAHnBC,KAAA,qBAAC,IAAD;GAAmB,GAAKJ;GAAK,GAAME;GAAnC,UAAA,CACFC,IAGAhC,QAJqB;;EAKHyB,EAAA,KAAAC;EAAAD,EAAA,KAAAzB;EAAAyB,EAAA,MAAAK;EAAAL,EAAA,MAAAM;EAAAN,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OALhBQ;AAKgB;AAQzB,SAASqB,aAAa9C,QAAyDkD,KAAsD;CACnI,QAAQ5C,UAAwC;EAC9C,IAAI,CAACD,eAAeC,KAAK,GACvBN,SAASM,KAAK;EAEhB4C,MAAM5C,KAAK;CACb;AACF;AACAS,KAAKoC,OAAOf;AACZrB,KAAKqC,WAAWlB;AAChBnB,KAAKsC,UAAUL"}
@@ -13,8 +13,9 @@ type ListDetailProps = {
13
13
  */
14
14
  list?: ReactNode;
15
15
  /**
16
- * Which pane to show while only one fits, below the expanded breakpoint.
17
- * Both are shown from expanded up, where this is ignored.
16
+ * Which pane to show while only one fits, while the layout is narrower than
17
+ * the expanded breakpoint. Both are shown once it is that wide, where this
18
+ * is ignored. The width is the layout's own rather than the window's.
18
19
  *
19
20
  * Controlled, with no uncontrolled fallback: the layout cannot know that an
20
21
  * item was selected or that the reader went back, so holding that state
@@ -36,6 +37,13 @@ type ListDetailProps = {
36
37
  * Material Design's list-detail layout: a fixed list pane beside a flexible
37
38
  * detail pane, collapsing to one pane at a time below the expanded breakpoint.
38
39
  *
40
+ * The breakpoints are compared against the layout's own width, not the
41
+ * window's, so a list-detail beside a navigation drawer or inside a sheet
42
+ * shows one pane until it has the room for two. It takes that width from
43
+ * its parent and none from its panes, so in a parent that shrinks to fit
44
+ * what it holds — an inline-flex row, a float, a flex item with no basis —
45
+ * give it a width of its own.
46
+ *
39
47
  * Layout only — neither pane paints a surface of its own, so what goes inside
40
48
  * them is composed at the call site. `render` swaps the container's element,
41
49
  * for a layout that should be a `<main>` rather than a `<div>`.
@@ -44,7 +52,7 @@ type ListDetailProps = {
44
52
  * Material Design asks of co-planar panes: focus order has to match the
45
53
  * arrangement on screen.
46
54
  *
47
- * Below the expanded breakpoint the pane that is not showing is hidden
55
+ * While only one pane fits, the pane that is not showing is hidden
48
56
  * outright, so focus inside it is dropped when `showing` changes. The call
49
57
  * site that changed it is what puts focus in the pane it revealed — see the
50
58
  * prop.
@@ -8,6 +8,13 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
8
  * Material Design's list-detail layout: a fixed list pane beside a flexible
9
9
  * detail pane, collapsing to one pane at a time below the expanded breakpoint.
10
10
  *
11
+ * The breakpoints are compared against the layout's own width, not the
12
+ * window's, so a list-detail beside a navigation drawer or inside a sheet
13
+ * shows one pane until it has the room for two. It takes that width from
14
+ * its parent and none from its panes, so in a parent that shrinks to fit
15
+ * what it holds — an inline-flex row, a float, a flex item with no basis —
16
+ * give it a width of its own.
17
+ *
11
18
  * Layout only — neither pane paints a surface of its own, so what goes inside
12
19
  * them is composed at the call site. `render` swaps the container's element,
13
20
  * for a layout that should be a `<main>` rather than a `<div>`.
@@ -16,7 +23,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
23
  * Material Design asks of co-planar panes: focus order has to match the
17
24
  * arrangement on screen.
18
25
  *
19
- * Below the expanded breakpoint the pane that is not showing is hidden
26
+ * While only one pane fits, the pane that is not showing is hidden
20
27
  * outright, so focus inside it is dropped when `showing` changes. The call
21
28
  * site that changed it is what puts focus in the pane it revealed — see the
22
29
  * prop.
@@ -39,8 +46,8 @@ function ListDetail(t0) {
39
46
  let t8;
40
47
  if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
41
48
  t8 = {
42
- 0: { className: "x9f619 xeuugli" },
43
- 1: { className: "x9f619 xeuugli x1s85apg x9a4l8x" }
49
+ 0: { className: "x9f619 xeuugli x1kk7mra x7v35i x1r8uery x11pqzan x1iyjqo2 x1fllpej xs83m0k" },
50
+ 1: { className: "x9f619 xeuugli x1kk7mra x7v35i x1r8uery x11pqzan x1iyjqo2 x1fllpej xs83m0k xsfcrho x1s85apg" }
44
51
  };
45
52
  $[7] = t8;
46
53
  } else t8 = $[7];
@@ -58,8 +65,8 @@ function ListDetail(t0) {
58
65
  let t11;
59
66
  if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
60
67
  t11 = {
61
- 0: { className: "x9f619 xeuugli" },
62
- 1: { className: "x9f619 xeuugli x1s85apg x9a4l8x" }
68
+ 0: { className: "x9f619 xeuugli x1r8uery x1iyjqo2 xs83m0k" },
69
+ 1: { className: "x9f619 xeuugli x1r8uery x1iyjqo2 xs83m0k xsfcrho x1s85apg" }
63
70
  };
64
71
  $[11] = t11;
65
72
  } else t11 = $[11];
@@ -80,7 +87,7 @@ function ListDetail(t0) {
80
87
  $[16] = t13;
81
88
  $[17] = t2;
82
89
  } else t2 = $[17];
83
- t3 = mergeStyles({ className: "x9f619 xrvj5dj xj2l1yv x1mkdm3x xkgydl7 xxxc7o5" }, props);
90
+ t3 = mergeStyles({ className: "x9f619 x12h1iku x78zum5 xj2l1yv" }, props);
84
91
  $[0] = t0;
85
92
  $[1] = render;
86
93
  $[2] = t1;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","ReactNode","stylex","RenderComponentProps","useRender","mergeStyles","media","spacing","LIST_PANE","LIST_PANE_EXTRA_LARGE","ListDetailProps","detail","list","showing","Omit","ListDetail","t0","$","render","t1","t2","t3","t4","t5","t6","t7","props","undefined","t8","Symbol","for","0","className","1","t9","t10","t11","t12","t13","children","defaultTagName","_c"],"sources":["../../../src/components/list-detail/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { media, spacing } from '../../tokens/design.tokens.stylex';\n\n// Material Design's recommended snap widths for a fixed pane. The list is the\n// fixed one here — Material Design points a fixed pane at \"lists with light\n// information density\" — and the detail pane is the flexible one that absorbs\n// whatever is left, which satisfies the spec's rule that every layout carry at\n// least one flexible pane.\nconst LIST_PANE = '360px';\nconst LIST_PANE_EXTRA_LARGE = '412px';\n\n// One of Material Design's canonical layouts, and the fixed-and-flexible shape\n// of its two-pane layouts. Unlike SupportingPane, the detail pane here stands\n// on its own: a message, a product, a file. That is what makes showing it\n// *instead of* the list a coherent thing to do when only one pane fits, and\n// why this layout has to be told which pane is showing while SupportingPane\n// does not.\n//\n// Material Design puts the second pane on screen from expanded up. Below that\n// the spec shows one pane at a time, with selecting an item swapping to the\n// detail and back returning to the list — app navigation rather than layout,\n// which is why `showing` is controlled rather than held here.\n\ntype ListDetailProps = {\n /**\n * The selected item's content. Stands on its own, and takes the flexible\n * pane.\n */\n detail?: ReactNode;\n /**\n * The items to choose between. Takes the fixed pane — 360px wide, 412px at\n * extra-large.\n */\n list?: ReactNode;\n /**\n * Which pane to show while only one fits, below the expanded breakpoint.\n * Both are shown from expanded up, where this is ignored.\n *\n * Controlled, with no uncontrolled fallback: the layout cannot know that an\n * item was selected or that the reader went back, so holding that state\n * here would only ever be wrong.\n *\n * **Moving focus into the revealed pane comes with flipping this.** The\n * pane being left is hidden outright, so a keyboard or screen reader inside\n * it lands on the body and the next Tab starts from the top of the page.\n * The same reason this prop is controlled is why the move is not made here:\n * only the call site knows whether a key, a pointer or the history put it\n * in that state, and what inside the pane to send focus to. Both panes hold\n * nodes it supplied, so it has something to aim at — a heading given\n * `tabIndex={-1}`, or a ref it already holds.\n * @default 'list'\n */\n showing?: 'detail' | 'list';\n} & Omit<RenderComponentProps<'div'>, 'children'>;\n\n/**\n * Material Design's list-detail layout: a fixed list pane beside a flexible\n * detail pane, collapsing to one pane at a time below the expanded breakpoint.\n *\n * Layout only — neither pane paints a surface of its own, so what goes inside\n * them is composed at the call site. `render` swaps the container's element,\n * for a layout that should be a `<main>` rather than a `<div>`.\n *\n * The panes are written to the DOM in the order they are shown, which is what\n * Material Design asks of co-planar panes: focus order has to match the\n * arrangement on screen.\n *\n * Below the expanded breakpoint the pane that is not showing is hidden\n * outright, so focus inside it is dropped when `showing` changes. The call\n * site that changed it is what puts focus in the pane it revealed — see the\n * prop.\n */\nfunction ListDetail({\n detail,\n list,\n render,\n showing = 'list',\n ...props\n}: ListDetailProps) {\n return useRender({\n defaultTagName: 'div',\n props: {\n ...props,\n children: <>\n <div {...{\n 0: {\n className: \"x9f619 xeuugli\"\n },\n 1: {\n className: \"x9f619 xeuugli x1s85apg x9a4l8x\"\n }\n }[!!(showing === 'detail') << 0]}>\n {list}\n </div>\n <div {...{\n 0: {\n className: \"x9f619 xeuugli\"\n },\n 1: {\n className: \"x9f619 xeuugli x1s85apg x9a4l8x\"\n }\n }[!!(showing === 'list') << 0]}>\n {detail}\n </div>\n </>,\n ...mergeStyles({\n className: \"x9f619 xrvj5dj xj2l1yv x1mkdm3x xkgydl7 xxxc7o5\"\n }, props)\n },\n render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BhB;AAAC"}
1
+ {"version":3,"file":"index.js","names":["c","_c","ReactNode","stylex","RenderComponentProps","useRender","mergeStyles","container","spacing","LIST_PANE","LIST_PANE_EXTRA_LARGE","ListDetailProps","detail","list","showing","Omit","ListDetail","t0","$","render","t1","t2","t3","t4","t5","t6","t7","props","undefined","t8","Symbol","for","0","className","1","t9","t10","t11","t12","t13","children","defaultTagName","_c"],"sources":["../../../src/components/list-detail/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport type { RenderComponentProps } from '../../render/useRender';\nimport { useRender } from '../../render/useRender';\nimport { mergeStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { container, spacing } from '../../tokens/design.tokens.stylex';\n\n// Material Design's recommended snap widths for a fixed pane. The list is the\n// fixed one here — Material Design points a fixed pane at \"lists with light\n// information density\" — and the detail pane is the flexible one that absorbs\n// whatever is left, which satisfies the spec's rule that every layout carry at\n// least one flexible pane.\nconst LIST_PANE = '360px';\nconst LIST_PANE_EXTRA_LARGE = '412px';\n\n// One of Material Design's canonical layouts, and the fixed-and-flexible shape\n// of its two-pane layouts. Unlike SupportingPane, the detail pane here stands\n// on its own: a message, a product, a file. That is what makes showing it\n// *instead of* the list a coherent thing to do when only one pane fits, and\n// why this layout has to be told which pane is showing while SupportingPane\n// does not.\n//\n// Material Design puts the second pane on screen from expanded up. Below that\n// the spec shows one pane at a time, with selecting an item swapping to the\n// detail and back returning to the list — app navigation rather than layout,\n// which is why `showing` is controlled rather than held here.\n//\n// **The breakpoints are the layout's own width, not the window's.** The root\n// is a query container, and both panes ask it through `container` rather than\n// `media`: a list-detail beside a navigation drawer, or inside a sheet, has\n// less room than the window, and laying two panes out by the window's width\n// squeezed the detail to a sliver. The thresholds are still Material Design's\n// window size classes, compared against the room the layout is given.\n//\n// That is also why the root is a flex row rather than a grid. A container\n// query reaches the container's descendants and never the container itself,\n// so the root cannot change its own tracks by its width; the panes size\n// themselves instead.\n\ntype ListDetailProps = {\n /**\n * The selected item's content. Stands on its own, and takes the flexible\n * pane.\n */\n detail?: ReactNode;\n /**\n * The items to choose between. Takes the fixed pane — 360px wide, 412px at\n * extra-large.\n */\n list?: ReactNode;\n /**\n * Which pane to show while only one fits, while the layout is narrower than\n * the expanded breakpoint. Both are shown once it is that wide, where this\n * is ignored. The width is the layout's own rather than the window's.\n *\n * Controlled, with no uncontrolled fallback: the layout cannot know that an\n * item was selected or that the reader went back, so holding that state\n * here would only ever be wrong.\n *\n * **Moving focus into the revealed pane comes with flipping this.** The\n * pane being left is hidden outright, so a keyboard or screen reader inside\n * it lands on the body and the next Tab starts from the top of the page.\n * The same reason this prop is controlled is why the move is not made here:\n * only the call site knows whether a key, a pointer or the history put it\n * in that state, and what inside the pane to send focus to. Both panes hold\n * nodes it supplied, so it has something to aim at — a heading given\n * `tabIndex={-1}`, or a ref it already holds.\n * @default 'list'\n */\n showing?: 'detail' | 'list';\n} & Omit<RenderComponentProps<'div'>, 'children'>;\n\n/**\n * Material Design's list-detail layout: a fixed list pane beside a flexible\n * detail pane, collapsing to one pane at a time below the expanded breakpoint.\n *\n * The breakpoints are compared against the layout's own width, not the\n * window's, so a list-detail beside a navigation drawer or inside a sheet\n * shows one pane until it has the room for two. It takes that width from\n * its parent and none from its panes, so in a parent that shrinks to fit\n * what it holds — an inline-flex row, a float, a flex item with no basis —\n * give it a width of its own.\n *\n * Layout only — neither pane paints a surface of its own, so what goes inside\n * them is composed at the call site. `render` swaps the container's element,\n * for a layout that should be a `<main>` rather than a `<div>`.\n *\n * The panes are written to the DOM in the order they are shown, which is what\n * Material Design asks of co-planar panes: focus order has to match the\n * arrangement on screen.\n *\n * While only one pane fits, the pane that is not showing is hidden\n * outright, so focus inside it is dropped when `showing` changes. The call\n * site that changed it is what puts focus in the pane it revealed — see the\n * prop.\n */\nfunction ListDetail({\n detail,\n list,\n render,\n showing = 'list',\n ...props\n}: ListDetailProps) {\n return useRender({\n defaultTagName: 'div',\n props: {\n ...props,\n children: <>\n <div {...{\n 0: {\n className: \"x9f619 xeuugli x1kk7mra x7v35i x1r8uery x11pqzan x1iyjqo2 x1fllpej xs83m0k\"\n },\n 1: {\n className: \"x9f619 xeuugli x1kk7mra x7v35i x1r8uery x11pqzan x1iyjqo2 x1fllpej xs83m0k xsfcrho x1s85apg\"\n }\n }[!!(showing === 'detail') << 0]}>\n {list}\n </div>\n <div {...{\n 0: {\n className: \"x9f619 xeuugli x1r8uery x1iyjqo2 xs83m0k\"\n },\n 1: {\n className: \"x9f619 xeuugli x1r8uery x1iyjqo2 xs83m0k xsfcrho x1s85apg\"\n }\n }[!!(showing === 'list') << 0]}>\n {detail}\n </div>\n </>,\n ...mergeStyles({\n className: \"x9f619 x12h1iku x78zum5 xj2l1yv\"\n }, props)\n },\n render\n });\n}\nexport type { ListDetailProps };\nexport default ListDetail;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmGA,SAAAgB,WAAAC,IAAA;CAAA,MAAAC,IAAAjB,EAAA,EAAA;CAAA,IAAAkB;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAN,EAAA,OAAAD,IAAA;EAAoB,MAAA,EAAAL,QAAAC,MAAAM,QAAAM,IAAAX,SAAAY,IAAA,GAAAC,UAAAV;EAAAE,SAAAM;EAIlB,MAAAX,UAAAY,OAAAE,KAAAA,IAAA,SAAAF;EAGOrB,KAAAA;EACWkB,KAAA;EAEXI,KAAAA;EAAK,IAAAE;EAAA,IAAAX,EAAA,OAAAY,OAAAC,IAAA,2BAAA,GAAA;GAEKF,KAAA;IAAAG,GACN,EAAAC,WACU,6EACb;IAACC,GACE,EAAAD,WACU,8FACb;GACF;GAACf,EAAA,KAAAW;EAAA,OAAAA,KAAAX,EAAA;EAPU,MAAAiB,KAAAN,GAOT,CAAC,EAAEf,YAAY,aAAa;EAAE,IAAAsB;EAAA,IAAAlB,EAAA,OAAAL,Q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AAP,EAAA,QAAAE,MAAAF,EAAA,QAAAG,MAAAH,EAAA,QAAAI,IAAA;EA1BJG,KAAA;GAAA,GACFE;GAAKa,UACEnB;GAqBL,GACFC;EAGL;EAACJ,EAAA,MAAAE;EAAAF,EAAA,MAAAG;EAAAH,EAAA,MAAAI;EAAAJ,EAAA,MAAAO;CAAA,OAAAA,KAAAP,EAAA;CAAA,IAAAQ;CAAA,IAAAR,EAAA,QAAAC,UAAAD,EAAA,QAAAK,MAAAL,EAAA,QAAAO,IAAA;EA7BcC,KAAA;GAAAe,gBACClB;GAAKI,OACdF;GA2BNN;EAEH;EAACD,EAAA,MAAAC;EAAAD,EAAA,MAAAK;EAAAL,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OA/BMb,GAAUqB,EA+BhB;AAAC"}
@@ -6,6 +6,11 @@ type ListItemProps = {
6
6
  /**
7
7
  * Renders a `<button>` that ripples and tints on hover, for a row that is
8
8
  * itself pressable. Leave it off for a row that only presents.
9
+ *
10
+ * Only an interactive row takes `onClick`, `onContextMenu` and the pointer
11
+ * handlers. A row that only presents is a `<div>` that cannot be focused or
12
+ * operated from the keyboard, so a handler on it would answer a mouse and
13
+ * nothing else.
9
14
  * @default false
10
15
  */
11
16
  interactive?: boolean;
@@ -31,7 +36,17 @@ type ListItemProps = {
31
36
  supporting?: ReactNode;
32
37
  /** Content after the headline, such as an amount or a control. */
33
38
  trailing?: ReactNode;
34
- } & HTMLAttributes<HTMLElement>;
39
+ } & HTMLAttributes<HTMLElement> & ({
40
+ interactive: true;
41
+ } | {
42
+ interactive?: false;
43
+ onClick?: never;
44
+ onContextMenu?: never;
45
+ onPointerCancel?: never;
46
+ onPointerDown?: never;
47
+ onPointerLeave?: never;
48
+ onPointerUp?: never;
49
+ });
35
50
  /**
36
51
  * A static row: the row every list draws, on its own, as the lists spec page
37
52
  * gives it — a 56px one-line container, a body-large headline and a
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","HTMLAttributes","ReactNode","RefAttributes","stylex","useRipple","hasContent","refCallback","RowContent","rowStyles","mergeStyles","ListItemProps","children","interactive","isDisabled","leading","overline","supporting","trailing","HTMLElement","ListItem","t0","$","t1","t2","onClick","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","ref","props","undefined","t3","ripple","extraLines","twoLine","threeLine","t4","forwarded","t5","content","handlers","base","list","disabled","t6","t7","t8","interactiveLayers","t9","surface","_c","props","stylex.props"],"sources":["../../../src/components/list-item/index.tsx"],"sourcesContent":["'use client';\n\nimport type { HTMLAttributes, ReactNode, RefAttributes } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { useRipple } from '../../hooks/useRipple';\nimport { hasContent } from '../../render/content';\nimport { refCallback } from '../../render/ref';\nimport { RowContent } from '../../row';\nimport { rowStyles } from '../../row/styles';\nimport { mergeStyles } from '../../styles/merge';\ntype ListItemProps = {\n /** The row's headline — the one thing it is mostly about. */\n children?: ReactNode;\n /**\n * Renders a `<button>` that ripples and tints on hover, for a row that is\n * itself pressable. Leave it off for a row that only presents.\n * @default false\n */\n interactive?: boolean;\n /**\n * Draws the row disabled, in the treatment every row in the library shares:\n * its text fades to on-surface at the disabled content opacity, overline\n * and supporting line included. An interactive row's button is disabled\n * outright: it takes no focus, no hover tint, no press and no ripple. A row\n * that only presents has nothing to disable, and is marked `aria-disabled`\n * instead so the state it draws is announced as well.\n * @default false\n */\n isDisabled?: boolean;\n /** Content before the headline: an avatar, an icon, a checkbox. */\n leading?: ReactNode;\n /**\n * A line above the headline, in the page's label-small and the same muted\n * role the supporting line takes — a category, a date, a status. Given\n * alongside `supporting` it makes the row the page's three-line item.\n */\n overline?: ReactNode;\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n /** Content after the headline, such as an amount or a control. */\n trailing?: ReactNode;\n} & HTMLAttributes<HTMLElement>;\n\n/**\n * A static row: the row every list draws, on its own, as the lists spec page\n * gives it — a 56px one-line container, a body-large headline and a\n * body-medium supporting line. A second line takes it to the page's 72px\n * two-line container; an `overline` puts that second line above the headline\n * instead of below it, and an overline with a supporting line makes the\n * page's three-line item, an 88px container with the leading and trailing\n * slots held at the top rather than centred. The layout and the states are\n * the row module's in `src/row`, shared with every collection item; what is\n * here is the element around them — a `<div>` that presents, or a `<button>`\n * that ripples — and the props that fill the slots.\n */\nfunction ListItem({\n children,\n interactive = false,\n isDisabled = false,\n leading,\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n overline,\n ref,\n supporting,\n trailing,\n ...props\n}: ListItemProps & RefAttributes<HTMLButtonElement | HTMLDivElement>) {\n // The consumer's own pointer handlers are handed to useRipple to merge\n // rather than left in `props` to be spread over its handlers afterwards,\n // which is what Card and Button do and for the same reason: a plain spread\n // means whichever object comes last silently wins, so an onClick on the\n // call site would replace the one that ends the press and the row would\n // stay visibly pressed. The hook runs its own handler first and the\n // consumer's second, and hands them straight back when the ripple is off,\n // which is what puts them on the presenting <div> below. The host is\n // `HTMLElement` rather than the button: the same handlers now reach both\n // elements, and only the type `ListItemProps` already declares is assignable\n // to a <div>'s props as well as a <button>'s.\n //\n // Off on a disabled row as well as on one that only presents. A press on a\n // disabled button still delivers its pointerdown and pointerup, and\n // withholds only the click, which is what ends a press — so a ripple left\n // on would start and then stay drawn.\n const ripple = useRipple<HTMLElement>(interactive && !isDisabled, {\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n });\n\n // Which of the page's three items this row is, read from the content rather\n // than taken as a prop: a row holding all three lines already says it is\n // three lines, and a word for it would be a second place to get it wrong.\n // A line that wraps grows the row past its container height on its own and\n // keeps its slots centred, which is the shorter item made taller rather\n // than the next one along.\n //\n // The three-line item is the only row whose slots move, which is why it\n // alone carries an alignment as well as a height.\n const extraLines = (hasContent(overline) ? 1 : 0) + (hasContent(supporting) ? 1 : 0);\n const twoLine = extraLines === 1;\n const threeLine = extraLines === 2;\n\n // A presenting row is a <div> and an interactive one a <button>, so the\n // ref is typed as either and handed to each as the callback both accept —\n // see src/render/ref.ts.\n const forwarded = refCallback(ref);\n const content = <RowContent isDisabled={isDisabled} leading={leading} overline={overline} supporting={supporting} trailing={trailing}>\n {children}\n </RowContent>;\n\n // `disabled` goes last in both lists. On the button that is what lets it\n // win over the interactive style, as it does on every collection item:\n // StyleX replaces a property whole, which takes the hover and pressed tints\n // and the pointer cursor with it.\n if (!interactive) {\n return <div aria-disabled={isDisabled || undefined} ref={forwarded} {...props} {...ripple.handlers} {...mergeStyles(stylex.props(rowStyles.base, rowStyles.list, twoLine && rowStyles.twoLine, threeLine && rowStyles.threeLine, isDisabled && rowStyles.disabled), props)}>\n {content}\n </div>;\n }\n return <button disabled={isDisabled} ref={forwarded} type=\"button\" {...ripple.handlers} {...props} {...mergeStyles(stylex.props(rowStyles.base, rowStyles.list, rowStyles.interactive, rowStyles.interactiveLayers, twoLine && rowStyles.twoLine, threeLine && rowStyles.threeLine, isDisabled && rowStyles.disabled), props)}>\n {content}\n {ripple.surface}\n </button>;\n}\nexport type { ListItemProps };\nexport default ListItem;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuDA,SAAAqB,SAAAC,IAAA;CAAA,MAAAC,IAAAtB,EAAA,EAAA;CAAkB,MAAA,EAAAY,UAAAC,aAAAU,IAAAT,YAAAU,IAAAT,SAAAU,SAAAC,eAAAC,iBAAAC,eAAAC,gBAAAC,aAAAd,UAAAe,KAAAd,YAAAC,UAAA,GAAAc,YAAAX;CAEhB,MAAAR,cAAAU,OAAAU,KAAAA,IAAA,QAAAV;CACA,MAAAT,aAAAU,OAAAS,KAAAA,IAAA,QAAAT;CAAkB,IAAAU;CAAA,IAAAZ,EAAA,OAAAG,WAAAH,EAAA,OAAAI,iBAAAJ,EAAA,OAAAK,mBAAAL,EAAA,OAAAM,iBAAAN,EAAA,OAAAO,kBAAAP,EAAA,OAAAQ,aAAA;EA8BgDI,KAAA;GAAAT;GAA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,SAAUC,aAAa7B,UAAS6B,WAAYxB,cAAcL,UAASqC,QAAS,GAAGd,OAAK;EACpQU,UAAAA;CACG,CAAA;CAEgD,MAAAK,KAAA;CAAa,MAAAC,KAAAb,OAAMQ;CAA0B,MAAAM,KAAAvC,YAAYN,MAAaK,UAASmC,MAAOnC,UAASoC,MAAOpC,UAASI,aAAcJ,UAASyC,mBAAoBb,WAAW5B,UAAS4B,SAAUC,aAAa7B,UAAS6B,WAAYxB,cAAcL,UAASqC,QAAS,GAAGd,OAAK;CAAC,IAAAmB;CAAA,IAAA7B,EAAA,QAAAoB,WAAApB,EAAA,QAAAkB,aAAAlB,EAAA,QAAAR,cAAAQ,EAAA,QAAAU,WAAAV,EAAA,QAAAa,OAAAQ,YAAArB,EAAA,QAAAa,OAAAiB,WAAA9B,EAAA,QAAA2B,IAAA;EAAtTE,KAAA,qBAAA,UAAA;GAAkBrC,UAAAA;GAAiB0B,KAAAA;GAAgB,MAAAO;GAAQ,GAAKC;GAAe,GAAMhB;GAAK,GAAMiB;GAAhG,UAAA,CACFP,SACAP,OAAMiB,OACA;;EAAA9B,EAAA,MAAAoB;EAAApB,EAAA,MAAAkB;EAAAlB,EAAA,MAAAR;EAAAQ,EAAA,MAAAU;EAAAV,EAAA,MAAAa,OAAAQ;EAAArB,EAAA,MAAAa,OAAAiB;EAAA9B,EAAA,MAAA2B;EAAA3B,EAAA,MAAA6B;CAAA,OAAAA,KAAA7B,EAAA;CAAA,OAHJ6B;AAGI"}
1
+ {"version":3,"file":"index.js","names":["c","_c","HTMLAttributes","ReactNode","RefAttributes","stylex","useRipple","hasContent","refCallback","RowContent","rowStyles","mergeStyles","ListItemProps","children","interactive","isDisabled","leading","overline","supporting","trailing","HTMLElement","onClick","onContextMenu","onPointerCancel","onPointerDown","onPointerLeave","onPointerUp","ListItem","t0","$","t1","t2","ref","props","undefined","t3","ripple","extraLines","twoLine","threeLine","t4","forwarded","t5","content","handlers","base","list","disabled","t6","t7","t8","interactiveLayers","t9","surface","_c","props","stylex.props"],"sources":["../../../src/components/list-item/index.tsx"],"sourcesContent":["'use client';\n\nimport type { HTMLAttributes, ReactNode, RefAttributes } from 'react';\nimport * as stylex from '@stylexjs/stylex';\nimport { useRipple } from '../../hooks/useRipple';\nimport { hasContent } from '../../render/content';\nimport { refCallback } from '../../render/ref';\nimport { RowContent } from '../../row';\nimport { rowStyles } from '../../row/styles';\nimport { mergeStyles } from '../../styles/merge';\ntype ListItemProps = {\n /** The row's headline — the one thing it is mostly about. */\n children?: ReactNode;\n /**\n * Renders a `<button>` that ripples and tints on hover, for a row that is\n * itself pressable. Leave it off for a row that only presents.\n *\n * Only an interactive row takes `onClick`, `onContextMenu` and the pointer\n * handlers. A row that only presents is a `<div>` that cannot be focused or\n * operated from the keyboard, so a handler on it would answer a mouse and\n * nothing else.\n * @default false\n */\n interactive?: boolean;\n /**\n * Draws the row disabled, in the treatment every row in the library shares:\n * its text fades to on-surface at the disabled content opacity, overline\n * and supporting line included. An interactive row's button is disabled\n * outright: it takes no focus, no hover tint, no press and no ripple. A row\n * that only presents has nothing to disable, and is marked `aria-disabled`\n * instead so the state it draws is announced as well.\n * @default false\n */\n isDisabled?: boolean;\n /** Content before the headline: an avatar, an icon, a checkbox. */\n leading?: ReactNode;\n /**\n * A line above the headline, in the page's label-small and the same muted\n * role the supporting line takes — a category, a date, a status. Given\n * alongside `supporting` it makes the row the page's three-line item.\n */\n overline?: ReactNode;\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n /** Content after the headline, such as an amount or a control. */\n trailing?: ReactNode;\n} & HTMLAttributes<HTMLElement> &\n// The handlers a press delivers, which a row that only presents refuses:\n// with no role, no `tabIndex` and no key handler, it would run them for a\n// pointer alone. `never` rather than leaving them out, since an omitted key\n// is still accepted from the `HTMLAttributes` beside it.\n({\n interactive: true;\n} | {\n interactive?: false;\n onClick?: never;\n onContextMenu?: never;\n onPointerCancel?: never;\n onPointerDown?: never;\n onPointerLeave?: never;\n onPointerUp?: never;\n});\n\n/**\n * A static row: the row every list draws, on its own, as the lists spec page\n * gives it — a 56px one-line container, a body-large headline and a\n * body-medium supporting line. A second line takes it to the page's 72px\n * two-line container; an `overline` puts that second line above the headline\n * instead of below it, and an overline with a supporting line makes the\n * page's three-line item, an 88px container with the leading and trailing\n * slots held at the top rather than centred. The layout and the states are\n * the row module's in `src/row`, shared with every collection item; what is\n * here is the element around them — a `<div>` that presents, or a `<button>`\n * that ripples — and the props that fill the slots.\n */\nfunction ListItem({\n children,\n interactive = false,\n isDisabled = false,\n leading,\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp,\n overline,\n ref,\n supporting,\n trailing,\n ...props\n}: ListItemProps & RefAttributes<HTMLButtonElement | HTMLDivElement>) {\n // The consumer's own pointer handlers are handed to useRipple to merge\n // rather than left in `props` to be spread over its handlers afterwards,\n // which is what Card and Button do and for the same reason: a plain spread\n // means whichever object comes last silently wins, so an onClick on the\n // call site would replace the one that ends the press and the row would\n // stay visibly pressed. The hook runs its own handler first and the\n // consumer's second, and hands them straight back when the ripple is off,\n // which is what puts them on the presenting <div> below. The host is\n // `HTMLElement` rather than the button: the same handlers now reach both\n // elements, and only the type `ListItemProps` already declares is assignable\n // to a <div>'s props as well as a <button>'s.\n //\n // Off on a disabled row as well as on one that only presents. A press on a\n // disabled button still delivers its pointerdown and pointerup, and\n // withholds only the click, which is what ends a press — so a ripple left\n // on would start and then stay drawn.\n const ripple = useRipple<HTMLElement>(interactive && !isDisabled, {\n onClick,\n onContextMenu,\n onPointerCancel,\n onPointerDown,\n onPointerLeave,\n onPointerUp\n });\n\n // Which of the page's three items this row is, read from the content rather\n // than taken as a prop: a row holding all three lines already says it is\n // three lines, and a word for it would be a second place to get it wrong.\n // A line that wraps grows the row past its container height on its own and\n // keeps its slots centred, which is the shorter item made taller rather\n // than the next one along.\n //\n // The three-line item is the only row whose slots move, which is why it\n // alone carries an alignment as well as a height.\n const extraLines = (hasContent(overline) ? 1 : 0) + (hasContent(supporting) ? 1 : 0);\n const twoLine = extraLines === 1;\n const threeLine = extraLines === 2;\n\n // A presenting row is a <div> and an interactive one a <button>, so the\n // ref is typed as either and handed to each as the callback both accept —\n // see src/render/ref.ts.\n const forwarded = refCallback(ref);\n const content = <RowContent isDisabled={isDisabled} leading={leading} overline={overline} supporting={supporting} trailing={trailing}>\n {children}\n </RowContent>;\n\n // `disabled` goes last in both lists. On the button that is what lets it\n // win over the interactive style, as it does on every collection item:\n // StyleX replaces a property whole, which takes the hover and pressed tints\n // and the pointer cursor with it.\n if (!interactive) {\n return <div aria-disabled={isDisabled || undefined} ref={forwarded} {...props} {...ripple.handlers} {...mergeStyles(stylex.props(rowStyles.base, rowStyles.list, twoLine && rowStyles.twoLine, threeLine && rowStyles.threeLine, isDisabled && rowStyles.disabled), props)}>\n {content}\n </div>;\n }\n return <button disabled={isDisabled} ref={forwarded} type=\"button\" {...ripple.handlers} {...props} {...mergeStyles(stylex.props(rowStyles.base, rowStyles.list, rowStyles.interactive, rowStyles.interactiveLayers, twoLine && rowStyles.twoLine, threeLine && rowStyles.threeLine, isDisabled && rowStyles.disabled), props)}>\n {content}\n {ripple.surface}\n </button>;\n}\nexport type { ListItemProps };\nexport default ListItem;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA2EA,SAAA2B,SAAAC,IAAA;CAAA,MAAAC,IAAA5B,EAAA,EAAA;CAAkB,MAAA,EAAAY,UAAAC,aAAAgB,IAAAf,YAAAgB,IAAAf,SAAAK,SAAAC,eAAAC,iBAAAC,eAAAC,gBAAAC,aAAAT,UAAAe,KAAAd,YAAAC,UAAA,GAAAc,YAAAL;CAEhB,MAAAd,cAAAgB,OAAAI,KAAAA,IAAA,QAAAJ;CACA,MAAAf,aAAAgB,OAAAG,KAAAA,IAAA,QAAAH;CAAkB,IAAAI;CAAA,IAAAN,EAAA,OAAAR,WAAAQ,EAAA,OAAAP,iBAAAO,EAAA,OAAAN,mBAAAM,EAAA,OAAAL,iBAAAK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C,YAAYN,MAAaK,UAASmC,MAAOnC,UAASoC,MAAOR,WAAW5B,UAAS4B,SAAUC,aAAa7B,UAAS6B,WAAYxB,cAAcL,UAASqC,QAAS,GAAGd,OAAK;EACpQU,UAAAA;CACG,CAAA;CAEgD,MAAAK,KAAA;CAAa,MAAAC,KAAAb,OAAMQ;CAA0B,MAAAM,KAAAvC,YAAYN,MAAaK,UAASmC,MAAOnC,UAASoC,MAAOpC,UAASI,aAAcJ,UAASyC,mBAAoBb,WAAW5B,UAAS4B,SAAUC,aAAa7B,UAAS6B,WAAYxB,cAAcL,UAASqC,QAAS,GAAGd,OAAK;CAAC,IAAAmB;CAAA,IAAAvB,EAAA,QAAAc,WAAAd,EAAA,QAAAY,aAAAZ,EAAA,QAAAd,cAAAc,EAAA,QAAAI,WAAAJ,EAAA,QAAAO,OAAAQ,YAAAf,EAAA,QAAAO,OAAAiB,WAAAxB,EAAA,QAAAqB,IAAA;EAAtTE,KAAA,qBAAA,UAAA;GAAkBrC,UAAAA;GAAiB0B,KAAAA;GAAgB,MAAAO;GAAQ,GAAKC;GAAe,GAAMhB;GAAK,GAAMiB;GAAhG,UAAA,CACFP,SACAP,OAAMiB,OACA;;EAAAxB,EAAA,MAAAc;EAAAd,EAAA,MAAAY;EAAAZ,EAAA,MAAAd;EAAAc,EAAA,MAAAI;EAAAJ,EAAA,MAAAO,OAAAQ;EAAAf,EAAA,MAAAO,OAAAiB;EAAAxB,EAAA,MAAAqB;EAAArB,EAAA,MAAAuB;CAAA,OAAAA,KAAAvB,EAAA;CAAA,OAHJuB;AAGI"}
@@ -51,7 +51,9 @@ type MenuContentProps<T extends object = object> = {
51
51
  * Which side of the trigger the menu opens on. Left out, a menu opens below
52
52
  * its trigger and a submenu at the inline end of the item that opens it,
53
53
  * where the item's chevron points — the places React Aria gives each.
54
- * Given `align` alone, the side is `bottom`.
54
+ * Given `align` alone, the side is `bottom`. `start` and `end` follow the
55
+ * writing direction, as a submenu does; `left` and `right` stay put in
56
+ * either.
55
57
  */
56
58
  side?: MenuSide;
57
59
  /**
@@ -72,7 +74,9 @@ type MenuItemProps$1<T extends object = object> = {
72
74
  /**
73
75
  * The keystroke that runs the item, drawn as a keycap at the end. Goes
74
76
  * through React Aria's keyboard slot, so a screen reader announces it
75
- * apart from the label rather than reading the two as one name.
77
+ * apart from the label rather than reading the two as one name. It takes
78
+ * the item's colour while the item is selected or disabled, and so does a
79
+ * `Keycap` inside it, its rule included.
76
80
  */
77
81
  shortcut?: ReactNode;
78
82
  /** A function may compute the style from the item's render state. */