@optimum-intelligence/opti-ui 0.3.0 → 0.5.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 (131) hide show
  1. package/README.md +28 -7
  2. package/dist/components/accordion/Accordion.d.ts +12 -0
  3. package/dist/components/accordion/Accordion.js +12 -0
  4. package/dist/components/accordion/Accordion.js.map +1 -1
  5. package/dist/components/alert/Alert.d.ts +4 -0
  6. package/dist/components/alert/Alert.js.map +1 -1
  7. package/dist/components/app-shell/AppShell.d.ts +96 -5
  8. package/dist/components/app-shell/AppShell.js +676 -185
  9. package/dist/components/app-shell/AppShell.js.map +1 -1
  10. package/dist/components/avatar/Avatar.d.ts +8 -0
  11. package/dist/components/avatar/Avatar.js +2 -0
  12. package/dist/components/avatar/Avatar.js.map +1 -1
  13. package/dist/components/badge/Badge.d.ts +10 -3
  14. package/dist/components/badge/Badge.js +17 -28
  15. package/dist/components/badge/Badge.js.map +1 -1
  16. package/dist/components/breadcrumbs/Breadcrumbs.d.ts +1 -0
  17. package/dist/components/breadcrumbs/Breadcrumbs.js.map +1 -1
  18. package/dist/components/button/Button.d.ts +8 -0
  19. package/dist/components/button/Button.js +6 -0
  20. package/dist/components/button/Button.js.map +1 -1
  21. package/dist/components/calendar/Calendar.d.ts +21 -7
  22. package/dist/components/calendar/Calendar.js +285 -212
  23. package/dist/components/calendar/Calendar.js.map +1 -1
  24. package/dist/components/calendar/DateConfig.d.ts +37 -0
  25. package/dist/components/calendar/DateConfig.js +75 -0
  26. package/dist/components/calendar/DateConfig.js.map +1 -0
  27. package/dist/components/calendar/date-utils.d.ts +41 -6
  28. package/dist/components/calendar/date-utils.js +119 -20
  29. package/dist/components/calendar/date-utils.js.map +1 -1
  30. package/dist/components/card/Card.d.ts +13 -0
  31. package/dist/components/card/Card.js +13 -0
  32. package/dist/components/card/Card.js.map +1 -1
  33. package/dist/components/choice/Choice.d.ts +13 -0
  34. package/dist/components/choice/Choice.js +10 -0
  35. package/dist/components/choice/Choice.js.map +1 -1
  36. package/dist/components/combobox/Combobox.d.ts +12 -0
  37. package/dist/components/combobox/Combobox.js.map +1 -1
  38. package/dist/components/command-palette/CommandPalette.d.ts +10 -0
  39. package/dist/components/command-palette/CommandPalette.js.map +1 -1
  40. package/dist/components/data-table/DataTable.d.ts +4 -0
  41. package/dist/components/data-table/DataTable.js.map +1 -1
  42. package/dist/components/data-table/DataTableContent.d.ts +1 -0
  43. package/dist/components/data-table/DataTableContent.js +3 -3
  44. package/dist/components/data-table/DataTableContent.js.map +1 -1
  45. package/dist/components/data-table/DataTableFilters.d.ts +3 -0
  46. package/dist/components/data-table/DataTableFilters.js.map +1 -1
  47. package/dist/components/data-table/types.d.ts +16 -0
  48. package/dist/components/date-picker/DatePicker.d.ts +33 -10
  49. package/dist/components/date-picker/DatePicker.js +315 -279
  50. package/dist/components/date-picker/DatePicker.js.map +1 -1
  51. package/dist/components/date-picker/DateRangePicker.d.ts +12 -4
  52. package/dist/components/date-picker/DateRangePicker.js +240 -206
  53. package/dist/components/date-picker/DateRangePicker.js.map +1 -1
  54. package/dist/components/date-picker/PickerField.d.ts +13 -0
  55. package/dist/components/date-picker/PickerField.js +1 -1
  56. package/dist/components/date-picker/PickerField.js.map +1 -1
  57. package/dist/components/dialog/Dialog.d.ts +5 -0
  58. package/dist/components/dialog/Dialog.js.map +1 -1
  59. package/dist/components/drawer/Drawer.d.ts +10 -0
  60. package/dist/components/drawer/Drawer.js.map +1 -1
  61. package/dist/components/empty-state/EmptyState.d.ts +5 -0
  62. package/dist/components/empty-state/EmptyState.js.map +1 -1
  63. package/dist/components/file-upload/FileUpload.d.ts +21 -0
  64. package/dist/components/file-upload/FileUpload.js.map +1 -1
  65. package/dist/components/input/Input.d.ts +7 -0
  66. package/dist/components/input/Input.js +3 -0
  67. package/dist/components/input/Input.js.map +1 -1
  68. package/dist/components/link/Link.d.ts +1 -0
  69. package/dist/components/link/Link.js.map +1 -1
  70. package/dist/components/menu/Menu.d.ts +6 -0
  71. package/dist/components/menu/Menu.js.map +1 -1
  72. package/dist/components/number-field/NumberField.d.ts +7 -0
  73. package/dist/components/number-field/NumberField.js.map +1 -1
  74. package/dist/components/pagination/Pagination.d.ts +4 -0
  75. package/dist/components/pagination/Pagination.js.map +1 -1
  76. package/dist/components/popover/Popover.d.ts +4 -0
  77. package/dist/components/popover/Popover.js.map +1 -1
  78. package/dist/components/preview-card/PreviewCard.d.ts +4 -0
  79. package/dist/components/preview-card/PreviewCard.js.map +1 -1
  80. package/dist/components/progress/Progress.d.ts +8 -0
  81. package/dist/components/progress/Progress.js.map +1 -1
  82. package/dist/components/scroll-area/ScrollArea.d.ts +1 -0
  83. package/dist/components/scroll-area/ScrollArea.js.map +1 -1
  84. package/dist/components/search-input/SearchInput.d.ts +2 -0
  85. package/dist/components/search-input/SearchInput.js.map +1 -1
  86. package/dist/components/select/Select.d.ts +11 -0
  87. package/dist/components/select/Select.js.map +1 -1
  88. package/dist/components/separator/Separator.d.ts +1 -0
  89. package/dist/components/separator/Separator.js +1 -0
  90. package/dist/components/separator/Separator.js.map +1 -1
  91. package/dist/components/skeleton/Skeleton.d.ts +7 -0
  92. package/dist/components/skeleton/Skeleton.js +1 -0
  93. package/dist/components/skeleton/Skeleton.js.map +1 -1
  94. package/dist/components/slider/Slider.d.ts +1 -0
  95. package/dist/components/slider/Slider.js.map +1 -1
  96. package/dist/components/spinner/Spinner.d.ts +2 -0
  97. package/dist/components/spinner/Spinner.js +1 -0
  98. package/dist/components/spinner/Spinner.js.map +1 -1
  99. package/dist/components/stat-card/StatCard.d.ts +4 -0
  100. package/dist/components/stat-card/StatCard.js.map +1 -1
  101. package/dist/components/stepper/Stepper.d.ts +4 -0
  102. package/dist/components/stepper/Stepper.js.map +1 -1
  103. package/dist/components/table/Table.d.ts +24 -1
  104. package/dist/components/table/Table.js +19 -2
  105. package/dist/components/table/Table.js.map +1 -1
  106. package/dist/components/tabs/Tabs.d.ts +1 -0
  107. package/dist/components/tabs/Tabs.js.map +1 -1
  108. package/dist/components/tag/Tag.d.ts +3 -0
  109. package/dist/components/tag/Tag.js.map +1 -1
  110. package/dist/components/toast/Toast.d.ts +2 -0
  111. package/dist/components/toast/Toast.js.map +1 -1
  112. package/dist/components/toggle/Toggle.d.ts +7 -0
  113. package/dist/components/toggle/Toggle.js +1 -0
  114. package/dist/components/toggle/Toggle.js.map +1 -1
  115. package/dist/components/tooltip/Tooltip.d.ts +8 -0
  116. package/dist/components/tooltip/Tooltip.js.map +1 -1
  117. package/dist/components/typography/Typography.d.ts +5 -0
  118. package/dist/components/typography/Typography.js +2 -0
  119. package/dist/components/typography/Typography.js.map +1 -1
  120. package/dist/components.json +5534 -0
  121. package/dist/index.d.ts +1 -0
  122. package/dist/index.js +4 -3
  123. package/dist/llms-full.txt +2707 -0
  124. package/dist/llms.txt +177 -0
  125. package/dist/opti-ui.css +171 -81
  126. package/dist/theme/ThemeProvider.d.ts +1 -0
  127. package/dist/theme/ThemeProvider.js.map +1 -1
  128. package/dist/utils/portal.d.ts +4 -0
  129. package/dist/utils/portal.js +4 -0
  130. package/dist/utils/portal.js.map +1 -1
  131. package/package.json +7 -3
@@ -2,16 +2,23 @@
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);
18
+ /**
19
+ * Collapsible side navigation. Use inside `AppShell`. Compose with `NavbarHeader` (`NavbarBrand`),
20
+ * `NavbarSection` (`NavbarSectionLabel`, `NavbarItem`) and `NavbarFooter`.
21
+ */
15
22
  function Navbar(t0) {
16
23
  const $ = c(29);
17
24
  const { variant: t1, collapsible: t2, collapsed: collapsedProp, defaultCollapsed: t3, onCollapsedChange, expandOnHover: t4, collapseLabel: t5, expandLabel: t6, render, children, ref, ...props } = t0;
@@ -154,6 +161,7 @@ var NavbarHeader = createPrimitive("div", "oui-navbar__header", "NavbarHeader");
154
161
  var NavbarFooter = createPrimitive("div", "oui-navbar__footer", "NavbarFooter");
155
162
  var NavbarSection = createPrimitive("div", "oui-navbar__section", "NavbarSection");
156
163
  var NavbarSectionLabel = createPrimitive("div", "oui-navbar__section-label", "NavbarSectionLabel");
164
+ /** Logo, title and subtitle block for the top of a `Navbar`. */
157
165
  function NavbarBrand(t0) {
158
166
  const $ = c(23);
159
167
  let t1;
@@ -246,90 +254,453 @@ function NavbarBrand(t0) {
246
254
  }
247
255
  /**
248
256
  * Navigation link. Renders an `<a>`; use `render={<Link to="…" />}` for a
249
- * 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.
250
258
  */
251
259
  function NavbarItem(t0) {
252
- const $ = c(17);
253
- 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
+ }
254
290
  const active = t1 === void 0 ? false : t1;
291
+ const pinned = t2 === void 0 ? false : t2;
255
292
  const collapsed = React.useContext(NavbarCollapsedContext);
256
- let t2;
257
- if ($[0] !== active) {
258
- t2 = { active };
259
- $[0] = active;
260
- $[1] = t2;
261
- } else t2 = $[1];
262
- const state = t2;
263
- 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);
264
323
  let t4;
265
- if ($[2] !== icon) {
266
- 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", {
267
358
  className: "oui-navbar__item-icon",
268
359
  children: icon
269
360
  });
270
- $[2] = icon;
271
- $[3] = t4;
272
- } else t4 = $[3];
273
- let t5;
274
- if ($[4] !== children) {
275
- 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", {
276
368
  className: "oui-navbar__item-label",
277
369
  children
278
370
  });
279
- $[4] = children;
280
- $[5] = t5;
281
- } else t5 = $[5];
282
- let t6;
283
- if ($[6] !== badge) {
284
- 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", {
285
377
  className: "oui-navbar__item-badge",
286
378
  children: badge
287
379
  });
288
- $[6] = badge;
289
- $[7] = t6;
290
- } else t6 = $[7];
291
- let t7;
292
- if ($[8] !== t4 || $[9] !== t5 || $[10] !== t6) {
293
- t7 = /* @__PURE__ */ jsxs(Fragment, { children: [
294
- t4,
295
- t5,
296
- 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
297
389
  ] });
298
- $[8] = t4;
299
- $[9] = t5;
300
- $[10] = t6;
301
- $[11] = t7;
302
- } else t7 = $[11];
303
- const t8 = mergeProps({
304
- className: "oui-navbar__item",
305
- "aria-current": active ? "page" : void 0,
306
- title: collapsed && typeof children === "string" ? children : void 0,
307
- children: t7
308
- }, props);
309
- let t9;
310
- if ($[12] !== ref || $[13] !== render || $[14] !== state || $[15] !== t8) {
311
- t9 = {
312
- 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",
313
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, {
314
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,
315
671
  state,
316
672
  props: t8
317
673
  };
318
- $[12] = ref;
319
- $[13] = render;
320
- $[14] = state;
321
- $[15] = t8;
322
- $[16] = t9;
323
- } else t9 = $[16];
674
+ $[14] = entry.render;
675
+ $[15] = state;
676
+ $[16] = t8;
677
+ $[17] = t9;
678
+ } else t9 = $[17];
324
679
  return useRender(t9);
325
680
  }
326
681
  /**
327
682
  * Full-height layout with a fixed navbar and an internally scrolling main
328
- * 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`).
329
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>
330
701
  */
331
702
  function AppShell(t0) {
332
- const $ = c(48);
703
+ const $ = c(77);
333
704
  let children;
334
705
  let className;
335
706
  let mainProps;
@@ -339,8 +710,11 @@ function AppShell(t0) {
339
710
  let props;
340
711
  let ref;
341
712
  let t1;
713
+ let t2;
714
+ let t3;
715
+ let t4;
342
716
  if ($[0] !== t0) {
343
- ({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);
344
718
  $[0] = t0;
345
719
  $[1] = children;
346
720
  $[2] = className;
@@ -351,6 +725,9 @@ function AppShell(t0) {
351
725
  $[7] = props;
352
726
  $[8] = ref;
353
727
  $[9] = t1;
728
+ $[10] = t2;
729
+ $[11] = t3;
730
+ $[12] = t4;
354
731
  } else {
355
732
  children = $[1];
356
733
  className = $[2];
@@ -361,163 +738,277 @@ function AppShell(t0) {
361
738
  props = $[7];
362
739
  ref = $[8];
363
740
  t1 = $[9];
741
+ t2 = $[10];
742
+ t3 = $[11];
743
+ t4 = $[12];
364
744
  }
365
- 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;
366
749
  const [open, setOpen] = React.useState(false);
367
750
  const container = usePortalContainer();
368
- let t2;
369
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
370
- t2 = (event) => {
371
- if (event.target.closest("a, .oui-navbar__item")) setOpen(false);
372
- };
373
- $[10] = t2;
374
- } else t2 = $[10];
375
- const closeOnNavigate = t2;
376
- let t3;
377
- if ($[11] !== className) {
378
- t3 = cx("oui-app-shell", className);
379
- $[11] = className;
380
- $[12] = t3;
381
- } else t3 = $[12];
382
- let t4;
383
- if ($[13] !== navbar) {
384
- t4 = /* @__PURE__ */ jsx("div", {
385
- className: "oui-app-shell__navbar",
386
- children: navbar
387
- });
388
- $[13] = navbar;
389
- $[14] = t4;
390
- } else t4 = $[14];
391
751
  let t5;
392
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
393
- t5 = /* @__PURE__ */ jsx(MenuIcon, {});
394
- $[15] = t5;
395
- } 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);
396
757
  let t6;
397
- if ($[16] !== menuLabel) {
398
- t6 = /* @__PURE__ */ jsx(Dialog.Trigger, {
399
- className: "oui-app-shell__menu-button",
400
- "aria-label": menuLabel,
401
- children: t5
402
- });
403
- $[16] = menuLabel;
404
- $[17] = t6;
405
- } 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;
406
775
  let t7;
407
- if ($[18] !== mobileBrand) {
408
- t7 = /* @__PURE__ */ jsx("div", {
409
- className: "oui-app-shell__mobile-brand",
410
- children: mobileBrand
411
- });
412
- $[18] = mobileBrand;
413
- $[19] = t7;
414
- } else t7 = $[19];
415
776
  let t8;
416
- if ($[20] !== mobileActions || $[21] !== t6 || $[22] !== t7) {
417
- 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", {
418
884
  className: "oui-app-shell__mobile-bar",
419
885
  children: [
420
- t6,
421
- 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
+ }),
422
895
  mobileActions
423
896
  ]
424
897
  });
425
- $[20] = mobileActions;
426
- $[21] = t6;
427
- $[22] = t7;
428
- $[23] = t8;
429
- } else t8 = $[23];
430
- let t9;
431
- if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
432
- t9 = /* @__PURE__ */ jsx(Dialog.Backdrop, { className: "oui-dialog__backdrop" });
433
- $[24] = t9;
434
- } else t9 = $[24];
435
- let t10;
436
- if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
437
- 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, {
438
934
  className: "oui-app-shell__drawer-close",
439
935
  "aria-label": "Close navigation",
440
936
  children: /* @__PURE__ */ jsx(XIcon, {})
441
937
  });
442
- $[25] = t10;
443
- } else t10 = $[25];
444
- let t11;
445
- if ($[26] !== navbar) {
446
- 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, {
447
943
  className: "oui-app-shell__drawer",
448
944
  "aria-label": "Navigation",
449
945
  onClick: closeOnNavigate,
450
- children: [t10, /* @__PURE__ */ jsx(NavbarDrawerContext, {
946
+ children: [t24, /* @__PURE__ */ jsx(NavbarDrawerContext, {
451
947
  value: true,
452
948
  children: navbar
453
949
  })]
454
950
  });
455
- $[26] = navbar;
456
- $[27] = t11;
457
- } else t11 = $[27];
458
- let t12;
459
- if ($[28] !== container || $[29] !== t11) {
460
- 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, {
461
957
  container,
462
- children: [t9, t11]
958
+ children: [t23, t25]
463
959
  });
464
- $[28] = container;
465
- $[29] = t11;
466
- $[30] = t12;
467
- } else t12 = $[30];
468
- let t13;
469
- if ($[31] !== open || $[32] !== t12 || $[33] !== t8) {
470
- 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, {
471
967
  open,
472
968
  onOpenChange: setOpen,
473
- children: [t8, t12]
474
- });
475
- $[31] = open;
476
- $[32] = t12;
477
- $[33] = t8;
478
- $[34] = t13;
479
- } else t13 = $[34];
480
- const t14 = mainProps?.className;
481
- let t15;
482
- if ($[35] !== t14) {
483
- t15 = cx("oui-app-shell__main", t14);
484
- $[35] = t14;
485
- $[36] = t15;
486
- } else t15 = $[36];
487
- let t16;
488
- if ($[37] !== children || $[38] !== mainProps || $[39] !== t15) {
489
- t16 = /* @__PURE__ */ jsx("main", {
490
- ...mainProps,
491
- className: t15,
492
- children
969
+ children: [
970
+ t17,
971
+ t18,
972
+ t21,
973
+ t22,
974
+ t26
975
+ ]
493
976
  });
494
- $[37] = children;
495
- $[38] = mainProps;
496
- $[39] = t15;
497
- $[40] = t16;
498
- } else t16 = $[40];
499
- let t17;
500
- if ($[41] !== props || $[42] !== ref || $[43] !== t13 || $[44] !== t16 || $[45] !== t3 || $[46] !== t4) {
501
- 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", {
502
988
  ref,
503
- className: t3,
989
+ className: t15,
504
990
  ...props,
505
- children: [
506
- t4,
507
- t13,
508
- t16
509
- ]
991
+ children: [t16, t27]
510
992
  });
511
- $[41] = props;
512
- $[42] = ref;
513
- $[43] = t13;
514
- $[44] = t16;
515
- $[45] = t3;
516
- $[46] = t4;
517
- $[47] = t17;
518
- } else t17 = $[47];
519
- 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);
520
1010
  }
1011
+ /** Page title block with optional breadcrumbs, eyebrow, description and actions. */
521
1012
  function PageHeader(t0) {
522
1013
  const $ = c(32);
523
1014
  let actions;
@@ -684,6 +1175,6 @@ function Grid(t0) {
684
1175
  return t4;
685
1176
  }
686
1177
  //#endregion
687
- export { AppShell, Grid, Navbar, NavbarBrand, NavbarFooter, NavbarHeader, NavbarItem, NavbarSection, NavbarSectionLabel, PageHeader };
1178
+ export { AppShell, Grid, Navbar, NavbarBrand, NavbarFooter, NavbarGroup, NavbarHeader, NavbarItem, NavbarSection, NavbarSectionLabel, PageHeader };
688
1179
 
689
1180
  //# sourceMappingURL=AppShell.js.map