@iris-ui-kit/vue 0.2.11 → 0.2.13

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
@@ -327,6 +327,40 @@ function useI18n() {
327
327
  };
328
328
  }
329
329
 
330
+ // src/admin/styles.ts
331
+ var __NAV_MENU_STYLE_ID = "iris-nav-menu-styles";
332
+ var CSS = `
333
+ :where(.iris-nav-menu-arrow) {
334
+ flex: 0 0 auto;
335
+ opacity: 0.6;
336
+ transform: rotate(0deg);
337
+ transform-origin: center;
338
+ transition: transform 160ms ease;
339
+ }
340
+ :where(.iris-nav-menu-arrow[data-reversed="true"]) {
341
+ transform: rotate(180deg);
342
+ }
343
+ @media (prefers-reduced-motion: reduce) {
344
+ :where(.iris-nav-menu-arrow) {
345
+ transition: none;
346
+ }
347
+ }
348
+ `.trim();
349
+ var installed = false;
350
+ function installNavMenuStyles() {
351
+ if (installed) return;
352
+ if (typeof document === "undefined") return;
353
+ if (document.getElementById(__NAV_MENU_STYLE_ID)) {
354
+ installed = true;
355
+ return;
356
+ }
357
+ const style = document.createElement("style");
358
+ style.id = __NAV_MENU_STYLE_ID;
359
+ style.textContent = CSS;
360
+ document.head.appendChild(style);
361
+ installed = true;
362
+ }
363
+
330
364
  // src/admin/NavMenu.ts
331
365
  var IrisNavMenu = vue.defineComponent({
332
366
  name: "IrisNavMenu",
@@ -353,6 +387,7 @@ var IrisNavMenu = vue.defineComponent({
353
387
  "update:expandedKeys": (_keys) => true
354
388
  },
355
389
  setup(props, { emit, attrs }) {
390
+ installNavMenuStyles();
356
391
  const { t } = useI18n();
357
392
  const tree = vue.computed(() => core.visibleNav(props.items));
358
393
  const activePath = vue.computed(
@@ -419,7 +454,7 @@ var IrisNavMenu = vue.defineComponent({
419
454
  return interactionKeyAtDepth(focusedBranches.value, depth) === key;
420
455
  };
421
456
  const itemStyle = (opts) => {
422
- const bg = opts.active ? "var(--iris-primary)" : opts.hovered && !opts.disabled ? "var(--iris-surface)" : "transparent";
457
+ const bg = opts.active ? "var(--iris-primary)" : opts.hovered && !opts.disabled ? "var(--iris-surface-hover, var(--iris-surface))" : "transparent";
423
458
  return {
424
459
  display: "flex",
425
460
  alignItems: "center",
@@ -500,6 +535,7 @@ var IrisNavMenu = vue.defineComponent({
500
535
  const shown = horizontal ? horizontalBranchVisible(node.key, depth) : open;
501
536
  const active = node.key === props.activeKey;
502
537
  const trail = branch && !active && activePath.value.includes(node.key);
538
+ const arrowReversed = branch && !node.disabled && (active || trail || shown || hovered.value === node.key);
503
539
  const row = vue.h(
504
540
  "button",
505
541
  {
@@ -542,7 +578,9 @@ var IrisNavMenu = vue.defineComponent({
542
578
  branch ? vue.h(IrisIcon, {
543
579
  name: horizontal && depth === 0 ? "chevron-down" : "chevron-right",
544
580
  size: 16,
545
- style: { marginInlineStart: badgeNode(node) ? "6px" : "auto", opacity: "0.6" }
581
+ class: "iris-nav-menu-arrow",
582
+ "data-reversed": arrowReversed ? "true" : void 0,
583
+ style: { marginInlineStart: badgeNode(node) ? "6px" : "auto" }
546
584
  }) : null
547
585
  ]
548
586
  );