@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,188 @@
|
|
|
1
|
+
# Drawer
|
|
2
|
+
|
|
3
|
+
A Vue UI kit component for Baklava's `bl-drawer` component for side drawers. The Drawer component provides a slide-in panel for supplemental content with support for caption, embedded iframe content, external link, and programmable width. The underlying bl-drawer has a fixed header with title and close button; content is provided via the default slot or an iframe when using `embedUrl`.
|
|
4
|
+
|
|
5
|
+
## Basic Usage
|
|
6
|
+
|
|
7
|
+
Use `v-model:open` for two-way binding. Trigger the drawer with a button.
|
|
8
|
+
|
|
9
|
+
<div class="component-demo">
|
|
10
|
+
|
|
11
|
+
<DrawerBasicDemo />
|
|
12
|
+
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<template>
|
|
17
|
+
<div>
|
|
18
|
+
<BvButton @click="showDrawer = true">Open Drawer</BvButton>
|
|
19
|
+
<BvDrawer v-model:open="showDrawer">
|
|
20
|
+
<p>Drawer content goes here.</p>
|
|
21
|
+
</BvDrawer>
|
|
22
|
+
</div>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script setup>
|
|
26
|
+
import { ref } from "vue";
|
|
27
|
+
import { BvDrawer, BvButton } from "@baklavue/ui";
|
|
28
|
+
|
|
29
|
+
const showDrawer = ref(false);
|
|
30
|
+
</script>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Caption
|
|
34
|
+
|
|
35
|
+
Use the `caption` prop for the drawer title. This maps to Baklava's `bl-drawer` caption attribute.
|
|
36
|
+
|
|
37
|
+
<div class="component-demo">
|
|
38
|
+
|
|
39
|
+
<DrawerCaptionDemo />
|
|
40
|
+
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
```vue
|
|
44
|
+
<template>
|
|
45
|
+
<div>
|
|
46
|
+
<BvButton @click="showDrawer = true">Open Drawer</BvButton>
|
|
47
|
+
<BvDrawer v-model:open="showDrawer" caption="Drawer Title">
|
|
48
|
+
<p>Use the caption prop for the drawer title.</p>
|
|
49
|
+
</BvDrawer>
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|
|
52
|
+
|
|
53
|
+
<script setup>
|
|
54
|
+
import { ref } from "vue";
|
|
55
|
+
import { BvDrawer, BvButton } from "@baklavue/ui";
|
|
56
|
+
|
|
57
|
+
const showDrawer = ref(false);
|
|
58
|
+
</script>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Width
|
|
62
|
+
|
|
63
|
+
Use the `width` prop to control the drawer width. Accepts `"small"` (320px), `"medium"` (424px, default), `"large"` (560px), or a custom CSS value (e.g. `"500px"`).
|
|
64
|
+
|
|
65
|
+
```vue
|
|
66
|
+
<template>
|
|
67
|
+
<BvDrawer v-model:open="showDrawer" width="large" caption="Wide Drawer">
|
|
68
|
+
<p>Wider drawer content.</p>
|
|
69
|
+
</BvDrawer>
|
|
70
|
+
</template>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Embed URL
|
|
74
|
+
|
|
75
|
+
When you need to display external content in an iframe, use the `embedUrl` prop. The drawer will render an iframe instead of the default slot content.
|
|
76
|
+
|
|
77
|
+
```vue
|
|
78
|
+
<template>
|
|
79
|
+
<BvDrawer v-model:open="showDrawer" embed-url="https://example.com" />
|
|
80
|
+
</template>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## External Link
|
|
84
|
+
|
|
85
|
+
Use the `externalLink` prop to add a button in the drawer header that opens a URL in a new tab.
|
|
86
|
+
|
|
87
|
+
```vue
|
|
88
|
+
<template>
|
|
89
|
+
<BvDrawer
|
|
90
|
+
v-model:open="showDrawer"
|
|
91
|
+
caption="Documentation"
|
|
92
|
+
external-link="https://docs.example.com"
|
|
93
|
+
>
|
|
94
|
+
<p>Drawer content with external link in header.</p>
|
|
95
|
+
</BvDrawer>
|
|
96
|
+
</template>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Programmatic Control
|
|
100
|
+
|
|
101
|
+
Access drawer methods programmatically using template refs. Call `open()` to show the drawer and `close()` to hide it.
|
|
102
|
+
|
|
103
|
+
<div class="component-demo">
|
|
104
|
+
|
|
105
|
+
<DrawerProgrammaticDemo />
|
|
106
|
+
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
```vue
|
|
110
|
+
<template>
|
|
111
|
+
<div>
|
|
112
|
+
<div style="margin-bottom: 1rem; display: flex; gap: 0.5rem;">
|
|
113
|
+
<BvButton @click="drawerRef?.open()">Open</BvButton>
|
|
114
|
+
<BvButton @click="drawerRef?.close()">Close</BvButton>
|
|
115
|
+
</div>
|
|
116
|
+
<BvDrawer ref="drawerRef" caption="Programmatically Controlled">
|
|
117
|
+
<p>
|
|
118
|
+
This drawer can be opened and closed via button clicks or
|
|
119
|
+
programmatically.
|
|
120
|
+
</p>
|
|
121
|
+
</BvDrawer>
|
|
122
|
+
</div>
|
|
123
|
+
</template>
|
|
124
|
+
|
|
125
|
+
<script setup>
|
|
126
|
+
import { ref } from "vue";
|
|
127
|
+
import { BvDrawer, BvButton } from "@baklavue/ui";
|
|
128
|
+
|
|
129
|
+
const drawerRef = ref();
|
|
130
|
+
</script>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Props
|
|
134
|
+
|
|
135
|
+
| Prop | Type | Default | Description |
|
|
136
|
+
| -------------- | --------- | ----------- | ------------------------------------------------------------------------------ |
|
|
137
|
+
| `open` | `boolean` | `false` | Whether the drawer is visible (use with `v-model:open`) |
|
|
138
|
+
| `caption` | `string` | `undefined` | Drawer title. Maps to bl-drawer's caption attribute |
|
|
139
|
+
| `embedUrl` | `string` | `undefined` | Iframe URL for embedded content. When set, drawer shows iframe instead of slot |
|
|
140
|
+
| `externalLink` | `string` | `undefined` | External link URL - adds a button in the header |
|
|
141
|
+
| `width` | `string` | `undefined` | Drawer width (`"small"`, `"medium"`, `"large"` or custom CSS value) |
|
|
142
|
+
|
|
143
|
+
## Events
|
|
144
|
+
|
|
145
|
+
| Event | Payload | Description |
|
|
146
|
+
| ------------- | --------- | --------------------------------------------------------- |
|
|
147
|
+
| `update:open` | `boolean` | Emitted when visibility changes. Use for two-way binding. |
|
|
148
|
+
| `open` | - | Emitted when the drawer is opened |
|
|
149
|
+
| `close` | - | Emitted when the drawer is closed |
|
|
150
|
+
|
|
151
|
+
## Methods
|
|
152
|
+
|
|
153
|
+
You can access these methods via template refs:
|
|
154
|
+
|
|
155
|
+
| Method | Description |
|
|
156
|
+
| --------- | ---------------------------------- |
|
|
157
|
+
| `open()` | Opens the drawer programmatically |
|
|
158
|
+
| `close()` | Closes the drawer programmatically |
|
|
159
|
+
|
|
160
|
+
## Slots
|
|
161
|
+
|
|
162
|
+
| Slot | Props | Description |
|
|
163
|
+
| --------- | ----- | ---------------------------------------------------- |
|
|
164
|
+
| `default` | - | Main drawer content. Ignored when `embedUrl` is set. |
|
|
165
|
+
|
|
166
|
+
## Types
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
import type { DrawerProps } from "@baklavue/ui";
|
|
170
|
+
|
|
171
|
+
interface DrawerProps {
|
|
172
|
+
open?: boolean;
|
|
173
|
+
caption?: string;
|
|
174
|
+
embedUrl?: string;
|
|
175
|
+
externalLink?: string;
|
|
176
|
+
width?: string;
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Usage Notes
|
|
181
|
+
|
|
182
|
+
- **Two-way binding**: Use `v-model:open` to control visibility. Alternatively, use a template ref and call `open()` / `close()`.
|
|
183
|
+
|
|
184
|
+
- **Slot vs embedUrl**: When `embedUrl` is set, the drawer uses an iframe instead of the default slot. The slot content is ignored in that case.
|
|
185
|
+
|
|
186
|
+
- **Accessibility**: The component follows Baklava's accessibility guidelines and includes proper ARIA attributes for screen readers.
|
|
187
|
+
|
|
188
|
+
- **Styling**: The component uses Baklava's default styling. Custom styling can be applied through CSS variables such as `--bl-drawer-animation-duration` (default: 250ms).
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# Dropdown
|
|
2
|
+
|
|
3
|
+
A Vue UI kit component for Baklava's `bl-dropdown`, `bl-dropdown-group`, and `bl-dropdown-item` components for dropdown menus. The Dropdown component can work in two modes: slot mode (custom content via default slot) or items mode (declarative menu items with optional grouping via `bl-dropdown-group`).
|
|
4
|
+
|
|
5
|
+
## Slot Mode
|
|
6
|
+
|
|
7
|
+
Use the Dropdown component without the `items` prop to provide custom content via the default slot. You can place `bl-dropdown-item` elements or other custom markup directly.
|
|
8
|
+
|
|
9
|
+
### Basic Slot Mode
|
|
10
|
+
|
|
11
|
+
<div class="component-demo">
|
|
12
|
+
|
|
13
|
+
<DropdownSlotDemo />
|
|
14
|
+
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
```vue
|
|
18
|
+
<template>
|
|
19
|
+
<BvDropdown label="Custom Content">
|
|
20
|
+
<bl-dropdown-item>Item 1</bl-dropdown-item>
|
|
21
|
+
<bl-dropdown-item>Item 2</bl-dropdown-item>
|
|
22
|
+
<bl-dropdown-item>Item 3</bl-dropdown-item>
|
|
23
|
+
</BvDropdown>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script setup>
|
|
27
|
+
import { BvDropdown } from "@baklavue/ui";
|
|
28
|
+
</script>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Items Mode
|
|
32
|
+
|
|
33
|
+
Use the Dropdown component with the `items` prop to create a declarative menu. Content for each item is provided via the `#item` scoped slot. Items can be grouped using the `groupCaption` property.
|
|
34
|
+
|
|
35
|
+
### Basic Items Example
|
|
36
|
+
|
|
37
|
+
<div class="component-demo">
|
|
38
|
+
|
|
39
|
+
<DropdownBasicDemo />
|
|
40
|
+
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
```vue
|
|
44
|
+
<template>
|
|
45
|
+
<BvDropdown label="Actions" :items="menuItems">
|
|
46
|
+
<template #item="{ item }">
|
|
47
|
+
{{ item.caption }}
|
|
48
|
+
</template>
|
|
49
|
+
</BvDropdown>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script setup>
|
|
53
|
+
import { BvDropdown } from "@baklavue/ui";
|
|
54
|
+
|
|
55
|
+
const menuItems = [
|
|
56
|
+
{ caption: "Edit" },
|
|
57
|
+
{ caption: "Duplicate" },
|
|
58
|
+
{ caption: "Delete" },
|
|
59
|
+
];
|
|
60
|
+
</script>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Items with Icons
|
|
64
|
+
|
|
65
|
+
Add icons to dropdown items using the `icon` prop on each item.
|
|
66
|
+
|
|
67
|
+
<div class="component-demo">
|
|
68
|
+
|
|
69
|
+
<DropdownItemsDemo />
|
|
70
|
+
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
```vue
|
|
74
|
+
<template>
|
|
75
|
+
<BvDropdown label="Menu" :items="menuItems">
|
|
76
|
+
<template #item="{ item }">
|
|
77
|
+
{{ item.caption }}
|
|
78
|
+
</template>
|
|
79
|
+
</BvDropdown>
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<script setup>
|
|
83
|
+
import { BvDropdown } from "@baklavue/ui";
|
|
84
|
+
|
|
85
|
+
const menuItems = [
|
|
86
|
+
{ caption: "Dashboard", icon: "dashboard" },
|
|
87
|
+
{ caption: "Settings", icon: "settings" },
|
|
88
|
+
{ caption: "Profile", icon: "user" },
|
|
89
|
+
];
|
|
90
|
+
</script>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Items with Groups
|
|
94
|
+
|
|
95
|
+
Use `groupCaption` on items to group them into `bl-dropdown-group` sections with captions.
|
|
96
|
+
|
|
97
|
+
<div class="component-demo">
|
|
98
|
+
|
|
99
|
+
<DropdownGroupDemo />
|
|
100
|
+
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
```vue
|
|
104
|
+
<template>
|
|
105
|
+
<BvDropdown label="Actions" :items="groupedItems">
|
|
106
|
+
<template #item="{ item }">
|
|
107
|
+
{{ item.caption }}
|
|
108
|
+
</template>
|
|
109
|
+
</BvDropdown>
|
|
110
|
+
</template>
|
|
111
|
+
|
|
112
|
+
<script setup>
|
|
113
|
+
import { BvDropdown } from "@baklavue/ui";
|
|
114
|
+
|
|
115
|
+
const groupedItems = [
|
|
116
|
+
{ caption: "New File", groupCaption: "File" },
|
|
117
|
+
{ caption: "Save", groupCaption: "File" },
|
|
118
|
+
{ caption: "Export", groupCaption: "File" },
|
|
119
|
+
{ caption: "Cut", groupCaption: "Edit" },
|
|
120
|
+
{ caption: "Copy", groupCaption: "Edit" },
|
|
121
|
+
{ caption: "Paste", groupCaption: "Edit" },
|
|
122
|
+
];
|
|
123
|
+
</script>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Disabled State
|
|
127
|
+
|
|
128
|
+
Disable the entire dropdown or individual items.
|
|
129
|
+
|
|
130
|
+
<div class="component-demo">
|
|
131
|
+
|
|
132
|
+
<DropdownDisabledDemo />
|
|
133
|
+
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
```vue
|
|
137
|
+
<template>
|
|
138
|
+
<BvDropdown label="Actions" :items="menuItems" :disabled="true">
|
|
139
|
+
<template #item="{ item }">
|
|
140
|
+
{{ item.caption }}
|
|
141
|
+
</template>
|
|
142
|
+
</BvDropdown>
|
|
143
|
+
</template>
|
|
144
|
+
|
|
145
|
+
<script setup>
|
|
146
|
+
import { BvDropdown } from "@baklavue/ui";
|
|
147
|
+
|
|
148
|
+
const menuItems = [
|
|
149
|
+
{ caption: "Enabled Item" },
|
|
150
|
+
{ caption: "Disabled Item", disabled: true },
|
|
151
|
+
{ caption: "Another Item" },
|
|
152
|
+
];
|
|
153
|
+
</script>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Programmatic Control
|
|
157
|
+
|
|
158
|
+
Access dropdown methods programmatically using template refs.
|
|
159
|
+
|
|
160
|
+
<div class="component-demo">
|
|
161
|
+
|
|
162
|
+
<DropdownProgrammaticDemo />
|
|
163
|
+
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
```vue
|
|
167
|
+
<template>
|
|
168
|
+
<div>
|
|
169
|
+
<div style="margin-bottom: 1rem; display: flex; gap: 0.5rem">
|
|
170
|
+
<BvButton @click="dropdownRef?.open()">Open</BvButton>
|
|
171
|
+
<BvButton @click="dropdownRef?.close()">Close</BvButton>
|
|
172
|
+
<BvButton @click="dropdownRef?.toggle()">Toggle</BvButton>
|
|
173
|
+
</div>
|
|
174
|
+
<BvDropdown ref="dropdownRef" label="Menu" :items="menuItems">
|
|
175
|
+
<template #item="{ item }">
|
|
176
|
+
{{ item.caption }}
|
|
177
|
+
</template>
|
|
178
|
+
</BvDropdown>
|
|
179
|
+
</div>
|
|
180
|
+
</template>
|
|
181
|
+
|
|
182
|
+
<script setup>
|
|
183
|
+
import { ref } from "vue";
|
|
184
|
+
import { BvDropdown, BvButton } from "@baklavue/ui";
|
|
185
|
+
|
|
186
|
+
const dropdownRef = ref();
|
|
187
|
+
const menuItems = [
|
|
188
|
+
{ caption: "Option 1" },
|
|
189
|
+
{ caption: "Option 2" },
|
|
190
|
+
{ caption: "Option 3" },
|
|
191
|
+
];
|
|
192
|
+
</script>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Props
|
|
196
|
+
|
|
197
|
+
### Common Props
|
|
198
|
+
|
|
199
|
+
| Prop | Type | Default | Description |
|
|
200
|
+
| ----------- | --------- | ----------- | -------------------------------------------------------- |
|
|
201
|
+
| `open` | `boolean` | `false` | Whether the dropdown is open (use with `v-model:open`) |
|
|
202
|
+
| `label` | `string` | `'Menu'` | Label for the built-in dropdown button |
|
|
203
|
+
| `variant` | `string` | `undefined` | Button variant for the dropdown trigger |
|
|
204
|
+
| `kind` | `string` | `undefined` | Button kind for the dropdown trigger |
|
|
205
|
+
| `size` | `string` | `undefined` | Button size for the dropdown trigger |
|
|
206
|
+
| `icon` | `string` | `undefined` | Icon for the dropdown trigger button |
|
|
207
|
+
| `disabled` | `boolean` | `false` | Whether the dropdown trigger is disabled |
|
|
208
|
+
| `placement` | `string` | `undefined` | Popover placement (when supported by bl-dropdown) |
|
|
209
|
+
|
|
210
|
+
### Items Mode Props
|
|
211
|
+
|
|
212
|
+
| Prop | Type | Default | Description |
|
|
213
|
+
| ------- | -------------- | ----------- | ------------------------------------------------------------------------------- |
|
|
214
|
+
| `items` | `DropdownItem[]` | `undefined` | Array of dropdown items. Each item is rendered as a bl-dropdown-item (or grouped) |
|
|
215
|
+
|
|
216
|
+
### DropdownItem Interface
|
|
217
|
+
|
|
218
|
+
When using the `items` prop, each item should follow the `DropdownItem` interface:
|
|
219
|
+
|
|
220
|
+
| Property | Type | Default | Description |
|
|
221
|
+
| -------------- | --------- | ----------- | ------------------------------------------------------------------------------- |
|
|
222
|
+
| `caption` | `string` | `undefined` | Text displayed for the item |
|
|
223
|
+
| `icon` | `string` | `undefined` | Icon name for the item (BaklavaIcon) |
|
|
224
|
+
| `disabled` | `boolean` | `false` | Whether the item is disabled |
|
|
225
|
+
| `groupCaption` | `string` | `undefined` | Groups items into a bl-dropdown-group with this caption |
|
|
226
|
+
|
|
227
|
+
Items may include additional custom data for use in the `#item` slot.
|
|
228
|
+
|
|
229
|
+
## Events
|
|
230
|
+
|
|
231
|
+
| Event | Payload | Description |
|
|
232
|
+
| ------------- | --------- | --------------------------------------------------------- |
|
|
233
|
+
| `update:open` | `boolean` | Emitted when visibility changes. Use for two-way binding. |
|
|
234
|
+
| `open` | - | Emitted when the dropdown is opened |
|
|
235
|
+
| `close` | - | Emitted when the dropdown is closed |
|
|
236
|
+
| `select` | `CustomEvent` | Emitted when a dropdown item is clicked (from bl-dropdown-item-click) |
|
|
237
|
+
|
|
238
|
+
## Methods
|
|
239
|
+
|
|
240
|
+
You can access these methods via template refs:
|
|
241
|
+
|
|
242
|
+
| Method | Description |
|
|
243
|
+
| --------- | ---------------------------------------- |
|
|
244
|
+
| `open()` | Opens the dropdown programmatically |
|
|
245
|
+
| `close()` | Closes the dropdown programmatically |
|
|
246
|
+
| `toggle()`| Toggles the dropdown open/closed state |
|
|
247
|
+
|
|
248
|
+
## Slots
|
|
249
|
+
|
|
250
|
+
| Slot | Props | Description |
|
|
251
|
+
| --------- | ------------------ | ------------------------------------------------------------- |
|
|
252
|
+
| `default` | - | Custom content for slot mode (e.g. bl-dropdown-item elements) |
|
|
253
|
+
| `item` | `{ item, index }` | Scoped slot for each item content in items mode |
|
|
254
|
+
|
|
255
|
+
## Types
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
import type { DropdownProps, DropdownItem } from "@baklavue/ui";
|
|
259
|
+
|
|
260
|
+
interface DropdownItem {
|
|
261
|
+
caption?: string;
|
|
262
|
+
icon?: string;
|
|
263
|
+
disabled?: boolean;
|
|
264
|
+
groupCaption?: string;
|
|
265
|
+
[key: string]: unknown; // Additional custom data for #item slot
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
interface DropdownProps {
|
|
269
|
+
open?: boolean;
|
|
270
|
+
placement?: string;
|
|
271
|
+
disabled?: boolean;
|
|
272
|
+
label?: string;
|
|
273
|
+
variant?: string;
|
|
274
|
+
kind?: string;
|
|
275
|
+
size?: string;
|
|
276
|
+
icon?: string;
|
|
277
|
+
items?: DropdownItem[];
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Usage Notes
|
|
282
|
+
|
|
283
|
+
- **Slot vs Items Mode**: The component automatically switches between slot mode and items mode based on whether the `items` prop is provided. When `items` is undefined or empty, it uses the default slot. When `items` is provided, it renders bl-dropdown-group and bl-dropdown-item elements.
|
|
284
|
+
|
|
285
|
+
- **Items Prop**: In items mode, content for each item is provided via the `#item` scoped slot. You can use the default (item.caption) or customize the markup.
|
|
286
|
+
|
|
287
|
+
- **Grouping**: Use `groupCaption` on items to group them. Items with the same `groupCaption` are rendered inside a `bl-dropdown-group` with that caption.
|
|
288
|
+
|
|
289
|
+
- **Accessibility**: The component follows Baklava's accessibility guidelines and includes proper ARIA attributes for screen readers.
|
|
290
|
+
|
|
291
|
+
- **Styling**: The component uses Baklava's default styling. Custom styling can be applied through CSS variables or by overriding the component styles.
|