@overdoser/react-toolkit 0.6.0 → 0.7.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/AGENTS.md CHANGED
@@ -53,6 +53,10 @@ For exhaustive component reference (every prop, every variant, every signature),
53
53
 
54
54
  - **Need a menu (Edit / Delete / Archive)?** → `<Dropdown trigger={...}>` with `<DropdownItem>` children.
55
55
 
56
+ - **Need a copy-to-clipboard button?** → `<CopyButton value={text} />` (icon + "Copy"→"Copied" morph), or `<CopyButton value={text} iconOnly aria-label="Copy" />` for icon-only. **Other one-shot actions with success feedback (send, download, delete-with-confirm)?** → `<ActionButton icon label successLabel onAction />` — async `onAction` gets a pending spinner; call `context.setProgress(0–100)` inside it for a determinate % + fill bar (downloads); `confirmLabel` adds a two-step confirm for destructive actions. Use plain `Button` when no phase feedback is needed.
57
+
58
+ - **Need a like/save/bookmark toggle?** → `<ToggleIconButton icon={<HeartIcon />} aria-label="Like" />` — round icon-only toggle with `aria-pressed`, fill + pop on toggle, optional `burst` ring, `activeColor` for semantic colors. Controlled (`pressed` + `onPressedChange`, optimistic) or uncontrolled (`defaultPressed`). Not for text toggles — it's icon-only by design.
59
+
56
60
  - **Need a tooltip / hover card / contextual panel?** → `<Popover trigger={...} content={...} />`.
57
61
 
58
62
  - **Need a confirm prompt or a full dialog?** → `<Modal>` with `Modal.Header`/`Body`/`Footer`. Always provide either `aria-label` or use a `Modal.Header` (it's auto-wired as `aria-labelledby`).
@@ -86,6 +90,7 @@ For exhaustive component reference (every prop, every variant, every signature),
86
90
  - **Need a data table?** → `<Table>`.
87
91
  - All data in memory → don't pass `onSort`; pass `pagination` (without `totalRows`) for client-side paging.
88
92
  - Data from a server → pass `sortConfig` + `onSort`, and `pagination` with `totalRows`.
93
+ - Wide table / comparison matrix → `scrollable` (horizontal scroll), `dragScroll` (middle/right-button drag-to-pan, implies scrollable; left button keeps selection/clicks), `sticky: true` on the first column to pin it. Per-cell shading via `cellClassName`/`cellStyle` on the column def; `defaultSortDirection: 'desc'` for highest-first columns; remove buttons can live in `header` (call `e.stopPropagation()` when the column is sortable). See [recipes/comparison-table.tsx](./recipes/comparison-table.tsx).
89
94
 
90
95
  - **Need a chart?**
91
96
  - Time series / trend → `<LineChart>` or `<AreaChart>` (use Area when the magnitude matters more than the precise line).
@@ -156,6 +161,7 @@ Full copy-paste-able files live alongside this doc. Each is one self-contained f
156
161
  - [recipes/login-form.tsx](./recipes/login-form.tsx) — Form + Input + Button with validation rules.
157
162
  - [recipes/paginated-table.tsx](./recipes/paginated-table.tsx) — Client-side sortable + paginated table.
158
163
  - [recipes/server-side-table.tsx](./recipes/server-side-table.tsx) — Server-driven sort & pagination.
164
+ - [recipes/comparison-table.tsx](./recipes/comparison-table.tsx) — Wide comparison matrix: sticky first column, drag-to-scroll, per-cell %DV bucket shading, removable columns, desc-first sort.
159
165
  - [recipes/confirm-modal.tsx](./recipes/confirm-modal.tsx) — Reusable destructive-action confirm dialog.
160
166
  - [recipes/searchable-multi-select.tsx](./recipes/searchable-multi-select.tsx) — Multi-select with search and form integration.
161
167
  - [recipes/dropdown-menu.tsx](./recipes/dropdown-menu.tsx) — Row action menu with `Dropdown` + `DropdownItem`.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,56 @@ All notable changes to `@overdoser/react-toolkit` are documented here.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
5
5
  project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.7.0]
8
+
9
+ A new family of stateful action buttons, and wide-table / comparison-matrix
10
+ support for `Table`. Everything is opt-in — no behavior changes for existing
11
+ usage (one addition: Shift+click now also triggers `Table` multi-sort,
12
+ alongside Ctrl/Cmd+click).
13
+
14
+ ### Added
15
+
16
+ - **`ActionButton`** — stateful action button with morphing icon/label layers
17
+ (`idle → armed → pending → success → idle`). Sync actions jump straight to a
18
+ success check + tinted surface, then auto-reset. Async actions (a
19
+ promise-returning `onAction`) show a pending spinner and only reach success
20
+ on resolve; rejections return to idle and call `onError`. Calling
21
+ `context.setProgress(0–100)` inside the action switches pending to a
22
+ determinate state — live % label plus an accent fill bar (drive it from
23
+ received bytes for downloads). `confirmLabel` adds a two-step confirm for
24
+ destructive actions (danger tint, icon shake, auto-disarm). Labels swap as a
25
+ directional carousel so transitions roll one way instead of jumping.
26
+ Variants/sizes match `Button`; `speed` scales every duration and timer at
27
+ once; colors/timings/transforms are themeable via `--crk-action-*` custom
28
+ properties; the current phase is exposed as `data-phase` for custom CSS;
29
+ respects `prefers-reduced-motion`.
30
+ - **`CopyButton`** — copy-to-clipboard preset of `ActionButton`: clipboard
31
+ icon morphs into a check, `Copy → Copied`, success tint, auto-reset. Works
32
+ icon+text or `iconOnly`. Success shows only after the clipboard write
33
+ confirms (with an `execCommand` fallback for insecure contexts); `value`
34
+ accepts a string or a lazy/async getter.
35
+ - **`ToggleIconButton`** — round icon-only toggle for like/save/bookmark-style
36
+ optimistic actions, with `aria-pressed`. Toggling on fills the icon with
37
+ `activeColor`, tints the surface, and pops the icon; optional `burst` ring.
38
+ Controlled (`pressed` + `onPressedChange`) or uncontrolled
39
+ (`defaultPressed`); themeable via `--crk-toggle-*` custom properties.
40
+ - **`Table` wide-table / comparison-matrix support** (all opt-in):
41
+ - `scrollable` — horizontal scroll container around the table.
42
+ - `dragScroll` — drag with the middle or right mouse button to pan
43
+ (implies `scrollable`). The left button keeps its native behavior (text
44
+ selection, clicks); the context menu opens only on a direct right click,
45
+ never after a drag.
46
+ - `ColumnDef.sticky` — pin the first column to the left edge while the
47
+ table scrolls; sticky cells stay opaque under striped/hover tints.
48
+ - `ColumnDef.cellClassName` / `cellStyle` — per-cell class/style hooks
49
+ (`(value, row, index) => …`) for value-bucket shading and the like.
50
+ - `ColumnDef.defaultSortDirection` — start the sort cycle at `'desc'` for
51
+ "highest first" columns; Shift+click now also adds a multi-sort column.
52
+ - `useTableSort`'s `requestSort`/`requestMultiSort` accept an optional
53
+ start direction.
54
+ - New `recipes/comparison-table.tsx` — copy-paste comparison matrix
55
+ (sticky first column, drag-to-scroll, %DV shading, removable columns).
56
+
7
57
  ## [0.6.0]
8
58
 
9
59
  Component polish plus an SSR-safety fix for `Toast`.
@@ -0,0 +1,105 @@
1
+ import { ComponentPropsWithRef, ReactNode } from 'react';
2
+ /** Lifecycle of one action run. */
3
+ export type ActionButtonPhase = 'idle' | 'armed' | 'pending' | 'success';
4
+ export interface ActionButtonClasses {
5
+ root: string;
6
+ iconStack: string;
7
+ iconLayer: string;
8
+ labelStack: string;
9
+ labelLayer: string;
10
+ progressFill: string;
11
+ }
12
+ /** Passed to `onAction` so long-running actions can report progress. */
13
+ export interface ActionButtonContext {
14
+ /**
15
+ * Report determinate progress (0–100) while the action's promise is in
16
+ * flight: the pending spinner gives way to the idle icon, the label shows
17
+ * the percentage, and an accent fill bar tracks it. Pass `null` to fall
18
+ * back to the indeterminate spinner (e.g. unknown content length).
19
+ */
20
+ setProgress: (percent: number | null) => void;
21
+ }
22
+ export interface ActionButtonProps extends Omit<ComponentPropsWithRef<'button'>, 'children'> {
23
+ /** Icon shown in the idle (and armed) state. */
24
+ icon: ReactNode;
25
+ /** Label shown in the idle state. Hidden when `iconOnly` is set. */
26
+ label?: ReactNode;
27
+ /** Icon shown while `onAction`'s promise is in flight. @default built-in spinner arc */
28
+ pendingIcon?: ReactNode;
29
+ /** Label shown while pending. Defaults to keeping `label` visible. */
30
+ pendingLabel?: ReactNode;
31
+ /** Icon shown in the success state. @default built-in check mark */
32
+ successIcon?: ReactNode;
33
+ /** Label shown in the success state (e.g. `'Copied'`). Defaults to keeping `label` visible. */
34
+ successLabel?: ReactNode;
35
+ /**
36
+ * Two-step confirm: when set, the first click arms the button (shows this
37
+ * label with a danger tint and a shake on the icon) and only a second
38
+ * click within `confirmTimeout` runs the action. For destructive actions.
39
+ */
40
+ confirmLabel?: ReactNode;
41
+ /** How long the armed state waits for the confirming click, in ms (scaled by `speed`). @default 2600 */
42
+ confirmTimeout?: number;
43
+ /**
44
+ * The action to run. Return a promise to get a pending phase — success
45
+ * shows only after it resolves; a rejection returns to idle and calls
46
+ * `onError`. Synchronous returns jump straight to success. Call
47
+ * `context.setProgress(0–100)` during the promise to switch the pending
48
+ * state from an indeterminate spinner to a determinate progress fill
49
+ * (e.g. a download driven by received bytes / `Content-Length`).
50
+ */
51
+ onAction?: (context: ActionButtonContext) => void | Promise<unknown>;
52
+ /** Label shown while determinate progress is reported. @default percent → `${Math.round(percent)}%` */
53
+ progressLabel?: (percent: number) => ReactNode;
54
+ /** Called when `onAction` throws or rejects. */
55
+ onError?: (error: unknown) => void;
56
+ /** Called whenever the phase changes. */
57
+ onPhaseChange?: (phase: ActionButtonPhase) => void;
58
+ /**
59
+ * How long the success state is held before auto-resetting to idle, in ms
60
+ * (scaled by `speed`). Pass `0` to stay in success until unmounted.
61
+ * @default 1800
62
+ */
63
+ resetAfter?: number;
64
+ /**
65
+ * Playback-speed multiplier for every transition and timer: `2` halves
66
+ * all durations, `0.5` doubles them.
67
+ * @default 1
68
+ */
69
+ speed?: number;
70
+ /** Visual style, same scale as `Button`. @default 'secondary' */
71
+ variant?: 'primary' | 'secondary' | 'danger' | 'ghost';
72
+ /** Button size, same scale as `Button`. @default 'md' */
73
+ size?: 'sm' | 'md' | 'lg';
74
+ /** Square icon-only button — hides all labels. Pair with `aria-label`. @default false */
75
+ iconOnly?: boolean;
76
+ /** Override class names on internal elements. */
77
+ classes?: Partial<ActionButtonClasses>;
78
+ }
79
+ /**
80
+ * Stateful action button with morphing icon and label layers:
81
+ * `idle → (armed) → (pending) → success → idle`.
82
+ *
83
+ * - Sync `onAction` jumps straight to success (icon morphs into a check,
84
+ * label swaps, surface takes a success tint), then auto-resets.
85
+ * - Async `onAction` (returns a promise) shows a pending spinner until it
86
+ * resolves; a rejection returns to idle and calls `onError`.
87
+ * - Call `context.setProgress(0–100)` during the promise for a determinate
88
+ * pending state: % label plus an accent fill bar (download/upload style).
89
+ * - `confirmLabel` adds a two-step confirm for destructive actions.
90
+ * - Clicks are ignored while a sequence is running.
91
+ *
92
+ * Layers are stacked in a grid cell, so the button width never jumps
93
+ * between states. Transitions, colors, and timings are themeable via
94
+ * `--crk-action-*` custom properties; `speed` scales everything at once.
95
+ * The current phase is exposed as `data-phase` on the root for custom CSS.
96
+ *
97
+ * @example
98
+ * <ActionButton
99
+ * icon={<SendIcon />}
100
+ * label="Send"
101
+ * successLabel="Sent"
102
+ * onAction={() => api.send(message)}
103
+ * />
104
+ */
105
+ export declare const ActionButton: import('react').ForwardRefExoticComponent<Omit<ActionButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,31 @@
1
+ import { ReactNode } from 'react';
2
+ import { ActionButtonProps } from './ActionButton';
3
+ export interface CopyButtonProps extends Omit<ActionButtonProps, 'icon' | 'label' | 'onAction' | 'value'> {
4
+ /**
5
+ * The text to copy, or a function returning it (lazily, possibly async —
6
+ * an async function shows the pending spinner until it resolves).
7
+ */
8
+ value: string | (() => string | Promise<string>);
9
+ /** Idle icon. @default built-in clipboard icon */
10
+ icon?: ReactNode;
11
+ /** Idle label. Hidden when `iconOnly` is set. @default 'Copy' */
12
+ label?: ReactNode;
13
+ /** Called with the copied text after a successful copy. */
14
+ onCopied?: (text: string) => void;
15
+ }
16
+ /**
17
+ * Copy-to-clipboard button: clipboard icon morphs into a check, the label
18
+ * swaps `Copy → Copied`, and the surface takes a success tint before
19
+ * auto-resetting. Built on `ActionButton` — all its props (`variant`,
20
+ * `size`, `speed`, `resetAfter`, `classes`, …) apply.
21
+ *
22
+ * Icon + text by default; pass `iconOnly` (with an `aria-label`) for a
23
+ * square icon-only trigger. Success shows only after the clipboard write
24
+ * confirms; failures return to idle and call `onError`.
25
+ *
26
+ * @example
27
+ * <CopyButton value={shareUrl} />
28
+ * // icon-only:
29
+ * <CopyButton value={shareUrl} iconOnly aria-label="Copy link" />
30
+ */
31
+ export declare const CopyButton: import('react').ForwardRefExoticComponent<Omit<CopyButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,4 @@
1
+ export { ActionButton } from './ActionButton';
2
+ export type { ActionButtonProps, ActionButtonClasses, ActionButtonPhase, ActionButtonContext, } from './ActionButton';
3
+ export { CopyButton } from './CopyButton';
4
+ export type { CopyButtonProps } from './CopyButton';
@@ -3,16 +3,47 @@ import { SortConfig } from './useTableSort';
3
3
  export interface ColumnDef<T> {
4
4
  /** Object key on each row to read the cell value from. */
5
5
  key: keyof T & string;
6
- /** Header content (string or any ReactNode). */
6
+ /**
7
+ * Header content (string or any ReactNode). Interactive elements (e.g. a
8
+ * remove button) are allowed; inside a `sortable` column they must call
9
+ * `e.stopPropagation()` in their click handler so the click doesn't sort.
10
+ */
7
11
  header: ReactNode;
8
12
  /** Enable click-to-sort on the header. */
9
13
  sortable?: boolean;
14
+ /**
15
+ * Direction the sort cycle starts with when this column is first clicked:
16
+ * `none → defaultSortDirection → opposite → none`. Use `'desc'` for
17
+ * columns where "highest first" is the natural question (scores, amounts).
18
+ * @default 'asc'
19
+ */
20
+ defaultSortDirection?: 'asc' | 'desc';
10
21
  /** Custom cell renderer; defaults to rendering `row[key]`. */
11
22
  render?: (value: T[keyof T], row: T, index: number) => ReactNode;
12
23
  /** Column width (CSS value). */
13
24
  width?: string | number;
14
25
  /** Text alignment for cells in this column. */
15
26
  align?: 'left' | 'center' | 'right';
27
+ /**
28
+ * Pin this column to the left edge while the table scrolls horizontally.
29
+ * Only meaningful with the `scrollable` (or `dragScroll`) table prop, and
30
+ * intended for the first column — multiple sticky columns all pin to
31
+ * `left: 0` and would overlap.
32
+ * @default false
33
+ */
34
+ sticky?: boolean;
35
+ /**
36
+ * Per-cell class name for this column. Pass a string to apply the same
37
+ * class to every cell, or a function `(value, row, index) => className` to
38
+ * compute it from the cell value (e.g. bucket shading). Returned
39
+ * `undefined` adds nothing.
40
+ */
41
+ cellClassName?: string | ((value: T[keyof T], row: T, index: number) => string | undefined);
42
+ /**
43
+ * Per-cell inline style for this column. Same value-or-callback shape as
44
+ * `cellClassName`; merged over the column's `align`.
45
+ */
46
+ cellStyle?: React.CSSProperties | ((value: T[keyof T], row: T, index: number) => React.CSSProperties | undefined);
16
47
  }
17
48
  export interface PaginationConfig {
18
49
  /** Current page (1-based) */
@@ -49,8 +80,25 @@ export interface TableProps<T extends Record<string, unknown>> {
49
80
  * server is expected to handle both.
50
81
  */
51
82
  onSort?: (config: SortConfig[]) => void;
52
- /** Enable multi-column sort via Ctrl/Cmd-click on a sortable header. @default true */
83
+ /** Enable multi-column sort via Ctrl/Cmd/Shift-click on a sortable header. @default true */
53
84
  multiSort?: boolean;
85
+ /**
86
+ * Wrap the table in a horizontal scroll container (`overflow-x: auto`).
87
+ * Enable when columns can outgrow the available width; required for
88
+ * `sticky` columns to have any effect.
89
+ * @default false
90
+ */
91
+ scrollable?: boolean;
92
+ /**
93
+ * Let users scroll the table horizontally by dragging anywhere on it with
94
+ * the middle or right mouse button. Implies `scrollable`. The left button
95
+ * keeps its native behavior (text selection, clicks); touch pans natively
96
+ * via the scroll container. After a right-button drag the context menu is
97
+ * suppressed — a direct right click (no drag within 200ms) opens it
98
+ * normally.
99
+ * @default false
100
+ */
101
+ dragScroll?: boolean;
54
102
  /** Alternate row backgrounds. @default false */
55
103
  striped?: boolean;
56
104
  /** Highlight rows on hover. @default false */
@@ -81,17 +129,24 @@ export interface TableProps<T extends Record<string, unknown>> {
81
129
  classes?: Partial<TableClasses>;
82
130
  }
83
131
  /**
84
- * Generic data table with sortable columns, multi-sort (Ctrl/Cmd-click), and
85
- * client- or server-side pagination.
132
+ * Generic data table with sortable columns, multi-sort (Ctrl/Cmd/Shift-click),
133
+ * and client- or server-side pagination.
86
134
  *
87
- * Sort cycle on header click: `none → asc → desc → none`.
135
+ * Sort cycle on header click: `none → asc → desc → none` (start with `desc`
136
+ * via `defaultSortDirection: 'desc'` on the column).
88
137
  *
89
138
  * **Client-side mode** (default): omit `onSort`. Table sorts and paginates internally.
90
139
  *
91
140
  * **Controlled mode**: pass `sortConfig` + `onSort`. Your server returns the
92
141
  * page already sorted and sliced; pass `pagination.totalRows` so the
93
142
  * paginator can compute page count.
143
+ *
144
+ * **Wide tables**: `scrollable` makes the wrapper scroll horizontally,
145
+ * `dragScroll` adds middle/right-mouse-button drag panning, and
146
+ * `sticky: true` on the first column pins it to the left edge. Per-cell
147
+ * styling (e.g. value-bucket shading) via `cellClassName`/`cellStyle` on
148
+ * the column.
94
149
  */
95
- declare function TableInner<T extends Record<string, unknown>>({ data, columns, sortConfig: controlledSortConfig, onSort, multiSort, striped, hoverable, compact, className, style, rowKey, rowClassName, rowStyle, emptyMessage, pagination, classes, }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
150
+ declare function TableInner<T extends Record<string, unknown>>({ data, columns, sortConfig: controlledSortConfig, onSort, multiSort, scrollable, dragScroll, striped, hoverable, compact, className, style, rowKey, rowClassName, rowStyle, emptyMessage, pagination, classes, }: TableProps<T>): import("react/jsx-runtime").JSX.Element;
96
151
  export declare const Table: typeof TableInner;
97
152
  export {};
@@ -8,15 +8,17 @@ export interface SortConfig {
8
8
  /**
9
9
  * Client-side sorting hook for tabular data.
10
10
  *
11
- * Supports single and multi-column sort with asc → desc → none cycling.
11
+ * Supports single and multi-column sort. The cycle is
12
+ * `none → startDirection → opposite → none`, where `startDirection`
13
+ * defaults to `'asc'` (pass `'desc'` for "highest first" columns).
12
14
  *
13
15
  * @param data - Array of row objects to sort.
14
16
  * @param initialSort - Optional initial sort configuration.
15
17
  * @returns An object containing:
16
18
  * - `sortedData` — the sorted copy of `data`.
17
19
  * - `sortConfig` — current active sort columns and directions.
18
- * - `requestSort(key)` — single-column sort (replaces any existing sort).
19
- * - `requestMultiSort(key)` — adds/toggles a column in multi-sort mode.
20
+ * - `requestSort(key, startDirection?)` — single-column sort (replaces any existing sort).
21
+ * - `requestMultiSort(key, startDirection?)` — adds/toggles a column in multi-sort mode.
20
22
  * - `resetSort()` — clears all sorting.
21
23
  *
22
24
  * @example
@@ -27,7 +29,7 @@ export interface SortConfig {
27
29
  export declare function useTableSort<T extends Record<string, unknown>>(data: T[], initialSort?: SortConfig[]): {
28
30
  sortedData: T[];
29
31
  sortConfig: SortConfig[];
30
- requestSort: (key: keyof T & string) => void;
31
- requestMultiSort: (key: keyof T & string) => void;
32
+ requestSort: (key: keyof T & string, startDirection?: 'asc' | 'desc') => void;
33
+ requestMultiSort: (key: keyof T & string, startDirection?: 'asc' | 'desc') => void;
32
34
  resetSort: () => void;
33
35
  };
@@ -0,0 +1,62 @@
1
+ import { ComponentPropsWithRef, ReactNode } from 'react';
2
+ export interface ToggleIconButtonClasses {
3
+ root: string;
4
+ icon: string;
5
+ burst: string;
6
+ }
7
+ export interface ToggleIconButtonProps extends Omit<ComponentPropsWithRef<'button'>, 'children'> {
8
+ /**
9
+ * The icon, as an outline SVG (`fill="none"`, `stroke="currentColor"`).
10
+ * When pressed it fills with the active color and pops. Sized to `1em`.
11
+ */
12
+ icon: ReactNode;
13
+ /** Controlled pressed state. Pair with `onPressedChange`. */
14
+ pressed?: boolean;
15
+ /** Initial pressed state when uncontrolled. @default false */
16
+ defaultPressed?: boolean;
17
+ /** Called with the next pressed state on every toggle. */
18
+ onPressedChange?: (pressed: boolean) => void;
19
+ /**
20
+ * Color of the pressed state (icon fill, tinted surface, border). Any CSS
21
+ * color. @default var(--crk-color-primary)
22
+ */
23
+ activeColor?: string;
24
+ /** Expanding ring animation when toggled on (like/heart style). @default false */
25
+ burst?: boolean;
26
+ /** Surface style when off. @default 'secondary' */
27
+ variant?: 'secondary' | 'ghost';
28
+ /** Button size, same control scale as `Button`. @default 'md' */
29
+ size?: 'sm' | 'md' | 'lg';
30
+ /**
31
+ * Playback-speed multiplier for the fill/pop/burst animations: `2` halves
32
+ * durations, `0.5` doubles them.
33
+ * @default 1
34
+ */
35
+ speed?: number;
36
+ /** Override class names on internal elements. */
37
+ classes?: Partial<ToggleIconButtonClasses>;
38
+ }
39
+ /**
40
+ * Round icon-only toggle for like/save/bookmark-style optimistic actions.
41
+ * Renders a native `<button>` with `aria-pressed`; toggling fills the icon
42
+ * with the active color, tints the surface, and pops the icon (plus an
43
+ * optional expanding burst ring). Always pair with an `aria-label`.
44
+ *
45
+ * Uncontrolled via `defaultPressed`, or controlled via `pressed` +
46
+ * `onPressedChange` — sync the state to your server in the background and
47
+ * flip it back on failure (optimistic toggle). The pressed state is exposed
48
+ * as `data-pressed` on the root for custom CSS; colors and timings are
49
+ * themeable via `--crk-toggle-*` custom properties. Respects
50
+ * `prefers-reduced-motion`.
51
+ *
52
+ * @example
53
+ * <ToggleIconButton
54
+ * icon={<HeartIcon />}
55
+ * burst
56
+ * activeColor="#ff5c7a"
57
+ * pressed={liked}
58
+ * onPressedChange={setLiked}
59
+ * aria-label="Like"
60
+ * />
61
+ */
62
+ export declare const ToggleIconButton: import('react').ForwardRefExoticComponent<Omit<ToggleIconButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
@@ -0,0 +1,2 @@
1
+ export { ToggleIconButton } from './ToggleIconButton';
2
+ export type { ToggleIconButtonProps, ToggleIconButtonClasses, } from './ToggleIconButton';