@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,23 +1,47 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Slider as BaseSlider } from '@base-ui/react/slider';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Requires an accessible name so the slider is never nameless. Provide a
|
|
5
|
+
* visible `label`, or an `aria-label` when the design has none.
|
|
6
|
+
*/
|
|
7
|
+
type SliderAccessibleName = {
|
|
8
|
+
label: ReactNode;
|
|
9
|
+
"aria-label"?: never;
|
|
10
|
+
} | {
|
|
11
|
+
label?: never;
|
|
12
|
+
"aria-label": string;
|
|
13
|
+
};
|
|
14
|
+
export type SliderProps = Omit<BaseSlider.Root.Props<number>, "children" | "orientation" | "minStepsBetweenValues" | "thumbAlignment" | "thumbCollisionBehavior" | "aria-label" | "aria-labelledby"> & SliderAccessibleName & {
|
|
15
|
+
/** Helper / error text shown below the slider and linked via `aria-describedby`. */
|
|
7
16
|
helperText?: ReactNode;
|
|
8
|
-
/** Puts
|
|
17
|
+
/** Puts the slider and its helper text into the error state. */
|
|
9
18
|
error?: boolean;
|
|
10
|
-
/** Marks wrapper FormControl as required. */
|
|
11
|
-
required?: boolean;
|
|
12
19
|
};
|
|
13
20
|
/**
|
|
14
|
-
*
|
|
21
|
+
* A single-value slider built on Base UI's accessible `Slider` primitive.
|
|
22
|
+
*
|
|
23
|
+
* The label, the current value, the `min` / `max` under each end of the track
|
|
24
|
+
* and the helper text are all rendered and wired internally: the label names
|
|
25
|
+
* the control, the helper text describes it, and `error` marks it invalid and
|
|
26
|
+
* announces the helper text. Base UI renders a native range input, so arrow
|
|
27
|
+
* keys, Page Up / Down, Home and End work, and the value is submitted when
|
|
28
|
+
* `name` is set.
|
|
29
|
+
*
|
|
30
|
+
* Pass `format` and `locale` to control how the value, `min` and `max` are
|
|
31
|
+
* written and announced.
|
|
15
32
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <Slider
|
|
35
|
+
* label="Lånebeløp"
|
|
36
|
+
* min={50000}
|
|
37
|
+
* max={600000}
|
|
38
|
+
* step={5000}
|
|
39
|
+
* defaultValue={150000}
|
|
40
|
+
* locale="nb-NO"
|
|
41
|
+
* format={{ style: "currency", currency: "NOK", maximumFractionDigits: 0 }}
|
|
42
|
+
* onValueChange={(value) => setAmount(value)}
|
|
43
|
+
* />
|
|
44
|
+
* ```
|
|
22
45
|
*/
|
|
23
|
-
export declare
|
|
46
|
+
export declare function Slider({ label, "aria-label": ariaLabel, helperText, error, min, max, format, locale, className, ...rest }: SliderProps): import("react").JSX.Element;
|
|
47
|
+
export {};
|
|
@@ -1,19 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Translated
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* every language. Consumers can still override any of them per-instance with
|
|
6
|
-
* MUI's `noOptionsText` / `loadingText` / `openText` / `closeText` / `clearText`.
|
|
2
|
+
* Translated texts for the controls with a list to search in (`Autocomplete`
|
|
3
|
+
* and `EmailInput`): what the list says when it has nothing to show, and the
|
|
4
|
+
* names of the open and clear buttons.
|
|
7
5
|
*/
|
|
8
6
|
export declare const useAutocompleteLabels: () => Record<"clear" | "loading" | "close" | "open" | "noOptions", string>;
|
|
9
|
-
/**
|
|
10
|
-
* The same labels mapped onto MUI's `Autocomplete` prop names, ready to spread
|
|
11
|
-
* before `...rest` so a consumer-supplied value still wins.
|
|
12
|
-
*/
|
|
13
|
-
export declare const useAutocompleteTextProps: () => {
|
|
14
|
-
noOptionsText: string;
|
|
15
|
-
loadingText: string;
|
|
16
|
-
openText: string;
|
|
17
|
-
closeText: string;
|
|
18
|
-
clearText: string;
|
|
19
|
-
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FocusEvent, RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* `onBlur` for a field that is made of several elements, some of them in a
|
|
4
|
+
* popup: it is called once focus has left them all, not when it moves from
|
|
5
|
+
* one to another. Put the returned handler on each element in `refs`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useBlurOutside(onBlur: ((event: FocusEvent<HTMLElement>) => void) | undefined, refs: readonly RefObject<HTMLElement | null>[]): (event: FocusEvent<HTMLElement>) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Ref, RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Internal. Points a control's `ref` at the element inside `rootRef` that
|
|
4
|
+
* takes focus, for controls where that element is rendered by another library
|
|
5
|
+
* or is one of several (the radios of a group). `selectors` are tried in
|
|
6
|
+
* order and the first match wins.
|
|
7
|
+
*
|
|
8
|
+
* This is what lets `ref.current.focus()` work on those controls, which
|
|
9
|
+
* react-hook-form relies on to move focus to the first invalid field.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useFocusTargetRef<T extends HTMLElement>(ref: Ref<T> | undefined, rootRef: RefObject<HTMLElement | null>, selectors: readonly string[]): void;
|
|
@@ -19,7 +19,7 @@ export type FormStepperProps = {
|
|
|
19
19
|
* flow.
|
|
20
20
|
*/
|
|
21
21
|
onBack?: () => void;
|
|
22
|
-
/** Progress circle colour. Defaults to `
|
|
22
|
+
/** Progress circle colour. Defaults to `primary`. */
|
|
23
23
|
color?: ProgressCircleColor;
|
|
24
24
|
/**
|
|
25
25
|
* Render the title as a `heading` (default) or plain `text`. Prefer `heading`
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ProgressCircleColor } from './progress-circle';
|
|
3
|
+
import { StepperLabels } from './use-stepper-labels';
|
|
4
|
+
export type LinearFormStepperProps = {
|
|
5
|
+
/** Active step (1-based). */
|
|
6
|
+
currentStep: number;
|
|
7
|
+
/**
|
|
8
|
+
* Total number of steps. May change between renders, e.g. when the next step
|
|
9
|
+
* from the API reveals a different path; the bar animates to the new value.
|
|
10
|
+
*/
|
|
11
|
+
totalSteps: number;
|
|
12
|
+
/** Title of the current step. Rendered as a heading and names the progress bar. */
|
|
13
|
+
title: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Called when the back button is pressed. The back button only renders when
|
|
16
|
+
* this is provided, so omit it on the first step or in forms without a back
|
|
17
|
+
* flow.
|
|
18
|
+
*/
|
|
19
|
+
onBack?: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* Bar colour.
|
|
22
|
+
* @default "primary"
|
|
23
|
+
*/
|
|
24
|
+
color?: ProgressCircleColor;
|
|
25
|
+
/**
|
|
26
|
+
* Heading level of the title.
|
|
27
|
+
* @default "h1"
|
|
28
|
+
*/
|
|
29
|
+
headingLevel?: "h1" | "h2" | "h3";
|
|
30
|
+
/**
|
|
31
|
+
* Id applied to the title. Defaults to a generated id. Use it to move focus to
|
|
32
|
+
* the title when the step changes so the new step is announced. Must be
|
|
33
|
+
* unique in the document.
|
|
34
|
+
*/
|
|
35
|
+
titleId?: string;
|
|
36
|
+
/** Override the built-in translated labels per-instance. */
|
|
37
|
+
labels?: StepperLabels;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Header for a multi-step form whose steps aren't all known up front: a linear
|
|
41
|
+
* progress bar above the current step's title, with an optional back button.
|
|
42
|
+
* Use `FormStepper` instead when the full step list is known.
|
|
43
|
+
*
|
|
44
|
+
* The bar is a `progressbar` named by the title heading, with the step count
|
|
45
|
+
* (`"step X of Y"`) as its value text. The title carries `tabIndex={-1}`; move
|
|
46
|
+
* focus to it (via `titleId`) whenever the step changes so screen-reader users
|
|
47
|
+
* hear the new step.
|
|
48
|
+
*
|
|
49
|
+
* ```tsx
|
|
50
|
+
* <LinearFormStepper
|
|
51
|
+
* currentStep={2}
|
|
52
|
+
* totalSteps={5}
|
|
53
|
+
* title="Refinancing"
|
|
54
|
+
* onBack={() => history.back()}
|
|
55
|
+
* />
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare const LinearFormStepper: ({ currentStep, totalSteps, title, onBack, color, headingLevel: Heading, titleId, labels, }: LinearFormStepperProps) => import("react").JSX.Element;
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
import { ColorRoles } from '../color-roles';
|
|
2
|
+
export type ProgressCircleColor = ColorRoles<"primary" | "tertiary">;
|
|
2
3
|
export type ProgressCircleProps = {
|
|
3
4
|
/** Current value, e.g. the active step (1-based). Clamped to `0..max`. */
|
|
4
5
|
value: number;
|
|
5
6
|
/** Maximum value, e.g. the total number of steps. */
|
|
6
7
|
max: number;
|
|
7
|
-
/** Ring colour. Defaults to `
|
|
8
|
+
/** Ring colour. Defaults to `primary`. */
|
|
8
9
|
color?: ProgressCircleColor;
|
|
9
10
|
/** Rendered diameter in px. Defaults to `48`. */
|
|
10
11
|
size?: number;
|
|
11
12
|
/** Ring thickness in px. Defaults to `4`. */
|
|
12
13
|
strokeWidth?: number;
|
|
13
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Show the `value/max` label in the centre. Defaults to `true`. The label
|
|
16
|
+
* is set smaller when it would otherwise touch the ring, in a small circle
|
|
17
|
+
* or with many digits. Below about 32px it is too small to read: leave it
|
|
18
|
+
* out there.
|
|
19
|
+
*/
|
|
14
20
|
showValue?: boolean;
|
|
15
21
|
/**
|
|
16
22
|
* Accessible name. When provided, the circle is exposed as a
|
|
@@ -22,13 +28,13 @@ export type ProgressCircleProps = {
|
|
|
22
28
|
label?: string;
|
|
23
29
|
};
|
|
24
30
|
/**
|
|
25
|
-
* An animated circular progress indicator
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
31
|
+
* An animated circular progress indicator: the ring is an SVG whose stroke
|
|
32
|
+
* animates as `value` changes, respecting `prefers-reduced-motion`. Colour is
|
|
33
|
+
* limited to `primary` (purple) and `tertiary` (teal) so contrast stays owned
|
|
34
|
+
* by the theme.
|
|
29
35
|
*
|
|
30
36
|
* ```tsx
|
|
31
|
-
* <ProgressCircle value={2} max={5} color="
|
|
37
|
+
* <ProgressCircle value={2} max={5} color="tertiary" label="Step 2 of 5" />
|
|
32
38
|
* ```
|
|
33
39
|
*/
|
|
34
40
|
export declare const ProgressCircle: ({ value, max, color, size, strokeWidth, showValue, label, }: ProgressCircleProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { LinearFormStepperProps } from './linear-form-stepper';
|
|
3
|
+
/**
|
|
4
|
+
* The step a flow is on, already resolved by the app. The library never
|
|
5
|
+
* defines steps: the app maps its own step (e.g. from the API) to a position
|
|
6
|
+
* and a translated title, then reports it.
|
|
7
|
+
*/
|
|
8
|
+
export type StepProgress = {
|
|
9
|
+
/** Active step (1-based). */
|
|
10
|
+
currentStep: number;
|
|
11
|
+
/** Total number of steps. May change as the flow reveals its path. */
|
|
12
|
+
totalSteps: number;
|
|
13
|
+
/** Translated title of the current step. */
|
|
14
|
+
title: string;
|
|
15
|
+
};
|
|
16
|
+
export type StepProgressProviderProps = {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Progress to show on the first render, before any page has reported, e.g.
|
|
20
|
+
* so a server-rendered layout paints the bar straight away.
|
|
21
|
+
*/
|
|
22
|
+
initialProgress?: StepProgress;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Holds the step a persistent flow header shows. Put it in the flow layout,
|
|
26
|
+
* above the route's loading boundary, so the header survives step navigations
|
|
27
|
+
* instead of remounting with the page, and its bar animates between steps.
|
|
28
|
+
*
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <StepProgressProvider>
|
|
31
|
+
* <StepProgressHeader onBack={router.back} />
|
|
32
|
+
* {children}
|
|
33
|
+
* </StepProgressProvider>
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare const StepProgressProvider: ({ children, initialProgress, }: StepProgressProviderProps) => import("react").JSX.Element;
|
|
37
|
+
/**
|
|
38
|
+
* The last reported step, or `null` before anything has been reported or
|
|
39
|
+
* outside a `StepProgressProvider`. Use it to render `FormStepper` or a custom
|
|
40
|
+
* header from the same state.
|
|
41
|
+
*/
|
|
42
|
+
export declare const useStepProgress: () => StepProgress | null;
|
|
43
|
+
/**
|
|
44
|
+
* Publishes the current step to the nearest `StepProgressProvider`. Pass
|
|
45
|
+
* `null` while the step isn't resolved yet; nothing is reported then. Never
|
|
46
|
+
* clears on unmount, so the header holds its value while the next route's
|
|
47
|
+
* loading fallback is on screen.
|
|
48
|
+
*
|
|
49
|
+
* ```tsx
|
|
50
|
+
* useReportStepProgress({ currentStep: 2, totalSteps: 5, title: t("income") });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare const useReportStepProgress: (progress: StepProgress | null) => void;
|
|
54
|
+
export type StepProgressHeaderProps = Omit<LinearFormStepperProps, "currentStep" | "totalSteps" | "title">;
|
|
55
|
+
/**
|
|
56
|
+
* A `LinearFormStepper` driven by the nearest `StepProgressProvider`. Renders
|
|
57
|
+
* nothing until a step has been reported. Everything except the step itself
|
|
58
|
+
* (`onBack`, `color`, `headingLevel`, …) is passed as props.
|
|
59
|
+
*/
|
|
60
|
+
export declare const StepProgressHeader: (props: StepProgressHeaderProps) => import("react").JSX.Element | null;
|
|
@@ -1,39 +1,41 @@
|
|
|
1
1
|
import { Tabs as BaseTabs } from '@base-ui/react/tabs';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export type
|
|
2
|
+
import { ColorRoles } from '../color-roles';
|
|
3
|
+
/** The colours of the active "pill". */
|
|
4
|
+
export type Color = ColorRoles<"primary" | "secondary">;
|
|
5
|
+
export type RootProps = Omit<BaseTabs.Root.Props, "color"> & {
|
|
5
6
|
/**
|
|
6
7
|
* Colour of the active-tab "pill".
|
|
7
|
-
* - `"
|
|
8
|
-
* - `"
|
|
9
|
-
* @default "
|
|
8
|
+
* - `"primary"` — filled with the brand purple (default).
|
|
9
|
+
* - `"secondary"` — filled with near-black, for a neutral surface.
|
|
10
|
+
* @default "primary"
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
|
+
color?: Color;
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
15
|
* A segmented, pill-style tabs control built on Base UI's accessible `Tabs`
|
|
15
16
|
* primitive. Renders a beige track with a sliding pill behind the active tab.
|
|
16
17
|
*
|
|
17
|
-
* Compose it from `
|
|
18
|
-
* for built-in content. Roles
|
|
19
|
-
*
|
|
20
|
-
* wired by Base UI, so
|
|
18
|
+
* Compose it from `Tabs.Root`, `Tabs.List` + `Tabs.Tab` (the tab bar) and,
|
|
19
|
+
* optionally, `Tabs.Panel` for built-in content. Roles
|
|
20
|
+
* (`tablist`/`tab`/`tabpanel`), roving `tabindex`, arrow-key navigation,
|
|
21
|
+
* `aria-selected` and the `tab`↔`tabpanel` links are all wired by Base UI, so
|
|
22
|
+
* relationships never dangle.
|
|
21
23
|
*
|
|
22
24
|
* The list scrolls horizontally when the tabs overflow (e.g. on mobile) and the
|
|
23
25
|
* pill slide respects `prefers-reduced-motion`.
|
|
24
26
|
*
|
|
25
27
|
* ```tsx
|
|
26
|
-
* <Tabs defaultValue="overview">
|
|
27
|
-
* <
|
|
28
|
-
* <Tab value="overview">Overview</Tab>
|
|
29
|
-
* <Tab value="activity">Activity</Tab>
|
|
30
|
-
* </
|
|
31
|
-
* <
|
|
32
|
-
* <
|
|
33
|
-
* </Tabs>
|
|
28
|
+
* <Tabs.Root defaultValue="overview">
|
|
29
|
+
* <Tabs.List aria-label="Account sections">
|
|
30
|
+
* <Tabs.Tab value="overview">Overview</Tabs.Tab>
|
|
31
|
+
* <Tabs.Tab value="activity">Activity</Tabs.Tab>
|
|
32
|
+
* </Tabs.List>
|
|
33
|
+
* <Tabs.Panel value="overview">Workspace stats and activity.</Tabs.Panel>
|
|
34
|
+
* <Tabs.Panel value="activity">Recent activity.</Tabs.Panel>
|
|
35
|
+
* </Tabs.Root>
|
|
34
36
|
* ```
|
|
35
37
|
*/
|
|
36
|
-
export declare function
|
|
38
|
+
export declare function Root({ color, className, ...rest }: RootProps): import("react").JSX.Element;
|
|
37
39
|
/**
|
|
38
40
|
* Requires an accessible name so the underlying `tablist` is never nameless.
|
|
39
41
|
* Provide exactly one of `aria-label` or `aria-labelledby`.
|
|
@@ -45,35 +47,36 @@ type TabsListAccessibleName = {
|
|
|
45
47
|
"aria-labelledby": string;
|
|
46
48
|
"aria-label"?: never;
|
|
47
49
|
};
|
|
48
|
-
export type
|
|
50
|
+
export type ListProps = Omit<BaseTabs.List.Props, "render" | "aria-label" | "aria-labelledby"> & TabsListAccessibleName;
|
|
49
51
|
/**
|
|
50
|
-
* Groups the `Tab` buttons into the pill track. The sliding indicator is
|
|
52
|
+
* Groups the `Tabs.Tab` buttons into the pill track. The sliding indicator is
|
|
51
53
|
* rendered internally so it can never go missing.
|
|
52
54
|
*/
|
|
53
|
-
export declare function
|
|
55
|
+
export declare function List({ children, className, ...rest }: ListProps): import("react").JSX.Element;
|
|
54
56
|
export type TabProps = Omit<BaseTabs.Tab.Props, "render">;
|
|
55
57
|
/**
|
|
56
58
|
* An individual tab. Pass an icon and label as children; mark decorative icons
|
|
57
59
|
* with `aria-hidden` so they aren't announced.
|
|
58
60
|
*
|
|
59
61
|
* ```tsx
|
|
60
|
-
* <Tab value="transactions">
|
|
62
|
+
* <Tabs.Tab value="transactions">
|
|
61
63
|
* <Receipt size={18} aria-hidden />
|
|
62
64
|
* Transaksjoner
|
|
63
|
-
* </Tab>
|
|
65
|
+
* </Tabs.Tab>
|
|
64
66
|
* ```
|
|
65
67
|
*/
|
|
66
|
-
export declare function Tab(
|
|
67
|
-
export type
|
|
68
|
+
export declare function Tab({ className, ...rest }: TabProps): import("react").JSX.Element;
|
|
69
|
+
export type IndicatorProps = Omit<BaseTabs.Indicator.Props, "render">;
|
|
68
70
|
/**
|
|
69
|
-
* The sliding pill behind the active tab. `
|
|
71
|
+
* The sliding pill behind the active tab. `Tabs.List` already renders one, so
|
|
70
72
|
* you only need this when composing a custom list.
|
|
71
73
|
*/
|
|
72
|
-
export declare function
|
|
73
|
-
export type
|
|
74
|
+
export declare function Indicator({ className, ...rest }: IndicatorProps): import("react").JSX.Element;
|
|
75
|
+
export type PanelProps = Omit<BaseTabs.Panel.Props, "render">;
|
|
74
76
|
/**
|
|
75
|
-
* Content shown when the `Tab` with the matching `value` is active.
|
|
76
|
-
* omit it to use `Tabs` purely as a bar that toggles content you
|
|
77
|
-
* elsewhere (drive it with `value`/`onValueChange`).
|
|
77
|
+
* Content shown when the `Tabs.Tab` with the matching `value` is active.
|
|
78
|
+
* Optional — omit it to use `Tabs` purely as a bar that toggles content you
|
|
79
|
+
* render elsewhere (drive it with `value`/`onValueChange`).
|
|
78
80
|
*/
|
|
79
|
-
export declare function
|
|
81
|
+
export declare function Panel({ className, ...rest }: PanelProps): import("react").JSX.Element;
|
|
82
|
+
export {};
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* "Next" subtitle prefix, and the visually-hidden "step X of Y" context.
|
|
4
4
|
* Consumers can override any of these per-instance via the `labels` prop.
|
|
5
5
|
*/
|
|
6
|
-
export declare const useStepperLabels: () => Record<"
|
|
6
|
+
export declare const useStepperLabels: () => Record<"step" | "next" | "back" | "of", string>;
|
|
7
7
|
export type StepperLabels = Partial<ReturnType<typeof useStepperLabels>>;
|
|
@@ -1,23 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
+
import { Ref } from 'react';
|
|
3
|
+
import { ColorRoles } from '../color-roles';
|
|
4
|
+
export type LinkColor = ColorRoles<"secondary" | "primary" | "tertiary" | "contrast">;
|
|
5
|
+
export type LinkProps = Omit<useRender.ComponentProps<"a">, "ref" | "color"> & {
|
|
6
|
+
/**
|
|
7
|
+
* The colour of the link: `secondary` is the near-black of body text,
|
|
8
|
+
* `primary` the brand purple, `tertiary` the brand teal. Use `contrast`
|
|
9
|
+
* (white) on a dark surface.
|
|
10
|
+
* @default "secondary"
|
|
11
|
+
*/
|
|
8
12
|
color?: LinkColor;
|
|
13
|
+
/** The rendered element: the `<a>`, or the element passed to `render`. */
|
|
14
|
+
ref?: Ref<HTMLElement>;
|
|
9
15
|
};
|
|
10
16
|
/**
|
|
11
|
-
* A link
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
17
|
+
* A link inside running text: underlined, so it is told apart from the words
|
|
18
|
+
* around it by more than its colour, and in the size and line height of the
|
|
19
|
+
* text around it. Renders an `a`; pass a router link
|
|
20
|
+
* through `render`:
|
|
15
21
|
*
|
|
16
22
|
* ```tsx
|
|
17
|
-
* <Link href="/
|
|
18
|
-
* <Link
|
|
19
|
-
* <Link
|
|
23
|
+
* <Link href="/om-oss">Om oss</Link>
|
|
24
|
+
* <Link render={<NextLink href="/om-oss" />}>Om oss</Link>
|
|
25
|
+
* <Link render={<RouterLink to="/om-oss" />}>Om oss</Link>
|
|
20
26
|
* ```
|
|
27
|
+
*
|
|
28
|
+
* For an action that only looks like a link, render a button:
|
|
29
|
+
* `<Link render={<button type="button" />} onClick={…}>`. For a link that
|
|
30
|
+
* looks like a button, use `Button` with `render`.
|
|
21
31
|
*/
|
|
22
|
-
export declare
|
|
23
|
-
export {};
|
|
32
|
+
export declare function Link({ color, render, ref, className, ...rest }: LinkProps): import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ReactNode } from 'react';
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
3
2
|
/**
|
|
4
3
|
* List is a composition component for rendering ordered or unordered lists.
|
|
5
4
|
*
|
|
@@ -25,30 +24,28 @@ import { ReactNode } from 'react';
|
|
|
25
24
|
* </List.Root>
|
|
26
25
|
*/
|
|
27
26
|
type ListVariant = "ul" | "ol";
|
|
28
|
-
|
|
29
|
-
/**
|
|
27
|
+
type RootProps = Omit<ComponentProps<"ul">, "ref"> & {
|
|
28
|
+
/**
|
|
29
|
+
* The type of list to render.
|
|
30
|
+
* @default "ul"
|
|
31
|
+
*/
|
|
30
32
|
variant?: ListVariant;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/** The class name of the list. */
|
|
36
|
-
className?: string;
|
|
37
|
-
/** The gap between the list items. */
|
|
33
|
+
/**
|
|
34
|
+
* The gap between the list items, as a multiple of the spacing step.
|
|
35
|
+
* @default 1.5
|
|
36
|
+
*/
|
|
38
37
|
gap?: number;
|
|
39
|
-
}
|
|
40
|
-
export declare const Root: ({ variant,
|
|
41
|
-
|
|
38
|
+
};
|
|
39
|
+
export declare const Root: ({ variant, gap, className, style, children, ...rest }: RootProps) => import("react").JSX.Element;
|
|
40
|
+
type ItemProps = Omit<ComponentProps<"li">, "ref"> & {
|
|
42
41
|
/** Custom marker rendered in place of the default dot/number. */
|
|
43
42
|
icon?: ReactNode;
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
className?: string;
|
|
50
|
-
/** The gap between the list items. */
|
|
43
|
+
/**
|
|
44
|
+
* The gap between a custom `icon` and the text, as a multiple of the spacing
|
|
45
|
+
* step. The dot and the number keep their own spacing.
|
|
46
|
+
* @default 1.5
|
|
47
|
+
*/
|
|
51
48
|
gap?: number;
|
|
52
|
-
}
|
|
53
|
-
export declare const Item: ({ icon,
|
|
49
|
+
};
|
|
50
|
+
export declare const Item: ({ icon, gap, className, style, children, ...rest }: ItemProps) => import("react").JSX.Element;
|
|
54
51
|
export {};
|
|
@@ -1,18 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
+
import { Ref } from 'react';
|
|
3
|
+
import { ColorPath } from '../../theme/token-types';
|
|
4
|
+
import { fontSizes } from '../../theme/tokens/font-sizes';
|
|
5
|
+
import { fontWeights } from '../../theme/tokens/font-weights';
|
|
6
|
+
import { TextStyleToken } from '../../theme/tokens/text-styles';
|
|
3
7
|
type FontSizeToken = keyof typeof fontSizes;
|
|
4
8
|
type FontWeightToken = keyof typeof fontWeights;
|
|
5
|
-
|
|
9
|
+
/** A palette token such as `text.subtle`, or `inherit` for the parent's colour. */
|
|
10
|
+
export type TextColor = ColorPath | "inherit";
|
|
11
|
+
export type TextAlign = "start" | "center" | "end";
|
|
12
|
+
export type TextProps = Omit<useRender.ComponentProps<"p">, "ref" | "color"> & {
|
|
13
|
+
/**
|
|
14
|
+
* A text style such as `heading-lg` or `body-sm`: size, weight, line height
|
|
15
|
+
* and letter spacing as one token. It says how the text looks, not which
|
|
16
|
+
* element it is, so pick the element with `render` from the page hierarchy.
|
|
17
|
+
* @default "body-md"
|
|
18
|
+
*/
|
|
19
|
+
textStyle?: TextStyleToken;
|
|
20
|
+
/** A font weight token, when the text style's own weight does not fit. */
|
|
6
21
|
fontWeight?: FontWeightToken;
|
|
7
|
-
|
|
22
|
+
/**
|
|
23
|
+
* A colour token from the palette, written as its path. Use `inherit` to
|
|
24
|
+
* take the colour of the surrounding text.
|
|
25
|
+
* @default "text.base"
|
|
26
|
+
*/
|
|
27
|
+
color?: TextColor;
|
|
28
|
+
/** Text alignment, following the reading direction. */
|
|
29
|
+
align?: TextAlign;
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Use `textStyle`. The `fontSize` scale (`xs` to `6xl`) is from
|
|
32
|
+
* before the text styles and is removed in a later major.
|
|
33
|
+
*/
|
|
8
34
|
fontSize?: FontSizeToken;
|
|
35
|
+
/** The rendered element: the `<p>`, or the element passed to `render`. */
|
|
36
|
+
ref?: Ref<HTMLElement>;
|
|
9
37
|
};
|
|
10
38
|
/**
|
|
11
|
-
*
|
|
12
|
-
* `
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
39
|
+
* Text set in one of Lea's text styles. Renders a `p` with no margin; pass
|
|
40
|
+
* `render` for another element:
|
|
41
|
+
*
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <Text>Vi svarer innen to virkedager.</Text>
|
|
44
|
+
* <Text render={<h1 />} textStyle="heading-lg">Mine lån</Text>
|
|
45
|
+
* <Text render={<span />} textStyle="body-sm" color="text.subtle">
|
|
46
|
+
* Sist oppdatert i dag
|
|
47
|
+
* </Text>
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* Spacing around the text belongs to the layout: use `Stack` and its `gap`, or
|
|
51
|
+
* `className` and `style`.
|
|
16
52
|
*/
|
|
17
|
-
export declare
|
|
53
|
+
export declare function Text({ textStyle, fontWeight, color, align, fontSize, render, ref, className, style, ...rest }: TextProps): import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>>;
|
|
18
54
|
export {};
|