@devslab/dds-react 0.21.2 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/README.ko.md +6 -1
  2. package/README.md +6 -1
  3. package/dist/calendar-view-I_sNlioP.js +145 -0
  4. package/dist/calendar-view-I_sNlioP.js.map +1 -0
  5. package/dist/calendar-view.d.ts +16 -0
  6. package/dist/calendar-view.d.ts.map +1 -0
  7. package/dist/calendar.d.ts +19 -0
  8. package/dist/calendar.d.ts.map +1 -0
  9. package/dist/calendar.js +51 -0
  10. package/dist/calendar.js.map +1 -0
  11. package/dist/choice-B3vNMfKK.js +300 -0
  12. package/dist/choice-B3vNMfKK.js.map +1 -0
  13. package/dist/choice-types.d.ts +56 -0
  14. package/dist/choice-types.d.ts.map +1 -0
  15. package/dist/combobox.d.ts +4 -0
  16. package/dist/combobox.d.ts.map +1 -0
  17. package/dist/combobox.js +13 -0
  18. package/dist/combobox.js.map +1 -0
  19. package/dist/controls-BajigKUv.js +139 -0
  20. package/dist/controls-BajigKUv.js.map +1 -0
  21. package/dist/date-only.d.ts +36 -0
  22. package/dist/date-only.d.ts.map +1 -0
  23. package/dist/date-picker.d.ts +8 -9
  24. package/dist/date-picker.d.ts.map +1 -1
  25. package/dist/date-picker.js +198 -0
  26. package/dist/date-picker.js.map +1 -0
  27. package/dist/dropdown-menu.d.ts +31 -0
  28. package/dist/dropdown-menu.d.ts.map +1 -0
  29. package/dist/dropdown-menu.js +73 -0
  30. package/dist/dropdown-menu.js.map +1 -0
  31. package/dist/index.d.ts +6 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +203 -578
  34. package/dist/index.js.map +1 -1
  35. package/dist/input.d.ts +22 -0
  36. package/dist/input.d.ts.map +1 -0
  37. package/dist/input.js +92 -0
  38. package/dist/input.js.map +1 -0
  39. package/dist/internal/choice.d.ts +5 -0
  40. package/dist/internal/choice.d.ts.map +1 -0
  41. package/dist/popover.d.ts +21 -0
  42. package/dist/popover.d.ts.map +1 -0
  43. package/dist/popover.js +49 -0
  44. package/dist/popover.js.map +1 -0
  45. package/dist/select-picker.d.ts +4 -0
  46. package/dist/select-picker.d.ts.map +1 -0
  47. package/dist/select-picker.js +13 -0
  48. package/dist/select-picker.js.map +1 -0
  49. package/package.json +46 -10
  50. package/styles.css +10 -1
package/dist/index.js CHANGED
@@ -1,167 +1,47 @@
1
- import { createContext as e, forwardRef as t, useContext as n, useEffect as r, useId as i, useMemo as a, useRef as o, useState as s } from "react";
2
- import { Field as c, Field as l } from "@ark-ui/react/field";
3
- import { Checkbox as u, Checkbox as d } from "@ark-ui/react/checkbox";
4
- import { Switch as f, Switch as p } from "@ark-ui/react/switch";
5
- import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
6
- import { Tabs as _, Tabs as v, useTabsContext as y } from "@ark-ui/react/tabs";
7
- import { RadioGroup as b, RadioGroup as x, useRadioGroupContext as S } from "@ark-ui/react/radio-group";
8
- import { Dialog as C, Dialog as w } from "@ark-ui/react/dialog";
9
- import { Tooltip as T, Tooltip as E } from "@ark-ui/react/tooltip";
10
- import { Portal as D } from "@ark-ui/react/portal";
11
- import { directionPolicy as O, icons as k } from "@devslab/dds-icons";
12
- import { Toast as A, Toast as j, Toaster as M, createToaster as N } from "@ark-ui/react/toast";
13
- import { DatePicker as P, DatePicker as F, parseDate as I } from "@ark-ui/react/date-picker";
14
- //#region src/controls.tsx
15
- var L = (...e) => e.filter(Boolean).join(" "), R = t(function({ tone: e = "primary", size: t = "md", loading: n, disabled: r, type: i = "button", className: a, children: o, ...s }, c) {
16
- return /* @__PURE__ */ g("button", {
17
- ...s,
18
- ref: c,
19
- type: i,
20
- disabled: r || n,
21
- "aria-busy": n || void 0,
22
- className: L("dds-btn", `dds-btn--${e}`, t !== "md" && `dds-btn--${t}`, a),
23
- children: [n && /* @__PURE__ */ h("span", {
24
- className: "dds-spinner",
25
- "aria-hidden": !0
26
- }), o]
27
- });
28
- }), z = t(function({ tone: e = "ghost", size: t = "md", loading: n, disabled: r, type: i = "button", className: a, children: o, ...s }, c) {
29
- return /* @__PURE__ */ h("button", {
30
- ...s,
31
- ref: c,
32
- type: i,
33
- disabled: r || n,
34
- "aria-busy": n || void 0,
35
- className: L("dds-iconbtn", e !== "ghost" && `dds-iconbtn--${e}`, t !== "md" && `dds-iconbtn--${t}`, a),
36
- children: n ? /* @__PURE__ */ h("span", {
37
- className: "dds-spinner",
38
- "aria-hidden": !0
39
- }) : o
40
- });
41
- }), B = t(function({ id: e, label: t, helpText: n, error: r, required: a, className: o, children: s, ...c }, u) {
42
- let d = i(), f = e ?? `dds-field-${d}`, p = {
43
- id: f,
44
- "aria-describedby": [n && `${f}-help`, r && `${f}-error`].filter(Boolean).join(" ") || void 0,
45
- "aria-invalid": r ? !0 : void 0,
46
- "aria-required": a ? !0 : void 0
47
- };
48
- return /* @__PURE__ */ g(l.Root, {
49
- ...c,
50
- ref: u,
51
- invalid: !!r,
52
- required: a,
53
- id: f,
54
- ids: {
55
- control: `${f}-root`,
56
- helperText: `${f}-help`,
57
- errorText: `${f}-error`
58
- },
59
- className: L("dds-field", !!r && "dds-field--error", o),
60
- children: [
61
- /* @__PURE__ */ g(l.Label, {
62
- htmlFor: f,
63
- className: "dds-field__label",
64
- children: [t, a && /* @__PURE__ */ h("span", {
65
- "aria-hidden": !0,
66
- children: " *"
67
- })]
68
- }),
69
- typeof s == "function" ? s(p) : s,
70
- n && /* @__PURE__ */ h(l.HelperText, {
71
- className: "dds-field__help",
72
- children: n
73
- }),
74
- r && /* @__PURE__ */ h(l.ErrorText, {
75
- className: "dds-field__error",
76
- role: "alert",
77
- children: r
78
- })
79
- ]
80
- });
81
- }), V = t(function({ invalid: e, wrapperClassName: t, className: n, children: r, ...i }, a) {
82
- return /* @__PURE__ */ h("span", {
83
- className: L("dds-select", t),
84
- children: /* @__PURE__ */ h("select", {
85
- ...i,
86
- ref: a,
87
- className: L("dds-select__input", n),
88
- "aria-invalid": e || i["aria-invalid"],
89
- children: r
90
- })
91
- });
92
- }), H = t(function({ kind: e, label: t, checked: n, defaultChecked: r, onCheckedChange: i, id: a, name: o, value: s, disabled: c, required: l, readOnly: u, form: f, className: m, inputClassName: _, onChange: v, ...y }, b) {
93
- let x = e === "switch" ? p.Root : d.Root, S = e === "switch" ? p.Label : d.Label, C = e === "switch" ? p.Context : d.Context, w = e === "switch" ? "dds-switch" : "dds-check";
94
- return /* @__PURE__ */ g(x, {
95
- checked: n,
96
- defaultChecked: r,
97
- onCheckedChange: (e) => i?.(e.checked === !0),
98
- ids: a ? { hiddenInput: a } : void 0,
99
- name: o,
100
- value: String(s ?? "on"),
101
- disabled: c,
102
- required: l,
103
- readOnly: u,
104
- form: f,
105
- className: L(w, m),
106
- children: [/* @__PURE__ */ h(C, { children: (t) => {
107
- let { style: n, defaultChecked: r, ...i } = t.getHiddenInputProps();
108
- return /* @__PURE__ */ h("input", {
109
- ...i,
110
- ...y,
111
- ref: b,
112
- checked: t.checked,
113
- role: e === "switch" ? "switch" : void 0,
114
- onChange: v ?? (() => {}),
115
- onClick: (e) => {
116
- y.onClick?.(e), e.defaultPrevented || i.onClick?.(e);
117
- },
118
- className: L(`${w}__input`, _)
119
- });
120
- } }), /* @__PURE__ */ h(S, { children: t })]
121
- });
122
- }), U = t((e, t) => /* @__PURE__ */ h(H, {
123
- ...e,
124
- kind: "checkbox",
125
- ref: t
126
- })), W = t((e, t) => /* @__PURE__ */ h(H, {
127
- ...e,
128
- kind: "switch",
129
- ref: t
130
- })), G = t(function({ label: e, className: t, inputClassName: n, onCheckedChange: r, onChange: i, ...a }, o) {
131
- return /* @__PURE__ */ g("label", {
132
- className: L("dds-check", t),
133
- children: [/* @__PURE__ */ h("input", {
134
- ...a,
135
- ref: o,
136
- type: "radio",
137
- className: L("dds-check__input", n),
138
- onChange: (e) => {
139
- i?.(e), e.defaultPrevented || r?.(e.currentTarget.checked);
140
- }
141
- }), /* @__PURE__ */ h("span", { children: e })]
1
+ import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./controls-BajigKUv.js";
2
+ import { DatePicker as c } from "./date-picker.js";
3
+ import { Input as l, InputGroup as u } from "./input.js";
4
+ import { Combobox as d } from "./combobox.js";
5
+ import { SelectPicker as f } from "./select-picker.js";
6
+ import { DropdownMenu as p } from "./dropdown-menu.js";
7
+ import { Popover as m } from "./popover.js";
8
+ import { Calendar as h } from "./calendar.js";
9
+ import { createContext as g, forwardRef as _, useContext as v, useEffect as y, useId as b, useMemo as x, useRef as S, useState as C } from "react";
10
+ import { Field as w } from "@ark-ui/react/field";
11
+ import { Checkbox as T } from "@ark-ui/react/checkbox";
12
+ import { Switch as E } from "@ark-ui/react/switch";
13
+ import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
14
+ import { Tabs as A, Tabs as j, useTabsContext as ee } from "@ark-ui/react/tabs";
15
+ import { RadioGroup as te, RadioGroup as M, useRadioGroupContext as N } from "@ark-ui/react/radio-group";
16
+ import { Dialog as P, Dialog as F } from "@ark-ui/react/dialog";
17
+ import { Tooltip as I, Tooltip as L } from "@ark-ui/react/tooltip";
18
+ import { Portal as R } from "@ark-ui/react/portal";
19
+ import { directionPolicy as z, icons as B } from "@devslab/dds-icons";
20
+ import { Toast as V, Toast as H, Toaster as U, createToaster as W } from "@ark-ui/react/toast";
21
+ import { DatePicker as G } from "@ark-ui/react/date-picker";
22
+ //#region src/selection.tsx
23
+ var K = _(function({ onValueChange: e, unstyled: n, className: r, ...i }, a) {
24
+ return /* @__PURE__ */ O(j.Root, {
25
+ ...i,
26
+ ref: a,
27
+ onValueChange: (t) => e?.(t.value),
28
+ className: t(!n && "dds-tabs-root", r)
142
29
  });
143
- }), ee = t(function({ onValueChange: e, unstyled: t, className: n, ...r }, i) {
144
- return /* @__PURE__ */ h(v.Root, {
30
+ }), q = _(function({ unstyled: e, className: n, ...r }, i) {
31
+ return /* @__PURE__ */ O(j.List, {
145
32
  ...r,
146
33
  ref: i,
147
- onValueChange: (t) => e?.(t.value),
148
- className: L(!t && "dds-tabs-root", n)
34
+ className: t(!e && "dds-tabs", n)
149
35
  });
150
- }), te = t(function({ unstyled: e, className: t, ...n }, r) {
151
- return /* @__PURE__ */ h(v.List, {
152
- ...n,
153
- ref: r,
154
- className: L(!e && "dds-tabs", t)
155
- });
156
- }), ne = t(function({ unstyled: e, className: t, ...n }, r) {
157
- return /* @__PURE__ */ h(v.Trigger, {
158
- ...n,
159
- ref: r,
160
- className: L(!e && "dds-tab", t)
36
+ }), J = _(function({ unstyled: e, className: n, ...r }, i) {
37
+ return /* @__PURE__ */ O(j.Trigger, {
38
+ ...r,
39
+ ref: i,
40
+ className: t(!e && "dds-tab", n)
161
41
  });
162
- }), re = t(function({ value: e, style: t, ...n }, r) {
163
- let i = y().value !== e;
164
- return /* @__PURE__ */ h(v.Content, {
42
+ }), Y = _(function({ value: e, style: t, ...n }, r) {
43
+ let i = ee().value !== e;
44
+ return /* @__PURE__ */ O(j.Content, {
165
45
  ...n,
166
46
  value: e,
167
47
  ref: r,
@@ -172,92 +52,92 @@ var L = (...e) => e.filter(Boolean).join(" "), R = t(function({ tone: e = "prima
172
52
  } : t
173
53
  });
174
54
  });
175
- function ie({ option: e }) {
176
- let t = S(), { style: n, defaultChecked: r, ...i } = t.getItemHiddenInputProps(e);
177
- return /* @__PURE__ */ h("input", {
55
+ function X({ option: e }) {
56
+ let t = N(), { style: n, defaultChecked: r, ...i } = t.getItemHiddenInputProps(e);
57
+ return /* @__PURE__ */ O("input", {
178
58
  ...i,
179
59
  checked: t.value === e.value,
180
60
  onChange: () => {},
181
61
  className: "dds-check__input"
182
62
  });
183
63
  }
184
- var ae = t(function({ options: e, label: t, onValueChange: n, className: r, children: i, ...a }, o) {
185
- return /* @__PURE__ */ g(x.Root, {
186
- ...a,
187
- ref: o,
64
+ var Z = _(function({ options: e, label: n, onValueChange: r, className: i, children: a, ...o }, s) {
65
+ return /* @__PURE__ */ k(M.Root, {
66
+ ...o,
67
+ ref: s,
188
68
  onValueChange: (e) => {
189
- e.value !== null && n?.(e.value);
69
+ e.value !== null && r?.(e.value);
190
70
  },
191
- className: L("dds-radio-group", r),
71
+ className: t("dds-radio-group", i),
192
72
  children: [
193
- /* @__PURE__ */ h(x.Label, {
73
+ /* @__PURE__ */ O(M.Label, {
194
74
  className: "dds-field__label",
195
- children: t
75
+ children: n
196
76
  }),
197
- e.map((e) => /* @__PURE__ */ g(x.Item, {
77
+ e.map((e) => /* @__PURE__ */ k(M.Item, {
198
78
  value: e.value,
199
79
  disabled: e.disabled,
200
80
  className: "dds-check",
201
- children: [/* @__PURE__ */ h(ie, { option: e }), /* @__PURE__ */ h(x.ItemText, { children: e.label })]
81
+ children: [/* @__PURE__ */ O(X, { option: e }), /* @__PURE__ */ O(M.ItemText, { children: e.label })]
202
82
  }, e.value)),
203
- i
83
+ a
204
84
  ]
205
85
  });
206
- }), oe = t(function({ title: e, description: t, children: n, actions: r, onOpenChange: i, closeOnOutside: a, portal: o = !0, className: s, overlayClassName: c, contentProps: l, initialFocus: u, finalFocus: d, frame: f, unstyled: p, ..._ }, v) {
207
- let y = {
208
- title: /* @__PURE__ */ h(w.Title, {
209
- className: p ? void 0 : "dds-dialog__title",
86
+ }), ne = _(function({ title: e, description: n, children: r, actions: i, onOpenChange: a, closeOnOutside: o, portal: s = !0, className: c, overlayClassName: l, contentProps: u, initialFocus: d, finalFocus: f, frame: p, unstyled: m, ...h }, g) {
87
+ let _ = {
88
+ title: /* @__PURE__ */ O(F.Title, {
89
+ className: m ? void 0 : "dds-dialog__title",
210
90
  children: e
211
91
  }),
212
- description: t && /* @__PURE__ */ h(w.Description, {
213
- className: p ? void 0 : "dds-dialog__body",
214
- children: t
92
+ description: n && /* @__PURE__ */ O(F.Description, {
93
+ className: m ? void 0 : "dds-dialog__body",
94
+ children: n
215
95
  }),
216
- children: n,
217
- actions: r && /* @__PURE__ */ h("div", {
218
- className: p ? void 0 : "dds-dialog__actions",
219
- children: r
96
+ children: r,
97
+ actions: i && /* @__PURE__ */ O("div", {
98
+ className: m ? void 0 : "dds-dialog__actions",
99
+ children: i
220
100
  })
221
- }, b = /* @__PURE__ */ h(w.Positioner, {
222
- className: L(!p && "dds-dialog-overlay", c),
223
- children: /* @__PURE__ */ h(w.Content, {
224
- ...l,
225
- ref: v,
226
- "aria-describedby": t ? l?.["aria-describedby"] : void 0,
227
- className: L(!p && "dds-dialog", s, l?.className),
228
- children: f ? f(y) : /* @__PURE__ */ g(m, { children: [
229
- y.title,
230
- y.description,
231
- n,
232
- y.actions
101
+ }, v = /* @__PURE__ */ O(F.Positioner, {
102
+ className: t(!m && "dds-dialog-overlay", l),
103
+ children: /* @__PURE__ */ O(F.Content, {
104
+ ...u,
105
+ ref: g,
106
+ "aria-describedby": n ? u?.["aria-describedby"] : void 0,
107
+ className: t(!m && "dds-dialog", c, u?.className),
108
+ children: p ? p(_) : /* @__PURE__ */ k(D, { children: [
109
+ _.title,
110
+ _.description,
111
+ r,
112
+ _.actions
233
113
  ] })
234
114
  })
235
115
  });
236
- return /* @__PURE__ */ h(w.Root, {
237
- ..._,
238
- onOpenChange: (e) => i?.(e.open),
239
- closeOnInteractOutside: a ?? _.closeOnInteractOutside,
240
- initialFocusEl: u ? () => u() ?? null : _.initialFocusEl,
241
- finalFocusEl: d ? () => d() ?? null : _.finalFocusEl,
116
+ return /* @__PURE__ */ O(F.Root, {
117
+ ...h,
118
+ onOpenChange: (e) => a?.(e.open),
119
+ closeOnInteractOutside: o ?? h.closeOnInteractOutside,
120
+ initialFocusEl: d ? () => d() ?? null : h.initialFocusEl,
121
+ finalFocusEl: f ? () => f() ?? null : h.finalFocusEl,
242
122
  lazyMount: !0,
243
123
  unmountOnExit: !0,
244
- children: o ? /* @__PURE__ */ h(D, { children: b }) : b
124
+ children: s ? /* @__PURE__ */ O(R, { children: v }) : v
245
125
  });
246
126
  });
247
- function se({ content: e, children: t, onOpenChange: n, className: r, contentProps: i, ...a }) {
248
- return /* @__PURE__ */ h(E.Root, {
127
+ function re({ content: e, children: n, onOpenChange: r, className: i, contentProps: a, ...o }) {
128
+ return /* @__PURE__ */ O(L.Root, {
249
129
  openDelay: 0,
250
130
  closeDelay: 0,
251
- ...a,
252
- onOpenChange: (e) => n?.(e.open),
253
- children: /* @__PURE__ */ g("span", {
254
- className: L("dds-tooltip", r),
255
- children: [typeof t == "function" ? /* @__PURE__ */ h(E.Context, { children: (e) => t(e.getTriggerProps()) }) : /* @__PURE__ */ h(E.Trigger, {
131
+ ...o,
132
+ onOpenChange: (e) => r?.(e.open),
133
+ children: /* @__PURE__ */ k("span", {
134
+ className: t("dds-tooltip", i),
135
+ children: [typeof n == "function" ? /* @__PURE__ */ O(L.Context, { children: (e) => n(e.getTriggerProps()) }) : /* @__PURE__ */ O(L.Trigger, {
256
136
  asChild: !0,
257
- children: t
258
- }), /* @__PURE__ */ h(D, { children: /* @__PURE__ */ h(E.Positioner, { children: /* @__PURE__ */ h(E.Content, {
259
- ...i,
260
- className: L("dds-tooltip__bubble", i?.className),
137
+ children: n
138
+ }), /* @__PURE__ */ O(R, { children: /* @__PURE__ */ O(L.Positioner, { children: /* @__PURE__ */ O(L.Content, {
139
+ ...a,
140
+ className: t("dds-tooltip__bubble", a?.className),
261
141
  children: e
262
142
  }) }) })]
263
143
  })
@@ -265,71 +145,71 @@ function se({ content: e, children: t, onOpenChange: n, className: r, contentPro
265
145
  }
266
146
  //#endregion
267
147
  //#region src/icon.tsx
268
- var ce = t(function({ name: e, label: t, size: n = 24, directional: r, className: i, ...a }, o) {
269
- let s = k[e];
270
- return /* @__PURE__ */ g("svg", {
271
- ...a,
272
- ref: o,
273
- viewBox: s.viewBox,
274
- width: n,
275
- height: n,
148
+ var Q = _(function({ name: e, label: n, size: r = 24, directional: i, className: a, ...o }, s) {
149
+ let c = B[e];
150
+ return /* @__PURE__ */ k("svg", {
151
+ ...o,
152
+ ref: s,
153
+ viewBox: c.viewBox,
154
+ width: r,
155
+ height: r,
276
156
  fill: "none",
277
157
  stroke: "currentColor",
278
- strokeWidth: s.strokeWidth,
158
+ strokeWidth: c.strokeWidth,
279
159
  strokeLinecap: "round",
280
160
  strokeLinejoin: "round",
281
- role: t ? "img" : void 0,
282
- "aria-label": t,
283
- "aria-hidden": !t || void 0,
284
- className: L((r ?? O.mirrorInRtl.includes(e)) && O.cssClass, i),
285
- children: [t && /* @__PURE__ */ h("title", { children: t }), /* @__PURE__ */ h("g", { dangerouslySetInnerHTML: { __html: s.body } })]
161
+ role: n ? "img" : void 0,
162
+ "aria-label": n,
163
+ "aria-hidden": !n || void 0,
164
+ className: t((i ?? z.mirrorInRtl.includes(e)) && z.cssClass, a),
165
+ children: [n && /* @__PURE__ */ O("title", { children: n }), /* @__PURE__ */ O("g", { dangerouslySetInnerHTML: { __html: c.body } })]
286
166
  });
287
- }), K = e(null);
288
- function le({ children: e, defaultDuration: t = 5e3, dismissLabel: n, regionLabel: s, className: c }) {
289
- let l = i(), u = o(0), d = a(() => N({
167
+ }), $ = g(null);
168
+ function ie({ children: e, defaultDuration: n = 5e3, dismissLabel: r, regionLabel: i, className: a }) {
169
+ let o = b(), s = S(0), c = x(() => W({
290
170
  placement: "bottom-end",
291
171
  overlap: !1,
292
172
  gap: 8,
293
173
  offsets: "var(--dds-space-16)",
294
174
  removeDelay: 0,
295
175
  hotkey: ["DDS_NO_HOTKEY"]
296
- }), []), f = a(() => ({
176
+ }), []), l = x(() => ({
297
177
  show(e) {
298
- let n = `dds-toast-${l}-${++u.current}`, r = e.duration ?? t;
299
- return d.create({
300
- id: n,
178
+ let t = `dds-toast-${o}-${++s.current}`, r = e.duration ?? n;
179
+ return c.create({
180
+ id: t,
301
181
  description: e.message,
302
182
  type: e.tone === "danger" ? "error" : e.tone ?? "info",
303
183
  duration: r > 0 ? r : Infinity,
304
184
  meta: { dds: {
305
185
  ...e,
306
- id: n
186
+ id: t
307
187
  } }
308
- }), n;
188
+ }), t;
309
189
  },
310
- dismiss: (e) => d.remove(e),
311
- clear: () => d.remove()
190
+ dismiss: (e) => c.remove(e),
191
+ clear: () => c.remove()
312
192
  }), [
313
- d,
314
- l,
315
- t
193
+ c,
194
+ o,
195
+ n
316
196
  ]);
317
- return r(() => () => d.remove(), [d]), /* @__PURE__ */ g(K.Provider, {
318
- value: f,
319
- children: [e, /* @__PURE__ */ h(M, {
320
- toaster: d,
321
- label: s ?? "",
322
- "aria-label": s ?? "",
323
- role: s ? "region" : "presentation",
324
- className: L("dds-toast-region", c),
197
+ return y(() => () => c.remove(), [c]), /* @__PURE__ */ k($.Provider, {
198
+ value: l,
199
+ children: [e, /* @__PURE__ */ O(U, {
200
+ toaster: c,
201
+ label: i ?? "",
202
+ "aria-label": i ?? "",
203
+ role: i ? "region" : "presentation",
204
+ className: t("dds-toast-region", a),
325
205
  children: (e) => {
326
- let t = e.meta?.dds;
327
- return /* @__PURE__ */ g(A.Root, {
328
- className: L("dds-toast", `dds-toast--${t.tone ?? "info"}`),
329
- role: t.tone === "danger" ? "alert" : "status",
330
- children: [/* @__PURE__ */ h(A.Description, { children: e.description }), n && /* @__PURE__ */ h(A.CloseTrigger, {
206
+ let n = e.meta?.dds;
207
+ return /* @__PURE__ */ k(V.Root, {
208
+ className: t("dds-toast", `dds-toast--${n.tone ?? "info"}`),
209
+ role: n.tone === "danger" ? "alert" : "status",
210
+ children: [/* @__PURE__ */ O(V.Description, { children: e.description }), r && /* @__PURE__ */ O(V.CloseTrigger, {
331
211
  className: "dds-iconbtn dds-iconbtn--sm",
332
- "aria-label": typeof n == "function" ? n(t) : n,
212
+ "aria-label": typeof r == "function" ? r(n) : r,
333
213
  children: "×"
334
214
  })]
335
215
  });
@@ -337,392 +217,137 @@ function le({ children: e, defaultDuration: t = 5e3, dismissLabel: n, regionLabe
337
217
  })]
338
218
  });
339
219
  }
340
- function ue() {
341
- let e = n(K);
220
+ function ae() {
221
+ let e = v($);
342
222
  if (!e) throw Error("useToast must be called inside <ToastProvider>");
343
223
  return e;
344
224
  }
345
225
  //#endregion
346
226
  //#region src/console-shell.tsx
347
- function de(e, t) {
227
+ function oe(e, t) {
348
228
  return t.active ?? (t.href.split("/").filter(Boolean).length <= 1 ? e === t.href : e === t.href || e.startsWith(`${t.href}/`));
349
229
  }
350
- var fe = t(function({ surface: e, activePath: t, brand: n, context: a, nav: o, labels: c, header: l, foot: u, children: d, className: f, ...p }, m) {
351
- let [_, v] = s(!1), [y, b] = s(!1), x = i(), S = `dds-console-rail-${x}`, C = `dds-console-main-${x}`;
352
- return r(() => {
353
- b(!0);
230
+ var se = _(function({ surface: e, activePath: n, brand: r, context: i, nav: a, labels: o, header: s, foot: c, children: l, className: u, ...d }, f) {
231
+ let [p, m] = C(!1), [h, g] = C(!1), _ = b(), v = `dds-console-rail-${_}`, x = `dds-console-main-${_}`;
232
+ return y(() => {
233
+ g(!0);
354
234
  let e = (e) => {
355
- e.key === "Escape" && v(!1);
235
+ e.key === "Escape" && m(!1);
356
236
  };
357
237
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
358
- }, []), /* @__PURE__ */ g("div", {
359
- ...p,
360
- ref: m,
361
- className: L("dds-console-shell", f),
238
+ }, []), /* @__PURE__ */ k("div", {
239
+ ...d,
240
+ ref: f,
241
+ className: t("dds-console-shell", u),
362
242
  "data-surface": e,
363
- "data-hydrated": y ? "true" : void 0,
243
+ "data-hydrated": h ? "true" : void 0,
364
244
  children: [
365
- /* @__PURE__ */ h("a", {
245
+ /* @__PURE__ */ O("a", {
366
246
  className: "dds-console-skip dds-visually-hidden",
367
- href: `#${C}`,
368
- children: c.skip
247
+ href: `#${x}`,
248
+ children: o.skip
369
249
  }),
370
- /* @__PURE__ */ g("button", {
250
+ /* @__PURE__ */ k("button", {
371
251
  className: "dds-console-rail__toggle",
372
252
  type: "button",
373
253
  "data-action": "toggle-rail",
374
- "aria-controls": S,
375
- "aria-expanded": _,
376
- onClick: () => v(!_),
377
- children: [/* @__PURE__ */ h("span", { "aria-hidden": !0 }), /* @__PURE__ */ h("span", {
254
+ "aria-controls": v,
255
+ "aria-expanded": p,
256
+ onClick: () => m(!p),
257
+ children: [/* @__PURE__ */ O("span", { "aria-hidden": !0 }), /* @__PURE__ */ O("span", {
378
258
  className: "dds-visually-hidden",
379
- children: _ ? c.menuClose : c.menuOpen
259
+ children: p ? o.menuClose : o.menuOpen
380
260
  })]
381
261
  }),
382
- /* @__PURE__ */ h("div", {
262
+ /* @__PURE__ */ O("div", {
383
263
  className: "dds-console-rail__scrim",
384
- "data-open": String(_),
385
- onClick: () => v(!1)
264
+ "data-open": String(p),
265
+ onClick: () => m(!1)
386
266
  }),
387
- /* @__PURE__ */ g("aside", {
388
- id: S,
267
+ /* @__PURE__ */ k("aside", {
268
+ id: v,
389
269
  className: "dds-console-rail",
390
- "data-open": String(_),
270
+ "data-open": String(p),
391
271
  children: [
392
- /* @__PURE__ */ g("a", {
272
+ /* @__PURE__ */ k("a", {
393
273
  className: "dds-console-rail__brand",
394
- href: n.href,
395
- children: [/* @__PURE__ */ h("img", {
396
- src: n.mark,
274
+ href: r.href,
275
+ children: [/* @__PURE__ */ O("img", {
276
+ src: r.mark,
397
277
  alt: "",
398
278
  width: 20,
399
279
  height: 20
400
- }), /* @__PURE__ */ h("strong", { children: n.name })]
280
+ }), /* @__PURE__ */ O("strong", { children: r.name })]
401
281
  }),
402
- a && a.length > 0 && /* @__PURE__ */ h("dl", {
282
+ i && i.length > 0 && /* @__PURE__ */ O("dl", {
403
283
  className: "dds-console-rail__context",
404
- children: a.map((e, t) => /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ h("dt", { children: e.label }), /* @__PURE__ */ h("dd", { children: e.value })] }, t))
284
+ children: i.map((e, t) => /* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("dt", { children: e.label }), /* @__PURE__ */ O("dd", { children: e.value })] }, t))
405
285
  }),
406
- /* @__PURE__ */ h("nav", {
286
+ /* @__PURE__ */ O("nav", {
407
287
  className: "dds-console-rail__nav",
408
- "aria-label": c.nav,
409
- children: o.map((n, r) => /* @__PURE__ */ g("section", {
288
+ "aria-label": o.nav,
289
+ children: a.map((t, r) => /* @__PURE__ */ k("section", {
410
290
  className: "dds-console-rail__group",
411
- "aria-labelledby": `${x}-group-${r}`,
412
- children: [/* @__PURE__ */ h("h2", {
413
- id: `${x}-group-${r}`,
291
+ "aria-labelledby": `${_}-group-${r}`,
292
+ children: [/* @__PURE__ */ O("h2", {
293
+ id: `${_}-group-${r}`,
414
294
  className: "dds-console-rail__group-label",
415
- children: n.label
416
- }), /* @__PURE__ */ h("ul", { children: n.items.map((n) => /* @__PURE__ */ h("li", { children: /* @__PURE__ */ g("a", {
295
+ children: t.label
296
+ }), /* @__PURE__ */ O("ul", { children: t.items.map((t) => /* @__PURE__ */ O("li", { children: /* @__PURE__ */ k("a", {
417
297
  className: "dds-console-rail__item",
418
- "data-nav": `${e}.${n.id}`,
419
- href: n.href,
420
- "aria-current": de(t, n) ? "page" : void 0,
421
- onClick: () => v(!1),
422
- children: [/* @__PURE__ */ h("span", { children: n.label }), n.badge !== void 0 && n.badge > 0 && /* @__PURE__ */ h("span", {
298
+ "data-nav": `${e}.${t.id}`,
299
+ href: t.href,
300
+ "aria-current": oe(n, t) ? "page" : void 0,
301
+ onClick: () => m(!1),
302
+ children: [/* @__PURE__ */ O("span", { children: t.label }), t.badge !== void 0 && t.badge > 0 && /* @__PURE__ */ O("span", {
423
303
  className: "dds-console-rail__badge",
424
- "aria-label": c.badge.replace("{count}", () => String(n.badge)),
425
- children: n.badge
304
+ "aria-label": o.badge.replace("{count}", () => String(t.badge)),
305
+ children: t.badge
426
306
  })]
427
- }) }, n.id)) })]
307
+ }) }, t.id)) })]
428
308
  }, r))
429
309
  }),
430
- u && /* @__PURE__ */ h("div", {
310
+ c && /* @__PURE__ */ O("div", {
431
311
  className: "dds-console-rail__foot",
432
- children: u
312
+ children: c
433
313
  })
434
314
  ]
435
315
  }),
436
- /* @__PURE__ */ g("main", {
437
- id: C,
316
+ /* @__PURE__ */ k("main", {
317
+ id: x,
438
318
  className: "dds-console-main",
439
319
  tabIndex: -1,
440
- children: [/* @__PURE__ */ g("header", {
320
+ children: [/* @__PURE__ */ k("header", {
441
321
  className: "dds-console-page-header",
442
- children: [/* @__PURE__ */ g("div", {
322
+ children: [/* @__PURE__ */ k("div", {
443
323
  className: "dds-console-page-header__text",
444
- children: [l.eyebrow && /* @__PURE__ */ h("p", {
324
+ children: [s.eyebrow && /* @__PURE__ */ O("p", {
445
325
  className: "dds-console-page-eyebrow",
446
- children: l.eyebrow
447
- }), /* @__PURE__ */ h("h1", { children: l.title })]
448
- }), l.actions && /* @__PURE__ */ h("div", {
326
+ children: s.eyebrow
327
+ }), /* @__PURE__ */ O("h1", { children: s.title })]
328
+ }), s.actions && /* @__PURE__ */ O("div", {
449
329
  className: "dds-console-page-header__actions",
450
- children: l.actions
330
+ children: s.actions
451
331
  })]
452
- }), d]
332
+ }), l]
453
333
  })
454
334
  ]
455
335
  });
456
336
  });
457
337
  //#endregion
458
- //#region src/date-picker.tsx
459
- function pe() {
460
- return /* @__PURE__ */ g("svg", {
461
- width: "20",
462
- height: "20",
463
- viewBox: "0 0 24 24",
464
- fill: "none",
465
- stroke: "currentColor",
466
- strokeWidth: "1.5",
467
- "aria-hidden": "true",
468
- children: [/* @__PURE__ */ h("rect", {
469
- x: "3.5",
470
- y: "5.5",
471
- width: "17",
472
- height: "15",
473
- rx: "2"
474
- }), /* @__PURE__ */ h("path", { d: "M7.5 3v5M16.5 3v5M3.5 10.5h17" })]
475
- });
476
- }
477
- function q({ next: e = !1 }) {
478
- return /* @__PURE__ */ h("svg", {
479
- width: "18",
480
- height: "18",
481
- viewBox: "0 0 24 24",
482
- fill: "none",
483
- stroke: "currentColor",
484
- strokeWidth: "1.5",
485
- "aria-hidden": "true",
486
- children: /* @__PURE__ */ h("path", { d: e ? "m9 5 7 7-7 7" : "m15 5-7 7 7 7" })
487
- });
488
- }
489
- function J(e) {
490
- if (!/^\d{4}-\d{2}-\d{2}$/.test(e)) return !1;
491
- let t = Number(e.slice(0, 4)), n = Number(e.slice(5, 7)), r = Number(e.slice(8, 10));
492
- return t < 1 || n < 1 || n > 12 || r < 1 ? !1 : r <= [
493
- 31,
494
- t % 4 == 0 && (t % 100 != 0 || t % 400 == 0) ? 29 : 28,
495
- 31,
496
- 30,
497
- 31,
498
- 30,
499
- 31,
500
- 31,
501
- 30,
502
- 31,
503
- 30,
504
- 31
505
- ][n - 1];
506
- }
507
- function Y(e) {
508
- return /^ko(?:-|$)/i.test(e);
509
- }
510
- function X(e, t) {
511
- return Y(t) && J(e) ? e.replaceAll("-", "/") : e;
512
- }
513
- function Z(e, t) {
514
- return Y(t) && /^\d{4}\/\d{2}\/\d{2}$/.test(e) ? e.replaceAll("/", "-") : e;
515
- }
516
- function Q(e, t, n, r, i = "en-US") {
517
- let a = Z(e, i), o = e.length < 10 && (/^\d{0,4}(?:-\d{0,2}(?:-\d{0,2})?)?$/.test(e) || Y(i) && /^\d{0,4}(?:\/\d{0,2}(?:\/\d{0,2})?)?$/.test(e)), s = "valid";
518
- return e === "" ? s = t ? "required" : "valid" : J(a) ? n && !J(n) || r && !J(r) || n && r && n > r ? s = "invalid" : n && a < n ? s = "rangeUnderflow" : r && a > r && (s = "rangeOverflow") : s = o ? "incomplete" : "invalid", {
519
- inputValue: e,
520
- value: s === "valid" ? a : null,
521
- valid: s === "valid",
522
- reason: s
523
- };
524
- }
525
- function $(e) {
526
- return J(e) ? [I(e)] : [];
527
- }
528
- function me({ label: e, value: t, onChange: n, locale: i = "ko-KR", timeZone: a = "Asia/Seoul", disabled: c = !1, readOnly: l = !1, required: u = !1, onValidityChange: d, min: f, max: p }) {
529
- let [_, v] = s(() => X(t, i)), [y, b] = s(() => $(t)), [x, S] = s(!1), C = o(null), w = o(!1), T = o(t), E = o(i), O = o([]), k = o(t), A = o(""), j = Z(_, E.current), M = E.current !== i && J(j) ? X(j, i) : _, N = Q(M, u, f, p, i), P = N.valid ? void 0 : i.toLowerCase().startsWith("ko") ? N.reason === "required" ? "날짜를 입력해 주세요." : "YYYY/MM/DD 형식의 유효한 범위 내 날짜를 입력해 주세요." : N.reason === "required" ? "Enter a date." : "Enter a valid date within the allowed range (YYYY-MM-DD).";
530
- r(() => {
531
- let e = E.current;
532
- if (E.current = i, T.current === t) {
533
- e !== i && v(M);
534
- return;
535
- }
536
- T.current = t;
537
- let n = O.current.indexOf(t);
538
- if (n !== -1) {
539
- O.current.splice(n, 1);
540
- return;
541
- }
542
- O.current = [], k.current = t, v(X(t, i)), (t === "" || J(t)) && b($(t));
543
- }, [t, i]), r(() => {
544
- C.current?.setCustomValidity(P ?? "");
545
- let e = JSON.stringify(N);
546
- d && A.current !== e && (A.current = e, d(N));
547
- }, [
548
- _,
549
- u,
550
- f,
551
- p,
552
- i,
553
- P,
554
- d
555
- ]), r(() => {
556
- (c || l) && (w.current = !1, S(!1));
557
- }, [c, l]), r(() => {
558
- if (!w.current || c || l) return;
559
- let e = requestAnimationFrame(() => {
560
- w.current = !1, C.current?.focus({ preventScroll: !0 });
561
- });
562
- return () => cancelAnimationFrame(e);
563
- }, [
564
- x,
565
- y,
566
- c,
567
- l
568
- ]);
569
- function L(e) {
570
- let t = Q(e, u, f, p, i);
571
- if (e !== "" && !t.valid) return;
572
- let r = e === "" ? "" : t.value;
573
- b($(r)), r !== k.current && (k.current = r, O.current.push(r), n(r));
574
- }
575
- function z(e) {
576
- v(e);
577
- let t = Q(e, u, f, p, i);
578
- C.current?.setCustomValidity(t.valid ? "" : P ?? "Enter a valid date (YYYY-MM-DD)."), (e === "" || t.valid) && (v(X(t.value ?? "", i)), L(e));
579
- }
580
- return /* @__PURE__ */ h(B, {
581
- label: e,
582
- required: u,
583
- error: P,
584
- children: (t) => /* @__PURE__ */ g(F.Root, {
585
- locale: i,
586
- timeZone: a,
587
- disabled: c,
588
- readOnly: l,
589
- required: u,
590
- invalid: !N.valid,
591
- open: x && !c && !l,
592
- onOpenChange: (e) => S(e.open && !c && !l),
593
- min: f && J(f) ? I(f) : void 0,
594
- max: p && J(p) ? I(p) : void 0,
595
- startOfWeek: 0,
596
- minView: "day",
597
- maxView: "day",
598
- fixedWeeks: !0,
599
- translations: {
600
- dayCell: (e) => `${e.valueText} 선택`,
601
- clearTrigger: "선택 날짜 지우기"
602
- },
603
- value: y,
604
- format: (e) => X(e.toString(), i),
605
- onValueChange: (e) => {
606
- let t = e.value[0]?.toString() || "";
607
- t !== "" && !Q(t, u, f, p, i).valid || (w.current = !0, v(X(t, i)), L(t));
608
- },
609
- positioning: {
610
- placement: "bottom-start",
611
- gutter: 8
612
- },
613
- children: [/* @__PURE__ */ g(F.Control, {
614
- className: "dds-date-picker-control",
615
- children: [/* @__PURE__ */ h("input", {
616
- ...t,
617
- ref: C,
618
- type: "text",
619
- value: M,
620
- onChange: () => {},
621
- required: u,
622
- readOnly: l,
623
- disabled: c,
624
- placeholder: Y(i) ? "YYYY/MM/DD" : "YYYY-MM-DD",
625
- autoComplete: "off",
626
- autoCorrect: "off",
627
- spellCheck: !1,
628
- onInputCapture: (e) => {
629
- c || l || (e.stopPropagation(), z(e.currentTarget.value));
630
- },
631
- onBlur: () => {
632
- !c && !l && L(M);
633
- },
634
- onKeyDownCapture: (e) => {
635
- e.key === "Enter" && !e.nativeEvent.isComposing && (e.preventDefault(), e.stopPropagation(), !c && !l && L(M));
636
- }
637
- }), /* @__PURE__ */ h(F.Trigger, {
638
- asChild: !0,
639
- children: /* @__PURE__ */ h(R, {
640
- type: "button",
641
- tone: "secondary",
642
- "aria-label": `${e} 달력 열기`,
643
- children: /* @__PURE__ */ h(pe, {})
644
- })
645
- })]
646
- }), /* @__PURE__ */ h(D, { children: /* @__PURE__ */ h(F.Positioner, {
647
- className: "dds-date-picker-positioner",
648
- children: /* @__PURE__ */ h(F.Content, {
649
- className: "dds-date-picker-content",
650
- "aria-label": `${e} 날짜 선택`,
651
- children: /* @__PURE__ */ h(F.View, {
652
- view: "day",
653
- children: /* @__PURE__ */ h(F.Context, { children: (e) => /* @__PURE__ */ g(m, { children: [
654
- /* @__PURE__ */ g(F.ViewControl, {
655
- className: "dds-date-picker-header",
656
- children: [
657
- /* @__PURE__ */ h(F.PrevTrigger, {
658
- asChild: !0,
659
- children: /* @__PURE__ */ h(R, {
660
- type: "button",
661
- tone: "secondary",
662
- "aria-label": "이전 달",
663
- children: /* @__PURE__ */ h(q, {})
664
- })
665
- }),
666
- /* @__PURE__ */ h(F.RangeText, {}),
667
- /* @__PURE__ */ h(F.NextTrigger, {
668
- asChild: !0,
669
- children: /* @__PURE__ */ h(R, {
670
- type: "button",
671
- tone: "secondary",
672
- "aria-label": "다음 달",
673
- children: /* @__PURE__ */ h(q, { next: !0 })
674
- })
675
- })
676
- ]
677
- }),
678
- /* @__PURE__ */ g(F.Table, {
679
- className: "dds-date-picker-table",
680
- children: [/* @__PURE__ */ h(F.TableHead, { children: /* @__PURE__ */ h(F.TableRow, { children: e.weekDays.map((e, t) => /* @__PURE__ */ h(F.TableHeader, { children: e.short }, t)) }) }), /* @__PURE__ */ h(F.TableBody, { children: e.weeks.map((e, t) => /* @__PURE__ */ h(F.TableRow, { children: e.map((e) => /* @__PURE__ */ h(F.TableCell, {
681
- value: e,
682
- children: /* @__PURE__ */ h(F.TableCellTrigger, { children: e.day })
683
- }, e.toString())) }, t)) })]
684
- }),
685
- /* @__PURE__ */ g("div", {
686
- className: "dds-date-picker-footer",
687
- children: [/* @__PURE__ */ h(R, {
688
- type: "button",
689
- tone: "secondary",
690
- onClick: () => e.selectToday(),
691
- children: "오늘"
692
- }), /* @__PURE__ */ h(F.ClearTrigger, {
693
- hidden: !1,
694
- asChild: !0,
695
- children: /* @__PURE__ */ h(R, {
696
- type: "button",
697
- tone: "secondary",
698
- onClick: () => {
699
- !c && !l && (v(""), L(""));
700
- },
701
- children: "지우기"
702
- })
703
- })]
704
- })
705
- ] }) })
706
- })
707
- })
708
- }) })]
709
- })
710
- });
711
- }
712
- //#endregion
713
338
  //#region src/status-pill.tsx
714
- function he(e) {
339
+ function ce(e) {
715
340
  let t = new Set(e.openDomains ?? []);
716
341
  return function(n) {
717
342
  let r = e.tones[n.domain]?.[n.value], i = e.label(n.domain, n.value, n.locale);
718
343
  if (!r || !i) {
719
- if (t.has(n.domain)) return /* @__PURE__ */ h("code", {
344
+ if (t.has(n.domain)) return /* @__PURE__ */ O("code", {
720
345
  "data-status": `${n.domain}.${n.value}`,
721
346
  children: n.value
722
347
  });
723
348
  throw Error(r ? `StatusPill: no label for ${n.domain}.${n.value}` : `StatusPill: no tone for ${n.domain}.${n.value}`);
724
349
  }
725
- return /* @__PURE__ */ h("span", {
350
+ return /* @__PURE__ */ O("span", {
726
351
  className: r === "neutral" ? "dds-badge" : `dds-badge dds-badge--${r}`,
727
352
  "data-status": `${n.domain}.${n.value}`,
728
353
  "data-tone": r,
@@ -731,6 +356,6 @@ function he(e) {
731
356
  };
732
357
  }
733
358
  //#endregion
734
- export { u as ArkCheckbox, P as ArkDatePicker, C as ArkDialog, c as ArkField, b as ArkRadioGroup, f as ArkSwitch, _ as ArkTabs, j as ArkToast, T as ArkTooltip, R as Button, U as Checkbox, fe as ConsoleShell, me as DatePicker, oe as Dialog, B as Field, ce as Icon, z as IconButton, G as Radio, ae as RadioGroup, V as Select, W as Switch, ne as Tab, te as TabList, re as TabPanel, ee as Tabs, le as ToastProvider, se as Tooltip, L as classes, he as createStatusPill, ue as useToast };
359
+ export { T as ArkCheckbox, G as ArkDatePicker, P as ArkDialog, w as ArkField, te as ArkRadioGroup, E as ArkSwitch, A as ArkTabs, H as ArkToast, I as ArkTooltip, s as Button, h as Calendar, r as Checkbox, d as Combobox, se as ConsoleShell, c as DatePicker, ne as Dialog, p as DropdownMenu, a as Field, Q as Icon, n as IconButton, l as Input, u as InputGroup, m as Popover, e as Radio, Z as RadioGroup, i as Select, f as SelectPicker, o as Switch, J as Tab, q as TabList, Y as TabPanel, K as Tabs, ie as ToastProvider, re as Tooltip, t as classes, ce as createStatusPill, ae as useToast };
735
360
 
736
361
  //# sourceMappingURL=index.js.map