@humanonlyweb/ui 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +45 -2
- package/dist/components/accordion/Accordion.js +60 -0
- package/dist/components/accordion/Accordion.vue.d.ts +28 -0
- package/dist/components/accordion/AccordionItem.js +102 -0
- package/dist/components/accordion/AccordionItem.vue.d.ts +33 -0
- package/dist/components/avatar/Avatar.js +52 -0
- package/dist/components/avatar/Avatar.vue.d.ts +26 -0
- package/dist/components/avatar/AvatarGroup.js +48 -0
- package/dist/components/avatar/AvatarGroup.vue.d.ts +16 -0
- package/dist/components/breadcrumbs/Breadcrumbs.js +59 -0
- package/dist/components/breadcrumbs/Breadcrumbs.vue.d.ts +14 -0
- package/dist/components/button/Button.js +95 -0
- package/dist/components/button/Button.vue.d.ts +74 -0
- package/dist/components/button/IconButton.js +47 -0
- package/dist/components/button/IconButton.vue.d.ts +115 -0
- package/dist/components/checkbox/Checkbox.js +93 -0
- package/dist/components/checkbox/Checkbox.vue.d.ts +43 -0
- package/dist/components/checkbox-group/CheckboxGroup.js +89 -0
- package/dist/components/checkbox-group/CheckboxGroup.vue.d.ts +43 -0
- package/dist/components/combobox/Combobox.js +294 -0
- package/dist/components/combobox/Combobox.vue.d.ts +80 -0
- package/dist/components/context-menu/ContextMenu.js +170 -0
- package/dist/components/context-menu/ContextMenu.vue.d.ts +38 -0
- package/dist/components/dialog/ConfirmDialog.js +103 -0
- package/dist/components/dialog/ConfirmDialog.vue.d.ts +46 -0
- package/dist/components/dialog/Dialog.js +160 -0
- package/dist/components/dialog/Dialog.vue.d.ts +54 -0
- package/dist/components/field/FieldMessage.js +31 -0
- package/dist/components/fieldset/Fieldset.js +59 -0
- package/dist/components/fieldset/Fieldset.vue.d.ts +29 -0
- package/dist/components/input/Input.js +111 -0
- package/dist/components/input/Input.vue.d.ts +50 -0
- package/dist/components/kbd/Kbd.js +48 -0
- package/dist/components/kbd/Kbd.vue.d.ts +24 -0
- package/dist/components/menu/Menu.js +124 -0
- package/dist/components/menu/Menu.vue.d.ts +41 -0
- package/dist/components/otp-input/OtpInput.js +179 -0
- package/dist/components/otp-input/OtpInput.vue.d.ts +48 -0
- package/dist/components/pagination/Pagination.js +128 -0
- package/dist/components/pagination/Pagination.vue.d.ts +24 -0
- package/dist/components/password-input/PasswordInput.js +151 -0
- package/dist/components/password-input/PasswordInput.vue.d.ts +32 -0
- package/dist/components/popover/Popover.js +83 -0
- package/dist/components/popover/Popover.vue.d.ts +37 -0
- package/dist/components/progress/Progress.js +52 -0
- package/dist/components/progress/Progress.vue.d.ts +17 -0
- package/dist/components/radio-group/RadioGroup.js +125 -0
- package/dist/components/radio-group/RadioGroup.vue.d.ts +45 -0
- package/dist/components/segmented/Segmented.js +110 -0
- package/dist/components/segmented/Segmented.vue.d.ts +41 -0
- package/dist/components/select/Select.js +231 -0
- package/dist/components/select/Select.vue.d.ts +59 -0
- package/dist/components/slider/Slider.js +196 -0
- package/dist/components/slider/Slider.vue.d.ts +49 -0
- package/dist/components/spin-button/SpinButton.js +231 -0
- package/dist/components/spin-button/SpinButton.vue.d.ts +48 -0
- package/dist/components/split-button/SplitButton.js +69 -0
- package/dist/components/split-button/SplitButton.vue.d.ts +38 -0
- package/dist/components/switch/Switch.js +95 -0
- package/dist/components/switch/Switch.vue.d.ts +42 -0
- package/dist/components/table/Table.js +173 -0
- package/dist/components/table/Table.vue.d.ts +45 -0
- package/dist/components/tabs/Tabs.js +103 -0
- package/dist/components/tabs/Tabs.vue.d.ts +39 -0
- package/dist/components/tag-input/TagInput.js +186 -0
- package/dist/components/tag-input/TagInput.vue.d.ts +36 -0
- package/dist/components/textarea/Textarea.js +118 -0
- package/dist/components/textarea/Textarea.vue.d.ts +34 -0
- package/dist/components/toast/ToastItem.js +91 -0
- package/dist/components/toast/ToastItem.vue.d.ts +29 -0
- package/dist/components/toast/ToastViewport.js +56 -0
- package/dist/components/toast/ToastViewport.vue.d.ts +25 -0
- package/dist/components/toolbar/Toolbar.js +91 -0
- package/dist/components/toolbar/Toolbar.vue.d.ts +21 -0
- package/dist/components/tooltip/Tooltip.js +85 -0
- package/dist/components/tooltip/Tooltip.vue.d.ts +25 -0
- package/dist/components/visually-hidden/VisuallyHidden.js +16 -0
- package/dist/components/visually-hidden/VisuallyHidden.vue.d.ts +19 -0
- package/dist/composables/internal/env.js +5 -0
- package/dist/composables/internal/is-equal.js +14 -0
- package/dist/composables/internal/on-click-outside.js +18 -0
- package/dist/composables/internal/standard-schema.d.ts +38 -0
- package/dist/composables/internal/use-document-visibility.js +16 -0
- package/dist/composables/internal/use-event-listener.js +24 -0
- package/dist/composables/internal/use-interval-fn.js +21 -0
- package/dist/composables/internal/use-resize-observer.js +21 -0
- package/dist/composables/internal/use-timeout-fn.js +25 -0
- package/dist/composables/use-accordion.d.ts +9 -0
- package/dist/composables/use-accordion.js +10 -0
- package/dist/composables/use-combobox.d.ts +44 -0
- package/dist/composables/use-combobox.js +185 -0
- package/dist/composables/use-field.d.ts +17 -0
- package/dist/composables/use-field.js +27 -0
- package/dist/composables/use-form.d.ts +44 -0
- package/dist/composables/use-form.js +146 -0
- package/dist/composables/use-menu.d.ts +26 -0
- package/dist/composables/use-menu.js +117 -0
- package/dist/composables/use-platform.d.ts +17 -0
- package/dist/composables/use-platform.js +126 -0
- package/dist/composables/use-popover.d.ts +35 -0
- package/dist/composables/use-popover.js +49 -0
- package/dist/composables/use-roving-selection.d.ts +22 -0
- package/dist/composables/use-roving-selection.js +65 -0
- package/dist/composables/use-select.d.ts +31 -0
- package/dist/composables/use-select.js +169 -0
- package/dist/composables/use-slide-indicator.d.ts +24 -0
- package/dist/composables/use-slide-indicator.js +52 -0
- package/dist/composables/use-toast.d.ts +23 -0
- package/dist/composables/use-toast.js +51 -0
- package/dist/config.d.ts +40 -0
- package/dist/config.js +35 -0
- package/dist/docs/README.md +52 -0
- package/dist/docs/changelog.md +21 -0
- package/dist/docs/components/accordion.md +100 -0
- package/dist/docs/components/avatar-group.md +58 -0
- package/dist/docs/components/avatar.md +40 -0
- package/dist/docs/components/breadcrumbs.md +81 -0
- package/dist/docs/components/button.md +109 -0
- package/dist/docs/components/checkbox-group.md +118 -0
- package/dist/docs/components/checkbox.md +123 -0
- package/dist/docs/components/combobox.md +207 -0
- package/dist/docs/components/confirm-dialog.md +107 -0
- package/dist/docs/components/context-menu.md +98 -0
- package/dist/docs/components/dialog.md +127 -0
- package/dist/docs/components/fieldset.md +65 -0
- package/dist/docs/components/icon-button.md +47 -0
- package/dist/docs/components/input.md +89 -0
- package/dist/docs/components/kbd.md +41 -0
- package/dist/docs/components/menu.md +112 -0
- package/dist/docs/components/otp-input.md +92 -0
- package/dist/docs/components/pagination.md +62 -0
- package/dist/docs/components/password-input.md +55 -0
- package/dist/docs/components/popover.md +72 -0
- package/dist/docs/components/progress.md +56 -0
- package/dist/docs/components/radio-group.md +114 -0
- package/dist/docs/components/segmented.md +96 -0
- package/dist/docs/components/select.md +129 -0
- package/dist/docs/components/slider.md +105 -0
- package/dist/docs/components/spin-button.md +73 -0
- package/dist/docs/components/split-button.md +64 -0
- package/dist/docs/components/switch.md +71 -0
- package/dist/docs/components/table.md +241 -0
- package/dist/docs/components/tabs.md +106 -0
- package/dist/docs/components/tag-input.md +88 -0
- package/dist/docs/components/textarea.md +46 -0
- package/dist/docs/components/toast.md +135 -0
- package/dist/docs/components/toolbar.md +71 -0
- package/dist/docs/components/tooltip.md +57 -0
- package/dist/docs/components/visually-hidden.md +53 -0
- package/dist/docs/forms.md +182 -0
- package/dist/docs/index.md +11 -0
- package/dist/docs/installation.md +71 -0
- package/dist/docs/localisation.md +42 -0
- package/dist/docs/ssr.md +24 -0
- package/dist/docs/styling.md +82 -0
- package/dist/index.d.ts +60 -0
- package/dist/index.js +56 -0
- package/dist/nuxt/module.d.ts +15 -0
- package/dist/nuxt/module.js +80 -0
- package/dist/nuxt/runtime/plugin.d.ts +4 -0
- package/dist/nuxt/runtime/plugin.js +24 -0
- package/dist/package.js +4 -0
- package/dist/styles/core.css +310 -0
- package/dist/translations.d.ts +85 -0
- package/dist/translations.js +62 -0
- package/dist/types.d.ts +69 -0
- package/package.json +93 -4
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ButtonSize, ButtonType, ButtonVariant, LinkTarget, LinkTo } from "../../types.js";
|
|
2
|
+
//#region src/components/button/Button.vue.d.ts
|
|
3
|
+
type BaseButtonProps = {
|
|
4
|
+
/** Style hook, exposed as `data-button-variant`. */
|
|
5
|
+
variant?: ButtonVariant;
|
|
6
|
+
/** Size hook, exposed as `data-button-size`. */
|
|
7
|
+
size?: ButtonSize;
|
|
8
|
+
/** Layout hook, exposed as `data-button-full-width`. */
|
|
9
|
+
fullWidth?: boolean;
|
|
10
|
+
/** Busy state: blocks clicks and sets `aria-busy`, but stays focusable. */
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
/** Disables the button. A disabled link loses its `href` and leaves the tab order. */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
};
|
|
15
|
+
type __VLS_Slots = {
|
|
16
|
+
/** Label. */
|
|
17
|
+
default?(): unknown;
|
|
18
|
+
/** Before the label, e.g. an icon. */
|
|
19
|
+
leading?(): unknown;
|
|
20
|
+
/** After the label, e.g. an icon. */
|
|
21
|
+
trailing?(): unknown;
|
|
22
|
+
/** Shown while `loading`. */
|
|
23
|
+
spinner?(): unknown;
|
|
24
|
+
};
|
|
25
|
+
declare const __VLS_base: import("vue").DefineComponent<(BaseButtonProps & {
|
|
26
|
+
/** Native button type. */
|
|
27
|
+
type?: ButtonType;
|
|
28
|
+
href?: never;
|
|
29
|
+
to?: never;
|
|
30
|
+
target?: never;
|
|
31
|
+
}) | (BaseButtonProps & {
|
|
32
|
+
/** Route for the router link given to `createUi({ link })`, rendering it instead of a `<button>`. */
|
|
33
|
+
to: LinkTo;
|
|
34
|
+
href?: never;
|
|
35
|
+
type?: never;
|
|
36
|
+
/** Link target. */
|
|
37
|
+
target?: LinkTarget;
|
|
38
|
+
}) | (BaseButtonProps & {
|
|
39
|
+
/** Renders an `<a>` to this URL instead of a `<button>`. */
|
|
40
|
+
href: string;
|
|
41
|
+
/** Link target. */
|
|
42
|
+
target?: LinkTarget;
|
|
43
|
+
type?: never;
|
|
44
|
+
to?: never;
|
|
45
|
+
}), {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<(BaseButtonProps & {
|
|
46
|
+
/** Native button type. */
|
|
47
|
+
type?: ButtonType;
|
|
48
|
+
href?: never;
|
|
49
|
+
to?: never;
|
|
50
|
+
target?: never;
|
|
51
|
+
}) | (BaseButtonProps & {
|
|
52
|
+
/** Route for the router link given to `createUi({ link })`, rendering it instead of a `<button>`. */
|
|
53
|
+
to: LinkTo;
|
|
54
|
+
href?: never;
|
|
55
|
+
type?: never;
|
|
56
|
+
/** Link target. */
|
|
57
|
+
target?: LinkTarget;
|
|
58
|
+
}) | (BaseButtonProps & {
|
|
59
|
+
/** Renders an `<a>` to this URL instead of a `<button>`. */
|
|
60
|
+
href: string;
|
|
61
|
+
/** Link target. */
|
|
62
|
+
target?: LinkTarget;
|
|
63
|
+
type?: never;
|
|
64
|
+
to?: never;
|
|
65
|
+
})> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
66
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
67
|
+
declare const _default: typeof __VLS_export;
|
|
68
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
69
|
+
new (): {
|
|
70
|
+
$slots: S;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
//#endregion
|
|
74
|
+
export { _default as default };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import _sfc_main$1 from "./Button.js";
|
|
2
|
+
import { createBlock, createPropsRestProxy, createSlots, defineComponent, mergeProps, openBlock, renderSlot, withCtx } from "vue";
|
|
3
|
+
//#region src/components/button/IconButton.vue
|
|
4
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
5
|
+
__name: "IconButton",
|
|
6
|
+
props: {
|
|
7
|
+
variant: { default: "ghost" },
|
|
8
|
+
size: {},
|
|
9
|
+
fullWidth: { type: Boolean },
|
|
10
|
+
loading: { type: Boolean },
|
|
11
|
+
disabled: { type: Boolean },
|
|
12
|
+
type: {},
|
|
13
|
+
href: {},
|
|
14
|
+
to: {},
|
|
15
|
+
target: {},
|
|
16
|
+
label: {},
|
|
17
|
+
shape: {}
|
|
18
|
+
},
|
|
19
|
+
setup(__props) {
|
|
20
|
+
const rest = createPropsRestProxy(__props, [
|
|
21
|
+
"label",
|
|
22
|
+
"shape",
|
|
23
|
+
"variant"
|
|
24
|
+
]);
|
|
25
|
+
return (_ctx, _cache) => {
|
|
26
|
+
return openBlock(), createBlock(_sfc_main$1, mergeProps(rest, {
|
|
27
|
+
variant: __props.variant,
|
|
28
|
+
"aria-label": __props.label,
|
|
29
|
+
"data-button-shape": __props.shape,
|
|
30
|
+
"data-button-icon-only": ""
|
|
31
|
+
}), createSlots({
|
|
32
|
+
spinner: withCtx(() => [renderSlot(_ctx.$slots, "spinner")]),
|
|
33
|
+
_: 2
|
|
34
|
+
}, [!rest.loading ? {
|
|
35
|
+
name: "leading",
|
|
36
|
+
fn: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
37
|
+
key: "0"
|
|
38
|
+
} : void 0]), 1040, [
|
|
39
|
+
"variant",
|
|
40
|
+
"aria-label",
|
|
41
|
+
"data-button-shape"
|
|
42
|
+
]);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
//#endregion
|
|
47
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { ButtonSize, ButtonType, ButtonVariant, LinkTarget, LinkTo } from "../../types.js";
|
|
2
|
+
import "../../index.js";
|
|
3
|
+
//#region src/components/button/IconButton.vue.d.ts
|
|
4
|
+
type __VLS_Slots = {
|
|
5
|
+
/** The icon. */
|
|
6
|
+
default?(): unknown;
|
|
7
|
+
/** Shown while `loading`, in place of the icon. */
|
|
8
|
+
spinner?(): unknown;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_base: import("vue").DefineComponent<({
|
|
11
|
+
variant?: ButtonVariant;
|
|
12
|
+
size?: ButtonSize;
|
|
13
|
+
fullWidth?: boolean;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
} & {
|
|
17
|
+
type?: ButtonType;
|
|
18
|
+
href?: never;
|
|
19
|
+
to?: never;
|
|
20
|
+
target?: never;
|
|
21
|
+
} & {
|
|
22
|
+
/** Accessible name; icon-only buttons have no visible text to supply one. */
|
|
23
|
+
label: string;
|
|
24
|
+
/** Shape hook, exposed as `data-button-shape`. */
|
|
25
|
+
shape?: "square" | "round";
|
|
26
|
+
}) | ({
|
|
27
|
+
variant?: ButtonVariant;
|
|
28
|
+
size?: ButtonSize;
|
|
29
|
+
fullWidth?: boolean;
|
|
30
|
+
loading?: boolean;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
} & {
|
|
33
|
+
to: LinkTo;
|
|
34
|
+
href?: never;
|
|
35
|
+
type?: never;
|
|
36
|
+
target?: LinkTarget;
|
|
37
|
+
} & {
|
|
38
|
+
/** Accessible name; icon-only buttons have no visible text to supply one. */
|
|
39
|
+
label: string;
|
|
40
|
+
/** Shape hook, exposed as `data-button-shape`. */
|
|
41
|
+
shape?: "square" | "round";
|
|
42
|
+
}) | ({
|
|
43
|
+
variant?: ButtonVariant;
|
|
44
|
+
size?: ButtonSize;
|
|
45
|
+
fullWidth?: boolean;
|
|
46
|
+
loading?: boolean;
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
} & {
|
|
49
|
+
href: string;
|
|
50
|
+
target?: LinkTarget;
|
|
51
|
+
type?: never;
|
|
52
|
+
to?: never;
|
|
53
|
+
} & {
|
|
54
|
+
/** Accessible name; icon-only buttons have no visible text to supply one. */
|
|
55
|
+
label: string;
|
|
56
|
+
/** Shape hook, exposed as `data-button-shape`. */
|
|
57
|
+
shape?: "square" | "round";
|
|
58
|
+
}), {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<({
|
|
59
|
+
variant?: ButtonVariant;
|
|
60
|
+
size?: ButtonSize;
|
|
61
|
+
fullWidth?: boolean;
|
|
62
|
+
loading?: boolean;
|
|
63
|
+
disabled?: boolean;
|
|
64
|
+
} & {
|
|
65
|
+
type?: ButtonType;
|
|
66
|
+
href?: never;
|
|
67
|
+
to?: never;
|
|
68
|
+
target?: never;
|
|
69
|
+
} & {
|
|
70
|
+
/** Accessible name; icon-only buttons have no visible text to supply one. */
|
|
71
|
+
label: string;
|
|
72
|
+
/** Shape hook, exposed as `data-button-shape`. */
|
|
73
|
+
shape?: "square" | "round";
|
|
74
|
+
}) | ({
|
|
75
|
+
variant?: ButtonVariant;
|
|
76
|
+
size?: ButtonSize;
|
|
77
|
+
fullWidth?: boolean;
|
|
78
|
+
loading?: boolean;
|
|
79
|
+
disabled?: boolean;
|
|
80
|
+
} & {
|
|
81
|
+
to: LinkTo;
|
|
82
|
+
href?: never;
|
|
83
|
+
type?: never;
|
|
84
|
+
target?: LinkTarget;
|
|
85
|
+
} & {
|
|
86
|
+
/** Accessible name; icon-only buttons have no visible text to supply one. */
|
|
87
|
+
label: string;
|
|
88
|
+
/** Shape hook, exposed as `data-button-shape`. */
|
|
89
|
+
shape?: "square" | "round";
|
|
90
|
+
}) | ({
|
|
91
|
+
variant?: ButtonVariant;
|
|
92
|
+
size?: ButtonSize;
|
|
93
|
+
fullWidth?: boolean;
|
|
94
|
+
loading?: boolean;
|
|
95
|
+
disabled?: boolean;
|
|
96
|
+
} & {
|
|
97
|
+
href: string;
|
|
98
|
+
target?: LinkTarget;
|
|
99
|
+
type?: never;
|
|
100
|
+
to?: never;
|
|
101
|
+
} & {
|
|
102
|
+
/** Accessible name; icon-only buttons have no visible text to supply one. */
|
|
103
|
+
label: string;
|
|
104
|
+
/** Shape hook, exposed as `data-button-shape`. */
|
|
105
|
+
shape?: "square" | "round";
|
|
106
|
+
})> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
107
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
108
|
+
declare const _default: typeof __VLS_export;
|
|
109
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
110
|
+
new (): {
|
|
111
|
+
$slots: S;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
export { _default as default };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { useField } from "../../composables/use-field.js";
|
|
2
|
+
import _sfc_main$1 from "../field/FieldMessage.js";
|
|
3
|
+
import { Fragment, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, mergeProps, openBlock, renderSlot, toDisplayString, unref, useModel, useTemplateRef, vModelCheckbox, watchEffect, withDirectives } from "vue";
|
|
4
|
+
//#region src/components/checkbox/Checkbox.vue
|
|
5
|
+
const _hoisted_1 = ["data-checkbox-disabled", "data-checkbox-error"];
|
|
6
|
+
const _hoisted_2 = [
|
|
7
|
+
"id",
|
|
8
|
+
"value",
|
|
9
|
+
"disabled",
|
|
10
|
+
"aria-invalid",
|
|
11
|
+
"aria-describedby"
|
|
12
|
+
];
|
|
13
|
+
const _hoisted_3 = {
|
|
14
|
+
"data-part": "checkbox-control",
|
|
15
|
+
"aria-hidden": "true"
|
|
16
|
+
};
|
|
17
|
+
const _hoisted_4 = {
|
|
18
|
+
key: 0,
|
|
19
|
+
"data-part": "checkbox-label"
|
|
20
|
+
};
|
|
21
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
22
|
+
inheritAttrs: false,
|
|
23
|
+
__name: "Checkbox",
|
|
24
|
+
props: /*@__PURE__*/ mergeModels({
|
|
25
|
+
label: {},
|
|
26
|
+
disabled: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
default: false
|
|
29
|
+
},
|
|
30
|
+
indeterminate: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
default: false
|
|
33
|
+
},
|
|
34
|
+
value: {},
|
|
35
|
+
hint: {},
|
|
36
|
+
error: { type: [String, Boolean] },
|
|
37
|
+
id: {}
|
|
38
|
+
}, {
|
|
39
|
+
"modelValue": { type: [Boolean, Array] },
|
|
40
|
+
"modelModifiers": {}
|
|
41
|
+
}),
|
|
42
|
+
emits: ["update:modelValue"],
|
|
43
|
+
setup(__props) {
|
|
44
|
+
/** Checked state, or with an array, the checked `value`s. */
|
|
45
|
+
const model = useModel(__props, "modelValue");
|
|
46
|
+
const { id, hintId, errorId, isError, errorMessage, describedBy } = useField({
|
|
47
|
+
id: () => __props.id,
|
|
48
|
+
hint: () => __props.hint,
|
|
49
|
+
error: () => __props.error
|
|
50
|
+
});
|
|
51
|
+
const inputRef = useTemplateRef("input");
|
|
52
|
+
watchEffect(() => {
|
|
53
|
+
if (inputRef.value) inputRef.value.indeterminate = __props.indeterminate;
|
|
54
|
+
});
|
|
55
|
+
return (_ctx, _cache) => {
|
|
56
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
57
|
+
createElementVNode("label", {
|
|
58
|
+
"data-part": "checkbox",
|
|
59
|
+
"data-checkbox-disabled": __props.disabled || void 0,
|
|
60
|
+
"data-checkbox-error": unref(isError) || void 0
|
|
61
|
+
}, [
|
|
62
|
+
withDirectives(createElementVNode("input", mergeProps({
|
|
63
|
+
id: unref(id),
|
|
64
|
+
ref: "input",
|
|
65
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
66
|
+
type: "checkbox",
|
|
67
|
+
"data-part": "checkbox-input",
|
|
68
|
+
value: __props.value,
|
|
69
|
+
disabled: __props.disabled,
|
|
70
|
+
"aria-invalid": unref(isError) || void 0,
|
|
71
|
+
"aria-describedby": unref(describedBy)
|
|
72
|
+
}, _ctx.$attrs), null, 16, _hoisted_2), [[vModelCheckbox, model.value]]),
|
|
73
|
+
createElementVNode("span", _hoisted_3, [renderSlot(_ctx.$slots, "indicator")]),
|
|
74
|
+
_ctx.$slots.default || __props.label ? (openBlock(), createElementBlock("span", _hoisted_4, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])])) : createCommentVNode("v-if", true)
|
|
75
|
+
], 8, _hoisted_1),
|
|
76
|
+
createCommentVNode(" A sibling, not a wrapper: without a hint or error the markup is just the label. "),
|
|
77
|
+
createVNode(_sfc_main$1, {
|
|
78
|
+
"error-id": unref(errorId),
|
|
79
|
+
"hint-id": unref(hintId),
|
|
80
|
+
"error-message": unref(errorMessage),
|
|
81
|
+
hint: __props.hint
|
|
82
|
+
}, null, 8, [
|
|
83
|
+
"error-id",
|
|
84
|
+
"hint-id",
|
|
85
|
+
"error-message",
|
|
86
|
+
"hint"
|
|
87
|
+
])
|
|
88
|
+
], 64);
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
//#endregion
|
|
93
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SelectValue } from "../../types.js";
|
|
2
|
+
//#region src/components/checkbox/Checkbox.vue.d.ts
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
/** Text next to the box. The default slot overrides it. */
|
|
5
|
+
label?: string;
|
|
6
|
+
/** Disables the checkbox. */
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/** Shows the mixed state, e.g. for a "select all" with some rows picked. */
|
|
9
|
+
indeterminate?: boolean;
|
|
10
|
+
/** With an array `v-model`, this value is added/removed when toggled. */
|
|
11
|
+
value?: SelectValue;
|
|
12
|
+
/** Help text under the checkbox, announced as its description. */
|
|
13
|
+
hint?: string;
|
|
14
|
+
/** `true` marks it invalid; a string also shows it as the message, replacing the hint. */
|
|
15
|
+
error?: string | boolean;
|
|
16
|
+
/** Id for the input; generated with `useId()` when omitted. */
|
|
17
|
+
id?: string;
|
|
18
|
+
};
|
|
19
|
+
type __VLS_Slots = {
|
|
20
|
+
/** Label content, replacing `label`. */
|
|
21
|
+
default?(): unknown;
|
|
22
|
+
/** Inside `checkbox-control`, e.g. a check icon. */
|
|
23
|
+
indicator?(): unknown;
|
|
24
|
+
};
|
|
25
|
+
type __VLS_ModelProps = {
|
|
26
|
+
/** Checked state, or with an array, the checked `value`s. */
|
|
27
|
+
modelValue?: boolean | SelectValue[];
|
|
28
|
+
};
|
|
29
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
30
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
31
|
+
"update:modelValue": (value: boolean | SelectValue[] | undefined) => any;
|
|
32
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
33
|
+
"onUpdate:modelValue"?: ((value: boolean | SelectValue[] | undefined) => any) | undefined;
|
|
34
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
35
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
36
|
+
declare const _default: typeof __VLS_export;
|
|
37
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
38
|
+
new (): {
|
|
39
|
+
$slots: S;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { _default as default };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import _sfc_main$1 from "../checkbox/Checkbox.js";
|
|
2
|
+
import _sfc_main$2 from "../fieldset/Fieldset.js";
|
|
3
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeModels, openBlock, renderList, renderSlot, toDisplayString, useModel, withCtx } from "vue";
|
|
4
|
+
//#region src/components/checkbox-group/CheckboxGroup.vue
|
|
5
|
+
const _hoisted_1 = ["data-orientation", "data-field-name"];
|
|
6
|
+
const _hoisted_2 = ["name", "value"];
|
|
7
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
8
|
+
__name: "CheckboxGroup",
|
|
9
|
+
props: /*@__PURE__*/ mergeModels({
|
|
10
|
+
options: { default: () => [] },
|
|
11
|
+
label: {},
|
|
12
|
+
hint: {},
|
|
13
|
+
error: { type: [String, Boolean] },
|
|
14
|
+
disabled: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: false
|
|
17
|
+
},
|
|
18
|
+
orientation: { default: "vertical" },
|
|
19
|
+
name: {}
|
|
20
|
+
}, {
|
|
21
|
+
"modelValue": {},
|
|
22
|
+
"modelModifiers": {}
|
|
23
|
+
}),
|
|
24
|
+
emits: ["update:modelValue"],
|
|
25
|
+
setup(__props) {
|
|
26
|
+
/** The checked values. */
|
|
27
|
+
const model = useModel(__props, "modelValue");
|
|
28
|
+
const checked = computed(() => new Set(model.value ?? []));
|
|
29
|
+
const isChecked = (value) => checked.value.has(value);
|
|
30
|
+
function toggle(value, on) {
|
|
31
|
+
const values = new Set(model.value ?? []);
|
|
32
|
+
if (on) values.add(value);
|
|
33
|
+
else values.delete(value);
|
|
34
|
+
model.value = __props.options.filter((option) => values.has(option.value)).map((option) => option.value);
|
|
35
|
+
}
|
|
36
|
+
return (_ctx, _cache) => {
|
|
37
|
+
return openBlock(), createBlock(_sfc_main$2, {
|
|
38
|
+
legend: __props.label,
|
|
39
|
+
hint: __props.hint,
|
|
40
|
+
error: __props.error,
|
|
41
|
+
disabled: __props.disabled
|
|
42
|
+
}, {
|
|
43
|
+
default: withCtx(() => [createElementVNode("div", {
|
|
44
|
+
"data-part": "checkbox-group",
|
|
45
|
+
"data-orientation": __props.orientation,
|
|
46
|
+
"data-field-name": __props.name
|
|
47
|
+
}, [
|
|
48
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
|
|
49
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
50
|
+
key: option.value,
|
|
51
|
+
label: option.label,
|
|
52
|
+
"model-value": isChecked(option.value),
|
|
53
|
+
disabled: __props.disabled || option.disabled,
|
|
54
|
+
"onUpdate:modelValue": (on) => toggle(option.value, on === true)
|
|
55
|
+
}, {
|
|
56
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "option", {
|
|
57
|
+
option,
|
|
58
|
+
checked: isChecked(option.value)
|
|
59
|
+
}, () => [createTextVNode(toDisplayString(option.label), 1)])]),
|
|
60
|
+
_: 2
|
|
61
|
+
}, 1032, [
|
|
62
|
+
"label",
|
|
63
|
+
"model-value",
|
|
64
|
+
"disabled",
|
|
65
|
+
"onUpdate:modelValue"
|
|
66
|
+
]);
|
|
67
|
+
}), 128)),
|
|
68
|
+
createCommentVNode(" The visual checkboxes are native, but an array needs one input per value to submit. "),
|
|
69
|
+
__props.name ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(model.value, (value) => {
|
|
70
|
+
return openBlock(), createElementBlock("input", {
|
|
71
|
+
key: value,
|
|
72
|
+
type: "hidden",
|
|
73
|
+
name: __props.name,
|
|
74
|
+
value
|
|
75
|
+
}, null, 8, _hoisted_2);
|
|
76
|
+
}), 128)) : createCommentVNode("v-if", true)
|
|
77
|
+
], 8, _hoisted_1)]),
|
|
78
|
+
_: 3
|
|
79
|
+
}, 8, [
|
|
80
|
+
"legend",
|
|
81
|
+
"hint",
|
|
82
|
+
"error",
|
|
83
|
+
"disabled"
|
|
84
|
+
]);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
//#endregion
|
|
89
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SelectOption, SelectValue } from "../../types.js";
|
|
2
|
+
//#region src/components/checkbox-group/CheckboxGroup.vue.d.ts
|
|
3
|
+
declare const __VLS_export: <T extends SelectValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<({
|
|
5
|
+
/** Checkboxes to render, in order. */
|
|
6
|
+
options?: SelectOption<T>[];
|
|
7
|
+
/** Visible group label, which names the fieldset. */
|
|
8
|
+
label?: string;
|
|
9
|
+
/** Help text under the legend, announced as the group's description. */
|
|
10
|
+
hint?: string;
|
|
11
|
+
/** `true` marks the group invalid; a string also shows it as the message, replacing the hint. */
|
|
12
|
+
error?: string | boolean;
|
|
13
|
+
/** Disables every checkbox. */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Layout hook, exposed as `data-orientation`. */
|
|
16
|
+
orientation?: "vertical" | "horizontal";
|
|
17
|
+
/** Form field name: submits the checked values with a native form, via hidden inputs. */
|
|
18
|
+
name?: string;
|
|
19
|
+
} & {
|
|
20
|
+
/** The checked values. */
|
|
21
|
+
modelValue?: T[];
|
|
22
|
+
}) & {
|
|
23
|
+
"onUpdate:modelValue"?: ((value: T[] | undefined) => any) | undefined;
|
|
24
|
+
}> & (typeof globalThis extends {
|
|
25
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
26
|
+
} ? P : {});
|
|
27
|
+
expose: (exposed: {}) => void;
|
|
28
|
+
attrs: any;
|
|
29
|
+
slots: {
|
|
30
|
+
/** Checkbox content, replacing the box and label. */
|
|
31
|
+
option?(props: {
|
|
32
|
+
option: SelectOption<T>;
|
|
33
|
+
checked: boolean;
|
|
34
|
+
}): unknown;
|
|
35
|
+
};
|
|
36
|
+
emit: (event: "update:modelValue", value: T[] | undefined) => void;
|
|
37
|
+
}>) => import("vue").VNode & {
|
|
38
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
39
|
+
};
|
|
40
|
+
declare const _default: typeof __VLS_export;
|
|
41
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { _default as default };
|