@synerise/ds-button 0.20.0 → 0.21.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 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
+ # [0.21.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-button@0.20.1...@synerise/ds-button@0.21.0) (2024-06-21)
7
+
8
+
9
+ ### Features
10
+
11
+ * **button:** disabled tooltip for button ([74fca04](https://github.com/synerise/synerise-design/commit/74fca04c9c02088c8bc59e055c7ffae0469e6355))
12
+
13
+
14
+
15
+
16
+
17
+ ## [0.20.1](https://github.com/synerise/synerise-design/compare/@synerise/ds-button@0.20.0...@synerise/ds-button@0.20.1) (2024-05-29)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **button:** add type to ButtonWithStar ([173e81b](https://github.com/synerise/synerise-design/commit/173e81b60667fd3334c9695aa9cfdf124f3a71c2))
23
+
24
+
25
+
26
+
27
+
6
28
  # [0.20.0](https://github.com/synerise/synerise-design/compare/@synerise/ds-button@0.19.9...@synerise/ds-button@0.20.0) (2024-05-16)
7
29
 
8
30
 
package/README.md CHANGED
@@ -54,19 +54,19 @@ import { AngleDownS } from '@synerise/ds-icon';
54
54
 
55
55
  ## Button
56
56
 
57
- | Property | Description | Type | Default |
58
- | -------------- | ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
59
- | color | Defines color of `custom-color` button. | `green` / `grey` / `yellow` / `blue` / `pink`/ `mars`/ `orange`/ `fern`/ `cyan`/ `purple` / `violet` | `red` |
60
- | disabled | Defines if the button is disabled. | boolean | `false` |
61
- | groupVariant | Defines shape of the button | `left-rounded` / `squared` / `right-rounded` | - |
62
- | justifyContent | Defines justify of content in button. | JustifyContentProperty (React.CSSPRroperties) | - |
63
- | loading | Sets the loading status of button. | boolean / `{ delay?: number }` | `false` |
64
- | mode | Defines the mode of the button content. It affects content inside the button | `single-icon` / `split` / `two-icons` /`label-icon` / `icon-label` | - |
65
- | onClick | Callback executed after clicking the button | (event: React.MouseEvent) => void | - |
66
- | type | Defines the type of the button. | `primary` / `secondary`/ `tertiary`/ `tertiary-white` / `ghost-primary` / `ghost` / `ghost-white` / `custom-color` / `custom-color-ghost` | `secondary` |
67
- | iconColor | Defines color of `icon` in button. | `green` / `grey` / `yellow` / `blue` / `pink`/ `mars`/ `orange`/ `fern`/ `cyan`/ `purple` / `violet` | `grey` |
68
- | error | Defines if the button has error button styles . | boolean | `false` |
69
- | activated | Defines if the button has activated button styles . | boolean | `false` |
57
+ | Property | Description | Type | Default |
58
+ | -------------------- | ---------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
59
+ | color | Defines color of `custom-color` button. | `green` / `grey` / `yellow` / `blue` / `pink`/ `mars`/ `orange`/ `fern`/ `cyan`/ `purple` / `violet` | `red` |
60
+ | disabled | Defines if the button is disabled. | boolean | `false` |
61
+ | groupVariant | Defines shape of the button | `left-rounded` / `squared` / `right-rounded` | - |
62
+ | justifyContent | Defines justify of content in button. | JustifyContentProperty (React.CSSPRroperties) | - |
63
+ | loading | Sets the loading status of button. | boolean / `{ delay?: number }` | `false` |
64
+ | mode | Defines the mode of the button content. It affects content inside the button | `single-icon` / `split` / `two-icons` /`label-icon` / `icon-label` | - |
65
+ | onClick | Callback executed after clicking the button | (event: React.MouseEvent) => void | - |
66
+ | type | Defines the type of the button. | `primary` / `secondary`/ `tertiary`/ `tertiary-white` / `ghost-primary` / `ghost` / `ghost-white` / `custom-color` / `custom-color-ghost` | `secondary` |
67
+ | iconColor | Defines color of `icon` in button. | `green` / `grey` / `yellow` / `blue` / `pink`/ `mars`/ `orange`/ `fern`/ `cyan`/ `purple` / `violet` | `grey` |
68
+ | error | Defines if the button has error button styles . | boolean | `false` |
69
+ | activated | Defines if the button has activated button styles . | boolean | `false` |
70
70
 
71
71
  ## Button.Creator
72
72
 
package/dist/Button.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import * as React from 'react';
1
+ import React from 'react';
2
2
  import '@synerise/ds-core/dist/js/style';
3
3
  import './style/index.less';
4
- import { Props } from './Button.types';
5
- declare const Button: React.FC<Props>;
4
+ import { ButtonProps } from './Button.types';
5
+ declare const Button: ({ type, mode, justifyContent, groupVariant, loading, onClick, className, color, error, activated, ...antdProps }: ButtonProps) => React.JSX.Element;
6
6
  export default Button;
package/dist/Button.js CHANGED
@@ -4,7 +4,7 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
4
4
 
5
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
6
 
7
- import * as React from 'react';
7
+ import React, { useEffect, useState, useMemo, useRef } from 'react';
8
8
  import '@synerise/ds-core/dist/js/style';
9
9
  import "./style/index.css";
10
10
  import Icon, { SpinnerM } from '@synerise/ds-icon';
@@ -28,17 +28,17 @@ var Button = function Button(_ref) {
28
28
  activated = _ref.activated,
29
29
  antdProps = _objectWithoutPropertiesLoose(_ref, _excluded);
30
30
 
31
- var rippleRef = React.useRef(null);
31
+ var rippleRef = useRef(null);
32
32
 
33
- var _React$useState = React.useState(''),
34
- rippleClassName = _React$useState[0],
35
- setRippleClassName = _React$useState[1];
33
+ var _useState = useState(''),
34
+ rippleClassName = _useState[0],
35
+ setRippleClassName = _useState[1];
36
36
 
37
- var _React$useState2 = React.useState(false),
38
- pressed = _React$useState2[0],
39
- setPressed = _React$useState2[1];
37
+ var _useState2 = useState(false),
38
+ pressed = _useState2[0],
39
+ setPressed = _useState2[1];
40
40
 
41
- React.useEffect(function () {
41
+ useEffect(function () {
42
42
  if (rippleClassName !== '') {
43
43
  setTimeout(function () {
44
44
  setRippleClassName('');
@@ -63,7 +63,7 @@ var Button = function Button(_ref) {
63
63
  }
64
64
  };
65
65
 
66
- var classNameString = React.useMemo(function () {
66
+ var classNameString = useMemo(function () {
67
67
  var modeStringifed = mode || '';
68
68
  var readOnlyStringifed = antdProps.readOnly ? 'read-only' : '';
69
69
  var classNameStringifed = className || '';
@@ -1,5 +1,6 @@
1
+ import * as React from 'react';
1
2
  export declare const RIPPLE_ANIMATION_TIME = 500;
2
3
  export declare const Spinner: import("styled-components").StyledComponent<"div", any, {}, never>;
3
4
  export declare const RippleEffect: import("styled-components").StyledComponent<"span", any, {}, never>;
4
5
  export declare const ButtonFocus: import("styled-components").StyledComponent<"div", any, {}, never>;
5
- export declare const AntdButton: import("styled-components").StyledComponent<({ mode, type, loading, justifyContent, groupVariant, customColor, rightIconSize, leftIconSize, pressed, size, iconColor, error, activated, ...rest }: any) => JSX.Element, any, {}, never>;
6
+ export declare const AntdButton: import("styled-components").StyledComponent<({ mode, type, loading, justifyContent, groupVariant, customColor, rightIconSize, leftIconSize, pressed, size, iconColor, error, activated, ...rest }: any) => React.JSX.Element, any, {}, never>;
@@ -1,7 +1,7 @@
1
- import * as React from 'react';
2
- import { ButtonProps } from 'antd/lib/button';
1
+ import { ElementType, MouseEvent } from 'react';
2
+ import { ButtonProps as AntdButtonProps } from 'antd/lib/button';
3
3
  import { JustifyContentProperty } from 'csstype';
4
- export type Props = Omit<ButtonProps, 'type'> & {
4
+ export type ButtonProps = Omit<AntdButtonProps, 'type'> & {
5
5
  /**
6
6
  * Defines the type of the button. It affects the button color
7
7
  *
@@ -38,13 +38,14 @@ export type Props = Omit<ButtonProps, 'type'> & {
38
38
  /**
39
39
  * Sets the handler to handle `click` event
40
40
  */
41
- onClick?: (event: React.MouseEvent<HTMLElement>) => void;
41
+ onClick?: (event: MouseEvent<HTMLElement>) => void;
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
45
  readOnly?: boolean;
46
46
  };
47
+ export type Props = ButtonProps;
47
48
  export type ButtonSubComponents = {
48
- Expander: React.ElementType;
49
- Creator: React.ElementType;
49
+ Expander: ElementType;
50
+ Creator: ElementType;
50
51
  };
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { CreatorProps } from './Creator.types';
2
- declare const Creator: ({ onClick, disabled, label, block, status, className }: CreatorProps) => JSX.Element;
3
+ declare const Creator: ({ onClick, disabled, label, block, status, className }: CreatorProps) => React.JSX.Element;
3
4
  export default Creator;
@@ -1,5 +1,6 @@
1
+ import * as React from 'react';
1
2
  export declare const CreatorLabel: import("styled-components").StyledComponent<"span", any, {}, never>;
2
- export declare const Creator: import("styled-components").StyledComponent<({ status, pressed, withLabel, ...rest }: any) => JSX.Element, any, {
3
+ export declare const Creator: import("styled-components").StyledComponent<({ status, pressed, withLabel, ...rest }: any) => React.JSX.Element, any, {
3
4
  withLabel: boolean;
4
5
  pressed: boolean;
5
6
  status: string;
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { ExpanderProps } from './Expander.types';
2
- declare const Expander: ({ size, expanded, disabled, onClick, className }: ExpanderProps) => JSX.Element;
3
+ declare const Expander: ({ size, expanded, disabled, onClick, className }: ExpanderProps) => React.JSX.Element;
3
4
  export default Expander;
@@ -1,4 +1,5 @@
1
1
  import { Keyframes } from 'styled-components';
2
+ import * as React from 'react';
2
3
  import { ThemeProps } from '@synerise/ds-core';
3
4
  export type ExpanderProps = {
4
5
  onClick: () => void;
@@ -7,4 +8,4 @@ export type ExpanderProps = {
7
8
  expanded: boolean;
8
9
  };
9
10
  export declare const focusAnimation: ({ theme }: ThemeProps) => Keyframes;
10
- export declare const Expander: import("styled-components").StyledComponent<({ children, expanded, size, ...rest }: any) => JSX.Element, any, {}, never>;
11
+ export declare const Expander: import("styled-components").StyledComponent<({ children, expanded, size, ...rest }: any) => React.JSX.Element, any, {}, never>;
package/dist/Star/Star.js CHANGED
@@ -1,4 +1,4 @@
1
- var _excluded = ["hasError", "active"];
1
+ var _excluded = ["hasError", "active", "type"];
2
2
 
3
3
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
@@ -12,6 +12,8 @@ import * as S from './Star.styles';
12
12
  var StarButton = function StarButton(props) {
13
13
  var hasError = props.hasError,
14
14
  active = props.active,
15
+ _props$type = props.type,
16
+ type = _props$type === void 0 ? 'ghost' : _props$type,
15
17
  restProps = _objectWithoutPropertiesLoose(props, _excluded);
16
18
 
17
19
  return /*#__PURE__*/React.createElement(Button, _extends({
@@ -22,7 +24,7 @@ var StarButton = function StarButton(props) {
22
24
  transition: 'none'
23
25
  },
24
26
  tabIndex: 0,
25
- type: "ghost"
27
+ type: type
26
28
  }, restProps), /*#__PURE__*/React.createElement(S.IconWrapper, {
27
29
  active: active,
28
30
  error: hasError
@@ -4,5 +4,6 @@ export type StarButtonProps = ButtonPropsOmitted & {
4
4
  active?: boolean;
5
5
  hasError?: boolean;
6
6
  className?: string;
7
+ type?: string;
7
8
  };
8
9
  export {};
package/dist/index.d.ts CHANGED
@@ -7,10 +7,10 @@ import * as ExpanderStyles from './Expander/Expander.styles';
7
7
  import * as StarStyles from './Star/Star.styles';
8
8
  declare class Button extends React.Component<ButtonProps> {
9
9
  static readonly Checkbox: (props: import("./Checkbox/Checkbox.types").CheckboxButtonProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
10
- static readonly Creator: ({ onClick, disabled, label, block, status, className }: import("./Creator/Creator.types").CreatorProps) => JSX.Element;
11
- static readonly Expander: ({ size, expanded, disabled, onClick, className }: import("./Expander/Expander.types").ExpanderProps) => JSX.Element;
10
+ static readonly Creator: ({ onClick, disabled, label, block, status, className }: import("./Creator/Creator.types").CreatorProps) => React.JSX.Element;
11
+ static readonly Expander: ({ size, expanded, disabled, onClick, className }: import("./Expander/Expander.types").ExpanderProps) => React.JSX.Element;
12
12
  static readonly Star: (props: import("./Star/Star.types").StarButtonProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>>;
13
- render(): JSX.Element;
13
+ render(): React.JSX.Element;
14
14
  }
15
15
  export default Button;
16
16
  export type { CreatorProps } from './Creator/Creator.types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-button",
3
- "version": "0.20.0",
3
+ "version": "0.21.0",
4
4
  "description": "Button UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "synerise/synerise-design",
@@ -33,19 +33,14 @@
33
33
  ],
34
34
  "types": "dist/index.d.ts",
35
35
  "dependencies": {
36
- "@synerise/ds-icon": "^0.61.0",
36
+ "@synerise/ds-icon": "^0.62.1",
37
37
  "classnames": "2.3.2"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "@synerise/ds-core": "*",
41
41
  "antd": "4.7.0",
42
- "react": ">=16.9.0 < 17.0.0",
42
+ "react": ">=16.9.0 <= 17.0.2",
43
43
  "styled-components": "5.0.1"
44
44
  },
45
- "devDependencies": {
46
- "@synerise/ds-utils": "^0.26.6",
47
- "@testing-library/react": "10.0.1",
48
- "csstype": "2.6.9"
49
- },
50
- "gitHead": "fc089bbf34c691a313b3fa648851d7831a23e3d0"
45
+ "gitHead": "ef835e848d4f02cca258130baa6c9f44dfa15dd0"
51
46
  }