@strands.gg/accui 2.3.7 → 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,
@@ -1438,10 +1498,10 @@ const _hoisted_1$A = {
1438
1498
  class: "loader-icon"
1439
1499
  };
1440
1500
  const _hoisted_2$t = ["width", "height"];
1441
- const _hoisted_3$r = ["d", "stroke", "stroke-width"];
1442
- const _hoisted_4$p = ["d", "stroke", "stroke-width"];
1443
- const _hoisted_5$m = ["width", "height"];
1444
- const _hoisted_6$l = ["stroke"];
1501
+ const _hoisted_3$r = ["d"];
1502
+ const _hoisted_4$p = ["stroke-width"];
1503
+ const _hoisted_5$m = ["stroke-width"];
1504
+ const _hoisted_6$l = ["width", "height"];
1445
1505
  const _hoisted_7$k = {
1446
1506
  key: 3,
1447
1507
  class: "loader-text"
@@ -1460,32 +1520,12 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1460
1520
  setup(__props) {
1461
1521
  const path = logo.replace(/<svg[^>]*>/, "").replace(/<\/svg>/, "").trim();
1462
1522
  const d = path.match(/d="([^"]*)"/)?.[1] || "";
1463
- const props = __props;
1464
- function getCurrentAccentColor() {
1465
- if (typeof window !== "undefined") {
1466
- const cssValue = getComputedStyle(document.documentElement).getPropertyValue("--strands-accent").trim();
1467
- if (cssValue) {
1468
- return cssValue;
1469
- }
1470
- }
1471
- return "#EA00A8";
1472
- }
1473
- const getColorMap = () => {
1474
- const accentColor = getCurrentAccentColor();
1475
- return {
1476
- primary: { solid: accentColor, semi: `${accentColor}10` },
1477
- success: { solid: "#22c55e", semi: "#22c55e10" },
1478
- warning: { solid: "#f59e0b", semi: "#f59e0b10" },
1479
- danger: { solid: "#ef4444", semi: "#ef444410" },
1480
- white: { solid: "#ffffff", semi: "#ffffff10" },
1481
- black: { solid: "#000000", semi: "#00000010" }
1482
- };
1483
- };
1484
- const semiColor = computed(() => getColorMap()[props.color].semi);
1485
- const solidColor = computed(() => getColorMap()[props.color].solid);
1486
1523
  return (_ctx, _cache) => {
1487
1524
  return openBlock(), createElementBlock("div", {
1488
- class: normalizeClass(["loader-container", { "loader-centered": _ctx.centered }])
1525
+ class: normalizeClass(["loader-container", [
1526
+ { "loader-centered": _ctx.centered },
1527
+ `loader-color-${_ctx.color}`
1528
+ ]])
1489
1529
  }, [
1490
1530
  _ctx.variant === "spinner" ? (openBlock(), createElementBlock("div", _hoisted_1$A, [
1491
1531
  (openBlock(), createElementBlock("svg", {
@@ -1493,25 +1533,30 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1493
1533
  height: _ctx.size,
1494
1534
  viewBox: "0 0 500 500"
1495
1535
  }, [
1496
- createElementVNode("path", {
1497
- d: unref(d),
1536
+ createElementVNode("defs", null, [
1537
+ createElementVNode("path", {
1538
+ id: "logo-path",
1539
+ d: unref(d),
1540
+ transform: "translate(81, 13) scale(1.0)"
1541
+ }, null, 8, _hoisted_3$r)
1542
+ ]),
1543
+ createElementVNode("use", {
1544
+ href: "#logo-path",
1498
1545
  fill: "none",
1499
- stroke: semiColor.value,
1546
+ stroke: "var(--loader-semi-color)",
1500
1547
  "stroke-width": _ctx.weight,
1501
1548
  "stroke-linecap": "round",
1502
- "stroke-linejoin": "round",
1503
- transform: "translate(81, 13) scale(1.0)"
1504
- }, null, 8, _hoisted_3$r),
1505
- createElementVNode("path", {
1506
- d: unref(d),
1549
+ "stroke-linejoin": "round"
1550
+ }, null, 8, _hoisted_4$p),
1551
+ createElementVNode("use", {
1552
+ href: "#logo-path",
1507
1553
  fill: "none",
1508
- stroke: solidColor.value,
1554
+ stroke: "var(--loader-solid-color)",
1509
1555
  "stroke-width": _ctx.weight,
1510
1556
  "stroke-linecap": "round",
1511
1557
  "stroke-linejoin": "round",
1512
- class: "loader-animated-path",
1513
- transform: "translate(81, 13) scale(1.0)"
1514
- }, null, 8, _hoisted_4$p)
1558
+ class: "loader-animated-path"
1559
+ }, null, 8, _hoisted_5$m)
1515
1560
  ], 8, _hoisted_2$t))
1516
1561
  ])) : _ctx.variant === "circle" ? (openBlock(), createElementBlock("div", {
1517
1562
  key: 1,
@@ -1522,18 +1567,18 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1522
1567
  width: _ctx.size,
1523
1568
  height: _ctx.size,
1524
1569
  viewBox: "0 0 50 50"
1525
- }, [
1570
+ }, [..._cache[0] || (_cache[0] = [
1526
1571
  createElementVNode("circle", {
1527
1572
  cx: "25",
1528
1573
  cy: "25",
1529
1574
  r: "20",
1530
1575
  fill: "none",
1531
- stroke: solidColor.value,
1576
+ stroke: "var(--loader-solid-color)",
1532
1577
  "stroke-width": "4",
1533
1578
  "stroke-linecap": "round",
1534
1579
  class: "loader-circle-path"
1535
- }, null, 8, _hoisted_6$l)
1536
- ], 8, _hoisted_5$m))
1580
+ }, null, -1)
1581
+ ])], 8, _hoisted_6$l))
1537
1582
  ], 4)) : _ctx.variant === "bar" ? (openBlock(), createElementBlock("div", {
1538
1583
  key: 2,
1539
1584
  class: "loader-bar",
@@ -1541,23 +1586,17 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
1541
1586
  width: _ctx.fullWidth ? "100%" : `${_ctx.size * 1.5}px`,
1542
1587
  height: `${Math.max(_ctx.size * 0.1, 4)}px`
1543
1588
  })
1544
- }, [
1545
- createElementVNode("div", {
1546
- class: "loader-bar-track",
1547
- style: normalizeStyle({ backgroundColor: semiColor.value })
1548
- }, [
1549
- createElementVNode("div", {
1550
- class: "loader-bar-fill",
1551
- style: normalizeStyle({ backgroundColor: solidColor.value })
1552
- }, null, 4)
1553
- ], 4)
1554
- ], 4)) : createCommentVNode("", true),
1589
+ }, [..._cache[1] || (_cache[1] = [
1590
+ createElementVNode("div", { class: "loader-bar-track" }, [
1591
+ createElementVNode("div", { class: "loader-bar-fill" })
1592
+ ], -1)
1593
+ ])], 4)) : createCommentVNode("", true),
1555
1594
  _ctx.text ? (openBlock(), createElementBlock("p", _hoisted_7$k, toDisplayString(_ctx.text), 1)) : createCommentVNode("", true)
1556
1595
  ], 2);
1557
1596
  };
1558
1597
  }
1559
1598
  });
1560
- const StrandsUiLoader = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-dde32ad9"]]);
1599
+ const StrandsUiLoader = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-ba3ffb77"]]);
1561
1600
  const _hoisted_1$z = ["aria-pressed", "aria-labelledby"];
1562
1601
  const _sfc_main$C = /* @__PURE__ */ defineComponent({
1563
1602
  __name: "UiToggle",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strands.gg/accui",
3
- "version": "2.3.7",
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",