@devalok/shilp-sutra 0.28.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/badge-group.js +299 -0
- package/dist/_chunks/framer.js +1915 -1980
- package/dist/_chunks/keybinding.js +4 -5
- package/dist/_chunks/primitives.js +3198 -3272
- package/dist/_chunks/sonner.js +29 -31
- package/dist/_chunks/stat-row.js +110 -131
- package/dist/_chunks/tiptap.js +42 -78
- package/dist/_chunks/tree-view.js +138 -149
- package/dist/_chunks/typing-indicator.js +565 -0
- package/dist/_chunks/use-calendar.js +416 -439
- package/dist/_chunks/vendor-client.js +5 -5
- package/dist/_chunks/vendor-utils.js +5 -5
- package/dist/ai/block-renderer.js +22 -22
- package/dist/ai/blocks/loading.d.ts.map +1 -1
- package/dist/ai/command-bar.d.ts.map +1 -1
- package/dist/ai/command-bar.js +241 -263
- package/dist/ai/conversation.d.ts.map +1 -1
- package/dist/ai/conversation.js +87 -107
- package/dist/composed/activity-feed.d.ts +2 -0
- package/dist/composed/activity-feed.d.ts.map +1 -1
- package/dist/composed/activity-feed.js +118 -90
- package/dist/composed/avatar-group.d.ts +1 -0
- package/dist/composed/avatar-group.d.ts.map +1 -1
- package/dist/composed/avatar-group.js +91 -67
- package/dist/composed/bulk-action-bar.d.ts.map +1 -1
- package/dist/composed/bulk-action-bar.js +29 -28
- package/dist/composed/command-palette.d.ts.map +1 -1
- package/dist/composed/command-palette.js +99 -113
- package/dist/composed/content-card.js +1 -1
- package/dist/composed/date-picker/calendar-grid.d.ts.map +1 -1
- package/dist/composed/date-picker/date-picker.d.ts.map +1 -1
- package/dist/composed/date-picker/date-range-picker.d.ts.map +1 -1
- package/dist/composed/date-picker/date-time-picker.d.ts.map +1 -1
- package/dist/composed/date-picker/time-picker.d.ts.map +1 -1
- package/dist/composed/deadline-indicator.d.ts.map +1 -1
- package/dist/composed/deadline-indicator.js +29 -28
- package/dist/composed/error-boundary.d.ts.map +1 -1
- package/dist/composed/error-boundary.js +30 -27
- package/dist/composed/extensions/file-attachment.d.ts.map +1 -1
- package/dist/composed/file-preview.d.ts.map +1 -1
- package/dist/composed/file-preview.js +261 -271
- package/dist/composed/filter-bar.d.ts.map +1 -1
- package/dist/composed/filter-bar.js +49 -48
- package/dist/composed/form-section.d.ts.map +1 -1
- package/dist/composed/form-section.js +12 -11
- package/dist/composed/global-loading.js +1 -1
- package/dist/composed/index.js +63 -63
- package/dist/composed/inline-edit.d.ts.map +1 -1
- package/dist/composed/inline-edit.js +55 -54
- package/dist/composed/markdown-viewer.d.ts.map +1 -1
- package/dist/composed/markdown-viewer.js +44 -43
- package/dist/composed/master-detail.d.ts.map +1 -1
- package/dist/composed/master-detail.js +35 -34
- package/dist/composed/multi-select-popover.d.ts.map +1 -1
- package/dist/composed/multi-select-popover.js +73 -73
- package/dist/composed/page-header.d.ts.map +1 -1
- package/dist/composed/page-header.js +31 -37
- package/dist/composed/priority-indicator.d.ts.map +1 -1
- package/dist/composed/priority-indicator.js +37 -36
- package/dist/composed/rich-text-editor.d.ts.map +1 -1
- package/dist/composed/rich-text-editor.js +287 -306
- package/dist/composed/schedule-view.js +62 -62
- package/dist/composed/status-badge.d.ts +4 -2
- package/dist/composed/status-badge.d.ts.map +1 -1
- package/dist/composed/status-badge.js +58 -45
- package/dist/shell/app-command-palette.d.ts.map +1 -1
- package/dist/shell/app-command-palette.js +93 -93
- package/dist/shell/bottom-navbar.d.ts.map +1 -1
- package/dist/shell/bottom-navbar.js +21 -20
- package/dist/shell/index.js +18 -18
- package/dist/shell/notification-center.d.ts.map +1 -1
- package/dist/shell/notification-center.js +96 -95
- package/dist/shell/notification-preferences.d.ts.map +1 -1
- package/dist/shell/notification-preferences.js +82 -85
- package/dist/shell/sidebar.js +59 -60
- package/dist/shell/top-bar.d.ts.map +1 -1
- package/dist/shell/top-bar.js +103 -103
- package/dist/tailwind/index.cjs +37 -4
- package/dist/tailwind/preset.d.ts.map +1 -1
- package/dist/tailwind/preset.js +38 -5
- package/dist/tokens/primitives.css +10 -0
- package/dist/tokens/semantic.css +70 -7
- package/dist/ui/accordion.d.ts +5 -2
- package/dist/ui/accordion.d.ts.map +1 -1
- package/dist/ui/accordion.js +44 -39
- package/dist/ui/alert-dialog.js +57 -57
- package/dist/ui/alert.d.ts +1 -1
- package/dist/ui/alert.d.ts.map +1 -1
- package/dist/ui/alert.js +30 -29
- package/dist/ui/aspect-ratio.js +4 -4
- package/dist/ui/autocomplete.js +56 -56
- package/dist/ui/avatar.js +2 -2
- package/dist/ui/badge-group.d.ts +22 -0
- package/dist/ui/badge-group.d.ts.map +1 -0
- package/dist/ui/badge-group.js +8 -0
- package/dist/ui/badge-indicator.d.ts +32 -0
- package/dist/ui/badge-indicator.d.ts.map +1 -0
- package/dist/ui/badge-indicator.js +54 -0
- package/dist/ui/badge.d.ts +27 -24
- package/dist/ui/badge.d.ts.map +1 -1
- package/dist/ui/badge.js +13 -129
- package/dist/ui/banner.d.ts +1 -1
- package/dist/ui/banner.d.ts.map +1 -1
- package/dist/ui/banner.js +27 -26
- package/dist/ui/breadcrumb.d.ts.map +1 -1
- package/dist/ui/breadcrumb.js +37 -36
- package/dist/ui/button-group.d.ts +12 -6
- package/dist/ui/button-group.d.ts.map +1 -1
- package/dist/ui/button-group.js +18 -18
- package/dist/ui/button-processing.d.ts +15 -0
- package/dist/ui/button-processing.d.ts.map +1 -0
- package/dist/ui/button-processing.js +77 -0
- package/dist/ui/button.d.ts +50 -25
- package/dist/ui/button.d.ts.map +1 -1
- package/dist/ui/button.js +243 -127
- package/dist/ui/card.js +20 -21
- package/dist/ui/charts/index.js +499 -508
- package/dist/ui/chat/date-separator.d.ts +12 -0
- package/dist/ui/chat/date-separator.d.ts.map +1 -0
- package/dist/ui/chat/index.d.ts +9 -0
- package/dist/ui/chat/index.d.ts.map +1 -0
- package/dist/ui/chat/index.js +12 -0
- package/dist/ui/chat/message-input.d.ts +16 -0
- package/dist/ui/chat/message-input.d.ts.map +1 -0
- package/dist/ui/chat/message-list.d.ts +24 -0
- package/dist/ui/chat/message-list.d.ts.map +1 -0
- package/dist/ui/chat/message.d.ts +108 -0
- package/dist/ui/chat/message.d.ts.map +1 -0
- package/dist/ui/chat/system-message.d.ts +11 -0
- package/dist/ui/chat/system-message.d.ts.map +1 -0
- package/dist/ui/chat/typing-indicator.d.ts +14 -0
- package/dist/ui/chat/typing-indicator.d.ts.map +1 -0
- package/dist/ui/chat/unread-separator.d.ts +12 -0
- package/dist/ui/chat/unread-separator.d.ts.map +1 -0
- package/dist/ui/checkbox.js +18 -18
- package/dist/ui/chip.d.ts +13 -62
- package/dist/ui/chip.d.ts.map +1 -1
- package/dist/ui/chip.js +10 -109
- package/dist/ui/collapsible.js +4 -4
- package/dist/ui/color-input.js +134 -134
- package/dist/ui/color-swatch.js +11 -11
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/combobox.js +74 -80
- package/dist/ui/context-menu.d.ts.map +1 -1
- package/dist/ui/context-menu.js +86 -85
- package/dist/ui/data-table-toolbar.d.ts.map +1 -1
- package/dist/ui/data-table-toolbar.js +51 -57
- package/dist/ui/data-table.d.ts.map +1 -1
- package/dist/ui/data-table.js +268 -296
- package/dist/ui/devalok-grain.d.ts +81 -0
- package/dist/ui/devalok-grain.d.ts.map +1 -0
- package/dist/ui/devalok-grain.js +69 -0
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +73 -72
- package/dist/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/ui/dropdown-menu.js +93 -92
- package/dist/ui/file-upload.d.ts.map +1 -1
- package/dist/ui/file-upload.js +82 -82
- package/dist/ui/hover-card.js +29 -29
- package/dist/ui/icon-button.d.ts +7 -7
- package/dist/ui/icon-button.d.ts.map +1 -1
- package/dist/ui/icon-context.d.ts +15 -0
- package/dist/ui/icon-context.d.ts.map +1 -0
- package/dist/ui/icon-context.js +20 -0
- package/dist/ui/icon-group.d.ts +22 -0
- package/dist/ui/icon-group.d.ts.map +1 -0
- package/dist/ui/icon-group.js +32 -0
- package/dist/ui/icon.d.ts +57 -0
- package/dist/ui/icon.d.ts.map +1 -0
- package/dist/ui/icon.js +122 -0
- package/dist/ui/index.d.ts +8 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +351 -329
- package/dist/ui/input-otp.d.ts.map +1 -1
- package/dist/ui/input-otp.js +21 -20
- package/dist/ui/input.d.ts +32 -11
- package/dist/ui/input.d.ts.map +1 -1
- package/dist/ui/input.js +149 -44
- package/dist/ui/lib/motion.d.ts +2 -0
- package/dist/ui/lib/motion.d.ts.map +1 -1
- package/dist/ui/lib/motion.js +13 -11
- package/dist/ui/lib/utils.js +1 -1
- package/dist/ui/menubar.d.ts.map +1 -1
- package/dist/ui/menubar.js +87 -86
- package/dist/ui/navigation-menu.d.ts.map +1 -1
- package/dist/ui/navigation-menu.js +23 -28
- package/dist/ui/number-input.d.ts.map +1 -1
- package/dist/ui/number-input.js +54 -53
- package/dist/ui/pagination.d.ts.map +1 -1
- package/dist/ui/pagination.js +45 -44
- package/dist/ui/popover.js +28 -28
- package/dist/ui/progress.d.ts +3 -1
- package/dist/ui/progress.d.ts.map +1 -1
- package/dist/ui/progress.js +43 -39
- package/dist/ui/search-input.d.ts.map +1 -1
- package/dist/ui/search-input.js +47 -60
- package/dist/ui/segmented-control.js +1 -1
- package/dist/ui/select.d.ts.map +1 -1
- package/dist/ui/select.js +54 -53
- package/dist/ui/sheet.d.ts.map +1 -1
- package/dist/ui/sheet.js +46 -45
- package/dist/ui/sidebar.d.ts.map +1 -1
- package/dist/ui/sidebar.js +196 -193
- package/dist/ui/skeleton.js +1 -1
- package/dist/ui/spinner.js +74 -74
- package/dist/ui/stat-card.d.ts.map +1 -1
- package/dist/ui/stat-card.js +85 -86
- package/dist/ui/switch.d.ts +3 -0
- package/dist/ui/switch.d.ts.map +1 -1
- package/dist/ui/switch.js +41 -27
- package/dist/ui/tabs.js +43 -43
- package/dist/ui/text.js +1 -1
- package/dist/ui/textarea.js +10 -10
- package/dist/ui/toast.d.ts.map +1 -1
- package/dist/ui/toast.js +169 -169
- package/dist/ui/toggle.js +4 -4
- package/dist/ui/tooltip.js +40 -40
- package/dist/ui/tree-view/tree-item.d.ts.map +1 -1
- package/docs/components/_header.md +4 -4
- package/docs/components/composed/activity-feed.md +7 -0
- package/docs/components/composed/avatar-group.md +8 -5
- package/docs/components/composed/status-badge.md +14 -1
- package/docs/components/ui/accordion.md +5 -2
- package/docs/components/ui/badge-group.md +38 -0
- package/docs/components/ui/badge-indicator.md +40 -0
- package/docs/components/ui/badge.md +36 -5
- package/docs/components/ui/button-processing.md +15 -0
- package/docs/components/ui/button.md +40 -11
- package/docs/components/ui/chat.md +214 -0
- package/docs/components/ui/data-table.md +3 -0
- package/docs/components/ui/devalok-grain.md +55 -0
- package/docs/components/ui/icon-button.md +12 -5
- package/docs/components/ui/icon-context.md +38 -0
- package/docs/components/ui/icon-group.md +36 -0
- package/docs/components/ui/icon.md +47 -0
- package/docs/components/ui/input.md +32 -6
- package/docs/components/ui/progress.md +5 -0
- package/docs/components/ui/spinner.md +3 -0
- package/docs/components/ui/switch.md +13 -0
- package/llms-full.txt +666 -40
- package/llms.txt +37 -18
- package/package.json +7 -2
package/dist/ui/color-input.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import * as
|
|
2
|
+
import { jsx as r, jsxs as f } from "react/jsx-runtime";
|
|
3
|
+
import * as g from "react";
|
|
4
4
|
import { Z as K } from "../_chunks/vendor-client.js";
|
|
5
5
|
import { cn as k } from "./lib/utils.js";
|
|
6
6
|
import { springs as R } from "./lib/motion.js";
|
|
7
7
|
import { Popover as Q, PopoverTrigger as X, PopoverContent as Y } from "./popover.js";
|
|
8
|
-
import { m as
|
|
8
|
+
import { m as x, A as V } from "../_chunks/framer.js";
|
|
9
9
|
function B(l) {
|
|
10
|
-
const
|
|
11
|
-
if (!
|
|
12
|
-
const
|
|
13
|
-
return { r:
|
|
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 };
|
|
14
14
|
}
|
|
15
|
-
function O(l,
|
|
16
|
-
return "#" + [l,
|
|
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("");
|
|
17
17
|
}
|
|
18
18
|
function ee(l) {
|
|
19
|
-
const
|
|
20
|
-
if (!
|
|
21
|
-
const
|
|
22
|
-
if (c ===
|
|
23
|
-
const
|
|
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
24
|
let M = 0;
|
|
25
|
-
return c ===
|
|
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) };
|
|
26
26
|
}
|
|
27
|
-
function te(l,
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
return Math.round(255 *
|
|
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
31
|
};
|
|
32
|
-
return O(
|
|
32
|
+
return O(s(0), s(8), s(4));
|
|
33
33
|
}
|
|
34
34
|
const re = [
|
|
35
35
|
{ hex: "#EF4444", label: "Red" },
|
|
@@ -44,38 +44,38 @@ const re = [
|
|
|
44
44
|
{ hex: "#6366F1", label: "Indigo" }
|
|
45
45
|
];
|
|
46
46
|
function ae(l) {
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
49
|
-
const [
|
|
50
|
-
const
|
|
51
|
-
return
|
|
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
52
|
});
|
|
53
|
-
return 0.2126 *
|
|
53
|
+
return 0.2126 * o + 0.7152 * t + 0.0722 * i > 0.4;
|
|
54
54
|
}
|
|
55
55
|
function w({
|
|
56
56
|
label: l,
|
|
57
|
-
value:
|
|
58
|
-
onChange:
|
|
59
|
-
onBlur:
|
|
57
|
+
value: a,
|
|
58
|
+
onChange: o,
|
|
59
|
+
onBlur: t,
|
|
60
60
|
disabled: i,
|
|
61
61
|
maxLength: c = 3,
|
|
62
|
-
prefix:
|
|
63
|
-
className:
|
|
64
|
-
id:
|
|
62
|
+
prefix: s,
|
|
63
|
+
className: p,
|
|
64
|
+
id: h
|
|
65
65
|
}) {
|
|
66
|
-
return /* @__PURE__ */
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
|
|
70
|
-
/* @__PURE__ */
|
|
66
|
+
return /* @__PURE__ */ f("div", { className: k("flex flex-col gap-ds-01", p), children: [
|
|
67
|
+
/* @__PURE__ */ r("label", { htmlFor: h, className: "text-[10px] 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
71
|
"input",
|
|
72
72
|
{
|
|
73
|
-
id:
|
|
73
|
+
id: h,
|
|
74
74
|
type: "text",
|
|
75
|
-
value:
|
|
75
|
+
value: a,
|
|
76
76
|
disabled: i,
|
|
77
|
-
onChange: (
|
|
78
|
-
onBlur:
|
|
77
|
+
onChange: (N) => o(N.target.value),
|
|
78
|
+
onBlur: t,
|
|
79
79
|
maxLength: c,
|
|
80
80
|
className: k(
|
|
81
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",
|
|
@@ -87,46 +87,46 @@ function w({
|
|
|
87
87
|
] })
|
|
88
88
|
] });
|
|
89
89
|
}
|
|
90
|
-
const
|
|
90
|
+
const ne = g.forwardRef(
|
|
91
91
|
({
|
|
92
92
|
value: l = "#000000",
|
|
93
|
-
onChange:
|
|
94
|
-
presets:
|
|
95
|
-
disabled:
|
|
93
|
+
onChange: a,
|
|
94
|
+
presets: o,
|
|
95
|
+
disabled: t = !1,
|
|
96
96
|
showPicker: i = !0,
|
|
97
97
|
defaultFormat: c = "hex",
|
|
98
|
-
align:
|
|
99
|
-
variant:
|
|
100
|
-
className:
|
|
101
|
-
...
|
|
98
|
+
align: s = "start",
|
|
99
|
+
variant: p = "default",
|
|
100
|
+
className: h,
|
|
101
|
+
...N
|
|
102
102
|
}, M) => {
|
|
103
|
-
const [$, A] =
|
|
104
|
-
|
|
103
|
+
const [$, A] = g.useState(c), [j, D] = g.useState(!1), b = g.useId(), [n, S] = g.useState(l);
|
|
104
|
+
g.useEffect(() => {
|
|
105
105
|
S(l);
|
|
106
106
|
}, [l]);
|
|
107
|
-
const [
|
|
108
|
-
|
|
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
109
|
}, P = (e) => {
|
|
110
|
-
if (
|
|
110
|
+
if (t) return;
|
|
111
111
|
const d = (e.startsWith("#") ? e : `#${e}`).toLowerCase();
|
|
112
|
-
F((u) => u[u.length - 1] ===
|
|
112
|
+
F((u) => u[u.length - 1] === n ? u : [...u.slice(-19), n]), S(d), a?.(d);
|
|
113
113
|
}, Z = (e) => {
|
|
114
|
-
if (
|
|
114
|
+
if (t) return;
|
|
115
115
|
const d = (e.startsWith("#") ? e : `#${e}`).toLowerCase();
|
|
116
|
-
H.current || (H.current = !0, F((u) => u[u.length - 1] ===
|
|
116
|
+
H.current || (H.current = !0, F((u) => u[u.length - 1] === n ? u : [...u.slice(-19), n])), S(d), a?.(d);
|
|
117
117
|
}, E = () => {
|
|
118
118
|
H.current = !1;
|
|
119
119
|
}, _ = () => {
|
|
120
120
|
if (I.length === 0) return;
|
|
121
121
|
const e = I[I.length - 1];
|
|
122
|
-
F((
|
|
122
|
+
F((m) => m.slice(0, -1)), S(e), a?.(e);
|
|
123
123
|
}, q = () => {
|
|
124
|
-
S(
|
|
125
|
-
}, z =
|
|
124
|
+
S(v), a?.(v), F([]);
|
|
125
|
+
}, z = o === !1 ? [] : o ? o.map(
|
|
126
126
|
(e) => typeof e == "string" ? { hex: e, label: e } : e
|
|
127
|
-
) : re, y = B(
|
|
127
|
+
) : re, y = B(n), C = ee(n), L = (e, m) => {
|
|
128
128
|
if (!y) return;
|
|
129
|
-
const d = parseInt(
|
|
129
|
+
const d = parseInt(m, 10);
|
|
130
130
|
if (isNaN(d)) return;
|
|
131
131
|
const u = Math.max(0, Math.min(255, d));
|
|
132
132
|
P(O(
|
|
@@ -134,89 +134,89 @@ const se = x.forwardRef(
|
|
|
134
134
|
e === "g" ? u : y.g,
|
|
135
135
|
e === "b" ? u : y.b
|
|
136
136
|
));
|
|
137
|
-
}, T = (e,
|
|
138
|
-
if (!
|
|
139
|
-
const d = parseInt(
|
|
137
|
+
}, T = (e, m) => {
|
|
138
|
+
if (!C) return;
|
|
139
|
+
const d = parseInt(m, 10);
|
|
140
140
|
if (isNaN(d)) return;
|
|
141
141
|
const U = Math.max(0, Math.min(e === "h" ? 360 : 100, d));
|
|
142
142
|
P(te(
|
|
143
|
-
e === "h" ? U :
|
|
144
|
-
e === "s" ? U :
|
|
145
|
-
e === "l" ? U :
|
|
143
|
+
e === "h" ? U : C.h,
|
|
144
|
+
e === "s" ? U : C.s,
|
|
145
|
+
e === "l" ? U : C.l
|
|
146
146
|
));
|
|
147
147
|
}, J = ["hex", "rgb", "hsl"];
|
|
148
|
-
return /* @__PURE__ */
|
|
149
|
-
/* @__PURE__ */
|
|
150
|
-
|
|
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
151
|
{
|
|
152
152
|
type: "button",
|
|
153
|
-
disabled:
|
|
153
|
+
disabled: t,
|
|
154
154
|
className: k(
|
|
155
155
|
"group flex items-center justify-center rounded-ds-md px-ds-04 py-ds-02 font-mono text-ds-sm font-medium",
|
|
156
156
|
"focus:outline-none focus:ring-2 focus:ring-accent-9 focus:ring-offset-2 focus:ring-offset-surface-base",
|
|
157
|
-
|
|
157
|
+
t && "cursor-not-allowed opacity-50"
|
|
158
158
|
),
|
|
159
159
|
animate: {
|
|
160
|
-
backgroundColor:
|
|
161
|
-
color: ae(
|
|
160
|
+
backgroundColor: n,
|
|
161
|
+
color: ae(n) ? "rgba(0,0,0,0.8)" : "rgba(255,255,255,0.95)"
|
|
162
162
|
},
|
|
163
163
|
whileHover: { y: -1, boxShadow: "0 4px 12px rgba(0,0,0,0.12)" },
|
|
164
164
|
whileTap: { scale: 0.97 },
|
|
165
165
|
transition: R.smooth,
|
|
166
|
-
"aria-label": `Color picker: ${
|
|
167
|
-
children:
|
|
166
|
+
"aria-label": `Color picker: ${n}`,
|
|
167
|
+
children: n.toUpperCase()
|
|
168
168
|
}
|
|
169
|
-
) : /* @__PURE__ */
|
|
170
|
-
|
|
169
|
+
) : /* @__PURE__ */ f(
|
|
170
|
+
x.button,
|
|
171
171
|
{
|
|
172
172
|
type: "button",
|
|
173
|
-
disabled:
|
|
173
|
+
disabled: t,
|
|
174
174
|
className: k(
|
|
175
175
|
"group relative flex items-center overflow-hidden rounded-ds-md border border-surface-border-strong",
|
|
176
176
|
"hover:border-accent-7 focus:border-accent-7 focus:outline-none focus:ring-1 focus:ring-accent-9",
|
|
177
|
-
|
|
177
|
+
t && "cursor-not-allowed opacity-50"
|
|
178
178
|
),
|
|
179
179
|
whileHover: { scale: 1.02 },
|
|
180
180
|
whileTap: { scale: 0.98 },
|
|
181
181
|
transition: R.snappy,
|
|
182
|
-
"aria-label": `Color picker: ${
|
|
182
|
+
"aria-label": `Color picker: ${n}`,
|
|
183
183
|
children: [
|
|
184
|
-
/* @__PURE__ */
|
|
185
|
-
|
|
184
|
+
/* @__PURE__ */ r(
|
|
185
|
+
x.span,
|
|
186
186
|
{
|
|
187
187
|
className: "absolute inset-0",
|
|
188
188
|
animate: {
|
|
189
|
-
background: `linear-gradient(to right, ${
|
|
189
|
+
background: `linear-gradient(to right, ${n} 0%, ${n} 35%, transparent 70%)`
|
|
190
190
|
},
|
|
191
191
|
transition: { duration: 0.3 }
|
|
192
192
|
}
|
|
193
193
|
),
|
|
194
|
-
/* @__PURE__ */
|
|
194
|
+
/* @__PURE__ */ r("span", { className: "absolute inset-0 bg-surface-overlay/60", style: {
|
|
195
195
|
maskImage: "linear-gradient(to right, transparent 0%, black 40%)",
|
|
196
196
|
WebkitMaskImage: "linear-gradient(to right, transparent 0%, black 40%)"
|
|
197
197
|
} }),
|
|
198
|
-
/* @__PURE__ */
|
|
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
199
|
]
|
|
200
200
|
}
|
|
201
201
|
) }),
|
|
202
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ r(
|
|
203
203
|
Y,
|
|
204
204
|
{
|
|
205
|
-
align:
|
|
205
|
+
align: s,
|
|
206
206
|
sideOffset: 8,
|
|
207
207
|
className: "w-[272px] rounded-ds-xl border border-surface-border-strong bg-surface-overlay p-0 shadow-floating",
|
|
208
|
-
children: /* @__PURE__ */
|
|
209
|
-
i && /* @__PURE__ */
|
|
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
210
|
K,
|
|
211
211
|
{
|
|
212
|
-
color:
|
|
212
|
+
color: n,
|
|
213
213
|
onChange: Z,
|
|
214
214
|
className: "!w-full",
|
|
215
215
|
style: { height: 160 }
|
|
216
216
|
}
|
|
217
217
|
) }),
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
/* @__PURE__ */
|
|
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
220
|
"button",
|
|
221
221
|
{
|
|
222
222
|
type: "button",
|
|
@@ -226,42 +226,42 @@ const se = x.forwardRef(
|
|
|
226
226
|
$ === e ? "text-accent-11" : "text-surface-fg-muted hover:text-surface-fg"
|
|
227
227
|
),
|
|
228
228
|
children: [
|
|
229
|
-
$ === e && /* @__PURE__ */
|
|
230
|
-
|
|
229
|
+
$ === e && /* @__PURE__ */ r(
|
|
230
|
+
x.span,
|
|
231
231
|
{
|
|
232
232
|
layoutId: `color-input-format-pill-${b}`,
|
|
233
233
|
className: "absolute inset-0 rounded-ds-sm bg-accent-3",
|
|
234
234
|
transition: R.snappy
|
|
235
235
|
}
|
|
236
236
|
),
|
|
237
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ r("span", { className: "relative z-10", children: e })
|
|
238
238
|
]
|
|
239
239
|
},
|
|
240
240
|
e
|
|
241
241
|
)) }),
|
|
242
|
-
/* @__PURE__ */
|
|
243
|
-
$ === "hex" && /* @__PURE__ */
|
|
244
|
-
|
|
242
|
+
/* @__PURE__ */ f(V, { mode: "wait", children: [
|
|
243
|
+
$ === "hex" && /* @__PURE__ */ r(
|
|
244
|
+
x.div,
|
|
245
245
|
{
|
|
246
246
|
initial: { opacity: 0, y: 4 },
|
|
247
247
|
animate: { opacity: 1, y: 0 },
|
|
248
248
|
exit: { opacity: 0, y: -4 },
|
|
249
249
|
transition: { duration: 0.15 },
|
|
250
250
|
className: "flex gap-ds-02",
|
|
251
|
-
children: /* @__PURE__ */
|
|
251
|
+
children: /* @__PURE__ */ r(
|
|
252
252
|
w,
|
|
253
253
|
{
|
|
254
254
|
id: `${b}-hex`,
|
|
255
255
|
label: "Hex",
|
|
256
|
-
value:
|
|
256
|
+
value: n.replace("#", "").toUpperCase(),
|
|
257
257
|
onChange: (e) => {
|
|
258
|
-
const
|
|
259
|
-
|
|
258
|
+
const m = e.replace(/[^0-9a-fA-F]/g, "").slice(0, 6);
|
|
259
|
+
m.length === 6 && P(`#${m}`);
|
|
260
260
|
},
|
|
261
261
|
onBlur: () => {
|
|
262
|
-
|
|
262
|
+
n.replace("#", "").toUpperCase().length !== 6 && S(n);
|
|
263
263
|
},
|
|
264
|
-
disabled:
|
|
264
|
+
disabled: t,
|
|
265
265
|
maxLength: 6,
|
|
266
266
|
prefix: "#",
|
|
267
267
|
className: "flex-1"
|
|
@@ -270,8 +270,8 @@ const se = x.forwardRef(
|
|
|
270
270
|
},
|
|
271
271
|
"hex"
|
|
272
272
|
),
|
|
273
|
-
$ === "rgb" && y && /* @__PURE__ */
|
|
274
|
-
|
|
273
|
+
$ === "rgb" && y && /* @__PURE__ */ f(
|
|
274
|
+
x.div,
|
|
275
275
|
{
|
|
276
276
|
initial: { opacity: 0, y: 4 },
|
|
277
277
|
animate: { opacity: 1, y: 0 },
|
|
@@ -279,15 +279,15 @@ const se = x.forwardRef(
|
|
|
279
279
|
transition: { duration: 0.15 },
|
|
280
280
|
className: "flex gap-ds-02",
|
|
281
281
|
children: [
|
|
282
|
-
/* @__PURE__ */
|
|
283
|
-
/* @__PURE__ */
|
|
284
|
-
/* @__PURE__ */
|
|
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
285
|
]
|
|
286
286
|
},
|
|
287
287
|
"rgb"
|
|
288
288
|
),
|
|
289
|
-
$ === "hsl" &&
|
|
290
|
-
|
|
289
|
+
$ === "hsl" && C && /* @__PURE__ */ f(
|
|
290
|
+
x.div,
|
|
291
291
|
{
|
|
292
292
|
initial: { opacity: 0, y: 4 },
|
|
293
293
|
animate: { opacity: 1, y: 0 },
|
|
@@ -295,32 +295,32 @@ const se = x.forwardRef(
|
|
|
295
295
|
transition: { duration: 0.15 },
|
|
296
296
|
className: "flex gap-ds-02",
|
|
297
297
|
children: [
|
|
298
|
-
/* @__PURE__ */
|
|
299
|
-
/* @__PURE__ */
|
|
300
|
-
/* @__PURE__ */
|
|
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
301
|
]
|
|
302
302
|
},
|
|
303
303
|
"hsl"
|
|
304
304
|
)
|
|
305
305
|
] })
|
|
306
306
|
] }),
|
|
307
|
-
z.length > 0 && /* @__PURE__ */
|
|
308
|
-
const d =
|
|
309
|
-
return /* @__PURE__ */
|
|
310
|
-
|
|
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
311
|
{
|
|
312
312
|
type: "button",
|
|
313
|
-
disabled:
|
|
313
|
+
disabled: t,
|
|
314
314
|
onClick: () => P(e.hex),
|
|
315
315
|
initial: { opacity: 0, scale: 0.8 },
|
|
316
316
|
animate: { opacity: 1, scale: d ? 1.15 : 1 },
|
|
317
317
|
whileHover: { scale: d ? 1.15 : 1.1 },
|
|
318
318
|
whileTap: { scale: 0.9 },
|
|
319
|
-
transition: { ...R.bouncy, delay:
|
|
319
|
+
transition: { ...R.bouncy, delay: m * 0.02 },
|
|
320
320
|
className: k(
|
|
321
321
|
"h-6 w-6 rounded-ds-sm border",
|
|
322
322
|
d ? "border-accent-7 ring-2 ring-accent-9/30" : "border-surface-border hover:border-surface-border-strong",
|
|
323
|
-
|
|
323
|
+
t && "cursor-not-allowed opacity-50"
|
|
324
324
|
),
|
|
325
325
|
style: { backgroundColor: e.hex },
|
|
326
326
|
title: e.label,
|
|
@@ -329,25 +329,25 @@ const se = x.forwardRef(
|
|
|
329
329
|
e.hex
|
|
330
330
|
);
|
|
331
331
|
}) }) }),
|
|
332
|
-
(I.length > 0 ||
|
|
333
|
-
|
|
332
|
+
(I.length > 0 || n !== v) && /* @__PURE__ */ f(
|
|
333
|
+
x.div,
|
|
334
334
|
{
|
|
335
335
|
initial: { opacity: 0, height: 0 },
|
|
336
336
|
animate: { opacity: 1, height: "auto" },
|
|
337
337
|
exit: { opacity: 0, height: 0 },
|
|
338
338
|
className: "flex items-center gap-ds-02 border-t border-surface-border px-ds-04 py-ds-02",
|
|
339
339
|
children: [
|
|
340
|
-
/* @__PURE__ */
|
|
340
|
+
/* @__PURE__ */ r(
|
|
341
341
|
"span",
|
|
342
342
|
{
|
|
343
343
|
className: "h-4 w-4 shrink-0 rounded-full border border-surface-border",
|
|
344
|
-
style: { backgroundColor:
|
|
345
|
-
title: `Original: ${
|
|
344
|
+
style: { backgroundColor: v },
|
|
345
|
+
title: `Original: ${v}`
|
|
346
346
|
}
|
|
347
347
|
),
|
|
348
|
-
/* @__PURE__ */
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
I.length > 0 && /* @__PURE__ */
|
|
348
|
+
/* @__PURE__ */ r("span", { className: "text-[10px] text-surface-fg-muted", children: v.toUpperCase() }),
|
|
349
|
+
/* @__PURE__ */ r("span", { className: "flex-1" }),
|
|
350
|
+
I.length > 0 && /* @__PURE__ */ r(
|
|
351
351
|
"button",
|
|
352
352
|
{
|
|
353
353
|
type: "button",
|
|
@@ -356,7 +356,7 @@ const se = x.forwardRef(
|
|
|
356
356
|
children: "Undo"
|
|
357
357
|
}
|
|
358
358
|
),
|
|
359
|
-
|
|
359
|
+
n !== v && /* @__PURE__ */ r(
|
|
360
360
|
"button",
|
|
361
361
|
{
|
|
362
362
|
type: "button",
|
|
@@ -374,7 +374,7 @@ const se = x.forwardRef(
|
|
|
374
374
|
] }) });
|
|
375
375
|
}
|
|
376
376
|
);
|
|
377
|
-
|
|
377
|
+
ne.displayName = "ColorInput";
|
|
378
378
|
export {
|
|
379
|
-
|
|
379
|
+
ne as ColorInput
|
|
380
380
|
};
|
package/dist/ui/color-swatch.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as h, Fragment as
|
|
2
|
+
import { jsxs as h, Fragment as N, jsx as t } from "react/jsx-runtime";
|
|
3
3
|
import * as s from "react";
|
|
4
4
|
import { cn as o } from "./lib/utils.js";
|
|
5
|
-
const
|
|
5
|
+
const S = {
|
|
6
6
|
sm: "h-3 w-3",
|
|
7
7
|
md: "h-4 w-4",
|
|
8
8
|
lg: "h-6 w-6"
|
|
@@ -11,12 +11,12 @@ const v = {
|
|
|
11
11
|
square: "rounded-none",
|
|
12
12
|
rounded: "rounded-ds-sm"
|
|
13
13
|
}, k = s.forwardRef(
|
|
14
|
-
({ color: a, size: g = "md", shape: n = "circle", ring: y = !1, copyable: i = !1, checkerboard: e = !1, className: w, style: x, ...c },
|
|
15
|
-
const [b,
|
|
14
|
+
({ color: a, size: g = "md", shape: n = "circle", ring: y = !1, copyable: i = !1, checkerboard: e = !1, className: w, style: x, ...c }, d) => {
|
|
15
|
+
const [b, u] = s.useState(!1), p = s.useRef(void 0);
|
|
16
16
|
s.useEffect(() => () => clearTimeout(p.current), []);
|
|
17
17
|
const m = o(
|
|
18
18
|
"inline-block shrink-0 relative",
|
|
19
|
-
|
|
19
|
+
S[g],
|
|
20
20
|
l[n],
|
|
21
21
|
y && "shadow-ring-sm",
|
|
22
22
|
i && "cursor-pointer",
|
|
@@ -28,12 +28,12 @@ const v = {
|
|
|
28
28
|
backgroundColor: a,
|
|
29
29
|
...x
|
|
30
30
|
};
|
|
31
|
-
function
|
|
31
|
+
function v() {
|
|
32
32
|
navigator.clipboard.writeText(a).then(() => {
|
|
33
|
-
|
|
33
|
+
u(!0), p.current = setTimeout(() => u(!1), 1500);
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
const f = e ? /* @__PURE__ */ h(
|
|
36
|
+
const f = e ? /* @__PURE__ */ h(N, { children: [
|
|
37
37
|
/* @__PURE__ */ t(
|
|
38
38
|
"span",
|
|
39
39
|
{
|
|
@@ -54,10 +54,10 @@ const v = {
|
|
|
54
54
|
"button",
|
|
55
55
|
{
|
|
56
56
|
type: "button",
|
|
57
|
-
ref:
|
|
57
|
+
ref: d,
|
|
58
58
|
className: m,
|
|
59
59
|
style: e ? {} : r,
|
|
60
|
-
onClick:
|
|
60
|
+
onClick: v,
|
|
61
61
|
"aria-label": `Copy color ${a}`,
|
|
62
62
|
...c,
|
|
63
63
|
children: [
|
|
@@ -75,7 +75,7 @@ const v = {
|
|
|
75
75
|
) : /* @__PURE__ */ t(
|
|
76
76
|
"span",
|
|
77
77
|
{
|
|
78
|
-
ref:
|
|
78
|
+
ref: d,
|
|
79
79
|
className: m,
|
|
80
80
|
style: e ? {} : r,
|
|
81
81
|
role: "presentation",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/ui/combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/ui/combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAS9B;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,UAAU,iBAAkB,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IACxF,OAAO,EAAE,cAAc,EAAE,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,KAAK,KAAK,CAAC,SAAS,CAAA;IAC7E,4FAA4F;IAC5F,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,UAAU,mBAAoB,SAAQ,iBAAiB;IACrD,QAAQ,CAAC,EAAE,KAAK,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACvC;AAED,UAAU,qBAAsB,SAAQ,iBAAiB;IACvD,QAAQ,EAAE,IAAI,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;CACzC;AAED,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,qBAAqB,CAAA;AAQvE,QAAA,MAAM,QAAQ,yFAoYb,CAAA;AAGD,OAAO,EAAE,QAAQ,EAAE,CAAA"}
|