@devslab/dds-solid 0.17.0 → 0.18.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.
package/dist/index.js CHANGED
@@ -1,27 +1,40 @@
1
- import { For as e, Show as t, createContext as n, createEffect as r, createSignal as i, createUniqueId as a, onCleanup as o, onMount as s, splitProps as c, useContext as l } from "solid-js";
2
- import { className as u, createComponent as d, delegateEvents as f, effect as p, getNextElement as m, getNextMarker as h, insert as g, memo as _, mergeProps as v, runHydrationEvents as y, setAttribute as b, setProperty as x, spread as S, template as C, use as w } from "solid-js/web";
3
- import { directionPolicy as T, icons as E } from "@devslab/dds-icons";
1
+ import { For as e, Show as t, createContext as n, createEffect as r, createMemo as i, createSignal as a, createUniqueId as o, mergeProps as s, onCleanup as c, onMount as l, splitProps as u, useContext as d } from "solid-js";
2
+ import { Dynamic as f, Portal as p, className as m, createComponent as h, delegateEvents as g, effect as _, getNextElement as v, getNextMarker as y, insert as b, isServer as x, memo as S, mergeProps as C, runHydrationEvents as w, setAttribute as T, setProperty as E, spread as D, template as O, use as k } from "solid-js/web";
3
+ import { useCheckbox as A } from "@ark-ui/solid/checkbox";
4
+ import { useSwitch as j } from "@ark-ui/solid/switch";
5
+ import { Field as M } from "@ark-ui/solid/field";
6
+ import { Dialog as N, useDialog as P } from "@ark-ui/solid/dialog";
7
+ import { usePresenceContext as F } from "@ark-ui/solid/presence";
8
+ import { FocusTrap as I } from "@zag-js/focus-trap";
9
+ import { ariaHidden as L } from "@zag-js/aria-hidden";
10
+ import { RadioGroup as R } from "@ark-ui/solid/radio-group";
11
+ import { directionPolicy as z, icons as B } from "@devslab/dds-icons";
12
+ import { Tabs as V, useTabsContext as H } from "@ark-ui/solid/tabs";
13
+ import { LocaleProvider as U } from "@ark-ui/solid/locale";
14
+ import { Toast as W, Toaster as ee, createToaster as te } from "@ark-ui/solid/toast";
15
+ import { space as ne } from "@devslab/dds-tokens";
16
+ import { Tooltip as G, useTooltip as re } from "@ark-ui/solid/tooltip";
4
17
  //#region src/controllable.ts
5
- function D(e) {
6
- let [t, n] = i(e.defaultValue), r = () => e.value() ?? t(), a = n;
18
+ function K(e) {
19
+ let [t, n] = a(e.defaultValue), r = () => e.value() ?? t(), i = n;
7
20
  return [r, (t) => {
8
21
  let n = typeof t == "function" ? t(r()) : t;
9
- return e.value() === void 0 && a(() => n), e.onChange?.(n), n;
22
+ return e.value() === void 0 && i(() => n), e.onChange?.(n), n;
10
23
  }];
11
24
  }
12
25
  //#endregion
13
26
  //#region src/utils.ts
14
- function O(...e) {
27
+ function q(...e) {
15
28
  return e.filter(Boolean).join(" ");
16
29
  }
17
- function k(...e) {
30
+ function ie(...e) {
18
31
  return e.filter(Boolean).join(" ") || void 0;
19
32
  }
20
33
  //#endregion
21
34
  //#region src/controls.tsx
22
- var A = /*#__PURE__*/ C("<button><!$><!/><!$><!/>"), j = /*#__PURE__*/ C("<span class=dds-spinner aria-hidden=true>"), M = /*#__PURE__*/ C("<button>"), N = /*#__PURE__*/ C("<div><label class=dds-field__label><!$><!/><!$><!/></label><!$><!/><!$><!/><!$><!/>"), P = /*#__PURE__*/ C("<span aria-hidden=true> *"), F = /*#__PURE__*/ C("<div class=dds-field__help>"), I = /*#__PURE__*/ C("<div class=dds-field__error role=alert>"), L = /*#__PURE__*/ C("<span><select>"), R = /*#__PURE__*/ C("<label><input><span>");
23
- function z(e) {
24
- let [t, n] = c(e, [
35
+ var ae = /*#__PURE__*/ O("<button><!$><!/><!$><!/>"), J = /*#__PURE__*/ O("<span class=dds-spinner aria-hidden=true>"), oe = /*#__PURE__*/ O("<button>"), se = /*#__PURE__*/ O("<span aria-hidden=true> *"), ce = /*#__PURE__*/ O("<span><select>"), Y = /*#__PURE__*/ O("<label><input><span>");
36
+ function le(e) {
37
+ let [t, n] = u(e, [
25
38
  "class",
26
39
  "tone",
27
40
  "size",
@@ -31,13 +44,13 @@ function z(e) {
31
44
  "children"
32
45
  ]);
33
46
  return (() => {
34
- var e = m(A), r = e.firstChild, [i, a] = h(r.nextSibling), o = i.nextSibling, [s, c] = h(o.nextSibling);
35
- return S(e, v(n, {
47
+ var e = v(ae), r = e.firstChild, [i, a] = y(r.nextSibling), o = i.nextSibling, [s, c] = y(o.nextSibling);
48
+ return D(e, C(n, {
36
49
  get type() {
37
50
  return t.type ?? "button";
38
51
  },
39
52
  get class() {
40
- return O("dds-btn", `dds-btn--${t.tone ?? "primary"}`, t.size !== "md" && t.size ? `dds-btn--${t.size}` : void 0, t.class);
53
+ return q("dds-btn", `dds-btn--${t.tone ?? "primary"}`, t.size !== "md" && t.size ? `dds-btn--${t.size}` : void 0, t.class);
41
54
  },
42
55
  get disabled() {
43
56
  return t.disabled || t.loading;
@@ -45,14 +58,14 @@ function z(e) {
45
58
  get "aria-busy"() {
46
59
  return t.loading ? "true" : void 0;
47
60
  }
48
- }), !1, !0), g(e, (() => {
49
- var e = _(() => !!t.loading);
50
- return () => e() && m(j);
51
- })(), i, a), g(e, () => t.children, s, c), y(), e;
61
+ }), !1, !0), b(e, (() => {
62
+ var e = S(() => !!t.loading);
63
+ return () => e() && v(J);
64
+ })(), i, a), b(e, () => t.children, s, c), w(), e;
52
65
  })();
53
66
  }
54
- function B(e) {
55
- let [t, n] = c(e, [
67
+ function ue(e) {
68
+ let [t, n] = u(e, [
56
69
  "class",
57
70
  "tone",
58
71
  "size",
@@ -62,13 +75,13 @@ function B(e) {
62
75
  "children"
63
76
  ]);
64
77
  return (() => {
65
- var e = m(M);
66
- return S(e, v(n, {
78
+ var e = v(oe);
79
+ return D(e, C(n, {
67
80
  get type() {
68
81
  return t.type ?? "button";
69
82
  },
70
83
  get class() {
71
- return O("dds-iconbtn", t.tone && t.tone !== "ghost" ? `dds-iconbtn--${t.tone}` : void 0, t.size !== "md" && t.size ? `dds-iconbtn--${t.size}` : void 0, t.class);
84
+ return q("dds-iconbtn", t.tone && t.tone !== "ghost" ? `dds-iconbtn--${t.tone}` : void 0, t.size !== "md" && t.size ? `dds-iconbtn--${t.size}` : void 0, t.class);
72
85
  },
73
86
  get disabled() {
74
87
  return t.disabled || t.loading;
@@ -76,66 +89,86 @@ function B(e) {
76
89
  get "aria-busy"() {
77
90
  return t.loading ? "true" : void 0;
78
91
  }
79
- }), !1, !0), g(e, (() => {
80
- var e = _(() => !!t.loading);
81
- return () => e() ? m(j) : t.children;
82
- })()), y(), e;
92
+ }), !1, !0), b(e, (() => {
93
+ var e = S(() => !!t.loading);
94
+ return () => e() ? v(J) : t.children;
95
+ })()), w(), e;
83
96
  })();
84
97
  }
85
- function V(e) {
86
- let t = a(), n = () => e.id ?? `dds-field-${t}`, r = () => e.helpText ? `${n()}-help` : void 0, i = () => e.error ? `${n()}-error` : void 0, o = () => ({
98
+ function de(e) {
99
+ let t = o(), n = () => e.id ?? `dds-field-${t}`, r = () => e.helpText ? `${n()}-help` : void 0, i = () => e.error ? `${n()}-error` : void 0, a = () => ({
87
100
  id: n(),
88
- "aria-describedby": k(r(), i()),
101
+ "aria-describedby": ie(r(), i()),
89
102
  "aria-invalid": e.error ? "true" : void 0,
90
103
  "aria-required": e.required ? "true" : void 0
91
104
  });
92
- return (() => {
93
- var t = m(N), a = t.firstChild, s = a.firstChild, [c, l] = h(s.nextSibling), d = c.nextSibling, [f, v] = h(d.nextSibling), y = a.nextSibling, [x, S] = h(y.nextSibling), C = x.nextSibling, [w, T] = h(C.nextSibling), E = w.nextSibling, [D, k] = h(E.nextSibling);
94
- return g(a, () => e.label, c, l), g(a, (() => {
95
- var t = _(() => !!e.required);
96
- return () => t() && m(P);
97
- })(), f, v), g(t, (() => {
98
- var t = _(() => typeof e.children == "function");
99
- return () => t() ? e.children(o()) : e.children;
100
- })(), x, S), g(t, (() => {
101
- var t = _(() => !!e.helpText);
102
- return () => t() && (() => {
103
- var t = m(F);
104
- return g(t, () => e.helpText), p(() => b(t, "id", r())), t;
105
- })();
106
- })(), w, T), g(t, (() => {
107
- var t = _(() => !!e.error);
108
- return () => t() && (() => {
109
- var t = m(I);
110
- return g(t, () => e.error), p(() => b(t, "id", i())), t;
111
- })();
112
- })(), D, k), p((r) => {
113
- var i = O("dds-field", e.error ? "dds-field--error" : void 0, e.class), o = n();
114
- return i !== r.e && u(t, r.e = i), o !== r.t && b(a, "for", r.t = o), r;
115
- }, {
116
- e: void 0,
117
- t: void 0
118
- }), t;
119
- })();
105
+ return h(M.Root, {
106
+ get id() {
107
+ return n();
108
+ },
109
+ get required() {
110
+ return e.required ?? !1;
111
+ },
112
+ get invalid() {
113
+ return !!e.error;
114
+ },
115
+ get ids() {
116
+ return {
117
+ control: `${n()}-root`,
118
+ helperText: `${n()}-help`,
119
+ errorText: `${n()}-error`
120
+ };
121
+ },
122
+ get class() {
123
+ return q("dds-field", e.error ? "dds-field--error" : void 0, e.class);
124
+ },
125
+ get children() {
126
+ return [
127
+ h(M.Label, {
128
+ class: "dds-field__label",
129
+ get for() {
130
+ return n();
131
+ },
132
+ get children() {
133
+ return [S(() => e.label), S(() => S(() => !!e.required)() && v(se))];
134
+ }
135
+ }),
136
+ S(() => S(() => typeof e.children == "function")() ? e.children(a()) : e.children),
137
+ S(() => S(() => !!e.helpText)() && h(M.HelperText, {
138
+ class: "dds-field__help",
139
+ get children() {
140
+ return e.helpText;
141
+ }
142
+ })),
143
+ S(() => S(() => !!e.error)() && h(M.ErrorText, {
144
+ class: "dds-field__error",
145
+ role: "alert",
146
+ get children() {
147
+ return e.error;
148
+ }
149
+ }))
150
+ ];
151
+ }
152
+ });
120
153
  }
121
- function H(e) {
122
- let [t, n] = c(e, [
154
+ function fe(e) {
155
+ let [t, n] = u(e, [
123
156
  "class",
124
157
  "invalid",
125
158
  "children"
126
159
  ]);
127
160
  return (() => {
128
- var e = m(L), r = e.firstChild;
129
- return S(r, v(n, {
161
+ var e = v(ce), r = e.firstChild;
162
+ return D(r, C(n, {
130
163
  class: "dds-select__input",
131
164
  get "aria-invalid"() {
132
165
  return t.invalid ? "true" : void 0;
133
166
  }
134
- }), !1, !0), g(r, () => t.children), p(() => u(e, O("dds-select", t.class))), y(), e;
167
+ }), !1, !0), b(r, () => t.children), _(() => m(e, q("dds-select", t.class))), w(), e;
135
168
  })();
136
169
  }
137
- function U(e) {
138
- let [t, n] = c(e, [
170
+ function pe(e) {
171
+ let [t, n] = u(e, [
139
172
  "checked",
140
173
  "defaultChecked",
141
174
  "onCheckedChange",
@@ -144,14 +177,14 @@ function U(e) {
144
177
  "inputClass",
145
178
  "type",
146
179
  "role"
147
- ]), [r, i] = D({
180
+ ]), [r, i] = K({
148
181
  value: () => t.checked,
149
182
  defaultValue: t.defaultChecked ?? !1,
150
183
  onChange: t.onCheckedChange
151
184
  });
152
185
  return (() => {
153
- var e = m(R), a = e.firstChild, o = a.nextSibling;
154
- return S(a, v(n, {
186
+ var e = v(Y), a = e.firstChild, o = a.nextSibling;
187
+ return D(a, C(n, {
155
188
  get type() {
156
189
  return t.type;
157
190
  },
@@ -159,115 +192,183 @@ function U(e) {
159
192
  return t.role;
160
193
  },
161
194
  get class() {
162
- return O(t.role === "switch" ? "dds-switch__input" : "dds-check__input", t.inputClass);
195
+ return q(t.role === "switch" ? "dds-switch__input" : "dds-check__input", t.inputClass);
163
196
  },
164
197
  get checked() {
165
198
  return r();
166
199
  },
167
200
  onChange: (e) => i(e.currentTarget.checked)
168
- }), !1, !1), g(o, () => t.label), p(() => u(e, O(t.role === "switch" ? "dds-switch" : "dds-check", t.class))), y(), e;
201
+ }), !1, !1), b(o, () => t.label), _(() => m(e, q(t.role === "switch" ? "dds-switch" : "dds-check", t.class))), w(), e;
202
+ })();
203
+ }
204
+ var me = (e) => h(X, C(e, { kind: "checkbox" })), he = (e) => h(pe, C(e, { type: "radio" })), ge = (e) => h(X, C(e, { kind: "switch" }));
205
+ function X(e) {
206
+ let t = o(), [n, r] = u(e, [
207
+ "checked",
208
+ "defaultChecked",
209
+ "onCheckedChange",
210
+ "label",
211
+ "class",
212
+ "inputClass",
213
+ "kind",
214
+ "id",
215
+ "onClick",
216
+ "onFocusIn",
217
+ "onFocusOut",
218
+ "style"
219
+ ]), i = () => ({
220
+ id: `dds-check-${t}`,
221
+ ids: { hiddenInput: n.id ?? `dds-check-${t}-input` },
222
+ checked: n.checked,
223
+ defaultChecked: n.defaultChecked,
224
+ onCheckedChange: (e) => n.onCheckedChange?.(e.checked === !0),
225
+ disabled: r.disabled,
226
+ required: r.required,
227
+ readOnly: r.readonly,
228
+ name: r.name,
229
+ form: r.form,
230
+ value: String(r.value ?? "on")
231
+ }), a = n.kind === "switch" ? j(i) : A(i), s = () => n.kind === "switch" ? "dds-switch__input" : "dds-check__input", c = () => {
232
+ let [, e] = u(a().getRootProps(), ["onClick"]);
233
+ return e;
234
+ };
235
+ return (() => {
236
+ var e = v(Y), t = e.firstChild, i = t.nextSibling;
237
+ return D(e, C(c, { get class() {
238
+ return q(n.kind === "switch" ? "dds-switch" : "dds-check", n.class);
239
+ } }), !1, !0), k((e) => {
240
+ e.defaultChecked = n.checked ?? n.defaultChecked ?? !1, typeof r.ref == "function" && r.ref(e);
241
+ }, t), D(t, C(() => a().getHiddenInputProps(), r, {
242
+ type: "checkbox",
243
+ get role() {
244
+ return n.kind === "switch" ? "switch" : void 0;
245
+ },
246
+ get class() {
247
+ return q(s(), n.inputClass);
248
+ },
249
+ get style() {
250
+ return n.style ?? {};
251
+ },
252
+ get checked() {
253
+ return a().checked;
254
+ },
255
+ onFocusIn: (e) => {
256
+ Z(a().getHiddenInputProps().onFocusIn, e), Z(n.onFocusIn, e);
257
+ },
258
+ onFocusOut: (e) => {
259
+ Z(a().getHiddenInputProps().onFocusOut, e), Z(n.onFocusOut, e);
260
+ },
261
+ onClick: (e) => {
262
+ if (typeof n.onClick == "function" ? n.onClick(e) : n.onClick && n.onClick[0](n.onClick[1], e), !e.defaultPrevented) {
263
+ let t = a().getHiddenInputProps().onClick;
264
+ typeof t == "function" ? t(e) : t && t[0](t[1], e);
265
+ }
266
+ }
267
+ }), !1, !1), D(i, C(() => a().getLabelProps()), !1, !0), b(i, () => n.label), w(), e;
169
268
  })();
170
269
  }
171
- var W = (e) => d(U, v(e, { type: "checkbox" })), ee = (e) => d(U, v(e, { type: "radio" })), te = (e) => d(U, v(e, {
172
- type: "checkbox",
173
- role: "switch"
174
- })), ne = /*#__PURE__*/ C("<dl class=dds-console-rail__context>"), re = /*#__PURE__*/ C("<div class=dds-console-rail__foot>"), ie = /*#__PURE__*/ C("<p class=dds-console-page-eyebrow>"), ae = /*#__PURE__*/ C("<div class=dds-console-page-header__actions>"), oe = /*#__PURE__*/ C("<div class=dds-console-shell><a class=\"dds-console-skip dds-visually-hidden\"href=#dds-console-main></a><button class=dds-console-rail__toggle type=button data-action=toggle-rail aria-controls=dds-console-rail><span aria-hidden=true></span><span class=dds-visually-hidden></span></button><div class=dds-console-rail__scrim></div><aside id=dds-console-rail class=dds-console-rail><a class=dds-console-rail__brand><img alt width=20 height=20><strong></strong></a><!$><!/><nav class=dds-console-rail__nav></nav><!$><!/></aside><main id=dds-console-main class=dds-console-main tabindex=-1><header class=dds-console-page-header><div class=dds-console-page-header__text><!$><!/><h1></h1></div><!$><!/></header><!$><!/>"), G = /*#__PURE__*/ C("<div><dt></dt><dd>"), K = /*#__PURE__*/ C("<section class=dds-console-rail__group><h2 class=dds-console-rail__group-label></h2><ul>"), q = /*#__PURE__*/ C("<span class=dds-console-rail__badge>"), se = /*#__PURE__*/ C("<li><a class=dds-console-rail__item><span></span><!$><!/>");
175
- function ce(e, t, n) {
270
+ function Z(e, t) {
271
+ typeof e == "function" ? e(t) : e && e[0](e[1], t);
272
+ }
273
+ //#endregion
274
+ //#region src/console-shell.tsx
275
+ var _e = /*#__PURE__*/ O("<dl class=dds-console-rail__context>"), ve = /*#__PURE__*/ O("<div class=dds-console-rail__foot>"), ye = /*#__PURE__*/ O("<p class=dds-console-page-eyebrow>"), be = /*#__PURE__*/ O("<div class=dds-console-page-header__actions>"), xe = /*#__PURE__*/ O("<div class=dds-console-shell><a class=\"dds-console-skip dds-visually-hidden\"href=#dds-console-main></a><button class=dds-console-rail__toggle type=button data-action=toggle-rail aria-controls=dds-console-rail><span aria-hidden=true></span><span class=dds-visually-hidden></span></button><div class=dds-console-rail__scrim></div><aside id=dds-console-rail class=dds-console-rail><a class=dds-console-rail__brand><img alt width=20 height=20><strong></strong></a><!$><!/><nav class=dds-console-rail__nav></nav><!$><!/></aside><main id=dds-console-main class=dds-console-main tabindex=-1><header class=dds-console-page-header><div class=dds-console-page-header__text><!$><!/><h1></h1></div><!$><!/></header><!$><!/>"), Se = /*#__PURE__*/ O("<div><dt></dt><dd>"), Ce = /*#__PURE__*/ O("<section class=dds-console-rail__group><h2 class=dds-console-rail__group-label></h2><ul>"), we = /*#__PURE__*/ O("<span class=dds-console-rail__badge>"), Te = /*#__PURE__*/ O("<li><a class=dds-console-rail__item><span></span><!$><!/>");
276
+ function Ee(e, t, n) {
176
277
  return n === void 0 ? t.split("/").filter(Boolean).length <= 1 ? e === t : e === t || e.startsWith(`${t}/`) : n;
177
278
  }
178
- function le(e, t) {
279
+ function De(e, t) {
179
280
  return e.replace("{count}", () => String(t));
180
281
  }
181
- function ue(n) {
182
- let [r, c] = i(!1), l = () => c(!1), [u, f] = i(!1);
183
- return s(() => {
184
- f(!0);
282
+ function Oe(n) {
283
+ let [r, i] = a(!1), s = () => i(!1), [u, d] = a(!1);
284
+ return l(() => {
285
+ d(!0);
185
286
  let e = (e) => {
186
- e.key === "Escape" && l();
287
+ e.key === "Escape" && s();
187
288
  };
188
- document.addEventListener("keydown", e), o(() => document.removeEventListener("keydown", e));
289
+ document.addEventListener("keydown", e), c(() => document.removeEventListener("keydown", e));
189
290
  }), (() => {
190
- var i = m(oe), o = i.firstChild, s = o.nextSibling, f = s.firstChild.nextSibling, v = s.nextSibling, x = v.nextSibling, S = x.firstChild, C = S.firstChild, w = C.nextSibling, T = S.nextSibling, [E, D] = h(T.nextSibling), O = E.nextSibling, k = O.nextSibling, [A, j] = h(k.nextSibling), M = x.nextSibling, N = M.firstChild, P = N.firstChild, F = P.firstChild, [I, L] = h(F.nextSibling), R = I.nextSibling, z = P.nextSibling, [B, V] = h(z.nextSibling), H = N.nextSibling, [U, W] = h(H.nextSibling);
191
- return g(o, () => n.labels.skip), s.$$click = () => c(!r()), g(f, (() => {
192
- var e = _(() => !!r());
291
+ var a = v(xe), c = a.firstChild, l = c.nextSibling, d = l.firstChild.nextSibling, f = l.nextSibling, p = f.nextSibling, m = p.firstChild, g = m.firstChild, x = g.nextSibling, C = m.nextSibling, [E, D] = y(C.nextSibling), O = E.nextSibling, k = O.nextSibling, [A, j] = y(k.nextSibling), M = p.nextSibling, N = M.firstChild, P = N.firstChild, F = P.firstChild, [I, L] = y(F.nextSibling), R = I.nextSibling, z = P.nextSibling, [B, V] = y(z.nextSibling), H = N.nextSibling, [U, W] = y(H.nextSibling);
292
+ return b(c, () => n.labels.skip), l.$$click = () => i(!r()), b(d, (() => {
293
+ var e = S(() => !!r());
193
294
  return () => e() ? n.labels.menuClose : n.labels.menuOpen;
194
- })()), v.$$click = l, g(w, () => n.brand.name), g(x, d(t, {
295
+ })()), f.$$click = s, b(x, () => n.brand.name), b(p, h(t, {
195
296
  get when() {
196
- return _(() => !!n.context)() && n.context.length > 0;
297
+ return S(() => !!n.context)() && n.context.length > 0;
197
298
  },
198
299
  get children() {
199
- var t = m(ne);
200
- return g(t, d(e, {
300
+ var t = v(_e);
301
+ return b(t, h(e, {
201
302
  get each() {
202
303
  return n.context;
203
304
  },
204
305
  children: (e) => (() => {
205
- var t = m(G), n = t.firstChild, r = n.nextSibling;
206
- return g(n, () => e.label), g(r, () => e.value), t;
306
+ var t = v(Se), n = t.firstChild, r = n.nextSibling;
307
+ return b(n, () => e.label), b(r, () => e.value), t;
207
308
  })()
208
309
  })), t;
209
310
  }
210
- }), E, D), g(O, d(e, {
311
+ }), E, D), b(O, h(e, {
211
312
  get each() {
212
313
  return n.nav;
213
314
  },
214
315
  children: (r) => {
215
- let i = `dds-console-group-${a()}`;
316
+ let i = `dds-console-group-${o()}`;
216
317
  return (() => {
217
- var a = m(K), o = a.firstChild, s = o.nextSibling;
218
- return b(a, "aria-labelledby", i), b(o, "id", i), g(o, () => r.label), g(s, d(e, {
318
+ var a = v(Ce), o = a.firstChild, c = o.nextSibling;
319
+ return T(a, "aria-labelledby", i), T(o, "id", i), b(o, () => r.label), b(c, h(e, {
219
320
  get each() {
220
321
  return r.items;
221
322
  },
222
323
  children: (e) => (() => {
223
- var r = m(se), i = r.firstChild, a = i.firstChild, o = a.nextSibling, [s, c] = h(o.nextSibling);
224
- return i.$$click = l, g(a, () => e.label), g(i, d(t, {
324
+ var r = v(Te), i = r.firstChild, a = i.firstChild, o = a.nextSibling, [c, l] = y(o.nextSibling);
325
+ return i.$$click = s, b(a, () => e.label), b(i, h(t, {
225
326
  get when() {
226
- return _(() => e.badge !== void 0)() && e.badge > 0;
327
+ return S(() => e.badge !== void 0)() && e.badge > 0;
227
328
  },
228
329
  get children() {
229
- var t = m(q);
230
- return g(t, () => e.badge), p(() => b(t, "aria-label", le(n.labels.badge, e.badge))), t;
330
+ var t = v(we);
331
+ return b(t, () => e.badge), _(() => T(t, "aria-label", De(n.labels.badge, e.badge))), t;
231
332
  }
232
- }), s, c), p((t) => {
233
- var r = `${n.surface}.${e.id}`, a = e.href, o = ce(n.activePath, e.href, e.active) ? "page" : void 0;
234
- return r !== t.e && b(i, "data-nav", t.e = r), a !== t.t && b(i, "href", t.t = a), o !== t.a && b(i, "aria-current", t.a = o), t;
333
+ }), c, l), _((t) => {
334
+ var r = `${n.surface}.${e.id}`, a = e.href, o = Ee(n.activePath, e.href, e.active) ? "page" : void 0;
335
+ return r !== t.e && T(i, "data-nav", t.e = r), a !== t.t && T(i, "href", t.t = a), o !== t.a && T(i, "aria-current", t.a = o), t;
235
336
  }, {
236
337
  e: void 0,
237
338
  t: void 0,
238
339
  a: void 0
239
- }), y(), r;
340
+ }), w(), r;
240
341
  })()
241
342
  })), a;
242
343
  })();
243
344
  }
244
- })), g(x, d(t, {
345
+ })), b(p, h(t, {
245
346
  get when() {
246
347
  return n.foot;
247
348
  },
248
349
  get children() {
249
- var e = m(re);
250
- return g(e, () => n.foot), e;
350
+ var e = v(ve);
351
+ return b(e, () => n.foot), e;
251
352
  }
252
- }), A, j), g(P, d(t, {
353
+ }), A, j), b(P, h(t, {
253
354
  get when() {
254
355
  return n.header.eyebrow;
255
356
  },
256
357
  get children() {
257
- var e = m(ie);
258
- return g(e, () => n.header.eyebrow), e;
358
+ var e = v(ye);
359
+ return b(e, () => n.header.eyebrow), e;
259
360
  }
260
- }), I, L), g(R, () => n.header.title), g(N, d(t, {
361
+ }), I, L), b(R, () => n.header.title), b(N, h(t, {
261
362
  get when() {
262
363
  return n.header.actions;
263
364
  },
264
365
  get children() {
265
- var e = m(ae);
266
- return g(e, () => n.header.actions), e;
366
+ var e = v(be);
367
+ return b(e, () => n.header.actions), e;
267
368
  }
268
- }), B, V), g(M, () => n.children, U, W), p((e) => {
269
- var t = n.surface, a = u() ? "true" : void 0, o = r(), c = r() ? "true" : "false", l = r() ? "true" : "false", d = n.brand.href, f = n.brand.mark, p = n.labels.nav;
270
- return t !== e.e && b(i, "data-surface", e.e = t), a !== e.t && b(i, "data-hydrated", e.t = a), o !== e.a && b(s, "aria-expanded", e.a = o), c !== e.o && b(v, "data-open", e.o = c), l !== e.i && b(x, "data-open", e.i = l), d !== e.n && b(S, "href", e.n = d), f !== e.s && b(C, "src", e.s = f), p !== e.h && b(O, "aria-label", e.h = p), e;
369
+ }), B, V), b(M, () => n.children, U, W), _((e) => {
370
+ var t = n.surface, i = u() ? "true" : void 0, o = r(), s = r() ? "true" : "false", c = r() ? "true" : "false", d = n.brand.href, h = n.brand.mark, _ = n.labels.nav;
371
+ return t !== e.e && T(a, "data-surface", e.e = t), i !== e.t && T(a, "data-hydrated", e.t = i), o !== e.a && T(l, "aria-expanded", e.a = o), s !== e.o && T(f, "data-open", e.o = s), c !== e.i && T(p, "data-open", e.i = c), d !== e.n && T(m, "href", e.n = d), h !== e.s && T(g, "src", e.s = h), _ !== e.h && T(O, "aria-label", e.h = _), e;
271
372
  }, {
272
373
  e: void 0,
273
374
  t: void 0,
@@ -277,13 +378,14 @@ function ue(n) {
277
378
  n: void 0,
278
379
  s: void 0,
279
380
  h: void 0
280
- }), y(), i;
381
+ }), w(), a;
281
382
  })();
282
383
  }
283
- f(["click"]);
384
+ g(["click"]);
284
385
  //#endregion
285
386
  //#region src/dialog.tsx
286
- var de = /*#__PURE__*/ C("<div class=dds-dialog-overlay><div role=dialog aria-modal=true tabindex=-1><h2 class=dds-dialog__title></h2><!$><!/><!$><!/><!$><!/>"), fe = /*#__PURE__*/ C("<div class=dds-dialog__body>"), pe = /*#__PURE__*/ C("<div class=dds-dialog__actions>"), J = [
387
+ var ke = /*#__PURE__*/ O("<div>");
388
+ [
287
389
  "a[href]",
288
390
  "button:not([disabled])",
289
391
  "input:not([disabled])",
@@ -291,86 +393,222 @@ var de = /*#__PURE__*/ C("<div class=dds-dialog-overlay><div role=dialog aria-mo
291
393
  "textarea:not([disabled])",
292
394
  "[tabindex]:not([tabindex='-1'])"
293
395
  ].join(",");
294
- function me(e) {
295
- let n = a(), i = () => e.id ?? `dds-dialog-${n}`, s = () => `${i()}-title`, c = () => e.description ? `${i()}-description` : void 0, [l, f] = D({
296
- value: () => e.open,
297
- defaultValue: e.defaultOpen ?? !1,
298
- onChange: e.onOpenChange
299
- }), v, x = null;
300
- return r(() => {
301
- if (!l()) return;
302
- x = document.activeElement instanceof HTMLElement ? document.activeElement : null, queueMicrotask(() => {
303
- (v?.querySelector(J) ?? v)?.focus();
396
+ function Ae(e) {
397
+ let n = o(), s = () => e.id ?? `dds-dialog-${n}`, [l, u] = a(), d = P(() => ({
398
+ id: s(),
399
+ open: e.open,
400
+ defaultOpen: e.defaultOpen,
401
+ onOpenChange: (t) => e.onOpenChange?.(t.open),
402
+ closeOnEscape: e.closeOnEscape ?? !0,
403
+ closeOnInteractOutside: e.closeOnOutside ?? !0,
404
+ onEscapeKeyDown: e.onEscapeKeyDown,
405
+ initialFocusEl: () => e.initialFocus?.() ?? null,
406
+ finalFocusEl: () => e.finalFocus?.() ?? null,
407
+ restoreFocus: e.restoreFocus ?? !0,
408
+ modal: !e.additionalFocusContainers,
409
+ trapFocus: !e.additionalFocusContainers,
410
+ preventScroll: !0,
411
+ role: e.role ?? "dialog",
412
+ persistentElements: x ? [] : e.additionalFocusContainers?.().filter((e) => !!e).map((e) => () => e),
413
+ ids: {
414
+ content: s(),
415
+ title: `${s()}-title`,
416
+ description: `${s()}-description`
417
+ }
418
+ })), g = i(() => d().open);
419
+ r(() => {
420
+ let t = l();
421
+ if (!g() || !e.additionalFocusContainers || !t) return;
422
+ let n = t.ownerDocument.activeElement, i, o, [s, u] = a(!1), d = () => [t, ...e.additionalFocusContainers().filter((e) => !!(e?.isConnected && e.ownerDocument === t.ownerDocument))], f = t.ownerDocument.defaultView.requestAnimationFrame(() => {
423
+ i = new I(d(), {
424
+ document: t.ownerDocument,
425
+ escapeDeactivates: !1,
426
+ allowOutsideClick: !0,
427
+ preventScroll: !0,
428
+ delayInitialFocus: !1,
429
+ fallbackFocus: t,
430
+ getShadowRoot: !0,
431
+ initialFocus: () => e.initialFocus?.() ?? void 0,
432
+ setReturnFocus: () => e.finalFocus?.() ?? (n instanceof HTMLElement && n.isConnected ? n : !1)
433
+ }), u(!0), i.activate();
304
434
  });
305
- let t = (t) => {
306
- if (t.key === "Escape" && e.closeOnEscape !== !1) {
307
- t.preventDefault(), f(!1);
308
- return;
309
- }
310
- if (t.key !== "Tab" || !v) return;
311
- let n = [...v.querySelectorAll(J)].filter((e) => !e.hidden && e.getAttribute("aria-hidden") !== "true");
312
- if (n.length === 0) {
313
- t.preventDefault(), v.focus();
314
- return;
435
+ r(() => {
436
+ if (!s()) return;
437
+ let e = d();
438
+ i.updateContainerElements(e), o?.(), o = L(e, { defer: !1 });
439
+ }), c(() => {
440
+ t.ownerDocument.defaultView.cancelAnimationFrame(f), o?.(), i?.deactivate({ returnFocus: e.restoreFocus !== !1 });
441
+ });
442
+ });
443
+ let y = (t, n) => q(e.unstyled ? void 0 : t, n), w = () => {
444
+ let t = F(), n = (n) => h(f, C({ get component() {
445
+ return e.contentAs ?? "div";
446
+ } }, () => n({}), { ref: (e) => {
447
+ t().ref(e), u(e);
448
+ } }));
449
+ return h(N.Positioner, {
450
+ get class() {
451
+ return y("dds-dialog-overlay", e.overlayClass);
452
+ },
453
+ get children() {
454
+ return h(N.Content, C(() => e.contentProps, {
455
+ ref: u,
456
+ get class() {
457
+ return y("dds-dialog", e.class);
458
+ }
459
+ }, () => e.contentAs ? { asChild: n } : {}, {
460
+ get role() {
461
+ return e.role ?? "dialog";
462
+ },
463
+ "aria-modal": "true",
464
+ get "aria-describedby"() {
465
+ return S(() => !!e.description)() ? `${s()}-description` : void 0;
466
+ },
467
+ get children() {
468
+ return (() => {
469
+ let t = {
470
+ get title() {
471
+ return h(N.Title, {
472
+ get class() {
473
+ return y("dds-dialog__title", e.titleClass);
474
+ },
475
+ get children() {
476
+ return e.title;
477
+ }
478
+ });
479
+ },
480
+ get description() {
481
+ return e.description && h(N.Description, {
482
+ get class() {
483
+ return y("dds-dialog__body", e.descriptionClass);
484
+ },
485
+ get children() {
486
+ return e.description;
487
+ }
488
+ });
489
+ },
490
+ get children() {
491
+ return e.children;
492
+ },
493
+ get actions() {
494
+ return e.actions && (() => {
495
+ var t = v(ke);
496
+ return b(t, () => e.actions), _(() => m(t, y("dds-dialog__actions", e.actionsClass))), t;
497
+ })();
498
+ }
499
+ };
500
+ return e.frame ? e.frame(t) : [
501
+ S(() => t.title),
502
+ S(() => t.description),
503
+ S(() => t.children),
504
+ S(() => t.actions)
505
+ ];
506
+ })();
507
+ }
508
+ }));
315
509
  }
316
- let r = n[0], i = n[n.length - 1];
317
- t.shiftKey && document.activeElement === r ? (t.preventDefault(), i.focus()) : !t.shiftKey && document.activeElement === i && (t.preventDefault(), r.focus());
318
- };
319
- document.addEventListener("keydown", t), o(() => {
320
- document.removeEventListener("keydown", t), queueMicrotask(() => x?.focus());
321
510
  });
322
- }), d(t, {
323
- get when() {
324
- return l();
511
+ };
512
+ return h(N.RootProvider, {
513
+ value: d,
514
+ lazyMount: !0,
515
+ unmountOnExit: !0,
516
+ get children() {
517
+ return h(t, {
518
+ get when() {
519
+ return e.portal;
520
+ },
521
+ get fallback() {
522
+ return h(w, {});
523
+ },
524
+ get children() {
525
+ return h(p, C(() => e.portalMount ? { mount: e.portalMount } : {}, { get children() {
526
+ return h(w, {});
527
+ } }));
528
+ }
529
+ });
530
+ }
531
+ });
532
+ }
533
+ //#endregion
534
+ //#region src/radio-group.tsx
535
+ function je(t) {
536
+ let n = t.value ?? t.defaultValue;
537
+ return h(R.Root, {
538
+ get value() {
539
+ return t.value;
540
+ },
541
+ get defaultValue() {
542
+ return t.defaultValue;
543
+ },
544
+ get name() {
545
+ return t.name;
546
+ },
547
+ get form() {
548
+ return t.form;
549
+ },
550
+ get disabled() {
551
+ return t.disabled;
552
+ },
553
+ get required() {
554
+ return t.required;
555
+ },
556
+ onValueChange: (e) => {
557
+ e.value !== null && t.onValueChange?.(e.value);
558
+ },
559
+ get class() {
560
+ return q("dds-radio-group", t.class);
325
561
  },
326
562
  get children() {
327
- var t = m(de), n = t.firstChild, r = n.firstChild, a = r.nextSibling, [o, l] = h(a.nextSibling), d = o.nextSibling, [x, S] = h(d.nextSibling), C = x.nextSibling, [T, E] = h(C.nextSibling);
328
- t.$$pointerdown = (t) => {
329
- t.target === t.currentTarget && e.closeOnOutside !== !1 && f(!1);
330
- };
331
- var D = v;
332
- return typeof D == "function" ? w(D, n) : v = n, g(r, () => e.title), g(n, (() => {
333
- var t = _(() => !!e.description);
334
- return () => t() && (() => {
335
- var t = m(fe);
336
- return g(t, () => e.description), p(() => b(t, "id", c())), t;
337
- })();
338
- })(), o, l), g(n, () => e.children, x, S), g(n, (() => {
339
- var t = _(() => !!e.actions);
340
- return () => t() && (() => {
341
- var t = m(pe);
342
- return g(t, () => e.actions), t;
343
- })();
344
- })(), T, E), p((t) => {
345
- var a = i(), o = O("dds-dialog", e.class), l = s(), d = k(c()), f = s();
346
- return a !== t.e && b(n, "id", t.e = a), o !== t.t && u(n, t.t = o), l !== t.a && b(n, "aria-labelledby", t.a = l), d !== t.o && b(n, "aria-describedby", t.o = d), f !== t.i && b(r, "id", t.i = f), t;
347
- }, {
348
- e: void 0,
349
- t: void 0,
350
- a: void 0,
351
- o: void 0,
352
- i: void 0
353
- }), y(), t;
563
+ return [h(R.Label, {
564
+ class: "dds-field__label",
565
+ get children() {
566
+ return t.label;
567
+ }
568
+ }), h(e, {
569
+ get each() {
570
+ return t.options;
571
+ },
572
+ children: (e) => h(R.Item, {
573
+ get value() {
574
+ return e.value;
575
+ },
576
+ get disabled() {
577
+ return e.disabled;
578
+ },
579
+ class: "dds-check",
580
+ get children() {
581
+ return [h(R.ItemHiddenInput, {
582
+ class: "dds-check__input",
583
+ style: {},
584
+ ref: (t) => {
585
+ t.defaultChecked = n === e.value;
586
+ }
587
+ }), h(R.ItemText, { get children() {
588
+ return e.label;
589
+ } })];
590
+ }
591
+ })
592
+ })];
354
593
  }
355
594
  });
356
595
  }
357
- f(["pointerdown"]);
358
596
  //#endregion
359
597
  //#region src/icon.tsx
360
- var he = /*#__PURE__*/ C("<svg><!$><!/><g>"), ge = /*#__PURE__*/ C("<title>");
361
- function Y(e) {
362
- let [t, n] = c(e, [
598
+ var Me = /*#__PURE__*/ O("<svg><!$><!/><g>"), Ne = /*#__PURE__*/ O("<title>");
599
+ function Pe(e) {
600
+ let [t, n] = u(e, [
363
601
  "name",
364
602
  "label",
365
603
  "size",
366
604
  "directional",
367
605
  "class"
368
- ]), r = () => E[t.name], i = () => t.directional ?? T.mirrorInRtl.includes(t.name);
606
+ ]), r = () => B[t.name], i = () => t.directional ?? z.mirrorInRtl.includes(t.name);
369
607
  return (() => {
370
- var e = m(he), a = e.firstChild, [o, s] = h(a.nextSibling), c = o.nextSibling;
371
- return S(e, v(n, {
608
+ var e = v(Me), a = e.firstChild, [o, s] = y(a.nextSibling), c = o.nextSibling;
609
+ return D(e, C(n, {
372
610
  get class() {
373
- return O(i() && T.cssClass, t.class);
611
+ return q(i() && z.cssClass, t.class);
374
612
  },
375
613
  get viewBox() {
376
614
  return r().viewBox;
@@ -397,19 +635,19 @@ function Y(e) {
397
635
  get "aria-hidden"() {
398
636
  return t.label ? void 0 : "true";
399
637
  }
400
- }), !0, !0), g(e, (() => {
401
- var e = _(() => !!t.label);
638
+ }), !0, !0), b(e, (() => {
639
+ var e = S(() => !!t.label);
402
640
  return () => e() && (() => {
403
- var e = m(ge);
404
- return g(e, () => t.label), e;
641
+ var e = v(Ne);
642
+ return b(e, () => t.label), e;
405
643
  })();
406
- })(), o, s), p(() => x(c, "innerHTML", r().body)), y(), e;
644
+ })(), o, s), _(() => E(c, "innerHTML", r().body)), w(), e;
407
645
  })();
408
646
  }
409
647
  //#endregion
410
648
  //#region src/status-pill.tsx
411
- var _e = /*#__PURE__*/ C("<code>"), ve = /*#__PURE__*/ C("<span>");
412
- function ye(e) {
649
+ var Fe = /*#__PURE__*/ O("<code>"), Q = /*#__PURE__*/ O("<span>");
650
+ function Ie(e) {
413
651
  let n = new Set(e.openDomains ?? []);
414
652
  return function(r) {
415
653
  let i = () => e.tones[r.domain]?.[r.value], a = () => e.label(r.domain, r.value, r.locale), o = () => !!(i() && a()), s = () => {
@@ -422,24 +660,24 @@ function ye(e) {
422
660
  text: t
423
661
  };
424
662
  };
425
- return d(t, {
663
+ return h(t, {
426
664
  get when() {
427
665
  return o() || !n.has(r.domain);
428
666
  },
429
667
  get fallback() {
430
668
  return (() => {
431
- var e = m(_e);
432
- return g(e, () => r.value), p(() => b(e, "data-status", `${r.domain}.${r.value}`)), e;
669
+ var e = v(Fe);
670
+ return b(e, () => r.value), _(() => T(e, "data-status", `${r.domain}.${r.value}`)), e;
433
671
  })();
434
672
  },
435
673
  get children() {
436
674
  return (() => {
437
675
  let e = s();
438
676
  return (() => {
439
- var t = m(ve);
440
- return g(t, () => e.text), p((n) => {
677
+ var t = v(Q);
678
+ return b(t, () => e.text), _((n) => {
441
679
  var i = e.tone === "neutral" ? "dds-badge" : `dds-badge dds-badge--${e.tone}`, a = `${r.domain}.${r.value}`, o = e.tone;
442
- return i !== n.e && u(t, n.e = i), a !== n.t && b(t, "data-status", n.t = a), o !== n.a && b(t, "data-tone", n.a = o), n;
680
+ return i !== n.e && m(t, n.e = i), a !== n.t && T(t, "data-status", n.t = a), o !== n.a && T(t, "data-tone", n.a = o), n;
443
681
  }, {
444
682
  e: void 0,
445
683
  t: void 0,
@@ -452,230 +690,261 @@ function ye(e) {
452
690
  };
453
691
  }
454
692
  //#endregion
693
+ //#region src/direction.ts
694
+ function Le(e, t) {
695
+ let [n, r] = a("ltr");
696
+ return l(() => {
697
+ let t = e()?.parentElement;
698
+ if (!t) return;
699
+ let n = () => r(getComputedStyle(t).direction === "rtl" ? "rtl" : "ltr");
700
+ n();
701
+ let i = new MutationObserver(n);
702
+ i.observe(t.ownerDocument.documentElement, {
703
+ attributes: !0,
704
+ subtree: !0,
705
+ attributeFilter: ["dir"]
706
+ }), c(() => i.disconnect());
707
+ }), () => t() ?? n();
708
+ }
709
+ //#endregion
455
710
  //#region src/tabs.tsx
456
- var X = /*#__PURE__*/ C("<div>"), be = /*#__PURE__*/ C("<button>"), Z = n(), Q = () => {
457
- let e = l(Z);
458
- if (!e) throw Error("Tab components must be rendered inside <Tabs>");
459
- return e;
460
- };
461
- function xe(e) {
462
- let t = a(), n = () => e.id ?? `dds-tabs-${t}`, [r, i] = D({
463
- value: () => e.value,
464
- defaultValue: e.defaultValue,
465
- onChange: e.onValueChange
466
- }), o = [], s = {
467
- value: r,
468
- setValue: i,
469
- orientation: e.orientation ?? "horizontal",
470
- register(e) {
471
- return o.push(e), () => {
472
- let t = o.indexOf(e);
473
- t >= 0 && o.splice(t, 1);
474
- };
711
+ function Re(e) {
712
+ let t = o(), n = () => e.id ?? `dds-tabs-${t}`, r, i = Le(() => r, () => e.dir), a = e.asChild ? (t) => e.asChild(s(t({}), { ref: (e) => {
713
+ r = e;
714
+ } })) : void 0;
715
+ return h(U, {
716
+ get locale() {
717
+ return i() === "rtl" ? "ar" : "en";
475
718
  },
476
- tabs: () => o,
477
- tabId: (e) => `${n()}-tab-${e}`,
478
- panelId: (e) => `${n()}-panel-${e}`
479
- };
480
- return d(Z.Provider, {
481
- value: s,
482
719
  get children() {
483
- return e.children;
720
+ return h(V.Root, C({
721
+ ref(e) {
722
+ var t = r;
723
+ typeof t == "function" ? t(e) : r = e;
724
+ },
725
+ get id() {
726
+ return n();
727
+ },
728
+ get value() {
729
+ return e.value;
730
+ },
731
+ get defaultValue() {
732
+ return e.defaultValue;
733
+ },
734
+ get orientation() {
735
+ return e.orientation ?? "horizontal";
736
+ },
737
+ get activationMode() {
738
+ return e.activationMode ?? "automatic";
739
+ },
740
+ onValueChange: (t) => e.onValueChange?.(t.value),
741
+ lazyMount: !1,
742
+ unmountOnExit: !1,
743
+ get class() {
744
+ return e.unstyled ? void 0 : "dds-tabs-root";
745
+ }
746
+ }, a ? { asChild: a } : {}, {
747
+ ids: {
748
+ trigger: (t) => e.tabId?.(t) ?? `${n()}-tab-${t}`,
749
+ content: (t) => e.panelId?.(t) ?? `${n()}-panel-${t}`
750
+ },
751
+ get children() {
752
+ return e.children;
753
+ }
754
+ }));
484
755
  }
485
756
  });
486
757
  }
487
- function Se(e) {
488
- let t = Q(), [n, r] = c(e, [
758
+ function ze(e) {
759
+ let [t, n] = u(e, [
489
760
  "class",
490
761
  "children",
491
- "onKeyDown"
492
- ]), i = (e) => {
493
- if (typeof n.onKeyDown == "function" && n.onKeyDown(e), e.defaultPrevented) return;
494
- let r = t.tabs().filter((e) => !e.disabled);
495
- if (!r.length) return;
496
- let i = r.findIndex((e) => e.element === document.activeElement), a = i, o = document.documentElement.dir === "rtl";
497
- if (e.key === "Home") a = 0;
498
- else if (e.key === "End") a = r.length - 1;
499
- else if (e.key === "ArrowRight" && t.orientation === "horizontal") a = (i + (o ? -1 : 1) + r.length) % r.length;
500
- else if (e.key === "ArrowLeft" && t.orientation === "horizontal") a = (i + (o ? 1 : -1) + r.length) % r.length;
501
- else if (e.key === "ArrowDown" && t.orientation === "vertical") a = (i + 1) % r.length;
502
- else if (e.key === "ArrowUp" && t.orientation === "vertical") a = (i - 1 + r.length) % r.length;
503
- else return;
504
- e.preventDefault();
505
- let s = r[a];
506
- s && (s.element.focus(), t.setValue(s.value));
507
- };
508
- return (() => {
509
- var e = m(X);
510
- return S(e, v(r, {
511
- get class() {
512
- return O("dds-tabs", n.class);
513
- },
514
- role: "tablist",
515
- get "aria-orientation"() {
516
- return t.orientation;
517
- },
518
- onKeyDown: i
519
- }), !1, !0), g(e, () => n.children), y(), e;
520
- })();
762
+ "unstyled"
763
+ ]);
764
+ return h(V.List, C(n, {
765
+ get class() {
766
+ return q(!t.unstyled && "dds-tabs", t.class);
767
+ },
768
+ get children() {
769
+ return t.children;
770
+ }
771
+ }));
521
772
  }
522
- function Ce(e) {
523
- let t = Q(), [n, r] = c(e, [
524
- "value",
773
+ function Be(e) {
774
+ let [t, n] = u(e, [
525
775
  "class",
526
776
  "children",
527
- "disabled",
528
- "onClick"
529
- ]), i;
530
- return s(() => {
531
- let e = t.register({
532
- value: n.value,
533
- element: i,
534
- disabled: !!n.disabled
535
- });
536
- o(e);
537
- }), (() => {
538
- var e = m(be), a = i;
539
- return typeof a == "function" ? w(a, e) : i = e, S(e, v(r, {
540
- get id() {
541
- return t.tabId(n.value);
542
- },
543
- type: "button",
544
- role: "tab",
545
- get class() {
546
- return O("dds-tab", n.class);
547
- },
548
- get "aria-selected"() {
549
- return t.value() === n.value;
550
- },
551
- get "aria-controls"() {
552
- return t.panelId(n.value);
553
- },
554
- get tabindex() {
555
- return t.value() === n.value ? 0 : -1;
556
- },
557
- get disabled() {
558
- return n.disabled;
559
- },
560
- onClick: (e) => {
561
- typeof n.onClick == "function" && n.onClick(e), e.defaultPrevented || t.setValue(n.value);
562
- }
563
- }), !1, !0), g(e, () => n.children), y(), e;
564
- })();
777
+ "value",
778
+ "unstyled",
779
+ "asChild"
780
+ ]), r = t.asChild ? (n) => t.asChild(s(n({}), { ref: e.ref })) : void 0;
781
+ return h(V.Trigger, C(n, {
782
+ get value() {
783
+ return t.value;
784
+ },
785
+ get class() {
786
+ return q(!t.unstyled && "dds-tab", t.class);
787
+ }
788
+ }, r ? { asChild: r } : {}, { get children() {
789
+ return t.children;
790
+ } }));
565
791
  }
566
- function we(e) {
567
- let t = Q(), [n, r] = c(e, [
792
+ function Ve(e) {
793
+ let [t, n] = u(e, [
568
794
  "value",
569
- "class",
570
- "children"
571
- ]);
572
- return (() => {
573
- var e = m(X);
574
- return S(e, v(r, {
575
- get id() {
576
- return t.panelId(n.value);
577
- },
578
- role: "tabpanel",
579
- get class() {
580
- return n.class;
581
- },
582
- get "aria-labelledby"() {
583
- return t.tabId(n.value);
584
- },
585
- get hidden() {
586
- return t.value() !== n.value;
587
- },
588
- tabindex: "0"
589
- }), !1, !0), g(e, () => n.children), y(), e;
590
- })();
795
+ "children",
796
+ "style"
797
+ ]), r = H(), i = () => r().value !== t.value, a = () => i() ? typeof t.style == "string" ? `${t.style.replace(/;+\s*$/, "")};display:none;` : {
798
+ ...t.style,
799
+ display: "none"
800
+ } : t.style;
801
+ return h(V.Content, C(n, {
802
+ get value() {
803
+ return t.value;
804
+ },
805
+ get style() {
806
+ return a();
807
+ },
808
+ get hidden() {
809
+ return i();
810
+ },
811
+ get inert() {
812
+ return i();
813
+ },
814
+ get children() {
815
+ return t.children;
816
+ }
817
+ }));
591
818
  }
592
819
  //#endregion
593
820
  //#region src/toast.tsx
594
- var Te = /*#__PURE__*/ C("<div aria-live=polite aria-relevant=\"additions removals\">"), Ee = /*#__PURE__*/ C("<div><span></span><!$><!/>"), De = /*#__PURE__*/ C("<button type=button class=\"dds-iconbtn dds-iconbtn--sm\">×"), $ = n();
595
- function Oe(t) {
596
- let [n, r] = i([]), a = /* @__PURE__ */ new Map(), s = 0, c = (e) => {
597
- let t = a.get(e);
598
- t && clearTimeout(t), a.delete(e), r((t) => t.filter((t) => t.id !== e));
599
- }, l = {
600
- show(e) {
601
- let n = `dds-toast-${++s}`;
602
- r((t) => [...t, {
603
- ...e,
604
- id: n
605
- }]);
606
- let i = e.duration ?? t.defaultDuration ?? 5e3;
607
- return i > 0 && a.set(n, setTimeout(() => c(n), i)), n;
821
+ var $ = n();
822
+ function He(e) {
823
+ let t = o(), n, r, i = () => r ??= new Proxy(n?.ownerDocument ?? document, { get(e, t) {
824
+ if (t === "getElementById") return (t) => t === "toast-group:bottom-end" ? n ?? null : e.getElementById(t);
825
+ let r = Reflect.get(e, t, e);
826
+ return typeof r == "function" ? r.bind(e) : r;
827
+ } }), a = te({
828
+ placement: "bottom-end",
829
+ overlap: !1,
830
+ gap: ne[8],
831
+ offsets: "var(--dds-space-16)",
832
+ removeDelay: 0,
833
+ hotkey: ["DDS_NO_HOTKEY"],
834
+ max: 2 ** 53 - 1,
835
+ pauseOnPageIdle: !0
836
+ }), s = 0, l = {
837
+ show(n) {
838
+ let r = `dds-toast-${t}-${++s}`, i = n.duration ?? e.defaultDuration ?? 5e3;
839
+ return a.create({
840
+ id: r,
841
+ description: n.message,
842
+ type: n.tone === "danger" ? "error" : n.tone ?? "info",
843
+ duration: i > 0 ? i : Infinity,
844
+ meta: { dds: {
845
+ ...n,
846
+ id: r
847
+ } }
848
+ }), r;
608
849
  },
609
- dismiss: c,
610
- clear() {
611
- for (let e of a.values()) clearTimeout(e);
612
- a.clear(), r([]);
613
- }
850
+ dismiss: (e) => a.remove(e),
851
+ clear: () => a.remove()
614
852
  };
615
- return o(l.clear), d($.Provider, {
853
+ return c(l.clear), h($.Provider, {
616
854
  value: l,
617
855
  get children() {
618
- return [_(() => t.children), (() => {
619
- var r = m(Te);
620
- return g(r, d(e, {
621
- get each() {
622
- return n();
623
- },
624
- children: (e) => (() => {
625
- var n = m(Ee), r = n.firstChild, i = r.nextSibling, [a, o] = h(i.nextSibling);
626
- return g(r, () => e.message), g(n, (() => {
627
- var n = _(() => !!t.dismissLabel);
628
- return () => n() ? (() => {
629
- var n = m(De);
630
- return n.$$click = () => c(e.id), p(() => b(n, "aria-label", typeof t.dismissLabel == "function" ? t.dismissLabel(e) : t.dismissLabel)), y(), n;
631
- })() : null;
632
- })(), a, o), p((t) => {
633
- var r = O("dds-toast", `dds-toast--${e.tone ?? "info"}`), i = e.tone === "danger" ? "alert" : "status";
634
- return r !== t.e && u(n, t.e = r), i !== t.t && b(n, "role", t.t = i), t;
635
- }, {
636
- e: void 0,
637
- t: void 0
638
- }), n;
639
- })()
640
- })), p(() => u(r, O("dds-toast-region", t.class))), r;
641
- })()];
856
+ return [S(() => e.children), h(ee, {
857
+ toaster: a,
858
+ ref(e) {
859
+ var t = n;
860
+ typeof t == "function" ? t(e) : n = e;
861
+ },
862
+ getRootNode: i,
863
+ id: `dds-toast-region-${t}`,
864
+ get class() {
865
+ return q("dds-toast-region", e.class);
866
+ },
867
+ get role() {
868
+ return e.regionLabel ? "region" : "presentation";
869
+ },
870
+ get "aria-label"() {
871
+ return e.regionLabel ?? "";
872
+ },
873
+ children: (t) => {
874
+ let n = () => t().meta?.dds;
875
+ return h(W.Root, {
876
+ get class() {
877
+ return q("dds-toast", `dds-toast--${n().tone ?? "info"}`);
878
+ },
879
+ get role() {
880
+ return n().tone === "danger" ? "alert" : "status";
881
+ },
882
+ get children() {
883
+ return [h(W.Description, { get children() {
884
+ return t().description;
885
+ } }), S(() => S(() => !!e.dismissLabel)() && h(W.CloseTrigger, {
886
+ class: "dds-iconbtn dds-iconbtn--sm",
887
+ get "aria-label"() {
888
+ return S(() => typeof e.dismissLabel == "function")() ? e.dismissLabel(n()) : e.dismissLabel;
889
+ },
890
+ children: "×"
891
+ }))];
892
+ }
893
+ });
894
+ }
895
+ })];
642
896
  }
643
897
  });
644
898
  }
645
- function ke() {
646
- let e = l($);
899
+ function Ue() {
900
+ let e = d($);
647
901
  if (!e) throw Error("useToast must be called inside <ToastProvider>");
648
902
  return e;
649
903
  }
650
- f(["click"]);
651
904
  //#endregion
652
905
  //#region src/tooltip.tsx
653
- var Ae = /*#__PURE__*/ C("<span><!$><!/><span class=dds-tooltip__bubble role=tooltip>");
654
- function je(e) {
655
- let t = a(), n = () => e.id ?? `dds-tooltip-${t}`, [r, i] = D({
906
+ var We = /*#__PURE__*/ O("<span><!$><!/><!$><!/>");
907
+ function Ge(e) {
908
+ let t = o(), n = () => e.id ?? `dds-tooltip-${t}`, [r, i] = K({
656
909
  value: () => e.open,
657
910
  defaultValue: e.defaultOpen ?? !1,
658
- onChange: e.onOpenChange
659
- }), o = {
660
- "aria-describedby": n(),
661
- onFocus: () => i(!0),
662
- onBlur: () => i(!1),
663
- onPointerEnter: () => i(!0),
664
- onPointerLeave: () => i(!1)
665
- };
666
- return (() => {
667
- var t = m(Ae), i = t.firstChild, [a, s] = h(i.nextSibling), c = a.nextSibling;
668
- return g(t, () => e.children(o), a, s), g(c, () => e.content), p((i) => {
669
- var a = O("dds-tooltip", e.class), o = n(), s = !r();
670
- return a !== i.e && u(t, i.e = a), o !== i.t && b(c, "id", i.t = o), s !== i.a && x(c, "hidden", i.a = s), i;
671
- }, {
672
- e: void 0,
673
- t: void 0,
674
- a: void 0
675
- }), t;
676
- })();
911
+ onChange: (t) => e.onOpenChange?.(t)
912
+ }), a = re(() => ({
913
+ id: n(),
914
+ ids: { content: n() },
915
+ open: r(),
916
+ onOpenChange: (e) => i(e.open),
917
+ openDelay: 0,
918
+ closeDelay: 0
919
+ }));
920
+ return h(G.RootProvider, {
921
+ value: a,
922
+ lazyMount: !1,
923
+ unmountOnExit: !1,
924
+ get children() {
925
+ var t = v(We), r = t.firstChild, [i, o] = y(r.nextSibling), s = i.nextSibling, [c, l] = y(s.nextSibling);
926
+ return b(t, h(G.Trigger, { asChild: (t) => {
927
+ let [, r] = u(t(), ["onFocusIn", "onFocusOut"]);
928
+ return e.children({
929
+ ...r,
930
+ "aria-describedby": n(),
931
+ onFocus: () => a().setOpen(!0),
932
+ onBlur: () => a().setOpen(!1),
933
+ onPointerEnter: () => a().setOpen(!0),
934
+ onPointerLeave: () => a().setOpen(!1)
935
+ });
936
+ } }), i, o), b(t, h(G.Positioner, { get children() {
937
+ return h(G.Content, {
938
+ class: "dds-tooltip__bubble",
939
+ get children() {
940
+ return e.content;
941
+ }
942
+ });
943
+ } }), c, l), _(() => m(t, q("dds-tooltip", e.class))), t;
944
+ }
945
+ });
677
946
  }
678
947
  //#endregion
679
- export { z as Button, W as Checkbox, ue as ConsoleShell, me as Dialog, V as Field, Y as Icon, B as IconButton, ee as Radio, H as Select, te as Switch, Ce as Tab, Se as TabList, we as TabPanel, xe as Tabs, Oe as ToastProvider, je as Tooltip, D as createControllableSignal, ye as createStatusPill, ke as useToast };
948
+ export { le as Button, me as Checkbox, Oe as ConsoleShell, Ae as Dialog, de as Field, Pe as Icon, ue as IconButton, he as Radio, je as RadioGroup, fe as Select, ge as Switch, Be as Tab, ze as TabList, Ve as TabPanel, Re as Tabs, He as ToastProvider, Ge as Tooltip, K as createControllableSignal, Ie as createStatusPill, Ue as useToast };
680
949
 
681
950
  //# sourceMappingURL=index.js.map