@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.
Files changed (168) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +45 -2
  3. package/dist/components/accordion/Accordion.js +60 -0
  4. package/dist/components/accordion/Accordion.vue.d.ts +28 -0
  5. package/dist/components/accordion/AccordionItem.js +102 -0
  6. package/dist/components/accordion/AccordionItem.vue.d.ts +33 -0
  7. package/dist/components/avatar/Avatar.js +52 -0
  8. package/dist/components/avatar/Avatar.vue.d.ts +26 -0
  9. package/dist/components/avatar/AvatarGroup.js +48 -0
  10. package/dist/components/avatar/AvatarGroup.vue.d.ts +16 -0
  11. package/dist/components/breadcrumbs/Breadcrumbs.js +59 -0
  12. package/dist/components/breadcrumbs/Breadcrumbs.vue.d.ts +14 -0
  13. package/dist/components/button/Button.js +95 -0
  14. package/dist/components/button/Button.vue.d.ts +74 -0
  15. package/dist/components/button/IconButton.js +47 -0
  16. package/dist/components/button/IconButton.vue.d.ts +115 -0
  17. package/dist/components/checkbox/Checkbox.js +93 -0
  18. package/dist/components/checkbox/Checkbox.vue.d.ts +43 -0
  19. package/dist/components/checkbox-group/CheckboxGroup.js +89 -0
  20. package/dist/components/checkbox-group/CheckboxGroup.vue.d.ts +43 -0
  21. package/dist/components/combobox/Combobox.js +294 -0
  22. package/dist/components/combobox/Combobox.vue.d.ts +80 -0
  23. package/dist/components/context-menu/ContextMenu.js +170 -0
  24. package/dist/components/context-menu/ContextMenu.vue.d.ts +38 -0
  25. package/dist/components/dialog/ConfirmDialog.js +103 -0
  26. package/dist/components/dialog/ConfirmDialog.vue.d.ts +46 -0
  27. package/dist/components/dialog/Dialog.js +160 -0
  28. package/dist/components/dialog/Dialog.vue.d.ts +54 -0
  29. package/dist/components/field/FieldMessage.js +31 -0
  30. package/dist/components/fieldset/Fieldset.js +59 -0
  31. package/dist/components/fieldset/Fieldset.vue.d.ts +29 -0
  32. package/dist/components/input/Input.js +111 -0
  33. package/dist/components/input/Input.vue.d.ts +50 -0
  34. package/dist/components/kbd/Kbd.js +48 -0
  35. package/dist/components/kbd/Kbd.vue.d.ts +24 -0
  36. package/dist/components/menu/Menu.js +124 -0
  37. package/dist/components/menu/Menu.vue.d.ts +41 -0
  38. package/dist/components/otp-input/OtpInput.js +179 -0
  39. package/dist/components/otp-input/OtpInput.vue.d.ts +48 -0
  40. package/dist/components/pagination/Pagination.js +128 -0
  41. package/dist/components/pagination/Pagination.vue.d.ts +24 -0
  42. package/dist/components/password-input/PasswordInput.js +151 -0
  43. package/dist/components/password-input/PasswordInput.vue.d.ts +32 -0
  44. package/dist/components/popover/Popover.js +83 -0
  45. package/dist/components/popover/Popover.vue.d.ts +37 -0
  46. package/dist/components/progress/Progress.js +52 -0
  47. package/dist/components/progress/Progress.vue.d.ts +17 -0
  48. package/dist/components/radio-group/RadioGroup.js +125 -0
  49. package/dist/components/radio-group/RadioGroup.vue.d.ts +45 -0
  50. package/dist/components/segmented/Segmented.js +110 -0
  51. package/dist/components/segmented/Segmented.vue.d.ts +41 -0
  52. package/dist/components/select/Select.js +231 -0
  53. package/dist/components/select/Select.vue.d.ts +59 -0
  54. package/dist/components/slider/Slider.js +196 -0
  55. package/dist/components/slider/Slider.vue.d.ts +49 -0
  56. package/dist/components/spin-button/SpinButton.js +231 -0
  57. package/dist/components/spin-button/SpinButton.vue.d.ts +48 -0
  58. package/dist/components/split-button/SplitButton.js +69 -0
  59. package/dist/components/split-button/SplitButton.vue.d.ts +38 -0
  60. package/dist/components/switch/Switch.js +95 -0
  61. package/dist/components/switch/Switch.vue.d.ts +42 -0
  62. package/dist/components/table/Table.js +173 -0
  63. package/dist/components/table/Table.vue.d.ts +45 -0
  64. package/dist/components/tabs/Tabs.js +103 -0
  65. package/dist/components/tabs/Tabs.vue.d.ts +39 -0
  66. package/dist/components/tag-input/TagInput.js +186 -0
  67. package/dist/components/tag-input/TagInput.vue.d.ts +36 -0
  68. package/dist/components/textarea/Textarea.js +118 -0
  69. package/dist/components/textarea/Textarea.vue.d.ts +34 -0
  70. package/dist/components/toast/ToastItem.js +91 -0
  71. package/dist/components/toast/ToastItem.vue.d.ts +29 -0
  72. package/dist/components/toast/ToastViewport.js +56 -0
  73. package/dist/components/toast/ToastViewport.vue.d.ts +25 -0
  74. package/dist/components/toolbar/Toolbar.js +91 -0
  75. package/dist/components/toolbar/Toolbar.vue.d.ts +21 -0
  76. package/dist/components/tooltip/Tooltip.js +85 -0
  77. package/dist/components/tooltip/Tooltip.vue.d.ts +25 -0
  78. package/dist/components/visually-hidden/VisuallyHidden.js +16 -0
  79. package/dist/components/visually-hidden/VisuallyHidden.vue.d.ts +19 -0
  80. package/dist/composables/internal/env.js +5 -0
  81. package/dist/composables/internal/is-equal.js +14 -0
  82. package/dist/composables/internal/on-click-outside.js +18 -0
  83. package/dist/composables/internal/standard-schema.d.ts +38 -0
  84. package/dist/composables/internal/use-document-visibility.js +16 -0
  85. package/dist/composables/internal/use-event-listener.js +24 -0
  86. package/dist/composables/internal/use-interval-fn.js +21 -0
  87. package/dist/composables/internal/use-resize-observer.js +21 -0
  88. package/dist/composables/internal/use-timeout-fn.js +25 -0
  89. package/dist/composables/use-accordion.d.ts +9 -0
  90. package/dist/composables/use-accordion.js +10 -0
  91. package/dist/composables/use-combobox.d.ts +44 -0
  92. package/dist/composables/use-combobox.js +185 -0
  93. package/dist/composables/use-field.d.ts +17 -0
  94. package/dist/composables/use-field.js +27 -0
  95. package/dist/composables/use-form.d.ts +44 -0
  96. package/dist/composables/use-form.js +146 -0
  97. package/dist/composables/use-menu.d.ts +26 -0
  98. package/dist/composables/use-menu.js +117 -0
  99. package/dist/composables/use-platform.d.ts +17 -0
  100. package/dist/composables/use-platform.js +126 -0
  101. package/dist/composables/use-popover.d.ts +35 -0
  102. package/dist/composables/use-popover.js +49 -0
  103. package/dist/composables/use-roving-selection.d.ts +22 -0
  104. package/dist/composables/use-roving-selection.js +65 -0
  105. package/dist/composables/use-select.d.ts +31 -0
  106. package/dist/composables/use-select.js +169 -0
  107. package/dist/composables/use-slide-indicator.d.ts +24 -0
  108. package/dist/composables/use-slide-indicator.js +52 -0
  109. package/dist/composables/use-toast.d.ts +23 -0
  110. package/dist/composables/use-toast.js +51 -0
  111. package/dist/config.d.ts +40 -0
  112. package/dist/config.js +35 -0
  113. package/dist/docs/README.md +52 -0
  114. package/dist/docs/changelog.md +21 -0
  115. package/dist/docs/components/accordion.md +100 -0
  116. package/dist/docs/components/avatar-group.md +58 -0
  117. package/dist/docs/components/avatar.md +40 -0
  118. package/dist/docs/components/breadcrumbs.md +81 -0
  119. package/dist/docs/components/button.md +109 -0
  120. package/dist/docs/components/checkbox-group.md +118 -0
  121. package/dist/docs/components/checkbox.md +123 -0
  122. package/dist/docs/components/combobox.md +207 -0
  123. package/dist/docs/components/confirm-dialog.md +107 -0
  124. package/dist/docs/components/context-menu.md +98 -0
  125. package/dist/docs/components/dialog.md +127 -0
  126. package/dist/docs/components/fieldset.md +65 -0
  127. package/dist/docs/components/icon-button.md +47 -0
  128. package/dist/docs/components/input.md +89 -0
  129. package/dist/docs/components/kbd.md +41 -0
  130. package/dist/docs/components/menu.md +112 -0
  131. package/dist/docs/components/otp-input.md +92 -0
  132. package/dist/docs/components/pagination.md +62 -0
  133. package/dist/docs/components/password-input.md +55 -0
  134. package/dist/docs/components/popover.md +72 -0
  135. package/dist/docs/components/progress.md +56 -0
  136. package/dist/docs/components/radio-group.md +114 -0
  137. package/dist/docs/components/segmented.md +96 -0
  138. package/dist/docs/components/select.md +129 -0
  139. package/dist/docs/components/slider.md +105 -0
  140. package/dist/docs/components/spin-button.md +73 -0
  141. package/dist/docs/components/split-button.md +64 -0
  142. package/dist/docs/components/switch.md +71 -0
  143. package/dist/docs/components/table.md +241 -0
  144. package/dist/docs/components/tabs.md +106 -0
  145. package/dist/docs/components/tag-input.md +88 -0
  146. package/dist/docs/components/textarea.md +46 -0
  147. package/dist/docs/components/toast.md +135 -0
  148. package/dist/docs/components/toolbar.md +71 -0
  149. package/dist/docs/components/tooltip.md +57 -0
  150. package/dist/docs/components/visually-hidden.md +53 -0
  151. package/dist/docs/forms.md +182 -0
  152. package/dist/docs/index.md +11 -0
  153. package/dist/docs/installation.md +71 -0
  154. package/dist/docs/localisation.md +42 -0
  155. package/dist/docs/ssr.md +24 -0
  156. package/dist/docs/styling.md +82 -0
  157. package/dist/index.d.ts +60 -0
  158. package/dist/index.js +56 -0
  159. package/dist/nuxt/module.d.ts +15 -0
  160. package/dist/nuxt/module.js +80 -0
  161. package/dist/nuxt/runtime/plugin.d.ts +4 -0
  162. package/dist/nuxt/runtime/plugin.js +24 -0
  163. package/dist/package.js +4 -0
  164. package/dist/styles/core.css +310 -0
  165. package/dist/translations.d.ts +85 -0
  166. package/dist/translations.js +62 -0
  167. package/dist/types.d.ts +69 -0
  168. package/package.json +93 -4
@@ -0,0 +1,46 @@
1
+ //#region src/components/dialog/ConfirmDialog.vue.d.ts
2
+ type __VLS_Props = {
3
+ /** Heading, which names the dialog. */
4
+ title?: string;
5
+ /** Supporting text, announced as the dialog's description. */
6
+ description?: string;
7
+ /** Confirm button text. Defaults to the `confirm` translation. */
8
+ confirmText?: string;
9
+ /** Cancel button text. Defaults to the `cancel` translation. */
10
+ cancelText?: string;
11
+ /** Destructive action: a danger-styled confirm, and Cancel takes initial focus. */
12
+ danger?: boolean;
13
+ /** The confirmed action is running: Confirm shows it, and the dialog can't be cancelled. */
14
+ loading?: boolean;
15
+ /** Stay open after Confirm, e.g. while `loading`; close it by setting `open` to false. */
16
+ keepOpen?: boolean;
17
+ };
18
+ type __VLS_Slots = {
19
+ /** Extra body content. */
20
+ default?(): unknown;
21
+ /** The Confirm button's spinner while `loading`. */
22
+ spinner?(): unknown;
23
+ };
24
+ type __VLS_ModelProps = {
25
+ /** Whether the dialog is open. */
26
+ "open"?: boolean;
27
+ };
28
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
29
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
30
+ "update:open": (value: boolean) => any;
31
+ confirm: () => any;
32
+ cancel: () => any;
33
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
34
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
35
+ onConfirm?: (() => any) | undefined;
36
+ onCancel?: (() => any) | undefined;
37
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
38
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
39
+ declare const _default: typeof __VLS_export;
40
+ type __VLS_WithSlots<T, S> = T & {
41
+ new (): {
42
+ $slots: S;
43
+ };
44
+ };
45
+ //#endregion
46
+ export { _default as default };
@@ -0,0 +1,160 @@
1
+ import { useTranslations } from "../../config.js";
2
+ import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeModels, nextTick, onBeforeUnmount, openBlock, ref, renderSlot, toDisplayString, unref, useId, useModel, useTemplateRef, watch } from "vue";
3
+ //#region src/components/dialog/Dialog.vue
4
+ const _hoisted_1 = [
5
+ "data-dialog-size",
6
+ "data-dialog-flush",
7
+ "aria-labelledby",
8
+ "aria-label",
9
+ "aria-describedby"
10
+ ];
11
+ const _hoisted_2 = { "data-part": "dialog-panel" };
12
+ const _hoisted_3 = {
13
+ key: 0,
14
+ "data-part": "dialog-header"
15
+ };
16
+ const _hoisted_4 = { "data-part": "dialog-header-text" };
17
+ const _hoisted_5 = ["id"];
18
+ const _hoisted_6 = ["id"];
19
+ const _hoisted_7 = ["aria-label"];
20
+ const _hoisted_8 = {
21
+ key: 1,
22
+ "data-part": "dialog-body"
23
+ };
24
+ const _hoisted_9 = {
25
+ key: 2,
26
+ "data-part": "dialog-footer"
27
+ };
28
+ const _sfc_main = /*@__PURE__*/ defineComponent({
29
+ __name: "Dialog",
30
+ props: /*@__PURE__*/ mergeModels({
31
+ title: {},
32
+ label: {},
33
+ description: {},
34
+ dismissible: {
35
+ type: Boolean,
36
+ default: true
37
+ },
38
+ size: { default: "md" },
39
+ flush: {
40
+ type: Boolean,
41
+ default: false
42
+ },
43
+ closeOnBackdrop: {
44
+ type: Boolean,
45
+ default: true
46
+ },
47
+ showCloseButton: {
48
+ type: Boolean,
49
+ default: true
50
+ }
51
+ }, {
52
+ "open": {
53
+ type: Boolean,
54
+ default: false
55
+ },
56
+ "openModifiers": {}
57
+ }),
58
+ emits: /*@__PURE__*/ mergeModels(["close"], ["update:open"]),
59
+ setup(__props, { emit: __emit }) {
60
+ const emit = __emit;
61
+ /** Whether the dialog is open. */
62
+ const open = useModel(__props, "open");
63
+ const dialogRef = useTemplateRef("dialog");
64
+ const translations = useTranslations();
65
+ const titleId = useId();
66
+ const descriptionId = useId();
67
+ const hasOpened = ref(open.value);
68
+ watch(open, async (isOpen) => {
69
+ if (isOpen) hasOpened.value = true;
70
+ await nextTick();
71
+ const dialog = dialogRef.value;
72
+ if (!dialog) return;
73
+ if (isOpen && !dialog.open) dialog.showModal();
74
+ else if (!isOpen && dialog.open) dialog.close();
75
+ }, {
76
+ immediate: true,
77
+ flush: "post"
78
+ });
79
+ onBeforeUnmount(() => {
80
+ if (dialogRef.value?.open) dialogRef.value.close();
81
+ });
82
+ /** Closes it from the app's own controls, which `dismissible` doesn't restrict. */
83
+ function close() {
84
+ open.value = false;
85
+ }
86
+ /** Escape, the backdrop and the close button: only when `dismissible`. */
87
+ function dismiss() {
88
+ if (__props.dismissible) close();
89
+ }
90
+ function onKeydown(event) {
91
+ if (!__props.dismissible && event.key === "Escape") event.preventDefault();
92
+ }
93
+ let pressedBackdrop = false;
94
+ function onDialogPointerdown(event) {
95
+ pressedBackdrop = event.target === dialogRef.value;
96
+ }
97
+ function onDialogClick(event) {
98
+ const fromBackdrop = pressedBackdrop && event.target === dialogRef.value;
99
+ pressedBackdrop = false;
100
+ if (__props.closeOnBackdrop && fromBackdrop) dismiss();
101
+ }
102
+ function onClose() {
103
+ if (open.value && !__props.dismissible) {
104
+ dialogRef.value?.showModal();
105
+ return;
106
+ }
107
+ if (open.value) open.value = false;
108
+ emit("close");
109
+ }
110
+ function onCancel(event) {
111
+ if (!__props.dismissible) event.preventDefault();
112
+ }
113
+ return (_ctx, _cache) => {
114
+ return openBlock(), createElementBlock("dialog", {
115
+ ref: "dialog",
116
+ "data-part": "dialog",
117
+ "data-dialog-size": __props.size,
118
+ "data-dialog-flush": __props.flush || void 0,
119
+ "aria-labelledby": __props.title ? unref(titleId) : void 0,
120
+ "aria-label": __props.title ? void 0 : __props.label,
121
+ "aria-describedby": __props.description ? unref(descriptionId) : void 0,
122
+ onPointerdown: onDialogPointerdown,
123
+ onClick: onDialogClick,
124
+ onKeydown,
125
+ onClose,
126
+ onCancel
127
+ }, [createElementVNode("div", _hoisted_2, [
128
+ __props.title || _ctx.$slots.header ? (openBlock(), createElementBlock("header", _hoisted_3, [renderSlot(_ctx.$slots, "header", {}, () => [createElementVNode("div", _hoisted_4, [createElementVNode("h2", {
129
+ id: unref(titleId),
130
+ "data-part": "dialog-title"
131
+ }, toDisplayString(__props.title), 9, _hoisted_5), __props.description ? (openBlock(), createElementBlock("p", {
132
+ key: 0,
133
+ id: unref(descriptionId),
134
+ "data-part": "dialog-description"
135
+ }, toDisplayString(__props.description), 9, _hoisted_6)) : createCommentVNode("v-if", true)])]), __props.showCloseButton && __props.dismissible ? (openBlock(), createElementBlock("button", {
136
+ key: 0,
137
+ type: "button",
138
+ "data-part": "dialog-close",
139
+ "aria-label": unref(translations).close,
140
+ onClick: dismiss
141
+ }, [renderSlot(_ctx.$slots, "close-icon", {}, () => [_cache[0] || (_cache[0] = createElementVNode("svg", {
142
+ viewBox: "0 0 16 16",
143
+ width: "16",
144
+ height: "16",
145
+ "aria-hidden": "true",
146
+ focusable: "false"
147
+ }, [createElementVNode("path", {
148
+ d: "M4 4l8 8M12 4l-8 8",
149
+ stroke: "currentColor",
150
+ "stroke-width": "1.5",
151
+ "stroke-linecap": "round"
152
+ })], -1))])], 8, _hoisted_7)) : createCommentVNode("v-if", true)])) : createCommentVNode("v-if", true),
153
+ hasOpened.value ? (openBlock(), createElementBlock("div", _hoisted_8, [renderSlot(_ctx.$slots, "default", { close })])) : createCommentVNode("v-if", true),
154
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", _hoisted_9, [renderSlot(_ctx.$slots, "footer", { close })])) : createCommentVNode("v-if", true)
155
+ ])], 40, _hoisted_1);
156
+ };
157
+ }
158
+ });
159
+ //#endregion
160
+ export { _sfc_main as default };
@@ -0,0 +1,54 @@
1
+ //#region src/components/dialog/Dialog.vue.d.ts
2
+ type __VLS_Props = {
3
+ /** Heading, which names the dialog. */
4
+ title?: string;
5
+ /** Accessible name when there's no visible `title`. */
6
+ label?: string;
7
+ /** Supporting text, announced as the dialog's description. */
8
+ description?: string;
9
+ /** Whether Escape, the backdrop and the header's close button can close it. The slots' `close` always can. */
10
+ dismissible?: boolean;
11
+ /** Size hook, exposed as `data-dialog-size`. */
12
+ size?: "sm" | "md" | "lg" | "xl";
13
+ /** Layout hook for edge-to-edge content, exposed as `data-dialog-flush`. */
14
+ flush?: boolean;
15
+ /** Close when the backdrop is clicked. */
16
+ closeOnBackdrop?: boolean;
17
+ /** Render the header's close button. */
18
+ showCloseButton?: boolean;
19
+ };
20
+ type __VLS_Slots = {
21
+ /** Body content. Mounted on first open. */
22
+ default?(props: {
23
+ close: () => void;
24
+ }): unknown;
25
+ /** Replaces the title and description. */
26
+ header?(): unknown;
27
+ /** Actions, e.g. buttons. */
28
+ footer?(props: {
29
+ close: () => void;
30
+ }): unknown;
31
+ /** Replaces the close button's icon. */
32
+ "close-icon"?(): unknown;
33
+ };
34
+ type __VLS_ModelProps = {
35
+ /** Whether the dialog is open. */
36
+ "open"?: boolean;
37
+ };
38
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
39
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
40
+ "update:open": (value: boolean) => any;
41
+ close: () => any;
42
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
43
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
44
+ onClose?: (() => any) | undefined;
45
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
46
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
47
+ declare const _default: typeof __VLS_export;
48
+ type __VLS_WithSlots<T, S> = T & {
49
+ new (): {
50
+ $slots: S;
51
+ };
52
+ };
53
+ //#endregion
54
+ export { _default as default };
@@ -0,0 +1,31 @@
1
+ import { createCommentVNode, createElementBlock, defineComponent, openBlock, toDisplayString } from "vue";
2
+ //#region src/components/field/FieldMessage.vue
3
+ const _hoisted_1 = ["id"];
4
+ const _hoisted_2 = ["id"];
5
+ const _sfc_main = /*@__PURE__*/ defineComponent({
6
+ __name: "FieldMessage",
7
+ props: {
8
+ errorId: {},
9
+ hintId: {},
10
+ errorMessage: {},
11
+ hint: {}
12
+ },
13
+ setup(__props) {
14
+ return (_ctx, _cache) => {
15
+ return __props.errorMessage ? (openBlock(), createElementBlock("p", {
16
+ key: 0,
17
+ id: __props.errorId,
18
+ role: "alert",
19
+ "data-part": "field-message",
20
+ "data-field-tone": "error"
21
+ }, toDisplayString(__props.errorMessage), 9, _hoisted_1)) : __props.hint ? (openBlock(), createElementBlock("p", {
22
+ key: 1,
23
+ id: __props.hintId,
24
+ "data-part": "field-message",
25
+ "data-field-tone": "hint"
26
+ }, toDisplayString(__props.hint), 9, _hoisted_2)) : createCommentVNode("v-if", true);
27
+ };
28
+ }
29
+ });
30
+ //#endregion
31
+ export { _sfc_main 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,111 @@
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 { createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, mergeProps, openBlock, renderSlot, toDisplayString, unref, useModel, useSlots, useTemplateRef, vModelDynamic, withDirectives } from "vue";
5
+ //#region src/components/input/Input.vue
6
+ const _hoisted_1 = ["data-field-size", "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
+ key: 0,
14
+ "aria-hidden": "true",
15
+ "data-part": "input-prefix"
16
+ };
17
+ const _hoisted_5 = [
18
+ "id",
19
+ "type",
20
+ "disabled",
21
+ "aria-invalid",
22
+ "aria-describedby"
23
+ ];
24
+ const _hoisted_6 = {
25
+ key: 1,
26
+ "aria-hidden": "true",
27
+ "data-part": "input-suffix"
28
+ };
29
+ const _sfc_main = /*@__PURE__*/ defineComponent({
30
+ inheritAttrs: false,
31
+ __name: "Input",
32
+ props: /*@__PURE__*/ mergeModels({
33
+ label: {},
34
+ hint: {},
35
+ error: { type: [String, Boolean] },
36
+ prefix: {},
37
+ suffix: {},
38
+ optional: {
39
+ type: Boolean,
40
+ default: false
41
+ },
42
+ disabled: {
43
+ type: Boolean,
44
+ default: false
45
+ },
46
+ type: { default: "text" },
47
+ size: { default: "medium" },
48
+ id: {}
49
+ }, {
50
+ "modelValue": {},
51
+ "modelModifiers": {}
52
+ }),
53
+ emits: ["update:modelValue"],
54
+ setup(__props, { expose: __expose }) {
55
+ const slots = useSlots();
56
+ /** The value. */
57
+ const model = useModel(__props, "modelValue");
58
+ const { id, hintId, errorId, isError, errorMessage, describedBy } = useField({
59
+ error: () => __props.error,
60
+ hint: () => __props.hint,
61
+ id: () => __props.id
62
+ });
63
+ const translations = useTranslations();
64
+ const inputRef = useTemplateRef("input");
65
+ __expose({ focus: () => inputRef.value?.focus() });
66
+ return (_ctx, _cache) => {
67
+ return openBlock(), createElementBlock("div", {
68
+ "data-part": "field",
69
+ "data-field-size": __props.size,
70
+ "data-field-error": unref(isError) || void 0
71
+ }, [
72
+ __props.label ? (openBlock(), createElementBlock("label", {
73
+ key: 0,
74
+ for: unref(id),
75
+ "data-part": "field-label"
76
+ }, [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),
77
+ createElementVNode("div", {
78
+ "data-part": "input-control",
79
+ onClick: _cache[1] || (_cache[1] = ($event) => inputRef.value?.focus())
80
+ }, [
81
+ __props.prefix || slots.prefix ? (openBlock(), createElementBlock("span", _hoisted_4, [renderSlot(_ctx.$slots, "prefix", {}, () => [createTextVNode(toDisplayString(__props.prefix), 1)])])) : createCommentVNode("v-if", true),
82
+ withDirectives(createElementVNode("input", mergeProps({
83
+ id: unref(id),
84
+ ref: "input",
85
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event)
86
+ }, _ctx.$attrs, {
87
+ type: __props.type,
88
+ disabled: __props.disabled,
89
+ "aria-invalid": unref(isError) || void 0,
90
+ "aria-describedby": unref(describedBy),
91
+ "data-part": "input"
92
+ }), null, 16, _hoisted_5), [[vModelDynamic, model.value]]),
93
+ __props.suffix || slots.suffix ? (openBlock(), createElementBlock("span", _hoisted_6, [renderSlot(_ctx.$slots, "suffix", {}, () => [createTextVNode(toDisplayString(__props.suffix), 1)])])) : createCommentVNode("v-if", true)
94
+ ]),
95
+ createVNode(_sfc_main$1, {
96
+ "error-id": unref(errorId),
97
+ "hint-id": unref(hintId),
98
+ "error-message": unref(errorMessage),
99
+ hint: __props.hint
100
+ }, null, 8, [
101
+ "error-id",
102
+ "hint-id",
103
+ "error-message",
104
+ "hint"
105
+ ])
106
+ ], 8, _hoisted_1);
107
+ };
108
+ }
109
+ });
110
+ //#endregion
111
+ export { _sfc_main as default };
@@ -0,0 +1,50 @@
1
+ //#region src/components/input/Input.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
+ /** Text shown before the input, e.g. a currency sign. Hidden from assistive tech. */
10
+ prefix?: string;
11
+ /** Text shown after the input, e.g. a unit. Hidden from assistive tech. */
12
+ suffix?: string;
13
+ /** Appends the `optional` translation to the label. */
14
+ optional?: boolean;
15
+ /** Disables the control. */
16
+ disabled?: boolean;
17
+ /** Native input type. */
18
+ type?: "text" | "email" | "search" | "url" | "tel" | "password" | "number" | "date" | "time" | "datetime-local" | "month" | "week";
19
+ /** Size hook, exposed as `data-field-size`. */
20
+ size?: "small" | "medium";
21
+ /** Id for the control; generated with `useId()` when omitted. */
22
+ id?: string;
23
+ };
24
+ type __VLS_Slots = {
25
+ /** Replaces the `prefix` text, e.g. with an icon. */
26
+ prefix?(): unknown;
27
+ /** Replaces the `suffix` text. */
28
+ suffix?(): unknown;
29
+ };
30
+ type __VLS_ModelProps = {
31
+ /** The value. */
32
+ modelValue?: string | number;
33
+ };
34
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
35
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
36
+ focus: () => void | undefined;
37
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
38
+ "update:modelValue": (value: string | number | undefined) => any;
39
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
40
+ "onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
41
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
42
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
43
+ declare const _default: typeof __VLS_export;
44
+ type __VLS_WithSlots<T, S> = T & {
45
+ new (): {
46
+ $slots: S;
47
+ };
48
+ };
49
+ //#endregion
50
+ export { _default as default };
@@ -0,0 +1,48 @@
1
+ import { useTranslations } from "../../config.js";
2
+ import { parseChord, usePlatform } from "../../composables/use-platform.js";
3
+ import { Fragment, computed, createElementBlock, createElementVNode, defineComponent, openBlock, renderList, renderSlot, toDisplayString } from "vue";
4
+ //#region src/components/kbd/Kbd.vue
5
+ const _hoisted_1 = ["data-kbd-size"];
6
+ const _hoisted_2 = {
7
+ key: 1,
8
+ "data-part": "key"
9
+ };
10
+ const _sfc_main = /*@__PURE__*/ defineComponent({
11
+ __name: "Kbd",
12
+ props: {
13
+ keys: {},
14
+ size: { default: "medium" },
15
+ platform: {}
16
+ },
17
+ setup(__props) {
18
+ const detected = usePlatform();
19
+ const translations = useTranslations();
20
+ const keyCaps = computed(() => __props.keys ? parseChord(__props.keys, __props.platform ?? detected.value, translations.value.keys) : []);
21
+ const label = computed(() => keyCaps.value.map((cap) => cap.label).join(" "));
22
+ const visuallyHidden = {
23
+ position: "absolute",
24
+ width: "1px",
25
+ height: "1px",
26
+ overflow: "hidden",
27
+ clipPath: "inset(50%)",
28
+ whiteSpace: "nowrap"
29
+ };
30
+ return (_ctx, _cache) => {
31
+ return openBlock(), createElementBlock("kbd", {
32
+ "data-part": "kbd",
33
+ "data-kbd-size": __props.size
34
+ }, [keyCaps.value.length ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [(openBlock(true), createElementBlock(Fragment, null, renderList(keyCaps.value, (cap, i) => {
35
+ return openBlock(), createElementBlock("kbd", {
36
+ key: `${cap.glyph}-${i}`,
37
+ "data-part": "key",
38
+ "aria-hidden": "true"
39
+ }, toDisplayString(cap.glyph), 1);
40
+ }), 128)), createElementVNode("span", {
41
+ "data-part": "kbd-label",
42
+ style: visuallyHidden
43
+ }, toDisplayString(label.value), 1)], 64)) : (openBlock(), createElementBlock("kbd", _hoisted_2, [renderSlot(_ctx.$slots, "default")]))], 8, _hoisted_1);
44
+ };
45
+ }
46
+ });
47
+ //#endregion
48
+ export { _sfc_main as default };
@@ -0,0 +1,24 @@
1
+ import { Platform } from "../../types.js";
2
+ //#region src/components/kbd/Kbd.vue.d.ts
3
+ type __VLS_Props = {
4
+ /** Chord written as "mod+k" or "shift enter". `mod` is ⌘ on Apple, Ctrl elsewhere. */
5
+ keys?: string;
6
+ /** Size hook, exposed as `data-kbd-size`. */
7
+ size?: "small" | "medium";
8
+ /** Forces a platform's key caps instead of the detected one. */
9
+ platform?: Platform;
10
+ };
11
+ type __VLS_Slots = {
12
+ /** A single literal key, when `keys` isn't set. */
13
+ default?(): unknown;
14
+ };
15
+ 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>;
16
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
17
+ declare const _default: typeof __VLS_export;
18
+ type __VLS_WithSlots<T, S> = T & {
19
+ new (): {
20
+ $slots: S;
21
+ };
22
+ };
23
+ //#endregion
24
+ export { _default as default };