@xds/vue 1.0.1 → 1.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/dist/Banner.vue_vue_type_script_setup_true_lang.js +4 -2
- package/dist/Button.vue.d.ts +9 -1
- package/dist/Button.vue_vue_type_script_setup_true_lang.js +18 -5
- package/dist/Checkbox.vue.d.ts +13 -10
- package/dist/Checkbox.vue_vue_type_script_setup_true_lang.js +32 -20
- package/dist/DatePicker.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/DateRangePicker.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/Dialog.vue.d.ts +5 -2
- package/dist/Dialog.vue_vue_type_script_setup_true_lang.js +6 -5
- package/dist/IconButton.vue.d.ts +9 -1
- package/dist/IconButton.vue_vue_type_script_setup_true_lang.js +18 -5
- package/dist/Labels.vue.d.ts +17 -0
- package/dist/Labels.vue_vue_type_script_setup_true_lang.js +14 -0
- package/dist/Labels2.js +4 -0
- package/dist/Menu.vue.d.ts +4 -1
- package/dist/Menu.vue_vue_type_script_setup_true_lang.js +5 -4
- package/dist/RadioGroup.vue_vue_type_script_setup_true_lang.js +13 -7
- package/dist/SearchField.vue.d.ts +11 -8
- package/dist/SearchField.vue_vue_type_script_setup_true_lang.js +40 -22
- package/dist/SegmentedControl.vue.d.ts +3 -7
- package/dist/SegmentedControl.vue_vue_type_script_setup_true_lang.js +13 -14
- package/dist/Select.vue_vue_type_script_setup_true_lang.js +7 -2
- package/dist/Slider.vue.d.ts +3 -8
- package/dist/Slider.vue_vue_type_script_setup_true_lang.js +11 -10
- package/dist/Switch.vue.d.ts +13 -10
- package/dist/Switch.vue_vue_type_script_setup_true_lang.js +33 -21
- package/dist/Tabs.vue.d.ts +3 -5
- package/dist/Tabs.vue_vue_type_script_setup_true_lang.js +10 -9
- package/dist/TextField.vue.d.ts +11 -8
- package/dist/TextField.vue_vue_type_script_setup_true_lang.js +26 -13
- package/dist/Toast.vue_vue_type_script_setup_true_lang.js +5 -11
- package/dist/TooltipOverlay.vue.d.ts +1 -0
- package/dist/TooltipOverlay.vue_vue_type_script_setup_true_lang.js +6 -5
- package/dist/controlled.d.ts +46 -0
- package/dist/controlled.js +64 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -1
- package/dist/labels.d.ts +9 -0
- package/dist/labels.js +17 -0
- package/dist/preview.js +9 -2
- package/dist/trigger.d.ts +7 -0
- package/dist/trigger.js +13 -1
- package/package.json +3 -3
- package/styles.css +70 -0
- package/tailwind.css +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { keepValue } from "./controlled.js";
|
|
1
|
+
import { focusable, formDefault, keepValue, useControllable, useFormReset } from "./controlled.js";
|
|
2
2
|
import Icon_default from "./Icon.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useLabels } from "./labels.js";
|
|
4
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, getCurrentInstance, mergeProps, normalizeClass, openBlock, unref, useTemplateRef } from "vue";
|
|
4
5
|
import { classes, rootPart } from "@xds/core";
|
|
5
6
|
// packages/ui-vue/src/SearchField.vue?vue&type=script&setup=true&lang.ts
|
|
6
7
|
var _hoisted_1 = { class: "xds-text-field__control xds-text-field__control--pill xds-text-field__group" };
|
|
@@ -10,6 +11,7 @@ var _hoisted_3 = [
|
|
|
10
11
|
"placeholder",
|
|
11
12
|
"value",
|
|
12
13
|
"disabled",
|
|
14
|
+
"readonly",
|
|
13
15
|
"data-uses-escape"
|
|
14
16
|
];
|
|
15
17
|
var _hoisted_4 = {
|
|
@@ -19,27 +21,39 @@ var _hoisted_4 = {
|
|
|
19
21
|
var _hoisted_5 = ["aria-label"];
|
|
20
22
|
var SearchField_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
21
23
|
__name: "SearchField",
|
|
22
|
-
props:
|
|
24
|
+
props: {
|
|
25
|
+
value: {},
|
|
26
|
+
defaultValue: { default: "" },
|
|
27
|
+
readOnly: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: false
|
|
30
|
+
},
|
|
23
31
|
label: {},
|
|
24
32
|
placeholder: {},
|
|
25
33
|
disabled: {
|
|
26
34
|
type: Boolean,
|
|
27
35
|
default: false
|
|
28
36
|
},
|
|
29
|
-
clearLabel: {
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
clearLabel: {}
|
|
38
|
+
},
|
|
39
|
+
emits: [
|
|
40
|
+
"update:value",
|
|
41
|
+
"submit",
|
|
42
|
+
"focus",
|
|
43
|
+
"blur"
|
|
44
|
+
],
|
|
45
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
37
46
|
const emit = __emit;
|
|
47
|
+
const labels = useLabels();
|
|
38
48
|
const input = useTemplateRef("input");
|
|
49
|
+
const { value, set, controlled, reset } = useControllable("value", () => __props.value, () => __props.defaultValue, (next) => emit("update:value", next));
|
|
50
|
+
useFormReset(() => input.value, controlled, reset);
|
|
51
|
+
__expose(focusable(() => input.value));
|
|
52
|
+
const clearable = computed(() => value.value !== "" && !__props.disabled && !__props.readOnly);
|
|
39
53
|
const instance = getCurrentInstance();
|
|
40
54
|
function edit(event) {
|
|
41
55
|
const field = event.currentTarget;
|
|
42
|
-
|
|
56
|
+
set(field.value);
|
|
43
57
|
if (!event.isComposing) keepValue(field, () => value.value);
|
|
44
58
|
}
|
|
45
59
|
function settle(event) {
|
|
@@ -51,13 +65,13 @@ var SearchField_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
51
65
|
if (instance?.vnode.props?.onSubmit) event.preventDefault();
|
|
52
66
|
emit("submit", value.value);
|
|
53
67
|
}
|
|
54
|
-
if (event.key === "Escape" &&
|
|
68
|
+
if (event.key === "Escape" && clearable.value) {
|
|
55
69
|
event.stopPropagation();
|
|
56
|
-
|
|
70
|
+
set("");
|
|
57
71
|
}
|
|
58
72
|
}
|
|
59
73
|
function clear() {
|
|
60
|
-
|
|
74
|
+
set("");
|
|
61
75
|
input.value?.focus();
|
|
62
76
|
}
|
|
63
77
|
return (_ctx, _cache) => {
|
|
@@ -66,7 +80,7 @@ var SearchField_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
66
80
|
name: "search",
|
|
67
81
|
size: "sm"
|
|
68
82
|
})]),
|
|
69
|
-
createElementVNode("input", {
|
|
83
|
+
createElementVNode("input", mergeProps({
|
|
70
84
|
ref_key: "input",
|
|
71
85
|
ref: input,
|
|
72
86
|
type: "text",
|
|
@@ -75,16 +89,20 @@ var SearchField_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
75
89
|
"aria-label": __props.label,
|
|
76
90
|
enterkeyhint: "search",
|
|
77
91
|
placeholder: __props.placeholder,
|
|
78
|
-
value: value
|
|
92
|
+
value: unref(value)
|
|
93
|
+
}, unref(formDefault)({ defaultValue: unref(value) }), {
|
|
79
94
|
disabled: __props.disabled,
|
|
80
|
-
|
|
95
|
+
readonly: __props.readOnly,
|
|
96
|
+
"data-uses-escape": clearable.value ? "" : void 0,
|
|
81
97
|
onInput: edit,
|
|
82
98
|
onCompositionend: settle,
|
|
83
|
-
onKeydown: key
|
|
84
|
-
|
|
85
|
-
|
|
99
|
+
onKeydown: key,
|
|
100
|
+
onFocus: _cache[0] || (_cache[0] = ($event) => emit("focus", $event)),
|
|
101
|
+
onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur", $event))
|
|
102
|
+
}), null, 16, _hoisted_3),
|
|
103
|
+
clearable.value ? (openBlock(), createElementBlock("span", _hoisted_4, [createElementVNode("button", {
|
|
86
104
|
type: "button",
|
|
87
|
-
"aria-label": __props.clearLabel,
|
|
105
|
+
"aria-label": __props.clearLabel ?? unref(labels).clear,
|
|
88
106
|
class: "-me-1 flex size-xds-target-min cursor-pointer items-center justify-center rounded-xds-full hover:text-xds-field-text focus-visible:outline-(length:--xds-focus-width) focus-visible:outline-xds-border-focus focus-visible:outline-solid",
|
|
89
107
|
onClick: clear
|
|
90
108
|
}, [createVNode(Icon_default, {
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { type SegmentedControlBaseProps } from "@xds/core";
|
|
2
|
-
export type SegmentedControlProps<Value extends string> = Omit<SegmentedControlBaseProps<Value>, "
|
|
2
|
+
export type SegmentedControlProps<Value extends string> = Omit<SegmentedControlBaseProps<Value>, "aria-label"> & {
|
|
3
3
|
ariaLabel: string;
|
|
4
4
|
};
|
|
5
5
|
declare const __VLS_export: <Value extends string>(__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<{
|
|
6
|
-
props: import('vue').PublicProps & __VLS_PrettifyLocal<
|
|
7
|
-
ariaLabel: string;
|
|
8
|
-
} & {
|
|
9
|
-
value: Value;
|
|
10
|
-
}) & {
|
|
6
|
+
props: import('vue').PublicProps & __VLS_PrettifyLocal<SegmentedControlProps<Value> & {
|
|
11
7
|
"onUpdate:value"?: ((value: Value) => any) | undefined;
|
|
12
8
|
}> & (typeof globalThis extends {
|
|
13
9
|
__VLS_PROPS_FALLBACK: infer P;
|
|
@@ -15,7 +11,7 @@ declare const __VLS_export: <Value extends string>(__VLS_props: NonNullable<Awai
|
|
|
15
11
|
expose: (exposed: {}) => void;
|
|
16
12
|
attrs: any;
|
|
17
13
|
slots: {};
|
|
18
|
-
emit: (
|
|
14
|
+
emit: (evt: "update:value", value: Value) => void;
|
|
19
15
|
}>) => import('vue').VNode & {
|
|
20
16
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
21
17
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { keepChecked } from "./controlled.js";
|
|
2
|
-
import { Fragment, createElementBlock, createElementVNode, defineComponent,
|
|
1
|
+
import { formDefault, keepChecked, useControllable } from "./controlled.js";
|
|
2
|
+
import { Fragment, createElementBlock, createElementVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderList, toDisplayString, unref, useId, useTemplateRef } from "vue";
|
|
3
3
|
import { classes, rootPart, segmentedControlClass, segmentedControlOptionClass, segmentedControlSegmentClass } from "@xds/core";
|
|
4
4
|
// packages/ui-vue/src/SegmentedControl.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
var _hoisted_1 = ["aria-label"];
|
|
@@ -11,24 +11,24 @@ var _hoisted_2 = [
|
|
|
11
11
|
];
|
|
12
12
|
var SegmentedControl_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
13
13
|
__name: "SegmentedControl",
|
|
14
|
-
props:
|
|
14
|
+
props: {
|
|
15
15
|
options: {},
|
|
16
|
+
value: {},
|
|
17
|
+
defaultValue: {},
|
|
16
18
|
fullWidth: {
|
|
17
19
|
type: Boolean,
|
|
18
20
|
default: false
|
|
19
21
|
},
|
|
20
22
|
ariaLabel: {}
|
|
21
|
-
},
|
|
22
|
-
"value": { required: true },
|
|
23
|
-
"valueModifiers": {}
|
|
24
|
-
}),
|
|
23
|
+
},
|
|
25
24
|
emits: ["update:value"],
|
|
26
|
-
setup(__props) {
|
|
27
|
-
const
|
|
25
|
+
setup(__props, { emit: __emit }) {
|
|
26
|
+
const emit = __emit;
|
|
27
|
+
const { value, set } = useControllable("value", () => __props.value, () => __props.defaultValue ?? __props.options[0]?.value, (next) => emit("update:value", next));
|
|
28
28
|
const name = useId();
|
|
29
29
|
const group = useTemplateRef("group");
|
|
30
30
|
function choose(option) {
|
|
31
|
-
|
|
31
|
+
set(option);
|
|
32
32
|
for (const input of group.value?.querySelectorAll("input") ?? []) keepChecked(input, () => input.value === value.value);
|
|
33
33
|
}
|
|
34
34
|
return (_ctx, _cache) => {
|
|
@@ -42,14 +42,13 @@ var SegmentedControl_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
42
42
|
return openBlock(), createElementBlock("label", {
|
|
43
43
|
key: option.value,
|
|
44
44
|
class: normalizeClass(unref(segmentedControlOptionClass)(__props.fullWidth))
|
|
45
|
-
}, [createElementVNode("input", {
|
|
45
|
+
}, [createElementVNode("input", mergeProps({
|
|
46
46
|
type: "radio",
|
|
47
47
|
name: unref(name),
|
|
48
48
|
value: option.value,
|
|
49
49
|
class: "peer sr-only",
|
|
50
|
-
checked: option.value === value
|
|
51
|
-
|
|
52
|
-
}, null, 40, _hoisted_2), createElementVNode("span", { class: normalizeClass(unref(segmentedControlSegmentClass)) }, toDisplayString(option.label), 3)], 2);
|
|
50
|
+
checked: option.value === unref(value)
|
|
51
|
+
}, { ref_for: true }, unref(formDefault)({ defaultChecked: option.value === unref(value) }), { onChange: ($event) => choose(option.value) }), null, 16, _hoisted_2), createElementVNode("span", { class: normalizeClass(unref(segmentedControlSegmentClass)) }, toDisplayString(option.label), 3)], 2);
|
|
53
52
|
}), 128))], 10, _hoisted_1);
|
|
54
53
|
};
|
|
55
54
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useControllable } from "./controlled.js";
|
|
1
2
|
import Icon_default from "./Icon.js";
|
|
2
3
|
import { useModalPopover } from "./modal-popover.js";
|
|
3
4
|
import Portal_default from "./Portal.js";
|
|
@@ -22,6 +23,7 @@ var Select_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
22
23
|
label: {},
|
|
23
24
|
options: {},
|
|
24
25
|
value: {},
|
|
26
|
+
defaultValue: {},
|
|
25
27
|
placeholder: {},
|
|
26
28
|
description: {},
|
|
27
29
|
error: {},
|
|
@@ -34,6 +36,9 @@ var Select_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
34
36
|
emits: ["update:value"],
|
|
35
37
|
setup(__props, { emit: __emit }) {
|
|
36
38
|
const emit = __emit;
|
|
39
|
+
const { value, set } = useControllable("value", () => __props.value, () => __props.defaultValue, (next) => {
|
|
40
|
+
if (next !== void 0) emit("update:value", next);
|
|
41
|
+
});
|
|
37
42
|
const id = useId();
|
|
38
43
|
const valueId = `${id}-value`;
|
|
39
44
|
const descriptionId = `${id}-description`;
|
|
@@ -47,10 +52,10 @@ var Select_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
47
52
|
const service = useMachine(select.machine, computed(() => ({
|
|
48
53
|
id,
|
|
49
54
|
collection: collection.value,
|
|
50
|
-
value:
|
|
55
|
+
value: value.value === void 0 ? [] : [value.value],
|
|
51
56
|
onValueChange: (details) => {
|
|
52
57
|
const next = details.value[0];
|
|
53
|
-
if (next !== void 0)
|
|
58
|
+
if (next !== void 0) set(next);
|
|
54
59
|
},
|
|
55
60
|
disabled: __props.disabled,
|
|
56
61
|
invalid: invalid.value,
|
package/dist/Slider.vue.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { type SliderBaseProps } from "@xds/core";
|
|
2
|
-
export type SliderProps =
|
|
3
|
-
|
|
4
|
-
type __VLS_ModelProps = {
|
|
5
|
-
"value": number;
|
|
6
|
-
};
|
|
7
|
-
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
8
|
-
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
2
|
+
export type SliderProps = SliderBaseProps;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<SliderBaseProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
4
|
"update:value": (value: number) => any;
|
|
10
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
5
|
+
}, string, import("vue").PublicProps, Readonly<SliderBaseProps> & Readonly<{
|
|
11
6
|
"onUpdate:value"?: ((value: number) => any) | undefined;
|
|
12
7
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
8
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useControllable } from "./controlled.js";
|
|
2
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, toDisplayString, unref, useId, useTemplateRef } from "vue";
|
|
2
3
|
import { focusThumbOnPress, sliderArrowValue, sliderPageSize, sliderValueText } from "@xds/core";
|
|
3
4
|
import { mergeProps as mergeProps$1, normalizeProps as normalizeProps$1, useMachine } from "@zag-js/vue";
|
|
4
5
|
import * as slider from "@zag-js/slider";
|
|
@@ -6,8 +7,10 @@ import * as slider from "@zag-js/slider";
|
|
|
6
7
|
var _hoisted_1 = ["aria-labelledby"];
|
|
7
8
|
var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
8
9
|
__name: "Slider",
|
|
9
|
-
props:
|
|
10
|
+
props: {
|
|
10
11
|
label: {},
|
|
12
|
+
value: {},
|
|
13
|
+
defaultValue: {},
|
|
11
14
|
min: { default: 0 },
|
|
12
15
|
max: { default: 100 },
|
|
13
16
|
step: { default: 1 },
|
|
@@ -21,13 +24,11 @@ var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
21
24
|
},
|
|
22
25
|
name: {},
|
|
23
26
|
locale: {}
|
|
24
|
-
},
|
|
25
|
-
"value": { required: true },
|
|
26
|
-
"valueModifiers": {}
|
|
27
|
-
}),
|
|
27
|
+
},
|
|
28
28
|
emits: ["update:value"],
|
|
29
|
-
setup(__props) {
|
|
30
|
-
const
|
|
29
|
+
setup(__props, { emit: __emit }) {
|
|
30
|
+
const emit = __emit;
|
|
31
|
+
const { value, set } = useControllable("value", () => __props.value, () => __props.defaultValue ?? __props.min, (next) => emit("update:value", next));
|
|
31
32
|
const id = useId();
|
|
32
33
|
const pageSize = computed(() => sliderPageSize({
|
|
33
34
|
min: __props.min,
|
|
@@ -38,7 +39,7 @@ var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
38
39
|
id,
|
|
39
40
|
name: __props.name,
|
|
40
41
|
value: [value.value],
|
|
41
|
-
onValueChange: (details) =>
|
|
42
|
+
onValueChange: (details) => set(details.value[0] ?? __props.min),
|
|
42
43
|
min: __props.min,
|
|
43
44
|
max: __props.max,
|
|
44
45
|
step: __props.step,
|
|
@@ -76,7 +77,7 @@ var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
|
|
|
76
77
|
__props.showValue ? (openBlock(), createElementBlock("output", mergeProps({ key: 0 }, api.value.getValueTextProps(), {
|
|
77
78
|
"aria-live": "off",
|
|
78
79
|
class: "xds-slider__output"
|
|
79
|
-
}), toDisplayString(unref(sliderValueText)(api.value.value[0] ?? value
|
|
80
|
+
}), toDisplayString(unref(sliderValueText)(api.value.value[0] ?? unref(value), __props.locale)), 17)) : createCommentVNode("", true),
|
|
80
81
|
createElementVNode("div", mergeProps(control.value, { class: "xds-slider__control" }), [createElementVNode("div", mergeProps(api.value.getTrackProps(), { class: "xds-slider__track" }), [createElementVNode("div", mergeProps(api.value.getRangeProps(), { class: "xds-slider__range" }), null, 16)], 16), createElementVNode("div", mergeProps(thumb.value, {
|
|
81
82
|
ref_key: "thumb",
|
|
82
83
|
ref: thumb,
|
package/dist/Switch.vue.d.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { type SwitchBaseProps } from "@xds/core";
|
|
2
|
-
export type SwitchProps = Omit<SwitchBaseProps, "
|
|
2
|
+
export type SwitchProps = Omit<SwitchBaseProps, "aria-label"> & {
|
|
3
3
|
ariaLabel?: string;
|
|
4
4
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<SwitchProps, {
|
|
6
|
+
focus: (options?: FocusOptions) => void | undefined;
|
|
7
|
+
blur: () => void | undefined;
|
|
8
|
+
element: () => HTMLInputElement | null;
|
|
9
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
+
blur: (event: FocusEvent) => any;
|
|
11
|
+
focus: (event: FocusEvent) => any;
|
|
12
|
+
"update:checked": (checked: boolean) => any;
|
|
13
|
+
}, string, import("vue").PublicProps, Readonly<SwitchProps> & Readonly<{
|
|
14
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
15
|
+
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
16
|
+
"onUpdate:checked"?: ((checked: boolean) => any) | undefined;
|
|
14
17
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
18
|
declare const _default: typeof __VLS_export;
|
|
16
19
|
export default _default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { keepChecked } from "./controlled.js";
|
|
2
|
-
import { createCommentVNode, createElementBlock, createElementVNode, defineComponent,
|
|
1
|
+
import { focusable, formDefault, keepChecked, useControllable, useFormReset } from "./controlled.js";
|
|
2
|
+
import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeProps, normalizeClass, openBlock, toDisplayString, unref, useTemplateRef } from "vue";
|
|
3
3
|
import { classes, rootPart, switchClass, switchLabelClass, switchThumbClass, switchTrackClass } from "@xds/core";
|
|
4
4
|
// packages/ui-vue/src/Switch.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
var _hoisted_1 = [
|
|
@@ -10,40 +10,52 @@ var _hoisted_1 = [
|
|
|
10
10
|
];
|
|
11
11
|
var Switch_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
12
12
|
__name: "Switch",
|
|
13
|
-
props:
|
|
13
|
+
props: {
|
|
14
|
+
checked: { type: Boolean },
|
|
15
|
+
defaultChecked: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: false
|
|
18
|
+
},
|
|
14
19
|
label: {},
|
|
15
20
|
disabled: {
|
|
16
21
|
type: Boolean,
|
|
17
22
|
default: false
|
|
18
23
|
},
|
|
19
24
|
ariaLabel: {}
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const checked =
|
|
25
|
+
},
|
|
26
|
+
emits: [
|
|
27
|
+
"update:checked",
|
|
28
|
+
"focus",
|
|
29
|
+
"blur"
|
|
30
|
+
],
|
|
31
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
32
|
+
const emit = __emit;
|
|
33
|
+
const input = useTemplateRef("input");
|
|
34
|
+
const { value: checked, set, controlled, reset } = useControllable("checked", () => __props.checked, () => __props.defaultChecked, (next) => emit("update:checked", next));
|
|
35
|
+
useFormReset(() => input.value, controlled, reset);
|
|
36
|
+
__expose(focusable(() => input.value));
|
|
30
37
|
function change(event) {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
keepChecked(
|
|
38
|
+
const element = event.currentTarget;
|
|
39
|
+
set(element.checked);
|
|
40
|
+
keepChecked(element, () => checked.value);
|
|
34
41
|
}
|
|
35
42
|
return (_ctx, _cache) => {
|
|
36
43
|
return openBlock(), createElementBlock("label", { class: normalizeClass(unref(classes)(unref(rootPart)("Switch"), unref(switchClass))) }, [
|
|
37
|
-
createElementVNode("input", {
|
|
44
|
+
createElementVNode("input", mergeProps({
|
|
45
|
+
ref_key: "input",
|
|
46
|
+
ref: input,
|
|
38
47
|
type: "checkbox",
|
|
39
48
|
role: "switch",
|
|
40
|
-
"aria-checked": checked
|
|
49
|
+
"aria-checked": unref(checked) ? "true" : "false",
|
|
41
50
|
"aria-label": __props.ariaLabel,
|
|
42
51
|
class: "peer sr-only",
|
|
43
|
-
checked: checked
|
|
52
|
+
checked: unref(checked)
|
|
53
|
+
}, unref(formDefault)({ defaultChecked: unref(checked) }), {
|
|
44
54
|
disabled: __props.disabled,
|
|
45
|
-
onChange: change
|
|
46
|
-
|
|
55
|
+
onChange: change,
|
|
56
|
+
onFocus: _cache[0] || (_cache[0] = ($event) => emit("focus", $event)),
|
|
57
|
+
onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur", $event))
|
|
58
|
+
}), null, 16, _hoisted_1),
|
|
47
59
|
createElementVNode("span", { class: normalizeClass(unref(switchTrackClass)) }, [createElementVNode("span", { class: normalizeClass(unref(switchThumbClass)) }, null, 2)], 2),
|
|
48
60
|
__props.label ? (openBlock(), createElementBlock("span", {
|
|
49
61
|
key: 0,
|
package/dist/Tabs.vue.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { type TabsBaseProps } from "@xds/core";
|
|
2
|
-
export type TabsProps<Value extends string> =
|
|
2
|
+
export type TabsProps<Value extends string> = TabsBaseProps<Value>;
|
|
3
3
|
declare const __VLS_export: <Value extends string>(__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
|
-
value: Value;
|
|
6
|
-
}) & {
|
|
4
|
+
props: import('vue').PublicProps & __VLS_PrettifyLocal<TabsProps<Value> & {
|
|
7
5
|
"onUpdate:value"?: ((value: Value) => any) | undefined;
|
|
8
6
|
}> & (typeof globalThis extends {
|
|
9
7
|
__VLS_PROPS_FALLBACK: infer P;
|
|
@@ -11,7 +9,7 @@ declare const __VLS_export: <Value extends string>(__VLS_props: NonNullable<Awai
|
|
|
11
9
|
expose: (exposed: {}) => void;
|
|
12
10
|
attrs: any;
|
|
13
11
|
slots: {};
|
|
14
|
-
emit: (
|
|
12
|
+
emit: (evt: "update:value", value: Value) => void;
|
|
15
13
|
}>) => import('vue').VNode & {
|
|
16
14
|
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
17
15
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { useControllable } from "./controlled.js";
|
|
1
2
|
import Icon_default from "./Icon.js";
|
|
2
|
-
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent,
|
|
3
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeProps, openBlock, renderList, toDisplayString, unref, useId } from "vue";
|
|
3
4
|
import { tabStopIndex, tabsClass } from "@xds/core";
|
|
4
5
|
import { normalizeProps as normalizeProps$1, useMachine } from "@zag-js/vue";
|
|
5
6
|
import * as tabs from "@zag-js/tabs";
|
|
@@ -7,25 +8,25 @@ import * as tabs from "@zag-js/tabs";
|
|
|
7
8
|
var _hoisted_1 = ["aria-label"];
|
|
8
9
|
var Tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
9
10
|
__name: "Tabs",
|
|
10
|
-
props:
|
|
11
|
+
props: {
|
|
11
12
|
items: {},
|
|
13
|
+
value: {},
|
|
14
|
+
defaultValue: {},
|
|
12
15
|
label: {},
|
|
13
16
|
fullWidth: {
|
|
14
17
|
type: Boolean,
|
|
15
18
|
default: false
|
|
16
19
|
}
|
|
17
|
-
},
|
|
18
|
-
"value": { required: true },
|
|
19
|
-
"valueModifiers": {}
|
|
20
|
-
}),
|
|
20
|
+
},
|
|
21
21
|
emits: ["update:value"],
|
|
22
|
-
setup(__props) {
|
|
23
|
-
const
|
|
22
|
+
setup(__props, { emit: __emit }) {
|
|
23
|
+
const emit = __emit;
|
|
24
|
+
const { value, set } = useControllable("value", () => __props.value, () => __props.defaultValue ?? __props.items[0]?.value, (next) => emit("update:value", next));
|
|
24
25
|
const id = useId();
|
|
25
26
|
const service = useMachine(tabs.machine, computed(() => ({
|
|
26
27
|
id,
|
|
27
28
|
value: value.value,
|
|
28
|
-
onValueChange: (details) =>
|
|
29
|
+
onValueChange: (details) => set(details.value)
|
|
29
30
|
})));
|
|
30
31
|
const api = computed(() => tabs.connect(service, normalizeProps$1));
|
|
31
32
|
const trigger = (item) => {
|
package/dist/TextField.vue.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { TextFieldBaseProps } from "@xds/core";
|
|
2
|
-
export type TextFieldProps = Omit<TextFieldBaseProps, "
|
|
2
|
+
export type TextFieldProps = Omit<TextFieldBaseProps, "autoComplete"> & {
|
|
3
3
|
autoComplete?: string;
|
|
4
4
|
};
|
|
5
|
-
type __VLS_Props = TextFieldProps;
|
|
6
5
|
type __VLS_Slots = {
|
|
7
6
|
/**
|
|
8
7
|
* Inside the box, in front of the text: an icon, a unit. It takes the placeholder's color
|
|
@@ -12,13 +11,17 @@ type __VLS_Slots = {
|
|
|
12
11
|
/** Inside the box, after the text: an icon, a unit, a small button. */
|
|
13
12
|
trailing?(): unknown;
|
|
14
13
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
declare const __VLS_base: import("vue").DefineComponent<TextFieldProps, {
|
|
15
|
+
focus: (options?: FocusOptions) => void | undefined;
|
|
16
|
+
blur: () => void | undefined;
|
|
17
|
+
element: () => HTMLInputElement | HTMLTextAreaElement | null;
|
|
18
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
19
|
+
blur: (event: FocusEvent) => any;
|
|
20
|
+
focus: (event: FocusEvent) => any;
|
|
20
21
|
"update:value": (value: string) => any;
|
|
21
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
22
|
+
}, string, import("vue").PublicProps, Readonly<TextFieldProps> & Readonly<{
|
|
23
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
24
|
+
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
22
25
|
"onUpdate:value"?: ((value: string) => any) | undefined;
|
|
23
26
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
27
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { keepValue } from "./controlled.js";
|
|
2
|
-
import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent,
|
|
1
|
+
import { focusable, keepValue, useControllable, useFormReset } from "./controlled.js";
|
|
2
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeProps, onMounted, openBlock, renderSlot, toDisplayString, unref, useId, useSlots, useTemplateRef, watch } from "vue";
|
|
3
3
|
// packages/ui-vue/src/TextField.vue?vue&type=script&setup=true&lang.ts
|
|
4
4
|
var _hoisted_1 = { class: "xds-text-field" };
|
|
5
5
|
var _hoisted_2 = ["for"];
|
|
@@ -26,8 +26,14 @@ var _hoisted_11 = {
|
|
|
26
26
|
};
|
|
27
27
|
var TextField_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
28
28
|
__name: "TextField",
|
|
29
|
-
props:
|
|
29
|
+
props: {
|
|
30
30
|
label: {},
|
|
31
|
+
value: {},
|
|
32
|
+
defaultValue: { default: "" },
|
|
33
|
+
readOnly: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
},
|
|
31
37
|
description: {},
|
|
32
38
|
error: {},
|
|
33
39
|
placeholder: {},
|
|
@@ -53,19 +59,23 @@ var TextField_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
53
59
|
default: false
|
|
54
60
|
},
|
|
55
61
|
autoComplete: {}
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
},
|
|
63
|
+
emits: [
|
|
64
|
+
"update:value",
|
|
65
|
+
"focus",
|
|
66
|
+
"blur"
|
|
67
|
+
],
|
|
68
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
69
|
+
const emit = __emit;
|
|
63
70
|
const slots = useSlots();
|
|
64
71
|
const id = useId();
|
|
65
72
|
const descriptionId = `${id}-description`;
|
|
66
73
|
const errorId = `${id}-error`;
|
|
67
74
|
const invalid = computed(() => __props.error !== void 0);
|
|
68
75
|
const input = useTemplateRef("input");
|
|
76
|
+
const { value, set, controlled, reset } = useControllable("value", () => __props.value, () => __props.defaultValue, (next) => emit("update:value", next));
|
|
77
|
+
useFormReset(() => input.value, controlled, reset);
|
|
78
|
+
__expose(focusable(() => input.value));
|
|
69
79
|
const grouped = computed(() => slots.leading !== void 0 || slots.trailing !== void 0);
|
|
70
80
|
onMounted(() => {
|
|
71
81
|
if (input.value instanceof HTMLTextAreaElement) input.value.setSelectionRange(0, 0);
|
|
@@ -89,13 +99,16 @@ var TextField_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
89
99
|
autocomplete: __props.autoComplete,
|
|
90
100
|
required: __props.required,
|
|
91
101
|
disabled: __props.disabled,
|
|
102
|
+
readonly: __props.readOnly,
|
|
92
103
|
"aria-invalid": invalid.value ? "true" : void 0,
|
|
93
104
|
"aria-errormessage": invalid.value ? errorId : void 0,
|
|
94
|
-
"aria-describedby": invalid.value ? errorId : __props.description ? descriptionId : void 0
|
|
105
|
+
"aria-describedby": invalid.value ? errorId : __props.description ? descriptionId : void 0,
|
|
106
|
+
onFocus: (event) => emit("focus", event),
|
|
107
|
+
onBlur: (event) => emit("blur", event)
|
|
95
108
|
}));
|
|
96
109
|
function edit(event) {
|
|
97
110
|
const field = event.currentTarget;
|
|
98
|
-
|
|
111
|
+
set(field.value);
|
|
99
112
|
if (!event.isComposing) keepValue(field, () => value.value);
|
|
100
113
|
}
|
|
101
114
|
function settle(event) {
|
|
@@ -155,7 +168,7 @@ var TextField_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
|
|
|
155
168
|
class: "xds-text-field__error",
|
|
156
169
|
"aria-live": "polite"
|
|
157
170
|
}, toDisplayString(__props.error), 1),
|
|
158
|
-
__props.maxLength !== void 0 ? (openBlock(), createElementBlock("span", _hoisted_11, toDisplayString(value.
|
|
171
|
+
__props.maxLength !== void 0 ? (openBlock(), createElementBlock("span", _hoisted_11, toDisplayString(unref(value).length) + "/" + toDisplayString(__props.maxLength), 1)) : createCommentVNode("", true)
|
|
159
172
|
])
|
|
160
173
|
]);
|
|
161
174
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeProps, normalizeClass,
|
|
1
|
+
import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeProps, normalizeClass, onBeforeUnmount, onMounted, openBlock, ref, toDisplayString, unref, useTemplateRef, watchEffect } from "vue";
|
|
2
2
|
import { TOAST_PARTS, readCssMs, rootPart } from "@xds/core";
|
|
3
3
|
import { motion } from "@xds/tokens";
|
|
4
4
|
// packages/ui-vue/src/Toast.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -42,24 +42,18 @@ var Toast_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
|
|
|
42
42
|
}, popover, {
|
|
43
43
|
role: "status",
|
|
44
44
|
class: unref(TOAST_PARTS).region
|
|
45
|
-
}), [__props.open ? (openBlock(), createElementBlock("div", {
|
|
46
|
-
|
|
47
|
-
class: normalizeClass([
|
|
48
|
-
unref(rootPart)("Toast"),
|
|
49
|
-
unref(TOAST_PARTS).toast,
|
|
50
|
-
_ctx.$attrs.class
|
|
51
|
-
]),
|
|
52
|
-
style: normalizeStyle(_ctx.$attrs.style),
|
|
45
|
+
}), [__props.open ? (openBlock(), createElementBlock("div", mergeProps({ key: 0 }, _ctx.$attrs, {
|
|
46
|
+
class: [unref(rootPart)("Toast"), unref(TOAST_PARTS).toast],
|
|
53
47
|
onPointerenter: _cache[1] || (_cache[1] = ($event) => hovered.value = $event.currentTarget),
|
|
54
48
|
onPointerleave: _cache[2] || (_cache[2] = ($event) => hovered.value = void 0),
|
|
55
49
|
onFocusin: _cache[3] || (_cache[3] = ($event) => focused.value = $event.currentTarget),
|
|
56
50
|
onFocusout: _cache[4] || (_cache[4] = ($event) => focused.value = void 0)
|
|
57
|
-
}, [createElementVNode("span", { class: normalizeClass(unref(TOAST_PARTS).message) }, toDisplayString(__props.message), 3), __props.action ? (openBlock(), createElementBlock("button", {
|
|
51
|
+
}), [createElementVNode("span", { class: normalizeClass(unref(TOAST_PARTS).message) }, toDisplayString(__props.message), 3), __props.action ? (openBlock(), createElementBlock("button", {
|
|
58
52
|
key: 0,
|
|
59
53
|
type: "button",
|
|
60
54
|
class: normalizeClass(unref(TOAST_PARTS).action),
|
|
61
55
|
onClick: _cache[0] || (_cache[0] = ($event) => press(__props.action.onPress))
|
|
62
|
-
}, toDisplayString(__props.action.label), 3)) : createCommentVNode("", true)],
|
|
56
|
+
}, toDisplayString(__props.action.label), 3)) : createCommentVNode("", true)], 16)) : createCommentVNode("", true)], 16);
|
|
63
57
|
};
|
|
64
58
|
}
|
|
65
59
|
});
|