@velkymx/vibeui 0.9.0 → 1.1.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/AGENTS.md +44 -0
- package/CLAUDE.md +48 -0
- package/README.md +222 -197
- package/dist/App.vue.d.ts +2 -1
- package/dist/components/HelloWorld.vue.d.ts +2 -1
- package/dist/components/VibeAccordion.vue.d.ts +39 -40
- package/dist/components/VibeAlert.vue.d.ts +21 -37
- package/dist/components/VibeAutocomplete.vue.d.ts +59 -31
- package/dist/components/VibeBadge.vue.d.ts +10 -18
- package/dist/components/VibeBreadcrumb.vue.d.ts +25 -21
- package/dist/components/VibeButton.vue.d.ts +13 -17
- package/dist/components/VibeButtonGroup.vue.d.ts +11 -19
- package/dist/components/VibeCard.vue.d.ts +51 -24
- package/dist/components/VibeCarousel.vue.d.ts +27 -49
- package/dist/components/VibeChartBar.vue.d.ts +61 -0
- package/dist/components/VibeChartLine.vue.d.ts +70 -0
- package/dist/components/VibeChartPie.vue.d.ts +34 -0
- package/dist/components/VibeCloseButton.vue.d.ts +9 -7
- package/dist/components/VibeCol.vue.d.ts +9 -17
- package/dist/components/VibeCollapse.vue.d.ts +24 -32
- package/dist/components/VibeContainer.vue.d.ts +9 -17
- package/dist/components/VibeDataTable.vue.d.ts +122 -63
- package/dist/components/VibeDatePicker.vue.d.ts +4 -6
- package/dist/components/VibeDraggable.vue.d.ts +9 -13
- package/dist/components/VibeDropdown.vue.d.ts +46 -43
- package/dist/components/VibeDroppable.vue.d.ts +9 -13
- package/dist/components/VibeFileInput.vue.d.ts +14 -20
- package/dist/components/VibeFormCheckbox.vue.d.ts +30 -22
- package/dist/components/VibeFormDatepicker.vue.d.ts +27 -30
- package/dist/components/VibeFormErrorSummary.vue.d.ts +17 -0
- package/dist/components/VibeFormGroup.vue.d.ts +10 -13
- package/dist/components/VibeFormInput.vue.d.ts +60 -25
- package/dist/components/VibeFormRadio.vue.d.ts +23 -24
- package/dist/components/VibeFormSelect.vue.d.ts +28 -34
- package/dist/components/VibeFormSpinbutton.vue.d.ts +31 -34
- package/dist/components/VibeFormSwitch.vue.d.ts +22 -23
- package/dist/components/VibeFormTextarea.vue.d.ts +24 -25
- package/dist/components/VibeFormWysiwyg.vue.d.ts +23 -22
- package/dist/components/VibeHero.vue.d.ts +117 -0
- package/dist/components/VibeIcon.vue.d.ts +27 -7
- package/dist/components/VibeInputGroup.vue.d.ts +12 -14
- package/dist/components/VibeLink.vue.d.ts +14 -18
- package/dist/components/VibeListGroup.vue.d.ts +26 -22
- package/dist/components/VibeModal.vue.d.ts +47 -45
- package/dist/components/VibeNav.vue.d.ts +40 -20
- package/dist/components/VibeNavbar.vue.d.ts +12 -19
- package/dist/components/VibeNavbarBrand.vue.d.ts +9 -17
- package/dist/components/VibeNavbarNav.vue.d.ts +52 -33
- package/dist/components/VibeNavbarToggle.vue.d.ts +7 -5
- package/dist/components/VibeOffcanvas.vue.d.ts +28 -43
- package/dist/components/VibePagination.vue.d.ts +38 -29
- package/dist/components/VibePlaceholder.vue.d.ts +9 -17
- package/dist/components/VibePopover.vue.d.ts +17 -40
- package/dist/components/VibeProgress.vue.d.ts +13 -21
- package/dist/components/VibeResizable.vue.d.ts +10 -14
- package/dist/components/VibeRow.vue.d.ts +9 -17
- package/dist/components/VibeScrollspy.vue.d.ts +37 -25
- package/dist/components/VibeSkeleton.vue.d.ts +2 -1
- package/dist/components/VibeSlider.vue.d.ts +4 -5
- package/dist/components/VibeSortable.vue.d.ts +37 -18
- package/dist/components/VibeSpinner.vue.d.ts +4 -7
- package/dist/components/VibeStepper.vue.d.ts +32 -31
- package/dist/components/VibeTab.vue.d.ts +7 -11
- package/dist/components/VibeTabContent.vue.d.ts +13 -31
- package/dist/components/VibeTabs.vue.d.ts +9 -13
- package/dist/components/VibeToast.vue.d.ts +31 -44
- package/dist/components/VibeToastHost.vue.d.ts +2 -1
- package/dist/components/VibeTooltip.vue.d.ts +16 -39
- package/dist/components/chart/chartColors.d.ts +3 -0
- package/dist/components/chart/chartResize.d.ts +2 -0
- package/dist/components/chart/chartTooltip.d.ts +2 -0
- package/dist/components/chart/chartTypes.d.ts +6 -0
- package/dist/components/chart/drawBar.d.ts +5 -0
- package/dist/components/chart/drawLine.d.ts +18 -0
- package/dist/components/chart/drawPie.d.ts +4 -0
- package/dist/components/dndStore.d.ts +1 -0
- package/dist/components/index.d.ts +6 -1
- package/dist/composables/useBreakpoints.d.ts +1 -0
- package/dist/composables/useColorMode.d.ts +1 -1
- package/dist/composables/useId.d.ts +1 -4
- package/dist/directives/vTooltip.d.ts +2 -3
- package/dist/injectionKeys.d.ts +34 -0
- package/dist/purify.es-eYghtX9j.mjs +735 -0
- package/dist/types.d.ts +23 -2
- package/dist/utils/routeKey.d.ts +11 -0
- package/dist/utils/safeCss.d.ts +16 -0
- package/dist/utils/safeHref.d.ts +7 -0
- package/dist/utils/sanitizeHtml.d.ts +13 -0
- package/dist/vibeui.css +2 -1
- package/dist/vibeui.es.js +8527 -5855
- package/dist/vibeui.umd.js +3 -1
- package/docs/README.md +225 -0
- package/docs/components/advanced/popover.md +125 -0
- package/docs/components/advanced/scrollspy.md +106 -0
- package/docs/components/advanced/tooltip.md +90 -0
- package/docs/components/card/card.md +223 -0
- package/docs/components/charts/chart-bar.md +129 -0
- package/docs/components/charts/chart-line.md +136 -0
- package/docs/components/charts/chart-pie.md +102 -0
- package/docs/components/core/alert.md +94 -0
- package/docs/components/core/badge.md +75 -0
- package/docs/components/core/button-group.md +99 -0
- package/docs/components/core/button.md +145 -0
- package/docs/components/core/close-button.md +82 -0
- package/docs/components/core/link.md +79 -0
- package/docs/components/core/placeholder.md +129 -0
- package/docs/components/core/skeleton.md +40 -0
- package/docs/components/core/spinner.md +103 -0
- package/docs/components/data/datatable.md +437 -0
- package/docs/components/hero/hero.md +65 -0
- package/docs/components/interactive/accordion.md +121 -0
- package/docs/components/interactive/carousel.md +112 -0
- package/docs/components/interactive/collapse.md +106 -0
- package/docs/components/interactive/date-picker.md +78 -0
- package/docs/components/interactive/draggable.md +91 -0
- package/docs/components/interactive/dropdown.md +129 -0
- package/docs/components/interactive/modal.md +151 -0
- package/docs/components/interactive/offcanvas.md +92 -0
- package/docs/components/interactive/resizable.md +73 -0
- package/docs/components/interactive/slider.md +57 -0
- package/docs/components/interactive/sortable.md +52 -0
- package/docs/components/interactive/stepper.md +83 -0
- package/docs/components/interactive/tabs.md +66 -0
- package/docs/components/interactive/toast.md +177 -0
- package/docs/components/layout/col.md +117 -0
- package/docs/components/layout/container.md +53 -0
- package/docs/components/layout/row.md +107 -0
- package/docs/components/list/list-group.md +225 -0
- package/docs/components/navigation/breadcrumb.md +120 -0
- package/docs/components/navigation/nav.md +151 -0
- package/docs/components/navigation/navbar.md +114 -0
- package/docs/components/navigation/pagination.md +163 -0
- package/docs/components/progress/progress.md +188 -0
- package/docs/composables/back-button.md +28 -0
- package/docs/composables/breakpoints.md +54 -0
- package/docs/composables/color-mode.md +179 -0
- package/docs/composables/use-form.md +78 -0
- package/docs/composables/use-position.md +68 -0
- package/docs/composables/use-toast.md +91 -0
- package/docs/directives/v-tooltip.md +58 -0
- package/docs/forms/README.md +87 -0
- package/docs/forms/autocomplete.md +96 -0
- package/docs/forms/file-input.md +97 -0
- package/docs/forms/form-checkbox.md +100 -0
- package/docs/forms/form-datepicker.md +80 -0
- package/docs/forms/form-error-summary.md +96 -0
- package/docs/forms/form-group.md +118 -0
- package/docs/forms/form-input.md +140 -0
- package/docs/forms/form-radio.md +82 -0
- package/docs/forms/form-select.md +98 -0
- package/docs/forms/form-spinbutton.md +94 -0
- package/docs/forms/form-switch.md +75 -0
- package/docs/forms/form-textarea.md +82 -0
- package/docs/forms/form-wysiwyg.md +99 -0
- package/docs/forms/input-group.md +70 -0
- package/docs/forms/validation.md +213 -0
- package/docs/getting-started/starter-template.md +136 -0
- package/docs/superpowers/plans/2026-05-12-vibe-charts.md +1999 -0
- package/docs/superpowers/plans/2026-05-29-e2e-browser-testing.md +615 -0
- package/docs/superpowers/specs/2026-05-12-charting-design.md +185 -0
- package/docs/superpowers/specs/2026-05-29-e2e-browser-testing-design.md +168 -0
- package/docs/utilities/position.md +82 -0
- package/docs/versioning.md +57 -0
- package/examples/README.md +201 -0
- package/examples/album.html +262 -0
- package/examples/blog.html +166 -0
- package/examples/carousel.html +114 -0
- package/examples/checkout.html +275 -0
- package/examples/cover.html +89 -0
- package/examples/dashboard.html +156 -0
- package/examples/index.html +129 -0
- package/examples/jumbotron.html +56 -0
- package/examples/mobile-dashboard.html +138 -0
- package/examples/pricing.html +172 -0
- package/examples/product.html +145 -0
- package/examples/sidebars.html +166 -0
- package/examples/sign-in.html +119 -0
- package/examples/starter.html +314 -0
- package/examples/sticky-footer-navbar.html +70 -0
- package/examples/sticky-footer.html +60 -0
- package/examples/test-simple.html +91 -0
- package/llms.txt +801 -0
- package/package.json +44 -14
- package/dist/types/index.d.ts +0 -6
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# v-vibe-tooltip
|
|
2
|
+
|
|
3
|
+
Inline tooltip directive. Equivalent to `<VibeTooltip>` but applied directly to the element, without a wrapper. Useful when adding tooltips to existing markup or many small elements (icons, button labels) where wrapping each is noisy.
|
|
4
|
+
|
|
5
|
+
Registered globally by `app.use(VibeUI)`.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<template>
|
|
11
|
+
<!-- String binding: tooltip title -->
|
|
12
|
+
<button v-vibe-tooltip="'Save changes'">
|
|
13
|
+
<VibeIcon name="save" />
|
|
14
|
+
</button>
|
|
15
|
+
|
|
16
|
+
<!-- Options object -->
|
|
17
|
+
<span v-vibe-tooltip="{ title: 'New tab', placement: 'right' }">
|
|
18
|
+
<VibeIcon name="external-link" />
|
|
19
|
+
</span>
|
|
20
|
+
</template>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Binding values
|
|
24
|
+
|
|
25
|
+
| Type | Behavior |
|
|
26
|
+
|------|----------|
|
|
27
|
+
| `string` | Sets the tooltip `title` |
|
|
28
|
+
| `{ title, placement, trigger }` | Full options |
|
|
29
|
+
| `undefined` | Renders nothing useful, but does not throw |
|
|
30
|
+
|
|
31
|
+
### Options
|
|
32
|
+
|
|
33
|
+
| Option | Type | Default | Description |
|
|
34
|
+
|--------|------|---------|-------------|
|
|
35
|
+
| `title` | `string` | — | Tooltip body. Aliases: `text`, `content` (whichever is set first wins) |
|
|
36
|
+
| `placement` | `TooltipPlacement` | `'top'` | Bootstrap placement |
|
|
37
|
+
| `trigger` | `string` | `'hover focus'` | Auto-swaps to `'click'` on touch devices |
|
|
38
|
+
|
|
39
|
+
> Tooltip content is always rendered as plain text (`html: false`). HTML in `title` is escaped; there is no `html` option on this directive.
|
|
40
|
+
|
|
41
|
+
## Direct import
|
|
42
|
+
|
|
43
|
+
For component-local registration without the plugin:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { vTooltip } from '@velkymx/vibeui'
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
directives: { 'vibe-tooltip': vTooltip }
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## When to use the component instead
|
|
54
|
+
|
|
55
|
+
`<VibeTooltip>` is better when:
|
|
56
|
+
- You want the tooltip body to come from a slot (rich content rather than a string).
|
|
57
|
+
- The triggering element is itself a slot of another component and you can't access it to bind a directive.
|
|
58
|
+
- You need imperative show/hide via the component's escape-hatch instance (`_unsafe_bsInstance`).
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# VibeUI Form Components
|
|
2
|
+
|
|
3
|
+
Form controls with built-in validation, accessibility, and Bootstrap 5.3 styling.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
VibeUI form controls integrate with Bootstrap and include validation and accessibility out of the box.
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
- **Bootstrap 5.3 styling** via native classes
|
|
12
|
+
- **Zero-boilerplate ids** — `id` props are optional and auto-generated
|
|
13
|
+
- **Accessible by default** — `VibeFormGroup` auto-links labels, help text, and feedback to its first child control
|
|
14
|
+
- **Two-way binding** with `v-model` on every control
|
|
15
|
+
- **Validation** — `useFormValidation`, `useForm`, and built-in `validators`
|
|
16
|
+
- **Fully typed** props, events, and APIs
|
|
17
|
+
|
|
18
|
+
## Recommended pattern: VibeFormGroup
|
|
19
|
+
|
|
20
|
+
Wrap a control in `VibeFormGroup` to auto-generate the id and wire the `<label>`, `aria-describedby`, help text, and validation feedback. The first child control consumes the group id (single-consumer rule).
|
|
21
|
+
|
|
22
|
+
```vue
|
|
23
|
+
<script setup lang="ts">
|
|
24
|
+
import { ref } from 'vue'
|
|
25
|
+
const email = ref('')
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<VibeFormGroup label="Email Address" help-text="We'll never share it.">
|
|
30
|
+
<VibeFormInput v-model="email" type="email" placeholder="Enter email" />
|
|
31
|
+
</VibeFormGroup>
|
|
32
|
+
</template>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Components
|
|
36
|
+
|
|
37
|
+
### Inputs
|
|
38
|
+
|
|
39
|
+
| Component | Description | Docs |
|
|
40
|
+
|-----------|-------------|------|
|
|
41
|
+
| VibeFormInput | Text, email, password, number, and other input types | [form-input.md](./form-input.md) |
|
|
42
|
+
| VibeInputGroup | Prepend/append text, buttons, or elements | [input-group.md](./input-group.md) |
|
|
43
|
+
| VibeFormTextarea | Multi-line text with optional char count | [form-textarea.md](./form-textarea.md) |
|
|
44
|
+
| VibeFormSelect | Single and multiple selection | [form-select.md](./form-select.md) |
|
|
45
|
+
| VibeFormSpinbutton | Number input with increment/decrement | [form-spinbutton.md](./form-spinbutton.md) |
|
|
46
|
+
| VibeFormDatepicker | Date, time, and datetime inputs | [form-datepicker.md](./form-datepicker.md) |
|
|
47
|
+
| VibeAutocomplete | Search-as-you-type with array/async source | [autocomplete.md](./autocomplete.md) |
|
|
48
|
+
| VibeFileInput | File picker with optional drag-and-drop | [file-input.md](./file-input.md) |
|
|
49
|
+
|
|
50
|
+
### Choice controls
|
|
51
|
+
|
|
52
|
+
| Component | Description | Docs |
|
|
53
|
+
|-----------|-------------|------|
|
|
54
|
+
| VibeFormCheckbox | Single checkbox or checkbox group | [form-checkbox.md](./form-checkbox.md) |
|
|
55
|
+
| VibeFormRadio | Radio button groups | [form-radio.md](./form-radio.md) |
|
|
56
|
+
| VibeFormSwitch | Toggle switch | [form-switch.md](./form-switch.md) |
|
|
57
|
+
|
|
58
|
+
### Advanced
|
|
59
|
+
|
|
60
|
+
| Component | Description | Docs |
|
|
61
|
+
|-----------|-------------|------|
|
|
62
|
+
| VibeFormWysiwyg | Rich-text editor (requires `quill` + `dompurify`) | [form-wysiwyg.md](./form-wysiwyg.md) |
|
|
63
|
+
| VibeFormGroup | Layout + automatic label/id/feedback linking | [form-group.md](./form-group.md) |
|
|
64
|
+
|
|
65
|
+
## Validation
|
|
66
|
+
|
|
67
|
+
See the [Validation Guide](./validation.md) for `useFormValidation`, `useForm`, the built-in `validators`, and async/API validation.
|
|
68
|
+
|
|
69
|
+
```vue
|
|
70
|
+
<script setup lang="ts">
|
|
71
|
+
import { useFormValidation, validators } from '@velkymx/vibeui'
|
|
72
|
+
|
|
73
|
+
const email = useFormValidation('')
|
|
74
|
+
const validateEmail = () =>
|
|
75
|
+
email.validate([validators.required(), validators.email()])
|
|
76
|
+
</script>
|
|
77
|
+
|
|
78
|
+
<template>
|
|
79
|
+
<VibeFormGroup
|
|
80
|
+
label="Email"
|
|
81
|
+
:validation-state="email.validationState"
|
|
82
|
+
:validation-message="email.validationMessage"
|
|
83
|
+
>
|
|
84
|
+
<VibeFormInput v-model="email.value" type="email" @validate="validateEmail" />
|
|
85
|
+
</VibeFormGroup>
|
|
86
|
+
</template>
|
|
87
|
+
```
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# VibeAutocomplete
|
|
2
|
+
|
|
3
|
+
Search-as-you-type input backed by an array or async source, with keyboard navigation. Generic over the item type `T`.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Prop | Type | Default | Description |
|
|
8
|
+
|------|------|---------|-------------|
|
|
9
|
+
| `modelValue` | `string` | `''` | The text value of the input (v-model). |
|
|
10
|
+
| `source` | `T[] \| (query: string) => T[] \| Promise<T[]>` | — (required) | Array to filter, or a function returning matches (sync or async). |
|
|
11
|
+
| `itemText` | `(item: T) => string` | `undefined` | Maps an item to its display/filter text. Defaults to the string form of the item. |
|
|
12
|
+
| `minChars` | `number` | `1` | Minimum characters before searching. |
|
|
13
|
+
| `debounce` | `number` | `200` | Debounce in ms before running a query (`0` disables debouncing). |
|
|
14
|
+
| `maxResults` | `number` | `10` | Maximum number of results shown. |
|
|
15
|
+
| `placeholder` | `string` | `''` | Placeholder text. |
|
|
16
|
+
| `label` | `string` | `undefined` | Label text. |
|
|
17
|
+
| `id` | `string` | auto-generated | Element id. |
|
|
18
|
+
| `disabled` | `boolean` | `false` | Disable the input. |
|
|
19
|
+
|
|
20
|
+
## Events
|
|
21
|
+
|
|
22
|
+
| Event | Payload | Description |
|
|
23
|
+
|-------|---------|-------------|
|
|
24
|
+
| `update:modelValue` | `string` | Emitted as the user types and when an item is selected. |
|
|
25
|
+
| `select` | `T` | Emitted with the chosen item when a result is selected. |
|
|
26
|
+
|
|
27
|
+
## Slots
|
|
28
|
+
|
|
29
|
+
| Slot | Scope | Description |
|
|
30
|
+
|------|-------|-------------|
|
|
31
|
+
| `item` | `{ item: T, index: number, label: string }` | Custom rendering for each result row. |
|
|
32
|
+
| `empty` | — | Content shown when there are no results. Defaults to "No results". |
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
### Array source
|
|
37
|
+
|
|
38
|
+
```vue
|
|
39
|
+
<script setup lang="ts">
|
|
40
|
+
import { ref } from 'vue'
|
|
41
|
+
const query = ref('')
|
|
42
|
+
const fruits = ['Apple', 'Apricot', 'Banana', 'Cherry', 'Mango']
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<template>
|
|
46
|
+
<VibeAutocomplete v-model="query" :source="fruits" label="Fruit" />
|
|
47
|
+
</template>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Async source with typed items
|
|
51
|
+
|
|
52
|
+
```vue
|
|
53
|
+
<script setup lang="ts">
|
|
54
|
+
import { ref } from 'vue'
|
|
55
|
+
|
|
56
|
+
interface User { id: number; name: string }
|
|
57
|
+
const value = ref('')
|
|
58
|
+
|
|
59
|
+
const search = async (q: string): Promise<User[]> => {
|
|
60
|
+
const res = await fetch(`/api/users?q=${encodeURIComponent(q)}`)
|
|
61
|
+
return res.json()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const onSelect = (user: User) => console.log('picked', user.id)
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<template>
|
|
68
|
+
<VibeAutocomplete
|
|
69
|
+
v-model="value"
|
|
70
|
+
:source="search"
|
|
71
|
+
:item-text="(u) => u.name"
|
|
72
|
+
:min-chars="2"
|
|
73
|
+
label="Assignee"
|
|
74
|
+
@select="onSelect"
|
|
75
|
+
>
|
|
76
|
+
<template #item="{ item }">
|
|
77
|
+
<strong>{{ item.name }}</strong> <small class="text-muted">#{{ item.id }}</small>
|
|
78
|
+
</template>
|
|
79
|
+
<template #empty>No users found</template>
|
|
80
|
+
</VibeAutocomplete>
|
|
81
|
+
</template>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Important Notes
|
|
85
|
+
|
|
86
|
+
- **Async race-safety:** in-flight async queries are token-guarded, so only the latest query's results are applied.
|
|
87
|
+
- **Keyboard support:** Arrow Up/Down move the highlight, Enter selects, Escape closes the menu. The combobox exposes `aria-expanded`, `aria-controls`, and `aria-activedescendant`.
|
|
88
|
+
- **Selection text:** selecting an item sets the input to the item's `itemText` (or string) value and emits both `update:modelValue` and `select`.
|
|
89
|
+
- **Outside click:** clicking outside the component closes the menu.
|
|
90
|
+
|
|
91
|
+
## Bootstrap CSS Classes
|
|
92
|
+
|
|
93
|
+
- `.form-control`
|
|
94
|
+
- `.form-label`
|
|
95
|
+
|
|
96
|
+
The dropdown menu, items, and empty state use VibeUI's own `.vibe-autocomplete*` classes (styled with Bootstrap CSS variables).
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# VibeFileInput
|
|
2
|
+
|
|
3
|
+
File attachment input with optional drag-and-drop zone. `v-model` exposes the selected files as `File[]`.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Prop | Type | Default | Description |
|
|
8
|
+
|------|------|---------|-------------|
|
|
9
|
+
| `modelValue` | `File[]` | `[]` | The accepted files (v-model). |
|
|
10
|
+
| `id` | `string` | auto-generated | Element id. |
|
|
11
|
+
| `label` | `string` | `undefined` | Label text. |
|
|
12
|
+
| `multiple` | `boolean` | `false` | Allow selecting multiple files. |
|
|
13
|
+
| `accept` | `string` | `undefined` | Comma-separated MIME types and/or extensions (e.g. `image/*,.pdf`). Used both as the native filter and for rejection. |
|
|
14
|
+
| `maxSize` | `number` | `undefined` | Maximum file size in bytes; larger files are rejected. |
|
|
15
|
+
| `dragDrop` | `boolean` | `false` | Render a drag-and-drop zone instead of the native control. |
|
|
16
|
+
| `disabled` | `boolean` | `false` | Disable the input. |
|
|
17
|
+
| `size` | `'sm' \| 'lg'` | `undefined` | Control size (native control only). |
|
|
18
|
+
| `helpText` | `string` | `undefined` | Help text below the input. |
|
|
19
|
+
| `dropzoneText` | `string` | `'Drag files here or click to browse'` | Text shown inside the drop zone. |
|
|
20
|
+
|
|
21
|
+
## Events
|
|
22
|
+
|
|
23
|
+
| Event | Payload | Description |
|
|
24
|
+
|-------|---------|-------------|
|
|
25
|
+
| `update:modelValue` | `File[]` | Emitted with the accepted files. |
|
|
26
|
+
| `change` | `File[]` | Emitted with the accepted files (mirrors `update:modelValue`). |
|
|
27
|
+
| `invalid` | `File[]` | Emitted with files rejected by `accept` or `maxSize`. |
|
|
28
|
+
|
|
29
|
+
## Slots
|
|
30
|
+
|
|
31
|
+
| Slot | Description |
|
|
32
|
+
|------|-------------|
|
|
33
|
+
| `dropzone` | Custom content for the drop zone (only when `dragDrop` is set). |
|
|
34
|
+
|
|
35
|
+
## Exposed methods
|
|
36
|
+
|
|
37
|
+
| Method | Description |
|
|
38
|
+
|--------|-------------|
|
|
39
|
+
| `clearFiles()` | Clears the native input and emits an empty selection. |
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
### Native input
|
|
44
|
+
|
|
45
|
+
```vue
|
|
46
|
+
<script setup lang="ts">
|
|
47
|
+
import { ref } from 'vue'
|
|
48
|
+
const files = ref<File[]>([])
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<VibeFileInput
|
|
53
|
+
v-model="files"
|
|
54
|
+
label="Attachment"
|
|
55
|
+
accept="image/*,.pdf"
|
|
56
|
+
:max-size="5 * 1024 * 1024"
|
|
57
|
+
help-text="Images or PDF, up to 5 MB."
|
|
58
|
+
/>
|
|
59
|
+
</template>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Drag-and-drop with rejection handling
|
|
63
|
+
|
|
64
|
+
```vue
|
|
65
|
+
<script setup lang="ts">
|
|
66
|
+
import { ref } from 'vue'
|
|
67
|
+
const files = ref<File[]>([])
|
|
68
|
+
|
|
69
|
+
const onInvalid = (rejected: File[]) => {
|
|
70
|
+
console.warn('Rejected:', rejected.map((f) => f.name))
|
|
71
|
+
}
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<template>
|
|
75
|
+
<VibeFileInput
|
|
76
|
+
v-model="files"
|
|
77
|
+
multiple
|
|
78
|
+
drag-drop
|
|
79
|
+
accept="image/*"
|
|
80
|
+
:max-size="2 * 1024 * 1024"
|
|
81
|
+
@invalid="onInvalid"
|
|
82
|
+
/>
|
|
83
|
+
</template>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Important Notes
|
|
87
|
+
|
|
88
|
+
- **Same-file reselection:** the native input is reset after each change so picking the same file again still fires `change`.
|
|
89
|
+
- **Rejection:** files failing `accept` or exceeding `maxSize` are excluded from the model and reported via the `invalid` event.
|
|
90
|
+
- **Drag safety:** a document-level fallback resets the dragging state if a drag ends or drops outside the zone.
|
|
91
|
+
|
|
92
|
+
## Bootstrap CSS Classes
|
|
93
|
+
|
|
94
|
+
- `.form-control`, `.form-control-{sm|lg}`
|
|
95
|
+
- `.form-label`, `.form-text`
|
|
96
|
+
|
|
97
|
+
The drop zone uses VibeUI's own `.vibe-file-input-dropzone*` classes.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# VibeFormCheckbox
|
|
2
|
+
|
|
3
|
+
Checkbox for a single boolean value or as part of a grouped multi-select (array model).
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Prop | Type | Default | Description |
|
|
8
|
+
|------|------|---------|-------------|
|
|
9
|
+
| `modelValue` | `boolean \| string \| number \| (string \| number \| boolean)[]` | `false` | v-model. A boolean (or `value`/`uncheckedValue`) for single checkboxes; an array for grouped checkboxes. |
|
|
10
|
+
| `value` | `string \| number \| boolean` | `true` | Value emitted/added to the array when checked. |
|
|
11
|
+
| `uncheckedValue` | `string \| number \| boolean` | `false` | Value emitted when unchecked (non-array model only). |
|
|
12
|
+
| `id` | `string` | auto-generated | Element id. Auto-generated, or inherited from a parent `VibeFormGroup`. |
|
|
13
|
+
| `label` | `string` | `undefined` | Checkbox label text. |
|
|
14
|
+
| `disabled` | `boolean` | `false` | Disable the checkbox. |
|
|
15
|
+
| `required` | `boolean` | `false` | Mark as required. |
|
|
16
|
+
| `inline` | `boolean` | `false` | Render inline (`.form-check-inline`). |
|
|
17
|
+
| `indeterminate` | `boolean` | `false` | Show the indeterminate (mixed) state. |
|
|
18
|
+
| `reverse` | `boolean` | `false` | Place the label before the checkbox (`.form-check-reverse`). |
|
|
19
|
+
| `validationState` | `'valid' \| 'invalid' \| null` | `null` | Visual validation state. |
|
|
20
|
+
| `validationMessage` | `string` | `undefined` | Feedback message for the current state. |
|
|
21
|
+
| `validationRules` | `ValidationRule[] \| ValidatorFunction` | `undefined` | Rules carried for use with a validation composable. |
|
|
22
|
+
| `validateOn` | `'change' \| 'blur'` | `'change'` | When the `validate` event fires. |
|
|
23
|
+
| `helpText` | `string` | `undefined` | Help text below the checkbox. |
|
|
24
|
+
|
|
25
|
+
## Events
|
|
26
|
+
|
|
27
|
+
| Event | Payload | Description |
|
|
28
|
+
|-------|---------|-------------|
|
|
29
|
+
| `update:modelValue` | `boolean \| string \| number \| (string \| number \| boolean)[]` | Emitted on toggle. Array result when the model is an array. |
|
|
30
|
+
| `change` | `Event` | Native change event. |
|
|
31
|
+
| `blur` | `FocusEvent` | Emitted on blur. |
|
|
32
|
+
| `focus` | `FocusEvent` | Emitted on focus. |
|
|
33
|
+
| `validate` | — | Emitted when the `validateOn` trigger occurs. |
|
|
34
|
+
|
|
35
|
+
## Slots
|
|
36
|
+
|
|
37
|
+
None.
|
|
38
|
+
|
|
39
|
+
## Usage
|
|
40
|
+
|
|
41
|
+
### Single checkbox
|
|
42
|
+
|
|
43
|
+
```vue
|
|
44
|
+
<script setup lang="ts">
|
|
45
|
+
import { ref } from 'vue'
|
|
46
|
+
const agreed = ref(false)
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<template>
|
|
50
|
+
<VibeFormCheckbox v-model="agreed" label="I accept the terms" />
|
|
51
|
+
</template>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Custom checked / unchecked values
|
|
55
|
+
|
|
56
|
+
```vue
|
|
57
|
+
<script setup lang="ts">
|
|
58
|
+
import { ref } from 'vue'
|
|
59
|
+
const status = ref('off')
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<template>
|
|
63
|
+
<VibeFormCheckbox
|
|
64
|
+
v-model="status"
|
|
65
|
+
value="on"
|
|
66
|
+
unchecked-value="off"
|
|
67
|
+
label="Enable feature"
|
|
68
|
+
/>
|
|
69
|
+
</template>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Grouped checkboxes (array model)
|
|
73
|
+
|
|
74
|
+
```vue
|
|
75
|
+
<script setup lang="ts">
|
|
76
|
+
import { ref } from 'vue'
|
|
77
|
+
const selected = ref<string[]>([])
|
|
78
|
+
</script>
|
|
79
|
+
|
|
80
|
+
<template>
|
|
81
|
+
<VibeFormGroup label="Interests">
|
|
82
|
+
<VibeFormCheckbox v-model="selected" value="vue" label="Vue" />
|
|
83
|
+
<VibeFormCheckbox v-model="selected" value="ts" label="TypeScript" />
|
|
84
|
+
<VibeFormCheckbox v-model="selected" value="css" label="CSS" />
|
|
85
|
+
</VibeFormGroup>
|
|
86
|
+
</template>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Important Notes
|
|
90
|
+
|
|
91
|
+
- **Array vs. single model:** if `modelValue` is an array, checking adds `value` and unchecking removes it. Otherwise the model toggles between `value` and `uncheckedValue`.
|
|
92
|
+
- **Indeterminate:** purely visual; it does not change the checked value and is reset once the user toggles.
|
|
93
|
+
- **Group linking:** in a grouped layout, the first checkbox consumes the `VibeFormGroup` id; subsequent checkboxes generate their own ids.
|
|
94
|
+
|
|
95
|
+
## Bootstrap CSS Classes
|
|
96
|
+
|
|
97
|
+
- `.form-check`
|
|
98
|
+
- `.form-check-input`, `.form-check-label`
|
|
99
|
+
- `.form-check-inline`, `.form-check-reverse`
|
|
100
|
+
- `.is-valid`, `.is-invalid`
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# VibeFormDatepicker
|
|
2
|
+
|
|
3
|
+
Date, time, and datetime input using the native browser pickers, with built-in validation and accessibility.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Prop | Type | Default | Description |
|
|
8
|
+
|------|------|---------|-------------|
|
|
9
|
+
| `modelValue` | `string` | `''` | The value (v-model) as an ISO-style string matching the chosen `type` (e.g. `2026-05-28`). |
|
|
10
|
+
| `type` | `'date' \| 'time' \| 'datetime-local' \| 'month' \| 'week'` | `'date'` | Native picker type. |
|
|
11
|
+
| `id` | `string` | auto-generated | Element id. Auto-generated, or inherited from a parent `VibeFormGroup`. |
|
|
12
|
+
| `label` | `string` | `undefined` | Standalone label text. |
|
|
13
|
+
| `disabled` | `boolean` | `false` | Disable the input. |
|
|
14
|
+
| `readonly` | `boolean` | `false` | Make the input read-only. |
|
|
15
|
+
| `required` | `boolean` | `false` | Mark as required. |
|
|
16
|
+
| `min` | `string` | `undefined` | Minimum allowed value. |
|
|
17
|
+
| `max` | `string` | `undefined` | Maximum allowed value. |
|
|
18
|
+
| `size` | `'sm' \| 'lg'` | `undefined` | Control size. |
|
|
19
|
+
| `validationState` | `'valid' \| 'invalid' \| null` | `null` | Visual validation state. |
|
|
20
|
+
| `validationMessage` | `string` | `undefined` | Feedback message for the current state. |
|
|
21
|
+
| `validationRules` | `ValidationRule[] \| ValidatorFunction` | `undefined` | Rules carried for use with a validation composable. |
|
|
22
|
+
| `validateOn` | `'input' \| 'blur' \| 'change'` | `'blur'` | When the `validate` event fires. |
|
|
23
|
+
| `helpText` | `string` | `undefined` | Help text below the input. |
|
|
24
|
+
|
|
25
|
+
## Events
|
|
26
|
+
|
|
27
|
+
| Event | Payload | Description |
|
|
28
|
+
|-------|---------|-------------|
|
|
29
|
+
| `update:modelValue` | `string` | Emitted on input. |
|
|
30
|
+
| `input` | `Event` | Native input event. |
|
|
31
|
+
| `change` | `Event` | Native change event. |
|
|
32
|
+
| `blur` | `FocusEvent` | Emitted on blur. |
|
|
33
|
+
| `focus` | `FocusEvent` | Emitted on focus. |
|
|
34
|
+
| `validate` | — | Emitted when the `validateOn` trigger occurs. |
|
|
35
|
+
|
|
36
|
+
## Slots
|
|
37
|
+
|
|
38
|
+
None.
|
|
39
|
+
|
|
40
|
+
## Usage
|
|
41
|
+
|
|
42
|
+
### Recommended: inside a VibeFormGroup
|
|
43
|
+
|
|
44
|
+
```vue
|
|
45
|
+
<script setup lang="ts">
|
|
46
|
+
import { ref } from 'vue'
|
|
47
|
+
const startDate = ref('')
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<VibeFormGroup label="Start Date">
|
|
52
|
+
<VibeFormDatepicker v-model="startDate" type="date" min="2026-01-01" />
|
|
53
|
+
</VibeFormGroup>
|
|
54
|
+
</template>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Standalone
|
|
58
|
+
|
|
59
|
+
```vue
|
|
60
|
+
<script setup lang="ts">
|
|
61
|
+
import { ref } from 'vue'
|
|
62
|
+
const meetingTime = ref('')
|
|
63
|
+
</script>
|
|
64
|
+
|
|
65
|
+
<template>
|
|
66
|
+
<VibeFormDatepicker v-model="meetingTime" label="Meeting Time" type="datetime-local" />
|
|
67
|
+
</template>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Important Notes
|
|
71
|
+
|
|
72
|
+
- **String model only:** `modelValue` must be a string. When using a validation composable, bind to `.value` (e.g. `v-model="field.value"`), not the field object — a dev-mode warning is logged otherwise.
|
|
73
|
+
- **Native pickers:** rendering and locale formatting come from the browser's native input, so the on-screen appearance varies by platform.
|
|
74
|
+
- **Group linking:** wrapped in a `VibeFormGroup`, the input consumes the group id so the label and feedback link automatically.
|
|
75
|
+
|
|
76
|
+
## Bootstrap CSS Classes
|
|
77
|
+
|
|
78
|
+
- `.form-control`
|
|
79
|
+
- `.form-control-{sm|lg}`
|
|
80
|
+
- `.is-valid`, `.is-invalid`
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# VibeFormErrorSummary
|
|
2
|
+
|
|
3
|
+
Top-of-form error summary that lists all field errors in one place with links to the offending fields. Satisfies WCAG 3.3.1 (Error Identification) for forms with multiple validation errors.
|
|
4
|
+
|
|
5
|
+
## Props
|
|
6
|
+
|
|
7
|
+
| Prop | Type | Required | Description |
|
|
8
|
+
|------|------|----------|-------------|
|
|
9
|
+
| `errors` | `Record<string, string>` | yes | Map of field name → error message. Entries with an empty string are ignored. |
|
|
10
|
+
|
|
11
|
+
## Events
|
|
12
|
+
|
|
13
|
+
| Event | Payload | Description |
|
|
14
|
+
|-------|---------|-------------|
|
|
15
|
+
| `focus` | `string` | Emitted when the user clicks an error link. Payload is the field key. Use it to programmatically focus the field. |
|
|
16
|
+
|
|
17
|
+
## Slots
|
|
18
|
+
|
|
19
|
+
None.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
### Basic
|
|
24
|
+
|
|
25
|
+
```vue
|
|
26
|
+
<script setup lang="ts">
|
|
27
|
+
import { reactive } from 'vue'
|
|
28
|
+
|
|
29
|
+
const errors = reactive<Record<string, string>>({
|
|
30
|
+
email: '',
|
|
31
|
+
password: '',
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
function handleSubmit() {
|
|
35
|
+
errors.email = ''
|
|
36
|
+
errors.password = ''
|
|
37
|
+
if (!form.email) errors.email = 'Email is required.'
|
|
38
|
+
if (!form.password) errors.password = 'Password must be at least 8 characters.'
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function focusField(key: string) {
|
|
42
|
+
document.getElementById(`field-${key}`)?.focus()
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<form @submit.prevent="handleSubmit">
|
|
48
|
+
<VibeFormErrorSummary :errors="errors" @focus="focusField" />
|
|
49
|
+
|
|
50
|
+
<VibeFormGroup label="Email" required :validation-state="errors.email ? 'invalid' : null" :validation-message="errors.email">
|
|
51
|
+
<VibeFormInput id="field-email" v-model="form.email" type="email" autocomplete="email" />
|
|
52
|
+
</VibeFormGroup>
|
|
53
|
+
|
|
54
|
+
<VibeFormGroup label="Password" required :validation-state="errors.password ? 'invalid' : null" :validation-message="errors.password">
|
|
55
|
+
<VibeFormInput id="field-password" v-model="form.password" type="password" autocomplete="current-password" />
|
|
56
|
+
</VibeFormGroup>
|
|
57
|
+
|
|
58
|
+
<VibeButton type="submit" variant="primary">Sign in</VibeButton>
|
|
59
|
+
</form>
|
|
60
|
+
</template>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### With useForm
|
|
64
|
+
|
|
65
|
+
```vue
|
|
66
|
+
<script setup lang="ts">
|
|
67
|
+
import { useForm, validators } from '@velkymx/vibeui'
|
|
68
|
+
|
|
69
|
+
const { fields, errors, handleSubmit } = useForm({
|
|
70
|
+
email: { value: '', rules: [validators.required(), validators.email()] },
|
|
71
|
+
password: { value: '', rules: [validators.required(), validators.minLength(8)] },
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
function focusField(key: string) {
|
|
75
|
+
document.getElementById(`field-${key}`)?.focus()
|
|
76
|
+
}
|
|
77
|
+
</script>
|
|
78
|
+
|
|
79
|
+
<template>
|
|
80
|
+
<form @submit.prevent="handleSubmit">
|
|
81
|
+
<VibeFormErrorSummary :errors="errors" @focus="focusField" />
|
|
82
|
+
<!-- fields … -->
|
|
83
|
+
</form>
|
|
84
|
+
</template>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Important Notes
|
|
88
|
+
|
|
89
|
+
- **Anchor convention:** error links use `href="#field-{key}"`. Set `:id="\`field-${key}\`"` on each input so the links resolve (and so `focusField` can look them up). The component itself does not set these ids — you control the field ids.
|
|
90
|
+
- **`role="alert"` (WCAG 4.1.3):** the container carries `role="alert" aria-live="polite"` so screen readers announce the error list automatically when errors appear, without requiring focus.
|
|
91
|
+
- **Auto-hides when clean:** when all `errors` values are empty strings the summary renders nothing. No need to conditionally mount it.
|
|
92
|
+
- **`@focus` vs native anchor:** the `@click.prevent` on each link suppresses the default scroll-to-anchor jump and lets you implement the focus strategy (e.g. scroll + focus, or open a collapsed section first).
|
|
93
|
+
|
|
94
|
+
## Bootstrap CSS Classes
|
|
95
|
+
|
|
96
|
+
- `.alert`, `.alert-danger`
|