@devalok/shilp-sutra 0.33.2 → 0.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/dist/_chunks/badge-group.js +306 -246
  2. package/dist/_chunks/chat.js +513 -0
  3. package/dist/_chunks/date-picker.js +748 -0
  4. package/dist/_chunks/document-preview.js +109 -90
  5. package/dist/_chunks/file-preview.js +492 -504
  6. package/dist/_chunks/framer.js +5564 -5613
  7. package/dist/_chunks/image-preview.js +127 -88
  8. package/dist/_chunks/keybinding.js +12 -14
  9. package/dist/_chunks/link-context.js +19 -16
  10. package/dist/_chunks/mention-suggestion.js +353 -350
  11. package/dist/_chunks/motion-provider.js +26 -20
  12. package/dist/_chunks/popover.js +127 -0
  13. package/dist/_chunks/primitives.js +7584 -6425
  14. package/dist/_chunks/rich-chat-input.js +2070 -0
  15. package/dist/_chunks/rolldown-runtime.js +21 -0
  16. package/dist/_chunks/shared.js +126 -0
  17. package/dist/_chunks/sonner.js +605 -734
  18. package/dist/_chunks/stat-row.js +418 -440
  19. package/dist/_chunks/tiptap.js +15850 -19964
  20. package/dist/_chunks/tree-view.js +231 -290
  21. package/dist/_chunks/use-calendar.js +161 -208
  22. package/dist/_chunks/vendor-client.js +314 -2199
  23. package/dist/_chunks/vendor-utils.js +1721 -2978
  24. package/dist/ai/ai-command-provider.js +23 -17
  25. package/dist/ai/block-renderer.js +68 -51
  26. package/dist/ai/blocks/index.js +2 -12
  27. package/dist/ai/command-bar.js +470 -519
  28. package/dist/ai/conversation.js +241 -227
  29. package/dist/ai/index.js +181 -167
  30. package/dist/ai/types.js +0 -1
  31. package/dist/composed/activity-feed.js +232 -202
  32. package/dist/composed/avatar-group.js +164 -222
  33. package/dist/composed/bulk-action-bar.js +174 -165
  34. package/dist/composed/command-palette.js +290 -308
  35. package/dist/composed/confirm-dialog.js +28 -48
  36. package/dist/composed/content-card.js +69 -108
  37. package/dist/composed/date-picker/index.js +3 -13
  38. package/dist/composed/deadline-indicator.js +68 -74
  39. package/dist/composed/emoji-picker.js +83 -110
  40. package/dist/composed/empty-state.js +64 -103
  41. package/dist/composed/error-boundary.js +129 -127
  42. package/dist/composed/file-preview.js +2 -12
  43. package/dist/composed/filter-bar.js +98 -130
  44. package/dist/composed/form-section.js +61 -45
  45. package/dist/composed/global-loading.js +34 -47
  46. package/dist/composed/index.js +34 -92
  47. package/dist/composed/inline-edit.js +92 -107
  48. package/dist/composed/lib/string-utils.js +8 -8
  49. package/dist/composed/loading-skeleton.js +103 -171
  50. package/dist/composed/markdown-viewer.js +187 -139
  51. package/dist/composed/master-detail.js +147 -156
  52. package/dist/composed/member-picker.js +46 -49
  53. package/dist/composed/multi-select-popover.js +181 -179
  54. package/dist/composed/page-header.js +54 -76
  55. package/dist/composed/page-skeletons.js +143 -127
  56. package/dist/composed/priority-indicator.js +105 -111
  57. package/dist/composed/responsive-overlay.js +36 -41
  58. package/dist/composed/rich-chat-input.js +2 -1860
  59. package/dist/composed/rich-text-editor.js +561 -424
  60. package/dist/composed/schedule-view.js +134 -185
  61. package/dist/composed/simple-tooltip.js +21 -21
  62. package/dist/composed/status-badge.js +133 -137
  63. package/dist/hooks/index.js +7 -12
  64. package/dist/hooks/use-color-mode.js +28 -25
  65. package/dist/hooks/use-mobile.js +13 -13
  66. package/dist/hooks/use-toast.js +2 -4
  67. package/dist/hooks/use-touch-device.js +9 -11
  68. package/dist/hooks/use-viewport-height.js +14 -14
  69. package/dist/motion/index.js +3 -11
  70. package/dist/motion/primitives-index.js +226 -186
  71. package/dist/shell/app-command-palette.js +203 -234
  72. package/dist/shell/bottom-navbar.js +150 -190
  73. package/dist/shell/command-registry.js +13 -14
  74. package/dist/shell/index.js +10 -20
  75. package/dist/shell/link-context.js +2 -5
  76. package/dist/shell/notification-center.js +238 -259
  77. package/dist/shell/notification-preferences.js +241 -184
  78. package/dist/shell/sidebar.js +251 -281
  79. package/dist/shell/top-bar.js +203 -237
  80. package/dist/tailwind/index.cjs +426 -451
  81. package/dist/tailwind/index.js +2 -4
  82. package/dist/tailwind/preset.d.ts.map +1 -1
  83. package/dist/tailwind/preset.js +443 -468
  84. package/dist/ui/accordion.js +52 -60
  85. package/dist/ui/alert-dialog.js +111 -156
  86. package/dist/ui/alert.js +177 -99
  87. package/dist/ui/aspect-ratio.js +13 -16
  88. package/dist/ui/autocomplete.js +112 -148
  89. package/dist/ui/avatar.js +196 -169
  90. package/dist/ui/badge-group.js +2 -7
  91. package/dist/ui/badge-indicator.js +42 -51
  92. package/dist/ui/badge.js +2 -15
  93. package/dist/ui/banner.js +76 -68
  94. package/dist/ui/breadcrumb.js +65 -84
  95. package/dist/ui/button-group.js +109 -102
  96. package/dist/ui/button-processing.js +69 -73
  97. package/dist/ui/button.js +393 -279
  98. package/dist/ui/card.js +151 -157
  99. package/dist/ui/charts/index.js +1002 -1319
  100. package/dist/ui/chat/index.js +2 -11
  101. package/dist/ui/checkbox.js +77 -100
  102. package/dist/ui/code.js +18 -32
  103. package/dist/ui/collapsible.js +21 -29
  104. package/dist/ui/color-input.js +453 -372
  105. package/dist/ui/color-swatch.js +60 -90
  106. package/dist/ui/combobox.js +244 -293
  107. package/dist/ui/container.js +18 -24
  108. package/dist/ui/context-menu.js +154 -203
  109. package/dist/ui/data-table-body.js +116 -213
  110. package/dist/ui/data-table-bulk-actions.js +43 -59
  111. package/dist/ui/data-table-card.js +84 -71
  112. package/dist/ui/data-table-context.js +39 -42
  113. package/dist/ui/data-table-header.js +98 -139
  114. package/dist/ui/data-table-pagination.js +69 -82
  115. package/dist/ui/data-table-toolbar.js +104 -130
  116. package/dist/ui/data-table.js +278 -354
  117. package/dist/ui/devalok-grain.js +77 -66
  118. package/dist/ui/dialog.js +122 -151
  119. package/dist/ui/dropdown-menu.js +152 -203
  120. package/dist/ui/file-upload.js +242 -266
  121. package/dist/ui/form.js +60 -56
  122. package/dist/ui/hover-card.js +54 -54
  123. package/dist/ui/icon-button.js +21 -26
  124. package/dist/ui/icon-context.js +17 -17
  125. package/dist/ui/icon-group.js +22 -29
  126. package/dist/ui/icon.js +201 -121
  127. package/dist/ui/index.js +74 -350
  128. package/dist/ui/input-otp.d.ts.map +1 -1
  129. package/dist/ui/input-otp.js +44 -48
  130. package/dist/ui/input.js +92 -169
  131. package/dist/ui/label.js +17 -22
  132. package/dist/ui/lib/date-utils.js +14 -11
  133. package/dist/ui/lib/motion.js +77 -36
  134. package/dist/ui/lib/utils.js +39 -16
  135. package/dist/ui/link.js +13 -24
  136. package/dist/ui/menubar.js +132 -210
  137. package/dist/ui/navigation-menu.js +164 -194
  138. package/dist/ui/number-input.js +72 -95
  139. package/dist/ui/pagination.js +122 -159
  140. package/dist/ui/popover.js +2 -131
  141. package/dist/ui/progress-ring.js +133 -143
  142. package/dist/ui/progress.js +51 -95
  143. package/dist/ui/radio.js +41 -50
  144. package/dist/ui/search-input.js +51 -53
  145. package/dist/ui/segmented-control.js +93 -114
  146. package/dist/ui/select.js +131 -157
  147. package/dist/ui/separator.js +15 -25
  148. package/dist/ui/sheet.js +135 -163
  149. package/dist/ui/sidebar.js +357 -600
  150. package/dist/ui/skeleton.js +179 -231
  151. package/dist/ui/slider.js +24 -34
  152. package/dist/ui/spinner.js +226 -205
  153. package/dist/ui/split-button.js +227 -276
  154. package/dist/ui/stack.js +56 -70
  155. package/dist/ui/stat-card.js +259 -251
  156. package/dist/ui/status-dot.js +67 -63
  157. package/dist/ui/stepper.js +119 -168
  158. package/dist/ui/switch.js +51 -54
  159. package/dist/ui/table.js +57 -90
  160. package/dist/ui/tabs.js +139 -156
  161. package/dist/ui/text.js +52 -59
  162. package/dist/ui/textarea.js +40 -57
  163. package/dist/ui/toast-types.js +0 -1
  164. package/dist/ui/toast.js +554 -536
  165. package/dist/ui/toaster.js +23 -33
  166. package/dist/ui/toggle-group.js +37 -41
  167. package/dist/ui/toggle.js +36 -40
  168. package/dist/ui/tooltip.js +80 -65
  169. package/dist/ui/tree-view/index.js +2 -6
  170. package/dist/ui/visually-hidden.js +12 -10
  171. package/llms-full.txt +1 -1
  172. package/llms.txt +12 -0
  173. package/package.json +3 -3
  174. package/dist/_chunks/date-time-picker.js +0 -851
  175. package/dist/_chunks/typing-indicator.js +0 -565
@@ -1,380 +1,461 @@
1
1
  "use client";
2
- import { jsx as r, jsxs as f } from "react/jsx-runtime";
3
- import * as g from "react";
4
- import { Z as K } from "../_chunks/vendor-client.js";
5
- import { cn as k } from "./lib/utils.js";
6
- import { springs as R } from "./lib/motion.js";
7
- import { Popover as Q, PopoverTrigger as X, PopoverContent as Y } from "./popover.js";
8
- import { m as x, A as V } from "../_chunks/framer.js";
9
- function B(l) {
10
- const a = /^#?([0-9a-f]{6})$/i.exec(l);
11
- if (!a) return null;
12
- const o = parseInt(a[1], 16);
13
- return { r: o >> 16 & 255, g: o >> 8 & 255, b: o & 255 };
2
+ import { a as e, c as t } from "../_chunks/framer.js";
3
+ import { springs as n } from "./lib/motion.js";
4
+ import { cn as r } from "./lib/utils.js";
5
+ import { t as i } from "../_chunks/vendor-client.js";
6
+ import { i as a, r as o, t as s } from "../_chunks/popover.js";
7
+ import * as c from "react";
8
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
9
+ //#region src/ui/color-input.tsx
10
+ function d(e) {
11
+ let t = /^#?([0-9a-f]{6})$/i.exec(e);
12
+ if (!t) return null;
13
+ let n = parseInt(t[1], 16);
14
+ return {
15
+ r: n >> 16 & 255,
16
+ g: n >> 8 & 255,
17
+ b: n & 255
18
+ };
14
19
  }
15
- function O(l, a, o) {
16
- return "#" + [l, a, o].map((t) => Math.max(0, Math.min(255, Math.round(t))).toString(16).padStart(2, "0")).join("");
20
+ function f(e, t, n) {
21
+ return "#" + [
22
+ e,
23
+ t,
24
+ n
25
+ ].map((e) => Math.max(0, Math.min(255, Math.round(e))).toString(16).padStart(2, "0")).join("");
17
26
  }
18
- function ee(l) {
19
- const a = B(l);
20
- if (!a) return null;
21
- const o = a.r / 255, t = a.g / 255, i = a.b / 255, c = Math.max(o, t, i), s = Math.min(o, t, i), p = (c + s) / 2;
22
- if (c === s) return { h: 0, s: 0, l: Math.round(p * 100) };
23
- const h = c - s, N = p > 0.5 ? h / (2 - c - s) : h / (c - s);
24
- let M = 0;
25
- return c === o ? M = ((t - i) / h + (t < i ? 6 : 0)) / 6 : c === t ? M = ((i - o) / h + 2) / 6 : M = ((o - t) / h + 4) / 6, { h: Math.round(M * 360), s: Math.round(N * 100), l: Math.round(p * 100) };
27
+ function p(e) {
28
+ let t = d(e);
29
+ if (!t) return null;
30
+ let n = t.r / 255, r = t.g / 255, i = t.b / 255, a = Math.max(n, r, i), o = Math.min(n, r, i), s = (a + o) / 2;
31
+ if (a === o) return {
32
+ h: 0,
33
+ s: 0,
34
+ l: Math.round(s * 100)
35
+ };
36
+ let c = a - o, l = s > .5 ? c / (2 - a - o) : c / (a - o), u = 0;
37
+ return u = a === n ? ((r - i) / c + (r < i ? 6 : 0)) / 6 : a === r ? ((i - n) / c + 2) / 6 : ((n - r) / c + 4) / 6, {
38
+ h: Math.round(u * 360),
39
+ s: Math.round(l * 100),
40
+ l: Math.round(s * 100)
41
+ };
26
42
  }
27
- function te(l, a, o) {
28
- const t = a / 100, i = o / 100, c = t * Math.min(i, 1 - i), s = (p) => {
29
- const h = (p + l / 30) % 12, N = i - c * Math.max(Math.min(h - 3, 9 - h, 1), -1);
30
- return Math.round(255 * N);
31
- };
32
- return O(s(0), s(8), s(4));
43
+ function m(e, t, n) {
44
+ let r = t / 100, i = n / 100, a = r * Math.min(i, 1 - i), o = (t) => {
45
+ let n = (t + e / 30) % 12, r = i - a * Math.max(Math.min(n - 3, 9 - n, 1), -1);
46
+ return Math.round(255 * r);
47
+ };
48
+ return f(o(0), o(8), o(4));
33
49
  }
34
- const re = [
35
- { hex: "#EF4444", label: "Red" },
36
- { hex: "#F59E0B", label: "Amber" },
37
- { hex: "#10B981", label: "Emerald" },
38
- { hex: "#3B82F6", label: "Blue" },
39
- { hex: "#8B5CF6", label: "Violet" },
40
- { hex: "#EC4899", label: "Pink" },
41
- { hex: "#06B6D4", label: "Cyan" },
42
- { hex: "#F97316", label: "Orange" },
43
- { hex: "#84CC16", label: "Lime" },
44
- { hex: "#6366F1", label: "Indigo" }
50
+ var h = [
51
+ {
52
+ hex: "#EF4444",
53
+ label: "Red"
54
+ },
55
+ {
56
+ hex: "#F59E0B",
57
+ label: "Amber"
58
+ },
59
+ {
60
+ hex: "#10B981",
61
+ label: "Emerald"
62
+ },
63
+ {
64
+ hex: "#3B82F6",
65
+ label: "Blue"
66
+ },
67
+ {
68
+ hex: "#8B5CF6",
69
+ label: "Violet"
70
+ },
71
+ {
72
+ hex: "#EC4899",
73
+ label: "Pink"
74
+ },
75
+ {
76
+ hex: "#06B6D4",
77
+ label: "Cyan"
78
+ },
79
+ {
80
+ hex: "#F97316",
81
+ label: "Orange"
82
+ },
83
+ {
84
+ hex: "#84CC16",
85
+ label: "Lime"
86
+ },
87
+ {
88
+ hex: "#6366F1",
89
+ label: "Indigo"
90
+ }
45
91
  ];
46
- function ae(l) {
47
- const a = B(l);
48
- if (!a) return !1;
49
- const [o, t, i] = [a.r, a.g, a.b].map((c) => {
50
- const s = c / 255;
51
- return s <= 0.03928 ? s / 12.92 : Math.pow((s + 0.055) / 1.055, 2.4);
52
- });
53
- return 0.2126 * o + 0.7152 * t + 0.0722 * i > 0.4;
92
+ function g(e) {
93
+ let t = d(e);
94
+ if (!t) return !1;
95
+ let [n, r, i] = [
96
+ t.r,
97
+ t.g,
98
+ t.b
99
+ ].map((e) => {
100
+ let t = e / 255;
101
+ return t <= .03928 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
102
+ });
103
+ return .2126 * n + .7152 * r + .0722 * i > .4;
54
104
  }
55
- function w({
56
- label: l,
57
- value: a,
58
- onChange: o,
59
- onBlur: t,
60
- disabled: i,
61
- maxLength: c = 3,
62
- prefix: s,
63
- className: p,
64
- id: h
65
- }) {
66
- return /* @__PURE__ */ f("div", { className: k("flex flex-col gap-ds-01", p), children: [
67
- /* @__PURE__ */ r("label", { htmlFor: h, className: "text-ds-xs font-medium uppercase tracking-wider text-surface-fg-muted", children: l }),
68
- /* @__PURE__ */ f("div", { className: "flex items-center", children: [
69
- s && /* @__PURE__ */ r("span", { className: "text-ds-sm text-surface-fg-muted", children: s }),
70
- /* @__PURE__ */ r(
71
- "input",
72
- {
73
- id: h,
74
- type: "text",
75
- value: a,
76
- disabled: i,
77
- onChange: (N) => o(N.target.value),
78
- onBlur: t,
79
- maxLength: c,
80
- className: k(
81
- "h-ds-xs-plus w-full rounded-ds-sm border border-surface-border bg-surface-overlay px-ds-02 font-mono text-ds-sm text-surface-fg transition-colors",
82
- "focus:border-accent-7 focus:outline-none focus:ring-1 focus:ring-accent-9",
83
- i && "cursor-not-allowed opacity-50"
84
- )
85
- }
86
- )
87
- ] })
88
- ] });
105
+ function _({ label: e, value: t, onChange: n, onBlur: i, disabled: a, maxLength: o = 3, prefix: s, className: c, id: d }) {
106
+ return /* @__PURE__ */ u("div", {
107
+ className: r("flex flex-col gap-ds-01", c),
108
+ children: [/* @__PURE__ */ l("label", {
109
+ htmlFor: d,
110
+ className: "text-ds-xs font-medium uppercase tracking-wider text-surface-fg-muted",
111
+ children: e
112
+ }), /* @__PURE__ */ u("div", {
113
+ className: "flex items-center",
114
+ children: [s && /* @__PURE__ */ l("span", {
115
+ className: "text-ds-sm text-surface-fg-muted",
116
+ children: s
117
+ }), /* @__PURE__ */ l("input", {
118
+ id: d,
119
+ type: "text",
120
+ value: t,
121
+ disabled: a,
122
+ onChange: (e) => n(e.target.value),
123
+ onBlur: i,
124
+ maxLength: o,
125
+ className: r("h-ds-xs-plus w-full rounded-ds-sm border border-surface-border bg-surface-overlay px-ds-02 font-mono text-ds-sm text-surface-fg transition-colors", "focus:border-accent-7 focus:outline-hidden focus:ring-1 focus:ring-accent-9", a && "cursor-not-allowed opacity-50")
126
+ })]
127
+ })]
128
+ });
89
129
  }
90
- const ne = g.forwardRef(
91
- ({
92
- value: l = "#000000",
93
- onChange: a,
94
- presets: o,
95
- disabled: t = !1,
96
- showPicker: i = !0,
97
- defaultFormat: c = "hex",
98
- align: s = "start",
99
- variant: p = "default",
100
- className: h,
101
- ...N
102
- }, M) => {
103
- const [$, A] = g.useState(c), [j, D] = g.useState(!1), b = g.useId(), [n, S] = g.useState(l);
104
- g.useEffect(() => {
105
- S(l);
106
- }, [l]);
107
- const [v, W] = g.useState(l), [I, F] = g.useState([]), H = g.useRef(!1), G = (e) => {
108
- t || (e && (W(n), F([])), D(e));
109
- }, P = (e) => {
110
- if (t) return;
111
- const d = (e.startsWith("#") ? e : `#${e}`).toLowerCase();
112
- F((u) => u[u.length - 1] === n ? u : [...u.slice(-19), n]), S(d), a?.(d);
113
- }, Z = (e) => {
114
- if (t) return;
115
- const d = (e.startsWith("#") ? e : `#${e}`).toLowerCase();
116
- H.current || (H.current = !0, F((u) => u[u.length - 1] === n ? u : [...u.slice(-19), n])), S(d), a?.(d);
117
- }, E = () => {
118
- H.current = !1;
119
- }, _ = () => {
120
- if (I.length === 0) return;
121
- const e = I[I.length - 1];
122
- F((m) => m.slice(0, -1)), S(e), a?.(e);
123
- }, q = () => {
124
- S(v), a?.(v), F([]);
125
- }, z = o === !1 ? [] : o ? o.map(
126
- (e) => typeof e == "string" ? { hex: e, label: e } : e
127
- ) : re, y = B(n), C = ee(n), L = (e, m) => {
128
- if (!y) return;
129
- const d = parseInt(m, 10);
130
- if (isNaN(d)) return;
131
- const u = Math.max(0, Math.min(255, d));
132
- P(O(
133
- e === "r" ? u : y.r,
134
- e === "g" ? u : y.g,
135
- e === "b" ? u : y.b
136
- ));
137
- }, T = (e, m) => {
138
- if (!C) return;
139
- const d = parseInt(m, 10);
140
- if (isNaN(d)) return;
141
- const U = Math.max(0, Math.min(e === "h" ? 360 : 100, d));
142
- P(te(
143
- e === "h" ? U : C.h,
144
- e === "s" ? U : C.s,
145
- e === "l" ? U : C.l
146
- ));
147
- }, J = ["hex", "rgb", "hsl"];
148
- return /* @__PURE__ */ r("div", { ref: M, className: k("inline-flex flex-col", h), ...N, children: /* @__PURE__ */ f(Q, { open: j, onOpenChange: G, children: [
149
- /* @__PURE__ */ r(X, { asChild: !0, children: p === "inline" ? /* @__PURE__ */ r(
150
- x.button,
151
- {
152
- type: "button",
153
- disabled: t,
154
- className: k(
155
- "group flex items-center justify-center rounded-ds-md px-ds-04 py-ds-02 font-mono text-ds-sm font-medium",
156
- "focus:outline-none focus:ring-2 focus:ring-accent-9 focus:ring-offset-2 focus:ring-offset-surface-base",
157
- t && "cursor-not-allowed opacity-50"
158
- ),
159
- animate: {
160
- backgroundColor: n,
161
- color: ae(n) ? "rgba(0,0,0,0.8)" : "rgba(255,255,255,0.95)"
162
- },
163
- whileHover: { y: -1, boxShadow: "0 4px 12px rgba(0,0,0,0.12)" },
164
- whileTap: { scale: 0.97 },
165
- transition: R.smooth,
166
- "aria-label": `Color picker: ${n}`,
167
- children: n.toUpperCase()
168
- }
169
- ) : /* @__PURE__ */ f(
170
- x.button,
171
- {
172
- type: "button",
173
- disabled: t,
174
- className: k(
175
- "group relative flex items-center overflow-hidden rounded-ds-md border border-surface-border-strong",
176
- "hover:border-accent-7 focus:border-accent-7 focus:outline-none focus:ring-1 focus:ring-accent-9",
177
- t && "cursor-not-allowed opacity-50"
178
- ),
179
- whileHover: { scale: 1.02 },
180
- whileTap: { scale: 0.98 },
181
- transition: R.snappy,
182
- "aria-label": `Color picker: ${n}`,
183
- children: [
184
- /* @__PURE__ */ r(
185
- x.span,
186
- {
187
- className: "absolute inset-0",
188
- animate: {
189
- background: `linear-gradient(to right, ${n} 0%, ${n} 35%, transparent 70%)`
190
- },
191
- transition: { duration: 0.3 }
192
- }
193
- ),
194
- /* @__PURE__ */ r("span", { className: "absolute inset-0 bg-surface-overlay/60", style: {
195
- maskImage: "linear-gradient(to right, transparent 0%, black 40%)",
196
- WebkitMaskImage: "linear-gradient(to right, transparent 0%, black 40%)"
197
- } }),
198
- /* @__PURE__ */ r("span", { className: "relative z-10 py-ds-02 pl-6 pr-ds-03 font-mono text-ds-sm text-surface-fg", children: n.toUpperCase() })
199
- ]
200
- }
201
- ) }),
202
- /* @__PURE__ */ r(
203
- Y,
204
- {
205
- align: s,
206
- sideOffset: 8,
207
- className: "w-[272px] rounded-ds-xl border border-surface-border-strong bg-surface-overlay p-0 shadow-floating",
208
- children: /* @__PURE__ */ f("div", { className: "flex flex-col", children: [
209
- i && /* @__PURE__ */ r("div", { className: "p-ds-04 pb-ds-03", onPointerUp: E, onPointerLeave: E, children: /* @__PURE__ */ r(
210
- K,
211
- {
212
- color: n,
213
- onChange: Z,
214
- className: "!w-full",
215
- style: { height: 160 }
216
- }
217
- ) }),
218
- /* @__PURE__ */ f("div", { className: "border-t border-surface-border px-ds-04 py-ds-03", children: [
219
- /* @__PURE__ */ r("div", { className: "mb-ds-03 flex items-center gap-ds-01", children: J.map((e) => /* @__PURE__ */ f(
220
- "button",
221
- {
222
- type: "button",
223
- onClick: () => A(e),
224
- className: k(
225
- "relative min-h-6 rounded-ds-sm px-ds-02 py-px text-ds-xs font-semibold uppercase tracking-wider transition-colors",
226
- $ === e ? "text-accent-11" : "text-surface-fg-muted hover:text-surface-fg"
227
- ),
228
- children: [
229
- $ === e && /* @__PURE__ */ r(
230
- x.span,
231
- {
232
- layoutId: `color-input-format-pill-${b}`,
233
- className: "absolute inset-0 rounded-ds-sm bg-accent-3",
234
- transition: R.snappy
235
- }
236
- ),
237
- /* @__PURE__ */ r("span", { className: "relative z-10", children: e })
238
- ]
239
- },
240
- e
241
- )) }),
242
- /* @__PURE__ */ f(V, { mode: "wait", children: [
243
- $ === "hex" && /* @__PURE__ */ r(
244
- x.div,
245
- {
246
- initial: { opacity: 0, y: 4 },
247
- animate: { opacity: 1, y: 0 },
248
- exit: { opacity: 0, y: -4 },
249
- transition: { duration: 0.15 },
250
- className: "flex gap-ds-02",
251
- children: /* @__PURE__ */ r(
252
- w,
253
- {
254
- id: `${b}-hex`,
255
- label: "Hex",
256
- value: n.replace("#", "").toUpperCase(),
257
- onChange: (e) => {
258
- const m = e.replace(/[^0-9a-fA-F]/g, "").slice(0, 6);
259
- m.length === 6 && P(`#${m}`);
260
- },
261
- onBlur: () => {
262
- n.replace("#", "").toUpperCase().length !== 6 && S(n);
263
- },
264
- disabled: t,
265
- maxLength: 6,
266
- prefix: "#",
267
- className: "flex-1"
268
- }
269
- )
270
- },
271
- "hex"
272
- ),
273
- $ === "rgb" && y && /* @__PURE__ */ f(
274
- x.div,
275
- {
276
- initial: { opacity: 0, y: 4 },
277
- animate: { opacity: 1, y: 0 },
278
- exit: { opacity: 0, y: -4 },
279
- transition: { duration: 0.15 },
280
- className: "flex gap-ds-02",
281
- children: [
282
- /* @__PURE__ */ r(w, { id: `${b}-r`, label: "R", value: String(y.r), onChange: (e) => L("r", e), disabled: t, className: "flex-1" }),
283
- /* @__PURE__ */ r(w, { id: `${b}-g`, label: "G", value: String(y.g), onChange: (e) => L("g", e), disabled: t, className: "flex-1" }),
284
- /* @__PURE__ */ r(w, { id: `${b}-b`, label: "B", value: String(y.b), onChange: (e) => L("b", e), disabled: t, className: "flex-1" })
285
- ]
286
- },
287
- "rgb"
288
- ),
289
- $ === "hsl" && C && /* @__PURE__ */ f(
290
- x.div,
291
- {
292
- initial: { opacity: 0, y: 4 },
293
- animate: { opacity: 1, y: 0 },
294
- exit: { opacity: 0, y: -4 },
295
- transition: { duration: 0.15 },
296
- className: "flex gap-ds-02",
297
- children: [
298
- /* @__PURE__ */ r(w, { id: `${b}-h`, label: "H", value: String(C.h), onChange: (e) => T("h", e), disabled: t, className: "flex-1" }),
299
- /* @__PURE__ */ r(w, { id: `${b}-s`, label: "S", value: String(C.s), onChange: (e) => T("s", e), disabled: t, className: "flex-1" }),
300
- /* @__PURE__ */ r(w, { id: `${b}-l`, label: "L", value: String(C.l), onChange: (e) => T("l", e), disabled: t, className: "flex-1" })
301
- ]
302
- },
303
- "hsl"
304
- )
305
- ] })
306
- ] }),
307
- z.length > 0 && /* @__PURE__ */ r("div", { className: "border-t border-surface-border px-ds-04 py-ds-03", children: /* @__PURE__ */ r("div", { className: "flex flex-wrap gap-ds-02", children: z.map((e, m) => {
308
- const d = n.toLowerCase() === e.hex.toLowerCase();
309
- return /* @__PURE__ */ r(
310
- x.button,
311
- {
312
- type: "button",
313
- disabled: t,
314
- onClick: () => P(e.hex),
315
- initial: { opacity: 0, scale: 0.8 },
316
- animate: { opacity: 1, scale: d ? 1.15 : 1 },
317
- whileHover: { scale: d ? 1.15 : 1.1 },
318
- whileTap: { scale: 0.9 },
319
- transition: { ...R.bouncy, delay: m * 0.02 },
320
- className: k(
321
- "h-6 w-6 rounded-ds-sm border",
322
- d ? "border-accent-7 ring-2 ring-accent-9/30" : "border-surface-border hover:border-surface-border-strong",
323
- t && "cursor-not-allowed opacity-50"
324
- ),
325
- style: { backgroundColor: e.hex },
326
- title: e.label,
327
- "aria-label": `${e.label}: ${e.hex}`
328
- },
329
- e.hex
330
- );
331
- }) }) }),
332
- (I.length > 0 || n !== v) && /* @__PURE__ */ f(
333
- x.div,
334
- {
335
- initial: { opacity: 0, height: 0 },
336
- animate: { opacity: 1, height: "auto" },
337
- exit: { opacity: 0, height: 0 },
338
- className: "flex items-center gap-ds-02 border-t border-surface-border px-ds-04 py-ds-02",
339
- children: [
340
- /* @__PURE__ */ r(
341
- "span",
342
- {
343
- className: "h-4 w-4 shrink-0 rounded-full border border-surface-border",
344
- style: { backgroundColor: v },
345
- title: `Original: ${v}`
346
- }
347
- ),
348
- /* @__PURE__ */ r("span", { className: "text-ds-xs text-surface-fg-muted", children: v.toUpperCase() }),
349
- /* @__PURE__ */ r("span", { className: "flex-1" }),
350
- I.length > 0 && /* @__PURE__ */ r(
351
- "button",
352
- {
353
- type: "button",
354
- onClick: _,
355
- className: "min-h-6 rounded-ds-sm px-ds-02 py-px text-ds-xs font-medium text-surface-fg-muted transition-colors hover:text-surface-fg",
356
- children: "Undo"
357
- }
358
- ),
359
- n !== v && /* @__PURE__ */ r(
360
- "button",
361
- {
362
- type: "button",
363
- onClick: q,
364
- className: "min-h-6 rounded-ds-sm px-ds-02 py-px text-ds-xs font-medium text-surface-fg-muted transition-colors hover:text-error-11",
365
- children: "Reset"
366
- }
367
- )
368
- ]
369
- }
370
- )
371
- ] })
372
- }
373
- )
374
- ] }) });
375
- }
376
- );
377
- ne.displayName = "ColorInput";
378
- export {
379
- ne as ColorInput
380
- };
130
+ var v = c.forwardRef(({ value: v = "#000000", onChange: y, presets: b, disabled: x = !1, showPicker: S = !0, defaultFormat: C = "hex", align: w = "start", variant: T = "default", className: E, ...D }, O) => {
131
+ let [k, A] = c.useState(C), [j, M] = c.useState(!1), N = c.useId(), [P, F] = c.useState(v);
132
+ c.useEffect(() => {
133
+ F(v);
134
+ }, [v]);
135
+ let [I, L] = c.useState(v), [R, z] = c.useState([]), B = c.useRef(!1), V = (e) => {
136
+ x || (e && (L(P), z([])), M(e));
137
+ }, H = (e) => {
138
+ if (x) return;
139
+ let t = (e.startsWith("#") ? e : `#${e}`).toLowerCase();
140
+ z((e) => e[e.length - 1] === P ? e : [...e.slice(-19), P]), F(t), y?.(t);
141
+ }, U = (e) => {
142
+ if (x) return;
143
+ let t = (e.startsWith("#") ? e : `#${e}`).toLowerCase();
144
+ B.current || (B.current = !0, z((e) => e[e.length - 1] === P ? e : [...e.slice(-19), P])), F(t), y?.(t);
145
+ }, W = () => {
146
+ B.current = !1;
147
+ }, G = () => {
148
+ if (R.length === 0) return;
149
+ let e = R[R.length - 1];
150
+ z((e) => e.slice(0, -1)), F(e), y?.(e);
151
+ }, K = () => {
152
+ F(I), y?.(I), z([]);
153
+ }, q = b === !1 ? [] : b ? b.map((e) => typeof e == "string" ? {
154
+ hex: e,
155
+ label: e
156
+ } : e) : h, J = d(P), Y = p(P), X = (e, t) => {
157
+ if (!J) return;
158
+ let n = parseInt(t, 10);
159
+ if (isNaN(n)) return;
160
+ let r = Math.max(0, Math.min(255, n));
161
+ H(f(e === "r" ? r : J.r, e === "g" ? r : J.g, e === "b" ? r : J.b));
162
+ }, Z = (e, t) => {
163
+ if (!Y) return;
164
+ let n = parseInt(t, 10);
165
+ if (isNaN(n)) return;
166
+ let r = Math.max(0, Math.min(e === "h" ? 360 : 100, n));
167
+ H(m(e === "h" ? r : Y.h, e === "s" ? r : Y.s, e === "l" ? r : Y.l));
168
+ }, Q = [
169
+ "hex",
170
+ "rgb",
171
+ "hsl"
172
+ ];
173
+ return /* @__PURE__ */ l("div", {
174
+ ref: O,
175
+ className: r("inline-flex flex-col", E),
176
+ ...D,
177
+ children: /* @__PURE__ */ u(s, {
178
+ open: j,
179
+ onOpenChange: V,
180
+ children: [/* @__PURE__ */ l(a, {
181
+ asChild: !0,
182
+ children: T === "inline" ? /* @__PURE__ */ l(e.button, {
183
+ type: "button",
184
+ disabled: x,
185
+ className: r("group flex items-center justify-center rounded-ds-md px-ds-04 py-ds-02 font-mono text-ds-sm font-medium", "focus:outline-hidden focus:ring-2 focus:ring-accent-9 focus:ring-offset-2 focus:ring-offset-surface-base", x && "cursor-not-allowed opacity-50"),
186
+ animate: {
187
+ backgroundColor: P,
188
+ color: g(P) ? "rgba(0,0,0,0.8)" : "rgba(255,255,255,0.95)"
189
+ },
190
+ whileHover: {
191
+ y: -1,
192
+ boxShadow: "0 4px 12px rgba(0,0,0,0.12)"
193
+ },
194
+ whileTap: { scale: .97 },
195
+ transition: n.smooth,
196
+ "aria-label": `Color picker: ${P}`,
197
+ children: P.toUpperCase()
198
+ }) : /* @__PURE__ */ u(e.button, {
199
+ type: "button",
200
+ disabled: x,
201
+ className: r("group relative flex items-center overflow-hidden rounded-ds-md border border-surface-border-strong", "hover:border-accent-7 focus:border-accent-7 focus:outline-hidden focus:ring-1 focus:ring-accent-9", x && "cursor-not-allowed opacity-50"),
202
+ whileHover: { scale: 1.02 },
203
+ whileTap: { scale: .98 },
204
+ transition: n.snappy,
205
+ "aria-label": `Color picker: ${P}`,
206
+ children: [
207
+ /* @__PURE__ */ l(e.span, {
208
+ className: "absolute inset-0",
209
+ animate: { background: `linear-gradient(to right, ${P} 0%, ${P} 35%, transparent 70%)` },
210
+ transition: { duration: .3 }
211
+ }),
212
+ /* @__PURE__ */ l("span", {
213
+ className: "absolute inset-0 bg-surface-overlay/60",
214
+ style: {
215
+ maskImage: "linear-gradient(to right, transparent 0%, black 40%)",
216
+ WebkitMaskImage: "linear-gradient(to right, transparent 0%, black 40%)"
217
+ }
218
+ }),
219
+ /* @__PURE__ */ l("span", {
220
+ className: "relative z-10 py-ds-02 pl-6 pr-ds-03 font-mono text-ds-sm text-surface-fg",
221
+ children: P.toUpperCase()
222
+ })
223
+ ]
224
+ })
225
+ }), /* @__PURE__ */ l(o, {
226
+ align: w,
227
+ sideOffset: 8,
228
+ className: "w-[272px] rounded-ds-xl border border-surface-border-strong bg-surface-overlay p-0 shadow-floating",
229
+ children: /* @__PURE__ */ u("div", {
230
+ className: "flex flex-col",
231
+ children: [
232
+ S && /* @__PURE__ */ l("div", {
233
+ className: "p-ds-04 pb-ds-03",
234
+ onPointerUp: W,
235
+ onPointerLeave: W,
236
+ children: /* @__PURE__ */ l(i, {
237
+ color: P,
238
+ onChange: U,
239
+ className: "w-full!",
240
+ style: { height: 160 }
241
+ })
242
+ }),
243
+ /* @__PURE__ */ u("div", {
244
+ className: "border-t border-surface-border px-ds-04 py-ds-03",
245
+ children: [/* @__PURE__ */ l("div", {
246
+ className: "mb-ds-03 flex items-center gap-ds-01",
247
+ children: Q.map((t) => /* @__PURE__ */ u("button", {
248
+ type: "button",
249
+ onClick: () => A(t),
250
+ className: r("relative min-h-6 rounded-ds-sm px-ds-02 py-px text-ds-xs font-semibold uppercase tracking-wider transition-colors", k === t ? "text-accent-11" : "text-surface-fg-muted hover:text-surface-fg"),
251
+ children: [k === t && /* @__PURE__ */ l(e.span, {
252
+ layoutId: `color-input-format-pill-${N}`,
253
+ className: "absolute inset-0 rounded-ds-sm bg-accent-3",
254
+ transition: n.snappy
255
+ }), /* @__PURE__ */ l("span", {
256
+ className: "relative z-10",
257
+ children: t
258
+ })]
259
+ }, t))
260
+ }), /* @__PURE__ */ u(t, {
261
+ mode: "wait",
262
+ children: [
263
+ k === "hex" && /* @__PURE__ */ l(e.div, {
264
+ initial: {
265
+ opacity: 0,
266
+ y: 4
267
+ },
268
+ animate: {
269
+ opacity: 1,
270
+ y: 0
271
+ },
272
+ exit: {
273
+ opacity: 0,
274
+ y: -4
275
+ },
276
+ transition: { duration: .15 },
277
+ className: "flex gap-ds-02",
278
+ children: /* @__PURE__ */ l(_, {
279
+ id: `${N}-hex`,
280
+ label: "Hex",
281
+ value: P.replace("#", "").toUpperCase(),
282
+ onChange: (e) => {
283
+ let t = e.replace(/[^0-9a-fA-F]/g, "").slice(0, 6);
284
+ t.length === 6 && H(`#${t}`);
285
+ },
286
+ onBlur: () => {
287
+ P.replace("#", "").toUpperCase().length !== 6 && F(P);
288
+ },
289
+ disabled: x,
290
+ maxLength: 6,
291
+ prefix: "#",
292
+ className: "flex-1"
293
+ })
294
+ }, "hex"),
295
+ k === "rgb" && J && /* @__PURE__ */ u(e.div, {
296
+ initial: {
297
+ opacity: 0,
298
+ y: 4
299
+ },
300
+ animate: {
301
+ opacity: 1,
302
+ y: 0
303
+ },
304
+ exit: {
305
+ opacity: 0,
306
+ y: -4
307
+ },
308
+ transition: { duration: .15 },
309
+ className: "flex gap-ds-02",
310
+ children: [
311
+ /* @__PURE__ */ l(_, {
312
+ id: `${N}-r`,
313
+ label: "R",
314
+ value: String(J.r),
315
+ onChange: (e) => X("r", e),
316
+ disabled: x,
317
+ className: "flex-1"
318
+ }),
319
+ /* @__PURE__ */ l(_, {
320
+ id: `${N}-g`,
321
+ label: "G",
322
+ value: String(J.g),
323
+ onChange: (e) => X("g", e),
324
+ disabled: x,
325
+ className: "flex-1"
326
+ }),
327
+ /* @__PURE__ */ l(_, {
328
+ id: `${N}-b`,
329
+ label: "B",
330
+ value: String(J.b),
331
+ onChange: (e) => X("b", e),
332
+ disabled: x,
333
+ className: "flex-1"
334
+ })
335
+ ]
336
+ }, "rgb"),
337
+ k === "hsl" && Y && /* @__PURE__ */ u(e.div, {
338
+ initial: {
339
+ opacity: 0,
340
+ y: 4
341
+ },
342
+ animate: {
343
+ opacity: 1,
344
+ y: 0
345
+ },
346
+ exit: {
347
+ opacity: 0,
348
+ y: -4
349
+ },
350
+ transition: { duration: .15 },
351
+ className: "flex gap-ds-02",
352
+ children: [
353
+ /* @__PURE__ */ l(_, {
354
+ id: `${N}-h`,
355
+ label: "H",
356
+ value: String(Y.h),
357
+ onChange: (e) => Z("h", e),
358
+ disabled: x,
359
+ className: "flex-1"
360
+ }),
361
+ /* @__PURE__ */ l(_, {
362
+ id: `${N}-s`,
363
+ label: "S",
364
+ value: String(Y.s),
365
+ onChange: (e) => Z("s", e),
366
+ disabled: x,
367
+ className: "flex-1"
368
+ }),
369
+ /* @__PURE__ */ l(_, {
370
+ id: `${N}-l`,
371
+ label: "L",
372
+ value: String(Y.l),
373
+ onChange: (e) => Z("l", e),
374
+ disabled: x,
375
+ className: "flex-1"
376
+ })
377
+ ]
378
+ }, "hsl")
379
+ ]
380
+ })]
381
+ }),
382
+ q.length > 0 && /* @__PURE__ */ l("div", {
383
+ className: "border-t border-surface-border px-ds-04 py-ds-03",
384
+ children: /* @__PURE__ */ l("div", {
385
+ className: "flex flex-wrap gap-ds-02",
386
+ children: q.map((t, i) => {
387
+ let a = P.toLowerCase() === t.hex.toLowerCase();
388
+ return /* @__PURE__ */ l(e.button, {
389
+ type: "button",
390
+ disabled: x,
391
+ onClick: () => H(t.hex),
392
+ initial: {
393
+ opacity: 0,
394
+ scale: .8
395
+ },
396
+ animate: {
397
+ opacity: 1,
398
+ scale: a ? 1.15 : 1
399
+ },
400
+ whileHover: { scale: a ? 1.15 : 1.1 },
401
+ whileTap: { scale: .9 },
402
+ transition: {
403
+ ...n.bouncy,
404
+ delay: i * .02
405
+ },
406
+ className: r("h-6 w-6 rounded-ds-sm border", a ? "border-accent-7 ring-2 ring-accent-9/30" : "border-surface-border hover:border-surface-border-strong", x && "cursor-not-allowed opacity-50"),
407
+ style: { backgroundColor: t.hex },
408
+ title: t.label,
409
+ "aria-label": `${t.label}: ${t.hex}`
410
+ }, t.hex);
411
+ })
412
+ })
413
+ }),
414
+ (R.length > 0 || P !== I) && /* @__PURE__ */ u(e.div, {
415
+ initial: {
416
+ opacity: 0,
417
+ height: 0
418
+ },
419
+ animate: {
420
+ opacity: 1,
421
+ height: "auto"
422
+ },
423
+ exit: {
424
+ opacity: 0,
425
+ height: 0
426
+ },
427
+ className: "flex items-center gap-ds-02 border-t border-surface-border px-ds-04 py-ds-02",
428
+ children: [
429
+ /* @__PURE__ */ l("span", {
430
+ className: "h-4 w-4 shrink-0 rounded-full border border-surface-border",
431
+ style: { backgroundColor: I },
432
+ title: `Original: ${I}`
433
+ }),
434
+ /* @__PURE__ */ l("span", {
435
+ className: "text-ds-xs text-surface-fg-muted",
436
+ children: I.toUpperCase()
437
+ }),
438
+ /* @__PURE__ */ l("span", { className: "flex-1" }),
439
+ R.length > 0 && /* @__PURE__ */ l("button", {
440
+ type: "button",
441
+ onClick: G,
442
+ className: "min-h-6 rounded-ds-sm px-ds-02 py-px text-ds-xs font-medium text-surface-fg-muted transition-colors hover:text-surface-fg",
443
+ children: "Undo"
444
+ }),
445
+ P !== I && /* @__PURE__ */ l("button", {
446
+ type: "button",
447
+ onClick: K,
448
+ className: "min-h-6 rounded-ds-sm px-ds-02 py-px text-ds-xs font-medium text-surface-fg-muted transition-colors hover:text-error-11",
449
+ children: "Reset"
450
+ })
451
+ ]
452
+ })
453
+ ]
454
+ })
455
+ })]
456
+ })
457
+ });
458
+ });
459
+ v.displayName = "ColorInput";
460
+ //#endregion
461
+ export { v as ColorInput };