@codbex/harmonia 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/harmonia.js CHANGED
@@ -1,84 +1,4 @@
1
1
  (() => {
2
- // node_modules/lucide/dist/esm/defaultAttributes.js
3
- var defaultAttributes = {
4
- xmlns: "http://www.w3.org/2000/svg",
5
- width: 24,
6
- height: 24,
7
- viewBox: "0 0 24 24",
8
- fill: "none",
9
- stroke: "currentColor",
10
- "stroke-width": 2,
11
- "stroke-linecap": "round",
12
- "stroke-linejoin": "round"
13
- };
14
-
15
- // node_modules/lucide/dist/esm/createElement.js
16
- var createSVGElement = ([tag, attrs, children]) => {
17
- const element = document.createElementNS("http://www.w3.org/2000/svg", tag);
18
- Object.keys(attrs).forEach((name) => {
19
- element.setAttribute(name, String(attrs[name]));
20
- });
21
- if (children?.length) {
22
- children.forEach((child) => {
23
- const childElement = createSVGElement(child);
24
- element.appendChild(childElement);
25
- });
26
- }
27
- return element;
28
- };
29
- var createElement = (iconNode, customAttrs = {}) => {
30
- const tag = "svg";
31
- const attrs = {
32
- ...defaultAttributes,
33
- ...customAttrs
34
- };
35
- return createSVGElement([tag, attrs, iconNode]);
36
- };
37
-
38
- // node_modules/lucide/dist/esm/icons/calendar.js
39
- var Calendar = [
40
- ["path", { d: "M8 2v4" }],
41
- ["path", { d: "M16 2v4" }],
42
- ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2" }],
43
- ["path", { d: "M3 10h18" }]
44
- ];
45
-
46
- // node_modules/lucide/dist/esm/icons/check.js
47
- var Check = [["path", { d: "M20 6 9 17l-5-5" }]];
48
-
49
- // node_modules/lucide/dist/esm/icons/chevron-down.js
50
- var ChevronDown = [["path", { d: "m6 9 6 6 6-6" }]];
51
-
52
- // node_modules/lucide/dist/esm/icons/chevron-left.js
53
- var ChevronLeft = [["path", { d: "m15 18-6-6 6-6" }]];
54
-
55
- // node_modules/lucide/dist/esm/icons/chevron-right.js
56
- var ChevronRight = [["path", { d: "m9 18 6-6-6-6" }]];
57
-
58
- // node_modules/lucide/dist/esm/icons/chevrons-left.js
59
- var ChevronsLeft = [
60
- ["path", { d: "m11 17-5-5 5-5" }],
61
- ["path", { d: "m18 17-5-5 5-5" }]
62
- ];
63
-
64
- // node_modules/lucide/dist/esm/icons/chevrons-right.js
65
- var ChevronsRight = [
66
- ["path", { d: "m6 17 5-5-5-5" }],
67
- ["path", { d: "m13 17 5-5-5-5" }]
68
- ];
69
-
70
- // node_modules/lucide/dist/esm/icons/clock.js
71
- var Clock = [
72
- ["path", { d: "M12 6v6l4 2" }],
73
- ["circle", { cx: "12", cy: "12", r: "10" }]
74
- ];
75
-
76
- // node_modules/lucide/dist/esm/icons/search.js
77
- var Search = [
78
- ["path", { d: "m21 21-4.34-4.34" }],
79
- ["circle", { cx: "11", cy: "11", r: "8" }]
80
- ];
81
-
82
2
  // node_modules/uuid/dist/stringify.js
83
3
  var byteToHex = [];
84
4
  for (let i = 0; i < 256; ++i) {
@@ -134,6 +54,247 @@
134
54
  }
135
55
  var v4_default = v4;
136
56
 
57
+ // src/common/icons.js
58
+ var Calendar = 0;
59
+ var Check = 1;
60
+ var ChevronDown = 2;
61
+ var ChevronLeft = 3;
62
+ var ChevronRight = 4;
63
+ var ChevronsLeft = 5;
64
+ var ChevronsRight = 6;
65
+ var Clock = 7;
66
+ var Search = 8;
67
+ var Ellipsis = 9;
68
+ var Minus = 10;
69
+ var Plus = 11;
70
+ function setCalendarContent(svg) {
71
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
72
+ path.setAttributeNS(
73
+ null,
74
+ "d",
75
+ "m5.4512 0.8252c-0.3601 0-0.65039 0.29029-0.65039 0.65039v0.69922h-1.3008c-1.108 0-2 0.892-2 2v9c0 1.108 0.892 2 2 2h9c1.108 0 2-0.892 2-2v-9c0-1.108-0.892-2-2-2h-1.2988v-0.69922c0-0.3601-0.29029-0.65039-0.65039-0.65039s-0.64844 0.29029-0.64844 0.65039v0.69922h-3.8027v-0.69922c0-0.3601-0.28834-0.65039-0.64844-0.65039zm-1.6504 2.6504h1v0.69922c1e-6 0.3601 0.29029 0.65039 0.65039 0.65039s0.64844-0.29029 0.64844-0.65039v-0.69922h3.8027v0.69922c0 0.3601 0.28834 0.65039 0.64844 0.65039s0.65039-0.29029 0.65039-0.65039v-0.69922h1c0.554 0 1 0.446 1 1v1.5h-10.4v-1.5c0-0.554 0.446-1 1-1zm-1 3.8008h10.4v5.5996c0 0.554-0.446 1-1 1h-8.4004c-0.554 0-1-0.446-1-1z"
76
+ );
77
+ svg.appendChild(path);
78
+ }
79
+ function setCheckContent(svg) {
80
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
81
+ path.setAttributeNS(
82
+ null,
83
+ "d",
84
+ "m12.937 4.049-6.5829 6.5829-3.2935-3.2914c-0.23947-0.23959-0.63055-0.24761-0.87815 0-0.24358 0.2437-0.24358 0.63448 0 0.87815l3.7315 3.7337c0.24646 0.24634 0.64298 0.23729 0.88026 0l7.0228-7.0251c0.24358-0.2437 0.24358-0.63448 0-0.87815-0.2433-0.24342-0.63667-0.24364-0.88026-1.5e-6z"
85
+ );
86
+ svg.appendChild(path);
87
+ }
88
+ function setChevronDownContent(svg) {
89
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
90
+ path.setAttributeNS(
91
+ null,
92
+ "d",
93
+ "m3.2098 5.353c-0.2797 0.27984-0.2797 0.72853 0 1.0083l4.2848 4.2872c0.283 0.28286 0.73831 0.27246 1.0108 0l4.2848-4.2872c0.2797-0.27984 0.2797-0.72853 0-1.0083-0.2797-0.27984-0.73098-0.27984-1.0108 0l-3.7795 3.7795-3.7818-3.7795c-0.27497-0.27511-0.72404-0.28432-1.0083 0z"
94
+ );
95
+ svg.appendChild(path);
96
+ }
97
+ function setChevronLeftContent(svg) {
98
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
99
+ path.setAttributeNS(
100
+ null,
101
+ "d",
102
+ "m10.647 12.79c-0.27984 0.2797-0.72853 0.2797-1.0083 0l-4.2872-4.2848c-0.28286-0.283-0.27246-0.73831 0-1.0108l4.2872-4.2848c0.27984-0.2797 0.72853-0.2797 1.0083 0 0.27984 0.2797 0.27984 0.73098 0 1.0108l-3.7795 3.7795 3.7795 3.7818c0.27511 0.27497 0.28432 0.72404 0 1.0083z"
103
+ );
104
+ svg.appendChild(path);
105
+ }
106
+ function setChevronRightContent(svg) {
107
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
108
+ path.setAttributeNS(
109
+ null,
110
+ "d",
111
+ "m5.353 12.79c0.27984 0.2797 0.72853 0.2797 1.0083 0l4.2872-4.2848c0.28286-0.283 0.27246-0.73831 0-1.0108l-4.2872-4.2848c-0.27984-0.2797-0.72853-0.2797-1.0083 0-0.27984 0.2797-0.27984 0.73098 0 1.0108l3.7795 3.7795-3.7795 3.7818c-0.27511 0.27497-0.28432 0.72404 0 1.0083z"
112
+ );
113
+ svg.appendChild(path);
114
+ }
115
+ function setChevronsLeftContent(svg) {
116
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
117
+ path.setAttributeNS(
118
+ null,
119
+ "d",
120
+ "m13 3c0.18212 0 0.36302 0.070121 0.50292 0.20996 0.27982 0.27969 0.27982 0.73097 0 1.0108l-3.7794 3.7794 3.7794 3.7819c0.27511 0.27496 0.28432 0.72402 0 1.0083-0.27984 0.27969-0.72852 0.27969-1.0083 0l-4.2872-4.2847c-0.28285-0.283-0.27246-0.7383 0-1.0108l4.2872-4.2847c0.13991-0.13985 0.32325-0.20996 0.50537-0.20996zm-5.7152 0c0.18212 0 0.36547 0.070121 0.50537 0.20996 0.27984 0.27969 0.27984 0.73097 0 1.0108l-3.7794 3.7794 3.7794 3.7819c0.27511 0.27496 0.28432 0.72402 0 1.0083-0.27984 0.27969-0.72852 0.27969-1.0083 0l-4.2872-4.2847c-0.28286-0.283-0.27246-0.7383 0-1.0108l4.2872-4.2847c0.13991-0.13985 0.32081-0.20996 0.50292-0.20996z"
121
+ );
122
+ svg.appendChild(path);
123
+ }
124
+ function setChevronsRightContent(svg) {
125
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
126
+ path.setAttributeNS(
127
+ null,
128
+ "d",
129
+ "m2.9996 3c-0.18212 0-0.36302 0.070121-0.50292 0.20996-0.27984 0.27969-0.27984 0.73097 0 1.0108l3.7794 3.7794-3.7794 3.7819c-0.27511 0.27496-0.28432 0.72402 0 1.0083 0.27984 0.27969 0.72852 0.27969 1.0083 0l4.2872-4.2847c0.28286-0.283 0.27246-0.7383 0-1.0108l-4.2872-4.2847c-0.13991-0.13985-0.32325-0.20996-0.50537-0.20996zm5.7152 0c-0.18212 0-0.36547 0.070121-0.50537 0.20996-0.27984 0.27969-0.27984 0.73097 0 1.0108l3.7794 3.7794-3.7794 3.7819c-0.27511 0.27496-0.28432 0.72402 0 1.0083 0.27984 0.27969 0.72852 0.27969 1.0083 0l4.2872-4.2847c0.28285-0.283 0.27246-0.7383 0-1.0108l-4.2872-4.2847c-0.13991-0.13985-0.32081-0.20996-0.50292-0.20996z"
130
+ );
131
+ svg.appendChild(path);
132
+ }
133
+ function setClockContent(svg) {
134
+ const path1 = document.createElementNS("http://www.w3.org/2000/svg", "path");
135
+ path1.setAttributeNS(
136
+ null,
137
+ "d",
138
+ "m8 0.75a7.25 7.25 0 0 0-7.25 7.25 7.25 7.25 0 0 0 7.25 7.25 7.25 7.25 0 0 0 7.25-7.25 7.25 7.25 0 0 0-7.25-7.25zm0 1.3008a5.95 5.95 0 0 1 5.9492 5.9492 5.95 5.95 0 0 1-5.9492 5.9512 5.95 5.95 0 0 1-5.9492-5.9512 5.95 5.95 0 0 1 5.9492-5.9492z"
139
+ );
140
+ svg.appendChild(path1);
141
+ const path2 = document.createElementNS("http://www.w3.org/2000/svg", "path");
142
+ path2.setAttributeNS(
143
+ null,
144
+ "d",
145
+ "m8 3.25c-0.3601 0-0.65039 0.29029-0.65039 0.65039v4.0996c-4.82e-5 0.2464 0.13303 0.40256 0.20508 0.47461l2.6035 2.6016c0.25463 0.25463 0.66334 0.25463 0.91797 0s0.25463-0.66334 0-0.91797l-2.4258-2.4277v-3.8301c0-0.3601-0.29029-0.65039-0.65039-0.65039z"
146
+ );
147
+ svg.appendChild(path2);
148
+ }
149
+ function setSearchContent(svg) {
150
+ const path1 = document.createElementNS("http://www.w3.org/2000/svg", "path");
151
+ path1.setAttributeNS(
152
+ null,
153
+ "d",
154
+ "m7.31 1.31a5.9999 5.9999 0 0 0-5.9999 5.9999 5.9999 5.9999 0 0 0 5.9999 5.9999 5.9999 5.9999 0 0 0 5.9999-5.9999 5.9999 5.9999 0 0 0-5.9999-5.9999zm0 1.1992a4.7999 4.7999 0 0 1 4.8007 4.8007 4.7999 4.7999 0 0 1-4.8007 4.8007 4.7999 4.7999 0 0 1-4.8007-4.8007 4.7999 4.7999 0 0 1 4.8007-4.8007z"
155
+ );
156
+ svg.appendChild(path1);
157
+ const path2 = document.createElementNS("http://www.w3.org/2000/svg", "path");
158
+ path2.setAttributeNS(
159
+ null,
160
+ "d",
161
+ "m10.705 10.705c0.23504-0.23504 0.6286-0.2199 0.88247 0.03394l2.9019 2.9019c0.25384 0.25384 0.26898 0.64742 0.03394 0.88247-0.23504 0.23504-0.6286 0.2199-0.88247-0.03394l-2.9019-2.9019c-0.25384-0.25384-0.26898-0.64742-0.03394-0.88247z"
162
+ );
163
+ svg.appendChild(path2);
164
+ }
165
+ function setEllipsisContent(svg) {
166
+ const circle1 = document.createElementNS("http://www.w3.org/2000/svg", "circle");
167
+ circle1.setAttributeNS(null, "cx", "2");
168
+ circle1.setAttributeNS(null, "cy", "8");
169
+ circle1.setAttributeNS(null, "r", "1.5");
170
+ svg.appendChild(circle1);
171
+ const circle2 = document.createElementNS("http://www.w3.org/2000/svg", "circle");
172
+ circle2.setAttributeNS(null, "cx", "8");
173
+ circle2.setAttributeNS(null, "cy", "8");
174
+ circle2.setAttributeNS(null, "r", "1.5");
175
+ svg.appendChild(circle2);
176
+ const circle3 = document.createElementNS("http://www.w3.org/2000/svg", "circle");
177
+ circle3.setAttributeNS(null, "cx", "14");
178
+ circle3.setAttributeNS(null, "cy", "8");
179
+ circle3.setAttributeNS(null, "r", "1.5");
180
+ svg.appendChild(circle3);
181
+ }
182
+ function setMinusContent(svg) {
183
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
184
+ path.setAttributeNS(null, "d", "m2.75 7.25h10.5c0.4155 0 0.75 0.3345 0.75 0.75s-0.3345 0.75-0.75 0.75h-10.5c-0.4155 0-0.75-0.3345-0.75-0.75s0.3345-0.75 0.75-0.75z");
185
+ svg.appendChild(path);
186
+ }
187
+ function setPlusContent(svg) {
188
+ const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
189
+ path.setAttributeNS(
190
+ null,
191
+ "d",
192
+ "m8 2c-0.4155 0-0.75 0.3345-0.75 0.75v4.5h-4.5c-0.4155 0-0.75 0.3345-0.75 0.75s0.3345 0.75 0.75 0.75h4.5v4.5c0 0.4155 0.3345 0.75 0.75 0.75s0.75-0.3345 0.75-0.75v-4.5h4.5c0.4155 0 0.75-0.3345 0.75-0.75s-0.3345-0.75-0.75-0.75h-4.5v-4.5c0-0.4155-0.3345-0.75-0.75-0.75z"
193
+ );
194
+ svg.appendChild(path);
195
+ }
196
+ function createSvg({ icon, classes = "size-4", attrs } = {}) {
197
+ const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
198
+ svg.setAttributeNS(null, "width", "16");
199
+ svg.setAttributeNS(null, "height", "16");
200
+ svg.setAttributeNS(null, "viewBox", "0 0 16 16");
201
+ svg.setAttributeNS(null, "fill", "currentColor");
202
+ svg.setAttributeNS(null, "class", classes);
203
+ if (attrs) {
204
+ for (const [key, value] of Object.entries(attrs)) {
205
+ svg.setAttributeNS(null, key, value);
206
+ }
207
+ }
208
+ switch (icon) {
209
+ case Calendar:
210
+ setCalendarContent(svg);
211
+ break;
212
+ case Check:
213
+ setCheckContent(svg);
214
+ break;
215
+ case ChevronDown:
216
+ setChevronDownContent(svg);
217
+ break;
218
+ case ChevronLeft:
219
+ setChevronLeftContent(svg);
220
+ break;
221
+ case ChevronRight:
222
+ setChevronRightContent(svg);
223
+ break;
224
+ case ChevronsLeft:
225
+ setChevronsLeftContent(svg);
226
+ break;
227
+ case ChevronsRight:
228
+ setChevronsRightContent(svg);
229
+ break;
230
+ case Clock:
231
+ setClockContent(svg);
232
+ break;
233
+ case Search:
234
+ setSearchContent(svg);
235
+ break;
236
+ case Ellipsis:
237
+ setEllipsisContent(svg);
238
+ break;
239
+ case Minus:
240
+ setMinusContent(svg);
241
+ break;
242
+ case Plus:
243
+ setPlusContent(svg);
244
+ break;
245
+ default:
246
+ break;
247
+ }
248
+ return svg;
249
+ }
250
+ function setSvgContent(svg, icon) {
251
+ svg.setAttribute("xmlns", "http://www.w3.org/2000/svg");
252
+ svg.setAttribute("width", "16");
253
+ svg.setAttribute("height", "16");
254
+ svg.setAttribute("viewBox", "0 0 16 16");
255
+ svg.setAttribute("fill", "currentColor");
256
+ switch (icon) {
257
+ case "calendar":
258
+ setCalendarContent(svg);
259
+ break;
260
+ case "check":
261
+ setCheckContent(svg);
262
+ break;
263
+ case "chevron-down":
264
+ setChevronDownContent(svg);
265
+ break;
266
+ case "chevron-left":
267
+ setChevronLeftContent(svg);
268
+ break;
269
+ case "chevron-right":
270
+ setChevronRightContent(svg);
271
+ break;
272
+ case "chevrons-left":
273
+ setChevronsLeftContent(svg);
274
+ break;
275
+ case "chevrons-right":
276
+ setChevronsRightContent(svg);
277
+ break;
278
+ case "clock":
279
+ setClockContent(svg);
280
+ break;
281
+ case "search":
282
+ setSearchContent(svg);
283
+ break;
284
+ case "ellipsis":
285
+ setEllipsisContent(svg);
286
+ break;
287
+ case "minus":
288
+ setMinusContent(svg);
289
+ break;
290
+ case "plus":
291
+ setPlusContent(svg);
292
+ break;
293
+ default:
294
+ break;
295
+ }
296
+ }
297
+
137
298
  // src/components/accordion.js
138
299
  function accordion_default(Alpine) {
139
300
  Alpine.directive("h-accordion", (el, { expression, modifiers }, { Alpine: Alpine2 }) => {
@@ -197,12 +358,13 @@
197
358
  );
198
359
  el.setAttribute("tabIndex", "-1");
199
360
  const getLabel = evaluateLater(expression);
200
- const chevronDown = createElement(ChevronDown, {
201
- class: ["text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200"],
202
- width: "16",
203
- height: "16",
204
- "aria-hidden": true,
205
- role: "presentation"
361
+ const chevronDown = createSvg({
362
+ icon: ChevronDown,
363
+ classes: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200",
364
+ attrs: {
365
+ "aria-hidden": true,
366
+ role: "presentation"
367
+ }
206
368
  });
207
369
  const button = document.createElement("button");
208
370
  button.setAttribute("type", "button");
@@ -368,7 +530,7 @@
368
530
  Alpine.directive("h-avatar-image", (el, { original }, { cleanup }) => {
369
531
  const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
370
532
  if (!avatar) {
371
- throw new Error(`${original} must be inside an h-avatar element`);
533
+ throw new Error(`${original} must be inside an avatar element`);
372
534
  }
373
535
  el.classList.add("aspect-square", "size-full");
374
536
  el.setAttribute("data-slot", "avatar-image");
@@ -402,7 +564,7 @@
402
564
  Alpine.directive("h-avatar-fallback", (el, { original }, { effect }) => {
403
565
  const avatar = Alpine.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_avatar"));
404
566
  if (!avatar) {
405
- throw new Error(`${original} must be inside an h-avatar element`);
567
+ throw new Error(`${original} must be inside an avatar element`);
406
568
  }
407
569
  el.classList.add("hidden", "bg-muted", "flex", "size-full", "items-center", "justify-center");
408
570
  el.setAttribute("data-slot", "avatar-fallback");
@@ -879,6 +1041,62 @@
879
1041
  }
880
1042
  return coords;
881
1043
  }
1044
+ async function detectOverflow(state, options) {
1045
+ var _await$platform$isEle;
1046
+ if (options === void 0) {
1047
+ options = {};
1048
+ }
1049
+ const {
1050
+ x,
1051
+ y,
1052
+ platform: platform2,
1053
+ rects,
1054
+ elements,
1055
+ strategy
1056
+ } = state;
1057
+ const {
1058
+ boundary = "clippingAncestors",
1059
+ rootBoundary = "viewport",
1060
+ elementContext = "floating",
1061
+ altBoundary = false,
1062
+ padding = 0
1063
+ } = evaluate(options, state);
1064
+ const paddingObject = getPaddingObject(padding);
1065
+ const altContext = elementContext === "floating" ? "reference" : "floating";
1066
+ const element = elements[altBoundary ? altContext : elementContext];
1067
+ const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
1068
+ element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
1069
+ boundary,
1070
+ rootBoundary,
1071
+ strategy
1072
+ }));
1073
+ const rect = elementContext === "floating" ? {
1074
+ x,
1075
+ y,
1076
+ width: rects.floating.width,
1077
+ height: rects.floating.height
1078
+ } : rects.reference;
1079
+ const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
1080
+ const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
1081
+ x: 1,
1082
+ y: 1
1083
+ } : {
1084
+ x: 1,
1085
+ y: 1
1086
+ };
1087
+ const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
1088
+ elements,
1089
+ rect,
1090
+ offsetParent,
1091
+ strategy
1092
+ }) : rect);
1093
+ return {
1094
+ top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
1095
+ bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
1096
+ left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
1097
+ right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
1098
+ };
1099
+ }
882
1100
  var computePosition = async (reference, floating, config) => {
883
1101
  const {
884
1102
  placement = "bottom",
@@ -901,6 +1119,7 @@
901
1119
  let middlewareData = {};
902
1120
  let resetCount = 0;
903
1121
  for (let i = 0; i < validMiddleware.length; i++) {
1122
+ var _platform$detectOverf;
904
1123
  const {
905
1124
  name,
906
1125
  fn
@@ -918,7 +1137,10 @@
918
1137
  strategy,
919
1138
  middlewareData,
920
1139
  rects,
921
- platform: platform2,
1140
+ platform: {
1141
+ ...platform2,
1142
+ detectOverflow: (_platform$detectOverf = platform2.detectOverflow) != null ? _platform$detectOverf : detectOverflow
1143
+ },
922
1144
  elements: {
923
1145
  reference,
924
1146
  floating
@@ -962,62 +1184,6 @@
962
1184
  middlewareData
963
1185
  };
964
1186
  };
965
- async function detectOverflow(state, options) {
966
- var _await$platform$isEle;
967
- if (options === void 0) {
968
- options = {};
969
- }
970
- const {
971
- x,
972
- y,
973
- platform: platform2,
974
- rects,
975
- elements,
976
- strategy
977
- } = state;
978
- const {
979
- boundary = "clippingAncestors",
980
- rootBoundary = "viewport",
981
- elementContext = "floating",
982
- altBoundary = false,
983
- padding = 0
984
- } = evaluate(options, state);
985
- const paddingObject = getPaddingObject(padding);
986
- const altContext = elementContext === "floating" ? "reference" : "floating";
987
- const element = elements[altBoundary ? altContext : elementContext];
988
- const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
989
- element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
990
- boundary,
991
- rootBoundary,
992
- strategy
993
- }));
994
- const rect = elementContext === "floating" ? {
995
- x,
996
- y,
997
- width: rects.floating.width,
998
- height: rects.floating.height
999
- } : rects.reference;
1000
- const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
1001
- const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
1002
- x: 1,
1003
- y: 1
1004
- } : {
1005
- x: 1,
1006
- y: 1
1007
- };
1008
- const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
1009
- elements,
1010
- rect,
1011
- offsetParent,
1012
- strategy
1013
- }) : rect);
1014
- return {
1015
- top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
1016
- bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
1017
- left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
1018
- right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
1019
- };
1020
- }
1021
1187
  var arrow = (options) => ({
1022
1188
  name: "arrow",
1023
1189
  options,
@@ -1119,7 +1285,7 @@
1119
1285
  fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
1120
1286
  }
1121
1287
  const placements2 = [initialPlacement, ...fallbackPlacements];
1122
- const overflow = await detectOverflow(state, detectOverflowOptions);
1288
+ const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
1123
1289
  const overflows = [];
1124
1290
  let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1125
1291
  if (checkMainAxis) {
@@ -1268,7 +1434,8 @@
1268
1434
  const {
1269
1435
  x,
1270
1436
  y,
1271
- placement
1437
+ placement,
1438
+ platform: platform2
1272
1439
  } = state;
1273
1440
  const {
1274
1441
  mainAxis: checkMainAxis = true,
@@ -1291,7 +1458,7 @@
1291
1458
  x,
1292
1459
  y
1293
1460
  };
1294
- const overflow = await detectOverflow(state, detectOverflowOptions);
1461
+ const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
1295
1462
  const crossAxis = getSideAxis(getSide(placement));
1296
1463
  const mainAxis = getOppositeAxis(crossAxis);
1297
1464
  let mainAxisCoord = coords[mainAxis];
@@ -1349,7 +1516,7 @@
1349
1516
  },
1350
1517
  ...detectOverflowOptions
1351
1518
  } = evaluate(options, state);
1352
- const overflow = await detectOverflow(state, detectOverflowOptions);
1519
+ const overflow = await platform2.detectOverflow(state, detectOverflowOptions);
1353
1520
  const side = getSide(placement);
1354
1521
  const alignment = getAlignment(placement);
1355
1522
  const isYAxis = getSideAxis(placement) === "y";
@@ -2181,7 +2348,7 @@
2181
2348
  el.setAttribute("role", "dialog");
2182
2349
  el.setAttribute("aria-modal", "true");
2183
2350
  el.setAttribute("data-slot", "date-picker-calendar");
2184
- el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
2351
+ el.setAttribute("data-state", datepicker._h_datepicker.state.expanded ? "open" : "closed");
2185
2352
  } else {
2186
2353
  el.classList.add("shadow-input", "data-[invalid=true]:border-negative", "data-[invalid=true]:ring-negative/20", "dark:data-[invalid=true]:ring-negative/40");
2187
2354
  }
@@ -2247,7 +2414,7 @@
2247
2414
  selected = new Date(focusedDay);
2248
2415
  modelChange(true);
2249
2416
  render();
2250
- if (datepicker) datepicker._h_datepicker.expanded = false;
2417
+ if (datepicker) datepicker._h_datepicker.state.expanded = false;
2251
2418
  }
2252
2419
  function isDisabled(d) {
2253
2420
  if (minDate && d < new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate())) return true;
@@ -2301,12 +2468,13 @@
2301
2468
  previousYearBtn.setAttribute("aria-label", el.hasAttribute("data-aria-prev-year") ? el.hasAttribute("data-aria-prev-year") : "previous year");
2302
2469
  previousYearBtn.setAttribute("type", "button");
2303
2470
  previousYearBtn.appendChild(
2304
- createElement(ChevronsLeft, {
2305
- class: ["opacity-70 size-4 shrink-0 pointer-events-none"],
2306
- width: "16",
2307
- height: "16",
2308
- "aria-hidden": true,
2309
- role: "presentation"
2471
+ createSvg({
2472
+ icon: ChevronsLeft,
2473
+ classes: "opacity-70 size-4 shrink-0 pointer-events-none",
2474
+ attrs: {
2475
+ "aria-hidden": true,
2476
+ role: "presentation"
2477
+ }
2310
2478
  })
2311
2479
  );
2312
2480
  previousYearBtn.addEventListener("click", () => {
@@ -2319,12 +2487,13 @@
2319
2487
  previousMonthBtn.setAttribute("aria-label", el.hasAttribute("data-aria-prev-month") ? el.hasAttribute("data-aria-prev-month") : "previous month");
2320
2488
  previousMonthBtn.setAttribute("type", "button");
2321
2489
  previousMonthBtn.appendChild(
2322
- createElement(ChevronLeft, {
2323
- class: ["opacity-70 size-4 shrink-0 pointer-events-none"],
2324
- width: "16",
2325
- height: "16",
2326
- "aria-hidden": true,
2327
- role: "presentation"
2490
+ createSvg({
2491
+ icon: ChevronLeft,
2492
+ classes: "opacity-70 size-4 shrink-0 pointer-events-none",
2493
+ attrs: {
2494
+ "aria-hidden": true,
2495
+ role: "presentation"
2496
+ }
2328
2497
  })
2329
2498
  );
2330
2499
  previousMonthBtn.addEventListener("click", () => {
@@ -2342,12 +2511,13 @@
2342
2511
  nextMonthBtn.setAttribute("aria-label", el.hasAttribute("data-aria-next-month") ? el.hasAttribute("data-aria-next-month") : "next month");
2343
2512
  nextMonthBtn.setAttribute("type", "button");
2344
2513
  nextMonthBtn.appendChild(
2345
- createElement(ChevronRight, {
2346
- class: ["opacity-70 size-4 shrink-0 pointer-events-none"],
2347
- width: "16",
2348
- height: "16",
2349
- "aria-hidden": true,
2350
- role: "presentation"
2514
+ createSvg({
2515
+ icon: ChevronRight,
2516
+ classes: "opacity-70 size-4 shrink-0 pointer-events-none",
2517
+ attrs: {
2518
+ "aria-hidden": true,
2519
+ role: "presentation"
2520
+ }
2351
2521
  })
2352
2522
  );
2353
2523
  nextMonthBtn.addEventListener("click", () => {
@@ -2360,12 +2530,13 @@
2360
2530
  nextYearBtn.setAttribute("aria-label", el.hasAttribute("data-aria-next-year") ? el.hasAttribute("data-aria-next-year") : "next year");
2361
2531
  nextYearBtn.setAttribute("type", "button");
2362
2532
  nextYearBtn.appendChild(
2363
- createElement(ChevronsRight, {
2364
- class: ["opacity-70 size-4 shrink-0 pointer-events-none"],
2365
- width: "16",
2366
- height: "16",
2367
- "aria-hidden": true,
2368
- role: "presentation"
2533
+ createSvg({
2534
+ icon: ChevronsRight,
2535
+ classes: "opacity-70 size-4 shrink-0 pointer-events-none",
2536
+ attrs: {
2537
+ "aria-hidden": true,
2538
+ role: "presentation"
2539
+ }
2369
2540
  })
2370
2541
  );
2371
2542
  nextYearBtn.addEventListener("click", () => {
@@ -2553,7 +2724,7 @@
2553
2724
  break;
2554
2725
  case "Escape":
2555
2726
  event.preventDefault();
2556
- if (datepicker) datepicker._h_datepicker.expanded = false;
2727
+ if (datepicker) datepicker._h_datepicker.state.expanded = false;
2557
2728
  return;
2558
2729
  case "Enter":
2559
2730
  case " ":
@@ -2617,8 +2788,8 @@
2617
2788
  }
2618
2789
  if (datepicker) {
2619
2790
  effect(() => {
2620
- el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
2621
- if (datepicker._h_datepicker.expanded) {
2791
+ el.setAttribute("data-state", datepicker._h_datepicker.state.expanded ? "open" : "closed");
2792
+ if (datepicker._h_datepicker.state.expanded) {
2622
2793
  autoUpdateCleanup = autoUpdate(datepicker, el, updatePosition);
2623
2794
  Alpine2.nextTick(() => {
2624
2795
  focusDay();
@@ -2694,18 +2865,6 @@
2694
2865
  "[&>input]:size-full",
2695
2866
  "[&>input]:top-0",
2696
2867
  "aspect-square",
2697
- "before:bg-transparent",
2698
- "before:block",
2699
- "before:border-b-2",
2700
- "before:border-l-2",
2701
- "before:border-primary-foreground",
2702
- "before:h-2",
2703
- "before:invisible",
2704
- "before:pointer-events-none",
2705
- "before:-rotate-45",
2706
- "before:translate-x-0.5",
2707
- "before:translate-y-0.75",
2708
- "before:w-3.5",
2709
2868
  "bg-input-inner",
2710
2869
  "border",
2711
2870
  "border-input",
@@ -2714,7 +2873,6 @@
2714
2873
  "duration-200",
2715
2874
  "has-[aria-invalid=true]:border-negative",
2716
2875
  "has-[aria-invalid=true]:ring-negative/20",
2717
- "has-[input:checked]:before:visible",
2718
2876
  "has-[input:checked]:bg-primary",
2719
2877
  "has-[input:checked]:border-primary",
2720
2878
  "has-[input:disabled]:cursor-not-allowed",
@@ -2730,6 +2888,8 @@
2730
2888
  );
2731
2889
  el.setAttribute("tabindex", "-1");
2732
2890
  el.setAttribute("data-slot", "checkbox");
2891
+ const check = createSvg({ icon: Check, classes: "size-full [input:checked~&]:visible invisible fill-primary-foreground", attrs: { "aria-hidden": true, role: "presentation" } });
2892
+ el.appendChild(check);
2733
2893
  });
2734
2894
  }
2735
2895
 
@@ -2805,13 +2965,17 @@
2805
2965
 
2806
2966
  // src/components/datepicker.js
2807
2967
  function datepicker_default(Alpine) {
2808
- Alpine.directive("h-date-picker", (el, { original }, { Alpine: Alpine2, cleanup }) => {
2809
- el._h_datepicker = Alpine2.reactive({
2968
+ Alpine.directive("h-date-picker", (el, { original, modifiers }, { Alpine: Alpine2, cleanup }) => {
2969
+ const state = Alpine2.reactive({
2970
+ expanded: false
2971
+ });
2972
+ el._h_datepicker = {
2810
2973
  id: void 0,
2811
2974
  controls: `hdpc${v4_default()}`,
2812
2975
  input: void 0,
2813
- expanded: false
2814
- });
2976
+ state,
2977
+ inTable: modifiers.includes("table")
2978
+ };
2815
2979
  el._h_datepicker.input = el.querySelector("input");
2816
2980
  if (!el._h_datepicker.input || el._h_datepicker.input.tagName !== "INPUT") {
2817
2981
  throw new Error(`${original} must contain an input`);
@@ -2823,30 +2987,50 @@
2823
2987
  el._h_datepicker.id = id;
2824
2988
  }
2825
2989
  el.classList.add(
2990
+ "overflow-hidden",
2826
2991
  "border-input",
2827
- "bg-input-inner",
2828
2992
  "flex",
2829
- "w-full",
2830
2993
  "items-center",
2831
- "rounded-control",
2832
- "border",
2833
- "shadow-input",
2834
2994
  "transition-[color,box-shadow]",
2835
2995
  "duration-200",
2836
2996
  "outline-none",
2837
2997
  "pl-3",
2838
2998
  "min-w-0",
2839
- "has-[input:focus-visible]:border-ring",
2840
- "has-[input:focus-visible]:ring-ring/50",
2841
- "has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
2842
- "has-[input[aria-invalid=true]]:ring-negative/20",
2843
- "has-[input[aria-invalid=true]]:border-negative",
2844
- "dark:has-[input[aria-invalid=true]]:ring-negative/40",
2845
- "has-[input:invalid]:ring-negative/20",
2846
- "has-[input:invalid]:border-negative",
2847
- "dark:has-[input:invalid]:ring-negative/40"
2999
+ "has-[input:disabled]:pointer-events-none",
3000
+ "has-[input:disabled]:cursor-not-allowed",
3001
+ "has-[input:disabled]:opacity-50"
2848
3002
  );
2849
- el.setAttribute("data-slot", "date-picker");
3003
+ if (el._h_datepicker.inTable) {
3004
+ el.classList.add(
3005
+ "size-full",
3006
+ "h-10",
3007
+ "has-[input:focus-visible]:inset-ring-ring/50",
3008
+ "has-[input:focus-visible]:inset-ring-2",
3009
+ "has-[input[aria-invalid=true]]:inset-ring-negative/20",
3010
+ "dark:has-[input[aria-invalid=true]]:inset-ring-negative/40",
3011
+ "has-[input:invalid]:!inset-ring-negative/20",
3012
+ "dark:has-[input:invalid]:!inset-ring-negative/40"
3013
+ );
3014
+ el.setAttribute("data-slot", "cell-input-date");
3015
+ } else {
3016
+ el.classList.add(
3017
+ "w-full",
3018
+ "rounded-control",
3019
+ "border",
3020
+ "bg-input-inner",
3021
+ "shadow-input",
3022
+ "has-[input:focus-visible]:border-ring",
3023
+ "has-[input:focus-visible]:ring-ring/50",
3024
+ "has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
3025
+ "has-[input[aria-invalid=true]]:ring-negative/20",
3026
+ "has-[input[aria-invalid=true]]:border-negative",
3027
+ "dark:has-[input[aria-invalid=true]]:ring-negative/40",
3028
+ "has-[input:invalid]:ring-negative/20",
3029
+ "has-[input:invalid]:border-negative",
3030
+ "dark:has-[input:invalid]:ring-negative/40"
3031
+ );
3032
+ el.setAttribute("data-slot", "date-picker");
3033
+ }
2850
3034
  el._h_datepicker.input.classList.add(
2851
3035
  "bg-transparent",
2852
3036
  "outline-none",
@@ -2882,54 +3066,55 @@
2882
3066
  if (!datepicker) {
2883
3067
  throw new Error(`${original} must be inside an date-picker element`);
2884
3068
  }
2885
- el.classList.add(
2886
- "cursor-pointer",
2887
- "inline-flex",
2888
- "items-center",
2889
- "justify-center",
2890
- "rounded-r-control",
2891
- "h-full",
2892
- "aspect-square",
2893
- "bg-transparent",
2894
- "hover:bg-secondary",
2895
- "active:bg-secondary-active",
2896
- "outline-none",
2897
- "focus-visible:border-ring",
2898
- "focus-visible:ring-ring/50",
2899
- "focus-visible:ring-[calc(var(--spacing)*0.75)]",
2900
- "[input[aria-invalid=true]~&]:ring-negative/20",
2901
- "[input[aria-invalid=true]~&]:border-negative",
2902
- "dark:[input[aria-invalid=true]~&]:ring-negative/40",
2903
- "[input:invalid~&]:ring-negative/20",
2904
- "[input:invalid~&]:border-negative",
2905
- "dark:[input:invalid~&]:ring-negative/40"
2906
- );
3069
+ el.classList.add("cursor-pointer", "inline-flex", "items-center", "justify-center", "h-full", "aspect-square", "bg-transparent", "hover:bg-secondary", "active:bg-secondary-active", "outline-none");
3070
+ if (datepicker._h_datepicker.inTable) {
3071
+ el.classList.add(
3072
+ "focus-visible:inset-ring-ring/50",
3073
+ "focus-visible:inset-ring-2",
3074
+ "[input[aria-invalid=true]~&]:inset-ring-negative/20",
3075
+ "dark:[input[aria-invalid=true]~&]:inset-ring-negative/40",
3076
+ "[input:invalid~&]:!inset-ring-negative/20",
3077
+ "dark:[input:invalid~&]:!inset-ring-negative/40"
3078
+ );
3079
+ } else {
3080
+ el.classList.add(
3081
+ "focus-visible:border-ring",
3082
+ "focus-visible:ring-ring/50",
3083
+ "focus-visible:ring-[calc(var(--spacing)*0.75)]",
3084
+ "[input[aria-invalid=true]~&]:ring-negative/20",
3085
+ "[input[aria-invalid=true]~&]:border-negative",
3086
+ "dark:[input[aria-invalid=true]~&]:ring-negative/40",
3087
+ "[input:invalid~&]:ring-negative/20",
3088
+ "[input:invalid~&]:border-negative",
3089
+ "dark:[input:invalid~&]:ring-negative/40"
3090
+ );
3091
+ }
2907
3092
  el.setAttribute("aria-controls", datepicker._h_datepicker.controls);
2908
3093
  el.setAttribute("aria-expanded", "false");
2909
3094
  el.setAttribute("aria-haspopup", "dialog");
2910
3095
  el.setAttribute("type", "button");
2911
3096
  el.setAttribute("data-slot", "date-picker-trigger");
2912
3097
  el.appendChild(
2913
- createElement(Calendar, {
2914
- class: ["opacity-70 text-foreground size-4"],
2915
- width: "16",
2916
- height: "16",
2917
- "aria-hidden": true,
2918
- role: "presentation"
3098
+ createSvg({
3099
+ icon: Calendar,
3100
+ classes: "opacity-70 text-foreground size-4",
3101
+ attrs: {
3102
+ "aria-hidden": true,
3103
+ role: "presentation"
3104
+ }
2919
3105
  })
2920
3106
  );
2921
3107
  effect(() => {
2922
- el.setAttribute("data-state", datepicker._h_datepicker.expanded ? "open" : "closed");
2923
- el.setAttribute("aria-expanded", datepicker._h_datepicker.expanded);
3108
+ el.setAttribute("data-state", datepicker._h_datepicker.state.expanded ? "open" : "closed");
3109
+ el.setAttribute("aria-expanded", datepicker._h_datepicker.state.expanded);
2924
3110
  });
2925
3111
  const close = () => {
2926
- datepicker._h_datepicker.expanded = false;
3112
+ datepicker._h_datepicker.state.expanded = false;
2927
3113
  };
2928
3114
  const handler = () => {
2929
- datepicker._h_datepicker.expanded = !datepicker._h_datepicker.expanded;
2930
- el.setAttribute("aria-expanded", datepicker._h_datepicker.expanded);
3115
+ datepicker._h_datepicker.state.expanded = !datepicker._h_datepicker.state.expanded;
2931
3116
  Alpine2.nextTick(() => {
2932
- if (datepicker._h_datepicker.expanded) {
3117
+ if (datepicker._h_datepicker.state.expanded) {
2933
3118
  top.addEventListener("click", close, { once: true });
2934
3119
  } else {
2935
3120
  top.removeEventListener("click", close);
@@ -3016,7 +3201,7 @@
3016
3201
  el.setAttribute("data-slot", "dialog-header");
3017
3202
  });
3018
3203
  Alpine.directive("h-dialog-title", (el, _, { Alpine: Alpine2 }) => {
3019
- el.classList.add("text-lg", "leading-none", "font-semibold");
3204
+ el.classList.add("order-1", "text-lg", "leading-none", "font-semibold");
3020
3205
  el.setAttribute("data-slot", "dialog-title");
3021
3206
  const dialog = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "dialog");
3022
3207
  if (dialog && (!dialog.hasAttribute("aria-labelledby") || !dialog.hasAttribute("aria-label"))) {
@@ -3029,6 +3214,7 @@
3029
3214
  });
3030
3215
  Alpine.directive("h-dialog-close", (el) => {
3031
3216
  el.classList.add(
3217
+ "order-2",
3032
3218
  "ring-offset-background",
3033
3219
  "focus:ring-ring",
3034
3220
  "rounded-xs",
@@ -3044,9 +3230,10 @@
3044
3230
  "[&_svg:not([class*='size-'])]:size-4"
3045
3231
  );
3046
3232
  el.setAttribute("data-slot", "dialog-close");
3233
+ el.setAttribute("type", "button");
3047
3234
  });
3048
3235
  Alpine.directive("h-dialog-description", (el, _, { Alpine: Alpine2 }) => {
3049
- el.classList.add("col-span-full", "text-muted-foreground", "text-sm");
3236
+ el.classList.add("order-3", "col-span-full", "text-muted-foreground", "text-sm");
3050
3237
  el.setAttribute("data-slot", "dialog-description");
3051
3238
  const dialog = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "dialog");
3052
3239
  if (dialog && (!dialog.hasAttribute("aria-describedby") || !dialog.hasAttribute("aria-description"))) {
@@ -3157,7 +3344,7 @@
3157
3344
 
3158
3345
  // src/components/icon.js
3159
3346
  function icon_default(Alpine) {
3160
- Alpine.directive("h-icon", (el, { original }) => {
3347
+ Alpine.directive("h-icon", (el, { original, modifiers }) => {
3161
3348
  if (el.tagName.toLowerCase() !== "svg") {
3162
3349
  throw new Error(`${original} works only on svg elements`);
3163
3350
  } else if (!el.hasAttribute("role")) {
@@ -3181,6 +3368,8 @@
3181
3368
  }).catch((response) => {
3182
3369
  console.error(response);
3183
3370
  });
3371
+ } else if (modifiers[0]) {
3372
+ setSvgContent(el, modifiers[0]);
3184
3373
  }
3185
3374
  });
3186
3375
  }
@@ -3257,6 +3446,18 @@
3257
3446
  if (modifiers.includes("group")) {
3258
3447
  el.classList.add("h-full", "flex-1", "rounded-none", "border-0", "bg-transparent", "shadow-none", "focus-visible:ring-0");
3259
3448
  el.setAttribute("data-slot", "input-group-control");
3449
+ } else if (modifiers.includes("table")) {
3450
+ el.classList.add(
3451
+ "size-full",
3452
+ "h-10",
3453
+ "focus-visible:inset-ring-ring/50",
3454
+ "focus-visible:inset-ring-2",
3455
+ "aria-invalid:inset-ring-negative/20",
3456
+ "dark:aria-invalid:inset-ring-negative/40",
3457
+ "invalid:!inset-ring-negative/20",
3458
+ "dark:invalid:!inset-ring-negative/40"
3459
+ );
3460
+ el.setAttribute("data-slot", "cell-input");
3260
3461
  } else {
3261
3462
  el.classList.add("w-full", "rounded-control", "border", "bg-input-inner", "shadow-input", "focus-visible:ring-[calc(var(--spacing)*0.75)]");
3262
3463
  el.setAttribute("data-slot", "input");
@@ -3368,6 +3569,7 @@
3368
3569
  });
3369
3570
  Alpine.directive("h-input-number", (el, { original }, { cleanup }) => {
3370
3571
  el.classList.add(
3572
+ "overflow-hidden",
3371
3573
  "group/input-number",
3372
3574
  "border-input",
3373
3575
  "bg-input-inner",
@@ -3381,12 +3583,18 @@
3381
3583
  "transition-[color,box-shadow]",
3382
3584
  "outline-none",
3383
3585
  "min-w-0",
3384
- "has-[[data-slot=input-number-control]:focus-visible]:border-ring",
3385
- "has-[[data-slot=input-number-control]:focus-visible]:ring-ring/50",
3386
- "has-[[data-slot=input-number-control]:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
3387
- "has-[[data-slot][aria-invalid=true]]:ring-negative/20",
3388
- "has-[[data-slot][aria-invalid=true]]:border-negative",
3389
- "dark:has-[[data-slot][aria-invalid=true]]:ring-negative/40"
3586
+ "has-[input:focus-visible]:border-ring",
3587
+ "has-[input:focus-visible]:ring-ring/50",
3588
+ "has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
3589
+ "has-[input[aria-invalid=true]]:ring-negative/20",
3590
+ "has-[input[aria-invalid=true]]:border-negative",
3591
+ "dark:has-[input[aria-invalid=true]]:ring-negative/40",
3592
+ "has-[input:invalid]:ring-negative/20",
3593
+ "has-[input:invalid]:border-negative",
3594
+ "dark:has-[input:invalid]:ring-negative/40",
3595
+ "has-[input:disabled]:pointer-events-none",
3596
+ "has-[input:disabled]:cursor-not-allowed",
3597
+ "has-[input:disabled]:opacity-50"
3390
3598
  );
3391
3599
  el.setAttribute("role", "group");
3392
3600
  el.setAttribute("data-slot", "input-number");
@@ -3407,14 +3615,27 @@
3407
3615
  input.setAttribute("autocorrect", "off");
3408
3616
  input.setAttribute("spellcheck", "off");
3409
3617
  input.setAttribute("data-slot", "input-number-control");
3410
- input.classList.add("rounded-l-control", "size-full", "px-3", "py-1", "outline-none");
3618
+ input.classList.add("size-full", "px-3", "py-1", "outline-none");
3411
3619
  const stepDown = document.createElement("button");
3412
3620
  stepDown.setAttribute("type", "button");
3413
3621
  stepDown.setAttribute("tabIndex", "-1");
3414
3622
  stepDown.setAttribute("aria-label", "Decrease");
3415
3623
  stepDown.setAttribute("aria-controls", input.getAttribute("id"));
3416
3624
  stepDown.setAttribute("data-slot", "step-up-trigger");
3625
+ stepDown.appendChild(
3626
+ createSvg({
3627
+ icon: Minus,
3628
+ classes: "opacity-70 fill-foreground size-4 shrink-0 pointer-events-none",
3629
+ attrs: {
3630
+ "aria-hidden": true,
3631
+ role: "presentation"
3632
+ }
3633
+ })
3634
+ );
3417
3635
  stepDown.classList.add(
3636
+ "inline-flex",
3637
+ "items-center",
3638
+ "justify-center",
3418
3639
  "cursor-pointer",
3419
3640
  "border-l",
3420
3641
  "border-input",
@@ -3427,15 +3648,7 @@
3427
3648
  "active:bg-secondary-active",
3428
3649
  "outline-none",
3429
3650
  "relative",
3430
- "before:block",
3431
- "before:opacity-70",
3432
- "before:rounded-full",
3433
- "before:h-0.5",
3434
- "before:min-h-px",
3435
- "before:w-3",
3436
- "before:mx-auto",
3437
- "before:bg-foreground",
3438
- "before:hover:bg-secondary-foreground"
3651
+ "[&:hover>svg]:text-secondary-foreground"
3439
3652
  );
3440
3653
  el.appendChild(stepDown);
3441
3654
  const onStepDown = () => {
@@ -3450,13 +3663,25 @@
3450
3663
  stepUp.setAttribute("aria-label", "Increase");
3451
3664
  stepUp.setAttribute("aria-controls", input.getAttribute("id"));
3452
3665
  stepUp.setAttribute("data-slot", "step-up-trigger");
3666
+ stepUp.appendChild(
3667
+ createSvg({
3668
+ icon: Plus,
3669
+ classes: "opacity-70 fill-foreground size-4 shrink-0 pointer-events-none",
3670
+ attrs: {
3671
+ "aria-hidden": true,
3672
+ role: "presentation"
3673
+ }
3674
+ })
3675
+ );
3453
3676
  stepUp.classList.add(
3677
+ "inline-flex",
3678
+ "items-center",
3679
+ "justify-center",
3454
3680
  "cursor-pointer",
3455
3681
  "border-l",
3456
3682
  "border-input",
3457
3683
  "[input[aria-invalid=true]~&]:border-negative",
3458
3684
  "[input:invalid~&]:border-negative",
3459
- "rounded-r-control",
3460
3685
  "h-full",
3461
3686
  "aspect-square",
3462
3687
  "bg-transparent",
@@ -3464,32 +3689,7 @@
3464
3689
  "active:bg-secondary-active",
3465
3690
  "outline-none",
3466
3691
  "relative",
3467
- "before:block",
3468
- "before:opacity-70",
3469
- "before:absolute",
3470
- "before:rounded-full",
3471
- "before:h-0.5",
3472
- "before:min-h-px",
3473
- "before:w-3",
3474
- "before:top-1/2",
3475
- "before:left-1/2",
3476
- "before:-translate-x-1/2",
3477
- "before:-translate-y-1/2",
3478
- "before:bg-foreground",
3479
- "before:hover:bg-secondary-foreground",
3480
- "after:block",
3481
- "after:opacity-70",
3482
- "after:absolute",
3483
- "after:rounded-full",
3484
- "after:h-3",
3485
- "after:min-w-px",
3486
- "after:w-0.5",
3487
- "after:top-1/2",
3488
- "after:left-1/2",
3489
- "after:-translate-x-1/2",
3490
- "after:-translate-y-1/2",
3491
- "after:bg-foreground",
3492
- "after:hover:bg-secondary-foreground"
3692
+ "[&:hover>svg]:text-secondary-foreground"
3493
3693
  );
3494
3694
  el.appendChild(stepUp);
3495
3695
  const onStepUp = () => {
@@ -3697,10 +3897,17 @@
3697
3897
  function menu_default(Alpine) {
3698
3898
  Alpine.directive("h-menu-trigger", (el, { modifiers }) => {
3699
3899
  el._menu_trigger = {
3700
- isDropdown: modifiers.includes("dropdown")
3900
+ isDropdown: modifiers.includes("dropdown"),
3901
+ setOpen(open) {
3902
+ el.setAttribute("data-state", open ? "open" : "closed");
3903
+ }
3701
3904
  };
3905
+ el.setAttribute("data-state", "closed");
3702
3906
  });
3703
3907
  Alpine.directive("h-menu", (el, { original, modifiers }, { cleanup, Alpine: Alpine2 }) => {
3908
+ if (el.tagName !== "UL") {
3909
+ throw new Error(`${original} must be an ul element`);
3910
+ }
3704
3911
  el.classList.add("hidden", "fixed", "bg-popover", "text-popover-foreground", "font-normal", "z-50", "min-w-[8rem]", "overflow-x-hidden", "overflow-y-auto", "rounded-md", "p-1", "shadow-md", "border", "outline-none");
3705
3912
  el.setAttribute("role", "menu");
3706
3913
  el.setAttribute("aria-orientation", "vertical");
@@ -3749,6 +3956,9 @@
3749
3956
  } else {
3750
3957
  listenForTrigger(true);
3751
3958
  if (focusTrigger) menuTrigger.focus();
3959
+ if (menuTrigger._menu_trigger.isDropdown) {
3960
+ menuTrigger._menu_trigger.setOpen(false);
3961
+ }
3752
3962
  }
3753
3963
  }
3754
3964
  el._menu = { close };
@@ -3899,6 +4109,9 @@
3899
4109
  }
3900
4110
  }
3901
4111
  function openDropdown() {
4112
+ if (menuTrigger._menu_trigger.isDropdown) {
4113
+ menuTrigger._menu_trigger.setOpen(true);
4114
+ }
3902
4115
  open(menuTrigger);
3903
4116
  }
3904
4117
  function onContextmenu(event) {
@@ -3932,7 +4145,10 @@
3932
4145
  el.removeEventListener("keydown", onKeyDown);
3933
4146
  });
3934
4147
  });
3935
- Alpine.directive("h-menu-item", (el, _, { cleanup, Alpine: Alpine2 }) => {
4148
+ Alpine.directive("h-menu-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
4149
+ if (el.tagName !== "LI") {
4150
+ throw new Error(`${original} must be a li element`);
4151
+ }
3936
4152
  el.classList.add(
3937
4153
  "focus:bg-secondary-hover",
3938
4154
  "focus:text-secondary-foreground",
@@ -4007,25 +4223,15 @@
4007
4223
  "data-[inset=true]:pl-8",
4008
4224
  "[&_svg]:pointer-events-none",
4009
4225
  "[&_svg]:shrink-0",
4010
- "[&_svg:not([class*='size-'])]:size-4",
4011
- "after:block",
4012
- "after:bg-transparent",
4013
- "after:border-t-[calc(var(--spacing)*0.25)]",
4014
- "after:border-r-[calc(var(--spacing)*0.25)]",
4015
- "after:border-muted-foreground",
4016
- "after:pointer-events-none",
4017
- "after:min-w-1.75",
4018
- "after:size-1.75",
4019
- "after:rounded-[calc(var(--spacing)*0.25)]",
4020
- "after:rotate-45",
4021
- "after:ml-auto",
4022
- "after:-translate-x-0.75"
4226
+ "[&_svg:not([class*='size-'])]:size-4"
4023
4227
  );
4024
4228
  el.setAttribute("role", "menuitem");
4025
4229
  el.setAttribute("aria-haspopup", "true");
4026
4230
  el.setAttribute("aria-expanded", "false");
4027
4231
  el.setAttribute("tabindex", "-1");
4028
4232
  el.setAttribute("data-slot", "menu-sub");
4233
+ const chevronRight = createSvg({ icon: ChevronRight, classes: "size-4 ml-auto", attrs: { "aria-hidden": true, role: "presentation" } });
4234
+ el.appendChild(chevronRight);
4029
4235
  const parentMenu = Alpine2.findClosest(el.parentElement, (parent) => parent.getAttribute("role") === "menu");
4030
4236
  if (!parentMenu) throw new Error(`${original} must have a parent`);
4031
4237
  el._menu_sub = {
@@ -4121,7 +4327,10 @@
4121
4327
  el.classList.add("text-foreground", "px-2", "py-1.5", "text-sm", "font-semibold", "text-left", "data-[inset=true]:pl-8");
4122
4328
  el.setAttribute("data-slot", "menu-label");
4123
4329
  });
4124
- Alpine.directive("h-menu-checkbox-item", (el, _, { cleanup, Alpine: Alpine2 }) => {
4330
+ Alpine.directive("h-menu-checkbox-item", (el, { original }, { cleanup, Alpine: Alpine2 }) => {
4331
+ if (el.tagName !== "LI" && el.tagName !== "DIV") {
4332
+ throw new Error(`${original} must be a li or div element`);
4333
+ }
4125
4334
  el.classList.add(
4126
4335
  "focus:bg-secondary-hover",
4127
4336
  "hover:bg-secondary-hover",
@@ -4131,8 +4340,7 @@
4131
4340
  "items-center",
4132
4341
  "gap-2",
4133
4342
  "rounded-sm",
4134
- "pr-2",
4135
- "pl-3.5",
4343
+ "px-2",
4136
4344
  "py-1.5",
4137
4345
  "text-sm",
4138
4346
  "outline-hidden",
@@ -4142,21 +4350,13 @@
4142
4350
  "aria-[disabled=true]:opacity-50",
4143
4351
  "transition-all",
4144
4352
  "overflow-hidden",
4145
- "before:invisible",
4146
- "before:bg-transparent",
4147
- "before:border-l-2",
4148
- "before:border-b-2",
4149
- "before:border-foreground",
4150
- "before:pointer-events-none",
4151
- "before:w-2.5",
4152
- "before:h-1.5",
4153
- "before:-rotate-45",
4154
- "before:-translate-x-0.75",
4155
- "aria-[checked=true]:before:visible"
4353
+ "aria-[checked=true]:[&>svg]:visible"
4156
4354
  );
4157
4355
  el.setAttribute("tabindex", "-1");
4158
4356
  el.setAttribute("role", "menuitemcheckbox");
4159
4357
  el.setAttribute("data-slot", "menu-checkbox-item");
4358
+ const check = createSvg({ icon: Check, classes: "size-4 invisible", attrs: { "aria-hidden": true, role: "presentation" } });
4359
+ el.prepend(check);
4160
4360
  function setState(checked, dispatch = true) {
4161
4361
  if (dispatch)
4162
4362
  Alpine2.nextTick(() => {
@@ -4195,7 +4395,10 @@
4195
4395
  el.removeEventListener("mouseleave", focusOut);
4196
4396
  });
4197
4397
  });
4198
- Alpine.directive("h-menu-radio-item", (el, { expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
4398
+ Alpine.directive("h-menu-radio-item", (el, { original, expression }, { effect, evaluateLater, cleanup, Alpine: Alpine2 }) => {
4399
+ if (el.tagName !== "LI" && el.tagName !== "DIV") {
4400
+ throw new Error(`${original} must be a li or div element`);
4401
+ }
4199
4402
  el.classList.add(
4200
4403
  "focus:bg-secondary-hover",
4201
4404
  "hover:bg-secondary-hover",
@@ -4348,28 +4551,15 @@
4348
4551
  });
4349
4552
  Alpine.directive("h-pagination-ellipsis", (el) => {
4350
4553
  el.classList.add("flex", "size-9", "items-center", "justify-center");
4351
- const svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
4352
- svg.setAttributeNS(null, "width", "16");
4353
- svg.setAttributeNS(null, "height", "16");
4354
- svg.setAttributeNS(null, "viewBox", "0 0 16 16");
4355
- svg.setAttributeNS(null, "fill", "currentColor");
4356
- svg.setAttributeNS(null, "class", "size-4");
4357
- const circle1 = document.createElementNS("http://www.w3.org/2000/svg", "circle");
4358
- circle1.setAttributeNS(null, "cx", "2");
4359
- circle1.setAttributeNS(null, "cy", "8");
4360
- circle1.setAttributeNS(null, "r", "1.5");
4361
- svg.appendChild(circle1);
4362
- const circle2 = document.createElementNS("http://www.w3.org/2000/svg", "circle");
4363
- circle2.setAttributeNS(null, "cx", "8");
4364
- circle2.setAttributeNS(null, "cy", "8");
4365
- circle2.setAttributeNS(null, "r", "1.5");
4366
- svg.appendChild(circle2);
4367
- const circle3 = document.createElementNS("http://www.w3.org/2000/svg", "circle");
4368
- circle3.setAttributeNS(null, "cx", "14");
4369
- circle3.setAttributeNS(null, "cy", "8");
4370
- circle3.setAttributeNS(null, "r", "1.5");
4371
- svg.appendChild(circle3);
4372
- el.appendChild(svg);
4554
+ el.appendChild(
4555
+ createSvg({
4556
+ icon: Ellipsis,
4557
+ attrs: {
4558
+ "aria-hidden": true,
4559
+ role: "presentation"
4560
+ }
4561
+ })
4562
+ );
4373
4563
  el.setAttribute("data-slot", "pagination-ellipsis");
4374
4564
  });
4375
4565
  }
@@ -6456,7 +6646,7 @@
6456
6646
  none: 3
6457
6647
  });
6458
6648
  function select_default(Alpine) {
6459
- Alpine.directive("h-select", (el, _, { Alpine: Alpine2, cleanup }) => {
6649
+ Alpine.directive("h-select", (el, { modifiers }, { Alpine: Alpine2, cleanup }) => {
6460
6650
  el._h_select = Alpine2.reactive({
6461
6651
  id: void 0,
6462
6652
  controls: `hsc${v4_default()}`,
@@ -6473,38 +6663,37 @@
6473
6663
  set: void 0,
6474
6664
  get: void 0
6475
6665
  };
6476
- el.classList.add(
6477
- "cursor-pointer",
6478
- "border-input",
6479
- "has-focus-visible:border-ring",
6480
- "has-focus-visible:ring-[calc(var(--spacing)*0.75)]",
6481
- "has-focus-visible:ring-ring/50",
6482
- "dark:has-[aria-invalid=true]:ring-negative/40",
6483
- "dark:has-[input:invalid]:ring-negative/40",
6484
- "has-[aria-invalid=true]:border-negative",
6485
- "has-[aria-invalid=true]:ring-negative/20",
6486
- "has-[input:invalid]:border-negative",
6487
- "has-[input:invalid]:ring-negative/20",
6488
- "hover:bg-secondary-hover",
6489
- "active:bg-secondary-active",
6490
- "w-full",
6491
- "rounded-control",
6492
- "border",
6493
- "bg-input-inner",
6494
- "text-sm",
6495
- "whitespace-nowrap",
6496
- "shadow-input",
6497
- "transition-[color,box-shadow]",
6498
- "duration-200",
6499
- "outline-none",
6500
- "has-[input:disabled]:pointer-events-none",
6501
- "has-[input:disabled]:opacity-50"
6502
- );
6503
- el.setAttribute("data-slot", "select");
6504
- const observer = sizeObserver(el);
6505
- cleanup(() => {
6506
- observer.disconnect();
6507
- });
6666
+ el.classList.add("cursor-pointer", "outline-none", "transition-[color,box-shadow]", "duration-200", "w-full", "has-[input:disabled]:pointer-events-none", "has-[input:disabled]:opacity-50");
6667
+ if (modifiers.includes("table")) {
6668
+ el.classList.add("h-10", "flex", "focus-visible:inset-ring-ring/50", "focus-visible:inset-ring-2", "hover:bg-table-hover", "hover:text-table-hover-foreground", "active:!bg-table-active", "active:!text-table-active-foreground");
6669
+ el.setAttribute("data-slot", "cell-input-select");
6670
+ } else {
6671
+ el.classList.add(
6672
+ "border-input",
6673
+ "has-focus-visible:border-ring",
6674
+ "has-focus-visible:ring-[calc(var(--spacing)*0.75)]",
6675
+ "has-focus-visible:ring-ring/50",
6676
+ "dark:has-[aria-invalid=true]:ring-negative/40",
6677
+ "dark:has-[input:invalid]:ring-negative/40",
6678
+ "has-[aria-invalid=true]:border-negative",
6679
+ "has-[aria-invalid=true]:ring-negative/20",
6680
+ "has-[input:invalid]:border-negative",
6681
+ "has-[input:invalid]:ring-negative/20",
6682
+ "hover:bg-secondary-hover",
6683
+ "active:bg-secondary-active",
6684
+ "rounded-control",
6685
+ "border",
6686
+ "bg-input-inner",
6687
+ "text-sm",
6688
+ "whitespace-nowrap",
6689
+ "shadow-input"
6690
+ );
6691
+ el.setAttribute("data-slot", "select");
6692
+ const observer = sizeObserver(el);
6693
+ cleanup(() => {
6694
+ observer.disconnect();
6695
+ });
6696
+ }
6508
6697
  });
6509
6698
  Alpine.directive("h-select-input", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
6510
6699
  if (el.tagName !== "INPUT") {
@@ -6735,12 +6924,13 @@
6735
6924
  };
6736
6925
  fakeTrigger.addEventListener("keydown", onPress);
6737
6926
  fakeTrigger.addEventListener("click", onClick2);
6738
- const chevronDown = createElement(ChevronDown, {
6739
- class: ["opacity-70 text-foreground size-4 shrink-0 pointer-events-none transition-transform duration-200"],
6740
- width: "16",
6741
- height: "16",
6742
- "aria-hidden": true,
6743
- role: "presentation"
6927
+ const chevronDown = createSvg({
6928
+ icon: ChevronDown,
6929
+ classes: "opacity-70 text-foreground size-4 shrink-0 pointer-events-none transition-transform duration-200",
6930
+ attrs: {
6931
+ "aria-hidden": true,
6932
+ role: "presentation"
6933
+ }
6744
6934
  });
6745
6935
  el.parentElement.appendChild(fakeTrigger);
6746
6936
  fakeTrigger.appendChild(chevronDown);
@@ -6836,7 +7026,7 @@
6836
7026
  el.setAttribute("autocomplete", "off");
6837
7027
  el.setAttribute("autocorrect", "off");
6838
7028
  el.setAttribute("spellcheck", "false");
6839
- const searchIcon = createElement(Search, { class: ["size-4 shrink-0 opacity-50"], width: "16", height: "16", "aria-hidden": true, role: "presentation" });
7029
+ const searchIcon = createSvg({ icon: Search, classes: "size-4 shrink-0 opacity-50", attrs: { "aria-hidden": true, role: "presentation" } });
6840
7030
  const searchInput = document.createElement("input");
6841
7031
  searchInput.setAttribute("type", "text");
6842
7032
  searchInput.setAttribute("data-slot", "select-input");
@@ -6940,7 +7130,7 @@
6940
7130
  labelEl.setAttribute("id", id);
6941
7131
  indicatorEl.classList.add("absolute", "right-2", "flex", "size-3.5", "items-center", "justify-center", "invisible");
6942
7132
  indicatorEl.setAttribute("aria-hidden", "true");
6943
- const check = createElement(Check, { class: ["size-4"], width: "16", height: "16", "aria-hidden": true, role: "presentation" });
7133
+ const check = createSvg({ icon: Check, attrs: { "aria-hidden": true, role: "presentation" } });
6944
7134
  indicatorEl.appendChild(check);
6945
7135
  el.appendChild(indicatorEl);
6946
7136
  el.appendChild(labelEl);
@@ -7331,7 +7521,7 @@
7331
7521
  el.setAttribute("role", "none");
7332
7522
  });
7333
7523
  Alpine.directive("h-sidebar-menu-sub", (el, { modifiers }) => {
7334
- el.classList.add("vbox", "min-w-0", "translate-x-px", "gap-1", "py-0.5", "group-data-[collapsed=true]/sidebar:hidden");
7524
+ el.classList.add("vbox", "min-w-0", "translate-x-px", "gap-1", "py-0.5", "group-data-[collapsed=true]/sidebar:!hidden");
7335
7525
  if (!modifiers.includes("flat")) {
7336
7526
  el.classList.add("border-sidebar-border", "mx-3.5", "border-l", "px-2.5");
7337
7527
  }
@@ -7447,17 +7637,212 @@
7447
7637
 
7448
7638
  // src/components/split.js
7449
7639
  function split_default(Alpine) {
7450
- Alpine.directive("h-split", (el) => {
7451
- el.classList.add("flex", "data-[orientation=horizontal]:flex-row", "data-[orientation=vertical]:flex-col");
7452
- el.setAttribute("tabindex", "-1");
7453
- el.setAttribute("data-slot", "split");
7640
+ Alpine.directive("h-split", (el, {}, { cleanup, Alpine: Alpine2 }) => {
7641
+ const panels = [];
7642
+ const state = Alpine2.reactive({
7643
+ isHorizontal: el.getAttribute("data-orientation") === "horizontal",
7644
+ isBorder: el.getAttribute("data-variant") === "border"
7645
+ });
7646
+ const storageKey = el.getAttribute("data-key");
7647
+ const loadSizes = () => {
7648
+ if (!storageKey) return null;
7649
+ try {
7650
+ const raw = localStorage.getItem(storageKey);
7651
+ if (!raw) return null;
7652
+ return JSON.parse(raw);
7653
+ } catch {
7654
+ return null;
7655
+ }
7656
+ };
7657
+ let saveTimer = null;
7658
+ const SAVE_DELAY = 200;
7659
+ const saveSizes = () => {
7660
+ if (!storageKey) return;
7661
+ if (saveTimer) clearTimeout(saveTimer);
7662
+ saveTimer = setTimeout(() => {
7663
+ const visible = panels.filter((p) => !p.hidden);
7664
+ const sizes = visible.map((p) => p.size / usableSize());
7665
+ localStorage.setItem(storageKey, JSON.stringify(sizes));
7666
+ saveTimer = null;
7667
+ }, SAVE_DELAY);
7668
+ };
7669
+ const sizeProp = () => state.isHorizontal ? "width" : "height";
7670
+ const containerSize = () => state.isHorizontal ? el.getBoundingClientRect().width : el.getBoundingClientRect().height;
7671
+ const gutterSize = () => {
7672
+ const panel = panels.find((p) => p.gutter.parentElement);
7673
+ if (panel) {
7674
+ return panel.gutter.getBoundingClientRect()[sizeProp()] ?? 0;
7675
+ }
7676
+ return 0;
7677
+ };
7678
+ const usableSize = () => {
7679
+ const visiblePanels = panels.filter((p) => !p.hidden);
7680
+ const gutters = Math.max(0, visiblePanels.length - 1);
7681
+ return containerSize() - gutters * gutterSize();
7682
+ };
7683
+ const normalize = (value) => {
7684
+ if (value == null) return null;
7685
+ if (typeof value === "number") return value;
7686
+ if (value.endsWith("%")) {
7687
+ return parseFloat(value) / 100 * usableSize();
7688
+ }
7689
+ return parseFloat(value);
7690
+ };
7691
+ let initialized = false;
7692
+ const DELTA_ABS = 0.01;
7693
+ const layout = () => {
7694
+ const visible = panels.filter((p) => !p.hidden);
7695
+ if (!visible.length) return;
7696
+ const total = usableSize();
7697
+ if (!initialized) {
7698
+ initialized = true;
7699
+ const visible2 = panels.filter((p) => !p.hidden);
7700
+ const stored = loadSizes();
7701
+ if (stored && stored.length === visible2.length) {
7702
+ visible2.forEach((p, i) => {
7703
+ p.size = stored[i] * usableSize();
7704
+ p.explicit = true;
7705
+ });
7706
+ } else {
7707
+ const explicitTotal = visible2.filter((p) => p.explicit).reduce((sum, p) => sum + p.declaredSize, 0);
7708
+ const autoPanels = visible2.filter((p) => !p.explicit);
7709
+ const remaining = total - explicitTotal;
7710
+ const share = autoPanels.length ? remaining / autoPanels.length : 0;
7711
+ visible2.forEach((p) => {
7712
+ if (p.explicit) {
7713
+ p.size = p.declaredSize;
7714
+ } else {
7715
+ p.size = share;
7716
+ }
7717
+ p.size = Math.min(Math.max(p.size ?? share, p.min), p.max);
7718
+ });
7719
+ }
7720
+ }
7721
+ visible.forEach((p) => {
7722
+ if (p.size == null) {
7723
+ p.size = p.min ?? 0;
7724
+ }
7725
+ p.size = Math.min(Math.max(p.size, p.min), p.max);
7726
+ });
7727
+ let currentTotal = visible.reduce((sum, p) => sum + p.size, 0);
7728
+ let delta = total - currentTotal;
7729
+ if (Math.abs(delta) < DELTA_ABS) {
7730
+ visible.forEach((p) => p.apply());
7731
+ return;
7732
+ }
7733
+ let flexible = visible.filter((p) => {
7734
+ if (p.collapsed) return false;
7735
+ if (delta > 0) {
7736
+ return p.size < p.max;
7737
+ } else {
7738
+ return p.size > p.min;
7739
+ }
7740
+ });
7741
+ while (flexible.length && Math.abs(delta) > DELTA_ABS) {
7742
+ const share = delta / flexible.length;
7743
+ let consumed = 0;
7744
+ const nextFlexible = [];
7745
+ flexible.forEach((p) => {
7746
+ const proposed = p.size + share;
7747
+ const clamped = Math.min(Math.max(proposed, p.min), p.max);
7748
+ const actualChange = clamped - p.size;
7749
+ if (Math.abs(actualChange) > DELTA_ABS) {
7750
+ p.size = clamped;
7751
+ consumed += actualChange;
7752
+ }
7753
+ if (delta > 0) {
7754
+ if (p.size < p.max) nextFlexible.push(p);
7755
+ } else {
7756
+ if (p.size > p.min) nextFlexible.push(p);
7757
+ }
7758
+ });
7759
+ delta -= consumed;
7760
+ flexible = nextFlexible;
7761
+ if (Math.abs(consumed) < DELTA_ABS) break;
7762
+ }
7763
+ visible.forEach((p) => p.apply());
7764
+ };
7765
+ let layoutFrame = null;
7766
+ const queueLayout = () => {
7767
+ if (layoutFrame) cancelAnimationFrame(layoutFrame);
7768
+ layoutFrame = requestAnimationFrame(() => {
7769
+ layout();
7770
+ saveSizes();
7771
+ layoutFrame = null;
7772
+ });
7773
+ };
7774
+ const refreshGutters = () => {
7775
+ panels.forEach((p, i) => p.setGutter(i === panels.length - 1));
7776
+ };
7777
+ el._h_split = {
7778
+ state,
7779
+ panels,
7780
+ addPanel(panel) {
7781
+ panels.push(panel);
7782
+ if (panel.size == null) {
7783
+ panel.size = null;
7784
+ }
7785
+ initialized = false;
7786
+ refreshGutters();
7787
+ queueLayout();
7788
+ },
7789
+ removePanel(panel) {
7790
+ const i = panels.indexOf(panel);
7791
+ if (i !== -1) panels.splice(i, 1);
7792
+ initialized = false;
7793
+ refreshGutters();
7794
+ queueLayout();
7795
+ },
7796
+ panelHidden() {
7797
+ initialized = false;
7798
+ refreshGutters();
7799
+ queueLayout();
7800
+ },
7801
+ panelChange() {
7802
+ queueLayout();
7803
+ },
7804
+ normalize,
7805
+ saveSizes
7806
+ };
7807
+ el.classList.add("flex", "flex-1", "min-w-0", "min-h-0", "data-[orientation=horizontal]:flex-row", "data-[orientation=vertical]:flex-col");
7808
+ const observer = new MutationObserver((mutations) => {
7809
+ mutations.forEach((mutation) => {
7810
+ if (mutation.attributeName === "data-orientation") {
7811
+ state.isHorizontal = el.getAttribute("data-orientation") === "horizontal";
7812
+ queueLayout();
7813
+ } else if (mutation.attributeName === "data-variant") {
7814
+ state.isBorder = el.getAttribute("data-variant") === "border";
7815
+ queueLayout();
7816
+ } else {
7817
+ panels.forEach((p) => p.setLocked(el.getAttribute("data-locked") === "true"));
7818
+ }
7819
+ });
7820
+ });
7821
+ observer.observe(el, { attributes: true, attributeFilter: ["data-orientation", "data-variant", "data-locked"] });
7822
+ const containerObserver = new ResizeObserver(queueLayout);
7823
+ containerObserver.observe(el);
7824
+ cleanup(() => {
7825
+ if (layoutFrame) cancelAnimationFrame(layoutFrame);
7826
+ if (saveTimer) clearTimeout(saveTimer);
7827
+ containerObserver.disconnect();
7828
+ observer.disconnect();
7829
+ });
7454
7830
  });
7455
- Alpine.directive("h-split-panel", (el) => {
7831
+ Alpine.directive("h-split-panel", (el, { original }, { effect, cleanup, Alpine: Alpine2 }) => {
7832
+ const split = Alpine2.findClosest(el.parentElement, (parent) => parent.hasOwnProperty("_h_split"));
7833
+ if (!split) {
7834
+ throw new Error(`${original} must be inside an split element`);
7835
+ }
7836
+ el.classList.add("flex", "shrink", "grow-0", "box-border", "min-w-0", "min-h-0", "overflow-visible");
7456
7837
  el.setAttribute("tabindex", "-1");
7457
7838
  el.setAttribute("data-slot", "split-panel");
7458
- });
7459
- Alpine.directive("h-split-gutter", (el, _, { cleanup }) => {
7460
- el.classList.add(
7839
+ const gutter = document.createElement("span");
7840
+ gutter.setAttribute("data-slot", "split-gutter");
7841
+ gutter.setAttribute("aria-disabled", el.getAttribute("data-locked") === "true");
7842
+ gutter.setAttribute("tabindex", "-1");
7843
+ gutter.setAttribute("role", "separator");
7844
+ gutter.classList.add(
7845
+ "overflow-visible",
7461
7846
  "relative",
7462
7847
  "shrink-0",
7463
7848
  "touch-none",
@@ -7465,15 +7850,8 @@
7465
7850
  "outline-none",
7466
7851
  "hover:bg-primary-hover",
7467
7852
  "active:bg-primary-active",
7468
- "before:absolute",
7469
- "before:top-1/2",
7470
- "before:left-1/2",
7471
- "before:-translate-x-1/2",
7472
- "before:-translate-y-1/2",
7473
- "before:block",
7474
- "before:bg-transparent",
7475
7853
  "hover:before:bg-primary-hover",
7476
- "[[data-locked=true]>&]:pointer-events-none",
7854
+ "aria-disabled:pointer-events-none",
7477
7855
  "[[data-orientation=horizontal]>&]:cursor-col-resize",
7478
7856
  "[[data-orientation=vertical]>&]:cursor-row-resize"
7479
7857
  );
@@ -7483,19 +7861,23 @@
7483
7861
  "hover:bg-primary-hover",
7484
7862
  "active:bg-primary-active",
7485
7863
  "before:absolute",
7486
- "before:top-1/2",
7487
- "before:left-1/2",
7488
- "before:-translate-x-1/2",
7489
- "before:-translate-y-1/2",
7490
7864
  "before:block",
7491
7865
  "before:bg-transparent",
7492
7866
  "hover:before:bg-primary-hover",
7867
+ "[[data-orientation=horizontal]>&]:before:-translate-x-1/2",
7868
+ "[[data-orientation=horizontal]>&[data-edge=end]]:before:-translate-x-1",
7869
+ "[[data-orientation=horizontal]>&[data-edge=start]]:before:translate-x-0",
7870
+ "[[data-orientation=horizontal]>&]:before:left-1/2",
7493
7871
  "[[data-orientation=horizontal]>&]:!w-px",
7494
7872
  "[[data-orientation=horizontal]>&]:before:h-full",
7495
- "[[data-orientation=horizontal]>&]:before:w-[calc(var(--spacing)*1.25)]",
7873
+ "[[data-orientation=horizontal]>&]:before:w-[calc(var(--spacing)*1)]",
7874
+ "[[data-orientation=vertical]>&]:before:-translate-y-1/2",
7875
+ "[[data-orientation=vertical]>&[data-edge=end]]:before:-translate-y-1",
7876
+ "[[data-orientation=vertical]>&[data-edge=start]]:before:translate-y-0",
7877
+ "[[data-orientation=vertical]>&]:before:top-1/2",
7496
7878
  "[[data-orientation=vertical]>&]:!h-px",
7497
7879
  "[[data-orientation=vertical]>&]:before:w-full",
7498
- "[[data-orientation=vertical]>&]:before:h-[calc(var(--spacing)*1.25)]"
7880
+ "[[data-orientation=vertical]>&]:before:h-[calc(var(--spacing)*1)]"
7499
7881
  ];
7500
7882
  const handleClasses = [
7501
7883
  "bg-transparent",
@@ -7544,24 +7926,175 @@
7544
7926
  "[[data-orientation=vertical]>&]:after:w-5",
7545
7927
  "[[data-orientation=vertical]>&]:after:h-2.5"
7546
7928
  ];
7547
- el.setAttribute("data-slot", "split-gutter");
7548
- el.setAttribute("tabindex", "-1");
7549
- el.setAttribute("role", "separator");
7550
- function setVariant(variant = "handle") {
7551
- if (variant === "border") {
7552
- el.classList.remove(...handleClasses);
7553
- el.classList.add(...borderClasses);
7929
+ const setVariant = () => {
7930
+ if (split._h_split.state.isBorder) {
7931
+ gutter.classList.remove(...handleClasses);
7932
+ gutter.classList.add(...borderClasses);
7554
7933
  } else {
7555
- el.classList.remove(...borderClasses);
7556
- el.classList.add(...handleClasses);
7934
+ gutter.classList.remove(...borderClasses);
7935
+ gutter.classList.add(...handleClasses);
7557
7936
  }
7558
- }
7559
- const observer = new MutationObserver(() => {
7560
- setVariant(el.parentElement.getAttribute("data-variant"));
7937
+ };
7938
+ setVariant();
7939
+ effect(setVariant);
7940
+ const initialSize = split._h_split.normalize(el.getAttribute("data-size"));
7941
+ let handleSize = 0;
7942
+ const panel = {
7943
+ el,
7944
+ gutter,
7945
+ hidden: el.getAttribute("data-hidden") === "true",
7946
+ declaredSize: initialSize,
7947
+ size: initialSize,
7948
+ explicit: initialSize != null,
7949
+ min: split._h_split.normalize(el.getAttribute("data-min")) ?? 0,
7950
+ max: split._h_split.normalize(el.getAttribute("data-max")) ?? Infinity,
7951
+ collapsed: false,
7952
+ prevSize: null,
7953
+ apply() {
7954
+ el.style.flexBasis = `${this.size.toFixed(2)}px`;
7955
+ if (split._h_split.state.isBorder) {
7956
+ this.setHandleOffset();
7957
+ }
7958
+ },
7959
+ setGutter(last) {
7960
+ if (this.hidden || last) {
7961
+ gutter.remove();
7962
+ } else if (!gutter.parentElement) {
7963
+ el.after(gutter);
7964
+ handleSize = this.getHandleSize();
7965
+ }
7966
+ },
7967
+ setHandleOffset() {
7968
+ const panels = split._h_split.panels.filter((p) => !p.hidden);
7969
+ const index = panels.indexOf(panel);
7970
+ const next = panels[index + 1];
7971
+ if (!next) return;
7972
+ if (next.size < handleSize) {
7973
+ gutter.setAttribute("data-edge", "end");
7974
+ } else if (this.size < handleSize) {
7975
+ gutter.setAttribute("data-edge", "start");
7976
+ } else {
7977
+ gutter.removeAttribute("data-edge");
7978
+ }
7979
+ },
7980
+ getHandleSize() {
7981
+ if (split._h_split.state.isBorder) {
7982
+ const beforeStyle = window.getComputedStyle(gutter, "::before");
7983
+ return Number(beforeStyle[split._h_split.state.isHorizontal ? "width" : "height"].replace("px", "")) / 2;
7984
+ } else {
7985
+ return 0;
7986
+ }
7987
+ },
7988
+ setLocked(locked = false) {
7989
+ const panelLocked = el.getAttribute("data-locked") === "true";
7990
+ if (locked) {
7991
+ gutter.classList.add("pointer-events-none");
7992
+ } else if (panelLocked) {
7993
+ gutter.classList.add("pointer-events-none");
7994
+ } else {
7995
+ gutter.classList.remove("pointer-events-none");
7996
+ }
7997
+ }
7998
+ };
7999
+ split._h_split.addPanel(panel);
8000
+ const drag = (e) => {
8001
+ e.preventDefault();
8002
+ gutter.setPointerCapture(e.pointerId);
8003
+ const panels = split._h_split.panels.filter((p) => !p.hidden);
8004
+ const index = panels.indexOf(panel);
8005
+ const next = panels[index + 1];
8006
+ if (!next) return;
8007
+ const startPos = split._h_split.state.isHorizontal ? e.clientX : e.clientY;
8008
+ const startA = panel.size;
8009
+ const startB = next.size;
8010
+ const minDelta = Math.max(
8011
+ panel.min - startA,
8012
+ // how much panel A can shrink
8013
+ startB - next.max
8014
+ // how much panel B can grow
8015
+ );
8016
+ const maxDelta = Math.min(
8017
+ panel.max - startA,
8018
+ // how much panel A can grow
8019
+ startB - next.min
8020
+ // how much panel B can shrink
8021
+ );
8022
+ const move = (e2) => {
8023
+ const currentPos = split._h_split.state.isHorizontal ? e2.clientX : e2.clientY;
8024
+ const delta = currentPos - startPos;
8025
+ const clamped = Math.min(maxDelta, Math.max(minDelta, delta));
8026
+ panel.size = startA + clamped;
8027
+ next.size = startB - clamped;
8028
+ panel.explicit = false;
8029
+ if (panel.collapsed) {
8030
+ panel.collapsed = false;
8031
+ }
8032
+ if (next.collapsed) {
8033
+ next.collapsed = false;
8034
+ }
8035
+ split._h_split.panelChange();
8036
+ };
8037
+ const up = () => {
8038
+ gutter.releasePointerCapture(e.pointerId);
8039
+ gutter.removeEventListener("pointermove", move);
8040
+ gutter.removeEventListener("pointerup", up);
8041
+ };
8042
+ gutter.addEventListener("pointermove", move);
8043
+ gutter.addEventListener("pointerup", up);
8044
+ };
8045
+ gutter.addEventListener("pointerdown", drag);
8046
+ const collapse = () => {
8047
+ if (panel.collapsed) return;
8048
+ panel.prevSize = panel.size;
8049
+ panel.size = panel.min ?? 0;
8050
+ panel.collapsed = true;
8051
+ panel.explicit = true;
8052
+ split._h_split.panelChange();
8053
+ };
8054
+ const expand = () => {
8055
+ if (!panel.collapsed) return;
8056
+ const target = panel.prevSize ?? panel.min ?? 0;
8057
+ const delta = target - panel.size;
8058
+ const visible = split._h_split.panels.filter((p) => !p.hidden && p !== panel);
8059
+ let remaining = delta;
8060
+ for (const p of visible) {
8061
+ const available = p.size - p.min;
8062
+ const take = Math.min(available, remaining);
8063
+ p.size -= take;
8064
+ remaining -= take;
8065
+ if (remaining <= 0) break;
8066
+ }
8067
+ panel.size = target - remaining;
8068
+ panel.collapsed = false;
8069
+ panel.explicit = true;
8070
+ split._h_split.panelChange();
8071
+ };
8072
+ const observer = new MutationObserver((mutations) => {
8073
+ mutations.forEach((mutation) => {
8074
+ if (mutation.attributeName === "data-hidden") {
8075
+ panel.hidden = el.getAttribute("data-hidden") === "true";
8076
+ if (panel.hidden) {
8077
+ el.classList.add("hidden");
8078
+ } else {
8079
+ el.classList.remove("hidden");
8080
+ }
8081
+ split._h_split.panelHidden();
8082
+ } else if (mutation.attributeName === "data-locked") {
8083
+ panel.setLocked();
8084
+ } else {
8085
+ if (el.getAttribute("data-collapse") === "true") {
8086
+ collapse();
8087
+ } else {
8088
+ expand();
8089
+ }
8090
+ }
8091
+ });
7561
8092
  });
7562
- observer.observe(el.parentElement, { attributes: true, attributeFilter: ["data-variant"] });
7563
- setVariant(el.parentElement.getAttribute("data-variant"));
8093
+ observer.observe(el, { attributes: true, attributeFilter: ["data-hidden", "data-locked", "data-collapse"] });
7564
8094
  cleanup(() => {
8095
+ gutter.remove();
8096
+ gutter.removeEventListener("pointerdown", drag);
8097
+ split._h_split.removePanel(panel);
7565
8098
  observer.disconnect();
7566
8099
  });
7567
8100
  });
@@ -7623,7 +8156,18 @@
7623
8156
  function table_default(Alpine) {
7624
8157
  Alpine.directive("h-table-container", (el, { modifiers }) => {
7625
8158
  if (modifiers.includes("scroll")) {
7626
- el.classList.add("overflow-scroll", "[&_thead]:sticky", "[&_thead]:top-0", "[&_thead]:z-2", "[&_tfoot]:sticky", "[&_tfoot]:bottom-0", "[&_tfoot]:z-2", "[&_tbody_tr_th]:sticky", "[&_tbody_tr_th]:left-0", "[&_tbody_tr_th]:z-1");
8159
+ el.classList.add(
8160
+ "overflow-scroll",
8161
+ "[&_thead[data-slot|=table]]:sticky",
8162
+ "[&_thead[data-slot|=table]]:top-0",
8163
+ "[&_thead[data-slot|=table]]:z-2",
8164
+ "[&_tfoot[data-slot|=table]]:sticky",
8165
+ "[&_tfoot[data-slot|=table]]:bottom-0",
8166
+ "[&_tfoot[data-slot|=table]]:z-2",
8167
+ "[&_tbody_tr_th[data-slot|=table]]:sticky",
8168
+ "[&_tbody_tr_th[data-slot|=table]]:left-0",
8169
+ "[&_tbody_tr_th[data-slot|=table]]:z-1"
8170
+ );
7627
8171
  } else {
7628
8172
  el.classList.add("relative", "w-full", "overflow-x-auto");
7629
8173
  }
@@ -7638,13 +8182,19 @@
7638
8182
  el.setAttribute("data-slot", "table");
7639
8183
  switch (el.getAttribute("data-borders")) {
7640
8184
  case "rows":
7641
- el.classList.add("[&_tr_td]:border-b", "[&_tr_th]:border-b", "first:[&_tfoot_tr_td]:border-t", "first:[&_tfoot_tr_th]:border-t");
8185
+ el.classList.add("[&_tr_td[data-slot|=table]]:border-b", "[&_tr_th[data-slot|=table]]:border-b", "first:[&_tfoot_tr_td[data-slot|=table]]:border-t", "first:[&_tfoot_tr_th[data-slot|=table]]:border-t");
7642
8186
  break;
7643
8187
  case "columns":
7644
- el.classList.add("[&_tr]:divide-x");
8188
+ el.classList.add("[&_tr[data-slot|=table]]:divide-x");
7645
8189
  break;
7646
8190
  case "both":
7647
- el.classList.add("[&_tr_td]:border-b", "[&_tr_th]:border-b", "first:[&_tfoot_tr_td]:border-t", "first:[&_tfoot_tr_th]:border-t", "[&_tr]:divide-x");
8191
+ el.classList.add(
8192
+ "[&_tr_td[data-slot|=table]]:border-b",
8193
+ "[&_tr_th[data-slot|=table]]:border-b",
8194
+ "first:[&_tfoot_tr_td[data-slot|=table]]:border-t",
8195
+ "first:[&_tfoot_tr_th[data-slot|=table]]:border-t",
8196
+ "[&_tr[data-slot|=table]]:divide-x"
8197
+ );
7648
8198
  break;
7649
8199
  }
7650
8200
  });
@@ -7674,6 +8224,7 @@
7674
8224
  Alpine.directive("h-table-cell", (el) => {
7675
8225
  el.classList.add(
7676
8226
  "p-2",
8227
+ "[&:has([data-slot|=cell-input])]:p-0",
7677
8228
  "align-middle",
7678
8229
  "whitespace-nowrap",
7679
8230
  "[&:has([role=checkbox])]:pr-0",
@@ -7686,15 +8237,47 @@
7686
8237
  );
7687
8238
  el.setAttribute("data-slot", "table-cell");
7688
8239
  });
8240
+ Alpine.directive("h-table-cell-button", (el) => {
8241
+ el.classList.add(
8242
+ "px-2",
8243
+ "size-full",
8244
+ "h-10",
8245
+ "cursor-pointer",
8246
+ "inline-flex",
8247
+ "items-center",
8248
+ "justify-between",
8249
+ "outline-none",
8250
+ "gap-2",
8251
+ "transition-[color,box-shadow]",
8252
+ "[&_svg]:pointer-events-none",
8253
+ "[&_svg]:opacity-70",
8254
+ "[&_svg]:text-foreground",
8255
+ "[&_svg]:transition-transform",
8256
+ "[&_svg]:duration-200",
8257
+ "[&_svg:not([class*='size-'])]:size-4",
8258
+ "shrink-0",
8259
+ "[&_svg]:shrink-0",
8260
+ "focus-visible:inset-ring-ring/50",
8261
+ "focus-visible:inset-ring-2",
8262
+ "hover:bg-table-hover",
8263
+ "hover:text-table-hover-foreground",
8264
+ "active:!bg-table-active",
8265
+ "active:!text-table-active-foreground",
8266
+ "[&[data-state=open]>svg:not(:first-child):last-child]:rotate-180",
8267
+ "[&[data-state=open]>svg:only-child]:rotate-180"
8268
+ );
8269
+ el.setAttribute("type", "button");
8270
+ el.setAttribute("data-slot", "cell-input-button");
8271
+ });
7689
8272
  Alpine.directive("h-table-body", (el) => {
7690
8273
  el.classList.add(
7691
- "[&_tr:last-child_td]:border-b-0",
7692
- "[&_tr:last-child_th]:border-b-0",
7693
- "[&_tr_th]:bg-table-header",
7694
- "[&_tr[data-hoverable=true]:hover_th]:bg-table-hover",
7695
- "[&_tr[data-hoverable=true]:hover_th]:text-table-hover-foreground",
7696
- "[&_tr[data-activable=true]:active_th]:!bg-table-active",
7697
- "[&_tr[data-activable=true]:active_th]:!text-table-active-foreground"
8274
+ "[&_tr:last-child_td[data-slot|=table]]:border-b-0",
8275
+ "[&_tr:last-child_th[data-slot|=table]]:border-b-0",
8276
+ "[&_tr_th[data-slot|=table]]:bg-table-header",
8277
+ "[&_tr[data-hoverable=true]:hover_th[data-slot|=table]]:bg-table-hover",
8278
+ "[&_tr[data-hoverable=true]:hover_th[data-slot|=table]]:text-table-hover-foreground",
8279
+ "[&_tr[data-activable=true]:active_th[data-slot|=table]]:!bg-table-active",
8280
+ "[&_tr[data-activable=true]:active_th[data-slot|=table]]:!text-table-active-foreground"
7698
8281
  );
7699
8282
  el.setAttribute("data-slot", "table-body");
7700
8283
  });
@@ -7714,7 +8297,7 @@
7714
8297
  el.setAttribute("data-slot", "table-caption");
7715
8298
  });
7716
8299
  Alpine.directive("h-table-footer", (el) => {
7717
- el.classList.add("bg-table-header", "font-medium", "last:[&>tr_td]:border-b-0", "last:[&>tr_th]:border-b-0");
8300
+ el.classList.add("bg-table-header", "font-medium", "last:[&>tr_td[data-slot|=table]]:border-b-0", "last:[&>tr_th[data-slot|=table]]:border-b-0");
7718
8301
  el.setAttribute("data-slot", "table-footer");
7719
8302
  });
7720
8303
  }
@@ -8119,7 +8702,7 @@
8119
8702
  });
8120
8703
  }
8121
8704
  function timepicker_default(Alpine) {
8122
- Alpine.directive("h-time-picker", (el, { expression }, { evaluateLater, cleanup, effect, Alpine: Alpine2 }) => {
8705
+ Alpine.directive("h-time-picker", (el, { expression, modifiers }, { evaluateLater, cleanup, effect, Alpine: Alpine2 }) => {
8123
8706
  el._h_timepicker = Alpine2.reactive({
8124
8707
  id: void 0,
8125
8708
  controls: `htpc${v4_default()}`,
@@ -8149,47 +8732,64 @@
8149
8732
  el.classList.add(
8150
8733
  "cursor-pointer",
8151
8734
  "border-input",
8152
- "[&>input]:appearance-none",
8153
- "has-[input:focus-visible]:border-ring",
8154
- "has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
8155
- "has-[input:focus-visible]:ring-ring/50",
8156
- "has-[input[aria-invalid=true]]:ring-negative/20",
8157
- "has-[input[aria-invalid=true]]:border-negative",
8158
- "dark:has-[input[aria-invalid=true]]:ring-negative/40",
8159
- "has-[input:invalid]:ring-negative/20",
8160
- "has-[input:invalid]:border-negative",
8161
- "dark:has-[input:invalid]:ring-negative/40",
8162
8735
  "hover:bg-secondary-hover",
8163
8736
  "active:bg-secondary-active",
8164
8737
  "flex",
8165
- "w-full",
8166
8738
  "items-center",
8167
8739
  "justify-between",
8168
8740
  "gap-2",
8169
- "rounded-control",
8170
- "border",
8171
- "bg-input-inner",
8172
8741
  "pl-3",
8173
8742
  "pr-2",
8174
8743
  "data-[size=sm]:pr-1",
8175
8744
  "text-sm",
8176
8745
  "whitespace-nowrap",
8177
- "shadow-input",
8178
8746
  "transition-[color,box-shadow]",
8179
8747
  "duration-200",
8180
8748
  "outline-none",
8181
8749
  "has-[input:disabled]:pointer-events-none",
8750
+ "has-[input:disabled]:cursor-not-allowed",
8182
8751
  "has-[input:disabled]:opacity-50"
8183
8752
  );
8184
- el.setAttribute("data-slot", "time-picker");
8753
+ if (modifiers.includes("table")) {
8754
+ el.classList.add(
8755
+ "size-full",
8756
+ "h-10",
8757
+ "has-[input:focus-visible]:inset-ring-ring/50",
8758
+ "has-[input:focus-visible]:inset-ring-2",
8759
+ "has-[input[aria-invalid=true]]:inset-ring-negative/20",
8760
+ "dark:has-[input[aria-invalid=true]]:inset-ring-negative/40",
8761
+ "has-[input:invalid]:!inset-ring-negative/20",
8762
+ "dark:has-[input:invalid]:!inset-ring-negative/40"
8763
+ );
8764
+ el.setAttribute("data-slot", "cell-input-time");
8765
+ } else {
8766
+ el.classList.add(
8767
+ "w-full",
8768
+ "rounded-control",
8769
+ "border",
8770
+ "bg-input-inner",
8771
+ "shadow-input",
8772
+ "has-[input:focus-visible]:border-ring",
8773
+ "has-[input:focus-visible]:ring-[calc(var(--spacing)*0.75)]",
8774
+ "has-[input:focus-visible]:ring-ring/50",
8775
+ "has-[input[aria-invalid=true]]:ring-negative/20",
8776
+ "has-[input[aria-invalid=true]]:border-negative",
8777
+ "dark:has-[input[aria-invalid=true]]:ring-negative/40",
8778
+ "has-[input:invalid]:ring-negative/20",
8779
+ "has-[input:invalid]:border-negative",
8780
+ "dark:has-[input:invalid]:ring-negative/40"
8781
+ );
8782
+ el.setAttribute("data-slot", "time-picker");
8783
+ }
8185
8784
  el.setAttribute("tabindex", "-1");
8186
8785
  el.appendChild(
8187
- createElement(Clock, {
8188
- class: ["opacity-70 text-foreground size-4 shrink-0 pointer-events-none"],
8189
- width: "16",
8190
- height: "16",
8191
- "aria-hidden": true,
8192
- role: "presentation"
8786
+ createSvg({
8787
+ icon: Clock,
8788
+ classes: "opacity-70 text-foreground size-4 shrink-0 pointer-events-none",
8789
+ attrs: {
8790
+ "aria-hidden": true,
8791
+ role: "presentation"
8792
+ }
8193
8793
  })
8194
8794
  );
8195
8795
  if (expression) {
@@ -8266,7 +8866,20 @@
8266
8866
  timepicker._h_timepicker.id = `htp${v4_default()}`;
8267
8867
  el.setAttribute("id", timepicker._h_timepicker.id);
8268
8868
  }
8269
- el.classList.add("cursor-pointer", "bg-transparent", "text-transparent", "text-shadow-[0_0_0_var(--foreground)]", "placeholder:text-muted-foreground", "outline-none", "size-full", "border-0", "md:text-sm", "text-base", "truncate");
8869
+ el.classList.add(
8870
+ "appearance-none",
8871
+ "cursor-pointer",
8872
+ "bg-transparent",
8873
+ "text-transparent",
8874
+ "text-shadow-[0_0_0_var(--foreground)]",
8875
+ "placeholder:text-muted-foreground",
8876
+ "outline-none",
8877
+ "size-full",
8878
+ "border-0",
8879
+ "md:text-sm",
8880
+ "text-base",
8881
+ "truncate"
8882
+ );
8270
8883
  el.setAttribute("aria-autocomplete", "none");
8271
8884
  el.setAttribute("aria-controls", timepicker._h_timepicker.controls);
8272
8885
  el.setAttribute("aria-expanded", "false");
@@ -8814,8 +9427,8 @@
8814
9427
  "shrink-0",
8815
9428
  "items-center",
8816
9429
  "px-1",
8817
- 'has-[>[data-slot="avatar"]:last-child]:pr-2',
8818
- 'has-[>[data-slot="toolbar-image"]:first-child]:pl-2',
9430
+ 'has-[>[data-slot="avatar"]:last-of-type]:pr-2',
9431
+ 'has-[>[data-slot="toolbar-image"]:first-of-type]:pl-2',
8819
9432
  "gap-1",
8820
9433
  modifiers.includes("footer") ? "border-t" : "border-b",
8821
9434
  "w-full",
@@ -8939,7 +9552,7 @@
8939
9552
  "py-0.5",
8940
9553
  "pl-4",
8941
9554
  "data-[border=true]:before:absolute",
8942
- "data-[border=true]:before:left-[calc(var(--spacing)*2.5)]",
9555
+ "data-[border=true]:before:left-[calc(var(--spacing)*3)]",
8943
9556
  "data-[border=true]:before:block",
8944
9557
  "data-[border=true]:before:top-0.5",
8945
9558
  "data-[border=true]:before:bottom-0.5",
@@ -9129,37 +9742,23 @@
9129
9742
  "data-[indicator=positive]:after:bg-positive",
9130
9743
  "data-[indicator=negative]:after:bg-negative",
9131
9744
  "data-[indicator=warning]:after:bg-warning",
9132
- "data-[indicator=information]:after:bg-information",
9133
- "before:mr-1",
9134
- "before:bg-transparent",
9135
- "before:min-w-1.5",
9136
- "before:size-1.5",
9137
- "before:pointer-events-none"
9745
+ "data-[indicator=information]:after:bg-information"
9138
9746
  );
9139
9747
  el.setAttribute("data-slot", "tree-button");
9140
9748
  el.setAttribute("tabindex", "-1");
9141
9749
  el.setAttribute("role", "presentation");
9142
9750
  if (treeItem._h_tree_item.hasSubtree) {
9143
- el.classList.add(
9144
- "before:block",
9145
- "before:mr-1",
9146
- "before:bg-transparent",
9147
- "before:border-t-[calc(var(--spacing)*0.25)]",
9148
- "before:border-r-[calc(var(--spacing)*0.25)]",
9149
- "before:border-foreground",
9150
- "active:before:border-primary-foreground",
9151
- "before:pointer-events-none",
9152
- "before:min-w-1.5",
9153
- "before:size-1.5",
9154
- "before:rounded-[calc(var(--spacing)*0.25)]",
9155
- "before:rotate-135",
9156
- "before:translate-x-1/2",
9157
- "before:-translate-y-0.25",
9158
- "data-[expanded=false]:before:rotate-45",
9159
- "data-[expanded=false]:before:translate-x-1/2",
9160
- "data-[expanded=false]:before:-translate-y-0",
9161
- "aria-selected:before:border-primary-foreground"
9162
- );
9751
+ const chevronDown = createSvg({
9752
+ icon: ChevronRight,
9753
+ classes: "size-4 shrink-0 transition-transform duration-200 [[data-expanded=true]>&]:rotate-90",
9754
+ attrs: {
9755
+ "aria-hidden": true,
9756
+ role: "presentation"
9757
+ }
9758
+ });
9759
+ el.prepend(chevronDown);
9760
+ } else {
9761
+ el.classList.add("before:size-4");
9163
9762
  }
9164
9763
  effect(() => {
9165
9764
  el.setAttribute("data-expanded", treeItem._h_tree_item.expanded);
@@ -9270,6 +9869,7 @@
9270
9869
  Alpine2.initTree(clone);
9271
9870
  });
9272
9871
  cleanup(() => {
9872
+ Alpine2.destroyTree(clone);
9273
9873
  clone.remove();
9274
9874
  });
9275
9875
  } else {
@@ -9291,7 +9891,7 @@
9291
9891
  }
9292
9892
 
9293
9893
  // package.json
9294
- var version = "1.1.1";
9894
+ var version = "1.2.0";
9295
9895
 
9296
9896
  // src/index.js
9297
9897
  window.Harmonia = { getBreakpointListener, addColorSchemeListener, getColorScheme, removeColorSchemeListener, setColorScheme, version };
@@ -9341,24 +9941,3 @@
9341
9941
  window.Alpine.plugin(template_default);
9342
9942
  });
9343
9943
  })();
9344
- /*! Bundled license information:
9345
-
9346
- lucide/dist/esm/defaultAttributes.js:
9347
- lucide/dist/esm/createElement.js:
9348
- lucide/dist/esm/icons/calendar.js:
9349
- lucide/dist/esm/icons/check.js:
9350
- lucide/dist/esm/icons/chevron-down.js:
9351
- lucide/dist/esm/icons/chevron-left.js:
9352
- lucide/dist/esm/icons/chevron-right.js:
9353
- lucide/dist/esm/icons/chevrons-left.js:
9354
- lucide/dist/esm/icons/chevrons-right.js:
9355
- lucide/dist/esm/icons/clock.js:
9356
- lucide/dist/esm/icons/search.js:
9357
- lucide/dist/esm/lucide.js:
9358
- (**
9359
- * @license lucide v0.562.0 - ISC
9360
- *
9361
- * This source code is licensed under the ISC license.
9362
- * See the LICENSE file in the root directory of this source tree.
9363
- *)
9364
- */