@iris-ui-kit/vue 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/admin.cjs CHANGED
@@ -390,13 +390,20 @@ var IrisNavMenu = vue.defineComponent({
390
390
  emit("update:expandedKeys", model.get());
391
391
  }
392
392
  };
393
+ const hovered = vue.ref(null);
394
+ const hoveredBranches = vue.ref([]);
395
+ const focusedBranches = vue.ref([]);
396
+ const closeHorizontalMenus = () => {
397
+ if (props.orientation !== "horizontal") return;
398
+ hovered.value = null;
399
+ hoveredBranches.value = [];
400
+ focusedBranches.value = [];
401
+ };
393
402
  const select = (node) => {
394
403
  if (node.disabled) return;
404
+ closeHorizontalMenus();
395
405
  emit("select", node.key, node);
396
406
  };
397
- const hovered = vue.ref(null);
398
- const hoveredBranches = vue.ref([]);
399
- const focusedBranches = vue.ref([]);
400
407
  const setBranchInteraction = (state, key, enabled) => {
401
408
  const current = state.value;
402
409
  if (enabled) {
@@ -430,7 +437,7 @@ var IrisNavMenu = vue.defineComponent({
430
437
  cursor: opts.disabled ? "not-allowed" : "pointer",
431
438
  opacity: opts.disabled ? "0.5" : "1",
432
439
  padding: props.collapsed ? "10px" : "8px 10px",
433
- paddingInlineStart: props.collapsed ? "10px" : `${12 + opts.depth * 16}px`,
440
+ paddingInlineStart: props.collapsed || props.orientation === "horizontal" ? "10px" : `${12 + opts.depth * 16}px`,
434
441
  justifyContent: props.collapsed ? "center" : "flex-start"
435
442
  };
436
443
  };
@@ -533,13 +540,13 @@ var IrisNavMenu = vue.defineComponent({
533
540
  ),
534
541
  badgeNode(node),
535
542
  branch ? vue.h(IrisIcon, {
536
- name: horizontal ? "chevron-down" : "chevron-right",
543
+ name: horizontal && depth === 0 ? "chevron-down" : "chevron-right",
537
544
  size: 16,
538
545
  style: { marginInlineStart: badgeNode(node) ? "6px" : "auto", opacity: "0.6" }
539
546
  }) : null
540
547
  ]
541
548
  );
542
- const groupStyle = horizontal && depth === 0 ? { position: "relative" } : void 0;
549
+ const groupStyle = horizontal && branch ? { position: "relative" } : void 0;
543
550
  if (!branch || !horizontal && !open)
544
551
  return vue.h(
545
552
  "div",
@@ -574,19 +581,19 @@ var IrisNavMenu = vue.defineComponent({
574
581
  "data-iris-nav-children": "",
575
582
  role: "group",
576
583
  "aria-hidden": horizontal && !shown ? "true" : void 0,
577
- style: horizontal && depth === 0 ? {
584
+ style: horizontal ? {
578
585
  display: shown ? "block" : "none",
579
586
  position: "absolute",
580
- insetBlockStart: "100%",
581
- insetInlineStart: "0",
582
- zIndex: "60",
587
+ insetBlockStart: depth === 0 ? "100%" : "0",
588
+ insetInlineStart: depth === 0 ? "0" : "100%",
589
+ zIndex: depth === 0 ? "60" : "61",
583
590
  minWidth: "220px",
584
591
  padding: "6px",
585
592
  border: "1px solid var(--iris-border)",
586
593
  borderRadius: "var(--iris-radius-md, 6px)",
587
594
  background: "var(--iris-surface)",
588
595
  boxShadow: "var(--iris-shadow-md)"
589
- } : horizontal ? { display: shown ? "block" : "none" } : void 0
596
+ } : void 0
590
597
  },
591
598
  (node.children ?? []).map((child) => renderItem(child, depth + 1))
592
599
  )
@@ -595,9 +602,7 @@ var IrisNavMenu = vue.defineComponent({
595
602
  };
596
603
  const onKeydown = (e) => {
597
604
  const root = e.currentTarget;
598
- const buttons = Array.from(
599
- root.querySelectorAll("[data-iris-nav-item]")
600
- ).filter(
605
+ const buttons = Array.from(root.querySelectorAll("[data-iris-nav-item]")).filter(
601
606
  (button) => !button.closest('[data-iris-nav-children][aria-hidden="true"]')
602
607
  );
603
608
  if (buttons.length === 0) return;