@devalok/shilp-sutra 0.34.0 → 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.
- package/dist/_chunks/badge-group.js +306 -246
- package/dist/_chunks/chat.js +513 -0
- package/dist/_chunks/date-picker.js +748 -0
- package/dist/_chunks/document-preview.js +109 -90
- package/dist/_chunks/file-preview.js +492 -504
- package/dist/_chunks/framer.js +5564 -5613
- package/dist/_chunks/image-preview.js +127 -88
- package/dist/_chunks/keybinding.js +12 -14
- package/dist/_chunks/link-context.js +19 -16
- package/dist/_chunks/mention-suggestion.js +353 -350
- package/dist/_chunks/motion-provider.js +26 -20
- package/dist/_chunks/popover.js +127 -0
- package/dist/_chunks/primitives.js +7584 -6425
- package/dist/_chunks/rich-chat-input.js +2070 -0
- package/dist/_chunks/rolldown-runtime.js +21 -0
- package/dist/_chunks/shared.js +126 -0
- package/dist/_chunks/sonner.js +605 -734
- package/dist/_chunks/stat-row.js +418 -440
- package/dist/_chunks/tiptap.js +15850 -19964
- package/dist/_chunks/tree-view.js +231 -290
- package/dist/_chunks/use-calendar.js +161 -208
- package/dist/_chunks/vendor-client.js +314 -2199
- package/dist/_chunks/vendor-utils.js +1721 -2978
- package/dist/ai/ai-command-provider.js +23 -17
- package/dist/ai/block-renderer.js +68 -51
- package/dist/ai/blocks/index.js +2 -12
- package/dist/ai/command-bar.js +470 -519
- package/dist/ai/conversation.js +241 -227
- package/dist/ai/index.js +181 -167
- package/dist/ai/types.js +0 -1
- package/dist/composed/activity-feed.js +232 -202
- package/dist/composed/avatar-group.js +164 -222
- package/dist/composed/bulk-action-bar.js +174 -165
- package/dist/composed/command-palette.js +290 -308
- package/dist/composed/confirm-dialog.js +28 -48
- package/dist/composed/content-card.js +69 -108
- package/dist/composed/date-picker/index.js +3 -13
- package/dist/composed/deadline-indicator.js +68 -74
- package/dist/composed/emoji-picker.js +83 -110
- package/dist/composed/empty-state.js +64 -103
- package/dist/composed/error-boundary.js +129 -127
- package/dist/composed/file-preview.js +2 -12
- package/dist/composed/filter-bar.js +98 -130
- package/dist/composed/form-section.js +61 -45
- package/dist/composed/global-loading.js +34 -47
- package/dist/composed/index.js +34 -92
- package/dist/composed/inline-edit.js +92 -107
- package/dist/composed/lib/string-utils.js +8 -8
- package/dist/composed/loading-skeleton.js +103 -171
- package/dist/composed/markdown-viewer.js +187 -139
- package/dist/composed/master-detail.js +147 -156
- package/dist/composed/member-picker.js +46 -49
- package/dist/composed/multi-select-popover.js +181 -179
- package/dist/composed/page-header.js +54 -76
- package/dist/composed/page-skeletons.js +143 -127
- package/dist/composed/priority-indicator.js +105 -111
- package/dist/composed/responsive-overlay.js +36 -41
- package/dist/composed/rich-chat-input.js +2 -1860
- package/dist/composed/rich-text-editor.js +561 -424
- package/dist/composed/schedule-view.js +134 -185
- package/dist/composed/simple-tooltip.js +21 -21
- package/dist/composed/status-badge.js +133 -137
- package/dist/hooks/index.js +7 -12
- package/dist/hooks/use-color-mode.js +28 -25
- package/dist/hooks/use-mobile.js +13 -13
- package/dist/hooks/use-toast.js +2 -4
- package/dist/hooks/use-touch-device.js +9 -11
- package/dist/hooks/use-viewport-height.js +14 -14
- package/dist/motion/index.js +3 -11
- package/dist/motion/primitives-index.js +226 -186
- package/dist/shell/app-command-palette.js +203 -234
- package/dist/shell/bottom-navbar.js +150 -190
- package/dist/shell/command-registry.js +13 -14
- package/dist/shell/index.js +10 -20
- package/dist/shell/link-context.js +2 -5
- package/dist/shell/notification-center.js +238 -259
- package/dist/shell/notification-preferences.js +241 -184
- package/dist/shell/sidebar.js +251 -281
- package/dist/shell/top-bar.js +203 -237
- package/dist/tailwind/index.cjs +426 -442
- package/dist/tailwind/index.js +2 -4
- package/dist/tailwind/preset.js +443 -459
- package/dist/ui/accordion.js +52 -60
- package/dist/ui/alert-dialog.js +111 -156
- package/dist/ui/alert.js +177 -99
- package/dist/ui/aspect-ratio.js +13 -16
- package/dist/ui/autocomplete.js +112 -148
- package/dist/ui/avatar.js +196 -169
- package/dist/ui/badge-group.js +2 -7
- package/dist/ui/badge-indicator.js +42 -51
- package/dist/ui/badge.js +2 -15
- package/dist/ui/banner.js +76 -68
- package/dist/ui/breadcrumb.js +65 -84
- package/dist/ui/button-group.js +109 -102
- package/dist/ui/button-processing.js +69 -73
- package/dist/ui/button.js +393 -279
- package/dist/ui/card.js +151 -157
- package/dist/ui/charts/index.js +1002 -1319
- package/dist/ui/chat/index.js +2 -11
- package/dist/ui/checkbox.js +77 -100
- package/dist/ui/code.js +18 -32
- package/dist/ui/collapsible.js +21 -29
- package/dist/ui/color-input.js +453 -372
- package/dist/ui/color-swatch.js +60 -90
- package/dist/ui/combobox.js +244 -293
- package/dist/ui/container.js +18 -24
- package/dist/ui/context-menu.js +154 -203
- package/dist/ui/data-table-body.js +116 -213
- package/dist/ui/data-table-bulk-actions.js +43 -59
- package/dist/ui/data-table-card.js +84 -71
- package/dist/ui/data-table-context.js +39 -42
- package/dist/ui/data-table-header.js +98 -139
- package/dist/ui/data-table-pagination.js +69 -82
- package/dist/ui/data-table-toolbar.js +104 -130
- package/dist/ui/data-table.js +278 -354
- package/dist/ui/devalok-grain.js +77 -66
- package/dist/ui/dialog.js +122 -151
- package/dist/ui/dropdown-menu.js +152 -203
- package/dist/ui/file-upload.js +242 -266
- package/dist/ui/form.js +60 -56
- package/dist/ui/hover-card.js +54 -54
- package/dist/ui/icon-button.js +21 -26
- package/dist/ui/icon-context.js +17 -17
- package/dist/ui/icon-group.js +22 -29
- package/dist/ui/icon.js +201 -121
- package/dist/ui/index.js +74 -350
- package/dist/ui/input-otp.js +44 -48
- package/dist/ui/input.js +92 -169
- package/dist/ui/label.js +17 -22
- package/dist/ui/lib/date-utils.js +14 -11
- package/dist/ui/lib/motion.js +77 -36
- package/dist/ui/lib/utils.js +39 -16
- package/dist/ui/link.js +13 -24
- package/dist/ui/menubar.js +132 -210
- package/dist/ui/navigation-menu.js +163 -193
- package/dist/ui/number-input.js +72 -95
- package/dist/ui/pagination.js +122 -159
- package/dist/ui/popover.js +2 -131
- package/dist/ui/progress-ring.js +133 -143
- package/dist/ui/progress.js +51 -95
- package/dist/ui/radio.js +41 -50
- package/dist/ui/search-input.js +51 -53
- package/dist/ui/segmented-control.js +93 -114
- package/dist/ui/select.js +131 -157
- package/dist/ui/separator.js +15 -25
- package/dist/ui/sheet.js +135 -163
- package/dist/ui/sidebar.js +357 -600
- package/dist/ui/skeleton.js +179 -231
- package/dist/ui/slider.js +24 -34
- package/dist/ui/spinner.js +226 -205
- package/dist/ui/split-button.js +227 -276
- package/dist/ui/stack.js +56 -70
- package/dist/ui/stat-card.js +259 -251
- package/dist/ui/status-dot.js +67 -63
- package/dist/ui/stepper.js +119 -168
- package/dist/ui/switch.js +51 -54
- package/dist/ui/table.js +57 -90
- package/dist/ui/tabs.js +139 -156
- package/dist/ui/text.js +52 -59
- package/dist/ui/textarea.js +40 -57
- package/dist/ui/toast-types.js +0 -1
- package/dist/ui/toast.js +554 -536
- package/dist/ui/toaster.js +23 -33
- package/dist/ui/toggle-group.js +37 -41
- package/dist/ui/toggle.js +36 -40
- package/dist/ui/tooltip.js +80 -65
- package/dist/ui/tree-view/index.js +2 -6
- package/dist/ui/visually-hidden.js +12 -10
- package/llms-full.txt +1 -1
- package/package.json +1 -1
- package/dist/_chunks/date-time-picker.js +0 -851
- package/dist/_chunks/typing-indicator.js +0 -565
package/dist/ui/color-input.js
CHANGED
|
@@ -1,380 +1,461 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
16
|
-
|
|
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
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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-hidden 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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
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 };
|