@smart-react-components/ui 2.0.0-alpha-118 → 2.0.0-alpha-120
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/Breadcrumb/BreadcrumbItem.js +5 -1
- package/Breadcrumb/BreadcrumbLink.js +5 -1
- package/Button/index.js +1 -1
- package/components/Checkbox/CheckboxElement.js +21 -16
- package/components/Form/FormInlineLabel.js +1 -1
- package/package.json +7 -7
- package/util/wave-effect.d.ts +4 -7
- package/util/wave-effect.js +15 -19
|
@@ -7,11 +7,15 @@ const A_1 = __importDefault(require("@smart-react-components/core/Element/A"));
|
|
|
7
7
|
const element_props_1 = __importDefault(require("@smart-react-components/core/element-props"));
|
|
8
8
|
const click_events_1 = __importDefault(require("@smart-react-components/core/element-props/click-events"));
|
|
9
9
|
const react_1 = __importDefault(require("react"));
|
|
10
|
+
const styled_components_1 = require("styled-components");
|
|
10
11
|
const BreadcrumbItemElement_1 = __importDefault(require("../components/Breadcrumb/BreadcrumbItemElement"));
|
|
12
|
+
const wave_effect_1 = require("../util/wave-effect");
|
|
11
13
|
const WaveEffect_1 = __importDefault(require("../WaveEffect"));
|
|
12
14
|
const BreadcrumbItem = (props) => {
|
|
15
|
+
const theme = (0, styled_components_1.useTheme)();
|
|
16
|
+
const waveEffectPalette = react_1.default.useMemo(() => (0, wave_effect_1.getWaveEffectPalette)(props, theme.$.vars.isDarkMode), [props.palette, props.isOutline, props.isSoft, props.waveEffectPalette, theme.$.vars.isDarkMode]);
|
|
13
17
|
const AnchorEl = (react_1.default.createElement(A_1.default, Object.assign({}, (0, element_props_1.default)(props, [click_events_1.default]), props.elementProps), props.children));
|
|
14
|
-
const El = props.hasWaveEffect ? react_1.default.createElement(WaveEffect_1.default, { palette:
|
|
18
|
+
const El = props.hasWaveEffect ? react_1.default.createElement(WaveEffect_1.default, { palette: waveEffectPalette }, AnchorEl) : AnchorEl;
|
|
15
19
|
return (react_1.default.createElement(BreadcrumbItemElement_1.default, { isActive: props.isActive, isDisabled: props.isDisabled, isOutline: props.isOutline, isSoft: props.isSoft, palette: props.palette, separator: props.separator, shape: props.shape }, El));
|
|
16
20
|
};
|
|
17
21
|
exports.default = BreadcrumbItem;
|
|
@@ -6,9 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const A_1 = __importDefault(require("@smart-react-components/core/Element/A"));
|
|
7
7
|
const useLink_1 = __importDefault(require("@smart-react-components/router/hooks/useLink"));
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const styled_components_1 = require("styled-components");
|
|
9
10
|
const WaveEffect_1 = __importDefault(require("../WaveEffect"));
|
|
10
11
|
const BreadcrumbItemElement_1 = __importDefault(require("../components/Breadcrumb/BreadcrumbItemElement"));
|
|
12
|
+
const wave_effect_1 = require("../util/wave-effect");
|
|
11
13
|
const BreadcrumbLink = (props) => {
|
|
14
|
+
const theme = (0, styled_components_1.useTheme)();
|
|
15
|
+
const waveEffectPalette = react_1.default.useMemo(() => (0, wave_effect_1.getWaveEffectPalette)(props, theme.$.vars.isDarkMode), [props.palette, props.isOutline, props.isSoft, props.waveEffectPalette, theme.$.vars.isDarkMode]);
|
|
12
16
|
const { children, handleOnClick, isActive } = (0, useLink_1.default)({
|
|
13
17
|
children: props.children,
|
|
14
18
|
isDisabled: props.isDisabled,
|
|
@@ -18,7 +22,7 @@ const BreadcrumbLink = (props) => {
|
|
|
18
22
|
to: props.to,
|
|
19
23
|
});
|
|
20
24
|
const AnchorEl = (react_1.default.createElement(A_1.default, Object.assign({}, props.elementProps, { href: props.to, onClick: handleOnClick }), children));
|
|
21
|
-
const El = props.hasWaveEffect ? react_1.default.createElement(WaveEffect_1.default, { palette:
|
|
25
|
+
const El = props.hasWaveEffect ? react_1.default.createElement(WaveEffect_1.default, { palette: waveEffectPalette }, AnchorEl) : AnchorEl;
|
|
22
26
|
return (react_1.default.createElement(BreadcrumbItemElement_1.default, { isActive: isActive, isDisabled: props.isDisabled, isOutline: props.isOutline, isSoft: props.isSoft, palette: props.palette, separator: props.separator, shape: props.shape }, El));
|
|
23
27
|
};
|
|
24
28
|
BreadcrumbLink.defaultProps = {
|
package/Button/index.js
CHANGED
|
@@ -40,7 +40,7 @@ const Button = react_1.default.forwardRef((props, forwardRef) => {
|
|
|
40
40
|
waveEffectPalette: props.waveEffectPalette,
|
|
41
41
|
},
|
|
42
42
|
});
|
|
43
|
-
const waveEffectPalette = react_1.default.useMemo(() => (0, wave_effect_1.getWaveEffectPalette)(props, theme.$.vars.
|
|
43
|
+
const waveEffectPalette = react_1.default.useMemo(() => (0, wave_effect_1.getWaveEffectPalette)(props, theme.$.vars.isDarkMode), [props.palette, props.isOutline, props.isSoft, props.isLink, props.waveEffectPalette, theme.$.vars.isDarkMode]);
|
|
44
44
|
const getLoadingEl = () => {
|
|
45
45
|
var _a;
|
|
46
46
|
if (!props.loading) {
|
|
@@ -36,7 +36,7 @@ const Svg = styled_components_1.default.svg.attrs({
|
|
|
36
36
|
|
|
37
37
|
> path {
|
|
38
38
|
fill: transparent;
|
|
39
|
-
stroke: ${theme.$.color.
|
|
39
|
+
stroke: ${theme.$.color.white};
|
|
40
40
|
stroke-width: 4px;
|
|
41
41
|
stroke-dasharray: 36px;
|
|
42
42
|
stroke-dashoffset: 36px;
|
|
@@ -46,7 +46,7 @@ const Svg = styled_components_1.default.svg.attrs({
|
|
|
46
46
|
const IndeterminateMark = styled_components_1.default.div.attrs({
|
|
47
47
|
className: 'src-checkbox-indeterminate-mark',
|
|
48
48
|
})(({ theme }) => `
|
|
49
|
-
background: ${theme.$.color.
|
|
49
|
+
background: ${theme.$.color.white};
|
|
50
50
|
height: 2px;
|
|
51
51
|
margin-top: -1px;
|
|
52
52
|
opacity: 0;
|
|
@@ -74,7 +74,8 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ child
|
|
|
74
74
|
|
|
75
75
|
.src-checkbox-container {
|
|
76
76
|
border-radius: ${theme.$.radius.checkbox[shape]};
|
|
77
|
-
|
|
77
|
+
transition: border-color 200ms 0s ease-in-out;
|
|
78
|
+
|
|
78
79
|
${!isOutline
|
|
79
80
|
? `
|
|
80
81
|
background: ${theme.$.color.dynamic.accent};
|
|
@@ -88,22 +89,26 @@ exports.default = (0, styled_components_1.default)(Div_1.default).attrs(({ child
|
|
|
88
89
|
|
|
89
90
|
${isChecked
|
|
90
91
|
? `
|
|
91
|
-
.src-checkbox-
|
|
92
|
-
|
|
93
|
-
}
|
|
92
|
+
.src-checkbox-container {
|
|
93
|
+
border-color: ${!isSoft ? theme.$.palette[palette].main : theme.$.palette[palette].soft};
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
.src-checkbox-rectangle {
|
|
96
|
+
background: ${!isSoft ? theme.$.palette[palette].main : theme.$.palette[palette].soft};
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
${!isIndeterminate
|
|
96
100
|
? `
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
.src-checkbox-svg > path {
|
|
102
|
+
stroke-dashoffset: 0;
|
|
103
|
+
}
|
|
104
|
+
`
|
|
101
105
|
: `
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
.src-checkbox-indeterminate-mark {
|
|
107
|
+
opacity: 1;
|
|
108
|
+
transform: scaleX(1);
|
|
109
|
+
}
|
|
110
|
+
`}
|
|
111
|
+
}
|
|
107
112
|
`
|
|
108
113
|
: ''}
|
|
109
114
|
`);
|
|
@@ -36,7 +36,7 @@ exports.default = (0, styled_components_1.default)(Label_1.default).attrs(({ isB
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
> span {
|
|
39
|
-
color: ${theme.$.color.dynamic.
|
|
39
|
+
color: ${theme.$.color.dynamic.bodyFont};
|
|
40
40
|
display: inline-flex;
|
|
41
41
|
flex: 1 1 auto;
|
|
42
42
|
font-family: ${theme.$.fontFamily.form};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smart-react-components/ui",
|
|
3
|
-
"version": "2.0.0-alpha-
|
|
3
|
+
"version": "2.0.0-alpha-120",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"description": "SRC UI includes React and Styled components.",
|
|
@@ -64,9 +64,9 @@
|
|
|
64
64
|
"test": "jest"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@smart-react-components/core": "2.0.0-alpha-
|
|
68
|
-
"@smart-react-components/router": "2.0.0-alpha-
|
|
69
|
-
"@smart-react-components/transition": "2.0.0-alpha-
|
|
67
|
+
"@smart-react-components/core": "2.0.0-alpha-45",
|
|
68
|
+
"@smart-react-components/router": "2.0.0-alpha-42",
|
|
69
|
+
"@smart-react-components/transition": "2.0.0-alpha-39",
|
|
70
70
|
"@testing-library/react": "13.4.0",
|
|
71
71
|
"@types/jest": "29.0.1",
|
|
72
72
|
"@types/react": "18.0.19",
|
|
@@ -83,9 +83,9 @@
|
|
|
83
83
|
"typescript": "4.8.3"
|
|
84
84
|
},
|
|
85
85
|
"peerDependencies": {
|
|
86
|
-
"@smart-react-components/core": "^2.0.0-alpha-
|
|
87
|
-
"@smart-react-components/router": "^2.0.0-alpha-
|
|
88
|
-
"@smart-react-components/transition": "^2.0.0-alpha-
|
|
86
|
+
"@smart-react-components/core": "^2.0.0-alpha-45",
|
|
87
|
+
"@smart-react-components/router": "^2.0.0-alpha-42",
|
|
88
|
+
"@smart-react-components/transition": "^2.0.0-alpha-39",
|
|
89
89
|
"react": "^18.2.0",
|
|
90
90
|
"react-dom": "^18.2.0",
|
|
91
91
|
"styled-components": "^5.3.5"
|
package/util/wave-effect.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { PaletteProp } from '@smart-react-components/core/types';
|
|
2
2
|
/**
|
|
3
|
-
* If waveEffectPalette is given returns it however if not, generates a default palette for the wave effect.
|
|
3
|
+
* If waveEffectPalette is given, returns it however if not, generates a default palette for the wave effect.
|
|
4
4
|
*
|
|
5
|
-
* If the background is transparent,
|
|
6
|
-
*
|
|
7
|
-
* so defaults the wave palette to dark.
|
|
8
|
-
* The same goes for vice-versa. If the palette is dark and the dark mode is enabled, both the body background and the effect will be dark color
|
|
9
|
-
* then defaults the wave palette to light.
|
|
5
|
+
* If the background is transparent, consideres the body element uses the general background color in the color attributes.
|
|
6
|
+
* That's why the wave effect palette is the opposite of the general background color.
|
|
10
7
|
*
|
|
11
|
-
* If
|
|
8
|
+
* If palette is light, defaults the wave palette to dark or vice-versa.
|
|
12
9
|
*
|
|
13
10
|
* If none of the above conditions are met, defaults to light since most of the default palette main colors are harmonious with the light effect color.
|
|
14
11
|
*/
|
package/util/wave-effect.js
CHANGED
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getWaveEffectPalette = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* If waveEffectPalette is given returns it however if not, generates a default palette for the wave effect.
|
|
5
|
+
* If waveEffectPalette is given, returns it however if not, generates a default palette for the wave effect.
|
|
6
6
|
*
|
|
7
|
-
* If the background is transparent,
|
|
8
|
-
*
|
|
9
|
-
* so defaults the wave palette to dark.
|
|
10
|
-
* The same goes for vice-versa. If the palette is dark and the dark mode is enabled, both the body background and the effect will be dark color
|
|
11
|
-
* then defaults the wave palette to light.
|
|
7
|
+
* If the background is transparent, consideres the body element uses the general background color in the color attributes.
|
|
8
|
+
* That's why the wave effect palette is the opposite of the general background color.
|
|
12
9
|
*
|
|
13
|
-
* If
|
|
10
|
+
* If palette is light, defaults the wave palette to dark or vice-versa.
|
|
14
11
|
*
|
|
15
12
|
* If none of the above conditions are met, defaults to light since most of the default palette main colors are harmonious with the light effect color.
|
|
16
13
|
*/
|
|
@@ -18,20 +15,19 @@ const getWaveEffectPalette = (props, isDark) => {
|
|
|
18
15
|
if (props.waveEffectPalette) {
|
|
19
16
|
return props.waveEffectPalette;
|
|
20
17
|
}
|
|
21
|
-
if (
|
|
18
|
+
if (props.isOutline || props.isLink) {
|
|
22
19
|
return isDark ? 'light' : 'dark';
|
|
23
20
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return 'dynamic';
|
|
29
|
-
case 'light':
|
|
30
|
-
return 'dark';
|
|
31
|
-
case 'dark':
|
|
32
|
-
return 'light';
|
|
33
|
-
default:
|
|
34
|
-
return (props.isSoft || props.isOutline || props.isLink) ? props.palette : 'light';
|
|
21
|
+
if (props.palette === 'light'
|
|
22
|
+
|| (props.palette === 'dynamic' && !isDark)
|
|
23
|
+
|| (props.palette === '!dynamic' && isDark)) {
|
|
24
|
+
return 'dark';
|
|
35
25
|
}
|
|
26
|
+
if (props.palette === 'dark'
|
|
27
|
+
|| (props.palette === 'dynamic' && isDark)
|
|
28
|
+
|| (props.palette === '!dynamic' && !isDark)) {
|
|
29
|
+
return 'light';
|
|
30
|
+
}
|
|
31
|
+
return 'light';
|
|
36
32
|
};
|
|
37
33
|
exports.getWaveEffectPalette = getWaveEffectPalette;
|