@smart-react-components/ui 2.0.0-alpha-117 → 2.0.0-alpha-119

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.
@@ -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: props.waveEffectPalette }, AnchorEl) : AnchorEl;
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: props.waveEffectPalette }, AnchorEl) : AnchorEl;
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.isDark), [props.palette, props.isOutline, props.isSoft, props.isLink, props.waveEffectPalette, theme.$.vars.isDarkMode]);
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) {
@@ -47,7 +47,7 @@ exports.default = (0, styled_components_1.default)(Button_1.default).attrs(({ ha
47
47
  align-items: stretch;
48
48
  background: transparent;
49
49
  border: 0;
50
- border-radius: ${(isFixedSize && shape === 'rounded') ? '100%' : '0'};
50
+ border-radius: ${(isFixedSize && shape === 'rounded') ? '100%' : theme.$.radius.button[shape]};
51
51
  cursor: ${(!isDisabled && !isLoading) ? theme.$.cursor.button : 'default'};
52
52
  font-family: ${theme.$.fontFamily.button};
53
53
  position: relative;
@@ -252,6 +252,20 @@ exports.default = (0, styled_components_1.default)(Button_1.default).attrs(({ ha
252
252
  `
253
253
  : ''}
254
254
 
255
+ ${hasSeparatedLeftAddon
256
+ ? `
257
+ border-top-left-radius: 0;
258
+ border-bottom-left-radius: 0;
259
+ `
260
+ : ''}
261
+
262
+ ${hasSeparatedRightAddon
263
+ ? `
264
+ border-top-right-radius: 0;
265
+ border-bottom-right-radius: 0;
266
+ `
267
+ : ''}
268
+
255
269
  .src-button-content {
256
270
  border-radius: ${(isFixedSize && shape === 'rounded') ? '100%' : theme.$.radius.button[shape]};
257
271
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smart-react-components/ui",
3
- "version": "2.0.0-alpha-117",
3
+ "version": "2.0.0-alpha-119",
4
4
  "license": "MIT",
5
5
  "main": "index.js",
6
6
  "description": "SRC UI includes React and Styled components.",
@@ -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, considered the body element uses the general background color in the color attributes.
6
- * If palette is light and the dark mode is disabled, both the body background and the effect will be light color
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 the background is transparent except from the above condition or uses the soft colors, defaults to the palette value to emphasize the palette color during the effect.
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
  */
@@ -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, considered the body element uses the general background color in the color attributes.
8
- * If palette is light and the dark mode is disabled, both the body background and the effect will be light color
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 the background is transparent except from the above condition or uses the soft colors, defaults to the palette value to emphasize the palette color during the effect.
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 ((props.isOutline || props.isLink) && ['dynamic', '!dynamic', 'light', 'dark'].includes(props.palette)) {
18
+ if (props.isOutline || props.isLink) {
22
19
  return isDark ? 'light' : 'dark';
23
20
  }
24
- switch (props.palette) {
25
- case 'dynamic':
26
- return '!dynamic';
27
- case '!dynamic':
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;