@gspa/ui 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -0
- package/dist/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +9 -0
- package/dist/components/Accordion.cjs +1 -0
- package/dist/components/Accordion.js +192 -0
- package/dist/components/AccordionItem.cjs +1 -0
- package/dist/components/AccordionItem.js +109 -0
- package/dist/components/AddReminderModal.cjs +1 -0
- package/dist/components/AddReminderModal.js +107 -0
- package/dist/components/Alert.cjs +1 -0
- package/dist/components/Alert.js +222 -0
- package/dist/components/Avatar.cjs +1 -0
- package/dist/components/Avatar.js +86 -0
- package/dist/components/Badge.cjs +1 -0
- package/dist/components/Badge.js +109 -0
- package/dist/components/Breadcrumb.cjs +1 -0
- package/dist/components/Breadcrumb.js +72 -0
- package/dist/components/Button.cjs +1 -0
- package/dist/components/Button.js +190 -0
- package/dist/components/ButtonGroup.cjs +1 -0
- package/dist/components/ButtonGroup.js +46 -0
- package/dist/components/Calendar.cjs +1 -0
- package/dist/components/Calendar.js +341 -0
- package/dist/components/Card.cjs +1 -0
- package/dist/components/Card.js +316 -0
- package/dist/components/CardBody.cjs +1 -0
- package/dist/components/CardBody.js +34 -0
- package/dist/components/CardContent.cjs +1 -0
- package/dist/components/CardContent.js +17 -0
- package/dist/components/CardFooter.cjs +1 -0
- package/dist/components/CardFooter.js +34 -0
- package/dist/components/CardHeader.cjs +1 -0
- package/dist/components/CardHeader.js +91 -0
- package/dist/components/CardTitle.cjs +1 -0
- package/dist/components/CardTitle.js +17 -0
- package/dist/components/Checkbox.cjs +1 -0
- package/dist/components/Checkbox.js +185 -0
- package/dist/components/CircularProgress.cjs +1 -0
- package/dist/components/CircularProgress.js +141 -0
- package/dist/components/DataTable.cjs +1 -0
- package/dist/components/DataTable.js +863 -0
- package/dist/components/DataTableCell.cjs +1 -0
- package/dist/components/DataTableCell.js +95 -0
- package/dist/components/DataTableFilters.cjs +1 -0
- package/dist/components/DataTableFilters.js +519 -0
- package/dist/components/DataTableHeader.cjs +1 -0
- package/dist/components/DataTableHeader.js +116 -0
- package/dist/components/DataTablePagination.cjs +1 -0
- package/dist/components/DataTablePagination.js +290 -0
- package/dist/components/DataTableRow.cjs +1 -0
- package/dist/components/DataTableRow.js +199 -0
- package/dist/components/DataTableToolBar.cjs +1 -0
- package/dist/components/DataTableToolBar.js +477 -0
- package/dist/components/DatePicker.cjs +1 -0
- package/dist/components/DatePicker.js +401 -0
- package/dist/components/Divider.cjs +1 -0
- package/dist/components/Divider.js +103 -0
- package/dist/components/Dropdown.cjs +1 -0
- package/dist/components/Dropdown.js +104 -0
- package/dist/components/DropdownItem.cjs +1 -0
- package/dist/components/DropdownItem.js +60 -0
- package/dist/components/EventsCalendar.cjs +1 -0
- package/dist/components/EventsCalendar.js +863 -0
- package/dist/components/FileUpload.cjs +1 -0
- package/dist/components/FileUpload.js +195 -0
- package/dist/components/FilterDrawer.cjs +1 -0
- package/dist/components/FilterDrawer.js +412 -0
- package/dist/components/Footer.cjs +1 -0
- package/dist/components/Footer.js +157 -0
- package/dist/components/FormField.cjs +1 -0
- package/dist/components/FormField.js +190 -0
- package/dist/components/Graph.cjs +1 -0
- package/dist/components/Graph.js +164 -0
- package/dist/components/GraphFilters.cjs +1 -0
- package/dist/components/GraphFilters.js +305 -0
- package/dist/components/Header.cjs +1 -0
- package/dist/components/Header.js +674 -0
- package/dist/components/Icon.cjs +1 -0
- package/dist/components/Icon.js +51 -0
- package/dist/components/Image.cjs +1 -0
- package/dist/components/Image.js +112 -0
- package/dist/components/Input.cjs +1 -0
- package/dist/components/Input.js +166 -0
- package/dist/components/InputGroup.cjs +1 -0
- package/dist/components/InputGroup.js +45 -0
- package/dist/components/Label.cjs +1 -0
- package/dist/components/Label.js +46 -0
- package/dist/components/Link.cjs +1 -0
- package/dist/components/Link.js +119 -0
- package/dist/components/ListItem.cjs +1 -0
- package/dist/components/ListItem.js +89 -0
- package/dist/components/Loader.cjs +1 -0
- package/dist/components/Loader.js +154 -0
- package/dist/components/Logo.cjs +1 -0
- package/dist/components/Logo.js +67 -0
- package/dist/components/MenuItem.cjs +1 -0
- package/dist/components/MenuItem.js +66 -0
- package/dist/components/Modal.cjs +1 -0
- package/dist/components/Modal.js +110 -0
- package/dist/components/ModalBody.cjs +1 -0
- package/dist/components/ModalBody.js +33 -0
- package/dist/components/ModalFooter.cjs +1 -0
- package/dist/components/ModalFooter.js +33 -0
- package/dist/components/ModalHeader.cjs +1 -0
- package/dist/components/ModalHeader.js +24 -0
- package/dist/components/MultiSelect.cjs +1 -0
- package/dist/components/MultiSelect.js +211 -0
- package/dist/components/Notification.cjs +1 -0
- package/dist/components/Notification.js +121 -0
- package/dist/components/Option.cjs +1 -0
- package/dist/components/Option.js +44 -0
- package/dist/components/Progress.cjs +1 -0
- package/dist/components/Progress.js +77 -0
- package/dist/components/ProgressBar.cjs +1 -0
- package/dist/components/ProgressBar.js +101 -0
- package/dist/components/Radio.cjs +1 -0
- package/dist/components/Radio.js +81 -0
- package/dist/components/RailNav.cjs +1 -0
- package/dist/components/RailNav.js +124 -0
- package/dist/components/ReminderConfig.cjs +1 -0
- package/dist/components/ReminderConfig.js +375 -0
- package/dist/components/ReusableForm.cjs +1 -0
- package/dist/components/ReusableForm.js +657 -0
- package/dist/components/ReusableFormModal.cjs +1 -0
- package/dist/components/ReusableFormModal.js +112 -0
- package/dist/components/RightDrawer.cjs +1 -0
- package/dist/components/RightDrawer.js +143 -0
- package/dist/components/Search.cjs +1 -0
- package/dist/components/Search.js +252 -0
- package/dist/components/Select.cjs +1 -0
- package/dist/components/Select.js +243 -0
- package/dist/components/Sidebar.cjs +1 -0
- package/dist/components/Sidebar.js +372 -0
- package/dist/components/Slider.cjs +1 -0
- package/dist/components/Slider.js +42 -0
- package/dist/components/Spinner.cjs +1 -0
- package/dist/components/Spinner.js +87 -0
- package/dist/components/Stepper.cjs +1 -0
- package/dist/components/Stepper.js +12 -0
- package/dist/components/StepperItem.cjs +1 -0
- package/dist/components/StepperItem.js +33 -0
- package/dist/components/Switch.cjs +1 -0
- package/dist/components/Switch.js +112 -0
- package/dist/components/Tab.cjs +1 -0
- package/dist/components/Tab.js +134 -0
- package/dist/components/TabPanel.cjs +1 -0
- package/dist/components/TabPanel.js +49 -0
- package/dist/components/Text.cjs +1 -0
- package/dist/components/Text.js +84 -0
- package/dist/components/Textarea.cjs +1 -0
- package/dist/components/Textarea.js +102 -0
- package/dist/components/ThemeConfigurator.cjs +1 -0
- package/dist/components/ThemeConfigurator.js +50 -0
- package/dist/components/Timeline.cjs +1 -0
- package/dist/components/Timeline.js +24 -0
- package/dist/components/TimelineItem.cjs +1 -0
- package/dist/components/TimelineItem.js +63 -0
- package/dist/components/Toast.cjs +1 -0
- package/dist/components/Toast.js +231 -0
- package/dist/components/Tooltip.cjs +1 -0
- package/dist/components/Tooltip.js +124 -0
- package/dist/components/Typography.cjs +1 -0
- package/dist/components/Typography.js +267 -0
- package/dist/components/charts/BarChart.cjs +1 -0
- package/dist/components/charts/BarChart.js +323 -0
- package/dist/components/charts/LineChart.cjs +1 -0
- package/dist/components/charts/LineChart.js +322 -0
- package/dist/components/charts/PieChart.cjs +1 -0
- package/dist/components/charts/PieChart.js +311 -0
- package/dist/components/charts/StackedBarChart.cjs +1 -0
- package/dist/components/charts/StackedBarChart.js +348 -0
- package/dist/components/widgets/DashboardWidget.cjs +1 -0
- package/dist/components/widgets/DashboardWidget.js +309 -0
- package/dist/directives/tooltip.cjs +47 -0
- package/dist/directives/tooltip.js +115 -0
- package/dist/index.cjs +1 -0
- package/dist/index.esm.js +311 -19548
- package/dist/layouts/AuthLayout.cjs +1 -0
- package/dist/layouts/AuthLayout.js +190 -0
- package/dist/layouts/DashboardLayout.cjs +1 -0
- package/dist/layouts/DashboardLayout.js +244 -0
- package/dist/layouts/DefaultLayout.cjs +1 -0
- package/dist/layouts/DefaultLayout.js +94 -0
- package/dist/layouts/ErrorLayout.cjs +1 -0
- package/dist/layouts/ErrorLayout.js +452 -0
- package/dist/lib/auth.cjs +1 -0
- package/dist/lib/auth.js +4 -0
- package/dist/lib/theme.cjs +1 -0
- package/dist/lib/theme.js +135 -0
- package/dist/lib/toast.cjs +1 -0
- package/dist/lib/toast.js +81 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/cn.cjs +1 -0
- package/dist/utils/cn.js +7 -0
- package/package.json +37 -7
- package/dist/index.js +0 -605
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { inject as x, computed as i, createElementBlock as s, createCommentVNode as a, openBlock as n, mergeProps as y, unref as h, createBlock as z, renderSlot as k, normalizeClass as g, createElementVNode as m, toDisplayString as B } from "vue";
|
|
2
|
+
import { cva as S } from "class-variance-authority";
|
|
3
|
+
import { cn as O } from "../utils/cn.js";
|
|
4
|
+
import A from "./Icon.js";
|
|
5
|
+
import { AUTH_RESOLVER_KEY as C } from "../lib/auth.js";
|
|
6
|
+
const E = ["disabled", "aria-disabled", "aria-busy"], M = { key: 2 }, D = /* @__PURE__ */ Object.assign({
|
|
7
|
+
inheritAttrs: !1
|
|
8
|
+
}, {
|
|
9
|
+
__name: "Button",
|
|
10
|
+
props: {
|
|
11
|
+
variant: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: "default",
|
|
14
|
+
validator: (r) => [
|
|
15
|
+
"primary",
|
|
16
|
+
"default",
|
|
17
|
+
"danger",
|
|
18
|
+
"outline",
|
|
19
|
+
"secondary",
|
|
20
|
+
"ghost",
|
|
21
|
+
"link",
|
|
22
|
+
"success",
|
|
23
|
+
"warning",
|
|
24
|
+
"info",
|
|
25
|
+
"subtle",
|
|
26
|
+
"dark",
|
|
27
|
+
"light",
|
|
28
|
+
"primaryOutline",
|
|
29
|
+
"dangerOutline",
|
|
30
|
+
"successOutline",
|
|
31
|
+
"gradient"
|
|
32
|
+
].includes(r)
|
|
33
|
+
},
|
|
34
|
+
size: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: "default",
|
|
37
|
+
validator: (r) => ["2xs", "xs", "sm", "default", "md", "lg", "xl", "2xl", "icon-sm", "icon", "icon-lg"].includes(r)
|
|
38
|
+
},
|
|
39
|
+
disabled: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: !1
|
|
42
|
+
},
|
|
43
|
+
loading: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: !1
|
|
46
|
+
},
|
|
47
|
+
loadingText: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: null
|
|
50
|
+
},
|
|
51
|
+
icon: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: null
|
|
54
|
+
},
|
|
55
|
+
permission: {
|
|
56
|
+
type: [String, Array, Boolean, Function],
|
|
57
|
+
default: null
|
|
58
|
+
},
|
|
59
|
+
role: {
|
|
60
|
+
type: [String, Array, Boolean, Function],
|
|
61
|
+
default: null
|
|
62
|
+
},
|
|
63
|
+
requireAll: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: !1
|
|
66
|
+
},
|
|
67
|
+
unauthorized: {
|
|
68
|
+
type: String,
|
|
69
|
+
default: "show",
|
|
70
|
+
validator: (r) => ["show", "hide", "disable"].includes(r)
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
setup(r) {
|
|
74
|
+
const o = r, d = x(C, null), u = (e) => e == null ? null : typeof e == "boolean" ? e : typeof e == "function" ? !!e() : e, l = i(() => {
|
|
75
|
+
const e = u(o.permission), t = u(o.role);
|
|
76
|
+
return e === null && t === null ? !0 : (e === null || typeof e == "boolean") && (t === null || typeof t == "boolean") ? (e ?? !0) && (t ?? !0) : typeof d == "function" ? !!d({
|
|
77
|
+
permission: e,
|
|
78
|
+
role: t,
|
|
79
|
+
requireAll: o.requireAll
|
|
80
|
+
}) : !0;
|
|
81
|
+
}), b = i(() => o.unauthorized === "hide" && !l.value), f = i(() => o.unauthorized === "disable" && !l.value), c = i(() => o.disabled || o.loading || f.value), p = S(
|
|
82
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium transition-[color,background-color,border-color,box-shadow,transform] duration-200 ease-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--ui-primary) focus-visible:ring-offset-2 active:scale-[0.98] disabled:pointer-events-none disabled:opacity-50",
|
|
83
|
+
{
|
|
84
|
+
variants: {
|
|
85
|
+
variant: {
|
|
86
|
+
primary: "ui-primary-bg shadow-sm hover:bg-(--ui-primary-strong) hover:shadow-md",
|
|
87
|
+
default: "ui-primary-bg shadow-sm hover:bg-(--ui-primary-strong) hover:shadow-md",
|
|
88
|
+
danger: "ui-danger-bg shadow-sm hover:bg-(--ui-danger-strong) hover:shadow-md",
|
|
89
|
+
outline: "border ui-border-strong ui-surface ui-text hover:bg-(--ui-surface-soft) hover:border-(--ui-primary) hover:text-(--ui-primary)",
|
|
90
|
+
secondary: "border ui-border ui-surface-muted ui-text hover:bg-(--ui-surface-soft) hover:shadow-sm",
|
|
91
|
+
ghost: "bg-transparent ui-text-muted hover:bg-[color:color-mix(in oklab, var(--ui-accent-soft), transparent 40%)] hover:text-(--ui-text)",
|
|
92
|
+
link: "ui-primary underline-offset-4 hover:underline hover:text-(--ui-primary-strong)",
|
|
93
|
+
success: "ui-success-bg shadow-sm hover:bg-(--ui-success-strong) hover:shadow-md",
|
|
94
|
+
warning: "ui-warning-bg shadow-sm hover:bg-(--ui-warning-strong) hover:shadow-md",
|
|
95
|
+
info: "border border-blue-600 bg-blue-600 text-white shadow-sm hover:bg-blue-700 hover:shadow-md dark:border-blue-500 dark:bg-blue-500 dark:text-white dark:hover:bg-blue-400",
|
|
96
|
+
subtle: "border ui-border ui-surface ui-text-muted hover:text-(--ui-text) hover:bg-(--ui-surface-soft)",
|
|
97
|
+
dark: "border border-zinc-900 bg-zinc-900 text-white shadow-sm hover:bg-black hover:shadow-md dark:border-zinc-100 dark:bg-zinc-100 dark:text-zinc-900 dark:hover:bg-white",
|
|
98
|
+
light: "border border-zinc-200 bg-white text-zinc-900 shadow-sm hover:bg-zinc-50 hover:shadow-md dark:border-zinc-700 dark:bg-zinc-900 dark:text-zinc-100 dark:hover:bg-zinc-800",
|
|
99
|
+
primaryOutline: "border border-(--ui-primary) ui-primary bg-transparent hover:bg-(--ui-primary-soft) hover:border-(--ui-primary-strong) hover:text-(--ui-primary-strong)",
|
|
100
|
+
dangerOutline: "border border-(--ui-danger) ui-danger bg-transparent hover:bg-(--ui-danger-soft) hover:border-(--ui-danger-strong) hover:text-(--ui-danger-strong)",
|
|
101
|
+
successOutline: "border border-(--ui-success) ui-success bg-transparent hover:bg-(--ui-success-soft) hover:border-(--ui-success-strong) hover:text-(--ui-success-strong)",
|
|
102
|
+
gradient: "bg-linear-to-r from-(--ui-primary) to-(--ui-accent) ui-text-inverse shadow-sm hover:from-(--ui-primary-strong) hover:to-(--ui-accent-strong) hover:shadow-md"
|
|
103
|
+
},
|
|
104
|
+
size: {
|
|
105
|
+
"2xs": "h-4 px-1 py-3 text-md rounded",
|
|
106
|
+
xs: "h-7 px-2.5 py-1 text-xs rounded-md",
|
|
107
|
+
sm: "h-8 px-3 py-1.5 text-sm rounded-md",
|
|
108
|
+
default: "h-9 px-4 py-2 text-sm rounded-md",
|
|
109
|
+
md: "h-10 px-4 py-2 text-sm rounded-md",
|
|
110
|
+
lg: "h-11 px-6 py-2.5 text-base rounded-md",
|
|
111
|
+
xl: "h-12 px-8 py-3 text-base rounded-lg",
|
|
112
|
+
"2xl": "h-14 px-10 py-3.5 text-lg rounded-lg",
|
|
113
|
+
"icon-sm": "h-8 w-8 p-0",
|
|
114
|
+
icon: "h-10 w-10 p-0",
|
|
115
|
+
"icon-lg": "h-12 w-12 p-0"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
defaultVariants: {
|
|
119
|
+
variant: "default",
|
|
120
|
+
size: "default"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
), v = i(() => ({
|
|
124
|
+
"2xs": "h-3 w-3",
|
|
125
|
+
xs: "h-3.5 w-3.5",
|
|
126
|
+
sm: "h-4 w-4",
|
|
127
|
+
default: "h-4 w-4",
|
|
128
|
+
md: "h-4 w-4",
|
|
129
|
+
lg: "h-5 w-5",
|
|
130
|
+
xl: "h-5 w-5",
|
|
131
|
+
"2xl": "h-6 w-6",
|
|
132
|
+
"icon-sm": "h-4 w-4",
|
|
133
|
+
icon: "h-5 w-5",
|
|
134
|
+
"icon-lg": "h-6 w-6"
|
|
135
|
+
})[o.size] || "h-4 w-4"), w = i(() => ({
|
|
136
|
+
"2xs": "h-3 w-3",
|
|
137
|
+
xs: "h-3.5 w-3.5",
|
|
138
|
+
sm: "h-4 w-4",
|
|
139
|
+
default: "h-4 w-4",
|
|
140
|
+
md: "h-4 w-4",
|
|
141
|
+
lg: "h-5 w-5",
|
|
142
|
+
xl: "h-5 w-5",
|
|
143
|
+
"2xl": "h-6 w-6",
|
|
144
|
+
"icon-sm": "h-4 w-4",
|
|
145
|
+
icon: "h-5 w-5",
|
|
146
|
+
"icon-lg": "h-6 w-6"
|
|
147
|
+
})[o.size] || "h-4 w-4");
|
|
148
|
+
return (e, t) => b.value ? a("", !0) : (n(), s("button", y({
|
|
149
|
+
key: 0,
|
|
150
|
+
class: h(O)(h(p)({ variant: r.variant, size: r.size }), e.$attrs.class),
|
|
151
|
+
disabled: c.value,
|
|
152
|
+
"aria-disabled": c.value,
|
|
153
|
+
"aria-busy": r.loading
|
|
154
|
+
}, e.$attrs), [
|
|
155
|
+
r.loading ? (n(), s("svg", {
|
|
156
|
+
key: 0,
|
|
157
|
+
class: g([w.value, "animate-spin mr-2 text-current"]),
|
|
158
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
159
|
+
fill: "none",
|
|
160
|
+
viewBox: "0 0 24 24"
|
|
161
|
+
}, [...t[0] || (t[0] = [
|
|
162
|
+
m("circle", {
|
|
163
|
+
class: "opacity-25",
|
|
164
|
+
cx: "12",
|
|
165
|
+
cy: "12",
|
|
166
|
+
r: "10",
|
|
167
|
+
stroke: "currentColor",
|
|
168
|
+
"stroke-width": "4"
|
|
169
|
+
}, null, -1),
|
|
170
|
+
m("path", {
|
|
171
|
+
class: "opacity-75",
|
|
172
|
+
fill: "none",
|
|
173
|
+
stroke: "currentColor",
|
|
174
|
+
"stroke-linecap": "round",
|
|
175
|
+
"stroke-width": "4",
|
|
176
|
+
d: "M4 12a8 8 0 018-8"
|
|
177
|
+
}, null, -1)
|
|
178
|
+
])], 2)) : a("", !0),
|
|
179
|
+
r.icon && !r.loading ? (n(), z(A, {
|
|
180
|
+
key: 1,
|
|
181
|
+
icon: r.icon,
|
|
182
|
+
class: g(v.value)
|
|
183
|
+
}, null, 8, ["icon", "class"])) : a("", !0),
|
|
184
|
+
r.loading && r.loadingText ? (n(), s("span", M, B(r.loadingText), 1)) : k(e.$slots, "default", { key: 3 })
|
|
185
|
+
], 16, E));
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
export {
|
|
189
|
+
D as default
|
|
190
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),r=require("class-variance-authority"),a=require("../utils/cn.cjs"),s=["aria-label"],d={__name:"ButtonGroup",props:{orientation:{type:String,default:"horizontal",validator:t=>["horizontal","vertical"].includes(t)},size:{type:String,default:"default",validator:t=>["sm","default","lg"].includes(t)},variant:{type:String,default:"default",validator:t=>["default","outline","ghost"].includes(t)},ariaLabel:String},setup(t){const n=t,o=r.cva("inline-flex ",{variants:{orientation:{horizontal:"flex-row [&>*:not(:first-child)]:ml-[-1px] [&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:first-child]:rounded-r-none [&>*:last-child]:rounded-l-none",vertical:"flex-col [&>*:not(:first-child)]:mt-[-1px] [&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:first-child]:rounded-b-none [&>*:last-child]:rounded-t-none"}}}),l=e.computed(()=>a.cn(o({orientation:n.orientation})));return(i,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(l.value),role:"group","aria-label":t.ariaLabel},[e.renderSlot(i.$slots,"default")],10,s))}};exports.default=d;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { computed as r, createElementBlock as a, openBlock as i, normalizeClass as d, renderSlot as s } from "vue";
|
|
2
|
+
import { cva as c } from "class-variance-authority";
|
|
3
|
+
import { cn as u } from "../utils/cn.js";
|
|
4
|
+
const f = ["aria-label"], g = {
|
|
5
|
+
__name: "ButtonGroup",
|
|
6
|
+
props: {
|
|
7
|
+
orientation: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: "horizontal",
|
|
10
|
+
validator: (t) => ["horizontal", "vertical"].includes(t)
|
|
11
|
+
},
|
|
12
|
+
size: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: "default",
|
|
15
|
+
validator: (t) => ["sm", "default", "lg"].includes(t)
|
|
16
|
+
},
|
|
17
|
+
variant: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: "default",
|
|
20
|
+
validator: (t) => ["default", "outline", "ghost"].includes(t)
|
|
21
|
+
},
|
|
22
|
+
ariaLabel: String
|
|
23
|
+
},
|
|
24
|
+
setup(t) {
|
|
25
|
+
const o = t, n = c("inline-flex ", {
|
|
26
|
+
variants: {
|
|
27
|
+
orientation: {
|
|
28
|
+
horizontal: "flex-row [&>*:not(:first-child)]:ml-[-1px] [&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:first-child]:rounded-r-none [&>*:last-child]:rounded-l-none",
|
|
29
|
+
vertical: "flex-col [&>*:not(:first-child)]:mt-[-1px] [&>*:not(:first-child):not(:last-child)]:rounded-none [&>*:first-child]:rounded-b-none [&>*:last-child]:rounded-t-none"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}), e = r(
|
|
33
|
+
() => u(n({ orientation: o.orientation }))
|
|
34
|
+
);
|
|
35
|
+
return (l, p) => (i(), a("div", {
|
|
36
|
+
class: d(e.value),
|
|
37
|
+
role: "group",
|
|
38
|
+
"aria-label": t.ariaLabel
|
|
39
|
+
}, [
|
|
40
|
+
s(l.$slots, "default")
|
|
41
|
+
], 10, f));
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
g as default
|
|
46
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),H={class:"relative w-full"},O={class:"relative"},A=["id","value","disabled","placeholder","required","aria-describedby"],U={class:"flex items-center justify-between mb-3"},W={class:"text-sm font-medium"},G={class:"grid grid-cols-7 gap-1 mb-2"},J={class:"grid grid-cols-7 gap-1"},K=["disabled","onClick"],Q={key:0,class:"mt-4 pt-3 border-t ui-border-strong"},R={key:0,class:"border-l pl-3 ui-border-strong"},X={class:"max-h-[260px] overflow-y-auto pr-1 space-y-1"},Z=["onClick"],_={__name:"Calendar",props:{id:String,modelValue:[String,Date],disabled:Boolean,required:Boolean,min:[String,Date],max:[String,Date],placeholder:{type:String,default:"Select date"},format:{type:String,default:"MM/DD/YYYY"},clearable:{type:Boolean,default:!0},showToday:{type:Boolean,default:!0},calendarPosition:{type:String,default:"left-0"},ariaDescribedby:String,enableTime:{type:Boolean,default:!1},minuteInterval:{type:Number,default:1}},emits:["update:modelValue"],setup(l,{emit:B}){const s=l,g=B,m=e.ref(!1),f=new Date,r=e.ref(f.getMonth()),i=e.ref(f.getFullYear()),u=e.ref(null),p=e.ref("00:00"),V=["Su","Mo","Tu","We","Th","Fr","Sa"],N=e.computed(()=>new Date(i.value,r.value).toLocaleString("default",{month:"long"})),y=e.computed(()=>new Date(i.value,r.value+1,0).getDate()),M=e.computed(()=>new Date(i.value,r.value,1).getDay()),h=e.computed(()=>{const o=new Date(i.value,r.value,0).getDate(),t=M.value;return Array.from({length:t},(n,a)=>o-t+a+1)}),C=e.computed(()=>{const o=h.value.length+y.value,t=o%7===0?0:7-o%7;return Array.from({length:t},(n,a)=>a+1)}),k=e.computed(()=>u.value?s.enableTime?$(u.value):x(u.value):""),T=e.computed(()=>{const o=Math.min(60,Math.max(1,Number(s.minuteInterval)||1)),t=[];for(let n=0;n<24;n++)for(let a=0;a<60;a+=o){const c=String(n).padStart(2,"0"),d=String(a).padStart(2,"0");t.push(`${c}:${d}`)}return t});function x(o){if(!o)return"";const t=new Date(o),n=String(t.getMonth()+1).padStart(2,"0"),a=String(t.getDate()).padStart(2,"0"),c=t.getFullYear();return s.format.replace("MM",n).replace("DD",a).replace("YYYY",c)}function $(o){const t=x(o),n=String(o.getHours()).padStart(2,"0"),a=String(o.getMinutes()).padStart(2,"0");return`${t} ${n}:${a}`}function v(o){if(!o)return null;if(o instanceof Date)return o;if(typeof o=="string"){if(o.includes("T")){const[a,c]=o.split("T"),d=v(a);if(!d)return null;const[P="00",q="00"]=(c||"").slice(0,5).split(":");return d.setHours(parseInt(P,10)||0,parseInt(q,10)||0,0,0),d}const n=o.split("-");if(n.length===3){const a=parseInt(n[0],10),c=parseInt(n[1],10)-1,d=parseInt(n[2],10);return new Date(a,c,d)}}const t=new Date(o);return isNaN(t.getTime())?null:t}function Y(o){if(!u.value)return!1;const t=new Date(u.value);return t.getDate()===o&&t.getMonth()===r.value&&t.getFullYear()===i.value}function b(o){const t=new Date(i.value,r.value,o);if(s.min){const n=v(s.min);if(n&&t<n)return!0}if(s.max){const n=v(s.max);if(n&&t>n)return!0}return!1}function F(){s.disabled||(m.value=!m.value)}function D(){m.value=!1}function I(){r.value===0?(r.value=11,i.value--):r.value--}function L(){r.value===11?(r.value=0,i.value++):r.value++}function w(o){if(b(o))return;const t=new Date(i.value,r.value,o);u.value=t,S(t),s.enableTime||(m.value=!1)}function S(o){const t=o.getFullYear(),n=String(o.getMonth()+1).padStart(2,"0"),a=String(o.getDate()).padStart(2,"0");if(!s.enableTime){g("update:modelValue",`${t}-${n}-${a}`);return}const[c="00",d="00"]=p.value.split(":");g("update:modelValue",`${t}-${n}-${a}T${c}:${d}`)}function j(){r.value=f.getMonth(),i.value=f.getFullYear(),w(f.getDate())}function z(){u.value=null,p.value="00:00",g("update:modelValue","")}e.watch(()=>s.modelValue,o=>{if(o){const t=v(o);if(t){u.value=t;const n=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0");p.value=`${n}:${a}`,r.value=t.getMonth(),i.value=t.getFullYear()}}else u.value=null},{immediate:!0}),e.watch(p,o=>{if(!s.enableTime||!u.value)return;const[t="00",n="00"]=(o||"00:00").split(":");u.value.setHours(parseInt(t,10)||0,parseInt(n,10)||0,0,0),S(u.value)});function E(o){o.key==="Escape"&&m.value&&D()}return e.onMounted(()=>{document.addEventListener("keydown",E)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",E)}),(o,t)=>(e.openBlock(),e.createElementBlock("div",H,[e.createElementVNode("div",O,[e.createElementVNode("input",{id:l.id,type:"text",value:k.value,readonly:"",disabled:l.disabled,placeholder:l.placeholder,required:l.required,"aria-describedby":l.ariaDescribedby,class:"w-full px-3 py-2 pr-10 border ui-border-strong rounded-md bg-(--ui-bg) ui-text placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-(--ui-primary) focus:border-(--ui-primary) cursor-pointer disabled:bg-(--ui-surface) disabled:text-(--ui-text) disabled:cursor-not-allowed",onClick:F},null,8,A),t[2]||(t[2]=e.createElementVNode("div",{class:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none"},[e.createElementVNode("svg",{class:"w-5 h-5 ui-text",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})])],-1)),l.clearable&&k.value&&!l.disabled?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"absolute right-9 top-1/2 -translate-y-1/2 p-1 hover:bg-(--ui-surface) rounded","aria-label":"Clear date",onClick:e.withModifiers(z,["stop"])},[...t[1]||(t[1]=[e.createElementVNode("svg",{class:"w-4 h-4 ui-text",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])):e.createCommentVNode("",!0)]),e.createVNode(e.Transition,{"enter-active-class":"transition ease-out duration-100","enter-from-class":"transform opacity-0 scale-95","enter-to-class":"transform opacity-100 scale-100","leave-active-class":"transition ease-in duration-75","leave-from-class":"transform opacity-100 scale-100","leave-to-class":"transform opacity-0 scale-95"},{default:e.withCtx(()=>[m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["absolute z-99999 mt-2 rounded-lg shadow-lg p-4 ui-surface",l.calendarPosition,l.enableTime?"w-[420px]":"w-auto"]),onClick:t[0]||(t[0]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(l.enableTime?"grid grid-cols-[1fr_124px] gap-3":"block")},[e.createElementVNode("div",null,[e.createElementVNode("div",U,[e.createElementVNode("button",{type:"button",class:"p-1 hover:bg-(--ui-surface) rounded","aria-label":"Previous Month",onClick:I},[...t[3]||(t[3]=[e.createElementVNode("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 18l-6-6 6-6"})],-1)])]),e.createElementVNode("div",W,e.toDisplayString(N.value)+" "+e.toDisplayString(i.value),1),e.createElementVNode("button",{type:"button",class:"p-1 hover:bg-(--ui-surface) rounded","aria-label":"Next Month",onClick:L},[...t[4]||(t[4]=[e.createElementVNode("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 18l6-6-6-6"})],-1)])])]),e.createElementVNode("div",G,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(V,n=>e.createElementVNode("div",{key:n,class:"text-center text-xs font-medium ui-text py-1"},e.toDisplayString(n),1)),64))]),e.createElementVNode("div",J,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(n,a)=>(e.openBlock(),e.createElementBlock("div",{key:"prev-"+a,class:"text-center text-sm ui-text py-2"},e.toDisplayString(n),1))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,n=>(e.openBlock(),e.createElementBlock("button",{key:n,type:"button",disabled:b(n),class:e.normalizeClass(["w-8 h-8 text-sm rounded flex items-center justify-center",Y(n)?"ui-primary-bg ui-text":"hover:bg-(--ui-surface)",b(n)?"ui-text cursor-not-allowed":""]),onClick:a=>w(n)},e.toDisplayString(n),11,K))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,(n,a)=>(e.openBlock(),e.createElementBlock("div",{key:"next-"+a,class:"text-center text-sm ui-text py-2"},e.toDisplayString(n),1))),128))]),l.showToday?(e.openBlock(),e.createElementBlock("div",Q,[e.createElementVNode("button",{type:"button",class:"w-full px-3 py-2 text-sm font-medium ui-primary hover:bg-(--ui-primary-soft) rounded-lg transition-colors",onClick:j}," Today ")])):e.createCommentVNode("",!0)]),l.enableTime?(e.openBlock(),e.createElementBlock("div",R,[t[5]||(t[5]=e.createElementVNode("div",{class:"text-xs font-semibold ui-text mb-2"},"Time",-1)),e.createElementVNode("div",X,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.value,n=>(e.openBlock(),e.createElementBlock("button",{key:n,type:"button",class:e.normalizeClass(["w-full px-2 py-1.5 text-left text-sm rounded transition-colors",n===p.value?"ui-primary-bg ui-text":"ui-text hover:bg-(--ui-surface)"]),onClick:a=>p.value=n},e.toDisplayString(n),11,Z))),128))])])):e.createCommentVNode("",!0)],2)],2)):e.createCommentVNode("",!0)]),_:1}),m.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed inset-0 z-99998",onClick:D})):e.createCommentVNode("",!0)]))}};exports.default=_;
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { ref as y, computed as p, watch as j, onMounted as Z, onBeforeUnmount as _, createElementBlock as l, openBlock as s, createElementVNode as r, createVNode as ee, createCommentVNode as x, withModifiers as E, Transition as te, withCtx as ne, normalizeClass as S, toDisplayString as g, Fragment as k, renderList as D } from "vue";
|
|
2
|
+
const ae = { class: "relative w-full" }, re = { class: "relative" }, oe = ["id", "value", "disabled", "placeholder", "required", "aria-describedby"], le = { class: "flex items-center justify-between mb-3" }, se = { class: "text-sm font-medium" }, ie = { class: "grid grid-cols-7 gap-1 mb-2" }, ue = { class: "grid grid-cols-7 gap-1" }, de = ["disabled", "onClick"], ce = {
|
|
3
|
+
key: 0,
|
|
4
|
+
class: "mt-4 pt-3 border-t ui-border-strong"
|
|
5
|
+
}, fe = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "border-l pl-3 ui-border-strong"
|
|
8
|
+
}, me = { class: "max-h-[260px] overflow-y-auto pr-1 space-y-1" }, ve = ["onClick"], ge = {
|
|
9
|
+
__name: "Calendar",
|
|
10
|
+
props: {
|
|
11
|
+
id: String,
|
|
12
|
+
modelValue: [String, Date],
|
|
13
|
+
disabled: Boolean,
|
|
14
|
+
required: Boolean,
|
|
15
|
+
min: [String, Date],
|
|
16
|
+
max: [String, Date],
|
|
17
|
+
placeholder: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: "Select date"
|
|
20
|
+
},
|
|
21
|
+
format: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: "MM/DD/YYYY"
|
|
24
|
+
},
|
|
25
|
+
clearable: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: !0
|
|
28
|
+
},
|
|
29
|
+
showToday: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: !0
|
|
32
|
+
},
|
|
33
|
+
calendarPosition: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "left-0"
|
|
36
|
+
},
|
|
37
|
+
ariaDescribedby: String,
|
|
38
|
+
enableTime: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: !1
|
|
41
|
+
},
|
|
42
|
+
minuteInterval: {
|
|
43
|
+
type: Number,
|
|
44
|
+
default: 1
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
emits: ["update:modelValue"],
|
|
48
|
+
setup(i, { emit: H }) {
|
|
49
|
+
const u = i, M = H, v = y(!1), h = /* @__PURE__ */ new Date(), o = y(h.getMonth()), d = y(h.getFullYear()), c = y(null), b = y("00:00"), L = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], P = p(
|
|
50
|
+
() => new Date(d.value, o.value).toLocaleString("default", {
|
|
51
|
+
month: "long"
|
|
52
|
+
})
|
|
53
|
+
), T = p(() => new Date(d.value, o.value + 1, 0).getDate()), q = p(() => new Date(d.value, o.value, 1).getDay()), $ = p(() => {
|
|
54
|
+
const n = new Date(d.value, o.value, 0).getDate(), e = q.value;
|
|
55
|
+
return Array.from({ length: e }, (t, a) => n - e + a + 1);
|
|
56
|
+
}), z = p(() => {
|
|
57
|
+
const n = $.value.length + T.value, e = n % 7 === 0 ? 0 : 7 - n % 7;
|
|
58
|
+
return Array.from({ length: e }, (t, a) => a + 1);
|
|
59
|
+
}), Y = p(() => c.value ? u.enableTime ? A(c.value) : V(c.value) : ""), O = p(() => {
|
|
60
|
+
const n = Math.min(60, Math.max(1, Number(u.minuteInterval) || 1)), e = [];
|
|
61
|
+
for (let t = 0; t < 24; t++)
|
|
62
|
+
for (let a = 0; a < 60; a += n) {
|
|
63
|
+
const f = String(t).padStart(2, "0"), m = String(a).padStart(2, "0");
|
|
64
|
+
e.push(`${f}:${m}`);
|
|
65
|
+
}
|
|
66
|
+
return e;
|
|
67
|
+
});
|
|
68
|
+
function V(n) {
|
|
69
|
+
if (!n) return "";
|
|
70
|
+
const e = new Date(n), t = String(e.getMonth() + 1).padStart(2, "0"), a = String(e.getDate()).padStart(2, "0"), f = e.getFullYear();
|
|
71
|
+
return u.format.replace("MM", t).replace("DD", a).replace("YYYY", f);
|
|
72
|
+
}
|
|
73
|
+
function A(n) {
|
|
74
|
+
const e = V(n), t = String(n.getHours()).padStart(2, "0"), a = String(n.getMinutes()).padStart(2, "0");
|
|
75
|
+
return `${e} ${t}:${a}`;
|
|
76
|
+
}
|
|
77
|
+
function w(n) {
|
|
78
|
+
if (!n) return null;
|
|
79
|
+
if (n instanceof Date) return n;
|
|
80
|
+
if (typeof n == "string") {
|
|
81
|
+
if (n.includes("T")) {
|
|
82
|
+
const [a, f] = n.split("T"), m = w(a);
|
|
83
|
+
if (!m) return null;
|
|
84
|
+
const [R = "00", X = "00"] = (f || "").slice(0, 5).split(":");
|
|
85
|
+
return m.setHours(parseInt(R, 10) || 0, parseInt(X, 10) || 0, 0, 0), m;
|
|
86
|
+
}
|
|
87
|
+
const t = n.split("-");
|
|
88
|
+
if (t.length === 3) {
|
|
89
|
+
const a = parseInt(t[0], 10), f = parseInt(t[1], 10) - 1, m = parseInt(t[2], 10);
|
|
90
|
+
return new Date(a, f, m);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const e = new Date(n);
|
|
94
|
+
return isNaN(e.getTime()) ? null : e;
|
|
95
|
+
}
|
|
96
|
+
function U(n) {
|
|
97
|
+
if (!c.value) return !1;
|
|
98
|
+
const e = new Date(c.value);
|
|
99
|
+
return e.getDate() === n && e.getMonth() === o.value && e.getFullYear() === d.value;
|
|
100
|
+
}
|
|
101
|
+
function C(n) {
|
|
102
|
+
const e = new Date(d.value, o.value, n);
|
|
103
|
+
if (u.min) {
|
|
104
|
+
const t = w(u.min);
|
|
105
|
+
if (t && e < t) return !0;
|
|
106
|
+
}
|
|
107
|
+
if (u.max) {
|
|
108
|
+
const t = w(u.max);
|
|
109
|
+
if (t && e > t) return !0;
|
|
110
|
+
}
|
|
111
|
+
return !1;
|
|
112
|
+
}
|
|
113
|
+
function W() {
|
|
114
|
+
u.disabled || (v.value = !v.value);
|
|
115
|
+
}
|
|
116
|
+
function B() {
|
|
117
|
+
v.value = !1;
|
|
118
|
+
}
|
|
119
|
+
function G() {
|
|
120
|
+
o.value === 0 ? (o.value = 11, d.value--) : o.value--;
|
|
121
|
+
}
|
|
122
|
+
function J() {
|
|
123
|
+
o.value === 11 ? (o.value = 0, d.value++) : o.value++;
|
|
124
|
+
}
|
|
125
|
+
function I(n) {
|
|
126
|
+
if (C(n)) return;
|
|
127
|
+
const e = new Date(d.value, o.value, n);
|
|
128
|
+
c.value = e, N(e), u.enableTime || (v.value = !1);
|
|
129
|
+
}
|
|
130
|
+
function N(n) {
|
|
131
|
+
const e = n.getFullYear(), t = String(n.getMonth() + 1).padStart(2, "0"), a = String(n.getDate()).padStart(2, "0");
|
|
132
|
+
if (!u.enableTime) {
|
|
133
|
+
M("update:modelValue", `${e}-${t}-${a}`);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const [f = "00", m = "00"] = b.value.split(":");
|
|
137
|
+
M("update:modelValue", `${e}-${t}-${a}T${f}:${m}`);
|
|
138
|
+
}
|
|
139
|
+
function K() {
|
|
140
|
+
o.value = h.getMonth(), d.value = h.getFullYear(), I(h.getDate());
|
|
141
|
+
}
|
|
142
|
+
function Q() {
|
|
143
|
+
c.value = null, b.value = "00:00", M("update:modelValue", "");
|
|
144
|
+
}
|
|
145
|
+
j(() => u.modelValue, (n) => {
|
|
146
|
+
if (n) {
|
|
147
|
+
const e = w(n);
|
|
148
|
+
if (e) {
|
|
149
|
+
c.value = e;
|
|
150
|
+
const t = String(e.getHours()).padStart(2, "0"), a = String(e.getMinutes()).padStart(2, "0");
|
|
151
|
+
b.value = `${t}:${a}`, o.value = e.getMonth(), d.value = e.getFullYear();
|
|
152
|
+
}
|
|
153
|
+
} else
|
|
154
|
+
c.value = null;
|
|
155
|
+
}, { immediate: !0 }), j(b, (n) => {
|
|
156
|
+
if (!u.enableTime || !c.value) return;
|
|
157
|
+
const [e = "00", t = "00"] = (n || "00:00").split(":");
|
|
158
|
+
c.value.setHours(parseInt(e, 10) || 0, parseInt(t, 10) || 0, 0, 0), N(c.value);
|
|
159
|
+
});
|
|
160
|
+
function F(n) {
|
|
161
|
+
n.key === "Escape" && v.value && B();
|
|
162
|
+
}
|
|
163
|
+
return Z(() => {
|
|
164
|
+
document.addEventListener("keydown", F);
|
|
165
|
+
}), _(() => {
|
|
166
|
+
document.removeEventListener("keydown", F);
|
|
167
|
+
}), (n, e) => (s(), l("div", ae, [
|
|
168
|
+
r("div", re, [
|
|
169
|
+
r("input", {
|
|
170
|
+
id: i.id,
|
|
171
|
+
type: "text",
|
|
172
|
+
value: Y.value,
|
|
173
|
+
readonly: "",
|
|
174
|
+
disabled: i.disabled,
|
|
175
|
+
placeholder: i.placeholder,
|
|
176
|
+
required: i.required,
|
|
177
|
+
"aria-describedby": i.ariaDescribedby,
|
|
178
|
+
class: "w-full px-3 py-2 pr-10 border ui-border-strong rounded-md bg-(--ui-bg) ui-text placeholder-slate-400 focus:outline-none focus:ring-2 focus:ring-(--ui-primary) focus:border-(--ui-primary) cursor-pointer disabled:bg-(--ui-surface) disabled:text-(--ui-text) disabled:cursor-not-allowed",
|
|
179
|
+
onClick: W
|
|
180
|
+
}, null, 8, oe),
|
|
181
|
+
e[2] || (e[2] = r("div", { class: "absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none" }, [
|
|
182
|
+
r("svg", {
|
|
183
|
+
class: "w-5 h-5 ui-text",
|
|
184
|
+
fill: "none",
|
|
185
|
+
stroke: "currentColor",
|
|
186
|
+
viewBox: "0 0 24 24"
|
|
187
|
+
}, [
|
|
188
|
+
r("path", {
|
|
189
|
+
"stroke-linecap": "round",
|
|
190
|
+
"stroke-linejoin": "round",
|
|
191
|
+
"stroke-width": "2",
|
|
192
|
+
d: "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
|
|
193
|
+
})
|
|
194
|
+
])
|
|
195
|
+
], -1)),
|
|
196
|
+
i.clearable && Y.value && !i.disabled ? (s(), l("button", {
|
|
197
|
+
key: 0,
|
|
198
|
+
type: "button",
|
|
199
|
+
class: "absolute right-9 top-1/2 -translate-y-1/2 p-1 hover:bg-(--ui-surface) rounded",
|
|
200
|
+
"aria-label": "Clear date",
|
|
201
|
+
onClick: E(Q, ["stop"])
|
|
202
|
+
}, [...e[1] || (e[1] = [
|
|
203
|
+
r("svg", {
|
|
204
|
+
class: "w-4 h-4 ui-text",
|
|
205
|
+
fill: "none",
|
|
206
|
+
stroke: "currentColor",
|
|
207
|
+
viewBox: "0 0 24 24"
|
|
208
|
+
}, [
|
|
209
|
+
r("path", {
|
|
210
|
+
"stroke-linecap": "round",
|
|
211
|
+
"stroke-linejoin": "round",
|
|
212
|
+
"stroke-width": "2",
|
|
213
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
214
|
+
})
|
|
215
|
+
], -1)
|
|
216
|
+
])])) : x("", !0)
|
|
217
|
+
]),
|
|
218
|
+
ee(te, {
|
|
219
|
+
"enter-active-class": "transition ease-out duration-100",
|
|
220
|
+
"enter-from-class": "transform opacity-0 scale-95",
|
|
221
|
+
"enter-to-class": "transform opacity-100 scale-100",
|
|
222
|
+
"leave-active-class": "transition ease-in duration-75",
|
|
223
|
+
"leave-from-class": "transform opacity-100 scale-100",
|
|
224
|
+
"leave-to-class": "transform opacity-0 scale-95"
|
|
225
|
+
}, {
|
|
226
|
+
default: ne(() => [
|
|
227
|
+
v.value ? (s(), l("div", {
|
|
228
|
+
key: 0,
|
|
229
|
+
class: S(["absolute z-99999 mt-2 rounded-lg shadow-lg p-4 ui-surface", i.calendarPosition, i.enableTime ? "w-[420px]" : "w-auto"]),
|
|
230
|
+
onClick: e[0] || (e[0] = E(() => {
|
|
231
|
+
}, ["stop"]))
|
|
232
|
+
}, [
|
|
233
|
+
r("div", {
|
|
234
|
+
class: S(i.enableTime ? "grid grid-cols-[1fr_124px] gap-3" : "block")
|
|
235
|
+
}, [
|
|
236
|
+
r("div", null, [
|
|
237
|
+
r("div", le, [
|
|
238
|
+
r("button", {
|
|
239
|
+
type: "button",
|
|
240
|
+
class: "p-1 hover:bg-(--ui-surface) rounded",
|
|
241
|
+
"aria-label": "Previous Month",
|
|
242
|
+
onClick: G
|
|
243
|
+
}, [...e[3] || (e[3] = [
|
|
244
|
+
r("svg", {
|
|
245
|
+
class: "w-4 h-4",
|
|
246
|
+
fill: "none",
|
|
247
|
+
stroke: "currentColor",
|
|
248
|
+
viewBox: "0 0 24 24"
|
|
249
|
+
}, [
|
|
250
|
+
r("path", {
|
|
251
|
+
"stroke-linecap": "round",
|
|
252
|
+
"stroke-linejoin": "round",
|
|
253
|
+
"stroke-width": "2",
|
|
254
|
+
d: "M15 18l-6-6 6-6"
|
|
255
|
+
})
|
|
256
|
+
], -1)
|
|
257
|
+
])]),
|
|
258
|
+
r("div", se, g(P.value) + " " + g(d.value), 1),
|
|
259
|
+
r("button", {
|
|
260
|
+
type: "button",
|
|
261
|
+
class: "p-1 hover:bg-(--ui-surface) rounded",
|
|
262
|
+
"aria-label": "Next Month",
|
|
263
|
+
onClick: J
|
|
264
|
+
}, [...e[4] || (e[4] = [
|
|
265
|
+
r("svg", {
|
|
266
|
+
class: "w-4 h-4",
|
|
267
|
+
fill: "none",
|
|
268
|
+
stroke: "currentColor",
|
|
269
|
+
viewBox: "0 0 24 24"
|
|
270
|
+
}, [
|
|
271
|
+
r("path", {
|
|
272
|
+
"stroke-linecap": "round",
|
|
273
|
+
"stroke-linejoin": "round",
|
|
274
|
+
"stroke-width": "2",
|
|
275
|
+
d: "M9 18l6-6-6-6"
|
|
276
|
+
})
|
|
277
|
+
], -1)
|
|
278
|
+
])])
|
|
279
|
+
]),
|
|
280
|
+
r("div", ie, [
|
|
281
|
+
(s(), l(k, null, D(L, (t) => r("div", {
|
|
282
|
+
key: t,
|
|
283
|
+
class: "text-center text-xs font-medium ui-text py-1"
|
|
284
|
+
}, g(t), 1)), 64))
|
|
285
|
+
]),
|
|
286
|
+
r("div", ue, [
|
|
287
|
+
(s(!0), l(k, null, D($.value, (t, a) => (s(), l("div", {
|
|
288
|
+
key: "prev-" + a,
|
|
289
|
+
class: "text-center text-sm ui-text py-2"
|
|
290
|
+
}, g(t), 1))), 128)),
|
|
291
|
+
(s(!0), l(k, null, D(T.value, (t) => (s(), l("button", {
|
|
292
|
+
key: t,
|
|
293
|
+
type: "button",
|
|
294
|
+
disabled: C(t),
|
|
295
|
+
class: S([
|
|
296
|
+
"w-8 h-8 text-sm rounded flex items-center justify-center",
|
|
297
|
+
U(t) ? "ui-primary-bg ui-text" : "hover:bg-(--ui-surface)",
|
|
298
|
+
C(t) ? "ui-text cursor-not-allowed" : ""
|
|
299
|
+
]),
|
|
300
|
+
onClick: (a) => I(t)
|
|
301
|
+
}, g(t), 11, de))), 128)),
|
|
302
|
+
(s(!0), l(k, null, D(z.value, (t, a) => (s(), l("div", {
|
|
303
|
+
key: "next-" + a,
|
|
304
|
+
class: "text-center text-sm ui-text py-2"
|
|
305
|
+
}, g(t), 1))), 128))
|
|
306
|
+
]),
|
|
307
|
+
i.showToday ? (s(), l("div", ce, [
|
|
308
|
+
r("button", {
|
|
309
|
+
type: "button",
|
|
310
|
+
class: "w-full px-3 py-2 text-sm font-medium ui-primary hover:bg-(--ui-primary-soft) rounded-lg transition-colors",
|
|
311
|
+
onClick: K
|
|
312
|
+
}, " Today ")
|
|
313
|
+
])) : x("", !0)
|
|
314
|
+
]),
|
|
315
|
+
i.enableTime ? (s(), l("div", fe, [
|
|
316
|
+
e[5] || (e[5] = r("div", { class: "text-xs font-semibold ui-text mb-2" }, "Time", -1)),
|
|
317
|
+
r("div", me, [
|
|
318
|
+
(s(!0), l(k, null, D(O.value, (t) => (s(), l("button", {
|
|
319
|
+
key: t,
|
|
320
|
+
type: "button",
|
|
321
|
+
class: S(["w-full px-2 py-1.5 text-left text-sm rounded transition-colors", t === b.value ? "ui-primary-bg ui-text" : "ui-text hover:bg-(--ui-surface)"]),
|
|
322
|
+
onClick: (a) => b.value = t
|
|
323
|
+
}, g(t), 11, ve))), 128))
|
|
324
|
+
])
|
|
325
|
+
])) : x("", !0)
|
|
326
|
+
], 2)
|
|
327
|
+
], 2)) : x("", !0)
|
|
328
|
+
]),
|
|
329
|
+
_: 1
|
|
330
|
+
}),
|
|
331
|
+
v.value ? (s(), l("div", {
|
|
332
|
+
key: 0,
|
|
333
|
+
class: "fixed inset-0 z-99998",
|
|
334
|
+
onClick: B
|
|
335
|
+
})) : x("", !0)
|
|
336
|
+
]));
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
export {
|
|
340
|
+
ge as default
|
|
341
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),o=require("class-variance-authority"),n=require("../utils/cn.cjs"),y={key:0,class:"absolute inset-0 bg-[color:color-mix(in oklab, var(--ui-surface), transparent 40%)] backdrop-blur-sm flex items-center justify-center z-10","aria-hidden":"true"},x={class:"flex items-start justify-between gap-4"},B={class:"flex-1 min-w-0"},C={key:0,class:"shrink-0"},S=["src","alt","loading"],V={key:5,class:"absolute top-3 right-3"},z={class:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ui-bg ui-text"},E="w-full h-full object-cover",N="font-semibold ui-text line-clamp-2",$="text-sm ui-text mt-1 line-clamp-2",w={__name:"Card",props:{as:{type:String,default:"div"},variant:{type:String,default:"default",validator:t=>["default","outlined","elevated","filled","ghost"].includes(t)},padding:{type:String,default:"none",validator:t=>["none","sm","md","lg","xl"].includes(t)},bordered:{type:Boolean,default:!0},title:String,titleTag:{type:String,default:"h3"},titleSize:{type:String,default:"default",validator:t=>["sm","default","lg","xl"].includes(t)},subtitle:String,badge:String,contentClass:{type:[String,Array,Object],default:""},contentWrapper:{type:Boolean,default:!0},image:String,imageAlt:{type:String,default:"Card image"},imageAspect:{type:String,default:"auto",validator:t=>["auto","video","square","portrait"].includes(t)},imageLazy:{type:Boolean,default:!0},hoverable:Boolean,clickable:Boolean,disabled:Boolean,loading:Boolean},emits:["click"],setup(t,{emit:s}){const l=t,d=s,c=new Set(["textbox","searchbox","combobox","spinbutton"]),u=a=>{if(!(a instanceof Element))return!1;if(a.closest('input, textarea, select, button, a, [contenteditable], [contenteditable="true"]'))return!0;const r=a.getAttribute("role");return r?c.has(r):!1},i=a=>{l.clickable&&!l.disabled&&!l.loading&&d("click",a)},m=a=>{!l.clickable||l.disabled||l.loading||a.key!=="Enter"&&a.key!==" "&&a.key!=="Spacebar"||u(a.target)||a.currentTarget===a.target&&(a.preventDefault(),i(a))},g=e.computed(()=>({sm:"text-base",default:"text-lg",lg:"text-xl",xl:"text-2xl"})[l.titleSize]),b=e.computed(()=>({auto:"",video:"aspect-video",square:"aspect-square",portrait:"aspect-[3/4]"})[l.imageAspect]),f=o.cva("rounded-lg overflow-hidden transition-all duration-200 relative ui-text",{variants:{variant:{default:"ui-surface",outlined:"ui-surface",elevated:"ui-surface shadow-md",filled:"ui-surface-soft",ghost:"bg-transparent"},padding:{none:"",sm:"p-3",md:"p-4",lg:"p-6",xl:"p-8"},bordered:{true:"",false:""},hoverable:{true:"hover:shadow-lg hover:scale-[1.02]"},clickable:{true:"cursor-pointer focus:outline-none focus:ring-2 focus:ring-(--ui-ring) focus:ring-offset-2"},loading:{true:""}},compoundVariants:[{variant:"default",bordered:!0,class:"border ui-border-strong"},{variant:"outlined",bordered:!0,class:"border-2 ui-border-strong"},{variant:"elevated",bordered:!0,class:"border ui-border-strong"},{variant:"filled",bordered:!0,class:"border ui-border-strong"},{clickable:!0,hoverable:!1,class:"hover:bg-(--ui-surface)"}],defaultVariants:{variant:"default",padding:"md",bordered:!0}}),k=o.cva("",{variants:{padding:{none:"p-4 pb-3",sm:"px-3 pt-3 pb-2",md:"px-4 pt-4 pb-3",lg:"px-6 pt-6 pb-4",xl:"px-8 pt-8 pb-6"},hasBorder:{true:"border-b ui-border-strong mb-0",false:""}}}),p=o.cva("",{variants:{padding:{none:"p-4",sm:"p-3",md:"p-4",lg:"p-6",xl:"p-8"}}}),v=o.cva("border-t ui-border-strong bg-[color:color-mix(in oklab, var(--ui-surface), transparent 50%)]",{variants:{padding:{none:"p-4 pt-3",sm:"px-3 pb-3 pt-2",md:"px-4 pb-4 pt-3",lg:"px-6 pb-6 pt-4",xl:"px-8 pb-8 pt-6"}}}),h=o.cva("overflow-hidden",{variants:{padding:{none:"",sm:"-mx-3 mb-3",md:"-mx-4 mb-4",lg:"-mx-6 mb-6",xl:"-mx-8 mb-8"},hasHeader:{true:"",false:""}},compoundVariants:[{hasHeader:!0,padding:"sm",class:"-mt-3"},{hasHeader:!0,padding:"md",class:"-mt-4"},{hasHeader:!0,padding:"lg",class:"-mt-6"},{hasHeader:!0,padding:"xl",class:"-mt-8"}]});return(a,r)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.as),{class:e.normalizeClass(e.unref(n.cn)(e.unref(f)({variant:t.variant,padding:t.padding,hoverable:t.hoverable,clickable:t.clickable,loading:t.loading,bordered:t.bordered}))),disabled:t.disabled||t.loading,"aria-busy":t.loading,"aria-disabled":t.disabled,role:t.clickable?"button":void 0,tabindex:t.clickable&&!t.disabled?0:void 0,onClick:i,onKeydown:m},{default:e.withCtx(()=>[t.loading?(e.openBlock(),e.createElementBlock("div",y,[...r[0]||(r[0]=[e.createElementVNode("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 ui-border-strong"},null,-1)])])):e.createCommentVNode("",!0),a.$slots.header||t.title||t.subtitle||a.$slots.actions?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(e.unref(n.cn)(e.unref(k)({padding:t.padding,hasBorder:!!(a.$slots.default||a.$slots.footer)})))},[e.renderSlot(a.$slots,"header",{},()=>[e.createElementVNode("div",x,[e.createElementVNode("div",B,[t.title?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.titleTag),{key:0,class:e.normalizeClass(e.unref(n.cn)(N,g.value))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),_:1},8,["class"])):e.createCommentVNode("",!0),t.subtitle?(e.openBlock(),e.createElementBlock("p",{key:1,class:e.normalizeClass($)},e.toDisplayString(t.subtitle),1)):e.createCommentVNode("",!0)]),a.$slots.actions?(e.openBlock(),e.createElementBlock("div",C,[e.renderSlot(a.$slots,"actions")])):e.createCommentVNode("",!0)])])],2)):e.createCommentVNode("",!0),a.$slots.image||t.image?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(e.unref(n.cn)(e.unref(h)({padding:t.padding,hasHeader:!!(a.$slots.header||t.title)})))},[e.renderSlot(a.$slots,"image",{},()=>[t.image?(e.openBlock(),e.createElementBlock("img",{key:0,src:t.image,alt:t.imageAlt,class:e.normalizeClass(e.unref(n.cn)(E,b.value)),loading:t.imageLazy?"lazy":"eager"},null,10,S)):e.createCommentVNode("",!0)])],2)):e.createCommentVNode("",!0),a.$slots.default?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[t.contentWrapper?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(e.unref(n.cn)(e.unref(p)({padding:t.padding}),t.contentClass))},[e.renderSlot(a.$slots,"default")],2)):e.renderSlot(a.$slots,"default",{key:1})],64)):e.createCommentVNode("",!0),a.$slots.footer?(e.openBlock(),e.createElementBlock("div",{key:4,class:e.normalizeClass(e.unref(n.cn)(e.unref(v)({padding:t.padding})))},[e.renderSlot(a.$slots,"footer")],2)):e.createCommentVNode("",!0),t.badge?(e.openBlock(),e.createElementBlock("div",V,[e.createElementVNode("span",z,e.toDisplayString(t.badge),1)])):e.createCommentVNode("",!0)]),_:3},40,["class","disabled","aria-busy","aria-disabled","role","tabindex"]))}};exports.default=w;
|