@overdoser/react-toolkit 0.16.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
@@ -454,7 +454,7 @@ Compound component: `Modal.Header`, `Modal.Body`, `Modal.Footer`. Renders into a
454
454
  - `open: boolean` — required.
455
455
  - `onClose: () => void` — required.
456
456
  - `closeOnBackdrop?: boolean` — default `true`
457
- - `closeOnEscape?: boolean` — default `true`
457
+ - `closeOnEscape?: boolean` — default `true`. Overlays stack: Escape only reaches the topmost open one, so closing a `Dropdown` / `Popover` / `Select` / date picker inside a Modal or Drawer leaves the Modal open (a second Escape closes it).
458
458
  - `size?: 'sm' | 'md' | 'lg' | 'fullscreen'` — default `'md'`
459
459
  - `aria-label?: string` — use this OR `aria-labelledby`. If neither is provided, the `Modal.Header` content is auto-wired as the `aria-labelledby` target.
460
460
  - `aria-labelledby?: string`
@@ -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.
@@ -874,6 +914,7 @@ Props:
874
914
  - `createLabel?: (query: string) => ReactNode` — Multi-mode only. Custom render for the create row. Default: `Create "<query>"`.
875
915
  - `portal?: boolean` — default `true`. Applies to `searchable` + `multiple` modes (native `<select>` is unaffected). The open menu is rendered in a portal at `document.body` with `position: fixed` + `--crk-z-floating` (1060), so it escapes `overflow: hidden` ancestors and sits above `--crk-z-modal` (1050). Means a `<Select>` inside a `<Modal>` works without needing to size the modal. Pass `false` if you need the menu inside the trigger's subtree.
876
916
  - `classes?: Partial<SelectClasses>` where `SelectClasses = { wrapper, root, arrow, search, menu, item, chip, chipRemove }`
917
+ - Native props in searchable/multi modes: `name` and `form` go to a hidden native `<select>`, so the value is submitted with native `FormData` (multi submits one entry per value, including `allowCreate` values not yet in `options`). `aria-*`, `data-*`, `title`, `autoFocus`, `tabIndex` go to the visible control; `required` becomes `aria-required` there (no native constraint validation — validate through `FormField` rules). While a searchable Select is open, its search input carries the same `aria-*` props and takes over `id`, so `<label htmlFor>` keeps naming the focused element. `onFocus` / `onBlur` fire when focus enters / leaves the whole widget (trigger, search input and portaled menu count as inside), so blur-based `FormField` validation works.
877
918
 
878
919
  Searchable example:
879
920
  ```tsx
@@ -1035,7 +1076,7 @@ Quick mapping from shadcn variant names to LineChart props:
1035
1076
  AreaChart extras (covers every shadcn area-chart variant via composable props):
1036
1077
  - `curve?: 'linear' | 'monotone' | 'step'` — default `'monotone'`.
1037
1078
  - `stacked?: boolean` — default `false`. Stacks series bottom-up in config-key order.
1038
- - `stackOffset?: 'none' | 'expand'` — default `'none'`. `'expand'` normalizes each row to sum to 1 (percentage stack). Requires `stacked`.
1079
+ - `stackOffset?: 'none' | 'expand'` — default `'none'`. `'expand'` normalizes each row to sum to 1 (percentage stack). Requires `stacked`. The default tooltip then shows `<value> · <share>%` per series (value through `valueFormat`).
1039
1080
  - `fillGradient?: boolean` — default `false`. Replaces flat fill with a per-series vertical linear gradient (opaque top → transparent bottom).
1040
1081
  - `showXAxis?: boolean` / `showYAxis?: boolean` — default `true`. Pass `false` to hide either axis.
1041
1082
  - `SeriesConfig.icon?: ReactNode` — if set on a series, the legend renders the icon (colored to match) in place of the swatch.
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.16.0",
3
+ "version": "0.18.0",
4
4
  "homepage": "https://react-toolkit.overdoser.org",
5
5
  "type": "module",
6
6
  "main": "./index.js",