@gspa/ui 0.1.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -1
- package/dist/Button.vue_vue_type_script_setup_true_lang-B3TkBTvG.js +205 -0
- package/dist/Button.vue_vue_type_script_setup_true_lang-DZxttvYH.cjs +1 -0
- package/dist/DataTable.css +1 -0
- package/dist/DataTableToolBar.css +1 -0
- package/dist/DatePicker.vue_vue_type_script_setup_true_lang-CIKiZaO1.cjs +1 -0
- package/dist/DatePicker.vue_vue_type_script_setup_true_lang-Dx_9f8DO.js +557 -0
- package/dist/FormField.vue_vue_type_script_setup_true_lang-BljDj5YZ.js +205 -0
- package/dist/FormField.vue_vue_type_script_setup_true_lang-FWitIR3U.cjs +1 -0
- package/dist/Header.css +1 -0
- package/dist/Input.vue_vue_type_script_setup_true_lang-C1OQn24h.cjs +1 -0
- package/dist/Input.vue_vue_type_script_setup_true_lang-CpBoY97r.js +137 -0
- package/dist/Loader.css +1 -0
- package/dist/ReminderConfig.css +1 -0
- package/dist/ReusableForm.css +1 -0
- package/dist/Sidebar.css +1 -0
- package/dist/Toast.css +1 -0
- package/dist/components/AccordionItem.cjs +1 -1
- package/dist/components/AccordionItem.js +5 -5
- package/dist/components/Alert.cjs +1 -1
- package/dist/components/Alert.js +71 -66
- package/dist/components/Button.cjs +1 -1
- package/dist/components/Button.js +2 -188
- package/dist/components/DataTable.cjs +1 -1
- package/dist/components/DataTable.js +1 -1
- package/dist/components/DataTableFilters.cjs +1 -1
- package/dist/components/DataTableFilters.js +19 -19
- package/dist/components/DataTableToolBar.cjs +1 -1
- package/dist/components/DataTableToolBar.js +1 -1
- package/dist/components/DatePicker.cjs +1 -1
- package/dist/components/DatePicker.js +2 -399
- package/dist/components/FormField.cjs +1 -1
- package/dist/components/FormField.js +2 -188
- package/dist/components/GraphFilters.cjs +1 -1
- package/dist/components/GraphFilters.js +29 -29
- package/dist/components/Icon.cjs +1 -1
- package/dist/components/Icon.js +23 -16
- package/dist/components/Input.cjs +1 -1
- package/dist/components/Input.js +2 -164
- package/dist/components/ReusableForm.cjs +1 -1
- package/dist/components/ReusableForm.js +188 -159
- package/dist/components/ThemeConfigurator.cjs +1 -1
- package/dist/components/ThemeConfigurator.js +51 -28
- package/dist/gspa-ui.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +124 -118
- package/dist/layouts/AuthLayout.cjs +1 -1
- package/dist/layouts/AuthLayout.js +110 -112
- package/dist/lib/form-field.cjs +1 -0
- package/dist/lib/form-field.js +4 -0
- package/dist/lib/icon.cjs +1 -0
- package/dist/lib/icon.js +4 -0
- package/dist/lib/theme.cjs +1 -1
- package/dist/lib/theme.js +73 -63
- package/dist/src/components/Alert.vue.d.ts.map +1 -1
- package/dist/src/components/Button.vue.d.ts +127 -29
- package/dist/src/components/Button.vue.d.ts.map +1 -1
- package/dist/src/components/Calendar.vue.d.ts +4 -4
- package/dist/src/components/Checkbox.vue.d.ts +2 -2
- package/dist/src/components/DataTable.vue.d.ts +1 -1
- package/dist/src/components/DatePicker.vue.d.ts +139 -29
- package/dist/src/components/DatePicker.vue.d.ts.map +1 -1
- package/dist/src/components/FormField.vue.d.ts +106 -38
- package/dist/src/components/FormField.vue.d.ts.map +1 -1
- package/dist/src/components/Icon.vue.d.ts.map +1 -1
- package/dist/src/components/Input.vue.d.ts +137 -33
- package/dist/src/components/Input.vue.d.ts.map +1 -1
- package/dist/src/components/ReusableForm.vue.d.ts +1 -1
- package/dist/src/components/ReusableForm.vue.d.ts.map +1 -1
- package/dist/src/components/ReusableFormModal.vue.d.ts +1 -1
- package/dist/src/components/Textarea.vue.d.ts +2 -2
- package/dist/src/index.d.ts +9 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/layouts/AuthLayout.vue.d.ts +2 -0
- package/dist/src/layouts/AuthLayout.vue.d.ts.map +1 -1
- package/dist/src/lib/form-field.d.ts +2 -0
- package/dist/src/lib/form-field.d.ts.map +1 -0
- package/dist/src/lib/icon.d.ts +2 -0
- package/dist/src/lib/icon.d.ts.map +1 -0
- package/dist/src/lib/theme.d.ts +4 -0
- package/dist/src/lib/theme.d.ts.map +1 -1
- package/dist/src/types.d.ts +47 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/styles/auth-layout.css +1 -0
- package/dist/styles/button.css +1 -0
- package/dist/styles/form-field.css +1 -0
- package/dist/styles/input.css +1 -0
- package/dist/styles/tokens.css +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -3
- package/dist/src/__tests__/Alert.spec.d.ts +0 -2
- package/dist/src/__tests__/Alert.spec.d.ts.map +0 -1
- package/dist/src/__tests__/App.spec.d.ts +0 -2
- package/dist/src/__tests__/App.spec.d.ts.map +0 -1
- package/dist/src/__tests__/AuthLayout.spec.d.ts +0 -2
- package/dist/src/__tests__/AuthLayout.spec.d.ts.map +0 -1
- package/dist/src/__tests__/Badge.spec.d.ts +0 -2
- package/dist/src/__tests__/Badge.spec.d.ts.map +0 -1
- package/dist/src/__tests__/Button.spec.d.ts +0 -2
- package/dist/src/__tests__/Button.spec.d.ts.map +0 -1
- package/dist/src/__tests__/Card.spec.d.ts +0 -2
- package/dist/src/__tests__/Card.spec.d.ts.map +0 -1
- package/dist/src/__tests__/Checkbox.spec.d.ts +0 -2
- package/dist/src/__tests__/Checkbox.spec.d.ts.map +0 -1
- package/dist/src/__tests__/Dropdown.spec.d.ts +0 -2
- package/dist/src/__tests__/Dropdown.spec.d.ts.map +0 -1
- package/dist/src/__tests__/Input.spec.d.ts +0 -2
- package/dist/src/__tests__/Input.spec.d.ts.map +0 -1
- package/dist/src/__tests__/Modal.spec.d.ts +0 -2
- package/dist/src/__tests__/Modal.spec.d.ts.map +0 -1
- package/dist/src/__tests__/Radio.spec.d.ts +0 -2
- package/dist/src/__tests__/Radio.spec.d.ts.map +0 -1
- package/dist/src/__tests__/ReusableForm.spec.d.ts +0 -2
- package/dist/src/__tests__/ReusableForm.spec.d.ts.map +0 -1
- package/dist/src/__tests__/Tabs.spec.d.ts +0 -2
- package/dist/src/__tests__/Tabs.spec.d.ts.map +0 -1
- package/dist/src/__tests__/integration/CardIntegration.spec.d.ts +0 -2
- package/dist/src/__tests__/integration/CardIntegration.spec.d.ts.map +0 -1
- package/dist/src/__tests__/integration/FormIntegration.spec.d.ts +0 -2
- package/dist/src/__tests__/integration/FormIntegration.spec.d.ts.map +0 -1
- package/dist/src/__tests__/integration/ModalIntegration.spec.d.ts +0 -2
- package/dist/src/__tests__/integration/ModalIntegration.spec.d.ts.map +0 -1
- package/dist/src/__tests__/integration/NavigationIntegration.spec.d.ts +0 -2
- package/dist/src/__tests__/integration/NavigationIntegration.spec.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -200,6 +200,23 @@ import AuthLayout from '@gspa/ui/layouts/AuthLayout'
|
|
|
200
200
|
import '@gspa/ui/css'
|
|
201
201
|
```
|
|
202
202
|
|
|
203
|
+
For a small entry point, import component CSS instead of the complete utility sheet:
|
|
204
|
+
|
|
205
|
+
```js
|
|
206
|
+
import Button from '@gspa/ui/components/Button'
|
|
207
|
+
import '@gspa/ui/css/button'
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Granular styles are available for `button`, `input`, `form-field`, and `auth-layout`. `@gspa/ui/css/tokens` contains only semantic theme tokens and shared accessibility rules. Scoped legacy styles can be loaded through `@gspa/ui/css/scoped/<Component>` when that component needs them.
|
|
211
|
+
|
|
212
|
+
Form controls include their validation and password icons, so authentication forms do not require global Font Awesome registration. For custom `Icon` names, applications may retain Font Awesome or provide a component adapter once:
|
|
213
|
+
|
|
214
|
+
```js
|
|
215
|
+
app.use(VueUI, {
|
|
216
|
+
iconAdapter: ({ name, prefix }) => myIconRegistry[prefix]?.[name]
|
|
217
|
+
})
|
|
218
|
+
```
|
|
219
|
+
|
|
203
220
|
Nested components use the same convention:
|
|
204
221
|
|
|
205
222
|
```js
|
|
@@ -881,8 +898,12 @@ A date picker component with calendar dropdown.
|
|
|
881
898
|
| `required` | `Boolean` | `false` | Whether required |
|
|
882
899
|
| `min` | `String \| Date` | - | Minimum selectable date |
|
|
883
900
|
| `max` | `String \| Date` | - | Maximum selectable date |
|
|
901
|
+
| `minDate` | `String \| Date` | - | Minimum selectable date (takes precedence over `min`) |
|
|
902
|
+
| `maxDate` | `String \| Date` | - | Maximum selectable date (takes precedence over `max`) |
|
|
903
|
+
| `yearRange` | `readonly [number, number]` | - | Inclusive years shown and selectable |
|
|
904
|
+
| `initialView` | `'day' \| 'month' \| 'year'` | `'day'` | View displayed whenever the calendar opens |
|
|
884
905
|
| `placeholder` | `String` | `'Select date'` | Placeholder text |
|
|
885
|
-
| `format` | `String` | `'MM/
|
|
906
|
+
| `format` | `String` | `'DD/MM/YYYY'` | Date format |
|
|
886
907
|
| `clearable` | `Boolean` | `true` | Show clear button |
|
|
887
908
|
| `showToday` | `Boolean` | `true` | Show today button in calendar |
|
|
888
909
|
| `calendarPosition` | `String` | `'left-0 bottom-full'` | Calendar dropdown position |
|
|
@@ -917,6 +938,18 @@ const maxDate = '2023-12-31'
|
|
|
917
938
|
</script>
|
|
918
939
|
```
|
|
919
940
|
|
|
941
|
+
For a date-of-birth field that emits an API-ready `YYYY-MM-DD` value:
|
|
942
|
+
|
|
943
|
+
```vue
|
|
944
|
+
<DatePicker
|
|
945
|
+
v-model="dateOfBirth"
|
|
946
|
+
initial-view="year"
|
|
947
|
+
:year-range="[1900, currentYear]"
|
|
948
|
+
:max-date="yesterday"
|
|
949
|
+
format="YYYY-MM-DD"
|
|
950
|
+
/>
|
|
951
|
+
```
|
|
952
|
+
|
|
920
953
|
## ReusableForm (v2)
|
|
921
954
|
|
|
922
955
|
A reusable inline form component with optional sectioned layout, field-level slot overrides, and cross-field validation.
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { defineComponent as x, inject as k, computed as i, createElementBlock as a, createCommentVNode as s, openBlock as n, mergeProps as z, unref as h, createBlock as S, renderSlot as B, normalizeClass as g, createElementVNode as m, toDisplayString as b } from "vue";
|
|
2
|
+
import { cva as O } from "class-variance-authority";
|
|
3
|
+
import { cn as A } from "./utils/cn.js";
|
|
4
|
+
import C from "./components/Icon.js";
|
|
5
|
+
import { AUTH_RESOLVER_KEY as E } from "./lib/auth.js";
|
|
6
|
+
const M = ["disabled", "type", "aria-disabled", "aria-busy"], R = { key: 2 }, V = {
|
|
7
|
+
key: 4,
|
|
8
|
+
class: "sr-only",
|
|
9
|
+
role: "status",
|
|
10
|
+
"aria-live": "polite"
|
|
11
|
+
}, F = /* @__PURE__ */ x({
|
|
12
|
+
inheritAttrs: !1,
|
|
13
|
+
__name: "Button",
|
|
14
|
+
props: {
|
|
15
|
+
variant: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: "default",
|
|
18
|
+
validator: (e) => [
|
|
19
|
+
"primary",
|
|
20
|
+
"default",
|
|
21
|
+
"danger",
|
|
22
|
+
"outline",
|
|
23
|
+
"secondary",
|
|
24
|
+
"ghost",
|
|
25
|
+
"link",
|
|
26
|
+
"success",
|
|
27
|
+
"warning",
|
|
28
|
+
"info",
|
|
29
|
+
"subtle",
|
|
30
|
+
"dark",
|
|
31
|
+
"light",
|
|
32
|
+
"primaryOutline",
|
|
33
|
+
"dangerOutline",
|
|
34
|
+
"successOutline",
|
|
35
|
+
"gradient"
|
|
36
|
+
].includes(e)
|
|
37
|
+
},
|
|
38
|
+
size: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: "default",
|
|
41
|
+
validator: (e) => ["2xs", "xs", "sm", "default", "md", "lg", "xl", "2xl", "icon-sm", "icon", "icon-lg"].includes(e)
|
|
42
|
+
},
|
|
43
|
+
disabled: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: !1
|
|
46
|
+
},
|
|
47
|
+
loading: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: !1
|
|
50
|
+
},
|
|
51
|
+
loadingText: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: null
|
|
54
|
+
},
|
|
55
|
+
loadingLabel: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: "Loading"
|
|
58
|
+
},
|
|
59
|
+
type: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "button"
|
|
62
|
+
},
|
|
63
|
+
icon: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: null
|
|
66
|
+
},
|
|
67
|
+
permission: {
|
|
68
|
+
type: [String, Array, Boolean, Function],
|
|
69
|
+
default: null
|
|
70
|
+
},
|
|
71
|
+
role: {
|
|
72
|
+
type: [String, Array, Boolean, Function],
|
|
73
|
+
default: null
|
|
74
|
+
},
|
|
75
|
+
requireAll: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: !1
|
|
78
|
+
},
|
|
79
|
+
unauthorized: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: "show",
|
|
82
|
+
validator: (e) => ["show", "hide", "disable"].includes(e)
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
setup(e) {
|
|
86
|
+
const t = e, d = k(E, null), l = (r) => r == null ? null : typeof r == "boolean" ? r : typeof r == "function" ? !!r() : r, u = i(() => {
|
|
87
|
+
const r = l(t.permission), o = l(t.role);
|
|
88
|
+
return r === null && o === null ? !0 : (r === null || typeof r == "boolean") && (o === null || typeof o == "boolean") ? (r ?? !0) && (o ?? !0) : typeof d == "function" ? !!d({
|
|
89
|
+
permission: r,
|
|
90
|
+
role: o,
|
|
91
|
+
requireAll: t.requireAll
|
|
92
|
+
}) : !0;
|
|
93
|
+
}), f = i(() => t.unauthorized === "hide" && !u.value), p = i(() => t.unauthorized === "disable" && !u.value), c = i(() => t.disabled || t.loading || p.value), v = O(
|
|
94
|
+
"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",
|
|
95
|
+
{
|
|
96
|
+
variants: {
|
|
97
|
+
variant: {
|
|
98
|
+
primary: "ui-primary-bg shadow-sm hover:bg-(--ui-primary-strong) hover:shadow-md",
|
|
99
|
+
default: "ui-primary-bg shadow-sm hover:bg-(--ui-primary-strong) hover:shadow-md",
|
|
100
|
+
danger: "ui-danger-bg shadow-sm hover:bg-(--ui-danger-strong) hover:shadow-md",
|
|
101
|
+
outline: "border ui-border-strong ui-surface ui-text hover:bg-(--ui-surface-soft) hover:border-(--ui-primary) hover:text-(--ui-primary)",
|
|
102
|
+
secondary: "border ui-border ui-surface-muted ui-text hover:bg-(--ui-surface-soft) hover:shadow-sm",
|
|
103
|
+
ghost: "bg-transparent ui-text-muted hover:bg-[color:color-mix(in oklab, var(--ui-accent-soft), transparent 40%)] hover:text-(--ui-text)",
|
|
104
|
+
link: "ui-primary underline-offset-4 hover:underline hover:text-(--ui-primary-strong)",
|
|
105
|
+
success: "ui-success-bg shadow-sm hover:bg-(--ui-success-strong) hover:shadow-md",
|
|
106
|
+
warning: "ui-warning-bg shadow-sm hover:bg-(--ui-warning-strong) hover:shadow-md",
|
|
107
|
+
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",
|
|
108
|
+
subtle: "border ui-border ui-surface ui-text-muted hover:text-(--ui-text) hover:bg-(--ui-surface-soft)",
|
|
109
|
+
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",
|
|
110
|
+
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",
|
|
111
|
+
primaryOutline: "border border-(--ui-primary) ui-primary bg-transparent hover:bg-(--ui-primary-soft) hover:border-(--ui-primary-strong) hover:text-(--ui-primary-strong)",
|
|
112
|
+
dangerOutline: "border border-(--ui-danger) ui-danger bg-transparent hover:bg-(--ui-danger-soft) hover:border-(--ui-danger-strong) hover:text-(--ui-danger-strong)",
|
|
113
|
+
successOutline: "border border-(--ui-success) ui-success bg-transparent hover:bg-(--ui-success-soft) hover:border-(--ui-success-strong) hover:text-(--ui-success-strong)",
|
|
114
|
+
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"
|
|
115
|
+
},
|
|
116
|
+
size: {
|
|
117
|
+
"2xs": "h-4 px-1 py-3 text-md rounded",
|
|
118
|
+
xs: "h-7 px-2.5 py-1 text-xs rounded-md",
|
|
119
|
+
sm: "h-8 px-3 py-1.5 text-sm rounded-md",
|
|
120
|
+
default: "h-9 px-4 py-2 text-sm rounded-md",
|
|
121
|
+
md: "h-10 px-4 py-2 text-sm rounded-md",
|
|
122
|
+
lg: "h-11 px-6 py-2.5 text-base rounded-md",
|
|
123
|
+
xl: "h-12 px-8 py-3 text-base rounded-lg",
|
|
124
|
+
"2xl": "h-14 px-10 py-3.5 text-lg rounded-lg",
|
|
125
|
+
"icon-sm": "h-8 w-8 p-0",
|
|
126
|
+
icon: "h-10 w-10 p-0",
|
|
127
|
+
"icon-lg": "h-12 w-12 p-0"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
defaultVariants: {
|
|
131
|
+
variant: "default",
|
|
132
|
+
size: "default"
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
), y = 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
|
+
})[t.size] || "h-4 w-4"), w = i(() => ({
|
|
148
|
+
"2xs": "h-3 w-3",
|
|
149
|
+
xs: "h-3.5 w-3.5",
|
|
150
|
+
sm: "h-4 w-4",
|
|
151
|
+
default: "h-4 w-4",
|
|
152
|
+
md: "h-4 w-4",
|
|
153
|
+
lg: "h-5 w-5",
|
|
154
|
+
xl: "h-5 w-5",
|
|
155
|
+
"2xl": "h-6 w-6",
|
|
156
|
+
"icon-sm": "h-4 w-4",
|
|
157
|
+
icon: "h-5 w-5",
|
|
158
|
+
"icon-lg": "h-6 w-6"
|
|
159
|
+
})[t.size] || "h-4 w-4");
|
|
160
|
+
return (r, o) => f.value ? s("", !0) : (n(), a("button", z({
|
|
161
|
+
key: 0,
|
|
162
|
+
class: h(A)(h(v)({ variant: e.variant, size: e.size }), r.$attrs.class),
|
|
163
|
+
disabled: c.value,
|
|
164
|
+
type: e.type,
|
|
165
|
+
"aria-disabled": c.value,
|
|
166
|
+
"aria-busy": e.loading
|
|
167
|
+
}, r.$attrs), [
|
|
168
|
+
e.loading ? (n(), a("svg", {
|
|
169
|
+
key: 0,
|
|
170
|
+
class: g([w.value, "animate-spin mr-2 text-current"]),
|
|
171
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
172
|
+
fill: "none",
|
|
173
|
+
viewBox: "0 0 24 24",
|
|
174
|
+
"aria-hidden": "true"
|
|
175
|
+
}, [...o[0] || (o[0] = [
|
|
176
|
+
m("circle", {
|
|
177
|
+
class: "opacity-25",
|
|
178
|
+
cx: "12",
|
|
179
|
+
cy: "12",
|
|
180
|
+
r: "10",
|
|
181
|
+
stroke: "currentColor",
|
|
182
|
+
"stroke-width": "4"
|
|
183
|
+
}, null, -1),
|
|
184
|
+
m("path", {
|
|
185
|
+
class: "opacity-75",
|
|
186
|
+
fill: "none",
|
|
187
|
+
stroke: "currentColor",
|
|
188
|
+
"stroke-linecap": "round",
|
|
189
|
+
"stroke-width": "4",
|
|
190
|
+
d: "M4 12a8 8 0 018-8"
|
|
191
|
+
}, null, -1)
|
|
192
|
+
])], 2)) : s("", !0),
|
|
193
|
+
e.icon && !e.loading ? (n(), S(C, {
|
|
194
|
+
key: 1,
|
|
195
|
+
icon: e.icon,
|
|
196
|
+
class: g(y.value)
|
|
197
|
+
}, null, 8, ["icon", "class"])) : s("", !0),
|
|
198
|
+
e.loading && e.loadingText ? (n(), a("span", R, b(e.loadingText), 1)) : B(r.$slots, "default", { key: 3 }),
|
|
199
|
+
e.loading ? (n(), a("span", V, b(e.loadingLabel), 1)) : s("", !0)
|
|
200
|
+
], 16, M));
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
export {
|
|
204
|
+
F as _
|
|
205
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),m=require("class-variance-authority"),b=require("./utils/cn.cjs"),p=require("./components/Icon.cjs"),f=require("./lib/auth.cjs"),v=["disabled","type","aria-disabled","aria-busy"],y={key:2},w={key:4,class:"sr-only",role:"status","aria-live":"polite"},x=e.defineComponent({inheritAttrs:!1,__name:"Button",props:{variant:{type:String,default:"default",validator:r=>["primary","default","danger","outline","secondary","ghost","link","success","warning","info","subtle","dark","light","primaryOutline","dangerOutline","successOutline","gradient"].includes(r)},size:{type:String,default:"default",validator:r=>["2xs","xs","sm","default","md","lg","xl","2xl","icon-sm","icon","icon-lg"].includes(r)},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},loadingText:{type:String,default:null},loadingLabel:{type:String,default:"Loading"},type:{type:String,default:"button"},icon:{type:String,default:null},permission:{type:[String,Array,Boolean,Function],default:null},role:{type:[String,Array,Boolean,Function],default:null},requireAll:{type:Boolean,default:!1},unauthorized:{type:String,default:"show",validator:r=>["show","hide","disable"].includes(r)}},setup(r){const o=r,i=e.inject(f.AUTH_RESOLVER_KEY,null),a=t=>t==null?null:typeof t=="boolean"?t:typeof t=="function"?!!t():t,s=e.computed(()=>{const t=a(o.permission),n=a(o.role);return t===null&&n===null?!0:(t===null||typeof t=="boolean")&&(n===null||typeof n=="boolean")?(t??!0)&&(n??!0):typeof i=="function"?!!i({permission:t,role:n,requireAll:o.requireAll}):!0}),u=e.computed(()=>o.unauthorized==="hide"&&!s.value),d=e.computed(()=>o.unauthorized==="disable"&&!s.value),l=e.computed(()=>o.disabled||o.loading||d.value),c=m.cva("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",{variants:{variant:{primary:"ui-primary-bg shadow-sm hover:bg-(--ui-primary-strong) hover:shadow-md",default:"ui-primary-bg shadow-sm hover:bg-(--ui-primary-strong) hover:shadow-md",danger:"ui-danger-bg shadow-sm hover:bg-(--ui-danger-strong) hover:shadow-md",outline:"border ui-border-strong ui-surface ui-text hover:bg-(--ui-surface-soft) hover:border-(--ui-primary) hover:text-(--ui-primary)",secondary:"border ui-border ui-surface-muted ui-text hover:bg-(--ui-surface-soft) hover:shadow-sm",ghost:"bg-transparent ui-text-muted hover:bg-[color:color-mix(in oklab, var(--ui-accent-soft), transparent 40%)] hover:text-(--ui-text)",link:"ui-primary underline-offset-4 hover:underline hover:text-(--ui-primary-strong)",success:"ui-success-bg shadow-sm hover:bg-(--ui-success-strong) hover:shadow-md",warning:"ui-warning-bg shadow-sm hover:bg-(--ui-warning-strong) hover:shadow-md",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",subtle:"border ui-border ui-surface ui-text-muted hover:text-(--ui-text) hover:bg-(--ui-surface-soft)",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",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",primaryOutline:"border border-(--ui-primary) ui-primary bg-transparent hover:bg-(--ui-primary-soft) hover:border-(--ui-primary-strong) hover:text-(--ui-primary-strong)",dangerOutline:"border border-(--ui-danger) ui-danger bg-transparent hover:bg-(--ui-danger-soft) hover:border-(--ui-danger-strong) hover:text-(--ui-danger-strong)",successOutline:"border border-(--ui-success) ui-success bg-transparent hover:bg-(--ui-success-soft) hover:border-(--ui-success-strong) hover:text-(--ui-success-strong)",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"},size:{"2xs":"h-4 px-1 py-3 text-md rounded",xs:"h-7 px-2.5 py-1 text-xs rounded-md",sm:"h-8 px-3 py-1.5 text-sm rounded-md",default:"h-9 px-4 py-2 text-sm rounded-md",md:"h-10 px-4 py-2 text-sm rounded-md",lg:"h-11 px-6 py-2.5 text-base rounded-md",xl:"h-12 px-8 py-3 text-base rounded-lg","2xl":"h-14 px-10 py-3.5 text-lg rounded-lg","icon-sm":"h-8 w-8 p-0",icon:"h-10 w-10 p-0","icon-lg":"h-12 w-12 p-0"}},defaultVariants:{variant:"default",size:"default"}}),h=e.computed(()=>({"2xs":"h-3 w-3",xs:"h-3.5 w-3.5",sm:"h-4 w-4",default:"h-4 w-4",md:"h-4 w-4",lg:"h-5 w-5",xl:"h-5 w-5","2xl":"h-6 w-6","icon-sm":"h-4 w-4",icon:"h-5 w-5","icon-lg":"h-6 w-6"})[o.size]||"h-4 w-4"),g=e.computed(()=>({"2xs":"h-3 w-3",xs:"h-3.5 w-3.5",sm:"h-4 w-4",default:"h-4 w-4",md:"h-4 w-4",lg:"h-5 w-5",xl:"h-5 w-5","2xl":"h-6 w-6","icon-sm":"h-4 w-4",icon:"h-5 w-5","icon-lg":"h-6 w-6"})[o.size]||"h-4 w-4");return(t,n)=>u.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",e.mergeProps({key:0,class:e.unref(b.cn)(e.unref(c)({variant:r.variant,size:r.size}),t.$attrs.class),disabled:l.value,type:r.type,"aria-disabled":l.value,"aria-busy":r.loading},t.$attrs),[r.loading?(e.openBlock(),e.createElementBlock("svg",{key:0,class:e.normalizeClass([g.value,"animate-spin mr-2 text-current"]),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true"},[...n[0]||(n[0]=[e.createElementVNode("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e.createElementVNode("path",{class:"opacity-75",fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-width":"4",d:"M4 12a8 8 0 018-8"},null,-1)])],2)):e.createCommentVNode("",!0),r.icon&&!r.loading?(e.openBlock(),e.createBlock(p.default,{key:1,icon:r.icon,class:e.normalizeClass(h.value)},null,8,["icon","class"])):e.createCommentVNode("",!0),r.loading&&r.loadingText?(e.openBlock(),e.createElementBlock("span",y,e.toDisplayString(r.loadingText),1)):e.renderSlot(t.$slots,"default",{key:3}),r.loading?(e.openBlock(),e.createElementBlock("span",w,e.toDisplayString(r.loadingLabel),1)):e.createCommentVNode("",!0)],16,v))}});exports._sfc_main=x;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.table-loading-overlay[data-v-dc691687]{border-radius:.5rem;z-index:10}.kv-module-themed-table[data-v-dc691687] thead th{background:var(--module-soft, var(--ui-primary-soft));color:var(--module-text, var(--ui-primary));border-bottom-color:var(--module-border, var(--ui-border-strong))}.kv-module-themed-table[data-v-dc691687] tbody tr:nth-child(odd){background:var(--module-soft-alt, transparent)}.kv-module-themed-table[data-v-dc691687] tbody tr:nth-child(2n){background:color-mix(in oklab,var(--module-soft-alt, transparent) 55%,transparent 45%)}@keyframes pulse-dc691687{0%,to{opacity:1}50%{opacity:.5}}.animate-pulse[data-v-dc691687]{animation:pulse-dc691687 2s cubic-bezier(.4,0,.6,1) infinite}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.kv-module-themed-toolbar[data-v-b6fc1eb4]{border-color:var(--module-border, var(--ui-border-strong));background:color-mix(in oklab,var(--module-soft, var(--ui-primary-soft)) 50%,var(--ui-bg) 50%)}.kv-module-themed-toolbar[data-v-b6fc1eb4] button{border-color:var(--module-border, var(--ui-border-strong))}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const e=require("vue"),ze={class:"relative w-full rounded-md bg-(--ui-surface)"},He={class:"relative"},Ke=["id","value","disabled","placeholder","required","aria-describedby","aria-expanded"],Oe={class:"min-w-0"},Ue={class:"mb-3 flex items-center justify-between gap-2"},qe=["disabled","aria-disabled","aria-label"],je=["aria-label"],We=["disabled","aria-disabled","aria-label"],Ge={class:"mb-1 grid grid-cols-7 gap-1","aria-hidden":"true"},Ze=["aria-label"],Je=["data-day","data-focus-preferred","disabled","aria-disabled","aria-selected","aria-label","onClick","onKeydown"],Qe=["aria-label"],Xe=["data-focus-preferred","disabled","aria-disabled","aria-selected","aria-label","onClick"],et=["aria-label"],tt=["data-focus-preferred","disabled","aria-disabled","aria-selected","aria-label","onClick"],at={key:3,class:"mt-3 border-t pt-2 ui-border"},rt=["disabled","aria-disabled"],lt={key:0,class:"border-t pt-3 ui-border sm:border-l sm:border-t-0 sm:pl-3 sm:pt-0"},nt={class:"max-h-64 space-y-1 overflow-y-auto pr-1"},ot=["aria-selected","onClick"],k=12,it=e.defineComponent({__name:"DatePicker",props:{id:String,modelValue:{type:[String,Date],default:""},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},min:[String,Date],max:[String,Date],minDate:[String,Date],maxDate:[String,Date],yearRange:Array,initialView:{type:String,default:"day",validator:f=>["day","month","year"].includes(f)},placeholder:{type:String,default:"Select date"},format:{type:String,default:"DD/MM/YYYY"},clearable:{type:Boolean,default:!0},showToday:{type:Boolean,default:!0},calendarPosition:{type:String,default:"left-0 bottom-full"},ariaDescribedby:String,customValidation:{type:Function,default:null},disabledDates:{type:[Array,Function],default:null},enableTime:{type:Boolean,default:!1},minuteInterval:{type:Number,default:1}},emits:["update:modelValue","validation-error"],setup(f,{emit:xe}){const i=f,S=xe,p=e.ref(!1),s=e.ref("day"),T=e.ref(null),z=e.ref(null),X=e.ref({}),v=A(new Date),c=e.ref(v.getMonth()),n=e.ref(v.getFullYear()),C=e.ref(v.getDate()),b=e.ref(Math.floor(v.getFullYear()/k)*k),u=e.ref(null),Y=e.ref(!1),D=e.ref("00:00"),we=["Su","Mo","Tu","We","Th","Fr","Sa"],ee=Array.from({length:12},(t,a)=>new Date(2e3,a,1).toLocaleString("default",{month:"long"})),x=e.computed(()=>I(i.minDate??i.min)),w=e.computed(()=>I(i.maxDate??i.max)),m=e.computed(()=>{if(!i.yearRange||i.yearRange.length!==2)return null;const t=Math.trunc(Number(i.yearRange[0])),a=Math.trunc(Number(i.yearRange[1]));return!Number.isFinite(t)||!Number.isFinite(a)?null:t<=a?[t,a]:[a,t]}),B=e.computed(()=>Math.max(m.value?.[0]??Number.NEGATIVE_INFINITY,x.value?.getFullYear()??Number.NEGATIVE_INFINITY)),F=e.computed(()=>Math.min(m.value?.[1]??Number.POSITIVE_INFINITY,w.value?.getFullYear()??Number.POSITIVE_INFINITY)),H=e.computed(()=>ee[c.value]),te=e.computed(()=>M(n.value,c.value)),ae=e.computed(()=>d(n.value,c.value,1).getDay()),re=e.computed(()=>{const t=M(n.value,c.value-1);return Array.from({length:ae.value},(a,r)=>t-ae.value+r+1)}),De=e.computed(()=>{const t=re.value.length+te.value,a=t%7===0?0:7-t%7;return Array.from({length:a},(r,l)=>l+1)}),le=e.computed(()=>Array.from({length:k},(t,a)=>b.value+a).filter(t=>t>=B.value&&t<=F.value)),ne=e.computed(()=>b.value+k-1),$=e.computed(()=>{if(s.value==="day")return`${H.value} ${n.value}`;if(s.value==="month")return String(n.value);const t=le.value;return t.length?`${t[0]}–${t[t.length-1]}`:`${b.value}–${ne.value}`}),Ne=e.computed(()=>s.value==="day"?`Select the month. Currently ${$.value}`:s.value==="month"?`Select the year. Currently ${n.value}`:`Return to day selection. Showing years ${$.value}`),Ee=e.computed(()=>s.value==="day"?"Previous month":s.value==="month"?"Previous year":"Previous year range"),Se=e.computed(()=>s.value==="day"?"Next month":s.value==="month"?"Next year":"Next year range"),K=e.computed(()=>s.value==="day"?j(n.value,c.value-1):s.value==="month"?n.value-1>=B.value:b.value>B.value),O=e.computed(()=>s.value==="day"?j(n.value,c.value+1):s.value==="month"?n.value+1<=F.value:ne.value<F.value),oe=e.computed(()=>u.value?i.enableTime?Me(u.value):ie(u.value):""),Be=e.computed(()=>{const t=Math.min(60,Math.max(1,Number(i.minuteInterval)||1)),a=[];for(let r=0;r<24;r++)for(let l=0;l<60;l+=t)a.push(`${String(r).padStart(2,"0")}:${String(l).padStart(2,"0")}`);return a});function d(t,a,r,l=0,o=0){const y=new Date(0);return y.setFullYear(t,a,r),y.setHours(l,o,0,0),y}function A(t){return d(t.getFullYear(),t.getMonth(),t.getDate())}function M(t,a){return d(t,a+1,0).getDate()}function I(t){if(!t)return null;if(t instanceof Date)return Number.isNaN(t.getTime())?null:d(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes());const a=t.match(/^(\d{4,})-(\d{2})-(\d{2})(?:T(\d{2}):(\d{2}))?/);if(a){const[,l,o,y,h="0",V="0"]=a,ye=Number(l),he=Number(o)-1,ke=Number(y),P=d(ye,he,ke,Number(h),Number(V));return P.getFullYear()===ye&&P.getMonth()===he&&P.getDate()===ke?P:null}const r=new Date(t);return Number.isNaN(r.getTime())?null:r}function g(t){return d(t.getFullYear(),t.getMonth(),t.getDate()).getTime()}function ie(t){const a=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return i.format.replace("MM",a).replace("DD",r).replace("YYYY",String(t.getFullYear()))}function Me(t){const a=String(t.getHours()).padStart(2,"0"),r=String(t.getMinutes()).padStart(2,"0");return`${ie(t)} ${a}:${r}`}function Ve(t){const a=String(t.getFullYear()).padStart(4,"0"),r=String(t.getMonth()+1).padStart(2,"0"),l=String(t.getDate()).padStart(2,"0");return`${a}-${r}-${l}`}function U(t){const a=g(t);return!(x.value&&a<g(x.value)||w.value&&a>g(w.value)||m.value&&(t.getFullYear()<m.value[0]||t.getFullYear()>m.value[1]))}function N(t){return!U(t)||i.disabledDates&&(typeof i.disabledDates=="function"&&i.disabledDates(new Date(t))||Array.isArray(i.disabledDates)&&i.disabledDates.some(a=>{const r=I(a);return r?g(r)===g(t):!1}))?!0:!!i.customValidation?.(new Date(t))}function q(t){return N(d(n.value,c.value,t))}function _(t){for(let a=1;a<=M(n.value,t);a++)if(!N(d(n.value,t,a)))return!1;return!0}function R(t){if(t<B.value||t>F.value)return!0;for(let a=0;a<12;a++)for(let r=1;r<=M(t,a);r++)if(!N(d(t,a,r)))return!1;return!0}function j(t,a){const r=d(t,a,1),l=d(r.getFullYear(),r.getMonth()+1,0);return!(r.getFullYear()<B.value||r.getFullYear()>F.value||x.value&&g(l)<g(x.value)||w.value&&g(r)>g(w.value))}function W(t){const a=m.value?.[0];return a!==void 0?a+Math.floor((t-a)/k)*k:Math.floor(t/k)*k}function ue(t){let a=A(t);return m.value&&a.getFullYear()<m.value[0]&&(a=d(m.value[0],0,1)),m.value&&a.getFullYear()>m.value[1]&&(a=d(m.value[1],11,31)),x.value&&g(a)<g(x.value)&&(a=A(x.value)),w.value&&g(a)>g(w.value)&&(a=A(w.value)),a}function Te(t){return v.getDate()===t&&v.getMonth()===c.value&&v.getFullYear()===n.value}function G(t){return!!(u.value&&u.value.getDate()===t&&u.value.getMonth()===c.value&&u.value.getFullYear()===n.value)}function se(t){if(!t)return Y.value=!1,S("validation-error",null),!0;const a=i.customValidation?.(new Date(t))||null;return Y.value=!!a,S("validation-error",a),!a}async function Z(){await e.nextTick();const t=z.value||(i.id?document.getElementById(i.id):null);if(!t||!T.value)return;const a=t.getBoundingClientRect(),r=T.value.offsetHeight||360,l=T.value.offsetWidth||(i.enableTime?448:320),o=window.innerHeight-a.bottom,y=o>=r||o>a.top?a.bottom+8:Math.max(8,a.top-r-8),h=Math.min(Math.max(16,a.left),Math.max(16,window.innerWidth-l-16));X.value={top:`${y}px`,left:`${h}px`}}function E(t){C.value=t.getDate(),c.value=t.getMonth(),n.value=t.getFullYear(),b.value=W(t.getFullYear())}async function de(){i.disabled||p.value||((!u.value||!U(u.value))&&E(ue(v)),s.value=i.initialView,b.value=W(n.value),p.value=!0,await Z(),await ve())}function Ye(){p.value?L():de()}function L(t=!1){p.value=!1,t&&e.nextTick(()=>z.value?.focus())}async function J(t){s.value=t,t==="year"&&(b.value=W(n.value)),await e.nextTick(),await Z(),await ve()}function Fe(){J({day:"month",month:"year",year:"day"}[s.value])}function Ce(){K.value&&(s.value==="day"?E(d(n.value,c.value-1,1)):s.value==="month"?n.value--:b.value=Math.max(b.value-k,B.value))}function $e(){O.value&&(s.value==="day"?E(d(n.value,c.value+1,1)):s.value==="month"?n.value++:b.value+=k)}function Ae(t){R(t)||(n.value=t,J("month"))}function Ie(t){_(t)||(c.value=t,C.value=Math.min(C.value,M(n.value,t)),J("day"))}function ce(t){const a=d(n.value,c.value,t);if(N(a)||!se(a))return;const[r="0",l="0"]=D.value.split(":");a.setHours(Number(r),Number(l),0,0),u.value=a,fe(a),i.enableTime||window.setTimeout(()=>L(),150)}function fe(t){const a=Ve(t);i.enableTime?S("update:modelValue",`${a}T${D.value}`):S("update:modelValue",a)}function _e(){N(v)||(E(v),ce(v.getDate()))}function Re(){u.value=null,D.value="00:00",Y.value=!1,S("update:modelValue",""),S("validation-error",null)}function Q(){return Array.from(T.value?.querySelectorAll("[data-picker-option]:not(:disabled)")||[])}async function ve(){await e.nextTick();const t=Q(),a=t.find(l=>l.getAttribute("aria-selected")==="true"),r=t.find(l=>l.dataset.focusPreferred==="true");(a||r||t[0])?.focus()}function me(t,a){const r=Q(),l=r.indexOf(t.currentTarget);if(l<0)return;let o=l;if(t.key==="ArrowRight")o=Math.min(r.length-1,l+1);else if(t.key==="ArrowLeft")o=Math.max(0,l-1);else if(t.key==="ArrowDown")o=Math.min(r.length-1,l+a);else if(t.key==="ArrowUp")o=Math.max(0,l-a);else if(t.key==="Home")o=l-l%a;else if(t.key==="End")o=Math.min(r.length-1,l+a-1-l%a);else return;t.preventDefault(),r[o]?.focus()}function Le(t,a){if(t.key==="PageUp"||t.key==="PageDown"){t.preventDefault();const h=t.key==="PageUp"?-1:1,V=d(n.value,c.value+h,Math.min(a,M(n.value,c.value+h)));j(V.getFullYear(),V.getMonth())&&(E(V),e.nextTick(()=>ge(V.getDate(),h)));return}if(!["ArrowRight","ArrowLeft","ArrowDown","ArrowUp","Home","End"].includes(t.key))return;t.preventDefault();let l={ArrowRight:1,ArrowLeft:-1,ArrowDown:7,ArrowUp:-7}[t.key];t.key==="Home"&&(l=-d(n.value,c.value,a).getDay()),t.key==="End"&&(l=6-d(n.value,c.value,a).getDay());let o=d(n.value,c.value,a+l);const y=l<0?-1:1;for(let h=0;h<3660;h++){if(!U(o))return;if(!N(o)){E(o),e.nextTick(()=>ge(o.getDate(),y));return}o=d(o.getFullYear(),o.getMonth(),o.getDate()+y)}}function ge(t,a){const r=Q();(r.find(o=>Number(o.dataset.day)===t)||(a<0?r.at(-1):r[0]))?.focus()}function Pe(t){["Enter"," ","ArrowDown"].includes(t.key)?(t.preventDefault(),de()):t.key==="Escape"&&p.value&&(t.preventDefault(),L(!0))}function pe(t){t.key==="Escape"&&p.value&&(t.preventDefault(),L(!0))}function be(){p.value&&Z()}return e.watch(()=>i.modelValue,t=>{const a=I(t);if(!a){u.value=null,Y.value=!1;return}u.value=a,D.value=`${String(a.getHours()).padStart(2,"0")}:${String(a.getMinutes()).padStart(2,"0")}`,E(a),se(a)},{immediate:!0}),e.watch([m,x,w],()=>{!u.value&&!p.value&&E(ue(v))}),e.watch(D,t=>{if(!i.enableTime||!u.value)return;const[a="0",r="0"]=t.split(":");u.value.setHours(Number(a),Number(r),0,0),fe(u.value)}),e.onMounted(()=>{document.addEventListener("keydown",pe),window.addEventListener("resize",be)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",pe),window.removeEventListener("resize",be)}),(t,a)=>(e.openBlock(),e.createElementBlock("div",ze,[e.createElementVNode("div",He,[e.createElementVNode("input",{id:f.id,ref_key:"inputRef",ref:z,type:"text",value:oe.value,readonly:"",disabled:f.disabled,placeholder:f.placeholder,required:f.required,"aria-describedby":f.ariaDescribedby,"aria-haspopup":"dialog","aria-expanded":p.value,class:e.normalizeClass(["w-full cursor-pointer rounded-md border px-3 py-2 pr-10 text-sm ui-surface ui-text placeholder:text-(--ui-text-muted) transition-colors","focus:border-(--ui-primary) focus:outline-none focus:ring-2 focus:ring-(--ui-ring)","disabled:cursor-not-allowed disabled:bg-(--ui-surface-muted) disabled:text-(--ui-text-muted)",Y.value?"border-(--ui-danger) focus:border-(--ui-danger) focus:ring-(--ui-danger)":"ui-border"]),onClick:Ye,onKeydown:Pe},null,42,Ke),a[4]||(a[4]=e.createElementVNode("div",{class:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2"},[e.createElementVNode("svg",{class:"h-4 w-4 ui-text-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true"},[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)),f.clearable&&oe.value&&!f.disabled?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"absolute right-9 top-1/2 -translate-y-1/2 rounded p-1 ui-text-muted transition-colors hover:bg-(--ui-surface-muted) hover:text-(--ui-text) focus-visible:ring-2 focus-visible:ring-(--ui-ring)","aria-label":"Clear date",onClick:e.withModifiers(Re,["stop"])},[...a[3]||(a[3]=[e.createElementVNode("svg",{class:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])):e.createCommentVNode("",!0)]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{"enter-active-class":"transition duration-100 ease-out","enter-from-class":"scale-95 opacity-0","enter-to-class":"scale-100 opacity-100","leave-active-class":"transition duration-75 ease-in","leave-from-class":"scale-100 opacity-100","leave-to-class":"scale-95 opacity-0"},{default:e.withCtx(()=>[p.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"calendarRef",ref:T,style:e.normalizeStyle(X.value),role:"dialog","aria-label":"Choose date","aria-modal":"false",class:e.normalizeClass(["fixed z-10000 max-w-[calc(100vw-2rem)] rounded-lg border p-3 shadow-xl ui-surface ui-border-strong",f.enableTime?"w-[28rem]":"w-80"]),onClick:a[2]||(a[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(f.enableTime?"grid grid-cols-1 gap-3 sm:grid-cols-[1fr_7.75rem]":"block")},[e.createElementVNode("div",Oe,[e.createElementVNode("div",Ue,[e.createElementVNode("button",{type:"button",class:"rounded p-1.5 ui-text-muted transition-colors hover:bg-(--ui-surface-muted) hover:text-(--ui-text) focus-visible:ring-2 focus-visible:ring-(--ui-ring) disabled:cursor-not-allowed disabled:opacity-40",disabled:!K.value,"aria-disabled":!K.value,"aria-label":Ee.value,onClick:Ce},[...a[5]||(a[5]=[e.createElementVNode("svg",{class:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 18l-6-6 6-6"})],-1)])],8,qe),e.createElementVNode("button",{type:"button",class:"min-w-0 flex-1 rounded px-2 py-1 text-sm font-semibold ui-text transition-colors hover:bg-(--ui-surface-muted) focus-visible:ring-2 focus-visible:ring-(--ui-ring)","aria-label":Ne.value,onClick:Fe},e.toDisplayString($.value),9,je),e.createElementVNode("button",{type:"button",class:"rounded p-1.5 ui-text-muted transition-colors hover:bg-(--ui-surface-muted) hover:text-(--ui-text) focus-visible:ring-2 focus-visible:ring-(--ui-ring) disabled:cursor-not-allowed disabled:opacity-40",disabled:!O.value,"aria-disabled":!O.value,"aria-label":Se.value,onClick:$e},[...a[6]||(a[6]=[e.createElementVNode("svg",{class:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 18l6-6-6-6"})],-1)])],8,We)]),s.value==="day"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Ge,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(we,r=>e.createElementVNode("div",{key:r,class:"py-1 text-center text-xs font-medium ui-text-muted"},e.toDisplayString(r),1)),64))]),e.createElementVNode("div",{class:"grid grid-cols-7 gap-1",role:"grid","aria-label":`${H.value} ${n.value}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(re.value,(r,l)=>(e.openBlock(),e.createElementBlock("div",{key:`prev-${l}`,class:"py-1.5 text-center text-xs ui-text-soft","aria-hidden":"true"},e.toDisplayString(r),1))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(te.value,r=>(e.openBlock(),e.createElementBlock("button",{key:r,type:"button",role:"gridcell","data-picker-option":"","data-day":r,"data-focus-preferred":r===C.value,disabled:q(r),"aria-disabled":q(r),"aria-selected":G(r),"aria-label":`${H.value} ${r}, ${n.value}`,class:e.normalizeClass(["h-8 w-full min-w-0 rounded text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:ring-(--ui-ring)",Te(r)&&!G(r)?"ui-primary-soft ring-1 ring-(--ui-primary)":"",G(r)?"ui-primary-bg":"ui-text hover:bg-(--ui-surface-muted)",q(r)?"cursor-not-allowed text-(--ui-text-soft) opacity-45 line-through hover:bg-transparent":"cursor-pointer"]),onClick:l=>ce(r),onKeydown:l=>Le(l,r)},e.toDisplayString(r),43,Je))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(De.value,(r,l)=>(e.openBlock(),e.createElementBlock("div",{key:`next-${l}`,class:"py-1.5 text-center text-xs ui-text-soft","aria-hidden":"true"},e.toDisplayString(r),1))),128))],8,Ze)],64)):s.value==="month"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"grid grid-cols-3 gap-2",role:"grid","aria-label":`Select a month in ${n.value}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(ee),(r,l)=>(e.openBlock(),e.createElementBlock("button",{key:r,type:"button",role:"gridcell","data-picker-option":"","data-focus-preferred":l===c.value,disabled:_(l),"aria-disabled":_(l),"aria-selected":u.value?.getFullYear()===n.value&&u.value?.getMonth()===l,"aria-label":`Select ${r} ${n.value}`,class:e.normalizeClass(["min-h-11 rounded px-2 py-2 text-sm transition-colors focus-visible:ring-2 focus-visible:ring-(--ui-ring)",u.value?.getFullYear()===n.value&&u.value?.getMonth()===l?"ui-primary-bg":"ui-text hover:bg-(--ui-surface-muted)",_(l)?"cursor-not-allowed text-(--ui-text-soft) opacity-45 hover:bg-transparent":""]),onClick:o=>Ie(l),onKeydown:a[0]||(a[0]=o=>me(o,3))},e.toDisplayString(r.slice(0,3)),43,Xe))),128))],8,Qe)):(e.openBlock(),e.createElementBlock("div",{key:2,class:"grid grid-cols-3 gap-2 sm:grid-cols-4",role:"grid","aria-label":`Select a year from ${$.value}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(le.value,r=>(e.openBlock(),e.createElementBlock("button",{key:r,type:"button",role:"gridcell","data-picker-option":"","data-focus-preferred":r===n.value,disabled:R(r),"aria-disabled":R(r),"aria-selected":u.value?.getFullYear()===r,"aria-label":`Select year ${r}`,class:e.normalizeClass(["min-h-11 rounded px-1 py-2 text-sm transition-colors focus-visible:ring-2 focus-visible:ring-(--ui-ring)",u.value?.getFullYear()===r?"ui-primary-bg":"ui-text hover:bg-(--ui-surface-muted)",R(r)?"cursor-not-allowed text-(--ui-text-soft) opacity-45 hover:bg-transparent":""]),onClick:l=>Ae(r),onKeydown:a[1]||(a[1]=l=>me(l,3))},e.toDisplayString(r),43,tt))),128))],8,et)),f.showToday&&s.value==="day"?(e.openBlock(),e.createElementBlock("div",at,[e.createElementVNode("button",{type:"button",class:"w-full rounded px-3 py-1.5 text-xs font-medium ui-primary transition-colors hover:bg-(--ui-primary-soft) focus-visible:ring-2 focus-visible:ring-(--ui-ring) disabled:cursor-not-allowed disabled:opacity-40",disabled:N(e.unref(v)),"aria-disabled":N(e.unref(v)),onClick:_e}," Today ",8,rt)])):e.createCommentVNode("",!0)]),f.enableTime?(e.openBlock(),e.createElementBlock("div",lt,[a[7]||(a[7]=e.createElementVNode("div",{class:"mb-2 text-xs font-semibold ui-text"}," Time ",-1)),e.createElementVNode("div",nt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Be.value,r=>(e.openBlock(),e.createElementBlock("button",{key:r,type:"button",class:e.normalizeClass(["w-full rounded px-2 py-1.5 text-left text-sm transition-colors focus-visible:ring-2 focus-visible:ring-(--ui-ring)",r===D.value?"ui-primary-bg":"ui-text hover:bg-(--ui-surface-muted)"]),"aria-selected":r===D.value,onClick:l=>D.value=r},e.toDisplayString(r),11,ot))),128))])])):e.createCommentVNode("",!0)],2)],6)):e.createCommentVNode("",!0)]),_:1})]))]))}});exports._sfc_main=it;
|