@baklavue/ui 1.0.0-preview.4 → 1.0.1
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/dist/accordion/Accordion.vue.d.ts +51 -0
- package/dist/accordion/Accordion.vue.d.ts.map +1 -0
- package/dist/accordion/accordion.types.d.ts +97 -0
- package/dist/accordion/accordion.types.d.ts.map +1 -0
- package/dist/accordion/index.d.ts +3 -0
- package/dist/accordion/index.d.ts.map +1 -0
- package/dist/alert/Alert.vue.d.ts +49 -0
- package/dist/alert/Alert.vue.d.ts.map +1 -0
- package/dist/alert/alert.types.d.ts +52 -0
- package/dist/alert/alert.types.d.ts.map +1 -0
- package/dist/alert/index.d.ts +3 -0
- package/dist/alert/index.d.ts.map +1 -0
- package/dist/badge/Badge.vue.d.ts +22 -0
- package/dist/badge/Badge.vue.d.ts.map +1 -0
- package/dist/badge/badge.types.d.ts +7 -0
- package/dist/badge/badge.types.d.ts.map +1 -0
- package/dist/badge/index.d.ts +3 -0
- package/dist/badge/index.d.ts.map +1 -0
- package/dist/banner/Banner.vue.d.ts +36 -0
- package/dist/banner/Banner.vue.d.ts.map +1 -0
- package/dist/banner/banner.types.d.ts +70 -0
- package/dist/banner/banner.types.d.ts.map +1 -0
- package/dist/banner/index.d.ts +3 -0
- package/dist/banner/index.d.ts.map +1 -0
- package/dist/button/Button.vue.d.ts +36 -0
- package/dist/button/Button.vue.d.ts.map +1 -0
- package/dist/button/button.types.d.ts +24 -0
- package/dist/button/button.types.d.ts.map +1 -0
- package/dist/button/index.d.ts +3 -0
- package/dist/button/index.d.ts.map +1 -0
- package/dist/checkbox/Checkbox.vue.d.ts +39 -0
- package/dist/checkbox/Checkbox.vue.d.ts.map +1 -0
- package/dist/checkbox/checkbox.types.d.ts +95 -0
- package/dist/checkbox/checkbox.types.d.ts.map +1 -0
- package/dist/checkbox/index.d.ts +3 -0
- package/dist/checkbox/index.d.ts.map +1 -0
- package/dist/chip/Chip.vue.d.ts +29 -0
- package/dist/chip/Chip.vue.d.ts.map +1 -0
- package/dist/chip/chip.types.d.ts +59 -0
- package/dist/chip/chip.types.d.ts.map +1 -0
- package/dist/chip/index.d.ts +3 -0
- package/dist/chip/index.d.ts.map +1 -0
- package/dist/datepicker/Datepicker.vue.d.ts +41 -0
- package/dist/datepicker/Datepicker.vue.d.ts.map +1 -0
- package/dist/datepicker/datepicker.types.d.ts +38 -0
- package/dist/datepicker/datepicker.types.d.ts.map +1 -0
- package/dist/datepicker/index.d.ts +3 -0
- package/dist/datepicker/index.d.ts.map +1 -0
- package/dist/dialog/Dialog.vue.d.ts +44 -0
- package/dist/dialog/Dialog.vue.d.ts.map +1 -0
- package/dist/dialog/dialog.types.d.ts +18 -0
- package/dist/dialog/dialog.types.d.ts.map +1 -0
- package/dist/dialog/index.d.ts +3 -0
- package/dist/dialog/index.d.ts.map +1 -0
- package/dist/drawer/Drawer.vue.d.ts +42 -0
- package/dist/drawer/Drawer.vue.d.ts.map +1 -0
- package/dist/drawer/drawer.types.d.ts +18 -0
- package/dist/drawer/drawer.types.d.ts.map +1 -0
- package/dist/drawer/index.d.ts +3 -0
- package/dist/drawer/index.d.ts.map +1 -0
- package/dist/dropdown/Dropdown.vue.d.ts +59 -0
- package/dist/dropdown/Dropdown.vue.d.ts.map +1 -0
- package/dist/dropdown/dropdown.types.d.ts +92 -0
- package/dist/dropdown/dropdown.types.d.ts.map +1 -0
- package/dist/dropdown/index.d.ts +3 -0
- package/dist/dropdown/index.d.ts.map +1 -0
- package/dist/file-upload/FileUpload.vue.d.ts +44 -0
- package/dist/file-upload/FileUpload.vue.d.ts.map +1 -0
- package/dist/file-upload/file-upload.types.d.ts +76 -0
- package/dist/file-upload/file-upload.types.d.ts.map +1 -0
- package/dist/file-upload/index.d.ts +3 -0
- package/dist/file-upload/index.d.ts.map +1 -0
- package/dist/icon/Icon.vue.d.ts +29 -0
- package/dist/icon/Icon.vue.d.ts.map +1 -0
- package/dist/icon/icon.types.d.ts +23 -0
- package/dist/icon/icon.types.d.ts.map +1 -0
- package/dist/icon/index.d.ts +3 -0
- package/dist/icon/index.d.ts.map +1 -0
- package/dist/image/Image.vue.d.ts +30 -0
- package/dist/image/Image.vue.d.ts.map +1 -0
- package/dist/image/image.types.d.ts +48 -0
- package/dist/image/image.types.d.ts.map +1 -0
- package/dist/image/index.d.ts +3 -0
- package/dist/image/index.d.ts.map +1 -0
- package/dist/index.css +474 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2404 -0
- package/dist/index.js.map +1 -0
- package/dist/input/Input.vue.d.ts +39 -0
- package/dist/input/Input.vue.d.ts.map +1 -0
- package/dist/input/index.d.ts +3 -0
- package/dist/input/index.d.ts.map +1 -0
- package/dist/input/input.types.d.ts +122 -0
- package/dist/input/input.types.d.ts.map +1 -0
- package/dist/link/Link.vue.d.ts +38 -0
- package/dist/link/Link.vue.d.ts.map +1 -0
- package/dist/link/index.d.ts +3 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/link.types.d.ts +40 -0
- package/dist/link/link.types.d.ts.map +1 -0
- package/dist/notification/Notification.vue.d.ts +7 -0
- package/dist/notification/Notification.vue.d.ts.map +1 -0
- package/dist/notification/index.d.ts +3 -0
- package/dist/notification/index.d.ts.map +1 -0
- package/dist/notification/notification.types.d.ts +25 -0
- package/dist/notification/notification.types.d.ts.map +1 -0
- package/dist/pagination/Pagination.vue.d.ts +34 -0
- package/dist/pagination/Pagination.vue.d.ts.map +1 -0
- package/dist/pagination/index.d.ts +3 -0
- package/dist/pagination/index.d.ts.map +1 -0
- package/dist/pagination/pagination.types.d.ts +54 -0
- package/dist/pagination/pagination.types.d.ts.map +1 -0
- package/dist/radio/Radio.vue.d.ts +42 -0
- package/dist/radio/Radio.vue.d.ts.map +1 -0
- package/dist/radio/index.d.ts +3 -0
- package/dist/radio/index.d.ts.map +1 -0
- package/dist/radio/radio.types.d.ts +84 -0
- package/dist/radio/radio.types.d.ts.map +1 -0
- package/dist/scroll-to-top/ScrollToTop.vue.d.ts +14 -0
- package/dist/scroll-to-top/ScrollToTop.vue.d.ts.map +1 -0
- package/dist/scroll-to-top/index.d.ts +3 -0
- package/dist/scroll-to-top/index.d.ts.map +1 -0
- package/dist/scroll-to-top/scroll-to-top.types.d.ts +33 -0
- package/dist/scroll-to-top/scroll-to-top.types.d.ts.map +1 -0
- package/dist/select/Select.vue.d.ts +42 -0
- package/dist/select/Select.vue.d.ts.map +1 -0
- package/dist/select/index.d.ts +3 -0
- package/dist/select/index.d.ts.map +1 -0
- package/dist/select/select.types.d.ts +52 -0
- package/dist/select/select.types.d.ts.map +1 -0
- package/dist/skeleton/Skeleton.vue.d.ts +9 -0
- package/dist/skeleton/Skeleton.vue.d.ts.map +1 -0
- package/dist/skeleton/index.d.ts +3 -0
- package/dist/skeleton/index.d.ts.map +1 -0
- package/dist/skeleton/skeleton.types.d.ts +30 -0
- package/dist/skeleton/skeleton.types.d.ts.map +1 -0
- package/dist/spinner/Spinner.vue.d.ts +8 -0
- package/dist/spinner/Spinner.vue.d.ts.map +1 -0
- package/dist/spinner/index.d.ts +3 -0
- package/dist/spinner/index.d.ts.map +1 -0
- package/dist/spinner/spinner.types.d.ts +12 -0
- package/dist/spinner/spinner.types.d.ts.map +1 -0
- package/dist/split-button/SplitButton.vue.d.ts +25 -0
- package/dist/split-button/SplitButton.vue.d.ts.map +1 -0
- package/dist/split-button/index.d.ts +3 -0
- package/dist/split-button/index.d.ts.map +1 -0
- package/dist/split-button/split-button.types.d.ts +19 -0
- package/dist/split-button/split-button.types.d.ts.map +1 -0
- package/dist/stepper/Stepper.vue.d.ts +30 -0
- package/dist/stepper/Stepper.vue.d.ts.map +1 -0
- package/dist/stepper/index.d.ts +3 -0
- package/dist/stepper/index.d.ts.map +1 -0
- package/dist/stepper/stepper.types.d.ts +29 -0
- package/dist/stepper/stepper.types.d.ts.map +1 -0
- package/dist/switch/Switch.vue.d.ts +32 -0
- package/dist/switch/Switch.vue.d.ts.map +1 -0
- package/dist/switch/index.d.ts +3 -0
- package/dist/switch/index.d.ts.map +1 -0
- package/dist/switch/switch.types.d.ts +14 -0
- package/dist/switch/switch.types.d.ts.map +1 -0
- package/dist/tab/Tab.vue.d.ts +31 -0
- package/dist/tab/Tab.vue.d.ts.map +1 -0
- package/dist/tab/index.d.ts +3 -0
- package/dist/tab/index.d.ts.map +1 -0
- package/dist/tab/tab.types.d.ts +17 -0
- package/dist/tab/tab.types.d.ts.map +1 -0
- package/dist/table/Table.vue.d.ts +181 -0
- package/dist/table/Table.vue.d.ts.map +1 -0
- package/dist/table/index.d.ts +3 -0
- package/dist/table/index.d.ts.map +1 -0
- package/dist/table/table.types.d.ts +61 -0
- package/dist/table/table.types.d.ts.map +1 -0
- package/dist/tag/Tag.vue.d.ts +31 -0
- package/dist/tag/Tag.vue.d.ts.map +1 -0
- package/dist/tag/index.d.ts +3 -0
- package/dist/tag/index.d.ts.map +1 -0
- package/dist/tag/tag.types.d.ts +22 -0
- package/dist/tag/tag.types.d.ts.map +1 -0
- package/dist/textarea/Textarea.vue.d.ts +35 -0
- package/dist/textarea/Textarea.vue.d.ts.map +1 -0
- package/dist/textarea/index.d.ts +3 -0
- package/dist/textarea/index.d.ts.map +1 -0
- package/dist/textarea/textarea.types.d.ts +37 -0
- package/dist/textarea/textarea.types.d.ts.map +1 -0
- package/dist/tooltip/Tooltip.vue.d.ts +33 -0
- package/dist/tooltip/Tooltip.vue.d.ts.map +1 -0
- package/dist/tooltip/index.d.ts +3 -0
- package/dist/tooltip/index.d.ts.map +1 -0
- package/dist/tooltip/tooltip.types.d.ts +17 -0
- package/dist/tooltip/tooltip.types.d.ts.map +1 -0
- package/dist/utils/loadBaklavaResources.d.ts +2 -0
- package/dist/utils/loadBaklavaResources.d.ts.map +1 -0
- package/package.json +28 -4
- package/.releaserc.json +0 -14
- package/CHANGELOG.md +0 -56
- package/index.ts +0 -1
- package/src/accordion/Accordion.vue +0 -206
- package/src/accordion/accordion.types.ts +0 -109
- package/src/accordion/index.ts +0 -3
- package/src/alert/Alert.vue +0 -199
- package/src/alert/alert.types.ts +0 -58
- package/src/alert/index.ts +0 -2
- package/src/badge/Badge.vue +0 -20
- package/src/badge/badge.types.ts +0 -7
- package/src/badge/index.ts +0 -2
- package/src/button/Button.vue +0 -45
- package/src/button/button.types.ts +0 -30
- package/src/button/index.ts +0 -3
- package/src/checkbox/Checkbox.vue +0 -148
- package/src/checkbox/checkbox.types.ts +0 -108
- package/src/checkbox/index.ts +0 -2
- package/src/datepicker/Datepicker.vue +0 -172
- package/src/datepicker/datepicker.types.ts +0 -39
- package/src/datepicker/index.ts +0 -2
- package/src/dialog/Dialog.vue +0 -178
- package/src/dialog/dialog.types.ts +0 -17
- package/src/dialog/index.ts +0 -2
- package/src/drawer/Drawer.vue +0 -162
- package/src/drawer/drawer.types.ts +0 -17
- package/src/drawer/index.ts +0 -2
- package/src/dropdown/Dropdown.vue +0 -231
- package/src/dropdown/dropdown.types.ts +0 -110
- package/src/dropdown/index.ts +0 -2
- package/src/file-upload/FileUpload.vue +0 -440
- package/src/file-upload/file-upload.types.ts +0 -89
- package/src/file-upload/index.ts +0 -7
- package/src/icon/Icon.vue +0 -102
- package/src/icon/icon.types.ts +0 -25
- package/src/icon/index.ts +0 -2
- package/src/image/Image.vue +0 -144
- package/src/image/image.types.ts +0 -57
- package/src/image/index.ts +0 -3
- package/src/index.ts +0 -41
- package/src/input/Input.vue +0 -148
- package/src/input/index.ts +0 -3
- package/src/input/input.types.ts +0 -156
- package/src/link/Link.vue +0 -133
- package/src/link/index.ts +0 -2
- package/src/link/link.types.ts +0 -42
- package/src/notification/Notification.vue +0 -57
- package/src/notification/index.ts +0 -2
- package/src/notification/notification.types.ts +0 -25
- package/src/pagination/Pagination.vue +0 -137
- package/src/pagination/index.ts +0 -2
- package/src/pagination/pagination.types.ts +0 -61
- package/src/radio/Radio.vue +0 -205
- package/src/radio/index.ts +0 -2
- package/src/radio/radio.types.ts +0 -95
- package/src/scroll-to-top/ScrollToTop.vue +0 -130
- package/src/scroll-to-top/index.ts +0 -2
- package/src/scroll-to-top/scroll-to-top.types.ts +0 -42
- package/src/select/Select.vue +0 -147
- package/src/select/index.ts +0 -2
- package/src/select/select.types.ts +0 -53
- package/src/skeleton/Skeleton.vue +0 -115
- package/src/skeleton/index.ts +0 -2
- package/src/skeleton/skeleton.types.ts +0 -33
- package/src/spinner/Spinner.vue +0 -49
- package/src/spinner/index.ts +0 -2
- package/src/spinner/spinner.types.ts +0 -11
- package/src/split-button/SplitButton.vue +0 -73
- package/src/split-button/index.ts +0 -2
- package/src/split-button/split-button.types.ts +0 -19
- package/src/stepper/Stepper.vue +0 -100
- package/src/stepper/index.ts +0 -2
- package/src/stepper/stepper.types.ts +0 -29
- package/src/switch/Switch.vue +0 -80
- package/src/switch/index.ts +0 -2
- package/src/switch/switch.types.ts +0 -13
- package/src/tab/Tab.vue +0 -99
- package/src/tab/index.ts +0 -2
- package/src/tab/tab.types.ts +0 -17
- package/src/table/Table.vue +0 -264
- package/src/table/index.ts +0 -7
- package/src/table/table.types.ts +0 -62
- package/src/tag/Tag.vue +0 -83
- package/src/tag/index.ts +0 -2
- package/src/tag/tag.types.ts +0 -24
- package/src/textarea/Textarea.vue +0 -84
- package/src/textarea/index.ts +0 -2
- package/src/textarea/textarea.types.ts +0 -37
- package/src/tooltip/Tooltip.vue +0 -81
- package/src/tooltip/index.ts +0 -3
- package/src/tooltip/tooltip.types.ts +0 -29
- package/src/utils/loadBaklavaResources.ts +0 -24
- package/tsconfig.json +0 -28
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* Datepicker Component
|
|
4
|
-
*
|
|
5
|
-
* A Vue UI kit component for Baklava's `bl-datepicker` web component with v-model support.
|
|
6
|
-
* Provides a calendar picker input for date selection with min/max constraints,
|
|
7
|
-
* placeholder text, and standard form states.
|
|
8
|
-
*
|
|
9
|
-
* Supports single date, multiple dates, and date range selection modes.
|
|
10
|
-
*
|
|
11
|
-
* @component
|
|
12
|
-
* @example
|
|
13
|
-
* ```vue
|
|
14
|
-
* <!-- Basic usage (single) -->
|
|
15
|
-
* <template>
|
|
16
|
-
* <BvDatepicker v-model="date" label="Select date" />
|
|
17
|
-
* </template>
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```vue
|
|
22
|
-
* <!-- Multiple dates -->
|
|
23
|
-
* <template>
|
|
24
|
-
* <BvDatepicker v-model="dates" type="multiple" label="Select dates" />
|
|
25
|
-
* </template>
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```vue
|
|
30
|
-
* <!-- Date range -->
|
|
31
|
-
* <template>
|
|
32
|
-
* <BvDatepicker v-model="range" type="range" label="Select range" />
|
|
33
|
-
* </template>
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```vue
|
|
38
|
-
* <!-- With min/max constraints -->
|
|
39
|
-
* <template>
|
|
40
|
-
* <BvDatepicker
|
|
41
|
-
* v-model="date"
|
|
42
|
-
* label="Date range"
|
|
43
|
-
* placeholder="Select within range"
|
|
44
|
-
* :min="minDate"
|
|
45
|
-
* :max="maxDate"
|
|
46
|
-
* />
|
|
47
|
-
* </template>
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
import { computed, nextTick, onMounted, ref, watch } from "vue";
|
|
51
|
-
import { loadBaklavaResources } from "../utils/loadBaklavaResources";
|
|
52
|
-
import type { DatepickerProps, DatepickerType } from "./datepicker.types";
|
|
53
|
-
|
|
54
|
-
const props = withDefaults(defineProps<DatepickerProps>(), {
|
|
55
|
-
modelValue: undefined,
|
|
56
|
-
type: "single",
|
|
57
|
-
label: undefined,
|
|
58
|
-
placeholder: undefined,
|
|
59
|
-
disabled: undefined,
|
|
60
|
-
min: undefined,
|
|
61
|
-
max: undefined,
|
|
62
|
-
required: undefined,
|
|
63
|
-
size: undefined,
|
|
64
|
-
labelFixed: undefined,
|
|
65
|
-
helpText: undefined,
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
const emit = defineEmits<{
|
|
69
|
-
"update:modelValue": [value: string | string[] | [string, string] | null];
|
|
70
|
-
change: [event: CustomEvent<Date[]>];
|
|
71
|
-
}>();
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Converts a Date to ISO date string (YYYY-MM-DD) for v-model consistency.
|
|
75
|
-
*/
|
|
76
|
-
function toISODateString(date: Date): string {
|
|
77
|
-
if (Number.isNaN(date.getTime())) return "";
|
|
78
|
-
const year = date.getFullYear();
|
|
79
|
-
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
80
|
-
const day = String(date.getDate()).padStart(2, "0");
|
|
81
|
-
return `${year}-${month}-${day}`;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Converts modelValue to Baklava value format (comma-separated string).
|
|
86
|
-
* Baklava expects comma-separated ISO date strings (YYYY-MM-DD).
|
|
87
|
-
*/
|
|
88
|
-
const baklavaValue = computed(() => {
|
|
89
|
-
const val = props.modelValue;
|
|
90
|
-
if (val == null || (Array.isArray(val) && val.length === 0)) return "";
|
|
91
|
-
if (Array.isArray(val)) return val.map((d) => String(d)).join(",");
|
|
92
|
-
return String(val);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Handles the bl-datepicker-change event from Baklava.
|
|
97
|
-
* Converts Date[] to the appropriate format based on type and emits update:modelValue.
|
|
98
|
-
*/
|
|
99
|
-
const skipNextValueSync = ref(false);
|
|
100
|
-
|
|
101
|
-
function handleDatepickerChange(event: CustomEvent<Date[]>) {
|
|
102
|
-
const rawDates = event.detail ?? [];
|
|
103
|
-
const dates = rawDates.filter(
|
|
104
|
-
(d) => d instanceof Date && !Number.isNaN(d.getTime()),
|
|
105
|
-
);
|
|
106
|
-
const type: DatepickerType = props.type ?? "single";
|
|
107
|
-
|
|
108
|
-
let value: string | string[] | [string, string] | null;
|
|
109
|
-
|
|
110
|
-
if (dates.length === 0) {
|
|
111
|
-
value = type === "multiple" ? [] : null;
|
|
112
|
-
} else if (type === "single") {
|
|
113
|
-
value = toISODateString(dates[0]);
|
|
114
|
-
} else if (type === "multiple") {
|
|
115
|
-
value = dates.map(toISODateString);
|
|
116
|
-
} else if (type === "range") {
|
|
117
|
-
value = [
|
|
118
|
-
toISODateString(dates[0]),
|
|
119
|
-
toISODateString(dates[1] ?? dates[0]),
|
|
120
|
-
] as [string, string];
|
|
121
|
-
} else {
|
|
122
|
-
value = null;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
skipNextValueSync.value = true;
|
|
126
|
-
emit("change", event);
|
|
127
|
-
emit("update:modelValue", value);
|
|
128
|
-
nextTick(() => {
|
|
129
|
-
skipNextValueSync.value = false;
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const datepickerRef = ref<HTMLElement | null>(null);
|
|
134
|
-
|
|
135
|
-
// Sync value to web component property when modelValue changes externally.
|
|
136
|
-
// Skip sync when change originated from datepicker to avoid duplicate values in multiple/range mode.
|
|
137
|
-
watch(
|
|
138
|
-
[datepickerRef, baklavaValue],
|
|
139
|
-
([el, val]) => {
|
|
140
|
-
if (skipNextValueSync.value || !el) return;
|
|
141
|
-
(el as HTMLUnknownElement & { value?: string }).value = val ?? "";
|
|
142
|
-
},
|
|
143
|
-
{ immediate: true },
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
onMounted(async () => {
|
|
147
|
-
loadBaklavaResources();
|
|
148
|
-
// Wait for custom element to be defined before value can be set
|
|
149
|
-
if (!customElements.get("bl-datepicker")) {
|
|
150
|
-
await customElements.whenDefined("bl-datepicker");
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
</script>
|
|
154
|
-
|
|
155
|
-
<template>
|
|
156
|
-
<bl-datepicker
|
|
157
|
-
ref="datepickerRef"
|
|
158
|
-
:type="props.type"
|
|
159
|
-
:label="props.label"
|
|
160
|
-
:placeholder="props.placeholder"
|
|
161
|
-
:disabled="props.disabled === true ? true : undefined"
|
|
162
|
-
:required="props.required === true ? true : undefined"
|
|
163
|
-
:size="props.size"
|
|
164
|
-
:label-fixed="props.labelFixed === true ? true : undefined"
|
|
165
|
-
:help-text="props.helpText"
|
|
166
|
-
:min-date="props.min ? new Date(props.min) : undefined"
|
|
167
|
-
:max-date="props.max ? new Date(props.max) : undefined"
|
|
168
|
-
@bl-datepicker-change="handleDatepickerChange"
|
|
169
|
-
>
|
|
170
|
-
<slot />
|
|
171
|
-
</bl-datepicker>
|
|
172
|
-
</template>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { InputSize } from "@trendyol/baklava/dist/components/input/bl-input";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Calendar selection type.
|
|
5
|
-
* - single: One date selection
|
|
6
|
-
* - multiple: Multiple dates selection
|
|
7
|
-
* - range: Date range selection (start and end)
|
|
8
|
-
*/
|
|
9
|
-
export type DatepickerType = "single" | "multiple" | "range";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Props for the BvDatepicker component.
|
|
13
|
-
*
|
|
14
|
-
* @see BvDatepicker
|
|
15
|
-
*/
|
|
16
|
-
export interface DatepickerProps {
|
|
17
|
-
/** Selected date(s) (v-model). For single: ISO string. For multiple: string[]. For range: [start, end]. */
|
|
18
|
-
modelValue?: string | string[] | [string, string] | null;
|
|
19
|
-
/** Selection mode: single date, multiple dates, or date range */
|
|
20
|
-
type?: DatepickerType;
|
|
21
|
-
/** Datepicker input label */
|
|
22
|
-
label?: string;
|
|
23
|
-
/** Placeholder text when no date is selected */
|
|
24
|
-
placeholder?: string;
|
|
25
|
-
/** Disabled state */
|
|
26
|
-
disabled?: boolean;
|
|
27
|
-
/** Minimum selectable date, ISO format YYYY-MM-DD */
|
|
28
|
-
min?: string;
|
|
29
|
-
/** Maximum selectable date, ISO format YYYY-MM-DD */
|
|
30
|
-
max?: string;
|
|
31
|
-
/** Required field for form validation */
|
|
32
|
-
required?: boolean;
|
|
33
|
-
/** Input size (small, medium, large) */
|
|
34
|
-
size?: InputSize;
|
|
35
|
-
/** Makes the label fixed positioned */
|
|
36
|
-
labelFixed?: boolean;
|
|
37
|
-
/** Help text displayed below the input */
|
|
38
|
-
helpText?: string;
|
|
39
|
-
}
|
package/src/datepicker/index.ts
DELETED
package/src/dialog/Dialog.vue
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* Dialog Component
|
|
4
|
-
*
|
|
5
|
-
* A Vue UI kit component for Baklava's `bl-dialog` web component.
|
|
6
|
-
* Provides a modal overlay for confirmations, forms, and important content
|
|
7
|
-
* with support for header and footer slots, controllable visibility, and programmatic open/close.
|
|
8
|
-
*
|
|
9
|
-
* @component
|
|
10
|
-
* @example
|
|
11
|
-
* ```vue
|
|
12
|
-
* <!-- Basic usage with v-model -->
|
|
13
|
-
* <template>
|
|
14
|
-
* <BvButton @click="showDialog = true">Open Dialog</BvButton>
|
|
15
|
-
* <BvDialog v-model:open="showDialog" caption="Dialog Title">
|
|
16
|
-
* <p>Dialog content goes here.</p>
|
|
17
|
-
* </BvDialog>
|
|
18
|
-
* </template>
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```vue
|
|
23
|
-
* <!-- With header and footer slots -->
|
|
24
|
-
* <template>
|
|
25
|
-
* <BvDialog v-model:open="showDialog" caption="Confirm Action">
|
|
26
|
-
* <p>Are you sure you want to proceed?</p>
|
|
27
|
-
* <template #footer>
|
|
28
|
-
* <BvButton variant="tertiary" @click="showDialog = false">Cancel</BvButton>
|
|
29
|
-
* <BvButton variant="primary" @click="showDialog = false">Confirm</BvButton>
|
|
30
|
-
* </template>
|
|
31
|
-
* </BvDialog>
|
|
32
|
-
* </template>
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```vue
|
|
37
|
-
* <!-- Closable with backdrop control -->
|
|
38
|
-
* <template>
|
|
39
|
-
* <BvDialog v-model:open="showDialog" caption="Closable" :closable="true" :backdrop="true">
|
|
40
|
-
* <p>This dialog has a close button and backdrop click.</p>
|
|
41
|
-
* </BvDialog>
|
|
42
|
-
* </template>
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```vue
|
|
47
|
-
* <!-- Programmatic control via ref -->
|
|
48
|
-
* <template>
|
|
49
|
-
* <BvButton @click="dialogRef?.open()">Open</BvButton>
|
|
50
|
-
* <BvButton @click="dialogRef?.close()">Close</BvButton>
|
|
51
|
-
* <BvDialog ref="dialogRef" caption="Programmatic">
|
|
52
|
-
* <p>Opened and closed via ref methods.</p>
|
|
53
|
-
* </BvDialog>
|
|
54
|
-
* </template>
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
import { computed, onMounted, ref, watch } from "vue";
|
|
58
|
-
import { loadBaklavaResources } from "../utils/loadBaklavaResources";
|
|
59
|
-
import type { DialogProps } from "./dialog.types";
|
|
60
|
-
|
|
61
|
-
const SIZE_TO_WIDTH: Record<string, string> = {
|
|
62
|
-
small: "320px",
|
|
63
|
-
medium: "424px",
|
|
64
|
-
large: "560px",
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const props = withDefaults(defineProps<DialogProps>(), {
|
|
68
|
-
open: false,
|
|
69
|
-
caption: undefined,
|
|
70
|
-
closable: undefined,
|
|
71
|
-
backdrop: undefined,
|
|
72
|
-
size: undefined,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
const emit = defineEmits<{
|
|
76
|
-
/** Emitted when visibility changes. Use for two-way binding. */
|
|
77
|
-
"update:open": [open: boolean];
|
|
78
|
-
/** Emitted when the dialog is opened. */
|
|
79
|
-
open: [];
|
|
80
|
-
/** Emitted when the dialog is closed. */
|
|
81
|
-
close: [];
|
|
82
|
-
}>();
|
|
83
|
-
|
|
84
|
-
/** Reference to the underlying bl-dialog element. */
|
|
85
|
-
const dialogRef = ref<HTMLElement | null>(null);
|
|
86
|
-
|
|
87
|
-
/** Computed style for dialog width based on size prop. */
|
|
88
|
-
const dialogStyle = computed(() => {
|
|
89
|
-
if (!props.size) return undefined;
|
|
90
|
-
const width = SIZE_TO_WIDTH[props.size.toLowerCase()] ?? props.size;
|
|
91
|
-
return { "--bl-dialog-width": width };
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
/** Handles bl-dialog-open event. Syncs state and emits. */
|
|
95
|
-
const handleOpen = () => {
|
|
96
|
-
emit("update:open", true);
|
|
97
|
-
emit("open");
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
/** Handles bl-dialog-close event. Syncs state and emits. */
|
|
101
|
-
const handleClose = () => {
|
|
102
|
-
emit("update:open", false);
|
|
103
|
-
emit("close");
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Handles bl-dialog-request-close event. Prevents closing when closable or backdrop
|
|
108
|
-
* is explicitly set to false for the given close source.
|
|
109
|
-
*/
|
|
110
|
-
const handleRequestClose = (
|
|
111
|
-
e: CustomEvent<{ source: "close-button" | "keyboard" | "backdrop" }>,
|
|
112
|
-
) => {
|
|
113
|
-
if (props.closable === false && e.detail.source === "close-button") {
|
|
114
|
-
e.preventDefault();
|
|
115
|
-
}
|
|
116
|
-
if (props.backdrop === false && e.detail.source === "backdrop") {
|
|
117
|
-
e.preventDefault();
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
|
|
121
|
-
/** Syncs props.open to the bl-dialog element's open property. */
|
|
122
|
-
function getBlDialog(el: HTMLElement | null): { open: boolean } | null {
|
|
123
|
-
return el as unknown as { open: boolean } | null;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
watch(
|
|
127
|
-
() => props.open,
|
|
128
|
-
(newValue) => {
|
|
129
|
-
const blDialog = getBlDialog(dialogRef.value);
|
|
130
|
-
if (blDialog && blDialog.open !== newValue) {
|
|
131
|
-
blDialog.open = newValue;
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
{ immediate: true },
|
|
135
|
-
);
|
|
136
|
-
|
|
137
|
-
onMounted(() => {
|
|
138
|
-
loadBaklavaResources();
|
|
139
|
-
|
|
140
|
-
const blDialog = getBlDialog(dialogRef.value);
|
|
141
|
-
if (blDialog && blDialog.open !== props.open) {
|
|
142
|
-
blDialog.open = props.open;
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
defineExpose({
|
|
147
|
-
/** Opens the dialog programmatically. */
|
|
148
|
-
open: () => {
|
|
149
|
-
const blDialog = getBlDialog(dialogRef.value);
|
|
150
|
-
if (blDialog) blDialog.open = true;
|
|
151
|
-
},
|
|
152
|
-
/** Closes the dialog programmatically. */
|
|
153
|
-
close: () => {
|
|
154
|
-
const blDialog = getBlDialog(dialogRef.value);
|
|
155
|
-
if (blDialog) blDialog.open = false;
|
|
156
|
-
},
|
|
157
|
-
});
|
|
158
|
-
</script>
|
|
159
|
-
|
|
160
|
-
<template>
|
|
161
|
-
<bl-dialog
|
|
162
|
-
ref="dialogRef"
|
|
163
|
-
:open="open"
|
|
164
|
-
:caption="caption"
|
|
165
|
-
:style="dialogStyle"
|
|
166
|
-
@bl-dialog-open="handleOpen"
|
|
167
|
-
@bl-dialog-close="handleClose"
|
|
168
|
-
@bl-dialog-request-close="handleRequestClose"
|
|
169
|
-
>
|
|
170
|
-
<div>
|
|
171
|
-
<slot v-if="$slots['header']" name="header" />
|
|
172
|
-
<slot />
|
|
173
|
-
</div>
|
|
174
|
-
<div v-if="$slots['footer']" slot="secondary-action">
|
|
175
|
-
<slot name="footer" />
|
|
176
|
-
</div>
|
|
177
|
-
</bl-dialog>
|
|
178
|
-
</template>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Props for the Dialog component.
|
|
3
|
-
*
|
|
4
|
-
* @interface DialogProps
|
|
5
|
-
*/
|
|
6
|
-
export interface DialogProps {
|
|
7
|
-
/** Whether the dialog is visible. */
|
|
8
|
-
open?: boolean;
|
|
9
|
-
/** Optional dialog title. Maps to bl-dialog's caption attribute. */
|
|
10
|
-
caption?: string;
|
|
11
|
-
/** Whether to show the close button in the header. When false, clicking the X is prevented. */
|
|
12
|
-
closable?: boolean;
|
|
13
|
-
/** Whether clicking the backdrop closes the dialog. When false, click-outside is prevented. */
|
|
14
|
-
backdrop?: boolean;
|
|
15
|
-
/** Dialog width. Accepts "small", "medium", "large" or a CSS value (e.g. "424px"). */
|
|
16
|
-
size?: string;
|
|
17
|
-
}
|
package/src/dialog/index.ts
DELETED
package/src/drawer/Drawer.vue
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* Drawer Component
|
|
4
|
-
*
|
|
5
|
-
* A Vue UI kit component for Baklava's `bl-drawer` web component.
|
|
6
|
-
* Provides a side drawer for supplemental content with support for caption,
|
|
7
|
-
* embedded iframe content, external link, and programmable width.
|
|
8
|
-
*
|
|
9
|
-
* @component
|
|
10
|
-
* @example
|
|
11
|
-
* ```vue
|
|
12
|
-
* <!-- Basic usage -->
|
|
13
|
-
* <template>
|
|
14
|
-
* <BvButton @click="showDrawer = true">Open Drawer</BvButton>
|
|
15
|
-
* <BvDrawer v-model:open="showDrawer">
|
|
16
|
-
* <p>Drawer content goes here.</p>
|
|
17
|
-
* </BvDrawer>
|
|
18
|
-
* </template>
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```vue
|
|
23
|
-
* <!-- With caption -->
|
|
24
|
-
* <template>
|
|
25
|
-
* <BvDrawer v-model:open="showDrawer" caption="Drawer Title">
|
|
26
|
-
* <p>Content with title.</p>
|
|
27
|
-
* </BvDrawer>
|
|
28
|
-
* </template>
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* ```vue
|
|
33
|
-
* <!-- With embed URL (iframe) -->
|
|
34
|
-
* <template>
|
|
35
|
-
* <BvDrawer v-model:open="showDrawer" embed-url="https://example.com" />
|
|
36
|
-
* </template>
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```vue
|
|
41
|
-
* <!-- With width -->
|
|
42
|
-
* <template>
|
|
43
|
-
* <BvDrawer v-model:open="showDrawer" width="large" caption="Wide Drawer">
|
|
44
|
-
* <p>Wider drawer content.</p>
|
|
45
|
-
* </BvDrawer>
|
|
46
|
-
* </template>
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```vue
|
|
51
|
-
* <!-- Programmatic control via ref -->
|
|
52
|
-
* <template>
|
|
53
|
-
* <BvButton @click="drawerRef?.open()">Open</BvButton>
|
|
54
|
-
* <BvButton @click="drawerRef?.close()">Close</BvButton>
|
|
55
|
-
* <BvDrawer ref="drawerRef" caption="Programmatic">
|
|
56
|
-
* <p>Opened and closed via ref methods.</p>
|
|
57
|
-
* </BvDrawer>
|
|
58
|
-
* </template>
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
import { computed, onMounted, ref, watch } from "vue";
|
|
62
|
-
import { loadBaklavaResources } from "../utils/loadBaklavaResources";
|
|
63
|
-
import type { DrawerProps } from "./drawer.types";
|
|
64
|
-
|
|
65
|
-
const WIDTH_TO_PX: Record<string, string> = {
|
|
66
|
-
small: "320px",
|
|
67
|
-
medium: "424px",
|
|
68
|
-
large: "560px",
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const props = withDefaults(defineProps<DrawerProps>(), {
|
|
72
|
-
open: false,
|
|
73
|
-
caption: undefined,
|
|
74
|
-
embedUrl: undefined,
|
|
75
|
-
externalLink: undefined,
|
|
76
|
-
width: undefined,
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const emit = defineEmits<{
|
|
80
|
-
/** Emitted when visibility changes. Use for two-way binding. */
|
|
81
|
-
"update:open": [open: boolean];
|
|
82
|
-
/** Emitted when the drawer is opened. */
|
|
83
|
-
open: [];
|
|
84
|
-
/** Emitted when the drawer is closed. */
|
|
85
|
-
close: [];
|
|
86
|
-
}>();
|
|
87
|
-
|
|
88
|
-
/** Reference to the underlying bl-drawer element. */
|
|
89
|
-
const drawerRef = ref<HTMLElement | null>(null);
|
|
90
|
-
|
|
91
|
-
/** Computed width for bl-drawer. Maps small/medium/large to px or passes CSS value. */
|
|
92
|
-
const drawerWidth = computed(() => {
|
|
93
|
-
if (!props.width) return undefined;
|
|
94
|
-
const key = props.width.toLowerCase();
|
|
95
|
-
return WIDTH_TO_PX[key] ?? props.width;
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
/** Handles bl-drawer-open event. Syncs state and emits. */
|
|
99
|
-
const handleOpen = () => {
|
|
100
|
-
emit("update:open", true);
|
|
101
|
-
emit("open");
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
/** Handles bl-drawer-close event. Syncs state and emits. */
|
|
105
|
-
const handleClose = () => {
|
|
106
|
-
emit("update:open", false);
|
|
107
|
-
emit("close");
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
/** Syncs props.open to the bl-drawer element's open property. */
|
|
111
|
-
function getBlDrawer(el: HTMLElement | null): { open: boolean } | null {
|
|
112
|
-
return el as unknown as { open: boolean } | null;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
watch(
|
|
116
|
-
() => props.open,
|
|
117
|
-
(newValue) => {
|
|
118
|
-
const blDrawer = getBlDrawer(drawerRef.value);
|
|
119
|
-
if (blDrawer && blDrawer.open !== newValue) {
|
|
120
|
-
blDrawer.open = newValue;
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
{ immediate: true },
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
onMounted(() => {
|
|
127
|
-
loadBaklavaResources();
|
|
128
|
-
|
|
129
|
-
const blDrawer = getBlDrawer(drawerRef.value);
|
|
130
|
-
if (blDrawer && blDrawer.open !== props.open) {
|
|
131
|
-
blDrawer.open = props.open;
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
defineExpose({
|
|
136
|
-
/** Opens the drawer programmatically. */
|
|
137
|
-
open: () => {
|
|
138
|
-
const blDrawer = getBlDrawer(drawerRef.value);
|
|
139
|
-
if (blDrawer) blDrawer.open = true;
|
|
140
|
-
},
|
|
141
|
-
/** Closes the drawer programmatically. */
|
|
142
|
-
close: () => {
|
|
143
|
-
const blDrawer = getBlDrawer(drawerRef.value);
|
|
144
|
-
if (blDrawer) blDrawer.open = false;
|
|
145
|
-
},
|
|
146
|
-
});
|
|
147
|
-
</script>
|
|
148
|
-
|
|
149
|
-
<template>
|
|
150
|
-
<bl-drawer
|
|
151
|
-
ref="drawerRef"
|
|
152
|
-
:open="open"
|
|
153
|
-
:caption="caption"
|
|
154
|
-
:embed-url="embedUrl"
|
|
155
|
-
:external-link="externalLink"
|
|
156
|
-
:width="drawerWidth"
|
|
157
|
-
@bl-drawer-open="handleOpen"
|
|
158
|
-
@bl-drawer-close="handleClose"
|
|
159
|
-
>
|
|
160
|
-
<slot />
|
|
161
|
-
</bl-drawer>
|
|
162
|
-
</template>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Props for the Drawer component.
|
|
3
|
-
*
|
|
4
|
-
* @interface DrawerProps
|
|
5
|
-
*/
|
|
6
|
-
export interface DrawerProps {
|
|
7
|
-
/** Whether the drawer is visible. */
|
|
8
|
-
open?: boolean;
|
|
9
|
-
/** Drawer title. Maps to bl-drawer's caption attribute. */
|
|
10
|
-
caption?: string;
|
|
11
|
-
/** Iframe URL for embedded content. When set, drawer shows iframe instead of slot. */
|
|
12
|
-
embedUrl?: string;
|
|
13
|
-
/** External link URL - adds a button in the header. */
|
|
14
|
-
externalLink?: string;
|
|
15
|
-
/** Drawer width. Accepts "small", "medium", "large" or CSS value (e.g. "424px"). */
|
|
16
|
-
width?: string;
|
|
17
|
-
}
|
package/src/drawer/index.ts
DELETED