@optimum-intelligence/opti-ui 0.4.0 → 0.5.1

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 (36) hide show
  1. package/README.md +9 -7
  2. package/dist/components/app-shell/AppShell.d.ts +75 -6
  3. package/dist/components/app-shell/AppShell.js +670 -185
  4. package/dist/components/app-shell/AppShell.js.map +1 -1
  5. package/dist/components/badge/Badge.d.ts +2 -4
  6. package/dist/components/badge/Badge.js +12 -29
  7. package/dist/components/badge/Badge.js.map +1 -1
  8. package/dist/components/calendar/Calendar.d.ts +19 -8
  9. package/dist/components/calendar/Calendar.js +285 -212
  10. package/dist/components/calendar/Calendar.js.map +1 -1
  11. package/dist/components/calendar/DateConfig.d.ts +37 -0
  12. package/dist/components/calendar/DateConfig.js +75 -0
  13. package/dist/components/calendar/DateConfig.js.map +1 -0
  14. package/dist/components/calendar/date-utils.d.ts +41 -6
  15. package/dist/components/calendar/date-utils.js +119 -20
  16. package/dist/components/calendar/date-utils.js.map +1 -1
  17. package/dist/components/data-table/DataTableContent.js +3 -3
  18. package/dist/components/data-table/DataTableContent.js.map +1 -1
  19. package/dist/components/date-picker/DatePicker.d.ts +33 -10
  20. package/dist/components/date-picker/DatePicker.js +315 -279
  21. package/dist/components/date-picker/DatePicker.js.map +1 -1
  22. package/dist/components/date-picker/DateRangePicker.d.ts +11 -4
  23. package/dist/components/date-picker/DateRangePicker.js +240 -206
  24. package/dist/components/date-picker/DateRangePicker.js.map +1 -1
  25. package/dist/components/date-picker/PickerField.js +1 -1
  26. package/dist/components/date-picker/PickerField.js.map +1 -1
  27. package/dist/components/table/Table.d.ts +1 -1
  28. package/dist/components/table/Table.js +2 -2
  29. package/dist/components/table/Table.js.map +1 -1
  30. package/dist/components.json +2023 -1864
  31. package/dist/index.d.ts +1 -0
  32. package/dist/index.js +4 -3
  33. package/dist/llms-full.txt +869 -752
  34. package/dist/llms.txt +37 -35
  35. package/dist/opti-ui.css +171 -81
  36. package/package.json +1 -1
@@ -2,16 +2,19 @@
2
2
  import { usePortalContainer } from "../../utils/portal.js";
3
3
  import { cx } from "../../utils/cx.js";
4
4
  import { createPrimitive } from "../../utils/primitive.js";
5
- import { ChevronLeftIcon, MenuIcon, XIcon } from "../../icons/index.js";
5
+ import { ChevronLeftIcon, ChevronRightIcon, MenuIcon, XIcon } from "../../icons/index.js";
6
6
  import { c } from "react/compiler-runtime";
7
7
  import * as React from "react";
8
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
+ import { Collapsible } from "@base-ui/react/collapsible";
9
10
  import { Dialog } from "@base-ui/react/dialog";
10
11
  import { useRender } from "@base-ui/react/use-render";
11
12
  import { mergeProps } from "@base-ui/react/merge-props";
12
13
  //#region src/components/app-shell/AppShell.tsx
13
14
  var NavbarCollapsedContext = React.createContext(false);
14
15
  var NavbarDrawerContext = React.createContext(false);
16
+ var NavbarNestedContext = React.createContext(false);
17
+ var PinnedRegistryContext = React.createContext(null);
15
18
  /**
16
19
  * Collapsible side navigation. Use inside `AppShell`. Compose with `NavbarHeader` (`NavbarBrand`),
17
20
  * `NavbarSection` (`NavbarSectionLabel`, `NavbarItem`) and `NavbarFooter`.
@@ -251,90 +254,453 @@ function NavbarBrand(t0) {
251
254
  }
252
255
  /**
253
256
  * Navigation link. Renders an `<a>`; use `render={<Link to="…" />}` for a
254
- * router link or `render={<button />}` for an action.
257
+ * router link or `render={<button />}` for an action. Inside a `NavbarGroup` it becomes an indented sub-link.
255
258
  */
256
259
  function NavbarItem(t0) {
257
- const $ = c(17);
258
- const { icon, active: t1, badge, render, children, ref, ...props } = t0;
260
+ const $ = c(46);
261
+ let badge;
262
+ let children;
263
+ let icon;
264
+ let props;
265
+ let ref;
266
+ let render;
267
+ let t1;
268
+ let t2;
269
+ if ($[0] !== t0) {
270
+ ({icon, active: t1, badge, pinned: t2, render, children, ref, ...props} = t0);
271
+ $[0] = t0;
272
+ $[1] = badge;
273
+ $[2] = children;
274
+ $[3] = icon;
275
+ $[4] = props;
276
+ $[5] = ref;
277
+ $[6] = render;
278
+ $[7] = t1;
279
+ $[8] = t2;
280
+ } else {
281
+ badge = $[1];
282
+ children = $[2];
283
+ icon = $[3];
284
+ props = $[4];
285
+ ref = $[5];
286
+ render = $[6];
287
+ t1 = $[7];
288
+ t2 = $[8];
289
+ }
259
290
  const active = t1 === void 0 ? false : t1;
291
+ const pinned = t2 === void 0 ? false : t2;
260
292
  const collapsed = React.useContext(NavbarCollapsedContext);
261
- let t2;
262
- if ($[0] !== active) {
263
- t2 = { active };
264
- $[0] = active;
265
- $[1] = t2;
266
- } else t2 = $[1];
267
- const state = t2;
268
- const t3 = "a";
293
+ const nested = React.useContext(NavbarNestedContext);
294
+ const inDrawer = React.useContext(NavbarDrawerContext);
295
+ const registry = React.useContext(PinnedRegistryContext);
296
+ const register = pinned && !inDrawer ? registry : null;
297
+ const id = React.useId();
298
+ const nodeRef = React.useRef(null);
299
+ let t3;
300
+ if ($[9] !== active || $[10] !== children || $[11] !== icon || $[12] !== id || $[13] !== props || $[14] !== register || $[15] !== render) {
301
+ t3 = () => {
302
+ if (!register) return;
303
+ const { className: _className, style: _style, title: _title, ...rest } = props;
304
+ register(id, {
305
+ node: nodeRef.current,
306
+ icon,
307
+ label: children,
308
+ active,
309
+ render,
310
+ props: rest
311
+ });
312
+ };
313
+ $[9] = active;
314
+ $[10] = children;
315
+ $[11] = icon;
316
+ $[12] = id;
317
+ $[13] = props;
318
+ $[14] = register;
319
+ $[15] = render;
320
+ $[16] = t3;
321
+ } else t3 = $[16];
322
+ React.useEffect(t3);
269
323
  let t4;
270
- if ($[2] !== icon) {
271
- t4 = icon && /* @__PURE__ */ jsx("span", {
324
+ let t5;
325
+ if ($[17] !== id || $[18] !== register) {
326
+ t4 = () => {
327
+ if (register) return () => register(id, null);
328
+ };
329
+ t5 = [register, id];
330
+ $[17] = id;
331
+ $[18] = register;
332
+ $[19] = t4;
333
+ $[20] = t5;
334
+ } else {
335
+ t4 = $[19];
336
+ t5 = $[20];
337
+ }
338
+ React.useEffect(t4, t5);
339
+ let t6;
340
+ if ($[21] !== active) {
341
+ t6 = { active };
342
+ $[21] = active;
343
+ $[22] = t6;
344
+ } else t6 = $[22];
345
+ const state = t6;
346
+ let t7;
347
+ if ($[23] !== ref) {
348
+ t7 = [ref, nodeRef];
349
+ $[23] = ref;
350
+ $[24] = t7;
351
+ } else t7 = $[24];
352
+ const t8 = t7;
353
+ const t9 = active ? "page" : void 0;
354
+ const t10 = collapsed && typeof children === "string" ? children : void 0;
355
+ let t11;
356
+ if ($[25] !== icon || $[26] !== nested) {
357
+ t11 = icon && !nested && /* @__PURE__ */ jsx("span", {
272
358
  className: "oui-navbar__item-icon",
273
359
  children: icon
274
360
  });
275
- $[2] = icon;
276
- $[3] = t4;
277
- } else t4 = $[3];
278
- let t5;
279
- if ($[4] !== children) {
280
- t5 = /* @__PURE__ */ jsx("span", {
361
+ $[25] = icon;
362
+ $[26] = nested;
363
+ $[27] = t11;
364
+ } else t11 = $[27];
365
+ let t12;
366
+ if ($[28] !== children) {
367
+ t12 = /* @__PURE__ */ jsx("span", {
281
368
  className: "oui-navbar__item-label",
282
369
  children
283
370
  });
284
- $[4] = children;
285
- $[5] = t5;
286
- } else t5 = $[5];
287
- let t6;
288
- if ($[6] !== badge) {
289
- t6 = badge != null && /* @__PURE__ */ jsx("span", {
371
+ $[28] = children;
372
+ $[29] = t12;
373
+ } else t12 = $[29];
374
+ let t13;
375
+ if ($[30] !== badge) {
376
+ t13 = badge != null && /* @__PURE__ */ jsx("span", {
290
377
  className: "oui-navbar__item-badge",
291
378
  children: badge
292
379
  });
293
- $[6] = badge;
294
- $[7] = t6;
295
- } else t6 = $[7];
296
- let t7;
297
- if ($[8] !== t4 || $[9] !== t5 || $[10] !== t6) {
298
- t7 = /* @__PURE__ */ jsxs(Fragment, { children: [
299
- t4,
300
- t5,
301
- t6
380
+ $[30] = badge;
381
+ $[31] = t13;
382
+ } else t13 = $[31];
383
+ let t14;
384
+ if ($[32] !== t11 || $[33] !== t12 || $[34] !== t13) {
385
+ t14 = /* @__PURE__ */ jsxs(Fragment, { children: [
386
+ t11,
387
+ t12,
388
+ t13
302
389
  ] });
303
- $[8] = t4;
304
- $[9] = t5;
305
- $[10] = t6;
306
- $[11] = t7;
307
- } else t7 = $[11];
308
- const t8 = mergeProps({
309
- className: "oui-navbar__item",
310
- "aria-current": active ? "page" : void 0,
311
- title: collapsed && typeof children === "string" ? children : void 0,
312
- children: t7
313
- }, props);
314
- let t9;
315
- if ($[12] !== ref || $[13] !== render || $[14] !== state || $[15] !== t8) {
316
- t9 = {
317
- defaultTagName: t3,
390
+ $[32] = t11;
391
+ $[33] = t12;
392
+ $[34] = t13;
393
+ $[35] = t14;
394
+ } else t14 = $[35];
395
+ let t15;
396
+ if ($[36] !== props || $[37] !== t10 || $[38] !== t14 || $[39] !== t9) {
397
+ t15 = mergeProps({
398
+ className: "oui-navbar__item",
399
+ "aria-current": t9,
400
+ title: t10,
401
+ children: t14
402
+ }, props);
403
+ $[36] = props;
404
+ $[37] = t10;
405
+ $[38] = t14;
406
+ $[39] = t9;
407
+ $[40] = t15;
408
+ } else t15 = $[40];
409
+ let t16;
410
+ if ($[41] !== render || $[42] !== state || $[43] !== t15 || $[44] !== t8) {
411
+ t16 = {
412
+ defaultTagName: "a",
318
413
  render,
414
+ ref: t8,
415
+ state,
416
+ props: t15
417
+ };
418
+ $[41] = render;
419
+ $[42] = state;
420
+ $[43] = t15;
421
+ $[44] = t8;
422
+ $[45] = t16;
423
+ } else t16 = $[45];
424
+ return useRender(t16);
425
+ }
426
+ function hasActiveItem(children) {
427
+ return React.Children.toArray(children).some((child) => React.isValidElement(child) && (child.props.active === true || (child.type === React.Fragment || child.type === NavbarGroup) && hasActiveItem(child.props.children)));
428
+ }
429
+ /**
430
+ * Expandable parent row in a `Navbar` with nested `NavbarItem` sub-links. Place it in a `NavbarSection`
431
+ * next to other items. On a collapsed rail the sub-links are hidden and the parent shows as active when
432
+ * one of them is; the hover peek shows the full tree.
433
+ *
434
+ * @example
435
+ * <NavbarSection>
436
+ * <NavbarGroup icon={<Truck />} label="Fleet">
437
+ * <NavbarItem href="/fleet/vehicles" active>Vehicles</NavbarItem>
438
+ * <NavbarItem href="/fleet/drivers">Drivers</NavbarItem>
439
+ * </NavbarGroup>
440
+ * </NavbarSection>
441
+ */
442
+ function NavbarGroup(t0) {
443
+ const $ = c(43);
444
+ let badge;
445
+ let children;
446
+ let className;
447
+ let defaultOpen;
448
+ let icon;
449
+ let label;
450
+ let onOpenChange;
451
+ let openProp;
452
+ let props;
453
+ let ref;
454
+ if ($[0] !== t0) {
455
+ ({label, icon, badge, open: openProp, defaultOpen, onOpenChange, className, children, ref, ...props} = t0);
456
+ $[0] = t0;
457
+ $[1] = badge;
458
+ $[2] = children;
459
+ $[3] = className;
460
+ $[4] = defaultOpen;
461
+ $[5] = icon;
462
+ $[6] = label;
463
+ $[7] = onOpenChange;
464
+ $[8] = openProp;
465
+ $[9] = props;
466
+ $[10] = ref;
467
+ } else {
468
+ badge = $[1];
469
+ children = $[2];
470
+ className = $[3];
471
+ defaultOpen = $[4];
472
+ icon = $[5];
473
+ label = $[6];
474
+ onOpenChange = $[7];
475
+ openProp = $[8];
476
+ props = $[9];
477
+ ref = $[10];
478
+ }
479
+ const collapsed = React.useContext(NavbarCollapsedContext);
480
+ let t1;
481
+ if ($[11] !== children) {
482
+ t1 = hasActiveItem(children);
483
+ $[11] = children;
484
+ $[12] = t1;
485
+ } else t1 = $[12];
486
+ const hasActive = t1;
487
+ const [internal, setInternal] = React.useState(defaultOpen ?? hasActive);
488
+ const [prevActive, setPrevActive] = React.useState(hasActive);
489
+ if (hasActive !== prevActive) {
490
+ setPrevActive(hasActive);
491
+ if (hasActive) setInternal(true);
492
+ }
493
+ const open = openProp ?? internal;
494
+ let t2;
495
+ if ($[13] !== onOpenChange || $[14] !== openProp) {
496
+ t2 = (next) => {
497
+ if (openProp === void 0) setInternal(next);
498
+ onOpenChange?.(next);
499
+ };
500
+ $[13] = onOpenChange;
501
+ $[14] = openProp;
502
+ $[15] = t2;
503
+ } else t2 = $[15];
504
+ const setOpen = t2;
505
+ let t3;
506
+ if ($[16] !== className) {
507
+ t3 = cx("oui-navbar__group", className);
508
+ $[16] = className;
509
+ $[17] = t3;
510
+ } else t3 = $[17];
511
+ const t4 = open ? "" : void 0;
512
+ const t5 = open ? "" : void 0;
513
+ const t6 = hasActive && (collapsed || !open) ? "" : void 0;
514
+ const t7 = collapsed && typeof label === "string" ? label : void 0;
515
+ let t8;
516
+ if ($[18] !== icon) {
517
+ t8 = icon && /* @__PURE__ */ jsx("span", {
518
+ className: "oui-navbar__item-icon",
519
+ children: icon
520
+ });
521
+ $[18] = icon;
522
+ $[19] = t8;
523
+ } else t8 = $[19];
524
+ let t9;
525
+ if ($[20] !== label) {
526
+ t9 = /* @__PURE__ */ jsx("span", {
527
+ className: "oui-navbar__item-label",
528
+ children: label
529
+ });
530
+ $[20] = label;
531
+ $[21] = t9;
532
+ } else t9 = $[21];
533
+ let t10;
534
+ if ($[22] !== badge) {
535
+ t10 = badge != null && /* @__PURE__ */ jsx("span", {
536
+ className: "oui-navbar__item-badge",
537
+ children: badge
538
+ });
539
+ $[22] = badge;
540
+ $[23] = t10;
541
+ } else t10 = $[23];
542
+ let t11;
543
+ if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
544
+ t11 = /* @__PURE__ */ jsx(ChevronRightIcon, { className: "oui-navbar__item-chevron" });
545
+ $[24] = t11;
546
+ } else t11 = $[24];
547
+ let t12;
548
+ if ($[25] !== t10 || $[26] !== t5 || $[27] !== t6 || $[28] !== t7 || $[29] !== t8 || $[30] !== t9) {
549
+ t12 = /* @__PURE__ */ jsxs(Collapsible.Trigger, {
550
+ className: "oui-navbar__item",
551
+ "data-has-children": "",
552
+ "data-open": t5,
553
+ "data-active": t6,
554
+ title: t7,
555
+ children: [
556
+ t8,
557
+ t9,
558
+ t10,
559
+ t11
560
+ ]
561
+ });
562
+ $[25] = t10;
563
+ $[26] = t5;
564
+ $[27] = t6;
565
+ $[28] = t7;
566
+ $[29] = t8;
567
+ $[30] = t9;
568
+ $[31] = t12;
569
+ } else t12 = $[31];
570
+ let t13;
571
+ if ($[32] !== children) {
572
+ t13 = /* @__PURE__ */ jsx(Collapsible.Panel, {
573
+ className: "oui-navbar__group-panel",
574
+ keepMounted: true,
575
+ children: /* @__PURE__ */ jsx("div", {
576
+ className: "oui-navbar__group-items",
577
+ children: /* @__PURE__ */ jsx(NavbarNestedContext, {
578
+ value: true,
579
+ children
580
+ })
581
+ })
582
+ });
583
+ $[32] = children;
584
+ $[33] = t13;
585
+ } else t13 = $[33];
586
+ let t14;
587
+ if ($[34] !== open || $[35] !== props || $[36] !== ref || $[37] !== setOpen || $[38] !== t12 || $[39] !== t13 || $[40] !== t3 || $[41] !== t4) {
588
+ t14 = /* @__PURE__ */ jsxs(Collapsible.Root, {
319
589
  ref,
590
+ className: t3,
591
+ open,
592
+ onOpenChange: setOpen,
593
+ "data-open": t4,
594
+ ...props,
595
+ children: [t12, t13]
596
+ });
597
+ $[34] = open;
598
+ $[35] = props;
599
+ $[36] = ref;
600
+ $[37] = setOpen;
601
+ $[38] = t12;
602
+ $[39] = t13;
603
+ $[40] = t3;
604
+ $[41] = t4;
605
+ $[42] = t14;
606
+ } else t14 = $[42];
607
+ return t14;
608
+ }
609
+ var MAX_PINNED = 4;
610
+ function byDocumentOrder(a, b) {
611
+ if (!a.node || !b.node) return 0;
612
+ return a.node.compareDocumentPosition(b.node) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
613
+ }
614
+ function PinnedTab(t0) {
615
+ const $ = c(18);
616
+ const { entry } = t0;
617
+ let t1;
618
+ if ($[0] !== entry.active) {
619
+ t1 = { active: entry.active };
620
+ $[0] = entry.active;
621
+ $[1] = t1;
622
+ } else t1 = $[1];
623
+ const state = t1;
624
+ const t2 = entry.render;
625
+ const t3 = entry.active ? "page" : void 0;
626
+ const t4 = typeof entry.label === "string" ? entry.label : void 0;
627
+ let t5;
628
+ if ($[2] !== entry.icon) {
629
+ t5 = /* @__PURE__ */ jsx("span", {
630
+ className: "oui-app-shell__tab-icon",
631
+ children: entry.icon
632
+ });
633
+ $[2] = entry.icon;
634
+ $[3] = t5;
635
+ } else t5 = $[3];
636
+ let t6;
637
+ if ($[4] !== entry.label) {
638
+ t6 = /* @__PURE__ */ jsx("span", {
639
+ className: "oui-app-shell__tab-label",
640
+ children: entry.label
641
+ });
642
+ $[4] = entry.label;
643
+ $[5] = t6;
644
+ } else t6 = $[5];
645
+ let t7;
646
+ if ($[6] !== t5 || $[7] !== t6) {
647
+ t7 = /* @__PURE__ */ jsxs(Fragment, { children: [t5, t6] });
648
+ $[6] = t5;
649
+ $[7] = t6;
650
+ $[8] = t7;
651
+ } else t7 = $[8];
652
+ let t8;
653
+ if ($[9] !== entry.props || $[10] !== t3 || $[11] !== t4 || $[12] !== t7) {
654
+ t8 = mergeProps({
655
+ className: "oui-app-shell__tab",
656
+ "aria-current": t3,
657
+ title: t4,
658
+ children: t7
659
+ }, entry.props);
660
+ $[9] = entry.props;
661
+ $[10] = t3;
662
+ $[11] = t4;
663
+ $[12] = t7;
664
+ $[13] = t8;
665
+ } else t8 = $[13];
666
+ let t9;
667
+ if ($[14] !== entry.render || $[15] !== state || $[16] !== t8) {
668
+ t9 = {
669
+ defaultTagName: "a",
670
+ render: t2,
320
671
  state,
321
672
  props: t8
322
673
  };
323
- $[12] = ref;
324
- $[13] = render;
325
- $[14] = state;
326
- $[15] = t8;
327
- $[16] = t9;
328
- } else t9 = $[16];
674
+ $[14] = entry.render;
675
+ $[15] = state;
676
+ $[16] = t8;
677
+ $[17] = t9;
678
+ } else t9 = $[17];
329
679
  return useRender(t9);
330
680
  }
331
681
  /**
332
682
  * Full-height layout with a fixed navbar and an internally scrolling main
333
- * area. Below 900px the navbar moves into a slide-in drawer.
683
+ * area. Below 900px the navbar moves into a slide-in drawer, and `NavbarItem`s marked `pinned` show in a
684
+ * tab bar (see `mobileNavPosition`).
334
685
  * Customize width with `--oui-navbar-width` and `--oui-navbar-collapsed-width`.
686
+ *
687
+ * @example
688
+ * <AppShell
689
+ * mobileBrand="OptiControl"
690
+ * navbar={
691
+ * <Navbar>
692
+ * <NavbarSection>
693
+ * <NavbarItem href="/" icon={<Home />} active pinned>Overview</NavbarItem>
694
+ * <NavbarItem href="/fleet" icon={<Truck />} pinned>Fleet</NavbarItem>
695
+ * </NavbarSection>
696
+ * </Navbar>
697
+ * }
698
+ * >
699
+ * <PageHeader title="Overview" />
700
+ * </AppShell>
335
701
  */
336
702
  function AppShell(t0) {
337
- const $ = c(48);
703
+ const $ = c(77);
338
704
  let children;
339
705
  let className;
340
706
  let mainProps;
@@ -344,8 +710,11 @@ function AppShell(t0) {
344
710
  let props;
345
711
  let ref;
346
712
  let t1;
713
+ let t2;
714
+ let t3;
715
+ let t4;
347
716
  if ($[0] !== t0) {
348
- ({navbar, mobileBrand, mobileActions, menuLabel: t1, mainProps, className, children, ref, ...props} = t0);
717
+ ({navbar, mobileBrand, mobileActions, mobileNavPosition: t1, menuLabel: t2, moreLabel: t3, moreTabPosition: t4, mainProps, className, children, ref, ...props} = t0);
349
718
  $[0] = t0;
350
719
  $[1] = children;
351
720
  $[2] = className;
@@ -356,6 +725,9 @@ function AppShell(t0) {
356
725
  $[7] = props;
357
726
  $[8] = ref;
358
727
  $[9] = t1;
728
+ $[10] = t2;
729
+ $[11] = t3;
730
+ $[12] = t4;
359
731
  } else {
360
732
  children = $[1];
361
733
  className = $[2];
@@ -366,162 +738,275 @@ function AppShell(t0) {
366
738
  props = $[7];
367
739
  ref = $[8];
368
740
  t1 = $[9];
741
+ t2 = $[10];
742
+ t3 = $[11];
743
+ t4 = $[12];
369
744
  }
370
- const menuLabel = t1 === void 0 ? "Open navigation" : t1;
745
+ const mobileNavPosition = t1 === void 0 ? "bottom" : t1;
746
+ const menuLabel = t2 === void 0 ? "Open navigation" : t2;
747
+ const moreLabel = t3 === void 0 ? "More" : t3;
748
+ const moreTabPosition = t4 === void 0 ? "start" : t4;
371
749
  const [open, setOpen] = React.useState(false);
372
750
  const container = usePortalContainer();
373
- let t2;
374
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
375
- t2 = (event) => {
376
- if (event.target.closest("a, .oui-navbar__item")) setOpen(false);
377
- };
378
- $[10] = t2;
379
- } else t2 = $[10];
380
- const closeOnNavigate = t2;
381
- let t3;
382
- if ($[11] !== className) {
383
- t3 = cx("oui-app-shell", className);
384
- $[11] = className;
385
- $[12] = t3;
386
- } else t3 = $[12];
387
- let t4;
388
- if ($[13] !== navbar) {
389
- t4 = /* @__PURE__ */ jsx("div", {
390
- className: "oui-app-shell__navbar",
391
- children: navbar
392
- });
393
- $[13] = navbar;
394
- $[14] = t4;
395
- } else t4 = $[14];
396
751
  let t5;
397
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
398
- t5 = /* @__PURE__ */ jsx(MenuIcon, {});
399
- $[15] = t5;
400
- } else t5 = $[15];
752
+ if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
753
+ t5 = /* @__PURE__ */ new Map();
754
+ $[13] = t5;
755
+ } else t5 = $[13];
756
+ const [pinned, setPinned] = React.useState(t5);
401
757
  let t6;
402
- if ($[16] !== menuLabel) {
403
- t6 = /* @__PURE__ */ jsx(Dialog.Trigger, {
404
- className: "oui-app-shell__menu-button",
405
- "aria-label": menuLabel,
406
- children: t5
407
- });
408
- $[16] = menuLabel;
409
- $[17] = t6;
410
- } else t6 = $[17];
758
+ if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
759
+ t6 = () => (id, entry) => {
760
+ setPinned((prev) => {
761
+ const next = new Map(prev);
762
+ if (entry) next.set(id, entry);
763
+ else next.delete(id);
764
+ return next;
765
+ });
766
+ };
767
+ $[14] = t6;
768
+ } else t6 = $[14];
769
+ const [register] = React.useState(t6);
770
+ let hasTabs;
771
+ let moreTab;
772
+ let showTopBar;
773
+ let t10;
774
+ let t11;
411
775
  let t7;
412
- if ($[18] !== mobileBrand) {
413
- t7 = /* @__PURE__ */ jsx("div", {
414
- className: "oui-app-shell__mobile-brand",
415
- children: mobileBrand
416
- });
417
- $[18] = mobileBrand;
418
- $[19] = t7;
419
- } else t7 = $[19];
420
776
  let t8;
421
- if ($[20] !== mobileActions || $[21] !== t6 || $[22] !== t7) {
422
- t8 = /* @__PURE__ */ jsxs("header", {
777
+ let t9;
778
+ if ($[15] !== mobileActions || $[16] !== mobileBrand || $[17] !== mobileNavPosition || $[18] !== moreLabel || $[19] !== moreTabPosition || $[20] !== pinned) {
779
+ const tabs = [...pinned.entries()].sort(_temp).slice(0, MAX_PINNED);
780
+ hasTabs = tabs.length > 0;
781
+ showTopBar = !hasTabs || mobileBrand != null || mobileActions != null;
782
+ let t12;
783
+ if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
784
+ t12 = /* @__PURE__ */ jsx("span", {
785
+ className: "oui-app-shell__tab-icon",
786
+ children: /* @__PURE__ */ jsx(MenuIcon, {})
787
+ });
788
+ $[29] = t12;
789
+ } else t12 = $[29];
790
+ let t13;
791
+ if ($[30] !== moreLabel) {
792
+ t13 = /* @__PURE__ */ jsxs(Dialog.Trigger, {
793
+ className: "oui-app-shell__tab",
794
+ children: [t12, /* @__PURE__ */ jsx("span", {
795
+ className: "oui-app-shell__tab-label",
796
+ children: moreLabel
797
+ })]
798
+ });
799
+ $[30] = moreLabel;
800
+ $[31] = t13;
801
+ } else t13 = $[31];
802
+ moreTab = t13;
803
+ t7 = "oui-app-shell__tabbar";
804
+ t8 = mobileNavPosition;
805
+ t9 = "Quick navigation";
806
+ t10 = moreTabPosition === "start" && moreTab;
807
+ t11 = tabs.map(_temp2);
808
+ $[15] = mobileActions;
809
+ $[16] = mobileBrand;
810
+ $[17] = mobileNavPosition;
811
+ $[18] = moreLabel;
812
+ $[19] = moreTabPosition;
813
+ $[20] = pinned;
814
+ $[21] = hasTabs;
815
+ $[22] = moreTab;
816
+ $[23] = showTopBar;
817
+ $[24] = t10;
818
+ $[25] = t11;
819
+ $[26] = t7;
820
+ $[27] = t8;
821
+ $[28] = t9;
822
+ } else {
823
+ hasTabs = $[21];
824
+ moreTab = $[22];
825
+ showTopBar = $[23];
826
+ t10 = $[24];
827
+ t11 = $[25];
828
+ t7 = $[26];
829
+ t8 = $[27];
830
+ t9 = $[28];
831
+ }
832
+ const t12 = moreTabPosition === "end" && moreTab;
833
+ let t13;
834
+ if ($[32] !== t10 || $[33] !== t11 || $[34] !== t12 || $[35] !== t7 || $[36] !== t8 || $[37] !== t9) {
835
+ t13 = /* @__PURE__ */ jsxs("nav", {
836
+ className: t7,
837
+ "data-position": t8,
838
+ "aria-label": t9,
839
+ children: [
840
+ t10,
841
+ t11,
842
+ t12
843
+ ]
844
+ });
845
+ $[32] = t10;
846
+ $[33] = t11;
847
+ $[34] = t12;
848
+ $[35] = t7;
849
+ $[36] = t8;
850
+ $[37] = t9;
851
+ $[38] = t13;
852
+ } else t13 = $[38];
853
+ const tabbar = t13;
854
+ let t14;
855
+ if ($[39] === Symbol.for("react.memo_cache_sentinel")) {
856
+ t14 = (event) => {
857
+ if (event.target.closest("a, .oui-navbar__item")) setOpen(false);
858
+ };
859
+ $[39] = t14;
860
+ } else t14 = $[39];
861
+ const closeOnNavigate = t14;
862
+ let t15;
863
+ if ($[40] !== className) {
864
+ t15 = cx("oui-app-shell", className);
865
+ $[40] = className;
866
+ $[41] = t15;
867
+ } else t15 = $[41];
868
+ let t16;
869
+ if ($[42] !== navbar || $[43] !== register) {
870
+ t16 = /* @__PURE__ */ jsx("div", {
871
+ className: "oui-app-shell__navbar",
872
+ children: /* @__PURE__ */ jsx(PinnedRegistryContext, {
873
+ value: register,
874
+ children: navbar
875
+ })
876
+ });
877
+ $[42] = navbar;
878
+ $[43] = register;
879
+ $[44] = t16;
880
+ } else t16 = $[44];
881
+ let t17;
882
+ if ($[45] !== hasTabs || $[46] !== menuLabel || $[47] !== mobileActions || $[48] !== mobileBrand || $[49] !== showTopBar) {
883
+ t17 = showTopBar && /* @__PURE__ */ jsxs("header", {
423
884
  className: "oui-app-shell__mobile-bar",
424
885
  children: [
425
- t6,
426
- t7,
886
+ !hasTabs && /* @__PURE__ */ jsx(Dialog.Trigger, {
887
+ className: "oui-app-shell__menu-button",
888
+ "aria-label": menuLabel,
889
+ children: /* @__PURE__ */ jsx(MenuIcon, {})
890
+ }),
891
+ /* @__PURE__ */ jsx("div", {
892
+ className: "oui-app-shell__mobile-brand",
893
+ children: mobileBrand
894
+ }),
427
895
  mobileActions
428
896
  ]
429
897
  });
430
- $[20] = mobileActions;
431
- $[21] = t6;
432
- $[22] = t7;
433
- $[23] = t8;
434
- } else t8 = $[23];
435
- let t9;
436
- if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
437
- t9 = /* @__PURE__ */ jsx(Dialog.Backdrop, { className: "oui-dialog__backdrop" });
438
- $[24] = t9;
439
- } else t9 = $[24];
440
- let t10;
441
- if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
442
- t10 = /* @__PURE__ */ jsx(Dialog.Close, {
898
+ $[45] = hasTabs;
899
+ $[46] = menuLabel;
900
+ $[47] = mobileActions;
901
+ $[48] = mobileBrand;
902
+ $[49] = showTopBar;
903
+ $[50] = t17;
904
+ } else t17 = $[50];
905
+ const t18 = hasTabs && mobileNavPosition === "top" && tabbar;
906
+ const t19 = mainProps?.className;
907
+ let t20;
908
+ if ($[51] !== t19) {
909
+ t20 = cx("oui-app-shell__main", t19);
910
+ $[51] = t19;
911
+ $[52] = t20;
912
+ } else t20 = $[52];
913
+ let t21;
914
+ if ($[53] !== children || $[54] !== mainProps || $[55] !== t20) {
915
+ t21 = /* @__PURE__ */ jsx("main", {
916
+ ...mainProps,
917
+ className: t20,
918
+ children
919
+ });
920
+ $[53] = children;
921
+ $[54] = mainProps;
922
+ $[55] = t20;
923
+ $[56] = t21;
924
+ } else t21 = $[56];
925
+ const t22 = hasTabs && mobileNavPosition === "bottom" && tabbar;
926
+ let t23;
927
+ if ($[57] === Symbol.for("react.memo_cache_sentinel")) {
928
+ t23 = /* @__PURE__ */ jsx(Dialog.Backdrop, { className: "oui-dialog__backdrop" });
929
+ $[57] = t23;
930
+ } else t23 = $[57];
931
+ let t24;
932
+ if ($[58] === Symbol.for("react.memo_cache_sentinel")) {
933
+ t24 = /* @__PURE__ */ jsx(Dialog.Close, {
443
934
  className: "oui-app-shell__drawer-close",
444
935
  "aria-label": "Close navigation",
445
936
  children: /* @__PURE__ */ jsx(XIcon, {})
446
937
  });
447
- $[25] = t10;
448
- } else t10 = $[25];
449
- let t11;
450
- if ($[26] !== navbar) {
451
- t11 = /* @__PURE__ */ jsxs(Dialog.Popup, {
938
+ $[58] = t24;
939
+ } else t24 = $[58];
940
+ let t25;
941
+ if ($[59] !== navbar) {
942
+ t25 = /* @__PURE__ */ jsxs(Dialog.Popup, {
452
943
  className: "oui-app-shell__drawer",
453
944
  "aria-label": "Navigation",
454
945
  onClick: closeOnNavigate,
455
- children: [t10, /* @__PURE__ */ jsx(NavbarDrawerContext, {
946
+ children: [t24, /* @__PURE__ */ jsx(NavbarDrawerContext, {
456
947
  value: true,
457
948
  children: navbar
458
949
  })]
459
950
  });
460
- $[26] = navbar;
461
- $[27] = t11;
462
- } else t11 = $[27];
463
- let t12;
464
- if ($[28] !== container || $[29] !== t11) {
465
- t12 = /* @__PURE__ */ jsxs(Dialog.Portal, {
951
+ $[59] = navbar;
952
+ $[60] = t25;
953
+ } else t25 = $[60];
954
+ let t26;
955
+ if ($[61] !== container || $[62] !== t25) {
956
+ t26 = /* @__PURE__ */ jsxs(Dialog.Portal, {
466
957
  container,
467
- children: [t9, t11]
958
+ children: [t23, t25]
468
959
  });
469
- $[28] = container;
470
- $[29] = t11;
471
- $[30] = t12;
472
- } else t12 = $[30];
473
- let t13;
474
- if ($[31] !== open || $[32] !== t12 || $[33] !== t8) {
475
- t13 = /* @__PURE__ */ jsxs(Dialog.Root, {
960
+ $[61] = container;
961
+ $[62] = t25;
962
+ $[63] = t26;
963
+ } else t26 = $[63];
964
+ let t27;
965
+ if ($[64] !== open || $[65] !== t17 || $[66] !== t18 || $[67] !== t21 || $[68] !== t22 || $[69] !== t26) {
966
+ t27 = /* @__PURE__ */ jsxs(Dialog.Root, {
476
967
  open,
477
968
  onOpenChange: setOpen,
478
- children: [t8, t12]
479
- });
480
- $[31] = open;
481
- $[32] = t12;
482
- $[33] = t8;
483
- $[34] = t13;
484
- } else t13 = $[34];
485
- const t14 = mainProps?.className;
486
- let t15;
487
- if ($[35] !== t14) {
488
- t15 = cx("oui-app-shell__main", t14);
489
- $[35] = t14;
490
- $[36] = t15;
491
- } else t15 = $[36];
492
- let t16;
493
- if ($[37] !== children || $[38] !== mainProps || $[39] !== t15) {
494
- t16 = /* @__PURE__ */ jsx("main", {
495
- ...mainProps,
496
- className: t15,
497
- children
969
+ children: [
970
+ t17,
971
+ t18,
972
+ t21,
973
+ t22,
974
+ t26
975
+ ]
498
976
  });
499
- $[37] = children;
500
- $[38] = mainProps;
501
- $[39] = t15;
502
- $[40] = t16;
503
- } else t16 = $[40];
504
- let t17;
505
- if ($[41] !== props || $[42] !== ref || $[43] !== t13 || $[44] !== t16 || $[45] !== t3 || $[46] !== t4) {
506
- t17 = /* @__PURE__ */ jsxs("div", {
977
+ $[64] = open;
978
+ $[65] = t17;
979
+ $[66] = t18;
980
+ $[67] = t21;
981
+ $[68] = t22;
982
+ $[69] = t26;
983
+ $[70] = t27;
984
+ } else t27 = $[70];
985
+ let t28;
986
+ if ($[71] !== props || $[72] !== ref || $[73] !== t15 || $[74] !== t16 || $[75] !== t27) {
987
+ t28 = /* @__PURE__ */ jsxs("div", {
507
988
  ref,
508
- className: t3,
989
+ className: t15,
509
990
  ...props,
510
- children: [
511
- t4,
512
- t13,
513
- t16
514
- ]
991
+ children: [t16, t27]
515
992
  });
516
- $[41] = props;
517
- $[42] = ref;
518
- $[43] = t13;
519
- $[44] = t16;
520
- $[45] = t3;
521
- $[46] = t4;
522
- $[47] = t17;
523
- } else t17 = $[47];
524
- return t17;
993
+ $[71] = props;
994
+ $[72] = ref;
995
+ $[73] = t15;
996
+ $[74] = t16;
997
+ $[75] = t27;
998
+ $[76] = t28;
999
+ } else t28 = $[76];
1000
+ return t28;
1001
+ }
1002
+ function _temp2(t0) {
1003
+ const [id_0, entry_0] = t0;
1004
+ return /* @__PURE__ */ jsx(PinnedTab, { entry: entry_0 }, id_0);
1005
+ }
1006
+ function _temp(t0, t1) {
1007
+ const [, a] = t0;
1008
+ const [, b] = t1;
1009
+ return byDocumentOrder(a, b);
525
1010
  }
526
1011
  /** Page title block with optional breadcrumbs, eyebrow, description and actions. */
527
1012
  function PageHeader(t0) {
@@ -690,6 +1175,6 @@ function Grid(t0) {
690
1175
  return t4;
691
1176
  }
692
1177
  //#endregion
693
- export { AppShell, Grid, Navbar, NavbarBrand, NavbarFooter, NavbarHeader, NavbarItem, NavbarSection, NavbarSectionLabel, PageHeader };
1178
+ export { AppShell, Grid, Navbar, NavbarBrand, NavbarFooter, NavbarGroup, NavbarHeader, NavbarItem, NavbarSection, NavbarSectionLabel, PageHeader };
694
1179
 
695
1180
  //# sourceMappingURL=AppShell.js.map