@leabankab/component-library 7.2.0 → 8.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/CHANGELOG.md +685 -0
- package/README.md +2 -5
- package/dist/component-library.es.js +2778 -5628
- package/dist/component-library.es.js.map +1 -1
- package/dist/component-library.umd.js +2 -35
- package/dist/component-library.umd.js.map +1 -1
- package/dist/components/animations/icons/status-icon.d.ts +4 -0
- package/dist/components/animations/illustrations/check-animation.d.ts +8 -0
- package/dist/components/animations/illustrations/pulse-animation.d.ts +5 -1
- package/dist/components/animations/illustrations/status-animation.d.ts +8 -1
- package/dist/components/animations/shared.d.ts +6 -32
- package/dist/components/animations/spinner.d.ts +18 -0
- package/dist/components/animations/use-animation-labels.d.ts +0 -5
- package/dist/components/buttons/action-button.d.ts +8 -10
- package/dist/components/buttons/button-base.d.ts +31 -17
- package/dist/components/buttons/button.d.ts +4 -4
- package/dist/components/buttons/close-button.d.ts +1 -1
- package/dist/components/buttons/icon-button.d.ts +2 -14
- package/dist/components/buttons/skip-link.d.ts +21 -4
- package/dist/components/color-roles.d.ts +8 -0
- package/dist/components/data-display/card.d.ts +31 -4
- package/dist/components/data-display/chip.d.ts +50 -8
- package/dist/components/data-display/data-field.d.ts +15 -4
- package/dist/components/data-display/tooltip.d.ts +74 -22
- package/dist/components/feedback/alert-parts.d.ts +329 -0
- package/dist/components/feedback/alert.d.ts +14 -19
- package/dist/components/feedback/global-alert.d.ts +24 -0
- package/dist/components/feedback/index.d.ts +1 -0
- package/dist/components/feedback/simple-dialog.d.ts +1 -1
- package/dist/components/form/amount-slider.d.ts +68 -0
- package/dist/components/form/autocomplete.d.ts +56 -59
- package/dist/components/form/checkbox-box.d.ts +11 -0
- package/dist/components/form/checkbox.d.ts +67 -7
- package/dist/components/form/combo-field.d.ts +60 -0
- package/dist/components/form/email-input.d.ts +20 -26
- package/dist/components/form/field-parts.d.ts +36 -0
- package/dist/components/form/index.d.ts +3 -9
- package/dist/components/form/input.d.ts +51 -13
- package/dist/components/form/multi-select.d.ts +12 -14
- package/dist/components/form/number-input.d.ts +20 -14
- package/dist/components/form/phone-number-input/phone-number-input.d.ts +25 -14
- package/dist/components/form/radio-card.d.ts +94 -43
- package/dist/components/form/radio-circle.d.ts +14 -13
- package/dist/components/form/radio-group-root.d.ts +88 -0
- package/dist/components/form/radio.d.ts +68 -24
- package/dist/components/form/select-field.d.ts +78 -0
- package/dist/components/form/select.d.ts +30 -42
- package/dist/components/form/slider-parts.d.ts +34 -0
- package/dist/components/form/slider.d.ts +40 -16
- package/dist/components/form/use-autocomplete-labels.d.ts +3 -16
- package/dist/components/form/use-blur-outside.d.ts +7 -0
- package/dist/components/form/use-focus-target-ref.d.ts +11 -0
- package/dist/components/form/use-tooltip-trigger-labels.d.ts +5 -0
- package/dist/components/index.d.ts +0 -1
- package/dist/components/layout/stack.d.ts +1 -1
- package/dist/components/navigation/form-stepper.d.ts +1 -1
- package/dist/components/navigation/index.d.ts +3 -1
- package/dist/components/navigation/linear-form-stepper.d.ts +58 -0
- package/dist/components/navigation/progress-circle.d.ts +14 -8
- package/dist/components/navigation/step-progress.d.ts +60 -0
- package/dist/components/navigation/tabs.d.ts +37 -34
- package/dist/components/navigation/use-stepper-labels.d.ts +1 -1
- package/dist/components/typography/link.d.ts +25 -16
- package/dist/components/typography/lists.d.ts +20 -23
- package/dist/components/typography/text.d.ts +46 -10
- package/dist/components/ui/app-header.d.ts +29 -0
- package/dist/components/ui/brand-divider.d.ts +7 -1
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/cookie-consent/react.d.ts +0 -1
- package/dist/cookie-consent-react.cjs +1 -1
- package/dist/cookie-consent-react.cjs.map +1 -1
- package/dist/cookie-consent-react.mjs +107 -97
- package/dist/cookie-consent-react.mjs.map +1 -1
- package/dist/cookie-consent.css +1 -1
- package/dist/date-picker/datepicker.d.ts +140 -0
- package/dist/date-picker/index.d.ts +18 -0
- package/dist/date-picker/theme/field-base.d.ts +23 -0
- package/dist/date-picker/theme/form-control.theme.d.ts +7 -0
- package/dist/date-picker/theme/index.d.ts +12 -0
- package/dist/date-picker/theme/input.theme.d.ts +6 -0
- package/dist/{components/form/datepicker → date-picker}/use-view-toggle-labels.d.ts +1 -1
- package/dist/date-picker.cjs +2 -0
- package/dist/date-picker.cjs.map +1 -0
- package/dist/date-picker.mjs +1012 -0
- package/dist/date-picker.mjs.map +1 -0
- package/dist/{components/dev-panel → dev-panel}/dev-panel-payload.d.ts +1 -1
- package/dist/{components/dev-panel → dev-panel}/dev-panel-status.d.ts +2 -2
- package/dist/{components/dev-panel → dev-panel}/dev-panel-steps.d.ts +2 -1
- package/dist/{components/dev-panel → dev-panel}/dev-panel.d.ts +25 -19
- package/dist/dev-panel/index.d.ts +10 -0
- package/dist/{components/dev-panel → dev-panel}/json-highlight.d.ts +2 -2
- package/dist/dev-panel/parts.d.ts +9 -0
- package/dist/{components/dev-panel → dev-panel}/segmented-control.d.ts +5 -4
- package/dist/{components/dev-panel → dev-panel}/use-dev-panel-labels.d.ts +1 -1
- package/dist/{components/dev-panel → dev-panel}/use-roving-radio.d.ts +2 -2
- package/dist/dev-panel.cjs +3 -0
- package/dist/dev-panel.cjs.map +1 -0
- package/dist/dev-panel.css +1 -0
- package/dist/dev-panel.mjs +818 -0
- package/dist/dev-panel.mjs.map +1 -0
- package/dist/fonts/ClashGrotesk-Variable.woff2 +0 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -3
- package/dist/provider/lea-provider.d.ts +4 -7
- package/dist/react-hook-form/form-field.d.ts +76 -0
- package/dist/react-hook-form/index.d.ts +1 -0
- package/dist/react-hook-form.cjs +2 -0
- package/dist/react-hook-form.cjs.map +1 -0
- package/dist/react-hook-form.mjs +33 -0
- package/dist/react-hook-form.mjs.map +1 -0
- package/dist/tailwind.css +103 -17
- package/dist/theme/index.d.ts +0 -4
- package/dist/theme/token-types.d.ts +15 -3
- package/dist/theme/tokens/colors.d.ts +13 -0
- package/dist/theme/tokens/font-family.d.ts +9 -0
- package/dist/theme/tokens/font-sizes.d.ts +8 -0
- package/dist/theme/tokens/index.d.ts +5 -1
- package/dist/theme/tokens/line-heights.d.ts +11 -0
- package/dist/theme/tokens/opacity.d.ts +5 -0
- package/dist/theme/tokens/spacing.d.ts +6 -0
- package/dist/theme/tokens/text-styles.d.ts +61 -0
- package/dist/theme/tokens/type-scale.d.ts +21 -0
- package/dist/theme/types.d.ts +19 -30
- package/package.json +42 -6
- package/dist/components/dev-panel/index.d.ts +0 -9
- package/dist/components/form/datepicker/datepicker.d.ts +0 -99
- package/dist/components/form/datepicker/index.d.ts +0 -1
- package/dist/components/form/fields/autocomplete-field.d.ts +0 -17
- package/dist/components/form/fields/boolean-radio-field.d.ts +0 -3
- package/dist/components/form/fields/checkbox-field.d.ts +0 -12
- package/dist/components/form/fields/datepicker-field.d.ts +0 -9
- package/dist/components/form/fields/email-field.d.ts +0 -10
- package/dist/components/form/fields/field-types.d.ts +0 -18
- package/dist/components/form/fields/index.d.ts +0 -14
- package/dist/components/form/fields/input-field.d.ts +0 -9
- package/dist/components/form/fields/multi-select-field.d.ts +0 -9
- package/dist/components/form/fields/number-field.d.ts +0 -10
- package/dist/components/form/fields/phone-number-field.d.ts +0 -11
- package/dist/components/form/fields/radio-card-field.d.ts +0 -22
- package/dist/components/form/fields/radio-field.d.ts +0 -16
- package/dist/components/form/fields/select-field.d.ts +0 -9
- package/dist/components/form/fields/use-field-control.d.ts +0 -6
- package/dist/components/form/fields/use-tooltip-trigger-labels.d.ts +0 -5
- package/dist/components/form/form-control/form-control-context.d.ts +0 -35
- package/dist/components/form/form-control/form-control-label.d.ts +0 -1
- package/dist/components/form/form-control/form-control.d.ts +0 -13
- package/dist/components/form/form-control/form-helper-text.d.ts +0 -9
- package/dist/components/form/form-control/form-label.d.ts +0 -9
- package/dist/components/form/form-control/index.d.ts +0 -5
- package/dist/components/form/input-label.d.ts +0 -9
- package/dist/theme/components/accordion.theme.d.ts +0 -7
- package/dist/theme/components/action-button.theme.d.ts +0 -45
- package/dist/theme/components/alert.theme.d.ts +0 -2
- package/dist/theme/components/autocomplete.theme.d.ts +0 -2
- package/dist/theme/components/baseline-css.d.ts +0 -2
- package/dist/theme/components/button.theme.d.ts +0 -2
- package/dist/theme/components/card.theme.d.ts +0 -2
- package/dist/theme/components/checkbox.theme.d.ts +0 -2
- package/dist/theme/components/chip.theme.d.ts +0 -2
- package/dist/theme/components/dev-panel.theme.d.ts +0 -95
- package/dist/theme/components/dialog.theme.d.ts +0 -2
- package/dist/theme/components/drawer.theme.d.ts +0 -4
- package/dist/theme/components/field-base.d.ts +0 -31
- package/dist/theme/components/form-control-label.theme.d.ts +0 -2
- package/dist/theme/components/form-control.theme.d.ts +0 -2
- package/dist/theme/components/index.d.ts +0 -2
- package/dist/theme/components/input.theme.d.ts +0 -3
- package/dist/theme/components/link.theme.d.ts +0 -2
- package/dist/theme/components/menu-item.theme.d.ts +0 -2
- package/dist/theme/components/number-input.theme.d.ts +0 -23
- package/dist/theme/components/phone-number-input.theme.d.ts +0 -43
- package/dist/theme/components/radio.theme.d.ts +0 -2
- package/dist/theme/components/select.theme.d.ts +0 -2
- package/dist/theme/components/slider.theme.d.ts +0 -2
- package/dist/theme/components/tabs.theme.d.ts +0 -34
- package/dist/theme/components/tooltip.theme.d.ts +0 -110
- package/dist/theme/components/typography.theme.d.ts +0 -2
- package/dist/theme/mui-augmentation.d.ts +0 -147
- package/dist/theme/sx-config.d.ts +0 -10
- /package/dist/{components/form/datepicker → date-picker}/calendar-header.d.ts +0 -0
- /package/dist/{components/form/datepicker → date-picker}/drawer-toolbar.d.ts +0 -0
- /package/dist/{theme/components → date-picker/theme}/date-picker.theme.d.ts +0 -0
- /package/dist/{theme/components → date-picker/theme}/icon-button.theme.d.ts +0 -0
- /package/dist/{theme/tokens → date-picker/theme}/typography.d.ts +0 -0
- /package/dist/{components/form/datepicker → date-picker}/use-calendar-header-labels.d.ts +0 -0
- /package/dist/{components/form/datepicker → date-picker}/use-datepicker-title-labels.d.ts +0 -0
- /package/dist/{components/form/datepicker → date-picker}/view-renderers.d.ts +0 -0
- /package/dist/{components/form/datepicker → date-picker}/view-toggle.d.ts +0 -0
- /package/dist/{components/dev-panel → dev-panel}/dev-panel-country.d.ts +0 -0
- /package/dist/{components/dev-panel → dev-panel}/dev-panel-flow.d.ts +0 -0
- /package/dist/{components/dev-panel → dev-panel}/dev-panel-footer.d.ts +0 -0
- /package/dist/{components/dev-panel → dev-panel}/dev-panel-step-state.d.ts +0 -0
- /package/dist/{components/dev-panel → dev-panel}/dev-panel-variant.d.ts +0 -0
- /package/dist/{components/dev-panel → dev-panel}/use-copy.d.ts +0 -0
|
@@ -1,12 +1,72 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type CheckboxProps = Omit<MuiCheckboxProps, "color" | "size">;
|
|
1
|
+
import { CSSProperties, FocusEventHandler, ReactNode, Ref } from 'react';
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* Requires an accessible name so the checkbox is never nameless. Provide a
|
|
4
|
+
* visible `label`, or an `aria-label` / `aria-labelledby` when the design has
|
|
5
|
+
* none (a row in a table, say).
|
|
6
|
+
*/
|
|
7
|
+
type CheckboxAccessibleName = {
|
|
8
|
+
label: ReactNode;
|
|
9
|
+
"aria-label"?: never;
|
|
10
|
+
"aria-labelledby"?: never;
|
|
11
|
+
} | {
|
|
12
|
+
label?: never;
|
|
13
|
+
"aria-label": string;
|
|
14
|
+
"aria-labelledby"?: never;
|
|
15
|
+
} | {
|
|
16
|
+
label?: never;
|
|
17
|
+
"aria-label"?: never;
|
|
18
|
+
"aria-labelledby": string;
|
|
19
|
+
};
|
|
20
|
+
export type CheckboxProps = CheckboxAccessibleName & {
|
|
21
|
+
/** Whether the box is ticked (controlled). Pair with `onCheckedChange`. */
|
|
22
|
+
checked?: boolean;
|
|
23
|
+
/** Whether the box is ticked when first rendered, for uncontrolled use. */
|
|
24
|
+
defaultChecked?: boolean;
|
|
25
|
+
/** Called with the new state when the box is ticked or cleared. */
|
|
26
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
27
|
+
/** Helper / error text shown below the checkbox and linked via `aria-describedby`. */
|
|
28
|
+
helperText?: ReactNode;
|
|
29
|
+
/** Puts the checkbox and its helper text into the error state. */
|
|
30
|
+
error?: boolean;
|
|
31
|
+
/** Submits the checkbox under this name when inside a form. */
|
|
32
|
+
name?: string;
|
|
33
|
+
/** The value submitted when ticked. The browser default is `"on"`. */
|
|
34
|
+
value?: string;
|
|
35
|
+
/** Disables the checkbox. */
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
/** Marks the checkbox as required and adds the asterisk to the label. */
|
|
38
|
+
required?: boolean;
|
|
39
|
+
/** Id of the checkbox itself, the element with the `checkbox` role. */
|
|
40
|
+
id?: string;
|
|
41
|
+
onBlur?: FocusEventHandler<HTMLElement>;
|
|
42
|
+
onFocus?: FocusEventHandler<HTMLElement>;
|
|
43
|
+
/** Extra ids describing the checkbox, alongside the helper text. */
|
|
44
|
+
"aria-describedby"?: string;
|
|
45
|
+
/** Class on the outermost element, for layout. */
|
|
46
|
+
className?: string;
|
|
47
|
+
/** Inline style on the outermost element, for layout. */
|
|
48
|
+
style?: CSSProperties;
|
|
49
|
+
/**
|
|
50
|
+
* The `<input type="checkbox">` that holds the value. It is hidden, but
|
|
51
|
+
* `ref.current.focus()` moves focus to the visible box.
|
|
52
|
+
*/
|
|
53
|
+
ref?: Ref<HTMLInputElement>;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Checkbox with its label, helper text and error state built in, on Base UI's
|
|
57
|
+
* accessible `Checkbox` primitive.
|
|
58
|
+
*
|
|
59
|
+
* Pass `label` for the text next to the box; it is a real `<label>`, so
|
|
60
|
+
* clicking it ticks the box. Without a visible label, pass `aria-label`.
|
|
61
|
+
* `className` and `style` go on the outermost element.
|
|
7
62
|
*
|
|
8
63
|
* ```tsx
|
|
9
|
-
* <
|
|
64
|
+
* <Checkbox
|
|
65
|
+
* label="Jeg godtar vilkårene"
|
|
66
|
+
* checked={accepted}
|
|
67
|
+
* onCheckedChange={setAccepted}
|
|
68
|
+
* />
|
|
10
69
|
* ```
|
|
11
70
|
*/
|
|
12
|
-
export declare
|
|
71
|
+
export declare function Checkbox({ label, helperText, error, checked, defaultChecked, onCheckedChange, name, value, disabled, required, id, onBlur, onFocus, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, className, style, ref, }: CheckboxProps): import("react").JSX.Element;
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CSSProperties, FocusEvent, InputHTMLAttributes, ReactNode, Ref } from 'react';
|
|
2
|
+
/** The props `Autocomplete` and `EmailInput` have in common. */
|
|
3
|
+
export type ComboFieldBaseProps = {
|
|
4
|
+
/** Floating label, linked to the input for you. */
|
|
5
|
+
label?: ReactNode;
|
|
6
|
+
/** Helper / error text shown below the control and linked via `aria-describedby`. */
|
|
7
|
+
helperText?: ReactNode;
|
|
8
|
+
/** Puts the control, its label and its helper text into the error state. */
|
|
9
|
+
error?: boolean;
|
|
10
|
+
/** Marks the control as required, with an asterisk after the label. */
|
|
11
|
+
required?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Text shown while the input is empty. With a `label` it appears once the
|
|
15
|
+
* label has floated up, on focus.
|
|
16
|
+
*/
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
/** Called when focus leaves the control, its list included. */
|
|
19
|
+
onBlur?: (event: FocusEvent<HTMLElement>) => void;
|
|
20
|
+
/** Submits the value under this name in a native form. */
|
|
21
|
+
name?: string;
|
|
22
|
+
/** Id of the text `<input>`. */
|
|
23
|
+
id?: string;
|
|
24
|
+
/** Names the control when there is no visible `label`. */
|
|
25
|
+
"aria-label"?: string;
|
|
26
|
+
"aria-labelledby"?: string;
|
|
27
|
+
"aria-describedby"?: string;
|
|
28
|
+
/** Class on the outermost element, for layout. */
|
|
29
|
+
className?: string;
|
|
30
|
+
/** Inline style on the outermost element, for layout. */
|
|
31
|
+
style?: CSSProperties;
|
|
32
|
+
/** The text `<input>`. */
|
|
33
|
+
ref?: Ref<HTMLInputElement>;
|
|
34
|
+
};
|
|
35
|
+
type ComboFieldProps = Omit<ComboFieldBaseProps, "name"> & {
|
|
36
|
+
/** Wraps the field and its popup in the Base UI root that drives them. */
|
|
37
|
+
renderRoot: (children: ReactNode) => ReactNode;
|
|
38
|
+
/** More attributes for the `<input>`: `type`, `name`, `autoComplete`, … */
|
|
39
|
+
inputProps?: InputHTMLAttributes<HTMLInputElement>;
|
|
40
|
+
/**
|
|
41
|
+
* The chosen values of a multiple control, as `Combobox.Chip`s. They share
|
|
42
|
+
* the field with the input and wrap onto new lines.
|
|
43
|
+
*/
|
|
44
|
+
chips?: ReactNode;
|
|
45
|
+
/** Whether a multiple control has values, which is what floats its label. */
|
|
46
|
+
filled?: boolean;
|
|
47
|
+
/** Shows the button that empties the control, while there is something to empty. */
|
|
48
|
+
clearable?: boolean;
|
|
49
|
+
/** Shows the arrow button that opens and closes the list. */
|
|
50
|
+
trigger?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Selects the text on the first click into the input, so that typing
|
|
53
|
+
* replaces it. For a control whose text is the label of the chosen option.
|
|
54
|
+
*/
|
|
55
|
+
selectTextOnClick?: boolean;
|
|
56
|
+
/** The content of the popup: the list, and what stands in for it when empty. */
|
|
57
|
+
children: ReactNode;
|
|
58
|
+
};
|
|
59
|
+
export declare function ComboField({ label, helperText, error, required, disabled, placeholder, onBlur, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, className, style, ref, renderRoot, inputProps, chips, filled, clearable, trigger, selectTextOnClick, children, }: ComboFieldProps): import("react").JSX.Element;
|
|
60
|
+
export {};
|
|
@@ -1,35 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type EmailInputProps = {
|
|
3
|
-
/**
|
|
1
|
+
import { ComboFieldBaseProps } from './combo-field';
|
|
2
|
+
export type EmailInputProps = ComboFieldBaseProps & {
|
|
3
|
+
/** The address (controlled). Pair with `onValueChange`. */
|
|
4
4
|
value?: string;
|
|
5
|
-
/**
|
|
5
|
+
/** The address when first rendered, for uncontrolled use. */
|
|
6
6
|
defaultValue?: string;
|
|
7
|
-
/** Called with the
|
|
8
|
-
|
|
7
|
+
/** Called with the new text on every change, and with a suggestion when one is picked. */
|
|
8
|
+
onValueChange?: (value: string) => void;
|
|
9
9
|
/** Domains offered once the user types `@`. Defaults to common providers. */
|
|
10
10
|
domains?: readonly string[];
|
|
11
|
-
/**
|
|
11
|
+
/** Most suggestions shown at once. @default 6 */
|
|
12
12
|
maxSuggestions?: number;
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/** Puts the control in an error state. */
|
|
20
|
-
error?: boolean;
|
|
21
|
-
/** Marks the control as required. */
|
|
22
|
-
required?: boolean;
|
|
23
|
-
/** Disables the control. */
|
|
24
|
-
disabled?: boolean;
|
|
25
|
-
/** Blur handler (e.g. for react-hook-form touched state). */
|
|
26
|
-
onBlur?: FocusEventHandler<HTMLDivElement>;
|
|
13
|
+
/**
|
|
14
|
+
* What the browser may fill in. The default lets it offer the user's own
|
|
15
|
+
* address; pass `"off"` when the address is somebody else's.
|
|
16
|
+
* @default "email"
|
|
17
|
+
*/
|
|
18
|
+
autoComplete?: string;
|
|
27
19
|
};
|
|
28
20
|
/**
|
|
29
|
-
* Email text field that suggests common domains in a
|
|
30
|
-
* types
|
|
31
|
-
*
|
|
32
|
-
* `FormControl`.
|
|
21
|
+
* Email text field that suggests common domains in a list once the user
|
|
22
|
+
* types `@`, on Base UI's `Autocomplete`, in the same box as `Input`. The
|
|
23
|
+
* text is the value: a suggestion only saves typing.
|
|
33
24
|
*
|
|
25
|
+
* ```tsx
|
|
26
|
+
* <EmailInput label="E-post" value={email} onValueChange={setEmail} />
|
|
27
|
+
* ```
|
|
34
28
|
*/
|
|
35
|
-
export declare
|
|
29
|
+
export declare function EmailInput({ value, defaultValue, onValueChange, domains, maxSuggestions, autoComplete, name, ...field }: EmailInputProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** The ` *` after the label of a required control. Decorative: `required` is on the control. */
|
|
3
|
+
export declare const RequiredAsterisk: ({ className }: {
|
|
4
|
+
className?: string;
|
|
5
|
+
}) => import("react").JSX.Element;
|
|
6
|
+
type FieldHelperTextProps = {
|
|
7
|
+
/** Id the control points at with `aria-describedby`. */
|
|
8
|
+
id: string;
|
|
9
|
+
error: boolean;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
};
|
|
12
|
+
/** Helper text below a control. Announced as an alert while in error. */
|
|
13
|
+
export declare function FieldHelperText({ id, error, children }: FieldHelperTextProps): import("react").JSX.Element;
|
|
14
|
+
type FieldGroupLabelProps = {
|
|
15
|
+
/** Id the group points at with `aria-labelledby`. It sits on the text alone. */
|
|
16
|
+
id: string;
|
|
17
|
+
/**
|
|
18
|
+
* Id of a single control this labels. The text is then a real `<label>`, so
|
|
19
|
+
* a click on it moves focus to the control.
|
|
20
|
+
*/
|
|
21
|
+
htmlFor?: string;
|
|
22
|
+
/** Help text behind an info button next to the label. */
|
|
23
|
+
tooltip?: ReactNode;
|
|
24
|
+
required?: boolean;
|
|
25
|
+
error?: boolean;
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* The label above a group of choices, or above a field whose label sits
|
|
31
|
+
* outside it. The element is not a `<label>`: it names its control through
|
|
32
|
+
* `aria-labelledby`, and a `<label>` around the info button would pass clicks
|
|
33
|
+
* on the text to that button. With `htmlFor`, the text alone is a `<label>`.
|
|
34
|
+
*/
|
|
35
|
+
export declare function FieldGroupLabel({ id, htmlFor, tooltip, required, error, disabled, children, }: FieldGroupLabelProps): import("react").JSX.Element;
|
|
36
|
+
export {};
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
+
export * from './amount-slider';
|
|
1
2
|
export * from './autocomplete';
|
|
2
3
|
export * from './checkbox';
|
|
3
|
-
export * from './datepicker';
|
|
4
4
|
export * from './email-input';
|
|
5
|
-
export * from './fields';
|
|
6
|
-
export * from './form-control';
|
|
7
|
-
export * from './form-control/form-helper-text';
|
|
8
5
|
export * from './input';
|
|
9
|
-
export * from './input-label';
|
|
10
6
|
export * from './multi-select';
|
|
11
7
|
export * from './number-input';
|
|
12
8
|
export * from './phone-number-input';
|
|
13
|
-
export * from './radio';
|
|
14
|
-
export * from './radio-card';
|
|
15
|
-
export * from './radio-circle';
|
|
9
|
+
export * as RadioGroup from './radio';
|
|
10
|
+
export * as RadioCard from './radio-card';
|
|
16
11
|
export * from './select';
|
|
17
12
|
export * from './slider';
|
|
18
13
|
export * from './switch';
|
|
19
|
-
export { FormControlLabel, InputAdornment, type FormControlLabelProps, type InputAdornmentProps, } from '@mui/material';
|
|
@@ -1,19 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export type InputProps =
|
|
4
|
-
/** Floating label
|
|
1
|
+
import { ComponentPropsWithoutRef, CSSProperties, ReactNode, Ref } from 'react';
|
|
2
|
+
type NativeInputProps = Omit<ComponentPropsWithoutRef<"input">, "value" | "defaultValue" | "size" | "color" | "children" | "className" | "style">;
|
|
3
|
+
export type InputProps = NativeInputProps & {
|
|
4
|
+
/** Floating label, linked to the input for you. */
|
|
5
5
|
label?: ReactNode;
|
|
6
|
-
/** Helper / error text shown below the
|
|
6
|
+
/** Helper / error text shown below the input and linked via `aria-describedby`. */
|
|
7
7
|
helperText?: ReactNode;
|
|
8
|
+
/** Puts the input, its label and its helper text into the error state. */
|
|
9
|
+
error?: boolean;
|
|
10
|
+
/** The text (controlled). Pair with `onValueChange`. */
|
|
11
|
+
value?: string;
|
|
12
|
+
/** The text when first rendered, for uncontrolled use. */
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
/** Called with the new text on every change. `onChange` still gets the event. */
|
|
15
|
+
onValueChange?: (value: string) => void;
|
|
16
|
+
/** Content before the text, inside the field, e.g. an icon. */
|
|
17
|
+
startAdornment?: ReactNode;
|
|
18
|
+
/** Content after the text, inside the field, e.g. a show / hide button. */
|
|
19
|
+
endAdornment?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Renders a `<textarea>` that grows with its content. The native attributes
|
|
22
|
+
* and event handlers then apply to the textarea.
|
|
23
|
+
*/
|
|
24
|
+
multiline?: boolean;
|
|
25
|
+
/** Fixed number of rows when `multiline`. */
|
|
26
|
+
rows?: number;
|
|
27
|
+
/** Fewest rows shown when `multiline`. */
|
|
28
|
+
minRows?: number;
|
|
29
|
+
/** Most rows shown when `multiline`, before it scrolls. */
|
|
30
|
+
maxRows?: number;
|
|
31
|
+
/** Class on the outermost element, for layout. */
|
|
32
|
+
className?: string;
|
|
33
|
+
/** Inline style on the outermost element, for layout. */
|
|
34
|
+
style?: CSSProperties;
|
|
35
|
+
/** The `<input>`, or the `<textarea>` when `multiline`. */
|
|
36
|
+
ref?: Ref<HTMLInputElement | HTMLTextAreaElement>;
|
|
8
37
|
};
|
|
9
38
|
/**
|
|
10
|
-
* Text input
|
|
39
|
+
* Text input, on Base UI's `Input` primitive. The label, the helper text and
|
|
40
|
+
* the ids that link them to the input are all rendered and wired for you.
|
|
11
41
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
42
|
+
* Takes the native `<input>` attributes (`type`, `name`, `placeholder`,
|
|
43
|
+
* `autoComplete`, `inputMode`, `maxLength`, `onKeyDown`, …), which land on the
|
|
44
|
+
* input itself. `className` and `style` go on the outermost element. Pass
|
|
45
|
+
* `multiline` (and `minRows`) for a textarea.
|
|
46
|
+
*
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <Input
|
|
49
|
+
* label="E-post"
|
|
50
|
+
* helperText="Vi deler den aldri."
|
|
51
|
+
* value={email}
|
|
52
|
+
* onValueChange={setEmail}
|
|
53
|
+
* />
|
|
54
|
+
* ```
|
|
18
55
|
*/
|
|
19
|
-
export declare
|
|
56
|
+
export declare function Input({ label, helperText, error, value, defaultValue, onValueChange, startAdornment, endAdornment, multiline, rows, minRows, maxRows, className, style, ref, id, disabled, required, placeholder, "aria-describedby": ariaDescribedBy, ...inputAttributes }: InputProps): import("react").JSX.Element;
|
|
57
|
+
export {};
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import { SelectChangeEvent } from '@mui/material';
|
|
2
1
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
export type MultiSelectProps
|
|
5
|
-
/**
|
|
6
|
-
options: SelectOption[];
|
|
2
|
+
import { SelectFieldBaseProps, SelectOption } from './select-field';
|
|
3
|
+
export type MultiSelectProps<Value extends string = string> = SelectFieldBaseProps & {
|
|
4
|
+
/** The choices, shown with a checkbox each. */
|
|
5
|
+
options: readonly SelectOption<Value>[];
|
|
7
6
|
/** Currently selected values (controlled). */
|
|
8
|
-
value?:
|
|
7
|
+
value?: Value[];
|
|
9
8
|
/** Initially selected values (uncontrolled). */
|
|
10
|
-
defaultValue?:
|
|
9
|
+
defaultValue?: Value[];
|
|
11
10
|
/** Called with the next array of selected values. */
|
|
12
|
-
|
|
11
|
+
onValueChange?: (value: Value[]) => void;
|
|
13
12
|
/** Minimum number of values that must stay selected. @default 1 */
|
|
14
13
|
min?: number;
|
|
15
14
|
/** Maximum number of values that can be selected. Unlimited when omitted. */
|
|
16
15
|
max?: number;
|
|
17
16
|
/** Override how the selected values are summarised in the closed control. */
|
|
18
|
-
renderValue?: (selected:
|
|
17
|
+
renderValue?: (selected: Value[]) => ReactNode;
|
|
19
18
|
};
|
|
20
19
|
/**
|
|
21
|
-
* Multi-select
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* chips by default.
|
|
20
|
+
* Multi-select on Base UI's `Select`, in the same box as `Select`, with the
|
|
21
|
+
* label, the helper text and their ids wired. Each option has a checkbox, and
|
|
22
|
+
* the closed control shows the selection as removable chips by default.
|
|
25
23
|
*
|
|
26
24
|
* The selection is bounded by `min` (default 1, so the last value can't be
|
|
27
25
|
* removed) and `max` (unlimited by default): options that would breach either
|
|
@@ -29,4 +27,4 @@ export type MultiSelectProps = Omit<SelectProps, "multiple" | "value" | "default
|
|
|
29
27
|
*
|
|
30
28
|
* Works controlled (`value`) or uncontrolled (`defaultValue`).
|
|
31
29
|
*/
|
|
32
|
-
export declare
|
|
30
|
+
export declare function MultiSelect<Value extends string = string>({ options, value, defaultValue, onValueChange, renderValue, min, max, disabled, ref, ...rest }: MultiSelectProps<Value>): import("react").JSX.Element;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { NumberField as BaseNumberField } from '@base-ui/react/number-field';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
export type NumberInputProps = BaseNumberField.Root.Props & {
|
|
4
|
-
/**
|
|
2
|
+
import { CSSProperties, ReactNode, Ref } from 'react';
|
|
3
|
+
export type NumberInputProps = Omit<BaseNumberField.Root.Props, "ref" | "inputRef" | "render" | "className" | "style"> & {
|
|
4
|
+
/** The visible `<input>`. */
|
|
5
|
+
ref?: Ref<HTMLInputElement>;
|
|
6
|
+
/** The label, linked to the input for you. */
|
|
5
7
|
label?: ReactNode;
|
|
6
|
-
/**
|
|
8
|
+
/** Floating inside the field, or as a line above it. @default "inside" */
|
|
7
9
|
labelPlacement?: "inside" | "outside";
|
|
10
|
+
/**
|
|
11
|
+
* Help text behind an info button next to the label. Needs
|
|
12
|
+
* `labelPlacement="outside"`: a floating label has no room for it.
|
|
13
|
+
*/
|
|
14
|
+
tooltip?: ReactNode;
|
|
8
15
|
/** Helper / error text shown below the control and linked via `aria-describedby`. */
|
|
9
16
|
helperText?: ReactNode;
|
|
10
17
|
/** Renders the field in its error state (border, label and helper colour). */
|
|
@@ -13,8 +20,6 @@ export type NumberInputProps = BaseNumberField.Root.Props & {
|
|
|
13
20
|
required?: boolean;
|
|
14
21
|
/** Disables the input and the stepper buttons. */
|
|
15
22
|
disabled?: boolean;
|
|
16
|
-
/** Control density. @default "medium" */
|
|
17
|
-
size?: "small" | "medium";
|
|
18
23
|
/** Placeholder shown while the field is empty. */
|
|
19
24
|
placeholder?: string;
|
|
20
25
|
/**
|
|
@@ -33,20 +38,21 @@ export type NumberInputProps = BaseNumberField.Root.Props & {
|
|
|
33
38
|
* @default true
|
|
34
39
|
*/
|
|
35
40
|
showSteppers?: boolean;
|
|
41
|
+
/** Class on the outermost element, for layout. */
|
|
42
|
+
className?: string;
|
|
43
|
+
/** Inline style on the outermost element, for layout. */
|
|
44
|
+
style?: CSSProperties;
|
|
36
45
|
};
|
|
37
46
|
/**
|
|
38
47
|
* Numeric input built on Base UI's `NumberField` (value / min / max / step /
|
|
39
|
-
* formatting)
|
|
40
|
-
* decrement buttons.
|
|
48
|
+
* formatting), in the same box as `Input`, with increment / decrement buttons.
|
|
41
49
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* - **Composed:** drop it inside a `FormControl` and it picks up the shared ids
|
|
46
|
-
* and state from context.
|
|
50
|
+
* The label, the helper text and the ids that link them to the input are all
|
|
51
|
+
* rendered and wired for you. Set `labelPlacement="outside"` for a label above
|
|
52
|
+
* the field, which can also carry a `tooltip`.
|
|
47
53
|
*
|
|
48
54
|
* For money and other open-ended amounts, set `showSteppers={false}` and use a
|
|
49
55
|
* `unit` (e.g. `kr`) instead — a stepper is only helpful for small bounded
|
|
50
56
|
* counts.
|
|
51
57
|
*/
|
|
52
|
-
export declare function NumberInput({ label, labelPlacement, helperText, error, required, disabled, id,
|
|
58
|
+
export declare function NumberInput({ label, labelPlacement, tooltip, helperText, error, required, disabled, id, placeholder, startIcon, unit, showSteppers, className, style, ref, ...rest }: NumberInputProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ComponentPropsWithoutRef, CSSProperties, ReactNode, Ref } from 'react';
|
|
3
2
|
import { CountryCode } from './countries';
|
|
4
3
|
/** Details reported alongside every change so the consumer can react to validity. */
|
|
5
4
|
export interface PhoneNumberMeta {
|
|
@@ -10,44 +9,56 @@ export interface PhoneNumberMeta {
|
|
|
10
9
|
/** Whether the current number is a valid phone number for the country. */
|
|
11
10
|
isValid: boolean;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
type NativeInputProps = Omit<ComponentPropsWithoutRef<"input">, "value" | "defaultValue" | "onChange" | "type" | "size" | "color" | "children" | "className" | "style">;
|
|
13
|
+
export type PhoneNumberInputProps = NativeInputProps & {
|
|
14
|
+
/** Floating label, linked to the input for you. */
|
|
15
15
|
label?: ReactNode;
|
|
16
16
|
/** Helper / error text shown below the control and linked via `aria-describedby`. */
|
|
17
17
|
helperText?: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Puts the input, its label and its helper text into the error state. When
|
|
20
|
+
* set, true or false, the built-in check on blur stays out of it.
|
|
21
|
+
*/
|
|
22
|
+
error?: boolean;
|
|
18
23
|
/** Selected country (controlled). Pair with `onCountryChange`. */
|
|
19
24
|
country?: CountryCode;
|
|
20
25
|
/** Initial country when uncontrolled. Defaults to the country for the active locale. */
|
|
21
26
|
defaultCountry?: CountryCode;
|
|
22
27
|
/** Fired when the user picks a different country. */
|
|
23
28
|
onCountryChange?: (country: CountryCode) => void;
|
|
24
|
-
/** The national number as displayed (controlled). Pair with `
|
|
29
|
+
/** The national number as displayed (controlled). Pair with `onValueChange`. */
|
|
25
30
|
value?: string;
|
|
26
31
|
/** Initial national number when uncontrolled. */
|
|
27
32
|
defaultValue?: string;
|
|
28
33
|
/** Fired on every keystroke with the formatted national number and validity meta. */
|
|
29
|
-
|
|
34
|
+
onValueChange?: (value: string, meta: PhoneNumberMeta) => void;
|
|
30
35
|
/**
|
|
31
36
|
* Show a built-in "invalid number" error once the field is blurred with a
|
|
32
37
|
* non-empty, invalid value. Ignored when the consumer drives `error`.
|
|
33
38
|
* @default true
|
|
34
39
|
*/
|
|
35
40
|
validateOnBlur?: boolean;
|
|
41
|
+
/** Class on the outermost element, for layout. */
|
|
42
|
+
className?: string;
|
|
43
|
+
/** Inline style on the outermost element, for layout. */
|
|
44
|
+
style?: CSSProperties;
|
|
45
|
+
/** The phone number `<input>`. */
|
|
46
|
+
ref?: Ref<HTMLInputElement>;
|
|
36
47
|
};
|
|
37
48
|
/**
|
|
38
|
-
* Phone number input with a searchable country-code picker
|
|
39
|
-
*
|
|
49
|
+
* Phone number input with a searchable country-code picker at its start, in
|
|
50
|
+
* the same box as `Input`. The number is formatted as you type and validated
|
|
40
51
|
* with `libphonenumber-js`. Lea Bank's core markets (Finland, Sweden, Norway,
|
|
41
52
|
* Spain) are pinned to the top of the country list; the default country follows
|
|
42
53
|
* the active locale.
|
|
43
54
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* - **Composed:** drop it inside a `FormControl` and it picks up the shared ids.
|
|
55
|
+
* The label, the helper text and the ids that link them to the input are all
|
|
56
|
+
* rendered and wired for you. Takes the native `<input>` attributes (`name`,
|
|
57
|
+
* `placeholder`, `onBlur`, `autoComplete`, …), which land on the number input.
|
|
48
58
|
*
|
|
49
59
|
* Both country and number can be **controlled** (`country` + `onCountryChange`,
|
|
50
|
-
* `value` + `
|
|
60
|
+
* `value` + `onValueChange`) or left **uncontrolled** (`defaultCountry` /
|
|
51
61
|
* `defaultValue`).
|
|
52
62
|
*/
|
|
53
|
-
export declare function PhoneNumberInput({ label, helperText, error, required, disabled, id, country, defaultCountry, onCountryChange, value, defaultValue,
|
|
63
|
+
export declare function PhoneNumberInput({ label, helperText, error, required, disabled, id, country, defaultCountry, onCountryChange, value, defaultValue, onValueChange, onBlur, validateOnBlur, className, style, ref, "aria-describedby": ariaDescribedBy, ...inputAttributes }: PhoneNumberInputProps): import("react").JSX.Element;
|
|
64
|
+
export {};
|