@ghostvue/themes 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 +22 -0
- package/README.md +59 -2
- package/THIRD_PARTY_NOTICES.md +30 -0
- package/dist/base.css +341 -0
- package/dist/calm.css +1899 -0
- package/dist/components.d.ts +148 -0
- package/dist/components.js +143 -0
- package/dist/default.css +11017 -0
- package/dist/define.d.ts +75 -0
- package/dist/define.js +5934 -0
- package/dist/flagship-themes.d.ts +5 -0
- package/dist/flagship-themes.js +3 -0
- package/dist/generated/tokens.d.ts +5275 -0
- package/dist/generated/tokens.js +5272 -0
- package/dist/ghost-accordion-content.d.ts +26 -0
- package/dist/ghost-accordion-content.js +22 -0
- package/dist/ghost-accordion-item.d.ts +24 -0
- package/dist/ghost-accordion-item.js +16 -0
- package/dist/ghost-accordion-trigger.d.ts +17 -0
- package/dist/ghost-accordion-trigger.js +33 -0
- package/dist/ghost-accordion.d.ts +72 -0
- package/dist/ghost-accordion.js +56 -0
- package/dist/ghost-avatar.d.ts +60 -0
- package/dist/ghost-avatar.js +39 -0
- package/dist/ghost-badge.d.ts +46 -0
- package/dist/ghost-badge.js +33 -0
- package/dist/ghost-breadcrumb-ellipsis.d.ts +16 -0
- package/dist/ghost-breadcrumb-ellipsis.js +20 -0
- package/dist/ghost-breadcrumb-item.d.ts +18 -0
- package/dist/ghost-breadcrumb-item.js +20 -0
- package/dist/ghost-breadcrumb-link.d.ts +18 -0
- package/dist/ghost-breadcrumb-link.js +33 -0
- package/dist/ghost-breadcrumb-list.d.ts +18 -0
- package/dist/ghost-breadcrumb-list.js +27 -0
- package/dist/ghost-breadcrumb-page.d.ts +18 -0
- package/dist/ghost-breadcrumb-page.js +20 -0
- package/dist/ghost-breadcrumb-separator.d.ts +18 -0
- package/dist/ghost-breadcrumb-separator.js +20 -0
- package/dist/ghost-breadcrumb.d.ts +34 -0
- package/dist/ghost-breadcrumb.js +27 -0
- package/dist/ghost-button.d.ts +102 -0
- package/dist/ghost-button.js +66 -0
- package/dist/ghost-calendar-cell.d.ts +15 -0
- package/dist/ghost-calendar-cell.js +12 -0
- package/dist/ghost-calendar-grid.d.ts +5 -0
- package/dist/ghost-calendar-grid.js +21 -0
- package/dist/ghost-calendar-header.d.ts +3 -0
- package/dist/ghost-calendar-header.js +9 -0
- package/dist/ghost-calendar-heading.d.ts +3 -0
- package/dist/ghost-calendar-heading.js +9 -0
- package/dist/ghost-calendar-next-button.d.ts +9 -0
- package/dist/ghost-calendar-next-button.js +18 -0
- package/dist/ghost-calendar-prev-button.d.ts +9 -0
- package/dist/ghost-calendar-prev-button.js +18 -0
- package/dist/ghost-calendar.d.ts +119 -0
- package/dist/ghost-calendar.js +101 -0
- package/dist/ghost-card.d.ts +33 -0
- package/dist/ghost-card.js +36 -0
- package/dist/ghost-checkbox.d.ts +76 -0
- package/dist/ghost-checkbox.js +59 -0
- package/dist/ghost-collapsible-content.d.ts +28 -0
- package/dist/ghost-collapsible-content.js +41 -0
- package/dist/ghost-collapsible-trigger.d.ts +28 -0
- package/dist/ghost-collapsible-trigger.js +41 -0
- package/dist/ghost-collapsible.d.ts +44 -0
- package/dist/ghost-collapsible.js +38 -0
- package/dist/ghost-combobox-content.d.ts +82 -0
- package/dist/ghost-combobox-content.js +58 -0
- package/dist/ghost-combobox-input.d.ts +28 -0
- package/dist/ghost-combobox-input.js +36 -0
- package/dist/ghost-combobox-trigger.d.ts +28 -0
- package/dist/ghost-combobox-trigger.js +36 -0
- package/dist/ghost-combobox.d.ts +179 -0
- package/dist/ghost-combobox.js +98 -0
- package/dist/ghost-command-palette-content.d.ts +86 -0
- package/dist/ghost-command-palette-content.js +55 -0
- package/dist/ghost-command-palette-overlay.d.ts +40 -0
- package/dist/ghost-command-palette-overlay.js +40 -0
- package/dist/ghost-command-palette.d.ts +114 -0
- package/dist/ghost-command-palette.js +93 -0
- package/dist/ghost-context-menu-checkbox-item.d.ts +50 -0
- package/dist/ghost-context-menu-checkbox-item.js +57 -0
- package/dist/ghost-context-menu-content.d.ts +85 -0
- package/dist/ghost-context-menu-content.js +75 -0
- package/dist/ghost-context-menu-group.d.ts +19 -0
- package/dist/ghost-context-menu-group.js +23 -0
- package/dist/ghost-context-menu-item.d.ts +32 -0
- package/dist/ghost-context-menu-item.js +43 -0
- package/dist/ghost-context-menu-label.d.ts +19 -0
- package/dist/ghost-context-menu-label.js +23 -0
- package/dist/ghost-context-menu-radio-group.d.ts +50 -0
- package/dist/ghost-context-menu-radio-group.js +46 -0
- package/dist/ghost-context-menu-radio-item.d.ts +40 -0
- package/dist/ghost-context-menu-radio-item.js +53 -0
- package/dist/ghost-context-menu-separator.d.ts +28 -0
- package/dist/ghost-context-menu-separator.js +28 -0
- package/dist/ghost-context-menu-trigger.d.ts +28 -0
- package/dist/ghost-context-menu-trigger.js +41 -0
- package/dist/ghost-context-menu.d.ts +35 -0
- package/dist/ghost-context-menu.js +33 -0
- package/dist/ghost-data-table-preset.d.ts +31 -0
- package/dist/ghost-data-table-preset.js +12 -0
- package/dist/ghost-data-table-table.d.ts +30 -0
- package/dist/ghost-data-table-table.js +9 -0
- package/dist/ghost-data-table.d.ts +94 -0
- package/dist/ghost-data-table.js +105 -0
- package/dist/ghost-date-picker-calendar.d.ts +9 -0
- package/dist/ghost-date-picker-calendar.js +30 -0
- package/dist/ghost-date-picker-content.d.ts +95 -0
- package/dist/ghost-date-picker-content.js +58 -0
- package/dist/ghost-date-picker-input.d.ts +46 -0
- package/dist/ghost-date-picker-input.js +39 -0
- package/dist/ghost-date-picker-trigger.d.ts +6 -0
- package/dist/ghost-date-picker-trigger.js +22 -0
- package/dist/ghost-date-picker.d.ts +245 -0
- package/dist/ghost-date-picker.js +68 -0
- package/dist/ghost-dialog-close.d.ts +28 -0
- package/dist/ghost-dialog-close.js +37 -0
- package/dist/ghost-dialog-content.d.ts +95 -0
- package/dist/ghost-dialog-content.js +78 -0
- package/dist/ghost-dialog-description.d.ts +19 -0
- package/dist/ghost-dialog-description.js +37 -0
- package/dist/ghost-dialog-overlay.d.ts +40 -0
- package/dist/ghost-dialog-overlay.js +46 -0
- package/dist/ghost-dialog-title.d.ts +19 -0
- package/dist/ghost-dialog-title.js +33 -0
- package/dist/ghost-dialog-trigger.d.ts +28 -0
- package/dist/ghost-dialog-trigger.js +37 -0
- package/dist/ghost-dialog.d.ts +44 -0
- package/dist/ghost-dialog.js +38 -0
- package/dist/ghost-drawer-close.d.ts +28 -0
- package/dist/ghost-drawer-close.js +37 -0
- package/dist/ghost-drawer-content.d.ts +87 -0
- package/dist/ghost-drawer-content.js +73 -0
- package/dist/ghost-drawer-description.d.ts +19 -0
- package/dist/ghost-drawer-description.js +36 -0
- package/dist/ghost-drawer-overlay.d.ts +40 -0
- package/dist/ghost-drawer-overlay.js +46 -0
- package/dist/ghost-drawer-title.d.ts +19 -0
- package/dist/ghost-drawer-title.js +32 -0
- package/dist/ghost-drawer-trigger.d.ts +28 -0
- package/dist/ghost-drawer-trigger.js +37 -0
- package/dist/ghost-drawer.d.ts +62 -0
- package/dist/ghost-drawer.js +48 -0
- package/dist/ghost-dropdown-menu-checkbox-item.d.ts +50 -0
- package/dist/ghost-dropdown-menu-checkbox-item.js +57 -0
- package/dist/ghost-dropdown-menu-content.d.ts +85 -0
- package/dist/ghost-dropdown-menu-content.js +75 -0
- package/dist/ghost-dropdown-menu-group.d.ts +19 -0
- package/dist/ghost-dropdown-menu-group.js +23 -0
- package/dist/ghost-dropdown-menu-item.d.ts +32 -0
- package/dist/ghost-dropdown-menu-item.js +47 -0
- package/dist/ghost-dropdown-menu-label.d.ts +19 -0
- package/dist/ghost-dropdown-menu-label.js +23 -0
- package/dist/ghost-dropdown-menu-radio-group.d.ts +50 -0
- package/dist/ghost-dropdown-menu-radio-group.js +46 -0
- package/dist/ghost-dropdown-menu-radio-item.d.ts +40 -0
- package/dist/ghost-dropdown-menu-radio-item.js +53 -0
- package/dist/ghost-dropdown-menu-separator.d.ts +28 -0
- package/dist/ghost-dropdown-menu-separator.js +28 -0
- package/dist/ghost-dropdown-menu-trigger.d.ts +28 -0
- package/dist/ghost-dropdown-menu-trigger.js +41 -0
- package/dist/ghost-dropdown-menu.d.ts +35 -0
- package/dist/ghost-dropdown-menu.js +33 -0
- package/dist/ghost-empty-state.d.ts +31 -0
- package/dist/ghost-empty-state.js +35 -0
- package/dist/ghost-field.d.ts +44 -0
- package/dist/ghost-field.js +44 -0
- package/dist/ghost-file-upload-dropzone.d.ts +9 -0
- package/dist/ghost-file-upload-dropzone.js +23 -0
- package/dist/ghost-file-upload-item-remove.d.ts +10 -0
- package/dist/ghost-file-upload-item-remove.js +30 -0
- package/dist/ghost-file-upload-list.d.ts +10 -0
- package/dist/ghost-file-upload-list.js +24 -0
- package/dist/ghost-file-upload-trigger.d.ts +18 -0
- package/dist/ghost-file-upload-trigger.js +30 -0
- package/dist/ghost-file-upload.d.ts +147 -0
- package/dist/ghost-file-upload.js +98 -0
- package/dist/ghost-hover-card-content.d.ts +85 -0
- package/dist/ghost-hover-card-content.js +75 -0
- package/dist/ghost-hover-card-trigger.d.ts +28 -0
- package/dist/ghost-hover-card-trigger.js +41 -0
- package/dist/ghost-hover-card.d.ts +62 -0
- package/dist/ghost-hover-card.js +48 -0
- package/dist/ghost-inline-alert.d.ts +62 -0
- package/dist/ghost-inline-alert.js +50 -0
- package/dist/ghost-input.d.ts +100 -0
- package/dist/ghost-input.js +60 -0
- package/dist/ghost-interactive-surface.d.ts +31 -0
- package/dist/ghost-interactive-surface.js +36 -0
- package/dist/ghost-kbd.d.ts +42 -0
- package/dist/ghost-kbd.js +32 -0
- package/dist/ghost-link.d.ts +94 -0
- package/dist/ghost-link.js +59 -0
- package/dist/ghost-menubar-checkbox-item.d.ts +50 -0
- package/dist/ghost-menubar-checkbox-item.js +57 -0
- package/dist/ghost-menubar-content.d.ts +85 -0
- package/dist/ghost-menubar-content.js +71 -0
- package/dist/ghost-menubar-group.d.ts +19 -0
- package/dist/ghost-menubar-group.js +19 -0
- package/dist/ghost-menubar-item.d.ts +32 -0
- package/dist/ghost-menubar-item.js +43 -0
- package/dist/ghost-menubar-label.d.ts +19 -0
- package/dist/ghost-menubar-label.js +19 -0
- package/dist/ghost-menubar-menu.d.ts +35 -0
- package/dist/ghost-menubar-menu.js +33 -0
- package/dist/ghost-menubar-radio-group.d.ts +50 -0
- package/dist/ghost-menubar-radio-group.js +46 -0
- package/dist/ghost-menubar-radio-item.d.ts +40 -0
- package/dist/ghost-menubar-radio-item.js +53 -0
- package/dist/ghost-menubar-separator.d.ts +28 -0
- package/dist/ghost-menubar-separator.js +28 -0
- package/dist/ghost-menubar-trigger.d.ts +28 -0
- package/dist/ghost-menubar-trigger.js +37 -0
- package/dist/ghost-menubar.d.ts +28 -0
- package/dist/ghost-menubar.js +33 -0
- package/dist/ghost-number-input.d.ts +153 -0
- package/dist/ghost-number-input.js +87 -0
- package/dist/ghost-pagination.d.ts +151 -0
- package/dist/ghost-pagination.js +71 -0
- package/dist/ghost-popover-close.d.ts +28 -0
- package/dist/ghost-popover-close.js +37 -0
- package/dist/ghost-popover-content.d.ts +86 -0
- package/dist/ghost-popover-content.js +72 -0
- package/dist/ghost-popover-trigger.d.ts +28 -0
- package/dist/ghost-popover-trigger.js +37 -0
- package/dist/ghost-popover.d.ts +35 -0
- package/dist/ghost-popover.js +33 -0
- package/dist/ghost-progress.d.ts +69 -0
- package/dist/ghost-progress.js +37 -0
- package/dist/ghost-radio-group-item.d.ts +37 -0
- package/dist/ghost-radio-group-item.js +33 -0
- package/dist/ghost-radio-group.d.ts +91 -0
- package/dist/ghost-radio-group.js +65 -0
- package/dist/ghost-scroll-area.d.ts +49 -0
- package/dist/ghost-scroll-area.js +32 -0
- package/dist/ghost-scroll-spy-item.d.ts +27 -0
- package/dist/ghost-scroll-spy-item.js +29 -0
- package/dist/ghost-scroll-spy-link.d.ts +44 -0
- package/dist/ghost-scroll-spy-link.js +39 -0
- package/dist/ghost-scroll-spy-list.d.ts +18 -0
- package/dist/ghost-scroll-spy-list.js +27 -0
- package/dist/ghost-scroll-spy.d.ts +121 -0
- package/dist/ghost-scroll-spy.js +83 -0
- package/dist/ghost-segmented-control-item.d.ts +36 -0
- package/dist/ghost-segmented-control-item.js +47 -0
- package/dist/ghost-segmented-control.d.ts +77 -0
- package/dist/ghost-segmented-control.js +73 -0
- package/dist/ghost-select-content.d.ts +82 -0
- package/dist/ghost-select-content.js +58 -0
- package/dist/ghost-select-trigger.d.ts +28 -0
- package/dist/ghost-select-trigger.js +36 -0
- package/dist/ghost-select.d.ts +115 -0
- package/dist/ghost-select.js +74 -0
- package/dist/ghost-separator.d.ts +41 -0
- package/dist/ghost-separator.js +34 -0
- package/dist/ghost-skeleton.d.ts +34 -0
- package/dist/ghost-skeleton.js +31 -0
- package/dist/ghost-slider.d.ts +150 -0
- package/dist/ghost-slider.js +83 -0
- package/dist/ghost-spinner.d.ts +42 -0
- package/dist/ghost-spinner.js +26 -0
- package/dist/ghost-switch.d.ts +102 -0
- package/dist/ghost-switch.js +68 -0
- package/dist/ghost-table.d.ts +30 -0
- package/dist/ghost-table.js +36 -0
- package/dist/ghost-tabs-content.d.ts +27 -0
- package/dist/ghost-tabs-content.js +38 -0
- package/dist/ghost-tabs-list.d.ts +19 -0
- package/dist/ghost-tabs-list.js +33 -0
- package/dist/ghost-tabs-trigger.d.ts +36 -0
- package/dist/ghost-tabs-trigger.js +43 -0
- package/dist/ghost-tabs.d.ts +59 -0
- package/dist/ghost-tabs.js +45 -0
- package/dist/ghost-textarea.d.ts +109 -0
- package/dist/ghost-textarea.js +66 -0
- package/dist/ghost-toast-viewport.d.ts +43 -0
- package/dist/ghost-toast-viewport.js +74 -0
- package/dist/ghost-toast.d.ts +54 -0
- package/dist/ghost-toast.js +48 -0
- package/dist/ghost-toggle-group-item.d.ts +36 -0
- package/dist/ghost-toggle-group-item.js +43 -0
- package/dist/ghost-toggle-group.d.ts +77 -0
- package/dist/ghost-toggle-group.js +69 -0
- package/dist/ghost-toolbar.d.ts +6 -0
- package/dist/ghost-toolbar.js +24 -0
- package/dist/ghost-tooltip-content.d.ts +86 -0
- package/dist/ghost-tooltip-content.js +72 -0
- package/dist/ghost-tooltip-trigger.d.ts +28 -0
- package/dist/ghost-tooltip-trigger.js +37 -0
- package/dist/ghost-tooltip.d.ts +62 -0
- package/dist/ghost-tooltip.js +50 -0
- package/dist/ghost-tree-group.d.ts +32 -0
- package/dist/ghost-tree-group.js +39 -0
- package/dist/ghost-tree-item.d.ts +45 -0
- package/dist/ghost-tree-item.js +42 -0
- package/dist/ghost-tree-trigger.d.ts +40 -0
- package/dist/ghost-tree-trigger.js +43 -0
- package/dist/ghost-tree.d.ts +122 -0
- package/dist/ghost-tree.js +98 -0
- package/dist/index.d.ts +148 -0
- package/dist/index.js +144 -0
- package/dist/manifest.json +6375 -0
- package/dist/mono.css +1864 -0
- package/dist/recipes/accordion.css +42 -0
- package/dist/recipes/avatar.css +87 -0
- package/dist/recipes/badge.css +170 -0
- package/dist/recipes/breadcrumb.css +149 -0
- package/dist/recipes/button.css +632 -0
- package/dist/recipes/calendar.css +292 -0
- package/dist/recipes/card.css +54 -0
- package/dist/recipes/checkbox.css +262 -0
- package/dist/recipes/collapsible.css +304 -0
- package/dist/recipes/combobox.css +276 -0
- package/dist/recipes/command-palette.css +244 -0
- package/dist/recipes/context-menu.css +227 -0
- package/dist/recipes/data-table.css +455 -0
- package/dist/recipes/date-picker.css +292 -0
- package/dist/recipes/dialog.css +141 -0
- package/dist/recipes/drawer.css +338 -0
- package/dist/recipes/dropdown-menu.css +232 -0
- package/dist/recipes/empty-state.css +66 -0
- package/dist/recipes/field.css +63 -0
- package/dist/recipes/file-upload.css +260 -0
- package/dist/recipes/hover-card.css +64 -0
- package/dist/recipes/inline-alert.css +172 -0
- package/dist/recipes/input.css +176 -0
- package/dist/recipes/kbd.css +113 -0
- package/dist/recipes/link.css +158 -0
- package/dist/recipes/menubar.css +242 -0
- package/dist/recipes/number-input.css +222 -0
- package/dist/recipes/pagination.css +143 -0
- package/dist/recipes/popover.css +83 -0
- package/dist/recipes/progress.css +119 -0
- package/dist/recipes/radio-group.css +200 -0
- package/dist/recipes/scroll-area.css +31 -0
- package/dist/recipes/scroll-spy.css +72 -0
- package/dist/recipes/segmented-control.css +178 -0
- package/dist/recipes/select.css +299 -0
- package/dist/recipes/separator.css +41 -0
- package/dist/recipes/skeleton.css +132 -0
- package/dist/recipes/slider.css +239 -0
- package/dist/recipes/spinner.css +93 -0
- package/dist/recipes/switch.css +314 -0
- package/dist/recipes/table.css +120 -0
- package/dist/recipes/tabs.css +139 -0
- package/dist/recipes/textarea.css +148 -0
- package/dist/recipes/toast.css +321 -0
- package/dist/recipes/toggle-group.css +92 -0
- package/dist/recipes/toolbar.css +25 -0
- package/dist/recipes/tooltip.css +48 -0
- package/dist/recipes/tree.css +231 -0
- package/dist/start-theme-transition.d.ts +9 -0
- package/dist/start-theme-transition.js +27 -0
- package/dist/tokens/primitives.json +612 -0
- package/dist/tokens/seeds.json +23 -0
- package/dist/tokens/semantic.compact.json +175 -0
- package/dist/tokens/semantic.dark.json +583 -0
- package/dist/tokens/semantic.json +1651 -0
- package/dist/tokens/semantic.spacious.json +175 -0
- package/dist/tokens.css +1864 -0
- package/dist/tokens.json +6137 -0
- package/dist/vibrant.css +1864 -0
- package/package.json +75 -4
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defineComponent, h, ref } from 'vue';
|
|
2
|
+
import { GhostSelect as GhostUnstyledSelect, } from '@ghostvue/vue';
|
|
3
|
+
/** Themed {@link GhostSelect} root wrapper. */
|
|
4
|
+
export const GhostSelect = defineComponent({
|
|
5
|
+
name: 'GhostSelect',
|
|
6
|
+
inheritAttrs: false,
|
|
7
|
+
props: {
|
|
8
|
+
modelValue: {
|
|
9
|
+
type: String,
|
|
10
|
+
default: undefined,
|
|
11
|
+
},
|
|
12
|
+
defaultValue: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: undefined,
|
|
15
|
+
},
|
|
16
|
+
name: { type: String, default: undefined },
|
|
17
|
+
form: { type: String, default: undefined },
|
|
18
|
+
disabled: { type: Boolean, default: false },
|
|
19
|
+
required: { type: Boolean, default: false },
|
|
20
|
+
invalid: { type: Boolean, default: false },
|
|
21
|
+
open: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: undefined,
|
|
24
|
+
},
|
|
25
|
+
defaultOpen: { type: Boolean, default: false },
|
|
26
|
+
placeholder: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: undefined,
|
|
29
|
+
},
|
|
30
|
+
messages: {
|
|
31
|
+
type: Object,
|
|
32
|
+
default: undefined,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
emits: {
|
|
36
|
+
'update:modelValue': (value) => value === undefined || typeof value === 'string',
|
|
37
|
+
'update:open': (open) => typeof open === 'boolean',
|
|
38
|
+
},
|
|
39
|
+
setup(props, { attrs, emit, slots, expose }) {
|
|
40
|
+
const inner = ref(null);
|
|
41
|
+
expose({
|
|
42
|
+
get element() {
|
|
43
|
+
return inner.value?.element ?? null;
|
|
44
|
+
},
|
|
45
|
+
focus(options) {
|
|
46
|
+
inner.value?.focus(options);
|
|
47
|
+
},
|
|
48
|
+
blur() {
|
|
49
|
+
inner.value?.blur();
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
return () => h(GhostUnstyledSelect, {
|
|
53
|
+
...attrs,
|
|
54
|
+
ref: inner,
|
|
55
|
+
modelValue: props.modelValue,
|
|
56
|
+
defaultValue: props.defaultValue,
|
|
57
|
+
name: props.name,
|
|
58
|
+
form: props.form,
|
|
59
|
+
disabled: props.disabled,
|
|
60
|
+
required: props.required,
|
|
61
|
+
invalid: props.invalid,
|
|
62
|
+
open: props.open,
|
|
63
|
+
defaultOpen: props.defaultOpen,
|
|
64
|
+
placeholder: props.placeholder,
|
|
65
|
+
messages: props.messages,
|
|
66
|
+
'onUpdate:modelValue': (next) => {
|
|
67
|
+
emit('update:modelValue', next);
|
|
68
|
+
},
|
|
69
|
+
'onUpdate:open': (next) => {
|
|
70
|
+
emit('update:open', next);
|
|
71
|
+
},
|
|
72
|
+
}, slots);
|
|
73
|
+
},
|
|
74
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import { type GhostSeparatorElement, type GhostSeparatorOrientation } from '@ghostvue/vue';
|
|
3
|
+
/**
|
|
4
|
+
* Themed wrapper: instance-scoped CSS. Behavior stays on the unstyled
|
|
5
|
+
* primitive; native attrs fall through. `as` has no static default — the
|
|
6
|
+
* headless component picks `hr` or `div` from orientation.
|
|
7
|
+
*/
|
|
8
|
+
export declare const GhostSeparator: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
9
|
+
as: {
|
|
10
|
+
type: PropType<GhostSeparatorElement>;
|
|
11
|
+
default: undefined;
|
|
12
|
+
};
|
|
13
|
+
decorative: {
|
|
14
|
+
type: BooleanConstructor;
|
|
15
|
+
default: boolean;
|
|
16
|
+
};
|
|
17
|
+
orientation: {
|
|
18
|
+
type: PropType<GhostSeparatorOrientation>;
|
|
19
|
+
default: string;
|
|
20
|
+
};
|
|
21
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
22
|
+
[key: string]: any;
|
|
23
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
|
+
as: {
|
|
25
|
+
type: PropType<GhostSeparatorElement>;
|
|
26
|
+
default: undefined;
|
|
27
|
+
};
|
|
28
|
+
decorative: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
32
|
+
orientation: {
|
|
33
|
+
type: PropType<GhostSeparatorOrientation>;
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
}>> & Readonly<{}>, {
|
|
37
|
+
as: GhostSeparatorElement;
|
|
38
|
+
decorative: boolean;
|
|
39
|
+
orientation: GhostSeparatorOrientation;
|
|
40
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
41
|
+
export type { GhostSeparatorElement, GhostSeparatorOrientation };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue';
|
|
2
|
+
import { GhostSeparator as GhostUnstyledSeparator, } from '@ghostvue/vue';
|
|
3
|
+
/**
|
|
4
|
+
* Themed wrapper: instance-scoped CSS. Behavior stays on the unstyled
|
|
5
|
+
* primitive; native attrs fall through. `as` has no static default — the
|
|
6
|
+
* headless component picks `hr` or `div` from orientation.
|
|
7
|
+
*/
|
|
8
|
+
export const GhostSeparator = defineComponent({
|
|
9
|
+
name: 'GhostSeparator',
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
props: {
|
|
12
|
+
as: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: undefined,
|
|
15
|
+
},
|
|
16
|
+
decorative: { type: Boolean, default: false },
|
|
17
|
+
orientation: {
|
|
18
|
+
type: String,
|
|
19
|
+
default: 'horizontal',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
setup(props, { attrs }) {
|
|
23
|
+
return () => h('span', { class: 'ghost-themed-scope' }, [
|
|
24
|
+
h(GhostUnstyledSeparator, {
|
|
25
|
+
...attrs,
|
|
26
|
+
// Omit `as` when unset so exactOptionalPropertyTypes stays satisfied
|
|
27
|
+
// and the unstyled default (hr vs div) still applies.
|
|
28
|
+
...(props.as ? { as: props.as } : {}),
|
|
29
|
+
decorative: props.decorative,
|
|
30
|
+
orientation: props.orientation,
|
|
31
|
+
}),
|
|
32
|
+
]);
|
|
33
|
+
},
|
|
34
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import { type GhostSkeletonElement } from '@ghostvue/vue';
|
|
3
|
+
/** Visual treatment for the themed skeleton. Omitting it selects `text`. */
|
|
4
|
+
export type GhostSkeletonShape = 'text' | 'rect' | 'circle';
|
|
5
|
+
/**
|
|
6
|
+
* Themed wrapper: `shape` as `data-shape`, `data-themed` for recipes. No extra
|
|
7
|
+
* span — a wrapper between `tr` and `td` is invalid HTML. Behavior stays on
|
|
8
|
+
* the unstyled primitive; native attrs fall through for dimensions.
|
|
9
|
+
*/
|
|
10
|
+
export declare const GhostSkeleton: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
11
|
+
as: {
|
|
12
|
+
type: PropType<GhostSkeletonElement>;
|
|
13
|
+
default: string;
|
|
14
|
+
};
|
|
15
|
+
shape: {
|
|
16
|
+
type: PropType<GhostSkeletonShape>;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
|
+
as: {
|
|
23
|
+
type: PropType<GhostSkeletonElement>;
|
|
24
|
+
default: string;
|
|
25
|
+
};
|
|
26
|
+
shape: {
|
|
27
|
+
type: PropType<GhostSkeletonShape>;
|
|
28
|
+
default: string;
|
|
29
|
+
};
|
|
30
|
+
}>> & Readonly<{}>, {
|
|
31
|
+
as: GhostSkeletonElement;
|
|
32
|
+
shape: GhostSkeletonShape;
|
|
33
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
34
|
+
export type { GhostSkeletonElement };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue';
|
|
2
|
+
import { GhostSkeleton as GhostUnstyledSkeleton, } from '@ghostvue/vue';
|
|
3
|
+
/**
|
|
4
|
+
* Themed wrapper: `shape` as `data-shape`, `data-themed` for recipes. No extra
|
|
5
|
+
* span — a wrapper between `tr` and `td` is invalid HTML. Behavior stays on
|
|
6
|
+
* the unstyled primitive; native attrs fall through for dimensions.
|
|
7
|
+
*/
|
|
8
|
+
export const GhostSkeleton = defineComponent({
|
|
9
|
+
name: 'GhostSkeleton',
|
|
10
|
+
inheritAttrs: false,
|
|
11
|
+
props: {
|
|
12
|
+
as: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: 'span',
|
|
15
|
+
},
|
|
16
|
+
shape: {
|
|
17
|
+
type: String,
|
|
18
|
+
default: 'text',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
setup(props, { attrs, slots }) {
|
|
22
|
+
return () => h(GhostUnstyledSkeleton, {
|
|
23
|
+
...attrs,
|
|
24
|
+
as: props.as,
|
|
25
|
+
// Same attachment hook as themed popover content (portals / invalid wrappers).
|
|
26
|
+
'data-themed': '',
|
|
27
|
+
// CSS treats a missing hook as the text default.
|
|
28
|
+
'data-shape': props.shape === 'text' ? undefined : props.shape,
|
|
29
|
+
}, slots);
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import { type GhostSliderExposed, type GhostSliderMessages, type GhostSliderValue } from '@ghostvue/vue';
|
|
3
|
+
export type GhostSliderSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export type GhostSliderTone = 'accent' | 'neutral' | 'danger';
|
|
5
|
+
export declare const GhostSlider: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
6
|
+
modelValue: {
|
|
7
|
+
type: PropType<GhostSliderValue | undefined>;
|
|
8
|
+
default: undefined;
|
|
9
|
+
};
|
|
10
|
+
defaultValue: {
|
|
11
|
+
type: PropType<GhostSliderValue | undefined>;
|
|
12
|
+
default: undefined;
|
|
13
|
+
};
|
|
14
|
+
min: {
|
|
15
|
+
type: NumberConstructor;
|
|
16
|
+
default: number;
|
|
17
|
+
};
|
|
18
|
+
max: {
|
|
19
|
+
type: NumberConstructor;
|
|
20
|
+
default: number;
|
|
21
|
+
};
|
|
22
|
+
step: {
|
|
23
|
+
type: NumberConstructor;
|
|
24
|
+
default: number;
|
|
25
|
+
};
|
|
26
|
+
range: {
|
|
27
|
+
type: BooleanConstructor;
|
|
28
|
+
default: boolean;
|
|
29
|
+
};
|
|
30
|
+
orientation: {
|
|
31
|
+
type: PropType<"horizontal" | "vertical">;
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
34
|
+
disabled: {
|
|
35
|
+
type: BooleanConstructor;
|
|
36
|
+
default: boolean;
|
|
37
|
+
};
|
|
38
|
+
name: {
|
|
39
|
+
type: StringConstructor;
|
|
40
|
+
default: undefined;
|
|
41
|
+
};
|
|
42
|
+
nameMax: {
|
|
43
|
+
type: StringConstructor;
|
|
44
|
+
default: undefined;
|
|
45
|
+
};
|
|
46
|
+
form: {
|
|
47
|
+
type: StringConstructor;
|
|
48
|
+
default: undefined;
|
|
49
|
+
};
|
|
50
|
+
valueText: {
|
|
51
|
+
type: StringConstructor;
|
|
52
|
+
default: undefined;
|
|
53
|
+
};
|
|
54
|
+
messages: {
|
|
55
|
+
type: PropType<GhostSliderMessages | undefined>;
|
|
56
|
+
default: undefined;
|
|
57
|
+
};
|
|
58
|
+
size: {
|
|
59
|
+
type: PropType<GhostSliderSize>;
|
|
60
|
+
default: string;
|
|
61
|
+
};
|
|
62
|
+
tone: {
|
|
63
|
+
type: PropType<GhostSliderTone>;
|
|
64
|
+
default: string;
|
|
65
|
+
};
|
|
66
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
69
|
+
'update:modelValue': (value: GhostSliderValue) => value is number | (GhostSliderValue & any[]);
|
|
70
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
71
|
+
modelValue: {
|
|
72
|
+
type: PropType<GhostSliderValue | undefined>;
|
|
73
|
+
default: undefined;
|
|
74
|
+
};
|
|
75
|
+
defaultValue: {
|
|
76
|
+
type: PropType<GhostSliderValue | undefined>;
|
|
77
|
+
default: undefined;
|
|
78
|
+
};
|
|
79
|
+
min: {
|
|
80
|
+
type: NumberConstructor;
|
|
81
|
+
default: number;
|
|
82
|
+
};
|
|
83
|
+
max: {
|
|
84
|
+
type: NumberConstructor;
|
|
85
|
+
default: number;
|
|
86
|
+
};
|
|
87
|
+
step: {
|
|
88
|
+
type: NumberConstructor;
|
|
89
|
+
default: number;
|
|
90
|
+
};
|
|
91
|
+
range: {
|
|
92
|
+
type: BooleanConstructor;
|
|
93
|
+
default: boolean;
|
|
94
|
+
};
|
|
95
|
+
orientation: {
|
|
96
|
+
type: PropType<"horizontal" | "vertical">;
|
|
97
|
+
default: string;
|
|
98
|
+
};
|
|
99
|
+
disabled: {
|
|
100
|
+
type: BooleanConstructor;
|
|
101
|
+
default: boolean;
|
|
102
|
+
};
|
|
103
|
+
name: {
|
|
104
|
+
type: StringConstructor;
|
|
105
|
+
default: undefined;
|
|
106
|
+
};
|
|
107
|
+
nameMax: {
|
|
108
|
+
type: StringConstructor;
|
|
109
|
+
default: undefined;
|
|
110
|
+
};
|
|
111
|
+
form: {
|
|
112
|
+
type: StringConstructor;
|
|
113
|
+
default: undefined;
|
|
114
|
+
};
|
|
115
|
+
valueText: {
|
|
116
|
+
type: StringConstructor;
|
|
117
|
+
default: undefined;
|
|
118
|
+
};
|
|
119
|
+
messages: {
|
|
120
|
+
type: PropType<GhostSliderMessages | undefined>;
|
|
121
|
+
default: undefined;
|
|
122
|
+
};
|
|
123
|
+
size: {
|
|
124
|
+
type: PropType<GhostSliderSize>;
|
|
125
|
+
default: string;
|
|
126
|
+
};
|
|
127
|
+
tone: {
|
|
128
|
+
type: PropType<GhostSliderTone>;
|
|
129
|
+
default: string;
|
|
130
|
+
};
|
|
131
|
+
}>> & Readonly<{
|
|
132
|
+
"onUpdate:modelValue"?: (value: GhostSliderValue) => any;
|
|
133
|
+
}>, {
|
|
134
|
+
name: string;
|
|
135
|
+
form: string;
|
|
136
|
+
size: GhostSliderSize;
|
|
137
|
+
disabled: boolean;
|
|
138
|
+
modelValue: GhostSliderValue | undefined;
|
|
139
|
+
defaultValue: GhostSliderValue | undefined;
|
|
140
|
+
tone: GhostSliderTone;
|
|
141
|
+
range: boolean;
|
|
142
|
+
messages: GhostSliderMessages | undefined;
|
|
143
|
+
min: number;
|
|
144
|
+
max: number;
|
|
145
|
+
step: number;
|
|
146
|
+
valueText: string;
|
|
147
|
+
orientation: "horizontal" | "vertical";
|
|
148
|
+
nameMax: string;
|
|
149
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
150
|
+
export type { GhostSliderExposed };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { defineComponent, h, ref } from 'vue';
|
|
2
|
+
import { GhostSlider as GhostUnstyledSlider, } from '@ghostvue/vue';
|
|
3
|
+
export const GhostSlider = defineComponent({
|
|
4
|
+
name: 'GhostSlider',
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
props: {
|
|
7
|
+
modelValue: {
|
|
8
|
+
type: [Number, Array],
|
|
9
|
+
default: undefined,
|
|
10
|
+
},
|
|
11
|
+
defaultValue: {
|
|
12
|
+
type: [Number, Array],
|
|
13
|
+
default: undefined,
|
|
14
|
+
},
|
|
15
|
+
min: { type: Number, default: 0 },
|
|
16
|
+
max: { type: Number, default: 100 },
|
|
17
|
+
step: { type: Number, default: 1 },
|
|
18
|
+
range: { type: Boolean, default: false },
|
|
19
|
+
orientation: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: 'horizontal',
|
|
22
|
+
},
|
|
23
|
+
disabled: { type: Boolean, default: false },
|
|
24
|
+
name: { type: String, default: undefined },
|
|
25
|
+
nameMax: { type: String, default: undefined },
|
|
26
|
+
form: { type: String, default: undefined },
|
|
27
|
+
valueText: { type: String, default: undefined },
|
|
28
|
+
messages: {
|
|
29
|
+
type: Object,
|
|
30
|
+
default: undefined,
|
|
31
|
+
},
|
|
32
|
+
size: { type: String, default: 'md' },
|
|
33
|
+
tone: { type: String, default: 'accent' },
|
|
34
|
+
},
|
|
35
|
+
emits: {
|
|
36
|
+
'update:modelValue': (value) => typeof value === 'number' || Array.isArray(value),
|
|
37
|
+
},
|
|
38
|
+
setup(props, { attrs, emit, slots, expose }) {
|
|
39
|
+
const inner = ref(null);
|
|
40
|
+
expose({
|
|
41
|
+
get element() {
|
|
42
|
+
return inner.value?.element ?? null;
|
|
43
|
+
},
|
|
44
|
+
get value() {
|
|
45
|
+
return inner.value?.value ?? props.min;
|
|
46
|
+
},
|
|
47
|
+
focus(options) {
|
|
48
|
+
inner.value?.focus(options);
|
|
49
|
+
},
|
|
50
|
+
blur() {
|
|
51
|
+
inner.value?.blur();
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
return () => h('span', { class: 'ghost-themed-scope' }, [
|
|
55
|
+
h(GhostUnstyledSlider, {
|
|
56
|
+
...attrs,
|
|
57
|
+
ref: inner,
|
|
58
|
+
...(props.modelValue === undefined
|
|
59
|
+
? {}
|
|
60
|
+
: { modelValue: props.modelValue }),
|
|
61
|
+
...(props.defaultValue === undefined
|
|
62
|
+
? {}
|
|
63
|
+
: { defaultValue: props.defaultValue }),
|
|
64
|
+
min: props.min,
|
|
65
|
+
max: props.max,
|
|
66
|
+
step: props.step,
|
|
67
|
+
range: props.range,
|
|
68
|
+
orientation: props.orientation,
|
|
69
|
+
disabled: props.disabled,
|
|
70
|
+
...(props.name ? { name: props.name } : {}),
|
|
71
|
+
...(props.nameMax ? { nameMax: props.nameMax } : {}),
|
|
72
|
+
...(props.form ? { form: props.form } : {}),
|
|
73
|
+
...(props.valueText ? { valueText: props.valueText } : {}),
|
|
74
|
+
...(props.messages ? { messages: props.messages } : {}),
|
|
75
|
+
'data-size': props.size === 'md' ? undefined : props.size,
|
|
76
|
+
'data-tone': props.tone === 'accent' ? undefined : props.tone,
|
|
77
|
+
'onUpdate:modelValue': (next) => {
|
|
78
|
+
emit('update:modelValue', next);
|
|
79
|
+
},
|
|
80
|
+
}, slots),
|
|
81
|
+
]);
|
|
82
|
+
},
|
|
83
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
/** Semantic color intent. Omitting it selects `accent`. */
|
|
3
|
+
export type GhostSpinnerTone = 'accent' | 'neutral' | 'danger';
|
|
4
|
+
/** Visual size. Omitting it selects `md`. */
|
|
5
|
+
export type GhostSpinnerSize = 'sm' | 'md' | 'lg';
|
|
6
|
+
/**
|
|
7
|
+
* Themed wrapper: visual props as `data-*`, instance-scoped CSS. Behavior stays
|
|
8
|
+
* on the unstyled primitive; native attrs fall through.
|
|
9
|
+
*/
|
|
10
|
+
export declare const GhostSpinner: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
11
|
+
label: {
|
|
12
|
+
type: StringConstructor;
|
|
13
|
+
default: string;
|
|
14
|
+
};
|
|
15
|
+
tone: {
|
|
16
|
+
type: PropType<GhostSpinnerTone>;
|
|
17
|
+
default: string;
|
|
18
|
+
};
|
|
19
|
+
size: {
|
|
20
|
+
type: PropType<GhostSpinnerSize>;
|
|
21
|
+
default: string;
|
|
22
|
+
};
|
|
23
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
26
|
+
label: {
|
|
27
|
+
type: StringConstructor;
|
|
28
|
+
default: string;
|
|
29
|
+
};
|
|
30
|
+
tone: {
|
|
31
|
+
type: PropType<GhostSpinnerTone>;
|
|
32
|
+
default: string;
|
|
33
|
+
};
|
|
34
|
+
size: {
|
|
35
|
+
type: PropType<GhostSpinnerSize>;
|
|
36
|
+
default: string;
|
|
37
|
+
};
|
|
38
|
+
}>> & Readonly<{}>, {
|
|
39
|
+
label: string;
|
|
40
|
+
size: GhostSpinnerSize;
|
|
41
|
+
tone: GhostSpinnerTone;
|
|
42
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineComponent, h } from 'vue';
|
|
2
|
+
import { GhostSpinner as GhostUnstyledSpinner } from '@ghostvue/vue';
|
|
3
|
+
/**
|
|
4
|
+
* Themed wrapper: visual props as `data-*`, instance-scoped CSS. Behavior stays
|
|
5
|
+
* on the unstyled primitive; native attrs fall through.
|
|
6
|
+
*/
|
|
7
|
+
export const GhostSpinner = defineComponent({
|
|
8
|
+
name: 'GhostSpinner',
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
props: {
|
|
11
|
+
label: { type: String, default: 'Loading' },
|
|
12
|
+
tone: { type: String, default: 'accent' },
|
|
13
|
+
size: { type: String, default: 'md' },
|
|
14
|
+
},
|
|
15
|
+
setup(props, { attrs }) {
|
|
16
|
+
return () => h('span', { class: 'ghost-themed-scope' }, [
|
|
17
|
+
h(GhostUnstyledSpinner, {
|
|
18
|
+
...attrs,
|
|
19
|
+
label: props.label,
|
|
20
|
+
// CSS treats missing attributes as the defaults (accent / md).
|
|
21
|
+
'data-tone': props.tone === 'accent' ? undefined : props.tone,
|
|
22
|
+
'data-size': props.size === 'md' ? undefined : props.size,
|
|
23
|
+
}),
|
|
24
|
+
]);
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import { type GhostSwitchExposed } from '@ghostvue/vue';
|
|
3
|
+
/** Visual size. Omitting it selects `md`. */
|
|
4
|
+
export type GhostSwitchSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
/** Semantic color of the on track. Omitting it selects `accent`. */
|
|
6
|
+
export type GhostSwitchTone = 'accent' | 'neutral' | 'danger';
|
|
7
|
+
/**
|
|
8
|
+
* Themed wrapper: visual props as `data-*`, instance-scoped CSS. Behavior stays
|
|
9
|
+
* on the unstyled primitive; native attrs fall through.
|
|
10
|
+
*/
|
|
11
|
+
export declare const GhostSwitch: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
12
|
+
modelValue: {
|
|
13
|
+
type: PropType<boolean | undefined>;
|
|
14
|
+
default: undefined;
|
|
15
|
+
};
|
|
16
|
+
defaultValue: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: boolean;
|
|
19
|
+
};
|
|
20
|
+
disabled: {
|
|
21
|
+
type: BooleanConstructor;
|
|
22
|
+
default: boolean;
|
|
23
|
+
};
|
|
24
|
+
readonly: {
|
|
25
|
+
type: BooleanConstructor;
|
|
26
|
+
default: boolean;
|
|
27
|
+
};
|
|
28
|
+
name: {
|
|
29
|
+
type: StringConstructor;
|
|
30
|
+
default: undefined;
|
|
31
|
+
};
|
|
32
|
+
value: {
|
|
33
|
+
type: StringConstructor;
|
|
34
|
+
default: string;
|
|
35
|
+
};
|
|
36
|
+
form: {
|
|
37
|
+
type: StringConstructor;
|
|
38
|
+
default: undefined;
|
|
39
|
+
};
|
|
40
|
+
size: {
|
|
41
|
+
type: PropType<GhostSwitchSize>;
|
|
42
|
+
default: string;
|
|
43
|
+
};
|
|
44
|
+
tone: {
|
|
45
|
+
type: PropType<GhostSwitchTone>;
|
|
46
|
+
default: string;
|
|
47
|
+
};
|
|
48
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
49
|
+
[key: string]: any;
|
|
50
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
51
|
+
'update:modelValue': (checked: boolean) => boolean;
|
|
52
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
53
|
+
modelValue: {
|
|
54
|
+
type: PropType<boolean | undefined>;
|
|
55
|
+
default: undefined;
|
|
56
|
+
};
|
|
57
|
+
defaultValue: {
|
|
58
|
+
type: BooleanConstructor;
|
|
59
|
+
default: boolean;
|
|
60
|
+
};
|
|
61
|
+
disabled: {
|
|
62
|
+
type: BooleanConstructor;
|
|
63
|
+
default: boolean;
|
|
64
|
+
};
|
|
65
|
+
readonly: {
|
|
66
|
+
type: BooleanConstructor;
|
|
67
|
+
default: boolean;
|
|
68
|
+
};
|
|
69
|
+
name: {
|
|
70
|
+
type: StringConstructor;
|
|
71
|
+
default: undefined;
|
|
72
|
+
};
|
|
73
|
+
value: {
|
|
74
|
+
type: StringConstructor;
|
|
75
|
+
default: string;
|
|
76
|
+
};
|
|
77
|
+
form: {
|
|
78
|
+
type: StringConstructor;
|
|
79
|
+
default: undefined;
|
|
80
|
+
};
|
|
81
|
+
size: {
|
|
82
|
+
type: PropType<GhostSwitchSize>;
|
|
83
|
+
default: string;
|
|
84
|
+
};
|
|
85
|
+
tone: {
|
|
86
|
+
type: PropType<GhostSwitchTone>;
|
|
87
|
+
default: string;
|
|
88
|
+
};
|
|
89
|
+
}>> & Readonly<{
|
|
90
|
+
"onUpdate:modelValue"?: (checked: boolean) => any;
|
|
91
|
+
}>, {
|
|
92
|
+
name: string;
|
|
93
|
+
form: string;
|
|
94
|
+
size: GhostSwitchSize;
|
|
95
|
+
value: string;
|
|
96
|
+
disabled: boolean;
|
|
97
|
+
modelValue: boolean | undefined;
|
|
98
|
+
defaultValue: boolean;
|
|
99
|
+
tone: GhostSwitchTone;
|
|
100
|
+
readonly: boolean;
|
|
101
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
102
|
+
export type { GhostSwitchExposed };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { defineComponent, h, ref } from 'vue';
|
|
2
|
+
import { GhostSwitch as GhostUnstyledSwitch, } from '@ghostvue/vue';
|
|
3
|
+
/**
|
|
4
|
+
* Themed wrapper: visual props as `data-*`, instance-scoped CSS. Behavior stays
|
|
5
|
+
* on the unstyled primitive; native attrs fall through.
|
|
6
|
+
*/
|
|
7
|
+
export const GhostSwitch = defineComponent({
|
|
8
|
+
name: 'GhostSwitch',
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
props: {
|
|
11
|
+
modelValue: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: undefined,
|
|
14
|
+
},
|
|
15
|
+
defaultValue: { type: Boolean, default: false },
|
|
16
|
+
disabled: { type: Boolean, default: false },
|
|
17
|
+
readonly: { type: Boolean, default: false },
|
|
18
|
+
name: { type: String, default: undefined },
|
|
19
|
+
value: { type: String, default: 'on' },
|
|
20
|
+
form: { type: String, default: undefined },
|
|
21
|
+
size: { type: String, default: 'md' },
|
|
22
|
+
tone: { type: String, default: 'accent' },
|
|
23
|
+
},
|
|
24
|
+
emits: {
|
|
25
|
+
'update:modelValue': (checked) => typeof checked === 'boolean',
|
|
26
|
+
},
|
|
27
|
+
setup(props, { attrs, emit, slots, expose }) {
|
|
28
|
+
const inner = ref(null);
|
|
29
|
+
expose({
|
|
30
|
+
get element() {
|
|
31
|
+
return inner.value?.element ?? null;
|
|
32
|
+
},
|
|
33
|
+
get checked() {
|
|
34
|
+
return inner.value?.checked ?? false;
|
|
35
|
+
},
|
|
36
|
+
toggle() {
|
|
37
|
+
inner.value?.toggle();
|
|
38
|
+
},
|
|
39
|
+
focus(options) {
|
|
40
|
+
inner.value?.focus(options);
|
|
41
|
+
},
|
|
42
|
+
blur() {
|
|
43
|
+
inner.value?.blur();
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
return () => h('span', { class: 'ghost-themed-scope' }, [
|
|
47
|
+
h(GhostUnstyledSwitch, {
|
|
48
|
+
...attrs,
|
|
49
|
+
ref: inner,
|
|
50
|
+
...(props.modelValue === undefined
|
|
51
|
+
? {}
|
|
52
|
+
: { modelValue: props.modelValue }),
|
|
53
|
+
defaultValue: props.defaultValue,
|
|
54
|
+
disabled: props.disabled,
|
|
55
|
+
readonly: props.readonly,
|
|
56
|
+
...(props.name ? { name: props.name } : {}),
|
|
57
|
+
value: props.value,
|
|
58
|
+
...(props.form ? { form: props.form } : {}),
|
|
59
|
+
// CSS treats missing attributes as the defaults (md / accent).
|
|
60
|
+
'data-size': props.size === 'md' ? undefined : props.size,
|
|
61
|
+
'data-tone': props.tone === 'accent' ? undefined : props.tone,
|
|
62
|
+
'onUpdate:modelValue': (next) => {
|
|
63
|
+
emit('update:modelValue', next);
|
|
64
|
+
},
|
|
65
|
+
}, slots),
|
|
66
|
+
]);
|
|
67
|
+
},
|
|
68
|
+
});
|