@strands.gg/accui 2.3.8 → 2.3.9

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.
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, provide, onMounted, onUnmounted, createElementBlock, openBlock, normalizeClass, renderSlot, createBlock, Teleport, createCommentVNode, unref, createElementVNode, toDisplayString, createTextVNode, h, useSlots, normalizeStyle, Fragment, resolveDynamicComponent, ref, mergeProps, withCtx, nextTick, toRefs, watch, renderList, reactive, withModifiers, createStaticVNode, createVNode, withDirectives, vModelText, Transition, createSlots, vModelSelect, inject, onBeforeUnmount, withKeys, isMemoSame, getCurrentInstance } from "vue";
1
+ import { defineComponent, computed, provide, onMounted, onUnmounted, createElementBlock, openBlock, normalizeClass, renderSlot, createBlock, Teleport, createCommentVNode, unref, createElementVNode, toDisplayString, createTextVNode, h, useSlots, resolveDynamicComponent, mergeProps, withCtx, Fragment, ref, nextTick, toRefs, watch, normalizeStyle, renderList, reactive, withModifiers, createStaticVNode, createVNode, withDirectives, vModelText, Transition, createSlots, vModelSelect, inject, onBeforeUnmount, withKeys, isMemoSame, getCurrentInstance } from "vue";
2
2
  import { u as useStrandsConfig, p as provideStrandsConfig } from "./useStrandsConfig-C3gBJK6y.es.js";
3
3
  import { s } from "./useStrandsConfig-C3gBJK6y.es.js";
4
4
  import { u as useStrandsAuth } from "./useStrandsAuth-B91u7n_t.es.js";
@@ -146,7 +146,7 @@ const _hoisted_4$t = {
146
146
  "aria-hidden": "true"
147
147
  };
148
148
  const _hoisted_5$q = ["d"];
149
- const _hoisted_6$o = { class: "alert-text-container" };
149
+ const _hoisted_6$n = { class: "alert-text-container" };
150
150
  const _hoisted_7$m = {
151
151
  key: 0,
152
152
  class: "alert-dismiss-container"
@@ -202,7 +202,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
202
202
  }, null, 8, _hoisted_5$q)
203
203
  ]))
204
204
  ]),
205
- createElementVNode("div", _hoisted_6$o, [
205
+ createElementVNode("div", _hoisted_6$n, [
206
206
  _ctx.title ? (openBlock(), createElementBlock("h3", {
207
207
  key: 0,
208
208
  class: normalizeClass(titleClasses.value)
@@ -613,21 +613,20 @@ const Users = createLucideIcon("users", [
613
613
  ["path", { d: "M22 21v-2a4 4 0 0 0-3-3.87", key: "kshegd" }],
614
614
  ["circle", { cx: "9", cy: "7", r: "4", key: "nufk8" }]
615
615
  ]);
616
- const _hoisted_1$E = ["type", "disabled"];
617
- const _hoisted_2$x = {
616
+ const _hoisted_1$E = {
618
617
  key: 0,
619
618
  class: "button-loading-content"
620
619
  };
621
- const _hoisted_3$v = { key: 0 };
622
- const _hoisted_4$s = {
620
+ const _hoisted_2$x = { key: 0 };
621
+ const _hoisted_3$v = {
623
622
  key: 1,
624
623
  class: "button-content"
625
624
  };
626
- const _hoisted_5$p = {
625
+ const _hoisted_4$s = {
627
626
  key: 0,
628
627
  class: "leading-icon"
629
628
  };
630
- const _hoisted_6$n = {
629
+ const _hoisted_5$p = {
631
630
  key: 1,
632
631
  class: "trailing-icon"
633
632
  };
@@ -647,7 +646,8 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
647
646
  iconName: {},
648
647
  leadingIcon: {},
649
648
  trailingIcon: {},
650
- squircle: { type: Boolean, default: false }
649
+ squircle: { type: Boolean, default: false },
650
+ to: {}
651
651
  },
652
652
  emits: ["click"],
653
653
  setup(__props) {
@@ -676,6 +676,36 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
676
676
  const LeadingIconComponent = computed(() => props.leadingIcon ? getLucideIcon(props.leadingIcon) : null);
677
677
  const TrailingIconComponent = computed(() => props.trailingIcon ? getLucideIcon(props.trailingIcon) : null);
678
678
  const IconComponent = computed(() => props.iconName ? getLucideIcon(props.iconName) : null);
679
+ const componentTag = computed(() => {
680
+ if (!props.to) return "button";
681
+ if (typeof process !== "undefined" && process.client !== void 0) {
682
+ return "nuxt-link";
683
+ }
684
+ if (typeof window !== "undefined" && (window.__NUXT__ || window.$nuxt)) {
685
+ return "nuxt-link";
686
+ }
687
+ try {
688
+ if (typeof window !== "undefined" && window.Vue?.Router) {
689
+ return "router-link";
690
+ }
691
+ } catch (e) {
692
+ }
693
+ return "a";
694
+ });
695
+ const linkProps = computed(() => {
696
+ if (!props.to) return {};
697
+ const tag = componentTag.value;
698
+ if (tag === "nuxt-link" || tag === "router-link") {
699
+ return { to: props.to };
700
+ }
701
+ if (tag === "a") {
702
+ if (typeof props.to === "object") {
703
+ return { href: "#route-object-not-supported" };
704
+ }
705
+ return { href: props.to };
706
+ }
707
+ return {};
708
+ });
679
709
  const buttonClasses = computed(() => {
680
710
  const classes = [
681
711
  "ui-button",
@@ -696,56 +726,59 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
696
726
  };
697
727
  });
698
728
  return (_ctx, _cache) => {
699
- return openBlock(), createElementBlock("button", {
700
- type: _ctx.type,
729
+ return openBlock(), createBlock(resolveDynamicComponent(componentTag.value), mergeProps(linkProps.value, {
730
+ type: componentTag.value === "button" ? _ctx.type : void 0,
701
731
  disabled: _ctx.disabled || _ctx.loading,
702
- class: normalizeClass(buttonClasses.value),
703
- style: normalizeStyle(buttonStyles.value),
732
+ class: buttonClasses.value,
733
+ style: buttonStyles.value,
704
734
  onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
705
- }, [
706
- _ctx.loading ? (openBlock(), createElementBlock("span", _hoisted_2$x, [
707
- _cache[1] || (_cache[1] = createElementVNode("svg", {
708
- class: "button-loading-icon",
709
- fill: "none",
710
- viewBox: "0 0 24 24"
711
- }, [
712
- createElementVNode("circle", {
713
- class: "button-loading-track",
714
- cx: "12",
715
- cy: "12",
716
- r: "10",
717
- stroke: "currentColor",
718
- "stroke-width": "4"
719
- }),
720
- createElementVNode("path", {
721
- class: "button-loading-spinner",
722
- fill: "currentColor",
723
- d: "m4 12a8 8 0 0 1 8-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 0 1 4 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
724
- })
725
- ], -1)),
726
- !_ctx.icon ? (openBlock(), createElementBlock("span", _hoisted_3$v, toDisplayString(_ctx.loadingText || "Loading..."), 1)) : createCommentVNode("", true)
727
- ])) : (openBlock(), createElementBlock("span", _hoisted_4$s, [
728
- _ctx.icon ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
729
- IconComponent.value && !unref(slots)["default"] ? (openBlock(), createBlock(resolveDynamicComponent(IconComponent.value), { key: 0 })) : renderSlot(_ctx.$slots, "default", { key: 1 }, void 0, true)
730
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
731
- IconComponent.value || LeadingIconComponent.value || unref(slots)["leading-icon"] ? (openBlock(), createElementBlock("span", _hoisted_5$p, [
732
- IconComponent.value && !LeadingIconComponent.value && !unref(slots)["leading-icon"] ? (openBlock(), createBlock(resolveDynamicComponent(IconComponent.value), { key: 0 })) : createCommentVNode("", true),
733
- LeadingIconComponent.value && !unref(slots)["leading-icon"] ? (openBlock(), createBlock(resolveDynamicComponent(LeadingIconComponent.value), { key: 1 })) : createCommentVNode("", true),
734
- unref(slots)["leading-icon"] ? renderSlot(_ctx.$slots, "leading-icon", { key: 2 }, void 0, true) : createCommentVNode("", true)
735
- ])) : createCommentVNode("", true),
736
- renderSlot(_ctx.$slots, "icon", {}, void 0, true),
737
- renderSlot(_ctx.$slots, "default", {}, void 0, true),
738
- TrailingIconComponent.value || unref(slots)["trailing-icon"] ? (openBlock(), createElementBlock("span", _hoisted_6$n, [
739
- TrailingIconComponent.value && !unref(slots)["trailing-icon"] ? (openBlock(), createBlock(resolveDynamicComponent(TrailingIconComponent.value), { key: 0 })) : createCommentVNode("", true),
740
- unref(slots)["trailing-icon"] ? renderSlot(_ctx.$slots, "trailing-icon", { key: 1 }, void 0, true) : createCommentVNode("", true)
741
- ])) : createCommentVNode("", true)
742
- ], 64))
743
- ]))
744
- ], 14, _hoisted_1$E);
735
+ }), {
736
+ default: withCtx(() => [
737
+ _ctx.loading ? (openBlock(), createElementBlock("span", _hoisted_1$E, [
738
+ _cache[1] || (_cache[1] = createElementVNode("svg", {
739
+ class: "button-loading-icon",
740
+ fill: "none",
741
+ viewBox: "0 0 24 24"
742
+ }, [
743
+ createElementVNode("circle", {
744
+ class: "button-loading-track",
745
+ cx: "12",
746
+ cy: "12",
747
+ r: "10",
748
+ stroke: "currentColor",
749
+ "stroke-width": "4"
750
+ }),
751
+ createElementVNode("path", {
752
+ class: "button-loading-spinner",
753
+ fill: "currentColor",
754
+ d: "m4 12a8 8 0 0 1 8-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 0 1 4 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
755
+ })
756
+ ], -1)),
757
+ !_ctx.icon ? (openBlock(), createElementBlock("span", _hoisted_2$x, toDisplayString(_ctx.loadingText || "Loading..."), 1)) : createCommentVNode("", true)
758
+ ])) : (openBlock(), createElementBlock("span", _hoisted_3$v, [
759
+ _ctx.icon ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
760
+ IconComponent.value && !unref(slots)["default"] ? (openBlock(), createBlock(resolveDynamicComponent(IconComponent.value), { key: 0 })) : renderSlot(_ctx.$slots, "default", { key: 1 }, void 0, true)
761
+ ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
762
+ IconComponent.value || LeadingIconComponent.value || unref(slots)["leading-icon"] ? (openBlock(), createElementBlock("span", _hoisted_4$s, [
763
+ IconComponent.value && !LeadingIconComponent.value && !unref(slots)["leading-icon"] ? (openBlock(), createBlock(resolveDynamicComponent(IconComponent.value), { key: 0 })) : createCommentVNode("", true),
764
+ LeadingIconComponent.value && !unref(slots)["leading-icon"] ? (openBlock(), createBlock(resolveDynamicComponent(LeadingIconComponent.value), { key: 1 })) : createCommentVNode("", true),
765
+ unref(slots)["leading-icon"] ? renderSlot(_ctx.$slots, "leading-icon", { key: 2 }, void 0, true) : createCommentVNode("", true)
766
+ ])) : createCommentVNode("", true),
767
+ renderSlot(_ctx.$slots, "icon", {}, void 0, true),
768
+ renderSlot(_ctx.$slots, "default", {}, void 0, true),
769
+ TrailingIconComponent.value || unref(slots)["trailing-icon"] ? (openBlock(), createElementBlock("span", _hoisted_5$p, [
770
+ TrailingIconComponent.value && !unref(slots)["trailing-icon"] ? (openBlock(), createBlock(resolveDynamicComponent(TrailingIconComponent.value), { key: 0 })) : createCommentVNode("", true),
771
+ unref(slots)["trailing-icon"] ? renderSlot(_ctx.$slots, "trailing-icon", { key: 1 }, void 0, true) : createCommentVNode("", true)
772
+ ])) : createCommentVNode("", true)
773
+ ], 64))
774
+ ]))
775
+ ]),
776
+ _: 3
777
+ }, 16, ["type", "disabled", "class", "style"]);
745
778
  };
746
779
  }
747
780
  });
748
- const StrandsUiButton = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-98ba7614"]]);
781
+ const StrandsUiButton = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__scopeId", "data-v-0a40a982"]]);
749
782
  const _hoisted_1$D = {
750
783
  key: 0,
751
784
  class: "ui-card-header"
@@ -1010,14 +1043,41 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
1010
1043
  const props = __props;
1011
1044
  const emit = __emit;
1012
1045
  const tag = computed(() => {
1013
- if (props.to) return "router-link";
1046
+ if (props.to) {
1047
+ if (typeof process !== "undefined" && process.client !== void 0) {
1048
+ return "nuxt-link";
1049
+ }
1050
+ if (typeof window !== "undefined" && (window.__NUXT__ || window.$nuxt)) {
1051
+ return "nuxt-link";
1052
+ }
1053
+ try {
1054
+ if (typeof window !== "undefined" && window.Vue?.Router) {
1055
+ return "router-link";
1056
+ }
1057
+ } catch (e) {
1058
+ }
1059
+ return "a";
1060
+ }
1014
1061
  if (props.href) return "a";
1015
1062
  return "button";
1016
1063
  });
1017
1064
  const linkProps = computed(() => {
1018
1065
  const baseProps = {};
1066
+ const currentTag = tag.value;
1019
1067
  if (props.to) {
1020
- baseProps["to"] = props.to;
1068
+ if (currentTag === "nuxt-link" || currentTag === "router-link") {
1069
+ baseProps["to"] = props.to;
1070
+ } else if (currentTag === "a") {
1071
+ if (typeof props.to === "object") {
1072
+ baseProps["href"] = "#route-object-not-supported";
1073
+ } else {
1074
+ baseProps["href"] = props.to;
1075
+ if (props.external) {
1076
+ baseProps["target"] = "_blank";
1077
+ baseProps["rel"] = "noopener noreferrer";
1078
+ }
1079
+ }
1080
+ }
1021
1081
  } else if (props.href) {
1022
1082
  baseProps["href"] = props.href;
1023
1083
  if (props.external) {
@@ -1100,7 +1160,7 @@ const _sfc_main$F = /* @__PURE__ */ defineComponent({
1100
1160
  };
1101
1161
  }
1102
1162
  });
1103
- const StrandsUiLink = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-49c069cf"]]);
1163
+ const StrandsUiLink = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__scopeId", "data-v-a9d22fbf"]]);
1104
1164
  const _hoisted_1$B = { class: "tabs-wrapper" };
1105
1165
  const _hoisted_2$u = {
1106
1166
  key: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strands.gg/accui",
3
- "version": "2.3.8",
3
+ "version": "2.3.9",
4
4
  "description": "Strands Authentication UI Components",
5
5
  "type": "module",
6
6
  "main": "./dist/strands-auth-ui.cjs.js",