@refraction-ui/react 0.4.2 → 0.6.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 +9 -1
- package/dist/chunk-O4453CBF.js +137 -0
- package/dist/chunk-O4453CBF.js.map +1 -0
- package/dist/chunk-XWP763SH.js +76 -0
- package/dist/chunk-XWP763SH.js.map +1 -0
- package/dist/faro-engine-47HGRAQH-JKINJPMH.js +3 -0
- package/dist/faro-engine-47HGRAQH-JKINJPMH.js.map +1 -0
- package/dist/form.cjs +340 -0
- package/dist/form.cjs.map +1 -0
- package/dist/form.d.cts +1 -0
- package/dist/form.d.ts +1 -0
- package/dist/form.js +204 -0
- package/dist/form.js.map +1 -0
- package/dist/index.cjs +1438 -237
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +76 -76
- package/dist/index.d.ts +76 -76
- package/dist/index.js +1317 -312
- package/dist/index.js.map +1 -1
- package/dist/internal/analytics/index.d.cts +448 -0
- package/dist/internal/analytics/index.d.ts +448 -0
- package/dist/internal/animated-text/index.d.cts +47 -0
- package/dist/internal/animated-text/index.d.ts +47 -0
- package/dist/internal/app-shell/index.d.cts +128 -0
- package/dist/internal/app-shell/index.d.ts +128 -0
- package/dist/internal/auth/index.d.cts +74 -0
- package/dist/internal/auth/index.d.ts +74 -0
- package/dist/internal/avatar/index.d.cts +53 -0
- package/dist/internal/avatar/index.d.ts +53 -0
- package/dist/internal/avatar-group/index.d.cts +70 -0
- package/dist/internal/avatar-group/index.d.ts +70 -0
- package/dist/internal/badge/index.d.cts +26 -0
- package/dist/internal/badge/index.d.ts +26 -0
- package/dist/internal/bottom-nav/index.d.cts +29 -0
- package/dist/internal/bottom-nav/index.d.ts +29 -0
- package/dist/internal/breadcrumbs/index.d.cts +38 -0
- package/dist/internal/breadcrumbs/index.d.ts +38 -0
- package/dist/internal/button/index.d.cts +34 -0
- package/dist/internal/button/index.d.ts +34 -0
- package/dist/internal/calendar/index.d.cts +73 -0
- package/dist/internal/calendar/index.d.ts +73 -0
- package/dist/internal/card/index.d.cts +62 -0
- package/dist/internal/card/index.d.ts +62 -0
- package/dist/internal/card-grid/index.d.cts +10 -0
- package/dist/internal/card-grid/index.d.ts +10 -0
- package/dist/internal/checkbox/index.d.cts +40 -0
- package/dist/internal/checkbox/index.d.ts +40 -0
- package/dist/internal/code-editor/index.d.cts +47 -0
- package/dist/internal/code-editor/index.d.ts +47 -0
- package/dist/internal/collapsible/index.d.cts +43 -0
- package/dist/internal/collapsible/index.d.ts +43 -0
- package/dist/internal/command/index.d.cts +80 -0
- package/dist/internal/command/index.d.ts +80 -0
- package/dist/internal/content-protection/index.d.cts +47 -0
- package/dist/internal/content-protection/index.d.ts +47 -0
- package/dist/internal/data-table/index.d.cts +73 -0
- package/dist/internal/data-table/index.d.ts +73 -0
- package/dist/internal/date-picker/index.d.cts +98 -0
- package/dist/internal/date-picker/index.d.ts +98 -0
- package/dist/internal/device-frame/index.d.cts +40 -0
- package/dist/internal/device-frame/index.d.ts +40 -0
- package/dist/internal/dialog/index.d.cts +54 -0
- package/dist/internal/dialog/index.d.ts +54 -0
- package/dist/internal/dropdown-menu/index.d.cts +55 -0
- package/dist/internal/dropdown-menu/index.d.ts +55 -0
- package/dist/internal/emoji-picker/index.d.cts +77 -0
- package/dist/internal/emoji-picker/index.d.ts +77 -0
- package/dist/internal/feedback-dialog/index.d.cts +55 -0
- package/dist/internal/feedback-dialog/index.d.ts +55 -0
- package/dist/internal/file-upload/index.d.cts +91 -0
- package/dist/internal/file-upload/index.d.ts +91 -0
- package/dist/internal/footer/index.d.cts +30 -0
- package/dist/internal/footer/index.d.ts +30 -0
- package/dist/internal/inline-editor/index.d.cts +52 -0
- package/dist/internal/inline-editor/index.d.ts +52 -0
- package/dist/internal/input/index.d.cts +38 -0
- package/dist/internal/input/index.d.ts +38 -0
- package/dist/internal/input-group/index.d.cts +35 -0
- package/dist/internal/input-group/index.d.ts +35 -0
- package/dist/internal/install-prompt/index.d.cts +36 -0
- package/dist/internal/install-prompt/index.d.ts +36 -0
- package/dist/internal/keyboard-shortcut/index.d.cts +49 -0
- package/dist/internal/keyboard-shortcut/index.d.ts +49 -0
- package/dist/internal/language-selector/index.d.cts +63 -0
- package/dist/internal/language-selector/index.d.ts +63 -0
- package/dist/internal/logger/index.d.cts +229 -0
- package/dist/internal/logger/index.d.ts +229 -0
- package/dist/internal/markdown-renderer/index.d.cts +40 -0
- package/dist/internal/markdown-renderer/index.d.ts +40 -0
- package/dist/internal/mobile-nav/index.d.cts +45 -0
- package/dist/internal/mobile-nav/index.d.ts +45 -0
- package/dist/internal/navbar/index.d.cts +30 -0
- package/dist/internal/navbar/index.d.ts +30 -0
- package/dist/internal/otp-input/index.d.cts +66 -0
- package/dist/internal/otp-input/index.d.ts +66 -0
- package/dist/internal/payment/index.d.cts +9 -0
- package/dist/internal/payment/index.d.ts +9 -0
- package/dist/internal/popover/index.d.cts +46 -0
- package/dist/internal/popover/index.d.ts +46 -0
- package/dist/internal/presence-indicator/index.d.cts +38 -0
- package/dist/internal/presence-indicator/index.d.ts +38 -0
- package/dist/internal/progress-display/index.d.cts +60 -0
- package/dist/internal/progress-display/index.d.ts +60 -0
- package/dist/internal/radio/index.d.ts +43 -0
- package/dist/internal/react-accordion/index.d.ts +22 -0
- package/dist/internal/react-analytics/index.d.cts +44 -0
- package/dist/internal/react-analytics/index.d.ts +44 -0
- package/dist/internal/react-animated-text/index.d.cts +12 -0
- package/dist/internal/react-animated-text/index.d.ts +12 -0
- package/dist/internal/react-app-shell/index.d.cts +169 -0
- package/dist/internal/react-app-shell/index.d.ts +169 -0
- package/dist/internal/react-auth/index.d.cts +59 -0
- package/dist/internal/react-auth/index.d.ts +59 -0
- package/dist/internal/react-avatar/index.d.cts +20 -0
- package/dist/internal/react-avatar/index.d.ts +20 -0
- package/dist/internal/react-avatar-group/index.d.cts +33 -0
- package/dist/internal/react-avatar-group/index.d.ts +33 -0
- package/dist/internal/react-badge/index.d.cts +17 -0
- package/dist/internal/react-badge/index.d.ts +17 -0
- package/dist/internal/react-bottom-nav/index.d.cts +19 -0
- package/dist/internal/react-bottom-nav/index.d.ts +19 -0
- package/dist/internal/react-breadcrumbs/index.d.cts +24 -0
- package/dist/internal/react-breadcrumbs/index.d.ts +24 -0
- package/dist/internal/react-button/index.d.cts +21 -0
- package/dist/internal/react-button/index.d.ts +21 -0
- package/dist/internal/react-calendar/index.d.cts +44 -0
- package/dist/internal/react-calendar/index.d.ts +44 -0
- package/dist/internal/react-callout/index.d.cts +12 -0
- package/dist/internal/react-callout/index.d.ts +12 -0
- package/dist/internal/react-card/index.d.cts +29 -0
- package/dist/internal/react-card/index.d.ts +29 -0
- package/dist/internal/react-card-grid/index.d.cts +8 -0
- package/dist/internal/react-card-grid/index.d.ts +8 -0
- package/dist/internal/react-carousel/index.d.ts +22 -0
- package/dist/internal/react-checkbox/index.d.cts +18 -0
- package/dist/internal/react-checkbox/index.d.ts +18 -0
- package/dist/internal/react-code-block/index.d.cts +7 -0
- package/dist/internal/react-code-block/index.d.ts +7 -0
- package/dist/internal/react-code-editor/index.d.cts +28 -0
- package/dist/internal/react-code-editor/index.d.ts +28 -0
- package/dist/internal/react-collapsible/index.d.cts +29 -0
- package/dist/internal/react-collapsible/index.d.ts +29 -0
- package/dist/internal/react-combobox/index.d.cts +94 -0
- package/dist/internal/react-combobox/index.d.ts +94 -0
- package/dist/internal/react-command/index.d.cts +51 -0
- package/dist/internal/react-command/index.d.ts +51 -0
- package/dist/internal/react-content-protection/index.d.cts +22 -0
- package/dist/internal/react-content-protection/index.d.ts +22 -0
- package/dist/internal/react-data-table/index.d.cts +22 -0
- package/dist/internal/react-data-table/index.d.ts +22 -0
- package/dist/internal/react-date-picker/index.d.cts +23 -0
- package/dist/internal/react-date-picker/index.d.ts +23 -0
- package/dist/internal/react-device-frame/index.d.cts +37 -0
- package/dist/internal/react-device-frame/index.d.ts +37 -0
- package/dist/internal/react-dialog/index.d.cts +49 -0
- package/dist/internal/react-dialog/index.d.ts +49 -0
- package/dist/internal/react-dropdown-menu/index.d.cts +37 -0
- package/dist/internal/react-dropdown-menu/index.d.ts +37 -0
- package/dist/internal/react-emoji-picker/index.d.cts +32 -0
- package/dist/internal/react-emoji-picker/index.d.ts +32 -0
- package/dist/internal/react-feedback-dialog/index.d.cts +40 -0
- package/dist/internal/react-feedback-dialog/index.d.ts +40 -0
- package/dist/internal/react-file-tree/index.d.cts +5 -0
- package/dist/internal/react-file-tree/index.d.ts +5 -0
- package/dist/internal/react-file-upload/index.d.cts +22 -0
- package/dist/internal/react-file-upload/index.d.ts +22 -0
- package/dist/internal/react-footer/index.d.cts +20 -0
- package/dist/internal/react-footer/index.d.ts +20 -0
- package/dist/internal/react-form/index.d.cts +85 -0
- package/dist/internal/react-form/index.d.ts +85 -0
- package/dist/internal/react-icon-system/index.d.cts +5 -0
- package/dist/internal/react-icon-system/index.d.ts +5 -0
- package/dist/internal/react-inline-editor/index.d.cts +17 -0
- package/dist/internal/react-inline-editor/index.d.ts +17 -0
- package/dist/internal/react-input/index.d.cts +31 -0
- package/dist/internal/react-input/index.d.ts +31 -0
- package/dist/internal/react-input-group/index.d.cts +34 -0
- package/dist/internal/react-input-group/index.d.ts +34 -0
- package/dist/internal/react-install-prompt/index.d.cts +24 -0
- package/dist/internal/react-install-prompt/index.d.ts +24 -0
- package/dist/internal/react-keyboard-shortcut/index.d.cts +57 -0
- package/dist/internal/react-keyboard-shortcut/index.d.ts +57 -0
- package/dist/internal/react-language-selector/index.d.cts +26 -0
- package/dist/internal/react-language-selector/index.d.ts +26 -0
- package/dist/internal/react-link-card/index.d.cts +5 -0
- package/dist/internal/react-link-card/index.d.ts +5 -0
- package/dist/internal/react-logger/index.d.cts +107 -0
- package/dist/internal/react-logger/index.d.ts +107 -0
- package/dist/internal/react-markdown-renderer/index.d.cts +20 -0
- package/dist/internal/react-markdown-renderer/index.d.ts +20 -0
- package/dist/internal/react-mobile-nav/index.d.cts +33 -0
- package/dist/internal/react-mobile-nav/index.d.ts +33 -0
- package/dist/internal/react-navbar/index.d.cts +25 -0
- package/dist/internal/react-navbar/index.d.ts +25 -0
- package/dist/internal/react-otp-input/index.d.cts +21 -0
- package/dist/internal/react-otp-input/index.d.ts +21 -0
- package/dist/internal/react-pagination/index.d.ts +7 -0
- package/dist/internal/react-payment/index.d.cts +9 -0
- package/dist/internal/react-payment/index.d.ts +9 -0
- package/dist/internal/react-popover/index.d.cts +33 -0
- package/dist/internal/react-popover/index.d.ts +33 -0
- package/dist/internal/react-presence-indicator/index.d.cts +34 -0
- package/dist/internal/react-presence-indicator/index.d.ts +34 -0
- package/dist/internal/react-progress-display/index.d.cts +21 -0
- package/dist/internal/react-progress-display/index.d.ts +21 -0
- package/dist/internal/react-radio/index.d.ts +33 -0
- package/dist/internal/react-reaction-bar/index.d.cts +34 -0
- package/dist/internal/react-reaction-bar/index.d.ts +34 -0
- package/dist/internal/react-resizable-layout/index.d.cts +36 -0
- package/dist/internal/react-resizable-layout/index.d.ts +36 -0
- package/dist/internal/react-rich-editor/index.d.cts +2 -0
- package/dist/internal/react-rich-editor/index.d.ts +2 -0
- package/dist/internal/react-search-bar/index.d.cts +32 -0
- package/dist/internal/react-search-bar/index.d.ts +32 -0
- package/dist/internal/react-select/index.d.cts +30 -0
- package/dist/internal/react-select/index.d.ts +30 -0
- package/dist/internal/react-sheet/index.d.cts +67 -0
- package/dist/internal/react-sheet/index.d.ts +67 -0
- package/dist/internal/react-sidebar/index.d.cts +23 -0
- package/dist/internal/react-sidebar/index.d.ts +23 -0
- package/dist/internal/react-skeleton/index.d.cts +31 -0
- package/dist/internal/react-skeleton/index.d.ts +31 -0
- package/dist/internal/react-skip-to-content/index.d.cts +9 -0
- package/dist/internal/react-skip-to-content/index.d.ts +9 -0
- package/dist/internal/react-slide-viewer/index.d.cts +23 -0
- package/dist/internal/react-slide-viewer/index.d.ts +23 -0
- package/dist/internal/react-slider/index.d.cts +1 -0
- package/dist/internal/react-slider/index.d.ts +1 -0
- package/dist/internal/react-status-indicator/index.d.cts +34 -0
- package/dist/internal/react-status-indicator/index.d.ts +34 -0
- package/dist/internal/react-steps/index.d.cts +19 -0
- package/dist/internal/react-steps/index.d.ts +19 -0
- package/dist/internal/react-switch/index.d.cts +17 -0
- package/dist/internal/react-switch/index.d.ts +17 -0
- package/dist/internal/react-table-of-contents/index.d.ts +10 -0
- package/dist/internal/react-tabs/index.d.cts +31 -0
- package/dist/internal/react-tabs/index.d.ts +31 -0
- package/dist/internal/react-textarea/index.d.cts +16 -0
- package/dist/internal/react-textarea/index.d.ts +16 -0
- package/dist/internal/react-theme/index.d.cts +44 -0
- package/dist/internal/react-theme/index.d.ts +44 -0
- package/dist/internal/react-thread-view/index.d.cts +34 -0
- package/dist/internal/react-thread-view/index.d.ts +34 -0
- package/dist/internal/react-toast/index.d.cts +36 -0
- package/dist/internal/react-toast/index.d.ts +36 -0
- package/dist/internal/react-tooltip/index.d.cts +33 -0
- package/dist/internal/react-tooltip/index.d.ts +33 -0
- package/dist/internal/react-version-selector/index.d.cts +24 -0
- package/dist/internal/react-version-selector/index.d.ts +24 -0
- package/dist/internal/react-video-player/index.d.cts +9 -0
- package/dist/internal/react-video-player/index.d.ts +9 -0
- package/dist/internal/react-voice-pill/index.d.cts +10 -0
- package/dist/internal/react-voice-pill/index.d.ts +10 -0
- package/dist/internal/react-waveform/index.d.cts +9 -0
- package/dist/internal/react-waveform/index.d.ts +9 -0
- package/dist/internal/reaction-bar/index.d.cts +50 -0
- package/dist/internal/reaction-bar/index.d.ts +50 -0
- package/dist/internal/resizable-layout/index.d.cts +47 -0
- package/dist/internal/resizable-layout/index.d.ts +47 -0
- package/dist/internal/search-bar/index.d.cts +51 -0
- package/dist/internal/search-bar/index.d.ts +51 -0
- package/dist/internal/select/index.d.cts +69 -0
- package/dist/internal/select/index.d.ts +69 -0
- package/dist/internal/shared/index.d.cts +419 -0
- package/dist/internal/shared/index.d.ts +419 -0
- package/dist/internal/sidebar/index.d.cts +40 -0
- package/dist/internal/sidebar/index.d.ts +40 -0
- package/dist/internal/skeleton/index.d.cts +27 -0
- package/dist/internal/skeleton/index.d.ts +27 -0
- package/dist/internal/slide-viewer/index.d.cts +72 -0
- package/dist/internal/slide-viewer/index.d.ts +72 -0
- package/dist/internal/slider/index.d.cts +4 -0
- package/dist/internal/slider/index.d.ts +4 -0
- package/dist/internal/status-indicator/index.d.cts +42 -0
- package/dist/internal/status-indicator/index.d.ts +42 -0
- package/dist/internal/switch/index.d.cts +41 -0
- package/dist/internal/switch/index.d.ts +41 -0
- package/dist/internal/tabs/index.d.cts +45 -0
- package/dist/internal/tabs/index.d.ts +45 -0
- package/dist/internal/textarea/index.d.cts +28 -0
- package/dist/internal/textarea/index.d.ts +28 -0
- package/dist/internal/theme/index.d.cts +60 -0
- package/dist/internal/theme/index.d.ts +60 -0
- package/dist/internal/thread-view/index.d.cts +95 -0
- package/dist/internal/thread-view/index.d.ts +95 -0
- package/dist/internal/toast/index.d.cts +64 -0
- package/dist/internal/toast/index.d.ts +64 -0
- package/dist/internal/tooltip/index.d.cts +45 -0
- package/dist/internal/tooltip/index.d.ts +45 -0
- package/dist/internal/version-selector/index.d.cts +68 -0
- package/dist/internal/version-selector/index.d.ts +68 -0
- package/dist/internal/video-player/index.d.cts +50 -0
- package/dist/internal/video-player/index.d.ts +50 -0
- package/dist/internal/voice-pill/index.d.cts +86 -0
- package/dist/internal/voice-pill/index.d.ts +86 -0
- package/dist/internal/waveform/index.d.cts +83 -0
- package/dist/internal/waveform/index.d.ts +83 -0
- package/dist/theme.cjs +23 -0
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +5 -2
- package/dist/theme.js.map +1 -1
- package/package.json +10 -7
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { AccessibilityProps, KeyboardHandlerMap, FocusTrapConfig } from '../shared/index.cjs';
|
|
2
|
+
|
|
3
|
+
interface DialogProps {
|
|
4
|
+
/** Whether the dialog is open (controlled) */
|
|
5
|
+
open?: boolean;
|
|
6
|
+
/** Whether the dialog starts open (uncontrolled) */
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
/** Callback when open state changes */
|
|
9
|
+
onOpenChange?: (open: boolean) => void;
|
|
10
|
+
/** Whether the dialog is modal (default: true) */
|
|
11
|
+
modal?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface DialogState {
|
|
14
|
+
open: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface DialogAPI {
|
|
17
|
+
/** Current dialog state */
|
|
18
|
+
state: DialogState;
|
|
19
|
+
/** ARIA attributes for the trigger button */
|
|
20
|
+
triggerProps: Partial<AccessibilityProps> & Record<string, unknown>;
|
|
21
|
+
/** ARIA attributes for the dialog content */
|
|
22
|
+
contentProps: Partial<AccessibilityProps> & Record<string, unknown>;
|
|
23
|
+
/** Data attributes for the overlay */
|
|
24
|
+
overlayProps: Record<string, string>;
|
|
25
|
+
/** Open the dialog */
|
|
26
|
+
open(): void;
|
|
27
|
+
/** Close the dialog */
|
|
28
|
+
close(): void;
|
|
29
|
+
/** Toggle the dialog */
|
|
30
|
+
toggle(): void;
|
|
31
|
+
/** Keyboard handlers (Escape to close) */
|
|
32
|
+
keyboardHandlers: KeyboardHandlerMap;
|
|
33
|
+
/** Generated IDs for aria linking */
|
|
34
|
+
ids: {
|
|
35
|
+
content: string;
|
|
36
|
+
title: string;
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Focus trap configuration for framework wrappers.
|
|
41
|
+
* Pass this to createFocusTrap() with a container element.
|
|
42
|
+
*/
|
|
43
|
+
focusTrapConfig: Omit<FocusTrapConfig, 'container'>;
|
|
44
|
+
}
|
|
45
|
+
declare function createDialog(props?: DialogProps): DialogAPI;
|
|
46
|
+
|
|
47
|
+
declare const overlayStyles = "fixed inset-0 z-50 bg-black/80";
|
|
48
|
+
declare const dialogContentVariants: (props?: ({
|
|
49
|
+
[x: string]: string | undefined;
|
|
50
|
+
} & {
|
|
51
|
+
className?: string;
|
|
52
|
+
}) | undefined) => string;
|
|
53
|
+
|
|
54
|
+
export { type DialogAPI, type DialogProps, type DialogState, createDialog, dialogContentVariants, overlayStyles };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { AccessibilityProps, KeyboardHandlerMap, FocusTrapConfig } from '../shared/index.js';
|
|
2
|
+
|
|
3
|
+
interface DialogProps {
|
|
4
|
+
/** Whether the dialog is open (controlled) */
|
|
5
|
+
open?: boolean;
|
|
6
|
+
/** Whether the dialog starts open (uncontrolled) */
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
/** Callback when open state changes */
|
|
9
|
+
onOpenChange?: (open: boolean) => void;
|
|
10
|
+
/** Whether the dialog is modal (default: true) */
|
|
11
|
+
modal?: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface DialogState {
|
|
14
|
+
open: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface DialogAPI {
|
|
17
|
+
/** Current dialog state */
|
|
18
|
+
state: DialogState;
|
|
19
|
+
/** ARIA attributes for the trigger button */
|
|
20
|
+
triggerProps: Partial<AccessibilityProps> & Record<string, unknown>;
|
|
21
|
+
/** ARIA attributes for the dialog content */
|
|
22
|
+
contentProps: Partial<AccessibilityProps> & Record<string, unknown>;
|
|
23
|
+
/** Data attributes for the overlay */
|
|
24
|
+
overlayProps: Record<string, string>;
|
|
25
|
+
/** Open the dialog */
|
|
26
|
+
open(): void;
|
|
27
|
+
/** Close the dialog */
|
|
28
|
+
close(): void;
|
|
29
|
+
/** Toggle the dialog */
|
|
30
|
+
toggle(): void;
|
|
31
|
+
/** Keyboard handlers (Escape to close) */
|
|
32
|
+
keyboardHandlers: KeyboardHandlerMap;
|
|
33
|
+
/** Generated IDs for aria linking */
|
|
34
|
+
ids: {
|
|
35
|
+
content: string;
|
|
36
|
+
title: string;
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Focus trap configuration for framework wrappers.
|
|
41
|
+
* Pass this to createFocusTrap() with a container element.
|
|
42
|
+
*/
|
|
43
|
+
focusTrapConfig: Omit<FocusTrapConfig, 'container'>;
|
|
44
|
+
}
|
|
45
|
+
declare function createDialog(props?: DialogProps): DialogAPI;
|
|
46
|
+
|
|
47
|
+
declare const overlayStyles = "fixed inset-0 z-50 bg-black/80";
|
|
48
|
+
declare const dialogContentVariants: (props?: ({
|
|
49
|
+
[x: string]: string | undefined;
|
|
50
|
+
} & {
|
|
51
|
+
className?: string;
|
|
52
|
+
}) | undefined) => string;
|
|
53
|
+
|
|
54
|
+
export { type DialogAPI, type DialogProps, type DialogState, createDialog, dialogContentVariants, overlayStyles };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { AccessibilityProps, KeyboardHandlerMap } from '../shared/index.cjs';
|
|
2
|
+
|
|
3
|
+
interface DropdownMenuProps {
|
|
4
|
+
/** Whether the menu is open (controlled) */
|
|
5
|
+
open?: boolean;
|
|
6
|
+
/** Whether the menu starts open (uncontrolled) */
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
/** Callback when open state changes */
|
|
9
|
+
onOpenChange?: (open: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
interface MenuItemProps {
|
|
12
|
+
/** Whether the item is disabled */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Callback when the item is selected */
|
|
15
|
+
onSelect?: () => void;
|
|
16
|
+
}
|
|
17
|
+
interface DropdownMenuState {
|
|
18
|
+
open: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface DropdownMenuAPI {
|
|
21
|
+
/** Current menu state */
|
|
22
|
+
state: DropdownMenuState;
|
|
23
|
+
/** ARIA attributes for the trigger button */
|
|
24
|
+
triggerProps: Partial<AccessibilityProps> & Record<string, unknown>;
|
|
25
|
+
/** ARIA attributes for the menu content */
|
|
26
|
+
contentProps: Partial<AccessibilityProps> & Record<string, unknown>;
|
|
27
|
+
/** Factory for menu item props */
|
|
28
|
+
getItemProps(item: MenuItemProps): Partial<AccessibilityProps> & Record<string, unknown>;
|
|
29
|
+
/** Open the menu */
|
|
30
|
+
open(): void;
|
|
31
|
+
/** Close the menu */
|
|
32
|
+
close(): void;
|
|
33
|
+
/** Toggle the menu */
|
|
34
|
+
toggle(): void;
|
|
35
|
+
/** Keyboard handlers for the menu */
|
|
36
|
+
keyboardHandlers: KeyboardHandlerMap;
|
|
37
|
+
/** Generated IDs for aria linking */
|
|
38
|
+
ids: {
|
|
39
|
+
content: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
declare function createDropdownMenu(props?: DropdownMenuProps): DropdownMenuAPI;
|
|
43
|
+
|
|
44
|
+
declare const menuContentVariants: (props?: ({
|
|
45
|
+
[x: string]: string | undefined;
|
|
46
|
+
} & {
|
|
47
|
+
className?: string;
|
|
48
|
+
}) | undefined) => string;
|
|
49
|
+
declare const menuItemVariants: (props?: ({
|
|
50
|
+
[x: string]: string | undefined;
|
|
51
|
+
} & {
|
|
52
|
+
className?: string;
|
|
53
|
+
}) | undefined) => string;
|
|
54
|
+
|
|
55
|
+
export { type DropdownMenuAPI, type DropdownMenuProps, type DropdownMenuState, type MenuItemProps, createDropdownMenu, menuContentVariants, menuItemVariants };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { AccessibilityProps, KeyboardHandlerMap } from '../shared/index.js';
|
|
2
|
+
|
|
3
|
+
interface DropdownMenuProps {
|
|
4
|
+
/** Whether the menu is open (controlled) */
|
|
5
|
+
open?: boolean;
|
|
6
|
+
/** Whether the menu starts open (uncontrolled) */
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
/** Callback when open state changes */
|
|
9
|
+
onOpenChange?: (open: boolean) => void;
|
|
10
|
+
}
|
|
11
|
+
interface MenuItemProps {
|
|
12
|
+
/** Whether the item is disabled */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Callback when the item is selected */
|
|
15
|
+
onSelect?: () => void;
|
|
16
|
+
}
|
|
17
|
+
interface DropdownMenuState {
|
|
18
|
+
open: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface DropdownMenuAPI {
|
|
21
|
+
/** Current menu state */
|
|
22
|
+
state: DropdownMenuState;
|
|
23
|
+
/** ARIA attributes for the trigger button */
|
|
24
|
+
triggerProps: Partial<AccessibilityProps> & Record<string, unknown>;
|
|
25
|
+
/** ARIA attributes for the menu content */
|
|
26
|
+
contentProps: Partial<AccessibilityProps> & Record<string, unknown>;
|
|
27
|
+
/** Factory for menu item props */
|
|
28
|
+
getItemProps(item: MenuItemProps): Partial<AccessibilityProps> & Record<string, unknown>;
|
|
29
|
+
/** Open the menu */
|
|
30
|
+
open(): void;
|
|
31
|
+
/** Close the menu */
|
|
32
|
+
close(): void;
|
|
33
|
+
/** Toggle the menu */
|
|
34
|
+
toggle(): void;
|
|
35
|
+
/** Keyboard handlers for the menu */
|
|
36
|
+
keyboardHandlers: KeyboardHandlerMap;
|
|
37
|
+
/** Generated IDs for aria linking */
|
|
38
|
+
ids: {
|
|
39
|
+
content: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
declare function createDropdownMenu(props?: DropdownMenuProps): DropdownMenuAPI;
|
|
43
|
+
|
|
44
|
+
declare const menuContentVariants: (props?: ({
|
|
45
|
+
[x: string]: string | undefined;
|
|
46
|
+
} & {
|
|
47
|
+
className?: string;
|
|
48
|
+
}) | undefined) => string;
|
|
49
|
+
declare const menuItemVariants: (props?: ({
|
|
50
|
+
[x: string]: string | undefined;
|
|
51
|
+
} & {
|
|
52
|
+
className?: string;
|
|
53
|
+
}) | undefined) => string;
|
|
54
|
+
|
|
55
|
+
export { type DropdownMenuAPI, type DropdownMenuProps, type DropdownMenuState, type MenuItemProps, createDropdownMenu, menuContentVariants, menuItemVariants };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { AccessibilityProps } from '../shared/index.cjs';
|
|
2
|
+
|
|
3
|
+
type EmojiCategory = 'smileys' | 'people' | 'nature' | 'food' | 'travel' | 'activities' | 'objects' | 'symbols' | 'flags';
|
|
4
|
+
interface EmojiEntry {
|
|
5
|
+
emoji: string;
|
|
6
|
+
name: string;
|
|
7
|
+
category: EmojiCategory;
|
|
8
|
+
keywords: string[];
|
|
9
|
+
}
|
|
10
|
+
declare const EMOJI_DATA: Record<EmojiCategory, EmojiEntry[]>;
|
|
11
|
+
/** All categories in display order */
|
|
12
|
+
declare const EMOJI_CATEGORIES: EmojiCategory[];
|
|
13
|
+
/** Category display labels */
|
|
14
|
+
declare const CATEGORY_LABELS: Record<EmojiCategory, string>;
|
|
15
|
+
/** Get all emojis as a flat array */
|
|
16
|
+
declare function getAllEmojis(): EmojiEntry[];
|
|
17
|
+
|
|
18
|
+
interface EmojiPickerProps {
|
|
19
|
+
/** Callback when an emoji is selected */
|
|
20
|
+
onSelect?: (emoji: EmojiEntry) => void;
|
|
21
|
+
/** Initial search query */
|
|
22
|
+
search?: string;
|
|
23
|
+
/** List of recently used emojis */
|
|
24
|
+
recentEmojis?: EmojiEntry[];
|
|
25
|
+
/** Maximum recent emojis to show */
|
|
26
|
+
maxRecent?: number;
|
|
27
|
+
}
|
|
28
|
+
interface EmojiPickerState {
|
|
29
|
+
search: string;
|
|
30
|
+
activeCategory: EmojiCategory;
|
|
31
|
+
filteredEmojis: EmojiEntry[];
|
|
32
|
+
recentEmojis: EmojiEntry[];
|
|
33
|
+
}
|
|
34
|
+
interface EmojiPickerAPI {
|
|
35
|
+
/** Current state */
|
|
36
|
+
state: EmojiPickerState;
|
|
37
|
+
/** Set search query */
|
|
38
|
+
setSearch(query: string): void;
|
|
39
|
+
/** Select an emoji */
|
|
40
|
+
select(emoji: EmojiEntry): void;
|
|
41
|
+
/** Set active category tab */
|
|
42
|
+
setCategory(category: EmojiCategory): void;
|
|
43
|
+
/** Category tabs with labels */
|
|
44
|
+
categoryTabs: {
|
|
45
|
+
category: EmojiCategory;
|
|
46
|
+
label: string;
|
|
47
|
+
emoji: string;
|
|
48
|
+
}[];
|
|
49
|
+
/** ARIA props for the picker container */
|
|
50
|
+
ariaProps: Partial<AccessibilityProps> & Record<string, unknown>;
|
|
51
|
+
/** ARIA props for the search input */
|
|
52
|
+
searchInputProps: Record<string, unknown>;
|
|
53
|
+
/** Get ARIA props for an emoji button */
|
|
54
|
+
getEmojiAriaProps(emoji: EmojiEntry): Record<string, unknown>;
|
|
55
|
+
/** Generated IDs */
|
|
56
|
+
ids: {
|
|
57
|
+
container: string;
|
|
58
|
+
search: string;
|
|
59
|
+
grid: string;
|
|
60
|
+
label: string;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
declare function createEmojiPicker(props?: EmojiPickerProps): EmojiPickerAPI;
|
|
64
|
+
|
|
65
|
+
declare const emojiPickerContainerStyles = "w-80 rounded-lg border bg-popover text-popover-foreground shadow-md";
|
|
66
|
+
declare const emojiPickerSearchStyles = "w-full border-b px-3 py-2 text-sm bg-transparent outline-none placeholder:text-muted-foreground";
|
|
67
|
+
declare const emojiPickerCategoryBarStyles = "flex border-b px-1";
|
|
68
|
+
declare const emojiPickerCategoryTabVariants: (props?: ({
|
|
69
|
+
state?: "active" | "inactive" | undefined;
|
|
70
|
+
} & {
|
|
71
|
+
className?: string;
|
|
72
|
+
}) | undefined) => string;
|
|
73
|
+
declare const emojiPickerGridStyles = "grid grid-cols-8 gap-0.5 p-2 max-h-64 overflow-y-auto";
|
|
74
|
+
declare const emojiPickerEmojiButtonStyles = "flex items-center justify-center h-8 w-8 rounded cursor-pointer text-lg hover:bg-accent transition-colors";
|
|
75
|
+
declare const emojiPickerSectionLabelStyles = "px-2 py-1 text-xs font-medium text-muted-foreground";
|
|
76
|
+
|
|
77
|
+
export { CATEGORY_LABELS, EMOJI_CATEGORIES, EMOJI_DATA, type EmojiCategory, type EmojiEntry, type EmojiPickerAPI, type EmojiPickerProps, type EmojiPickerState, createEmojiPicker, emojiPickerCategoryBarStyles, emojiPickerCategoryTabVariants, emojiPickerContainerStyles, emojiPickerEmojiButtonStyles, emojiPickerGridStyles, emojiPickerSearchStyles, emojiPickerSectionLabelStyles, getAllEmojis };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { AccessibilityProps } from '../shared/index.js';
|
|
2
|
+
|
|
3
|
+
type EmojiCategory = 'smileys' | 'people' | 'nature' | 'food' | 'travel' | 'activities' | 'objects' | 'symbols' | 'flags';
|
|
4
|
+
interface EmojiEntry {
|
|
5
|
+
emoji: string;
|
|
6
|
+
name: string;
|
|
7
|
+
category: EmojiCategory;
|
|
8
|
+
keywords: string[];
|
|
9
|
+
}
|
|
10
|
+
declare const EMOJI_DATA: Record<EmojiCategory, EmojiEntry[]>;
|
|
11
|
+
/** All categories in display order */
|
|
12
|
+
declare const EMOJI_CATEGORIES: EmojiCategory[];
|
|
13
|
+
/** Category display labels */
|
|
14
|
+
declare const CATEGORY_LABELS: Record<EmojiCategory, string>;
|
|
15
|
+
/** Get all emojis as a flat array */
|
|
16
|
+
declare function getAllEmojis(): EmojiEntry[];
|
|
17
|
+
|
|
18
|
+
interface EmojiPickerProps {
|
|
19
|
+
/** Callback when an emoji is selected */
|
|
20
|
+
onSelect?: (emoji: EmojiEntry) => void;
|
|
21
|
+
/** Initial search query */
|
|
22
|
+
search?: string;
|
|
23
|
+
/** List of recently used emojis */
|
|
24
|
+
recentEmojis?: EmojiEntry[];
|
|
25
|
+
/** Maximum recent emojis to show */
|
|
26
|
+
maxRecent?: number;
|
|
27
|
+
}
|
|
28
|
+
interface EmojiPickerState {
|
|
29
|
+
search: string;
|
|
30
|
+
activeCategory: EmojiCategory;
|
|
31
|
+
filteredEmojis: EmojiEntry[];
|
|
32
|
+
recentEmojis: EmojiEntry[];
|
|
33
|
+
}
|
|
34
|
+
interface EmojiPickerAPI {
|
|
35
|
+
/** Current state */
|
|
36
|
+
state: EmojiPickerState;
|
|
37
|
+
/** Set search query */
|
|
38
|
+
setSearch(query: string): void;
|
|
39
|
+
/** Select an emoji */
|
|
40
|
+
select(emoji: EmojiEntry): void;
|
|
41
|
+
/** Set active category tab */
|
|
42
|
+
setCategory(category: EmojiCategory): void;
|
|
43
|
+
/** Category tabs with labels */
|
|
44
|
+
categoryTabs: {
|
|
45
|
+
category: EmojiCategory;
|
|
46
|
+
label: string;
|
|
47
|
+
emoji: string;
|
|
48
|
+
}[];
|
|
49
|
+
/** ARIA props for the picker container */
|
|
50
|
+
ariaProps: Partial<AccessibilityProps> & Record<string, unknown>;
|
|
51
|
+
/** ARIA props for the search input */
|
|
52
|
+
searchInputProps: Record<string, unknown>;
|
|
53
|
+
/** Get ARIA props for an emoji button */
|
|
54
|
+
getEmojiAriaProps(emoji: EmojiEntry): Record<string, unknown>;
|
|
55
|
+
/** Generated IDs */
|
|
56
|
+
ids: {
|
|
57
|
+
container: string;
|
|
58
|
+
search: string;
|
|
59
|
+
grid: string;
|
|
60
|
+
label: string;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
declare function createEmojiPicker(props?: EmojiPickerProps): EmojiPickerAPI;
|
|
64
|
+
|
|
65
|
+
declare const emojiPickerContainerStyles = "w-80 rounded-lg border bg-popover text-popover-foreground shadow-md";
|
|
66
|
+
declare const emojiPickerSearchStyles = "w-full border-b px-3 py-2 text-sm bg-transparent outline-none placeholder:text-muted-foreground";
|
|
67
|
+
declare const emojiPickerCategoryBarStyles = "flex border-b px-1";
|
|
68
|
+
declare const emojiPickerCategoryTabVariants: (props?: ({
|
|
69
|
+
state?: "active" | "inactive" | undefined;
|
|
70
|
+
} & {
|
|
71
|
+
className?: string;
|
|
72
|
+
}) | undefined) => string;
|
|
73
|
+
declare const emojiPickerGridStyles = "grid grid-cols-8 gap-0.5 p-2 max-h-64 overflow-y-auto";
|
|
74
|
+
declare const emojiPickerEmojiButtonStyles = "flex items-center justify-center h-8 w-8 rounded cursor-pointer text-lg hover:bg-accent transition-colors";
|
|
75
|
+
declare const emojiPickerSectionLabelStyles = "px-2 py-1 text-xs font-medium text-muted-foreground";
|
|
76
|
+
|
|
77
|
+
export { CATEGORY_LABELS, EMOJI_CATEGORIES, EMOJI_DATA, type EmojiCategory, type EmojiEntry, type EmojiPickerAPI, type EmojiPickerProps, type EmojiPickerState, createEmojiPicker, emojiPickerCategoryBarStyles, emojiPickerCategoryTabVariants, emojiPickerContainerStyles, emojiPickerEmojiButtonStyles, emojiPickerGridStyles, emojiPickerSearchStyles, emojiPickerSectionLabelStyles, getAllEmojis };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { AccessibilityProps } from '../shared/index.cjs';
|
|
2
|
+
import { DialogAPI } from '../dialog/index.cjs';
|
|
3
|
+
|
|
4
|
+
type FeedbackType = 'text' | 'video' | 'general';
|
|
5
|
+
interface FeedbackDialogProps {
|
|
6
|
+
/** Whether the dialog is open (controlled) */
|
|
7
|
+
open?: boolean;
|
|
8
|
+
/** Callback when open state changes */
|
|
9
|
+
onOpenChange?: (open: boolean) => void;
|
|
10
|
+
/** Callback when feedback is submitted */
|
|
11
|
+
onSubmit?: (data: FeedbackData) => void | Promise<void>;
|
|
12
|
+
/** Feedback type */
|
|
13
|
+
type?: FeedbackType;
|
|
14
|
+
}
|
|
15
|
+
interface FeedbackData {
|
|
16
|
+
comment: string;
|
|
17
|
+
email?: string;
|
|
18
|
+
type: FeedbackType;
|
|
19
|
+
selectedText?: string;
|
|
20
|
+
}
|
|
21
|
+
interface FeedbackFormState {
|
|
22
|
+
comment: string;
|
|
23
|
+
email: string;
|
|
24
|
+
honeypot: string;
|
|
25
|
+
}
|
|
26
|
+
interface FeedbackDialogState {
|
|
27
|
+
open: boolean;
|
|
28
|
+
isSubmitting: boolean;
|
|
29
|
+
isSubmitted: boolean;
|
|
30
|
+
}
|
|
31
|
+
interface FeedbackDialogAPI {
|
|
32
|
+
/** Current state */
|
|
33
|
+
state: FeedbackDialogState;
|
|
34
|
+
/** Dialog props from the underlying createDialog */
|
|
35
|
+
dialogProps: DialogAPI;
|
|
36
|
+
/** Form field values */
|
|
37
|
+
formState: FeedbackFormState;
|
|
38
|
+
/** Set a form field value */
|
|
39
|
+
setField(field: keyof FeedbackFormState, value: string): void;
|
|
40
|
+
/** Submit the feedback form */
|
|
41
|
+
submit(): Promise<void>;
|
|
42
|
+
/** Reset form to initial state */
|
|
43
|
+
reset(): void;
|
|
44
|
+
/** ARIA props for the feedback dialog */
|
|
45
|
+
ariaProps: Partial<AccessibilityProps> & Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
declare function createFeedbackDialog(props?: FeedbackDialogProps): FeedbackDialogAPI;
|
|
48
|
+
|
|
49
|
+
declare const feedbackDialogVariants: (props?: ({
|
|
50
|
+
type?: "text" | "video" | "general" | undefined;
|
|
51
|
+
} & {
|
|
52
|
+
className?: string;
|
|
53
|
+
}) | undefined) => string;
|
|
54
|
+
|
|
55
|
+
export { type FeedbackData, type FeedbackDialogAPI, type FeedbackDialogProps, type FeedbackDialogState, type FeedbackFormState, type FeedbackType, createFeedbackDialog, feedbackDialogVariants };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { AccessibilityProps } from '../shared/index.js';
|
|
2
|
+
import { DialogAPI } from '../dialog/index.js';
|
|
3
|
+
|
|
4
|
+
type FeedbackType = 'text' | 'video' | 'general';
|
|
5
|
+
interface FeedbackDialogProps {
|
|
6
|
+
/** Whether the dialog is open (controlled) */
|
|
7
|
+
open?: boolean;
|
|
8
|
+
/** Callback when open state changes */
|
|
9
|
+
onOpenChange?: (open: boolean) => void;
|
|
10
|
+
/** Callback when feedback is submitted */
|
|
11
|
+
onSubmit?: (data: FeedbackData) => void | Promise<void>;
|
|
12
|
+
/** Feedback type */
|
|
13
|
+
type?: FeedbackType;
|
|
14
|
+
}
|
|
15
|
+
interface FeedbackData {
|
|
16
|
+
comment: string;
|
|
17
|
+
email?: string;
|
|
18
|
+
type: FeedbackType;
|
|
19
|
+
selectedText?: string;
|
|
20
|
+
}
|
|
21
|
+
interface FeedbackFormState {
|
|
22
|
+
comment: string;
|
|
23
|
+
email: string;
|
|
24
|
+
honeypot: string;
|
|
25
|
+
}
|
|
26
|
+
interface FeedbackDialogState {
|
|
27
|
+
open: boolean;
|
|
28
|
+
isSubmitting: boolean;
|
|
29
|
+
isSubmitted: boolean;
|
|
30
|
+
}
|
|
31
|
+
interface FeedbackDialogAPI {
|
|
32
|
+
/** Current state */
|
|
33
|
+
state: FeedbackDialogState;
|
|
34
|
+
/** Dialog props from the underlying createDialog */
|
|
35
|
+
dialogProps: DialogAPI;
|
|
36
|
+
/** Form field values */
|
|
37
|
+
formState: FeedbackFormState;
|
|
38
|
+
/** Set a form field value */
|
|
39
|
+
setField(field: keyof FeedbackFormState, value: string): void;
|
|
40
|
+
/** Submit the feedback form */
|
|
41
|
+
submit(): Promise<void>;
|
|
42
|
+
/** Reset form to initial state */
|
|
43
|
+
reset(): void;
|
|
44
|
+
/** ARIA props for the feedback dialog */
|
|
45
|
+
ariaProps: Partial<AccessibilityProps> & Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
declare function createFeedbackDialog(props?: FeedbackDialogProps): FeedbackDialogAPI;
|
|
48
|
+
|
|
49
|
+
declare const feedbackDialogVariants: (props?: ({
|
|
50
|
+
type?: "text" | "video" | "general" | undefined;
|
|
51
|
+
} & {
|
|
52
|
+
className?: string;
|
|
53
|
+
}) | undefined) => string;
|
|
54
|
+
|
|
55
|
+
export { type FeedbackData, type FeedbackDialogAPI, type FeedbackDialogProps, type FeedbackDialogState, type FeedbackFormState, type FeedbackType, createFeedbackDialog, feedbackDialogVariants };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { AccessibilityProps } from '../shared/index.cjs';
|
|
2
|
+
|
|
3
|
+
type FileStatus = 'pending' | 'uploading' | 'complete' | 'error';
|
|
4
|
+
interface FileEntry {
|
|
5
|
+
/** Unique ID for this file entry */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Original file name */
|
|
8
|
+
name: string;
|
|
9
|
+
/** File size in bytes */
|
|
10
|
+
size: number;
|
|
11
|
+
/** MIME type */
|
|
12
|
+
type: string;
|
|
13
|
+
/** Upload progress 0-100 */
|
|
14
|
+
progress: number;
|
|
15
|
+
/** Current status */
|
|
16
|
+
status: FileStatus;
|
|
17
|
+
/** Error message if status is 'error' */
|
|
18
|
+
error?: string;
|
|
19
|
+
}
|
|
20
|
+
interface FileUploadProps {
|
|
21
|
+
/** Accepted file types (e.g., 'image/*,.pdf') */
|
|
22
|
+
accept?: string;
|
|
23
|
+
/** Max file size in bytes */
|
|
24
|
+
maxSize?: number;
|
|
25
|
+
/** Max number of files */
|
|
26
|
+
maxFiles?: number;
|
|
27
|
+
/** Allow multiple file selection */
|
|
28
|
+
multiple?: boolean;
|
|
29
|
+
/** Callback when files are selected/added */
|
|
30
|
+
onFilesSelected?: (files: FileEntry[]) => void;
|
|
31
|
+
/** Callback when a validation error occurs */
|
|
32
|
+
onError?: (errors: FileUploadError[]) => void;
|
|
33
|
+
}
|
|
34
|
+
interface FileUploadError {
|
|
35
|
+
file: string;
|
|
36
|
+
code: 'type' | 'size' | 'count';
|
|
37
|
+
message: string;
|
|
38
|
+
}
|
|
39
|
+
interface FileUploadState {
|
|
40
|
+
files: FileEntry[];
|
|
41
|
+
isDragging: boolean;
|
|
42
|
+
}
|
|
43
|
+
interface FileUploadAPI {
|
|
44
|
+
/** Current state */
|
|
45
|
+
state: FileUploadState;
|
|
46
|
+
/** Add files (validates type, size, count) */
|
|
47
|
+
addFiles(files: Array<{
|
|
48
|
+
name: string;
|
|
49
|
+
size: number;
|
|
50
|
+
type: string;
|
|
51
|
+
}>): void;
|
|
52
|
+
/** Remove a file by ID */
|
|
53
|
+
removeFile(id: string): void;
|
|
54
|
+
/** Update a file's progress */
|
|
55
|
+
updateProgress(id: string, progress: number): void;
|
|
56
|
+
/** Set a file's status */
|
|
57
|
+
setStatus(id: string, status: FileStatus, error?: string): void;
|
|
58
|
+
/** ARIA props for the drop zone */
|
|
59
|
+
dropZoneProps: Partial<AccessibilityProps> & Record<string, unknown>;
|
|
60
|
+
/** ARIA props for the file input */
|
|
61
|
+
inputProps: Record<string, unknown>;
|
|
62
|
+
/** Drag event handlers (for headless use) */
|
|
63
|
+
dragHandlers: {
|
|
64
|
+
onDragEnter(): void;
|
|
65
|
+
onDragLeave(): void;
|
|
66
|
+
onDragOver(): void;
|
|
67
|
+
onDrop(): void;
|
|
68
|
+
};
|
|
69
|
+
/** Generated IDs */
|
|
70
|
+
ids: {
|
|
71
|
+
dropZone: string;
|
|
72
|
+
input: string;
|
|
73
|
+
label: string;
|
|
74
|
+
fileList: string;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
declare function formatFileSize(bytes: number): string;
|
|
78
|
+
declare function createFileUpload(props?: FileUploadProps): FileUploadAPI;
|
|
79
|
+
|
|
80
|
+
declare const fileUploadDropZoneVariants: (props?: ({
|
|
81
|
+
state?: "idle" | "dragging" | "disabled" | undefined;
|
|
82
|
+
} & {
|
|
83
|
+
className?: string;
|
|
84
|
+
}) | undefined) => string;
|
|
85
|
+
declare const fileUploadFileListStyles = "mt-4 space-y-2";
|
|
86
|
+
declare const fileUploadFileItemStyles = "flex items-center gap-3 rounded-md border p-3 text-sm";
|
|
87
|
+
declare const fileUploadProgressStyles = "h-1.5 w-full rounded-full bg-secondary overflow-hidden";
|
|
88
|
+
declare const fileUploadProgressBarStyles = "h-full rounded-full bg-primary transition-all duration-300";
|
|
89
|
+
declare const fileUploadRemoveButtonStyles = "ml-auto text-muted-foreground hover:text-foreground cursor-pointer";
|
|
90
|
+
|
|
91
|
+
export { type FileEntry, type FileStatus, type FileUploadAPI, type FileUploadError, type FileUploadProps, type FileUploadState, createFileUpload, fileUploadDropZoneVariants, fileUploadFileItemStyles, fileUploadFileListStyles, fileUploadProgressBarStyles, fileUploadProgressStyles, fileUploadRemoveButtonStyles, formatFileSize };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { AccessibilityProps } from '../shared/index.js';
|
|
2
|
+
|
|
3
|
+
type FileStatus = 'pending' | 'uploading' | 'complete' | 'error';
|
|
4
|
+
interface FileEntry {
|
|
5
|
+
/** Unique ID for this file entry */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Original file name */
|
|
8
|
+
name: string;
|
|
9
|
+
/** File size in bytes */
|
|
10
|
+
size: number;
|
|
11
|
+
/** MIME type */
|
|
12
|
+
type: string;
|
|
13
|
+
/** Upload progress 0-100 */
|
|
14
|
+
progress: number;
|
|
15
|
+
/** Current status */
|
|
16
|
+
status: FileStatus;
|
|
17
|
+
/** Error message if status is 'error' */
|
|
18
|
+
error?: string;
|
|
19
|
+
}
|
|
20
|
+
interface FileUploadProps {
|
|
21
|
+
/** Accepted file types (e.g., 'image/*,.pdf') */
|
|
22
|
+
accept?: string;
|
|
23
|
+
/** Max file size in bytes */
|
|
24
|
+
maxSize?: number;
|
|
25
|
+
/** Max number of files */
|
|
26
|
+
maxFiles?: number;
|
|
27
|
+
/** Allow multiple file selection */
|
|
28
|
+
multiple?: boolean;
|
|
29
|
+
/** Callback when files are selected/added */
|
|
30
|
+
onFilesSelected?: (files: FileEntry[]) => void;
|
|
31
|
+
/** Callback when a validation error occurs */
|
|
32
|
+
onError?: (errors: FileUploadError[]) => void;
|
|
33
|
+
}
|
|
34
|
+
interface FileUploadError {
|
|
35
|
+
file: string;
|
|
36
|
+
code: 'type' | 'size' | 'count';
|
|
37
|
+
message: string;
|
|
38
|
+
}
|
|
39
|
+
interface FileUploadState {
|
|
40
|
+
files: FileEntry[];
|
|
41
|
+
isDragging: boolean;
|
|
42
|
+
}
|
|
43
|
+
interface FileUploadAPI {
|
|
44
|
+
/** Current state */
|
|
45
|
+
state: FileUploadState;
|
|
46
|
+
/** Add files (validates type, size, count) */
|
|
47
|
+
addFiles(files: Array<{
|
|
48
|
+
name: string;
|
|
49
|
+
size: number;
|
|
50
|
+
type: string;
|
|
51
|
+
}>): void;
|
|
52
|
+
/** Remove a file by ID */
|
|
53
|
+
removeFile(id: string): void;
|
|
54
|
+
/** Update a file's progress */
|
|
55
|
+
updateProgress(id: string, progress: number): void;
|
|
56
|
+
/** Set a file's status */
|
|
57
|
+
setStatus(id: string, status: FileStatus, error?: string): void;
|
|
58
|
+
/** ARIA props for the drop zone */
|
|
59
|
+
dropZoneProps: Partial<AccessibilityProps> & Record<string, unknown>;
|
|
60
|
+
/** ARIA props for the file input */
|
|
61
|
+
inputProps: Record<string, unknown>;
|
|
62
|
+
/** Drag event handlers (for headless use) */
|
|
63
|
+
dragHandlers: {
|
|
64
|
+
onDragEnter(): void;
|
|
65
|
+
onDragLeave(): void;
|
|
66
|
+
onDragOver(): void;
|
|
67
|
+
onDrop(): void;
|
|
68
|
+
};
|
|
69
|
+
/** Generated IDs */
|
|
70
|
+
ids: {
|
|
71
|
+
dropZone: string;
|
|
72
|
+
input: string;
|
|
73
|
+
label: string;
|
|
74
|
+
fileList: string;
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
declare function formatFileSize(bytes: number): string;
|
|
78
|
+
declare function createFileUpload(props?: FileUploadProps): FileUploadAPI;
|
|
79
|
+
|
|
80
|
+
declare const fileUploadDropZoneVariants: (props?: ({
|
|
81
|
+
state?: "idle" | "dragging" | "disabled" | undefined;
|
|
82
|
+
} & {
|
|
83
|
+
className?: string;
|
|
84
|
+
}) | undefined) => string;
|
|
85
|
+
declare const fileUploadFileListStyles = "mt-4 space-y-2";
|
|
86
|
+
declare const fileUploadFileItemStyles = "flex items-center gap-3 rounded-md border p-3 text-sm";
|
|
87
|
+
declare const fileUploadProgressStyles = "h-1.5 w-full rounded-full bg-secondary overflow-hidden";
|
|
88
|
+
declare const fileUploadProgressBarStyles = "h-full rounded-full bg-primary transition-all duration-300";
|
|
89
|
+
declare const fileUploadRemoveButtonStyles = "ml-auto text-muted-foreground hover:text-foreground cursor-pointer";
|
|
90
|
+
|
|
91
|
+
export { type FileEntry, type FileStatus, type FileUploadAPI, type FileUploadError, type FileUploadProps, type FileUploadState, createFileUpload, fileUploadDropZoneVariants, fileUploadFileItemStyles, fileUploadFileListStyles, fileUploadProgressBarStyles, fileUploadProgressStyles, fileUploadRemoveButtonStyles, formatFileSize };
|