@indielayer/ui 1.0.0-alpha.5 → 1.0.0-alpha.8

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/lib/index.es.js CHANGED
@@ -17,7 +17,7 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { inject, defineComponent, computed, openBlock, createBlock, resolveDynamicComponent, normalizeClass, normalizeStyle, withCtx, createElementBlock, renderSlot, createCommentVNode, Fragment, pushScopeId, popScopeId, createElementVNode, ref, watchEffect, mergeProps, watch, resolveComponent, toDisplayString, createVNode, renderList, createTextVNode, provide, onMounted, onUnmounted, withKeys, withModifiers, withDirectives, vModelCheckbox, Transition, vShow, getCurrentScope, onScopeDispose, getCurrentInstance, onBeforeMount, nextTick, unref, reactive, toRefs, Teleport, toHandlers, onBeforeUnmount, TransitionGroup, useCssModule, vModelRadio, vModelSelect } from "vue";
20
+ import { inject, defineComponent, computed, openBlock, createBlock, resolveDynamicComponent, normalizeClass, normalizeStyle, withCtx, createElementBlock, renderSlot, createCommentVNode, Fragment, pushScopeId, popScopeId, createElementVNode, ref, watchEffect, mergeProps, watch, resolveComponent, toDisplayString, createVNode, renderList, createTextVNode, provide, onMounted, onUnmounted, withKeys, withModifiers, withDirectives, vModelCheckbox, Transition, vShow, getCurrentScope, onScopeDispose, getCurrentInstance, onBeforeMount, nextTick, unref, reactive, toRefs, Teleport, toHandlers, TransitionGroup, useCssModule, vModelRadio, vModelSelect, onBeforeUnmount } from "vue";
21
21
  const isHex = (hex) => /^#(?:[A-Fa-f0-9]{3}){1,2}$/.test(hex);
22
22
  const isRGB = (rgb) => /^rgb[(](?:\s*0*(?:\d\d?(?:\.\d+)?(?:\s*%)?|\.\d+\s*%|100(?:\.0*)?\s*%|(?:1\d\d|2[0-4]\d|25[0-5])(?:\.\d+)?)\s*(?:,(?![)])|(?=[)]))){3}[)]$/.test(rgb);
23
23
  const isRGBA = (rgba) => /^^rgba[(](?:\s*0*(?:\d\d?(?:\.\d+)?(?:\s*%)?|\.\d+\s*%|100(?:\.0*)?\s*%|(?:1\d\d|2[0-4]\d|25[0-5])(?:\.\d+)?)\s*,){3}\s*0*(?:\.\d+|1(?:\.0*)?)\s*[)]$/.test(rgba);
@@ -365,7 +365,7 @@ const tailwindColors = Object.freeze({
365
365
  900: "#881337"
366
366
  }
367
367
  });
368
- var version = "1.0.0-alpha.5";
368
+ var version = "1.0.0-alpha.8";
369
369
  const injectTabKey = Symbol();
370
370
  const injectFormKey = Symbol();
371
371
  const injectIconsKey = Symbol();
@@ -637,7 +637,8 @@ const _sfc_main$H = defineComponent({
637
637
  }
638
638
  }),
639
639
  setup(props) {
640
- const icons = inject(injectIconsKey, {});
640
+ const icons = inject(injectIconsKey, () => {
641
+ }, false);
641
642
  const sizeClasses = computed(() => {
642
643
  if (props.size === "xs")
643
644
  return "h-3 w-3";
@@ -655,7 +656,7 @@ const _sfc_main$H = defineComponent({
655
656
  const computedViewBox = ref(props.viewBox);
656
657
  const attrs = ref({});
657
658
  watchEffect(() => {
658
- const injectedIcon = icons[props.icon];
659
+ const injectedIcon = icons && icons[props.icon];
659
660
  isWrapSVG.value = false;
660
661
  computedIcon.value = injectedIcon;
661
662
  if (injectedIcon) {
@@ -679,18 +680,18 @@ const _sfc_main$H = defineComponent({
679
680
  }
680
681
  });
681
682
  function getSVG(svgString) {
682
- const temp = document.createElement("template");
683
- temp.innerHTML = svgString.trim();
684
- const [svg] = temp.content.children;
685
- const names = svg.getAttributeNames();
683
+ svgString = svgString.trim();
684
+ const content = svgString.substring(svgString.indexOf(">") + 1, svgString.lastIndexOf("</svg>"));
685
+ const attrsRaw = svgString.substring(svgString.indexOf("<svg") + 4, svgString.indexOf(">")).trim().match(/[\w-]+="[^"]*"/g);
686
686
  const attributes = {};
687
- names.forEach((n) => {
688
- if (!["height", "width", "class"].includes(n))
689
- attributes[n] = svg.getAttribute(n);
687
+ attrsRaw == null ? void 0 : attrsRaw.forEach((a) => {
688
+ const [attribute, value] = a.split("=");
689
+ if (!["height", "width", "class"].includes(attribute))
690
+ attributes[attribute] = value.replace(/(^"|"$)/g, "");
690
691
  });
691
692
  return {
692
693
  attributes,
693
- content: svg.innerHTML
694
+ content
694
695
  };
695
696
  }
696
697
  return {
@@ -855,6 +856,8 @@ const _sfc_main$F = defineComponent({
855
856
  type: String,
856
857
  default: "right"
857
858
  },
859
+ offsetX: [Number, String],
860
+ offsetY: [Number, String],
858
861
  animated: Boolean,
859
862
  outlined: Boolean,
860
863
  icon: String,
@@ -889,8 +892,17 @@ const _sfc_main$F = defineComponent({
889
892
  }
890
893
  return classes;
891
894
  });
895
+ const offsetStyle = computed(() => {
896
+ const style = {};
897
+ if (props.offsetX)
898
+ style[props.align === "left" ? "marginLeft" : "marginRight"] = props.offsetX + "px";
899
+ if (props.offsetY)
900
+ style[props.position === "top" ? "marginTop" : "marginBottom"] = props.offsetY + "px";
901
+ return style;
902
+ });
892
903
  return {
893
904
  styles,
905
+ offsetStyle,
894
906
  positionClasses
895
907
  };
896
908
  }
@@ -915,7 +927,8 @@ function _sfc_render$F(_ctx, _cache, $props, $setup, $data, $options) {
915
927
  {
916
928
  "border-2 border-gray-50 dark:border-gray-900": _ctx.outlined
917
929
  }
918
- ]])
930
+ ]]),
931
+ style: normalizeStyle(_ctx.offsetStyle)
919
932
  }, [
920
933
  _ctx.animated ? (openBlock(), createElementBlock("div", _hoisted_2$i)) : createCommentVNode("", true),
921
934
  createElementVNode("div", {
@@ -931,7 +944,7 @@ function _sfc_render$F(_ctx, _cache, $props, $setup, $data, $options) {
931
944
  }, [
932
945
  renderSlot(_ctx.$slots, "content")
933
946
  ], 2)
934
- ], 2)) : createCommentVNode("", true)
947
+ ], 6)) : createCommentVNode("", true)
935
948
  ])
936
949
  ]),
937
950
  _: 3
@@ -1151,8 +1164,8 @@ const _sfc_main$C = defineComponent({
1151
1164
  bg: gray[800],
1152
1165
  text: "white",
1153
1166
  border: gray[600],
1154
- hover: { bg: !props.loading ? gray[800] : "" },
1155
- active: { bg: !props.loading ? gray[700] : "" }
1167
+ hover: { bg: !props.loading ? gray[700] : "" },
1168
+ active: { bg: !props.loading ? gray[600] : "" }
1156
1169
  }
1157
1170
  }));
1158
1171
  }
@@ -1415,7 +1428,7 @@ function _sfc_render$C(_ctx, _cache, $props, $setup, $data, $options) {
1415
1428
  const cssModules$7 = {
1416
1429
  "$style": style0$7
1417
1430
  };
1418
- var XButton = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$C], ["__cssModules", cssModules$7], ["__scopeId", "data-v-7ada6753"]]);
1431
+ var XButton = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$C], ["__cssModules", cssModules$7], ["__scopeId", "data-v-6cb75733"]]);
1419
1432
  var style0$6 = {
1420
1433
  "button-group": "_button-group_s7fyl_2",
1421
1434
  "button-group--rounded": "_button-group--rounded_s7fyl_1"
@@ -1596,7 +1609,7 @@ const _sfc_main$z = defineComponent({
1596
1609
  const checked = ref(false);
1597
1610
  watch(() => props.modelValue, (value) => {
1598
1611
  checked.value = !!value;
1599
- });
1612
+ }, { immediate: true });
1600
1613
  watch(() => checked.value, (value) => {
1601
1614
  emit("update:modelValue", value);
1602
1615
  });
@@ -1679,7 +1692,7 @@ const _sfc_main$z = defineComponent({
1679
1692
  });
1680
1693
  }
1681
1694
  });
1682
- const _withScopeId$2 = (n) => (pushScopeId("data-v-54fce636"), n = n(), popScopeId(), n);
1695
+ const _withScopeId$2 = (n) => (pushScopeId("data-v-05f49cb5"), n = n(), popScopeId(), n);
1683
1696
  const _hoisted_1$p = { class: "inline-block relative cursor-pointer align-middle mb-1 pb-2" };
1684
1697
  const _hoisted_2$g = ["aria-checked", "aria-disabled", "disabled", "name", "required"];
1685
1698
  const _hoisted_3$d = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("path", { d: "M0 11l2-2 5 5L18 3l2 2L7 18z" }, null, -1));
@@ -1752,7 +1765,7 @@ function _sfc_render$z(_ctx, _cache, $props, $setup, $data, $options) {
1752
1765
  const cssModules$5 = {
1753
1766
  "$style": style0$5
1754
1767
  };
1755
- var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$z], ["__cssModules", cssModules$5], ["__scopeId", "data-v-54fce636"]]);
1768
+ var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$z], ["__cssModules", cssModules$5], ["__scopeId", "data-v-05f49cb5"]]);
1756
1769
  const _sfc_main$y = defineComponent({
1757
1770
  name: "XCollapse",
1758
1771
  components: {
@@ -2392,6 +2405,48 @@ function useScroll(element, options = {}) {
2392
2405
  directions
2393
2406
  };
2394
2407
  }
2408
+ var __getOwnPropSymbols$6 = Object.getOwnPropertySymbols;
2409
+ var __hasOwnProp$6 = Object.prototype.hasOwnProperty;
2410
+ var __propIsEnum$6 = Object.prototype.propertyIsEnumerable;
2411
+ var __objRest$1 = (source, exclude) => {
2412
+ var target = {};
2413
+ for (var prop in source)
2414
+ if (__hasOwnProp$6.call(source, prop) && exclude.indexOf(prop) < 0)
2415
+ target[prop] = source[prop];
2416
+ if (source != null && __getOwnPropSymbols$6)
2417
+ for (var prop of __getOwnPropSymbols$6(source)) {
2418
+ if (exclude.indexOf(prop) < 0 && __propIsEnum$6.call(source, prop))
2419
+ target[prop] = source[prop];
2420
+ }
2421
+ return target;
2422
+ };
2423
+ function useMutationObserver(target, callback, options) {
2424
+ const _a2 = options, { window: window2 = defaultWindow } = _a2, mutationOptions = __objRest$1(_a2, ["window"]);
2425
+ let observer;
2426
+ const isSupported = window2 && "MutationObserver" in window2;
2427
+ const cleanup = () => {
2428
+ if (observer) {
2429
+ observer.disconnect();
2430
+ observer = void 0;
2431
+ }
2432
+ };
2433
+ const stopWatch = watch(() => unrefElement(target), (el) => {
2434
+ cleanup();
2435
+ if (isSupported && window2 && el) {
2436
+ observer = new MutationObserver(callback);
2437
+ observer.observe(el, mutationOptions);
2438
+ }
2439
+ }, { immediate: true });
2440
+ const stop = () => {
2441
+ cleanup();
2442
+ stopWatch();
2443
+ };
2444
+ tryOnScopeDispose(stop);
2445
+ return {
2446
+ isSupported,
2447
+ stop
2448
+ };
2449
+ }
2395
2450
  var SwipeDirection;
2396
2451
  (function(SwipeDirection2) {
2397
2452
  SwipeDirection2["UP"] = "UP";
@@ -2523,7 +2578,7 @@ const _sfc_main$v = defineComponent({
2523
2578
  useResizeObserver(scrollEl, triggerScroll);
2524
2579
  if (props.horizontal && props.mousewheel)
2525
2580
  useEventListener(scrollEl, "wheel", (e) => {
2526
- if (!scrollEl.value)
2581
+ if (!scrollEl.value || scrollEl.value.scrollWidth <= scrollEl.value.clientWidth)
2527
2582
  return;
2528
2583
  e.preventDefault();
2529
2584
  scrollEl.value.scrollLeft += e.deltaY + e.deltaX;
@@ -2576,7 +2631,7 @@ function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
2576
2631
  const cssModules$4 = {
2577
2632
  "$style": style0$4
2578
2633
  };
2579
- var XScroll = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["render", _sfc_render$v], ["__cssModules", cssModules$4], ["__scopeId", "data-v-ff88aa62"]]);
2634
+ var XScroll = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["render", _sfc_render$v], ["__cssModules", cssModules$4], ["__scopeId", "data-v-7362ac18"]]);
2580
2635
  const _sfc_main$u = defineComponent({
2581
2636
  name: "XDrawer",
2582
2637
  components: {
@@ -2939,7 +2994,8 @@ const _sfc_main$r = defineComponent({
2939
2994
  type: String,
2940
2995
  default: "text"
2941
2996
  },
2942
- inputClass: String
2997
+ inputClass: String,
2998
+ block: Boolean
2943
2999
  }),
2944
3000
  emits: useInputtable.emits(),
2945
3001
  setup(props, { emit }) {
@@ -3016,7 +3072,7 @@ const _hoisted_8$1 = ["textContent"];
3016
3072
  function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
3017
3073
  const _component_x_icon = resolveComponent("x-icon");
3018
3074
  return openBlock(), createElementBlock("label", {
3019
- class: normalizeClass(["inline-block relative align-bottom text-left", { "mb-3": _ctx.isInsideForm }])
3075
+ class: normalizeClass(["inline-block relative align-bottom text-left", { "mb-3": _ctx.isInsideForm, "w-full": _ctx.block }])
3020
3076
  }, [
3021
3077
  _ctx.label ? (openBlock(), createElementBlock("p", {
3022
3078
  key: 0,
@@ -3054,7 +3110,7 @@ function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
3054
3110
  placeholder: _ctx.placeholder,
3055
3111
  readonly: _ctx.readonly,
3056
3112
  type: _ctx.currentType,
3057
- value: _ctx.modelValue
3113
+ value: _ctx.modelValue || ""
3058
3114
  }, _ctx.$attrs, toHandlers(_ctx.inputListeners), {
3059
3115
  onChange: _cache[0] || (_cache[0] = (...args) => _ctx.onChange && _ctx.onChange(...args))
3060
3116
  }), null, 16, _hoisted_3$b),
@@ -3133,7 +3189,7 @@ const _sfc_main$q = defineComponent({
3133
3189
  };
3134
3190
  }
3135
3191
  });
3136
- const _withScopeId$1 = (n) => (pushScopeId("data-v-b6c57c10"), n = n(), popScopeId(), n);
3192
+ const _withScopeId$1 = (n) => (pushScopeId("data-v-af336fea"), n = n(), popScopeId(), n);
3137
3193
  const _hoisted_1$i = {
3138
3194
  key: 0,
3139
3195
  class: "inline-flex items-center"
@@ -3160,7 +3216,7 @@ const _hoisted_2$d = /* @__PURE__ */ _withScopeId$1(() => /* @__PURE__ */ create
3160
3216
  function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
3161
3217
  return openBlock(), createBlock(resolveDynamicComponent(_ctx.to ? "router-link" : _ctx.tag), {
3162
3218
  to: _ctx.to,
3163
- class: normalizeClass(["transition duration-300 ease-in-out cursor-pointer text-[color:var(--x-text)] dark:text-[color:var(--x-dark-text)]", [
3219
+ class: normalizeClass(["transition duration-300 ease-in-out cursor-pointer inline-flex text-[color:var(--x-text)] dark:text-[color:var(--x-dark-text)]", [
3164
3220
  [_ctx.shadow ? _ctx.$style["link--shadow"] : ""],
3165
3221
  {
3166
3222
  "underline": _ctx.underline
@@ -3180,7 +3236,7 @@ function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
3180
3236
  const cssModules$3 = {
3181
3237
  "$style": style0$3
3182
3238
  };
3183
- var XLink = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$q], ["__cssModules", cssModules$3], ["__scopeId", "data-v-b6c57c10"]]);
3239
+ var XLink = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$q], ["__cssModules", cssModules$3], ["__scopeId", "data-v-af336fea"]]);
3184
3240
  var style0$2 = {
3185
3241
  "menu-item": "_menu-item_1v1kj_2",
3186
3242
  "menu-item--active": "_menu-item--active_1v1kj_1"
@@ -3209,8 +3265,14 @@ const _sfc_main$p = defineComponent({
3209
3265
  icon: String,
3210
3266
  iconRight: String,
3211
3267
  loading: Boolean,
3212
- rounded: Boolean,
3213
- filled: Boolean,
3268
+ rounded: {
3269
+ type: Boolean,
3270
+ default: true
3271
+ },
3272
+ filled: {
3273
+ type: Boolean,
3274
+ default: true
3275
+ },
3214
3276
  selected: Boolean,
3215
3277
  disabled: Boolean
3216
3278
  }),
@@ -3224,23 +3286,22 @@ const _sfc_main$p = defineComponent({
3224
3286
  });
3225
3287
  const cItem = computed(() => __spreadValues(__spreadValues({}, props), props.item));
3226
3288
  const htmlTag = cItem.value.to || cItem.value.href ? "x-link" : "div";
3227
- const isSupported = window && "MutationObserver" in window;
3228
- const classObserver = isSupported ? new MutationObserver(check) : null;
3229
3289
  onMounted(() => {
3230
3290
  if (!elRef.value)
3231
3291
  return;
3232
3292
  check();
3233
- if (isSupported && htmlTag === "x-link")
3234
- classObserver == null ? void 0 : classObserver.observe(elRef.value.$el, {
3293
+ if (htmlTag === "x-link")
3294
+ useMutationObserver(elRef.value.$el, check, {
3235
3295
  attributes: true,
3236
3296
  attributeFilter: ["class"]
3237
3297
  });
3238
3298
  });
3239
- onBeforeUnmount(() => {
3240
- if (classObserver)
3241
- classObserver.disconnect();
3242
- });
3243
3299
  function onItemClick(e) {
3300
+ if (cItem.value.disabled) {
3301
+ e.stopPropagation();
3302
+ e.preventDefault();
3303
+ return;
3304
+ }
3244
3305
  cItem.value.onClick && cItem.value.onClick(e);
3245
3306
  emit("click", e);
3246
3307
  }
@@ -3265,7 +3326,12 @@ const _sfc_main$p = defineComponent({
3265
3326
  const color = colors.getPalette(cItem.value.color || "gray");
3266
3327
  const gray = colors.getPalette("gray");
3267
3328
  if (cItem.value.disabled)
3268
- return css.get("text", gray[300]);
3329
+ return css.variables({
3330
+ text: gray[300],
3331
+ dark: {
3332
+ text: gray[600]
3333
+ }
3334
+ });
3269
3335
  if (filled.value) {
3270
3336
  if (isActive.value) {
3271
3337
  return css.variables({
@@ -3359,7 +3425,7 @@ function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
3359
3425
  href: _ctx.cItem.href,
3360
3426
  target: _ctx.cItem.target,
3361
3427
  color: _ctx.cItem.color,
3362
- class: normalizeClass(["relative flex items-center whitespace-nowrap px-3 mt-1", [
3428
+ class: normalizeClass(["relative !flex items-center whitespace-nowrap px-3 mt-1", [
3363
3429
  _ctx.$style["menu-item"],
3364
3430
  [_ctx.isActive ? _ctx.$style["menu-item--active"] : ""],
3365
3431
  {
@@ -3414,7 +3480,7 @@ function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
3414
3480
  const cssModules$2 = {
3415
3481
  "$style": style0$2
3416
3482
  };
3417
- var XMenuItem = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$p], ["__cssModules", cssModules$2], ["__scopeId", "data-v-6f9d99e4"]]);
3483
+ var XMenuItem = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$p], ["__cssModules", cssModules$2], ["__scopeId", "data-v-295f8cb3"]]);
3418
3484
  const _sfc_main$o = defineComponent({
3419
3485
  name: "XMenu",
3420
3486
  components: {
@@ -3431,8 +3497,14 @@ const _sfc_main$o = defineComponent({
3431
3497
  collapseIcon: String,
3432
3498
  expanded: Boolean,
3433
3499
  disabled: Boolean,
3434
- rounded: Boolean,
3435
- filled: Boolean
3500
+ rounded: {
3501
+ type: Boolean,
3502
+ default: true
3503
+ },
3504
+ filled: {
3505
+ type: Boolean,
3506
+ default: true
3507
+ }
3436
3508
  }),
3437
3509
  emits: ["expand"]
3438
3510
  });
@@ -3523,7 +3595,8 @@ var Menu = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$o]])
3523
3595
  const _sfc_main$n = defineComponent({
3524
3596
  name: "XModal",
3525
3597
  components: {
3526
- XScroll
3598
+ XScroll,
3599
+ XIcon
3527
3600
  },
3528
3601
  props: {
3529
3602
  size: {
@@ -3648,7 +3721,7 @@ function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
3648
3721
  }, [
3649
3722
  _ctx.showClose ? (openBlock(), createElementBlock("div", {
3650
3723
  key: 0,
3651
- class: normalizeClass(["absolute p-1 top-4 right-4 rounded-full bg-opacity-10 hover:bg-opacity-30 cursor-pointer", [
3724
+ class: normalizeClass(["flex absolute p-1 top-4 z-10 right-4 rounded-full bg-opacity-10 hover:bg-opacity-30 cursor-pointer", [
3652
3725
  _ctx.$slots.image ? "bg-gray-900 text-white" : "bg-gray-500 text-gray-800 dark:text-gray-300"
3653
3726
  ]]),
3654
3727
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.close && _ctx.close(...args))
@@ -4485,7 +4558,7 @@ const _sfc_main$g = defineComponent({
4485
4558
  });
4486
4559
  }
4487
4560
  });
4488
- const _withScopeId = (n) => (pushScopeId("data-v-857bd200"), n = n(), popScopeId(), n);
4561
+ const _withScopeId = (n) => (pushScopeId("data-v-4e34dad2"), n = n(), popScopeId(), n);
4489
4562
  const _hoisted_1$c = ["aria-selected", "aria-disabled"];
4490
4563
  const _hoisted_2$8 = ["name", "required", "disabled"];
4491
4564
  const _hoisted_3$6 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("circle", {
@@ -4502,10 +4575,11 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
4502
4575
  const _component_x_spinner = resolveComponent("x-spinner");
4503
4576
  return openBlock(), createElementBlock("label", {
4504
4577
  ref: "elRef",
4505
- class: "inline-block mb-1 relative cursor-pointer focus:outline-none",
4578
+ tabindex: "0",
4579
+ class: "inline-block mb-1 relative cursor-pointer focus:outline-none group",
4506
4580
  "aria-selected": _ctx.selected ? "true" : "false",
4507
4581
  "aria-disabled": _ctx.disabled || _ctx.loading ? "true" : void 0,
4508
- tabindex: "0",
4582
+ style: normalizeStyle(_ctx.styles),
4509
4583
  onKeypress: _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => _ctx.$emit("update:modelValue", _ctx.value), ["prevent", "stop"]), ["space"]))
4510
4584
  }, [
4511
4585
  createElementVNode("div", {
@@ -4522,15 +4596,14 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
4522
4596
  [vModelRadio, _ctx.selected]
4523
4597
  ]),
4524
4598
  createElementVNode("div", {
4525
- class: normalizeClass(["rounded-full flex justify-center items-center flex-shrink-0 border-2 border-[color:var(--x-border)] bg-[color:var(--x-bg)] dark:border-[color:var(--x-dark-border)] dark:bg-[color:var(--x-dark-bg)]", [
4599
+ class: normalizeClass(["rounded-full flex justify-center items-center flex-shrink-0 border-2 outline-offset-2 outline-slate-300 dark:outline-slate-500 group-focus:outline-1 group-focus:outline border-[color:var(--x-border)] bg-[color:var(--x-bg)] dark:border-[color:var(--x-dark-border)] dark:bg-[color:var(--x-dark-bg)]", [
4526
4600
  [_ctx.glow && !_ctx.disabled && !_ctx.loading ? _ctx.$style["radio--glow"] : ""],
4527
4601
  {
4528
4602
  "h-4 w-4": _ctx.size === "sm" || _ctx.size === "xs",
4529
4603
  "h-5 w-5": !_ctx.size || !["xs", "sm", "xl"].includes(_ctx.size),
4530
4604
  "h-6 w-6": _ctx.size === "xl"
4531
4605
  }
4532
- ]]),
4533
- style: normalizeStyle(_ctx.styles)
4606
+ ]])
4534
4607
  }, [
4535
4608
  _ctx.loading ? (openBlock(), createBlock(_component_x_spinner, {
4536
4609
  key: 0,
@@ -4547,7 +4620,7 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
4547
4620
  }]),
4548
4621
  viewBox: "0 0 20 20"
4549
4622
  }, _hoisted_4$5, 2))
4550
- ], 6),
4623
+ ], 2),
4551
4624
  _ctx.label ? (openBlock(), createElementBlock("span", {
4552
4625
  key: 0,
4553
4626
  class: normalizeClass(["font-medium text-gray-800 dark:text-gray-200 pl-2", {
@@ -4576,12 +4649,12 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
4576
4649
  class: "text-sm text-red-500 mt-1",
4577
4650
  textContent: toDisplayString(_ctx.errorInternal)
4578
4651
  }, null, 8, _hoisted_6$2)) : createCommentVNode("", true)
4579
- ], 40, _hoisted_1$c);
4652
+ ], 44, _hoisted_1$c);
4580
4653
  }
4581
4654
  const cssModules = {
4582
4655
  "$style": style0
4583
4656
  };
4584
- var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$g], ["__cssModules", cssModules], ["__scopeId", "data-v-857bd200"]]);
4657
+ var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$g], ["__cssModules", cssModules], ["__scopeId", "data-v-4e34dad2"]]);
4585
4658
  const _sfc_main$f = defineComponent({
4586
4659
  name: "XTag",
4587
4660
  props: __spreadProps(__spreadValues(__spreadValues({}, useCommon.props()), useColors.props("gray")), {
@@ -5591,13 +5664,14 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
5591
5664
  "text-align": header.align,
5592
5665
  sort: _ctx.getSort(header.value, _ctx.sort),
5593
5666
  sortable: header.sortable,
5667
+ width: header.width,
5594
5668
  onClick: ($event) => header.sortable ? _ctx.sortHeader(header) : null
5595
5669
  }, {
5596
5670
  default: withCtx(() => [
5597
5671
  createTextVNode(toDisplayString(header.text), 1)
5598
5672
  ]),
5599
5673
  _: 2
5600
- }, 1032, ["sticky-header", "text-align", "sort", "sortable", "onClick"]);
5674
+ }, 1032, ["sticky-header", "text-align", "sort", "sortable", "width", "onClick"]);
5601
5675
  }), 128))
5602
5676
  ]),
5603
5677
  _: 1
@@ -5642,10 +5716,13 @@ function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
5642
5716
  var Table = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5]]);
5643
5717
  const _sfc_main$4 = defineComponent({
5644
5718
  name: "XTab",
5719
+ components: {
5720
+ XIcon,
5721
+ XLink
5722
+ },
5645
5723
  props: __spreadProps(__spreadValues({}, useCommon.props()), {
5646
5724
  value: {
5647
- type: [String, Number],
5648
- required: true
5725
+ type: [String, Number]
5649
5726
  },
5650
5727
  tag: {
5651
5728
  type: String,
@@ -5654,11 +5731,14 @@ const _sfc_main$4 = defineComponent({
5654
5731
  to: String,
5655
5732
  label: String,
5656
5733
  icon: String,
5657
- disabled: Boolean
5734
+ disabled: Boolean,
5735
+ exact: Boolean
5658
5736
  }),
5659
5737
  setup(props) {
5738
+ const cValue = computed(() => props.to || props.value);
5660
5739
  const cLabel = computed(() => props.label || props.value);
5661
5740
  const teleportTo = ref(null);
5741
+ const elRef = ref();
5662
5742
  const tabs = inject(injectTabKey, {
5663
5743
  tabsContentRef: ref(null),
5664
5744
  activateTab: () => {
@@ -5669,20 +5749,53 @@ const _sfc_main$4 = defineComponent({
5669
5749
  grow: false
5670
5750
  })
5671
5751
  });
5752
+ const cExact = computed(() => tabs.state.exact || props.exact);
5753
+ const cSize = computed(() => props.size || tabs.state.size);
5672
5754
  onMounted(() => {
5673
5755
  teleportTo.value = tabs.tabsContentRef.value;
5756
+ if (props.to) {
5757
+ check();
5758
+ useMutationObserver(elRef.value.$el, check, {
5759
+ attributes: true,
5760
+ attributeFilter: ["class"]
5761
+ });
5762
+ }
5674
5763
  });
5764
+ function check() {
5765
+ var _a2;
5766
+ if (elRef.value && elRef.value.$el && props.to) {
5767
+ const active = (_a2 = elRef.value) == null ? void 0 : _a2.$el.classList.contains(cExact.value ? "router-link-exact-active" : "router-link-active");
5768
+ if (active)
5769
+ tabs.activateTab(cValue.value);
5770
+ }
5771
+ }
5675
5772
  const state = reactive({
5676
- selected: computed(() => tabs.state.active === props.value)
5773
+ selected: computed(() => tabs.state.active === cValue.value)
5677
5774
  });
5678
5775
  function onClickTab() {
5679
- tabs.activateTab(props.value);
5776
+ if (!props.to)
5777
+ tabs.activateTab(cValue.value);
5680
5778
  }
5779
+ const sizeClasses = computed(() => {
5780
+ if (cSize.value === "xs")
5781
+ return "text-xs";
5782
+ else if (cSize.value === "sm")
5783
+ return "text-sm";
5784
+ else if (cSize.value === "lg")
5785
+ return "text-lg";
5786
+ else if (cSize.value === "xl")
5787
+ return "text-xl";
5788
+ return "";
5789
+ });
5681
5790
  return __spreadProps(__spreadValues({}, toRefs(state)), {
5682
5791
  variant: tabs.state.variant,
5683
5792
  grow: tabs.state.grow,
5793
+ elRef,
5684
5794
  cLabel,
5795
+ cValue,
5796
+ cSize,
5685
5797
  tabs,
5798
+ sizeClasses,
5686
5799
  teleportTo,
5687
5800
  onClickTab
5688
5801
  });
@@ -5691,14 +5804,16 @@ const _sfc_main$4 = defineComponent({
5691
5804
  const _hoisted_1$3 = ["data-value"];
5692
5805
  const _hoisted_2$2 = { class: "flex items-center justify-center" };
5693
5806
  function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
5694
- const _component_x_icon = resolveComponent("x-icon");
5807
+ const _component_XIcon = resolveComponent("XIcon");
5695
5808
  return openBlock(), createElementBlock("li", {
5696
- "data-value": _ctx.value,
5809
+ "data-value": _ctx.cValue,
5697
5810
  class: normalizeClass(["shrink-0 font-medium", { "flex-1": _ctx.grow }])
5698
5811
  }, [
5699
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.to ? "router-link" : _ctx.tag), {
5812
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.to ? "x-link" : _ctx.tag), {
5813
+ ref: "elRef",
5700
5814
  to: _ctx.to,
5701
5815
  class: normalizeClass(["py-2 transition-colors duration-150 ease-in-out whitespace-nowrap text-center", [
5816
+ _ctx.sizeClasses,
5702
5817
  {
5703
5818
  "px-8": _ctx.variant === "block",
5704
5819
  "text-[color:var(--x-tabs-text)] dark:text-[color:var(--x-dark-tabs-text)]": _ctx.selected,
@@ -5715,14 +5830,14 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
5715
5830
  renderSlot(_ctx.$slots, "tab", {
5716
5831
  label: _ctx.label,
5717
5832
  value: _ctx.value,
5718
- size: _ctx.size,
5833
+ size: _ctx.cSize,
5719
5834
  icon: _ctx.icon
5720
5835
  }, () => [
5721
5836
  createElementVNode("div", _hoisted_2$2, [
5722
- _ctx.icon ? (openBlock(), createBlock(_component_x_icon, {
5837
+ _ctx.icon ? (openBlock(), createBlock(_component_XIcon, {
5723
5838
  key: 0,
5724
5839
  icon: _ctx.icon,
5725
- size: _ctx.size,
5840
+ size: _ctx.cSize,
5726
5841
  class: "mr-1.5 shrink-0"
5727
5842
  }, null, 8, ["icon", "size"])) : createCommentVNode("", true),
5728
5843
  createElementVNode("span", null, toDisplayString(_ctx.cLabel), 1)
@@ -5745,14 +5860,19 @@ const _sfc_main$3 = defineComponent({
5745
5860
  components: {
5746
5861
  XScroll
5747
5862
  },
5748
- props: __spreadProps(__spreadValues({}, useColors.props("primary")), {
5863
+ props: __spreadProps(__spreadValues(__spreadValues({}, useCommon.props()), useColors.props("primary")), {
5749
5864
  modelValue: [String, Number],
5750
5865
  variant: {
5751
5866
  type: String,
5752
5867
  default: "line"
5753
5868
  },
5869
+ align: {
5870
+ type: String,
5871
+ default: "left"
5872
+ },
5754
5873
  ghost: Boolean,
5755
- grow: Boolean
5874
+ grow: Boolean,
5875
+ exact: Boolean
5756
5876
  }),
5757
5877
  emits: ["update:modelValue"],
5758
5878
  setup(props, { emit }) {
@@ -5761,13 +5881,20 @@ const _sfc_main$3 = defineComponent({
5761
5881
  const trackerRef = ref();
5762
5882
  const tabsRef = ref();
5763
5883
  const tabsContentRef = ref();
5884
+ const active = ref();
5885
+ watchEffect(() => {
5886
+ active.value = props.modelValue;
5887
+ });
5764
5888
  const state = reactive({
5765
- active: computed(() => props.modelValue),
5889
+ active: computed(() => active.value),
5766
5890
  variant: computed(() => props.variant),
5767
5891
  ghost: computed(() => props.ghost),
5768
- grow: computed(() => props.grow)
5892
+ grow: computed(() => props.grow),
5893
+ exact: computed(() => props.exact),
5894
+ size: computed(() => props.size)
5769
5895
  });
5770
5896
  function activateTab(tab) {
5897
+ active.value = tab;
5771
5898
  emit("update:modelValue", tab);
5772
5899
  }
5773
5900
  provide(injectTabKey, {
@@ -5791,13 +5918,13 @@ const _sfc_main$3 = defineComponent({
5791
5918
  scrollRef.value.scrollEl.scrollTo({ left: center, behavior: "smooth" });
5792
5919
  }, 100);
5793
5920
  useResizeObserver(wrapperRef, () => {
5794
- updateTracker(props.modelValue);
5921
+ updateTracker(active.value);
5795
5922
  });
5796
- watch(() => props.modelValue, (value) => {
5923
+ watch(() => active.value, (value) => {
5797
5924
  updateTracker(value);
5798
5925
  });
5799
5926
  onMounted(() => {
5800
- updateTracker(props.modelValue);
5927
+ updateTracker(active.value);
5801
5928
  });
5802
5929
  const css = useCSS("tabs");
5803
5930
  const colors = useColors();
@@ -5848,7 +5975,9 @@ function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
5848
5975
  class: normalizeClass(["flex relative min-w-full w-fit", {
5849
5976
  "border-b border-gray-200 dark:border-gray-700": _ctx.variant === "line",
5850
5977
  "space-x-8": _ctx.variant === "line" && !_ctx.grow,
5851
- "z-[1]": _ctx.variant === "block"
5978
+ "z-[1]": _ctx.variant === "block",
5979
+ "justify-center": _ctx.align === "center",
5980
+ "justify-end": _ctx.align === "right"
5852
5981
  }])
5853
5982
  }, [
5854
5983
  renderSlot(_ctx.$slots, "default")
@@ -5878,6 +6007,7 @@ const _sfc_main$2 = defineComponent({
5878
6007
  type: String,
5879
6008
  default: "ltr"
5880
6009
  },
6010
+ rows: Number,
5881
6011
  max: Number,
5882
6012
  maxlength: Number,
5883
6013
  min: Number,
@@ -5888,7 +6018,8 @@ const _sfc_main$2 = defineComponent({
5888
6018
  default: true
5889
6019
  },
5890
6020
  preventEnter: Boolean,
5891
- inputClass: String
6021
+ inputClass: String,
6022
+ block: Boolean
5892
6023
  }),
5893
6024
  emits: useInputtable.emits(),
5894
6025
  setup(props, { emit }) {
@@ -5938,13 +6069,13 @@ const _sfc_main$2 = defineComponent({
5938
6069
  }
5939
6070
  });
5940
6071
  const _hoisted_1$1 = ["textContent"];
5941
- const _hoisted_2$1 = ["disabled", "max", "maxlength", "min", "dir", "minlength", "name", "placeholder", "readonly", "value"];
6072
+ const _hoisted_2$1 = ["disabled", "max", "maxlength", "min", "dir", "rows", "minlength", "name", "placeholder", "readonly", "value"];
5942
6073
  const _hoisted_3$1 = ["textContent"];
5943
6074
  const _hoisted_4$1 = ["textContent"];
5944
6075
  function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
5945
6076
  var _a2;
5946
6077
  return openBlock(), createElementBlock("label", {
5947
- class: normalizeClass(["inline-block relative align-bottom text-left", { "mb-3": _ctx.isInsideForm }])
6078
+ class: normalizeClass(["inline-block relative align-bottom text-left", { "mb-3": _ctx.isInsideForm, "w-full": _ctx.block }])
5948
6079
  }, [
5949
6080
  _ctx.label ? (openBlock(), createElementBlock("p", {
5950
6081
  key: 0,
@@ -5978,6 +6109,7 @@ function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
5978
6109
  maxlength: _ctx.maxlength,
5979
6110
  min: _ctx.min,
5980
6111
  dir: _ctx.dir,
6112
+ rows: _ctx.rows,
5981
6113
  minlength: _ctx.minlength,
5982
6114
  name: _ctx.name,
5983
6115
  placeholder: _ctx.placeholder,
@@ -6047,7 +6179,7 @@ const _hoisted_4 = ["textContent"];
6047
6179
  function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
6048
6180
  const _component_x_spinner = resolveComponent("x-spinner");
6049
6181
  return openBlock(), createElementBlock("label", {
6050
- class: normalizeClass(["inline-block mb-1 pb-2", [!_ctx.disabled ? "cursor-pointer" : "cursor-not-allowed"]])
6182
+ class: normalizeClass(["inline-block", [!_ctx.disabled ? "cursor-pointer" : "cursor-not-allowed"]])
6051
6183
  }, [
6052
6184
  createElementVNode("div", _hoisted_1, [
6053
6185
  createElementVNode("div", {
@@ -6217,7 +6349,7 @@ const create = (createOptions = {}) => {
6217
6349
  app.component(`${options.prefix}${component.name.slice(1)}`, component);
6218
6350
  });
6219
6351
  app.provide(injectColorsKey, options.colors);
6220
- app.provide(injectIconsKey, options.icons);
6352
+ app.provide(injectIconsKey, options.icons || {});
6221
6353
  };
6222
6354
  return {
6223
6355
  install: install2