@epilot/zenith-react 0.1.0-next.0 → 0.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 (142) hide show
  1. package/README.md +95 -15
  2. package/dist/components/appearance-boundary/appearance-boundary.js +32 -34
  3. package/dist/components/appearance-boundary/appearance-boundary.js.map +1 -1
  4. package/dist/components/badge/badge.js +1 -1
  5. package/dist/components/badge/badge.js.map +1 -1
  6. package/dist/components/breadcrumb/breadcrumb.js +10 -10
  7. package/dist/components/breadcrumb/breadcrumb.js.map +1 -1
  8. package/dist/components/button/button.js +28 -28
  9. package/dist/components/button/button.js.map +1 -1
  10. package/dist/components/button-group/button-group.js.map +1 -1
  11. package/dist/components/callout/callout.js +13 -13
  12. package/dist/components/callout/callout.js.map +1 -1
  13. package/dist/components/card/card.js.map +1 -1
  14. package/dist/components/checkbox/checkbox.js +13 -13
  15. package/dist/components/checkbox/checkbox.js.map +1 -1
  16. package/dist/components/code-block/code-block.js +6 -6
  17. package/dist/components/code-block/code-block.js.map +1 -1
  18. package/dist/components/code-editor/code-editor.js +1 -1
  19. package/dist/components/code-editor/code-editor.js.map +1 -1
  20. package/dist/components/code-editor/indent.js.map +1 -1
  21. package/dist/components/command/command.js +7 -13
  22. package/dist/components/command/command.js.map +1 -1
  23. package/dist/components/data-table/data-table-body.js +120 -66
  24. package/dist/components/data-table/data-table-body.js.map +1 -1
  25. package/dist/components/data-table/data-table-column-header.js +7 -7
  26. package/dist/components/data-table/data-table-column-header.js.map +1 -1
  27. package/dist/components/data-table/data-table-column-order.js +277 -0
  28. package/dist/components/data-table/data-table-column-order.js.map +1 -0
  29. package/dist/components/data-table/data-table-content.js +72 -58
  30. package/dist/components/data-table/data-table-content.js.map +1 -1
  31. package/dist/components/data-table/data-table-context.js +8 -4
  32. package/dist/components/data-table/data-table-context.js.map +1 -1
  33. package/dist/components/data-table/data-table-footer.js +31 -0
  34. package/dist/components/data-table/data-table-footer.js.map +1 -0
  35. package/dist/components/data-table/data-table-header-draggable.js +151 -0
  36. package/dist/components/data-table/data-table-header-draggable.js.map +1 -0
  37. package/dist/components/data-table/data-table-header.js +130 -57
  38. package/dist/components/data-table/data-table-header.js.map +1 -1
  39. package/dist/components/data-table/data-table-resize-handle.js +137 -0
  40. package/dist/components/data-table/data-table-resize-handle.js.map +1 -0
  41. package/dist/components/data-table/data-table.js +184 -156
  42. package/dist/components/data-table/data-table.js.map +1 -1
  43. package/dist/components/data-table/hooks/use-data-table-virtualizer.js +9 -0
  44. package/dist/components/data-table/hooks/use-data-table-virtualizer.js.map +1 -0
  45. package/dist/components/date-range-picker/date-range-picker.js +197 -195
  46. package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
  47. package/dist/components/date-time-picker/calendar.js +29 -29
  48. package/dist/components/date-time-picker/calendar.js.map +1 -1
  49. package/dist/components/date-time-picker/time-picker.js +55 -55
  50. package/dist/components/date-time-picker/time-picker.js.map +1 -1
  51. package/dist/components/density-provider/density-provider.js.map +1 -1
  52. package/dist/components/dialog/dialog.js +1 -1
  53. package/dist/components/dialog/dialog.js.map +1 -1
  54. package/dist/components/drawer/drawer.js +5 -5
  55. package/dist/components/drawer/drawer.js.map +1 -1
  56. package/dist/components/dropdown-menu/dropdown-menu.js +36 -36
  57. package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -1
  58. package/dist/components/field/field-combobox.js +4 -4
  59. package/dist/components/field/field-combobox.js.map +1 -1
  60. package/dist/components/field/field.js +40 -40
  61. package/dist/components/field/field.js.map +1 -1
  62. package/dist/components/label/label.js +0 -28
  63. package/dist/components/label/label.js.map +1 -1
  64. package/dist/components/list/list.js +42 -52
  65. package/dist/components/list/list.js.map +1 -1
  66. package/dist/components/option-card/option-card.js +27 -25
  67. package/dist/components/option-card/option-card.js.map +1 -1
  68. package/dist/components/pill/pill.js +9 -9
  69. package/dist/components/pill/pill.js.map +1 -1
  70. package/dist/components/radio/radio.js +14 -14
  71. package/dist/components/radio/radio.js.map +1 -1
  72. package/dist/components/scroll-area/scroll-area.js +9 -9
  73. package/dist/components/scroll-area/scroll-area.js.map +1 -1
  74. package/dist/components/segmented-control/segmented-control.js +1 -1
  75. package/dist/components/segmented-control/segmented-control.js.map +1 -1
  76. package/dist/components/select/select.js +11 -11
  77. package/dist/components/select/select.js.map +1 -1
  78. package/dist/components/separator/separator.js.map +1 -1
  79. package/dist/components/skeleton/skeleton.js.map +1 -1
  80. package/dist/components/slot/compose-as-child.js.map +1 -1
  81. package/dist/components/spinner/spinner.js.map +1 -1
  82. package/dist/components/switch/switch.js +11 -11
  83. package/dist/components/switch/switch.js.map +1 -1
  84. package/dist/components/table/table-pagination.js +1 -1
  85. package/dist/components/table/table-pagination.js.map +1 -1
  86. package/dist/components/table/table.js +15 -15
  87. package/dist/components/table/table.js.map +1 -1
  88. package/dist/components/text/text.js +10 -1
  89. package/dist/components/text/text.js.map +1 -1
  90. package/dist/components/toast/toast.js +30 -32
  91. package/dist/components/toast/toast.js.map +1 -1
  92. package/dist/components/toggle/toggle.js +20 -20
  93. package/dist/components/toggle/toggle.js.map +1 -1
  94. package/dist/delivery/index.d.ts +10 -44
  95. package/dist/delivery/index.js +5 -9
  96. package/dist/index.d.ts +1994 -2272
  97. package/dist/index.js +133 -121
  98. package/dist/index.js.map +1 -1
  99. package/dist/lib/clear-button.js.map +1 -1
  100. package/dist/lib/code-highlight.js.map +1 -1
  101. package/dist/lib/code-tokens.js.map +1 -1
  102. package/dist/lib/pagination.js.map +1 -1
  103. package/dist/packages/tokens/dist/delivery/index.js +18 -48
  104. package/dist/packages/tokens/dist/delivery/index.js.map +1 -1
  105. package/dist/packages/tokens/dist/generated/core.generated.js +18 -0
  106. package/dist/packages/tokens/dist/generated/core.generated.js.map +1 -0
  107. package/dist/packages/tokens/dist/generated/palette.generated.js +5 -5
  108. package/dist/packages/tokens/dist/generated/palette.generated.js.map +1 -1
  109. package/dist/packages/tokens/dist/install.js +9 -9
  110. package/dist/packages/tokens/dist/install.js.map +1 -1
  111. package/dist/styles/document-context.js.map +1 -1
  112. package/dist/styles/make-styles.js.map +1 -1
  113. package/dist/tokens/core.meta.generated.js +2 -2
  114. package/dist/tokens/core.meta.generated.js.map +1 -1
  115. package/dist/tokens/index.d.ts +1029 -1104
  116. package/dist/tokens/index.js +1031 -1106
  117. package/dist/tokens/index.js.map +1 -1
  118. package/dist/tokens/palette.generated.js +2 -2
  119. package/dist/tokens/palette.generated.js.map +1 -1
  120. package/dist/tokens/use-palette-tokens.js.map +1 -1
  121. package/dist/tokens.json +605 -755
  122. package/dist/vendor/.bun/@dnd-kit_core@6.3.1_6f4b9a1cfb20c0ae/vendor/@dnd-kit/core/dist/core.esm.js +385 -340
  123. package/dist/vendor/.bun/@dnd-kit_core@6.3.1_6f4b9a1cfb20c0ae/vendor/@dnd-kit/core/dist/core.esm.js.map +1 -1
  124. package/dist/vendor/.bun/@dnd-kit_sortable@10.0.0_1d291640e1250bbe/vendor/@dnd-kit/sortable/dist/sortable.esm.js +344 -229
  125. package/dist/vendor/.bun/@dnd-kit_sortable@10.0.0_1d291640e1250bbe/vendor/@dnd-kit/sortable/dist/sortable.esm.js.map +1 -1
  126. package/dist/vendor/.bun/@dnd-kit_utilities@3.2.2_62547eec5a2188e3/vendor/@dnd-kit/utilities/dist/utilities.esm.js +1 -1
  127. package/dist/vendor/.bun/@tanstack_react-virtual@3.11.2_6f4b9a1cfb20c0ae/vendor/@tanstack/react-virtual/dist/esm/index.js +36 -0
  128. package/dist/vendor/.bun/@tanstack_react-virtual@3.11.2_6f4b9a1cfb20c0ae/vendor/@tanstack/react-virtual/dist/esm/index.js.map +1 -0
  129. package/dist/vendor/.bun/@tanstack_virtual-core@3.11.2/vendor/@tanstack/virtual-core/dist/esm/index.js +450 -0
  130. package/dist/vendor/.bun/@tanstack_virtual-core@3.11.2/vendor/@tanstack/virtual-core/dist/esm/index.js.map +1 -0
  131. package/dist/vendor/.bun/@tanstack_virtual-core@3.11.2/vendor/@tanstack/virtual-core/dist/esm/utils.js +50 -0
  132. package/dist/vendor/.bun/@tanstack_virtual-core@3.11.2/vendor/@tanstack/virtual-core/dist/esm/utils.js.map +1 -0
  133. package/package.json +5 -4
  134. package/scripts/migration-diagnostics-core.mjs +19 -90
  135. package/scripts/migration-diagnostics.mjs +1 -16
  136. package/scripts/migration-sweep.mjs +2 -12
  137. package/ADOPTING.md +0 -73
  138. package/dist/packages/tokens/dist/delivery/internal.js +0 -181
  139. package/dist/packages/tokens/dist/delivery/internal.js.map +0 -1
  140. package/dist/packages/tokens/dist/generated/core.meta.generated.js +0 -10
  141. package/dist/packages/tokens/dist/generated/core.meta.generated.js.map +0 -1
  142. package/dist/token-assets/core/5cd4072decf5df2a664f0b1d5f2ec250a3309101ded3056c1f87c8bbe3738d50.css +0 -22
@@ -1,368 +1,483 @@
1
- import H, { useMemo as E, useRef as z, useEffect as L, useContext as le, useState as fe } from "react";
2
- import { useDndContext as ge, useDroppable as pe, useDraggable as ve, getClientRect as be, KeyboardCode as O } from "../../../../../@dnd-kit_core@6.3.1_6f4b9a1cfb20c0ae/vendor/@dnd-kit/core/dist/core.esm.js";
3
- import { useUniqueId as me, useIsomorphicLayoutEffect as K, useCombinedRefs as Ie, isKeyboardEvent as xe, CSS as U } from "../../../../../@dnd-kit_utilities@3.2.2_62547eec5a2188e3/vendor/@dnd-kit/utilities/dist/utilities.esm.js";
4
- function V(e, n, t) {
1
+ import q, { useMemo as _, useRef as X, useEffect as k, useContext as pe, useState as be } from "react";
2
+ import { useDndContext as ve, useDroppable as he, useDraggable as xe, KeyboardCode as m, closestCorners as Ie, getFirstCollision as me, getScrollableAncestors as we, getClientRect as ye } from "../../../../../@dnd-kit_core@6.3.1_6f4b9a1cfb20c0ae/vendor/@dnd-kit/core/dist/core.esm.js";
3
+ import { useUniqueId as Re, useIsomorphicLayoutEffect as B, useCombinedRefs as Ce, isKeyboardEvent as Se, CSS as H, subtract as De } from "../../../../../@dnd-kit_utilities@3.2.2_62547eec5a2188e3/vendor/@dnd-kit/utilities/dist/utilities.esm.js";
4
+ function V(e, t, o) {
5
5
  const r = e.slice();
6
- return r.splice(t < 0 ? r.length + t : t, 0, r.splice(n, 1)[0]), r;
6
+ return r.splice(o < 0 ? r.length + o : o, 0, r.splice(t, 1)[0]), r;
7
7
  }
8
- function he(e, n) {
9
- return e.reduce((t, r, o) => {
10
- const s = n.get(r);
11
- return s && (t[o] = s), t;
8
+ function Ae(e, t) {
9
+ return e.reduce((o, r, n) => {
10
+ const s = t.get(r);
11
+ return s && (o[n] = s), o;
12
12
  }, Array(e.length));
13
13
  }
14
- function N(e) {
14
+ function O(e) {
15
15
  return e !== null && e >= 0;
16
16
  }
17
- function ye(e, n) {
18
- if (e === n)
17
+ function Te(e, t) {
18
+ if (e === t)
19
19
  return !0;
20
- if (e.length !== n.length)
20
+ if (e.length !== t.length)
21
21
  return !1;
22
- for (let t = 0; t < e.length; t++)
23
- if (e[t] !== n[t])
22
+ for (let o = 0; o < e.length; o++)
23
+ if (e[o] !== t[o])
24
24
  return !1;
25
25
  return !0;
26
26
  }
27
- function Re(e) {
27
+ function Ne(e) {
28
28
  return typeof e == "boolean" ? {
29
29
  draggable: e,
30
30
  droppable: e
31
31
  } : e;
32
32
  }
33
- const j = (e) => {
33
+ const E = {
34
+ scaleX: 1,
35
+ scaleY: 1
36
+ }, je = (e) => {
37
+ var t;
38
+ let {
39
+ rects: o,
40
+ activeNodeRect: r,
41
+ activeIndex: n,
42
+ overIndex: s,
43
+ index: i
44
+ } = e;
45
+ const a = (t = o[n]) != null ? t : r;
46
+ if (!a)
47
+ return null;
48
+ const d = Oe(o, i, n);
49
+ if (i === n) {
50
+ const c = o[s];
51
+ return c ? {
52
+ x: n < s ? c.left + c.width - (a.left + a.width) : c.left - a.left,
53
+ y: 0,
54
+ ...E
55
+ } : null;
56
+ }
57
+ return i > n && i <= s ? {
58
+ x: -a.width - d,
59
+ y: 0,
60
+ ...E
61
+ } : i < n && i >= s ? {
62
+ x: a.width + d,
63
+ y: 0,
64
+ ...E
65
+ } : {
66
+ x: 0,
67
+ y: 0,
68
+ ...E
69
+ };
70
+ };
71
+ function Oe(e, t, o) {
72
+ const r = e[t], n = e[t - 1], s = e[t + 1];
73
+ return !r || !n && !s ? 0 : o < t ? n ? r.left - (n.left + n.width) : s.left - (r.left + r.width) : s ? s.left - (r.left + r.width) : r.left - (n.left + n.width);
74
+ }
75
+ const J = (e) => {
34
76
  let {
35
- rects: n,
36
- activeIndex: t,
77
+ rects: t,
78
+ activeIndex: o,
37
79
  overIndex: r,
38
- index: o
80
+ index: n
39
81
  } = e;
40
- const s = V(n, r, t), i = n[o], a = s[o];
82
+ const s = V(t, r, o), i = t[n], a = s[n];
41
83
  return !a || !i ? null : {
42
84
  x: a.left - i.left,
43
85
  y: a.top - i.top,
44
86
  scaleX: a.width / i.width,
45
87
  scaleY: a.height / i.height
46
88
  };
47
- }, A = {
89
+ }, L = {
48
90
  scaleX: 1,
49
91
  scaleY: 1
50
- }, ze = (e) => {
51
- var n;
92
+ }, qe = (e) => {
93
+ var t;
52
94
  let {
53
- activeIndex: t,
95
+ activeIndex: o,
54
96
  activeNodeRect: r,
55
- index: o,
97
+ index: n,
56
98
  rects: s,
57
99
  overIndex: i
58
100
  } = e;
59
- const a = (n = s[t]) != null ? n : r;
101
+ const a = (t = s[o]) != null ? t : r;
60
102
  if (!a)
61
103
  return null;
62
- if (o === t) {
63
- const u = s[i];
64
- return u ? {
104
+ if (n === o) {
105
+ const c = s[i];
106
+ return c ? {
65
107
  x: 0,
66
- y: t < i ? u.top + u.height - (a.top + a.height) : u.top - a.top,
67
- ...A
108
+ y: o < i ? c.top + c.height - (a.top + a.height) : c.top - a.top,
109
+ ...L
68
110
  } : null;
69
111
  }
70
- const l = De(s, o, t);
71
- return o > t && o <= i ? {
112
+ const d = Ee(s, n, o);
113
+ return n > o && n <= i ? {
72
114
  x: 0,
73
- y: -a.height - l,
74
- ...A
75
- } : o < t && o >= i ? {
115
+ y: -a.height - d,
116
+ ...L
117
+ } : n < o && n >= i ? {
76
118
  x: 0,
77
- y: a.height + l,
78
- ...A
119
+ y: a.height + d,
120
+ ...L
79
121
  } : {
80
122
  x: 0,
81
123
  y: 0,
82
- ...A
124
+ ...L
83
125
  };
84
126
  };
85
- function De(e, n, t) {
86
- const r = e[n], o = e[n - 1], s = e[n + 1];
87
- return r ? t < n ? o ? r.top - (o.top + o.height) : s ? s.top - (r.top + r.height) : 0 : s ? s.top - (r.top + r.height) : o ? r.top - (o.top + o.height) : 0 : 0;
127
+ function Ee(e, t, o) {
128
+ const r = e[t], n = e[t - 1], s = e[t + 1];
129
+ return r ? o < t ? n ? r.top - (n.top + n.height) : s ? s.top - (r.top + r.height) : 0 : s ? s.top - (r.top + r.height) : n ? r.top - (n.top + n.height) : 0 : 0;
88
130
  }
89
- const k = "Sortable", J = /* @__PURE__ */ H.createContext({
131
+ const Q = "Sortable", W = /* @__PURE__ */ q.createContext({
90
132
  activeIndex: -1,
91
- containerId: k,
133
+ containerId: Q,
92
134
  disableTransforms: !1,
93
135
  items: [],
94
136
  overIndex: -1,
95
137
  useDragOverlay: !1,
96
138
  sortedRects: [],
97
- strategy: j,
139
+ strategy: J,
98
140
  disabled: {
99
141
  draggable: !1,
100
142
  droppable: !1
101
143
  }
102
144
  });
103
- function Pe(e) {
145
+ function Be(e) {
104
146
  let {
105
- children: n,
106
- id: t,
147
+ children: t,
148
+ id: o,
107
149
  items: r,
108
- strategy: o = j,
150
+ strategy: n = J,
109
151
  disabled: s = !1
110
152
  } = e;
111
153
  const {
112
154
  active: i,
113
155
  dragOverlay: a,
114
- droppableRects: l,
115
- over: u,
116
- measureDroppableContainers: c
117
- } = ge(), p = me(k, t), b = a.rect !== null, f = E(() => r.map((m) => typeof m == "object" && "id" in m ? m.id : m), [r]), w = i != null, h = i ? f.indexOf(i.id) : -1, v = u ? f.indexOf(u.id) : -1, T = z(f), y = !ye(f, T.current), R = v !== -1 && h === -1 || y, g = Re(s);
118
- K(() => {
119
- y && w && c(f);
120
- }, [y, f, w, c]), L(() => {
121
- T.current = f;
122
- }, [f]);
123
- const D = E(
156
+ droppableRects: d,
157
+ over: c,
158
+ measureDroppableContainers: l
159
+ } = ve(), u = Re(Q, o), f = a.rect !== null, g = _(() => r.map((I) => typeof I == "object" && "id" in I ? I.id : I), [r]), w = i != null, y = i ? g.indexOf(i.id) : -1, v = c ? g.indexOf(c.id) : -1, R = X(g), x = !Te(g, R.current), h = v !== -1 && y === -1 || x, b = Ne(s);
160
+ B(() => {
161
+ x && w && l(g);
162
+ }, [x, g, w, l]), k(() => {
163
+ R.current = g;
164
+ }, [g]);
165
+ const C = _(
124
166
  () => ({
125
- activeIndex: h,
126
- containerId: p,
127
- disabled: g,
128
- disableTransforms: R,
129
- items: f,
167
+ activeIndex: y,
168
+ containerId: u,
169
+ disabled: b,
170
+ disableTransforms: h,
171
+ items: g,
130
172
  overIndex: v,
131
- useDragOverlay: b,
132
- sortedRects: he(f, l),
133
- strategy: o
173
+ useDragOverlay: f,
174
+ sortedRects: Ae(g, d),
175
+ strategy: n
134
176
  }),
135
177
  // eslint-disable-next-line react-hooks/exhaustive-deps
136
- [h, p, g.draggable, g.droppable, R, f, v, l, b, o]
178
+ [y, u, b.draggable, b.droppable, h, g, v, d, f, n]
137
179
  );
138
- return H.createElement(J.Provider, {
139
- value: D
140
- }, n);
180
+ return q.createElement(W.Provider, {
181
+ value: C
182
+ }, t);
141
183
  }
142
- const Se = (e) => {
184
+ const Le = (e) => {
143
185
  let {
144
- id: n,
145
- items: t,
186
+ id: t,
187
+ items: o,
146
188
  activeIndex: r,
147
- overIndex: o
189
+ overIndex: n
148
190
  } = e;
149
- return V(t, r, o).indexOf(n);
150
- }, Ce = (e) => {
191
+ return V(o, r, n).indexOf(t);
192
+ }, _e = (e) => {
151
193
  let {
152
- containerId: n,
153
- isSorting: t,
194
+ containerId: t,
195
+ isSorting: o,
154
196
  wasDragging: r,
155
- index: o,
197
+ index: n,
156
198
  items: s,
157
199
  newIndex: i,
158
200
  previousItems: a,
159
- previousContainerId: l,
160
- transition: u
201
+ previousContainerId: d,
202
+ transition: c
161
203
  } = e;
162
- return !u || !r || a !== s && o === i ? !1 : t ? !0 : i !== o && n === l;
163
- }, we = {
204
+ return !c || !r || a !== s && n === i ? !1 : o ? !0 : i !== n && t === d;
205
+ }, ke = {
164
206
  duration: 200,
165
207
  easing: "ease"
166
- }, Q = "transform", Te = /* @__PURE__ */ U.Transition.toString({
167
- property: Q,
208
+ }, Z = "transform", $e = /* @__PURE__ */ H.Transition.toString({
209
+ property: Z,
168
210
  duration: 0,
169
211
  easing: "linear"
170
- }), Oe = {
212
+ }), ze = {
171
213
  roleDescription: "sortable"
172
214
  };
173
- function Ne(e) {
215
+ function Ge(e) {
174
216
  let {
175
- disabled: n,
176
- index: t,
217
+ disabled: t,
218
+ index: o,
177
219
  node: r,
178
- rect: o
220
+ rect: n
179
221
  } = e;
180
- const [s, i] = fe(null), a = z(t);
181
- return K(() => {
182
- if (!n && t !== a.current && r.current) {
183
- const l = o.current;
184
- if (l) {
185
- const u = be(r.current, {
222
+ const [s, i] = be(null), a = X(o);
223
+ return B(() => {
224
+ if (!t && o !== a.current && r.current) {
225
+ const d = n.current;
226
+ if (d) {
227
+ const c = ye(r.current, {
186
228
  ignoreTransform: !0
187
- }), c = {
188
- x: l.left - u.left,
189
- y: l.top - u.top,
190
- scaleX: l.width / u.width,
191
- scaleY: l.height / u.height
229
+ }), l = {
230
+ x: d.left - c.left,
231
+ y: d.top - c.top,
232
+ scaleX: d.width / c.width,
233
+ scaleY: d.height / c.height
192
234
  };
193
- (c.x || c.y) && i(c);
235
+ (l.x || l.y) && i(l);
194
236
  }
195
237
  }
196
- t !== a.current && (a.current = t);
197
- }, [n, t, r, o]), L(() => {
238
+ o !== a.current && (a.current = o);
239
+ }, [t, o, r, n]), k(() => {
198
240
  s && i(null);
199
241
  }, [s]), s;
200
242
  }
201
- function Xe(e) {
243
+ function He(e) {
202
244
  let {
203
- animateLayoutChanges: n = Ce,
204
- attributes: t,
245
+ animateLayoutChanges: t = _e,
246
+ attributes: o,
205
247
  disabled: r,
206
- data: o,
207
- getNewIndex: s = Se,
248
+ data: n,
249
+ getNewIndex: s = Le,
208
250
  id: i,
209
251
  strategy: a,
210
- resizeObserverConfig: l,
211
- transition: u = we
252
+ resizeObserverConfig: d,
253
+ transition: c = ke
212
254
  } = e;
213
255
  const {
214
- items: c,
215
- containerId: p,
216
- activeIndex: b,
217
- disabled: f,
256
+ items: l,
257
+ containerId: u,
258
+ activeIndex: f,
259
+ disabled: g,
218
260
  disableTransforms: w,
219
- sortedRects: h,
261
+ sortedRects: y,
220
262
  overIndex: v,
221
- useDragOverlay: T,
222
- strategy: y
223
- } = le(J), R = Ae(r, f), g = c.indexOf(i), D = E(() => ({
263
+ useDragOverlay: R,
264
+ strategy: x
265
+ } = pe(W), h = Xe(r, g), b = l.indexOf(i), C = _(() => ({
224
266
  sortable: {
225
- containerId: p,
226
- index: g,
227
- items: c
267
+ containerId: u,
268
+ index: b,
269
+ items: l
228
270
  },
229
- ...o
230
- }), [p, o, g, c]), m = E(() => c.slice(c.indexOf(i)), [c, i]), {
231
- rect: P,
232
- node: X,
233
- isOver: W,
234
- setNodeRef: G
235
- } = pe({
271
+ ...n
272
+ }), [u, n, b, l]), I = _(() => l.slice(l.indexOf(i)), [l, i]), {
273
+ rect: N,
274
+ node: P,
275
+ isOver: te,
276
+ setNodeRef: Y
277
+ } = he({
236
278
  id: i,
237
- data: D,
238
- disabled: R.droppable,
279
+ data: C,
280
+ disabled: h.droppable,
239
281
  resizeObserverConfig: {
240
- updateMeasurementsFor: m,
241
- ...l
282
+ updateMeasurementsFor: I,
283
+ ...d
242
284
  }
243
285
  }), {
244
- active: S,
245
- activatorEvent: Z,
246
- activeNodeRect: ee,
247
- attributes: te,
248
- setNodeRef: M,
249
- listeners: re,
250
- isDragging: _,
251
- over: ne,
252
- setActivatorNodeRef: oe,
253
- transform: ie
254
- } = ve({
286
+ active: A,
287
+ activatorEvent: re,
288
+ activeNodeRect: ne,
289
+ attributes: oe,
290
+ setNodeRef: F,
291
+ listeners: ie,
292
+ isDragging: z,
293
+ over: se,
294
+ setActivatorNodeRef: ae,
295
+ transform: ce
296
+ } = xe({
255
297
  id: i,
256
- data: D,
298
+ data: C,
257
299
  attributes: {
258
- ...Oe,
259
- ...t
300
+ ...ze,
301
+ ...o
260
302
  },
261
- disabled: R.draggable
262
- }), se = Ie(G, M), I = !!S, Y = I && !w && N(b) && N(v), q = !T && _, B = q && Y ? ie : null, ae = Y ? B ?? (a ?? y)({
263
- rects: h,
264
- activeNodeRect: ee,
265
- activeIndex: b,
303
+ disabled: h.draggable
304
+ }), le = Ce(Y, F), S = !!A, K = S && !w && O(f) && O(v), M = !R && z, U = M && K ? ce : null, de = K ? U ?? (a ?? x)({
305
+ rects: y,
306
+ activeNodeRect: ne,
307
+ activeIndex: f,
266
308
  overIndex: v,
267
- index: g
268
- }) : null, C = N(b) && N(v) ? s({
309
+ index: b
310
+ }) : null, T = O(f) && O(v) ? s({
269
311
  id: i,
270
- items: c,
271
- activeIndex: b,
312
+ items: l,
313
+ activeIndex: f,
272
314
  overIndex: v
273
- }) : g, x = S == null ? void 0 : S.id, d = z({
274
- activeId: x,
275
- items: c,
276
- newIndex: C,
277
- containerId: p
278
- }), ce = c !== d.current.items, F = n({
279
- active: S,
280
- containerId: p,
281
- isDragging: _,
282
- isSorting: I,
315
+ }) : b, D = A == null ? void 0 : A.id, p = X({
316
+ activeId: D,
317
+ items: l,
318
+ newIndex: T,
319
+ containerId: u
320
+ }), ue = l !== p.current.items, j = t({
321
+ active: A,
322
+ containerId: u,
323
+ isDragging: z,
324
+ isSorting: S,
283
325
  id: i,
284
- index: g,
285
- items: c,
286
- newIndex: d.current.newIndex,
287
- previousItems: d.current.items,
288
- previousContainerId: d.current.containerId,
289
- transition: u,
290
- wasDragging: d.current.activeId != null
291
- }), $ = Ne({
292
- disabled: !F,
293
- index: g,
294
- node: X,
295
- rect: P
326
+ index: b,
327
+ items: l,
328
+ newIndex: p.current.newIndex,
329
+ previousItems: p.current.items,
330
+ previousContainerId: p.current.containerId,
331
+ transition: c,
332
+ wasDragging: p.current.activeId != null
333
+ }), G = Ge({
334
+ disabled: !j,
335
+ index: b,
336
+ node: P,
337
+ rect: N
296
338
  });
297
- return L(() => {
298
- I && d.current.newIndex !== C && (d.current.newIndex = C), p !== d.current.containerId && (d.current.containerId = p), c !== d.current.items && (d.current.items = c);
299
- }, [I, C, p, c]), L(() => {
300
- if (x === d.current.activeId)
339
+ return k(() => {
340
+ S && p.current.newIndex !== T && (p.current.newIndex = T), u !== p.current.containerId && (p.current.containerId = u), l !== p.current.items && (p.current.items = l);
341
+ }, [S, T, u, l]), k(() => {
342
+ if (D === p.current.activeId)
301
343
  return;
302
- if (x != null && d.current.activeId == null) {
303
- d.current.activeId = x;
344
+ if (D != null && p.current.activeId == null) {
345
+ p.current.activeId = D;
304
346
  return;
305
347
  }
306
- const de = setTimeout(() => {
307
- d.current.activeId = x;
348
+ const ge = setTimeout(() => {
349
+ p.current.activeId = D;
308
350
  }, 50);
309
- return () => clearTimeout(de);
310
- }, [x]), {
311
- active: S,
312
- activeIndex: b,
313
- attributes: te,
314
- data: D,
315
- rect: P,
316
- index: g,
317
- newIndex: C,
318
- items: c,
319
- isOver: W,
320
- isSorting: I,
321
- isDragging: _,
322
- listeners: re,
323
- node: X,
351
+ return () => clearTimeout(ge);
352
+ }, [D]), {
353
+ active: A,
354
+ activeIndex: f,
355
+ attributes: oe,
356
+ data: C,
357
+ rect: N,
358
+ index: b,
359
+ newIndex: T,
360
+ items: l,
361
+ isOver: te,
362
+ isSorting: S,
363
+ isDragging: z,
364
+ listeners: ie,
365
+ node: P,
324
366
  overIndex: v,
325
- over: ne,
326
- setNodeRef: se,
327
- setActivatorNodeRef: oe,
328
- setDroppableNodeRef: G,
329
- setDraggableNodeRef: M,
330
- transform: $ ?? ae,
331
- transition: ue()
367
+ over: se,
368
+ setNodeRef: le,
369
+ setActivatorNodeRef: ae,
370
+ setDroppableNodeRef: Y,
371
+ setDraggableNodeRef: F,
372
+ transform: G ?? de,
373
+ transition: fe()
332
374
  };
333
- function ue() {
375
+ function fe() {
334
376
  if (
335
377
  // Temporarily disable transitions for a single frame to set up derived transforms
336
- $ || // Or to prevent items jumping to back to their "new" position when items change
337
- ce && d.current.newIndex === g
378
+ G || // Or to prevent items jumping to back to their "new" position when items change
379
+ ue && p.current.newIndex === b
338
380
  )
339
- return Te;
340
- if (!(q && !xe(Z) || !u) && (I || F))
341
- return U.Transition.toString({
342
- ...u,
343
- property: Q
381
+ return $e;
382
+ if (!(M && !Se(re) || !c) && (S || j))
383
+ return H.Transition.toString({
384
+ ...c,
385
+ property: Z
344
386
  });
345
387
  }
346
388
  }
347
- function Ae(e, n) {
348
- var t, r;
389
+ function Xe(e, t) {
390
+ var o, r;
349
391
  return typeof e == "boolean" ? {
350
392
  draggable: e,
351
393
  // Backwards compatibility
352
394
  droppable: !1
353
395
  } : {
354
- draggable: (t = e == null ? void 0 : e.draggable) != null ? t : n.draggable,
355
- droppable: (r = e == null ? void 0 : e.droppable) != null ? r : n.droppable
396
+ draggable: (o = e == null ? void 0 : e.draggable) != null ? o : t.draggable,
397
+ droppable: (r = e == null ? void 0 : e.droppable) != null ? r : t.droppable
356
398
  };
357
399
  }
358
- O.Down, O.Right, O.Up, O.Left;
400
+ function $(e) {
401
+ if (!e)
402
+ return !1;
403
+ const t = e.data.current;
404
+ return !!(t && "sortable" in t && typeof t.sortable == "object" && "containerId" in t.sortable && "items" in t.sortable && "index" in t.sortable);
405
+ }
406
+ const Pe = [m.Down, m.Right, m.Up, m.Left], Ve = (e, t) => {
407
+ let {
408
+ context: {
409
+ active: o,
410
+ collisionRect: r,
411
+ droppableRects: n,
412
+ droppableContainers: s,
413
+ over: i,
414
+ scrollableAncestors: a
415
+ }
416
+ } = t;
417
+ if (Pe.includes(e.code)) {
418
+ if (e.preventDefault(), !o || !r)
419
+ return;
420
+ const d = [];
421
+ s.getEnabled().forEach((u) => {
422
+ if (!u || u != null && u.disabled)
423
+ return;
424
+ const f = n.get(u.id);
425
+ if (f)
426
+ switch (e.code) {
427
+ case m.Down:
428
+ r.top < f.top && d.push(u);
429
+ break;
430
+ case m.Up:
431
+ r.top > f.top && d.push(u);
432
+ break;
433
+ case m.Left:
434
+ r.left > f.left && d.push(u);
435
+ break;
436
+ case m.Right:
437
+ r.left < f.left && d.push(u);
438
+ break;
439
+ }
440
+ });
441
+ const c = Ie({
442
+ collisionRect: r,
443
+ droppableRects: n,
444
+ droppableContainers: d
445
+ });
446
+ let l = me(c, "id");
447
+ if (l === (i == null ? void 0 : i.id) && c.length > 1 && (l = c[1].id), l != null) {
448
+ const u = s.get(o.id), f = s.get(l), g = f ? n.get(f.id) : null, w = f == null ? void 0 : f.node.current;
449
+ if (w && g && u && f) {
450
+ const v = we(w).some((I, N) => a[N] !== I), R = ee(u, f), x = Ye(u, f), h = v || !R ? {
451
+ x: 0,
452
+ y: 0
453
+ } : {
454
+ x: x ? r.width - g.width : 0,
455
+ y: x ? r.height - g.height : 0
456
+ }, b = {
457
+ x: g.left,
458
+ y: g.top
459
+ };
460
+ return h.x && h.y ? b : De(b, h);
461
+ }
462
+ }
463
+ }
464
+ };
465
+ function ee(e, t) {
466
+ return !$(e) || !$(t) ? !1 : e.data.current.sortable.containerId === t.data.current.sortable.containerId;
467
+ }
468
+ function Ye(e, t) {
469
+ return !$(e) || !$(t) || !ee(e, t) ? !1 : e.data.current.sortable.index < t.data.current.sortable.index;
470
+ }
359
471
  export {
360
- Pe as SortableContext,
472
+ Be as SortableContext,
361
473
  V as arrayMove,
362
- Ce as defaultAnimateLayoutChanges,
363
- Se as defaultNewIndexGetter,
364
- j as rectSortingStrategy,
365
- Xe as useSortable,
366
- ze as verticalListSortingStrategy
474
+ _e as defaultAnimateLayoutChanges,
475
+ Le as defaultNewIndexGetter,
476
+ $ as hasSortableData,
477
+ je as horizontalListSortingStrategy,
478
+ J as rectSortingStrategy,
479
+ Ve as sortableKeyboardCoordinates,
480
+ He as useSortable,
481
+ qe as verticalListSortingStrategy
367
482
  };
368
483
  //# sourceMappingURL=sortable.esm.js.map