@vectoriox/iox-ui 5.64.0 → 5.66.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.
@@ -11659,11 +11659,23 @@ function makeKit(globals, rootId, newId) {
11659
11659
  }
11660
11660
  /** Point an opener's dialog actions at `dialogId` (a drawer rebuilt under a new id keeps its openers working). */
11661
11661
  function retarget(node, dialogId) {
11662
- for (const ix of node.interactions) {
11662
+ for (const ix of (node.interactions ?? [])) {
11663
11663
  for (const a of ix.actions ?? [])
11664
- if (a.type === 'openDialog' || a.type === 'toggleDialog')
11664
+ if (a.type === NavDialogAction.Open || a.type === NavDialogAction.Toggle)
11665
11665
  a.target = dialogId;
11666
11666
  }
11667
+ return asToggle(node);
11668
+ }
11669
+ /** The menu button and More are TOGGLES (a second click closes what the first opened): a part saved before that
11670
+ * rule opened only — kept through a change of shape, it toggles from then on. */
11671
+ function asToggle(node) {
11672
+ for (const ix of (node.interactions ?? [])) {
11673
+ if (ix.trigger !== CLICK)
11674
+ continue;
11675
+ for (const a of ix.actions ?? [])
11676
+ if (a.type === NavDialogAction.Open)
11677
+ a.type = NavDialogAction.Toggle;
11678
+ }
11667
11679
  return node;
11668
11680
  }
11669
11681
  function part(kit, suffix, type, props, style, role, lay = {}) {
@@ -11676,6 +11688,13 @@ function part(kit, suffix, type, props, style, role, lay = {}) {
11676
11688
  Object.assign(node.styleProps, lay);
11677
11689
  return node;
11678
11690
  }
11691
+ /** The dialog actions a nav part runs on click. */
11692
+ var NavDialogAction;
11693
+ (function (NavDialogAction) {
11694
+ NavDialogAction["Open"] = "openDialog";
11695
+ NavDialogAction["Close"] = "closeDialog";
11696
+ NavDialogAction["Toggle"] = "toggleDialog";
11697
+ })(NavDialogAction || (NavDialogAction = {}));
11679
11698
  function clickTo(kit, suffix, type, target) {
11680
11699
  return { id: kit.id(`${suffix}-click`), trigger: CLICK, actions: [{ type, target, duration: 0, delay: 0, easing: 'ease' }] };
11681
11700
  }
@@ -11707,10 +11726,14 @@ function iconNode(kit, suffix, iconClass) {
11707
11726
  function labelText(kit, suffix, words) {
11708
11727
  return part(kit, suffix, TEXT$1, { content: words, tag: 'span' }, 'button-label');
11709
11728
  }
11729
+ /** The menu button and the drawer's Close are ONE size — and the shared CSS pads the drawer like the header
11730
+ * (`.iox-role-nav-drawer` re-declares dialog-pad as nav-pad) — so the Close lands where the menu button is and
11731
+ * reads as the same button turned into an X. */
11732
+ const MENU_BUTTON_LAY = { width: '48px', height: '48px', alignItems: 'center', justifyContent: 'center' };
11710
11733
  function menuButton(kit, drawerId, at) {
11711
- const btn = part(kit, 'menu', BUTTON, { tag: 'button', ariaLabel: NAV_SHAPE_COPY.menu }, 'button-ghost', NavRole.MenuButton, { width: '48px', height: '48px', alignItems: 'center', justifyContent: 'center' });
11734
+ const btn = part(kit, 'menu', BUTTON, { tag: 'button', ariaLabel: NAV_SHAPE_COPY.menu }, 'button-ghost', NavRole.MenuButton, { ...MENU_BUTTON_LAY });
11712
11735
  btn.children = [iconNode(kit, 'menu-icon', MENU_ICON)];
11713
- btn.interactions = [clickTo(kit, 'menu', 'openDialog', drawerId)];
11736
+ btn.interactions = [clickTo(kit, 'menu', NavDialogAction.Toggle, drawerId)];
11714
11737
  phoneOnly(btn, at, 'inline-flex');
11715
11738
  return btn;
11716
11739
  }
@@ -11723,9 +11746,9 @@ function drawer(kit, root, pages, at) {
11723
11746
  }, 'dialog', NavRole.Drawer, { width: '86vw', maxWidth: '360px', display: 'flex', flexDirection: 'column', gap: '20px' });
11724
11747
  const brandWords = textOf(find([root], NavRole.Brand) ?? root) || NAV_PART_LABELS[NavRole.Root];
11725
11748
  const head = part(kit, 'drawer-head', CONTAINER, {}, 'box', NavRole.DrawerHead, { display: 'flex', justifyContent: 'space-between', alignItems: 'center', gap: '12px' });
11726
- const close = part(kit, 'drawer-close', BUTTON, { tag: 'button', ariaLabel: NAV_SHAPE_COPY.closeMenu }, 'button-ghost', NavRole.DrawerClose, { width: '44px', height: '44px', alignItems: 'center', justifyContent: 'center' });
11749
+ const close = part(kit, 'drawer-close', BUTTON, { tag: 'button', ariaLabel: NAV_SHAPE_COPY.closeMenu }, 'button-ghost', NavRole.DrawerClose, { ...MENU_BUTTON_LAY });
11727
11750
  close.children = [iconNode(kit, 'drawer-close-icon', CLOSE_ICON)];
11728
- close.interactions = [clickTo(kit, 'drawer-close', 'closeDialog', dr.id)];
11751
+ close.interactions = [clickTo(kit, 'drawer-close', NavDialogAction.Close, dr.id)];
11729
11752
  head.children = [part(kit, 'drawer-brand', HEADING, { content: brandWords, level: 'h3' }, 'h3'), close];
11730
11753
  const list = part(kit, 'drawer-links', CONTAINER, {}, 'box', NavRole.DrawerLinks, { display: 'flex', flexDirection: 'column', gap: '4px' });
11731
11754
  // Board 1: every page, Home first, at lead size (on each Link: a Link's own baseline font size would
@@ -11761,7 +11784,7 @@ const BAR_ITEM_LAY = {
11761
11784
  function moreItem(kit, drawerId) {
11762
11785
  const more = part(kit, 'bar-more', BUTTON, { tag: 'button' }, 'bottom-bar-item', NavRole.More, BAR_ITEM_LAY);
11763
11786
  more.children = [iconNode(kit, 'bar-more-icon', MORE_ICON), labelText(kit, 'bar-more-label', NAV_SHAPE_COPY.more)];
11764
- more.interactions = [clickTo(kit, 'bar-more', 'openDialog', drawerId)];
11787
+ more.interactions = [clickTo(kit, 'bar-more', NavDialogAction.Toggle, drawerId)];
11765
11788
  return more;
11766
11789
  }
11767
11790
  /** Home first, then the header's pages: the header reaches Home through its brand, a phone menu names it. */
@@ -11871,7 +11894,7 @@ function planNavShape(globals, shape, options = {}, navId) {
11871
11894
  dr.props = { ...dr.props, closeAbove: at };
11872
11895
  // The menu button: Drawer only (Q4: with a bar, the phone header keeps only the brand).
11873
11896
  const existingMenu = removeRole(root, NavRole.MenuButton);
11874
- const menu = wantMenuButton ? (existingMenu ?? menuButton(kit, dr.id, at)) : null;
11897
+ const menu = wantMenuButton ? (existingMenu ? asToggle(existingMenu) : menuButton(kit, dr.id, at)) : null;
11875
11898
  for (const p of phoneHiddenParts(root)) {
11876
11899
  moveDisplayOverride(p, at);
11877
11900
  hideAt(p, at);