@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,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 };
@@ -0,0 +1,83 @@
1
+ import { firstFocusable, useAnchor, usePopoverState } from "../../composables/use-popover.js";
2
+ import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeModels, nextTick, normalizeStyle, openBlock, ref, renderSlot, unref, useId, useModel, useTemplateRef, watch } from "vue";
3
+ //#region src/components/popover/Popover.vue
4
+ const _hoisted_1 = [
5
+ "id",
6
+ "data-popover-align",
7
+ "aria-label"
8
+ ];
9
+ const _sfc_main = /*@__PURE__*/ defineComponent({
10
+ __name: "Popover",
11
+ props: /*@__PURE__*/ mergeModels({
12
+ label: {},
13
+ align: { default: "start" }
14
+ }, {
15
+ "open": {
16
+ type: Boolean,
17
+ default: false
18
+ },
19
+ "openModifiers": {}
20
+ }),
21
+ emits: ["update:open"],
22
+ setup(__props) {
23
+ /** Whether the panel is open. */
24
+ const open = useModel(__props, "open");
25
+ const triggerId = useId();
26
+ const panelId = useId();
27
+ const anchorRef = useTemplateRef("anchor");
28
+ const panelRef = useTemplateRef("panel");
29
+ const { anchorStyle, panelStyle } = useAnchor();
30
+ const hasOpened = ref(open.value);
31
+ watch(open, (isOpen) => {
32
+ if (isOpen) hasOpened.value = true;
33
+ });
34
+ usePopoverState({
35
+ panel: panelRef,
36
+ open,
37
+ onShow: () => void nextTick(() => (firstFocusable(panelRef.value) ?? panelRef.value)?.focus())
38
+ });
39
+ const triggerAttrs = computed(() => ({
40
+ id: triggerId,
41
+ popovertarget: panelId,
42
+ "aria-haspopup": "dialog",
43
+ "aria-expanded": open.value,
44
+ "aria-controls": panelId
45
+ }));
46
+ function triggerElement() {
47
+ return anchorRef.value?.querySelector(`#${CSS.escape(triggerId)}`);
48
+ }
49
+ function close(refocus = true) {
50
+ if (!open.value) return;
51
+ open.value = false;
52
+ if (refocus) triggerElement()?.focus();
53
+ }
54
+ function onFocusOut(event) {
55
+ const next = event.relatedTarget;
56
+ if (!(next instanceof Node) || panelRef.value?.contains(next) || anchorRef.value?.contains(next)) return;
57
+ close(false);
58
+ }
59
+ return (_ctx, _cache) => {
60
+ return openBlock(), createElementBlock(Fragment, null, [createElementVNode("span", {
61
+ ref: "anchor",
62
+ "data-part": "popover-anchor",
63
+ style: normalizeStyle(unref(anchorStyle))
64
+ }, [renderSlot(_ctx.$slots, "trigger", {
65
+ isOpen: open.value,
66
+ attrs: triggerAttrs.value
67
+ })], 4), createElementVNode("div", {
68
+ id: unref(panelId),
69
+ ref: "panel",
70
+ popover: "auto",
71
+ role: "dialog",
72
+ tabindex: "-1",
73
+ "data-part": "popover",
74
+ "data-popover-align": __props.align,
75
+ "aria-label": __props.label,
76
+ style: normalizeStyle(unref(panelStyle)),
77
+ onFocusout: onFocusOut
78
+ }, [hasOpened.value ? renderSlot(_ctx.$slots, "default", { close }, void 0, void 0, 0) : createCommentVNode("v-if", true)], 44, _hoisted_1)], 64);
79
+ };
80
+ }
81
+ });
82
+ //#endregion
83
+ export { _sfc_main as default };
@@ -0,0 +1,37 @@
1
+ //#region src/components/popover/Popover.vue.d.ts
2
+ type __VLS_Props = {
3
+ /** Accessible name for the panel (role="dialog"). */
4
+ label: string;
5
+ /** Which trigger edge the panel lines up with. Flips automatically near the viewport edge. */
6
+ align?: "start" | "end";
7
+ };
8
+ type __VLS_Slots = {
9
+ /** The trigger. Bind `attrs` to a `<button>`. */
10
+ trigger(props: {
11
+ isOpen: boolean;
12
+ attrs: Record<string, unknown>;
13
+ }): unknown;
14
+ /** Panel content. Mounted on first open. */
15
+ default?(props: {
16
+ close: () => void;
17
+ }): unknown;
18
+ };
19
+ type __VLS_ModelProps = {
20
+ /** Whether the panel is open. */
21
+ "open"?: boolean;
22
+ };
23
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
24
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
+ "update:open": (value: boolean) => any;
26
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
27
+ "onUpdate:open"?: ((value: boolean) => any) | undefined;
28
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
29
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
30
+ declare const _default: typeof __VLS_export;
31
+ type __VLS_WithSlots<T, S> = T & {
32
+ new (): {
33
+ $slots: S;
34
+ };
35
+ };
36
+ //#endregion
37
+ export { _default as default };
@@ -0,0 +1,52 @@
1
+ import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, normalizeStyle, openBlock, toDisplayString } from "vue";
2
+ //#region src/components/progress/Progress.vue
3
+ const _hoisted_1 = [
4
+ "aria-valuemax",
5
+ "aria-label",
6
+ "aria-valuenow",
7
+ "aria-valuetext",
8
+ "data-progress-indeterminate"
9
+ ];
10
+ const _hoisted_2 = { "data-part": "progress-track" };
11
+ const _hoisted_3 = {
12
+ key: 0,
13
+ "data-part": "progress-value",
14
+ "aria-hidden": "true"
15
+ };
16
+ const _sfc_main = /*@__PURE__*/ defineComponent({
17
+ __name: "Progress",
18
+ props: {
19
+ value: {},
20
+ max: { default: 100 },
21
+ label: {},
22
+ valueText: {},
23
+ showValue: {
24
+ type: Boolean,
25
+ default: false
26
+ }
27
+ },
28
+ setup(__props) {
29
+ const indeterminate = computed(() => __props.value == null || !Number.isFinite(__props.value));
30
+ const maximum = computed(() => __props.max > 0 ? __props.max : 100);
31
+ const clamped = computed(() => indeterminate.value ? 0 : Math.min(Math.max(__props.value ?? 0, 0), maximum.value));
32
+ const percent = computed(() => clamped.value / maximum.value * 100);
33
+ const display = computed(() => __props.valueText ?? `${Math.round(percent.value)}%`);
34
+ return (_ctx, _cache) => {
35
+ return openBlock(), createElementBlock("div", {
36
+ "data-part": "progress",
37
+ role: "progressbar",
38
+ "aria-valuemin": "0",
39
+ "aria-valuemax": maximum.value,
40
+ "aria-label": __props.label,
41
+ "aria-valuenow": indeterminate.value ? void 0 : clamped.value,
42
+ "aria-valuetext": indeterminate.value ? void 0 : __props.valueText,
43
+ "data-progress-indeterminate": indeterminate.value || void 0
44
+ }, [createElementVNode("div", _hoisted_2, [createElementVNode("div", {
45
+ "data-part": "progress-indicator",
46
+ style: normalizeStyle({ "--ui-progress": `${percent.value}%` })
47
+ }, null, 4)]), __props.showValue && !indeterminate.value ? (openBlock(), createElementBlock("span", _hoisted_3, toDisplayString(display.value), 1)) : createCommentVNode("v-if", true)], 8, _hoisted_1);
48
+ };
49
+ }
50
+ });
51
+ //#endregion
52
+ export { _sfc_main as default };
@@ -0,0 +1,17 @@
1
+ //#region src/components/progress/Progress.vue.d.ts
2
+ type __VLS_Props = {
3
+ /** Current value. Omit it, or pass a non-finite number, for an indeterminate bar. */
4
+ value?: number;
5
+ /** The value at which the bar is full. */
6
+ max?: number;
7
+ /** Accessible name, e.g. "Uploading". */
8
+ label?: string;
9
+ /** Spoken and displayed text for the value, e.g. "3 of 5 files". Defaults to a percentage. */
10
+ valueText?: string;
11
+ /** Shows the value next to the bar. */
12
+ showValue?: boolean;
13
+ };
14
+ 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>;
15
+ declare const _default: typeof __VLS_export;
16
+ //#endregion
17
+ export { _default as default };
@@ -0,0 +1,125 @@
1
+ import { useField } from "../../composables/use-field.js";
2
+ import _sfc_main$1 from "../field/FieldMessage.js";
3
+ import { useRovingSelection } from "../../composables/use-roving-selection.js";
4
+ import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeModels, openBlock, renderList, renderSlot, toDisplayString, unref, useModel, useTemplateRef } from "vue";
5
+ //#region src/components/radio-group/RadioGroup.vue
6
+ const _hoisted_1 = ["data-field-error", "data-field-name"];
7
+ const _hoisted_2 = ["id"];
8
+ const _hoisted_3 = [
9
+ "data-orientation",
10
+ "aria-orientation",
11
+ "aria-labelledby",
12
+ "aria-describedby",
13
+ "aria-invalid",
14
+ "aria-disabled"
15
+ ];
16
+ const _hoisted_4 = [
17
+ "aria-checked",
18
+ "tabindex",
19
+ "disabled",
20
+ "data-radio-checked",
21
+ "onClick"
22
+ ];
23
+ const _hoisted_5 = { "data-part": "radio-label" };
24
+ const _hoisted_6 = ["name", "value"];
25
+ const _sfc_main = /*@__PURE__*/ defineComponent({
26
+ __name: "RadioGroup",
27
+ props: /*@__PURE__*/ mergeModels({
28
+ options: { default: () => [] },
29
+ label: {},
30
+ hint: {},
31
+ error: { type: [String, Boolean] },
32
+ disabled: {
33
+ type: Boolean,
34
+ default: false
35
+ },
36
+ orientation: { default: "vertical" },
37
+ name: {},
38
+ id: {}
39
+ }, {
40
+ "modelValue": {},
41
+ "modelModifiers": {}
42
+ }),
43
+ emits: ["update:modelValue"],
44
+ setup(__props) {
45
+ /** The selected value. */
46
+ const model = useModel(__props, "modelValue");
47
+ const { id, hintId, errorId, isError, errorMessage, describedBy } = useField({
48
+ id: () => __props.id,
49
+ hint: () => __props.hint,
50
+ error: () => __props.error
51
+ });
52
+ const labelId = computed(() => `${id.value}-label`);
53
+ const radioRefs = useTemplateRef("radios");
54
+ const { isTabStop, select, onKeydown } = useRovingSelection({
55
+ items: () => __props.options,
56
+ elements: () => radioRefs.value,
57
+ disabled: () => __props.disabled,
58
+ model
59
+ });
60
+ return (_ctx, _cache) => {
61
+ return openBlock(), createElementBlock("div", {
62
+ "data-part": "field",
63
+ "data-field-error": unref(isError) || void 0,
64
+ "data-field-name": __props.name
65
+ }, [
66
+ __props.label ? (openBlock(), createElementBlock("span", {
67
+ key: 0,
68
+ id: labelId.value,
69
+ "data-part": "field-label"
70
+ }, toDisplayString(__props.label), 9, _hoisted_2)) : createCommentVNode("v-if", true),
71
+ createElementVNode("div", {
72
+ role: "radiogroup",
73
+ "data-part": "radio-group",
74
+ "data-orientation": __props.orientation,
75
+ "aria-orientation": __props.orientation,
76
+ "aria-labelledby": __props.label ? labelId.value : void 0,
77
+ "aria-describedby": unref(describedBy),
78
+ "aria-invalid": unref(isError) || void 0,
79
+ "aria-disabled": __props.disabled || void 0,
80
+ onKeydown: _cache[0] || (_cache[0] = (...args) => unref(onKeydown) && unref(onKeydown)(...args))
81
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (opt, i) => {
82
+ return openBlock(), createElementBlock("button", {
83
+ ref_for: true,
84
+ ref: "radios",
85
+ key: opt.value,
86
+ type: "button",
87
+ role: "radio",
88
+ "data-part": "radio",
89
+ "aria-checked": opt.value === model.value,
90
+ tabindex: unref(isTabStop)(opt, i) ? 0 : -1,
91
+ disabled: __props.disabled || opt.disabled,
92
+ "data-radio-checked": opt.value === model.value || void 0,
93
+ onClick: ($event) => unref(select)(opt)
94
+ }, [renderSlot(_ctx.$slots, "option", {
95
+ option: opt,
96
+ checked: opt.value === model.value
97
+ }, () => [_cache[1] || (_cache[1] = createElementVNode("span", {
98
+ "data-part": "radio-control",
99
+ "aria-hidden": "true"
100
+ }, null, -1)), createElementVNode("span", _hoisted_5, toDisplayString(opt.label), 1)])], 8, _hoisted_4);
101
+ }), 128))], 40, _hoisted_3),
102
+ createCommentVNode(" The radios are buttons, which don't submit values; a hidden input does. "),
103
+ __props.name && model.value != null ? (openBlock(), createElementBlock("input", {
104
+ key: 1,
105
+ type: "hidden",
106
+ name: __props.name,
107
+ value: model.value
108
+ }, null, 8, _hoisted_6)) : createCommentVNode("v-if", true),
109
+ createVNode(_sfc_main$1, {
110
+ "error-id": unref(errorId),
111
+ "hint-id": unref(hintId),
112
+ "error-message": unref(errorMessage),
113
+ hint: __props.hint
114
+ }, null, 8, [
115
+ "error-id",
116
+ "hint-id",
117
+ "error-message",
118
+ "hint"
119
+ ])
120
+ ], 8, _hoisted_1);
121
+ };
122
+ }
123
+ });
124
+ //#endregion
125
+ export { _sfc_main as default };
@@ -0,0 +1,45 @@
1
+ import { SelectOption } from "../../types.js";
2
+ //#region src/components/radio-group/RadioGroup.vue.d.ts
3
+ declare const __VLS_export: <T extends string | number>(__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
+ /** Radios to render, in order. */
6
+ options?: SelectOption<T>[];
7
+ /** Visible group label, which names the radiogroup. */
8
+ label?: string;
9
+ /** Help text under the control, announced as its description. */
10
+ hint?: string;
11
+ /** `true` marks the control invalid; a string also shows it as the message, replacing the hint. */
12
+ error?: string | boolean;
13
+ /** Disables the control. */
14
+ disabled?: boolean;
15
+ /** Layout hook, exposed as `data-orientation` and `aria-orientation`. */
16
+ orientation?: "vertical" | "horizontal";
17
+ /** Form field name: submits the value with a native form, via hidden inputs. */
18
+ name?: string;
19
+ /** Id for the control; generated with `useId()` when omitted. */
20
+ id?: string;
21
+ } & {
22
+ /** The selected value. */
23
+ modelValue?: T;
24
+ }) & {
25
+ "onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
26
+ }> & (typeof globalThis extends {
27
+ __VLS_PROPS_FALLBACK: infer P;
28
+ } ? P : {});
29
+ expose: (exposed: {}) => void;
30
+ attrs: any;
31
+ slots: {
32
+ /** Radio content, replacing the control and label. */
33
+ option?(props: {
34
+ option: SelectOption<T>;
35
+ checked: boolean;
36
+ }): unknown;
37
+ };
38
+ emit: (event: "update:modelValue", value: T | undefined) => void;
39
+ }>) => import("vue").VNode & {
40
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
41
+ };
42
+ declare const _default: typeof __VLS_export;
43
+ type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
44
+ //#endregion
45
+ export { _default as default };
@@ -0,0 +1,110 @@
1
+ import { useRovingSelection } from "../../composables/use-roving-selection.js";
2
+ import { useSlideIndicator } from "../../composables/use-slide-indicator.js";
3
+ import { Fragment, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeModels, normalizeStyle, openBlock, renderList, renderSlot, toDisplayString, unref, useModel, useTemplateRef } from "vue";
4
+ //#region src/components/segmented/Segmented.vue
5
+ const _hoisted_1 = [
6
+ "data-field-name",
7
+ "data-segmented-size",
8
+ "data-segmented-icon-only",
9
+ "data-segmented-sliding",
10
+ "data-segmented-animate",
11
+ "aria-label",
12
+ "aria-disabled"
13
+ ];
14
+ const _hoisted_2 = [
15
+ "aria-checked",
16
+ "aria-label",
17
+ "tabindex",
18
+ "disabled",
19
+ "data-segment-checked",
20
+ "onClick"
21
+ ];
22
+ const _hoisted_3 = ["name", "value"];
23
+ const _sfc_main = /*@__PURE__*/ defineComponent({
24
+ __name: "Segmented",
25
+ props: /*@__PURE__*/ mergeModels({
26
+ options: { default: () => [] },
27
+ label: {},
28
+ size: { default: "medium" },
29
+ iconOnly: {
30
+ type: Boolean,
31
+ default: false
32
+ },
33
+ disabled: {
34
+ type: Boolean,
35
+ default: false
36
+ },
37
+ name: {}
38
+ }, {
39
+ "modelValue": {},
40
+ "modelModifiers": {}
41
+ }),
42
+ emits: ["update:modelValue"],
43
+ setup(__props) {
44
+ /** The selected value. */
45
+ const model = useModel(__props, "modelValue");
46
+ const rootRef = useTemplateRef("root");
47
+ const segmentRefs = useTemplateRef("segments");
48
+ const { isTabStop, select, onKeydown } = useRovingSelection({
49
+ items: () => __props.options,
50
+ elements: () => segmentRefs.value,
51
+ disabled: () => __props.disabled,
52
+ model
53
+ });
54
+ const { style, isMeasured, canAnimate } = useSlideIndicator({
55
+ container: rootRef,
56
+ items: () => segmentRefs.value,
57
+ activeIndex: () => __props.options.findIndex((option) => option.value === model.value)
58
+ });
59
+ return (_ctx, _cache) => {
60
+ return openBlock(), createElementBlock("div", {
61
+ ref: "root",
62
+ role: "radiogroup",
63
+ "data-field-name": __props.name,
64
+ "data-part": "segmented",
65
+ "data-segmented-size": __props.size,
66
+ "data-segmented-icon-only": __props.iconOnly || void 0,
67
+ "data-segmented-sliding": unref(isMeasured) || void 0,
68
+ "data-segmented-animate": unref(canAnimate) || void 0,
69
+ "aria-label": __props.label,
70
+ "aria-disabled": __props.disabled || void 0,
71
+ onKeydown: _cache[0] || (_cache[0] = (...args) => unref(onKeydown) && unref(onKeydown)(...args))
72
+ }, [
73
+ createCommentVNode(" Until measured (e.g. before hydration) style the checked segment itself,\n via [data-segment-checked], so the selection is never invisible. Hiding the\n indicator with a style binding, not v-show, keeps that in the server HTML:\n directives' SSR props don't reach prebuilt render functions. "),
74
+ createElementVNode("span", {
75
+ style: normalizeStyle([unref(style), unref(isMeasured) ? void 0 : { display: "none" }]),
76
+ "data-part": "segmented-indicator",
77
+ "aria-hidden": "true"
78
+ }, null, 4),
79
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, i) => {
80
+ return openBlock(), createElementBlock("button", {
81
+ ref_for: true,
82
+ ref: "segments",
83
+ key: option.value,
84
+ type: "button",
85
+ role: "radio",
86
+ "data-part": "segment",
87
+ "aria-checked": option.value === model.value,
88
+ "aria-label": __props.iconOnly ? option.label : void 0,
89
+ tabindex: unref(isTabStop)(option, i) ? 0 : -1,
90
+ disabled: __props.disabled || option.disabled,
91
+ "data-segment-checked": option.value === model.value || void 0,
92
+ onClick: ($event) => unref(select)(option)
93
+ }, [renderSlot(_ctx.$slots, "option", {
94
+ option,
95
+ checked: option.value === model.value
96
+ }, () => [createTextVNode(toDisplayString(__props.iconOnly ? "" : option.label), 1)])], 8, _hoisted_2);
97
+ }), 128)),
98
+ createCommentVNode(" The segments are buttons, which don't submit values; a hidden input does. "),
99
+ __props.name && model.value != null ? (openBlock(), createElementBlock("input", {
100
+ key: 0,
101
+ type: "hidden",
102
+ name: __props.name,
103
+ value: model.value
104
+ }, null, 8, _hoisted_3)) : createCommentVNode("v-if", true)
105
+ ], 40, _hoisted_1);
106
+ };
107
+ }
108
+ });
109
+ //#endregion
110
+ export { _sfc_main as default };