@goplusvn/core 0.1.1 → 0.1.3
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/package.json +31 -175
- package/dist/audit/index.d.mts +0 -115
- package/dist/audit/index.d.ts +0 -115
- package/dist/audit/index.js +0 -204
- package/dist/audit/index.js.map +0 -1
- package/dist/audit/index.mjs +0 -200
- package/dist/audit/index.mjs.map +0 -1
- package/dist/auth/index.d.mts +0 -86
- package/dist/auth/index.d.ts +0 -86
- package/dist/auth/index.js +0 -210
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/index.mjs +0 -198
- package/dist/auth/index.mjs.map +0 -1
- package/dist/button-1dWvP9Ib.d.mts +0 -30
- package/dist/button-1dWvP9Ib.d.ts +0 -30
- package/dist/calendar-2QzdEo1z.d.mts +0 -20
- package/dist/calendar-2QzdEo1z.d.ts +0 -20
- package/dist/code-generation/index.d.mts +0 -30
- package/dist/code-generation/index.d.ts +0 -30
- package/dist/code-generation/index.js +0 -31
- package/dist/code-generation/index.js.map +0 -1
- package/dist/code-generation/index.mjs +0 -28
- package/dist/code-generation/index.mjs.map +0 -1
- package/dist/configs/index.d.mts +0 -175
- package/dist/configs/index.d.ts +0 -175
- package/dist/configs/index.js +0 -254
- package/dist/configs/index.js.map +0 -1
- package/dist/configs/index.mjs +0 -233
- package/dist/configs/index.mjs.map +0 -1
- package/dist/crud/index.d.mts +0 -646
- package/dist/crud/index.d.ts +0 -646
- package/dist/crud/index.js +0 -11772
- package/dist/crud/index.js.map +0 -1
- package/dist/crud/index.mjs +0 -11665
- package/dist/crud/index.mjs.map +0 -1
- package/dist/crud/server.d.mts +0 -20
- package/dist/crud/server.d.ts +0 -20
- package/dist/crud/server.js +0 -123
- package/dist/crud/server.js.map +0 -1
- package/dist/crud/server.mjs +0 -120
- package/dist/crud/server.mjs.map +0 -1
- package/dist/data-table-skeleton-12NA8Mjx.d.mts +0 -39
- package/dist/data-table-skeleton-12NA8Mjx.d.ts +0 -39
- package/dist/dialog-bKfjZMTd.d.mts +0 -22
- package/dist/dialog-bKfjZMTd.d.ts +0 -22
- package/dist/dynamic-icon-DrGIiu2N.d.mts +0 -10
- package/dist/dynamic-icon-DrGIiu2N.d.ts +0 -10
- package/dist/home/index.d.mts +0 -269
- package/dist/home/index.d.ts +0 -269
- package/dist/home/index.js +0 -1678
- package/dist/home/index.js.map +0 -1
- package/dist/home/index.mjs +0 -1635
- package/dist/home/index.mjs.map +0 -1
- package/dist/hooks/index.d.mts +0 -7
- package/dist/hooks/index.d.ts +0 -7
- package/dist/hooks/index.js +0 -8316
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/index.mjs +0 -8255
- package/dist/hooks/index.mjs.map +0 -1
- package/dist/index-50hpiPrV.d.ts +0 -116
- package/dist/index-B9zQVEVi.d.mts +0 -116
- package/dist/index.d.mts +0 -5
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -123
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -118
- package/dist/index.mjs.map +0 -1
- package/dist/infrastructure/index.d.mts +0 -423
- package/dist/infrastructure/index.d.ts +0 -423
- package/dist/infrastructure/index.js +0 -633
- package/dist/infrastructure/index.js.map +0 -1
- package/dist/infrastructure/index.mjs +0 -619
- package/dist/infrastructure/index.mjs.map +0 -1
- package/dist/label-DWTEkNPo.d.ts +0 -226
- package/dist/label-LPpdcoBx.d.mts +0 -226
- package/dist/layout/index.d.mts +0 -48
- package/dist/layout/index.d.ts +0 -48
- package/dist/layout/index.js +0 -117
- package/dist/layout/index.js.map +0 -1
- package/dist/layout/index.mjs +0 -90
- package/dist/layout/index.mjs.map +0 -1
- package/dist/navigation/index.d.mts +0 -16
- package/dist/navigation/index.d.ts +0 -16
- package/dist/navigation/index.js +0 -53
- package/dist/navigation/index.js.map +0 -1
- package/dist/navigation/index.mjs +0 -50
- package/dist/navigation/index.mjs.map +0 -1
- package/dist/notification/index.d.mts +0 -105
- package/dist/notification/index.d.ts +0 -105
- package/dist/notification/index.js +0 -278
- package/dist/notification/index.js.map +0 -1
- package/dist/notification/index.mjs +0 -274
- package/dist/notification/index.mjs.map +0 -1
- package/dist/organization/index.d.mts +0 -99
- package/dist/organization/index.d.ts +0 -99
- package/dist/organization/index.js +0 -360
- package/dist/organization/index.js.map +0 -1
- package/dist/organization/index.mjs +0 -352
- package/dist/organization/index.mjs.map +0 -1
- package/dist/plugin/index.d.mts +0 -83
- package/dist/plugin/index.d.ts +0 -83
- package/dist/plugin/index.js +0 -86
- package/dist/plugin/index.js.map +0 -1
- package/dist/plugin/index.mjs +0 -84
- package/dist/plugin/index.mjs.map +0 -1
- package/dist/providers/index.d.mts +0 -25
- package/dist/providers/index.d.ts +0 -25
- package/dist/providers/index.js +0 -84
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/index.mjs +0 -77
- package/dist/providers/index.mjs.map +0 -1
- package/dist/rbac/index.d.mts +0 -226
- package/dist/rbac/index.d.ts +0 -226
- package/dist/rbac/index.js +0 -4784
- package/dist/rbac/index.js.map +0 -1
- package/dist/rbac/index.mjs +0 -4722
- package/dist/rbac/index.mjs.map +0 -1
- package/dist/rbac/permissions.d.mts +0 -26
- package/dist/rbac/permissions.d.ts +0 -26
- package/dist/rbac/permissions.js +0 -94
- package/dist/rbac/permissions.js.map +0 -1
- package/dist/rbac/permissions.mjs +0 -90
- package/dist/rbac/permissions.mjs.map +0 -1
- package/dist/rbac/server.d.mts +0 -1
- package/dist/rbac/server.d.ts +0 -1
- package/dist/rbac/server.js +0 -128
- package/dist/rbac/server.js.map +0 -1
- package/dist/rbac/server.mjs +0 -124
- package/dist/rbac/server.mjs.map +0 -1
- package/dist/schemas/index.d.mts +0 -1257
- package/dist/schemas/index.d.ts +0 -1257
- package/dist/schemas/index.js +0 -572
- package/dist/schemas/index.js.map +0 -1
- package/dist/schemas/index.mjs +0 -523
- package/dist/schemas/index.mjs.map +0 -1
- package/dist/server-QuYCTa89.d.mts +0 -83
- package/dist/server-QuYCTa89.d.ts +0 -83
- package/dist/sonner-C74GlRDQ.d.mts +0 -71
- package/dist/sonner-C74GlRDQ.d.ts +0 -71
- package/dist/status-BOXZgIqX.d.mts +0 -12
- package/dist/status-BOXZgIqX.d.ts +0 -12
- package/dist/system/index.d.mts +0 -77
- package/dist/system/index.d.ts +0 -77
- package/dist/system/index.js +0 -102
- package/dist/system/index.js.map +0 -1
- package/dist/system/index.mjs +0 -100
- package/dist/system/index.mjs.map +0 -1
- package/dist/tabs-C6FfBwPY.d.mts +0 -18
- package/dist/tabs-C6FfBwPY.d.ts +0 -18
- package/dist/tenant-provider-B8eC_Wpb.d.mts +0 -27
- package/dist/tenant-provider-B8eC_Wpb.d.ts +0 -27
- package/dist/types/index.d.mts +0 -469
- package/dist/types/index.d.ts +0 -469
- package/dist/types/index.js +0 -25
- package/dist/types/index.js.map +0 -1
- package/dist/types/index.mjs +0 -21
- package/dist/types/index.mjs.map +0 -1
- package/dist/ui/auth.d.mts +0 -39
- package/dist/ui/auth.d.ts +0 -39
- package/dist/ui/auth.js +0 -4941
- package/dist/ui/auth.js.map +0 -1
- package/dist/ui/auth.mjs +0 -4896
- package/dist/ui/auth.mjs.map +0 -1
- package/dist/ui/crud.d.mts +0 -2
- package/dist/ui/crud.d.ts +0 -2
- package/dist/ui/crud.js +0 -4
- package/dist/ui/crud.js.map +0 -1
- package/dist/ui/crud.mjs +0 -3
- package/dist/ui/crud.mjs.map +0 -1
- package/dist/ui/data-display.d.mts +0 -596
- package/dist/ui/data-display.d.ts +0 -596
- package/dist/ui/data-display.js +0 -5307
- package/dist/ui/data-display.js.map +0 -1
- package/dist/ui/data-display.mjs +0 -5212
- package/dist/ui/data-display.mjs.map +0 -1
- package/dist/ui/feedback.d.mts +0 -55
- package/dist/ui/feedback.d.ts +0 -55
- package/dist/ui/feedback.js +0 -2608
- package/dist/ui/feedback.js.map +0 -1
- package/dist/ui/feedback.mjs +0 -2526
- package/dist/ui/feedback.mjs.map +0 -1
- package/dist/ui/forms.d.mts +0 -309
- package/dist/ui/forms.d.ts +0 -309
- package/dist/ui/forms.js +0 -4656
- package/dist/ui/forms.js.map +0 -1
- package/dist/ui/forms.mjs +0 -4571
- package/dist/ui/forms.mjs.map +0 -1
- package/dist/ui/index.d.mts +0 -331
- package/dist/ui/index.d.ts +0 -331
- package/dist/ui/index.js +0 -16953
- package/dist/ui/index.js.map +0 -1
- package/dist/ui/index.mjs +0 -16598
- package/dist/ui/index.mjs.map +0 -1
- package/dist/ui/primitives/client.d.mts +0 -61
- package/dist/ui/primitives/client.d.ts +0 -61
- package/dist/ui/primitives/client.js +0 -3408
- package/dist/ui/primitives/client.js.map +0 -1
- package/dist/ui/primitives/client.mjs +0 -3256
- package/dist/ui/primitives/client.mjs.map +0 -1
- package/dist/ui/primitives.d.mts +0 -113
- package/dist/ui/primitives.d.ts +0 -113
- package/dist/ui/primitives.js +0 -3356
- package/dist/ui/primitives.js.map +0 -1
- package/dist/ui/primitives.mjs +0 -3227
- package/dist/ui/primitives.mjs.map +0 -1
- package/dist/user/index.d.mts +0 -228
- package/dist/user/index.d.ts +0 -228
- package/dist/user/index.js +0 -4306
- package/dist/user/index.js.map +0 -1
- package/dist/user/index.mjs +0 -4260
- package/dist/user/index.mjs.map +0 -1
- package/dist/utils/index.d.mts +0 -205
- package/dist/utils/index.d.ts +0 -205
- package/dist/utils/index.js +0 -574
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/index.mjs +0 -514
- package/dist/utils/index.mjs.map +0 -1
- package/dist/workflow/index.d.mts +0 -40
- package/dist/workflow/index.d.ts +0 -40
- package/dist/workflow/index.js +0 -3710
- package/dist/workflow/index.js.map +0 -1
- package/dist/workflow/index.mjs +0 -3677
- package/dist/workflow/index.mjs.map +0 -1
package/dist/ui/forms.mjs
DELETED
|
@@ -1,4571 +0,0 @@
|
|
|
1
|
-
import { clsx } from 'clsx';
|
|
2
|
-
import { twMerge } from 'tailwind-merge';
|
|
3
|
-
import * as React12 from 'react';
|
|
4
|
-
import { useState, useCallback, useEffect, useRef, useImperativeHandle, useContext, useMemo, useId, createContext } from 'react';
|
|
5
|
-
import { cva } from 'class-variance-authority';
|
|
6
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
8
|
-
import { Circle, Search, CalendarIcon, Smile, FileIcon, Loader2, X, UploadCloud, Minus, Check, ChevronsUpDown, Plus, Clock, icons, ChevronLeft, ChevronRight, Type, Palette, Image as Image$1, Unlink, Link, PanelLeft } from 'lucide-react';
|
|
9
|
-
import { DayPicker } from 'react-day-picker';
|
|
10
|
-
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
11
|
-
import '@radix-ui/react-select';
|
|
12
|
-
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
13
|
-
import '@radix-ui/react-dropdown-menu';
|
|
14
|
-
import '@radix-ui/react-switch';
|
|
15
|
-
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
16
|
-
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
17
|
-
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
18
|
-
import { useMedia } from 'react-use';
|
|
19
|
-
import { useDirection } from '@radix-ui/react-direction';
|
|
20
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
21
|
-
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
22
|
-
import 'next/link';
|
|
23
|
-
import 'react-resizable-panels';
|
|
24
|
-
import '@radix-ui/react-slider';
|
|
25
|
-
import '@radix-ui/react-menubar';
|
|
26
|
-
import '@radix-ui/react-navigation-menu';
|
|
27
|
-
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
28
|
-
import '@radix-ui/react-toggle-group';
|
|
29
|
-
import '@radix-ui/react-progress';
|
|
30
|
-
import '@radix-ui/react-context-menu';
|
|
31
|
-
import 'vaul';
|
|
32
|
-
import 'sonner';
|
|
33
|
-
import '@radix-ui/react-alert-dialog';
|
|
34
|
-
import 'next/navigation';
|
|
35
|
-
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
36
|
-
import { Command as Command$1 } from 'cmdk';
|
|
37
|
-
import { format } from 'date-fns';
|
|
38
|
-
import dynamic from 'next/dynamic';
|
|
39
|
-
import { Theme } from 'emoji-picker-react';
|
|
40
|
-
import Image from 'next/image';
|
|
41
|
-
import { useDropzone } from 'react-dropzone';
|
|
42
|
-
import { OTPInput, OTPInputContext } from 'input-otp';
|
|
43
|
-
import * as RPNInputPrimitive from 'react-phone-number-input';
|
|
44
|
-
import Color from '@tiptap/extension-color';
|
|
45
|
-
import Image3 from '@tiptap/extension-image';
|
|
46
|
-
import Link4 from '@tiptap/extension-link';
|
|
47
|
-
import Placeholder from '@tiptap/extension-placeholder';
|
|
48
|
-
import TextAlign from '@tiptap/extension-text-align';
|
|
49
|
-
import TextStyle from '@tiptap/extension-text-style';
|
|
50
|
-
import Typography from '@tiptap/extension-typography';
|
|
51
|
-
import Underline from '@tiptap/extension-underline';
|
|
52
|
-
import { useEditor, BubbleMenu, EditorContent } from '@tiptap/react';
|
|
53
|
-
import StarterKit from '@tiptap/starter-kit';
|
|
54
|
-
import { Controller, useFormContext, FormProvider } from 'react-hook-form';
|
|
55
|
-
|
|
56
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
57
|
-
var __esm = (fn, res) => function __init() {
|
|
58
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
59
|
-
};
|
|
60
|
-
function cn(...inputs) {
|
|
61
|
-
return twMerge(clsx(inputs));
|
|
62
|
-
}
|
|
63
|
-
function formatFileSize(bytes, decimals = 2) {
|
|
64
|
-
if (bytes === 0) return "0 Bytes";
|
|
65
|
-
const k = 1e3;
|
|
66
|
-
const dm = decimals < 0 ? 0 : decimals;
|
|
67
|
-
const sizes2 = ["Bytes", "KB", "MB", "GB", "TB", "PB"];
|
|
68
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
69
|
-
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + " " + sizes2[i];
|
|
70
|
-
}
|
|
71
|
-
function wait(ms = 250) {
|
|
72
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
73
|
-
}
|
|
74
|
-
function timeToDate(timeString, baseDate = /* @__PURE__ */ new Date()) {
|
|
75
|
-
if (!/^\d{2}:\d{2}$/.test(timeString)) {
|
|
76
|
-
throw new Error("Invalid time format. Use 'HH:mm'.");
|
|
77
|
-
}
|
|
78
|
-
const [hours, minutes] = timeString.split(":").map(Number);
|
|
79
|
-
const date = new Date(baseDate);
|
|
80
|
-
date.setHours(hours, minutes, 0, 0);
|
|
81
|
-
return date;
|
|
82
|
-
}
|
|
83
|
-
var Logger;
|
|
84
|
-
var init_utils = __esm({
|
|
85
|
-
"src/utils/index.ts"() {
|
|
86
|
-
Logger = class {
|
|
87
|
-
log(level, message, context, error) {
|
|
88
|
-
const entry = {
|
|
89
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
90
|
-
level,
|
|
91
|
-
message,
|
|
92
|
-
context
|
|
93
|
-
};
|
|
94
|
-
if (error instanceof Error) {
|
|
95
|
-
entry.error = {
|
|
96
|
-
name: error.name,
|
|
97
|
-
message: error.message,
|
|
98
|
-
stack: error.stack
|
|
99
|
-
};
|
|
100
|
-
} else if (error) {
|
|
101
|
-
entry.error = error;
|
|
102
|
-
}
|
|
103
|
-
const logString = JSON.stringify(entry);
|
|
104
|
-
switch (level) {
|
|
105
|
-
case "error":
|
|
106
|
-
console.error(logString);
|
|
107
|
-
break;
|
|
108
|
-
case "warn":
|
|
109
|
-
console.warn(logString);
|
|
110
|
-
break;
|
|
111
|
-
case "debug":
|
|
112
|
-
if (process.env.NODE_ENV === "development") console.debug(logString);
|
|
113
|
-
break;
|
|
114
|
-
default:
|
|
115
|
-
console.log(logString);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
info(message, context) {
|
|
119
|
-
this.log("info", message, context);
|
|
120
|
-
}
|
|
121
|
-
warn(message, context) {
|
|
122
|
-
this.log("warn", message, context);
|
|
123
|
-
}
|
|
124
|
-
error(message, error, context) {
|
|
125
|
-
this.log("error", message, context, error);
|
|
126
|
-
}
|
|
127
|
-
debug(message, context) {
|
|
128
|
-
this.log("debug", message, context);
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
new Logger();
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
var buttonVariants, Button;
|
|
135
|
-
var init_button = __esm({
|
|
136
|
-
"src/ui/primitives/button.tsx"() {
|
|
137
|
-
init_utils();
|
|
138
|
-
buttonVariants = cva(
|
|
139
|
-
"inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
140
|
-
{
|
|
141
|
-
variants: {
|
|
142
|
-
variant: {
|
|
143
|
-
// Existing variants (backwards-compatible)
|
|
144
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
145
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
146
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
147
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
148
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
149
|
-
link: "text-primary underline-offset-4 hover:underline",
|
|
150
|
-
// New Plane-inspired variants using semantic tokens
|
|
151
|
-
accent: "bg-accent-primary text-text-on-color hover:bg-accent-primary-hover active:bg-accent-primary-active disabled:bg-layer-disabled disabled:text-text-disabled",
|
|
152
|
-
danger: "bg-danger text-text-on-color hover:bg-danger-hover active:bg-danger-hover disabled:bg-layer-disabled disabled:text-text-disabled",
|
|
153
|
-
"danger-outline": "border border-danger bg-layer-2 text-danger-text hover:bg-danger-subtle active:bg-danger-subtle disabled:border-border-subtle disabled:bg-layer-2 disabled:text-text-disabled",
|
|
154
|
-
success: "bg-success-semantic text-text-on-color hover:bg-success-semantic/90 active:bg-success-semantic/80 disabled:bg-layer-disabled disabled:text-text-disabled",
|
|
155
|
-
tertiary: "bg-layer-3 text-text-secondary hover:bg-layer-3-hover active:bg-layer-3-hover disabled:bg-transparent disabled:text-text-disabled"
|
|
156
|
-
},
|
|
157
|
-
size: {
|
|
158
|
-
// Existing sizes (backwards-compatible)
|
|
159
|
-
default: "h-10 px-4 py-2",
|
|
160
|
-
sm: "h-9 rounded-md px-3",
|
|
161
|
-
lg: "h-11 rounded-md px-8",
|
|
162
|
-
icon: "h-10 w-10",
|
|
163
|
-
// New ERP-specific compact sizes
|
|
164
|
-
xs: "h-7 rounded-sm px-2 text-xs",
|
|
165
|
-
compact: "h-8 rounded-md px-3 text-xs",
|
|
166
|
-
"icon-sm": "h-8 w-8",
|
|
167
|
-
"icon-xs": "h-7 w-7"
|
|
168
|
-
}
|
|
169
|
-
},
|
|
170
|
-
defaultVariants: {
|
|
171
|
-
variant: "default",
|
|
172
|
-
size: "default"
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
);
|
|
176
|
-
Button = React12.forwardRef(
|
|
177
|
-
({ className, variant, size, asChild = false, loading = false, prependIcon, appendIcon, children, disabled, ...props }, ref) => {
|
|
178
|
-
if (asChild) {
|
|
179
|
-
return /* @__PURE__ */ jsx(
|
|
180
|
-
Slot,
|
|
181
|
-
{
|
|
182
|
-
className: cn(buttonVariants({ variant, size }), className),
|
|
183
|
-
ref,
|
|
184
|
-
...{ disabled: disabled || loading },
|
|
185
|
-
...props,
|
|
186
|
-
children: React12.isValidElement(children) && (prependIcon || appendIcon) ? React12.cloneElement(children, {}, /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
187
|
-
prependIcon && React12.cloneElement(prependIcon, {
|
|
188
|
-
className: cn("shrink-0", size === "xs" || size === "compact" ? "size-3.5" : "size-4")
|
|
189
|
-
}),
|
|
190
|
-
children.props.children,
|
|
191
|
-
appendIcon && React12.cloneElement(appendIcon, {
|
|
192
|
-
className: cn("shrink-0", size === "xs" || size === "compact" ? "size-3.5" : "size-4")
|
|
193
|
-
})
|
|
194
|
-
] })) : children
|
|
195
|
-
}
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
return /* @__PURE__ */ jsxs(
|
|
199
|
-
"button",
|
|
200
|
-
{
|
|
201
|
-
className: cn(buttonVariants({ variant, size }), className),
|
|
202
|
-
ref,
|
|
203
|
-
disabled: disabled || loading,
|
|
204
|
-
...props,
|
|
205
|
-
children: [
|
|
206
|
-
prependIcon && React12.cloneElement(prependIcon, {
|
|
207
|
-
className: cn("shrink-0", size === "xs" || size === "compact" ? "size-3.5" : "size-4")
|
|
208
|
-
}),
|
|
209
|
-
children,
|
|
210
|
-
appendIcon && React12.cloneElement(appendIcon, {
|
|
211
|
-
className: cn("shrink-0", size === "xs" || size === "compact" ? "size-3.5" : "size-4")
|
|
212
|
-
})
|
|
213
|
-
]
|
|
214
|
-
}
|
|
215
|
-
);
|
|
216
|
-
}
|
|
217
|
-
);
|
|
218
|
-
Button.displayName = "Button";
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
function Calendar({
|
|
222
|
-
className,
|
|
223
|
-
classNames,
|
|
224
|
-
showOutsideDays = true,
|
|
225
|
-
...props
|
|
226
|
-
}) {
|
|
227
|
-
return /* @__PURE__ */ jsx(
|
|
228
|
-
DayPicker,
|
|
229
|
-
{
|
|
230
|
-
showOutsideDays,
|
|
231
|
-
className: cn("p-3", className),
|
|
232
|
-
classNames: {
|
|
233
|
-
month: "space-y-4",
|
|
234
|
-
month_caption: "flex justify-center pt-1 items-center",
|
|
235
|
-
caption_label: "text-sm font-medium",
|
|
236
|
-
nav: "relative gap-x-1 flex items-center",
|
|
237
|
-
button_previous: cn(
|
|
238
|
-
buttonVariants({ variant: "outline" }),
|
|
239
|
-
"absolute top-0 start-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
|
240
|
-
),
|
|
241
|
-
button_next: cn(
|
|
242
|
-
buttonVariants({ variant: "outline" }),
|
|
243
|
-
"absolute top-0 end-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
|
|
244
|
-
),
|
|
245
|
-
month_grid: "w-full border-collapse space-y-1",
|
|
246
|
-
weekdays: "flex",
|
|
247
|
-
weekday: "text-muted-foreground rounded-md w-8 font-normal text-[0.8rem]",
|
|
248
|
-
week: "flex w-full mt-2",
|
|
249
|
-
day: cn(
|
|
250
|
-
buttonVariants({ variant: "ghost" }),
|
|
251
|
-
"relative h-8 w-8 p-0 font-normal text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected].day-range-end)]:rounded-e-md"
|
|
252
|
-
),
|
|
253
|
-
day_button: "cursor-pointer h-full w-full aria-selected:opacity-100",
|
|
254
|
-
range_start: "rounded-md!",
|
|
255
|
-
range_end: "rounded-md!",
|
|
256
|
-
selected: cn(
|
|
257
|
-
"bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground",
|
|
258
|
-
props.mode === "range" && "rounded-none"
|
|
259
|
-
),
|
|
260
|
-
today: "bg-accent text-accent-foreground",
|
|
261
|
-
outside: "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",
|
|
262
|
-
disabled: "text-muted-foreground opacity-50",
|
|
263
|
-
range_middle: "aria-selected:bg-accent aria-selected:text-accent-foreground",
|
|
264
|
-
hidden: "invisible",
|
|
265
|
-
...classNames
|
|
266
|
-
},
|
|
267
|
-
components: {
|
|
268
|
-
Chevron: (props2) => {
|
|
269
|
-
if (props2.orientation === "left") {
|
|
270
|
-
return /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4" });
|
|
271
|
-
}
|
|
272
|
-
return /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" });
|
|
273
|
-
}
|
|
274
|
-
},
|
|
275
|
-
...props
|
|
276
|
-
}
|
|
277
|
-
);
|
|
278
|
-
}
|
|
279
|
-
var init_calendar = __esm({
|
|
280
|
-
"src/ui/primitives/calendar.tsx"() {
|
|
281
|
-
"use client";
|
|
282
|
-
init_utils();
|
|
283
|
-
init_button();
|
|
284
|
-
Calendar.displayName = "Calendar";
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
var Input;
|
|
288
|
-
var init_input = __esm({
|
|
289
|
-
"src/ui/primitives/input.tsx"() {
|
|
290
|
-
init_utils();
|
|
291
|
-
Input = React12.forwardRef(
|
|
292
|
-
({ className, type, ...props }, ref) => {
|
|
293
|
-
return /* @__PURE__ */ jsx(
|
|
294
|
-
"input",
|
|
295
|
-
{
|
|
296
|
-
type,
|
|
297
|
-
className: cn(
|
|
298
|
-
"flex h-10 w-full rounded-md border border-input 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",
|
|
299
|
-
className
|
|
300
|
-
),
|
|
301
|
-
ref,
|
|
302
|
-
...props
|
|
303
|
-
}
|
|
304
|
-
);
|
|
305
|
-
}
|
|
306
|
-
);
|
|
307
|
-
Input.displayName = "Input";
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
function ScrollArea({
|
|
311
|
-
orientation,
|
|
312
|
-
className,
|
|
313
|
-
children,
|
|
314
|
-
...props
|
|
315
|
-
}) {
|
|
316
|
-
return /* @__PURE__ */ jsxs(
|
|
317
|
-
ScrollAreaPrimitive.Root,
|
|
318
|
-
{
|
|
319
|
-
"data-slot": "scroll-area",
|
|
320
|
-
className: cn("relative overflow-hidden", className),
|
|
321
|
-
...props,
|
|
322
|
-
children: [
|
|
323
|
-
/* @__PURE__ */ jsx(
|
|
324
|
-
ScrollAreaPrimitive.Viewport,
|
|
325
|
-
{
|
|
326
|
-
"data-slot": "scroll-area-viewport",
|
|
327
|
-
className: "h-full w-full rounded-[inherit]",
|
|
328
|
-
children
|
|
329
|
-
}
|
|
330
|
-
),
|
|
331
|
-
/* @__PURE__ */ jsx(ScrollBar, { orientation }),
|
|
332
|
-
/* @__PURE__ */ jsx(ScrollAreaPrimitive.Corner, {})
|
|
333
|
-
]
|
|
334
|
-
}
|
|
335
|
-
);
|
|
336
|
-
}
|
|
337
|
-
function ScrollBar({
|
|
338
|
-
className,
|
|
339
|
-
orientation = "vertical",
|
|
340
|
-
...props
|
|
341
|
-
}) {
|
|
342
|
-
return /* @__PURE__ */ jsx(
|
|
343
|
-
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
344
|
-
{
|
|
345
|
-
"data-slot": "scroll-area-scrollbar",
|
|
346
|
-
orientation,
|
|
347
|
-
className: cn(
|
|
348
|
-
"flex touch-none select-none transition-colors",
|
|
349
|
-
orientation === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
|
|
350
|
-
orientation === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
|
351
|
-
className
|
|
352
|
-
),
|
|
353
|
-
...props,
|
|
354
|
-
children: /* @__PURE__ */ jsx(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
|
|
355
|
-
}
|
|
356
|
-
);
|
|
357
|
-
}
|
|
358
|
-
var init_scroll_area = __esm({
|
|
359
|
-
"src/ui/primitives/scroll-area.tsx"() {
|
|
360
|
-
"use client";
|
|
361
|
-
init_utils();
|
|
362
|
-
}
|
|
363
|
-
});
|
|
364
|
-
var init_combobox = __esm({
|
|
365
|
-
"src/ui/primitives/combobox.tsx"() {
|
|
366
|
-
"use client";
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
var init_select = __esm({
|
|
370
|
-
"src/ui/primitives/select.tsx"() {
|
|
371
|
-
"use client";
|
|
372
|
-
}
|
|
373
|
-
});
|
|
374
|
-
function Popover({
|
|
375
|
-
...props
|
|
376
|
-
}) {
|
|
377
|
-
return /* @__PURE__ */ jsx(PopoverPrimitive.Root, { "data-slot": "popover", ...props });
|
|
378
|
-
}
|
|
379
|
-
function PopoverTrigger({
|
|
380
|
-
className,
|
|
381
|
-
...props
|
|
382
|
-
}) {
|
|
383
|
-
return /* @__PURE__ */ jsx(
|
|
384
|
-
PopoverPrimitive.Trigger,
|
|
385
|
-
{
|
|
386
|
-
"data-slot": "popover-trigger",
|
|
387
|
-
className: cn("cursor-pointer", className),
|
|
388
|
-
...props
|
|
389
|
-
}
|
|
390
|
-
);
|
|
391
|
-
}
|
|
392
|
-
function PopoverContent({
|
|
393
|
-
className,
|
|
394
|
-
align = "center",
|
|
395
|
-
sideOffset = 4,
|
|
396
|
-
container,
|
|
397
|
-
...props
|
|
398
|
-
}) {
|
|
399
|
-
return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { container, children: /* @__PURE__ */ jsx(
|
|
400
|
-
PopoverPrimitive.Content,
|
|
401
|
-
{
|
|
402
|
-
"data-slot": "popover-content",
|
|
403
|
-
align,
|
|
404
|
-
sideOffset,
|
|
405
|
-
className: cn(
|
|
406
|
-
"z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
407
|
-
className
|
|
408
|
-
),
|
|
409
|
-
...props
|
|
410
|
-
}
|
|
411
|
-
) });
|
|
412
|
-
}
|
|
413
|
-
var init_popover = __esm({
|
|
414
|
-
"src/ui/primitives/popover.tsx"() {
|
|
415
|
-
"use client";
|
|
416
|
-
init_utils();
|
|
417
|
-
}
|
|
418
|
-
});
|
|
419
|
-
var init_dropdown_menu = __esm({
|
|
420
|
-
"src/ui/primitives/dropdown-menu.tsx"() {
|
|
421
|
-
"use client";
|
|
422
|
-
}
|
|
423
|
-
});
|
|
424
|
-
var init_switch = __esm({
|
|
425
|
-
"src/ui/primitives/switch.tsx"() {
|
|
426
|
-
"use client";
|
|
427
|
-
}
|
|
428
|
-
});
|
|
429
|
-
var Checkbox;
|
|
430
|
-
var init_checkbox = __esm({
|
|
431
|
-
"src/ui/primitives/checkbox.tsx"() {
|
|
432
|
-
"use client";
|
|
433
|
-
init_utils();
|
|
434
|
-
Checkbox = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
435
|
-
CheckboxPrimitive.Root,
|
|
436
|
-
{
|
|
437
|
-
ref,
|
|
438
|
-
className: cn(
|
|
439
|
-
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
|
|
440
|
-
className
|
|
441
|
-
),
|
|
442
|
-
...props,
|
|
443
|
-
children: /* @__PURE__ */ jsx(
|
|
444
|
-
CheckboxPrimitive.Indicator,
|
|
445
|
-
{
|
|
446
|
-
className: cn("flex items-center justify-center text-current"),
|
|
447
|
-
children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" })
|
|
448
|
-
}
|
|
449
|
-
)
|
|
450
|
-
}
|
|
451
|
-
));
|
|
452
|
-
Checkbox.displayName = CheckboxPrimitive.Root.displayName;
|
|
453
|
-
}
|
|
454
|
-
});
|
|
455
|
-
var Label3;
|
|
456
|
-
var init_label = __esm({
|
|
457
|
-
"src/ui/primitives/label.tsx"() {
|
|
458
|
-
"use client";
|
|
459
|
-
init_utils();
|
|
460
|
-
Label3 = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
461
|
-
LabelPrimitive.Root,
|
|
462
|
-
{
|
|
463
|
-
ref,
|
|
464
|
-
className: cn(
|
|
465
|
-
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
466
|
-
className
|
|
467
|
-
),
|
|
468
|
-
...props
|
|
469
|
-
}
|
|
470
|
-
));
|
|
471
|
-
Label3.displayName = LabelPrimitive.Root.displayName;
|
|
472
|
-
}
|
|
473
|
-
});
|
|
474
|
-
function TooltipProvider({
|
|
475
|
-
delayDuration = 0,
|
|
476
|
-
...props
|
|
477
|
-
}) {
|
|
478
|
-
return /* @__PURE__ */ jsx(
|
|
479
|
-
TooltipPrimitive.Provider,
|
|
480
|
-
{
|
|
481
|
-
"data-slot": "tooltip-provider",
|
|
482
|
-
delayDuration,
|
|
483
|
-
...props
|
|
484
|
-
}
|
|
485
|
-
);
|
|
486
|
-
}
|
|
487
|
-
function Tooltip({
|
|
488
|
-
...props
|
|
489
|
-
}) {
|
|
490
|
-
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
|
|
491
|
-
}
|
|
492
|
-
function TooltipTrigger({
|
|
493
|
-
className,
|
|
494
|
-
...props
|
|
495
|
-
}) {
|
|
496
|
-
return /* @__PURE__ */ jsx(
|
|
497
|
-
TooltipPrimitive.Trigger,
|
|
498
|
-
{
|
|
499
|
-
"data-slot": "tooltip-trigger",
|
|
500
|
-
className: cn("cursor-pointer", className),
|
|
501
|
-
...props
|
|
502
|
-
}
|
|
503
|
-
);
|
|
504
|
-
}
|
|
505
|
-
function TooltipContent({
|
|
506
|
-
className,
|
|
507
|
-
sideOffset = 0,
|
|
508
|
-
...props
|
|
509
|
-
}) {
|
|
510
|
-
return /* @__PURE__ */ jsx(
|
|
511
|
-
TooltipPrimitive.Content,
|
|
512
|
-
{
|
|
513
|
-
"data-slot": "tooltip-content",
|
|
514
|
-
sideOffset,
|
|
515
|
-
className: cn(
|
|
516
|
-
"z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-sm text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
517
|
-
className
|
|
518
|
-
),
|
|
519
|
-
...props
|
|
520
|
-
}
|
|
521
|
-
);
|
|
522
|
-
}
|
|
523
|
-
var init_tooltip = __esm({
|
|
524
|
-
"src/ui/primitives/tooltip.tsx"() {
|
|
525
|
-
"use client";
|
|
526
|
-
init_utils();
|
|
527
|
-
}
|
|
528
|
-
});
|
|
529
|
-
var init_tenant_provider = __esm({
|
|
530
|
-
"src/providers/tenant-provider.tsx"() {
|
|
531
|
-
createContext(void 0);
|
|
532
|
-
}
|
|
533
|
-
});
|
|
534
|
-
var defaultSettings, SettingsContext;
|
|
535
|
-
var init_providers = __esm({
|
|
536
|
-
"src/providers/index.tsx"() {
|
|
537
|
-
"use client";
|
|
538
|
-
init_tenant_provider();
|
|
539
|
-
defaultSettings = {
|
|
540
|
-
theme: "blue",
|
|
541
|
-
mode: "system",
|
|
542
|
-
radius: 0.5,
|
|
543
|
-
layout: "vertical",
|
|
544
|
-
locale: "vi",
|
|
545
|
-
sidebarVariant: "sidebar",
|
|
546
|
-
sidebarCollapsible: "icon",
|
|
547
|
-
density: "comfortable"
|
|
548
|
-
};
|
|
549
|
-
SettingsContext = createContext(void 0);
|
|
550
|
-
}
|
|
551
|
-
});
|
|
552
|
-
function Badge({ className, variant, size, ...props }) {
|
|
553
|
-
return /* @__PURE__ */ jsx("div", { className: cn(badgeVariants({ variant, size }), className), ...props });
|
|
554
|
-
}
|
|
555
|
-
var badgeVariants;
|
|
556
|
-
var init_badge = __esm({
|
|
557
|
-
"src/ui/primitives/badge.tsx"() {
|
|
558
|
-
init_utils();
|
|
559
|
-
badgeVariants = cva(
|
|
560
|
-
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
|
561
|
-
{
|
|
562
|
-
variants: {
|
|
563
|
-
variant: {
|
|
564
|
-
// Existing variants (backwards-compatible)
|
|
565
|
-
default: "border-transparent bg-primary text-primary-foreground",
|
|
566
|
-
secondary: "border-transparent bg-secondary text-secondary-foreground",
|
|
567
|
-
destructive: "border-transparent bg-destructive text-destructive-foreground",
|
|
568
|
-
outline: "text-foreground",
|
|
569
|
-
// Enhanced semantic variants (using Design Tokens)
|
|
570
|
-
success: "border-transparent bg-success-subtle text-success-text",
|
|
571
|
-
warning: "border-transparent bg-warning-subtle text-warning-text",
|
|
572
|
-
danger: "border-transparent bg-danger-subtle text-danger-text",
|
|
573
|
-
info: "border-transparent bg-info-subtle text-info-text",
|
|
574
|
-
accent: "border-transparent bg-accent-primary-subtle text-accent-primary"
|
|
575
|
-
},
|
|
576
|
-
size: {
|
|
577
|
-
default: "",
|
|
578
|
-
sm: "px-1.5 py-0 text-[10px]",
|
|
579
|
-
lg: "px-3 py-1 text-sm"
|
|
580
|
-
}
|
|
581
|
-
},
|
|
582
|
-
defaultVariants: {
|
|
583
|
-
variant: "default",
|
|
584
|
-
size: "default"
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
);
|
|
588
|
-
}
|
|
589
|
-
});
|
|
590
|
-
var Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter;
|
|
591
|
-
var init_card = __esm({
|
|
592
|
-
"src/ui/primitives/card.tsx"() {
|
|
593
|
-
init_utils();
|
|
594
|
-
Card = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
595
|
-
"div",
|
|
596
|
-
{
|
|
597
|
-
ref,
|
|
598
|
-
className: cn(
|
|
599
|
-
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
|
600
|
-
className
|
|
601
|
-
),
|
|
602
|
-
...props
|
|
603
|
-
}
|
|
604
|
-
));
|
|
605
|
-
Card.displayName = "Card";
|
|
606
|
-
CardHeader = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
607
|
-
"div",
|
|
608
|
-
{
|
|
609
|
-
ref,
|
|
610
|
-
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
611
|
-
...props
|
|
612
|
-
}
|
|
613
|
-
));
|
|
614
|
-
CardHeader.displayName = "CardHeader";
|
|
615
|
-
CardTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
616
|
-
"h3",
|
|
617
|
-
{
|
|
618
|
-
ref,
|
|
619
|
-
className: cn(
|
|
620
|
-
"text-2xl font-semibold leading-none tracking-tight",
|
|
621
|
-
className
|
|
622
|
-
),
|
|
623
|
-
...props
|
|
624
|
-
}
|
|
625
|
-
));
|
|
626
|
-
CardTitle.displayName = "CardTitle";
|
|
627
|
-
CardDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
628
|
-
"p",
|
|
629
|
-
{
|
|
630
|
-
ref,
|
|
631
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
632
|
-
...props
|
|
633
|
-
}
|
|
634
|
-
));
|
|
635
|
-
CardDescription.displayName = "CardDescription";
|
|
636
|
-
CardContent = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props }));
|
|
637
|
-
CardContent.displayName = "CardContent";
|
|
638
|
-
CardFooter = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
639
|
-
"div",
|
|
640
|
-
{
|
|
641
|
-
ref,
|
|
642
|
-
className: cn("flex items-center p-6 pt-0", className),
|
|
643
|
-
...props
|
|
644
|
-
}
|
|
645
|
-
));
|
|
646
|
-
CardFooter.displayName = "CardFooter";
|
|
647
|
-
}
|
|
648
|
-
});
|
|
649
|
-
var Separator3;
|
|
650
|
-
var init_separator = __esm({
|
|
651
|
-
"src/ui/primitives/separator.tsx"() {
|
|
652
|
-
init_utils();
|
|
653
|
-
Separator3 = React12.forwardRef(
|
|
654
|
-
({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ jsx(
|
|
655
|
-
"div",
|
|
656
|
-
{
|
|
657
|
-
ref,
|
|
658
|
-
className: cn(
|
|
659
|
-
"shrink-0 bg-border",
|
|
660
|
-
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
661
|
-
className
|
|
662
|
-
),
|
|
663
|
-
...props
|
|
664
|
-
}
|
|
665
|
-
)
|
|
666
|
-
);
|
|
667
|
-
Separator3.displayName = "Separator";
|
|
668
|
-
}
|
|
669
|
-
});
|
|
670
|
-
var Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption;
|
|
671
|
-
var init_table = __esm({
|
|
672
|
-
"src/ui/primitives/table.tsx"() {
|
|
673
|
-
init_utils();
|
|
674
|
-
Table = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { className: "relative w-full overflow-auto", children: /* @__PURE__ */ jsx(
|
|
675
|
-
"table",
|
|
676
|
-
{
|
|
677
|
-
ref,
|
|
678
|
-
className: cn("w-max min-w-full caption-bottom text-xs", className),
|
|
679
|
-
...props
|
|
680
|
-
}
|
|
681
|
-
) }));
|
|
682
|
-
Table.displayName = "Table";
|
|
683
|
-
TableHeader = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("thead", { ref, className: cn("[&_tr]:border-b", className), ...props }));
|
|
684
|
-
TableHeader.displayName = "TableHeader";
|
|
685
|
-
TableBody = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
686
|
-
"tbody",
|
|
687
|
-
{
|
|
688
|
-
ref,
|
|
689
|
-
className: cn("[&_tr:last-child]:border-0", className),
|
|
690
|
-
...props
|
|
691
|
-
}
|
|
692
|
-
));
|
|
693
|
-
TableBody.displayName = "TableBody";
|
|
694
|
-
TableFooter = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
695
|
-
"tfoot",
|
|
696
|
-
{
|
|
697
|
-
ref,
|
|
698
|
-
className: cn(
|
|
699
|
-
"border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",
|
|
700
|
-
className
|
|
701
|
-
),
|
|
702
|
-
...props
|
|
703
|
-
}
|
|
704
|
-
));
|
|
705
|
-
TableFooter.displayName = "TableFooter";
|
|
706
|
-
TableRow = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
707
|
-
"tr",
|
|
708
|
-
{
|
|
709
|
-
ref,
|
|
710
|
-
className: cn(
|
|
711
|
-
"border-b transition-colors even:bg-muted/30 data-[state=selected]:bg-muted",
|
|
712
|
-
className
|
|
713
|
-
),
|
|
714
|
-
...props
|
|
715
|
-
}
|
|
716
|
-
));
|
|
717
|
-
TableRow.displayName = "TableRow";
|
|
718
|
-
TableHead = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
719
|
-
"th",
|
|
720
|
-
{
|
|
721
|
-
ref,
|
|
722
|
-
className: cn(
|
|
723
|
-
"h-9 px-3 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",
|
|
724
|
-
className
|
|
725
|
-
),
|
|
726
|
-
...props
|
|
727
|
-
}
|
|
728
|
-
));
|
|
729
|
-
TableHead.displayName = "TableHead";
|
|
730
|
-
TableCell = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
731
|
-
"td",
|
|
732
|
-
{
|
|
733
|
-
ref,
|
|
734
|
-
className: cn("px-3 py-1.5 align-middle [&:has([role=checkbox])]:pr-0 text-xs", className),
|
|
735
|
-
...props
|
|
736
|
-
}
|
|
737
|
-
));
|
|
738
|
-
TableCell.displayName = "TableCell";
|
|
739
|
-
TableCaption = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
740
|
-
"caption",
|
|
741
|
-
{
|
|
742
|
-
ref,
|
|
743
|
-
className: cn("mt-4 text-sm text-muted-foreground", className),
|
|
744
|
-
...props
|
|
745
|
-
}
|
|
746
|
-
));
|
|
747
|
-
TableCaption.displayName = "TableCaption";
|
|
748
|
-
}
|
|
749
|
-
});
|
|
750
|
-
var Dialog, DialogPortal, DialogOverlay, DialogContent, DialogHeader, DialogFooter, DialogTitle, DialogDescription;
|
|
751
|
-
var init_dialog = __esm({
|
|
752
|
-
"src/ui/primitives/dialog.tsx"() {
|
|
753
|
-
"use client";
|
|
754
|
-
init_utils();
|
|
755
|
-
Dialog = DialogPrimitive.Root;
|
|
756
|
-
DialogPortal = DialogPrimitive.Portal;
|
|
757
|
-
DialogOverlay = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
758
|
-
DialogPrimitive.Overlay,
|
|
759
|
-
{
|
|
760
|
-
ref,
|
|
761
|
-
className: cn(
|
|
762
|
-
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
763
|
-
className
|
|
764
|
-
),
|
|
765
|
-
...props
|
|
766
|
-
}
|
|
767
|
-
));
|
|
768
|
-
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
769
|
-
DialogContent = React12.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs(DialogPortal, { children: [
|
|
770
|
-
/* @__PURE__ */ jsx(DialogOverlay, {}),
|
|
771
|
-
/* @__PURE__ */ jsxs(
|
|
772
|
-
DialogPrimitive.Content,
|
|
773
|
-
{
|
|
774
|
-
ref,
|
|
775
|
-
className: cn(
|
|
776
|
-
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
|
|
777
|
-
className
|
|
778
|
-
),
|
|
779
|
-
...props,
|
|
780
|
-
children: [
|
|
781
|
-
children,
|
|
782
|
-
/* @__PURE__ */ jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
|
|
783
|
-
/* @__PURE__ */ jsx(X, { className: "h-4 w-4" }),
|
|
784
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close" })
|
|
785
|
-
] })
|
|
786
|
-
]
|
|
787
|
-
}
|
|
788
|
-
)
|
|
789
|
-
] }));
|
|
790
|
-
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
791
|
-
DialogHeader = ({
|
|
792
|
-
className,
|
|
793
|
-
...props
|
|
794
|
-
}) => /* @__PURE__ */ jsx(
|
|
795
|
-
"div",
|
|
796
|
-
{
|
|
797
|
-
className: cn(
|
|
798
|
-
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
799
|
-
className
|
|
800
|
-
),
|
|
801
|
-
...props
|
|
802
|
-
}
|
|
803
|
-
);
|
|
804
|
-
DialogHeader.displayName = "DialogHeader";
|
|
805
|
-
DialogFooter = ({
|
|
806
|
-
className,
|
|
807
|
-
...props
|
|
808
|
-
}) => /* @__PURE__ */ jsx(
|
|
809
|
-
"div",
|
|
810
|
-
{
|
|
811
|
-
className: cn(
|
|
812
|
-
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
813
|
-
className
|
|
814
|
-
),
|
|
815
|
-
...props
|
|
816
|
-
}
|
|
817
|
-
);
|
|
818
|
-
DialogFooter.displayName = "DialogFooter";
|
|
819
|
-
DialogTitle = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
820
|
-
DialogPrimitive.Title,
|
|
821
|
-
{
|
|
822
|
-
ref,
|
|
823
|
-
className: cn(
|
|
824
|
-
"text-lg font-semibold leading-none tracking-tight",
|
|
825
|
-
className
|
|
826
|
-
),
|
|
827
|
-
...props
|
|
828
|
-
}
|
|
829
|
-
));
|
|
830
|
-
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
831
|
-
DialogDescription = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
832
|
-
DialogPrimitive.Description,
|
|
833
|
-
{
|
|
834
|
-
ref,
|
|
835
|
-
className: cn("text-sm text-muted-foreground", className),
|
|
836
|
-
...props
|
|
837
|
-
}
|
|
838
|
-
));
|
|
839
|
-
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
840
|
-
}
|
|
841
|
-
});
|
|
842
|
-
var TabsList, TabsTrigger, TabsContent;
|
|
843
|
-
var init_tabs = __esm({
|
|
844
|
-
"src/ui/primitives/tabs.tsx"() {
|
|
845
|
-
"use client";
|
|
846
|
-
init_utils();
|
|
847
|
-
TabsList = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
848
|
-
TabsPrimitive.List,
|
|
849
|
-
{
|
|
850
|
-
ref,
|
|
851
|
-
className: cn(
|
|
852
|
-
"inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",
|
|
853
|
-
className
|
|
854
|
-
),
|
|
855
|
-
...props
|
|
856
|
-
}
|
|
857
|
-
));
|
|
858
|
-
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
859
|
-
TabsTrigger = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
860
|
-
TabsPrimitive.Trigger,
|
|
861
|
-
{
|
|
862
|
-
ref,
|
|
863
|
-
className: cn(
|
|
864
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
|
|
865
|
-
className
|
|
866
|
-
),
|
|
867
|
-
...props
|
|
868
|
-
}
|
|
869
|
-
));
|
|
870
|
-
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
871
|
-
TabsContent = React12.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
872
|
-
TabsPrimitive.Content,
|
|
873
|
-
{
|
|
874
|
-
ref,
|
|
875
|
-
className: cn(
|
|
876
|
-
"mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
877
|
-
className
|
|
878
|
-
),
|
|
879
|
-
...props
|
|
880
|
-
}
|
|
881
|
-
));
|
|
882
|
-
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
883
|
-
}
|
|
884
|
-
});
|
|
885
|
-
var init_breadcrumb = __esm({
|
|
886
|
-
"src/ui/primitives/breadcrumb.tsx"() {
|
|
887
|
-
}
|
|
888
|
-
});
|
|
889
|
-
var init_keyboard = __esm({
|
|
890
|
-
"src/ui/primitives/keyboard.tsx"() {
|
|
891
|
-
}
|
|
892
|
-
});
|
|
893
|
-
var init_pagination = __esm({
|
|
894
|
-
"src/ui/primitives/pagination.tsx"() {
|
|
895
|
-
}
|
|
896
|
-
});
|
|
897
|
-
var init_status_badge = __esm({
|
|
898
|
-
"src/ui/primitives/status-badge.tsx"() {
|
|
899
|
-
}
|
|
900
|
-
});
|
|
901
|
-
var init_resizable = __esm({
|
|
902
|
-
"src/ui/primitives/resizable.tsx"() {
|
|
903
|
-
"use client";
|
|
904
|
-
}
|
|
905
|
-
});
|
|
906
|
-
var init_slider = __esm({
|
|
907
|
-
"src/ui/primitives/slider.tsx"() {
|
|
908
|
-
"use client";
|
|
909
|
-
}
|
|
910
|
-
});
|
|
911
|
-
var init_menubar = __esm({
|
|
912
|
-
"src/ui/primitives/menubar.tsx"() {
|
|
913
|
-
"use client";
|
|
914
|
-
}
|
|
915
|
-
});
|
|
916
|
-
var init_navigation_menu = __esm({
|
|
917
|
-
"src/ui/primitives/navigation-menu.tsx"() {
|
|
918
|
-
cva(
|
|
919
|
-
"group cursor-pointer inline-flex h-9 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-accent data-[state=open]:text-accent-foreground data-[state=open]:focus:bg-accent data-[state=open]:bg-accent/50 focus-visible:ring-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1"
|
|
920
|
-
);
|
|
921
|
-
}
|
|
922
|
-
});
|
|
923
|
-
function Toggle({
|
|
924
|
-
className,
|
|
925
|
-
variant,
|
|
926
|
-
size,
|
|
927
|
-
...props
|
|
928
|
-
}) {
|
|
929
|
-
return /* @__PURE__ */ jsx(
|
|
930
|
-
TogglePrimitive.Root,
|
|
931
|
-
{
|
|
932
|
-
"data-slot": "toggle",
|
|
933
|
-
className: cn(toggleVariants({ variant, size, className })),
|
|
934
|
-
...props
|
|
935
|
-
}
|
|
936
|
-
);
|
|
937
|
-
}
|
|
938
|
-
var toggleVariants;
|
|
939
|
-
var init_toggle = __esm({
|
|
940
|
-
"src/ui/primitives/toggle.tsx"() {
|
|
941
|
-
"use client";
|
|
942
|
-
init_utils();
|
|
943
|
-
toggleVariants = cva(
|
|
944
|
-
"cursor-pointer inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
|
|
945
|
-
{
|
|
946
|
-
variants: {
|
|
947
|
-
variant: {
|
|
948
|
-
default: "bg-transparent",
|
|
949
|
-
outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"
|
|
950
|
-
},
|
|
951
|
-
size: {
|
|
952
|
-
default: "h-9 px-3",
|
|
953
|
-
sm: "h-8 px-2",
|
|
954
|
-
lg: "h-10 px-3"
|
|
955
|
-
}
|
|
956
|
-
},
|
|
957
|
-
defaultVariants: {
|
|
958
|
-
variant: "default",
|
|
959
|
-
size: "default"
|
|
960
|
-
}
|
|
961
|
-
}
|
|
962
|
-
);
|
|
963
|
-
}
|
|
964
|
-
});
|
|
965
|
-
var init_toggle_group = __esm({
|
|
966
|
-
"src/ui/primitives/toggle-group.tsx"() {
|
|
967
|
-
"use client";
|
|
968
|
-
createContext({
|
|
969
|
-
size: "default",
|
|
970
|
-
variant: "default"
|
|
971
|
-
});
|
|
972
|
-
}
|
|
973
|
-
});
|
|
974
|
-
function Spinner({ size = "md", className }) {
|
|
975
|
-
const sizeClasses = {
|
|
976
|
-
sm: "h-4 w-4",
|
|
977
|
-
md: "h-6 w-6",
|
|
978
|
-
lg: "h-8 w-8"
|
|
979
|
-
};
|
|
980
|
-
return /* @__PURE__ */ jsx(
|
|
981
|
-
"div",
|
|
982
|
-
{
|
|
983
|
-
className: cn(
|
|
984
|
-
"animate-spin rounded-full border-2 border-current border-t-transparent",
|
|
985
|
-
sizeClasses[size],
|
|
986
|
-
className
|
|
987
|
-
)
|
|
988
|
-
}
|
|
989
|
-
);
|
|
990
|
-
}
|
|
991
|
-
var Textarea, ButtonLoading;
|
|
992
|
-
var init_primitives = __esm({
|
|
993
|
-
"src/ui/primitives/index.tsx"() {
|
|
994
|
-
init_utils();
|
|
995
|
-
init_button();
|
|
996
|
-
init_badge();
|
|
997
|
-
init_button();
|
|
998
|
-
init_input();
|
|
999
|
-
init_checkbox();
|
|
1000
|
-
init_card();
|
|
1001
|
-
init_separator();
|
|
1002
|
-
init_card();
|
|
1003
|
-
init_table();
|
|
1004
|
-
init_dropdown_menu();
|
|
1005
|
-
init_dialog();
|
|
1006
|
-
init_tabs();
|
|
1007
|
-
init_breadcrumb();
|
|
1008
|
-
init_keyboard();
|
|
1009
|
-
init_pagination();
|
|
1010
|
-
init_status_badge();
|
|
1011
|
-
init_sidebar();
|
|
1012
|
-
init_popover();
|
|
1013
|
-
init_scroll_area();
|
|
1014
|
-
init_calendar();
|
|
1015
|
-
init_resizable();
|
|
1016
|
-
init_slider();
|
|
1017
|
-
init_switch();
|
|
1018
|
-
init_tooltip();
|
|
1019
|
-
init_select();
|
|
1020
|
-
init_menubar();
|
|
1021
|
-
init_navigation_menu();
|
|
1022
|
-
init_toggle();
|
|
1023
|
-
init_toggle_group();
|
|
1024
|
-
init_combobox();
|
|
1025
|
-
init_label();
|
|
1026
|
-
Textarea = React12.forwardRef(
|
|
1027
|
-
({ className, ...props }, ref) => {
|
|
1028
|
-
return /* @__PURE__ */ jsx(
|
|
1029
|
-
"textarea",
|
|
1030
|
-
{
|
|
1031
|
-
className: cn(
|
|
1032
|
-
"flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background 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",
|
|
1033
|
-
className
|
|
1034
|
-
),
|
|
1035
|
-
ref,
|
|
1036
|
-
...props
|
|
1037
|
-
}
|
|
1038
|
-
);
|
|
1039
|
-
}
|
|
1040
|
-
);
|
|
1041
|
-
Textarea.displayName = "Textarea";
|
|
1042
|
-
ButtonLoading = React12.forwardRef(({ className, isLoading, children, disabled, ...props }, ref) => {
|
|
1043
|
-
return /* @__PURE__ */ jsxs(
|
|
1044
|
-
Button,
|
|
1045
|
-
{
|
|
1046
|
-
className: cn("gap-2", className),
|
|
1047
|
-
disabled: isLoading || disabled,
|
|
1048
|
-
ref,
|
|
1049
|
-
...props,
|
|
1050
|
-
children: [
|
|
1051
|
-
isLoading && /* @__PURE__ */ jsx(Spinner, { size: "sm" }),
|
|
1052
|
-
children
|
|
1053
|
-
]
|
|
1054
|
-
}
|
|
1055
|
-
);
|
|
1056
|
-
});
|
|
1057
|
-
ButtonLoading.displayName = "ButtonLoading";
|
|
1058
|
-
}
|
|
1059
|
-
});
|
|
1060
|
-
var init_progress = __esm({
|
|
1061
|
-
"src/ui/feedback/progress.tsx"() {
|
|
1062
|
-
"use client";
|
|
1063
|
-
}
|
|
1064
|
-
});
|
|
1065
|
-
function Sheet({
|
|
1066
|
-
...props
|
|
1067
|
-
}) {
|
|
1068
|
-
return /* @__PURE__ */ jsx(DialogPrimitive.Root, { "data-slot": "sheet", ...props });
|
|
1069
|
-
}
|
|
1070
|
-
function SheetPortal({
|
|
1071
|
-
...props
|
|
1072
|
-
}) {
|
|
1073
|
-
return /* @__PURE__ */ jsx(DialogPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
|
|
1074
|
-
}
|
|
1075
|
-
function SheetOverlay({
|
|
1076
|
-
className,
|
|
1077
|
-
...props
|
|
1078
|
-
}) {
|
|
1079
|
-
return /* @__PURE__ */ jsx(
|
|
1080
|
-
DialogPrimitive.Overlay,
|
|
1081
|
-
{
|
|
1082
|
-
"data-slot": "sheet-overlay",
|
|
1083
|
-
className: cn(
|
|
1084
|
-
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
1085
|
-
className
|
|
1086
|
-
),
|
|
1087
|
-
...props
|
|
1088
|
-
}
|
|
1089
|
-
);
|
|
1090
|
-
}
|
|
1091
|
-
function SheetContent({
|
|
1092
|
-
className,
|
|
1093
|
-
children,
|
|
1094
|
-
side = "right",
|
|
1095
|
-
...props
|
|
1096
|
-
}) {
|
|
1097
|
-
return /* @__PURE__ */ jsxs(SheetPortal, { children: [
|
|
1098
|
-
/* @__PURE__ */ jsx(SheetOverlay, {}),
|
|
1099
|
-
/* @__PURE__ */ jsx(
|
|
1100
|
-
DialogPrimitive.Content,
|
|
1101
|
-
{
|
|
1102
|
-
"data-slot": "sheet-content",
|
|
1103
|
-
className: cn(sheetVariants({ side }), className),
|
|
1104
|
-
...props,
|
|
1105
|
-
children
|
|
1106
|
-
}
|
|
1107
|
-
)
|
|
1108
|
-
] });
|
|
1109
|
-
}
|
|
1110
|
-
function SheetTitle({
|
|
1111
|
-
className,
|
|
1112
|
-
...props
|
|
1113
|
-
}) {
|
|
1114
|
-
return /* @__PURE__ */ jsx(
|
|
1115
|
-
DialogPrimitive.Title,
|
|
1116
|
-
{
|
|
1117
|
-
"data-slot": "sheet-title",
|
|
1118
|
-
className: cn("text-lg font-semibold text-foreground", className),
|
|
1119
|
-
...props
|
|
1120
|
-
}
|
|
1121
|
-
);
|
|
1122
|
-
}
|
|
1123
|
-
var sheetVariants;
|
|
1124
|
-
var init_sheet = __esm({
|
|
1125
|
-
"src/ui/feedback/sheet.tsx"() {
|
|
1126
|
-
"use client";
|
|
1127
|
-
init_utils();
|
|
1128
|
-
sheetVariants = cva(
|
|
1129
|
-
"fixed z-50 gap-4 bg-background p-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",
|
|
1130
|
-
{
|
|
1131
|
-
variants: {
|
|
1132
|
-
side: {
|
|
1133
|
-
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
1134
|
-
bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
1135
|
-
left: "inset-y-0 left-0 h-full w-72 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
|
|
1136
|
-
right: "inset-y-0 right-0 h-full w-72 border-s data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm",
|
|
1137
|
-
start: "inset-y-0 start-0 h-full w-72 border-e data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left data-[state=closed]:rtl:slide-out-to-right data-[state=open]:rtl:slide-in-from-right sm:max-w-sm",
|
|
1138
|
-
end: "inset-y-0 end-0 h-full w-72 border-s data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right data-[state=closed]:rtl:slide-out-to-left data-[state=open]:rtl:slide-in-from-left sm:max-w-sm"
|
|
1139
|
-
}
|
|
1140
|
-
},
|
|
1141
|
-
defaultVariants: {
|
|
1142
|
-
side: "right"
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
);
|
|
1146
|
-
}
|
|
1147
|
-
});
|
|
1148
|
-
var init_alert = __esm({
|
|
1149
|
-
"src/ui/feedback/alert.tsx"() {
|
|
1150
|
-
cva(
|
|
1151
|
-
"relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",
|
|
1152
|
-
{
|
|
1153
|
-
variants: {
|
|
1154
|
-
variant: {
|
|
1155
|
-
default: "bg-background text-foreground",
|
|
1156
|
-
destructive: "border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"
|
|
1157
|
-
}
|
|
1158
|
-
},
|
|
1159
|
-
defaultVariants: {
|
|
1160
|
-
variant: "default"
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1163
|
-
);
|
|
1164
|
-
}
|
|
1165
|
-
});
|
|
1166
|
-
var init_context_menu = __esm({
|
|
1167
|
-
"src/ui/feedback/context-menu.tsx"() {
|
|
1168
|
-
"use client";
|
|
1169
|
-
}
|
|
1170
|
-
});
|
|
1171
|
-
var init_drawer = __esm({
|
|
1172
|
-
"src/ui/feedback/drawer.tsx"() {
|
|
1173
|
-
"use client";
|
|
1174
|
-
}
|
|
1175
|
-
});
|
|
1176
|
-
var init_sonner = __esm({
|
|
1177
|
-
"src/ui/feedback/sonner.tsx"() {
|
|
1178
|
-
"use client";
|
|
1179
|
-
}
|
|
1180
|
-
});
|
|
1181
|
-
var GlobalErrorEmitter;
|
|
1182
|
-
var init_error_dialog = __esm({
|
|
1183
|
-
"src/ui/feedback/error-dialog.tsx"() {
|
|
1184
|
-
"use client";
|
|
1185
|
-
GlobalErrorEmitter = class {
|
|
1186
|
-
constructor() {
|
|
1187
|
-
this.listeners = [];
|
|
1188
|
-
}
|
|
1189
|
-
subscribe(listener) {
|
|
1190
|
-
this.listeners.push(listener);
|
|
1191
|
-
return () => {
|
|
1192
|
-
this.listeners = this.listeners.filter((l) => l !== listener);
|
|
1193
|
-
};
|
|
1194
|
-
}
|
|
1195
|
-
emit(data) {
|
|
1196
|
-
this.listeners.forEach((listener) => listener(data));
|
|
1197
|
-
}
|
|
1198
|
-
};
|
|
1199
|
-
new GlobalErrorEmitter();
|
|
1200
|
-
createContext(null);
|
|
1201
|
-
}
|
|
1202
|
-
});
|
|
1203
|
-
var init_feedback = __esm({
|
|
1204
|
-
"src/ui/feedback/index.tsx"() {
|
|
1205
|
-
init_primitives();
|
|
1206
|
-
init_progress();
|
|
1207
|
-
init_sheet();
|
|
1208
|
-
init_alert();
|
|
1209
|
-
init_context_menu();
|
|
1210
|
-
init_drawer();
|
|
1211
|
-
init_sonner();
|
|
1212
|
-
init_error_dialog();
|
|
1213
|
-
}
|
|
1214
|
-
});
|
|
1215
|
-
|
|
1216
|
-
// src/hooks/use-tenant.ts
|
|
1217
|
-
var init_use_tenant = __esm({
|
|
1218
|
-
"src/hooks/use-tenant.ts"() {
|
|
1219
|
-
}
|
|
1220
|
-
});
|
|
1221
|
-
function useMediaQuery(query) {
|
|
1222
|
-
const [matches, setMatches] = useState(false);
|
|
1223
|
-
useEffect(() => {
|
|
1224
|
-
if (typeof window !== "undefined") {
|
|
1225
|
-
const media = window.matchMedia(query);
|
|
1226
|
-
setMatches(media.matches);
|
|
1227
|
-
const listener = (event) => setMatches(event.matches);
|
|
1228
|
-
media.addEventListener("change", listener);
|
|
1229
|
-
return () => media.removeEventListener("change", listener);
|
|
1230
|
-
}
|
|
1231
|
-
}, [query]);
|
|
1232
|
-
return matches;
|
|
1233
|
-
}
|
|
1234
|
-
function useMobile() {
|
|
1235
|
-
return useMediaQuery("(max-width: 768px)");
|
|
1236
|
-
}
|
|
1237
|
-
function useSettings() {
|
|
1238
|
-
const context = useContext(SettingsContext);
|
|
1239
|
-
if (!context) {
|
|
1240
|
-
return defaultSettingsValue;
|
|
1241
|
-
}
|
|
1242
|
-
return context;
|
|
1243
|
-
}
|
|
1244
|
-
function useIsDarkMode() {
|
|
1245
|
-
const { settings } = useSettings();
|
|
1246
|
-
const isDarkModePreferred = useMedia("(prefers-color-scheme: dark)");
|
|
1247
|
-
let resolvedMode = settings.mode;
|
|
1248
|
-
if (resolvedMode === "system") {
|
|
1249
|
-
resolvedMode = isDarkModePreferred ? "dark" : "light";
|
|
1250
|
-
}
|
|
1251
|
-
return resolvedMode === "dark";
|
|
1252
|
-
}
|
|
1253
|
-
function useIsRtl() {
|
|
1254
|
-
const direction = useDirection();
|
|
1255
|
-
return direction === "rtl";
|
|
1256
|
-
}
|
|
1257
|
-
var defaultSettingsValue;
|
|
1258
|
-
var init_hooks = __esm({
|
|
1259
|
-
"src/hooks/index.tsx"() {
|
|
1260
|
-
"use client";
|
|
1261
|
-
init_providers();
|
|
1262
|
-
init_use_tenant();
|
|
1263
|
-
defaultSettingsValue = {
|
|
1264
|
-
settings: defaultSettings,
|
|
1265
|
-
updateSettings: () => {
|
|
1266
|
-
},
|
|
1267
|
-
resetSettings: () => {
|
|
1268
|
-
}
|
|
1269
|
-
};
|
|
1270
|
-
createContext(null);
|
|
1271
|
-
}
|
|
1272
|
-
});
|
|
1273
|
-
function useSidebar() {
|
|
1274
|
-
const context = React12.useContext(SidebarContext);
|
|
1275
|
-
if (!context) {
|
|
1276
|
-
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
1277
|
-
}
|
|
1278
|
-
return context;
|
|
1279
|
-
}
|
|
1280
|
-
var SIDEBAR_WIDTH, SIDEBAR_WIDTH_MOBILE, SIDEBAR_WIDTH_ICON, SIDEBAR_KEYBOARD_SHORTCUT, SidebarContext, SidebarProvider, Sidebar, SidebarTrigger, SidebarRail, SidebarInset, SidebarInput, SidebarHeader, SidebarFooter, SidebarSeparator, SidebarContent, SidebarGroup, SidebarGroupLabel, SidebarGroupAction, SidebarGroupContent, SidebarMenu, SidebarMenuItem, sidebarMenuButtonVariants, SidebarMenuButton, SidebarMenuAction, SidebarMenuBadge, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubItem, SidebarMenuSubButton;
|
|
1281
|
-
var init_sidebar = __esm({
|
|
1282
|
-
"src/ui/primitives/sidebar.tsx"() {
|
|
1283
|
-
"use client";
|
|
1284
|
-
init_hooks();
|
|
1285
|
-
init_utils();
|
|
1286
|
-
init_button();
|
|
1287
|
-
init_feedback();
|
|
1288
|
-
init_tooltip();
|
|
1289
|
-
SIDEBAR_WIDTH = "16rem";
|
|
1290
|
-
SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
1291
|
-
SIDEBAR_WIDTH_ICON = "3rem";
|
|
1292
|
-
SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
1293
|
-
SidebarContext = React12.createContext(null);
|
|
1294
|
-
SidebarProvider = React12.forwardRef(
|
|
1295
|
-
({
|
|
1296
|
-
defaultOpen = false,
|
|
1297
|
-
open: openProp,
|
|
1298
|
-
onOpenChange: setOpenProp,
|
|
1299
|
-
className,
|
|
1300
|
-
style,
|
|
1301
|
-
children,
|
|
1302
|
-
...props
|
|
1303
|
-
}, ref) => {
|
|
1304
|
-
const isMobile = useMobile();
|
|
1305
|
-
const [openMobile, setOpenMobile] = React12.useState(false);
|
|
1306
|
-
const [hoverOpen, setHoverOpen] = React12.useState(false);
|
|
1307
|
-
const [_open, _setOpen] = React12.useState(defaultOpen);
|
|
1308
|
-
const open = openProp ?? _open;
|
|
1309
|
-
const setOpen = React12.useCallback(
|
|
1310
|
-
(value) => {
|
|
1311
|
-
if (setOpenProp) {
|
|
1312
|
-
return setOpenProp(typeof value === "function" ? value(open) : value);
|
|
1313
|
-
}
|
|
1314
|
-
_setOpen(value);
|
|
1315
|
-
},
|
|
1316
|
-
[setOpenProp, open]
|
|
1317
|
-
);
|
|
1318
|
-
const toggleSidebar = React12.useCallback(() => {
|
|
1319
|
-
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
1320
|
-
}, [isMobile, setOpen, setOpenMobile]);
|
|
1321
|
-
React12.useEffect(() => {
|
|
1322
|
-
const handleKeyDown = (event) => {
|
|
1323
|
-
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
1324
|
-
event.preventDefault();
|
|
1325
|
-
toggleSidebar();
|
|
1326
|
-
}
|
|
1327
|
-
};
|
|
1328
|
-
window.addEventListener("keydown", handleKeyDown);
|
|
1329
|
-
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
1330
|
-
}, [toggleSidebar]);
|
|
1331
|
-
const state = open ? "expanded" : "collapsed";
|
|
1332
|
-
const isHoverExpanded = !open && hoverOpen;
|
|
1333
|
-
const contextValue = React12.useMemo(
|
|
1334
|
-
() => ({
|
|
1335
|
-
state,
|
|
1336
|
-
open,
|
|
1337
|
-
setOpen,
|
|
1338
|
-
isMobile,
|
|
1339
|
-
openMobile,
|
|
1340
|
-
setOpenMobile,
|
|
1341
|
-
toggleSidebar,
|
|
1342
|
-
hoverOpen,
|
|
1343
|
-
setHoverOpen,
|
|
1344
|
-
isHoverExpanded
|
|
1345
|
-
}),
|
|
1346
|
-
[
|
|
1347
|
-
state,
|
|
1348
|
-
open,
|
|
1349
|
-
setOpen,
|
|
1350
|
-
isMobile,
|
|
1351
|
-
openMobile,
|
|
1352
|
-
setOpenMobile,
|
|
1353
|
-
toggleSidebar,
|
|
1354
|
-
hoverOpen,
|
|
1355
|
-
setHoverOpen,
|
|
1356
|
-
isHoverExpanded
|
|
1357
|
-
]
|
|
1358
|
-
);
|
|
1359
|
-
return /* @__PURE__ */ jsx(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx(
|
|
1360
|
-
"div",
|
|
1361
|
-
{
|
|
1362
|
-
style: {
|
|
1363
|
-
"--sidebar-width": SIDEBAR_WIDTH,
|
|
1364
|
-
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
1365
|
-
...style
|
|
1366
|
-
},
|
|
1367
|
-
className: cn(
|
|
1368
|
-
"group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",
|
|
1369
|
-
className
|
|
1370
|
-
),
|
|
1371
|
-
ref,
|
|
1372
|
-
...props,
|
|
1373
|
-
children
|
|
1374
|
-
}
|
|
1375
|
-
) }) });
|
|
1376
|
-
}
|
|
1377
|
-
);
|
|
1378
|
-
SidebarProvider.displayName = "SidebarProvider";
|
|
1379
|
-
Sidebar = React12.forwardRef(
|
|
1380
|
-
({
|
|
1381
|
-
side = "left",
|
|
1382
|
-
variant = "sidebar",
|
|
1383
|
-
collapsible = "offcanvas",
|
|
1384
|
-
hoverExpandEnabled = true,
|
|
1385
|
-
className,
|
|
1386
|
-
children,
|
|
1387
|
-
...props
|
|
1388
|
-
}, ref) => {
|
|
1389
|
-
const {
|
|
1390
|
-
isMobile,
|
|
1391
|
-
state,
|
|
1392
|
-
openMobile,
|
|
1393
|
-
setOpenMobile,
|
|
1394
|
-
setHoverOpen,
|
|
1395
|
-
isHoverExpanded
|
|
1396
|
-
} = useSidebar();
|
|
1397
|
-
const handleMouseEnter = React12.useCallback(() => {
|
|
1398
|
-
if (hoverExpandEnabled && state === "collapsed" && collapsible === "icon") {
|
|
1399
|
-
setHoverOpen(true);
|
|
1400
|
-
}
|
|
1401
|
-
}, [hoverExpandEnabled, state, collapsible, setHoverOpen]);
|
|
1402
|
-
const handleMouseLeave = React12.useCallback(() => {
|
|
1403
|
-
if (hoverExpandEnabled) {
|
|
1404
|
-
setHoverOpen(false);
|
|
1405
|
-
}
|
|
1406
|
-
}, [hoverExpandEnabled, setHoverOpen]);
|
|
1407
|
-
if (collapsible === "none") {
|
|
1408
|
-
return /* @__PURE__ */ jsx(
|
|
1409
|
-
"div",
|
|
1410
|
-
{
|
|
1411
|
-
className: cn(
|
|
1412
|
-
"flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground",
|
|
1413
|
-
className
|
|
1414
|
-
),
|
|
1415
|
-
ref,
|
|
1416
|
-
...props,
|
|
1417
|
-
children
|
|
1418
|
-
}
|
|
1419
|
-
);
|
|
1420
|
-
}
|
|
1421
|
-
if (isMobile) {
|
|
1422
|
-
return /* @__PURE__ */ jsx(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs(
|
|
1423
|
-
SheetContent,
|
|
1424
|
-
{
|
|
1425
|
-
"data-sidebar": "sidebar",
|
|
1426
|
-
"data-mobile": "true",
|
|
1427
|
-
className: "w-(--sidebar-width) bg-background p-0 text-foreground [&>button]:hidden",
|
|
1428
|
-
style: {
|
|
1429
|
-
"--sidebar-width": SIDEBAR_WIDTH_MOBILE
|
|
1430
|
-
},
|
|
1431
|
-
side,
|
|
1432
|
-
children: [
|
|
1433
|
-
/* @__PURE__ */ jsx(SheetTitle, { className: "sr-only", children: "Mobile Menu" }),
|
|
1434
|
-
/* @__PURE__ */ jsx("div", { className: "flex h-full w-full flex-col", children })
|
|
1435
|
-
]
|
|
1436
|
-
}
|
|
1437
|
-
) });
|
|
1438
|
-
}
|
|
1439
|
-
return /* @__PURE__ */ jsxs(
|
|
1440
|
-
"div",
|
|
1441
|
-
{
|
|
1442
|
-
ref,
|
|
1443
|
-
className: cn(
|
|
1444
|
-
"group peer hidden md:block transition-colors duration-200",
|
|
1445
|
-
// Blue bg + white text when collapsed, white bg + dark text when expanded/hover
|
|
1446
|
-
state === "collapsed" && !isHoverExpanded ? "text-sidebar-foreground" : "text-foreground"
|
|
1447
|
-
),
|
|
1448
|
-
"data-state": state,
|
|
1449
|
-
"data-hover-expanded": isHoverExpanded,
|
|
1450
|
-
"data-collapsible": state === "collapsed" ? collapsible : "",
|
|
1451
|
-
"data-variant": variant,
|
|
1452
|
-
"data-side": side,
|
|
1453
|
-
onMouseEnter: handleMouseEnter,
|
|
1454
|
-
onMouseLeave: handleMouseLeave,
|
|
1455
|
-
children: [
|
|
1456
|
-
/* @__PURE__ */ jsx(
|
|
1457
|
-
"div",
|
|
1458
|
-
{
|
|
1459
|
-
className: cn(
|
|
1460
|
-
"duration-200 relative h-svh w-(--sidebar-width) bg-transparent transition-[width] ease-linear",
|
|
1461
|
-
"group-data-[collapsible=offcanvas]:w-0",
|
|
1462
|
-
"group-data-[collapsible=icon]:w-(--sidebar-width-icon)",
|
|
1463
|
-
variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
|
|
1464
|
-
)
|
|
1465
|
-
}
|
|
1466
|
-
),
|
|
1467
|
-
/* @__PURE__ */ jsx(
|
|
1468
|
-
"div",
|
|
1469
|
-
{
|
|
1470
|
-
className: cn(
|
|
1471
|
-
"duration-200 fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] ease-linear md:flex",
|
|
1472
|
-
side === "left" ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]" : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
1473
|
-
// Adjustments for collapsible=icon
|
|
1474
|
-
variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_8px)] group-data-[collapsible=icon]:px-2.5" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[collapsible=icon]:border-r group-data-[collapsible=icon]:px-0",
|
|
1475
|
-
// Hover expand - override icon width to full width on hover
|
|
1476
|
-
"group-data-[hover-expanded=true]:!w-(--sidebar-width) group-data-[hover-expanded=true]:shadow-xl group-data-[hover-expanded=true]:z-[100]",
|
|
1477
|
-
className
|
|
1478
|
-
),
|
|
1479
|
-
...props,
|
|
1480
|
-
children: /* @__PURE__ */ jsx(
|
|
1481
|
-
"div",
|
|
1482
|
-
{
|
|
1483
|
-
"data-sidebar": "sidebar",
|
|
1484
|
-
className: cn(
|
|
1485
|
-
"flex h-full w-full flex-col border-r transition-colors duration-200",
|
|
1486
|
-
// Blue background when collapsed, white when expanded/hover
|
|
1487
|
-
"group-data-[state=collapsed]:bg-sidebar group-data-[state=collapsed]:border-sidebar-border",
|
|
1488
|
-
"group-data-[state=expanded]:bg-background group-data-[state=expanded]:border-border",
|
|
1489
|
-
"group-data-[hover-expanded=true]:!bg-background group-data-[hover-expanded=true]:!border-border",
|
|
1490
|
-
"group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow"
|
|
1491
|
-
),
|
|
1492
|
-
children
|
|
1493
|
-
}
|
|
1494
|
-
)
|
|
1495
|
-
}
|
|
1496
|
-
)
|
|
1497
|
-
]
|
|
1498
|
-
}
|
|
1499
|
-
);
|
|
1500
|
-
}
|
|
1501
|
-
);
|
|
1502
|
-
Sidebar.displayName = "Sidebar";
|
|
1503
|
-
SidebarTrigger = React12.forwardRef(({ className, onClick, ...props }, ref) => {
|
|
1504
|
-
const { toggleSidebar } = useSidebar();
|
|
1505
|
-
return /* @__PURE__ */ jsxs(
|
|
1506
|
-
Button,
|
|
1507
|
-
{
|
|
1508
|
-
ref,
|
|
1509
|
-
"data-sidebar": "trigger",
|
|
1510
|
-
variant: "ghost",
|
|
1511
|
-
size: "icon",
|
|
1512
|
-
className: cn("h-7 w-7", className),
|
|
1513
|
-
onClick: (event) => {
|
|
1514
|
-
onClick?.(event);
|
|
1515
|
-
toggleSidebar();
|
|
1516
|
-
},
|
|
1517
|
-
...props,
|
|
1518
|
-
children: [
|
|
1519
|
-
/* @__PURE__ */ jsx(PanelLeft, {}),
|
|
1520
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
1521
|
-
]
|
|
1522
|
-
}
|
|
1523
|
-
);
|
|
1524
|
-
});
|
|
1525
|
-
SidebarTrigger.displayName = "SidebarTrigger";
|
|
1526
|
-
SidebarRail = React12.forwardRef(({ className, ...props }, ref) => {
|
|
1527
|
-
const { toggleSidebar } = useSidebar();
|
|
1528
|
-
return /* @__PURE__ */ jsx(
|
|
1529
|
-
"button",
|
|
1530
|
-
{
|
|
1531
|
-
ref,
|
|
1532
|
-
"data-sidebar": "rail",
|
|
1533
|
-
"aria-label": "Toggle Sidebar",
|
|
1534
|
-
tabIndex: -1,
|
|
1535
|
-
onClick: toggleSidebar,
|
|
1536
|
-
title: "Toggle Sidebar",
|
|
1537
|
-
className: cn(
|
|
1538
|
-
"absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex",
|
|
1539
|
-
"[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize",
|
|
1540
|
-
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
|
|
1541
|
-
"group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar",
|
|
1542
|
-
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
|
|
1543
|
-
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
|
|
1544
|
-
className
|
|
1545
|
-
),
|
|
1546
|
-
...props
|
|
1547
|
-
}
|
|
1548
|
-
);
|
|
1549
|
-
});
|
|
1550
|
-
SidebarRail.displayName = "SidebarRail";
|
|
1551
|
-
SidebarInset = React12.forwardRef(({ className, ...props }, ref) => {
|
|
1552
|
-
return /* @__PURE__ */ jsx(
|
|
1553
|
-
"main",
|
|
1554
|
-
{
|
|
1555
|
-
ref,
|
|
1556
|
-
className: cn(
|
|
1557
|
-
"relative flex min-h-svh flex-1 flex-col bg-muted/40 transition-[margin] duration-200 ease-linear",
|
|
1558
|
-
"peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",
|
|
1559
|
-
className
|
|
1560
|
-
),
|
|
1561
|
-
...props
|
|
1562
|
-
}
|
|
1563
|
-
);
|
|
1564
|
-
});
|
|
1565
|
-
SidebarInset.displayName = "SidebarInset";
|
|
1566
|
-
SidebarInput = React12.forwardRef(({ className, ...props }, ref) => {
|
|
1567
|
-
return /* @__PURE__ */ jsx(
|
|
1568
|
-
"input",
|
|
1569
|
-
{
|
|
1570
|
-
ref,
|
|
1571
|
-
"data-sidebar": "input",
|
|
1572
|
-
className: cn(
|
|
1573
|
-
"flex h-8 w-full rounded-md border border-input 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-sidebar-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
1574
|
-
className
|
|
1575
|
-
),
|
|
1576
|
-
...props
|
|
1577
|
-
}
|
|
1578
|
-
);
|
|
1579
|
-
});
|
|
1580
|
-
SidebarInput.displayName = "SidebarInput";
|
|
1581
|
-
SidebarHeader = React12.forwardRef(({ className, ...props }, ref) => {
|
|
1582
|
-
return /* @__PURE__ */ jsx(
|
|
1583
|
-
"div",
|
|
1584
|
-
{
|
|
1585
|
-
ref,
|
|
1586
|
-
"data-sidebar": "header",
|
|
1587
|
-
className: cn("flex flex-col gap-2 p-2", className),
|
|
1588
|
-
...props
|
|
1589
|
-
}
|
|
1590
|
-
);
|
|
1591
|
-
});
|
|
1592
|
-
SidebarHeader.displayName = "SidebarHeader";
|
|
1593
|
-
SidebarFooter = React12.forwardRef(({ className, ...props }, ref) => {
|
|
1594
|
-
return /* @__PURE__ */ jsx(
|
|
1595
|
-
"div",
|
|
1596
|
-
{
|
|
1597
|
-
ref,
|
|
1598
|
-
"data-sidebar": "footer",
|
|
1599
|
-
className: cn("flex flex-col gap-2 p-2", className),
|
|
1600
|
-
...props
|
|
1601
|
-
}
|
|
1602
|
-
);
|
|
1603
|
-
});
|
|
1604
|
-
SidebarFooter.displayName = "SidebarFooter";
|
|
1605
|
-
SidebarSeparator = React12.forwardRef(({ className, ...props }, ref) => {
|
|
1606
|
-
return /* @__PURE__ */ jsx(
|
|
1607
|
-
"div",
|
|
1608
|
-
{
|
|
1609
|
-
ref,
|
|
1610
|
-
"data-sidebar": "separator",
|
|
1611
|
-
className: cn("mx-2 h-[1px] w-auto bg-sidebar-border", className),
|
|
1612
|
-
...props
|
|
1613
|
-
}
|
|
1614
|
-
);
|
|
1615
|
-
});
|
|
1616
|
-
SidebarSeparator.displayName = "SidebarSeparator";
|
|
1617
|
-
SidebarContent = React12.forwardRef(({ className, ...props }, ref) => {
|
|
1618
|
-
return /* @__PURE__ */ jsx(
|
|
1619
|
-
"div",
|
|
1620
|
-
{
|
|
1621
|
-
ref,
|
|
1622
|
-
"data-sidebar": "content",
|
|
1623
|
-
className: cn(
|
|
1624
|
-
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto",
|
|
1625
|
-
// Hide overflow when collapsed, but show when hover-expanded
|
|
1626
|
-
"group-data-[collapsible=icon]:overflow-hidden group-data-[hover-expanded=true]:!overflow-auto",
|
|
1627
|
-
className
|
|
1628
|
-
),
|
|
1629
|
-
...props
|
|
1630
|
-
}
|
|
1631
|
-
);
|
|
1632
|
-
});
|
|
1633
|
-
SidebarContent.displayName = "SidebarContent";
|
|
1634
|
-
SidebarGroup = React12.forwardRef(({ className, ...props }, ref) => {
|
|
1635
|
-
return /* @__PURE__ */ jsx(
|
|
1636
|
-
"div",
|
|
1637
|
-
{
|
|
1638
|
-
ref,
|
|
1639
|
-
"data-sidebar": "group",
|
|
1640
|
-
className: cn("relative flex w-full min-w-0 flex-col p-2", className),
|
|
1641
|
-
...props
|
|
1642
|
-
}
|
|
1643
|
-
);
|
|
1644
|
-
});
|
|
1645
|
-
SidebarGroup.displayName = "SidebarGroup";
|
|
1646
|
-
SidebarGroupLabel = React12.forwardRef(({ className, asChild = false, ...props }, ref) => {
|
|
1647
|
-
const Comp = asChild ? Slot : "div";
|
|
1648
|
-
return /* @__PURE__ */ jsx(
|
|
1649
|
-
Comp,
|
|
1650
|
-
{
|
|
1651
|
-
ref,
|
|
1652
|
-
"data-sidebar": "group-label",
|
|
1653
|
-
className: cn(
|
|
1654
|
-
"duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-bold text-primary uppercase tracking-wider outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
1655
|
-
// Hide when collapsed, show when hover-expanded
|
|
1656
|
-
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
|
|
1657
|
-
"group-data-[hover-expanded=true]:!mt-0 group-data-[hover-expanded=true]:!opacity-100",
|
|
1658
|
-
className
|
|
1659
|
-
),
|
|
1660
|
-
...props
|
|
1661
|
-
}
|
|
1662
|
-
);
|
|
1663
|
-
});
|
|
1664
|
-
SidebarGroupLabel.displayName = "SidebarGroupLabel";
|
|
1665
|
-
SidebarGroupAction = React12.forwardRef(({ className, asChild = false, ...props }, ref) => {
|
|
1666
|
-
const Comp = asChild ? Slot : "button";
|
|
1667
|
-
return /* @__PURE__ */ jsx(
|
|
1668
|
-
Comp,
|
|
1669
|
-
{
|
|
1670
|
-
ref,
|
|
1671
|
-
"data-sidebar": "group-action",
|
|
1672
|
-
className: cn(
|
|
1673
|
-
"absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
1674
|
-
// Increases the hit area of the button on mobile.
|
|
1675
|
-
"after:absolute after:-inset-2 after:md:hidden",
|
|
1676
|
-
"group-data-[collapsible=icon]:hidden",
|
|
1677
|
-
className
|
|
1678
|
-
),
|
|
1679
|
-
...props
|
|
1680
|
-
}
|
|
1681
|
-
);
|
|
1682
|
-
});
|
|
1683
|
-
SidebarGroupAction.displayName = "SidebarGroupAction";
|
|
1684
|
-
SidebarGroupContent = React12.forwardRef(({ className, ...props }, ref) => {
|
|
1685
|
-
return /* @__PURE__ */ jsx(
|
|
1686
|
-
"div",
|
|
1687
|
-
{
|
|
1688
|
-
ref,
|
|
1689
|
-
"data-sidebar": "group-content",
|
|
1690
|
-
className: cn("w-full text-sm", className),
|
|
1691
|
-
...props
|
|
1692
|
-
}
|
|
1693
|
-
);
|
|
1694
|
-
});
|
|
1695
|
-
SidebarGroupContent.displayName = "SidebarGroupContent";
|
|
1696
|
-
SidebarMenu = React12.forwardRef(({ className, ...props }, ref) => {
|
|
1697
|
-
return /* @__PURE__ */ jsx(
|
|
1698
|
-
"ul",
|
|
1699
|
-
{
|
|
1700
|
-
ref,
|
|
1701
|
-
"data-sidebar": "menu",
|
|
1702
|
-
className: cn("flex w-full min-w-0 flex-col gap-1", className),
|
|
1703
|
-
...props
|
|
1704
|
-
}
|
|
1705
|
-
);
|
|
1706
|
-
});
|
|
1707
|
-
SidebarMenu.displayName = "SidebarMenu";
|
|
1708
|
-
SidebarMenuItem = React12.forwardRef(({ className, ...props }, ref) => {
|
|
1709
|
-
return /* @__PURE__ */ jsx(
|
|
1710
|
-
"li",
|
|
1711
|
-
{
|
|
1712
|
-
ref,
|
|
1713
|
-
"data-sidebar": "menu-item",
|
|
1714
|
-
className: cn("group/menu-item relative", className),
|
|
1715
|
-
...props
|
|
1716
|
-
}
|
|
1717
|
-
);
|
|
1718
|
-
});
|
|
1719
|
-
SidebarMenuItem.displayName = "SidebarMenuItem";
|
|
1720
|
-
sidebarMenuButtonVariants = cva(
|
|
1721
|
-
// Base styles + hover-expand overrides
|
|
1722
|
-
"peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 group-data-[hover-expanded=true]:!size-auto group-data-[hover-expanded=true]:!w-full group-data-[hover-expanded=true]:!p-2",
|
|
1723
|
-
{
|
|
1724
|
-
variants: {
|
|
1725
|
-
variant: {
|
|
1726
|
-
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
1727
|
-
outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
|
|
1728
|
-
},
|
|
1729
|
-
size: {
|
|
1730
|
-
default: "h-8 text-sm",
|
|
1731
|
-
sm: "h-7 text-xs",
|
|
1732
|
-
lg: "h-12 text-sm group-data-[collapsible=icon]:!p-0"
|
|
1733
|
-
},
|
|
1734
|
-
isActive: {
|
|
1735
|
-
true: "bg-primary/10 text-primary font-bold"
|
|
1736
|
-
}
|
|
1737
|
-
},
|
|
1738
|
-
defaultVariants: {
|
|
1739
|
-
variant: "default",
|
|
1740
|
-
size: "default"
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
);
|
|
1744
|
-
SidebarMenuButton = React12.forwardRef(
|
|
1745
|
-
({
|
|
1746
|
-
asChild = false,
|
|
1747
|
-
isActive = false,
|
|
1748
|
-
variant = "default",
|
|
1749
|
-
size = "default",
|
|
1750
|
-
tooltip,
|
|
1751
|
-
className,
|
|
1752
|
-
...props
|
|
1753
|
-
}, ref) => {
|
|
1754
|
-
const Comp = asChild ? Slot : "button";
|
|
1755
|
-
const { isMobile, state } = useSidebar();
|
|
1756
|
-
const button = /* @__PURE__ */ jsx(
|
|
1757
|
-
Comp,
|
|
1758
|
-
{
|
|
1759
|
-
ref,
|
|
1760
|
-
"data-sidebar": "menu-button",
|
|
1761
|
-
"data-size": size,
|
|
1762
|
-
"data-active": isActive,
|
|
1763
|
-
className: cn(
|
|
1764
|
-
sidebarMenuButtonVariants({ variant, size, isActive }),
|
|
1765
|
-
className
|
|
1766
|
-
),
|
|
1767
|
-
...props
|
|
1768
|
-
}
|
|
1769
|
-
);
|
|
1770
|
-
if (!tooltip) {
|
|
1771
|
-
return button;
|
|
1772
|
-
}
|
|
1773
|
-
if (typeof tooltip === "string") {
|
|
1774
|
-
tooltip = {
|
|
1775
|
-
children: tooltip
|
|
1776
|
-
};
|
|
1777
|
-
}
|
|
1778
|
-
return /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
1779
|
-
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: button }),
|
|
1780
|
-
/* @__PURE__ */ jsx(
|
|
1781
|
-
TooltipContent,
|
|
1782
|
-
{
|
|
1783
|
-
side: "right",
|
|
1784
|
-
align: "center",
|
|
1785
|
-
hidden: state !== "collapsed" || isMobile,
|
|
1786
|
-
...tooltip
|
|
1787
|
-
}
|
|
1788
|
-
)
|
|
1789
|
-
] });
|
|
1790
|
-
}
|
|
1791
|
-
);
|
|
1792
|
-
SidebarMenuButton.displayName = "SidebarMenuButton";
|
|
1793
|
-
SidebarMenuAction = React12.forwardRef(({ className, asChild = false, showOnHover = false, ...props }, ref) => {
|
|
1794
|
-
const Comp = asChild ? Slot : "button";
|
|
1795
|
-
return /* @__PURE__ */ jsx(
|
|
1796
|
-
Comp,
|
|
1797
|
-
{
|
|
1798
|
-
ref,
|
|
1799
|
-
"data-sidebar": "menu-action",
|
|
1800
|
-
className: cn(
|
|
1801
|
-
"absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
|
|
1802
|
-
// Increases the hit area of the button on mobile.
|
|
1803
|
-
"after:absolute after:-inset-2 after:md:hidden",
|
|
1804
|
-
"peer-data-[size=sm]/menu-button:top-1",
|
|
1805
|
-
"peer-data-[size=default]/menu-button:top-1.5",
|
|
1806
|
-
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
1807
|
-
"group-data-[collapsible=icon]:hidden",
|
|
1808
|
-
showOnHover && "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
|
|
1809
|
-
className
|
|
1810
|
-
),
|
|
1811
|
-
...props
|
|
1812
|
-
}
|
|
1813
|
-
);
|
|
1814
|
-
});
|
|
1815
|
-
SidebarMenuAction.displayName = "SidebarMenuAction";
|
|
1816
|
-
SidebarMenuBadge = React12.forwardRef(({ className, ...props }, ref) => {
|
|
1817
|
-
return /* @__PURE__ */ jsx(
|
|
1818
|
-
"div",
|
|
1819
|
-
{
|
|
1820
|
-
ref,
|
|
1821
|
-
"data-sidebar": "menu-badge",
|
|
1822
|
-
className: cn(
|
|
1823
|
-
"pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none",
|
|
1824
|
-
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
|
1825
|
-
"peer-data-[size=sm]/menu-button:top-1",
|
|
1826
|
-
"peer-data-[size=default]/menu-button:top-1.5",
|
|
1827
|
-
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
1828
|
-
"group-data-[collapsible=icon]:hidden",
|
|
1829
|
-
className
|
|
1830
|
-
),
|
|
1831
|
-
...props
|
|
1832
|
-
}
|
|
1833
|
-
);
|
|
1834
|
-
});
|
|
1835
|
-
SidebarMenuBadge.displayName = "SidebarMenuBadge";
|
|
1836
|
-
SidebarMenuSkeleton = React12.forwardRef(({ className, showIcon = false, ...props }, ref) => {
|
|
1837
|
-
const width = React12.useMemo(() => {
|
|
1838
|
-
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
1839
|
-
}, []);
|
|
1840
|
-
return /* @__PURE__ */ jsxs(
|
|
1841
|
-
"div",
|
|
1842
|
-
{
|
|
1843
|
-
ref,
|
|
1844
|
-
"data-sidebar": "menu-skeleton",
|
|
1845
|
-
className: cn("flex h-8 items-center gap-2 rounded-md px-2", className),
|
|
1846
|
-
...props,
|
|
1847
|
-
children: [
|
|
1848
|
-
showIcon && /* @__PURE__ */ jsx(
|
|
1849
|
-
"div",
|
|
1850
|
-
{
|
|
1851
|
-
className: "size-4 rounded-md animate-pulse bg-muted",
|
|
1852
|
-
"data-sidebar": "menu-skeleton-icon"
|
|
1853
|
-
}
|
|
1854
|
-
),
|
|
1855
|
-
/* @__PURE__ */ jsx(
|
|
1856
|
-
"div",
|
|
1857
|
-
{
|
|
1858
|
-
className: "h-4 flex-1 max-w-[--skeleton-width] animate-pulse bg-muted rounded-full",
|
|
1859
|
-
"data-sidebar": "menu-skeleton-text",
|
|
1860
|
-
style: {
|
|
1861
|
-
"--skeleton-width": width
|
|
1862
|
-
}
|
|
1863
|
-
}
|
|
1864
|
-
)
|
|
1865
|
-
]
|
|
1866
|
-
}
|
|
1867
|
-
);
|
|
1868
|
-
});
|
|
1869
|
-
SidebarMenuSkeleton.displayName = "SidebarMenuSkeleton";
|
|
1870
|
-
SidebarMenuSub = React12.forwardRef(({ className, ...props }, ref) => {
|
|
1871
|
-
return /* @__PURE__ */ jsx(
|
|
1872
|
-
"ul",
|
|
1873
|
-
{
|
|
1874
|
-
ref,
|
|
1875
|
-
"data-sidebar": "menu-sub",
|
|
1876
|
-
className: cn(
|
|
1877
|
-
"mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5",
|
|
1878
|
-
// Hide when collapsed, show when hover-expanded
|
|
1879
|
-
"group-data-[collapsible=icon]:hidden group-data-[hover-expanded=true]:!flex",
|
|
1880
|
-
className
|
|
1881
|
-
),
|
|
1882
|
-
...props
|
|
1883
|
-
}
|
|
1884
|
-
);
|
|
1885
|
-
});
|
|
1886
|
-
SidebarMenuSub.displayName = "SidebarMenuSub";
|
|
1887
|
-
SidebarMenuSubItem = React12.forwardRef(({ ...props }, ref) => /* @__PURE__ */ jsx("li", { ref, ...props }));
|
|
1888
|
-
SidebarMenuSubItem.displayName = "SidebarMenuSubItem";
|
|
1889
|
-
SidebarMenuSubButton = React12.forwardRef(({ asChild = false, size = "md", isActive, className, ...props }, ref) => {
|
|
1890
|
-
const Comp = asChild ? Slot : "a";
|
|
1891
|
-
return /* @__PURE__ */ jsx(
|
|
1892
|
-
Comp,
|
|
1893
|
-
{
|
|
1894
|
-
ref,
|
|
1895
|
-
"data-sidebar": "menu-sub-button",
|
|
1896
|
-
"data-size": size,
|
|
1897
|
-
"data-active": isActive,
|
|
1898
|
-
className: cn(
|
|
1899
|
-
"flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 text-xs",
|
|
1900
|
-
"data-[active=true]:bg-primary/15 data-[active=true]:!text-primary data-[active=true]:font-bold",
|
|
1901
|
-
size === "sm" && "text-xs",
|
|
1902
|
-
size === "md" && "text-sm",
|
|
1903
|
-
className
|
|
1904
|
-
),
|
|
1905
|
-
...props
|
|
1906
|
-
}
|
|
1907
|
-
);
|
|
1908
|
-
});
|
|
1909
|
-
SidebarMenuSubButton.displayName = "SidebarMenuSubButton";
|
|
1910
|
-
}
|
|
1911
|
-
});
|
|
1912
|
-
var init_sticky_layout = __esm({
|
|
1913
|
-
"src/ui/primitives/sticky-layout.tsx"() {
|
|
1914
|
-
}
|
|
1915
|
-
});
|
|
1916
|
-
var init_prefetch_link = __esm({
|
|
1917
|
-
"src/ui/primitives/prefetch-link.tsx"() {
|
|
1918
|
-
"use client";
|
|
1919
|
-
}
|
|
1920
|
-
});
|
|
1921
|
-
function DynamicIcon({ name, ...props }) {
|
|
1922
|
-
if (!name) return null;
|
|
1923
|
-
const LucideIcon = icons[name];
|
|
1924
|
-
if (!LucideIcon) return null;
|
|
1925
|
-
return /* @__PURE__ */ jsx(LucideIcon, { ...props });
|
|
1926
|
-
}
|
|
1927
|
-
var init_dynamic_icon = __esm({
|
|
1928
|
-
"src/ui/primitives/dynamic-icon.tsx"() {
|
|
1929
|
-
"use client";
|
|
1930
|
-
}
|
|
1931
|
-
});
|
|
1932
|
-
var InputNumber;
|
|
1933
|
-
var init_input_number = __esm({
|
|
1934
|
-
"src/ui/primitives/input-number.tsx"() {
|
|
1935
|
-
"use client";
|
|
1936
|
-
init_utils();
|
|
1937
|
-
init_input();
|
|
1938
|
-
InputNumber = React12.forwardRef(
|
|
1939
|
-
({ value, onChange, className, decimalScale = 0, suffix, ...props }, ref) => {
|
|
1940
|
-
const [displayValue, setDisplayValue] = React12.useState("");
|
|
1941
|
-
const parseDisplayValue = (val) => {
|
|
1942
|
-
const clean = val.replace(/\./g, "").replace(",", ".");
|
|
1943
|
-
return Number(clean);
|
|
1944
|
-
};
|
|
1945
|
-
const formatNumber = React12.useCallback(
|
|
1946
|
-
(num) => {
|
|
1947
|
-
return new Intl.NumberFormat("vi-VN", {
|
|
1948
|
-
maximumFractionDigits: decimalScale,
|
|
1949
|
-
minimumFractionDigits: 0
|
|
1950
|
-
}).format(num);
|
|
1951
|
-
},
|
|
1952
|
-
[decimalScale]
|
|
1953
|
-
);
|
|
1954
|
-
React12.useEffect(() => {
|
|
1955
|
-
if (value === null || value === void 0 || value === "") {
|
|
1956
|
-
setDisplayValue("");
|
|
1957
|
-
return;
|
|
1958
|
-
}
|
|
1959
|
-
const numValue = Number(value);
|
|
1960
|
-
if (isNaN(numValue)) return;
|
|
1961
|
-
const currentNum = parseDisplayValue(displayValue);
|
|
1962
|
-
if (currentNum !== numValue) {
|
|
1963
|
-
setDisplayValue(formatNumber(numValue));
|
|
1964
|
-
}
|
|
1965
|
-
}, [value, decimalScale, displayValue, formatNumber]);
|
|
1966
|
-
const handleChange = (e) => {
|
|
1967
|
-
const rawValue = e.target.value;
|
|
1968
|
-
let cleanVal = rawValue.replace(/[^0-9,]/g, "");
|
|
1969
|
-
const parts = cleanVal.split(",");
|
|
1970
|
-
if (parts.length > 2) {
|
|
1971
|
-
cleanVal = parts[0] + "," + parts.slice(1).join("");
|
|
1972
|
-
}
|
|
1973
|
-
if (cleanVal === "") {
|
|
1974
|
-
setDisplayValue("");
|
|
1975
|
-
onChange?.(null);
|
|
1976
|
-
return;
|
|
1977
|
-
}
|
|
1978
|
-
const [integerPart, decimalPart] = cleanVal.split(",");
|
|
1979
|
-
let formattedInteger = integerPart;
|
|
1980
|
-
if (integerPart) {
|
|
1981
|
-
formattedInteger = new Intl.NumberFormat("vi-VN").format(
|
|
1982
|
-
Number(integerPart)
|
|
1983
|
-
);
|
|
1984
|
-
}
|
|
1985
|
-
let newDisplayValue = formattedInteger;
|
|
1986
|
-
let finalDecimalPart = decimalPart;
|
|
1987
|
-
if (decimalPart !== void 0) {
|
|
1988
|
-
if (decimalScale !== void 0 && decimalPart.length > decimalScale) {
|
|
1989
|
-
finalDecimalPart = decimalPart.substring(0, decimalScale);
|
|
1990
|
-
}
|
|
1991
|
-
newDisplayValue += "," + finalDecimalPart;
|
|
1992
|
-
}
|
|
1993
|
-
setDisplayValue(newDisplayValue);
|
|
1994
|
-
let numStr = integerPart;
|
|
1995
|
-
if (finalDecimalPart !== void 0) {
|
|
1996
|
-
numStr += "." + finalDecimalPart;
|
|
1997
|
-
}
|
|
1998
|
-
const numValue = Number(numStr.replace(/\./g, ""));
|
|
1999
|
-
onChange?.(numValue);
|
|
2000
|
-
};
|
|
2001
|
-
return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
2002
|
-
/* @__PURE__ */ jsx(
|
|
2003
|
-
Input,
|
|
2004
|
-
{
|
|
2005
|
-
...props,
|
|
2006
|
-
ref,
|
|
2007
|
-
type: "text",
|
|
2008
|
-
inputMode: "numeric",
|
|
2009
|
-
value: displayValue,
|
|
2010
|
-
onChange: handleChange,
|
|
2011
|
-
className: cn("pr-8", className)
|
|
2012
|
-
}
|
|
2013
|
-
),
|
|
2014
|
-
suffix && /* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none text-muted-foreground text-sm", children: suffix })
|
|
2015
|
-
] });
|
|
2016
|
-
}
|
|
2017
|
-
);
|
|
2018
|
-
InputNumber.displayName = "InputNumber";
|
|
2019
|
-
}
|
|
2020
|
-
});
|
|
2021
|
-
|
|
2022
|
-
// src/ui/primitives/client.ts
|
|
2023
|
-
var init_client = __esm({
|
|
2024
|
-
"src/ui/primitives/client.ts"() {
|
|
2025
|
-
"use client";
|
|
2026
|
-
init_calendar();
|
|
2027
|
-
init_combobox();
|
|
2028
|
-
init_scroll_area();
|
|
2029
|
-
init_select();
|
|
2030
|
-
init_popover();
|
|
2031
|
-
init_dropdown_menu();
|
|
2032
|
-
init_switch();
|
|
2033
|
-
init_checkbox();
|
|
2034
|
-
init_label();
|
|
2035
|
-
init_tooltip();
|
|
2036
|
-
init_sidebar();
|
|
2037
|
-
init_resizable();
|
|
2038
|
-
init_slider();
|
|
2039
|
-
init_toggle();
|
|
2040
|
-
init_toggle_group();
|
|
2041
|
-
init_menubar();
|
|
2042
|
-
init_navigation_menu();
|
|
2043
|
-
init_sticky_layout();
|
|
2044
|
-
init_prefetch_link();
|
|
2045
|
-
init_dynamic_icon();
|
|
2046
|
-
init_input_number();
|
|
2047
|
-
init_sheet();
|
|
2048
|
-
init_context_menu();
|
|
2049
|
-
init_drawer();
|
|
2050
|
-
init_progress();
|
|
2051
|
-
init_sonner();
|
|
2052
|
-
}
|
|
2053
|
-
});
|
|
2054
|
-
function RadioGroup4({
|
|
2055
|
-
className,
|
|
2056
|
-
...props
|
|
2057
|
-
}) {
|
|
2058
|
-
return /* @__PURE__ */ jsx(
|
|
2059
|
-
RadioGroupPrimitive.Root,
|
|
2060
|
-
{
|
|
2061
|
-
"data-slot": "radio-group",
|
|
2062
|
-
className: cn("grid gap-2", className),
|
|
2063
|
-
...props
|
|
2064
|
-
}
|
|
2065
|
-
);
|
|
2066
|
-
}
|
|
2067
|
-
function RadioGroupItem({
|
|
2068
|
-
className,
|
|
2069
|
-
...props
|
|
2070
|
-
}) {
|
|
2071
|
-
return /* @__PURE__ */ jsx(
|
|
2072
|
-
RadioGroupPrimitive.Item,
|
|
2073
|
-
{
|
|
2074
|
-
"data-slot": "radio-group-item",
|
|
2075
|
-
className: cn(
|
|
2076
|
-
"cursor-pointer aspect-square h-current w-4 rounded-full border-[1.5px] border-primary text-primary focus:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
2077
|
-
className
|
|
2078
|
-
),
|
|
2079
|
-
...props,
|
|
2080
|
-
children: /* @__PURE__ */ jsx(
|
|
2081
|
-
RadioGroupPrimitive.Indicator,
|
|
2082
|
-
{
|
|
2083
|
-
"data-slot": "radio-group-indicator",
|
|
2084
|
-
className: "flex items-center justify-center",
|
|
2085
|
-
children: /* @__PURE__ */ jsx(Circle, { className: "h-2.5 w-2.5 fill-current text-current" })
|
|
2086
|
-
}
|
|
2087
|
-
)
|
|
2088
|
-
}
|
|
2089
|
-
);
|
|
2090
|
-
}
|
|
2091
|
-
var init_radio_group = __esm({
|
|
2092
|
-
"src/ui/forms/radio-group.tsx"() {
|
|
2093
|
-
"use client";
|
|
2094
|
-
init_utils();
|
|
2095
|
-
}
|
|
2096
|
-
});
|
|
2097
|
-
function Rating({
|
|
2098
|
-
className,
|
|
2099
|
-
length = 5,
|
|
2100
|
-
size,
|
|
2101
|
-
variant = "default",
|
|
2102
|
-
orientation = "horizontal",
|
|
2103
|
-
readOnly = false,
|
|
2104
|
-
iconName = "Star",
|
|
2105
|
-
...props
|
|
2106
|
-
}) {
|
|
2107
|
-
const currentValue = props.value || "0";
|
|
2108
|
-
const [hoverValue, onHoverValue] = useState(currentValue);
|
|
2109
|
-
if (readOnly) {
|
|
2110
|
-
return /* @__PURE__ */ jsx(
|
|
2111
|
-
"div",
|
|
2112
|
-
{
|
|
2113
|
-
"data-slot": "rating",
|
|
2114
|
-
role: "img",
|
|
2115
|
-
className: cn(
|
|
2116
|
-
"flex",
|
|
2117
|
-
orientation === "horizontal" ? "gap-x-1.5" : "flex-col space-y-1.5",
|
|
2118
|
-
className
|
|
2119
|
-
),
|
|
2120
|
-
"aria-label": `Rating: ${currentValue} out of ${length}`,
|
|
2121
|
-
...props,
|
|
2122
|
-
children: Array.from({ length }, (_, index) => {
|
|
2123
|
-
const starValue = (index + 1).toString();
|
|
2124
|
-
const filled = Number(starValue) <= Number(currentValue);
|
|
2125
|
-
return /* @__PURE__ */ jsx(
|
|
2126
|
-
DynamicIcon,
|
|
2127
|
-
{
|
|
2128
|
-
name: iconName,
|
|
2129
|
-
className: cn(
|
|
2130
|
-
starVariants({ size, variant, filled }),
|
|
2131
|
-
"fill-current"
|
|
2132
|
-
),
|
|
2133
|
-
"aria-hidden": true
|
|
2134
|
-
},
|
|
2135
|
-
starValue
|
|
2136
|
-
);
|
|
2137
|
-
})
|
|
2138
|
-
}
|
|
2139
|
-
);
|
|
2140
|
-
}
|
|
2141
|
-
return /* @__PURE__ */ jsx(
|
|
2142
|
-
RadioGroupPrimitive.Root,
|
|
2143
|
-
{
|
|
2144
|
-
"data-slot": "rating",
|
|
2145
|
-
className: cn(
|
|
2146
|
-
"flex",
|
|
2147
|
-
orientation === "horizontal" ? "gap-x-1.5" : "flex-col space-y-1.5",
|
|
2148
|
-
className
|
|
2149
|
-
),
|
|
2150
|
-
orientation,
|
|
2151
|
-
onMouseLeave: () => onHoverValue("0"),
|
|
2152
|
-
"aria-label": "Rating",
|
|
2153
|
-
...props,
|
|
2154
|
-
children: Array.from({ length }).map((_, index) => {
|
|
2155
|
-
const starValue = (index + 1).toString();
|
|
2156
|
-
const filled = Number(starValue) <= (Number(hoverValue) || Number(currentValue));
|
|
2157
|
-
return /* @__PURE__ */ jsx(
|
|
2158
|
-
RatingStar,
|
|
2159
|
-
{
|
|
2160
|
-
variant,
|
|
2161
|
-
size,
|
|
2162
|
-
filled,
|
|
2163
|
-
value: starValue,
|
|
2164
|
-
onHoverValue,
|
|
2165
|
-
iconName
|
|
2166
|
-
},
|
|
2167
|
-
starValue
|
|
2168
|
-
);
|
|
2169
|
-
})
|
|
2170
|
-
}
|
|
2171
|
-
);
|
|
2172
|
-
}
|
|
2173
|
-
function RatingStar({
|
|
2174
|
-
value,
|
|
2175
|
-
size,
|
|
2176
|
-
variant,
|
|
2177
|
-
filled,
|
|
2178
|
-
onHoverValue,
|
|
2179
|
-
iconName,
|
|
2180
|
-
...props
|
|
2181
|
-
}) {
|
|
2182
|
-
return /* @__PURE__ */ jsx(
|
|
2183
|
-
RadioGroupPrimitive.Item,
|
|
2184
|
-
{
|
|
2185
|
-
"data-slot": "rating-star",
|
|
2186
|
-
value,
|
|
2187
|
-
className: cn(
|
|
2188
|
-
starVariants({ size, variant, filled }),
|
|
2189
|
-
"cursor-pointer focus:outline-hidden focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"
|
|
2190
|
-
),
|
|
2191
|
-
onMouseEnter: () => onHoverValue(value),
|
|
2192
|
-
"aria-label": `Rate ${value} star${value === "1" ? "" : "s"}`,
|
|
2193
|
-
...props,
|
|
2194
|
-
children: /* @__PURE__ */ jsx(DynamicIcon, { name: iconName, className: "h-full w-full fill-current" })
|
|
2195
|
-
}
|
|
2196
|
-
);
|
|
2197
|
-
}
|
|
2198
|
-
var starVariants;
|
|
2199
|
-
var init_rating = __esm({
|
|
2200
|
-
"src/ui/forms/rating.tsx"() {
|
|
2201
|
-
"use client";
|
|
2202
|
-
init_utils();
|
|
2203
|
-
init_dynamic_icon();
|
|
2204
|
-
starVariants = cva(
|
|
2205
|
-
"transition-all duration-100 ease-in-out hover:scale-110",
|
|
2206
|
-
{
|
|
2207
|
-
variants: {
|
|
2208
|
-
size: {
|
|
2209
|
-
sm: "w-4 h-4",
|
|
2210
|
-
default: "w-6 h-6",
|
|
2211
|
-
lg: "w-8 h-8"
|
|
2212
|
-
},
|
|
2213
|
-
variant: {
|
|
2214
|
-
default: "text-yellow-400",
|
|
2215
|
-
primary: "text-primary",
|
|
2216
|
-
muted: "text-muted-foreground"
|
|
2217
|
-
},
|
|
2218
|
-
filled: {
|
|
2219
|
-
true: "",
|
|
2220
|
-
false: "text-gray-200"
|
|
2221
|
-
}
|
|
2222
|
-
},
|
|
2223
|
-
defaultVariants: {
|
|
2224
|
-
size: "default",
|
|
2225
|
-
variant: "default",
|
|
2226
|
-
filled: false
|
|
2227
|
-
}
|
|
2228
|
-
}
|
|
2229
|
-
);
|
|
2230
|
-
}
|
|
2231
|
-
});
|
|
2232
|
-
function Command({
|
|
2233
|
-
className,
|
|
2234
|
-
...props
|
|
2235
|
-
}) {
|
|
2236
|
-
return /* @__PURE__ */ jsx(
|
|
2237
|
-
Command$1,
|
|
2238
|
-
{
|
|
2239
|
-
"data-slot": "command",
|
|
2240
|
-
className: cn(
|
|
2241
|
-
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
|
2242
|
-
className
|
|
2243
|
-
),
|
|
2244
|
-
...props
|
|
2245
|
-
}
|
|
2246
|
-
);
|
|
2247
|
-
}
|
|
2248
|
-
function CommandDialog({
|
|
2249
|
-
children,
|
|
2250
|
-
commandProps,
|
|
2251
|
-
...props
|
|
2252
|
-
}) {
|
|
2253
|
-
return /* @__PURE__ */ jsx(Dialog, { ...props, children: /* @__PURE__ */ jsx(DialogContent, { className: "overflow-hidden p-0 shadow-lg", children: /* @__PURE__ */ jsx(
|
|
2254
|
-
Command,
|
|
2255
|
-
{
|
|
2256
|
-
className: "[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",
|
|
2257
|
-
...commandProps,
|
|
2258
|
-
children
|
|
2259
|
-
}
|
|
2260
|
-
) }) });
|
|
2261
|
-
}
|
|
2262
|
-
function CommandInput({
|
|
2263
|
-
className,
|
|
2264
|
-
...props
|
|
2265
|
-
}) {
|
|
2266
|
-
return /* @__PURE__ */ jsxs(
|
|
2267
|
-
"div",
|
|
2268
|
-
{
|
|
2269
|
-
"data-slot": "command-input-wrapper",
|
|
2270
|
-
className: "flex items-center border-b px-3",
|
|
2271
|
-
children: [
|
|
2272
|
-
/* @__PURE__ */ jsx(Search, { className: "me-2 size-4 shrink-0 opacity-50" }),
|
|
2273
|
-
/* @__PURE__ */ jsx(
|
|
2274
|
-
Command$1.Input,
|
|
2275
|
-
{
|
|
2276
|
-
"data-slot": "command-input",
|
|
2277
|
-
className: cn(
|
|
2278
|
-
"flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
|
2279
|
-
className
|
|
2280
|
-
),
|
|
2281
|
-
...props
|
|
2282
|
-
}
|
|
2283
|
-
)
|
|
2284
|
-
]
|
|
2285
|
-
}
|
|
2286
|
-
);
|
|
2287
|
-
}
|
|
2288
|
-
function CommandList({
|
|
2289
|
-
className,
|
|
2290
|
-
...props
|
|
2291
|
-
}) {
|
|
2292
|
-
return /* @__PURE__ */ jsx(
|
|
2293
|
-
Command$1.List,
|
|
2294
|
-
{
|
|
2295
|
-
"data-slot": "command-list",
|
|
2296
|
-
className: cn(
|
|
2297
|
-
"max-h-[300px] overflow-y-auto overflow-x-hidden",
|
|
2298
|
-
className
|
|
2299
|
-
),
|
|
2300
|
-
...props
|
|
2301
|
-
}
|
|
2302
|
-
);
|
|
2303
|
-
}
|
|
2304
|
-
function CommandEmpty({
|
|
2305
|
-
...props
|
|
2306
|
-
}) {
|
|
2307
|
-
return /* @__PURE__ */ jsx(
|
|
2308
|
-
Command$1.Empty,
|
|
2309
|
-
{
|
|
2310
|
-
"data-slot": "command-empty",
|
|
2311
|
-
className: "py-6 text-center text-sm",
|
|
2312
|
-
...props
|
|
2313
|
-
}
|
|
2314
|
-
);
|
|
2315
|
-
}
|
|
2316
|
-
function CommandGroup({
|
|
2317
|
-
className,
|
|
2318
|
-
...props
|
|
2319
|
-
}) {
|
|
2320
|
-
return /* @__PURE__ */ jsx(
|
|
2321
|
-
Command$1.Group,
|
|
2322
|
-
{
|
|
2323
|
-
"data-slot": "command-group",
|
|
2324
|
-
className: cn(
|
|
2325
|
-
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-sm [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
|
2326
|
-
className
|
|
2327
|
-
),
|
|
2328
|
-
...props
|
|
2329
|
-
}
|
|
2330
|
-
);
|
|
2331
|
-
}
|
|
2332
|
-
function CommandSeparator({
|
|
2333
|
-
className,
|
|
2334
|
-
...props
|
|
2335
|
-
}) {
|
|
2336
|
-
return /* @__PURE__ */ jsx(
|
|
2337
|
-
Command$1.Separator,
|
|
2338
|
-
{
|
|
2339
|
-
"data-slot": "command-separator",
|
|
2340
|
-
className: cn("-mx-1 h-px bg-border", className),
|
|
2341
|
-
...props
|
|
2342
|
-
}
|
|
2343
|
-
);
|
|
2344
|
-
}
|
|
2345
|
-
function CommandItem({
|
|
2346
|
-
className,
|
|
2347
|
-
...props
|
|
2348
|
-
}) {
|
|
2349
|
-
return /* @__PURE__ */ jsx(
|
|
2350
|
-
Command$1.Item,
|
|
2351
|
-
{
|
|
2352
|
-
"data-slot": "command-item",
|
|
2353
|
-
className: cn(
|
|
2354
|
-
"cursor-pointer relative flex gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-hidden data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",
|
|
2355
|
-
className
|
|
2356
|
-
),
|
|
2357
|
-
...props
|
|
2358
|
-
}
|
|
2359
|
-
);
|
|
2360
|
-
}
|
|
2361
|
-
function CommandShortcut({
|
|
2362
|
-
className,
|
|
2363
|
-
...props
|
|
2364
|
-
}) {
|
|
2365
|
-
return /* @__PURE__ */ jsx(
|
|
2366
|
-
"span",
|
|
2367
|
-
{
|
|
2368
|
-
"data-slot": "command-shortcut",
|
|
2369
|
-
className: cn(
|
|
2370
|
-
"ms-auto text-sm tracking-widest text-muted-foreground",
|
|
2371
|
-
className
|
|
2372
|
-
),
|
|
2373
|
-
...props
|
|
2374
|
-
}
|
|
2375
|
-
);
|
|
2376
|
-
}
|
|
2377
|
-
var init_command = __esm({
|
|
2378
|
-
"src/ui/forms/command.tsx"() {
|
|
2379
|
-
"use client";
|
|
2380
|
-
init_utils();
|
|
2381
|
-
init_feedback();
|
|
2382
|
-
}
|
|
2383
|
-
});
|
|
2384
|
-
var MultiSelect;
|
|
2385
|
-
var init_multi_select = __esm({
|
|
2386
|
-
"src/ui/forms/multi-select.tsx"() {
|
|
2387
|
-
"use client";
|
|
2388
|
-
init_utils();
|
|
2389
|
-
init_primitives();
|
|
2390
|
-
init_client();
|
|
2391
|
-
MultiSelect = React12.forwardRef(
|
|
2392
|
-
({
|
|
2393
|
-
options,
|
|
2394
|
-
value: controlledValue,
|
|
2395
|
-
onValueChange,
|
|
2396
|
-
defaultValue = [],
|
|
2397
|
-
placeholder = "Select options...",
|
|
2398
|
-
searchPlaceholder = "Search...",
|
|
2399
|
-
emptyText = "No option found.",
|
|
2400
|
-
maxCount = 3,
|
|
2401
|
-
disabled = false,
|
|
2402
|
-
responsive = false,
|
|
2403
|
-
className,
|
|
2404
|
-
id
|
|
2405
|
-
}, ref) => {
|
|
2406
|
-
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
2407
|
-
const [open, setOpen] = useState(false);
|
|
2408
|
-
const [searchValue, setSearchValue] = useState("");
|
|
2409
|
-
const isControlled = controlledValue !== void 0;
|
|
2410
|
-
const value = isControlled ? controlledValue : internalValue;
|
|
2411
|
-
const containerRef = useRef(null);
|
|
2412
|
-
const searchInputRef = useRef(null);
|
|
2413
|
-
const dropdownRef = useRef(null);
|
|
2414
|
-
const buttonRef = useRef(null);
|
|
2415
|
-
const [politeMessage, setPoliteMessage] = useState("");
|
|
2416
|
-
const [assertiveMessage, setAssertiveMessage] = useState("");
|
|
2417
|
-
const prevSelectedCount = useRef(value.length);
|
|
2418
|
-
const announce = useCallback(
|
|
2419
|
-
(message, priority = "polite") => {
|
|
2420
|
-
if (priority === "assertive") {
|
|
2421
|
-
setAssertiveMessage(message);
|
|
2422
|
-
setTimeout(() => setAssertiveMessage(""), 100);
|
|
2423
|
-
} else {
|
|
2424
|
-
setPoliteMessage(message);
|
|
2425
|
-
setTimeout(() => setPoliteMessage(""), 100);
|
|
2426
|
-
}
|
|
2427
|
-
},
|
|
2428
|
-
[]
|
|
2429
|
-
);
|
|
2430
|
-
const [screenSize, setScreenSize] = useState("desktop");
|
|
2431
|
-
useEffect(() => {
|
|
2432
|
-
if (typeof window === "undefined") return;
|
|
2433
|
-
const handleResize = () => {
|
|
2434
|
-
const width = window.innerWidth;
|
|
2435
|
-
if (width < 640) {
|
|
2436
|
-
setScreenSize("mobile");
|
|
2437
|
-
} else if (width < 1024) {
|
|
2438
|
-
setScreenSize("tablet");
|
|
2439
|
-
} else {
|
|
2440
|
-
setScreenSize("desktop");
|
|
2441
|
-
}
|
|
2442
|
-
};
|
|
2443
|
-
handleResize();
|
|
2444
|
-
window.addEventListener("resize", handleResize);
|
|
2445
|
-
return () => window.removeEventListener("resize", handleResize);
|
|
2446
|
-
}, []);
|
|
2447
|
-
const getResponsiveSettings = useCallback(() => {
|
|
2448
|
-
if (!responsive) {
|
|
2449
|
-
return {
|
|
2450
|
-
maxCount,
|
|
2451
|
-
compactMode: false
|
|
2452
|
-
};
|
|
2453
|
-
}
|
|
2454
|
-
if (responsive === true) {
|
|
2455
|
-
const defaultResponsive = {
|
|
2456
|
-
mobile: { maxCount: 2, compactMode: true },
|
|
2457
|
-
tablet: { maxCount: 4, compactMode: false },
|
|
2458
|
-
desktop: { maxCount: 6, compactMode: false }
|
|
2459
|
-
};
|
|
2460
|
-
const currentSettings2 = defaultResponsive[screenSize];
|
|
2461
|
-
return {
|
|
2462
|
-
maxCount: currentSettings2?.maxCount ?? maxCount,
|
|
2463
|
-
compactMode: currentSettings2?.compactMode ?? false
|
|
2464
|
-
};
|
|
2465
|
-
}
|
|
2466
|
-
const currentSettings = responsive[screenSize];
|
|
2467
|
-
return {
|
|
2468
|
-
maxCount: currentSettings?.maxCount ?? maxCount,
|
|
2469
|
-
compactMode: currentSettings?.compactMode ?? false
|
|
2470
|
-
};
|
|
2471
|
-
}, [responsive, screenSize, maxCount]);
|
|
2472
|
-
const responsiveSettings = getResponsiveSettings();
|
|
2473
|
-
const filteredOptions = useMemo(() => {
|
|
2474
|
-
if (!searchValue.trim()) {
|
|
2475
|
-
return options;
|
|
2476
|
-
}
|
|
2477
|
-
const searchLower = searchValue.toLowerCase();
|
|
2478
|
-
return options.filter(
|
|
2479
|
-
(option) => option.label.toLowerCase().includes(searchLower) || String(option.value).toLowerCase().includes(searchLower)
|
|
2480
|
-
);
|
|
2481
|
-
}, [options, searchValue]);
|
|
2482
|
-
useEffect(() => {
|
|
2483
|
-
if (!open) {
|
|
2484
|
-
setSearchValue("");
|
|
2485
|
-
}
|
|
2486
|
-
}, [open]);
|
|
2487
|
-
useEffect(() => {
|
|
2488
|
-
if (open && searchInputRef.current) {
|
|
2489
|
-
setTimeout(() => {
|
|
2490
|
-
searchInputRef.current?.focus();
|
|
2491
|
-
}, 50);
|
|
2492
|
-
}
|
|
2493
|
-
}, [open]);
|
|
2494
|
-
useEffect(() => {
|
|
2495
|
-
if (!open) return;
|
|
2496
|
-
const handleClickOutside = (event) => {
|
|
2497
|
-
const target = event.target;
|
|
2498
|
-
if (containerRef.current && !containerRef.current.contains(target) && dropdownRef.current && !dropdownRef.current.contains(target)) {
|
|
2499
|
-
if (target.closest('[data-slot="dialog-content"]')) {
|
|
2500
|
-
return;
|
|
2501
|
-
}
|
|
2502
|
-
setOpen(false);
|
|
2503
|
-
}
|
|
2504
|
-
};
|
|
2505
|
-
const handleEscape = (event) => {
|
|
2506
|
-
if (event.key === "Escape" && open) {
|
|
2507
|
-
event.stopPropagation();
|
|
2508
|
-
setOpen(false);
|
|
2509
|
-
}
|
|
2510
|
-
};
|
|
2511
|
-
document.addEventListener("mousedown", handleClickOutside, true);
|
|
2512
|
-
document.addEventListener("keydown", handleEscape, true);
|
|
2513
|
-
return () => {
|
|
2514
|
-
document.removeEventListener("mousedown", handleClickOutside, true);
|
|
2515
|
-
document.removeEventListener("keydown", handleEscape, true);
|
|
2516
|
-
};
|
|
2517
|
-
}, [open]);
|
|
2518
|
-
useEffect(() => {
|
|
2519
|
-
const selectedCount = value.length;
|
|
2520
|
-
const totalOptions = options.filter((opt) => !opt.disabled).length;
|
|
2521
|
-
if (selectedCount !== prevSelectedCount.current) {
|
|
2522
|
-
const diff = selectedCount - prevSelectedCount.current;
|
|
2523
|
-
if (diff > 0) {
|
|
2524
|
-
announce(`${selectedCount} of ${totalOptions} options selected.`);
|
|
2525
|
-
} else if (diff < 0) {
|
|
2526
|
-
announce(
|
|
2527
|
-
`Option removed. ${selectedCount} of ${totalOptions} options selected.`
|
|
2528
|
-
);
|
|
2529
|
-
}
|
|
2530
|
-
prevSelectedCount.current = selectedCount;
|
|
2531
|
-
}
|
|
2532
|
-
}, [value, announce, options]);
|
|
2533
|
-
const updateValue = useCallback(
|
|
2534
|
-
(newValue) => {
|
|
2535
|
-
if (!isControlled) {
|
|
2536
|
-
setInternalValue(newValue);
|
|
2537
|
-
}
|
|
2538
|
-
onValueChange?.(newValue);
|
|
2539
|
-
},
|
|
2540
|
-
[isControlled, onValueChange]
|
|
2541
|
-
);
|
|
2542
|
-
const handleSelect = useCallback(
|
|
2543
|
-
(optionValue) => {
|
|
2544
|
-
const option = options.find((opt) => opt.value === optionValue);
|
|
2545
|
-
if (option?.disabled) {
|
|
2546
|
-
return;
|
|
2547
|
-
}
|
|
2548
|
-
const newValue = value.includes(optionValue) ? value.filter((v) => v !== optionValue) : [...value, optionValue];
|
|
2549
|
-
updateValue(newValue);
|
|
2550
|
-
},
|
|
2551
|
-
[value, options, updateValue]
|
|
2552
|
-
);
|
|
2553
|
-
const handleSelectAll = useCallback(() => {
|
|
2554
|
-
updateValue(
|
|
2555
|
-
filteredOptions.filter((opt) => !opt.disabled).map((opt) => opt.value)
|
|
2556
|
-
);
|
|
2557
|
-
}, [updateValue, filteredOptions]);
|
|
2558
|
-
const handleClearAll = useCallback(() => {
|
|
2559
|
-
updateValue([]);
|
|
2560
|
-
}, [updateValue]);
|
|
2561
|
-
const handleRemove = useCallback(
|
|
2562
|
-
(optionValue, e) => {
|
|
2563
|
-
e.stopPropagation();
|
|
2564
|
-
updateValue(value.filter((v) => v !== optionValue));
|
|
2565
|
-
},
|
|
2566
|
-
[updateValue, value]
|
|
2567
|
-
);
|
|
2568
|
-
const clearExtraOptions = useCallback(() => {
|
|
2569
|
-
const newSelectedValues = value.slice(0, responsiveSettings.maxCount);
|
|
2570
|
-
updateValue(newSelectedValues);
|
|
2571
|
-
}, [value, responsiveSettings.maxCount, updateValue]);
|
|
2572
|
-
React12.useImperativeHandle(
|
|
2573
|
-
ref,
|
|
2574
|
-
() => ({
|
|
2575
|
-
reset: () => {
|
|
2576
|
-
updateValue(defaultValue);
|
|
2577
|
-
setOpen(false);
|
|
2578
|
-
setSearchValue("");
|
|
2579
|
-
},
|
|
2580
|
-
getSelectedValues: () => value,
|
|
2581
|
-
setSelectedValues: (values) => {
|
|
2582
|
-
updateValue(values);
|
|
2583
|
-
},
|
|
2584
|
-
clear: () => {
|
|
2585
|
-
updateValue([]);
|
|
2586
|
-
},
|
|
2587
|
-
focus: () => {
|
|
2588
|
-
buttonRef.current?.focus();
|
|
2589
|
-
}
|
|
2590
|
-
}),
|
|
2591
|
-
[value, defaultValue, updateValue]
|
|
2592
|
-
);
|
|
2593
|
-
const selectedOptions = options.filter(
|
|
2594
|
-
(option) => value.includes(option.value)
|
|
2595
|
-
);
|
|
2596
|
-
const getBadgeColor = (index) => {
|
|
2597
|
-
const colors = [
|
|
2598
|
-
"bg-blue-100 text-blue-700 hover:bg-blue-200",
|
|
2599
|
-
"bg-green-100 text-green-700 hover:bg-green-200",
|
|
2600
|
-
"bg-purple-100 text-purple-700 hover:bg-purple-200",
|
|
2601
|
-
"bg-orange-100 text-orange-700 hover:bg-orange-200",
|
|
2602
|
-
"bg-pink-100 text-pink-700 hover:bg-pink-200",
|
|
2603
|
-
"bg-cyan-100 text-cyan-700 hover:bg-cyan-200"
|
|
2604
|
-
];
|
|
2605
|
-
return colors[index % colors.length];
|
|
2606
|
-
};
|
|
2607
|
-
return /* @__PURE__ */ jsxs("div", { ref: containerRef, className: "relative w-full", children: [
|
|
2608
|
-
/* @__PURE__ */ jsxs("div", { className: "sr-only", children: [
|
|
2609
|
-
/* @__PURE__ */ jsx("div", { "aria-live": "polite", "aria-atomic": "true", role: "status", children: politeMessage }),
|
|
2610
|
-
/* @__PURE__ */ jsx("div", { "aria-live": "assertive", "aria-atomic": "true", role: "alert", children: assertiveMessage })
|
|
2611
|
-
] }),
|
|
2612
|
-
/* @__PURE__ */ jsxs(
|
|
2613
|
-
Button,
|
|
2614
|
-
{
|
|
2615
|
-
ref: buttonRef,
|
|
2616
|
-
type: "button",
|
|
2617
|
-
variant: "outline",
|
|
2618
|
-
role: "combobox",
|
|
2619
|
-
"aria-expanded": open,
|
|
2620
|
-
disabled,
|
|
2621
|
-
className: cn(
|
|
2622
|
-
"w-full justify-between h-auto min-h-10 px-3 py-2",
|
|
2623
|
-
responsiveSettings.compactMode && "min-h-8 text-sm",
|
|
2624
|
-
className
|
|
2625
|
-
),
|
|
2626
|
-
id,
|
|
2627
|
-
onClick: (e) => {
|
|
2628
|
-
e.stopPropagation();
|
|
2629
|
-
setOpen(!open);
|
|
2630
|
-
},
|
|
2631
|
-
children: [
|
|
2632
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: selectedOptions.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2633
|
-
selectedOptions.slice(0, responsiveSettings.maxCount).map((option, index) => /* @__PURE__ */ jsxs(
|
|
2634
|
-
Badge,
|
|
2635
|
-
{
|
|
2636
|
-
className: cn(
|
|
2637
|
-
"mr-1 mb-1",
|
|
2638
|
-
getBadgeColor(index),
|
|
2639
|
-
responsiveSettings.compactMode && "text-xs px-1.5 py-0.5"
|
|
2640
|
-
),
|
|
2641
|
-
onClick: (e) => handleRemove(option.value, e),
|
|
2642
|
-
children: [
|
|
2643
|
-
option.icon && !responsiveSettings.compactMode && /* @__PURE__ */ jsx(option.icon, { className: "mr-2 h-4 w-4" }),
|
|
2644
|
-
option.label,
|
|
2645
|
-
/* @__PURE__ */ jsx(
|
|
2646
|
-
"div",
|
|
2647
|
-
{
|
|
2648
|
-
role: "button",
|
|
2649
|
-
tabIndex: 0,
|
|
2650
|
-
className: "ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer",
|
|
2651
|
-
onKeyDown: (e) => {
|
|
2652
|
-
if (e.key === "Enter") {
|
|
2653
|
-
handleRemove(option.value, e);
|
|
2654
|
-
}
|
|
2655
|
-
},
|
|
2656
|
-
onMouseDown: (e) => {
|
|
2657
|
-
e.preventDefault();
|
|
2658
|
-
e.stopPropagation();
|
|
2659
|
-
},
|
|
2660
|
-
onClick: (e) => handleRemove(option.value, e),
|
|
2661
|
-
children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3 text-muted-foreground hover:text-foreground" })
|
|
2662
|
-
}
|
|
2663
|
-
)
|
|
2664
|
-
]
|
|
2665
|
-
},
|
|
2666
|
-
String(option.value)
|
|
2667
|
-
)),
|
|
2668
|
-
value.length > responsiveSettings.maxCount && /* @__PURE__ */ jsxs(
|
|
2669
|
-
Badge,
|
|
2670
|
-
{
|
|
2671
|
-
className: cn(
|
|
2672
|
-
"mr-1 mb-1 bg-muted text-muted-foreground hover:bg-muted",
|
|
2673
|
-
responsiveSettings.compactMode && "text-xs px-1.5 py-0.5"
|
|
2674
|
-
),
|
|
2675
|
-
children: [
|
|
2676
|
-
"+",
|
|
2677
|
-
value.length - responsiveSettings.maxCount,
|
|
2678
|
-
" more",
|
|
2679
|
-
/* @__PURE__ */ jsx(
|
|
2680
|
-
"div",
|
|
2681
|
-
{
|
|
2682
|
-
role: "button",
|
|
2683
|
-
tabIndex: 0,
|
|
2684
|
-
className: "ml-1 ring-offset-background rounded-full outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 cursor-pointer",
|
|
2685
|
-
onClick: (e) => {
|
|
2686
|
-
e.stopPropagation();
|
|
2687
|
-
clearExtraOptions();
|
|
2688
|
-
},
|
|
2689
|
-
children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
|
|
2690
|
-
}
|
|
2691
|
-
)
|
|
2692
|
-
]
|
|
2693
|
-
}
|
|
2694
|
-
)
|
|
2695
|
-
] }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: placeholder }) }),
|
|
2696
|
-
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
2697
|
-
]
|
|
2698
|
-
}
|
|
2699
|
-
),
|
|
2700
|
-
open && /* @__PURE__ */ jsx(
|
|
2701
|
-
"div",
|
|
2702
|
-
{
|
|
2703
|
-
ref: dropdownRef,
|
|
2704
|
-
className: "absolute z-[100] mt-1 w-full rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
2705
|
-
style: {
|
|
2706
|
-
top: "100%",
|
|
2707
|
-
left: 0
|
|
2708
|
-
},
|
|
2709
|
-
children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
2710
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center border-b px-3 py-2", children: [
|
|
2711
|
-
/* @__PURE__ */ jsx(Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
2712
|
-
/* @__PURE__ */ jsx(
|
|
2713
|
-
Input,
|
|
2714
|
-
{
|
|
2715
|
-
ref: searchInputRef,
|
|
2716
|
-
placeholder: searchPlaceholder,
|
|
2717
|
-
value: searchValue,
|
|
2718
|
-
onChange: (e) => {
|
|
2719
|
-
e.stopPropagation();
|
|
2720
|
-
setSearchValue(e.target.value);
|
|
2721
|
-
},
|
|
2722
|
-
onKeyDown: (e) => {
|
|
2723
|
-
e.stopPropagation();
|
|
2724
|
-
if (e.key === "Escape") {
|
|
2725
|
-
e.preventDefault();
|
|
2726
|
-
setOpen(false);
|
|
2727
|
-
}
|
|
2728
|
-
},
|
|
2729
|
-
onClick: (e) => {
|
|
2730
|
-
e.stopPropagation();
|
|
2731
|
-
},
|
|
2732
|
-
onFocus: (e) => {
|
|
2733
|
-
e.stopPropagation();
|
|
2734
|
-
},
|
|
2735
|
-
className: "border-0 focus-visible:ring-0 focus-visible:ring-offset-0 h-9 bg-transparent px-0"
|
|
2736
|
-
}
|
|
2737
|
-
),
|
|
2738
|
-
searchValue && /* @__PURE__ */ jsx(
|
|
2739
|
-
Button,
|
|
2740
|
-
{
|
|
2741
|
-
type: "button",
|
|
2742
|
-
variant: "ghost",
|
|
2743
|
-
size: "sm",
|
|
2744
|
-
className: "h-6 w-6 p-0",
|
|
2745
|
-
onClick: (e) => {
|
|
2746
|
-
e.stopPropagation();
|
|
2747
|
-
setSearchValue("");
|
|
2748
|
-
searchInputRef.current?.focus();
|
|
2749
|
-
},
|
|
2750
|
-
children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
|
|
2751
|
-
}
|
|
2752
|
-
)
|
|
2753
|
-
] }),
|
|
2754
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-b p-1", children: [
|
|
2755
|
-
/* @__PURE__ */ jsx(
|
|
2756
|
-
Button,
|
|
2757
|
-
{
|
|
2758
|
-
type: "button",
|
|
2759
|
-
variant: "ghost",
|
|
2760
|
-
size: "sm",
|
|
2761
|
-
className: "h-8 px-2 text-xs",
|
|
2762
|
-
onClick: (e) => {
|
|
2763
|
-
e.stopPropagation();
|
|
2764
|
-
handleSelectAll();
|
|
2765
|
-
},
|
|
2766
|
-
children: "Select All"
|
|
2767
|
-
}
|
|
2768
|
-
),
|
|
2769
|
-
/* @__PURE__ */ jsx(
|
|
2770
|
-
Button,
|
|
2771
|
-
{
|
|
2772
|
-
type: "button",
|
|
2773
|
-
variant: "ghost",
|
|
2774
|
-
size: "sm",
|
|
2775
|
-
className: "h-8 px-2 text-xs",
|
|
2776
|
-
onClick: (e) => {
|
|
2777
|
-
e.stopPropagation();
|
|
2778
|
-
handleClearAll();
|
|
2779
|
-
},
|
|
2780
|
-
children: "Clear All"
|
|
2781
|
-
}
|
|
2782
|
-
)
|
|
2783
|
-
] }),
|
|
2784
|
-
/* @__PURE__ */ jsx(ScrollArea, { className: "max-h-[300px]", children: filteredOptions.length === 0 ? /* @__PURE__ */ jsx("div", { className: "py-6 text-center text-sm text-muted-foreground", children: emptyText }) : /* @__PURE__ */ jsx("div", { className: "p-1", children: filteredOptions.map((option) => {
|
|
2785
|
-
const isSelected = value.includes(option.value);
|
|
2786
|
-
const isDisabled = option.disabled || false;
|
|
2787
|
-
return /* @__PURE__ */ jsxs(
|
|
2788
|
-
"div",
|
|
2789
|
-
{
|
|
2790
|
-
role: "option",
|
|
2791
|
-
"aria-selected": isSelected,
|
|
2792
|
-
"aria-disabled": isDisabled,
|
|
2793
|
-
className: cn(
|
|
2794
|
-
"relative flex select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",
|
|
2795
|
-
isDisabled ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-accent hover:text-accent-foreground",
|
|
2796
|
-
isSelected && !isDisabled && "bg-accent text-accent-foreground"
|
|
2797
|
-
),
|
|
2798
|
-
onMouseDown: (e) => {
|
|
2799
|
-
e.preventDefault();
|
|
2800
|
-
e.stopPropagation();
|
|
2801
|
-
},
|
|
2802
|
-
onClick: (e) => {
|
|
2803
|
-
e.preventDefault();
|
|
2804
|
-
e.stopPropagation();
|
|
2805
|
-
if (!isDisabled) {
|
|
2806
|
-
handleSelect(option.value);
|
|
2807
|
-
}
|
|
2808
|
-
},
|
|
2809
|
-
children: [
|
|
2810
|
-
/* @__PURE__ */ jsx(
|
|
2811
|
-
"div",
|
|
2812
|
-
{
|
|
2813
|
-
className: cn(
|
|
2814
|
-
"mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",
|
|
2815
|
-
isSelected ? "bg-primary text-primary-foreground" : "opacity-50 [&_svg]:invisible"
|
|
2816
|
-
),
|
|
2817
|
-
children: /* @__PURE__ */ jsx(Check, { className: cn("h-4 w-4") })
|
|
2818
|
-
}
|
|
2819
|
-
),
|
|
2820
|
-
option.icon && /* @__PURE__ */ jsx(option.icon, { className: "mr-2 h-4 w-4 text-muted-foreground" }),
|
|
2821
|
-
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: option.label })
|
|
2822
|
-
]
|
|
2823
|
-
},
|
|
2824
|
-
String(option.value)
|
|
2825
|
-
);
|
|
2826
|
-
}) }) }),
|
|
2827
|
-
/* @__PURE__ */ jsx("div", { className: "border-t p-2", children: /* @__PURE__ */ jsx(
|
|
2828
|
-
Button,
|
|
2829
|
-
{
|
|
2830
|
-
type: "button",
|
|
2831
|
-
variant: "outline",
|
|
2832
|
-
size: "sm",
|
|
2833
|
-
className: "w-full h-8 text-xs",
|
|
2834
|
-
onClick: (e) => {
|
|
2835
|
-
e.stopPropagation();
|
|
2836
|
-
setOpen(false);
|
|
2837
|
-
},
|
|
2838
|
-
children: "Close"
|
|
2839
|
-
}
|
|
2840
|
-
) })
|
|
2841
|
-
] })
|
|
2842
|
-
}
|
|
2843
|
-
)
|
|
2844
|
-
] });
|
|
2845
|
-
}
|
|
2846
|
-
);
|
|
2847
|
-
MultiSelect.displayName = "MultiSelect";
|
|
2848
|
-
}
|
|
2849
|
-
});
|
|
2850
|
-
function DatePicker({
|
|
2851
|
-
value,
|
|
2852
|
-
onValueChange,
|
|
2853
|
-
formatStr = "yyyy-MM-dd",
|
|
2854
|
-
popoverContentClassName,
|
|
2855
|
-
popoverContentOptions,
|
|
2856
|
-
buttonClassName,
|
|
2857
|
-
buttonOptions,
|
|
2858
|
-
placeholder = "Pick date",
|
|
2859
|
-
...props
|
|
2860
|
-
}) {
|
|
2861
|
-
return /* @__PURE__ */ jsxs(Popover, { modal: true, children: [
|
|
2862
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
2863
|
-
Button,
|
|
2864
|
-
{
|
|
2865
|
-
variant: "outline",
|
|
2866
|
-
className: cn("w-full px-3 text-start font-normal", buttonClassName),
|
|
2867
|
-
...buttonOptions,
|
|
2868
|
-
children: [
|
|
2869
|
-
value ? /* @__PURE__ */ jsx("span", { children: format(value, formatStr) }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: placeholder }),
|
|
2870
|
-
/* @__PURE__ */ jsx(CalendarIcon, { className: "shrink-0 h-4 w-4 ms-auto text-muted-foreground" })
|
|
2871
|
-
]
|
|
2872
|
-
}
|
|
2873
|
-
) }),
|
|
2874
|
-
/* @__PURE__ */ jsx(
|
|
2875
|
-
PopoverContent,
|
|
2876
|
-
{
|
|
2877
|
-
className: cn("w-auto p-0", popoverContentClassName),
|
|
2878
|
-
align: "start",
|
|
2879
|
-
...popoverContentOptions,
|
|
2880
|
-
children: /* @__PURE__ */ jsx(
|
|
2881
|
-
Calendar,
|
|
2882
|
-
{
|
|
2883
|
-
mode: "single",
|
|
2884
|
-
selected: value,
|
|
2885
|
-
onSelect: onValueChange,
|
|
2886
|
-
...props
|
|
2887
|
-
}
|
|
2888
|
-
)
|
|
2889
|
-
}
|
|
2890
|
-
)
|
|
2891
|
-
] });
|
|
2892
|
-
}
|
|
2893
|
-
var init_date_picker = __esm({
|
|
2894
|
-
"src/ui/forms/date-picker.tsx"() {
|
|
2895
|
-
"use client";
|
|
2896
|
-
init_utils();
|
|
2897
|
-
init_primitives();
|
|
2898
|
-
init_client();
|
|
2899
|
-
}
|
|
2900
|
-
});
|
|
2901
|
-
function DateRangePicker({
|
|
2902
|
-
value,
|
|
2903
|
-
onValueChange,
|
|
2904
|
-
formatStr = "yyyy-MM-dd",
|
|
2905
|
-
popoverContentClassName,
|
|
2906
|
-
popoverContentOptions,
|
|
2907
|
-
buttonClassName,
|
|
2908
|
-
buttonOptions,
|
|
2909
|
-
placeholder = "Pick date",
|
|
2910
|
-
...props
|
|
2911
|
-
}) {
|
|
2912
|
-
return /* @__PURE__ */ jsxs(Popover, { modal: true, children: [
|
|
2913
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
2914
|
-
Button,
|
|
2915
|
-
{
|
|
2916
|
-
variant: "outline",
|
|
2917
|
-
className: cn("w-full px-3 text-start font-normal", buttonClassName),
|
|
2918
|
-
...buttonOptions,
|
|
2919
|
-
children: [
|
|
2920
|
-
value?.from ? value.to ? /* @__PURE__ */ jsxs("span", { children: [
|
|
2921
|
-
format(value.from, formatStr),
|
|
2922
|
-
" to ",
|
|
2923
|
-
format(value.to, formatStr)
|
|
2924
|
-
] }) : /* @__PURE__ */ jsx("span", { children: format(value.from, formatStr) }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: placeholder }),
|
|
2925
|
-
/* @__PURE__ */ jsx(CalendarIcon, { className: "ms-auto h-4 w-4 text-muted-foreground" })
|
|
2926
|
-
]
|
|
2927
|
-
}
|
|
2928
|
-
) }),
|
|
2929
|
-
/* @__PURE__ */ jsx(
|
|
2930
|
-
PopoverContent,
|
|
2931
|
-
{
|
|
2932
|
-
className: cn("w-auto p-0", popoverContentClassName),
|
|
2933
|
-
align: "start",
|
|
2934
|
-
...popoverContentOptions,
|
|
2935
|
-
children: /* @__PURE__ */ jsx(
|
|
2936
|
-
Calendar,
|
|
2937
|
-
{
|
|
2938
|
-
mode: "range",
|
|
2939
|
-
selected: value,
|
|
2940
|
-
onSelect: onValueChange,
|
|
2941
|
-
...props
|
|
2942
|
-
}
|
|
2943
|
-
)
|
|
2944
|
-
}
|
|
2945
|
-
)
|
|
2946
|
-
] });
|
|
2947
|
-
}
|
|
2948
|
-
var init_date_range_picker = __esm({
|
|
2949
|
-
"src/ui/forms/date-range-picker.tsx"() {
|
|
2950
|
-
"use client";
|
|
2951
|
-
init_utils();
|
|
2952
|
-
init_primitives();
|
|
2953
|
-
init_client();
|
|
2954
|
-
init_client();
|
|
2955
|
-
}
|
|
2956
|
-
});
|
|
2957
|
-
function InputTime({
|
|
2958
|
-
className,
|
|
2959
|
-
onValueChange,
|
|
2960
|
-
...props
|
|
2961
|
-
}) {
|
|
2962
|
-
const [isEmpty, setIsEmpty] = useState(!props.defaultValue && !props.value);
|
|
2963
|
-
const handleChange = (e) => {
|
|
2964
|
-
const value = e.target.value;
|
|
2965
|
-
setIsEmpty(!value);
|
|
2966
|
-
onValueChange?.(value);
|
|
2967
|
-
};
|
|
2968
|
-
return /* @__PURE__ */ jsx(
|
|
2969
|
-
Input,
|
|
2970
|
-
{
|
|
2971
|
-
"data-slot": "input-time",
|
|
2972
|
-
className: cn(
|
|
2973
|
-
"block [&::-webkit-calendar-picker-indicator]:hidden rtl:text-right",
|
|
2974
|
-
isEmpty && "text-muted-foreground",
|
|
2975
|
-
className
|
|
2976
|
-
),
|
|
2977
|
-
...props,
|
|
2978
|
-
type: "time",
|
|
2979
|
-
onChange: handleChange
|
|
2980
|
-
}
|
|
2981
|
-
);
|
|
2982
|
-
}
|
|
2983
|
-
var init_input_time = __esm({
|
|
2984
|
-
"src/ui/forms/input-time.tsx"() {
|
|
2985
|
-
"use client";
|
|
2986
|
-
init_utils();
|
|
2987
|
-
init_primitives();
|
|
2988
|
-
}
|
|
2989
|
-
});
|
|
2990
|
-
function DateTimePicker({
|
|
2991
|
-
value,
|
|
2992
|
-
onValueChange,
|
|
2993
|
-
formatStr = "yyyy-MM-dd p",
|
|
2994
|
-
popoverContentClassName,
|
|
2995
|
-
popoverContentOptions,
|
|
2996
|
-
buttonClassName,
|
|
2997
|
-
buttonOptions,
|
|
2998
|
-
placeholder = "Pick date and time",
|
|
2999
|
-
...props
|
|
3000
|
-
}) {
|
|
3001
|
-
const [selectedDate, setSelectedDate] = useState(value);
|
|
3002
|
-
const handleDateSelect = (selected) => {
|
|
3003
|
-
if (!selected) return;
|
|
3004
|
-
const newDateTime = new Date(selected);
|
|
3005
|
-
if (selectedDate) {
|
|
3006
|
-
newDateTime.setHours(selectedDate.getHours());
|
|
3007
|
-
newDateTime.setMinutes(selectedDate.getMinutes());
|
|
3008
|
-
}
|
|
3009
|
-
setSelectedDate(newDateTime);
|
|
3010
|
-
onValueChange?.(newDateTime);
|
|
3011
|
-
};
|
|
3012
|
-
const handleTimeChange = (timeString) => {
|
|
3013
|
-
if (!timeString) return;
|
|
3014
|
-
const [hours, minutes] = timeString.split(":").map(Number);
|
|
3015
|
-
if (selectedDate) {
|
|
3016
|
-
const newDateTime = new Date(selectedDate);
|
|
3017
|
-
newDateTime.setHours(hours);
|
|
3018
|
-
newDateTime.setMinutes(minutes);
|
|
3019
|
-
setSelectedDate(newDateTime);
|
|
3020
|
-
onValueChange?.(newDateTime);
|
|
3021
|
-
}
|
|
3022
|
-
};
|
|
3023
|
-
return /* @__PURE__ */ jsxs(Popover, { modal: true, children: [
|
|
3024
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
3025
|
-
Button,
|
|
3026
|
-
{
|
|
3027
|
-
variant: "outline",
|
|
3028
|
-
className: cn("w-full px-3 text-start font-normal", buttonClassName),
|
|
3029
|
-
...buttonOptions,
|
|
3030
|
-
children: [
|
|
3031
|
-
selectedDate ? /* @__PURE__ */ jsx("span", { children: format(selectedDate, formatStr) }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: placeholder }),
|
|
3032
|
-
/* @__PURE__ */ jsx(CalendarIcon, { className: "ms-auto h-4 w-4 text-muted-foreground" })
|
|
3033
|
-
]
|
|
3034
|
-
}
|
|
3035
|
-
) }),
|
|
3036
|
-
/* @__PURE__ */ jsxs(
|
|
3037
|
-
PopoverContent,
|
|
3038
|
-
{
|
|
3039
|
-
className: cn("w-auto p-0", popoverContentClassName),
|
|
3040
|
-
align: "start",
|
|
3041
|
-
...popoverContentOptions,
|
|
3042
|
-
children: [
|
|
3043
|
-
/* @__PURE__ */ jsx(
|
|
3044
|
-
Calendar,
|
|
3045
|
-
{
|
|
3046
|
-
mode: "single",
|
|
3047
|
-
selected: selectedDate,
|
|
3048
|
-
onSelect: handleDateSelect,
|
|
3049
|
-
...props
|
|
3050
|
-
}
|
|
3051
|
-
),
|
|
3052
|
-
/* @__PURE__ */ jsx(Separator3, {}),
|
|
3053
|
-
/* @__PURE__ */ jsx(
|
|
3054
|
-
InputTime,
|
|
3055
|
-
{
|
|
3056
|
-
className: "rounded-t-none border-0",
|
|
3057
|
-
onValueChange: handleTimeChange,
|
|
3058
|
-
value: selectedDate ? format(selectedDate, "p") : void 0
|
|
3059
|
-
}
|
|
3060
|
-
)
|
|
3061
|
-
]
|
|
3062
|
-
}
|
|
3063
|
-
)
|
|
3064
|
-
] });
|
|
3065
|
-
}
|
|
3066
|
-
var init_date_time_picker = __esm({
|
|
3067
|
-
"src/ui/forms/date-time-picker.tsx"() {
|
|
3068
|
-
"use client";
|
|
3069
|
-
init_utils();
|
|
3070
|
-
init_primitives();
|
|
3071
|
-
init_client();
|
|
3072
|
-
init_input_time();
|
|
3073
|
-
init_client();
|
|
3074
|
-
init_primitives();
|
|
3075
|
-
}
|
|
3076
|
-
});
|
|
3077
|
-
function EmojiPicker({
|
|
3078
|
-
popoverContentClassName,
|
|
3079
|
-
popoverContentOptions,
|
|
3080
|
-
buttonClassName,
|
|
3081
|
-
buttonOptions,
|
|
3082
|
-
...props
|
|
3083
|
-
}) {
|
|
3084
|
-
const isDarkMode = useIsDarkMode();
|
|
3085
|
-
const theme = isDarkMode ? Theme.DARK : Theme.LIGHT;
|
|
3086
|
-
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
3087
|
-
/* @__PURE__ */ jsx(
|
|
3088
|
-
PopoverTrigger,
|
|
3089
|
-
{
|
|
3090
|
-
className: cn(
|
|
3091
|
-
buttonVariants({ variant: "ghost", size: "icon" }),
|
|
3092
|
-
buttonClassName
|
|
3093
|
-
),
|
|
3094
|
-
...buttonOptions,
|
|
3095
|
-
"aria-label": "Emoji",
|
|
3096
|
-
children: /* @__PURE__ */ jsx(Smile, { className: "h-4 w-4" })
|
|
3097
|
-
}
|
|
3098
|
-
),
|
|
3099
|
-
/* @__PURE__ */ jsx(
|
|
3100
|
-
PopoverContent,
|
|
3101
|
-
{
|
|
3102
|
-
className: cn("w-auto p-0", popoverContentClassName),
|
|
3103
|
-
align: "start",
|
|
3104
|
-
...popoverContentOptions,
|
|
3105
|
-
children: /* @__PURE__ */ jsx(Picker, { theme, searchPlaceholder: "Search...", ...props })
|
|
3106
|
-
}
|
|
3107
|
-
)
|
|
3108
|
-
] });
|
|
3109
|
-
}
|
|
3110
|
-
function ReactionPicker({
|
|
3111
|
-
popoverContentClassName,
|
|
3112
|
-
popoverContentOptions,
|
|
3113
|
-
buttonClassName,
|
|
3114
|
-
buttonOptions,
|
|
3115
|
-
...props
|
|
3116
|
-
}) {
|
|
3117
|
-
const isDarkMode = useIsDarkMode();
|
|
3118
|
-
const theme = isDarkMode ? Theme.DARK : Theme.LIGHT;
|
|
3119
|
-
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
3120
|
-
/* @__PURE__ */ jsx(
|
|
3121
|
-
PopoverTrigger,
|
|
3122
|
-
{
|
|
3123
|
-
className: cn(
|
|
3124
|
-
buttonVariants({ variant: "ghost", size: "icon" }),
|
|
3125
|
-
buttonClassName
|
|
3126
|
-
),
|
|
3127
|
-
...buttonOptions,
|
|
3128
|
-
"aria-label": "Emoji",
|
|
3129
|
-
children: /* @__PURE__ */ jsx(Smile, { className: "h-4 w-4" })
|
|
3130
|
-
}
|
|
3131
|
-
),
|
|
3132
|
-
/* @__PURE__ */ jsx(
|
|
3133
|
-
PopoverContent,
|
|
3134
|
-
{
|
|
3135
|
-
className: cn("w-auto p-0", popoverContentClassName),
|
|
3136
|
-
align: "start",
|
|
3137
|
-
...popoverContentOptions,
|
|
3138
|
-
children: /* @__PURE__ */ jsx(
|
|
3139
|
-
Picker,
|
|
3140
|
-
{
|
|
3141
|
-
theme,
|
|
3142
|
-
searchPlaceholder: "Search...",
|
|
3143
|
-
lazyLoadEmojis: true,
|
|
3144
|
-
allowExpandReactions: false,
|
|
3145
|
-
...props,
|
|
3146
|
-
reactionsDefaultOpen: true
|
|
3147
|
-
}
|
|
3148
|
-
)
|
|
3149
|
-
}
|
|
3150
|
-
)
|
|
3151
|
-
] });
|
|
3152
|
-
}
|
|
3153
|
-
var Picker;
|
|
3154
|
-
var init_emoji_picker = __esm({
|
|
3155
|
-
"src/ui/forms/emoji-picker.tsx"() {
|
|
3156
|
-
"use client";
|
|
3157
|
-
init_utils();
|
|
3158
|
-
init_hooks();
|
|
3159
|
-
init_primitives();
|
|
3160
|
-
init_client();
|
|
3161
|
-
Picker = dynamic(
|
|
3162
|
-
() => {
|
|
3163
|
-
return import('emoji-picker-react');
|
|
3164
|
-
},
|
|
3165
|
-
{ ssr: false }
|
|
3166
|
-
);
|
|
3167
|
-
}
|
|
3168
|
-
});
|
|
3169
|
-
function FileThumbnail({ fileName, className }) {
|
|
3170
|
-
const fileExtension = fileName.slice(fileName.lastIndexOf(".") + 1).toUpperCase();
|
|
3171
|
-
return /* @__PURE__ */ jsxs("div", { className: cn("relative size-8 text-[6px] font-black", className), children: [
|
|
3172
|
-
/* @__PURE__ */ jsx(FileIcon, { className: "size-full stroke-1", "aria-labelledby": "file-name" }),
|
|
3173
|
-
/* @__PURE__ */ jsxs(
|
|
3174
|
-
"div",
|
|
3175
|
-
{
|
|
3176
|
-
className: "absolute inset-0 flex justify-center items-center",
|
|
3177
|
-
id: "file-name",
|
|
3178
|
-
"aria-hidden": true,
|
|
3179
|
-
children: [
|
|
3180
|
-
/* @__PURE__ */ jsx("span", { className: "select-none", children: fileExtension }),
|
|
3181
|
-
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "File" })
|
|
3182
|
-
]
|
|
3183
|
-
}
|
|
3184
|
-
)
|
|
3185
|
-
] });
|
|
3186
|
-
}
|
|
3187
|
-
var init_file_thumbnail = __esm({
|
|
3188
|
-
"src/ui/forms/file-thumbnail.tsx"() {
|
|
3189
|
-
init_utils();
|
|
3190
|
-
}
|
|
3191
|
-
});
|
|
3192
|
-
function FileDropzone({
|
|
3193
|
-
className,
|
|
3194
|
-
value,
|
|
3195
|
-
onFilesChange,
|
|
3196
|
-
...props
|
|
3197
|
-
}) {
|
|
3198
|
-
const [files, setFiles] = useState(value || []);
|
|
3199
|
-
const [loadingFiles, setLoadingFiles] = useState(/* @__PURE__ */ new Set());
|
|
3200
|
-
const maxFiles = props.multiple ? props.maxFiles : 1;
|
|
3201
|
-
const isDisabled = maxFiles === files.length;
|
|
3202
|
-
const onDrop = useCallback(
|
|
3203
|
-
async (acceptedFiles) => {
|
|
3204
|
-
const newFiles = acceptedFiles.map((file) => ({
|
|
3205
|
-
id: crypto.randomUUID(),
|
|
3206
|
-
name: file.name,
|
|
3207
|
-
size: file.size,
|
|
3208
|
-
type: file.type,
|
|
3209
|
-
url: URL.createObjectURL(file)
|
|
3210
|
-
}));
|
|
3211
|
-
const updatedFiles = [...files, ...newFiles];
|
|
3212
|
-
setFiles(updatedFiles);
|
|
3213
|
-
onFilesChange?.(updatedFiles);
|
|
3214
|
-
setLoadingFiles(new Set(newFiles.map((file) => file.id)));
|
|
3215
|
-
for (const file of newFiles) {
|
|
3216
|
-
await wait(2e3);
|
|
3217
|
-
setLoadingFiles((prev) => {
|
|
3218
|
-
const newLoadingFiles = new Set(prev);
|
|
3219
|
-
newLoadingFiles.delete(file.id);
|
|
3220
|
-
return newLoadingFiles;
|
|
3221
|
-
});
|
|
3222
|
-
}
|
|
3223
|
-
},
|
|
3224
|
-
[files, onFilesChange]
|
|
3225
|
-
);
|
|
3226
|
-
useEffect(() => {
|
|
3227
|
-
if (value) {
|
|
3228
|
-
setFiles(value);
|
|
3229
|
-
}
|
|
3230
|
-
}, [value]);
|
|
3231
|
-
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
3232
|
-
onDrop,
|
|
3233
|
-
disabled: isDisabled,
|
|
3234
|
-
...props,
|
|
3235
|
-
maxFiles
|
|
3236
|
-
});
|
|
3237
|
-
const removeFile = (fileId) => {
|
|
3238
|
-
const updatedFiles = files.filter((file) => {
|
|
3239
|
-
if (file.id === fileId) {
|
|
3240
|
-
URL.revokeObjectURL(file.url);
|
|
3241
|
-
return false;
|
|
3242
|
-
}
|
|
3243
|
-
return true;
|
|
3244
|
-
});
|
|
3245
|
-
setFiles(updatedFiles);
|
|
3246
|
-
onFilesChange?.(updatedFiles);
|
|
3247
|
-
};
|
|
3248
|
-
return /* @__PURE__ */ jsxs(
|
|
3249
|
-
"div",
|
|
3250
|
-
{
|
|
3251
|
-
"data-slot": "file-dropzone",
|
|
3252
|
-
...(() => {
|
|
3253
|
-
const { popover, ...rest } = getRootProps();
|
|
3254
|
-
return rest;
|
|
3255
|
-
})(),
|
|
3256
|
-
className: cn(
|
|
3257
|
-
"h-[17.75rem] w-full relative flex rounded-lg border-2 border-dashed border-muted-foreground cursor-pointer transition-colors hover:border-primary hover:bg-muted/50",
|
|
3258
|
-
isDragActive && "border-primary bg-muted/50",
|
|
3259
|
-
isDisabled && "cursor-not-allowed",
|
|
3260
|
-
className
|
|
3261
|
-
),
|
|
3262
|
-
children: [
|
|
3263
|
-
/* @__PURE__ */ jsx(
|
|
3264
|
-
"input",
|
|
3265
|
-
{
|
|
3266
|
-
...(() => {
|
|
3267
|
-
const { popover, ...rest } = getInputProps();
|
|
3268
|
-
return rest;
|
|
3269
|
-
})()
|
|
3270
|
-
}
|
|
3271
|
-
),
|
|
3272
|
-
/* @__PURE__ */ jsx(ScrollArea, { className: "w-0 flex-1 p-6", children: files.length > 0 ? /* @__PURE__ */ jsx("div", { className: "grid gap-4 grid-cols-2", children: files.map((file) => /* @__PURE__ */ jsxs(
|
|
3273
|
-
"div",
|
|
3274
|
-
{
|
|
3275
|
-
className: "relative flex flex-col gap-2 rounded-lg border bg-background p-2 cursor-auto",
|
|
3276
|
-
children: [
|
|
3277
|
-
file.type.startsWith("image/") ? /* @__PURE__ */ jsx(
|
|
3278
|
-
Image,
|
|
3279
|
-
{
|
|
3280
|
-
src: file.url,
|
|
3281
|
-
alt: file.name,
|
|
3282
|
-
width: 165,
|
|
3283
|
-
height: 165,
|
|
3284
|
-
className: "self-center aspect-square rounded object-contain pointer-events-none"
|
|
3285
|
-
}
|
|
3286
|
-
) : /* @__PURE__ */ jsx(
|
|
3287
|
-
FileThumbnail,
|
|
3288
|
-
{
|
|
3289
|
-
fileName: file.name,
|
|
3290
|
-
className: "self-center aspect-square size-full text-sm"
|
|
3291
|
-
}
|
|
3292
|
-
),
|
|
3293
|
-
loadingFiles.has(file.id) && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex items-center justify-center bg-background/50 rounded", children: /* @__PURE__ */ jsx(Loader2, { className: "h-8 w-8 text-primary animate-spin" }) }),
|
|
3294
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
3295
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium truncate", children: file.name }),
|
|
3296
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground font-semibold", children: formatFileSize(file.size) })
|
|
3297
|
-
] }),
|
|
3298
|
-
/* @__PURE__ */ jsx(
|
|
3299
|
-
Button,
|
|
3300
|
-
{
|
|
3301
|
-
variant: "secondary",
|
|
3302
|
-
size: "icon",
|
|
3303
|
-
className: "absolute end-1 top-1 h-4 w-4",
|
|
3304
|
-
onClick: (e) => {
|
|
3305
|
-
e.stopPropagation();
|
|
3306
|
-
removeFile(file.id);
|
|
3307
|
-
},
|
|
3308
|
-
"aria-label": "Remove",
|
|
3309
|
-
children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
|
|
3310
|
-
}
|
|
3311
|
-
)
|
|
3312
|
-
]
|
|
3313
|
-
},
|
|
3314
|
-
file.id
|
|
3315
|
-
)) }) : /* @__PURE__ */ jsxs("div", { className: "h-56 flex flex-col justify-center items-center gap-2 text-center p-4", children: [
|
|
3316
|
-
/* @__PURE__ */ jsx(UploadCloud, { className: "h-8 w-8 text-muted-foreground" }),
|
|
3317
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Drag and drop some files here, or click to select files" })
|
|
3318
|
-
] }) })
|
|
3319
|
-
]
|
|
3320
|
-
}
|
|
3321
|
-
);
|
|
3322
|
-
}
|
|
3323
|
-
var init_file_dropzone = __esm({
|
|
3324
|
-
"src/ui/forms/file-dropzone.tsx"() {
|
|
3325
|
-
"use client";
|
|
3326
|
-
init_utils();
|
|
3327
|
-
init_primitives();
|
|
3328
|
-
init_file_thumbnail();
|
|
3329
|
-
init_client();
|
|
3330
|
-
}
|
|
3331
|
-
});
|
|
3332
|
-
function InputFile({
|
|
3333
|
-
className,
|
|
3334
|
-
containerClassName,
|
|
3335
|
-
buttonVariant,
|
|
3336
|
-
buttonLabel,
|
|
3337
|
-
placeholder = "No file chosen",
|
|
3338
|
-
value,
|
|
3339
|
-
onValueChange,
|
|
3340
|
-
...props
|
|
3341
|
-
}) {
|
|
3342
|
-
const [fileName, setFileName] = useState(placeholder);
|
|
3343
|
-
const inputRef = useRef(null);
|
|
3344
|
-
useImperativeHandle(props.ref, () => inputRef.current);
|
|
3345
|
-
const handleFileChange = (event) => {
|
|
3346
|
-
const files = event.target.files;
|
|
3347
|
-
if (files) {
|
|
3348
|
-
if (files.length > 1) {
|
|
3349
|
-
setFileName(`${files.length} Files`);
|
|
3350
|
-
} else if (files.length === 1) {
|
|
3351
|
-
setFileName(files[0].name);
|
|
3352
|
-
} else {
|
|
3353
|
-
setFileName(placeholder);
|
|
3354
|
-
}
|
|
3355
|
-
onValueChange?.(files);
|
|
3356
|
-
}
|
|
3357
|
-
};
|
|
3358
|
-
const handleClick = () => {
|
|
3359
|
-
inputRef.current?.click();
|
|
3360
|
-
};
|
|
3361
|
-
useEffect(() => {
|
|
3362
|
-
if (value) {
|
|
3363
|
-
if (value.length > 1) {
|
|
3364
|
-
setFileName(`${value.length} Files`);
|
|
3365
|
-
} else {
|
|
3366
|
-
setFileName(value[0].name);
|
|
3367
|
-
}
|
|
3368
|
-
} else {
|
|
3369
|
-
setFileName(placeholder);
|
|
3370
|
-
}
|
|
3371
|
-
}, [value, placeholder]);
|
|
3372
|
-
return /* @__PURE__ */ jsxs(
|
|
3373
|
-
"div",
|
|
3374
|
-
{
|
|
3375
|
-
"data-slot": "input-file",
|
|
3376
|
-
className: cn(
|
|
3377
|
-
"h-9 w-full flex rounded-md border border-input bg-transparent text-sm transition-colors",
|
|
3378
|
-
props.disabled && "cursor-not-allowed opacity-50",
|
|
3379
|
-
containerClassName
|
|
3380
|
-
),
|
|
3381
|
-
children: [
|
|
3382
|
-
/* @__PURE__ */ jsx(
|
|
3383
|
-
Button,
|
|
3384
|
-
{
|
|
3385
|
-
type: "button",
|
|
3386
|
-
variant: buttonVariant,
|
|
3387
|
-
className: "h-full w-28 rounded-e-none border-0 border-e border-input",
|
|
3388
|
-
onClick: handleClick,
|
|
3389
|
-
disabled: props.disabled,
|
|
3390
|
-
children: buttonLabel ?? `Choose File${props.multiple ? "s" : ""}`
|
|
3391
|
-
}
|
|
3392
|
-
),
|
|
3393
|
-
/* @__PURE__ */ jsx("div", { className: "flex-1 flex items-center text-muted-foreground px-3 break-all", children: /* @__PURE__ */ jsx("span", { className: "w-0 flex-1 truncate", children: fileName }) }),
|
|
3394
|
-
/* @__PURE__ */ jsx(
|
|
3395
|
-
"input",
|
|
3396
|
-
{
|
|
3397
|
-
...props,
|
|
3398
|
-
ref: inputRef,
|
|
3399
|
-
type: "file",
|
|
3400
|
-
className: cn("hidden", className),
|
|
3401
|
-
onChange: handleFileChange
|
|
3402
|
-
}
|
|
3403
|
-
)
|
|
3404
|
-
]
|
|
3405
|
-
}
|
|
3406
|
-
);
|
|
3407
|
-
}
|
|
3408
|
-
var init_input_file = __esm({
|
|
3409
|
-
"src/ui/forms/input-file.tsx"() {
|
|
3410
|
-
"use client";
|
|
3411
|
-
init_utils();
|
|
3412
|
-
init_primitives();
|
|
3413
|
-
}
|
|
3414
|
-
});
|
|
3415
|
-
function InputGroup({ className, children, ...props }) {
|
|
3416
|
-
return /* @__PURE__ */ jsx(
|
|
3417
|
-
"div",
|
|
3418
|
-
{
|
|
3419
|
-
"data-slot": "input-group",
|
|
3420
|
-
className: cn(
|
|
3421
|
-
"flex min-h-9 w-full rounded-md border border-input bg-transparent text-sm transition-colors [&>*:not(.input-group-text)]:border-0 [&>input]:z-10 [&>input]:first:rounded-e-none [&>input]:last:rounded-s-none [&>input:not(:first-child):not(:last-child)]:rounded-none [&>textarea]:z-10 [&>textarea]:first:rounded-e-none [&>textarea]:last:rounded-s-none [&>textarea:not(:first-child):not(:last-child)]:rounded-none [&>button]:first:rounded-e-none [&>button]:last:rounded-s-none [&>button]:[&:not(:first-child):not(:last-child)]:rounded-none",
|
|
3422
|
-
className
|
|
3423
|
-
),
|
|
3424
|
-
...props,
|
|
3425
|
-
children
|
|
3426
|
-
}
|
|
3427
|
-
);
|
|
3428
|
-
}
|
|
3429
|
-
function InputGroupText({
|
|
3430
|
-
className,
|
|
3431
|
-
merged = false,
|
|
3432
|
-
...props
|
|
3433
|
-
}) {
|
|
3434
|
-
return /* @__PURE__ */ jsx(
|
|
3435
|
-
"div",
|
|
3436
|
-
{
|
|
3437
|
-
"data-slot": "input-group-text",
|
|
3438
|
-
className: cn(
|
|
3439
|
-
"input-group-text",
|
|
3440
|
-
"flex items-center justify-center border-input px-3 py-1 text-sm text-muted-foreground",
|
|
3441
|
-
!merged && "first:rounded-s-md last:rounded-e-md first:border-e last:border-s [&:not(:first-child):not(:last-child)]:border-x",
|
|
3442
|
-
className
|
|
3443
|
-
),
|
|
3444
|
-
...props
|
|
3445
|
-
}
|
|
3446
|
-
);
|
|
3447
|
-
}
|
|
3448
|
-
var init_input_group = __esm({
|
|
3449
|
-
"src/ui/forms/input-group.tsx"() {
|
|
3450
|
-
"use client";
|
|
3451
|
-
init_utils();
|
|
3452
|
-
}
|
|
3453
|
-
});
|
|
3454
|
-
function InputOTP({
|
|
3455
|
-
className,
|
|
3456
|
-
containerClassName,
|
|
3457
|
-
...props
|
|
3458
|
-
}) {
|
|
3459
|
-
return /* @__PURE__ */ jsx(
|
|
3460
|
-
OTPInput,
|
|
3461
|
-
{
|
|
3462
|
-
"data-slot": "input-otp",
|
|
3463
|
-
containerClassName: cn(
|
|
3464
|
-
"flex items-center gap-2 has-disabled:opacity-50",
|
|
3465
|
-
containerClassName
|
|
3466
|
-
),
|
|
3467
|
-
className: cn("disabled:cursor-not-allowed", className),
|
|
3468
|
-
...props
|
|
3469
|
-
}
|
|
3470
|
-
);
|
|
3471
|
-
}
|
|
3472
|
-
function InputOTPGroup({ className, ...props }) {
|
|
3473
|
-
return /* @__PURE__ */ jsx(
|
|
3474
|
-
"div",
|
|
3475
|
-
{
|
|
3476
|
-
"data-slot": "input-otp-group",
|
|
3477
|
-
className: cn("flex items-center", className),
|
|
3478
|
-
...props
|
|
3479
|
-
}
|
|
3480
|
-
);
|
|
3481
|
-
}
|
|
3482
|
-
function InputOTPSlot({
|
|
3483
|
-
index,
|
|
3484
|
-
className,
|
|
3485
|
-
...props
|
|
3486
|
-
}) {
|
|
3487
|
-
const inputOTPContext = useContext(OTPInputContext);
|
|
3488
|
-
const { char, hasFakeCaret, isActive } = inputOTPContext.slots[index];
|
|
3489
|
-
return /* @__PURE__ */ jsxs(
|
|
3490
|
-
"div",
|
|
3491
|
-
{
|
|
3492
|
-
"data-slot": "input-otp-slot",
|
|
3493
|
-
className: cn(
|
|
3494
|
-
"relative flex h-9 w-9 items-center justify-center border-y border-e border-input text-sm transition-all first:rounded-s-md first:border-s last:rounded-e-md",
|
|
3495
|
-
isActive && "z-10 ring-1 ring-ring",
|
|
3496
|
-
className
|
|
3497
|
-
),
|
|
3498
|
-
...props,
|
|
3499
|
-
children: [
|
|
3500
|
-
char,
|
|
3501
|
-
hasFakeCaret && /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "h-4 w-px animate-caret-blink bg-foreground duration-1000" }) })
|
|
3502
|
-
]
|
|
3503
|
-
}
|
|
3504
|
-
);
|
|
3505
|
-
}
|
|
3506
|
-
function InputOTPSeparator({ ...props }) {
|
|
3507
|
-
return /* @__PURE__ */ jsx("div", { "data-slot": "input-otp-separator", role: "separator", ...props, children: /* @__PURE__ */ jsx(Minus, {}) });
|
|
3508
|
-
}
|
|
3509
|
-
var init_input_otp = __esm({
|
|
3510
|
-
"src/ui/forms/input-otp.tsx"() {
|
|
3511
|
-
"use client";
|
|
3512
|
-
init_utils();
|
|
3513
|
-
}
|
|
3514
|
-
});
|
|
3515
|
-
function InputPhone({ className, onChange, ...props }) {
|
|
3516
|
-
const direction = useDirection();
|
|
3517
|
-
return /* @__PURE__ */ jsx(
|
|
3518
|
-
RPNInputPrimitive.default,
|
|
3519
|
-
{
|
|
3520
|
-
"data-slot": "input-phone",
|
|
3521
|
-
dir: direction,
|
|
3522
|
-
className: cn("w-full flex", className),
|
|
3523
|
-
flagComponent: FlagComponent,
|
|
3524
|
-
countrySelectComponent: CountrySelect,
|
|
3525
|
-
inputComponent: InputComponent,
|
|
3526
|
-
onChange: (value) => onChange?.(value),
|
|
3527
|
-
...props
|
|
3528
|
-
}
|
|
3529
|
-
);
|
|
3530
|
-
}
|
|
3531
|
-
function InputComponent({ className, ...props }) {
|
|
3532
|
-
return /* @__PURE__ */ jsx(
|
|
3533
|
-
Input,
|
|
3534
|
-
{
|
|
3535
|
-
className: cn("rounded-e-md rounded-s-none", className),
|
|
3536
|
-
...props
|
|
3537
|
-
}
|
|
3538
|
-
);
|
|
3539
|
-
}
|
|
3540
|
-
function CountrySelect({
|
|
3541
|
-
disabled,
|
|
3542
|
-
value,
|
|
3543
|
-
onChange,
|
|
3544
|
-
options
|
|
3545
|
-
}) {
|
|
3546
|
-
const handleSelect = useCallback(
|
|
3547
|
-
(country) => onChange(country),
|
|
3548
|
-
[onChange]
|
|
3549
|
-
);
|
|
3550
|
-
const memoizedOptions = useMemo(
|
|
3551
|
-
() => options.map((option) => /* @__PURE__ */ jsxs(
|
|
3552
|
-
CommandItem,
|
|
3553
|
-
{
|
|
3554
|
-
className: "flex gap-2 w-full",
|
|
3555
|
-
onSelect: () => handleSelect(option.value),
|
|
3556
|
-
children: [
|
|
3557
|
-
/* @__PURE__ */ jsx(FlagComponent, { country: option.value, countryName: option.label }),
|
|
3558
|
-
/* @__PURE__ */ jsx("span", { className: "flex-1 text-sm", children: option.label }),
|
|
3559
|
-
option.value && /* @__PURE__ */ jsx("span", { className: "text-foreground/50 text-sm", children: `+${RPNInputPrimitive.getCountryCallingCode(option.value)}` }),
|
|
3560
|
-
/* @__PURE__ */ jsx("span", { "aria-label": option.value === value ? "Selected" : void 0, children: /* @__PURE__ */ jsx(
|
|
3561
|
-
Check,
|
|
3562
|
-
{
|
|
3563
|
-
className: cn(
|
|
3564
|
-
"ms-auto size-4",
|
|
3565
|
-
option.value === value ? "opacity-100" : "opacity-0"
|
|
3566
|
-
)
|
|
3567
|
-
}
|
|
3568
|
-
) })
|
|
3569
|
-
]
|
|
3570
|
-
},
|
|
3571
|
-
option.value || "ZZ"
|
|
3572
|
-
)),
|
|
3573
|
-
[options, handleSelect, value]
|
|
3574
|
-
);
|
|
3575
|
-
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
3576
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
3577
|
-
Button,
|
|
3578
|
-
{
|
|
3579
|
-
type: "button",
|
|
3580
|
-
variant: "outline",
|
|
3581
|
-
className: cn("flex gap-1 rounded-e-none rounded-s-lg px-3"),
|
|
3582
|
-
disabled,
|
|
3583
|
-
children: [
|
|
3584
|
-
/* @__PURE__ */ jsx(FlagComponent, { country: value, countryName: value }),
|
|
3585
|
-
/* @__PURE__ */ jsx(
|
|
3586
|
-
ChevronsUpDown,
|
|
3587
|
-
{
|
|
3588
|
-
className: cn(
|
|
3589
|
-
"-me-2 size-4 opacity-50",
|
|
3590
|
-
disabled ? "hidden" : "opacity-100"
|
|
3591
|
-
),
|
|
3592
|
-
"aria-hidden": true
|
|
3593
|
-
}
|
|
3594
|
-
)
|
|
3595
|
-
]
|
|
3596
|
-
}
|
|
3597
|
-
) }),
|
|
3598
|
-
/* @__PURE__ */ jsx(PopoverContent, { className: "w-[300px] p-0", align: "start", children: /* @__PURE__ */ jsxs(Command, { children: [
|
|
3599
|
-
/* @__PURE__ */ jsx(CommandInput, { placeholder: "Search country..." }),
|
|
3600
|
-
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
3601
|
-
/* @__PURE__ */ jsx(CommandEmpty, { children: "No country found." }),
|
|
3602
|
-
/* @__PURE__ */ jsx(ScrollArea, { className: "h-[300px] max-h-[300px]", children: /* @__PURE__ */ jsx(CommandGroup, { children: memoizedOptions }) })
|
|
3603
|
-
] })
|
|
3604
|
-
] }) })
|
|
3605
|
-
] });
|
|
3606
|
-
}
|
|
3607
|
-
function FlagComponent({ country, countryName }) {
|
|
3608
|
-
const flagUrl = `https://purecatamphetamine.github.io/country-flag-icons/3x2/${country}.svg`;
|
|
3609
|
-
return /* @__PURE__ */ jsx("div", { className: "relative h-4 w-6 bg-foreground/20 rounded-sm", children: country && /* @__PURE__ */ jsx(
|
|
3610
|
-
Image,
|
|
3611
|
-
{
|
|
3612
|
-
src: flagUrl,
|
|
3613
|
-
alt: countryName,
|
|
3614
|
-
fill: true,
|
|
3615
|
-
className: "rounded-sm object-cover"
|
|
3616
|
-
}
|
|
3617
|
-
) });
|
|
3618
|
-
}
|
|
3619
|
-
var init_input_phone = __esm({
|
|
3620
|
-
"src/ui/forms/input-phone.tsx"() {
|
|
3621
|
-
"use client";
|
|
3622
|
-
init_utils();
|
|
3623
|
-
init_primitives();
|
|
3624
|
-
init_command();
|
|
3625
|
-
init_primitives();
|
|
3626
|
-
init_client();
|
|
3627
|
-
init_client();
|
|
3628
|
-
}
|
|
3629
|
-
});
|
|
3630
|
-
function InputSpin({
|
|
3631
|
-
value,
|
|
3632
|
-
onChange,
|
|
3633
|
-
min = -Infinity,
|
|
3634
|
-
max = Infinity,
|
|
3635
|
-
step = 1,
|
|
3636
|
-
disabled = false,
|
|
3637
|
-
className,
|
|
3638
|
-
buttonVariant = "default",
|
|
3639
|
-
...props
|
|
3640
|
-
}) {
|
|
3641
|
-
const [internalValue, setInternalValue] = useState(value ?? 0);
|
|
3642
|
-
function handleIncrement() {
|
|
3643
|
-
const newValue = internalValue + step;
|
|
3644
|
-
if (newValue <= max) {
|
|
3645
|
-
setInternalValue(newValue);
|
|
3646
|
-
onChange?.(newValue);
|
|
3647
|
-
}
|
|
3648
|
-
}
|
|
3649
|
-
function handleDecrement() {
|
|
3650
|
-
const newValue = internalValue - step;
|
|
3651
|
-
if (newValue >= min) {
|
|
3652
|
-
setInternalValue(newValue);
|
|
3653
|
-
onChange?.(newValue);
|
|
3654
|
-
}
|
|
3655
|
-
}
|
|
3656
|
-
const handleOnChange = (e) => {
|
|
3657
|
-
const newValue = parseFloat(e.target.value);
|
|
3658
|
-
if (!isNaN(newValue) && newValue >= min && newValue <= max) {
|
|
3659
|
-
setInternalValue(newValue);
|
|
3660
|
-
onChange?.(newValue);
|
|
3661
|
-
}
|
|
3662
|
-
};
|
|
3663
|
-
useEffect(() => {
|
|
3664
|
-
if (value !== void 0) {
|
|
3665
|
-
setInternalValue(value);
|
|
3666
|
-
}
|
|
3667
|
-
}, [value]);
|
|
3668
|
-
return /* @__PURE__ */ jsxs(
|
|
3669
|
-
"div",
|
|
3670
|
-
{
|
|
3671
|
-
"data-slot": "input-spin",
|
|
3672
|
-
className: cn(
|
|
3673
|
-
"h-9 w-fit flex justify-between items-center p-0.5 rounded-md border border-input bg-transparent text-sm transition-colors",
|
|
3674
|
-
disabled && "cursor-not-allowed opacity-50",
|
|
3675
|
-
className
|
|
3676
|
-
),
|
|
3677
|
-
children: [
|
|
3678
|
-
/* @__PURE__ */ jsx(
|
|
3679
|
-
Button,
|
|
3680
|
-
{
|
|
3681
|
-
type: "button",
|
|
3682
|
-
variant: buttonVariant,
|
|
3683
|
-
size: "icon",
|
|
3684
|
-
className: "h-full w-auto aspect-square",
|
|
3685
|
-
onClick: handleDecrement,
|
|
3686
|
-
disabled: disabled || internalValue <= min,
|
|
3687
|
-
"aria-label": "Decrease value",
|
|
3688
|
-
children: /* @__PURE__ */ jsx(Minus, { className: "h-4 w-4" })
|
|
3689
|
-
}
|
|
3690
|
-
),
|
|
3691
|
-
/* @__PURE__ */ jsx(
|
|
3692
|
-
"input",
|
|
3693
|
-
{
|
|
3694
|
-
type: "number",
|
|
3695
|
-
value: internalValue,
|
|
3696
|
-
className: cn(
|
|
3697
|
-
"h-full w-10 border-0 bg-transparent text-sm text-center focus:outline-hidden focus:ring-0",
|
|
3698
|
-
"[-moz-appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
|
|
3699
|
-
),
|
|
3700
|
-
onChange: handleOnChange,
|
|
3701
|
-
disabled,
|
|
3702
|
-
min,
|
|
3703
|
-
max,
|
|
3704
|
-
step,
|
|
3705
|
-
readOnly: true,
|
|
3706
|
-
...props
|
|
3707
|
-
}
|
|
3708
|
-
),
|
|
3709
|
-
/* @__PURE__ */ jsx(
|
|
3710
|
-
Button,
|
|
3711
|
-
{
|
|
3712
|
-
type: "button",
|
|
3713
|
-
variant: buttonVariant,
|
|
3714
|
-
size: "icon",
|
|
3715
|
-
className: "h-full w-auto aspect-square",
|
|
3716
|
-
onClick: handleIncrement,
|
|
3717
|
-
disabled: disabled || internalValue >= max,
|
|
3718
|
-
"aria-label": "Increase value",
|
|
3719
|
-
children: /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" })
|
|
3720
|
-
}
|
|
3721
|
-
)
|
|
3722
|
-
]
|
|
3723
|
-
}
|
|
3724
|
-
);
|
|
3725
|
-
}
|
|
3726
|
-
var init_input_spin = __esm({
|
|
3727
|
-
"src/ui/forms/input-spin.tsx"() {
|
|
3728
|
-
"use client";
|
|
3729
|
-
init_utils();
|
|
3730
|
-
init_primitives();
|
|
3731
|
-
}
|
|
3732
|
-
});
|
|
3733
|
-
function InputTags({
|
|
3734
|
-
placeholder,
|
|
3735
|
-
tags,
|
|
3736
|
-
onTagsChange,
|
|
3737
|
-
className,
|
|
3738
|
-
...props
|
|
3739
|
-
}) {
|
|
3740
|
-
const [inputValue, setInputValue] = useState("");
|
|
3741
|
-
const inputRef = useRef(null);
|
|
3742
|
-
useImperativeHandle(props.ref, () => inputRef.current);
|
|
3743
|
-
const addTag = (tag) => {
|
|
3744
|
-
const trimmedTag = tag.trim();
|
|
3745
|
-
if (trimmedTag && !tags.includes(trimmedTag)) {
|
|
3746
|
-
onTagsChange([...tags, trimmedTag]);
|
|
3747
|
-
}
|
|
3748
|
-
setInputValue("");
|
|
3749
|
-
};
|
|
3750
|
-
const removeTag = (indexToRemove) => {
|
|
3751
|
-
onTagsChange(tags.filter((_, index) => index !== indexToRemove));
|
|
3752
|
-
};
|
|
3753
|
-
const handleKeyDown = (e) => {
|
|
3754
|
-
if (e.key === "Enter") {
|
|
3755
|
-
e.preventDefault();
|
|
3756
|
-
addTag(inputValue);
|
|
3757
|
-
} else if (e.key === "Backspace" && !inputValue && tags.length > 0) {
|
|
3758
|
-
removeTag(tags.length - 1);
|
|
3759
|
-
}
|
|
3760
|
-
};
|
|
3761
|
-
return /* @__PURE__ */ jsxs(
|
|
3762
|
-
"div",
|
|
3763
|
-
{
|
|
3764
|
-
"data-slot": "input-tags",
|
|
3765
|
-
className: cn(
|
|
3766
|
-
"min-h-9 w-full flex flex-wrap gap-2 rounded-md border border-input bg-background px-3 py-1 text-sm ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
|
|
3767
|
-
className
|
|
3768
|
-
),
|
|
3769
|
-
onClick: () => inputRef.current?.focus(),
|
|
3770
|
-
children: [
|
|
3771
|
-
tags.map((tag, index) => /* @__PURE__ */ jsxs(
|
|
3772
|
-
"span",
|
|
3773
|
-
{
|
|
3774
|
-
className: "inline-flex items-center rounded-full bg-secondary px-3 py-0.5 text-sm font-medium text-secondary-foreground",
|
|
3775
|
-
children: [
|
|
3776
|
-
tag,
|
|
3777
|
-
/* @__PURE__ */ jsx(
|
|
3778
|
-
Button,
|
|
3779
|
-
{
|
|
3780
|
-
variant: "ghost",
|
|
3781
|
-
onClick: (e) => {
|
|
3782
|
-
e.preventDefault();
|
|
3783
|
-
removeTag(index);
|
|
3784
|
-
},
|
|
3785
|
-
className: "size-auto p-0.5 ms-0.5 -me-1 rounded-full hover:bg-secondary-foreground/20",
|
|
3786
|
-
"aria-label": "Remove",
|
|
3787
|
-
children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
|
|
3788
|
-
}
|
|
3789
|
-
)
|
|
3790
|
-
]
|
|
3791
|
-
},
|
|
3792
|
-
index
|
|
3793
|
-
)),
|
|
3794
|
-
/* @__PURE__ */ jsx(
|
|
3795
|
-
"input",
|
|
3796
|
-
{
|
|
3797
|
-
ref: inputRef,
|
|
3798
|
-
type: "text",
|
|
3799
|
-
className: "w-0 flex-1 bg-transparent outline-hidden placeholder:text-muted-foreground",
|
|
3800
|
-
value: inputValue,
|
|
3801
|
-
onChange: (e) => setInputValue(e.target.value),
|
|
3802
|
-
onKeyDown: handleKeyDown,
|
|
3803
|
-
onBlur: () => addTag(inputValue),
|
|
3804
|
-
placeholder: tags.length === 0 ? placeholder : "",
|
|
3805
|
-
...props
|
|
3806
|
-
}
|
|
3807
|
-
)
|
|
3808
|
-
]
|
|
3809
|
-
}
|
|
3810
|
-
);
|
|
3811
|
-
}
|
|
3812
|
-
function InputTagsWithSuggestions({
|
|
3813
|
-
placeholder,
|
|
3814
|
-
tags,
|
|
3815
|
-
suggestions,
|
|
3816
|
-
onTagsChange,
|
|
3817
|
-
className,
|
|
3818
|
-
...props
|
|
3819
|
-
}) {
|
|
3820
|
-
const [inputValue, setInputValue] = useState("");
|
|
3821
|
-
const [open, setOpen] = useState(false);
|
|
3822
|
-
const containerRef = useRef(null);
|
|
3823
|
-
const [popoverWidth, setPopoverWidth] = useState(
|
|
3824
|
-
void 0
|
|
3825
|
-
);
|
|
3826
|
-
useEffect(() => {
|
|
3827
|
-
if (containerRef.current) {
|
|
3828
|
-
setPopoverWidth(containerRef.current.offsetWidth);
|
|
3829
|
-
}
|
|
3830
|
-
}, [open]);
|
|
3831
|
-
const filteredSuggestions = suggestions.filter(
|
|
3832
|
-
(suggestion) => suggestion.toLowerCase().includes(inputValue.toLowerCase()) && !tags.includes(suggestion)
|
|
3833
|
-
);
|
|
3834
|
-
const addTag = (tag) => {
|
|
3835
|
-
const trimmedTag = tag.trim();
|
|
3836
|
-
if (trimmedTag && !tags.includes(trimmedTag)) {
|
|
3837
|
-
onTagsChange([...tags, trimmedTag]);
|
|
3838
|
-
}
|
|
3839
|
-
setInputValue("");
|
|
3840
|
-
};
|
|
3841
|
-
const removeTag = (indexToRemove) => {
|
|
3842
|
-
onTagsChange(tags.filter((_, index) => index !== indexToRemove));
|
|
3843
|
-
};
|
|
3844
|
-
const handleKeyDown = (e) => {
|
|
3845
|
-
if (e.key === "Enter" && !open) {
|
|
3846
|
-
e.preventDefault();
|
|
3847
|
-
addTag(inputValue);
|
|
3848
|
-
} else if (e.key === "Backspace" && !inputValue && tags.length > 0) {
|
|
3849
|
-
removeTag(tags.length - 1);
|
|
3850
|
-
}
|
|
3851
|
-
};
|
|
3852
|
-
return /* @__PURE__ */ jsxs(Popover, { modal: true, open, onOpenChange: setOpen, children: [
|
|
3853
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
3854
|
-
"div",
|
|
3855
|
-
{
|
|
3856
|
-
"data-slot": "input-tags-with-suggestions",
|
|
3857
|
-
ref: containerRef,
|
|
3858
|
-
className: cn(
|
|
3859
|
-
"min-h-9 w-full flex flex-wrap gap-2 rounded-md border border-input bg-background px-3 py-1 text-sm ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",
|
|
3860
|
-
className
|
|
3861
|
-
),
|
|
3862
|
-
children: [
|
|
3863
|
-
tags.map((tag, index) => /* @__PURE__ */ jsxs(
|
|
3864
|
-
"span",
|
|
3865
|
-
{
|
|
3866
|
-
className: "inline-flex items-center rounded-full bg-secondary px-3 py-0.5 text-sm font-medium text-secondary-foreground",
|
|
3867
|
-
children: [
|
|
3868
|
-
tag,
|
|
3869
|
-
/* @__PURE__ */ jsx(
|
|
3870
|
-
Button,
|
|
3871
|
-
{
|
|
3872
|
-
variant: "ghost",
|
|
3873
|
-
onClick: (e) => {
|
|
3874
|
-
e.preventDefault();
|
|
3875
|
-
removeTag(index);
|
|
3876
|
-
},
|
|
3877
|
-
className: "size-auto p-0.5 ms-0.5 -me-1 rounded-full hover:bg-secondary-foreground/20",
|
|
3878
|
-
"aria-label": "Remove",
|
|
3879
|
-
children: /* @__PURE__ */ jsx(X, { className: "h-3 w-3" })
|
|
3880
|
-
}
|
|
3881
|
-
)
|
|
3882
|
-
]
|
|
3883
|
-
},
|
|
3884
|
-
index
|
|
3885
|
-
)),
|
|
3886
|
-
/* @__PURE__ */ jsx(
|
|
3887
|
-
"input",
|
|
3888
|
-
{
|
|
3889
|
-
ref: props.ref,
|
|
3890
|
-
type: "text",
|
|
3891
|
-
value: inputValue,
|
|
3892
|
-
onChange: (e) => setInputValue(e.target.value),
|
|
3893
|
-
onKeyDown: handleKeyDown,
|
|
3894
|
-
className: "w-0 flex-1 bg-transparent outline-hidden placeholder:text-muted-foreground",
|
|
3895
|
-
placeholder: tags.length === 0 ? placeholder : "",
|
|
3896
|
-
...props
|
|
3897
|
-
}
|
|
3898
|
-
)
|
|
3899
|
-
]
|
|
3900
|
-
}
|
|
3901
|
-
) }),
|
|
3902
|
-
/* @__PURE__ */ jsx(
|
|
3903
|
-
PopoverContent,
|
|
3904
|
-
{
|
|
3905
|
-
style: { width: popoverWidth ? `${popoverWidth}px` : "auto" },
|
|
3906
|
-
onOpenAutoFocus: (e) => e.preventDefault(),
|
|
3907
|
-
children: /* @__PURE__ */ jsx(ScrollArea, { className: "flex flex-col max-h-[300px]", children: /* @__PURE__ */ jsx(Command, { children: /* @__PURE__ */ jsxs(CommandList, { className: "max-h-full", children: [
|
|
3908
|
-
/* @__PURE__ */ jsx(CommandEmpty, { children: "No results found." }),
|
|
3909
|
-
filteredSuggestions.map((suggestion) => /* @__PURE__ */ jsx(
|
|
3910
|
-
CommandItem,
|
|
3911
|
-
{
|
|
3912
|
-
onSelect: () => addTag(suggestion),
|
|
3913
|
-
children: suggestion
|
|
3914
|
-
},
|
|
3915
|
-
suggestion
|
|
3916
|
-
))
|
|
3917
|
-
] }) }) })
|
|
3918
|
-
}
|
|
3919
|
-
)
|
|
3920
|
-
] });
|
|
3921
|
-
}
|
|
3922
|
-
var init_input_tags = __esm({
|
|
3923
|
-
"src/ui/forms/input-tags.tsx"() {
|
|
3924
|
-
"use client";
|
|
3925
|
-
init_utils();
|
|
3926
|
-
init_command();
|
|
3927
|
-
init_client();
|
|
3928
|
-
init_primitives();
|
|
3929
|
-
init_client();
|
|
3930
|
-
}
|
|
3931
|
-
});
|
|
3932
|
-
function MultipleDatesPicker({
|
|
3933
|
-
value,
|
|
3934
|
-
onValueChange,
|
|
3935
|
-
formatStr = "yyyy-MM-dd p",
|
|
3936
|
-
popoverContentClassName,
|
|
3937
|
-
popoverContentOptions,
|
|
3938
|
-
buttonClassName,
|
|
3939
|
-
buttonOptions,
|
|
3940
|
-
placeholder = "Pick dates",
|
|
3941
|
-
...props
|
|
3942
|
-
}) {
|
|
3943
|
-
return /* @__PURE__ */ jsxs(Popover, { modal: true, children: [
|
|
3944
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
3945
|
-
Button,
|
|
3946
|
-
{
|
|
3947
|
-
variant: "outline",
|
|
3948
|
-
className: cn(
|
|
3949
|
-
"w-full px-3 text-start font-normal overflow-hidden",
|
|
3950
|
-
buttonClassName
|
|
3951
|
-
),
|
|
3952
|
-
...buttonOptions,
|
|
3953
|
-
children: [
|
|
3954
|
-
value && value.length > 0 ? /* @__PURE__ */ jsx("div", { className: "truncate me-1", children: value.map((date) => format(date, formatStr)).join(", ") }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: placeholder }),
|
|
3955
|
-
/* @__PURE__ */ jsx(CalendarIcon, { className: "shrink-0 ms-auto h-4 w-4 text-muted-foreground" })
|
|
3956
|
-
]
|
|
3957
|
-
}
|
|
3958
|
-
) }),
|
|
3959
|
-
/* @__PURE__ */ jsx(
|
|
3960
|
-
PopoverContent,
|
|
3961
|
-
{
|
|
3962
|
-
className: cn("w-auto p-0", popoverContentClassName),
|
|
3963
|
-
align: "start",
|
|
3964
|
-
...popoverContentOptions,
|
|
3965
|
-
children: /* @__PURE__ */ jsx(
|
|
3966
|
-
Calendar,
|
|
3967
|
-
{
|
|
3968
|
-
mode: "multiple",
|
|
3969
|
-
selected: value,
|
|
3970
|
-
onSelect: onValueChange,
|
|
3971
|
-
...props
|
|
3972
|
-
}
|
|
3973
|
-
)
|
|
3974
|
-
}
|
|
3975
|
-
)
|
|
3976
|
-
] });
|
|
3977
|
-
}
|
|
3978
|
-
var init_multiple_date_picker = __esm({
|
|
3979
|
-
"src/ui/forms/multiple-date-picker.tsx"() {
|
|
3980
|
-
"use client";
|
|
3981
|
-
init_utils();
|
|
3982
|
-
init_primitives();
|
|
3983
|
-
init_client();
|
|
3984
|
-
init_client();
|
|
3985
|
-
}
|
|
3986
|
-
});
|
|
3987
|
-
function TimePicker({
|
|
3988
|
-
value,
|
|
3989
|
-
popoverContentClassName,
|
|
3990
|
-
popoverContentOptions,
|
|
3991
|
-
buttonClassName,
|
|
3992
|
-
buttonOptions,
|
|
3993
|
-
placeholder = "Pick time",
|
|
3994
|
-
...props
|
|
3995
|
-
}) {
|
|
3996
|
-
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
3997
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
3998
|
-
Button,
|
|
3999
|
-
{
|
|
4000
|
-
variant: "outline",
|
|
4001
|
-
className: cn("w-full px-3 text-start font-normal", buttonClassName),
|
|
4002
|
-
...buttonOptions,
|
|
4003
|
-
children: [
|
|
4004
|
-
value ? /* @__PURE__ */ jsx("span", { children: format(timeToDate(value), "p") }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: placeholder }),
|
|
4005
|
-
/* @__PURE__ */ jsx(Clock, { className: "ms-auto h-4 w-4 text-muted-foreground" })
|
|
4006
|
-
]
|
|
4007
|
-
}
|
|
4008
|
-
) }),
|
|
4009
|
-
/* @__PURE__ */ jsx(
|
|
4010
|
-
PopoverContent,
|
|
4011
|
-
{
|
|
4012
|
-
className: cn("w-auto p-0", popoverContentClassName),
|
|
4013
|
-
align: "start",
|
|
4014
|
-
...popoverContentOptions,
|
|
4015
|
-
children: /* @__PURE__ */ jsx(InputTime, { className: "border-0", value, ...props })
|
|
4016
|
-
}
|
|
4017
|
-
)
|
|
4018
|
-
] });
|
|
4019
|
-
}
|
|
4020
|
-
var init_time_picker = __esm({
|
|
4021
|
-
"src/ui/forms/time-picker.tsx"() {
|
|
4022
|
-
"use client";
|
|
4023
|
-
init_utils();
|
|
4024
|
-
init_primitives();
|
|
4025
|
-
init_input_time();
|
|
4026
|
-
init_client();
|
|
4027
|
-
}
|
|
4028
|
-
});
|
|
4029
|
-
function SizeHandler({ editor }) {
|
|
4030
|
-
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
4031
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
4032
|
-
Button,
|
|
4033
|
-
{
|
|
4034
|
-
variant: "ghost",
|
|
4035
|
-
size: "icon",
|
|
4036
|
-
className: "h-8 w-8",
|
|
4037
|
-
"aria-label": "Select text style",
|
|
4038
|
-
children: /* @__PURE__ */ jsx(Type, { className: "h-4 w-4" })
|
|
4039
|
-
}
|
|
4040
|
-
) }),
|
|
4041
|
-
/* @__PURE__ */ jsx(PopoverContent, { align: "start", className: "min-w-[8rem] w-auto p-1", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
|
|
4042
|
-
/* @__PURE__ */ jsx(
|
|
4043
|
-
Button,
|
|
4044
|
-
{
|
|
4045
|
-
variant: "ghost",
|
|
4046
|
-
onClick: () => editor.chain().focus().setParagraph().run(),
|
|
4047
|
-
className: cn(
|
|
4048
|
-
"justify-start px-3 py-2 text-left text-base",
|
|
4049
|
-
editor.isActive("paragraph") && "bg-muted"
|
|
4050
|
-
),
|
|
4051
|
-
children: "Small"
|
|
4052
|
-
}
|
|
4053
|
-
),
|
|
4054
|
-
sizes.map((size) => /* @__PURE__ */ jsx(
|
|
4055
|
-
Button,
|
|
4056
|
-
{
|
|
4057
|
-
variant: "ghost",
|
|
4058
|
-
onClick: () => editor.chain().focus().toggleHeading({ level: size.level }).run(),
|
|
4059
|
-
className: cn(
|
|
4060
|
-
"justify-start px-3 py-2 text-left",
|
|
4061
|
-
size.textSize,
|
|
4062
|
-
editor.isActive("heading", { level: size.level }) && "bg-muted"
|
|
4063
|
-
),
|
|
4064
|
-
children: size.label
|
|
4065
|
-
},
|
|
4066
|
-
size.level
|
|
4067
|
-
))
|
|
4068
|
-
] }) })
|
|
4069
|
-
] });
|
|
4070
|
-
}
|
|
4071
|
-
function FormatHandler({
|
|
4072
|
-
editor,
|
|
4073
|
-
format: format6,
|
|
4074
|
-
iconName
|
|
4075
|
-
}) {
|
|
4076
|
-
const toggleCommands = {
|
|
4077
|
-
bold: () => editor.chain().focus().toggleBold(),
|
|
4078
|
-
italic: () => editor.chain().focus().toggleItalic(),
|
|
4079
|
-
underline: () => editor.chain().focus().toggleUnderline(),
|
|
4080
|
-
strike: () => editor.chain().focus().toggleStrike()
|
|
4081
|
-
};
|
|
4082
|
-
function handlePressChange() {
|
|
4083
|
-
const command = toggleCommands[format6];
|
|
4084
|
-
if (command) {
|
|
4085
|
-
command().run();
|
|
4086
|
-
}
|
|
4087
|
-
}
|
|
4088
|
-
return /* @__PURE__ */ jsx(
|
|
4089
|
-
Toggle,
|
|
4090
|
-
{
|
|
4091
|
-
size: "sm",
|
|
4092
|
-
pressed: editor.isActive(format6),
|
|
4093
|
-
onPressedChange: handlePressChange,
|
|
4094
|
-
"aria-label": `Toggle ${format6} format`,
|
|
4095
|
-
children: /* @__PURE__ */ jsx(DynamicIcon, { name: iconName, className: "h-4 w-4" })
|
|
4096
|
-
}
|
|
4097
|
-
);
|
|
4098
|
-
}
|
|
4099
|
-
function AlignmentHandler({
|
|
4100
|
-
editor,
|
|
4101
|
-
alignment,
|
|
4102
|
-
iconName
|
|
4103
|
-
}) {
|
|
4104
|
-
return /* @__PURE__ */ jsx(
|
|
4105
|
-
Toggle,
|
|
4106
|
-
{
|
|
4107
|
-
size: "sm",
|
|
4108
|
-
pressed: editor.isActive({ textAlign: alignment }),
|
|
4109
|
-
onPressedChange: () => editor.chain().focus().setTextAlign(alignment).run(),
|
|
4110
|
-
"aria-label": `Switch ${alignment} alignment`,
|
|
4111
|
-
children: /* @__PURE__ */ jsx(DynamicIcon, { name: iconName, className: "h-4 w-4" })
|
|
4112
|
-
}
|
|
4113
|
-
);
|
|
4114
|
-
}
|
|
4115
|
-
function ImageHandler({ editor }) {
|
|
4116
|
-
const [imageSrc, setImageSrc] = useState(null);
|
|
4117
|
-
function handleFileChange(files) {
|
|
4118
|
-
if (files.length < 1) return;
|
|
4119
|
-
const objectURL = URL.createObjectURL(files[0]);
|
|
4120
|
-
setImageSrc(objectURL);
|
|
4121
|
-
}
|
|
4122
|
-
function handleSubmit(e) {
|
|
4123
|
-
e.preventDefault();
|
|
4124
|
-
if (editor && imageSrc) {
|
|
4125
|
-
editor.chain().focus().setImage({ src: imageSrc }).run();
|
|
4126
|
-
setImageSrc(null);
|
|
4127
|
-
}
|
|
4128
|
-
}
|
|
4129
|
-
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
4130
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
4131
|
-
Button,
|
|
4132
|
-
{
|
|
4133
|
-
type: "button",
|
|
4134
|
-
variant: "ghost",
|
|
4135
|
-
size: "icon",
|
|
4136
|
-
className: "h-8 w-8",
|
|
4137
|
-
"aria-label": "Insert image",
|
|
4138
|
-
children: /* @__PURE__ */ jsx(Image$1, { className: "h-4 w-4" })
|
|
4139
|
-
}
|
|
4140
|
-
) }),
|
|
4141
|
-
/* @__PURE__ */ jsx(PopoverContent, { children: /* @__PURE__ */ jsxs(
|
|
4142
|
-
"form",
|
|
4143
|
-
{
|
|
4144
|
-
onSubmit: (e) => {
|
|
4145
|
-
e.stopPropagation();
|
|
4146
|
-
handleSubmit(e);
|
|
4147
|
-
},
|
|
4148
|
-
className: "flex justify-center items-center gap-2",
|
|
4149
|
-
children: [
|
|
4150
|
-
/* @__PURE__ */ jsx(InputFile, { onValueChange: handleFileChange }),
|
|
4151
|
-
/* @__PURE__ */ jsx(
|
|
4152
|
-
Button,
|
|
4153
|
-
{
|
|
4154
|
-
type: "submit",
|
|
4155
|
-
variant: "ghost",
|
|
4156
|
-
size: "icon",
|
|
4157
|
-
className: "shrink-0 h-8 w-8",
|
|
4158
|
-
"aria-label": "Submit",
|
|
4159
|
-
children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" })
|
|
4160
|
-
}
|
|
4161
|
-
)
|
|
4162
|
-
]
|
|
4163
|
-
}
|
|
4164
|
-
) })
|
|
4165
|
-
] });
|
|
4166
|
-
}
|
|
4167
|
-
function LinkHandler({ editor }) {
|
|
4168
|
-
const isLinkActive = editor.isActive("link");
|
|
4169
|
-
return isLinkActive ? /* @__PURE__ */ jsx(
|
|
4170
|
-
Button,
|
|
4171
|
-
{
|
|
4172
|
-
type: "button",
|
|
4173
|
-
variant: "ghost",
|
|
4174
|
-
size: "icon",
|
|
4175
|
-
className: "h-8 w-8",
|
|
4176
|
-
onClick: () => editor.chain().focus().unsetLink().run(),
|
|
4177
|
-
"aria-label": "Remove link",
|
|
4178
|
-
children: /* @__PURE__ */ jsx(Unlink, { className: "h-4 w-4" })
|
|
4179
|
-
}
|
|
4180
|
-
) : /* @__PURE__ */ jsxs(Popover, { children: [
|
|
4181
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
4182
|
-
Button,
|
|
4183
|
-
{
|
|
4184
|
-
type: "button",
|
|
4185
|
-
variant: "ghost",
|
|
4186
|
-
size: "icon",
|
|
4187
|
-
className: "h-8 w-8",
|
|
4188
|
-
"aria-label": "Insert link",
|
|
4189
|
-
children: /* @__PURE__ */ jsx(Link, { className: "h-4 w-4" })
|
|
4190
|
-
}
|
|
4191
|
-
) }),
|
|
4192
|
-
/* @__PURE__ */ jsxs(PopoverContent, { className: "flex justify-center items-center gap-2", children: [
|
|
4193
|
-
/* @__PURE__ */ jsx("p", { className: "shrink-0", children: "Insert link" }),
|
|
4194
|
-
/* @__PURE__ */ jsx(
|
|
4195
|
-
Input,
|
|
4196
|
-
{
|
|
4197
|
-
autoFocus: true,
|
|
4198
|
-
type: "text",
|
|
4199
|
-
placeholder: "https://www.example.com",
|
|
4200
|
-
onKeyDown: (e) => {
|
|
4201
|
-
if (e.key === "Enter") {
|
|
4202
|
-
editor.chain().focus().setLink({
|
|
4203
|
-
href: e.target.value
|
|
4204
|
-
}).run();
|
|
4205
|
-
}
|
|
4206
|
-
}
|
|
4207
|
-
}
|
|
4208
|
-
),
|
|
4209
|
-
/* @__PURE__ */ jsx(
|
|
4210
|
-
Button,
|
|
4211
|
-
{
|
|
4212
|
-
type: "button",
|
|
4213
|
-
variant: "ghost",
|
|
4214
|
-
size: "icon",
|
|
4215
|
-
className: "shrink-0 h-8 w-8",
|
|
4216
|
-
onClick: (e) => {
|
|
4217
|
-
editor.chain().focus().setLink({
|
|
4218
|
-
href: e.target.value
|
|
4219
|
-
}).run();
|
|
4220
|
-
},
|
|
4221
|
-
"aria-label": "Submit",
|
|
4222
|
-
children: /* @__PURE__ */ jsx(Check, { className: "h-4 w-4" })
|
|
4223
|
-
}
|
|
4224
|
-
)
|
|
4225
|
-
] })
|
|
4226
|
-
] });
|
|
4227
|
-
}
|
|
4228
|
-
function ColorHandler({ editor }) {
|
|
4229
|
-
const selectedColor = editor.getAttributes("textStyle").color;
|
|
4230
|
-
const inputRef = useRef(null);
|
|
4231
|
-
return /* @__PURE__ */ jsxs(
|
|
4232
|
-
Button,
|
|
4233
|
-
{
|
|
4234
|
-
type: "button",
|
|
4235
|
-
variant: "ghost",
|
|
4236
|
-
size: "icon",
|
|
4237
|
-
className: "relative overflow-hidden",
|
|
4238
|
-
onClick: () => inputRef.current?.click(),
|
|
4239
|
-
"aria-label": "Select text color",
|
|
4240
|
-
children: [
|
|
4241
|
-
/* @__PURE__ */ jsx(Palette, { style: { color: selectedColor }, className: "size-4" }),
|
|
4242
|
-
/* @__PURE__ */ jsx(
|
|
4243
|
-
Input,
|
|
4244
|
-
{
|
|
4245
|
-
ref: inputRef,
|
|
4246
|
-
type: "color",
|
|
4247
|
-
value: selectedColor,
|
|
4248
|
-
onChange: (e) => editor.chain().focus().setColor(e.target.value).run(),
|
|
4249
|
-
className: "sr-only",
|
|
4250
|
-
tabIndex: -1
|
|
4251
|
-
}
|
|
4252
|
-
)
|
|
4253
|
-
]
|
|
4254
|
-
}
|
|
4255
|
-
);
|
|
4256
|
-
}
|
|
4257
|
-
function EditorMenuBar({ editor }) {
|
|
4258
|
-
return /* @__PURE__ */ jsxs(
|
|
4259
|
-
"div",
|
|
4260
|
-
{
|
|
4261
|
-
className: "flex flex-wrap items-center gap-1.5 p-1.5",
|
|
4262
|
-
"aria-label": "Editor Menu Bar",
|
|
4263
|
-
children: [
|
|
4264
|
-
/* @__PURE__ */ jsx(SizeHandler, { editor }),
|
|
4265
|
-
/* @__PURE__ */ jsx(ColorHandler, { editor }),
|
|
4266
|
-
/* @__PURE__ */ jsx(Separator3, { orientation: "vertical", className: "h-4" }),
|
|
4267
|
-
formats.map(({ format: format6, iconName }) => /* @__PURE__ */ jsx(
|
|
4268
|
-
FormatHandler,
|
|
4269
|
-
{
|
|
4270
|
-
editor,
|
|
4271
|
-
format: format6,
|
|
4272
|
-
iconName
|
|
4273
|
-
},
|
|
4274
|
-
format6
|
|
4275
|
-
)),
|
|
4276
|
-
/* @__PURE__ */ jsx(Separator3, { orientation: "vertical", className: "h-4" }),
|
|
4277
|
-
alignments.map(({ alignment, iconName }) => /* @__PURE__ */ jsx(
|
|
4278
|
-
AlignmentHandler,
|
|
4279
|
-
{
|
|
4280
|
-
editor,
|
|
4281
|
-
alignment,
|
|
4282
|
-
iconName
|
|
4283
|
-
},
|
|
4284
|
-
alignment
|
|
4285
|
-
)),
|
|
4286
|
-
/* @__PURE__ */ jsx(Separator3, { orientation: "vertical", className: "h-4" }),
|
|
4287
|
-
/* @__PURE__ */ jsx(ImageHandler, { editor }),
|
|
4288
|
-
/* @__PURE__ */ jsx(LinkHandler, { editor })
|
|
4289
|
-
]
|
|
4290
|
-
}
|
|
4291
|
-
);
|
|
4292
|
-
}
|
|
4293
|
-
var sizes, formats, alignments;
|
|
4294
|
-
var init_editor_menu_bar = __esm({
|
|
4295
|
-
"src/ui/forms/editor/editor-menu-bar.tsx"() {
|
|
4296
|
-
"use client";
|
|
4297
|
-
init_utils();
|
|
4298
|
-
init_primitives();
|
|
4299
|
-
init_primitives();
|
|
4300
|
-
init_input_file();
|
|
4301
|
-
init_client();
|
|
4302
|
-
init_primitives();
|
|
4303
|
-
init_client();
|
|
4304
|
-
init_client();
|
|
4305
|
-
sizes = [
|
|
4306
|
-
{ label: "Normal", level: 3, textSize: "text-lg" },
|
|
4307
|
-
{ label: "Large", level: 2, textSize: "text-xl" },
|
|
4308
|
-
{ label: "Extra Large", level: 1, textSize: "text-2xl" }
|
|
4309
|
-
];
|
|
4310
|
-
formats = [
|
|
4311
|
-
{
|
|
4312
|
-
format: "bold",
|
|
4313
|
-
iconName: "Bold"
|
|
4314
|
-
},
|
|
4315
|
-
{
|
|
4316
|
-
format: "italic",
|
|
4317
|
-
iconName: "Italic"
|
|
4318
|
-
},
|
|
4319
|
-
{
|
|
4320
|
-
format: "underline",
|
|
4321
|
-
iconName: "Underline"
|
|
4322
|
-
},
|
|
4323
|
-
{
|
|
4324
|
-
format: "strike",
|
|
4325
|
-
iconName: "Strikethrough"
|
|
4326
|
-
}
|
|
4327
|
-
];
|
|
4328
|
-
alignments = [
|
|
4329
|
-
{ alignment: "left", iconName: "AlignLeft" },
|
|
4330
|
-
{ alignment: "center", iconName: "AlignCenter" },
|
|
4331
|
-
{ alignment: "right", iconName: "AlignRight" },
|
|
4332
|
-
{ alignment: "justify", iconName: "AlignJustify" }
|
|
4333
|
-
];
|
|
4334
|
-
}
|
|
4335
|
-
});
|
|
4336
|
-
function Editor({
|
|
4337
|
-
value,
|
|
4338
|
-
onValueChange,
|
|
4339
|
-
bubbleMenu = false,
|
|
4340
|
-
placeholder,
|
|
4341
|
-
className,
|
|
4342
|
-
...props
|
|
4343
|
-
}) {
|
|
4344
|
-
const direction = useDirection();
|
|
4345
|
-
const isRtl = useIsRtl();
|
|
4346
|
-
const editor = useEditor({
|
|
4347
|
-
immediatelyRender: false,
|
|
4348
|
-
editorProps: {
|
|
4349
|
-
attributes: {
|
|
4350
|
-
class: cn(
|
|
4351
|
-
"px-3 py-2 break-all [&_p]:m-0 [&_.is-editor-empty]:before:absolute [&_.is-editor-empty]:before:top-2 [&_.is-editor-empty]:before:cursor-text [&_.is-editor-empty]:before:text-muted-foreground [&_.is-editor-empty]:before:content-[attr(data-placeholder)] prose prose-headings:font-normal prose-headings:text-foreground prose-h1:text-2xl prose-h2:text-xl prose-h3:text-lg dark:prose-invert focus:outline-hidden",
|
|
4352
|
-
className
|
|
4353
|
-
)
|
|
4354
|
-
}
|
|
4355
|
-
},
|
|
4356
|
-
extensions: [
|
|
4357
|
-
StarterKit,
|
|
4358
|
-
Underline,
|
|
4359
|
-
TextAlign.configure({
|
|
4360
|
-
types: ["heading", "paragraph"],
|
|
4361
|
-
defaultAlignment: isRtl ? "right" : "left"
|
|
4362
|
-
}),
|
|
4363
|
-
Color,
|
|
4364
|
-
TextStyle,
|
|
4365
|
-
Image3,
|
|
4366
|
-
Link4.configure({
|
|
4367
|
-
openOnClick: true,
|
|
4368
|
-
HTMLAttributes: {
|
|
4369
|
-
rel: "noopener noreferrer",
|
|
4370
|
-
target: "_blank"
|
|
4371
|
-
}
|
|
4372
|
-
}),
|
|
4373
|
-
Placeholder.configure({
|
|
4374
|
-
placeholder,
|
|
4375
|
-
showOnlyCurrent: true
|
|
4376
|
-
}),
|
|
4377
|
-
Typography
|
|
4378
|
-
],
|
|
4379
|
-
content: value,
|
|
4380
|
-
onUpdate: ({ editor: editor2 }) => {
|
|
4381
|
-
onValueChange?.(editor2.getHTML());
|
|
4382
|
-
},
|
|
4383
|
-
...props
|
|
4384
|
-
});
|
|
4385
|
-
if (!editor) {
|
|
4386
|
-
return null;
|
|
4387
|
-
}
|
|
4388
|
-
return /* @__PURE__ */ jsxs(Card, { children: [
|
|
4389
|
-
bubbleMenu ? /* @__PURE__ */ jsx(
|
|
4390
|
-
BubbleMenu,
|
|
4391
|
-
{
|
|
4392
|
-
className: "z-50 h-auto rounded-md border bg-popover text-popover-foreground shadow-md outline-hidden",
|
|
4393
|
-
editor,
|
|
4394
|
-
tippyOptions: {
|
|
4395
|
-
duration: 100,
|
|
4396
|
-
maxWidth: "98vw",
|
|
4397
|
-
appendTo: document.body,
|
|
4398
|
-
zIndex: 50
|
|
4399
|
-
},
|
|
4400
|
-
children: /* @__PURE__ */ jsx(EditorMenuBar, { editor })
|
|
4401
|
-
}
|
|
4402
|
-
) : /* @__PURE__ */ jsx(EditorMenuBar, { editor }),
|
|
4403
|
-
/* @__PURE__ */ jsx(
|
|
4404
|
-
ScrollArea,
|
|
4405
|
-
{
|
|
4406
|
-
className: cn(
|
|
4407
|
-
"flex flex-col min-h-9 rounded-md cursor-text",
|
|
4408
|
-
!bubbleMenu && "border-t border-border",
|
|
4409
|
-
editor.isFocused && "outline-hidden ring-1 ring-ring"
|
|
4410
|
-
),
|
|
4411
|
-
children: /* @__PURE__ */ jsx(
|
|
4412
|
-
EditorContent,
|
|
4413
|
-
{
|
|
4414
|
-
editor,
|
|
4415
|
-
dir: direction,
|
|
4416
|
-
className: cn(
|
|
4417
|
-
editor.isActive({ textAlign: "left" }) && "[&_.is-editor-empty]:before:left-3",
|
|
4418
|
-
editor.isActive({ textAlign: "right" }) && "[&_.is-editor-empty]:before:right-3",
|
|
4419
|
-
editor.isActive({ textAlign: "center" }) && "[&_.is-editor-empty]:before:left-1/2 [&_.is-editor-empty]:before:absolute [&_.is-editor-empty]:before:-translate-x-1/2",
|
|
4420
|
-
editor.isActive({ textAlign: "justify" }) && "[&_.is-editor-empty]:before:left-3"
|
|
4421
|
-
),
|
|
4422
|
-
onClick: () => editor.commands.focus()
|
|
4423
|
-
}
|
|
4424
|
-
)
|
|
4425
|
-
}
|
|
4426
|
-
)
|
|
4427
|
-
] });
|
|
4428
|
-
}
|
|
4429
|
-
var init_editor = __esm({
|
|
4430
|
-
"src/ui/forms/editor/index.tsx"() {
|
|
4431
|
-
"use client";
|
|
4432
|
-
init_utils();
|
|
4433
|
-
init_hooks();
|
|
4434
|
-
init_primitives();
|
|
4435
|
-
init_client();
|
|
4436
|
-
init_editor_menu_bar();
|
|
4437
|
-
}
|
|
4438
|
-
});
|
|
4439
|
-
function FormField(props) {
|
|
4440
|
-
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
4441
|
-
}
|
|
4442
|
-
function useFormField() {
|
|
4443
|
-
const fieldContext = useContext(FormFieldContext);
|
|
4444
|
-
const itemContext = useContext(FormItemContext);
|
|
4445
|
-
const { getFieldState, formState } = useFormContext();
|
|
4446
|
-
const fieldState = getFieldState(fieldContext.name, formState);
|
|
4447
|
-
if (!fieldContext) {
|
|
4448
|
-
throw new Error("useFormField should be used within <FormField>");
|
|
4449
|
-
}
|
|
4450
|
-
const { id } = itemContext;
|
|
4451
|
-
return {
|
|
4452
|
-
id,
|
|
4453
|
-
name: fieldContext.name,
|
|
4454
|
-
formItemId: `${id}-form-item`,
|
|
4455
|
-
formDescriptionId: `${id}-form-item-description`,
|
|
4456
|
-
formMessageId: `${id}-form-item-message`,
|
|
4457
|
-
...fieldState
|
|
4458
|
-
};
|
|
4459
|
-
}
|
|
4460
|
-
function FormItem({ className, ...props }) {
|
|
4461
|
-
const id = useId();
|
|
4462
|
-
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx(
|
|
4463
|
-
"div",
|
|
4464
|
-
{
|
|
4465
|
-
"data-slot": "form-item",
|
|
4466
|
-
className: cn("grid gap-2", className),
|
|
4467
|
-
...props
|
|
4468
|
-
}
|
|
4469
|
-
) });
|
|
4470
|
-
}
|
|
4471
|
-
function FormLabel({
|
|
4472
|
-
className,
|
|
4473
|
-
...props
|
|
4474
|
-
}) {
|
|
4475
|
-
const { error, formItemId } = useFormField();
|
|
4476
|
-
return /* @__PURE__ */ jsx(
|
|
4477
|
-
Label3,
|
|
4478
|
-
{
|
|
4479
|
-
"data-slot": "form-label",
|
|
4480
|
-
"data-error": !!error,
|
|
4481
|
-
className: cn("data-[error=true]:text-destructive", className),
|
|
4482
|
-
htmlFor: formItemId,
|
|
4483
|
-
...props
|
|
4484
|
-
}
|
|
4485
|
-
);
|
|
4486
|
-
}
|
|
4487
|
-
function FormControl({ ...props }) {
|
|
4488
|
-
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
4489
|
-
return /* @__PURE__ */ jsx(
|
|
4490
|
-
Slot,
|
|
4491
|
-
{
|
|
4492
|
-
"data-slot": "form-control",
|
|
4493
|
-
id: formItemId,
|
|
4494
|
-
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
4495
|
-
"aria-invalid": !!error,
|
|
4496
|
-
...props
|
|
4497
|
-
}
|
|
4498
|
-
);
|
|
4499
|
-
}
|
|
4500
|
-
function FormDescription({ className, ...props }) {
|
|
4501
|
-
const { formDescriptionId } = useFormField();
|
|
4502
|
-
return /* @__PURE__ */ jsx(
|
|
4503
|
-
"p",
|
|
4504
|
-
{
|
|
4505
|
-
"data-slot": "form-description",
|
|
4506
|
-
id: formDescriptionId,
|
|
4507
|
-
className: cn("text-[0.8rem] text-muted-foreground", className),
|
|
4508
|
-
...props
|
|
4509
|
-
}
|
|
4510
|
-
);
|
|
4511
|
-
}
|
|
4512
|
-
function FormMessage({
|
|
4513
|
-
className,
|
|
4514
|
-
children,
|
|
4515
|
-
...props
|
|
4516
|
-
}) {
|
|
4517
|
-
const { error, formMessageId } = useFormField();
|
|
4518
|
-
const body = error ? String(error?.message) : children;
|
|
4519
|
-
if (!body) {
|
|
4520
|
-
return null;
|
|
4521
|
-
}
|
|
4522
|
-
return /* @__PURE__ */ jsx(
|
|
4523
|
-
"p",
|
|
4524
|
-
{
|
|
4525
|
-
"data-slot": "form-message",
|
|
4526
|
-
id: formMessageId,
|
|
4527
|
-
className: cn("text-[0.8rem] font-medium text-destructive", className),
|
|
4528
|
-
...props,
|
|
4529
|
-
children: body
|
|
4530
|
-
}
|
|
4531
|
-
);
|
|
4532
|
-
}
|
|
4533
|
-
var Form, FormFieldContext, FormItemContext;
|
|
4534
|
-
var init_forms = __esm({
|
|
4535
|
-
"src/ui/forms/index.tsx"() {
|
|
4536
|
-
init_utils();
|
|
4537
|
-
init_client();
|
|
4538
|
-
init_radio_group();
|
|
4539
|
-
init_rating();
|
|
4540
|
-
init_command();
|
|
4541
|
-
init_multi_select();
|
|
4542
|
-
init_date_picker();
|
|
4543
|
-
init_date_range_picker();
|
|
4544
|
-
init_date_time_picker();
|
|
4545
|
-
init_emoji_picker();
|
|
4546
|
-
init_file_dropzone();
|
|
4547
|
-
init_file_thumbnail();
|
|
4548
|
-
init_input_file();
|
|
4549
|
-
init_input_group();
|
|
4550
|
-
init_input_otp();
|
|
4551
|
-
init_input_phone();
|
|
4552
|
-
init_input_spin();
|
|
4553
|
-
init_input_tags();
|
|
4554
|
-
init_input_time();
|
|
4555
|
-
init_multiple_date_picker();
|
|
4556
|
-
init_time_picker();
|
|
4557
|
-
init_editor();
|
|
4558
|
-
Form = FormProvider;
|
|
4559
|
-
FormFieldContext = createContext(
|
|
4560
|
-
{}
|
|
4561
|
-
);
|
|
4562
|
-
FormItemContext = createContext(
|
|
4563
|
-
{}
|
|
4564
|
-
);
|
|
4565
|
-
}
|
|
4566
|
-
});
|
|
4567
|
-
init_forms();
|
|
4568
|
-
|
|
4569
|
-
export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DatePicker, DateRangePicker, DateTimePicker, Editor, EmojiPicker, FileDropzone, FileThumbnail, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, InputFile, InputGroup, InputGroupText, InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot, InputPhone, InputSpin, InputTags, InputTagsWithSuggestions, InputTime, MultiSelect, MultipleDatesPicker, RadioGroup4 as RadioGroup, RadioGroupItem, Rating, RatingStar, ReactionPicker, TimePicker, starVariants, useFormField };
|
|
4570
|
-
//# sourceMappingURL=forms.mjs.map
|
|
4571
|
-
//# sourceMappingURL=forms.mjs.map
|