asma-ui-core 3.68.6 → 3.69.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/dist/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.js +49 -43
- package/dist/components/inputs/dynamic-select/components/DynamicSelectAutocomplete.js +45 -44
- package/dist/components/inputs/input-field/StyledInputField.js +127 -116
- package/dist/components/inputs/radio-button/base-ui/StyledRadioGroup.js +37 -32
- package/dist/components/inputs/search-field/StyledSearchField.js +9 -8
- package/dist/components/inputs/select/StyledSelect.js +123 -111
- package/dist/components/inputs/select-autocomplete/StyledSelectAutocomplete.js +67 -65
- package/dist/components/inputs/slider/StyledSlider.js +69 -61
- package/dist/components/inputs/textarea/StyledTextarea.js +52 -47
- package/dist/datetime/components/date-picker/components/BaseDatePickerInput.js +12 -12
- package/dist/datetime/components/date-picker/hooks/useDatePickerValidation.js +32 -31
- package/dist/datetime/components/time-picker/TimePickerInput.js +19 -18
- package/dist/datetime/components/time-picker/components/HelperText.js +10 -9
- package/dist/helpers/helperTextRoom.js +34 -0
- package/dist/helpers/useHelperAlertRole.js +11 -0
- package/dist/helpers/useHelperRowBudget.js +24 -0
- package/dist/helpers/warnMissingErrorMessage.js +6 -0
- package/dist/index.js +170 -165
- package/dist/src/components/inputs/dynamic-select/components/DynamicInteractiveChipGroup.test.d.ts +1 -0
- package/dist/src/components/inputs/dynamic-select/types.d.ts +1 -1
- package/dist/src/components/inputs/input-field/StyledInputField.d.ts +3 -3
- package/dist/src/components/inputs/input-field/StyledInputField.helper-slot.test.d.ts +1 -0
- package/dist/src/components/inputs/radio-button/base-ui/StyledRadioGroup.d.ts +2 -0
- package/dist/src/components/inputs/select/StyledSelect.d.ts +4 -4
- package/dist/src/components/inputs/select-autocomplete/StyledSelectAutocomplete.d.ts +5 -4
- package/dist/src/components/inputs/slider/StyledSlider.d.ts +2 -2
- package/dist/src/components/inputs/textarea/StyledTextarea.d.ts +1 -0
- package/dist/src/datetime/components/date-picker/hooks/useDatePickerValidation.d.ts +18 -1
- package/dist/src/datetime/components/date-picker/index.d.ts +1 -0
- package/dist/src/datetime/components/time-picker/components/HelperText.d.ts +12 -0
- package/dist/src/datetime/components/time-picker/index.d.ts +1 -0
- package/dist/src/helpers/helperTextRoom.d.ts +9 -0
- package/dist/src/helpers/helperTextRoom.test.d.ts +1 -0
- package/dist/src/helpers/useHelperAlertRole.d.ts +2 -0
- package/dist/src/helpers/useHelperAlertRole.test.d.ts +1 -0
- package/dist/src/helpers/useHelperRowBudget.d.ts +7 -0
- package/dist/src/helpers/warnMissingErrorMessage.d.ts +2 -0
- package/package.json +1 -1
|
@@ -47,7 +47,6 @@ interface DynamicSelectCommonProps<TOption extends DynamicSelectOption> {
|
|
|
47
47
|
* Use this when the field must always have a value.
|
|
48
48
|
*/
|
|
49
49
|
required?: boolean;
|
|
50
|
-
/** @figmaProp Helper text (Helper 14/lh20; falls back to "Required" when `error` and no text). */
|
|
51
50
|
helperText?: React.ReactNode;
|
|
52
51
|
/** Completely removes the helper text block below the autocomplete */
|
|
53
52
|
disableHelperText?: boolean;
|
|
@@ -100,6 +99,7 @@ interface DynamicSelectCommonProps<TOption extends DynamicSelectOption> {
|
|
|
100
99
|
* or empty-state messaging when localized behavior is supported.
|
|
101
100
|
*/
|
|
102
101
|
locale?: 'no' | 'en';
|
|
102
|
+
clearSelectionLabel?: string;
|
|
103
103
|
}
|
|
104
104
|
export type StyledDynamicSelectProps<TOption extends DynamicSelectOption> = DynamicSelectCommonProps<TOption> & (SingleDynamicSelectProps<TOption> | MultipleDynamicSelectProps<TOption>);
|
|
105
105
|
export type StyledDynamicSelectComponent = <TOption extends DynamicSelectOption>(props: StyledDynamicSelectProps<TOption> & React.RefAttributes<HTMLInputElement>) => React.ReactElement | null;
|
|
@@ -17,7 +17,6 @@ type HtmlInputSlot = InputHTMLAttributes<HTMLInputElement> & {
|
|
|
17
17
|
* Error/Disabled/Read only) is driven by native focus/hover + the `error`/`disabled`/`readOnly`
|
|
18
18
|
* props; **Filled** (on/off) is derived from `value`/`defaultValue`. **Unify** and **Mixed state**
|
|
19
19
|
* are Figma-authoring properties with no React counterpart. Non-annotated props are behavioral /
|
|
20
|
-
* MUI `TextField` API-parity (DEC-003).
|
|
21
20
|
*/
|
|
22
21
|
export interface StyledInputFieldProps {
|
|
23
22
|
/** @figmaProp none — test hook */
|
|
@@ -35,6 +34,8 @@ export interface StyledInputFieldProps {
|
|
|
35
34
|
error?: boolean;
|
|
36
35
|
/** @figmaProp Helper text element */
|
|
37
36
|
helperText?: ReactNode;
|
|
37
|
+
reserveHelperText?: boolean;
|
|
38
|
+
expandHelperText?: boolean;
|
|
38
39
|
/** @figmaProp State = true→"Disabled" */
|
|
39
40
|
disabled?: boolean;
|
|
40
41
|
/** @figmaProp State = true→"Read only" */
|
|
@@ -85,10 +86,9 @@ export interface StyledInputFieldProps {
|
|
|
85
86
|
* Outlined text field with a floating label (replaces MUI `TextField`). Self-contained: manages its
|
|
86
87
|
* own focus/value state to drive the shared field styling ([[field-styles]]); supports multiline,
|
|
87
88
|
* start/end adornments, an optional clear button, and error/helper text. Public props preserved
|
|
88
|
-
* (DEC-003). TASK-401.
|
|
89
89
|
*
|
|
90
90
|
* ponytail: `variant` is accepted but always renders outlined, and multiline uses fixed `rows`
|
|
91
91
|
* (no auto-grow to `maxRows`) — known ceilings; Chromatic in CI is the visual gate.
|
|
92
92
|
*/
|
|
93
|
-
export declare const StyledInputField: ({ dataTest, label, value, defaultValue, onChange, onBlur, onFocus, error, helperText, disabled, readOnly, required, allowClear, onClear, type, placeholder, name, id, autoComplete, autoFocus, multiline, rows, minRows, maxRows, size, fullWidth, className, style, sx, inputRef, slotProps, InputProps, onKeyDown, onClick, variant: _variant, }: StyledInputFieldProps) => JSX.Element;
|
|
93
|
+
export declare const StyledInputField: ({ dataTest, label, value, defaultValue, onChange, onBlur, onFocus, error, helperText, reserveHelperText, expandHelperText, disabled, readOnly, required, allowClear, onClear, type, placeholder, name, id, autoComplete, autoFocus, multiline, rows, minRows, maxRows, size, fullWidth, className, style, sx, inputRef, slotProps, InputProps, onKeyDown, onClick, variant: _variant, }: StyledInputFieldProps) => JSX.Element;
|
|
94
94
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -12,6 +12,7 @@ export type StyledRadioGroupProps = {
|
|
|
12
12
|
error?: boolean;
|
|
13
13
|
errorText?: string;
|
|
14
14
|
helperText?: string;
|
|
15
|
+
reserveHelperText?: boolean;
|
|
15
16
|
children: React.ReactNode;
|
|
16
17
|
name?: string;
|
|
17
18
|
} & Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange'>;
|
|
@@ -32,6 +33,7 @@ export declare const StyledRadioGroup: React.ForwardRefExoticComponent<{
|
|
|
32
33
|
error?: boolean;
|
|
33
34
|
errorText?: string;
|
|
34
35
|
helperText?: string;
|
|
36
|
+
reserveHelperText?: boolean;
|
|
35
37
|
children: React.ReactNode;
|
|
36
38
|
name?: string;
|
|
37
39
|
} & Omit<React.HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -11,7 +11,6 @@ export interface SelectChangeEvent<T = unknown> {
|
|
|
11
11
|
* The trigger is the outlined **Input field** (shared `field-styles`: 40px, focus gama-400, hover
|
|
12
12
|
* gama-300); the dropdown is **Menus** (node 16073-19226). Figma field **State** (Enabled/Hovered/
|
|
13
13
|
* Focused/Error/Disabled/Read-only) ← open/focus + `error`/`disabled`/`readOnly`; **Filled** ← `value`.
|
|
14
|
-
* Non-annotated props are behavioral / MUI `Select` API-parity (DEC-003).
|
|
15
14
|
*/
|
|
16
15
|
export interface StyledSelectProps {
|
|
17
16
|
/** @figmaProp none — test hook */
|
|
@@ -22,7 +21,6 @@ export interface StyledSelectProps {
|
|
|
22
21
|
defaultValue?: unknown;
|
|
23
22
|
onChange?: (event: SelectChangeEvent, child: ReactNode) => void;
|
|
24
23
|
/**
|
|
25
|
-
* @figmaProp none — accepted for MUI `Select` / DEC-003 drop-in parity, but **no longer affects
|
|
26
24
|
* rendering**: the trigger value is Body Base 16px and the field is 40px at every size (a smaller
|
|
27
25
|
* size only changed text before; Figma field text is 16/lh24 regardless). Kept so `size="small"`
|
|
28
26
|
* call sites still compile. Ignored on purpose (not destructured).
|
|
@@ -31,6 +29,9 @@ export interface StyledSelectProps {
|
|
|
31
29
|
/** @figmaProp State = true→"Error" */
|
|
32
30
|
error?: boolean;
|
|
33
31
|
errorText?: string;
|
|
32
|
+
helperText?: ReactNode;
|
|
33
|
+
reserveHelperText?: boolean;
|
|
34
|
+
expandHelperText?: boolean;
|
|
34
35
|
/** @figmaProp Clear (trigger clear button) */
|
|
35
36
|
allowClear?: boolean;
|
|
36
37
|
/** @figmaProp State = true→"Disabled" */
|
|
@@ -67,7 +68,6 @@ export interface StyledSelectProps {
|
|
|
67
68
|
/**
|
|
68
69
|
* Single-select dropdown (replaces MUI `Select`) — a trigger styled as the outlined field plus a
|
|
69
70
|
* portalled `role="listbox"`. Reports open/filled into a surrounding `StyledFormControl` so its
|
|
70
|
-
* `StyledInputLabel` floats. Public props preserved (DEC-003). Use inside `StyledFormControl`.
|
|
71
71
|
* TASK-402.
|
|
72
72
|
*/
|
|
73
|
-
export declare const StyledSelect: ({ dataTest, value, defaultValue, onChange, error, errorText, allowClear, disabled, readOnly, name, placeholder, displayEmpty, multiple, renderValue, fullWidth, className, style, sx, variant, children, MenuProps, onFocus, onBlur, labelId, }: StyledSelectProps) => JSX.Element;
|
|
73
|
+
export declare const StyledSelect: ({ dataTest, value, defaultValue, onChange, error, errorText, helperText, reserveHelperText, expandHelperText, allowClear, disabled, readOnly, name, placeholder, displayEmpty, multiple, renderValue, fullWidth, className, style, sx, variant, children, MenuProps, onFocus, onBlur, labelId, }: StyledSelectProps) => JSX.Element;
|
|
@@ -11,6 +11,8 @@ export interface AutocompleteRenderInputParams {
|
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
size?: 'small' | 'medium';
|
|
13
13
|
fullWidth?: boolean;
|
|
14
|
+
error?: boolean;
|
|
15
|
+
helperText?: ReactNode;
|
|
14
16
|
value: string;
|
|
15
17
|
onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
16
18
|
onFocus?: () => void;
|
|
@@ -43,7 +45,6 @@ type AutocompleteValue<T, Multiple, DisableClearable, FreeSolo> = Multiple exten
|
|
|
43
45
|
* chips** (`StyledChip`: h32, radius25, label 16/delta-700 — node 20475-29954). The dropdown is the
|
|
44
46
|
* **Menus** surface (node 16073-19226): rounded-lg, border delta-300, Menus shadow. Popup indicator =
|
|
45
47
|
* `+` (`PlusIconCircle`, multiple) or chevron (single); clear = `CloseIcon`. Non-annotated props are
|
|
46
|
-
* behavioral / MUI `Autocomplete` API-parity (DEC-002/DEC-003).
|
|
47
48
|
*/
|
|
48
49
|
export interface StyledSelectAutocompleteProps<T, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false> {
|
|
49
50
|
/** @figmaProp none — test hook */
|
|
@@ -77,6 +78,8 @@ export interface StyledSelectAutocompleteProps<T, Multiple extends boolean | und
|
|
|
77
78
|
disabled?: boolean;
|
|
78
79
|
/** @figmaProp State = true→"Read-only" (chips lose their delete button; no popup/clear icons) */
|
|
79
80
|
readOnly?: boolean;
|
|
81
|
+
error?: boolean;
|
|
82
|
+
helperText?: ReactNode;
|
|
80
83
|
/** @figmaProp none — FieldSize (both render the 40px field) */
|
|
81
84
|
size?: 'small' | 'medium';
|
|
82
85
|
/** @figmaProp Clear (trigger clear button) */
|
|
@@ -116,13 +119,11 @@ export interface StyledSelectAutocompleteProps<T, Multiple extends boolean | und
|
|
|
116
119
|
sx?: unknown;
|
|
117
120
|
}
|
|
118
121
|
/**
|
|
119
|
-
* Custom combobox (replaces MUI `Autocomplete`, DEC-002) built on `@floating-ui/react`. Supports
|
|
120
122
|
* single + multiple selection (with tag chips + optional select-all), type-ahead filtering,
|
|
121
123
|
* async `loading`, grouping, and the MUI `renderInput`/`renderOption`/`renderValue` callback
|
|
122
|
-
* contracts. Public props/generics preserved (DEC-003). TASK-401.
|
|
123
124
|
*
|
|
124
125
|
* ponytail: `freeSolo` is accepted (arbitrary input is emitted via onInputChange) but not turned
|
|
125
126
|
* into option values; exact keyboard-parity edge cases are Chromatic/axe-gated.
|
|
126
127
|
*/
|
|
127
|
-
export declare function StyledSelectAutocomplete<T, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false>({ dataTest, options, renderInput, value, onChange, getOptionLabel, getOptionKey, isOptionEqualToValue, renderOption, renderValue, filterOptions, loading, loadingText, noOptionsText, disabled, readOnly, size, disableClearable, disableCloseOnSelect, popupIcon, autoHeight, multiple, allowSelectAll, selectAllLabel, fullWidth, classes, inputValue: controlledInput, onInputChange, open: controlledOpen, onOpen, onClose, className, wrapperClassName, getOptionDisabled, slotProps, }: StyledSelectAutocompleteProps<T, Multiple, DisableClearable, FreeSolo>): JSX.Element;
|
|
128
|
+
export declare function StyledSelectAutocomplete<T, Multiple extends boolean | undefined = false, DisableClearable extends boolean | undefined = false, FreeSolo extends boolean | undefined = false>({ dataTest, options, renderInput, value, onChange, getOptionLabel, getOptionKey, isOptionEqualToValue, renderOption, renderValue, filterOptions, loading, loadingText, noOptionsText, disabled, readOnly, error, helperText, size, disableClearable, disableCloseOnSelect, popupIcon, autoHeight, multiple, allowSelectAll, selectAllLabel, fullWidth, classes, inputValue: controlledInput, onInputChange, open: controlledOpen, onOpen, onClose, className, wrapperClassName, getOptionDisabled, slotProps, }: StyledSelectAutocompleteProps<T, Multiple, DisableClearable, FreeSolo>): JSX.Element;
|
|
128
129
|
export {};
|
|
@@ -49,6 +49,7 @@ export interface StyledSliderProps {
|
|
|
49
49
|
error?: boolean;
|
|
50
50
|
errorText?: string;
|
|
51
51
|
helperText?: string;
|
|
52
|
+
reserveHelperText?: boolean;
|
|
52
53
|
/** Accessible name for the thumb input(s) — there is no visible label to derive it from
|
|
53
54
|
* (axe `label`). A function receives the thumb index (0, or 0/1 for a two-thumb range) so each
|
|
54
55
|
* thumb of a range slider can get a distinct name. */
|
|
@@ -61,11 +62,10 @@ export interface StyledSliderProps {
|
|
|
61
62
|
* Native range-input slider (replaces MUI `Slider`). Single value uses one `<input type="range">`;
|
|
62
63
|
* a two-element `value` renders two stacked inputs (each thumb independently grabbable via
|
|
63
64
|
* pointer-events on the thumb only). Marks, vertical orientation, `classes`/`slotProps` slots and
|
|
64
|
-
* `onChange`/`onChangeCommitted` are preserved (DEC-003).
|
|
65
65
|
*
|
|
66
66
|
* ponytail: exact-pixel parity with MUI's thumb travel/animation is a known ceiling — Chromatic in
|
|
67
67
|
* CI is the visual gate. Upgrade path: tune the 8px thumb inset if a diff shows misalignment.
|
|
68
68
|
* TASK-204.
|
|
69
69
|
*/
|
|
70
|
-
export declare const StyledSlider: ({ dataTest, min, max, step, value, defaultValue, disabled, size, orientation, marks, name, className, classes, slotProps, error, errorText, helperText, ariaLabel, ariaLabelledBy, onChange, onChangeCommitted, }: StyledSliderProps) => JSX.Element;
|
|
70
|
+
export declare const StyledSlider: ({ dataTest, min, max, step, value, defaultValue, disabled, size, orientation, marks, name, className, classes, slotProps, error, errorText, helperText, reserveHelperText, ariaLabel, ariaLabelledBy, onChange, onChangeCommitted, }: StyledSliderProps) => JSX.Element;
|
|
71
71
|
export {};
|
|
@@ -8,6 +8,7 @@ export interface TextareaCommonProps {
|
|
|
8
8
|
labelClassName?: string;
|
|
9
9
|
/** @figmaProp Description / helper text (Helper 14/lh20, delta-600). */
|
|
10
10
|
description?: ReactNode;
|
|
11
|
+
reserveHelperText?: boolean;
|
|
11
12
|
containerClassName?: string;
|
|
12
13
|
className?: string;
|
|
13
14
|
dataTest?: string;
|
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
import { Matcher } from 'react-day-picker';
|
|
2
|
+
export interface DatePickerValidationMessages {
|
|
3
|
+
required: string;
|
|
4
|
+
minDate: string;
|
|
5
|
+
invalidDay: string;
|
|
6
|
+
invalidMonth: string;
|
|
7
|
+
invalidYear: string;
|
|
8
|
+
invalidDate: string;
|
|
9
|
+
invalidFormat: string;
|
|
10
|
+
dateDisabled: string;
|
|
11
|
+
pastNotAllowed: string;
|
|
12
|
+
futureNotAllowed: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DatePickerValidationMessageCatalog {
|
|
15
|
+
en: DatePickerValidationMessages;
|
|
16
|
+
nb: DatePickerValidationMessages;
|
|
17
|
+
}
|
|
18
|
+
export declare const defaultDatePickerValidationMessages: DatePickerValidationMessageCatalog;
|
|
2
19
|
interface DatePickerValidation {
|
|
3
20
|
validationError: boolean;
|
|
4
21
|
errHelperText: string;
|
|
@@ -13,5 +30,5 @@ interface DatePickerValidation {
|
|
|
13
30
|
minDate?: Date;
|
|
14
31
|
}) => boolean;
|
|
15
32
|
}
|
|
16
|
-
export declare const useDatePickerValidation: () => DatePickerValidation;
|
|
33
|
+
export declare const useDatePickerValidation: (messages?: DatePickerValidationMessageCatalog) => DatePickerValidation;
|
|
17
34
|
export {};
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
export interface TimePickerHelperMessages {
|
|
3
|
+
invalid: {
|
|
4
|
+
en: string;
|
|
5
|
+
no: string;
|
|
6
|
+
};
|
|
7
|
+
afterStartTime: {
|
|
8
|
+
en: string;
|
|
9
|
+
no: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare const defaultTimePickerHelperMessages: TimePickerHelperMessages;
|
|
2
13
|
export declare const HelperText: React.FC<{
|
|
3
14
|
isValidTime: boolean;
|
|
4
15
|
isValidEndTime: boolean;
|
|
5
16
|
error?: boolean;
|
|
6
17
|
localization: 'en' | 'no';
|
|
7
18
|
helperText?: ReactNode;
|
|
19
|
+
messages?: TimePickerHelperMessages;
|
|
8
20
|
}>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface EdgeBox {
|
|
2
|
+
top: number;
|
|
3
|
+
right: number;
|
|
4
|
+
bottom: number;
|
|
5
|
+
left: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function blockingLeftEdge(band: EdgeBox, neighbours: EdgeBox[]): number;
|
|
8
|
+
export declare function helperRowMaxWidth(fieldLeft: number, fieldWidth: number, limitRight: number): number | undefined;
|
|
9
|
+
export declare function measureHelperRowMaxWidth(field: HTMLElement, helperRow: HTMLElement): number | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CSSProperties, RefObject } from 'react';
|
|
2
|
+
export interface HelperRowBudget {
|
|
3
|
+
fieldRef: RefObject<HTMLDivElement>;
|
|
4
|
+
rowRef: RefObject<HTMLDivElement>;
|
|
5
|
+
rowStyle: CSSProperties | undefined;
|
|
6
|
+
}
|
|
7
|
+
export declare function useHelperRowBudget(enabled: boolean): HelperRowBudget;
|