@xds/vue 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/Banner.vue_vue_type_script_setup_true_lang.js +4 -2
  2. package/dist/Button.vue.d.ts +9 -1
  3. package/dist/Button.vue_vue_type_script_setup_true_lang.js +18 -5
  4. package/dist/Checkbox.vue.d.ts +13 -10
  5. package/dist/Checkbox.vue_vue_type_script_setup_true_lang.js +32 -20
  6. package/dist/DatePicker.vue_vue_type_script_setup_true_lang.js +4 -1
  7. package/dist/DateRangePicker.vue_vue_type_script_setup_true_lang.js +5 -2
  8. package/dist/Dialog.vue.d.ts +5 -2
  9. package/dist/Dialog.vue_vue_type_script_setup_true_lang.js +6 -5
  10. package/dist/IconButton.vue.d.ts +9 -1
  11. package/dist/IconButton.vue_vue_type_script_setup_true_lang.js +18 -5
  12. package/dist/Labels.vue.d.ts +17 -0
  13. package/dist/Labels.vue_vue_type_script_setup_true_lang.js +14 -0
  14. package/dist/Labels2.js +4 -0
  15. package/dist/Menu.vue.d.ts +4 -1
  16. package/dist/Menu.vue_vue_type_script_setup_true_lang.js +5 -4
  17. package/dist/RadioGroup.vue_vue_type_script_setup_true_lang.js +13 -7
  18. package/dist/SearchField.vue.d.ts +11 -8
  19. package/dist/SearchField.vue_vue_type_script_setup_true_lang.js +40 -22
  20. package/dist/SegmentedControl.vue.d.ts +3 -7
  21. package/dist/SegmentedControl.vue_vue_type_script_setup_true_lang.js +13 -14
  22. package/dist/Select.vue_vue_type_script_setup_true_lang.js +7 -2
  23. package/dist/Slider.vue.d.ts +3 -8
  24. package/dist/Slider.vue_vue_type_script_setup_true_lang.js +11 -10
  25. package/dist/Switch.vue.d.ts +13 -10
  26. package/dist/Switch.vue_vue_type_script_setup_true_lang.js +33 -21
  27. package/dist/Tabs.vue.d.ts +3 -5
  28. package/dist/Tabs.vue_vue_type_script_setup_true_lang.js +10 -9
  29. package/dist/TextField.vue.d.ts +11 -8
  30. package/dist/TextField.vue_vue_type_script_setup_true_lang.js +26 -13
  31. package/dist/Toast.vue_vue_type_script_setup_true_lang.js +5 -11
  32. package/dist/TooltipOverlay.vue.d.ts +1 -0
  33. package/dist/TooltipOverlay.vue_vue_type_script_setup_true_lang.js +6 -5
  34. package/dist/controlled.d.ts +46 -0
  35. package/dist/controlled.js +64 -2
  36. package/dist/index.d.ts +2 -0
  37. package/dist/index.js +2 -1
  38. package/dist/labels.d.ts +9 -0
  39. package/dist/labels.js +17 -0
  40. package/dist/preview.js +9 -2
  41. package/dist/trigger.d.ts +7 -0
  42. package/dist/trigger.js +13 -1
  43. package/package.json +3 -3
  44. package/styles.css +70 -0
  45. package/tailwind.css +1 -1
@@ -1,6 +1,7 @@
1
1
  import Button_default from "./Button.js";
2
2
  import { useDefaults } from "./defaults.js";
3
3
  import IconButton_default from "./IconButton.js";
4
+ import { useLabels } from "./labels.js";
4
5
  import { createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, renderSlot, toDisplayString, unref, withCtx } from "vue";
5
6
  import { BANNER_PARTS, bannerClass, bannerIconClass, bannerIconPath, bannerRole, classes, rootPart } from "@xds/core";
6
7
  // packages/ui-vue/src/Banner.vue?vue&type=script&setup=true&lang.ts
@@ -11,12 +12,13 @@ var Banner_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
11
12
  props: {
12
13
  tone: {},
13
14
  title: {},
14
- dismissLabel: { default: "Dismiss" },
15
+ dismissLabel: {},
15
16
  action: {},
16
17
  onDismiss: { type: Function }
17
18
  },
18
19
  setup(__props) {
19
20
  const options = useDefaults("Banner", () => ({ tone: __props.tone }));
21
+ const labels = useLabels();
20
22
  return (_ctx, _cache) => {
21
23
  return openBlock(), createElementBlock("div", {
22
24
  role: unref(bannerRole)(unref(options).tone),
@@ -53,7 +55,7 @@ var Banner_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
53
55
  class: normalizeClass(unref(BANNER_PARTS).dismiss)
54
56
  }, [createVNode(IconButton_default, {
55
57
  icon: "x",
56
- label: __props.dismissLabel,
58
+ label: __props.dismissLabel ?? unref(labels).dismiss,
57
59
  variant: "ghost",
58
60
  size: "sm",
59
61
  onPress: _cache[1] || (_cache[1] = ($event) => __props.onDismiss())
@@ -6,9 +6,17 @@ type __VLS_Slots = {
6
6
  /** Leave it out for a button that holds only an icon, and name that one with `aria-label`. */
7
7
  default?(): unknown;
8
8
  };
9
- declare const __VLS_base: import("vue").DefineComponent<ButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
+ declare const __VLS_base: import("vue").DefineComponent<ButtonProps, {
10
+ focus: (options?: FocusOptions) => void | undefined;
11
+ blur: () => void | undefined;
12
+ element: () => HTMLButtonElement | null;
13
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
14
+ blur: (event: FocusEvent) => any;
15
+ focus: (event: FocusEvent) => any;
10
16
  press: () => any;
11
17
  }, string, import("vue").PublicProps, Readonly<ButtonProps> & Readonly<{
18
+ onBlur?: ((event: FocusEvent) => any) | undefined;
19
+ onFocus?: ((event: FocusEvent) => any) | undefined;
12
20
  onPress?: (() => any) | undefined;
13
21
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
22
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -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 { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, guardReactiveProps, normalizeClass, normalizeProps, openBlock, renderSlot, unref, useSlots } from "vue";
5
+ import { useTrigger, withAttributes } from "./trigger.js";
6
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, renderSlot, unref, useSlots, useTemplateRef } from "vue";
6
7
  import { BUTTON_ICON, buttonClass, isHeld } from "@xds/core";
7
8
  // packages/ui-vue/src/Button.vue?vue&type=script&setup=true&lang.ts
8
9
  var Button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
10
+ inheritAttrs: false,
9
11
  __name: "Button",
10
12
  props: {
11
13
  variant: {},
@@ -31,9 +33,15 @@ var Button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
31
33
  type: { default: "button" },
32
34
  ariaLabel: {}
33
35
  },
34
- emits: ["press"],
35
- setup(__props, { emit: __emit }) {
36
+ emits: [
37
+ "press",
38
+ "focus",
39
+ "blur"
40
+ ],
41
+ setup(__props, { expose: __expose, emit: __emit }) {
36
42
  const emit = __emit;
43
+ const button = useTemplateRef("button");
44
+ __expose(focusable(() => button.value));
37
45
  const slots = useSlots();
38
46
  const options = useDefaults("Button", () => ({
39
47
  variant: __props.variant,
@@ -61,6 +69,8 @@ var Button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
61
69
  "data-pending": __props.loading ? "" : void 0,
62
70
  "aria-pressed": __props.selected === void 0 ? void 0 : __props.selected ? "true" : "false",
63
71
  "aria-label": __props.ariaLabel,
72
+ onFocus: (event) => emit("focus", event),
73
+ onBlur: (event) => emit("blur", event),
64
74
  onClick: (event) => {
65
75
  if (__props.loading) {
66
76
  event.preventDefault();
@@ -70,7 +80,10 @@ var Button_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
70
80
  }
71
81
  }), () => __props.loading);
72
82
  return (_ctx, _cache) => {
73
- return openBlock(), createElementBlock("button", normalizeProps(guardReactiveProps(unref(attributes))), [
83
+ return openBlock(), createElementBlock("button", mergeProps({
84
+ ref_key: "button",
85
+ ref: button
86
+ }, unref(withAttributes)(unref(attributes), _ctx.$attrs)), [
74
87
  __props.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [__props.iconStart ? (openBlock(), createElementBlock("span", {
75
88
  key: 0,
76
89
  class: normalizeClass(icon.value.box)
@@ -1,16 +1,19 @@
1
1
  import { type CheckboxBaseProps } from "@xds/core";
2
- export type CheckboxProps = Omit<CheckboxBaseProps, "checked" | "aria-label"> & {
2
+ export type CheckboxProps = Omit<CheckboxBaseProps, "aria-label"> & {
3
3
  ariaLabel?: string;
4
4
  };
5
- type __VLS_Props = CheckboxProps;
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<CheckboxProps, {
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<CheckboxProps> & 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 { CHECKBOX_MARK, checkboxBoxClass, checkboxClass, checkboxLabelClass, checkboxMarkClass, classes, rootPart } from "@xds/core";
4
4
  // packages/ui-vue/src/Checkbox.vue?vue&type=script&setup=true&lang.ts
5
5
  var _hoisted_1 = [
@@ -11,7 +11,12 @@ var _hoisted_1 = [
11
11
  var _hoisted_2 = ["d"];
12
12
  var Checkbox_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
13
13
  __name: "Checkbox",
14
- props: /*@__PURE__*/ mergeModels({
14
+ props: {
15
+ checked: { type: Boolean },
16
+ defaultChecked: {
17
+ type: Boolean,
18
+ default: false
19
+ },
15
20
  label: {},
16
21
  name: {},
17
22
  disabled: {
@@ -19,32 +24,39 @@ var Checkbox_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineC
19
24
  default: false
20
25
  },
21
26
  ariaLabel: {}
22
- }, {
23
- "checked": {
24
- type: Boolean,
25
- required: true
26
- },
27
- "checkedModifiers": {}
28
- }),
29
- emits: ["update:checked"],
30
- setup(__props) {
31
- const checked = useModel(__props, "checked");
27
+ },
28
+ emits: [
29
+ "update:checked",
30
+ "focus",
31
+ "blur"
32
+ ],
33
+ setup(__props, { expose: __expose, emit: __emit }) {
34
+ const emit = __emit;
35
+ const input = useTemplateRef("input");
36
+ const { value: checked, set, controlled, reset } = useControllable("checked", () => __props.checked, () => __props.defaultChecked, (next) => emit("update:checked", next));
37
+ useFormReset(() => input.value, controlled, reset);
38
+ __expose(focusable(() => input.value));
32
39
  function change(event) {
33
- const input = event.currentTarget;
34
- checked.value = input.checked;
35
- keepChecked(input, () => checked.value);
40
+ const element = event.currentTarget;
41
+ set(element.checked);
42
+ keepChecked(element, () => checked.value);
36
43
  }
37
44
  return (_ctx, _cache) => {
38
45
  return openBlock(), createElementBlock("label", { class: normalizeClass(unref(classes)(unref(rootPart)("Checkbox"), unref(checkboxClass))) }, [
39
- createElementVNode("input", {
46
+ createElementVNode("input", mergeProps({
47
+ ref_key: "input",
48
+ ref: input,
40
49
  type: "checkbox",
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
55
  name: __props.name || void 0,
46
- onChange: change
47
- }, null, 40, _hoisted_1),
56
+ onChange: change,
57
+ onFocus: _cache[0] || (_cache[0] = ($event) => emit("focus", $event)),
58
+ onBlur: _cache[1] || (_cache[1] = ($event) => emit("blur", $event))
59
+ }), null, 16, _hoisted_1),
48
60
  createElementVNode("span", { class: normalizeClass(unref(checkboxBoxClass)) }, [(openBlock(), createElementBlock("svg", {
49
61
  viewBox: "0 0 16 16",
50
62
  fill: "none",
@@ -1,4 +1,5 @@
1
1
  import Icon_default from "./Icon.js";
2
+ import { useLabels } from "./labels.js";
2
3
  import { useModalPopover } from "./modal-popover.js";
3
4
  import Portal_default from "./Portal.js";
4
5
  import { usePresence } from "./presence.js";
@@ -39,11 +40,13 @@ var DatePicker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defin
39
40
  const id = useId();
40
41
  const ids = datePickerIds(id);
41
42
  const locale = computed(() => datePickerLocale(props.locale));
43
+ const labels = useLabels();
42
44
  const service = useMachine(datePicker.machine, computed(() => datePickerMachineProps(props, {
43
45
  id,
44
46
  locale: locale.value,
45
47
  onChange: (value) => emit("update:value", value),
46
- gutter: readCssPx(null, "--xds-space-1", space[1])
48
+ gutter: readCssPx(null, "--xds-space-1", space[1]),
49
+ labels: labels.value
47
50
  })));
48
51
  const api = computed(() => datePicker.connect(service, normalizeProps$1));
49
52
  const invalid = computed(() => props.error !== void 0);
@@ -1,4 +1,5 @@
1
1
  import Icon_default from "./Icon.js";
2
+ import { useLabels } from "./labels.js";
2
3
  import { useModalPopover } from "./modal-popover.js";
3
4
  import Portal_default from "./Portal.js";
4
5
  import { usePresence } from "./presence.js";
@@ -58,6 +59,7 @@ var DateRangePicker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
58
59
  const id = useId();
59
60
  const ids = datePickerIds(id);
60
61
  const locale = computed(() => datePickerLocale(props.locale));
62
+ const labels = useLabels();
61
63
  const draft = shallowRef(null);
62
64
  const months = ref(1);
63
65
  const shown = computed(() => shownRange(props.value, draft.value));
@@ -67,11 +69,12 @@ var DateRangePicker_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
67
69
  months: months.value,
68
70
  onDraft: (next) => draft.value = next,
69
71
  onChange: (value) => emit("update:value", value),
70
- gutter: readCssPx(null, "--xds-space-1", space[1])
72
+ gutter: readCssPx(null, "--xds-space-1", space[1]),
73
+ labels: labels.value
71
74
  })));
72
75
  const api = computed(() => datePicker.connect(service, normalizeProps$1));
73
76
  const invalid = computed(() => props.error !== void 0);
74
- const summary = computed(() => rangeSummary(shown.value, props, locale.value));
77
+ const summary = computed(() => rangeSummary(shown.value, props, locale.value, labels.value));
75
78
  const views = computed(() => rangeMonthViews(api.value, months.value));
76
79
  const trigger = computed(() => {
77
80
  const zag = api.value.getTriggerProps();
@@ -1,14 +1,17 @@
1
1
  import { type DialogBaseProps } from "@xds/core";
2
2
  export type DialogProps = DialogBaseProps;
3
+ type __VLS_Props = DialogProps & {
4
+ id?: string;
5
+ };
3
6
  type __VLS_Slots = {
4
7
  /** The body, between the description and the actions. It scrolls when it is too tall. */
5
8
  default?(): unknown;
6
9
  /** Buttons, in a row at the end edge. Put the main action last. */
7
10
  actions?(): unknown;
8
11
  };
9
- declare const __VLS_base: import("vue").DefineComponent<DialogBaseProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
10
13
  close: () => any;
11
- }, string, import("vue").PublicProps, Readonly<DialogBaseProps> & Readonly<{
14
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
15
  onClose?: (() => any) | undefined;
13
16
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
17
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -3,7 +3,7 @@ import { usePresence } from "./presence.js";
3
3
  import { TriggerScope } from "./trigger.js";
4
4
  import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, openBlock, renderSlot, toDisplayString, unref, useId, useSlots, useTemplateRef, withCtx, withModifiers } from "vue";
5
5
  import { leaveEscapeToFields } from "@xds/core";
6
- import { normalizeProps as normalizeProps$1, useMachine } from "@zag-js/vue";
6
+ import { mergeProps as mergeProps$1, normalizeProps as normalizeProps$1, useMachine } from "@zag-js/vue";
7
7
  import * as dialog from "@zag-js/dialog";
8
8
  // packages/ui-vue/src/Dialog.vue?vue&type=script&setup=true&lang.ts
9
9
  var _hoisted_1 = {
@@ -24,7 +24,8 @@ var Dialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
24
24
  dismissible: {
25
25
  type: Boolean,
26
26
  default: true
27
- }
27
+ },
28
+ id: {}
28
29
  },
29
30
  emits: ["close"],
30
31
  setup(__props, { emit: __emit }) {
@@ -36,6 +37,7 @@ var Dialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
36
37
  const content = useTemplateRef("content");
37
38
  const service = useMachine(dialog.machine, computed(() => ({
38
39
  id,
40
+ ids: { content: __props.id },
39
41
  open: __props.open,
40
42
  onOpenChange: (details) => {
41
43
  if (!details.open) emit("close");
@@ -60,12 +62,11 @@ var Dialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCom
60
62
  ref_key: "positioner",
61
63
  ref: positioner,
62
64
  class: "xds-dialog__positioner"
63
- }), [createElementVNode("section", mergeProps(api.value.getContentProps(), {
65
+ }), [createElementVNode("section", mergeProps(unref(mergeProps$1)(api.value.getContentProps(), _ctx.$attrs), {
64
66
  ref_key: "content",
65
67
  ref: content,
66
68
  hidden: false,
67
- class: ["xds-dialog", _ctx.$attrs.class],
68
- style: _ctx.$attrs.style
69
+ class: "xds-dialog"
69
70
  }), [
70
71
  createElementVNode("h2", mergeProps(api.value.getTitleProps(), { class: "xds-dialog__title" }), toDisplayString(__props.title), 17),
71
72
  __props.description ? (openBlock(), createElementBlock("p", mergeProps({ key: 0 }, api.value.getDescriptionProps(), { class: "xds-dialog__description" }), toDisplayString(__props.description), 17)) : createCommentVNode("", true),
@@ -1,8 +1,16 @@
1
1
  import { type IconButtonBaseProps } from "@xds/core";
2
2
  export type IconButtonProps = IconButtonBaseProps;
3
- declare const __VLS_export: import("vue").DefineComponent<IconButtonBaseProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
3
+ declare const __VLS_export: import("vue").DefineComponent<IconButtonBaseProps, {
4
+ focus: (options?: FocusOptions) => void | undefined;
5
+ blur: () => void | undefined;
6
+ element: () => HTMLButtonElement | null;
7
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
+ blur: (event: FocusEvent) => any;
9
+ focus: (event: FocusEvent) => any;
4
10
  press: () => any;
5
11
  }, string, import("vue").PublicProps, Readonly<IconButtonBaseProps> & Readonly<{
12
+ onBlur?: ((event: FocusEvent) => any) | undefined;
13
+ onFocus?: ((event: FocusEvent) => any) | undefined;
6
14
  onPress?: (() => any) | undefined;
7
15
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
16
  declare const _default: typeof __VLS_export;
@@ -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, guardReactiveProps, normalizeClass, normalizeProps, openBlock, unref } from "vue";
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: ["press"],
29
- setup(__props, { emit: __emit }) {
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", normalizeProps(guardReactiveProps(unref(attributes))), [__props.loading ? (openBlock(), createElementBlock("span", {
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 };
@@ -0,0 +1,4 @@
1
+ import Labels_vue_vue_type_script_setup_true_lang_default from "./Labels.vue_vue_type_script_setup_true_lang.js";
2
+ // packages/ui-vue/src/Labels.vue
3
+ var Labels_default = Labels_vue_vue_type_script_setup_true_lang_default;
4
+ export { Labels_default as default };
@@ -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<MenuBaseProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<MenuBaseProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
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: ["xds-menu", _ctx.$attrs.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,
@@ -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
- emit("update:value", option);
49
- for (const input of group.value?.querySelectorAll("input") ?? []) keepChecked(input, () => input.value === __props.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 === __props.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, 40, _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", {
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 = Omit<SearchFieldBaseProps, "value">;
3
- type __VLS_Props = SearchFieldProps;
4
- type __VLS_ModelProps = {
5
- "value": string;
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 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<__VLS_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>;