xiod-ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +73 -0
- package/README.md +167 -0
- package/dist/components/accordion.d.ts +9 -0
- package/dist/components/accordion.js +46 -0
- package/dist/components/agent-steps.d.ts +47 -0
- package/dist/components/agent-steps.js +223 -0
- package/dist/components/alert-dialog.d.ts +21 -0
- package/dist/components/alert-dialog.js +74 -0
- package/dist/components/alert.d.ts +12 -0
- package/dist/components/alert.js +45 -0
- package/dist/components/aspect-ratio.d.ts +9 -0
- package/dist/components/aspect-ratio.js +22 -0
- package/dist/components/autocomplete.d.ts +35 -0
- package/dist/components/autocomplete.js +160 -0
- package/dist/components/avatar.d.ts +17 -0
- package/dist/components/avatar.js +65 -0
- package/dist/components/badge.d.ts +15 -0
- package/dist/components/badge.js +46 -0
- package/dist/components/breadcrumb.d.ts +12 -0
- package/dist/components/breadcrumb.js +75 -0
- package/dist/components/button-group.d.ts +14 -0
- package/dist/components/button-group.js +45 -0
- package/dist/components/button-split.d.ts +19 -0
- package/dist/components/button-split.js +73 -0
- package/dist/components/button.d.ts +15 -0
- package/dist/components/button.js +54 -0
- package/dist/components/calendar.d.ts +63 -0
- package/dist/components/calendar.js +425 -0
- package/dist/components/card.d.ts +17 -0
- package/dist/components/card.js +139 -0
- package/dist/components/carousel.d.ts +59 -0
- package/dist/components/carousel.js +503 -0
- package/dist/components/checkbox.d.ts +16 -0
- package/dist/components/checkbox.js +86 -0
- package/dist/components/circular-progress.d.ts +28 -0
- package/dist/components/circular-progress.js +127 -0
- package/dist/components/collapsible.d.ts +8 -0
- package/dist/components/collapsible.js +27 -0
- package/dist/components/color-picker.d.ts +159 -0
- package/dist/components/color-picker.js +1589 -0
- package/dist/components/combobox.d.ts +46 -0
- package/dist/components/combobox.js +237 -0
- package/dist/components/command.d.ts +22 -0
- package/dist/components/command.js +129 -0
- package/dist/components/context-menu.d.ts +38 -0
- package/dist/components/context-menu.js +164 -0
- package/dist/components/copy-to-clipboard.d.ts +32 -0
- package/dist/components/copy-to-clipboard.js +83 -0
- package/dist/components/corner-badge.d.ts +22 -0
- package/dist/components/corner-badge.js +84 -0
- package/dist/components/dashboard-grid.d.ts +83 -0
- package/dist/components/dashboard-grid.js +486 -0
- package/dist/components/date-picker.d.ts +29 -0
- package/dist/components/date-picker.js +261 -0
- package/dist/components/dialog.d.ts +26 -0
- package/dist/components/dialog.js +97 -0
- package/dist/components/dot-matrix.d.ts +32 -0
- package/dist/components/dot-matrix.js +707 -0
- package/dist/components/draggable.d.ts +42 -0
- package/dist/components/draggable.js +346 -0
- package/dist/components/drawer.d.ts +66 -0
- package/dist/components/drawer.js +304 -0
- package/dist/components/empty.d.ts +14 -0
- package/dist/components/empty.js +75 -0
- package/dist/components/field.d.ts +12 -0
- package/dist/components/field.js +44 -0
- package/dist/components/fieldset.d.ts +7 -0
- package/dist/components/fieldset.js +21 -0
- package/dist/components/file-upload.d.ts +61 -0
- package/dist/components/file-upload.js +482 -0
- package/dist/components/form.d.ts +6 -0
- package/dist/components/form.js +14 -0
- package/dist/components/frame.d.ts +10 -0
- package/dist/components/frame.js +47 -0
- package/dist/components/gauge.d.ts +27 -0
- package/dist/components/gauge.js +74 -0
- package/dist/components/grid.d.ts +26 -0
- package/dist/components/grid.js +204 -0
- package/dist/components/group.d.ts +19 -0
- package/dist/components/group.js +45 -0
- package/dist/components/input-group.d.ts +15 -0
- package/dist/components/input-group.js +61 -0
- package/dist/components/input-otp.d.ts +24 -0
- package/dist/components/input-otp.js +50 -0
- package/dist/components/input-payment.d.ts +131 -0
- package/dist/components/input-payment.js +1140 -0
- package/dist/components/input-phone.d.ts +70 -0
- package/dist/components/input-phone.js +657 -0
- package/dist/components/input-sensitive.d.ts +12 -0
- package/dist/components/input-sensitive.js +169 -0
- package/dist/components/input.d.ts +13 -0
- package/dist/components/input.js +26 -0
- package/dist/components/kbd.d.ts +6 -0
- package/dist/components/kbd.js +19 -0
- package/dist/components/kinetic-click.d.ts +48 -0
- package/dist/components/kinetic-click.js +1184 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.js +18 -0
- package/dist/components/list-box.d.ts +20 -0
- package/dist/components/list-box.js +148 -0
- package/dist/components/loader.d.ts +13 -0
- package/dist/components/loader.js +430 -0
- package/dist/components/marker.d.ts +15 -0
- package/dist/components/marker.js +59 -0
- package/dist/components/menu.d.ts +42 -0
- package/dist/components/menu.js +186 -0
- package/dist/components/menubar.d.ts +40 -0
- package/dist/components/menubar.js +107 -0
- package/dist/components/message.d.ts +33 -0
- package/dist/components/message.js +112 -0
- package/dist/components/meter.d.ts +10 -0
- package/dist/components/meter.js +42 -0
- package/dist/components/morphic-toast.d.ts +61 -0
- package/dist/components/morphic-toast.js +916 -0
- package/dist/components/navigation-menu.d.ts +26 -0
- package/dist/components/navigation-menu.js +116 -0
- package/dist/components/number-field.d.ts +15 -0
- package/dist/components/number-field.js +86 -0
- package/dist/components/option-picker.d.ts +18 -0
- package/dist/components/option-picker.js +89 -0
- package/dist/components/orb.d.ts +38 -0
- package/dist/components/orb.js +1413 -0
- package/dist/components/pagination.d.ts +25 -0
- package/dist/components/pagination.js +147 -0
- package/dist/components/popover.d.ts +22 -0
- package/dist/components/popover.js +79 -0
- package/dist/components/preview-card.d.ts +16 -0
- package/dist/components/preview-card.js +60 -0
- package/dist/components/progress.d.ts +21 -0
- package/dist/components/progress.js +139 -0
- package/dist/components/radio.d.ts +16 -0
- package/dist/components/radio.js +68 -0
- package/dist/components/resizable.d.ts +58 -0
- package/dist/components/resizable.js +964 -0
- package/dist/components/ruler-picker.d.ts +27 -0
- package/dist/components/ruler-picker.js +253 -0
- package/dist/components/scroll-area.d.ts +13 -0
- package/dist/components/scroll-area.js +34 -0
- package/dist/components/scroll-bar.d.ts +13 -0
- package/dist/components/scroll-bar.js +47 -0
- package/dist/components/select.d.ts +29 -0
- package/dist/components/select.js +140 -0
- package/dist/components/separator.d.ts +6 -0
- package/dist/components/separator.js +15 -0
- package/dist/components/sidebar.d.ts +65 -0
- package/dist/components/sidebar.js +408 -0
- package/dist/components/skeleton.d.ts +5 -0
- package/dist/components/skeleton.js +12 -0
- package/dist/components/slider.d.ts +12 -0
- package/dist/components/slider.js +96 -0
- package/dist/components/sortable.d.ts +44 -0
- package/dist/components/sortable.js +327 -0
- package/dist/components/switch.d.ts +15 -0
- package/dist/components/switch.js +63 -0
- package/dist/components/table.d.ts +12 -0
- package/dist/components/table.js +65 -0
- package/dist/components/tabs.d.ts +12 -0
- package/dist/components/tabs.js +39 -0
- package/dist/components/text.d.ts +14 -0
- package/dist/components/text.js +69 -0
- package/dist/components/textarea.d.ts +9 -0
- package/dist/components/textarea.js +20 -0
- package/dist/components/theme-provider.d.ts +52 -0
- package/dist/components/theme-provider.js +148 -0
- package/dist/components/timeline.d.ts +34 -0
- package/dist/components/timeline.js +147 -0
- package/dist/components/toast.d.ts +17 -0
- package/dist/components/toast.js +161 -0
- package/dist/components/toggle-group.d.ts +14 -0
- package/dist/components/toggle-group.js +53 -0
- package/dist/components/toggle.d.ts +11 -0
- package/dist/components/toggle.js +36 -0
- package/dist/components/toolbar.d.ts +11 -0
- package/dist/components/toolbar.js +49 -0
- package/dist/components/tooltip.d.ts +17 -0
- package/dist/components/tooltip.js +56 -0
- package/dist/components/waveform.d.ts +61 -0
- package/dist/components/waveform.js +500 -0
- package/dist/components/wheel-picker.d.ts +44 -0
- package/dist/components/wheel-picker.js +771 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +9 -0
- package/dist/hooks/use-copy-to-clipboard.js +36 -0
- package/dist/hooks/use-media-query.d.ts +21 -0
- package/dist/hooks/use-media-query.js +58 -0
- package/dist/styles.css +202 -0
- package/dist/themes/afterglow.css +89 -0
- package/dist/themes/afterglow.scoped.css +90 -0
- package/dist/themes/blacklight.css +89 -0
- package/dist/themes/blacklight.scoped.css +90 -0
- package/dist/themes/cathode.css +89 -0
- package/dist/themes/cathode.scoped.css +90 -0
- package/dist/themes/cel.css +89 -0
- package/dist/themes/cel.scoped.css +90 -0
- package/dist/themes/cinder.css +89 -0
- package/dist/themes/cinder.scoped.css +90 -0
- package/dist/themes/clay.css +89 -0
- package/dist/themes/clay.scoped.css +90 -0
- package/dist/themes/cobalt.css +89 -0
- package/dist/themes/cobalt.scoped.css +90 -0
- package/dist/themes/crimson.css +89 -0
- package/dist/themes/crimson.scoped.css +90 -0
- package/dist/themes/ion.css +89 -0
- package/dist/themes/ion.scoped.css +90 -0
- package/dist/themes/iris.css +89 -0
- package/dist/themes/iris.scoped.css +90 -0
- package/dist/themes/lagoon.css +89 -0
- package/dist/themes/lagoon.scoped.css +90 -0
- package/dist/themes/mochi.css +89 -0
- package/dist/themes/mochi.scoped.css +90 -0
- package/dist/themes/riso.css +89 -0
- package/dist/themes/riso.scoped.css +90 -0
- package/dist/themes/roast.css +89 -0
- package/dist/themes/roast.scoped.css +90 -0
- package/dist/themes/sage.css +89 -0
- package/dist/themes/sage.scoped.css +90 -0
- package/dist/themes/sepia.css +89 -0
- package/dist/themes/sepia.scoped.css +90 -0
- package/dist/themes/sorbet.css +89 -0
- package/dist/themes/sorbet.scoped.css +90 -0
- package/dist/themes/taffy.css +89 -0
- package/dist/themes/taffy.scoped.css +90 -0
- package/dist/themes/toxin.css +89 -0
- package/dist/themes/toxin.scoped.css +90 -0
- package/package.json +140 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Button } from "./button.js";
|
|
3
|
+
import { Popover, PopoverContent as PopoverPopup, PopoverTrigger } from "./popover.js";
|
|
4
|
+
import { Calendar as Calendar$1 } from "./calendar.js";
|
|
5
|
+
import { InputGroup, InputGroupAddon, InputGroupInput } from "./input-group.js";
|
|
6
|
+
import { cn } from "cn";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import * as React$1 from "react";
|
|
9
|
+
import { Calendar } from "xiod-icons/icons/Calendar";
|
|
10
|
+
//#region src/components/date-picker.tsx
|
|
11
|
+
const MONTHS = [
|
|
12
|
+
"January",
|
|
13
|
+
"February",
|
|
14
|
+
"March",
|
|
15
|
+
"April",
|
|
16
|
+
"May",
|
|
17
|
+
"June",
|
|
18
|
+
"July",
|
|
19
|
+
"August",
|
|
20
|
+
"September",
|
|
21
|
+
"October",
|
|
22
|
+
"November",
|
|
23
|
+
"December"
|
|
24
|
+
];
|
|
25
|
+
const MONTHS_SHORT = [
|
|
26
|
+
"Jan",
|
|
27
|
+
"Feb",
|
|
28
|
+
"Mar",
|
|
29
|
+
"Apr",
|
|
30
|
+
"May",
|
|
31
|
+
"Jun",
|
|
32
|
+
"Jul",
|
|
33
|
+
"Aug",
|
|
34
|
+
"Sep",
|
|
35
|
+
"Oct",
|
|
36
|
+
"Nov",
|
|
37
|
+
"Dec"
|
|
38
|
+
];
|
|
39
|
+
const formatSingleDate = (d, style = "PPP") => {
|
|
40
|
+
if (style === "yyyy-MM-dd") return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
41
|
+
const day = d.getDate();
|
|
42
|
+
const month = MONTHS_SHORT[d.getMonth()];
|
|
43
|
+
const year = d.getFullYear();
|
|
44
|
+
if (style === "LLL dd, y") return `${month} ${day}, ${year}`;
|
|
45
|
+
return `${MONTHS[d.getMonth()]} ${day}, ${year}`;
|
|
46
|
+
};
|
|
47
|
+
const parseDateString = (val) => {
|
|
48
|
+
const parts = val.split("-");
|
|
49
|
+
if (parts.length === 3) {
|
|
50
|
+
const y = parseInt(parts[0], 10);
|
|
51
|
+
const m = parseInt(parts[1], 10) - 1;
|
|
52
|
+
const d = parseInt(parts[2], 10);
|
|
53
|
+
if (!Number.isNaN(y) && !Number.isNaN(m) && !Number.isNaN(d) && m >= 0 && m < 12 && d >= 1 && d <= 31) {
|
|
54
|
+
const parsed = new Date(y, m, d);
|
|
55
|
+
if (!Number.isNaN(parsed.getTime())) return parsed;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
};
|
|
60
|
+
function handleInputKeyDown(event) {
|
|
61
|
+
if (event.key === "Enter") event.currentTarget.blur();
|
|
62
|
+
}
|
|
63
|
+
function DatePicker({ className, mode = "single", triggerType = "button", defaultValue, value, onSelect, placeholder, formatStr = "PPP", minDate, maxDate, disabled, numberOfMonths = 1, fixedWeeks = true, weekStartsOn = 0, showOutsideDays = true, disableOutsideDays = false, triggerClassName, triggerVariant = "outline", triggerSize = "default", ...props }) {
|
|
64
|
+
const [open, setOpen] = React$1.useState(false);
|
|
65
|
+
const inputGroupRef = React$1.useRef(null);
|
|
66
|
+
const [uncontrolledVal, setUncontrolledVal] = React$1.useState(defaultValue);
|
|
67
|
+
const isControlled = value !== void 0;
|
|
68
|
+
const activeValue = isControlled ? value : uncontrolledVal;
|
|
69
|
+
const [inputValFrom, setInputValFrom] = React$1.useState("");
|
|
70
|
+
const [inputValTo, setInputValTo] = React$1.useState("");
|
|
71
|
+
React$1.useEffect(() => {
|
|
72
|
+
if (mode === "single") {
|
|
73
|
+
const parsed = parseDateString(inputValFrom);
|
|
74
|
+
if ((activeValue instanceof Date ? activeValue.getTime() : null) !== (parsed ? parsed.getTime() : null)) {
|
|
75
|
+
if (activeValue instanceof Date) setInputValFrom(formatSingleDate(activeValue, "yyyy-MM-dd"));
|
|
76
|
+
else setInputValFrom("");
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
const range = activeValue;
|
|
80
|
+
const parsedFrom = parseDateString(inputValFrom);
|
|
81
|
+
const parsedTo = parseDateString(inputValTo);
|
|
82
|
+
const activeFromTime = range?.from ? range.from.getTime() : null;
|
|
83
|
+
const activeToTime = range?.to ? range.to.getTime() : null;
|
|
84
|
+
const parsedFromTime = parsedFrom ? parsedFrom.getTime() : null;
|
|
85
|
+
const parsedToTime = parsedTo ? parsedTo.getTime() : null;
|
|
86
|
+
if (activeFromTime !== parsedFromTime) {
|
|
87
|
+
if (range?.from) setInputValFrom(formatSingleDate(range.from, "yyyy-MM-dd"));
|
|
88
|
+
else setInputValFrom("");
|
|
89
|
+
}
|
|
90
|
+
if (activeToTime !== parsedToTime) {
|
|
91
|
+
if (range?.to) setInputValTo(formatSingleDate(range.to, "yyyy-MM-dd"));
|
|
92
|
+
else setInputValTo("");
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}, [
|
|
96
|
+
activeValue,
|
|
97
|
+
mode,
|
|
98
|
+
inputValFrom,
|
|
99
|
+
inputValTo
|
|
100
|
+
]);
|
|
101
|
+
const handleSelect = (val) => {
|
|
102
|
+
if (!isControlled) setUncontrolledVal(val);
|
|
103
|
+
onSelect?.(val);
|
|
104
|
+
if (triggerType === "button") {
|
|
105
|
+
if (mode === "single" && val) setOpen(false);
|
|
106
|
+
else if (mode === "range" && val && typeof val === "object" && "from" in val && "to" in val && val.from && val.to) setOpen(false);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
const handleInputChangeFrom = (e) => {
|
|
110
|
+
const val = e.target.value;
|
|
111
|
+
setInputValFrom(val);
|
|
112
|
+
const parsed = parseDateString(val);
|
|
113
|
+
if (parsed) {
|
|
114
|
+
if (mode === "single") handleSelect(parsed);
|
|
115
|
+
else handleSelect({
|
|
116
|
+
from: parsed,
|
|
117
|
+
to: (activeValue || {}).to
|
|
118
|
+
});
|
|
119
|
+
} else if (val === "") {
|
|
120
|
+
if (mode === "single") handleSelect(void 0);
|
|
121
|
+
else handleSelect({
|
|
122
|
+
from: void 0,
|
|
123
|
+
to: (activeValue || {}).to
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const handleInputChangeTo = (e) => {
|
|
128
|
+
const val = e.target.value;
|
|
129
|
+
setInputValTo(val);
|
|
130
|
+
const parsed = parseDateString(val);
|
|
131
|
+
if (parsed) handleSelect({
|
|
132
|
+
from: (activeValue || {}).from,
|
|
133
|
+
to: parsed
|
|
134
|
+
});
|
|
135
|
+
else if (val === "") handleSelect({
|
|
136
|
+
from: (activeValue || {}).from,
|
|
137
|
+
to: void 0
|
|
138
|
+
});
|
|
139
|
+
};
|
|
140
|
+
const handleInputBlurFrom = () => {
|
|
141
|
+
const parsed = parseDateString(inputValFrom);
|
|
142
|
+
if (parsed) setInputValFrom(formatSingleDate(parsed, "yyyy-MM-dd"));
|
|
143
|
+
else if (mode === "single") {
|
|
144
|
+
if (activeValue instanceof Date) setInputValFrom(formatSingleDate(activeValue, "yyyy-MM-dd"));
|
|
145
|
+
else setInputValFrom("");
|
|
146
|
+
} else {
|
|
147
|
+
const range = activeValue;
|
|
148
|
+
if (range?.from) setInputValFrom(formatSingleDate(range.from, "yyyy-MM-dd"));
|
|
149
|
+
else setInputValFrom("");
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
const handleInputBlurTo = () => {
|
|
153
|
+
const parsed = parseDateString(inputValTo);
|
|
154
|
+
if (parsed) setInputValTo(formatSingleDate(parsed, "yyyy-MM-dd"));
|
|
155
|
+
else {
|
|
156
|
+
const range = activeValue;
|
|
157
|
+
if (range?.to) setInputValTo(formatSingleDate(range.to, "yyyy-MM-dd"));
|
|
158
|
+
else setInputValTo("");
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
const renderTriggerLabel = () => {
|
|
162
|
+
if (mode === "single") return activeValue instanceof Date ? formatSingleDate(activeValue, formatStr) : placeholder || "Pick a date";
|
|
163
|
+
const range = activeValue;
|
|
164
|
+
if (range?.from) {
|
|
165
|
+
if (range.to) return `${formatSingleDate(range.from, "LLL dd, y")} - ${formatSingleDate(range.to, "LLL dd, y")}`;
|
|
166
|
+
return `${formatSingleDate(range.from, "LLL dd, y")} - ...`;
|
|
167
|
+
}
|
|
168
|
+
return placeholder || "Pick a date range";
|
|
169
|
+
};
|
|
170
|
+
return /* @__PURE__ */ jsx("div", {
|
|
171
|
+
"data-slot": "date-picker",
|
|
172
|
+
className: cn("relative w-full max-w-sm", className),
|
|
173
|
+
...props,
|
|
174
|
+
children: /* @__PURE__ */ jsxs(Popover, {
|
|
175
|
+
open,
|
|
176
|
+
onOpenChange: setOpen,
|
|
177
|
+
children: [triggerType === "button" ? /* @__PURE__ */ jsxs(PopoverTrigger, {
|
|
178
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
179
|
+
variant: triggerVariant,
|
|
180
|
+
size: triggerSize,
|
|
181
|
+
className: cn("w-full justify-start text-left font-normal tabular-nums [&_svg]:text-muted-foreground/80 pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11", !activeValue && "text-muted-foreground", triggerClassName)
|
|
182
|
+
}),
|
|
183
|
+
children: [/* @__PURE__ */ jsx(Calendar, { className: "size-4 shrink-0 pointer-events-none mr-2" }), renderTriggerLabel()]
|
|
184
|
+
}) : /* @__PURE__ */ jsxs(InputGroup, {
|
|
185
|
+
ref: inputGroupRef,
|
|
186
|
+
className: "w-full",
|
|
187
|
+
children: [mode === "single" ? /* @__PURE__ */ jsx(InputGroupInput, {
|
|
188
|
+
type: "date",
|
|
189
|
+
placeholder: placeholder || "YYYY-MM-DD",
|
|
190
|
+
value: inputValFrom,
|
|
191
|
+
onChange: handleInputChangeFrom,
|
|
192
|
+
onKeyDown: handleInputKeyDown,
|
|
193
|
+
onBlur: handleInputBlurFrom,
|
|
194
|
+
onClick: (e) => e.stopPropagation(),
|
|
195
|
+
"data-slot": "date-picker-input",
|
|
196
|
+
className: "font-medium tabular-nums *:[input]:[&::-webkit-calendar-picker-indicator]:hidden *:[input]:[&::-webkit-calendar-picker-indicator]:appearance-none [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none"
|
|
197
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
198
|
+
className: "flex items-center gap-1.5 flex-1 px-3 py-1",
|
|
199
|
+
children: [
|
|
200
|
+
/* @__PURE__ */ jsx("input", {
|
|
201
|
+
type: "date",
|
|
202
|
+
placeholder: "Start (YYYY-MM-DD)",
|
|
203
|
+
value: inputValFrom,
|
|
204
|
+
onChange: handleInputChangeFrom,
|
|
205
|
+
onKeyDown: handleInputKeyDown,
|
|
206
|
+
onBlur: handleInputBlurFrom,
|
|
207
|
+
onClick: (e) => e.stopPropagation(),
|
|
208
|
+
"data-slot": "date-picker-input-from",
|
|
209
|
+
className: "bg-transparent border-none outline-none font-medium text-sm w-full tabular-nums text-foreground placeholder:text-muted-foreground/50 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none"
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ jsx("span", {
|
|
212
|
+
className: "text-muted-foreground/50 text-[10px] uppercase font-bold select-none shrink-0",
|
|
213
|
+
children: "to"
|
|
214
|
+
}),
|
|
215
|
+
/* @__PURE__ */ jsx("input", {
|
|
216
|
+
type: "date",
|
|
217
|
+
placeholder: "End (YYYY-MM-DD)",
|
|
218
|
+
value: inputValTo,
|
|
219
|
+
onChange: handleInputChangeTo,
|
|
220
|
+
onKeyDown: handleInputKeyDown,
|
|
221
|
+
onBlur: handleInputBlurTo,
|
|
222
|
+
onClick: (e) => e.stopPropagation(),
|
|
223
|
+
"data-slot": "date-picker-input-to",
|
|
224
|
+
className: "bg-transparent border-none outline-none font-medium text-sm w-full tabular-nums text-foreground placeholder:text-muted-foreground/50 [&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-calendar-picker-indicator]:appearance-none"
|
|
225
|
+
})
|
|
226
|
+
]
|
|
227
|
+
}), /* @__PURE__ */ jsx(InputGroupAddon, { children: /* @__PURE__ */ jsx(PopoverTrigger, {
|
|
228
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
229
|
+
size: "icon-xs",
|
|
230
|
+
variant: "ghost",
|
|
231
|
+
className: "pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11",
|
|
232
|
+
"aria-label": "Open Calendar popup"
|
|
233
|
+
}),
|
|
234
|
+
children: /* @__PURE__ */ jsx(Calendar, { className: "size-4 shrink-0 pointer-events-none" })
|
|
235
|
+
}) })]
|
|
236
|
+
}), /* @__PURE__ */ jsx(PopoverPopup, {
|
|
237
|
+
align: "start",
|
|
238
|
+
alignOffset: triggerType === "input" ? -1 : 0,
|
|
239
|
+
sideOffset: 8,
|
|
240
|
+
anchor: triggerType === "input" ? inputGroupRef : void 0,
|
|
241
|
+
children: /* @__PURE__ */ jsx(Calendar$1, {
|
|
242
|
+
mode,
|
|
243
|
+
selected: activeValue,
|
|
244
|
+
onSelect: handleSelect,
|
|
245
|
+
minDate,
|
|
246
|
+
maxDate,
|
|
247
|
+
disabled,
|
|
248
|
+
numberOfMonths,
|
|
249
|
+
fixedWeeks,
|
|
250
|
+
weekStartsOn,
|
|
251
|
+
showOutsideDays,
|
|
252
|
+
disableOutsideDays,
|
|
253
|
+
className: "border-none bg-transparent shadow-none p-0 before:shadow-none!"
|
|
254
|
+
})
|
|
255
|
+
})]
|
|
256
|
+
})
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
DatePicker.displayName = "DatePicker";
|
|
260
|
+
//#endregion
|
|
261
|
+
export { DatePicker };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
3
|
+
//#region src/components/dialog.d.ts
|
|
4
|
+
declare const DialogCreateHandle: typeof Dialog$1.createHandle;
|
|
5
|
+
declare const Dialog: <Payload>(props: Dialog$1.Root.Props<Payload>) => React$1.JSX.Element;
|
|
6
|
+
declare const DialogPortal: React$1.ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogPortalProps, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare function DialogTrigger(props: Dialog$1.Trigger.Props): React$1.JSX.Element;
|
|
8
|
+
declare function DialogClose(props: Dialog$1.Close.Props): React$1.JSX.Element;
|
|
9
|
+
declare function DialogBackdrop({ className, ...props }: Dialog$1.Backdrop.Props): React$1.JSX.Element;
|
|
10
|
+
declare function DialogViewport({ className, ...props }: Dialog$1.Viewport.Props): React$1.JSX.Element;
|
|
11
|
+
declare function DialogPopup({ className, children, showCloseButton, bottomStickOnMobile, closeProps, ...props }: Dialog$1.Popup.Props & {
|
|
12
|
+
showCloseButton?: boolean;
|
|
13
|
+
bottomStickOnMobile?: boolean;
|
|
14
|
+
closeProps?: Dialog$1.Close.Props;
|
|
15
|
+
}): React$1.JSX.Element;
|
|
16
|
+
declare function DialogHeader({ className, ...props }: React$1.ComponentProps<"div">): React$1.JSX.Element;
|
|
17
|
+
declare function DialogFooter({ className, variant, ...props }: React$1.ComponentProps<"div"> & {
|
|
18
|
+
variant?: "default" | "bare";
|
|
19
|
+
}): React$1.JSX.Element;
|
|
20
|
+
declare function DialogTitle({ className, ...props }: Dialog$1.Title.Props): React$1.JSX.Element;
|
|
21
|
+
declare function DialogDescription({ className, ...props }: Dialog$1.Description.Props): React$1.JSX.Element;
|
|
22
|
+
declare function DialogPanel({ className, scrollFade, ...props }: React$1.ComponentProps<"div"> & {
|
|
23
|
+
scrollFade?: boolean;
|
|
24
|
+
}): React$1.JSX.Element;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { Dialog, DialogBackdrop, DialogBackdrop as DialogOverlay, DialogClose, DialogPopup as DialogContent, DialogPopup, DialogCreateHandle, DialogDescription, DialogFooter, DialogHeader, DialogPanel, DialogPortal, DialogTitle, DialogTrigger, DialogViewport };
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ScrollArea } from "./scroll-area.js";
|
|
3
|
+
import { Button } from "./button.js";
|
|
4
|
+
import { cn } from "cn";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Cancel } from "xiod-icons/icons/Cancel";
|
|
7
|
+
import { Dialog as Dialog$1 } from "@base-ui/react/dialog";
|
|
8
|
+
//#region src/components/dialog.tsx
|
|
9
|
+
const DialogCreateHandle = Dialog$1.createHandle;
|
|
10
|
+
const Dialog = Dialog$1.Root;
|
|
11
|
+
const DialogPortal = Dialog$1.Portal;
|
|
12
|
+
function DialogTrigger(props) {
|
|
13
|
+
return /* @__PURE__ */ jsx(Dialog$1.Trigger, {
|
|
14
|
+
"data-slot": "dialog-trigger",
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
function DialogClose(props) {
|
|
19
|
+
return /* @__PURE__ */ jsx(Dialog$1.Close, {
|
|
20
|
+
"data-slot": "dialog-close",
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function DialogBackdrop({ className, ...props }) {
|
|
25
|
+
return /* @__PURE__ */ jsx(Dialog$1.Backdrop, {
|
|
26
|
+
className: cn("fixed inset-0 z-50 bg-black/32 backdrop-blur-sm transition-all duration-200 data-ending-style:opacity-0 data-starting-style:opacity-0", className),
|
|
27
|
+
"data-slot": "dialog-backdrop",
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function DialogViewport({ className, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx(Dialog$1.Viewport, {
|
|
33
|
+
className: cn("fixed inset-0 z-50 grid grid-rows-[1fr_auto_3fr] justify-items-center p-4", className),
|
|
34
|
+
"data-slot": "dialog-viewport",
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function DialogPopup({ className, children, showCloseButton = true, bottomStickOnMobile = true, closeProps, ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogBackdrop, {}), /* @__PURE__ */ jsx(DialogViewport, {
|
|
40
|
+
className: cn(bottomStickOnMobile && "max-sm:grid-rows-[1fr_auto] max-sm:p-0 max-sm:pt-12"),
|
|
41
|
+
children: /* @__PURE__ */ jsxs(Dialog$1.Popup, {
|
|
42
|
+
className: cn("translate-y-[calc(-1.25rem*var(--nested-dialogs))] relative row-start-2 flex max-h-full min-h-0 w-full min-w-0 max-w-lg scale-[calc(1-0.1*var(--nested-dialogs))] flex-col rounded-2xl border bg-popover not-dark:bg-clip-padding text-popover-foreground opacity-[calc(1-0.1*var(--nested-dialogs))] shadow-lg/5 transition-[scale,opacity,translate] duration-200 ease-in-out will-change-transform before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] data-nested:data-ending-style:translate-y-8 data-nested:data-starting-style:translate-y-8 data-nested-dialog-open:origin-top data-ending-style:scale-98 data-starting-style:scale-98 data-ending-style:opacity-0 data-starting-style:opacity-0 dark:before:shadow-[0_-1px_--theme(--color-white/6%)]", bottomStickOnMobile && "max-sm:max-w-none max-sm:rounded-none max-sm:border-x-0 max-sm:border-t max-sm:border-b-0 max-sm:opacity-[calc(1-min(var(--nested-dialogs),1))] max-sm:data-ending-style:translate-y-4 max-sm:data-starting-style:translate-y-4 max-sm:before:hidden max-sm:before:rounded-none", className),
|
|
43
|
+
"data-slot": "dialog-popup",
|
|
44
|
+
...props,
|
|
45
|
+
children: [children, showCloseButton && /* @__PURE__ */ jsx(Dialog$1.Close, {
|
|
46
|
+
"aria-label": "Close",
|
|
47
|
+
className: "absolute inset-e-2 top-2",
|
|
48
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
49
|
+
size: "icon",
|
|
50
|
+
variant: "ghost"
|
|
51
|
+
}),
|
|
52
|
+
...closeProps,
|
|
53
|
+
children: /* @__PURE__ */ jsx(Cancel, {})
|
|
54
|
+
})]
|
|
55
|
+
})
|
|
56
|
+
})] });
|
|
57
|
+
}
|
|
58
|
+
function DialogHeader({ className, ...props }) {
|
|
59
|
+
return /* @__PURE__ */ jsx("div", {
|
|
60
|
+
className: cn("flex flex-col gap-2 p-6 in-[[data-slot=dialog-popup]:has([data-slot=dialog-panel])]:pb-3 max-sm:pb-4", className),
|
|
61
|
+
"data-slot": "dialog-header",
|
|
62
|
+
...props
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function DialogFooter({ className, variant = "default", ...props }) {
|
|
66
|
+
return /* @__PURE__ */ jsx("div", {
|
|
67
|
+
className: cn("flex flex-col-reverse gap-2 px-6 sm:flex-row sm:justify-end sm:rounded-b-[calc(var(--radius-2xl)-1px)]", variant === "default" && "border-t bg-muted/72 pt-[calc(--spacing(4)-1px)] pb-4", variant === "bare" && "in-[[data-slot=dialog-popup]:has([data-slot=dialog-panel])]:pt-3 pt-4 pb-6", className),
|
|
68
|
+
"data-slot": "dialog-footer",
|
|
69
|
+
...props
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function DialogTitle({ className, ...props }) {
|
|
73
|
+
return /* @__PURE__ */ jsx(Dialog$1.Title, {
|
|
74
|
+
className: cn("font-heading font-semibold text-xl leading-none", className),
|
|
75
|
+
"data-slot": "dialog-title",
|
|
76
|
+
...props
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function DialogDescription({ className, ...props }) {
|
|
80
|
+
return /* @__PURE__ */ jsx(Dialog$1.Description, {
|
|
81
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
82
|
+
"data-slot": "dialog-description",
|
|
83
|
+
...props
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
function DialogPanel({ className, scrollFade = true, ...props }) {
|
|
87
|
+
return /* @__PURE__ */ jsx(ScrollArea, {
|
|
88
|
+
scrollFade,
|
|
89
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
90
|
+
className: cn("p-6 in-[[data-slot=dialog-popup]:has([data-slot=dialog-header])]:pt-1 in-[[data-slot=dialog-popup]:has([data-slot=dialog-footer]:not(.border-t))]:pb-1", className),
|
|
91
|
+
"data-slot": "dialog-panel",
|
|
92
|
+
...props
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
export { Dialog, DialogBackdrop, DialogBackdrop as DialogOverlay, DialogClose, DialogPopup as DialogContent, DialogPopup, DialogCreateHandle, DialogDescription, DialogFooter, DialogHeader, DialogPanel, DialogPortal, DialogTitle, DialogTrigger, DialogViewport };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/components/dot-matrix.d.ts
|
|
3
|
+
export type DotMatrixShape = "circle" | "square" | "diamond" | "heart";
|
|
4
|
+
export type DotMatrixPreset = "ripple" | "spiral" | "snake" | "wave" | "wave-vertical" | "pulse" | "diagonal" | "diagonal-reverse" | "rotor" | "columns-flux" | "helix" | "infinity" | "heart-pulse" | "orbit" | "matrix-rain" | "sine-wave" | "crt-glide" | "twin-orbit" | "rung-shift" | "lunar-breath" | "nova-wheel" | "prism-bloom" | "half-helix" | "honey-gate" | "spiral-lattice" | "altitude-wave" | "glyph-cluster" | "rail-scan" | "halo-drift" | "none";
|
|
5
|
+
export type DotMatrixColorPreset = "solid" | "sunset" | "ocean" | "neon" | "aurora" | "fire" | "prism";
|
|
6
|
+
export interface DotMatrixProps extends React$1.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
rows?: number;
|
|
8
|
+
cols?: number;
|
|
9
|
+
mode?: "animation" | "static" | "vu";
|
|
10
|
+
pattern?: number[][] | boolean[][];
|
|
11
|
+
preset?: DotMatrixPreset;
|
|
12
|
+
frames?: number[][][];
|
|
13
|
+
isPlaying?: boolean;
|
|
14
|
+
loop?: boolean;
|
|
15
|
+
autoplay?: boolean;
|
|
16
|
+
fps?: number;
|
|
17
|
+
speed?: number;
|
|
18
|
+
levels?: number[];
|
|
19
|
+
dotSize?: number;
|
|
20
|
+
gap?: number;
|
|
21
|
+
shape?: DotMatrixShape;
|
|
22
|
+
colorPreset?: DotMatrixColorPreset;
|
|
23
|
+
color?: string;
|
|
24
|
+
colorOff?: string;
|
|
25
|
+
bloom?: boolean;
|
|
26
|
+
bloomIntensity?: number;
|
|
27
|
+
halo?: boolean;
|
|
28
|
+
ariaLabel?: string;
|
|
29
|
+
onFrame?: (index: number) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare function DotMatrix({ rows, cols, mode, pattern, preset, frames, isPlaying, loop, autoplay, fps, speed, levels, dotSize, gap, shape, colorPreset, color, colorOff, bloom, bloomIntensity, halo, ariaLabel, className, onFrame, ...props }: DotMatrixProps): React$1.JSX.Element;
|
|
32
|
+
//#endregion
|