@xleddyl/443-components-vue 0.16.86 → 0.16.88
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/CATALOG.md
CHANGED
|
@@ -152,7 +152,7 @@ Playground paths in this file are relative to `playground/nuxt/app/pages/compone
|
|
|
152
152
|
| `Spinner` | Loading indicator. Use `block` for a centered loading state that fills its container. | Props: `size` (xs to lg), `label`, `decorative`, `block`. | `core/spinner.vue` |
|
|
153
153
|
| `Input` | Single line text field. Use `NumberInput` for numbers, `PasswordInput` for passwords. | Model: `v-model` (string, number or null; modifiers `.number`, `.trim`). Props: `type`, `size`, `icon`, `clearable`, `counter` (needs `maxlength`), `transform`, `numeric` (decimal keyboard, number model, tabular digits, left aligned), `invalid`, `disabled`, `readonly`, `required`, `noAutofill`. Slots: `leading`, `trailing`. Event: `clear`. | `core/input.vue` |
|
|
154
154
|
| `Textarea` | Multi line text field. | Model: `v-model`. Props: `rows`, `maxRows`, `autoresize`, `counter`, `size`, `invalid`, `disabled`, `readonly`, `required`. Slot: `trailing`. | `core/textarea.vue` |
|
|
155
|
-
| `FormField` | Label, description, hint, error and required marker around one control. It links ids and ARIA for the control inside. | Props: `label`, `name` (reads error and warning from the surrounding `Form`), `description`, `hint`, `error`, `warning`, `required`, `optional`, `disabled`, `icon
|
|
155
|
+
| `FormField` | Label, description, hint, error and required marker around one control. It links ids and ARIA for the control inside. | Props: `label`, `name` (reads error and warning from the surrounding `Form`), `description`, `hint`, `error`, `warning`, `required`, `optional`, `disabled`, `icon`, `help` (an info icon after the label with the text as tooltip, also linked to the control as a description). Slots: default, `label`, `label-actions`, `description`, `hint`. | `core/form-field.vue` |
|
|
156
156
|
| `FieldMessage` | One error, warning or hint line outside a `FormField`. | Props: `message`, `tone` (danger, warning, neutral), `icon`. Slot: default. | `core/field-message.vue` |
|
|
157
157
|
| `FieldBoundary` | Cut the field context for controls inside a `FormField` that are not the main control (a search box above a `Tree`). | Prop: `auxiliary` (keeps own id, follows only `disabled`). Without it the context is fully cut. | `core/form-field.vue` |
|
|
158
158
|
| `Form` | Connects a `useForm` result to a `<form>`. Provides errors to `FormField`, handles submit, reset, focus on first error. | Props: `form` (required), `as` (form or div; use `div` for a form nested in a modal), `focusOnError`, `alerts` (start, end, false), `disabled` (every `FormField` and control inside is disabled; a nested form inherits it unless it sets its own), `guard` (`false` keeps this form out of the leave guard; default: the `guard` option of `useForm`). While mounted it registers its dirty state in the nearest leave scope (`Modal`, `Drawer`, `FormDrawer`, `FormModal`, `SettingsModal`, else the page): leaving it dirty asks `confirm.discard()` first. Not while submitting or disabled. Slot: default, `alerts`. Events: `submitted`, `invalid`, `reset`. | `core/form.vue` |
|
package/README.md
CHANGED
|
@@ -507,7 +507,7 @@ On your own elements, `paletteClass(color)` gives the class of a palette name an
|
|
|
507
507
|
- `Input` and `Textarea` take `counter`: with a `maxlength` attribute they show `length / maxlength` inside the field, describe the control with "12 of 40 characters" (`form.characterCount`) and announce "Character limit reached" when it is hit.
|
|
508
508
|
- Numbers are left aligned in every field. `Input` `numeric` sets the decimal keyboard, the number model and tabular digits; `NumberInput` takes `align="end"` to right align its value when a layout needs it (default `start`).
|
|
509
509
|
- `Input` takes `transform: (value: string) => string`, applied to the typed text before it reaches the model (the caret keeps its place; IME composition is transformed when it ends). `:transform="(value) => value.toUpperCase()"` enforces uppercase codes. Values set from outside are not transformed.
|
|
510
|
-
- `FormField` takes `optional`, a muted localized "Optional" marker in the label row (`form.optional`, `optionalText` overrides it), the counterpart of the required asterisk. It is hidden when the field is required.
|
|
510
|
+
- `FormField` takes `optional`, a muted localized "Optional" marker in the label row (`form.optional`, `optionalText` overrides it), the counterpart of the required asterisk. It is hidden when the field is required. `help` adds an info icon after the label: the text shows as a tooltip on hover and is linked to the control with `aria-describedby`, for a format or a rule that the label cannot say.
|
|
511
511
|
- `CheckboxGroup` takes `columns` (a number): the options are laid out in a grid with that many equal columns. Unset keeps the `orientation` layout. `variant="filled"` (`CheckboxGroupVariant`, `'default' | 'filled'`, default `'default'`) puts the options in a subtle filled panel, styled by `--k-checkbox-group-background` (`--k-subtle`), `--k-checkbox-group-padding` (0.75rem), `--k-checkbox-group-radius` (`--k-radius-md`) and `--k-checkbox-group-border` (none).
|
|
512
512
|
- `Combobox` with `creatable` takes `createTransform` (`ComboboxCreateTransform`, `(input) => string | null | undefined`) and `createValidate` (`ComboboxCreateValidate`, `(input) => string | true | undefined`). The transform runs on the typed text first: the "Create" option shows its result, and an empty result (or `null`) shows no create option. The validator gets the transformed text when the user picks the create option: a returned string is the error, shown inline through the surrounding `FormField` (`useFieldControl().setControlError`, or a `FieldMessage` under the control and an announcement without a field) with `aria-invalid` on the input, and nothing is created; `true` or nothing accepts it. The error clears when the query changes. Both work with `multiple`, where created values become tags: `<KCombobox v-model="tags" multiple creatable :create-transform="(input) => input.toLowerCase()" :create-validate="(input) => input.length >= 3 || 'Too short'" />`.
|
|
513
513
|
- `Combobox` takes `createActions` (`ComboboxCreateActions`, `(query) => ComboboxCreateAction[]`) to show several create items instead of the single "Create" item. Each action has `id` (the item key is `__create:<id>`), `label`, `icon` (default `plus`) and `run(query)`. The actions show at the end of the list under the same conditions as the create item: a non-empty query after `createTransform`, with no option whose label or value matches it exactly. The function gets that text, and an empty array shows no action. `createValidate` runs before `run`. When `run` returns an option, the combobox remembers it, emits `create` and selects it. When it returns nothing (for example it opens a form for the full record), nothing is selected: the query clears and the list closes (with `multiple`, only the query clears). Errors from `run` are logged. `createActions` replaces `creatable`: `<KCombobox v-model="category" :options="categories" :create-actions="(query) => [{ id: 'quick', label: 'Create here', run: createCategory }, { id: 'form', label: 'Create with details', icon: 'pencil-square', run: openForm }]" />`.
|
|
@@ -28,6 +28,11 @@
|
|
|
28
28
|
<span v-if="optional && !isRequired" class="k-form-field-optional">{{
|
|
29
29
|
optionalText ?? t("form.optional")
|
|
30
30
|
}}</span>
|
|
31
|
+
<span v-if="help" class="k-form-field-help">
|
|
32
|
+
<Icon name="information-circle" aria-hidden="true" />
|
|
33
|
+
<span :id="helpId" class="k-visually-hidden">{{ help }}</span>
|
|
34
|
+
<HintTooltip :text="help" />
|
|
35
|
+
</span>
|
|
31
36
|
</label>
|
|
32
37
|
<span v-if="hint || $slots.hint" :id="hintId" class="k-form-field-hint">
|
|
33
38
|
<slot name="hint">{{ hint }}</slot>
|
|
@@ -72,6 +77,7 @@ import { useFormDisabled } from "../../internal/forms/disabled";
|
|
|
72
77
|
import { FIELD_KEY, FIELD_ROLE_KEY } from "../../internal/keys";
|
|
73
78
|
import FieldMessage from "./FieldMessage.vue";
|
|
74
79
|
import Icon from "./Icon.vue";
|
|
80
|
+
import HintTooltip from "../../internal/overlays/HintTooltip.vue";
|
|
75
81
|
const props = defineProps({
|
|
76
82
|
label: { type: String, required: false },
|
|
77
83
|
name: { type: String, required: false },
|
|
@@ -84,6 +90,7 @@ const props = defineProps({
|
|
|
84
90
|
optionalText: { type: String, required: false },
|
|
85
91
|
disabled: { type: Boolean, required: false },
|
|
86
92
|
icon: { type: null, required: false },
|
|
93
|
+
help: { type: String, required: false },
|
|
87
94
|
id: { type: String, required: false }
|
|
88
95
|
});
|
|
89
96
|
const slots = useSlots();
|
|
@@ -95,6 +102,7 @@ const baseId = useId();
|
|
|
95
102
|
const id = computed(() => props.id ?? `${baseId}-control`);
|
|
96
103
|
const labelId = `${baseId}-label`;
|
|
97
104
|
const hintId = `${baseId}-hint`;
|
|
105
|
+
const helpId = `${baseId}-help`;
|
|
98
106
|
const descriptionId = `${baseId}-description`;
|
|
99
107
|
const messageId = `${baseId}-message`;
|
|
100
108
|
const controlErrors = shallowReactive(/* @__PURE__ */ new Map());
|
|
@@ -139,6 +147,7 @@ const hasLabelRow = computed(
|
|
|
139
147
|
);
|
|
140
148
|
const describedBy = computed(
|
|
141
149
|
() => joinIds(
|
|
150
|
+
props.help && helpId,
|
|
142
151
|
(props.hint || slots.hint) && hintId,
|
|
143
152
|
(props.description || slots.description) && descriptionId,
|
|
144
153
|
(errorMessage.value || warningMessage.value) && messageId
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import type { IconName } from '../../composables/useIcons';
|
|
2
|
-
declare var __VLS_6: {},
|
|
2
|
+
declare var __VLS_6: {}, __VLS_18: {}, __VLS_20: {}, __VLS_22: {
|
|
3
3
|
id: string;
|
|
4
4
|
describedBy: string | undefined;
|
|
5
5
|
invalid: boolean;
|
|
6
|
-
},
|
|
6
|
+
}, __VLS_24: {};
|
|
7
7
|
type __VLS_Slots = {} & {
|
|
8
8
|
label?: (props: typeof __VLS_6) => any;
|
|
9
9
|
} & {
|
|
10
|
-
hint?: (props: typeof
|
|
10
|
+
hint?: (props: typeof __VLS_18) => any;
|
|
11
11
|
} & {
|
|
12
|
-
'label-actions'?: (props: typeof
|
|
12
|
+
'label-actions'?: (props: typeof __VLS_20) => any;
|
|
13
13
|
} & {
|
|
14
|
-
default?: (props: typeof
|
|
14
|
+
default?: (props: typeof __VLS_22) => any;
|
|
15
15
|
} & {
|
|
16
|
-
description?: (props: typeof
|
|
16
|
+
description?: (props: typeof __VLS_24) => any;
|
|
17
17
|
};
|
|
18
18
|
declare const __VLS_base: import("vue").DefineComponent<{
|
|
19
19
|
label?: string;
|
|
@@ -27,6 +27,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
27
27
|
optionalText?: string;
|
|
28
28
|
disabled?: boolean;
|
|
29
29
|
icon?: IconName;
|
|
30
|
+
help?: string;
|
|
30
31
|
id?: string | undefined;
|
|
31
32
|
innerHTML?: string | undefined | undefined;
|
|
32
33
|
class?: import("vue").ClassValue;
|
|
@@ -231,6 +232,7 @@ declare const __VLS_base: import("vue").DefineComponent<{
|
|
|
231
232
|
optionalText?: string;
|
|
232
233
|
disabled?: boolean;
|
|
233
234
|
icon?: IconName;
|
|
235
|
+
help?: string;
|
|
234
236
|
id?: string | undefined;
|
|
235
237
|
innerHTML?: string | undefined | undefined;
|
|
236
238
|
class?: import("vue").ClassValue;
|
|
@@ -62,6 +62,13 @@
|
|
|
62
62
|
animation: k-shake 320ms var(--k-ease);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
.k-form-field-help {
|
|
66
|
+
--k-icon-size: 0.875rem;
|
|
67
|
+
display: inline-flex;
|
|
68
|
+
color: var(--k-text-dimmed);
|
|
69
|
+
cursor: help;
|
|
70
|
+
}
|
|
71
|
+
|
|
65
72
|
.k-form-field.is-disabled .k-form-field-label {
|
|
66
73
|
color: var(--k-text-muted);
|
|
67
74
|
}
|
package/package.json
CHANGED