@idealyst/components 1.0.99 → 1.1.1
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/package.json +4 -4
- package/src/Accordion/Accordion.native.tsx +15 -0
- package/src/Accordion/Accordion.styles.tsx +17 -0
- package/src/Accordion/Accordion.web.tsx +15 -0
- package/src/Accordion/types.ts +2 -1
- package/src/Button/Button.native.tsx +55 -2
- package/src/Button/Button.styles.tsx +22 -0
- package/src/Button/Button.web.tsx +6 -2
- package/src/Button/types.ts +15 -0
- package/src/Card/Card.native.tsx +18 -5
- package/src/Card/Card.styles.tsx +123 -131
- package/src/Card/Card.web.tsx +17 -4
- package/src/Card/types.ts +3 -8
- package/src/Checkbox/Checkbox.native.tsx +7 -0
- package/src/Checkbox/Checkbox.styles.tsx +11 -0
- package/src/Checkbox/Checkbox.web.tsx +7 -0
- package/src/Checkbox/types.ts +2 -1
- package/src/Input/Input.native.tsx +7 -0
- package/src/Input/Input.styles.tsx +9 -0
- package/src/Input/Input.web.tsx +7 -0
- package/src/Input/types.ts +2 -1
- package/src/List/List.native.tsx +15 -0
- package/src/List/List.styles.tsx +17 -0
- package/src/List/List.web.tsx +15 -0
- package/src/List/types.ts +2 -1
- package/src/Pressable/Pressable.native.tsx +13 -1
- package/src/Pressable/Pressable.styles.tsx +24 -0
- package/src/Pressable/Pressable.web.tsx +24 -6
- package/src/Pressable/types.ts +3 -2
- package/src/RadioButton/RadioButton.native.tsx +7 -0
- package/src/RadioButton/RadioButton.styles.tsx +9 -0
- package/src/RadioButton/RadioButton.web.tsx +7 -0
- package/src/RadioButton/types.ts +2 -1
- package/src/Screen/Screen.native.tsx +25 -12
- package/src/Screen/Screen.styles.tsx +28 -16
- package/src/Screen/Screen.web.tsx +16 -3
- package/src/Screen/types.ts +4 -8
- package/src/Select/Select.native.tsx +7 -0
- package/src/Select/Select.styles.tsx +11 -0
- package/src/Select/Select.web.tsx +7 -0
- package/src/Select/types.ts +2 -1
- package/src/Slider/Slider.native.tsx +7 -0
- package/src/Slider/Slider.styles.tsx +11 -0
- package/src/Slider/Slider.web.tsx +7 -0
- package/src/Slider/types.ts +2 -1
- package/src/Switch/Switch.native.tsx +7 -0
- package/src/Switch/Switch.styles.tsx +11 -0
- package/src/Switch/Switch.web.tsx +7 -0
- package/src/Switch/types.ts +2 -1
- package/src/TabBar/TabBar.native.tsx +19 -1
- package/src/TabBar/TabBar.styles.tsx +17 -0
- package/src/TabBar/TabBar.web.tsx +20 -1
- package/src/TabBar/types.ts +2 -1
- package/src/Table/Table.native.tsx +15 -0
- package/src/Table/Table.styles.tsx +27 -0
- package/src/Table/Table.web.tsx +15 -0
- package/src/Table/types.ts +2 -1
- package/src/Text/Text.native.tsx +14 -3
- package/src/Text/Text.styles.tsx +36 -12
- package/src/Text/Text.web.tsx +15 -4
- package/src/Text/types.ts +15 -4
- package/src/TextArea/TextArea.native.tsx +7 -0
- package/src/TextArea/TextArea.styles.tsx +11 -0
- package/src/TextArea/TextArea.web.tsx +7 -0
- package/src/TextArea/types.ts +2 -1
- package/src/View/View.native.tsx +35 -12
- package/src/View/View.styles.tsx +78 -75
- package/src/View/View.web.tsx +18 -9
- package/src/View/types.ts +8 -23
- package/src/examples/AccordionExamples.tsx +32 -32
- package/src/examples/AlertExamples.tsx +42 -42
- package/src/examples/AvatarExamples.tsx +18 -18
- package/src/examples/BadgeExamples.tsx +30 -30
- package/src/examples/BreadcrumbExamples.tsx +64 -64
- package/src/examples/ButtonExamples.tsx +128 -16
- package/src/examples/CardExamples.tsx +28 -28
- package/src/examples/CheckboxExamples.tsx +25 -25
- package/src/examples/ChipExamples.tsx +17 -17
- package/src/examples/DialogExamples.tsx +17 -17
- package/src/examples/DividerExamples.tsx +21 -21
- package/src/examples/IconExamples.tsx +113 -113
- package/src/examples/ImageExamples.tsx +34 -34
- package/src/examples/InputExamples.tsx +20 -20
- package/src/examples/LinkExamples.tsx +23 -23
- package/src/examples/ListExamples.tsx +42 -42
- package/src/examples/MenuExamples.tsx +15 -15
- package/src/examples/PopoverExamples.tsx +23 -23
- package/src/examples/ProgressExamples.tsx +41 -41
- package/src/examples/RadioButtonExamples.tsx +21 -21
- package/src/examples/SVGImageExamples.tsx +25 -25
- package/src/examples/ScreenExamples.tsx +41 -41
- package/src/examples/SelectExamples.tsx +59 -59
- package/src/examples/SkeletonExamples.tsx +30 -30
- package/src/examples/SliderExamples.tsx +54 -54
- package/src/examples/SwitchExamples.tsx +20 -20
- package/src/examples/TabBarExamples.tsx +26 -26
- package/src/examples/TableExamples.tsx +36 -36
- package/src/examples/TextAreaExamples.tsx +25 -25
- package/src/examples/TextExamples.tsx +61 -66
- package/src/examples/ThemeExtensionExamples.tsx +12 -12
- package/src/examples/TooltipExamples.tsx +21 -21
- package/src/examples/VideoExamples.tsx +28 -28
- package/src/examples/ViewExamples.tsx +59 -59
- package/src/index.ts +4 -0
- package/src/utils/buildViewStyleVariants.ts +148 -0
- package/src/utils/viewStyleProps.ts +63 -0
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
import { Theme } from '@idealyst/theme';
|
|
3
|
+
import {
|
|
4
|
+
buildGapVariants,
|
|
5
|
+
buildPaddingVariants,
|
|
6
|
+
buildPaddingVerticalVariants,
|
|
7
|
+
buildPaddingHorizontalVariants,
|
|
8
|
+
buildMarginVariants,
|
|
9
|
+
buildMarginVerticalVariants,
|
|
10
|
+
buildMarginHorizontalVariants,
|
|
11
|
+
} from '../utils/buildViewStyleVariants';
|
|
3
12
|
|
|
4
13
|
function generateBackgroundVariants(theme: Theme) {
|
|
5
14
|
return {
|
|
@@ -10,18 +19,7 @@ function generateBackgroundVariants(theme: Theme) {
|
|
|
10
19
|
'inverse-secondary': { backgroundColor: theme.colors.surface['inverse-secondary'] },
|
|
11
20
|
'inverse-tertiary': { backgroundColor: theme.colors.surface['inverse-tertiary'] },
|
|
12
21
|
transparent: { backgroundColor: 'transparent' },
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
function generatePaddingVariants() {
|
|
17
|
-
return {
|
|
18
|
-
none: { padding: 0 },
|
|
19
|
-
xs: { padding: 4 },
|
|
20
|
-
sm: { padding: 8 },
|
|
21
|
-
md: { padding: 16 },
|
|
22
|
-
lg: { padding: 24 },
|
|
23
|
-
xl: { padding: 32 },
|
|
24
|
-
}
|
|
22
|
+
};
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
// Styles are inlined here instead of in @idealyst/theme because Unistyles' Babel
|
|
@@ -34,11 +32,18 @@ export const screenStyles = StyleSheet.create((theme: Theme) => {
|
|
|
34
32
|
backgroundColor: theme.colors.surface.primary,
|
|
35
33
|
variants: {
|
|
36
34
|
background: generateBackgroundVariants(theme),
|
|
37
|
-
padding: generatePaddingVariants(),
|
|
38
35
|
safeArea: {
|
|
39
36
|
true: {},
|
|
40
37
|
false: {},
|
|
41
|
-
}
|
|
38
|
+
},
|
|
39
|
+
// Spacing variants from ContainerStyleProps
|
|
40
|
+
gap: buildGapVariants(theme),
|
|
41
|
+
padding: buildPaddingVariants(theme),
|
|
42
|
+
paddingVertical: buildPaddingVerticalVariants(theme),
|
|
43
|
+
paddingHorizontal: buildPaddingHorizontalVariants(theme),
|
|
44
|
+
margin: buildMarginVariants(theme),
|
|
45
|
+
marginVertical: buildMarginVerticalVariants(theme),
|
|
46
|
+
marginHorizontal: buildMarginHorizontalVariants(theme),
|
|
42
47
|
},
|
|
43
48
|
_web: {
|
|
44
49
|
overflow: 'auto',
|
|
@@ -53,11 +58,18 @@ export const screenStyles = StyleSheet.create((theme: Theme) => {
|
|
|
53
58
|
backgroundColor: theme.colors.surface.primary,
|
|
54
59
|
variants: {
|
|
55
60
|
background: generateBackgroundVariants(theme),
|
|
56
|
-
padding: generatePaddingVariants(),
|
|
57
61
|
safeArea: {
|
|
58
62
|
true: {},
|
|
59
63
|
false: {},
|
|
60
|
-
}
|
|
64
|
+
},
|
|
65
|
+
// Spacing variants from ContainerStyleProps
|
|
66
|
+
gap: buildGapVariants(theme),
|
|
67
|
+
padding: buildPaddingVariants(theme),
|
|
68
|
+
paddingVertical: buildPaddingVerticalVariants(theme),
|
|
69
|
+
paddingHorizontal: buildPaddingHorizontalVariants(theme),
|
|
70
|
+
margin: buildMarginVariants(theme),
|
|
71
|
+
marginVertical: buildMarginVerticalVariants(theme),
|
|
72
|
+
marginHorizontal: buildMarginHorizontalVariants(theme),
|
|
61
73
|
},
|
|
62
74
|
},
|
|
63
75
|
};
|
|
@@ -7,15 +7,28 @@ import useMergeRefs from '../hooks/useMergeRefs';
|
|
|
7
7
|
const Screen = forwardRef<HTMLDivElement, ScreenProps>(({
|
|
8
8
|
children,
|
|
9
9
|
background = 'primary',
|
|
10
|
-
padding = 'md',
|
|
11
10
|
safeArea = false,
|
|
11
|
+
// Spacing variants from ContainerStyleProps
|
|
12
|
+
gap,
|
|
13
|
+
padding,
|
|
14
|
+
paddingVertical,
|
|
15
|
+
paddingHorizontal,
|
|
16
|
+
margin,
|
|
17
|
+
marginVertical,
|
|
18
|
+
marginHorizontal,
|
|
12
19
|
style,
|
|
13
20
|
testID,
|
|
14
21
|
}, ref) => {
|
|
15
22
|
screenStyles.useVariants({
|
|
16
23
|
background,
|
|
17
|
-
padding,
|
|
18
24
|
safeArea,
|
|
25
|
+
gap,
|
|
26
|
+
padding,
|
|
27
|
+
paddingVertical,
|
|
28
|
+
paddingHorizontal,
|
|
29
|
+
margin,
|
|
30
|
+
marginVertical,
|
|
31
|
+
marginHorizontal,
|
|
19
32
|
});
|
|
20
33
|
|
|
21
34
|
// Use getWebProps to generate className and ref for web
|
|
@@ -36,4 +49,4 @@ const Screen = forwardRef<HTMLDivElement, ScreenProps>(({
|
|
|
36
49
|
|
|
37
50
|
Screen.displayName = 'Screen';
|
|
38
51
|
|
|
39
|
-
export default Screen;
|
|
52
|
+
export default Screen;
|
package/src/Screen/types.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import {
|
|
3
|
+
import { Surface } from '@idealyst/theme';
|
|
4
|
+
import { ContainerStyleProps } from '../utils/viewStyleProps';
|
|
4
5
|
|
|
5
|
-
export interface ScreenProps {
|
|
6
|
+
export interface ScreenProps extends ContainerStyleProps {
|
|
6
7
|
/**
|
|
7
8
|
* The content to display inside the screen
|
|
8
9
|
*/
|
|
@@ -13,11 +14,6 @@ export interface ScreenProps {
|
|
|
13
14
|
*/
|
|
14
15
|
background?: Surface | 'transparent';
|
|
15
16
|
|
|
16
|
-
/**
|
|
17
|
-
* Screen padding variant
|
|
18
|
-
*/
|
|
19
|
-
padding?: Size | 'none';
|
|
20
|
-
|
|
21
17
|
/**
|
|
22
18
|
* Safe area padding for mobile devices
|
|
23
19
|
*/
|
|
@@ -49,4 +45,4 @@ export interface ScreenProps {
|
|
|
49
45
|
* Scrollable content
|
|
50
46
|
*/
|
|
51
47
|
scrollable?: boolean;
|
|
52
|
-
}
|
|
48
|
+
}
|
|
@@ -33,6 +33,10 @@ const Select = forwardRef<View, SelectProps>(({
|
|
|
33
33
|
filterOption,
|
|
34
34
|
presentationMode = 'dropdown',
|
|
35
35
|
maxHeight = 240,
|
|
36
|
+
// Spacing variants from FormInputStyleProps
|
|
37
|
+
margin,
|
|
38
|
+
marginVertical,
|
|
39
|
+
marginHorizontal,
|
|
36
40
|
style,
|
|
37
41
|
testID,
|
|
38
42
|
accessibilityLabel,
|
|
@@ -76,6 +80,9 @@ const Select = forwardRef<View, SelectProps>(({
|
|
|
76
80
|
disabled,
|
|
77
81
|
error,
|
|
78
82
|
focused: isOpen,
|
|
83
|
+
margin,
|
|
84
|
+
marginVertical,
|
|
85
|
+
marginHorizontal,
|
|
79
86
|
});
|
|
80
87
|
|
|
81
88
|
const handleTriggerPress = () => {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
import { Theme, StylesheetStyles, Intent, Size } from '@idealyst/theme';
|
|
3
3
|
import { buildSizeVariants } from '../utils/buildSizeVariants';
|
|
4
|
+
import {
|
|
5
|
+
buildMarginVariants,
|
|
6
|
+
buildMarginVerticalVariants,
|
|
7
|
+
buildMarginHorizontalVariants,
|
|
8
|
+
} from '../utils/buildViewStyleVariants';
|
|
4
9
|
import { SelectIntentVariant } from './types';
|
|
5
10
|
|
|
6
11
|
// Type definitions
|
|
@@ -138,6 +143,12 @@ export const selectStyles = StyleSheet.create((theme: Theme) => {
|
|
|
138
143
|
return {
|
|
139
144
|
container: {
|
|
140
145
|
position: 'relative',
|
|
146
|
+
variants: {
|
|
147
|
+
// Spacing variants from FormInputStyleProps
|
|
148
|
+
margin: buildMarginVariants(theme),
|
|
149
|
+
marginVertical: buildMarginVerticalVariants(theme),
|
|
150
|
+
marginHorizontal: buildMarginHorizontalVariants(theme),
|
|
151
|
+
},
|
|
141
152
|
},
|
|
142
153
|
label: {
|
|
143
154
|
fontSize: 14,
|
|
@@ -23,6 +23,10 @@ const Select = forwardRef<HTMLDivElement, SelectProps>(({
|
|
|
23
23
|
searchable = false,
|
|
24
24
|
filterOption,
|
|
25
25
|
maxHeight = 240,
|
|
26
|
+
// Spacing variants from FormInputStyleProps
|
|
27
|
+
margin,
|
|
28
|
+
marginVertical,
|
|
29
|
+
marginHorizontal,
|
|
26
30
|
style,
|
|
27
31
|
testID,
|
|
28
32
|
accessibilityLabel,
|
|
@@ -59,6 +63,9 @@ const Select = forwardRef<HTMLDivElement, SelectProps>(({
|
|
|
59
63
|
disabled,
|
|
60
64
|
error,
|
|
61
65
|
focused: isOpen,
|
|
66
|
+
margin,
|
|
67
|
+
marginVertical,
|
|
68
|
+
marginHorizontal,
|
|
62
69
|
});
|
|
63
70
|
|
|
64
71
|
// Handle keyboard navigation on the trigger button
|
package/src/Select/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Intent, Size } from '@idealyst/theme';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
4
|
+
import { FormInputStyleProps } from '../utils/viewStyleProps';
|
|
4
5
|
|
|
5
6
|
// Component-specific type aliases for future extensibility
|
|
6
7
|
export type SelectIntentVariant = Intent;
|
|
@@ -29,7 +30,7 @@ export interface SelectOption {
|
|
|
29
30
|
icon?: ReactNode;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
export interface SelectProps {
|
|
33
|
+
export interface SelectProps extends FormInputStyleProps {
|
|
33
34
|
/**
|
|
34
35
|
* Array of options to display in the select
|
|
35
36
|
*/
|
|
@@ -21,6 +21,10 @@ const Slider = forwardRef<View, SliderProps>(({
|
|
|
21
21
|
intent = 'primary',
|
|
22
22
|
size = 'md',
|
|
23
23
|
icon,
|
|
24
|
+
// Spacing variants from FormInputStyleProps
|
|
25
|
+
margin,
|
|
26
|
+
marginVertical,
|
|
27
|
+
marginHorizontal,
|
|
24
28
|
onValueChange,
|
|
25
29
|
onValueCommit,
|
|
26
30
|
style,
|
|
@@ -38,6 +42,9 @@ const Slider = forwardRef<View, SliderProps>(({
|
|
|
38
42
|
sliderStyles.useVariants({
|
|
39
43
|
size,
|
|
40
44
|
disabled,
|
|
45
|
+
margin,
|
|
46
|
+
marginVertical,
|
|
47
|
+
marginHorizontal,
|
|
41
48
|
});
|
|
42
49
|
|
|
43
50
|
const clampValue = (val: number) => {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
import { Theme, Size, Styles} from '@idealyst/theme';
|
|
3
3
|
import { buildSizeVariants } from '../utils/buildSizeVariants';
|
|
4
|
+
import {
|
|
5
|
+
buildMarginVariants,
|
|
6
|
+
buildMarginVerticalVariants,
|
|
7
|
+
buildMarginHorizontalVariants,
|
|
8
|
+
} from '../utils/buildViewStyleVariants';
|
|
4
9
|
import { SliderIntentVariant } from './types';
|
|
5
10
|
|
|
6
11
|
/**
|
|
@@ -157,6 +162,12 @@ export const sliderStyles = StyleSheet.create((theme: Theme) => {
|
|
|
157
162
|
container: {
|
|
158
163
|
gap: 4,
|
|
159
164
|
paddingVertical: 8,
|
|
165
|
+
variants: {
|
|
166
|
+
// Spacing variants from FormInputStyleProps
|
|
167
|
+
margin: buildMarginVariants(theme),
|
|
168
|
+
marginVertical: buildMarginVerticalVariants(theme),
|
|
169
|
+
marginHorizontal: buildMarginHorizontalVariants(theme),
|
|
170
|
+
},
|
|
160
171
|
},
|
|
161
172
|
sliderWrapper: {
|
|
162
173
|
position: 'relative',
|
|
@@ -19,6 +19,10 @@ const Slider = forwardRef<HTMLDivElement, SliderProps>(({
|
|
|
19
19
|
intent = 'primary',
|
|
20
20
|
size = 'md',
|
|
21
21
|
icon,
|
|
22
|
+
// Spacing variants from FormInputStyleProps
|
|
23
|
+
margin,
|
|
24
|
+
marginVertical,
|
|
25
|
+
marginHorizontal,
|
|
22
26
|
onValueChange,
|
|
23
27
|
onValueCommit,
|
|
24
28
|
style,
|
|
@@ -36,6 +40,9 @@ const Slider = forwardRef<HTMLDivElement, SliderProps>(({
|
|
|
36
40
|
sliderStyles.useVariants({
|
|
37
41
|
size,
|
|
38
42
|
disabled,
|
|
43
|
+
margin,
|
|
44
|
+
marginVertical,
|
|
45
|
+
marginHorizontal,
|
|
39
46
|
});
|
|
40
47
|
|
|
41
48
|
const containerProps = getWebProps([sliderStyles.container, style as any]);
|
package/src/Slider/types.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
2
|
import type { IconName } from '../Icon/icon-types';
|
|
3
3
|
import { Intent, Size } from '@idealyst/theme';
|
|
4
|
+
import { FormInputStyleProps } from '../utils/viewStyleProps';
|
|
4
5
|
|
|
5
6
|
// Component-specific type aliases for future extensibility
|
|
6
7
|
export type SliderIntentVariant = Intent;
|
|
7
8
|
export type SliderSizeVariant = Size;
|
|
8
9
|
|
|
9
|
-
export interface SliderProps {
|
|
10
|
+
export interface SliderProps extends FormInputStyleProps {
|
|
10
11
|
value?: number;
|
|
11
12
|
defaultValue?: number;
|
|
12
13
|
min?: number;
|
|
@@ -13,6 +13,10 @@ const Switch = forwardRef<ComponentRef<typeof Pressable>, SwitchProps>(({
|
|
|
13
13
|
labelPosition = 'right',
|
|
14
14
|
intent = 'primary',
|
|
15
15
|
size = 'md',
|
|
16
|
+
// Spacing variants from FormInputStyleProps
|
|
17
|
+
margin,
|
|
18
|
+
marginVertical,
|
|
19
|
+
marginHorizontal,
|
|
16
20
|
style,
|
|
17
21
|
testID,
|
|
18
22
|
}, ref) => {
|
|
@@ -20,6 +24,9 @@ const Switch = forwardRef<ComponentRef<typeof Pressable>, SwitchProps>(({
|
|
|
20
24
|
size,
|
|
21
25
|
disabled,
|
|
22
26
|
position: labelPosition,
|
|
27
|
+
margin,
|
|
28
|
+
marginVertical,
|
|
29
|
+
marginHorizontal,
|
|
23
30
|
});
|
|
24
31
|
|
|
25
32
|
const progress = useSharedValue(checked ? 1 : 0);
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
import { Theme, StylesheetStyles, Intent, Size} from '@idealyst/theme';
|
|
3
3
|
import { buildSizeVariants } from '../utils/buildSizeVariants';
|
|
4
|
+
import {
|
|
5
|
+
buildMarginVariants,
|
|
6
|
+
buildMarginVerticalVariants,
|
|
7
|
+
buildMarginHorizontalVariants,
|
|
8
|
+
} from '../utils/buildViewStyleVariants';
|
|
4
9
|
import { SwitchIntentVariant, SwitchSizeVariant } from './types';
|
|
5
10
|
|
|
6
11
|
function createTrackSizeVariants(theme: Theme) {
|
|
@@ -130,6 +135,12 @@ export const switchStyles = StyleSheet.create((theme: Theme) => {
|
|
|
130
135
|
flexDirection: 'row',
|
|
131
136
|
alignItems: 'center',
|
|
132
137
|
gap: 8,
|
|
138
|
+
variants: {
|
|
139
|
+
// Spacing variants from FormInputStyleProps
|
|
140
|
+
margin: buildMarginVariants(theme),
|
|
141
|
+
marginVertical: buildMarginVerticalVariants(theme),
|
|
142
|
+
marginHorizontal: buildMarginHorizontalVariants(theme),
|
|
143
|
+
},
|
|
133
144
|
},
|
|
134
145
|
switchContainer: {
|
|
135
146
|
justifyContent: 'center',
|
|
@@ -16,6 +16,10 @@ const Switch = forwardRef<HTMLDivElement | HTMLButtonElement, SwitchProps>(({
|
|
|
16
16
|
size = 'md',
|
|
17
17
|
enabledIcon,
|
|
18
18
|
disabledIcon,
|
|
19
|
+
// Spacing variants from FormInputStyleProps
|
|
20
|
+
margin,
|
|
21
|
+
marginVertical,
|
|
22
|
+
marginHorizontal,
|
|
19
23
|
style,
|
|
20
24
|
testID,
|
|
21
25
|
}, ref) => {
|
|
@@ -30,6 +34,9 @@ const Switch = forwardRef<HTMLDivElement | HTMLButtonElement, SwitchProps>(({
|
|
|
30
34
|
size: size as 'sm' | 'md' | 'lg',
|
|
31
35
|
disabled: disabled as boolean,
|
|
32
36
|
position: labelPosition as 'left' | 'right',
|
|
37
|
+
margin,
|
|
38
|
+
marginVertical,
|
|
39
|
+
marginHorizontal,
|
|
33
40
|
});
|
|
34
41
|
|
|
35
42
|
const trackProps = getWebProps([switchStyles.switchTrack({ checked, intent })]);
|
package/src/Switch/types.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
2
|
import type { IconName } from '../Icon/icon-types';
|
|
3
3
|
import { Intent, Size } from '@idealyst/theme';
|
|
4
|
+
import { FormInputStyleProps } from '../utils/viewStyleProps';
|
|
4
5
|
|
|
5
6
|
// Component-specific type aliases for future extensibility
|
|
6
7
|
export type SwitchIntentVariant = Intent;
|
|
7
8
|
export type SwitchSizeVariant = Size;
|
|
8
9
|
|
|
9
|
-
export interface SwitchProps {
|
|
10
|
+
export interface SwitchProps extends FormInputStyleProps {
|
|
10
11
|
checked?: boolean;
|
|
11
12
|
onCheckedChange?: (checked: boolean) => void;
|
|
12
13
|
disabled?: boolean;
|
|
@@ -17,6 +17,14 @@ const TabBar = forwardRef<View, TabBarProps>(({
|
|
|
17
17
|
type = 'default',
|
|
18
18
|
size = 'md',
|
|
19
19
|
pillMode = 'light',
|
|
20
|
+
// Spacing variants from ContainerStyleProps
|
|
21
|
+
gap,
|
|
22
|
+
padding,
|
|
23
|
+
paddingVertical,
|
|
24
|
+
paddingHorizontal,
|
|
25
|
+
margin,
|
|
26
|
+
marginVertical,
|
|
27
|
+
marginHorizontal,
|
|
20
28
|
style,
|
|
21
29
|
testID,
|
|
22
30
|
}, ref) => {
|
|
@@ -77,7 +85,17 @@ const TabBar = forwardRef<View, TabBarProps>(({
|
|
|
77
85
|
});
|
|
78
86
|
|
|
79
87
|
// Apply container and indicator types right before rendering
|
|
80
|
-
tabBarContainerStyles.useVariants({
|
|
88
|
+
tabBarContainerStyles.useVariants({
|
|
89
|
+
size,
|
|
90
|
+
pillMode,
|
|
91
|
+
gap,
|
|
92
|
+
padding,
|
|
93
|
+
paddingVertical,
|
|
94
|
+
paddingHorizontal,
|
|
95
|
+
margin,
|
|
96
|
+
marginVertical,
|
|
97
|
+
marginHorizontal,
|
|
98
|
+
});
|
|
81
99
|
tabBarIndicatorStyles.useVariants({ pillMode });
|
|
82
100
|
|
|
83
101
|
return (
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
import { Theme, StylesheetStyles, CompoundVariants, Size } from '@idealyst/theme';
|
|
3
3
|
import { buildSizeVariants } from '../utils/buildSizeVariants';
|
|
4
|
+
import {
|
|
5
|
+
buildGapVariants,
|
|
6
|
+
buildPaddingVariants,
|
|
7
|
+
buildPaddingVerticalVariants,
|
|
8
|
+
buildPaddingHorizontalVariants,
|
|
9
|
+
buildMarginVariants,
|
|
10
|
+
buildMarginVerticalVariants,
|
|
11
|
+
buildMarginHorizontalVariants,
|
|
12
|
+
} from '../utils/buildViewStyleVariants';
|
|
4
13
|
import { TabBarPillMode, TabBarSizeVariant, TabBarType } from './types';
|
|
5
14
|
|
|
6
15
|
type TabBarContainerVariants = {
|
|
@@ -229,6 +238,14 @@ const createContainerStyles = (theme: Theme) => {
|
|
|
229
238
|
light: {},
|
|
230
239
|
dark: {},
|
|
231
240
|
},
|
|
241
|
+
// Spacing variants from ContainerStyleProps
|
|
242
|
+
gap: buildGapVariants(theme),
|
|
243
|
+
padding: buildPaddingVariants(theme),
|
|
244
|
+
paddingVertical: buildPaddingVerticalVariants(theme),
|
|
245
|
+
paddingHorizontal: buildPaddingHorizontalVariants(theme),
|
|
246
|
+
margin: buildMarginVariants(theme),
|
|
247
|
+
marginVertical: buildMarginVerticalVariants(theme),
|
|
248
|
+
marginHorizontal: buildMarginHorizontalVariants(theme),
|
|
232
249
|
} as const,
|
|
233
250
|
compoundVariants: createContainerCompoundVariants(theme),
|
|
234
251
|
} as const;
|
|
@@ -79,6 +79,14 @@ const TabBar: React.FC<TabBarProps> = ({
|
|
|
79
79
|
type = 'standard',
|
|
80
80
|
size = 'md',
|
|
81
81
|
pillMode = 'light',
|
|
82
|
+
// Spacing variants from ContainerStyleProps
|
|
83
|
+
gap,
|
|
84
|
+
padding,
|
|
85
|
+
paddingVertical,
|
|
86
|
+
paddingHorizontal,
|
|
87
|
+
margin,
|
|
88
|
+
marginVertical,
|
|
89
|
+
marginHorizontal,
|
|
82
90
|
style,
|
|
83
91
|
testID,
|
|
84
92
|
}) => {
|
|
@@ -139,7 +147,18 @@ const TabBar: React.FC<TabBarProps> = ({
|
|
|
139
147
|
};
|
|
140
148
|
|
|
141
149
|
// Apply container and indicator types
|
|
142
|
-
tabBarContainerStyles.useVariants({
|
|
150
|
+
tabBarContainerStyles.useVariants({
|
|
151
|
+
type,
|
|
152
|
+
size,
|
|
153
|
+
pillMode,
|
|
154
|
+
gap,
|
|
155
|
+
padding,
|
|
156
|
+
paddingVertical,
|
|
157
|
+
paddingHorizontal,
|
|
158
|
+
margin,
|
|
159
|
+
marginVertical,
|
|
160
|
+
marginHorizontal,
|
|
161
|
+
});
|
|
143
162
|
const containerProps = getWebProps([tabBarContainerStyles.container, style as any]);
|
|
144
163
|
|
|
145
164
|
tabBarIndicatorStyles.useVariants({ type, pillMode });
|
package/src/TabBar/types.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Size } from '@idealyst/theme';
|
|
2
2
|
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { ContainerStyleProps } from '../utils/viewStyleProps';
|
|
3
4
|
|
|
4
5
|
// Component-specific type aliases for future extensibility
|
|
5
6
|
export type TabBarSizeVariant = Size;
|
|
@@ -12,7 +13,7 @@ export interface TabBarItem {
|
|
|
12
13
|
disabled?: boolean;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
export interface TabBarProps {
|
|
16
|
+
export interface TabBarProps extends ContainerStyleProps {
|
|
16
17
|
items: TabBarItem[];
|
|
17
18
|
value?: string;
|
|
18
19
|
defaultValue?: string;
|
|
@@ -10,6 +10,14 @@ function TableInner<T = any>({
|
|
|
10
10
|
size = 'md',
|
|
11
11
|
stickyHeader = false,
|
|
12
12
|
onRowPress,
|
|
13
|
+
// Spacing variants from ContainerStyleProps
|
|
14
|
+
gap,
|
|
15
|
+
padding,
|
|
16
|
+
paddingVertical,
|
|
17
|
+
paddingHorizontal,
|
|
18
|
+
margin,
|
|
19
|
+
marginVertical,
|
|
20
|
+
marginHorizontal,
|
|
13
21
|
style,
|
|
14
22
|
testID,
|
|
15
23
|
}: TableProps<T>, ref: React.Ref<ScrollView>) {
|
|
@@ -17,6 +25,13 @@ function TableInner<T = any>({
|
|
|
17
25
|
tableStyles.useVariants({
|
|
18
26
|
type,
|
|
19
27
|
size,
|
|
28
|
+
gap,
|
|
29
|
+
padding,
|
|
30
|
+
paddingVertical,
|
|
31
|
+
paddingHorizontal,
|
|
32
|
+
margin,
|
|
33
|
+
marginVertical,
|
|
34
|
+
marginHorizontal,
|
|
20
35
|
});
|
|
21
36
|
|
|
22
37
|
// Helper to get cell value
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
import { Theme, StylesheetStyles, CompoundVariants, Size } from '@idealyst/theme';
|
|
3
3
|
import { buildSizeVariants } from '../utils/buildSizeVariants';
|
|
4
|
+
import {
|
|
5
|
+
buildGapVariants,
|
|
6
|
+
buildPaddingVariants,
|
|
7
|
+
buildPaddingVerticalVariants,
|
|
8
|
+
buildPaddingHorizontalVariants,
|
|
9
|
+
buildMarginVariants,
|
|
10
|
+
buildMarginVerticalVariants,
|
|
11
|
+
buildMarginHorizontalVariants,
|
|
12
|
+
} from '../utils/buildViewStyleVariants';
|
|
4
13
|
|
|
5
14
|
type TableType = 'default' | 'bordered' | 'striped';
|
|
6
15
|
|
|
@@ -165,6 +174,14 @@ const createContainerStyles = (theme: Theme) => {
|
|
|
165
174
|
},
|
|
166
175
|
variants: {
|
|
167
176
|
type: createContainerTypeVariants(theme),
|
|
177
|
+
// Spacing variants from ContainerStyleProps
|
|
178
|
+
gap: buildGapVariants(theme),
|
|
179
|
+
padding: buildPaddingVariants(theme),
|
|
180
|
+
paddingVertical: buildPaddingVerticalVariants(theme),
|
|
181
|
+
paddingHorizontal: buildPaddingHorizontalVariants(theme),
|
|
182
|
+
margin: buildMarginVariants(theme),
|
|
183
|
+
marginVertical: buildMarginVerticalVariants(theme),
|
|
184
|
+
marginHorizontal: buildMarginHorizontalVariants(theme),
|
|
168
185
|
},
|
|
169
186
|
} as const;
|
|
170
187
|
}
|
|
@@ -221,6 +238,8 @@ const createRowStyles = (theme: Theme) => {
|
|
|
221
238
|
|
|
222
239
|
const createHeaderCellStyles = (theme: Theme) => {
|
|
223
240
|
return {
|
|
241
|
+
flexDirection: 'row',
|
|
242
|
+
alignItems: 'center',
|
|
224
243
|
textAlign: 'left',
|
|
225
244
|
fontWeight: '600',
|
|
226
245
|
color: theme.colors.text.primary,
|
|
@@ -235,12 +254,15 @@ const createHeaderCellStyles = (theme: Theme) => {
|
|
|
235
254
|
align: {
|
|
236
255
|
left: {
|
|
237
256
|
textAlign: 'left',
|
|
257
|
+
justifyContent: 'flex-start',
|
|
238
258
|
},
|
|
239
259
|
center: {
|
|
240
260
|
textAlign: 'center',
|
|
261
|
+
justifyContent: 'center',
|
|
241
262
|
},
|
|
242
263
|
right: {
|
|
243
264
|
textAlign: 'right',
|
|
265
|
+
justifyContent: 'flex-end',
|
|
244
266
|
},
|
|
245
267
|
},
|
|
246
268
|
type: createHeaderCellTypeVariants(theme),
|
|
@@ -250,6 +272,8 @@ const createHeaderCellStyles = (theme: Theme) => {
|
|
|
250
272
|
|
|
251
273
|
const createCellStyles = (theme: Theme) => {
|
|
252
274
|
return {
|
|
275
|
+
flexDirection: 'row',
|
|
276
|
+
alignItems: 'center',
|
|
253
277
|
textAlign: 'left',
|
|
254
278
|
color: theme.colors.text.primary,
|
|
255
279
|
variants: {
|
|
@@ -257,12 +281,15 @@ const createCellStyles = (theme: Theme) => {
|
|
|
257
281
|
align: {
|
|
258
282
|
left: {
|
|
259
283
|
textAlign: 'left',
|
|
284
|
+
justifyContent: 'flex-start',
|
|
260
285
|
},
|
|
261
286
|
center: {
|
|
262
287
|
textAlign: 'center',
|
|
288
|
+
justifyContent: 'center',
|
|
263
289
|
},
|
|
264
290
|
right: {
|
|
265
291
|
textAlign: 'right',
|
|
292
|
+
justifyContent: 'flex-end',
|
|
266
293
|
},
|
|
267
294
|
},
|
|
268
295
|
type: createCellTypeVariants(theme),
|
package/src/Table/Table.web.tsx
CHANGED
|
@@ -10,6 +10,14 @@ function Table<T = any>({
|
|
|
10
10
|
size = 'md',
|
|
11
11
|
stickyHeader = false,
|
|
12
12
|
onRowPress,
|
|
13
|
+
// Spacing variants from ContainerStyleProps
|
|
14
|
+
gap,
|
|
15
|
+
padding,
|
|
16
|
+
paddingVertical,
|
|
17
|
+
paddingHorizontal,
|
|
18
|
+
margin,
|
|
19
|
+
marginVertical,
|
|
20
|
+
marginHorizontal,
|
|
13
21
|
style,
|
|
14
22
|
testID,
|
|
15
23
|
}: TableProps<T>) {
|
|
@@ -17,6 +25,13 @@ function Table<T = any>({
|
|
|
17
25
|
tableStyles.useVariants({
|
|
18
26
|
type,
|
|
19
27
|
size,
|
|
28
|
+
gap,
|
|
29
|
+
padding,
|
|
30
|
+
paddingVertical,
|
|
31
|
+
paddingHorizontal,
|
|
32
|
+
margin,
|
|
33
|
+
marginVertical,
|
|
34
|
+
marginHorizontal,
|
|
20
35
|
});
|
|
21
36
|
|
|
22
37
|
const containerProps = getWebProps([tableStyles.container, style as any]);
|
package/src/Table/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
import { Size } from '@idealyst/theme';
|
|
4
|
+
import { ContainerStyleProps } from '../utils/viewStyleProps';
|
|
4
5
|
|
|
5
6
|
// Component-specific type aliases for future extensibility
|
|
6
7
|
export type TableSizeVariant = Size;
|
|
@@ -16,7 +17,7 @@ export interface TableColumn<T = any> {
|
|
|
16
17
|
align?: TableAlignVariant;
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
export interface TableProps<T = any> {
|
|
20
|
+
export interface TableProps<T = any> extends ContainerStyleProps {
|
|
20
21
|
columns: TableColumn<T>[];
|
|
21
22
|
data: T[];
|
|
22
23
|
type?: TableType;
|