@vkzstudio/muza-ui 1.0.35 → 1.0.37

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 (30) hide show
  1. package/dist/components/DataTable/DataTable.d.ts +6 -1
  2. package/dist/components/DataTable/DataTable.d.ts.map +1 -1
  3. package/dist/components/DataTable/DataTable.js +92 -79
  4. package/dist/components/DataTable/DataTable.stories.d.ts +1 -0
  5. package/dist/components/DataTable/DataTable.stories.d.ts.map +1 -1
  6. package/dist/components/FileUpload/FileItem.d.ts.map +1 -1
  7. package/dist/components/FileUpload/FileItem.js +1 -1
  8. package/dist/components/Input/Input.d.ts +9 -0
  9. package/dist/components/Input/Input.d.ts.map +1 -1
  10. package/dist/components/Input/Input.js +23 -22
  11. package/dist/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  12. package/dist/components/MultiSelect/MultiSelect.js +83 -62
  13. package/dist/components/MuzaUIProvider/theme/colorShades.js +11 -10
  14. package/dist/components/Reorderable/Reorderable.d.ts +5 -0
  15. package/dist/components/Reorderable/Reorderable.d.ts.map +1 -1
  16. package/dist/components/Reorderable/Reorderable.js +166 -164
  17. package/dist/components/ReorderableTable/ReorderableTable.d.ts +6 -0
  18. package/dist/components/ReorderableTable/ReorderableTable.d.ts.map +1 -1
  19. package/dist/components/ReorderableTable/ReorderableTable.js +91 -80
  20. package/dist/components/ReorderableTable/ReorderableTable.stories.d.ts +1 -0
  21. package/dist/components/ReorderableTable/ReorderableTable.stories.d.ts.map +1 -1
  22. package/dist/components/TextEditor/TextEditor.d.ts +4 -0
  23. package/dist/components/TextEditor/TextEditor.d.ts.map +1 -1
  24. package/dist/components/TextEditor/TextEditor.js +128 -97
  25. package/dist/components/TextEditor/TextEditor.stories.d.ts +1 -0
  26. package/dist/components/TextEditor/TextEditor.stories.d.ts.map +1 -1
  27. package/dist/components/Textarea/Textarea.js +1 -1
  28. package/dist/muza-ui.css +1 -1
  29. package/dist/node_modules/@tiptap/extension-character-count/dist/index.js +73 -0
  30. package/package.json +3 -1
@@ -1,61 +1,62 @@
1
- import { jsx as e, jsxs as m } from "react/jsx-runtime";
2
- import { forwardRef as E } from "react";
3
- import { motion as n } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
4
- import { ReorderableGroup as D, ReorderableItem as R, ReorderableHandle as j } from "../Reorderable/Reorderable.js";
5
- import { Reorder as P } from "../Icons/CustomIcons.js";
1
+ import { jsx as e, jsxs as h } from "react/jsx-runtime";
2
+ import { forwardRef as S } from "react";
3
+ import { motion as l } from "../../node_modules/framer-motion/dist/es/render/components/motion/proxy.js";
4
+ import { ReorderableGroup as k, ReorderableItem as w, ReorderableHandle as z } from "../Reorderable/Reorderable.js";
5
+ import { Reorder as G } from "../Icons/CustomIcons.js";
6
6
  import { cn as d } from "../../utils/cn.js";
7
- import { typographyVariants as S, Typography as z } from "../Typography/Typography.js";
8
- const p = 72, u = 20, G = 24, W = 4, K = ({
9
- data: y,
10
- onReorder: N,
11
- onSync: g,
12
- syncDelay: x,
13
- onSyncPendingChange: L,
14
- onDragStart: _,
15
- onDragEnd: v,
16
- columns: o,
17
- showHeader: I = !1,
18
- disabled: b = !1,
19
- isRowDisabled: l,
20
- className: T,
21
- isMovable: s = !0,
22
- animateItems: w = !1,
23
- layout: A,
7
+ import { typographyVariants as W, Typography as K } from "../Typography/Typography.js";
8
+ const f = 72, N = 20, R = 24, U = 4, F = ({
9
+ data: g,
10
+ onReorder: x,
11
+ onSync: L,
12
+ syncDelay: v,
13
+ onSyncPendingChange: _,
14
+ onDragStart: I,
15
+ onDragEnd: T,
16
+ columns: c,
17
+ showHeader: A = !1,
18
+ disabled: u = !1,
19
+ isRowDisabled: m,
20
+ className: H,
21
+ isMovable: i = !0,
22
+ animateItems: O = !1,
23
+ layout: E,
24
+ onRowClick: n,
24
25
  ...C
25
- }, H) => /* @__PURE__ */ e("div", { className: "w-full", children: /* @__PURE__ */ m(
26
+ }, j) => /* @__PURE__ */ e("div", { className: "w-full", children: /* @__PURE__ */ h(
26
27
  "table",
27
28
  {
28
- ref: H,
29
+ ref: j,
29
30
  className: d(
30
31
  "-my-sm w-full border-separate border-spacing-y-sm",
31
- T
32
+ H
32
33
  ),
33
34
  ...C,
34
35
  children: [
35
- I && /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ m("tr", { children: [
36
- o.map((i, r) => /* @__PURE__ */ e(
36
+ A && /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ h("tr", { children: [
37
+ c.map((o, a) => /* @__PURE__ */ e(
37
38
  "th",
38
39
  {
39
40
  className: d(
40
- S({
41
+ W({
41
42
  size: "sm",
42
43
  uppercase: !0,
43
44
  variant: "body",
44
45
  weight: "medium"
45
46
  }),
46
47
  "px-comp-table-p text-left text-text-dark-secondary",
47
- i.className
48
+ o.className
48
49
  ),
49
- children: i.title
50
+ children: o.title
50
51
  },
51
- r
52
+ a
52
53
  )),
53
54
  /* @__PURE__ */ e(
54
- n.th,
55
+ l.th,
55
56
  {
56
57
  initial: !1,
57
58
  animate: {
58
- width: s ? p : u
59
+ width: i ? f : N
59
60
  },
60
61
  transition: { duration: 0.3, ease: "easeInOut" },
61
62
  className: "overflow-hidden"
@@ -63,57 +64,65 @@ const p = 72, u = 20, G = 24, W = 4, K = ({
63
64
  )
64
65
  ] }) }),
65
66
  /* @__PURE__ */ e(
66
- D,
67
+ k,
67
68
  {
68
- values: y,
69
- onReorder: N,
70
- onSync: g,
71
- syncDelay: x,
72
- onSyncPendingChange: L,
73
- onDragStart: _,
74
- onDragEnd: v,
75
- disabled: b,
76
- animatePresence: w,
69
+ values: g,
70
+ onReorder: x,
71
+ onSync: L,
72
+ syncDelay: v,
73
+ onSyncPendingChange: _,
74
+ onDragStart: I,
75
+ onDragEnd: T,
76
+ disabled: u,
77
+ animatePresence: O,
77
78
  as: "tbody",
78
79
  className: "contents",
79
- children: (i) => i.map((r, h) => {
80
- const O = (l == null ? void 0 : l(r, h)) ?? !1, t = b || O;
81
- return /* @__PURE__ */ m(
82
- R,
80
+ children: (o) => o.map((a, p) => {
81
+ const D = (m == null ? void 0 : m(a, p)) ?? !1, t = u || D, b = !!n && !t;
82
+ return /* @__PURE__ */ h(
83
+ w,
83
84
  {
84
- value: r,
85
+ value: a,
85
86
  as: "tr",
86
- layout: A,
87
+ layout: E,
87
88
  disabled: t,
88
89
  dragListenerDisabled: !0,
89
90
  whileDrag: t ? void 0 : { boxShadow: "0 8px 32px 0 rgba(59, 18, 107, 0.2)" },
90
- className: "group rounded-2xl",
91
+ onClick: b ? (r) => {
92
+ if (!b) return;
93
+ const s = r.target;
94
+ s != null && s.closest("[data-reorder-handle]") || n == null || n(a, p);
95
+ } : void 0,
96
+ className: d(
97
+ "group rounded-2xl",
98
+ b && "cursor-pointer"
99
+ ),
91
100
  children: [
92
- o.map((a, c) => {
93
- const k = c === 0, f = c === o.length - 1;
101
+ c.map((r, s) => {
102
+ const P = s === 0, y = s === c.length - 1;
94
103
  return /* @__PURE__ */ e(
95
- n.td,
104
+ l.td,
96
105
  {
97
106
  initial: !1,
98
- animate: f ? {
99
- paddingRight: s ? G : W
107
+ animate: y ? {
108
+ paddingRight: i ? R : U
100
109
  } : void 0,
101
110
  transition: { duration: 0.3, ease: "easeInOut" },
102
111
  className: d(
103
112
  "h-comp-table-h-def border-y border-stroke-base-secondary bg-surface-base-secondary align-middle",
104
- f ? "pl-comp-table-p" : "px-comp-table-p",
113
+ y ? "pl-comp-table-p" : "px-comp-table-p",
105
114
  {
106
- "rounded-l-xl border-l": k,
115
+ "rounded-l-xl border-l": P,
107
116
  "group-focus-within:border-icon-brand-focus group-hover:border-icon-brand-hover": !t
108
117
  },
109
- a.className
118
+ r.className
110
119
  ),
111
- children: a.render ? a.render(
112
- r[a.dataKey],
113
- r,
114
- h
120
+ children: r.render ? r.render(
121
+ a[r.dataKey],
122
+ a,
123
+ p
115
124
  ) : /* @__PURE__ */ e(
116
- z,
125
+ K,
117
126
  {
118
127
  variant: "body",
119
128
  size: "base",
@@ -122,50 +131,52 @@ const p = 72, u = 20, G = 24, W = 4, K = ({
122
131
  className: d(
123
132
  t && "text-text-dark-disabled",
124
133
  {
125
- "line-clamp-1": a.lineClamp === !0 || a.lineClamp === 1,
126
- "line-clamp-2": a.lineClamp === 2
134
+ "line-clamp-1": r.lineClamp === !0 || r.lineClamp === 1,
135
+ "line-clamp-2": r.lineClamp === 2
127
136
  }
128
137
  ),
129
- children: r[a.dataKey]
138
+ children: a[r.dataKey]
130
139
  }
131
140
  )
132
141
  },
133
- c
142
+ s
134
143
  );
135
144
  }),
136
145
  /* @__PURE__ */ e(
137
- n.td,
146
+ l.td,
138
147
  {
148
+ "data-reorder-handle": !0,
139
149
  initial: !1,
140
150
  animate: {
141
- width: s ? p : u
151
+ width: i ? f : N
142
152
  },
143
153
  transition: { duration: 0.3, ease: "easeInOut" },
144
154
  className: d(
145
155
  "h-comp-table-h-def min-w-[20px] rounded-r-xl border-y border-r border-stroke-base-secondary bg-surface-base-secondary align-middle",
146
156
  {
147
- "group-focus-within:border-icon-brand-focus group-hover:border-icon-brand-hover": !t
157
+ "group-focus-within:border-icon-brand-focus group-hover:border-icon-brand-hover": !t,
158
+ "cursor-default": !!n
148
159
  }
149
160
  ),
150
161
  children: /* @__PURE__ */ e(
151
- n.div,
162
+ l.div,
152
163
  {
153
164
  initial: !1,
154
165
  animate: {
155
- opacity: s ? 1 : 0,
156
- width: s ? p : 0
166
+ opacity: i ? 1 : 0,
167
+ width: i ? f : 0
157
168
  },
158
169
  transition: { duration: 0.3, ease: "easeInOut" },
159
170
  className: "flex h-full items-center justify-center overflow-hidden border-l border-stroke-base-secondary",
160
171
  children: /* @__PURE__ */ e(
161
- j,
172
+ z,
162
173
  {
163
- disabled: !s || t,
174
+ disabled: !i || t,
164
175
  className: d(
165
176
  "flex h-comp-button-h-sm w-comp-button-w-sm items-center justify-center focus-visible-default",
166
177
  t ? "text-text-dark-disabled" : "text-text-brand-def"
167
178
  ),
168
- children: /* @__PURE__ */ e(P, { className: "size-icon-default" })
179
+ children: /* @__PURE__ */ e(G, { className: "size-icon-default" })
169
180
  }
170
181
  )
171
182
  }
@@ -174,15 +185,15 @@ const p = 72, u = 20, G = 24, W = 4, K = ({
174
185
  )
175
186
  ]
176
187
  },
177
- r.id
188
+ a.id
178
189
  );
179
190
  })
180
191
  }
181
192
  )
182
193
  ]
183
194
  }
184
- ) }), U = E(K);
185
- U.displayName = "ReorderableTable";
195
+ ) }), V = S(F);
196
+ V.displayName = "ReorderableTable";
186
197
  export {
187
- U as ReorderableTable
198
+ V as ReorderableTable
188
199
  };
@@ -12,6 +12,7 @@ declare const meta: Meta<typeof ReorderableTable>;
12
12
  export default meta;
13
13
  type Story = StoryObj<typeof ReorderableTable<IBenefit>>;
14
14
  export declare const Default: Story;
15
+ export declare const WithRowClick: Story;
15
16
  export declare const WithoutHeader: Story;
16
17
  export declare const WithDisabledRow: Story;
17
18
  export declare const AnimatedRows: Story;
@@ -1 +1 @@
1
- {"version":3,"file":"ReorderableTable.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableTable/ReorderableTable.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAM3D,OAAO,EACL,gBAAgB,EAEjB,MAAM,oBAAoB,CAAA;AAE3B,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAA;CAC9B;AAyCD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CAiEvC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAA;AAExD,eAAO,MAAM,OAAO,EAAE,KAkHrB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAsG3B,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KA2G7B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KA0H1B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAkG3B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KA4FtB,CAAA"}
1
+ {"version":3,"file":"ReorderableTable.stories.d.ts","sourceRoot":"","sources":["../../../src/components/ReorderableTable/ReorderableTable.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAc3D,OAAO,EACL,gBAAgB,EAEjB,MAAM,oBAAoB,CAAA;AAE3B,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAA;CAC9B;AAyCD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CAoEvC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAA;AAExD,eAAO,MAAM,OAAO,EAAE,KAkHrB,CAAA;AAMD,eAAO,MAAM,YAAY,EAAE,KAuL1B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAsG3B,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KA2G7B,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KA0H1B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAkG3B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KA4FtB,CAAA"}
@@ -135,6 +135,10 @@ export interface TextEditorProps {
135
135
  unstyled?: boolean;
136
136
  /** Additional class name for the TipTap editor element */
137
137
  editorClassName?: string;
138
+ /** Maximum character count. Blocks input past this limit and enables the counter when `showCharacterCount` is true. */
139
+ maxLength?: number;
140
+ /** Displays a character counter (currentCount/maxLength) in the label row. Requires `maxLength` to be set. @default false */
141
+ showCharacterCount?: boolean;
138
142
  }
139
143
  declare const TextEditor: import('react').ForwardRefExoticComponent<TextEditorProps & import('react').RefAttributes<TextEditorRef>>;
140
144
  export { TextEditor };
@@ -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,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAGhD,OAAO,EAAE,KAAK,MAAM,EAA4B,MAAM,eAAe,CAAA;AAUrE,gCAAgC;AAChC,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM,CAAA;AAElC,+BAA+B;AAC/B,KAAK,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAE7B,wCAAwC;AACxC,KAAK,cAAc,GAAG,MAAM,GAAG,QAAQ,GAAG,eAAe,CAAA;AAEzD,6BAA6B;AAC7B,KAAK,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;AAEpC;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,uBAAuB;IACtC,sDAAsD;IACtD,OAAO,CAAC,EAAE,OAAO,GAAG,WAAW,EAAE,CAAA;IACjC,qDAAqD;IACrD,QAAQ,CAAC,EAAE,OAAO,GAAG,YAAY,EAAE,CAAA;IACnC,yEAAyE;IACzE,UAAU,CAAC,EAAE,OAAO,GAAG,cAAc,EAAE,CAAA;IACvC,wDAAwD;IACxD,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,EAAE,CAAA;IAC5B,iFAAiF;IACjF,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,k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- import { forwardRef as O, useEffect as _, useImperativeHandle as $, useRef as I } from "react";
3
- import { Link as K } from "../../node_modules/@tiptap/extension-link/dist/index.js";
4
- import { Placeholder as W } from "../../node_modules/@tiptap/extension-placeholder/dist/index.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
- import { useMuzaTranslations as Z } from "../../translations/TranslationContext.js";
12
- import { FormField as tt } from "../FormField/FormField.js";
13
- import { cn as b } from "../../utils/cn.js";
14
- const et = J(
1
+ import { jsxs as p, jsx as l } from "react/jsx-runtime";
2
+ import { forwardRef as D, useState as G, useEffect as u, useImperativeHandle as J, useRef as Q } from "react";
3
+ import { CharacterCount as X } from "../../node_modules/@tiptap/extension-character-count/dist/index.js";
4
+ import { Link as Y } from "../../node_modules/@tiptap/extension-link/dist/index.js";
5
+ import { Placeholder as Z } from "../../node_modules/@tiptap/extension-placeholder/dist/index.js";
6
+ import { useEditor as tt, EditorContent as et } from "../../node_modules/@tiptap/react/dist/index.js";
7
+ import { StarterKit as rt } from "../../node_modules/@tiptap/starter-kit/dist/index.js";
8
+ import { cva as ot } from "class-variance-authority";
9
+ import { EditorToolbar as nt } from "./EditorToolbar.js";
10
+ import { LinkBubbleMenu as it } from "./LinkBubbleMenu.js";
11
+ import { useLinkEditor as st } from "./useLinkEditor.js";
12
+ import { useMuzaTranslations as lt } from "../../translations/TranslationContext.js";
13
+ import { FormField as at } from "../FormField/FormField.js";
14
+ import { cn as x } from "../../utils/cn.js";
15
+ import { typographyVariants as ct } from "../Typography/Typography.js";
16
+ const mt = ot(
15
17
  [
16
18
  "overflow-hidden rounded-xl border bg-surface-base-secondary transition-colors",
17
19
  "focus-within:border-comp-input-stroke-focused",
@@ -23,50 +25,52 @@ const et = J(
23
25
  state: {
24
26
  default: "border-comp-input-stroke-def hover:border-comp-input-stroke-hover",
25
27
  disabled: "cursor-not-allowed border-comp-input-stroke-disabled opacity-60",
26
- error: "border-comp-input-stroke-error"
28
+ error: "border-comp-input-stroke-error-def"
27
29
  }
28
30
  },
29
31
  defaultVariants: {
30
32
  state: "default"
31
33
  }
32
34
  }
33
- ), rt = O(
35
+ ), dt = D(
34
36
  ({
35
- value: i,
36
- defaultValue: g,
37
- onChange: c,
38
- onBlur: y,
39
- onFocus: v,
40
- placeholder: L = "",
41
- label: E,
42
- hint: T,
43
- infoTooltip: C,
44
- disabled: o = !1,
45
- readOnly: d = !1,
46
- required: M,
37
+ value: n,
38
+ defaultValue: v,
39
+ onChange: d,
40
+ onBlur: C,
41
+ onFocus: T,
42
+ placeholder: E = "",
43
+ label: L,
44
+ hint: M,
45
+ infoTooltip: w,
46
+ disabled: i = !1,
47
+ readOnly: f = !1,
48
+ required: z,
47
49
  disableRequiredAsterisk: H,
48
- error: l,
49
- toolbar: n = {},
50
- toolbarExtra: f,
51
- extensions: w = [],
52
- minHeight: z = 200,
53
- maxHeight: a,
54
- resizable: P = !0,
55
- className: R,
56
- contentClassName: U,
50
+ error: a,
51
+ toolbar: s = {},
52
+ toolbarExtra: h,
53
+ extensions: N = [],
54
+ minHeight: R = 200,
55
+ maxHeight: c,
56
+ resizable: S = !0,
57
+ className: U,
58
+ contentClassName: V,
57
59
  unstyled: F = !1,
58
- editorClassName: N
59
- }, S) => {
60
- const p = Z(), m = {
61
- history: n.history ?? !0,
62
- headings: n.headings ?? !0,
63
- formatting: n.formatting ?? !0,
64
- lists: n.lists ?? !0,
65
- link: n.link ?? !0,
66
- clearFormatting: n.clearFormatting ?? !0
67
- }, V = !!f || Object.values(m).some((e) => e !== !1), t = q({
60
+ editorClassName: P,
61
+ maxLength: o,
62
+ showCharacterCount: j
63
+ }, A) => {
64
+ const k = lt(), [B, y] = G(0), m = {
65
+ history: s.history ?? !0,
66
+ headings: s.headings ?? !0,
67
+ formatting: s.formatting ?? !0,
68
+ lists: s.lists ?? !0,
69
+ link: s.link ?? !0,
70
+ clearFormatting: s.clearFormatting ?? !0
71
+ }, O = !!h || Object.values(m).some((e) => e !== !1), t = tt({
68
72
  extensions: [
69
- G.configure({
73
+ rt.configure({
70
74
  heading: { levels: [1, 2, 3] },
71
75
  bulletList: {
72
76
  HTMLAttributes: { class: "list-disc ml-6" }
@@ -76,7 +80,7 @@ const et = J(
76
80
  }
77
81
  }),
78
82
  ...m.link ? [
79
- K.configure({
83
+ Y.configure({
80
84
  openOnClick: !1,
81
85
  autolink: !0,
82
86
  linkOnPaste: !0,
@@ -86,22 +90,23 @@ const et = J(
86
90
  }
87
91
  })
88
92
  ] : [],
89
- W.configure({
90
- placeholder: ({ editor: e }) => e.state.doc.textContent.length === 0 ? L : ""
93
+ Z.configure({
94
+ placeholder: ({ editor: e }) => e.state.doc.textContent.length === 0 ? E : ""
91
95
  }),
92
- ...w
96
+ ...o != null ? [X.configure({ limit: o, mode: "textSize" })] : [],
97
+ ...N
93
98
  ],
94
- content: i ?? g ?? "",
95
- editable: !o && !d,
99
+ content: n ?? v ?? "",
100
+ editable: !i && !f,
96
101
  onUpdate: ({ editor: e }) => {
97
- const x = e.getText().trim(), h = e.getHTML();
98
- c == null || c(x.length === 0 ? "" : h);
102
+ const b = e.getText().trim(), g = e.getHTML();
103
+ o != null && y(e.storage.characterCount.characters()), d == null || d(b.length === 0 ? "" : g);
99
104
  },
100
- onBlur: y,
101
- onFocus: v,
105
+ onBlur: C,
106
+ onFocus: T,
102
107
  editorProps: {
103
108
  attributes: {
104
- class: b(
109
+ class: x(
105
110
  "outline-none text-sm",
106
111
  !F && [
107
112
  // Headings
@@ -123,7 +128,7 @@ const et = J(
123
128
  ],
124
129
  // Placeholder (only when the entire editor is empty — controlled via placeholder function)
125
130
  "[&_.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",
126
- N
131
+ P
127
132
  ),
128
133
  // Inline styles needed because Tailwind CSS 4 JIT doesn't apply to dynamically created elements
129
134
  style: "width: 100%; min-height: 100%; max-width: none;",
@@ -132,15 +137,17 @@ const et = J(
132
137
  }
133
138
  }
134
139
  });
135
- _(() => {
136
- if (t && i !== void 0) {
140
+ u(() => {
141
+ if (t && n !== void 0) {
137
142
  const e = t.getHTML();
138
- (i || "<p></p>") !== (e || "<p></p>") && t.commands.setContent(i, !1);
143
+ (n || "<p></p>") !== (e || "<p></p>") && t.commands.setContent(n, !1);
139
144
  }
140
- }, [t, i]), _(() => {
141
- t && t.setEditable(!o && !d);
142
- }, [t, o, d]), $(
143
- S,
145
+ }, [t, n]), u(() => {
146
+ t && t.setEditable(!i && !f);
147
+ }, [t, i, f]), u(() => {
148
+ t && o != null && y(t.storage.characterCount.characters());
149
+ }, [t, o, n]), J(
150
+ A,
144
151
  () => ({
145
152
  editor: t,
146
153
  focus: () => t == null ? void 0 : t.commands.focus(),
@@ -152,51 +159,75 @@ const et = J(
152
159
  }),
153
160
  [t]
154
161
  );
155
- const r = Y(t), u = I(null), j = o ? "disabled" : l ? "error" : "default", A = typeof l == "string" ? l : void 0, B = {
156
- minHeight: `${Math.max(z, 200)}px`,
157
- maxHeight: a ? typeof a == "number" ? `${a}px` : a : void 0,
158
- resize: P && !o ? "vertical" : "none"
162
+ const r = st(t), _ = Q(null), $ = i ? "disabled" : a ? "error" : "default", I = typeof a == "string" ? a : void 0, K = `${Math.max(R, 200)}px`, W = j && o != null ? /* @__PURE__ */ p(
163
+ "span",
164
+ {
165
+ className: x(
166
+ ct({
167
+ variant: "body",
168
+ weight: "regular",
169
+ size: "sm"
170
+ }),
171
+ "text-comp-input-text-secondary"
172
+ ),
173
+ children: [
174
+ B,
175
+ "/",
176
+ o
177
+ ]
178
+ }
179
+ ) : void 0, q = {
180
+ minHeight: K,
181
+ maxHeight: c ? typeof c == "number" ? `${c}px` : c : void 0,
182
+ resize: S && !i ? "vertical" : "none"
159
183
  };
160
- return /* @__PURE__ */ s("div", { ref: u, children: /* @__PURE__ */ s(
161
- tt,
184
+ return /* @__PURE__ */ l("div", { ref: _, children: /* @__PURE__ */ l(
185
+ at,
162
186
  {
163
- label: E,
164
- hint: A || T,
165
- error: !!l,
166
- required: M,
187
+ label: L,
188
+ hint: I || M,
189
+ error: !!a,
190
+ required: z,
167
191
  disableRequiredAsterisk: H,
168
- className: R,
169
- infoTooltip: C,
170
- children: /* @__PURE__ */ k("div", { className: et({ state: j }), children: [
171
- V && /* @__PURE__ */ s(
172
- Q,
192
+ className: U,
193
+ infoTooltip: w,
194
+ labelRight: W,
195
+ children: /* @__PURE__ */ p("div", { className: mt({ state: $ }), children: [
196
+ O && /* @__PURE__ */ l(
197
+ nt,
173
198
  {
174
199
  editor: t,
175
200
  toolbarConfig: m,
176
- disabled: o,
177
- translations: p.textEditor,
201
+ disabled: i,
202
+ translations: k.textEditor,
178
203
  onLinkClick: r.handleLinkToolbarClick,
179
- toolbarExtra: f
204
+ toolbarExtra: h
180
205
  }
181
206
  ),
182
- /* @__PURE__ */ k(
207
+ /* @__PURE__ */ p(
183
208
  "div",
184
209
  {
185
- className: b(
186
- "relative overflow-auto px-2xl py-xl",
210
+ className: x(
211
+ "relative flex flex-col overflow-auto px-2xl py-xl",
187
212
  "mr-[calc(var(--spacing-xl)/2)]",
188
213
  "pr-[calc(var(--spacing-2xl)-var(--spacing-xl)/2)]",
189
214
  // Compensate for scrollbar offset
190
- U
215
+ V
191
216
  ),
192
- style: B,
217
+ style: q,
193
218
  children: [
194
- /* @__PURE__ */ s(D, { editor: t, className: "h-full w-full" }),
195
- t && m.link && /* @__PURE__ */ s(
196
- X,
219
+ /* @__PURE__ */ l(
220
+ et,
221
+ {
222
+ editor: t,
223
+ className: "flex w-full flex-1 [&_div]:grow-1"
224
+ }
225
+ ),
226
+ t && m.link && /* @__PURE__ */ l(
227
+ it,
197
228
  {
198
229
  editor: t,
199
- containerRef: u,
230
+ containerRef: _,
200
231
  linkUrl: r.linkUrl,
201
232
  isEditingLink: r.isEditingLink,
202
233
  onUrlChange: r.setLinkUrl,
@@ -204,7 +235,7 @@ const et = J(
204
235
  onSave: r.handleSaveLink,
205
236
  onRemove: r.handleRemoveLink,
206
237
  onCancel: r.handleCancelEdit,
207
- translations: p.textEditor
238
+ translations: k.textEditor
208
239
  }
209
240
  )
210
241
  ]
@@ -215,7 +246,7 @@ const et = J(
215
246
  ) });
216
247
  }
217
248
  );
218
- rt.displayName = "TextEditor";
249
+ dt.displayName = "TextEditor";
219
250
  export {
220
- rt as TextEditor
251
+ dt as TextEditor
221
252
  };
@@ -4,6 +4,7 @@ declare const meta: Meta<typeof TextEditor>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof TextEditor>;
6
6
  export declare const Default: Story;
7
+ export declare const WithCharacterCounter: Story;
7
8
  export declare const Controlled: Story;
8
9
  export declare const WithFormIntegration: Story;
9
10
  export declare const AllStates: Story;