@vkzstudio/muza-ui 1.0.17 → 1.0.18

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 (49) hide show
  1. package/dist/components/Button/buttonVariants.js +1 -1
  2. package/dist/components/Checkbox/Checkbox.d.ts +4 -0
  3. package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
  4. package/dist/components/Checkbox/Checkbox.js +36 -29
  5. package/dist/components/Checkbox/Checkbox.stories.d.ts +1 -0
  6. package/dist/components/Checkbox/Checkbox.stories.d.ts.map +1 -1
  7. package/dist/components/DatePicker/DatePicker.d.ts +2 -0
  8. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
  9. package/dist/components/DatePicker/DatePicker.js +33 -31
  10. package/dist/components/FileUpload/FileUpload.d.ts +6 -2
  11. package/dist/components/FileUpload/FileUpload.d.ts.map +1 -1
  12. package/dist/components/FileUpload/FileUpload.js +141 -135
  13. package/dist/components/FileUpload/FileUpload.stories.d.ts +2 -0
  14. package/dist/components/FileUpload/FileUpload.stories.d.ts.map +1 -1
  15. package/dist/components/Flex/Flex.d.ts +3 -1
  16. package/dist/components/Flex/Flex.d.ts.map +1 -1
  17. package/dist/components/Flex/Flex.js +33 -31
  18. package/dist/components/FormField/FormField.d.ts +30 -0
  19. package/dist/components/FormField/FormField.d.ts.map +1 -0
  20. package/dist/components/FormField/FormField.js +56 -0
  21. package/dist/components/FormField/InputHint.d.ts +13 -0
  22. package/dist/components/FormField/InputHint.d.ts.map +1 -0
  23. package/dist/components/FormField/InputHint.js +26 -0
  24. package/dist/components/FormField/InputLabel.d.ts +20 -0
  25. package/dist/components/FormField/InputLabel.d.ts.map +1 -0
  26. package/dist/components/FormField/InputLabel.js +27 -0
  27. package/dist/components/FormField/index.d.ts +4 -0
  28. package/dist/components/FormField/index.d.ts.map +1 -0
  29. package/dist/components/Input/Input.d.ts.map +1 -1
  30. package/dist/components/Input/Input.js +79 -94
  31. package/dist/components/MultiSelect/MultiSelect.d.ts +2 -0
  32. package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  33. package/dist/components/MultiSelect/MultiSelect.js +125 -131
  34. package/dist/components/Radio/Radio.js +1 -1
  35. package/dist/components/Select/Select.d.ts +2 -0
  36. package/dist/components/Select/Select.d.ts.map +1 -1
  37. package/dist/components/Select/Select.js +126 -131
  38. package/dist/components/TextEditor/TextEditor.d.ts +4 -0
  39. package/dist/components/TextEditor/TextEditor.d.ts.map +1 -1
  40. package/dist/components/TextEditor/TextEditor.js +113 -135
  41. package/dist/components/Textarea/Textarea.d.ts +4 -0
  42. package/dist/components/Textarea/Textarea.d.ts.map +1 -1
  43. package/dist/components/Textarea/Textarea.js +52 -61
  44. package/dist/components/Textarea/Textarea.stories.d.ts +1 -0
  45. package/dist/components/Textarea/Textarea.stories.d.ts.map +1 -1
  46. package/dist/components/TimePicker/TimePicker.d.ts +2 -0
  47. package/dist/components/TimePicker/TimePicker.d.ts.map +1 -1
  48. package/dist/muza-ui.css +1 -1
  49. package/package.json +1 -1
@@ -0,0 +1,4 @@
1
+ export { FormField, type FormFieldProps } from './FormField';
2
+ export { InputLabel, type InputLabelProps } from './InputLabel';
3
+ export { InputHint, type InputHintProps } from './InputHint';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FormField/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../src/components/Input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,SAAS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AE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC,EAC1E,YAAY,CAAC,OAAO,oBAAoB,CAAC;IAC3C,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,MAAM,CAAA;IACxD;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAC3B;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,uEAAuE;IACvE,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,wEAAwE;IACxE,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,KAAK,sHA0IjB,CAAA"}
@@ -1,6 +1,6 @@
1
- import { jsxs as h, jsx as a } from "react/jsx-runtime";
2
- import { forwardRef as W, useId as $, useRef as A, useEffect as w } from "react";
3
- import { cva as C } from "class-variance-authority";
1
+ import { jsx as c, jsxs as j } from "react/jsx-runtime";
2
+ import { forwardRef as z, useId as W, useRef as $, useEffect as y } from "react";
3
+ import { cva as A } from "class-variance-authority";
4
4
  import "../../node_modules/imask/esm/index.js";
5
5
  import "../../node_modules/imask/esm/controls/input.js";
6
6
  import "../../node_modules/imask/esm/masked/factory.js";
@@ -10,11 +10,12 @@ import "../../node_modules/imask/esm/controls/html-mask-element.js";
10
10
  import "../../node_modules/imask/esm/controls/html-contenteditable-mask-element.js";
11
11
  import "../../node_modules/imask/esm/controls/input-history.js";
12
12
  import "../../node_modules/react-imask/esm/input.js";
13
- import E from "../../node_modules/react-imask/esm/hook.js";
13
+ import C from "../../node_modules/react-imask/esm/hook.js";
14
14
  import "../../node_modules/react-imask/esm/mixin.js";
15
- import { Typography as I, typographyVariants as F } from "../Typography/Typography.js";
16
- import { cn as s } from "../../utils/cn.js";
17
- const M = C(
15
+ import { FormField as E } from "../FormField/FormField.js";
16
+ import { cn as u } from "../../utils/cn.js";
17
+ import { typographyVariants as M } from "../Typography/Typography.js";
18
+ const T = A(
18
19
  [
19
20
  "rounded-full border border-comp-input-stroke-def",
20
21
  "bg-comp-input-fill-def transition-colors",
@@ -39,8 +40,8 @@ const M = C(
39
40
  error: !1
40
41
  }
41
42
  }
42
- ), U = (d) => s(
43
- F({
43
+ ), U = (d) => u(
44
+ M({
44
45
  size: d === "sm" ? "input" : "base",
45
46
  weight: "medium",
46
47
  fixY: !0
@@ -50,24 +51,24 @@ const M = C(
50
51
  "placeholder:font-regular",
51
52
  "disabled:cursor-not-allowed",
52
53
  "w-full"
53
- ), Y = W(
54
+ ), Y = z(
54
55
  ({
55
56
  className: d,
56
- type: N = "text",
57
- prefix: b,
58
- suffix: x,
59
- label: l,
60
- hint: u,
61
- size: g,
62
- error: m,
57
+ type: w = "text",
58
+ prefix: m,
59
+ suffix: f,
60
+ label: b,
61
+ hint: h,
62
+ size: x,
63
+ error: s,
63
64
  mask: i,
64
- onChange: p,
65
- id: z,
66
- required: f,
67
- disableRequiredAsterisk: R,
65
+ onChange: a,
66
+ id: I,
67
+ required: l,
68
+ disableRequiredAsterisk: N,
68
69
  ...v
69
70
  }, o) => {
70
- const V = $(), c = z ?? V, y = u ? `${c}-hint` : void 0, k = l ? `${c}-label` : void 0, e = A(null), r = E(
71
+ const R = W(), p = I ?? R, g = h ? `${p}-hint` : void 0, k = b ? `${p}-label` : void 0, e = $(null), r = C(
71
72
  {
72
73
  mask: i || "",
73
74
  // Pattern like 'aaaaa-aaaaa' where 'a' = alphanumeric, '0' = digit
@@ -78,92 +79,76 @@ const M = C(
78
79
  ref: e
79
80
  }
80
81
  );
81
- w(() => {
82
- if (i && (r != null && r.maskRef.current) && p) {
82
+ y(() => {
83
+ if (i && (r != null && r.maskRef.current) && a) {
83
84
  const t = r.maskRef.current, n = () => {
84
- const T = {
85
+ const F = {
85
86
  target: { value: t.value }
86
87
  };
87
- p(T);
88
+ a(F);
88
89
  };
89
90
  return t.on("accept", n), () => {
90
91
  t.off("accept", n);
91
92
  };
92
93
  }
93
- }, [i, r, p]), w(() => {
94
+ }, [i, r, a]), y(() => {
94
95
  o && (typeof o == "function" ? o(e.current) : o.current = e.current);
95
96
  }, [e, o]);
96
- const j = (t) => {
97
+ const V = (t) => {
97
98
  var n;
98
99
  v.disabled || t.target !== e.current && ((n = e.current) == null || n.focus());
99
100
  };
100
- return /* @__PURE__ */ h("div", { className: "flex flex-col gap-comp-input-gap", children: [
101
- l && /* @__PURE__ */ h(
102
- I,
103
- {
104
- component: "label",
105
- weight: "regular",
106
- size: "sm",
107
- htmlFor: c,
108
- id: k,
109
- children: [
110
- l,
111
- f && !R && /* @__PURE__ */ a("span", { className: "text-comp-input-text-error", children: " *" })
112
- ]
113
- }
114
- ),
115
- /* @__PURE__ */ h(
116
- "div",
117
- {
118
- className: s(
119
- M({
120
- size: g,
121
- error: m
122
- }),
123
- d
124
- ),
125
- onClick: j,
126
- children: [
127
- b && /* @__PURE__ */ a("div", { className: "flex items-center text-icon-dark-secondary-def", children: b }),
128
- /* @__PURE__ */ a(
129
- "input",
130
- {
131
- type: N,
132
- "data-slot": "input",
133
- className: s(
134
- U(g),
135
- "[&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-clear-button]:hidden [&::-webkit-inner-spin-button]:hidden",
136
- "[&::-webkit-datetime-edit-text]:px-3xs"
137
- ),
138
- ref: i ? r.ref : e,
139
- onChange: i ? void 0 : p,
140
- id: c,
141
- "aria-describedby": y,
142
- "aria-labelledby": k,
143
- "aria-invalid": m,
144
- "aria-required": f,
145
- required: f,
146
- ...v
147
- }
101
+ return /* @__PURE__ */ c(
102
+ E,
103
+ {
104
+ label: b,
105
+ hint: h,
106
+ error: s,
107
+ required: l,
108
+ disableRequiredAsterisk: N,
109
+ htmlFor: p,
110
+ labelId: k,
111
+ hintId: g,
112
+ children: /* @__PURE__ */ j(
113
+ "div",
114
+ {
115
+ className: u(
116
+ T({
117
+ size: x,
118
+ error: s
119
+ }),
120
+ d
148
121
  ),
149
- x && /* @__PURE__ */ a("div", { className: "flex items-center text-icon-dark-secondary-def", children: x })
150
- ]
151
- }
152
- ),
153
- u && /* @__PURE__ */ a(
154
- I,
155
- {
156
- component: "span",
157
- size: "sm",
158
- weight: "regular",
159
- className: s("text-comp-input-text-secondary", {
160
- "text-comp-input-text-error": m
161
- }),
162
- id: y,
163
- children: u
164
- }
165
- )
166
- ] });
122
+ onClick: V,
123
+ children: [
124
+ m && /* @__PURE__ */ c("div", { className: "flex items-center text-icon-dark-secondary-def", children: m }),
125
+ /* @__PURE__ */ c(
126
+ "input",
127
+ {
128
+ type: w,
129
+ "data-slot": "input",
130
+ className: u(
131
+ U(x),
132
+ "[&::-webkit-calendar-picker-indicator]:hidden [&::-webkit-clear-button]:hidden [&::-webkit-inner-spin-button]:hidden",
133
+ "[&::-webkit-datetime-edit-text]:px-3xs"
134
+ ),
135
+ ref: i ? r.ref : e,
136
+ onChange: i ? void 0 : a,
137
+ id: p,
138
+ "aria-describedby": g,
139
+ "aria-labelledby": k,
140
+ "aria-invalid": s,
141
+ "aria-required": l,
142
+ required: l,
143
+ ...v
144
+ }
145
+ ),
146
+ f && /* @__PURE__ */ c("div", { className: "flex items-center text-icon-dark-secondary-def", children: f })
147
+ ]
148
+ }
149
+ )
150
+ }
151
+ );
167
152
  }
168
153
  );
169
154
  Y.displayName = "Input";
@@ -11,6 +11,8 @@ export interface IMultiSelectProps {
11
11
  error?: boolean;
12
12
  /** Marks the field as required (visual indicator only). */
13
13
  required?: boolean;
14
+ /** Hides the required asterisk even when `required` is true. @default false */
15
+ disableRequiredAsterisk?: boolean;
14
16
  /** Element displayed after the selected values (not currently implemented). */
15
17
  suffix?: ReactNode;
16
18
  /** Icon or element displayed before the selected values. */
@@ -1 +1 @@
1
- {"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../../src/components/MultiSelect/MultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AAcd;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,yDAAyD;IACzD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,oGAAoG;IACpG,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,mDAAmD;IACnD,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAC3B;;;;;;;;;OASG;IACH,OAAO,EAAE,KAAK,CAAC;QACb,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,SAAS,CAAA;QAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,IAAI,CAAC,EAAE,SAAS,CAAA;KACjB,CAAC,CAAA;IACF,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kGAAkG;IAClG,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,uFAAuF;IACvF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;CACrC;AAED,eAAO,MAAM,WAAW,6FAwMvB,CAAA"}
1
+ {"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../../src/components/MultiSelect/MultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,KAAK,SAAS,EAMf,MAAM,OAAO,CAAA;AAed;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,yFAAyF;IACzF,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,yDAAyD;IACzD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,+EAA+E;IAC/E,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,+EAA+E;IAC/E,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,oGAAoG;IACpG,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,mDAAmD;IACnD,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAC3B;;;;;;;;;OASG;IACH,OAAO,EAAE,KAAK,CAAC;QACb,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,SAAS,CAAA;QAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;QAClB,IAAI,CAAC,EAAE,SAAS,CAAA;KACjB,CAAC,CAAA;IACF,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,kGAAkG;IAClG,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,uFAAuF;IACvF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAA;CACrC;AAED,eAAO,MAAM,WAAW,6FA+LvB,CAAA"}
@@ -1,157 +1,151 @@
1
- import { jsx as t, jsxs as i } from "react/jsx-runtime";
2
- import u, { forwardRef as k, useMemo as R, useRef as A, useEffect as I } from "react";
3
- import { triggerWrapperVariants as V } from "../Select/utils.js";
4
- import { useMuzaTranslations as E } from "../../translations/TranslationContext.js";
5
- import { Tag as f } from "../Tag/Tag.js";
6
- import { DropdownMenu as _, DropdownMenuTrigger as B, DropdownMenuContent as F, DropdownMenuCheckboxItem as L } from "../DropdownMenu/DropdownMenu.js";
7
- import { Typography as h } from "../Typography/Typography.js";
8
- import { AltArrowUpOutline as P } from "@solar-icons/react-perf";
9
- import { cn as U } from "../../utils/cn.js";
10
- const $ = k(
11
- (T, x) => {
12
- const z = E(), {
13
- label: g,
14
- hint: b,
15
- error: w,
16
- options: o,
1
+ import { jsx as r, jsxs as u } from "react/jsx-runtime";
2
+ import f, { forwardRef as F, useId as V, useMemo as T, useRef as $, useEffect as E } from "react";
3
+ import { triggerWrapperVariants as _ } from "../Select/utils.js";
4
+ import { useMuzaTranslations as B } from "../../translations/TranslationContext.js";
5
+ import { Tag as p } from "../Tag/Tag.js";
6
+ import { FormField as L } from "../FormField/FormField.js";
7
+ import { DropdownMenu as P, DropdownMenuTrigger as U, DropdownMenuContent as G, DropdownMenuCheckboxItem as H } from "../DropdownMenu/DropdownMenu.js";
8
+ import { Typography as J } from "../Typography/Typography.js";
9
+ import { AltArrowUpOutline as K } from "@solar-icons/react-perf";
10
+ import { cn as Q } from "../../utils/cn.js";
11
+ const X = F(
12
+ (I, h) => {
13
+ const z = B(), {
14
+ label: x,
15
+ hint: g,
16
+ error: b,
17
+ options: c,
17
18
  onChange: s,
18
- value: r,
19
- disabled: d,
20
- prefix: m,
21
- maxNumberOfVisibleTags: c = 2,
19
+ value: t,
20
+ disabled: o,
21
+ prefix: d,
22
+ maxNumberOfVisibleTags: i = 2,
22
23
  size: D,
23
- placeholder: S
24
- } = T, N = S ?? z.select.placeholder, v = R(() => new Map(o.map((e) => [e.value, e.label])), [o]), W = R(() => {
25
- const e = r && r.map((l) => v.get(l));
26
- return e != null && e.length ? e.length <= c ? /* @__PURE__ */ t("div", { className: "flex flex-1 items-start justify-start gap-xs", children: e.map((l, n) => /* @__PURE__ */ t(f, { variant: "info", className: "max-w-[72px]", children: l }, n)) }) : /* @__PURE__ */ t("div", { className: "flex flex-1 items-center gap-xs", children: [
27
- ...e.slice(0, c).map((l, n) => /* @__PURE__ */ t(
28
- f,
24
+ placeholder: S,
25
+ required: v,
26
+ disableRequiredAsterisk: W
27
+ } = I, w = S ?? z.select.placeholder, N = V(), k = x ? `${N}-label` : void 0, A = g ? `${N}-hint` : void 0, M = T(() => new Map(c.map((e) => [e.value, e.label])), [c]), C = T(() => {
28
+ const e = t && t.map((n) => M.get(n));
29
+ return e != null && e.length ? e.length <= i ? /* @__PURE__ */ r("div", { className: "flex flex-1 items-start justify-start gap-xs", children: e.map((n, a) => /* @__PURE__ */ r(p, { variant: "info", className: "max-w-[72px]", children: n }, a)) }) : /* @__PURE__ */ r("div", { className: "flex flex-1 items-center gap-xs", children: [
30
+ ...e.slice(0, i).map((n, a) => /* @__PURE__ */ r(
31
+ p,
29
32
  {
30
33
  variant: "info",
31
34
  className: "max-w-[72px] overflow-hidden",
32
- children: /* @__PURE__ */ t("span", { className: "truncate", children: l })
35
+ children: /* @__PURE__ */ r("span", { className: "truncate", children: n })
33
36
  },
34
- n
37
+ a
35
38
  )),
36
- /* @__PURE__ */ i(f, { variant: "info", children: [
37
- e.length - c,
39
+ /* @__PURE__ */ u(p, { variant: "info", children: [
40
+ e.length - i,
38
41
  "+"
39
42
  ] }, "more")
40
- ] }) : /* @__PURE__ */ t(
41
- h,
43
+ ] }) : /* @__PURE__ */ r(
44
+ J,
42
45
  {
43
46
  size: "input",
44
47
  className: "grow-1 fix-y-text truncate text-left text-comp-select-text-placeholder",
45
48
  weight: "regular",
46
49
  component: "span",
47
- children: N
50
+ children: w
48
51
  }
49
52
  );
50
- }, [r, N, c, v]), [y, C] = u.useState(!1), [M, O] = u.useState(0), p = u.useRef(!1), j = A(null), a = (typeof x == "function" ? null : x) ?? j;
51
- return I(() => {
53
+ }, [t, w, i, M]), [y, O] = f.useState(!1), [R, j] = f.useState(0), m = f.useRef(!1), q = $(null), l = (typeof h == "function" ? null : h) ?? q;
54
+ return E(() => {
52
55
  const e = () => {
53
- a.current && O(a.current.offsetWidth);
56
+ l.current && j(l.current.offsetWidth);
54
57
  };
55
58
  e();
56
- const l = new ResizeObserver(e);
57
- return a.current && l.observe(a.current), () => {
58
- l.disconnect();
59
+ const n = new ResizeObserver(e);
60
+ return l.current && n.observe(l.current), () => {
61
+ n.disconnect();
59
62
  };
60
- }, [a]), /* @__PURE__ */ i("div", { className: "flex flex-col gap-sm", children: [
61
- g && /* @__PURE__ */ t(
62
- h,
63
- {
64
- component: "label",
65
- size: "sm",
66
- weight: "regular",
67
- className: "text-comp-select-text-primary",
68
- children: g
69
- }
70
- ),
71
- /* @__PURE__ */ i(
72
- _,
73
- {
74
- onOpenChange: (e) => {
75
- C(e);
76
- },
77
- children: [
78
- /* @__PURE__ */ t(B, { disabled: d, asChild: !0, children: /* @__PURE__ */ t(
79
- "button",
80
- {
81
- ref: a,
82
- type: "button",
83
- role: "input",
84
- tabIndex: 0,
85
- disabled: d,
86
- className: V({
87
- size: D,
88
- error: w,
89
- expanded: y,
90
- hasIcon: !!m || (r == null ? void 0 : r.length) === 0
91
- }),
92
- children: /* @__PURE__ */ i("div", { className: "flex min-w-0 flex-1 items-center gap-sm", children: [
93
- m && /* @__PURE__ */ t(
94
- "span",
95
- {
96
- className: d ? "text-comp-select-icon-disabled" : "text-comp-select-icon-brand-def",
97
- children: m
98
- }
99
- ),
100
- W,
101
- /* @__PURE__ */ t(
102
- P,
63
+ }, [l]), /* @__PURE__ */ r(
64
+ L,
65
+ {
66
+ label: x,
67
+ hint: g,
68
+ error: b,
69
+ required: v,
70
+ disableRequiredAsterisk: W,
71
+ labelId: k,
72
+ hintId: A,
73
+ children: /* @__PURE__ */ u(
74
+ P,
75
+ {
76
+ onOpenChange: (e) => {
77
+ O(e);
78
+ },
79
+ children: [
80
+ /* @__PURE__ */ r(U, { disabled: o, asChild: !0, children: /* @__PURE__ */ r(
81
+ "button",
82
+ {
83
+ ref: l,
84
+ type: "button",
85
+ role: "input",
86
+ tabIndex: 0,
87
+ disabled: o,
88
+ "aria-required": v,
89
+ className: _({
90
+ size: D,
91
+ error: b,
92
+ expanded: y,
93
+ hasIcon: !!d || (t == null ? void 0 : t.length) === 0
94
+ }),
95
+ children: /* @__PURE__ */ u("div", { className: "flex min-w-0 flex-1 items-center gap-sm", children: [
96
+ d && /* @__PURE__ */ r(
97
+ "span",
98
+ {
99
+ className: o ? "text-comp-select-icon-disabled" : "text-comp-select-icon-brand-def",
100
+ children: d
101
+ }
102
+ ),
103
+ C,
104
+ /* @__PURE__ */ r(
105
+ K,
106
+ {
107
+ className: Q(
108
+ "transition-transform duration-200",
109
+ y ? "rotate-0" : "rotate-180"
110
+ )
111
+ }
112
+ )
113
+ ] })
114
+ }
115
+ ) }),
116
+ /* @__PURE__ */ r(
117
+ G,
118
+ {
119
+ className: "mt-1",
120
+ style: {
121
+ width: R > 0 ? `${R}px` : void 0
122
+ },
123
+ onCloseAutoFocus: (e) => {
124
+ m.current || e.preventDefault(), m.current = !1;
125
+ },
126
+ children: c.map((e) => /* @__PURE__ */ r(
127
+ H,
103
128
  {
104
- className: U(
105
- "transition-transform duration-200",
106
- y ? "rotate-0" : "rotate-180"
107
- )
108
- }
109
- )
110
- ] })
111
- }
112
- ) }),
113
- /* @__PURE__ */ t(
114
- F,
115
- {
116
- className: "mt-1",
117
- style: {
118
- width: M > 0 ? `${M}px` : void 0
119
- },
120
- onCloseAutoFocus: (e) => {
121
- p.current || e.preventDefault(), p.current = !1;
122
- },
123
- children: o.map((e) => /* @__PURE__ */ t(
124
- L,
125
- {
126
- checked: r == null ? void 0 : r.includes(e.value),
127
- disabled: e.disabled,
128
- icon: e.icon,
129
- onCheckedChange: (l) => {
130
- l ? s == null || s([...r || [], e.value]) : s == null || s((r || []).filter((n) => n !== e.value)), p.current = !0;
129
+ checked: t == null ? void 0 : t.includes(e.value),
130
+ disabled: e.disabled,
131
+ icon: e.icon,
132
+ onCheckedChange: (n) => {
133
+ n ? s == null || s([...t || [], e.value]) : s == null || s((t || []).filter((a) => a !== e.value)), m.current = !0;
134
+ },
135
+ children: e.label
131
136
  },
132
- children: e.label
133
- },
134
- e.value
135
- ))
136
- }
137
- )
138
- ]
139
- }
140
- ),
141
- b && /* @__PURE__ */ t(
142
- h,
143
- {
144
- component: "p",
145
- size: "sm",
146
- weight: "regular",
147
- className: w ? "text-comp-select-text-error" : "text-comp-select-text-secondary",
148
- children: b
149
- }
150
- )
151
- ] });
137
+ e.value
138
+ ))
139
+ }
140
+ )
141
+ ]
142
+ }
143
+ )
144
+ }
145
+ );
152
146
  }
153
147
  );
154
- $.displayName = "MultiSelect";
148
+ X.displayName = "MultiSelect";
155
149
  export {
156
- $ as MultiSelect
150
+ X as MultiSelect
157
151
  };
@@ -19,7 +19,7 @@ const x = ({ className: i, ...a }) => /* @__PURE__ */ r(
19
19
  ...l
20
20
  }) => {
21
21
  const f = p.useId(), d = a || f;
22
- return /* @__PURE__ */ n("div", { className: "flex items-start gap-sm", children: [
22
+ return /* @__PURE__ */ n("div", { className: "isolate flex items-start gap-sm", children: [
23
23
  /* @__PURE__ */ r(
24
24
  s.Item,
25
25
  {
@@ -9,6 +9,8 @@ export interface ISelectProps {
9
9
  error?: boolean;
10
10
  /** Marks the field as required. */
11
11
  required?: boolean;
12
+ /** Hides the required asterisk even when `required` is true. @default false */
13
+ disableRequiredAsterisk?: boolean;
12
14
  /** Element displayed after the selected value. */
13
15
  suffix?: ReactNode;
14
16
  /** Icon or element displayed before the selected value. */
@@ -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,EAKf,MAAM,OAAO,CAAA;AAcd,uDAAuD;AACvD,MAAM,WAAW,YAAY;IAC3B,qDAAqD;IACrD,KAAK,CAAC,EAAE,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