@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.js CHANGED
@@ -6596,10 +6596,82 @@ var IrisTabs = defineComponent({
6596
6596
  return () => slots.default?.();
6597
6597
  }
6598
6598
  });
6599
+
6600
+ // src/primitives/tabs/styles.ts
6601
+ var STYLE_ID = "iris-tabs-styles";
6602
+ var CSS4 = `
6603
+ :where(.iris-tabs-list) {
6604
+ display: flex;
6605
+ gap: 2px;
6606
+ }
6607
+ :where(.iris-tabs-list[data-orientation="horizontal"]) {
6608
+ flex-direction: row;
6609
+ border-bottom: 1px solid var(--iris-border);
6610
+ }
6611
+ :where(.iris-tabs-list[data-orientation="vertical"]) {
6612
+ flex-direction: column;
6613
+ border-inline-end: 1px solid var(--iris-border);
6614
+ }
6615
+ :where(.iris-tabs-trigger) {
6616
+ padding: 8px var(--iris-padding-md);
6617
+ font-size: 14px;
6618
+ font-weight: 500;
6619
+ font-family: inherit;
6620
+ cursor: pointer;
6621
+ opacity: 1;
6622
+ border: none;
6623
+ outline: none;
6624
+ background: transparent;
6625
+ color: var(--iris-muted);
6626
+ transition: color 120ms ease, border-color 120ms ease;
6627
+ }
6628
+ :where(.iris-tabs-trigger[data-orientation="horizontal"]) {
6629
+ margin-bottom: -1px;
6630
+ border-bottom: 2px solid transparent;
6631
+ }
6632
+ :where(.iris-tabs-trigger[data-orientation="vertical"]) {
6633
+ margin-inline-end: -1px;
6634
+ border-inline-end: 2px solid transparent;
6635
+ }
6636
+ :where(.iris-tabs-trigger[data-state="active"]) {
6637
+ color: var(--iris-primary);
6638
+ }
6639
+ :where(.iris-tabs-trigger[data-state="active"][data-orientation="horizontal"]) {
6640
+ border-bottom-color: var(--iris-primary);
6641
+ }
6642
+ :where(.iris-tabs-trigger[data-state="active"][data-orientation="vertical"]) {
6643
+ border-inline-end-color: var(--iris-primary);
6644
+ }
6645
+ :where(.iris-tabs-trigger[data-disabled]) {
6646
+ cursor: not-allowed;
6647
+ opacity: 0.5;
6648
+ }
6649
+ :where(.iris-tabs-trigger:focus-visible) {
6650
+ outline: 2px solid var(--iris-focus-ring, var(--iris-primary));
6651
+ outline-offset: 2px;
6652
+ }
6653
+ `.trim();
6654
+ var installed4 = false;
6655
+ function installTabsStyles() {
6656
+ if (installed4) return;
6657
+ if (typeof document === "undefined") return;
6658
+ if (document.getElementById(STYLE_ID)) {
6659
+ installed4 = true;
6660
+ return;
6661
+ }
6662
+ const style = document.createElement("style");
6663
+ style.id = STYLE_ID;
6664
+ style.textContent = CSS4;
6665
+ document.head.appendChild(style);
6666
+ installed4 = true;
6667
+ }
6668
+
6669
+ // src/primitives/tabs/TabsList.ts
6599
6670
  var IrisTabsList = defineComponent({
6600
6671
  name: "IrisTabsList",
6601
6672
  inheritAttrs: false,
6602
6673
  setup(_, { slots, attrs }) {
6674
+ installTabsStyles();
6603
6675
  const ctx = inject(TabsContextKey);
6604
6676
  if (!ctx) {
6605
6677
  throw new Error("[iris-ui] IrisTabsList must be inside an IrisTabs");
@@ -6615,14 +6687,8 @@ var IrisTabsList = defineComponent({
6615
6687
  "aria-orientation": ctx.orientation.value,
6616
6688
  "data-iris-tabs-list": "",
6617
6689
  "data-orientation": ctx.orientation.value,
6618
- style: {
6619
- display: "flex",
6620
- flexDirection: ctx.orientation.value === "horizontal" ? "row" : "column",
6621
- gap: "2px",
6622
- borderBottom: ctx.orientation.value === "horizontal" ? "1px solid var(--iris-border)" : "none",
6623
- borderInlineEnd: ctx.orientation.value === "vertical" ? "1px solid var(--iris-border)" : "none",
6624
- ...attrs.style ?? {}
6625
- }
6690
+ class: ["iris-tabs-list", attrs.class],
6691
+ style: attrs.style
6626
6692
  },
6627
6693
  slots.default?.()
6628
6694
  );
@@ -6637,6 +6703,7 @@ var IrisTabsTrigger = defineComponent({
6637
6703
  asChild: { type: Boolean, default: false }
6638
6704
  },
6639
6705
  setup(props, { slots, attrs }) {
6706
+ installTabsStyles();
6640
6707
  const ctx = inject(TabsContextKey);
6641
6708
  if (!ctx) {
6642
6709
  throw new Error("[iris-ui] IrisTabsTrigger must be inside an IrisTabs");
@@ -6685,7 +6752,9 @@ var IrisTabsTrigger = defineComponent({
6685
6752
  "data-disabled": isDisabled.value ? "" : void 0,
6686
6753
  disabled: isDisabled.value ? true : void 0,
6687
6754
  onClick,
6688
- onKeydown: onKeyDown
6755
+ onKeydown: onKeyDown,
6756
+ class: ["iris-tabs-trigger", attrs.class],
6757
+ style: attrs.style
6689
6758
  };
6690
6759
  if (props.asChild) {
6691
6760
  const root = findFirstElement(slots.default?.());
@@ -6696,37 +6765,17 @@ var IrisTabsTrigger = defineComponent({
6696
6765
  return null;
6697
6766
  }
6698
6767
  const merged = mergeSlotProps(
6699
- { ...triggerProps, ...attrs },
6768
+ { ...attrs, ...triggerProps },
6700
6769
  root.props ?? {}
6701
6770
  );
6702
6771
  return h(root.type, merged, root.children);
6703
6772
  }
6704
- const colors = isActive.value ? { background: "transparent", color: "var(--iris-primary)" } : { background: "transparent", color: "var(--iris-muted)" };
6705
- const borderActive = ctx.orientation.value === "horizontal" ? { borderBottom: `2px solid ${isActive.value ? "var(--iris-primary)" : "transparent"}` } : {
6706
- borderInlineEnd: `2px solid ${isActive.value ? "var(--iris-primary)" : "transparent"}`
6707
- };
6708
6773
  return h(
6709
6774
  "button",
6710
6775
  {
6711
6776
  type: "button",
6712
6777
  ...attrs,
6713
- ...triggerProps,
6714
- style: {
6715
- padding: "8px var(--iris-padding-md)",
6716
- fontSize: "14px",
6717
- fontWeight: "500",
6718
- fontFamily: "inherit",
6719
- cursor: isDisabled.value ? "not-allowed" : "pointer",
6720
- opacity: isDisabled.value ? "0.5" : "1",
6721
- border: "none",
6722
- outline: "none",
6723
- marginBottom: ctx.orientation.value === "horizontal" ? "-1px" : void 0,
6724
- marginInlineEnd: ctx.orientation.value === "vertical" ? "-1px" : void 0,
6725
- transition: "color 120ms ease, border-color 120ms ease",
6726
- ...colors,
6727
- ...borderActive,
6728
- ...attrs.style ?? {}
6729
- }
6778
+ ...triggerProps
6730
6779
  },
6731
6780
  slots.default?.()
6732
6781
  );