@invoiceonline/ui-react 0.1.0 → 0.2.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/AGENTS.md +4 -3
- package/CHANGELOG.md +18 -0
- package/dist/components/date-picker/DatePicker.js +1 -1
- package/dist/components/field/Field.d.ts +2 -1
- package/dist/components/field/Field.js +13 -8
- package/dist/components/field-pair/FieldPair.d.ts +29 -13
- package/dist/components/field-pair/FieldPair.js +20 -6
- package/dist/components/text-field/TextField.d.ts +97 -2
- package/dist/components/text-field/TextField.js +76 -5
- package/dist/components/text-field/index.d.ts +2 -2
- package/dist/components/textarea/Textarea.js +1 -1
- package/dist/components/unit-field/UnitField.js +1 -1
- package/dist/index.d.ts +3 -5
- package/dist/index.js +2 -3
- package/dist/internal/useDateFieldTrigger.d.ts +60 -0
- package/dist/internal/useDateFieldTrigger.js +68 -16
- package/dist/internal/useFormReset.js +10 -3
- package/docs/Consuming.mdx +20 -3
- package/llms.txt +7 -13
- package/package.json +1 -5
- package/src/components/date-picker/DatePicker.mdx +18 -14
- package/src/components/date-picker/DatePicker.stories.tsx +1 -1
- package/src/components/field/Field.tsx +40 -18
- package/src/components/field-pair/FieldPair.mdx +13 -9
- package/src/components/field-pair/FieldPair.stories.tsx +11 -2
- package/src/components/field-pair/FieldPair.tsx +76 -27
- package/src/components/filter-facet/FilterFacet.tsx +1 -1
- package/src/components/subject-lookup-field/SubjectLookupField.tsx +3 -3
- package/src/components/text-field/TextField.mdx +258 -38
- package/src/components/text-field/TextField.stories.tsx +311 -3
- package/src/components/text-field/TextField.tsx +259 -5
- package/src/components/text-field/index.ts +3 -0
- package/src/components/textarea/Textarea.mdx +2 -2
- package/src/components/textarea/Textarea.tsx +1 -1
- package/src/components/unit-field/UnitField.mdx +1 -1
- package/src/components/unit-field/UnitField.tsx +1 -1
- package/src/index.ts +0 -1
- package/src/internal/useDateFieldTrigger.tsx +178 -38
- package/src/internal/useFormReset.ts +13 -3
- package/src/recipes/Form.stories.tsx +5 -0
- package/dist/components/date-field/DateField.d.ts +0 -52
- package/dist/components/date-field/DateField.js +0 -45
- package/dist/components/date-field/index.d.ts +0 -2
- package/dist/components/date-field/index.js +0 -1
- package/src/components/date-field/DateField.mdx +0 -340
- package/src/components/date-field/DateField.stories.tsx +0 -221
- package/src/components/date-field/DateField.tsx +0 -176
- package/src/components/date-field/index.ts +0 -1
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
+
import type { Locale } from 'date-fns';
|
|
3
4
|
import { tv } from '../../internal/tailwind-variants';
|
|
4
5
|
import { Icon, type IconName, type IconSize } from '../icon/Icon';
|
|
6
|
+
import type { DatePickerNavLabels } from '../date-picker/DatePicker';
|
|
7
|
+
import {
|
|
8
|
+
useDateFieldTrigger,
|
|
9
|
+
type DateInputInvalidReason,
|
|
10
|
+
} from '../../internal/useDateFieldTrigger';
|
|
5
11
|
import { useFormReset } from '../../internal/useFormReset';
|
|
6
12
|
import { cn } from '../../internal/utils';
|
|
7
13
|
|
|
@@ -16,6 +22,30 @@ import { cn } from '../../internal/utils';
|
|
|
16
22
|
//
|
|
17
23
|
// The floating label, helper and error/success messaging live in `Field` — wrap
|
|
18
24
|
// TextField in it. TextField itself is the field *shell + value*.
|
|
25
|
+
//
|
|
26
|
+
// `type="date"` is NOT a separate component (text-field.md § Purpose, manifest
|
|
27
|
+
// 2.7.0 / 2.15.0): it is this field with a calendar. What changes:
|
|
28
|
+
//
|
|
29
|
+
// - The input stays a real, editable `type="text"` input — never the native date
|
|
30
|
+
// input (delivery.react) — so a typist keys the date straight in; the
|
|
31
|
+
// Select-trigger pattern (a read-only `<button role="combobox">`) is
|
|
32
|
+
// deliberately not reused, it would take typing away.
|
|
33
|
+
// - The value is a `Date` (`value` / `onValueChange`), never the formatted
|
|
34
|
+
// string. The text is shown and parsed in the MARKET's pattern, which the
|
|
35
|
+
// consumer passes as `dateFormat` + `locale`; both are required and nothing
|
|
36
|
+
// defaults to Czech — the field is market-agnostic.
|
|
37
|
+
// - THE WHOLE FIELD IS THE TRIGGER, and the `calendar-dots` glyph forced into the
|
|
38
|
+
// leading slot is decorative (field-readonly.md § Date Picker: "a quiet
|
|
39
|
+
// affordance, NOT an active control"). Hence `role="combobox"` on the input
|
|
40
|
+
// (APG Date Picker Combobox), not `aria-haspopup` on a button. "Whole field" is
|
|
41
|
+
// literal: the open handler sits on a WRAPPER around the shell, because the
|
|
42
|
+
// glyph and the shell padding are siblings of the input and would otherwise be
|
|
43
|
+
// dead area. A press off the input is handled on mouse-down so focus (and a
|
|
44
|
+
// half-typed draft) stays in the input — see `handleTriggerMouseDown` in
|
|
45
|
+
// `useDateFieldTrigger`, which owns every bit of date behaviour (draft/commit,
|
|
46
|
+
// min/max clamp, the ArrowDown route, the blur-into-panel guard, the panel).
|
|
47
|
+
// This file is only the chrome; a `FieldPair` cell in `format="date"` renders
|
|
48
|
+
// the same hook in a borderless Field Segment.
|
|
19
49
|
// =============================================================================
|
|
20
50
|
|
|
21
51
|
// Shell styles — owns border, fill, radius. Focus is a border-colour swap only
|
|
@@ -187,11 +217,33 @@ export type TextFieldState =
|
|
|
187
217
|
// `check`, exactly like UnitField.
|
|
188
218
|
const STATUS_ICON = {
|
|
189
219
|
error: { name: 'warning-circle', className: 'text-status-danger' },
|
|
190
|
-
success: { name: 'check', className: 'text-status-success-solid' },
|
|
220
|
+
success: { name: 'check-circle', className: 'text-status-success-solid' },
|
|
191
221
|
} as const;
|
|
192
222
|
|
|
223
|
+
/**
|
|
224
|
+
* The plain field's types — text-field manifest `delivery.react` lists
|
|
225
|
+
* text / email / tel / url / search / password / numeric / date; `date` is not
|
|
226
|
+
* here because it selects the date mode (`TextFieldDateProps`). Literal names
|
|
227
|
+
* only, so `type` discriminates `TextFieldProps` and nothing outside the
|
|
228
|
+
* manifest (`time`, `color`, `checkbox` …) gets through.
|
|
229
|
+
*
|
|
230
|
+
* `numeric` is the manifest's word, not an HTML type: it renders
|
|
231
|
+
* `type="text"` + `inputMode="numeric"`, right-aligned ("numeric
|
|
232
|
+
* right-aligns", manifest `intent.whenToUse`). A digit string such as an IČO
|
|
233
|
+
* keeps its leading zeros and stays a string; numbers that are computed with
|
|
234
|
+
* belong to NumberField / UnitField, whose formatter accepts the decimal comma
|
|
235
|
+
* the native `type="number"` rejects.
|
|
236
|
+
*/
|
|
237
|
+
export type TextFieldInputType = 'text' | 'email' | 'tel' | 'url' | 'search' | 'password' | 'numeric';
|
|
238
|
+
|
|
193
239
|
export interface TextFieldBaseProps
|
|
194
|
-
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
|
|
240
|
+
extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix' | 'type'> {
|
|
241
|
+
/**
|
|
242
|
+
* Input type from the manifest's list. `"numeric"` renders a right-aligned
|
|
243
|
+
* text input with the numeric keyboard; `"date"` is not here — it selects the
|
|
244
|
+
* date mode (`TextFieldDateProps`).
|
|
245
|
+
*/
|
|
246
|
+
type?: TextFieldInputType;
|
|
195
247
|
/** Field height — md (48) standalone, sm (40) dense rows */
|
|
196
248
|
size?: TextFieldSize;
|
|
197
249
|
/** Visual state; `readonly` renders the native `readonly` attribute (not `disabled`) */
|
|
@@ -218,9 +270,82 @@ type TextFieldTrailingButton =
|
|
|
218
270
|
| { onTrailingIconClick: () => void; trailingIconLabel: string }
|
|
219
271
|
| { onTrailingIconClick?: undefined; trailingIconLabel?: undefined };
|
|
220
272
|
|
|
221
|
-
|
|
273
|
+
/** Text, e-mail, tel, url, search, password, numeric — the plain field. */
|
|
274
|
+
export type TextFieldTextProps = TextFieldBaseProps & TextFieldTrailingButton;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* `type="date"` — a localized text input with the DS Single month Date Picker
|
|
278
|
+
* (text-field manifest delivery.react). The leading slot is forced to
|
|
279
|
+
* `calendar-dots` and there is no trailing affordance, so the glyph props are
|
|
280
|
+
* absent; the native string `value` / `defaultValue` / `onChange` give way to a
|
|
281
|
+
* `Date` in `value` and out through `onValueChange`.
|
|
282
|
+
*/
|
|
283
|
+
export interface TextFieldDateProps
|
|
284
|
+
extends Omit<
|
|
285
|
+
TextFieldBaseProps,
|
|
286
|
+
'type' | 'value' | 'defaultValue' | 'onChange' | 'leadingIcon' | 'trailingIcon'
|
|
287
|
+
> {
|
|
288
|
+
type: 'date';
|
|
289
|
+
/**
|
|
290
|
+
* The chosen date. Controlled while it is not `undefined`; leave it out (and
|
|
291
|
+
* use `defaultValue`) for an uncontrolled field.
|
|
292
|
+
*/
|
|
293
|
+
value?: Date;
|
|
294
|
+
/** Initial date of an uncontrolled field (`value` left out). */
|
|
295
|
+
defaultValue?: Date;
|
|
296
|
+
/**
|
|
297
|
+
* The committed date — a parsed typed draft, a picked day, or `undefined` when
|
|
298
|
+
* cleared or when a typed draft is rejected.
|
|
299
|
+
*/
|
|
300
|
+
onValueChange?: (value: Date | undefined) => void;
|
|
301
|
+
/**
|
|
302
|
+
* A typed draft was rejected on commit (blur or Enter) — `'unparseable'` (not in `dateFormat`)
|
|
303
|
+
* or `'out-of-range'` (outside `minDate` / `maxDate`). The typed text stays in
|
|
304
|
+
* the input and the value becomes `undefined` (reported through
|
|
305
|
+
* `onValueChange` first); this tells the consumer why, e.g. to show an error
|
|
306
|
+
* on the `Field` next to that text.
|
|
307
|
+
*/
|
|
308
|
+
onInvalidInput?: (raw: string, reason: DateInputInvalidReason) => void;
|
|
309
|
+
/**
|
|
310
|
+
* Display + parse pattern, date-fns syntax — the MARKET's, from the consumer
|
|
311
|
+
* (e.g. `dd. MM. yyyy` CZ, `MM/dd/yyyy` US, `dd/MM/yyyy` GB). Required, no
|
|
312
|
+
* default.
|
|
313
|
+
*/
|
|
314
|
+
dateFormat: string;
|
|
315
|
+
/** date-fns Locale of the market: the panel's week start, weekday and month names. Required, no default. */
|
|
316
|
+
locale: Locale;
|
|
317
|
+
/** Earliest / latest selectable day — bounds both the panel and a typed date. */
|
|
318
|
+
minDate?: Date;
|
|
319
|
+
maxDate?: Date;
|
|
320
|
+
/**
|
|
321
|
+
* Id of the visible text naming the calendar panel (`aria-labelledby`). `Field`
|
|
322
|
+
* injects its `<label>` id here — inside a labelled `Field` there is nothing to
|
|
323
|
+
* pass (overlay-behavior.md § Naming).
|
|
324
|
+
*/
|
|
325
|
+
panelLabelledBy?: string;
|
|
326
|
+
/**
|
|
327
|
+
* Accessible name for the calendar panel (`role="dialog"`), used only when
|
|
328
|
+
* nothing else names it. The order: `panelLabelledBy` (a `Field` label), the
|
|
329
|
+
* field's own `aria-labelledby`, `panelLabel`, the field's own `aria-label`.
|
|
330
|
+
* Inside a labelled `Field`, or with `aria-label` on the field, there is
|
|
331
|
+
* nothing to pass. Never defaulted — the design system is locale-agnostic; a
|
|
332
|
+
* dialog left without any name warns in development.
|
|
333
|
+
*/
|
|
334
|
+
panelLabel?: string;
|
|
335
|
+
/** Accessible names for the panel's four navigation chevrons. */
|
|
336
|
+
navLabels: DatePickerNavLabels;
|
|
337
|
+
/** Applied to the trigger wrapper around the shell. */
|
|
338
|
+
className?: string;
|
|
339
|
+
leadingIcon?: never;
|
|
340
|
+
trailingIcon?: never;
|
|
341
|
+
onTrailingIconClick?: never;
|
|
342
|
+
trailingIconLabel?: never;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export type TextFieldProps = TextFieldTextProps | TextFieldDateProps;
|
|
222
346
|
|
|
223
|
-
|
|
347
|
+
// The shell + value. Both modes render through it; the date mode as `type="text"`.
|
|
348
|
+
const TextFieldShell = React.forwardRef<HTMLInputElement, TextFieldTextProps>(
|
|
224
349
|
(
|
|
225
350
|
{
|
|
226
351
|
className,
|
|
@@ -241,6 +366,7 @@ const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
241
366
|
// Native attributes win when set explicitly; otherwise derive from `state`.
|
|
242
367
|
const isDisabled = disabled ?? state === 'disabled';
|
|
243
368
|
const isReadOnly = readOnly ?? state === 'readonly';
|
|
369
|
+
const isNumeric = type === 'numeric';
|
|
244
370
|
const currentState: TextFieldState = isDisabled
|
|
245
371
|
? 'disabled'
|
|
246
372
|
: isReadOnly
|
|
@@ -364,13 +490,15 @@ const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
364
490
|
|
|
365
491
|
<input
|
|
366
492
|
ref={setRefs}
|
|
367
|
-
type={type}
|
|
493
|
+
type={isNumeric ? 'text' : type}
|
|
494
|
+
inputMode={isNumeric ? 'numeric' : undefined}
|
|
368
495
|
data-fods-part="value"
|
|
369
496
|
// The placeholder stays in the DOM, only hidden, while the dash shows: it may
|
|
370
497
|
// be the field's only accessible name (the dash is aria-hidden), and the
|
|
371
498
|
// browser falls back to it only when no label names the input.
|
|
372
499
|
className={cn(
|
|
373
500
|
textFieldValueVariants({ state: currentState }),
|
|
501
|
+
isNumeric && 'text-right',
|
|
374
502
|
showEmptyDash && 'placeholder:text-transparent',
|
|
375
503
|
)}
|
|
376
504
|
disabled={isDisabled}
|
|
@@ -386,6 +514,132 @@ const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(
|
|
|
386
514
|
);
|
|
387
515
|
},
|
|
388
516
|
);
|
|
517
|
+
TextFieldShell.displayName = 'TextFieldShell';
|
|
518
|
+
|
|
519
|
+
const TextFieldDate = React.forwardRef<HTMLInputElement, TextFieldDateProps>(
|
|
520
|
+
(
|
|
521
|
+
{
|
|
522
|
+
value: valueProp,
|
|
523
|
+
defaultValue,
|
|
524
|
+
onValueChange,
|
|
525
|
+
onInvalidInput,
|
|
526
|
+
dateFormat,
|
|
527
|
+
locale,
|
|
528
|
+
minDate,
|
|
529
|
+
maxDate,
|
|
530
|
+
panelLabelledBy,
|
|
531
|
+
panelLabel,
|
|
532
|
+
navLabels,
|
|
533
|
+
className,
|
|
534
|
+
state,
|
|
535
|
+
disabled,
|
|
536
|
+
readOnly,
|
|
537
|
+
onBlur,
|
|
538
|
+
onKeyDown,
|
|
539
|
+
...props
|
|
540
|
+
},
|
|
541
|
+
ref,
|
|
542
|
+
) => {
|
|
543
|
+
const isDisabled = disabled ?? state === 'disabled';
|
|
544
|
+
const isReadOnly = readOnly ?? state === 'readonly';
|
|
545
|
+
|
|
546
|
+
// Controllable value — the repo's rule (`useControllable` in
|
|
547
|
+
// StatusSummaryBar): controlled while `value` is not `undefined`. The inner
|
|
548
|
+
// date is only the uncontrolled store, so it is cleared whenever the field
|
|
549
|
+
// is controlled — otherwise a controlled field reset to `undefined` from
|
|
550
|
+
// outside would fall back to a date picked while it was briefly empty.
|
|
551
|
+
const [innerValue, setInnerValue] = React.useState<Date | undefined>(defaultValue);
|
|
552
|
+
const isControlled = valueProp !== undefined;
|
|
553
|
+
if (isControlled && innerValue !== undefined) setInnerValue(undefined);
|
|
554
|
+
const value = isControlled ? valueProp : innerValue;
|
|
555
|
+
const handleValueChange = (next: Date | undefined) => {
|
|
556
|
+
if (!isControlled) setInnerValue(next);
|
|
557
|
+
onValueChange?.(next);
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
// The input is React-controlled (its text comes from the trigger), so a
|
|
561
|
+
// native form.reset() cannot restore it by itself: an uncontrolled date
|
|
562
|
+
// field goes back to its `defaultValue` here, like a plain input would.
|
|
563
|
+
// A half-typed draft is dropped in either mode, or the next blur would
|
|
564
|
+
// commit it and undo the reset.
|
|
565
|
+
const innerRef = React.useRef<HTMLInputElement | null>(null);
|
|
566
|
+
const setRefs = React.useCallback(
|
|
567
|
+
(node: HTMLInputElement | null) => {
|
|
568
|
+
innerRef.current = node;
|
|
569
|
+
if (typeof ref === 'function') ref(node);
|
|
570
|
+
else if (ref) ref.current = node;
|
|
571
|
+
},
|
|
572
|
+
[ref],
|
|
573
|
+
);
|
|
574
|
+
useFormReset(
|
|
575
|
+
innerRef,
|
|
576
|
+
() => {
|
|
577
|
+
trigger.clearDraft();
|
|
578
|
+
if (!isControlled) setInnerValue(defaultValue);
|
|
579
|
+
},
|
|
580
|
+
props.form,
|
|
581
|
+
);
|
|
582
|
+
|
|
583
|
+
const trigger = useDateFieldTrigger({
|
|
584
|
+
value,
|
|
585
|
+
onValueChange: handleValueChange,
|
|
586
|
+
onInvalidInput,
|
|
587
|
+
dateFormat,
|
|
588
|
+
locale,
|
|
589
|
+
minDate,
|
|
590
|
+
maxDate,
|
|
591
|
+
disabled: isDisabled,
|
|
592
|
+
readOnly: isReadOnly,
|
|
593
|
+
// The field's own name is the dialog's name too when nothing visible
|
|
594
|
+
// labels it (overlay-behavior.md § Naming) — no second string to translate.
|
|
595
|
+
panelLabelledBy: panelLabelledBy ?? props['aria-labelledby'],
|
|
596
|
+
panelLabel: panelLabel ?? props['aria-label'],
|
|
597
|
+
navLabels,
|
|
598
|
+
inputRef: setRefs,
|
|
599
|
+
});
|
|
600
|
+
|
|
601
|
+
return (
|
|
602
|
+
<>
|
|
603
|
+
{/* The whole field is the trigger — hence the click handler here and not
|
|
604
|
+
on the input, whose siblings (the glyph, the shell padding) would
|
|
605
|
+
otherwise be dead area. No keyboard handler pairs with it: the wrapper
|
|
606
|
+
only widens the hit area of the <input> inside, which is the real
|
|
607
|
+
control and carries the keyboard route (ArrowDown) itself. */}
|
|
608
|
+
<div {...trigger.triggerProps} className={cn('w-full', className)}>
|
|
609
|
+
<TextFieldShell
|
|
610
|
+
{...props}
|
|
611
|
+
ref={trigger.setInputRef}
|
|
612
|
+
// A localized text input, never the native date input (delivery.react).
|
|
613
|
+
type="text"
|
|
614
|
+
state={state}
|
|
615
|
+
disabled={isDisabled}
|
|
616
|
+
readOnly={isReadOnly}
|
|
617
|
+
// Decorative: the FIELD is the trigger. The shell steps it down to
|
|
618
|
+
// --icon-muted when read-only.
|
|
619
|
+
leadingIcon="calendar-dots"
|
|
620
|
+
{...trigger.getInputProps({ onBlur, onKeyDown })}
|
|
621
|
+
/>
|
|
622
|
+
</div>
|
|
623
|
+
|
|
624
|
+
{trigger.panel}
|
|
625
|
+
</>
|
|
626
|
+
);
|
|
627
|
+
},
|
|
628
|
+
);
|
|
629
|
+
TextFieldDate.displayName = 'TextFieldDate';
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Single-line text input. `type="date"` turns it into the date field (a Date in,
|
|
633
|
+
* a Date out, the market's `dateFormat` + `locale`, the DS calendar on click);
|
|
634
|
+
* every other `type` is the plain field.
|
|
635
|
+
*/
|
|
636
|
+
const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>((props, ref) =>
|
|
637
|
+
props.type === 'date' ? (
|
|
638
|
+
<TextFieldDate {...props} ref={ref} />
|
|
639
|
+
) : (
|
|
640
|
+
<TextFieldShell {...props} ref={ref} />
|
|
641
|
+
),
|
|
642
|
+
);
|
|
389
643
|
TextField.displayName = 'TextField';
|
|
390
644
|
|
|
391
645
|
export { TextField, textFieldShellVariants, textFieldValueVariants };
|
|
@@ -35,7 +35,7 @@ Use it for longer, free-form text: invoice remarks (*poznámky*), descriptions,
|
|
|
35
35
|
|
|
36
36
|
- **Shell** — outlined `<div>` that owns the border/fill/radius/padding: `--bg-primary` fill, `--outline-default` 1px border, `--radius-400`. Height rests at the shared single-line input height (`minRows` default 1, no floor since 2026-09-02) — the inner textarea **auto-grows** with content, then scrolls at `maxRows`.
|
|
37
37
|
- **Value** — a borderless, transparent native `<textarea>`, `Body/M/Regular` (line-height 24) in **both** sizes — parity with Text Field; full width, top-aligned, wraps. `--text-primary` when filled; the placeholder is `--text-placeholder` (claudy/400 — one tier quieter than the label, so an empty field reads value > label > placeholder). An empty **disabled** field shows no placeholder: it shows an en dash `–` in `--disabled-foreground` (visual only, `aria-hidden`); the placeholder stays in the DOM, transparent, as the accessible-name fallback.
|
|
38
|
-
- **Status icon** — pinned **top-right** so it holds position as the field grows. Intrinsic (no leading/trailing user slots): appears only on Error / Success. **Error → `warning-circle`**, **Success → `check`** (exactly like UnitField); size 24 (medium) / 20 (small).
|
|
38
|
+
- **Status icon** — pinned **top-right** so it holds position as the field grows. Intrinsic (no leading/trailing user slots): appears only on Error / Success. **Error → `warning-circle`**, **Success → `check-circle`** (exactly like UnitField); size 24 (medium) / 20 (small).
|
|
39
39
|
- **Resize grip** — a painted `--icon-muted` diagonal glyph (10×10, 1.5px strokes, round caps) pinned to the shell's bottom-right corner; the browser's own `::-webkit-resizer` is hidden so only this one shows. It marks native `resize: vertical` and stays pointer-transparent — the drag zone is the textarea's own corner (which is why padding lives on the `<textarea>`, not the shell). Shown on the **editable states only** (default/focused/error/success); dropped on disabled.
|
|
40
40
|
- **Floating label / helper / optional marker** — not owned by `Textarea`; provided by the wrapping [`Field`](?path=/docs/design-system-atoms-field--docs).
|
|
41
41
|
- **Counter** — a live `used/limit` count rendered by the component **below the shell** (`--text-secondary`, reddens over the limit). Toggled by `counter`, requires a `limit`.
|
|
@@ -94,7 +94,7 @@ Both open at the single-line resting height — Medium 48, Small 40, the same sh
|
|
|
94
94
|
- **Focused** — border `--outline-focus`, **no ring**. Label floats even when empty (focus is the editing state). Grip present. Success + focus is this same plain swap.
|
|
95
95
|
- **Error** — `--status-danger` border + top-right `warning-circle` icon; the field sets `aria-invalid`, and the wrapping `Field` renders the message in `--status-danger`. Label floats even when empty. Grip present.
|
|
96
96
|
- **Error + focus** — a composition, not a seventh state value. The border **keeps** `--status-danger` and goes from `--border-width-100` to `--border-width-200` while the field has focus — colour carries the state, weight carries the focus; `--outline-focus` never shows on an invalid field (a blue border would say "fine" while label, icon and message say "wrong", and tabbing through an invalid form would blink red → blue → red). The added weight sits **inside** the shell — an inset `box-shadow` of `calc(var(--border-width-200) - var(--border-width-100))` on top of the 1px border — so the shell does not grow and the content does not shift. Label, top-right `warning-circle` icon and message stay exactly as in Error; the floating-label notch widens from `--border-width-100` to `--border-width-200`, so no red line shows under the label.
|
|
97
|
-
- **Success** — `--status-success-solid` border + top-right `check` icon, but the floating **label and the confirmation message** are `--status-success-tint-foreground` (5.09:1 on white): `-solid` is 3.35:1, which clears only the 3:1 non-text bar, so it never carries text (manifest changelog 2026-07-31, upstream PR #148). Empty stays inside (a field isn't validated-valid while blank). Grip present.
|
|
97
|
+
- **Success** — `--status-success-solid` border + top-right `check-circle` icon, but the floating **label and the confirmation message** are `--status-success-tint-foreground` (5.09:1 on white): `-solid` is 3.35:1, which clears only the 3:1 non-text bar, so it never carries text (manifest changelog 2026-07-31, upstream PR #148). Empty stays inside (a field isn't validated-valid while blank). Grip present.
|
|
98
98
|
- **Disabled** — `--outline-default` border at `--border-width-100`, `--disabled-background` fill, content in `--disabled-foreground` (empty → `–`), `resize` forced to `none` (**no grip**). Drops out of the tab order.
|
|
99
99
|
- **Read-only** — **deferred**, not built as a variant. When a locked multi-line value is needed, apply the shared `field-readonly` recipe (`readonly`, not `disabled`) — do not fake it with disabled.
|
|
100
100
|
|
|
@@ -130,7 +130,7 @@ const textareaCounterVariants = tv({
|
|
|
130
130
|
// exactly like UnitField.
|
|
131
131
|
const STATUS_ICON: Record<'error' | 'success', { name: IconName; className: string }> = {
|
|
132
132
|
error: { name: 'warning-circle', className: 'text-status-danger' },
|
|
133
|
-
success: { name: 'check', className: 'text-status-success-solid' },
|
|
133
|
+
success: { name: 'check-circle', className: 'text-status-success-solid' },
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
// Resize grip — two diagonal strokes pinned to the shell's bottom-right corner
|
|
@@ -211,5 +211,5 @@ import { Field, UnitField } from '@invoiceonline/ui-react';
|
|
|
211
211
|
- **Status icon moved to leading** — a deliberate divergence from TextField/NumberField's trailing status icon, forced by the unit suffix owning the trailing slot (default `unitPosition="suffix"`).
|
|
212
212
|
- **`unitPosition="prefix"` is now in the upstream spec** — originally an FE-ahead-of-spec extension, the mirrored layout was adopted upstream as the **Unit side** axis (`Right` default · `Left`) in manifest v1.3.0 (2026-07-19), growing the variant matrix from 12 to 24.
|
|
213
213
|
- **Unit suffix retuned to `--text-placeholder`** (spec v1.3.0, 2026-07-19) — originally `--text-secondary`; the unit now sits one tier below the value in every state, including Read-only (see Rationale §1). Manifest 1.8.0 (2026-09-22) carved out Disabled: there the unit mutes to `--disabled-foreground` with the rest of the content.
|
|
214
|
-
-
|
|
214
|
+
- **Status icons match the spec:** `warning-circle` on Error and `check-circle` on Success.
|
|
215
215
|
- **cs-CZ display formatting is implemented** — the spec's format rule (space thousands-separator, comma decimals — `1 000,00`, applied on display and re-parsed on edit, decimals derived from `unit`) is handled by the shared `NumberFormatInput` core. The `<input>` still holds the raw number; consumers read it via `onValueChange` and pass a numeric `value` / `defaultValue`.
|
|
@@ -148,7 +148,7 @@ export interface UnitFieldProps
|
|
|
148
148
|
// leading by default, trailing when the unit is a prefix.
|
|
149
149
|
const STATUS_ICON = {
|
|
150
150
|
error: { name: 'warning-circle', className: 'text-status-danger' },
|
|
151
|
-
success: { name: 'check', className: 'text-status-success-solid' },
|
|
151
|
+
success: { name: 'check-circle', className: 'text-status-success-solid' },
|
|
152
152
|
} as const;
|
|
153
153
|
|
|
154
154
|
const UnitField = React.forwardRef<HTMLInputElement, UnitFieldProps>(
|
package/src/index.ts
CHANGED
|
@@ -11,7 +11,6 @@ export * from './components/checkbox';
|
|
|
11
11
|
export * from './components/chip';
|
|
12
12
|
export * from './components/column-header';
|
|
13
13
|
export * from './components/combobox-field';
|
|
14
|
-
export * from './components/date-field';
|
|
15
14
|
export * from './components/date-picker';
|
|
16
15
|
export * from './components/divider';
|
|
17
16
|
export * from './components/drawer';
|