@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.
Files changed (188) hide show
  1. package/dist/Banner.vue_vue_type_script_setup_true_lang.js +4 -2
  2. package/dist/Breadcrumb.js +4 -0
  3. package/dist/Breadcrumb.vue.d.ts +6 -0
  4. package/dist/Breadcrumb.vue_vue_type_script_setup_true_lang.js +47 -0
  5. package/dist/Button.vue.d.ts +9 -1
  6. package/dist/Button.vue_vue_type_script_setup_true_lang.js +18 -5
  7. package/dist/Checkbox.vue.d.ts +13 -10
  8. package/dist/Checkbox.vue_vue_type_script_setup_true_lang.js +42 -22
  9. package/dist/Combobox.js +4 -0
  10. package/dist/Combobox.vue.d.ts +22 -0
  11. package/dist/Combobox.vue_vue_type_script_setup_true_lang.js +140 -0
  12. package/dist/DatePicker.vue_vue_type_script_setup_true_lang.js +4 -1
  13. package/dist/DateRangePicker.vue_vue_type_script_setup_true_lang.js +5 -2
  14. package/dist/Dialog.vue.d.ts +5 -2
  15. package/dist/Dialog.vue_vue_type_script_setup_true_lang.js +6 -5
  16. package/dist/IconButton.vue.d.ts +9 -1
  17. package/dist/IconButton.vue_vue_type_script_setup_true_lang.js +18 -5
  18. package/dist/Labels.vue.d.ts +17 -0
  19. package/dist/Labels.vue_vue_type_script_setup_true_lang.js +14 -0
  20. package/dist/Labels2.js +4 -0
  21. package/dist/Link.js +4 -0
  22. package/dist/Link.vue.d.ts +27 -0
  23. package/dist/Link.vue_vue_type_script_setup_true_lang.js +62 -0
  24. package/dist/Menu.vue.d.ts +4 -1
  25. package/dist/Menu.vue_vue_type_script_setup_true_lang.js +5 -4
  26. package/dist/Pagination.js +4 -0
  27. package/dist/Pagination.vue.d.ts +9 -0
  28. package/dist/Pagination.vue_vue_type_script_setup_true_lang.js +74 -0
  29. package/dist/Popover.js +4 -0
  30. package/dist/Popover.vue.d.ts +26 -0
  31. package/dist/Popover.vue_vue_type_script_setup_true_lang.js +81 -0
  32. package/dist/RadioGroup.vue_vue_type_script_setup_true_lang.js +13 -7
  33. package/dist/SearchField.vue.d.ts +11 -8
  34. package/dist/SearchField.vue_vue_type_script_setup_true_lang.js +40 -22
  35. package/dist/SegmentedControl.vue.d.ts +3 -7
  36. package/dist/SegmentedControl.vue_vue_type_script_setup_true_lang.js +13 -14
  37. package/dist/Select.vue.d.ts +3 -1
  38. package/dist/Select.vue_vue_type_script_setup_true_lang.js +47 -18
  39. package/dist/Slider.vue.d.ts +3 -8
  40. package/dist/Slider.vue_vue_type_script_setup_true_lang.js +11 -10
  41. package/dist/Switch.vue.d.ts +13 -10
  42. package/dist/Switch.vue_vue_type_script_setup_true_lang.js +33 -21
  43. package/dist/Table.js +4 -0
  44. package/dist/Table.vue.d.ts +10 -0
  45. package/dist/Table.vue_vue_type_script_setup_true_lang.js +61 -0
  46. package/dist/Tabs.vue.d.ts +3 -5
  47. package/dist/Tabs.vue_vue_type_script_setup_true_lang.js +10 -9
  48. package/dist/TextField.vue.d.ts +11 -8
  49. package/dist/TextField.vue_vue_type_script_setup_true_lang.js +26 -13
  50. package/dist/TimePicker.js +4 -0
  51. package/dist/TimePicker.vue.d.ts +10 -0
  52. package/dist/TimePicker.vue_vue_type_script_setup_true_lang.js +168 -0
  53. package/dist/Toast.vue_vue_type_script_setup_true_lang.js +5 -11
  54. package/dist/ToastQueue.js +4 -0
  55. package/dist/ToastQueue.vue.d.ts +9 -0
  56. package/dist/ToastQueue.vue_vue_type_script_setup_true_lang.js +42 -0
  57. package/dist/TooltipOverlay.vue.d.ts +1 -0
  58. package/dist/TooltipOverlay.vue_vue_type_script_setup_true_lang.js +6 -5
  59. package/dist/base.d.ts +13 -0
  60. package/dist/base.js +14 -0
  61. package/dist/controlled.d.ts +46 -0
  62. package/dist/controlled.js +64 -2
  63. package/dist/index.d.ts +14 -3
  64. package/dist/index.js +11 -1
  65. package/dist/labels.d.ts +9 -0
  66. package/dist/labels.js +17 -0
  67. package/dist/preview.d.ts +20 -3
  68. package/dist/preview.js +37 -7
  69. package/dist/trigger.d.ts +7 -0
  70. package/dist/trigger.js +13 -1
  71. package/eject/files/Accordion.vue +89 -0
  72. package/eject/files/AccordionPanel.vue +47 -0
  73. package/eject/files/Avatar.vue +41 -0
  74. package/eject/files/AvatarStack.vue +46 -0
  75. package/eject/files/Badge.vue +29 -0
  76. package/eject/files/Banner.vue +65 -0
  77. package/eject/files/Breadcrumb.vue +43 -0
  78. package/eject/files/Button.vue +93 -0
  79. package/eject/files/Card.vue +85 -0
  80. package/eject/files/Checkbox.vue +104 -0
  81. package/eject/files/Chip.vue +32 -0
  82. package/eject/files/ChipBar.vue +25 -0
  83. package/eject/files/Combobox.vue +175 -0
  84. package/eject/files/CountBadge.vue +45 -0
  85. package/eject/files/DatePicker.vue +223 -0
  86. package/eject/files/DateRangePicker.vue +317 -0
  87. package/eject/files/Dialog.vue +105 -0
  88. package/eject/files/Divider.vue +15 -0
  89. package/eject/files/EmptyState.vue +28 -0
  90. package/eject/files/Icon.vue +34 -0
  91. package/eject/files/IconButton.vue +71 -0
  92. package/eject/files/Link.vue +48 -0
  93. package/eject/files/ListRow.vue +33 -0
  94. package/eject/files/MediaCard.vue +109 -0
  95. package/eject/files/Menu.vue +181 -0
  96. package/eject/files/Pagination.vue +88 -0
  97. package/eject/files/PlaceRow.vue +54 -0
  98. package/eject/files/Popover.vue +119 -0
  99. package/eject/files/ProgressBar.vue +34 -0
  100. package/eject/files/RadioGroup.vue +126 -0
  101. package/eject/files/SearchField.vue +129 -0
  102. package/eject/files/SectionHeader.vue +37 -0
  103. package/eject/files/SegmentedControl.vue +81 -0
  104. package/eject/files/Select.vue +269 -0
  105. package/eject/files/Sidebar.vue +101 -0
  106. package/eject/files/SidebarRailButton.vue +31 -0
  107. package/eject/files/Skeleton.vue +27 -0
  108. package/eject/files/Slider.vue +126 -0
  109. package/eject/files/Spinner.vue +36 -0
  110. package/eject/files/Switch.vue +88 -0
  111. package/eject/files/Table.vue +77 -0
  112. package/eject/files/Tabs.vue +72 -0
  113. package/eject/files/Text.vue +22 -0
  114. package/eject/files/TextField.vue +190 -0
  115. package/eject/files/Thumbnail.vue +62 -0
  116. package/eject/files/TimePicker.vue +224 -0
  117. package/eject/files/Toast.vue +83 -0
  118. package/eject/files/ToastQueue.vue +54 -0
  119. package/eject/files/Tooltip.vue +28 -0
  120. package/eject/files/TooltipOverlay.vue +86 -0
  121. package/eject/files/accordion.css +89 -0
  122. package/eject/files/accordion.ts +67 -0
  123. package/eject/files/avatar-stack.ts +57 -0
  124. package/eject/files/avatar.ts +42 -0
  125. package/eject/files/badge.ts +30 -0
  126. package/eject/files/banner.ts +71 -0
  127. package/eject/files/base.css +38 -0
  128. package/eject/files/breadcrumb.css +51 -0
  129. package/eject/files/breadcrumb.ts +42 -0
  130. package/eject/files/button.css +241 -0
  131. package/eject/files/button.ts +106 -0
  132. package/eject/files/card.ts +58 -0
  133. package/eject/files/checkbox.ts +52 -0
  134. package/eject/files/chip-bar.ts +16 -0
  135. package/eject/files/chip.ts +35 -0
  136. package/eject/files/combobox.css +269 -0
  137. package/eject/files/combobox.ts +85 -0
  138. package/eject/files/count-badge.ts +32 -0
  139. package/eject/files/date-picker.css +375 -0
  140. package/eject/files/date-picker.ts +280 -0
  141. package/eject/files/date-range-picker.ts +338 -0
  142. package/eject/files/dialog.css +139 -0
  143. package/eject/files/dialog.ts +15 -0
  144. package/eject/files/divider.ts +5 -0
  145. package/eject/files/empty-state.ts +22 -0
  146. package/eject/files/icon.ts +36 -0
  147. package/eject/files/link.css +64 -0
  148. package/eject/files/link.ts +63 -0
  149. package/eject/files/list-row.ts +66 -0
  150. package/eject/files/media-card.ts +66 -0
  151. package/eject/files/menu.css +192 -0
  152. package/eject/files/menu.ts +84 -0
  153. package/eject/files/overlay.css +40 -0
  154. package/eject/files/pagination.css +106 -0
  155. package/eject/files/pagination.ts +68 -0
  156. package/eject/files/parts.ts +17 -0
  157. package/eject/files/popover.css +101 -0
  158. package/eject/files/popover.ts +37 -0
  159. package/eject/files/progress-bar.ts +26 -0
  160. package/eject/files/radio-group.css +184 -0
  161. package/eject/files/radio-group.ts +30 -0
  162. package/eject/files/section-header.ts +32 -0
  163. package/eject/files/segmented-control.ts +33 -0
  164. package/eject/files/select.css +347 -0
  165. package/eject/files/select.ts +77 -0
  166. package/eject/files/sidebar.ts +75 -0
  167. package/eject/files/skeleton.ts +51 -0
  168. package/eject/files/slider.css +160 -0
  169. package/eject/files/slider.ts +80 -0
  170. package/eject/files/spinner.ts +22 -0
  171. package/eject/files/switch.ts +45 -0
  172. package/eject/files/table.css +107 -0
  173. package/eject/files/table.ts +84 -0
  174. package/eject/files/tabs.css +120 -0
  175. package/eject/files/tabs.ts +37 -0
  176. package/eject/files/text-field.css +225 -0
  177. package/eject/files/text-field.ts +64 -0
  178. package/eject/files/text.ts +38 -0
  179. package/eject/files/thumbnail.ts +51 -0
  180. package/eject/files/time-picker.ts +113 -0
  181. package/eject/files/toast-queue.ts +64 -0
  182. package/eject/files/toast.ts +31 -0
  183. package/eject/files/tooltip.css +111 -0
  184. package/eject/files/tooltip.ts +21 -0
  185. package/eject/manifest.json +1122 -0
  186. package/package.json +11 -4
  187. package/styles.css +1135 -167
  188. package/tailwind.css +1295 -218
@@ -1,13 +1,9 @@
1
1
  import { type SegmentedControlBaseProps } from "@xds/core";
2
- export type SegmentedControlProps<Value extends string> = Omit<SegmentedControlBaseProps<Value>, "value" | "aria-label"> & {
2
+ export type SegmentedControlProps<Value extends string> = Omit<SegmentedControlBaseProps<Value>, "aria-label"> & {
3
3
  ariaLabel: string;
4
4
  };
5
5
  declare const __VLS_export: <Value extends string>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>['props'], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, 'attrs' | 'emit' | 'slots'>>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>['expose'], __VLS_setup?: Promise<{
6
- props: import('vue').PublicProps & __VLS_PrettifyLocal<(Omit<SegmentedControlBaseProps<Value>, "aria-label" | "value"> & {
7
- ariaLabel: string;
8
- } & {
9
- value: Value;
10
- }) & {
6
+ props: import('vue').PublicProps & __VLS_PrettifyLocal<SegmentedControlProps<Value> & {
11
7
  "onUpdate:value"?: ((value: Value) => any) | undefined;
12
8
  }> & (typeof globalThis extends {
13
9
  __VLS_PROPS_FALLBACK: infer P;
@@ -15,7 +11,7 @@ declare const __VLS_export: <Value extends string>(__VLS_props: NonNullable<Awai
15
11
  expose: (exposed: {}) => void;
16
12
  attrs: any;
17
13
  slots: {};
18
- emit: (event: "update:value", value: Value) => void;
14
+ emit: (evt: "update:value", value: Value) => void;
19
15
  }>) => import('vue').VNode & {
20
16
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
21
17
  };
@@ -1,5 +1,5 @@
1
- import { keepChecked } from "./controlled.js";
2
- import { Fragment, createElementBlock, createElementVNode, defineComponent, mergeModels, normalizeClass, openBlock, renderList, toDisplayString, unref, useId, useModel, useTemplateRef } from "vue";
1
+ import { formDefault, keepChecked, useControllable } from "./controlled.js";
2
+ import { Fragment, createElementBlock, createElementVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderList, toDisplayString, unref, useId, useTemplateRef } from "vue";
3
3
  import { classes, rootPart, segmentedControlClass, segmentedControlOptionClass, segmentedControlSegmentClass } from "@xds/core";
4
4
  // packages/ui-vue/src/SegmentedControl.vue?vue&type=script&setup=true&lang.ts
5
5
  var _hoisted_1 = ["aria-label"];
@@ -11,24 +11,24 @@ var _hoisted_2 = [
11
11
  ];
12
12
  var SegmentedControl_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
13
13
  __name: "SegmentedControl",
14
- props: /*@__PURE__*/ mergeModels({
14
+ props: {
15
15
  options: {},
16
+ value: {},
17
+ defaultValue: {},
16
18
  fullWidth: {
17
19
  type: Boolean,
18
20
  default: false
19
21
  },
20
22
  ariaLabel: {}
21
- }, {
22
- "value": { required: true },
23
- "valueModifiers": {}
24
- }),
23
+ },
25
24
  emits: ["update:value"],
26
- setup(__props) {
27
- const value = useModel(__props, "value");
25
+ setup(__props, { emit: __emit }) {
26
+ const emit = __emit;
27
+ const { value, set } = useControllable("value", () => __props.value, () => __props.defaultValue ?? __props.options[0]?.value, (next) => emit("update:value", next));
28
28
  const name = useId();
29
29
  const group = useTemplateRef("group");
30
30
  function choose(option) {
31
- value.value = option;
31
+ set(option);
32
32
  for (const input of group.value?.querySelectorAll("input") ?? []) keepChecked(input, () => input.value === value.value);
33
33
  }
34
34
  return (_ctx, _cache) => {
@@ -42,14 +42,13 @@ var SegmentedControl_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
42
42
  return openBlock(), createElementBlock("label", {
43
43
  key: option.value,
44
44
  class: normalizeClass(unref(segmentedControlOptionClass)(__props.fullWidth))
45
- }, [createElementVNode("input", {
45
+ }, [createElementVNode("input", mergeProps({
46
46
  type: "radio",
47
47
  name: unref(name),
48
48
  value: option.value,
49
49
  class: "peer sr-only",
50
- checked: option.value === value.value,
51
- onChange: ($event) => choose(option.value)
52
- }, null, 40, _hoisted_2), createElementVNode("span", { class: normalizeClass(unref(segmentedControlSegmentClass)) }, toDisplayString(option.label), 3)], 2);
50
+ checked: option.value === unref(value)
51
+ }, { ref_for: true }, unref(formDefault)({ defaultChecked: option.value === unref(value) }), { onChange: ($event) => choose(option.value) }), null, 16, _hoisted_2), createElementVNode("span", { class: normalizeClass(unref(segmentedControlSegmentClass)) }, toDisplayString(option.label), 3)], 2);
53
52
  }), 128))], 10, _hoisted_1);
54
53
  };
55
54
  }
@@ -4,13 +4,15 @@ export type SelectProps<Value extends string = string> = SelectBaseProps<Value>;
4
4
  declare const __VLS_export: <Value extends string = string>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>['props'], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, 'attrs' | 'emit' | 'slots'>>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>['expose'], __VLS_setup?: Promise<{
5
5
  props: import('vue').PublicProps & __VLS_PrettifyLocal<SelectProps<Value> & {
6
6
  "onUpdate:value"?: ((value: Value) => any) | undefined;
7
+ "onUpdate:values"?: ((values: Value[]) => any) | undefined;
8
+ onValuesChange?: ((values: Value[]) => any) | undefined;
7
9
  }> & (typeof globalThis extends {
8
10
  __VLS_PROPS_FALLBACK: infer P;
9
11
  } ? P : {});
10
12
  expose: (exposed: {}) => void;
11
13
  attrs: any;
12
14
  slots: {};
13
- emit: (evt: "update:value", value: Value) => void;
15
+ emit: ((evt: "update:value", value: Value) => void) & ((evt: "update:values", values: Value[]) => void) & ((evt: "valuesChange", values: Value[]) => void);
14
16
  }>) => import('vue').VNode & {
15
17
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
16
18
  };
@@ -1,27 +1,33 @@
1
+ import { useControllable } from "./controlled.js";
1
2
  import Icon_default from "./Icon.js";
2
3
  import { useModalPopover } from "./modal-popover.js";
3
4
  import Portal_default from "./Portal.js";
4
5
  import { usePresence } from "./presence.js";
5
6
  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";
7
+ import { keepListKeys, orderedValues, readCssPx, selectOptionIds, selectedLabels, underlayLayerStyle } from "@xds/core";
7
8
  import { normalizeProps as normalizeProps$1, useMachine } from "@zag-js/vue";
8
9
  import { space } from "@xds/tokens";
9
10
  import * as select from "@zag-js/select";
10
11
  // packages/ui-vue/src/Select.vue?vue&type=script&setup=true&lang.ts
11
12
  var _hoisted_1 = ["aria-labelledby", "aria-describedby"];
12
13
  var _hoisted_2 = { class: "xds-select__footer" };
13
- var _hoisted_3 = ["value"];
14
- var _hoisted_4 = ["hidden"];
15
- var _hoisted_5 = ["aria-labelledby", "aria-describedby"];
16
- var _hoisted_6 = { class: "xds-select__item-words" };
17
- var _hoisted_7 = ["id"];
14
+ var _hoisted_3 = {
15
+ key: 0,
16
+ value: ""
17
+ };
18
+ var _hoisted_4 = ["value"];
19
+ var _hoisted_5 = ["hidden"];
20
+ var _hoisted_6 = ["aria-labelledby", "aria-describedby"];
21
+ var _hoisted_7 = { class: "xds-select__item-words" };
18
22
  var _hoisted_8 = ["id"];
23
+ var _hoisted_9 = ["id"];
19
24
  var Select_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
20
25
  __name: "Select",
21
26
  props: {
22
27
  label: {},
23
28
  options: {},
24
29
  value: {},
30
+ defaultValue: {},
25
31
  placeholder: {},
26
32
  description: {},
27
33
  error: {},
@@ -29,11 +35,28 @@ var Select_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
29
35
  disabled: {
30
36
  type: Boolean,
31
37
  default: false
32
- }
38
+ },
39
+ multiple: {
40
+ type: Boolean,
41
+ default: false
42
+ },
43
+ values: {},
44
+ defaultValues: {}
33
45
  },
34
- emits: ["update:value"],
46
+ emits: [
47
+ "update:value",
48
+ "update:values",
49
+ "valuesChange"
50
+ ],
35
51
  setup(__props, { emit: __emit }) {
36
52
  const emit = __emit;
53
+ const { value, set } = useControllable("value", () => __props.value, () => __props.defaultValue, (next) => {
54
+ if (next !== void 0) emit("update:value", next);
55
+ });
56
+ const { value: values, set: setValues } = useControllable("values", () => __props.values, () => __props.defaultValues ?? [], (next) => {
57
+ emit("update:values", [...next]);
58
+ emit("valuesChange", [...next]);
59
+ });
37
60
  const id = useId();
38
61
  const valueId = `${id}-value`;
39
62
  const descriptionId = `${id}-description`;
@@ -47,11 +70,17 @@ var Select_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
47
70
  const service = useMachine(select.machine, computed(() => ({
48
71
  id,
49
72
  collection: collection.value,
50
- value: __props.value === void 0 ? [] : [__props.value],
73
+ value: __props.multiple ? [...values.value] : value.value === void 0 ? [] : [value.value],
51
74
  onValueChange: (details) => {
75
+ if (__props.multiple) {
76
+ setValues(orderedValues(__props.options, details.value));
77
+ return;
78
+ }
52
79
  const next = details.value[0];
53
- if (next !== void 0) emit("update:value", next);
80
+ if (next !== void 0) set(next);
54
81
  },
82
+ multiple: __props.multiple,
83
+ closeOnSelect: !__props.multiple,
55
84
  disabled: __props.disabled,
56
85
  invalid: invalid.value,
57
86
  name: __props.name,
@@ -102,7 +131,7 @@ var Select_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
102
131
  }), [createElementVNode("span", mergeProps(api.value.getValueTextProps(), {
103
132
  id: valueId,
104
133
  class: "xds-select__value"
105
- }), toDisplayString(api.value.valueAsString || __props.placeholder), 17), createVNode(Icon_default, {
134
+ }), toDisplayString((__props.multiple ? unref(selectedLabels)(__props.options, unref(values)) : api.value.valueAsString) || __props.placeholder), 17), createVNode(Icon_default, {
106
135
  name: "chevrons-up-down",
107
136
  size: "sm",
108
137
  class: "text-xds-field-placeholder"
@@ -116,11 +145,11 @@ var Select_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
116
145
  class: "xds-select__error",
117
146
  "aria-live": "polite"
118
147
  }, toDisplayString(__props.error), 1)]),
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) => {
148
+ createElementVNode("select", normalizeProps(guardReactiveProps(api.value.getHiddenSelectProps())), [!__props.multiple ? (openBlock(), createElementBlock("option", _hoisted_3)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option) => {
120
149
  return openBlock(), createElementBlock("option", {
121
150
  key: option.value,
122
151
  value: option.value
123
- }, toDisplayString(option.label), 9, _hoisted_3);
152
+ }, toDisplayString(option.label), 9, _hoisted_4);
124
153
  }), 128))], 16),
125
154
  createVNode(Portal_default, null, {
126
155
  default: withCtx(() => [api.value.open ? (openBlock(), createElementBlock("div", {
@@ -141,19 +170,19 @@ var Select_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
141
170
  "aria-labelledby": unref(selectOptionIds)(unref(id), index).label,
142
171
  "aria-describedby": option.description ? unref(selectOptionIds)(unref(id), index).description : void 0,
143
172
  class: "xds-select__item"
144
- }), [createElementVNode("span", _hoisted_6, [createElementVNode("span", mergeProps({ ref_for: true }, api.value.getItemTextProps({ item: option }), {
173
+ }), [createElementVNode("span", _hoisted_7, [createElementVNode("span", mergeProps({ ref_for: true }, api.value.getItemTextProps({ item: option }), {
145
174
  id: unref(selectOptionIds)(unref(id), index).label,
146
175
  class: "xds-select__item-label"
147
- }), toDisplayString(option.label), 17, _hoisted_7), option.description ? (openBlock(), createElementBlock("span", {
176
+ }), toDisplayString(option.label), 17, _hoisted_8), option.description ? (openBlock(), createElementBlock("span", {
148
177
  key: 0,
149
178
  id: unref(selectOptionIds)(unref(id), index).description,
150
179
  class: "xds-select__item-description"
151
- }, toDisplayString(option.description), 9, _hoisted_8)) : createCommentVNode("", true)]), api.value.getItemState({ item: option }).selected ? (openBlock(), createBlock(Icon_default, {
180
+ }, toDisplayString(option.description), 9, _hoisted_9)) : createCommentVNode("", true)]), api.value.getItemState({ item: option }).selected ? (openBlock(), createBlock(Icon_default, {
152
181
  key: 0,
153
182
  name: "check",
154
183
  size: "sm"
155
- })) : createCommentVNode("", true)], 16, _hoisted_5);
156
- }), 128))], 16)], 16, _hoisted_4)], 16)]),
184
+ })) : createCommentVNode("", true)], 16, _hoisted_6);
185
+ }), 128))], 16)], 16, _hoisted_5)], 16)]),
157
186
  _: 1
158
187
  })
159
188
  ], 16);
@@ -1,13 +1,8 @@
1
1
  import { type SliderBaseProps } from "@xds/core";
2
- export type SliderProps = Omit<SliderBaseProps, "value">;
3
- type __VLS_Props = SliderProps;
4
- type __VLS_ModelProps = {
5
- "value": number;
6
- };
7
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
8
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
2
+ export type SliderProps = SliderBaseProps;
3
+ declare const __VLS_export: import("vue").DefineComponent<SliderBaseProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
4
  "update:value": (value: number) => any;
10
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
5
+ }, string, import("vue").PublicProps, Readonly<SliderBaseProps> & Readonly<{
11
6
  "onUpdate:value"?: ((value: number) => any) | undefined;
12
7
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
8
  declare const _default: typeof __VLS_export;
@@ -1,4 +1,5 @@
1
- import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeModels, mergeProps, normalizeProps, openBlock, toDisplayString, unref, useId, useModel, useTemplateRef } from "vue";
1
+ import { useControllable } from "./controlled.js";
2
+ import { computed, createCommentVNode, createElementBlock, createElementVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, openBlock, toDisplayString, unref, useId, useTemplateRef } from "vue";
2
3
  import { focusThumbOnPress, sliderArrowValue, sliderPageSize, sliderValueText } from "@xds/core";
3
4
  import { mergeProps as mergeProps$1, normalizeProps as normalizeProps$1, useMachine } from "@zag-js/vue";
4
5
  import * as slider from "@zag-js/slider";
@@ -6,8 +7,10 @@ import * as slider from "@zag-js/slider";
6
7
  var _hoisted_1 = ["aria-labelledby"];
7
8
  var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
8
9
  __name: "Slider",
9
- props: /*@__PURE__*/ mergeModels({
10
+ props: {
10
11
  label: {},
12
+ value: {},
13
+ defaultValue: {},
11
14
  min: { default: 0 },
12
15
  max: { default: 100 },
13
16
  step: { default: 1 },
@@ -21,13 +24,11 @@ var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
21
24
  },
22
25
  name: {},
23
26
  locale: {}
24
- }, {
25
- "value": { required: true },
26
- "valueModifiers": {}
27
- }),
27
+ },
28
28
  emits: ["update:value"],
29
- setup(__props) {
30
- const value = useModel(__props, "value");
29
+ setup(__props, { emit: __emit }) {
30
+ const emit = __emit;
31
+ const { value, set } = useControllable("value", () => __props.value, () => __props.defaultValue ?? __props.min, (next) => emit("update:value", next));
31
32
  const id = useId();
32
33
  const pageSize = computed(() => sliderPageSize({
33
34
  min: __props.min,
@@ -38,7 +39,7 @@ var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
38
39
  id,
39
40
  name: __props.name,
40
41
  value: [value.value],
41
- onValueChange: (details) => value.value = details.value[0] ?? __props.min,
42
+ onValueChange: (details) => set(details.value[0] ?? __props.min),
42
43
  min: __props.min,
43
44
  max: __props.max,
44
45
  step: __props.step,
@@ -76,7 +77,7 @@ var Slider_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
76
77
  __props.showValue ? (openBlock(), createElementBlock("output", mergeProps({ key: 0 }, api.value.getValueTextProps(), {
77
78
  "aria-live": "off",
78
79
  class: "xds-slider__output"
79
- }), toDisplayString(unref(sliderValueText)(api.value.value[0] ?? value.value, __props.locale)), 17)) : createCommentVNode("", true),
80
+ }), toDisplayString(unref(sliderValueText)(api.value.value[0] ?? unref(value), __props.locale)), 17)) : createCommentVNode("", true),
80
81
  createElementVNode("div", mergeProps(control.value, { class: "xds-slider__control" }), [createElementVNode("div", mergeProps(api.value.getTrackProps(), { class: "xds-slider__track" }), [createElementVNode("div", mergeProps(api.value.getRangeProps(), { class: "xds-slider__range" }), null, 16)], 16), createElementVNode("div", mergeProps(thumb.value, {
81
82
  ref_key: "thumb",
82
83
  ref: thumb,
@@ -1,16 +1,19 @@
1
1
  import { type SwitchBaseProps } from "@xds/core";
2
- export type SwitchProps = Omit<SwitchBaseProps, "checked" | "aria-label"> & {
2
+ export type SwitchProps = Omit<SwitchBaseProps, "aria-label"> & {
3
3
  ariaLabel?: string;
4
4
  };
5
- type __VLS_Props = SwitchProps;
6
- type __VLS_ModelProps = {
7
- "checked": boolean;
8
- };
9
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
- declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
- "update:checked": (value: boolean) => any;
12
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
13
- "onUpdate:checked"?: ((value: boolean) => any) | undefined;
5
+ declare const __VLS_export: import("vue").DefineComponent<SwitchProps, {
6
+ focus: (options?: FocusOptions) => void | undefined;
7
+ blur: () => void | undefined;
8
+ element: () => HTMLInputElement | null;
9
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
+ blur: (event: FocusEvent) => any;
11
+ focus: (event: FocusEvent) => any;
12
+ "update:checked": (checked: boolean) => any;
13
+ }, string, import("vue").PublicProps, Readonly<SwitchProps> & Readonly<{
14
+ onBlur?: ((event: FocusEvent) => any) | undefined;
15
+ onFocus?: ((event: FocusEvent) => any) | undefined;
16
+ "onUpdate:checked"?: ((checked: boolean) => any) | undefined;
14
17
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
18
  declare const _default: typeof __VLS_export;
16
19
  export default _default;
@@ -1,5 +1,5 @@
1
- import { keepChecked } from "./controlled.js";
2
- import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeModels, normalizeClass, openBlock, toDisplayString, unref, useModel } from "vue";
1
+ import { focusable, formDefault, keepChecked, useControllable, useFormReset } from "./controlled.js";
2
+ import { createCommentVNode, createElementBlock, createElementVNode, defineComponent, mergeProps, normalizeClass, openBlock, toDisplayString, unref, useTemplateRef } from "vue";
3
3
  import { classes, rootPart, switchClass, switchLabelClass, switchThumbClass, switchTrackClass } from "@xds/core";
4
4
  // packages/ui-vue/src/Switch.vue?vue&type=script&setup=true&lang.ts
5
5
  var _hoisted_1 = [
@@ -10,40 +10,52 @@ var _hoisted_1 = [
10
10
  ];
11
11
  var Switch_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
12
12
  __name: "Switch",
13
- props: /*@__PURE__*/ mergeModels({
13
+ props: {
14
+ checked: { type: Boolean },
15
+ defaultChecked: {
16
+ type: Boolean,
17
+ default: false
18
+ },
14
19
  label: {},
15
20
  disabled: {
16
21
  type: Boolean,
17
22
  default: false
18
23
  },
19
24
  ariaLabel: {}
20
- }, {
21
- "checked": {
22
- type: Boolean,
23
- required: true
24
- },
25
- "checkedModifiers": {}
26
- }),
27
- emits: ["update:checked"],
28
- setup(__props) {
29
- const checked = useModel(__props, "checked");
25
+ },
26
+ emits: [
27
+ "update:checked",
28
+ "focus",
29
+ "blur"
30
+ ],
31
+ setup(__props, { expose: __expose, emit: __emit }) {
32
+ const emit = __emit;
33
+ const input = useTemplateRef("input");
34
+ const { value: checked, set, controlled, reset } = useControllable("checked", () => __props.checked, () => __props.defaultChecked, (next) => emit("update:checked", next));
35
+ useFormReset(() => input.value, controlled, reset);
36
+ __expose(focusable(() => input.value));
30
37
  function change(event) {
31
- const input = event.currentTarget;
32
- checked.value = input.checked;
33
- keepChecked(input, () => checked.value);
38
+ const element = event.currentTarget;
39
+ set(element.checked);
40
+ keepChecked(element, () => checked.value);
34
41
  }
35
42
  return (_ctx, _cache) => {
36
43
  return openBlock(), createElementBlock("label", { class: normalizeClass(unref(classes)(unref(rootPart)("Switch"), unref(switchClass))) }, [
37
- createElementVNode("input", {
44
+ createElementVNode("input", mergeProps({
45
+ ref_key: "input",
46
+ ref: input,
38
47
  type: "checkbox",
39
48
  role: "switch",
40
- "aria-checked": checked.value ? "true" : "false",
49
+ "aria-checked": unref(checked) ? "true" : "false",
41
50
  "aria-label": __props.ariaLabel,
42
51
  class: "peer sr-only",
43
- checked: checked.value,
52
+ checked: unref(checked)
53
+ }, unref(formDefault)({ defaultChecked: unref(checked) }), {
44
54
  disabled: __props.disabled,
45
- onChange: change
46
- }, null, 40, _hoisted_1),
55
+ onChange: change,
56
+ onFocus: _cache[0] || (_cache[0] = ($event) => emit("focus", $event)),
57
+ onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur", $event))
58
+ }), null, 16, _hoisted_1),
47
59
  createElementVNode("span", { class: normalizeClass(unref(switchTrackClass)) }, [createElementVNode("span", { class: normalizeClass(unref(switchThumbClass)) }, null, 2)], 2),
48
60
  __props.label ? (openBlock(), createElementBlock("span", {
49
61
  key: 0,
package/dist/Table.js ADDED
@@ -0,0 +1,4 @@
1
+ import Table_vue_vue_type_script_setup_true_lang_default from "./Table.vue_vue_type_script_setup_true_lang.js";
2
+ // packages/ui-vue/src/Table.vue
3
+ var Table_default = Table_vue_vue_type_script_setup_true_lang_default;
4
+ export { Table_default as default };
@@ -0,0 +1,10 @@
1
+ import { type TableBaseProps, type TableSort } from "@xds/core";
2
+ export type { SortDirection, TableColumn, TableRow, TableSort } from "@xds/core";
3
+ export type TableProps = TableBaseProps;
4
+ declare const __VLS_export: import("vue").DefineComponent<TableBaseProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ sortChange: (sort: TableSort) => any;
6
+ }, string, import("vue").PublicProps, Readonly<TableBaseProps> & Readonly<{
7
+ onSortChange?: ((sort: TableSort) => any) | undefined;
8
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ declare const _default: typeof __VLS_export;
10
+ export default _default;
@@ -0,0 +1,61 @@
1
+ import Icon_default from "./Icon.js";
2
+ import { Fragment, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, renderList, toDisplayString, unref } from "vue";
3
+ import { TABLE_PARTS, columnSort, nextSort, rootPart, sortIcon } from "@xds/core";
4
+ // packages/ui-vue/src/Table.vue?vue&type=script&setup=true&lang.ts
5
+ var _hoisted_1 = ["aria-label"];
6
+ var _hoisted_2 = ["aria-sort"];
7
+ var _hoisted_3 = ["onClick"];
8
+ var _hoisted_4 = ["colspan"];
9
+ var Table_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
10
+ __name: "Table",
11
+ props: {
12
+ label: {},
13
+ columns: {},
14
+ rows: {},
15
+ sort: {},
16
+ empty: {}
17
+ },
18
+ emits: ["sortChange"],
19
+ setup(__props, { emit: __emit }) {
20
+ const emit = __emit;
21
+ const end = (align) => align === "end" ? TABLE_PARTS.end : void 0;
22
+ return (_ctx, _cache) => {
23
+ return openBlock(), createElementBlock("div", { class: normalizeClass(unref(rootPart)("Table")) }, [createElementVNode("table", {
24
+ class: normalizeClass(unref(TABLE_PARTS).table),
25
+ "aria-label": __props.label
26
+ }, [createElementVNode("thead", null, [createElementVNode("tr", { class: normalizeClass(unref(TABLE_PARTS).row) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column) => {
27
+ return openBlock(), createElementBlock("th", {
28
+ key: column.key,
29
+ scope: "col",
30
+ "aria-sort": unref(columnSort)(__props.sort, column.key),
31
+ class: normalizeClass([unref(TABLE_PARTS).header, end(column.align)])
32
+ }, [column.sortable ? (openBlock(), createElementBlock("button", {
33
+ key: 0,
34
+ type: "button",
35
+ class: normalizeClass(unref(TABLE_PARTS).sort),
36
+ onClick: ($event) => emit("sortChange", unref(nextSort)(__props.sort, column.key))
37
+ }, [createTextVNode(toDisplayString(column.label) + " ", 1), createVNode(Icon_default, {
38
+ name: unref(sortIcon)(unref(columnSort)(__props.sort, column.key)),
39
+ size: "xs"
40
+ }, null, 8, ["name"])], 10, _hoisted_3)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(column.label), 1)], 64))], 10, _hoisted_2);
41
+ }), 128))], 2)]), createElementVNode("tbody", null, [__props.rows.length === 0 && __props.empty !== void 0 ? (openBlock(), createElementBlock("tr", {
42
+ key: 0,
43
+ class: normalizeClass(unref(TABLE_PARTS).row)
44
+ }, [createElementVNode("td", {
45
+ class: normalizeClass(unref(TABLE_PARTS).empty),
46
+ colspan: __props.columns.length
47
+ }, toDisplayString(__props.empty), 11, _hoisted_4)], 2)) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(__props.rows, (row) => {
48
+ return openBlock(), createElementBlock("tr", {
49
+ key: row.id,
50
+ class: normalizeClass(unref(TABLE_PARTS).row)
51
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column, index) => {
52
+ return openBlock(), createElementBlock("td", {
53
+ key: column.key,
54
+ class: normalizeClass([unref(TABLE_PARTS).cell, end(column.align)])
55
+ }, toDisplayString(row.cells[index]), 3);
56
+ }), 128))], 2);
57
+ }), 128))])], 10, _hoisted_1)], 2);
58
+ };
59
+ }
60
+ });
61
+ export { Table_vue_vue_type_script_setup_true_lang_default as default };
@@ -1,9 +1,7 @@
1
1
  import { type TabsBaseProps } from "@xds/core";
2
- export type TabsProps<Value extends string> = Omit<TabsBaseProps<Value>, "value">;
2
+ export type TabsProps<Value extends string> = TabsBaseProps<Value>;
3
3
  declare const __VLS_export: <Value extends string>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>['props'], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, 'attrs' | 'emit' | 'slots'>>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>['expose'], __VLS_setup?: Promise<{
4
- props: import('vue').PublicProps & __VLS_PrettifyLocal<(TabsProps<Value> & {
5
- value: Value;
6
- }) & {
4
+ props: import('vue').PublicProps & __VLS_PrettifyLocal<TabsProps<Value> & {
7
5
  "onUpdate:value"?: ((value: Value) => any) | undefined;
8
6
  }> & (typeof globalThis extends {
9
7
  __VLS_PROPS_FALLBACK: infer P;
@@ -11,7 +9,7 @@ declare const __VLS_export: <Value extends string>(__VLS_props: NonNullable<Awai
11
9
  expose: (exposed: {}) => void;
12
10
  attrs: any;
13
11
  slots: {};
14
- emit: (event: "update:value", value: Value) => void;
12
+ emit: (evt: "update:value", value: Value) => void;
15
13
  }>) => import('vue').VNode & {
16
14
  __ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
17
15
  };
@@ -1,5 +1,6 @@
1
+ import { useControllable } from "./controlled.js";
1
2
  import Icon_default from "./Icon.js";
2
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeModels, mergeProps, openBlock, renderList, toDisplayString, unref, useId, useModel } from "vue";
3
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, mergeProps, openBlock, renderList, toDisplayString, unref, useId } from "vue";
3
4
  import { tabStopIndex, tabsClass } from "@xds/core";
4
5
  import { normalizeProps as normalizeProps$1, useMachine } from "@zag-js/vue";
5
6
  import * as tabs from "@zag-js/tabs";
@@ -7,25 +8,25 @@ import * as tabs from "@zag-js/tabs";
7
8
  var _hoisted_1 = ["aria-label"];
8
9
  var Tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
9
10
  __name: "Tabs",
10
- props: /*@__PURE__*/ mergeModels({
11
+ props: {
11
12
  items: {},
13
+ value: {},
14
+ defaultValue: {},
12
15
  label: {},
13
16
  fullWidth: {
14
17
  type: Boolean,
15
18
  default: false
16
19
  }
17
- }, {
18
- "value": { required: true },
19
- "valueModifiers": {}
20
- }),
20
+ },
21
21
  emits: ["update:value"],
22
- setup(__props) {
23
- const value = useModel(__props, "value");
22
+ setup(__props, { emit: __emit }) {
23
+ const emit = __emit;
24
+ const { value, set } = useControllable("value", () => __props.value, () => __props.defaultValue ?? __props.items[0]?.value, (next) => emit("update:value", next));
24
25
  const id = useId();
25
26
  const service = useMachine(tabs.machine, computed(() => ({
26
27
  id,
27
28
  value: value.value,
28
- onValueChange: (details) => value.value = details.value
29
+ onValueChange: (details) => set(details.value)
29
30
  })));
30
31
  const api = computed(() => tabs.connect(service, normalizeProps$1));
31
32
  const trigger = (item) => {
@@ -1,8 +1,7 @@
1
1
  import type { TextFieldBaseProps } from "@xds/core";
2
- export type TextFieldProps = Omit<TextFieldBaseProps, "value" | "autoComplete"> & {
2
+ export type TextFieldProps = Omit<TextFieldBaseProps, "autoComplete"> & {
3
3
  autoComplete?: string;
4
4
  };
5
- type __VLS_Props = TextFieldProps;
6
5
  type __VLS_Slots = {
7
6
  /**
8
7
  * Inside the box, in front of the text: an icon, a unit. It takes the placeholder's color
@@ -12,13 +11,17 @@ type __VLS_Slots = {
12
11
  /** Inside the box, after the text: an icon, a unit, a small button. */
13
12
  trailing?(): unknown;
14
13
  };
15
- type __VLS_ModelProps = {
16
- "value": string;
17
- };
18
- type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
19
- declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ declare const __VLS_base: import("vue").DefineComponent<TextFieldProps, {
15
+ focus: (options?: FocusOptions) => void | undefined;
16
+ blur: () => void | undefined;
17
+ element: () => HTMLInputElement | HTMLTextAreaElement | null;
18
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
+ blur: (event: FocusEvent) => any;
20
+ focus: (event: FocusEvent) => any;
20
21
  "update:value": (value: string) => any;
21
- }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
+ }, string, import("vue").PublicProps, Readonly<TextFieldProps> & Readonly<{
23
+ onBlur?: ((event: FocusEvent) => any) | undefined;
24
+ onFocus?: ((event: FocusEvent) => any) | undefined;
22
25
  "onUpdate:value"?: ((value: string) => any) | undefined;
23
26
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
27
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;