@iris-ui-kit/vue 0.2.2 → 0.2.3

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/index.cjs CHANGED
@@ -10462,10 +10462,82 @@ var IrisTabs = vue.defineComponent({
10462
10462
  return () => slots.default?.();
10463
10463
  }
10464
10464
  });
10465
+
10466
+ // src/primitives/tabs/styles.ts
10467
+ var STYLE_ID2 = "iris-tabs-styles";
10468
+ var CSS6 = `
10469
+ :where(.iris-tabs-list) {
10470
+ display: flex;
10471
+ gap: 2px;
10472
+ }
10473
+ :where(.iris-tabs-list[data-orientation="horizontal"]) {
10474
+ flex-direction: row;
10475
+ border-bottom: 1px solid var(--iris-border);
10476
+ }
10477
+ :where(.iris-tabs-list[data-orientation="vertical"]) {
10478
+ flex-direction: column;
10479
+ border-inline-end: 1px solid var(--iris-border);
10480
+ }
10481
+ :where(.iris-tabs-trigger) {
10482
+ padding: 8px var(--iris-padding-md);
10483
+ font-size: 14px;
10484
+ font-weight: 500;
10485
+ font-family: inherit;
10486
+ cursor: pointer;
10487
+ opacity: 1;
10488
+ border: none;
10489
+ outline: none;
10490
+ background: transparent;
10491
+ color: var(--iris-muted);
10492
+ transition: color 120ms ease, border-color 120ms ease;
10493
+ }
10494
+ :where(.iris-tabs-trigger[data-orientation="horizontal"]) {
10495
+ margin-bottom: -1px;
10496
+ border-bottom: 2px solid transparent;
10497
+ }
10498
+ :where(.iris-tabs-trigger[data-orientation="vertical"]) {
10499
+ margin-inline-end: -1px;
10500
+ border-inline-end: 2px solid transparent;
10501
+ }
10502
+ :where(.iris-tabs-trigger[data-state="active"]) {
10503
+ color: var(--iris-primary);
10504
+ }
10505
+ :where(.iris-tabs-trigger[data-state="active"][data-orientation="horizontal"]) {
10506
+ border-bottom-color: var(--iris-primary);
10507
+ }
10508
+ :where(.iris-tabs-trigger[data-state="active"][data-orientation="vertical"]) {
10509
+ border-inline-end-color: var(--iris-primary);
10510
+ }
10511
+ :where(.iris-tabs-trigger[data-disabled]) {
10512
+ cursor: not-allowed;
10513
+ opacity: 0.5;
10514
+ }
10515
+ :where(.iris-tabs-trigger:focus-visible) {
10516
+ outline: 2px solid var(--iris-focus-ring, var(--iris-primary));
10517
+ outline-offset: 2px;
10518
+ }
10519
+ `.trim();
10520
+ var installed6 = false;
10521
+ function installTabsStyles() {
10522
+ if (installed6) return;
10523
+ if (typeof document === "undefined") return;
10524
+ if (document.getElementById(STYLE_ID2)) {
10525
+ installed6 = true;
10526
+ return;
10527
+ }
10528
+ const style = document.createElement("style");
10529
+ style.id = STYLE_ID2;
10530
+ style.textContent = CSS6;
10531
+ document.head.appendChild(style);
10532
+ installed6 = true;
10533
+ }
10534
+
10535
+ // src/primitives/tabs/TabsList.ts
10465
10536
  var IrisTabsList = vue.defineComponent({
10466
10537
  name: "IrisTabsList",
10467
10538
  inheritAttrs: false,
10468
10539
  setup(_, { slots, attrs }) {
10540
+ installTabsStyles();
10469
10541
  const ctx = vue.inject(TabsContextKey);
10470
10542
  if (!ctx) {
10471
10543
  throw new Error("[iris-ui] IrisTabsList must be inside an IrisTabs");
@@ -10481,14 +10553,8 @@ var IrisTabsList = vue.defineComponent({
10481
10553
  "aria-orientation": ctx.orientation.value,
10482
10554
  "data-iris-tabs-list": "",
10483
10555
  "data-orientation": ctx.orientation.value,
10484
- style: {
10485
- display: "flex",
10486
- flexDirection: ctx.orientation.value === "horizontal" ? "row" : "column",
10487
- gap: "2px",
10488
- borderBottom: ctx.orientation.value === "horizontal" ? "1px solid var(--iris-border)" : "none",
10489
- borderInlineEnd: ctx.orientation.value === "vertical" ? "1px solid var(--iris-border)" : "none",
10490
- ...attrs.style ?? {}
10491
- }
10556
+ class: ["iris-tabs-list", attrs.class],
10557
+ style: attrs.style
10492
10558
  },
10493
10559
  slots.default?.()
10494
10560
  );
@@ -10503,6 +10569,7 @@ var IrisTabsTrigger = vue.defineComponent({
10503
10569
  asChild: { type: Boolean, default: false }
10504
10570
  },
10505
10571
  setup(props, { slots, attrs }) {
10572
+ installTabsStyles();
10506
10573
  const ctx = vue.inject(TabsContextKey);
10507
10574
  if (!ctx) {
10508
10575
  throw new Error("[iris-ui] IrisTabsTrigger must be inside an IrisTabs");
@@ -10551,7 +10618,9 @@ var IrisTabsTrigger = vue.defineComponent({
10551
10618
  "data-disabled": isDisabled.value ? "" : void 0,
10552
10619
  disabled: isDisabled.value ? true : void 0,
10553
10620
  onClick,
10554
- onKeydown: onKeyDown
10621
+ onKeydown: onKeyDown,
10622
+ class: ["iris-tabs-trigger", attrs.class],
10623
+ style: attrs.style
10555
10624
  };
10556
10625
  if (props.asChild) {
10557
10626
  const root = findFirstElement(slots.default?.());
@@ -10562,37 +10631,17 @@ var IrisTabsTrigger = vue.defineComponent({
10562
10631
  return null;
10563
10632
  }
10564
10633
  const merged = mergeSlotProps(
10565
- { ...triggerProps, ...attrs },
10634
+ { ...attrs, ...triggerProps },
10566
10635
  root.props ?? {}
10567
10636
  );
10568
10637
  return vue.h(root.type, merged, root.children);
10569
10638
  }
10570
- const colors = isActive.value ? { background: "transparent", color: "var(--iris-primary)" } : { background: "transparent", color: "var(--iris-muted)" };
10571
- const borderActive = ctx.orientation.value === "horizontal" ? { borderBottom: `2px solid ${isActive.value ? "var(--iris-primary)" : "transparent"}` } : {
10572
- borderInlineEnd: `2px solid ${isActive.value ? "var(--iris-primary)" : "transparent"}`
10573
- };
10574
10639
  return vue.h(
10575
10640
  "button",
10576
10641
  {
10577
10642
  type: "button",
10578
10643
  ...attrs,
10579
- ...triggerProps,
10580
- style: {
10581
- padding: "8px var(--iris-padding-md)",
10582
- fontSize: "14px",
10583
- fontWeight: "500",
10584
- fontFamily: "inherit",
10585
- cursor: isDisabled.value ? "not-allowed" : "pointer",
10586
- opacity: isDisabled.value ? "0.5" : "1",
10587
- border: "none",
10588
- outline: "none",
10589
- marginBottom: ctx.orientation.value === "horizontal" ? "-1px" : void 0,
10590
- marginInlineEnd: ctx.orientation.value === "vertical" ? "-1px" : void 0,
10591
- transition: "color 120ms ease, border-color 120ms ease",
10592
- ...colors,
10593
- ...borderActive,
10594
- ...attrs.style ?? {}
10595
- }
10644
+ ...triggerProps
10596
10645
  },
10597
10646
  slots.default?.()
10598
10647
  );