@devalok/shilp-sutra 0.27.2 → 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 +977 -814
- 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 +64 -64
- 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.d.ts +19 -5
- package/dist/ui/color-input.d.ts.map +1 -1
- package/dist/ui/color-input.js +371 -79
- 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/label.js +1 -1
- 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 +30 -30
- 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/radio.js +1 -1
- 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/separator.js +5 -5
- 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/slider.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 +40 -26
- 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-group.js +1 -1
- package/dist/ui/toggle.js +5 -5
- package/dist/ui/tooltip.js +41 -41
- 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/color-input.md +58 -4
- 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 +724 -44
- package/llms.txt +38 -19
- package/package.json +8 -2
package/dist/ui/dropdown-menu.js
CHANGED
|
@@ -1,77 +1,78 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as m, jsx as
|
|
2
|
+
import { jsxs as m, jsx as s } from "react/jsx-runtime";
|
|
3
3
|
import * as t from "react";
|
|
4
|
-
import {
|
|
5
|
-
import { IconChevronRight as
|
|
4
|
+
import { Q as f, U as b, V as g, W as h, X as y, Y as w, Z as v, _ as x, $ as N, a0 as C, a1 as P, a2 as _, a3 as j, a4 as z, a5 as G } from "../_chunks/primitives.js";
|
|
5
|
+
import { IconChevronRight as T, IconCheck as U, IconCircle as A } from "@tabler/icons-react";
|
|
6
6
|
import { cn as d } from "./lib/utils.js";
|
|
7
|
-
import { tweens as
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
import { tweens as M, springs as D } from "./lib/motion.js";
|
|
8
|
+
import { Icon as R } from "./icon.js";
|
|
9
|
+
import { A as S, m as I } from "../_chunks/framer.js";
|
|
10
|
+
const k = t.createContext(!1), O = t.createContext(!1), L = ({
|
|
11
|
+
open: e,
|
|
11
12
|
defaultOpen: o = !1,
|
|
12
|
-
onOpenChange:
|
|
13
|
+
onOpenChange: a,
|
|
13
14
|
...r
|
|
14
15
|
}) => {
|
|
15
|
-
const [n, c] = t.useState(o), i =
|
|
16
|
-
(
|
|
17
|
-
i || c(
|
|
16
|
+
const [n, c] = t.useState(o), i = e !== void 0, l = i ? e : n, u = t.useCallback(
|
|
17
|
+
(p) => {
|
|
18
|
+
i || c(p), a?.(p);
|
|
18
19
|
},
|
|
19
|
-
[i,
|
|
20
|
+
[i, a]
|
|
20
21
|
);
|
|
21
|
-
return /* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ s(k.Provider, { value: l, children: /* @__PURE__ */ s(_, { open: l, onOpenChange: u, ...r }) });
|
|
22
23
|
};
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
open:
|
|
24
|
+
L.displayName = "DropdownMenu";
|
|
25
|
+
const ae = P, re = j, te = g, Q = ({
|
|
26
|
+
open: e,
|
|
26
27
|
defaultOpen: o = !1,
|
|
27
|
-
onOpenChange:
|
|
28
|
+
onOpenChange: a,
|
|
28
29
|
...r
|
|
29
30
|
}) => {
|
|
30
|
-
const [n, c] = t.useState(o), i =
|
|
31
|
-
(
|
|
32
|
-
i || c(
|
|
31
|
+
const [n, c] = t.useState(o), i = e !== void 0, l = i ? e : n, u = t.useCallback(
|
|
32
|
+
(p) => {
|
|
33
|
+
i || c(p), a?.(p);
|
|
33
34
|
},
|
|
34
|
-
[i,
|
|
35
|
+
[i, a]
|
|
35
36
|
);
|
|
36
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ s(O.Provider, { value: l, children: /* @__PURE__ */ s(G, { open: l, onOpenChange: u, ...r }) });
|
|
37
38
|
};
|
|
38
|
-
|
|
39
|
-
const
|
|
39
|
+
Q.displayName = "DropdownMenuSub";
|
|
40
|
+
const ne = z, V = t.forwardRef(({ className: e, inset: o, children: a, ...r }, n) => /* @__PURE__ */ m(
|
|
40
41
|
f,
|
|
41
42
|
{
|
|
42
43
|
ref: n,
|
|
43
44
|
className: d(
|
|
44
45
|
"flex cursor-default select-none items-center gap-ds-03 rounded-ds-md px-ds-03 py-ds-02b text-ds-md outline-none focus:bg-surface-raised data-[state=open]:bg-surface-raised [&_svg]:pointer-events-none [&_svg]:h-ico-sm [&_svg]:w-ico-sm [&_svg]:shrink-0",
|
|
45
46
|
o && "pl-ds-07",
|
|
46
|
-
|
|
47
|
+
e
|
|
47
48
|
),
|
|
48
49
|
...r,
|
|
49
50
|
children: [
|
|
50
|
-
|
|
51
|
-
/* @__PURE__ */
|
|
51
|
+
a,
|
|
52
|
+
/* @__PURE__ */ s(R, { icon: T, size: "sm", className: "ml-auto" })
|
|
52
53
|
]
|
|
53
54
|
}
|
|
54
55
|
));
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
const n = t.useContext(
|
|
58
|
-
return /* @__PURE__ */
|
|
56
|
+
V.displayName = f.displayName;
|
|
57
|
+
const W = t.forwardRef(({ className: e, children: o, ...a }, r) => {
|
|
58
|
+
const n = t.useContext(O);
|
|
59
|
+
return /* @__PURE__ */ s(S, { children: n && /* @__PURE__ */ s(
|
|
59
60
|
b,
|
|
60
61
|
{
|
|
61
62
|
ref: r,
|
|
62
63
|
forceMount: !0,
|
|
63
64
|
asChild: !0,
|
|
64
|
-
...
|
|
65
|
-
children: /* @__PURE__ */
|
|
66
|
-
|
|
65
|
+
...a,
|
|
66
|
+
children: /* @__PURE__ */ s(
|
|
67
|
+
I.div,
|
|
67
68
|
{
|
|
68
69
|
initial: { opacity: 0, scale: 0.95 },
|
|
69
70
|
animate: { opacity: 1, scale: 1 },
|
|
70
71
|
exit: { opacity: 0, scale: 0.95 },
|
|
71
|
-
transition: { ...
|
|
72
|
+
transition: { ...D.snappy, opacity: M.fade },
|
|
72
73
|
className: d(
|
|
73
74
|
"z-popover min-w-[8rem] overflow-hidden rounded-ds-lg border border-surface-border-strong bg-surface-overlay p-ds-02 text-surface-fg shadow-floating",
|
|
74
|
-
|
|
75
|
+
e
|
|
75
76
|
),
|
|
76
77
|
children: o
|
|
77
78
|
}
|
|
@@ -79,128 +80,128 @@ const Y = t.forwardRef(({ className: s, children: o, ...e }, r) => {
|
|
|
79
80
|
}
|
|
80
81
|
) });
|
|
81
82
|
});
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
const c = t.useContext(
|
|
85
|
-
return /* @__PURE__ */
|
|
86
|
-
|
|
83
|
+
W.displayName = b.displayName;
|
|
84
|
+
const X = t.forwardRef(({ className: e, sideOffset: o = 4, children: a, ...r }, n) => {
|
|
85
|
+
const c = t.useContext(k);
|
|
86
|
+
return /* @__PURE__ */ s(S, { children: c && /* @__PURE__ */ s(g, { forceMount: !0, children: /* @__PURE__ */ s(
|
|
87
|
+
h,
|
|
87
88
|
{
|
|
88
89
|
ref: n,
|
|
89
90
|
sideOffset: o,
|
|
90
91
|
forceMount: !0,
|
|
91
92
|
asChild: !0,
|
|
92
93
|
...r,
|
|
93
|
-
children: /* @__PURE__ */
|
|
94
|
-
|
|
94
|
+
children: /* @__PURE__ */ s(
|
|
95
|
+
I.div,
|
|
95
96
|
{
|
|
96
97
|
initial: { opacity: 0, scale: 0.95 },
|
|
97
98
|
animate: { opacity: 1, scale: 1 },
|
|
98
99
|
exit: { opacity: 0, scale: 0.95 },
|
|
99
|
-
transition: { ...
|
|
100
|
+
transition: { ...D.snappy, opacity: M.fade },
|
|
100
101
|
className: d(
|
|
101
102
|
"z-popover min-w-[8rem] rounded-ds-lg border border-surface-border-strong bg-surface-overlay p-ds-02 text-surface-fg shadow-floating",
|
|
102
|
-
|
|
103
|
+
e
|
|
103
104
|
),
|
|
104
|
-
children:
|
|
105
|
+
children: a
|
|
105
106
|
}
|
|
106
107
|
)
|
|
107
108
|
}
|
|
108
109
|
) }) });
|
|
109
110
|
});
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
|
|
111
|
+
X.displayName = h.displayName;
|
|
112
|
+
const Y = t.forwardRef(({ className: e, inset: o, ...a }, r) => /* @__PURE__ */ s(
|
|
113
|
+
y,
|
|
113
114
|
{
|
|
114
115
|
ref: r,
|
|
115
116
|
className: d(
|
|
116
117
|
"relative flex cursor-default select-none items-center gap-ds-03 rounded-ds-md px-ds-03 py-ds-02b text-ds-md outline-none transition-colors duration-fast-01 ease-productive-standard hover:bg-surface-raised focus:bg-surface-raised focus:text-surface-fg active:bg-surface-raised-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-action-disabled [&>svg]:h-ico-sm [&>svg]:w-ico-sm [&>svg]:shrink-0",
|
|
117
118
|
o && "pl-ds-07",
|
|
118
|
-
|
|
119
|
+
e
|
|
119
120
|
),
|
|
120
|
-
...
|
|
121
|
+
...a
|
|
121
122
|
}
|
|
122
123
|
));
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
|
|
124
|
+
Y.displayName = y.displayName;
|
|
125
|
+
const Z = t.forwardRef(({ className: e, children: o, checked: a, ...r }, n) => /* @__PURE__ */ m(
|
|
126
|
+
w,
|
|
126
127
|
{
|
|
127
128
|
ref: n,
|
|
128
129
|
className: d(
|
|
129
130
|
"relative flex cursor-default select-none items-center rounded-ds-md py-ds-02b pl-ds-07 pr-ds-03 text-ds-md outline-none transition-colors duration-fast-01 ease-productive-standard hover:bg-surface-raised focus:bg-surface-raised focus:text-surface-fg active:bg-surface-raised-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-action-disabled",
|
|
130
|
-
|
|
131
|
+
e
|
|
131
132
|
),
|
|
132
|
-
checked:
|
|
133
|
+
checked: a,
|
|
133
134
|
...r,
|
|
134
135
|
children: [
|
|
135
|
-
/* @__PURE__ */
|
|
136
|
+
/* @__PURE__ */ s("span", { className: "absolute left-ds-03 flex h-ico-sm w-ico-sm items-center justify-center", children: /* @__PURE__ */ s(v, { children: /* @__PURE__ */ s(R, { icon: U, size: "sm" }) }) }),
|
|
136
137
|
o
|
|
137
138
|
]
|
|
138
139
|
}
|
|
139
140
|
));
|
|
140
|
-
|
|
141
|
-
const
|
|
141
|
+
Z.displayName = w.displayName;
|
|
142
|
+
const $ = t.forwardRef(({ className: e, children: o, ...a }, r) => /* @__PURE__ */ m(
|
|
142
143
|
x,
|
|
143
144
|
{
|
|
144
145
|
ref: r,
|
|
145
146
|
className: d(
|
|
146
147
|
"relative flex cursor-default select-none items-center rounded-ds-md py-ds-02b pl-ds-07 pr-ds-03 text-ds-md outline-none transition-colors duration-fast-01 ease-productive-standard hover:bg-surface-raised focus:bg-surface-raised focus:text-surface-fg active:bg-surface-raised-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-action-disabled",
|
|
147
|
-
|
|
148
|
+
e
|
|
148
149
|
),
|
|
149
|
-
...
|
|
150
|
+
...a,
|
|
150
151
|
children: [
|
|
151
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ s("span", { className: "absolute left-ds-03 flex h-ico-sm w-ico-sm items-center justify-center", children: /* @__PURE__ */ s(v, { children: /* @__PURE__ */ s(A, { className: "h-2 w-2 fill-current" }) }) }),
|
|
152
153
|
o
|
|
153
154
|
]
|
|
154
155
|
}
|
|
155
156
|
));
|
|
156
|
-
|
|
157
|
-
const
|
|
157
|
+
$.displayName = x.displayName;
|
|
158
|
+
const q = t.forwardRef(({ className: e, inset: o, ...a }, r) => /* @__PURE__ */ s(
|
|
158
159
|
N,
|
|
159
160
|
{
|
|
160
161
|
ref: r,
|
|
161
162
|
className: d(
|
|
162
163
|
"px-ds-03 py-ds-02b text-ds-md font-semibold",
|
|
163
164
|
o && "pl-ds-07",
|
|
164
|
-
|
|
165
|
+
e
|
|
165
166
|
),
|
|
166
|
-
...
|
|
167
|
+
...a
|
|
167
168
|
}
|
|
168
169
|
));
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
170
|
+
q.displayName = N.displayName;
|
|
171
|
+
const B = t.forwardRef(({ className: e, ...o }, a) => /* @__PURE__ */ s(
|
|
172
|
+
C,
|
|
172
173
|
{
|
|
173
|
-
ref:
|
|
174
|
-
className: d("-mx-ds-01 my-ds-02 h-px bg-surface-border",
|
|
174
|
+
ref: a,
|
|
175
|
+
className: d("-mx-ds-01 my-ds-02 h-px bg-surface-border", e),
|
|
175
176
|
...o
|
|
176
177
|
}
|
|
177
178
|
));
|
|
178
|
-
|
|
179
|
-
const
|
|
180
|
-
className:
|
|
179
|
+
B.displayName = C.displayName;
|
|
180
|
+
const E = ({
|
|
181
|
+
className: e,
|
|
181
182
|
...o
|
|
182
|
-
}) => /* @__PURE__ */
|
|
183
|
+
}) => /* @__PURE__ */ s(
|
|
183
184
|
"span",
|
|
184
185
|
{
|
|
185
|
-
className: d("ml-auto text-ds-sm text-surface-fg-subtle",
|
|
186
|
+
className: d("ml-auto text-ds-sm text-surface-fg-subtle", e),
|
|
186
187
|
...o
|
|
187
188
|
}
|
|
188
189
|
);
|
|
189
|
-
|
|
190
|
+
E.displayName = "DropdownMenuShortcut";
|
|
190
191
|
export {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
192
|
+
L as DropdownMenu,
|
|
193
|
+
Z as DropdownMenuCheckboxItem,
|
|
194
|
+
X as DropdownMenuContent,
|
|
195
|
+
re as DropdownMenuGroup,
|
|
196
|
+
Y as DropdownMenuItem,
|
|
197
|
+
q as DropdownMenuLabel,
|
|
198
|
+
te as DropdownMenuPortal,
|
|
199
|
+
ne as DropdownMenuRadioGroup,
|
|
200
|
+
$ as DropdownMenuRadioItem,
|
|
201
|
+
B as DropdownMenuSeparator,
|
|
202
|
+
E as DropdownMenuShortcut,
|
|
203
|
+
Q as DropdownMenuSub,
|
|
204
|
+
W as DropdownMenuSubContent,
|
|
205
|
+
V as DropdownMenuSubTrigger,
|
|
206
|
+
ae as DropdownMenuTrigger
|
|
206
207
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-upload.d.ts","sourceRoot":"","sources":["../../src/ui/file-upload.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"file-upload.d.ts","sourceRoot":"","sources":["../../src/ui/file-upload.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,SAAS,CAAC;IAC7D,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,6CAA6C;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,2BAA2B;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,+CAA+C;IAC/C,OAAO,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAA;IAChC,+BAA+B;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,wDAAwD;IACxD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,eAAe;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sBAAsB;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAuBD,QAAA,MAAM,UAAU,wFAkUf,CAAA;AAGD,OAAO,EAAE,UAAU,EAAE,CAAA"}
|
package/dist/ui/file-upload.js
CHANGED
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as p, jsx as t } from "react/jsx-runtime";
|
|
3
3
|
import * as r from "react";
|
|
4
|
-
import { IconPaperclip as
|
|
4
|
+
import { IconPaperclip as Z, IconCheck as q, IconUpload as G } from "@tabler/icons-react";
|
|
5
5
|
import { cn as h } from "./lib/utils.js";
|
|
6
|
-
import { springs as
|
|
6
|
+
import { springs as w, tweens as N } from "./lib/motion.js";
|
|
7
7
|
import { Spinner as B } from "./spinner.js";
|
|
8
|
+
import { Icon as I } from "./icon.js";
|
|
8
9
|
import { m as c, A as M } from "../_chunks/framer.js";
|
|
9
|
-
const
|
|
10
|
-
function
|
|
11
|
-
return l.split(",").map((
|
|
10
|
+
const H = 10 * 1024 * 1024;
|
|
11
|
+
function J(a, l) {
|
|
12
|
+
return l.split(",").map((s) => s.trim()).some((s) => s.startsWith(".") ? a.name.toLowerCase().endsWith(s.toLowerCase()) : s.endsWith("/*") ? a.type.startsWith(s.slice(0, s.indexOf("/") + 1)) : a.type === s);
|
|
12
13
|
}
|
|
13
14
|
function U(a) {
|
|
14
15
|
return a < 1024 ? `${a} B` : a < 1024 * 1024 ? `${(a / 1024).toFixed(1)} KB` : `${(a / (1024 * 1024)).toFixed(1)} MB`;
|
|
15
16
|
}
|
|
16
|
-
const
|
|
17
|
+
const Q = r.forwardRef(
|
|
17
18
|
({
|
|
18
19
|
accept: a,
|
|
19
|
-
maxSize: l =
|
|
20
|
-
multiple:
|
|
20
|
+
maxSize: l = H,
|
|
21
|
+
multiple: s = !1,
|
|
21
22
|
uploading: o = !1,
|
|
22
23
|
progress: x = 0,
|
|
23
24
|
onFiles: A,
|
|
24
|
-
error:
|
|
25
|
+
error: F,
|
|
25
26
|
compact: W = !1,
|
|
26
|
-
disabled:
|
|
27
|
-
className:
|
|
27
|
+
disabled: n = !1,
|
|
28
|
+
className: E,
|
|
28
29
|
label: v,
|
|
29
30
|
sublabel: j,
|
|
30
|
-
...
|
|
31
|
-
},
|
|
32
|
-
const y = r.useRef(null), [b,
|
|
31
|
+
...L
|
|
32
|
+
}, R) => {
|
|
33
|
+
const y = r.useRef(null), [b, f] = r.useState(!1), [K, d] = r.useState(
|
|
33
34
|
null
|
|
34
|
-
), g = r.useRef(!1), k = r.useRef(!1), u =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, [s, o]), m = r.useCallback(
|
|
35
|
+
), g = r.useRef(!1), k = r.useRef(!1), u = F || K, C = r.useCallback(() => {
|
|
36
|
+
n || o || y.current?.click();
|
|
37
|
+
}, [n, o]), m = r.useCallback(
|
|
38
38
|
(e) => {
|
|
39
|
-
|
|
40
|
-
for (const
|
|
41
|
-
if (
|
|
42
|
-
|
|
43
|
-
`File "${
|
|
39
|
+
d(null);
|
|
40
|
+
for (const i of e) {
|
|
41
|
+
if (i.size > l) {
|
|
42
|
+
d(
|
|
43
|
+
`File "${i.name}" exceeds the maximum size of ${U(l)}`
|
|
44
44
|
);
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
if (a && !
|
|
48
|
-
|
|
49
|
-
`File "${
|
|
47
|
+
if (a && !J(i, a)) {
|
|
48
|
+
d(
|
|
49
|
+
`File "${i.name}" is not an accepted file type`
|
|
50
50
|
);
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
@@ -54,47 +54,47 @@ const J = r.forwardRef(
|
|
|
54
54
|
A(e);
|
|
55
55
|
},
|
|
56
56
|
[l, a, A]
|
|
57
|
-
),
|
|
57
|
+
), $ = r.useCallback(
|
|
58
58
|
(e) => {
|
|
59
59
|
k.current = !0;
|
|
60
|
-
const
|
|
61
|
-
!
|
|
60
|
+
const i = e.target.files;
|
|
61
|
+
!i || i.length === 0 || (m(Array.from(i)), e.target.value = "");
|
|
62
62
|
},
|
|
63
63
|
[m]
|
|
64
|
-
),
|
|
64
|
+
), P = r.useCallback(() => {
|
|
65
65
|
g.current = !0, k.current = !1;
|
|
66
|
-
}, []),
|
|
67
|
-
g.current && !k.current && a &&
|
|
68
|
-
}, [a]),
|
|
66
|
+
}, []), z = r.useCallback(() => {
|
|
67
|
+
g.current && !k.current && a && d("File type is not accepted"), g.current = !1;
|
|
68
|
+
}, [a]), S = r.useCallback(
|
|
69
69
|
(e) => {
|
|
70
|
-
e.preventDefault(), e.stopPropagation(), !
|
|
70
|
+
e.preventDefault(), e.stopPropagation(), !n && !o && f(!0);
|
|
71
71
|
},
|
|
72
|
-
[
|
|
73
|
-
),
|
|
72
|
+
[n, o]
|
|
73
|
+
), T = r.useCallback(
|
|
74
74
|
(e) => {
|
|
75
|
-
e.preventDefault(), e.stopPropagation(), !
|
|
75
|
+
e.preventDefault(), e.stopPropagation(), !n && !o && f(!0);
|
|
76
76
|
},
|
|
77
|
-
[
|
|
78
|
-
),
|
|
77
|
+
[n, o]
|
|
78
|
+
), _ = r.useCallback(
|
|
79
79
|
(e) => {
|
|
80
|
-
e.preventDefault(), e.stopPropagation(),
|
|
80
|
+
e.preventDefault(), e.stopPropagation(), f(!1);
|
|
81
81
|
},
|
|
82
82
|
[]
|
|
83
|
-
),
|
|
83
|
+
), V = r.useCallback(
|
|
84
84
|
(e) => {
|
|
85
|
-
if (e.preventDefault(), e.stopPropagation(),
|
|
86
|
-
const
|
|
87
|
-
!
|
|
85
|
+
if (e.preventDefault(), e.stopPropagation(), f(!1), n || o) return;
|
|
86
|
+
const i = e.dataTransfer.files;
|
|
87
|
+
!i || i.length === 0 || m(Array.from(i));
|
|
88
88
|
},
|
|
89
|
-
[
|
|
90
|
-
), O = v ?? "Drop files here or click to browse",
|
|
91
|
-
return W ? /* @__PURE__ */ p("div", { ref:
|
|
89
|
+
[n, o, m]
|
|
90
|
+
), O = v ?? "Drop files here or click to browse", X = j ?? `Max file size: ${U(l)}`, D = r.useId();
|
|
91
|
+
return W ? /* @__PURE__ */ p("div", { ref: R, className: h("inline-flex flex-col", E), ...L, children: [
|
|
92
92
|
/* @__PURE__ */ p(
|
|
93
93
|
"button",
|
|
94
94
|
{
|
|
95
95
|
type: "button",
|
|
96
96
|
onClick: C,
|
|
97
|
-
disabled:
|
|
97
|
+
disabled: n,
|
|
98
98
|
className: h(
|
|
99
99
|
"inline-flex items-center gap-ds-02 rounded-ds-md px-ds-03 py-ds-02",
|
|
100
100
|
"text-ds-sm font-medium",
|
|
@@ -105,7 +105,7 @@ const J = r.forwardRef(
|
|
|
105
105
|
"transition-colors"
|
|
106
106
|
),
|
|
107
107
|
children: [
|
|
108
|
-
o ? /* @__PURE__ */ t(B, { size: "sm" }) : /* @__PURE__ */ t(
|
|
108
|
+
o ? /* @__PURE__ */ t(B, { size: "sm" }) : /* @__PURE__ */ t(I, { icon: Z, size: "sm" }),
|
|
109
109
|
v ?? "Attach files"
|
|
110
110
|
]
|
|
111
111
|
}
|
|
@@ -114,18 +114,18 @@ const J = r.forwardRef(
|
|
|
114
114
|
"input",
|
|
115
115
|
{
|
|
116
116
|
ref: y,
|
|
117
|
-
id:
|
|
117
|
+
id: D,
|
|
118
118
|
type: "file",
|
|
119
119
|
className: "sr-only",
|
|
120
120
|
style: { visibility: "hidden" },
|
|
121
121
|
"aria-hidden": "true",
|
|
122
122
|
"aria-label": v ?? "Attach files",
|
|
123
123
|
accept: a,
|
|
124
|
-
multiple:
|
|
125
|
-
disabled:
|
|
126
|
-
onChange:
|
|
127
|
-
onClick:
|
|
128
|
-
onFocus:
|
|
124
|
+
multiple: s,
|
|
125
|
+
disabled: n,
|
|
126
|
+
onChange: $,
|
|
127
|
+
onClick: P,
|
|
128
|
+
onFocus: z,
|
|
129
129
|
tabIndex: -1
|
|
130
130
|
}
|
|
131
131
|
),
|
|
@@ -141,25 +141,25 @@ const J = r.forwardRef(
|
|
|
141
141
|
] }) : /* @__PURE__ */ p(
|
|
142
142
|
"div",
|
|
143
143
|
{
|
|
144
|
-
ref:
|
|
145
|
-
...
|
|
144
|
+
ref: R,
|
|
145
|
+
...L,
|
|
146
146
|
role: "presentation",
|
|
147
|
-
className: h("flex flex-col",
|
|
147
|
+
className: h("flex flex-col", E),
|
|
148
148
|
"data-drag-active": b ? "true" : void 0,
|
|
149
|
-
onDragEnter:
|
|
150
|
-
onDragOver:
|
|
151
|
-
onDragLeave:
|
|
152
|
-
onDrop:
|
|
149
|
+
onDragEnter: S,
|
|
150
|
+
onDragOver: T,
|
|
151
|
+
onDragLeave: _,
|
|
152
|
+
onDrop: V,
|
|
153
153
|
children: [
|
|
154
154
|
/* @__PURE__ */ p(
|
|
155
155
|
c.div,
|
|
156
156
|
{
|
|
157
157
|
role: "button",
|
|
158
158
|
tabIndex: 0,
|
|
159
|
-
"aria-disabled":
|
|
160
|
-
onClick:
|
|
159
|
+
"aria-disabled": n || void 0,
|
|
160
|
+
onClick: n ? void 0 : C,
|
|
161
161
|
onKeyDown: (e) => {
|
|
162
|
-
!
|
|
162
|
+
!n && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), C());
|
|
163
163
|
},
|
|
164
164
|
className: h(
|
|
165
165
|
"flex flex-col items-center justify-center gap-ds-03 rounded-ds-lg",
|
|
@@ -167,12 +167,12 @@ const J = r.forwardRef(
|
|
|
167
167
|
"cursor-pointer",
|
|
168
168
|
"border-surface-border-strong bg-surface-raised-hover",
|
|
169
169
|
b && "border-accent-7 bg-accent-2",
|
|
170
|
-
|
|
170
|
+
n && "opacity-action-disabled cursor-not-allowed"
|
|
171
171
|
),
|
|
172
172
|
animate: {
|
|
173
173
|
scale: b ? 1.02 : 1
|
|
174
174
|
},
|
|
175
|
-
transition:
|
|
175
|
+
transition: w.snappy,
|
|
176
176
|
children: [
|
|
177
177
|
/* @__PURE__ */ t(M, { mode: "wait", children: o ? /* @__PURE__ */ t(
|
|
178
178
|
c.div,
|
|
@@ -184,14 +184,14 @@ const J = r.forwardRef(
|
|
|
184
184
|
children: /* @__PURE__ */ t(B, { size: "md" })
|
|
185
185
|
},
|
|
186
186
|
"spinner"
|
|
187
|
-
) : x === 100 && !
|
|
187
|
+
) : x === 100 && !F ? /* @__PURE__ */ t(
|
|
188
188
|
c.div,
|
|
189
189
|
{
|
|
190
190
|
initial: { opacity: 0, scale: 0.5 },
|
|
191
191
|
animate: { opacity: 1, scale: 1 },
|
|
192
192
|
exit: { opacity: 0, scale: 0.5 },
|
|
193
|
-
transition:
|
|
194
|
-
children: /* @__PURE__ */ t(
|
|
193
|
+
transition: w.bouncy,
|
|
194
|
+
children: /* @__PURE__ */ t(I, { icon: q, size: "2xl", className: "text-success-11" })
|
|
195
195
|
},
|
|
196
196
|
"complete"
|
|
197
197
|
) : /* @__PURE__ */ t(
|
|
@@ -201,11 +201,11 @@ const J = r.forwardRef(
|
|
|
201
201
|
animate: { opacity: 1 },
|
|
202
202
|
exit: { opacity: 0 },
|
|
203
203
|
transition: N.fade,
|
|
204
|
-
children: /* @__PURE__ */ t(
|
|
204
|
+
children: /* @__PURE__ */ t(I, { icon: G, size: "2xl", className: "text-surface-fg-subtle" })
|
|
205
205
|
},
|
|
206
206
|
"upload"
|
|
207
207
|
) }),
|
|
208
|
-
/* @__PURE__ */ t("span", { id:
|
|
208
|
+
/* @__PURE__ */ t("span", { id: D + "-label", className: "text-ds-sm text-surface-fg-muted", children: O }),
|
|
209
209
|
o ? /* @__PURE__ */ t("div", { className: "w-full max-w-xs", children: /* @__PURE__ */ t(
|
|
210
210
|
"div",
|
|
211
211
|
{
|
|
@@ -219,11 +219,11 @@ const J = r.forwardRef(
|
|
|
219
219
|
{
|
|
220
220
|
className: "h-full rounded-ds-full bg-accent-9",
|
|
221
221
|
animate: { width: `${x}%` },
|
|
222
|
-
transition:
|
|
222
|
+
transition: w.smooth
|
|
223
223
|
}
|
|
224
224
|
)
|
|
225
225
|
}
|
|
226
|
-
) }) : /* @__PURE__ */ t("span", { className: "text-ds-xs text-surface-fg-subtle", children:
|
|
226
|
+
) }) : /* @__PURE__ */ t("span", { className: "text-ds-xs text-surface-fg-subtle", children: X })
|
|
227
227
|
]
|
|
228
228
|
}
|
|
229
229
|
),
|
|
@@ -231,18 +231,18 @@ const J = r.forwardRef(
|
|
|
231
231
|
"input",
|
|
232
232
|
{
|
|
233
233
|
ref: y,
|
|
234
|
-
id:
|
|
234
|
+
id: D,
|
|
235
235
|
type: "file",
|
|
236
236
|
className: "sr-only",
|
|
237
237
|
style: { visibility: "hidden" },
|
|
238
238
|
"aria-hidden": "true",
|
|
239
239
|
"aria-label": O,
|
|
240
240
|
accept: a,
|
|
241
|
-
multiple:
|
|
242
|
-
disabled:
|
|
243
|
-
onChange:
|
|
244
|
-
onClick:
|
|
245
|
-
onFocus:
|
|
241
|
+
multiple: s,
|
|
242
|
+
disabled: n,
|
|
243
|
+
onChange: $,
|
|
244
|
+
onClick: P,
|
|
245
|
+
onFocus: z,
|
|
246
246
|
tabIndex: -1
|
|
247
247
|
}
|
|
248
248
|
),
|
|
@@ -263,7 +263,7 @@ const J = r.forwardRef(
|
|
|
263
263
|
);
|
|
264
264
|
}
|
|
265
265
|
);
|
|
266
|
-
|
|
266
|
+
Q.displayName = "FileUpload";
|
|
267
267
|
export {
|
|
268
|
-
|
|
268
|
+
Q as FileUpload
|
|
269
269
|
};
|