wimui 0.62.2 → 0.63.1

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 (73) hide show
  1. package/dist/components/_internal/OverlayBase.cjs +1 -1
  2. package/dist/components/_internal/OverlayBase.js +31 -30
  3. package/dist/components/_internal/composeEventHandlers.cjs +2 -0
  4. package/dist/components/_internal/composeEventHandlers.d.ts +25 -0
  5. package/dist/components/_internal/composeEventHandlers.js +8 -0
  6. package/dist/components/_internal/observeMove.cjs +2 -0
  7. package/dist/components/_internal/observeMove.d.ts +16 -0
  8. package/dist/components/_internal/observeMove.js +44 -0
  9. package/dist/components/ai/ChatUI/ChatUI.cjs +1 -1
  10. package/dist/components/ai/ChatUI/ChatUI.js +83 -82
  11. package/dist/components/data-display/Accordion/Accordion.cjs +1 -1
  12. package/dist/components/data-display/Accordion/Accordion.js +79 -78
  13. package/dist/components/data-display/PullToRefresh/PullToRefresh.cjs +1 -1
  14. package/dist/components/data-display/PullToRefresh/PullToRefresh.js +73 -72
  15. package/dist/components/data-display/SortableList/SortableList.cjs +1 -1
  16. package/dist/components/data-display/SortableList/SortableList.js +54 -53
  17. package/dist/components/data-display/SwipeAction/SwipeAction.cjs +1 -1
  18. package/dist/components/data-display/SwipeAction/SwipeAction.js +77 -76
  19. package/dist/components/feedback/Tour/Tour.cjs +1 -1
  20. package/dist/components/feedback/Tour/Tour.js +91 -88
  21. package/dist/components/form/Button/Button.cjs +1 -1
  22. package/dist/components/form/Button/Button.d.ts +2 -2
  23. package/dist/components/form/Button/Button.js +14 -12
  24. package/dist/components/form/Cascader/Cascader.cjs +1 -1
  25. package/dist/components/form/Cascader/Cascader.js +99 -98
  26. package/dist/components/form/DatePicker/DatePicker.cjs +1 -1
  27. package/dist/components/form/DatePicker/DatePicker.js +53 -52
  28. package/dist/components/form/RangeSlider/RangeSlider.cjs +1 -1
  29. package/dist/components/form/RangeSlider/RangeSlider.js +109 -108
  30. package/dist/components/form/Rating/Rating.cjs +1 -1
  31. package/dist/components/form/Rating/Rating.js +75 -74
  32. package/dist/components/form/Slider/Slider.cjs +1 -1
  33. package/dist/components/form/Slider/Slider.js +58 -57
  34. package/dist/components/form/SmartSearchInput/SmartSearchInput.cjs +1 -1
  35. package/dist/components/form/SmartSearchInput/SmartSearchInput.js +65 -64
  36. package/dist/components/form/Textarea/Textarea.cjs +1 -1
  37. package/dist/components/form/Textarea/Textarea.js +4 -4
  38. package/dist/components/form/TimePicker/TimePicker.cjs +1 -1
  39. package/dist/components/form/TimePicker/TimePicker.js +31 -30
  40. package/dist/components/layout/Dashboard/Dashboard.cjs +1 -1
  41. package/dist/components/layout/Dashboard/Dashboard.js +3 -2
  42. package/dist/components/layout/InteractiveArea/InteractiveArea.cjs +1 -1
  43. package/dist/components/layout/InteractiveArea/InteractiveArea.js +1 -1
  44. package/dist/components/layout/Navbar/Navbar.cjs +1 -1
  45. package/dist/components/layout/Navbar/Navbar.js +68 -66
  46. package/dist/components/layout/Splitter/Splitter.cjs +1 -1
  47. package/dist/components/layout/Splitter/Splitter.js +47 -46
  48. package/dist/components/layout/Transition/Transition.cjs +1 -1
  49. package/dist/components/layout/Transition/Transition.js +25 -24
  50. package/dist/components/media/Audio/Audio.cjs +1 -1
  51. package/dist/components/media/Audio/Audio.js +39 -38
  52. package/dist/components/media/Image/Image.cjs +2 -2
  53. package/dist/components/media/Image/Image.js +96 -95
  54. package/dist/components/media/ImageCompare/ImageCompare.cjs +1 -1
  55. package/dist/components/media/ImageCompare/ImageCompare.js +75 -73
  56. package/dist/components/media/Video/Video.cjs +1 -1
  57. package/dist/components/media/Video/Video.js +114 -113
  58. package/dist/components/navigation/Affix/Affix.cjs +1 -1
  59. package/dist/components/navigation/Affix/Affix.js +39 -36
  60. package/dist/components/navigation/Menubar/Menubar.cjs +1 -1
  61. package/dist/components/navigation/Menubar/Menubar.js +67 -61
  62. package/dist/components/navigation/SpeedDial/SpeedDial.cjs +1 -1
  63. package/dist/components/navigation/SpeedDial/SpeedDial.js +47 -46
  64. package/dist/components/navigation/Tabs/Tabs.cjs +1 -1
  65. package/dist/components/navigation/Tabs/Tabs.js +87 -86
  66. package/dist/components/overlay/Dropdown/Dropdown.cjs +1 -1
  67. package/dist/components/overlay/Dropdown/Dropdown.js +42 -36
  68. package/dist/components/overlay/Popover/Popover.cjs +1 -1
  69. package/dist/components/overlay/Popover/Popover.js +1 -1
  70. package/dist/llms-full.txt +3 -3
  71. package/dist/llms.txt +1 -1
  72. package/dist/wimui.umd.js +5 -5
  73. package/package.json +1 -1
@@ -1,112 +1,113 @@
1
1
  "use client";
2
2
  import { Root as e } from "../../../node_modules/@radix-ui/react-slot/dist/index.js";
3
- import { Icon as t } from "../../media/Icon/Icon.js";
4
- import n from "./swipe-action.module.js";
5
- import { useSwipeableList as r } from "./SwipeableList.js";
6
- import i, { useEffect as a, useId as o, useImperativeHandle as s, useRef as c, useState as l } from "react";
7
- import u from "classnames";
8
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
3
+ import { composeEventHandlers as t } from "../../_internal/composeEventHandlers.js";
4
+ import { Icon as n } from "../../media/Icon/Icon.js";
5
+ import r from "./swipe-action.module.js";
6
+ import { useSwipeableList as i } from "./SwipeableList.js";
7
+ import a, { useEffect as o, useId as s, useImperativeHandle as c, useRef as l, useState as u } from "react";
8
+ import d from "classnames";
9
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
9
10
  //#region src/components/data-display/SwipeAction/SwipeAction.tsx
10
- var p = i.forwardRef(({ as: i = "div", leftActions: p = [], rightActions: m = [], children: h, asChild: g = !1, id: _, closeOnAction: v = !0, fullSwipe: y, className: b, ...x }, S) => {
11
- let C = o(), w = _ || C, T = r(), [E, D] = l(0), [O, k] = l(!1), A = c(0), j = c(0), M = c(null);
12
- s(S, () => ({ close: () => {
13
- D(0), T?.reportClose(w);
11
+ var m = a.forwardRef(({ as: a = "div", leftActions: m = [], rightActions: h = [], children: g, asChild: _ = !1, id: v, closeOnAction: y = !0, fullSwipe: b, className: x, ...S }, C) => {
12
+ let w = s(), T = v || w, E = i(), [D, O] = u(0), [k, A] = u(!1), j = l(0), M = l(0), N = l(null);
13
+ c(C, () => ({ close: () => {
14
+ O(0), E?.reportClose(T);
14
15
  } }));
15
- let N = c(!1);
16
- a(() => {
17
- if (O) {
18
- N.current = !0;
16
+ let P = l(!1);
17
+ o(() => {
18
+ if (k) {
19
+ P.current = !0;
19
20
  return;
20
21
  }
21
- if (N.current) {
22
+ if (P.current) {
22
23
  let e = setTimeout(() => {
23
- N.current = !1;
24
+ P.current = !1;
24
25
  }, 100);
25
26
  return () => clearTimeout(e);
26
27
  }
27
- T?.openedId && T.openedId !== w && D(0);
28
+ E?.openedId && E.openedId !== T && O(0);
28
29
  }, [
29
- T?.openedId,
30
- w,
31
- O
30
+ E?.openedId,
31
+ T,
32
+ k
32
33
  ]);
33
- let P = p.length * 80, F = m.length * 80, I = P > 0 && (y === "left" || y === "both"), L = F > 0 && (y === "right" || y === "both"), R = M.current?.offsetWidth ?? 0, z = (e) => Math.max(e + 40, R / 2), B = O && I && E >= z(P) ? "left" : O && L && -E >= z(F) ? "right" : null, V = (e) => {
34
- A.current = "touches" in e ? e.touches[0].clientX : e.clientX, j.current = E, k(!0);
35
- }, H = (e) => {
36
- if (!O) return;
37
- let t = ("touches" in e ? e.touches[0].clientX : e.clientX) - A.current, n = j.current + t;
38
- Math.abs(t) > 5 && T?.openedId !== w && T?.reportOpen(w), n > P && !I && (n = P + (n - P) * .3), n < -F && !L && (n = -F + (n + F) * .3), D(n);
39
- }, U = (e = !0) => {
40
- if (O) {
41
- if (k(!1), B) {
42
- let t = B === "left" ? p[0] : m[m.length - 1];
34
+ let F = m.length * 80, I = h.length * 80, L = F > 0 && (b === "left" || b === "both"), R = I > 0 && (b === "right" || b === "both"), z = N.current?.offsetWidth ?? 0, B = (e) => Math.max(e + 40, z / 2), V = k && L && D >= B(F) ? "left" : k && R && -D >= B(I) ? "right" : null, H = (e) => {
35
+ j.current = "touches" in e ? e.touches[0].clientX : e.clientX, M.current = D, A(!0);
36
+ }, U = (e) => {
37
+ if (!k) return;
38
+ let t = ("touches" in e ? e.touches[0].clientX : e.clientX) - j.current, n = M.current + t;
39
+ Math.abs(t) > 5 && E?.openedId !== T && E?.reportOpen(T), n > F && !L && (n = F + (n - F) * .3), n < -I && !R && (n = -I + (n + I) * .3), O(n);
40
+ }, W = (e = !0) => {
41
+ if (k) {
42
+ if (A(!1), V) {
43
+ let t = V === "left" ? m[0] : h[h.length - 1];
43
44
  if (e) {
44
- Y(t), v || (D(B === "left" ? P : -F), T?.reportOpen(w));
45
+ X(t), y || (O(V === "left" ? F : -I), E?.reportOpen(T));
45
46
  return;
46
47
  }
47
48
  }
48
- E > P / 2 ? (D(P), T?.reportOpen(w)) : E < -F / 2 ? (D(-F), T?.reportOpen(w)) : (D(0), T?.reportClose(w));
49
+ D > F / 2 ? (O(F), E?.reportOpen(T)) : D < -I / 2 ? (O(-I), E?.reportOpen(T)) : (O(0), E?.reportClose(T));
49
50
  }
50
- }, W = g ? e : "div", G = c(null), K = P > 0 || F > 0, q = (e) => {
51
- let t = e === "left" ? P : -F;
52
- E !== t && D(t), T?.reportOpen(w);
53
- }, J = (e) => {
51
+ }, G = _ ? e : "div", K = l(null), q = F > 0 || I > 0, J = (e) => {
52
+ let t = e === "left" ? F : -I;
53
+ D !== t && O(t), E?.reportOpen(T);
54
+ }, Y = (e) => {
54
55
  let t = e.relatedTarget;
55
- t && M.current?.contains(t) || E !== 0 && !O && (D(0), T?.reportClose(w));
56
- }, Y = (e, t) => {
57
- e.onClick(), v && (D(0), T?.reportClose(w), t && document.activeElement === t && G.current?.focus());
58
- }, X = (e, r, i) => {
59
- let a = e === "left" ? I : L, o = e === "left" ? Math.max(0, E) : Math.max(0, -E), s = e === "left" ? 0 : r.length - 1;
60
- return /* @__PURE__ */ d("div", {
61
- className: u(n.actions, n[e], a && o > i && n.stretched, B === e && n.armed),
56
+ t && N.current?.contains(t) || D !== 0 && !k && (O(0), E?.reportClose(T));
57
+ }, X = (e, t) => {
58
+ e.onClick(), y && (O(0), E?.reportClose(T), t && document.activeElement === t && K.current?.focus());
59
+ }, Z = (e, t, i) => {
60
+ let a = e === "left" ? L : R, o = e === "left" ? Math.max(0, D) : Math.max(0, -D), s = e === "left" ? 0 : t.length - 1;
61
+ return /* @__PURE__ */ f("div", {
62
+ className: d(r.actions, r[e], a && o > i && r.stretched, V === e && r.armed),
62
63
  style: {
63
64
  width: a ? Math.max(i, o) : i,
64
65
  "--_action-w": "80px"
65
66
  },
66
- children: r.map((r, i) => /* @__PURE__ */ f("button", {
67
- className: u(n.action, r.intent && n[r.intent], a && i === s && n.outer),
68
- style: { backgroundColor: r.color },
69
- onFocus: () => q(e),
70
- onClick: (e) => Y(r, e.currentTarget),
67
+ children: t.map((t, i) => /* @__PURE__ */ p("button", {
68
+ className: d(r.action, t.intent && r[t.intent], a && i === s && r.outer),
69
+ style: { backgroundColor: t.color },
70
+ onFocus: () => J(e),
71
+ onClick: (e) => X(t, e.currentTarget),
71
72
  type: "button",
72
- children: [/* @__PURE__ */ d(t, {
73
- name: r.icon,
73
+ children: [/* @__PURE__ */ f(n, {
74
+ name: t.icon,
74
75
  size: "md"
75
- }), /* @__PURE__ */ d("span", {
76
- className: n.label,
77
- children: r.label
76
+ }), /* @__PURE__ */ f("span", {
77
+ className: r.label,
78
+ children: t.label
78
79
  })]
79
80
  }, i))
80
81
  });
81
82
  };
82
- return /* @__PURE__ */ f(i, {
83
- ref: M,
84
- className: u("wim-swipe-action", n.container, b),
85
- onMouseLeave: () => U(!1),
86
- onBlur: J,
87
- ...x,
83
+ return /* @__PURE__ */ p(a, {
84
+ ref: N,
85
+ className: d("wim-swipe-action", r.container, x),
86
+ ...S,
87
+ onMouseLeave: t(S.onMouseLeave, () => W(!1)),
88
+ onBlur: t(S.onBlur, Y),
88
89
  children: [
89
- /* @__PURE__ */ d(W, {
90
- ref: G,
91
- className: n.content,
92
- tabIndex: K ? -1 : void 0,
90
+ /* @__PURE__ */ f(G, {
91
+ ref: K,
92
+ className: r.content,
93
+ tabIndex: q ? -1 : void 0,
93
94
  style: {
94
- transform: `translateX(${E}px)`,
95
- transition: O ? "none" : "transform 0.4s cubic-bezier(0.16, 1, 0.3, 1)"
95
+ transform: `translateX(${D}px)`,
96
+ transition: k ? "none" : "transform 0.4s cubic-bezier(0.16, 1, 0.3, 1)"
96
97
  },
97
- onTouchStart: V,
98
- onTouchMove: H,
99
- onTouchEnd: () => U(),
100
- onMouseDown: V,
101
- onMouseMove: H,
102
- onMouseUp: () => U(),
103
- children: h
98
+ onTouchStart: H,
99
+ onTouchMove: U,
100
+ onTouchEnd: () => W(),
101
+ onMouseDown: H,
102
+ onMouseMove: U,
103
+ onMouseUp: () => W(),
104
+ children: g
104
105
  }),
105
- P > 0 && X("left", p, P),
106
- F > 0 && X("right", m, F)
106
+ F > 0 && Z("left", m, F),
107
+ I > 0 && Z("right", h, I)
107
108
  ]
108
109
  });
109
110
  });
110
- p.displayName = "SwipeAction";
111
+ m.displayName = "SwipeAction";
111
112
  //#endregion
112
- export { p as SwipeAction };
113
+ export { m as SwipeAction };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../overlay/Portal/Portal.cjs"),i=require("../../overlay/FocusTrap/FocusTrap.cjs"),a=require("../../form/Button/Button.cjs"),o=require("./tour.module.cjs");let s=require("react");s=e.__toESM(s,1);let c=require("classnames");c=e.__toESM(c,1);let l=require("react/jsx-runtime");var u=16;function d(e){let t=getComputedStyle(e);return`${t.fontWeight} ${t.fontSize} ${t.fontFamily}`}async function f(e){let t=document.fonts;if(t&&typeof t.load==`function`){try{await t.load(d(e))}catch{}for(;t.status===`loading`;)await new Promise(e=>{t.addEventListener(`loadingdone`,()=>e(),{once:!0})})}}function p(e){let t=document.fonts;return!t||typeof t.load!=`function`?!1:t.status===`loading`||typeof t.check==`function`&&!t.check(d(e))}function m(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.width)===Math.round(t.width)&&Math.round(e.height)===Math.round(t.height)}function h(e){return e.top>=u&&e.bottom<=window.innerHeight-u&&e.left>=u&&e.right<=window.innerWidth-u}var g=({steps:e,open:u,onClose:d,onFinish:g})=>{let{t:_}=t.useWimTranslation(n.commonNs),[v,y]=(0,s.useState)(0),[b,x]=(0,s.useState)(null),S=e[v],C=S?.target;(0,s.useLayoutEffect)(()=>{if(!u||!C){x(null);return}let e=!1,t=t=>{e||x(e=>t?e&&m(e,t)?e:t:null)},n=()=>{let e=document.querySelector(C);if(!e){t(null);return}h(e.getBoundingClientRect())||e.scrollIntoView({block:`center`,inline:`nearest`}),t(e.getBoundingClientRect())},r=()=>{let e=document.querySelector(C);t(e?e.getBoundingClientRect():null)},i=()=>{window.addEventListener(`resize`,r),window.addEventListener(`scroll`,r,!0)},a=async()=>{let t=document.querySelector(C);t&&await f(t),!e&&(n(),i())},o=document.querySelector(C);return o&&p(o)?a():(n(),i()),()=>{e=!0,window.removeEventListener(`resize`,r),window.removeEventListener(`scroll`,r,!0)}},[u,v,C]);let w=(0,s.useId)(),T=(0,s.useRef)(null),E=(0,s.useRef)(null),D=u&&!!S&&!!b;if((0,s.useEffect)(()=>{if(!D)return;let e=T.current;e&&!e.contains(document.activeElement)&&E.current?.focus()},[D,v]),(0,s.useEffect)(()=>{if(!u)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),d())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[u,d]),!u||!S)return null;let O=()=>{v<e.length-1?y(v+1):(g?g():d(),y(0))},k=()=>{v>0&&y(v-1)},A={},j=S.placement||`bottom`;if(b){let e=window.innerWidth,t=Math.min(300,e-32),n=j;if(e<640&&(n===`left`||n===`right`)&&(n=`bottom`),j=n,n===`top`||n===`bottom`){let r=b.left+b.width/2,i=t/2+16,a=e-t/2-16;r=i>a?e/2:Math.max(i,Math.min(a,r)),A.left=r,n===`top`?(A.top=b.top-12,A.transform=`translate(-50%, -100%)`):(A.top=b.bottom+12,A.transform=`translateX(-50%)`)}else n===`left`?(A.left=b.left-12,A.top=b.top+b.height/2,A.transform=`translate(-100%, -50%)`):n===`right`&&(A.left=b.right+12,A.top=b.top+b.height/2,A.transform=`translateY(-50%)`)}return(0,l.jsx)(r.Portal,{children:(0,l.jsx)(i.FocusTrap,{initialFocus:!1,children:(0,l.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":S.title,"aria-describedby":b?w:void 0,children:[b&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`div`,{className:o.default.highlight,style:{top:b.top-4,left:b.left-4,width:b.width+8,height:b.height+8}}),(0,l.jsx)(`div`,{ref:T,className:(0,c.default)(`wim-tour`,o.default.bubble),"data-placement":j,style:A,children:(0,l.jsxs)(`div`,{className:o.default.inner,children:[(0,l.jsx)(`h3`,{className:o.default.title,children:S.title}),(0,l.jsx)(`p`,{id:w,className:o.default.description,children:S.description}),(0,l.jsxs)(`div`,{className:o.default.footer,children:[(0,l.jsxs)(`span`,{className:o.default.progress,children:[v+1,` / `,e.length]}),(0,l.jsxs)(`div`,{className:o.default.buttons,children:[v>0&&(0,l.jsx)(a.Button,{size:`sm`,variant:`outline`,onClick:k,children:_(`action.back`)}),(0,l.jsx)(a.Button,{ref:E,size:`sm`,variant:`solid`,onClick:O,children:v===e.length-1?_(`action.finish`):_(`action.next`)})]})]})]})})]}),(0,l.jsx)(`div`,{className:o.default.mask,onClick:d,role:`button`,tabIndex:0,"aria-label":_(`a11y.close_tour`),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&d()}})]})})})};exports.Tour=g;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../i18n/useWimTranslation.cjs"),n=require("../../../i18n/generated/common.cjs"),r=require("../../overlay/Portal/Portal.cjs"),i=require("../../overlay/FocusTrap/FocusTrap.cjs"),a=require("../../form/Button/Button.cjs"),o=require("./tour.module.cjs"),s=require("../../_internal/observeMove.cjs");let c=require("react");c=e.__toESM(c,1);let l=require("classnames");l=e.__toESM(l,1);let u=require("react/jsx-runtime");var d=16;function f(e){let t=getComputedStyle(e);return`${t.fontWeight} ${t.fontSize} ${t.fontFamily}`}async function p(e){let t=document.fonts;if(t&&typeof t.load==`function`){try{await t.load(f(e))}catch{}for(;t.status===`loading`;)await new Promise(e=>{t.addEventListener(`loadingdone`,()=>e(),{once:!0})})}}function m(e){let t=document.fonts;return!t||typeof t.load!=`function`?!1:t.status===`loading`||typeof t.check==`function`&&!t.check(f(e))}function h(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.width)===Math.round(t.width)&&Math.round(e.height)===Math.round(t.height)}function g(e){return e.top>=d&&e.bottom<=window.innerHeight-d&&e.left>=d&&e.right<=window.innerWidth-d}var _=({steps:e,open:d,onClose:f,onFinish:_})=>{let{t:v}=t.useWimTranslation(n.commonNs),[y,b]=(0,c.useState)(0),[x,S]=(0,c.useState)(null),C=e[y],w=C?.target;(0,c.useLayoutEffect)(()=>{if(!d||!w){S(null);return}let e=!1,t=t=>{e||S(e=>t?e&&h(e,t)?e:t:null)},n=()=>{let e=document.querySelector(w);if(!e){t(null);return}g(e.getBoundingClientRect())||e.scrollIntoView({block:`center`,inline:`nearest`}),t(e.getBoundingClientRect())},r=()=>{let e=document.querySelector(w);t(e?e.getBoundingClientRect():null)},i,a=()=>{window.addEventListener(`resize`,r),window.addEventListener(`scroll`,r,!0);let e=document.querySelector(w);e&&(i=s.observeMove(e,r))},o=async()=>{let t=document.querySelector(w);t&&await p(t),!e&&(n(),a())},c=document.querySelector(w);return c&&m(c)?o():(n(),a()),()=>{e=!0,window.removeEventListener(`resize`,r),window.removeEventListener(`scroll`,r,!0),i?.()}},[d,y,w]);let T=(0,c.useId)(),E=(0,c.useRef)(null),D=(0,c.useRef)(null),O=d&&!!C&&!!x;if((0,c.useEffect)(()=>{if(!O)return;let e=E.current;e&&!e.contains(document.activeElement)&&D.current?.focus()},[O,y]),(0,c.useEffect)(()=>{if(!d)return;let e=e=>{e.key===`Escape`&&(e.preventDefault(),f())};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[d,f]),!d||!C)return null;let k=()=>{y<e.length-1?b(y+1):(_?_():f(),b(0))},A=()=>{y>0&&b(y-1)},j={},M=C.placement||`bottom`;if(x){let e=window.innerWidth,t=Math.min(300,e-32),n=M;if(e<640&&(n===`left`||n===`right`)&&(n=`bottom`),M=n,n===`top`||n===`bottom`){let r=x.left+x.width/2,i=t/2+16,a=e-t/2-16;r=i>a?e/2:Math.max(i,Math.min(a,r)),j.left=r,n===`top`?(j.top=x.top-12,j.transform=`translate(-50%, -100%)`):(j.top=x.bottom+12,j.transform=`translateX(-50%)`)}else n===`left`?(j.left=x.left-12,j.top=x.top+x.height/2,j.transform=`translate(-100%, -50%)`):n===`right`&&(j.left=x.right+12,j.top=x.top+x.height/2,j.transform=`translateY(-50%)`)}return(0,u.jsx)(r.Portal,{children:(0,u.jsx)(i.FocusTrap,{initialFocus:!1,children:(0,u.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":C.title,"aria-describedby":x?T:void 0,children:[x&&(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:o.default.highlight,style:{top:x.top-4,left:x.left-4,width:x.width+8,height:x.height+8}}),(0,u.jsx)(`div`,{ref:E,className:(0,l.default)(`wim-tour`,o.default.bubble),"data-placement":M,style:j,children:(0,u.jsxs)(`div`,{className:o.default.inner,children:[(0,u.jsx)(`h3`,{className:o.default.title,children:C.title}),(0,u.jsx)(`p`,{id:T,className:o.default.description,children:C.description}),(0,u.jsxs)(`div`,{className:o.default.footer,children:[(0,u.jsxs)(`span`,{className:o.default.progress,children:[y+1,` / `,e.length]}),(0,u.jsxs)(`div`,{className:o.default.buttons,children:[y>0&&(0,u.jsx)(a.Button,{size:`sm`,variant:`outline`,onClick:A,children:v(`action.back`)}),(0,u.jsx)(a.Button,{ref:D,size:`sm`,variant:`solid`,onClick:k,children:y===e.length-1?v(`action.finish`):v(`action.next`)})]})]})]})})]}),(0,u.jsx)(`div`,{className:o.default.mask,onClick:f,role:`button`,tabIndex:0,"aria-label":v(`a11y.close_tour`),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&f()}})]})})})};exports.Tour=_;
@@ -5,167 +5,170 @@ import { Portal as n } from "../../overlay/Portal/Portal.js";
5
5
  import { FocusTrap as r } from "../../overlay/FocusTrap/FocusTrap.js";
6
6
  import { Button as i } from "../../form/Button/Button.js";
7
7
  import a from "./tour.module.js";
8
- import { useEffect as o, useId as s, useLayoutEffect as c, useRef as l, useState as u } from "react";
9
- import d from "classnames";
10
- import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
8
+ import { observeMove as o } from "../../_internal/observeMove.js";
9
+ import { useEffect as s, useId as c, useLayoutEffect as l, useRef as u, useState as d } from "react";
10
+ import f from "classnames";
11
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
11
12
  //#region src/components/feedback/Tour/Tour.tsx
12
- var h = 16;
13
- function g(e) {
13
+ var g = 16;
14
+ function _(e) {
14
15
  let t = getComputedStyle(e);
15
16
  return `${t.fontWeight} ${t.fontSize} ${t.fontFamily}`;
16
17
  }
17
- async function _(e) {
18
+ async function v(e) {
18
19
  let t = document.fonts;
19
20
  if (t && typeof t.load == "function") {
20
21
  try {
21
- await t.load(g(e));
22
+ await t.load(_(e));
22
23
  } catch {}
23
24
  for (; t.status === "loading";) await new Promise((e) => {
24
25
  t.addEventListener("loadingdone", () => e(), { once: !0 });
25
26
  });
26
27
  }
27
28
  }
28
- function v(e) {
29
+ function y(e) {
29
30
  let t = document.fonts;
30
- return !t || typeof t.load != "function" ? !1 : t.status === "loading" || typeof t.check == "function" && !t.check(g(e));
31
+ return !t || typeof t.load != "function" ? !1 : t.status === "loading" || typeof t.check == "function" && !t.check(_(e));
31
32
  }
32
- function y(e, t) {
33
+ function b(e, t) {
33
34
  return Math.round(e.top) === Math.round(t.top) && Math.round(e.left) === Math.round(t.left) && Math.round(e.width) === Math.round(t.width) && Math.round(e.height) === Math.round(t.height);
34
35
  }
35
- function b(e) {
36
- return e.top >= h && e.bottom <= window.innerHeight - h && e.left >= h && e.right <= window.innerWidth - h;
36
+ function x(e) {
37
+ return e.top >= g && e.bottom <= window.innerHeight - g && e.left >= g && e.right <= window.innerWidth - g;
37
38
  }
38
- var x = ({ steps: h, open: g, onClose: x, onFinish: S }) => {
39
- let { t: C } = e(t), [w, T] = u(0), [E, D] = u(null), O = h[w], k = O?.target;
40
- c(() => {
41
- if (!g || !k) {
42
- D(null);
39
+ var S = ({ steps: g, open: _, onClose: S, onFinish: C }) => {
40
+ let { t: w } = e(t), [T, E] = d(0), [D, O] = d(null), k = g[T], A = k?.target;
41
+ l(() => {
42
+ if (!_ || !A) {
43
+ O(null);
43
44
  return;
44
45
  }
45
46
  let e = !1, t = (t) => {
46
- e || D((e) => t ? e && y(e, t) ? e : t : null);
47
+ e || O((e) => t ? e && b(e, t) ? e : t : null);
47
48
  }, n = () => {
48
- let e = document.querySelector(k);
49
+ let e = document.querySelector(A);
49
50
  if (!e) {
50
51
  t(null);
51
52
  return;
52
53
  }
53
- b(e.getBoundingClientRect()) || e.scrollIntoView({
54
+ x(e.getBoundingClientRect()) || e.scrollIntoView({
54
55
  block: "center",
55
56
  inline: "nearest"
56
57
  }), t(e.getBoundingClientRect());
57
58
  }, r = () => {
58
- let e = document.querySelector(k);
59
+ let e = document.querySelector(A);
59
60
  t(e ? e.getBoundingClientRect() : null);
60
- }, i = () => {
61
+ }, i, a = () => {
61
62
  window.addEventListener("resize", r), window.addEventListener("scroll", r, !0);
62
- }, a = async () => {
63
- let t = document.querySelector(k);
64
- t && await _(t), !e && (n(), i());
65
- }, o = document.querySelector(k);
66
- return o && v(o) ? a() : (n(), i()), () => {
67
- e = !0, window.removeEventListener("resize", r), window.removeEventListener("scroll", r, !0);
63
+ let e = document.querySelector(A);
64
+ e && (i = o(e, r));
65
+ }, s = async () => {
66
+ let t = document.querySelector(A);
67
+ t && await v(t), !e && (n(), a());
68
+ }, c = document.querySelector(A);
69
+ return c && y(c) ? s() : (n(), a()), () => {
70
+ e = !0, window.removeEventListener("resize", r), window.removeEventListener("scroll", r, !0), i?.();
68
71
  };
69
72
  }, [
70
- g,
71
- w,
72
- k
73
+ _,
74
+ T,
75
+ A
73
76
  ]);
74
- let A = s(), j = l(null), M = l(null), N = g && !!O && !!E;
75
- if (o(() => {
76
- if (!N) return;
77
- let e = j.current;
78
- e && !e.contains(document.activeElement) && M.current?.focus();
79
- }, [N, w]), o(() => {
80
- if (!g) return;
77
+ let j = c(), M = u(null), N = u(null), P = _ && !!k && !!D;
78
+ if (s(() => {
79
+ if (!P) return;
80
+ let e = M.current;
81
+ e && !e.contains(document.activeElement) && N.current?.focus();
82
+ }, [P, T]), s(() => {
83
+ if (!_) return;
81
84
  let e = (e) => {
82
- e.key === "Escape" && (e.preventDefault(), x());
85
+ e.key === "Escape" && (e.preventDefault(), S());
83
86
  };
84
87
  return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
85
- }, [g, x]), !g || !O) return null;
86
- let P = () => {
87
- w < h.length - 1 ? T(w + 1) : (S ? S() : x(), T(0));
88
- }, F = () => {
89
- w > 0 && T(w - 1);
90
- }, I = {}, L = O.placement || "bottom";
91
- if (E) {
92
- let e = window.innerWidth, t = Math.min(300, e - 32), n = L;
93
- if (e < 640 && (n === "left" || n === "right") && (n = "bottom"), L = n, n === "top" || n === "bottom") {
94
- let r = E.left + E.width / 2, i = t / 2 + 16, a = e - t / 2 - 16;
95
- r = i > a ? e / 2 : Math.max(i, Math.min(a, r)), I.left = r, n === "top" ? (I.top = E.top - 12, I.transform = "translate(-50%, -100%)") : (I.top = E.bottom + 12, I.transform = "translateX(-50%)");
96
- } else n === "left" ? (I.left = E.left - 12, I.top = E.top + E.height / 2, I.transform = "translate(-100%, -50%)") : n === "right" && (I.left = E.right + 12, I.top = E.top + E.height / 2, I.transform = "translateY(-50%)");
88
+ }, [_, S]), !_ || !k) return null;
89
+ let F = () => {
90
+ T < g.length - 1 ? E(T + 1) : (C ? C() : S(), E(0));
91
+ }, I = () => {
92
+ T > 0 && E(T - 1);
93
+ }, L = {}, R = k.placement || "bottom";
94
+ if (D) {
95
+ let e = window.innerWidth, t = Math.min(300, e - 32), n = R;
96
+ if (e < 640 && (n === "left" || n === "right") && (n = "bottom"), R = n, n === "top" || n === "bottom") {
97
+ let r = D.left + D.width / 2, i = t / 2 + 16, a = e - t / 2 - 16;
98
+ r = i > a ? e / 2 : Math.max(i, Math.min(a, r)), L.left = r, n === "top" ? (L.top = D.top - 12, L.transform = "translate(-50%, -100%)") : (L.top = D.bottom + 12, L.transform = "translateX(-50%)");
99
+ } else n === "left" ? (L.left = D.left - 12, L.top = D.top + D.height / 2, L.transform = "translate(-100%, -50%)") : n === "right" && (L.left = D.right + 12, L.top = D.top + D.height / 2, L.transform = "translateY(-50%)");
97
100
  }
98
- return /* @__PURE__ */ p(n, { children: /* @__PURE__ */ p(r, {
101
+ return /* @__PURE__ */ m(n, { children: /* @__PURE__ */ m(r, {
99
102
  initialFocus: !1,
100
- children: /* @__PURE__ */ m("div", {
103
+ children: /* @__PURE__ */ h("div", {
101
104
  role: "dialog",
102
105
  "aria-modal": "true",
103
- "aria-label": O.title,
104
- "aria-describedby": E ? A : void 0,
105
- children: [E && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", {
106
+ "aria-label": k.title,
107
+ "aria-describedby": D ? j : void 0,
108
+ children: [D && /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("div", {
106
109
  className: a.highlight,
107
110
  style: {
108
- top: E.top - 4,
109
- left: E.left - 4,
110
- width: E.width + 8,
111
- height: E.height + 8
111
+ top: D.top - 4,
112
+ left: D.left - 4,
113
+ width: D.width + 8,
114
+ height: D.height + 8
112
115
  }
113
- }), /* @__PURE__ */ p("div", {
114
- ref: j,
115
- className: d("wim-tour", a.bubble),
116
- "data-placement": L,
117
- style: I,
118
- children: /* @__PURE__ */ m("div", {
116
+ }), /* @__PURE__ */ m("div", {
117
+ ref: M,
118
+ className: f("wim-tour", a.bubble),
119
+ "data-placement": R,
120
+ style: L,
121
+ children: /* @__PURE__ */ h("div", {
119
122
  className: a.inner,
120
123
  children: [
121
- /* @__PURE__ */ p("h3", {
124
+ /* @__PURE__ */ m("h3", {
122
125
  className: a.title,
123
- children: O.title
126
+ children: k.title
124
127
  }),
125
- /* @__PURE__ */ p("p", {
126
- id: A,
128
+ /* @__PURE__ */ m("p", {
129
+ id: j,
127
130
  className: a.description,
128
- children: O.description
131
+ children: k.description
129
132
  }),
130
- /* @__PURE__ */ m("div", {
133
+ /* @__PURE__ */ h("div", {
131
134
  className: a.footer,
132
- children: [/* @__PURE__ */ m("span", {
135
+ children: [/* @__PURE__ */ h("span", {
133
136
  className: a.progress,
134
137
  children: [
135
- w + 1,
138
+ T + 1,
136
139
  " / ",
137
- h.length
140
+ g.length
138
141
  ]
139
- }), /* @__PURE__ */ m("div", {
142
+ }), /* @__PURE__ */ h("div", {
140
143
  className: a.buttons,
141
- children: [w > 0 && /* @__PURE__ */ p(i, {
144
+ children: [T > 0 && /* @__PURE__ */ m(i, {
142
145
  size: "sm",
143
146
  variant: "outline",
144
- onClick: F,
145
- children: C("action.back")
146
- }), /* @__PURE__ */ p(i, {
147
- ref: M,
147
+ onClick: I,
148
+ children: w("action.back")
149
+ }), /* @__PURE__ */ m(i, {
150
+ ref: N,
148
151
  size: "sm",
149
152
  variant: "solid",
150
- onClick: P,
151
- children: w === h.length - 1 ? C("action.finish") : C("action.next")
153
+ onClick: F,
154
+ children: T === g.length - 1 ? w("action.finish") : w("action.next")
152
155
  })]
153
156
  })]
154
157
  })
155
158
  ]
156
159
  })
157
- })] }), /* @__PURE__ */ p("div", {
160
+ })] }), /* @__PURE__ */ m("div", {
158
161
  className: a.mask,
159
- onClick: x,
162
+ onClick: S,
160
163
  role: "button",
161
164
  tabIndex: 0,
162
- "aria-label": C("a11y.close_tour"),
165
+ "aria-label": w("a11y.close_tour"),
163
166
  onKeyDown: (e) => {
164
- (e.key === "Enter" || e.key === " ") && x();
167
+ (e.key === "Enter" || e.key === " ") && S();
165
168
  }
166
169
  })]
167
170
  })
168
171
  }) });
169
172
  };
170
173
  //#endregion
171
- export { x as Tour };
174
+ export { S as Tour };
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../utilities/style-utils.cjs"),r=require("../../../i18n/useWimTranslation.cjs"),i=require("../../../i18n/generated/common.cjs"),a=require("../../../hooks/useMergedRef.cjs"),o=require("../../../icon/loading.cjs"),s=require("../../media/Icon/Icon.cjs"),c=require("./button.module.cjs");let l=require("react");l=e.__toESM(l,1);let u=require("classnames");u=e.__toESM(u,1);let d=require("react/jsx-runtime");var f=l.default.forwardRef(({asChild:e=!1,size:f=`md`,variant:p=`outline`,intent:m=`default`,icon:h,iconPosition:g=`left`,loading:_=!1,backgroundColor:v,justify:y=`center`,animateWidth:b=!1,fullWidth:x=!1,styles:S,"aria-label":C,className:w,disabled:T,children:E,...D},O)=>{let k=l.default.useRef(null),A=a.useMergedRef(k,O),[j,M]=l.default.useState(`auto`),N=l.default.useRef(!0);l.default.useLayoutEffect(()=>{if(!b||!k.current)return;if(N.current){N.current=!1;return}let e=k.current,t=e.getBoundingClientRect().width;M(t);let n=e.style.width,r=e.style.minWidth;e.style.width=`auto`,e.style.minWidth=`0`;let i=Math.ceil(e.getBoundingClientRect().width)+2;e.style.width=n,e.style.minWidth=r;let a=requestAnimationFrame(()=>{M(i)});return()=>cancelAnimationFrame(a)},[E,b]);let{t:P}=r.useWimTranslation(i.commonNs),F=T,I;typeof C==`string`?I=C:C!==!1&&(!E&&typeof h==`string`?I=h:_&&(I=P(`a11y.loading`)));let L=y===`start`?`flex-start`:y===`end`?`flex-end`:y===`between`?`space-between`:y,R=_?(0,d.jsx)(`span`,{className:(0,u.default)(c.default.loader,S?.loader),children:(0,d.jsx)(s.Icon,{component:o.default,spin:!0,size:f})}):h?typeof h==`string`?(0,d.jsx)(s.Icon,{name:h,size:f,className:S?.icon}):h:null;return(0,d.jsxs)(e?t.Root:`button`,{ref:A,type:e?void 0:`button`,style:{...D.style,justifyContent:L,...v?{backgroundColor:n.getColorValue(v)}:{},...b&&j!==`auto`?{width:`${j}px`,transitionProperty:D.style?.transitionProperty||`width, background-color, border-color, box-shadow, transform`,transitionDuration:D.style?.transitionDuration||`var(--wim-duration-base)`,transitionTimingFunction:D.style?.transitionTimingFunction||`var(--wim-easing-standard)`,overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`clip`}:{}},className:(0,u.default)(`wim-button`,c.default.root,c.default[f],c.default[p],c.default[m],_&&c.default.loading,b&&c.default.animatedWidth,x&&c.default.fullWidth,!E&&!!h&&c.default.iconOnly,w,S?.root),disabled:(F||_)&&!e?!0:void 0,"aria-label":I,"aria-busy":_||void 0,...e?D:{...D},children:[e&&R&&g===`left`?R:null,e?(0,d.jsx)(t.Slottable,{children:E}):(0,d.jsxs)(`span`,{className:c.default.content,children:[R&&g===`left`&&R,E,R&&g===`right`&&R]}),e&&R&&g===`right`?R:null]})});f.displayName=`Button`,exports.Button=f;
2
+ const e=require("../../../_virtual/_rolldown/runtime.cjs"),t=require("../../../node_modules/@radix-ui/react-slot/dist/index.cjs"),n=require("../../../utilities/style-utils.cjs"),r=require("../../../i18n/useWimTranslation.cjs"),i=require("../../../i18n/generated/common.cjs"),a=require("../../../hooks/useMergedRef.cjs"),o=require("../../../icon/loading.cjs"),s=require("../../media/Icon/Icon.cjs"),c=require("./button.module.cjs");let l=require("react");l=e.__toESM(l,1);let u=require("classnames");u=e.__toESM(u,1);let d=require("react/jsx-runtime");var f=l.default.forwardRef(({asChild:e=!1,size:f=`md`,variant:p=`outline`,intent:m=`default`,icon:h,iconPosition:g=`left`,loading:_=!1,backgroundColor:v,justify:y=`center`,animateWidth:b=!1,fullWidth:x=!1,styles:S,"aria-label":C,className:w,disabled:T,children:E,...D},O)=>{let k=l.default.useRef(null),A=a.useMergedRef(k,O),[j,M]=l.default.useState(`auto`),N=l.default.useRef(!0);l.default.useLayoutEffect(()=>{if(!b||!k.current)return;if(N.current){N.current=!1;return}let e=k.current,t=e.getBoundingClientRect().width;M(t);let n=e.style.width,r=e.style.minWidth;e.style.width=`auto`,e.style.minWidth=`0`;let i=Math.ceil(e.getBoundingClientRect().width)+2;e.style.width=n,e.style.minWidth=r;let a=requestAnimationFrame(()=>{M(i)});return()=>cancelAnimationFrame(a)},[E,b]);let{t:P}=r.useWimTranslation(i.commonNs),F=T,I;typeof C==`string`?I=C:C!==!1&&_&&(E||typeof h!=`string`)&&(I=P(`a11y.loading`));let L=!e&&!E&&!!h&&typeof C!=`string`&&!D[`aria-labelledby`]&&!D.title;l.default.useEffect(()=>{},[L]);let R=y===`start`?`flex-start`:y===`end`?`flex-end`:y===`between`?`space-between`:y,z=_?(0,d.jsx)(`span`,{className:(0,u.default)(c.default.loader,S?.loader),children:(0,d.jsx)(s.Icon,{component:o.default,spin:!0,size:f})}):h?typeof h==`string`?(0,d.jsx)(s.Icon,{name:h,size:f,className:S?.icon}):h:null;return(0,d.jsxs)(e?t.Root:`button`,{ref:A,type:e?void 0:`button`,className:(0,u.default)(`wim-button`,c.default.root,c.default[f],c.default[p],c.default[m],_&&c.default.loading,b&&c.default.animatedWidth,x&&c.default.fullWidth,!E&&!!h&&c.default.iconOnly,w,S?.root),disabled:(F||_)&&!e?!0:void 0,"aria-label":I,"aria-busy":_||void 0,...e?D:{...D},style:{...D.style,justifyContent:R,...v?{backgroundColor:n.getColorValue(v)}:{},...b&&j!==`auto`?{width:`${j}px`,transitionProperty:D.style?.transitionProperty||`width, background-color, border-color, box-shadow, transform`,transitionDuration:D.style?.transitionDuration||`var(--wim-duration-base)`,transitionTimingFunction:D.style?.transitionTimingFunction||`var(--wim-easing-standard)`,overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`clip`}:{}},children:[e&&z&&g===`left`?z:null,e?(0,d.jsx)(t.Slottable,{children:E}):(0,d.jsxs)(`span`,{className:c.default.content,children:[z&&g===`left`&&z,E,z&&g===`right`&&z]}),e&&z&&g===`right`?z:null]})});f.displayName=`Button`,exports.Button=f;
@@ -15,7 +15,7 @@ export type ButtonProps = React.ComponentPropsWithoutRef<"button"> & {
15
15
  variant?: ButtonVariant;
16
16
  /** Design intent of the button (visual / semantic state). Unrelated to the ARIA role attribute. */
17
17
  intent?: ButtonIntent;
18
- /** Icon name or custom icon element */
18
+ /** Icon name or custom icon element. An icon-only button (no children) needs `aria-label` or `aria-labelledby`: the icon name is not used as the accessible name. */
19
19
  icon?: React.ComponentProps<typeof Icon>["name"] | React.ReactNode;
20
20
  /** Position of the icon relative to the label */
21
21
  iconPosition?: "left" | "right";
@@ -48,7 +48,7 @@ export declare const Button: React.ForwardRefExoticComponent<Omit<React.Detailed
48
48
  variant?: ButtonVariant;
49
49
  /** Design intent of the button (visual / semantic state). Unrelated to the ARIA role attribute. */
50
50
  intent?: ButtonIntent;
51
- /** Icon name or custom icon element */
51
+ /** Icon name or custom icon element. An icon-only button (no children) needs `aria-label` or `aria-labelledby`: the icon name is not used as the accessible name. */
52
52
  icon?: React.ComponentProps<typeof Icon>["name"] | React.ReactNode;
53
53
  /** Position of the icon relative to the label */
54
54
  iconPosition?: "left" | "right";
@@ -31,8 +31,10 @@ var p = l.forwardRef(({ asChild: p = !1, size: m = "md", variant: h = "outline",
31
31
  return () => cancelAnimationFrame(a);
32
32
  }, [O, S]);
33
33
  let { t: I } = r(i), L = D, R;
34
- typeof T == "string" ? R = T : T !== !1 && (!O && typeof _ == "string" ? R = _ : y && (R = I("a11y.loading")));
35
- let z = x === "start" ? "flex-start" : x === "end" ? "flex-end" : x === "between" ? "space-between" : x, B = y ? /* @__PURE__ */ d("span", {
34
+ typeof T == "string" ? R = T : T !== !1 && y && (O || typeof _ != "string") && (R = I("a11y.loading"));
35
+ let z = !p && !O && !!_ && typeof T != "string" && !k["aria-labelledby"] && !k.title;
36
+ l.useEffect(() => {}, [z]);
37
+ let B = x === "start" ? "flex-start" : x === "end" ? "flex-end" : x === "between" ? "space-between" : x, V = y ? /* @__PURE__ */ d("span", {
36
38
  className: u(c.loader, w?.loader),
37
39
  children: /* @__PURE__ */ d(s, {
38
40
  component: o,
@@ -47,9 +49,14 @@ var p = l.forwardRef(({ asChild: p = !1, size: m = "md", variant: h = "outline",
47
49
  return /* @__PURE__ */ f(p ? e : "button", {
48
50
  ref: M,
49
51
  type: p ? void 0 : "button",
52
+ className: u("wim-button", c.root, c[m], c[h], c[g], y && c.loading, S && c.animatedWidth, C && c.fullWidth, !O && !!_ && c.iconOnly, E, w?.root),
53
+ disabled: (L || y) && !p ? !0 : void 0,
54
+ "aria-label": R,
55
+ "aria-busy": y || void 0,
56
+ ...p ? k : { ...k },
50
57
  style: {
51
58
  ...k.style,
52
- justifyContent: z,
59
+ justifyContent: B,
53
60
  ...b ? { backgroundColor: n(b) } : {},
54
61
  ...S && N !== "auto" ? {
55
62
  width: `${N}px`,
@@ -61,22 +68,17 @@ var p = l.forwardRef(({ asChild: p = !1, size: m = "md", variant: h = "outline",
61
68
  textOverflow: "clip"
62
69
  } : {}
63
70
  },
64
- className: u("wim-button", c.root, c[m], c[h], c[g], y && c.loading, S && c.animatedWidth, C && c.fullWidth, !O && !!_ && c.iconOnly, E, w?.root),
65
- disabled: (L || y) && !p ? !0 : void 0,
66
- "aria-label": R,
67
- "aria-busy": y || void 0,
68
- ...p ? k : { ...k },
69
71
  children: [
70
- p && B && v === "left" ? B : null,
72
+ p && V && v === "left" ? V : null,
71
73
  p ? /* @__PURE__ */ d(t, { children: O }) : /* @__PURE__ */ f("span", {
72
74
  className: c.content,
73
75
  children: [
74
- B && v === "left" && B,
76
+ V && v === "left" && V,
75
77
  O,
76
- B && v === "right" && B
78
+ V && v === "right" && V
77
79
  ]
78
80
  }),
79
- p && B && v === "right" ? B : null
81
+ p && V && v === "right" ? V : null
80
82
  ]
81
83
  });
82
84
  });