@humanonlyweb/ui 0.0.0-stage → 0.1.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 (144) 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/button/Button.js +95 -0
  12. package/dist/components/button/Button.vue.d.ts +74 -0
  13. package/dist/components/button/IconButton.js +47 -0
  14. package/dist/components/button/IconButton.vue.d.ts +115 -0
  15. package/dist/components/checkbox/Checkbox.js +93 -0
  16. package/dist/components/checkbox/Checkbox.vue.d.ts +43 -0
  17. package/dist/components/combobox/Combobox.js +294 -0
  18. package/dist/components/combobox/Combobox.vue.d.ts +80 -0
  19. package/dist/components/context-menu/ContextMenu.js +170 -0
  20. package/dist/components/context-menu/ContextMenu.vue.d.ts +38 -0
  21. package/dist/components/dialog/ConfirmDialog.js +103 -0
  22. package/dist/components/dialog/ConfirmDialog.vue.d.ts +46 -0
  23. package/dist/components/dialog/Dialog.js +160 -0
  24. package/dist/components/dialog/Dialog.vue.d.ts +54 -0
  25. package/dist/components/field/FieldMessage.js +31 -0
  26. package/dist/components/input/Input.js +111 -0
  27. package/dist/components/input/Input.vue.d.ts +50 -0
  28. package/dist/components/kbd/Kbd.js +48 -0
  29. package/dist/components/kbd/Kbd.vue.d.ts +24 -0
  30. package/dist/components/menu/Menu.js +124 -0
  31. package/dist/components/menu/Menu.vue.d.ts +41 -0
  32. package/dist/components/otp-input/OtpInput.js +179 -0
  33. package/dist/components/otp-input/OtpInput.vue.d.ts +48 -0
  34. package/dist/components/popover/Popover.js +83 -0
  35. package/dist/components/popover/Popover.vue.d.ts +37 -0
  36. package/dist/components/radio-group/RadioGroup.js +125 -0
  37. package/dist/components/radio-group/RadioGroup.vue.d.ts +45 -0
  38. package/dist/components/segmented/Segmented.js +110 -0
  39. package/dist/components/segmented/Segmented.vue.d.ts +41 -0
  40. package/dist/components/select/Select.js +231 -0
  41. package/dist/components/select/Select.vue.d.ts +59 -0
  42. package/dist/components/slider/Slider.js +196 -0
  43. package/dist/components/slider/Slider.vue.d.ts +49 -0
  44. package/dist/components/spin-button/SpinButton.js +231 -0
  45. package/dist/components/spin-button/SpinButton.vue.d.ts +48 -0
  46. package/dist/components/split-button/SplitButton.js +69 -0
  47. package/dist/components/split-button/SplitButton.vue.d.ts +38 -0
  48. package/dist/components/switch/Switch.js +95 -0
  49. package/dist/components/switch/Switch.vue.d.ts +42 -0
  50. package/dist/components/table/Table.js +173 -0
  51. package/dist/components/table/Table.vue.d.ts +45 -0
  52. package/dist/components/tabs/Tabs.js +99 -0
  53. package/dist/components/tabs/Tabs.vue.d.ts +39 -0
  54. package/dist/components/textarea/Textarea.js +118 -0
  55. package/dist/components/textarea/Textarea.vue.d.ts +34 -0
  56. package/dist/components/toast/ToastItem.js +91 -0
  57. package/dist/components/toast/ToastItem.vue.d.ts +29 -0
  58. package/dist/components/toast/ToastViewport.js +56 -0
  59. package/dist/components/toast/ToastViewport.vue.d.ts +25 -0
  60. package/dist/components/toolbar/Toolbar.js +91 -0
  61. package/dist/components/toolbar/Toolbar.vue.d.ts +21 -0
  62. package/dist/components/tooltip/Tooltip.js +85 -0
  63. package/dist/components/tooltip/Tooltip.vue.d.ts +25 -0
  64. package/dist/composables/internal/env.js +5 -0
  65. package/dist/composables/internal/is-equal.js +14 -0
  66. package/dist/composables/internal/on-click-outside.js +18 -0
  67. package/dist/composables/internal/standard-schema.d.ts +38 -0
  68. package/dist/composables/internal/use-document-visibility.js +16 -0
  69. package/dist/composables/internal/use-event-listener.js +24 -0
  70. package/dist/composables/internal/use-interval-fn.js +21 -0
  71. package/dist/composables/internal/use-resize-observer.js +21 -0
  72. package/dist/composables/internal/use-timeout-fn.js +25 -0
  73. package/dist/composables/use-accordion.d.ts +9 -0
  74. package/dist/composables/use-accordion.js +10 -0
  75. package/dist/composables/use-combobox.d.ts +44 -0
  76. package/dist/composables/use-combobox.js +185 -0
  77. package/dist/composables/use-field.d.ts +17 -0
  78. package/dist/composables/use-field.js +27 -0
  79. package/dist/composables/use-form.d.ts +44 -0
  80. package/dist/composables/use-form.js +146 -0
  81. package/dist/composables/use-menu.d.ts +26 -0
  82. package/dist/composables/use-menu.js +117 -0
  83. package/dist/composables/use-platform.d.ts +17 -0
  84. package/dist/composables/use-platform.js +126 -0
  85. package/dist/composables/use-popover.d.ts +35 -0
  86. package/dist/composables/use-popover.js +49 -0
  87. package/dist/composables/use-roving-selection.d.ts +22 -0
  88. package/dist/composables/use-roving-selection.js +65 -0
  89. package/dist/composables/use-select.d.ts +31 -0
  90. package/dist/composables/use-select.js +169 -0
  91. package/dist/composables/use-slide-indicator.d.ts +24 -0
  92. package/dist/composables/use-slide-indicator.js +52 -0
  93. package/dist/composables/use-toast.d.ts +23 -0
  94. package/dist/composables/use-toast.js +51 -0
  95. package/dist/config.d.ts +40 -0
  96. package/dist/config.js +35 -0
  97. package/dist/docs/README.md +44 -0
  98. package/dist/docs/changelog.md +14 -0
  99. package/dist/docs/components/accordion.md +100 -0
  100. package/dist/docs/components/avatar-group.md +58 -0
  101. package/dist/docs/components/avatar.md +40 -0
  102. package/dist/docs/components/button.md +109 -0
  103. package/dist/docs/components/checkbox.md +123 -0
  104. package/dist/docs/components/combobox.md +207 -0
  105. package/dist/docs/components/confirm-dialog.md +107 -0
  106. package/dist/docs/components/context-menu.md +98 -0
  107. package/dist/docs/components/dialog.md +127 -0
  108. package/dist/docs/components/icon-button.md +47 -0
  109. package/dist/docs/components/input.md +89 -0
  110. package/dist/docs/components/kbd.md +41 -0
  111. package/dist/docs/components/menu.md +112 -0
  112. package/dist/docs/components/otp-input.md +92 -0
  113. package/dist/docs/components/popover.md +72 -0
  114. package/dist/docs/components/radio-group.md +114 -0
  115. package/dist/docs/components/segmented.md +96 -0
  116. package/dist/docs/components/select.md +129 -0
  117. package/dist/docs/components/slider.md +105 -0
  118. package/dist/docs/components/spin-button.md +73 -0
  119. package/dist/docs/components/split-button.md +64 -0
  120. package/dist/docs/components/switch.md +71 -0
  121. package/dist/docs/components/table.md +241 -0
  122. package/dist/docs/components/tabs.md +106 -0
  123. package/dist/docs/components/textarea.md +46 -0
  124. package/dist/docs/components/toast.md +135 -0
  125. package/dist/docs/components/toolbar.md +71 -0
  126. package/dist/docs/components/tooltip.md +57 -0
  127. package/dist/docs/forms.md +182 -0
  128. package/dist/docs/index.md +11 -0
  129. package/dist/docs/installation.md +73 -0
  130. package/dist/docs/localisation.md +40 -0
  131. package/dist/docs/ssr.md +24 -0
  132. package/dist/docs/styling.md +66 -0
  133. package/dist/index.d.ts +46 -0
  134. package/dist/index.js +44 -0
  135. package/dist/nuxt/module.d.ts +15 -0
  136. package/dist/nuxt/module.js +72 -0
  137. package/dist/nuxt/runtime/plugin.d.ts +4 -0
  138. package/dist/nuxt/runtime/plugin.js +24 -0
  139. package/dist/package.js +4 -0
  140. package/dist/styles/core.css +284 -0
  141. package/dist/translations.d.ts +71 -0
  142. package/dist/translations.js +55 -0
  143. package/dist/types.d.ts +61 -0
  144. package/package.json +93 -4
@@ -0,0 +1,38 @@
1
+ import { ButtonSize, ButtonVariant } from "../../types.js";
2
+ //#region src/components/split-button/SplitButton.vue.d.ts
3
+ type __VLS_Props = {
4
+ /** Accessible name for the toggle half, e.g. "More save options". */
5
+ menuLabel: string;
6
+ /** The `attrs` from a `<Menu>` or `<Popover>` trigger slot, bound to the toggle half. */
7
+ triggerAttrs?: Record<string, unknown>;
8
+ /** Style hook, exposed as `data-button-variant` on both halves. */
9
+ variant?: Exclude<ButtonVariant, "link">;
10
+ /** Size hook, exposed as `data-button-size` on both halves. */
11
+ size?: Exclude<ButtonSize, "large">;
12
+ /** Disables both halves. */
13
+ disabled?: boolean;
14
+ };
15
+ type __VLS_Slots = {
16
+ /** Main action label. */
17
+ default?(): unknown;
18
+ /** Replaces the toggle's chevron. */
19
+ caret?(props: {
20
+ open: boolean;
21
+ }): unknown;
22
+ };
23
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
24
+ action: () => any;
25
+ toggle: () => any;
26
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
27
+ onAction?: (() => any) | undefined;
28
+ onToggle?: (() => any) | undefined;
29
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
31
+ declare const _default: typeof __VLS_export;
32
+ type __VLS_WithSlots<T, S> = T & {
33
+ new (): {
34
+ $slots: S;
35
+ };
36
+ };
37
+ //#endregion
38
+ export { _default as default };
@@ -0,0 +1,95 @@
1
+ import { useField } from "../../composables/use-field.js";
2
+ import _sfc_main$1 from "../field/FieldMessage.js";
3
+ import { Fragment, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, mergeProps, openBlock, renderSlot, toDisplayString, unref, useModel } from "vue";
4
+ //#region src/components/switch/Switch.vue
5
+ const _hoisted_1 = [
6
+ "id",
7
+ "aria-checked",
8
+ "aria-invalid",
9
+ "aria-describedby",
10
+ "disabled",
11
+ "data-switch-size",
12
+ "data-switch-checked",
13
+ "data-switch-error",
14
+ "data-field-name"
15
+ ];
16
+ const _hoisted_2 = {
17
+ key: 0,
18
+ "data-part": "switch-label"
19
+ };
20
+ const _hoisted_3 = ["name", "value"];
21
+ const _sfc_main = /*@__PURE__*/ defineComponent({
22
+ inheritAttrs: false,
23
+ __name: "Switch",
24
+ props: /*@__PURE__*/ mergeModels({
25
+ disabled: {
26
+ type: Boolean,
27
+ default: false
28
+ },
29
+ label: {},
30
+ size: { default: "medium" },
31
+ hint: {},
32
+ error: { type: [String, Boolean] },
33
+ name: {},
34
+ value: { default: "on" },
35
+ id: {}
36
+ }, {
37
+ "modelValue": {
38
+ type: Boolean,
39
+ default: false
40
+ },
41
+ "modelModifiers": {}
42
+ }),
43
+ emits: ["update:modelValue"],
44
+ setup(__props) {
45
+ /** On or off. */
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
+ return (_ctx, _cache) => {
53
+ return openBlock(), createElementBlock(Fragment, null, [
54
+ createElementVNode("button", mergeProps({
55
+ id: unref(id),
56
+ type: "button",
57
+ role: "switch",
58
+ "data-part": "switch",
59
+ "aria-checked": model.value,
60
+ "aria-invalid": unref(isError) || void 0,
61
+ "aria-describedby": unref(describedBy),
62
+ disabled: __props.disabled,
63
+ "data-switch-size": __props.size,
64
+ "data-switch-checked": model.value || void 0,
65
+ "data-switch-error": unref(isError) || void 0,
66
+ "data-field-name": __props.name
67
+ }, _ctx.$attrs, { onClick: _cache[0] || (_cache[0] = ($event) => model.value = !model.value) }), [_cache[1] || (_cache[1] = createElementVNode("span", {
68
+ "data-part": "switch-track",
69
+ "aria-hidden": "true"
70
+ }, [createElementVNode("span", { "data-part": "switch-thumb" })], -1)), _ctx.$slots.default || __props.label ? (openBlock(), createElementBlock("span", _hoisted_2, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])])) : createCommentVNode("v-if", true)], 16, _hoisted_1),
71
+ createCommentVNode(" A sibling, not a wrapper: without a hint or error the markup is just the button. "),
72
+ createVNode(_sfc_main$1, {
73
+ "error-id": unref(errorId),
74
+ "hint-id": unref(hintId),
75
+ "error-message": unref(errorMessage),
76
+ hint: __props.hint
77
+ }, null, 8, [
78
+ "error-id",
79
+ "hint-id",
80
+ "error-message",
81
+ "hint"
82
+ ]),
83
+ createCommentVNode(" The switch is a button, which doesn't submit a value; a hidden input does. "),
84
+ __props.name && model.value ? (openBlock(), createElementBlock("input", {
85
+ key: 0,
86
+ type: "hidden",
87
+ name: __props.name,
88
+ value: __props.value
89
+ }, null, 8, _hoisted_3)) : createCommentVNode("v-if", true)
90
+ ], 64);
91
+ };
92
+ }
93
+ });
94
+ //#endregion
95
+ export { _sfc_main as default };
@@ -0,0 +1,42 @@
1
+ //#region src/components/switch/Switch.vue.d.ts
2
+ type __VLS_Props = {
3
+ /** Disables the switch. */
4
+ disabled?: boolean;
5
+ /** Text next to the switch. The default slot overrides it. */
6
+ label?: string;
7
+ /** Size hook, exposed as `data-switch-size`. */
8
+ size?: "small" | "medium";
9
+ /** Help text under the switch, announced as its description. */
10
+ hint?: string;
11
+ /** `true` marks it invalid; a string also shows it as the message, replacing the hint. */
12
+ error?: string | boolean;
13
+ /** Form field name: while on, a native form submits `value` under it. */
14
+ name?: string;
15
+ /** What a native form submits while on, as a checkbox would. */
16
+ value?: string;
17
+ /** Id for the switch; generated with `useId()` when omitted. */
18
+ id?: string;
19
+ };
20
+ type __VLS_Slots = {
21
+ /** Label content, replacing `label`. */
22
+ default?(): unknown;
23
+ };
24
+ type __VLS_ModelProps = {
25
+ /** On or off. */
26
+ modelValue?: 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:modelValue": (value: boolean) => any;
31
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
32
+ "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
33
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
34
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
35
+ declare const _default: typeof __VLS_export;
36
+ type __VLS_WithSlots<T, S> = T & {
37
+ new (): {
38
+ $slots: S;
39
+ };
40
+ };
41
+ //#endregion
42
+ export { _default as default };
@@ -0,0 +1,173 @@
1
+ import { useTranslations } from "../../config.js";
2
+ import { useResizeObserver } from "../../composables/internal/use-resize-observer.js";
3
+ import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeModels, normalizeStyle, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useId, useModel, useSlots, useTemplateRef } from "vue";
4
+ //#region src/components/table/Table.vue
5
+ const _hoisted_1 = [
6
+ "tabindex",
7
+ "data-table-overflow",
8
+ "role",
9
+ "aria-labelledby"
10
+ ];
11
+ const _hoisted_2 = {
12
+ ref: "table",
13
+ "data-part": "table"
14
+ };
15
+ const _hoisted_3 = ["id"];
16
+ const _hoisted_4 = { key: 1 };
17
+ const _hoisted_5 = { "data-part": "table-header" };
18
+ const _hoisted_6 = { "data-part": "table-row" };
19
+ const _hoisted_7 = [
20
+ "data-table-align",
21
+ "data-table-numeric",
22
+ "data-table-sort",
23
+ "aria-sort"
24
+ ];
25
+ const _hoisted_8 = ["data-table-sort", "onClick"];
26
+ const _hoisted_9 = {
27
+ "data-part": "table-sort-indicator",
28
+ "aria-hidden": "true"
29
+ };
30
+ const _hoisted_10 = {
31
+ key: 0,
32
+ viewBox: "0 0 16 16",
33
+ width: "12",
34
+ height: "12",
35
+ focusable: "false"
36
+ };
37
+ const _hoisted_11 = ["d"];
38
+ const _hoisted_12 = ["data-table-align", "data-table-numeric"];
39
+ const _hoisted_13 = {
40
+ key: 0,
41
+ "data-part": "table-row"
42
+ };
43
+ const _hoisted_14 = ["colspan"];
44
+ const _hoisted_15 = {
45
+ key: 2,
46
+ "data-part": "table-footer"
47
+ };
48
+ const _hoisted_16 = { "data-part": "table-row" };
49
+ const _hoisted_17 = ["data-table-align", "data-table-numeric"];
50
+ const _sfc_main = /*@__PURE__*/ defineComponent({
51
+ __name: "Table",
52
+ props: /*@__PURE__*/ mergeModels({
53
+ columns: {},
54
+ rows: {},
55
+ rowKey: { type: Function },
56
+ caption: {}
57
+ }, {
58
+ "sort": {},
59
+ "sortModifiers": {}
60
+ }),
61
+ emits: ["update:sort"],
62
+ setup(__props) {
63
+ /** The sorted column and direction, set by `sortable` columns' headers. Rows aren't reordered for you. */
64
+ const sort = useModel(__props, "sort");
65
+ const slots = useSlots();
66
+ const captionId = useId();
67
+ const translations = useTranslations();
68
+ const hasWidths = computed(() => __props.columns.some((column) => column.width));
69
+ const hasFooter = computed(() => __props.columns.some((column) => slots[`${column.key}-footer`]));
70
+ function keyFor(row, index) {
71
+ if (typeof __props.rowKey === "function") return __props.rowKey(row, index);
72
+ if (__props.rowKey != null) return row[__props.rowKey];
73
+ return index;
74
+ }
75
+ function valueFor(row, column) {
76
+ return column.accessor ? column.accessor(row) : row[column.key];
77
+ }
78
+ const directionOf = (column) => sort.value?.key === column.key ? sort.value.direction : void 0;
79
+ function toggleSort(column) {
80
+ const direction = directionOf(column) === "ascending" ? "descending" : "ascending";
81
+ sort.value = {
82
+ key: column.key,
83
+ direction
84
+ };
85
+ }
86
+ const scrollRef = useTemplateRef("scroll");
87
+ const tableRef = useTemplateRef("table");
88
+ const overflows = ref(false);
89
+ function measure() {
90
+ const el = scrollRef.value;
91
+ if (el) overflows.value = el.scrollWidth > el.clientWidth;
92
+ }
93
+ useResizeObserver(scrollRef, measure);
94
+ useResizeObserver(tableRef, measure);
95
+ return (_ctx, _cache) => {
96
+ return openBlock(), createElementBlock(Fragment, null, [createCommentVNode(" Focusable when it overflows, so keyboard users can scroll it. "), createElementVNode("div", {
97
+ ref: "scroll",
98
+ "data-part": "table-scroll",
99
+ tabindex: overflows.value ? 0 : void 0,
100
+ "data-table-overflow": overflows.value || void 0,
101
+ role: __props.caption ? "region" : void 0,
102
+ "aria-labelledby": __props.caption ? unref(captionId) : void 0
103
+ }, [createElementVNode("table", _hoisted_2, [
104
+ __props.caption ? (openBlock(), createElementBlock("caption", {
105
+ key: 0,
106
+ id: unref(captionId),
107
+ "data-part": "table-caption"
108
+ }, toDisplayString(__props.caption), 9, _hoisted_3)) : createCommentVNode("v-if", true),
109
+ hasWidths.value ? (openBlock(), createElementBlock("colgroup", _hoisted_4, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column) => {
110
+ return openBlock(), createElementBlock("col", {
111
+ key: column.key,
112
+ style: normalizeStyle({ width: column.width })
113
+ }, null, 4);
114
+ }), 128))])) : createCommentVNode("v-if", true),
115
+ createElementVNode("thead", _hoisted_5, [createElementVNode("tr", _hoisted_6, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column) => {
116
+ return openBlock(), createElementBlock("th", {
117
+ key: column.key,
118
+ scope: "col",
119
+ "data-part": "table-cell",
120
+ "data-table-align": column.align || void 0,
121
+ "data-table-numeric": column.numeric || void 0,
122
+ "data-table-sort": directionOf(column),
123
+ "aria-sort": column.sortable ? directionOf(column) ?? "none" : void 0
124
+ }, [column.sortable ? (openBlock(), createElementBlock("button", {
125
+ key: 0,
126
+ type: "button",
127
+ "data-part": "table-sort",
128
+ "data-table-sort": directionOf(column),
129
+ onClick: ($event) => toggleSort(column)
130
+ }, [renderSlot(_ctx.$slots, `${column.key}-header`, { column }, () => [createTextVNode(toDisplayString(column.header), 1)]), createElementVNode("span", _hoisted_9, [renderSlot(_ctx.$slots, "sort-indicator", { direction: directionOf(column) }, () => [directionOf(column) ? (openBlock(), createElementBlock("svg", _hoisted_10, [createElementVNode("path", {
131
+ d: directionOf(column) === "ascending" ? "M8 13V3M4 7l4-4 4 4" : "M8 3v10M4 9l4 4 4-4",
132
+ fill: "none",
133
+ stroke: "currentColor",
134
+ "stroke-width": "1.5",
135
+ "stroke-linecap": "round",
136
+ "stroke-linejoin": "round"
137
+ }, null, 8, _hoisted_11)])) : createCommentVNode("v-if", true)])])], 8, _hoisted_8)) : renderSlot(_ctx.$slots, `${column.key}-header`, { column }, () => [createTextVNode(toDisplayString(column.header), 1)], void 0, 1)], 8, _hoisted_7);
138
+ }), 128))])]),
139
+ createElementVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.rows, (row, rowIndex) => {
140
+ return openBlock(), createElementBlock("tr", {
141
+ key: keyFor(row, rowIndex),
142
+ "data-part": "table-row"
143
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column) => {
144
+ return openBlock(), createElementBlock("td", {
145
+ key: column.key,
146
+ "data-part": "table-cell",
147
+ "data-table-align": column.align || void 0,
148
+ "data-table-numeric": column.numeric || void 0
149
+ }, [renderSlot(_ctx.$slots, `${column.key}-cell`, {
150
+ row,
151
+ value: valueFor(row, column),
152
+ column,
153
+ rowIndex
154
+ }, () => [createTextVNode(toDisplayString(valueFor(row, column)), 1)])], 8, _hoisted_12);
155
+ }), 128))]);
156
+ }), 128)), !__props.rows.length ? (openBlock(), createElementBlock("tr", _hoisted_13, [createElementVNode("td", {
157
+ "data-part": "table-empty",
158
+ colspan: __props.columns.length
159
+ }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(unref(translations).noData), 1)])], 8, _hoisted_14)])) : createCommentVNode("v-if", true)]),
160
+ hasFooter.value ? (openBlock(), createElementBlock("tfoot", _hoisted_15, [createElementVNode("tr", _hoisted_16, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column) => {
161
+ return openBlock(), createElementBlock("td", {
162
+ key: column.key,
163
+ "data-part": "table-cell",
164
+ "data-table-align": column.align || void 0,
165
+ "data-table-numeric": column.numeric || void 0
166
+ }, [renderSlot(_ctx.$slots, `${column.key}-footer`, { column })], 8, _hoisted_17);
167
+ }), 128))])])) : createCommentVNode("v-if", true)
168
+ ], 512)], 8, _hoisted_1)], 2112);
169
+ };
170
+ }
171
+ });
172
+ //#endregion
173
+ export { _sfc_main as default };
@@ -0,0 +1,45 @@
1
+ import { TableColumn, TableSort } from "../../types.js";
2
+ //#region src/components/table/Table.vue.d.ts
3
+ declare const __VLS_export: <T>(__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
+ /** Column definitions: `key`, `header`, and optional `accessor`, `align`, `numeric`, `width`. */
6
+ columns: TableColumn<T>[];
7
+ /** Row data. */
8
+ rows: T[];
9
+ /** Stable key per row: a property name or a function. Defaults to the index. */
10
+ rowKey?: keyof T | ((row: T, index: number) => PropertyKey);
11
+ /** Visible caption. Also names the scroll region. */
12
+ caption?: string;
13
+ } & {
14
+ /** The sorted column and direction, set by `sortable` columns' headers. Rows aren't reordered for you. */
15
+ sort?: TableSort;
16
+ }) & {
17
+ "onUpdate:sort"?: ((value: TableSort | undefined) => any) | undefined;
18
+ }> & (typeof globalThis extends {
19
+ __VLS_PROPS_FALLBACK: infer P;
20
+ } ? P : {});
21
+ expose: (exposed: {}) => void;
22
+ attrs: any;
23
+ slots: Record<`${string}-cell`, (props: {
24
+ row: T;
25
+ value: unknown;
26
+ column: TableColumn<T>;
27
+ rowIndex: number;
28
+ }) => unknown> & Record<`${string}-header` | `${string}-footer`, (props: {
29
+ column: TableColumn<T>;
30
+ }) => unknown> & {
31
+ /** Shown when there are no rows. */
32
+ empty?: () => unknown;
33
+ /** Replaces a sortable header's direction arrow. */
34
+ "sort-indicator"?: (props: {
35
+ direction: TableSort["direction"] | undefined;
36
+ }) => unknown;
37
+ };
38
+ emit: (event: "update:sort", value: TableSort | 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,99 @@
1
+ import { useRovingSelection } from "../../composables/use-roving-selection.js";
2
+ import { useSlideIndicator } from "../../composables/use-slide-indicator.js";
3
+ import { Fragment, computed, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeModels, normalizeStyle, openBlock, renderList, renderSlot, toDisplayString, unref, useId, useModel, useTemplateRef, vShow, withDirectives } from "vue";
4
+ //#region src/components/tabs/Tabs.vue
5
+ const _hoisted_1 = { "data-part": "tabs" };
6
+ const _hoisted_2 = [
7
+ "data-tabs-sliding",
8
+ "data-tabs-animate",
9
+ "aria-label"
10
+ ];
11
+ const _hoisted_3 = [
12
+ "id",
13
+ "aria-selected",
14
+ "tabindex",
15
+ "disabled",
16
+ "data-tab-selected",
17
+ "onClick"
18
+ ];
19
+ const _hoisted_4 = ["aria-labelledby"];
20
+ const _sfc_main = /*@__PURE__*/ defineComponent({
21
+ __name: "Tabs",
22
+ props: /*@__PURE__*/ mergeModels({
23
+ items: { default: () => [] },
24
+ label: {},
25
+ disabled: {
26
+ type: Boolean,
27
+ default: false
28
+ }
29
+ }, {
30
+ "modelValue": {},
31
+ "modelModifiers": {}
32
+ }),
33
+ emits: ["update:modelValue"],
34
+ setup(__props) {
35
+ /** The selected tab's value. */
36
+ const model = useModel(__props, "modelValue");
37
+ const uid = useId();
38
+ const panelId = `${uid}-panel`;
39
+ const tabId = (index) => `${uid}-tab-${index}`;
40
+ const activeIndex = computed(() => __props.items.findIndex((item) => item.value === model.value));
41
+ const activeTabId = computed(() => activeIndex.value < 0 ? void 0 : tabId(activeIndex.value));
42
+ const tablistRef = useTemplateRef("tablist");
43
+ const tabRefs = useTemplateRef("tabs");
44
+ const { isTabStop, select, onKeydown } = useRovingSelection({
45
+ items: () => __props.items,
46
+ elements: () => tabRefs.value,
47
+ disabled: () => __props.disabled,
48
+ orientation: () => "horizontal",
49
+ model
50
+ });
51
+ const { style, isMeasured, canAnimate } = useSlideIndicator({
52
+ container: tablistRef,
53
+ items: () => tabRefs.value,
54
+ activeIndex: () => activeIndex.value
55
+ });
56
+ return (_ctx, _cache) => {
57
+ return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", {
58
+ ref: "tablist",
59
+ role: "tablist",
60
+ "data-part": "tablist",
61
+ "data-tabs-sliding": unref(isMeasured) || void 0,
62
+ "data-tabs-animate": unref(canAnimate) || void 0,
63
+ "aria-label": __props.label,
64
+ onKeydown: _cache[0] || (_cache[0] = (...args) => unref(onKeydown) && unref(onKeydown)(...args))
65
+ }, [withDirectives(createElementVNode("span", {
66
+ "data-part": "tab-indicator",
67
+ style: normalizeStyle(unref(style)),
68
+ "aria-hidden": "true"
69
+ }, null, 4), [[vShow, unref(isMeasured)]]), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, i) => {
70
+ return openBlock(), createElementBlock("button", {
71
+ id: tabId(i),
72
+ ref_for: true,
73
+ ref: "tabs",
74
+ key: item.value,
75
+ type: "button",
76
+ role: "tab",
77
+ "data-part": "tab",
78
+ "aria-selected": item.value === model.value,
79
+ "aria-controls": panelId,
80
+ tabindex: unref(isTabStop)(item, i) ? 0 : -1,
81
+ disabled: __props.disabled || item.disabled,
82
+ "data-tab-selected": item.value === model.value || void 0,
83
+ onClick: ($event) => unref(select)(item)
84
+ }, [renderSlot(_ctx.$slots, "tab", {
85
+ item,
86
+ selected: item.value === model.value
87
+ }, () => [createTextVNode(toDisplayString(item.label), 1)])], 8, _hoisted_3);
88
+ }), 128))], 40, _hoisted_2), createElementVNode("div", {
89
+ id: panelId,
90
+ role: "tabpanel",
91
+ "data-part": "tabpanel",
92
+ tabindex: "0",
93
+ "aria-labelledby": activeTabId.value
94
+ }, [renderSlot(_ctx.$slots, "default", { value: model.value })], 8, _hoisted_4)]);
95
+ };
96
+ }
97
+ });
98
+ //#endregion
99
+ export { _sfc_main as default };
@@ -0,0 +1,39 @@
1
+ import { SelectOption } from "../../types.js";
2
+ //#region src/components/tabs/Tabs.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
+ /** Tabs to render, in order. */
6
+ items?: SelectOption<T>[];
7
+ /** Accessible name for the tablist. */
8
+ label?: string;
9
+ /** Disables every tab. */
10
+ disabled?: boolean;
11
+ } & {
12
+ /** The selected tab's value. */
13
+ modelValue?: T;
14
+ }) & {
15
+ "onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
16
+ }> & (typeof globalThis extends {
17
+ __VLS_PROPS_FALLBACK: infer P;
18
+ } ? P : {});
19
+ expose: (exposed: {}) => void;
20
+ attrs: any;
21
+ slots: {
22
+ /** Panel content for the selected tab. */
23
+ default?(props: {
24
+ value: T | undefined;
25
+ }): unknown;
26
+ /** Tab content. */
27
+ tab?(props: {
28
+ item: SelectOption<T>;
29
+ selected: boolean;
30
+ }): unknown;
31
+ };
32
+ emit: (event: "update:modelValue", value: T | undefined) => void;
33
+ }>) => import("vue").VNode & {
34
+ __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
35
+ };
36
+ declare const _default: typeof __VLS_export;
37
+ type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
38
+ //#endregion
39
+ export { _default as default };
@@ -0,0 +1,118 @@
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, toDisplayString, unref, useModel, useTemplateRef, vModelText, withDirectives } from "vue";
5
+ //#region src/components/textarea/Textarea.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
+ "rows",
15
+ "disabled",
16
+ "maxlength",
17
+ "aria-invalid",
18
+ "aria-describedby"
19
+ ];
20
+ const _hoisted_5 = {
21
+ key: 1,
22
+ "data-part": "field-footer"
23
+ };
24
+ const _hoisted_6 = ["id", "data-field-count-exceeded"];
25
+ const _hoisted_7 = { "aria-hidden": "true" };
26
+ const _sfc_main = /*@__PURE__*/ defineComponent({
27
+ inheritAttrs: false,
28
+ __name: "Textarea",
29
+ props: /*@__PURE__*/ mergeModels({
30
+ label: {},
31
+ hint: {},
32
+ error: { type: [String, Boolean] },
33
+ maxLength: {},
34
+ optional: {
35
+ type: Boolean,
36
+ default: false
37
+ },
38
+ disabled: {
39
+ type: Boolean,
40
+ default: false
41
+ },
42
+ rows: { default: 4 },
43
+ id: {}
44
+ }, {
45
+ "modelValue": {},
46
+ "modelModifiers": {}
47
+ }),
48
+ emits: ["update:modelValue"],
49
+ setup(__props, { expose: __expose }) {
50
+ /** The value. */
51
+ const model = useModel(__props, "modelValue");
52
+ const { id, hintId, errorId, isError, errorMessage, describedBy } = useField({
53
+ id: () => __props.id,
54
+ hint: () => __props.hint,
55
+ error: () => __props.error
56
+ });
57
+ const translations = useTranslations();
58
+ const countId = computed(() => `${id.value}-count`);
59
+ const charCount = computed(() => model.value?.length ?? 0);
60
+ const isOverLimit = computed(() => __props.maxLength != null && charCount.value > __props.maxLength);
61
+ const describedByAll = computed(() => {
62
+ const ids = [describedBy.value, __props.maxLength == null ? void 0 : countId.value].filter(Boolean);
63
+ return ids.length ? ids.join(" ") : void 0;
64
+ });
65
+ const visuallyHidden = {
66
+ position: "absolute",
67
+ width: "1px",
68
+ height: "1px",
69
+ overflow: "hidden",
70
+ clipPath: "inset(50%)",
71
+ whiteSpace: "nowrap"
72
+ };
73
+ const textareaRef = useTemplateRef("textarea");
74
+ __expose({ focus: () => textareaRef.value?.focus() });
75
+ return (_ctx, _cache) => {
76
+ return openBlock(), createElementBlock("div", {
77
+ "data-part": "field",
78
+ "data-field-error": unref(isError) || void 0
79
+ }, [
80
+ __props.label ? (openBlock(), createElementBlock("label", {
81
+ key: 0,
82
+ for: unref(id),
83
+ "data-part": "field-label"
84
+ }, [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),
85
+ withDirectives(createElementVNode("textarea", mergeProps({
86
+ id: unref(id),
87
+ ref: "textarea",
88
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
89
+ rows: __props.rows
90
+ }, _ctx.$attrs, {
91
+ disabled: __props.disabled,
92
+ maxlength: __props.maxLength,
93
+ "aria-invalid": unref(isError) || isOverLimit.value || void 0,
94
+ "aria-describedby": describedByAll.value,
95
+ "data-part": "textarea"
96
+ }), null, 16, _hoisted_4), [[vModelText, model.value]]),
97
+ unref(errorMessage) || __props.hint || __props.maxLength != null ? (openBlock(), createElementBlock("div", _hoisted_5, [createVNode(_sfc_main$1, {
98
+ "error-id": unref(errorId),
99
+ "hint-id": unref(hintId),
100
+ "error-message": unref(errorMessage),
101
+ hint: __props.hint
102
+ }, null, 8, [
103
+ "error-id",
104
+ "hint-id",
105
+ "error-message",
106
+ "hint"
107
+ ]), __props.maxLength != null ? (openBlock(), createElementBlock("span", {
108
+ key: 0,
109
+ id: countId.value,
110
+ "data-part": "field-count",
111
+ "data-field-count-exceeded": isOverLimit.value || void 0
112
+ }, [createElementVNode("span", _hoisted_7, toDisplayString(charCount.value) + "/" + toDisplayString(__props.maxLength), 1), createElementVNode("span", { style: visuallyHidden }, toDisplayString(unref(translations).characterCount(charCount.value, __props.maxLength)), 1)], 8, _hoisted_6)) : createCommentVNode("v-if", true)])) : createCommentVNode("v-if", true)
113
+ ], 8, _hoisted_1);
114
+ };
115
+ }
116
+ });
117
+ //#endregion
118
+ export { _sfc_main as default };