@synerise/ds-button 1.2.0 → 1.3.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/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
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
+ ## [1.3.1](https://github.com/synerise/synerise-design/compare/@synerise/ds-button@1.3.0...@synerise/ds-button@1.3.1) (2025-05-26)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **button:** raise style specificity ([eac3e97](https://github.com/synerise/synerise-design/commit/eac3e974b09ab4819c237facc66dfd065bff44a4))
12
+
13
+
14
+
15
+
16
+
17
+ # [1.3.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-button@1.2.0...@synerise/ds-button@1.3.0) (2025-05-19)
18
+
19
+
20
+ ### Features
21
+
22
+ * **button:** add tooltipProps prop ([6249b29](https://github.com/synerise/synerise-design/commit/6249b295f89671379030d77b92229ce3523d3784))
23
+
24
+
25
+
26
+
27
+
6
28
  # [1.2.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-button@1.1.5...@synerise/ds-button@1.2.0) (2025-05-07)
7
29
 
8
30
 
package/dist/Button.d.ts CHANGED
@@ -2,5 +2,5 @@ import React from 'react';
2
2
  import '@synerise/ds-core/dist/js/style';
3
3
  import './style/index.less';
4
4
  import { ButtonProps } from './Button.types';
5
- declare const Button: ({ type, mode, justifyContent, groupVariant, loading, onClick, className, color, error, tagProps, children, ...antdProps }: ButtonProps) => React.JSX.Element;
5
+ declare const Button: ({ type, mode, justifyContent, groupVariant, loading, onClick, className, color, error, tagProps, children, tooltipProps, ...antdProps }: ButtonProps) => React.JSX.Element;
6
6
  export default Button;
package/dist/Button.js CHANGED
@@ -1,4 +1,4 @@
1
- var _excluded = ["type", "mode", "justifyContent", "groupVariant", "loading", "onClick", "className", "color", "error", "tagProps", "children"];
1
+ var _excluded = ["type", "mode", "justifyContent", "groupVariant", "loading", "onClick", "className", "color", "error", "tagProps", "children", "tooltipProps"];
2
2
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
3
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
4
  import React, { useEffect, useState, useMemo, useRef } from 'react';
@@ -6,7 +6,9 @@ import '@synerise/ds-core/dist/js/style';
6
6
  import "./style/index.css";
7
7
  import Icon, { SpinnerM } from '@synerise/ds-icon';
8
8
  import { TagShape } from '@synerise/ds-tag';
9
+ import Tooltip from '@synerise/ds-tooltip';
9
10
  import * as S from './Button.styles';
11
+ import { ButtonMode } from './Button.types';
10
12
  var RIPPLE_ANIMATION_OFFSET = 50;
11
13
  var Button = function Button(_ref) {
12
14
  var _ref$type = _ref.type,
@@ -24,6 +26,7 @@ var Button = function Button(_ref) {
24
26
  error = _ref.error,
25
27
  tagProps = _ref.tagProps,
26
28
  children = _ref.children,
29
+ tooltipProps = _ref.tooltipProps,
27
30
  antdProps = _objectWithoutPropertiesLoose(_ref, _excluded);
28
31
  var rippleRef = useRef(null);
29
32
  var _useState = useState(''),
@@ -62,6 +65,17 @@ var Button = function Button(_ref) {
62
65
  var classNameStringifed = className || '';
63
66
  return "ds-button " + modeStringifed + " " + classNameStringifed + " " + readOnlyStringifed;
64
67
  }, [mode, className, antdProps.readOnly]);
68
+ var buttonLabel = useMemo(function () {
69
+ var label = /*#__PURE__*/React.createElement(S.ButtonLabel, {
70
+ withTooltip: !!tooltipProps,
71
+ "data-testid": "ds-button-label",
72
+ className: "ds-button-label"
73
+ }, children, tagProps && mode !== ButtonMode.SINGLE_ICON && /*#__PURE__*/React.createElement(S.Tag, _extends({}, tagProps, {
74
+ shape: TagShape.MEDIUM_ROUND,
75
+ asPill: true
76
+ })));
77
+ return tooltipProps ? /*#__PURE__*/React.createElement(Tooltip, tooltipProps, label) : label;
78
+ }, [children, tagProps, mode, tooltipProps]);
65
79
  return /*#__PURE__*/React.createElement(S.AntdButton, _extends({
66
80
  justifyContent: justifyContent,
67
81
  type: type || 'secondary',
@@ -82,13 +96,7 @@ var Button = function Button(_ref) {
82
96
  }, antdProps), !antdProps.readOnly && /*#__PURE__*/React.createElement(S.RippleEffect, {
83
97
  ref: rippleRef,
84
98
  className: "btn-ripple " + rippleClassName
85
- }), /*#__PURE__*/React.createElement(S.ButtonLabel, {
86
- "data-testid": "ds-button-label",
87
- className: "ds-button-label"
88
- }, children, tagProps && mode !== 'single-icon' && /*#__PURE__*/React.createElement(S.Tag, _extends({}, tagProps, {
89
- shape: TagShape.MEDIUM_ROUND,
90
- asPill: true
91
- }))), loading && /*#__PURE__*/React.createElement(S.Spinner, {
99
+ }), buttonLabel, loading && /*#__PURE__*/React.createElement(S.Spinner, {
92
100
  className: "btn-spinner",
93
101
  "data-testid": "button-spinner"
94
102
  }, /*#__PURE__*/React.createElement(Icon, {
@@ -4,5 +4,7 @@ export declare const Spinner: import("styled-components").StyledComponent<"div",
4
4
  export declare const RippleEffect: import("styled-components").StyledComponent<"span", any, {}, never>;
5
5
  export declare const ButtonFocus: import("styled-components").StyledComponent<"div", any, {}, never>;
6
6
  export declare const Tag: import("styled-components").StyledComponent<({ id, name, className, disabled, removable, image, shape, color, textColor, onRemove, onClick, prefixel, suffixel, texts, asPill, dashed, ...htmlAttributes }: import("@synerise/ds-tag").TagProps) => React.JSX.Element, any, {}, never>;
7
- export declare const ButtonLabel: import("styled-components").StyledComponent<"div", any, {}, never>;
7
+ export declare const ButtonLabel: import("styled-components").StyledComponent<"div", any, {
8
+ withTooltip?: boolean | undefined;
9
+ }, never>;
8
10
  export declare const AntdButton: import("styled-components").StyledComponent<({ mode, type, loading, justifyContent, groupVariant, customColor, rightIconSize, leftIconSize, pressed, size, iconColor, error, ...rest }: any) => React.JSX.Element, any, {}, never>;
@@ -43,7 +43,9 @@ export var Tag = styled(DSTag).withConfig({
43
43
  export var ButtonLabel = styled.div.withConfig({
44
44
  displayName: "Buttonstyles__ButtonLabel",
45
45
  componentId: "sc-3lgta1-4"
46
- })(["display:flex;align-items:center;flex-grow:1;justify-content:center;"]);
46
+ })(["display:flex;align-items:center;flex-grow:1;justify-content:center;", ""], function (props) {
47
+ return props.withTooltip && "\n && {\n pointer-events: all;\n }";
48
+ });
47
49
  export var AntdButton = styled(function (_ref) {
48
50
  var mode = _ref.mode,
49
51
  type = _ref.type,
@@ -118,7 +120,7 @@ export var AntdButton = styled(function (_ref) {
118
120
  }, function (props) {
119
121
  return props.type === 'custom-color' && !props.error && css(["&.ant-btn{background-color:", ";border:0 solid transparent;color:", ";", "{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:", ";", "{color:", ";}svg{color:", " !important;fill:", " !important;}}&:disabled{opacity:0.4;background-color:", ";", "{color:", ";}svg{color:", " !important;fill:", " !important;}}}"], props.theme.palette[props.customColor + "-600"], props.theme.palette.white, ButtonLabel, 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"], ButtonLabel, props.theme.palette.white, props.theme.palette.white, props.theme.palette.white, props.theme.palette[props.customColor + "-600"], ButtonLabel, props.theme.palette.white, props.theme.palette.white, props.theme.palette.white);
120
122
  }, function (props) {
121
- return props.type === 'custom-color-ghost' && !props.error && css(["color:", ";.ds-icon > svg{fill:", ";}&:hover:not(:disabled):not(:focus){color:", ";", "{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"], ButtonLabel, props.theme.palette[props.customColor + "-500"], props.theme.palette[props.customColor + "-500"], props.theme.palette[props.customColor + "-600"], props.theme.palette[props.customColor + "-600"]);
123
+ return props.type === 'custom-color-ghost' && !props.error && css(["&&&{color:", ";.ds-icon > svg{fill:", ";}&:hover:not(:disabled):not(:focus){color:", ";", "{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"], ButtonLabel, props.theme.palette[props.customColor + "-500"], props.theme.palette[props.customColor + "-500"], props.theme.palette[props.customColor + "-600"], props.theme.palette[props.customColor + "-600"]);
122
124
  }, Tag, function (props) {
123
125
  return props.theme.palette.white;
124
126
  });
@@ -3,6 +3,15 @@ import type { ButtonProps as AntdButtonProps } from 'antd/lib/button';
3
3
  import type { JustifyContentProperty } from 'csstype';
4
4
  import type { LiteralStringUnion } from '@synerise/ds-utils';
5
5
  import type { TagProps } from '@synerise/ds-tag';
6
+ import type { TooltipProps } from '@synerise/ds-tooltip';
7
+ export declare enum ButtonMode {
8
+ SINGLE_ICON = "single-icon",
9
+ SPLIT = "split",
10
+ TWO_ICONS = "two-icons",
11
+ LABEL_ICON = "label-icon",
12
+ ICON_LABEL = "icon-label"
13
+ }
14
+ type ButtonModes = `${ButtonMode}`;
6
15
  export type ButtonType = 'primary' | 'secondary' | 'tertiary' | 'tertiary-white' | 'ghost-primary' | 'ghost' | 'ghost-white' | 'custom-color' | 'custom-color-ghost';
7
16
  export type ButtonProps = Omit<AntdButtonProps, 'type' | 'ghost'> & {
8
17
  /**
@@ -16,7 +25,7 @@ export type ButtonProps = Omit<AntdButtonProps, 'type' | 'ghost'> & {
16
25
  *
17
26
  * @default simple
18
27
  */
19
- mode?: LiteralStringUnion<'single-icon' | 'split' | 'two-icons' | 'label-icon' | 'icon-label'>;
28
+ mode?: LiteralStringUnion<ButtonModes>;
20
29
  /**
21
30
  * Defines color of `custom-color` button.
22
31
  *
@@ -46,9 +55,11 @@ export type ButtonProps = Omit<AntdButtonProps, 'type' | 'ghost'> & {
46
55
  error?: boolean;
47
56
  readOnly?: boolean;
48
57
  tagProps?: TagProps;
58
+ tooltipProps?: TooltipProps;
49
59
  };
50
60
  export type Props = ButtonProps;
51
61
  export type ButtonSubComponents = {
52
62
  Expander: ElementType;
53
63
  Creator: ElementType;
54
64
  };
65
+ export {};
@@ -1 +1,10 @@
1
- export {};
1
+ export var ButtonMode = /*#__PURE__*/function (ButtonMode) {
2
+ ButtonMode["SINGLE_ICON"] = "single-icon";
3
+ ButtonMode["SPLIT"] = "split";
4
+ ButtonMode["TWO_ICONS"] = "two-icons";
5
+ ButtonMode["LABEL_ICON"] = "label-icon";
6
+ ButtonMode["ICON_LABEL"] = "icon-label";
7
+ return ButtonMode;
8
+ }({});
9
+
10
+ // @deprecated - use ButtonProps instead
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-button",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "Button UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -34,9 +34,10 @@
34
34
  ],
35
35
  "types": "dist/index.d.ts",
36
36
  "dependencies": {
37
- "@synerise/ds-icon": "^1.4.2",
38
- "@synerise/ds-tag": "^1.1.6",
39
- "@synerise/ds-utils": "^1.1.0",
37
+ "@synerise/ds-icon": "^1.5.1",
38
+ "@synerise/ds-tag": "^1.1.8",
39
+ "@synerise/ds-tooltip": "^1.1.8",
40
+ "@synerise/ds-utils": "^1.1.1",
40
41
  "classnames": "2.3.2",
41
42
  "csstype": "^2.6.9"
42
43
  },
@@ -46,5 +47,5 @@
46
47
  "react": ">=16.9.0 <= 18.3.1",
47
48
  "styled-components": "^5.3.3"
48
49
  },
49
- "gitHead": "90af7549cf0f556340bdd0deec4bb59bacf3e95e"
50
+ "gitHead": "9e9cc54e3690b4d51323f91c81b3b79305984da6"
50
51
  }