vlite3 1.5.11 → 1.5.13
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 +20 -8
- package/components/Accordion/AccordionContent.vue.js +2 -2
- package/components/CategoryManager/CategoryManager2.vue.js +1 -1
- package/components/CommandPalette/CommandPaletteContent2.vue.js +1 -1
- package/components/CommandPalette/{CommandPaletteItem2.vue.js → CommandPaletteItem.vue.js} +1 -1
- package/components/Dropdown/DropdownMenu.vue.js +1 -1
- package/components/Form/{AccordionView.vue.js → AccordionView2.vue.js} +2 -2
- package/components/Form/Form.vue.js +2 -2
- package/components/Form/index2.vue.js +1 -1
- package/components/NavbarCommandPalette.vue.js +1 -1
- package/components/PanZoomViewport/PanZoomViewport.vue.d.ts +7 -7
- package/components/PanZoomViewport/PanZoomViewport.vue.js +1 -1
- package/components/Screen/ScreenFilter.vue.js +1 -1
- package/components/Splitter/Splitter.vue.d.ts +7 -0
- package/components/Splitter/Splitter.vue.js +33 -29
- package/components/Tabes/Tabes.vue.js +2 -2
- package/docs/README.md +17 -0
- package/docs/all-components.md +89 -0
- package/docs/component-index.md +313 -0
- package/docs/components/accordion.md +52 -0
- package/docs/components/alert.md +34 -0
- package/docs/components/app-shell.md +371 -0
- package/docs/components/async-select.md +264 -0
- package/docs/components/attachments-list.md +231 -0
- package/docs/components/avatar-group.md +74 -0
- package/docs/components/avatar-uploader.md +61 -0
- package/docs/components/avatar.md +28 -0
- package/docs/components/badge.md +81 -0
- package/docs/components/barcode.md +42 -0
- package/docs/components/beacon.md +29 -0
- package/docs/components/breadcrumb.md +317 -0
- package/docs/components/button-group.md +35 -0
- package/docs/components/button.md +86 -0
- package/docs/components/calendar.md +95 -0
- package/docs/components/carousel.md +122 -0
- package/docs/components/cart.md +533 -0
- package/docs/components/category-manager.md +269 -0
- package/docs/components/category-menu.md +251 -0
- package/docs/components/charts.md +1456 -0
- package/docs/components/chat.md +330 -0
- package/docs/components/checkbox.md +31 -0
- package/docs/components/chip.md +137 -0
- package/docs/components/choice-box.md +40 -0
- package/docs/components/clipboard.md +105 -0
- package/docs/components/clock.md +70 -0
- package/docs/components/color-picker.md +82 -0
- package/docs/components/command-palette.md +214 -0
- package/docs/components/comment-thread.md +171 -0
- package/docs/components/confirmation-modal.md +50 -0
- package/docs/components/custom-fields-display.md +94 -0
- package/docs/components/custom-fields.md +97 -0
- package/docs/components/data-list.md +93 -0
- package/docs/components/data-table.md +922 -0
- package/docs/components/date-picker.md +58 -0
- package/docs/components/date-range-picker.md +24 -0
- package/docs/components/date-time.md +104 -0
- package/docs/components/dropdown.md +740 -0
- package/docs/components/empty.md +100 -0
- package/docs/components/export-data.md +320 -0
- package/docs/components/file-picker.md +83 -0
- package/docs/components/file-preview.md +42 -0
- package/docs/components/file-tree.md +144 -0
- package/docs/components/footer.md +251 -0
- package/docs/components/forms.md +776 -0
- package/docs/components/gantt-chart.md +767 -0
- package/docs/components/google-login.md +67 -0
- package/docs/components/google-map.md +128 -0
- package/docs/components/heatmap.md +80 -0
- package/docs/components/icon-picker.md +58 -0
- package/docs/components/icon.md +176 -0
- package/docs/components/image-comparison.md +51 -0
- package/docs/components/image-magnifier.md +26 -0
- package/docs/components/import-data.md +521 -0
- package/docs/components/input.md +58 -0
- package/docs/components/invoice.md +339 -0
- package/docs/components/kanban.md +302 -0
- package/docs/components/label.md +25 -0
- package/docs/components/list.md +419 -0
- package/docs/components/masonry.md +55 -0
- package/docs/components/modal.md +133 -0
- package/docs/components/multi-select.md +54 -0
- package/docs/components/navbar.md +403 -0
- package/docs/components/number-input.md +41 -0
- package/docs/components/otp-input.md +68 -0
- package/docs/components/pagination.md +83 -0
- package/docs/components/pan-zoom-viewport.md +245 -0
- package/docs/components/permission-editor.md +322 -0
- package/docs/components/persona.md +56 -0
- package/docs/components/price.md +106 -0
- package/docs/components/pricing-plan.md +68 -0
- package/docs/components/progress-bar.md +53 -0
- package/docs/components/qr-code.md +59 -0
- package/docs/components/rating.md +59 -0
- package/docs/components/rich-text-editor.md +210 -0
- package/docs/components/scale-generator.md +101 -0
- package/docs/components/screen.md +208 -0
- package/docs/components/seo-provider.md +189 -0
- package/docs/components/side-panel.md +94 -0
- package/docs/components/sidebar-menu.md +422 -0
- package/docs/components/skeleton.md +115 -0
- package/docs/components/slider.md +48 -0
- package/docs/components/spinner.md +27 -0
- package/docs/components/splitter.md +97 -0
- package/docs/components/stats.md +234 -0
- package/docs/components/status-chip.md +232 -0
- package/docs/components/switch.md +23 -0
- package/docs/components/tabs.md +335 -0
- package/docs/components/tag-input.md +55 -0
- package/docs/components/textarea.md +31 -0
- package/docs/components/theme-provider.md +130 -0
- package/docs/components/theme-toggle.md +36 -0
- package/docs/components/thumbnail-selector.md +186 -0
- package/docs/components/timeline.md +225 -0
- package/docs/components/toast-notification.md +89 -0
- package/docs/components/tooltip.md +31 -0
- package/docs/components/workbook.md +102 -0
- package/docs/composables/use-theme.md +59 -0
- package/docs/getting-started/setup.md +176 -0
- package/docs/guides/draggable.md +211 -0
- package/docs/guides/internationalization.md +281 -0
- package/docs/guides/performance.md +118 -0
- package/docs/guides/testing-forms.md +154 -0
- package/docs/guides/testing-overlays.md +131 -0
- package/docs/guides/theming.md +124 -0
- package/docs/utilities/search.md +580 -0
- package/docs/utilities/utilities.md +371 -0
- package/docs-manifest.json +339 -0
- package/package.json +6 -15
- package/scripts/generate-docs-manifest.js +207 -0
- package/scripts/sync-docs.js +754 -0
- package/style.css +1 -1
- /package/components/Dropdown/{DropdownMenu2.vue.js → DropdownMenu3.vue.js} +0 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
# Tabes
|
|
2
|
+
|
|
3
|
+
**Import:** `import { Tabes } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
A segmented control for switching modes or views. Supports standard selectable tabs and optional **dropdown menu tabs** that reuse the existing `Dropdown` component.
|
|
6
|
+
|
|
7
|
+
### Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Description |
|
|
10
|
+
| :----------- | :----------------- | :-------- | :------------------------------------------------------- |
|
|
11
|
+
| `modelValue` | `string \| number` | — | Binding (`v-model`) |
|
|
12
|
+
| `options` | `TabesOption[]` | required | Array of tabs (standard and/or menu) |
|
|
13
|
+
| `size` | `TabesSize` | `md` | Dimensions |
|
|
14
|
+
| `variant` | `TabesVariant` | `surface` | Visual style |
|
|
15
|
+
| `block` | `boolean` | `false` | Full width |
|
|
16
|
+
| `textClass` | `string` | — | Custom class for text |
|
|
17
|
+
| `wrap` | `boolean` | `false` | Wrap tabs to multiple rows on small screens instead of scrolling |
|
|
18
|
+
| `direction` | `'ltr' \| 'rtl' \| 'auto'` | `auto` | Direction for the tab row, scroll affordances, and menus. `auto` follows the nearest ancestor `dir`, then `html[dir]` |
|
|
19
|
+
| `sortable` | `boolean` | `false` | Opt-in drag-to-reorder. The new order is persisted to `localStorage` and restored on reload |
|
|
20
|
+
| `storageKey` | `string` | — | `localStorage` slot for the saved order (prefixed `builto-tabes-order-`). Auto-derived from the tab set when omitted. Only used with `sortable` |
|
|
21
|
+
|
|
22
|
+
### Types
|
|
23
|
+
```ts
|
|
24
|
+
import type { IDropdownOption } from 'vlite3'
|
|
25
|
+
import type { TooltTipPlacement } from 'v-tooltip-lite/types'
|
|
26
|
+
|
|
27
|
+
export interface TabesDropdownConfig {
|
|
28
|
+
position?: TooltTipPlacement
|
|
29
|
+
offset?: [number, number]
|
|
30
|
+
direction?: 'ltr' | 'rtl'
|
|
31
|
+
searchable?: boolean
|
|
32
|
+
closeOnSelect?: boolean
|
|
33
|
+
maxHeight?: string
|
|
34
|
+
minWidth?: string
|
|
35
|
+
width?: string
|
|
36
|
+
menuId?: string
|
|
37
|
+
teleport?: boolean
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface TabesOption {
|
|
41
|
+
label: string
|
|
42
|
+
labelI18n?: string
|
|
43
|
+
value: string | number
|
|
44
|
+
icon?: string
|
|
45
|
+
disabled?: boolean
|
|
46
|
+
to?: string | { path: string; [key: string]: any }
|
|
47
|
+
href?: string
|
|
48
|
+
/** When set, this tab becomes a dropdown menu trigger */
|
|
49
|
+
menu?: IDropdownOption[]
|
|
50
|
+
/** Optional Dropdown configuration for this menu tab */
|
|
51
|
+
dropdown?: TabesDropdownConfig
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type TabesSize = 'xs' | 'sm' | 'md' | 'lg'
|
|
55
|
+
|
|
56
|
+
export type TabesVariant =
|
|
57
|
+
| 'surface'
|
|
58
|
+
| 'primary'
|
|
59
|
+
| 'secondary'
|
|
60
|
+
| 'danger'
|
|
61
|
+
| 'success'
|
|
62
|
+
| 'outline'
|
|
63
|
+
| 'line'
|
|
64
|
+
| 'checkbox'
|
|
65
|
+
|
|
66
|
+
export type TabesMenuSelectPayload = {
|
|
67
|
+
value: any
|
|
68
|
+
option?: IDropdownOption
|
|
69
|
+
tab: TabesOption
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type TabesReorderPayload = {
|
|
73
|
+
/** Tabs in their new order. */
|
|
74
|
+
options: TabesOption[]
|
|
75
|
+
/** New order as a list of option values (the shape persisted to storage). */
|
|
76
|
+
order: (string | number)[]
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Events
|
|
81
|
+
|
|
82
|
+
| Event | Payload | Description |
|
|
83
|
+
| :------------------ | :---------------------- | :---------- |
|
|
84
|
+
| `update:modelValue` | `string \| number` | Emitted on tab or menu-item selection (`v-model`) |
|
|
85
|
+
| `change` | `string \| number` | Emitted when selection changes (standard tab or menu item) |
|
|
86
|
+
| `menu-select` | `TabesMenuSelectPayload`| Emitted when a dropdown menu option is selected |
|
|
87
|
+
| `menu-open` | `TabesOption` | Emitted when a menu tab dropdown opens |
|
|
88
|
+
| `menu-close` | `TabesOption` | Emitted when a menu tab dropdown closes |
|
|
89
|
+
| `reorder` | `TabesReorderPayload` | Emitted after the user drags tabs into a new order (`sortable`) |
|
|
90
|
+
| `update:options` | `TabesOption[]` | Emitted with the reordered tabs, enabling `v-model:options` |
|
|
91
|
+
|
|
92
|
+
### Variants
|
|
93
|
+
|
|
94
|
+
| Value | Description |
|
|
95
|
+
| :---------- | :---------- |
|
|
96
|
+
| `surface` | Default segmented control on a muted surface with a sliding marker |
|
|
97
|
+
| `primary` | Primary-colored active marker on a muted surface |
|
|
98
|
+
| `secondary` | Secondary-colored active marker |
|
|
99
|
+
| `danger` | Danger-tinted track and active state |
|
|
100
|
+
| `success` | Success-tinted track and active state |
|
|
101
|
+
| `outline` | Transparent track with a border |
|
|
102
|
+
| `line` | Underline tabs — transparent track, bottom border, active underline marker |
|
|
103
|
+
| `checkbox` | Filter-style chips — transparent group; inactive items are plain muted text; the active item is a primary pill (`bg-primary` / `text-primary-fg`) |
|
|
104
|
+
|
|
105
|
+
#### Checkbox (filter chips)
|
|
106
|
+
|
|
107
|
+
Use `variant="checkbox"` for compact option selectors where tabs should look like individually selectable filter controls rather than a traditional tab bar. Selection remains **single-choice** via `v-model` — this is not a multi-select checkbox group.
|
|
108
|
+
|
|
109
|
+
- The tab group background stays fully transparent (no shared fill, border, or underline).
|
|
110
|
+
- Inactive items: fully transparent, muted/gray text, no border.
|
|
111
|
+
- Active item: rounded pill using `bg-primary` + `text-primary-fg` (no border), matching the design-token active-state pattern.
|
|
112
|
+
- Hover, focus-visible ring, disabled, icons, menu tabs, sizes, RTL, scroll, wrap, block, and sortable all continue to work.
|
|
113
|
+
- Visual principles borrow from chip/filter UIs (rounded-full active pill, plain inactive labels) but rendering and interaction stay owned by `Tabes` — it does **not** wrap `Chip` or `StatusChip`.
|
|
114
|
+
|
|
115
|
+
```vue
|
|
116
|
+
<Tabes
|
|
117
|
+
v-model="selectedView"
|
|
118
|
+
:options="[
|
|
119
|
+
{ label: 'List', value: 'list', icon: 'lucide:list' },
|
|
120
|
+
{ label: 'Board', value: 'board', icon: 'lucide:layout-grid' },
|
|
121
|
+
{ label: 'Calendar', value: 'calendar', icon: 'lucide:calendar' },
|
|
122
|
+
]"
|
|
123
|
+
variant="checkbox" />
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Usage
|
|
127
|
+
```vue
|
|
128
|
+
<Tabes
|
|
129
|
+
v-model="currentTab"
|
|
130
|
+
:options="[
|
|
131
|
+
{ label: 'Home', value: 'home' },
|
|
132
|
+
{ label: 'Profile', value: 'profile' },
|
|
133
|
+
]"
|
|
134
|
+
variant="line"
|
|
135
|
+
block />
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### Menu tabs (More ▾)
|
|
139
|
+
|
|
140
|
+
A tab with a `menu` array renders as a dropdown trigger inside the same tab group. Opening the menu does **not** change `v-model`. Selecting a menu item updates `v-model` to that item's value and marks the parent menu tab as active.
|
|
141
|
+
|
|
142
|
+
Menu items use the existing `IDropdownOption` contract (`label`, `value`, `icon`, `disabled`, `to`, `href`, nested `children`, etc.).
|
|
143
|
+
|
|
144
|
+
```vue
|
|
145
|
+
<script setup lang="ts">
|
|
146
|
+
import { ref } from 'vue'
|
|
147
|
+
import { Tabes, type TabesOption } from 'vlite3'
|
|
148
|
+
|
|
149
|
+
const current = ref('work')
|
|
150
|
+
|
|
151
|
+
const options: TabesOption[] = [
|
|
152
|
+
{ label: 'Work', value: 'work', icon: 'lucide:briefcase' },
|
|
153
|
+
{ label: 'Team', value: 'team', icon: 'lucide:users' },
|
|
154
|
+
{ label: 'Sites', value: 'sites', icon: 'lucide:map-pin' },
|
|
155
|
+
{ label: 'Documents', value: 'documents', icon: 'lucide:file-text' },
|
|
156
|
+
{ label: 'Insights', value: 'insights', icon: 'lucide:chart-line' },
|
|
157
|
+
{
|
|
158
|
+
label: 'More',
|
|
159
|
+
value: 'more',
|
|
160
|
+
menu: [
|
|
161
|
+
{ label: 'Calendar', value: 'calendar', icon: 'lucide:calendar' },
|
|
162
|
+
{ label: 'Workload', value: 'workload', icon: 'lucide:gauge' },
|
|
163
|
+
{ label: 'Plan', value: 'plan', icon: 'lucide:clipboard-list' },
|
|
164
|
+
{ label: 'Materials', value: 'materials', icon: 'lucide:package' },
|
|
165
|
+
{ label: 'Project Dashboard', value: 'project-dashboard', icon: 'lucide:layout-dashboard' },
|
|
166
|
+
{ label: 'Settings', value: 'settings', icon: 'lucide:settings' },
|
|
167
|
+
],
|
|
168
|
+
},
|
|
169
|
+
]
|
|
170
|
+
</script>
|
|
171
|
+
|
|
172
|
+
<template>
|
|
173
|
+
<Tabes
|
|
174
|
+
v-model="current"
|
|
175
|
+
:options="options"
|
|
176
|
+
@menu-select="({ value }) => console.log('menu', value)"
|
|
177
|
+
@change="(v) => console.log('change', v)" />
|
|
178
|
+
</template>
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
#### Active menu-child behaviour
|
|
182
|
+
|
|
183
|
+
When `v-model` equals a menu child's `value` (including nested `children`), the parent menu tab shows the active / selected styles and the animated marker tracks the parent trigger — not a phantom child tab.
|
|
184
|
+
|
|
185
|
+
#### Disabled states
|
|
186
|
+
|
|
187
|
+
```ts
|
|
188
|
+
{
|
|
189
|
+
label: 'More',
|
|
190
|
+
value: 'more',
|
|
191
|
+
disabled: true, // disables the menu trigger
|
|
192
|
+
menu: [
|
|
193
|
+
{ label: 'Calendar', value: 'calendar' },
|
|
194
|
+
{ label: 'Archived', value: 'archived', disabled: true }, // disables one item
|
|
195
|
+
],
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
#### Icons and translated labels
|
|
200
|
+
|
|
201
|
+
Standard tabs and menu triggers support `icon` and `labelI18n`. Menu items inherit the same fields from `IDropdownOption` (`icon`, `labelI18n`, etc.).
|
|
202
|
+
|
|
203
|
+
#### Dropdown placement and config
|
|
204
|
+
|
|
205
|
+
Per-tab Dropdown options via `dropdown`:
|
|
206
|
+
|
|
207
|
+
```ts
|
|
208
|
+
{
|
|
209
|
+
label: 'More',
|
|
210
|
+
value: 'more',
|
|
211
|
+
menu: [/* IDropdownOption[] */],
|
|
212
|
+
dropdown: {
|
|
213
|
+
position: 'bottom-end',
|
|
214
|
+
offset: [0, 8],
|
|
215
|
+
searchable: false,
|
|
216
|
+
minWidth: '180px',
|
|
217
|
+
direction: 'rtl',
|
|
218
|
+
},
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Menus teleport to `body` by default so they are not clipped by the tab scroll container.
|
|
223
|
+
|
|
224
|
+
#### RTL
|
|
225
|
+
|
|
226
|
+
By default (`direction="auto"`) the tab row follows the nearest ancestor `dir`,
|
|
227
|
+
then `html[dir]` — matching `Dropdown` — so tabs mirror automatically on RTL
|
|
228
|
+
pages or inside RTL islands. Set `direction="rtl"` / `"ltr"` to force a value, or
|
|
229
|
+
override a single menu via `dropdown.direction`.
|
|
230
|
+
|
|
231
|
+
Under the resolved direction:
|
|
232
|
+
|
|
233
|
+
- The tab row receives `dir="rtl"` and lays tabs out right-to-left.
|
|
234
|
+
- The active marker is positioned from local, physical geometry (inline `left`/
|
|
235
|
+
`top` + translate), so it is **not** flipped by the global `i18n.css`
|
|
236
|
+
`left-0 → right-0` rule and stays aligned with the active tab.
|
|
237
|
+
- Scroll fades and chevron buttons sit on the inline-start / inline-end edges,
|
|
238
|
+
and the chevrons flip to point toward the scroll travel direction.
|
|
239
|
+
- Menu dropdowns (teleported to `body`) receive the resolved direction, so their
|
|
240
|
+
placement and text follow RTL even though they render outside the tab row.
|
|
241
|
+
|
|
242
|
+
```vue
|
|
243
|
+
<!-- Auto: mirrors because an ancestor is RTL -->
|
|
244
|
+
<div dir="rtl">
|
|
245
|
+
<Tabes v-model="tab" :options="options" />
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
<!-- Forced RTL regardless of context -->
|
|
249
|
+
<Tabes v-model="tab" :options="options" direction="rtl" />
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
#### Reordering (drag & drop)
|
|
253
|
+
|
|
254
|
+
Set `sortable` to let users drag tabs into a new order. It is **off by default** —
|
|
255
|
+
enable it only where reordering makes sense. Dragging does not change `v-model`
|
|
256
|
+
(that still tracks the active tab); a plain click still selects, a drag reorders.
|
|
257
|
+
|
|
258
|
+
The new order is **persisted to `localStorage`** and restored on the next load,
|
|
259
|
+
mirroring how saved view preferences work elsewhere. Persistence is keyed by
|
|
260
|
+
`storageKey` (recommended so multiple tab bars don't collide); when omitted, a
|
|
261
|
+
stable key is derived from the tab value set. Keys are stored under
|
|
262
|
+
`builto-tabes-order-<key>`.
|
|
263
|
+
|
|
264
|
+
```vue
|
|
265
|
+
<script setup lang="ts">
|
|
266
|
+
import { ref } from 'vue'
|
|
267
|
+
import { Tabes, type TabesOption, type TabesReorderPayload } from 'vlite3'
|
|
268
|
+
|
|
269
|
+
const tab = ref('write')
|
|
270
|
+
const tabs: TabesOption[] = [
|
|
271
|
+
{ label: 'Write', value: 'write', icon: 'lucide:pen-line' },
|
|
272
|
+
{ label: 'Preview', value: 'preview', icon: 'lucide:eye' },
|
|
273
|
+
{ label: 'Settings', value: 'settings', icon: 'lucide:settings' },
|
|
274
|
+
]
|
|
275
|
+
|
|
276
|
+
const onReorder = (payload: TabesReorderPayload) => {
|
|
277
|
+
console.log('new order', payload.order)
|
|
278
|
+
}
|
|
279
|
+
</script>
|
|
280
|
+
|
|
281
|
+
<template>
|
|
282
|
+
<Tabes
|
|
283
|
+
v-model="tab"
|
|
284
|
+
:options="tabs"
|
|
285
|
+
sortable
|
|
286
|
+
storage-key="editor-tabs"
|
|
287
|
+
@reorder="onReorder" />
|
|
288
|
+
</template>
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
To keep the parent's array in sync with the on-screen order, bind it two-way:
|
|
292
|
+
|
|
293
|
+
```vue
|
|
294
|
+
<Tabes v-model="tab" v-model:options="tabs" sortable storage-key="editor-tabs" />
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Notes:
|
|
298
|
+
|
|
299
|
+
- Menu tabs (`More ▾`) reorder like any other tab; opening the menu still works.
|
|
300
|
+
- Disabled tabs can be pushed around but can't be picked up.
|
|
301
|
+
- Reordering integrates with scrolling and RTL — the marker and scroll
|
|
302
|
+
affordances re-measure after a drop.
|
|
303
|
+
- Uses `vue-draggable-plus` (SortableJS) under the hood.
|
|
304
|
+
|
|
305
|
+
#### Responsive wrap on small screens
|
|
306
|
+
```vue
|
|
307
|
+
<Tabes
|
|
308
|
+
v-model="currentTab"
|
|
309
|
+
:options="tabs"
|
|
310
|
+
wrap />
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
> **Note:** By default, when `Tabes` exceed their container's width, they will enable smooth horizontal scrolling and display navigation buttons. Use `wrap` to wrap them to multiple rows instead. When `wrap` is enabled, the animated sliding marker is hidden. Menu tabs continue to work with both scrolling and wrapping.
|
|
314
|
+
|
|
315
|
+
### Transformed / scaled parents
|
|
316
|
+
|
|
317
|
+
The active marker is measured in the tablist’s **local CSS coordinate space**.
|
|
318
|
+
Visual `getBoundingClientRect()` deltas are normalized by the container’s
|
|
319
|
+
current transform scale, and width/height use layout (`offset*`) sizes.
|
|
320
|
+
This keeps the marker aligned inside ancestors that apply
|
|
321
|
+
`transform: scale(...)` (including VLite3 `ScaleGenerator`) without
|
|
322
|
+
double-scaling the overlay.
|
|
323
|
+
|
|
324
|
+
Performance notes (see `docs/guides/performance.md`):
|
|
325
|
+
|
|
326
|
+
- Tab item refs use a plain `Map` so DOM nodes are never deep-proxied.
|
|
327
|
+
- Resize and scroll layout work is coalesced to `requestAnimationFrame`.
|
|
328
|
+
- Marker style writes are skipped when geometry is unchanged.
|
|
329
|
+
- Standard (non-menu) tab items use `v-memo` to skip VDOM diffs when
|
|
330
|
+
unchanged. Menu tabs are excluded so Dropdown open-state updates stay live.
|
|
331
|
+
- The scroll strip and marker use `will-change: transform` + `contain`.
|
|
332
|
+
|
|
333
|
+
### Backward compatibility
|
|
334
|
+
|
|
335
|
+
Existing flat `TabesOption` arrays (without `menu`) continue to work unchanged: same `v-model`, `change` event, variants, sizes, `block`, `wrap`, scrolling, and marker behaviour.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# TagInput
|
|
2
|
+
|
|
3
|
+
**Import:** `import { TagInput } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
A component for inputting a list of string values, such as tags or keywords. Press **Enter**, type a **comma**, or click the **+** button to add a tag. Supports pasting comma-separated values to add multiple tags at once.
|
|
6
|
+
|
|
7
|
+
### Props
|
|
8
|
+
|
|
9
|
+
| Prop | Type | Default | Description |
|
|
10
|
+
| :---------------- | :---------------------------------------------------------------- | :----------- | :--------------------------------------- |
|
|
11
|
+
| `modelValue` | `string[]` | `[]` | Binding (`v-model`) |
|
|
12
|
+
| `placeholder` | `string` | `Add tag...` | Input placeholder |
|
|
13
|
+
| `placeholderI18n` | `string` | — | I18n key for the placeholder |
|
|
14
|
+
| `disabled` | `boolean` | `false` | Disable input and tag removal |
|
|
15
|
+
| `maxTags` | `number` | — | Maximum number of tags allowed |
|
|
16
|
+
| `variant` | `'outline' \| 'solid' \| 'transparent' \| 'outline-b' \| 'floating'` | `outline` | Visual style of the input |
|
|
17
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `md` | Dimensions (affects input and tag chips) |
|
|
18
|
+
| `rounded` | `'none' \| 'sm' \| 'md' \| 'lg' \| 'xl' \| '2xl' \| 'full'` | `md` | Border radius of the input |
|
|
19
|
+
| `error` | `string` | — | Error message / state |
|
|
20
|
+
| `class` | `string` | — | Custom wrapper class |
|
|
21
|
+
|
|
22
|
+
### Events
|
|
23
|
+
|
|
24
|
+
- `@update:modelValue`: Emitted when tags are added or removed (array of current tags)
|
|
25
|
+
- `@change`: Emitted alongside `update:modelValue` with the new tags array
|
|
26
|
+
|
|
27
|
+
### Behaviour
|
|
28
|
+
|
|
29
|
+
- **Adding tags** — Press `Enter`, type `,`, or click the trailing `+` icon.
|
|
30
|
+
- **Paste support** — Pasting comma-separated text automatically splits and adds each value as a separate tag. Duplicates are ignored.
|
|
31
|
+
- **Duplicates** — A tag that already exists in the list will not be added again.
|
|
32
|
+
- **Max limit** — When `maxTags` is set and the limit is reached, the input is disabled and the placeholder changes to *"Max tags reached"*.
|
|
33
|
+
- **Removing tags** — Click the `×` button on a tag chip. Disabled when `disabled` is `true`.
|
|
34
|
+
|
|
35
|
+
### Usage
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<!-- Basic -->
|
|
39
|
+
<TagInput v-model="tags" placeholder="Add tag..." />
|
|
40
|
+
|
|
41
|
+
<!-- With max tags limit -->
|
|
42
|
+
<TagInput v-model="tags" :maxTags="5" />
|
|
43
|
+
|
|
44
|
+
<!-- Variants -->
|
|
45
|
+
<TagInput v-model="tags" variant="outline" />
|
|
46
|
+
<TagInput v-model="tags" variant="solid" />
|
|
47
|
+
<TagInput v-model="tags" variant="transparent" />
|
|
48
|
+
|
|
49
|
+
<!-- Disabled state -->
|
|
50
|
+
<TagInput v-model="tags" disabled />
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
#### RTL
|
|
54
|
+
|
|
55
|
+
Built on `Input`, so the field placeholder, trailing `+` icon, and clear/add chrome follow page direction. Tag chips use normal flex-wrap flow under RTL (remove control sits on the inline-end of each chip).
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Textarea
|
|
2
|
+
|
|
3
|
+
**Import:** `import { Textarea } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
### Props
|
|
6
|
+
|
|
7
|
+
| Prop | Type | Default | Description |
|
|
8
|
+
| :---------------- | :-------- | :------ | :----------------------- |
|
|
9
|
+
| `modelValue` | `string` | `''` | Binding (`v-model`) |
|
|
10
|
+
| `rows` | `number` | `3` | Default visible rows |
|
|
11
|
+
| `placeholder` | `string` | — | Placeholder text |
|
|
12
|
+
| `placeholderI18n` | `string` | — | I18n key for placeholder |
|
|
13
|
+
| `class` | `string` | — | Custom CSS classes |
|
|
14
|
+
| `disabled` | `boolean` | `false` | Disable input |
|
|
15
|
+
| `dir` | `'ltr' \| 'rtl'` | page dir | Text / placeholder direction |
|
|
16
|
+
|
|
17
|
+
### Events
|
|
18
|
+
|
|
19
|
+
- `@update:modelValue`
|
|
20
|
+
- `@focus`
|
|
21
|
+
- `@blur`
|
|
22
|
+
|
|
23
|
+
### Usage
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<Textarea v-model="message" placeholder="Leave a comment..." :rows="5" />
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
#### RTL
|
|
30
|
+
|
|
31
|
+
Placeholder and typed text follow `document.documentElement.dir` (or an explicit `dir` prop). When used as `Input type="textarea"`, the same nested field-dir rules as Input apply.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# ThemeProvider
|
|
2
|
+
|
|
3
|
+
**Import:** `import { ThemeProvider, useThemeStyles } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
A data-driven theme wrapper. Pass root, Surface, and brand colors plus font
|
|
6
|
+
and layout values — the provider computes every CSS variable, every
|
|
7
|
+
nested card override, and exposes the resolved styles to descendants via the
|
|
8
|
+
`useThemeStyles()` composable.
|
|
9
|
+
|
|
10
|
+
The component is **generic** — it knows nothing about shops, dashboards, or
|
|
11
|
+
auth flows. Any app-specific wrapper (e.g. `ShopWebsiteProvider`) just maps
|
|
12
|
+
its own domain object onto `ThemeProviderProps`.
|
|
13
|
+
|
|
14
|
+
### Props
|
|
15
|
+
|
|
16
|
+
| Prop | Type | Default | Description |
|
|
17
|
+
| :-------------- | :-------------------------------- | :------------------------- | :-------------------------------------------------------------------------------- |
|
|
18
|
+
| `bgColor` | `string` | — | Root background. Used to derive the full root `--color-*` palette. |
|
|
19
|
+
| `surfaceColor` | `string` | — | Optional seed for a complete descendant `.bg-card` color scope. |
|
|
20
|
+
| `primaryColor` | `string` | — | Brand color. Generates `--color-primary*` variants. |
|
|
21
|
+
| `footerBgColor` | `string` | — | Optional footer background. Surfaced as `--color-footer`. |
|
|
22
|
+
| `baseFontSize` | `number` | `16` | Base font size in `px`. Drives the `--text-*` scale. |
|
|
23
|
+
| `scaleSpacingWithBaseFontSize` | `boolean` | `false` | Opt in to scaling Tailwind's `--spacing` unit with `baseFontSize`. |
|
|
24
|
+
| `headingScale` | `number` | `1.25` | Heading ratio. Scales the progressive `--text-fs-*` family. |
|
|
25
|
+
| `borderRadius` | `number` | `8` | Base radius in `px`. Drives the `--radius*` family. |
|
|
26
|
+
| `maxWidth` | `number \| string \| null` | `1440` | Max content width. `'full' \| 'none' \| 0` becomes `none`. Any other string passes through. |
|
|
27
|
+
| `rootClass` | `string` | `'vlite-theme-provider'` | Root class applied to the wrapper. |
|
|
28
|
+
|
|
29
|
+
### Slots
|
|
30
|
+
|
|
31
|
+
| Slot | Description |
|
|
32
|
+
| :-------- | :---------------- |
|
|
33
|
+
| `default` | Themed content. |
|
|
34
|
+
|
|
35
|
+
### Generated CSS Variables
|
|
36
|
+
|
|
37
|
+
The provider sets a flat record of CSS custom properties on its root element
|
|
38
|
+
that drive the entire vlite3 design system:
|
|
39
|
+
|
|
40
|
+
- **Colors** — `--color-background`, `--color-body`, `--color-foreground`,
|
|
41
|
+
`--color-border`, `--color-input`, `--color-card`, `--color-card-light`,
|
|
42
|
+
`--color-muted`, `--color-accent`, `--color-secondary`, `--color-scrollbar`,
|
|
43
|
+
`--color-primary*`, semantic palette (`--color-danger*`, `--color-warning*`,
|
|
44
|
+
`--color-info*`, `--color-success*`), and `--color-chart-1..6`.
|
|
45
|
+
- **Gray scale** — `--color-gray-50 .. 950` generated via
|
|
46
|
+
`color-mix(in oklab, …)`.
|
|
47
|
+
- **Typography** — `font-size`, `--font-size-base`, Tailwind text tokens
|
|
48
|
+
(`--text-xs` … `--text-6xl`), compact scale (`--text--fs-*`), progressive
|
|
49
|
+
scale (`--text-fs-*`), and font weights (`--font-weight-*`).
|
|
50
|
+
- **Radii** — `--radius`, `--radius-sm`, `--radius-md`, `--radius-lg`,
|
|
51
|
+
`--radius-xl`, `--radius-2xl`, `--radius-3xl`.
|
|
52
|
+
- **Layout** — `--shop-max-width`, `--spacing`.
|
|
53
|
+
- **Component** — `--tooltip-*`, `--date-picker-*`, `--iconPicker-border`,
|
|
54
|
+
`--shadow-*`.
|
|
55
|
+
|
|
56
|
+
### Composable
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import { useThemeStyles } from 'vlite3'
|
|
60
|
+
|
|
61
|
+
const styles = useThemeStyles() // ComputedRef<ThemeStyles> | undefined
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Inside any descendant of `ThemeProvider`, `styles.value` is a reactive record
|
|
65
|
+
of every CSS variable the provider produced. Use it to read the resolved
|
|
66
|
+
theme (e.g. to compute a contrasting foreground) or to forward the styles
|
|
67
|
+
into a child component that takes a `:styles` prop (like `SidePanel`).
|
|
68
|
+
|
|
69
|
+
### Usage
|
|
70
|
+
|
|
71
|
+
```vue
|
|
72
|
+
<script setup lang="ts">
|
|
73
|
+
import { ThemeProvider, Button } from 'vlite3'
|
|
74
|
+
|
|
75
|
+
const storeTheme = {
|
|
76
|
+
bg: '#f5f5f4',
|
|
77
|
+
surface: '#ffffff',
|
|
78
|
+
primary: '#6366f1',
|
|
79
|
+
baseFontSize: 16,
|
|
80
|
+
headingScale: 1.25,
|
|
81
|
+
borderRadius: 8,
|
|
82
|
+
maxWidth: 1280,
|
|
83
|
+
}
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<template>
|
|
87
|
+
<ThemeProvider
|
|
88
|
+
:bg-color="storeTheme.bg"
|
|
89
|
+
:surface-color="storeTheme.surface"
|
|
90
|
+
:primary-color="storeTheme.primary"
|
|
91
|
+
:base-font-size="storeTheme.baseFontSize"
|
|
92
|
+
:scale-spacing-with-base-font-size="true"
|
|
93
|
+
:heading-scale="storeTheme.headingScale"
|
|
94
|
+
:border-radius="storeTheme.borderRadius"
|
|
95
|
+
:max-width="storeTheme.maxWidth">
|
|
96
|
+
<Button variant="primary">Save</Button>
|
|
97
|
+
</ThemeProvider>
|
|
98
|
+
</template>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Notes
|
|
102
|
+
|
|
103
|
+
- The wrapper applies a `dark` class when `bgColor` has luminance < 50%, so
|
|
104
|
+
consumers can opt into dark variants of custom styles via
|
|
105
|
+
`.vlite-theme-provider.dark .something { … }`.
|
|
106
|
+
- When `surfaceColor` is provided, `.bg-card` receives a complete color scope
|
|
107
|
+
with its own foreground, grays, borders, inputs, muted/secondary tokens,
|
|
108
|
+
semantic colors, charts, shadows, and the inherited primary brand palette.
|
|
109
|
+
Its luminance is evaluated independently from `bgColor`.
|
|
110
|
+
- `.bg-card-light` is an intentionally shallower companion Surface. Nested
|
|
111
|
+
`.bg-card` levels continue moving away from their parent to preserve visible
|
|
112
|
+
separation. When `surfaceColor` is omitted, the legacy root-derived card
|
|
113
|
+
behavior is preserved.
|
|
114
|
+
- `primaryColor` is the brand/action palette (`--color-primary*`). It does not
|
|
115
|
+
replace the neutral interaction token `--color-accent`.
|
|
116
|
+
- `headingScale` remains supported. Omitting it uses the existing `1.25`
|
|
117
|
+
default. Spacing remains exactly `0.25rem` unless the spacing opt-in is true;
|
|
118
|
+
with the opt-in it is `0.25rem * (baseFontSize / 16)`.
|
|
119
|
+
- Every generated root and card selector is tied to one provider instance, so
|
|
120
|
+
multiple providers can coexist without leaking palettes or spacing values.
|
|
121
|
+
- The provider is SSR-safe: theme tokens are pure computed values with no
|
|
122
|
+
`window` / `document` access at render time. Root CSS variables are written
|
|
123
|
+
as **inline styles** on the provider element so the first SSR HTML byte is
|
|
124
|
+
already themed (no blank overlay / client-only flash). A nested `<style>`
|
|
125
|
+
block still applies `!important` root tokens plus descendant `.bg-card`
|
|
126
|
+
scopes. Those style selectors use **unquoted** `[data-vlite-theme-provider=…]`
|
|
127
|
+
forms so Vue SSR text escaping cannot turn quotes into literal `"`
|
|
128
|
+
inside `<style>` rawtext (which does not decode HTML entities — quoted
|
|
129
|
+
selectors would only start matching after hydration). Color transitions are
|
|
130
|
+
deferred until after mount so hydration does not animate token application.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# ThemeToggle
|
|
2
|
+
|
|
3
|
+
**Import:** `import { ThemeToggle } from 'vlite3'`
|
|
4
|
+
|
|
5
|
+
### Description
|
|
6
|
+
|
|
7
|
+
A dedicated button component to toggle between light and dark modes. It utilizes the `useTheme` composable internally.
|
|
8
|
+
|
|
9
|
+
### Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| :-------- | :-------------- | :---------- | :------------------- |
|
|
13
|
+
| `variant` | `ButtonVariant` | `secondary` | Visual style |
|
|
14
|
+
| `size` | `ButtonSize` | — | Button dimensions |
|
|
15
|
+
| `rounded` | `ButtonRounded` | `md` | Border radius |
|
|
16
|
+
| `class` | `string` | — | Custom wrapper class |
|
|
17
|
+
|
|
18
|
+
### Slots
|
|
19
|
+
|
|
20
|
+
| Slot | Description | Props |
|
|
21
|
+
| :-------- | :--------------------------------------- | :----------------------------------------- |
|
|
22
|
+
| `default` | Custom content to replace default button | `{ toggleTheme: Function, theme: string }` |
|
|
23
|
+
|
|
24
|
+
### Usage
|
|
25
|
+
|
|
26
|
+
#### Basic Usage
|
|
27
|
+
|
|
28
|
+
```vue
|
|
29
|
+
<ThemeToggle />
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
#### With Custom Class
|
|
33
|
+
|
|
34
|
+
```vue
|
|
35
|
+
<ThemeToggle class="absolute top-4 right-4" />
|
|
36
|
+
```
|