@vkzstudio/muza-ui 1.0.5 → 1.0.7

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 (90) hide show
  1. package/dist/components/Button/buttonVariants.d.ts +1 -1
  2. package/dist/components/Calendar/Calendar.d.ts +2 -2
  3. package/dist/components/Calendar/Calendar.d.ts.map +1 -1
  4. package/dist/components/Calendar/Calendar.js +158 -150
  5. package/dist/components/DataTable/DataTable.d.ts +17 -0
  6. package/dist/components/DataTable/DataTable.d.ts.map +1 -0
  7. package/dist/components/DataTable/DataTable.js +73 -0
  8. package/dist/components/DataTable/DataTable.stories.d.ts +10 -0
  9. package/dist/components/DataTable/DataTable.stories.d.ts.map +1 -0
  10. package/dist/components/DataTable/index.d.ts +2 -0
  11. package/dist/components/DataTable/index.d.ts.map +1 -0
  12. package/dist/components/Dialog/Dialog.d.ts.map +1 -1
  13. package/dist/components/Dialog/Dialog.js +28 -26
  14. package/dist/components/ExpandableTable/Table.d.ts +1 -1
  15. package/dist/components/FileUpload/FileItem.d.ts.map +1 -1
  16. package/dist/components/FileUpload/FileItem.js +83 -78
  17. package/dist/components/FileUpload/FileUpload.d.ts.map +1 -1
  18. package/dist/components/FileUpload/FileUpload.js +98 -94
  19. package/dist/components/Flex/Flex.d.ts +1 -1
  20. package/dist/components/Icons/CustomIcons.d.ts +3 -0
  21. package/dist/components/Icons/CustomIcons.d.ts.map +1 -1
  22. package/dist/components/Icons/CustomIcons.js +90 -41
  23. package/dist/components/Icons/Icons.stories.d.ts.map +1 -1
  24. package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  25. package/dist/components/MultiSelect/MultiSelect.js +51 -50
  26. package/dist/components/MuzaUIProvider/MuzaUIProvider.d.ts +19 -0
  27. package/dist/components/MuzaUIProvider/MuzaUIProvider.d.ts.map +1 -0
  28. package/dist/components/MuzaUIProvider/MuzaUIProvider.js +19 -0
  29. package/dist/components/MuzaUIProvider/MuzaUIProvider.stories.d.ts +10 -0
  30. package/dist/components/MuzaUIProvider/MuzaUIProvider.stories.d.ts.map +1 -0
  31. package/dist/components/MuzaUIProvider/index.d.ts +2 -0
  32. package/dist/components/MuzaUIProvider/index.d.ts.map +1 -0
  33. package/dist/components/Searchbar/Searchbar.d.ts +3 -2
  34. package/dist/components/Searchbar/Searchbar.d.ts.map +1 -1
  35. package/dist/components/Searchbar/Searchbar.js +56 -54
  36. package/dist/components/Searchbar/Searchbar.stories.d.ts +1 -0
  37. package/dist/components/Searchbar/Searchbar.stories.d.ts.map +1 -1
  38. package/dist/components/Select/Select.d.ts.map +1 -1
  39. package/dist/components/Select/Select.js +43 -42
  40. package/dist/components/Stepper/Stepper.d.ts +1 -1
  41. package/dist/components/Stepper/Stepper.d.ts.map +1 -1
  42. package/dist/components/Stepper/Stepper.js +43 -42
  43. package/dist/components/SwipeButton/SwipeButton.d.ts +1 -1
  44. package/dist/components/SwipeButton/SwipeButton.d.ts.map +1 -1
  45. package/dist/components/SwipeButton/SwipeButton.js +85 -84
  46. package/dist/components/SwipeButton/SwipeButton.stories.d.ts +1 -1
  47. package/dist/components/Typography/Typography.d.ts +1 -1
  48. package/dist/components/index.d.ts +3 -0
  49. package/dist/components/index.d.ts.map +1 -1
  50. package/dist/index.js +204 -186
  51. package/dist/muza-ui.css +1 -1
  52. package/dist/node_modules/date-fns/_lib/defaultOptions.js +7 -0
  53. package/dist/node_modules/date-fns/_lib/normalizeDates.js +11 -0
  54. package/dist/node_modules/date-fns/constants.js +4 -0
  55. package/dist/node_modules/date-fns/constructFrom.js +8 -0
  56. package/dist/node_modules/date-fns/isSameWeek.js +14 -0
  57. package/dist/node_modules/date-fns/locale/cs/_lib/formatDistance.js +275 -0
  58. package/dist/node_modules/date-fns/locale/cs/_lib/formatLong.js +33 -0
  59. package/dist/node_modules/date-fns/locale/cs/_lib/formatRelative.js +25 -0
  60. package/dist/node_modules/date-fns/locale/cs/_lib/localize.js +167 -0
  61. package/dist/node_modules/date-fns/locale/cs/_lib/match.js +109 -0
  62. package/dist/node_modules/date-fns/locale/cs.js +21 -0
  63. package/dist/node_modules/date-fns/locale/sk/_lib/formatDistance.js +158 -0
  64. package/dist/node_modules/date-fns/locale/sk/_lib/formatLong.js +33 -0
  65. package/dist/node_modules/date-fns/locale/sk/_lib/formatRelative.js +60 -0
  66. package/dist/node_modules/date-fns/locale/sk/_lib/localize.js +175 -0
  67. package/dist/node_modules/date-fns/locale/sk/_lib/match.js +111 -0
  68. package/dist/node_modules/date-fns/locale/sk.js +21 -0
  69. package/dist/node_modules/date-fns/startOfWeek.js +11 -0
  70. package/dist/node_modules/date-fns/toDate.js +8 -0
  71. package/dist/styles/token-colors.css +1206 -1199
  72. package/dist/styles/token-sizes.css +680 -680
  73. package/dist/styles/typography.css +84 -84
  74. package/dist/translations/TranslationContext.d.ts +61 -0
  75. package/dist/translations/TranslationContext.d.ts.map +1 -0
  76. package/dist/translations/TranslationContext.js +74 -0
  77. package/dist/translations/index.d.ts +6 -0
  78. package/dist/translations/index.d.ts.map +1 -0
  79. package/dist/translations/locales/cs.d.ts +3 -0
  80. package/dist/translations/locales/cs.d.ts.map +1 -0
  81. package/dist/translations/locales/cs.js +52 -0
  82. package/dist/translations/locales/en.d.ts +3 -0
  83. package/dist/translations/locales/en.d.ts.map +1 -0
  84. package/dist/translations/locales/en.js +52 -0
  85. package/dist/translations/locales/sk.d.ts +3 -0
  86. package/dist/translations/locales/sk.d.ts.map +1 -0
  87. package/dist/translations/locales/sk.js +52 -0
  88. package/dist/translations/types.d.ts +118 -0
  89. package/dist/translations/types.d.ts.map +1 -0
  90. package/package.json +1 -1
@@ -1,26 +1,27 @@
1
1
  import { jsx as t, jsxs as p } from "react/jsx-runtime";
2
- import m, { forwardRef as C, useMemo as V, useRef as N, useEffect as R } from "react";
3
- import { triggerWrapperVariants as A } from "./utils.js";
2
+ import m, { forwardRef as A, useMemo as I, useRef as N, useEffect as R } from "react";
3
+ import { triggerWrapperVariants as j } from "./utils.js";
4
+ import { useMuzaTranslations as E } from "../../translations/TranslationContext.js";
4
5
  import { Typography as s } from "../Typography/Typography.js";
5
- import { DropdownMenu as I, DropdownMenuTrigger as j, DropdownMenuContent as E, DropdownMenuRadioGroup as _, DropdownMenuRadioItem as k } from "../DropdownMenu/DropdownMenu.js";
6
- import { AltArrowUpOutline as B } from "@solar-icons/react-perf";
7
- import { cn as F } from "../../utils/cn.js";
8
- const G = C(
9
- (S, f) => {
10
- const {
11
- label: x,
12
- hint: g,
13
- error: h,
6
+ import { DropdownMenu as P, DropdownMenuTrigger as _, DropdownMenuContent as k, DropdownMenuRadioGroup as B, DropdownMenuRadioItem as F } from "../DropdownMenu/DropdownMenu.js";
7
+ import { AltArrowUpOutline as G } from "@solar-icons/react-perf";
8
+ import { cn as L } from "../../utils/cn.js";
9
+ const U = A(
10
+ (z, f) => {
11
+ const S = E(), {
12
+ label: h,
13
+ hint: x,
14
+ error: g,
14
15
  options: c,
15
- onChange: i,
16
+ onChange: a,
16
17
  value: r,
17
- disabled: a,
18
+ disabled: i,
18
19
  prefix: b,
19
- size: z,
20
- placeholder: w = "Select...",
21
- shouldScrollToSelectedOption: v,
20
+ size: M,
21
+ placeholder: T,
22
+ shouldScrollToSelectedOption: w,
22
23
  collisionPadding: D
23
- } = S, M = V(() => {
24
+ } = z, v = T ?? S.select.placeholder, O = I(() => {
24
25
  const e = r && c.find((l) => l.value === r);
25
26
  return e ? typeof e.label != "function" ? /* @__PURE__ */ t(
26
27
  s,
@@ -38,13 +39,13 @@ const G = C(
38
39
  className: "grow-1 fix-y-text truncate text-left text-comp-select-text-placeholder",
39
40
  weight: "regular",
40
41
  component: "span",
41
- children: w
42
+ children: v
42
43
  }
43
44
  );
44
- }, [c, r, w]), [o, O] = m.useState(!1), [y, T] = m.useState(0), d = m.useRef(!1), W = N(null), u = N({}), n = (typeof f == "function" ? null : f) ?? W;
45
+ }, [c, r, v]), [o, W] = m.useState(!1), [y, C] = m.useState(0), d = m.useRef(!1), V = N(null), u = N({}), n = (typeof f == "function" ? null : f) ?? V;
45
46
  return R(() => {
46
47
  const e = () => {
47
- n.current && T(n.current.offsetWidth);
48
+ n.current && C(n.current.offsetWidth);
48
49
  };
49
50
  e();
50
51
  const l = new ResizeObserver(e);
@@ -53,47 +54,47 @@ const G = C(
53
54
  };
54
55
  }, [n]), R(() => {
55
56
  var e;
56
- o && r && u.current[r] && v && ((e = u.current[r]) == null || e.scrollIntoView({ block: "nearest" }));
57
- }, [o, v, r]), /* @__PURE__ */ p("div", { className: "flex flex-1 flex-col gap-sm", children: [
58
- x && /* @__PURE__ */ t(
57
+ o && r && u.current[r] && w && ((e = u.current[r]) == null || e.scrollIntoView({ block: "nearest" }));
58
+ }, [o, w, r]), /* @__PURE__ */ p("div", { className: "flex flex-1 flex-col gap-sm", children: [
59
+ h && /* @__PURE__ */ t(
59
60
  s,
60
61
  {
61
62
  component: "label",
62
63
  size: "sm",
63
64
  weight: "regular",
64
65
  className: "text-comp-select-text-primary",
65
- children: x
66
+ children: h
66
67
  }
67
68
  ),
68
69
  /* @__PURE__ */ p(
69
- I,
70
+ P,
70
71
  {
71
72
  onOpenChange: (e) => {
72
- O(e);
73
+ W(e);
73
74
  },
74
75
  children: [
75
- /* @__PURE__ */ t(j, { disabled: a, asChild: !0, children: /* @__PURE__ */ t(
76
+ /* @__PURE__ */ t(_, { disabled: i, asChild: !0, children: /* @__PURE__ */ t(
76
77
  "button",
77
78
  {
78
79
  ref: n,
79
80
  type: "button",
80
81
  role: "input",
81
82
  tabIndex: 0,
82
- disabled: a,
83
- className: A({ size: z, error: h, expanded: o }),
83
+ disabled: i,
84
+ className: j({ size: M, error: g, expanded: o }),
84
85
  children: /* @__PURE__ */ p("div", { className: "flex min-w-0 flex-1 items-center gap-sm", children: [
85
86
  b && /* @__PURE__ */ t(
86
87
  "span",
87
88
  {
88
- className: a ? "text-comp-select-icon-disabled" : "text-comp-select-icon-brand-def",
89
+ className: i ? "text-comp-select-icon-disabled" : "text-comp-select-icon-brand-def",
89
90
  children: b
90
91
  }
91
92
  ),
92
- M,
93
+ O,
93
94
  /* @__PURE__ */ t(
94
- B,
95
+ G,
95
96
  {
96
- className: F(
97
+ className: L(
97
98
  "transition-transform duration-200",
98
99
  o ? "rotate-0" : "rotate-180"
99
100
  )
@@ -103,7 +104,7 @@ const G = C(
103
104
  }
104
105
  ) }),
105
106
  /* @__PURE__ */ t(
106
- E,
107
+ k,
107
108
  {
108
109
  className: "mt-1",
109
110
  style: {
@@ -114,14 +115,14 @@ const G = C(
114
115
  },
115
116
  collisionPadding: D,
116
117
  children: /* @__PURE__ */ t(
117
- _,
118
+ B,
118
119
  {
119
120
  value: r,
120
121
  onValueChange: (e) => {
121
- d.current = !0, i == null || i(e);
122
+ d.current = !0, a == null || a(e);
122
123
  },
123
124
  children: c.map((e) => /* @__PURE__ */ t(
124
- k,
125
+ F,
125
126
  {
126
127
  value: e.value.toString(),
127
128
  disabled: e.disabled,
@@ -140,20 +141,20 @@ const G = C(
140
141
  ]
141
142
  }
142
143
  ),
143
- g && /* @__PURE__ */ t(
144
+ x && /* @__PURE__ */ t(
144
145
  s,
145
146
  {
146
147
  component: "p",
147
148
  size: "sm",
148
149
  weight: "regular",
149
- className: h ? "text-comp-select-text-error" : "text-comp-select-text-secondary",
150
- children: g
150
+ className: g ? "text-comp-select-text-error" : "text-comp-select-text-secondary",
151
+ children: x
151
152
  }
152
153
  )
153
154
  ] });
154
155
  }
155
156
  );
156
- G.displayName = "Select";
157
+ U.displayName = "Select";
157
158
  export {
158
- G as Select
159
+ U as Select
159
160
  };
@@ -13,6 +13,6 @@ export interface StepperProps {
13
13
  className?: string;
14
14
  onLimitReached?: (limit: 'min' | 'max') => void;
15
15
  }
16
- declare const Stepper: ({ value, defaultValue, onChange, min, max, step, disabled, formatValue, incrementAriaLabel, decrementAriaLabel, className, onLimitReached, }: StepperProps) => import("react/jsx-runtime").JSX.Element;
16
+ declare const Stepper: ({ value, defaultValue, onChange, min, max, step, disabled, formatValue, incrementAriaLabel: incrementAriaLabelProp, decrementAriaLabel: decrementAriaLabelProp, className, onLimitReached, }: StepperProps) => import("react/jsx-runtime").JSX.Element;
17
17
  export { Stepper };
18
18
  //# sourceMappingURL=Stepper.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Stepper.d.ts","sourceRoot":"","sources":["../../../src/components/Stepper/Stepper.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,YAAY;IAE3B,KAAK,EAAE,MAAM,CAAA;IAEb,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAElC,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAEvC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,KAAK,IAAI,CAAA;CAChD;AAED,QAAA,MAAM,OAAO,GAAI,8IAad,YAAY,4CA6Ed,CAAA;AAED,OAAO,EAAE,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"Stepper.d.ts","sourceRoot":"","sources":["../../../src/components/Stepper/Stepper.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,YAAY;IAE3B,KAAK,EAAE,MAAM,CAAA;IAEb,YAAY,CAAC,EAAE,MAAM,CAAA;IAErB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAElC,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ,IAAI,CAAC,EAAE,MAAM,CAAA;IAEb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IAEvC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAE3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,KAAK,IAAI,CAAA;CAChD;AAED,QAAA,MAAM,OAAO,GAAI,8LAad,YAAY,4CAmFd,CAAA;AAED,OAAO,EAAE,OAAO,EAAE,CAAA"}
@@ -1,84 +1,85 @@
1
- import { jsxs as a, jsx as l } from "react/jsx-runtime";
2
- import { useState as j, useEffect as n } from "react";
3
- import { StepperButton as v } from "./StepperButton.js";
4
- import { Typography as w } from "../Typography/Typography.js";
5
- import { cn as z } from "../../utils/cn.js";
6
- import { MinusCircleBold as D, AddCircleBold as A } from "@solar-icons/react-perf";
7
- const G = ({
8
- value: d,
1
+ import { jsxs as w, jsx as l } from "react/jsx-runtime";
2
+ import { useState as I, useEffect as M } from "react";
3
+ import { StepperButton as b } from "./StepperButton.js";
4
+ import { useMuzaTranslations as T } from "../../translations/TranslationContext.js";
5
+ import { Typography as D } from "../Typography/Typography.js";
6
+ import { cn as x } from "../../utils/cn.js";
7
+ import { MinusCircleBold as E, AddCircleBold as Y } from "@solar-icons/react-perf";
8
+ const P = ({
9
+ value: f,
9
10
  defaultValue: p,
10
11
  onChange: r,
11
- min: c,
12
+ min: i,
12
13
  max: o,
13
- step: N,
14
+ step: z,
14
15
  disabled: m,
15
- formatValue: u,
16
- incrementAriaLabel: b = "Increment",
17
- decrementAriaLabel: y = "Decrement",
18
- className: k,
19
- onLimitReached: e
16
+ formatValue: d,
17
+ incrementAriaLabel: v,
18
+ decrementAriaLabel: A,
19
+ className: N,
20
+ onLimitReached: s
20
21
  }) => {
21
- const i = d !== void 0, [S, f] = j(p ?? 0), s = i ? d : S, x = N ?? 1;
22
- n(() => {
23
- !i && p !== void 0 && f(p);
24
- }, [p, i]);
22
+ const n = T(), y = v ?? n.stepper.incrementAriaLabel, k = A ?? n.stepper.decrementAriaLabel, c = f !== void 0, [S, a] = I(p ?? 0), e = c ? f : S, u = z ?? 1;
23
+ M(() => {
24
+ !c && p !== void 0 && a(p);
25
+ }, [p, c]);
25
26
  const B = () => {
26
27
  if (m) return;
27
- const t = s - x;
28
- if (c !== void 0 && t < c) {
29
- e == null || e("min");
28
+ const t = e - u;
29
+ if (i !== void 0 && t < i) {
30
+ s == null || s("min");
30
31
  return;
31
32
  }
32
- i || f(t), r == null || r(t);
33
- }, I = () => {
33
+ c || a(t), r == null || r(t);
34
+ }, j = () => {
34
35
  if (m) return;
35
- const t = s + x;
36
+ const t = e + u;
36
37
  if (o !== void 0 && t > o) {
37
- e == null || e("max");
38
+ s == null || s("max");
38
39
  return;
39
40
  }
40
- i || f(t), r == null || r(t);
41
+ c || a(t), r == null || r(t);
41
42
  };
42
- return /* @__PURE__ */ a("div", { className: z("flex items-center gap-sm", k), children: [
43
+ return /* @__PURE__ */ w("div", { className: x("flex items-center gap-sm", N), children: [
43
44
  /* @__PURE__ */ l(
44
- v,
45
+ b,
45
46
  {
46
- ariaLabel: y,
47
+ ariaLabel: k,
47
48
  onClick: B,
48
- disabled: m || c !== void 0 && s <= c,
49
+ disabled: m || i !== void 0 && e <= i,
49
50
  className: "size-comp-stepper-btn-size",
50
- children: /* @__PURE__ */ l(D, { className: "size-full transition-colors" })
51
+ children: /* @__PURE__ */ l(E, { className: "size-full transition-colors" })
51
52
  }
52
53
  ),
53
54
  /* @__PURE__ */ l(
54
- w,
55
+ D,
55
56
  {
56
57
  variant: "body",
57
58
  size: "base",
58
59
  weight: "medium",
59
60
  component: "span",
60
- className: z(
61
+ className: x(
61
62
  "min-w-[1.75rem] text-center text-text-dark-primary-def",
62
63
  {
63
- "text-text-dark-secondary": s === c
64
+ "text-text-dark-secondary": e === i
64
65
  }
65
66
  ),
66
67
  fixY: !0,
67
- children: u ? u(s) : s
68
+ children: d ? d(e) : e
68
69
  }
69
70
  ),
70
71
  /* @__PURE__ */ l(
71
- v,
72
+ b,
72
73
  {
73
- ariaLabel: b,
74
- onClick: I,
75
- disabled: m || o !== void 0 && s >= o,
74
+ ariaLabel: y,
75
+ onClick: j,
76
+ disabled: m || o !== void 0 && e >= o,
76
77
  className: "size-comp-stepper-btn-size",
77
- children: /* @__PURE__ */ l(A, { className: "size-full transition-colors" })
78
+ children: /* @__PURE__ */ l(Y, { className: "size-full transition-colors" })
78
79
  }
79
80
  )
80
81
  ] });
81
82
  };
82
83
  export {
83
- G as Stepper
84
+ P as Stepper
84
85
  };
@@ -12,6 +12,6 @@ export interface SwipeButtonProps extends React.ButtonHTMLAttributes<HTMLButtonE
12
12
  onResetComplete?: () => void;
13
13
  className?: string;
14
14
  }
15
- declare const SwipeButton: ({ text, successText, loadingText, variant, size, fullWidth, loading, success, disabled, danger, onSwipeComplete, reset, onResetComplete, className, }: SwipeButtonProps) => import("react/jsx-runtime").JSX.Element;
15
+ declare const SwipeButton: ({ text, successText: successTextProp, loadingText: loadingTextProp, variant, size, fullWidth, loading, success, disabled, danger, onSwipeComplete, reset, onResetComplete, className, }: SwipeButtonProps) => import("react/jsx-runtime").JSX.Element;
16
16
  export { SwipeButton };
17
17
  //# sourceMappingURL=SwipeButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SwipeButton.d.ts","sourceRoot":"","sources":["../../../src/components/SwipeButton/SwipeButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAe5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D,MAAM,WAAW,gBACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,mBAAmB,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,QAAA,MAAM,WAAW,GAAI,uJAelB,gBAAgB,4CAiOlB,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
1
+ {"version":3,"file":"SwipeButton.d.ts","sourceRoot":"","sources":["../../../src/components/SwipeButton/SwipeButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAgB5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D,MAAM,WAAW,gBACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,mBAAmB,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,QAAA,MAAM,WAAW,GAAI,yLAelB,gBAAgB,4CAsOlB,CAAA;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -1,131 +1,132 @@
1
- import { jsxs as g, jsx as o } from "react/jsx-runtime";
2
- import { useRef as D, useState as V, useEffect as N } from "react";
3
- import { SwipeLoadingIcon as A } from "./SwipeLoadingIcon.js";
4
- import { swipeButtonProgressVariants as $ } from "./swipeButtonProgressVariants.js";
5
- import { swipeButtonSliderVariants as F } from "./swipeButtonSliderVariants.js";
6
- import { swipeButtonVariants as S } from "./swipeButtonVariants.js";
7
- import { useDragControls as U } from "../../node_modules/framer-motion/dist/es/gestures/drag/use-drag-controls.js";
8
- import { useMotionValue as _ } from "../../node_modules/framer-motion/dist/es/value/use-motion-value.js";
9
- import { useTransform as b } from "../../node_modules/framer-motion/dist/es/value/use-transform.js";
10
- import { useMotionValueEvent as q } from "../../node_modules/framer-motion/dist/es/utils/use-motion-value-event.js";
11
- import { animate as f } from "../../node_modules/framer-motion/dist/es/animation/animate/index.js";
1
+ import { jsxs as b, jsx as s } from "react/jsx-runtime";
2
+ import { useRef as D, useState as B, useEffect as N } from "react";
3
+ import { SwipeLoadingIcon as U } from "./SwipeLoadingIcon.js";
4
+ import { swipeButtonProgressVariants as _ } from "./swipeButtonProgressVariants.js";
5
+ import { swipeButtonSliderVariants as q } from "./swipeButtonSliderVariants.js";
6
+ import { swipeButtonVariants as G } from "./swipeButtonVariants.js";
7
+ import { useMuzaTranslations as H } from "../../translations/TranslationContext.js";
8
+ import { useDragControls as J } from "../../node_modules/framer-motion/dist/es/gestures/drag/use-drag-controls.js";
9
+ import { useMotionValue as Q } from "../../node_modules/framer-motion/dist/es/value/use-motion-value.js";
10
+ import { useTransform as T } from "../../node_modules/framer-motion/dist/es/value/use-transform.js";
11
+ import { useMotionValueEvent as X } from "../../node_modules/framer-motion/dist/es/utils/use-motion-value-event.js";
12
+ import { animate as u } from "../../node_modules/framer-motion/dist/es/animation/animate/index.js";
12
13
  import { motion as E } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
13
- import { Typography as B } from "../Typography/Typography.js";
14
- import { DoubleArrowRight as G } from "../Icons/CustomIcons.js";
15
- import { cn as x } from "../../utils/cn.js";
16
- import { UnreadOutline as H } from "@solar-icons/react-perf";
17
- const pe = ({
18
- text: I,
19
- successText: O = "success",
20
- loadingText: C = "loading",
14
+ import { Typography as V } from "../Typography/Typography.js";
15
+ import { DoubleArrowRight as Z } from "../Icons/CustomIcons.js";
16
+ import { cn as y } from "../../utils/cn.js";
17
+ import { UnreadOutline as ee } from "@solar-icons/react-perf";
18
+ const ve = ({
19
+ text: z,
20
+ successText: L,
21
+ loadingText: M,
21
22
  variant: w = "primary",
22
- size: s = "md",
23
- fullWidth: M = !1,
23
+ size: o = "md",
24
+ fullWidth: A = !1,
24
25
  loading: t = !1,
25
- success: a = !1,
26
+ success: n = !1,
26
27
  disabled: i = !1,
27
28
  danger: h = !1,
28
- onSwipeComplete: u,
29
+ onSwipeComplete: f,
29
30
  reset: p,
30
- onResetComplete: z,
31
- className: R
31
+ onResetComplete: I,
32
+ className: C
32
33
  }) => {
33
- const T = D(null), l = D(null), d = D(null), [n, j] = V(0), [y, c] = V(!1), v = U(), r = _(0), K = b(r, [0, n], [0, 1]), L = b(r, [0, n * 0.5], [1, 0]), P = b(
34
- K,
34
+ const v = H(), O = L ?? v.swipeButton.successText, R = M ?? v.swipeButton.loadingText, j = v.swipeButton.processingAriaLabel, K = D(null), m = D(null), d = D(null), [a, W] = B(0), [x, l] = B(!1), g = J(), r = Q(0), Y = T(r, [0, a], [0, 1]), k = T(r, [0, a * 0.5], [1, 0]), P = T(
35
+ Y,
35
36
  (e) => `calc(${e}*(100% - var(--slider-size) - 2px) + var(--slider-size))`
36
- ), m = !t && !a && !p || i;
37
+ ), c = !t && !n && !p || i;
37
38
  N(() => {
38
39
  const e = () => {
39
- d.current && l.current && j(
40
- l.current.offsetWidth - d.current.offsetWidth
40
+ d.current && m.current && W(
41
+ m.current.offsetWidth - d.current.offsetWidth
41
42
  );
42
43
  };
43
44
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
44
- }, [d, l, s]), q(r, "change", (e) => {
45
- if (m)
46
- e / n >= 0.9 && !p ? c(!0) : c(!1);
45
+ }, [d, m, o]), X(r, "change", (e) => {
46
+ if (c)
47
+ e / a >= 0.9 && !p ? l(!0) : l(!1);
47
48
  else return;
48
49
  }), N(() => {
49
- y && (f(r, n, {
50
+ x && (u(r, a, {
50
51
  type: "tween",
51
52
  duration: 0.15,
52
53
  ease: "easeOut"
53
- }), v.cancel(), u == null || u());
54
- }, [v, y, n, u, r]), N(() => {
55
- p ? (c(!1), f(r, 0, {
54
+ }), g.cancel(), f == null || f());
55
+ }, [g, x, a, f, r]), N(() => {
56
+ p ? (l(!1), u(r, 0, {
56
57
  type: "tween",
57
58
  duration: 0.25,
58
59
  ease: "easeOut",
59
- onComplete: z
60
- })) : (a || t) && f(r, n, {
60
+ onComplete: I
61
+ })) : (n || t) && u(r, a, {
61
62
  type: "tween",
62
63
  duration: 0.15,
63
64
  ease: "easeOut"
64
65
  });
65
- }, [p, t, n, a, z, r]);
66
- const W = () => {
67
- !m || y || f(r, 0, { type: "tween", duration: 0.25, ease: "easeOut" });
66
+ }, [p, t, a, n, I, r]);
67
+ const $ = () => {
68
+ !c || x || u(r, 0, { type: "tween", duration: 0.25, ease: "easeOut" });
68
69
  };
69
- return /* @__PURE__ */ g(
70
+ return /* @__PURE__ */ b(
70
71
  "button",
71
72
  {
72
- ref: T,
73
+ ref: K,
73
74
  tabIndex: i ? -1 : 0,
74
75
  role: "button",
75
- "aria-label": a ? O : t ? "Processing..." : I,
76
+ "aria-label": n ? O : t ? j : z,
76
77
  "aria-disabled": !!i,
77
78
  "aria-busy": !!t,
78
79
  onKeyDown: (e) => {
79
- m && (e.key === "Enter" || e.key === " ") && (y ? f(r, 0, {
80
+ c && (e.key === "Enter" || e.key === " ") && (x ? u(r, 0, {
80
81
  type: "tween",
81
82
  duration: 0.25,
82
83
  ease: "easeOut",
83
- onComplete: () => c(!1)
84
- }) : c(!0));
84
+ onComplete: () => l(!1)
85
+ }) : l(!0));
85
86
  },
86
87
  "data-danger": h,
87
88
  disabled: i,
88
- className: x(
89
- S({ variant: w, size: s, loading: t, fullWidth: M, disabled: i }),
90
- R
89
+ className: y(
90
+ G({ variant: w, size: o, loading: t, fullWidth: A, disabled: i }),
91
+ C
91
92
  ),
92
93
  style: {
93
- "--slider-size": `calc(var(--spacing-comp-button-h-${s === "md" ? "def" : s}) - 2px - 2*var(--spacing-comp-button-p-xxs))`
94
+ "--slider-size": `calc(var(--spacing-comp-button-h-${o === "md" ? "def" : o}) - 2px - 2*var(--spacing-comp-button-p-xxs))`
94
95
  },
95
96
  children: [
96
- /* @__PURE__ */ o(
97
+ /* @__PURE__ */ s(
97
98
  E.div,
98
99
  {
99
- style: { opacity: a || t ? 1 : L },
100
+ style: { opacity: n || t ? 1 : k },
100
101
  className: "pointer-events-none flex items-center justify-center",
101
- children: /* @__PURE__ */ o(
102
- B,
102
+ children: /* @__PURE__ */ s(
103
+ V,
103
104
  {
104
105
  component: "span",
105
106
  variant: "cta",
106
- size: s === "sm" ? "sm" : "base",
107
+ size: o === "sm" ? "sm" : "base",
107
108
  weight: "medium",
108
109
  className: "relative fix-y-text",
109
110
  fixY: !0,
110
- children: I
111
+ children: z
111
112
  }
112
113
  )
113
114
  }
114
115
  ),
115
- /* @__PURE__ */ g(
116
+ /* @__PURE__ */ b(
116
117
  "div",
117
118
  {
118
- ref: l,
119
+ ref: m,
119
120
  className: "absolute inset-comp-button-p-xxs",
120
121
  children: [
121
- /* @__PURE__ */ o(
122
+ /* @__PURE__ */ s(
122
123
  E.div,
123
124
  {
124
- className: x(
125
+ className: y(
125
126
  "absolute rounded-full",
126
- $({
127
+ _({
127
128
  variant: w,
128
- interactive: m,
129
+ interactive: c,
129
130
  danger: h,
130
131
  disabled: i
131
132
  })
@@ -133,24 +134,24 @@ const pe = ({
133
134
  style: { width: P }
134
135
  }
135
136
  ),
136
- /* @__PURE__ */ g(
137
+ /* @__PURE__ */ b(
137
138
  E.div,
138
139
  {
139
140
  ref: d,
140
- className: x(
141
- F({
141
+ className: y(
142
+ q({
142
143
  variant: w,
143
- interactive: m,
144
+ interactive: c,
144
145
  danger: h
145
146
  })
146
147
  ),
147
148
  style: { x: r, touchAction: "none" },
148
- dragControls: v,
149
- drag: m ? "x" : !1,
150
- dragConstraints: l,
149
+ dragControls: g,
150
+ drag: c ? "x" : !1,
151
+ dragConstraints: m,
151
152
  dragElastic: 0,
152
153
  dragTransition: { power: 0, timeConstant: 0 },
153
- onDragEnd: W,
154
+ onDragEnd: $,
154
155
  animate: { rotate: t ? 360 : 0 },
155
156
  transition: {
156
157
  scale: { type: "tween", duration: 0.2 },
@@ -161,9 +162,9 @@ const pe = ({
161
162
  } : { duration: 0.2 }
162
163
  },
163
164
  children: [
164
- a && /* @__PURE__ */ o(H, { className: "size-icon-small" }),
165
- t && !a && /* @__PURE__ */ o(A, { className: "size-icon-small" }),
166
- !t && !a && /* @__PURE__ */ o(G, { className: "size-icon-small" })
165
+ n && /* @__PURE__ */ s(ee, { className: "size-icon-small" }),
166
+ t && !n && /* @__PURE__ */ s(U, { className: "size-icon-small" }),
167
+ !t && !n && /* @__PURE__ */ s(Z, { className: "size-icon-small" })
167
168
  ]
168
169
  }
169
170
  )
@@ -171,29 +172,29 @@ const pe = ({
171
172
  }
172
173
  ),
173
174
  [
174
- { textContent: C, condition: t },
175
- { textContent: O, condition: a }
175
+ { textContent: R, condition: t },
176
+ { textContent: O, condition: n }
176
177
  ].map(
177
- ({ textContent: e, condition: Y }, k) => e && /* @__PURE__ */ o(
178
- B,
178
+ ({ textContent: e, condition: F }, S) => e && /* @__PURE__ */ s(
179
+ V,
179
180
  {
180
181
  component: "span",
181
182
  variant: "cta",
182
- size: s === "sm" ? "sm" : "base",
183
+ size: o === "sm" ? "sm" : "base",
183
184
  weight: "medium",
184
185
  fixY: !0,
185
- className: x(
186
+ className: y(
186
187
  "pointer-events-none absolute z-10 w-max",
187
188
  "top-[50%] left-[calc(50%-var(--slider-size)/2))]",
188
189
  "translate-x-[-50%] translate-y-[-50%]",
189
190
  "transition-500 opacity-0 transition-opacity",
190
191
  {
191
- "opacity-100": Y
192
+ "opacity-100": F
192
193
  }
193
194
  ),
194
195
  children: e
195
196
  },
196
- k
197
+ S
197
198
  )
198
199
  )
199
200
  ]
@@ -201,5 +202,5 @@ const pe = ({
201
202
  );
202
203
  };
203
204
  export {
204
- pe as SwipeButton
205
+ ve as SwipeButton
205
206
  };
@@ -2,7 +2,7 @@ import { StoryObj } from '@storybook/react-vite';
2
2
  import { SwipeButtonProps } from './SwipeButton';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ text, successText, loadingText, variant, size, fullWidth, loading, success, disabled, danger, onSwipeComplete, reset, onResetComplete, className, }: SwipeButtonProps) => import("react/jsx-runtime").JSX.Element;
5
+ component: ({ text, successText: successTextProp, loadingText: loadingTextProp, variant, size, fullWidth, loading, success, disabled, danger, onSwipeComplete, reset, onResetComplete, className, }: SwipeButtonProps) => import("react/jsx-runtime").JSX.Element;
6
6
  parameters: {
7
7
  layout: string;
8
8
  docs: {
@@ -3,7 +3,7 @@ import * as React from 'react';
3
3
  export declare const typographyVariants: (props?: ({
4
4
  size?: "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl" | "5xl" | "6xl" | "7xl" | "caption" | "base" | "input" | null | undefined;
5
5
  weight?: "bold" | "light" | "regular" | "medium" | null | undefined;
6
- variant?: "body" | "title" | "paragraph" | "cta" | null | undefined;
6
+ variant?: "title" | "body" | "paragraph" | "cta" | null | undefined;
7
7
  uppercase?: boolean | null | undefined;
8
8
  fixY?: boolean | null | undefined;
9
9
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;