@epilot/zenith-react 0.1.0 → 0.2.0-next.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 (132) hide show
  1. package/README.md +34 -0
  2. package/dist/components/accordion/accordion.js +57 -48
  3. package/dist/components/accordion/accordion.js.map +1 -1
  4. package/dist/components/alert-dialog/alert-dialog.js +120 -91
  5. package/dist/components/alert-dialog/alert-dialog.js.map +1 -1
  6. package/dist/components/avatar/avatar-group.js +38 -35
  7. package/dist/components/avatar/avatar-group.js.map +1 -1
  8. package/dist/components/avatar/avatar.js +78 -71
  9. package/dist/components/avatar/avatar.js.map +1 -1
  10. package/dist/components/badge/badge.js +60 -55
  11. package/dist/components/badge/badge.js.map +1 -1
  12. package/dist/components/breadcrumb/breadcrumb.js +99 -54
  13. package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
  14. package/dist/components/button/button.js +87 -77
  15. package/dist/components/button/button.js.map +1 -1
  16. package/dist/components/button-group/button-group.js +36 -32
  17. package/dist/components/button-group/button-group.js.map +1 -1
  18. package/dist/components/callout/callout.js +113 -104
  19. package/dist/components/callout/callout.js.map +1 -1
  20. package/dist/components/card/card.js +62 -52
  21. package/dist/components/card/card.js.map +1 -1
  22. package/dist/components/checkbox/checkbox.js +22 -19
  23. package/dist/components/checkbox/checkbox.js.map +1 -1
  24. package/dist/components/code-block/code-block.js +135 -123
  25. package/dist/components/code-block/code-block.js.map +1 -1
  26. package/dist/components/code-editor/code-editor.js +276 -260
  27. package/dist/components/code-editor/code-editor.js.map +1 -1
  28. package/dist/components/collapsible-sidebar/collapsible-sidebar.js +62 -56
  29. package/dist/components/collapsible-sidebar/collapsible-sidebar.js.map +1 -1
  30. package/dist/components/command/command.js +116 -105
  31. package/dist/components/command/command.js.map +1 -1
  32. package/dist/components/data-table/data-table-body.js +38 -34
  33. package/dist/components/data-table/data-table-body.js.map +1 -1
  34. package/dist/components/data-table/data-table-column-header.js +30 -26
  35. package/dist/components/data-table/data-table-column-header.js.map +1 -1
  36. package/dist/components/data-table/data-table-column-order.js +79 -73
  37. package/dist/components/data-table/data-table-column-order.js.map +1 -1
  38. package/dist/components/data-table/data-table-column-visibility.js +25 -22
  39. package/dist/components/data-table/data-table-column-visibility.js.map +1 -1
  40. package/dist/components/data-table/data-table-content.js +47 -44
  41. package/dist/components/data-table/data-table-content.js.map +1 -1
  42. package/dist/components/data-table/data-table-error.js +36 -32
  43. package/dist/components/data-table/data-table-error.js.map +1 -1
  44. package/dist/components/data-table/data-table-footer.js +10 -8
  45. package/dist/components/data-table/data-table-footer.js.map +1 -1
  46. package/dist/components/data-table/data-table-header-draggable.js +40 -36
  47. package/dist/components/data-table/data-table-header-draggable.js.map +1 -1
  48. package/dist/components/data-table/data-table-loading.js +21 -18
  49. package/dist/components/data-table/data-table-loading.js.map +1 -1
  50. package/dist/components/data-table/data-table-resize-handle.js +13 -11
  51. package/dist/components/data-table/data-table-resize-handle.js.map +1 -1
  52. package/dist/components/data-table/data-table-row.js +47 -44
  53. package/dist/components/data-table/data-table-row.js.map +1 -1
  54. package/dist/components/data-table/data-table-toolbar.js +9 -7
  55. package/dist/components/data-table/data-table-toolbar.js.map +1 -1
  56. package/dist/components/data-table/data-table.js +48 -46
  57. package/dist/components/data-table/data-table.js.map +1 -1
  58. package/dist/components/date-range-picker/date-range-picker.js +212 -193
  59. package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
  60. package/dist/components/date-range-picker/range-calendar.js +36 -34
  61. package/dist/components/date-range-picker/range-calendar.js.map +1 -1
  62. package/dist/components/date-time-picker/calendar.js +290 -272
  63. package/dist/components/date-time-picker/calendar.js.map +1 -1
  64. package/dist/components/date-time-picker/date-time-picker-input.js +127 -112
  65. package/dist/components/date-time-picker/date-time-picker-input.js.map +1 -1
  66. package/dist/components/date-time-picker/date-time-picker-panel.js +126 -120
  67. package/dist/components/date-time-picker/date-time-picker-panel.js.map +1 -1
  68. package/dist/components/date-time-picker/date-time-picker.js +91 -86
  69. package/dist/components/date-time-picker/date-time-picker.js.map +1 -1
  70. package/dist/components/date-time-picker/time-picker.js +95 -87
  71. package/dist/components/date-time-picker/time-picker.js.map +1 -1
  72. package/dist/components/dialog/dialog.js +125 -103
  73. package/dist/components/dialog/dialog.js.map +1 -1
  74. package/dist/components/drawer/drawer.js +151 -114
  75. package/dist/components/drawer/drawer.js.map +1 -1
  76. package/dist/components/dropdown-menu/dropdown-menu.js +141 -112
  77. package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
  78. package/dist/components/field/field-combobox.js +196 -176
  79. package/dist/components/field/field-combobox.js.map +1 -1
  80. package/dist/components/field/field.js +237 -195
  81. package/dist/components/field/field.js.map +1 -1
  82. package/dist/components/list/list.js +237 -219
  83. package/dist/components/list/list.js.map +1 -1
  84. package/dist/components/option-card/option-card.js +129 -116
  85. package/dist/components/option-card/option-card.js.map +1 -1
  86. package/dist/components/pill/pill.js +55 -51
  87. package/dist/components/pill/pill.js.map +1 -1
  88. package/dist/components/popover/popover.js +53 -36
  89. package/dist/components/popover/popover.js.map +1 -1
  90. package/dist/components/radio/radio.js +38 -34
  91. package/dist/components/radio/radio.js.map +1 -1
  92. package/dist/components/scroll-area/scroll-area.js +38 -35
  93. package/dist/components/scroll-area/scroll-area.js.map +1 -1
  94. package/dist/components/scroll-overflow/scroll-overflow.js +166 -151
  95. package/dist/components/scroll-overflow/scroll-overflow.js.map +1 -1
  96. package/dist/components/segmented-control/segmented-control.js +93 -85
  97. package/dist/components/segmented-control/segmented-control.js.map +1 -1
  98. package/dist/components/select/select.js +149 -128
  99. package/dist/components/select/select.js.map +1 -1
  100. package/dist/components/separator/separator.js +19 -16
  101. package/dist/components/separator/separator.js.map +1 -1
  102. package/dist/components/skeleton/skeleton.js +34 -30
  103. package/dist/components/skeleton/skeleton.js.map +1 -1
  104. package/dist/components/spinner/spinner.js +22 -17
  105. package/dist/components/spinner/spinner.js.map +1 -1
  106. package/dist/components/surface/surface.js +25 -22
  107. package/dist/components/surface/surface.js.map +1 -1
  108. package/dist/components/switch/switch.js +66 -57
  109. package/dist/components/switch/switch.js.map +1 -1
  110. package/dist/components/table/table-pagination.js +139 -129
  111. package/dist/components/table/table-pagination.js.map +1 -1
  112. package/dist/components/table/table.js +104 -90
  113. package/dist/components/table/table.js.map +1 -1
  114. package/dist/components/tabs/tabs.js +212 -79
  115. package/dist/components/tabs/tabs.js.map +1 -1
  116. package/dist/components/toast/toast.js +112 -100
  117. package/dist/components/toast/toast.js.map +1 -1
  118. package/dist/components/toggle/toggle.js +32 -30
  119. package/dist/components/toggle/toggle.js.map +1 -1
  120. package/dist/components/tooltip/tooltip.js +59 -46
  121. package/dist/components/tooltip/tooltip.js.map +1 -1
  122. package/dist/index.d.ts +22 -0
  123. package/dist/lib/clear-button.js +18 -17
  124. package/dist/lib/clear-button.js.map +1 -1
  125. package/dist/styles/host-reset.js +47 -0
  126. package/dist/styles/host-reset.js.map +1 -0
  127. package/dist/styles/overlay-layer.js +5 -0
  128. package/dist/styles/overlay-layer.js.map +1 -0
  129. package/dist/tokens.json +1 -1
  130. package/package.json +8 -7
  131. package/scripts/migration-diagnostics.mjs +42 -7
  132. package/scripts/migration-sweep.mjs +9 -1
@@ -1,30 +1,68 @@
1
- import { jsx as s } from "react/jsx-runtime";
1
+ import { jsx as c } from "react/jsx-runtime";
2
2
  import * as a from "react";
3
- import { mergeClasses as f, SLOT_ATTR as c, shorthands as r } from "@epilot/zenith-runtime/v1";
4
- import { makeZenithStyles as W } from "../../styles/make-styles.js";
5
- import { fontWeightNormal as b, leadingSm as v, textSm as C, grayA11 as H, grayA8 as G, grayA12 as x, fieldInputHeight as P, leadingXs as D, textXs as F, errorOnSoft as N, errorA4 as V, errorSoft as L, grayA3 as I, accentA4 as X, accentA3 as $, grayA4 as j, focusRing as M, fieldPaddingX as k, fieldPaddingY as A, spacingElement2 as S, spacingElement1 as z, fieldSetGap as Y, radiusLg as q } from "../../tokens/index.js";
6
- const U = "div", Z = "label", _ = "input", J = "p", K = "div", R = a.createContext(null), E = () => {
7
- const l = a.useContext(R);
8
- if (!l)
3
+ import { mergeClasses as f, SLOT_ATTR as r, shorthands as d } from "@epilot/zenith-runtime/v1";
4
+ import { makeZenithStyles as P } from "../../styles/make-styles.js";
5
+ import { boxModel as m, nativeControl as N } from "../../styles/host-reset.js";
6
+ import { fontWeightNormal as S, leadingSm as R, textSm as D, grayA11 as O, grayA8 as G, grayA12 as x, fieldPaddingY as w, fieldInputHeight as V, leadingXs as E, textXs as C, errorOnSoft as H, errorA4 as j, errorSoft as I, grayA3 as T, accentA4 as X, accentA3 as Y, grayA4 as q, focusRing as U, spacingElement1 as L, fieldPaddingX as A, spacingElement2 as F, fieldSetGap as Z, radiusLg as J } from "../../tokens/index.js";
7
+ const K = "div", Q = "label", ee = "input", te = "p", oe = "div", z = a.createContext(null), $ = () => {
8
+ const n = a.useContext(z);
9
+ if (!n)
9
10
  throw new Error("FieldInput must be used within a Field component");
10
- return l;
11
- }, ne = () => a.useContext(R), p = W({
11
+ return n;
12
+ }, pe = () => a.useContext(z), k = ["field-input", "field-textarea", "select-trigger"], ne = ["field-label", "label"], ie = { cursor: "not-allowed", opacity: 0.5 }, le = () => Object.fromEntries(
13
+ [
14
+ "&[data-disabled]",
15
+ ...k.map(
16
+ (n) => `&:has([${r}="${n}"]:disabled)`
17
+ )
18
+ ].flatMap(
19
+ (n) => ne.map((l) => [
20
+ `${n} [${r}="${l}"]`,
21
+ ie
22
+ ])
23
+ )
24
+ ), B = {
25
+ alignSelf: "center",
26
+ marginTop: `calc(-1 * ${w})`,
27
+ marginBottom: `calc(-1 * ${w})`
28
+ }, re = [...k, "field-input-group"], ae = () => Object.fromEntries([
29
+ ["& > *", { gridColumnStart: 1, gridColumnEnd: -1 }],
30
+ ...re.flatMap((n) => [
31
+ [
32
+ `& > [${r}="${n}"]`,
33
+ { gridColumnStart: 1, gridColumnEnd: 2 }
34
+ ],
35
+ [
36
+ `& > [${r}="${n}"] + :not([${r}])`,
37
+ {
38
+ gridColumnStart: 2,
39
+ gridColumnEnd: 3,
40
+ marginLeft: L,
41
+ ...B
42
+ }
43
+ ]
44
+ ])
45
+ ]), p = P({
12
46
  root: {
47
+ ...m,
13
48
  position: "relative",
14
- display: "flex",
15
- flexDirection: "column",
49
+ // A grid, not a column, so an injected button can sit beside the control (see BESIDE_CONTROL).
50
+ // The second column is empty and zero-wide unless something is injected.
51
+ display: "grid",
52
+ gridTemplateColumns: "minmax(0, 1fr) auto",
16
53
  width: "100%",
17
54
  // Density-bound (DENSITY-SPEC.md §2.3, WP9B1-ACCEPTANCE-WP9B2A): normal resolves to the same
18
55
  // spacingElement2/spacingElement3 values this used before binding — `spacingGroup1` (0.5rem)
19
56
  // is a half-step short of the 0.75rem v1 actually uses, which three components got wrong by
20
57
  // reaching for it directly; that pitfall is why fieldPaddingX's normal tier aliases
21
58
  // spacingElement3, not spacingGroup1 (packages/tokens/spec/density.yaml).
22
- paddingTop: A,
23
- paddingBottom: A,
24
- paddingLeft: k,
25
- paddingRight: k,
26
- ...r.gap(z),
27
- ...r.borderRadius(q),
59
+ paddingTop: w,
60
+ paddingBottom: w,
61
+ paddingLeft: A,
62
+ paddingRight: A,
63
+ // Row gap only: a column gap would narrow the control even while the second column is empty.
64
+ rowGap: L,
65
+ ...d.borderRadius(J),
28
66
  transitionProperty: "all",
29
67
  transitionDuration: "75ms",
30
68
  outlineOffset: "2px",
@@ -35,64 +73,58 @@ const U = "div", Z = "label", _ = "input", J = "p", K = "div", R = a.createConte
35
73
  },
36
74
  "&[data-focused='true'], &[data-focus-visible]": {
37
75
  outlineStyle: "solid",
38
- outlineColor: M
76
+ outlineColor: U
39
77
  },
40
78
  "&[data-invalid]": {
41
- backgroundColor: L
79
+ backgroundColor: I
42
80
  },
43
81
  // Label's disabled styling, declared here because Field owns the elements these selectors are
44
82
  // rooted at. On Label they were written as "[data-disabled] &", ":disabled ~ &" and
45
83
  // "[data-disabled] ~ &"; Griffel does not substitute `&` in that position and emits
46
84
  // `.hash<selector> .hash`, which never matches, so a label in a disabled field never dimmed.
47
- // See src/ancestor-selector.test.ts.
48
- [`&[data-disabled] [${c}="label"]`]: {
49
- pointerEvents: "none",
50
- opacity: 0.5
51
- },
52
- [`& :disabled ~ [${c}="label"]`]: {
53
- cursor: "not-allowed",
54
- opacity: 0.5
55
- },
56
- [`& [data-disabled] ~ [${c}="label"]`]: {
57
- cursor: "not-allowed",
58
- opacity: 0.5
59
- }
85
+ // See src/ancestor-selector.test.ts. The port of those rules still missed: they named the
86
+ // `label` slot while FieldLabel emits `field-label`, and the `~` forms needed the label AFTER
87
+ // the control, but it comes first. `:has()` reaches the control wherever it sits.
88
+ ...le(),
89
+ ...ae()
60
90
  },
61
91
  rootDefault: {
62
- backgroundColor: I,
92
+ backgroundColor: T,
63
93
  ":hover": {
64
- backgroundColor: j
94
+ backgroundColor: q
65
95
  }
66
96
  },
67
97
  rootHighlight: {
68
- backgroundColor: $,
98
+ backgroundColor: Y,
69
99
  ":hover": {
70
100
  backgroundColor: X
71
101
  }
72
102
  },
73
103
  rootReadonly: {
74
- backgroundColor: I
104
+ backgroundColor: T
75
105
  },
76
106
  rootDestructive: {
77
- backgroundColor: L,
107
+ backgroundColor: I,
78
108
  ":hover": {
79
- backgroundColor: V
109
+ backgroundColor: j
80
110
  }
81
111
  },
82
112
  fieldSet: {
113
+ ...m,
83
114
  display: "flex",
84
115
  flexDirection: "column",
85
116
  // Density-bound (DENSITY-SPEC.md §2.3): normal resolves to the same spacingLayout2 (32px)
86
117
  // this used before binding.
87
- ...r.gap(Y),
88
- ...r.border("0"),
89
- ...r.padding(0),
90
- ...r.margin(0)
118
+ ...d.gap(Z),
119
+ ...d.border("0"),
120
+ ...d.padding(0),
121
+ ...d.margin(0)
91
122
  },
92
123
  fieldGroup: {
124
+ ...m,
93
125
  display: "flex",
94
126
  width: "100%",
95
- ...r.gap(S)
127
+ ...d.gap(F)
96
128
  },
97
129
  fieldGroupColumn: {
98
130
  flexDirection: "column"
@@ -106,16 +138,18 @@ const U = "div", Z = "label", _ = "input", J = "p", K = "div", R = a.createConte
106
138
  flexShrink: 1,
107
139
  flexBasis: "0%",
108
140
  flexDirection: "column",
109
- ...r.gap(S),
141
+ ...d.gap(F),
110
142
  lineHeight: "1.375"
111
143
  },
112
144
  label: {
145
+ ...m,
113
146
  minHeight: "1rem",
114
- fontSize: F,
115
- lineHeight: D,
147
+ fontSize: C,
148
+ lineHeight: E,
149
+ // No width: the label stretches across the field's column, so the whole label row is a hit
150
+ // area for the control rather than only the text. Field reads as one box and is aimed at as one.
116
151
  display: "flex",
117
- width: "fit-content",
118
- ...r.gap(S),
152
+ ...d.gap(F),
119
153
  cursor: "default",
120
154
  color: x,
121
155
  "&[data-disabled]": {
@@ -125,7 +159,7 @@ const U = "div", Z = "label", _ = "input", J = "p", K = "div", R = a.createConte
125
159
  labelContent: {
126
160
  display: "inline-flex",
127
161
  alignItems: "center",
128
- ...r.gap(z),
162
+ ...d.gap(L),
129
163
  transitionProperty: "opacity",
130
164
  transitionDuration: "150ms",
131
165
  "@media (prefers-reduced-motion: reduce)": {
@@ -133,6 +167,7 @@ const U = "div", Z = "label", _ = "input", J = "p", K = "div", R = a.createConte
133
167
  }
134
168
  },
135
169
  labelContentHover: {
170
+ ...m,
136
171
  width: 0,
137
172
  height: 0,
138
173
  overflowX: "visible",
@@ -141,10 +176,10 @@ const U = "div", Z = "label", _ = "input", J = "p", K = "div", R = a.createConte
141
176
  pointerEvents: "none"
142
177
  },
143
178
  description: {
144
- fontSize: F,
179
+ fontSize: C,
145
180
  lineHeight: "1.5",
146
- fontWeight: b,
147
- ...r.margin(0),
181
+ fontWeight: S,
182
+ ...d.margin(0),
148
183
  "& a": {
149
184
  textDecorationLine: "underline",
150
185
  textUnderlineOffset: "4px"
@@ -154,43 +189,45 @@ const U = "div", Z = "label", _ = "input", J = "p", K = "div", R = a.createConte
154
189
  color: x
155
190
  },
156
191
  descriptionHelper: {
157
- color: H
192
+ color: O
158
193
  },
159
194
  error: {
160
- color: N,
161
- fontSize: F,
162
- lineHeight: D,
163
- fontWeight: b
195
+ color: H,
196
+ fontSize: C,
197
+ lineHeight: E,
198
+ fontWeight: S
164
199
  },
165
200
  errorList: {
201
+ ...m,
166
202
  display: "flex",
167
203
  flexDirection: "column",
168
- ...r.margin(0),
204
+ ...d.margin(0),
169
205
  paddingLeft: "1.25rem",
170
206
  listStyleType: "disc"
171
207
  },
172
208
  errorListItem: {
173
- color: N,
174
- fontSize: F,
175
- lineHeight: D,
176
- fontWeight: b,
209
+ color: H,
210
+ fontSize: C,
211
+ lineHeight: E,
212
+ fontWeight: S,
177
213
  marginTop: "0.25rem",
178
214
  marginBottom: "0.25rem"
179
215
  },
180
216
  input: {
217
+ ...N,
181
218
  width: "100%",
182
219
  // Density-bound (DENSITY-SPEC.md §2.3): normal resolves to the same "1.5rem" this used before
183
220
  // binding. FieldComboboxInput (field-combobox.tsx) has its OWN separate makeZenithStyles call
184
221
  // and its own unrelated "input" key (width: "100%" only, no height) — this binding does not
185
222
  // reach it; review corrected an earlier claim that it did.
186
- height: P,
223
+ height: V,
187
224
  outlineStyle: "none",
188
- fontSize: C,
189
- lineHeight: v,
225
+ fontSize: D,
226
+ lineHeight: R,
190
227
  color: x,
191
228
  backgroundColor: "transparent",
192
- ...r.border("0"),
193
- ...r.padding(0),
229
+ ...d.border("0"),
230
+ ...d.padding(0),
194
231
  "::placeholder": {
195
232
  color: G
196
233
  },
@@ -199,20 +236,24 @@ const U = "div", Z = "label", _ = "input", J = "p", K = "div", R = a.createConte
199
236
  }
200
237
  },
201
238
  inputGroup: {
239
+ ...m,
202
240
  display: "flex",
203
241
  alignItems: "center",
204
- ...r.gap(z),
205
- width: "100%"
242
+ ...d.gap(L),
243
+ width: "100%",
244
+ // Already a row, so an injected button lands beside the input; it must not stretch the row.
245
+ [`& > [${r}="field-input"] + :not([${r}])`]: B
206
246
  },
207
247
  textarea: {
248
+ ...N,
208
249
  width: "100%",
209
250
  outlineStyle: "none",
210
- fontSize: C,
211
- lineHeight: v,
251
+ fontSize: D,
252
+ lineHeight: R,
212
253
  color: x,
213
254
  backgroundColor: "transparent",
214
- ...r.border("0"),
215
- ...r.padding(0),
255
+ ...d.border("0"),
256
+ ...d.padding(0),
216
257
  "::placeholder": {
217
258
  color: G
218
259
  },
@@ -230,17 +271,18 @@ const U = "div", Z = "label", _ = "input", J = "p", K = "div", R = a.createConte
230
271
  resize: "horizontal"
231
272
  },
232
273
  addon: {
233
- color: H,
274
+ ...m,
275
+ color: O,
234
276
  display: "flex",
235
277
  height: "auto",
236
278
  cursor: "text",
237
279
  whiteSpace: "nowrap",
238
280
  alignItems: "center",
239
281
  justifyContent: "center",
240
- ...r.gap(S),
241
- fontSize: C,
242
- lineHeight: v,
243
- fontWeight: b,
282
+ ...d.gap(F),
283
+ fontSize: D,
284
+ lineHeight: R,
285
+ fontWeight: S,
244
286
  userSelect: "none"
245
287
  },
246
288
  addonStart: {
@@ -249,132 +291,132 @@ const U = "div", Z = "label", _ = "input", J = "p", K = "div", R = a.createConte
249
291
  addonEnd: {
250
292
  order: 1
251
293
  }
252
- }), ie = ({
253
- variant: l = "default"
254
- } = {}) => l, le = a.forwardRef(
294
+ }), ge = ({
295
+ variant: n = "default"
296
+ } = {}) => n, me = a.forwardRef(
255
297
  function({
256
- className: i,
298
+ className: l,
257
299
  variant: e = "default",
258
300
  children: t,
259
301
  onFocusCapture: o,
260
- onBlurCapture: n,
261
- ...d
262
- }, m) {
263
- const u = p(), h = a.useRef(null), [g, y] = a.useState(!1), T = (w) => {
264
- y(!0), o == null || o(w);
265
- }, O = (w) => {
266
- y(!1), n == null || n(w);
267
- }, B = e === "highlight" ? u.rootHighlight : e === "readonly" ? u.rootReadonly : e === "destructive" ? u.rootDestructive : u.rootDefault;
268
- return /* @__PURE__ */ s(R.Provider, { value: { inputRef: h }, children: /* @__PURE__ */ s(
269
- U,
302
+ onBlurCapture: i,
303
+ ...s
304
+ }, h) {
305
+ const u = p(), y = a.useRef(null), [g, b] = a.useState(!1), _ = (v) => {
306
+ b(!0), o == null || o(v);
307
+ }, W = (v) => {
308
+ b(!1), i == null || i(v);
309
+ }, M = e === "highlight" ? u.rootHighlight : e === "readonly" ? u.rootReadonly : e === "destructive" ? u.rootDestructive : u.rootDefault;
310
+ return /* @__PURE__ */ c(z.Provider, { value: { inputRef: y }, children: /* @__PURE__ */ c(
311
+ K,
270
312
  {
271
- ref: m,
313
+ ref: h,
272
314
  role: "group",
273
315
  "data-slot": "field",
274
- [c]: "field",
316
+ [r]: "field",
275
317
  "data-focused": g ? "true" : "false",
276
- className: f(u.root, B, i),
277
- onFocusCapture: T,
278
- onBlurCapture: O,
279
- ...d,
318
+ className: f(u.root, M, l),
319
+ onFocusCapture: _,
320
+ onBlurCapture: W,
321
+ ...s,
280
322
  children: t
281
323
  }
282
324
  ) });
283
325
  }
284
- ), re = a.forwardRef(
285
- function({ className: i, ...e }, t) {
326
+ ), he = a.forwardRef(
327
+ function({ className: l, ...e }, t) {
286
328
  const o = p();
287
- return /* @__PURE__ */ s(
329
+ return /* @__PURE__ */ c(
288
330
  "fieldset",
289
331
  {
290
332
  ref: t,
291
333
  "data-slot": "field-set",
292
- [c]: "field-set",
293
- className: f(o.fieldSet, i),
334
+ [r]: "field-set",
335
+ className: f(o.fieldSet, l),
294
336
  ...e
295
337
  }
296
338
  );
297
339
  }
298
- ), ae = a.forwardRef(
299
- function({ className: i, direction: e = "column", ...t }, o) {
300
- const n = p();
301
- return /* @__PURE__ */ s(
340
+ ), ye = a.forwardRef(
341
+ function({ className: l, direction: e = "column", ...t }, o) {
342
+ const i = p();
343
+ return /* @__PURE__ */ c(
302
344
  "div",
303
345
  {
304
346
  ref: o,
305
347
  "data-slot": "field-group",
306
- [c]: "field-group",
348
+ [r]: "field-group",
307
349
  className: f(
308
- n.fieldGroup,
309
- e === "row" ? n.fieldGroupRow : n.fieldGroupColumn,
310
- i
350
+ i.fieldGroup,
351
+ e === "row" ? i.fieldGroupRow : i.fieldGroupColumn,
352
+ l
311
353
  ),
312
354
  ...t
313
355
  }
314
356
  );
315
357
  }
316
- ), de = a.forwardRef(
317
- function({ className: i, ...e }, t) {
358
+ ), be = a.forwardRef(
359
+ function({ className: l, ...e }, t) {
318
360
  const o = p();
319
- return /* @__PURE__ */ s(
361
+ return /* @__PURE__ */ c(
320
362
  "div",
321
363
  {
322
364
  ref: t,
323
365
  "data-slot": "field-content",
324
- [c]: "field-content",
325
- className: f(o.fieldContent, i),
366
+ [r]: "field-content",
367
+ className: f(o.fieldContent, l),
326
368
  ...e
327
369
  }
328
370
  );
329
371
  }
330
- ), se = a.forwardRef(
331
- function({ className: i, ...e }, t) {
372
+ ), Se = a.forwardRef(
373
+ function({ className: l, ...e }, t) {
332
374
  const o = p();
333
- return /* @__PURE__ */ s(
334
- Z,
375
+ return /* @__PURE__ */ c(
376
+ Q,
335
377
  {
336
378
  ref: t,
337
379
  "data-slot": "field-label",
338
- [c]: "field-label",
339
- className: f(o.label, i),
380
+ [r]: "field-label",
381
+ className: f(o.label, l),
340
382
  ...e
341
383
  }
342
384
  );
343
385
  }
344
- ), ce = a.forwardRef(function({ className: i, showOnHover: e = !0, ...t }, o) {
345
- const n = p();
346
- return /* @__PURE__ */ s(
386
+ ), xe = a.forwardRef(function({ className: l, showOnHover: e = !0, ...t }, o) {
387
+ const i = p();
388
+ return /* @__PURE__ */ c(
347
389
  "div",
348
390
  {
349
391
  ref: o,
350
392
  "data-slot": "field-label-content",
351
- [c]: "field-label-content",
393
+ [r]: "field-label-content",
352
394
  className: f(
353
- n.labelContent,
354
- e && n.labelContentHover,
355
- i
395
+ i.labelContent,
396
+ e && i.labelContentHover,
397
+ l
356
398
  ),
357
399
  ...t
358
400
  }
359
401
  );
360
- }), ue = ({
361
- variant: l = "default"
362
- } = {}) => l, fe = a.forwardRef(function({ className: i, variant: e = "default", ...t }, o) {
363
- const n = p(), d = e === "helper" ? n.descriptionHelper : n.descriptionDefault;
364
- return /* @__PURE__ */ s(
365
- J,
402
+ }), Ce = ({
403
+ variant: n = "default"
404
+ } = {}) => n, Fe = a.forwardRef(function({ className: l, variant: e = "default", ...t }, o) {
405
+ const i = p(), s = e === "helper" ? i.descriptionHelper : i.descriptionDefault;
406
+ return /* @__PURE__ */ c(
407
+ te,
366
408
  {
367
409
  ref: o,
368
410
  "data-slot": "field-description",
369
- [c]: "field-description",
370
- className: f(n.description, d, i),
411
+ [r]: "field-description",
412
+ className: f(i.description, s, l),
371
413
  ...t
372
414
  }
373
415
  );
374
- }), pe = a.forwardRef(
375
- function({ className: i, children: e, errors: t, ...o }, n) {
376
- const d = p(), m = a.useMemo(() => {
377
- var h;
416
+ }), Le = a.forwardRef(
417
+ function({ className: l, children: e, errors: t, ...o }, i) {
418
+ const s = p(), h = a.useMemo(() => {
419
+ var y;
378
420
  if (e)
379
421
  return e;
380
422
  if (!(t != null && t.length))
@@ -382,106 +424,106 @@ const U = "div", Z = "label", _ = "input", J = "p", K = "div", R = a.createConte
382
424
  const u = [
383
425
  ...new Map(t.map((g) => [g == null ? void 0 : g.message, g])).values()
384
426
  ];
385
- return u.length === 1 ? (h = u[0]) == null ? void 0 : h.message : /* @__PURE__ */ s("ul", { className: d.errorList, children: u.map(
386
- (g, y) => (g == null ? void 0 : g.message) && /* @__PURE__ */ s("li", { className: d.errorListItem, children: g.message }, y)
427
+ return u.length === 1 ? (y = u[0]) == null ? void 0 : y.message : /* @__PURE__ */ c("ul", { className: s.errorList, children: u.map(
428
+ (g, b) => (g == null ? void 0 : g.message) && /* @__PURE__ */ c("li", { className: s.errorListItem, children: g.message }, b)
387
429
  ) });
388
- }, [e, t, d.errorList, d.errorListItem]);
389
- return m ? /* @__PURE__ */ s(
390
- K,
430
+ }, [e, t, s.errorList, s.errorListItem]);
431
+ return h ? /* @__PURE__ */ c(
432
+ oe,
391
433
  {
392
- ref: n,
434
+ ref: i,
393
435
  role: "alert",
394
436
  "data-slot": "field-error",
395
- [c]: "field-error",
396
- className: f(d.error, i),
437
+ [r]: "field-error",
438
+ className: f(s.error, l),
397
439
  ...o,
398
- children: m
440
+ children: h
399
441
  }
400
442
  ) : null;
401
443
  }
402
- ), ge = a.forwardRef(
403
- function({ className: i, ...e }, t) {
404
- const o = p(), { inputRef: n } = E();
405
- return /* @__PURE__ */ s(
406
- _,
444
+ ), we = a.forwardRef(
445
+ function({ className: l, ...e }, t) {
446
+ const o = p(), { inputRef: i } = $();
447
+ return /* @__PURE__ */ c(
448
+ ee,
407
449
  {
408
- ref: (d) => {
409
- n.current = d, typeof t == "function" ? t(d) : t && (t.current = d);
450
+ ref: (s) => {
451
+ i.current = s, typeof t == "function" ? t(s) : t && (t.current = s);
410
452
  },
411
453
  "data-readonly": e.readOnly,
412
454
  "data-slot": "field-input",
413
- [c]: "field-input",
414
- className: f(o.input, i),
455
+ [r]: "field-input",
456
+ className: f(o.input, l),
415
457
  ...e
416
458
  }
417
459
  );
418
460
  }
419
- ), me = a.forwardRef(function({ className: i, ...e }, t) {
461
+ ), ve = a.forwardRef(function({ className: l, ...e }, t) {
420
462
  const o = p();
421
- return /* @__PURE__ */ s(
463
+ return /* @__PURE__ */ c(
422
464
  "div",
423
465
  {
424
466
  ref: t,
425
467
  "data-slot": "field-input-group",
426
- [c]: "field-input-group",
427
- className: f(o.inputGroup, i),
468
+ [r]: "field-input-group",
469
+ className: f(o.inputGroup, l),
428
470
  ...e
429
471
  }
430
472
  );
431
- }), he = a.forwardRef(function({ className: i, resize: e = "none", ...t }, o) {
432
- const n = p(), { inputRef: d } = E(), m = e === "vertical" ? n.resizeVertical : e === "horizontal" ? n.resizeHorizontal : n.resizeNone;
433
- return /* @__PURE__ */ s(
473
+ }), Re = a.forwardRef(function({ className: l, resize: e = "none", ...t }, o) {
474
+ const i = p(), { inputRef: s } = $(), h = e === "vertical" ? i.resizeVertical : e === "horizontal" ? i.resizeHorizontal : i.resizeNone;
475
+ return /* @__PURE__ */ c(
434
476
  "textarea",
435
477
  {
436
478
  ...t,
437
479
  ref: (u) => {
438
- d.current = u, typeof o == "function" ? o(u) : o && (o.current = u);
480
+ s.current = u, typeof o == "function" ? o(u) : o && (o.current = u);
439
481
  },
440
482
  "data-readonly": t.readOnly,
441
483
  "data-slot": "field-textarea",
442
- [c]: "field-textarea",
484
+ [r]: "field-textarea",
443
485
  "data-resize": e,
444
- className: f(n.textarea, m, i)
486
+ className: f(i.textarea, h, l)
445
487
  }
446
488
  );
447
- }), ye = ({
448
- align: l = "start"
449
- } = {}) => l, be = a.forwardRef(function({ className: i, align: e = "start", ...t }, o) {
450
- const n = p();
451
- return /* @__PURE__ */ s(
489
+ }), De = ({
490
+ align: n = "start"
491
+ } = {}) => n, Ee = a.forwardRef(function({ className: l, align: e = "start", ...t }, o) {
492
+ const i = p();
493
+ return /* @__PURE__ */ c(
452
494
  "div",
453
495
  {
454
496
  ref: o,
455
497
  role: "group",
456
498
  "data-slot": "input-group-addon",
457
- [c]: "input-group-addon",
499
+ [r]: "input-group-addon",
458
500
  "data-align": e,
459
501
  className: f(
460
- n.addon,
461
- e === "end" ? n.addonEnd : n.addonStart,
462
- i
502
+ i.addon,
503
+ e === "end" ? i.addonEnd : i.addonStart,
504
+ l
463
505
  ),
464
506
  ...t
465
507
  }
466
508
  );
467
509
  });
468
510
  export {
469
- le as Field,
470
- de as FieldContent,
471
- fe as FieldDescription,
472
- pe as FieldError,
473
- ae as FieldGroup,
474
- be as FieldGroupAddon,
475
- ge as FieldInput,
476
- me as FieldInputGroup,
477
- se as FieldLabel,
478
- ce as FieldLabelContent,
479
- re as FieldSet,
480
- he as FieldTextarea,
481
- ue as fieldDescriptionVariants,
482
- ie as fieldVariants,
483
- ye as inputGroupAddonVariants,
484
- E as useFieldContext,
485
- ne as useOptionalFieldContext
511
+ me as Field,
512
+ be as FieldContent,
513
+ Fe as FieldDescription,
514
+ Le as FieldError,
515
+ ye as FieldGroup,
516
+ Ee as FieldGroupAddon,
517
+ we as FieldInput,
518
+ ve as FieldInputGroup,
519
+ Se as FieldLabel,
520
+ xe as FieldLabelContent,
521
+ he as FieldSet,
522
+ Re as FieldTextarea,
523
+ Ce as fieldDescriptionVariants,
524
+ ge as fieldVariants,
525
+ De as inputGroupAddonVariants,
526
+ $ as useFieldContext,
527
+ pe as useOptionalFieldContext
486
528
  };
487
529
  //# sourceMappingURL=field.js.map