@iris-ui-kit/vue 0.2.2 → 0.2.4

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
@@ -1221,6 +1221,12 @@ var IrisNumberInput = defineComponent({
1221
1221
  const rawText = ref(
1222
1222
  props.modelValue === null || props.modelValue === void 0 ? "" : String(props.modelValue)
1223
1223
  );
1224
+ watch(
1225
+ () => props.modelValue,
1226
+ (next) => {
1227
+ rawText.value = next === null || next === void 0 ? "" : String(next);
1228
+ }
1229
+ );
1224
1230
  const startValue = computed(() => {
1225
1231
  if (Number.isFinite(props.min) && props.min !== -Infinity) return props.min;
1226
1232
  return 0;
@@ -6596,10 +6602,82 @@ var IrisTabs = defineComponent({
6596
6602
  return () => slots.default?.();
6597
6603
  }
6598
6604
  });
6605
+
6606
+ // src/primitives/tabs/styles.ts
6607
+ var STYLE_ID = "iris-tabs-styles";
6608
+ var CSS4 = `
6609
+ :where(.iris-tabs-list) {
6610
+ display: flex;
6611
+ gap: 2px;
6612
+ }
6613
+ :where(.iris-tabs-list[data-orientation="horizontal"]) {
6614
+ flex-direction: row;
6615
+ border-bottom: 1px solid var(--iris-border);
6616
+ }
6617
+ :where(.iris-tabs-list[data-orientation="vertical"]) {
6618
+ flex-direction: column;
6619
+ border-inline-end: 1px solid var(--iris-border);
6620
+ }
6621
+ :where(.iris-tabs-trigger) {
6622
+ padding: 8px var(--iris-padding-md);
6623
+ font-size: 14px;
6624
+ font-weight: 500;
6625
+ font-family: inherit;
6626
+ cursor: pointer;
6627
+ opacity: 1;
6628
+ border: none;
6629
+ outline: none;
6630
+ background: transparent;
6631
+ color: var(--iris-muted);
6632
+ transition: color 120ms ease, border-color 120ms ease;
6633
+ }
6634
+ :where(.iris-tabs-trigger[data-orientation="horizontal"]) {
6635
+ margin-bottom: -1px;
6636
+ border-bottom: 2px solid transparent;
6637
+ }
6638
+ :where(.iris-tabs-trigger[data-orientation="vertical"]) {
6639
+ margin-inline-end: -1px;
6640
+ border-inline-end: 2px solid transparent;
6641
+ }
6642
+ :where(.iris-tabs-trigger[data-state="active"]) {
6643
+ color: var(--iris-primary);
6644
+ }
6645
+ :where(.iris-tabs-trigger[data-state="active"][data-orientation="horizontal"]) {
6646
+ border-bottom-color: var(--iris-primary);
6647
+ }
6648
+ :where(.iris-tabs-trigger[data-state="active"][data-orientation="vertical"]) {
6649
+ border-inline-end-color: var(--iris-primary);
6650
+ }
6651
+ :where(.iris-tabs-trigger[data-disabled]) {
6652
+ cursor: not-allowed;
6653
+ opacity: 0.5;
6654
+ }
6655
+ :where(.iris-tabs-trigger:focus-visible) {
6656
+ outline: 2px solid var(--iris-focus-ring, var(--iris-primary));
6657
+ outline-offset: 2px;
6658
+ }
6659
+ `.trim();
6660
+ var installed4 = false;
6661
+ function installTabsStyles() {
6662
+ if (installed4) return;
6663
+ if (typeof document === "undefined") return;
6664
+ if (document.getElementById(STYLE_ID)) {
6665
+ installed4 = true;
6666
+ return;
6667
+ }
6668
+ const style = document.createElement("style");
6669
+ style.id = STYLE_ID;
6670
+ style.textContent = CSS4;
6671
+ document.head.appendChild(style);
6672
+ installed4 = true;
6673
+ }
6674
+
6675
+ // src/primitives/tabs/TabsList.ts
6599
6676
  var IrisTabsList = defineComponent({
6600
6677
  name: "IrisTabsList",
6601
6678
  inheritAttrs: false,
6602
6679
  setup(_, { slots, attrs }) {
6680
+ installTabsStyles();
6603
6681
  const ctx = inject(TabsContextKey);
6604
6682
  if (!ctx) {
6605
6683
  throw new Error("[iris-ui] IrisTabsList must be inside an IrisTabs");
@@ -6615,14 +6693,8 @@ var IrisTabsList = defineComponent({
6615
6693
  "aria-orientation": ctx.orientation.value,
6616
6694
  "data-iris-tabs-list": "",
6617
6695
  "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
- }
6696
+ class: ["iris-tabs-list", attrs.class],
6697
+ style: attrs.style
6626
6698
  },
6627
6699
  slots.default?.()
6628
6700
  );
@@ -6637,6 +6709,7 @@ var IrisTabsTrigger = defineComponent({
6637
6709
  asChild: { type: Boolean, default: false }
6638
6710
  },
6639
6711
  setup(props, { slots, attrs }) {
6712
+ installTabsStyles();
6640
6713
  const ctx = inject(TabsContextKey);
6641
6714
  if (!ctx) {
6642
6715
  throw new Error("[iris-ui] IrisTabsTrigger must be inside an IrisTabs");
@@ -6685,7 +6758,9 @@ var IrisTabsTrigger = defineComponent({
6685
6758
  "data-disabled": isDisabled.value ? "" : void 0,
6686
6759
  disabled: isDisabled.value ? true : void 0,
6687
6760
  onClick,
6688
- onKeydown: onKeyDown
6761
+ onKeydown: onKeyDown,
6762
+ class: ["iris-tabs-trigger", attrs.class],
6763
+ style: attrs.style
6689
6764
  };
6690
6765
  if (props.asChild) {
6691
6766
  const root = findFirstElement(slots.default?.());
@@ -6696,37 +6771,17 @@ var IrisTabsTrigger = defineComponent({
6696
6771
  return null;
6697
6772
  }
6698
6773
  const merged = mergeSlotProps(
6699
- { ...triggerProps, ...attrs },
6774
+ { ...attrs, ...triggerProps },
6700
6775
  root.props ?? {}
6701
6776
  );
6702
6777
  return h(root.type, merged, root.children);
6703
6778
  }
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
6779
  return h(
6709
6780
  "button",
6710
6781
  {
6711
6782
  type: "button",
6712
6783
  ...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
- }
6784
+ ...triggerProps
6730
6785
  },
6731
6786
  slots.default?.()
6732
6787
  );