@baklavue/mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -0
- package/dist/data/component-categories.d.ts +7 -0
- package/dist/data/component-categories.js +48 -0
- package/dist/data/loaders.d.ts +22 -0
- package/dist/data/loaders.js +346 -0
- package/dist/docs/components/accordion.md +601 -0
- package/dist/docs/components/alert.md +233 -0
- package/dist/docs/components/badge.md +100 -0
- package/dist/docs/components/banner.md +231 -0
- package/dist/docs/components/button.md +324 -0
- package/dist/docs/components/checkbox.md +343 -0
- package/dist/docs/components/chip.md +199 -0
- package/dist/docs/components/datepicker.md +243 -0
- package/dist/docs/components/dialog.md +224 -0
- package/dist/docs/components/drawer.md +188 -0
- package/dist/docs/components/dropdown.md +291 -0
- package/dist/docs/components/file-upload.md +248 -0
- package/dist/docs/components/icon.md +142 -0
- package/dist/docs/components/image.md +161 -0
- package/dist/docs/components/index.md +151 -0
- package/dist/docs/components/input.md +407 -0
- package/dist/docs/components/link.md +249 -0
- package/dist/docs/components/notification.md +179 -0
- package/dist/docs/components/pagination.md +168 -0
- package/dist/docs/components/radio.md +221 -0
- package/dist/docs/components/scroll-to-top.md +90 -0
- package/dist/docs/components/select.md +239 -0
- package/dist/docs/components/skeleton.md +79 -0
- package/dist/docs/components/spinner.md +93 -0
- package/dist/docs/components/split-button.md +165 -0
- package/dist/docs/components/stepper.md +337 -0
- package/dist/docs/components/switch.md +144 -0
- package/dist/docs/components/tab.md +140 -0
- package/dist/docs/components/table.md +362 -0
- package/dist/docs/components/tag.md +243 -0
- package/dist/docs/components/textarea.md +190 -0
- package/dist/docs/components/tooltip.md +155 -0
- package/dist/docs/composables/alert.md +87 -0
- package/dist/docs/composables/asyncState.md +74 -0
- package/dist/docs/composables/base64.md +72 -0
- package/dist/docs/composables/breakpoints.md +129 -0
- package/dist/docs/composables/clipboard.md +108 -0
- package/dist/docs/composables/colorScheme.md +110 -0
- package/dist/docs/composables/confirmDialog.md +105 -0
- package/dist/docs/composables/containerScroll.md +89 -0
- package/dist/docs/composables/cookie.md +137 -0
- package/dist/docs/composables/debounce.md +69 -0
- package/dist/docs/composables/disclosure.md +69 -0
- package/dist/docs/composables/elementSize.md +84 -0
- package/dist/docs/composables/fetch.md +257 -0
- package/dist/docs/composables/fieldArray.md +104 -0
- package/dist/docs/composables/file.md +343 -0
- package/dist/docs/composables/focusTrap.md +87 -0
- package/dist/docs/composables/formPersistence.md +69 -0
- package/dist/docs/composables/formState.md +71 -0
- package/dist/docs/composables/formValidation.md +355 -0
- package/dist/docs/composables/format.md +107 -0
- package/dist/docs/composables/id.md +54 -0
- package/dist/docs/composables/index.md +112 -0
- package/dist/docs/composables/infiniteQuery.md +104 -0
- package/dist/docs/composables/intersectionObserver.md +64 -0
- package/dist/docs/composables/lazyQuery.md +68 -0
- package/dist/docs/composables/loading.md +91 -0
- package/dist/docs/composables/mutation.md +83 -0
- package/dist/docs/composables/notification.md +169 -0
- package/dist/docs/composables/pagination.md +109 -0
- package/dist/docs/composables/polling.md +76 -0
- package/dist/docs/composables/previous.md +58 -0
- package/dist/docs/composables/query.md +248 -0
- package/dist/docs/composables/raf.md +78 -0
- package/dist/docs/composables/scrollLock.md +46 -0
- package/dist/docs/composables/scrollToError.md +291 -0
- package/dist/docs/composables/scrollVisibility.md +60 -0
- package/dist/docs/composables/share.md +78 -0
- package/dist/docs/composables/slug.md +58 -0
- package/dist/docs/composables/stepper.md +117 -0
- package/dist/docs/composables/stepperForm.md +74 -0
- package/dist/docs/composables/sticky.md +91 -0
- package/dist/docs/composables/storage.md +193 -0
- package/dist/docs/composables/theme.md +252 -0
- package/dist/docs/composables/themePreset.md +62 -0
- package/dist/docs/composables/throttle.md +76 -0
- package/dist/docs/composables/timer.md +78 -0
- package/dist/docs/composables/toggle.md +55 -0
- package/dist/docs/guide/contributing.md +364 -0
- package/dist/docs/guide/design-tokens.md +29 -0
- package/dist/docs/guide/getting-started.md +181 -0
- package/dist/docs/guide/installation.md +287 -0
- package/dist/docs/guide/localization.md +132 -0
- package/dist/docs/guide/mcp.md +141 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +177 -0
- package/package.json +48 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# Select
|
|
2
|
+
|
|
3
|
+
A Vue UI kit component for Baklava's `bl-select` component with v-model support. Supports both slot-based options (using `bl-select-option` children) and the `options` prop for programmatic rendering. Single and multiple selection modes are supported.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
Use `v-model` for two-way binding. Provide options via the default slot using `bl-select-option` elements.
|
|
8
|
+
|
|
9
|
+
<div class="component-demo">
|
|
10
|
+
|
|
11
|
+
<SelectBasicDemo />
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<template>
|
|
17
|
+
<BvSelect v-model="selected" label="Choose an option">
|
|
18
|
+
<bl-select-option value="option1">Option 1</bl-select-option>
|
|
19
|
+
<bl-select-option value="option2">Option 2</bl-select-option>
|
|
20
|
+
<bl-select-option value="option3">Option 3</bl-select-option>
|
|
21
|
+
</BvSelect>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script setup>
|
|
25
|
+
import { ref } from "vue";
|
|
26
|
+
import { BvSelect } from "@baklavue/ui";
|
|
27
|
+
|
|
28
|
+
const selected = ref("option1");
|
|
29
|
+
</script>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## With Options Array
|
|
33
|
+
|
|
34
|
+
Use the `options` prop for programmatic option rendering. Each option has `value`, `label`, and optional `disabled`.
|
|
35
|
+
|
|
36
|
+
<div class="component-demo">
|
|
37
|
+
|
|
38
|
+
<SelectOptionsDemo />
|
|
39
|
+
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
```vue
|
|
43
|
+
<template>
|
|
44
|
+
<BvSelect v-model="selected" label="Country" :options="countries" placeholder="Select a country" />
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<script setup>
|
|
48
|
+
import { ref } from "vue";
|
|
49
|
+
import { BvSelect } from "@baklavue/ui";
|
|
50
|
+
|
|
51
|
+
const selected = ref("");
|
|
52
|
+
const countries = [
|
|
53
|
+
{ value: "us", label: "United States" },
|
|
54
|
+
{ value: "uk", label: "United Kingdom" },
|
|
55
|
+
{ value: "tr", label: "Turkey" },
|
|
56
|
+
];
|
|
57
|
+
</script>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Multiple Select
|
|
61
|
+
|
|
62
|
+
Enable multiple selection with the `multiple` prop. The `modelValue` becomes an array of selected values.
|
|
63
|
+
|
|
64
|
+
<div class="component-demo">
|
|
65
|
+
|
|
66
|
+
<SelectMultipleDemo />
|
|
67
|
+
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
```vue
|
|
71
|
+
<template>
|
|
72
|
+
<BvSelect
|
|
73
|
+
v-model="selected"
|
|
74
|
+
label="Frameworks"
|
|
75
|
+
:options="items"
|
|
76
|
+
:multiple="true"
|
|
77
|
+
placeholder="Select multiple"
|
|
78
|
+
/>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<script setup>
|
|
82
|
+
import { ref } from "vue";
|
|
83
|
+
import { BvSelect } from "@baklavue/ui";
|
|
84
|
+
|
|
85
|
+
const selected = ref([]);
|
|
86
|
+
const items = [
|
|
87
|
+
{ value: "react", label: "React" },
|
|
88
|
+
{ value: "vue", label: "Vue" },
|
|
89
|
+
{ value: "svelte", label: "Svelte" },
|
|
90
|
+
{ value: "angular", label: "Angular" },
|
|
91
|
+
];
|
|
92
|
+
</script>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Disabled State
|
|
96
|
+
|
|
97
|
+
Disable the select to prevent user interaction.
|
|
98
|
+
|
|
99
|
+
<div class="component-demo">
|
|
100
|
+
|
|
101
|
+
<SelectDisabledDemo />
|
|
102
|
+
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
```vue
|
|
106
|
+
<template>
|
|
107
|
+
<BvSelect v-model="selected" label="Disabled Select" :options="options" :disabled="true" />
|
|
108
|
+
</template>
|
|
109
|
+
|
|
110
|
+
<script setup>
|
|
111
|
+
import { ref } from "vue";
|
|
112
|
+
import { BvSelect } from "@baklavue/ui";
|
|
113
|
+
|
|
114
|
+
const selected = ref("option1");
|
|
115
|
+
const options = [
|
|
116
|
+
{ value: "option1", label: "Option 1" },
|
|
117
|
+
{ value: "option2", label: "Option 2" },
|
|
118
|
+
{ value: "option3", label: "Option 3" },
|
|
119
|
+
];
|
|
120
|
+
</script>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Sizes
|
|
124
|
+
|
|
125
|
+
Use the `size` prop to change the select height: `small`, `medium`, or `large`.
|
|
126
|
+
|
|
127
|
+
<div class="component-demo">
|
|
128
|
+
|
|
129
|
+
<SelectSizesDemo />
|
|
130
|
+
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
```vue
|
|
134
|
+
<template>
|
|
135
|
+
<div style="display: flex; flex-direction: column; gap: 1rem; max-width: 300px;">
|
|
136
|
+
<BvSelect v-model="small" size="small" label="Small" :options="options" placeholder="Select" />
|
|
137
|
+
<BvSelect v-model="medium" size="medium" label="Medium" :options="options" placeholder="Select" />
|
|
138
|
+
<BvSelect v-model="large" size="large" label="Large" :options="options" placeholder="Select" />
|
|
139
|
+
</div>
|
|
140
|
+
</template>
|
|
141
|
+
|
|
142
|
+
<script setup>
|
|
143
|
+
import { ref } from "vue";
|
|
144
|
+
import { BvSelect } from "@baklavue/ui";
|
|
145
|
+
|
|
146
|
+
const small = ref("");
|
|
147
|
+
const medium = ref("");
|
|
148
|
+
const large = ref("");
|
|
149
|
+
const options = [
|
|
150
|
+
{ value: "a", label: "Option A" },
|
|
151
|
+
{ value: "b", label: "Option B" },
|
|
152
|
+
{ value: "c", label: "Option C" },
|
|
153
|
+
];
|
|
154
|
+
</script>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Props
|
|
158
|
+
|
|
159
|
+
| Prop | Type | Default | Description |
|
|
160
|
+
| -------------------- | ----------------------- | ----------- | ---------------------------------------------------------------- |
|
|
161
|
+
| `modelValue` | `string \| string[] \| null` | `undefined` | Selected value(s). Use with v-model. Array when `multiple` is true. |
|
|
162
|
+
| `options` | `SelectOption[]` | `undefined` | Array of options for programmatic rendering |
|
|
163
|
+
| `label` | `string` | `undefined` | Label displayed above or as placeholder |
|
|
164
|
+
| `placeholder` | `string` | `undefined` | Placeholder text when no value is selected |
|
|
165
|
+
| `name` | `string` | `undefined` | Select name attribute for form submission |
|
|
166
|
+
| `required` | `boolean` | `undefined` | Whether the select is required (shows error state when empty) |
|
|
167
|
+
| `disabled` | `boolean` | `undefined` | Whether the select is disabled |
|
|
168
|
+
| `multiple` | `boolean` | `undefined` | Whether multiple options can be selected |
|
|
169
|
+
| `size` | `SelectSize` | `undefined` | Size: `small`, `medium`, or `large` |
|
|
170
|
+
| `clearable` | `boolean` | `undefined` | Whether the selected value can be cleared |
|
|
171
|
+
| `helpText` | `string` | `undefined` | Help text displayed below the select |
|
|
172
|
+
| `customInvalidText` | `string` | `undefined` | Custom error message for validation |
|
|
173
|
+
| `searchBar` | `boolean` | `undefined` | Enable search/filter for options in the dropdown |
|
|
174
|
+
| `searchBarPlaceholder` | `string` | `undefined` | Placeholder text for the search input |
|
|
175
|
+
|
|
176
|
+
### SelectOption Interface
|
|
177
|
+
|
|
178
|
+
When using the `options` prop, each item should follow the `SelectOption` interface:
|
|
179
|
+
|
|
180
|
+
| Property | Type | Default | Description |
|
|
181
|
+
| ---------- | --------- | ----------- | ------------------------------ |
|
|
182
|
+
| `value` | `string` | required | The value submitted or bound |
|
|
183
|
+
| `label` | `string` | required | The label displayed to the user |
|
|
184
|
+
| `disabled` | `boolean` | `undefined` | Whether the option is disabled |
|
|
185
|
+
|
|
186
|
+
## Events
|
|
187
|
+
|
|
188
|
+
| Event | Payload | Description |
|
|
189
|
+
| ------------------- | ---------------------------- | -------------------------------------------------------- |
|
|
190
|
+
| `update:modelValue` | `string \| string[] \| null` | Emitted when selection changes. Use with v-model. |
|
|
191
|
+
| `change` | `CustomEvent` | Emitted when selection changes (bl-change event) |
|
|
192
|
+
| `input` | `CustomEvent` | Emitted on input (bl-input event) |
|
|
193
|
+
|
|
194
|
+
## Slots
|
|
195
|
+
|
|
196
|
+
| Slot | Props | Description |
|
|
197
|
+
| --------- | ----- | ------------------------------------------------------------------------ |
|
|
198
|
+
| `default` | - | Custom `bl-select-option` elements. Alternative to the `options` prop. |
|
|
199
|
+
|
|
200
|
+
## Types
|
|
201
|
+
|
|
202
|
+
```typescript
|
|
203
|
+
import type { SelectProps, SelectOption, SelectSize } from "@baklavue/ui";
|
|
204
|
+
|
|
205
|
+
type SelectSize = "small" | "medium" | "large";
|
|
206
|
+
|
|
207
|
+
interface SelectOption {
|
|
208
|
+
value: string;
|
|
209
|
+
label: string;
|
|
210
|
+
disabled?: boolean;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
interface SelectProps {
|
|
214
|
+
modelValue?: string | string[] | null;
|
|
215
|
+
options?: SelectOption[];
|
|
216
|
+
label?: string;
|
|
217
|
+
placeholder?: string;
|
|
218
|
+
name?: string;
|
|
219
|
+
required?: boolean;
|
|
220
|
+
disabled?: boolean;
|
|
221
|
+
multiple?: boolean;
|
|
222
|
+
size?: SelectSize;
|
|
223
|
+
clearable?: boolean;
|
|
224
|
+
helpText?: string;
|
|
225
|
+
customInvalidText?: string;
|
|
226
|
+
searchBar?: boolean;
|
|
227
|
+
searchBarPlaceholder?: string;
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
## Usage Notes
|
|
232
|
+
|
|
233
|
+
- **Options vs Slot**: Use the `options` prop for data-driven option lists, or the default slot with `bl-select-option` elements when you need full control over markup.
|
|
234
|
+
|
|
235
|
+
- **v-model**: The component uses `modelValue` for single select and emits `string | null`. With `multiple`, `modelValue` is `string[]`.
|
|
236
|
+
|
|
237
|
+
- **Baklava Alignment**: The component wraps Baklava's `bl-select` and passes through supported props. Attributes like `help-text`, `search-bar`, etc. are mapped from camelCase props.
|
|
238
|
+
|
|
239
|
+
- **Accessibility**: The component follows Baklava's accessibility guidelines and includes proper ARIA attributes for screen readers.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Skeleton
|
|
2
|
+
|
|
3
|
+
Animated placeholder for content loading states. Displays a shimmer effect with configurable variants.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
<div class="component-demo">
|
|
8
|
+
|
|
9
|
+
<SkeletonBasicDemo />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<template>
|
|
15
|
+
<BvSkeleton />
|
|
16
|
+
<BvSkeleton variant="text" :count="3" />
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script setup>
|
|
20
|
+
import { BvSkeleton } from "@baklavue/ui";
|
|
21
|
+
</script>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Variants
|
|
25
|
+
|
|
26
|
+
Use the `variant` prop for different placeholder shapes: rectangle (default), text lines, or circle (for avatars).
|
|
27
|
+
|
|
28
|
+
<div class="component-demo">
|
|
29
|
+
|
|
30
|
+
<SkeletonVariantsDemo />
|
|
31
|
+
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
```vue
|
|
35
|
+
<template>
|
|
36
|
+
<!-- Rectangle (default) -->
|
|
37
|
+
<BvSkeleton width="200px" height="120px" />
|
|
38
|
+
|
|
39
|
+
<!-- Text lines -->
|
|
40
|
+
<BvSkeleton variant="text" :count="3" />
|
|
41
|
+
|
|
42
|
+
<!-- Circle for avatar -->
|
|
43
|
+
<BvSkeleton variant="circle" />
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script setup>
|
|
47
|
+
import { BvSkeleton } from "@baklavue/ui";
|
|
48
|
+
</script>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Props
|
|
52
|
+
|
|
53
|
+
| Prop | Type | Default | Description |
|
|
54
|
+
| --------- | ---------------- | ------------ | ---------------------------------------------- |
|
|
55
|
+
| `variant` | `SkeletonVariant` | `"rectangle"` | Shape: text, rectangle, circle |
|
|
56
|
+
| `width` | `string` | varies | Width as CSS value (100% for text/rect, 40px for circle) |
|
|
57
|
+
| `height` | `string` | varies | Height as CSS value (1rem default) |
|
|
58
|
+
| `count` | `number` | `1` | Number of skeleton elements (for text lines) |
|
|
59
|
+
|
|
60
|
+
## Types
|
|
61
|
+
|
|
62
|
+
```typescript
|
|
63
|
+
import type { SkeletonProps, SkeletonVariant } from "@baklavue/ui";
|
|
64
|
+
|
|
65
|
+
type SkeletonVariant = "text" | "rectangle" | "circle";
|
|
66
|
+
|
|
67
|
+
interface SkeletonProps {
|
|
68
|
+
variant?: SkeletonVariant;
|
|
69
|
+
width?: string;
|
|
70
|
+
height?: string;
|
|
71
|
+
count?: number;
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Usage Notes
|
|
76
|
+
|
|
77
|
+
- **Design tokens**: The skeleton uses `--bl-color-neutral-light` and `--bl-border-radius-s` for consistent styling with the Baklava design system.
|
|
78
|
+
- **Accessibility**: The component has `role="status"` and `aria-label="Loading"` for screen readers.
|
|
79
|
+
- **Content patterns**: Use text variant for paragraph placeholders, rectangle for cards/images, and circle for avatars and profile pictures.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Spinner
|
|
2
|
+
|
|
3
|
+
A Vue UI kit component for Baklava's `bl-spinner` web component for loading indicators. Use the Spinner component to show loading states during async operations.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
<div class="component-demo">
|
|
8
|
+
|
|
9
|
+
<SpinnerBasicDemo />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<template>
|
|
15
|
+
<div style="display: flex; align-items: center; gap: 1rem;">
|
|
16
|
+
<BvSpinner />
|
|
17
|
+
<span>Loading...</span>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup>
|
|
22
|
+
import { BvSpinner } from "@baklavue/ui";
|
|
23
|
+
</script>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Sizes
|
|
27
|
+
|
|
28
|
+
Control the spinner size using the `size` prop. Use CSS variables for consistent sizing.
|
|
29
|
+
|
|
30
|
+
<div class="component-demo">
|
|
31
|
+
|
|
32
|
+
<SpinnerSizesDemo />
|
|
33
|
+
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
```vue
|
|
37
|
+
<template>
|
|
38
|
+
<div style="display: flex; align-items: center; gap: 2rem;">
|
|
39
|
+
<BvSpinner size="var(--bl-font-size-s)" />
|
|
40
|
+
<BvSpinner size="var(--bl-font-size-m)" />
|
|
41
|
+
<BvSpinner size="var(--bl-font-size-l)" />
|
|
42
|
+
</div>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script setup>
|
|
46
|
+
import { BvSpinner } from "@baklavue/ui";
|
|
47
|
+
</script>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## With Label
|
|
51
|
+
|
|
52
|
+
Add a `label` for accessibility. The label is exposed to screen readers via `aria-label`.
|
|
53
|
+
|
|
54
|
+
<div class="component-demo">
|
|
55
|
+
|
|
56
|
+
<SpinnerVariantsDemo />
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
```vue
|
|
61
|
+
<template>
|
|
62
|
+
<BvSpinner label="Loading content..." />
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script setup>
|
|
66
|
+
import { BvSpinner } from "@baklavue/ui";
|
|
67
|
+
</script>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Props
|
|
71
|
+
|
|
72
|
+
| Prop | Type | Default | Description |
|
|
73
|
+
| --------- | -------- | ----------- | ------------------------------------------- |
|
|
74
|
+
| `size` | `string` | `undefined` | Spinner size (e.g. CSS variable or length) |
|
|
75
|
+
| `variant` | `string` | `undefined` | Spinner variant/style |
|
|
76
|
+
| `label` | `string` | `undefined` | Accessible label for screen readers |
|
|
77
|
+
|
|
78
|
+
## Types
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
import type { SpinnerProps } from "@baklavue/ui";
|
|
82
|
+
|
|
83
|
+
interface SpinnerProps {
|
|
84
|
+
size?: string;
|
|
85
|
+
variant?: string;
|
|
86
|
+
label?: string;
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Usage Notes
|
|
91
|
+
|
|
92
|
+
- **Accessibility**: Provide a `label` when the spinner is the primary indicator of loading state so screen readers can announce it. The label is set as `aria-label` on the spinner element.
|
|
93
|
+
- **Sizing**: Use Baklava CSS variables (`--bl-font-size-s`, `--bl-font-size-m`, `--bl-font-size-l`) for consistent sizing with the design system.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Split Button
|
|
2
|
+
|
|
3
|
+
A Vue UI kit component for Baklava's `bl-split-button` web component for buttons with a primary action and a dropdown for secondary actions. Dropdown content is provided via the `dropdown-content` slot.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
<div class="component-demo">
|
|
8
|
+
|
|
9
|
+
<SplitButtonBasicDemo />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<template>
|
|
15
|
+
<BvSplitButton label="Actions" @click="handleClick">
|
|
16
|
+
<template #dropdown-content>
|
|
17
|
+
<bl-dropdown-item>Action 1</bl-dropdown-item>
|
|
18
|
+
<bl-dropdown-item>Action 2</bl-dropdown-item>
|
|
19
|
+
<bl-dropdown-item>Action 3</bl-dropdown-item>
|
|
20
|
+
</template>
|
|
21
|
+
</BvSplitButton>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script setup>
|
|
25
|
+
import { BvSplitButton } from "@baklavue/ui";
|
|
26
|
+
|
|
27
|
+
const handleClick = () => {
|
|
28
|
+
console.log("Main button clicked");
|
|
29
|
+
};
|
|
30
|
+
</script>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## With Icon
|
|
34
|
+
|
|
35
|
+
Add an icon to the main button using the `icon` prop.
|
|
36
|
+
|
|
37
|
+
<div class="component-demo">
|
|
38
|
+
|
|
39
|
+
<SplitButtonWithIconDemo />
|
|
40
|
+
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
```vue
|
|
44
|
+
<template>
|
|
45
|
+
<BvSplitButton
|
|
46
|
+
label="Save"
|
|
47
|
+
icon="check"
|
|
48
|
+
variant="primary"
|
|
49
|
+
@click="handleSave"
|
|
50
|
+
>
|
|
51
|
+
<template #dropdown-content>
|
|
52
|
+
<bl-dropdown-item>Save as draft</bl-dropdown-item>
|
|
53
|
+
<bl-dropdown-item>Save and publish</bl-dropdown-item>
|
|
54
|
+
</template>
|
|
55
|
+
</BvSplitButton>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<script setup>
|
|
59
|
+
import { BvSplitButton } from "@baklavue/ui";
|
|
60
|
+
|
|
61
|
+
const handleSave = () => {
|
|
62
|
+
console.log("Save clicked");
|
|
63
|
+
};
|
|
64
|
+
</script>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## With Dropdown Content
|
|
68
|
+
|
|
69
|
+
Use the `#dropdown-content` slot to provide custom dropdown items. Each item should be a `bl-dropdown-item` element.
|
|
70
|
+
|
|
71
|
+
<div class="component-demo">
|
|
72
|
+
|
|
73
|
+
<SplitButtonDropdownDemo />
|
|
74
|
+
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
```vue
|
|
78
|
+
<template>
|
|
79
|
+
<BvSplitButton label="More options" @click="handleMainClick">
|
|
80
|
+
<template #dropdown-content>
|
|
81
|
+
<bl-dropdown-item>Edit</bl-dropdown-item>
|
|
82
|
+
<bl-dropdown-item>Duplicate</bl-dropdown-item>
|
|
83
|
+
<bl-dropdown-item>Delete</bl-dropdown-item>
|
|
84
|
+
</template>
|
|
85
|
+
</BvSplitButton>
|
|
86
|
+
</template>
|
|
87
|
+
|
|
88
|
+
<script setup>
|
|
89
|
+
import { BvSplitButton } from "@baklavue/ui";
|
|
90
|
+
|
|
91
|
+
const handleMainClick = () => {
|
|
92
|
+
console.log("Main button clicked");
|
|
93
|
+
};
|
|
94
|
+
</script>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Loading State
|
|
98
|
+
|
|
99
|
+
Use the `loading` prop to show a loading indicator on the main button.
|
|
100
|
+
|
|
101
|
+
```vue
|
|
102
|
+
<template>
|
|
103
|
+
<BvSplitButton label="Saving..." :loading="isLoading" @click="save" />
|
|
104
|
+
</template>
|
|
105
|
+
|
|
106
|
+
<script setup>
|
|
107
|
+
import { ref } from "vue";
|
|
108
|
+
import { BvSplitButton } from "@baklavue/ui";
|
|
109
|
+
|
|
110
|
+
const isLoading = ref(false);
|
|
111
|
+
|
|
112
|
+
const save = async () => {
|
|
113
|
+
isLoading.value = true;
|
|
114
|
+
await doSave();
|
|
115
|
+
isLoading.value = false;
|
|
116
|
+
};
|
|
117
|
+
</script>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Props
|
|
121
|
+
|
|
122
|
+
| Prop | Type | Default | Description |
|
|
123
|
+
| ---------- | -------------- | ----------- | ------------------------------------ |
|
|
124
|
+
| `label` | `string` | `undefined` | Button label |
|
|
125
|
+
| `variant` | `string` | `undefined` | Button variant (`primary`, `secondary`) |
|
|
126
|
+
| `size` | `string` | `undefined` | Button size (`small`, `medium`, `large`) |
|
|
127
|
+
| `disabled` | `boolean` | `undefined` | Whether the main button is disabled |
|
|
128
|
+
| `loading` | `boolean` | `undefined` | Loading state of the main button |
|
|
129
|
+
| `icon` | `BaklavaIcon` | `undefined` | Icon name for the main button |
|
|
130
|
+
|
|
131
|
+
## Events
|
|
132
|
+
|
|
133
|
+
| Event | Payload | Description |
|
|
134
|
+
| ------------------- | ------------- | ------------------------------------ |
|
|
135
|
+
| `click` | `CustomEvent` | Emitted when the main button is clicked |
|
|
136
|
+
| `dropdown-click` | `CustomEvent` | Emitted when the dropdown button is clicked |
|
|
137
|
+
|
|
138
|
+
## Slots
|
|
139
|
+
|
|
140
|
+
| Slot | Description |
|
|
141
|
+
| ------------------ | --------------------------------------------- |
|
|
142
|
+
| `default` | Main button content (falls back to `label`) |
|
|
143
|
+
| `dropdown-content` | Content for the dropdown (e.g. bl-dropdown-item elements) |
|
|
144
|
+
|
|
145
|
+
## Types
|
|
146
|
+
|
|
147
|
+
```typescript
|
|
148
|
+
import type { SplitButtonProps } from "@baklavue/ui";
|
|
149
|
+
import type { BaklavaIcon } from "@trendyol/baklava-icons";
|
|
150
|
+
|
|
151
|
+
interface SplitButtonProps {
|
|
152
|
+
variant?: string;
|
|
153
|
+
size?: string;
|
|
154
|
+
disabled?: boolean;
|
|
155
|
+
loading?: boolean;
|
|
156
|
+
label?: string;
|
|
157
|
+
icon?: BaklavaIcon;
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Usage Notes
|
|
162
|
+
|
|
163
|
+
- **Dropdown content**: Dropdown items must be `bl-dropdown-item` elements. Place them in the `#dropdown-content` slot.
|
|
164
|
+
- **No options prop**: The Split Button does not accept an `options` array; use the slot for dropdown content.
|
|
165
|
+
- **Accessibility**: The component follows Baklava's accessibility guidelines. Ensure dropdown items have clear, actionable labels.
|