@humanonlyweb/ui 0.2.0 → 0.2.1
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/dist/components/toggle/Toggle.js +42 -0
- package/dist/components/toggle/Toggle.vue.d.ts +30 -0
- package/dist/components/toggle-group/ToggleGroup.js +98 -0
- package/dist/components/toggle-group/ToggleGroup.vue.d.ts +41 -0
- package/dist/docs/README.md +2 -0
- package/dist/docs/changelog.md +4 -0
- package/dist/docs/components/toggle-group.md +125 -0
- package/dist/docs/components/toggle.md +81 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.js +6 -4
- package/dist/nuxt/module.d.ts +1 -1
- package/dist/nuxt/module.js +2 -0
- package/dist/package.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createElementBlock, defineComponent, mergeModels, openBlock, renderSlot, useModel } from "vue";
|
|
2
|
+
//#region src/components/toggle/Toggle.vue
|
|
3
|
+
const _hoisted_1 = [
|
|
4
|
+
"data-toggle-pressed",
|
|
5
|
+
"aria-pressed",
|
|
6
|
+
"disabled",
|
|
7
|
+
"aria-label"
|
|
8
|
+
];
|
|
9
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
10
|
+
__name: "Toggle",
|
|
11
|
+
props: /*@__PURE__*/ mergeModels({
|
|
12
|
+
disabled: {
|
|
13
|
+
type: Boolean,
|
|
14
|
+
default: false
|
|
15
|
+
},
|
|
16
|
+
label: {}
|
|
17
|
+
}, {
|
|
18
|
+
"modelValue": {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: false
|
|
21
|
+
},
|
|
22
|
+
"modelModifiers": {}
|
|
23
|
+
}),
|
|
24
|
+
emits: ["update:modelValue"],
|
|
25
|
+
setup(__props) {
|
|
26
|
+
/** Whether the button is pressed. */
|
|
27
|
+
const model = useModel(__props, "modelValue");
|
|
28
|
+
return (_ctx, _cache) => {
|
|
29
|
+
return openBlock(), createElementBlock("button", {
|
|
30
|
+
type: "button",
|
|
31
|
+
"data-part": "toggle",
|
|
32
|
+
"data-toggle-pressed": model.value || void 0,
|
|
33
|
+
"aria-pressed": model.value,
|
|
34
|
+
disabled: __props.disabled,
|
|
35
|
+
"aria-label": __props.label,
|
|
36
|
+
onClick: _cache[0] || (_cache[0] = ($event) => model.value = !model.value)
|
|
37
|
+
}, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_1);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
//#endregion
|
|
42
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/components/toggle/Toggle.vue.d.ts
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** Disables the toggle. */
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
/** Accessible name when the content is only an icon; otherwise the slot content names it. */
|
|
6
|
+
label?: string;
|
|
7
|
+
};
|
|
8
|
+
type __VLS_Slots = {
|
|
9
|
+
/** The button content. */
|
|
10
|
+
default?(): unknown;
|
|
11
|
+
};
|
|
12
|
+
type __VLS_ModelProps = {
|
|
13
|
+
/** Whether the button is pressed. */
|
|
14
|
+
modelValue?: boolean;
|
|
15
|
+
};
|
|
16
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
17
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
+
"update:modelValue": (value: boolean) => any;
|
|
19
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
20
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
21
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
25
|
+
new (): {
|
|
26
|
+
$slots: S;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
export { _default as default };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import _sfc_main$1 from "../toggle/Toggle.js";
|
|
2
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createTextVNode, defineComponent, mergeModels, openBlock, renderList, renderSlot, toDisplayString, useModel, withCtx } from "vue";
|
|
3
|
+
//#region src/components/toggle-group/ToggleGroup.vue
|
|
4
|
+
const _hoisted_1 = [
|
|
5
|
+
"aria-label",
|
|
6
|
+
"data-orientation",
|
|
7
|
+
"data-field-name",
|
|
8
|
+
"data-toggle-group-disabled"
|
|
9
|
+
];
|
|
10
|
+
const _hoisted_2 = ["name", "value"];
|
|
11
|
+
const _hoisted_3 = ["name", "value"];
|
|
12
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
13
|
+
__name: "ToggleGroup",
|
|
14
|
+
props: /*@__PURE__*/ mergeModels({
|
|
15
|
+
options: { default: () => [] },
|
|
16
|
+
label: {},
|
|
17
|
+
multiple: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false
|
|
20
|
+
},
|
|
21
|
+
orientation: { default: "horizontal" },
|
|
22
|
+
disabled: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: false
|
|
25
|
+
},
|
|
26
|
+
name: {}
|
|
27
|
+
}, {
|
|
28
|
+
"modelValue": {},
|
|
29
|
+
"modelModifiers": {}
|
|
30
|
+
}),
|
|
31
|
+
emits: ["update:modelValue"],
|
|
32
|
+
setup(__props) {
|
|
33
|
+
/** The pressed value; with `multiple`, an array of pressed values. */
|
|
34
|
+
const model = useModel(__props, "modelValue");
|
|
35
|
+
const singleValue = computed(() => Array.isArray(model.value) ? void 0 : model.value);
|
|
36
|
+
const pressedValues = computed(() => {
|
|
37
|
+
if (__props.multiple) return Array.isArray(model.value) ? model.value : [];
|
|
38
|
+
return singleValue.value == null ? [] : [singleValue.value];
|
|
39
|
+
});
|
|
40
|
+
const pressed = computed(() => new Set(pressedValues.value));
|
|
41
|
+
const isPressed = (value) => pressed.value.has(value);
|
|
42
|
+
function toggle(value, on) {
|
|
43
|
+
if (!__props.multiple) {
|
|
44
|
+
if (on) model.value = value;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const values = new Set(pressedValues.value);
|
|
48
|
+
if (on) values.add(value);
|
|
49
|
+
else values.delete(value);
|
|
50
|
+
model.value = __props.options.filter((option) => values.has(option.value)).map((option) => option.value);
|
|
51
|
+
}
|
|
52
|
+
return (_ctx, _cache) => {
|
|
53
|
+
return openBlock(), createElementBlock("div", {
|
|
54
|
+
"data-part": "toggle-group",
|
|
55
|
+
role: "group",
|
|
56
|
+
"aria-label": __props.label,
|
|
57
|
+
"data-orientation": __props.orientation,
|
|
58
|
+
"data-field-name": __props.name,
|
|
59
|
+
"data-toggle-group-disabled": __props.disabled || void 0
|
|
60
|
+
}, [
|
|
61
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
|
|
62
|
+
return openBlock(), createBlock(_sfc_main$1, {
|
|
63
|
+
key: option.value,
|
|
64
|
+
"model-value": isPressed(option.value),
|
|
65
|
+
disabled: __props.disabled || option.disabled,
|
|
66
|
+
"onUpdate:modelValue": (on) => toggle(option.value, on)
|
|
67
|
+
}, {
|
|
68
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "option", {
|
|
69
|
+
option,
|
|
70
|
+
pressed: isPressed(option.value)
|
|
71
|
+
}, () => [createTextVNode(toDisplayString(option.label), 1)])]),
|
|
72
|
+
_: 2
|
|
73
|
+
}, 1032, [
|
|
74
|
+
"model-value",
|
|
75
|
+
"disabled",
|
|
76
|
+
"onUpdate:modelValue"
|
|
77
|
+
]);
|
|
78
|
+
}), 128)),
|
|
79
|
+
createCommentVNode(" The toggles are buttons, which don't submit values; hidden inputs do. "),
|
|
80
|
+
__props.name ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [__props.multiple ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(pressedValues.value, (value) => {
|
|
81
|
+
return openBlock(), createElementBlock("input", {
|
|
82
|
+
key: value,
|
|
83
|
+
type: "hidden",
|
|
84
|
+
name: __props.name,
|
|
85
|
+
value
|
|
86
|
+
}, null, 8, _hoisted_2);
|
|
87
|
+
}), 128)) : singleValue.value != null ? (openBlock(), createElementBlock("input", {
|
|
88
|
+
key: 1,
|
|
89
|
+
type: "hidden",
|
|
90
|
+
name: __props.name,
|
|
91
|
+
value: singleValue.value
|
|
92
|
+
}, null, 8, _hoisted_3)) : createCommentVNode("v-if", true)], 64)) : createCommentVNode("v-if", true)
|
|
93
|
+
], 8, _hoisted_1);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
//#endregion
|
|
98
|
+
export { _sfc_main as default };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SelectOption, SelectValue } from "../../types.js";
|
|
2
|
+
//#region src/components/toggle-group/ToggleGroup.vue.d.ts
|
|
3
|
+
declare const __VLS_export: <T extends SelectValue>(__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
|
+
/** Toggles to render, in order. */
|
|
6
|
+
options?: SelectOption<T>[];
|
|
7
|
+
/** Accessible name for the group. */
|
|
8
|
+
label?: string;
|
|
9
|
+
/** Allow several options pressed at once; the model is then an array. */
|
|
10
|
+
multiple?: boolean;
|
|
11
|
+
/** Layout hook, exposed as `data-orientation`. */
|
|
12
|
+
orientation?: "horizontal" | "vertical";
|
|
13
|
+
/** Disables every toggle. */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Form field name: submits the pressed value with a native form, via hidden inputs. */
|
|
16
|
+
name?: string;
|
|
17
|
+
} & {
|
|
18
|
+
/** The pressed value; with `multiple`, an array of pressed values. */
|
|
19
|
+
modelValue?: T | T[];
|
|
20
|
+
}) & {
|
|
21
|
+
"onUpdate:modelValue"?: ((value: T | T[] | undefined) => any) | undefined;
|
|
22
|
+
}> & (typeof globalThis extends {
|
|
23
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
24
|
+
} ? P : {});
|
|
25
|
+
expose: (exposed: {}) => void;
|
|
26
|
+
attrs: any;
|
|
27
|
+
slots: {
|
|
28
|
+
/** Toggle content, replacing the label, e.g. an icon. */
|
|
29
|
+
option?(props: {
|
|
30
|
+
option: SelectOption<T>;
|
|
31
|
+
pressed: boolean;
|
|
32
|
+
}): unknown;
|
|
33
|
+
};
|
|
34
|
+
emit: (event: "update:modelValue", value: T | T[] | undefined) => void;
|
|
35
|
+
}>) => import("vue").VNode & {
|
|
36
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
37
|
+
};
|
|
38
|
+
declare const _default: typeof __VLS_export;
|
|
39
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};
|
|
40
|
+
//#endregion
|
|
41
|
+
export { _default as default };
|
package/dist/docs/README.md
CHANGED
|
@@ -47,6 +47,8 @@
|
|
|
47
47
|
- [Tag Input](./components/tag-input.md): Free-form tags typed as chips.
|
|
48
48
|
- [Textarea](./components/textarea.md): A multi-line input with an optional character limit.
|
|
49
49
|
- [Toast](./components/toast.md): Temporary notifications.
|
|
50
|
+
- [Toggle](./components/toggle.md): A button that stays pressed.
|
|
51
|
+
- [Toggle Group](./components/toggle-group.md): A set of toggles, single or multiple.
|
|
50
52
|
- [Toolbar](./components/toolbar.md): A row of controls with a single tab stop.
|
|
51
53
|
- [Tooltip](./components/tooltip.md): A short label shown on hover and focus.
|
|
52
54
|
- [Visually Hidden](./components/visually-hidden.md): Text for assistive technology only.
|
package/dist/docs/changelog.md
CHANGED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# Toggle Group
|
|
2
|
+
|
|
3
|
+
> A set of toggles, single or multiple.
|
|
4
|
+
|
|
5
|
+
## Examples
|
|
6
|
+
|
|
7
|
+
### Basic
|
|
8
|
+
|
|
9
|
+
With `multiple`, each toggle is independent and the model is an array of the pressed values, kept in `options` order.
|
|
10
|
+
|
|
11
|
+
```vue
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
const styles = ref<string[]>(["bold"]);
|
|
14
|
+
const options = [
|
|
15
|
+
{ label: "Bold", value: "bold" },
|
|
16
|
+
{ label: "Italic", value: "italic" },
|
|
17
|
+
{ label: "Underline", value: "underline" },
|
|
18
|
+
];
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<div class="demo-stack">
|
|
23
|
+
<UiToggleGroup v-model="styles" :options="options" multiple label="Text style" />
|
|
24
|
+
<p class="demo-note">Pressed: {{ styles.join(", ") || "none" }}</p>
|
|
25
|
+
</div>
|
|
26
|
+
</template>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Single
|
|
30
|
+
|
|
31
|
+
Without `multiple`, at most one option is pressed. Pressing the pressed option again keeps it pressed.
|
|
32
|
+
|
|
33
|
+
```vue
|
|
34
|
+
<script setup lang="ts">
|
|
35
|
+
const alignment = ref("left");
|
|
36
|
+
const options = [
|
|
37
|
+
{ label: "Left", value: "left" },
|
|
38
|
+
{ label: "Center", value: "center" },
|
|
39
|
+
{ label: "Right", value: "right" },
|
|
40
|
+
];
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<UiToggleGroup v-model="alignment" :options="options" label="Alignment" />
|
|
45
|
+
</template>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Disabled
|
|
49
|
+
|
|
50
|
+
`disabled` disables every toggle; `option.disabled` disables just one.
|
|
51
|
+
|
|
52
|
+
```vue
|
|
53
|
+
<script setup lang="ts">
|
|
54
|
+
const alignment = ref("center");
|
|
55
|
+
const options = [
|
|
56
|
+
{ label: "Left", value: "left" },
|
|
57
|
+
{ label: "Center", value: "center" },
|
|
58
|
+
{ label: "Right", value: "right" },
|
|
59
|
+
];
|
|
60
|
+
const someDisabled = [
|
|
61
|
+
{ label: "Left", value: "left" },
|
|
62
|
+
{ label: "Center", value: "center", disabled: true },
|
|
63
|
+
{ label: "Right", value: "right" },
|
|
64
|
+
];
|
|
65
|
+
</script>
|
|
66
|
+
|
|
67
|
+
<template>
|
|
68
|
+
<div class="demo-stack">
|
|
69
|
+
<UiToggleGroup v-model="alignment" :options="options" label="Alignment" disabled />
|
|
70
|
+
<UiToggleGroup v-model="alignment" :options="someDisabled" label="Alignment, one unavailable" />
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## API
|
|
76
|
+
|
|
77
|
+
| Prop | Type | Default | Description |
|
|
78
|
+
| --- | --- | --- | --- |
|
|
79
|
+
| `options` | `SelectOption<T>[]` | `[]` | Toggles to render, in order. |
|
|
80
|
+
| `label` | `string` | — | Accessible name for the group. |
|
|
81
|
+
| `multiple` | `boolean` | `false` | Allow several options pressed at once; the model is then an array. |
|
|
82
|
+
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Layout hook, exposed as `data-orientation`. |
|
|
83
|
+
| `disabled` | `boolean` | `false` | Disables every toggle. |
|
|
84
|
+
| `name` | `string` | — | Form field name: submits the pressed value with a native form, via hidden inputs. |
|
|
85
|
+
| `modelValue` | `T \| T[]` | — | The pressed value; with `multiple`, an array of pressed values. |
|
|
86
|
+
|
|
87
|
+
| Event | Payload | Description |
|
|
88
|
+
| --- | --- | --- |
|
|
89
|
+
| `update:modelValue` | `[value: T \| T[] \| undefined]` | `v-model:modelValue` update. |
|
|
90
|
+
|
|
91
|
+
| Slot | Props | Description |
|
|
92
|
+
| --- | --- | --- |
|
|
93
|
+
| `option` | `{ option: SelectOption<T>; pressed: boolean; }` | Toggle content, replacing the label, e.g. an icon. |
|
|
94
|
+
|
|
95
|
+
Types:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
export interface SelectOption<T extends SelectValue = SelectValue> {
|
|
99
|
+
label: string;
|
|
100
|
+
value: T;
|
|
101
|
+
disabled?: boolean;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type SelectValue = string | number;
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Styling
|
|
108
|
+
|
|
109
|
+
`orientation` is a layout hook, exposed as `data-orientation`.
|
|
110
|
+
|
|
111
|
+
- Parts (`[data-part="…"]`): `toggle-group`, `toggle`
|
|
112
|
+
- State attributes: `data-orientation`, `data-field-name`, `data-toggle-group-disabled`, `data-toggle-pressed`
|
|
113
|
+
|
|
114
|
+
## Keyboard
|
|
115
|
+
|
|
116
|
+
| Keys | Action |
|
|
117
|
+
| ----------------- | ------------------------- |
|
|
118
|
+
| `Tab` | Move between the toggles |
|
|
119
|
+
| `Space` / `Enter` | Toggle the focused option |
|
|
120
|
+
|
|
121
|
+
## Accessibility
|
|
122
|
+
|
|
123
|
+
- The toggles sit in a `role="group"` named by `label`.
|
|
124
|
+
- Each option is a native `<button>` with `aria-pressed`, so its state is announced with its name.
|
|
125
|
+
- With `multiple`, the toggles are independent; without it, pressing one releases the others.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Toggle
|
|
2
|
+
|
|
3
|
+
> A button that stays pressed.
|
|
4
|
+
|
|
5
|
+
## Examples
|
|
6
|
+
|
|
7
|
+
### Basic
|
|
8
|
+
|
|
9
|
+
`v-model` is the pressed state; `aria-pressed` keeps assistive tech in sync.
|
|
10
|
+
|
|
11
|
+
```vue
|
|
12
|
+
<script setup lang="ts">
|
|
13
|
+
const bold = ref(false);
|
|
14
|
+
const muted = ref(true);
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<div class="demo-stack">
|
|
19
|
+
<div class="demo-row">
|
|
20
|
+
<UiToggle v-model="bold">
|
|
21
|
+
<Icon name="bold" :size="14" />
|
|
22
|
+
<span>Bold</span>
|
|
23
|
+
</UiToggle>
|
|
24
|
+
<UiToggle v-model="muted">Mute</UiToggle>
|
|
25
|
+
</div>
|
|
26
|
+
<p class="demo-note">
|
|
27
|
+
Bold: {{ bold ? "pressed" : "not pressed" }} · Mute: {{ muted ? "pressed" : "not pressed" }}
|
|
28
|
+
</p>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Disabled
|
|
34
|
+
|
|
35
|
+
A disabled toggle is a native disabled button: it can't be clicked, pressed or focused.
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<script setup lang="ts">
|
|
39
|
+
const bold = ref(false);
|
|
40
|
+
const italic = ref(true);
|
|
41
|
+
</script>
|
|
42
|
+
|
|
43
|
+
<template>
|
|
44
|
+
<div class="demo-row">
|
|
45
|
+
<UiToggle v-model="bold" disabled>Bold</UiToggle>
|
|
46
|
+
<UiToggle v-model="italic" disabled>Italic</UiToggle>
|
|
47
|
+
</div>
|
|
48
|
+
</template>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## API
|
|
52
|
+
|
|
53
|
+
| Prop | Type | Default | Description |
|
|
54
|
+
| --- | --- | --- | --- |
|
|
55
|
+
| `disabled` | `boolean` | `false` | Disables the toggle. |
|
|
56
|
+
| `label` | `string` | — | Accessible name when the content is only an icon; otherwise the slot content names it. |
|
|
57
|
+
| `modelValue` | `boolean` | `false` | Whether the button is pressed. |
|
|
58
|
+
|
|
59
|
+
| Event | Payload | Description |
|
|
60
|
+
| --- | --- | --- |
|
|
61
|
+
| `update:modelValue` | `[value: boolean]` | `v-model:modelValue` update. |
|
|
62
|
+
|
|
63
|
+
| Slot | Props | Description |
|
|
64
|
+
| --- | --- | --- |
|
|
65
|
+
| `default` | — | The button content. |
|
|
66
|
+
|
|
67
|
+
## Styling
|
|
68
|
+
|
|
69
|
+
- Parts (`[data-part="…"]`): `toggle`
|
|
70
|
+
- State attributes: `data-toggle-pressed`
|
|
71
|
+
|
|
72
|
+
## Keyboard
|
|
73
|
+
|
|
74
|
+
| Keys | Action |
|
|
75
|
+
| ----------------- | --------- |
|
|
76
|
+
| `Space` / `Enter` | Toggle it |
|
|
77
|
+
|
|
78
|
+
## Accessibility
|
|
79
|
+
|
|
80
|
+
- It's a native `<button>` with `aria-pressed`, so it's focusable and announces its state.
|
|
81
|
+
- The slot content names the button; give an icon-only toggle a `label`.
|
package/dist/index.d.ts
CHANGED
|
@@ -35,9 +35,11 @@ import _default$31 from "./components/tag-input/TagInput.vue.js";
|
|
|
35
35
|
import _default$32 from "./components/textarea/Textarea.vue.js";
|
|
36
36
|
import _default$33 from "./components/toast/ToastItem.vue.js";
|
|
37
37
|
import _default$34 from "./components/toast/ToastViewport.vue.js";
|
|
38
|
-
import _default$35 from "./components/
|
|
39
|
-
import _default$36 from "./components/
|
|
40
|
-
import _default$37 from "./components/
|
|
38
|
+
import _default$35 from "./components/toggle/Toggle.vue.js";
|
|
39
|
+
import _default$36 from "./components/toggle-group/ToggleGroup.vue.js";
|
|
40
|
+
import _default$37 from "./components/toolbar/Toolbar.vue.js";
|
|
41
|
+
import _default$38 from "./components/tooltip/Tooltip.vue.js";
|
|
42
|
+
import _default$39 from "./components/visually-hidden/VisuallyHidden.vue.js";
|
|
41
43
|
import { UiTranslations, UiTranslationsInput, defaultTranslations } from "./translations.js";
|
|
42
44
|
import { UI_CONFIG_KEY, UiConfig, UiOptions, createUi, useTranslations, useUiConfig } from "./config.js";
|
|
43
45
|
import { ACCORDION_KEY, AccordionContext, useAccordionItem } from "./composables/use-accordion.js";
|
|
@@ -57,4 +59,4 @@ declare module "vue" {
|
|
|
57
59
|
function initDirectivesForSSR(): void;
|
|
58
60
|
}
|
|
59
61
|
//#endregion
|
|
60
|
-
export { ACCORDION_KEY, _default as Accordion, type AccordionContext, _default$1 as AccordionItem, _default$2 as Avatar, _default$3 as AvatarGroup, type AvatarItem, type AvatarSize, type BreadcrumbItem, _default$4 as Breadcrumbs, _default$5 as Button, type ButtonSize, type ButtonType, type ButtonVariant, _default$6 as Checkbox, _default$7 as CheckboxGroup, _default$8 as Combobox, type ComboboxFilter, _default$9 as ConfirmDialog, _default$10 as ContextMenu, _default$11 as Dialog, type FieldSource, _default$12 as Fieldset, type FormErrors, type FormValues, _default$13 as IconButton, _default$14 as Input, _default$15 as Kbd, type KeyCap, type LinkTarget, type LinkTo, _default$16 as Menu, type MenuEntry, type MenuItem, type MenuSeparator, _default$17 as OtpInput, _default$18 as Pagination, _default$19 as PasswordInput, type Platform, _default$20 as Popover, _default$21 as Progress, _default$22 as RadioGroup, _default$23 as Segmented, _default$24 as Select, type SelectOption, type SelectValue, _default$25 as Slider, _default$26 as SpinButton, _default$27 as SplitButton, type StandardSchemaV1, _default$28 as Switch, TOASTER_KEY, _default$29 as Table, type TableColumn, type TableSort, _default$30 as Tabs, _default$31 as TagInput, _default$32 as Textarea, type Toast, type ToastAction, _default$33 as ToastItem, type ToastOptions, type ToastTone, _default$34 as ToastViewport, type Toaster, _default$35 as
|
|
62
|
+
export { ACCORDION_KEY, _default as Accordion, type AccordionContext, _default$1 as AccordionItem, _default$2 as Avatar, _default$3 as AvatarGroup, type AvatarItem, type AvatarSize, type BreadcrumbItem, _default$4 as Breadcrumbs, _default$5 as Button, type ButtonSize, type ButtonType, type ButtonVariant, _default$6 as Checkbox, _default$7 as CheckboxGroup, _default$8 as Combobox, type ComboboxFilter, _default$9 as ConfirmDialog, _default$10 as ContextMenu, _default$11 as Dialog, type FieldSource, _default$12 as Fieldset, type FormErrors, type FormValues, _default$13 as IconButton, _default$14 as Input, _default$15 as Kbd, type KeyCap, type LinkTarget, type LinkTo, _default$16 as Menu, type MenuEntry, type MenuItem, type MenuSeparator, _default$17 as OtpInput, _default$18 as Pagination, _default$19 as PasswordInput, type Platform, _default$20 as Popover, _default$21 as Progress, _default$22 as RadioGroup, _default$23 as Segmented, _default$24 as Select, type SelectOption, type SelectValue, _default$25 as Slider, _default$26 as SpinButton, _default$27 as SplitButton, type StandardSchemaV1, _default$28 as Switch, TOASTER_KEY, _default$29 as Table, type TableColumn, type TableSort, _default$30 as Tabs, _default$31 as TagInput, _default$32 as Textarea, type Toast, type ToastAction, _default$33 as ToastItem, type ToastOptions, type ToastTone, _default$34 as ToastViewport, type Toaster, _default$35 as Toggle, _default$36 as ToggleGroup, _default$37 as Toolbar, _default$38 as Tooltip, UI_CONFIG_KEY, type UiConfig, type UiOptions, type UiTranslations, type UiTranslationsInput, type UseFormOptions, _default$39 as VisuallyHidden, 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
CHANGED
|
@@ -45,12 +45,14 @@ import _sfc_main$31 from "./components/tag-input/TagInput.js";
|
|
|
45
45
|
import _sfc_main$32 from "./components/textarea/Textarea.js";
|
|
46
46
|
import _sfc_main$33 from "./components/toast/ToastItem.js";
|
|
47
47
|
import _sfc_main$34 from "./components/toast/ToastViewport.js";
|
|
48
|
-
import _sfc_main$35 from "./components/
|
|
49
|
-
import _sfc_main$36 from "./components/
|
|
50
|
-
import _sfc_main$37 from "./components/
|
|
48
|
+
import _sfc_main$35 from "./components/toggle/Toggle.js";
|
|
49
|
+
import _sfc_main$36 from "./components/toggle-group/ToggleGroup.js";
|
|
50
|
+
import _sfc_main$37 from "./components/toolbar/Toolbar.js";
|
|
51
|
+
import _sfc_main$38 from "./components/tooltip/Tooltip.js";
|
|
52
|
+
import _sfc_main$39 from "./components/visually-hidden/VisuallyHidden.js";
|
|
51
53
|
import { useForm } from "./composables/use-form.js";
|
|
52
54
|
import { initDirectivesForSSR } from "vue";
|
|
53
55
|
//#region src/index.ts
|
|
54
56
|
initDirectivesForSSR();
|
|
55
57
|
//#endregion
|
|
56
|
-
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 Breadcrumbs, _sfc_main$5 as Button, _sfc_main$6 as Checkbox, _sfc_main$7 as CheckboxGroup, _sfc_main$8 as Combobox, _sfc_main$9 as ConfirmDialog, _sfc_main$10 as ContextMenu, _sfc_main$11 as Dialog, _sfc_main$12 as Fieldset, _sfc_main$13 as IconButton, _sfc_main$14 as Input, _sfc_main$15 as Kbd, _sfc_main$16 as Menu, _sfc_main$17 as OtpInput, _sfc_main$18 as Pagination, _sfc_main$19 as PasswordInput, _sfc_main$20 as Popover, _sfc_main$21 as Progress, _sfc_main$22 as RadioGroup, _sfc_main$23 as Segmented, _sfc_main$24 as Select, _sfc_main$25 as Slider, _sfc_main$26 as SpinButton, _sfc_main$27 as SplitButton, _sfc_main$28 as Switch, TOASTER_KEY, _sfc_main$29 as Table, _sfc_main$30 as Tabs, _sfc_main$31 as TagInput, _sfc_main$32 as Textarea, _sfc_main$33 as ToastItem, _sfc_main$34 as ToastViewport, _sfc_main$35 as
|
|
58
|
+
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 Breadcrumbs, _sfc_main$5 as Button, _sfc_main$6 as Checkbox, _sfc_main$7 as CheckboxGroup, _sfc_main$8 as Combobox, _sfc_main$9 as ConfirmDialog, _sfc_main$10 as ContextMenu, _sfc_main$11 as Dialog, _sfc_main$12 as Fieldset, _sfc_main$13 as IconButton, _sfc_main$14 as Input, _sfc_main$15 as Kbd, _sfc_main$16 as Menu, _sfc_main$17 as OtpInput, _sfc_main$18 as Pagination, _sfc_main$19 as PasswordInput, _sfc_main$20 as Popover, _sfc_main$21 as Progress, _sfc_main$22 as RadioGroup, _sfc_main$23 as Segmented, _sfc_main$24 as Select, _sfc_main$25 as Slider, _sfc_main$26 as SpinButton, _sfc_main$27 as SplitButton, _sfc_main$28 as Switch, TOASTER_KEY, _sfc_main$29 as Table, _sfc_main$30 as Tabs, _sfc_main$31 as TagInput, _sfc_main$32 as Textarea, _sfc_main$33 as ToastItem, _sfc_main$34 as ToastViewport, _sfc_main$35 as Toggle, _sfc_main$36 as ToggleGroup, _sfc_main$37 as Toolbar, _sfc_main$38 as Tooltip, UI_CONFIG_KEY, _sfc_main$39 as VisuallyHidden, createToaster, createUi, defaultTranslations, firstFocusable, isMenuSeparator, parseChord, platformFrom, useAccordionItem, useAnchor, useCombobox, useField, useForm, useMenu, usePlatform, usePopoverState, useRovingSelection, useSelect, useSlideIndicator, useToast, useTranslations, useUiConfig };
|
package/dist/nuxt/module.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/nuxt/module.d.ts
|
|
2
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", "Breadcrumbs", "Button", "Checkbox", "CheckboxGroup", "Combobox", "ConfirmDialog", "ContextMenu", "Dialog", "Fieldset", "IconButton", "Input", "Kbd", "Menu", "OtpInput", "Pagination", "PasswordInput", "Popover", "Progress", "RadioGroup", "Segmented", "Select", "Slider", "SpinButton", "SplitButton", "Switch", "Table", "Tabs", "TagInput", "Textarea", "ToastItem", "ToastViewport", "Toolbar", "Tooltip", "VisuallyHidden"];
|
|
3
|
+
export declare const COMPONENTS: readonly ["Accordion", "AccordionItem", "Avatar", "AvatarGroup", "Breadcrumbs", "Button", "Checkbox", "CheckboxGroup", "Combobox", "ConfirmDialog", "ContextMenu", "Dialog", "Fieldset", "IconButton", "Input", "Kbd", "Menu", "OtpInput", "Pagination", "PasswordInput", "Popover", "Progress", "RadioGroup", "Segmented", "Select", "Slider", "SpinButton", "SplitButton", "Switch", "Table", "Tabs", "TagInput", "Textarea", "ToastItem", "ToastViewport", "Toggle", "ToggleGroup", "Toolbar", "Tooltip", "VisuallyHidden"];
|
|
4
4
|
export declare const COMPOSABLES: readonly ["useField", "useForm", "useToast"];
|
|
5
5
|
export interface ModuleOptions {
|
|
6
6
|
/** Auto-imported component prefix: `Ui` gives `<UiButton>`. */
|
package/dist/nuxt/module.js
CHANGED
package/dist/package.js
CHANGED