@seed-design/lynx-react 0.7.1 → 0.9.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/lib/components/Accordion/Accordion.jsx +2 -2
- package/lib/components/ActionButton/ActionButton.jsx +1 -1
- package/lib/components/AlertDialog/AlertDialog.d.ts +64 -0
- package/lib/components/AlertDialog/AlertDialog.d.ts.map +1 -0
- package/lib/components/AlertDialog/AlertDialog.jsx +138 -0
- package/lib/components/AlertDialog/AlertDialog.namespace.d.ts +2 -0
- package/lib/components/AlertDialog/AlertDialog.namespace.d.ts.map +1 -0
- package/lib/components/AlertDialog/AlertDialog.namespace.js +17 -0
- package/lib/components/AlertDialog/index.d.ts +3 -0
- package/lib/components/AlertDialog/index.d.ts.map +1 -0
- package/lib/components/AppBar/AppBar.d.ts +14 -1
- package/lib/components/AppBar/AppBar.d.ts.map +1 -1
- package/lib/components/AppBar/AppBar.jsx +42 -16
- package/lib/components/AppBar/AppBar.namespace.d.ts +1 -1
- package/lib/components/AppBar/AppBar.namespace.d.ts.map +1 -1
- package/lib/components/AppBar/context.d.ts +2 -1
- package/lib/components/AppBar/context.d.ts.map +1 -1
- package/lib/components/AppBar/index.d.ts +1 -1
- package/lib/components/AppBar/index.d.ts.map +1 -1
- package/lib/components/AppBar/useAppBar.d.ts +2 -1
- package/lib/components/AppBar/useAppBar.d.ts.map +1 -1
- package/lib/components/AppBar/useAppBar.js +17 -15
- package/lib/components/AttachmentDisplay/AttachmentDisplay.d.ts +182 -0
- package/lib/components/AttachmentDisplay/AttachmentDisplay.d.ts.map +1 -0
- package/lib/components/AttachmentDisplay/AttachmentDisplay.jsx +444 -0
- package/lib/components/AttachmentDisplay/index.d.ts +2 -0
- package/lib/components/AttachmentDisplay/index.d.ts.map +1 -0
- package/lib/components/AttachmentInput/AttachmentInput.d.ts +179 -0
- package/lib/components/AttachmentInput/AttachmentInput.d.ts.map +1 -0
- package/lib/components/AttachmentInput/AttachmentInput.jsx +520 -0
- package/lib/components/AttachmentInput/index.d.ts +2 -0
- package/lib/components/AttachmentInput/index.d.ts.map +1 -0
- package/lib/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/lib/components/BottomSheet/BottomSheet.jsx +1 -7
- package/lib/components/Box/Box.d.ts +3 -3
- package/lib/components/Box/Box.d.ts.map +1 -1
- package/lib/components/Callout/Callout.jsx +2 -2
- package/lib/components/Checkbox/Checkbox.jsx +2 -2
- package/lib/components/Chip/Chip.jsx +2 -2
- package/lib/components/ChipTabs/ChipTabs.d.ts +41 -0
- package/lib/components/ChipTabs/ChipTabs.d.ts.map +1 -0
- package/lib/components/ChipTabs/ChipTabs.jsx +39 -0
- package/lib/components/ChipTabs/ChipTabs.namespace.d.ts +2 -0
- package/lib/components/ChipTabs/ChipTabs.namespace.d.ts.map +1 -0
- package/lib/components/ChipTabs/ChipTabs.namespace.js +13 -0
- package/lib/components/ChipTabs/index.d.ts +3 -0
- package/lib/components/ChipTabs/index.d.ts.map +1 -0
- package/lib/components/ContextualFloatingButton/ContextualFloatingButton.d.ts +18 -0
- package/lib/components/ContextualFloatingButton/ContextualFloatingButton.d.ts.map +1 -0
- package/lib/components/ContextualFloatingButton/ContextualFloatingButton.jsx +113 -0
- package/lib/components/ContextualFloatingButton/index.d.ts +2 -0
- package/lib/components/ContextualFloatingButton/index.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.d.ts +87 -0
- package/lib/components/Dialog/Dialog.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.jsx +147 -0
- package/lib/components/Dialog/Dialog.namespace.d.ts +2 -0
- package/lib/components/Dialog/Dialog.namespace.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.namespace.js +18 -0
- package/lib/components/Dialog/index.d.ts +3 -0
- package/lib/components/Dialog/index.d.ts.map +1 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.d.ts +23 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.d.ts.map +1 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.jsx +76 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.namespace.d.ts +2 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.namespace.d.ts.map +1 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.namespace.js +10 -0
- package/lib/components/FloatingActionButton/index.d.ts +3 -0
- package/lib/components/FloatingActionButton/index.d.ts.map +1 -0
- package/lib/components/HelpBubble/HelpBubble.d.ts +67 -0
- package/lib/components/HelpBubble/HelpBubble.d.ts.map +1 -0
- package/lib/components/HelpBubble/HelpBubble.jsx +600 -0
- package/lib/components/HelpBubble/HelpBubble.namespace.d.ts +2 -0
- package/lib/components/HelpBubble/HelpBubble.namespace.d.ts.map +1 -0
- package/lib/components/HelpBubble/HelpBubble.namespace.js +18 -0
- package/lib/components/HelpBubble/index.d.ts +3 -0
- package/lib/components/HelpBubble/index.d.ts.map +1 -0
- package/lib/components/Icon/Icon.d.ts +1 -0
- package/lib/components/Icon/Icon.d.ts.map +1 -1
- package/lib/components/Icon/Icon.jsx +2 -1
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.d.ts +28 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.d.ts.map +1 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.jsx +37 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.d.ts +2 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.d.ts.map +1 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.js +9 -0
- package/lib/components/IdentityPlaceholder/identity-placeholder-business.js +4 -0
- package/lib/components/IdentityPlaceholder/identity-placeholder-person.js +4 -0
- package/lib/components/IdentityPlaceholder/index.d.ts +3 -0
- package/lib/components/IdentityPlaceholder/index.d.ts.map +1 -0
- package/lib/components/InputButton/InputButton.d.ts +2 -0
- package/lib/components/InputButton/InputButton.d.ts.map +1 -1
- package/lib/components/InputButton/InputButton.jsx +40 -8
- package/lib/components/List/List.d.ts +1 -1
- package/lib/components/List/List.d.ts.map +1 -1
- package/lib/components/List/List.jsx +26 -12
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.jsx +15 -5
- package/lib/components/PageBanner/PageBanner.d.ts +3 -0
- package/lib/components/PageBanner/PageBanner.d.ts.map +1 -1
- package/lib/components/PageBanner/PageBanner.jsx +49 -11
- package/lib/components/QuantityPicker/QuantityPicker.d.ts +53 -0
- package/lib/components/QuantityPicker/QuantityPicker.d.ts.map +1 -0
- package/lib/components/QuantityPicker/QuantityPicker.jsx +282 -0
- package/lib/components/QuantityPicker/QuantityPicker.namespace.d.ts +2 -0
- package/lib/components/QuantityPicker/QuantityPicker.namespace.d.ts.map +1 -0
- package/lib/components/QuantityPicker/QuantityPicker.namespace.js +11 -0
- package/lib/components/QuantityPicker/index.d.ts +3 -0
- package/lib/components/QuantityPicker/index.d.ts.map +1 -0
- package/lib/components/RadioGroup/RadioGroup.jsx +2 -2
- package/lib/components/ReactionButton/ReactionButton.d.ts +1 -1
- package/lib/components/ReactionButton/ReactionButton.d.ts.map +1 -1
- package/lib/components/ReactionButton/ReactionButton.jsx +22 -13
- package/lib/components/ScrollFog/ScrollFog.d.ts +41 -0
- package/lib/components/ScrollFog/ScrollFog.d.ts.map +1 -0
- package/lib/components/ScrollFog/ScrollFog.jsx +65 -0
- package/lib/components/ScrollFog/index.d.ts +2 -0
- package/lib/components/ScrollFog/index.d.ts.map +1 -0
- package/lib/components/SegmentedControl/SegmentedControl.jsx +2 -2
- package/lib/components/Select/Select.d.ts +112 -0
- package/lib/components/Select/Select.d.ts.map +1 -0
- package/lib/components/Select/Select.jsx +885 -0
- package/lib/components/Select/Select.namespace.d.ts +2 -0
- package/lib/components/Select/Select.namespace.d.ts.map +1 -0
- package/lib/components/Select/Select.namespace.js +23 -0
- package/lib/components/Select/index.d.ts +3 -0
- package/lib/components/Select/index.d.ts.map +1 -0
- package/lib/components/Skeleton/Skeleton.d.ts +15 -0
- package/lib/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/lib/components/Skeleton/Skeleton.jsx +18 -0
- package/lib/components/Skeleton/index.d.ts +2 -0
- package/lib/components/Skeleton/index.d.ts.map +1 -0
- package/lib/components/Slider/Slider.d.ts +101 -0
- package/lib/components/Slider/Slider.d.ts.map +1 -0
- package/lib/components/Slider/Slider.jsx +573 -0
- package/lib/components/Slider/Slider.namespace.d.ts +2 -0
- package/lib/components/Slider/Slider.namespace.d.ts.map +1 -0
- package/lib/components/Slider/Slider.namespace.js +19 -0
- package/lib/components/Slider/Slider.utils.d.ts +19 -0
- package/lib/components/Slider/Slider.utils.d.ts.map +1 -0
- package/lib/components/Slider/Slider.utils.js +106 -0
- package/lib/components/Slider/index.d.ts +3 -0
- package/lib/components/Slider/index.d.ts.map +1 -0
- package/lib/components/Stack/Stack.d.ts +7 -9
- package/lib/components/Stack/Stack.d.ts.map +1 -1
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.d.ts.map +1 -1
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.jsx +22 -8
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Switch/Switch.jsx +5 -3
- package/lib/components/Tabs/Tabs.d.ts +34 -2
- package/lib/components/Tabs/Tabs.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.jsx +186 -56
- package/lib/components/Tabs/Tabs.utils.d.ts +14 -1
- package/lib/components/Tabs/Tabs.utils.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.utils.js +24 -3
- package/lib/components/Tabs/index.d.ts +1 -1
- package/lib/components/Tabs/index.d.ts.map +1 -1
- package/lib/components/index.d.ts +14 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/hooks/useControllableState.d.ts +1 -14
- package/lib/hooks/useControllableState.d.ts.map +1 -1
- package/lib/hooks/usePressTap.d.ts +1 -27
- package/lib/hooks/usePressTap.d.ts.map +1 -1
- package/lib/hooks/useSafeArea.d.ts +8 -4
- package/lib/hooks/useSafeArea.d.ts.map +1 -1
- package/lib/hooks/useSafeArea.js +22 -20
- package/lib/index.js +29 -6
- package/lib/{hooks/useControllableState.js → packages/lynx-react-headless/use-controllable-state/lib/index.js} +2 -3
- package/lib/{hooks/usePressTap.js → packages/lynx-react-headless/use-press-tap/lib/index.js} +13 -10
- package/lib/types.d.ts +1 -0
- package/lib/types.d.ts.map +1 -1
- package/lib/utils/styled.d.ts +46 -6
- package/lib/utils/styled.d.ts.map +1 -1
- package/lib/utils/styled.js +19 -4
- package/package.json +9 -5
- package/src/components/AlertDialog/AlertDialog.namespace.ts +22 -0
- package/src/components/AlertDialog/AlertDialog.test.tsx +226 -0
- package/src/components/AlertDialog/AlertDialog.tsx +374 -0
- package/src/components/AlertDialog/index.ts +24 -0
- package/src/components/AppBar/AppBar.namespace.ts +1 -0
- package/src/components/AppBar/AppBar.test.tsx +252 -3
- package/src/components/AppBar/AppBar.tsx +108 -25
- package/src/components/AppBar/context.ts +3 -1
- package/src/components/AppBar/index.ts +1 -0
- package/src/components/AppBar/useAppBar.ts +21 -15
- package/src/components/AttachmentDisplay/AttachmentDisplay.tsx +886 -0
- package/src/components/AttachmentDisplay/index.ts +48 -0
- package/src/components/AttachmentInput/AttachmentInput.tsx +1001 -0
- package/src/components/AttachmentInput/index.ts +49 -0
- package/src/components/BottomSheet/BottomSheet.test.tsx +22 -7
- package/src/components/BottomSheet/BottomSheet.tsx +1 -19
- package/src/components/Box/Box.test.tsx +104 -0
- package/src/components/Box/Box.tsx +9 -6
- package/src/components/ChipTabs/ChipTabs.namespace.ts +14 -0
- package/src/components/ChipTabs/ChipTabs.tsx +119 -0
- package/src/components/ChipTabs/index.ts +16 -0
- package/src/components/ContextualFloatingButton/ContextualFloatingButton.test.tsx +63 -0
- package/src/components/ContextualFloatingButton/ContextualFloatingButton.tsx +232 -0
- package/src/components/ContextualFloatingButton/index.ts +4 -0
- package/src/components/Dialog/Dialog.namespace.ts +24 -0
- package/src/components/Dialog/Dialog.test.tsx +172 -0
- package/src/components/Dialog/Dialog.tsx +373 -0
- package/src/components/Dialog/index.ts +26 -0
- package/src/components/FloatingActionButton/FloatingActionButton.namespace.ts +8 -0
- package/src/components/FloatingActionButton/FloatingActionButton.test.tsx +59 -0
- package/src/components/FloatingActionButton/FloatingActionButton.tsx +207 -0
- package/src/components/FloatingActionButton/index.ts +10 -0
- package/src/components/HelpBubble/HelpBubble.namespace.ts +24 -0
- package/src/components/HelpBubble/HelpBubble.tsx +998 -0
- package/src/components/HelpBubble/index.ts +26 -0
- package/src/components/Icon/Icon.test.tsx +0 -3
- package/src/components/Icon/Icon.tsx +11 -1
- package/src/components/IdentityPlaceholder/IdentityPlaceholder.namespace.ts +6 -0
- package/src/components/IdentityPlaceholder/IdentityPlaceholder.tsx +103 -0
- package/src/components/IdentityPlaceholder/assets.d.ts +4 -0
- package/src/components/IdentityPlaceholder/identity-placeholder-business.webp +0 -0
- package/src/components/IdentityPlaceholder/identity-placeholder-person.webp +0 -0
- package/src/components/IdentityPlaceholder/index.ts +8 -0
- package/src/components/InputButton/InputButton.test.tsx +128 -1
- package/src/components/InputButton/InputButton.tsx +60 -9
- package/src/components/List/List.test.tsx +54 -2
- package/src/components/List/List.tsx +43 -10
- package/src/components/Menu/Menu.tsx +14 -4
- package/src/components/Menu/__tests__/Menu.test.tsx +34 -0
- package/src/components/PageBanner/PageBanner.test.tsx +110 -3
- package/src/components/PageBanner/PageBanner.tsx +83 -19
- package/src/components/QuantityPicker/QuantityPicker.namespace.ts +10 -0
- package/src/components/QuantityPicker/QuantityPicker.test.tsx +235 -0
- package/src/components/QuantityPicker/QuantityPicker.tsx +605 -0
- package/src/components/QuantityPicker/index.ts +14 -0
- package/src/components/ReactionButton/ReactionButton.feedback.test.tsx +50 -0
- package/src/components/ReactionButton/ReactionButton.test.tsx +5 -3
- package/src/components/ReactionButton/ReactionButton.tsx +20 -12
- package/src/components/ScrollFog/ScrollFog.test.tsx +222 -0
- package/src/components/ScrollFog/ScrollFog.tsx +172 -0
- package/src/components/ScrollFog/index.ts +1 -0
- package/src/components/Select/Select.namespace.ts +34 -0
- package/src/components/Select/Select.test.tsx +297 -0
- package/src/components/Select/Select.tsx +1483 -0
- package/src/components/Select/index.ts +39 -0
- package/src/components/Skeleton/Skeleton.test.tsx +64 -0
- package/src/components/Skeleton/Skeleton.tsx +45 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/Slider/Slider.namespace.ts +26 -0
- package/src/components/Slider/Slider.test.tsx +260 -0
- package/src/components/Slider/Slider.tsx +897 -0
- package/src/components/Slider/Slider.utils.ts +167 -0
- package/src/components/Slider/index.ts +30 -0
- package/src/components/Stack/Stack.test.tsx +7 -0
- package/src/components/Stack/Stack.tsx +11 -10
- package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.test.tsx +21 -1
- package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.tsx +30 -7
- package/src/components/Switch/Switch.tsx +14 -13
- package/src/components/Tabs/Tabs.test.tsx +218 -1
- package/src/components/Tabs/Tabs.tsx +346 -75
- package/src/components/Tabs/Tabs.utils.ts +51 -1
- package/src/components/Tabs/index.ts +17 -1
- package/src/components/index.ts +14 -0
- package/src/hooks/useControllableState.ts +1 -43
- package/src/hooks/usePressTap.test.ts +23 -11
- package/src/hooks/usePressTap.ts +1 -60
- package/src/hooks/useSafeArea.test.ts +13 -1
- package/src/hooks/useSafeArea.ts +25 -23
- package/src/types.ts +1 -0
- package/src/utils/styled.ts +127 -9
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { IntrinsicElements, NodesRef } from '@lynx-js/types';
|
|
2
|
+
import { AttachmentInputVariantProps } from '@seed-design/lynx-css/recipes/attachment-input';
|
|
3
|
+
import { AttachmentInputItemVariantProps } from '@seed-design/lynx-css/recipes/attachment-input-item';
|
|
4
|
+
import { AttachmentInputTriggerVariantProps } from '@seed-design/lynx-css/recipes/attachment-input-trigger';
|
|
5
|
+
import { FieldLabelVariantProps } from '@seed-design/lynx-css/recipes/field-label';
|
|
6
|
+
import { LynxAccessibilityProps, LynxPressableProps, LynxStyledElementProps } from '../../types';
|
|
7
|
+
import * as React from "@lynx-js/react";
|
|
8
|
+
export type AttachmentDisplayStatusDetails = {
|
|
9
|
+
status: "pending";
|
|
10
|
+
} | {
|
|
11
|
+
status: "uploading";
|
|
12
|
+
progress?: number;
|
|
13
|
+
} | {
|
|
14
|
+
status: "success";
|
|
15
|
+
} | {
|
|
16
|
+
status: "error";
|
|
17
|
+
};
|
|
18
|
+
export type AttachmentDisplayEntry = {
|
|
19
|
+
id: string;
|
|
20
|
+
thumbnailUrl?: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
type?: string;
|
|
23
|
+
size?: number;
|
|
24
|
+
} & AttachmentDisplayStatusDetails;
|
|
25
|
+
export interface AttachmentDisplayProps {
|
|
26
|
+
entries?: AttachmentDisplayEntry[];
|
|
27
|
+
defaultEntries?: AttachmentDisplayEntry[];
|
|
28
|
+
onEntriesChange?: (entries: AttachmentDisplayEntry[]) => void;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
invalid?: boolean;
|
|
31
|
+
readOnly?: boolean;
|
|
32
|
+
required?: boolean;
|
|
33
|
+
maxEntries?: number;
|
|
34
|
+
onTriggerTap?: (helpers: {
|
|
35
|
+
addEntries: (entries: AttachmentDisplayEntry[]) => void;
|
|
36
|
+
updateEntryStatus: (id: string, details: AttachmentDisplayStatusDetails) => void;
|
|
37
|
+
}) => void;
|
|
38
|
+
}
|
|
39
|
+
interface AttachmentDisplayStateProps {
|
|
40
|
+
"data-disabled": boolean;
|
|
41
|
+
"data-readonly": boolean;
|
|
42
|
+
"data-invalid": boolean;
|
|
43
|
+
"data-required": boolean;
|
|
44
|
+
}
|
|
45
|
+
interface AttachmentDisplayContextValue {
|
|
46
|
+
entries: AttachmentDisplayEntry[];
|
|
47
|
+
currentEntryCount: number;
|
|
48
|
+
disabled: boolean;
|
|
49
|
+
invalid: boolean;
|
|
50
|
+
readOnly: boolean;
|
|
51
|
+
required: boolean;
|
|
52
|
+
maxEntries: number;
|
|
53
|
+
triggerDisabled: boolean;
|
|
54
|
+
stateProps: AttachmentDisplayStateProps;
|
|
55
|
+
onTriggerTap?: AttachmentDisplayProps["onTriggerTap"];
|
|
56
|
+
addEntries: (entries: AttachmentDisplayEntry[]) => void;
|
|
57
|
+
removeEntry: (id: string) => void;
|
|
58
|
+
reorderEntry: (fromIndex: number, toIndex: number) => void;
|
|
59
|
+
clearEntries: () => void;
|
|
60
|
+
updateEntryStatus: (id: string, details: AttachmentDisplayStatusDetails) => void;
|
|
61
|
+
}
|
|
62
|
+
type AttachmentDisplayItemContextValue = AttachmentDisplayEntry & {
|
|
63
|
+
imageProps?: {
|
|
64
|
+
src: string;
|
|
65
|
+
alt?: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
type NativeScrollViewProps = Omit<IntrinsicElements["scroll-view"], "children" | "className" | "style">;
|
|
69
|
+
export declare function useAttachmentDisplayContext(): AttachmentDisplayContextValue;
|
|
70
|
+
export declare function useAttachmentDisplayItemContext(): AttachmentDisplayItemContextValue;
|
|
71
|
+
export declare function useAttachmentDisplay(props?: AttachmentDisplayProps): {
|
|
72
|
+
entries: AttachmentDisplayEntry[];
|
|
73
|
+
currentEntryCount: number;
|
|
74
|
+
disabled: boolean;
|
|
75
|
+
invalid: boolean;
|
|
76
|
+
readOnly: boolean;
|
|
77
|
+
required: boolean;
|
|
78
|
+
maxEntries: number;
|
|
79
|
+
triggerDisabled: boolean;
|
|
80
|
+
stateProps: {
|
|
81
|
+
"data-disabled": boolean;
|
|
82
|
+
"data-readonly": boolean;
|
|
83
|
+
"data-invalid": boolean;
|
|
84
|
+
"data-required": boolean;
|
|
85
|
+
};
|
|
86
|
+
addEntries: (incoming: AttachmentDisplayEntry[]) => void;
|
|
87
|
+
removeEntry: (id: string) => void;
|
|
88
|
+
reorderEntry: (fromIndex: number, toIndex: number) => void;
|
|
89
|
+
clearEntries: () => void;
|
|
90
|
+
updateEntryStatus: (id: string, details: AttachmentDisplayStatusDetails) => void;
|
|
91
|
+
onTriggerTap: ((helpers: {
|
|
92
|
+
addEntries: (entries: AttachmentDisplayEntry[]) => void;
|
|
93
|
+
updateEntryStatus: (id: string, details: AttachmentDisplayStatusDetails) => void;
|
|
94
|
+
}) => void) | undefined;
|
|
95
|
+
};
|
|
96
|
+
export interface AttachmentDisplayRootProps extends AttachmentDisplayProps, AttachmentInputVariantProps, LynxStyledElementProps {
|
|
97
|
+
}
|
|
98
|
+
export declare const AttachmentDisplayRoot: React.ForwardRefExoticComponent<AttachmentDisplayRootProps & React.RefAttributes<NodesRef>>;
|
|
99
|
+
export interface AttachmentDisplayControlProps extends AttachmentInputVariantProps, LynxStyledElementProps {
|
|
100
|
+
}
|
|
101
|
+
export declare const AttachmentDisplayControl: React.ForwardRefExoticComponent<AttachmentDisplayControlProps & React.RefAttributes<NodesRef>>;
|
|
102
|
+
export interface AttachmentDisplayContainerProps extends LynxStyledElementProps, Omit<NativeScrollViewProps, "scroll-orientation" | "scroll-bar-enable"> {
|
|
103
|
+
}
|
|
104
|
+
export declare const AttachmentDisplayContainer: React.ForwardRefExoticComponent<Omit<AttachmentDisplayContainerProps, "ref"> & React.RefAttributes<NodesRef>>;
|
|
105
|
+
export declare const AttachmentDisplayItemGroup: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
106
|
+
export declare const AttachmentDisplayFooter: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
107
|
+
export declare const AttachmentDisplayDescription: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
108
|
+
export declare const AttachmentDisplayErrorMessage: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
109
|
+
export interface AttachmentDisplayHeaderProps extends LynxStyledElementProps {
|
|
110
|
+
}
|
|
111
|
+
export declare const AttachmentDisplayHeader: React.ForwardRefExoticComponent<AttachmentDisplayHeaderProps & React.RefAttributes<NodesRef>>;
|
|
112
|
+
export interface AttachmentDisplayLabelProps extends FieldLabelVariantProps, LynxStyledElementProps {
|
|
113
|
+
}
|
|
114
|
+
export declare const AttachmentDisplayLabel: React.ForwardRefExoticComponent<AttachmentDisplayLabelProps & React.RefAttributes<NodesRef>>;
|
|
115
|
+
export interface AttachmentDisplayIndicatorTextProps extends LynxStyledElementProps {
|
|
116
|
+
}
|
|
117
|
+
export declare const AttachmentDisplayIndicatorText: React.ForwardRefExoticComponent<AttachmentDisplayIndicatorTextProps & React.RefAttributes<NodesRef>>;
|
|
118
|
+
export interface AttachmentDisplayRequiredIndicatorProps extends LynxStyledElementProps {
|
|
119
|
+
}
|
|
120
|
+
export declare const AttachmentDisplayRequiredIndicator: React.ForwardRefExoticComponent<AttachmentDisplayRequiredIndicatorProps & React.RefAttributes<NodesRef>>;
|
|
121
|
+
export interface AttachmentDisplayTriggerProps extends AttachmentInputTriggerVariantProps, LynxStyledElementProps, LynxPressableProps, LynxAccessibilityProps {
|
|
122
|
+
}
|
|
123
|
+
export declare const AttachmentDisplayTrigger: React.ForwardRefExoticComponent<AttachmentDisplayTriggerProps & React.RefAttributes<NodesRef>>;
|
|
124
|
+
export interface AttachmentDisplayTriggerIconProps extends LynxStyledElementProps {
|
|
125
|
+
image?: React.ReactNode;
|
|
126
|
+
}
|
|
127
|
+
export declare const AttachmentDisplayTriggerIcon: React.ForwardRefExoticComponent<AttachmentDisplayTriggerIconProps & React.RefAttributes<NodesRef>>;
|
|
128
|
+
export interface AttachmentDisplayTriggerItemCountProps extends LynxStyledElementProps {
|
|
129
|
+
}
|
|
130
|
+
export declare const AttachmentDisplayTriggerItemCount: React.ForwardRefExoticComponent<AttachmentDisplayTriggerItemCountProps & React.RefAttributes<NodesRef>>;
|
|
131
|
+
export interface AttachmentDisplayItemProps extends Omit<AttachmentInputItemVariantProps, "type">, LynxStyledElementProps {
|
|
132
|
+
entry: AttachmentDisplayEntry;
|
|
133
|
+
}
|
|
134
|
+
export declare const AttachmentDisplayItem: React.ForwardRefExoticComponent<AttachmentDisplayItemProps & React.RefAttributes<NodesRef>>;
|
|
135
|
+
export declare const AttachmentDisplayItemSurface: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
136
|
+
export declare const AttachmentDisplayItemImage: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
137
|
+
export declare const AttachmentDisplayItemThumbnail: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
138
|
+
export declare const AttachmentDisplayItemMetadata: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
139
|
+
export declare const AttachmentDisplayItemBadge: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
140
|
+
export interface AttachmentDisplayItemActionButtonProps extends LynxStyledElementProps, LynxPressableProps {
|
|
141
|
+
}
|
|
142
|
+
export declare const AttachmentDisplayItemActionButton: React.ForwardRefExoticComponent<AttachmentDisplayItemActionButtonProps & React.RefAttributes<NodesRef>>;
|
|
143
|
+
export interface AttachmentDisplayItemBackdropProps extends Omit<LynxStyledElementProps, "children"> {
|
|
144
|
+
status: AttachmentDisplayEntry["status"];
|
|
145
|
+
children?: React.ReactNode | ((entry: AttachmentDisplayEntry) => React.ReactNode);
|
|
146
|
+
}
|
|
147
|
+
export declare const AttachmentDisplayItemBackdrop: React.ForwardRefExoticComponent<AttachmentDisplayItemBackdropProps & React.RefAttributes<NodesRef>>;
|
|
148
|
+
export interface AttachmentDisplayItemRemoveButtonProps extends LynxStyledElementProps, LynxPressableProps, LynxAccessibilityProps {
|
|
149
|
+
}
|
|
150
|
+
export declare const AttachmentDisplayItemRemoveButton: React.ForwardRefExoticComponent<AttachmentDisplayItemRemoveButtonProps & React.RefAttributes<NodesRef>>;
|
|
151
|
+
export interface AttachmentDisplayContextProps {
|
|
152
|
+
children: (context: AttachmentDisplayContextValue) => React.ReactNode;
|
|
153
|
+
}
|
|
154
|
+
export declare const AttachmentDisplayContext: (props: AttachmentDisplayContextProps) => React.ReactNode;
|
|
155
|
+
export declare const AttachmentDisplay: {
|
|
156
|
+
Root: React.ForwardRefExoticComponent<AttachmentDisplayRootProps & React.RefAttributes<NodesRef>>;
|
|
157
|
+
Control: React.ForwardRefExoticComponent<AttachmentDisplayControlProps & React.RefAttributes<NodesRef>>;
|
|
158
|
+
Container: React.ForwardRefExoticComponent<Omit<AttachmentDisplayContainerProps, "ref"> & React.RefAttributes<NodesRef>>;
|
|
159
|
+
ItemGroup: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
160
|
+
Footer: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
161
|
+
Header: React.ForwardRefExoticComponent<AttachmentDisplayHeaderProps & React.RefAttributes<NodesRef>>;
|
|
162
|
+
Label: React.ForwardRefExoticComponent<AttachmentDisplayLabelProps & React.RefAttributes<NodesRef>>;
|
|
163
|
+
IndicatorText: React.ForwardRefExoticComponent<AttachmentDisplayIndicatorTextProps & React.RefAttributes<NodesRef>>;
|
|
164
|
+
RequiredIndicator: React.ForwardRefExoticComponent<AttachmentDisplayRequiredIndicatorProps & React.RefAttributes<NodesRef>>;
|
|
165
|
+
Description: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
166
|
+
ErrorMessage: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
167
|
+
Trigger: React.ForwardRefExoticComponent<AttachmentDisplayTriggerProps & React.RefAttributes<NodesRef>>;
|
|
168
|
+
TriggerIcon: React.ForwardRefExoticComponent<AttachmentDisplayTriggerIconProps & React.RefAttributes<NodesRef>>;
|
|
169
|
+
TriggerItemCount: React.ForwardRefExoticComponent<AttachmentDisplayTriggerItemCountProps & React.RefAttributes<NodesRef>>;
|
|
170
|
+
Item: React.ForwardRefExoticComponent<AttachmentDisplayItemProps & React.RefAttributes<NodesRef>>;
|
|
171
|
+
ItemSurface: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
172
|
+
ItemImage: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
173
|
+
ItemThumbnail: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
174
|
+
ItemMetadata: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
175
|
+
ItemBadge: React.ForwardRefExoticComponent<LynxStyledElementProps & React.RefAttributes<NodesRef>>;
|
|
176
|
+
ItemActionButton: React.ForwardRefExoticComponent<AttachmentDisplayItemActionButtonProps & React.RefAttributes<NodesRef>>;
|
|
177
|
+
ItemBackdrop: React.ForwardRefExoticComponent<AttachmentDisplayItemBackdropProps & React.RefAttributes<NodesRef>>;
|
|
178
|
+
ItemRemoveButton: React.ForwardRefExoticComponent<AttachmentDisplayItemRemoveButtonProps & React.RefAttributes<NodesRef>>;
|
|
179
|
+
Context: (props: AttachmentDisplayContextProps) => React.ReactNode;
|
|
180
|
+
};
|
|
181
|
+
export {};
|
|
182
|
+
//# sourceMappingURL=AttachmentDisplay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentDisplay/AttachmentDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,qDAAqD,CAAC;AAC7D,OAAO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AAM,iCAAiC,yGAiD5C,CAAC;AAGH,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,EAAE,CAAC,OAAO,EAAE,6BAA6B,KAAK,KAAK,CAAC,SAAS,CAAC;CACvE;AACD,eAAO,MAAM,wBAAwB,GAAI,OAAO,6BAA6B,oBAC9B,CAAC;AAEhD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;qBAHkB,6BAA6B;CA4B5E,CAAC"}
|
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
import { useControllableState } from "../../packages/lynx-react-headless/use-controllable-state/lib/index.js";
|
|
2
|
+
import { usePressTap } from "../../packages/lynx-react-headless/use-press-tap/lib/index.js";
|
|
3
|
+
import { toArray } from "../../utils/children.js";
|
|
4
|
+
import { mergeProps } from "../../utils/merge-props.js";
|
|
5
|
+
import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
|
|
6
|
+
import { IconSlotProvider, InternalIcon } from "../Icon/Icon.jsx";
|
|
7
|
+
import * as React from "@lynx-js/react";
|
|
8
|
+
import { isValidElement } from "@lynx-js/react";
|
|
9
|
+
import clsx from "clsx";
|
|
10
|
+
import { fieldLabel } from "@seed-design/lynx-css/recipes/field-label";
|
|
11
|
+
import { attachmentInput } from "@seed-design/lynx-css/recipes/attachment-input";
|
|
12
|
+
import { attachmentInputItem } from "@seed-design/lynx-css/recipes/attachment-input-item";
|
|
13
|
+
import { attachmentInputTrigger } from "@seed-design/lynx-css/recipes/attachment-input-trigger";
|
|
14
|
+
//#region src/components/AttachmentDisplay/AttachmentDisplay.tsx
|
|
15
|
+
var { ClassNamesProvider: RootClassNamesProvider, useClassNames: useRootClassNames } = createSlotRecipeContext(attachmentInput);
|
|
16
|
+
var { ClassNamesProvider: TriggerClassNamesProvider, useClassNames: useTriggerClassNames } = createSlotRecipeContext(attachmentInputTrigger);
|
|
17
|
+
var { ClassNamesProvider: ItemClassNamesProvider, useClassNames: useItemClassNames } = createSlotRecipeContext(attachmentInputItem);
|
|
18
|
+
var { ClassNamesProvider: LabelClassNamesProvider, useClassNames: useLabelClassNames } = createSlotRecipeContext(fieldLabel);
|
|
19
|
+
var DisplayContextObject = React.createContext(null);
|
|
20
|
+
var DisplayItemContextObject = React.createContext(null);
|
|
21
|
+
function useAttachmentDisplayContext() {
|
|
22
|
+
const context = React.useContext(DisplayContextObject);
|
|
23
|
+
if (!context) throw new Error("AttachmentDisplay components must be used within AttachmentDisplay.Root");
|
|
24
|
+
return context;
|
|
25
|
+
}
|
|
26
|
+
function useAttachmentDisplayItemContext() {
|
|
27
|
+
const context = React.useContext(DisplayItemContextObject);
|
|
28
|
+
if (!context) throw new Error("AttachmentDisplay item components must be used within AttachmentDisplay.Item");
|
|
29
|
+
return context;
|
|
30
|
+
}
|
|
31
|
+
function withUpdatedStatus(entry, details) {
|
|
32
|
+
const metadata = {
|
|
33
|
+
id: entry.id,
|
|
34
|
+
thumbnailUrl: entry.thumbnailUrl,
|
|
35
|
+
name: entry.name,
|
|
36
|
+
type: entry.type,
|
|
37
|
+
size: entry.size
|
|
38
|
+
};
|
|
39
|
+
return details.status === "uploading" ? {
|
|
40
|
+
...metadata,
|
|
41
|
+
status: details.status,
|
|
42
|
+
progress: details.progress
|
|
43
|
+
} : {
|
|
44
|
+
...metadata,
|
|
45
|
+
status: details.status
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function useAttachmentDisplay(props = {}) {
|
|
49
|
+
const { entries: value, defaultEntries = [], onEntriesChange, disabled = false, invalid = false, readOnly = false, required = false, maxEntries = 1, onTriggerTap } = props;
|
|
50
|
+
const [entries, setEntries] = useControllableState({
|
|
51
|
+
value,
|
|
52
|
+
defaultValue: defaultEntries,
|
|
53
|
+
onChange: onEntriesChange
|
|
54
|
+
});
|
|
55
|
+
const currentEntries = entries ?? [];
|
|
56
|
+
const entriesRef = React.useRef(currentEntries);
|
|
57
|
+
entriesRef.current = currentEntries;
|
|
58
|
+
const optionsRef = React.useRef({
|
|
59
|
+
disabled,
|
|
60
|
+
readOnly,
|
|
61
|
+
maxEntries,
|
|
62
|
+
onTriggerTap
|
|
63
|
+
});
|
|
64
|
+
optionsRef.current = {
|
|
65
|
+
disabled,
|
|
66
|
+
readOnly,
|
|
67
|
+
maxEntries,
|
|
68
|
+
onTriggerTap
|
|
69
|
+
};
|
|
70
|
+
const triggerDisabled = disabled || readOnly || currentEntries.length >= maxEntries;
|
|
71
|
+
const addEntries = React.useCallback((incoming) => {
|
|
72
|
+
const options = optionsRef.current;
|
|
73
|
+
if (options.disabled || options.readOnly || incoming.length === 0) return;
|
|
74
|
+
const current = entriesRef.current;
|
|
75
|
+
const next = options.maxEntries > 1 ? [...current, ...incoming.slice(0, Math.max(0, options.maxEntries - current.length))] : [incoming[0]];
|
|
76
|
+
entriesRef.current = next;
|
|
77
|
+
setEntries(next);
|
|
78
|
+
}, [setEntries]);
|
|
79
|
+
const removeEntry = React.useCallback((id) => {
|
|
80
|
+
if (optionsRef.current.readOnly) return;
|
|
81
|
+
const next = entriesRef.current.filter((entry) => entry.id !== id);
|
|
82
|
+
entriesRef.current = next;
|
|
83
|
+
setEntries(next);
|
|
84
|
+
}, [setEntries]);
|
|
85
|
+
const clearEntries = React.useCallback(() => {
|
|
86
|
+
if (optionsRef.current.readOnly) return;
|
|
87
|
+
entriesRef.current = [];
|
|
88
|
+
setEntries([]);
|
|
89
|
+
}, [setEntries]);
|
|
90
|
+
const reorderEntry = React.useCallback((fromIndex, toIndex) => {
|
|
91
|
+
const options = optionsRef.current;
|
|
92
|
+
if (options.disabled || options.readOnly) return;
|
|
93
|
+
const next = [...entriesRef.current];
|
|
94
|
+
if (fromIndex < 0 || toIndex < 0 || fromIndex >= next.length || toIndex >= next.length) return;
|
|
95
|
+
const [entry] = next.splice(fromIndex, 1);
|
|
96
|
+
next.splice(toIndex, 0, entry);
|
|
97
|
+
entriesRef.current = next;
|
|
98
|
+
setEntries(next);
|
|
99
|
+
}, [setEntries]);
|
|
100
|
+
const updateEntryStatus = React.useCallback((id, details) => {
|
|
101
|
+
const next = entriesRef.current.map((entry) => entry.id === id ? withUpdatedStatus(entry, details) : entry);
|
|
102
|
+
entriesRef.current = next;
|
|
103
|
+
setEntries(next);
|
|
104
|
+
}, [setEntries]);
|
|
105
|
+
return {
|
|
106
|
+
entries: currentEntries,
|
|
107
|
+
currentEntryCount: currentEntries.length,
|
|
108
|
+
disabled,
|
|
109
|
+
invalid,
|
|
110
|
+
readOnly,
|
|
111
|
+
required,
|
|
112
|
+
maxEntries,
|
|
113
|
+
triggerDisabled,
|
|
114
|
+
stateProps: {
|
|
115
|
+
"data-disabled": disabled,
|
|
116
|
+
"data-readonly": readOnly,
|
|
117
|
+
"data-invalid": invalid,
|
|
118
|
+
"data-required": required
|
|
119
|
+
},
|
|
120
|
+
addEntries,
|
|
121
|
+
removeEntry,
|
|
122
|
+
reorderEntry,
|
|
123
|
+
clearEntries,
|
|
124
|
+
updateEntryStatus,
|
|
125
|
+
onTriggerTap
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
var AttachmentDisplayRoot = React.forwardRef((props, ref) => {
|
|
129
|
+
const [variantProps, otherProps] = attachmentInput.splitVariantProps(props);
|
|
130
|
+
const { children, className, entries, defaultEntries, onEntriesChange, disabled, invalid, readOnly, required, maxEntries, onTriggerTap, ...nativeProps } = otherProps;
|
|
131
|
+
const api = useAttachmentDisplay({
|
|
132
|
+
entries,
|
|
133
|
+
defaultEntries,
|
|
134
|
+
onEntriesChange,
|
|
135
|
+
disabled,
|
|
136
|
+
invalid,
|
|
137
|
+
readOnly,
|
|
138
|
+
required,
|
|
139
|
+
maxEntries,
|
|
140
|
+
onTriggerTap
|
|
141
|
+
});
|
|
142
|
+
const classes = attachmentInput(variantProps);
|
|
143
|
+
return <DisplayContextObject.Provider value={api}>
|
|
144
|
+
<RootClassNamesProvider value={classes}>
|
|
145
|
+
<view {...mergeProps(ref ? { ref } : {}, api.stateProps, nativeProps)} className={clsx(classes.root, className)}>
|
|
146
|
+
{children}
|
|
147
|
+
</view>
|
|
148
|
+
</RootClassNamesProvider>
|
|
149
|
+
</DisplayContextObject.Provider>;
|
|
150
|
+
});
|
|
151
|
+
AttachmentDisplayRoot.displayName = "AttachmentDisplayRoot";
|
|
152
|
+
var AttachmentDisplayControl = React.forwardRef((props, ref) => {
|
|
153
|
+
const { children, className, ...nativeProps } = props;
|
|
154
|
+
const [variantProps] = attachmentInput.splitVariantProps(props);
|
|
155
|
+
const classes = attachmentInput(variantProps);
|
|
156
|
+
return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classes.root, className)}>
|
|
157
|
+
{children}
|
|
158
|
+
</view>;
|
|
159
|
+
});
|
|
160
|
+
AttachmentDisplayControl.displayName = "AttachmentDisplayControl";
|
|
161
|
+
var AttachmentDisplayContainer = React.forwardRef((props, ref) => {
|
|
162
|
+
const { children, className, ...nativeProps } = props;
|
|
163
|
+
const classes = useRootClassNames();
|
|
164
|
+
return <scroll-view {...mergeProps(ref ? { ref } : {}, nativeProps)} scroll-orientation="horizontal" scroll-bar-enable={false} className={clsx(classes.container, className)}>
|
|
165
|
+
<view className={classes.containerContent}>{children}</view>
|
|
166
|
+
</scroll-view>;
|
|
167
|
+
});
|
|
168
|
+
AttachmentDisplayContainer.displayName = "AttachmentDisplayContainer";
|
|
169
|
+
var AttachmentDisplayItemGroup = React.forwardRef((props, ref) => {
|
|
170
|
+
const { children, className, ...nativeProps } = props;
|
|
171
|
+
const classes = useRootClassNames();
|
|
172
|
+
return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classes.itemGroup, className)}>
|
|
173
|
+
{children}
|
|
174
|
+
</view>;
|
|
175
|
+
});
|
|
176
|
+
AttachmentDisplayItemGroup.displayName = "AttachmentDisplayItemGroup";
|
|
177
|
+
var AttachmentDisplayFooter = React.forwardRef((props, ref) => {
|
|
178
|
+
const { children, className, ...nativeProps } = props;
|
|
179
|
+
const context = useAttachmentDisplayContext();
|
|
180
|
+
return <view {...mergeProps(ref ? { ref } : {}, context.stateProps, nativeProps)} className={className}>
|
|
181
|
+
{children}
|
|
182
|
+
</view>;
|
|
183
|
+
});
|
|
184
|
+
AttachmentDisplayFooter.displayName = "AttachmentDisplayFooter";
|
|
185
|
+
var AttachmentDisplayDescription = React.forwardRef((props, ref) => {
|
|
186
|
+
const { children, className, ...nativeProps } = props;
|
|
187
|
+
const context = useAttachmentDisplayContext();
|
|
188
|
+
return <text {...mergeProps(ref ? { ref } : {}, context.stateProps, nativeProps)} className={className}>
|
|
189
|
+
{children}
|
|
190
|
+
</text>;
|
|
191
|
+
});
|
|
192
|
+
AttachmentDisplayDescription.displayName = "AttachmentDisplayDescription";
|
|
193
|
+
var AttachmentDisplayErrorMessage = React.forwardRef((props, ref) => {
|
|
194
|
+
const { children, className, ...nativeProps } = props;
|
|
195
|
+
const context = useAttachmentDisplayContext();
|
|
196
|
+
return <text {...mergeProps(ref ? { ref } : {}, context.stateProps, nativeProps)} className={className}>
|
|
197
|
+
{children}
|
|
198
|
+
</text>;
|
|
199
|
+
});
|
|
200
|
+
AttachmentDisplayErrorMessage.displayName = "AttachmentDisplayErrorMessage";
|
|
201
|
+
var AttachmentDisplayHeader = React.forwardRef((props, ref) => {
|
|
202
|
+
const { children, className, ...nativeProps } = props;
|
|
203
|
+
const context = useAttachmentDisplayContext();
|
|
204
|
+
return <view {...mergeProps(ref ? { ref } : {}, context.stateProps, nativeProps)} className={className}>
|
|
205
|
+
{children}
|
|
206
|
+
</view>;
|
|
207
|
+
});
|
|
208
|
+
AttachmentDisplayHeader.displayName = "AttachmentDisplayHeader";
|
|
209
|
+
var AttachmentDisplayLabel = React.forwardRef((props, ref) => {
|
|
210
|
+
const [variantProps, otherProps] = fieldLabel.splitVariantProps(props);
|
|
211
|
+
const { children, className, ...nativeProps } = otherProps;
|
|
212
|
+
const classes = fieldLabel(variantProps);
|
|
213
|
+
const context = useAttachmentDisplayContext();
|
|
214
|
+
return <LabelClassNamesProvider value={classes}>
|
|
215
|
+
<text {...mergeProps(ref ? { ref } : {}, context.stateProps, nativeProps)} className={clsx(classes.root, className)}>
|
|
216
|
+
{children}
|
|
217
|
+
</text>
|
|
218
|
+
</LabelClassNamesProvider>;
|
|
219
|
+
});
|
|
220
|
+
AttachmentDisplayLabel.displayName = "AttachmentDisplayLabel";
|
|
221
|
+
var AttachmentDisplayIndicatorText = React.forwardRef((props, ref) => {
|
|
222
|
+
const { children, className, ...nativeProps } = props;
|
|
223
|
+
const classes = useLabelClassNames();
|
|
224
|
+
const context = useAttachmentDisplayContext();
|
|
225
|
+
return <text {...mergeProps(ref ? { ref } : {}, context.stateProps, nativeProps)} className={clsx(classes.indicatorText, className)}>
|
|
226
|
+
{"\xA0"}
|
|
227
|
+
{children}
|
|
228
|
+
</text>;
|
|
229
|
+
});
|
|
230
|
+
AttachmentDisplayIndicatorText.displayName = "AttachmentDisplayIndicatorText";
|
|
231
|
+
var AttachmentDisplayRequiredIndicator = React.forwardRef((props, ref) => {
|
|
232
|
+
const { children = "*", className, ...nativeProps } = props;
|
|
233
|
+
const classes = useLabelClassNames();
|
|
234
|
+
const context = useAttachmentDisplayContext();
|
|
235
|
+
return <text {...mergeProps(ref ? { ref } : {}, context.stateProps, nativeProps)} accessibility-elements-hidden={true} className={clsx(classes.indicatorIcon, className)}>
|
|
236
|
+
{" "}
|
|
237
|
+
{children}
|
|
238
|
+
</text>;
|
|
239
|
+
});
|
|
240
|
+
AttachmentDisplayRequiredIndicator.displayName = "AttachmentDisplayRequiredIndicator";
|
|
241
|
+
var AttachmentDisplayTrigger = React.forwardRef((props, ref) => {
|
|
242
|
+
const [variantProps, restProps] = attachmentInputTrigger.splitVariantProps(props);
|
|
243
|
+
const { children, className, bindtap, "main-thread:bindtap": mainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel, "accessibility-role-description": accessibilityRoleDescription = "button", "accessibility-traits": accessibilityTraits, ...nativeProps } = restProps;
|
|
244
|
+
const context = useAttachmentDisplayContext();
|
|
245
|
+
const press = usePressTap({
|
|
246
|
+
disabled: context.triggerDisabled,
|
|
247
|
+
onTap: () => context.onTriggerTap?.({
|
|
248
|
+
addEntries: context.addEntries,
|
|
249
|
+
updateEntryStatus: context.updateEntryStatus
|
|
250
|
+
}),
|
|
251
|
+
mainThreadOnTap: mainThreadBindtap
|
|
252
|
+
});
|
|
253
|
+
const classes = attachmentInputTrigger({
|
|
254
|
+
...variantProps,
|
|
255
|
+
pressed: press.pressed,
|
|
256
|
+
disabled: context.triggerDisabled
|
|
257
|
+
});
|
|
258
|
+
return <TriggerClassNamesProvider value={classes}>
|
|
259
|
+
<view {...mergeProps(ref ? { ref } : {}, press, { bindtap: context.triggerDisabled ? void 0 : bindtap }, nativeProps, context.stateProps)} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel} accessibility-role-description={accessibilityRoleDescription} accessibility-traits={accessibilityTraits ?? (context.triggerDisabled ? "disabled" : "button")} flatten={false} className={clsx(classes.root, className)}>
|
|
260
|
+
{children}
|
|
261
|
+
</view>
|
|
262
|
+
</TriggerClassNamesProvider>;
|
|
263
|
+
});
|
|
264
|
+
AttachmentDisplayTrigger.displayName = "AttachmentDisplayTrigger";
|
|
265
|
+
var AttachmentDisplayTriggerIcon = React.forwardRef((props, ref) => {
|
|
266
|
+
const { image, children, className, ...nativeProps } = props;
|
|
267
|
+
const context = useAttachmentDisplayContext();
|
|
268
|
+
const classes = useTriggerClassNames();
|
|
269
|
+
const icon = image ?? children;
|
|
270
|
+
if (!isValidElement(icon)) return null;
|
|
271
|
+
return <InternalIcon icon={icon} ref={ref} {...nativeProps} className={clsx(classes.icon, className)} accessibility-elements-hidden={true} deps={[context.triggerDisabled]} />;
|
|
272
|
+
});
|
|
273
|
+
AttachmentDisplayTriggerIcon.displayName = "AttachmentDisplayTriggerIcon";
|
|
274
|
+
var AttachmentDisplayTriggerItemCount = React.forwardRef((props, ref) => {
|
|
275
|
+
const { children, className, ...nativeProps } = props;
|
|
276
|
+
const context = useAttachmentDisplayContext();
|
|
277
|
+
const classes = useTriggerClassNames();
|
|
278
|
+
return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classes.itemCountArea, className)}>
|
|
279
|
+
<text {...context.currentEntryCount === 0 ? { "data-empty": true } : {}} {...context.stateProps} className={classes.itemCount}>
|
|
280
|
+
{context.currentEntryCount}
|
|
281
|
+
</text>
|
|
282
|
+
<text {...context.stateProps} className={classes.maxItemCount}>
|
|
283
|
+
/{context.maxEntries}
|
|
284
|
+
</text>
|
|
285
|
+
{children}
|
|
286
|
+
</view>;
|
|
287
|
+
});
|
|
288
|
+
AttachmentDisplayTriggerItemCount.displayName = "AttachmentDisplayTriggerItemCount";
|
|
289
|
+
var AttachmentDisplayItem = React.forwardRef((props, ref) => {
|
|
290
|
+
const { entry, children, className, ...restProps } = props;
|
|
291
|
+
const [variantProps, nativeProps] = attachmentInputItem.splitVariantProps({
|
|
292
|
+
type: "image",
|
|
293
|
+
...restProps
|
|
294
|
+
});
|
|
295
|
+
const root = useAttachmentDisplayContext();
|
|
296
|
+
const classes = attachmentInputItem({
|
|
297
|
+
...variantProps,
|
|
298
|
+
type: "image",
|
|
299
|
+
disabled: root.disabled,
|
|
300
|
+
readOnly: root.readOnly,
|
|
301
|
+
pressed: false,
|
|
302
|
+
dragging: variantProps.dragging ?? false
|
|
303
|
+
});
|
|
304
|
+
const item = {
|
|
305
|
+
...entry,
|
|
306
|
+
imageProps: entry.thumbnailUrl ? {
|
|
307
|
+
src: entry.thumbnailUrl,
|
|
308
|
+
alt: entry.name
|
|
309
|
+
} : void 0
|
|
310
|
+
};
|
|
311
|
+
return <DisplayItemContextObject.Provider value={item}>
|
|
312
|
+
<ItemClassNamesProvider value={classes}>
|
|
313
|
+
<view {...mergeProps(ref ? { ref } : {}, root.stateProps, nativeProps)} className={clsx(classes.root, className)}>
|
|
314
|
+
{children}
|
|
315
|
+
</view>
|
|
316
|
+
</ItemClassNamesProvider>
|
|
317
|
+
</DisplayItemContextObject.Provider>;
|
|
318
|
+
});
|
|
319
|
+
AttachmentDisplayItem.displayName = "AttachmentDisplayItem";
|
|
320
|
+
var AttachmentDisplayItemSurface = React.forwardRef((props, ref) => {
|
|
321
|
+
const { children, className, ...nativeProps } = props;
|
|
322
|
+
const classes = useItemClassNames();
|
|
323
|
+
return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classes.surface, className)}>
|
|
324
|
+
{children}
|
|
325
|
+
</view>;
|
|
326
|
+
});
|
|
327
|
+
AttachmentDisplayItemSurface.displayName = "AttachmentDisplayItemSurface";
|
|
328
|
+
var AttachmentDisplayItemImage = React.forwardRef((props, ref) => {
|
|
329
|
+
const { className, ...nativeProps } = props;
|
|
330
|
+
const item = useAttachmentDisplayItemContext();
|
|
331
|
+
const classes = useItemClassNames();
|
|
332
|
+
if (!item.imageProps) return null;
|
|
333
|
+
return <image {...mergeProps(ref ? { ref } : {}, nativeProps)} src={item.imageProps.src} accessibility-label={item.imageProps.alt} className={clsx(classes.image, className)} />;
|
|
334
|
+
});
|
|
335
|
+
AttachmentDisplayItemImage.displayName = "AttachmentDisplayItemImage";
|
|
336
|
+
var AttachmentDisplayItemThumbnail = React.forwardRef((props, ref) => {
|
|
337
|
+
const { children, className, ...nativeProps } = props;
|
|
338
|
+
const classes = useItemClassNames();
|
|
339
|
+
const context = useAttachmentDisplayContext();
|
|
340
|
+
return <IconSlotProvider value={{
|
|
341
|
+
classNames: { icon: classes.thumbnailIcon },
|
|
342
|
+
deps: [context.disabled, context.readOnly]
|
|
343
|
+
}}>
|
|
344
|
+
<view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classes.thumbnail, className)}>
|
|
345
|
+
{children}
|
|
346
|
+
</view>
|
|
347
|
+
</IconSlotProvider>;
|
|
348
|
+
});
|
|
349
|
+
AttachmentDisplayItemThumbnail.displayName = "AttachmentDisplayItemThumbnail";
|
|
350
|
+
var AttachmentDisplayItemMetadata = React.forwardRef((props, ref) => {
|
|
351
|
+
const { children, className, ...nativeProps } = props;
|
|
352
|
+
const classes = useItemClassNames();
|
|
353
|
+
return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classes.metadata, className)}>
|
|
354
|
+
{children}
|
|
355
|
+
</view>;
|
|
356
|
+
});
|
|
357
|
+
AttachmentDisplayItemMetadata.displayName = "AttachmentDisplayItemMetadata";
|
|
358
|
+
var AttachmentDisplayItemBadge = React.forwardRef((props, ref) => {
|
|
359
|
+
const { children, className, ...nativeProps } = props;
|
|
360
|
+
const classes = useItemClassNames();
|
|
361
|
+
return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classes.badge, className)}>
|
|
362
|
+
<text className={classes.badgeLabel}>{children}</text>
|
|
363
|
+
</view>;
|
|
364
|
+
});
|
|
365
|
+
AttachmentDisplayItemBadge.displayName = "AttachmentDisplayItemBadge";
|
|
366
|
+
var AttachmentDisplayItemActionButton = React.forwardRef((props, ref) => {
|
|
367
|
+
const { children, className, bindtap, "main-thread:bindtap": mainThreadBindtap, ...nativeProps } = props;
|
|
368
|
+
const classes = useItemClassNames();
|
|
369
|
+
const context = useAttachmentDisplayContext();
|
|
370
|
+
const actionChildren = toArray(children).map((child, index) => typeof child === "string" || typeof child === "number" ? <text key={index} className={classes.actionLabel}>
|
|
371
|
+
{child}
|
|
372
|
+
</text> : child);
|
|
373
|
+
return <IconSlotProvider value={{
|
|
374
|
+
classNames: { icon: classes.actionIcon },
|
|
375
|
+
deps: [context.disabled, context.readOnly]
|
|
376
|
+
}}>
|
|
377
|
+
<view {...mergeProps(ref ? { ref } : {}, nativeProps, {
|
|
378
|
+
bindtap,
|
|
379
|
+
"main-thread:bindtap": mainThreadBindtap
|
|
380
|
+
})} className={clsx(classes.actionButton, className)}>
|
|
381
|
+
{actionChildren}
|
|
382
|
+
</view>
|
|
383
|
+
</IconSlotProvider>;
|
|
384
|
+
});
|
|
385
|
+
AttachmentDisplayItemActionButton.displayName = "AttachmentDisplayItemActionButton";
|
|
386
|
+
var AttachmentDisplayItemBackdrop = React.forwardRef((props, ref) => {
|
|
387
|
+
const { status, children, className, ...nativeProps } = props;
|
|
388
|
+
const entry = useAttachmentDisplayItemContext();
|
|
389
|
+
const classes = useItemClassNames();
|
|
390
|
+
if (entry.status !== status) return null;
|
|
391
|
+
return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classes.backdrop, className)}>
|
|
392
|
+
{typeof children === "function" ? children(entry) : children}
|
|
393
|
+
</view>;
|
|
394
|
+
});
|
|
395
|
+
AttachmentDisplayItemBackdrop.displayName = "AttachmentDisplayItemBackdrop";
|
|
396
|
+
var AttachmentDisplayItemRemoveButton = React.forwardRef((props, ref) => {
|
|
397
|
+
const { children, className, bindtap, "main-thread:bindtap": mainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel, "accessibility-role-description": accessibilityRoleDescription = "button", "accessibility-traits": accessibilityTraits, ...nativeProps } = props;
|
|
398
|
+
const item = useAttachmentDisplayItemContext();
|
|
399
|
+
const context = useAttachmentDisplayContext();
|
|
400
|
+
const classes = useItemClassNames();
|
|
401
|
+
const press = usePressTap({
|
|
402
|
+
disabled: context.readOnly,
|
|
403
|
+
onTap: () => context.removeEntry(item.id),
|
|
404
|
+
mainThreadOnTap: mainThreadBindtap
|
|
405
|
+
});
|
|
406
|
+
return <IconSlotProvider value={{
|
|
407
|
+
classNames: { icon: classes.removeIcon },
|
|
408
|
+
deps: [context.disabled, context.readOnly]
|
|
409
|
+
}}>
|
|
410
|
+
<view {...mergeProps(ref ? { ref } : {}, press, { bindtap: context.readOnly ? void 0 : bindtap }, nativeProps, context.stateProps)} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel} accessibility-role-description={accessibilityRoleDescription} accessibility-traits={accessibilityTraits ?? (context.readOnly ? "disabled" : "button")} flatten={false} className={clsx(classes.removeButton, className)}>
|
|
411
|
+
{children}
|
|
412
|
+
</view>
|
|
413
|
+
</IconSlotProvider>;
|
|
414
|
+
});
|
|
415
|
+
AttachmentDisplayItemRemoveButton.displayName = "AttachmentDisplayItemRemoveButton";
|
|
416
|
+
var AttachmentDisplayContext = (props) => props.children(useAttachmentDisplayContext());
|
|
417
|
+
var AttachmentDisplay = {
|
|
418
|
+
Root: AttachmentDisplayRoot,
|
|
419
|
+
Control: AttachmentDisplayControl,
|
|
420
|
+
Container: AttachmentDisplayContainer,
|
|
421
|
+
ItemGroup: AttachmentDisplayItemGroup,
|
|
422
|
+
Footer: AttachmentDisplayFooter,
|
|
423
|
+
Header: AttachmentDisplayHeader,
|
|
424
|
+
Label: AttachmentDisplayLabel,
|
|
425
|
+
IndicatorText: AttachmentDisplayIndicatorText,
|
|
426
|
+
RequiredIndicator: AttachmentDisplayRequiredIndicator,
|
|
427
|
+
Description: AttachmentDisplayDescription,
|
|
428
|
+
ErrorMessage: AttachmentDisplayErrorMessage,
|
|
429
|
+
Trigger: AttachmentDisplayTrigger,
|
|
430
|
+
TriggerIcon: AttachmentDisplayTriggerIcon,
|
|
431
|
+
TriggerItemCount: AttachmentDisplayTriggerItemCount,
|
|
432
|
+
Item: AttachmentDisplayItem,
|
|
433
|
+
ItemSurface: AttachmentDisplayItemSurface,
|
|
434
|
+
ItemImage: AttachmentDisplayItemImage,
|
|
435
|
+
ItemThumbnail: AttachmentDisplayItemThumbnail,
|
|
436
|
+
ItemMetadata: AttachmentDisplayItemMetadata,
|
|
437
|
+
ItemBadge: AttachmentDisplayItemBadge,
|
|
438
|
+
ItemActionButton: AttachmentDisplayItemActionButton,
|
|
439
|
+
ItemBackdrop: AttachmentDisplayItemBackdrop,
|
|
440
|
+
ItemRemoveButton: AttachmentDisplayItemRemoveButton,
|
|
441
|
+
Context: AttachmentDisplayContext
|
|
442
|
+
};
|
|
443
|
+
//#endregion
|
|
444
|
+
export { AttachmentDisplay, AttachmentDisplayContainer, AttachmentDisplayContext, AttachmentDisplayControl, AttachmentDisplayDescription, AttachmentDisplayErrorMessage, AttachmentDisplayFooter, AttachmentDisplayHeader, AttachmentDisplayIndicatorText, AttachmentDisplayItem, AttachmentDisplayItemActionButton, AttachmentDisplayItemBackdrop, AttachmentDisplayItemBadge, AttachmentDisplayItemGroup, AttachmentDisplayItemImage, AttachmentDisplayItemMetadata, AttachmentDisplayItemRemoveButton, AttachmentDisplayItemSurface, AttachmentDisplayItemThumbnail, AttachmentDisplayLabel, AttachmentDisplayRequiredIndicator, AttachmentDisplayRoot, AttachmentDisplayTrigger, AttachmentDisplayTriggerIcon, AttachmentDisplayTriggerItemCount, useAttachmentDisplay, useAttachmentDisplayContext, useAttachmentDisplayItemContext };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { AttachmentDisplay, AttachmentDisplayRoot, AttachmentDisplayControl, AttachmentDisplayContainer, AttachmentDisplayItemGroup, AttachmentDisplayFooter, AttachmentDisplayHeader, AttachmentDisplayLabel, AttachmentDisplayIndicatorText, AttachmentDisplayRequiredIndicator, AttachmentDisplayDescription, AttachmentDisplayErrorMessage, AttachmentDisplayTrigger, AttachmentDisplayTriggerIcon, AttachmentDisplayTriggerItemCount, AttachmentDisplayItem, AttachmentDisplayItemSurface, AttachmentDisplayItemImage, AttachmentDisplayItemThumbnail, AttachmentDisplayItemMetadata, AttachmentDisplayItemBadge, AttachmentDisplayItemActionButton, AttachmentDisplayItemBackdrop, AttachmentDisplayItemRemoveButton, AttachmentDisplayContext, useAttachmentDisplay, useAttachmentDisplayContext, useAttachmentDisplayItemContext, type AttachmentDisplayEntry, type AttachmentDisplayStatusDetails, type AttachmentDisplayHeaderProps, type AttachmentDisplayLabelProps, type AttachmentDisplayIndicatorTextProps, type AttachmentDisplayRequiredIndicatorProps, type AttachmentDisplayTriggerItemCountProps, type AttachmentDisplayProps, type AttachmentDisplayRootProps, type AttachmentDisplayControlProps, type AttachmentDisplayContainerProps, type AttachmentDisplayTriggerProps, type AttachmentDisplayTriggerIconProps, type AttachmentDisplayItemProps, type AttachmentDisplayItemBackdropProps, type AttachmentDisplayItemRemoveButtonProps, type AttachmentDisplayItemActionButtonProps, type AttachmentDisplayContextProps, } from './AttachmentDisplay';
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AttachmentDisplay/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACxB,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,8BAA8B,EAC9B,kCAAkC,EAClC,4BAA4B,EAC5B,6BAA6B,EAC7B,wBAAwB,EACxB,4BAA4B,EAC5B,iCAAiC,EACjC,qBAAqB,EACrB,4BAA4B,EAC5B,0BAA0B,EAC1B,8BAA8B,EAC9B,6BAA6B,EAC7B,0BAA0B,EAC1B,iCAAiC,EACjC,6BAA6B,EAC7B,iCAAiC,EACjC,wBAAwB,EACxB,oBAAoB,EACpB,2BAA2B,EAC3B,+BAA+B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,8BAA8B,EACnC,KAAK,4BAA4B,EACjC,KAAK,2BAA2B,EAChC,KAAK,mCAAmC,EACxC,KAAK,uCAAuC,EAC5C,KAAK,sCAAsC,EAC3C,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAClC,KAAK,+BAA+B,EACpC,KAAK,6BAA6B,EAClC,KAAK,iCAAiC,EACtC,KAAK,0BAA0B,EAC/B,KAAK,kCAAkC,EACvC,KAAK,sCAAsC,EAC3C,KAAK,sCAAsC,EAC3C,KAAK,6BAA6B,GACnC,MAAM,qBAAqB,CAAC"}
|