@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,337 @@
|
|
|
1
|
+
# Stepper
|
|
2
|
+
|
|
3
|
+
A Vue UI kit component for Baklava's `bl-stepper` web component for step indicators. Displays progress through a sequence of steps. Use the `steps` prop for declarative configuration or the default slot for custom step content.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
<div class="component-demo">
|
|
8
|
+
|
|
9
|
+
<StepperBasicDemo />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<template>
|
|
15
|
+
<div>
|
|
16
|
+
<p>Current step: {{ currentStep + 1 }}</p>
|
|
17
|
+
<BvStepper v-model:current-step="currentStep" :steps="steps" />
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup>
|
|
22
|
+
import { ref } from "vue";
|
|
23
|
+
import { BvStepper } from "@baklavue/ui";
|
|
24
|
+
|
|
25
|
+
const currentStep = ref(0);
|
|
26
|
+
const steps = [{ label: "Step 1" }, { label: "Step 2" }, { label: "Step 3" }];
|
|
27
|
+
</script>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## With Steps Prop
|
|
31
|
+
|
|
32
|
+
Use the `steps` prop with objects to define labels, completed state, and disabled state for each step.
|
|
33
|
+
|
|
34
|
+
<div class="component-demo">
|
|
35
|
+
|
|
36
|
+
<StepperWithStepsDemo />
|
|
37
|
+
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
```vue
|
|
41
|
+
<template>
|
|
42
|
+
<BvStepper v-model:current-step="currentStep" :steps="steps" />
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script setup>
|
|
46
|
+
import { ref } from "vue";
|
|
47
|
+
import { BvStepper } from "@baklavue/ui";
|
|
48
|
+
|
|
49
|
+
const currentStep = ref(1);
|
|
50
|
+
const steps = [
|
|
51
|
+
{ label: "Account", completed: true },
|
|
52
|
+
{ label: "Profile", completed: false },
|
|
53
|
+
{ label: "Preferences", completed: false },
|
|
54
|
+
{ label: "Review", completed: false },
|
|
55
|
+
];
|
|
56
|
+
</script>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## With Descriptions
|
|
60
|
+
|
|
61
|
+
Add optional descriptions to each step for additional context.
|
|
62
|
+
|
|
63
|
+
<div class="component-demo">
|
|
64
|
+
|
|
65
|
+
<StepperDescriptionDemo />
|
|
66
|
+
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
```vue
|
|
70
|
+
<template>
|
|
71
|
+
<BvStepper v-model:current-step="currentStep" :steps="steps" />
|
|
72
|
+
</template>
|
|
73
|
+
|
|
74
|
+
<script setup>
|
|
75
|
+
import { ref } from "vue";
|
|
76
|
+
import { BvStepper } from "@baklavue/ui";
|
|
77
|
+
|
|
78
|
+
const currentStep = ref(1);
|
|
79
|
+
const steps = [
|
|
80
|
+
{ label: "Account", description: "Create your account" },
|
|
81
|
+
{ label: "Profile", description: "Add your details" },
|
|
82
|
+
{ label: "Preferences", description: "Set your preferences" },
|
|
83
|
+
{ label: "Review", description: "Review and submit" },
|
|
84
|
+
];
|
|
85
|
+
</script>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Disabled Steps
|
|
89
|
+
|
|
90
|
+
Disable specific steps to prevent users from navigating to them. Disabled steps are not clickable.
|
|
91
|
+
|
|
92
|
+
<div class="component-demo">
|
|
93
|
+
|
|
94
|
+
<StepperDisabledDemo />
|
|
95
|
+
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
```vue
|
|
99
|
+
<template>
|
|
100
|
+
<BvStepper v-model:current-step="currentStep" :steps="steps" />
|
|
101
|
+
</template>
|
|
102
|
+
|
|
103
|
+
<script setup>
|
|
104
|
+
import { ref } from "vue";
|
|
105
|
+
import { BvStepper } from "@baklavue/ui";
|
|
106
|
+
|
|
107
|
+
const currentStep = ref(1);
|
|
108
|
+
const steps = [
|
|
109
|
+
{ label: "Step 1" },
|
|
110
|
+
{ label: "Step 2", disabled: true },
|
|
111
|
+
{ label: "Step 3" },
|
|
112
|
+
{ label: "Step 4", disabled: true },
|
|
113
|
+
];
|
|
114
|
+
</script>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Error State
|
|
118
|
+
|
|
119
|
+
Mark a step with an error state to indicate validation failures or issues that need attention.
|
|
120
|
+
|
|
121
|
+
<div class="component-demo">
|
|
122
|
+
|
|
123
|
+
<StepperErrorDemo />
|
|
124
|
+
|
|
125
|
+
</div>
|
|
126
|
+
|
|
127
|
+
```vue
|
|
128
|
+
<template>
|
|
129
|
+
<BvStepper v-model:current-step="currentStep" :steps="steps" />
|
|
130
|
+
</template>
|
|
131
|
+
|
|
132
|
+
<script setup>
|
|
133
|
+
import { ref } from "vue";
|
|
134
|
+
import { BvStepper } from "@baklavue/ui";
|
|
135
|
+
|
|
136
|
+
const currentStep = ref(1);
|
|
137
|
+
const steps = [
|
|
138
|
+
{ label: "Account", description: "Account created" },
|
|
139
|
+
{ label: "Validation", description: "Please fix errors", error: true },
|
|
140
|
+
{ label: "Review", description: "Final review" },
|
|
141
|
+
];
|
|
142
|
+
</script>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Without Labels
|
|
146
|
+
|
|
147
|
+
Hide step labels to show only the step indicators (dots). Useful for compact layouts.
|
|
148
|
+
|
|
149
|
+
<div class="component-demo">
|
|
150
|
+
|
|
151
|
+
<StepperNoLabelsDemo />
|
|
152
|
+
|
|
153
|
+
</div>
|
|
154
|
+
|
|
155
|
+
```vue
|
|
156
|
+
<template>
|
|
157
|
+
<BvStepper v-model:current-step="currentStep" :steps="steps" :show-labels="false" />
|
|
158
|
+
</template>
|
|
159
|
+
|
|
160
|
+
<script setup>
|
|
161
|
+
import { ref } from "vue";
|
|
162
|
+
import { BvStepper } from "@baklavue/ui";
|
|
163
|
+
|
|
164
|
+
const currentStep = ref(1);
|
|
165
|
+
const steps = [
|
|
166
|
+
{ label: "Step 1" },
|
|
167
|
+
{ label: "Step 2" },
|
|
168
|
+
{ label: "Step 3" },
|
|
169
|
+
{ label: "Step 4" },
|
|
170
|
+
];
|
|
171
|
+
</script>
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## Step Change Event
|
|
175
|
+
|
|
176
|
+
Listen to the `step-change` event to react when the user selects a different step.
|
|
177
|
+
|
|
178
|
+
<div class="component-demo">
|
|
179
|
+
|
|
180
|
+
<StepperChangeEventDemo />
|
|
181
|
+
|
|
182
|
+
</div>
|
|
183
|
+
|
|
184
|
+
```vue
|
|
185
|
+
<template>
|
|
186
|
+
<BvStepper
|
|
187
|
+
v-model:current-step="currentStep"
|
|
188
|
+
:steps="steps"
|
|
189
|
+
@step-change="onStepChange"
|
|
190
|
+
/>
|
|
191
|
+
</template>
|
|
192
|
+
|
|
193
|
+
<script setup>
|
|
194
|
+
import { ref } from "vue";
|
|
195
|
+
import { BvStepper } from "@baklavue/ui";
|
|
196
|
+
|
|
197
|
+
const currentStep = ref(0);
|
|
198
|
+
const steps = [{ label: "Step 1" }, { label: "Step 2" }, { label: "Step 3" }];
|
|
199
|
+
|
|
200
|
+
const onStepChange = (event) => {
|
|
201
|
+
const { activeStep, totalSteps } = event.detail || {};
|
|
202
|
+
console.log(`Step ${activeStep + 1} of ${totalSteps} selected`);
|
|
203
|
+
};
|
|
204
|
+
</script>
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Form Wizard
|
|
208
|
+
|
|
209
|
+
Use the stepper with Back/Next buttons for a multi-step form or wizard flow.
|
|
210
|
+
|
|
211
|
+
<div class="component-demo">
|
|
212
|
+
|
|
213
|
+
<StepperFormWizardDemo />
|
|
214
|
+
|
|
215
|
+
</div>
|
|
216
|
+
|
|
217
|
+
```vue
|
|
218
|
+
<template>
|
|
219
|
+
<div>
|
|
220
|
+
<BvStepper v-model:current-step="currentStep" :steps="steps" />
|
|
221
|
+
<div style="margin-top: 1.5rem;">
|
|
222
|
+
<!-- Step content here -->
|
|
223
|
+
<BvButton variant="tertiary" :disabled="currentStep === 0" @click="goBack">
|
|
224
|
+
Back
|
|
225
|
+
</BvButton>
|
|
226
|
+
<BvButton variant="primary" @click="goNext">
|
|
227
|
+
{{ currentStep === steps.length - 1 ? "Submit" : "Next" }}
|
|
228
|
+
</BvButton>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
</template>
|
|
232
|
+
|
|
233
|
+
<script setup>
|
|
234
|
+
import { ref } from "vue";
|
|
235
|
+
import { BvButton, BvStepper } from "@baklavue/ui";
|
|
236
|
+
|
|
237
|
+
const currentStep = ref(0);
|
|
238
|
+
const steps = [
|
|
239
|
+
{ label: "Personal", description: "Your details" },
|
|
240
|
+
{ label: "Address", description: "Where you live" },
|
|
241
|
+
{ label: "Confirm", description: "Review & submit" },
|
|
242
|
+
];
|
|
243
|
+
|
|
244
|
+
const goNext = () => {
|
|
245
|
+
if (currentStep.value < steps.length - 1) currentStep.value++;
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const goBack = () => {
|
|
249
|
+
if (currentStep.value > 0) currentStep.value--;
|
|
250
|
+
};
|
|
251
|
+
</script>
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Orientation
|
|
255
|
+
|
|
256
|
+
Control the stepper layout with the `orientation` prop.
|
|
257
|
+
|
|
258
|
+
<div class="component-demo">
|
|
259
|
+
|
|
260
|
+
<StepperOrientationDemo />
|
|
261
|
+
|
|
262
|
+
</div>
|
|
263
|
+
|
|
264
|
+
```vue
|
|
265
|
+
<template>
|
|
266
|
+
<div>
|
|
267
|
+
<BvStepper
|
|
268
|
+
v-model:current-step="currentStep"
|
|
269
|
+
:steps="steps"
|
|
270
|
+
orientation="horizontal"
|
|
271
|
+
/>
|
|
272
|
+
<BvStepper
|
|
273
|
+
v-model:current-step="currentStep"
|
|
274
|
+
:steps="steps"
|
|
275
|
+
orientation="vertical"
|
|
276
|
+
/>
|
|
277
|
+
</div>
|
|
278
|
+
</template>
|
|
279
|
+
|
|
280
|
+
<script setup>
|
|
281
|
+
import { ref } from "vue";
|
|
282
|
+
import { BvStepper } from "@baklavue/ui";
|
|
283
|
+
|
|
284
|
+
const currentStep = ref(0);
|
|
285
|
+
const steps = [{ label: "Step 1" }, { label: "Step 2" }, { label: "Step 3" }];
|
|
286
|
+
</script>
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## Props
|
|
290
|
+
|
|
291
|
+
| Prop | Type | Default | Description |
|
|
292
|
+
| ------------- | --------------------------------------------------------------- | ----------- | ------------------------------------------------- |
|
|
293
|
+
| `currentStep` | `number` | `undefined` | Current step index (use with v-model:currentStep) |
|
|
294
|
+
| `steps` | `Array<{ label, description?, completed?, error?, disabled? }>` | `undefined` | Array of step configurations |
|
|
295
|
+
| `orientation` | `string` | `undefined` | Layout direction (`horizontal`, `vertical`) |
|
|
296
|
+
| `showLabels` | `boolean` | `undefined` | Whether to show step labels |
|
|
297
|
+
|
|
298
|
+
## Events
|
|
299
|
+
|
|
300
|
+
| Event | Payload | Description |
|
|
301
|
+
| -------------------- | ------------- | ----------------------------------------------- |
|
|
302
|
+
| `update:currentStep` | `number` | Emitted when the current step changes (v-model) |
|
|
303
|
+
| `step-change` | `CustomEvent` | Emitted when the user selects a different step |
|
|
304
|
+
|
|
305
|
+
## Slots
|
|
306
|
+
|
|
307
|
+
| Slot | Description |
|
|
308
|
+
| --------- | ----------------------------------------------------- |
|
|
309
|
+
| `default` | Custom step content (use when not using `steps` prop) |
|
|
310
|
+
|
|
311
|
+
## Types
|
|
312
|
+
|
|
313
|
+
```typescript
|
|
314
|
+
import type { StepperProps } from "@baklavue/ui";
|
|
315
|
+
|
|
316
|
+
interface StepperStep {
|
|
317
|
+
label: string;
|
|
318
|
+
description?: string;
|
|
319
|
+
completed?: boolean;
|
|
320
|
+
error?: boolean;
|
|
321
|
+
disabled?: boolean;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
interface StepperProps {
|
|
325
|
+
currentStep?: number;
|
|
326
|
+
steps?: StepperStep[];
|
|
327
|
+
orientation?: string;
|
|
328
|
+
showLabels?: boolean;
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Usage Notes
|
|
333
|
+
|
|
334
|
+
- **v-model:currentStep**: Use `v-model:current-step` for two-way binding of the current step index.
|
|
335
|
+
- **Steps vs Slot**: When using the `steps` prop, steps are rendered as `bl-stepper-item` elements. Use the default slot for fully custom step markup.
|
|
336
|
+
- **Orientation**: The `orientation` prop maps to Baklava's `direction` attribute (`horizontal` | `vertical`).
|
|
337
|
+
- **Accessibility**: The component follows Baklava's accessibility guidelines for step navigation.
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Switch
|
|
2
|
+
|
|
3
|
+
A Vue UI kit component for Baklava's `bl-switch` web component with v-model support. A toggle switch for boolean states. Use `v-model:checked` for two-way binding.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
<div class="component-demo">
|
|
8
|
+
|
|
9
|
+
<SwitchBasicDemo />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
```vue
|
|
14
|
+
<template>
|
|
15
|
+
<div>
|
|
16
|
+
<p>Notifications: {{ enabled ? "On" : "Off" }}</p>
|
|
17
|
+
<BvSwitch v-model:checked="enabled" label="Enable notifications" />
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script setup>
|
|
22
|
+
import { ref } from "vue";
|
|
23
|
+
import { BvSwitch } from "@baklavue/ui";
|
|
24
|
+
|
|
25
|
+
const enabled = ref(false);
|
|
26
|
+
</script>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Disabled State
|
|
30
|
+
|
|
31
|
+
Disable the switch to prevent user interaction.
|
|
32
|
+
|
|
33
|
+
<div class="component-demo">
|
|
34
|
+
|
|
35
|
+
<SwitchDisabledDemo />
|
|
36
|
+
|
|
37
|
+
</div>
|
|
38
|
+
|
|
39
|
+
```vue
|
|
40
|
+
<template>
|
|
41
|
+
<BvSwitch :checked="true" :disabled="true" label="Disabled (checked)" />
|
|
42
|
+
<BvSwitch :checked="false" :disabled="true" label="Disabled (unchecked)" />
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script setup>
|
|
46
|
+
import { BvSwitch } from "@baklavue/ui";
|
|
47
|
+
</script>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Sizes
|
|
51
|
+
|
|
52
|
+
Control the switch size using the `size` prop.
|
|
53
|
+
|
|
54
|
+
<div class="component-demo">
|
|
55
|
+
|
|
56
|
+
<SwitchSizesDemo />
|
|
57
|
+
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
```vue
|
|
61
|
+
<template>
|
|
62
|
+
<div style="display: flex; flex-direction: column; gap: 1rem;">
|
|
63
|
+
<BvSwitch v-model:checked="small" size="small" label="Small" />
|
|
64
|
+
<BvSwitch v-model:checked="medium" size="medium" label="Medium" />
|
|
65
|
+
<BvSwitch v-model:checked="large" size="large" label="Large" />
|
|
66
|
+
</div>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script setup>
|
|
70
|
+
import { ref } from "vue";
|
|
71
|
+
import { BvSwitch } from "@baklavue/ui";
|
|
72
|
+
|
|
73
|
+
const small = ref(false);
|
|
74
|
+
const medium = ref(false);
|
|
75
|
+
const large = ref(false);
|
|
76
|
+
</script>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## Multiple Switches
|
|
80
|
+
|
|
81
|
+
Use multiple switches for settings or preferences.
|
|
82
|
+
|
|
83
|
+
```vue
|
|
84
|
+
<template>
|
|
85
|
+
<div>
|
|
86
|
+
<BvSwitch v-model:checked="settings.email" label="Email notifications" />
|
|
87
|
+
<BvSwitch v-model:checked="settings.sms" label="SMS notifications" />
|
|
88
|
+
<BvSwitch v-model:checked="settings.push" label="Push notifications" />
|
|
89
|
+
</div>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<script setup>
|
|
93
|
+
import { reactive } from "vue";
|
|
94
|
+
import { BvSwitch } from "@baklavue/ui";
|
|
95
|
+
|
|
96
|
+
const settings = reactive({
|
|
97
|
+
email: true,
|
|
98
|
+
sms: false,
|
|
99
|
+
push: true,
|
|
100
|
+
});
|
|
101
|
+
</script>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Props
|
|
105
|
+
|
|
106
|
+
| Prop | Type | Default | Description |
|
|
107
|
+
| ---------- | --------- | ----------- | ---------------------------------- |
|
|
108
|
+
| `checked` | `boolean` | `undefined` | Checked state (use with v-model:checked) |
|
|
109
|
+
| `disabled` | `boolean` | `undefined` | Whether the switch is disabled |
|
|
110
|
+
| `label` | `string` | `undefined` | Label for the switch |
|
|
111
|
+
| `size` | `string` | `undefined` | Switch size (`small`, `medium`, `large`) |
|
|
112
|
+
|
|
113
|
+
## Events
|
|
114
|
+
|
|
115
|
+
| Event | Payload | Description |
|
|
116
|
+
| ----------------- | ------------- | ---------------------------------------- |
|
|
117
|
+
| `update:checked` | `boolean` | Emitted when checked state changes (v-model) |
|
|
118
|
+
| `change` | `CustomEvent` | Emitted when the user toggles the switch |
|
|
119
|
+
| `input` | `CustomEvent` | Emitted on user input (mirrors native) |
|
|
120
|
+
|
|
121
|
+
## Slots
|
|
122
|
+
|
|
123
|
+
| Slot | Description |
|
|
124
|
+
| --------- | ---------------------------------------- |
|
|
125
|
+
| `default` | Switch label (falls back to `label` prop) |
|
|
126
|
+
|
|
127
|
+
## Types
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
import type { SwitchProps } from "@baklavue/ui";
|
|
131
|
+
|
|
132
|
+
interface SwitchProps {
|
|
133
|
+
checked?: boolean;
|
|
134
|
+
disabled?: boolean;
|
|
135
|
+
label?: string;
|
|
136
|
+
size?: string;
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## Usage Notes
|
|
141
|
+
|
|
142
|
+
- **v-model:checked**: Use `v-model:checked` for two-way binding of the toggle state.
|
|
143
|
+
- **Accessibility**: The `label` prop or default slot provides accessible text for the switch.
|
|
144
|
+
- **Styling**: Custom colors can be applied via CSS variables (`--bl-switch-color-on`, `--bl-switch-color-off`, `--bl-switch-animation-duration`).
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# Tab
|
|
2
|
+
|
|
3
|
+
A Vue UI kit component for Baklava's `bl-tabs` (bl-tab-group / bl-tab / bl-tab-panel) components for tab navigation. Use the `tabs` prop for declarative configuration or the default slot for custom tab content and panels.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
Use the `tabs` prop with `v-model:activeTab` for two-way binding of the active tab.
|
|
8
|
+
|
|
9
|
+
<div class="component-demo">
|
|
10
|
+
|
|
11
|
+
<TabBasicDemo />
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<template>
|
|
17
|
+
<div>
|
|
18
|
+
<p>Active tab: {{ activeTab }}</p>
|
|
19
|
+
<BvTab v-model:activeTab="activeTab" :tabs="tabs">
|
|
20
|
+
<div v-if="activeTab === 'tab1'">Content for Tab 1</div>
|
|
21
|
+
<div v-if="activeTab === 'tab2'">Content for Tab 2</div>
|
|
22
|
+
<div v-if="activeTab === 'tab3'">Content for Tab 3</div>
|
|
23
|
+
</BvTab>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script setup>
|
|
28
|
+
import { ref } from "vue";
|
|
29
|
+
import { BvTab } from "@baklavue/ui";
|
|
30
|
+
|
|
31
|
+
const activeTab = ref("tab1");
|
|
32
|
+
const tabs = [
|
|
33
|
+
{ label: "Tab 1", value: "tab1" },
|
|
34
|
+
{ label: "Tab 2", value: "tab2" },
|
|
35
|
+
{ label: "Tab 3", value: "tab3" },
|
|
36
|
+
];
|
|
37
|
+
</script>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## With Slots
|
|
41
|
+
|
|
42
|
+
Use the default slot to provide panel content. Match `v-if` conditions to the tab `value` to show the correct content.
|
|
43
|
+
|
|
44
|
+
<div class="component-demo">
|
|
45
|
+
|
|
46
|
+
<TabWithSlotsDemo />
|
|
47
|
+
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
```vue
|
|
51
|
+
<template>
|
|
52
|
+
<BvTab v-model:activeTab="activeTab" :tabs="tabOptions">
|
|
53
|
+
<div v-if="activeTab === 'overview'">Overview content</div>
|
|
54
|
+
<div v-if="activeTab === 'profile'">Profile content</div>
|
|
55
|
+
<div v-if="activeTab === 'settings'">Settings content</div>
|
|
56
|
+
</BvTab>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script setup>
|
|
60
|
+
import { ref } from "vue";
|
|
61
|
+
import { BvTab } from "@baklavue/ui";
|
|
62
|
+
|
|
63
|
+
const activeTab = ref("profile");
|
|
64
|
+
const tabOptions = [
|
|
65
|
+
{ label: "Overview", value: "overview" },
|
|
66
|
+
{ label: "Profile", value: "profile" },
|
|
67
|
+
{ label: "Settings", value: "settings" },
|
|
68
|
+
];
|
|
69
|
+
</script>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Disabled Tabs
|
|
73
|
+
|
|
74
|
+
Disable specific tabs by setting `disabled: true` in the tab option.
|
|
75
|
+
|
|
76
|
+
```vue
|
|
77
|
+
<template>
|
|
78
|
+
<BvTab v-model:activeTab="activeTab" :tabs="[
|
|
79
|
+
{ label: 'Enabled', value: 'enabled' },
|
|
80
|
+
{ label: 'Disabled', value: 'disabled', disabled: true },
|
|
81
|
+
]">
|
|
82
|
+
<div v-if="activeTab === 'enabled'">Enabled content</div>
|
|
83
|
+
<div v-if="activeTab === 'disabled'">Disabled content</div>
|
|
84
|
+
</BvTab>
|
|
85
|
+
</template>
|
|
86
|
+
|
|
87
|
+
<script setup>
|
|
88
|
+
import { ref } from "vue";
|
|
89
|
+
import { BvTab } from "@baklavue/ui";
|
|
90
|
+
|
|
91
|
+
const activeTab = ref("enabled");
|
|
92
|
+
</script>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Props
|
|
96
|
+
|
|
97
|
+
| Prop | Type | Default | Description |
|
|
98
|
+
| ------------ | ------------- | ----------- | -------------------------------------------------- |
|
|
99
|
+
| `activeTab` | `string` | `undefined` | Currently active tab value (use with v-model:activeTab) |
|
|
100
|
+
| `tabs` | `TabOption[]` | `undefined` | Array of tab options. When provided, tabs are rendered from this array. |
|
|
101
|
+
| `variant` | `string` | `undefined` | Tab variant (passed to bl-tabs) |
|
|
102
|
+
| `orientation`| `string` | `undefined` | Tab orientation: horizontal or vertical |
|
|
103
|
+
|
|
104
|
+
## Events
|
|
105
|
+
|
|
106
|
+
| Event | Payload | Description |
|
|
107
|
+
| ------------------- | ---------- | ------------------------------------------------- |
|
|
108
|
+
| `update:activeTab` | `string` | Emitted when the active tab changes (v-model) |
|
|
109
|
+
| `tab-change` | `CustomEvent` | Emitted when tab selection changes (raw event) |
|
|
110
|
+
|
|
111
|
+
## Slots
|
|
112
|
+
|
|
113
|
+
| Slot | Description |
|
|
114
|
+
| --------- | -------------------------------------------------------- |
|
|
115
|
+
| `default` | Panel content. Use v-if to show content per active tab. |
|
|
116
|
+
|
|
117
|
+
## Types
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
import type { TabProps, TabOption } from "@baklavue/ui";
|
|
121
|
+
|
|
122
|
+
interface TabOption {
|
|
123
|
+
label: string;
|
|
124
|
+
value: string;
|
|
125
|
+
disabled?: boolean;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
interface TabProps {
|
|
129
|
+
activeTab?: string;
|
|
130
|
+
tabs?: TabOption[];
|
|
131
|
+
variant?: string;
|
|
132
|
+
orientation?: string;
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Usage Notes
|
|
137
|
+
|
|
138
|
+
- **tabs prop**: When `tabs` is provided, the component renders a `bl-tab` for each item. Content for each panel is provided via the default slot; use `v-if="activeTab === 'value'"` to show the correct panel.
|
|
139
|
+
- **v-model:activeTab**: Use `v-model:activeTab` for two-way binding of the active tab value.
|
|
140
|
+
- **Accessibility**: The component follows Baklava's accessibility guidelines for tab navigation.
|