@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,11 +1,13 @@
|
|
|
1
|
+
import { focusable } from "./controlled.js";
|
|
1
2
|
import { useDefaults } from "./defaults.js";
|
|
2
3
|
import Icon_default from "./Icon.js";
|
|
3
4
|
import Spinner_default from "./Spinner.js";
|
|
4
|
-
import { useTrigger } from "./trigger.js";
|
|
5
|
-
import { createBlock, createElementBlock, createVNode, defineComponent,
|
|
5
|
+
import { useTrigger, withAttributes } from "./trigger.js";
|
|
6
|
+
import { createBlock, createElementBlock, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, unref, useTemplateRef } from "vue";
|
|
6
7
|
import { ICON_BUTTON_BOX, buttonClass, isHeld } from "@xds/core";
|
|
7
8
|
// packages/ui-vue/src/IconButton.vue?vue&type=script&setup=true&lang.ts
|
|
8
9
|
var IconButton_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
10
|
+
inheritAttrs: false,
|
|
9
11
|
__name: "IconButton",
|
|
10
12
|
props: {
|
|
11
13
|
icon: {},
|
|
@@ -25,9 +27,15 @@ var IconButton_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
25
27
|
default: false
|
|
26
28
|
}
|
|
27
29
|
},
|
|
28
|
-
emits: [
|
|
29
|
-
|
|
30
|
+
emits: [
|
|
31
|
+
"press",
|
|
32
|
+
"focus",
|
|
33
|
+
"blur"
|
|
34
|
+
],
|
|
35
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
30
36
|
const emit = __emit;
|
|
37
|
+
const button = useTemplateRef("button");
|
|
38
|
+
__expose(focusable(() => button.value));
|
|
31
39
|
const options = useDefaults("IconButton", () => ({
|
|
32
40
|
variant: __props.variant,
|
|
33
41
|
size: __props.size
|
|
@@ -46,12 +54,17 @@ var IconButton_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
46
54
|
"data-pending": __props.loading ? "" : void 0,
|
|
47
55
|
"aria-pressed": __props.selected === void 0 ? void 0 : __props.selected ? "true" : "false",
|
|
48
56
|
"aria-label": __props.label,
|
|
57
|
+
onFocus: (event) => emit("focus", event),
|
|
58
|
+
onBlur: (event) => emit("blur", event),
|
|
49
59
|
onClick: () => {
|
|
50
60
|
if (!__props.loading) emit("press");
|
|
51
61
|
}
|
|
52
62
|
}), () => __props.loading);
|
|
53
63
|
return (_ctx, _cache) => {
|
|
54
|
-
return openBlock(), createElementBlock("button",
|
|
64
|
+
return openBlock(), createElementBlock("button", mergeProps({
|
|
65
|
+
ref_key: "button",
|
|
66
|
+
ref: button
|
|
67
|
+
}, unref(withAttributes)(unref(attributes), _ctx.$attrs)), [__props.loading ? (openBlock(), createElementBlock("span", {
|
|
55
68
|
key: 0,
|
|
56
69
|
class: normalizeClass(unref(ICON_BUTTON_BOX)[unref(options).size])
|
|
57
70
|
}, [createVNode(Spinner_default, { size: "sm" })], 2)) : (openBlock(), createBlock(Icon_default, {
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ComponentLabels } from "@xds/core";
|
|
2
|
+
export type LabelsProps = {
|
|
3
|
+
/** The labels, by key: `{ dismiss: "닫기", clear: "지우기" }`. */
|
|
4
|
+
value: Partial<ComponentLabels>;
|
|
5
|
+
};
|
|
6
|
+
type __VLS_Slots = {
|
|
7
|
+
default(): unknown;
|
|
8
|
+
};
|
|
9
|
+
declare const __VLS_base: import("vue").DefineComponent<LabelsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LabelsProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { provideLabels } from "./labels.js";
|
|
2
|
+
import { defineComponent, renderSlot } from "vue";
|
|
3
|
+
// packages/ui-vue/src/Labels.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var Labels_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
5
|
+
__name: "Labels",
|
|
6
|
+
props: { value: {} },
|
|
7
|
+
setup(__props) {
|
|
8
|
+
provideLabels(() => __props.value);
|
|
9
|
+
return (_ctx, _cache) => {
|
|
10
|
+
return renderSlot(_ctx.$slots, "default");
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
export { Labels_vue_vue_type_script_setup_true_lang_default as default };
|
package/dist/Labels2.js
ADDED
package/dist/Link.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type LinkBaseProps } from "@xds/core";
|
|
2
|
+
export type LinkProps = LinkBaseProps;
|
|
3
|
+
type __VLS_Slots = {
|
|
4
|
+
/** The text, which names the link. */
|
|
5
|
+
default(): unknown;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_base: import("vue").DefineComponent<LinkBaseProps, {
|
|
8
|
+
focus: (options?: FocusOptions) => void | undefined;
|
|
9
|
+
blur: () => void | undefined;
|
|
10
|
+
element: () => HTMLElement | null;
|
|
11
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
blur: (event: FocusEvent) => any;
|
|
13
|
+
focus: (event: FocusEvent) => any;
|
|
14
|
+
press: () => any;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<LinkBaseProps> & Readonly<{
|
|
16
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
17
|
+
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
18
|
+
onPress?: (() => any) | undefined;
|
|
19
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
23
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
24
|
+
new (): {
|
|
25
|
+
$slots: S;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { focusable } from "./controlled.js";
|
|
2
|
+
import Icon_default from "./Icon.js";
|
|
3
|
+
import { computed, createBlock, createCommentVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderSlot, resolveDynamicComponent, unref, useTemplateRef, withCtx } from "vue";
|
|
4
|
+
import { LINK_ICON, LINK_PARTS, linkElement, rootPart } from "@xds/core";
|
|
5
|
+
// packages/ui-vue/src/Link.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var Link_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
7
|
+
__name: "Link",
|
|
8
|
+
props: {
|
|
9
|
+
href: {},
|
|
10
|
+
external: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: false
|
|
13
|
+
},
|
|
14
|
+
disabled: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: false
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
emits: [
|
|
20
|
+
"press",
|
|
21
|
+
"focus",
|
|
22
|
+
"blur"
|
|
23
|
+
],
|
|
24
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
25
|
+
/** `press` comes before the browser follows `href`. A disabled link never sends it. */
|
|
26
|
+
const emit = __emit;
|
|
27
|
+
const root = useTemplateRef("root");
|
|
28
|
+
__expose(focusable(() => root.value));
|
|
29
|
+
const element = computed(() => linkElement({
|
|
30
|
+
href: __props.href,
|
|
31
|
+
external: __props.external,
|
|
32
|
+
disabled: __props.disabled
|
|
33
|
+
}));
|
|
34
|
+
function press() {
|
|
35
|
+
if (!__props.disabled) emit("press");
|
|
36
|
+
}
|
|
37
|
+
return (_ctx, _cache) => {
|
|
38
|
+
return openBlock(), createBlock(resolveDynamicComponent(element.value.tag), mergeProps({
|
|
39
|
+
ref_key: "root",
|
|
40
|
+
ref: root
|
|
41
|
+
}, element.value.attributes, {
|
|
42
|
+
class: unref(rootPart)("Link"),
|
|
43
|
+
onClick: press,
|
|
44
|
+
onFocus: _cache[0] || (_cache[0] = ($event) => emit("focus", $event)),
|
|
45
|
+
onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur", $event))
|
|
46
|
+
}), {
|
|
47
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "default"), __props.external ? (openBlock(), createBlock(Icon_default, {
|
|
48
|
+
key: 0,
|
|
49
|
+
name: unref(LINK_ICON).name,
|
|
50
|
+
size: unref(LINK_ICON).size,
|
|
51
|
+
class: normalizeClass(unref(LINK_PARTS).icon)
|
|
52
|
+
}, null, 8, [
|
|
53
|
+
"name",
|
|
54
|
+
"size",
|
|
55
|
+
"class"
|
|
56
|
+
])) : createCommentVNode("", true)]),
|
|
57
|
+
_: 3
|
|
58
|
+
}, 16, ["class"]);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
export { Link_vue_vue_type_script_setup_true_lang_default as default };
|
package/dist/Menu.vue.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { type MenuBaseProps } from "@xds/core";
|
|
2
2
|
export type { MenuItem } from "@xds/core";
|
|
3
3
|
export type MenuProps = MenuBaseProps;
|
|
4
|
+
type __VLS_Props = MenuProps & {
|
|
5
|
+
id?: string;
|
|
6
|
+
};
|
|
4
7
|
type __VLS_Slots = {
|
|
5
8
|
/** The control that opens the menu: a Button or an IconButton. */
|
|
6
9
|
trigger(): unknown;
|
|
7
10
|
};
|
|
8
|
-
declare const __VLS_base: import("vue").DefineComponent<
|
|
11
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
12
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
10
13
|
declare const _default: typeof __VLS_export;
|
|
11
14
|
export default _default;
|
|
@@ -17,12 +17,14 @@ var Menu_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
17
17
|
props: {
|
|
18
18
|
label: {},
|
|
19
19
|
items: {},
|
|
20
|
-
align: { default: "start" }
|
|
20
|
+
align: { default: "start" },
|
|
21
|
+
id: {}
|
|
21
22
|
},
|
|
22
23
|
setup(__props) {
|
|
23
24
|
const id = useId();
|
|
24
25
|
const service = useMachine(menu.machine, computed(() => ({
|
|
25
26
|
id,
|
|
27
|
+
ids: { content: __props.id },
|
|
26
28
|
"aria-label": __props.label,
|
|
27
29
|
positioning: {
|
|
28
30
|
placement: `bottom-${__props.align}`,
|
|
@@ -81,12 +83,11 @@ var Menu_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
|
|
|
81
83
|
}, null, 36)) : createCommentVNode("", true), createElementVNode("div", mergeProps({
|
|
82
84
|
ref_key: "positioner",
|
|
83
85
|
ref: positioner
|
|
84
|
-
}, api.value.getPositionerProps(), { class: "xds-menu__positioner" }), [createElementVNode("div", mergeProps(content.value, {
|
|
86
|
+
}, api.value.getPositionerProps(), { class: "xds-menu__positioner" }), [createElementVNode("div", mergeProps(unref(mergeProps$1)(content.value, _ctx.$attrs), {
|
|
85
87
|
ref_key: "surface",
|
|
86
88
|
ref: surface,
|
|
87
89
|
hidden: !unref(present),
|
|
88
|
-
class:
|
|
89
|
-
style: _ctx.$attrs.style
|
|
90
|
+
class: "xds-menu"
|
|
90
91
|
}), [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, index) => {
|
|
91
92
|
return openBlock(), createElementBlock(Fragment, { key: index }, [item === "separator" ? (openBlock(), createElementBlock("div", mergeProps({
|
|
92
93
|
key: 0,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import Pagination_vue_vue_type_script_setup_true_lang_default from "./Pagination.vue_vue_type_script_setup_true_lang.js";
|
|
2
|
+
// packages/ui-vue/src/Pagination.vue
|
|
3
|
+
var Pagination_default = Pagination_vue_vue_type_script_setup_true_lang_default;
|
|
4
|
+
export { Pagination_default as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type PaginationBaseProps } from "@xds/core";
|
|
2
|
+
export type PaginationProps = PaginationBaseProps;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<PaginationBaseProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
4
|
+
"update:value": (value: number) => any;
|
|
5
|
+
}, string, import("vue").PublicProps, Readonly<PaginationBaseProps> & Readonly<{
|
|
6
|
+
"onUpdate:value"?: ((value: number) => any) | undefined;
|
|
7
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
|
+
declare const _default: typeof __VLS_export;
|
|
9
|
+
export default _default;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { useControllable } from "./controlled.js";
|
|
2
|
+
import Icon_default from "./Icon.js";
|
|
3
|
+
import { useLabels } from "./labels.js";
|
|
4
|
+
import { Fragment, computed, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, renderList, toDisplayString, unref } from "vue";
|
|
5
|
+
import { PAGINATION_PARTS, PAGINATION_STEPS, clampPage, paginationEntries, rootPart } from "@xds/core";
|
|
6
|
+
// packages/ui-vue/src/Pagination.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var _hoisted_1 = ["aria-label"];
|
|
8
|
+
var _hoisted_2 = ["aria-label", "aria-disabled"];
|
|
9
|
+
var _hoisted_3 = ["aria-current", "onClick"];
|
|
10
|
+
var _hoisted_4 = ["aria-label", "aria-disabled"];
|
|
11
|
+
var Pagination_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
12
|
+
__name: "Pagination",
|
|
13
|
+
props: {
|
|
14
|
+
count: {},
|
|
15
|
+
value: {},
|
|
16
|
+
defaultValue: {},
|
|
17
|
+
label: {},
|
|
18
|
+
previousLabel: {},
|
|
19
|
+
nextLabel: {}
|
|
20
|
+
},
|
|
21
|
+
emits: ["update:value"],
|
|
22
|
+
setup(__props, { emit: __emit }) {
|
|
23
|
+
const emit = __emit;
|
|
24
|
+
const { value, set } = useControllable("value", () => __props.value, () => __props.defaultValue ?? 1, (next) => emit("update:value", next));
|
|
25
|
+
const labels = useLabels();
|
|
26
|
+
const page = computed(() => clampPage(value.value ?? 1, __props.count));
|
|
27
|
+
const last = computed(() => Math.max(1, Math.floor(__props.count)));
|
|
28
|
+
const entries = computed(() => paginationEntries(page.value, __props.count));
|
|
29
|
+
const go = (next) => {
|
|
30
|
+
if (next !== page.value && next >= 1 && next <= last.value) set(next);
|
|
31
|
+
};
|
|
32
|
+
return (_ctx, _cache) => {
|
|
33
|
+
return openBlock(), createElementBlock("nav", {
|
|
34
|
+
class: normalizeClass(unref(rootPart)("Pagination")),
|
|
35
|
+
"aria-label": __props.label ?? unref(labels).pagination
|
|
36
|
+
}, [createElementVNode("ul", { class: normalizeClass(unref(PAGINATION_PARTS).list) }, [
|
|
37
|
+
createElementVNode("li", null, [createElementVNode("button", {
|
|
38
|
+
type: "button",
|
|
39
|
+
class: normalizeClass(unref(PAGINATION_PARTS).step),
|
|
40
|
+
"aria-label": __props.previousLabel ?? unref(labels).previousPage,
|
|
41
|
+
"aria-disabled": page.value <= 1 ? true : void 0,
|
|
42
|
+
onClick: _cache[0] || (_cache[0] = ($event) => go(page.value - 1))
|
|
43
|
+
}, [createVNode(Icon_default, {
|
|
44
|
+
name: unref(PAGINATION_STEPS).previous,
|
|
45
|
+
size: unref(PAGINATION_STEPS).size
|
|
46
|
+
}, null, 8, ["name", "size"])], 10, _hoisted_2)]),
|
|
47
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(entries.value, (entry, index) => {
|
|
48
|
+
return openBlock(), createElementBlock("li", { key: entry === "gap" ? `gap-${index}` : entry }, [entry === "gap" ? (openBlock(), createElementBlock("span", {
|
|
49
|
+
key: 0,
|
|
50
|
+
class: normalizeClass(unref(PAGINATION_PARTS).gap),
|
|
51
|
+
"aria-hidden": "true"
|
|
52
|
+
}, "…", 2)) : (openBlock(), createElementBlock("button", {
|
|
53
|
+
key: 1,
|
|
54
|
+
type: "button",
|
|
55
|
+
class: normalizeClass(unref(PAGINATION_PARTS).page),
|
|
56
|
+
"aria-current": entry === page.value ? "page" : void 0,
|
|
57
|
+
onClick: ($event) => go(entry)
|
|
58
|
+
}, toDisplayString(entry), 11, _hoisted_3))]);
|
|
59
|
+
}), 128)),
|
|
60
|
+
createElementVNode("li", null, [createElementVNode("button", {
|
|
61
|
+
type: "button",
|
|
62
|
+
class: normalizeClass(unref(PAGINATION_PARTS).step),
|
|
63
|
+
"aria-label": __props.nextLabel ?? unref(labels).nextPage,
|
|
64
|
+
"aria-disabled": page.value >= last.value ? true : void 0,
|
|
65
|
+
onClick: _cache[1] || (_cache[1] = ($event) => go(page.value + 1))
|
|
66
|
+
}, [createVNode(Icon_default, {
|
|
67
|
+
name: unref(PAGINATION_STEPS).next,
|
|
68
|
+
size: unref(PAGINATION_STEPS).size
|
|
69
|
+
}, null, 8, ["name", "size"])], 10, _hoisted_4)])
|
|
70
|
+
], 2)], 10, _hoisted_1);
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
export { Pagination_vue_vue_type_script_setup_true_lang_default as default };
|
package/dist/Popover.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type PopoverBaseProps } from "@xds/core";
|
|
2
|
+
export type PopoverProps = PopoverBaseProps;
|
|
3
|
+
type __VLS_Props = PopoverProps & {
|
|
4
|
+
id?: string;
|
|
5
|
+
};
|
|
6
|
+
type __VLS_Slots = {
|
|
7
|
+
/** The control that opens it: a Button or an IconButton. */
|
|
8
|
+
trigger(): unknown;
|
|
9
|
+
/** What it holds: a few lines of text, a short form, actions. */
|
|
10
|
+
default?(): unknown;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
openChange: (open: boolean) => any;
|
|
14
|
+
"update:open": (open: boolean) => any;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
16
|
+
onOpenChange?: ((open: boolean) => any) | undefined;
|
|
17
|
+
"onUpdate:open"?: ((open: boolean) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
20
|
+
declare const _default: typeof __VLS_export;
|
|
21
|
+
export default _default;
|
|
22
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
23
|
+
new (): {
|
|
24
|
+
$slots: S;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useControllable } from "./controlled.js";
|
|
2
|
+
import IconButton_default from "./IconButton.js";
|
|
3
|
+
import { useLabels } from "./labels.js";
|
|
4
|
+
import Portal_default from "./Portal.js";
|
|
5
|
+
import { usePresence } from "./presence.js";
|
|
6
|
+
import { TriggerScope } from "./trigger.js";
|
|
7
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderSlot, toDisplayString, unref, useId, useTemplateRef, withCtx } from "vue";
|
|
8
|
+
import { POPOVER_PARTS, leaveEscapeToFields, readCssPx } from "@xds/core";
|
|
9
|
+
import { mergeProps as mergeProps$1, normalizeProps as normalizeProps$1, useMachine } from "@zag-js/vue";
|
|
10
|
+
import { space } from "@xds/tokens";
|
|
11
|
+
import * as popover from "@zag-js/popover";
|
|
12
|
+
// packages/ui-vue/src/Popover.vue?vue&type=script&setup=true&lang.ts
|
|
13
|
+
var Popover_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
14
|
+
inheritAttrs: false,
|
|
15
|
+
__name: "Popover",
|
|
16
|
+
props: {
|
|
17
|
+
title: {},
|
|
18
|
+
placement: { default: "bottom" },
|
|
19
|
+
closeLabel: {},
|
|
20
|
+
open: { type: Boolean },
|
|
21
|
+
defaultOpen: {
|
|
22
|
+
type: Boolean,
|
|
23
|
+
default: false
|
|
24
|
+
},
|
|
25
|
+
id: {}
|
|
26
|
+
},
|
|
27
|
+
emits: ["update:open", "openChange"],
|
|
28
|
+
setup(__props, { emit: __emit }) {
|
|
29
|
+
const emit = __emit;
|
|
30
|
+
const labels = useLabels();
|
|
31
|
+
const { value: open, set } = useControllable("open", () => __props.open, () => __props.defaultOpen, (next) => {
|
|
32
|
+
emit("update:open", next ?? false);
|
|
33
|
+
emit("openChange", next ?? false);
|
|
34
|
+
});
|
|
35
|
+
const content = useTemplateRef("content");
|
|
36
|
+
const id = useId();
|
|
37
|
+
const service = useMachine(popover.machine, computed(() => ({
|
|
38
|
+
id,
|
|
39
|
+
ids: { content: __props.id },
|
|
40
|
+
open: open.value ?? false,
|
|
41
|
+
onOpenChange: (details) => set(details.open),
|
|
42
|
+
positioning: {
|
|
43
|
+
placement: __props.placement,
|
|
44
|
+
gutter: readCssPx(null, "--xds-space-1", space[1])
|
|
45
|
+
},
|
|
46
|
+
onEscapeKeyDown: leaveEscapeToFields,
|
|
47
|
+
initialFocusEl: () => content.value
|
|
48
|
+
})));
|
|
49
|
+
const api = computed(() => popover.connect(service, normalizeProps$1));
|
|
50
|
+
const trigger = computed(() => mergeProps$1(api.value.getTriggerProps(), { class: POPOVER_PARTS.trigger }));
|
|
51
|
+
const present = usePresence(() => api.value.open, () => [content.value]);
|
|
52
|
+
return (_ctx, _cache) => {
|
|
53
|
+
return openBlock(), createElementBlock(Fragment, null, [createVNode(unref(TriggerScope), { trigger: trigger.value }, {
|
|
54
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "trigger")]),
|
|
55
|
+
_: 3
|
|
56
|
+
}, 8, ["trigger"]), unref(present) ? (openBlock(), createBlock(Portal_default, { key: 0 }, {
|
|
57
|
+
default: withCtx(() => [createVNode(unref(TriggerScope), { trigger: null }, {
|
|
58
|
+
default: withCtx(() => [createElementVNode("div", mergeProps(api.value.getPositionerProps(), { class: unref(POPOVER_PARTS).positioner }), [createElementVNode("section", mergeProps(unref(mergeProps$1)(api.value.getContentProps(), _ctx.$attrs), {
|
|
59
|
+
ref_key: "content",
|
|
60
|
+
ref: content,
|
|
61
|
+
hidden: false,
|
|
62
|
+
class: "xds-popover"
|
|
63
|
+
}), [createElementVNode("div", { class: normalizeClass(unref(POPOVER_PARTS).header) }, [createElementVNode("h2", mergeProps(api.value.getTitleProps(), { class: unref(POPOVER_PARTS).title }), toDisplayString(__props.title), 17), createVNode(IconButton_default, {
|
|
64
|
+
icon: "x",
|
|
65
|
+
label: __props.closeLabel ?? unref(labels).close,
|
|
66
|
+
variant: "ghost",
|
|
67
|
+
size: "sm",
|
|
68
|
+
class: normalizeClass(unref(POPOVER_PARTS).close),
|
|
69
|
+
onPress: _cache[0] || (_cache[0] = ($event) => api.value.setOpen(false))
|
|
70
|
+
}, null, 8, ["label", "class"])], 2), _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
|
|
71
|
+
key: 0,
|
|
72
|
+
class: normalizeClass(unref(POPOVER_PARTS).body)
|
|
73
|
+
}, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("", true)], 16)], 16)]),
|
|
74
|
+
_: 3
|
|
75
|
+
})]),
|
|
76
|
+
_: 3
|
|
77
|
+
})) : createCommentVNode("", true)], 64);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
export { Popover_vue_vue_type_script_setup_true_lang_default as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { keepChecked } from "./controlled.js";
|
|
2
|
-
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, openBlock, renderList, toDisplayString, unref, useId, useTemplateRef } from "vue";
|
|
1
|
+
import { formDefault, keepChecked, useControllable, useFormReset } from "./controlled.js";
|
|
2
|
+
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeProps, openBlock, renderList, toDisplayString, unref, useId, useTemplateRef } from "vue";
|
|
3
3
|
// packages/ui-vue/src/RadioGroup.vue?vue&type=script&setup=true&lang.ts
|
|
4
4
|
var _hoisted_1 = [
|
|
5
5
|
"aria-describedby",
|
|
@@ -28,6 +28,7 @@ var RadioGroup_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
28
28
|
label: {},
|
|
29
29
|
options: {},
|
|
30
30
|
value: {},
|
|
31
|
+
defaultValue: {},
|
|
31
32
|
disabled: {
|
|
32
33
|
type: Boolean,
|
|
33
34
|
default: false
|
|
@@ -43,10 +44,14 @@ var RadioGroup_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
43
44
|
const errorId = `${id}-error`;
|
|
44
45
|
const invalid = computed(() => __props.error !== void 0);
|
|
45
46
|
const group = useTemplateRef("group");
|
|
47
|
+
const { value, set, controlled, reset } = useControllable("value", () => __props.value, () => __props.defaultValue, (next) => {
|
|
48
|
+
if (next !== void 0) emit("update:value", next);
|
|
49
|
+
});
|
|
50
|
+
useFormReset(() => group.value, controlled, reset);
|
|
46
51
|
const describedBy = (index, description) => [description ? `${id}-${index}-description` : void 0, invalid.value ? errorId : void 0].filter(Boolean).join(" ") || void 0;
|
|
47
52
|
function choose(option) {
|
|
48
|
-
|
|
49
|
-
for (const input of group.value?.querySelectorAll("input") ?? []) keepChecked(input, () => input.value ===
|
|
53
|
+
set(option);
|
|
54
|
+
for (const input of group.value?.querySelectorAll("input") ?? []) keepChecked(input, () => input.value === value.value);
|
|
50
55
|
}
|
|
51
56
|
return (_ctx, _cache) => {
|
|
52
57
|
return openBlock(), createElementBlock("div", {
|
|
@@ -68,18 +73,19 @@ var RadioGroup_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
|
|
|
68
73
|
return openBlock(), createElementBlock("label", {
|
|
69
74
|
key: option.value,
|
|
70
75
|
class: "xds-radio-group__option"
|
|
71
|
-
}, [createElementVNode("input", {
|
|
76
|
+
}, [createElementVNode("input", mergeProps({
|
|
72
77
|
type: "radio",
|
|
73
78
|
class: "xds-radio-group__input sr-only",
|
|
74
79
|
name: __props.name ?? unref(id),
|
|
75
80
|
value: option.value,
|
|
76
|
-
checked: option.value ===
|
|
81
|
+
checked: option.value === unref(value)
|
|
82
|
+
}, { ref_for: true }, unref(formDefault)({ defaultChecked: option.value === unref(value) }), {
|
|
77
83
|
disabled: __props.disabled,
|
|
78
84
|
"aria-labelledby": `${unref(id)}-${index}`,
|
|
79
85
|
"aria-describedby": describedBy(index, option.description),
|
|
80
86
|
"aria-invalid": invalid.value ? "true" : void 0,
|
|
81
87
|
onChange: ($event) => choose(option.value)
|
|
82
|
-
}, null,
|
|
88
|
+
}), null, 16, _hoisted_3), createElementVNode("span", _hoisted_4, [_cache[0] || (_cache[0] = createElementVNode("span", { class: "xds-radio-group__circle-line" }, [createElementVNode("span", { class: "xds-radio-group__circle" }, [createElementVNode("span", { class: "xds-radio-group__dot" })])], -1)), createElementVNode("span", _hoisted_5, [createElementVNode("span", {
|
|
83
89
|
id: `${unref(id)}-${index}`,
|
|
84
90
|
class: "xds-radio-group__text"
|
|
85
91
|
}, toDisplayString(option.label), 9, _hoisted_6), option.description ? (openBlock(), createElementBlock("span", {
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { type SearchFieldBaseProps } from "@xds/core";
|
|
2
|
-
export type SearchFieldProps =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
export type SearchFieldProps = SearchFieldBaseProps;
|
|
3
|
+
declare const __VLS_export: import("vue").DefineComponent<SearchFieldBaseProps, {
|
|
4
|
+
focus: (options?: FocusOptions) => void | undefined;
|
|
5
|
+
blur: () => void | undefined;
|
|
6
|
+
element: () => HTMLInputElement | null;
|
|
7
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
blur: (event: FocusEvent) => any;
|
|
9
|
+
focus: (event: FocusEvent) => any;
|
|
9
10
|
submit: (value: string) => any;
|
|
10
11
|
"update:value": (value: string) => any;
|
|
11
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
12
|
+
}, string, import("vue").PublicProps, Readonly<SearchFieldBaseProps> & Readonly<{
|
|
13
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
14
|
+
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
12
15
|
onSubmit?: ((value: string) => any) | undefined;
|
|
13
16
|
"onUpdate:value"?: ((value: string) => any) | undefined;
|
|
14
17
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -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, {
|