@overdoser/react-toolkit 0.17.0 → 0.18.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/llms.txt CHANGED
@@ -627,6 +627,46 @@ Example:
627
627
  <Spinner size="lg" />
628
628
  ```
629
629
 
630
+ ### Loader
631
+ Import: `import { Loader } from '@overdoser/react-toolkit'`
632
+ Element: a `<div>` (forwards ref); the animation + label live in an inner `role="status"` element. Loading indicator for pages and containers — no CSS needed on the surrounding elements. (`Spinner` stays the small inline one for buttons and text.)
633
+
634
+ Four placements:
635
+ 1. **Inline block** (default, no children) — centered in the flow. Use for an empty section; `minHeight` gives it room.
636
+ 2. **Wrap content** — pass `children`. They stay mounted and keep their height; the loader overlays them. This is the one for "results reload while a filter runs" — the page doesn't jump. If the container is taller than the viewport (or its scroll parent), the indicator is centred in the visible part and follows scrolling (same for the drop-in overlay).
637
+ 3. **Drop-in overlay** — `mode="overlay"` with no children, rendered anywhere inside a container. Covers that container; a statically positioned parent is made `position: relative` while shown and restored after (also gets `aria-busy`). The parent needs some height of its own — for an empty container use the inline block.
638
+ 4. **Fullscreen** — `mode="fullscreen"`. Portaled to `document.body`, fixed, centered in the viewport, `--crk-z-floating`.
639
+
640
+ `LoaderProps` (extends native `div` props, `color` retyped):
641
+ - `variant?: 'dots' | 'pulse' | 'spinner' | 'grid' | 'morph'` — default `'dots'`. `dots` = the `Button` loading bounce at scale; `pulse` = the same three dots swelling and fading in place (no vertical travel); `spinner` = arc on a faint track; `grid` = 3×3 cells in a diagonal wave; `morph` = gradient shape that morphs and turns.
642
+ - `size?: 'sm' | 'md' | 'lg'` — default `'md'` (1.5 / 2.5 / 4rem glyph).
643
+ - `mode?: 'inline' | 'overlay' | 'fullscreen'` — default `'inline'`. With `children` the loader always wraps them; `'fullscreen'` then covers the viewport instead of the wrapper.
644
+ - `loading?: boolean` — default `true`. Without children, `false` renders nothing.
645
+ - `children?: ReactNode` — content to cover while loading.
646
+ - `delay?: number` — ms to wait before showing; default `0`. Use ~150 so fast responses never flash a loader. Nothing is reserved or made inert during the delay.
647
+ - `backdrop?: 'dim' | 'blur' | 'none'` — default `'dim'`.
648
+ - `interactive?: boolean` — default `false`. Covered content is `inert` while loading; set `true` when the covered area contains the control that triggered the load (filter-as-you-type), so it keeps focus.
649
+ - `color?: string` — default `--crk-color-primary`.
650
+ - `label?: string` — default `'Loading'`, visually hidden. `showLabel?: boolean` renders it under the animation.
651
+ - `minHeight?: number | string` — inline block height, or wrapper min-height while loading.
652
+ - `classes?: Partial<LoaderClasses>` where `LoaderClasses = { root, content, overlay, indicator, glyph, label }`.
653
+
654
+ CSS variables (set on the Loader via `style`/`className`, or on any ancestor): `--crk-loader-size` (wins over `size`), `--crk-loader-color`, `--crk-loader-speed` (default `1.2s`), `--crk-loader-dot-size`, `--crk-loader-dot-gap`, `--crk-loader-dot-bounce` (dots; negative = up), `--crk-loader-dot-pulse` (pulse; resting scale 0–1, default `0.6`), `--crk-loader-backdrop`, `--crk-loader-blur`, `--crk-loader-label-color`, `--crk-loader-min-height`. Honors `prefers-reduced-motion` (variants fade instead of moving).
655
+
656
+ Example:
657
+ ```tsx
658
+ // Results keep their height while a new filter runs
659
+ <Loader loading={isFetching} delay={150}>
660
+ <ResultList items={results} />
661
+ </Loader>
662
+
663
+ // Initial page load
664
+ <Loader mode="fullscreen" variant="morph" label="Loading dashboard" showLabel />
665
+
666
+ // Inside any container, no wrapper
667
+ <section><Header /><Body /><Loader mode="overlay" loading={saving} backdrop="blur" /></section>
668
+ ```
669
+
630
670
  ### Skeleton
631
671
  Import: `import { Skeleton } from '@overdoser/react-toolkit'`
632
672
  Element: a `<div aria-hidden>` (forwards ref). Decorative loading placeholder.
package/manifest.json CHANGED
@@ -1084,6 +1084,79 @@
1084
1084
  }
1085
1085
  }
1086
1086
  },
1087
+ "Loader": {
1088
+ "import": "import { Loader } from '@overdoser/react-toolkit'",
1089
+ "element": "div (inner span[role=status])",
1090
+ "forwardsRef": true,
1091
+ "extendsNativeProps": "div (color retyped)",
1092
+ "notes": "Page/container loading indicator. No children: inline block (default), mode=overlay covers the parent it is rendered into (positions a static parent itself), mode=fullscreen portals over the viewport. With children: wraps them and overlays while loading, content keeps its height. CSS vars: --crk-loader-size, --crk-loader-color, --crk-loader-speed, --crk-loader-dot-size, --crk-loader-dot-gap, --crk-loader-dot-bounce, --crk-loader-dot-pulse, --crk-loader-backdrop, --crk-loader-blur, --crk-loader-label-color, --crk-loader-min-height.",
1093
+ "props": {
1094
+ "variant": {
1095
+ "type": "'dots' | 'pulse' | 'spinner' | 'grid' | 'morph'",
1096
+ "default": "dots"
1097
+ },
1098
+ "size": {
1099
+ "type": "'sm' | 'md' | 'lg'",
1100
+ "default": "md"
1101
+ },
1102
+ "mode": {
1103
+ "type": "'inline' | 'overlay' | 'fullscreen'",
1104
+ "default": "inline",
1105
+ "notes": "Placement when there are no children; with children, 'fullscreen' covers the viewport instead of the wrapper."
1106
+ },
1107
+ "loading": {
1108
+ "type": "boolean",
1109
+ "default": true,
1110
+ "notes": "Without children, false renders nothing."
1111
+ },
1112
+ "children": {
1113
+ "type": "ReactNode",
1114
+ "notes": "Content to cover while loading; stays mounted and keeps its size."
1115
+ },
1116
+ "delay": {
1117
+ "type": "number",
1118
+ "default": 0,
1119
+ "notes": "ms before showing, so fast responses never flash a loader."
1120
+ },
1121
+ "backdrop": {
1122
+ "type": "'dim' | 'blur' | 'none'",
1123
+ "default": "dim"
1124
+ },
1125
+ "interactive": {
1126
+ "type": "boolean",
1127
+ "default": false,
1128
+ "notes": "Keep covered content usable instead of inert."
1129
+ },
1130
+ "color": {
1131
+ "type": "string",
1132
+ "notes": "Defaults to --crk-color-primary."
1133
+ },
1134
+ "label": {
1135
+ "type": "string",
1136
+ "default": "Loading",
1137
+ "notes": "Visually hidden unless showLabel."
1138
+ },
1139
+ "showLabel": {
1140
+ "type": "boolean",
1141
+ "default": false
1142
+ },
1143
+ "minHeight": {
1144
+ "type": "number | string",
1145
+ "notes": "Inline block height, or wrapper min-height while loading. number -> px."
1146
+ },
1147
+ "classes": {
1148
+ "type": "Partial<LoaderClasses>",
1149
+ "shape": [
1150
+ "root",
1151
+ "content",
1152
+ "overlay",
1153
+ "indicator",
1154
+ "glyph",
1155
+ "label"
1156
+ ]
1157
+ }
1158
+ }
1159
+ },
1087
1160
  "Skeleton": {
1088
1161
  "import": "import { Skeleton } from '@overdoser/react-toolkit'",
1089
1162
  "element": "div[aria-hidden]",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overdoser/react-toolkit",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "homepage": "https://react-toolkit.overdoser.org",
5
5
  "type": "module",
6
6
  "main": "./index.js",