@ahrowe/ui 0.44.0 → 0.46.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 +40 -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/kanbanBoard/KanbanBoard.d.ts +1 -1
- package/dist/cjs-types/common/kanbanBoard/KanbanColumn.d.ts +21 -12
- package/dist/cjs-types/common/kanbanBoard/KanbanItem.d.ts +1 -1
- package/dist/cjs-types/common/kanbanBoard/kanbanBoard.types.d.ts +23 -17
- package/dist/cjs-types/common/kanbanBoard/kanbanBoard.utils.d.ts +47 -1
- 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/kanbanBoard/KanbanBoard.mjs +3 -2
- package/dist/esm/common/kanbanBoard/KanbanBoard.mjs.map +1 -1
- package/dist/esm/common/kanbanBoard/KanbanColumn.mjs +1 -1
- package/dist/esm/common/kanbanBoard/KanbanColumn.mjs.map +1 -1
- package/dist/esm/common/kanbanBoard/KanbanItem.mjs +1 -1
- package/dist/esm/common/kanbanBoard/KanbanItem.mjs.map +1 -1
- package/dist/esm/common/kanbanBoard/kanbanBoard.module.mjs +1 -1
- package/dist/esm/common/kanbanBoard/kanbanBoard.module.mjs.map +1 -1
- package/dist/esm/common/kanbanBoard/kanbanBoard.utils.mjs +1 -1
- package/dist/esm/common/kanbanBoard/kanbanBoard.utils.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 +4 -3
- 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/kanbanBoard/KanbanBoard.d.ts +1 -1
- package/dist/types/common/kanbanBoard/KanbanColumn.d.ts +21 -12
- package/dist/types/common/kanbanBoard/KanbanItem.d.ts +1 -1
- package/dist/types/common/kanbanBoard/kanbanBoard.types.d.ts +23 -17
- package/dist/types/common/kanbanBoard/kanbanBoard.utils.d.ts +47 -1
- 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/KanbanBoard.md +36 -18
- package/docs/SplitButton.md +1 -1
- package/docs/Stepper.md +57 -29
- package/package.json +1 -1
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`.
|