@donkit-ai/design-system 0.3.5 → 0.4.2

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 (45) hide show
  1. package/dist/index.cjs.js +22 -0
  2. package/dist/index.es.js +1105 -0
  3. package/dist/tokens.css +1 -0
  4. package/package.json +15 -9
  5. package/src/components/Accordion.css +0 -70
  6. package/src/components/Accordion.jsx +0 -42
  7. package/src/components/Alert.css +0 -93
  8. package/src/components/Alert.jsx +0 -47
  9. package/src/components/Badge.css +0 -52
  10. package/src/components/Badge.jsx +0 -25
  11. package/src/components/Button.css +0 -103
  12. package/src/components/Button.jsx +0 -80
  13. package/src/components/Card.css +0 -46
  14. package/src/components/Card.jsx +0 -70
  15. package/src/components/Checkbox.css +0 -88
  16. package/src/components/Checkbox.jsx +0 -47
  17. package/src/components/Code.css +0 -30
  18. package/src/components/Code.jsx +0 -27
  19. package/src/components/CodeAccordion.css +0 -80
  20. package/src/components/CodeAccordion.jsx +0 -42
  21. package/src/components/Input.css +0 -163
  22. package/src/components/Input.jsx +0 -55
  23. package/src/components/Link.css +0 -18
  24. package/src/components/Link.jsx +0 -21
  25. package/src/components/Modal.css +0 -70
  26. package/src/components/Modal.jsx +0 -72
  27. package/src/components/Radio.css +0 -115
  28. package/src/components/Radio.jsx +0 -42
  29. package/src/components/Select.css +0 -167
  30. package/src/components/Select.jsx +0 -118
  31. package/src/components/Stepper.css +0 -183
  32. package/src/components/Stepper.jsx +0 -104
  33. package/src/components/Tabs.css +0 -87
  34. package/src/components/Tabs.jsx +0 -81
  35. package/src/components/Textarea.css +0 -116
  36. package/src/components/Textarea.jsx +0 -41
  37. package/src/components/Toggle.css +0 -133
  38. package/src/components/Toggle.jsx +0 -38
  39. package/src/components/Tooltip.css +0 -134
  40. package/src/components/Tooltip.jsx +0 -158
  41. package/src/components/Typography.css +0 -74
  42. package/src/components/Typography.jsx +0 -42
  43. package/src/index.js +0 -24
  44. package/src/styles/iconSizes.js +0 -15
  45. package/src/styles/tokens.css +0 -298
@@ -0,0 +1,1105 @@
1
+ import $, { useState as P, useRef as F, useEffect as M } from "react";
2
+ import { ChevronDown as G, Minus as ce, Plus as le, XCircle as ie, AlertTriangle as de, CheckCircle as ue, Info as fe, X as re, Check as pe } from "lucide-react";
3
+ const T = {
4
+ xs: 16,
5
+ s: 20,
6
+ m: 24,
7
+ l: 28,
8
+ xl: 48
9
+ };
10
+ var q = { exports: {} }, B = {};
11
+ /**
12
+ * @license React
13
+ * react-jsx-runtime.production.js
14
+ *
15
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
16
+ *
17
+ * This source code is licensed under the MIT license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ */
20
+ var ee;
21
+ function me() {
22
+ if (ee) return B;
23
+ ee = 1;
24
+ var o = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
25
+ function r(l, n, a) {
26
+ var i = null;
27
+ if (a !== void 0 && (i = "" + a), n.key !== void 0 && (i = "" + n.key), "key" in n) {
28
+ a = {};
29
+ for (var c in n)
30
+ c !== "key" && (a[c] = n[c]);
31
+ } else a = n;
32
+ return n = a.ref, {
33
+ $$typeof: o,
34
+ type: l,
35
+ key: i,
36
+ ref: n !== void 0 ? n : null,
37
+ props: a
38
+ };
39
+ }
40
+ return B.Fragment = s, B.jsx = r, B.jsxs = r, B;
41
+ }
42
+ var L = {};
43
+ /**
44
+ * @license React
45
+ * react-jsx-runtime.development.js
46
+ *
47
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
48
+ *
49
+ * This source code is licensed under the MIT license found in the
50
+ * LICENSE file in the root directory of this source tree.
51
+ */
52
+ var te;
53
+ function xe() {
54
+ return te || (te = 1, process.env.NODE_ENV !== "production" && function() {
55
+ function o(t) {
56
+ if (t == null) return null;
57
+ if (typeof t == "function")
58
+ return t.$$typeof === ne ? null : t.displayName || t.name || null;
59
+ if (typeof t == "string") return t;
60
+ switch (t) {
61
+ case h:
62
+ return "Fragment";
63
+ case g:
64
+ return "Profiler";
65
+ case v:
66
+ return "StrictMode";
67
+ case y:
68
+ return "Suspense";
69
+ case O:
70
+ return "SuspenseList";
71
+ case D:
72
+ return "Activity";
73
+ }
74
+ if (typeof t == "object")
75
+ switch (typeof t.tag == "number" && console.error(
76
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
77
+ ), t.$$typeof) {
78
+ case E:
79
+ return "Portal";
80
+ case R:
81
+ return t.displayName || "Context";
82
+ case k:
83
+ return (t._context.displayName || "Context") + ".Consumer";
84
+ case I:
85
+ var f = t.render;
86
+ return t = t.displayName, t || (t = f.displayName || f.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
87
+ case S:
88
+ return f = t.displayName || null, f !== null ? f : o(t.type) || "Memo";
89
+ case A:
90
+ f = t._payload, t = t._init;
91
+ try {
92
+ return o(t(f));
93
+ } catch {
94
+ }
95
+ }
96
+ return null;
97
+ }
98
+ function s(t) {
99
+ return "" + t;
100
+ }
101
+ function r(t) {
102
+ try {
103
+ s(t);
104
+ var f = !1;
105
+ } catch {
106
+ f = !0;
107
+ }
108
+ if (f) {
109
+ f = console;
110
+ var j = f.error, N = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
111
+ return j.call(
112
+ f,
113
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
114
+ N
115
+ ), s(t);
116
+ }
117
+ }
118
+ function l(t) {
119
+ if (t === h) return "<>";
120
+ if (typeof t == "object" && t !== null && t.$$typeof === A)
121
+ return "<...>";
122
+ try {
123
+ var f = o(t);
124
+ return f ? "<" + f + ">" : "<...>";
125
+ } catch {
126
+ return "<...>";
127
+ }
128
+ }
129
+ function n() {
130
+ var t = V.A;
131
+ return t === null ? null : t.getOwner();
132
+ }
133
+ function a() {
134
+ return Error("react-stack-top-frame");
135
+ }
136
+ function i(t) {
137
+ if (X.call(t, "key")) {
138
+ var f = Object.getOwnPropertyDescriptor(t, "key").get;
139
+ if (f && f.isReactWarning) return !1;
140
+ }
141
+ return t.key !== void 0;
142
+ }
143
+ function c(t, f) {
144
+ function j() {
145
+ J || (J = !0, console.error(
146
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
147
+ f
148
+ ));
149
+ }
150
+ j.isReactWarning = !0, Object.defineProperty(t, "key", {
151
+ get: j,
152
+ configurable: !0
153
+ });
154
+ }
155
+ function m() {
156
+ var t = o(this.type);
157
+ return K[t] || (K[t] = !0, console.error(
158
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
159
+ )), t = this.props.ref, t !== void 0 ? t : null;
160
+ }
161
+ function p(t, f, j, N, Y, z) {
162
+ var w = j.ref;
163
+ return t = {
164
+ $$typeof: _,
165
+ type: t,
166
+ key: f,
167
+ props: j,
168
+ _owner: N
169
+ }, (w !== void 0 ? w : null) !== null ? Object.defineProperty(t, "ref", {
170
+ enumerable: !1,
171
+ get: m
172
+ }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
173
+ configurable: !1,
174
+ enumerable: !1,
175
+ writable: !0,
176
+ value: 0
177
+ }), Object.defineProperty(t, "_debugInfo", {
178
+ configurable: !1,
179
+ enumerable: !1,
180
+ writable: !0,
181
+ value: null
182
+ }), Object.defineProperty(t, "_debugStack", {
183
+ configurable: !1,
184
+ enumerable: !1,
185
+ writable: !0,
186
+ value: Y
187
+ }), Object.defineProperty(t, "_debugTask", {
188
+ configurable: !1,
189
+ enumerable: !1,
190
+ writable: !0,
191
+ value: z
192
+ }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
193
+ }
194
+ function d(t, f, j, N, Y, z) {
195
+ var w = f.children;
196
+ if (w !== void 0)
197
+ if (N)
198
+ if (ae(w)) {
199
+ for (N = 0; N < w.length; N++)
200
+ u(w[N]);
201
+ Object.freeze && Object.freeze(w);
202
+ } else
203
+ console.error(
204
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
205
+ );
206
+ else u(w);
207
+ if (X.call(f, "key")) {
208
+ w = o(t);
209
+ var W = Object.keys(f).filter(function(oe) {
210
+ return oe !== "key";
211
+ });
212
+ N = 0 < W.length ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}", Q[w + N] || (W = 0 < W.length ? "{" + W.join(": ..., ") + ": ...}" : "{}", console.error(
213
+ `A props object containing a "key" prop is being spread into JSX:
214
+ let props = %s;
215
+ <%s {...props} />
216
+ React keys must be passed directly to JSX without using spread:
217
+ let props = %s;
218
+ <%s key={someKey} {...props} />`,
219
+ N,
220
+ w,
221
+ W,
222
+ w
223
+ ), Q[w + N] = !0);
224
+ }
225
+ if (w = null, j !== void 0 && (r(j), w = "" + j), i(f) && (r(f.key), w = "" + f.key), "key" in f) {
226
+ j = {};
227
+ for (var U in f)
228
+ U !== "key" && (j[U] = f[U]);
229
+ } else j = f;
230
+ return w && c(
231
+ j,
232
+ typeof t == "function" ? t.displayName || t.name || "Unknown" : t
233
+ ), p(
234
+ t,
235
+ w,
236
+ j,
237
+ n(),
238
+ Y,
239
+ z
240
+ );
241
+ }
242
+ function u(t) {
243
+ x(t) ? t._store && (t._store.validated = 1) : typeof t == "object" && t !== null && t.$$typeof === A && (t._payload.status === "fulfilled" ? x(t._payload.value) && t._payload.value._store && (t._payload.value._store.validated = 1) : t._store && (t._store.validated = 1));
244
+ }
245
+ function x(t) {
246
+ return typeof t == "object" && t !== null && t.$$typeof === _;
247
+ }
248
+ var b = $, _ = Symbol.for("react.transitional.element"), E = Symbol.for("react.portal"), h = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), g = Symbol.for("react.profiler"), k = Symbol.for("react.consumer"), R = Symbol.for("react.context"), I = Symbol.for("react.forward_ref"), y = Symbol.for("react.suspense"), O = Symbol.for("react.suspense_list"), S = Symbol.for("react.memo"), A = Symbol.for("react.lazy"), D = Symbol.for("react.activity"), ne = Symbol.for("react.client.reference"), V = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, X = Object.prototype.hasOwnProperty, ae = Array.isArray, H = console.createTask ? console.createTask : function() {
249
+ return null;
250
+ };
251
+ b = {
252
+ react_stack_bottom_frame: function(t) {
253
+ return t();
254
+ }
255
+ };
256
+ var J, K = {}, Z = b.react_stack_bottom_frame.bind(
257
+ b,
258
+ a
259
+ )(), C = H(l(a)), Q = {};
260
+ L.Fragment = h, L.jsx = function(t, f, j) {
261
+ var N = 1e4 > V.recentlyCreatedOwnerStacks++;
262
+ return d(
263
+ t,
264
+ f,
265
+ j,
266
+ !1,
267
+ N ? Error("react-stack-top-frame") : Z,
268
+ N ? H(l(t)) : C
269
+ );
270
+ }, L.jsxs = function(t, f, j) {
271
+ var N = 1e4 > V.recentlyCreatedOwnerStacks++;
272
+ return d(
273
+ t,
274
+ f,
275
+ j,
276
+ !0,
277
+ N ? Error("react-stack-top-frame") : Z,
278
+ N ? H(l(t)) : C
279
+ );
280
+ };
281
+ }()), L;
282
+ }
283
+ process.env.NODE_ENV === "production" ? q.exports = me() : q.exports = xe();
284
+ var e = q.exports;
285
+ function be({
286
+ children: o,
287
+ variant: s = "primary",
288
+ size: r = "m",
289
+ fullWidth: l = !1,
290
+ icon: n,
291
+ disabled: a = !1,
292
+ onClick: i,
293
+ type: c = "button",
294
+ href: m,
295
+ "aria-label": p,
296
+ ...d
297
+ }) {
298
+ const u = n && !o, x = [
299
+ "ds-button",
300
+ `ds-button--${s}`,
301
+ `ds-button--${r}`,
302
+ l && "ds-button--full",
303
+ u && "ds-button--icon-only"
304
+ ].filter(Boolean).join(" "), b = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
305
+ n && !u && /* @__PURE__ */ e.jsx("span", { className: "ds-button__icon", "aria-hidden": "true", children: n }),
306
+ o,
307
+ u && /* @__PURE__ */ e.jsx("span", { className: "ds-button__icon", "aria-hidden": "true", children: n })
308
+ ] });
309
+ if (m) {
310
+ const _ = (E) => {
311
+ if (a) {
312
+ E.preventDefault();
313
+ return;
314
+ }
315
+ E.metaKey || E.ctrlKey || E.button === 1 || (E.preventDefault(), i == null || i(E));
316
+ };
317
+ return /* @__PURE__ */ e.jsx(
318
+ "a",
319
+ {
320
+ className: x,
321
+ href: a ? void 0 : m,
322
+ onClick: _,
323
+ "aria-label": p,
324
+ "aria-disabled": a ? "true" : void 0,
325
+ ...d,
326
+ children: b
327
+ }
328
+ );
329
+ }
330
+ return /* @__PURE__ */ e.jsx(
331
+ "button",
332
+ {
333
+ type: c,
334
+ className: x,
335
+ disabled: a,
336
+ onClick: i,
337
+ "aria-label": p,
338
+ ...d,
339
+ children: b
340
+ }
341
+ );
342
+ }
343
+ function Ne({
344
+ label: o,
345
+ error: s,
346
+ hint: r,
347
+ fullWidth: l = !0,
348
+ icon: n,
349
+ iconRight: a,
350
+ onIconRightClick: i,
351
+ size: c = "m",
352
+ disabled: m,
353
+ id: p,
354
+ ...d
355
+ }) {
356
+ const u = p || `input-${$.useId()}`, x = r ? `${u}-hint` : void 0, b = s ? `${u}-error` : void 0, _ = b || x;
357
+ return /* @__PURE__ */ e.jsxs("div", { className: `ds-input-wrapper ${l ? "ds-input-wrapper--full" : ""} ${m ? "ds-input-wrapper--disabled" : ""}`, children: [
358
+ o && /* @__PURE__ */ e.jsx("label", { className: "ds-input-label", htmlFor: u, children: o }),
359
+ /* @__PURE__ */ e.jsxs("div", { className: "ds-input-container", children: [
360
+ n && /* @__PURE__ */ e.jsx("span", { className: `ds-input-icon ds-input-icon--${c}`, "aria-hidden": "true", children: n }),
361
+ /* @__PURE__ */ e.jsx(
362
+ "input",
363
+ {
364
+ id: u,
365
+ className: `ds-input ds-input--${c} ${n ? "ds-input--with-icon" : ""} ${a ? "ds-input--with-icon-right" : ""} ${s ? "ds-input--error" : ""}`,
366
+ disabled: m,
367
+ "aria-invalid": s ? "true" : "false",
368
+ "aria-describedby": _,
369
+ ...d
370
+ }
371
+ ),
372
+ a && /* @__PURE__ */ e.jsx(
373
+ "button",
374
+ {
375
+ type: "button",
376
+ className: `ds-input-icon-right ds-input-icon-right--${c}`,
377
+ onClick: i,
378
+ tabIndex: -1,
379
+ "aria-label": "Toggle visibility",
380
+ children: a
381
+ }
382
+ )
383
+ ] }),
384
+ r && !s && /* @__PURE__ */ e.jsx("span", { id: x, className: "ds-input-hint", children: r }),
385
+ s && /* @__PURE__ */ e.jsx("span", { id: b, className: "ds-input-error", role: "alert", children: s })
386
+ ] });
387
+ }
388
+ function we({
389
+ label: o,
390
+ error: s,
391
+ hint: r,
392
+ fullWidth: l = !0,
393
+ size: n = "m",
394
+ disabled: a,
395
+ id: i,
396
+ resize: c = !0,
397
+ rows: m = 3,
398
+ ...p
399
+ }) {
400
+ const d = i || `textarea-${$.useId()}`, u = r ? `${d}-hint` : void 0, x = s ? `${d}-error` : void 0, b = x || u;
401
+ return /* @__PURE__ */ e.jsxs("div", { className: `ds-textarea-wrapper ${l ? "ds-textarea-wrapper--full" : ""} ${a ? "ds-textarea-wrapper--disabled" : ""}`, children: [
402
+ o && /* @__PURE__ */ e.jsx("label", { className: "ds-textarea-label", htmlFor: d, children: o }),
403
+ /* @__PURE__ */ e.jsx(
404
+ "textarea",
405
+ {
406
+ id: d,
407
+ className: `ds-textarea ds-textarea--${n} ${s ? "ds-textarea--error" : ""} ${c ? "" : "ds-textarea--no-resize"}`,
408
+ disabled: a,
409
+ "aria-invalid": s ? "true" : "false",
410
+ "aria-describedby": b,
411
+ rows: m,
412
+ ...p
413
+ }
414
+ ),
415
+ r && !s && /* @__PURE__ */ e.jsx("span", { id: u, className: "ds-textarea-hint", children: r }),
416
+ s && /* @__PURE__ */ e.jsx("span", { id: x, className: "ds-textarea-error", role: "alert", children: s })
417
+ ] });
418
+ }
419
+ function Ee({
420
+ label: o,
421
+ value: s,
422
+ onChange: r,
423
+ options: l = [],
424
+ placeholder: n = "Select option",
425
+ error: a,
426
+ fullWidth: i = !0,
427
+ size: c = "m",
428
+ disabled: m = !1,
429
+ id: p,
430
+ ...d
431
+ }) {
432
+ const [u, x] = P(!1), [b, _] = P("down"), E = F(null), h = F(null), v = p || `select-${$.useId()}`, g = `${v}-label`, k = a ? `${v}-error` : void 0;
433
+ M(() => {
434
+ const y = (O) => {
435
+ E.current && !E.current.contains(O.target) && x(!1);
436
+ };
437
+ return document.addEventListener("mousedown", y), () => document.removeEventListener("mousedown", y);
438
+ }, []), M(() => {
439
+ if (u && E.current) {
440
+ const y = E.current.getBoundingClientRect(), S = window.innerHeight - y.bottom, A = y.top;
441
+ S < 300 && A > S ? _("up") : _("down");
442
+ }
443
+ }, [u]);
444
+ const R = l.find((y) => y.value === s), I = c === "xs" ? T.xs : c === "small" ? T.s : T.m;
445
+ return /* @__PURE__ */ e.jsxs("div", { className: `ds-select-wrapper ${i ? "ds-select-wrapper--full" : ""} ${m ? "ds-select-wrapper--disabled" : ""}`, children: [
446
+ o && /* @__PURE__ */ e.jsx("label", { id: g, className: "ds-select-label", children: o }),
447
+ /* @__PURE__ */ e.jsxs("div", { className: "ds-select-container", ref: E, children: [
448
+ /* @__PURE__ */ e.jsxs(
449
+ "button",
450
+ {
451
+ type: "button",
452
+ id: v,
453
+ role: "combobox",
454
+ "aria-haspopup": "listbox",
455
+ "aria-expanded": u,
456
+ "aria-labelledby": o ? g : void 0,
457
+ "aria-invalid": a ? "true" : "false",
458
+ "aria-describedby": k,
459
+ className: `ds-select-trigger ds-select-trigger--${c} ${a ? "ds-select-trigger--error" : ""}`,
460
+ onClick: () => !m && x(!u),
461
+ disabled: m,
462
+ ...d,
463
+ children: [
464
+ /* @__PURE__ */ e.jsx("span", { className: R ? "" : "ds-select-placeholder", children: (R == null ? void 0 : R.label) || n }),
465
+ /* @__PURE__ */ e.jsx(
466
+ G,
467
+ {
468
+ size: I,
469
+ strokeWidth: 1.5,
470
+ className: `ds-select-icon ${u && b === "down" ? "ds-select-icon--open" : ""} ${u && b === "up" ? "ds-select-icon--up" : ""}`,
471
+ "aria-hidden": "true"
472
+ }
473
+ )
474
+ ]
475
+ }
476
+ ),
477
+ u && /* @__PURE__ */ e.jsx(
478
+ "div",
479
+ {
480
+ ref: h,
481
+ role: "listbox",
482
+ "aria-labelledby": o ? g : void 0,
483
+ className: `ds-select-dropdown ds-select-dropdown--${c} ds-select-dropdown--${b}`,
484
+ children: l.map((y) => /* @__PURE__ */ e.jsx(
485
+ "button",
486
+ {
487
+ type: "button",
488
+ role: "option",
489
+ "aria-selected": s === y.value,
490
+ className: `ds-select-option ds-select-option--${c} ${s === y.value ? "ds-select-option--selected" : ""}`,
491
+ onClick: () => {
492
+ r == null || r(y.value), x(!1);
493
+ },
494
+ children: y.label
495
+ },
496
+ y.value
497
+ ))
498
+ }
499
+ )
500
+ ] }),
501
+ a && /* @__PURE__ */ e.jsx("span", { id: k, className: "ds-select-error", role: "alert", children: a })
502
+ ] });
503
+ }
504
+ function ye({
505
+ label: o,
506
+ value: s = 0,
507
+ onChange: r,
508
+ min: l = 0,
509
+ max: n = 100,
510
+ step: a = 1,
511
+ size: i = "m",
512
+ disabled: c = !1,
513
+ hint: m,
514
+ error: p,
515
+ ...d
516
+ }) {
517
+ const u = () => {
518
+ if (c) return;
519
+ const v = Math.min(Number(s) + a, n);
520
+ r == null || r(v);
521
+ }, x = () => {
522
+ if (c) return;
523
+ const v = Math.max(Number(s) - a, l);
524
+ r == null || r(v);
525
+ }, b = (v) => {
526
+ if (c) return;
527
+ const g = v.target.value;
528
+ if (g === "") {
529
+ r == null || r(l);
530
+ return;
531
+ }
532
+ const k = Number(g);
533
+ if (!isNaN(k)) {
534
+ const R = Math.min(Math.max(k, l), n);
535
+ r == null || r(R);
536
+ }
537
+ }, _ = [
538
+ "ds-stepper-wrapper",
539
+ c && "ds-stepper-wrapper--disabled",
540
+ p && "ds-stepper-wrapper--error"
541
+ ].filter(Boolean).join(" "), E = [
542
+ "ds-stepper",
543
+ `ds-stepper--${i}`,
544
+ c && "ds-stepper--disabled"
545
+ ].filter(Boolean).join(" "), h = i === "xs" ? T.xs : i === "small" ? T.s : T.m;
546
+ return /* @__PURE__ */ e.jsxs("div", { className: _, children: [
547
+ o && /* @__PURE__ */ e.jsx("label", { className: "ds-stepper-label", children: o }),
548
+ /* @__PURE__ */ e.jsxs("div", { className: E, children: [
549
+ /* @__PURE__ */ e.jsx(
550
+ "button",
551
+ {
552
+ type: "button",
553
+ className: "ds-stepper-button ds-stepper-button--minus",
554
+ onClick: x,
555
+ disabled: c || s <= l,
556
+ "aria-label": "Decrease",
557
+ children: /* @__PURE__ */ e.jsx(ce, { size: h, strokeWidth: 1.5 })
558
+ }
559
+ ),
560
+ /* @__PURE__ */ e.jsx(
561
+ "input",
562
+ {
563
+ type: "number",
564
+ className: "ds-stepper-input",
565
+ value: s,
566
+ onChange: b,
567
+ min: l,
568
+ max: n,
569
+ step: a,
570
+ disabled: c,
571
+ ...d
572
+ }
573
+ ),
574
+ /* @__PURE__ */ e.jsx(
575
+ "button",
576
+ {
577
+ type: "button",
578
+ className: "ds-stepper-button ds-stepper-button--plus",
579
+ onClick: u,
580
+ disabled: c || s >= n,
581
+ "aria-label": "Increase",
582
+ children: /* @__PURE__ */ e.jsx(le, { size: h, strokeWidth: 1.5 })
583
+ }
584
+ )
585
+ ] }),
586
+ m && !p && /* @__PURE__ */ e.jsx("div", { className: "ds-stepper-hint", children: m }),
587
+ p && /* @__PURE__ */ e.jsx("div", { className: "ds-stepper-error", children: p })
588
+ ] });
589
+ }
590
+ function Re({
591
+ children: o,
592
+ padding: s = "m",
593
+ variant: r = "info",
594
+ hover: l = !1,
595
+ // deprecated, use variant="interactive"
596
+ onClick: n,
597
+ href: a,
598
+ disabled: i = !1,
599
+ ...c
600
+ }) {
601
+ const p = (l ? "interactive" : r) === "interactive" || n || a, d = [
602
+ "ds-card",
603
+ `ds-card--${s}`,
604
+ p && "ds-card--interactive"
605
+ ].filter(Boolean).join(" ");
606
+ if (a) {
607
+ const b = (_) => {
608
+ if (i) {
609
+ _.preventDefault();
610
+ return;
611
+ }
612
+ _.metaKey || _.ctrlKey || _.button === 1 || (_.preventDefault(), n == null || n(_));
613
+ };
614
+ return /* @__PURE__ */ e.jsx(
615
+ "a",
616
+ {
617
+ className: d,
618
+ href: i ? void 0 : a,
619
+ onClick: b,
620
+ "aria-disabled": i ? "true" : void 0,
621
+ ...c,
622
+ children: o
623
+ }
624
+ );
625
+ }
626
+ const u = p && n ? "button" : "div", x = p && n ? {
627
+ type: "button",
628
+ onClick: n,
629
+ disabled: i
630
+ } : {};
631
+ return /* @__PURE__ */ e.jsx(
632
+ u,
633
+ {
634
+ className: d,
635
+ role: p && !n ? "article" : void 0,
636
+ ...x,
637
+ ...c,
638
+ children: o
639
+ }
640
+ );
641
+ }
642
+ function ge({ children: o, ...s }) {
643
+ return /* @__PURE__ */ e.jsx("h1", { className: "ds-h1", ...s, children: o });
644
+ }
645
+ function ke({ children: o, ...s }) {
646
+ return /* @__PURE__ */ e.jsx("h2", { className: "ds-h2", ...s, children: o });
647
+ }
648
+ function $e({ children: o, ...s }) {
649
+ return /* @__PURE__ */ e.jsx("h3", { className: "ds-h3", ...s, children: o });
650
+ }
651
+ function Te({ children: o, ...s }) {
652
+ return /* @__PURE__ */ e.jsx("h4", { className: "ds-h4", ...s, children: o });
653
+ }
654
+ function Oe({ children: o, secondary: s = !1, ...r }) {
655
+ return /* @__PURE__ */ e.jsx("p", { className: `ds-p1 ${s ? "ds-p1--secondary" : ""}`, ...r, children: o });
656
+ }
657
+ function Ae({ children: o, secondary: s = !1, ...r }) {
658
+ return /* @__PURE__ */ e.jsx("p", { className: `ds-p2 ${s ? "ds-p2--secondary" : ""}`, ...r, children: o });
659
+ }
660
+ function Ie({ children: o, secondary: s = !1, ...r }) {
661
+ return /* @__PURE__ */ e.jsx("p", { className: `ds-p3 ${s ? "ds-p3--secondary" : ""}`, ...r, children: o });
662
+ }
663
+ function Se({
664
+ children: o,
665
+ variant: s = "default",
666
+ size: r = "m",
667
+ role: l,
668
+ ...n
669
+ }) {
670
+ const a = [
671
+ "ds-badge",
672
+ `ds-badge--${s}`,
673
+ `ds-badge--${r}`
674
+ ].filter(Boolean).join(" "), i = l || (["info", "success", "warning", "error"].includes(s) ? "status" : void 0);
675
+ return /* @__PURE__ */ e.jsx("span", { className: a, role: i, ...n, children: o });
676
+ }
677
+ const he = {
678
+ info: fe,
679
+ success: ue,
680
+ warning: de,
681
+ error: ie
682
+ };
683
+ function Pe({
684
+ children: o,
685
+ variant: s = "info",
686
+ title: r,
687
+ onClose: l,
688
+ role: n,
689
+ ...a
690
+ }) {
691
+ const i = he[s], c = n || (s === "error" ? "alert" : "status");
692
+ return /* @__PURE__ */ e.jsxs("div", { className: `ds-alert ds-alert--${s} ${r ? "" : "ds-alert--no-title"}`, role: c, ...a, children: [
693
+ i && /* @__PURE__ */ e.jsx("div", { className: "ds-alert__icon", children: /* @__PURE__ */ e.jsx(i, { size: T.m, strokeWidth: 1.5 }) }),
694
+ /* @__PURE__ */ e.jsxs("div", { className: "ds-alert__content", children: [
695
+ r && /* @__PURE__ */ e.jsx("div", { className: "ds-alert__title", children: r }),
696
+ o && /* @__PURE__ */ e.jsx("div", { className: "ds-alert__message", children: o })
697
+ ] }),
698
+ l && /* @__PURE__ */ e.jsx(
699
+ "button",
700
+ {
701
+ type: "button",
702
+ className: "ds-alert__close",
703
+ onClick: l,
704
+ "aria-label": "Close alert",
705
+ children: /* @__PURE__ */ e.jsx(re, { size: T.m, strokeWidth: 1.5 })
706
+ }
707
+ )
708
+ ] });
709
+ }
710
+ function De({
711
+ children: o,
712
+ title: s,
713
+ onClose: r,
714
+ size: l = "m",
715
+ ...n
716
+ }) {
717
+ const a = F(null), i = $.useId();
718
+ M(() => {
719
+ const d = (x) => {
720
+ x.key === "Escape" && (r == null || r());
721
+ }, u = (x) => {
722
+ a.current && !a.current.contains(x.target) && (r == null || r());
723
+ };
724
+ return document.addEventListener("keydown", d), document.addEventListener("mousedown", u), () => {
725
+ document.removeEventListener("keydown", d), document.removeEventListener("mousedown", u);
726
+ };
727
+ }, [r]);
728
+ const c = $.Children.toArray(o), m = c.find((d) => (d == null ? void 0 : d.type) === se), p = c.filter((d) => (d == null ? void 0 : d.type) !== se);
729
+ return /* @__PURE__ */ e.jsx("div", { className: "ds-modal-overlay", ...n, children: /* @__PURE__ */ e.jsxs(
730
+ "div",
731
+ {
732
+ className: `ds-modal ds-modal--${l}`,
733
+ ref: a,
734
+ role: "dialog",
735
+ "aria-modal": "true",
736
+ "aria-labelledby": s ? i : void 0,
737
+ children: [
738
+ (s || r) && /* @__PURE__ */ e.jsxs("div", { className: "ds-modal__header", children: [
739
+ s && /* @__PURE__ */ e.jsx("h3", { id: i, className: "ds-modal__title", children: s }),
740
+ r && /* @__PURE__ */ e.jsx(
741
+ be,
742
+ {
743
+ variant: "ghost",
744
+ size: "small",
745
+ icon: /* @__PURE__ */ e.jsx(re, { size: T.s, strokeWidth: 1.5 }),
746
+ onClick: r,
747
+ "aria-label": "Close modal"
748
+ }
749
+ )
750
+ ] }),
751
+ /* @__PURE__ */ e.jsx("div", { className: "ds-modal__body", children: p }),
752
+ m
753
+ ]
754
+ }
755
+ ) });
756
+ }
757
+ function se({ children: o }) {
758
+ return /* @__PURE__ */ e.jsx("div", { className: "ds-modal__footer", children: o });
759
+ }
760
+ function je({
761
+ children: o,
762
+ title: s = "Code",
763
+ defaultExpanded: r = !1,
764
+ padding: l = "s",
765
+ ...n
766
+ }) {
767
+ const [a, i] = P(r), c = [
768
+ "ds-code-accordion",
769
+ `ds-code-accordion--${l}`
770
+ ].filter(Boolean).join(" ");
771
+ return /* @__PURE__ */ e.jsxs("div", { className: c, children: [
772
+ /* @__PURE__ */ e.jsxs(
773
+ "button",
774
+ {
775
+ type: "button",
776
+ className: "ds-code-accordion__header",
777
+ onClick: () => i(!a),
778
+ "aria-expanded": a,
779
+ children: [
780
+ /* @__PURE__ */ e.jsx("span", { className: "ds-code-accordion__title", children: s }),
781
+ /* @__PURE__ */ e.jsx(
782
+ G,
783
+ {
784
+ size: T.s,
785
+ strokeWidth: 1.5,
786
+ className: `ds-code-accordion__icon ${a ? "ds-code-accordion__icon--expanded" : ""}`
787
+ }
788
+ )
789
+ ]
790
+ }
791
+ ),
792
+ a && /* @__PURE__ */ e.jsx("pre", { className: "ds-code-accordion__content", ...n, children: /* @__PURE__ */ e.jsx("code", { children: o }) })
793
+ ] });
794
+ }
795
+ function We({ children: o, block: s = !1, collapsible: r = !1, title: l = "Code", defaultExpanded: n = !1, ...a }) {
796
+ return s ? r ? /* @__PURE__ */ e.jsx(je, { title: l, defaultExpanded: n, ...a, children: o }) : /* @__PURE__ */ e.jsx("pre", { className: "ds-code-block", ...a, children: /* @__PURE__ */ e.jsx("code", { children: o }) }) : /* @__PURE__ */ e.jsx("code", { className: "ds-code-inline", ...a, children: o });
797
+ }
798
+ function Fe({ href: o, children: s, onClick: r, target: l, rel: n, ...a }) {
799
+ const c = l === "_blank" ? n ? `${n} noopener noreferrer` : "noopener noreferrer" : n;
800
+ return /* @__PURE__ */ e.jsx(
801
+ "a",
802
+ {
803
+ href: o,
804
+ className: "ds-link",
805
+ onClick: r,
806
+ target: l,
807
+ rel: c,
808
+ ...a,
809
+ children: s
810
+ }
811
+ );
812
+ }
813
+ function Me({ children: o, size: s = "m", variant: r = "ghost", ...l }) {
814
+ return /* @__PURE__ */ e.jsx("div", { className: "ds-tabs", role: "tablist", ...l, children: $.Children.map(o, (n) => $.isValidElement(n) ? $.cloneElement(n, { size: s, variant: r }) : n) });
815
+ }
816
+ function Be({ children: o, selected: s = !1, onClick: r, size: l = "m", variant: n = "ghost", disabled: a = !1, icon: i, href: c, ...m }) {
817
+ const p = i && !o, d = [
818
+ "ds-tab",
819
+ `ds-tab--${l}`,
820
+ `ds-tab--${n}`,
821
+ s && "ds-tab--selected",
822
+ p && "ds-tab--icon-only"
823
+ ].filter(Boolean).join(" "), u = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
824
+ i && /* @__PURE__ */ e.jsx("span", { className: "ds-tab-icon", children: i }),
825
+ o
826
+ ] });
827
+ if (c) {
828
+ const x = (b) => {
829
+ if (a) {
830
+ b.preventDefault();
831
+ return;
832
+ }
833
+ b.metaKey || b.ctrlKey || b.button === 1 || (b.preventDefault(), r == null || r(b));
834
+ };
835
+ return /* @__PURE__ */ e.jsx(
836
+ "a",
837
+ {
838
+ role: "tab",
839
+ "aria-current": s ? "page" : void 0,
840
+ "aria-disabled": a ? "true" : void 0,
841
+ className: d,
842
+ href: a ? void 0 : c,
843
+ onClick: x,
844
+ ...m,
845
+ children: u
846
+ }
847
+ );
848
+ }
849
+ return /* @__PURE__ */ e.jsx(
850
+ "button",
851
+ {
852
+ role: "tab",
853
+ "aria-selected": s,
854
+ className: d,
855
+ onClick: r,
856
+ disabled: a,
857
+ ...m,
858
+ children: u
859
+ }
860
+ );
861
+ }
862
+ function Le({
863
+ children: o,
864
+ title: s,
865
+ defaultExpanded: r = !1,
866
+ padding: l = "m",
867
+ ...n
868
+ }) {
869
+ const [a, i] = P(r), c = [
870
+ "ds-accordion",
871
+ `ds-accordion--${l}`
872
+ ].filter(Boolean).join(" ");
873
+ return /* @__PURE__ */ e.jsxs("div", { className: c, ...n, children: [
874
+ /* @__PURE__ */ e.jsxs(
875
+ "button",
876
+ {
877
+ type: "button",
878
+ className: "ds-accordion__header",
879
+ onClick: () => i(!a),
880
+ "aria-expanded": a,
881
+ children: [
882
+ /* @__PURE__ */ e.jsx("span", { className: "ds-accordion__title", children: s }),
883
+ /* @__PURE__ */ e.jsx(
884
+ G,
885
+ {
886
+ size: T.s,
887
+ strokeWidth: 1.5,
888
+ className: `ds-accordion__icon ${a ? "ds-accordion__icon--expanded" : ""}`
889
+ }
890
+ )
891
+ ]
892
+ }
893
+ ),
894
+ a && /* @__PURE__ */ e.jsx("div", { className: "ds-accordion__content", children: o })
895
+ ] });
896
+ }
897
+ function Ye({
898
+ children: o,
899
+ content: s,
900
+ position: r,
901
+ ...l
902
+ }) {
903
+ const [n, a] = P(!1), [i, c] = P(r || "top"), [m, p] = P({ x: 0, arrowOffset: 0 }), d = F(null), u = F(null), x = F(!1);
904
+ M(() => {
905
+ n && !r && d.current && u.current ? requestAnimationFrame(() => {
906
+ if (!d.current || !u.current) return;
907
+ const h = d.current.getBoundingClientRect(), v = u.current.getBoundingClientRect(), g = window.innerHeight, k = window.innerWidth, R = h.top, I = g - h.bottom, y = h.left, O = k - h.right, S = v.height, A = v.width;
908
+ if (R >= S + 8)
909
+ c("top");
910
+ else if (I >= S + 8)
911
+ c("bottom");
912
+ else if (O >= A + 8)
913
+ c("right");
914
+ else if (y >= A + 8)
915
+ c("left");
916
+ else {
917
+ const D = Math.max(R, I, y, O);
918
+ c(D === R ? "top" : D === I ? "bottom" : D === O ? "right" : "left");
919
+ }
920
+ }) : r && c(r);
921
+ }, [n, r]), M(() => {
922
+ n && u.current && d.current ? requestAnimationFrame(() => {
923
+ if (!u.current || !d.current) return;
924
+ const h = u.current.getBoundingClientRect(), v = window.innerWidth, g = 8;
925
+ let k = 0, R = 0;
926
+ (i === "top" || i === "bottom") && (h.right > v - g ? (k = v - g - h.right, R = -k) : h.left < g && (k = g - h.left, R = -k)), p({ x: k, arrowOffset: R });
927
+ }) : p({ x: 0, arrowOffset: 0 });
928
+ }, [n, i]), M(() => {
929
+ if (!n) return;
930
+ const h = (v) => {
931
+ d.current && !d.current.contains(v.target) && a(!1);
932
+ };
933
+ return document.addEventListener("touchstart", h), () => {
934
+ document.removeEventListener("touchstart", h);
935
+ };
936
+ }, [n]);
937
+ const b = () => {
938
+ x.current = !0, a((h) => !h);
939
+ }, _ = () => {
940
+ x.current || a(!0);
941
+ }, E = () => {
942
+ x.current || a(!1);
943
+ };
944
+ return s ? /* @__PURE__ */ e.jsxs(
945
+ "div",
946
+ {
947
+ ref: d,
948
+ className: "ds-tooltip-wrapper",
949
+ onMouseEnter: _,
950
+ onMouseLeave: E,
951
+ onTouchStart: b,
952
+ ...l,
953
+ children: [
954
+ o,
955
+ n && /* @__PURE__ */ e.jsx(
956
+ "div",
957
+ {
958
+ ref: u,
959
+ className: `ds-tooltip ds-tooltip--${i}`,
960
+ role: "tooltip",
961
+ style: {
962
+ "--tooltip-offset-x": `${m.x}px`,
963
+ "--arrow-offset": `${m.arrowOffset}px`
964
+ },
965
+ children: s
966
+ }
967
+ )
968
+ ]
969
+ }
970
+ ) : o;
971
+ }
972
+ function Ve({
973
+ checked: o = !1,
974
+ onChange: s,
975
+ size: r = "m",
976
+ disabled: l = !1,
977
+ label: n,
978
+ id: a,
979
+ ...i
980
+ }) {
981
+ const c = a || `toggle-${$.useId()}`, m = [
982
+ "ds-toggle",
983
+ `ds-toggle--${r}`,
984
+ l && "ds-toggle--disabled"
985
+ ].filter(Boolean).join(" ");
986
+ return /* @__PURE__ */ e.jsxs("label", { className: m, htmlFor: c, children: [
987
+ /* @__PURE__ */ e.jsx(
988
+ "input",
989
+ {
990
+ type: "checkbox",
991
+ id: c,
992
+ className: "ds-toggle__input",
993
+ checked: o,
994
+ onChange: (p) => s == null ? void 0 : s(p.target.checked),
995
+ disabled: l,
996
+ ...i
997
+ }
998
+ ),
999
+ /* @__PURE__ */ e.jsx("span", { className: "ds-toggle__track", children: /* @__PURE__ */ e.jsx("span", { className: "ds-toggle__thumb" }) }),
1000
+ n && /* @__PURE__ */ e.jsx("span", { className: "ds-toggle__label", children: n })
1001
+ ] });
1002
+ }
1003
+ function He({
1004
+ checked: o = !1,
1005
+ onChange: s,
1006
+ size: r = "m",
1007
+ disabled: l = !1,
1008
+ label: n,
1009
+ id: a,
1010
+ ...i
1011
+ }) {
1012
+ const c = a || `checkbox-${$.useId()}`, m = [
1013
+ "ds-checkbox",
1014
+ `ds-checkbox--${r}`,
1015
+ l && "ds-checkbox--disabled"
1016
+ ].filter(Boolean).join(" "), p = r === "xs" ? 10 : r === "small" ? 14 : r === "large" ? 20 : 16;
1017
+ return /* @__PURE__ */ e.jsxs("label", { className: m, htmlFor: c, children: [
1018
+ /* @__PURE__ */ e.jsx(
1019
+ "input",
1020
+ {
1021
+ type: "checkbox",
1022
+ id: c,
1023
+ className: "ds-checkbox__input",
1024
+ checked: o,
1025
+ onChange: (d) => s == null ? void 0 : s(d.target.checked),
1026
+ disabled: l,
1027
+ ...i
1028
+ }
1029
+ ),
1030
+ /* @__PURE__ */ e.jsx("span", { className: "ds-checkbox__box", children: o && /* @__PURE__ */ e.jsx(
1031
+ pe,
1032
+ {
1033
+ size: p,
1034
+ strokeWidth: 2.5,
1035
+ className: "ds-checkbox__icon"
1036
+ }
1037
+ ) }),
1038
+ n && /* @__PURE__ */ e.jsx("span", { className: "ds-checkbox__label", children: n })
1039
+ ] });
1040
+ }
1041
+ function ze({
1042
+ checked: o = !1,
1043
+ onChange: s,
1044
+ size: r = "m",
1045
+ disabled: l = !1,
1046
+ label: n,
1047
+ name: a,
1048
+ value: i,
1049
+ id: c,
1050
+ ...m
1051
+ }) {
1052
+ const p = c || `radio-${$.useId()}`, d = [
1053
+ "ds-radio",
1054
+ `ds-radio--${r}`,
1055
+ l && "ds-radio--disabled"
1056
+ ].filter(Boolean).join(" ");
1057
+ return /* @__PURE__ */ e.jsxs("label", { className: d, htmlFor: p, children: [
1058
+ /* @__PURE__ */ e.jsx(
1059
+ "input",
1060
+ {
1061
+ type: "radio",
1062
+ id: p,
1063
+ className: "ds-radio__input",
1064
+ checked: o,
1065
+ onChange: (u) => s == null ? void 0 : s(u.target.checked),
1066
+ disabled: l,
1067
+ name: a,
1068
+ value: i,
1069
+ ...m
1070
+ }
1071
+ ),
1072
+ /* @__PURE__ */ e.jsx("span", { className: "ds-radio__circle", children: /* @__PURE__ */ e.jsx("span", { className: "ds-radio__dot" }) }),
1073
+ n && /* @__PURE__ */ e.jsx("span", { className: "ds-radio__label", children: n })
1074
+ ] });
1075
+ }
1076
+ export {
1077
+ Le as Accordion,
1078
+ Pe as Alert,
1079
+ Se as Badge,
1080
+ be as Button,
1081
+ Re as Card,
1082
+ He as Checkbox,
1083
+ We as Code,
1084
+ je as CodeAccordion,
1085
+ ge as H1,
1086
+ ke as H2,
1087
+ $e as H3,
1088
+ Te as H4,
1089
+ Ne as Input,
1090
+ Fe as Link,
1091
+ De as Modal,
1092
+ se as ModalFooter,
1093
+ Oe as P1,
1094
+ Ae as P2,
1095
+ Ie as P3,
1096
+ ze as Radio,
1097
+ Ee as Select,
1098
+ ye as Stepper,
1099
+ Be as Tab,
1100
+ Me as Tabs,
1101
+ we as Textarea,
1102
+ Ve as Toggle,
1103
+ Ye as Tooltip,
1104
+ T as iconSizes
1105
+ };