@ramme-io/ui 4.1.0 → 4.2.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 +4 -3
- package/dist/component-registry.js +55 -52
- package/dist/components/ai/AIChatThread/AIChatThread.js +3 -3
- package/dist/components/ai/NewsSummaryCard/NewsSummaryCard.js +17 -17
- package/dist/components/ai/StockChart/StockChart.js +35 -35
- package/dist/components/auth/LoginPage.d.ts +22 -0
- package/dist/components/auth/LoginPage.js +50 -42
- package/dist/components/data-display/StatusBadge.d.ts +4 -3
- package/dist/components/data-display/StatusBadge.js +18 -18
- package/dist/components/feedback/Alert.js +19 -19
- package/dist/components/forms/ComboBox.js +2 -2
- package/dist/components/forms/DatePicker.js +37 -32
- package/dist/components/forms/FileUpload.js +39 -37
- package/dist/components/forms/Input.js +19 -18
- package/dist/components/forms/MultiSelect.js +9 -8
- package/dist/components/forms/SegmentedControl.js +10 -10
- package/dist/components/forms/Select.js +9 -8
- package/dist/components/forms/Textarea.d.ts +13 -11
- package/dist/components/forms/Textarea.js +36 -16
- package/dist/components/layout/Accordion.js +25 -32
- package/dist/components/layout/Card.js +38 -21
- package/dist/components/layout/DetailDrawer.d.ts +9 -1
- package/dist/components/layout/DetailDrawer.js +60 -51
- package/dist/components/layout/Drawer.js +47 -39
- package/dist/components/layout/Modal.js +28 -23
- package/dist/components/layout/SettingsContainer.js +23 -13
- package/dist/components/layout/Sheet.d.ts +58 -0
- package/dist/components/layout/Sheet.js +146 -0
- package/dist/components/navigation/MobileNav.d.ts +44 -1
- package/dist/components/navigation/MobileNav.js +96 -70
- package/dist/components/navigation/Tabs.js +19 -12
- package/dist/components/ui/icon-loader.d.ts +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +218 -209
- package/dist/lib/hooks/useDialogFocus.d.ts +1 -0
- package/dist/lib/hooks/useDialogFocus.js +46 -0
- package/dist/lib/hooks/useSheetGesture.d.ts +81 -0
- package/dist/lib/hooks/useSheetGesture.js +70 -0
- package/dist/setupTests.d.ts +1 -0
- package/dist/wizardManifest.js +139 -14
- package/package.json +9 -2
- package/src/wizardManifest.ts +139 -14
- package/tailwind.preset.js +8 -0
|
@@ -1,98 +1,106 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Link as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Input as
|
|
6
|
-
import { Alert as
|
|
1
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as h } from "react";
|
|
3
|
+
import { Link as x } from "react-router-dom";
|
|
4
|
+
import { Button as v } from "../ui/Button.js";
|
|
5
|
+
import { Input as f } from "../forms/Input.js";
|
|
6
|
+
import { Alert as y } from "../feedback/Alert.js";
|
|
7
7
|
import { Icon as s } from "../ui/Icon.js";
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
const A = ({
|
|
9
|
+
onLogin: g,
|
|
10
|
+
error: l,
|
|
11
|
+
loading: i,
|
|
12
|
+
quickProfiles: r,
|
|
13
|
+
signupHref: n = "/auth/signup",
|
|
14
|
+
signupLabel: b = "Create one",
|
|
15
|
+
forgotHref: o = "#"
|
|
16
|
+
}) => {
|
|
17
|
+
const [c, d] = h(""), [m, u] = h(""), N = (t) => {
|
|
18
|
+
t.preventDefault(), g(c, m);
|
|
19
|
+
}, p = "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 mb-2 block text-foreground/90";
|
|
20
|
+
return /* @__PURE__ */ a("div", { className: "w-full max-w-[400px] space-y-6 animate-in fade-in zoom-in-95 duration-300", children: [
|
|
21
|
+
/* @__PURE__ */ a("div", { className: "flex flex-col items-center space-y-2 text-center mb-8", children: [
|
|
14
22
|
/* @__PURE__ */ e("div", { className: "h-10 w-10 bg-primary/10 rounded-xl flex items-center justify-center mb-2 border border-primary/20", children: /* @__PURE__ */ e(s, { name: "hexagon", className: "text-primary fill-primary/20", size: 24, strokeWidth: 2.5 }) }),
|
|
15
23
|
/* @__PURE__ */ e("h1", { className: "text-2xl font-bold tracking-tight", children: "Welcome back" }),
|
|
16
24
|
/* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "Enter your credentials to access your workspace" })
|
|
17
25
|
] }),
|
|
18
|
-
/* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */ e("div", { className: "p-6 pt-6", children: /* @__PURE__ */
|
|
20
|
-
l && /* @__PURE__ */ e(
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
/* @__PURE__ */ e("label", { htmlFor: "email", className:
|
|
23
|
-
/* @__PURE__ */
|
|
26
|
+
/* @__PURE__ */ a("div", { className: "bg-card text-card-foreground border shadow-sm rounded-xl overflow-hidden", children: [
|
|
27
|
+
/* @__PURE__ */ e("div", { className: "p-6 pt-6", children: /* @__PURE__ */ a("form", { onSubmit: N, className: "space-y-4", children: [
|
|
28
|
+
l && /* @__PURE__ */ e(y, { variant: "danger", title: "Authentication Error", className: "mb-4", children: l }),
|
|
29
|
+
/* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
30
|
+
/* @__PURE__ */ e("label", { htmlFor: "email", className: p, children: "Email" }),
|
|
31
|
+
/* @__PURE__ */ a("div", { className: "relative group", children: [
|
|
24
32
|
/* @__PURE__ */ e(s, { name: "mail", className: "absolute left-3 top-2.5 h-4 w-4 text-muted-foreground group-focus-within:text-primary transition-colors" }),
|
|
25
33
|
/* @__PURE__ */ e(
|
|
26
|
-
|
|
34
|
+
f,
|
|
27
35
|
{
|
|
28
36
|
id: "email",
|
|
29
37
|
type: "email",
|
|
30
38
|
placeholder: "name@example.com",
|
|
31
39
|
className: "pl-9 h-10 bg-background/50",
|
|
32
|
-
value:
|
|
33
|
-
onChange: (
|
|
40
|
+
value: c,
|
|
41
|
+
onChange: (t) => d(t.target.value),
|
|
34
42
|
required: !0
|
|
35
43
|
}
|
|
36
44
|
)
|
|
37
45
|
] })
|
|
38
46
|
] }),
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
/* @__PURE__ */ e("label", { htmlFor: "password", className:
|
|
42
|
-
/* @__PURE__ */ e(
|
|
47
|
+
/* @__PURE__ */ a("div", { className: "space-y-1", children: [
|
|
48
|
+
/* @__PURE__ */ a("div", { className: "flex items-center justify-between", children: [
|
|
49
|
+
/* @__PURE__ */ e("label", { htmlFor: "password", className: p, children: "Password" }),
|
|
50
|
+
o !== null && /* @__PURE__ */ e(x, { to: o, className: "text-xs text-primary hover:underline font-medium", children: "Forgot?" })
|
|
43
51
|
] }),
|
|
44
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ a("div", { className: "relative group", children: [
|
|
45
53
|
/* @__PURE__ */ e(s, { name: "lock", className: "absolute left-3 top-2.5 h-4 w-4 text-muted-foreground group-focus-within:text-primary transition-colors" }),
|
|
46
54
|
/* @__PURE__ */ e(
|
|
47
|
-
|
|
55
|
+
f,
|
|
48
56
|
{
|
|
49
57
|
id: "password",
|
|
50
58
|
type: "password",
|
|
51
59
|
className: "pl-9 h-10 bg-background/50",
|
|
52
|
-
value:
|
|
53
|
-
onChange: (
|
|
60
|
+
value: m,
|
|
61
|
+
onChange: (t) => u(t.target.value),
|
|
54
62
|
required: !0
|
|
55
63
|
}
|
|
56
64
|
)
|
|
57
65
|
] })
|
|
58
66
|
] }),
|
|
59
|
-
/* @__PURE__ */ e(
|
|
67
|
+
/* @__PURE__ */ e(v, { type: "submit", className: "w-full mt-2", size: "lg", disabled: i, children: i ? "Authenticating..." : "Sign In" })
|
|
60
68
|
] }) }),
|
|
61
|
-
r && r.length > 0 && /* @__PURE__ */
|
|
62
|
-
/* @__PURE__ */
|
|
69
|
+
r && r.length > 0 && /* @__PURE__ */ a("div", { className: "px-6 pb-6 space-y-3", children: [
|
|
70
|
+
/* @__PURE__ */ a("div", { className: "relative mb-4", children: [
|
|
63
71
|
/* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center", children: /* @__PURE__ */ e("span", { className: "w-full border-t border-border/50" }) }),
|
|
64
72
|
/* @__PURE__ */ e("div", { className: "relative flex justify-center text-xs uppercase", children: /* @__PURE__ */ e("span", { className: "bg-card px-2 text-muted-foreground", children: "Quick Select Profiles" }) })
|
|
65
73
|
] }),
|
|
66
|
-
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: r.map((
|
|
74
|
+
/* @__PURE__ */ e("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: r.map((t) => /* @__PURE__ */ a(
|
|
67
75
|
"button",
|
|
68
76
|
{
|
|
69
77
|
type: "button",
|
|
70
78
|
onClick: () => {
|
|
71
|
-
|
|
79
|
+
d(t.email), u("demo");
|
|
72
80
|
},
|
|
73
81
|
className: "flex flex-col items-start p-3 text-left border rounded-lg hover:border-primary hover:bg-primary/5 transition-all w-full focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1 focus:ring-offset-card",
|
|
74
82
|
children: [
|
|
75
|
-
/* @__PURE__ */ e("span", { className: "font-medium text-sm text-foreground", children:
|
|
76
|
-
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children:
|
|
83
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-sm text-foreground", children: t.name }),
|
|
84
|
+
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: t.role })
|
|
77
85
|
]
|
|
78
86
|
},
|
|
79
|
-
|
|
87
|
+
t.email
|
|
80
88
|
)) })
|
|
81
89
|
] }),
|
|
82
|
-
/* @__PURE__ */
|
|
83
|
-
/* @__PURE__ */
|
|
90
|
+
n !== null && /* @__PURE__ */ a("div", { className: "p-6 pt-0 text-center", children: [
|
|
91
|
+
/* @__PURE__ */ a("div", { className: "relative mb-4", children: [
|
|
84
92
|
/* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center", children: /* @__PURE__ */ e("span", { className: "w-full border-t" }) }),
|
|
85
93
|
/* @__PURE__ */ e("div", { className: "relative flex justify-center text-xs uppercase", children: /* @__PURE__ */ e("span", { className: "bg-card px-2 text-muted-foreground", children: "Or continue with" }) })
|
|
86
94
|
] }),
|
|
87
|
-
/* @__PURE__ */
|
|
95
|
+
/* @__PURE__ */ a("p", { className: "text-sm text-muted-foreground", children: [
|
|
88
96
|
"Don't have an account?",
|
|
89
97
|
" ",
|
|
90
|
-
/* @__PURE__ */ e(
|
|
98
|
+
/* @__PURE__ */ e(x, { to: n, className: "font-semibold text-primary hover:underline transition-all", children: b })
|
|
91
99
|
] })
|
|
92
100
|
] })
|
|
93
101
|
] })
|
|
94
102
|
] });
|
|
95
103
|
};
|
|
96
104
|
export {
|
|
97
|
-
|
|
105
|
+
A as LoginPage
|
|
98
106
|
};
|
|
@@ -4,8 +4,9 @@ export interface StatusBadgeProps {
|
|
|
4
4
|
/** One of the 5 built-in presets. Omit and use `color` + `label` for a
|
|
5
5
|
* status this preset set doesn't cover (e.g. a domain-specific state). */
|
|
6
6
|
status?: StatusType;
|
|
7
|
-
/**
|
|
8
|
-
* the `status` preset's
|
|
7
|
+
/** Background class for the dot, e.g. 'bg-success' or 'bg-chart-2'. Overrides
|
|
8
|
+
* the `status` preset's colour when both are given. Use a semantic token: a
|
|
9
|
+
* numeric shade is fixed across all five themes. */
|
|
9
10
|
color?: string;
|
|
10
11
|
/**
|
|
11
12
|
* Optional custom label. If not provided, uses the default status name.
|
|
@@ -27,7 +28,7 @@ export interface StatusBadgeProps {
|
|
|
27
28
|
* description: One of the 5 built-in presets. Determines the color of the dot. Omit and use `color`+`label` for a status outside this set.
|
|
28
29
|
* - name: color
|
|
29
30
|
* type: string
|
|
30
|
-
* description:
|
|
31
|
+
* description: Background class for the dot (e.g. 'bg-success'). Use a semantic token — a numeric shade does not adapt to the active theme. Overrides the `status` preset's colour when both are given.
|
|
31
32
|
* - name: label
|
|
32
33
|
* type: string
|
|
33
34
|
* description: Custom text to display next to the dot. If omitted, displays the status name (e.g., "Online").
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { cn as
|
|
3
|
-
const
|
|
4
|
-
online: { color: "bg-
|
|
5
|
-
offline: { color: "bg-
|
|
6
|
-
error: { color: "bg-
|
|
7
|
-
warning: { color: "bg-
|
|
8
|
-
active: { color: "bg-
|
|
1
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { cn as i } from "../../utils/cn.js";
|
|
3
|
+
const g = {
|
|
4
|
+
online: { color: "bg-success", label: "Online" },
|
|
5
|
+
offline: { color: "bg-muted-foreground", label: "Offline" },
|
|
6
|
+
error: { color: "bg-destructive", label: "Error" },
|
|
7
|
+
warning: { color: "bg-warning", label: "Warning" },
|
|
8
|
+
active: { color: "bg-info", label: "Active" }
|
|
9
9
|
}, m = ({
|
|
10
|
-
status:
|
|
11
|
-
color:
|
|
12
|
-
label:
|
|
13
|
-
className:
|
|
14
|
-
showDot:
|
|
10
|
+
status: n,
|
|
11
|
+
color: t,
|
|
12
|
+
label: r,
|
|
13
|
+
className: c,
|
|
14
|
+
showDot: a = !0
|
|
15
15
|
}) => {
|
|
16
|
-
const
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
|
|
16
|
+
const o = n ? g[n] : void 0, s = t ?? (o == null ? void 0 : o.color) ?? "bg-muted-foreground", l = r === null ? null : r ?? (o == null ? void 0 : o.label) ?? null;
|
|
17
|
+
return /* @__PURE__ */ d("div", { className: i("inline-flex items-center gap-2", c), children: [
|
|
18
|
+
a && /* @__PURE__ */ e(
|
|
19
19
|
"span",
|
|
20
20
|
{
|
|
21
|
-
className:
|
|
21
|
+
className: i("h-2.5 w-2.5 rounded-full ring-2 ring-card", s),
|
|
22
22
|
"aria-hidden": "true"
|
|
23
23
|
}
|
|
24
24
|
),
|
|
25
|
-
|
|
25
|
+
l && /* @__PURE__ */ e("span", { className: "text-sm font-medium text-foreground", children: l })
|
|
26
26
|
] });
|
|
27
27
|
};
|
|
28
28
|
export {
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Icon as
|
|
3
|
-
const
|
|
1
|
+
import { jsxs as c, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { Icon as o } from "../ui/Icon.js";
|
|
3
|
+
const a = {
|
|
4
4
|
info: {
|
|
5
5
|
icon: "info",
|
|
6
|
-
classes: "bg-
|
|
6
|
+
classes: "bg-info/10 border-info/50 text-info-strong"
|
|
7
7
|
},
|
|
8
8
|
success: {
|
|
9
9
|
icon: "check-circle",
|
|
10
|
-
classes: "bg-
|
|
10
|
+
classes: "bg-success/10 border-success/50 text-success-strong"
|
|
11
11
|
},
|
|
12
12
|
warning: {
|
|
13
13
|
icon: "alert-triangle",
|
|
14
|
-
classes: "bg-
|
|
14
|
+
classes: "bg-warning/10 border-warning/50 text-warning-strong"
|
|
15
15
|
},
|
|
16
16
|
danger: {
|
|
17
17
|
icon: "x-circle",
|
|
18
|
-
classes: "bg-
|
|
18
|
+
classes: "bg-destructive/10 border-destructive/50 text-destructive-strong"
|
|
19
19
|
}
|
|
20
|
-
},
|
|
21
|
-
title:
|
|
22
|
-
children:
|
|
23
|
-
variant:
|
|
24
|
-
className:
|
|
20
|
+
}, g = ({
|
|
21
|
+
title: n,
|
|
22
|
+
children: e,
|
|
23
|
+
variant: i = "info",
|
|
24
|
+
className: t
|
|
25
25
|
}) => {
|
|
26
|
-
const
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
|
|
26
|
+
const r = a[i];
|
|
27
|
+
return /* @__PURE__ */ c("div", { className: `flex items-start gap-4 p-4 border-l-4 rounded-r-lg ${r.classes} ${t || ""}`, role: "alert", children: [
|
|
28
|
+
/* @__PURE__ */ s("div", { className: "flex-shrink-0", children: /* @__PURE__ */ s(o, { name: r.icon, size: 20 }) }),
|
|
29
|
+
/* @__PURE__ */ c("div", { className: "flex-grow", children: [
|
|
30
|
+
/* @__PURE__ */ s("h4", { className: "font-semibold", children: n }),
|
|
31
|
+
e && /* @__PURE__ */ s("div", { className: "text-sm mt-1", children: e })
|
|
32
32
|
] })
|
|
33
33
|
] });
|
|
34
34
|
};
|
|
35
35
|
export {
|
|
36
|
-
|
|
36
|
+
g as Alert
|
|
37
37
|
};
|
|
@@ -2,7 +2,7 @@ import { jsxs as D, jsx as i } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState as l, useRef as g, useEffect as f, useCallback as K } from "react";
|
|
3
3
|
import { Input as q } from "./Input.js";
|
|
4
4
|
import { cn as p } from "../../utils/cn.js";
|
|
5
|
-
const
|
|
5
|
+
const _ = ({
|
|
6
6
|
options: t,
|
|
7
7
|
label: v,
|
|
8
8
|
value: a,
|
|
@@ -73,5 +73,5 @@ const $ = ({
|
|
|
73
73
|
] });
|
|
74
74
|
};
|
|
75
75
|
export {
|
|
76
|
-
|
|
76
|
+
_ as ComboBox
|
|
77
77
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsxs as d, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import s from "react";
|
|
3
|
+
import b from "react-datepicker";
|
|
3
4
|
import { cn as e } from "../../utils/cn.js";
|
|
4
|
-
import { Icon as
|
|
5
|
+
import { Icon as u } from "../ui/Icon.js";
|
|
5
6
|
import "react-datepicker/dist/react-datepicker.css";
|
|
6
|
-
const
|
|
7
|
+
const f = `
|
|
7
8
|
.react-datepicker {
|
|
8
9
|
font-family: inherit !important;
|
|
9
10
|
background-color: rgb(var(--app-card-bg-color)) !important;
|
|
@@ -28,36 +29,40 @@ const m = `
|
|
|
28
29
|
.react-datepicker__navigation-icon::before {
|
|
29
30
|
border-color: rgb(var(--app-text-color)) !important;
|
|
30
31
|
}
|
|
31
|
-
`,
|
|
32
|
+
`, y = ({
|
|
32
33
|
label: o,
|
|
33
|
-
selected:
|
|
34
|
-
onChange:
|
|
35
|
-
className:
|
|
34
|
+
selected: l,
|
|
35
|
+
onChange: n,
|
|
36
|
+
className: p,
|
|
36
37
|
error: t,
|
|
37
38
|
helperText: a,
|
|
38
|
-
...
|
|
39
|
-
}) =>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/* @__PURE__ */ r(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
39
|
+
...c
|
|
40
|
+
}) => {
|
|
41
|
+
const m = s.useId(), i = c.id || m;
|
|
42
|
+
return /* @__PURE__ */ d("div", { className: e("w-full flex flex-col", p), children: [
|
|
43
|
+
/* @__PURE__ */ r("style", { children: f }),
|
|
44
|
+
o && /* @__PURE__ */ r("label", { htmlFor: i, className: "block text-sm font-medium text-foreground mb-1.5", children: o }),
|
|
45
|
+
/* @__PURE__ */ d("div", { className: "relative", children: [
|
|
46
|
+
/* @__PURE__ */ r(
|
|
47
|
+
b,
|
|
48
|
+
{
|
|
49
|
+
id: i,
|
|
50
|
+
selected: l,
|
|
51
|
+
onChange: n,
|
|
52
|
+
className: e(
|
|
53
|
+
"flex h-10 w-full rounded-md border bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
54
|
+
t ? "border-destructive" : "border-input"
|
|
55
|
+
),
|
|
56
|
+
wrapperClassName: "w-full",
|
|
57
|
+
showPopperArrow: !1,
|
|
58
|
+
...c
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
/* @__PURE__ */ r("div", { className: "absolute right-3 top-2.5 pointer-events-none text-muted-foreground", children: /* @__PURE__ */ r(u, { name: "calendar", className: "h-4 w-4" }) })
|
|
62
|
+
] }),
|
|
63
|
+
a && /* @__PURE__ */ r("p", { className: e("mt-1.5 text-xs", t ? "text-destructive" : "text-muted-foreground"), children: a })
|
|
64
|
+
] });
|
|
65
|
+
};
|
|
61
66
|
export {
|
|
62
|
-
|
|
67
|
+
y as DatePicker
|
|
63
68
|
};
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import { jsxs as t, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
2
|
+
import F, { useState as v, useRef as I, useCallback as i } from "react";
|
|
3
3
|
import { Button as j } from "../ui/Button.js";
|
|
4
|
-
import { Icon as
|
|
5
|
-
import { cn as
|
|
6
|
-
const
|
|
7
|
-
onFileUpload:
|
|
8
|
-
multiple:
|
|
9
|
-
acceptedFileTypes:
|
|
10
|
-
label:
|
|
11
|
-
className:
|
|
4
|
+
import { Icon as c } from "../ui/Icon.js";
|
|
5
|
+
import { cn as b } from "../../utils/cn.js";
|
|
6
|
+
const $ = ({
|
|
7
|
+
onFileUpload: N,
|
|
8
|
+
multiple: o = !1,
|
|
9
|
+
acceptedFileTypes: n,
|
|
10
|
+
label: s,
|
|
11
|
+
className: y,
|
|
12
12
|
helperText: m
|
|
13
13
|
}) => {
|
|
14
|
-
const [
|
|
15
|
-
e.preventDefault(), e.stopPropagation(), e.type === "dragenter" || e.type === "dragover" ?
|
|
14
|
+
const [D, d] = v(!1), [f, u] = v([]), p = I(null), l = i((e) => {
|
|
15
|
+
e.preventDefault(), e.stopPropagation(), e.type === "dragenter" || e.type === "dragover" ? d(!0) : e.type === "dragleave" && d(!1);
|
|
16
16
|
}, []), g = (e) => {
|
|
17
|
-
u((a) =>
|
|
18
|
-
},
|
|
19
|
-
e.preventDefault(), e.stopPropagation(),
|
|
20
|
-
}, [
|
|
17
|
+
u((a) => o ? [...a, ...e] : [e[0]]), N(e);
|
|
18
|
+
}, w = i((e) => {
|
|
19
|
+
e.preventDefault(), e.stopPropagation(), d(!1), e.dataTransfer.files && e.dataTransfer.files.length > 0 && g(Array.from(e.dataTransfer.files));
|
|
20
|
+
}, [o]), C = i((e) => {
|
|
21
21
|
e.preventDefault(), e.target.files && e.target.files.length > 0 && g(Array.from(e.target.files));
|
|
22
|
-
}, [
|
|
23
|
-
u((a) => a.filter((
|
|
24
|
-
};
|
|
25
|
-
return /* @__PURE__ */ t("div", { className:
|
|
26
|
-
|
|
22
|
+
}, [o]), k = (e) => {
|
|
23
|
+
u((a) => a.filter((x, A) => A !== e));
|
|
24
|
+
}, h = F.useId();
|
|
25
|
+
return /* @__PURE__ */ t("div", { className: b("w-full", y), children: [
|
|
26
|
+
s && /* @__PURE__ */ r("label", { htmlFor: h, className: "block text-sm font-medium text-foreground mb-1.5", children: s }),
|
|
27
27
|
/* @__PURE__ */ t(
|
|
28
28
|
"div",
|
|
29
29
|
{
|
|
30
|
-
className:
|
|
30
|
+
className: b(
|
|
31
31
|
"relative flex flex-col items-center justify-center p-6 border-2 border-dashed rounded-lg transition-colors duration-200 ease-in-out cursor-pointer",
|
|
32
|
-
|
|
32
|
+
D ? "border-primary bg-primary/5" : "border-border bg-card hover:bg-muted/50",
|
|
33
33
|
"min-h-[150px]"
|
|
34
34
|
),
|
|
35
|
-
onDragEnter:
|
|
36
|
-
onDragLeave:
|
|
37
|
-
onDragOver:
|
|
38
|
-
onDrop:
|
|
35
|
+
onDragEnter: l,
|
|
36
|
+
onDragLeave: l,
|
|
37
|
+
onDragOver: l,
|
|
38
|
+
onDrop: w,
|
|
39
39
|
onClick: () => {
|
|
40
40
|
var e;
|
|
41
41
|
return (e = p.current) == null ? void 0 : e.click();
|
|
@@ -45,28 +45,30 @@ const S = ({
|
|
|
45
45
|
"input",
|
|
46
46
|
{
|
|
47
47
|
ref: p,
|
|
48
|
+
id: h,
|
|
48
49
|
type: "file",
|
|
49
50
|
className: "hidden",
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
"aria-label": s || "Choose files to upload",
|
|
52
|
+
multiple: o,
|
|
53
|
+
accept: n,
|
|
54
|
+
onChange: C
|
|
53
55
|
}
|
|
54
56
|
),
|
|
55
|
-
/* @__PURE__ */ r("div", { className: "bg-muted p-3 rounded-full mb-3", children: /* @__PURE__ */ r(
|
|
57
|
+
/* @__PURE__ */ r("div", { className: "bg-muted p-3 rounded-full mb-3", children: /* @__PURE__ */ r(c, { name: "upload-cloud", className: "h-6 w-6 text-muted-foreground" }) }),
|
|
56
58
|
/* @__PURE__ */ t("p", { className: "text-sm font-medium text-foreground text-center", children: [
|
|
57
59
|
/* @__PURE__ */ r("span", { className: "text-primary font-semibold hover:underline", children: "Click to upload" }),
|
|
58
60
|
" or drag and drop"
|
|
59
61
|
] }),
|
|
60
62
|
/* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground mt-1", children: [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
n ? n.replace(/,/g, ", ") : "Any file type",
|
|
64
|
+
o ? "" : " (Single file)"
|
|
63
65
|
] })
|
|
64
66
|
]
|
|
65
67
|
}
|
|
66
68
|
),
|
|
67
69
|
f.length > 0 && /* @__PURE__ */ r("div", { className: "mt-4 space-y-2", children: f.map((e, a) => /* @__PURE__ */ t("div", { className: "flex items-center justify-between p-2 rounded-md border border-border bg-card", children: [
|
|
68
70
|
/* @__PURE__ */ t("div", { className: "flex items-center gap-3 overflow-hidden", children: [
|
|
69
|
-
/* @__PURE__ */ r("div", { className: "bg-primary/10 p-2 rounded text-primary", children: /* @__PURE__ */ r(
|
|
71
|
+
/* @__PURE__ */ r("div", { className: "bg-primary/10 p-2 rounded text-primary", children: /* @__PURE__ */ r(c, { name: "file", className: "h-4 w-4" }) }),
|
|
70
72
|
/* @__PURE__ */ t("div", { className: "min-w-0", children: [
|
|
71
73
|
/* @__PURE__ */ r("p", { className: "text-sm font-medium text-foreground truncate", children: e.name }),
|
|
72
74
|
/* @__PURE__ */ t("p", { className: "text-xs text-muted-foreground", children: [
|
|
@@ -81,10 +83,10 @@ const S = ({
|
|
|
81
83
|
variant: "ghost",
|
|
82
84
|
size: "icon",
|
|
83
85
|
className: "h-8 w-8 text-muted-foreground hover:text-destructive",
|
|
84
|
-
onClick: (
|
|
85
|
-
|
|
86
|
+
onClick: (x) => {
|
|
87
|
+
x.stopPropagation(), k(a);
|
|
86
88
|
},
|
|
87
|
-
children: /* @__PURE__ */ r(
|
|
89
|
+
children: /* @__PURE__ */ r(c, { name: "x", className: "h-4 w-4" })
|
|
88
90
|
}
|
|
89
91
|
)
|
|
90
92
|
] }, `${e.name}-${a}`)) }),
|
|
@@ -92,5 +94,5 @@ const S = ({
|
|
|
92
94
|
] });
|
|
93
95
|
};
|
|
94
96
|
export {
|
|
95
|
-
|
|
97
|
+
$ as FileUpload
|
|
96
98
|
};
|
|
@@ -1,43 +1,44 @@
|
|
|
1
1
|
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import { Icon as
|
|
2
|
+
import c from "react";
|
|
3
|
+
import { Icon as N } from "../ui/Icon.js";
|
|
4
4
|
import { cn as o } from "../../utils/cn.js";
|
|
5
|
-
const
|
|
5
|
+
const h = c.forwardRef(
|
|
6
6
|
({
|
|
7
7
|
label: r,
|
|
8
8
|
icon: t,
|
|
9
9
|
helperText: i,
|
|
10
|
-
error:
|
|
10
|
+
error: d = !1,
|
|
11
11
|
required: s = !1,
|
|
12
|
-
showOptionalLabel:
|
|
13
|
-
className:
|
|
14
|
-
containerClassName:
|
|
12
|
+
showOptionalLabel: m = !1,
|
|
13
|
+
className: f,
|
|
14
|
+
containerClassName: u,
|
|
15
15
|
...l
|
|
16
|
-
},
|
|
17
|
-
const
|
|
18
|
-
return /* @__PURE__ */ n("div", { className: o("w-full",
|
|
19
|
-
r && /* @__PURE__ */ n("label", { htmlFor:
|
|
16
|
+
}, p) => {
|
|
17
|
+
const b = c.useId(), a = l.id || l.name || b, x = "flex h-10 w-full rounded-md border bg-background py-2 ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", g = d ? "border-destructive" : "border-input", v = t ? "pl-10 pr-3" : "px-3";
|
|
18
|
+
return /* @__PURE__ */ n("div", { className: o("w-full", u), children: [
|
|
19
|
+
r && /* @__PURE__ */ n("label", { htmlFor: a, className: "block text-sm font-medium text-foreground mb-1", children: [
|
|
20
20
|
r,
|
|
21
21
|
s && /* @__PURE__ */ e("span", { className: "text-destructive ml-1", children: "*" }),
|
|
22
|
-
!s &&
|
|
22
|
+
!s && m && /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground ml-1", children: "(optional)" })
|
|
23
23
|
] }),
|
|
24
24
|
/* @__PURE__ */ n("div", { className: "relative w-full", children: [
|
|
25
|
-
t && /* @__PURE__ */ e("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none", children: /* @__PURE__ */ e(
|
|
25
|
+
t && /* @__PURE__ */ e("div", { className: "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none", children: /* @__PURE__ */ e(N, { name: t, className: "text-muted-foreground", size: 16 }) }),
|
|
26
26
|
/* @__PURE__ */ e(
|
|
27
27
|
"input",
|
|
28
28
|
{
|
|
29
|
-
ref:
|
|
30
|
-
|
|
29
|
+
ref: p,
|
|
30
|
+
id: a,
|
|
31
|
+
className: o(x, g, v, f),
|
|
31
32
|
required: s,
|
|
32
33
|
...l
|
|
33
34
|
}
|
|
34
35
|
)
|
|
35
36
|
] }),
|
|
36
|
-
i && /* @__PURE__ */ e("p", { className: o("mt-1.5 text-xs",
|
|
37
|
+
i && /* @__PURE__ */ e("p", { className: o("mt-1.5 text-xs", d ? "text-destructive" : "text-muted-foreground"), children: i })
|
|
37
38
|
] });
|
|
38
39
|
}
|
|
39
40
|
);
|
|
40
|
-
|
|
41
|
+
h.displayName = "Input";
|
|
41
42
|
export {
|
|
42
|
-
|
|
43
|
+
h as Input
|
|
43
44
|
};
|
|
@@ -7,24 +7,24 @@ const R = (a) => /* @__PURE__ */ e(d.DropdownIndicator, { ...a, children: /* @__
|
|
|
7
7
|
options: a,
|
|
8
8
|
value: u,
|
|
9
9
|
onChange: m,
|
|
10
|
-
label:
|
|
10
|
+
label: c,
|
|
11
11
|
placeholder: s = "Select...",
|
|
12
12
|
isClearable: b = !0,
|
|
13
13
|
isDisabled: g = !1,
|
|
14
14
|
isLoading: v = !1,
|
|
15
15
|
isSearchable: x = !0,
|
|
16
16
|
className: f,
|
|
17
|
-
error:
|
|
18
|
-
helperText:
|
|
17
|
+
error: l,
|
|
18
|
+
helperText: n
|
|
19
19
|
}) => {
|
|
20
|
-
const
|
|
20
|
+
const t = S(), h = (r, o) => {
|
|
21
21
|
const C = r ? Array.from(r) : null;
|
|
22
22
|
m(C);
|
|
23
23
|
}, y = {
|
|
24
24
|
control: (r, o) => ({
|
|
25
25
|
...r,
|
|
26
26
|
backgroundColor: "rgb(var(--app-card-bg-color))",
|
|
27
|
-
borderColor:
|
|
27
|
+
borderColor: l ? "rgb(var(--app-danger-color))" : o.isFocused ? "rgb(var(--app-primary-color))" : "rgb(var(--app-border-color))",
|
|
28
28
|
color: "rgb(var(--app-text-color))",
|
|
29
29
|
borderRadius: "var(--app-border-radius-md)",
|
|
30
30
|
boxShadow: o.isFocused ? "0 0 0 1px rgb(var(--app-primary-color))" : "none",
|
|
@@ -83,11 +83,12 @@ const R = (a) => /* @__PURE__ */ e(d.DropdownIndicator, { ...a, children: /* @__
|
|
|
83
83
|
})
|
|
84
84
|
};
|
|
85
85
|
return /* @__PURE__ */ I("div", { className: p("w-full", f), children: [
|
|
86
|
-
|
|
86
|
+
c && /* @__PURE__ */ e("label", { htmlFor: t, className: "block text-sm font-medium text-foreground mb-1.5", children: c }),
|
|
87
87
|
/* @__PURE__ */ e(
|
|
88
88
|
k,
|
|
89
89
|
{
|
|
90
|
-
instanceId:
|
|
90
|
+
instanceId: t,
|
|
91
|
+
inputId: t,
|
|
91
92
|
styles: y,
|
|
92
93
|
components: { DropdownIndicator: R, MultiValueRemove: w },
|
|
93
94
|
options: a,
|
|
@@ -103,7 +104,7 @@ const R = (a) => /* @__PURE__ */ e(d.DropdownIndicator, { ...a, children: /* @__
|
|
|
103
104
|
menuPosition: "fixed"
|
|
104
105
|
}
|
|
105
106
|
),
|
|
106
|
-
|
|
107
|
+
n && /* @__PURE__ */ e("p", { className: p("mt-1.5 text-xs", l ? "text-destructive" : "text-muted-foreground"), children: n })
|
|
107
108
|
] });
|
|
108
109
|
};
|
|
109
110
|
export {
|