@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
@@ -1,30 +1,33 @@
1
- import { jsx as t, jsxs as p } from "react/jsx-runtime";
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";
5
- import { Typography as s } from "../Typography/Typography.js";
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,
15
- options: c,
16
- onChange: a,
1
+ import { jsx as t, jsxs as y } from "react/jsx-runtime";
2
+ import u, { forwardRef as j, useId as k, useMemo as E, useRef as N, useEffect as S } from "react";
3
+ import { triggerWrapperVariants as P } from "./utils.js";
4
+ import { useMuzaTranslations as _ } from "../../translations/TranslationContext.js";
5
+ import { FormField as B } from "../FormField/FormField.js";
6
+ import { Typography as I } from "../Typography/Typography.js";
7
+ import { DropdownMenu as G, DropdownMenuTrigger as L, DropdownMenuContent as U, DropdownMenuRadioGroup as H, DropdownMenuRadioItem as J } from "../DropdownMenu/DropdownMenu.js";
8
+ import { AltArrowUpOutline as K } from "@solar-icons/react-perf";
9
+ import { cn as Q } from "../../utils/cn.js";
10
+ const X = j(
11
+ (M, p) => {
12
+ const T = _(), {
13
+ label: f,
14
+ hint: m,
15
+ error: h,
16
+ options: i,
17
+ onChange: s,
17
18
  value: r,
18
- disabled: i,
19
- prefix: b,
20
- size: M,
21
- placeholder: T,
22
- shouldScrollToSelectedOption: w,
23
- collisionPadding: D
24
- } = z, v = T ?? S.select.placeholder, O = I(() => {
25
- const e = r && c.find((l) => l.value === r);
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
+ } = M, w = D ?? T.select.placeholder, v = k(), A = f ? `${v}-label` : void 0, C = m ? `${v}-hint` : void 0, V = E(() => {
28
+ const e = r && i.find((o) => o.value === r);
26
29
  return e ? typeof e.label != "function" ? /* @__PURE__ */ t(
27
- s,
30
+ I,
28
31
  {
29
32
  size: "input",
30
33
  className: "grow-1 fix-y-text truncate text-left text-comp-select-text-primary",
@@ -33,128 +36,120 @@ const U = A(
33
36
  children: e.label
34
37
  }
35
38
  ) : e.label : /* @__PURE__ */ t(
36
- s,
39
+ I,
37
40
  {
38
41
  size: "input",
39
42
  className: "grow-1 fix-y-text truncate text-left text-comp-select-text-placeholder",
40
43
  weight: "regular",
41
44
  component: "span",
42
- children: v
45
+ children: w
43
46
  }
44
47
  );
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;
46
- return R(() => {
48
+ }, [i, r, w]), [l, q] = u.useState(!1), [R, F] = u.useState(0), c = u.useRef(!1), $ = N(null), d = N({}), n = (typeof p == "function" ? null : p) ?? $;
49
+ return S(() => {
47
50
  const e = () => {
48
- n.current && C(n.current.offsetWidth);
51
+ n.current && F(n.current.offsetWidth);
49
52
  };
50
53
  e();
51
- const l = new ResizeObserver(e);
52
- return n.current && l.observe(n.current), () => {
53
- l.disconnect();
54
+ const o = new ResizeObserver(e);
55
+ return n.current && o.observe(n.current), () => {
56
+ o.disconnect();
54
57
  };
55
- }, [n]), R(() => {
58
+ }, [n]), S(() => {
56
59
  var e;
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(
60
- s,
61
- {
62
- component: "label",
63
- size: "sm",
64
- weight: "regular",
65
- className: "text-comp-select-text-primary",
66
- children: h
67
- }
68
- ),
69
- /* @__PURE__ */ p(
70
- P,
71
- {
72
- onOpenChange: (e) => {
73
- W(e);
74
- },
75
- children: [
76
- /* @__PURE__ */ t(_, { disabled: i, asChild: !0, children: /* @__PURE__ */ t(
77
- "button",
78
- {
79
- ref: n,
80
- type: "button",
81
- role: "input",
82
- tabIndex: 0,
83
- disabled: i,
84
- className: j({ size: M, error: g, expanded: o }),
85
- children: /* @__PURE__ */ p("div", { className: "flex min-w-0 flex-1 items-center gap-sm", children: [
86
- b && /* @__PURE__ */ t(
87
- "span",
88
- {
89
- className: i ? "text-comp-select-icon-disabled" : "text-comp-select-icon-brand-def",
90
- children: b
91
- }
92
- ),
93
- O,
94
- /* @__PURE__ */ t(
95
- G,
60
+ l && r && d.current[r] && x && ((e = d.current[r]) == null || e.scrollIntoView({ block: "nearest" }));
61
+ }, [l, x, r]), /* @__PURE__ */ t(
62
+ B,
63
+ {
64
+ label: f,
65
+ hint: m,
66
+ error: h,
67
+ required: b,
68
+ disableRequiredAsterisk: W,
69
+ labelId: A,
70
+ hintId: C,
71
+ className: "flex-1",
72
+ children: /* @__PURE__ */ y(
73
+ G,
74
+ {
75
+ onOpenChange: (e) => {
76
+ q(e);
77
+ },
78
+ children: [
79
+ /* @__PURE__ */ t(L, { disabled: a, asChild: !0, children: /* @__PURE__ */ t(
80
+ "button",
81
+ {
82
+ ref: n,
83
+ type: "button",
84
+ role: "input",
85
+ tabIndex: 0,
86
+ disabled: a,
87
+ "aria-required": b,
88
+ className: P({ size: z, error: h, expanded: l }),
89
+ children: /* @__PURE__ */ y("div", { className: "flex min-w-0 flex-1 items-center gap-sm", children: [
90
+ g && /* @__PURE__ */ t(
91
+ "span",
92
+ {
93
+ className: a ? "text-comp-select-icon-disabled" : "text-comp-select-icon-brand-def",
94
+ children: g
95
+ }
96
+ ),
97
+ V,
98
+ /* @__PURE__ */ t(
99
+ K,
100
+ {
101
+ className: Q(
102
+ "transition-transform duration-200",
103
+ l ? "rotate-0" : "rotate-180"
104
+ )
105
+ }
106
+ )
107
+ ] })
108
+ }
109
+ ) }),
110
+ /* @__PURE__ */ t(
111
+ U,
112
+ {
113
+ className: "mt-1",
114
+ style: {
115
+ width: R > 0 ? `${R}px` : void 0
116
+ },
117
+ onCloseAutoFocus: (e) => {
118
+ c.current || e.preventDefault(), c.current = !1;
119
+ },
120
+ collisionPadding: O,
121
+ children: /* @__PURE__ */ t(
122
+ H,
96
123
  {
97
- className: L(
98
- "transition-transform duration-200",
99
- o ? "rotate-0" : "rotate-180"
100
- )
124
+ value: r,
125
+ onValueChange: (e) => {
126
+ c.current = !0, s == null || s(e);
127
+ },
128
+ children: i.map((e) => /* @__PURE__ */ t(
129
+ J,
130
+ {
131
+ value: e.value.toString(),
132
+ disabled: e.disabled,
133
+ icon: e.icon,
134
+ ref: (o) => {
135
+ d.current[e.value] = o;
136
+ },
137
+ children: e.label
138
+ },
139
+ e.value
140
+ ))
101
141
  }
102
142
  )
103
- ] })
104
- }
105
- ) }),
106
- /* @__PURE__ */ t(
107
- k,
108
- {
109
- className: "mt-1",
110
- style: {
111
- width: y > 0 ? `${y}px` : void 0
112
- },
113
- onCloseAutoFocus: (e) => {
114
- d.current || e.preventDefault(), d.current = !1;
115
- },
116
- collisionPadding: D,
117
- children: /* @__PURE__ */ t(
118
- B,
119
- {
120
- value: r,
121
- onValueChange: (e) => {
122
- d.current = !0, a == null || a(e);
123
- },
124
- children: c.map((e) => /* @__PURE__ */ t(
125
- F,
126
- {
127
- value: e.value.toString(),
128
- disabled: e.disabled,
129
- icon: e.icon,
130
- ref: (l) => {
131
- u.current[e.value] = l;
132
- },
133
- children: e.label
134
- },
135
- e.value
136
- ))
137
- }
138
- )
139
- }
140
- )
141
- ]
142
- }
143
- ),
144
- x && /* @__PURE__ */ t(
145
- s,
146
- {
147
- component: "p",
148
- size: "sm",
149
- weight: "regular",
150
- className: g ? "text-comp-select-text-error" : "text-comp-select-text-secondary",
151
- children: x
152
- }
153
- )
154
- ] });
143
+ }
144
+ )
145
+ ]
146
+ }
147
+ )
148
+ }
149
+ );
155
150
  }
156
151
  );
157
- U.displayName = "Select";
152
+ X.displayName = "Select";
158
153
  export {
159
- U as Select
154
+ X as Select
160
155
  };
@@ -98,6 +98,10 @@ export interface TextEditorProps {
98
98
  disabled?: boolean;
99
99
  /** Allows viewing but not editing content */
100
100
  readOnly?: boolean;
101
+ /** Marks the field as required and displays a red asterisk next to the label. @default false */
102
+ required?: boolean;
103
+ /** Hides the required asterisk even when `required` is true. @default false */
104
+ disableRequiredAsterisk?: boolean;
101
105
  /** Error state. String shows as error message, boolean only shows error styling. */
102
106
  error?: string | boolean;
103
107
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"TextEditor.d.ts","sourceRoot":"","sources":["../../../src/components/TextEditor/TextEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AACd,OAA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;;;;OAKG;IACH,UAAU,CAAC,EAAE,YAAY,EAAE,CAAA;IAC3B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B,+CAA+C;IAC/C,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,uGAAuG;IACvG,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,0DAA0D;IAC1D,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAwBD,QAAA,MAAM,UAAU,2GAoPf,CAAA;AAID,OAAO,EAAE,UAAU,EAAE,CAAA"}
@@ -1,20 +1,19 @@
1
- import { jsx as r, jsxs as l } from "react/jsx-runtime";
2
- import { forwardRef as I, useEffect as T, useImperativeHandle as O, useRef as $ } from "react";
1
+ import { jsx as r, jsxs as f } from "react/jsx-runtime";
2
+ import { forwardRef as I, useEffect as b, useImperativeHandle as O, useRef as $ } from "react";
3
3
  import { Link as K } from "../../node_modules/@tiptap/extension-link/dist/index.js";
4
4
  import { Placeholder as W } from "../../node_modules/@tiptap/extension-placeholder/dist/index.js";
5
- import { useEditor as Y, EditorContent as q } from "../../node_modules/@tiptap/react/dist/index.js";
6
- import { StarterKit as D } from "../../node_modules/@tiptap/starter-kit/dist/index.js";
7
- import { cva as G } from "class-variance-authority";
8
- import { EditorToolbar as J } from "./EditorToolbar.js";
9
- import { LinkBubbleMenu as Q } from "./LinkBubbleMenu.js";
10
- import { useLinkEditor as X } from "./useLinkEditor.js";
5
+ import { useEditor as q, EditorContent as D } from "../../node_modules/@tiptap/react/dist/index.js";
6
+ import { StarterKit as G } from "../../node_modules/@tiptap/starter-kit/dist/index.js";
7
+ import { cva as J } from "class-variance-authority";
8
+ import { EditorToolbar as Q } from "./EditorToolbar.js";
9
+ import { LinkBubbleMenu as X } from "./LinkBubbleMenu.js";
10
+ import { useLinkEditor as Y } from "./useLinkEditor.js";
11
11
  import { useMuzaTranslations as Z } from "../../translations/TranslationContext.js";
12
- import { cn as d } from "../../utils/cn.js";
13
- import { Flex as L } from "../Flex/Flex.js";
14
- import { Typography as E } from "../Typography/Typography.js";
15
- import { TooltipProvider as tt, Tooltip as et, TooltipTrigger as rt, TooltipContent as ot } from "../Tooltip/Tooltip.js";
16
- import { InfoCircleBold as it } from "@solar-icons/react-perf";
17
- const nt = G(
12
+ import { FormField as tt } from "../FormField/FormField.js";
13
+ import { cn as g } from "../../utils/cn.js";
14
+ import { TooltipProvider as et, Tooltip as rt, TooltipTrigger as ot, TooltipContent as it } from "../Tooltip/Tooltip.js";
15
+ import { InfoCircleBold as nt } from "@solar-icons/react-perf";
16
+ const lt = J(
18
17
  [
19
18
  "overflow-hidden rounded-xl border bg-surface-base-secondary transition-colors",
20
19
  "focus-within:border-comp-texteditor-stroke-focused",
@@ -35,39 +34,41 @@ const nt = G(
35
34
  }
36
35
  ), st = I(
37
36
  ({
38
- value: s,
39
- defaultValue: C,
40
- onChange: p,
41
- onBlur: M,
42
- onFocus: w,
43
- placeholder: H = "",
44
- label: x,
45
- hint: u,
46
- infoTooltip: h,
37
+ value: l,
38
+ defaultValue: y,
39
+ onChange: d,
40
+ onBlur: v,
41
+ onFocus: L,
42
+ placeholder: T = "",
43
+ label: E,
44
+ hint: C,
45
+ infoTooltip: p,
47
46
  disabled: i = !1,
48
- readOnly: f = !1,
49
- error: a,
47
+ readOnly: c = !1,
48
+ required: M,
49
+ disableRequiredAsterisk: H,
50
+ error: s,
50
51
  toolbar: n = {},
51
- toolbarExtra: g,
52
- extensions: z = [],
53
- minHeight: N = 200,
54
- maxHeight: m,
52
+ toolbarExtra: x,
53
+ extensions: w = [],
54
+ minHeight: z = 200,
55
+ maxHeight: a,
55
56
  resizable: P = !0,
56
- className: R,
57
- contentClassName: U,
58
- unstyled: S = !1,
59
- editorClassName: V
60
- }, j) => {
61
- const k = Z(), c = {
57
+ className: N,
58
+ contentClassName: R,
59
+ unstyled: U = !1,
60
+ editorClassName: F
61
+ }, S) => {
62
+ const u = Z(), m = {
62
63
  history: n.history ?? !0,
63
64
  headings: n.headings ?? !0,
64
65
  formatting: n.formatting ?? !0,
65
66
  lists: n.lists ?? !0,
66
67
  link: n.link ?? !0,
67
68
  clearFormatting: n.clearFormatting ?? !0
68
- }, A = !!g || Object.values(c).some((e) => e !== !1), t = Y({
69
+ }, V = !!x || Object.values(m).some((e) => e !== !1), t = q({
69
70
  extensions: [
70
- D.configure({
71
+ G.configure({
71
72
  heading: { levels: [1, 2, 3] },
72
73
  bulletList: {
73
74
  HTMLAttributes: { class: "list-disc ml-6" }
@@ -76,7 +77,7 @@ const nt = G(
76
77
  HTMLAttributes: { class: "list-decimal ml-6" }
77
78
  }
78
79
  }),
79
- ...c.link ? [
80
+ ...m.link ? [
80
81
  K.configure({
81
82
  openOnClick: !1,
82
83
  autolink: !0,
@@ -88,23 +89,23 @@ const nt = G(
88
89
  })
89
90
  ] : [],
90
91
  W.configure({
91
- placeholder: ({ editor: e }) => e.state.doc.textContent.length === 0 ? H : ""
92
+ placeholder: ({ editor: e }) => e.state.doc.textContent.length === 0 ? T : ""
92
93
  }),
93
- ...z
94
+ ...w
94
95
  ],
95
- content: s ?? C ?? "",
96
- editable: !i && !f,
96
+ content: l ?? y ?? "",
97
+ editable: !i && !c,
97
98
  onUpdate: ({ editor: e }) => {
98
- const b = e.getText().trim(), v = e.getHTML();
99
- p == null || p(b.length === 0 ? "" : v);
99
+ const k = e.getText().trim(), _ = e.getHTML();
100
+ d == null || d(k.length === 0 ? "" : _);
100
101
  },
101
- onBlur: M,
102
- onFocus: w,
102
+ onBlur: v,
103
+ onFocus: L,
103
104
  editorProps: {
104
105
  attributes: {
105
- class: d(
106
+ class: g(
106
107
  "outline-none text-sm",
107
- !S && [
108
+ !U && [
108
109
  // Headings
109
110
  "[&_h1]:text-3xl [&_h1]:font-semibold [&_h1]:text-text-dark-primary-def [&_h1]:my-3",
110
111
  "[&_h2]:text-2xl [&_h2]:font-semibold [&_h2]:text-text-dark-primary-def [&_h2]:my-3",
@@ -124,7 +125,7 @@ const nt = G(
124
125
  ],
125
126
  // Placeholder (only when the entire editor is empty — controlled via placeholder function)
126
127
  "[&_.is-empty]:before:content-[attr(data-placeholder)] [&_.is-empty]:before:text-comp-input-text-placeholder [&_.is-empty]:before:float-left [&_.is-empty]:before:h-0 [&_.is-empty]:before:pointer-events-none",
127
- V
128
+ F
128
129
  ),
129
130
  // Inline styles needed because Tailwind CSS 4 JIT doesn't apply to dynamically created elements
130
131
  style: "width: 100%; min-height: 100%; max-width: none;",
@@ -133,15 +134,15 @@ const nt = G(
133
134
  }
134
135
  }
135
136
  });
136
- T(() => {
137
- if (t && s !== void 0) {
137
+ b(() => {
138
+ if (t && l !== void 0) {
138
139
  const e = t.getHTML();
139
- (s || "<p></p>") !== (e || "<p></p>") && t.commands.setContent(s, !1);
140
+ (l || "<p></p>") !== (e || "<p></p>") && t.commands.setContent(l, !1);
140
141
  }
141
- }, [t, s]), T(() => {
142
- t && t.setEditable(!i && !f);
143
- }, [t, i, f]), O(
144
- j,
142
+ }, [t, l]), b(() => {
143
+ t && t.setEditable(!i && !c);
144
+ }, [t, i, c]), O(
145
+ S,
145
146
  () => ({
146
147
  editor: t,
147
148
  focus: () => t == null ? void 0 : t.commands.focus(),
@@ -153,91 +154,68 @@ const nt = G(
153
154
  }),
154
155
  [t]
155
156
  );
156
- const o = X(t), y = $(null), B = i ? "disabled" : a ? "error" : "default", _ = typeof a == "string" ? a : void 0, F = {
157
- minHeight: `${Math.max(N, 200)}px`,
158
- maxHeight: m ? typeof m == "number" ? `${m}px` : m : void 0,
157
+ const o = Y(t), h = $(null), j = i ? "disabled" : s ? "error" : "default", A = typeof s == "string" ? s : void 0, B = {
158
+ minHeight: `${Math.max(z, 200)}px`,
159
+ maxHeight: a ? typeof a == "number" ? `${a}px` : a : void 0,
159
160
  resize: P && !i ? "vertical" : "none"
160
161
  };
161
- return /* @__PURE__ */ r("div", { ref: y, children: /* @__PURE__ */ l(
162
- L,
162
+ return /* @__PURE__ */ r("div", { ref: h, children: /* @__PURE__ */ r(
163
+ tt,
163
164
  {
164
- direction: "column",
165
- className: d("gap-comp-input-gap", R),
166
- children: [
167
- x && /* @__PURE__ */ l(L, { align: "center", gap: "2xs", children: [
168
- /* @__PURE__ */ r(
169
- E,
170
- {
171
- component: "label",
172
- weight: "regular",
173
- size: "sm",
174
- className: "text-comp-select-text-primary",
175
- fixY: !0,
176
- children: x
177
- }
178
- ),
179
- h && /* @__PURE__ */ r(tt, { children: /* @__PURE__ */ l(et, { children: [
180
- /* @__PURE__ */ r(rt, { asChild: !0, children: /* @__PURE__ */ r(it, { className: "cursor-help text-comp-info-ico-def hover:text-comp-info-ico-hover" }) }),
181
- /* @__PURE__ */ r(ot, { children: h })
182
- ] }) })
183
- ] }),
184
- /* @__PURE__ */ l("div", { className: nt({ state: B }), children: [
185
- A && /* @__PURE__ */ r(
186
- J,
187
- {
188
- editor: t,
189
- toolbarConfig: c,
190
- disabled: i,
191
- translations: k.textEditor,
192
- onLinkClick: o.handleLinkToolbarClick,
193
- toolbarExtra: g
194
- }
195
- ),
196
- /* @__PURE__ */ l(
197
- "div",
198
- {
199
- className: d(
200
- "relative overflow-auto px-2xl py-xl",
201
- "mr-[calc(var(--spacing-xl)/2)]",
202
- "pr-[calc(var(--spacing-2xl)-var(--spacing-xl)/2)]",
203
- // Compensate for scrollbar offset
204
- U
205
- ),
206
- style: F,
207
- children: [
208
- /* @__PURE__ */ r(q, { editor: t, className: "h-full w-full" }),
209
- t && c.link && /* @__PURE__ */ r(
210
- Q,
211
- {
212
- editor: t,
213
- containerRef: y,
214
- linkUrl: o.linkUrl,
215
- isEditingLink: o.isEditingLink,
216
- onUrlChange: o.setLinkUrl,
217
- onEdit: o.handleOpenLinkEdit,
218
- onSave: o.handleSaveLink,
219
- onRemove: o.handleRemoveLink,
220
- onCancel: o.handleCancelEdit,
221
- translations: k.textEditor
222
- }
223
- )
224
- ]
225
- }
226
- )
227
- ] }),
228
- (u || _) && /* @__PURE__ */ r(
229
- E,
165
+ label: E,
166
+ hint: A || C,
167
+ error: !!s,
168
+ required: M,
169
+ disableRequiredAsterisk: H,
170
+ className: N,
171
+ labelExtra: p ? /* @__PURE__ */ r(et, { children: /* @__PURE__ */ f(rt, { children: [
172
+ /* @__PURE__ */ r(ot, { asChild: !0, children: /* @__PURE__ */ r(nt, { className: "cursor-help text-comp-info-ico-def hover:text-comp-info-ico-hover" }) }),
173
+ /* @__PURE__ */ r(it, { children: p })
174
+ ] }) }) : void 0,
175
+ children: /* @__PURE__ */ f("div", { className: lt({ state: j }), children: [
176
+ V && /* @__PURE__ */ r(
177
+ Q,
230
178
  {
231
- component: "span",
232
- size: "sm",
233
- weight: "regular",
234
- className: d("text-comp-select-text-secondary", {
235
- "text-comp-input-text-error": a
236
- }),
237
- children: _ || u
179
+ editor: t,
180
+ toolbarConfig: m,
181
+ disabled: i,
182
+ translations: u.textEditor,
183
+ onLinkClick: o.handleLinkToolbarClick,
184
+ toolbarExtra: x
185
+ }
186
+ ),
187
+ /* @__PURE__ */ f(
188
+ "div",
189
+ {
190
+ className: g(
191
+ "relative overflow-auto px-2xl py-xl",
192
+ "mr-[calc(var(--spacing-xl)/2)]",
193
+ "pr-[calc(var(--spacing-2xl)-var(--spacing-xl)/2)]",
194
+ // Compensate for scrollbar offset
195
+ R
196
+ ),
197
+ style: B,
198
+ children: [
199
+ /* @__PURE__ */ r(D, { editor: t, className: "h-full w-full" }),
200
+ t && m.link && /* @__PURE__ */ r(
201
+ X,
202
+ {
203
+ editor: t,
204
+ containerRef: h,
205
+ linkUrl: o.linkUrl,
206
+ isEditingLink: o.isEditingLink,
207
+ onUrlChange: o.setLinkUrl,
208
+ onEdit: o.handleOpenLinkEdit,
209
+ onSave: o.handleSaveLink,
210
+ onRemove: o.handleRemoveLink,
211
+ onCancel: o.handleCancelEdit,
212
+ translations: u.textEditor
213
+ }
214
+ )
215
+ ]
238
216
  }
239
217
  )
240
- ]
218
+ ] })
241
219
  }
242
220
  ) });
243
221
  }
@@ -11,6 +11,10 @@ export interface TextareaProps extends ComponentProps<'textarea'> {
11
11
  error?: boolean;
12
12
  /** Error message displayed below textarea when error is true. Overrides hint text. */
13
13
  errorMessage?: string;
14
+ /** Marks the field as required and displays a red asterisk next to the label. @default false */
15
+ required?: boolean;
16
+ /** Hides the required asterisk even when `required` is true. @default false */
17
+ disableRequiredAsterisk?: boolean;
14
18
  /** Name attribute for form submission. */
15
19
  name?: string;
16
20
  /** Automatically grows textarea height to fit content. @default false */
@@ -1 +1 @@
1
- {"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../../src/components/Textarea/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAA6B,MAAM,OAAO,CAAA;AAyCtE,wCAAwC;AACxC,MAAM,WAAW,aAAc,SAAQ,cAAc,CAAC,UAAU,CAAC;IAC/D,uEAAuE;IACvE,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,CAAA;IACpD,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6FAA6F;IAC7F,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,mDAAmD;IACnD,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,sFAAsF;IACtF,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,yEAAyE;IACzE,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,eAAO,MAAM,QAAQ,4HA0EpB,CAAA"}
1
+ {"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../../src/components/Textarea/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAA6B,MAAM,OAAO,CA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