@serendie/ui 2.0.0 → 2.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 (118) hide show
  1. package/dist/components/CheckBox/CheckBox.js +36 -35
  2. package/dist/components/ChoiceBox/ChoiceBox.js +41 -41
  3. package/dist/components/DataTable/DataTableComponent.d.ts +3 -20
  4. package/dist/components/DataTable/DataTableComponent.js +38 -36
  5. package/dist/components/DataTable/table/HeaderCheckbox.js +29 -19
  6. package/dist/components/Search/Search.d.ts +3 -1
  7. package/dist/components/Search/Search.js +34 -33
  8. package/dist/components/Select/Select.d.ts +2 -1
  9. package/dist/components/Select/Select.js +47 -41
  10. package/dist/components/Tooltip/Tooltip.d.ts +14 -0
  11. package/dist/components/Tooltip/Tooltip.js +70 -0
  12. package/dist/components/Tooltip/index.d.ts +1 -0
  13. package/dist/components/Tooltip/index.js +4 -0
  14. package/dist/index.d.ts +1 -0
  15. package/dist/index.js +12 -10
  16. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-content.js +4 -6
  17. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-indicator.js +4 -6
  18. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item-trigger.js +10 -12
  19. package/dist/node_modules/@ark-ui/react/dist/components/accordion/accordion-item.js +16 -16
  20. package/dist/node_modules/@ark-ui/react/dist/components/accordion/use-accordion.js +13 -20
  21. package/dist/node_modules/@ark-ui/react/dist/components/avatar/avatar-root.js +1 -5
  22. package/dist/node_modules/@ark-ui/react/dist/components/avatar/use-avatar.js +14 -18
  23. package/dist/node_modules/@ark-ui/react/dist/components/checkbox/checkbox-hidden-input.js +4 -6
  24. package/dist/node_modules/@ark-ui/react/dist/components/checkbox/use-checkbox.js +22 -28
  25. package/dist/node_modules/@ark-ui/react/dist/components/collapsible/collapsible-content.js +7 -9
  26. package/dist/node_modules/@ark-ui/react/dist/components/collapsible/use-collapsible.js +14 -21
  27. package/dist/node_modules/@ark-ui/react/dist/components/collection/list-collection.js +5 -0
  28. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-content.js +9 -8
  29. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-item-group.js +4 -6
  30. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-positioner.js +4 -6
  31. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-root.js +17 -18
  32. package/dist/node_modules/@ark-ui/react/dist/components/combobox/combobox-trigger.js +10 -9
  33. package/dist/node_modules/@ark-ui/react/dist/components/combobox/use-combobox-item-context.js +5 -7
  34. package/dist/node_modules/@ark-ui/react/dist/components/combobox/use-combobox.js +21 -45
  35. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-backdrop.js +10 -9
  36. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-close-trigger.js +4 -6
  37. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-content.js +6 -5
  38. package/dist/node_modules/@ark-ui/react/dist/components/dialog/dialog-description.js +4 -6
  39. package/dist/node_modules/@ark-ui/react/dist/components/dialog/use-dialog.js +13 -22
  40. package/dist/node_modules/@ark-ui/react/dist/components/factory.js +26 -24
  41. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-content.js +9 -8
  42. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-item-group.js +1 -3
  43. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-item.js +15 -13
  44. package/dist/node_modules/@ark-ui/react/dist/components/menu/menu-root.js +13 -14
  45. package/dist/node_modules/@ark-ui/react/dist/components/menu/use-menu-option-item-props-context.js +10 -0
  46. package/dist/node_modules/@ark-ui/react/dist/components/menu/use-menu.js +14 -21
  47. package/dist/node_modules/@ark-ui/react/dist/components/pagination/pagination-ellipsis.js +4 -6
  48. package/dist/node_modules/@ark-ui/react/dist/components/pagination/pagination-next-trigger.js +4 -6
  49. package/dist/node_modules/@ark-ui/react/dist/components/pagination/pagination-prev-trigger.js +4 -6
  50. package/dist/node_modules/@ark-ui/react/dist/components/pagination/pagination-root.js +5 -4
  51. package/dist/node_modules/@ark-ui/react/dist/components/pagination/use-pagination.js +13 -19
  52. package/dist/node_modules/@ark-ui/react/dist/components/portal/portal.js +25 -16
  53. package/dist/node_modules/@ark-ui/react/dist/components/presence/split-presence-props.js +3 -2
  54. package/dist/node_modules/@ark-ui/react/dist/components/presence/use-presence.js +18 -18
  55. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-control.js +4 -6
  56. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item-text.js +4 -6
  57. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/radio-group-item.js +1 -5
  58. package/dist/node_modules/@ark-ui/react/dist/components/radio-group/use-radio-group.js +14 -22
  59. package/dist/node_modules/@ark-ui/react/dist/components/select/select-content.js +9 -8
  60. package/dist/node_modules/@ark-ui/react/dist/components/select/select-root.js +11 -12
  61. package/dist/node_modules/@ark-ui/react/dist/components/select/use-select.js +20 -47
  62. package/dist/node_modules/@ark-ui/react/dist/components/switch/switch-hidden-input.js +4 -6
  63. package/dist/node_modules/@ark-ui/react/dist/components/switch/use-switch.js +20 -26
  64. package/dist/node_modules/@ark-ui/react/dist/components/tabs/tabs-root.js +9 -8
  65. package/dist/node_modules/@ark-ui/react/dist/components/tabs/use-tabs.js +14 -21
  66. package/dist/node_modules/@ark-ui/react/dist/components/toast/create-toaster.js +3 -7
  67. package/dist/node_modules/@ark-ui/react/dist/components/toast/toaster.js +28 -15
  68. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-arrow-tip.js +13 -0
  69. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-arrow.js +13 -0
  70. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-content.js +15 -0
  71. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-positioner.js +14 -0
  72. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-root.js +14 -0
  73. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/tooltip-trigger.js +13 -0
  74. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/use-tooltip-context.js +10 -0
  75. package/dist/node_modules/@ark-ui/react/dist/components/tooltip/use-tooltip.js +17 -0
  76. package/dist/node_modules/@ark-ui/react/dist/utils/compose-refs.js +13 -7
  77. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +92 -90
  78. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +230 -216
  79. package/dist/node_modules/@zag-js/accordion/dist/index.js +210 -227
  80. package/dist/node_modules/@zag-js/aria-hidden/dist/index.js +49 -12
  81. package/dist/node_modules/@zag-js/avatar/dist/index.js +119 -134
  82. package/dist/node_modules/@zag-js/checkbox/dist/index.js +196 -197
  83. package/dist/node_modules/@zag-js/collapsible/dist/index.js +250 -198
  84. package/dist/node_modules/@zag-js/collection/dist/index.js +172 -179
  85. package/dist/node_modules/@zag-js/combobox/dist/index.js +1176 -1082
  86. package/dist/node_modules/@zag-js/core/dist/index.js +77 -496
  87. package/dist/node_modules/@zag-js/dialog/dist/index.js +243 -270
  88. package/dist/node_modules/@zag-js/dismissable/dist/index.js +62 -60
  89. package/dist/node_modules/@zag-js/dom-query/dist/index.js +465 -253
  90. package/dist/node_modules/@zag-js/focus-trap/dist/index.js +307 -0
  91. package/dist/node_modules/@zag-js/focus-visible/dist/index.js +48 -47
  92. package/dist/node_modules/@zag-js/interact-outside/dist/index.js +112 -80
  93. package/dist/node_modules/@zag-js/menu/dist/index.js +998 -884
  94. package/dist/node_modules/@zag-js/pagination/dist/index.js +207 -213
  95. package/dist/node_modules/@zag-js/popper/dist/index.js +130 -129
  96. package/dist/node_modules/@zag-js/presence/dist/index.js +139 -122
  97. package/dist/node_modules/@zag-js/radio-group/dist/index.js +297 -302
  98. package/dist/node_modules/@zag-js/react/dist/index.js +255 -103
  99. package/dist/node_modules/@zag-js/remove-scroll/dist/index.js +18 -31
  100. package/dist/node_modules/@zag-js/select/dist/index.js +889 -885
  101. package/dist/node_modules/@zag-js/store/dist/index.js +98 -137
  102. package/dist/node_modules/@zag-js/switch/dist/index.js +199 -191
  103. package/dist/node_modules/@zag-js/tabs/dist/index.js +383 -386
  104. package/dist/node_modules/@zag-js/toast/dist/index.js +646 -633
  105. package/dist/node_modules/@zag-js/tooltip/dist/index.js +459 -0
  106. package/dist/node_modules/@zag-js/types/dist/index.js +6 -6
  107. package/dist/node_modules/@zag-js/utils/dist/index.js +112 -99
  108. package/dist/node_modules/proxy-compare/dist/index.js +4 -106
  109. package/dist/styles.css +1 -1
  110. package/package.json +5 -5
  111. package/dist/node_modules/@ark-ui/react/dist/utils/use-is-server.js +0 -10
  112. package/dist/node_modules/@zag-js/dom-event/dist/index.js +0 -130
  113. package/dist/node_modules/@zag-js/element-rect/dist/index.js +0 -32
  114. package/dist/node_modules/@zag-js/form-utils/dist/index.js +0 -51
  115. package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -52
  116. package/dist/node_modules/focus-trap/dist/focus-trap.esm.js +0 -431
  117. package/dist/node_modules/klona/full/index.js +0 -21
  118. package/dist/node_modules/tabbable/dist/index.esm.js +0 -202
@@ -1,138 +1,112 @@
1
- import { createAnatomy as p } from "../../anatomy/dist/index.js";
2
- import { createScope as m, dataAttr as c, visuallyHiddenStyle as E, queryAll as h, nextTick as b } from "../../dom-query/dist/index.js";
3
- import { trackFocusVisible as y, isFocusVisible as T } from "../../focus-visible/dist/index.js";
4
- import { createMachine as V, guards as R } from "../../core/dist/index.js";
5
- import { trackElementRect as C } from "../../element-rect/dist/index.js";
6
- import { dispatchInputCheckedEvent as S, trackFormControl as k } from "../../form-utils/dist/index.js";
7
- import { compact as A, isString as F, isEqual as D } from "../../utils/dist/index.js";
8
- import { createProps as I } from "../../types/dist/index.js";
9
- var _ = p("radio-group").parts(
1
+ import { createAnatomy as S } from "../../anatomy/dist/index.js";
2
+ import { dispatchInputCheckedEvent as k, trackElementRect as R, trackFormControl as D, dataAttr as u, visuallyHiddenStyle as F, isSafari as A, isLeftClick as $, queryAll as P } from "../../dom-query/dist/index.js";
3
+ import { trackFocusVisible as _, isFocusVisible as w } from "../../focus-visible/dist/index.js";
4
+ import { createMachine as O, createGuards as H } from "../../core/dist/index.js";
5
+ import { isString as L } from "../../utils/dist/index.js";
6
+ import { createProps as b } from "../../types/dist/index.js";
7
+ var U = S("radio-group").parts(
10
8
  "root",
11
9
  "label",
12
10
  "item",
13
11
  "itemText",
14
12
  "itemControl",
15
13
  "indicator"
16
- ), v = _.build(), n = m({
17
- getRootId: (e) => {
18
- var i;
19
- return ((i = e.ids) == null ? void 0 : i.root) ?? `radio-group:${e.id}`;
20
- },
21
- getLabelId: (e) => {
22
- var i;
23
- return ((i = e.ids) == null ? void 0 : i.label) ?? `radio-group:${e.id}:label`;
24
- },
25
- getItemId: (e, i) => {
26
- var t, a;
27
- return ((a = (t = e.ids) == null ? void 0 : t.item) == null ? void 0 : a.call(t, i)) ?? `radio-group:${e.id}:radio:${i}`;
28
- },
29
- getItemHiddenInputId: (e, i) => {
30
- var t, a;
31
- return ((a = (t = e.ids) == null ? void 0 : t.itemHiddenInput) == null ? void 0 : a.call(t, i)) ?? `radio-group:${e.id}:radio:input:${i}`;
32
- },
33
- getItemControlId: (e, i) => {
34
- var t, a;
35
- return ((a = (t = e.ids) == null ? void 0 : t.itemControl) == null ? void 0 : a.call(t, i)) ?? `radio-group:${e.id}:radio:control:${i}`;
36
- },
37
- getItemLabelId: (e, i) => {
38
- var t, a;
39
- return ((a = (t = e.ids) == null ? void 0 : t.itemLabel) == null ? void 0 : a.call(t, i)) ?? `radio-group:${e.id}:radio:label:${i}`;
40
- },
41
- getIndicatorId: (e) => {
42
- var i;
43
- return ((i = e.ids) == null ? void 0 : i.indicator) ?? `radio-group:${e.id}:indicator`;
44
- },
45
- getRootEl: (e) => n.getById(e, n.getRootId(e)),
46
- getItemHiddenInputEl: (e, i) => n.getById(e, n.getItemHiddenInputId(e, i)),
47
- getIndicatorEl: (e) => n.getById(e, n.getIndicatorId(e)),
48
- getFirstEnabledInputEl: (e) => {
49
- var i;
50
- return (i = n.getRootEl(e)) == null ? void 0 : i.querySelector("input:not(:disabled)");
51
- },
52
- getFirstEnabledAndCheckedInputEl: (e) => {
53
- var i;
54
- return (i = n.getRootEl(e)) == null ? void 0 : i.querySelector("input:not(:disabled):checked");
55
- },
56
- getInputEls: (e) => {
57
- const t = `input[type=radio][data-ownedby='${CSS.escape(n.getRootId(e))}']:not([disabled])`;
58
- return h(n.getRootEl(e), t);
59
- },
60
- getActiveRadioEl: (e) => {
61
- if (e.value)
62
- return n.getById(e, n.getItemId(e, e.value));
63
- },
64
- getOffsetRect: (e) => ({
65
- left: (e == null ? void 0 : e.offsetLeft) ?? 0,
66
- top: (e == null ? void 0 : e.offsetTop) ?? 0,
67
- width: (e == null ? void 0 : e.offsetWidth) ?? 0,
68
- height: (e == null ? void 0 : e.offsetHeight) ?? 0
69
- }),
70
- getRectById: (e, i) => {
71
- const t = n.getById(e, n.getItemId(e, i));
72
- if (t)
73
- return n.resolveRect(n.getOffsetRect(t));
74
- },
75
- resolveRect: (e) => ({
76
- width: `${e.width}px`,
77
- height: `${e.height}px`,
78
- left: `${e.left}px`,
79
- top: `${e.top}px`
80
- })
14
+ ), v = U.build(), g = (e) => {
15
+ var t;
16
+ return ((t = e.ids) == null ? void 0 : t.root) ?? `radio-group:${e.id}`;
17
+ }, I = (e) => {
18
+ var t;
19
+ return ((t = e.ids) == null ? void 0 : t.label) ?? `radio-group:${e.id}:label`;
20
+ }, T = (e, t) => {
21
+ var i, r;
22
+ return ((r = (i = e.ids) == null ? void 0 : i.item) == null ? void 0 : r.call(i, t)) ?? `radio-group:${e.id}:radio:${t}`;
23
+ }, p = (e, t) => {
24
+ var i, r;
25
+ return ((r = (i = e.ids) == null ? void 0 : i.itemHiddenInput) == null ? void 0 : r.call(i, t)) ?? `radio-group:${e.id}:radio:input:${t}`;
26
+ }, B = (e, t) => {
27
+ var i, r;
28
+ return ((r = (i = e.ids) == null ? void 0 : i.itemControl) == null ? void 0 : r.call(i, t)) ?? `radio-group:${e.id}:radio:control:${t}`;
29
+ }, q = (e, t) => {
30
+ var i, r;
31
+ return ((r = (i = e.ids) == null ? void 0 : i.itemLabel) == null ? void 0 : r.call(i, t)) ?? `radio-group:${e.id}:radio:label:${t}`;
32
+ }, C = (e) => {
33
+ var t;
34
+ return ((t = e.ids) == null ? void 0 : t.indicator) ?? `radio-group:${e.id}:indicator`;
35
+ }, m = (e) => e.getById(g(e)), K = (e, t) => e.getById(p(e, t)), M = (e) => e.getById(C(e)), N = (e) => {
36
+ var t;
37
+ return (t = m(e)) == null ? void 0 : t.querySelector("input:not(:disabled)");
38
+ }, G = (e) => {
39
+ var t;
40
+ return (t = m(e)) == null ? void 0 : t.querySelector("input:not(:disabled):checked");
41
+ }, V = (e) => {
42
+ const i = `input[type=radio][data-ownedby='${CSS.escape(g(e))}']:not([disabled])`;
43
+ return P(m(e), i);
44
+ }, W = (e, t) => {
45
+ if (t)
46
+ return e.getById(T(e, t));
47
+ }, j = (e) => ({
48
+ left: (e == null ? void 0 : e.offsetLeft) ?? 0,
49
+ top: (e == null ? void 0 : e.offsetTop) ?? 0,
50
+ width: (e == null ? void 0 : e.offsetWidth) ?? 0,
51
+ height: (e == null ? void 0 : e.offsetHeight) ?? 0
52
+ }), J = (e) => ({
53
+ width: `${e.width}px`,
54
+ height: `${e.height}px`,
55
+ left: `${e.left}px`,
56
+ top: `${e.top}px`
81
57
  });
82
- function M(e, i, t) {
83
- const a = e.context.isDisabled, l = e.context.readOnly;
84
- function u(o) {
58
+ function te(e, t) {
59
+ const { context: i, send: r, computed: c, prop: o, scope: l } = e, s = c("isDisabled"), y = o("readOnly");
60
+ function f(a) {
61
+ const n = i.get("focusedValue") === a.value, d = n && w();
85
62
  return {
86
- invalid: !!o.invalid,
87
- disabled: !!o.disabled || a,
88
- checked: e.context.value === o.value,
89
- focused: e.context.focusedValue === o.value,
90
- hovered: e.context.hoveredValue === o.value,
91
- active: e.context.activeValue === o.value
63
+ value: a.value,
64
+ invalid: !!a.invalid,
65
+ disabled: !!a.disabled || s,
66
+ checked: i.get("value") === a.value,
67
+ focused: n,
68
+ focusVisible: d,
69
+ hovered: i.get("hoveredValue") === a.value,
70
+ active: i.get("activeValue") === a.value
92
71
  };
93
72
  }
94
- function s(o) {
95
- const r = u(o);
73
+ function h(a) {
74
+ const n = f(a);
96
75
  return {
97
- "data-focus": c(r.focused),
98
- "data-focus-visible": c(r.focused && e.context.focusVisible),
99
- "data-disabled": c(r.disabled),
100
- "data-readonly": c(l),
101
- "data-state": r.checked ? "checked" : "unchecked",
102
- "data-hover": c(r.hovered),
103
- "data-invalid": c(r.invalid),
104
- "data-orientation": e.context.orientation,
105
- "data-ssr": c(e.context.ssr)
76
+ "data-focus": u(n.focused),
77
+ "data-focus-visible": u(n.focusVisible),
78
+ "data-disabled": u(n.disabled),
79
+ "data-readonly": u(y),
80
+ "data-state": n.checked ? "checked" : "unchecked",
81
+ "data-hover": u(n.hovered),
82
+ "data-invalid": u(n.invalid),
83
+ "data-orientation": o("orientation"),
84
+ "data-ssr": u(i.get("ssr"))
106
85
  };
107
86
  }
108
- const f = () => {
109
- const o = n.getFirstEnabledAndCheckedInputEl(e.context);
110
- if (o) {
111
- o.focus();
112
- return;
113
- }
114
- const r = n.getFirstEnabledInputEl(e.context);
115
- r == null || r.focus();
87
+ const E = () => {
88
+ const a = G(l) ?? N(l);
89
+ a == null || a.focus();
116
90
  };
117
91
  return {
118
- focus: f,
119
- value: e.context.value,
120
- setValue(o) {
121
- i({ type: "SET_VALUE", value: o, isTrusted: !1 });
92
+ focus: E,
93
+ value: i.get("value"),
94
+ setValue(a) {
95
+ r({ type: "SET_VALUE", value: a, isTrusted: !1 });
122
96
  },
123
97
  clearValue() {
124
- i({ type: "SET_VALUE", value: null, isTrusted: !1 });
98
+ r({ type: "SET_VALUE", value: null, isTrusted: !1 });
125
99
  },
126
100
  getRootProps() {
127
101
  return t.element({
128
102
  ...v.root.attrs,
129
103
  role: "radiogroup",
130
- id: n.getRootId(e.context),
131
- "aria-labelledby": n.getLabelId(e.context),
132
- "data-orientation": e.context.orientation,
133
- "data-disabled": c(a),
134
- "aria-orientation": e.context.orientation,
135
- dir: e.context.dir,
104
+ id: g(l),
105
+ "aria-labelledby": I(l),
106
+ "data-orientation": o("orientation"),
107
+ "data-disabled": u(s),
108
+ "aria-orientation": o("orientation"),
109
+ dir: o("dir"),
136
110
  style: {
137
111
  position: "relative"
138
112
  }
@@ -141,256 +115,276 @@ function M(e, i, t) {
141
115
  getLabelProps() {
142
116
  return t.element({
143
117
  ...v.label.attrs,
144
- dir: e.context.dir,
145
- "data-orientation": e.context.orientation,
146
- "data-disabled": c(a),
147
- id: n.getLabelId(e.context),
148
- onClick: f
118
+ dir: o("dir"),
119
+ "data-orientation": o("orientation"),
120
+ "data-disabled": u(s),
121
+ id: I(l),
122
+ onClick: E
149
123
  });
150
124
  },
151
- getItemState: u,
152
- getItemProps(o) {
153
- const r = u(o);
125
+ getItemState: f,
126
+ getItemProps(a) {
127
+ const n = f(a);
154
128
  return t.label({
155
129
  ...v.item.attrs,
156
- dir: e.context.dir,
157
- id: n.getItemId(e.context, o.value),
158
- htmlFor: n.getItemHiddenInputId(e.context, o.value),
159
- ...s(o),
130
+ dir: o("dir"),
131
+ id: T(l, a.value),
132
+ htmlFor: p(l, a.value),
133
+ ...h(a),
160
134
  onPointerMove() {
161
- r.disabled || r.hovered || i({ type: "SET_HOVERED", value: o.value, hovered: !0 });
135
+ n.disabled || n.hovered || r({ type: "SET_HOVERED", value: a.value, hovered: !0 });
162
136
  },
163
137
  onPointerLeave() {
164
- r.disabled || i({ type: "SET_HOVERED", value: null });
138
+ n.disabled || r({ type: "SET_HOVERED", value: null });
165
139
  },
166
140
  onPointerDown(d) {
167
- r.disabled || (r.focused && d.pointerType === "mouse" && d.preventDefault(), i({ type: "SET_ACTIVE", value: o.value, active: !0 }));
141
+ n.disabled || $(d) && (n.focused && d.pointerType === "mouse" && d.preventDefault(), r({ type: "SET_ACTIVE", value: a.value, active: !0 }));
168
142
  },
169
143
  onPointerUp() {
170
- r.disabled || i({ type: "SET_ACTIVE", value: null });
144
+ n.disabled || r({ type: "SET_ACTIVE", value: null });
145
+ },
146
+ onClick() {
147
+ var d;
148
+ !n.disabled && A() && ((d = K(l, a.value)) == null || d.focus());
171
149
  }
172
150
  });
173
151
  },
174
- getItemTextProps(o) {
152
+ getItemTextProps(a) {
175
153
  return t.element({
176
154
  ...v.itemText.attrs,
177
- dir: e.context.dir,
178
- id: n.getItemLabelId(e.context, o.value),
179
- ...s(o)
155
+ dir: o("dir"),
156
+ id: q(l, a.value),
157
+ ...h(a)
180
158
  });
181
159
  },
182
- getItemControlProps(o) {
183
- const r = u(o);
160
+ getItemControlProps(a) {
161
+ const n = f(a);
184
162
  return t.element({
185
163
  ...v.itemControl.attrs,
186
- dir: e.context.dir,
187
- id: n.getItemControlId(e.context, o.value),
188
- "data-active": c(r.active),
164
+ dir: o("dir"),
165
+ id: B(l, a.value),
166
+ "data-active": u(n.active),
189
167
  "aria-hidden": !0,
190
- ...s(o)
168
+ ...h(a)
191
169
  });
192
170
  },
193
- getItemHiddenInputProps(o) {
194
- const r = u(o);
171
+ getItemHiddenInputProps(a) {
172
+ const n = f(a);
195
173
  return t.input({
196
- "data-ownedby": n.getRootId(e.context),
197
- id: n.getItemHiddenInputId(e.context, o.value),
174
+ "data-ownedby": g(l),
175
+ id: p(l, a.value),
198
176
  type: "radio",
199
- name: e.context.name || e.context.id,
200
- form: e.context.form,
201
- value: o.value,
177
+ name: o("name") || o("id"),
178
+ form: o("form"),
179
+ value: a.value,
202
180
  onClick(d) {
203
- if (l) {
181
+ if (y) {
204
182
  d.preventDefault();
205
183
  return;
206
184
  }
207
- d.currentTarget.checked && i({ type: "SET_VALUE", value: o.value, isTrusted: !0 });
185
+ d.currentTarget.checked && r({ type: "SET_VALUE", value: a.value, isTrusted: !0 });
208
186
  },
209
187
  onBlur() {
210
- i({ type: "SET_FOCUSED", value: null, focused: !1, focusVisible: !1 });
188
+ r({ type: "SET_FOCUSED", value: null, focused: !1 });
211
189
  },
212
190
  onFocus() {
213
- const d = T();
214
- i({ type: "SET_FOCUSED", value: o.value, focused: !0, focusVisible: d });
191
+ r({ type: "SET_FOCUSED", value: a.value, focused: !0 });
215
192
  },
216
193
  onKeyDown(d) {
217
- d.defaultPrevented || d.key === " " && i({ type: "SET_ACTIVE", value: o.value, active: !0 });
194
+ d.defaultPrevented || d.key === " " && r({ type: "SET_ACTIVE", value: a.value, active: !0 });
218
195
  },
219
196
  onKeyUp(d) {
220
- d.defaultPrevented || d.key === " " && i({ type: "SET_ACTIVE", value: null });
197
+ d.defaultPrevented || d.key === " " && r({ type: "SET_ACTIVE", value: null });
221
198
  },
222
- disabled: r.disabled,
223
- defaultChecked: r.checked,
224
- style: E
199
+ disabled: n.disabled,
200
+ defaultChecked: n.checked,
201
+ style: F
225
202
  });
226
203
  },
227
204
  getIndicatorProps() {
228
- var o, r, d, g;
205
+ const a = i.get("indicatorRect");
229
206
  return t.element({
230
- id: n.getIndicatorId(e.context),
207
+ id: C(l),
231
208
  ...v.indicator.attrs,
232
- dir: e.context.dir,
233
- hidden: e.context.value == null,
234
- "data-disabled": c(a),
235
- "data-orientation": e.context.orientation,
209
+ dir: o("dir"),
210
+ hidden: i.get("value") == null,
211
+ "data-disabled": u(s),
212
+ "data-orientation": o("orientation"),
236
213
  style: {
237
214
  "--transition-property": "left, top, width, height",
238
- "--left": (o = e.context.indicatorRect) == null ? void 0 : o.left,
239
- "--top": (r = e.context.indicatorRect) == null ? void 0 : r.top,
240
- "--width": (d = e.context.indicatorRect) == null ? void 0 : d.width,
241
- "--height": (g = e.context.indicatorRect) == null ? void 0 : g.height,
215
+ "--left": a == null ? void 0 : a.left,
216
+ "--top": a == null ? void 0 : a.top,
217
+ "--width": a == null ? void 0 : a.width,
218
+ "--height": a == null ? void 0 : a.height,
242
219
  position: "absolute",
243
220
  willChange: "var(--transition-property)",
244
221
  transitionProperty: "var(--transition-property)",
245
- transitionDuration: e.context.canIndicatorTransition ? "var(--transition-duration, 150ms)" : "0ms",
222
+ transitionDuration: i.get("canIndicatorTransition") ? "var(--transition-duration, 150ms)" : "0ms",
246
223
  transitionTimingFunction: "var(--transition-timing-function)",
247
- [e.context.orientation === "horizontal" ? "left" : "top"]: e.context.orientation === "horizontal" ? "var(--left)" : "var(--top)"
224
+ [o("orientation") === "horizontal" ? "left" : "top"]: o("orientation") === "horizontal" ? "var(--left)" : "var(--top)"
248
225
  }
249
226
  });
250
227
  }
251
228
  };
252
229
  }
253
- var { not: $ } = R;
254
- function N(e) {
255
- const i = A(e);
256
- return V(
257
- {
258
- id: "radio",
259
- initial: "idle",
260
- context: {
261
- value: null,
262
- activeValue: null,
263
- focusedValue: null,
264
- hoveredValue: null,
265
- disabled: !1,
266
- orientation: "vertical",
267
- ...i,
268
- indicatorRect: {},
269
- canIndicatorTransition: !1,
270
- fieldsetDisabled: !1,
271
- focusVisible: !1,
272
- ssr: !0
273
- },
274
- computed: {
275
- isDisabled: (t) => !!t.disabled || t.fieldsetDisabled
276
- },
277
- entry: ["syncIndicatorRect", "syncSsr"],
278
- exit: ["cleanupObserver"],
279
- activities: ["trackFormControlState", "trackFocusVisible"],
280
- watch: {
281
- value: ["setIndicatorTransition", "syncIndicatorRect", "syncInputElements"]
230
+ var { not: Q } = H(), ae = O({
231
+ props({ props: e }) {
232
+ return {
233
+ orientation: "vertical",
234
+ ...e
235
+ };
236
+ },
237
+ initialState() {
238
+ return "idle";
239
+ },
240
+ context({ prop: e, bindable: t }) {
241
+ return {
242
+ value: t(() => ({
243
+ defaultValue: e("defaultValue"),
244
+ value: e("value"),
245
+ onChange(i) {
246
+ var r;
247
+ (r = e("onValueChange")) == null || r({ value: i });
248
+ }
249
+ })),
250
+ activeValue: t(() => ({
251
+ defaultValue: null
252
+ })),
253
+ focusedValue: t(() => ({
254
+ defaultValue: null
255
+ })),
256
+ hoveredValue: t(() => ({
257
+ defaultValue: null
258
+ })),
259
+ indicatorRect: t(() => ({
260
+ defaultValue: {}
261
+ })),
262
+ canIndicatorTransition: t(() => ({
263
+ defaultValue: !1
264
+ })),
265
+ fieldsetDisabled: t(() => ({
266
+ defaultValue: !1
267
+ })),
268
+ ssr: t(() => ({
269
+ defaultValue: !0
270
+ }))
271
+ };
272
+ },
273
+ refs() {
274
+ return {
275
+ indicatorCleanup: null
276
+ };
277
+ },
278
+ computed: {
279
+ isDisabled: ({ prop: e, context: t }) => !!e("disabled") || t.get("fieldsetDisabled")
280
+ },
281
+ entry: ["syncIndicatorRect", "syncSsr"],
282
+ exit: ["cleanupObserver"],
283
+ effects: ["trackFormControlState", "trackFocusVisible"],
284
+ watch({ track: e, action: t, context: i }) {
285
+ e([() => i.get("value")], () => {
286
+ t(["setIndicatorTransition", "syncIndicatorRect", "syncInputElements"]);
287
+ });
288
+ },
289
+ on: {
290
+ SET_VALUE: [
291
+ {
292
+ guard: Q("isTrusted"),
293
+ actions: ["setValue", "dispatchChangeEvent"]
282
294
  },
283
- on: {
284
- SET_VALUE: [
285
- {
286
- guard: $("isTrusted"),
287
- actions: ["setValue", "dispatchChangeEvent"]
295
+ {
296
+ actions: ["setValue"]
297
+ }
298
+ ],
299
+ SET_HOVERED: {
300
+ actions: ["setHovered"]
301
+ },
302
+ SET_ACTIVE: {
303
+ actions: ["setActive"]
304
+ },
305
+ SET_FOCUSED: {
306
+ actions: ["setFocused"]
307
+ }
308
+ },
309
+ states: {
310
+ idle: {}
311
+ },
312
+ implementations: {
313
+ guards: {
314
+ isTrusted: ({ event: e }) => !!e.isTrusted
315
+ },
316
+ effects: {
317
+ trackFormControlState({ context: e, scope: t }) {
318
+ return D(m(t), {
319
+ onFieldsetDisabledChange(i) {
320
+ e.set("fieldsetDisabled", i);
288
321
  },
289
- {
290
- actions: ["setValue"]
322
+ onFormReset() {
323
+ e.set("value", e.initial("value"));
291
324
  }
292
- ],
293
- SET_HOVERED: {
294
- actions: "setHovered"
295
- },
296
- SET_ACTIVE: {
297
- actions: "setActive"
298
- },
299
- SET_FOCUSED: {
300
- actions: "setFocused"
301
- }
325
+ });
302
326
  },
303
- states: {
304
- idle: {}
327
+ trackFocusVisible({ scope: e }) {
328
+ var t;
329
+ return _({ root: (t = e.getRootNode) == null ? void 0 : t.call(e) });
305
330
  }
306
331
  },
307
- {
308
- guards: {
309
- isTrusted: (t, a) => !!a.isTrusted
332
+ actions: {
333
+ setValue({ context: e, event: t }) {
334
+ e.set("value", t.value);
310
335
  },
311
- activities: {
312
- trackFormControlState(t, a, { send: l, initialContext: u }) {
313
- return k(n.getRootEl(t), {
314
- onFieldsetDisabledChange(s) {
315
- t.fieldsetDisabled = s;
316
- },
317
- onFormReset() {
318
- l({ type: "SET_VALUE", value: u.value });
319
- }
320
- });
321
- },
322
- trackFocusVisible(t) {
323
- return y({ root: n.getRootNode(t) });
324
- }
336
+ setHovered({ context: e, event: t }) {
337
+ e.set("hoveredValue", t.value);
325
338
  },
326
- actions: {
327
- setValue(t, a) {
328
- w.value(t, a.value);
329
- },
330
- setHovered(t, a) {
331
- t.hoveredValue = a.value;
332
- },
333
- setActive(t, a) {
334
- t.activeValue = a.value;
335
- },
336
- setFocused(t, a) {
337
- t.focusedValue = a.value, t.focusVisible = a.focusVisible;
338
- },
339
- syncInputElements(t) {
340
- n.getInputEls(t).forEach((l) => {
341
- l.checked = l.value === t.value;
342
- });
343
- },
344
- setIndicatorTransition(t) {
345
- t.canIndicatorTransition = F(t.value);
346
- },
347
- cleanupObserver(t) {
348
- var a;
349
- (a = t.indicatorCleanup) == null || a.call(t);
350
- },
351
- syncSsr(t) {
352
- t.ssr = !1;
353
- },
354
- syncIndicatorRect(t) {
355
- var u;
356
- if ((u = t.indicatorCleanup) == null || u.call(t), !n.getIndicatorEl(t)) return;
357
- const a = t.value, l = n.getActiveRadioEl(t);
358
- if (a == null || !l) {
359
- t.indicatorRect = {};
360
- return;
361
- }
362
- t.indicatorCleanup = C(l, {
363
- getRect(s) {
364
- return n.getOffsetRect(s);
365
- },
366
- onChange(s) {
367
- t.indicatorRect = n.resolveRect(s), b(() => {
368
- t.canIndicatorTransition = !1;
369
- });
370
- }
371
- });
372
- },
373
- dispatchChangeEvent(t) {
374
- n.getInputEls(t).forEach((l) => {
375
- const u = l.value === t.value;
376
- u !== l.checked && S(l, { checked: u });
377
- });
339
+ setActive({ context: e, event: t }) {
340
+ e.set("activeValue", t.value);
341
+ },
342
+ setFocused({ context: e, event: t }) {
343
+ e.set("focusedValue", t.value);
344
+ },
345
+ syncInputElements({ context: e, scope: t }) {
346
+ V(t).forEach((r) => {
347
+ r.checked = r.value === e.get("value");
348
+ });
349
+ },
350
+ setIndicatorTransition({ context: e }) {
351
+ e.set("canIndicatorTransition", L(e.get("value")));
352
+ },
353
+ cleanupObserver({ refs: e }) {
354
+ var t;
355
+ (t = e.get("indicatorCleanup")) == null || t();
356
+ },
357
+ syncSsr({ context: e }) {
358
+ e.set("ssr", !1);
359
+ },
360
+ syncIndicatorRect({ context: e, scope: t, refs: i }) {
361
+ var l;
362
+ if ((l = i.get("indicatorCleanup")) == null || l(), !M(t)) return;
363
+ const r = e.get("value"), c = W(t, r);
364
+ if (r == null || !c) {
365
+ e.set("canIndicatorTransition", !1), e.set("indicatorRect", {});
366
+ return;
378
367
  }
368
+ const o = R([c], {
369
+ measure(s) {
370
+ return j(s);
371
+ },
372
+ onEntry({ rects: s }) {
373
+ e.set("indicatorRect", J(s[0]));
374
+ }
375
+ });
376
+ i.set("indicatorCleanup", o);
377
+ },
378
+ dispatchChangeEvent({ context: e, scope: t }) {
379
+ V(t).forEach((r) => {
380
+ const c = r.value === e.get("value");
381
+ c !== r.checked && k(r, { checked: c });
382
+ });
379
383
  }
380
384
  }
381
- );
382
- }
383
- var P = {
384
- change: (e) => {
385
- var i;
386
- e.value != null && ((i = e.onValueChange) == null || i.call(e, { value: e.value }));
387
- }
388
- }, w = {
389
- value: (e, i) => {
390
- D(e.value, i) || (e.value = i, P.change(e));
391
385
  }
392
- };
393
- I()([
386
+ });
387
+ b()([
394
388
  "dir",
395
389
  "disabled",
396
390
  "form",
@@ -401,11 +395,12 @@ I()([
401
395
  "onValueChange",
402
396
  "orientation",
403
397
  "readOnly",
404
- "value"
398
+ "value",
399
+ "defaultValue"
405
400
  ]);
406
- I()(["value", "disabled", "invalid"]);
401
+ b()(["value", "disabled", "invalid"]);
407
402
  export {
408
- _ as anatomy,
409
- M as connect,
410
- N as machine
403
+ U as anatomy,
404
+ te as connect,
405
+ ae as machine
411
406
  };