@appsbd/vue3-appsbd-ui 1.0.19 → 1.0.21
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/.ai/ai_ref_AbAccordion.md +69 -0
- package/.ai/ai_ref_AbAccordionItem.md +48 -0
- package/.ai/ai_ref_AbActionButton.md +151 -0
- package/.ai/ai_ref_AbButton.md +5 -2
- package/.ai/ai_ref_AbColorPicker.md +1 -1
- package/.ai/ai_ref_AbDateTimePicker.md +3 -3
- package/.ai/ai_ref_AbFileUploader.md +43 -2
- package/.ai/ai_ref_AbFilterPanel.md +6 -5
- package/.ai/ai_ref_AbInputField.md +26 -6
- package/.ai/ai_ref_AbMultiSelect.md +3 -3
- package/.ai/ai_ref_AbNumberField.md +22 -14
- package/.ai/ai_ref_AbToggle.md +5 -0
- package/.ai/ai_ref_migration_guide.md +5 -0
- package/.ai/ai_ref_usage_guide.md +411 -0
- package/AI_REFERENCE.md +8 -3
- package/CHANGELOG.md +39 -2
- package/dist/style.css +1 -1
- package/dist/vue3-appsbd-ui.cjs.js +91 -81
- package/dist/vue3-appsbd-ui.es.js +11537 -10664
- package/package.json +1 -1
- package/readme.md +1 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# AbAccordion — AI Reference
|
|
2
|
+
|
|
3
|
+
Group container for a vertically stacked set of collapsible sections (shadcn-style accordion). Controls open/close behavior (single vs. multiple open) and the shared icon position / title / body background colors for every child. Wrap `AbAccordionItem` children inside it. Use it instead of `AbTabs` when content should stack vertically and reveal on demand, rather than switching between panels.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Globally registered by the plugin — use `<ab-accordion>` directly, or `import { AbAccordion } from "vue3-appsbd-ui"`. No extra peer dependency required; the default trigger icon uses Bootstrap Icons (`bi bi-chevron-down`), already a peer dependency of this library.
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```vue
|
|
12
|
+
<template>
|
|
13
|
+
<ab-accordion>
|
|
14
|
+
<ab-accordion-item title="Is it accessible?" default-open>
|
|
15
|
+
<p>Yes. It follows the WAI-ARIA design pattern.</p>
|
|
16
|
+
</ab-accordion-item>
|
|
17
|
+
<ab-accordion-item title="Is it styled?">
|
|
18
|
+
<p>Yes. It ships with modern default styles.</p>
|
|
19
|
+
</ab-accordion-item>
|
|
20
|
+
</ab-accordion>
|
|
21
|
+
</template>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Multiple items open at once, icon on the left, custom colors:
|
|
25
|
+
|
|
26
|
+
```vue
|
|
27
|
+
<ab-accordion multiple icon-position="left" title-bg-color="#f8f5ff" body-bg-color="#fdfcff">
|
|
28
|
+
<ab-accordion-item title="First">...</ab-accordion-item>
|
|
29
|
+
<ab-accordion-item title="Second">...</ab-accordion-item>
|
|
30
|
+
</ab-accordion>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Responsive: expanded, non-collapsible sections on large screens, accordion on small screens:
|
|
34
|
+
|
|
35
|
+
```vue
|
|
36
|
+
<ab-accordion variant="responsive" breakpoint="md">
|
|
37
|
+
<ab-accordion-item title="Overview">...</ab-accordion-item>
|
|
38
|
+
<ab-accordion-item title="Details">...</ab-accordion-item>
|
|
39
|
+
</ab-accordion>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Props
|
|
43
|
+
|
|
44
|
+
| Name | Type | Default | Description |
|
|
45
|
+
| --- | --- | --- | --- |
|
|
46
|
+
| `multiple` | `Boolean` | `false` | When `true`, more than one item can be open at once. When `false` (default), opening an item closes any other open item in the group. |
|
|
47
|
+
| `variant` | `String` | `"default"` | `"default"` (always an accordion) or `"responsive"`. With `"responsive"`, at viewport widths >= `breakpoint` every item is always expanded and shows no toggle icon/button (static sections, not clickable); below it, it behaves as a normal accordion, collapsed by default (unless an item has `defaultOpen`). |
|
|
48
|
+
| `breakpoint` | `String` | `"lg"` | Only used by `variant="responsive"`. Bootstrap breakpoint at/above which items become static: `"sm"` (576px), `"md"` (768px), `"lg"` (992px), `"xl"` (1200px), `"xxl"` (1400px). |
|
|
49
|
+
| `iconPosition` | `String` | `"right"` | Where the expand/collapse icon renders on every child item's trigger: `"left"` or `"right"`. Applies to the whole group, not set per item. |
|
|
50
|
+
| `titleBgColor` | `String` | `"#fff"` | Background color applied to every child item's title/trigger row. Accepts a hex or `rgb()`/`rgba()` string; the trigger's text color is automatically switched to a light or dark shade based on this background's luminance, so it stays readable regardless of the surrounding app theme (light or dark mode). |
|
|
51
|
+
| `bodyBgColor` | `String` | `"#fff"` | Background color applied to every child item's expanded body panel. Same automatic text-contrast behavior as `titleBgColor`. |
|
|
52
|
+
|
|
53
|
+
## Events
|
|
54
|
+
|
|
55
|
+
None — open/close state is managed internally via `provide`/`inject` with child `AbAccordionItem`s.
|
|
56
|
+
|
|
57
|
+
## Slots
|
|
58
|
+
|
|
59
|
+
| Name | Description |
|
|
60
|
+
| --- | --- |
|
|
61
|
+
| `default` | Accepts `AbAccordionItem` children. |
|
|
62
|
+
|
|
63
|
+
## v-model
|
|
64
|
+
|
|
65
|
+
No — open/close state is internal per item (see [`AbAccordionItem`](./ai_ref_AbAccordionItem.md)'s `defaultOpen`), not bound on `AbAccordion`.
|
|
66
|
+
|
|
67
|
+
## Provides
|
|
68
|
+
|
|
69
|
+
Provides an `apbdAccordion` context (`iconPosition`, `titleBgColor`, `bodyBgColor`, internal `isStatic`/`toggleItem`/`isItemOpen`) consumed by every descendant `AbAccordionItem`. An `AbAccordionItem` rendered outside an `AbAccordion` has nothing to inject and will not work.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# AbAccordionItem — AI Reference
|
|
2
|
+
|
|
3
|
+
Single collapsible row inside an [`AbAccordion`](./ai_ref_AbAccordion.md) group. Must be used inside an `AbAccordion` parent — it injects shared context (icon position, colors, open/close control) from there. The body slot accepts any content: plain text, an `AbCard`, or any other component.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```vue
|
|
8
|
+
<ab-accordion>
|
|
9
|
+
<ab-accordion-item title="Is it accessible?" default-open>
|
|
10
|
+
<p>Yes. It follows the WAI-ARIA design pattern.</p>
|
|
11
|
+
</ab-accordion-item>
|
|
12
|
+
</ab-accordion>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Custom icon (scoped slot receives `{ isOpen }`):
|
|
16
|
+
|
|
17
|
+
```vue
|
|
18
|
+
<ab-accordion-item title="Custom icon">
|
|
19
|
+
<template #icon="{ isOpen }">
|
|
20
|
+
<i :class="isOpen ? 'bi bi-dash-lg' : 'bi bi-plus-lg'"></i>
|
|
21
|
+
</template>
|
|
22
|
+
<p>Body content...</p>
|
|
23
|
+
</ab-accordion-item>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Props
|
|
27
|
+
|
|
28
|
+
| Name | Type | Default | Description |
|
|
29
|
+
| --- | --- | --- | --- |
|
|
30
|
+
| `title` | `String` | `""` | Label shown in the trigger row. Ignored if the `title` slot is provided. |
|
|
31
|
+
| `disabled` | `Boolean` | `false` | Prevents the item from being toggled (trigger renders as a disabled `<button>`). |
|
|
32
|
+
| `defaultOpen` | `Boolean` | `false` | Opens the item on mount. |
|
|
33
|
+
|
|
34
|
+
## Slots
|
|
35
|
+
|
|
36
|
+
| Name | Description |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| `default` | The expandable body content. Accepts any markup or component. Animates open/closed with a smooth height transition (not an abrupt toggle). |
|
|
39
|
+
| `title` | Overrides the trigger label instead of using the `title` prop. |
|
|
40
|
+
| `icon` | Overrides the default chevron icon. Receives `{ isOpen: Boolean }` so a custom icon can reflect the item's expanded state. |
|
|
41
|
+
|
|
42
|
+
## v-model
|
|
43
|
+
|
|
44
|
+
No — open/close state is internal, driven by `defaultOpen` on mount and toggled by clicking the trigger (or via the parent `AbAccordion`'s `multiple`/single-open rule).
|
|
45
|
+
|
|
46
|
+
## Injects
|
|
47
|
+
|
|
48
|
+
Injects the `apbdAccordion` context provided by the parent `AbAccordion` (`iconPosition`, `titleBgColor`, `bodyBgColor`, `toggleItem`, `isItemOpen`).
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# AbActionButton — AI Reference
|
|
2
|
+
|
|
3
|
+
Thin wrapper around `AbButton` for CRUD-style actions (add, edit, save, delete, cancel, and more). Each action resolves to a default label/icon/color preset; the component emits a single `action` event on click (after an optional confirmation step for actions like `delete`) and never performs the underlying business logic itself — the parent owns the workflow. Two modes, mutually exclusive:
|
|
4
|
+
|
|
5
|
+
- **Single** (`action` prop, a string) — renders one button. Typically used for a state-changing button where the parent changes `action` in response (e.g. `edit` → `save` → `add`).
|
|
6
|
+
- **Group** (`actions` prop, an array) — renders a whole row of action buttons from **one** component instance instead of repeating `<AbActionButton action="..." />` per action. Use this whenever a row/card needs several fixed actions at once (e.g. View + Edit + Delete on a table row).
|
|
7
|
+
|
|
8
|
+
When `actions` is a non-empty array it takes over rendering and `action`/`label`/`icon`/`color`/`variant`/`confirm`/`confirmOptions` (the single-mode props) are ignored — set those per-item inside the array instead.
|
|
9
|
+
|
|
10
|
+
Prefer this over a raw `AbButton` whenever a button's meaning is one of the CRUD-style actions, whether alone or as part of a fixed group.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
Not globally registered — import explicitly. Icons are rendered via `@lucide/vue` (already a peer dependency).
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
import { AbActionButton } from "vue3-appsbd-ui";
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
Single action:
|
|
23
|
+
|
|
24
|
+
```vue
|
|
25
|
+
<template>
|
|
26
|
+
<ab-action-button action="edit" @action="handleAction" />
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<script setup>
|
|
30
|
+
function handleAction(action) {
|
|
31
|
+
console.log(action); // "edit"
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Group of actions — one component renders the whole row:
|
|
37
|
+
|
|
38
|
+
```vue
|
|
39
|
+
<template>
|
|
40
|
+
<ab-action-button :actions="['view', 'edit', 'delete']" @action="handleRowAction" />
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script setup>
|
|
44
|
+
function handleRowAction(action) {
|
|
45
|
+
// "view" | "edit" | "delete"
|
|
46
|
+
}
|
|
47
|
+
</script>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Per-item overrides (array items can be plain strings or objects — mix freely):
|
|
51
|
+
|
|
52
|
+
```vue
|
|
53
|
+
<template>
|
|
54
|
+
<ab-action-button
|
|
55
|
+
:actions="[
|
|
56
|
+
'view',
|
|
57
|
+
{ action: 'edit', disabled: !canEdit },
|
|
58
|
+
{ action: 'delete', confirmOptions: { message: 'This user will be permanently removed.' } },
|
|
59
|
+
{ action: 'approve', label: 'Approve', icon: CircleCheckBig, color: 'success', show: isPending },
|
|
60
|
+
]"
|
|
61
|
+
@action="handleRowAction"
|
|
62
|
+
/>
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script setup>
|
|
66
|
+
import { CircleCheckBig } from '@lucide/vue';
|
|
67
|
+
</script>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
State-change workflow (single mode, parent decides what the button becomes next):
|
|
71
|
+
|
|
72
|
+
```vue
|
|
73
|
+
<template>
|
|
74
|
+
<ab-action-button :action="rowAction" :loading="isSaving" @action="handleRowAction" />
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<script setup>
|
|
78
|
+
import { ref } from 'vue';
|
|
79
|
+
|
|
80
|
+
const rowAction = ref('edit');
|
|
81
|
+
const isSaving = ref(false);
|
|
82
|
+
|
|
83
|
+
function handleRowAction(action) {
|
|
84
|
+
if (action === 'edit') {
|
|
85
|
+
rowAction.value = 'save';
|
|
86
|
+
} else if (action === 'save') {
|
|
87
|
+
isSaving.value = true;
|
|
88
|
+
saveToServer().then(() => {
|
|
89
|
+
isSaving.value = false;
|
|
90
|
+
rowAction.value = 'add';
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
</script>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Delete with a custom confirmation message (built-in confirm uses `useAlert`):
|
|
98
|
+
|
|
99
|
+
```vue
|
|
100
|
+
<ab-action-button
|
|
101
|
+
action="delete"
|
|
102
|
+
:confirm-options="{ message: 'This user will be permanently removed.' }"
|
|
103
|
+
@action="handleDelete"
|
|
104
|
+
/>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Custom action (not in the predefined set):
|
|
108
|
+
|
|
109
|
+
```vue
|
|
110
|
+
<script setup>
|
|
111
|
+
import { CircleCheckBig } from '@lucide/vue';
|
|
112
|
+
</script>
|
|
113
|
+
|
|
114
|
+
<template>
|
|
115
|
+
<ab-action-button action="approve" label="Approve" :icon="CircleCheckBig" color="success" @action="handleApprove" />
|
|
116
|
+
</template>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Props
|
|
120
|
+
|
|
121
|
+
| Name | Type | Default | Description |
|
|
122
|
+
| --- | --- | --- | --- |
|
|
123
|
+
| `action` | `String` | `null` | Single-mode action key. Presets: `add`, `edit`, `save`, `delete`, `cancel`, `view`, `close`, `submit`. Any other string is accepted as a custom action. Ignored when `actions` is a non-empty array. |
|
|
124
|
+
| `actions` | `Array` | `[]` | Group mode. Each item is either a plain action-key `String`, or an `Object`: `{ action, label?, icon?, color?, variant?, loading?, disabled?, confirm?, confirmOptions?, show?, ...otherAbButtonProps }`. `action` is required per item; every other key falls back the same way the single-mode props do (item override → preset → built-in default). `show` (`Boolean`, default `true`) conditionally excludes that button from the row. Unrecognized keys on an item (e.g. `size`, `isRounded`) are forwarded straight through to that item's `AbButton`, same as extra attrs in single mode. |
|
|
125
|
+
| `label` | `String` | `null` | Single mode only. Overrides the preset label. Falls back to the preset's label, then to the raw `action` string. |
|
|
126
|
+
| `icon` | `Component` \| `Boolean` | `null` | Single mode only. Overrides the preset icon (a `@lucide/vue` icon component). Pass `false` to force no icon. |
|
|
127
|
+
| `color` | `String` | `null` | Single mode only. Overrides the preset `AbButton` `color`. Falls back to the preset's color, then `"primary"`. |
|
|
128
|
+
| `variant` | `String` | `null` | Single mode only. Overrides the preset `AbButton` `variant` (`solid`, `outline`, `animated-round`). Falls back to the preset's variant, then `"solid"`. |
|
|
129
|
+
| `loading` | `Boolean` | `false` | Single mode only. Maps to `AbButton`'s `is-animated`. Also disables the button while `true`. In group mode, set `loading` per item instead. |
|
|
130
|
+
| `disabled` | `Boolean` | `false` | Single mode only. Disables the button (combined with `loading`). In group mode, set `disabled` per item instead. |
|
|
131
|
+
| `confirm` | `Boolean` | `null` | Single mode only. Whether to show a confirmation dialog before emitting the action. Falls back to the preset's default (`true` only for `delete`), then `false`. |
|
|
132
|
+
| `confirmOptions` | `Object` | `{}` | Single mode only. Shallow-merged into the confirmation dialog's options (`title`, `message`, `icon`, `confirmText`, `cancelText`, …) — same shape `useAlert`'s `alert()` accepts. |
|
|
133
|
+
|
|
134
|
+
Any other prop supported by `AbButton` (`size`, `mode`, `isRounded`, `isIconBtn`, `iconPosition`, `showIconDivider`, …) can be passed directly on `<AbActionButton>` and is forwarded through unchanged (standard Vue attrs fallthrough) — applied to the single button in single mode, or to **every** button in group mode (overridable per item, since an item's own matching key wins).
|
|
135
|
+
|
|
136
|
+
## Events
|
|
137
|
+
|
|
138
|
+
| Event | Payload | Description |
|
|
139
|
+
| --- | --- | --- |
|
|
140
|
+
| `action` | `(action: String, event: MouseEvent)` | Fired once an action is approved — immediately, or after the user confirms (for actions with `confirm` truthy). In group mode, fired per-button with that button's own action key. The component performs no business logic itself. |
|
|
141
|
+
|
|
142
|
+
## Slots
|
|
143
|
+
|
|
144
|
+
| Name | Description |
|
|
145
|
+
| --- | --- |
|
|
146
|
+
| `default` | Single mode only. Overrides the button's label content (defaults to the resolved label). |
|
|
147
|
+
| `action` | Group mode only. Overrides each button's label content. Scoped: `{ item, action }` — `item` is the fully resolved `{ action, label, icon, color, variant, loading, disabled, confirm, confirmOptions, show }` object for that button, `action` is its key. Defaults to `item.label`. |
|
|
148
|
+
|
|
149
|
+
## v-model
|
|
150
|
+
|
|
151
|
+
None.
|
package/.ai/ai_ref_AbButton.md
CHANGED
|
@@ -20,6 +20,9 @@ Customizable button with optional loader animation and leading icon slot.
|
|
|
20
20
|
<ab-button color="primary" :is-animated="isSaving" is-hide-text-on-animate>
|
|
21
21
|
Save
|
|
22
22
|
</ab-button>
|
|
23
|
+
|
|
24
|
+
<!-- Preset: rounded + animated (text auto-hidden), no extra props -->
|
|
25
|
+
<ab-button color="success" variant="animated-round" :is-animated="isSaving">Save</ab-button>
|
|
23
26
|
</template>
|
|
24
27
|
|
|
25
28
|
<script setup>
|
|
@@ -35,13 +38,13 @@ const isSaving = ref(false);
|
|
|
35
38
|
| `mode` | `String` | `"button"` | Sets the root tag (`button`, `link`, `router-link`). |
|
|
36
39
|
| `type` | `String` | `"button"` | Native button type (`button`, `submit`, `reset`). |
|
|
37
40
|
| `color` | `String` | `"primary"` | Color variant (primary, secondary, success, danger, warning, info, light, dark). |
|
|
38
|
-
| `variant` | `String` | `"solid"` | Design variant — `"solid"` (plain filled button)
|
|
41
|
+
| `variant` | `String` | `"solid"` | Design variant — `"solid"` (plain filled button), `"outline"` (border-only, matches `isOutline`) or `"animated-round"` (preset: acts as `isRounded` + text hidden while animating, without passing those props; the loader still shows only while `isAnimated` is `true`; combine with `isOutline` for an outline look). Drives which class is generated for `color` (e.g. `"outline"` → `btn-outline-{color}`). |
|
|
39
42
|
| `size` | `String` | `"md"` | Button size (`xs`, `sm`, `md`, `lg`, `xl`, `xxl`). |
|
|
40
43
|
| `isOutline` | `Boolean` | `false` | Deprecated — equivalent to `variant="outline"`, kept for backward compatibility. Prefer `variant="outline"` in new code. |
|
|
41
44
|
| `isIconBtn` | `Boolean` | `false` | Formats the button styling for a single icon. |
|
|
42
45
|
| `isRounded` | `Boolean` | `false` | Applies a fully rounded, pill-like border radius to the button. |
|
|
43
46
|
| `isAnimated` | `Boolean` | `false` | When `true`, renders the loader SVG and optionally hides the label. |
|
|
44
|
-
| `isHideTextOnAnimate` | `Boolean` | `false` | Hides the default slot content while `isAnimated` is `true`. |
|
|
47
|
+
| `isHideTextOnAnimate` | `Boolean` | `false` | Hides the default slot content while `isAnimated` is `true`. Forced to `true` whenever the button is rounded (`isRounded`, or `variant="animated-round"`) — an explicit `false` is ignored in that case. |
|
|
45
48
|
| `showIconDivider` | `Boolean` | `false` | Renders a vertical divider between the `#icon` slot and the label. |
|
|
46
49
|
| `iconPosition` | `String` | `"left"` | Placement of the icon and divider (`"left"` or `"right"`). |
|
|
47
50
|
|
|
@@ -32,7 +32,7 @@ const themeColor = ref('blue');
|
|
|
32
32
|
| --- | --- | --- | --- |
|
|
33
33
|
| `modelValue` | `String` | `""` | Selected color `name` (v-model). |
|
|
34
34
|
| `name` | `String` | `"color"` | Radio group name. |
|
|
35
|
-
| `colors` | `Array` | `[]` | Each: `{ name, color, title? }`. |
|
|
35
|
+
| `colors` | `Array` | `[]` | Each: `{ name, color, title? }`. The selected swatch's outline ring uses that swatch's own `color` (gradient/`url()` values fall back to the theme color). |
|
|
36
36
|
| `align` | `String` | `"left"` | Flex alignment (`left`, `center`, `right`, …). |
|
|
37
37
|
| `borderRadius` | `String` | `"50%"` | Swatch border-radius. |
|
|
38
38
|
| `size` | `String` | `"md"` | Item size (`xs`, `sm`, `md`, `lg`, `xl`, `xxl`). |
|
|
@@ -33,9 +33,9 @@ const datetime = ref(null);
|
|
|
33
33
|
| `isRange` | `Boolean` | `false` | Enable date-range mode. |
|
|
34
34
|
| `size` | `String` | `"md"` | Adjusts component size (`xs`, `sm`, `md`, `lg`, `xl`, `xxl`). |
|
|
35
35
|
| `containerClass` | `String` | `"mb-3"` | Wrapper class. |
|
|
36
|
-
| `width` | `String \| Number` | `undefined` | Explicit width on the `.apbd-date-time-container` wrapper. A number is treated as px (e.g. `220` -> `220px`); a string is used as-is (e.g. `"50%"`). |
|
|
37
|
-
| `minWidth` | `String \| Number` | `undefined` | `min-width` on the wrapper (same number/string rules as `width`). |
|
|
38
|
-
| `maxWidth` | `String \| Number` | `undefined` | `max-width` on the wrapper (same number/string rules as `width`) — caps growth inside a flex/grid parent without a fixed `width`. |
|
|
36
|
+
| `width` | `String \| Number` | `undefined` | Explicit width on the `.apbd-date-time-container` wrapper. A number is treated as px (e.g. `220` -> `220px`); a string is used as-is (e.g. `"50%"`). Applied as `min(<value>, 100%)`, so it shrinks to fit a narrower parent on small screens instead of overflowing it. |
|
|
37
|
+
| `minWidth` | `String \| Number` | `undefined` | `min-width` on the wrapper (same number/string rules as `width`, same `min(<value>, 100%)` clamp). |
|
|
38
|
+
| `maxWidth` | `String \| Number` | `undefined` | `max-width` on the wrapper (same number/string rules as `width`, same `min(<value>, 100%)` clamp) — caps growth inside a flex/grid parent without a fixed `width`. |
|
|
39
39
|
| `hints` | `String` | `""` | Helper text. |
|
|
40
40
|
| `isDisable` | `Boolean` | `false` | Disable the picker. |
|
|
41
41
|
| `visibility` | `String` | `"click"` | v-calendar popover trigger. |
|
|
@@ -20,6 +20,27 @@ UI or accept a custom one via slots.
|
|
|
20
20
|
:max-size="5"
|
|
21
21
|
/>
|
|
22
22
|
|
|
23
|
+
<!-- isCrop: optional crop dialog after picking an image (Cancel = nothing is selected) -->
|
|
24
|
+
<ab-file-uploader v-model="avatar" is-crop :crop-aspect-ratio="1" />
|
|
25
|
+
|
|
26
|
+
<!-- maxWidth/maxHeight: the picked image file itself is downscaled to fit within 300x200
|
|
27
|
+
before it's emitted; the container keeps its normal width/height box either way -->
|
|
28
|
+
<ab-file-uploader v-model="avatar" :max-width="300" :max-height="200" />
|
|
29
|
+
|
|
30
|
+
<!-- variant="dropzone": icon on top, title + description, AbButton trigger, drag & drop.
|
|
31
|
+
:is-border="false" drops the dashed border and uses a box-shadow instead -->
|
|
32
|
+
<ab-file-uploader
|
|
33
|
+
v-model="avatar"
|
|
34
|
+
variant="dropzone"
|
|
35
|
+
:is-border="false"
|
|
36
|
+
title="Upload pictures"
|
|
37
|
+
description="Videos must be less than 30 MB and photos must be less than 2 MB in size."
|
|
38
|
+
button-text="Upload"
|
|
39
|
+
:width="360"
|
|
40
|
+
>
|
|
41
|
+
<template #icon><i class="bi bi-cloud-arrow-up"></i></template>
|
|
42
|
+
</ab-file-uploader>
|
|
43
|
+
|
|
23
44
|
<ab-file-uploader v-model="avatar" :max-size="5">
|
|
24
45
|
<template #dial>
|
|
25
46
|
<div class="my-drop-zone">Drop files here</div>
|
|
@@ -40,14 +61,25 @@ function handleFiles(files) { console.log('Selected files:', files); }
|
|
|
40
61
|
| Name | Type | Default | Description |
|
|
41
62
|
| --- | --- | --- | --- |
|
|
42
63
|
| `modelValue` | `File \| Array \| String` | `null` | Selected file (or URL string / array). |
|
|
64
|
+
| `isCrop` | `Boolean` | `false` | Image mode only (ignored for `type="file"`): after an image is picked a crop dialog opens with **Crop** and **Cancel** buttons. Crop selects the cropped image (jpeg/png/webp keep their format, others such as gif become png); Cancel closes the dialog and selects nothing (a previously selected image stays). |
|
|
65
|
+
| `cropAspectRatio` | `Number` | `null` | Width / height ratio the crop box is locked to (`1` = square, `16 / 9`, …). `null` = free-form. Only used with `isCrop`. |
|
|
43
66
|
| `maxSize` | `Number` | `2.0` | Max file size in MB. |
|
|
44
67
|
| `label` | `String` | `""` | Field label. |
|
|
45
68
|
| `containerClass` | `String` | `undefined` | Wrapper class (falls back to globalConfig.inputContainerClass). |
|
|
46
69
|
| `type` | `'image' \| 'file'` | `'image'` | Upload mode. `image` only accepts images and always shows a thumbnail preview. `file` accepts any file listed in `allowedTypes`; non-image files render an extension icon instead of a preview. |
|
|
47
70
|
| `allowedTypes` | `Array<String>` | `[]` | Allowed extensions, no dot (e.g. `['pdf', 'docx']`). **Required when `type="file"`** — logs a console error and rejects every selected file when empty. Also drives the input's `accept` attribute. Ignored in `image` mode. |
|
|
48
71
|
| `showFileName` | `Boolean` | `null` | Whether to render the filename below the container. `null` auto-picks by `type` (off for `image`, on for `file`); pass `true`/`false` to override either mode. |
|
|
49
|
-
| `width` | `String \| Number` | `undefined` | Container width. Number is treated as px. Falls back to the default `100px`. |
|
|
50
|
-
| `height` | `String \| Number` | `undefined` | Container height. Number is treated as px. Falls back to the default `73px`. |
|
|
72
|
+
| `width` | `String \| Number` | `undefined` | Container width. Number is treated as px. Falls back to the default `100px`. Not affected by `maxWidth`/`maxHeight` — the preview box always fits the image via `object-fit: contain`. |
|
|
73
|
+
| `height` | `String \| Number` | `undefined` | Container height. Number is treated as px. Falls back to the default `73px`. Not affected by `maxWidth`/`maxHeight`. |
|
|
74
|
+
| `maxWidth` | `String \| Number` | `undefined` | Applies to any picked image file (number = px). If the image's actual width exceeds this, the file itself is downscaled (aspect ratio kept, canvas-based, never upscaled) before it's shown/emitted — so the file a consumer later uploads is already capped. Does not resize the preview container. |
|
|
75
|
+
| `maxHeight` | `String \| Number` | `undefined` | Same as `maxWidth`, for height. Both are applied together as a "contain" cap — the image is scaled down by whichever ratio is smaller so it fits within `maxWidth x maxHeight`. |
|
|
76
|
+
| `variant` | `'default' \| 'dropzone'` | `'default'` | `dropzone` renders a larger card: icon on top, `title`, `description`, then an `AbButton` trigger; clicking the card or dropping a file on it selects a file. `default` and the custom-slot designs are unchanged. |
|
|
77
|
+
| `isBorder` | `Boolean` | `true` | `variant="dropzone"` only. `true` = dashed border, `false` = borderless with a box-shadow. |
|
|
78
|
+
| `title` | `String` | `""` | `variant="dropzone"` only. Bold heading under the icon; hidden when empty (unless the `title` slot is used). |
|
|
79
|
+
| `description` | `String` | `""` | `variant="dropzone"` only. Muted helper text under the title; hidden when empty (unless the `description` slot is used). |
|
|
80
|
+
| `buttonText` | `String` | `"Upload"` | `variant="dropzone"` only. Label of the trigger button. |
|
|
81
|
+
| `buttonColor` | `String` | `"primary"` | `variant="dropzone"` only. `AbButton` `color` of the trigger button. |
|
|
82
|
+
| `buttonSize` | `String` | `undefined` | `variant="dropzone"` only. `AbButton` `size` of the trigger button; falls back to the global `size`. |
|
|
51
83
|
|
|
52
84
|
## Events
|
|
53
85
|
|
|
@@ -63,6 +95,14 @@ function handleFiles(files) { console.log('Selected files:', files); }
|
|
|
63
95
|
| `label` | Custom label. |
|
|
64
96
|
| `dial` | Custom uploader UI (replaces the default design). |
|
|
65
97
|
| `default` | Alternative custom UI slot. |
|
|
98
|
+
| `icon` | Replaces the empty-state icon — the top icon in `variant="dropzone"`, the image/file icon in the default design. Not shown once a file is picked. |
|
|
99
|
+
| `remove-icon` | Replaces the icon on the hover-to-remove overlay over a picked image / file (both designs). |
|
|
100
|
+
| `title` | `variant="dropzone"` only. Replaces the `title` text. |
|
|
101
|
+
| `description` | `variant="dropzone"` only. Replaces the `description` text. |
|
|
102
|
+
| `button` | `variant="dropzone"` only. Replaces the trigger button's label. |
|
|
103
|
+
| `crop-title` | `isCrop` only. Replaces the crop dialog title (default `Crop image`). |
|
|
104
|
+
| `crop-cancel` | `isCrop` only. Replaces the crop dialog's Cancel button label. |
|
|
105
|
+
| `crop-apply` | `isCrop` only. Replaces the crop dialog's Crop button label. |
|
|
66
106
|
|
|
67
107
|
## v-model
|
|
68
108
|
|
|
@@ -71,6 +111,7 @@ previews), or `null`.
|
|
|
71
111
|
|
|
72
112
|
## Notes
|
|
73
113
|
|
|
114
|
+
- In `variant="dropzone"` the icon area has a fixed height (88px) that a picked image fills (aspect ratio kept via `object-fit: contain`, never wider than the card), so the card has the same size with and without an image; override the height with the `--afu-preview-height` CSS variable. A picked non-image file shows its extension icon at 64px.
|
|
74
115
|
- Icon mapping for non-image files (pdf, zip, doc/docx, xls/xlsx, ppt/pptx, video) comes from the
|
|
75
116
|
shared `useFileValidator()` composable's `getFileIconByExt`, the same mapping `AbChatInput` uses.
|
|
76
117
|
- In `image` mode, validation is unchanged from before: only jpg/jpeg/png/gif/webp are accepted and
|
|
@@ -4,9 +4,9 @@ Advanced filter panel for list and table views. Supports quick/advance modes, si
|
|
|
4
4
|
|
|
5
5
|
`isMultiple` is functional in `isQuickAdvance` mode for `dd` fields: selections toggle on/off and render as removable tag chips on the popover trigger (no `AbMultiSelect` involved). The popover's option list is searchable — locally against `options`, or via `isAjaxSearch` + `onSearch` for server-side search.
|
|
6
6
|
|
|
7
|
-
`isBuilderFilter` is a Shopify-style filter builder: no field is visible until the user clicks the `+` button. That opens a popover which first lists every not-yet-applied `filterOptions` entry by `name`; picking one swaps the same popover to a value editor matching that field's `type` (`dd`→`AbMultiSelect`, `t`→`AbInputField`, `tr`→min/max inputs, `d`/`dr`→`AbDateTimePicker`) plus Cancel/Apply Filter buttons. A `"t"` (plain text/number) field also applies on `Enter` in its input — same no-op-when-empty guard as clicking Apply Filter. Apply pushes it in as a removable chip (e.g. "Email : gmail" — see `builderChipSeparator` slot below). By default (`isBuilderAutoSearch: false`), a
|
|
7
|
+
`isBuilderFilter` is a Shopify-style filter builder: no field is visible until the user clicks the `+` button. That opens a popover which first lists every not-yet-applied `filterOptions` entry by `name`; picking one swaps the same popover to a value editor matching that field's `type` (`dd`→`AbMultiSelect`, `t`→`AbInputField`, `tr`→min/max inputs, `d`/`dr`→`AbDateTimePicker`) plus Cancel/Apply Filter buttons. A `"t"` (plain text/number) field also applies on `Enter` in its input — same no-op-when-empty guard as clicking Apply Filter. Apply pushes it in as a removable chip (e.g. "Email : gmail" — see `builderChipSeparator` slot below). By default (`isBuilderAutoSearch: false`), a Search button is shown so search fires only on clicking Search, and Reset clears all applied chips. When `isBuilderAutoSearch: true`, every Apply and chip removal immediately fires `searchFilter` without showing a Search button (only Reset). The Search/Reset buttons are hidden entirely while no chip is applied — they appear right after the `+` button once the first chip is applied, and vanish again when Reset is clicked or the last chip is removed individually. A field's `operators` is fixed by its schema entry, same as other modes — this mode does not add an is/is-not/contains operator picker, only the value input changes per `type`.
|
|
8
8
|
|
|
9
|
-
Standard-search, advance-search, and quick-advance field layouts are all plain flex (`d-flex flex-wrap gap-2`) — no Bootstrap grid. Each field grows/shrinks on its own, which means a field left alone on the last row will stretch to fill the remaining row width; give a `filterOptions` entry a `width`, `minWidth`, and/or `maxWidth` key (`String | Number` — a number is px, e.g. `maxWidth: 280`, or a CSS string like `"50%"`) to control that specific field's size. All three are forwarded straight to the underlying `AbInputField`/`AbMultiSelect`/`AbDateTimePicker`'s own same-named props, and also constrain that field's flex-item wrapper directly (`width` sets `flex: 0 0 <width
|
|
9
|
+
Standard-search, advance-search, and quick-advance field layouts are all plain flex (`d-flex flex-wrap gap-2`) — no Bootstrap grid. Each field grows/shrinks on its own, which means a field left alone on the last row will stretch to fill the remaining row width; give a `filterOptions` entry a `width`, `minWidth`, and/or `maxWidth` key (`String | Number` — a number is px, e.g. `maxWidth: 280`, or a CSS string like `"50%"`) to control that specific field's size. All three are forwarded straight to the underlying `AbInputField`/`AbMultiSelect`/`AbDateTimePicker`'s own same-named props, and also constrain that field's flex-item wrapper directly (`width` sets `flex: 0 0 min(<width>, 100%)` so it stops growing/shrinking; `minWidth`/`maxWidth` clamp it while it keeps growing/shrinking with its siblings). Every one of these is applied as `min(<value>, 100%)`, so a fixed value like `width: 300` never overflows a narrower container on small screens — it shrinks to fit instead.
|
|
10
10
|
|
|
11
11
|
The standard-mode property-selector (and the scan field it swaps for) isn't part of `filterOptions` — it's not tied to one field, it lists all of them — so it has no `width`/`minWidth`/`maxWidth` key to set. It's also the only item in its row until a property is picked (or whenever `showScanFld` is on), so without sizing it it'll stretch to fill the row the same way an unsized `filterOptions` field would. Use the panel-level `propertySelectWidth`/`propertySelectMinWidth`/`propertySelectMaxWidth` props for that slot instead.
|
|
12
12
|
|
|
@@ -58,9 +58,9 @@ function handleSearch(data) {
|
|
|
58
58
|
| `isMaxDate` | `Boolean` | `true` | Limit date pickers to today as max. |
|
|
59
59
|
| `size` | `String` | `"xs"` | Control size. |
|
|
60
60
|
| `advanceContainerClass` | `String` | `""` | Extra class on each field's flex-item wrapper in advance mode (base sizing is `flex: 1 1 240px`, wraps as needed — not a Bootstrap grid). To fix a single field's width instead, use that field's own `width` prop (`AbInputField`/`AbMultiSelect`/`AbDateTimePicker`). |
|
|
61
|
-
| `propertySelectWidth` | `String` \| `Number` | `undefined` | Width of the standard-mode property-selector / scan-field slot (number = px). |
|
|
62
|
-
| `propertySelectMinWidth` | `String` \| `Number` | `undefined` | `min-width` of that same slot. |
|
|
63
|
-
| `propertySelectMaxWidth` | `String` \| `Number` | `undefined` | `max-width` of that same slot — it's the only item in its row until a property is picked (or in scan mode), so it stretches to fill it without one. |
|
|
61
|
+
| `propertySelectWidth` | `String` \| `Number` | `undefined` | Width of the standard-mode property-selector / scan-field slot (number = px). Applied as `min(<value>, 100%)`, so it shrinks on small screens instead of overflowing. |
|
|
62
|
+
| `propertySelectMinWidth` | `String` \| `Number` | `undefined` | `min-width` of that same slot (same `min(<value>, 100%)` clamp). |
|
|
63
|
+
| `propertySelectMaxWidth` | `String` \| `Number` | `undefined` | `max-width` of that same slot — it's the only item in its row until a property is picked (or in scan mode), so it stretches to fill it without one (same `min(<value>, 100%)` clamp). |
|
|
64
64
|
| `isQuickAdvanceAutoSearch` | `Boolean` | `false` | Fire search automatically on field change (quick advance). |
|
|
65
65
|
| `defaultFilterId` | `String` \| `Number` | `""` | Pre-selects a default filter property in standard search mode (when `!isSingle && !isAdvance && !isQuickAdvance`). |
|
|
66
66
|
|
|
@@ -82,3 +82,4 @@ function handleSearch(data) {
|
|
|
82
82
|
| `hints` | Helper text. |
|
|
83
83
|
| `builderChipSeparator` | `isBuilderFilter` mode only. Overrides the connector text rendered between an applied chip's field name and its value (e.g. "Email **:** gmail", "Revenue **:** 12 - 23" for `tr`/`dr` range fields). Receives `{ field }`. Default content is `:`. |
|
|
84
84
|
| `builderAddLabel` | `isBuilderFilter` mode only. Renders before the static `+` icon inside the "Add filter" button — use it to add a label next to the icon. Not scoped. Empty by default. |
|
|
85
|
+
| `builderTitle` | `isBuilderFilter` mode only. Title rendered at the far left of the row, inside the same box style as the applied chips. Hidden until at least one chip is applied (and again after Reset / removing the last chip). Not scoped. Default content is `Filter Title`. |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AbInputField — AI Reference
|
|
2
2
|
|
|
3
|
-
Core text input with VeeValidate integration, localized feedback, and prefix/postfix/hint slots. Use for single-line text inputs; use `AbField` for a polymorphic field that can render selects, toggles, etc. Pass `variant="stepper"` to turn it into a numeric stepper input (min/max/step clamping, +/- buttons) —
|
|
3
|
+
Core text input with VeeValidate integration, localized feedback, and prefix/postfix/hint slots. Use for single-line text inputs; use `AbField` for a polymorphic field that can render selects, toggles, etc. Pass `variant="stepper"` to turn it into a numeric stepper input (min/max/step clamping, +/- buttons) — [`AbNumberField`](./ai_ref_AbNumberField.md) is a thin wrapper exposing the same `variant` prop, defaulting to a plain `type="number"` input when it's unset.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -49,6 +49,18 @@ const qty = ref(1);
|
|
|
49
49
|
</script>
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
Inset label variant (label inside the bordered box; acts as the placeholder while empty/unfocused, moves to the top on focus / when filled):
|
|
53
|
+
|
|
54
|
+
```vue
|
|
55
|
+
<ab-input-field v-model="username" variant="inset" name="username" label="Username" />
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Outlined variant (floating label: looks like the placeholder when empty, moves onto the top border on focus / when filled; `placeholder` shows on focus):
|
|
59
|
+
|
|
60
|
+
```vue
|
|
61
|
+
<ab-input-field v-model="username" variant="outlined" name="username" label="Username" placeholder="Enter username" />
|
|
62
|
+
```
|
|
63
|
+
|
|
52
64
|
Copyable (read-only value with a copy-to-clipboard button — no built-in confirmation UI, wire your own via the `copy-success`/`copy-error` events):
|
|
53
65
|
|
|
54
66
|
```vue
|
|
@@ -85,9 +97,9 @@ const { toast } = useToast();
|
|
|
85
97
|
| `size` | `String` | `undefined` | Adjusts component size (`xs`, `sm`, `md`, `lg`, `xl`, `xxl`). |
|
|
86
98
|
| `rules` | `String \| Object` | `""` | VeeValidate rules. |
|
|
87
99
|
| `containerClass` | `String` | `undefined` | Class on the wrapper `<div>`. |
|
|
88
|
-
| `width` | `String \| Number` | `undefined` | Explicit width on the wrapper `<div>`. A number is treated as px (e.g. `220` -> `220px`); a string is used as-is (e.g. `"50%"`). |
|
|
89
|
-
| `minWidth` | `String \| Number` | `undefined` | `min-width` on the wrapper `<div>` (same number/string rules as `width`). |
|
|
90
|
-
| `maxWidth` | `String \| Number` | `undefined` | `max-width` on the wrapper `<div>` (same number/string rules as `width`) — caps growth inside a flex/grid parent without a fixed `width`. |
|
|
100
|
+
| `width` | `String \| Number` | `undefined` | Explicit width on the wrapper `<div>`. A number is treated as px (e.g. `220` -> `220px`); a string is used as-is (e.g. `"50%"`). Applied as `min(<value>, 100%)`, so it shrinks to fit a narrower parent on small screens instead of overflowing it. |
|
|
101
|
+
| `minWidth` | `String \| Number` | `undefined` | `min-width` on the wrapper `<div>` (same number/string rules as `width`, same `min(<value>, 100%)` clamp). |
|
|
102
|
+
| `maxWidth` | `String \| Number` | `undefined` | `max-width` on the wrapper `<div>` (same number/string rules as `width`, same `min(<value>, 100%)` clamp) — caps growth inside a flex/grid parent without a fixed `width`. |
|
|
91
103
|
| `hints` | `String` | `""` | Helper text beneath the input. |
|
|
92
104
|
| `prefix` | `String` | `""` | Prefix text/icon (shortcut for `#prefix` slot). |
|
|
93
105
|
| `postfix` | `String` | `""` | Postfix text/icon. |
|
|
@@ -101,16 +113,24 @@ const { toast } = useToast();
|
|
|
101
113
|
| `iconPosition` | `String` | `undefined` | Position of the custom `#icon` slot (`"left"`, `"right"`). |
|
|
102
114
|
| `inputClass` | `String \| Object \| Array` | `undefined` | Additional class(es) for the input element. |
|
|
103
115
|
| `inputStyle` | `String \| Object \| Array` | `undefined` | Additional style(s) for the input element. |
|
|
104
|
-
| `variant` | `String` | `undefined` | Layout variant. `"stepper"` renders a numeric stepper (forces `type="number"`, shows +/- buttons, enables `min`/`max`/`step` clamping). |
|
|
116
|
+
| `variant` | `String` | `undefined` | Layout variant. `"stepper"` renders a numeric stepper (forces `type="number"`, shows +/- buttons, enables `min`/`max`/`step` clamping). `"inset"` renders the label inside the bordered field: it acts as the placeholder (centered) while empty and unfocused, and moves to the top, stacked above the value, on focus or when filled — the real `placeholder` shows on focus (border/focus/error styles unchanged; a left `#icon`/`prefix` gets a fixed width so the label aligns — use an icon, not long text). `"outlined"` renders a floating label: shown like a placeholder while empty/unfocused, floats onto the top border when focused or filled, the border is cut away behind it, no label background, RTL supported (real `placeholder` appears on focus; scales with `size`). |
|
|
105
117
|
| `min` | `Number \| String` | `null` | *(stepper variant)* Minimum allowed value. Clamps input and disables the minus button at the floor. |
|
|
106
118
|
| `max` | `Number \| String` | `null` | *(stepper variant)* Maximum allowed value. Clamps input and disables the plus button at the ceiling. |
|
|
107
119
|
| `step` | `Number \| String` | `1` | *(stepper variant)* Increment/decrement amount. |
|
|
108
120
|
| `showButtons` | `Boolean` | `true` | *(stepper variant)* Render the minus/plus controls. |
|
|
109
121
|
| `isBorder` | `Boolean` | `false` | *(stepper variant)* Show inner borders between minus/input/plus. Default is a seamless pill. |
|
|
110
|
-
| `copyable` | `Boolean` | `false` | Renders a plain, borderless postfix button that copies the current value to the clipboard (via the Clipboard API). No built-in confirmation UI — listen for `copy-success`/`copy-error` to show your own (e.g. `useToast()`). Pair with a native `readonly` attribute for a display-only copyable value
|
|
122
|
+
| `copyable` | `Boolean` | `false` | Renders a plain, borderless postfix button that copies the current value to the clipboard (via the Clipboard API). No built-in confirmation UI — listen for `copy-success`/`copy-error` to show your own (e.g. `useToast()`). Pair with a native `readonly` attribute for a display-only copyable value. |
|
|
111
123
|
| `copySuccessMsg` | `String` | `"Copied to clipboard"` | Message text passed to the `copy-success` event after a successful copy (`copyable` only). Runs through the same translation pipeline as `label`/`hints`. |
|
|
112
124
|
| `copyErrorMsg` | `String` | `"Failed to copy"` | Message text passed to the `copy-error` event when copying fails, e.g. the Clipboard API is unavailable outside a secure context (`copyable` only). |
|
|
113
125
|
|
|
126
|
+
## Read-only mode
|
|
127
|
+
|
|
128
|
+
Not a dedicated prop — pass the native `readonly` attribute (it falls through to the input via `$attrs`, same as `disabled`). Unlike `disabled`, it renders exactly like a normal enabled field (no greyed-out background), it keeps the value focusable/selectable/copyable, and it's still submitted with the form — use it when the value must not be *changed* but should still look and read like every other field. On `variant="stepper"`, `readonly` also disables the +/- buttons, so the value truly can't change (native `readonly` alone only blocks typing in the number input, not button clicks).
|
|
129
|
+
|
|
130
|
+
```vue
|
|
131
|
+
<ab-input-field v-model="accountId" name="account_id" label="Account ID" readonly />
|
|
132
|
+
```
|
|
133
|
+
|
|
114
134
|
## Events
|
|
115
135
|
|
|
116
136
|
| Event | Payload | Description |
|
|
@@ -27,9 +27,9 @@ Searchable single/multi/tag select. Custom built-in replacement for `@vueform/mu
|
|
|
27
27
|
| `name` | `String` | `""` | VeeValidate field name. |
|
|
28
28
|
| `rules` | `String \| Object` | `""` | VeeValidate rules. |
|
|
29
29
|
| `containerClass` | `String` | `undefined` | Wrapper class. |
|
|
30
|
-
| `width` | `String \| Number` | `undefined` | Explicit width on the wrapper `<div>`. A number is treated as px (e.g. `220` -> `220px`); a string is used as-is (e.g. `"50%"`). |
|
|
31
|
-
| `minWidth` | `String \| Number` | `undefined` | `min-width` on the wrapper `<div>` (same number/string rules as `width`). |
|
|
32
|
-
| `maxWidth` | `String \| Number` | `undefined` | `max-width` on the wrapper `<div>` (same number/string rules as `width`) — caps growth inside a flex/grid parent without a fixed `width`. |
|
|
30
|
+
| `width` | `String \| Number` | `undefined` | Explicit width on the wrapper `<div>`. A number is treated as px (e.g. `220` -> `220px`); a string is used as-is (e.g. `"50%"`). Applied as `min(<value>, 100%)`, so it shrinks to fit a narrower parent on small screens instead of overflowing it. |
|
|
31
|
+
| `minWidth` | `String \| Number` | `undefined` | `min-width` on the wrapper `<div>` (same number/string rules as `width`, same `min(<value>, 100%)` clamp). |
|
|
32
|
+
| `maxWidth` | `String \| Number` | `undefined` | `max-width` on the wrapper `<div>` (same number/string rules as `width`, same `min(<value>, 100%)` clamp) — caps growth inside a flex/grid parent without a fixed `width`. |
|
|
33
33
|
| `hints` | `String` | `""` | Helper text. |
|
|
34
34
|
| `multiple` | `Boolean` | `false` | Deprecated — use `mode` instead. |
|
|
35
35
|
| `searchable` | `Boolean` | `false` | Enable option search/filter. |
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
# AbNumberField — AI Reference
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Numeric input with minus/plus buttons, min/max clamping, custom step, and VeeValidate integration. Renders as a seamless pill by default; pass `is-border` to show internal dividers between buttons and input.
|
|
3
|
+
Numeric input with VeeValidate integration. By default it renders a plain native `type="number"` input; pass `variant="stepper"` to turn it into a stepper with minus/plus buttons, min/max clamping, and a custom step. `AbNumberField` is a thin wrapper around [`AbInputField`](./ai_ref_AbInputField.md) — `<ab-number-field variant="stepper" ... />` and `<ab-input-field variant="stepper" type="number" ... />` render identically. Renders the stepper as a seamless pill by default; pass `is-border` to show internal dividers between buttons and input.
|
|
6
4
|
|
|
7
5
|
## Usage
|
|
8
6
|
|
|
9
7
|
```vue
|
|
10
8
|
<template>
|
|
11
|
-
|
|
9
|
+
<!-- Default: plain number input -->
|
|
10
|
+
<ab-number-field v-model="qty" name="quantity" label="Quantity" />
|
|
11
|
+
|
|
12
|
+
<!-- Stepper: minus/plus buttons with min/max clamping -->
|
|
13
|
+
<ab-number-field v-model="qty" name="quantity" label="Quantity" variant="stepper" :min="1" :max="10" :step="1" hints="Clamped between 1 and 10" />
|
|
12
14
|
|
|
13
|
-
<ab-number-field v-model="qty" name="quantity" label="Quantity" is-border />
|
|
15
|
+
<ab-number-field v-model="qty" name="quantity" label="Quantity" variant="stepper" is-border />
|
|
14
16
|
</template>
|
|
15
17
|
|
|
16
18
|
<script setup>
|
|
@@ -32,12 +34,14 @@ const qty = ref(1);
|
|
|
32
34
|
| `hints` | `String` | `""` | Helper text beneath the input. |
|
|
33
35
|
| `prefix` | `String` | `""` | Prefix text/icon (shortcut for `#prefix` slot). |
|
|
34
36
|
| `postfix` | `String` | `""` | Postfix text/icon. |
|
|
35
|
-
| `
|
|
36
|
-
| `
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
37
|
+
| `variant` | `String` | `undefined` | Pass `"stepper"` to render minus/plus buttons with min/max/step clamping. Left unset, renders a plain native `type="number"` input with no buttons or clamping (min/max/step are still applied as native input attributes). |
|
|
38
|
+
| `min` | `Number \| String` | `null` | Minimum allowed value. With `variant="stepper"`, clamps the typed value and disables the minus button at the floor; otherwise it's only the native `min` attribute. |
|
|
39
|
+
| `max` | `Number \| String` | `null` | Maximum allowed value. With `variant="stepper"`, clamps the typed value and disables the plus button at the ceiling; otherwise it's only the native `max` attribute. |
|
|
40
|
+
| `step` | `Number \| String` | `1` | Increment/decrement amount (`variant="stepper"`), or the native `step` attribute otherwise. |
|
|
41
|
+
| `showButtons` | `Boolean` | `true` | Render the minus/plus controls. Only applies when `variant="stepper"`. |
|
|
39
42
|
| `disabled` | `Boolean` | `false` | Disable the field and both buttons. |
|
|
40
|
-
| `
|
|
43
|
+
| `readonly` | `Boolean` | `false` | Make the field read-only and disable both buttons (`variant="stepper"`). Renders like a normal enabled field (no greyed-out background), unlike `disabled`. |
|
|
44
|
+
| `isBorder` | `Boolean` | `false` | Show inner borders between minus/input/plus. Default is a seamless pill. Only applies when `variant="stepper"`. |
|
|
41
45
|
| `isLeftIconBorder` | `Boolean` | `false` | Render border between the prefix icon and the input. |
|
|
42
46
|
| `isRightIconBorder` | `Boolean` | `false` | Render border between the postfix icon and the input. |
|
|
43
47
|
| `size` | `String` | `undefined` | Input size: `"xs"`, `"sm"`, `"md"`, `"lg"`, `"xl"`. Falls back to `globalConfig.size`, then `"md"`. |
|
|
@@ -46,8 +50,8 @@ const qty = ref(1);
|
|
|
46
50
|
|
|
47
51
|
| Event | Payload | Description |
|
|
48
52
|
| --- | --- | --- |
|
|
49
|
-
| `update:modelValue` | `number \| null` | v-model sync.
|
|
50
|
-
| `input` | `number` | Fired on input after clamping. |
|
|
53
|
+
| `update:modelValue` | `number \| null` | v-model sync. With `variant="stepper"`, value is `number` after clamping, or `null` when cleared. |
|
|
54
|
+
| `input` | `number` | Fired on input. With `variant="stepper"`, fired after clamping. |
|
|
51
55
|
| `keyup` | `KeyboardEvent` | Forwarded native event. |
|
|
52
56
|
| `keydown` | `KeyboardEvent` | Forwarded native event. |
|
|
53
57
|
| `paste` | `ClipboardEvent` | Forwarded native event. |
|
|
@@ -57,6 +61,10 @@ const qty = ref(1);
|
|
|
57
61
|
| Name | Description |
|
|
58
62
|
| --- | --- |
|
|
59
63
|
| `label` | Custom label content. |
|
|
60
|
-
| `prefix` | Prefix icon / text (rendered before the minus button). |
|
|
61
|
-
| `postfix` | Postfix icon / text (rendered after the plus button). |
|
|
64
|
+
| `prefix` | Prefix icon / text (rendered before the minus button when `variant="stepper"`). |
|
|
65
|
+
| `postfix` | Postfix icon / text (rendered after the plus button when `variant="stepper"`). |
|
|
62
66
|
| `hints` | Helper text (overrides `hints` prop). |
|
|
67
|
+
|
|
68
|
+
## v-model
|
|
69
|
+
|
|
70
|
+
Yes — `modelValue` + `update:modelValue`. Nullable; with `variant="stepper"` the value is clamped to `min`/`max` and coerced to `number` (or `null` when the field is cleared).
|
package/.ai/ai_ref_AbToggle.md
CHANGED
|
@@ -25,6 +25,9 @@ Accessible switch/toggle control. Supports title + description layout and custom
|
|
|
25
25
|
| `size` | `String` | `"md"` | Toggle size. |
|
|
26
26
|
| `trueValue` | `any` | `"Y"` | Value when checked. |
|
|
27
27
|
| `falseValue` | `any` | `"N"` | Value when unchecked. |
|
|
28
|
+
| `hasIcon` | `Boolean` | `false` | Renders default enable (check) and disable (cross) icons inside switch track. |
|
|
29
|
+
| `onIcon` | `Component \| String` | `Check` | Custom icon component or CSS class for enabled state. |
|
|
30
|
+
| `offIcon` | `Component \| String` | `X` | Custom icon component or CSS class for disabled state. |
|
|
28
31
|
| `title` | `String \| null` | `null` | Title next to the toggle. |
|
|
29
32
|
| `description` | `String \| null` | `null` | Description under the title. |
|
|
30
33
|
| `hints` | `String \| null` | `null` | Helper text. |
|
|
@@ -43,4 +46,6 @@ Accessible switch/toggle control. Supports title + description layout and custom
|
|
|
43
46
|
| `title` | Custom title. |
|
|
44
47
|
| `description` | Custom description. |
|
|
45
48
|
| `descriptionContainer` | Wraps the entire title + description block. |
|
|
49
|
+
| `on-icon` | Custom icon for enabled state inside track. |
|
|
50
|
+
| `off-icon` | Custom icon for disabled state inside track. |
|
|
46
51
|
| `hints` | Custom hints. |
|