@vkzstudio/muza-ui 1.9.1 → 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"RatingBlock.d.ts","sourceRoot":"","sources":["../../../src/components/RatingBlock/RatingBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAW9B;;GAEG;AACH,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC9D,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAA;IACb;;;;;;;OAOG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uFAAuF;IACvF,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACvC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAA;IAC9C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,WAAW,yFAwFhB,CAAA;AAGD,OAAO,EAAE,WAAW,EAAE,CAAA"}
1
+ {"version":3,"file":"RatingBlock.d.ts","sourceRoot":"","sources":["../../../src/components/RatingBlock/RatingBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAW9B;;GAEG;AACH,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC9D,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAA;IACb;;;;;;;OAOG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,uFAAuF;IACvF,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACvC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAA;IAC9C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,QAAA,MAAM,WAAW,yFA8FhB,CAAA;AAGD,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -1,4 +1,4 @@
1
- import { jsxs as c, jsx as o } from "react/jsx-runtime";
1
+ import { jsxs as l, jsx as o } from "react/jsx-runtime";
2
2
  import * as n from "react";
3
3
  import { useMuzaTranslationContext as b } from "../../translations/TranslationContext.js";
4
4
  import { resolvePluralTemplate as M } from "../../translations/resolvePluralTemplate.js";
@@ -6,37 +6,37 @@ import { cn as p } from "../../utils/cn.js";
6
6
  import { Card as B } from "../Card/Card.js";
7
7
  import { Flex as C } from "../Flex/Flex.js";
8
8
  import { Rating as z } from "../Rating/Rating.js";
9
- import { Typography as u } from "../Typography/Typography.js";
9
+ import { Typography as d } from "../Typography/Typography.js";
10
10
  const T = n.forwardRef(
11
11
  ({
12
- value: i,
13
- reviewsCount: d,
12
+ value: m,
13
+ reviewsCount: u,
14
14
  starCount: f = 5,
15
15
  allowHalf: x = !1,
16
16
  formatValue: e,
17
- numberFormatOptions: m,
17
+ numberFormatOptions: i,
18
18
  countText: g,
19
- emptyText: h,
20
- className: k,
19
+ emptyText: k,
20
+ className: h,
21
21
  ...y
22
22
  }, v) => {
23
- const { locale: t, translations: s } = b(), r = Math.max(0, Math.floor(d)), a = r === 0, l = n.useMemo(() => {
23
+ const { locale: t, translations: s } = b(), r = Math.max(0, Math.floor(u)), a = r === 0, c = n.useMemo(() => {
24
24
  if (e) return e;
25
25
  const N = new Intl.NumberFormat(t, {
26
26
  minimumFractionDigits: 1,
27
27
  maximumFractionDigits: 1,
28
- ...m
28
+ ...i
29
29
  });
30
30
  return (R) => N.format(R);
31
- }, [e, t, m])(a ? 0 : i), w = n.useMemo(
31
+ }, [e, t, i])(a ? 0 : m), w = n.useMemo(
32
32
  () => new Intl.NumberFormat(t).format(r),
33
33
  [t, r]
34
- ), F = a ? h ?? s.ratingBlock.empty : (g ?? M(
34
+ ), F = a ? k ?? s.ratingBlock.empty : (g ?? M(
35
35
  r,
36
36
  t,
37
37
  s.ratingBlock.users
38
38
  )).replace("{count}", w);
39
- return /* @__PURE__ */ c(
39
+ return /* @__PURE__ */ l(
40
40
  B,
41
41
  {
42
42
  ref: v,
@@ -44,11 +44,14 @@ const T = n.forwardRef(
44
44
  direction: "row",
45
45
  align: "center",
46
46
  gap: "xl",
47
- className: p("w-full", k),
47
+ className: p(
48
+ "w-full rounded-xl px-comp-market-card-p-ver py-comp-market-card-p-hor",
49
+ h
50
+ ),
48
51
  ...y,
49
52
  children: [
50
53
  /* @__PURE__ */ o(
51
- u,
54
+ d,
52
55
  {
53
56
  component: "span",
54
57
  variant: "title",
@@ -57,21 +60,21 @@ const T = n.forwardRef(
57
60
  className: p("text-text-dark-primary-def", {
58
61
  "text-text-dark-disabled": a
59
62
  }),
60
- children: l
63
+ children: c
61
64
  }
62
65
  ),
63
- /* @__PURE__ */ c(C, { direction: "column", align: "start", gap: "2xs", children: [
66
+ /* @__PURE__ */ l(C, { direction: "column", align: "start", gap: "2xs", children: [
64
67
  /* @__PURE__ */ o(
65
68
  z,
66
69
  {
67
- value: a ? 0 : i,
70
+ value: a ? 0 : m,
68
71
  count: f,
69
72
  allowHalf: x,
70
- "aria-label": l
73
+ "aria-label": c
71
74
  }
72
75
  ),
73
76
  /* @__PURE__ */ o(
74
- u,
77
+ d,
75
78
  {
76
79
  component: "span",
77
80
  variant: "body",
@@ -27,6 +27,32 @@ export interface ISelectOption {
27
27
  * @see ISelectOption
28
28
  */
29
29
  export interface ISelectProps {
30
+ /**
31
+ * `id` set on the trigger button, and the prefix of the generated label and hint
32
+ * ids. An external `<label htmlFor>` pointing at it forwards clicks to the trigger,
33
+ * but does not name it — a `<button>` takes its accessible name from
34
+ * `aria-labelledby`, `aria-label` or its own content, so pass `aria-labelledby`
35
+ * as well to label the select from outside.
36
+ * @default a generated id
37
+ */
38
+ id?: string;
39
+ /**
40
+ * Id(s) of element(s) labelling the trigger. Merged with the internal `label` id
41
+ * when both are present, so an external label can be added without losing the
42
+ * built-in one.
43
+ *
44
+ * @example
45
+ * ```tsx
46
+ * <span id="country-label">Country</span>
47
+ * <Select aria-labelledby="country-label" options={options} />
48
+ * ```
49
+ */
50
+ 'aria-labelledby'?: string;
51
+ /**
52
+ * Id(s) of element(s) describing the trigger — an external tooltip or help text.
53
+ * Merged with the internal `hint` id when both are present.
54
+ */
55
+ 'aria-describedby'?: string;
30
56
  /** Label text rendered above the trigger by `FormField`. */
31
57
  label?: string;
32
58
  /** Helper text rendered below the trigger. Switches to the error color when `error` is `true`. */
@@ -1 +1 @@
1
- {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../src/components/Select/Select.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AAcd;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAA;IACb,wFAAwF;IACxF,KAAK,EAAE,SAAS,CAAA;IAChB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,SAAS,CAAA;IACvB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iEAAiE;IACjE,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB;AAED;;;;GAIG;AACH,MA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AC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,gFAAgF;IAChF,4BAA4B,CAAC,EAAE,OAAO,CAAA;IACtC,oHAAoH;IACpH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,6HAA6H;IAC7H,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,sGAAsG;IACtG,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,eAAO,MAAM,MAAM,wFAyOlB,CAAA"}
@@ -1,34 +1,37 @@
1
- import { jsx as t, jsxs as N } from "react/jsx-runtime";
2
- import u, { forwardRef as B, useId as G, useMemo as L, useRef as z, useEffect as S } from "react";
3
- import { useMuzaTranslations as H } from "../../translations/TranslationContext.js";
4
- import { DropdownMenu as J, DropdownMenuTrigger as K, DropdownMenuContent as Q, DropdownMenuRadioGroup as U, DropdownMenuRadioItem as X } from "../DropdownMenu/DropdownMenu.js";
5
- import { Flex as Y } from "../Flex/Flex.js";
6
- import { FormField as Z } from "../FormField/FormField.js";
7
- import { Typography as l } from "../Typography/Typography.js";
8
- import { SelectTrigger as ee } from "./SelectTrigger.js";
9
- const te = B(
10
- (T, p) => {
11
- const m = H(), {
12
- label: f,
13
- hint: h,
14
- error: g,
1
+ import { jsx as t, jsxs as S } from "react/jsx-runtime";
2
+ import p, { forwardRef as U, useId as X, useMemo as Y, useRef as T, useEffect as D } from "react";
3
+ import { useMuzaTranslations as Z } from "../../translations/TranslationContext.js";
4
+ import { DropdownMenu as ee, DropdownMenuTrigger as te, DropdownMenuContent as re, DropdownMenuRadioGroup as ne, DropdownMenuRadioItem as ie } from "../DropdownMenu/DropdownMenu.js";
5
+ import { Flex as le } from "../Flex/Flex.js";
6
+ import { FormField as oe } from "../FormField/FormField.js";
7
+ import { Typography as o } from "../Typography/Typography.js";
8
+ import { SelectTrigger as ae } from "./SelectTrigger.js";
9
+ const se = U(
10
+ (B, m) => {
11
+ const f = Z(), {
12
+ id: F,
13
+ "aria-labelledby": j,
14
+ "aria-describedby": C,
15
+ label: h,
16
+ hint: g,
17
+ error: b,
15
18
  options: s,
16
19
  onChange: c,
17
20
  value: n,
18
21
  disabled: x,
19
- prefix: D,
20
- size: I,
21
- placeholder: C,
22
- emptyMessage: F,
23
- shouldScrollToSelectedOption: b,
24
- collisionPadding: O,
25
- required: y,
26
- disableRequiredAsterisk: W,
27
- labelExtra: q,
28
- infoTooltip: E
29
- } = T, v = C ?? m.select.placeholder, P = F ?? m.select.noOptions, w = G(), V = f ? `${w}-label` : void 0, $ = h ? `${w}-hint` : void 0, r = n ? s.find((e) => e.value === n) : void 0, j = L(() => r ? r.description ? /* @__PURE__ */ N(Y, { flex: 1, direction: "column", className: "min-w-0 text-left", children: [
22
+ prefix: O,
23
+ size: W,
24
+ placeholder: q,
25
+ emptyMessage: E,
26
+ shouldScrollToSelectedOption: y,
27
+ collisionPadding: P,
28
+ required: v,
29
+ disableRequiredAsterisk: V,
30
+ labelExtra: $,
31
+ infoTooltip: k
32
+ } = B, w = q ?? f.select.placeholder, A = E ?? f.select.noOptions, L = X(), i = F ?? L, R = h ? `${i}-label` : void 0, M = g ? `${i}-hint` : void 0, N = [R, j].filter(Boolean), _ = N.length ? [...N, i].join(" ") : void 0, G = [M, C].filter(Boolean).join(" ") || void 0, r = n ? s.find((e) => e.value === n) : void 0, H = Y(() => r ? r.description ? /* @__PURE__ */ S(le, { flex: 1, direction: "column", className: "min-w-0 text-left", children: [
30
33
  /* @__PURE__ */ t(
31
- l,
34
+ o,
32
35
  {
33
36
  size: "sm",
34
37
  variant: "title",
@@ -39,7 +42,7 @@ const te = B(
39
42
  }
40
43
  ),
41
44
  /* @__PURE__ */ t(
42
- l,
45
+ o,
43
46
  {
44
47
  size: "sm",
45
48
  variant: "body",
@@ -50,7 +53,7 @@ const te = B(
50
53
  }
51
54
  )
52
55
  ] }) : typeof r.label != "function" ? /* @__PURE__ */ t(
53
- l,
56
+ o,
54
57
  {
55
58
  size: "input",
56
59
  className: "grow-1 fix-y-text truncate text-left text-comp-select-text-primary",
@@ -59,99 +62,104 @@ const te = B(
59
62
  children: r.label
60
63
  }
61
64
  ) : r.label : /* @__PURE__ */ t(
62
- l,
65
+ o,
63
66
  {
64
67
  size: "input",
65
68
  className: "grow-1 fix-y-text truncate text-left text-comp-select-text-placeholder",
66
69
  weight: "regular",
67
70
  component: "span",
68
- children: v
71
+ children: w
69
72
  }
70
- ), [r, v]), [R, k] = u.useState(!1), [M, A] = u.useState(0), a = u.useRef(!1), _ = z(null), d = z({}), i = (typeof p == "function" ? null : p) ?? _;
71
- return S(() => {
73
+ ), [r, w]), [z, J] = p.useState(!1), [I, K] = p.useState(0), d = p.useRef(!1), Q = T(null), u = T({}), l = (typeof m == "function" ? null : m) ?? Q;
74
+ return D(() => {
72
75
  const e = () => {
73
- i.current && A(i.current.offsetWidth);
76
+ l.current && K(l.current.offsetWidth);
74
77
  };
75
78
  e();
76
- const o = new ResizeObserver(e);
77
- return i.current && o.observe(i.current), () => {
78
- o.disconnect();
79
+ const a = new ResizeObserver(e);
80
+ return l.current && a.observe(l.current), () => {
81
+ a.disconnect();
79
82
  };
80
- }, [i]), S(() => {
83
+ }, [l]), D(() => {
81
84
  var e;
82
- R && n && d.current[n] && b && ((e = d.current[n]) == null || e.scrollIntoView({ block: "nearest" }));
83
- }, [R, b, n]), /* @__PURE__ */ t(
84
- Z,
85
+ z && n && u.current[n] && y && ((e = u.current[n]) == null || e.scrollIntoView({ block: "nearest" }));
86
+ }, [z, y, n]), /* @__PURE__ */ t(
87
+ oe,
85
88
  {
86
- label: f,
87
- hint: h,
88
- error: g,
89
- required: y,
90
- disableRequiredAsterisk: W,
91
- labelId: V,
92
- hintId: $,
93
- labelExtra: q,
94
- infoTooltip: E,
89
+ label: h,
90
+ hint: g,
91
+ error: b,
92
+ required: v,
93
+ disableRequiredAsterisk: V,
94
+ htmlFor: i,
95
+ labelId: R,
96
+ hintId: M,
97
+ labelExtra: $,
98
+ infoTooltip: k,
95
99
  className: "flex-1",
96
- children: /* @__PURE__ */ N(
97
- J,
100
+ children: /* @__PURE__ */ S(
101
+ ee,
98
102
  {
99
103
  onOpenChange: (e) => {
100
- k(e);
104
+ J(e);
101
105
  },
102
106
  children: [
103
- /* @__PURE__ */ t(K, { disabled: x, asChild: !0, children: /* @__PURE__ */ t(
104
- ee,
107
+ /* @__PURE__ */ t(te, { disabled: x, asChild: !0, children: /* @__PURE__ */ t(
108
+ ae,
105
109
  {
106
- ref: i,
110
+ ref: l,
107
111
  role: "input",
108
112
  tabIndex: 0,
109
113
  disabled: x,
110
- "aria-required": y,
111
- size: I,
112
- error: g,
113
- prefix: D,
114
+ id: i,
115
+ "aria-labelledby": _,
116
+ "aria-describedby": G,
117
+ "aria-required": v,
118
+ size: W,
119
+ error: b,
120
+ prefix: O,
114
121
  hasDescription: !!(r != null && r.description),
115
- children: j
122
+ children: H
116
123
  }
117
124
  ) }),
118
125
  /* @__PURE__ */ t(
119
- Q,
126
+ re,
120
127
  {
128
+ "aria-labelledby": i,
121
129
  className: "mt-1",
122
130
  style: {
123
- width: M > 0 ? `${M}px` : void 0
131
+ width: I > 0 ? `${I}px` : void 0
124
132
  },
125
133
  align: "center",
126
134
  onCloseAutoFocus: (e) => {
127
- a.current || e.preventDefault(), a.current = !1;
135
+ d.current || e.preventDefault(), d.current = !1;
128
136
  },
129
- collisionPadding: O,
137
+ collisionPadding: P,
130
138
  children: s.length === 0 ? /* @__PURE__ */ t("div", { className: "px-lg py-md", role: "presentation", children: /* @__PURE__ */ t(
131
- l,
139
+ o,
132
140
  {
133
141
  component: "span",
134
142
  size: "input",
135
143
  weight: "regular",
136
144
  className: "text-comp-select-text-secondary",
137
- children: P
145
+ children: A
138
146
  }
139
147
  ) }) : /* @__PURE__ */ t(
140
- U,
148
+ ne,
141
149
  {
142
150
  value: n,
143
151
  onValueChange: (e) => {
144
- a.current = !0, c == null || c(e);
152
+ d.current = !0, c == null || c(e);
145
153
  },
146
154
  children: s.map((e) => /* @__PURE__ */ t(
147
- X,
155
+ ie,
148
156
  {
149
157
  value: e.value.toString(),
150
158
  disabled: e.disabled,
151
159
  icon: e.icon,
152
160
  description: e.description,
153
- ref: (o) => {
154
- d.current[e.value] = o;
161
+ ref: (a) => {
162
+ u.current[e.value] = a;
155
163
  },
156
164
  children: e.label
157
165
  },
@@ -168,7 +176,7 @@ const te = B(
168
176
  );
169
177
  }
170
178
  );
171
- te.displayName = "Select";
179
+ se.displayName = "Select";
172
180
  export {
173
- te as Select
181
+ se as Select
174
182
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Select.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Select/Select.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAU3D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAsI7B,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAA;AA6BpC,eAAO,MAAM,OAAO,EAAE,KAwBrB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KA2BvB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KA0B9B,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KA0BvB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAwB/B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KA0BtB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KA0BtB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KA6DtB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KA0C7B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAgCzB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAyBxB,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,KAqDhC,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KAkCjC,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KAoDrB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAqBvB,CAAA"}
1
+ {"version":3,"file":"Select.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Select/Select.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAU3D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAwJ7B,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,MAAM,CAAC,CAAA;AA6BpC,eAAO,MAAM,OAAO,EAAE,KAwBrB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KA2BvB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KA0B9B,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KA0BvB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAwB/B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KA0BtB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KA0BtB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KA6DtB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KA0C7B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAgCzB,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAyBxB,CAAA;AAED,eAAO,MAAM,kBAAkB,EAAE,KAqDhC,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KAkCjC,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KAoDrB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAqBvB,CAAA"}
@@ -44,7 +44,12 @@ declare const Tooltip: ({ openOnClick, open: openProp, defaultOpen, onOpenChange
44
44
  /** Props for the TooltipTrigger. Element that displays the tooltip on hover/focus, or on click/tap when the root opts in via `openOnClick`. Use `asChild` for custom elements. */
45
45
  export type TooltipTriggerProps = React.ComponentProps<typeof TooltipPrimitive.Trigger>;
46
46
  declare const TooltipTrigger: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
47
- /** Props for the TooltipContent. Styled floating container with positioning and animations. */
47
+ /**
48
+ * Props for the TooltipContent. Styled floating container with positioning and
49
+ * animations. Short text sizes the bubble to itself, long text wraps at the
50
+ * design system's maximum tooltip width; pass a `max-w-*` class via `className`
51
+ * to override that cap for a single tooltip.
52
+ */
48
53
  export interface TooltipContentProps extends React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> {
49
54
  /** Preferred side of the trigger to render against. @default 'top' */
50
55
  side?: 'top' | 'right' | 'bottom' | 'left';
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAA;AA+C3D,+FAA+F;AAC/F,MAAM,WAAW,oBACf,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,QAAQ,CAAC;IACxE,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,yFAAyF;IACzF,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,4FAA4F;IAC5F,uBAAuB,CAAC,EAAE,OAAO,CAAA;CAClC;AAED,QAAA,MAAM,eAAe,GAAI,cAAc,oBAAoB,4CAE1D,CAAA;AAED,uEAAuE;AACvE,MAAM,WAAW,YACf,SAAQ,KAAK,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC;IAC1D,4CAA4C;IAC5C,IAAI,CAAC,EAAE,OAAO,CAA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O,GAAG,QAAQ,GAAG,MAAM,CAAA;IAC1C,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,iEAAiE;IACjE,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAA;IAClC,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,QAAA,MAAM,cAAc,4FA0EnB,CAAA;AAGD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,CAAA"}
@@ -1,8 +1,8 @@
1
1
  import { jsx as u, jsxs as N } from "react/jsx-runtime";
2
2
  import * as e from "react";
3
3
  import * as g from "@radix-ui/react-tooltip";
4
- import { useMuzaTranslationContext as D } from "../../translations/TranslationContext.js";
5
- import { cn as w } from "../../utils/cn.js";
4
+ import { useMuzaTranslationContext as w } from "../../translations/TranslationContext.js";
5
+ import { cn as D } from "../../utils/cn.js";
6
6
  import { XClose as C } from "../Icons/CustomIcons.js";
7
7
  import { Typography as j } from "../Typography/Typography.js";
8
8
  const M = () => {
@@ -24,13 +24,13 @@ const M = () => {
24
24
  }) => {
25
25
  const [T, p] = e.useState(
26
26
  b ?? !1
27
- ), [s, n] = e.useState(!1), i = a !== void 0, l = i ? a : T, t = r === "touch", f = r === !0 || t && s, m = e.useRef(f);
27
+ ), [i, n] = e.useState(!1), s = a !== void 0, l = s ? a : T, t = r === "touch", f = r === !0 || t && i, m = e.useRef(f);
28
28
  m.current = f;
29
29
  const h = e.useRef(null), d = e.useCallback(
30
30
  (y) => {
31
- i || p(y), o == null || o(y);
31
+ s || p(y), o == null || o(y);
32
32
  },
33
- [i, o]
33
+ [s, o]
34
34
  ), v = e.useCallback(() => {
35
35
  m.current = !0, n(!0);
36
36
  }, []), k = e.useCallback(
@@ -65,14 +65,14 @@ const M = () => {
65
65
  detectTouch: x,
66
66
  clickModeRef: T,
67
67
  open: p,
68
- setOpen: s,
68
+ setOpen: i,
69
69
  onTouchDetected: n,
70
- triggerRef: i
70
+ triggerRef: s
71
71
  } = e.useContext(R), l = e.useCallback(
72
72
  (t) => {
73
- i.current = t, typeof o == "function" ? o(t) : o && (o.current = t);
73
+ s.current = t, typeof o == "function" ? o(t) : o && (o.current = t);
74
74
  },
75
- [o, i]
75
+ [o, s]
76
76
  );
77
77
  return /* @__PURE__ */ u(
78
78
  g.Trigger,
@@ -83,7 +83,7 @@ const M = () => {
83
83
  a == null || a(t), x && t.pointerType === "touch" && n();
84
84
  },
85
85
  onClick: (t) => {
86
- r == null || r(t), T.current && s(!p);
86
+ r == null || r(t), T.current && i(!p);
87
87
  },
88
88
  ...b
89
89
  }
@@ -100,31 +100,31 @@ const O = e.forwardRef(
100
100
  "aria-label": x,
101
101
  ...T
102
102
  }, p) => {
103
- const { clickMode: s, setOpen: n, triggerRef: i } = e.useContext(R), { translations: l } = D(), t = o ?? l.tooltip.closeAriaLabel, f = x ?? (s && typeof a == "string" ? a : void 0);
103
+ const { clickMode: i, setOpen: n, triggerRef: s } = e.useContext(R), { translations: l } = w(), t = o ?? l.tooltip.closeAriaLabel, f = x ?? (i && typeof a == "string" ? a : void 0);
104
104
  return /* @__PURE__ */ N(
105
105
  g.Content,
106
106
  {
107
107
  ref: p,
108
108
  sideOffset: b,
109
109
  "aria-label": f,
110
- className: w(
111
- "relative z-50 origin-[--radix-tooltip-content-transform-origin] animate-in overflow-hidden rounded-comp-tooltip-radius bg-surface-brand-brand-tertiary py-comp-tooltip-p-ver text-text-brand-def fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
110
+ className: D(
111
+ "relative z-50 max-w-comp-tooltip-w-max origin-[--radix-tooltip-content-transform-origin] animate-in overflow-hidden rounded-comp-tooltip-radius bg-surface-brand-brand-tertiary py-comp-tooltip-p-ver text-text-brand-def fade-in-0 zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",
112
112
  // Click mode reserves extra right padding for the close button.
113
- s ? "pr-comp-tooltip-p-right pl-comp-tooltip-p-left" : "px-comp-tooltip-p-left",
113
+ i ? "pr-comp-tooltip-p-right pl-comp-tooltip-p-left" : "px-comp-tooltip-p-left",
114
114
  r
115
115
  ),
116
116
  ...T,
117
- ...s && {
117
+ ...i && {
118
118
  onEscapeKeyDown: () => n(!1),
119
119
  onPointerDownOutside: (m) => {
120
120
  var d;
121
121
  const h = m.detail.originalEvent.target;
122
- h && ((d = i.current) != null && d.contains(h)) || n(!1);
122
+ h && ((d = s.current) != null && d.contains(h)) || n(!1);
123
123
  }
124
124
  },
125
125
  children: [
126
126
  /* @__PURE__ */ u(j, { component: "span", variant: "body", weight: "regular", size: "sm", children: a }),
127
- s && /* @__PURE__ */ u(
127
+ i && /* @__PURE__ */ u(
128
128
  "button",
129
129
  {
130
130
  type: "button",
@@ -5,6 +5,7 @@ export default meta;
5
5
  type Story = StoryObj<typeof Tooltip>;
6
6
  export declare const DefaultTooltipComponent: Story;
7
7
  export declare const OpenState: Story;
8
+ export declare const AvailableWidth: Story;
8
9
  export declare const OpenOnTouch: Story;
9
10
  export declare const OpenOnClick: Story;
10
11
  export declare const PrefferedSideBottom: Story;
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAK3D,OAAO,EACL,OAAO,EAIR,MAAM,WAAW,CAAA;AAElB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,OAAO,CAwD9B,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,OAAO,CAAC,CAAA;AAErC,eAAO,MAAM,uBAAuB,EAAE,KAqBrC,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAsBvB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAsBzB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAkCzB,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KAsBjC,CAAA"}
1
+ {"version":3,"file":"Tooltip.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Tooltip/Tooltip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAK3D,OAAO,EACL,OAAO,EAIR,MAAM,WAAW,CAAA;AAElB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,OAAO,CA0D9B,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,OAAO,CAAC,CAAA;AAErC,eAAO,MAAM,uBAAuB,EAAE,KAqBrC,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAsBvB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAwB5B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAsBzB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAkCzB,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KAsBjC,CAAA"}