@xds/vue 1.0.1 → 1.2.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/Breadcrumb.js +4 -0
- package/dist/Breadcrumb.vue.d.ts +6 -0
- package/dist/Breadcrumb.vue_vue_type_script_setup_true_lang.js +47 -0
- 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 +42 -22
- package/dist/Combobox.js +4 -0
- package/dist/Combobox.vue.d.ts +22 -0
- package/dist/Combobox.vue_vue_type_script_setup_true_lang.js +140 -0
- 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/Link.js +4 -0
- package/dist/Link.vue.d.ts +27 -0
- package/dist/Link.vue_vue_type_script_setup_true_lang.js +62 -0
- package/dist/Menu.vue.d.ts +4 -1
- package/dist/Menu.vue_vue_type_script_setup_true_lang.js +5 -4
- package/dist/Pagination.js +4 -0
- package/dist/Pagination.vue.d.ts +9 -0
- package/dist/Pagination.vue_vue_type_script_setup_true_lang.js +74 -0
- package/dist/Popover.js +4 -0
- package/dist/Popover.vue.d.ts +26 -0
- package/dist/Popover.vue_vue_type_script_setup_true_lang.js +81 -0
- 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.d.ts +3 -1
- package/dist/Select.vue_vue_type_script_setup_true_lang.js +47 -18
- 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/Table.js +4 -0
- package/dist/Table.vue.d.ts +10 -0
- package/dist/Table.vue_vue_type_script_setup_true_lang.js +61 -0
- 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/TimePicker.js +4 -0
- package/dist/TimePicker.vue.d.ts +10 -0
- package/dist/TimePicker.vue_vue_type_script_setup_true_lang.js +168 -0
- package/dist/Toast.vue_vue_type_script_setup_true_lang.js +5 -11
- package/dist/ToastQueue.js +4 -0
- package/dist/ToastQueue.vue.d.ts +9 -0
- package/dist/ToastQueue.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/TooltipOverlay.vue.d.ts +1 -0
- package/dist/TooltipOverlay.vue_vue_type_script_setup_true_lang.js +6 -5
- package/dist/base.d.ts +13 -0
- package/dist/base.js +14 -0
- package/dist/controlled.d.ts +46 -0
- package/dist/controlled.js +64 -2
- package/dist/index.d.ts +14 -3
- package/dist/index.js +11 -1
- package/dist/labels.d.ts +9 -0
- package/dist/labels.js +17 -0
- package/dist/preview.d.ts +20 -3
- package/dist/preview.js +37 -7
- package/dist/trigger.d.ts +7 -0
- package/dist/trigger.js +13 -1
- package/eject/files/Accordion.vue +89 -0
- package/eject/files/AccordionPanel.vue +47 -0
- package/eject/files/Avatar.vue +41 -0
- package/eject/files/AvatarStack.vue +46 -0
- package/eject/files/Badge.vue +29 -0
- package/eject/files/Banner.vue +65 -0
- package/eject/files/Breadcrumb.vue +43 -0
- package/eject/files/Button.vue +93 -0
- package/eject/files/Card.vue +85 -0
- package/eject/files/Checkbox.vue +104 -0
- package/eject/files/Chip.vue +32 -0
- package/eject/files/ChipBar.vue +25 -0
- package/eject/files/Combobox.vue +175 -0
- package/eject/files/CountBadge.vue +45 -0
- package/eject/files/DatePicker.vue +223 -0
- package/eject/files/DateRangePicker.vue +317 -0
- package/eject/files/Dialog.vue +105 -0
- package/eject/files/Divider.vue +15 -0
- package/eject/files/EmptyState.vue +28 -0
- package/eject/files/Icon.vue +34 -0
- package/eject/files/IconButton.vue +71 -0
- package/eject/files/Link.vue +48 -0
- package/eject/files/ListRow.vue +33 -0
- package/eject/files/MediaCard.vue +109 -0
- package/eject/files/Menu.vue +181 -0
- package/eject/files/Pagination.vue +88 -0
- package/eject/files/PlaceRow.vue +54 -0
- package/eject/files/Popover.vue +119 -0
- package/eject/files/ProgressBar.vue +34 -0
- package/eject/files/RadioGroup.vue +126 -0
- package/eject/files/SearchField.vue +129 -0
- package/eject/files/SectionHeader.vue +37 -0
- package/eject/files/SegmentedControl.vue +81 -0
- package/eject/files/Select.vue +269 -0
- package/eject/files/Sidebar.vue +101 -0
- package/eject/files/SidebarRailButton.vue +31 -0
- package/eject/files/Skeleton.vue +27 -0
- package/eject/files/Slider.vue +126 -0
- package/eject/files/Spinner.vue +36 -0
- package/eject/files/Switch.vue +88 -0
- package/eject/files/Table.vue +77 -0
- package/eject/files/Tabs.vue +72 -0
- package/eject/files/Text.vue +22 -0
- package/eject/files/TextField.vue +190 -0
- package/eject/files/Thumbnail.vue +62 -0
- package/eject/files/TimePicker.vue +224 -0
- package/eject/files/Toast.vue +83 -0
- package/eject/files/ToastQueue.vue +54 -0
- package/eject/files/Tooltip.vue +28 -0
- package/eject/files/TooltipOverlay.vue +86 -0
- package/eject/files/accordion.css +89 -0
- package/eject/files/accordion.ts +67 -0
- package/eject/files/avatar-stack.ts +57 -0
- package/eject/files/avatar.ts +42 -0
- package/eject/files/badge.ts +30 -0
- package/eject/files/banner.ts +71 -0
- package/eject/files/base.css +38 -0
- package/eject/files/breadcrumb.css +51 -0
- package/eject/files/breadcrumb.ts +42 -0
- package/eject/files/button.css +241 -0
- package/eject/files/button.ts +106 -0
- package/eject/files/card.ts +58 -0
- package/eject/files/checkbox.ts +52 -0
- package/eject/files/chip-bar.ts +16 -0
- package/eject/files/chip.ts +35 -0
- package/eject/files/combobox.css +269 -0
- package/eject/files/combobox.ts +85 -0
- package/eject/files/count-badge.ts +32 -0
- package/eject/files/date-picker.css +375 -0
- package/eject/files/date-picker.ts +280 -0
- package/eject/files/date-range-picker.ts +338 -0
- package/eject/files/dialog.css +139 -0
- package/eject/files/dialog.ts +15 -0
- package/eject/files/divider.ts +5 -0
- package/eject/files/empty-state.ts +22 -0
- package/eject/files/icon.ts +36 -0
- package/eject/files/link.css +64 -0
- package/eject/files/link.ts +63 -0
- package/eject/files/list-row.ts +66 -0
- package/eject/files/media-card.ts +66 -0
- package/eject/files/menu.css +192 -0
- package/eject/files/menu.ts +84 -0
- package/eject/files/overlay.css +40 -0
- package/eject/files/pagination.css +106 -0
- package/eject/files/pagination.ts +68 -0
- package/eject/files/parts.ts +17 -0
- package/eject/files/popover.css +101 -0
- package/eject/files/popover.ts +37 -0
- package/eject/files/progress-bar.ts +26 -0
- package/eject/files/radio-group.css +184 -0
- package/eject/files/radio-group.ts +30 -0
- package/eject/files/section-header.ts +32 -0
- package/eject/files/segmented-control.ts +33 -0
- package/eject/files/select.css +347 -0
- package/eject/files/select.ts +77 -0
- package/eject/files/sidebar.ts +75 -0
- package/eject/files/skeleton.ts +51 -0
- package/eject/files/slider.css +160 -0
- package/eject/files/slider.ts +80 -0
- package/eject/files/spinner.ts +22 -0
- package/eject/files/switch.ts +45 -0
- package/eject/files/table.css +107 -0
- package/eject/files/table.ts +84 -0
- package/eject/files/tabs.css +120 -0
- package/eject/files/tabs.ts +37 -0
- package/eject/files/text-field.css +225 -0
- package/eject/files/text-field.ts +64 -0
- package/eject/files/text.ts +38 -0
- package/eject/files/thumbnail.ts +51 -0
- package/eject/files/time-picker.ts +113 -0
- package/eject/files/toast-queue.ts +64 -0
- package/eject/files/toast.ts +31 -0
- package/eject/files/tooltip.css +111 -0
- package/eject/files/tooltip.ts +21 -0
- package/eject/manifest.json +1122 -0
- package/package.json +11 -4
- package/styles.css +1135 -167
- package/tailwind.css +1295 -218
|
@@ -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
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import TimePicker_vue_vue_type_script_setup_true_lang_default from "./TimePicker.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
// packages/ui-vue/src/TimePicker.vue
|
|
3
|
+
var TimePicker_default = TimePicker_vue_vue_type_script_setup_true_lang_default;
|
|
4
|
+
export { TimePicker_default as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type TimePickerBaseProps } from "@xds/core";
|
|
2
|
+
export type { IsoTime } from "@xds/core";
|
|
3
|
+
export type TimePickerProps = TimePickerBaseProps;
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<TimePickerBaseProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
5
|
+
"update:value": (value: string) => any;
|
|
6
|
+
}, string, import("vue").PublicProps, Readonly<TimePickerBaseProps> & Readonly<{
|
|
7
|
+
"onUpdate:value"?: ((value: string) => any) | undefined;
|
|
8
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { useControllable, useFormReset } from "./controlled.js";
|
|
2
|
+
import Icon_default from "./Icon.js";
|
|
3
|
+
import { useModalPopover } from "./modal-popover.js";
|
|
4
|
+
import Portal_default from "./Portal.js";
|
|
5
|
+
import { usePresence } from "./presence.js";
|
|
6
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeStyle, openBlock, renderList, toDisplayString, unref, useId, useTemplateRef, withCtx, withModifiers } from "vue";
|
|
7
|
+
import { keepListKeys, readCssPx, timeOptions, timePickerIds, timePickerLocale, underlayLayerStyle } from "@xds/core";
|
|
8
|
+
import { normalizeProps as normalizeProps$1, useMachine } from "@zag-js/vue";
|
|
9
|
+
import { space } from "@xds/tokens";
|
|
10
|
+
import * as select from "@zag-js/select";
|
|
11
|
+
// packages/ui-vue/src/TimePicker.vue?vue&type=script&setup=true&lang.ts
|
|
12
|
+
var _hoisted_1 = ["aria-labelledby", "aria-describedby"];
|
|
13
|
+
var _hoisted_2 = ["id"];
|
|
14
|
+
var _hoisted_3 = { class: "xds-time-picker__footer" };
|
|
15
|
+
var _hoisted_4 = ["id"];
|
|
16
|
+
var _hoisted_5 = ["id"];
|
|
17
|
+
var _hoisted_6 = ["name", "value"];
|
|
18
|
+
var _hoisted_7 = ["hidden"];
|
|
19
|
+
var _hoisted_8 = { class: "xds-time-picker__item-words" };
|
|
20
|
+
var TimePicker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
21
|
+
__name: "TimePicker",
|
|
22
|
+
props: {
|
|
23
|
+
label: {},
|
|
24
|
+
value: {},
|
|
25
|
+
defaultValue: {},
|
|
26
|
+
min: {},
|
|
27
|
+
max: {},
|
|
28
|
+
step: {},
|
|
29
|
+
placeholder: {},
|
|
30
|
+
description: {},
|
|
31
|
+
error: {},
|
|
32
|
+
name: {},
|
|
33
|
+
disabled: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false
|
|
36
|
+
},
|
|
37
|
+
locale: {}
|
|
38
|
+
},
|
|
39
|
+
emits: ["update:value"],
|
|
40
|
+
setup(__props, { emit: __emit }) {
|
|
41
|
+
const emit = __emit;
|
|
42
|
+
const { value, set, controlled, reset } = useControllable("value", () => __props.value, () => __props.defaultValue, (next) => {
|
|
43
|
+
if (next !== void 0) emit("update:value", next);
|
|
44
|
+
});
|
|
45
|
+
const root = useTemplateRef("root");
|
|
46
|
+
useFormReset(() => root.value, controlled, reset);
|
|
47
|
+
const id = useId();
|
|
48
|
+
const ids = timePickerIds(id);
|
|
49
|
+
const invalid = computed(() => __props.error !== void 0);
|
|
50
|
+
const options = computed(() => timeOptions({
|
|
51
|
+
min: __props.min,
|
|
52
|
+
max: __props.max,
|
|
53
|
+
step: __props.step,
|
|
54
|
+
value: value.value
|
|
55
|
+
}, timePickerLocale(__props.locale)));
|
|
56
|
+
const collection = computed(() => select.collection({
|
|
57
|
+
items: options.value,
|
|
58
|
+
itemToValue: (option) => option.value,
|
|
59
|
+
itemToString: (option) => option.label
|
|
60
|
+
}));
|
|
61
|
+
const service = useMachine(select.machine, computed(() => ({
|
|
62
|
+
id,
|
|
63
|
+
collection: collection.value,
|
|
64
|
+
value: value.value === void 0 ? [] : [value.value],
|
|
65
|
+
onValueChange: (details) => {
|
|
66
|
+
const next = details.value[0];
|
|
67
|
+
if (next !== void 0) set(next);
|
|
68
|
+
},
|
|
69
|
+
disabled: __props.disabled,
|
|
70
|
+
invalid: invalid.value,
|
|
71
|
+
positioning: {
|
|
72
|
+
placement: "bottom-start",
|
|
73
|
+
gutter: readCssPx(null, "--xds-space-1", space[1]),
|
|
74
|
+
sameWidth: true,
|
|
75
|
+
overflowPadding: readCssPx(null, "--xds-space-3", space[3])
|
|
76
|
+
}
|
|
77
|
+
})));
|
|
78
|
+
const api = computed(() => select.connect(service, normalizeProps$1));
|
|
79
|
+
const current = () => select.connect(service, normalizeProps$1);
|
|
80
|
+
const labelProps = computed(() => {
|
|
81
|
+
const { for: _, ...rest } = api.value.getLabelProps();
|
|
82
|
+
return rest;
|
|
83
|
+
});
|
|
84
|
+
const triggerProps = computed(() => {
|
|
85
|
+
const { role: _role, "aria-invalid": _invalid, "aria-required": _required, onKeydown: _onKeydown, ...rest } = api.value.getTriggerProps();
|
|
86
|
+
return {
|
|
87
|
+
...rest,
|
|
88
|
+
onKeydown: (event) => {
|
|
89
|
+
if (!api.value.open && (event.key === "Home" || event.key === "End")) return;
|
|
90
|
+
current().getTriggerProps().onKeydown?.(event);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
const positioner = useTemplateRef("positioner");
|
|
95
|
+
const surface = useTemplateRef("surface");
|
|
96
|
+
useModalPopover(() => api.value.open, () => positioner.value);
|
|
97
|
+
const present = usePresence(() => api.value.open, () => [surface.value]);
|
|
98
|
+
const content = computed(() => {
|
|
99
|
+
const { onKeydown: _onKeydown, ...rest } = api.value.getContentProps();
|
|
100
|
+
return {
|
|
101
|
+
...rest,
|
|
102
|
+
onKeydown: (event) => {
|
|
103
|
+
keepListKeys(event, surface.value, ".xds-time-picker__item:not([data-disabled])", (next) => api.value.setHighlightedValue(next));
|
|
104
|
+
current().getContentProps().onKeydown?.(event);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
return (_ctx, _cache) => {
|
|
109
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
110
|
+
ref_key: "root",
|
|
111
|
+
ref: root
|
|
112
|
+
}, api.value.getRootProps(), { class: "xds-time-picker" }), [
|
|
113
|
+
createElementVNode("span", mergeProps(labelProps.value, { class: "xds-time-picker__label" }), toDisplayString(__props.label), 17),
|
|
114
|
+
createElementVNode("button", mergeProps(triggerProps.value, {
|
|
115
|
+
"aria-labelledby": `${unref(ids).value} ${labelProps.value.id}`,
|
|
116
|
+
"aria-describedby": invalid.value ? unref(ids).error : __props.description ? unref(ids).description : void 0,
|
|
117
|
+
class: "xds-time-picker__trigger"
|
|
118
|
+
}), [createElementVNode("span", mergeProps(api.value.getValueTextProps(), {
|
|
119
|
+
id: unref(ids).value,
|
|
120
|
+
class: "xds-time-picker__value"
|
|
121
|
+
}), toDisplayString(api.value.valueAsString || __props.placeholder), 17, _hoisted_2), createVNode(Icon_default, {
|
|
122
|
+
name: "clock",
|
|
123
|
+
size: "sm",
|
|
124
|
+
class: "text-xds-field-placeholder"
|
|
125
|
+
})], 16, _hoisted_1),
|
|
126
|
+
createElementVNode("div", _hoisted_3, [!invalid.value && __props.description ? (openBlock(), createElementBlock("span", {
|
|
127
|
+
key: 0,
|
|
128
|
+
id: unref(ids).description,
|
|
129
|
+
class: "xds-time-picker__description"
|
|
130
|
+
}, toDisplayString(__props.description), 9, _hoisted_4)) : createCommentVNode("", true), createElementVNode("span", {
|
|
131
|
+
id: unref(ids).error,
|
|
132
|
+
class: "xds-time-picker__error",
|
|
133
|
+
"aria-live": "polite"
|
|
134
|
+
}, toDisplayString(__props.error), 9, _hoisted_5)]),
|
|
135
|
+
__props.name !== void 0 ? (openBlock(), createElementBlock("input", {
|
|
136
|
+
key: 0,
|
|
137
|
+
type: "hidden",
|
|
138
|
+
name: __props.name,
|
|
139
|
+
value: unref(value) ?? ""
|
|
140
|
+
}, null, 8, _hoisted_6)) : createCommentVNode("", true),
|
|
141
|
+
createVNode(Portal_default, null, {
|
|
142
|
+
default: withCtx(() => [api.value.open ? (openBlock(), createElementBlock("div", {
|
|
143
|
+
key: 0,
|
|
144
|
+
class: "xds-time-picker__underlay",
|
|
145
|
+
style: normalizeStyle(unref(underlayLayerStyle)(api.value.getPositionerProps().style)),
|
|
146
|
+
onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"]))
|
|
147
|
+
}, null, 36)) : createCommentVNode("", true), createElementVNode("div", mergeProps({
|
|
148
|
+
ref_key: "positioner",
|
|
149
|
+
ref: positioner
|
|
150
|
+
}, api.value.getPositionerProps(), { class: "xds-time-picker__positioner" }), [createElementVNode("div", mergeProps(content.value, {
|
|
151
|
+
ref_key: "surface",
|
|
152
|
+
ref: surface,
|
|
153
|
+
hidden: !unref(present),
|
|
154
|
+
class: "xds-time-picker__content"
|
|
155
|
+
}), [createElementVNode("div", mergeProps(api.value.getListProps(), { class: "xds-time-picker__list" }), [(openBlock(true), createElementBlock(Fragment, null, renderList(collection.value.items, (option) => {
|
|
156
|
+
return openBlock(), createElementBlock("div", mergeProps({ key: option.value }, { ref_for: true }, api.value.getItemProps({ item: option }), { class: "xds-time-picker__item" }), [createElementVNode("span", _hoisted_8, [createElementVNode("span", mergeProps({ ref_for: true }, api.value.getItemTextProps({ item: option }), { class: "xds-time-picker__item-label" }), toDisplayString(option.label), 17)]), api.value.getItemState({ item: option }).selected ? (openBlock(), createBlock(Icon_default, {
|
|
157
|
+
key: 0,
|
|
158
|
+
name: "check",
|
|
159
|
+
size: "sm"
|
|
160
|
+
})) : createCommentVNode("", true)], 16);
|
|
161
|
+
}), 128))], 16)], 16, _hoisted_7)], 16)]),
|
|
162
|
+
_: 1
|
|
163
|
+
})
|
|
164
|
+
], 16);
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
export { TimePicker_vue_vue_type_script_setup_true_lang_default as default };
|
|
@@ -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
|
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import ToastQueue_vue_vue_type_script_setup_true_lang_default from "./ToastQueue.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
// packages/ui-vue/src/ToastQueue.vue
|
|
3
|
+
var ToastQueue_default = ToastQueue_vue_vue_type_script_setup_true_lang_default;
|
|
4
|
+
export { ToastQueue_default as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ToastQueueBaseProps } from "@xds/core";
|
|
2
|
+
export type ToastQueueProps = ToastQueueBaseProps;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<ToastQueueBaseProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
4
|
+
close: (id: string | number) => any;
|
|
5
|
+
}, string, import("vue").PublicProps, Readonly<ToastQueueBaseProps> & Readonly<{
|
|
6
|
+
onClose?: ((id: string | number) => any) | undefined;
|
|
7
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import Toast_default from "./Toast.js";
|
|
2
|
+
import { computed, createBlock, defineComponent, openBlock, ref, watch } from "vue";
|
|
3
|
+
import { readCssMs, toastQueueStep } from "@xds/core";
|
|
4
|
+
import { motion } from "@xds/tokens";
|
|
5
|
+
// packages/ui-vue/src/ToastQueue.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var ToastQueue_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
7
|
+
__name: "ToastQueue",
|
|
8
|
+
props: { toasts: {} },
|
|
9
|
+
emits: ["close"],
|
|
10
|
+
setup(__props, { emit: __emit }) {
|
|
11
|
+
const props = __props;
|
|
12
|
+
const emit = __emit;
|
|
13
|
+
const visible = ref();
|
|
14
|
+
const step = computed(() => toastQueueStep(props.toasts, visible.value));
|
|
15
|
+
const shown = computed(() => step.value === "keep" ? props.toasts[0] : void 0);
|
|
16
|
+
watch([step, () => props.toasts[0]], ([current, first], _, onCleanup) => {
|
|
17
|
+
if (current === "close") {
|
|
18
|
+
visible.value = void 0;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (current !== "wait" || first === void 0) return;
|
|
22
|
+
const gap = readCssMs(null, "--xds-motion-duration-normal", motion.duration.normal);
|
|
23
|
+
const timer = setTimeout(() => visible.value = first.id, gap);
|
|
24
|
+
onCleanup(() => clearTimeout(timer));
|
|
25
|
+
}, { immediate: true });
|
|
26
|
+
return (_ctx, _cache) => {
|
|
27
|
+
return openBlock(), createBlock(Toast_default, {
|
|
28
|
+
open: shown.value !== void 0,
|
|
29
|
+
message: shown.value?.message ?? "",
|
|
30
|
+
action: shown.value?.action,
|
|
31
|
+
duration: shown.value?.duration,
|
|
32
|
+
onClose: _cache[0] || (_cache[0] = ($event) => shown.value !== void 0 && emit("close", shown.value.id))
|
|
33
|
+
}, null, 8, [
|
|
34
|
+
"open",
|
|
35
|
+
"message",
|
|
36
|
+
"action",
|
|
37
|
+
"duration"
|
|
38
|
+
]);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
export { ToastQueue_vue_vue_type_script_setup_true_lang_default as default };
|
|
@@ -3,7 +3,7 @@ import { usePresence } from "./presence.js";
|
|
|
3
3
|
import { TriggerScope } from "./trigger.js";
|
|
4
4
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, openBlock, renderSlot, toDisplayString, unref, useId, useTemplateRef, withCtx } from "vue";
|
|
5
5
|
import { readCssMs, readCssPx } from "@xds/core";
|
|
6
|
-
import { normalizeProps as normalizeProps$1, useMachine } from "@zag-js/vue";
|
|
6
|
+
import { mergeProps as mergeProps$1, normalizeProps as normalizeProps$1, useMachine } from "@zag-js/vue";
|
|
7
7
|
import { motion, space } from "@xds/tokens";
|
|
8
8
|
import * as tooltip from "@zag-js/tooltip";
|
|
9
9
|
// packages/ui-vue/src/TooltipOverlay.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -17,12 +17,14 @@ var TooltipOverlay_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
|
|
|
17
17
|
props: {
|
|
18
18
|
label: {},
|
|
19
19
|
shortcut: {},
|
|
20
|
-
placement: {}
|
|
20
|
+
placement: {},
|
|
21
|
+
id: {}
|
|
21
22
|
},
|
|
22
23
|
setup(__props) {
|
|
23
24
|
const id = useId();
|
|
24
25
|
const service = useMachine(tooltip.machine, computed(() => ({
|
|
25
26
|
id,
|
|
27
|
+
ids: { content: __props.id },
|
|
26
28
|
openDelay: readCssMs(null, "--xds-motion-duration-tooltip-delay", motion.duration.tooltipDelay),
|
|
27
29
|
closeDelay: 0,
|
|
28
30
|
closeOnScroll: false,
|
|
@@ -41,12 +43,11 @@ var TooltipOverlay_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
|
|
|
41
43
|
_: 3
|
|
42
44
|
}, 8, ["trigger"]), unref(present) ? (openBlock(), createBlock(Portal_default, { key: 0 }, {
|
|
43
45
|
default: withCtx(() => [createVNode(unref(TriggerScope), { trigger: null }, {
|
|
44
|
-
default: withCtx(() => [createElementVNode("div", mergeProps(api.value.getPositionerProps(), { class: "xds-tooltip__positioner" }), [createElementVNode("div", mergeProps(api.value.getContentProps(), {
|
|
46
|
+
default: withCtx(() => [createElementVNode("div", mergeProps(api.value.getPositionerProps(), { class: "xds-tooltip__positioner" }), [createElementVNode("div", mergeProps(unref(mergeProps$1)(api.value.getContentProps(), _ctx.$attrs), {
|
|
45
47
|
ref_key: "content",
|
|
46
48
|
ref: content,
|
|
47
49
|
hidden: false,
|
|
48
|
-
class:
|
|
49
|
-
style: _ctx.$attrs.style
|
|
50
|
+
class: "xds-tooltip"
|
|
50
51
|
}), [createTextVNode(toDisplayString(__props.label), 1), __props.shortcut ? (openBlock(), createElementBlock("kbd", _hoisted_1, toDisplayString(__props.shortcut), 1)) : createCommentVNode("", true)], 16)], 16)]),
|
|
51
52
|
_: 1
|
|
52
53
|
})]),
|
package/dist/base.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { default as PlaceRow } from "./PlaceRow.vue";
|
|
2
|
+
export { default as Portal } from "./Portal.vue";
|
|
3
|
+
export { default as TooltipOverlay } from "./TooltipOverlay.vue";
|
|
4
|
+
export { focusable, formDefault, keepChecked, keepValue, useControllable, useFormReset, } from "./controlled.ts";
|
|
5
|
+
export { useDefaults } from "./defaults.ts";
|
|
6
|
+
export { useLabels } from "./labels.ts";
|
|
7
|
+
export { useModalPopover } from "./modal-popover.ts";
|
|
8
|
+
export { usePicture } from "./picture.ts";
|
|
9
|
+
export { usePresence } from "./presence.ts";
|
|
10
|
+
export { type TriggerProps, TriggerScope, useTrigger, withAttributes } from "./trigger.ts";
|
|
11
|
+
export { Wrap } from "./wrap.ts";
|
|
12
|
+
export { type IconName, icons, motion, space } from "@xds/tokens";
|
|
13
|
+
export { AVATAR_SIZE, type AvatarSize, afterAnimations, buttonClass, type ComponentLabels, DEFAULT_LABELS, focusWithoutRing, type IconSize, initials, keepListKeys, leaveEscapeToFields, PEER_FOCUS, PRESSABLE_ROW, pictureClass, readCssMs, readCssPx, type SelectOption, selectOptionIds, switchClass, switchLabelClass, type ThumbnailRatio, type ToastAction, tooltipEndSide, underlayLayerStyle, } from "@xds/core";
|
package/dist/base.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import PlaceRow_default from "./PlaceRow.js";
|
|
2
|
+
import Portal_default from "./Portal.js";
|
|
3
|
+
import TooltipOverlay_default from "./TooltipOverlay.js";
|
|
4
|
+
import { focusable, formDefault, keepChecked, keepValue, useControllable, useFormReset } from "./controlled.js";
|
|
5
|
+
import { useDefaults } from "./defaults.js";
|
|
6
|
+
import { useLabels } from "./labels.js";
|
|
7
|
+
import { useModalPopover } from "./modal-popover.js";
|
|
8
|
+
import { usePicture } from "./picture.js";
|
|
9
|
+
import { usePresence } from "./presence.js";
|
|
10
|
+
import { TriggerScope, useTrigger, withAttributes } from "./trigger.js";
|
|
11
|
+
import { Wrap } from "./wrap.js";
|
|
12
|
+
import { AVATAR_SIZE, DEFAULT_LABELS, PEER_FOCUS, PRESSABLE_ROW, afterAnimations, buttonClass, focusWithoutRing, initials, keepListKeys, leaveEscapeToFields, pictureClass, readCssMs, readCssPx, selectOptionIds, switchClass, switchLabelClass, tooltipEndSide, underlayLayerStyle } from "@xds/core";
|
|
13
|
+
import { icons, motion, space } from "@xds/tokens";
|
|
14
|
+
export { AVATAR_SIZE, DEFAULT_LABELS, PEER_FOCUS, PRESSABLE_ROW, PlaceRow_default as PlaceRow, Portal_default as Portal, TooltipOverlay_default as TooltipOverlay, TriggerScope, Wrap, afterAnimations, buttonClass, focusWithoutRing, focusable, formDefault, icons, initials, keepChecked, keepListKeys, keepValue, leaveEscapeToFields, motion, pictureClass, readCssMs, readCssPx, selectOptionIds, space, switchClass, switchLabelClass, tooltipEndSide, underlayLayerStyle, useControllable, useDefaults, useFormReset, useLabels, useModalPopover, usePicture, usePresence, useTrigger, withAttributes };
|
package/dist/controlled.d.ts
CHANGED
|
@@ -1,4 +1,50 @@
|
|
|
1
|
+
import { type ComputedRef } from "vue";
|
|
1
2
|
/** After the model's update: puts the owner's value back into a field that did not take it. */
|
|
2
3
|
export declare function keepValue(element: HTMLInputElement | HTMLTextAreaElement, value: () => string): void;
|
|
3
4
|
/** After the model's update: puts the owner's state back into a checkbox or radio. */
|
|
4
5
|
export declare function keepChecked(element: HTMLInputElement, checked: () => boolean): void;
|
|
6
|
+
/**
|
|
7
|
+
* The state of a control that the app may keep or leave to it. It is the app's while the app
|
|
8
|
+
* gives the prop `name`, even as `undefined`, and the control's own otherwise, from `initial`.
|
|
9
|
+
* Either way a change goes to `emit`, the update event of `v-model:<name>`.
|
|
10
|
+
*
|
|
11
|
+
* Not defineModel, which keeps a value of its own whenever the owner does not both give the prop
|
|
12
|
+
* and listen to its update: a control given a value and no listener would then change, where
|
|
13
|
+
* every web library shows the value it is given. Its own value starts from another prop, the
|
|
14
|
+
* default, which defineModel's default cannot read.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useControllable<T>(name: string, given: () => T | undefined, initial: () => T, emit: (value: T) => void): {
|
|
17
|
+
value: ComputedRef<T>;
|
|
18
|
+
controlled: () => boolean;
|
|
19
|
+
set: (next: T) => void;
|
|
20
|
+
reset: () => void;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Sets a control that keeps its own state back to its default when its form is reset, as the
|
|
24
|
+
* form sets the native field back. A controlled one shows what its owner gives it, whatever the
|
|
25
|
+
* form does.
|
|
26
|
+
*
|
|
27
|
+
* The form sets a field back to its `defaultValue` or `defaultChecked`, which the controls keep
|
|
28
|
+
* equal to what they show, as React does: Vue writes neither, and a field the form emptied while
|
|
29
|
+
* its state stayed the same would not be drawn again. The form's reset then leaves the field as
|
|
30
|
+
* it is, and this sets the state, and so the field, back to the component's default.
|
|
31
|
+
*/
|
|
32
|
+
export declare function useFormReset(element: () => Element | null | undefined, controlled: () => boolean, reset: () => void): void;
|
|
33
|
+
/**
|
|
34
|
+
* A native field's default, which `useFormReset` keeps equal to its state. Vue's types for the
|
|
35
|
+
* DOM list neither property, which Vue sets as a property all the same. Bind it with `v-bind`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function formDefault(attributes: {
|
|
38
|
+
defaultValue: string;
|
|
39
|
+
} | {
|
|
40
|
+
defaultChecked: boolean;
|
|
41
|
+
}): Record<string, unknown>;
|
|
42
|
+
/**
|
|
43
|
+
* What a component that is focused through a native element exposes on its instance: `focus`,
|
|
44
|
+
* `blur`, and `element`, which returns the element itself, as React's `ref` reaches it.
|
|
45
|
+
*/
|
|
46
|
+
export declare function focusable<E extends HTMLElement>(element: () => E | null | undefined): {
|
|
47
|
+
focus: (options?: FocusOptions) => void | undefined;
|
|
48
|
+
blur: () => void | undefined;
|
|
49
|
+
element: () => E | null;
|
|
50
|
+
};
|
package/dist/controlled.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { nextTick } from "vue";
|
|
1
|
+
import { computed, getCurrentInstance, nextTick, onBeforeUnmount, onMounted, shallowRef } from "vue";
|
|
2
|
+
import { isControlled, onFormReset } from "@xds/core";
|
|
2
3
|
// packages/ui-vue/src/controlled.ts
|
|
3
4
|
/** After the model's update: puts the owner's value back into a field that did not take it. */
|
|
4
5
|
function keepValue(element, value) {
|
|
@@ -12,4 +13,65 @@ function keepChecked(element, checked) {
|
|
|
12
13
|
if (element.checked !== checked()) element.checked = checked();
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* The state of a control that the app may keep or leave to it. It is the app's while the app
|
|
18
|
+
* gives the prop `name`, even as `undefined`, and the control's own otherwise, from `initial`.
|
|
19
|
+
* Either way a change goes to `emit`, the update event of `v-model:<name>`.
|
|
20
|
+
*
|
|
21
|
+
* Not defineModel, which keeps a value of its own whenever the owner does not both give the prop
|
|
22
|
+
* and listen to its update: a control given a value and no listener would then change, where
|
|
23
|
+
* every web library shows the value it is given. Its own value starts from another prop, the
|
|
24
|
+
* default, which defineModel's default cannot read.
|
|
25
|
+
*/
|
|
26
|
+
function useControllable(name, given, initial, emit) {
|
|
27
|
+
const instance = getCurrentInstance();
|
|
28
|
+
const controlled = () => isControlled(instance?.vnode.props ?? {}, name);
|
|
29
|
+
const own = shallowRef(initial());
|
|
30
|
+
return {
|
|
31
|
+
value: computed(() => controlled() ? given() : own.value),
|
|
32
|
+
controlled,
|
|
33
|
+
set: (next) => {
|
|
34
|
+
if (!controlled()) own.value = next;
|
|
35
|
+
emit(next);
|
|
36
|
+
},
|
|
37
|
+
reset: () => {
|
|
38
|
+
own.value = initial();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Sets a control that keeps its own state back to its default when its form is reset, as the
|
|
44
|
+
* form sets the native field back. A controlled one shows what its owner gives it, whatever the
|
|
45
|
+
* form does.
|
|
46
|
+
*
|
|
47
|
+
* The form sets a field back to its `defaultValue` or `defaultChecked`, which the controls keep
|
|
48
|
+
* equal to what they show, as React does: Vue writes neither, and a field the form emptied while
|
|
49
|
+
* its state stayed the same would not be drawn again. The form's reset then leaves the field as
|
|
50
|
+
* it is, and this sets the state, and so the field, back to the component's default.
|
|
51
|
+
*/
|
|
52
|
+
function useFormReset(element, controlled, reset) {
|
|
53
|
+
let stop;
|
|
54
|
+
onMounted(() => {
|
|
55
|
+
if (!controlled()) stop = onFormReset(element(), reset);
|
|
56
|
+
});
|
|
57
|
+
onBeforeUnmount(() => stop?.());
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A native field's default, which `useFormReset` keeps equal to its state. Vue's types for the
|
|
61
|
+
* DOM list neither property, which Vue sets as a property all the same. Bind it with `v-bind`.
|
|
62
|
+
*/
|
|
63
|
+
function formDefault(attributes) {
|
|
64
|
+
return attributes;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* What a component that is focused through a native element exposes on its instance: `focus`,
|
|
68
|
+
* `blur`, and `element`, which returns the element itself, as React's `ref` reaches it.
|
|
69
|
+
*/
|
|
70
|
+
function focusable(element) {
|
|
71
|
+
return {
|
|
72
|
+
focus: (options) => element()?.focus(options),
|
|
73
|
+
blur: () => element()?.blur(),
|
|
74
|
+
element: () => element() ?? null
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export { focusable, formDefault, keepChecked, keepValue, useControllable, useFormReset };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
|
-
export type { IconName, IconSize, TextTone, TextVariant } from "@xds/core";
|
|
2
1
|
export { default as Accordion, type AccordionItem, type AccordionProps } from "./Accordion.vue";
|
|
3
2
|
export { default as Avatar, type AvatarProps, type AvatarSize } from "./Avatar.vue";
|
|
4
3
|
export { default as AvatarStack, type AvatarStackProps } from "./AvatarStack.vue";
|
|
5
4
|
export { default as Badge, type BadgeProps, type BadgeTone } from "./Badge.vue";
|
|
6
5
|
export { default as Banner, type BannerProps, type BannerTone } from "./Banner.vue";
|
|
6
|
+
export { type BreadcrumbItem, type BreadcrumbProps, default as Breadcrumb } from "./Breadcrumb.vue";
|
|
7
7
|
export { default as Button, type ButtonProps } from "./Button.vue";
|
|
8
|
-
export type { ButtonVariant, ControlSize } from "@xds/core";
|
|
9
8
|
export { default as Card, type CardProps } from "./Card.vue";
|
|
10
9
|
export { default as Checkbox, type CheckboxProps } from "./Checkbox.vue";
|
|
11
10
|
export { default as Chip, type ChipProps } from "./Chip.vue";
|
|
12
11
|
export { default as ChipBar, type ChipBarProps } from "./ChipBar.vue";
|
|
12
|
+
export { default as Combobox, type ComboboxProps } from "./Combobox.vue";
|
|
13
13
|
export { default as CountBadge, type CountBadgeProps } from "./CountBadge.vue";
|
|
14
14
|
export { default as DatePicker, type DatePickerProps, type IsoDate } from "./DatePicker.vue";
|
|
15
15
|
export { type DateRange, default as DateRangePicker, type DateRangePickerProps, } from "./DateRangePicker.vue";
|
|
16
|
-
export type { ComponentDefaults } from "@xds/core";
|
|
17
16
|
export { default as Defaults, type DefaultsProps } from "./Defaults.vue";
|
|
18
17
|
export { default as Dialog, type DialogProps } from "./Dialog.vue";
|
|
19
18
|
export { default as Divider, type DividerProps } from "./Divider.vue";
|
|
20
19
|
export { default as EmptyState, type EmptyStateProps } from "./EmptyState.vue";
|
|
21
20
|
export { default as Icon, type IconProps } from "./Icon.vue";
|
|
22
21
|
export { default as IconButton, type IconButtonProps } from "./IconButton.vue";
|
|
22
|
+
export { default as Labels, type LabelsProps } from "./Labels.vue";
|
|
23
|
+
export { default as Link, type LinkProps } from "./Link.vue";
|
|
23
24
|
export { default as ListRow, type ListRowProps } from "./ListRow.vue";
|
|
24
25
|
export { default as MediaCard, type MediaCardProps } from "./MediaCard.vue";
|
|
25
26
|
export { default as Menu, type MenuItem, type MenuProps } from "./Menu.vue";
|
|
27
|
+
export { default as Pagination, type PaginationProps } from "./Pagination.vue";
|
|
28
|
+
export { default as Popover, type PopoverProps } from "./Popover.vue";
|
|
26
29
|
export { default as ProgressBar, type ProgressBarProps } from "./ProgressBar.vue";
|
|
27
30
|
export { default as RadioGroup, type RadioGroupProps, type RadioOption } from "./RadioGroup.vue";
|
|
28
31
|
export { default as SearchField, type SearchFieldProps } from "./SearchField.vue";
|
|
@@ -34,9 +37,17 @@ export { default as Skeleton, type SkeletonProps } from "./Skeleton.vue";
|
|
|
34
37
|
export { default as Slider, type SliderProps } from "./Slider.vue";
|
|
35
38
|
export { default as Spinner, type SpinnerProps } from "./Spinner.vue";
|
|
36
39
|
export { default as Switch, type SwitchProps } from "./Switch.vue";
|
|
40
|
+
export { type SortDirection, default as Table, type TableColumn, type TableProps, type TableRow, type TableSort, } from "./Table.vue";
|
|
37
41
|
export { default as Tabs, type TabsProps } from "./Tabs.vue";
|
|
38
42
|
export { default as Text, type TextProps } from "./Text.vue";
|
|
39
43
|
export { default as TextField, type TextFieldProps } from "./TextField.vue";
|
|
40
44
|
export { default as Thumbnail, type ThumbnailProps, type ThumbnailRatio } from "./Thumbnail.vue";
|
|
45
|
+
export { type IsoTime, default as TimePicker, type TimePickerProps } from "./TimePicker.vue";
|
|
41
46
|
export { default as Toast, type ToastProps } from "./Toast.vue";
|
|
47
|
+
export { default as ToastQueue, type ToastQueueProps } from "./ToastQueue.vue";
|
|
42
48
|
export { default as Tooltip, type TooltipProps } from "./Tooltip.vue";
|
|
49
|
+
export type { ButtonVariant, ControlSize } from "@xds/core";
|
|
50
|
+
export type { ComponentDefaults } from "@xds/core";
|
|
51
|
+
export type { ComponentLabels } from "@xds/core";
|
|
52
|
+
export type { IconName, IconSize, TextTone, TextVariant } from "@xds/core";
|
|
53
|
+
export { type QueuedToast, queueToast } from "@xds/core";
|