windly-ui 1.0.2 → 1.0.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.
Files changed (103) hide show
  1. package/{ui-library/dist → dist}/module.json +2 -2
  2. package/dist/module.mjs +33 -0
  3. package/dist/runtime/components/Accordion.d.vue.ts +39 -0
  4. package/dist/runtime/components/Accordion.vue +96 -0
  5. package/dist/runtime/components/Accordion.vue.d.ts +39 -0
  6. package/dist/runtime/components/Alert.d.vue.ts +83 -0
  7. package/dist/runtime/components/Alert.vue +78 -0
  8. package/dist/runtime/components/Alert.vue.d.ts +83 -0
  9. package/dist/runtime/components/Avatar.d.vue.ts +141 -0
  10. package/dist/runtime/components/Avatar.vue +72 -0
  11. package/dist/runtime/components/Avatar.vue.d.ts +141 -0
  12. package/dist/runtime/components/Badge.d.vue.ts +133 -0
  13. package/dist/runtime/components/Badge.vue +99 -0
  14. package/dist/runtime/components/Badge.vue.d.ts +133 -0
  15. package/dist/runtime/components/Breadcrumbs.d.vue.ts +83 -0
  16. package/dist/runtime/components/Breadcrumbs.vue +116 -0
  17. package/dist/runtime/components/Breadcrumbs.vue.d.ts +83 -0
  18. package/dist/runtime/components/Button.d.vue.ts +208 -0
  19. package/dist/runtime/components/Button.vue +126 -0
  20. package/dist/runtime/components/Button.vue.d.ts +208 -0
  21. package/dist/runtime/components/Card.d.vue.ts +83 -0
  22. package/dist/runtime/components/Card.vue +71 -0
  23. package/dist/runtime/components/Card.vue.d.ts +83 -0
  24. package/dist/runtime/components/Checkbox.d.vue.ts +190 -0
  25. package/dist/runtime/components/Checkbox.vue +125 -0
  26. package/dist/runtime/components/Checkbox.vue.d.ts +190 -0
  27. package/dist/runtime/components/CodeBlock.d.vue.ts +16 -0
  28. package/dist/runtime/components/CodeBlock.vue +75 -0
  29. package/dist/runtime/components/CodeBlock.vue.d.ts +16 -0
  30. package/dist/runtime/components/ColorPicker.d.vue.ts +91 -0
  31. package/dist/runtime/components/ColorPicker.vue +244 -0
  32. package/dist/runtime/components/ColorPicker.vue.d.ts +91 -0
  33. package/dist/runtime/components/Date.d.vue.ts +137 -0
  34. package/dist/runtime/components/Date.vue +201 -0
  35. package/dist/runtime/components/Date.vue.d.ts +137 -0
  36. package/dist/runtime/components/Dialog.d.vue.ts +63 -0
  37. package/dist/runtime/components/Dialog.vue +85 -0
  38. package/dist/runtime/components/Dialog.vue.d.ts +63 -0
  39. package/dist/runtime/components/Divider.d.vue.ts +51 -0
  40. package/dist/runtime/components/Divider.vue +52 -0
  41. package/dist/runtime/components/Divider.vue.d.ts +51 -0
  42. package/dist/runtime/components/Drawer.d.vue.ts +30 -0
  43. package/dist/runtime/components/Drawer.vue +43 -0
  44. package/dist/runtime/components/Drawer.vue.d.ts +30 -0
  45. package/dist/runtime/components/Dropdown.d.vue.ts +34 -0
  46. package/dist/runtime/components/Dropdown.vue +127 -0
  47. package/dist/runtime/components/Dropdown.vue.d.ts +34 -0
  48. package/dist/runtime/components/FileUploader.d.vue.ts +65 -0
  49. package/dist/runtime/components/FileUploader.vue +358 -0
  50. package/dist/runtime/components/FileUploader.vue.d.ts +65 -0
  51. package/dist/runtime/components/Icon.d.vue.ts +41 -0
  52. package/dist/runtime/components/Icon.vue +66 -0
  53. package/dist/runtime/components/Icon.vue.d.ts +41 -0
  54. package/dist/runtime/components/Image.d.vue.ts +77 -0
  55. package/dist/runtime/components/Image.vue +61 -0
  56. package/dist/runtime/components/Image.vue.d.ts +77 -0
  57. package/dist/runtime/components/Input.d.vue.ts +68 -0
  58. package/dist/runtime/components/Input.vue +241 -0
  59. package/dist/runtime/components/Input.vue.d.ts +68 -0
  60. package/dist/runtime/components/Radio.d.vue.ts +41 -0
  61. package/dist/runtime/components/Radio.vue +222 -0
  62. package/dist/runtime/components/Radio.vue.d.ts +41 -0
  63. package/dist/runtime/components/ScrollArea.d.vue.ts +79 -0
  64. package/dist/runtime/components/ScrollArea.vue +36 -0
  65. package/dist/runtime/components/ScrollArea.vue.d.ts +79 -0
  66. package/dist/runtime/components/Select.d.vue.ts +51 -0
  67. package/dist/runtime/components/Select.vue +271 -0
  68. package/dist/runtime/components/Select.vue.d.ts +51 -0
  69. package/dist/runtime/components/Stepper.d.vue.ts +46 -0
  70. package/dist/runtime/components/Stepper.vue +218 -0
  71. package/dist/runtime/components/Stepper.vue.d.ts +46 -0
  72. package/dist/runtime/components/TabPanel.d.vue.ts +17 -0
  73. package/dist/runtime/components/TabPanel.vue +21 -0
  74. package/dist/runtime/components/TabPanel.vue.d.ts +17 -0
  75. package/dist/runtime/components/Table.d.vue.ts +40 -0
  76. package/dist/runtime/components/Table.vue +92 -0
  77. package/dist/runtime/components/Table.vue.d.ts +40 -0
  78. package/dist/runtime/components/Tabs.d.vue.ts +20 -0
  79. package/dist/runtime/components/Tabs.vue +62 -0
  80. package/dist/runtime/components/Tabs.vue.d.ts +20 -0
  81. package/dist/runtime/components/Textarea.d.vue.ts +208 -0
  82. package/dist/runtime/components/Textarea.vue +185 -0
  83. package/dist/runtime/components/Textarea.vue.d.ts +208 -0
  84. package/dist/runtime/components/Toggle.d.vue.ts +36 -0
  85. package/dist/runtime/components/Toggle.vue +173 -0
  86. package/dist/runtime/components/Toggle.vue.d.ts +36 -0
  87. package/dist/runtime/components/Tooltip.d.vue.ts +63 -0
  88. package/dist/runtime/components/Tooltip.vue +144 -0
  89. package/dist/runtime/components/Tooltip.vue.d.ts +63 -0
  90. package/dist/runtime/components/uiProps.d.ts +38 -0
  91. package/dist/runtime/components/uiProps.js +11 -0
  92. package/dist/runtime/components/useUiClasses.d.ts +43 -0
  93. package/dist/runtime/components/useUiClasses.js +124 -0
  94. package/dist/runtime/composables/plugin.d.ts +2 -0
  95. package/dist/runtime/composables/plugin.js +3 -0
  96. package/dist/runtime/tailwind-color.d.ts +2 -0
  97. package/dist/runtime/tailwind-color.js +5859 -0
  98. package/package.json +12 -46
  99. package/LICENSE +0 -21
  100. package/README.md +0 -232
  101. package/ui-library/dist/module.mjs +0 -22
  102. /package/{ui-library/dist → dist}/module.d.mts +0 -0
  103. /package/{ui-library/dist → dist}/types.d.mts +0 -0
@@ -0,0 +1,201 @@
1
+ <script setup>
2
+ import { ref, computed, watch } from "vue";
3
+ import { useUiClasses } from "./useUiClasses";
4
+ import { uiProps } from "./uiProps";
5
+ const props = defineProps({
6
+ modelValue: { type: [String, Array], default: "" },
7
+ multiDate: Boolean,
8
+ rangeDate: Boolean,
9
+ disabledDates: { type: Array, default: () => [] },
10
+ format: { type: String, default: "DD-MM-YYYY" },
11
+ showHeader: { type: Boolean, default: true },
12
+ backgroundColor: { type: String, default: "white" },
13
+ bordered: { type: Boolean, default: false },
14
+ borderRadius: { type: String, default: "rounded-md", acceptedValues: ["none", "sm", "md", "lg", "xl"] },
15
+ flat: { type: Boolean, default: false },
16
+ color: { type: String, default: "indigo" },
17
+ textColor: uiProps.textColor,
18
+ contentClass: uiProps.contentClass,
19
+ contentStyle: uiProps.contentStyle,
20
+ disable: uiProps.disable
21
+ });
22
+ const {
23
+ isHex
24
+ } = useUiClasses(props);
25
+ const emit = defineEmits(["update:modelValue", "change"]);
26
+ const today = /* @__PURE__ */ new Date();
27
+ const currentMonth = ref(today.getMonth());
28
+ const currentYear = ref(today.getFullYear());
29
+ const selectedDates = ref([]);
30
+ const rangeStart = ref(null);
31
+ const rangeEnd = ref(null);
32
+ const headerLabel = computed(() => {
33
+ const first = selectedDates.value[0];
34
+ if (!first) return "No date selected";
35
+ const date = new Date(first);
36
+ const dayName = date.toLocaleDateString("default", {
37
+ weekday: "long"
38
+ });
39
+ return dayName;
40
+ });
41
+ const daysInMonth = computed(() => {
42
+ return new Date(currentYear.value, currentMonth.value + 1, 0).getDate();
43
+ });
44
+ const blankDays = computed(() => {
45
+ return new Date(currentYear.value, currentMonth.value, 1).getDay();
46
+ });
47
+ const days = computed(
48
+ () => Array.from({ length: daysInMonth.value }, (_, i) => i + 1)
49
+ );
50
+ function formatDate(day) {
51
+ const d = new Date(currentYear.value, currentMonth.value, day);
52
+ const year = d.getFullYear();
53
+ const month = String(d.getMonth() + 1).padStart(2, "0");
54
+ const date = String(d.getDate()).padStart(2, "0");
55
+ return `${year}-${month}-${date}`;
56
+ }
57
+ function formatDateString(date, format) {
58
+ const map = {
59
+ YYYY: String(date.getFullYear()),
60
+ MM: String(date.getMonth() + 1).padStart(2, "0"),
61
+ DD: String(date.getDate()).padStart(2, "0"),
62
+ HH: String(date.getHours()).padStart(2, "0"),
63
+ mm: String(date.getMinutes()).padStart(2, "0"),
64
+ ss: String(date.getSeconds()).padStart(2, "0")
65
+ };
66
+ return format.replace(/YYYY|MM|DD|HH|mm|ss/g, (match) => {
67
+ return map[match];
68
+ });
69
+ }
70
+ function isDisabled(day) {
71
+ return props.disabledDates.includes(formatDate(day));
72
+ }
73
+ function isSelected(day) {
74
+ return selectedDates.value.includes(formatDate(day));
75
+ }
76
+ function isToday(day) {
77
+ const d = /* @__PURE__ */ new Date();
78
+ return day === d.getDate() && currentMonth.value === d.getMonth() && currentYear.value === d.getFullYear();
79
+ }
80
+ function isInRange(day) {
81
+ if (rangeStart.value === null || rangeEnd.value === null) return false;
82
+ const start = Math.min(rangeStart.value, rangeEnd.value);
83
+ const end = Math.max(rangeStart.value, rangeEnd.value);
84
+ return day >= start && day <= end;
85
+ }
86
+ function dayClasses(day) {
87
+ if (isDisabled(day)) return "text-gray-300 cursor-not-allowed";
88
+ if (isSelected(day))
89
+ return `bg-${props.color}-600 text-white font-medium`;
90
+ if (props.rangeDate && isInRange(day))
91
+ return `bg-${props.color}-100 text-${props.color}-700`;
92
+ if (isToday(day))
93
+ return `border border-${props.color}-500`;
94
+ return "hover:bg-gray-100";
95
+ }
96
+ function selectDate(day) {
97
+ if (isDisabled(day)) return;
98
+ const value = formatDate(day);
99
+ if (props.multiDate) {
100
+ if (selectedDates.value.includes(value)) {
101
+ selectedDates.value = selectedDates.value.filter((d) => d !== value);
102
+ } else {
103
+ selectedDates.value.push(value);
104
+ }
105
+ } else if (props.rangeDate) {
106
+ if (rangeStart.value === null) {
107
+ rangeStart.value = day;
108
+ rangeEnd.value = null;
109
+ } else {
110
+ rangeEnd.value = day;
111
+ selectedDates.value = buildRange();
112
+ }
113
+ } else {
114
+ selectedDates.value = [value];
115
+ }
116
+ emit("update:modelValue", selectedDates.value);
117
+ emit("change", selectedDates.value);
118
+ }
119
+ function buildRange() {
120
+ if (rangeStart.value === null || rangeEnd.value === null) return [];
121
+ const start = Math.min(rangeStart.value, rangeEnd.value);
122
+ const end = Math.max(rangeStart.value, rangeEnd.value);
123
+ const range = [];
124
+ for (let i = start; i <= end; i++) {
125
+ range.push(formatDate(i));
126
+ }
127
+ return range;
128
+ }
129
+ function nextMonth() {
130
+ if (currentMonth.value === 11) {
131
+ currentMonth.value = 0;
132
+ currentYear.value++;
133
+ } else currentMonth.value++;
134
+ }
135
+ function prevMonth() {
136
+ if (currentMonth.value === 0) {
137
+ currentMonth.value = 11;
138
+ currentYear.value--;
139
+ } else currentMonth.value--;
140
+ }
141
+ watch(
142
+ () => props.modelValue,
143
+ (val) => {
144
+ if (!val) return;
145
+ if (Array.isArray(val)) {
146
+ selectedDates.value = val;
147
+ } else {
148
+ selectedDates.value = [val];
149
+ }
150
+ },
151
+ { immediate: true }
152
+ );
153
+ </script>
154
+
155
+ <template>
156
+ <div class="w-80 min-w-80" :class="[
157
+ borderRadius ? `rounded-${borderRadius}` : '',
158
+ bordered ? 'border border-gray-200' : '',
159
+ flat ? '' : 'shadow-md',
160
+ textColor && !isHex(textColor) ? `text-${textColor}` : 'text-gray-800',
161
+ backgroundColor && !isHex(backgroundColor) ? `bg-${backgroundColor}` : ''
162
+ ]" :style="{
163
+ backgroundColor: isHex(backgroundColor) ? backgroundColor : '',
164
+ color: isHex(textColor) ? textColor : ''
165
+ }">
166
+ <div v-if="showHeader" class="px-4 py-3 flex justify-between items-center"
167
+ :class="bordered ? 'border-b border-gray-200' : ''">
168
+ <div class="text-sm font-semibold text-gray-700">
169
+ <div v-if="multiDate">{{ selectedDates.length }} selected</div>
170
+ <div v-else>
171
+ <div class="text-lg" :class="`text-${color}-600`">{{ headerLabel }}</div>
172
+ <div class="text-gray-700">
173
+ {{ selectedDates[0] ? formatDateString(new Date(selectedDates[0]), format) : "" }}
174
+ </div>
175
+ </div>
176
+ </div>
177
+ </div>
178
+ <div class="flex items-center justify-between px-4 py-2">
179
+ <button @click="prevMonth" class="p-1 rounded hover:bg-gray-100">‹</button>
180
+ <div class="text-sm font-medium text-gray-800">
181
+ {{ new Date(currentYear, currentMonth).toLocaleString("default", { month: "long" }) }}
182
+ {{ currentYear }}
183
+ </div>
184
+ <button @click="nextMonth" class="p-1 rounded hover:bg-gray-100">›</button>
185
+ </div>
186
+ <div class="grid grid-cols-7 text-xs font-medium text-center text-gray-500 px-3 mb-1">
187
+ <div v-for="d in ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']" :key="d">
188
+ {{ d }}
189
+ </div>
190
+ </div>
191
+ <div class="grid grid-cols-7 gap-1 px-3 pb-3">
192
+ <div v-for="n in blankDays" :key="'b' + n"></div>
193
+ <div v-for="day in days" :key="day" @click="selectDate(day)"
194
+ class="h-10 flex items-center justify-center text-sm rounded-lg cursor-pointer transition-all duration-150"
195
+ :class="dayClasses(day)">
196
+ {{ day }}
197
+ </div>
198
+ </div>
199
+
200
+ </div>
201
+ </template>
@@ -0,0 +1,137 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ modelValue: {
3
+ type: (StringConstructor | ArrayConstructor)[];
4
+ default: string;
5
+ };
6
+ multiDate: BooleanConstructor;
7
+ rangeDate: BooleanConstructor;
8
+ disabledDates: {
9
+ type: () => string[];
10
+ default: () => never[];
11
+ };
12
+ format: {
13
+ type: StringConstructor;
14
+ default: string;
15
+ };
16
+ showHeader: {
17
+ type: BooleanConstructor;
18
+ default: boolean;
19
+ };
20
+ backgroundColor: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
24
+ bordered: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ borderRadius: {
29
+ type: StringConstructor;
30
+ default: string;
31
+ acceptedValues: string[];
32
+ };
33
+ flat: {
34
+ type: BooleanConstructor;
35
+ default: boolean;
36
+ };
37
+ color: {
38
+ type: StringConstructor;
39
+ default: string;
40
+ };
41
+ textColor: {
42
+ readonly type: StringConstructor;
43
+ readonly default: "";
44
+ };
45
+ contentClass: {
46
+ readonly type: StringConstructor;
47
+ readonly default: "";
48
+ };
49
+ contentStyle: {
50
+ readonly type: StringConstructor;
51
+ readonly default: "";
52
+ };
53
+ disable: {
54
+ readonly type: BooleanConstructor;
55
+ readonly default: false;
56
+ };
57
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
58
+ "update:modelValue": (...args: any[]) => void;
59
+ change: (...args: any[]) => void;
60
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
61
+ modelValue: {
62
+ type: (StringConstructor | ArrayConstructor)[];
63
+ default: string;
64
+ };
65
+ multiDate: BooleanConstructor;
66
+ rangeDate: BooleanConstructor;
67
+ disabledDates: {
68
+ type: () => string[];
69
+ default: () => never[];
70
+ };
71
+ format: {
72
+ type: StringConstructor;
73
+ default: string;
74
+ };
75
+ showHeader: {
76
+ type: BooleanConstructor;
77
+ default: boolean;
78
+ };
79
+ backgroundColor: {
80
+ type: StringConstructor;
81
+ default: string;
82
+ };
83
+ bordered: {
84
+ type: BooleanConstructor;
85
+ default: boolean;
86
+ };
87
+ borderRadius: {
88
+ type: StringConstructor;
89
+ default: string;
90
+ acceptedValues: string[];
91
+ };
92
+ flat: {
93
+ type: BooleanConstructor;
94
+ default: boolean;
95
+ };
96
+ color: {
97
+ type: StringConstructor;
98
+ default: string;
99
+ };
100
+ textColor: {
101
+ readonly type: StringConstructor;
102
+ readonly default: "";
103
+ };
104
+ contentClass: {
105
+ readonly type: StringConstructor;
106
+ readonly default: "";
107
+ };
108
+ contentStyle: {
109
+ readonly type: StringConstructor;
110
+ readonly default: "";
111
+ };
112
+ disable: {
113
+ readonly type: BooleanConstructor;
114
+ readonly default: false;
115
+ };
116
+ }>> & Readonly<{
117
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
118
+ onChange?: ((...args: any[]) => any) | undefined;
119
+ }>, {
120
+ modelValue: string | unknown[];
121
+ contentClass: string;
122
+ contentStyle: string;
123
+ textColor: string;
124
+ disable: boolean;
125
+ color: string;
126
+ backgroundColor: string;
127
+ flat: boolean;
128
+ bordered: boolean;
129
+ borderRadius: string;
130
+ multiDate: boolean;
131
+ rangeDate: boolean;
132
+ disabledDates: string[];
133
+ format: string;
134
+ showHeader: boolean;
135
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
136
+ declare const _default: typeof __VLS_export;
137
+ export default _default;
@@ -0,0 +1,63 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
4
+ type __VLS_WithSlots<T, S> = T & (new () => {
5
+ $slots: S;
6
+ });
7
+ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
+ isOpen: {
9
+ type: BooleanConstructor;
10
+ required: true;
11
+ };
12
+ width: {
13
+ type: StringConstructor;
14
+ default: string;
15
+ };
16
+ height: {
17
+ type: StringConstructor;
18
+ default: string;
19
+ };
20
+ persistent: {
21
+ type: BooleanConstructor;
22
+ default: boolean;
23
+ };
24
+ position: {
25
+ type: StringConstructor;
26
+ default: string;
27
+ validator: (value: unknown) => any;
28
+ };
29
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
30
+ "update:isOpen": (...args: any[]) => void;
31
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
32
+ isOpen: {
33
+ type: BooleanConstructor;
34
+ required: true;
35
+ };
36
+ width: {
37
+ type: StringConstructor;
38
+ default: string;
39
+ };
40
+ height: {
41
+ type: StringConstructor;
42
+ default: string;
43
+ };
44
+ persistent: {
45
+ type: BooleanConstructor;
46
+ default: boolean;
47
+ };
48
+ position: {
49
+ type: StringConstructor;
50
+ default: string;
51
+ validator: (value: unknown) => any;
52
+ };
53
+ }>> & Readonly<{
54
+ "onUpdate:isOpen"?: ((...args: any[]) => any) | undefined;
55
+ }>, {
56
+ position: string;
57
+ width: string;
58
+ height: string;
59
+ persistent: boolean;
60
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
61
+ type __VLS_Slots = {
62
+ default?: ((props: {}) => any) | undefined;
63
+ };
@@ -0,0 +1,85 @@
1
+ <script setup>
2
+ import { computed, watch, onBeforeUnmount } from "vue";
3
+ import { useRouter } from "vue-router";
4
+ const props = defineProps({
5
+ isOpen: {
6
+ type: Boolean,
7
+ required: true
8
+ },
9
+ width: {
10
+ type: String,
11
+ default: "400px"
12
+ },
13
+ height: {
14
+ type: String,
15
+ default: "auto"
16
+ },
17
+ persistent: {
18
+ type: Boolean,
19
+ default: false
20
+ },
21
+ position: {
22
+ type: String,
23
+ default: "center",
24
+ validator: (value) => ["top", "bottom", "left", "right", "center"].includes(value)
25
+ }
26
+ });
27
+ const emit = defineEmits(["update:isOpen"]);
28
+ const router = useRouter();
29
+ const close = () => emit("update:isOpen", false);
30
+ const handleOutsideClick = () => {
31
+ if (!props.persistent) close();
32
+ };
33
+ const handleEscKey = (event) => {
34
+ if (event.key === "Escape" && !props.persistent) {
35
+ close();
36
+ }
37
+ };
38
+ const positionClasses = computed(() => {
39
+ switch (props.position) {
40
+ case "top":
41
+ return "items-start justify-center p-6";
42
+ case "bottom":
43
+ return "items-end justify-center p-6";
44
+ case "left":
45
+ return "items-center justify-start p-6";
46
+ case "right":
47
+ return "items-center justify-end p-6";
48
+ default:
49
+ return "items-center justify-center p-6";
50
+ }
51
+ });
52
+ watch(
53
+ () => props.isOpen,
54
+ (open) => {
55
+ if (open) {
56
+ document.addEventListener("keydown", handleEscKey);
57
+ } else {
58
+ document.removeEventListener("keydown", handleEscKey);
59
+ }
60
+ }
61
+ );
62
+ const removeGuard = router.beforeEach((to, from, next) => {
63
+ if (props.isOpen && !props.persistent) close();
64
+ next();
65
+ });
66
+ onBeforeUnmount(() => {
67
+ document.removeEventListener("keydown", handleEscKey);
68
+ removeGuard?.();
69
+ });
70
+ </script>
71
+
72
+ <template>
73
+ <transition name="fade">
74
+ <div v-if="isOpen" class="fixed inset-0 z-50 flex bg-black bg-opacity-60" role="dialog" aria-modal="true"
75
+ @click.self="handleOutsideClick" :class="positionClasses">
76
+ <div :style="{ width: width, height: height }">
77
+ <slot />
78
+ </div>
79
+ </div>
80
+ </transition>
81
+ </template>
82
+
83
+ <style scoped>
84
+ .fade-enter-active{animation:fadeInScale .3s ease forwards}.fade-leave-active{transition:opacity .3s ease,transform .3s ease}@keyframes fadeInScale{0%{opacity:0}to{opacity:1}}.fade-leave-to{opacity:0}
85
+ </style>
@@ -0,0 +1,63 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
4
+ type __VLS_WithSlots<T, S> = T & (new () => {
5
+ $slots: S;
6
+ });
7
+ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
+ isOpen: {
9
+ type: BooleanConstructor;
10
+ required: true;
11
+ };
12
+ width: {
13
+ type: StringConstructor;
14
+ default: string;
15
+ };
16
+ height: {
17
+ type: StringConstructor;
18
+ default: string;
19
+ };
20
+ persistent: {
21
+ type: BooleanConstructor;
22
+ default: boolean;
23
+ };
24
+ position: {
25
+ type: StringConstructor;
26
+ default: string;
27
+ validator: (value: unknown) => any;
28
+ };
29
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
30
+ "update:isOpen": (...args: any[]) => void;
31
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
32
+ isOpen: {
33
+ type: BooleanConstructor;
34
+ required: true;
35
+ };
36
+ width: {
37
+ type: StringConstructor;
38
+ default: string;
39
+ };
40
+ height: {
41
+ type: StringConstructor;
42
+ default: string;
43
+ };
44
+ persistent: {
45
+ type: BooleanConstructor;
46
+ default: boolean;
47
+ };
48
+ position: {
49
+ type: StringConstructor;
50
+ default: string;
51
+ validator: (value: unknown) => any;
52
+ };
53
+ }>> & Readonly<{
54
+ "onUpdate:isOpen"?: ((...args: any[]) => any) | undefined;
55
+ }>, {
56
+ position: string;
57
+ width: string;
58
+ height: string;
59
+ persistent: boolean;
60
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
61
+ type __VLS_Slots = {
62
+ default?: ((props: {}) => any) | undefined;
63
+ };
@@ -0,0 +1,51 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ color: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ type: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
10
+ vertical: {
11
+ type: BooleanConstructor;
12
+ default: boolean;
13
+ };
14
+ inset: {
15
+ type: BooleanConstructor;
16
+ default: boolean;
17
+ };
18
+ thickness: {
19
+ type: StringConstructor;
20
+ default: string;
21
+ };
22
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
23
+ color: {
24
+ type: StringConstructor;
25
+ default: string;
26
+ };
27
+ type: {
28
+ type: StringConstructor;
29
+ default: string;
30
+ };
31
+ vertical: {
32
+ type: BooleanConstructor;
33
+ default: boolean;
34
+ };
35
+ inset: {
36
+ type: BooleanConstructor;
37
+ default: boolean;
38
+ };
39
+ thickness: {
40
+ type: StringConstructor;
41
+ default: string;
42
+ };
43
+ }>> & Readonly<{}>, {
44
+ type: string;
45
+ color: string;
46
+ vertical: boolean;
47
+ inset: boolean;
48
+ thickness: string;
49
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
50
+ declare const _default: typeof __VLS_export;
51
+ export default _default;
@@ -0,0 +1,52 @@
1
+ <script setup>
2
+ defineOptions({
3
+ inheritAttrs: false
4
+ });
5
+ import { computed } from "vue";
6
+ const props = defineProps({
7
+ color: {
8
+ type: String,
9
+ default: "gray-300"
10
+ },
11
+ type: {
12
+ type: String,
13
+ default: "solid"
14
+ },
15
+ vertical: {
16
+ type: Boolean,
17
+ default: false
18
+ },
19
+ inset: {
20
+ type: Boolean,
21
+ default: false
22
+ },
23
+ thickness: {
24
+ type: String,
25
+ default: "1px"
26
+ }
27
+ });
28
+ const isHex = (val) => val.startsWith("#");
29
+ const dividerStyle = computed(() => {
30
+ const style = {};
31
+ if (isHex(props.color)) {
32
+ style.borderColor = props.color;
33
+ }
34
+ style.borderWidth = props.thickness;
35
+ return style;
36
+ });
37
+ const dividerClass = computed(() => [
38
+ props.vertical ? "h-full border-l" : "w-full border-t",
39
+ props.type === "dashed" ? "border-dashed" : "",
40
+ props.type === "dotted" ? "border-dotted" : "",
41
+ props.inset ? "mx-4" : "",
42
+ !isHex(props.color) ? `border-${props.color}` : ""
43
+ ]);
44
+ </script>
45
+
46
+ <template>
47
+ <div
48
+ :class="dividerClass"
49
+ :style="dividerStyle"
50
+ v-bind="$attrs"
51
+ />
52
+ </template>
@@ -0,0 +1,51 @@
1
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ color: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ type: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
10
+ vertical: {
11
+ type: BooleanConstructor;
12
+ default: boolean;
13
+ };
14
+ inset: {
15
+ type: BooleanConstructor;
16
+ default: boolean;
17
+ };
18
+ thickness: {
19
+ type: StringConstructor;
20
+ default: string;
21
+ };
22
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
23
+ color: {
24
+ type: StringConstructor;
25
+ default: string;
26
+ };
27
+ type: {
28
+ type: StringConstructor;
29
+ default: string;
30
+ };
31
+ vertical: {
32
+ type: BooleanConstructor;
33
+ default: boolean;
34
+ };
35
+ inset: {
36
+ type: BooleanConstructor;
37
+ default: boolean;
38
+ };
39
+ thickness: {
40
+ type: StringConstructor;
41
+ default: string;
42
+ };
43
+ }>> & Readonly<{}>, {
44
+ type: string;
45
+ color: string;
46
+ vertical: boolean;
47
+ inset: boolean;
48
+ thickness: string;
49
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
50
+ declare const _default: typeof __VLS_export;
51
+ export default _default;