@iris-ui-kit/vue 0.2.33 → 0.2.35

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
@@ -702,13 +702,13 @@ function createNavMenuFlyout(ctx) {
702
702
  const rect = trigger.getBoundingClientRect();
703
703
  const dir = getComputedStyle(trigger).direction;
704
704
  panel.style.position = "fixed";
705
- panel.style.top = `${ctx.collapsed ? rect.top : rect.bottom}px`;
705
+ panel.style.top = `${ctx.collapsed.value ? rect.top : rect.bottom}px`;
706
706
  if (dir === "rtl") {
707
707
  panel.style.left = "";
708
- panel.style.right = `${window.innerWidth - (ctx.collapsed ? rect.left : rect.right)}px`;
708
+ panel.style.right = `${window.innerWidth - (ctx.collapsed.value ? rect.left : rect.right)}px`;
709
709
  } else {
710
710
  panel.style.right = "";
711
- panel.style.left = `${ctx.collapsed ? rect.right : rect.left}px`;
711
+ panel.style.left = `${ctx.collapsed.value ? rect.right : rect.left}px`;
712
712
  }
713
713
  };
714
714
  vue.onBeforeUnmount(() => {
@@ -717,8 +717,8 @@ function createNavMenuFlyout(ctx) {
717
717
  flyoutPanels.clear();
718
718
  });
719
719
  const isolateAtDepth = (key) => {
720
- const depth = core.findNavPath(ctx.items, key).length - 1;
721
- const isSameDepthOther = (k) => k !== key && core.findNavPath(ctx.items, k).length - 1 === depth;
720
+ const depth = core.findNavPath(ctx.items.value, key).length - 1;
721
+ const isSameDepthOther = (k) => k !== key && core.findNavPath(ctx.items.value, k).length - 1 === depth;
722
722
  for (const state of [hoveredBranches, clickedBranches, focusedBranches]) {
723
723
  if (state.value.some(isSameDepthOther)) {
724
724
  state.value = state.value.filter((k) => !isSameDepthOther(k));
@@ -786,7 +786,7 @@ function createNavMenuFlyout(ctx) {
786
786
  const next = event.relatedTarget;
787
787
  return !!(next && next instanceof Node && container.contains(next));
788
788
  };
789
- const interactionKeyAtDepth = (keys, depth) => keys.find((key) => core.findNavPath(ctx.items, key).length === depth + 1);
789
+ const interactionKeyAtDepth = (keys, depth) => keys.find((key) => core.findNavPath(ctx.items.value, key).length === depth + 1);
790
790
  const horizontalBranchVisible = (key, depth) => {
791
791
  const hoveredAtDepth = interactionKeyAtDepth(hoveredBranches.value, depth);
792
792
  if (hoveredAtDepth) return hoveredAtDepth === key;
@@ -998,6 +998,7 @@ var IrisNavMenu = vue.defineComponent({
998
998
  setup(props, { emit, attrs }) {
999
999
  installNavMenuStyles();
1000
1000
  const { t } = useI18n();
1001
+ const menuItems = vue.computed(() => props.items);
1001
1002
  const tree = vue.computed(() => core.visibleNav(props.items));
1002
1003
  const activePath = vue.computed(
1003
1004
  () => props.activeKey ? core.findNavPath(props.items, props.activeKey).map((n) => n.key) : []
@@ -1033,11 +1034,13 @@ var IrisNavMenu = vue.defineComponent({
1033
1034
  }
1034
1035
  };
1035
1036
  const flyout = createNavMenuFlyout({
1036
- items: props.items,
1037
+ // Keep the flyout controller in sync with async navigation data and
1038
+ // layout changes; passing .value here would freeze the initial state.
1039
+ items: menuItems,
1037
1040
  tree,
1038
1041
  expanded,
1039
- flyoutMode: { value: flyoutMode.value },
1040
- collapsed: props.collapsed,
1042
+ flyoutMode,
1043
+ collapsed: vue.computed(() => props.collapsed),
1041
1044
  toggle,
1042
1045
  emitSelect: (key, node) => emit("select", key, node)
1043
1046
  });
@@ -1086,12 +1089,14 @@ var IrisNavMenu = vue.defineComponent({
1086
1089
  const renderItem = (node, depth) => {
1087
1090
  const branch = core.isBranch(node);
1088
1091
  const horizontal = flyoutMode.value;
1092
+ const verticalAccordion = props.orientation === "vertical" && !props.collapsed;
1089
1093
  const open = expanded.value.includes(node.key);
1090
1094
  const shown = horizontal ? horizontalBranchVisible(node.key, depth) : open;
1091
1095
  const active = node.key === props.activeKey;
1092
1096
  const trail = branch && !active && activePath.value.includes(node.key);
1093
1097
  const rowHovered = hovered.value === node.key || horizontal && shown;
1094
- const arrowReversed = branch && !node.disabled && (active || trail || shown || rowHovered);
1098
+ const arrowReversed = !verticalAccordion && branch && !node.disabled && (active || trail || shown || rowHovered);
1099
+ const arrowName = verticalAccordion ? open ? "chevron-up" : "chevron-down" : horizontal && depth === 0 && !props.collapsed ? "chevron-down" : "chevron-right";
1095
1100
  const isFlyoutRoot = horizontal && branch && depth === 0;
1096
1101
  const row = vue.h(
1097
1102
  "button",
@@ -1157,7 +1162,7 @@ var IrisNavMenu = vue.defineComponent({
1157
1162
  ),
1158
1163
  badgeNode(node),
1159
1164
  branch && !(props.collapsed && depth === 0) ? vue.h(IrisIcon, {
1160
- name: horizontal && depth === 0 && !props.collapsed ? "chevron-down" : "chevron-right",
1165
+ name: arrowName,
1161
1166
  size: 16,
1162
1167
  class: "iris-nav-menu-arrow",
1163
1168
  "data-reversed": arrowReversed ? "true" : void 0