hys-ui 0.3.0 → 0.5.0

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.
Files changed (168) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +68 -73
  3. package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +5 -41
  4. package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +467 -2
  5. package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.js +7 -0
  6. package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas2.vue.js +166 -0
  7. package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.js +7 -0
  8. package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits2.vue.js +105 -0
  9. package/dist/components/HysAnimatedNumber/animation/digital.js +186 -0
  10. package/dist/components/HysAnimatedNumber/animation/morph.js +110 -0
  11. package/dist/components/HysAnimatedNumber/animation/paint.js +34 -0
  12. package/dist/components/HysAnimatedNumber/animation/particles.js +51 -0
  13. package/dist/components/HysAnimatedNumber/animation/paths.js +165 -0
  14. package/dist/components/HysAnimatedNumber/animation/physics.js +66 -0
  15. package/dist/components/HysAnimatedNumber/animation/render.js +89 -0
  16. package/dist/components/HysAnimatedNumber/animation/reveal.js +125 -0
  17. package/dist/components/HysAnimatedNumber/animation/rolling.js +66 -0
  18. package/dist/components/HysAnimatedNumber/animation/scenarios.js +217 -0
  19. package/dist/components/HysAnimatedNumber/animation/spatial.js +112 -0
  20. package/dist/components/HysAnimatedNumber/useNumberCountdown.js +58 -0
  21. package/dist/components/HysAnimatedNumber/useNumberVisuals.js +60 -0
  22. package/dist/components/HysButton/HysButton.vue.js +2 -2
  23. package/dist/components/HysButton/HysButton2.vue.js +227 -60
  24. package/dist/components/HysButtonGroup/HysButtonGroup.vue.js +7 -0
  25. package/dist/components/HysButtonGroup/HysButtonGroup2.vue.js +51 -0
  26. package/dist/components/HysFormItem/HysFormItem.vue.js +1 -1
  27. package/dist/components/HysFormItem/HysFormItem2.vue.js +231 -229
  28. package/dist/components/HysInput/HysInput.vue.js +2 -2
  29. package/dist/components/HysInput/HysInput2.vue.js +327 -274
  30. package/dist/components/HysMention/HysMention.vue.js +1 -1
  31. package/dist/components/HysMention/HysMention2.vue.js +1092 -154
  32. package/dist/components/HysModal/HysModal.vue.js +3 -3
  33. package/dist/components/HysModal/HysModal2.vue.js +81 -80
  34. package/dist/components/HysPagination/HysPagination.vue.js +2 -2
  35. package/dist/components/HysPagination/HysPagination2.vue.js +243 -180
  36. package/dist/components/HysSearch/HysSearch.vue.js +5 -82
  37. package/dist/components/HysSearch/HysSearch2.vue.js +176 -2
  38. package/dist/components/HysSelect/HysSelect.vue.js +2 -2
  39. package/dist/components/HysSelect/HysSelect2.vue.js +472 -443
  40. package/dist/components/HysSplitPane/HysSplitPane.vue.js +315 -58
  41. package/dist/components/HysSplitPane/HysSplitPane3.vue.js +5 -0
  42. package/dist/components/HysTable/HysTable.vue.js +2 -2
  43. package/dist/components/HysTable/HysTable2.vue.js +1418 -1150
  44. package/dist/components/HysTextarea/HysTextarea.vue.js +56 -32
  45. package/dist/components/HysTour/HysTour.vue.js +291 -67
  46. package/dist/components/HysTour/HysTour3.vue.js +5 -0
  47. package/dist/composables/animatedNumberDigits.js +106 -0
  48. package/dist/composables/animatedNumberFormat.js +222 -0
  49. package/dist/composables/animatedNumberTiming.js +66 -0
  50. package/dist/composables/buttonGroup.js +12 -0
  51. package/dist/composables/floatingPosition.js +18 -0
  52. package/dist/composables/mentionDocument.js +79 -0
  53. package/dist/composables/mentionEditor.js +58 -0
  54. package/dist/composables/numberAnimation.js +72 -0
  55. package/dist/composables/numberAnimationCatalog.js +301 -0
  56. package/dist/composables/numberAnimationSequence.js +45 -0
  57. package/dist/composables/selectOptions.js +44 -38
  58. package/dist/composables/splitPaneSizes.js +58 -0
  59. package/dist/composables/table.js +128 -105
  60. package/dist/composables/textInput.js +23 -14
  61. package/dist/composables/useDialog.js +50 -50
  62. package/dist/composables/useFloating.js +107 -103
  63. package/dist/composables/useHysAnimatedNumber.js +264 -0
  64. package/dist/composables/useHysNumberAnimationGroup.js +23 -0
  65. package/dist/composables/useMentionCaret.js +81 -0
  66. package/dist/composables/useMentionList.js +81 -0
  67. package/dist/composables/useMentionModel.js +90 -0
  68. package/dist/composables/useMentionOptions.js +421 -0
  69. package/dist/composables/useSplitPaneDrag.js +52 -0
  70. package/dist/composables/useSplitPaneStorage.js +38 -0
  71. package/dist/composables/useTable.js +344 -312
  72. package/dist/composables/useTableSticky.js +79 -0
  73. package/dist/composables/useTextareaSize.js +62 -46
  74. package/dist/composables/useTourLayout.js +129 -0
  75. package/dist/config.js +11 -11
  76. package/dist/index.js +183 -152
  77. package/dist/internal/MultiSplitPane.vue.js +305 -0
  78. package/dist/internal/MultiSplitPane2.vue.js +4 -0
  79. package/dist/style.css +1 -1
  80. package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +99 -6
  81. package/dist/types/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.d.ts +19 -0
  82. package/dist/types/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.d.ts +31 -0
  83. package/dist/types/components/HysAnimatedNumber/animation/digital.d.ts +3 -0
  84. package/dist/types/components/HysAnimatedNumber/animation/morph.d.ts +2 -0
  85. package/dist/types/components/HysAnimatedNumber/animation/paint.d.ts +44 -0
  86. package/dist/types/components/HysAnimatedNumber/animation/particles.d.ts +5 -0
  87. package/dist/types/components/HysAnimatedNumber/animation/paths.d.ts +12 -0
  88. package/dist/types/components/HysAnimatedNumber/animation/physics.d.ts +2 -0
  89. package/dist/types/components/HysAnimatedNumber/animation/render.d.ts +2 -0
  90. package/dist/types/components/HysAnimatedNumber/animation/reveal.d.ts +2 -0
  91. package/dist/types/components/HysAnimatedNumber/animation/rolling.d.ts +2 -0
  92. package/dist/types/components/HysAnimatedNumber/animation/scenarios.d.ts +4 -0
  93. package/dist/types/components/HysAnimatedNumber/animation/spatial.d.ts +2 -0
  94. package/dist/types/components/HysAnimatedNumber/useNumberCountdown.d.ts +8 -0
  95. package/dist/types/components/HysAnimatedNumber/useNumberVisuals.d.ts +12 -0
  96. package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +12 -3
  97. package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +2 -2
  98. package/dist/types/components/HysButton/HysButton.vue.d.ts +82 -22
  99. package/dist/types/components/HysButtonGroup/HysButtonGroup.vue.d.ts +30 -0
  100. package/dist/types/components/HysCard/HysCard.vue.d.ts +1 -1
  101. package/dist/types/components/HysCascader/HysCascader.vue.d.ts +3 -3
  102. package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +3 -3
  103. package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +3 -3
  104. package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +2 -2
  105. package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +3 -3
  106. package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +6 -6
  107. package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +3 -3
  108. package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +2 -2
  109. package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +1 -1
  110. package/dist/types/components/HysInput/HysInput.vue.d.ts +13 -1
  111. package/dist/types/components/HysMention/HysMention.vue.d.ts +91 -40
  112. package/dist/types/components/HysModal/HysModal.vue.d.ts +1 -1
  113. package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
  114. package/dist/types/components/HysPagination/HysPagination.vue.d.ts +55 -4
  115. package/dist/types/components/HysPopover/HysPopover.vue.d.ts +1 -1
  116. package/dist/types/components/HysRating/HysRating.vue.d.ts +1 -1
  117. package/dist/types/components/HysSearch/HysSearch.vue.d.ts +46 -8
  118. package/dist/types/components/HysSelect/HysSelect.vue.d.ts +6 -1
  119. package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +2 -2
  120. package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +125 -14
  121. package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
  122. package/dist/types/components/HysTable/HysTable.vue.d.ts +1740 -3
  123. package/dist/types/components/HysTabs/HysTabs.vue.d.ts +1 -1
  124. package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +1 -1
  125. package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +13 -2
  126. package/dist/types/components/HysToast/HysToast.vue.d.ts +1 -1
  127. package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +1 -1
  128. package/dist/types/components/HysTour/HysTour.vue.d.ts +46 -9
  129. package/dist/types/components/HysTreeSelect/HysTreeSelect.vue.d.ts +3 -3
  130. package/dist/types/components/HysUpload/HysUpload.vue.d.ts +2 -2
  131. package/dist/types/composables/animatedNumber.d.ts +220 -0
  132. package/dist/types/composables/animatedNumberDigits.d.ts +32 -0
  133. package/dist/types/composables/animatedNumberFormat.d.ts +16 -0
  134. package/dist/types/composables/animatedNumberTiming.d.ts +21 -0
  135. package/dist/types/composables/buttonGroup.d.ts +9 -0
  136. package/dist/types/composables/drawer.d.ts +1 -1
  137. package/dist/types/composables/floatingPosition.d.ts +14 -0
  138. package/dist/types/composables/mention.d.ts +284 -0
  139. package/dist/types/composables/mentionDocument.d.ts +15 -0
  140. package/dist/types/composables/mentionEditor.d.ts +7 -0
  141. package/dist/types/composables/modal.d.ts +2 -0
  142. package/dist/types/composables/numberAnimation.d.ts +29 -0
  143. package/dist/types/composables/numberAnimationCatalog.d.ts +58 -0
  144. package/dist/types/composables/numberAnimationSequence.d.ts +13 -0
  145. package/dist/types/composables/selectOptions.d.ts +5 -0
  146. package/dist/types/composables/splitPaneSizes.d.ts +11 -0
  147. package/dist/types/composables/table.d.ts +116 -6
  148. package/dist/types/composables/textInput.d.ts +39 -4
  149. package/dist/types/composables/tour.d.ts +68 -0
  150. package/dist/types/composables/useFloating.d.ts +1 -1
  151. package/dist/types/composables/useHysAnimatedNumber.d.ts +37 -0
  152. package/dist/types/composables/useHysNumberAnimationGroup.d.ts +4 -0
  153. package/dist/types/composables/useMentionCaret.d.ts +6 -0
  154. package/dist/types/composables/useMentionList.d.ts +23 -0
  155. package/dist/types/composables/useMentionModel.d.ts +14 -0
  156. package/dist/types/composables/useMentionOptions.d.ts +26 -0
  157. package/dist/types/composables/useSplitPaneDrag.d.ts +14 -0
  158. package/dist/types/composables/useSplitPaneStorage.d.ts +4 -0
  159. package/dist/types/composables/useTable.d.ts +7 -3
  160. package/dist/types/composables/useTableSticky.d.ts +22 -0
  161. package/dist/types/composables/useTextareaSize.d.ts +5 -2
  162. package/dist/types/composables/useTourLayout.d.ts +33 -0
  163. package/dist/types/config.d.ts +1 -0
  164. package/dist/types/index.d.ts +46 -1
  165. package/dist/types/internal/MultiSplitPane.vue.d.ts +54 -0
  166. package/package.json +3 -2
  167. package/dist/components/HysSplitPane/HysSplitPane2.vue.js +0 -4
  168. package/dist/components/HysTour/HysTour2.vue.js +0 -4
@@ -0,0 +1,58 @@
1
+ import { computed as l, ref as H, watch as v, onMounted as N, onActivated as A, onDeactivated as E, onBeforeUnmount as y } from "vue";
2
+ import { listenVisibility as F, unlistenVisibility as V } from "../../composables/animatedNumberTiming.js";
3
+ const _ = { D: 864e5, H: 36e5, m: 6e4, s: 1e3, S: 1 }, M = /^(DD?|HH?|mm?|ss?|SSS)$/;
4
+ function C(b, g, d, T, w) {
5
+ const S = l(() => {
6
+ const t = b(), o = t instanceof Date ? t.getTime() : t;
7
+ return o !== void 0 && Number.isFinite(o) ? o : void 0;
8
+ }), c = l(
9
+ () => g().match(/\[[^\]]*\]|SSS|DD?|HH?|mm?|ss?|[\s\S]/g) ?? []
10
+ ), u = l(() => c.value.includes("SSS")), i = H(0);
11
+ let a = !1, m, r, f;
12
+ function n() {
13
+ clearTimeout(m);
14
+ const t = S.value;
15
+ if (!(!a || t === void 0 || d() && document.hidden)) {
16
+ if (i.value = Math.max(
17
+ 0,
18
+ Math.min(Number.MAX_SAFE_INTEGER, t - Date.now())
19
+ ), i.value !== r && (r = i.value, T(r)), i.value === 0) {
20
+ f !== t && (f = t, w());
21
+ return;
22
+ }
23
+ m = setTimeout(
24
+ n,
25
+ u.value ? 16 : i.value % 1e3 || 1e3
26
+ );
27
+ }
28
+ }
29
+ function h() {
30
+ a || (a = !0, F(n), n());
31
+ }
32
+ function p() {
33
+ a = !1, V(n), clearTimeout(m);
34
+ }
35
+ v(S, () => {
36
+ r = f = void 0, i.value = 0, n();
37
+ }), v(u, n), v(d, n), N(h), A(h), E(p), y(p);
38
+ const x = l(() => {
39
+ let t = u.value ? Math.floor(i.value) : Math.ceil(i.value / 1e3) * 1e3;
40
+ const o = /* @__PURE__ */ new Map();
41
+ for (const [e, s] of Object.entries(_))
42
+ c.value.some((D) => D[0] === e && M.test(D)) && (o.set(e, Math.floor(t / s)), t %= s);
43
+ return c.value.map((e) => {
44
+ const s = o.get(e[0]);
45
+ return M.test(e) && s !== void 0 ? {
46
+ text: String(s).padStart(e.length, "0"),
47
+ numeric: !0
48
+ } : {
49
+ text: e.startsWith("[") && e.endsWith("]") ? e.slice(1, -1) : e,
50
+ numeric: !1
51
+ };
52
+ });
53
+ });
54
+ return { remaining: i, parts: x, milliseconds: u };
55
+ }
56
+ export {
57
+ C as useNumberCountdown
58
+ };
@@ -0,0 +1,60 @@
1
+ import { computed as n } from "vue";
2
+ import { digitEffects as I } from "../../composables/animatedNumberDigits.js";
3
+ import { numberTrend as j } from "../../composables/animatedNumberFormat.js";
4
+ const k = (a) => typeof a == "string" ? [a] : a ?? [];
5
+ function C(a, s, P, S, T, v, h) {
6
+ const i = n(() => s.value.from), u = n(() => s.value.to), x = n(
7
+ () => a.changeThreshold !== void 0 && j(i.value, u.value, a.changeThreshold).significant
8
+ ), o = n(
9
+ () => x.value && h.value ? [...k(a.thresholdEffect ?? "highlight"), ...v.value] : v.value
10
+ ), c = n(() => s.value.status), d = n(
11
+ () => c.value === "playing" || c.value === "paused"
12
+ ), r = n(
13
+ () => S.value && h.value && !T.value && d.value && s.value.progress < 1
14
+ ), e = (t) => o.value.includes(t), E = n(
15
+ () => o.value.find((t) => I.includes(t))
16
+ ), l = n(() => e("slide") && r.value), g = (t) => a.axis === "horizontal" ? `translateX(${t}%)` : `translateY(${t}%)`, f = () => s.value.direction === "down" ? -1 : 1, m = n(() => {
17
+ if (!r.value || !l.value && !e("fade") || i.value === u.value)
18
+ return;
19
+ const t = s.value.progress;
20
+ return {
21
+ opacity: e("fade") ? 1 - t : 1,
22
+ transform: l.value ? g(-f() * t * 100) : void 0
23
+ };
24
+ }), Y = n(() => {
25
+ var M;
26
+ if (!r.value || !a.animationStyle && !o.value.some(
27
+ ($) => $ !== "count" && !I.includes($)
28
+ ))
29
+ return;
30
+ const t = s.value.progress, y = Math.sin(Math.PI * t), z = 1 - (e("scale") ? 0.18 * (1 - t) : 0) + (e("spring") ? 0.24 * Math.sin(4 * Math.PI * t) * (1 - t) : 0), N = e("bounce") ? -0.27 * Math.abs(Math.sin(3 * Math.PI * t)) * (1 - t) : 0, V = e("fade") ? m.value ? t : 0.25 + 0.75 * t : 1, X = e("flash") ? 1 - 0.35 * Math.abs(Math.sin(4 * Math.PI * t)) * (1 - t) : 1;
31
+ let b;
32
+ try {
33
+ b = (M = a.animationStyle) == null ? void 0 : M.call(a, P.value);
34
+ } catch {
35
+ }
36
+ return [
37
+ {
38
+ transform: `${l.value ? g(f() * (1 - t) * 100) : ""} translateY(${N}em) scale(${z})`.trim(),
39
+ opacity: V * X,
40
+ filter: e("blur") ? `blur(${0.12 * (1 - t)}em)` : void 0,
41
+ "--hys-number-highlight": e("highlight") ? y : 0,
42
+ "--hys-number-gradient": e("gradient") ? y : 0
43
+ },
44
+ b
45
+ ];
46
+ });
47
+ return {
48
+ from: i,
49
+ to: u,
50
+ status: c,
51
+ running: d,
52
+ digitEffect: E,
53
+ visualStyle: Y,
54
+ outgoingStyle: m,
55
+ sliding: l
56
+ };
57
+ }
58
+ export {
59
+ C as useNumberVisuals
60
+ };
@@ -1,7 +1,7 @@
1
1
  import o from "./HysButton2.vue.js";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-646a4efb"]]);
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-f242e243"]]);
5
5
  export {
6
- m as default
6
+ p as default
7
7
  };
@@ -1,32 +1,52 @@
1
- import { defineComponent as $, ref as z, computed as d, openBlock as i, createBlock as u, resolveDynamicComponent as r, mergeProps as P, unref as s, withCtx as D, createElementBlock as c, renderSlot as a, createVNode as H, createCommentVNode as y } from "vue";
2
- import { useHysControlState as L } from "../../composables/formContext.js";
3
- import { LoaderCircle as S } from "lucide-vue-next";
4
- import { useHysRootAttrs as w } from "../../config.js";
5
- const A = {
1
+ import { defineComponent as ce, useSlots as de, inject as fe, computed as l, toValue as Y, shallowRef as Z, ref as _, watch as ee, onMounted as ve, onActivated as ye, onBeforeUnmount as be, onDeactivated as he, openBlock as s, createBlock as m, resolveDynamicComponent as S, mergeProps as ge, unref as z, withCtx as me, createElementBlock as w, renderSlot as L, createCommentVNode as H, toDisplayString as ke, createVNode as pe, h as Be, Text as xe, Fragment as Te } from "vue";
2
+ import { LoaderCircle as Ce } from "lucide-vue-next";
3
+ import { useHysConfig as Ae, useHysRootAttrs as Se } from "../../config.js";
4
+ import { useHysControlState as ze } from "../../composables/formContext.js";
5
+ import { useChoiceModel as we } from "../../composables/choiceModel.js";
6
+ import { buttonGroupKey as Le, buttonVariant as Pe, buttonSize as De } from "../../composables/buttonGroup.js";
7
+ import { parseColor as $e, colorRgb as Ie } from "../../composables/color.js";
8
+ const Ee = {
6
9
  key: 0,
7
10
  class: "hys-ui-button-icon"
8
- }, N = {
11
+ }, He = {
9
12
  key: 1,
10
13
  class: "hys-ui-button-icon"
11
- }, R = {
12
- key: 2,
14
+ }, Me = { key: 2 }, Ne = {
15
+ key: 3,
13
16
  class: "hys-ui-button-icon"
14
- }, q = /* @__PURE__ */ $({
17
+ }, Ge = /* @__PURE__ */ ce({
15
18
  __name: "HysButton",
16
19
  props: {
17
- variant: { default: "primary" },
20
+ variant: {},
18
21
  size: {},
19
22
  disabled: { type: Boolean },
20
- loading: { type: Boolean },
23
+ loading: { type: [Boolean, Object] },
24
+ loadingIcon: {},
25
+ loadingText: {},
26
+ action: {},
27
+ beforeAction: {},
28
+ actionLoadingDelay: {},
29
+ toggle: { type: Boolean },
30
+ pressed: { type: Boolean, default: void 0 },
31
+ defaultPressed: { type: Boolean },
21
32
  plain: { type: Boolean },
22
33
  round: { type: Boolean },
23
34
  circle: { type: Boolean },
35
+ shape: {},
24
36
  block: { type: Boolean },
25
37
  dashed: { type: Boolean },
26
38
  color: {},
39
+ dark: { type: Boolean, default: void 0 },
40
+ danger: { type: Boolean },
41
+ ghost: { type: Boolean },
42
+ text: { type: Boolean },
43
+ link: { type: Boolean },
44
+ bg: { type: Boolean },
45
+ autoInsertSpace: { type: Boolean, default: void 0 },
46
+ tag: {},
27
47
  icon: {},
28
48
  iconPosition: { default: "left" },
29
- type: { default: "button" },
49
+ type: {},
30
50
  nativeType: {},
31
51
  href: {},
32
52
  target: {},
@@ -35,73 +55,220 @@ const A = {
35
55
  focusable: { type: Boolean, default: !0 },
36
56
  ariaLabel: {}
37
57
  },
38
- emits: ["click"],
39
- setup(e, { expose: f, emit: b }) {
40
- const n = e, { disabled: h, size: m } = L(n), v = b, k = w(), l = z(), o = d(() => h.value || n.loading), g = { danger: "#ed4556", success: "#16a46e", warning: "#d9860c", info: "#697b97" }, B = d(() => n.color || g[n.variant] || "var(--hys-ui-primary,var(--hys-ui-theme-primary))");
41
- function C(t) {
42
- if (o.value) {
43
- t.preventDefault(), t.stopImmediatePropagation();
58
+ emits: ["click", "update:pressed", "pressedChange", "actionSuccess", "actionError"],
59
+ setup(t, { expose: te, emit: ae }) {
60
+ const a = t, P = de(), b = ae, r = fe(Le, void 0), { disabled: M, size: N } = ze({
61
+ get disabled() {
62
+ return a.disabled || (r == null ? void 0 : r.disabled.value);
63
+ },
64
+ get size() {
65
+ return De(a.size) ?? (r == null ? void 0 : r.size.value);
66
+ }
67
+ }), h = l(() => a.variant ?? Pe(a.type) ?? (r == null ? void 0 : r.variant.value) ?? "primary"), k = l(() => a.link ? "link" : a.text ? "text" : h.value), oe = l(() => a.nativeType ?? (a.type === "submit" || a.type === "reset" ? a.type : "button")), V = Ae(), D = l(() => a.dark ?? Y(V.theme) === "dark"), ne = Se(), p = l(() => a.tag ?? (a.href ? "a" : "button")), B = l(() => p.value === "button"), v = l(() => p.value === "a" || !!a.href && typeof p.value != "string"), j = Z(), x = l(() => {
68
+ const e = j.value, n = e && "$el" in e ? e.$el : e;
69
+ return typeof HTMLElement < "u" && n instanceof HTMLElement ? n : void 0;
70
+ }), y = Z(), T = we({ get modelValue() {
71
+ return a.pressed;
72
+ } }, () => !!a.defaultPressed), R = l(() => a.toggle || a.pressed !== void 0), d = l(() => !!a.loading || !!y.value), c = l(() => M.value || d.value), C = l(() => {
73
+ const e = typeof a.loading == "object" ? a.loading.delay : a.loading ? 0 : a.actionLoadingDelay;
74
+ return typeof e == "number" && Number.isFinite(e) ? Math.max(0, Math.min(3e4, e)) : 0;
75
+ }), f = _(d.value && C.value === 0);
76
+ let $, A = !1;
77
+ function K() {
78
+ clearTimeout($), $ = void 0;
79
+ }
80
+ function I() {
81
+ K(), !d.value || C.value === 0 ? f.value = d.value : A && !f.value && ($ = setTimeout(() => {
82
+ f.value = !0;
83
+ }, C.value));
84
+ }
85
+ ee([d, C], I, { flush: "sync" }), ve(() => {
86
+ A = !0, I();
87
+ }), ye(() => {
88
+ A = !0, I();
89
+ });
90
+ function E() {
91
+ const e = y.value;
92
+ y.value = void 0, e == null || e.abort();
93
+ }
94
+ function O() {
95
+ A = !1, E(), K();
96
+ }
97
+ be(O), he(O);
98
+ const F = {
99
+ danger: "#ed4556",
100
+ success: "#16a46e",
101
+ warning: "#d9860c",
102
+ info: "#697b97"
103
+ }, U = {
104
+ slate: { light: "#475569", dark: "#a5b4c7" },
105
+ blue: { light: "#1d4ed8", dark: "#7cb2ff" },
106
+ indigo: { light: "#4338ca", dark: "#a5aaff" },
107
+ purple: { light: "#7e22ce", dark: "#c4a1ff" },
108
+ cyan: { light: "#0e7490", dark: "#67d7ee" },
109
+ teal: { light: "#0f766e", dark: "#5eead4" },
110
+ green: { light: "#15803d", dark: "#86efac" },
111
+ lime: { light: "#4d7c0f", dark: "#b5df59" },
112
+ amber: { light: "#b45309", dark: "#ffca68" },
113
+ orange: { light: "#c2410c", dark: "#ffab79" },
114
+ red: { light: "#b91c1c", dark: "#ff9090" },
115
+ pink: { light: "#be185d", dark: "#f6a1cf" }
116
+ }, g = l(() => {
117
+ if (!(a.color || a.danger || !Object.hasOwn(U, h.value)))
118
+ return U[h.value][D.value ? "dark" : "light"];
119
+ }), le = l(() => a.color || g.value || (a.danger ? F.danger : F[h.value]) || "var(--hys-ui-primary,var(--hys-ui-theme-primary))"), G = l(() => {
120
+ const e = $e(a.color || g.value);
121
+ if (!e) return;
122
+ const [n, o, i] = Ie(e).map((u) => u <= 0.04045 ? u / 12.92 : ((u + 0.055) / 1.055) ** 2.4);
123
+ return n * 0.2126 + o * 0.7152 + i * 0.0722 > 0.179 ? "#141414" : "#fff";
124
+ }), ie = l(() => (a.autoInsertSpace ?? Y(V.buttonAutoInsertSpace) ?? !1) && k.value !== "text" && k.value !== "link"), q = _(!1);
125
+ function J(e) {
126
+ let n = "";
127
+ for (const o of e)
128
+ if (o.type === xe && typeof o.children == "string") n += o.children;
129
+ else if (o.type === Te && Array.isArray(o.children)) {
130
+ const i = J(o.children);
131
+ if (i === void 0) return;
132
+ n += i;
133
+ } else return;
134
+ return n;
135
+ }
136
+ const ue = ({ hidden: e }) => {
137
+ var u, X;
138
+ const n = ((u = P.default) == null ? void 0 : u.call(P)) ?? [], o = ie.value ? (X = J(n)) == null ? void 0 : X.trim() : void 0, i = !!o && new RegExp("^\\p{Unified_Ideograph}{2}$", "u").test(o);
139
+ return q.value = i, e ? null : i ? Be("span", { class: "hys-ui-button-spaced" }, o) : n;
140
+ };
141
+ function Q() {
142
+ if (R.value)
143
+ return T.commit(!T.current.value, (e) => b("update:pressed", e), (e) => b("pressedChange", e));
144
+ }
145
+ async function re(e, n) {
146
+ const o = new AbortController(), i = { signal: o.signal, event: n, pressed: T.current.value };
147
+ y.value = o;
148
+ try {
149
+ if (a.beforeAction && await a.beforeAction(i) === !1 || o.signal.aborted) return;
150
+ const u = await e(i);
151
+ if (o.signal.aborted) return;
152
+ await Q(), o.signal.aborted || b("actionSuccess", u, i);
153
+ } catch (u) {
154
+ o.signal.aborted || b("actionError", u, i);
155
+ } finally {
156
+ y.value === o && (y.value = void 0);
157
+ }
158
+ }
159
+ ee(M, (e) => {
160
+ e && E();
161
+ }, { flush: "sync" });
162
+ function se(e) {
163
+ if (c.value) {
164
+ e.preventDefault(), e.stopImmediatePropagation();
44
165
  return;
45
166
  }
46
- v("click", t);
167
+ b("click", e), !e.defaultPrevented && (a.action ? (e.preventDefault(), re(a.action, e)) : Q());
47
168
  }
48
- return f({ element: l, focus: () => {
49
- var t;
50
- return (t = l.value) == null ? void 0 : t.focus();
51
- }, blur: () => {
52
- var t;
53
- return (t = l.value) == null ? void 0 : t.blur();
54
- } }), (t, T) => (i(), u(r(e.href ? "a" : "button"), P({
55
- ref_key: "element",
56
- ref: l
57
- }, s(k), {
58
- class: ["hys-ui-btn", ["hys-ui-btn-" + s(m), "hys-ui-button-" + e.variant, { "hys-ui-button-plain": e.plain, "hys-ui-button-round": e.round, "hys-ui-button-circle": e.circle, "hys-ui-button-block": e.block, "hys-ui-button-dashed": e.dashed, "hys-ui-button-locked": o.value }]],
59
- style: { "--hys-ui-button-color": B.value },
60
- type: e.href ? void 0 : e.nativeType || e.type,
61
- href: o.value ? void 0 : e.href,
62
- role: e.href ? "link" : void 0,
63
- target: e.href ? e.target : void 0,
64
- rel: e.href ? e.rel || (e.target === "_blank" ? "noopener noreferrer" : void 0) : void 0,
65
- disabled: e.href ? void 0 : o.value,
66
- "aria-disabled": o.value || void 0,
67
- "aria-busy": e.loading || void 0,
68
- "aria-label": e.ariaLabel,
69
- tabindex: o.value || !e.focusable ? -1 : void 0,
70
- autofocus: e.autofocus,
71
- onClick: C
169
+ function W(e, n) {
170
+ const o = e.currentTarget;
171
+ if (!(o instanceof HTMLElement) || e.target !== o || e.isComposing || e.defaultPrevented || o.localName === "button" || o.localName === "a" && o.hasAttribute("href")) return;
172
+ const i = e.key === " " && !v.value;
173
+ !i && e.key !== "Enter" || (e.preventDefault(), !c.value && !e.repeat && (i ? n : !n) && o.click());
174
+ }
175
+ return te({
176
+ element: x,
177
+ ref: x,
178
+ busy: d,
179
+ disabled: c,
180
+ size: N,
181
+ type: h,
182
+ shouldAddSpace: q,
183
+ cancelAction: E,
184
+ focus: () => {
185
+ var e;
186
+ return (e = x.value) == null ? void 0 : e.focus();
187
+ },
188
+ blur: () => {
189
+ var e;
190
+ return (e = x.value) == null ? void 0 : e.blur();
191
+ }
192
+ }), (e, n) => (s(), m(S(p.value), ge({
193
+ ref_key: "root",
194
+ ref: j
195
+ }, z(ne), {
196
+ class: ["hys-ui-btn", ["hys-ui-btn-" + z(N), "hys-ui-button-" + k.value, {
197
+ "hys-ui-button-plain": t.plain,
198
+ "hys-ui-button-round": t.round || t.shape === "round",
199
+ "hys-ui-button-circle": t.circle || t.shape === "circle",
200
+ "hys-ui-button-block": t.block,
201
+ "hys-ui-button-dashed": t.dashed,
202
+ "hys-ui-button-locked": c.value,
203
+ "hys-ui-button-danger-tone": t.danger,
204
+ "hys-ui-button-outline-ghost": t.ghost,
205
+ "hys-ui-button-text-bg": t.bg && k.value === "text",
206
+ "hys-ui-button-palette": g.value,
207
+ "hys-ui-button-palette-dark": g.value && D.value,
208
+ "hys-ui-button-custom-color": t.color,
209
+ "hys-ui-button-custom-dark": t.color && D.value
210
+ }]],
211
+ style: {
212
+ "--hys-ui-button-color": le.value,
213
+ "--hys-ui-button-foreground": G.value,
214
+ "--hys-ui-button-palette-shade": g.value && G.value === "#141414" ? "#fff" : void 0
215
+ },
216
+ type: B.value ? oe.value : void 0,
217
+ href: v.value && !c.value ? t.href : void 0,
218
+ role: v.value ? "link" : B.value ? void 0 : "button",
219
+ target: v.value && t.href ? t.target : void 0,
220
+ rel: v.value && t.href ? t.rel || (t.target === "_blank" ? "noopener noreferrer" : void 0) : void 0,
221
+ disabled: B.value ? c.value : void 0,
222
+ "aria-disabled": c.value || void 0,
223
+ "aria-busy": d.value || void 0,
224
+ "aria-pressed": R.value ? z(T).current.value : void 0,
225
+ "aria-label": t.ariaLabel,
226
+ tabindex: c.value || !t.focusable ? -1 : !B.value && (!v.value || !t.href) ? 0 : void 0,
227
+ autofocus: t.autofocus,
228
+ onClick: se,
229
+ onKeydown: n[0] || (n[0] = (o) => W(o, !1)),
230
+ onKeyup: n[1] || (n[1] = (o) => W(o, !0))
72
231
  }), {
73
- default: D(() => [
74
- e.loading ? (i(), c("span", A, [
75
- a(t.$slots, "loading", {}, () => [
76
- H(s(S), {
232
+ default: me(() => [
233
+ f.value ? (s(), w("span", Ee, [
234
+ L(e.$slots, "loading", {}, () => [
235
+ t.loadingIcon ? (s(), m(S(t.loadingIcon), {
236
+ key: 0,
237
+ size: 16,
238
+ "aria-hidden": "true"
239
+ })) : (s(), m(z(Ce), {
240
+ key: 1,
77
241
  class: "hys-ui-button-spinner",
78
242
  size: 16,
79
243
  "aria-hidden": "true"
80
- })
244
+ }))
81
245
  ], !0)
82
- ])) : (e.icon || t.$slots.icon) && e.iconPosition === "left" ? (i(), c("span", N, [
83
- a(t.$slots, "icon", {}, () => [
84
- (i(), u(r(e.icon), {
246
+ ])) : (t.icon || e.$slots.icon) && t.iconPosition === "left" ? (s(), w("span", He, [
247
+ L(e.$slots, "icon", {}, () => [
248
+ (s(), m(S(t.icon), {
85
249
  size: 16,
86
250
  "aria-hidden": "true"
87
251
  }))
88
252
  ], !0)
89
- ])) : y("", !0),
90
- a(t.$slots, "default", {}, void 0, !0),
91
- !e.loading && (e.icon || t.$slots.icon) && e.iconPosition === "right" ? (i(), c("span", R, [
92
- a(t.$slots, "icon", {}, () => [
93
- (i(), u(r(e.icon), {
253
+ ])) : H("", !0),
254
+ f.value && t.loadingText ? (s(), w("span", Me, ke(t.loadingText), 1)) : H("", !0),
255
+ pe(ue, {
256
+ hidden: f.value && !!t.loadingText
257
+ }, null, 8, ["hidden"]),
258
+ !f.value && (t.icon || e.$slots.icon) && t.iconPosition === "right" ? (s(), w("span", Ne, [
259
+ L(e.$slots, "icon", {}, () => [
260
+ (s(), m(S(t.icon), {
94
261
  size: 16,
95
262
  "aria-hidden": "true"
96
263
  }))
97
264
  ], !0)
98
- ])) : y("", !0),
99
- a(t.$slots, "suffix", {}, void 0, !0)
265
+ ])) : H("", !0),
266
+ L(e.$slots, "suffix", {}, void 0, !0)
100
267
  ]),
101
268
  _: 3
102
- }, 16, ["class", "style", "type", "href", "role", "target", "rel", "disabled", "aria-disabled", "aria-busy", "aria-label", "tabindex", "autofocus"]));
269
+ }, 16, ["class", "style", "type", "href", "role", "target", "rel", "disabled", "aria-disabled", "aria-busy", "aria-pressed", "aria-label", "tabindex", "autofocus"]));
103
270
  }
104
271
  });
105
272
  export {
106
- q as default
273
+ Ge as default
107
274
  };
@@ -0,0 +1,7 @@
1
+ import o from "./HysButtonGroup2.vue.js";
2
+ /* empty css */
3
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const s = /* @__PURE__ */ t(o, [["__scopeId", "data-v-19e19d54"]]);
5
+ export {
6
+ s as default
7
+ };
@@ -0,0 +1,51 @@
1
+ import { defineComponent as d, inject as b, provide as p, computed as a, openBlock as c, createElementBlock as y, mergeProps as m, unref as r, renderSlot as g } from "vue";
2
+ import { useHysRootAttrs as f } from "../../config.js";
3
+ import { buttonGroupKey as u, buttonSize as v, buttonVariant as h } from "../../composables/buttonGroup.js";
4
+ import { useHysControlState as B } from "../../composables/formContext.js";
5
+ const k = ["aria-label", "aria-disabled"], S = /* @__PURE__ */ d({
6
+ __name: "HysButtonGroup",
7
+ props: {
8
+ variant: {},
9
+ size: {},
10
+ type: {},
11
+ direction: { default: "horizontal" },
12
+ joined: { type: Boolean, default: !0 },
13
+ gap: { default: 8 },
14
+ wrap: { type: Boolean },
15
+ block: { type: Boolean },
16
+ disabled: { type: Boolean },
17
+ ariaLabel: {}
18
+ },
19
+ setup(o) {
20
+ const t = o, n = f(), e = b(u, void 0), { disabled: i } = B({
21
+ get disabled() {
22
+ return t.disabled || (e == null ? void 0 : e.disabled.value);
23
+ }
24
+ });
25
+ p(u, {
26
+ variant: a(() => t.variant ?? h(t.type) ?? (e == null ? void 0 : e.variant.value)),
27
+ size: a(() => v(t.size) ?? (e == null ? void 0 : e.size.value)),
28
+ disabled: i
29
+ });
30
+ const l = a(() => typeof t.gap == "number" ? (Number.isFinite(t.gap) ? Math.max(0, t.gap) : 8) + "px" : t.gap);
31
+ return (s, z) => (c(), y("div", m(r(n), {
32
+ role: "group",
33
+ "aria-label": o.ariaLabel,
34
+ "aria-disabled": r(i) || void 0,
35
+ class: ["hys-ui-button-group", [
36
+ "hys-ui-button-group-" + o.direction,
37
+ {
38
+ "hys-ui-button-group-joined": o.joined,
39
+ "hys-ui-button-group-wrap": o.wrap && !o.joined,
40
+ "hys-ui-button-group-block": o.block
41
+ }
42
+ ]],
43
+ style: { "--hys-ui-button-group-gap": l.value }
44
+ }), [
45
+ g(s.$slots, "default", {}, void 0, !0)
46
+ ], 16, k));
47
+ }
48
+ });
49
+ export {
50
+ S as default
51
+ };
@@ -1,7 +1,7 @@
1
1
  import o from "./HysFormItem2.vue.js";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-ed19e01e"]]);
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-7ce25263"]]);
5
5
  export {
6
6
  p as default
7
7
  };