@baklavue/ui 1.0.0 → 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 +18 -2
- package/.releaserc.json +0 -14
- package/CHANGELOG.md +0 -88
- package/env.d.ts +0 -5
- package/index.ts +0 -1
- package/src/accordion/Accordion.spec.ts +0 -75
- 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.spec.ts +0 -38
- 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.spec.ts +0 -28
- package/src/badge/Badge.vue +0 -20
- package/src/badge/badge.types.ts +0 -7
- package/src/badge/index.ts +0 -2
- package/src/banner/Banner.spec.ts +0 -111
- package/src/banner/Banner.vue +0 -265
- package/src/banner/banner.types.ts +0 -86
- package/src/banner/index.ts +0 -2
- package/src/button/Button.spec.ts +0 -51
- 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.spec.ts +0 -216
- package/src/checkbox/Checkbox.vue +0 -148
- package/src/checkbox/checkbox.types.ts +0 -108
- package/src/checkbox/index.ts +0 -2
- package/src/chip/Chip.spec.ts +0 -49
- package/src/chip/Chip.vue +0 -237
- package/src/chip/chip.types.ts +0 -77
- package/src/chip/index.ts +0 -2
- package/src/datepicker/Datepicker.spec.ts +0 -129
- 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.spec.ts +0 -111
- 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.spec.ts +0 -102
- 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.spec.ts +0 -207
- 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.spec.ts +0 -359
- 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.spec.ts +0 -40
- 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.spec.ts +0 -23
- 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 -43
- package/src/input/Input.spec.ts +0 -69
- 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.spec.ts +0 -69
- 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.spec.ts +0 -18
- 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.spec.ts +0 -39
- 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.spec.ts +0 -149
- 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.spec.ts +0 -119
- 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.spec.ts +0 -47
- 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.spec.ts +0 -28
- 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.spec.ts +0 -28
- 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.spec.ts +0 -24
- 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.spec.ts +0 -37
- 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.spec.ts +0 -30
- 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.spec.ts +0 -87
- 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.spec.ts +0 -185
- 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.spec.ts +0 -84
- 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.spec.ts +0 -105
- 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.spec.ts +0 -46
- 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/tests/setup.ts +0 -352
- package/tsconfig.json +0 -29
- package/vitest.config.ts +0 -32
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { ButtonSize, ButtonVariant } from "@trendyol/baklava/dist/components/button/bl-button";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Position of the scroll-to-top button.
|
|
5
|
-
*/
|
|
6
|
-
export type ScrollToTopPosition =
|
|
7
|
-
| "bottom-right"
|
|
8
|
-
| "bottom-left"
|
|
9
|
-
| "top-right"
|
|
10
|
-
| "top-left";
|
|
11
|
-
|
|
12
|
-
export interface ScrollToTopProps {
|
|
13
|
-
/**
|
|
14
|
-
* Scroll threshold in pixels. Button becomes visible when user scrolls past this.
|
|
15
|
-
* @default 300
|
|
16
|
-
*/
|
|
17
|
-
threshold?: number;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Fixed position of the button.
|
|
21
|
-
* @default "bottom-right"
|
|
22
|
-
*/
|
|
23
|
-
position?: ScrollToTopPosition;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Accessible label for screen readers.
|
|
27
|
-
* @default "Scroll to top"
|
|
28
|
-
*/
|
|
29
|
-
label?: string;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Button size.
|
|
33
|
-
* @default "medium"
|
|
34
|
-
*/
|
|
35
|
-
size?: ButtonSize;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Button variant.
|
|
39
|
-
* @default "primary"
|
|
40
|
-
*/
|
|
41
|
-
variant?: ButtonVariant;
|
|
42
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { mount } from "@vue/test-utils";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import BvSelect from "./Select.vue";
|
|
4
|
-
|
|
5
|
-
describe("BvSelect", () => {
|
|
6
|
-
it("renders with default props", () => {
|
|
7
|
-
const wrapper = mount(BvSelect);
|
|
8
|
-
expect(wrapper.find("bl-select").exists()).toBe(true);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
it("passes label and placeholder to bl-select", () => {
|
|
12
|
-
const wrapper = mount(BvSelect, {
|
|
13
|
-
props: { label: "Choose", placeholder: "Select..." },
|
|
14
|
-
});
|
|
15
|
-
const el = wrapper.find("bl-select").element;
|
|
16
|
-
expect(el.getAttribute("label")).toBe("Choose");
|
|
17
|
-
expect(el.getAttribute("placeholder")).toBe("Select...");
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it("emits update:modelValue when bl-select fires bl-change", async () => {
|
|
21
|
-
const wrapper = mount(BvSelect);
|
|
22
|
-
const el = wrapper.find("bl-select").element as HTMLElement & { value?: string };
|
|
23
|
-
el.value = "option1";
|
|
24
|
-
el.dispatchEvent(
|
|
25
|
-
new CustomEvent("bl-change", {
|
|
26
|
-
bubbles: true,
|
|
27
|
-
detail: { target: el },
|
|
28
|
-
}),
|
|
29
|
-
);
|
|
30
|
-
await wrapper.vm.$nextTick();
|
|
31
|
-
expect(wrapper.emitted("update:modelValue")).toEqual([["option1"]]);
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("renders options from options prop", () => {
|
|
35
|
-
const wrapper = mount(BvSelect, {
|
|
36
|
-
props: {
|
|
37
|
-
options: [
|
|
38
|
-
{ value: "a", label: "Option A" },
|
|
39
|
-
{ value: "b", label: "Option B" },
|
|
40
|
-
],
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
expect(wrapper.findAll("bl-select-option")).toHaveLength(2);
|
|
44
|
-
expect(wrapper.text()).toContain("Option A");
|
|
45
|
-
expect(wrapper.text()).toContain("Option B");
|
|
46
|
-
});
|
|
47
|
-
});
|
package/src/select/Select.vue
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* Select Component
|
|
4
|
-
*
|
|
5
|
-
* A Vue UI kit component for Baklava's `bl-select` web component with v-model support.
|
|
6
|
-
* Supports both slot-based options and the `options` prop for programmatic rendering.
|
|
7
|
-
*
|
|
8
|
-
* @component
|
|
9
|
-
* @example
|
|
10
|
-
* ```vue
|
|
11
|
-
* <!-- Basic single select with slot -->
|
|
12
|
-
* <template>
|
|
13
|
-
* <BvSelect v-model="selected" label="Choose an option">
|
|
14
|
-
* <bl-select-option value="a">Option A</bl-select-option>
|
|
15
|
-
* <bl-select-option value="b">Option B</bl-select-option>
|
|
16
|
-
* </BvSelect>
|
|
17
|
-
* </template>
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```vue
|
|
22
|
-
* <!-- Options array -->
|
|
23
|
-
* <template>
|
|
24
|
-
* <BvSelect v-model="country" label="Country" :options="countries" />
|
|
25
|
-
* </template>
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```vue
|
|
30
|
-
* <!-- Multiple select -->
|
|
31
|
-
* <template>
|
|
32
|
-
* <BvSelect v-model="selected" label="Select multiple" :multiple="true" :options="items" />
|
|
33
|
-
* </template>
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
import { computed, onMounted } from "vue";
|
|
37
|
-
import { loadBaklavaResources } from "../utils/loadBaklavaResources";
|
|
38
|
-
import type { SelectProps } from "./select.types";
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Component props with default values.
|
|
42
|
-
*/
|
|
43
|
-
const props = withDefaults(defineProps<SelectProps>(), {
|
|
44
|
-
modelValue: undefined,
|
|
45
|
-
options: undefined,
|
|
46
|
-
label: undefined,
|
|
47
|
-
placeholder: undefined,
|
|
48
|
-
name: undefined,
|
|
49
|
-
required: undefined,
|
|
50
|
-
disabled: undefined,
|
|
51
|
-
multiple: undefined,
|
|
52
|
-
size: undefined,
|
|
53
|
-
clearable: undefined,
|
|
54
|
-
helpText: undefined,
|
|
55
|
-
customInvalidText: undefined,
|
|
56
|
-
searchBar: undefined,
|
|
57
|
-
searchBarPlaceholder: undefined,
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Component events.
|
|
62
|
-
*/
|
|
63
|
-
const emit = defineEmits<{
|
|
64
|
-
/**
|
|
65
|
-
* Emitted when the selection changes. Use with v-model.
|
|
66
|
-
*
|
|
67
|
-
* @param {string | string[] | null} value - The selected value(s). Array when multiple.
|
|
68
|
-
*/
|
|
69
|
-
"update:modelValue": [value: string | string[] | null];
|
|
70
|
-
/**
|
|
71
|
-
* Emitted when selection changes (bl-change event).
|
|
72
|
-
*
|
|
73
|
-
* @param {CustomEvent} event - The native bl-change event from bl-select.
|
|
74
|
-
*/
|
|
75
|
-
change: [event: CustomEvent];
|
|
76
|
-
/**
|
|
77
|
-
* Emitted on input (bl-input event).
|
|
78
|
-
*
|
|
79
|
-
* @param {CustomEvent} event - The native bl-input event from bl-select.
|
|
80
|
-
*/
|
|
81
|
-
input: [event: CustomEvent];
|
|
82
|
-
}>();
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Handles the bl-change event from the underlying bl-select component.
|
|
86
|
-
* Syncs v-model and forwards the change event.
|
|
87
|
-
* The bl-select element (event.target) exposes a .value property for the selected value.
|
|
88
|
-
*
|
|
89
|
-
* @param {CustomEvent} event - The bl-change event from bl-select.
|
|
90
|
-
*/
|
|
91
|
-
const handleChange = (event: CustomEvent) => {
|
|
92
|
-
emit("change", event);
|
|
93
|
-
const target = event.target as HTMLSelectElement & {
|
|
94
|
-
value?: string | string[] | null;
|
|
95
|
-
};
|
|
96
|
-
emit("update:modelValue", target?.value ?? null);
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Lifecycle hook: Component mounted.
|
|
101
|
-
*
|
|
102
|
-
* Loads Baklava resources when the component is mounted.
|
|
103
|
-
*/
|
|
104
|
-
/**
|
|
105
|
-
* Props to pass to bl-select. Excludes modelValue (we use :value) and options
|
|
106
|
-
* (we render bl-select-option children from options in the template).
|
|
107
|
-
*/
|
|
108
|
-
const selectProps = computed(() => {
|
|
109
|
-
const { modelValue: _, options: __, ...rest } = props;
|
|
110
|
-
return {
|
|
111
|
-
...rest,
|
|
112
|
-
disabled: rest.disabled === true ? true : undefined,
|
|
113
|
-
multiple: rest.multiple === true ? true : undefined,
|
|
114
|
-
"help-text": rest.helpText ?? undefined,
|
|
115
|
-
"invalid-text": rest.customInvalidText ?? undefined,
|
|
116
|
-
"search-bar": rest.searchBar === true ? true : undefined,
|
|
117
|
-
"search-bar-placeholder": rest.searchBarPlaceholder ?? undefined,
|
|
118
|
-
};
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
onMounted(() => {
|
|
122
|
-
loadBaklavaResources();
|
|
123
|
-
});
|
|
124
|
-
</script>
|
|
125
|
-
|
|
126
|
-
<template>
|
|
127
|
-
<bl-select
|
|
128
|
-
v-bind="selectProps"
|
|
129
|
-
:value="props.modelValue"
|
|
130
|
-
@bl-change="handleChange"
|
|
131
|
-
@bl-input="emit('input', $event)"
|
|
132
|
-
>
|
|
133
|
-
<!-- Render options from options prop when provided -->
|
|
134
|
-
<template v-if="options">
|
|
135
|
-
<bl-select-option
|
|
136
|
-
v-for="option in options"
|
|
137
|
-
:key="option.value"
|
|
138
|
-
:value="option.value"
|
|
139
|
-
:disabled="option.disabled"
|
|
140
|
-
>
|
|
141
|
-
{{ option.label }}
|
|
142
|
-
</bl-select-option>
|
|
143
|
-
</template>
|
|
144
|
-
<!-- Default slot for custom bl-select-option children -->
|
|
145
|
-
<slot />
|
|
146
|
-
</bl-select>
|
|
147
|
-
</template>
|
package/src/select/index.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Size variants for the Select component.
|
|
3
|
-
* @see {@link https://baklavastyle.trendyol.com/components/select | Baklava Select}
|
|
4
|
-
*/
|
|
5
|
-
export type SelectSize = "small" | "medium" | "large";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Option shape for the Select component's `options` prop.
|
|
9
|
-
* Each option can have a value, display label, and optional disabled state.
|
|
10
|
-
*/
|
|
11
|
-
export interface SelectOption {
|
|
12
|
-
/** The value submitted with the form or bound via v-model */
|
|
13
|
-
value: string;
|
|
14
|
-
/** The label displayed to the user */
|
|
15
|
-
label: string;
|
|
16
|
-
/** Whether the option is disabled */
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Props for the Select Vue UI kit component.
|
|
22
|
-
* Wraps Baklava's `bl-select` web component with v-model support.
|
|
23
|
-
*/
|
|
24
|
-
export interface SelectProps {
|
|
25
|
-
/** Selected value(s) - use with v-model. Single value or array when multiple. */
|
|
26
|
-
modelValue?: string | string[] | null;
|
|
27
|
-
/** Array of options for programmatic option rendering. Alternative to default slot. */
|
|
28
|
-
options?: SelectOption[];
|
|
29
|
-
/** Label displayed above or as placeholder for the select */
|
|
30
|
-
label?: string;
|
|
31
|
-
/** Placeholder text when no value is selected */
|
|
32
|
-
placeholder?: string;
|
|
33
|
-
/** Select name attribute for form submission */
|
|
34
|
-
name?: string;
|
|
35
|
-
/** Whether the select is required (shows error state when empty) */
|
|
36
|
-
required?: boolean;
|
|
37
|
-
/** Whether the select is disabled */
|
|
38
|
-
disabled?: boolean;
|
|
39
|
-
/** Whether multiple options can be selected */
|
|
40
|
-
multiple?: boolean;
|
|
41
|
-
/** Size of the select: small, medium, or large */
|
|
42
|
-
size?: SelectSize;
|
|
43
|
-
/** Whether the selected value can be cleared */
|
|
44
|
-
clearable?: boolean;
|
|
45
|
-
/** Help text displayed below the select */
|
|
46
|
-
helpText?: string;
|
|
47
|
-
/** Custom error message for validation */
|
|
48
|
-
customInvalidText?: string;
|
|
49
|
-
/** Enable search/filter for options in the dropdown */
|
|
50
|
-
searchBar?: boolean;
|
|
51
|
-
/** Placeholder text for the search input */
|
|
52
|
-
searchBarPlaceholder?: string;
|
|
53
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { mount } from "@vue/test-utils";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import BvSkeleton from "./Skeleton.vue";
|
|
4
|
-
|
|
5
|
-
describe("BvSkeleton", () => {
|
|
6
|
-
it("renders with default props", () => {
|
|
7
|
-
const wrapper = mount(BvSkeleton);
|
|
8
|
-
expect(wrapper.find(".skeleton-wrapper").exists()).toBe(true);
|
|
9
|
-
expect(wrapper.findAll(".skeleton")).toHaveLength(1);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it("renders multiple skeletons when count > 1", () => {
|
|
13
|
-
const wrapper = mount(BvSkeleton, { props: { count: 3 } });
|
|
14
|
-
expect(wrapper.findAll(".skeleton")).toHaveLength(3);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it("applies variant class", () => {
|
|
18
|
-
const wrapper = mount(BvSkeleton, { props: { variant: "circle" } });
|
|
19
|
-
expect(wrapper.find(".skeleton--circle").exists()).toBe(true);
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it("has aria-label for accessibility", () => {
|
|
23
|
-
const wrapper = mount(BvSkeleton);
|
|
24
|
-
expect(wrapper.find(".skeleton-wrapper").element.getAttribute("aria-label")).toBe(
|
|
25
|
-
"Loading",
|
|
26
|
-
);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* Skeleton Component
|
|
4
|
-
*
|
|
5
|
-
* Animated placeholder for content loading states.
|
|
6
|
-
* Displays a shimmer effect with configurable variants.
|
|
7
|
-
*
|
|
8
|
-
* @component
|
|
9
|
-
* @example
|
|
10
|
-
* ```vue
|
|
11
|
-
* <template>
|
|
12
|
-
* <BvSkeleton />
|
|
13
|
-
* </template>
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```vue
|
|
18
|
-
* <template>
|
|
19
|
-
* <BvSkeleton variant="text" :count="3" />
|
|
20
|
-
* </template>
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
import { computed, onMounted } from "vue";
|
|
24
|
-
import { loadBaklavaResources } from "../utils/loadBaklavaResources";
|
|
25
|
-
import type { SkeletonProps } from "./skeleton.types";
|
|
26
|
-
|
|
27
|
-
const props = withDefaults(defineProps<SkeletonProps>(), {
|
|
28
|
-
variant: "rectangle",
|
|
29
|
-
width: undefined,
|
|
30
|
-
height: undefined,
|
|
31
|
-
count: 1,
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const effectiveWidth = computed(() => {
|
|
35
|
-
if (props.width) return props.width;
|
|
36
|
-
if (props.variant === "circle") return "40px";
|
|
37
|
-
return "100%";
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const effectiveHeight = computed(() => {
|
|
41
|
-
if (props.height) return props.height;
|
|
42
|
-
if (props.variant === "circle") return "40px";
|
|
43
|
-
return "1rem";
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
onMounted(() => {
|
|
48
|
-
loadBaklavaResources();
|
|
49
|
-
});
|
|
50
|
-
</script>
|
|
51
|
-
|
|
52
|
-
<template>
|
|
53
|
-
<div
|
|
54
|
-
class="skeleton-wrapper"
|
|
55
|
-
:class="`skeleton-wrapper--${props.variant}`"
|
|
56
|
-
role="status"
|
|
57
|
-
aria-label="Loading"
|
|
58
|
-
>
|
|
59
|
-
<div
|
|
60
|
-
v-for="n in count"
|
|
61
|
-
:key="n"
|
|
62
|
-
class="skeleton"
|
|
63
|
-
:class="['skeleton--' + props.variant]"
|
|
64
|
-
:style="{
|
|
65
|
-
width: effectiveWidth,
|
|
66
|
-
height: effectiveHeight,
|
|
67
|
-
}"
|
|
68
|
-
/>
|
|
69
|
-
</div>
|
|
70
|
-
</template>
|
|
71
|
-
|
|
72
|
-
<style scoped>
|
|
73
|
-
.skeleton-wrapper {
|
|
74
|
-
display: flex;
|
|
75
|
-
flex-direction: column;
|
|
76
|
-
gap: 0.5rem;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.skeleton {
|
|
80
|
-
background: var(--bl-color-neutral-light, #e5e7eb);
|
|
81
|
-
border-radius: var(--bl-border-radius-s, 0.25rem);
|
|
82
|
-
position: relative;
|
|
83
|
-
overflow: hidden;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.skeleton::after {
|
|
87
|
-
content: "";
|
|
88
|
-
position: absolute;
|
|
89
|
-
inset: 0;
|
|
90
|
-
background: linear-gradient(
|
|
91
|
-
90deg,
|
|
92
|
-
transparent 0%,
|
|
93
|
-
rgba(255, 255, 255, 0.4) 50%,
|
|
94
|
-
transparent 100%
|
|
95
|
-
);
|
|
96
|
-
animation: skeleton-shimmer 1.5s ease-in-out infinite;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.skeleton--circle {
|
|
100
|
-
border-radius: var(--bl-border-radius-circle, 50%);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.skeleton--text {
|
|
104
|
-
height: 1rem;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
@keyframes skeleton-shimmer {
|
|
108
|
-
0% {
|
|
109
|
-
transform: translateX(-100%);
|
|
110
|
-
}
|
|
111
|
-
100% {
|
|
112
|
-
transform: translateX(100%);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
</style>
|
package/src/skeleton/index.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Skeleton shape variant.
|
|
3
|
-
*/
|
|
4
|
-
export type SkeletonVariant = "text" | "rectangle" | "circle";
|
|
5
|
-
|
|
6
|
-
export interface SkeletonProps {
|
|
7
|
-
/**
|
|
8
|
-
* Shape variant of the skeleton.
|
|
9
|
-
* - text: Line shape for text placeholders
|
|
10
|
-
* - rectangle: Default block shape
|
|
11
|
-
* - circle: Circular shape for avatars
|
|
12
|
-
* @default "rectangle"
|
|
13
|
-
*/
|
|
14
|
-
variant?: SkeletonVariant;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Width as CSS value (e.g. "100%", "200px", "5rem").
|
|
18
|
-
* @default "100%" for text/rectangle, "40px" for circle
|
|
19
|
-
*/
|
|
20
|
-
width?: string;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Height as CSS value (e.g. "1rem", "20px").
|
|
24
|
-
* @default "1rem" for text, "1rem" for rectangle, "40px" for circle
|
|
25
|
-
*/
|
|
26
|
-
height?: string;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Number of skeleton elements to render (for text lines).
|
|
30
|
-
* @default 1
|
|
31
|
-
*/
|
|
32
|
-
count?: number;
|
|
33
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { mount } from "@vue/test-utils";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import BvSpinner from "./Spinner.vue";
|
|
4
|
-
|
|
5
|
-
describe("BvSpinner", () => {
|
|
6
|
-
it("renders with default props", () => {
|
|
7
|
-
const wrapper = mount(BvSpinner);
|
|
8
|
-
const blSpinner = wrapper.find("bl-spinner");
|
|
9
|
-
expect(blSpinner.exists()).toBe(true);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it("passes size and variant to bl-spinner", () => {
|
|
13
|
-
const wrapper = mount(BvSpinner, {
|
|
14
|
-
props: { size: "large", variant: "primary" },
|
|
15
|
-
});
|
|
16
|
-
const blSpinner = wrapper.find("bl-spinner").element;
|
|
17
|
-
expect(blSpinner.getAttribute("size")).toBe("large");
|
|
18
|
-
expect(blSpinner.getAttribute("variant")).toBe("primary");
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("passes aria-label for accessibility", () => {
|
|
22
|
-
const wrapper = mount(BvSpinner, {
|
|
23
|
-
props: { label: "Loading..." },
|
|
24
|
-
});
|
|
25
|
-
const blSpinner = wrapper.find("bl-spinner").element;
|
|
26
|
-
expect(blSpinner.getAttribute("aria-label")).toBe("Loading...");
|
|
27
|
-
});
|
|
28
|
-
});
|
package/src/spinner/Spinner.vue
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* Spinner Component
|
|
4
|
-
*
|
|
5
|
-
* A Vue UI kit component for Baklava's `bl-spinner` web component for loading indicators.
|
|
6
|
-
* Displays an animated spinner with configurable size and variant.
|
|
7
|
-
*
|
|
8
|
-
* @component
|
|
9
|
-
* @example
|
|
10
|
-
* ```vue
|
|
11
|
-
* <template>
|
|
12
|
-
* <BvSpinner />
|
|
13
|
-
* </template>
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```vue
|
|
18
|
-
* <template>
|
|
19
|
-
* <BvSpinner size="large" label="Loading..." />
|
|
20
|
-
* </template>
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
import { computed, onMounted } from "vue";
|
|
24
|
-
import { loadBaklavaResources } from "../utils/loadBaklavaResources";
|
|
25
|
-
import type { SpinnerProps } from "./spinner.types";
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Component props with default values.
|
|
29
|
-
*/
|
|
30
|
-
const props = withDefaults(defineProps<SpinnerProps>(), {
|
|
31
|
-
size: undefined,
|
|
32
|
-
variant: undefined,
|
|
33
|
-
label: undefined,
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
/** Props to pass to bl-spinner (excludes label, which is used for aria-label) */
|
|
37
|
-
const spinnerProps = computed(() => {
|
|
38
|
-
const { label: _, ...rest } = props;
|
|
39
|
-
return rest;
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
onMounted(() => {
|
|
43
|
-
loadBaklavaResources();
|
|
44
|
-
});
|
|
45
|
-
</script>
|
|
46
|
-
|
|
47
|
-
<template>
|
|
48
|
-
<bl-spinner v-bind="spinnerProps" :aria-label="label" />
|
|
49
|
-
</template>
|
package/src/spinner/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Props for the Spinner component.
|
|
3
|
-
*/
|
|
4
|
-
export interface SpinnerProps {
|
|
5
|
-
/** Spinner size (e.g. CSS variable or length like var(--bl-font-size-m)) */
|
|
6
|
-
size?: string;
|
|
7
|
-
/** Spinner variant/style */
|
|
8
|
-
variant?: string;
|
|
9
|
-
/** Accessible label for screen readers */
|
|
10
|
-
label?: string;
|
|
11
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { mount } from "@vue/test-utils";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import BvSplitButton from "./SplitButton.vue";
|
|
4
|
-
|
|
5
|
-
describe("BvSplitButton", () => {
|
|
6
|
-
it("renders with label", () => {
|
|
7
|
-
const wrapper = mount(BvSplitButton, {
|
|
8
|
-
props: { label: "Actions" },
|
|
9
|
-
});
|
|
10
|
-
expect(wrapper.find("bl-split-button").exists()).toBe(true);
|
|
11
|
-
expect(wrapper.find("bl-split-button").element.getAttribute("label")).toBe(
|
|
12
|
-
"Actions",
|
|
13
|
-
);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("emits click when bl-split-button fires bl-click", async () => {
|
|
17
|
-
const wrapper = mount(BvSplitButton, { props: { label: "Save" } });
|
|
18
|
-
wrapper.find("bl-split-button").element.dispatchEvent(
|
|
19
|
-
new CustomEvent("bl-click", { bubbles: true }),
|
|
20
|
-
);
|
|
21
|
-
await wrapper.vm.$nextTick();
|
|
22
|
-
expect(wrapper.emitted("click")).toHaveLength(1);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
/**
|
|
3
|
-
* SplitButton Component
|
|
4
|
-
*
|
|
5
|
-
* A Vue UI kit component for Baklava's `bl-split-button` web component.
|
|
6
|
-
* A button with a primary action and a dropdown for secondary actions.
|
|
7
|
-
* Dropdown content is provided via the `dropdown-content` slot.
|
|
8
|
-
*
|
|
9
|
-
* @component
|
|
10
|
-
* @example
|
|
11
|
-
* ```vue
|
|
12
|
-
* <template>
|
|
13
|
-
* <BvSplitButton label="Actions" @click="handleClick">
|
|
14
|
-
* <template #dropdown-content>
|
|
15
|
-
* <bl-dropdown-item>Action 1</bl-dropdown-item>
|
|
16
|
-
* <bl-dropdown-item>Action 2</bl-dropdown-item>
|
|
17
|
-
* </template>
|
|
18
|
-
* </BvSplitButton>
|
|
19
|
-
* </template>
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```vue
|
|
24
|
-
* <template>
|
|
25
|
-
* <BvSplitButton label="Save" icon="check" variant="primary" @click="save" />
|
|
26
|
-
* </template>
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
import { onMounted } from "vue";
|
|
30
|
-
import { loadBaklavaResources } from "../utils/loadBaklavaResources";
|
|
31
|
-
import type { SplitButtonProps } from "./split-button.types";
|
|
32
|
-
|
|
33
|
-
const props = defineProps<SplitButtonProps>();
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Component events.
|
|
37
|
-
*/
|
|
38
|
-
const emit = defineEmits<{
|
|
39
|
-
/**
|
|
40
|
-
* Emitted when the main button is clicked.
|
|
41
|
-
*
|
|
42
|
-
* @param {CustomEvent} event - The native click event from bl-split-button.
|
|
43
|
-
*/
|
|
44
|
-
click: [event: CustomEvent];
|
|
45
|
-
/**
|
|
46
|
-
* Emitted when the dropdown button is clicked.
|
|
47
|
-
*
|
|
48
|
-
* @param {CustomEvent} event - The native dropdown-click event from bl-split-button.
|
|
49
|
-
*/
|
|
50
|
-
"dropdown-click": [event: CustomEvent];
|
|
51
|
-
}>();
|
|
52
|
-
|
|
53
|
-
onMounted(() => {
|
|
54
|
-
loadBaklavaResources();
|
|
55
|
-
});
|
|
56
|
-
</script>
|
|
57
|
-
|
|
58
|
-
<template>
|
|
59
|
-
<bl-split-button
|
|
60
|
-
v-bind="{
|
|
61
|
-
variant: props.variant,
|
|
62
|
-
size: props.size,
|
|
63
|
-
disabled: props.disabled === true ? true : undefined,
|
|
64
|
-
loading: props.loading === true ? true : undefined,
|
|
65
|
-
label: props.label,
|
|
66
|
-
icon: props.icon,
|
|
67
|
-
}"
|
|
68
|
-
@bl-click="emit('click', $event)"
|
|
69
|
-
@bl-dropdown-click="emit('dropdown-click', $event)"
|
|
70
|
-
>
|
|
71
|
-
<slot v-if="$slots['dropdown-content']" name="dropdown-content" />
|
|
72
|
-
</bl-split-button>
|
|
73
|
-
</template>
|