@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.
Files changed (57) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +1 -1
  3. package/dist/cjs-types/common/button/button.types.d.ts +1 -1
  4. package/dist/cjs-types/common/configProvider/configProvider.types.d.ts +2 -0
  5. package/dist/cjs-types/common/kanbanBoard/KanbanBoard.d.ts +1 -1
  6. package/dist/cjs-types/common/kanbanBoard/KanbanColumn.d.ts +21 -12
  7. package/dist/cjs-types/common/kanbanBoard/KanbanItem.d.ts +1 -1
  8. package/dist/cjs-types/common/kanbanBoard/kanbanBoard.types.d.ts +23 -17
  9. package/dist/cjs-types/common/kanbanBoard/kanbanBoard.utils.d.ts +47 -1
  10. package/dist/cjs-types/common/stepper/stepper.d.ts +1 -1
  11. package/dist/cjs-types/common/stepper/stepper.types.d.ts +28 -12
  12. package/dist/cjs-types/common/themeProvider/theme.types.d.ts +0 -12
  13. package/dist/esm/common/button/button.mjs +1 -1
  14. package/dist/esm/common/button/button.mjs.map +1 -1
  15. package/dist/esm/common/button/button.module.mjs +1 -1
  16. package/dist/esm/common/button/button.module.mjs.map +1 -1
  17. package/dist/esm/common/button/button.types.mjs +1 -1
  18. package/dist/esm/common/button/button.types.mjs.map +1 -1
  19. package/dist/esm/common/kanbanBoard/KanbanBoard.mjs +3 -2
  20. package/dist/esm/common/kanbanBoard/KanbanBoard.mjs.map +1 -1
  21. package/dist/esm/common/kanbanBoard/KanbanColumn.mjs +1 -1
  22. package/dist/esm/common/kanbanBoard/KanbanColumn.mjs.map +1 -1
  23. package/dist/esm/common/kanbanBoard/KanbanItem.mjs +1 -1
  24. package/dist/esm/common/kanbanBoard/KanbanItem.mjs.map +1 -1
  25. package/dist/esm/common/kanbanBoard/kanbanBoard.module.mjs +1 -1
  26. package/dist/esm/common/kanbanBoard/kanbanBoard.module.mjs.map +1 -1
  27. package/dist/esm/common/kanbanBoard/kanbanBoard.utils.mjs +1 -1
  28. package/dist/esm/common/kanbanBoard/kanbanBoard.utils.mjs.map +1 -1
  29. package/dist/esm/common/splitButton/splitButton.mjs +1 -1
  30. package/dist/esm/common/splitButton/splitButton.mjs.map +1 -1
  31. package/dist/esm/common/stepper/stepper.mjs +1 -1
  32. package/dist/esm/common/stepper/stepper.mjs.map +1 -1
  33. package/dist/esm/common/stepper/stepper.module.mjs +1 -1
  34. package/dist/esm/common/stepper/stepper.module.mjs.map +1 -1
  35. package/dist/esm/common/stepper/stepper.types.mjs +1 -1
  36. package/dist/esm/common/stepper/stepper.types.mjs.map +1 -1
  37. package/dist/esm/index.mjs +1 -1
  38. package/dist/index.cjs +4 -3
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/style.css +1 -1
  41. package/dist/types/common/button/button.types.d.ts +1 -1
  42. package/dist/types/common/configProvider/configProvider.types.d.ts +2 -0
  43. package/dist/types/common/kanbanBoard/KanbanBoard.d.ts +1 -1
  44. package/dist/types/common/kanbanBoard/KanbanColumn.d.ts +21 -12
  45. package/dist/types/common/kanbanBoard/KanbanItem.d.ts +1 -1
  46. package/dist/types/common/kanbanBoard/kanbanBoard.types.d.ts +23 -17
  47. package/dist/types/common/kanbanBoard/kanbanBoard.utils.d.ts +47 -1
  48. package/dist/types/common/stepper/stepper.d.ts +1 -1
  49. package/dist/types/common/stepper/stepper.types.d.ts +28 -12
  50. package/dist/types/common/themeProvider/theme.types.d.ts +0 -12
  51. package/docs/Button.md +8 -2
  52. package/docs/CLAUDE.md +1 -1
  53. package/docs/ConfigProvider.md +1 -1
  54. package/docs/KanbanBoard.md +36 -18
  55. package/docs/SplitButton.md +1 -1
  56. package/docs/Stepper.md +57 -29
  57. 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
- - `StepperAlignment`: `Horizontal` (default) | `Vertical`
12
- - `StepperStyleType`: `Default` (filled numbered markers) | `Outlined` (numbered markers that stay ringed when completed) | `Dots` (minimal dots, no numbers)
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, StepperAlignment, StepperStyleType, StepperCollapse } from '@ahrowe/ui';
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
- alignment={StepperAlignment.Vertical}
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
- alignment={StepperAlignment.Vertical}
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` | Recolours the marker with `--stepper-error-color`; suppresses the checkmark |
74
- | `optional` | `boolean \| ReactNode` | `true` → an "Optional" hint; a node → custom hint text |
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 active step index |
83
- | `alignment` | `StepperAlignment \| 'horizontal' \| 'vertical'` | Layout direction (default `Horizontal`) |
84
- | `styleType` | `StepperStyleType` | Marker/connector preset (default `Default`) |
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 labels, descriptions, and (vertical) content |
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
- **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. Bodies animate their height and respect `prefers-reduced-motion`. Horizontal steppers don't render inline `content` and ignore `collapse`.
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 pink markers, thicker connectors
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`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahrowe/ui",
3
- "version": "0.44.0",
3
+ "version": "0.46.0",
4
4
  "description": "A React UI component library with theming, CSS Modules, and TypeScript support",
5
5
  "keywords": [
6
6
  "agent",