@strands.gg/accui 2.11.21 → 2.11.23

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.es.js CHANGED
@@ -1430,6 +1430,18 @@ const X = createLucideIcon("x", [
1430
1430
  ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
1431
1431
  ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
1432
1432
  ]);
1433
+ function hasSlotContent(slots, slotName) {
1434
+ const slot = slots[slotName];
1435
+ if (!slot) return false;
1436
+ const content = slot();
1437
+ if (!content || content.length === 0) return false;
1438
+ return content.some((vnode) => {
1439
+ if (vnode.children && vnode.children !== "") return true;
1440
+ if (vnode.type && typeof vnode.type === "object") return true;
1441
+ if (vnode.props && Object.keys(vnode.props).length > 0) return true;
1442
+ return false;
1443
+ });
1444
+ }
1433
1445
  const _hoisted_1$N = {
1434
1446
  key: 0,
1435
1447
  class: "input-leading-icon"
@@ -1481,8 +1493,11 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
1481
1493
  }
1482
1494
  return props.type;
1483
1495
  });
1496
+ const hasLeadingIcon = computed(() => {
1497
+ return hasSlotContent(slots, "leading-icon");
1498
+ });
1484
1499
  const hasTrailingIcon = computed(() => {
1485
- return slots["trailing-icon"] || props.type === "password" || props.type === "search" && props.modelValue;
1500
+ return hasSlotContent(slots, "trailing-icon") || props.type === "password" || props.type === "search" && props.modelValue;
1486
1501
  });
1487
1502
  const buttonTabindex = computed(() => {
1488
1503
  if (props.tabindex === void 0) return;
@@ -1537,7 +1552,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
1537
1552
  return openBlock(), createElementBlock("div", {
1538
1553
  class: normalizeClass(["input-field-wrapper", wrapperClasses.value])
1539
1554
  }, [
1540
- _ctx.$slots["leading-icon"] ? (openBlock(), createElementBlock("div", _hoisted_1$N, [
1555
+ hasLeadingIcon.value ? (openBlock(), createElementBlock("div", _hoisted_1$N, [
1541
1556
  renderSlot(_ctx.$slots, "leading-icon", {}, void 0, true)
1542
1557
  ])) : createCommentVNode("", true),
1543
1558
  createElementVNode("input", {
@@ -1599,7 +1614,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
1599
1614
  };
1600
1615
  }
1601
1616
  });
1602
- const UiInputText = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-67ba177d"]]);
1617
+ const UiInputText = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__scopeId", "data-v-99563a41"]]);
1603
1618
  const _hoisted_1$M = {
1604
1619
  key: 0,
1605
1620
  class: "input-leading-icon"
@@ -1636,6 +1651,8 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
1636
1651
  const props = __props;
1637
1652
  const emit = __emit;
1638
1653
  const slots = useSlots();
1654
+ const hasLeadingIcon = computed(() => hasSlotContent(slots, "leading-icon"));
1655
+ const hasTrailingIcon = computed(() => hasSlotContent(slots, "trailing-icon"));
1639
1656
  const wrapperClasses = computed(() => {
1640
1657
  const classes = [];
1641
1658
  if (props.error) classes.push("input-error");
@@ -1646,12 +1663,12 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
1646
1663
  });
1647
1664
  const paddingClasses = computed(() => {
1648
1665
  const classes = [];
1649
- if (slots["leading-icon"]) {
1666
+ if (hasLeadingIcon.value) {
1650
1667
  classes.push("input-padding-left-icon");
1651
1668
  } else {
1652
1669
  classes.push("input-padding-left");
1653
1670
  }
1654
- if (slots["trailing-icon"]) {
1671
+ if (hasTrailingIcon.value) {
1655
1672
  classes.push("input-padding-right-icon");
1656
1673
  } else {
1657
1674
  classes.push("input-padding-right");
@@ -1675,7 +1692,7 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
1675
1692
  return openBlock(), createElementBlock("div", {
1676
1693
  class: normalizeClass(["input-field-wrapper input-textarea", wrapperClasses.value])
1677
1694
  }, [
1678
- _ctx.$slots["leading-icon"] ? (openBlock(), createElementBlock("div", _hoisted_1$M, [
1695
+ hasLeadingIcon.value ? (openBlock(), createElementBlock("div", _hoisted_1$M, [
1679
1696
  renderSlot(_ctx.$slots, "leading-icon", {}, void 0, true)
1680
1697
  ])) : createCommentVNode("", true),
1681
1698
  createElementVNode("div", {
@@ -1703,14 +1720,14 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
1703
1720
  onKeydown: handleKeydown
1704
1721
  }, null, 42, _hoisted_2$G)
1705
1722
  ], 2),
1706
- _ctx.$slots["trailing-icon"] ? (openBlock(), createElementBlock("div", _hoisted_3$D, [
1723
+ hasTrailingIcon.value ? (openBlock(), createElementBlock("div", _hoisted_3$D, [
1707
1724
  renderSlot(_ctx.$slots, "trailing-icon", {}, void 0, true)
1708
1725
  ])) : createCommentVNode("", true)
1709
1726
  ], 2);
1710
1727
  };
1711
1728
  }
1712
1729
  });
1713
- const UiInputTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-b18ddba2"]]);
1730
+ const UiInputTextarea = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__scopeId", "data-v-ffd4ab5c"]]);
1714
1731
  function useFloatingPosition(options) {
1715
1732
  const {
1716
1733
  trigger,
@@ -25551,7 +25568,9 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
25551
25568
  setup(__props, { emit: __emit }) {
25552
25569
  const props = __props;
25553
25570
  const emit = __emit;
25571
+ const slots = useSlots();
25554
25572
  const inputId = computed(() => `input-${Math.random().toString(36).substring(2, 11)}`);
25573
+ const hasSlotContent$1 = (slotName) => hasSlotContent(slots, slotName);
25555
25574
  const isTextInput = computed(() => {
25556
25575
  const textTypes = ["text", "email", "password", "number", "tel", "url", "search"];
25557
25576
  const inputType = props.type || "text";
@@ -25617,14 +25636,14 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
25617
25636
  onFocus: handleFocus,
25618
25637
  onKeydown: handleKeydown
25619
25638
  }, createSlots({ _: 2 }, [
25620
- _ctx.$slots["leading-icon"] ? {
25639
+ hasSlotContent$1("leading-icon") ? {
25621
25640
  name: "leading-icon",
25622
25641
  fn: withCtx(() => [
25623
25642
  renderSlot(_ctx.$slots, "leading-icon", {}, void 0, true)
25624
25643
  ]),
25625
25644
  key: "0"
25626
25645
  } : void 0,
25627
- _ctx.$slots["trailing-icon"] ? {
25646
+ hasSlotContent$1("trailing-icon") ? {
25628
25647
  name: "trailing-icon",
25629
25648
  fn: withCtx(() => [
25630
25649
  renderSlot(_ctx.$slots, "trailing-icon", {}, void 0, true)
@@ -25653,14 +25672,14 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
25653
25672
  onFocus: handleFocus,
25654
25673
  onKeydown: handleKeydown
25655
25674
  }, createSlots({ _: 2 }, [
25656
- _ctx.$slots["leading-icon"] ? {
25675
+ hasSlotContent$1("leading-icon") ? {
25657
25676
  name: "leading-icon",
25658
25677
  fn: withCtx(() => [
25659
25678
  renderSlot(_ctx.$slots, "leading-icon", {}, void 0, true)
25660
25679
  ]),
25661
25680
  key: "0"
25662
25681
  } : void 0,
25663
- _ctx.$slots["trailing-icon"] ? {
25682
+ hasSlotContent$1("trailing-icon") ? {
25664
25683
  name: "trailing-icon",
25665
25684
  fn: withCtx(() => [
25666
25685
  renderSlot(_ctx.$slots, "trailing-icon", {}, void 0, true)
@@ -25687,14 +25706,14 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
25687
25706
  onBlur: handleBlur,
25688
25707
  onFocus: handleFocus
25689
25708
  }, createSlots({ _: 2 }, [
25690
- _ctx.$slots["leading-icon"] ? {
25709
+ hasSlotContent$1("leading-icon") ? {
25691
25710
  name: "leading-icon",
25692
25711
  fn: withCtx(() => [
25693
25712
  renderSlot(_ctx.$slots, "leading-icon", {}, void 0, true)
25694
25713
  ]),
25695
25714
  key: "0"
25696
25715
  } : void 0,
25697
- _ctx.$slots["trailing-icon"] ? {
25716
+ hasSlotContent$1("trailing-icon") ? {
25698
25717
  name: "trailing-icon",
25699
25718
  fn: withCtx(() => [
25700
25719
  renderSlot(_ctx.$slots, "trailing-icon", {}, void 0, true)
@@ -25722,14 +25741,14 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
25722
25741
  onBlur: handleBlur,
25723
25742
  onFocus: handleFocus
25724
25743
  }, createSlots({ _: 2 }, [
25725
- _ctx.$slots["leading-icon"] ? {
25744
+ hasSlotContent$1("leading-icon") ? {
25726
25745
  name: "leading-icon",
25727
25746
  fn: withCtx(() => [
25728
25747
  renderSlot(_ctx.$slots, "leading-icon", {}, void 0, true)
25729
25748
  ]),
25730
25749
  key: "0"
25731
25750
  } : void 0,
25732
- _ctx.$slots["trailing-icon"] ? {
25751
+ hasSlotContent$1("trailing-icon") ? {
25733
25752
  name: "trailing-icon",
25734
25753
  fn: withCtx(() => [
25735
25754
  renderSlot(_ctx.$slots, "trailing-icon", {}, void 0, true)
@@ -25813,14 +25832,14 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
25813
25832
  onFocus: handleFocus,
25814
25833
  onComplete: handlePincodeComplete
25815
25834
  }, createSlots({ _: 2 }, [
25816
- _ctx.$slots["leading-icon"] ? {
25835
+ hasSlotContent$1("leading-icon") ? {
25817
25836
  name: "leading-icon",
25818
25837
  fn: withCtx(() => [
25819
25838
  renderSlot(_ctx.$slots, "leading-icon", {}, void 0, true)
25820
25839
  ]),
25821
25840
  key: "0"
25822
25841
  } : void 0,
25823
- _ctx.$slots["trailing-icon"] ? {
25842
+ hasSlotContent$1("trailing-icon") ? {
25824
25843
  name: "trailing-icon",
25825
25844
  fn: withCtx(() => [
25826
25845
  renderSlot(_ctx.$slots, "trailing-icon", {}, void 0, true)
@@ -25837,7 +25856,7 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
25837
25856
  };
25838
25857
  }
25839
25858
  });
25840
- const StrandsUiInput = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-a9c816f5"]]);
25859
+ const StrandsUiInput = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__scopeId", "data-v-55d725f7"]]);
25841
25860
  const _hoisted_1$D = ["disabled", "aria-disabled"];
25842
25861
  const _hoisted_2$y = ["href", "target", "rel", "aria-disabled"];
25843
25862
  const _sfc_main$G = /* @__PURE__ */ defineComponent({
@@ -0,0 +1,9 @@
1
+ import type { Slots } from 'vue';
2
+ /**
3
+ * Check if a slot has actual content (not just empty/whitespace)
4
+ *
5
+ * @param slots - Vue slots object from useSlots()
6
+ * @param slotName - Name of the slot to check
7
+ * @returns true if slot has content, false otherwise
8
+ */
9
+ export declare function hasSlotContent(slots: Slots, slotName: string): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strands.gg/accui",
3
- "version": "2.11.21",
3
+ "version": "2.11.23",
4
4
  "description": "Strands Authentication UI Components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs.js",