@modoock/components 1.0.0

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.
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # @modoock/components
2
+
3
+ Official Modooock source components for internal projects.
4
+
5
+ ## Purpose
6
+
7
+ This package contains reusable Modooock UI components distributed as source code.
8
+
9
+ Components are intended to be copied into projects and owned locally, following the Modooock component architecture.
10
+
11
+ ## Included Components
12
+
13
+ The package currently includes the components under:
14
+
15
+ ```text
16
+ components/ui/
17
+ ```
18
+
19
+ ## Version
20
+
21
+ Current version: `1.0.0`
@@ -0,0 +1,42 @@
1
+ import ClickableButton from "./button";
2
+ import type { ButtonVariant } from "./button";
3
+
4
+ export interface ActionStackItem {
5
+ key: string;
6
+ label: string;
7
+ variant?: ButtonVariant;
8
+ onClick: () => void;
9
+ }
10
+
11
+ /**
12
+ * Pile verticale de boutons d'action, avec message si aucune action n'est disponible.
13
+ */
14
+ export default function ActionStack({
15
+ actions,
16
+ emptyMessage,
17
+ }: {
18
+ actions: ActionStackItem[];
19
+ emptyMessage?: string;
20
+ }) {
21
+ if (actions.length === 0) {
22
+ return emptyMessage ? (
23
+ <p className="text-body text-muted-foreground">{emptyMessage}</p>
24
+ ) : null;
25
+ }
26
+
27
+ return (
28
+ <div className="flex flex-col gap-inline">
29
+ {actions.map((action) => (
30
+ <ClickableButton
31
+ key={action.key}
32
+ type="button"
33
+ variant={action.variant}
34
+ fullWidth
35
+ onClick={action.onClick}
36
+ >
37
+ {action.label}
38
+ </ClickableButton>
39
+ ))}
40
+ </div>
41
+ );
42
+ }
@@ -0,0 +1,43 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ type BadgeVariant =
4
+ | "default"
5
+ | "primary"
6
+ | "secondary"
7
+ | "success"
8
+ | "warning"
9
+ | "danger"
10
+ | "info"
11
+ | "accent";
12
+
13
+ export interface BadgeProps {
14
+ children: ReactNode;
15
+ variant?: BadgeVariant;
16
+ className?: string;
17
+ }
18
+
19
+ const badgeStyles: Record<BadgeVariant, string> = {
20
+ default: "bg-surface-muted text-muted-foreground",
21
+ primary: "bg-primary-light text-primary",
22
+ secondary: "bg-surface text-foreground border border-border",
23
+ success: "bg-success-light text-success-foreground",
24
+ warning: "bg-warning-light text-warning-foreground",
25
+ danger: "bg-danger-light text-danger-foreground",
26
+ info: "bg-info-light text-info-foreground",
27
+ accent: "bg-accent-light text-accent",
28
+ };
29
+
30
+ export default function Badge({
31
+ children,
32
+ variant = "default",
33
+ className = "",
34
+ }: BadgeProps) {
35
+ return (
36
+ <span
37
+ className={`inline-flex items-center justify-center rounded-full px-component py-micro text-label whitespace-nowrap ${badgeStyles[variant]} ${className}`}
38
+ >
39
+ {children}
40
+ </span>
41
+ );
42
+ }
43
+
@@ -0,0 +1,104 @@
1
+ import type { ButtonHTMLAttributes, ReactNode } from "react";
2
+ import Icon from "./icon";
3
+
4
+ export type ButtonVariant =
5
+ | "primary"
6
+ | "secondary"
7
+ | "ghost"
8
+ | "bare"
9
+ | "success"
10
+ | "warning"
11
+ | "danger"
12
+ | "info"
13
+ | "accent";
14
+
15
+ export type ButtonSize = "sm" | "md" | "lg" | "icon";
16
+
17
+ export interface ClickableButtonProps
18
+ extends ButtonHTMLAttributes<HTMLButtonElement> {
19
+ children: ReactNode;
20
+ variant?: ButtonVariant;
21
+ /** Controls the height, padding and radius of the button. */
22
+ size?: ButtonSize;
23
+ /** Optional leading icon (replaced by a spinner while `loading`). */
24
+ leftIcon?: ReactNode;
25
+ /** Optional trailing icon. */
26
+ rightIcon?: ReactNode;
27
+ /** Shows a spinner, disables the button and prevents interactions. */
28
+ loading?: boolean;
29
+ /** Text displayed while `loading` (defaults to `children`). */
30
+ loadingText?: string;
31
+ /** Expands the button to fill the available width. */
32
+ fullWidth?: boolean;
33
+ }
34
+
35
+ const BASE_CLASS =
36
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-medium text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-60 [&_svg]:size-[var(--icon-small)] [&_svg]:shrink-0 [&_svg]:text-current";
37
+
38
+ const SIZE_CLASS: Record<ButtonSize, string> = {
39
+ sm: "h-9 px-3",
40
+ md: "h-10 px-4",
41
+ lg: "h-11 px-5",
42
+ /* Icon-only button: square, no horizontal padding. */
43
+ icon: "h-10 w-10 px-0",
44
+ };
45
+
46
+ const VARIANT_CLASS: Record<ButtonVariant, string> = {
47
+ primary:
48
+ "bg-primary text-white hover:bg-primary-hover active:bg-primary-active focus-visible:ring-primary",
49
+ secondary:
50
+ "border border-border bg-surface text-foreground hover:border-primary hover:text-primary focus-visible:ring-primary",
51
+ ghost:
52
+ "bg-transparent text-muted-foreground hover:text-primary focus-visible:ring-primary",
53
+ success:
54
+ "bg-success text-white hover:brightness-90 active:brightness-80 focus-visible:ring-success",
55
+ warning:
56
+ "bg-warning text-white hover:brightness-90 active:brightness-80 focus-visible:ring-warning",
57
+ danger:
58
+ "bg-danger text-white hover:brightness-90 active:brightness-80 focus-visible:ring-danger",
59
+ info: "bg-info text-white hover:brightness-90 active:brightness-80 focus-visible:ring-info",
60
+ accent:
61
+ "bg-accent text-accent-foreground hover:bg-accent-hover active:brightness-80 focus-visible:ring-accent",
62
+ /* No built-in styles: the caller provides everything via className. */
63
+ bare: "",
64
+ };
65
+
66
+ export default function ClickableButton({
67
+ children,
68
+ variant = "primary",
69
+ size = "md",
70
+ leftIcon,
71
+ rightIcon,
72
+ loading = false,
73
+ loadingText,
74
+ fullWidth = false,
75
+ disabled,
76
+ className = "",
77
+ ...props
78
+ }: ClickableButtonProps) {
79
+ const isDisabled = disabled || loading;
80
+ const resolvedLabel = loading && loadingText ? loadingText : children;
81
+
82
+ return (
83
+ <button
84
+ type="button"
85
+ aria-busy={loading || undefined}
86
+ disabled={isDisabled}
87
+ className={`${BASE_CLASS} ${VARIANT_CLASS[variant]} ${SIZE_CLASS[size]} ${fullWidth ? "w-full" : ""} ${className}`}
88
+ {...props}
89
+ >
90
+ {loading ? (
91
+ <Icon
92
+ name="LoaderCircle"
93
+ size="small"
94
+ className="animate-spin"
95
+ aria-hidden="true"
96
+ />
97
+ ) : (
98
+ leftIcon
99
+ )}
100
+ {resolvedLabel}
101
+ {!loading && rightIcon}
102
+ </button>
103
+ );
104
+ }
@@ -0,0 +1,78 @@
1
+ import type { SVGProps } from "react";
2
+ import { icons, type LucideIcon } from "lucide-react";
3
+
4
+ /* ------------------------------------------------------------------ */
5
+ /* Icon - centralized interface icon */
6
+ /* */
7
+ /* Single source of truth for icons. Only pick `name`, `variant` and */
8
+ /* `size` from the allowed values defined by the Design System. */
9
+ /* ------------------------------------------------------------------ */
10
+
11
+ /** Available icon sizes from the Iconography section. */
12
+ export type IconSize = "small" | "default" | "large" | "display";
13
+
14
+ /** Available icon variants, aligned with the Design System colors. */
15
+ export type IconVariant =
16
+ | "default"
17
+ | "muted"
18
+ | "primary"
19
+ | "success"
20
+ | "warning"
21
+ | "danger"
22
+ | "white";
23
+
24
+ /** Every exported Lucide icon name (e.g. "Search", "ArrowRight"). */
25
+ export type IconName = keyof typeof icons;
26
+
27
+ export interface IconProps extends Omit<SVGProps<SVGSVGElement>, "size"> {
28
+ /** The Lucide icon name to render. */
29
+ name: IconName;
30
+ /** Color variant; defaults to a neutral foreground icon. */
31
+ variant?: IconVariant;
32
+ /** Size variant following the Iconography tokens. */
33
+ size?: IconSize;
34
+ /** Overrides the Design System default stroke weight (1.8). */
35
+ strokeWidth?: number;
36
+ className?: string;
37
+ }
38
+
39
+ /** Fallback base class: keeps the icon from shrinking inside flex rows. */
40
+ const BASE_CLASS = "shrink-0";
41
+
42
+ const SIZE_CLASS: Record<IconSize, string> = {
43
+ small: "size-[var(--icon-small)]",
44
+ default: "size-[var(--icon-default)]",
45
+ large: "size-[var(--icon-large)]",
46
+ display: "size-[var(--icon-display)]",
47
+ };
48
+
49
+ const VARIANT_CLASS: Record<IconVariant, string> = {
50
+ default: "text-foreground",
51
+ muted: "text-muted-foreground",
52
+ primary: "text-primary",
53
+ success: "text-success",
54
+ warning: "text-warning",
55
+ danger: "text-danger",
56
+ /* White icon intended for colored surfaces (nav items, brand badges). */
57
+ white: "text-white",
58
+ };
59
+
60
+ export default function Icon({
61
+ name,
62
+ variant = "default",
63
+ size = "default",
64
+ strokeWidth = 1.8,
65
+ className = "",
66
+ ...props
67
+ }: IconProps) {
68
+ const IconComponent: LucideIcon = icons[name];
69
+
70
+ return (
71
+ <IconComponent
72
+ aria-hidden="true"
73
+ strokeWidth={strokeWidth}
74
+ className={`${BASE_CLASS} ${SIZE_CLASS[size]} ${VARIANT_CLASS[variant]} ${className}`}
75
+ {...props}
76
+ />
77
+ );
78
+ }
@@ -0,0 +1,28 @@
1
+ export { default as ClickableButton } from "./button";
2
+ export type {
3
+ ClickableButtonProps,
4
+ ButtonVariant,
5
+ ButtonSize,
6
+ } from "./button";
7
+ export { default as Input, Textarea } from "./input";
8
+ export type { InputState, InputProps, TextareaProps } from "./input";
9
+ export {default as Badge} from "./badge";
10
+ export type {BadgeProps} from "./badge";
11
+ export {default as UserTable} from "./user-table";
12
+ export type {Column, CardAction, UserTableCardActions} from "./user-table";
13
+ export { Select, MultiSelect, SelectWithSearch, MultiSelectWithSearch, SelectFilter } from "./select";
14
+ export type { SelectOption } from "./select";
15
+ export { default as Modal } from "./modal";
16
+ export { default as Tabs } from "./tab";
17
+ export type { Tab } from "./tab";
18
+ export { default as Icon } from "./icon";
19
+ export type { IconName, IconVariant, IconSize, IconProps } from "./icon";
20
+ export { default as Loader } from "./loader";
21
+ export type { LoaderProps } from "./loader";
22
+ export { default as MetricBar } from "./metric-bar";
23
+ export type { MetricTone } from "./metric-bar";
24
+ export { default as Stepper } from "./stepper";
25
+ export type { StepperStepState } from "./stepper";
26
+ export { default as ActionStack } from "./action-stack";
27
+ export type { ActionStackItem } from "./action-stack";
28
+
@@ -0,0 +1,376 @@
1
+ "use client";
2
+
3
+ import {
4
+ useId,
5
+ useRef,
6
+ useState,
7
+ type ChangeEvent,
8
+ type InputHTMLAttributes,
9
+ type ReactNode,
10
+ type Ref,
11
+ type TextareaHTMLAttributes,
12
+ } from "react";
13
+ import Icon from "./icon";
14
+
15
+ /** Visual validation state of the field. */
16
+ export type InputState = "valid" | "invalid";
17
+
18
+ const LABEL_CLASS =
19
+ "mb-inline flex items-center gap-micro text-label text-muted-foreground";
20
+
21
+ function RequiredMark() {
22
+ return (
23
+ <span aria-hidden="true" className="text-danger">
24
+ *
25
+ </span>
26
+ );
27
+ }
28
+
29
+ function FieldFeedback({ id, error }: { id: string; error?: string }) {
30
+ if (!error) return null;
31
+ return (
32
+ <p
33
+ id={id}
34
+ className="flex items-start gap-micro text-small text-danger-foreground [&_svg]:size-[var(--icon-small)] [&_svg]:shrink-0"
35
+ >
36
+ <Icon name="CircleAlert" variant="danger" aria-hidden="true" />
37
+ <span>{error}</span>
38
+ </p>
39
+ );
40
+ }
41
+
42
+ export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
43
+ /** Text label shown above the field. */
44
+ label?: string;
45
+ /** Optional leading icon/control inside the field. */
46
+ icon?: ReactNode;
47
+ /** Optional static adornment shown at the right of the field. */
48
+ trailingIcon?: ReactNode;
49
+ /** Visual validation state: tints the border and shows a feedback icon. */
50
+ state?: InputState;
51
+ /** Error message shown below the field (overrides `helper`). */
52
+ error?: string;
53
+ /** Unstyled helper text shown below the field. */
54
+ helper?: string;
55
+ /** Marks the field as required (renders `*` and sets `aria-required`). */
56
+ required?: boolean;
57
+ /** When set, shows a "clear" action as soon as the field has a value. */
58
+ clearable?: boolean;
59
+ /** Shorthand for a password field with a visibility toggle (same as `type="password"`). */
60
+ password?: boolean;
61
+ /** Shows a live character counter (uses `maxLength` when provided). */
62
+ counter?: boolean;
63
+ /** Extra callback fired after the field value is cleared. */
64
+ onClear?: () => void;
65
+ /** React 19 forwarded ref. */
66
+ ref?: Ref<HTMLInputElement>;
67
+ }
68
+
69
+ export default function Input({
70
+ label,
71
+ icon,
72
+ trailingIcon,
73
+ state,
74
+ error,
75
+ helper,
76
+ required = false,
77
+ clearable = false,
78
+ password = false,
79
+ counter = false,
80
+ onClear,
81
+ id,
82
+ type,
83
+ disabled,
84
+ maxLength,
85
+ value,
86
+ defaultValue,
87
+ onChange,
88
+ className = "",
89
+ ref,
90
+ ...props
91
+ }: InputProps) {
92
+ const generatedId = useId();
93
+ const helperId = useId();
94
+ const errorId = useId();
95
+ const inputId = id ?? generatedId;
96
+
97
+ const inputRef = useRef<HTMLInputElement>(null);
98
+ const [currentValue, setCurrentValue] = useState<string>(() => {
99
+ if (typeof value === "string") return value;
100
+ if (defaultValue != null) return String(defaultValue);
101
+ return "";
102
+ });
103
+ const [showPassword, setShowPassword] = useState(false);
104
+
105
+ const effectiveValue = typeof value === "string" ? value : currentValue;
106
+
107
+ const isPassword = password || type === "password";
108
+ const resolvedType = isPassword ? (showPassword ? "text" : "password") : type;
109
+
110
+ const hasClear = clearable && effectiveValue.length > 0 && !disabled;
111
+
112
+ /** A semantic feedback icon is shown unless a `trailingIcon` occupies the slot. */
113
+ const feedbackShown = (state !== undefined || Boolean(error)) && !trailingIcon;
114
+
115
+ const rightCount =
116
+ (feedbackShown ? 1 : 0) +
117
+ (trailingIcon ? 1 : 0) +
118
+ (hasClear ? 1 : 0) +
119
+ (isPassword ? 1 : 0);
120
+
121
+ const rightPad =
122
+ rightCount === 0
123
+ ? ""
124
+ : rightCount === 1
125
+ ? "pr-9"
126
+ : rightCount === 2
127
+ ? "pr-[3.75rem]"
128
+ : "pr-[5.25rem]";
129
+
130
+ const describedBy =
131
+ [error ? errorId : helper ? helperId : undefined]
132
+ .filter(Boolean)
133
+ .join(" ") || undefined;
134
+
135
+ const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
136
+ setCurrentValue(event.target.value);
137
+ onChange?.(event);
138
+ };
139
+
140
+ const handleClear = () => {
141
+ setCurrentValue("");
142
+ if (inputRef.current) {
143
+ const inputEl = inputRef.current;
144
+ const setter = Object.getOwnPropertyDescriptor(
145
+ window.HTMLInputElement.prototype,
146
+ "value",
147
+ )?.set;
148
+ setter?.call(inputEl, "");
149
+ inputEl.dispatchEvent(new Event("input", { bubbles: true }));
150
+ inputEl.focus();
151
+ }
152
+ onClear?.();
153
+ };
154
+
155
+ const setRefs = (el: HTMLInputElement | null) => {
156
+ inputRef.current = el;
157
+ if (typeof ref === "function") ref(el);
158
+ else if (ref) ref.current = el;
159
+ };
160
+
161
+ const toneClass =
162
+ state === "valid"
163
+ ? "border-success hover:border-success focus:border-success"
164
+ : state === "invalid" || error
165
+ ? "border-danger hover:border-danger focus:border-danger"
166
+ : "";
167
+
168
+ return (
169
+ <div className="w-full">
170
+ {label && (
171
+ <label htmlFor={inputId} className={LABEL_CLASS}>
172
+ <span className="truncate">{label}</span>
173
+ {required && <RequiredMark />}
174
+ </label>
175
+ )}
176
+
177
+ <div className="relative w-full">
178
+ {icon && (
179
+ <span className="pointer-events-none absolute left-3 top-1/2 flex -translate-y-1/2 items-center text-muted-foreground [&_svg]:size-[var(--icon-small)] [&_svg]:shrink-0 [&_svg]:text-current">
180
+ {icon}
181
+ </span>
182
+ )}
183
+
184
+ <input
185
+ ref={setRefs}
186
+ id={inputId}
187
+ type={resolvedType}
188
+ disabled={disabled}
189
+ required={required}
190
+ aria-invalid={state === "invalid" || Boolean(error) || undefined}
191
+ aria-required={required || undefined}
192
+ aria-describedby={describedBy}
193
+ maxLength={maxLength}
194
+ value={value}
195
+ defaultValue={defaultValue}
196
+ onChange={handleChange}
197
+ className={`ds-input ${icon ? "pl-9" : ""} ${rightPad} ${toneClass} ${className}`}
198
+ {...props}
199
+ />
200
+
201
+ {rightCount > 0 && (
202
+ <span className="absolute right-3 top-1/2 flex -translate-y-1/2 items-center gap-inline">
203
+ {state === "valid" && !trailingIcon && (
204
+ <Icon name="Check" variant="success" aria-hidden="true" />
205
+ )}
206
+ {!trailingIcon && (state === "invalid" || error) && (
207
+ <Icon name="CircleAlert" variant="danger" aria-hidden="true" />
208
+ )}
209
+
210
+ {trailingIcon && (
211
+ <span className="pointer-events-none text-muted-foreground [&_svg]:size-[var(--icon-small)] [&_svg]:shrink-0 [&_svg]:text-current">
212
+ {trailingIcon}
213
+ </span>
214
+ )}
215
+
216
+ {hasClear && (
217
+ <button
218
+ type="button"
219
+ onClick={handleClear}
220
+ aria-label="Effacer la valeur"
221
+ className="flex items-center rounded-small text-muted-foreground transition-colors hover:text-foreground [&_svg]:size-[var(--icon-small)] [&_svg]:shrink-0 [&_svg]:text-current"
222
+ >
223
+ <Icon name="X" aria-hidden="true" />
224
+ </button>
225
+ )}
226
+
227
+ {isPassword && (
228
+ <button
229
+ type="button"
230
+ onClick={() => setShowPassword((prev) => !prev)}
231
+ aria-label={
232
+ showPassword
233
+ ? "Masquer le mot de passe"
234
+ : "Afficher le mot de passe"
235
+ }
236
+ className="flex items-center rounded-small text-muted-foreground transition-colors hover:text-foreground [&_svg]:size-[var(--icon-small)] [&_svg]:shrink-0 [&_svg]:text-current"
237
+ >
238
+ {showPassword ? (
239
+ <Icon name="EyeOff" aria-hidden="true" />
240
+ ) : (
241
+ <Icon name="Eye" aria-hidden="true" />
242
+ )}
243
+ </button>
244
+ )}
245
+ </span>
246
+ )}
247
+ </div>
248
+
249
+ {(error || helper || counter) && (
250
+ <div className="mt-inline flex items-start justify-between gap-inline">
251
+ <div className="min-w-0">
252
+ {error ? (
253
+ <FieldFeedback id={errorId} error={error} />
254
+ ) : helper ? (
255
+ <p id={helperId} className="text-small text-muted-foreground">
256
+ {helper}
257
+ </p>
258
+ ) : null}
259
+ </div>
260
+ {counter && (
261
+ <span className="shrink-0 text-small text-muted-foreground">
262
+ {effectiveValue.length}
263
+ {typeof maxLength === "number" ? ` / ${maxLength}` : ""}
264
+ </span>
265
+ )}
266
+ </div>
267
+ )}
268
+ </div>
269
+ );
270
+ }
271
+
272
+ export interface TextareaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {
273
+ label?: string;
274
+ state?: InputState;
275
+ error?: string;
276
+ helper?: string;
277
+ required?: boolean;
278
+ counter?: boolean;
279
+ ref?: Ref<HTMLTextAreaElement>;
280
+ }
281
+
282
+ export function Textarea({
283
+ label,
284
+ state,
285
+ error,
286
+ helper,
287
+ required = false,
288
+ counter = false,
289
+ id,
290
+ disabled,
291
+ maxLength,
292
+ value,
293
+ defaultValue,
294
+ onChange,
295
+ className = "",
296
+ ref,
297
+ ...props
298
+ }: TextareaProps) {
299
+ const generatedId = useId();
300
+ const helperId = useId();
301
+ const errorId = useId();
302
+ const textareaId = id ?? generatedId;
303
+
304
+ const [currentValue, setCurrentValue] = useState<string>(() => {
305
+ if (typeof value === "string") return value;
306
+ if (defaultValue != null) return String(defaultValue);
307
+ return "";
308
+ });
309
+
310
+ const effectiveValue = typeof value === "string" ? value : currentValue;
311
+
312
+ const describedBy =
313
+ [error ? errorId : helper ? helperId : undefined]
314
+ .filter(Boolean)
315
+ .join(" ") || undefined;
316
+
317
+ const handleChange = (event: ChangeEvent<HTMLTextAreaElement>) => {
318
+ setCurrentValue(event.target.value);
319
+ onChange?.(event);
320
+ };
321
+
322
+ const toneClass =
323
+ state === "valid"
324
+ ? "border-success hover:border-success focus:border-success"
325
+ : state === "invalid" || error
326
+ ? "border-danger hover:border-danger focus:border-danger"
327
+ : "";
328
+
329
+ return (
330
+ <div className="w-full">
331
+ {label && (
332
+ <label htmlFor={textareaId} className={LABEL_CLASS}>
333
+ <span className="truncate">{label}</span>
334
+ {required && <RequiredMark />}
335
+ </label>
336
+ )}
337
+
338
+ <textarea
339
+ ref={ref}
340
+ id={textareaId}
341
+ rows={4}
342
+ disabled={disabled}
343
+ required={required}
344
+ aria-invalid={state === "invalid" || Boolean(error) || undefined}
345
+ aria-required={required || undefined}
346
+ aria-describedby={describedBy}
347
+ maxLength={maxLength}
348
+ value={value}
349
+ defaultValue={defaultValue}
350
+ onChange={handleChange}
351
+ className={`ds-input resize-y ${toneClass} ${className}`}
352
+ {...props}
353
+ />
354
+
355
+ {(error || helper || counter) && (
356
+ <div className="mt-inline flex items-start justify-between gap-inline">
357
+ <div className="min-w-0">
358
+ {error ? (
359
+ <FieldFeedback id={errorId} error={error} />
360
+ ) : helper ? (
361
+ <p id={helperId} className="text-small text-muted-foreground">
362
+ {helper}
363
+ </p>
364
+ ) : null}
365
+ </div>
366
+ {counter && (
367
+ <span className="shrink-0 text-small text-muted-foreground">
368
+ {effectiveValue.length}
369
+ {typeof maxLength === "number" ? ` / ${maxLength}` : ""}
370
+ </span>
371
+ )}
372
+ </div>
373
+ )}
374
+ </div>
375
+ );
376
+ }