@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,478 +1,475 @@
1
- import { createAnatomy as A } from "../../anatomy/dist/index.js";
2
- import { clickIfLink as C, getEventKey as F } from "../../dom-event/dist/index.js";
3
- import { createScope as S, nextTick as V, raf as T, getFocusables as L, dataAttr as g, isSafari as _, isSelfTarget as O, isComposingEvent as w, prevById as B, nextById as N, itemById as P, queryAll as k } from "../../dom-query/dist/index.js";
4
- import { compact as U, last as $, first as D, isEqual as h } from "../../utils/dist/index.js";
5
- import { createMachine as W, guards as M } from "../../core/dist/index.js";
6
- import { trackElementRect as X } from "../../element-rect/dist/index.js";
7
- import { createProps as E } from "../../types/dist/index.js";
8
- var H = A("tabs").parts("root", "list", "trigger", "content", "indicator"), v = H.build(), r = S({
9
- getRootId: (e) => {
10
- var o;
11
- return ((o = e.ids) == null ? void 0 : o.root) ?? `tabs:${e.id}`;
12
- },
13
- getListId: (e) => {
14
- var o;
15
- return ((o = e.ids) == null ? void 0 : o.list) ?? `tabs:${e.id}:list`;
16
- },
17
- getContentId: (e, o) => {
18
- var t;
19
- return ((t = e.ids) == null ? void 0 : t.content) ?? `tabs:${e.id}:content-${o}`;
20
- },
21
- getTriggerId: (e, o) => {
22
- var t;
23
- return ((t = e.ids) == null ? void 0 : t.trigger) ?? `tabs:${e.id}:trigger-${o}`;
24
- },
25
- getIndicatorId: (e) => {
26
- var o;
27
- return ((o = e.ids) == null ? void 0 : o.indicator) ?? `tabs:${e.id}:indicator`;
28
- },
29
- getListEl: (e) => r.getById(e, r.getListId(e)),
30
- getContentEl: (e, o) => r.getById(e, r.getContentId(e, o)),
31
- getTriggerEl: (e, o) => r.getById(e, r.getTriggerId(e, o)),
32
- getIndicatorEl: (e) => r.getById(e, r.getIndicatorId(e)),
33
- getElements: (e) => {
34
- const t = `[role=tab][data-ownedby='${CSS.escape(r.getListId(e))}']:not([disabled])`;
35
- return k(r.getListEl(e), t);
36
- },
37
- getFirstTriggerEl: (e) => D(r.getElements(e)),
38
- getLastTriggerEl: (e) => $(r.getElements(e)),
39
- getNextTriggerEl: (e, o) => N(r.getElements(e), r.getTriggerId(e, o), e.loopFocus),
40
- getPrevTriggerEl: (e, o) => B(r.getElements(e), r.getTriggerId(e, o), e.loopFocus),
41
- getSelectedContentEl: (e) => {
42
- if (e.value)
43
- return r.getContentEl(e, e.value);
44
- },
45
- getSelectedTriggerEl: (e) => {
46
- if (e.value)
47
- return r.getTriggerEl(e, e.value);
48
- },
49
- getOffsetRect: (e) => ({
50
- left: (e == null ? void 0 : e.offsetLeft) ?? 0,
51
- top: (e == null ? void 0 : e.offsetTop) ?? 0,
52
- width: (e == null ? void 0 : e.offsetWidth) ?? 0,
53
- height: (e == null ? void 0 : e.offsetHeight) ?? 0
54
- }),
55
- getRectById: (e, o) => {
56
- const t = P(r.getElements(e), r.getTriggerId(e, o));
57
- return r.resolveRect(r.getOffsetRect(t));
58
- },
59
- resolveRect: (e) => ({
60
- width: `${e.width}px`,
61
- height: `${e.height}px`,
62
- left: `${e.left}px`,
63
- top: `${e.top}px`
64
- })
1
+ import { createAnatomy as L } from "../../anatomy/dist/index.js";
2
+ import { isAnchorElement as N, trackElementRect as P, nextTick as S, raf as v, prevById as U, nextById as $, clickIfLink as D, dataAttr as d, isOpeningInNewTab as k, isSafari as W, isSelfTarget as x, isComposingEvent as M, getEventKey as X, itemById as H, queryAll as K, getFocusables as Y } from "../../dom-query/dist/index.js";
3
+ import { last as q, first as j } from "../../utils/dist/index.js";
4
+ import { setup as G } from "../../core/dist/index.js";
5
+ import { createProps as F } from "../../types/dist/index.js";
6
+ var J = L("tabs").parts("root", "list", "trigger", "content", "indicator"), b = J.build(), Q = (e) => {
7
+ var t;
8
+ return ((t = e.ids) == null ? void 0 : t.root) ?? `tabs:${e.id}`;
9
+ }, y = (e) => {
10
+ var t;
11
+ return ((t = e.ids) == null ? void 0 : t.list) ?? `tabs:${e.id}:list`;
12
+ }, E = (e, t) => {
13
+ var o;
14
+ return ((o = e.ids) == null ? void 0 : o.content) ?? `tabs:${e.id}:content-${t}`;
15
+ }, f = (e, t) => {
16
+ var o;
17
+ return ((o = e.ids) == null ? void 0 : o.trigger) ?? `tabs:${e.id}:trigger-${t}`;
18
+ }, w = (e) => {
19
+ var t;
20
+ return ((t = e.ids) == null ? void 0 : t.indicator) ?? `tabs:${e.id}:indicator`;
21
+ }, Z = (e) => e.getById(y(e)), z = (e, t) => e.getById(E(e, t)), h = (e, t) => e.getById(f(e, t)), _ = (e) => e.getById(w(e)), V = (e) => {
22
+ const o = `[role=tab][data-ownedby='${CSS.escape(y(e))}']:not([disabled])`;
23
+ return K(Z(e), o);
24
+ }, ee = (e) => j(V(e)), te = (e) => q(V(e)), ae = (e, t) => $(V(e), f(e, t.value), t.loopFocus), oe = (e, t) => U(V(e), f(e, t.value), t.loopFocus), O = (e) => ({
25
+ left: (e == null ? void 0 : e.offsetLeft) ?? 0,
26
+ top: (e == null ? void 0 : e.offsetTop) ?? 0,
27
+ width: (e == null ? void 0 : e.offsetWidth) ?? 0,
28
+ height: (e == null ? void 0 : e.offsetHeight) ?? 0
29
+ }), re = (e, t) => {
30
+ const o = H(V(e), f(e, t));
31
+ return B(O(o));
32
+ }, B = (e) => ({
33
+ width: `${e.width}px`,
34
+ height: `${e.height}px`,
35
+ left: `${e.left}px`,
36
+ top: `${e.top}px`
65
37
  });
66
- function z(e, o, t) {
67
- const n = e.context.translations, s = e.matches("focused"), u = e.context.orientation === "vertical", d = e.context.orientation === "horizontal", y = e.context.composite, p = e.context.indicatorState;
68
- function R(a) {
38
+ function de(e, t) {
39
+ const { state: o, send: a, context: n, prop: r, scope: u } = e, p = r("translations"), g = o.matches("focused"), R = r("orientation") === "vertical", I = r("orientation") === "horizontal", m = r("composite");
40
+ function C(i) {
69
41
  return {
70
- selected: e.context.value === a.value,
71
- focused: e.context.focusedValue === a.value,
72
- disabled: !!a.disabled
42
+ selected: n.get("value") === i.value,
43
+ focused: n.get("focusedValue") === i.value,
44
+ disabled: !!i.disabled
73
45
  };
74
46
  }
75
47
  return {
76
- value: e.context.value,
77
- focusedValue: e.context.focusedValue,
78
- setValue(a) {
79
- o({ type: "SET_VALUE", value: a });
48
+ value: n.get("value"),
49
+ focusedValue: n.get("focusedValue"),
50
+ setValue(i) {
51
+ a({ type: "SET_VALUE", value: i });
80
52
  },
81
53
  clearValue() {
82
- o({ type: "CLEAR_VALUE" });
54
+ a({ type: "CLEAR_VALUE" });
83
55
  },
84
- setIndicatorRect(a) {
85
- const i = r.getTriggerId(e.context, a);
86
- o({ type: "SET_INDICATOR_RECT", id: i });
56
+ setIndicatorRect(i) {
57
+ const s = f(u, i);
58
+ a({ type: "SET_INDICATOR_RECT", id: s });
87
59
  },
88
60
  syncTabIndex() {
89
- o("SYNC_TAB_INDEX");
61
+ a({ type: "SYNC_TAB_INDEX" });
90
62
  },
91
- selectNext(a) {
92
- o({ type: "TAB_FOCUS", value: a, src: "selectNext" }), o({ type: "ARROW_NEXT", src: "selectNext" });
63
+ selectNext(i) {
64
+ a({ type: "TAB_FOCUS", value: i, src: "selectNext" }), a({ type: "ARROW_NEXT", src: "selectNext" });
93
65
  },
94
- selectPrev(a) {
95
- o({ type: "TAB_FOCUS", value: a, src: "selectPrev" }), o({ type: "ARROW_PREV", src: "selectPrev" });
66
+ selectPrev(i) {
67
+ a({ type: "TAB_FOCUS", value: i, src: "selectPrev" }), a({ type: "ARROW_PREV", src: "selectPrev" });
96
68
  },
97
69
  focus() {
98
- var a;
99
- (a = r.getSelectedTriggerEl(e.context)) == null || a.focus();
70
+ var s;
71
+ const i = n.get("value");
72
+ i && ((s = h(u, i)) == null || s.focus());
100
73
  },
101
74
  getRootProps() {
102
75
  return t.element({
103
- ...v.root.attrs,
104
- id: r.getRootId(e.context),
105
- "data-orientation": e.context.orientation,
106
- "data-focus": g(s),
107
- dir: e.context.dir
76
+ ...b.root.attrs,
77
+ id: Q(u),
78
+ "data-orientation": r("orientation"),
79
+ "data-focus": d(g),
80
+ dir: r("dir")
108
81
  });
109
82
  },
110
83
  getListProps() {
111
84
  return t.element({
112
- ...v.list.attrs,
113
- id: r.getListId(e.context),
85
+ ...b.list.attrs,
86
+ id: y(u),
114
87
  role: "tablist",
115
- dir: e.context.dir,
116
- "data-focus": g(s),
117
- "aria-orientation": e.context.orientation,
118
- "data-orientation": e.context.orientation,
119
- "aria-label": n == null ? void 0 : n.listLabel,
120
- onKeyDown(a) {
121
- if (a.defaultPrevented || !O(a) || w(a)) return;
122
- const i = {
88
+ dir: r("dir"),
89
+ "data-focus": d(g),
90
+ "aria-orientation": r("orientation"),
91
+ "data-orientation": r("orientation"),
92
+ "aria-label": p == null ? void 0 : p.listLabel,
93
+ onKeyDown(i) {
94
+ if (i.defaultPrevented || !x(i) || M(i)) return;
95
+ const s = {
123
96
  ArrowDown() {
124
- d || o({ type: "ARROW_NEXT", key: "ArrowDown" });
97
+ I || a({ type: "ARROW_NEXT", key: "ArrowDown" });
125
98
  },
126
99
  ArrowUp() {
127
- d || o({ type: "ARROW_PREV", key: "ArrowUp" });
100
+ I || a({ type: "ARROW_PREV", key: "ArrowUp" });
128
101
  },
129
102
  ArrowLeft() {
130
- u || o({ type: "ARROW_PREV", key: "ArrowLeft" });
103
+ R || a({ type: "ARROW_PREV", key: "ArrowLeft" });
131
104
  },
132
105
  ArrowRight() {
133
- u || o({ type: "ARROW_NEXT", key: "ArrowRight" });
106
+ R || a({ type: "ARROW_NEXT", key: "ArrowRight" });
134
107
  },
135
108
  Home() {
136
- o("HOME");
109
+ a({ type: "HOME" });
137
110
  },
138
111
  End() {
139
- o("END");
140
- },
141
- Enter() {
142
- o({ type: "ENTER" });
112
+ a({ type: "END" });
143
113
  }
144
114
  };
145
- let l = F(a, e.context);
146
- const c = i[l];
147
- c && (a.preventDefault(), c(a));
115
+ let c = X(i, {
116
+ dir: r("dir"),
117
+ orientation: r("orientation")
118
+ });
119
+ const l = s[c];
120
+ if (l) {
121
+ i.preventDefault(), l(i);
122
+ return;
123
+ }
148
124
  }
149
125
  });
150
126
  },
151
- getTriggerState: R,
152
- getTriggerProps(a) {
153
- const { value: i, disabled: l } = a, c = R(a);
127
+ getTriggerState: C,
128
+ getTriggerProps(i) {
129
+ const { value: s, disabled: c } = i, l = C(i);
154
130
  return t.button({
155
- ...v.trigger.attrs,
131
+ ...b.trigger.attrs,
156
132
  role: "tab",
157
133
  type: "button",
158
- disabled: l,
159
- dir: e.context.dir,
160
- "data-orientation": e.context.orientation,
161
- "data-disabled": g(l),
162
- "aria-disabled": l,
163
- "data-value": i,
164
- "aria-selected": c.selected,
165
- "data-selected": g(c.selected),
166
- "data-focus": g(c.focused),
167
- "aria-controls": c.selected ? r.getContentId(e.context, i) : void 0,
168
- "data-ownedby": r.getListId(e.context),
169
- "data-ssr": g(e.context.ssr),
170
- id: r.getTriggerId(e.context, i),
171
- tabIndex: c.selected && y ? 0 : -1,
134
+ disabled: c,
135
+ dir: r("dir"),
136
+ "data-orientation": r("orientation"),
137
+ "data-disabled": d(c),
138
+ "aria-disabled": c,
139
+ "data-value": s,
140
+ "aria-selected": l.selected,
141
+ "data-selected": d(l.selected),
142
+ "data-focus": d(l.focused),
143
+ "aria-controls": l.selected ? E(u, s) : void 0,
144
+ "data-ownedby": y(u),
145
+ "data-ssr": d(n.get("ssr")),
146
+ id: f(u, s),
147
+ tabIndex: l.selected && m ? 0 : -1,
172
148
  onFocus() {
173
- o({ type: "TAB_FOCUS", value: i });
149
+ a({ type: "TAB_FOCUS", value: s });
174
150
  },
175
- onBlur(b) {
176
- const I = b.relatedTarget;
177
- (I == null ? void 0 : I.getAttribute("role")) !== "tab" && o({ type: "TAB_BLUR" });
151
+ onBlur(T) {
152
+ const A = T.relatedTarget;
153
+ (A == null ? void 0 : A.getAttribute("role")) !== "tab" && a({ type: "TAB_BLUR" });
178
154
  },
179
- onClick(b) {
180
- b.defaultPrevented || l || (_() && b.currentTarget.focus(), o({ type: "TAB_CLICK", value: i }));
155
+ onClick(T) {
156
+ T.defaultPrevented || k(T) || c || (W() && T.currentTarget.focus(), a({ type: "TAB_CLICK", value: s }));
181
157
  }
182
158
  });
183
159
  },
184
- getContentProps(a) {
185
- const { value: i } = a, l = e.context.value === i;
160
+ getContentProps(i) {
161
+ const { value: s } = i, c = n.get("value") === s;
186
162
  return t.element({
187
- ...v.content.attrs,
188
- dir: e.context.dir,
189
- id: r.getContentId(e.context, i),
190
- tabIndex: y ? 0 : -1,
191
- "aria-labelledby": r.getTriggerId(e.context, i),
163
+ ...b.content.attrs,
164
+ dir: r("dir"),
165
+ id: E(u, s),
166
+ tabIndex: m ? 0 : -1,
167
+ "aria-labelledby": f(u, s),
192
168
  role: "tabpanel",
193
- "data-ownedby": r.getListId(e.context),
194
- "data-selected": g(l),
195
- "data-orientation": e.context.orientation,
196
- hidden: !l
169
+ "data-ownedby": y(u),
170
+ "data-selected": d(c),
171
+ "data-orientation": r("orientation"),
172
+ hidden: !c
197
173
  });
198
174
  },
199
175
  getIndicatorProps() {
200
- var a, i, l, c;
176
+ const i = n.get("indicatorRect"), s = n.get("indicatorTransition");
201
177
  return t.element({
202
- id: r.getIndicatorId(e.context),
203
- ...v.indicator.attrs,
204
- dir: e.context.dir,
205
- "data-orientation": e.context.orientation,
178
+ id: w(u),
179
+ ...b.indicator.attrs,
180
+ dir: r("dir"),
181
+ "data-orientation": r("orientation"),
206
182
  style: {
207
183
  "--transition-property": "left, right, top, bottom, width, height",
208
- "--left": (a = p.rect) == null ? void 0 : a.left,
209
- "--top": (i = p.rect) == null ? void 0 : i.top,
210
- "--width": (l = p.rect) == null ? void 0 : l.width,
211
- "--height": (c = p.rect) == null ? void 0 : c.height,
184
+ "--left": i.left,
185
+ "--top": i.top,
186
+ "--width": i.width,
187
+ "--height": i.height,
212
188
  position: "absolute",
213
189
  willChange: "var(--transition-property)",
214
190
  transitionProperty: "var(--transition-property)",
215
- transitionDuration: p.transition ? "var(--transition-duration, 150ms)" : "0ms",
191
+ transitionDuration: s ? "var(--transition-duration, 150ms)" : "0ms",
216
192
  transitionTimingFunction: "var(--transition-timing-function)",
217
- [d ? "left" : "top"]: d ? "var(--left)" : "var(--top)"
193
+ [I ? "left" : "top"]: I ? "var(--left)" : "var(--top)"
218
194
  }
219
195
  });
220
196
  }
221
197
  };
222
198
  }
223
- var { not: K } = M;
224
- function x(e) {
225
- const o = U(e);
226
- return W(
227
- {
228
- initial: "idle",
229
- context: {
230
- dir: "ltr",
231
- orientation: "horizontal",
232
- activationMode: "automatic",
233
- value: null,
234
- loopFocus: !0,
235
- composite: !0,
236
- ...o,
237
- focusedValue: o.value ?? null,
238
- ssr: !0,
239
- indicatorState: {
240
- rendered: !1,
241
- transition: !1,
242
- rect: { left: "0px", top: "0px", width: "0px", height: "0px" }
243
- }
244
- },
245
- watch: {
246
- value: ["allowIndicatorTransition", "syncIndicatorRect", "syncTabIndex", "clickIfLink"],
247
- dir: ["syncIndicatorRect"],
248
- orientation: ["syncIndicatorRect"]
199
+ var { createMachine: ie } = G(), fe = ie({
200
+ props({ props: e }) {
201
+ return {
202
+ dir: "ltr",
203
+ orientation: "horizontal",
204
+ activationMode: "automatic",
205
+ loopFocus: !0,
206
+ composite: !0,
207
+ navigate(t) {
208
+ D(t.node);
249
209
  },
210
+ defaultValue: null,
211
+ ...e
212
+ };
213
+ },
214
+ initialState() {
215
+ return "idle";
216
+ },
217
+ context({ prop: e, bindable: t }) {
218
+ return {
219
+ value: t(() => ({
220
+ defaultValue: e("defaultValue"),
221
+ value: e("value"),
222
+ onChange(o) {
223
+ var a;
224
+ (a = e("onValueChange")) == null || a({ value: o });
225
+ }
226
+ })),
227
+ focusedValue: t(() => ({
228
+ defaultValue: e("value") || e("defaultValue"),
229
+ sync: !0,
230
+ onChange(o) {
231
+ var a;
232
+ (a = e("onFocusChange")) == null || a({ focusedValue: o });
233
+ }
234
+ })),
235
+ ssr: t(() => ({ defaultValue: !0 })),
236
+ indicatorTransition: t(() => ({ defaultValue: !1 })),
237
+ indicatorRect: t(() => ({
238
+ defaultValue: { left: "0px", top: "0px", width: "0px", height: "0px" }
239
+ }))
240
+ };
241
+ },
242
+ watch({ context: e, prop: t, track: o, action: a }) {
243
+ o([() => e.get("value")], () => {
244
+ a(["allowIndicatorTransition", "syncIndicatorRect", "syncTabIndex", "navigateIfNeeded"]);
245
+ }), o([() => t("dir"), () => t("orientation")], () => {
246
+ a(["syncIndicatorRect"]);
247
+ });
248
+ },
249
+ on: {
250
+ SET_VALUE: {
251
+ actions: ["setValue"]
252
+ },
253
+ CLEAR_VALUE: {
254
+ actions: ["clearValue"]
255
+ },
256
+ SET_INDICATOR_RECT: {
257
+ actions: ["setIndicatorRect"]
258
+ },
259
+ SYNC_TAB_INDEX: {
260
+ actions: ["syncTabIndex"]
261
+ }
262
+ },
263
+ entry: ["syncIndicatorRect", "syncTabIndex", "syncSsr"],
264
+ exit: ["cleanupObserver"],
265
+ states: {
266
+ idle: {
250
267
  on: {
251
- SET_VALUE: {
252
- actions: "setValue"
253
- },
254
- CLEAR_VALUE: {
255
- actions: "clearValue"
256
- },
257
- SET_INDICATOR_RECT: {
258
- actions: "setIndicatorRect"
268
+ TAB_FOCUS: {
269
+ target: "focused",
270
+ actions: ["setFocusedValue"]
259
271
  },
260
- SYNC_TAB_INDEX: {
261
- actions: "syncTabIndex"
272
+ TAB_CLICK: {
273
+ target: "focused",
274
+ actions: ["setFocusedValue", "setValue"]
262
275
  }
263
- },
264
- created: ["syncFocusedValue"],
265
- entry: ["checkRenderedElements", "syncIndicatorRect", "syncTabIndex", "syncSsr"],
266
- exit: ["cleanupObserver"],
267
- states: {
268
- idle: {
269
- on: {
270
- TAB_FOCUS: {
271
- target: "focused",
272
- actions: "setFocusedValue"
273
- },
274
- TAB_CLICK: {
275
- target: "focused",
276
- actions: ["setFocusedValue", "setValue"]
277
- }
278
- }
276
+ }
277
+ },
278
+ focused: {
279
+ on: {
280
+ TAB_CLICK: {
281
+ actions: ["setFocusedValue", "setValue"]
279
282
  },
280
- focused: {
281
- on: {
282
- TAB_CLICK: {
283
- target: "focused",
284
- actions: ["setFocusedValue", "setValue"]
285
- },
286
- ARROW_PREV: [
287
- {
288
- guard: "selectOnFocus",
289
- actions: ["focusPrevTab", "selectFocusedTab"]
290
- },
291
- {
292
- actions: "focusPrevTab"
293
- }
294
- ],
295
- ARROW_NEXT: [
296
- {
297
- guard: "selectOnFocus",
298
- actions: ["focusNextTab", "selectFocusedTab"]
299
- },
300
- {
301
- actions: "focusNextTab"
302
- }
303
- ],
304
- HOME: [
305
- {
306
- guard: "selectOnFocus",
307
- actions: ["focusFirstTab", "selectFocusedTab"]
308
- },
309
- {
310
- actions: "focusFirstTab"
311
- }
312
- ],
313
- END: [
314
- {
315
- guard: "selectOnFocus",
316
- actions: ["focusLastTab", "selectFocusedTab"]
317
- },
318
- {
319
- actions: "focusLastTab"
320
- }
321
- ],
322
- ENTER: {
323
- guard: K("selectOnFocus"),
324
- actions: "selectFocusedTab"
325
- },
326
- TAB_FOCUS: {
327
- actions: ["setFocusedValue"]
328
- },
329
- TAB_BLUR: {
330
- target: "idle",
331
- actions: "clearFocusedValue"
332
- }
283
+ ARROW_PREV: [
284
+ {
285
+ guard: "selectOnFocus",
286
+ actions: ["focusPrevTab", "selectFocusedTab"]
287
+ },
288
+ {
289
+ actions: ["focusPrevTab"]
290
+ }
291
+ ],
292
+ ARROW_NEXT: [
293
+ {
294
+ guard: "selectOnFocus",
295
+ actions: ["focusNextTab", "selectFocusedTab"]
296
+ },
297
+ {
298
+ actions: ["focusNextTab"]
333
299
  }
300
+ ],
301
+ HOME: [
302
+ {
303
+ guard: "selectOnFocus",
304
+ actions: ["focusFirstTab", "selectFocusedTab"]
305
+ },
306
+ {
307
+ actions: ["focusFirstTab"]
308
+ }
309
+ ],
310
+ END: [
311
+ {
312
+ guard: "selectOnFocus",
313
+ actions: ["focusLastTab", "selectFocusedTab"]
314
+ },
315
+ {
316
+ actions: ["focusLastTab"]
317
+ }
318
+ ],
319
+ TAB_FOCUS: {
320
+ actions: ["setFocusedValue"]
321
+ },
322
+ TAB_BLUR: {
323
+ target: "idle",
324
+ actions: ["clearFocusedValue"]
334
325
  }
335
326
  }
327
+ }
328
+ },
329
+ implementations: {
330
+ guards: {
331
+ selectOnFocus: ({ prop: e }) => e("activationMode") === "automatic"
336
332
  },
337
- {
338
- guards: {
339
- selectOnFocus: (t) => t.activationMode === "automatic"
333
+ actions: {
334
+ selectFocusedTab({ context: e, prop: t }) {
335
+ v(() => {
336
+ const o = e.get("focusedValue");
337
+ if (!o) return;
338
+ const n = t("deselectable") && e.get("value") === o ? null : o;
339
+ e.set("value", n);
340
+ });
340
341
  },
341
- actions: {
342
- syncFocusedValue(t) {
343
- t.value != null && t.focusedValue == null && (t.focusedValue = t.value);
344
- },
345
- selectFocusedTab(t) {
346
- T(() => {
347
- const s = t.deselectable && t.value === t.focusedValue ? null : t.focusedValue;
348
- f.value(t, s);
349
- });
350
- },
351
- setFocusedValue(t, n) {
352
- n.value != null && f.focusedValue(t, n.value);
353
- },
354
- clearFocusedValue(t) {
355
- f.focusedValue(t, null);
356
- },
357
- setValue(t, n) {
358
- const u = t.deselectable && t.value === t.focusedValue ? null : n.value;
359
- f.value(t, u);
360
- },
361
- clearValue(t) {
362
- f.value(t, null);
363
- },
364
- focusFirstTab(t) {
365
- T(() => {
366
- var n;
367
- (n = r.getFirstTriggerEl(t)) == null || n.focus();
368
- });
369
- },
370
- focusLastTab(t) {
371
- T(() => {
372
- var n;
373
- (n = r.getLastTriggerEl(t)) == null || n.focus();
374
- });
375
- },
376
- focusNextTab(t) {
377
- if (!t.focusedValue) return;
378
- const n = r.getNextTriggerEl(t, t.focusedValue);
379
- T(() => {
380
- t.composite ? n == null || n.focus() : (n == null ? void 0 : n.dataset.value) != null && f.focusedValue(t, n.dataset.value);
381
- });
382
- },
383
- focusPrevTab(t) {
384
- if (!t.focusedValue) return;
385
- const n = r.getPrevTriggerEl(t, t.focusedValue);
386
- T(() => {
387
- t.composite ? n == null || n.focus() : (n == null ? void 0 : n.dataset.value) != null && f.focusedValue(t, n.dataset.value);
388
- });
389
- },
390
- checkRenderedElements(t) {
391
- t.indicatorState.rendered = !!r.getIndicatorEl(t);
392
- },
393
- syncTabIndex(t) {
394
- T(() => {
395
- const n = r.getSelectedContentEl(t);
396
- if (!n) return;
397
- L(n).length > 0 ? n.removeAttribute("tabindex") : n.setAttribute("tabindex", "0");
398
- });
399
- },
400
- cleanupObserver(t) {
401
- var n;
402
- (n = t.indicatorCleanup) == null || n.call(t);
403
- },
404
- allowIndicatorTransition(t) {
405
- t.indicatorState.transition = !0;
406
- },
407
- setIndicatorRect(t, n) {
408
- const s = n.id ?? t.value;
409
- !t.indicatorState.rendered || !s || !r.getTriggerEl(t, s) || (t.indicatorState.rect = r.getRectById(t, s), V(() => {
410
- t.indicatorState.transition = !1;
411
- }));
412
- },
413
- syncSsr(t) {
414
- t.ssr = !1;
415
- },
416
- syncIndicatorRect(t) {
417
- var u;
418
- (u = t.indicatorCleanup) == null || u.call(t);
419
- const n = t.value;
420
- if (!t.indicatorState.rendered || !n) return;
421
- const s = r.getSelectedTriggerEl(t);
422
- s && (t.indicatorCleanup = X(s, {
423
- getRect(d) {
424
- return r.getOffsetRect(d);
425
- },
426
- onChange(d) {
427
- t.indicatorState.rect = r.resolveRect(d), V(() => {
428
- t.indicatorState.transition = !1;
429
- });
430
- }
431
- }));
432
- },
433
- clickIfLink(t) {
434
- C(r.getSelectedTriggerEl(t));
342
+ setFocusedValue({ context: e, event: t, flush: o }) {
343
+ t.value != null && o(() => {
344
+ e.set("focusedValue", t.value);
345
+ });
346
+ },
347
+ clearFocusedValue({ context: e }) {
348
+ e.set("focusedValue", null);
349
+ },
350
+ setValue({ context: e, event: t, prop: o }) {
351
+ const a = o("deselectable") && e.get("value") === e.get("focusedValue");
352
+ e.set("value", a ? null : t.value);
353
+ },
354
+ clearValue({ context: e }) {
355
+ e.set("value", null);
356
+ },
357
+ focusFirstTab({ scope: e }) {
358
+ v(() => {
359
+ var t;
360
+ (t = ee(e)) == null || t.focus();
361
+ });
362
+ },
363
+ focusLastTab({ scope: e }) {
364
+ v(() => {
365
+ var t;
366
+ (t = te(e)) == null || t.focus();
367
+ });
368
+ },
369
+ focusNextTab({ context: e, prop: t, scope: o, event: a }) {
370
+ const n = a.value ?? e.get("focusedValue");
371
+ if (!n) return;
372
+ const r = ae(o, {
373
+ value: n,
374
+ loopFocus: t("loopFocus")
375
+ });
376
+ v(() => {
377
+ t("composite") ? r == null || r.focus() : (r == null ? void 0 : r.dataset.value) != null && e.set("focusedValue", r.dataset.value);
378
+ });
379
+ },
380
+ focusPrevTab({ context: e, prop: t, scope: o, event: a }) {
381
+ const n = a.value ?? e.get("focusedValue");
382
+ if (!n) return;
383
+ const r = oe(o, {
384
+ value: n,
385
+ loopFocus: t("loopFocus")
386
+ });
387
+ v(() => {
388
+ t("composite") ? r == null || r.focus() : (r == null ? void 0 : r.dataset.value) != null && e.set("focusedValue", r.dataset.value);
389
+ });
390
+ },
391
+ syncTabIndex({ context: e, scope: t }) {
392
+ v(() => {
393
+ const o = e.get("value");
394
+ if (!o) return;
395
+ const a = z(t, o);
396
+ if (!a) return;
397
+ Y(a).length > 0 ? a.removeAttribute("tabindex") : a.setAttribute("tabindex", "0");
398
+ });
399
+ },
400
+ cleanupObserver({ refs: e }) {
401
+ const t = e.get("indicatorCleanup");
402
+ t && t();
403
+ },
404
+ allowIndicatorTransition({ context: e }) {
405
+ e.set("indicatorTransition", !0);
406
+ },
407
+ setIndicatorRect({ context: e, event: t, scope: o }) {
408
+ const a = t.id ?? e.get("value");
409
+ if (!_(o)) return;
410
+ if (!a) {
411
+ e.set("indicatorTransition", !1);
412
+ return;
413
+ }
414
+ h(o, a) && (e.set("indicatorRect", re(o, a)), S(() => {
415
+ e.set("indicatorTransition", !1);
416
+ }));
417
+ },
418
+ syncSsr({ context: e }) {
419
+ e.set("ssr", !1);
420
+ },
421
+ syncIndicatorRect({ context: e, refs: t, scope: o }) {
422
+ const a = t.get("indicatorCleanup");
423
+ a && a();
424
+ const n = e.get("value");
425
+ if (!n) {
426
+ e.set("indicatorTransition", !1);
427
+ return;
435
428
  }
429
+ const r = h(o, n), u = _(o);
430
+ if (!r || !u) return;
431
+ const p = P([r], {
432
+ measure(g) {
433
+ return O(g);
434
+ },
435
+ onEntry({ rects: g }) {
436
+ const [R] = g;
437
+ e.set("indicatorRect", B(R));
438
+ }
439
+ });
440
+ t.set("indicatorCleanup", p);
441
+ },
442
+ navigateIfNeeded({ context: e, prop: t, scope: o }) {
443
+ var r;
444
+ const a = e.get("value");
445
+ if (!a) return;
446
+ const n = h(o, a);
447
+ N(n) && ((r = t("navigate")) == null || r({ value: a, node: n, href: n.href }));
436
448
  }
437
449
  }
438
- );
439
- }
440
- var m = {
441
- change: (e) => {
442
- var o;
443
- e.value != null && ((o = e.onValueChange) == null || o.call(e, { value: e.value }));
444
- },
445
- focusChange: (e) => {
446
- var o;
447
- e.focusedValue != null && ((o = e.onFocusChange) == null || o.call(e, { focusedValue: e.focusedValue }));
448
450
  }
449
- }, f = {
450
- value: (e, o) => {
451
- h(o, e.value) || (e.value = o, m.change(e));
452
- },
453
- focusedValue: (e, o) => {
454
- h(o, e.focusedValue) || (e.focusedValue = o, m.focusChange(e));
455
- }
456
- };
457
- E()([
451
+ });
452
+ F()([
458
453
  "activationMode",
459
454
  "composite",
455
+ "deselectable",
460
456
  "dir",
461
457
  "getRootNode",
462
458
  "id",
463
459
  "ids",
464
460
  "loopFocus",
461
+ "navigate",
465
462
  "onFocusChange",
466
463
  "onValueChange",
467
464
  "orientation",
468
465
  "translations",
469
- "deselectable",
470
- "value"
466
+ "value",
467
+ "defaultValue"
471
468
  ]);
472
- E()(["disabled", "value"]);
473
- E()(["value"]);
469
+ F()(["disabled", "value"]);
470
+ F()(["value"]);
474
471
  export {
475
- H as anatomy,
476
- z as connect,
477
- x as machine
472
+ J as anatomy,
473
+ de as connect,
474
+ fe as machine
478
475
  };