@tecsinapse/react-core 1.17.2 → 1.18.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/CHANGELOG.md +36 -0
- package/dist/components/atoms/Switch/Switch.js.map +1 -1
- package/dist/components/molecules/Grid/functions.d.ts +3 -0
- package/dist/components/molecules/Grid/functions.js +21 -0
- package/dist/components/molecules/Grid/functions.js.map +1 -0
- package/dist/components/molecules/Grid/index.d.ts +42 -2
- package/dist/components/molecules/Grid/index.js +6 -13
- package/dist/components/molecules/Grid/index.js.map +1 -1
- package/dist/components/molecules/IconTextButton/IconComponent.d.ts +9 -0
- package/dist/components/molecules/IconTextButton/IconComponent.js +28 -0
- package/dist/components/molecules/IconTextButton/IconComponent.js.map +1 -0
- package/dist/components/molecules/IconTextButton/IconTextButton.d.ts +10 -0
- package/dist/components/molecules/IconTextButton/IconTextButton.js +4 -0
- package/dist/components/molecules/IconTextButton/IconTextButton.js.map +1 -0
- package/dist/components/molecules/IconTextButton/index.d.ts +2 -0
- package/dist/components/molecules/IconTextButton/index.js +16 -0
- package/dist/components/molecules/IconTextButton/index.js.map +1 -0
- package/dist/components/molecules/IconTextButton/styled.d.ts +4 -0
- package/dist/components/molecules/{Grid/Item/index.js → IconTextButton/styled.js} +19 -5
- package/dist/components/molecules/IconTextButton/styled.js.map +1 -0
- package/dist/components/molecules/LabeledSwitch/LabeledSwitch.d.ts +7 -0
- package/dist/components/molecules/LabeledSwitch/LabeledSwitch.js +4 -0
- package/dist/components/molecules/LabeledSwitch/LabeledSwitch.js.map +1 -0
- package/dist/components/molecules/LabeledSwitch/index.d.ts +1 -0
- package/dist/components/molecules/LabeledSwitch/index.js +10 -0
- package/dist/components/molecules/LabeledSwitch/index.js.map +1 -0
- package/dist/hooks/useDebouncedState.js +1 -1
- package/dist/hooks/useDebouncedState.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.js +44 -30
- package/dist/index.js.map +1 -1
- package/dist/styles/definitions.d.ts +2 -1
- package/dist/styles/definitions.js +7 -1
- package/dist/styles/definitions.js.map +1 -1
- package/dist/styles/light.js +2 -1
- package/dist/styles/light.js.map +1 -1
- package/dist/types/defaults.d.ts +8 -2
- package/dist/utils/index.d.ts +5 -4
- package/dist/utils/index.js +28 -19
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/variantComplement.d.ts +6 -0
- package/dist/utils/variantComplement.js +35 -0
- package/dist/utils/variantComplement.js.map +1 -0
- package/package.json +5 -5
- package/src/components/atoms/Switch/Switch.tsx +38 -18
- package/src/components/molecules/Grid/functions.ts +29 -0
- package/src/components/molecules/Grid/index.ts +66 -2
- package/src/components/molecules/IconTextButton/IconComponent.tsx +31 -0
- package/src/components/molecules/IconTextButton/IconTextButton.tsx +12 -0
- package/src/components/molecules/IconTextButton/index.ts +2 -0
- package/src/components/molecules/IconTextButton/styled.ts +20 -0
- package/src/components/molecules/LabeledSwitch/LabeledSwitch.tsx +9 -0
- package/src/components/molecules/LabeledSwitch/index.ts +1 -0
- package/src/hooks/useDebouncedState.ts +1 -1
- package/src/index.ts +15 -6
- package/src/styles/definitions.ts +8 -1
- package/src/styles/light.ts +2 -0
- package/src/types/defaults.ts +11 -1
- package/src/utils/index.ts +5 -4
- package/src/utils/variantComplement.ts +36 -0
- package/dist/components/molecules/Grid/Grid.d.ts +0 -15
- package/dist/components/molecules/Grid/Grid.js +0 -55
- package/dist/components/molecules/Grid/Grid.js.map +0 -1
- package/dist/components/molecules/Grid/Item/Item.d.ts +0 -30
- package/dist/components/molecules/Grid/Item/Item.js +0 -68
- package/dist/components/molecules/Grid/Item/Item.js.map +0 -1
- package/dist/components/molecules/Grid/Item/index.d.ts +0 -1
- package/dist/components/molecules/Grid/Item/index.js.map +0 -1
- package/src/components/molecules/Grid/Grid.stories.tsx +0 -132
- package/src/components/molecules/Grid/Grid.tsx +0 -87
- package/src/components/molecules/Grid/Item/Item.tsx +0 -93
- package/src/components/molecules/Grid/Item/index.ts +0 -1
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import { useTheme } from '../../../../hooks';
|
|
4
|
-
import { SpacingType } from '../../../../types/defaults';
|
|
5
|
-
import { extractNumbersFromString } from '../../../../utils';
|
|
6
|
-
|
|
7
|
-
type FlexPositioning = 'flex-start' | 'flex-end' | 'center';
|
|
8
|
-
type FlexAlignBase = FlexPositioning | 'stretch';
|
|
9
|
-
type FlexAlignType = FlexAlignBase | 'baseline';
|
|
10
|
-
type FlexSpacing = 'space-between' | 'space-around';
|
|
11
|
-
|
|
12
|
-
type PaddingPosition = 'top' | 'right' | 'bottom' | 'left';
|
|
13
|
-
|
|
14
|
-
export interface IGridItem {
|
|
15
|
-
children: React.ReactElement;
|
|
16
|
-
/** Number of columns to fill */
|
|
17
|
-
span: number;
|
|
18
|
-
/** You don't have to give this property since is inherited from Grid */
|
|
19
|
-
columns?: number;
|
|
20
|
-
loading?: boolean;
|
|
21
|
-
/** If your GridItem has a loading state, specify the component here (Skeleton) */
|
|
22
|
-
loadingComponent?: React.ReactElement;
|
|
23
|
-
/** Flex properties below */
|
|
24
|
-
alignContent?: FlexAlignBase | FlexSpacing;
|
|
25
|
-
alignItems?: FlexAlignType;
|
|
26
|
-
alignSelf?: 'auto' | FlexAlignType;
|
|
27
|
-
flex?: number;
|
|
28
|
-
flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
|
29
|
-
flexGrow?: number;
|
|
30
|
-
flexShrink?: number;
|
|
31
|
-
justifyContent?: FlexPositioning | FlexSpacing | 'space-evenly';
|
|
32
|
-
/** You don't have to give this property since is inherited from Grid */
|
|
33
|
-
spacing?:
|
|
34
|
-
| SpacingType
|
|
35
|
-
| {
|
|
36
|
-
top?: SpacingType;
|
|
37
|
-
right?: SpacingType;
|
|
38
|
-
bottom?: SpacingType;
|
|
39
|
-
left?: SpacingType;
|
|
40
|
-
};
|
|
41
|
-
/** Used to wrap children in a View when its style extrapolates the dimensions*/
|
|
42
|
-
wrapper?: boolean;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const GridItem = ({
|
|
46
|
-
children,
|
|
47
|
-
span,
|
|
48
|
-
columns = 12,
|
|
49
|
-
loadingComponent,
|
|
50
|
-
loading = false,
|
|
51
|
-
spacing: _spacing,
|
|
52
|
-
wrapper = false,
|
|
53
|
-
...rest
|
|
54
|
-
}: IGridItem) => {
|
|
55
|
-
const { spacing } = useTheme();
|
|
56
|
-
if (!React.Children.only(children)) {
|
|
57
|
-
throw new Error('The number of children in GridItem should be one');
|
|
58
|
-
}
|
|
59
|
-
if (loadingComponent && loading) {
|
|
60
|
-
return loadingComponent;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const getPadding = (pos: PaddingPosition) => {
|
|
64
|
-
if (_spacing) {
|
|
65
|
-
if (typeof _spacing === 'string')
|
|
66
|
-
return extractNumbersFromString(spacing[_spacing]);
|
|
67
|
-
else if (typeof _spacing === 'object' && _spacing[pos]) {
|
|
68
|
-
return extractNumbersFromString(spacing[_spacing[pos]!]);
|
|
69
|
-
} else return undefined;
|
|
70
|
-
} else return undefined;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const style = {
|
|
74
|
-
...rest,
|
|
75
|
-
boxSizing: 'border-box',
|
|
76
|
-
flexBasis: `${100 / (columns / span)}%`,
|
|
77
|
-
paddingTop: getPadding('top'),
|
|
78
|
-
paddingBottom: getPadding('bottom'),
|
|
79
|
-
paddingRight: getPadding('right'),
|
|
80
|
-
paddingLeft: getPadding('left'),
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
const clone = React.cloneElement(children, {
|
|
84
|
-
...children?.props,
|
|
85
|
-
style: wrapper
|
|
86
|
-
? children?.props.style
|
|
87
|
-
: { ...style, ...children?.props.style },
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
return wrapper ? <View style={style}>{clone}</View> : clone;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export default GridItem;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default as GridItem, IGridItem } from './Item';
|