@ahrowe/ui 0.44.0 → 0.45.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 +17 -0
- package/README.md +1 -1
- package/dist/cjs-types/common/button/button.types.d.ts +1 -1
- package/dist/cjs-types/common/configProvider/configProvider.types.d.ts +2 -0
- package/dist/cjs-types/common/stepper/stepper.d.ts +1 -1
- package/dist/cjs-types/common/stepper/stepper.types.d.ts +28 -12
- package/dist/cjs-types/common/themeProvider/theme.types.d.ts +0 -12
- package/dist/esm/common/button/button.mjs +1 -1
- package/dist/esm/common/button/button.mjs.map +1 -1
- package/dist/esm/common/button/button.module.mjs +1 -1
- package/dist/esm/common/button/button.module.mjs.map +1 -1
- package/dist/esm/common/button/button.types.mjs +1 -1
- package/dist/esm/common/button/button.types.mjs.map +1 -1
- package/dist/esm/common/splitButton/splitButton.mjs +1 -1
- package/dist/esm/common/splitButton/splitButton.mjs.map +1 -1
- package/dist/esm/common/stepper/stepper.mjs +1 -1
- package/dist/esm/common/stepper/stepper.mjs.map +1 -1
- package/dist/esm/common/stepper/stepper.module.mjs +1 -1
- package/dist/esm/common/stepper/stepper.module.mjs.map +1 -1
- package/dist/esm/common/stepper/stepper.types.mjs +1 -1
- package/dist/esm/common/stepper/stepper.types.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/common/button/button.types.d.ts +1 -1
- package/dist/types/common/configProvider/configProvider.types.d.ts +2 -0
- package/dist/types/common/stepper/stepper.d.ts +1 -1
- package/dist/types/common/stepper/stepper.types.d.ts +28 -12
- package/dist/types/common/themeProvider/theme.types.d.ts +0 -12
- package/docs/Button.md +8 -2
- package/docs/CLAUDE.md +1 -1
- package/docs/ConfigProvider.md +1 -1
- package/docs/SplitButton.md +1 -1
- package/docs/Stepper.md +57 -29
- package/package.json +1 -1
|
@@ -14,8 +14,8 @@ export declare enum ButtonStyleType {
|
|
|
14
14
|
Plain = "plain"
|
|
15
15
|
}
|
|
16
16
|
export declare enum ButtonSize {
|
|
17
|
-
Default = "default",
|
|
18
17
|
Small = "small",
|
|
18
|
+
/** The default. */
|
|
19
19
|
Medium = "medium",
|
|
20
20
|
Large = "large",
|
|
21
21
|
/** Square, padding-free button for a lone icon. Give it its own width/height. */
|
|
@@ -48,6 +48,7 @@ import { RoomDrawerProps } from '../roomDrawer/roomDrawer.types.js';
|
|
|
48
48
|
import { RoomViewerProps } from '../roomViewer/roomViewer.types.js';
|
|
49
49
|
import { PopoverProps } from '../popover/popover.types.js';
|
|
50
50
|
import { ModalProps } from '../modal/modal.types.js';
|
|
51
|
+
import { StepperProps } from '../stepper/stepper.types.js';
|
|
51
52
|
import { Presentation } from '../configProvider/presentation.types.js';
|
|
52
53
|
/**
|
|
53
54
|
* Global default props keyed by component name.
|
|
@@ -131,6 +132,7 @@ export interface ComponentDefaults {
|
|
|
131
132
|
Modal?: Partial<ModalProps>;
|
|
132
133
|
CommandPalette?: Partial<CommandPaletteProps>;
|
|
133
134
|
WeatherIcon?: Partial<WeatherIconProps>;
|
|
135
|
+
Stepper?: Partial<StepperProps>;
|
|
134
136
|
}
|
|
135
137
|
export interface ConfigProviderProps {
|
|
136
138
|
children: React.ReactNode;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { StepperProps } from './stepper.types.js';
|
|
3
|
-
export default function Stepper(
|
|
3
|
+
export default function Stepper(props: StepperProps): React.JSX.Element;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { IconContent } from '../types/icon.types.js';
|
|
3
3
|
import { SlotClassNames, SlotStyles, HtmlProps } from '../types/slots.types.js';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import { ColorValue } from '../themeProvider/color.types.js';
|
|
5
|
+
/** Direction the steps run in. */
|
|
6
|
+
export declare enum StepperOrientation {
|
|
6
7
|
Horizontal = "horizontal",
|
|
7
8
|
Vertical = "vertical"
|
|
8
9
|
}
|
|
9
|
-
/**
|
|
10
|
+
/** How the step markers are drawn. */
|
|
10
11
|
export declare enum StepperStyleType {
|
|
11
|
-
/** Numbered markers, filled solid on completion
|
|
12
|
-
|
|
13
|
-
/** Numbered markers that stay ringed when completed
|
|
12
|
+
/** Numbered markers, filled solid on completion. The default. */
|
|
13
|
+
Filled = "filled",
|
|
14
|
+
/** Numbered markers that stay ringed when completed, with a check in the colour. */
|
|
14
15
|
Outlined = "outlined",
|
|
15
16
|
/** Minimal dots without numbers, for a compact onboarding or carousel style. */
|
|
16
17
|
Dots = "dots"
|
|
@@ -39,6 +40,16 @@ export declare enum StepperLabelPlacement {
|
|
|
39
40
|
Right = "right"
|
|
40
41
|
}
|
|
41
42
|
export type StepperSlots = 'root' | 'entry' | 'entryNumber' | 'entryLabel' | 'connector' | 'description' | 'content' | 'optional' | 'icon';
|
|
43
|
+
export interface StepperLabels {
|
|
44
|
+
/** Hint under the label of a step with `optional: true`. */
|
|
45
|
+
optional?: string;
|
|
46
|
+
/** Status of a completed step, read out by screen readers. */
|
|
47
|
+
completed?: string;
|
|
48
|
+
/** Status of a step not reached yet, read out by screen readers. */
|
|
49
|
+
notCompleted?: string;
|
|
50
|
+
/** Status of a step with `error`, read out by screen readers. */
|
|
51
|
+
error?: string;
|
|
52
|
+
}
|
|
42
53
|
export interface StepperStep {
|
|
43
54
|
/** Primary label for the step. */
|
|
44
55
|
label: React.ReactNode;
|
|
@@ -48,28 +59,33 @@ export interface StepperStep {
|
|
|
48
59
|
content?: React.ReactNode;
|
|
49
60
|
/** Icon shown in the marker instead of the step number — a FontAwesome icon or any node. */
|
|
50
61
|
icon?: IconContent;
|
|
51
|
-
/** Marks the step as errored,
|
|
62
|
+
/** Marks the step as errored, drawing its marker in the theme's `--error-color`. */
|
|
52
63
|
error?: boolean;
|
|
53
|
-
/** `true` renders
|
|
64
|
+
/** `true` renders the `optional` label as a hint; a node renders custom hint text. */
|
|
54
65
|
optional?: boolean | React.ReactNode;
|
|
55
66
|
/** Disables this step: never clickable, dimmed. */
|
|
56
67
|
disabled?: boolean;
|
|
57
68
|
}
|
|
58
|
-
export interface StepperProps extends HtmlProps {
|
|
69
|
+
export interface StepperProps extends HtmlProps<HTMLOListElement> {
|
|
59
70
|
steps?: StepperStep[];
|
|
71
|
+
/** Zero-based index of the current step. `steps.length` marks every step completed. */
|
|
60
72
|
currentStep?: number;
|
|
61
|
-
|
|
73
|
+
/** Direction the steps run in (default `Horizontal`). */
|
|
74
|
+
orientation?: StepperOrientation;
|
|
62
75
|
onStepClicked?: ((index: number) => void) | null;
|
|
63
76
|
/** Allow clicking any step, not just completed ones. */
|
|
64
77
|
nonLinear?: boolean;
|
|
65
|
-
/** Hide
|
|
78
|
+
/** Hide each step's label, description and hint visually. Screen readers still read them. */
|
|
66
79
|
hideLabels?: boolean;
|
|
67
|
-
/**
|
|
80
|
+
/** How the markers are drawn (default `Filled`). */
|
|
68
81
|
styleType?: StepperStyleType;
|
|
82
|
+
/** A `ThemeColor` (default `Primary`) or any CSS colour, such as `'var(--brand)'`. */
|
|
83
|
+
color?: ColorValue;
|
|
69
84
|
/** Which step bodies are expanded. Vertical `content` only (default `None`). */
|
|
70
85
|
collapse?: StepperCollapse;
|
|
71
86
|
/** Label position relative to the marker (default: horizontal `Bottom`, vertical `Right`). */
|
|
72
87
|
labelPlacement?: StepperLabelPlacement;
|
|
88
|
+
labels?: StepperLabels;
|
|
73
89
|
className?: string;
|
|
74
90
|
style?: React.CSSProperties;
|
|
75
91
|
classNames?: SlotClassNames<StepperSlots>;
|
|
@@ -125,24 +125,12 @@ export interface ThemeVariables {
|
|
|
125
125
|
'--stepper-marker-size'?: string;
|
|
126
126
|
/** Step marker corner radius. Falls back to --default-border-radius. */
|
|
127
127
|
'--stepper-marker-radius'?: string;
|
|
128
|
-
/** Idle (upcoming) marker/connector colour. Falls back to --primary-lighter. */
|
|
129
|
-
'--stepper-idle-color'?: string;
|
|
130
|
-
/** Current-step marker colour. Falls back to --primary-color. */
|
|
131
|
-
'--stepper-active-color'?: string;
|
|
132
|
-
/** Completed-step marker fill/colour. Falls back to --primary-color. */
|
|
133
|
-
'--stepper-done-color'?: string;
|
|
134
|
-
/** Errored-step marker colour. Falls back to --error-color. */
|
|
135
|
-
'--stepper-error-color'?: string;
|
|
136
|
-
/** Completed connector colour. Falls back to --primary-color. */
|
|
137
|
-
'--stepper-connector-color'?: string;
|
|
138
128
|
/** Completed connector thickness. Falls back to 3px. */
|
|
139
129
|
'--stepper-connector-thickness'?: string;
|
|
140
130
|
/** Not-yet-reached connector thickness. Falls back to 1px. */
|
|
141
131
|
'--stepper-connector-idle-thickness'?: string;
|
|
142
132
|
/** Gap between marker and label, and grid column gap. Falls back to 12px. */
|
|
143
133
|
'--stepper-gap'?: string;
|
|
144
|
-
/** Text/check colour on a filled marker. Falls back to --text-on-primary. */
|
|
145
|
-
'--stepper-text-on-marker'?: string;
|
|
146
134
|
/** Timer ring track (unfilled) colour. Falls back to --background-accent-light. */
|
|
147
135
|
'--timer-track-color'?: string;
|
|
148
136
|
/** Timer ring progress (remaining time) colour. Falls back to --primary-color. */
|
package/docs/Button.md
CHANGED
|
@@ -69,7 +69,7 @@ import { faPlus, faSave, faTrash, faXmark } from '@fortawesome/free-solid-svg-ic
|
|
|
69
69
|
|
|
70
70
|
- `ButtonStyleType`: `Filled` | `Light` | `Outlined` (default) | `Plain`
|
|
71
71
|
- `ThemeColor`: `Primary` (default) | `Neutral` | `Success` | `Info` | `Warn` | `Error`
|
|
72
|
-
- `ButtonSize`: `
|
|
72
|
+
- `ButtonSize`: `Small` | `Medium` (default) | `Large` | `Icon`
|
|
73
73
|
- `ButtonType`: `Button` | `Reset` | `Submit`
|
|
74
74
|
|
|
75
75
|
**Key props:**
|
|
@@ -119,10 +119,16 @@ so an icon is never cut off by a flexible sibling. A multi-word label still wrap
|
|
|
119
119
|
|
|
120
120
|
## Sizing
|
|
121
121
|
|
|
122
|
-
A Button is sized by its font. `--default-font-size` is the base, and `Small` and `Large` are multiples of it (0.75x and 1.25x), so a theme with a smaller base font gets proportionally smaller controls everywhere. Padding and the icon gap are in `em`, so the whole box grows with the label rather than a large button wearing a
|
|
122
|
+
A Button is sized by its font. `--default-font-size` is the base, `Medium` is that size, and `Small` and `Large` are multiples of it (0.75x and 1.25x), so a theme with a smaller base font gets proportionally smaller controls everywhere. Padding and the icon gap are in `em`, so the whole box grows with the label rather than a large button wearing a medium button's padding.
|
|
123
123
|
|
|
124
124
|
`ButtonSize.Icon` is the exception: it inherits the surrounding text size and has no padding at all, because the caller sets the box.
|
|
125
125
|
|
|
126
|
+
## Migration from `ButtonSize.Default`
|
|
127
|
+
|
|
128
|
+
Before 0.45, `ButtonSize.Default` was a second name for `Medium`, which is now the default. Replace
|
|
129
|
+
`size={ButtonSize.Default}` with `size={ButtonSize.Medium}`, or leave the prop out. The look does
|
|
130
|
+
not change.
|
|
131
|
+
|
|
126
132
|
## Migration from `Primary`, `Default` and `Delete`
|
|
127
133
|
|
|
128
134
|
Before 0.43, `styleType` set emphasis and colour in one value. `Primary`, `Default` and `Delete` no
|
package/docs/CLAUDE.md
CHANGED
|
@@ -128,7 +128,7 @@ enums and slot names. Do not infer props from a component's name.
|
|
|
128
128
|
| Skeleton.md | Skeleton, SkeletonVariant, SkeletonAnimation | Content-shaped loading placeholder, shown while real content is being fetched — more polished than a Loader for content-heavy pages (lists, cards, profile headers) |
|
|
129
129
|
| Slider.md | Slider | Let the user pick a number from a continuous or stepped range by dragging a thumb: volume, brightness, price ranges, zoom, quality presets |
|
|
130
130
|
| SplitButton.md | SplitButton | A primary action button with a small attached dropdown for closely related secondary actions, e.g. "Save ▾" opening "Save as draft" / "Save and close" |
|
|
131
|
-
| Stepper.md | Stepper | Step progress indicator for multi-step forms, onboarding flows, and checkout wizards |
|
|
131
|
+
| Stepper.md | Stepper, StepperOrientation, StepperStyleType, StepperCollapse, StepperLabelPlacement, ThemeColor | Step progress indicator for multi-step forms, onboarding flows, and checkout wizards |
|
|
132
132
|
| Sticky.md | Sticky | Pin a piece of content to the top of the viewport once the page scrolls past it — section headers, toolbars, filter bars, table headers |
|
|
133
133
|
| Switch.md | Switch | Sliding boolean toggle — settings panels, feature flags, preference lists |
|
|
134
134
|
| TabHeader.md | TabHeader | A horizontal row of tabs to switch between sibling views or sections — settings panels, dashboards, detail pages |
|
package/docs/ConfigProvider.md
CHANGED
|
@@ -95,7 +95,7 @@ A nested provider inherits it unless it sets its own, the same way `defaultProps
|
|
|
95
95
|
Each entry is a `Partial<...Props>`, so any of that component's props can be defaulted:
|
|
96
96
|
|
|
97
97
|
- **Form inputs:** `Input` · `Textarea` · `NumberInput` · `Dropdown` · `InputDropdown` · `Checkbox` · `Switch` · `RadioGroup` · `DatePicker` · `OptionPicker` · `OtpInput`
|
|
98
|
-
- **Display:** `Button` · `CopyButton` · `ActionButtons` · `Badge` · `Chip` · `Card` · `SectionHeader` · `Skeleton` · `Loader` · `LoadingOverlay` · `Accordion` · `Divider` · `Timer` · `WeatherIcon`
|
|
98
|
+
- **Display:** `Button` · `CopyButton` · `ActionButtons` · `Badge` · `Chip` · `Card` · `SectionHeader` · `Skeleton` · `Loader` · `LoadingOverlay` · `Accordion` · `Divider` · `Timer` · `WeatherIcon` · `Stepper`
|
|
99
99
|
- **Overlays:** `ConfirmModal` · `Modal` · `CommandPalette` · `Popover`
|
|
100
100
|
- **Editors:** `RoomDrawer`, `RoomViewer`
|
|
101
101
|
- **Scheduling:** `Calendar`, for `labels`, `locale`, `weekStartsOn`, `slotMinutes`, `views`, `hiddenDays`, `scrollToHour`, `workingHours` and `showWeekNumbers` only (see below)
|
package/docs/SplitButton.md
CHANGED
|
@@ -70,7 +70,7 @@ import { ButtonStyleType } from '@ahrowe/ui';
|
|
|
70
70
|
| `actions` | `SplitButtonAction[]` | Secondary actions shown in the dropdown |
|
|
71
71
|
| `styleType` | `ButtonStyleType` | Shared by both the primary and trigger button (default `Filled`) |
|
|
72
72
|
| `color` | `ColorValue` | Shared by both buttons (default `Primary`); or any CSS colour, as on Button |
|
|
73
|
-
| `size` | `ButtonSize` | Size variant, shared by both buttons |
|
|
73
|
+
| `size` | `ButtonSize` | Size variant, shared by both buttons (default `Medium`) |
|
|
74
74
|
| `disabled` | `boolean` | Disables both the primary and trigger button |
|
|
75
75
|
| `isLoading` | `boolean` | Shows a spinner on the primary button (same as `Button`'s own `isLoading`) |
|
|
76
76
|
| `align` | `PopoverAlign` | Which edge of the group the menu lines up with (default `End`, the chevron's side). The menu is a [Menu](Menu.md), hence `Popover`'s enum |
|
package/docs/Stepper.md
CHANGED
|
@@ -4,17 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
**Keywords:** wizard steps, progress steps
|
|
6
6
|
|
|
7
|
-
**Import:** `import { Stepper } from '@ahrowe/ui'`
|
|
8
|
-
**Types:** `import type { StepperStep, StepperProps } from '@ahrowe/ui'`
|
|
7
|
+
**Import:** `import { Stepper, StepperOrientation, StepperStyleType, StepperCollapse, StepperLabelPlacement, ThemeColor } from '@ahrowe/ui'`
|
|
8
|
+
**Types:** `import type { StepperStep, StepperProps, StepperLabels } from '@ahrowe/ui'`
|
|
9
9
|
|
|
10
10
|
**Enums:**
|
|
11
|
-
- `
|
|
12
|
-
- `StepperStyleType`: `
|
|
11
|
+
- `StepperOrientation`: `Horizontal` (default) | `Vertical`
|
|
12
|
+
- `StepperStyleType`: `Filled` (default: completed markers filled solid) | `Outlined` (completed markers stay ringed, with a check in the colour) | `Dots` (minimal dots, no numbers)
|
|
13
13
|
- `StepperCollapse`: `None` (default) | `ActiveOnly` | `Completed`
|
|
14
14
|
- `StepperLabelPlacement`: `Top` | `Bottom` | `Left` | `Right`
|
|
15
15
|
|
|
16
|
+
**Colours:** any `color`: a `ThemeColor` (default `Primary`) or any CSS colour, see [ThemeColor.md](ThemeColor.md). It paints the current and completed markers and the connectors between them. Upcoming steps are drawn in the theme's `--border-color` and `--text-dark`, and a step with `error` in its `--error-color`.
|
|
17
|
+
|
|
16
18
|
```tsx
|
|
17
|
-
import { Stepper,
|
|
19
|
+
import { Stepper, StepperOrientation, StepperStyleType, StepperCollapse, ThemeColor } from '@ahrowe/ui';
|
|
18
20
|
import { faUser, faCreditCard } from '@fortawesome/free-solid-svg-icons';
|
|
19
21
|
|
|
20
22
|
const steps = [
|
|
@@ -26,15 +28,16 @@ const steps = [
|
|
|
26
28
|
// Horizontal (default)
|
|
27
29
|
<Stepper steps={steps} currentStep={1} />
|
|
28
30
|
|
|
29
|
-
// Style presets
|
|
31
|
+
// Style presets and colour
|
|
30
32
|
<Stepper steps={steps} currentStep={1} styleType={StepperStyleType.Outlined} />
|
|
31
33
|
<Stepper steps={steps} currentStep={1} styleType={StepperStyleType.Dots} hideLabels />
|
|
34
|
+
<Stepper steps={steps} currentStep={1} color={ThemeColor.Success} />
|
|
32
35
|
|
|
33
36
|
// Vertical, clickable
|
|
34
37
|
<Stepper
|
|
35
38
|
steps={steps}
|
|
36
39
|
currentStep={currentStep}
|
|
37
|
-
|
|
40
|
+
orientation={StepperOrientation.Vertical}
|
|
38
41
|
onStepClicked={(stepIndex) => setCurrentStep(stepIndex)}
|
|
39
42
|
/>
|
|
40
43
|
|
|
@@ -50,7 +53,7 @@ const steps = [
|
|
|
50
53
|
|
|
51
54
|
// Vertical wizard with collapsible bodies (only the active step's body is open)
|
|
52
55
|
<Stepper
|
|
53
|
-
|
|
56
|
+
orientation={StepperOrientation.Vertical}
|
|
54
57
|
collapse={StepperCollapse.ActiveOnly}
|
|
55
58
|
currentStep={step}
|
|
56
59
|
onStepClicked={setStep}
|
|
@@ -70,8 +73,8 @@ const steps = [
|
|
|
70
73
|
| `description` | `ReactNode` | Secondary line under the label |
|
|
71
74
|
| `content` | `ReactNode` | Collapsible body under the label (vertical only) |
|
|
72
75
|
| `icon` | `IconDefinition \| ReactElement` | Icon in the marker, replacing the number — FontAwesome icon or any React element |
|
|
73
|
-
| `error` | `boolean` |
|
|
74
|
-
| `optional` | `boolean \| ReactNode` | `true` →
|
|
76
|
+
| `error` | `boolean` | Draws the marker in `--error-color`, suppresses the checkmark, and tells screen readers |
|
|
77
|
+
| `optional` | `boolean \| ReactNode` | `true` → the `optional` label as a hint; a node → custom hint text |
|
|
75
78
|
| `disabled` | `boolean` | Never clickable, dimmed |
|
|
76
79
|
|
|
77
80
|
**Key props:**
|
|
@@ -79,16 +82,23 @@ const steps = [
|
|
|
79
82
|
| Prop | Type | Description |
|
|
80
83
|
|------|------|-------------|
|
|
81
84
|
| `steps` | `StepperStep[]` | The steps to render |
|
|
82
|
-
| `currentStep` | `number` | Zero-based
|
|
83
|
-
| `
|
|
84
|
-
| `styleType` | `StepperStyleType` |
|
|
85
|
+
| `currentStep` | `number` | Zero-based index of the current step. `steps.length` marks every step completed |
|
|
86
|
+
| `orientation` | `StepperOrientation` | Direction the steps run in (default `Horizontal`) |
|
|
87
|
+
| `styleType` | `StepperStyleType` | How the markers are drawn (default `Filled`) |
|
|
88
|
+
| `color` | `ColorValue` | A `ThemeColor` (default `Primary`) or any CSS colour |
|
|
85
89
|
| `collapse` | `StepperCollapse` | Which `content` bodies are expanded. Vertical only (default `None`) |
|
|
86
90
|
| `labelPlacement` | `StepperLabelPlacement` | Label position; default `Bottom` (horizontal) / `Right` (vertical). An out-of-orientation value falls back to that default |
|
|
87
|
-
| `onStepClicked` | `(stepIndex: number) => void` | Navigate on step click. Linear: only completed steps are clickable; with `nonLinear`, any enabled step except the current one |
|
|
91
|
+
| `onStepClicked` | `(stepIndex: number) => void` | Navigate on step click. Linear: only completed steps are clickable; with `nonLinear`, any enabled step except the current one. A clickable step is a `<button>`, and so is the current one, `aria-disabled`, so focus stays on a step after activating it |
|
|
88
92
|
| `nonLinear` | `boolean` | Allow clicking any step, not just completed ones |
|
|
89
|
-
| `hideLabels` | `boolean` | Hide
|
|
93
|
+
| `hideLabels` | `boolean` | Hide each step's label, description and hint visually. Screen readers still read them, and vertical `content` still shows |
|
|
94
|
+
|
|
95
|
+
**Layout:** a horizontal stepper gives every step an equal share of its width, with the marker centred in it and the label wrapping within it, so a long label never reaches past the stepper or into its neighbour. The connectors run from marker to marker.
|
|
96
|
+
|
|
97
|
+
**Collapse (vertical `content`):** `None` keeps every body open; `ActiveOnly` opens just the current step's body (classic vertical wizard); `Completed` collapses completed bodies while keeping the current and upcoming ones open. A collapsed body is `inert`, so nothing in it can be focused. Bodies animate their height and respect `prefers-reduced-motion`. Horizontal steppers don't render inline `content` and ignore `collapse`.
|
|
98
|
+
|
|
99
|
+
**Accessibility:** the stepper is an ordered list, the current step carries `aria-current="step"`, and every other step's status is read out from the `completed`, `notCompleted` and `error` labels. The marker is hidden from screen readers: the list gives the position.
|
|
90
100
|
|
|
91
|
-
**
|
|
101
|
+
**Labels:** `optional` `completed` `notCompleted` `error` — the text this component renders of its own; the last three are for screen readers only. Pass `labels` to override any of them, on the component or app-wide through `ConfigProvider`; they merge per key. Type: `StepperLabels`.
|
|
92
102
|
|
|
93
103
|
**Theming:** these are theme variables (typed on `ThemeVariables`). Set them theme-wide via `ThemeProvider`'s `variables`, or per instance via `style`, without fighting specificity. Each falls back to a built-in default when unset:
|
|
94
104
|
|
|
@@ -96,23 +106,16 @@ const steps = [
|
|
|
96
106
|
|----------|---------------|
|
|
97
107
|
| `--stepper-marker-size` | `40px` |
|
|
98
108
|
| `--stepper-marker-radius` | `var(--default-border-radius)` |
|
|
99
|
-
| `--stepper-idle-color` | `var(--primary-lighter)` |
|
|
100
|
-
| `--stepper-active-color` | `var(--primary-color)` |
|
|
101
|
-
| `--stepper-done-color` | `var(--primary-color)` |
|
|
102
|
-
| `--stepper-error-color` | `var(--error-color)` |
|
|
103
|
-
| `--stepper-connector-color` | `var(--primary-color)` |
|
|
104
109
|
| `--stepper-connector-thickness` (completed connectors) | `3px` |
|
|
105
110
|
| `--stepper-connector-idle-thickness` (not-yet-reached connectors) | `1px` |
|
|
106
111
|
| `--stepper-gap` | `12px` |
|
|
107
|
-
| `--stepper-text-on-marker` | `var(--text-on-primary)` |
|
|
108
112
|
|
|
109
113
|
```tsx
|
|
110
|
-
// Theme-wide, via ThemeProvider: circular
|
|
114
|
+
// Theme-wide, via ThemeProvider: circular markers, thicker connectors
|
|
111
115
|
const theme: Theme = {
|
|
112
116
|
id: 'brand',
|
|
113
117
|
variables: {
|
|
114
118
|
'--stepper-marker-radius': '50%',
|
|
115
|
-
'--stepper-active-color': '#e91e63',
|
|
116
119
|
'--stepper-connector-thickness': '4px',
|
|
117
120
|
},
|
|
118
121
|
};
|
|
@@ -121,12 +124,37 @@ const theme: Theme = {
|
|
|
121
124
|
<Stepper
|
|
122
125
|
steps={steps}
|
|
123
126
|
currentStep={1}
|
|
124
|
-
style={{
|
|
125
|
-
'--stepper-marker-radius': '50%',
|
|
126
|
-
'--stepper-active-color': '#e91e63',
|
|
127
|
-
'--stepper-connector-thickness': '4px',
|
|
128
|
-
} as React.CSSProperties}
|
|
127
|
+
style={{ '--stepper-marker-radius': '50%' } as React.CSSProperties}
|
|
129
128
|
/>
|
|
130
129
|
```
|
|
131
130
|
|
|
132
131
|
**Slots:** `root` `entry` `entryNumber` `entryLabel` `connector` `description` `content` `optional` `icon`
|
|
132
|
+
|
|
133
|
+
## Migration from `alignment`, `StepperStyleType.Default` and the colour variables
|
|
134
|
+
|
|
135
|
+
Before 0.45, a Stepper's direction was `alignment`, its default look `StepperStyleType.Default`, and
|
|
136
|
+
its colours six theme variables. TypeScript points at the first two:
|
|
137
|
+
|
|
138
|
+
| Before | After |
|
|
139
|
+
|--------|-------|
|
|
140
|
+
| `alignment={StepperAlignment.Vertical}` or `alignment='vertical'` | `orientation={StepperOrientation.Vertical}` |
|
|
141
|
+
| `alignment={StepperAlignment.Horizontal}` | nothing: `Horizontal` is the default |
|
|
142
|
+
| `styleType={StepperStyleType.Default}` | nothing: `Filled` is the default |
|
|
143
|
+
|
|
144
|
+
**The colour variables compile unchanged and do nothing**, since a theme accepts any variable:
|
|
145
|
+
|
|
146
|
+
| Theme set | Instead |
|
|
147
|
+
|-----------|---------|
|
|
148
|
+
| `--stepper-active-color`, `--stepper-done-color`, `--stepper-connector-color` | `color`, on the instance or app-wide with `defaultProps={{ Stepper: { color: 'var(--your-colour)' } }}` |
|
|
149
|
+
| `--stepper-text-on-marker` | nothing: it is picked for contrast with `color` (`--text-on-primary` for `Primary`) |
|
|
150
|
+
| `--stepper-error-color` | `--error-color` |
|
|
151
|
+
| `--stepper-idle-color` | `--border-color` and `--text-dark` theme-wide, or `classNames.entryNumber` for the Stepper alone |
|
|
152
|
+
|
|
153
|
+
Three more changes compile unchanged and need a look of their own:
|
|
154
|
+
|
|
155
|
+
- **Horizontal steps take equal columns**, so the first and last markers no longer sit at the
|
|
156
|
+
stepper's edges. A `styles.connector` or `classNames.connector` that sized the connector (such as
|
|
157
|
+
`{ flex: 1, width: 'auto' }`) is no longer needed: the connector is positioned between the markers.
|
|
158
|
+
- **`hideLabels` no longer hides vertical `content`**, and keeps the labels for screen readers.
|
|
159
|
+
- **A clickable step is a `<button>`**, not a `div` with `role="button"`. CSS that selected
|
|
160
|
+
`[role="button"]` inside a Stepper should select `button`.
|