@middag-io/react 0.33.0 → 0.34.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/README.md +2 -2
- package/dist-lib/base/shell/AuthShell.js +39 -0
- package/dist-lib/base/shell/BasicShell.js +207 -0
- package/dist-lib/base/shell/ImmersiveShell.js +55 -0
- package/dist-lib/base/shell/partials/InspectorContext.js +60 -0
- package/dist-lib/base/shell/partials/InspectorPanel.js +22 -0
- package/dist-lib/base/shell/partials/NavErrorBoundary.js +66 -0
- package/dist-lib/base/shell/partials/OverlayScreen.js +36 -0
- package/dist-lib/base/shell/partials/PageActionButton.js +4 -0
- package/dist-lib/base/theme/appearance.js +39 -0
- package/dist-lib/base/theme/host-layout-detector.js +39 -0
- package/dist-lib/base/theme/host-theme-detector.js +131 -0
- package/dist-lib/base/theme/sidebar-safelist.txt +20 -0
- package/dist-lib/base/theme/theme-bridge.css +164 -0
- package/dist-lib/base/theme/theme-context.js +103 -0
- package/dist-lib/base/theme/themes/classic.css +174 -0
- package/dist-lib/base/theme/tokens.css +290 -0
- package/dist-lib/base/theme/useHostTheme.js +34 -0
- package/dist-lib/base/utils/clipboard.js +16 -0
- package/dist-lib/base/utils/conditions.js +13 -0
- package/dist-lib/base/utils/icon-registry.js +16 -0
- package/dist-lib/base/utils/icons.js +11 -0
- package/dist-lib/base/utils/interpolate.js +6 -0
- package/dist-lib/base/utils/register-default-icons.js +9 -0
- package/dist-lib/base/utils/storage.js +30 -0
- package/dist-lib/base/utils/time.js +59 -0
- package/dist-lib/chunks/subpath-BD_PKGUX.js +146 -0
- package/dist-lib/chunks/subpath-DLFO_UGQ.js +604 -0
- package/dist-lib/components/reui/accordion.js +43 -0
- package/dist-lib/components/reui/alert-dialog.js +101 -0
- package/dist-lib/components/reui/alert.js +55 -0
- package/dist-lib/components/reui/aspect-ratio.js +11 -0
- package/dist-lib/components/reui/autocomplete.js +170 -0
- package/dist-lib/components/reui/avatar.js +51 -0
- package/dist-lib/components/reui/badge.js +64 -0
- package/dist-lib/components/reui/breadcrumb.js +69 -0
- package/dist-lib/components/reui/button-group.js +38 -0
- package/dist-lib/components/reui/button.js +47 -0
- package/dist-lib/components/reui/calendar.js +89 -0
- package/dist-lib/components/reui/card.js +55 -0
- package/dist-lib/components/reui/carousel.js +110 -0
- package/dist-lib/components/reui/chart.js +130 -0
- package/dist-lib/components/reui/checkbox.js +20 -0
- package/dist-lib/components/reui/collapsible.js +23 -0
- package/dist-lib/components/reui/combobox.js +166 -0
- package/dist-lib/components/reui/command.js +85 -0
- package/dist-lib/components/reui/context-menu.js +121 -0
- package/dist-lib/components/reui/data-grid/data-grid-column-filter.js +108 -0
- package/dist-lib/components/reui/data-grid/data-grid-column-header.js +217 -0
- package/dist-lib/components/reui/data-grid/data-grid-column-visibility.js +25 -0
- package/dist-lib/components/reui/data-grid/data-grid-pagination.js +132 -0
- package/dist-lib/components/reui/data-grid/data-grid-scroll-area.js +183 -0
- package/dist-lib/components/reui/data-grid/data-grid-table-dnd-rows.js +125 -0
- package/dist-lib/components/reui/data-grid/data-grid-table-dnd.js +130 -0
- package/dist-lib/components/reui/data-grid/data-grid-table-virtual.js +156 -0
- package/dist-lib/components/reui/data-grid/data-grid-table.js +546 -0
- package/dist-lib/components/reui/data-grid/data-grid.js +113 -0
- package/dist-lib/components/reui/data-grid-pagination.js +131 -0
- package/dist-lib/components/reui/date-selector.js +642 -0
- package/dist-lib/components/reui/dialog.js +94 -0
- package/dist-lib/components/reui/drawer.js +77 -0
- package/dist-lib/components/reui/dropdown-menu.js +123 -0
- package/dist-lib/components/reui/empty.js +59 -0
- package/dist-lib/components/reui/field.js +115 -0
- package/dist-lib/components/reui/filters.js +873 -0
- package/dist-lib/components/reui/frame.js +97 -0
- package/dist-lib/components/reui/hover-card.js +31 -0
- package/dist-lib/components/reui/icon-placeholder.js +14 -0
- package/dist-lib/components/reui/index.js +18 -0
- package/dist-lib/components/reui/input-group.js +78 -0
- package/dist-lib/components/reui/input-otp.js +44 -0
- package/dist-lib/components/reui/input.js +14 -0
- package/dist-lib/components/reui/item.js +116 -0
- package/dist-lib/components/reui/kanban.js +316 -0
- package/dist-lib/components/reui/kbd.js +19 -0
- package/dist-lib/components/reui/label.js +14 -0
- package/dist-lib/components/reui/menubar.js +132 -0
- package/dist-lib/components/reui/native-select.js +37 -0
- package/dist-lib/components/reui/navigation-menu.js +80 -0
- package/dist-lib/components/reui/number-field.js +126 -0
- package/dist-lib/components/reui/pagination.js +78 -0
- package/dist-lib/components/reui/phone-input.js +124 -0
- package/dist-lib/components/reui/popover.js +55 -0
- package/dist-lib/components/reui/progress.js +20 -0
- package/dist-lib/components/reui/radio-group.js +27 -0
- package/dist-lib/components/reui/rating.js +81 -0
- package/dist-lib/components/reui/resizable.js +31 -0
- package/dist-lib/components/reui/scroll-area.js +36 -0
- package/dist-lib/components/reui/scrollspy.js +104 -0
- package/dist-lib/components/reui/select.js +97 -0
- package/dist-lib/components/reui/separator.js +17 -0
- package/dist-lib/components/reui/sheet.js +81 -0
- package/dist-lib/components/reui/sidebar.js +350 -0
- package/dist-lib/components/reui/skeleton.js +12 -0
- package/dist-lib/components/reui/slider.js +35 -0
- package/dist-lib/components/reui/sonner.js +28 -0
- package/dist-lib/components/reui/sortable.js +172 -0
- package/dist-lib/components/reui/spinner.js +14 -0
- package/dist-lib/components/reui/stepper.js +193 -0
- package/dist-lib/components/reui/svgs/claudeAiIcon.js +13 -0
- package/dist-lib/components/reui/svgs/gemini.js +257 -0
- package/dist-lib/components/reui/svgs/openai.js +10 -0
- package/dist-lib/components/reui/svgs/openaiDark.js +13 -0
- package/dist-lib/components/reui/switch.js +19 -0
- package/dist-lib/components/reui/table.js +66 -0
- package/dist-lib/components/reui/tabs.js +47 -0
- package/dist-lib/components/reui/textarea.js +13 -0
- package/dist-lib/components/reui/timeline.js +84 -0
- package/dist-lib/components/reui/toggle-group.js +48 -0
- package/dist-lib/components/reui/toggle.js +36 -0
- package/dist-lib/components/reui/tooltip.js +35 -0
- package/dist-lib/components/reui/tree.js +102 -0
- package/dist-lib/i18n/I18nProvider.js +23 -0
- package/dist-lib/i18n/host-resolver.js +10 -0
- package/dist-lib/i18n/instance.js +2 -0
- package/dist-lib/i18n/locales/en/ui.json +266 -0
- package/dist-lib/i18n/locales/en/validators.json +13 -0
- package/dist-lib/i18n/locales/pt-BR/ui.json +266 -0
- package/dist-lib/i18n/locales/pt-BR/validators.json +13 -0
- package/dist-lib/i18n/register-strings.js +7 -0
- package/dist-lib/i18n/render-label.js +13 -0
- package/dist-lib/i18n/resolve-field-error.js +10 -0
- package/dist-lib/i18n/useHostString.js +31 -0
- package/dist-lib/i18n/useTranslation.js +48 -0
- package/dist-lib/lib/actions/resolve-action-target.js +48 -0
- package/dist-lib/lib/hooks/use-copy-to-clipboard.js +18 -0
- package/dist-lib/lib/hooks/use-file-upload.js +171 -0
- package/dist-lib/lib/hooks/use-mobile.js +18 -0
- package/dist-lib/lib/portal-container.js +7 -0
- package/dist-lib/lib/utils.js +8 -0
- package/package.json +39 -7
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import * as t from "react";
|
|
3
|
+
import { Slider as n } from "radix-ui";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/reui/slider.tsx
|
|
6
|
+
function a({ className: a, defaultValue: o, value: s, min: c = 0, max: l = 100, ...u }) {
|
|
7
|
+
let d = t.useMemo(() => Array.isArray(s) ? s : Array.isArray(o) ? o : [c, l], [
|
|
8
|
+
s,
|
|
9
|
+
o,
|
|
10
|
+
c,
|
|
11
|
+
l
|
|
12
|
+
]);
|
|
13
|
+
return /* @__PURE__ */ i(n.Root, {
|
|
14
|
+
"data-slot": "slider",
|
|
15
|
+
defaultValue: o,
|
|
16
|
+
value: s,
|
|
17
|
+
min: c,
|
|
18
|
+
max: l,
|
|
19
|
+
className: e("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col", a),
|
|
20
|
+
...u,
|
|
21
|
+
children: [/* @__PURE__ */ r(n.Track, {
|
|
22
|
+
"data-slot": "slider-track",
|
|
23
|
+
className: e("relative grow overflow-hidden rounded-full bg-muted data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"),
|
|
24
|
+
children: /* @__PURE__ */ r(n.Range, {
|
|
25
|
+
"data-slot": "slider-range",
|
|
26
|
+
className: e("absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full")
|
|
27
|
+
})
|
|
28
|
+
}), Array.from({ length: d.length }, (e, t) => /* @__PURE__ */ r(n.Thumb, {
|
|
29
|
+
"data-slot": "slider-thumb",
|
|
30
|
+
className: "block size-4 shrink-0 rounded-full border border-primary bg-white shadow-sm ring-ring/50 transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
|
|
31
|
+
}, t))]
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { a as Slider };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { getEffectiveTheme as e, getStoredAppearance as t } from "../../base/theme/appearance.js";
|
|
3
|
+
import { getPortalContainer as n } from "../../lib/portal-container.js";
|
|
4
|
+
import { CircleCheckIcon as r, InfoIcon as i, Loader2Icon as a, OctagonXIcon as o, TriangleAlertIcon as s } from "lucide-react";
|
|
5
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
6
|
+
import { createPortal as l } from "react-dom";
|
|
7
|
+
import { Toaster as u } from "sonner";
|
|
8
|
+
//#region src/components/reui/sonner.tsx
|
|
9
|
+
var d = ({ ...d }) => l(/* @__PURE__ */ c(u, {
|
|
10
|
+
theme: e(t()),
|
|
11
|
+
className: "toaster group",
|
|
12
|
+
icons: {
|
|
13
|
+
success: /* @__PURE__ */ c(r, { className: "size-4" }),
|
|
14
|
+
info: /* @__PURE__ */ c(i, { className: "size-4" }),
|
|
15
|
+
warning: /* @__PURE__ */ c(s, { className: "size-4" }),
|
|
16
|
+
error: /* @__PURE__ */ c(o, { className: "size-4" }),
|
|
17
|
+
loading: /* @__PURE__ */ c(a, { className: "size-4 animate-spin" })
|
|
18
|
+
},
|
|
19
|
+
style: {
|
|
20
|
+
"--normal-bg": "var(--popover)",
|
|
21
|
+
"--normal-text": "var(--popover-foreground)",
|
|
22
|
+
"--normal-border": "var(--border)",
|
|
23
|
+
"--border-radius": "var(--radius)"
|
|
24
|
+
},
|
|
25
|
+
...d
|
|
26
|
+
}), n());
|
|
27
|
+
//#endregion
|
|
28
|
+
export { d as Toaster };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { Children as t, cloneElement as n, createContext as r, isValidElement as i, useCallback as a, useContext as o, useLayoutEffect as s, useMemo as c, useState as l } from "react";
|
|
3
|
+
import { Slot as u } from "radix-ui";
|
|
4
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
5
|
+
import { DndContext as p, DragOverlay as m, KeyboardSensor as h, MeasuringStrategy as g, MouseSensor as _, TouchSensor as v, defaultDropAnimationSideEffects as y, useSensor as b, useSensors as x } from "@dnd-kit/core";
|
|
6
|
+
import { SortableContext as S, arrayMove as C, defaultAnimateLayoutChanges as w, rectSortingStrategy as T, sortableKeyboardCoordinates as E, useSortable as D, verticalListSortingStrategy as O } from "@dnd-kit/sortable";
|
|
7
|
+
import { CSS as k } from "@dnd-kit/utilities";
|
|
8
|
+
import { createPortal as A } from "react-dom";
|
|
9
|
+
//#region src/components/reui/sortable.tsx
|
|
10
|
+
var j = r({
|
|
11
|
+
listeners: void 0,
|
|
12
|
+
isDragging: !1,
|
|
13
|
+
disabled: !1
|
|
14
|
+
}), M = r(!1), N = r({
|
|
15
|
+
activeId: null,
|
|
16
|
+
modifiers: void 0
|
|
17
|
+
}), P = (e) => w({
|
|
18
|
+
...e,
|
|
19
|
+
wasDragging: !0
|
|
20
|
+
}), F = { sideEffects: y({ styles: { active: { opacity: "0.4" } } }) };
|
|
21
|
+
function I({ value: r, onValueChange: o, getItemValue: y, className: w, asChild: D = !1, onMove: k, strategy: j = "vertical", onDragStart: P, onDragEnd: I, modifiers: L, children: R, ...z }) {
|
|
22
|
+
let [B, V] = l(null), [H, U] = l(!1);
|
|
23
|
+
s(() => U(!0), []);
|
|
24
|
+
let W = x(b(_, { activationConstraint: { distance: 10 } }), b(v, { activationConstraint: {
|
|
25
|
+
delay: 250,
|
|
26
|
+
tolerance: 5
|
|
27
|
+
} }), b(h, { coordinateGetter: E })), G = a((e) => {
|
|
28
|
+
V(e.active.id), P?.(e);
|
|
29
|
+
}, [P]), K = a((e) => {
|
|
30
|
+
let { active: t, over: n } = e;
|
|
31
|
+
if (V(null), I?.(e), !n) return;
|
|
32
|
+
let i = r.findIndex((e) => y(e) === t.id), a = r.findIndex((e) => y(e) === n.id);
|
|
33
|
+
i !== a && (k ? k({
|
|
34
|
+
event: e,
|
|
35
|
+
activeIndex: i,
|
|
36
|
+
overIndex: a
|
|
37
|
+
}) : o(C(r, i, a)));
|
|
38
|
+
}, [
|
|
39
|
+
r,
|
|
40
|
+
y,
|
|
41
|
+
o,
|
|
42
|
+
k,
|
|
43
|
+
I
|
|
44
|
+
]), q = a(() => {
|
|
45
|
+
V(null);
|
|
46
|
+
}, []), J = () => {
|
|
47
|
+
switch (j) {
|
|
48
|
+
case "horizontal": return T;
|
|
49
|
+
case "grid": return T;
|
|
50
|
+
default: return O;
|
|
51
|
+
}
|
|
52
|
+
}, Y = c(() => r.map(y), [r, y]), X = c(() => ({
|
|
53
|
+
activeId: B,
|
|
54
|
+
modifiers: L
|
|
55
|
+
}), [B, L]), Z = c(() => {
|
|
56
|
+
if (!B) return null;
|
|
57
|
+
let r = null;
|
|
58
|
+
return t.forEach(R, (t) => {
|
|
59
|
+
i(t) && t.props.value === B && (r = n(t, {
|
|
60
|
+
...t.props,
|
|
61
|
+
className: e(t.props.className, "z-50")
|
|
62
|
+
}));
|
|
63
|
+
}), r;
|
|
64
|
+
}, [B, R]), Q = D ? u.Root : "div";
|
|
65
|
+
return /* @__PURE__ */ d(N.Provider, {
|
|
66
|
+
value: X,
|
|
67
|
+
children: /* @__PURE__ */ f(p, {
|
|
68
|
+
sensors: W,
|
|
69
|
+
modifiers: L,
|
|
70
|
+
measuring: { droppable: { strategy: g.Always } },
|
|
71
|
+
onDragStart: G,
|
|
72
|
+
onDragEnd: K,
|
|
73
|
+
onDragCancel: q,
|
|
74
|
+
children: [/* @__PURE__ */ d(S, {
|
|
75
|
+
items: Y,
|
|
76
|
+
strategy: J(),
|
|
77
|
+
children: /* @__PURE__ */ d(Q, {
|
|
78
|
+
"data-slot": "sortable",
|
|
79
|
+
"data-dragging": B !== null,
|
|
80
|
+
className: e(B !== null && "cursor-grabbing!", w),
|
|
81
|
+
...z,
|
|
82
|
+
children: R
|
|
83
|
+
})
|
|
84
|
+
}), H && A(/* @__PURE__ */ d(m, {
|
|
85
|
+
dropAnimation: F,
|
|
86
|
+
modifiers: L,
|
|
87
|
+
className: e("z-50", B && "cursor-grabbing"),
|
|
88
|
+
children: /* @__PURE__ */ d(M.Provider, {
|
|
89
|
+
value: !0,
|
|
90
|
+
children: Z
|
|
91
|
+
})
|
|
92
|
+
}), document.body)]
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function L({ value: t, className: n, asChild: r = !1, disabled: i, children: a, ...s }) {
|
|
97
|
+
let c = o(M), { setNodeRef: l, transform: f, transition: p, attributes: m, listeners: h, isDragging: g } = D({
|
|
98
|
+
id: t,
|
|
99
|
+
disabled: i || c,
|
|
100
|
+
animateLayoutChanges: P
|
|
101
|
+
});
|
|
102
|
+
if (c) {
|
|
103
|
+
let i = r ? u.Root : "div";
|
|
104
|
+
return /* @__PURE__ */ d(j.Provider, {
|
|
105
|
+
value: {
|
|
106
|
+
listeners: void 0,
|
|
107
|
+
isDragging: !0,
|
|
108
|
+
disabled: !1
|
|
109
|
+
},
|
|
110
|
+
children: /* @__PURE__ */ d(i, {
|
|
111
|
+
"data-slot": "sortable-item",
|
|
112
|
+
"data-value": t,
|
|
113
|
+
"data-dragging": !0,
|
|
114
|
+
className: e(n),
|
|
115
|
+
...s,
|
|
116
|
+
children: a
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
let _ = {
|
|
121
|
+
transition: p,
|
|
122
|
+
transform: k.Transform.toString(f)
|
|
123
|
+
}, v = r ? u.Root : "div";
|
|
124
|
+
return /* @__PURE__ */ d(j.Provider, {
|
|
125
|
+
value: {
|
|
126
|
+
listeners: h,
|
|
127
|
+
isDragging: g,
|
|
128
|
+
disabled: i
|
|
129
|
+
},
|
|
130
|
+
children: /* @__PURE__ */ d(v, {
|
|
131
|
+
"data-slot": "sortable-item",
|
|
132
|
+
"data-value": t,
|
|
133
|
+
"data-dragging": g,
|
|
134
|
+
"data-disabled": i,
|
|
135
|
+
ref: l,
|
|
136
|
+
style: _,
|
|
137
|
+
...m,
|
|
138
|
+
className: e(g && "z-50 opacity-50", i && "opacity-50", n),
|
|
139
|
+
...s,
|
|
140
|
+
children: a
|
|
141
|
+
})
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function R({ className: t, asChild: n = !1, cursor: r = !0, children: i, ...a }) {
|
|
145
|
+
let { listeners: s, isDragging: c, disabled: l } = o(j);
|
|
146
|
+
return /* @__PURE__ */ d(n ? u.Root : "div", {
|
|
147
|
+
"data-slot": "sortable-item-handle",
|
|
148
|
+
"data-dragging": c,
|
|
149
|
+
"data-disabled": l,
|
|
150
|
+
...s,
|
|
151
|
+
className: e(r && (c ? "cursor-grabbing!" : "cursor-grab!"), t),
|
|
152
|
+
...a,
|
|
153
|
+
children: i
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function z({ children: t, className: n, ...r }) {
|
|
157
|
+
let { activeId: i, modifiers: a } = o(N), [c, u] = l(!1);
|
|
158
|
+
s(() => u(!0), []);
|
|
159
|
+
let f = i && t ? typeof t == "function" ? t({ value: i }) : t : null;
|
|
160
|
+
return c ? A(/* @__PURE__ */ d(m, {
|
|
161
|
+
dropAnimation: F,
|
|
162
|
+
modifiers: a,
|
|
163
|
+
className: e("z-50", i && "cursor-grabbing", n),
|
|
164
|
+
...r,
|
|
165
|
+
children: /* @__PURE__ */ d(M.Provider, {
|
|
166
|
+
value: !0,
|
|
167
|
+
children: f
|
|
168
|
+
})
|
|
169
|
+
}), document.body) : null;
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
export { I as Sortable, L as SortableItem, R as SortableItemHandle, z as SortableOverlay };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { Loader2Icon as t } from "lucide-react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/reui/spinner.tsx
|
|
5
|
+
function r({ className: r, ...i }) {
|
|
6
|
+
return /* @__PURE__ */ n(t, {
|
|
7
|
+
role: "status",
|
|
8
|
+
"aria-label": "Loading",
|
|
9
|
+
className: e("size-4 animate-spin", r),
|
|
10
|
+
...i
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { r as Spinner };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import { Children as t, createContext as n, isValidElement as r, useCallback as i, useContext as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
3
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/reui/stepper.tsx
|
|
5
|
+
var d = n(void 0), f = n(void 0);
|
|
6
|
+
function p() {
|
|
7
|
+
let e = a(d);
|
|
8
|
+
if (!e) throw Error("useStepper must be used within a Stepper");
|
|
9
|
+
return e;
|
|
10
|
+
}
|
|
11
|
+
function m() {
|
|
12
|
+
let e = a(f);
|
|
13
|
+
if (!e) throw Error("useStepItem must be used within a StepperItem");
|
|
14
|
+
return e;
|
|
15
|
+
}
|
|
16
|
+
function h({ defaultValue: n = 1, value: a, onValueChange: o, orientation: c = "horizontal", className: f, children: p, indicators: m = {}, ...h }) {
|
|
17
|
+
let [g, _] = l(n), [v, y] = l([]), b = i((e) => {
|
|
18
|
+
y((t) => e && !t.includes(e) ? [...t, e] : !e && t.includes(e) ? t.filter((t) => t !== e) : t);
|
|
19
|
+
}, []), x = i((e) => {
|
|
20
|
+
a === void 0 && _(e), o?.(e);
|
|
21
|
+
}, [a, o]), S = a ?? g, C = (e) => {
|
|
22
|
+
v[e] && v[e].focus();
|
|
23
|
+
}, w = (e) => C((e + 1) % v.length), T = (e) => C((e - 1 + v.length) % v.length), E = () => C(0), D = () => C(v.length - 1), O = s(() => ({
|
|
24
|
+
activeStep: S,
|
|
25
|
+
setActiveStep: x,
|
|
26
|
+
stepsCount: t.toArray(p).filter((e) => r(e) && e.type.displayName === "StepperItem").length,
|
|
27
|
+
orientation: c,
|
|
28
|
+
registerTrigger: b,
|
|
29
|
+
focusNext: w,
|
|
30
|
+
focusPrev: T,
|
|
31
|
+
focusFirst: E,
|
|
32
|
+
focusLast: D,
|
|
33
|
+
triggerNodes: v,
|
|
34
|
+
indicators: m
|
|
35
|
+
}), [
|
|
36
|
+
S,
|
|
37
|
+
x,
|
|
38
|
+
p,
|
|
39
|
+
c,
|
|
40
|
+
b,
|
|
41
|
+
v
|
|
42
|
+
]);
|
|
43
|
+
return /* @__PURE__ */ u(d.Provider, {
|
|
44
|
+
value: O,
|
|
45
|
+
children: /* @__PURE__ */ u("div", {
|
|
46
|
+
role: "tablist",
|
|
47
|
+
"aria-orientation": c,
|
|
48
|
+
"data-slot": "stepper",
|
|
49
|
+
className: e("w-full", f),
|
|
50
|
+
"data-orientation": c,
|
|
51
|
+
...h,
|
|
52
|
+
children: p
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function g({ step: t, completed: n = !1, disabled: r = !1, loading: i = !1, className: a, children: o, ...s }) {
|
|
57
|
+
let { activeStep: c } = p(), l = n || t < c ? "completed" : c === t ? "active" : "inactive", d = i && t === c;
|
|
58
|
+
return /* @__PURE__ */ u(f.Provider, {
|
|
59
|
+
value: {
|
|
60
|
+
step: t,
|
|
61
|
+
state: l,
|
|
62
|
+
isDisabled: r,
|
|
63
|
+
isLoading: d
|
|
64
|
+
},
|
|
65
|
+
children: /* @__PURE__ */ u("div", {
|
|
66
|
+
"data-slot": "stepper-item",
|
|
67
|
+
className: e("group/step flex items-center justify-center not-last:flex-1 group-data-[orientation=horizontal]/stepper-nav:flex-row group-data-[orientation=vertical]/stepper-nav:flex-col", a),
|
|
68
|
+
"data-state": l,
|
|
69
|
+
...d ? { "data-loading": !0 } : {},
|
|
70
|
+
...s,
|
|
71
|
+
children: o
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
function _({ asChild: t = !1, className: n, children: r, tabIndex: i, ...a }) {
|
|
76
|
+
let { state: l, isLoading: d } = m(), { setActiveStep: f, activeStep: h, registerTrigger: g, triggerNodes: _, focusNext: v, focusPrev: y, focusFirst: b, focusLast: x } = p(), { step: S, isDisabled: C } = m(), w = h === S, T = `stepper-tab-${S}`, E = `stepper-panel-${S}`, D = c(null);
|
|
77
|
+
o(() => {
|
|
78
|
+
D.current && g(D.current);
|
|
79
|
+
}, [D.current]);
|
|
80
|
+
let O = s(() => _.findIndex((e) => e === D.current), [_, D.current]), k = (e) => {
|
|
81
|
+
switch (e.key) {
|
|
82
|
+
case "ArrowRight":
|
|
83
|
+
case "ArrowDown":
|
|
84
|
+
e.preventDefault(), O !== -1 && v && v(O);
|
|
85
|
+
break;
|
|
86
|
+
case "ArrowLeft":
|
|
87
|
+
case "ArrowUp":
|
|
88
|
+
e.preventDefault(), O !== -1 && y && y(O);
|
|
89
|
+
break;
|
|
90
|
+
case "Home":
|
|
91
|
+
e.preventDefault(), b && b();
|
|
92
|
+
break;
|
|
93
|
+
case "End":
|
|
94
|
+
e.preventDefault(), x && x();
|
|
95
|
+
break;
|
|
96
|
+
case "Enter":
|
|
97
|
+
case " ":
|
|
98
|
+
e.preventDefault(), f(S);
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
return t ? /* @__PURE__ */ u("span", {
|
|
103
|
+
"data-slot": "stepper-trigger",
|
|
104
|
+
"data-state": l,
|
|
105
|
+
className: n,
|
|
106
|
+
children: r
|
|
107
|
+
}) : /* @__PURE__ */ u("button", {
|
|
108
|
+
ref: D,
|
|
109
|
+
role: "tab",
|
|
110
|
+
id: T,
|
|
111
|
+
"aria-selected": w,
|
|
112
|
+
"aria-controls": E,
|
|
113
|
+
tabIndex: typeof i == "number" ? i : w ? 0 : -1,
|
|
114
|
+
"data-slot": "stepper-trigger",
|
|
115
|
+
"data-state": l,
|
|
116
|
+
"data-loading": d,
|
|
117
|
+
className: e("focus-visible:border-ring focus-visible:ring-ring/50 inline-flex cursor-pointer items-center outline-none focus-visible:z-10 focus-visible:ring-3 disabled:pointer-events-none disabled:opacity-60", "gap-3 rounded-full", n),
|
|
118
|
+
onClick: () => f(S),
|
|
119
|
+
onKeyDown: k,
|
|
120
|
+
disabled: C,
|
|
121
|
+
...a,
|
|
122
|
+
children: r
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function v({ children: t, className: n }) {
|
|
126
|
+
let { state: r, isLoading: i } = m(), { indicators: a } = p();
|
|
127
|
+
return /* @__PURE__ */ u("div", {
|
|
128
|
+
"data-slot": "stepper-indicator",
|
|
129
|
+
"data-state": r,
|
|
130
|
+
className: e("border-background bg-accent text-accent-foreground data-[state=completed]:bg-primary data-[state=completed]:text-primary-foreground data-[state=active]:bg-primary data-[state=active]:text-primary-foreground relative flex size-6 shrink-0 items-center justify-center overflow-hidden", "rounded-full text-xs", n),
|
|
131
|
+
children: /* @__PURE__ */ u("div", {
|
|
132
|
+
className: "absolute",
|
|
133
|
+
children: a && (i && a.loading || r === "completed" && a.completed || r === "active" && a.active || r === "inactive" && a.inactive) ? i && a.loading || r === "completed" && a.completed || r === "active" && a.active || r === "inactive" && a.inactive : t
|
|
134
|
+
})
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function y({ className: t }) {
|
|
138
|
+
let { state: n } = m();
|
|
139
|
+
return /* @__PURE__ */ u("div", {
|
|
140
|
+
"data-slot": "stepper-separator",
|
|
141
|
+
"data-state": n,
|
|
142
|
+
className: e("bg-muted rounded-full group-data-[orientation=horizontal]/stepper-nav:h-0.5 group-data-[orientation=vertical]/stepper-nav:h-12 group-data-[orientation=vertical]/stepper-nav:w-0.5 m-0.5 group-data-[orientation=horizontal]/stepper-nav:flex-1", t)
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
function b({ children: t, className: n }) {
|
|
146
|
+
let { state: r } = m();
|
|
147
|
+
return /* @__PURE__ */ u("h3", {
|
|
148
|
+
"data-slot": "stepper-title",
|
|
149
|
+
"data-state": r,
|
|
150
|
+
className: e("text-sm leading-none font-medium", n),
|
|
151
|
+
children: t
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function x({ children: t, className: n }) {
|
|
155
|
+
let { state: r } = m();
|
|
156
|
+
return /* @__PURE__ */ u("div", {
|
|
157
|
+
"data-slot": "stepper-description",
|
|
158
|
+
"data-state": r,
|
|
159
|
+
className: e("text-muted-foreground text-sm", n),
|
|
160
|
+
children: t
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function S({ children: t, className: n }) {
|
|
164
|
+
let { activeStep: r, orientation: i } = p();
|
|
165
|
+
return /* @__PURE__ */ u("nav", {
|
|
166
|
+
"data-slot": "stepper-nav",
|
|
167
|
+
"data-state": r,
|
|
168
|
+
"data-orientation": i,
|
|
169
|
+
className: e("group/stepper-nav inline-flex data-[orientation=horizontal]:w-full data-[orientation=horizontal]:flex-row data-[orientation=vertical]:flex-col", n),
|
|
170
|
+
children: t
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function C({ children: t, className: n }) {
|
|
174
|
+
let { activeStep: r } = p();
|
|
175
|
+
return /* @__PURE__ */ u("div", {
|
|
176
|
+
"data-slot": "stepper-panel",
|
|
177
|
+
"data-state": r,
|
|
178
|
+
className: e("w-full", n),
|
|
179
|
+
children: t
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function w({ value: t, forceMount: n, children: r, className: i }) {
|
|
183
|
+
let { activeStep: a } = p(), o = t === a;
|
|
184
|
+
return !n && !o ? null : /* @__PURE__ */ u("div", {
|
|
185
|
+
"data-slot": "stepper-content",
|
|
186
|
+
"data-state": a,
|
|
187
|
+
className: e("w-full", i, !o && n && "hidden"),
|
|
188
|
+
hidden: !o && n,
|
|
189
|
+
children: r
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
export { h as Stepper, w as StepperContent, x as StepperDescription, v as StepperIndicator, g as StepperItem, S as StepperNav, C as StepperPanel, y as StepperSeparator, b as StepperTitle, _ as StepperTrigger, m as useStepItem, p as useStepper };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
//#region src/components/reui/svgs/claudeAiIcon.tsx
|
|
3
|
+
var t = (t) => /* @__PURE__ */ e("svg", {
|
|
4
|
+
...t,
|
|
5
|
+
preserveAspectRatio: "xMidYMid",
|
|
6
|
+
viewBox: "0 0 256 257",
|
|
7
|
+
children: /* @__PURE__ */ e("path", {
|
|
8
|
+
fill: "#D97757",
|
|
9
|
+
d: "m50.228 170.321 50.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0 125.796l.583-3.759 5.12-3.434 7.324.648 16.202 1.101 24.304 1.685 17.629 1.037 26.118 2.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758 7-7.713 9.397.649 2.398.648 9.527 7.323 20.35 15.75L94.817 91.9l3.889 3.24 1.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0 82.05 1.426l4.472 3.888 6.61 15.101 10.694 23.786 16.591 32.34 4.861 9.592 2.592 8.879.973 2.722h1.685v-1.556l1.36-18.211 2.528-22.36 2.463-28.776.843-8.1 4.018-9.722 7.971-5.25 6.222 2.981 5.12 7.324-.713 4.73-3.046 19.768-5.962 30.98-3.889 20.739h2.268l2.593-2.593 10.499-13.934 17.628-22.036 7.778-8.749 9.073-9.657 5.833-4.601h11.018l8.1 12.055-3.628 12.443-11.342 14.388-9.398 12.184-13.48 18.147-8.426 14.518.778 1.166 2.01-.194 30.46-6.481 16.462-2.982 19.637-3.37 8.88 4.148.971 4.213-3.5 8.62-20.998 5.184-24.628 4.926-36.682 8.685-.454.324.519.648 16.526 1.555 7.065.389h17.304l32.21 2.398 8.426 5.574 5.055 6.805-.843 5.184-12.962 6.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666 11.406 21.387 19.314 26.767 24.887 1.36 6.157-3.434 4.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73 6.935 25.017 37.59 1.296 11.536-1.814 3.76-6.481 2.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194 77.448-3.37 3.953-7.778 2.981-6.48-4.925-3.436-7.972 3.435-15.749 4.148-20.544 3.37-16.333 3.046-20.285 1.815-6.74-.13-.454-1.49.194-15.295 20.999-23.267 31.433-18.406 19.702-4.407 1.75-7.648-3.954.713-7.064 4.277-6.286 25.47-32.405 15.36-20.092 9.917-11.6-.065-1.686h-.583L44.07 198.125l-12.055 1.555-5.185-4.86.648-7.972 2.463-2.593 20.35-13.999-.064.065Z"
|
|
10
|
+
})
|
|
11
|
+
});
|
|
12
|
+
//#endregion
|
|
13
|
+
export { t as ClaudeAiIcon };
|