@idealyst/components 1.2.29 → 1.2.31
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 +3 -3
- package/package.json +4 -4
- package/plugin/__tests__/web.test.ts +2 -2
- package/plugin/web.js +2 -0
- package/src/Accordion/Accordion.native.tsx +3 -2
- package/src/ActivityIndicator/ActivityIndicator.native.tsx +4 -2
- package/src/ActivityIndicator/ActivityIndicator.styles.tsx +22 -27
- package/src/ActivityIndicator/ActivityIndicator.web.tsx +17 -29
- package/src/Alert/Alert.native.tsx +20 -10
- package/src/Alert/Alert.styles.tsx +173 -86
- package/src/Alert/Alert.web.tsx +34 -30
- package/src/Alert/types.ts +53 -3
- package/src/Avatar/Avatar.native.tsx +3 -2
- package/src/Avatar/Avatar.web.tsx +2 -1
- package/src/Avatar/types.ts +1 -1
- package/src/Badge/Badge.native.tsx +18 -6
- package/src/Badge/Badge.styles.tsx +22 -5
- package/src/Badge/Badge.web.tsx +12 -4
- package/src/Badge/types.ts +14 -2
- package/src/Breadcrumb/Breadcrumb.native.tsx +3 -2
- package/src/Button/Button.native.tsx +16 -6
- package/src/Button/Button.styles.tsx +2 -2
- package/src/Button/Button.web.tsx +19 -15
- package/src/Button/types.ts +6 -10
- package/src/Card/Card.native.tsx +27 -3
- package/src/Card/Card.web.tsx +30 -4
- package/src/Card/types.ts +15 -0
- package/src/Checkbox/Checkbox.native.tsx +5 -4
- package/src/Checkbox/Checkbox.styles.tsx +62 -52
- package/src/Checkbox/Checkbox.web.tsx +4 -3
- package/src/Checkbox/types.ts +1 -1
- package/src/Chip/Chip.native.tsx +30 -7
- package/src/Chip/Chip.web.tsx +28 -5
- package/src/Chip/types.ts +15 -0
- package/src/Dialog/Dialog.native.tsx +6 -6
- package/src/Dialog/Dialog.web.tsx +5 -5
- package/src/Dialog/types.ts +2 -2
- package/src/Divider/Divider.native.tsx +20 -17
- package/src/Divider/Divider.styles.tsx +51 -29
- package/src/Divider/Divider.web.tsx +5 -4
- package/src/Divider/types.ts +3 -3
- package/src/Icon/Icon.native.tsx +3 -2
- package/src/Icon/Icon.web.tsx +2 -1
- package/src/Icon/IconSvg/IconSvg.native.tsx +3 -2
- package/src/IconButton/IconButton.native.tsx +219 -0
- package/src/IconButton/IconButton.styles.tsx +127 -0
- package/src/IconButton/IconButton.web.tsx +198 -0
- package/src/IconButton/index.native.ts +5 -0
- package/src/IconButton/index.ts +5 -0
- package/src/IconButton/index.web.ts +5 -0
- package/src/IconButton/types.ts +84 -0
- package/src/Image/Image.native.tsx +3 -2
- package/src/Input/Input.native.tsx +42 -290
- package/src/Input/Input.styles.tsx +1 -1
- package/src/Input/Input.web.tsx +37 -288
- package/src/Input/index.native.ts +9 -2
- package/src/Input/index.ts +8 -1
- package/src/Input/index.web.ts +8 -1
- package/src/Input/types.ts +1 -1
- package/src/List/List.native.tsx +3 -2
- package/src/List/ListItem.native.tsx +3 -2
- package/src/List/ListSection.native.tsx +3 -2
- package/src/Menu/Menu.native.tsx +2 -1
- package/src/Menu/Menu.styles.tsx +79 -29
- package/src/Menu/Menu.web.tsx +2 -1
- package/src/Menu/MenuItem.native.tsx +4 -3
- package/src/Menu/MenuItem.styles.tsx +81 -32
- package/src/Menu/MenuItem.web.tsx +2 -1
- package/src/Menu/docs.ts +1 -1
- package/src/Popover/Popover.native.tsx +2 -1
- package/src/Popover/Popover.web.tsx +2 -1
- package/src/Popover/types.ts +15 -4
- package/src/Pressable/Pressable.native.tsx +3 -2
- package/src/Pressable/Pressable.web.tsx +3 -5
- package/src/Progress/Progress.native.tsx +5 -4
- package/src/Progress/Progress.web.tsx +3 -3
- package/src/Progress/types.ts +3 -3
- package/src/RadioButton/RadioButton.native.tsx +4 -3
- package/src/RadioButton/RadioButton.styles.tsx +53 -33
- package/src/RadioButton/RadioGroup.native.tsx +3 -2
- package/src/SVGImage/SVGImage.native.tsx +5 -4
- package/src/SVGImage/SVGImage.styles.tsx +44 -10
- package/src/SVGImage/SVGImage.web.tsx +2 -1
- package/src/Screen/Screen.native.tsx +2 -1
- package/src/Screen/Screen.web.tsx +2 -1
- package/src/Select/Select.native.tsx +6 -5
- package/src/Select/Select.styles.tsx +1 -1
- package/src/Select/Select.web.tsx +4 -3
- package/src/Select/types.ts +1 -1
- package/src/Skeleton/Skeleton.native.tsx +2 -1
- package/src/Skeleton/Skeleton.web.tsx +1 -1
- package/src/Slider/Slider.native.tsx +9 -8
- package/src/Slider/Slider.web.tsx +10 -9
- package/src/Slider/types.ts +9 -2
- package/src/Switch/Switch.native.tsx +7 -6
- package/src/Switch/Switch.styles.tsx +52 -17
- package/src/Switch/Switch.web.tsx +15 -16
- package/src/Switch/types.ts +44 -4
- package/src/TabBar/TabBar.native.tsx +3 -2
- package/src/Text/Text.native.tsx +3 -2
- package/src/Text/Text.web.tsx +2 -1
- package/src/TextArea/TextArea.native.tsx +3 -2
- package/src/TextArea/TextArea.styles.tsx +2 -2
- package/src/TextArea/TextArea.web.tsx +2 -1
- package/src/TextInput/TextInput.native.tsx +300 -0
- package/src/TextInput/TextInput.styles.tsx +207 -0
- package/src/TextInput/TextInput.web.tsx +301 -0
- package/src/TextInput/index.native.ts +3 -0
- package/src/TextInput/index.ts +5 -0
- package/src/TextInput/index.web.ts +5 -0
- package/src/TextInput/types.ts +163 -0
- package/src/Tooltip/Tooltip.native.tsx +3 -2
- package/src/Video/Video.native.tsx +4 -3
- package/src/View/View.native.tsx +2 -1
- package/src/View/View.styles.tsx +1 -0
- package/src/View/View.web.tsx +9 -2
- package/src/examples/ActivityIndicatorExamples.tsx +177 -0
- package/src/examples/AlertExamples.tsx +5 -5
- package/src/examples/ButtonExamples.tsx +12 -12
- package/src/examples/CardExamples.tsx +1 -1
- package/src/examples/CheckboxExamples.tsx +2 -2
- package/src/examples/ChipExamples.tsx +6 -6
- package/src/examples/DialogExamples.tsx +1 -1
- package/src/examples/DividerExamples.tsx +1 -1
- package/src/examples/InputExamples.tsx +1 -1
- package/src/examples/LinkExamples.tsx +1 -1
- package/src/examples/ListExamples.tsx +1 -1
- package/src/examples/MenuExamples.tsx +2 -2
- package/src/examples/ProgressExamples.tsx +1 -1
- package/src/examples/RadioButtonExamples.tsx +5 -5
- package/src/examples/SVGImageExamples.tsx +1 -1
- package/src/examples/SelectExamples.tsx +1 -1
- package/src/examples/SliderExamples.tsx +5 -5
- package/src/examples/SwitchExamples.tsx +26 -26
- package/src/examples/TableExamples.tsx +1 -1
- package/src/examples/TooltipExamples.tsx +2 -2
- package/src/examples/index.ts +1 -0
- package/src/extensions/index.ts +1 -0
- package/src/extensions/types.ts +22 -3
- package/src/index.native.ts +4 -0
- package/src/index.ts +27 -2
- package/src/utils/index.ts +12 -0
- package/src/utils/refTypes.ts +50 -0
|
@@ -29,7 +29,7 @@ export const SwitchExamples: React.FC = () => {
|
|
|
29
29
|
<Text typography="h5">Basic Switch</Text>
|
|
30
30
|
<Switch
|
|
31
31
|
checked={basicChecked}
|
|
32
|
-
|
|
32
|
+
onChange={setBasicChecked}
|
|
33
33
|
/>
|
|
34
34
|
</View>
|
|
35
35
|
|
|
@@ -37,7 +37,7 @@ export const SwitchExamples: React.FC = () => {
|
|
|
37
37
|
<Text typography="h5">With Label</Text>
|
|
38
38
|
<Switch
|
|
39
39
|
checked={labelledChecked}
|
|
40
|
-
|
|
40
|
+
onChange={setLabelledChecked}
|
|
41
41
|
label="Enable notifications"
|
|
42
42
|
/>
|
|
43
43
|
</View>
|
|
@@ -46,7 +46,7 @@ export const SwitchExamples: React.FC = () => {
|
|
|
46
46
|
<Text typography="h5">Label Position</Text>
|
|
47
47
|
<Switch
|
|
48
48
|
checked={labelledChecked}
|
|
49
|
-
|
|
49
|
+
onChange={setLabelledChecked}
|
|
50
50
|
label="Left label"
|
|
51
51
|
labelPosition="left"
|
|
52
52
|
/>
|
|
@@ -57,13 +57,13 @@ export const SwitchExamples: React.FC = () => {
|
|
|
57
57
|
<View gap="sm">
|
|
58
58
|
<Switch
|
|
59
59
|
checked={basicChecked}
|
|
60
|
-
|
|
60
|
+
onChange={setBasicChecked}
|
|
61
61
|
size="sm"
|
|
62
62
|
label="Small"
|
|
63
63
|
/>
|
|
64
64
|
<Switch
|
|
65
65
|
checked={basicChecked}
|
|
66
|
-
|
|
66
|
+
onChange={setBasicChecked}
|
|
67
67
|
size="md"
|
|
68
68
|
label="Medium (default)"
|
|
69
69
|
/>
|
|
@@ -81,31 +81,31 @@ export const SwitchExamples: React.FC = () => {
|
|
|
81
81
|
<View gap="sm">
|
|
82
82
|
<Switch
|
|
83
83
|
checked={intentChecked.primary}
|
|
84
|
-
|
|
84
|
+
onChange={(checked) => setIntentChecked(prev => ({ ...prev, primary: checked }))}
|
|
85
85
|
intent="primary"
|
|
86
86
|
label="Primary"
|
|
87
87
|
/>
|
|
88
88
|
<Switch
|
|
89
89
|
checked={intentChecked.success}
|
|
90
|
-
|
|
90
|
+
onChange={(checked) => setIntentChecked(prev => ({ ...prev, success: checked }))}
|
|
91
91
|
intent="success"
|
|
92
92
|
label="Success"
|
|
93
93
|
/>
|
|
94
94
|
<Switch
|
|
95
95
|
checked={intentChecked.error}
|
|
96
|
-
|
|
97
|
-
intent="
|
|
96
|
+
onChange={(checked) => setIntentChecked(prev => ({ ...prev, error: checked }))}
|
|
97
|
+
intent="danger"
|
|
98
98
|
label="Error"
|
|
99
99
|
/>
|
|
100
100
|
<Switch
|
|
101
101
|
checked={intentChecked.warning}
|
|
102
|
-
|
|
102
|
+
onChange={(checked) => setIntentChecked(prev => ({ ...prev, warning: checked }))}
|
|
103
103
|
intent="warning"
|
|
104
104
|
label="Warning"
|
|
105
105
|
/>
|
|
106
106
|
<Switch
|
|
107
107
|
checked={intentChecked.neutral}
|
|
108
|
-
|
|
108
|
+
onChange={(checked) => setIntentChecked(prev => ({ ...prev, neutral: checked }))}
|
|
109
109
|
intent="neutral"
|
|
110
110
|
label="Neutral"
|
|
111
111
|
/>
|
|
@@ -117,32 +117,32 @@ export const SwitchExamples: React.FC = () => {
|
|
|
117
117
|
<View gap="sm">
|
|
118
118
|
<Switch
|
|
119
119
|
checked={iconChecked.basic}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
onChange={(checked) => setIconChecked(prev => ({ ...prev, basic: checked }))}
|
|
121
|
+
onIcon="check"
|
|
122
|
+
offIcon="close"
|
|
123
123
|
label="On/Off"
|
|
124
124
|
/>
|
|
125
125
|
<Switch
|
|
126
126
|
checked={iconChecked.notifications}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
onChange={(checked) => setIconChecked(prev => ({ ...prev, notifications: checked }))}
|
|
128
|
+
onIcon="bell"
|
|
129
|
+
offIcon="bell-off"
|
|
130
130
|
intent="success"
|
|
131
131
|
label="Notifications"
|
|
132
132
|
/>
|
|
133
133
|
<Switch
|
|
134
134
|
checked={iconChecked.visibility}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
onChange={(checked) => setIconChecked(prev => ({ ...prev, visibility: checked }))}
|
|
136
|
+
onIcon="eye"
|
|
137
|
+
offIcon="eye-off"
|
|
138
138
|
intent="primary"
|
|
139
139
|
label="Visibility"
|
|
140
140
|
/>
|
|
141
141
|
<Switch
|
|
142
142
|
checked={iconChecked.volume}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
onChange={(checked) => setIconChecked(prev => ({ ...prev, volume: checked }))}
|
|
144
|
+
onIcon="volume-high"
|
|
145
|
+
offIcon="volume-off"
|
|
146
146
|
intent="warning"
|
|
147
147
|
label="Sound"
|
|
148
148
|
size="lg"
|
|
@@ -150,9 +150,9 @@ export const SwitchExamples: React.FC = () => {
|
|
|
150
150
|
<Switch
|
|
151
151
|
checked={iconChecked.wifi}
|
|
152
152
|
onCheckedChange={(checked) => setIconChecked(prev => ({ ...prev, wifi: checked }))}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
intent="
|
|
153
|
+
onIcon="wifi"
|
|
154
|
+
offIcon="wifi-off"
|
|
155
|
+
intent="danger"
|
|
156
156
|
label="WiFi Connection"
|
|
157
157
|
size="sm"
|
|
158
158
|
/>
|
|
@@ -126,7 +126,7 @@ export const TableExamples: React.FC = () => {
|
|
|
126
126
|
<Button size="sm" type="outlined" onPress={() => console.log('Edit', user.id)}>
|
|
127
127
|
Edit
|
|
128
128
|
</Button>
|
|
129
|
-
<Button size="sm" type="outlined" intent="
|
|
129
|
+
<Button size="sm" type="outlined" intent="danger" onPress={() => console.log('Delete', user.id)}>
|
|
130
130
|
Delete
|
|
131
131
|
</Button>
|
|
132
132
|
</View>
|
|
@@ -62,8 +62,8 @@ export const TooltipExamples: React.FC = () => {
|
|
|
62
62
|
<Tooltip content="Warning tooltip" intent="warning">
|
|
63
63
|
<Button type="contained" intent="warning">Warning</Button>
|
|
64
64
|
</Tooltip>
|
|
65
|
-
<Tooltip content="Error tooltip" intent="
|
|
66
|
-
<Button type="contained" intent="
|
|
65
|
+
<Tooltip content="Error tooltip" intent="danger">
|
|
66
|
+
<Button type="contained" intent="danger">Error</Button>
|
|
67
67
|
</Tooltip>
|
|
68
68
|
<Tooltip content="Neutral tooltip" intent="neutral">
|
|
69
69
|
<Button type="contained" intent="neutral">Neutral</Button>
|
package/src/examples/index.ts
CHANGED
package/src/extensions/index.ts
CHANGED
package/src/extensions/types.ts
CHANGED
|
@@ -37,6 +37,17 @@ export type ButtonStyleableElements = {
|
|
|
37
37
|
text: ElementStyle;
|
|
38
38
|
icon: ElementStyle;
|
|
39
39
|
iconContainer: ElementStyle;
|
|
40
|
+
spinner: ElementStyle;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* IconButton styleable elements.
|
|
45
|
+
* @see IconButtonStylesheet in @idealyst/theme/components/icon-button
|
|
46
|
+
*/
|
|
47
|
+
export type IconButtonStyleableElements = {
|
|
48
|
+
button: ElementStyle;
|
|
49
|
+
icon: ElementStyle;
|
|
50
|
+
spinner: ElementStyle;
|
|
40
51
|
};
|
|
41
52
|
|
|
42
53
|
/**
|
|
@@ -48,10 +59,10 @@ export type CardStyleableElements = {
|
|
|
48
59
|
};
|
|
49
60
|
|
|
50
61
|
/**
|
|
51
|
-
*
|
|
52
|
-
* @see
|
|
62
|
+
* TextInput styleable elements.
|
|
63
|
+
* @see TextInputStylesheet in @idealyst/theme/components/text-input
|
|
53
64
|
*/
|
|
54
|
-
export type
|
|
65
|
+
export type TextInputStyleableElements = {
|
|
55
66
|
container: Styles;
|
|
56
67
|
leftIconContainer: Styles;
|
|
57
68
|
rightIconContainer: Styles;
|
|
@@ -62,6 +73,11 @@ export type InputStyleableElements = {
|
|
|
62
73
|
input: Styles;
|
|
63
74
|
};
|
|
64
75
|
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Use TextInputStyleableElements instead
|
|
78
|
+
*/
|
|
79
|
+
export type InputStyleableElements = TextInputStyleableElements;
|
|
80
|
+
|
|
65
81
|
/**
|
|
66
82
|
* Chip styleable elements.
|
|
67
83
|
* @see ChipStylesheet in @idealyst/theme/components/chip
|
|
@@ -451,7 +467,10 @@ export interface ComponentStyleExtensions {}
|
|
|
451
467
|
*/
|
|
452
468
|
interface BuiltInComponentStyleElements {
|
|
453
469
|
Button: ButtonStyleableElements;
|
|
470
|
+
IconButton: IconButtonStyleableElements;
|
|
454
471
|
Card: CardStyleableElements;
|
|
472
|
+
TextInput: TextInputStyleableElements;
|
|
473
|
+
/** @deprecated Use TextInput instead */
|
|
455
474
|
Input: InputStyleableElements;
|
|
456
475
|
Chip: ChipStyleableElements;
|
|
457
476
|
Alert: AlertStyleableElements;
|
package/src/index.native.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export { default as Button } from './Button';
|
|
2
2
|
export * from './Button/types';
|
|
3
3
|
|
|
4
|
+
export { default as IconButton } from './IconButton';
|
|
5
|
+
export * from './IconButton/types';
|
|
6
|
+
|
|
4
7
|
export { default as Text } from './Text';
|
|
5
8
|
export * from './Text/types';
|
|
6
9
|
|
|
@@ -108,6 +111,7 @@ export { default as Platform } from './Platform';
|
|
|
108
111
|
export * from './Platform/types';
|
|
109
112
|
|
|
110
113
|
export type { ButtonProps } from './Button/types';
|
|
114
|
+
export type { IconButtonProps } from './IconButton/types';
|
|
111
115
|
export type { TextProps } from './Text/types';
|
|
112
116
|
export type { ViewProps } from './View/types';
|
|
113
117
|
export type { InputProps } from './Input/types';
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,9 @@ import useMergeRefs from './hooks/useMergeRefs';
|
|
|
6
6
|
export { default as Button } from './Button';
|
|
7
7
|
export * from './Button/types';
|
|
8
8
|
|
|
9
|
+
export { default as IconButton } from './IconButton';
|
|
10
|
+
export * from './IconButton/types';
|
|
11
|
+
|
|
9
12
|
export { default as Text } from './Text';
|
|
10
13
|
export * from './Text/types';
|
|
11
14
|
|
|
@@ -18,8 +21,14 @@ export * from './Pressable/types';
|
|
|
18
21
|
export { default as Link } from './Link';
|
|
19
22
|
export * from './Link/types';
|
|
20
23
|
|
|
24
|
+
// TextInput (primary text input component)
|
|
25
|
+
export { default as TextInput } from './TextInput';
|
|
26
|
+
export * from './TextInput/types';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use TextInput instead. Input is maintained for backwards compatibility only.
|
|
30
|
+
*/
|
|
21
31
|
export { default as Input } from './Input';
|
|
22
|
-
export * from './Input/types';
|
|
23
32
|
|
|
24
33
|
// New primitive components
|
|
25
34
|
export { default as Checkbox } from './Checkbox';
|
|
@@ -113,10 +122,13 @@ export { default as Platform } from './Platform';
|
|
|
113
122
|
export * from './Platform/types';
|
|
114
123
|
|
|
115
124
|
export type { ButtonProps } from './Button/types';
|
|
125
|
+
export type { IconButtonProps } from './IconButton/types';
|
|
116
126
|
export type { TextProps } from './Text/types';
|
|
117
127
|
export type { ViewProps } from './View/types';
|
|
118
128
|
export type { LinkProps } from './Link/types';
|
|
119
|
-
export type {
|
|
129
|
+
export type { TextInputProps } from './TextInput/types';
|
|
130
|
+
/** @deprecated Use TextInputProps instead */
|
|
131
|
+
export type { InputProps } from './TextInput/types';
|
|
120
132
|
export type { CheckboxProps } from './Checkbox/types';
|
|
121
133
|
export type { CardProps } from './Card/types';
|
|
122
134
|
export type { DividerProps } from './Divider/types';
|
|
@@ -156,6 +168,18 @@ export * from './utils/events';
|
|
|
156
168
|
export * from './utils/viewStyleProps';
|
|
157
169
|
export * from './utils/buildViewStyleVariants';
|
|
158
170
|
|
|
171
|
+
// Cross-platform ref types
|
|
172
|
+
export type {
|
|
173
|
+
IdealystElement,
|
|
174
|
+
AnchorElement,
|
|
175
|
+
AnchorRef,
|
|
176
|
+
ComponentElement,
|
|
177
|
+
WebElement,
|
|
178
|
+
NativeElement,
|
|
179
|
+
CrossPlatformElement,
|
|
180
|
+
CrossPlatformRef,
|
|
181
|
+
} from './utils/refTypes';
|
|
182
|
+
|
|
159
183
|
// Component style extensions
|
|
160
184
|
export {
|
|
161
185
|
extendComponent,
|
|
@@ -174,6 +198,7 @@ export type {
|
|
|
174
198
|
Styles,
|
|
175
199
|
ButtonStyleableElements,
|
|
176
200
|
CardStyleableElements,
|
|
201
|
+
TextInputStyleableElements,
|
|
177
202
|
InputStyleableElements,
|
|
178
203
|
ChipStyleableElements,
|
|
179
204
|
AlertStyleableElements,
|
package/src/utils/index.ts
CHANGED
|
@@ -18,3 +18,15 @@ export { deepMerge, isPlainObject } from './styleHelpers';
|
|
|
18
18
|
|
|
19
19
|
// Accessibility utilities
|
|
20
20
|
export * from './accessibility';
|
|
21
|
+
|
|
22
|
+
// Cross-platform ref types
|
|
23
|
+
export type {
|
|
24
|
+
IdealystElement,
|
|
25
|
+
AnchorElement,
|
|
26
|
+
AnchorRef,
|
|
27
|
+
ComponentElement,
|
|
28
|
+
WebElement,
|
|
29
|
+
NativeElement,
|
|
30
|
+
CrossPlatformElement,
|
|
31
|
+
CrossPlatformRef,
|
|
32
|
+
} from './refTypes';
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-platform ref types for use with refs across web and React Native.
|
|
3
|
+
*
|
|
4
|
+
* These types provide a unified way to work with refs in a cross-platform manner,
|
|
5
|
+
* especially useful for components like Popover that need to anchor to other elements.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Universal element type for cross-platform refs.
|
|
10
|
+
* Works seamlessly in both React web and React Native contexts.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```tsx
|
|
14
|
+
* const anchorRef = React.useRef<IdealystElement>(null);
|
|
15
|
+
*
|
|
16
|
+
* <Button ref={anchorRef} onPress={() => setOpen(true)}>
|
|
17
|
+
* Open Popover
|
|
18
|
+
* </Button>
|
|
19
|
+
* <Popover anchor={anchorRef} open={open} onOpenChange={setOpen}>
|
|
20
|
+
* <Text>Content</Text>
|
|
21
|
+
* </Popover>
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
+
export type IdealystElement = any;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use IdealystElement instead
|
|
29
|
+
*/
|
|
30
|
+
export type AnchorElement = IdealystElement;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use React.RefObject<IdealystElement> instead
|
|
34
|
+
*/
|
|
35
|
+
export type AnchorRef = React.RefObject<IdealystElement>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Use IdealystElement instead
|
|
39
|
+
*/
|
|
40
|
+
export type CrossPlatformElement = IdealystElement;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated Use React.RefObject<IdealystElement> instead
|
|
44
|
+
*/
|
|
45
|
+
export type CrossPlatformRef = React.RefObject<IdealystElement>;
|
|
46
|
+
|
|
47
|
+
// Legacy exports kept for backwards compatibility
|
|
48
|
+
export type WebElement = IdealystElement;
|
|
49
|
+
export type NativeElement = IdealystElement;
|
|
50
|
+
export type ComponentElement<T> = IdealystElement;
|