@akhil-saxena/design-system 1.4.2 → 1.5.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/README.md +1 -1
- package/dist/hooks/index.d.ts +19 -1
- package/dist/hooks/index.js +23 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.d.ts +108 -2
- package/dist/index.js +424 -31
- package/dist/index.js.map +1 -1
- package/dist/tokens.css +45 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Accessible React primitives with semantic tokens. Full dark mode, cream + ink + amber design language.
|
|
4
4
|
|
|
5
|
-
**v1.
|
|
5
|
+
**v1.5.0 — 79 components across 9 categories.**
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@akhil-saxena/design-system)
|
|
8
8
|
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -42,6 +42,24 @@ interface ShortcutOptions {
|
|
|
42
42
|
*/
|
|
43
43
|
declare function useKeyboardShortcut(combo: string | string[], handler: (e: KeyboardEvent) => void, options?: ShortcutOptions): void;
|
|
44
44
|
|
|
45
|
+
interface LongPressHandlers {
|
|
46
|
+
onPointerDown: (e: React.PointerEvent) => void;
|
|
47
|
+
onPointerUp: (e: React.PointerEvent) => void;
|
|
48
|
+
onPointerCancel: (e: React.PointerEvent) => void;
|
|
49
|
+
onPointerLeave: (e: React.PointerEvent) => void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Fires `onLongPress` when a pointer is held for `ms` (default 600ms). Mouse
|
|
53
|
+
* users release well under the threshold, so it stays inert on desktop — pair
|
|
54
|
+
* it with a hover-reveal affordance there and a long-press → ActionSheet on
|
|
55
|
+
* touch. Spread the returned handlers onto the target element.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* const lp = useLongPress(() => setSheetOpen(true));
|
|
59
|
+
* return <div {...lp}>…</div>;
|
|
60
|
+
*/
|
|
61
|
+
declare function useLongPress(onLongPress: () => void, ms?: number): LongPressHandlers;
|
|
62
|
+
|
|
45
63
|
/**
|
|
46
64
|
* Returns the `matches` boolean for an arbitrary CSS media query, reactive
|
|
47
65
|
* to viewport changes (resize, rotation, prefers-* toggles at runtime).
|
|
@@ -142,4 +160,4 @@ declare function useResizableColumns(initialWidths: Record<string, number>, opti
|
|
|
142
160
|
startResize: (col: string, e: react__default.PointerEvent) => void;
|
|
143
161
|
};
|
|
144
162
|
|
|
145
|
-
export { type SelectionMode, type SortState, useClickOutside, useComposedRefs, useFocusTrap, useKeyboardShortcut, useMatchMedia, useReducedMotion, useResizableColumns, useSortableTable, useTableSelection };
|
|
163
|
+
export { type LongPressHandlers, type SelectionMode, type SortState, useClickOutside, useComposedRefs, useFocusTrap, useKeyboardShortcut, useLongPress, useMatchMedia, useReducedMotion, useResizableColumns, useSortableTable, useTableSelection };
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { useClickOutside, useComposedRefs, useFocusTrap, useMatchMedia, useReducedMotion, useResizableColumns, useSortableTable, useTableSelection } from '../chunk-34YNJKI2.js';
|
|
2
|
-
import { useEffect } from 'react';
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
3
|
|
|
4
4
|
var isMac = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform);
|
|
5
5
|
function parseCombo(combo) {
|
|
@@ -48,7 +48,28 @@ function useKeyboardShortcut(combo, handler, options = {}) {
|
|
|
48
48
|
};
|
|
49
49
|
}, [combo, handler, enabled, preventDefault, target]);
|
|
50
50
|
}
|
|
51
|
+
function useLongPress(onLongPress, ms = 600) {
|
|
52
|
+
const timer = useRef(null);
|
|
53
|
+
const start = () => {
|
|
54
|
+
if (timer.current) clearTimeout(timer.current);
|
|
55
|
+
timer.current = setTimeout(() => {
|
|
56
|
+
onLongPress();
|
|
57
|
+
}, ms);
|
|
58
|
+
};
|
|
59
|
+
const cancel = () => {
|
|
60
|
+
if (timer.current) {
|
|
61
|
+
clearTimeout(timer.current);
|
|
62
|
+
timer.current = null;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
return {
|
|
66
|
+
onPointerDown: start,
|
|
67
|
+
onPointerUp: cancel,
|
|
68
|
+
onPointerCancel: cancel,
|
|
69
|
+
onPointerLeave: cancel
|
|
70
|
+
};
|
|
71
|
+
}
|
|
51
72
|
|
|
52
|
-
export { useKeyboardShortcut };
|
|
73
|
+
export { useKeyboardShortcut, useLongPress };
|
|
53
74
|
//# sourceMappingURL=index.js.map
|
|
54
75
|
//# sourceMappingURL=index.js.map
|
package/dist/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useKeyboardShortcut.ts"],"names":[],"mappings":";;;AAQA,IAAM,QAAQ,OAAO,SAAA,KAAc,eAAe,iBAAA,CAAkB,IAAA,CAAK,UAAU,QAAQ,CAAA;AAU3F,SAAS,WAAW,KAAA,EAA4B;AAC/C,EAAA,MAAM,KAAA,GAAQ,KAAA,CACZ,WAAA,EAAY,CACZ,KAAA,CAAM,GAAG,CAAA,CACT,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,IAAA,EAAM,CAAA;AACrB,EAAA,MAAM,GAAA,GAAmB;AAAA,IACxB,GAAA,EAAK,EAAA;AAAA,IACL,GAAA,EAAK,KAAA;AAAA,IACL,IAAA,EAAM,KAAA;AAAA,IACN,KAAA,EAAO,KAAA;AAAA,IACP,GAAA,EAAK;AAAA,GACN;AACA,EAAA,KAAA,MAAW,KAAK,KAAA,EAAO;AACtB,IAAA,IAAI,CAAA,KAAM,KAAA,EAAO,GAAA,CAAI,GAAA,GAAM,IAAA;AAAA,SAAA,IAClB,CAAA,KAAM,MAAA,EAAQ,GAAA,CAAI,IAAA,GAAO,IAAA;AAAA,SAAA,IACzB,CAAA,KAAM,OAAA,EAAS,GAAA,CAAI,KAAA,GAAQ,IAAA;AAAA,SA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AAA;AACV,MAAA,IAAI,MAAA,CAAO,KAAK,CAAC,CAAA,KAAM,QAAQ,CAAA,EAAG,CAAC,CAAC,CAAA,EAAG;AACtC,QAAA,IAAI,cAAA,IAAkB,cAAA,EAAe;AACrC,QAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MACV;AAAA,IACD;AACA,IAAA,CAAA,CAAE,gBAAA,CAAiB,WAAW,QAAQ,CAAA;AACtC,IAAA,OAAO,MAAM;AACZ,MAAA,CAAA,CAAE,mBAAA,CAAoB,WAAW,QAAQ,CAAA;AAAA,IAC1C,CAAA;AAAA,EACD,GAAG,CAAC,KAAA,EAAO,SAAS,OAAA,EAAS,cAAA,EAAgB,MAAM,CAAC,CAAA;AACrD","file":"index.js","sourcesContent":["import { useEffect } from \"react\";\n\ninterface ShortcutOptions {\n\tenabled?: boolean;\n\tpreventDefault?: boolean;\n\ttarget?: HTMLElement | Window;\n}\n\nconst isMac = typeof navigator !== \"undefined\" && /Mac|iPhone|iPad/.test(navigator.platform);\n\ninterface ParsedCombo {\n\tkey: string;\n\tmod: boolean;\n\tctrl: boolean;\n\tshift: boolean;\n\talt: boolean;\n}\n\nfunction parseCombo(combo: string): ParsedCombo {\n\tconst parts = combo\n\t\t.toLowerCase()\n\t\t.split(\"+\")\n\t\t.map((p) => p.trim());\n\tconst out: ParsedCombo = {\n\t\tkey: \"\",\n\t\tmod: false,\n\t\tctrl: false,\n\t\tshift: false,\n\t\talt: false,\n\t};\n\tfor (const p of parts) {\n\t\tif (p === \"mod\") out.mod = true;\n\t\telse if (p === \"ctrl\") out.ctrl = true;\n\t\telse if (p === \"shift\") out.shift = true;\n\t\telse if (p === \"alt\" || p === \"opt\") out.alt = true;\n\t\telse out.key = p;\n\t}\n\treturn out;\n}\n\nfunction matches(e: KeyboardEvent, combo: ParsedCombo): boolean {\n\tif (e.key.toLowerCase() !== combo.key.toLowerCase()) return false;\n\tconst modPressed = isMac ? e.metaKey : e.ctrlKey;\n\tif (combo.mod && !modPressed) return false;\n\tif (combo.ctrl && !e.ctrlKey) return false;\n\tif (combo.shift !== e.shiftKey) return false;\n\tif (combo.alt !== e.altKey) return false;\n\treturn true;\n}\n\n/**\n * Bind a keyboard shortcut. Use \"mod+k\" for Cmd-on-Mac, Ctrl-on-Win/Linux.\n * Used by CommandPalette (Phase 17 - ⌘K), Modal Esc-to-close (Phase 14).\n */\nexport function useKeyboardShortcut(\n\tcombo: string | string[],\n\thandler: (e: KeyboardEvent) => void,\n\toptions: ShortcutOptions = {},\n): void {\n\tconst { enabled = true, preventDefault = false, target } = options;\n\tuseEffect(() => {\n\t\tif (!enabled) return;\n\t\tconst combos = (Array.isArray(combo) ? combo : [combo]).map(parseCombo);\n\t\tconst t: EventTarget = target ?? (typeof window !== \"undefined\" ? window : ({} as EventTarget));\n\t\tfunction listener(ev: Event) {\n\t\t\tconst e = ev as KeyboardEvent;\n\t\t\tif (combos.some((c) => matches(e, c))) {\n\t\t\t\tif (preventDefault) e.preventDefault();\n\t\t\t\thandler(e);\n\t\t\t}\n\t\t}\n\t\tt.addEventListener(\"keydown\", listener);\n\t\treturn () => {\n\t\t\tt.removeEventListener(\"keydown\", listener);\n\t\t};\n\t}, [combo, handler, enabled, preventDefault, target]);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/useKeyboardShortcut.ts","../../src/hooks/useLongPress.ts"],"names":[],"mappings":";;;AAQA,IAAM,QAAQ,OAAO,SAAA,KAAc,eAAe,iBAAA,CAAkB,IAAA,CAAK,UAAU,QAAQ,CAAA;AAU3F,SAAS,WAAW,KAAA,EAA4B;AAC/C,EAAA,MAAM,KAAA,GAAQ,KAAA,CACZ,WAAA,EAAY,CACZ,KAAA,CAAM,GAAG,CAAA,CACT,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,IAAA,EAAM,CAAA;AACrB,EAAA,MAAM,GAAA,GAAmB;AAAA,IACxB,GAAA,EAAK,EAAA;AAAA,IACL,GAAA,EAAK,KAAA;AAAA,IACL,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,MAAM,OAAO,CAAA;AAC1B,MAAA,KAAA,CAAM,OAAA,GAAU,IAAA;AAAA,IACjB;AAAA,EACD,CAAA;AAEA,EAAA,OAAO;AAAA,IACN,aAAA,EAAe,KAAA;AAAA,IACf,WAAA,EAAa,MAAA;AAAA,IACb,eAAA,EAAiB,MAAA;AAAA,IACjB,cAAA,EAAgB;AAAA,GACjB;AACD","file":"index.js","sourcesContent":["import { useEffect } from \"react\";\n\ninterface ShortcutOptions {\n\tenabled?: boolean;\n\tpreventDefault?: boolean;\n\ttarget?: HTMLElement | Window;\n}\n\nconst isMac = typeof navigator !== \"undefined\" && /Mac|iPhone|iPad/.test(navigator.platform);\n\ninterface ParsedCombo {\n\tkey: string;\n\tmod: boolean;\n\tctrl: boolean;\n\tshift: boolean;\n\talt: boolean;\n}\n\nfunction parseCombo(combo: string): ParsedCombo {\n\tconst parts = combo\n\t\t.toLowerCase()\n\t\t.split(\"+\")\n\t\t.map((p) => p.trim());\n\tconst out: ParsedCombo = {\n\t\tkey: \"\",\n\t\tmod: false,\n\t\tctrl: false,\n\t\tshift: false,\n\t\talt: false,\n\t};\n\tfor (const p of parts) {\n\t\tif (p === \"mod\") out.mod = true;\n\t\telse if (p === \"ctrl\") out.ctrl = true;\n\t\telse if (p === \"shift\") out.shift = true;\n\t\telse if (p === \"alt\" || p === \"opt\") out.alt = true;\n\t\telse out.key = p;\n\t}\n\treturn out;\n}\n\nfunction matches(e: KeyboardEvent, combo: ParsedCombo): boolean {\n\tif (e.key.toLowerCase() !== combo.key.toLowerCase()) return false;\n\tconst modPressed = isMac ? e.metaKey : e.ctrlKey;\n\tif (combo.mod && !modPressed) return false;\n\tif (combo.ctrl && !e.ctrlKey) return false;\n\tif (combo.shift !== e.shiftKey) return false;\n\tif (combo.alt !== e.altKey) return false;\n\treturn true;\n}\n\n/**\n * Bind a keyboard shortcut. Use \"mod+k\" for Cmd-on-Mac, Ctrl-on-Win/Linux.\n * Used by CommandPalette (Phase 17 - ⌘K), Modal Esc-to-close (Phase 14).\n */\nexport function useKeyboardShortcut(\n\tcombo: string | string[],\n\thandler: (e: KeyboardEvent) => void,\n\toptions: ShortcutOptions = {},\n): void {\n\tconst { enabled = true, preventDefault = false, target } = options;\n\tuseEffect(() => {\n\t\tif (!enabled) return;\n\t\tconst combos = (Array.isArray(combo) ? combo : [combo]).map(parseCombo);\n\t\tconst t: EventTarget = target ?? (typeof window !== \"undefined\" ? window : ({} as EventTarget));\n\t\tfunction listener(ev: Event) {\n\t\t\tconst e = ev as KeyboardEvent;\n\t\t\tif (combos.some((c) => matches(e, c))) {\n\t\t\t\tif (preventDefault) e.preventDefault();\n\t\t\t\thandler(e);\n\t\t\t}\n\t\t}\n\t\tt.addEventListener(\"keydown\", listener);\n\t\treturn () => {\n\t\t\tt.removeEventListener(\"keydown\", listener);\n\t\t};\n\t}, [combo, handler, enabled, preventDefault, target]);\n}\n","import { useRef } from \"react\";\n\nexport interface LongPressHandlers {\n\tonPointerDown: (e: React.PointerEvent) => void;\n\tonPointerUp: (e: React.PointerEvent) => void;\n\tonPointerCancel: (e: React.PointerEvent) => void;\n\tonPointerLeave: (e: React.PointerEvent) => void;\n}\n\n/**\n * Fires `onLongPress` when a pointer is held for `ms` (default 600ms). Mouse\n * users release well under the threshold, so it stays inert on desktop — pair\n * it with a hover-reveal affordance there and a long-press → ActionSheet on\n * touch. Spread the returned handlers onto the target element.\n *\n * @example\n * const lp = useLongPress(() => setSheetOpen(true));\n * return <div {...lp}>…</div>;\n */\nexport function useLongPress(onLongPress: () => void, ms = 600): LongPressHandlers {\n\tconst timer = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n\tconst start = () => {\n\t\tif (timer.current) clearTimeout(timer.current);\n\t\ttimer.current = setTimeout(() => {\n\t\t\tonLongPress();\n\t\t}, ms);\n\t};\n\tconst cancel = () => {\n\t\tif (timer.current) {\n\t\t\tclearTimeout(timer.current);\n\t\t\ttimer.current = null;\n\t\t}\n\t};\n\n\treturn {\n\t\tonPointerDown: start,\n\t\tonPointerUp: cancel,\n\t\tonPointerCancel: cancel,\n\t\tonPointerLeave: cancel,\n\t};\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -129,6 +129,27 @@ interface InlineEditFieldProps {
|
|
|
129
129
|
}
|
|
130
130
|
declare function InlineEditField({ value, onSave, multiline, placeholder, disabled, maxLength, ariaLabel, font, className, style, }: InlineEditFieldProps): react_jsx_runtime.JSX.Element;
|
|
131
131
|
|
|
132
|
+
interface InlineAddRowProps {
|
|
133
|
+
/** Placeholder shown in both the dashed trigger and the active input. */
|
|
134
|
+
placeholder?: string;
|
|
135
|
+
/** Called with the trimmed value when the user commits (Enter). */
|
|
136
|
+
onSave: (value: string) => void;
|
|
137
|
+
/** Keyboard hint rendered at the right edge of the active input. */
|
|
138
|
+
kbdHint?: string;
|
|
139
|
+
className?: string;
|
|
140
|
+
style?: CSSProperties;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* InlineAddRow — a dashed "+ add" affordance that expands into an inline text
|
|
144
|
+
* input on click. Enter commits (`onSave` with the trimmed value); Esc or blur
|
|
145
|
+
* discards. Use for "add a question / note / person / row" patterns where a full
|
|
146
|
+
* form is overkill.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* <InlineAddRow placeholder="Add a question…" onSave={(t) => addQuestion(t)} />
|
|
150
|
+
*/
|
|
151
|
+
declare const InlineAddRow: react.ForwardRefExoticComponent<InlineAddRowProps & react.RefAttributes<HTMLDivElement>>;
|
|
152
|
+
|
|
132
153
|
type EyebrowSize = "xs" | "sm" | "md";
|
|
133
154
|
type EyebrowTone = "ink-3" | "ink-4" | "amber";
|
|
134
155
|
interface EyebrowProps extends HTMLAttributes<HTMLSpanElement> {
|
|
@@ -410,6 +431,18 @@ interface AvatarProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
410
431
|
name?: string;
|
|
411
432
|
/** Override the auto-derived initials (1–2 uppercase letters). */
|
|
412
433
|
initials?: string;
|
|
434
|
+
/**
|
|
435
|
+
* Derive the background color from this string instead of `name` — e.g. a
|
|
436
|
+
* stable id — so the color stays fixed even if the display name changes.
|
|
437
|
+
* Initials are still derived from `name`/`initials`.
|
|
438
|
+
*/
|
|
439
|
+
seed?: string;
|
|
440
|
+
/**
|
|
441
|
+
* Override the built-in solid-color palette used for the name→color hash.
|
|
442
|
+
* Pass a custom set (e.g. WCAG-tuned colors) to control which colors the
|
|
443
|
+
* deterministic hash can land on. Ignored when `gradient` is set.
|
|
444
|
+
*/
|
|
445
|
+
palette?: string[];
|
|
413
446
|
/**
|
|
414
447
|
* URL of an image to display. When provided, the image fills the circle and
|
|
415
448
|
* initials/background are not rendered.
|
|
@@ -1122,6 +1155,13 @@ interface BottomSheetProps {
|
|
|
1122
1155
|
* Defaults to detecting `html.dark` (Canvas dark mode toggle).
|
|
1123
1156
|
*/
|
|
1124
1157
|
dark?: boolean;
|
|
1158
|
+
/**
|
|
1159
|
+
* Track the mobile soft keyboard via `window.visualViewport` and lift the
|
|
1160
|
+
* footer above it (padding-bottom = visible-viewport delta). Defaults to
|
|
1161
|
+
* true. Set false to opt out; it is a no-op anyway on platforms without a
|
|
1162
|
+
* `visualViewport` (e.g. desktop) or when there is no footer.
|
|
1163
|
+
*/
|
|
1164
|
+
trackKeyboard?: boolean;
|
|
1125
1165
|
className?: string;
|
|
1126
1166
|
style?: CSSProperties;
|
|
1127
1167
|
}
|
|
@@ -1155,7 +1195,38 @@ interface BottomSheetProps {
|
|
|
1155
1195
|
* feeding it into useFocusTrap's `active` arg ensures the trap re-runs
|
|
1156
1196
|
* once the portal commits the panel into the DOM.
|
|
1157
1197
|
*/
|
|
1158
|
-
declare function BottomSheet({ open, onClose, title, footer, children, height, closeOnBackdropClick, dark, className, style, }: BottomSheetProps): react_jsx_runtime.JSX.Element | null;
|
|
1198
|
+
declare function BottomSheet({ open, onClose, title, footer, children, height, closeOnBackdropClick, dark, trackKeyboard, className, style, }: BottomSheetProps): react_jsx_runtime.JSX.Element | null;
|
|
1199
|
+
|
|
1200
|
+
interface ActionSheetItem {
|
|
1201
|
+
label: string;
|
|
1202
|
+
/** `"destructive"` renders the label in `--red`. */
|
|
1203
|
+
variant?: "default" | "destructive";
|
|
1204
|
+
onSelect: () => void;
|
|
1205
|
+
}
|
|
1206
|
+
interface ActionSheetProps {
|
|
1207
|
+
open: boolean;
|
|
1208
|
+
onClose: () => void;
|
|
1209
|
+
items: ActionSheetItem[];
|
|
1210
|
+
/** Dismiss-without-picking label. Default "Close". Backdrop tap + Esc also dismiss. */
|
|
1211
|
+
cancelLabel?: string;
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* ActionSheet — an iOS-style bottom-anchored action list: a rounded block of
|
|
1215
|
+
* tappable items plus a separate Cancel block. Backdrop tap, the Cancel button,
|
|
1216
|
+
* and Esc all dismiss; body scroll locks while open. Pair with `useLongPress`
|
|
1217
|
+
* for the touch "long-press → actions" pattern.
|
|
1218
|
+
*
|
|
1219
|
+
* @example
|
|
1220
|
+
* <ActionSheet
|
|
1221
|
+
* open={open}
|
|
1222
|
+
* onClose={() => setOpen(false)}
|
|
1223
|
+
* items={[
|
|
1224
|
+
* { label: "Edit", onSelect: edit },
|
|
1225
|
+
* { label: "Delete", variant: "destructive", onSelect: remove },
|
|
1226
|
+
* ]}
|
|
1227
|
+
* />
|
|
1228
|
+
*/
|
|
1229
|
+
declare function ActionSheet({ open, onClose, items, cancelLabel }: ActionSheetProps): react.ReactPortal | null;
|
|
1159
1230
|
|
|
1160
1231
|
interface LightboxItem {
|
|
1161
1232
|
src: string;
|
|
@@ -1527,6 +1598,12 @@ interface SnackbarOptions {
|
|
|
1527
1598
|
* Pass an explicit boolean to override.
|
|
1528
1599
|
*/
|
|
1529
1600
|
dismissible?: boolean;
|
|
1601
|
+
/** Render a thin countdown progress bar along the bottom edge that depletes
|
|
1602
|
+
* (width 100% → 0%) linearly over `duration` ms — a visual undo timer
|
|
1603
|
+
* (matches the SoftConfirmToast pattern). Only renders when `true` AND
|
|
1604
|
+
* `duration` is finite. Respects `prefers-reduced-motion: reduce` (the bar
|
|
1605
|
+
* is shown static, no animation). Default `false`. */
|
|
1606
|
+
progress?: boolean;
|
|
1530
1607
|
}
|
|
1531
1608
|
interface SnackbarApi {
|
|
1532
1609
|
/** Show a snackbar. Replaces any active snackbar (single-at-a-time). */
|
|
@@ -2002,10 +2079,28 @@ interface ColorInputProps {
|
|
|
2002
2079
|
*/
|
|
2003
2080
|
declare function ColorInput({ value, onChange, defaultValue, label, className, style, }: ColorInputProps): react_jsx_runtime.JSX.Element;
|
|
2004
2081
|
|
|
2082
|
+
/**
|
|
2083
|
+
* Optional per-option active colors. When set, the option uses these
|
|
2084
|
+
* foreground/background colors *while active* instead of the default amber
|
|
2085
|
+
* pill. Prefer DS CSS-var tokens (e.g. `var(--green)`). Inactive options are
|
|
2086
|
+
* unaffected and render with default styling.
|
|
2087
|
+
*/
|
|
2088
|
+
interface SegmentedTone {
|
|
2089
|
+
/** Text color of the option while active. */
|
|
2090
|
+
fg: string;
|
|
2091
|
+
/** Background of the option while active. */
|
|
2092
|
+
activeBg: string;
|
|
2093
|
+
}
|
|
2005
2094
|
interface SegmentedOption<T extends string = string> {
|
|
2006
2095
|
value: T;
|
|
2007
2096
|
label: string;
|
|
2008
2097
|
disabled?: boolean;
|
|
2098
|
+
/**
|
|
2099
|
+
* Optional per-option active tone. When provided, the *active* segment
|
|
2100
|
+
* renders with `tone.fg` / `tone.activeBg` instead of the default amber.
|
|
2101
|
+
* Omit for the standard styling (fully backward compatible).
|
|
2102
|
+
*/
|
|
2103
|
+
tone?: SegmentedTone;
|
|
2009
2104
|
}
|
|
2010
2105
|
interface SegmentedControlProps<T extends string = string> {
|
|
2011
2106
|
options: SegmentedOption<T>[];
|
|
@@ -2513,6 +2608,17 @@ interface RichTextProps {
|
|
|
2513
2608
|
ariaLabel?: string;
|
|
2514
2609
|
/** Inline styles applied to the outer root wrapper. */
|
|
2515
2610
|
style?: CSSProperties;
|
|
2611
|
+
/** Borderless/inline mode: strips the editor chrome (border, background, padding,
|
|
2612
|
+
* min-height) so the editor sits inline inside a card or click-to-edit surface.
|
|
2613
|
+
* Purely additive - default keeps the bordered "card" appearance.
|
|
2614
|
+
* @default false
|
|
2615
|
+
*/
|
|
2616
|
+
inline?: boolean;
|
|
2617
|
+
/** Show a keyboard-shortcut hint strip (⌘B ⌘I ⌘U ⌘⇧H ⌘K ⌘↵ Esc) that is revealed
|
|
2618
|
+
* while the editor has focus. Suppressed in `readOnly` mode.
|
|
2619
|
+
* @default false
|
|
2620
|
+
*/
|
|
2621
|
+
hints?: boolean;
|
|
2516
2622
|
}
|
|
2517
2623
|
declare const RichText: react.ForwardRefExoticComponent<RichTextProps & react.RefAttributes<HTMLDivElement>>;
|
|
2518
2624
|
|
|
@@ -2825,4 +2931,4 @@ declare function SortableItem({ id, children, reducedMotion }: SortableItemProps
|
|
|
2825
2931
|
declare function SortableDndContext({ children, onMove, renderOverlay }: SortableDndContextProps): react_jsx_runtime.JSX.Element;
|
|
2826
2932
|
declare function Sortable({ items, onReorder, renderItem, id, className, style }: SortableProps): react_jsx_runtime.JSX.Element;
|
|
2827
2933
|
|
|
2828
|
-
export { Accordion, type AccordionItemProps, type AccordionProps, AlertBanner, type AlertBannerProps, type AlertBannerTone, AppBar, type AppBarProps, type AppBarVariant, AppShell, type AppShellProps, Autocomplete, type AutocompleteProps, Avatar, type AvatarPresence, type AvatarPresencePosition, type AvatarProps, type AvatarSize, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, type BadgeTone, BottomSheet, type BottomSheetHeight, type BottomSheetProps, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Calendar, type CalendarEvent, type CalendarProps, Card, type CardProps, type CardVariant, Carousel, type CarouselProps, type CarouselSlide, Checkbox, type CheckboxProps, Chip, type ChipProps, type ChipTone, Coachmark, type CoachmarkProps, ColorInput, type ColorInputProps, ColorPicker, type ColorPickerProps, CommandPalette, type CommandPaletteItem, type CommandPaletteProps, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogTone, ContextMenu, type ContextMenuItem, type ContextMenuProps, CopyToClipboard, type CopyToClipboardProps, DSPortal, type DSPortalProps, DataGrid, type DataGridColumn, type DataGridProps, type DataGridRow, DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, Divider, type DividerProps, DotGrid, type DotGridProps, EmptyState, type EmptyStateProps, Eyebrow, type EyebrowProps, type EyebrowSize, FieldError, type FieldErrorProps, FileInput, type FileInputProps, Footer, type FooterColumn, type FooterProps, type FooterVariant, FormErrorSummary, type FormErrorSummaryProps, Heading, type HeadingLevel, type HeadingProps, HoverCard, type HoverCardPlacement, type HoverCardProps, InfiniteList, type InfiniteListProps, InlineConfirm, type InlineConfirmProps, type InlineConfirmTriggerProps, InlineEdit, InlineEditField, type InlineEditFieldProps, type InlineEditProps, Kbd, type KbdProps, type KbdSize, Lightbox, type LightboxItem, type LightboxProps, Link, type LinkProps, type LinkVariant, MiniBar, type MiniBarProps, MiniDonut, type MiniDonutProps, Modal, type ModalProps, type ModalRole, MultiSelect, type MultiSelectOption, type MultiSelectProps, NumberStepper, type NumberStepperProps, OAuthButton, type OAuthButtonProps, type OAuthProvider, Pagination, type PaginationProps, PasswordStrength, type PasswordStrengthProps, Popover, type PopoverPlacement, type PopoverProps, type PopoverVariant, ProgressBar, type ProgressBarProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, RangeSlider, type RangeSliderProps, RelativeTime, type RelativeTimeProps, RichText, type RichTextProps, RollingNumber, type RollingNumberProps, SearchAndFilters, type SearchAndFiltersProps, type SearchFilter, type SearchSuggestion, SegmentedControl, type SegmentedControlProps, type SegmentedOption, Select, type SelectOption, type SelectProps, Sheet, type SheetProps, type SheetSide, Skeleton, type SkeletonProps, type SkeletonShape, type SnackbarAction, type SnackbarOptions, SnackbarProvider, type SnackbarProviderProps, type SnackbarTone, Sortable, SortableDndContext, type SortableDndContextProps, SortableItem, type SortableItemData, type SortableItemProps, type SortableProps, Sparkline, type SparklineProps, SplitButton, type SplitButtonAction, type SplitButtonProps, SplitHero, type SplitHeroProps, StarRating, type StarRatingProps, type StarRatingSize, StatCard, type StatCardChangeDir, type StatCardProps, StatusPill, type StatusPillProps, type StatusPillStage, StickyNote, type StickyNoteProps, type StickyNoteRotation, type TabItem, Table, type TableHeaderCellProps, type TableRootProps, Tabs, type TabsProps, Text, type TextElement, TextInput, type TextInputProps, type TextProps, type TextVariant, Textarea, type TextareaProps, Timeline, type TimelineEvent, type TimelineProps, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, Toggle, type ToggleProps, Tooltip, type TooltipPlacement, type TooltipProps, TypeToConfirm, type TypeToConfirmProps, Wizard, type WizardProps, type WizardStep, deriveGradient, deriveInitials, useSnackbar, useToast };
|
|
2934
|
+
export { Accordion, type AccordionItemProps, type AccordionProps, ActionSheet, type ActionSheetItem, type ActionSheetProps, AlertBanner, type AlertBannerProps, type AlertBannerTone, AppBar, type AppBarProps, type AppBarVariant, AppShell, type AppShellProps, Autocomplete, type AutocompleteProps, Avatar, type AvatarPresence, type AvatarPresencePosition, type AvatarProps, type AvatarSize, AvatarStack, type AvatarStackProps, Badge, type BadgeProps, type BadgeTone, BottomSheet, type BottomSheetHeight, type BottomSheetProps, type BreadcrumbItem, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Calendar, type CalendarEvent, type CalendarProps, Card, type CardProps, type CardVariant, Carousel, type CarouselProps, type CarouselSlide, Checkbox, type CheckboxProps, Chip, type ChipProps, type ChipTone, Coachmark, type CoachmarkProps, ColorInput, type ColorInputProps, ColorPicker, type ColorPickerProps, CommandPalette, type CommandPaletteItem, type CommandPaletteProps, ConfirmDialog, type ConfirmDialogProps, type ConfirmDialogTone, ContextMenu, type ContextMenuItem, type ContextMenuProps, CopyToClipboard, type CopyToClipboardProps, DSPortal, type DSPortalProps, DataGrid, type DataGridColumn, type DataGridProps, type DataGridRow, DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, Divider, type DividerProps, DotGrid, type DotGridProps, EmptyState, type EmptyStateProps, Eyebrow, type EyebrowProps, type EyebrowSize, FieldError, type FieldErrorProps, FileInput, type FileInputProps, Footer, type FooterColumn, type FooterProps, type FooterVariant, FormErrorSummary, type FormErrorSummaryProps, Heading, type HeadingLevel, type HeadingProps, HoverCard, type HoverCardPlacement, type HoverCardProps, InfiniteList, type InfiniteListProps, InlineAddRow, type InlineAddRowProps, InlineConfirm, type InlineConfirmProps, type InlineConfirmTriggerProps, InlineEdit, InlineEditField, type InlineEditFieldProps, type InlineEditProps, Kbd, type KbdProps, type KbdSize, Lightbox, type LightboxItem, type LightboxProps, Link, type LinkProps, type LinkVariant, MiniBar, type MiniBarProps, MiniDonut, type MiniDonutProps, Modal, type ModalProps, type ModalRole, MultiSelect, type MultiSelectOption, type MultiSelectProps, NumberStepper, type NumberStepperProps, OAuthButton, type OAuthButtonProps, type OAuthProvider, Pagination, type PaginationProps, PasswordStrength, type PasswordStrengthProps, Popover, type PopoverPlacement, type PopoverProps, type PopoverVariant, ProgressBar, type ProgressBarProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, RangeSlider, type RangeSliderProps, RelativeTime, type RelativeTimeProps, RichText, type RichTextProps, RollingNumber, type RollingNumberProps, SearchAndFilters, type SearchAndFiltersProps, type SearchFilter, type SearchSuggestion, SegmentedControl, type SegmentedControlProps, type SegmentedOption, Select, type SelectOption, type SelectProps, Sheet, type SheetProps, type SheetSide, Skeleton, type SkeletonProps, type SkeletonShape, type SnackbarAction, type SnackbarOptions, SnackbarProvider, type SnackbarProviderProps, type SnackbarTone, Sortable, SortableDndContext, type SortableDndContextProps, SortableItem, type SortableItemData, type SortableItemProps, type SortableProps, Sparkline, type SparklineProps, SplitButton, type SplitButtonAction, type SplitButtonProps, SplitHero, type SplitHeroProps, StarRating, type StarRatingProps, type StarRatingSize, StatCard, type StatCardChangeDir, type StatCardProps, StatusPill, type StatusPillProps, type StatusPillStage, StickyNote, type StickyNoteProps, type StickyNoteRotation, type TabItem, Table, type TableHeaderCellProps, type TableRootProps, Tabs, type TabsProps, Text, type TextElement, TextInput, type TextInputProps, type TextProps, type TextVariant, Textarea, type TextareaProps, Timeline, type TimelineEvent, type TimelineProps, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, Toggle, type ToggleProps, Tooltip, type TooltipPlacement, type TooltipProps, TypeToConfirm, type TypeToConfirmProps, Wizard, type WizardProps, type WizardStep, deriveGradient, deriveInitials, useSnackbar, useToast };
|