@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.
- package/LICENSE +21 -0
- package/README.md +45 -2
- package/dist/components/accordion/Accordion.js +60 -0
- package/dist/components/accordion/Accordion.vue.d.ts +28 -0
- package/dist/components/accordion/AccordionItem.js +102 -0
- package/dist/components/accordion/AccordionItem.vue.d.ts +33 -0
- package/dist/components/avatar/Avatar.js +52 -0
- package/dist/components/avatar/Avatar.vue.d.ts +26 -0
- package/dist/components/avatar/AvatarGroup.js +48 -0
- package/dist/components/avatar/AvatarGroup.vue.d.ts +16 -0
- package/dist/components/button/Button.js +95 -0
- package/dist/components/button/Button.vue.d.ts +74 -0
- package/dist/components/button/IconButton.js +47 -0
- package/dist/components/button/IconButton.vue.d.ts +115 -0
- package/dist/components/checkbox/Checkbox.js +93 -0
- package/dist/components/checkbox/Checkbox.vue.d.ts +43 -0
- package/dist/components/combobox/Combobox.js +294 -0
- package/dist/components/combobox/Combobox.vue.d.ts +80 -0
- package/dist/components/context-menu/ContextMenu.js +170 -0
- package/dist/components/context-menu/ContextMenu.vue.d.ts +38 -0
- package/dist/components/dialog/ConfirmDialog.js +103 -0
- package/dist/components/dialog/ConfirmDialog.vue.d.ts +46 -0
- package/dist/components/dialog/Dialog.js +160 -0
- package/dist/components/dialog/Dialog.vue.d.ts +54 -0
- package/dist/components/field/FieldMessage.js +31 -0
- package/dist/components/input/Input.js +111 -0
- package/dist/components/input/Input.vue.d.ts +50 -0
- package/dist/components/kbd/Kbd.js +48 -0
- package/dist/components/kbd/Kbd.vue.d.ts +24 -0
- package/dist/components/menu/Menu.js +124 -0
- package/dist/components/menu/Menu.vue.d.ts +41 -0
- package/dist/components/otp-input/OtpInput.js +179 -0
- package/dist/components/otp-input/OtpInput.vue.d.ts +48 -0
- package/dist/components/popover/Popover.js +83 -0
- package/dist/components/popover/Popover.vue.d.ts +37 -0
- package/dist/components/radio-group/RadioGroup.js +125 -0
- package/dist/components/radio-group/RadioGroup.vue.d.ts +45 -0
- package/dist/components/segmented/Segmented.js +110 -0
- package/dist/components/segmented/Segmented.vue.d.ts +41 -0
- package/dist/components/select/Select.js +231 -0
- package/dist/components/select/Select.vue.d.ts +59 -0
- package/dist/components/slider/Slider.js +196 -0
- package/dist/components/slider/Slider.vue.d.ts +49 -0
- package/dist/components/spin-button/SpinButton.js +231 -0
- package/dist/components/spin-button/SpinButton.vue.d.ts +48 -0
- package/dist/components/split-button/SplitButton.js +69 -0
- package/dist/components/split-button/SplitButton.vue.d.ts +38 -0
- package/dist/components/switch/Switch.js +95 -0
- package/dist/components/switch/Switch.vue.d.ts +42 -0
- package/dist/components/table/Table.js +173 -0
- package/dist/components/table/Table.vue.d.ts +45 -0
- package/dist/components/tabs/Tabs.js +99 -0
- package/dist/components/tabs/Tabs.vue.d.ts +39 -0
- package/dist/components/textarea/Textarea.js +118 -0
- package/dist/components/textarea/Textarea.vue.d.ts +34 -0
- package/dist/components/toast/ToastItem.js +91 -0
- package/dist/components/toast/ToastItem.vue.d.ts +29 -0
- package/dist/components/toast/ToastViewport.js +56 -0
- package/dist/components/toast/ToastViewport.vue.d.ts +25 -0
- package/dist/components/toolbar/Toolbar.js +91 -0
- package/dist/components/toolbar/Toolbar.vue.d.ts +21 -0
- package/dist/components/tooltip/Tooltip.js +85 -0
- package/dist/components/tooltip/Tooltip.vue.d.ts +25 -0
- package/dist/composables/internal/env.js +5 -0
- package/dist/composables/internal/is-equal.js +14 -0
- package/dist/composables/internal/on-click-outside.js +18 -0
- package/dist/composables/internal/standard-schema.d.ts +38 -0
- package/dist/composables/internal/use-document-visibility.js +16 -0
- package/dist/composables/internal/use-event-listener.js +24 -0
- package/dist/composables/internal/use-interval-fn.js +21 -0
- package/dist/composables/internal/use-resize-observer.js +21 -0
- package/dist/composables/internal/use-timeout-fn.js +25 -0
- package/dist/composables/use-accordion.d.ts +9 -0
- package/dist/composables/use-accordion.js +10 -0
- package/dist/composables/use-combobox.d.ts +44 -0
- package/dist/composables/use-combobox.js +185 -0
- package/dist/composables/use-field.d.ts +17 -0
- package/dist/composables/use-field.js +27 -0
- package/dist/composables/use-form.d.ts +44 -0
- package/dist/composables/use-form.js +146 -0
- package/dist/composables/use-menu.d.ts +26 -0
- package/dist/composables/use-menu.js +117 -0
- package/dist/composables/use-platform.d.ts +17 -0
- package/dist/composables/use-platform.js +126 -0
- package/dist/composables/use-popover.d.ts +35 -0
- package/dist/composables/use-popover.js +49 -0
- package/dist/composables/use-roving-selection.d.ts +22 -0
- package/dist/composables/use-roving-selection.js +65 -0
- package/dist/composables/use-select.d.ts +31 -0
- package/dist/composables/use-select.js +169 -0
- package/dist/composables/use-slide-indicator.d.ts +24 -0
- package/dist/composables/use-slide-indicator.js +52 -0
- package/dist/composables/use-toast.d.ts +23 -0
- package/dist/composables/use-toast.js +51 -0
- package/dist/config.d.ts +40 -0
- package/dist/config.js +35 -0
- package/dist/docs/README.md +44 -0
- package/dist/docs/changelog.md +14 -0
- package/dist/docs/components/accordion.md +100 -0
- package/dist/docs/components/avatar-group.md +58 -0
- package/dist/docs/components/avatar.md +40 -0
- package/dist/docs/components/button.md +109 -0
- package/dist/docs/components/checkbox.md +123 -0
- package/dist/docs/components/combobox.md +207 -0
- package/dist/docs/components/confirm-dialog.md +107 -0
- package/dist/docs/components/context-menu.md +98 -0
- package/dist/docs/components/dialog.md +127 -0
- package/dist/docs/components/icon-button.md +47 -0
- package/dist/docs/components/input.md +89 -0
- package/dist/docs/components/kbd.md +41 -0
- package/dist/docs/components/menu.md +112 -0
- package/dist/docs/components/otp-input.md +92 -0
- package/dist/docs/components/popover.md +72 -0
- package/dist/docs/components/radio-group.md +114 -0
- package/dist/docs/components/segmented.md +96 -0
- package/dist/docs/components/select.md +129 -0
- package/dist/docs/components/slider.md +105 -0
- package/dist/docs/components/spin-button.md +73 -0
- package/dist/docs/components/split-button.md +64 -0
- package/dist/docs/components/switch.md +71 -0
- package/dist/docs/components/table.md +241 -0
- package/dist/docs/components/tabs.md +106 -0
- package/dist/docs/components/textarea.md +46 -0
- package/dist/docs/components/toast.md +135 -0
- package/dist/docs/components/toolbar.md +71 -0
- package/dist/docs/components/tooltip.md +57 -0
- package/dist/docs/forms.md +182 -0
- package/dist/docs/index.md +11 -0
- package/dist/docs/installation.md +73 -0
- package/dist/docs/localisation.md +40 -0
- package/dist/docs/ssr.md +24 -0
- package/dist/docs/styling.md +66 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.js +44 -0
- package/dist/nuxt/module.d.ts +15 -0
- package/dist/nuxt/module.js +72 -0
- package/dist/nuxt/runtime/plugin.d.ts +4 -0
- package/dist/nuxt/runtime/plugin.js +24 -0
- package/dist/package.js +4 -0
- package/dist/styles/core.css +284 -0
- package/dist/translations.d.ts +71 -0
- package/dist/translations.js +55 -0
- package/dist/types.d.ts +61 -0
- package/package.json +93 -4
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Styling
|
|
2
|
+
|
|
3
|
+
> Style the data-part hooks with your own CSS.
|
|
4
|
+
|
|
5
|
+
Style the components with your own CSS. Every element has a `data-part` attribute and states are attributes too; each component page lists them.
|
|
6
|
+
|
|
7
|
+
```css
|
|
8
|
+
[data-part="select-trigger"] {
|
|
9
|
+
border: 1px solid var(--border);
|
|
10
|
+
border-radius: 8px;
|
|
11
|
+
|
|
12
|
+
&[data-select-open] {
|
|
13
|
+
border-color: var(--accent);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
[data-part="select-option"][data-select-active] {
|
|
18
|
+
background: var(--surface-3);
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Fields
|
|
23
|
+
|
|
24
|
+
On Input, Textarea, Select and Combobox, `class`, `style` and other attributes go to the control itself, not the field around it. To size the whole field, label included, wrap it:
|
|
25
|
+
|
|
26
|
+
```vue-html
|
|
27
|
+
<div class="w-80">
|
|
28
|
+
<UiInput v-model="email" label="Email" />
|
|
29
|
+
</div>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## core.css
|
|
33
|
+
|
|
34
|
+
It's required, and only handles positioning and visibility. It sits in the `humanonlyweb-ui` cascade layer, so your unlayered CSS always wins over it. If you use layers, list it first:
|
|
35
|
+
|
|
36
|
+
```css
|
|
37
|
+
@layer reset, humanonlyweb-ui, base, components;
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Motion
|
|
41
|
+
|
|
42
|
+
Overlays are native popovers, so animate them in with `@starting-style`:
|
|
43
|
+
|
|
44
|
+
```css
|
|
45
|
+
[data-part="menu-list"] {
|
|
46
|
+
opacity: 0;
|
|
47
|
+
transition:
|
|
48
|
+
opacity 120ms,
|
|
49
|
+
display 120ms allow-discrete,
|
|
50
|
+
overlay 120ms allow-discrete;
|
|
51
|
+
|
|
52
|
+
&:popover-open {
|
|
53
|
+
opacity: 1;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@starting-style {
|
|
58
|
+
[data-part="menu-list"]:popover-open {
|
|
59
|
+
opacity: 0;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
- **Accordion:** transition `grid-template-rows` on `accordion-panel`.
|
|
65
|
+
- **Tabs, Segmented:** transition the indicator under `[data-tabs-animate]` / `[data-segmented-animate]`.
|
|
66
|
+
- **Toasts:** `ui-toast-enter-from`, `ui-toast-leave-to` and `ui-toast-move`.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import _default from "./components/accordion/Accordion.vue.js";
|
|
2
|
+
import _default$1 from "./components/accordion/AccordionItem.vue.js";
|
|
3
|
+
import { AvatarItem, AvatarSize, ButtonSize, ButtonType, ButtonVariant, LinkTarget, LinkTo, MenuEntry, MenuItem, MenuSeparator, Platform, SelectOption, SelectValue, TableColumn, TableSort, Toast, ToastAction, ToastTone } from "./types.js";
|
|
4
|
+
import _default$2 from "./components/avatar/Avatar.vue.js";
|
|
5
|
+
import _default$3 from "./components/avatar/AvatarGroup.vue.js";
|
|
6
|
+
import _default$4 from "./components/button/Button.vue.js";
|
|
7
|
+
import _default$10 from "./components/button/IconButton.vue.js";
|
|
8
|
+
import _default$5 from "./components/checkbox/Checkbox.vue.js";
|
|
9
|
+
import { ComboboxFilter, useCombobox } from "./composables/use-combobox.js";
|
|
10
|
+
import _default$6 from "./components/combobox/Combobox.vue.js";
|
|
11
|
+
import _default$7 from "./components/dialog/ConfirmDialog.vue.js";
|
|
12
|
+
import _default$8 from "./components/context-menu/ContextMenu.vue.js";
|
|
13
|
+
import _default$9 from "./components/dialog/Dialog.vue.js";
|
|
14
|
+
import _default$11 from "./components/input/Input.vue.js";
|
|
15
|
+
import _default$12 from "./components/kbd/Kbd.vue.js";
|
|
16
|
+
import _default$13 from "./components/menu/Menu.vue.js";
|
|
17
|
+
import _default$14 from "./components/otp-input/OtpInput.vue.js";
|
|
18
|
+
import _default$15 from "./components/popover/Popover.vue.js";
|
|
19
|
+
import _default$16 from "./components/radio-group/RadioGroup.vue.js";
|
|
20
|
+
import _default$17 from "./components/segmented/Segmented.vue.js";
|
|
21
|
+
import _default$18 from "./components/select/Select.vue.js";
|
|
22
|
+
import _default$19 from "./components/slider/Slider.vue.js";
|
|
23
|
+
import _default$20 from "./components/spin-button/SpinButton.vue.js";
|
|
24
|
+
import _default$21 from "./components/split-button/SplitButton.vue.js";
|
|
25
|
+
import _default$22 from "./components/switch/Switch.vue.js";
|
|
26
|
+
import _default$23 from "./components/table/Table.vue.js";
|
|
27
|
+
import _default$24 from "./components/tabs/Tabs.vue.js";
|
|
28
|
+
import _default$25 from "./components/textarea/Textarea.vue.js";
|
|
29
|
+
import _default$26 from "./components/toast/ToastItem.vue.js";
|
|
30
|
+
import _default$27 from "./components/toast/ToastViewport.vue.js";
|
|
31
|
+
import _default$28 from "./components/toolbar/Toolbar.vue.js";
|
|
32
|
+
import _default$29 from "./components/tooltip/Tooltip.vue.js";
|
|
33
|
+
import { UiTranslations, UiTranslationsInput, defaultTranslations } from "./translations.js";
|
|
34
|
+
import { UI_CONFIG_KEY, UiConfig, UiOptions, createUi, useTranslations, useUiConfig } from "./config.js";
|
|
35
|
+
import { ACCORDION_KEY, AccordionContext, useAccordionItem } from "./composables/use-accordion.js";
|
|
36
|
+
import { FieldSource, useField } from "./composables/use-field.js";
|
|
37
|
+
import { StandardSchemaV1 } from "./composables/internal/standard-schema.js";
|
|
38
|
+
import { FormErrors, FormValues, UseFormOptions, useForm } from "./composables/use-form.js";
|
|
39
|
+
import { isMenuSeparator, useMenu } from "./composables/use-menu.js";
|
|
40
|
+
import { KeyCap, parseChord, platformFrom, usePlatform } from "./composables/use-platform.js";
|
|
41
|
+
import { firstFocusable, useAnchor, usePopoverState } from "./composables/use-popover.js";
|
|
42
|
+
import { useRovingSelection } from "./composables/use-roving-selection.js";
|
|
43
|
+
import { useSelect } from "./composables/use-select.js";
|
|
44
|
+
import { useSlideIndicator } from "./composables/use-slide-indicator.js";
|
|
45
|
+
import { TOASTER_KEY, ToastOptions, Toaster, createToaster, useToast } from "./composables/use-toast.js";
|
|
46
|
+
export { ACCORDION_KEY, _default as Accordion, type AccordionContext, _default$1 as AccordionItem, _default$2 as Avatar, _default$3 as AvatarGroup, type AvatarItem, type AvatarSize, _default$4 as Button, type ButtonSize, type ButtonType, type ButtonVariant, _default$5 as Checkbox, _default$6 as Combobox, type ComboboxFilter, _default$7 as ConfirmDialog, _default$8 as ContextMenu, _default$9 as Dialog, type FieldSource, type FormErrors, type FormValues, _default$10 as IconButton, _default$11 as Input, _default$12 as Kbd, type KeyCap, type LinkTarget, type LinkTo, _default$13 as Menu, type MenuEntry, type MenuItem, type MenuSeparator, _default$14 as OtpInput, type Platform, _default$15 as Popover, _default$16 as RadioGroup, _default$17 as Segmented, _default$18 as Select, type SelectOption, type SelectValue, _default$19 as Slider, _default$20 as SpinButton, _default$21 as SplitButton, type StandardSchemaV1, _default$22 as Switch, TOASTER_KEY, _default$23 as Table, type TableColumn, type TableSort, _default$24 as Tabs, _default$25 as Textarea, type Toast, type ToastAction, _default$26 as ToastItem, type ToastOptions, type ToastTone, _default$27 as ToastViewport, type Toaster, _default$28 as Toolbar, _default$29 as Tooltip, UI_CONFIG_KEY, type UiConfig, type UiOptions, type UiTranslations, type UiTranslationsInput, type UseFormOptions, createToaster, createUi, defaultTranslations, firstFocusable, isMenuSeparator, parseChord, platformFrom, useAccordionItem, useAnchor, useCombobox, useField, useForm, useMenu, usePlatform, usePopoverState, useRovingSelection, useSelect, useSlideIndicator, useToast, useTranslations, useUiConfig };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ACCORDION_KEY, useAccordionItem } from "./composables/use-accordion.js";
|
|
2
|
+
import _sfc_main from "./components/accordion/Accordion.js";
|
|
3
|
+
import _sfc_main$1 from "./components/accordion/AccordionItem.js";
|
|
4
|
+
import _sfc_main$2 from "./components/avatar/Avatar.js";
|
|
5
|
+
import { TOASTER_KEY, createToaster, useToast } from "./composables/use-toast.js";
|
|
6
|
+
import { defaultTranslations } from "./translations.js";
|
|
7
|
+
import { UI_CONFIG_KEY, createUi, useTranslations, useUiConfig } from "./config.js";
|
|
8
|
+
import _sfc_main$3 from "./components/avatar/AvatarGroup.js";
|
|
9
|
+
import _sfc_main$4 from "./components/button/Button.js";
|
|
10
|
+
import _sfc_main$10 from "./components/button/IconButton.js";
|
|
11
|
+
import { useField } from "./composables/use-field.js";
|
|
12
|
+
import _sfc_main$5 from "./components/checkbox/Checkbox.js";
|
|
13
|
+
import { useCombobox } from "./composables/use-combobox.js";
|
|
14
|
+
import { firstFocusable, useAnchor, usePopoverState } from "./composables/use-popover.js";
|
|
15
|
+
import _sfc_main$6 from "./components/combobox/Combobox.js";
|
|
16
|
+
import _sfc_main$9 from "./components/dialog/Dialog.js";
|
|
17
|
+
import _sfc_main$7 from "./components/dialog/ConfirmDialog.js";
|
|
18
|
+
import { isMenuSeparator, useMenu } from "./composables/use-menu.js";
|
|
19
|
+
import _sfc_main$8 from "./components/context-menu/ContextMenu.js";
|
|
20
|
+
import _sfc_main$11 from "./components/input/Input.js";
|
|
21
|
+
import { parseChord, platformFrom, usePlatform } from "./composables/use-platform.js";
|
|
22
|
+
import _sfc_main$12 from "./components/kbd/Kbd.js";
|
|
23
|
+
import _sfc_main$13 from "./components/menu/Menu.js";
|
|
24
|
+
import _sfc_main$14 from "./components/otp-input/OtpInput.js";
|
|
25
|
+
import _sfc_main$15 from "./components/popover/Popover.js";
|
|
26
|
+
import { useRovingSelection } from "./composables/use-roving-selection.js";
|
|
27
|
+
import _sfc_main$16 from "./components/radio-group/RadioGroup.js";
|
|
28
|
+
import { useSlideIndicator } from "./composables/use-slide-indicator.js";
|
|
29
|
+
import _sfc_main$17 from "./components/segmented/Segmented.js";
|
|
30
|
+
import { useSelect } from "./composables/use-select.js";
|
|
31
|
+
import _sfc_main$18 from "./components/select/Select.js";
|
|
32
|
+
import _sfc_main$19 from "./components/slider/Slider.js";
|
|
33
|
+
import _sfc_main$20 from "./components/spin-button/SpinButton.js";
|
|
34
|
+
import _sfc_main$21 from "./components/split-button/SplitButton.js";
|
|
35
|
+
import _sfc_main$22 from "./components/switch/Switch.js";
|
|
36
|
+
import _sfc_main$23 from "./components/table/Table.js";
|
|
37
|
+
import _sfc_main$24 from "./components/tabs/Tabs.js";
|
|
38
|
+
import _sfc_main$25 from "./components/textarea/Textarea.js";
|
|
39
|
+
import _sfc_main$26 from "./components/toast/ToastItem.js";
|
|
40
|
+
import _sfc_main$27 from "./components/toast/ToastViewport.js";
|
|
41
|
+
import _sfc_main$28 from "./components/toolbar/Toolbar.js";
|
|
42
|
+
import _sfc_main$29 from "./components/tooltip/Tooltip.js";
|
|
43
|
+
import { useForm } from "./composables/use-form.js";
|
|
44
|
+
export { ACCORDION_KEY, _sfc_main as Accordion, _sfc_main$1 as AccordionItem, _sfc_main$2 as Avatar, _sfc_main$3 as AvatarGroup, _sfc_main$4 as Button, _sfc_main$5 as Checkbox, _sfc_main$6 as Combobox, _sfc_main$7 as ConfirmDialog, _sfc_main$8 as ContextMenu, _sfc_main$9 as Dialog, _sfc_main$10 as IconButton, _sfc_main$11 as Input, _sfc_main$12 as Kbd, _sfc_main$13 as Menu, _sfc_main$14 as OtpInput, _sfc_main$15 as Popover, _sfc_main$16 as RadioGroup, _sfc_main$17 as Segmented, _sfc_main$18 as Select, _sfc_main$19 as Slider, _sfc_main$20 as SpinButton, _sfc_main$21 as SplitButton, _sfc_main$22 as Switch, TOASTER_KEY, _sfc_main$23 as Table, _sfc_main$24 as Tabs, _sfc_main$25 as Textarea, _sfc_main$26 as ToastItem, _sfc_main$27 as ToastViewport, _sfc_main$28 as Toolbar, _sfc_main$29 as Tooltip, UI_CONFIG_KEY, createToaster, createUi, defaultTranslations, firstFocusable, isMenuSeparator, parseChord, platformFrom, useAccordionItem, useAnchor, useCombobox, useField, useForm, useMenu, usePlatform, usePopoverState, useRovingSelection, useSelect, useSlideIndicator, useToast, useTranslations, useUiConfig };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/nuxt/module.d.ts
|
|
2
|
+
/** Auto-registered as `<{prefix}{name}>`. A test keeps it in step with `src/index.ts`. */
|
|
3
|
+
export declare const COMPONENTS: readonly ["Accordion", "AccordionItem", "Avatar", "AvatarGroup", "Button", "Checkbox", "Combobox", "ConfirmDialog", "ContextMenu", "Dialog", "IconButton", "Input", "Kbd", "Menu", "OtpInput", "Popover", "RadioGroup", "Segmented", "Select", "Slider", "SpinButton", "SplitButton", "Switch", "Table", "Tabs", "Textarea", "ToastItem", "ToastViewport", "Toolbar", "Tooltip"];
|
|
4
|
+
export declare const COMPOSABLES: readonly ["useField", "useForm", "useToast"];
|
|
5
|
+
export interface ModuleOptions {
|
|
6
|
+
/** Auto-imported component prefix: `Ui` gives `<UiButton>`. */
|
|
7
|
+
prefix: string;
|
|
8
|
+
/** Inject the core stylesheet. Turn off only to import it yourself, e.g. into a layer order. */
|
|
9
|
+
css: boolean;
|
|
10
|
+
/** Auto-import `useField`, `useForm` and `useToast`. */
|
|
11
|
+
composables: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare const _default: import("@nuxt/schema").NuxtModule<ModuleOptions, ModuleOptions, false>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { _default as default };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { version } from "../package.js";
|
|
2
|
+
import { addComponent, addImports, addPlugin, createResolver, defineNuxtModule } from "@nuxt/kit";
|
|
3
|
+
//#region src/nuxt/module.ts
|
|
4
|
+
const PACKAGE = "@humanonlyweb/ui";
|
|
5
|
+
/** Auto-registered as `<{prefix}{name}>`. A test keeps it in step with `src/index.ts`. */
|
|
6
|
+
const COMPONENTS = [
|
|
7
|
+
"Accordion",
|
|
8
|
+
"AccordionItem",
|
|
9
|
+
"Avatar",
|
|
10
|
+
"AvatarGroup",
|
|
11
|
+
"Button",
|
|
12
|
+
"Checkbox",
|
|
13
|
+
"Combobox",
|
|
14
|
+
"ConfirmDialog",
|
|
15
|
+
"ContextMenu",
|
|
16
|
+
"Dialog",
|
|
17
|
+
"IconButton",
|
|
18
|
+
"Input",
|
|
19
|
+
"Kbd",
|
|
20
|
+
"Menu",
|
|
21
|
+
"OtpInput",
|
|
22
|
+
"Popover",
|
|
23
|
+
"RadioGroup",
|
|
24
|
+
"Segmented",
|
|
25
|
+
"Select",
|
|
26
|
+
"Slider",
|
|
27
|
+
"SpinButton",
|
|
28
|
+
"SplitButton",
|
|
29
|
+
"Switch",
|
|
30
|
+
"Table",
|
|
31
|
+
"Tabs",
|
|
32
|
+
"Textarea",
|
|
33
|
+
"ToastItem",
|
|
34
|
+
"ToastViewport",
|
|
35
|
+
"Toolbar",
|
|
36
|
+
"Tooltip"
|
|
37
|
+
];
|
|
38
|
+
const COMPOSABLES = [
|
|
39
|
+
"useField",
|
|
40
|
+
"useForm",
|
|
41
|
+
"useToast"
|
|
42
|
+
];
|
|
43
|
+
var module_default = defineNuxtModule({
|
|
44
|
+
meta: {
|
|
45
|
+
name: PACKAGE,
|
|
46
|
+
version,
|
|
47
|
+
configKey: "ui",
|
|
48
|
+
compatibility: { nuxt: ">=4.0.0" }
|
|
49
|
+
},
|
|
50
|
+
defaults: {
|
|
51
|
+
prefix: "Ui",
|
|
52
|
+
css: true,
|
|
53
|
+
composables: true
|
|
54
|
+
},
|
|
55
|
+
setup(options, nuxt) {
|
|
56
|
+
const resolver = createResolver(import.meta.url);
|
|
57
|
+
const entry = resolver.resolve("../index");
|
|
58
|
+
for (const name of COMPONENTS) addComponent({
|
|
59
|
+
name: `${options.prefix}${name}`,
|
|
60
|
+
export: name,
|
|
61
|
+
filePath: entry
|
|
62
|
+
});
|
|
63
|
+
if (options.composables) addImports(COMPOSABLES.map((name) => ({
|
|
64
|
+
name,
|
|
65
|
+
from: entry
|
|
66
|
+
})));
|
|
67
|
+
if (options.css) nuxt.options.css.push(resolver.resolve("../styles/core.css"));
|
|
68
|
+
addPlugin(resolver.resolve("./runtime/plugin"));
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
//#endregion
|
|
72
|
+
export { COMPONENTS, COMPOSABLES, module_default as default };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createUi } from "../../config.js";
|
|
2
|
+
import { platformFrom } from "../../composables/use-platform.js";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
import { defineNuxtPlugin, useRequestHeaders, useState } from "nuxt/app";
|
|
5
|
+
import { NuxtLink } from "#components";
|
|
6
|
+
//#region src/nuxt/runtime/plugin.ts
|
|
7
|
+
var plugin_default = defineNuxtPlugin({
|
|
8
|
+
name: "humanonlyweb-ui",
|
|
9
|
+
setup(nuxtApp) {
|
|
10
|
+
const platform = useState("humanonlyweb-ui:platform", () => {
|
|
11
|
+
if (import.meta.client) return platformFrom(navigator.userAgent);
|
|
12
|
+
if (import.meta.prerender) return null;
|
|
13
|
+
const headers = useRequestHeaders(["sec-ch-ua-platform", "user-agent"]);
|
|
14
|
+
const source = headers["sec-ch-ua-platform"] ?? headers["user-agent"];
|
|
15
|
+
return source ? platformFrom(source) : null;
|
|
16
|
+
});
|
|
17
|
+
nuxtApp.vueApp.use(createUi({
|
|
18
|
+
link: NuxtLink,
|
|
19
|
+
platform: computed(() => platform.value ?? void 0)
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
//#endregion
|
|
24
|
+
export { plugin_default as default };
|
package/dist/package.js
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/* @humanonlyweb/ui core styles: behaviour only, in a layer your CSS overrides. */
|
|
2
|
+
@layer humanonlyweb-ui {
|
|
3
|
+
/* Dialog: no page scroll behind a modal. */
|
|
4
|
+
:root:has([data-part="dialog"]:modal) {
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
scrollbar-gutter: stable;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/* Popover, Menu, Select, Combobox: anchored to the trigger, flipping at edges. */
|
|
10
|
+
[data-part="popover"],
|
|
11
|
+
[data-part="menu-list"],
|
|
12
|
+
[data-part="select-listbox"],
|
|
13
|
+
[data-part="combobox-popup"] {
|
|
14
|
+
inset: auto;
|
|
15
|
+
margin: 0;
|
|
16
|
+
overflow-y: auto;
|
|
17
|
+
position-area: block-end span-inline-end;
|
|
18
|
+
position-try-fallbacks:
|
|
19
|
+
flip-block,
|
|
20
|
+
flip-inline,
|
|
21
|
+
flip-block flip-inline;
|
|
22
|
+
position-visibility: anchors-visible;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
[data-part="popover"][data-popover-align="end"],
|
|
26
|
+
[data-part="menu-list"][data-menu-align="end"] {
|
|
27
|
+
position-area: block-end span-inline-start;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[data-part="menu-list"],
|
|
31
|
+
[data-part="select-listbox"],
|
|
32
|
+
[data-part="combobox-popup"] {
|
|
33
|
+
min-inline-size: anchor-size(inline);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/* An inline anchor would measure its line box, not its button. */
|
|
37
|
+
[data-part="popover-anchor"],
|
|
38
|
+
[data-part="menu"],
|
|
39
|
+
[data-part="toolbar"] {
|
|
40
|
+
display: inline-flex;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
[data-part="toolbar"][data-orientation="vertical"] {
|
|
44
|
+
flex-direction: column;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* Context menu: anchored to a zero-size point at the pointer. */
|
|
48
|
+
[data-part="context-menu"] {
|
|
49
|
+
-webkit-touch-callout: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
[data-part="context-menu-anchor"] {
|
|
53
|
+
position: fixed;
|
|
54
|
+
width: 0;
|
|
55
|
+
height: 0;
|
|
56
|
+
pointer-events: none;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
[data-part="context-menu-anchor"] + [data-part="menu-list"] {
|
|
60
|
+
position-area: block-end span-inline-end;
|
|
61
|
+
min-inline-size: auto;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Accordion: pad accordion-content, not the clip, or it won't collapse. */
|
|
65
|
+
[data-part="accordion-panel"] {
|
|
66
|
+
display: grid;
|
|
67
|
+
grid-template-rows: 0fr;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
[data-part="accordion-panel"][data-accordion-open] {
|
|
71
|
+
grid-template-rows: 1fr;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
[data-part="accordion-clip"] {
|
|
75
|
+
min-height: 0;
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
[data-part="accordion-panel"][data-accordion-open] > [data-part="accordion-clip"] {
|
|
80
|
+
overflow: visible;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Tooltip: above the trigger; flips and shifts at edges. */
|
|
84
|
+
[data-part="tooltip-root"] {
|
|
85
|
+
display: inline-flex;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
[data-part="tooltip"] {
|
|
89
|
+
inset: auto;
|
|
90
|
+
margin: 0;
|
|
91
|
+
width: max-content;
|
|
92
|
+
max-width: min(320px, calc(100vw - 16px));
|
|
93
|
+
overflow: visible;
|
|
94
|
+
position-area: block-start;
|
|
95
|
+
position-try-fallbacks:
|
|
96
|
+
flip-block,
|
|
97
|
+
block-start span-inline-end,
|
|
98
|
+
block-start span-inline-start,
|
|
99
|
+
block-end span-inline-end,
|
|
100
|
+
block-end span-inline-start;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/* Tabs, Segmented: indicator placed from the measured --ui-indicator-* vars. */
|
|
104
|
+
[data-part="tablist"],
|
|
105
|
+
[data-part="segmented"] {
|
|
106
|
+
position: relative;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/* Physical left, not inline-start: --ui-indicator-x is measured from the left edge,
|
|
110
|
+
in right-to-left layouts too. */
|
|
111
|
+
[data-part="tab-indicator"],
|
|
112
|
+
[data-part="segmented-indicator"] {
|
|
113
|
+
position: absolute;
|
|
114
|
+
left: 0;
|
|
115
|
+
width: var(--ui-indicator-width);
|
|
116
|
+
transform: translateX(var(--ui-indicator-x));
|
|
117
|
+
pointer-events: none;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
[data-part="tab-indicator"] {
|
|
121
|
+
inset-block-end: 0;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
[data-part="segmented-indicator"] {
|
|
125
|
+
top: var(--ui-indicator-top);
|
|
126
|
+
height: var(--ui-indicator-height);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* Paints above the indicator. */
|
|
130
|
+
[data-part="segment"] {
|
|
131
|
+
position: relative;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Slider: placed from the --ui-slider-* percentages. */
|
|
135
|
+
[data-part="slider-control"] {
|
|
136
|
+
position: relative;
|
|
137
|
+
display: flex;
|
|
138
|
+
align-items: center;
|
|
139
|
+
touch-action: none;
|
|
140
|
+
user-select: none;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
[data-part="slider-track"] {
|
|
144
|
+
position: relative;
|
|
145
|
+
flex: 1;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
[data-part="slider-range"] {
|
|
149
|
+
position: absolute;
|
|
150
|
+
inset-block: 0;
|
|
151
|
+
inset-inline-start: var(--ui-slider-start);
|
|
152
|
+
inset-inline-end: calc(100% - var(--ui-slider-end));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
[data-part="slider-thumb"] {
|
|
156
|
+
position: absolute;
|
|
157
|
+
inset-block-start: 50%;
|
|
158
|
+
inset-inline-start: var(--ui-slider-value);
|
|
159
|
+
translate: -50% -50%;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/* :dir(), unlike [dir="rtl"] on an ancestor, respects nested dir and dir="auto". */
|
|
163
|
+
[data-part="slider-thumb"]:dir(rtl) {
|
|
164
|
+
translate: 50% -50%;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
[data-part="slider"][data-orientation="vertical"] {
|
|
168
|
+
& [data-part="slider-control"] {
|
|
169
|
+
flex-direction: column;
|
|
170
|
+
justify-content: center;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
& [data-part="slider-range"] {
|
|
174
|
+
inset-inline: 0;
|
|
175
|
+
inset-block-start: calc(100% - var(--ui-slider-end));
|
|
176
|
+
inset-block-end: var(--ui-slider-start);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
& [data-part="slider-thumb"] {
|
|
180
|
+
inset-block-start: auto;
|
|
181
|
+
inset-block-end: var(--ui-slider-value);
|
|
182
|
+
inset-inline-start: 50%;
|
|
183
|
+
translate: -50% 50%;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/* Switch */
|
|
188
|
+
[data-part="switch-track"] {
|
|
189
|
+
display: inline-flex;
|
|
190
|
+
align-items: center;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
[data-part="switch"][data-switch-checked] [data-part="switch-track"] {
|
|
194
|
+
justify-content: flex-end;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/* Checkbox: the native input stays, visually hidden. */
|
|
198
|
+
[data-part="checkbox"] {
|
|
199
|
+
position: relative;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
[data-part="checkbox-input"] {
|
|
203
|
+
position: absolute;
|
|
204
|
+
width: 1px;
|
|
205
|
+
height: 1px;
|
|
206
|
+
margin: 0;
|
|
207
|
+
opacity: 0;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/* Toasts */
|
|
211
|
+
/* A manual popover in the top layer: undo the browser's centred-box defaults. */
|
|
212
|
+
[data-part="toast-viewport"] {
|
|
213
|
+
position: fixed;
|
|
214
|
+
inset: auto;
|
|
215
|
+
inset-block-end: 0;
|
|
216
|
+
inset-inline-end: 0;
|
|
217
|
+
margin: 0;
|
|
218
|
+
padding: 0;
|
|
219
|
+
border: 0;
|
|
220
|
+
background: none;
|
|
221
|
+
color: inherit;
|
|
222
|
+
overflow: visible;
|
|
223
|
+
display: flex;
|
|
224
|
+
flex-direction: column;
|
|
225
|
+
pointer-events: none;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
[data-part="toast-viewport"] > * {
|
|
229
|
+
pointer-events: auto;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/* Avatar: the image covers the initials, which show until it has loaded. */
|
|
233
|
+
[data-part="avatar"] {
|
|
234
|
+
position: relative;
|
|
235
|
+
display: inline-flex;
|
|
236
|
+
align-items: center;
|
|
237
|
+
justify-content: center;
|
|
238
|
+
overflow: hidden;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
[data-part="avatar-image"] {
|
|
242
|
+
position: absolute;
|
|
243
|
+
inset: 0;
|
|
244
|
+
width: 100%;
|
|
245
|
+
height: 100%;
|
|
246
|
+
object-fit: cover;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/* Table */
|
|
250
|
+
[data-part="table-scroll"] {
|
|
251
|
+
overflow-x: auto;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* OTP input: one real input laid over the slots, which only display its value.
|
|
255
|
+
Autofill, paste and screen readers see a single field. */
|
|
256
|
+
[data-part="otp"] {
|
|
257
|
+
position: relative;
|
|
258
|
+
display: inline-flex;
|
|
259
|
+
align-items: center;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
[data-part="otp-input"] {
|
|
263
|
+
position: absolute;
|
|
264
|
+
inset: 0;
|
|
265
|
+
width: 100%;
|
|
266
|
+
height: 100%;
|
|
267
|
+
margin: 0;
|
|
268
|
+
padding: 0;
|
|
269
|
+
/* Under 16px, iOS zooms in on focus. */
|
|
270
|
+
font-size: max(16px, 1em);
|
|
271
|
+
/* Important, so an app's input reset can't show it over the slots: a layered
|
|
272
|
+
!important beats unlayered rules, important or not. */
|
|
273
|
+
border: 0 !important;
|
|
274
|
+
outline: 0 !important;
|
|
275
|
+
background: transparent !important;
|
|
276
|
+
box-shadow: none !important;
|
|
277
|
+
color: transparent !important;
|
|
278
|
+
caret-color: transparent !important;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
[data-part="otp-input"]::selection {
|
|
282
|
+
background: transparent;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
//#region src/translations.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Every string the components render or announce on their own. Override any of them
|
|
4
|
+
* with `createUi({ translations })`. Strings with a value in them are functions, so each
|
|
5
|
+
* language can order its words.
|
|
6
|
+
*/
|
|
7
|
+
export interface UiTranslations {
|
|
8
|
+
/** Dialog's header close button. */
|
|
9
|
+
close: string;
|
|
10
|
+
/** ConfirmDialog's buttons, when `confirm-text` / `cancel-text` aren't set. */
|
|
11
|
+
confirm: string;
|
|
12
|
+
cancel: string;
|
|
13
|
+
/** Toast's dismiss button. */
|
|
14
|
+
dismissToast: string;
|
|
15
|
+
/** Toast viewport's region name, when `label` isn't set. */
|
|
16
|
+
notifications: string;
|
|
17
|
+
/** Menu's trigger text and name, when `label` isn't set. */
|
|
18
|
+
menu: string;
|
|
19
|
+
/** ContextMenu's name, when `label` isn't set. */
|
|
20
|
+
contextMenu: string;
|
|
21
|
+
/** SpinButton's step buttons. */
|
|
22
|
+
decrease: string;
|
|
23
|
+
increase: string;
|
|
24
|
+
/** Appended to a field label with `optional`. */
|
|
25
|
+
optional: string;
|
|
26
|
+
/** Textarea's spoken character count. */
|
|
27
|
+
characterCount: (count: number, max: number) => string;
|
|
28
|
+
/** Select with several picked: what follows the first label. */
|
|
29
|
+
moreSelected: (count: number) => string;
|
|
30
|
+
/** Combobox chip's remove button. */
|
|
31
|
+
removeItem: (label: string) => string;
|
|
32
|
+
/** Combobox with `multiple`: what's picked, part of the input's description. */
|
|
33
|
+
selectedItems: (labels: string[]) => string;
|
|
34
|
+
/** Combobox with nothing matching. */
|
|
35
|
+
noResults: string;
|
|
36
|
+
/** Combobox with `creatable`, offering to add the typed text. */
|
|
37
|
+
createOption: (query: string) => string;
|
|
38
|
+
/** Combobox's spoken result count while filtering. */
|
|
39
|
+
resultCount: (count: number) => string;
|
|
40
|
+
/** Combobox while `loading`. */
|
|
41
|
+
loading: string;
|
|
42
|
+
/** Table without rows. */
|
|
43
|
+
noData: string;
|
|
44
|
+
/** Slider range thumbs, when `thumb-labels` isn't set. */
|
|
45
|
+
rangeStart: string;
|
|
46
|
+
rangeEnd: string;
|
|
47
|
+
/** AvatarGroup's "+N" chip, when `overflow-label` isn't set. */
|
|
48
|
+
moreAvatars: (count: number) => string;
|
|
49
|
+
/** Spoken names of Kbd's special keys. */
|
|
50
|
+
keys: {
|
|
51
|
+
command: string;
|
|
52
|
+
control: string;
|
|
53
|
+
option: string;
|
|
54
|
+
alt: string;
|
|
55
|
+
shift: string;
|
|
56
|
+
enter: string;
|
|
57
|
+
backspace: string;
|
|
58
|
+
tab: string;
|
|
59
|
+
escape: string;
|
|
60
|
+
space: string;
|
|
61
|
+
up: string;
|
|
62
|
+
down: string;
|
|
63
|
+
left: string;
|
|
64
|
+
right: string;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export type UiTranslationsInput = Partial<Omit<UiTranslations, "keys">> & {
|
|
68
|
+
keys?: Partial<UiTranslations["keys"]>;
|
|
69
|
+
};
|
|
70
|
+
export declare const defaultTranslations: UiTranslations;
|
|
71
|
+
//#endregion
|