@ahrowe/ui 0.43.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 +29 -0
- package/README.md +4 -3
- package/dist/cjs-types/common/button/button.types.d.ts +1 -1
- package/dist/cjs-types/common/configProvider/configProvider.types.d.ts +6 -0
- package/dist/cjs-types/common/loader/index.d.ts +2 -0
- package/dist/cjs-types/common/loader/loader.d.ts +4 -0
- package/dist/cjs-types/common/loader/loader.types.d.ts +31 -0
- package/dist/cjs-types/common/loadingOverlay/index.d.ts +2 -0
- package/dist/cjs-types/common/loadingOverlay/loadingOverlay.d.ts +4 -0
- package/dist/cjs-types/common/loadingOverlay/loadingOverlay.types.d.ts +21 -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 +4 -12
- package/dist/cjs-types/index.d.ts +4 -1
- 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/checkbox/checkbox.mjs +1 -1
- package/dist/esm/common/checkbox/checkbox.mjs.map +1 -1
- package/dist/esm/common/checkbox/checkbox.module.mjs +1 -1
- package/dist/esm/common/checkbox/checkbox.module.mjs.map +1 -1
- package/dist/esm/common/dropdown/dropdown.mjs +1 -1
- package/dist/esm/common/dropdown/dropdown.mjs.map +1 -1
- package/dist/esm/common/dropdown/dropdown.module.mjs +1 -1
- package/dist/esm/common/dropdown/dropdown.module.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/kanbanBoard.module.mjs +1 -1
- package/dist/esm/common/kanbanBoard/kanbanBoard.module.mjs.map +1 -1
- package/dist/esm/common/loader/loader.mjs +2 -0
- package/dist/esm/common/loader/loader.mjs.map +1 -0
- package/dist/esm/common/loader/loader.module.mjs +2 -0
- package/dist/esm/common/loader/loader.module.mjs.map +1 -0
- package/dist/esm/common/loader/loader.types.mjs +2 -0
- package/dist/esm/common/loader/loader.types.mjs.map +1 -0
- package/dist/esm/common/loadingOverlay/loadingOverlay.mjs +2 -0
- package/dist/esm/common/loadingOverlay/loadingOverlay.mjs.map +1 -0
- package/dist/esm/common/loadingOverlay/loadingOverlay.module.mjs +2 -0
- package/dist/esm/common/loadingOverlay/loadingOverlay.module.mjs.map +1 -0
- 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/common/virtualList/virtualList.mjs +1 -1
- package/dist/esm/common/virtualList/virtualList.mjs.map +1 -1
- package/dist/esm/common/virtualList/virtualList.module.mjs +1 -1
- package/dist/esm/common/virtualList/virtualList.module.mjs.map +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/index.cjs +3 -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 +6 -0
- package/dist/types/common/loader/index.d.ts +2 -0
- package/dist/types/common/loader/loader.d.ts +4 -0
- package/dist/types/common/loader/loader.types.d.ts +31 -0
- package/dist/types/common/loadingOverlay/index.d.ts +2 -0
- package/dist/types/common/loadingOverlay/loadingOverlay.d.ts +4 -0
- package/dist/types/common/loadingOverlay/loadingOverlay.types.d.ts +21 -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 +4 -12
- package/dist/types/index.d.ts +4 -1
- package/docs/Button.md +9 -3
- package/docs/CLAUDE.md +4 -3
- package/docs/Checkbox.md +1 -1
- package/docs/ConfigProvider.md +1 -1
- package/docs/Loader.md +95 -0
- package/docs/LoadingOverlay.md +85 -0
- package/docs/Skeleton.md +1 -1
- package/docs/SplitButton.md +1 -1
- package/docs/Stepper.md +57 -29
- package/docs/ThemeColor.md +1 -1
- package/package.json +1 -1
- package/dist/cjs-types/common/loading/index.d.ts +0 -1
- package/dist/cjs-types/common/loading/spinnerLoading/index.d.ts +0 -2
- package/dist/cjs-types/common/loading/spinnerLoading/spinnerLoading.d.ts +0 -6
- package/dist/esm/common/loading/spinnerLoading/index.mjs +0 -2
- package/dist/esm/common/loading/spinnerLoading/index.mjs.map +0 -1
- package/dist/esm/common/loading/spinnerLoading/spinnerLoading.mjs +0 -2
- package/dist/esm/common/loading/spinnerLoading/spinnerLoading.mjs.map +0 -1
- package/dist/esm/common/loading/spinnerLoading/spinnerLoading.module.mjs +0 -2
- package/dist/esm/common/loading/spinnerLoading/spinnerLoading.module.mjs.map +0 -1
- package/dist/types/common/loading/index.d.ts +0 -1
- package/dist/types/common/loading/spinnerLoading/index.d.ts +0 -2
- package/dist/types/common/loading/spinnerLoading/spinnerLoading.d.ts +0 -6
- package/docs/Loading.md +0 -68
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`.
|
package/docs/ThemeColor.md
CHANGED
|
@@ -38,7 +38,7 @@ showToast('Saved', { color: ThemeColor.Success });
|
|
|
38
38
|
|
|
39
39
|
**Where it applies:** Button, ActionIcon, CopyButton, SplitButton, ActionButtons (`submitButtonColor`,
|
|
40
40
|
`cancelButtonColor`), Card and its actions, Badge, Chip, Accordion, Alert, Toast, Timeline items, Calendar
|
|
41
|
-
events, ProgressBar segments and AnimatedLogo.
|
|
41
|
+
events, ProgressBar segments, Loader and AnimatedLogo.
|
|
42
42
|
|
|
43
43
|
**Styles share their names:** where two components offer the same look, it has the same name in
|
|
44
44
|
each one's own `styleType` enum. Each component offers only the ones it can draw.
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as SpinnerLoading } from './spinnerLoading/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../package/common/loading/spinnerLoading/index.ts"],"sourcesContent":["import SpinnerLoading from './spinnerLoading';\n\nexport default SpinnerLoading;\n"],"mappings":"iDAEA,IAAA,EAAe"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";import e from"./spinnerLoading.module.mjs";import t from"classnames";import{jsx as n}from"react/jsx-runtime";function r({className:r}){return n(`svg`,{"data-testid":`spinner`,className:t(e.spinnerLoading,r),xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 100 100`,fill:`none`,stroke:`var(--primary-color)`,children:n(`circle`,{cx:`50`,cy:`50`,r:`45`,strokeWidth:`10`})})}export{r as default};
|
|
2
|
-
//# sourceMappingURL=spinnerLoading.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spinnerLoading.mjs","names":[],"sources":["../../../../../package/common/loading/spinnerLoading/spinnerLoading.tsx"],"sourcesContent":["import type { ReactElement } from 'react';\nimport cx from 'classnames';\n\nimport styles from './spinnerLoading.module.pcss';\n\ninterface Properties {\n className?: string | undefined;\n}\n\nfunction SpinnerLoading({ className }: Properties): ReactElement {\n return (\n <svg\n data-testid='spinner'\n className={cx(styles.spinnerLoading, className)}\n xmlns='http://www.w3.org/2000/svg'\n viewBox='0 0 100 100'\n fill='none'\n stroke='var(--primary-color)'\n >\n <circle cx='50' cy='50' r='45' strokeWidth='10' />\n </svg>\n );\n}\n\nexport default SpinnerLoading;\n"],"mappings":"0HASA,SAAS,EAAe,CAAE,aAAuC,CAC/D,OACE,EAAC,MAAD,CACE,cAAY,UACZ,UAAW,EAAG,EAAO,eAAgB,CAAS,EAC9C,MAAM,6BACN,QAAQ,cACR,KAAK,OACL,OAAO,uBAEP,SAAA,EAAC,SAAD,CAAQ,GAAG,KAAK,GAAG,KAAK,EAAE,KAAK,YAAY,IAAM,CAAA,CAC9C,CAAA,CAET"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use client";var e=`spinner-loading_qbxX-`,t=`animate-spinner_6HoVF`,n=`spin_axdh6`,r={"spinner-loading":`spinner-loading_qbxX-`,spinnerLoading:e,"animate-spinner":`animate-spinner_6HoVF`,animateSpinner:t,spin:n};export{t as animateSpinner,r as default,n as spin,e as spinnerLoading};
|
|
2
|
-
//# sourceMappingURL=spinnerLoading.module.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spinnerLoading.module.mjs","names":[],"sources":["../../../../../package/common/loading/spinnerLoading/spinnerLoading.module.pcss"],"sourcesContent":[".spinner-loading {\n width: 70px;\n height: 70px;\n\n circle {\n stroke-dasharray: 283;\n stroke-dashoffset: 281;\n stroke-linecap: round;\n animation:\n animate-spinner 2s cubic-bezier(0.89, 0.01, 0.12, 1) infinite,\n spin 3s linear infinite;\n transform-origin: center;\n }\n\n @keyframes animate-spinner {\n 0% {\n stroke-dashoffset: 281;\n }\n\n 50% {\n stroke-dashoffset: 0;\n }\n\n 100% {\n stroke-dashoffset: -281;\n }\n }\n\n @keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n\n 100% {\n transform: rotate(360deg);\n }\n }\n}\n"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as SpinnerLoading } from './spinnerLoading/index.js';
|
package/docs/Loading.md
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# Loading (SpinnerLoading)
|
|
2
|
-
|
|
3
|
-
**When to use:** A loading indicator for async operations: page loads, data fetching, or covering a region while it refreshes. For a button use `Button`'s built-in `isLoading`, and for placeholder content that mirrors the shape of what is coming use [Skeleton.md](Skeleton.md).
|
|
4
|
-
|
|
5
|
-
**Keywords:** busy, waiting, activity indicator, throbber, progress, async, fetching, overlay
|
|
6
|
-
|
|
7
|
-
**Import:** `import { SpinnerLoading } from '@ahrowe/ui'`
|
|
8
|
-
|
|
9
|
-
```tsx
|
|
10
|
-
import { SpinnerLoading } from '@ahrowe/ui';
|
|
11
|
-
|
|
12
|
-
// Default: a 70x70 circular spinner stroked in var(--primary-color)
|
|
13
|
-
{isLoading && <SpinnerLoading />}
|
|
14
|
-
|
|
15
|
-
// Sized through className
|
|
16
|
-
<SpinnerLoading className="my-spinner" />
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
```css
|
|
20
|
-
.my-spinner {
|
|
21
|
-
width: 24px;
|
|
22
|
-
height: 24px;
|
|
23
|
-
}
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
**Key props:**
|
|
27
|
-
|
|
28
|
-
| Prop | Type | Description |
|
|
29
|
-
|------|------|-------------|
|
|
30
|
-
| `className` | `string` | Root `svg` element. This is also how you size it |
|
|
31
|
-
|
|
32
|
-
## Covering a region while it loads
|
|
33
|
-
|
|
34
|
-
`SpinnerLoading` is the indicator only. To overlay it on content, centre it in a positioned parent:
|
|
35
|
-
|
|
36
|
-
```tsx
|
|
37
|
-
<div className="panel">
|
|
38
|
-
<YourContent />
|
|
39
|
-
{isLoading && (
|
|
40
|
-
<div className="panel-overlay">
|
|
41
|
-
<SpinnerLoading className="my-spinner" />
|
|
42
|
-
</div>
|
|
43
|
-
)}
|
|
44
|
-
</div>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
```css
|
|
48
|
-
.panel {
|
|
49
|
-
position: relative;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.panel-overlay {
|
|
53
|
-
position: absolute;
|
|
54
|
-
inset: 0;
|
|
55
|
-
display: flex;
|
|
56
|
-
align-items: center;
|
|
57
|
-
justify-content: center;
|
|
58
|
-
pointer-events: none;
|
|
59
|
-
}
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Drop the `pointer-events: none` if the overlay should also block interaction with what is underneath, and add a translucent `background` if it should dim it.
|
|
63
|
-
|
|
64
|
-
For a branded loading screen rather than a generic spinner, [AnimatedLogo.md](AnimatedLogo.md) draws an SVG mark and sits in the same overlay.
|
|
65
|
-
|
|
66
|
-
**Note:** the spinner animates continuously even under `prefers-reduced-motion`. A frozen spinner would say the app has hung, which is the opposite of what it is there to communicate.
|
|
67
|
-
|
|
68
|
-
**Slots:** none. The root `svg` takes `className`.
|