neatkit 0.8.0 → 0.9.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 (82) hide show
  1. package/dist/Boundary.cjs +1 -1
  2. package/dist/Boundary.js +29 -29
  3. package/dist/Button-BV5OUXpc.js +101 -0
  4. package/dist/Button-DU4j_IED.cjs +1 -0
  5. package/dist/Button.cjs +1 -1
  6. package/dist/Button.js +1 -1
  7. package/dist/Checkbox.cjs +1 -1
  8. package/dist/Checkbox.js +1 -1
  9. package/dist/{Code-JDb4VFl7.cjs → Code-B7s_rN0G.cjs} +1 -1
  10. package/dist/{Code-ClkozPlv.js → Code-Bp2X1k-g.js} +1 -4
  11. package/dist/Code.cjs +1 -1
  12. package/dist/Code.js +1 -1
  13. package/dist/Divider-C7XGlr26.cjs +1 -0
  14. package/dist/{Divider-BE15WVDI.js → Divider-DZgpYpr-.js} +1 -1
  15. package/dist/Divider.cjs +1 -1
  16. package/dist/Divider.js +1 -1
  17. package/dist/Icon-BIBzgznI.cjs +1 -0
  18. package/dist/{Icon-BoEUoOk7.js → Icon-CxK1wlGk.js} +98 -52
  19. package/dist/Icon.cjs +1 -1
  20. package/dist/Icon.js +1 -1
  21. package/dist/Input.cjs +1 -1
  22. package/dist/Input.js +1 -1
  23. package/dist/Markdown.cjs +1 -1
  24. package/dist/Markdown.js +108 -104
  25. package/dist/Modal.cjs +1 -1
  26. package/dist/Modal.js +1 -1
  27. package/dist/Popover.cjs +1 -1
  28. package/dist/Popover.js +147 -141
  29. package/dist/Select.cjs +1 -1
  30. package/dist/Select.js +2 -2
  31. package/dist/Sidebar.cjs +1 -1
  32. package/dist/Sidebar.js +310 -295
  33. package/dist/Table-CADupJEU.js +423 -0
  34. package/dist/Table-qetwZpTC.cjs +1 -0
  35. package/dist/Table.cjs +1 -1
  36. package/dist/Table.js +1 -1
  37. package/dist/{Tooltip-B4bajPtk.cjs → Tooltip-B2d5ss7S.cjs} +1 -1
  38. package/dist/{Tooltip-BVqdnKK_.js → Tooltip-BK64rkxV.js} +1 -1
  39. package/dist/Tooltip.cjs +1 -1
  40. package/dist/Tooltip.js +1 -1
  41. package/dist/albert-sans-cb3e34c4.woff2 +0 -0
  42. package/dist/components/Icon/icons/GearIcon.d.ts +11 -0
  43. package/dist/components/Icon/icons/ImageIcon.d.ts +11 -0
  44. package/dist/components/Icon/utils/registry.d.ts +2 -0
  45. package/dist/components/Sidebar/Sidebar.d.ts +6 -1
  46. package/dist/components/Sidebar/components/SidebarFooter.d.ts +5 -0
  47. package/dist/components/Sidebar/components/SidebarGroup.d.ts +5 -16
  48. package/dist/components/Sidebar/components/SidebarHeader.d.ts +29 -0
  49. package/dist/components/Sidebar/components/SidebarItem.d.ts +3 -0
  50. package/dist/components/Sidebar/components/SidebarPanel.d.ts +2 -2
  51. package/dist/components/Sidebar/hooks/usePresentation.d.ts +2 -2
  52. package/dist/components/Sidebar/index.d.ts +1 -1
  53. package/dist/components/Sidebar/utils/presentation.d.ts +12 -0
  54. package/dist/components/Sidebar/utils/state.d.ts +2 -2
  55. package/dist/components/Table/Table.d.ts +21 -209
  56. package/dist/components/Table/components/TableAction.d.ts +18 -0
  57. package/dist/components/Table/components/TableActionCell.d.ts +15 -0
  58. package/dist/components/Table/components/TableActionHeaderCell.d.ts +13 -0
  59. package/dist/components/Table/components/TableBody.d.ts +27 -0
  60. package/dist/components/Table/components/TableCell.d.ts +42 -0
  61. package/dist/components/Table/components/TableFoot.d.ts +19 -0
  62. package/dist/components/Table/components/TableHead.d.ts +19 -0
  63. package/dist/components/Table/components/TableHeaderCell.d.ts +23 -0
  64. package/dist/components/Table/components/TableRow.d.ts +67 -0
  65. package/dist/components/Table/hooks/useHorizontalOverflow.d.ts +25 -0
  66. package/dist/components/Table/utils/cell.d.ts +25 -0
  67. package/dist/components/Table/utils/children.d.ts +18 -0
  68. package/dist/components/Table/utils/trigger.d.ts +54 -0
  69. package/dist/floating-position-DIjh2wnP.cjs +1 -0
  70. package/dist/floating-position-DvR6e334.js +50 -0
  71. package/dist/style.css +1 -1
  72. package/dist/{useFloatingPosition-CMirP2-2.js → useFloatingPosition-B3ZC-v3v.js} +1 -1
  73. package/dist/{useFloatingPosition-BBEUHPqy.cjs → useFloatingPosition-GzkP9dCc.cjs} +1 -1
  74. package/package.json +2 -1
  75. package/dist/Button-Chv4O66e.js +0 -99
  76. package/dist/Button-DCKtFvSo.cjs +0 -1
  77. package/dist/Divider-CJYbFcSX.cjs +0 -1
  78. package/dist/Icon-DJ4BigRz.cjs +0 -1
  79. package/dist/Table-B30TBckZ.js +0 -402
  80. package/dist/Table-DceR12X9.cjs +0 -1
  81. package/dist/floating-position-5wJ5G5IT.js +0 -48
  82. package/dist/floating-position-Cy9xxdH4.cjs +0 -1
package/dist/Markdown.js CHANGED
@@ -7,9 +7,9 @@ import Q, { defaultSchema as P } from "rehype-sanitize";
7
7
  import Z from "rehype-slug";
8
8
  import ee from "remark-gfm";
9
9
  import { A as ne } from "./Alert-DQ5CCE0N.js";
10
- import { C as re } from "./Code-ClkozPlv.js";
11
- import { D as te } from "./Divider-BE15WVDI.js";
12
- import { T as _ } from "./Table-B30TBckZ.js";
10
+ import { C as re } from "./Code-Bp2X1k-g.js";
11
+ import { D as te } from "./Divider-DZgpYpr-.js";
12
+ import { T as _ } from "./Table-CADupJEU.js";
13
13
  import { T as k } from "./Text-rN6iDo0V.js";
14
14
  const oe = {
15
15
  bash: "Shell",
@@ -44,7 +44,7 @@ const oe = {
44
44
  };
45
45
  function ie(e) {
46
46
  var a;
47
- const o = (a = e == null ? void 0 : e.split(/\s+/).find((m) => m.startsWith("language-"))) == null ? void 0 : a.slice(9).toLowerCase();
47
+ const o = (a = e == null ? void 0 : e.split(/\s+/).find((f) => f.startsWith("language-"))) == null ? void 0 : a.slice(9).toLowerCase();
48
48
  return o ? oe[o] : void 0;
49
49
  }
50
50
  const B = "md-", R = [
@@ -140,34 +140,35 @@ function le(e) {
140
140
  }
141
141
  function E(e, o, a) {
142
142
  if (e.includes("\\") || /[\u0000-\u0020\u007f]/.test(e) || o === void 0) return;
143
- const m = /^[a-z][a-z\d+.-]*:/i.test(e), f = e.startsWith("//");
143
+ const f = /^[a-z][a-z\d+.-]*:/i.test(e), m = e.startsWith("//");
144
144
  if (o === "*")
145
- return !m && !f || /^https?:/i.test(e) || f ? e : void 0;
145
+ return !f && !m || /^https?:/i.test(e) || m ? e : void 0;
146
146
  const i = Array.isArray(o) ? o : [o], t = le(a);
147
147
  try {
148
- const n = m ? new URL(e) : t ? new URL(e, t) : null;
149
- if (!n || n.protocol !== "http:" && n.protocol !== "https:" || n.username || n.password)
148
+ let n = null;
149
+ if (f ? n = new URL(e) : t && (n = new URL(e, t)), !n || n.protocol !== "http:" && n.protocol !== "https:" || n.username || n.password)
150
150
  return;
151
151
  const r = n.href;
152
- return i.some((d) => ae(r, d)) ? r : void 0;
152
+ return i.some((l) => ae(r, l)) ? r : void 0;
153
153
  } catch {
154
154
  return;
155
155
  }
156
156
  }
157
157
  function C(e, o, a) {
158
158
  if (!e) return;
159
- const f = e.split(",").map((i) => {
159
+ const m = e.split(",").map((i) => {
160
160
  const t = i.trim().split(/\s+/), [n, r] = t, d = r === void 0 || /^(?:\d+w|(?:\d+(?:\.\d+)?|\.\d+)x)$/.test(r);
161
161
  if (t.length > 2 || !d || n === void 0 || n.length === 0)
162
162
  return null;
163
- const c = E(
163
+ const l = E(
164
164
  n,
165
165
  o,
166
166
  a
167
167
  );
168
- return c ? `${c}${r ? ` ${r}` : ""}` : null;
168
+ return l ? `${l}${r ? ` ${r}` : ""}` : null;
169
169
  });
170
- return f.every((i) => i !== null) ? f.join(", ") : void 0;
170
+ if (!m.some((i) => i === null))
171
+ return m.join(", ");
171
172
  }
172
173
  function ce() {
173
174
  function e(o) {
@@ -182,9 +183,9 @@ function S(e, o) {
182
183
  }
183
184
  function de(e) {
184
185
  const { clobberPrefix: o, prefix: a } = e;
185
- function m(f) {
186
- if (f.type === "element") {
187
- const { properties: i } = f;
186
+ function f(m) {
187
+ if (m.type === "element") {
188
+ const { properties: i } = m;
188
189
  i.id = S(i.id, a), i.name = S(i.name, a), i.ariaDescribedBy = S(
189
190
  i.ariaDescribedBy,
190
191
  a
@@ -193,9 +194,9 @@ function de(e) {
193
194
  a
194
195
  ), typeof i.href == "string" && i.href.startsWith("#") && (i.href = `#${o}${a}${i.href.slice(1)}`);
195
196
  }
196
- "children" in f && f.children.forEach(m);
197
+ "children" in m && m.children.forEach(f);
197
198
  }
198
- return (f) => m(f);
199
+ return (m) => f(m);
199
200
  }
200
201
  function A(e) {
201
202
  return e === "center" || e === "left" || e === "right" ? e : void 0;
@@ -210,23 +211,26 @@ function ue(e) {
210
211
  if (!e) return null;
211
212
  const o = e.children.find((n) => n.type === "element" && n.tagName === "code");
212
213
  if (!o || e.children.some((n) => n !== o && (n.type !== "text" || n.value.trim().length > 0))) return null;
213
- const m = o.properties.className, f = Array.isArray(m) ? m.join(" ") : typeof m == "string" ? m : void 0, i = o.children.map(j).join("").replace(/\n$/, "");
214
+ const f = o.properties.className;
215
+ let m;
216
+ Array.isArray(f) ? m = f.join(" ") : typeof f == "string" && (m = f);
217
+ const i = o.children.map(j).join("").replace(/\n$/, "");
214
218
  return { codeProps: {
215
- className: f,
219
+ className: m,
216
220
  dir: H(o.properties.dir),
217
221
  id: H(o.properties.id),
218
222
  lang: H(o.properties.lang),
219
223
  title: H(o.properties.title)
220
224
  }, content: i };
221
225
  }
222
- function me(e, o, a, m, f) {
226
+ function me(e, o, a, f, m) {
223
227
  return {
224
228
  a: function(t) {
225
229
  const {
226
230
  children: n,
227
231
  className: r,
228
232
  dangerouslySetInnerHTML: d,
229
- node: c,
233
+ node: l,
230
234
  ...s
231
235
  } = t;
232
236
  return /* @__PURE__ */ u(
@@ -234,7 +238,7 @@ function me(e, o, a, m, f) {
234
238
  {
235
239
  ...s,
236
240
  className: ["nk-markdown__link", r].filter(Boolean).join(" "),
237
- onClick: f,
241
+ onClick: m,
238
242
  children: n
239
243
  }
240
244
  );
@@ -244,16 +248,16 @@ function me(e, o, a, m, f) {
244
248
  children: n,
245
249
  dangerouslySetInnerHTML: r,
246
250
  node: d,
247
- ...c
251
+ ...l
248
252
  } = t;
249
- return /* @__PURE__ */ u("blockquote", { ...c, className: "nk-markdown__blockquote", children: n });
253
+ return /* @__PURE__ */ u("blockquote", { ...l, className: "nk-markdown__blockquote", children: n });
250
254
  },
251
255
  code: function(t) {
252
256
  const {
253
257
  children: n,
254
258
  className: r,
255
259
  dangerouslySetInnerHTML: d,
256
- node: c,
260
+ node: l,
257
261
  ...s
258
262
  } = t;
259
263
  return /* @__PURE__ */ u(
@@ -270,14 +274,14 @@ function me(e, o, a, m, f) {
270
274
  children: n,
271
275
  className: r,
272
276
  dangerouslySetInnerHTML: d,
273
- node: c,
277
+ node: l,
274
278
  ref: s,
275
- ...l
279
+ ...c
276
280
  } = t;
277
281
  return /* @__PURE__ */ u(
278
282
  k,
279
283
  {
280
- ...l,
284
+ ...c,
281
285
  as: "h1",
282
286
  className: ["nk-markdown__heading", r].filter(Boolean).join(" "),
283
287
  size: "heading",
@@ -291,14 +295,14 @@ function me(e, o, a, m, f) {
291
295
  children: n,
292
296
  className: r,
293
297
  dangerouslySetInnerHTML: d,
294
- node: c,
298
+ node: l,
295
299
  ref: s,
296
- ...l
300
+ ...c
297
301
  } = t;
298
302
  return /* @__PURE__ */ u(
299
303
  k,
300
304
  {
301
- ...l,
305
+ ...c,
302
306
  as: "h2",
303
307
  className: [
304
308
  "nk-markdown__heading",
@@ -315,14 +319,14 @@ function me(e, o, a, m, f) {
315
319
  children: n,
316
320
  className: r,
317
321
  dangerouslySetInnerHTML: d,
318
- node: c,
322
+ node: l,
319
323
  ref: s,
320
- ...l
324
+ ...c
321
325
  } = t;
322
326
  return /* @__PURE__ */ u(
323
327
  k,
324
328
  {
325
- ...l,
329
+ ...c,
326
330
  as: "h3",
327
331
  className: ["nk-markdown__heading", r].filter(Boolean).join(" "),
328
332
  size: "subtitle",
@@ -336,14 +340,14 @@ function me(e, o, a, m, f) {
336
340
  children: n,
337
341
  className: r,
338
342
  dangerouslySetInnerHTML: d,
339
- node: c,
343
+ node: l,
340
344
  ref: s,
341
- ...l
345
+ ...c
342
346
  } = t;
343
347
  return /* @__PURE__ */ u(
344
348
  k,
345
349
  {
346
- ...l,
350
+ ...c,
347
351
  as: "h4",
348
352
  className: ["nk-markdown__heading", r].filter(Boolean).join(" "),
349
353
  weight: "semibold",
@@ -356,14 +360,14 @@ function me(e, o, a, m, f) {
356
360
  children: n,
357
361
  className: r,
358
362
  dangerouslySetInnerHTML: d,
359
- node: c,
363
+ node: l,
360
364
  ref: s,
361
- ...l
365
+ ...c
362
366
  } = t;
363
367
  return /* @__PURE__ */ u(
364
368
  k,
365
369
  {
366
- ...l,
370
+ ...c,
367
371
  as: "h5",
368
372
  className: ["nk-markdown__heading", r].filter(Boolean).join(" "),
369
373
  weight: "semibold",
@@ -376,14 +380,14 @@ function me(e, o, a, m, f) {
376
380
  children: n,
377
381
  className: r,
378
382
  dangerouslySetInnerHTML: d,
379
- node: c,
383
+ node: l,
380
384
  ref: s,
381
- ...l
385
+ ...c
382
386
  } = t;
383
387
  return /* @__PURE__ */ u(
384
388
  k,
385
389
  {
386
- ...l,
390
+ ...c,
387
391
  as: "h6",
388
392
  className: ["nk-markdown__heading", r].filter(Boolean).join(" "),
389
393
  weight: "medium",
@@ -404,16 +408,16 @@ function me(e, o, a, m, f) {
404
408
  alt: n,
405
409
  className: r,
406
410
  dangerouslySetInnerHTML: d,
407
- node: c,
411
+ node: l,
408
412
  src: s,
409
- srcSet: l,
413
+ srcSet: c,
410
414
  ...M
411
415
  } = t, b = E(
412
416
  typeof s == "string" ? s : "",
413
417
  e,
414
418
  o
415
419
  ), L = C(
416
- l,
420
+ c,
417
421
  e,
418
422
  o
419
423
  );
@@ -435,7 +439,7 @@ function me(e, o, a, m, f) {
435
439
  checked: n,
436
440
  className: r,
437
441
  dangerouslySetInnerHTML: d,
438
- node: c,
442
+ node: l,
439
443
  ...s
440
444
  } = t;
441
445
  return /* @__PURE__ */ W(q, { children: [
@@ -463,16 +467,16 @@ function me(e, o, a, m, f) {
463
467
  children: n,
464
468
  className: r,
465
469
  dangerouslySetInnerHTML: d,
466
- node: c,
470
+ node: l,
467
471
  ...s
468
- } = t, l = (r == null ? void 0 : r.split(/\s+/).includes("task-list-item")) ?? !1;
472
+ } = t, c = (r == null ? void 0 : r.split(/\s+/).includes("task-list-item")) ?? !1;
469
473
  return /* @__PURE__ */ u(
470
474
  "li",
471
475
  {
472
476
  ...s,
473
477
  className: [
474
478
  "nk-markdown__list-item",
475
- l ? "nk-markdown__list-item--task" : void 0
479
+ c ? "nk-markdown__list-item--task" : void 0
476
480
  ].filter(Boolean).join(" "),
477
481
  children: n
478
482
  }
@@ -483,9 +487,9 @@ function me(e, o, a, m, f) {
483
487
  children: n,
484
488
  className: r,
485
489
  dangerouslySetInnerHTML: d,
486
- node: c,
490
+ node: l,
487
491
  ...s
488
- } = t, l = (r == null ? void 0 : r.split(/\s+/).includes("contains-task-list")) ?? !1;
492
+ } = t, c = (r == null ? void 0 : r.split(/\s+/).includes("contains-task-list")) ?? !1;
489
493
  return /* @__PURE__ */ u(
490
494
  "ol",
491
495
  {
@@ -493,7 +497,7 @@ function me(e, o, a, m, f) {
493
497
  className: [
494
498
  "nk-markdown__list",
495
499
  "nk-markdown__list--ordered",
496
- l ? "nk-markdown__list--tasks" : void 0
500
+ c ? "nk-markdown__list--tasks" : void 0
497
501
  ].filter(Boolean).join(" "),
498
502
  children: n
499
503
  }
@@ -504,14 +508,14 @@ function me(e, o, a, m, f) {
504
508
  children: n,
505
509
  className: r,
506
510
  dangerouslySetInnerHTML: d,
507
- node: c,
511
+ node: l,
508
512
  ref: s,
509
- ...l
513
+ ...c
510
514
  } = t;
511
515
  return /* @__PURE__ */ u(
512
516
  k,
513
517
  {
514
- ...l,
518
+ ...c,
515
519
  className: ["nk-markdown__paragraph", r].filter(Boolean).join(" "),
516
520
  children: n
517
521
  }
@@ -522,7 +526,7 @@ function me(e, o, a, m, f) {
522
526
  children: n,
523
527
  className: r,
524
528
  dangerouslySetInnerHTML: d,
525
- node: c,
529
+ node: l,
526
530
  ...s
527
531
  } = t;
528
532
  return /* @__PURE__ */ u(
@@ -539,17 +543,17 @@ function me(e, o, a, m, f) {
539
543
  children: n,
540
544
  dangerouslySetInnerHTML: r,
541
545
  node: d,
542
- ref: c,
546
+ ref: l,
543
547
  ...s
544
- } = t, l = ue(d);
545
- return l ? /* @__PURE__ */ u(
548
+ } = t, c = ue(d);
549
+ return c ? /* @__PURE__ */ u(
546
550
  re,
547
551
  {
548
- code: l.content,
549
- codeProps: l.codeProps,
550
- language: ie(l.codeProps.className),
552
+ code: c.content,
553
+ codeProps: c.codeProps,
554
+ language: ie(c.codeProps.className),
551
555
  maxHighlightLength: a,
552
- maxLineCount: m,
556
+ maxLineCount: f,
553
557
  preProps: s
554
558
  }
555
559
  ) : /* @__PURE__ */ u("pre", { ...s, children: n });
@@ -559,18 +563,18 @@ function me(e, o, a, m, f) {
559
563
  children: n,
560
564
  dangerouslySetInnerHTML: r,
561
565
  node: d,
562
- srcSet: c,
566
+ srcSet: l,
563
567
  ...s
564
- } = t, l = C(
565
- c,
568
+ } = t, c = C(
569
+ l,
566
570
  e,
567
571
  o
568
572
  );
569
- return l ? /* @__PURE__ */ u(
573
+ return c ? /* @__PURE__ */ u(
570
574
  "source",
571
575
  {
572
576
  ...s,
573
- srcSet: l
577
+ srcSet: c
574
578
  }
575
579
  ) : null;
576
580
  },
@@ -579,32 +583,32 @@ function me(e, o, a, m, f) {
579
583
  children: n,
580
584
  dangerouslySetInnerHTML: r,
581
585
  node: d,
582
- ...c
586
+ ...l
583
587
  } = t;
584
- return /* @__PURE__ */ u(_, { ...c, children: n });
588
+ return /* @__PURE__ */ u(_, { ...l, children: n });
585
589
  },
586
590
  tbody: function(t) {
587
591
  const {
588
592
  children: n,
589
593
  dangerouslySetInnerHTML: r,
590
594
  node: d,
591
- ...c
595
+ ...l
592
596
  } = t;
593
- return /* @__PURE__ */ u(_.Body, { ...c, children: n });
597
+ return /* @__PURE__ */ u(_.Body, { ...l, children: n });
594
598
  },
595
599
  td: function(t) {
596
600
  const {
597
601
  align: n,
598
602
  children: r,
599
603
  dangerouslySetInnerHTML: d,
600
- node: c,
604
+ node: l,
601
605
  style: s,
602
- ...l
606
+ ...c
603
607
  } = t;
604
608
  return /* @__PURE__ */ u(
605
609
  _.Cell,
606
610
  {
607
- ...l,
611
+ ...c,
608
612
  align: A((s == null ? void 0 : s.textAlign) ?? n),
609
613
  children: r
610
614
  }
@@ -615,14 +619,14 @@ function me(e, o, a, m, f) {
615
619
  align: n,
616
620
  children: r,
617
621
  dangerouslySetInnerHTML: d,
618
- node: c,
622
+ node: l,
619
623
  style: s,
620
- ...l
624
+ ...c
621
625
  } = t;
622
626
  return /* @__PURE__ */ u(
623
627
  _.HeaderCell,
624
628
  {
625
- ...l,
629
+ ...c,
626
630
  align: A((s == null ? void 0 : s.textAlign) ?? n),
627
631
  children: r
628
632
  }
@@ -633,16 +637,16 @@ function me(e, o, a, m, f) {
633
637
  children: n,
634
638
  dangerouslySetInnerHTML: r,
635
639
  node: d,
636
- ...c
640
+ ...l
637
641
  } = t;
638
- return /* @__PURE__ */ u(_.Head, { ...c, children: n });
642
+ return /* @__PURE__ */ u(_.Head, { ...l, children: n });
639
643
  },
640
644
  tr: function(t) {
641
645
  const {
642
646
  children: n,
643
647
  dangerouslySetInnerHTML: r,
644
648
  node: d,
645
- onClick: c,
649
+ onClick: l,
646
650
  ...s
647
651
  } = t;
648
652
  return /* @__PURE__ */ u(_.Row, { ...s, children: n });
@@ -652,9 +656,9 @@ function me(e, o, a, m, f) {
652
656
  children: n,
653
657
  className: r,
654
658
  dangerouslySetInnerHTML: d,
655
- node: c,
659
+ node: l,
656
660
  ...s
657
- } = t, l = (r == null ? void 0 : r.split(/\s+/).includes("contains-task-list")) ?? !1;
661
+ } = t, c = (r == null ? void 0 : r.split(/\s+/).includes("contains-task-list")) ?? !1;
658
662
  return /* @__PURE__ */ u(
659
663
  "ul",
660
664
  {
@@ -662,7 +666,7 @@ function me(e, o, a, m, f) {
662
666
  className: [
663
667
  "nk-markdown__list",
664
668
  "nk-markdown__list--unordered",
665
- l ? "nk-markdown__list--tasks" : void 0
669
+ c ? "nk-markdown__list--tasks" : void 0
666
670
  ].filter(Boolean).join(" "),
667
671
  children: n
668
672
  }
@@ -696,27 +700,27 @@ function ge(e) {
696
700
  }
697
701
  }
698
702
  function _e(e, o) {
699
- const a = e, m = new a.HashChangeEvent("hashchange", {
703
+ const a = e, f = new a.HashChangeEvent("hashchange", {
700
704
  newURL: e.location.href,
701
705
  oldURL: o
702
706
  });
703
- e.dispatchEvent(m);
707
+ e.dispatchEvent(f);
704
708
  }
705
709
  function ye(e) {
706
710
  return e === null ? null : Number.isFinite(e) ? Math.max(0, Math.floor(e)) : 0;
707
711
  }
708
712
  const Ce = V(function(o, a) {
709
713
  const {
710
- allowedImageSources: m,
711
- anchorPrefix: f = "",
714
+ allowedImageSources: f,
715
+ anchorPrefix: m = "",
712
716
  className: i,
713
717
  content: t,
714
718
  dangerouslySetInnerHTML: n,
715
719
  imageBaseUrl: r,
716
720
  maxCodeHighlightLength: d,
717
- maxCodeLineCount: c,
721
+ maxCodeLineCount: l,
718
722
  maxContentLength: s = he,
719
- rehypePlugins: l,
723
+ rehypePlugins: c,
720
724
  remarkPlugins: M,
721
725
  scrollOffset: g = 128,
722
726
  style: b,
@@ -725,7 +729,7 @@ const Ce = V(function(o, a) {
725
729
  s
726
730
  ), D = I !== null && t.length > I, N = J(
727
731
  (h) => {
728
- var x;
732
+ var v;
729
733
  if (h.defaultPrevented || h.button !== 0 || h.metaKey || h.ctrlKey || h.shiftKey || h.altKey)
730
734
  return;
731
735
  const y = h.currentTarget.getAttribute("href");
@@ -738,7 +742,7 @@ const Ce = V(function(o, a) {
738
742
  const p = w.ownerDocument.defaultView;
739
743
  if (!p) return;
740
744
  h.preventDefault();
741
- const F = ((x = p.matchMedia) == null ? void 0 : x.call(
745
+ const F = ((v = p.matchMedia) == null ? void 0 : v.call(
742
746
  p,
743
747
  "(prefers-reduced-motion: reduce)"
744
748
  ).matches) ?? !1, U = g === null || F ? "auto" : "smooth", K = p.location.href, G = p.location.hash !== y;
@@ -750,18 +754,18 @@ const Ce = V(function(o, a) {
750
754
  [g]
751
755
  ), O = T(
752
756
  () => me(
753
- m,
757
+ f,
754
758
  r,
755
759
  d,
756
- c,
760
+ l,
757
761
  N
758
762
  ),
759
763
  [
760
- m,
764
+ f,
761
765
  N,
762
766
  r,
763
767
  d,
764
- c
768
+ l
765
769
  ]
766
770
  ), $ = T(
767
771
  () => [ee, ...M ?? []],
@@ -769,20 +773,20 @@ const Ce = V(function(o, a) {
769
773
  ), z = T(
770
774
  () => [
771
775
  X,
772
- ...l ?? [],
776
+ ...c ?? [],
773
777
  ce,
774
778
  Z,
775
779
  [de, {
776
780
  clobberPrefix: B,
777
- prefix: f
781
+ prefix: m
778
782
  }],
779
783
  [Q, se]
780
784
  ],
781
- [f, l]
782
- ), v = { ...b };
785
+ [m, c]
786
+ ), x = { ...b };
783
787
  if (g !== null) {
784
788
  const h = Number.isFinite(g) ? Math.max(0, g) : 0;
785
- v["--nk-markdown-scroll-offset"] = `${h}px`;
789
+ x["--nk-markdown-scroll-offset"] = `${h}px`;
786
790
  }
787
791
  return /* @__PURE__ */ u(
788
792
  "div",
@@ -790,7 +794,7 @@ const Ce = V(function(o, a) {
790
794
  ...L,
791
795
  ref: a,
792
796
  className: ["nk-markdown", i].filter(Boolean).join(" "),
793
- style: v,
797
+ style: x,
794
798
  children: D ? /* @__PURE__ */ u(ne, { role: "alert", tone: "warning", children: pe }) : /* @__PURE__ */ u(
795
799
  Y,
796
800
  {
package/dist/Modal.cjs CHANGED
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),s=require("react"),A=require("./effects-D85L_7zM.cjs"),$=require("./Button-DCKtFvSo.cjs"),r=require("./usePresence-B5RYv4e1.cjs"),G=require("./useFocusTrap-BrFZdMqQ.cjs"),H=require("./useScrollLock-Dy8MZaSn.cjs"),J=require("./Surface-BttJYSDt.cjs"),K=require("./Text-DWYlIcPj.cjs");function Q(c,t,a){t.current=c,typeof a=="function"?a(c):a&&(a.current=c)}function U(c){const{"aria-label":t,"aria-labelledby":a,children:l,className:v,closeButtonLabel:m="Close modal",exitable:i=!0,forwardedReference:u,initialFocusReference:d,lockScroll:f=!0,onClose:e,open:o,ownerDocument:g,presenceState:k,restoreFocus:R=!0,role:F="dialog",style:I,title:b,trapFocus:S=!0,...P}=c,j=s.useRef(null),_=s.useRef(null),q=s.useContext(r.FocusScopeContext),B=`${s.useId()}-title`,[y,M]=s.useState(null),p=r.useBoundary("Modal").boundaryElement,x=r.useOverlayLayer(!0,p),E=s.useMemo(()=>[j],[]),h=!!(b!=null&&b.trim()),N=d??(h?_:void 0),O=a??(t===void 0&&h?B:void 0),T=s.useCallback(L=>{Q(L,j,u),M(L)},[u]);A.useIsomorphicLayoutEffect(()=>{y&&(y.inert=!o)},[y,o]);const w=s.useCallback(()=>{e==null||e("escape")},[e]),C=s.useCallback(()=>{e==null||e("outside")},[e]);r.useDismissableLayer({boundary:p,active:o,boundaries:E,dismissOnEscape:i,dismissOnPointerDownOutside:i,layerId:x.id,onEscapeDismiss:w,onPointerDownOutsideDismiss:C,ownerDocument:g});const z=G.useFocusTrap({boundary:p,active:o&&S,container:y,initialFocusReference:N,layerId:x.id,restoreFocus:R});H.useScrollLock(f,g,p);const D=i?n.jsx($.Button,{"aria-label":m,className:"nk-modal__close",icon:"cross",onClick:()=>e==null?void 0:e("close-button"),shape:"rectangle",type:"button",variant:"ghost"}):null;return n.jsx(r.FocusScopeContext.Provider,{value:o&&S?z:q,children:n.jsx("div",{className:"nk-modal__overlay","data-state":k,role:"presentation",style:{zIndex:x.zIndex},children:n.jsx("div",{className:"nk-modal__viewport",children:n.jsxs(J.Surface,{...P,ref:T,"aria-hidden":o?void 0:!0,"aria-label":o?t:void 0,"aria-labelledby":o?O:void 0,"aria-modal":o?"true":void 0,className:["nk-modal",v].filter(Boolean).join(" "),"data-state":k,role:o?F:void 0,style:I,tabIndex:-1,children:[h?n.jsxs("div",{className:"nk-modal__header",children:[n.jsx(K.Text,{as:"h2",className:"nk-modal__title",id:B,ref:_,size:"subtitle",tabIndex:-1,weight:"semibold",children:b}),D]}):D,l]})})})})}const V=s.forwardRef(function(t,a){const{open:l}=t,v=r.useBoundary("Modal"),m=s.useRef(t);l&&(m.current=t);const i=l?t:m.current,u=r.usePresence(l),d=v.boundaryElement,f=(d==null?void 0:d.ownerDocument)??(typeof document>"u"?null:document);return!u.present||!f?null:n.jsx(r.Portal,{children:n.jsx(U,{...i,forwardedReference:a,open:l,ownerDocument:f,presenceState:u.state==="closing"?"closing":"open"})})});exports.default=V;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),s=require("react"),A=require("./effects-D85L_7zM.cjs"),$=require("./Button-DU4j_IED.cjs"),r=require("./usePresence-B5RYv4e1.cjs"),G=require("./useFocusTrap-BrFZdMqQ.cjs"),H=require("./useScrollLock-Dy8MZaSn.cjs"),J=require("./Surface-BttJYSDt.cjs"),K=require("./Text-DWYlIcPj.cjs");function Q(c,t,a){t.current=c,typeof a=="function"?a(c):a&&(a.current=c)}function U(c){const{"aria-label":t,"aria-labelledby":a,children:l,className:v,closeButtonLabel:m="Close modal",exitable:i=!0,forwardedReference:u,initialFocusReference:d,lockScroll:f=!0,onClose:e,open:o,ownerDocument:g,presenceState:k,restoreFocus:R=!0,role:F="dialog",style:I,title:b,trapFocus:S=!0,...P}=c,j=s.useRef(null),_=s.useRef(null),q=s.useContext(r.FocusScopeContext),B=`${s.useId()}-title`,[y,M]=s.useState(null),p=r.useBoundary("Modal").boundaryElement,x=r.useOverlayLayer(!0,p),E=s.useMemo(()=>[j],[]),h=!!(b!=null&&b.trim()),N=d??(h?_:void 0),O=a??(t===void 0&&h?B:void 0),T=s.useCallback(L=>{Q(L,j,u),M(L)},[u]);A.useIsomorphicLayoutEffect(()=>{y&&(y.inert=!o)},[y,o]);const w=s.useCallback(()=>{e==null||e("escape")},[e]),C=s.useCallback(()=>{e==null||e("outside")},[e]);r.useDismissableLayer({boundary:p,active:o,boundaries:E,dismissOnEscape:i,dismissOnPointerDownOutside:i,layerId:x.id,onEscapeDismiss:w,onPointerDownOutsideDismiss:C,ownerDocument:g});const z=G.useFocusTrap({boundary:p,active:o&&S,container:y,initialFocusReference:N,layerId:x.id,restoreFocus:R});H.useScrollLock(f,g,p);const D=i?n.jsx($.Button,{"aria-label":m,className:"nk-modal__close",icon:"cross",onClick:()=>e==null?void 0:e("close-button"),shape:"rectangle",type:"button",variant:"ghost"}):null;return n.jsx(r.FocusScopeContext.Provider,{value:o&&S?z:q,children:n.jsx("div",{className:"nk-modal__overlay","data-state":k,role:"presentation",style:{zIndex:x.zIndex},children:n.jsx("div",{className:"nk-modal__viewport",children:n.jsxs(J.Surface,{...P,ref:T,"aria-hidden":o?void 0:!0,"aria-label":o?t:void 0,"aria-labelledby":o?O:void 0,"aria-modal":o?"true":void 0,className:["nk-modal",v].filter(Boolean).join(" "),"data-state":k,role:o?F:void 0,style:I,tabIndex:-1,children:[h?n.jsxs("div",{className:"nk-modal__header",children:[n.jsx(K.Text,{as:"h2",className:"nk-modal__title",id:B,ref:_,size:"subtitle",tabIndex:-1,weight:"semibold",children:b}),D]}):D,l]})})})})}const V=s.forwardRef(function(t,a){const{open:l}=t,v=r.useBoundary("Modal"),m=s.useRef(t);l&&(m.current=t);const i=l?t:m.current,u=r.usePresence(l),d=v.boundaryElement,f=(d==null?void 0:d.ownerDocument)??(typeof document>"u"?null:document);return!u.present||!f?null:n.jsx(r.Portal,{children:n.jsx(U,{...i,forwardedReference:a,open:l,ownerDocument:f,presenceState:u.state==="closing"?"closing":"open"})})});exports.default=V;
package/dist/Modal.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { jsx as t, jsxs as F } from "react/jsx-runtime";
3
3
  import { forwardRef as H, useRef as g, useContext as J, useId as K, useState as Q, useMemo as U, useCallback as h } from "react";
4
4
  import { u as V } from "./effects-D5CWf-Pl.js";
5
- import { B as W } from "./Button-Chv4O66e.js";
5
+ import { B as W } from "./Button-BV5OUXpc.js";
6
6
  import { b as E, c as X, P as Y, F as P, d as Z, e as ee } from "./usePresence-CqegYqy4.js";
7
7
  import { u as oe } from "./useFocusTrap-DhVnlboe.js";
8
8
  import { u as ae } from "./useScrollLock-Drd7OZRC.js";
package/dist/Popover.cjs CHANGED
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),t=require("react"),Ce=require("./aria-Bntn6ad_.cjs"),Se=require("./effects-D85L_7zM.cjs"),_=require("./reference-C2guRuR0.cjs"),m=require("./usePresence-B5RYv4e1.cjs"),Oe=require("./useFloatingPosition-BBEUHPqy.cjs"),qe=require("./useFocusTrap-BrFZdMqQ.cjs"),we=require("./Surface-BttJYSDt.cjs");function De(o){const{inert:i,panelElement:c}=o;return Se.useIsomorphicLayoutEffect(()=>{c&&(c.inert=i)},[i,c]),null}function Fe(o,i,c){i.current=o,_.assignElementReference(c,o)}function je(o,i,c){i.current=o,_.assignElementReference(c,o)}function Le(o){const i=o.tagName.toLowerCase();return o.getAttribute("role")==="button"&&i!=="button"?!1:["button","input","select","summary","textarea"].includes(i)?!0:i==="a"&&o.hasAttribute("href")}function Ne(o){return o==="grid"||o==="listbox"||o==="menu"||o==="tree"?o:"dialog"}const _e=t.forwardRef(function(i,c){const{"aria-label":B,"aria-labelledby":ee,autoFocus:q=!0,children:te,className:re,closeOnEscape:ne=!0,closeOnOutsideInteraction:se=!0,defaultOpen:oe=!1,disabled:T=!1,initialFocusReference:h,onEscapeKeyDown:ae,onOpenChange:x,onPointerDownOutside:k,open:M,placement:K="bottom",restoreFocus:w=!0,role:z="dialog",style:A,tabIndex:ie,trapFocus:b=!1,trigger:d,...ce}=i;if(d.type===t.Fragment)throw new Error("Popover requires a single non-Fragment trigger");const H=t.useId(),ue=t.useContext(m.FocusScopeContext),V=`${H}-popover`,s=d.props,$=_.getElementReference(d),U=s.id??`${H}-trigger`,E=T||s.disabled===!0||s["aria-disabled"]===!0||s["aria-disabled"]==="true",P=M!==void 0,[le,de]=t.useState(oe),r=P?M:le,I=m.usePresence(r),G=t.useRef(null),J=t.useRef(null),D=t.useRef("programmatic"),F=t.useRef(null),Q=t.useRef(r),C=t.useRef(null),[fe,pe]=t.useReducer(e=>e+1,0),[u,ge]=t.useState(null),[f,me]=t.useState(null),a=(u==null?void 0:u.ownerDocument)??(typeof document>"u"?null:document),S=m.useBoundary("Popover").boundaryElement,O=m.useOverlayLayer(I.present,S),be=t.useMemo(()=>[G,J],[]),p=Oe.useFloatingPosition(I.present,K,u,f,S),ve=t.useCallback(e=>{je(e,G,$),ge(e)},[$]),ye=t.useCallback(e=>{Fe(e,J,c),me(e)},[c]),g=t.useCallback((e,n)=>{r!==e&&(P?(F.current={open:e,reason:n},pe()):(D.current=n,de(e)),x==null||x(e,n))},[P,x,r]),he=t.useCallback(()=>{g(!1,"escape")},[g]),Ee=t.useCallback(()=>{g(!1,"outside")},[g]),Pe=t.useCallback(e=>{var R;if(k==null||k(e),e.defaultPrevented)return;const n=(R=a==null?void 0:a.defaultView)==null?void 0:R.HTMLElement;C.current=n?e.composedPath().find(y=>y instanceof n&&y.tabIndex>=0)??e.target:e.target},[k,a]);m.useDismissableLayer({boundary:S,active:r,boundaries:be,dismissOnEscape:ne,dismissOnPointerDownOutside:se,layerId:O.id,onEscapeDismiss:he,onEscapeKeyDown:ae,onPointerDownOutside:Pe,onPointerDownOutsideDismiss:Ee,ownerDocument:a});const Re=qe.useFocusTrap({boundary:S,active:r&&b,autoFocus:q,container:f,initialFocusReference:h,layerId:O.id,restoreFocus:w});t.useEffect(()=>{if(!r||b||!q||!f)return;let e=!0;return Promise.resolve().then(()=>{if(!e)return;const n=h==null?void 0:h.current;(n&&f.contains(n)?n:f).focus({preventScroll:!0})}),()=>{e=!1}},[q,h,r,f,b]),t.useEffect(()=>{var Z;const e=Q.current;Q.current=r;const n=F.current,R=P?e!==r&&(n==null?void 0:n.open)===r?n.reason:"programmatic":D.current;if(F.current=null,r){D.current="programmatic",C.current=null;return}const y=a==null?void 0:a.activeElement,L=C.current,N=(Z=a==null?void 0:a.defaultView)==null?void 0:Z.HTMLElement,Ie=R==="outside"&&N&&L instanceof N&&y instanceof N&&(L===y||L.contains(y));e&&!b&&w&&!Ie&&(u==null||u.focus({preventScroll:!0})),C.current=null},[fe,P,r,a,w,b,u]),t.useEffect(()=>{T&&r&&g(!1,"programmatic")},[T,r,g]);function Te(e){var n;if(E){e.preventDefault(),e.stopPropagation();return}(n=s.onClick)==null||n.call(s,e),!e.defaultPrevented&&g(!r,"trigger")}function xe(e){var n;(n=s.onKeyDown)==null||n.call(s,e),!(e.defaultPrevented||E||Le(e.currentTarget)||e.key!=="Enter"&&e.key!==" ")&&(e.preventDefault(),e.currentTarget.click())}if(T)return d;const j=typeof d.type=="string",v=j?d.type:null,W=v==="a"&&typeof s.href=="string",X=j&&!(v==="button"||v==="input"||v==="select"||v==="summary"||v==="textarea"||W),Y=W&&E,ke=t.cloneElement(d,{"aria-controls":r?Ce.mergeIdentifiers(s["aria-controls"],V):s["aria-controls"],"aria-expanded":r,"aria-haspopup":s["aria-haspopup"]??Ne(z),"aria-disabled":E?!0:s["aria-disabled"],className:[s.className,"nk-popover__trigger"].filter(Boolean).join(" "),href:Y?void 0:s.href,id:U,onClick:Te,onKeyDown:j?xe:s.onKeyDown,ref:ve,role:s.role??(Y?"link":X?"button":void 0),tabIndex:E?-1:s.tabIndex??(X?0:void 0)});return l.jsxs(l.Fragment,{children:[ke,l.jsx(m.FocusScopeContext.Provider,{value:r&&b?Re:ue,children:I.present&&a?l.jsx(m.Portal,{children:l.jsxs(we.Surface,{...ce,ref:ye,"aria-hidden":r?void 0:!0,"aria-label":r?B:void 0,"aria-labelledby":r?ee??(B===void 0?U:void 0):void 0,className:["nk-popover",re].filter(Boolean).join(" "),"data-placement":(p==null?void 0:p.placement)??K,"data-state":I.state==="closing"?"closing":"open",id:V,role:r?z:void 0,style:p?{...A,"--nk-popover-arrow-offset":`${p.arrowOffset}px`,left:p.left,top:p.top,zIndex:O.zIndex}:{...A,visibility:"hidden",zIndex:O.zIndex},tabIndex:ie??-1,children:[l.jsx(De,{inert:!r,panelElement:f}),l.jsx("span",{"aria-hidden":"true",className:"nk-popover__arrow"}),l.jsx("div",{className:"nk-popover__content",children:te})]})}):null})]})});exports.default=_e;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),t=require("react"),Oe=require("./aria-Bntn6ad_.cjs"),qe=require("./effects-D85L_7zM.cjs"),M=require("./reference-C2guRuR0.cjs"),b=require("./usePresence-B5RYv4e1.cjs"),we=require("./useFloatingPosition-GzkP9dCc.cjs"),De=require("./useFocusTrap-BrFZdMqQ.cjs"),Fe=require("./Surface-BttJYSDt.cjs");function je(o){const{inert:i,panelElement:c}=o;return qe.useIsomorphicLayoutEffect(()=>{c&&(c.inert=i)},[i,c]),null}function Le(o,i,c){i.current=o,M.assignElementReference(c,o)}function Ne(o,i,c){i.current=o,M.assignElementReference(c,o)}function _e(o){const i=o.tagName.toLowerCase();return o.getAttribute("role")==="button"&&i!=="button"?!1:["button","input","select","summary","textarea"].includes(i)?!0:i==="a"&&o.hasAttribute("href")}function Be(o){return o==="grid"||o==="listbox"||o==="menu"||o==="tree"?o:"dialog"}const Me=t.forwardRef(function(i,c){const{"aria-label":K,"aria-labelledby":re,autoFocus:D=!0,children:ne,className:se,closeOnEscape:oe=!0,closeOnOutsideInteraction:ae=!0,defaultOpen:ie=!1,disabled:x=!1,initialFocusReference:E,onEscapeKeyDown:ce,onOpenChange:k,onPointerDownOutside:I,open:z,placement:A="bottom",restoreFocus:F=!0,role:H="dialog",style:V,tabIndex:ue,trapFocus:v=!1,trigger:d,...le}=i;if(d.type===t.Fragment)throw new Error("Popover requires a single non-Fragment trigger");const $=t.useId(),de=t.useContext(b.FocusScopeContext),U=`${$}-popover`,s=d.props,G=M.getElementReference(d),J=s.id??`${$}-trigger`,P=x||s.disabled===!0||s["aria-disabled"]===!0||s["aria-disabled"]==="true",R=z!==void 0,[fe,pe]=t.useState(ie),r=R?z:fe,C=b.usePresence(r),Q=t.useRef(null),W=t.useRef(null),j=t.useRef("programmatic"),L=t.useRef(null),X=t.useRef(r),T=t.useRef(null),[ge,me]=t.useReducer(e=>e+1,0),[u,be]=t.useState(null),[f,ve]=t.useState(null),a=(u==null?void 0:u.ownerDocument)??(typeof document>"u"?null:document),S=b.useBoundary("Popover").boundaryElement,O=b.useOverlayLayer(C.present,S),ye=t.useMemo(()=>[Q,W],[]),p=we.useFloatingPosition(C.present,A,u,f,S),he=t.useCallback(e=>{Ne(e,Q,G),be(e)},[G]),Ee=t.useCallback(e=>{Le(e,W,c),ve(e)},[c]),g=t.useCallback((e,n)=>{r!==e&&(R?(L.current={open:e,reason:n},me()):(j.current=n,pe(e)),k==null||k(e,n))},[R,k,r]),Pe=t.useCallback(()=>{g(!1,"escape")},[g]),Re=t.useCallback(()=>{g(!1,"outside")},[g]),Te=t.useCallback(e=>{var m;if(I==null||I(e),e.defaultPrevented)return;const n=(m=a==null?void 0:a.defaultView)==null?void 0:m.HTMLElement;n?T.current=e.composedPath().find(h=>h instanceof n&&h.tabIndex>=0)??e.target:T.current=e.target},[I,a]);b.useDismissableLayer({boundary:S,active:r,boundaries:ye,dismissOnEscape:oe,dismissOnPointerDownOutside:ae,layerId:O.id,onEscapeDismiss:Pe,onEscapeKeyDown:ce,onPointerDownOutside:Te,onPointerDownOutsideDismiss:Re,ownerDocument:a});const xe=De.useFocusTrap({boundary:S,active:r&&v,autoFocus:D,container:f,initialFocusReference:E,layerId:O.id,restoreFocus:F});t.useEffect(()=>{if(!r||v||!D||!f)return;let e=!0;return Promise.resolve().then(()=>{if(!e)return;const n=E==null?void 0:E.current;(n&&f.contains(n)?n:f).focus({preventScroll:!0})}),()=>{e=!1}},[D,E,r,f,v]),t.useEffect(()=>{var te;const e=X.current;X.current=r;const n=L.current;let m=j.current;if(R&&(m="programmatic",e!==r&&(n==null?void 0:n.open)===r&&(m=n.reason)),L.current=null,r){j.current="programmatic",T.current=null;return}const h=a==null?void 0:a.activeElement,_=T.current,B=(te=a==null?void 0:a.defaultView)==null?void 0:te.HTMLElement,Se=m==="outside"&&B&&_ instanceof B&&h instanceof B&&(_===h||_.contains(h));e&&!v&&F&&!Se&&(u==null||u.focus({preventScroll:!0})),T.current=null},[ge,R,r,a,F,v,u]),t.useEffect(()=>{x&&r&&g(!1,"programmatic")},[x,r,g]);function ke(e){var n;if(P){e.preventDefault(),e.stopPropagation();return}(n=s.onClick)==null||n.call(s,e),!e.defaultPrevented&&g(!r,"trigger")}function Ie(e){var n;(n=s.onKeyDown)==null||n.call(s,e),!(e.defaultPrevented||P||_e(e.currentTarget)||e.key!=="Enter"&&e.key!==" ")&&(e.preventDefault(),e.currentTarget.click())}if(x)return d;const N=typeof d.type=="string",y=N?d.type:null,Y=y==="a"&&typeof s.href=="string",Z=N&&!(y==="button"||y==="input"||y==="select"||y==="summary"||y==="textarea"||Y),ee=Y&&P;let q=s.role;q===void 0&&(ee?q="link":Z&&(q="button"));let w=s.tabIndex;w===void 0&&Z&&(w=0),P&&(w=-1);const Ce=t.cloneElement(d,{"aria-controls":r?Oe.mergeIdentifiers(s["aria-controls"],U):s["aria-controls"],"aria-expanded":r,"aria-haspopup":s["aria-haspopup"]??Be(H),"aria-disabled":P?!0:s["aria-disabled"],className:[s.className,"nk-popover__trigger"].filter(Boolean).join(" "),href:ee?void 0:s.href,id:J,onClick:ke,onKeyDown:N?Ie:s.onKeyDown,ref:he,role:q,tabIndex:w});return l.jsxs(l.Fragment,{children:[Ce,l.jsx(b.FocusScopeContext.Provider,{value:r&&v?xe:de,children:C.present&&a?l.jsx(b.Portal,{children:l.jsxs(Fe.Surface,{...le,ref:Ee,"aria-hidden":r?void 0:!0,"aria-label":r?K:void 0,"aria-labelledby":r?re??(K===void 0?J:void 0):void 0,className:["nk-popover",se].filter(Boolean).join(" "),"data-placement":(p==null?void 0:p.placement)??A,"data-state":C.state==="closing"?"closing":"open",id:U,role:r?H:void 0,style:p?{...V,"--nk-popover-arrow-offset":`${p.arrowOffset}px`,left:p.left,top:p.top,zIndex:O.zIndex}:{...V,visibility:"hidden",zIndex:O.zIndex},tabIndex:ue??-1,children:[l.jsx(je,{inert:!r,panelElement:f}),l.jsx("span",{"aria-hidden":"true",className:"nk-popover__arrow"}),l.jsx("div",{className:"nk-popover__content",children:ne})]})}):null})]})});exports.default=Me;