@kanso-labs/kanso-ui 0.43.7 → 0.44.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) 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/app-bar/index.d.ts +9 -5
  15. package/dist/components/app-bar/index.js +400 -170
  16. package/dist/components/app-bar/index.js.map +1 -1
  17. package/dist/components/button/index.js.map +1 -1
  18. package/dist/components/calendar/index.d.ts +8 -1
  19. package/dist/components/calendar/index.js +129 -73
  20. package/dist/components/calendar/index.js.map +1 -1
  21. package/dist/components/checkbox/index.js +31 -31
  22. package/dist/components/checkbox/index.js.map +1 -1
  23. package/dist/components/checkbox-group/index.js +4 -2
  24. package/dist/components/checkbox-group/index.js.map +1 -1
  25. package/dist/components/chip/index.js +1 -1
  26. package/dist/components/chip/index.js.map +1 -1
  27. package/dist/components/chip-group/index.d.ts +35 -5
  28. package/dist/components/chip-group/index.js +137 -97
  29. package/dist/components/chip-group/index.js.map +1 -1
  30. package/dist/components/copy-field/index.js +1 -1
  31. package/dist/components/copy-field/index.js.map +1 -1
  32. package/dist/components/currency/index.d.ts +64 -6
  33. package/dist/components/currency/index.js +117 -40
  34. package/dist/components/currency/index.js.map +1 -1
  35. package/dist/components/date-picker/index.js +1 -1
  36. package/dist/components/dialog/index.d.ts +3 -1
  37. package/dist/components/dialog/index.js +115 -81
  38. package/dist/components/dialog/index.js.map +1 -1
  39. package/dist/components/disclosure-group/index.js +1 -1
  40. package/dist/components/disclosure-group/index.js.map +1 -1
  41. package/dist/components/icon-button/index.js +18 -1
  42. package/dist/components/icon-button/index.js.map +1 -1
  43. package/dist/components/index.d.ts +2 -2
  44. package/dist/components/keycap/index.d.ts +3 -0
  45. package/dist/components/keycap/index.js +30 -44
  46. package/dist/components/keycap/index.js.map +1 -1
  47. package/dist/components/list/index.d.ts +16 -2
  48. package/dist/components/list/index.js +124 -69
  49. package/dist/components/list/index.js.map +1 -1
  50. package/dist/components/list-detail/index.d.ts +11 -3
  51. package/dist/components/list-detail/index.js +13 -6
  52. package/dist/components/list-detail/index.js.map +1 -1
  53. package/dist/components/list-item/index.d.ts +16 -1
  54. package/dist/components/list-item/index.js.map +1 -1
  55. package/dist/components/menu/index.d.ts +6 -2
  56. package/dist/components/menu/index.js +22 -15
  57. package/dist/components/menu/index.js.map +1 -1
  58. package/dist/components/meter/index.d.ts +4 -1
  59. package/dist/components/meter/index.js +6 -0
  60. package/dist/components/meter/index.js.map +1 -1
  61. package/dist/components/navigation-bar/index.d.ts +14 -4
  62. package/dist/components/navigation-bar/index.js +77 -50
  63. package/dist/components/navigation-bar/index.js.map +1 -1
  64. package/dist/components/navigation-rail/index.d.ts +3 -2
  65. package/dist/components/navigation-rail/index.js +59 -52
  66. package/dist/components/navigation-rail/index.js.map +1 -1
  67. package/dist/components/navigation-tree/index.js +4 -1
  68. package/dist/components/navigation-tree/index.js.map +1 -1
  69. package/dist/components/number-field/index.d.ts +3 -2
  70. package/dist/components/number-field/index.js +91 -115
  71. package/dist/components/number-field/index.js.map +1 -1
  72. package/dist/components/popover/index.d.ts +3 -1
  73. package/dist/components/popover/index.js +102 -100
  74. package/dist/components/popover/index.js.map +1 -1
  75. package/dist/components/progress-indicator/index.d.ts +4 -2
  76. package/dist/components/progress-indicator/index.js +4 -3
  77. package/dist/components/progress-indicator/index.js.map +1 -1
  78. package/dist/components/radio-group/index.js +34 -24
  79. package/dist/components/radio-group/index.js.map +1 -1
  80. package/dist/components/search-field/index.d.ts +11 -1
  81. package/dist/components/search-field/index.js +32 -28
  82. package/dist/components/search-field/index.js.map +1 -1
  83. package/dist/components/segmented-button/index.d.ts +9 -2
  84. package/dist/components/segmented-button/index.js +1 -1
  85. package/dist/components/segmented-button/index.js.map +1 -1
  86. package/dist/components/separator/index.d.ts +19 -7
  87. package/dist/components/separator/index.js +36 -13
  88. package/dist/components/separator/index.js.map +1 -1
  89. package/dist/components/sheet/index.js +29 -25
  90. package/dist/components/sheet/index.js.map +1 -1
  91. package/dist/components/snackbar/index.d.ts +4 -1
  92. package/dist/components/snackbar/index.js +140 -55
  93. package/dist/components/snackbar/index.js.map +1 -1
  94. package/dist/components/stack/index.d.ts +6 -3
  95. package/dist/components/stack/index.js +48 -31
  96. package/dist/components/stack/index.js.map +1 -1
  97. package/dist/components/switch/index.d.ts +16 -6
  98. package/dist/components/switch/index.js +116 -62
  99. package/dist/components/switch/index.js.map +1 -1
  100. package/dist/components/text-area/index.d.ts +10 -1
  101. package/dist/components/text-area/index.js +21 -19
  102. package/dist/components/text-area/index.js.map +1 -1
  103. package/dist/components/text-field/index.d.ts +16 -2
  104. package/dist/components/text-field/index.js +49 -43
  105. package/dist/components/text-field/index.js.map +1 -1
  106. package/dist/components/time-picker/index.js +1 -1
  107. package/dist/components/tooltip/index.d.ts +3 -1
  108. package/dist/components/tooltip/index.js.map +1 -1
  109. package/dist/components/tree/index.d.ts +15 -3
  110. package/dist/components/tree/index.js +41 -28
  111. package/dist/components/tree/index.js.map +1 -1
  112. package/dist/control/index.js +26 -23
  113. package/dist/control/index.js.map +1 -1
  114. package/dist/control/styles.js +7 -1
  115. package/dist/control/styles.js.map +1 -1
  116. package/dist/field/index.js +220 -193
  117. package/dist/field/index.js.map +1 -1
  118. package/dist/field/styles.js +64 -8
  119. package/dist/field/styles.js.map +1 -1
  120. package/dist/glyphs/index.js +37 -1
  121. package/dist/glyphs/index.js.map +1 -1
  122. package/dist/hooks/useClippedTitle.js +44 -0
  123. package/dist/hooks/useClippedTitle.js.map +1 -0
  124. package/dist/hooks/useRipple.js +7 -6
  125. package/dist/hooks/useRipple.js.map +1 -1
  126. package/dist/hooks/useScrollStop.js +133 -0
  127. package/dist/hooks/useScrollStop.js.map +1 -0
  128. package/dist/i18n/index.js +1 -0
  129. package/dist/i18n/index.js.map +1 -1
  130. package/dist/i18n/messages.js +34 -0
  131. package/dist/i18n/messages.js.map +1 -1
  132. package/dist/index.d.ts +2 -2
  133. package/dist/indicator/index.js +18 -16
  134. package/dist/indicator/index.js.map +1 -1
  135. package/dist/indicator/styles.js +3 -0
  136. package/dist/indicator/styles.js.map +1 -1
  137. package/dist/keycap/context.js +7 -0
  138. package/dist/keycap/context.js.map +1 -0
  139. package/dist/layout.d.ts +4 -1
  140. package/dist/layout.js +4 -1
  141. package/dist/layout.js.map +1 -1
  142. package/dist/navigation/index.d.ts +16 -2
  143. package/dist/navigation/index.js +145 -44
  144. package/dist/navigation/index.js.map +1 -1
  145. package/dist/navigation/styles.js +79 -16
  146. package/dist/navigation/styles.js.map +1 -1
  147. package/dist/row/index.js +92 -89
  148. package/dist/row/index.js.map +1 -1
  149. package/dist/row/styles.js +26 -2
  150. package/dist/row/styles.js.map +1 -1
  151. package/dist/styles/overlay.d.ts +6 -2
  152. package/dist/styles/overlay.js +4 -1
  153. package/dist/styles/overlay.js.map +1 -1
  154. package/dist/styles.css +296 -38
  155. package/dist/theme-scope.d.ts +5 -1
  156. package/dist/theme-scope.js +100 -51
  157. package/dist/theme-scope.js.map +1 -1
  158. package/dist/tokens/design.tokens.stylex.js.map +1 -1
  159. package/package.json +21 -20
  160. package/dist/hooks/useScrollable.js +0 -69
  161. package/dist/hooks/useScrollable.js.map +0 -1
@@ -5,9 +5,13 @@ import { focus } from "../../styles/focus.js";
5
5
  import { calendarStyles, dateLayers } from "../../calendar/styles.js";
6
6
  import { CalendarFrame, CalendarGridHeader as CalendarGridHeader$1 } from "../../calendar/index.js";
7
7
  import { monthOffsets } from "../../calendar/months.js";
8
+ import { invalidFrom } from "../../field/root.js";
9
+ import { fieldChromeStyles } from "../../field/styles.js";
8
10
  import { c } from "react/compiler-runtime";
9
- import { jsx, jsxs } from "react/jsx-runtime";
10
- import { Calendar, CalendarCell, CalendarGrid, CalendarGridBody } from "react-aria-components";
11
+ import { useContext } from "react";
12
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
13
+ import { Calendar, CalendarCell, CalendarGrid, CalendarGridBody, CalendarStateContext, Text } from "react-aria-components";
14
+ import { isSameDay } from "@internationalized/date";
11
15
  //#region src/components/calendar/index.tsx
12
16
  /**
13
17
  * A month calendar for picking a date. The value is React Aria's: pass
@@ -31,85 +35,82 @@ import { Calendar, CalendarCell, CalendarGrid, CalendarGridBody } from "react-ar
31
35
  * element a layout positions.
32
36
  */
33
37
  function Calendar$1(t0) {
34
- const $ = c(23);
38
+ const $ = c(20);
35
39
  let T0;
36
- let T1;
40
+ let error;
41
+ let props$1;
42
+ let showMonthYearMenus;
37
43
  let t1;
38
44
  let t2;
39
45
  let t3;
40
- let t4;
41
- let t5;
42
- let t6;
43
46
  if ($[0] !== t0) {
44
- const { showMonthYearMenus: t7, ...props$1 } = t0;
45
- const showMonthYearMenus = t7 === void 0 ? false : t7;
46
- T1 = Calendar;
47
- t5 = props$1;
48
- t6 = mergeStatefulStyles(props(calendarStyles.root), props$1);
49
- T0 = CalendarFrame;
50
- t3 = props$1.visibleDuration?.months ?? 1;
51
- t4 = showMonthYearMenus;
52
- if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
53
- t1 = props(calendarStyles.months);
47
+ const { error: t4, showMonthYearMenus: t5, ...t6 } = t0;
48
+ error = t4;
49
+ props$1 = t6;
50
+ showMonthYearMenus = t5 === void 0 ? false : t5;
51
+ T0 = Calendar;
52
+ if ($[8] !== error) {
53
+ t1 = invalidFrom(error);
54
+ $[8] = error;
54
55
  $[9] = t1;
55
56
  } else t1 = $[9];
56
- t2 = monthOffsets(props$1.visibleDuration?.months ?? 1).map(_temp);
57
+ t2 = props$1;
58
+ t3 = mergeStatefulStyles(props(calendarStyles.root), props$1);
57
59
  $[0] = t0;
58
60
  $[1] = T0;
59
- $[2] = T1;
60
- $[3] = t1;
61
- $[4] = t2;
62
- $[5] = t3;
63
- $[6] = t4;
64
- $[7] = t5;
65
- $[8] = t6;
61
+ $[2] = error;
62
+ $[3] = props$1;
63
+ $[4] = showMonthYearMenus;
64
+ $[5] = t1;
65
+ $[6] = t2;
66
+ $[7] = t3;
66
67
  } else {
67
68
  T0 = $[1];
68
- T1 = $[2];
69
- t1 = $[3];
70
- t2 = $[4];
71
- t3 = $[5];
72
- t4 = $[6];
73
- t5 = $[7];
74
- t6 = $[8];
69
+ error = $[2];
70
+ props$1 = $[3];
71
+ showMonthYearMenus = $[4];
72
+ t1 = $[5];
73
+ t2 = $[6];
74
+ t3 = $[7];
75
75
  }
76
- let t7;
77
- if ($[10] !== t1 || $[11] !== t2) {
78
- t7 = /* @__PURE__ */ jsx("div", {
79
- ...t1,
80
- children: t2
81
- });
82
- $[10] = t1;
83
- $[11] = t2;
84
- $[12] = t7;
85
- } else t7 = $[12];
86
- let t8;
87
- if ($[13] !== T0 || $[14] !== t3 || $[15] !== t4 || $[16] !== t7) {
88
- t8 = /* @__PURE__ */ jsx(T0, {
89
- months: t3,
90
- showMonthYearMenus: t4,
91
- children: t7
92
- });
93
- $[13] = T0;
94
- $[14] = t3;
95
- $[15] = t4;
96
- $[16] = t7;
97
- $[17] = t8;
98
- } else t8 = $[17];
99
- let t9;
100
- if ($[18] !== T1 || $[19] !== t5 || $[20] !== t6 || $[21] !== t8) {
101
- t9 = /* @__PURE__ */ jsx(T1, {
102
- ...t5,
103
- ...t6,
104
- children: t8
76
+ let t4;
77
+ if ($[10] !== error || $[11] !== props$1.visibleDuration?.months || $[12] !== showMonthYearMenus) {
78
+ t4 = (t5) => {
79
+ const { isInvalid } = t5;
80
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CalendarFrame, {
81
+ months: props$1.visibleDuration?.months ?? 1,
82
+ showMonthYearMenus,
83
+ children: /* @__PURE__ */ jsx("div", {
84
+ ...props(calendarStyles.months),
85
+ children: monthOffsets(props$1.visibleDuration?.months ?? 1).map(_temp)
86
+ })
87
+ }), isInvalid && error !== void 0 ? /* @__PURE__ */ jsx(Text, {
88
+ slot: "errorMessage",
89
+ ...props(fieldChromeStyles.message, fieldChromeStyles.messageError),
90
+ children: error
91
+ }) : null] });
92
+ };
93
+ $[10] = error;
94
+ $[11] = props$1.visibleDuration?.months;
95
+ $[12] = showMonthYearMenus;
96
+ $[13] = t4;
97
+ } else t4 = $[13];
98
+ let t5;
99
+ if ($[14] !== T0 || $[15] !== t1 || $[16] !== t2 || $[17] !== t3 || $[18] !== t4) {
100
+ t5 = /* @__PURE__ */ jsx(T0, {
101
+ isInvalid: t1,
102
+ ...t2,
103
+ ...t3,
104
+ children: t4
105
105
  });
106
- $[18] = T1;
106
+ $[14] = T0;
107
+ $[15] = t1;
108
+ $[16] = t2;
109
+ $[17] = t3;
110
+ $[18] = t4;
107
111
  $[19] = t5;
108
- $[20] = t6;
109
- $[21] = t8;
110
- $[22] = t9;
111
- } else t9 = $[22];
112
- return t9;
112
+ } else t5 = $[19];
113
+ return t5;
113
114
  }
114
115
  function _temp(offset) {
115
116
  return /* @__PURE__ */ jsx("div", {
@@ -121,14 +122,69 @@ function _temp(offset) {
121
122
  })
122
123
  }, offset.months);
123
124
  }
124
- function cellClassName(state) {
125
- return props(calendarStyles.cell, focus.ring, state.isToday && calendarStyles.cellToday, state.isSelected && calendarStyles.cellSelected, state.isHovered && (state.isSelected ? dateLayers.selectedHovered : dateLayers.plainHovered), state.isPressed && (state.isSelected ? dateLayers.selectedPressed : dateLayers.plainPressed), state.isUnavailable && calendarStyles.cellUnavailable, state.isDisabled && calendarStyles.cellDisabled).className ?? "";
125
+ function cellClassName(state, calendar) {
126
+ return props(calendarStyles.cell, focus.ring, state.isToday && calendarStyles.cellToday, state.isSelected && calendarStyles.cellSelected, state.isSelected && state.isInvalid && calendarStyles.cellInvalid, calendar.isReadOnly && calendarStyles.cellReadOnly, !calendar.isReadOnly && state.isHovered && hoveredLayer(state), state.isPressed && pressedLayer(state), state.isUnavailable && calendarStyles.cellUnavailable, state.isDisabled && calendarStyles.cellDisabled, calendar.isHeldWhileDisabled && !state.isOutsideMonth && calendarStyles.cellSelectedDisabled).className ?? "";
127
+ }
128
+ function cellClassNameIn(calendar) {
129
+ return (state) => cellClassName(state, calendar);
130
+ }
131
+ /**
132
+ * One date. React Aria's cell, with what its classes need from the calendar
133
+ * read from React Aria's calendar state: whether it is read-only, and the
134
+ * date it holds, which React Aria hides from the cell itself once the
135
+ * calendar is disabled.
136
+ *
137
+ * Held means what React Aria would have called selected with the calendar
138
+ * enabled: the value, inside the bounds, and in its own month's grid rather
139
+ * than a neighbour's, which the classes check.
140
+ */
141
+ function DateCell(t0) {
142
+ const $ = c(8);
143
+ const { date } = t0;
144
+ const calendar = useContext(CalendarStateContext);
145
+ let T0;
146
+ let t1;
147
+ if ($[0] !== calendar || $[1] !== date) {
148
+ const isHeldWhileDisabled = calendar !== null && calendar.isDisabled && !calendar.isInvalid(date) && holds(calendar.value, date);
149
+ T0 = CalendarCell;
150
+ t1 = cellClassNameIn({
151
+ isHeldWhileDisabled,
152
+ isReadOnly: calendar?.isReadOnly ?? false
153
+ });
154
+ $[0] = calendar;
155
+ $[1] = date;
156
+ $[2] = T0;
157
+ $[3] = t1;
158
+ } else {
159
+ T0 = $[2];
160
+ t1 = $[3];
161
+ }
162
+ let t2;
163
+ if ($[4] !== T0 || $[5] !== date || $[6] !== t1) {
164
+ t2 = /* @__PURE__ */ jsx(T0, {
165
+ className: t1,
166
+ date
167
+ });
168
+ $[4] = T0;
169
+ $[5] = date;
170
+ $[6] = t1;
171
+ $[7] = t2;
172
+ } else t2 = $[7];
173
+ return t2;
126
174
  }
127
175
  function gridCell(date) {
128
- return /* @__PURE__ */ jsx(CalendarCell, {
129
- className: cellClassName,
130
- date
131
- });
176
+ return /* @__PURE__ */ jsx(DateCell, { date });
177
+ }
178
+ function holds(value, date) {
179
+ return (value !== null && "length" in value ? value : [value]).some((entry) => entry !== null && isSameDay(entry, date));
180
+ }
181
+ function hoveredLayer(state) {
182
+ if (!state.isSelected) return dateLayers.plainHovered;
183
+ return state.isInvalid ? dateLayers.invalidHovered : dateLayers.selectedHovered;
184
+ }
185
+ function pressedLayer(state) {
186
+ if (!state.isSelected) return dateLayers.plainPressed;
187
+ return state.isInvalid ? dateLayers.invalidPressed : dateLayers.selectedPressed;
132
188
  }
133
189
  //#endregion
134
190
  export { Calendar$1 as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","CalendarDate","ReactElement","RefAttributes","DateValue","CalendarProps","RACCalendarProps","stylex","Calendar","RACCalendar","CalendarCell","RACCalendarCell","CalendarGrid","RACCalendarGrid","CalendarGridBody","RACCalendarGridBody","CalendarFrame","CalendarGridHeader","monthOffsets","calendarStyles","dateLayers","focus","mergeStatefulStyles","className","T","showMonthYearMenus","style","Omit","t0","$","T0","T1","t1","t2","t3","t4","t5","t6","t7","props","undefined","root","visibleDuration","months","Symbol","for","map","_temp","t8","t9","offset","month","grid","gridCell","cellClassName","state","isDisabled","isHovered","isPressed","isSelected","isToday","isUnavailable","cell","ring","cellToday","cellSelected","selectedHovered","plainHovered","selectedPressed","plainPressed","cellUnavailable","cellDisabled","date","Calendar","_c","props","RACCalendar","stylex.props","RACCalendarGrid","CalendarGridHeader","RACCalendarGridBody","RACCalendarCell"],"sources":["../../../src/components/calendar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { CalendarDate } from '@internationalized/date';\nimport type { ReactElement, RefAttributes } from 'react';\nimport type { DateValue, CalendarProps as RACCalendarProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { Calendar as RACCalendar, CalendarCell as RACCalendarCell, CalendarGrid as RACCalendarGrid, CalendarGridBody as RACCalendarGridBody } from 'react-aria-components';\nimport { CalendarFrame, CalendarGridHeader } from '../../calendar';\nimport { monthOffsets } from '../../calendar/months';\nimport { calendarStyles, dateLayers } from '../../calendar/styles';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// The date pickers page's docked calendar: a month grid with a circle on the\n// selected date and an outline on today. Its values are that page's — a\n// 360dp container on the high surface container, 48dp date cells with a 40dp\n// state layer inside them, body-large for both the weekday row and the dates,\n// primary for the selected circle and for today's outline.\n//\n// The page's container is 456dp tall, which this does not take: that height\n// is a picker's, counting a headline and an action row the calendar itself\n// does not draw. What is held instead is the grid, at six weeks — the most\n// any month occupies — so the calendar keeps its height as the month moves\n// and a shorter month leaves its last rows empty. `months` in\n// `src/calendar/styles.ts` is where the room is reserved.\n//\n// `showMonthYearMenus` draws the page's docked header instead of one heading:\n// the month's menu button between the chevrons that step it and the year's\n// after them, each opening its list where the grid was. The parts are in\n// `src/calendar`, shared with RangeCalendar.\n//\n// Five things are this component's own.\n//\n// **The year menu has no chevrons of its own.** The page draws a pair either\n// side of it that step a year, which would need two names React Aria has no\n// message for — the library writes a word of its own only behind a prop that\n// can replace it, and it would take a pair on four components. The year list\n// reaches any year within a century of the one shown in one press, or any\n// the bounds allow where they are closer, and Shift with Page Up or Page\n// Down steps a year from the keyboard.\n//\n// **The cell is a circle in a square.** The page gives the date a 48dp\n// container and a 40dp state layer, which is a 40dp circle with 4dp of room\n// around it. The circle is the element, centred in a 48dp column and a 48dp\n// row — the pitch Compose lays its days at — and a transparent box reaching\n// the 4dp past it on every side makes the whole square the press target,\n// rather than a 48dp box with a 40dp box inside it. The chevrons and the\n// month and year menu buttons reach a 48dp target the same way.\n//\n// **It narrows to its container.** The page's docked calendar is 360dp, and\n// a compact window leaves 328dp between its margins, so the calendar is 360\n// at most and the columns share whatever is left below that. Under about\n// 304dp of content a column is narrower than its 40dp circle, and the\n// circles of neighbouring dates meet.\n//\n// **A date from the month either side is faded because it is disabled, not\n// because it is outside.** React Aria marks those cells `data-outside-month`\n// and disables them in the same breath, so a treatment keyed on the first\n// would never draw anything the second had not already drawn. The disabled\n// fade is the page's 38% either way.\n//\n// **Today reads as today whether or not it is selected.** The page gives it\n// an outline and the primary label; selected gives it a filled circle and the\n// on-primary label. A selected today takes the fill, since a circle already\n// says where you are and two rings would say it twice.\n//\n// **The month is moved by IconButton's shape rather than by IconButton.**\n// React Aria wires `slot=\"previous\"` and `slot=\"next\"` on its own `Button`,\n// and IconButton renders React Aria's `Button` too — so nesting one inside\n// the slot would put two buttons where the page draws one. The chevrons take\n// the standard icon button's 40dp square and its state layer instead.\n\ntype CalendarProps<T extends DateValue = DateValue> = {\n /** A function may compute the class from the calendar's render state. */\n className?: RACCalendarProps<T>['className'];\n /**\n * Whether the header draws the month and the year as menu buttons, each\n * opening a list of them in the grid's place, as the docked date picker's\n * header does, rather than one heading between the chevrons. For a date\n * far from the one shown, such as a date of birth: the year list runs a\n * century either side of the year shown, or to `minValue` and `maxValue`\n * where they are closer.\n *\n * For one visible month. With `visibleDuration` of more than one, the\n * header is the plain one, whose heading names every month shown — the\n * menus name only the first, which would leave the others unlabelled.\n * @default false\n */\n showMonthYearMenus?: boolean;\n /** A function may compute the style from the calendar's render state. */\n style?: RACCalendarProps<T>['style'];\n} & Omit<RACCalendarProps<T>, 'children' | 'className' | 'style'>;\n\n/**\n * A month calendar for picking a date. The value is React Aria's: pass\n * `value` with `onChange` to control it, or `defaultValue` to let it keep its\n * own, both as an `@internationalized/date` value from this package's\n * `./date` subpath.\n *\n * ```tsx\n * import { today, getLocalTimeZone } from '@kanso-labs/kanso-ui/date'\n *\n * <Calendar aria-label=\"Label\" defaultValue={today(getLocalTimeZone())} />\n * ```\n *\n * `minValue` and `maxValue` bound it, `isDateUnavailable` rules individual\n * dates out, and `visibleDuration` of `{ months: 2 }` draws two months side\n * by side, stacked below the expanded breakpoint. Name it with `aria-label`\n * or `aria-labelledby`; React Aria composes the visible month into that name\n * itself.\n *\n * The call site's `className` and `style` land on the container, which is the\n * element a layout positions.\n */\nfunction Calendar<T extends DateValue>({\n showMonthYearMenus = false,\n ...props\n}: CalendarProps<T> & RefAttributes<HTMLDivElement>) {\n return <RACCalendar<T> {...props} {...mergeStatefulStyles(stylex.props(calendarStyles.root), props)}>\n <CalendarFrame months={props.visibleDuration?.months ?? 1} showMonthYearMenus={showMonthYearMenus}>\n <div {...stylex.props(calendarStyles.months)}>\n {monthOffsets(props.visibleDuration?.months ?? 1).map(offset => <div key={offset.months} {...stylex.props(calendarStyles.month)}>\n <RACCalendarGrid offset={offset} {...stylex.props(calendarStyles.grid)}>\n <CalendarGridHeader />\n <RACCalendarGridBody>{gridCell}</RACCalendarGridBody>\n </RACCalendarGrid>\n </div>)}\n </div>\n </CalendarFrame>\n </RACCalendar>;\n}\n\n// A date's classes, from React Aria's render state. StyleX cannot target\n// `[data-selected]` on the element it is styling, so the state comes from\n// what React Aria hands the className.\n//\n// The order matters. `selected` is applied after `today`, so a selected today\n// takes the fill rather than the outline — a circle already says where you\n// are, and two rings would say it twice. The hover and pressed layers come\n// next, over whichever ground the date has, a press over a hover.\n// `unavailable` and `disabled` come last, and StyleX replaces a property\n// whole, so they take the layers with them.\nfunction cellClassName(state: {\n isDisabled: boolean;\n isHovered: boolean;\n isPressed: boolean;\n isSelected: boolean;\n isToday: boolean;\n isUnavailable: boolean;\n}) {\n return stylex.props(calendarStyles.cell, focus.ring, state.isToday && calendarStyles.cellToday, state.isSelected && calendarStyles.cellSelected, state.isHovered && (state.isSelected ? dateLayers.selectedHovered : dateLayers.plainHovered), state.isPressed && (state.isSelected ? dateLayers.selectedPressed : dateLayers.plainPressed), state.isUnavailable && calendarStyles.cellUnavailable, state.isDisabled && calendarStyles.cellDisabled).className ?? '';\n}\nfunction gridCell(date: CalendarDate): ReactElement {\n return <RACCalendarCell className={cellClassName} date={date} />;\n}\nexport type { CalendarProps };\nexport default Calendar;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkHA,SAAAS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,WAAWgD,kBAAkBhD,WAAWiD,eAAed,MAAMM,iBAAiB1C,eAAemD,iBAAiBf,MAAMC,cAAcrC,eAAeoD,YAAY,CAAC,CAAChD,aAAa;AACpc;AACA,SAAS8B,SAASmB,MAAkC;CAClD,OAAO,oBAACS,cAAD;EAAiB,WAAW3B;EAAqBkB;CAAK,CAAA;AAC/D"}
1
+ {"version":3,"file":"index.js","names":["c","_c","CalendarDate","ReactElement","RefAttributes","CalendarCellRenderProps","CalendarRenderProps","DateValue","CalendarProps","RACCalendarProps","isSameDay","stylex","useContext","CalendarStateContext","Calendar","RACCalendar","CalendarCell","RACCalendarCell","CalendarGrid","RACCalendarGrid","CalendarGridBody","RACCalendarGridBody","Text","RACText","CalendarFrame","CalendarGridHeader","monthOffsets","calendarStyles","dateLayers","invalidFrom","fieldChromeStyles","focus","mergeStatefulStyles","className","T","error","showMonthYearMenus","style","Omit","CalendarStates","isHeldWhileDisabled","isReadOnly","t0","$","T0","props","t1","t2","t3","t4","t5","t6","undefined","root","visibleDuration","months","isInvalid","map","_temp","message","messageError","offset","month","grid","gridCell","cellClassName","state","calendar","cell","ring","isToday","cellToday","isSelected","cellSelected","cellInvalid","cellReadOnly","isHovered","hoveredLayer","isPressed","pressedLayer","isUnavailable","cellUnavailable","isDisabled","cellDisabled","isOutsideMonth","cellSelectedDisabled","cellClassNameIn","DateCell","date","holds","value","held","some","entry","plainHovered","invalidHovered","selectedHovered","plainPressed","invalidPressed","selectedPressed","Calendar","_c","props","RACCalendar","stylex.props","RACText","RACCalendarGrid","CalendarGridHeader","RACCalendarGridBody","RACCalendarCell"],"sources":["../../../src/components/calendar/index.tsx"],"sourcesContent":["'use client';\n\nimport type { CalendarDate } from '@internationalized/date';\nimport type { ReactElement, RefAttributes } from 'react';\nimport type { CalendarCellRenderProps, CalendarRenderProps, DateValue, CalendarProps as RACCalendarProps } from 'react-aria-components';\nimport { isSameDay } from '@internationalized/date';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext } from 'react';\nimport { CalendarStateContext, Calendar as RACCalendar, CalendarCell as RACCalendarCell, CalendarGrid as RACCalendarGrid, CalendarGridBody as RACCalendarGridBody, Text as RACText } from 'react-aria-components';\nimport { CalendarFrame, CalendarGridHeader } from '../../calendar';\nimport { monthOffsets } from '../../calendar/months';\nimport { calendarStyles, dateLayers } from '../../calendar/styles';\nimport { invalidFrom } from '../../field/root';\nimport { fieldChromeStyles } from '../../field/styles';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// The date pickers page's docked calendar: a month grid with a circle on the\n// selected date and an outline on today. Its values are that page's — a\n// 360dp container on the high surface container, 48dp date cells with a 40dp\n// state layer inside them, body-large for both the weekday row and the dates,\n// primary for the selected circle and for today's outline.\n//\n// The page's container is 456dp tall, which this does not take: that height\n// is a picker's, counting a headline and an action row the calendar itself\n// does not draw. What is held instead is the grid, at six weeks — the most\n// any month occupies — so the calendar keeps its height as the month moves\n// and a shorter month leaves its last rows empty. `months` in\n// `src/calendar/styles.ts` is where the room is reserved.\n//\n// `showMonthYearMenus` draws the page's docked header instead of one heading:\n// the month's menu button between the chevrons that step it and the year's\n// after them, each opening its list where the grid was. The parts are in\n// `src/calendar`, shared with RangeCalendar.\n//\n// The calendar's own disabled, read-only and invalid states are drawn on its\n// dates, from React Aria's calendar state rather than each date's, since\n// that is the one place all three are known:\n//\n// - **Disabled** fades every date, the weekday row, the chevrons and the\n// menu buttons to the page's 38%, and keeps the date it holds as a\n// disabled filled circle — React Aria stops calling a disabled date\n// selected, which left the calendar looking empty.\n// - **Read-only** keeps every date at full strength, since it still reports\n// a value, but drops the pointer and the state layers from the dates, which\n// a press no longer changes. The chevrons and the menus still move the\n// month, so they keep theirs.\n// - **Invalid** draws the date held in the error container roles, and\n// `error` writes the reason under the months in the field's supporting\n// type and error colour. Each date React Aria marks invalid points\n// `aria-describedby` at it, so a screen reader hears why as well as that.\n//\n// Five things are this component's own.\n//\n// **The year menu has no chevrons of its own.** The page draws a pair either\n// side of it that step a year, which would need two names React Aria has no\n// message for — the library writes a word of its own only behind a prop that\n// can replace it, and it would take a pair on four components. The year list\n// reaches any year within a century of the one shown in one press, or any\n// the bounds allow where they are closer, and Shift with Page Up or Page\n// Down steps a year from the keyboard.\n//\n// **The cell is a circle in a square.** The page gives the date a 48dp\n// container and a 40dp state layer, which is a 40dp circle with 4dp of room\n// around it. The circle is the element, centred in a 48dp column and a 48dp\n// row — the pitch Compose lays its days at — and a transparent box reaching\n// the 4dp past it on every side makes the whole square the press target,\n// rather than a 48dp box with a 40dp box inside it. The chevrons and the\n// month and year menu buttons reach a 48dp target the same way.\n//\n// **It narrows to its container.** The page's docked calendar is 360dp, and\n// a compact window leaves 328dp between its margins, so the calendar is 360\n// at most and the columns share whatever is left below that. Under about\n// 304dp of content a column is narrower than its 40dp circle, and the\n// circles of neighbouring dates meet.\n//\n// **A date from the month either side is faded because it is disabled, not\n// because it is outside.** React Aria marks those cells `data-outside-month`\n// and disables them in the same breath, so a treatment keyed on the first\n// would never draw anything the second had not already drawn. The disabled\n// fade is the page's 38% either way.\n//\n// **Today reads as today whether or not it is selected.** The page gives it\n// an outline and the primary label; selected gives it a filled circle and the\n// on-primary label. A selected today takes the fill, since a circle already\n// says where you are and two rings would say it twice.\n//\n// **The month is moved by IconButton's shape rather than by IconButton.**\n// React Aria wires `slot=\"previous\"` and `slot=\"next\"` on its own `Button`,\n// and IconButton renders React Aria's `Button` too — so nesting one inside\n// the slot would put two buttons where the page draws one. The chevrons take\n// the standard icon button's 40dp square and its state layer instead.\n\ntype CalendarProps<T extends DateValue = DateValue> = {\n /** A function may compute the class from the calendar's render state. */\n className?: RACCalendarProps<T>['className'];\n /**\n * The message shown under the months, which also marks the calendar\n * invalid: the date it holds turns to the error container colours, and\n * React Aria points that date's description at the message. `isInvalid`\n * on its own marks the date with no message.\n */\n error?: string;\n /**\n * Whether the header draws the month and the year as menu buttons, each\n * opening a list of them in the grid's place, as the docked date picker's\n * header does, rather than one heading between the chevrons. For a date\n * far from the one shown, such as a date of birth: the year list runs a\n * century either side of the year shown, or to `minValue` and `maxValue`\n * where they are closer.\n *\n * For one visible month. With `visibleDuration` of more than one, the\n * header is the plain one, whose heading names every month shown — the\n * menus name only the first, which would leave the others unlabelled.\n * @default false\n */\n showMonthYearMenus?: boolean;\n /** A function may compute the style from the calendar's render state. */\n style?: RACCalendarProps<T>['style'];\n} & Omit<RACCalendarProps<T>, 'children' | 'className' | 'style'>;\n\n/** What a date's classes read off the calendar around it. */\ntype CalendarStates = {\n /**\n * Whether this date is the one a disabled calendar holds, inside its\n * bounds. A copy of it in a neighbouring month's grid is told apart by\n * React Aria's own `isOutsideMonth`.\n */\n isHeldWhileDisabled: boolean;\n isReadOnly: boolean;\n};\n\n/**\n * A month calendar for picking a date. The value is React Aria's: pass\n * `value` with `onChange` to control it, or `defaultValue` to let it keep its\n * own, both as an `@internationalized/date` value from this package's\n * `./date` subpath.\n *\n * ```tsx\n * import { today, getLocalTimeZone } from '@kanso-labs/kanso-ui/date'\n *\n * <Calendar aria-label=\"Label\" defaultValue={today(getLocalTimeZone())} />\n * ```\n *\n * `minValue` and `maxValue` bound it, `isDateUnavailable` rules individual\n * dates out, and `visibleDuration` of `{ months: 2 }` draws two months side\n * by side, stacked below the expanded breakpoint. Name it with `aria-label`\n * or `aria-labelledby`; React Aria composes the visible month into that name\n * itself.\n *\n * The call site's `className` and `style` land on the container, which is the\n * element a layout positions.\n */\nfunction Calendar<T extends DateValue>({\n error,\n showMonthYearMenus = false,\n ...props\n}: CalendarProps<T> & RefAttributes<HTMLDivElement>) {\n return <RACCalendar<T> isInvalid={invalidFrom(error)} {...props} {...mergeStatefulStyles(stylex.props(calendarStyles.root), props)}>\n {({\n isInvalid\n }: CalendarRenderProps) => <>\n <CalendarFrame months={props.visibleDuration?.months ?? 1} showMonthYearMenus={showMonthYearMenus}>\n <div {...stylex.props(calendarStyles.months)}>\n {monthOffsets(props.visibleDuration?.months ?? 1).map(offset => <div key={offset.months} {...stylex.props(calendarStyles.month)}>\n <RACCalendarGrid offset={offset} {...stylex.props(calendarStyles.grid)}>\n <CalendarGridHeader />\n <RACCalendarGridBody>{gridCell}</RACCalendarGridBody>\n </RACCalendarGrid>\n </div>)}\n </div>\n </CalendarFrame>\n {/*\n * Through React Aria's error slot, which gives it the id an\n * invalid date's `aria-describedby` names. Drawn only while the\n * calendar is invalid: React Aria looks for the element when\n * `isInvalid` changes, which is when this appears and goes.\n */}\n {isInvalid && error !== undefined ? <RACText slot=\"errorMessage\" {...stylex.props(fieldChromeStyles.message, fieldChromeStyles.messageError)}>\n {error}\n </RACText> : null}\n </>}\n </RACCalendar>;\n}\n\n// A date's classes, from React Aria's render state and the calendar's.\n// StyleX cannot target `[data-selected]` on the element it is styling, so the\n// state comes from what React Aria hands the className.\n//\n// The order matters. `selected` is applied after `today`, so a selected today\n// takes the fill rather than the outline — a circle already says where you\n// are, and two rings would say it twice — and `invalid` after `selected`,\n// which it repaints. The hover and pressed layers come next, over whichever\n// ground the date has, a press over a hover. A read-only calendar takes no\n// hover layer, and React Aria reports no press there to draw one for.\n// `unavailable` and `disabled` come last, and StyleX replaces a property\n// whole, so they take the layers with them; the date a disabled calendar\n// holds then puts its disabled circle back.\nfunction cellClassName(state: CalendarCellRenderProps, calendar: CalendarStates) {\n return stylex.props(calendarStyles.cell, focus.ring, state.isToday && calendarStyles.cellToday, state.isSelected && calendarStyles.cellSelected, state.isSelected && state.isInvalid && calendarStyles.cellInvalid, calendar.isReadOnly && calendarStyles.cellReadOnly, !calendar.isReadOnly && state.isHovered && hoveredLayer(state), state.isPressed && pressedLayer(state), state.isUnavailable && calendarStyles.cellUnavailable, state.isDisabled && calendarStyles.cellDisabled, calendar.isHeldWhileDisabled && !state.isOutsideMonth && calendarStyles.cellSelectedDisabled).className ?? '';\n}\n\n// The calendar's part of a date's classes, bound once per date. Built by a\n// call rather than written inline at the prop, which is what react-perf's\n// no-new-function-as-prop is after.\nfunction cellClassNameIn(calendar: CalendarStates) {\n return (state: CalendarCellRenderProps) => cellClassName(state, calendar);\n}\n\n/**\n * One date. React Aria's cell, with what its classes need from the calendar\n * read from React Aria's calendar state: whether it is read-only, and the\n * date it holds, which React Aria hides from the cell itself once the\n * calendar is disabled.\n *\n * Held means what React Aria would have called selected with the calendar\n * enabled: the value, inside the bounds, and in its own month's grid rather\n * than a neighbour's, which the classes check.\n */\nfunction DateCell({\n date\n}: {\n date: CalendarDate;\n}): ReactElement {\n const calendar = useContext(CalendarStateContext);\n const isHeldWhileDisabled = calendar !== null && calendar.isDisabled && !calendar.isInvalid(date) && holds(calendar.value, date);\n return <RACCalendarCell className={cellClassNameIn({\n isHeldWhileDisabled,\n isReadOnly: calendar?.isReadOnly ?? false\n })} date={date} />;\n}\nfunction gridCell(date: CalendarDate): ReactElement {\n return <DateCell date={date} />;\n}\n\n// Whether a calendar's value includes a date: one date, or several where the\n// calendar takes more than one.\nfunction holds(value: CalendarDate | null | readonly (CalendarDate | null)[], date: CalendarDate) {\n const held = value !== null && 'length' in value ? value : [value];\n return held.some(entry => entry !== null && isSameDay(entry, date));\n}\nfunction hoveredLayer(state: CalendarCellRenderProps) {\n if (!state.isSelected) {\n return dateLayers.plainHovered;\n }\n return state.isInvalid ? dateLayers.invalidHovered : dateLayers.selectedHovered;\n}\nfunction pressedLayer(state: CalendarCellRenderProps) {\n if (!state.isSelected) {\n return dateLayers.plainPressed;\n }\n return state.isInvalid ? dateLayers.invalidPressed : dateLayers.selectedPressed;\n}\nexport type { CalendarProps };\nexport default Calendar;"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyJA,SAAAc,WAAA4B,IAAA;CAAA,MAAAC,IAAA1C,EAAA,EAAA;CAAA,IAAA2C;CAAA,IAAAT;CAAA,IAAAU;CAAA,IAAAT;CAAA,IAAAU;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAL,EAAA,OAAAD,IAAA;EAAuC,MAAA,EAAAP,OAAAc,IAAAb,oBAAAc,IAA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CACrDE,MAAKC,UAASA,UAAU,QAAQnF,UAAUmF,OAAOL,IAAI,CAAC;AACpE;AACA,SAASX,aAAaX,OAAgC;CACpD,IAAI,CAACA,MAAMM,YACT,OAAO5C,WAAWkE;CAEpB,OAAO5B,MAAMV,YAAY5B,WAAWmE,iBAAiBnE,WAAWoE;AAClE;AACA,SAASjB,aAAab,OAAgC;CACpD,IAAI,CAACA,MAAMM,YACT,OAAO5C,WAAWqE;CAEpB,OAAO/B,MAAMV,YAAY5B,WAAWsE,iBAAiBtE,WAAWuE;AAClE"}
@@ -121,7 +121,7 @@ function buttonContent(children, ripple, inGroup) {
121
121
  ...props(controlStyles.disc, styles.control, state.isReadOnly && controlStyles.controlReadOnly, state.isDisabled && controlStyles.controlDisabled, interactive && state.isHovered && hoverLayers[tone], interactive && state.isFocusVisible && focusLayers[tone], interactive && state.isPressed && pressedLayers[tone], state.isFocusVisible && focus.ringVisible),
122
122
  children: [/* @__PURE__ */ jsx("span", {
123
123
  ...props(styles.box, marked && styles.boxMarked, !marked && state.isInvalid && styles.boxUnmarkedError, !marked && !state.isInvalid && interactive && active && styles.boxUnmarkedActive, marked && state.isInvalid && styles.boxMarkedError, state.isDisabled && (marked ? styles.boxMarkedDisabled : styles.boxUnmarkedDisabled)),
124
- children: state.isIndeterminate ? /* @__PURE__ */ jsx(IndeterminateGlyph, { className: "xmix8c7 x1lliihq x1xp8n7a" }) : state.isSelected ? /* @__PURE__ */ jsx(CheckGlyph, { className: "xmix8c7 x1lliihq x1xp8n7a" }) : null
124
+ children: state.isIndeterminate ? /* @__PURE__ */ jsx(IndeterminateGlyph, { className: "xmix8c7 x1lliihq x2lah0s x1xp8n7a" }) : state.isSelected ? /* @__PURE__ */ jsx(CheckGlyph, { className: "xmix8c7 x1lliihq x2lah0s x1xp8n7a" }) : null
125
125
  }), interactive ? ripple.surface : null]
126
126
  }), /* @__PURE__ */ jsx(ControlLabel, {
127
127
  isRequired: required,
@@ -145,7 +145,7 @@ function buttonContent(children, ripple, inGroup) {
145
145
  * which is the element a layout positions.
146
146
  */
147
147
  function Checkbox(t0) {
148
- const $ = c(21);
148
+ const $ = c(20);
149
149
  const { children, description, error, ...props$1 } = t0;
150
150
  const ripple = useRipple();
151
151
  const validationBehavior = useFieldValidationBehavior();
@@ -177,45 +177,45 @@ function Checkbox(t0) {
177
177
  $[7] = t4;
178
178
  } else t4 = $[7];
179
179
  let t5;
180
- if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
181
- t5 = props(controlStyles.messages);
182
- $[8] = t5;
183
- } else t5 = $[8];
180
+ if ($[8] !== description || $[9] !== error || $[10] !== reachable || $[11] !== t4) {
181
+ t5 = fieldContent(t4, description, error, reachable);
182
+ $[8] = description;
183
+ $[9] = error;
184
+ $[10] = reachable;
185
+ $[11] = t4;
186
+ $[12] = t5;
187
+ } else t5 = $[12];
184
188
  let t6;
185
- if ($[9] !== description || $[10] !== error || $[11] !== reachable) {
186
- t6 = /* @__PURE__ */ jsx("div", {
187
- ...t5,
188
- children: /* @__PURE__ */ jsx(FieldMessage, {
189
- description,
190
- error,
191
- inset: false,
192
- reserve: reachable
193
- })
194
- });
195
- $[9] = description;
196
- $[10] = error;
197
- $[11] = reachable;
198
- $[12] = t6;
199
- } else t6 = $[12];
200
- let t7;
201
- if ($[13] !== T0 || $[14] !== props$1 || $[15] !== t1 || $[16] !== t2 || $[17] !== t4 || $[18] !== t6 || $[19] !== validationBehavior) {
202
- t7 = /* @__PURE__ */ jsxs(T0, {
189
+ if ($[13] !== T0 || $[14] !== props$1 || $[15] !== t1 || $[16] !== t2 || $[17] !== t5 || $[18] !== validationBehavior) {
190
+ t6 = /* @__PURE__ */ jsx(T0, {
203
191
  isInvalid: t1,
204
192
  validationBehavior,
205
193
  ...props$1,
206
194
  ...t2,
207
- children: [t4, t6]
195
+ children: t5
208
196
  });
209
197
  $[13] = T0;
210
198
  $[14] = props$1;
211
199
  $[15] = t1;
212
200
  $[16] = t2;
213
- $[17] = t4;
214
- $[18] = t6;
215
- $[19] = validationBehavior;
216
- $[20] = t7;
217
- } else t7 = $[20];
218
- return t7;
201
+ $[17] = t5;
202
+ $[18] = validationBehavior;
203
+ $[19] = t6;
204
+ } else t6 = $[19];
205
+ return t6;
206
+ }
207
+ function fieldContent(button, description, error, reserve) {
208
+ return ({ isDisabled }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [button, /* @__PURE__ */ jsx("div", {
209
+ ...props(controlStyles.messages),
210
+ children: /* @__PURE__ */ jsx(FieldMessage, {
211
+ description,
212
+ error,
213
+ indent: true,
214
+ inset: false,
215
+ isDisabled,
216
+ reserve
217
+ })
218
+ })] });
219
219
  }
220
220
  //#endregion
221
221
  export { Checkbox as default };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","CheckboxButtonRenderProps","CheckboxFieldProps","RACCheckboxFieldProps","stylex","useContext","CheckboxButton","CheckboxField","CheckboxGroupStateContext","ControlLabel","controlStyles","FieldMessage","invalidFrom","useFieldValidationBehavior","CheckGlyph","IndeterminateGlyph","useRipple","focus","mergeStatefulStyles","colors","motion","stateLayerOpacity","FORCED_COLORS","styles","box","k6CgDc","kGNEyG","kWkggS","kZKoxP","kVAM5u","kaIpWk","ksu8eU","kMzoRj","kB7OPa","kMwMTN","k1xSpc","kzqmXN","kjj79g","kIyJzY","k1ekBW","kAMwcw","$$css","boxMarked","boxMarkedDisabled","boxMarkedError","boxUnmarkedActive","boxUnmarkedDisabled","boxUnmarkedError","control","hoverLayers","error","marked","unmarked","focusLayers","pressedLayers","CheckboxProps","children","description","Omit","Ripple","ReturnType","HTMLSpanElement","Tone","buttonContent","ripple","inGroup","state","required","isRequired","isSelected","isIndeterminate","interactive","isDisabled","isReadOnly","tone","isInvalid","active","isHovered","isPressed","isFocusVisible","handlers","props","disc","controlReadOnly","controlDisabled","ringVisible","surface","Checkbox","t0","$","validationBehavior","reachable","validate","undefined","name","T0","t1","t2","field","t3","t4","t5","Symbol","for","messages","t6","t7","stylex.props","_c","props"],"sources":["../../../src/components/checkbox/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { CheckboxButtonRenderProps, CheckboxFieldProps as RACCheckboxFieldProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext } from 'react';\nimport { CheckboxButton, CheckboxField, CheckboxGroupStateContext } from 'react-aria-components';\nimport { ControlLabel } from '../../control';\nimport { controlStyles } from '../../control/styles';\nimport { FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CheckGlyph, IndeterminateGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// The checkbox page: an 18dp box with a 2dp corner and an 18dp glyph, inside\n// a 40dp state layer, with a 48dp target. Unselected, the box is a 2dp rule\n// in on surface variant that turns on surface while hovered, pressed or\n// focused; selected or indeterminate, it fills with primary and the glyph\n// takes on primary. The error pair is error and on error, and disabled is\n// on surface at the disabled opacity for the rule or the fill, with the\n// glyph in surface. The state layer is on surface over an unselected box and\n// primary over a selected one while hovered, and the two swap once pressed.\n//\n// React Aria's `CheckboxField` is the root, a div holding the description\n// and error slots; its `CheckboxButton` is the label around a visually\n// hidden input, and everything drawn is that label's children, chosen from\n// the render state React Aria hands them. The field is a two-column grid —\n// the control, then the text — and the label is `display: contents`, so the\n// control and the label text each take a column and the description and\n// error line up under the text rather than under the box.\n//\n// The adjacent label is body-large on surface, which the page keeps the same\n// whether or not the box is selected. The corner is a literal: the page's\n// 2dp is a step the shape scale does not carry.\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\nconst styles = {\n box: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"xmix8c7\",\n kVAM5u: \"x1is7jjm\",\n kaIpWk: \"x1cum3z5\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xdh2fpr\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"xwjo7ld\",\n k1xSpc: \"x78zum5\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xts7igz\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n boxMarked: {\n kWkggS: \"xnety89\",\n kVAM5u: \"x9r1u3d\",\n $$css: true\n },\n boxMarkedDisabled: {\n kWkggS: \"x1crcgwy\",\n kVAM5u: \"x9r1u3d xmnqt3w\",\n kMwMTN: \"xrpadme x1bhcspo\",\n $$css: true\n },\n boxMarkedError: {\n kWkggS: \"xwi4nbo\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"x1l7c2jh\",\n $$css: true\n },\n boxUnmarkedActive: {\n kVAM5u: \"x1pacwz9\",\n $$css: true\n },\n boxUnmarkedDisabled: {\n kVAM5u: \"xp1r3on xmnqt3w\",\n $$css: true\n },\n boxUnmarkedError: {\n kVAM5u: \"xx78ee7\",\n $$css: true\n },\n control: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n }\n};\n\n// The state layer's colour follows the box: on surface over an unmarked box\n// and primary over a marked one while hovered, the two swapped once pressed,\n// and error throughout while invalid.\nconst hoverLayers = {\n error: {\n kWkggS: \"x55e1u4\",\n $$css: true\n },\n marked: {\n kWkggS: \"x659ado\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"x1b18xnh\",\n $$css: true\n }\n};\n\n// A keyboard's focus draws the hover layer's colour at the focus opacity.\nconst focusLayers = {\n error: {\n kWkggS: \"xyn212m\",\n $$css: true\n },\n marked: {\n kWkggS: \"x1sog3nf\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"xwqhyid\",\n $$css: true\n }\n};\nconst pressedLayers = {\n error: {\n kWkggS: \"x3czxiy\",\n $$css: true\n },\n marked: {\n kWkggS: \"xjeeohs\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"x1dvjsmr\",\n $$css: true\n }\n};\ntype CheckboxProps = {\n /**\n * The label, beside the box. A checkbox that a row labels some other way\n * leaves it out and passes `aria-label` instead.\n *\n * A link or a button in it acts on its own, as in a native label: a press\n * or Enter on \"the terms\" in \"I agree to the terms\" follows the link and\n * leaves the checkbox as it was. A press anywhere else in the label\n * toggles it.\n */\n children?: ReactNode;\n /**\n * A hint under the label. Replaced by `error` when there is one, so the\n * two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the checkbox in its error state — the message, the error colours and\n * `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n} & Omit<RACCheckboxFieldProps, 'children' | 'isInvalid' | 'validationBehavior'>;\ntype Ripple = ReturnType<typeof useRipple<HTMLSpanElement>>;\ntype Tone = 'error' | 'marked' | 'unmarked';\n\n// What the label draws, chosen from the render state React Aria hands it.\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's no-new-function-as-prop is after; the React Compiler memoises\n// the result on its inputs. The ripple's handlers and surface go on the\n// control while the checkbox can change, and are left off while it cannot,\n// since a press that changes nothing should not look like one.\nfunction buttonContent(children: ReactNode, ripple: Ripple, inGroup: boolean) {\n return (state: CheckboxButtonRenderProps) => {\n // A checkbox in a group is marked by the group's label rather than its\n // own: the group is what has to have a choice made in it.\n const required = state.isRequired && !inGroup;\n const marked = state.isSelected || state.isIndeterminate;\n const interactive = !state.isDisabled && !state.isReadOnly;\n const tone: Tone = state.isInvalid ? 'error' : marked ? 'marked' : 'unmarked';\n const active = state.isHovered || state.isPressed || state.isFocusVisible;\n return <>\n <span {...interactive ? ripple.handlers : {}} {...stylex.props(controlStyles.disc, styles.control, state.isReadOnly && controlStyles.controlReadOnly, state.isDisabled && controlStyles.controlDisabled, interactive && state.isHovered && hoverLayers[tone], interactive && state.isFocusVisible && focusLayers[tone], interactive && state.isPressed && pressedLayers[tone], state.isFocusVisible && focus.ringVisible)}>\n <span {...stylex.props(styles.box, marked && styles.boxMarked, !marked && state.isInvalid && styles.boxUnmarkedError, !marked && !state.isInvalid && interactive && active && styles.boxUnmarkedActive, marked && state.isInvalid && styles.boxMarkedError, state.isDisabled && (marked ? styles.boxMarkedDisabled : styles.boxUnmarkedDisabled))}>\n {state.isIndeterminate ? <IndeterminateGlyph className=\"xmix8c7 x1lliihq x1xp8n7a\" /> : state.isSelected ? <CheckGlyph className=\"xmix8c7 x1lliihq x1xp8n7a\" /> : null}\n </span>\n {interactive ? ripple.surface : null}\n </span>\n <ControlLabel isRequired={required} state={state}>\n {children}\n </ControlLabel>\n </>;\n };\n}\n\n/**\n * A checkbox with its label, and optionally a description or an error under\n * it. Its state is React Aria's: pass `isSelected` with `onChange` to\n * control it, or `defaultSelected` to let it keep its own; `isIndeterminate`\n * draws the dash for a box that stands for a partly selected set. Inside a\n * `CheckboxGroup` it takes its `value` and the group's selection instead.\n *\n * `isRequired` ends the label in the asterisk every required field's label\n * ends in. Inside a `CheckboxGroup` the group's label carries it instead,\n * since the group is what must have a choice made in it.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction Checkbox({\n children,\n description,\n error,\n ...props\n}: CheckboxProps & RefAttributes<HTMLDivElement>) {\n const ripple = useRipple<HTMLSpanElement>();\n const validationBehavior = useFieldValidationBehavior();\n\n // Whether a message can ever reach this checkbox, which is what a form\n // keeps an empty line under a field for. One in a group cannot — the\n // group owns the one message and keeps its own line for it — and one on\n // its own can only where something can find it wanting: a requirement, a\n // check of its own, or a name a form's errors can be keyed by. Without\n // this every checkbox in a form sat a line taller than it draws, and a\n // group of them in a form gained a line after every item.\n const inGroup = useContext(CheckboxGroupStateContext) !== null;\n const reachable = !inGroup && (props.isRequired === true || props.validate !== undefined || props.name !== undefined);\n return <CheckboxField isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(controlStyles.field), props)}>\n <CheckboxButton className=\"xjp7ctv\">\n {buttonContent(children, ripple, inGroup)}\n </CheckboxButton>\n <div {...stylex.props(controlStyles.messages)}>\n <FieldMessage description={description} error={error} inset={false} reserve={reachable} />\n </div>\n </CheckboxField>;\n}\nexport type { CheckboxProps };\nexport default Checkbox;"],"mappings":";;;;;;;;;;;;;;;AA2CA,MAAM0B,SAAS;CACbC,KAAK;EACHC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,WAAW;EACTf,QAAQ;EACRE,QAAQ;EACRY,OAAO;CACT;CACAE,mBAAmB;EACjBhB,QAAQ;EACRE,QAAQ;EACRK,QAAQ;EACRO,OAAO;CACT;CACAG,gBAAgB;EACdjB,QAAQ;EACRE,QAAQ;EACRK,QAAQ;EACRO,OAAO;CACT;CACAI,mBAAmB;EACjBhB,QAAQ;EACRY,OAAO;CACT;CACAK,qBAAqB;EACnBjB,QAAQ;EACRY,OAAO;CACT;CACAM,kBAAkB;EAChBlB,QAAQ;EACRY,OAAO;CACT;CACAO,SAAS;EACPd,QAAQ;EACRO,OAAO;CACT;AACF;AAKA,MAAMQ,cAAc;CAClBC,OAAO;EACLvB,QAAQ;EACRc,OAAO;CACT;CACAU,QAAQ;EACNxB,QAAQ;EACRc,OAAO;CACT;CACAW,UAAU;EACRzB,QAAQ;EACRc,OAAO;CACT;AACF;AAGA,MAAMY,cAAc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CheckboxFieldProps","RACCheckboxFieldProps","stylex","useContext","CheckboxButton","CheckboxField","CheckboxGroupStateContext","ControlLabel","controlStyles","FieldMessage","invalidFrom","useFieldValidationBehavior","CheckGlyph","IndeterminateGlyph","useRipple","focus","mergeStatefulStyles","colors","motion","stateLayerOpacity","FORCED_COLORS","styles","box","k6CgDc","kGNEyG","kWkggS","kZKoxP","kVAM5u","kaIpWk","ksu8eU","kMzoRj","kB7OPa","kMwMTN","k1xSpc","kzqmXN","kjj79g","kIyJzY","k1ekBW","kAMwcw","$$css","boxMarked","boxMarkedDisabled","boxMarkedError","boxUnmarkedActive","boxUnmarkedDisabled","boxUnmarkedError","control","hoverLayers","error","marked","unmarked","focusLayers","pressedLayers","CheckboxProps","children","description","Omit","Ripple","ReturnType","HTMLSpanElement","Tone","buttonContent","ripple","inGroup","state","required","isRequired","isSelected","isIndeterminate","interactive","isDisabled","isReadOnly","tone","isInvalid","active","isHovered","isPressed","isFocusVisible","handlers","props","disc","controlReadOnly","controlDisabled","ringVisible","surface","Checkbox","t0","$","validationBehavior","reachable","validate","undefined","name","T0","t1","t2","field","t3","t4","t5","fieldContent","t6","button","reserve","messages","stylex.props","_c","props"],"sources":["../../../src/components/checkbox/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { CheckboxButtonRenderProps, CheckboxFieldRenderProps, CheckboxFieldProps as RACCheckboxFieldProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { useContext } from 'react';\nimport { CheckboxButton, CheckboxField, CheckboxGroupStateContext } from 'react-aria-components';\nimport { ControlLabel } from '../../control';\nimport { controlStyles } from '../../control/styles';\nimport { FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { CheckGlyph, IndeterminateGlyph } from '../../glyphs';\nimport { useRipple } from '../../hooks/useRipple';\nimport { focus } from '../../styles/focus';\nimport { mergeStatefulStyles } from '../../styles/merge';\nimport '../../tokens/design.tokens.stylex';\nimport { colors, motion, stateLayerOpacity } from '../../tokens/design.tokens.stylex';\n\n// The checkbox page: an 18dp box with a 2dp corner and an 18dp glyph, inside\n// a 40dp state layer, with a 48dp target. Unselected, the box is a 2dp rule\n// in on surface variant that turns on surface while hovered, pressed or\n// focused; selected or indeterminate, it fills with primary and the glyph\n// takes on primary. The error pair is error and on error, and disabled is\n// on surface at the disabled opacity for the rule or the fill, with the\n// glyph in surface. The state layer is on surface over an unselected box and\n// primary over a selected one while hovered, and the two swap once pressed.\n//\n// React Aria's `CheckboxField` is the root, a div holding the description\n// and error slots; its `CheckboxButton` is the label around a visually\n// hidden input, and everything drawn is that label's children, chosen from\n// the render state React Aria hands them. The field is a two-column grid —\n// the control, then the text — and the label is `display: contents`, so the\n// control and the label text each take a column and the description and\n// error line up under the text rather than under the box.\n//\n// The adjacent label is body-large on surface, which the page keeps the same\n// whether or not the box is selected. The corner is a literal: the page's\n// 2dp is a step the shape scale does not carry.\n// Windows High Contrast and the rest of the forced-colours modes. Spelled\n// here rather than imported, for the reason src/field/styles.ts records: the\n// StyleX compiler resolves a constant across files only out of a `.stylex.ts`\n// module, and the generated one holds design tokens rather than queries.\nconst FORCED_COLORS = '@media (forced-colors: active)';\nconst styles = {\n box: {\n k6CgDc: \"x12w9bfk\",\n kGNEyG: \"x6s0dn4\",\n kWkggS: \"xjbqb8w\",\n kZKoxP: \"xmix8c7\",\n kVAM5u: \"x1is7jjm\",\n kaIpWk: \"x1cum3z5\",\n ksu8eU: \"x1y0btm7\",\n kMzoRj: \"xdh2fpr\",\n kB7OPa: \"x9f619\",\n kMwMTN: \"xwjo7ld\",\n k1xSpc: \"x78zum5\",\n kzqmXN: \"x1xp8n7a\",\n kjj79g: \"xl56j7k\",\n kIyJzY: \"x1qno0dh\",\n k1ekBW: \"xts7igz\",\n kAMwcw: \"xpc4ca7\",\n $$css: true\n },\n boxMarked: {\n kWkggS: \"xnety89\",\n kVAM5u: \"x9r1u3d\",\n $$css: true\n },\n boxMarkedDisabled: {\n kWkggS: \"x1crcgwy\",\n kVAM5u: \"x9r1u3d xmnqt3w\",\n kMwMTN: \"xrpadme x1bhcspo\",\n $$css: true\n },\n boxMarkedError: {\n kWkggS: \"xwi4nbo\",\n kVAM5u: \"x9r1u3d\",\n kMwMTN: \"x1l7c2jh\",\n $$css: true\n },\n boxUnmarkedActive: {\n kVAM5u: \"x1pacwz9\",\n $$css: true\n },\n boxUnmarkedDisabled: {\n kVAM5u: \"xp1r3on xmnqt3w\",\n $$css: true\n },\n boxUnmarkedError: {\n kVAM5u: \"xx78ee7\",\n $$css: true\n },\n control: {\n kMwMTN: \"x139gbkf\",\n $$css: true\n }\n};\n\n// The state layer's colour follows the box: on surface over an unmarked box\n// and primary over a marked one while hovered, the two swapped once pressed,\n// and error throughout while invalid.\nconst hoverLayers = {\n error: {\n kWkggS: \"x55e1u4\",\n $$css: true\n },\n marked: {\n kWkggS: \"x659ado\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"x1b18xnh\",\n $$css: true\n }\n};\n\n// A keyboard's focus draws the hover layer's colour at the focus opacity.\nconst focusLayers = {\n error: {\n kWkggS: \"xyn212m\",\n $$css: true\n },\n marked: {\n kWkggS: \"x1sog3nf\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"xwqhyid\",\n $$css: true\n }\n};\nconst pressedLayers = {\n error: {\n kWkggS: \"x3czxiy\",\n $$css: true\n },\n marked: {\n kWkggS: \"xjeeohs\",\n $$css: true\n },\n unmarked: {\n kWkggS: \"x1dvjsmr\",\n $$css: true\n }\n};\ntype CheckboxProps = {\n /**\n * The label, beside the box. A checkbox that a row labels some other way\n * leaves it out and passes `aria-label` instead.\n *\n * A link or a button in it acts on its own, as in a native label: a press\n * or Enter on \"the terms\" in \"I agree to the terms\" follows the link and\n * leaves the checkbox as it was. A press anywhere else in the label\n * toggles it.\n */\n children?: ReactNode;\n /**\n * A hint under the label. Replaced by `error` when there is one, so the\n * two never stack.\n */\n description?: string;\n /**\n * The problem with the current value, in words. Its presence is what puts\n * the checkbox in its error state — the message, the error colours and\n * `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n} & Omit<RACCheckboxFieldProps, 'children' | 'isInvalid' | 'validationBehavior'>;\ntype Ripple = ReturnType<typeof useRipple<HTMLSpanElement>>;\ntype Tone = 'error' | 'marked' | 'unmarked';\n\n// What the label draws, chosen from the render state React Aria hands it.\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's no-new-function-as-prop is after; the React Compiler memoises\n// the result on its inputs. The ripple's handlers and surface go on the\n// control while the checkbox can change, and are left off while it cannot,\n// since a press that changes nothing should not look like one.\nfunction buttonContent(children: ReactNode, ripple: Ripple, inGroup: boolean) {\n return (state: CheckboxButtonRenderProps) => {\n // A checkbox in a group is marked by the group's label rather than its\n // own: the group is what has to have a choice made in it.\n const required = state.isRequired && !inGroup;\n const marked = state.isSelected || state.isIndeterminate;\n const interactive = !state.isDisabled && !state.isReadOnly;\n const tone: Tone = state.isInvalid ? 'error' : marked ? 'marked' : 'unmarked';\n const active = state.isHovered || state.isPressed || state.isFocusVisible;\n return <>\n <span {...interactive ? ripple.handlers : {}} {...stylex.props(controlStyles.disc, styles.control, state.isReadOnly && controlStyles.controlReadOnly, state.isDisabled && controlStyles.controlDisabled, interactive && state.isHovered && hoverLayers[tone], interactive && state.isFocusVisible && focusLayers[tone], interactive && state.isPressed && pressedLayers[tone], state.isFocusVisible && focus.ringVisible)}>\n <span {...stylex.props(styles.box, marked && styles.boxMarked, !marked && state.isInvalid && styles.boxUnmarkedError, !marked && !state.isInvalid && interactive && active && styles.boxUnmarkedActive, marked && state.isInvalid && styles.boxMarkedError, state.isDisabled && (marked ? styles.boxMarkedDisabled : styles.boxUnmarkedDisabled))}>\n {state.isIndeterminate ? <IndeterminateGlyph className=\"xmix8c7 x1lliihq x2lah0s x1xp8n7a\" /> : state.isSelected ? <CheckGlyph className=\"xmix8c7 x1lliihq x2lah0s x1xp8n7a\" /> : null}\n </span>\n {interactive ? ripple.surface : null}\n </span>\n <ControlLabel isRequired={required} state={state}>\n {children}\n </ControlLabel>\n </>;\n };\n}\n\n/**\n * A checkbox with its label, and optionally a description or an error under\n * it. Its state is React Aria's: pass `isSelected` with `onChange` to\n * control it, or `defaultSelected` to let it keep its own; `isIndeterminate`\n * draws the dash for a box that stands for a partly selected set. Inside a\n * `CheckboxGroup` it takes its `value` and the group's selection instead.\n *\n * `isRequired` ends the label in the asterisk every required field's label\n * ends in. Inside a `CheckboxGroup` the group's label carries it instead,\n * since the group is what must have a choice made in it.\n *\n * The call site's `className` and `style` land on the field as a whole,\n * which is the element a layout positions.\n */\nfunction Checkbox({\n children,\n description,\n error,\n ...props\n}: CheckboxProps & RefAttributes<HTMLDivElement>) {\n const ripple = useRipple<HTMLSpanElement>();\n const validationBehavior = useFieldValidationBehavior();\n\n // Whether a message can ever reach this checkbox, which is what a form\n // keeps an empty line under a field for. One in a group cannot — the\n // group owns the one message and keeps its own line for it — and one on\n // its own can only where something can find it wanting: a requirement, a\n // check of its own, or a name a form's errors can be keyed by. Without\n // this every checkbox in a form sat a line taller than it draws, and a\n // group of them in a form gained a line after every item.\n const inGroup = useContext(CheckboxGroupStateContext) !== null;\n const reachable = !inGroup && (props.isRequired === true || props.validate !== undefined || props.name !== undefined);\n return <CheckboxField isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(controlStyles.field), props)}>\n {fieldContent(<CheckboxButton className=\"xjp7ctv\">\n {buttonContent(children, ripple, inGroup)}\n </CheckboxButton>, description, error, reachable)}\n </CheckboxField>;\n}\n\n// The button and the line under it, from the field's render state: the\n// description fades with a disabled checkbox, by itself or by its group, as\n// its label does. Built by a call for the same reason as `buttonContent`.\nfunction fieldContent(button: ReactNode, description: string | undefined, error: string | undefined, reserve: boolean) {\n return ({\n isDisabled\n }: CheckboxFieldRenderProps) => <>\n {button}\n <div {...stylex.props(controlStyles.messages)}>\n <FieldMessage description={description} error={error} indent inset={false} isDisabled={isDisabled} reserve={reserve} />\n </div>\n </>;\n}\nexport type { CheckboxProps };\nexport default Checkbox;"],"mappings":";;;;;;;;;;;;;;;AA2CA,MAAM2B,SAAS;CACbC,KAAK;EACHC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,QAAQ;EACRC,OAAO;CACT;CACAC,WAAW;EACTf,QAAQ;EACRE,QAAQ;EACRY,OAAO;CACT;CACAE,mBAAmB;EACjBhB,QAAQ;EACRE,QAAQ;EACRK,QAAQ;EACRO,OAAO;CACT;CACAG,gBAAgB;EACdjB,QAAQ;EACRE,QAAQ;EACRK,QAAQ;EACRO,OAAO;CACT;CACAI,mBAAmB;EACjBhB,QAAQ;EACRY,OAAO;CACT;CACAK,qBAAqB;EACnBjB,QAAQ;EACRY,OAAO;CACT;CACAM,kBAAkB;EAChBlB,QAAQ;EACRY,OAAO;CACT;CACAO,SAAS;EACPd,QAAQ;EACRO,OAAO;CACT;AACF;AAKA,MAAMQ,cAAc;CAClBC,OAAO;EACLvB,QAAQ;EACRc,OAAO;CACT;CACAU,QAAQ;EACNxB,QAAQ;EACRc,OAAO;CACT;CACAW,UAAU;EACRzB,QAAQ;EACRc,OAAO;CACT;AACF;AAGA,MAAMY,cAAc;CAClBH,OAAO;EACLvB,QAAQ;EACRc,OAAO;CACT;CACAU,QAAQ;EACNxB,QAAQ;EACRc,OAAO;CACT;CACAW,UAAU;EACRzB,QAAQ;EACRc,OAAO;CACT;AACF;AACA,MAAMa,gBAAgB;CACpBJ,OAAO;EACLvB,QAAQ;EACRc,OAAO;CACT;CACAU,QAAQ;EACNxB,QAAQ;EACRc,OAAO;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A,QAAAW,IAAA;EAFlBC,KAAAC,aAAaF,IAEO3C,aAAaP,OAAOyC,SAAS;EAACF,EAAA,KAAAhC;EAAAgC,EAAA,KAAAvC;EAAAuC,EAAA,MAAAE;EAAAF,EAAA,MAAAW;EAAAX,EAAA,MAAAY;CAAA,OAAAA,KAAAZ,EAAA;CAAA,IAAAc;CAAA,IAAAd,EAAA,QAAAM,MAAAN,EAAA,QAAAR,WAAAQ,EAAA,QAAAO,MAAAP,EAAA,QAAAQ,MAAAR,EAAA,QAAAY,MAAAZ,EAAA,QAAAC,oBAAA;EAHhDa,KAAA,oBAAC,IAAD;GAA0B,WAAAP;GAAwCN;GAAkB,GAAMT;GAAK,GAAMgB;GACvGI,UAAAA;EADgB,CAAA;EAIHZ,EAAA,MAAAM;EAAAN,EAAA,MAAAR;EAAAQ,EAAA,MAAAO;EAAAP,EAAA,MAAAQ;EAAAR,EAAA,MAAAY;EAAAZ,EAAA,MAAAC;EAAAD,EAAA,MAAAc;CAAA,OAAAA,KAAAd,EAAA;CAAA,OAJXc;AAIW;AAMpB,SAASD,aAAaE,QAAmB/C,aAAiCP,OAA2BuD,SAAkB;CACrH,QAAQ,EACNjC,iBAC8B,qBAAA,YAAA,EAAA,UAAA,CAC3BgC,QACD,oBAAC,OAAD;EAAK,GAAIpG,MAAaM,cAAcgG,QAAQ;EAC1C,UAAA,oBAAC,cAAD;GAA2BjD;GAAoBP;GAAO,QAAA;GAAO,OAAO;GAAmBsB;GAAqBiC;EAAQ,CAAA;CACjH,CAAA,CACP,EAAA,CAAA;AACJ"}
@@ -4,6 +4,7 @@ import { mergeStatefulStyles } from "../../styles/merge.js";
4
4
  import { invalidFrom, useFieldValidationBehavior } from "../../field/root.js";
5
5
  import { groupStyles } from "../../field/styles.js";
6
6
  import { FieldLabel, FieldMessage } from "../../field/index.js";
7
+ import { controlStyles } from "../../control/styles.js";
7
8
  import { c } from "react/compiler-runtime";
8
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
10
  import { CheckboxGroup } from "react-aria-components";
@@ -67,13 +68,14 @@ function groupContent(label, children, description, error) {
67
68
  children: label
68
69
  }),
69
70
  /* @__PURE__ */ jsx("div", {
70
- className: "x78zum5 xdt5ytf",
71
+ ...props(controlStyles.stack),
71
72
  children
72
73
  }),
73
74
  /* @__PURE__ */ jsx(FieldMessage, {
74
75
  description,
75
76
  error,
76
- inset: false
77
+ inset: false,
78
+ isDisabled: state.isDisabled
77
79
  })
78
80
  ] });
79
81
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","CheckboxGroupRenderProps","CheckboxGroupProps","RACCheckboxGroupProps","stylex","CheckboxGroup","RACCheckboxGroup","FieldLabel","FieldMessage","invalidFrom","useFieldValidationBehavior","groupStyles","mergeStatefulStyles","children","description","error","label","Omit","t0","$","props","validationBehavior","T0","t1","t2","root","t3","groupContent","t4","state","isRequired","CheckboxGroup","_c","props","RACCheckboxGroup","stylex.props"],"sources":["../../../src/components/checkbox-group/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { CheckboxGroupRenderProps, CheckboxGroupProps as RACCheckboxGroupProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { CheckboxGroup as RACCheckboxGroup } from 'react-aria-components';\nimport { FieldLabel, FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { groupStyles } from '../../field/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A labelled set of checkboxes sharing one value. The checkbox page draws\n// the boxes; the group is what the ARIA pattern asks for around them — a\n// group named by its label, described by its description, and invalid as a\n// whole — and its label, description and error are the field chrome's, so a\n// group reads like the fields beside it. The label is label-large, the role\n// a field's label takes at rest, since a group has no box to float it in.\n\ntype CheckboxGroupProps = {\n /** The checkboxes, each with a `value` of its own. */\n children?: ReactNode;\n /**\n * A hint under the group. Replaced by `error` when there is one, so the\n * two never stack.\n */\n description?: string;\n /**\n * The problem with the current selection, in words. Its presence is what\n * puts the group in its error state — the message, the boxes' error\n * colours and `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * What the group is for. Required rather than optional: a group of\n * checkboxes with no name is a set of boxes a screen reader cannot\n * introduce.\n */\n label: string;\n} & Omit<RACCheckboxGroupProps, 'children' | 'isInvalid' | 'validationBehavior'>;\n\n/**\n * A labelled set of checkboxes with one value between them. The value is\n * React Aria's: pass `value` with `onChange` to control it, or\n * `defaultValue` to let the group keep its own, and each `Checkbox` inside\n * names the entry it stands for with `value`. Disabled, read-only and the\n * error state reach every checkbox from here.\n *\n * The call site's `className` and `style` land on the group as a whole,\n * which is the element a layout positions.\n */\nfunction CheckboxGroup({\n children,\n description,\n error,\n label,\n ...props\n}: CheckboxGroupProps & RefAttributes<HTMLDivElement>) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACCheckboxGroup isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(groupStyles.root), props)}>\n {groupContent(label, children, description, error)}\n </RACCheckboxGroup>;\n}\n\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's no-new-function-as-prop is after; the React Compiler memoises\n// the result on its inputs. The label takes the group's render state, so\n// its colour follows disabled and invalid the way a field's follows its box.\nfunction groupContent(label: string, children: ReactNode, description: string | undefined, error: string | undefined) {\n return (state: CheckboxGroupRenderProps) => <>\n <FieldLabel isRequired={state.isRequired} state={state} variant=\"group\">\n {label}\n </FieldLabel>\n <div className=\"x78zum5 xdt5ytf\">{children}</div>\n <FieldMessage description={description} error={error} inset={false} />\n </>;\n}\nexport type { CheckboxGroupProps };\nexport default CheckboxGroup;"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsDA,SAAAQ,gBAAAa,IAAA;CAAA,MAAAC,IAAArB,EAAA,EAAA;CAAuB,MAAA,EA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A;EACZ,oBAAC,OAAD;GAAK,WAAU;GAAmBH;EAAc,CAAA;EAChD,oBAAC,cAAD;GAA2BC;GAAoBC;GAAO,OAAO;EAAM,CAAA;CACrE,EAAA,CAAA;AACJ"}
1
+ {"version":3,"file":"index.js","names":["c","_c","ReactNode","RefAttributes","CheckboxGroupRenderProps","CheckboxGroupProps","RACCheckboxGroupProps","stylex","CheckboxGroup","RACCheckboxGroup","controlStyles","FieldLabel","FieldMessage","invalidFrom","useFieldValidationBehavior","groupStyles","mergeStatefulStyles","children","description","error","label","Omit","t0","$","props","validationBehavior","T0","t1","t2","root","t3","groupContent","t4","state","isRequired","stack","isDisabled","CheckboxGroup","_c","props","RACCheckboxGroup","stylex.props"],"sources":["../../../src/components/checkbox-group/index.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode, RefAttributes } from 'react';\nimport type { CheckboxGroupRenderProps, CheckboxGroupProps as RACCheckboxGroupProps } from 'react-aria-components';\nimport * as stylex from '@stylexjs/stylex';\nimport { CheckboxGroup as RACCheckboxGroup } from 'react-aria-components';\nimport { controlStyles } from '../../control/styles';\nimport { FieldLabel, FieldMessage } from '../../field';\nimport { invalidFrom, useFieldValidationBehavior } from '../../field/root';\nimport { groupStyles } from '../../field/styles';\nimport { mergeStatefulStyles } from '../../styles/merge';\n\n// A labelled set of checkboxes sharing one value. The checkbox page draws\n// the boxes; the group is what the ARIA pattern asks for around them — a\n// group named by its label, described by its description, and invalid as a\n// whole — and its label, description and error are the field chrome's, so a\n// group reads like the fields beside it. The label is label-large, the role\n// a field's label takes at rest, since a group has no box to float it in.\ntype CheckboxGroupProps = {\n /** The checkboxes, each with a `value` of its own. */\n children?: ReactNode;\n /**\n * A hint under the group. Replaced by `error` when there is one, so the\n * two never stack.\n */\n description?: string;\n /**\n * The problem with the current selection, in words. Its presence is what\n * puts the group in its error state — the message, the boxes' error\n * colours and `aria-invalid` all follow from it.\n *\n * Outside a `Form` the message line arrives with the message, so the\n * field grows when this does and moves what is under it. A `Form` holds\n * that space from the start; so does a permanent `description`.\n */\n error?: string;\n /**\n * What the group is for. Required rather than optional: a group of\n * checkboxes with no name is a set of boxes a screen reader cannot\n * introduce.\n */\n label: string;\n} & Omit<RACCheckboxGroupProps, 'children' | 'isInvalid' | 'validationBehavior'>;\n\n/**\n * A labelled set of checkboxes with one value between them. The value is\n * React Aria's: pass `value` with `onChange` to control it, or\n * `defaultValue` to let the group keep its own, and each `Checkbox` inside\n * names the entry it stands for with `value`. Disabled, read-only and the\n * error state reach every checkbox from here.\n *\n * The call site's `className` and `style` land on the group as a whole,\n * which is the element a layout positions.\n */\nfunction CheckboxGroup({\n children,\n description,\n error,\n label,\n ...props\n}: CheckboxGroupProps & RefAttributes<HTMLDivElement>) {\n const validationBehavior = useFieldValidationBehavior();\n return <RACCheckboxGroup isInvalid={invalidFrom(error)} validationBehavior={validationBehavior} {...props} {...mergeStatefulStyles(stylex.props(groupStyles.root), props)}>\n {groupContent(label, children, description, error)}\n </RACCheckboxGroup>;\n}\n\n// Built by a call rather than written inline at the prop, which is what\n// react-perf's no-new-function-as-prop is after; the React Compiler memoises\n// the result on its inputs. The label takes the group's render state, so\n// its colour follows disabled and invalid the way a field's follows its box.\nfunction groupContent(label: string, children: ReactNode, description: string | undefined, error: string | undefined) {\n return (state: CheckboxGroupRenderProps) => <>\n <FieldLabel isRequired={state.isRequired} state={state} variant=\"group\">\n {label}\n </FieldLabel>\n <div {...stylex.props(controlStyles.stack)}>{children}</div>\n <FieldMessage description={description} error={error} inset={false} isDisabled={state.isDisabled} />\n </>;\n}\nexport type { CheckboxGroupProps };\nexport default CheckboxGroup;"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsDA,SAAAQ,gBAAAc,IAAA;CAAA,MAAAC,IAAAtB,EAAA,EAAA;CAAuB,MAAA,EAAAgB,UAAAC,aAAAC,OAAAC,OAAA,GAAAI,YAAAF;CAOrB,MAAAG,qBAA2BX,2BAA2B;CAC9C,MAAAY,KAAAjB;CAAgB,IAAAkB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AAO,OAAO;GAAO,YAAYc,MAAMG;EAAW,CAAA;CACnG,EAAA,CAAA;AACJ"}
@@ -80,7 +80,7 @@ function actionChipContent(children, icon, surface) {
80
80
  chipGlyph({
81
81
  isDisabled: state.isDisabled,
82
82
  isSelected: false
83
- }, icon),
83
+ }, icon, false),
84
84
  chipLabel(children),
85
85
  surface
86
86
  ] });