@humanonlyweb/ui 0.1.0 → 0.2.1

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.
Files changed (48) hide show
  1. package/dist/components/breadcrumbs/Breadcrumbs.js +59 -0
  2. package/dist/components/breadcrumbs/Breadcrumbs.vue.d.ts +14 -0
  3. package/dist/components/checkbox-group/CheckboxGroup.js +89 -0
  4. package/dist/components/checkbox-group/CheckboxGroup.vue.d.ts +43 -0
  5. package/dist/components/fieldset/Fieldset.js +59 -0
  6. package/dist/components/fieldset/Fieldset.vue.d.ts +29 -0
  7. package/dist/components/pagination/Pagination.js +128 -0
  8. package/dist/components/pagination/Pagination.vue.d.ts +24 -0
  9. package/dist/components/password-input/PasswordInput.js +151 -0
  10. package/dist/components/password-input/PasswordInput.vue.d.ts +32 -0
  11. package/dist/components/progress/Progress.js +52 -0
  12. package/dist/components/progress/Progress.vue.d.ts +17 -0
  13. package/dist/components/segmented/Segmented.js +5 -5
  14. package/dist/components/tabs/Tabs.js +29 -25
  15. package/dist/components/tag-input/TagInput.js +186 -0
  16. package/dist/components/tag-input/TagInput.vue.d.ts +36 -0
  17. package/dist/components/toggle/Toggle.js +42 -0
  18. package/dist/components/toggle/Toggle.vue.d.ts +30 -0
  19. package/dist/components/toggle-group/ToggleGroup.js +98 -0
  20. package/dist/components/toggle-group/ToggleGroup.vue.d.ts +41 -0
  21. package/dist/components/visually-hidden/VisuallyHidden.js +16 -0
  22. package/dist/components/visually-hidden/VisuallyHidden.vue.d.ts +19 -0
  23. package/dist/docs/README.md +10 -0
  24. package/dist/docs/changelog.md +12 -1
  25. package/dist/docs/components/breadcrumbs.md +81 -0
  26. package/dist/docs/components/checkbox-group.md +118 -0
  27. package/dist/docs/components/fieldset.md +65 -0
  28. package/dist/docs/components/pagination.md +62 -0
  29. package/dist/docs/components/password-input.md +55 -0
  30. package/dist/docs/components/progress.md +56 -0
  31. package/dist/docs/components/tag-input.md +88 -0
  32. package/dist/docs/components/toggle-group.md +125 -0
  33. package/dist/docs/components/toggle.md +81 -0
  34. package/dist/docs/components/visually-hidden.md +53 -0
  35. package/dist/docs/forms.md +1 -1
  36. package/dist/docs/installation.md +0 -2
  37. package/dist/docs/localisation.md +2 -0
  38. package/dist/docs/styling.md +16 -0
  39. package/dist/index.d.ts +44 -28
  40. package/dist/index.js +41 -27
  41. package/dist/nuxt/module.d.ts +1 -1
  42. package/dist/nuxt/module.js +11 -1
  43. package/dist/package.js +1 -1
  44. package/dist/styles/core.css +26 -0
  45. package/dist/translations.d.ts +15 -1
  46. package/dist/translations.js +7 -0
  47. package/dist/types.d.ts +8 -0
  48. package/package.json +1 -1
@@ -0,0 +1,59 @@
1
+ import { useTranslations, useUiConfig } from "../../config.js";
2
+ import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, openBlock, renderList, resolveDynamicComponent, toDisplayString, unref, withCtx } from "vue";
3
+ //#region src/components/breadcrumbs/Breadcrumbs.vue
4
+ const _hoisted_1 = ["aria-label"];
5
+ const _hoisted_2 = { "data-part": "breadcrumbs-list" };
6
+ const _hoisted_3 = ["data-breadcrumbs-current"];
7
+ const _hoisted_4 = {
8
+ key: 0,
9
+ "data-part": "breadcrumbs-separator",
10
+ "aria-hidden": "true"
11
+ };
12
+ const _hoisted_5 = ["href", "aria-current"];
13
+ const _hoisted_6 = ["aria-current"];
14
+ const _sfc_main = /*@__PURE__*/ defineComponent({
15
+ __name: "Breadcrumbs",
16
+ props: {
17
+ items: { default: () => [] },
18
+ label: {},
19
+ separator: { default: "/" }
20
+ },
21
+ setup(__props) {
22
+ const { link } = useUiConfig();
23
+ const translations = useTranslations();
24
+ /** The `to` a configured router link should get, if this crumb is a router location. */
25
+ const routerTarget = (item) => item.to != null && link ? item.to : void 0;
26
+ const hrefOf = (item) => item.href ?? (typeof item.to === "string" && !link ? item.to : void 0);
27
+ return (_ctx, _cache) => {
28
+ return openBlock(), createElementBlock("nav", {
29
+ "data-part": "breadcrumbs",
30
+ "aria-label": __props.label ?? unref(translations).breadcrumbs
31
+ }, [createElementVNode("ol", _hoisted_2, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, index) => {
32
+ return openBlock(), createElementBlock("li", {
33
+ key: index,
34
+ "data-part": "breadcrumbs-item",
35
+ "data-breadcrumbs-current": index === __props.items.length - 1 || void 0
36
+ }, [index > 0 && __props.separator ? (openBlock(), createElementBlock("span", _hoisted_4, toDisplayString(__props.separator), 1)) : createCommentVNode("v-if", true), routerTarget(item) != null ? (openBlock(), createBlock(resolveDynamicComponent(unref(link)), {
37
+ key: 1,
38
+ to: routerTarget(item),
39
+ "data-part": "breadcrumbs-link",
40
+ "aria-current": index === __props.items.length - 1 ? "page" : void 0
41
+ }, {
42
+ default: withCtx(() => [createTextVNode(toDisplayString(item.label), 1)]),
43
+ _: 2
44
+ }, 1032, ["to", "aria-current"])) : hrefOf(item) != null ? (openBlock(), createElementBlock("a", {
45
+ key: 2,
46
+ href: hrefOf(item),
47
+ "data-part": "breadcrumbs-link",
48
+ "aria-current": index === __props.items.length - 1 ? "page" : void 0
49
+ }, toDisplayString(item.label), 9, _hoisted_5)) : (openBlock(), createElementBlock("span", {
50
+ key: 3,
51
+ "data-part": "breadcrumbs-label",
52
+ "aria-current": index === __props.items.length - 1 ? "page" : void 0
53
+ }, toDisplayString(item.label), 9, _hoisted_6))], 8, _hoisted_3);
54
+ }), 128))])], 8, _hoisted_1);
55
+ };
56
+ }
57
+ });
58
+ //#endregion
59
+ export { _sfc_main as default };
@@ -0,0 +1,14 @@
1
+ import { BreadcrumbItem } from "../../types.js";
2
+ //#region src/components/breadcrumbs/Breadcrumbs.vue.d.ts
3
+ type __VLS_Props = {
4
+ /** Crumbs, in order. The last one is the current page. */
5
+ items?: BreadcrumbItem[];
6
+ /** Accessible name for the navigation landmark, when the `breadcrumbs` translation isn't wanted. */
7
+ label?: string;
8
+ /** Text between crumbs, hidden from assistive technology. Leave it empty to style a separator with CSS instead. */
9
+ separator?: string;
10
+ };
11
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ //#endregion
14
+ 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 };
@@ -0,0 +1,59 @@
1
+ import { useField } from "../../composables/use-field.js";
2
+ import _sfc_main$1 from "../field/FieldMessage.js";
3
+ import { createCommentVNode, createElementBlock, createTextVNode, createVNode, defineComponent, openBlock, renderSlot, toDisplayString, unref } from "vue";
4
+ //#region src/components/fieldset/Fieldset.vue
5
+ const _hoisted_1 = [
6
+ "id",
7
+ "disabled",
8
+ "data-field-error",
9
+ "aria-describedby"
10
+ ];
11
+ const _hoisted_2 = {
12
+ key: 0,
13
+ "data-part": "fieldset-legend"
14
+ };
15
+ const _sfc_main = /*@__PURE__*/ defineComponent({
16
+ __name: "Fieldset",
17
+ props: {
18
+ legend: {},
19
+ hint: {},
20
+ error: { type: [String, Boolean] },
21
+ disabled: {
22
+ type: Boolean,
23
+ default: false
24
+ },
25
+ id: {}
26
+ },
27
+ setup(__props) {
28
+ const { id, hintId, errorId, isError, errorMessage, describedBy } = useField({
29
+ id: () => __props.id,
30
+ hint: () => __props.hint,
31
+ error: () => __props.error
32
+ });
33
+ return (_ctx, _cache) => {
34
+ return openBlock(), createElementBlock("fieldset", {
35
+ id: unref(id),
36
+ "data-part": "fieldset",
37
+ disabled: __props.disabled || void 0,
38
+ "data-field-error": unref(isError) || void 0,
39
+ "aria-describedby": unref(describedBy)
40
+ }, [
41
+ __props.legend || _ctx.$slots.legend ? (openBlock(), createElementBlock("legend", _hoisted_2, [renderSlot(_ctx.$slots, "legend", {}, () => [createTextVNode(toDisplayString(__props.legend), 1)])])) : createCommentVNode("v-if", true),
42
+ createVNode(_sfc_main$1, {
43
+ "error-id": unref(errorId),
44
+ "hint-id": unref(hintId),
45
+ "error-message": unref(errorMessage),
46
+ hint: __props.hint
47
+ }, null, 8, [
48
+ "error-id",
49
+ "hint-id",
50
+ "error-message",
51
+ "hint"
52
+ ]),
53
+ renderSlot(_ctx.$slots, "default")
54
+ ], 8, _hoisted_1);
55
+ };
56
+ }
57
+ });
58
+ //#endregion
59
+ export { _sfc_main as default };
@@ -0,0 +1,29 @@
1
+ //#region src/components/fieldset/Fieldset.vue.d.ts
2
+ type __VLS_Props = {
3
+ /** Text inside the `<legend>`, naming the group. */
4
+ legend?: string;
5
+ /** Help text under the legend, announced as the group's description. */
6
+ hint?: string;
7
+ /** `true` marks the group invalid; a string also shows it as the message, replacing the hint. */
8
+ error?: string | boolean;
9
+ /** Disables the group: native controls inside it too. */
10
+ disabled?: boolean;
11
+ /** Id for the `<fieldset>`; generated with `useId()` when omitted. */
12
+ id?: string;
13
+ };
14
+ type __VLS_Slots = {
15
+ /** The grouped controls. */
16
+ default?(): unknown;
17
+ /** Legend content, replacing `legend`. */
18
+ legend?(props: {}): unknown;
19
+ };
20
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
22
+ declare const _default: typeof __VLS_export;
23
+ type __VLS_WithSlots<T, S> = T & {
24
+ new (): {
25
+ $slots: S;
26
+ };
27
+ };
28
+ //#endregion
29
+ export { _default as default };
@@ -0,0 +1,128 @@
1
+ import { useTranslations } from "../../config.js";
2
+ import { Fragment, computed, createElementBlock, createElementVNode, defineComponent, mergeModels, openBlock, renderList, toDisplayString, unref, useModel } from "vue";
3
+ //#region src/components/pagination/Pagination.vue
4
+ const _hoisted_1 = ["aria-label", "data-pagination-disabled"];
5
+ const _hoisted_2 = { "data-part": "pagination-list" };
6
+ const _hoisted_3 = { "data-part": "pagination-item" };
7
+ const _hoisted_4 = ["disabled", "aria-label"];
8
+ const _hoisted_5 = {
9
+ key: 0,
10
+ "data-part": "pagination-item"
11
+ };
12
+ const _hoisted_6 = [
13
+ "aria-label",
14
+ "aria-current",
15
+ "data-pagination-current",
16
+ "disabled",
17
+ "onClick"
18
+ ];
19
+ const _hoisted_7 = {
20
+ key: 1,
21
+ "data-part": "pagination-item"
22
+ };
23
+ const _hoisted_8 = { "data-part": "pagination-item" };
24
+ const _hoisted_9 = ["disabled", "aria-label"];
25
+ const _sfc_main = /*@__PURE__*/ defineComponent({
26
+ __name: "Pagination",
27
+ props: /*@__PURE__*/ mergeModels({
28
+ pageCount: {},
29
+ siblingCount: { default: 1 },
30
+ label: {},
31
+ disabled: {
32
+ type: Boolean,
33
+ default: false
34
+ }
35
+ }, {
36
+ "modelValue": {},
37
+ "modelModifiers": {}
38
+ }),
39
+ emits: ["update:modelValue"],
40
+ setup(__props) {
41
+ /** The current page, 1-based. */
42
+ const page = useModel(__props, "modelValue");
43
+ const translations = useTranslations();
44
+ const total = computed(() => Math.max(1, Math.floor(__props.pageCount)));
45
+ const current = computed(() => Math.min(Math.max(page.value ?? 1, 1), total.value));
46
+ /** Page numbers to show, with `"ellipsis"` standing in for a skipped run. */
47
+ const pages = computed(() => {
48
+ if (total.value <= 2 * __props.siblingCount + 5) return Array.from({ length: total.value }, (_, index) => index + 1);
49
+ const shown = /* @__PURE__ */ new Set([1, total.value]);
50
+ for (let index = current.value - __props.siblingCount; index <= current.value + __props.siblingCount; index++) if (index >= 1 && index <= total.value) shown.add(index);
51
+ const list = [];
52
+ let previous = 0;
53
+ for (const index of [...shown].toSorted((a, b) => a - b)) {
54
+ if (index - previous > 1) list.push("ellipsis");
55
+ list.push(index);
56
+ previous = index;
57
+ }
58
+ return list;
59
+ });
60
+ function goTo(target) {
61
+ page.value = Math.min(Math.max(target, 1), total.value);
62
+ }
63
+ return (_ctx, _cache) => {
64
+ return openBlock(), createElementBlock("nav", {
65
+ "data-part": "pagination",
66
+ "aria-label": __props.label ?? unref(translations).pagination,
67
+ "data-pagination-disabled": __props.disabled || void 0
68
+ }, [createElementVNode("ul", _hoisted_2, [
69
+ createElementVNode("li", _hoisted_3, [createElementVNode("button", {
70
+ type: "button",
71
+ "data-part": "pagination-previous",
72
+ disabled: __props.disabled || current.value <= 1,
73
+ "aria-label": unref(translations).previousPage,
74
+ onClick: _cache[0] || (_cache[0] = ($event) => goTo(current.value - 1))
75
+ }, [..._cache[2] || (_cache[2] = [createElementVNode("svg", {
76
+ viewBox: "0 0 16 16",
77
+ width: "14",
78
+ height: "14",
79
+ fill: "none",
80
+ "aria-hidden": "true",
81
+ focusable: "false"
82
+ }, [createElementVNode("path", {
83
+ d: "M10 3 5 8l5 5",
84
+ stroke: "currentColor",
85
+ "stroke-width": "1.5",
86
+ "stroke-linecap": "round",
87
+ "stroke-linejoin": "round"
88
+ })], -1)])], 8, _hoisted_4)]),
89
+ (openBlock(true), createElementBlock(Fragment, null, renderList(pages.value, (item, index) => {
90
+ return openBlock(), createElementBlock(Fragment, { key: `${item}-${index}` }, [typeof item === "number" ? (openBlock(), createElementBlock("li", _hoisted_5, [createElementVNode("button", {
91
+ type: "button",
92
+ "data-part": "pagination-page",
93
+ "aria-label": unref(translations).page(item),
94
+ "aria-current": item === current.value ? "page" : void 0,
95
+ "data-pagination-current": item === current.value || void 0,
96
+ disabled: __props.disabled,
97
+ onClick: ($event) => goTo(item)
98
+ }, toDisplayString(item), 9, _hoisted_6)])) : (openBlock(), createElementBlock("li", _hoisted_7, [..._cache[3] || (_cache[3] = [createElementVNode("span", {
99
+ "data-part": "pagination-ellipsis",
100
+ "aria-hidden": "true"
101
+ }, "…", -1)])]))], 64);
102
+ }), 128)),
103
+ createElementVNode("li", _hoisted_8, [createElementVNode("button", {
104
+ type: "button",
105
+ "data-part": "pagination-next",
106
+ disabled: __props.disabled || current.value >= total.value,
107
+ "aria-label": unref(translations).nextPage,
108
+ onClick: _cache[1] || (_cache[1] = ($event) => goTo(current.value + 1))
109
+ }, [..._cache[4] || (_cache[4] = [createElementVNode("svg", {
110
+ viewBox: "0 0 16 16",
111
+ width: "14",
112
+ height: "14",
113
+ fill: "none",
114
+ "aria-hidden": "true",
115
+ focusable: "false"
116
+ }, [createElementVNode("path", {
117
+ d: "M6 3l5 5-5 5",
118
+ stroke: "currentColor",
119
+ "stroke-width": "1.5",
120
+ "stroke-linecap": "round",
121
+ "stroke-linejoin": "round"
122
+ })], -1)])], 8, _hoisted_9)])
123
+ ])], 8, _hoisted_1);
124
+ };
125
+ }
126
+ });
127
+ //#endregion
128
+ export { _sfc_main as default };
@@ -0,0 +1,24 @@
1
+ //#region src/components/pagination/Pagination.vue.d.ts
2
+ type __VLS_Props = {
3
+ /** Number of pages, at least 1. */
4
+ pageCount: number;
5
+ /** Pages shown either side of the current one. */
6
+ siblingCount?: number;
7
+ /** Accessible name for the navigation landmark, when the `pagination` translation isn't wanted. */
8
+ label?: string;
9
+ /** Disables every button. */
10
+ disabled?: boolean;
11
+ };
12
+ type __VLS_ModelProps = {
13
+ /** The current page, 1-based. */
14
+ modelValue?: number;
15
+ };
16
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
17
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
18
+ "update:modelValue": (value: number | undefined) => any;
19
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
20
+ "onUpdate:modelValue"?: ((value: number | undefined) => any) | undefined;
21
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
22
+ declare const _default: typeof __VLS_export;
23
+ //#endregion
24
+ export { _default as default };
@@ -0,0 +1,151 @@
1
+ import { useTranslations } from "../../config.js";
2
+ import { useField } from "../../composables/use-field.js";
3
+ import _sfc_main$1 from "../field/FieldMessage.js";
4
+ import { computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, mergeProps, openBlock, ref, toDisplayString, unref, useModel, useTemplateRef, vModelDynamic, withDirectives, withModifiers } from "vue";
5
+ //#region src/components/password-input/PasswordInput.vue
6
+ const _hoisted_1 = ["data-field-error"];
7
+ const _hoisted_2 = ["for"];
8
+ const _hoisted_3 = {
9
+ key: 0,
10
+ "data-part": "field-optional"
11
+ };
12
+ const _hoisted_4 = [
13
+ "id",
14
+ "type",
15
+ "autocomplete",
16
+ "disabled",
17
+ "aria-invalid",
18
+ "aria-describedby"
19
+ ];
20
+ const _hoisted_5 = [
21
+ "aria-label",
22
+ "aria-pressed",
23
+ "disabled"
24
+ ];
25
+ const _hoisted_6 = {
26
+ key: 0,
27
+ viewBox: "0 0 16 16",
28
+ width: "16",
29
+ height: "16",
30
+ fill: "none",
31
+ stroke: "currentColor",
32
+ "stroke-width": "1.5",
33
+ "stroke-linecap": "round",
34
+ "stroke-linejoin": "round",
35
+ "aria-hidden": "true",
36
+ focusable: "false"
37
+ };
38
+ const _hoisted_7 = {
39
+ key: 1,
40
+ viewBox: "0 0 16 16",
41
+ width: "16",
42
+ height: "16",
43
+ fill: "none",
44
+ stroke: "currentColor",
45
+ "stroke-width": "1.5",
46
+ "stroke-linecap": "round",
47
+ "stroke-linejoin": "round",
48
+ "aria-hidden": "true",
49
+ focusable: "false"
50
+ };
51
+ const _sfc_main = /*@__PURE__*/ defineComponent({
52
+ inheritAttrs: false,
53
+ __name: "PasswordInput",
54
+ props: /*@__PURE__*/ mergeModels({
55
+ label: {},
56
+ hint: {},
57
+ error: { type: [String, Boolean] },
58
+ optional: {
59
+ type: Boolean,
60
+ default: false
61
+ },
62
+ disabled: {
63
+ type: Boolean,
64
+ default: false
65
+ },
66
+ autocomplete: { default: "current-password" },
67
+ id: {}
68
+ }, {
69
+ "modelValue": {},
70
+ "modelModifiers": {}
71
+ }),
72
+ emits: ["update:modelValue"],
73
+ setup(__props, { expose: __expose }) {
74
+ /** The password. */
75
+ const model = useModel(__props, "modelValue");
76
+ const { id, hintId, errorId, isError, errorMessage, describedBy } = useField({
77
+ id: () => __props.id,
78
+ hint: () => __props.hint,
79
+ error: () => __props.error
80
+ });
81
+ const translations = useTranslations();
82
+ const inputRef = useTemplateRef("input");
83
+ const revealed = ref(false);
84
+ const type = computed(() => revealed.value ? "text" : "password");
85
+ function toggle() {
86
+ revealed.value = !revealed.value;
87
+ inputRef.value?.focus();
88
+ }
89
+ __expose({ focus: () => inputRef.value?.focus() });
90
+ return (_ctx, _cache) => {
91
+ return openBlock(), createElementBlock("div", {
92
+ "data-part": "field",
93
+ "data-field-error": unref(isError) || void 0
94
+ }, [
95
+ __props.label ? (openBlock(), createElementBlock("label", {
96
+ key: 0,
97
+ for: unref(id),
98
+ "data-part": "field-label"
99
+ }, [createTextVNode(toDisplayString(__props.label), 1), __props.optional ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(` ${unref(translations).optional}`), 1)) : createCommentVNode("v-if", true)], 8, _hoisted_2)) : createCommentVNode("v-if", true),
100
+ createElementVNode("div", {
101
+ "data-part": "input-control",
102
+ onClick: _cache[2] || (_cache[2] = ($event) => inputRef.value?.focus())
103
+ }, [withDirectives(createElementVNode("input", mergeProps({
104
+ id: unref(id),
105
+ ref: "input",
106
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event)
107
+ }, _ctx.$attrs, {
108
+ type: type.value,
109
+ autocomplete: __props.autocomplete,
110
+ disabled: __props.disabled,
111
+ "aria-invalid": unref(isError) || void 0,
112
+ "aria-describedby": unref(describedBy),
113
+ "data-part": "input"
114
+ }), null, 16, _hoisted_4), [[vModelDynamic, model.value]]), createElementVNode("button", {
115
+ type: "button",
116
+ "data-part": "password-toggle",
117
+ "aria-label": revealed.value ? unref(translations).hidePassword : unref(translations).showPassword,
118
+ "aria-pressed": revealed.value,
119
+ disabled: __props.disabled,
120
+ onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {}, ["prevent"])),
121
+ onClick: toggle
122
+ }, [revealed.value ? (openBlock(), createElementBlock("svg", _hoisted_6, [..._cache[3] || (_cache[3] = [
123
+ createElementVNode("path", { d: "M1.5 8S3.9 3.5 8 3.5 14.5 8 14.5 8 12.1 12.5 8 12.5 1.5 8 1.5 8Z" }, null, -1),
124
+ createElementVNode("circle", {
125
+ cx: "8",
126
+ cy: "8",
127
+ r: "2"
128
+ }, null, -1),
129
+ createElementVNode("path", { d: "M2.5 2.5l11 11" }, null, -1)
130
+ ])])) : (openBlock(), createElementBlock("svg", _hoisted_7, [..._cache[4] || (_cache[4] = [createElementVNode("path", { d: "M1.5 8S3.9 3.5 8 3.5 14.5 8 14.5 8 12.1 12.5 8 12.5 1.5 8 1.5 8Z" }, null, -1), createElementVNode("circle", {
131
+ cx: "8",
132
+ cy: "8",
133
+ r: "2"
134
+ }, null, -1)])]))], 40, _hoisted_5)]),
135
+ createVNode(_sfc_main$1, {
136
+ "error-id": unref(errorId),
137
+ "hint-id": unref(hintId),
138
+ "error-message": unref(errorMessage),
139
+ hint: __props.hint
140
+ }, null, 8, [
141
+ "error-id",
142
+ "hint-id",
143
+ "error-message",
144
+ "hint"
145
+ ])
146
+ ], 8, _hoisted_1);
147
+ };
148
+ }
149
+ });
150
+ //#endregion
151
+ export { _sfc_main as default };
@@ -0,0 +1,32 @@
1
+ //#region src/components/password-input/PasswordInput.vue.d.ts
2
+ type __VLS_Props = {
3
+ /** Visible label, linked to the control. */
4
+ label?: string;
5
+ /** Help text under the control, announced as its description. */
6
+ hint?: string;
7
+ /** `true` marks the control invalid; a string also shows it as the message, replacing the hint. */
8
+ error?: string | boolean;
9
+ /** Appends the `optional` translation to the label. */
10
+ optional?: boolean;
11
+ /** Disables the control and its reveal button. */
12
+ disabled?: boolean;
13
+ /** Value of the native `autocomplete` attribute, e.g. `new-password` on a sign-up form. */
14
+ autocomplete?: string;
15
+ /** Id for the control; generated with `useId()` when omitted. */
16
+ id?: string;
17
+ };
18
+ type __VLS_ModelProps = {
19
+ /** The password. */
20
+ modelValue?: string;
21
+ };
22
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
23
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
24
+ focus: () => void | undefined;
25
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
26
+ "update:modelValue": (value: string | undefined) => any;
27
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
28
+ "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
29
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
+ declare const _default: typeof __VLS_export;
31
+ //#endregion
32
+ export { _default as default };