@synerise/ds-button 0.17.14 → 0.17.16

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 CHANGED
@@ -3,6 +3,30 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.17.16](https://github.com/synerise/synerise-design/compare/@synerise/ds-button@0.17.15...@synerise/ds-button@0.17.16) (2023-05-23)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **button:** add readOnly styles to button ([e02c5f3](https://github.com/synerise/synerise-design/commit/e02c5f34963de704766e9f69bb775f0171a04a77))
12
+ * **card-tabs:** changes button creator height ([d822687](https://github.com/synerise/synerise-design/commit/d822687f69b513d5adb4e67ade2650d454909aae))
13
+
14
+
15
+
16
+
17
+
18
+ ## [0.17.15](https://github.com/synerise/synerise-design/compare/@synerise/ds-button@0.17.14...@synerise/ds-button@0.17.15) (2023-05-20)
19
+
20
+
21
+ ### Bug Fixes
22
+
23
+ * **button:** fixes error validation styles ([9b47139](https://github.com/synerise/synerise-design/commit/9b47139807265c448b62350ebf226b526f31caad))
24
+ * **condition:** adds validation errors support ([0da0a99](https://github.com/synerise/synerise-design/commit/0da0a99436920398787a1128e26d5432af2d89e2))
25
+
26
+
27
+
28
+
29
+
6
30
  ## [0.17.14](https://github.com/synerise/synerise-design/compare/@synerise/ds-button@0.17.13...@synerise/ds-button@0.17.14) (2023-04-26)
7
31
 
8
32
  **Note:** Version bump only for package @synerise/ds-button
package/dist/Button.js CHANGED
@@ -64,10 +64,11 @@ var Button = function Button(_ref) {
64
64
  };
65
65
 
66
66
  var classNameString = React.useMemo(function () {
67
- var modeStringifed = !mode ? '' : mode;
68
- var classNameStringifed = !className ? '' : className;
69
- return "ds-button " + modeStringifed + " " + classNameStringifed;
70
- }, [mode, className]);
67
+ var modeStringifed = mode || '';
68
+ var readOnlyStringifed = antdProps.readOnly ? 'read-only' : '';
69
+ var classNameStringifed = className || '';
70
+ return "ds-button " + modeStringifed + " " + classNameStringifed + " " + readOnlyStringifed;
71
+ }, [mode, className, antdProps.readOnly]);
71
72
  return /*#__PURE__*/React.createElement(S.AntdButton, _extends({
72
73
  justifyContent: justifyContent,
73
74
  type: type || 'secondary',
@@ -88,7 +89,7 @@ var Button = function Button(_ref) {
88
89
  customColor: color
89
90
  /* eslint-disable-next-line react/jsx-props-no-spreading */
90
91
 
91
- }, antdProps), /*#__PURE__*/React.createElement(S.RippleEffect, {
92
+ }, antdProps), !antdProps.readOnly && /*#__PURE__*/React.createElement(S.RippleEffect, {
92
93
  ref: rippleRef,
93
94
  className: "btn-ripple " + rippleClassName
94
95
  }), antdProps.children, loading && /*#__PURE__*/React.createElement(S.Spinner, {
@@ -65,7 +65,7 @@ export var AntdButton = styled(function (_ref) {
65
65
  }).withConfig({
66
66
  displayName: "Buttonstyles__AntdButton",
67
67
  componentId: "sc-3lgta1-3"
68
- })([" &&{-webkit-mask-image:-webkit-radial-gradient(white,black);border:0;display:inline-flex;align-items:center;padding:0 12px;position:relative;overflow:hidden;justify-content:", ";", ";> *:not(.btn-focus){position:relative;}> .ds-icon{display:flex;align-items:center;justify-content:center;margin:0;width:24px;height:24px;}&:disabled{&&{", "{box-shadow:none;}}};", " &&.ant-btn-default:not(.ds-expander):not(.ds-button-creator),&&.ant-btn-secondary:not(.ds-expander):not(.ds-button-creator){&:active{", "}&:focus:not(:active){color:", ";svg{fill:", ";}background:", ";}&:hover:not(:disabled):not(:focus){background-color:", ";&.ant-btn .btn-focus{box-shadow:inset 0 0 0 1px ", ";}> span:not(.btn-focus) +.ds-icon:before{background-color:", ";}", "}&:active{color:", ";svg{fill:", ";!important;}}}", ";", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "}"], function (props) {
68
+ })([" &&{-webkit-mask-image:-webkit-radial-gradient(white,black);border:0;display:inline-flex;align-items:center;padding:0 12px;position:relative;overflow:hidden;justify-content:", ";", ";> *:not(.btn-focus){position:relative;}> .ds-icon{display:flex;align-items:center;justify-content:center;margin:0;width:24px;height:24px;}&:disabled{&&{", "{box-shadow:none;}}};", " &&.ant-btn-default:not(.ds-expander):not(.ds-button-creator):not(.read-only),&&.ant-btn-secondary:not(.ds-expander):not(.ds-button-creator):not(.read-only){&:active{", "}&:focus:not(:active){color:", ";svg{fill:", ";}background:", ";}&:hover:not(:disabled):not(:focus){background-color:", ";&.ant-btn .btn-focus{box-shadow:inset 0 0 0 1px ", ";}> span:not(.btn-focus) +.ds-icon:before{background-color:", ";}", "}&:active{color:", ";svg{fill:", ";!important;}}}", " ", ";", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", "}"], function (props) {
69
69
  return props.justifyContent;
70
70
  }, function (props) {
71
71
  return props.shape && props.shape === 'circle' && css(["border-radius:50%;"]);
@@ -74,9 +74,9 @@ export var AntdButton = styled(function (_ref) {
74
74
  }, function (props) {
75
75
  return pressedStyles(props);
76
76
  }, function (props) {
77
- return props.theme.palette['grey-600'];
77
+ return props.error ? props.theme.palette['red-600'] : props.theme.palette['grey-600'];
78
78
  }, function (props) {
79
- return props.theme.palette['grey-600'];
79
+ return props.error ? props.theme.palette['red-600'] : props.theme.palette['grey-600'];
80
80
  }, function (props) {
81
81
  return props.theme.palette['grey-050'];
82
82
  }, function (props) {
@@ -91,10 +91,12 @@ export var AntdButton = styled(function (_ref) {
91
91
  return props.theme.palette['blue-600'];
92
92
  }, function (props) {
93
93
  return props.theme.palette['blue-600'];
94
+ }, function (props) {
95
+ return props.readOnly && css(["&&.ant-btn{cursor:default;transition:none;}&&.ant-btn-secondary{&:hover,&:focus{background:", ";.btn-focus{box-shadow:inset 0 0 0 1px ", ";}span,svg{color:", ";}svg{fill:", " !important;}}}"], props.theme.palette['grey-050'], props.theme.palette['grey-300'], props.theme.palette['grey-700'], props.theme.palette['grey-700']);
94
96
  }, function (props) {
95
97
  return props.loading && css(["> *:not(.btn-focus){opacity:0;visibility:hidden;}", "{opacity:1;visibility:visible;}"], Spinner);
96
98
  }, function (props) {
97
- return props.type === buttonType[props.type] && css(["&.ant-btn{&:not(:disabled){svg{fill:", ";}&:hover{svg{fill:", ";}}}}"], props.iconColor ? props.theme.palette[props.iconColor + "-600"] : props.theme.palette['grey-600'], props.iconColor ? props.theme.palette['blue-600'] : props.theme.palette['grey-600']);
99
+ return props.type === buttonType[props.type] && !props.error && css(["&.ant-btn{&:not(:disabled){svg{fill:", ";}&:hover{svg{fill:", ";}}}}"], props.iconColor ? props.theme.palette[props.iconColor + "-600"] : props.theme.palette['grey-600'], props.iconColor ? props.theme.palette['blue-600'] : props.theme.palette['grey-600']);
98
100
  }, function (props) {
99
101
  return props.mode === 'split' && css(["&.ant-btn{padding-right:0;> span:not(.btn-focus){padding-right:12px;position:relative;}> span:not(.btn-focus) + .ds-icon{margin:0 4px 0 3px;position:relative;&:before{content:'';background-color:", ";top:", ";height:", ";width:1px;left:-4px;position:absolute;transition:all 0.3s ease;}}}"], props.type !== splitType[props.type] ? "rgba(255, 255, 255, 0.15);" : props.theme.palette['grey-300'], props.size === 'large' ? '-12px' : '-4px', props.size === 'large' ? '48px' : '32px');
100
102
  }, function (props) {
@@ -114,13 +116,13 @@ export var AntdButton = styled(function (_ref) {
114
116
  }, function (props) {
115
117
  return props.groupVariant === 'right-rounded' && css(["&.ant-btn{border-radius:0 3px 3px 0;}"]);
116
118
  }, function (props) {
117
- return props.activated && css(["&&&.ant-btn{background-color:", ";span{color:", ";}svg{fill:", ";}&&&:focus{background-color:", ";span{color:", ";}svg{fill:", ";}&&&:hover:not(:active){background-color:", ";}}}&.ant-btn .btn-focus{box-shadow:none;}"], props.theme.palette["blue-050"], props.theme.palette['blue-600'], props.theme.palette['blue-600'], props.theme.palette["blue-050"], props.theme.palette['blue-600'], props.theme.palette['blue-600'], props.theme.palette["blue-100"]);
119
+ return props.activated && css(["&&&.ant-btn:not(.read-only){background-color:", ";span{color:", ";}svg{fill:", ";}&&&:focus{background-color:", ";span{color:", ";}svg{fill:", ";}&&&:hover:not(:active){background-color:", ";}}}&.ant-btn .btn-focus{box-shadow:none;}"], props.theme.palette["blue-050"], props.theme.palette['blue-600'], props.theme.palette['blue-600'], props.theme.palette["blue-050"], props.theme.palette['blue-600'], props.theme.palette['blue-600'], props.theme.palette["blue-100"]);
118
120
  }, function (props) {
119
- return props.error && css(["&.ant-btn{background-color:", ";box-shadow:inset 0 0 0 1px ", ";span{color:", ";}svg{fill:", ";}&&&:hover:not(:disabled):not(:focus){background-color:", ";box-shadow:inset 0 0 0 1px ", ";span{color:", ";}svg{fill:", " !important;}}&:active{background-color:", ";span{color:", ";}svg{fill:", ";}}&&&:focus:not(:active){border:none !important;background-color:", ";span{color:", ";}}svg{fill:", ";}}&&&:focus{&&&:active{border:none !important;background-color:", ";span{color:", ";}svg{fill:", ";}}}", "{background-color:", ";}"], props.theme.palette["red-050"], props.theme.palette['red-600'], props.theme.palette["red-600"], props.theme.palette["red-600"], props.theme.palette["red-200"], props.theme.palette['red-600'], props.theme.palette["red-600"], props.theme.palette["red-600"], props.theme.palette["red-600"], props.theme.palette.white, props.theme.palette.white, props.theme.palette["red-050"], props.theme.palette["red-600"], props.theme.palette["red-600"], props.theme.palette["red-600"], props.theme.palette.white, props.theme.palette.white, RippleEffect, props.theme.palette["red-700"]);
121
+ return props.error && css(["&.ant-btn{background-color:", ";box-shadow:inset 0 0 0 1px ", ";span{color:", ";}svg{fill:", ";}.btn-focus{box-shadow:none;}&&&:hover:not(:disabled):not(:focus){background-color:", ";box-shadow:inset 0 0 0 1px ", ";span{color:", ";}svg{fill:", " !important;}}&:active{background-color:", ";box-shadow:none;span{color:", ";}svg{fill:", ";}}&&&:focus:not(:active){border:none !important;background-color:", ";span{color:", ";}.btn-focus{box-shadow:inset 0 0 0 2px ", ";}}svg{fill:", ";}}", "{background-color:", ";}"], props.theme.palette["red-100"], props.theme.palette['red-600'], props.theme.palette["red-600"], props.theme.palette["red-600"], props.theme.palette["red-200"], props.theme.palette['red-600'], props.theme.palette["red-600"], props.theme.palette["red-600"], props.theme.palette["red-700"], props.theme.palette.white, props.theme.palette.white, props.theme.palette["red-100"], props.theme.palette["red-600"], props.theme.palette['blue-600'], props.theme.palette["red-600"], RippleEffect, props.theme.palette["red-700"]);
120
122
  }, function (props) {
121
- return props.error && props.type === 'secondary' && css(["&&&.ant-btn .btn-focus{box-shadow:inset 0 0 0 1px ", " !important;&&&:hover{background-color:", ";}&&&:active{background-color:", ";box-shadow:inset 0 0 0 2px ", ";span{color:", ";}svg{fill:", ";}}", "{background-color:", ";}}"], props.theme.palette['red-600'], props.theme.palette["red-200"], props.theme.palette["red-600"], props.theme.palette['blue-600'], props.theme.palette.white, props.theme.palette.white, RippleEffect, props.theme.palette["red-700"]);
123
+ return props.error && props.type === 'secondary' && css(["&&&.ant-btn{span{color:", ";}svg{fill:", ";}.btn-focus{box-shadow:none;}&&&:hover{background-color:", ";.btn-focus{box-shadow:none;}}&&&:focus:not(:active){.btn-focus{box-shadow:inset 0 0 0 2px ", ";}}&&&:active{background-color:", ";span{color:", ";}svg{fill:", ";}}", "{background-color:", ";}}"], props.theme.palette["red-600"], props.theme.palette["red-600"], props.theme.palette["red-200"], props.theme.palette['blue-600'], props.theme.palette["red-700"], props.theme.palette.white, props.theme.palette.white, RippleEffect, props.theme.palette["red-700"]);
122
124
  }, function (props) {
123
- return props.type === 'custom-color' && css(["&.ant-btn{background-color:", ";border:0 solid transparent;span{color:", ";}svg{color:", ";fill:", ";}", "{box-shadow:inset 0 0 0 0px transparent;}", "{background-color:", ";}&:focus{", "{box-shadow:inset 0 0 0 2px ", ";}}&:hover:not(:disabled):not(:focus){background-color:", ";span{color:", ";}svg{color:", " !important;fill:", " !important;}}&:disabled{opacity:0.4;background-color:", ";span{color:", ";}svg{color:", " !important;fill:", " !important;}}}"], props.theme.palette[props.customColor + "-600"], props.theme.palette.white, props.theme.palette.white, props.theme.palette.white, ButtonFocus, RippleEffect, props.theme.palette[props.customColor + "-700"], ButtonFocus, props.theme.palette['blue-600'], props.theme.palette[props.customColor + "-500"], props.theme.palette.white, props.theme.palette.white, props.theme.palette.white, props.theme.palette[props.customColor + "-600"], props.theme.palette.white, props.theme.palette.white, props.theme.palette.white);
125
+ return props.type === 'custom-color' && !props.error && css(["&.ant-btn{background-color:", ";border:0 solid transparent;color:", ";span{color:", ";}svg{color:", ";fill:", ";}", "{box-shadow:inset 0 0 0 0px transparent;}", "{background-color:", ";}&:focus:not(.read-only){", "{box-shadow:inset 0 0 0 2px ", ";}}&:hover:not(:disabled):not(:focus){background-color:", ";span{color:", ";}svg{color:", " !important;fill:", " !important;}}&:disabled{opacity:0.4;background-color:", ";span{color:", ";}svg{color:", " !important;fill:", " !important;}}}"], props.theme.palette[props.customColor + "-600"], props.theme.palette.white, props.theme.palette.white, props.theme.palette.white, props.theme.palette.white, ButtonFocus, RippleEffect, props.theme.palette[props.customColor + "-700"], ButtonFocus, props.theme.palette['blue-600'], props.theme.palette[props.readOnly ? props.customColor + "-600" : props.customColor + "-500"], props.theme.palette.white, props.theme.palette.white, props.theme.palette.white, props.theme.palette[props.customColor + "-600"], props.theme.palette.white, props.theme.palette.white, props.theme.palette.white);
124
126
  }, function (props) {
125
- return props.type === 'custom-color-ghost' && css(["color:", ";.ds-icon > svg{fill:", ";}&:hover:not(:disabled):not(:focus){color:", ";span{color:", ";}svg{fill:", " !important;}}&:disabled{opacity:0.4;color:", ";.ds-icon > svg{fill:", " !important;}}"], props.theme.palette[props.customColor + "-600"], props.theme.palette[props.customColor + "-600"], props.theme.palette[props.customColor + "-500"], props.theme.palette[props.customColor + "-500"], props.theme.palette[props.customColor + "-500"], props.theme.palette[props.customColor + "-600"], props.theme.palette[props.customColor + "-600"]);
127
+ return props.type === 'custom-color-ghost' && !props.error && css(["color:", ";.ds-icon > svg{fill:", ";}&:hover:not(:disabled):not(:focus){color:", ";span{color:", ";}svg{fill:", " !important;}}&:disabled{opacity:0.4;color:", ";.ds-icon > svg{fill:", " !important;}}"], props.theme.palette[props.customColor + "-600"], props.theme.palette[props.customColor + "-600"], props.theme.palette[props.customColor + "-500"], props.theme.palette[props.customColor + "-500"], props.theme.palette[props.customColor + "-500"], props.theme.palette[props.customColor + "-600"], props.theme.palette[props.customColor + "-600"]);
126
128
  });
@@ -42,6 +42,7 @@ export declare type Props = Omit<ButtonProps, 'type'> & {
42
42
  iconColor?: string | 'blue' | 'grey' | 'red' | 'green' | 'yellow' | 'pink' | 'mars' | 'orange' | 'fern' | 'cyan' | 'purple' | 'violet';
43
43
  error?: boolean;
44
44
  activated?: boolean;
45
+ readOnly?: boolean;
45
46
  };
46
47
  export declare type ButtonSubComponents = {
47
48
  Expander: React.ElementType;
@@ -35,9 +35,10 @@ export var Creator = styled(function (_ref3) {
35
35
  }).withConfig({
36
36
  displayName: "Creatorstyles__Creator",
37
37
  componentId: "sc-1w96u6h-1"
38
- })(["&&&{width:", ";opacity:", ";height:40px;", " padding:0;border-radius:3px;border:1px dashed ", ";background:", ";transition:all 0.3s ease;justify-content:", ";align-items:center;", "{margin:auto 12px;svg{transition:all 0.3s ease;color:", ";fill:", ";}}", "{background-color:", ";}", "{display:none;}&:hover:not(:disabled){", "{svg{color:", " !important;fill:", " !important;}}", "{color:", ";}}&:hover:not(:disabled):not(:focus){border:1px dashed ", ";background-color:", ";}", " &:focus:active{border:1px dashed ", " !important;box-shadow:none;background-color:", ";}&:focus{border:1px dashed ", ";box-shadow:none;}&:disabled{border-color:", ";background-color:", ";}", " ", "}"], function (props) {
38
+ })(["&&&{width:", ";opacity:", ";height:48px;", " padding:0;border-radius:3px;border:1px dashed ", ";background:", ";transition:all 0.3s ease;justify-content:", ";align-items:center;", "{margin:auto 12px;svg{transition:all 0.3s ease;color:", ";fill:", ";}}", "{background-color:", ";}", "{display:none;}&:hover:not(:disabled){", "{svg{color:", " !important;fill:", " !important;}}", "{color:", ";}}&:hover:not(:disabled):not(:focus){border:1px dashed ", ";background-color:", ";}", " &:focus:active{border:1px dashed ", " !important;box-shadow:none;background-color:", ";}&:focus{border:1px dashed ", ";box-shadow:none;}&:disabled{border-color:", ";background-color:", ";}", " ", "}"], function (props) {
39
+ if (!props.withLabel) return '48px';
39
40
  if (props.block) return '100%';
40
- return props.withLabel ? 'auto' : '40px';
41
+ return 'auto';
41
42
  }, function (props) {
42
43
  return props.disabled ? "0.4" : '1';
43
44
  }, function (props) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-button",
3
- "version": "0.17.14",
3
+ "version": "0.17.16",
4
4
  "description": "Button UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -43,5 +43,5 @@
43
43
  "@synerise/ds-utils": "^0.19.0",
44
44
  "csstype": "2.6.9"
45
45
  },
46
- "gitHead": "41163901b144e78a83329029519cb9eb48bf4787"
46
+ "gitHead": "9a0fe37374409f1830fa642965975a26a72116c8"
47
47
  }