@kanso-labs/kanso-ui 0.45.34 → 0.47.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 (129) hide show
  1. package/dist/button/index.js +13 -9
  2. package/dist/button/index.js.map +1 -1
  3. package/dist/calendar/styles.js +12 -7
  4. package/dist/calendar/styles.js.map +1 -1
  5. package/dist/chip/label.js +1 -0
  6. package/dist/chip/label.js.map +1 -1
  7. package/dist/chip/styles.js +2 -0
  8. package/dist/chip/styles.js.map +1 -1
  9. package/dist/collection/styles.js +1 -1
  10. package/dist/collection/styles.js.map +1 -1
  11. package/dist/components/breadcrumbs/index.js +4 -1
  12. package/dist/components/breadcrumbs/index.js.map +1 -1
  13. package/dist/components/button-group/index.d.ts +16 -3
  14. package/dist/components/button-group/index.js +53 -86
  15. package/dist/components/button-group/index.js.map +1 -1
  16. package/dist/components/calendar/index.d.ts +3 -3
  17. package/dist/components/calendar/index.js.map +1 -1
  18. package/dist/components/card/index.js +5 -1
  19. package/dist/components/card/index.js.map +1 -1
  20. package/dist/components/carousel/index.js +162 -105
  21. package/dist/components/carousel/index.js.map +1 -1
  22. package/dist/components/chip/index.d.ts +38 -15
  23. package/dist/components/chip/index.js +104 -8
  24. package/dist/components/chip/index.js.map +1 -1
  25. package/dist/components/code/index.js +32 -26
  26. package/dist/components/code/index.js.map +1 -1
  27. package/dist/components/color-area/index.d.ts +5 -3
  28. package/dist/components/color-area/index.js +5 -3
  29. package/dist/components/color-area/index.js.map +1 -1
  30. package/dist/components/color-picker/index.js +6 -3
  31. package/dist/components/color-picker/index.js.map +1 -1
  32. package/dist/components/color-swatch/index.js +1 -1
  33. package/dist/components/color-swatch/index.js.map +1 -1
  34. package/dist/components/color-swatch-picker/index.js +24 -9
  35. package/dist/components/color-swatch-picker/index.js.map +1 -1
  36. package/dist/components/combo-box/index.d.ts +11 -3
  37. package/dist/components/combo-box/index.js +66 -62
  38. package/dist/components/combo-box/index.js.map +1 -1
  39. package/dist/components/copy-field/index.js +1 -0
  40. package/dist/components/copy-field/index.js.map +1 -1
  41. package/dist/components/date-picker/index.d.ts +22 -3
  42. package/dist/components/date-picker/index.js +234 -45
  43. package/dist/components/date-picker/index.js.map +1 -1
  44. package/dist/components/date-range-picker/index.d.ts +3 -1
  45. package/dist/components/date-range-picker/index.js +6 -4
  46. package/dist/components/date-range-picker/index.js.map +1 -1
  47. package/dist/components/disclosure/index.d.ts +4 -3
  48. package/dist/components/disclosure/index.js +159 -101
  49. package/dist/components/disclosure/index.js.map +1 -1
  50. package/dist/components/fab/index.d.ts +3 -1
  51. package/dist/components/fab/index.js +25 -12
  52. package/dist/components/fab/index.js.map +1 -1
  53. package/dist/components/fab-menu/index.js +1 -1
  54. package/dist/components/fab-menu/index.js.map +1 -1
  55. package/dist/components/icon-button/index.js +3 -3
  56. package/dist/components/icon-button/index.js.map +1 -1
  57. package/dist/components/index.d.ts +3 -3
  58. package/dist/components/link/index.js +2 -2
  59. package/dist/components/link/index.js.map +1 -1
  60. package/dist/components/menu/index.js +5 -2
  61. package/dist/components/menu/index.js.map +1 -1
  62. package/dist/components/navigation-bar/index.js.map +1 -1
  63. package/dist/components/navigation-rail/index.js +4 -4
  64. package/dist/components/navigation-rail/index.js.map +1 -1
  65. package/dist/components/navigation-tree/index.js +16 -13
  66. package/dist/components/navigation-tree/index.js.map +1 -1
  67. package/dist/components/popover/index.js +35 -33
  68. package/dist/components/popover/index.js.map +1 -1
  69. package/dist/components/progress-indicator/index.js +258 -172
  70. package/dist/components/progress-indicator/index.js.map +1 -1
  71. package/dist/components/range-calendar/index.js +41 -7
  72. package/dist/components/range-calendar/index.js.map +1 -1
  73. package/dist/components/search-view/index.js +1 -1
  74. package/dist/components/search-view/index.js.map +1 -1
  75. package/dist/components/segmented-button/index.d.ts +3 -2
  76. package/dist/components/segmented-button/index.js +46 -95
  77. package/dist/components/segmented-button/index.js.map +1 -1
  78. package/dist/components/select/index.js +5 -2
  79. package/dist/components/select/index.js.map +1 -1
  80. package/dist/components/slider/index.js +42 -10
  81. package/dist/components/slider/index.js.map +1 -1
  82. package/dist/components/table/index.d.ts +26 -5
  83. package/dist/components/table/index.js +93 -75
  84. package/dist/components/table/index.js.map +1 -1
  85. package/dist/components/tag/index.js +1 -0
  86. package/dist/components/tag/index.js.map +1 -1
  87. package/dist/components/time-picker/index.js +37 -5
  88. package/dist/components/time-picker/index.js.map +1 -1
  89. package/dist/components/token-field/index.js +89 -66
  90. package/dist/components/token-field/index.js.map +1 -1
  91. package/dist/components/toolbar/index.d.ts +8 -3
  92. package/dist/components/toolbar/index.js +123 -43
  93. package/dist/components/toolbar/index.js.map +1 -1
  94. package/dist/components/tree/index.js +1 -1
  95. package/dist/components/tree/index.js.map +1 -1
  96. package/dist/fab/styles.js +12 -0
  97. package/dist/fab/styles.js.map +1 -1
  98. package/dist/field/styles.js +2 -2
  99. package/dist/field/styles.js.map +1 -1
  100. package/dist/hooks/useDockedMonths.js +36 -0
  101. package/dist/hooks/useDockedMonths.js.map +1 -0
  102. package/dist/i18n/index.js +1 -0
  103. package/dist/i18n/index.js.map +1 -1
  104. package/dist/i18n/messages.js +34 -0
  105. package/dist/i18n/messages.js.map +1 -1
  106. package/dist/index.d.ts +3 -3
  107. package/dist/navigation/index.js +5 -5
  108. package/dist/navigation/index.js.map +1 -1
  109. package/dist/navigation/styles.js +5 -1
  110. package/dist/navigation/styles.js.map +1 -1
  111. package/dist/row/context.js +6 -0
  112. package/dist/row/context.js.map +1 -0
  113. package/dist/row/index.js +77 -66
  114. package/dist/row/index.js.map +1 -1
  115. package/dist/row/styles.js +15 -0
  116. package/dist/row/styles.js.map +1 -1
  117. package/dist/segments/index.js +2 -5
  118. package/dist/segments/index.js.map +1 -1
  119. package/dist/segments/literal.js +66 -0
  120. package/dist/segments/literal.js.map +1 -0
  121. package/dist/segments/styles.js +8 -0
  122. package/dist/segments/styles.js.map +1 -1
  123. package/dist/styles/chequer.js +1 -0
  124. package/dist/styles/chequer.js.map +1 -1
  125. package/dist/styles/focus.js.map +1 -1
  126. package/dist/styles.css +509 -69
  127. package/dist/toggle-group/index.js +133 -0
  128. package/dist/toggle-group/index.js.map +1 -0
  129. package/package.json +3 -3
@@ -57,9 +57,10 @@ declare namespace Disclosure {
57
57
  declare function DisclosureHeader({ children, headingLevel, leading, supporting }: DisclosureHeaderProps): import("react").JSX.Element;
58
58
  /**
59
59
  * What the section shows while it is open. Its content lines up with the
60
- * headline above it, and it takes the group role React Aria gives it —
61
- * `role="region"` names it in the landmark list instead, for a section a
62
- * reader should be able to jump to.
60
+ * headline above it, past the header's leading slot when it has one, and it
61
+ * takes the group role React Aria gives it — `role="region"` names it in
62
+ * the landmark list instead, for a section a reader should be able to jump
63
+ * to.
63
64
  */
64
65
  declare function DisclosurePanel({ children, ...props }: DisclosurePanelProps & RefAttributes<HTMLDivElement>): import("react").JSX.Element;
65
66
  export { DisclosureHeader, type DisclosureHeaderProps, DisclosurePanel, type DisclosurePanelProps, type DisclosureProps, Disclosure as default };
@@ -5,16 +5,31 @@ import { useRipple } from "../../hooks/useRipple.js";
5
5
  import { RowContent } from "../../row/index.js";
6
6
  import { rowStyles } from "../../row/styles.js";
7
7
  import { mergeStatefulStyles } from "../../styles/merge.js";
8
+ import { spacing } from "../../tokens/design.tokens.stylex.js";
8
9
  import { c } from "react/compiler-runtime";
9
- import { useContext } from "react";
10
+ import { createContext, useContext, useLayoutEffect, useRef, useState } from "react";
10
11
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
12
  import { Button, Disclosure as Disclosure$1, DisclosurePanel as DisclosurePanel$1, DisclosureStateContext, Heading } from "react-aria-components";
12
13
  // src/components/disclosure/index.tsx
13
- const styles = { header: {
14
- kzqmXN: "xh8yej3",
15
- k9WMMc: "x1yc453h",
14
+ const LeadingSlotContext = createContext(null);
15
+ const insetStyles = { inner: (paddingInlineStart) => [paddingInlineStart !== void 0 && {
16
+ kZCmMZ: paddingInlineStart != null ? "xnvo3vl" : "",
16
17
  $$css: true
17
- } };
18
+ }, { "--x-paddingInlineStart": ((val) => typeof val === "number" ? val + "px" : val != null ? val : void 0)(paddingInlineStart) }] };
19
+ const styles = {
20
+ header: {
21
+ kzqmXN: "xh8yej3",
22
+ k9WMMc: "x1yc453h",
23
+ $$css: true
24
+ },
25
+ inner: {
26
+ kB7OPa: "x9f619",
27
+ kGO01o: "xzfxn0k",
28
+ kLKAdn: "x25398y",
29
+ kg3NbH: "x790zyz",
30
+ $$css: true
31
+ }
32
+ };
18
33
  function chevronFor(isExpanded) {
19
34
  return /* @__PURE__ */ jsx(ChevronEndGlyph, { ...{
20
35
  0: { className: "x12w9bfk xxk0z11 x1w5n3ug x2lah0s xvy4d1p xu3v78v x1c071of xkzkux9 x11xpdln xpc4ca7" },
@@ -43,41 +58,44 @@ function chevronFor(isExpanded) {
43
58
  */
44
59
  function Disclosure(t0) {
45
60
  const $ = c(10);
46
- let T0;
47
- let children;
61
+ const { children, ...props } = t0;
62
+ const [width, setWidth] = useState(null);
48
63
  let t1;
49
- let t2;
50
- if ($[0] !== t0) {
51
- const { children: t3, ...props } = t0;
52
- children = t3;
53
- T0 = Disclosure$1;
54
- t1 = props;
55
- t2 = mergeStatefulStyles({ className: "x9f619 x78zum5 xdt5ytf" }, props);
56
- $[0] = t0;
57
- $[1] = T0;
58
- $[2] = children;
59
- $[3] = t1;
60
- $[4] = t2;
61
- } else {
62
- T0 = $[1];
63
- children = $[2];
64
- t1 = $[3];
65
- t2 = $[4];
66
- }
64
+ if ($[0] !== width) {
65
+ t1 = {
66
+ setWidth,
67
+ width
68
+ };
69
+ $[0] = width;
70
+ $[1] = t1;
71
+ } else t1 = $[1];
72
+ const leadingSlot = t1;
73
+ const T0 = Disclosure$1;
74
+ const t2 = mergeStatefulStyles({ className: "x9f619 x78zum5 xdt5ytf" }, props);
67
75
  let t3;
68
- if ($[5] !== T0 || $[6] !== children || $[7] !== t1 || $[8] !== t2) {
69
- t3 = /* @__PURE__ */ jsx(T0, {
70
- ...t1,
71
- ...t2,
76
+ if ($[2] !== children || $[3] !== leadingSlot) {
77
+ t3 = /* @__PURE__ */ jsx(LeadingSlotContext.Provider, {
78
+ value: leadingSlot,
72
79
  children
73
80
  });
81
+ $[2] = children;
82
+ $[3] = leadingSlot;
83
+ $[4] = t3;
84
+ } else t3 = $[4];
85
+ let t4;
86
+ if ($[5] !== T0 || $[6] !== props || $[7] !== t2 || $[8] !== t3) {
87
+ t4 = /* @__PURE__ */ jsx(T0, {
88
+ ...props,
89
+ ...t2,
90
+ children: t3
91
+ });
74
92
  $[5] = T0;
75
- $[6] = children;
76
- $[7] = t1;
77
- $[8] = t2;
78
- $[9] = t3;
79
- } else t3 = $[9];
80
- return t3;
93
+ $[6] = props;
94
+ $[7] = t2;
95
+ $[8] = t3;
96
+ $[9] = t4;
97
+ } else t4 = $[9];
98
+ return t4;
81
99
  }
82
100
  /**
83
101
  * The row that opens the section. It renders the heading React Aria wants
@@ -85,65 +103,98 @@ function Disclosure(t0) {
85
103
  * slots with a chevron in the trailing one.
86
104
  */
87
105
  function DisclosureHeader(t0) {
88
- const $ = c(15);
106
+ const $ = c(19);
89
107
  const { children, headingLevel: t1, leading, supporting } = t0;
90
108
  const headingLevel = t1 === void 0 ? 3 : t1;
91
109
  const state = useContext(DisclosureStateContext);
92
110
  const ripple = useRipple();
111
+ const trigger = useRef(null);
112
+ const setLeadingWidth = useContext(LeadingSlotContext)?.setWidth;
113
+ const hasLeading = leading !== void 0 && leading !== null && leading !== false;
93
114
  let t2;
94
- if ($[0] !== supporting) {
95
- t2 = headerClassName(supporting);
96
- $[0] = supporting;
97
- $[1] = t2;
98
- } else t2 = $[1];
99
- const t3 = ripple.handlers;
100
- const t4 = state?.isExpanded === true;
101
- let t5;
102
- if ($[2] !== children || $[3] !== leading || $[4] !== ripple.surface || $[5] !== supporting || $[6] !== t4) {
103
- t5 = headerContent(children, leading, supporting, t4, ripple.surface);
104
- $[2] = children;
105
- $[3] = leading;
106
- $[4] = ripple.surface;
107
- $[5] = supporting;
108
- $[6] = t4;
109
- $[7] = t5;
110
- } else t5 = $[7];
111
- let t6;
112
- if ($[8] !== ripple.handlers || $[9] !== t2 || $[10] !== t5) {
113
- t6 = /* @__PURE__ */ jsx(Button, {
114
- className: t2,
115
+ let t3;
116
+ if ($[0] !== hasLeading || $[1] !== setLeadingWidth) {
117
+ t2 = () => {
118
+ const slot = trigger.current?.firstElementChild;
119
+ if (setLeadingWidth === void 0 || !hasLeading || slot == null) return;
120
+ const measure = () => {
121
+ setLeadingWidth(slot.getBoundingClientRect().width);
122
+ };
123
+ measure();
124
+ const observer = new ResizeObserver(measure);
125
+ observer.observe(slot);
126
+ return () => {
127
+ observer.disconnect();
128
+ setLeadingWidth(null);
129
+ };
130
+ };
131
+ t3 = [hasLeading, setLeadingWidth];
132
+ $[0] = hasLeading;
133
+ $[1] = setLeadingWidth;
134
+ $[2] = t2;
135
+ $[3] = t3;
136
+ } else {
137
+ t2 = $[2];
138
+ t3 = $[3];
139
+ }
140
+ useLayoutEffect(t2, t3);
141
+ let t4;
142
+ if ($[4] !== supporting) {
143
+ t4 = headerClassName(supporting);
144
+ $[4] = supporting;
145
+ $[5] = t4;
146
+ } else t4 = $[5];
147
+ const t5 = ripple.handlers;
148
+ const t6 = state?.isExpanded === true;
149
+ let t7;
150
+ if ($[6] !== children || $[7] !== leading || $[8] !== ripple.surface || $[9] !== supporting || $[10] !== t6) {
151
+ t7 = headerContent(children, leading, supporting, t6, ripple.surface);
152
+ $[6] = children;
153
+ $[7] = leading;
154
+ $[8] = ripple.surface;
155
+ $[9] = supporting;
156
+ $[10] = t6;
157
+ $[11] = t7;
158
+ } else t7 = $[11];
159
+ let t8;
160
+ if ($[12] !== ripple.handlers || $[13] !== t4 || $[14] !== t7) {
161
+ t8 = /* @__PURE__ */ jsx(Button, {
162
+ className: t4,
163
+ ref: trigger,
115
164
  slot: "trigger",
116
- ...t3,
117
- children: t5
165
+ ...t5,
166
+ children: t7
118
167
  });
119
- $[8] = ripple.handlers;
120
- $[9] = t2;
121
- $[10] = t5;
122
- $[11] = t6;
123
- } else t6 = $[11];
124
- let t7;
125
- if ($[12] !== headingLevel || $[13] !== t6) {
126
- t7 = /* @__PURE__ */ jsx(Heading, {
168
+ $[12] = ripple.handlers;
169
+ $[13] = t4;
170
+ $[14] = t7;
171
+ $[15] = t8;
172
+ } else t8 = $[15];
173
+ let t9;
174
+ if ($[16] !== headingLevel || $[17] !== t8) {
175
+ t9 = /* @__PURE__ */ jsx(Heading, {
127
176
  level: headingLevel,
128
177
  className: "x1qlqyl8 x1pd3egz x1ghz6dp",
129
- children: t6
178
+ children: t8
130
179
  });
131
- $[12] = headingLevel;
132
- $[13] = t6;
133
- $[14] = t7;
134
- } else t7 = $[14];
135
- return t7;
180
+ $[16] = headingLevel;
181
+ $[17] = t8;
182
+ $[18] = t9;
183
+ } else t9 = $[18];
184
+ return t9;
136
185
  }
137
186
  /**
138
187
  * What the section shows while it is open. Its content lines up with the
139
- * headline above it, and it takes the group role React Aria gives it —
140
- * `role="region"` names it in the landmark list instead, for a section a
141
- * reader should be able to jump to.
188
+ * headline above it, past the header's leading slot when it has one, and it
189
+ * takes the group role React Aria gives it — `role="region"` names it in
190
+ * the landmark list instead, for a section a reader should be able to jump
191
+ * to.
142
192
  */
143
193
  function DisclosurePanel(t0) {
144
- const $ = c(11);
145
- const { children, ...props } = t0;
194
+ const $ = c(14);
195
+ const { children, ...props$1 } = t0;
146
196
  const state = useContext(DisclosureStateContext);
197
+ const leadingWidth = useContext(LeadingSlotContext)?.width ?? null;
147
198
  let t1;
148
199
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
149
200
  t1 = {
@@ -154,40 +205,47 @@ function DisclosurePanel(t0) {
154
205
  } else t1 = $[0];
155
206
  const t2 = t1[!!(state?.isExpanded === true) << 0];
156
207
  const T0 = DisclosurePanel$1;
157
- const t3 = mergeStatefulStyles({ className: "x9f619 x2lwn1j x7giv3 x1hm618n" }, props);
208
+ const t3 = mergeStatefulStyles({ className: "x9f619 x2lwn1j x7giv3 x1hm618n" }, props$1);
158
209
  let t4;
159
- if ($[1] !== children) {
160
- t4 = /* @__PURE__ */ jsx("div", {
161
- className: "x9f619 xzfxn0k x25398y x790zyz",
162
- children
163
- });
164
- $[1] = children;
210
+ if ($[1] !== leadingWidth) {
211
+ t4 = props(styles.inner, leadingWidth !== null && insetStyles.inner(`calc(${spacing.lg} + ${leadingWidth}px + ${spacing.lg})`));
212
+ $[1] = leadingWidth;
165
213
  $[2] = t4;
166
214
  } else t4 = $[2];
167
215
  let t5;
168
- if ($[3] !== T0 || $[4] !== props || $[5] !== t3 || $[6] !== t4) {
169
- t5 = /* @__PURE__ */ jsx(T0, {
170
- ...props,
171
- ...t3,
172
- children: t4
216
+ if ($[3] !== children || $[4] !== t4) {
217
+ t5 = /* @__PURE__ */ jsx("div", {
218
+ ...t4,
219
+ children
173
220
  });
174
- $[3] = T0;
175
- $[4] = props;
176
- $[5] = t3;
177
- $[6] = t4;
178
- $[7] = t5;
179
- } else t5 = $[7];
221
+ $[3] = children;
222
+ $[4] = t4;
223
+ $[5] = t5;
224
+ } else t5 = $[5];
180
225
  let t6;
181
- if ($[8] !== t2 || $[9] !== t5) {
182
- t6 = /* @__PURE__ */ jsx("div", {
183
- ...t2,
226
+ if ($[6] !== T0 || $[7] !== props$1 || $[8] !== t3 || $[9] !== t5) {
227
+ t6 = /* @__PURE__ */ jsx(T0, {
228
+ ...props$1,
229
+ ...t3,
184
230
  children: t5
185
231
  });
186
- $[8] = t2;
232
+ $[6] = T0;
233
+ $[7] = props$1;
234
+ $[8] = t3;
187
235
  $[9] = t5;
188
236
  $[10] = t6;
189
237
  } else t6 = $[10];
190
- return t6;
238
+ let t7;
239
+ if ($[11] !== t2 || $[12] !== t6) {
240
+ t7 = /* @__PURE__ */ jsx("div", {
241
+ ...t2,
242
+ children: t6
243
+ });
244
+ $[11] = t2;
245
+ $[12] = t6;
246
+ $[13] = t7;
247
+ } else t7 = $[13];
248
+ return t7;
191
249
  }
192
250
  function headerClassName(supporting) {
193
251
  return (state) => props(rowStyles.base, rowStyles.list, rowStyles.interactive, styles.header, supporting !== void 0 && rowStyles.twoLine, state.isHovered && rowStyles.hovered, state.isPressed && rowStyles.pressed, state.isDisabled && rowStyles.disabled).className ?? "";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_c","stylex","useContext","DisclosureStateContext","Disclosure","RACDisclosure","DisclosurePanel","RACDisclosurePanel","useRipple","rowStyles","mergeStatefulStyles","styles","header","kzqmXN","k9WMMc","$$css","children","headingLevel","leading","supporting","className","chevronFor","isExpanded","t0","$","T0","t1","t2","t3","props","DisclosureHeader","undefined","state","ripple","headerClassName","handlers","t4","t5","surface","headerContent","t6","t7","Symbol","for","0","1","isDisabled","isHovered","isPressed","base","list","interactive","twoLine","hovered","pressed","disabled","Header","Panel","RACButton","RACHeading"],"sources":["../../../src/components/disclosure/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { FocusableElement, DisclosurePanelProps as RACDisclosurePanelProps, DisclosureProps as RACDisclosureProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext } from 'react';\nimport { DisclosureStateContext, Button as RACButton, Disclosure as RACDisclosure, DisclosurePanel as RACDisclosurePanel, Heading as RACHeading } from 'react-aria-components';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { RowContent } from '../../row';\nimport { rowStyles } from '../../row/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, spacing } from '../../tokens/design.tokens.stylex';\n\n// A section that opens to show what is under it, and closes again. The\n// header is the row every list here draws — `src/row`, shared with ListItem,\n// ListBox and List — so its 56dp floor, body-large headline, body-medium\n// supporting line and state layers are that module's, and a header sitting\n// above a list cannot drift from the rows below it.\n//\n// The lists page gives the expand interaction its own token set, which its\n// widget keeps behind a menu that does not open to a script. What the page\n// states in words covers the row, which is what the shared module already\n// carries; the chevron's size and the panel's inset below are the library's\n// own, taken from the row's own trailing slot and inline padding rather than\n// invented.\n//\n// Three things are this component's own.\n//\n// **The header is a heading with a button in it.** React Aria wants both —\n// the heading is what a screen reader jumps between, and the button is what\n// opens the section — so `Disclosure.Header` renders the pair rather than\n// leaving a call site to remember. `headingLevel` says where in the page's\n// outline it sits.\n//\n// **The panel opens to its own height, without one being measured.** A grid\n// whose single row goes from `0fr` to `1fr` interpolates between nothing and\n// the content's natural height, so no height is read from the DOM and no\n// number is written down. Under `prefers-reduced-motion` the row snaps\n// instead.\n//\n// **Only the opening animates, and that is React Aria's doing rather than a\n// choice here.** It marks the collapsed panel `hidden=\"until-found\"`, so on\n// the way closed the content stops being laid out at once and the track has\n// nothing left to shrink. Worth knowing before reaching for a closing\n// animation: it needs the panel kept in the layout, which would cost the\n// find-in-page behaviour that attribute buys.\n\nconst styles = {\n header: {\n kzqmXN: \"xh8yej3\",\n k9WMMc: \"x1yc453h\",\n $$css: true\n }\n};\ntype DisclosureHeaderProps = {\n /** The header's headline — what the section is about. */\n children?: ReactNode;\n /**\n * Where the header sits in the page's outline. React Aria renders the\n * trigger inside a heading, and a screen reader moves between them.\n * @default 3\n */\n headingLevel?: number;\n /** Content before the headline: an avatar, an icon. */\n leading?: ReactNode;\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n};\ntype DisclosurePanelProps = Omit<RACDisclosurePanelProps, 'className' | 'style'> & {\n /** A function may compute the class from the panel's render state. */\n className?: RACDisclosurePanelProps['className'];\n /** A function may compute the style from the panel's render state. */\n style?: RACDisclosurePanelProps['style'];\n};\ntype DisclosureProps = Omit<RACDisclosureProps, 'children'> & {\n /** A `Disclosure.Header` and a `Disclosure.Panel`. */\n children?: ReactNode;\n};\n\n// The chevron, turned or not. A call rather than JSX written at the prop,\n// which is what react-perf's jsx-no-jsx-as-prop is after; the React Compiler\n// memoises the result on `isExpanded`.\nfunction chevronFor(isExpanded: boolean) {\n return <ChevronEndGlyph {...{\n 0: {\n className: \"x12w9bfk xxk0z11 x1w5n3ug x2lah0s xvy4d1p xu3v78v x1c071of xkzkux9 x11xpdln xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk xxk0z11 x1w5n3ug x2lah0s xvy4d1p xkzkux9 x11xpdln xpc4ca7 xaaet9u x1iffjtl\"\n }\n }[!!isExpanded << 0]} />;\n}\n\n/**\n * A section that opens to show what is under it. Whether it is open is React\n * Aria's: pass `isExpanded` with `onExpandedChange` to control it, or\n * `defaultExpanded` to let it keep its own.\n *\n * ```tsx\n * <Disclosure>\n * <Disclosure.Header>Headline</Disclosure.Header>\n * <Disclosure.Panel>Supporting line</Disclosure.Panel>\n * </Disclosure>\n * ```\n *\n * The header is the row every list here draws, so a section above a list of\n * rows lines up with them. The panel opens to whatever height its content\n * turns out to have, and snaps rather than sliding under\n * `prefers-reduced-motion`.\n *\n * The call site's `className` and `style` land on the container, which is the\n * element a layout positions.\n */\nfunction Disclosure({\n children,\n ...props\n}: DisclosureProps & RefAttributes<HTMLDivElement>) {\n return <RACDisclosure {...props} {...mergeStatefulStyles({\n className: \"x9f619 x78zum5 xdt5ytf\"\n }, props)}>\n {children}\n </RACDisclosure>;\n}\n\n/**\n * The row that opens the section. It renders the heading React Aria wants\n * around the trigger and the button inside it, and draws the shared row's\n * slots with a chevron in the trailing one.\n */\nfunction DisclosureHeader({\n children,\n headingLevel = 3,\n leading,\n supporting\n}: DisclosureHeaderProps) {\n // The chevron turns with the section, and React Aria's button render state\n // reports the press states rather than what the button controls — so\n // whether the section is open comes from the disclosure's own context.\n const state = useContext(DisclosureStateContext);\n // The press ripple a list's rows draw, since this is the same row. It is a\n // button, which hears its own click, so the press ends there as Button's\n // does, and a keyboard press draws one too.\n const ripple = useRipple<FocusableElement>();\n return <RACHeading level={headingLevel} className=\"x1qlqyl8 x1pd3egz x1ghz6dp\">\n <RACButton className={headerClassName(supporting)} slot=\"trigger\" {...ripple.handlers}>\n {headerContent(children, leading, supporting, state?.isExpanded === true, ripple.surface)}\n </RACButton>\n </RACHeading>;\n}\n\n/**\n * What the section shows while it is open. Its content lines up with the\n * headline above it, and it takes the group role React Aria gives it —\n * `role=\"region\"` names it in the landmark list instead, for a section a\n * reader should be able to jump to.\n */\nfunction DisclosurePanel({\n children,\n ...props\n}: DisclosurePanelProps & RefAttributes<HTMLDivElement>) {\n // The track has to know, and React Aria hands the render state to the panel\n // rather than to what wraps it — so the state comes from its context, the\n // same one its own panel reads.\n const state = useContext(DisclosureStateContext);\n return <div {...{\n 0: {\n className: \"x12w9bfk xrvj5dj xihq33y xjvfotl x1qn9uv2 x1seskgd\"\n },\n 1: {\n className: \"x12w9bfk xrvj5dj xjvfotl x1qn9uv2 x1seskgd x1tu4anv\"\n }\n }[!!(state?.isExpanded === true) << 0]}>\n <RACDisclosurePanel {...props} {...mergeStatefulStyles({\n className: \"x9f619 x2lwn1j x7giv3 x1hm618n\"\n }, props)}>\n <div className=\"x9f619 xzfxn0k x25398y x790zyz\">{children}</div>\n </RACDisclosurePanel>\n </div>;\n}\n\n// The trigger's classes, from React Aria's render state. `isSelected` is not\n// among them — a disclosure's button reports `aria-expanded` rather than a\n// selection — so the row draws unselected throughout and only its disabled\n// state changes.\n//\n// A supporting line moves the header from the page's one-line container\n// height to its two-line one, which is a floor rather than something the\n// row's own box arrives at — see `twoLine` in `src/row/styles.ts`. Taken as\n// an argument rather than read from the render state, since React Aria\n// reports what the trigger is doing and not what it holds; the classes are\n// built by a call for the same reason `headerContent` is.\n// No overline, and so no three-line header. The row takes the list\n// variant's metrics because a header looks like a list row, but what it\n// follows is its own page, and that page gives a headline and a supporting\n// line — the three-line item belongs to the lists page, which `List.Item`\n// and `ListBox.Item` draw.\n//\n// The hover and pressed layers come from the trigger's render state, like\n// every other row React Aria hosts — see `focusVisible` in\n// `src/row/styles.ts` for the order they are drawn in.\nfunction headerClassName(supporting: ReactNode) {\n return (state: {\n isDisabled: boolean;\n isHovered: boolean;\n isPressed: boolean;\n }) => stylex.props(rowStyles.base, rowStyles.list, rowStyles.interactive, styles.header, supporting !== undefined && rowStyles.twoLine, state.isHovered && rowStyles.hovered, state.isPressed && rowStyles.pressed, state.isDisabled && rowStyles.disabled).className ?? '';\n}\n\n// What the header row draws. Built by a call rather than written inline at\n// the prop, which is what react-perf's no-new-function-as-prop is after; the\n// React Compiler memoises the result on its inputs.\nfunction headerContent(children: ReactNode, leading: ReactNode, supporting: ReactNode, isExpanded: boolean, ripple: ReactNode) {\n return (state: {\n isDisabled: boolean;\n }) => <>\n <RowContent isDisabled={state.isDisabled} leading={leading} supporting={supporting} trailing={chevronFor(isExpanded)}>\n {children}\n </RowContent>\n {state.isDisabled ? null : ripple}\n </>;\n}\nDisclosure.Header = DisclosureHeader;\nDisclosure.Panel = DisclosurePanel;\nexport type { DisclosureHeaderProps, DisclosurePanelProps, DisclosureProps };\nexport { DisclosureHeader, DisclosurePanel };\nexport default Disclosure;"],"mappings":";;;;;;;;;;;;AAiDA,MAAMW,SAAS,EACbC,QAAQ;CACNC,QAAQ;CACRC,QAAQ;CACRC,OAAO;AACT,EACF;AA6BA,SAASM,WAAWC,YAAqB;CACvC,OAAO,oBAAC,iBAAD,EAAiB,GAAI;EAC1B,GAAG,EACDF,WAAW,sFACb;EACA,GAAG,EACDA,WAAW,sFACb;CACF,EAAE,CAAC,CAACE,cAAc,GAAG,CAAA;AACvB;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAAlB,WAAAmB,IAAA;CAAA,MAAAC,IAAAxB,EAAA,EAAA;CAAA,IAAAyB;CAAA,IAAAT;CAAA,IAAAU;CAAA,IAAAC;CAAA,IAAAH,EAAA,OAAAD,IAAA;EAAoB,MAAA,EAAAP,UAAAY,IAAA,GAAAC,UAAAN;EAAAP,WAAAY;EAIVH,KAAApB;EAAkBwB,KAAAA;EAAWF,KAAAjB,oBAAoB,EAAAU,WAC5C,yBACb,GAAGS,KAAK;EAACL,EAAA,KAAAD;EAAAC,EAAA,KAA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A7B,WAAWoD,SAAS1B;AACpB1B,WAAWqD,QAAQnD"}
1
+ {"version":3,"file":"index.js","names":["_c","stylex","createContext","useContext","useLayoutEffect","useRef","useState","DisclosureStateContext","Disclosure","RACDisclosure","DisclosurePanel","RACDisclosurePanel","useRipple","rowStyles","mergeStatefulStyles","spacing","LeadingSlotContext","setWidth","width","insetStyles","inner","paddingInlineStart","undefined","kZCmMZ","$$css","val","styles","header","kzqmXN","k9WMMc","kB7OPa","kGO01o","kLKAdn","kg3NbH","children","headingLevel","leading","supporting","className","chevronFor","isExpanded","t0","$","props","t1","leadingSlot","T0","t2","t3","t4","DisclosureHeader","state","ripple","trigger","setLeadingWidth","hasLeading","slot","current","firstElementChild","measure","getBoundingClientRect","observer","ResizeObserver","observe","disconnect","headerClassName","t5","handlers","t6","t7","surface","headerContent","t8","t9","leadingWidth","Symbol","for","0","1","lg","isDisabled","isHovered","isPressed","base","list","interactive","twoLine","hovered","pressed","disabled","Header","Panel","RACButton","RACHeading"],"sources":["../../../src/components/disclosure/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { FocusableElement, DisclosurePanelProps as RACDisclosurePanelProps, DisclosureProps as RACDisclosureProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { createContext, useContext, useLayoutEffect, useMemo, useRef, useState } from 'react';\nimport { DisclosureStateContext, Button as RACButton, Disclosure as RACDisclosure, DisclosurePanel as RACDisclosurePanel, Heading as RACHeading } from 'react-aria-components';\nimport { ChevronEndGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { RowContent } from '../../row';\nimport { rowStyles } from '../../row/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, spacing } from '../../tokens/design.tokens.stylex';\n\n// A section that opens to show what is under it, and closes again. The\n// header is the row every list here draws — `src/row`, shared with ListItem,\n// ListBox and List — so its 56dp floor, body-large headline, body-medium\n// supporting line and state layers are that module's, and a header sitting\n// above a list cannot drift from the rows below it.\n//\n// The lists page gives the expand interaction its own token set, which its\n// widget keeps behind a menu that does not open to a script. What the page\n// states in words covers the row, which is what the shared module already\n// carries; the chevron's size and the panel's inset below are the library's\n// own, taken from the row's own trailing slot and inline padding rather than\n// invented.\n//\n// Four things are this component's own.\n//\n// **The header is a heading with a button in it.** React Aria wants both —\n// the heading is what a screen reader jumps between, and the button is what\n// opens the section — so `Disclosure.Header` renders the pair rather than\n// leaving a call site to remember. `headingLevel` says where in the page's\n// outline it sits.\n//\n// **The panel opens to its own height, without one being measured.** A grid\n// whose single row goes from `0fr` to `1fr` interpolates between nothing and\n// the content's natural height, so no height is read from the DOM and no\n// number is written down. Under `prefers-reduced-motion` the row snaps\n// instead.\n//\n// **Only the opening animates, and that is React Aria's doing rather than a\n// choice here.** It marks the collapsed panel `hidden=\"until-found\"`, so on\n// the way closed the content stops being laid out at once and the track has\n// nothing left to shrink. Worth knowing before reaching for a closing\n// animation: it needs the panel kept in the layout, which would cost the\n// find-in-page behaviour that attribute buys.\n//\n// **The panel's content starts where the headline does.** With nothing in\n// the header's leading slot that is the row's own 16dp inset. With an avatar\n// or an icon there, it is that inset, the slot and the row's 16dp gap after\n// it, so the panel's text sits under the headline rather than under the\n// avatar. The slot is as wide as what a call site puts in it, so the header\n// measures it and hands the width to the panel through the disclosure's own\n// context, and the panel adds the two 16s from the tokens. Logical padding\n// does the rest, so the same width indents from the right under\n// right-to-left.\n\n// The width of the header's leading slot, from the header to the panel: null\n// while the header has nothing there, or outside a `Disclosure`.\nconst LeadingSlotContext = createContext<null | {\n setWidth: (width: null | number) => void;\n width: null | number;\n}>(null);\n\n// The panel's start padding past the header's leading slot, which the panel\n// works out from the slot's width: the row's inset, the slot, and the row's\n// gap between the slot and the headline. A function style because the width\n// is the call site's content.\nconst insetStyles = {\n inner: (paddingInlineStart: string) => [paddingInlineStart !== undefined && {\n kZCmMZ: paddingInlineStart != null ? \"xnvo3vl\" : \"\",\n $$css: true\n }, {\n \"--x-paddingInlineStart\": (val => typeof val === \"number\" ? val + \"px\" : val != null ? val : undefined)(paddingInlineStart)\n }]\n};\nconst styles = {\n header: {\n kzqmXN: \"xh8yej3\",\n k9WMMc: \"x1yc453h\",\n $$css: true\n },\n inner: {\n kB7OPa: \"x9f619\",\n kGO01o: \"xzfxn0k\",\n kLKAdn: \"x25398y\",\n kg3NbH: \"x790zyz\",\n $$css: true\n }\n};\ntype DisclosureHeaderProps = {\n /** The header's headline — what the section is about. */\n children?: ReactNode;\n /**\n * Where the header sits in the page's outline. React Aria renders the\n * trigger inside a heading, and a screen reader moves between them.\n * @default 3\n */\n headingLevel?: number;\n /** Content before the headline: an avatar, an icon. */\n leading?: ReactNode;\n /** A second line under the headline, in the muted role. */\n supporting?: ReactNode;\n};\ntype DisclosurePanelProps = Omit<RACDisclosurePanelProps, 'className' | 'style'> & {\n /** A function may compute the class from the panel's render state. */\n className?: RACDisclosurePanelProps['className'];\n /** A function may compute the style from the panel's render state. */\n style?: RACDisclosurePanelProps['style'];\n};\ntype DisclosureProps = Omit<RACDisclosureProps, 'children'> & {\n /** A `Disclosure.Header` and a `Disclosure.Panel`. */\n children?: ReactNode;\n};\n\n// The chevron, turned or not. A call rather than JSX written at the prop,\n// which is what react-perf's jsx-no-jsx-as-prop is after; the React Compiler\n// memoises the result on `isExpanded`.\nfunction chevronFor(isExpanded: boolean) {\n return <ChevronEndGlyph {...{\n 0: {\n className: \"x12w9bfk xxk0z11 x1w5n3ug x2lah0s xvy4d1p xu3v78v x1c071of xkzkux9 x11xpdln xpc4ca7\"\n },\n 1: {\n className: \"x12w9bfk xxk0z11 x1w5n3ug x2lah0s xvy4d1p xkzkux9 x11xpdln xpc4ca7 xaaet9u x1iffjtl\"\n }\n }[!!isExpanded << 0]} />;\n}\n\n/**\n * A section that opens to show what is under it. Whether it is open is React\n * Aria's: pass `isExpanded` with `onExpandedChange` to control it, or\n * `defaultExpanded` to let it keep its own.\n *\n * ```tsx\n * <Disclosure>\n * <Disclosure.Header>Headline</Disclosure.Header>\n * <Disclosure.Panel>Supporting line</Disclosure.Panel>\n * </Disclosure>\n * ```\n *\n * The header is the row every list here draws, so a section above a list of\n * rows lines up with them. The panel opens to whatever height its content\n * turns out to have, and snaps rather than sliding under\n * `prefers-reduced-motion`.\n *\n * The call site's `className` and `style` land on the container, which is the\n * element a layout positions.\n */\nfunction Disclosure({\n children,\n ...props\n}: DisclosureProps & RefAttributes<HTMLDivElement>) {\n const [width, setWidth] = useState<null | number>(null);\n const leadingSlot = useMemo(() => ({\n setWidth,\n width\n }), [width]);\n return <RACDisclosure {...props} {...mergeStatefulStyles({\n className: \"x9f619 x78zum5 xdt5ytf\"\n }, props)}>\n <LeadingSlotContext.Provider value={leadingSlot}>\n {children}\n </LeadingSlotContext.Provider>\n </RACDisclosure>;\n}\n\n/**\n * The row that opens the section. It renders the heading React Aria wants\n * around the trigger and the button inside it, and draws the shared row's\n * slots with a chevron in the trailing one.\n */\nfunction DisclosureHeader({\n children,\n headingLevel = 3,\n leading,\n supporting\n}: DisclosureHeaderProps) {\n // The chevron turns with the section, and React Aria's button render state\n // reports the press states rather than what the button controls — so\n // whether the section is open comes from the disclosure's own context.\n const state = useContext(DisclosureStateContext);\n // The press ripple a list's rows draw, since this is the same row. It is a\n // button, which hears its own click, so the press ends there as Button's\n // does, and a keyboard press draws one too.\n const ripple = useRipple<FocusableElement>();\n const trigger = useRef<HTMLButtonElement>(null);\n const setLeadingWidth = useContext(LeadingSlotContext)?.setWidth;\n const hasLeading = leading !== undefined && leading !== null && leading !== false;\n\n // The leading slot is the row's first child when there is one, and its\n // width is what it holds, so it is watched rather than read once: an\n // avatar's image arriving, or the slot's content swapped for something of\n // another size, moves the headline and the panel with it.\n useLayoutEffect(() => {\n const slot = trigger.current?.firstElementChild;\n if (setLeadingWidth === undefined || !hasLeading || slot == null) {\n return undefined;\n }\n const measure = () => {\n setLeadingWidth(slot.getBoundingClientRect().width);\n };\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(slot);\n return () => {\n observer.disconnect();\n setLeadingWidth(null);\n };\n }, [hasLeading, setLeadingWidth]);\n return <RACHeading level={headingLevel} className=\"x1qlqyl8 x1pd3egz x1ghz6dp\">\n <RACButton className={headerClassName(supporting)} ref={trigger} slot=\"trigger\" {...ripple.handlers}>\n {headerContent(children, leading, supporting, state?.isExpanded === true, ripple.surface)}\n </RACButton>\n </RACHeading>;\n}\n\n/**\n * What the section shows while it is open. Its content lines up with the\n * headline above it, past the header's leading slot when it has one, and it\n * takes the group role React Aria gives it — `role=\"region\"` names it in\n * the landmark list instead, for a section a reader should be able to jump\n * to.\n */\nfunction DisclosurePanel({\n children,\n ...props\n}: DisclosurePanelProps & RefAttributes<HTMLDivElement>) {\n // The track has to know, and React Aria hands the render state to the panel\n // rather than to what wraps it — so the state comes from its context, the\n // same one its own panel reads.\n const state = useContext(DisclosureStateContext);\n const leadingWidth = useContext(LeadingSlotContext)?.width ?? null;\n return <div {...{\n 0: {\n className: \"x12w9bfk xrvj5dj xihq33y xjvfotl x1qn9uv2 x1seskgd\"\n },\n 1: {\n className: \"x12w9bfk xrvj5dj xjvfotl x1qn9uv2 x1seskgd x1tu4anv\"\n }\n }[!!(state?.isExpanded === true) << 0]}>\n <RACDisclosurePanel {...props} {...mergeStatefulStyles({\n className: \"x9f619 x2lwn1j x7giv3 x1hm618n\"\n }, props)}>\n <div {...stylex.props(styles.inner, leadingWidth !== null && insetStyles.inner(`calc(${spacing.lg} + ${leadingWidth}px + ${spacing.lg})`))}>\n {children}\n </div>\n </RACDisclosurePanel>\n </div>;\n}\n\n// The trigger's classes, from React Aria's render state. `isSelected` is not\n// among them — a disclosure's button reports `aria-expanded` rather than a\n// selection — so the row draws unselected throughout and only its disabled\n// state changes.\n//\n// A supporting line moves the header from the page's one-line container\n// height to its two-line one, which is a floor rather than something the\n// row's own box arrives at — see `twoLine` in `src/row/styles.ts`. Taken as\n// an argument rather than read from the render state, since React Aria\n// reports what the trigger is doing and not what it holds; the classes are\n// built by a call for the same reason `headerContent` is.\n// No overline, and so no three-line header. The row takes the list\n// variant's metrics because a header looks like a list row, but what it\n// follows is its own page, and that page gives a headline and a supporting\n// line — the three-line item belongs to the lists page, which `List.Item`\n// and `ListBox.Item` draw.\n//\n// The hover and pressed layers come from the trigger's render state, like\n// every other row React Aria hosts — see `focusVisible` in\n// `src/row/styles.ts` for the order they are drawn in.\nfunction headerClassName(supporting: ReactNode) {\n return (state: {\n isDisabled: boolean;\n isHovered: boolean;\n isPressed: boolean;\n }) => stylex.props(rowStyles.base, rowStyles.list, rowStyles.interactive, styles.header, supporting !== undefined && rowStyles.twoLine, state.isHovered && rowStyles.hovered, state.isPressed && rowStyles.pressed, state.isDisabled && rowStyles.disabled).className ?? '';\n}\n\n// What the header row draws. Built by a call rather than written inline at\n// the prop, which is what react-perf's no-new-function-as-prop is after; the\n// React Compiler memoises the result on its inputs.\nfunction headerContent(children: ReactNode, leading: ReactNode, supporting: ReactNode, isExpanded: boolean, ripple: ReactNode) {\n return (state: {\n isDisabled: boolean;\n }) => <>\n <RowContent isDisabled={state.isDisabled} leading={leading} supporting={supporting} trailing={chevronFor(isExpanded)}>\n {children}\n </RowContent>\n {state.isDisabled ? null : ripple}\n </>;\n}\nDisclosure.Header = DisclosureHeader;\nDisclosure.Panel = DisclosurePanel;\nexport type { DisclosureHeaderProps, DisclosurePanelProps, DisclosureProps };\nexport { DisclosureHeader, DisclosurePanel };\nexport default Disclosure;"],"mappings":";;;;;;;;;;;;;AA6DA,MAAMgB,qBAAqBd,cAGxB,IAAI;AAMP,MAAMiB,cAAc,EAClBC,QAAQC,uBAA+B,CAACA,uBAAuBC,KAAAA,KAAa;CAC1EC,QAAQF,sBAAsB,OAAO,YAAY;CACjDG,OAAO;AACT,GAAG,EACD,4BAA2BC,QAAO,OAAOA,QAAQ,WAAWA,MAAM,OAAOA,OAAO,OAAOA,MAAMH,KAAAA,EAAAA,CAAWD,kBAAkB,EAC5H,CAAC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A,OAAAA,KAAA1B,EAAA;CAAA,IAAA2B;CAAA,IAAA3B,EAAA,QAAAK,MAAAL,EAAA,QAAA0B,IAAA;EAdlBC,KAAA,oBAAA,OAAA;GAeC,GAfQtB;GAQZqB,UAAAA;EAOI,CAAA;EAAA1B,EAAA,MAAAK;EAAAL,EAAA,MAAA0B;EAAA1B,EAAA,MAAA2B;CAAA,OAAAA,KAAA3B,EAAA;CAAA,OAfD2B;AAeC;AAuBV,SAASJ,gBAAgB5B,YAAuB;CAC9C,QAAQc,UAIFlD,MAAaY,UAAUsE,MAAMtE,UAAUuE,MAAMvE,UAAUwE,aAAa3D,OAAOC,QAAQU,eAAef,KAAAA,KAAaT,UAAUyE,SAASnC,MAAM8B,aAAapE,UAAU0E,SAASpC,MAAM+B,aAAarE,UAAU2E,SAASrC,MAAM6B,cAAcnE,UAAU4E,QAAQ,CAAC,CAACnD,aAAa;AAC3Q;AAKA,SAASiC,cAAcrC,UAAqBE,SAAoBC,YAAuBG,YAAqBY,QAAmB;CAC7H,QAAQD,UAEF,qBAAA,YAAA,EAAA,UAAA,CACF,oBAAC,YAAD;EAAY,YAAYA,MAAM6B;EAAqB5C;EAAqBC;EAAY,UAAUE,WAAWC,UAAU;EAChHN;CACS,CAAA,GACXiB,MAAM6B,aAAa,OAAO5B,MAC7B,EAAA,CAAA;AACJ;AACA5C,WAAWkF,SAASxC;AACpB1C,WAAWmF,QAAQjF"}
@@ -24,7 +24,9 @@ type FabProps = {
24
24
  href?: string;
25
25
  /**
26
26
  * A label after the icon, which makes this the extended FAB: as tall as
27
- * the size, as wide as what it holds.
27
+ * the size, as wide as what it holds. Kept to one line, it ends in an
28
+ * ellipsis when the FAB's container is narrower than it, and shows its
29
+ * full text in a tooltip on hover.
28
30
  */
29
31
  label?: ReactNode;
30
32
  /** The link's `rel`, when `href` is set. */
@@ -2,6 +2,7 @@
2
2
  import { props } from "../../node_modules/@stylexjs/stylex/lib/es/stylex.js";
3
3
  import { ButtonBase } from "../../button/index.js";
4
4
  import { extendedFabSizes, fabIconSizes, fabSizes, fabStyles, fabTones } from "../../fab/styles.js";
5
+ import { useClippedTitle } from "../../hooks/useClippedTitle.js";
5
6
  import { focus } from "../../styles/focus.js";
6
7
  import { c } from "react/compiler-runtime";
7
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -18,7 +19,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
18
19
  * ```
19
20
  */
20
21
  function Fab(t0) {
21
- const $ = c(20);
22
+ const $ = c(23);
22
23
  let children;
23
24
  let label;
24
25
  let props$1;
@@ -45,6 +46,7 @@ function Fab(t0) {
45
46
  const size = t1 === void 0 ? "md" : t1;
46
47
  const tone = t2 === void 0 ? "primary" : t2;
47
48
  const variant = t3 === void 0 ? "tonal" : t3;
49
+ const clipped = useClippedTitle(label);
48
50
  const t4 = label !== void 0;
49
51
  let t5;
50
52
  if ($[7] !== size || $[8] !== t4 || $[9] !== tone || $[10] !== variant) {
@@ -66,22 +68,33 @@ function Fab(t0) {
66
68
  $[14] = t6;
67
69
  } else t6 = $[14];
68
70
  let t7;
69
- if ($[15] !== label || $[16] !== props$1 || $[17] !== t5 || $[18] !== t6) {
70
- t7 = /* @__PURE__ */ jsxs(ButtonBase, {
71
+ if ($[15] !== clipped || $[16] !== label) {
72
+ t7 = label === void 0 ? null : /* @__PURE__ */ jsx("span", {
73
+ ...clipped,
74
+ ...props(fabStyles.label),
75
+ children: label
76
+ });
77
+ $[15] = clipped;
78
+ $[16] = label;
79
+ $[17] = t7;
80
+ } else t7 = $[17];
81
+ let t8;
82
+ if ($[18] !== props$1 || $[19] !== t5 || $[20] !== t6 || $[21] !== t7) {
83
+ t8 = /* @__PURE__ */ jsxs(ButtonBase, {
71
84
  ...props$1,
72
85
  classes: t5,
73
- children: [t6, label]
86
+ children: [t6, t7]
74
87
  });
75
- $[15] = label;
76
- $[16] = props$1;
77
- $[17] = t5;
78
- $[18] = t6;
79
- $[19] = t7;
80
- } else t7 = $[19];
81
- return t7;
88
+ $[18] = props$1;
89
+ $[19] = t5;
90
+ $[20] = t6;
91
+ $[21] = t7;
92
+ $[22] = t8;
93
+ } else t8 = $[22];
94
+ return t8;
82
95
  }
83
96
  function fabClasses(isExtended, size, tone, variant) {
84
- return (state) => props(fabStyles.base, focus.ring, fabTones[variant][tone], isExtended ? extendedFabSizes[size] : fabSizes[size], state.isHovered && fabStyles.hovered, state.isFocusVisible && fabStyles.focused, state.isPressed && fabStyles.pressed, state.isDisabled && fabStyles.disabled);
97
+ return (state) => props(fabStyles.base, focus.ring, fabTones[variant][tone], isExtended ? extendedFabSizes[size] : fabSizes[size], isExtended && fabStyles.extended, state.isHovered && fabStyles.hovered, state.isFocusVisible && fabStyles.focused, state.isPressed && fabStyles.pressed, state.isDisabled && fabStyles.disabled);
85
98
  }
86
99
  export { Fab as default };
87
100
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_c","stylex","extendedFabSizes","fabIconSizes","fabSizes","fabStyles","fabTones","focus","children","label","size","tone","variant","Fab","t0","$","props","t1","t2","t3","undefined","t4","t5","fabClasses","t6","icon","t7","isExtended","state","base","ring","isHovered","hovered","isFocusVisible","focused","isPressed","pressed","isDisabled","disabled"],"sources":["../../../src/components/fab/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport type { ButtonDOMProps, ButtonState } from '../../button';\nimport { ButtonBase } from '../../button';\nimport { extendedFabSizes, fabIconSizes, fabSizes, fabStyles, fabTones } from '../../fab/styles';\nimport { focus } from '../../styles/focus';\n\n// The FAB page's floating action button, and the extended FAB page's form of\n// it with a label: a screen's primary action, raised over the content on the\n// pages' level 3 shadow and lifted to level 4 under a hovering pointer.\n//\n// Three sizes, the pages' FAB, medium FAB and large FAB: `md` is 56dp with a\n// 24dp icon and a 16dp corner, `lg` 80dp with 28dp and 20dp, and `xl` 96dp\n// with 36dp and 28dp. The extended form keeps the size's height and corner\n// and sets a label after the icon in the size's type role — title medium,\n// title large and headline small — with 16dp, 26dp and 28dp of padding and\n// 8dp, 12dp and 16dp before the label. The 80dp size, the 20dp corner and\n// the 26dp and 28dp paddings fall between steps of their scales and are\n// written out. The pages' small FAB is gone from the newer set, so there is\n// no `xs`.\n//\n// Six colour pairs, by `tone` and `variant`: `tonal` draws the tone's\n// container pair — primary container is the pages' default — and `filled`\n// the tone itself, as Button's two variants of those names do.\n//\n// The hover, focus and pressed layers are the label colour at the usual 8%,\n// 10% and 10%, drawn as an image over the container, as the row module draws\n// its layers, so one style serves all six pairs. The pages give no disabled\n// FAB; a disabled one takes the 12% and 38% every disabled container takes,\n// and drops its shadow.\n//\n// Under forced colours the shadow goes and the container is painted over, so\n// the button is drawn as a 1px `ButtonText` rule, as Button's are.\n//\n// What every button does past its own styles — the ripple, the link form, a\n// parent's disabled state — is `src/button`'s, shared with Button and\n// IconButton. The styles below are `src/fab`'s, shared with FabMenu's FAB.\n\ntype FabProps = {\n /**\n * What the FAB does, in words. A FAB without a `label` is an icon alone,\n * which has no name of its own, so give it this; with a `label` the label\n * is its name.\n */\n 'aria-label'?: string;\n /** The FAB's icon, drawn at the size's icon size. */\n children?: ReactNode;\n /** A function may compute the class from the FAB's render state. */\n className?: ClassNameOrFunction<ButtonState>;\n /**\n * Disables the press ripple. The state layers are unaffected.\n * @default false\n */\n disableRipple?: boolean;\n /**\n * Where the FAB leads. Given one, it is rendered as a link — an `<a>`,\n * announced as the link it is — with the same styles and ripple.\n */\n href?: string;\n /**\n * A label after the icon, which makes this the extended FAB: as tall as\n * the size, as wide as what it holds.\n */\n label?: ReactNode;\n /** The link's `rel`, when `href` is set. */\n rel?: string;\n /**\n * The pages' three sizes: `md` the FAB at 56px, `lg` the medium FAB at\n * 80px and `xl` the large FAB at 96px.\n * @default 'md'\n */\n size?: FabSize;\n /** A function may compute the style from the FAB's render state. */\n style?: StyleOrFunction<ButtonState>;\n /** The link's `target`, when `href` is set. */\n target?: string;\n /**\n * The colour role the FAB is drawn in.\n * @default 'primary'\n */\n tone?: FabTone;\n /**\n * `tonal` draws the tone's container pair, the pages' default; `filled`\n * draws the tone itself.\n * @default 'tonal'\n */\n variant?: FabVariant;\n} & Omit<ButtonDOMProps, 'aria-label' | 'isPending'>;\ntype FabSize = 'lg' | 'md' | 'xl';\ntype FabTone = 'primary' | 'secondary' | 'tertiary';\ntype FabVariant = 'filled' | 'tonal';\n\n/**\n * A screen's primary action, raised over its content. Its icon is its\n * children; given a `label` it is the extended FAB, with the label after the\n * icon. Given `href` it is a link with the same appearance.\n *\n * ```tsx\n * <Fab aria-label=\"Label\">\n * <PlusIcon />\n * </Fab>\n * ```\n */\nfunction Fab({\n children,\n label,\n size = 'md',\n tone = 'primary',\n variant = 'tonal',\n ...props\n}: FabProps & RefAttributes<HTMLAnchorElement | HTMLButtonElement>) {\n return <ButtonBase {...props} classes={fabClasses(label !== undefined, size, tone, variant)}>\n {children === undefined ? null : <span {...stylex.props(fabStyles.icon, fabIconSizes[size])}>\n {children}\n </span>}\n {label}\n </ButtonBase>;\n}\n\n// The FAB's classes, from React Aria's render state: the layers from what it\n// reports rather than from `:hover` and `:active`, for Button's reasons — see\n// its header. Built by a call rather than written inline at the prop, which\n// is what react-perf's no-new-function-as-prop is after.\nfunction fabClasses(isExtended: boolean, size: FabSize, tone: FabTone, variant: FabVariant) {\n return (state: ButtonState) => stylex.props(fabStyles.base, focus.ring, fabTones[variant][tone], isExtended ? extendedFabSizes[size] : fabSizes[size], state.isHovered && fabStyles.hovered, state.isFocusVisible && fabStyles.focused, state.isPressed && fabStyles.pressed, state.isDisabled && fabStyles.disabled);\n}\nexport type { FabProps, FabSize, FabTone, FabVariant };\nexport default Fab;"],"mappings":";;;;;;;;;;;;;;;;;;;AA0GA,SAAAa,IAAAC,IAAA;CAAA,MAAAC,IAAAf,EAAA,EAAA;CAAA,IAAAQ;CAAA,IAAAC;CAAA,IAAAO;CAAA,IAAAC;CAAA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A,QAAAC,WAAAD,EAAA,QAAAO,MAAAP,EAAA,QAAAS,IAAA;EAHNE,KAAA,qBAAC,YAAD;GAAW,GAAKV;GAAgB,SAAAM;GAAhC,UAAA,CACFE,IAGAf,KAJa;;EAKHM,EAAA,MAAAN;EAAAM,EAAA,MAAAC;EAAAD,EAAA,MAAAO;EAAAP,EAAA,MAAAS;EAAAT,EAAA,MAAAW;CAAA,OAAAA,KAAAX,EAAA;CAAA,OALRW;AAKQ;AAOjB,SAASH,WAAWI,YAAqBjB,MAAeC,MAAeC,SAAqB;CAC1F,QAAQgB,UAAuB3B,MAAaI,UAAUwB,MAAMtB,MAAMuB,MAAMxB,SAASM,QAAQ,CAACD,OAAOgB,aAAazB,iBAAiBQ,QAAQN,SAASM,OAAOkB,MAAMG,aAAa1B,UAAU2B,SAASJ,MAAMK,kBAAkB5B,UAAU6B,SAASN,MAAMO,aAAa9B,UAAU+B,SAASR,MAAMS,cAAchC,UAAUiC,QAAQ;AACtT"}
1
+ {"version":3,"file":"index.js","names":["_c","stylex","extendedFabSizes","fabIconSizes","fabSizes","fabStyles","fabTones","useClippedTitle","focus","children","label","size","tone","variant","Fab","t0","$","props","t1","t2","t3","undefined","clipped","t4","t5","fabClasses","t6","icon","t7","t8","isExtended","state","base","ring","extended","isHovered","hovered","isFocusVisible","focused","isPressed","pressed","isDisabled","disabled"],"sources":["../../../src/components/fab/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { ClassNameOrFunction, StyleOrFunction } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport type { ButtonDOMProps, ButtonState } from '../../button';\nimport { ButtonBase } from '../../button';\nimport { extendedFabSizes, fabIconSizes, fabSizes, fabStyles, fabTones } from '../../fab/styles';\nimport { useClippedTitle } from '../../hooks/useClippedTitle';\nimport { focus } from '../../styles/focus';\n\n// The FAB page's floating action button, and the extended FAB page's form of\n// it with a label: a screen's primary action, raised over the content on the\n// pages' level 3 shadow and lifted to level 4 under a hovering pointer.\n//\n// Three sizes, the pages' FAB, medium FAB and large FAB: `md` is 56dp with a\n// 24dp icon and a 16dp corner, `lg` 80dp with 28dp and 20dp, and `xl` 96dp\n// with 36dp and 28dp. The extended form keeps the size's height and corner\n// and sets a label after the icon in the size's type role — title medium,\n// title large and headline small — with 16dp, 26dp and 28dp of padding and\n// 8dp, 12dp and 16dp before the label. The 80dp size, the 20dp corner and\n// the 26dp and 28dp paddings fall between steps of their scales and are\n// written out. The pages' small FAB is gone from the newer set, so there is\n// no `xs`.\n//\n// The label stays on one line, as the pages draw it. One wider than the box\n// the FAB is placed in is cut short with an ellipsis rather than wrapped onto\n// lines the fixed height has no room for, and the FAB keeps inside that box.\n// Its full text stays the button's name, and shows in the browser's tooltip\n// on hover once it is cut short — see `useClippedTitle`.\n//\n// Six colour pairs, by `tone` and `variant`: `tonal` draws the tone's\n// container pair — primary container is the pages' default — and `filled`\n// the tone itself, as Button's two variants of those names do.\n//\n// The hover, focus and pressed layers are the label colour at the usual 8%,\n// 10% and 10%, drawn as an image over the container, as the row module draws\n// its layers, so one style serves all six pairs. The pages give no disabled\n// FAB; a disabled one takes the 12% and 38% every disabled container takes,\n// and drops its shadow.\n//\n// Under forced colours the shadow goes and the container is painted over, so\n// the button is drawn as a 1px `ButtonText` rule, as Button's are.\n//\n// What every button does past its own styles — the ripple, the link form, a\n// parent's disabled state — is `src/button`'s, shared with Button and\n// IconButton. The styles below are `src/fab`'s, shared with FabMenu's FAB.\n\ntype FabProps = {\n /**\n * What the FAB does, in words. A FAB without a `label` is an icon alone,\n * which has no name of its own, so give it this; with a `label` the label\n * is its name.\n */\n 'aria-label'?: string;\n /** The FAB's icon, drawn at the size's icon size. */\n children?: ReactNode;\n /** A function may compute the class from the FAB's render state. */\n className?: ClassNameOrFunction<ButtonState>;\n /**\n * Disables the press ripple. The state layers are unaffected.\n * @default false\n */\n disableRipple?: boolean;\n /**\n * Where the FAB leads. Given one, it is rendered as a link — an `<a>`,\n * announced as the link it is — with the same styles and ripple.\n */\n href?: string;\n /**\n * A label after the icon, which makes this the extended FAB: as tall as\n * the size, as wide as what it holds. Kept to one line, it ends in an\n * ellipsis when the FAB's container is narrower than it, and shows its\n * full text in a tooltip on hover.\n */\n label?: ReactNode;\n /** The link's `rel`, when `href` is set. */\n rel?: string;\n /**\n * The pages' three sizes: `md` the FAB at 56px, `lg` the medium FAB at\n * 80px and `xl` the large FAB at 96px.\n * @default 'md'\n */\n size?: FabSize;\n /** A function may compute the style from the FAB's render state. */\n style?: StyleOrFunction<ButtonState>;\n /** The link's `target`, when `href` is set. */\n target?: string;\n /**\n * The colour role the FAB is drawn in.\n * @default 'primary'\n */\n tone?: FabTone;\n /**\n * `tonal` draws the tone's container pair, the pages' default; `filled`\n * draws the tone itself.\n * @default 'tonal'\n */\n variant?: FabVariant;\n} & Omit<ButtonDOMProps, 'aria-label' | 'isPending'>;\ntype FabSize = 'lg' | 'md' | 'xl';\ntype FabTone = 'primary' | 'secondary' | 'tertiary';\ntype FabVariant = 'filled' | 'tonal';\n\n/**\n * A screen's primary action, raised over its content. Its icon is its\n * children; given a `label` it is the extended FAB, with the label after the\n * icon. Given `href` it is a link with the same appearance.\n *\n * ```tsx\n * <Fab aria-label=\"Label\">\n * <PlusIcon />\n * </Fab>\n * ```\n */\nfunction Fab({\n children,\n label,\n size = 'md',\n tone = 'primary',\n variant = 'tonal',\n ...props\n}: FabProps & RefAttributes<HTMLAnchorElement | HTMLButtonElement>) {\n const clipped = useClippedTitle(label);\n return <ButtonBase {...props} classes={fabClasses(label !== undefined, size, tone, variant)}>\n {children === undefined ? null : <span {...stylex.props(fabStyles.icon, fabIconSizes[size])}>\n {children}\n </span>}\n {label === undefined ? null : <span {...clipped} {...stylex.props(fabStyles.label)}>\n {label}\n </span>}\n </ButtonBase>;\n}\n\n// The FAB's classes, from React Aria's render state: the layers from what it\n// reports rather than from `:hover` and `:active`, for Button's reasons — see\n// its header. Built by a call rather than written inline at the prop, which\n// is what react-perf's no-new-function-as-prop is after.\nfunction fabClasses(isExtended: boolean, size: FabSize, tone: FabTone, variant: FabVariant) {\n return (state: ButtonState) => stylex.props(fabStyles.base, focus.ring, fabTones[variant][tone], isExtended ? extendedFabSizes[size] : fabSizes[size], isExtended && fabStyles.extended, state.isHovered && fabStyles.hovered, state.isFocusVisible && fabStyles.focused, state.isPressed && fabStyles.pressed, state.isDisabled && fabStyles.disabled);\n}\nexport type { FabProps, FabSize, FabTone, FabVariant };\nexport default Fab;"],"mappings":";;;;;;;;;;;;;;;;;;;;AAmHA,SAAAc,IAAAC,IAAA;CAAA,MAAAC,IAAAhB,EAAA,EAAA;CAAA,IAAAS;CAAA,IAAAC;CAAA,IAAAO;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAJ,EAAA,OAAAD,IAAA;EAAa,CAAA,CAAAN,UAAAC,OAAAC,MAAAO,IAAAN,MAAAO,IAAAN,SAAAO,IAAA,GAAAH,WAAAF;EAOqDC,EAAA,KAAAD;EAAAC,EAAA,KAAAP;EAAAO,EAAA,KAAAN;EAAAM,EAAA,KAAAC;EAAAD,EAAA,KAAAE;EAAAF,EAAA,KAAAG;EAAAH,EAAA,KAAAI;CAAA,OAAA;EAAAX,WAAAO,EAAA;EAAAN,QAAAM,EAAA;EAAAC,UAAAD,EAAA;EAAAE,KAAAF,EAAA;EAAAG,KAAAH,EAAA;EAAAI,KAAAJ,EAAA;CAAA;CAJhE,MAAAL,OAAAO,OAAAG,KAAAA,IAAA,OAAAH;CACA,MAAAN,OAAAO,OAAAE,KAAAA,IAAA,YAAAF;CACA,MAAAN,UAAAO,OAAAC,KAAAA,IAAA,UAAAD;CAGA,MAAAE,UAAgBf,gBAAgBG,KAAK;CACa,MAAAa,KAAAb,UAAUW,KAAAA;CAAS,IAAAG;CAAA,IAAAR,EAAA,OAAAL,QAAAK,EAAA,OAAAO,MAAAP,EAAA,OAAAJ,QAAAI,EAAA,QAAAH,SAAA;EAA9BW,KAAAC,WAAW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