@xds/vue 1.0.0-rc.1 → 1.0.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.
@@ -1,9 +1,10 @@
1
1
  import Icon_default from "./Icon.js";
2
2
  import { useModalPopover } from "./modal-popover.js";
3
+ import Portal_default from "./Portal.js";
3
4
  import { usePresence } from "./presence.js";
4
5
  import { TriggerScope } from "./trigger.js";
5
- import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, openBlock, renderList, renderSlot, toDisplayString, unref, useId, useTemplateRef, withCtx, withModifiers } from "vue";
6
- import { firstMenuValue, keepListKeys, layoutRect, leaveEscapeToFields, menuItemClass, opensOnPress } from "@xds/core";
6
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeStyle, openBlock, renderList, renderSlot, toDisplayString, unref, useId, useTemplateRef, withCtx, withModifiers } from "vue";
7
+ import { firstMenuValue, keepListKeys, layoutRect, leaveEscapeToFields, menuItemClass, opensOnPress, readCssPx, underlayLayerStyle } from "@xds/core";
7
8
  import { mergeProps as mergeProps$1, normalizeProps as normalizeProps$1, useMachine } from "@zag-js/vue";
8
9
  import { space } from "@xds/tokens";
9
10
  import * as menu from "@zag-js/menu";
@@ -25,7 +26,7 @@ var Menu_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
25
26
  "aria-label": __props.label,
26
27
  positioning: {
27
28
  placement: `bottom-${__props.align}`,
28
- gutter: space[1],
29
+ gutter: readCssPx(null, "--xds-space-1", space[1]),
29
30
  getAnchorRect: (anchor) => anchor instanceof HTMLElement ? layoutRect(anchor) : null
30
31
  },
31
32
  onSelect: (details) => {
@@ -70,48 +71,52 @@ var Menu_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
70
71
  return openBlock(), createElementBlock(Fragment, null, [createVNode(unref(TriggerScope), { trigger: trigger.value }, {
71
72
  default: withCtx(() => [renderSlot(_ctx.$slots, "trigger")]),
72
73
  _: 3
73
- }, 8, ["trigger"]), (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(unref(TriggerScope), { trigger: null }, {
74
- default: withCtx(() => [api.value.open ? (openBlock(), createElementBlock("div", {
75
- key: 0,
76
- class: "xds-menu__underlay",
77
- onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"]))
78
- }, null, 32)) : createCommentVNode("", true), createElementVNode("div", mergeProps({
79
- ref_key: "positioner",
80
- ref: positioner
81
- }, api.value.getPositionerProps(), { class: "xds-menu__positioner" }), [createElementVNode("div", mergeProps(content.value, {
82
- ref_key: "surface",
83
- ref: surface,
84
- hidden: !unref(present),
85
- class: ["xds-menu", _ctx.$attrs.class],
86
- style: _ctx.$attrs.style
87
- }), [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, index) => {
88
- return openBlock(), createElementBlock(Fragment, { key: index }, [item === "separator" ? (openBlock(), createElementBlock("div", mergeProps({
74
+ }, 8, ["trigger"]), createVNode(Portal_default, null, {
75
+ default: withCtx(() => [createVNode(unref(TriggerScope), { trigger: null }, {
76
+ default: withCtx(() => [api.value.open ? (openBlock(), createElementBlock("div", {
89
77
  key: 0,
90
- ref_for: true
91
- }, api.value.getSeparatorProps(), { class: "xds-menu__separator" }), null, 16)) : (openBlock(), createElementBlock("div", mergeProps({
92
- key: 1,
93
- ref_for: true
94
- }, api.value.getItemProps({
95
- value: String(index),
96
- disabled: item.disabled
97
- }), { class: unref(menuItemClass)(item.danger) }), [
98
- item.icon ? (openBlock(), createBlock(Icon_default, {
78
+ class: "xds-menu__underlay",
79
+ style: normalizeStyle(unref(underlayLayerStyle)(api.value.getPositionerProps().style)),
80
+ onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"]))
81
+ }, null, 36)) : createCommentVNode("", true), createElementVNode("div", mergeProps({
82
+ ref_key: "positioner",
83
+ ref: positioner
84
+ }, api.value.getPositionerProps(), { class: "xds-menu__positioner" }), [createElementVNode("div", mergeProps(content.value, {
85
+ ref_key: "surface",
86
+ ref: surface,
87
+ hidden: !unref(present),
88
+ class: ["xds-menu", _ctx.$attrs.class],
89
+ style: _ctx.$attrs.style
90
+ }), [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.items, (item, index) => {
91
+ return openBlock(), createElementBlock(Fragment, { key: index }, [item === "separator" ? (openBlock(), createElementBlock("div", mergeProps({
99
92
  key: 0,
100
- name: item.icon,
101
- size: "sm",
102
- class: "xds-menu__item-icon"
103
- }, null, 8, ["name"])) : createCommentVNode("", true),
104
- createElementVNode("span", _hoisted_2, toDisplayString(item.label), 1),
105
- item.selected ? (openBlock(), createBlock(Icon_default, {
93
+ ref_for: true
94
+ }, api.value.getSeparatorProps(), { class: "xds-menu__separator" }), null, 16)) : (openBlock(), createElementBlock("div", mergeProps({
106
95
  key: 1,
107
- name: "check",
108
- size: "sm",
109
- label: "Selected"
110
- })) : createCommentVNode("", true)
111
- ], 16))], 64);
112
- }), 128))], 16, _hoisted_1)], 16)]),
96
+ ref_for: true
97
+ }, api.value.getItemProps({
98
+ value: String(index),
99
+ disabled: item.disabled
100
+ }), { class: unref(menuItemClass)(item.danger) }), [
101
+ item.icon ? (openBlock(), createBlock(Icon_default, {
102
+ key: 0,
103
+ name: item.icon,
104
+ size: "sm",
105
+ class: "xds-menu__item-icon"
106
+ }, null, 8, ["name"])) : createCommentVNode("", true),
107
+ createElementVNode("span", _hoisted_2, toDisplayString(item.label), 1),
108
+ item.selected ? (openBlock(), createBlock(Icon_default, {
109
+ key: 1,
110
+ name: "check",
111
+ size: "sm",
112
+ label: "Selected"
113
+ })) : createCommentVNode("", true)
114
+ ], 16))], 64);
115
+ }), 128))], 16, _hoisted_1)], 16)]),
116
+ _: 1
117
+ })]),
113
118
  _: 1
114
- })]))], 64);
119
+ })], 64);
115
120
  };
116
121
  }
117
122
  });
package/dist/Portal.js ADDED
@@ -0,0 +1,4 @@
1
+ import Portal_vue_vue_type_script_setup_true_lang_default from "./Portal.vue_vue_type_script_setup_true_lang.js";
2
+ // packages/ui-vue/src/Portal.vue
3
+ var Portal_default = Portal_vue_vue_type_script_setup_true_lang_default;
4
+ export { Portal_default as default };
@@ -0,0 +1,12 @@
1
+ type __VLS_Slots = {
2
+ default(): unknown;
3
+ };
4
+ declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
5
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
6
+ declare const _default: typeof __VLS_export;
7
+ export default _default;
8
+ type __VLS_WithSlots<T, S> = T & {
9
+ new (): {
10
+ $slots: S;
11
+ };
12
+ };
@@ -0,0 +1,34 @@
1
+ import { Fragment, Teleport, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, onMounted, openBlock, ref, renderSlot, useTemplateRef, watchEffect } from "vue";
2
+ import { syncThemeScope } from "@xds/core";
3
+ // packages/ui-vue/src/Portal.vue?vue&type=script&setup=true&lang.ts
4
+ var Portal_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
5
+ __name: "Portal",
6
+ setup(__props) {
7
+ const mounted = ref(false);
8
+ const anchor = useTemplateRef("anchor");
9
+ const host = useTemplateRef("host");
10
+ onMounted(() => {
11
+ mounted.value = true;
12
+ });
13
+ watchEffect((onCleanup) => {
14
+ if (!mounted.value || !anchor.value || !host.value) return;
15
+ onCleanup(syncThemeScope(anchor.value, host.value));
16
+ });
17
+ return (_ctx, _cache) => {
18
+ return openBlock(), createElementBlock(Fragment, null, [createElementVNode("span", {
19
+ ref_key: "anchor",
20
+ ref: anchor,
21
+ hidden: "",
22
+ style: { "display": "none" }
23
+ }, null, 512), mounted.value ? (openBlock(), createBlock(Teleport, {
24
+ key: 0,
25
+ to: "body"
26
+ }, [createElementVNode("div", {
27
+ ref_key: "host",
28
+ ref: host,
29
+ style: { "display": "contents" }
30
+ }, [renderSlot(_ctx.$slots, "default")], 512)])) : createCommentVNode("", true)], 64);
31
+ };
32
+ }
33
+ });
34
+ export { Portal_vue_vue_type_script_setup_true_lang_default as default };
@@ -1,6 +1,6 @@
1
1
  import { keepValue } from "./controlled.js";
2
2
  import Icon_default from "./Icon.js";
3
- import { createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeModels, normalizeClass, openBlock, unref, useModel, useTemplateRef } from "vue";
3
+ import { createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, getCurrentInstance, mergeModels, normalizeClass, openBlock, unref, useModel, useTemplateRef } from "vue";
4
4
  import { classes, rootPart } from "@xds/core";
5
5
  // packages/ui-vue/src/SearchField.vue?vue&type=script&setup=true&lang.ts
6
6
  var _hoisted_1 = { class: "xds-text-field__control xds-text-field__control--pill xds-text-field__group" };
@@ -36,6 +36,7 @@ var SearchField_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
36
36
  const value = useModel(__props, "value");
37
37
  const emit = __emit;
38
38
  const input = useTemplateRef("input");
39
+ const instance = getCurrentInstance();
39
40
  function edit(event) {
40
41
  const field = event.currentTarget;
41
42
  value.value = field.value;
@@ -46,7 +47,10 @@ var SearchField_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
46
47
  }
47
48
  function key(event) {
48
49
  if (event.isComposing) return;
49
- if (event.key === "Enter") emit("submit", value.value);
50
+ if (event.key === "Enter") {
51
+ if (instance?.vnode.props?.onSubmit) event.preventDefault();
52
+ emit("submit", value.value);
53
+ }
50
54
  if (event.key === "Escape" && value.value !== "") {
51
55
  event.stopPropagation();
52
56
  value.value = "";
@@ -66,6 +70,7 @@ var SearchField_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
66
70
  ref_key: "input",
67
71
  ref: input,
68
72
  type: "text",
73
+ role: "searchbox",
69
74
  class: "xds-text-field__input",
70
75
  "aria-label": __props.label,
71
76
  enterkeyhint: "search",
@@ -1,17 +1,15 @@
1
1
  import Icon_default from "./Icon.js";
2
2
  import { useModalPopover } from "./modal-popover.js";
3
+ import Portal_default from "./Portal.js";
3
4
  import { usePresence } from "./presence.js";
4
- import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, renderList, toDisplayString, unref, useId, useTemplateRef, withModifiers } from "vue";
5
- import { keepListKeys, selectOptionIds } from "@xds/core";
5
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, normalizeStyle, openBlock, renderList, toDisplayString, unref, useId, useTemplateRef, withCtx, withModifiers } from "vue";
6
+ import { keepListKeys, readCssPx, selectOptionIds, underlayLayerStyle } from "@xds/core";
6
7
  import { normalizeProps as normalizeProps$1, useMachine } from "@zag-js/vue";
7
8
  import { space } from "@xds/tokens";
8
9
  import * as select from "@zag-js/select";
9
10
  // packages/ui-vue/src/Select.vue?vue&type=script&setup=true&lang.ts
10
11
  var _hoisted_1 = ["aria-labelledby", "aria-describedby"];
11
- var _hoisted_2 = {
12
- key: 0,
13
- class: "xds-select__footer"
14
- };
12
+ var _hoisted_2 = { class: "xds-select__footer" };
15
13
  var _hoisted_3 = ["value"];
16
14
  var _hoisted_4 = ["hidden"];
17
15
  var _hoisted_5 = ["aria-labelledby", "aria-describedby"];
@@ -59,9 +57,9 @@ var Select_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
59
57
  name: __props.name,
60
58
  positioning: {
61
59
  placement: "bottom-start",
62
- gutter: space[1],
60
+ gutter: readCssPx(null, "--xds-space-1", space[1]),
63
61
  sameWidth: true,
64
- overflowPadding: space[3]
62
+ overflowPadding: readCssPx(null, "--xds-space-3", space[3])
65
63
  }
66
64
  })));
67
65
  const api = computed(() => select.connect(service, normalizeProps$1));
@@ -109,51 +107,55 @@ var Select_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
109
107
  size: "sm",
110
108
  class: "text-xds-field-placeholder"
111
109
  })], 16, _hoisted_1),
112
- invalid.value || __props.description ? (openBlock(), createElementBlock("div", _hoisted_2, [invalid.value ? (openBlock(), createElementBlock("span", {
110
+ createElementVNode("div", _hoisted_2, [!invalid.value && __props.description ? (openBlock(), createElementBlock("span", {
113
111
  key: 0,
114
- id: errorId,
115
- class: "xds-select__error"
116
- }, toDisplayString(__props.error), 1)) : (openBlock(), createElementBlock("span", {
117
- key: 1,
118
112
  id: descriptionId,
119
113
  class: "xds-select__description"
120
- }, toDisplayString(__props.description), 1))])) : createCommentVNode("", true),
114
+ }, toDisplayString(__props.description), 1)) : createCommentVNode("", true), createElementVNode("span", {
115
+ id: errorId,
116
+ class: "xds-select__error",
117
+ "aria-live": "polite"
118
+ }, toDisplayString(__props.error), 1)]),
121
119
  createElementVNode("select", normalizeProps(guardReactiveProps(api.value.getHiddenSelectProps())), [_cache[1] || (_cache[1] = createElementVNode("option", { value: "" }, null, -1)), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
122
120
  return openBlock(), createElementBlock("option", {
123
121
  key: option.value,
124
122
  value: option.value
125
123
  }, toDisplayString(option.label), 9, _hoisted_3);
126
124
  }), 128))], 16),
127
- (openBlock(), createBlock(Teleport, { to: "body" }, [api.value.open ? (openBlock(), createElementBlock("div", {
128
- key: 0,
129
- class: "xds-select__underlay",
130
- onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"]))
131
- }, null, 32)) : createCommentVNode("", true), createElementVNode("div", mergeProps({
132
- ref_key: "positioner",
133
- ref: positioner
134
- }, api.value.getPositionerProps(), { class: "xds-select__positioner" }), [createElementVNode("div", mergeProps(content.value, {
135
- ref_key: "surface",
136
- ref: surface,
137
- hidden: !unref(present),
138
- class: "xds-select__content"
139
- }), [createElementVNode("div", mergeProps(api.value.getListProps(), { class: "xds-select__list" }), [(openBlock(true), createElementBlock(Fragment, null, renderList(collection.value.items, (option, index) => {
140
- return openBlock(), createElementBlock("div", mergeProps({ key: option.value }, { ref_for: true }, api.value.getItemProps({ item: option }), {
141
- "aria-labelledby": unref(selectOptionIds)(unref(id), index).label,
142
- "aria-describedby": option.description ? unref(selectOptionIds)(unref(id), index).description : void 0,
143
- class: "xds-select__item"
144
- }), [createElementVNode("span", _hoisted_6, [createElementVNode("span", mergeProps({ ref_for: true }, api.value.getItemTextProps({ item: option }), {
145
- id: unref(selectOptionIds)(unref(id), index).label,
146
- class: "xds-select__item-label"
147
- }), toDisplayString(option.label), 17, _hoisted_7), option.description ? (openBlock(), createElementBlock("span", {
148
- key: 0,
149
- id: unref(selectOptionIds)(unref(id), index).description,
150
- class: "xds-select__item-description"
151
- }, toDisplayString(option.description), 9, _hoisted_8)) : createCommentVNode("", true)]), api.value.getItemState({ item: option }).selected ? (openBlock(), createBlock(Icon_default, {
125
+ createVNode(Portal_default, null, {
126
+ default: withCtx(() => [api.value.open ? (openBlock(), createElementBlock("div", {
152
127
  key: 0,
153
- name: "check",
154
- size: "sm"
155
- })) : createCommentVNode("", true)], 16, _hoisted_5);
156
- }), 128))], 16)], 16, _hoisted_4)], 16)]))
128
+ class: "xds-select__underlay",
129
+ style: normalizeStyle(unref(underlayLayerStyle)(api.value.getPositionerProps().style)),
130
+ onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"]))
131
+ }, null, 36)) : createCommentVNode("", true), createElementVNode("div", mergeProps({
132
+ ref_key: "positioner",
133
+ ref: positioner
134
+ }, api.value.getPositionerProps(), { class: "xds-select__positioner" }), [createElementVNode("div", mergeProps(content.value, {
135
+ ref_key: "surface",
136
+ ref: surface,
137
+ hidden: !unref(present),
138
+ class: "xds-select__content"
139
+ }), [createElementVNode("div", mergeProps(api.value.getListProps(), { class: "xds-select__list" }), [(openBlock(true), createElementBlock(Fragment, null, renderList(collection.value.items, (option, index) => {
140
+ return openBlock(), createElementBlock("div", mergeProps({ key: option.value }, { ref_for: true }, api.value.getItemProps({ item: option }), {
141
+ "aria-labelledby": unref(selectOptionIds)(unref(id), index).label,
142
+ "aria-describedby": option.description ? unref(selectOptionIds)(unref(id), index).description : void 0,
143
+ class: "xds-select__item"
144
+ }), [createElementVNode("span", _hoisted_6, [createElementVNode("span", mergeProps({ ref_for: true }, api.value.getItemTextProps({ item: option }), {
145
+ id: unref(selectOptionIds)(unref(id), index).label,
146
+ class: "xds-select__item-label"
147
+ }), toDisplayString(option.label), 17, _hoisted_7), option.description ? (openBlock(), createElementBlock("span", {
148
+ key: 0,
149
+ id: unref(selectOptionIds)(unref(id), index).description,
150
+ class: "xds-select__item-description"
151
+ }, toDisplayString(option.description), 9, _hoisted_8)) : createCommentVNode("", true)]), api.value.getItemState({ item: option }).selected ? (openBlock(), createBlock(Icon_default, {
152
+ key: 0,
153
+ name: "check",
154
+ size: "sm"
155
+ })) : createCommentVNode("", true)], 16, _hoisted_5);
156
+ }), 128))], 16)], 16, _hoisted_4)], 16)]),
157
+ _: 1
158
+ })
157
159
  ], 16);
158
160
  };
159
161
  }
@@ -18,7 +18,9 @@ var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
18
18
  showValue: {
19
19
  type: Boolean,
20
20
  default: false
21
- }
21
+ },
22
+ name: {},
23
+ locale: {}
22
24
  }, {
23
25
  "value": { required: true },
24
26
  "valueModifiers": {}
@@ -34,6 +36,7 @@ var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
34
36
  }));
35
37
  const service = useMachine(slider.machine, computed(() => ({
36
38
  id,
39
+ name: __props.name,
37
40
  value: [value.value],
38
41
  onValueChange: (details) => value.value = details.value[0] ?? __props.min,
39
42
  min: __props.min,
@@ -42,7 +45,7 @@ var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
42
45
  largeStep: pageSize.value,
43
46
  disabled: __props.disabled,
44
47
  thumbAlignment: "center",
45
- getAriaValueText: (details) => sliderValueText(details.value)
48
+ getAriaValueText: (details) => sliderValueText(details.value, __props.locale)
46
49
  })));
47
50
  const api = computed(() => slider.connect(service, normalizeProps$1));
48
51
  const thumbElement = useTemplateRef("thumb");
@@ -55,7 +58,10 @@ var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
55
58
  step: __props.step,
56
59
  pageSize: pageSize.value
57
60
  });
58
- if (next !== void 0) api.value.setThumbValue(0, next);
61
+ if (next !== void 0) {
62
+ event.preventDefault();
63
+ api.value.setThumbValue(0, next);
64
+ }
59
65
  } }));
60
66
  const control = computed(() => mergeProps$1(api.value.getControlProps(), { onPointerdown: (event) => {
61
67
  if (!__props.disabled) focusThumbOnPress(event, thumbElement.value ?? void 0);
@@ -70,7 +76,7 @@ var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
70
76
  __props.showValue ? (openBlock(), createElementBlock("output", mergeProps({ key: 0 }, api.value.getValueTextProps(), {
71
77
  "aria-live": "off",
72
78
  class: "xds-slider__output"
73
- }), toDisplayString(unref(sliderValueText)(api.value.value[0] ?? value.value)), 17)) : createCommentVNode("", true),
79
+ }), toDisplayString(unref(sliderValueText)(api.value.value[0] ?? value.value, __props.locale)), 17)) : createCommentVNode("", true),
74
80
  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, {
75
81
  ref_key: "thumb",
76
82
  ref: thumb,
@@ -1,5 +1,5 @@
1
1
  import { keepValue } from "./controlled.js";
2
- import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeModels, mergeProps, onMounted, openBlock, renderSlot, toDisplayString, unref, useId, useModel, useSlots, useTemplateRef } from "vue";
2
+ import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeModels, mergeProps, onMounted, openBlock, renderSlot, toDisplayString, unref, useId, useModel, 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"];
@@ -71,6 +71,12 @@ var TextField_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
71
71
  if (input.value instanceof HTMLTextAreaElement) input.value.setSelectionRange(0, 0);
72
72
  if (__props.autoFocus) input.value?.focus();
73
73
  });
74
+ watch([() => __props.error, () => __props.multiline], () => {
75
+ input.value?.setCustomValidity(__props.error ?? "");
76
+ }, {
77
+ flush: "post",
78
+ immediate: true
79
+ });
74
80
  const shared = computed(() => ({
75
81
  id,
76
82
  class: grouped.value ? "xds-text-field__input" : "xds-text-field__input xds-text-field__control",
@@ -37,6 +37,7 @@ var Thumbnail_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
37
37
  size: "lg"
38
38
  })) : createCommentVNode("", true), unref(picture).loaded.value !== false && __props.src ? (openBlock(), createElementBlock("img", {
39
39
  key: 1,
40
+ ref: (el) => unref(picture).sync(el, __props.src),
40
41
  src: __props.src,
41
42
  alt: "",
42
43
  "aria-hidden": "true",
@@ -1,5 +1,5 @@
1
1
  import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeProps, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, ref, toDisplayString, unref, useTemplateRef, watchEffect } from "vue";
2
- import { TOAST_PARTS, rootPart } from "@xds/core";
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
5
5
  var Toast_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
@@ -9,7 +9,7 @@ var Toast_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
9
9
  open: { type: Boolean },
10
10
  message: {},
11
11
  action: {},
12
- duration: { default: () => motion.duration.toast }
12
+ duration: {}
13
13
  },
14
14
  emits: ["close"],
15
15
  setup(__props, { emit: __emit }) {
@@ -20,10 +20,15 @@ var Toast_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
20
20
  const focused = ref();
21
21
  const inPage = (toast) => toast?.isConnected === true;
22
22
  onMounted(() => region.value?.showPopover?.());
23
- onBeforeUnmount(() => region.value?.hidePopover?.());
23
+ onBeforeUnmount(() => {
24
+ const element = region.value;
25
+ if (element?.isConnected && element.matches(":popover-open")) element.hidePopover();
26
+ });
24
27
  watchEffect((onCleanup) => {
25
- if (!__props.open || inPage(hovered.value) || inPage(focused.value) || __props.duration <= 0) return;
26
- const timer = setTimeout(() => emit("close"), __props.duration);
28
+ __props.message;
29
+ const ms = __props.duration ?? readCssMs(region.value, "--xds-motion-duration-toast", motion.duration.toast);
30
+ if (!__props.open || inPage(hovered.value) || inPage(focused.value) || ms <= 0) return;
31
+ const timer = setTimeout(() => emit("close"), ms);
27
32
  onCleanup(() => clearTimeout(timer));
28
33
  });
29
34
  function press(run) {
@@ -1,6 +1,8 @@
1
+ import Portal_default from "./Portal.js";
1
2
  import { usePresence } from "./presence.js";
2
3
  import { TriggerScope } from "./trigger.js";
3
- import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, openBlock, renderSlot, toDisplayString, unref, useId, useTemplateRef, withCtx } from "vue";
4
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, openBlock, renderSlot, toDisplayString, unref, useId, useTemplateRef, withCtx } from "vue";
5
+ import { readCssMs, readCssPx } from "@xds/core";
4
6
  import { normalizeProps as normalizeProps$1, useMachine } from "@zag-js/vue";
5
7
  import { motion, space } from "@xds/tokens";
6
8
  import * as tooltip from "@zag-js/tooltip";
@@ -21,12 +23,12 @@ var TooltipOverlay_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
21
23
  const id = useId();
22
24
  const service = useMachine(tooltip.machine, computed(() => ({
23
25
  id,
24
- openDelay: motion.duration.tooltipDelay,
26
+ openDelay: readCssMs(null, "--xds-motion-duration-tooltip-delay", motion.duration.tooltipDelay),
25
27
  closeDelay: 0,
26
28
  closeOnScroll: false,
27
29
  positioning: {
28
30
  placement: __props.placement,
29
- gutter: space[1]
31
+ gutter: readCssPx(null, "--xds-space-1", space[1])
30
32
  }
31
33
  })));
32
34
  const api = computed(() => tooltip.connect(service, normalizeProps$1));
@@ -37,19 +39,19 @@ var TooltipOverlay_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ d
37
39
  return openBlock(), createElementBlock(Fragment, null, [createVNode(unref(TriggerScope), { trigger: trigger.value }, {
38
40
  default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
39
41
  _: 3
40
- }, 8, ["trigger"]), unref(present) ? (openBlock(), createBlock(Teleport, {
41
- key: 0,
42
- to: "body"
43
- }, [createVNode(unref(TriggerScope), { trigger: null }, {
44
- default: withCtx(() => [createElementVNode("div", mergeProps(api.value.getPositionerProps(), { class: "xds-tooltip__positioner" }), [createElementVNode("div", mergeProps(api.value.getContentProps(), {
45
- ref_key: "content",
46
- ref: content,
47
- hidden: false,
48
- class: ["xds-tooltip", _ctx.$attrs.class],
49
- style: _ctx.$attrs.style
50
- }), [createTextVNode(toDisplayString(__props.label), 1), __props.shortcut ? (openBlock(), createElementBlock("kbd", _hoisted_1, toDisplayString(__props.shortcut), 1)) : createCommentVNode("", true)], 16)], 16)]),
42
+ }, 8, ["trigger"]), unref(present) ? (openBlock(), createBlock(Portal_default, { key: 0 }, {
43
+ 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(), {
45
+ ref_key: "content",
46
+ ref: content,
47
+ hidden: false,
48
+ class: ["xds-tooltip", _ctx.$attrs.class],
49
+ style: _ctx.$attrs.style
50
+ }), [createTextVNode(toDisplayString(__props.label), 1), __props.shortcut ? (openBlock(), createElementBlock("kbd", _hoisted_1, toDisplayString(__props.shortcut), 1)) : createCommentVNode("", true)], 16)], 16)]),
51
+ _: 1
52
+ })]),
51
53
  _: 1
52
- })])) : createCommentVNode("", true)], 64);
54
+ })) : createCommentVNode("", true)], 64);
53
55
  };
54
56
  }
55
57
  });
package/dist/index.d.ts CHANGED
@@ -16,7 +16,7 @@ export { type DateRange, default as DateRangePicker, type DateRangePickerProps,
16
16
  export type { ComponentDefaults } from "@xds/core";
17
17
  export { default as Defaults, type DefaultsProps } from "./Defaults.vue";
18
18
  export { default as Dialog, type DialogProps } from "./Dialog.vue";
19
- export { default as Divider } from "./Divider.vue";
19
+ export { default as Divider, type DividerProps } from "./Divider.vue";
20
20
  export { default as EmptyState, type EmptyStateProps } from "./EmptyState.vue";
21
21
  export { default as Icon, type IconProps } from "./Icon.vue";
22
22
  export { default as IconButton, type IconButtonProps } from "./IconButton.vue";
@@ -17,6 +17,6 @@ function useModalPopover(open, popup) {
17
17
  reveal();
18
18
  unlock();
19
19
  });
20
- });
20
+ }, { immediate: true });
21
21
  }
22
22
  export { useModalPopover };
package/dist/picture.d.ts CHANGED
@@ -1,13 +1,11 @@
1
1
  /**
2
- * Follows the loading of the picture at `src()`. `loaded` is undefined while it loads, then
3
- * true or false. The result is remembered with the address it belongs to, so a new `src` starts
4
- * over without a watcher.
5
- *
6
- * A picture that is in the cache still reports its load in a later task, after the listeners
7
- * are attached, so no check of `complete` is needed on a page rendered in the browser.
2
+ * Follows the loading of the picture at `src()`. `loaded` is undefined while it loads, then true
3
+ * or false. The result is remembered with the address it belongs to, so a new `src` starts over
4
+ * without a watcher.
8
5
  */
9
6
  export declare function usePicture(src: () => string | undefined): {
10
7
  loaded: import("vue").ComputedRef<boolean | undefined>;
8
+ sync: (image: unknown, address: string) => void;
11
9
  onLoad: (address: string) => {
12
10
  src: string;
13
11
  loaded: true;
package/dist/picture.js CHANGED
@@ -1,17 +1,21 @@
1
1
  import { computed, ref } from "vue";
2
2
  // packages/ui-vue/src/picture.ts
3
3
  /**
4
- * Follows the loading of the picture at `src()`. `loaded` is undefined while it loads, then
5
- * true or false. The result is remembered with the address it belongs to, so a new `src` starts
6
- * over without a watcher.
7
- *
8
- * A picture that is in the cache still reports its load in a later task, after the listeners
9
- * are attached, so no check of `complete` is needed on a page rendered in the browser.
4
+ * Follows the loading of the picture at `src()`. `loaded` is undefined while it loads, then true
5
+ * or false. The result is remembered with the address it belongs to, so a new `src` starts over
6
+ * without a watcher.
10
7
  */
11
8
  function usePicture(src) {
12
9
  const picture = ref();
10
+ const loaded = computed(() => picture.value !== void 0 && picture.value.src === src() ? picture.value.loaded : void 0);
13
11
  return {
14
- loaded: computed(() => picture.value !== void 0 && picture.value.src === src() ? picture.value.loaded : void 0),
12
+ loaded,
13
+ sync: (image, address) => {
14
+ if (image instanceof HTMLImageElement && image.getAttribute("src") === address && image.complete && loaded.value === void 0) picture.value = {
15
+ src: address,
16
+ loaded: image.naturalWidth > 0
17
+ };
18
+ },
15
19
  onLoad: (address) => picture.value = {
16
20
  src: address,
17
21
  loaded: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xds/vue",
3
- "version": "1.0.0-rc.1",
3
+ "version": "1.0.0",
4
4
  "description": "The xds design system's components for Vue.",
5
5
  "keywords": [
6
6
  "design-system",
@@ -41,8 +41,8 @@
41
41
  "page.css"
42
42
  ],
43
43
  "dependencies": {
44
- "@xds/tokens": "1.0.0-rc.1",
45
- "@xds/core": "1.0.0-rc.1",
44
+ "@xds/tokens": "1.0.0",
45
+ "@xds/core": "1.0.0",
46
46
  "@internationalized/date": "3.12.4",
47
47
  "@zag-js/accordion": "2.0.0-next.4",
48
48
  "@zag-js/aria-hidden": "2.0.0-next.4",