@vkzstudio/muza-ui 1.0.40 → 1.0.41

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,35 +1,36 @@
1
- import { jsx as t, jsxs as y } from "react/jsx-runtime";
2
- import u, { forwardRef as k, useId as P, useMemo as _, useRef as N, useEffect as S } from "react";
3
- import { triggerWrapperVariants as B } from "./utils.js";
4
- import { useMuzaTranslations as G } from "../../translations/TranslationContext.js";
5
- import { FormField as L } from "../FormField/FormField.js";
6
- import { Typography as T } from "../Typography/Typography.js";
7
- import { DropdownMenu as U, DropdownMenuTrigger as H, DropdownMenuContent as J, DropdownMenuRadioGroup as K, DropdownMenuRadioItem as Q } from "../DropdownMenu/DropdownMenu.js";
8
- import { AltArrowUpOutline as X } from "@solar-icons/react-perf";
9
- import { cn as Y } from "../../utils/cn.js";
10
- const Z = k(
11
- (I, p) => {
12
- const M = G(), {
13
- label: f,
14
- hint: m,
15
- error: h,
16
- options: i,
17
- onChange: s,
1
+ import { jsx as t, jsxs as M } from "react/jsx-runtime";
2
+ import u, { forwardRef as _, useId as B, useMemo as G, useRef as S, useEffect as T } from "react";
3
+ import { triggerWrapperVariants as L } from "./utils.js";
4
+ import { useMuzaTranslations as U } from "../../translations/TranslationContext.js";
5
+ import { FormField as H } from "../FormField/FormField.js";
6
+ import { Typography as p } from "../Typography/Typography.js";
7
+ import { DropdownMenu as J, DropdownMenuTrigger as K, DropdownMenuContent as Q, DropdownMenuRadioGroup as X, DropdownMenuRadioItem as Y } from "../DropdownMenu/DropdownMenu.js";
8
+ import { AltArrowUpOutline as Z } from "@solar-icons/react-perf";
9
+ import { cn as ee } from "../../utils/cn.js";
10
+ const te = _(
11
+ (z, m) => {
12
+ const f = U(), {
13
+ label: h,
14
+ hint: g,
15
+ error: x,
16
+ options: l,
17
+ onChange: i,
18
18
  value: r,
19
19
  disabled: a,
20
- prefix: g,
21
- size: z,
22
- placeholder: D,
23
- shouldScrollToSelectedOption: x,
24
- collisionPadding: O,
25
- required: b,
26
- disableRequiredAsterisk: W,
27
- labelExtra: A,
28
- infoTooltip: C
29
- } = I, w = D ?? M.select.placeholder, v = P(), V = f ? `${v}-label` : void 0, q = m ? `${v}-hint` : void 0, E = _(() => {
30
- const e = r && i.find((o) => o.value === r);
20
+ prefix: b,
21
+ size: I,
22
+ placeholder: O,
23
+ emptyMessage: D,
24
+ shouldScrollToSelectedOption: w,
25
+ collisionPadding: W,
26
+ required: y,
27
+ disableRequiredAsterisk: A,
28
+ labelExtra: C,
29
+ infoTooltip: V
30
+ } = z, v = O ?? f.select.placeholder, q = D ?? f.select.noOptions, R = B(), E = h ? `${R}-label` : void 0, F = g ? `${R}-hint` : void 0, P = G(() => {
31
+ const e = r && l.find((o) => o.value === r);
31
32
  return e ? typeof e.label != "function" ? /* @__PURE__ */ t(
32
- T,
33
+ p,
33
34
  {
34
35
  size: "input",
35
36
  className: "grow-1 fix-y-text truncate text-left text-comp-select-text-primary",
@@ -38,49 +39,49 @@ const Z = k(
38
39
  children: e.label
39
40
  }
40
41
  ) : e.label : /* @__PURE__ */ t(
41
- T,
42
+ p,
42
43
  {
43
44
  size: "input",
44
45
  className: "grow-1 fix-y-text truncate text-left text-comp-select-text-placeholder",
45
46
  weight: "regular",
46
47
  component: "span",
47
- children: w
48
+ children: v
48
49
  }
49
50
  );
50
- }, [i, r, w]), [l, F] = u.useState(!1), [R, $] = u.useState(0), c = u.useRef(!1), j = N(null), d = N({}), n = (typeof p == "function" ? null : p) ?? j;
51
- return S(() => {
51
+ }, [l, r, v]), [s, $] = u.useState(!1), [N, j] = u.useState(0), c = u.useRef(!1), k = S(null), d = S({}), n = (typeof m == "function" ? null : m) ?? k;
52
+ return T(() => {
52
53
  const e = () => {
53
- n.current && $(n.current.offsetWidth);
54
+ n.current && j(n.current.offsetWidth);
54
55
  };
55
56
  e();
56
57
  const o = new ResizeObserver(e);
57
58
  return n.current && o.observe(n.current), () => {
58
59
  o.disconnect();
59
60
  };
60
- }, [n]), S(() => {
61
+ }, [n]), T(() => {
61
62
  var e;
62
- l && r && d.current[r] && x && ((e = d.current[r]) == null || e.scrollIntoView({ block: "nearest" }));
63
- }, [l, x, r]), /* @__PURE__ */ t(
64
- L,
63
+ s && r && d.current[r] && w && ((e = d.current[r]) == null || e.scrollIntoView({ block: "nearest" }));
64
+ }, [s, w, r]), /* @__PURE__ */ t(
65
+ H,
65
66
  {
66
- label: f,
67
- hint: m,
68
- error: h,
69
- required: b,
70
- disableRequiredAsterisk: W,
71
- labelId: V,
72
- hintId: q,
73
- labelExtra: A,
74
- infoTooltip: C,
67
+ label: h,
68
+ hint: g,
69
+ error: x,
70
+ required: y,
71
+ disableRequiredAsterisk: A,
72
+ labelId: E,
73
+ hintId: F,
74
+ labelExtra: C,
75
+ infoTooltip: V,
75
76
  className: "flex-1",
76
- children: /* @__PURE__ */ y(
77
- U,
77
+ children: /* @__PURE__ */ M(
78
+ J,
78
79
  {
79
80
  onOpenChange: (e) => {
80
- F(e);
81
+ $(e);
81
82
  },
82
83
  children: [
83
- /* @__PURE__ */ t(H, { disabled: a, asChild: !0, children: /* @__PURE__ */ t(
84
+ /* @__PURE__ */ t(K, { disabled: a, asChild: !0, children: /* @__PURE__ */ t(
84
85
  "button",
85
86
  {
86
87
  ref: n,
@@ -88,23 +89,23 @@ const Z = k(
88
89
  role: "input",
89
90
  tabIndex: 0,
90
91
  disabled: a,
91
- "aria-required": b,
92
- className: B({ size: z, error: h, expanded: l }),
93
- children: /* @__PURE__ */ y("div", { className: "flex min-w-0 flex-1 items-center gap-sm", children: [
94
- g && /* @__PURE__ */ t(
92
+ "aria-required": y,
93
+ className: L({ size: I, error: x, expanded: s }),
94
+ children: /* @__PURE__ */ M("div", { className: "flex min-w-0 flex-1 items-center gap-sm", children: [
95
+ b && /* @__PURE__ */ t(
95
96
  "span",
96
97
  {
97
98
  className: a ? "text-comp-select-icon-disabled" : "text-comp-select-icon-brand-def",
98
- children: g
99
+ children: b
99
100
  }
100
101
  ),
101
- E,
102
+ P,
102
103
  /* @__PURE__ */ t(
103
- X,
104
+ Z,
104
105
  {
105
- className: Y(
106
+ className: ee(
106
107
  "transition-transform duration-200",
107
- l ? "rotate-0" : "rotate-180"
108
+ s ? "rotate-0" : "rotate-180"
108
109
  )
109
110
  }
110
111
  )
@@ -112,25 +113,34 @@ const Z = k(
112
113
  }
113
114
  ) }),
114
115
  /* @__PURE__ */ t(
115
- J,
116
+ Q,
116
117
  {
117
118
  className: "mt-1",
118
119
  style: {
119
- width: R > 0 ? `${R}px` : void 0
120
+ width: N > 0 ? `${N}px` : void 0
120
121
  },
121
122
  onCloseAutoFocus: (e) => {
122
123
  c.current || e.preventDefault(), c.current = !1;
123
124
  },
124
- collisionPadding: O,
125
- children: /* @__PURE__ */ t(
126
- K,
125
+ collisionPadding: W,
126
+ children: l.length === 0 ? /* @__PURE__ */ t("div", { className: "px-lg py-md", role: "presentation", children: /* @__PURE__ */ t(
127
+ p,
128
+ {
129
+ component: "span",
130
+ size: "input",
131
+ weight: "regular",
132
+ className: "text-comp-select-text-secondary",
133
+ children: q
134
+ }
135
+ ) }) : /* @__PURE__ */ t(
136
+ X,
127
137
  {
128
138
  value: r,
129
139
  onValueChange: (e) => {
130
- c.current = !0, s == null || s(e);
140
+ c.current = !0, i == null || i(e);
131
141
  },
132
- children: i.map((e) => /* @__PURE__ */ t(
133
- Q,
142
+ children: l.map((e) => /* @__PURE__ */ t(
143
+ Y,
134
144
  {
135
145
  value: e.value.toString(),
136
146
  disabled: e.disabled,
@@ -153,7 +163,7 @@ const Z = k(
153
163
  );
154
164
  }
155
165
  );
156
- Z.displayName = "Select";
166
+ te.displayName = "Select";
157
167
  export {
158
- Z as Select
168
+ te as Select
159
169
  };
@@ -15,4 +15,5 @@ export declare const Interactive: Story;
15
15
  export declare const WithPrefix: Story;
16
16
  export declare const WithIconsInOptions: Story;
17
17
  export declare const WithDisabledOptions: Story;
18
+ export declare const NoOptions: Story;
18
19
  //# sourceMappingURL=Select.stories.d.ts.map
@@ -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;AAS3D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAgH7B,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,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"}
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;AAS3D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAsH7B,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,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,SAAS,EAAE,KAqBvB,CAAA"}