@synerise/ds-button 1.5.16 → 1.5.18
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 +8 -0
- package/README.md +5 -2
- package/dist/Button.d.ts +11 -13
- package/dist/Button.figma.d.ts +1 -0
- package/dist/Button.figma.js +56 -0
- package/dist/Button.js +72 -96
- package/dist/Button.styles.d.ts +14 -14
- package/dist/Button.styles.js +56 -105
- package/dist/Button.types.d.ts +7 -7
- package/dist/Button.types.js +11 -10
- package/dist/ButtonToggle/ButtonToggle.d.ts +2 -2
- package/dist/ButtonToggle/ButtonToggle.js +21 -25
- package/dist/ButtonToggle/ButtonToggle.styles.d.ts +2 -2
- package/dist/ButtonToggle/ButtonToggle.styles.js +14 -14
- package/dist/ButtonToggle/ButtonToggle.types.d.ts +1 -1
- package/dist/ButtonToggle/ButtonToggle.types.js +1 -1
- package/dist/Checkbox/Checkbox.d.ts +2 -2
- package/dist/Checkbox/Checkbox.js +43 -55
- package/dist/Checkbox/Checkbox.styles.d.ts +4 -4
- package/dist/Checkbox/Checkbox.styles.js +37 -33
- package/dist/Checkbox/Checkbox.types.d.ts +1 -1
- package/dist/Checkbox/Checkbox.types.js +1 -1
- package/dist/Creator/Creator.d.ts +2 -2
- package/dist/Creator/Creator.js +25 -41
- package/dist/Creator/Creator.styles.d.ts +3 -25
- package/dist/Creator/Creator.styles.js +37 -81
- package/dist/Creator/Creator.types.d.ts +2 -2
- package/dist/Creator/Creator.types.js +9 -6
- package/dist/Expander/Expander.d.ts +2 -2
- package/dist/Expander/Expander.js +16 -22
- package/dist/Expander/Expander.styles.d.ts +4 -4
- package/dist/Expander/Expander.styles.js +19 -38
- package/dist/Expander/Expander.types.js +8 -5
- package/dist/Star/Star.d.ts +2 -2
- package/dist/Star/Star.js +17 -29
- package/dist/Star/Star.styles.d.ts +2 -2
- package/dist/Star/Star.styles.js +25 -24
- package/dist/Star/Star.types.d.ts +1 -1
- package/dist/Star/Star.types.js +1 -1
- package/dist/assets/style/index-tn0RQdqM.css +0 -0
- package/dist/index.d.ts +22 -22
- package/dist/index.js +34 -24
- package/dist/modules.d.js +1 -1
- package/dist/modules.d.ts +0 -0
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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.5.18](https://github.com/synerise/synerise-design/compare/@synerise/ds-button@1.5.17...@synerise/ds-button@1.5.18) (2026-03-24)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-button
|
|
9
|
+
|
|
10
|
+
## [1.5.17](https://github.com/synerise/synerise-design/compare/@synerise/ds-button@1.5.16...@synerise/ds-button@1.5.17) (2026-03-20)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @synerise/ds-button
|
|
13
|
+
|
|
6
14
|
## [1.5.16](https://github.com/synerise/synerise-design/compare/@synerise/ds-button@1.5.15...@synerise/ds-button@1.5.16) (2026-03-09)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @synerise/ds-button
|
package/README.md
CHANGED
|
@@ -65,9 +65,11 @@ import { AngleDownS } from '@synerise/ds-icon';
|
|
|
65
65
|
| mode | Defines the mode of the button content. It affects content inside the button | `single-icon` / `split` / `two-icons` /`label-icon` / `icon-label` | - |
|
|
66
66
|
| onClick | Callback executed after clicking the button | (event: React.MouseEvent) => void | - |
|
|
67
67
|
| type | Defines the type of the button. | `primary` / `secondary`/ `tertiary`/ `tertiary-white` / `ghost-primary` / `ghost` / `ghost-white` / `custom-color` / `custom-color-ghost` | `secondary` |
|
|
68
|
-
| iconColor | Defines color of `icon` in button. | `green` / `grey` / `yellow` / `blue` / `pink`/ `mars`/ `orange`/ `fern`/ `cyan`/ `purple` / `violet` |
|
|
68
|
+
| iconColor | Defines color of `icon` in button. | `green` / `grey` / `yellow` / `blue` / `pink`/ `mars`/ `orange`/ `fern`/ `cyan`/ `purple` / `violet` | - |
|
|
69
69
|
| error | Defines if the button has error button styles . | boolean | `false` |
|
|
70
|
+
| readOnly | Disables ripple and freezes hover/focus styles (cursor: default). | boolean | - |
|
|
70
71
|
| tagProps | Renders a status tag next to button label | TagProps see ds-tag | - |
|
|
72
|
+
| tooltipProps | Wraps the button label in a tooltip. | TooltipProps see ds-tooltip | - |
|
|
71
73
|
|
|
72
74
|
## ButtonToggle
|
|
73
75
|
|
|
@@ -104,7 +106,7 @@ Special type of Button, with two states: default and activated (selected). Inher
|
|
|
104
106
|
| disabled | Defines if the button is disabled. | boolean | `false` |
|
|
105
107
|
| expanded | The current state of the button. | boolean | `false` |
|
|
106
108
|
| onClick | Callback executed after clicking the button | (event: React.MouseEvent) => void | - |
|
|
107
|
-
| size | Defines the size of the button. | `S` / `M` | `
|
|
109
|
+
| size | Defines the size of the button. | `S` / `M` | `S` |
|
|
108
110
|
|
|
109
111
|
## Button.Checkbox
|
|
110
112
|
|
|
@@ -134,3 +136,4 @@ It inherits all `Button`'s props excluding.
|
|
|
134
136
|
| Property | Description | Type | Default |
|
|
135
137
|
| -------- | -------------------------------------------------------- | --------- | ----------- |
|
|
136
138
|
| active | (optional) Sets checkbox state for controlled component. | `boolean` | `undefined` |
|
|
139
|
+
| hasError | (optional) Changes appearance for wrong validation. | `boolean` | `undefined` |
|
package/dist/Button.d.ts
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import React,
|
|
2
|
-
import '@synerise/ds-core/dist/js/style';
|
|
3
|
-
import './style/index.less';
|
|
1
|
+
import { default as React, MouseEvent } from 'react';
|
|
4
2
|
declare const Button: React.ForwardRefExoticComponent<Omit<Partial<{
|
|
5
3
|
href: string;
|
|
6
4
|
target?: string;
|
|
7
5
|
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
8
|
-
} & import(
|
|
9
|
-
htmlType?: import(
|
|
6
|
+
} & import('antd/lib/button/button').BaseButtonProps & Omit<React.AnchorHTMLAttributes<any>, "type" | "onClick"> & {
|
|
7
|
+
htmlType?: import('antd/lib/button/button').ButtonHTMLType;
|
|
10
8
|
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
11
9
|
} & Omit<React.ButtonHTMLAttributes<any>, "type" | "onClick">>, "ghost" | "type"> & {
|
|
12
|
-
type?: import(
|
|
13
|
-
mode?: import(
|
|
14
|
-
color?: import(
|
|
15
|
-
groupVariant?: import(
|
|
16
|
-
justifyContent?: import(
|
|
10
|
+
type?: import('@synerise/ds-utils').LiteralStringUnion<import('./Button.types').ButtonType>;
|
|
11
|
+
mode?: import('@synerise/ds-utils').LiteralStringUnion<"single-icon" | "split" | "two-icons" | "label-icon" | "icon-label">;
|
|
12
|
+
color?: import('@synerise/ds-utils').LiteralStringUnion<"blue" | "grey" | "red" | "green" | "yellow" | "pink" | "mars" | "orange" | "fern" | "cyan" | "purple" | "violet">;
|
|
13
|
+
groupVariant?: import('@synerise/ds-utils').LiteralStringUnion<"left-rounded" | "squared" | "right-rounded">;
|
|
14
|
+
justifyContent?: import('csstype').JustifyContentProperty;
|
|
17
15
|
loading?: boolean | {
|
|
18
16
|
delay?: number;
|
|
19
17
|
};
|
|
20
18
|
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
21
|
-
iconColor?: import(
|
|
19
|
+
iconColor?: import('@synerise/ds-utils').LiteralStringUnion<"blue" | "grey" | "red" | "green" | "yellow" | "pink" | "mars" | "orange" | "fern" | "cyan" | "purple" | "violet">;
|
|
22
20
|
error?: boolean;
|
|
23
21
|
readOnly?: boolean;
|
|
24
|
-
tagProps?: import(
|
|
25
|
-
tooltipProps?: import(
|
|
22
|
+
tagProps?: import('@synerise/ds-tag').TagProps;
|
|
23
|
+
tooltipProps?: import('@synerise/ds-tooltip').TooltipProps;
|
|
26
24
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
27
25
|
export default Button;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import figma from "@figma/code-connect";
|
|
3
|
+
import Button from "./Button.js";
|
|
4
|
+
import { ButtonMode } from "./Button.types.js";
|
|
5
|
+
const FIGMA_URL = "https://www.figma.com/design/fsSZONXpVvtrDsCgtu01Jb/Synerise-Design-System?node-id=139:4694&m=dev";
|
|
6
|
+
const typeMapping = figma.enum("Variant", {
|
|
7
|
+
Primary: "primary",
|
|
8
|
+
Secondary: "secondary",
|
|
9
|
+
Tertiary: "tertiary",
|
|
10
|
+
"Tetriary White": "tertiary-white",
|
|
11
|
+
"Ghost Primary": "ghost-primary",
|
|
12
|
+
"Ghost Secondary": "ghost",
|
|
13
|
+
"Ghost Secondary White": "ghost-white"
|
|
14
|
+
});
|
|
15
|
+
const modeMapping = figma.enum("Content Type", {
|
|
16
|
+
Simple: void 0,
|
|
17
|
+
"Icon left": ButtonMode.ICON_LABEL,
|
|
18
|
+
"Icon right": ButtonMode.LABEL_ICON,
|
|
19
|
+
"Icon solo": ButtonMode.SINGLE_ICON,
|
|
20
|
+
"2 icons": ButtonMode.TWO_ICONS,
|
|
21
|
+
Split: ButtonMode.SPLIT
|
|
22
|
+
});
|
|
23
|
+
const sizeMapping = figma.enum("Size", {
|
|
24
|
+
Normal: void 0,
|
|
25
|
+
Large: "large"
|
|
26
|
+
});
|
|
27
|
+
const baseProps = {
|
|
28
|
+
type: typeMapping,
|
|
29
|
+
mode: modeMapping,
|
|
30
|
+
size: sizeMapping,
|
|
31
|
+
label: figma.string("✏️Text")
|
|
32
|
+
};
|
|
33
|
+
figma.connect(Button, FIGMA_URL, {
|
|
34
|
+
variant: {
|
|
35
|
+
State: "Default"
|
|
36
|
+
},
|
|
37
|
+
props: baseProps,
|
|
38
|
+
example: ({
|
|
39
|
+
type,
|
|
40
|
+
mode,
|
|
41
|
+
size,
|
|
42
|
+
label
|
|
43
|
+
}) => /* @__PURE__ */ jsx(Button, { type, mode, size, children: label })
|
|
44
|
+
});
|
|
45
|
+
figma.connect(Button, FIGMA_URL, {
|
|
46
|
+
variant: {
|
|
47
|
+
State: "Disabled"
|
|
48
|
+
},
|
|
49
|
+
props: baseProps,
|
|
50
|
+
example: ({
|
|
51
|
+
type,
|
|
52
|
+
mode,
|
|
53
|
+
size,
|
|
54
|
+
label
|
|
55
|
+
}) => /* @__PURE__ */ jsx(Button, { type, mode, size, disabled: true, children: label })
|
|
56
|
+
});
|
package/dist/Button.js
CHANGED
|
@@ -1,110 +1,86 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import Tooltip from '@synerise/ds-tooltip';
|
|
9
|
-
import * as S from './Button.styles';
|
|
10
|
-
import { ButtonMode } from './Button.types';
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useRef, useState, useEffect, useMemo } from "react";
|
|
3
|
+
import Icon, { SpinnerM } from "@synerise/ds-icon";
|
|
4
|
+
import { TagShape } from "@synerise/ds-tag";
|
|
5
|
+
import Tooltip from "@synerise/ds-tooltip";
|
|
6
|
+
import { RIPPLE_ANIMATION_TIME, ButtonLabel, Tag, AntdButton, RippleEffect, Spinner, ButtonFocus } from "./Button.styles.js";
|
|
7
|
+
import { ButtonMode } from "./Button.types.js";
|
|
11
8
|
import "./style/index.css";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
rippleClassName
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
setPressed = _useState2[1];
|
|
38
|
-
useEffect(function () {
|
|
39
|
-
var rippleAnimation;
|
|
40
|
-
if (rippleClassName !== '') {
|
|
41
|
-
rippleAnimation = setTimeout(function () {
|
|
42
|
-
setRippleClassName('');
|
|
43
|
-
}, S.RIPPLE_ANIMATION_TIME - RIPPLE_ANIMATION_OFFSET);
|
|
9
|
+
const RIPPLE_ANIMATION_OFFSET = 50;
|
|
10
|
+
const Button = forwardRef(({
|
|
11
|
+
type = "secondary",
|
|
12
|
+
mode,
|
|
13
|
+
justifyContent = "center",
|
|
14
|
+
groupVariant,
|
|
15
|
+
loading = false,
|
|
16
|
+
onClick,
|
|
17
|
+
className,
|
|
18
|
+
color = "red",
|
|
19
|
+
error,
|
|
20
|
+
tagProps,
|
|
21
|
+
children,
|
|
22
|
+
tooltipProps,
|
|
23
|
+
...antdProps
|
|
24
|
+
}, forwardedRef) => {
|
|
25
|
+
const rippleRef = useRef(null);
|
|
26
|
+
const [rippleClassName, setRippleClassName] = useState("");
|
|
27
|
+
const [pressed, setPressed] = useState(false);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
let rippleAnimation;
|
|
30
|
+
if (rippleClassName !== "") {
|
|
31
|
+
rippleAnimation = setTimeout(() => {
|
|
32
|
+
setRippleClassName("");
|
|
33
|
+
}, RIPPLE_ANIMATION_TIME - RIPPLE_ANIMATION_OFFSET);
|
|
44
34
|
}
|
|
45
|
-
return
|
|
35
|
+
return () => {
|
|
46
36
|
rippleAnimation && clearTimeout(rippleAnimation);
|
|
47
37
|
};
|
|
48
38
|
}, [rippleClassName]);
|
|
49
|
-
|
|
50
|
-
|
|
39
|
+
const handleClick = (event) => {
|
|
40
|
+
const button = event.currentTarget.closest(".ant-btn");
|
|
51
41
|
if (button) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
42
|
+
const buttonBoundingRect = button.getBoundingClientRect();
|
|
43
|
+
const x = event.clientX - buttonBoundingRect.left;
|
|
44
|
+
const y = event.clientY - buttonBoundingRect.top;
|
|
55
45
|
if (rippleRef.current) {
|
|
56
|
-
rippleRef.current.style.cssText =
|
|
46
|
+
rippleRef.current.style.cssText = `top: ${y}px; left: ${x}px`;
|
|
57
47
|
}
|
|
58
|
-
setRippleClassName(
|
|
48
|
+
setRippleClassName("animate");
|
|
59
49
|
onClick && onClick(event);
|
|
60
50
|
}
|
|
61
51
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return
|
|
52
|
+
const classNameString = useMemo(() => {
|
|
53
|
+
const modeStringifed = mode || "";
|
|
54
|
+
const readOnlyStringifed = antdProps.readOnly ? "read-only" : "";
|
|
55
|
+
const classNameStringifed = className || "";
|
|
56
|
+
return `ds-button ${modeStringifed} ${classNameStringifed} ${readOnlyStringifed}`;
|
|
67
57
|
}, [mode, className, antdProps.readOnly]);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
58
|
+
const buttonLabel = useMemo(() => {
|
|
59
|
+
const label = /* @__PURE__ */ jsxs(
|
|
60
|
+
ButtonLabel,
|
|
61
|
+
{
|
|
62
|
+
withTooltip: !!tooltipProps,
|
|
63
|
+
"data-testid": "ds-button-label",
|
|
64
|
+
className: "ds-button-label",
|
|
65
|
+
children: [
|
|
66
|
+
children,
|
|
67
|
+
tagProps && mode !== ButtonMode.SINGLE_ICON && /* @__PURE__ */ jsx(Tag, { ...tagProps, shape: TagShape.MEDIUM_ROUND, asPill: true })
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
return tooltipProps ? /* @__PURE__ */ jsx(Tooltip, { ...tooltipProps, children: label }) : label;
|
|
79
72
|
}, [children, tagProps, mode, tooltipProps]);
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
loading:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
setPressed(true);
|
|
91
|
-
},
|
|
92
|
-
onMouseUp: function onMouseUp() {
|
|
93
|
-
setPressed(false);
|
|
94
|
-
},
|
|
95
|
-
pressed: pressed,
|
|
96
|
-
className: classNameString,
|
|
97
|
-
customColor: color
|
|
98
|
-
}, antdProps), !antdProps.readOnly && /*#__PURE__*/React.createElement(S.RippleEffect, {
|
|
99
|
-
ref: rippleRef,
|
|
100
|
-
className: "btn-ripple " + rippleClassName
|
|
101
|
-
}), buttonLabel, loading && /*#__PURE__*/React.createElement(S.Spinner, {
|
|
102
|
-
className: "btn-spinner",
|
|
103
|
-
"data-testid": "button-spinner"
|
|
104
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
105
|
-
component: /*#__PURE__*/React.createElement(SpinnerM, null)
|
|
106
|
-
})), /*#__PURE__*/React.createElement(S.ButtonFocus, {
|
|
107
|
-
className: "btn-focus"
|
|
108
|
-
}));
|
|
73
|
+
return /* @__PURE__ */ jsxs(AntdButton, { ref: forwardedRef, justifyContent, type: type || "secondary", mode, error, groupVariant, loading, onClick: handleClick, onMouseDown: () => {
|
|
74
|
+
setPressed(true);
|
|
75
|
+
}, onMouseUp: () => {
|
|
76
|
+
setPressed(false);
|
|
77
|
+
}, pressed, className: classNameString, customColor: color, ...antdProps, children: [
|
|
78
|
+
!antdProps.readOnly && /* @__PURE__ */ jsx(RippleEffect, { ref: rippleRef, className: `btn-ripple ${rippleClassName}` }),
|
|
79
|
+
buttonLabel,
|
|
80
|
+
loading && /* @__PURE__ */ jsx(Spinner, { className: "btn-spinner", "data-testid": "button-spinner", children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(SpinnerM, {}) }) }),
|
|
81
|
+
/* @__PURE__ */ jsx(ButtonFocus, { className: "btn-focus" })
|
|
82
|
+
] });
|
|
109
83
|
});
|
|
110
|
-
export
|
|
84
|
+
export {
|
|
85
|
+
Button as default
|
|
86
|
+
};
|
package/dist/Button.styles.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ButtonProps } from './Button.types';
|
|
3
3
|
export declare const RIPPLE_ANIMATION_TIME = 500;
|
|
4
|
-
export declare const Spinner: import(
|
|
5
|
-
export declare const RippleEffect: import(
|
|
6
|
-
export declare const ButtonFocus: import(
|
|
7
|
-
export declare const Tag: import(
|
|
4
|
+
export declare const Spinner: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
5
|
+
export declare const RippleEffect: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
6
|
+
export declare const ButtonFocus: import('styled-components').StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export declare const Tag: import('styled-components').StyledComponent<React.ForwardRefExoticComponent<{
|
|
8
8
|
id?: string | number;
|
|
9
9
|
name?: string;
|
|
10
10
|
textColor?: string;
|
|
11
11
|
color?: string;
|
|
12
12
|
image?: string;
|
|
13
|
-
shape?: import(
|
|
13
|
+
shape?: import('@synerise/ds-tag').TagShape;
|
|
14
14
|
removable?: boolean;
|
|
15
15
|
className?: string;
|
|
16
16
|
disabled?: boolean;
|
|
@@ -18,20 +18,20 @@ export declare const Tag: import("styled-components").StyledComponent<React.Forw
|
|
|
18
18
|
onRemove?: (tag: string | number) => void;
|
|
19
19
|
prefixel?: React.ReactNode;
|
|
20
20
|
suffixel?: React.ReactNode;
|
|
21
|
-
texts?: import(
|
|
21
|
+
texts?: import('@synerise/ds-tag').TagTexts;
|
|
22
22
|
asPill?: boolean;
|
|
23
23
|
dashed?: boolean;
|
|
24
|
-
tooltipProps?: import(
|
|
25
|
-
} & Omit<React.HTMLAttributes<HTMLDivElement>, "onClick" | "className" | "id" | "color" | "disabled" | "name" | "shape" | "textColor" | "image" | "removable" | "onRemove" | "prefixel" | "suffixel" | "texts" | "asPill" | "dashed" | "tooltipProps"> & import(
|
|
26
|
-
export declare const ButtonLabel: import(
|
|
24
|
+
tooltipProps?: import('@synerise/ds-tooltip').TooltipProps;
|
|
25
|
+
} & Omit<React.HTMLAttributes<HTMLDivElement>, "onClick" | "className" | "id" | "color" | "disabled" | "name" | "shape" | "textColor" | "image" | "removable" | "onRemove" | "prefixel" | "suffixel" | "texts" | "asPill" | "dashed" | "tooltipProps"> & import('@synerise/ds-utils').DataAttributes & React.RefAttributes<HTMLDivElement>>, any, {}, never>;
|
|
26
|
+
export declare const ButtonLabel: import('styled-components').StyledComponent<"div", any, {
|
|
27
27
|
withTooltip?: boolean;
|
|
28
28
|
}, never>;
|
|
29
|
-
export declare const AntdButton: import(
|
|
29
|
+
export declare const AntdButton: import('styled-components').StyledComponent<React.ForwardRefExoticComponent<Omit<Partial<{
|
|
30
30
|
href: string;
|
|
31
31
|
target?: string;
|
|
32
32
|
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
33
|
-
} & import(
|
|
34
|
-
htmlType?: import(
|
|
33
|
+
} & import('antd/lib/button/button').BaseButtonProps & Omit<React.AnchorHTMLAttributes<any>, "type" | "onClick"> & {
|
|
34
|
+
htmlType?: import('antd/lib/button/button').ButtonHTMLType;
|
|
35
35
|
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
36
36
|
} & Omit<React.ButtonHTMLAttributes<any>, "type" | "onClick">>, "type"> & Pick<ButtonProps, "mode" | "justifyContent" | "groupVariant" | "iconColor" | "error"> & {
|
|
37
37
|
pressed: boolean;
|
package/dist/Button.styles.js
CHANGED
|
@@ -1,122 +1,73 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
var spinnerAnimation = keyframes(["from{transform:rotateZ(0deg);}to{transform:rotateZ(360deg);}"]);
|
|
19
|
-
var rippleAnimation = keyframes(["from{opacity:1;transform:scale(1);}to{opacity:0;transform:scale(20);}"]);
|
|
20
|
-
export var Spinner = styled.div.withConfig({
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import Button from "antd/lib/button";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import styled, { css, keyframes } from "styled-components";
|
|
5
|
+
import { IconContainer } from "@synerise/ds-icon";
|
|
6
|
+
import DSTag from "@synerise/ds-tag";
|
|
7
|
+
const RIPPLE_ANIMATION_TIME = 500;
|
|
8
|
+
const leftIcon = "0 4px 0 8px";
|
|
9
|
+
const rightIcon = "0 8px 0 4px";
|
|
10
|
+
const rippleInitialSize = 20;
|
|
11
|
+
const buttonTypes = ["secondary", "tertiary", "ghost"];
|
|
12
|
+
const splitTypes = ["secondary", "tertiary"];
|
|
13
|
+
const pressedStyles = (props) => css(["color:", ";background:", ";&.ant-btn .btn-focus{box-shadow:inset 0 0 0 1px ", ";}", " > .ds-icon:before{background-color:", ";}"], props.theme.palette["blue-600"], props.theme.palette["blue-100"], props.theme.palette["blue-300"], ButtonLabel, props.theme.palette["blue-200"]);
|
|
14
|
+
const spinnerAnimation = /* @__PURE__ */ keyframes(["from{transform:rotateZ(0deg);}to{transform:rotateZ(360deg);}"]);
|
|
15
|
+
const rippleAnimation = /* @__PURE__ */ keyframes(["from{opacity:1;transform:scale(1);}to{opacity:0;transform:scale(20);}"]);
|
|
16
|
+
const Spinner = /* @__PURE__ */ styled.div.withConfig({
|
|
21
17
|
displayName: "Buttonstyles__Spinner",
|
|
22
18
|
componentId: "sc-3lgta1-0"
|
|
23
19
|
})(["position:absolute !important;top:0;left:0;width:100%;height:100%;margin:0;background-color:transparent;border-radius:inherit;display:flex;align-items:center;justify-content:center;", "{animation:", " 1s forwards linear infinite;}"], IconContainer, spinnerAnimation);
|
|
24
|
-
|
|
20
|
+
const RippleEffect = /* @__PURE__ */ styled.span.withConfig({
|
|
25
21
|
displayName: "Buttonstyles__RippleEffect",
|
|
26
22
|
componentId: "sc-3lgta1-1"
|
|
27
23
|
})(["&&{display:flex;width:", "px;height:", "px;top:50%;left:50%;position:absolute !important;border-radius:50%;padding:0 !important;margin:-", "px 0 0 -", "px !important;z-index:0;opacity:0;visibility:visible !important;&.animate{opacity:1;animation:", " ", "ms ease-in;animation-iteration-count:1;}&::after{display:none;}}"], rippleInitialSize, rippleInitialSize, rippleInitialSize / 2, rippleInitialSize / 2, rippleAnimation, RIPPLE_ANIMATION_TIME);
|
|
28
|
-
|
|
24
|
+
const ButtonFocus = /* @__PURE__ */ styled.div.withConfig({
|
|
29
25
|
displayName: "Buttonstyles__ButtonFocus",
|
|
30
26
|
componentId: "sc-3lgta1-2"
|
|
31
27
|
})(["content:'';display:flex;position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;transition:box-shadow 0.3s ease;border-radius:inherit;z-index:99;box-shadow:inset 0 0 0 0 transparent;"]);
|
|
32
|
-
|
|
28
|
+
const Tag = /* @__PURE__ */ styled(DSTag).withConfig({
|
|
33
29
|
displayName: "Buttonstyles__Tag",
|
|
34
30
|
componentId: "sc-3lgta1-3"
|
|
35
31
|
})(["margin:0 0 0 8px;flex:0 0 auto;"]);
|
|
36
|
-
|
|
32
|
+
const ButtonLabel = /* @__PURE__ */ styled.div.withConfig({
|
|
37
33
|
displayName: "Buttonstyles__ButtonLabel",
|
|
38
34
|
componentId: "sc-3lgta1-4"
|
|
39
|
-
})(["display:flex;align-items:center;flex-grow:1;min-width:0;justify-content:center;", ""],
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
35
|
+
})(["display:flex;align-items:center;flex-grow:1;min-width:0;justify-content:center;", ""], (props) => props.withTooltip && `
|
|
36
|
+
&& {
|
|
37
|
+
pointer-events: all;
|
|
38
|
+
}`);
|
|
39
|
+
const AntdButton = /* @__PURE__ */ styled(forwardRef(({
|
|
40
|
+
mode,
|
|
41
|
+
type,
|
|
42
|
+
loading,
|
|
43
|
+
justifyContent,
|
|
44
|
+
groupVariant,
|
|
45
|
+
customColor,
|
|
46
|
+
pressed,
|
|
47
|
+
size,
|
|
48
|
+
iconColor,
|
|
49
|
+
error,
|
|
50
|
+
...rest
|
|
51
|
+
}, ref) => {
|
|
52
|
+
return /* @__PURE__ */ jsx(
|
|
53
|
+
Button,
|
|
54
|
+
{
|
|
55
|
+
ref,
|
|
56
|
+
type: type === "custom-color-ghost" ? "ghost-primary" : type,
|
|
57
|
+
size,
|
|
58
|
+
...rest
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
61
|
})).withConfig({
|
|
62
62
|
displayName: "Buttonstyles__AntdButton",
|
|
63
63
|
componentId: "sc-3lgta1-5"
|
|
64
|
-
})([" &&{-webkit-mask-image:-webkit-radial-gradient(white,black);display:inline-flex;align-items:center;padding:0 12px;position:relative;overflow:hidden;justify-content:", ";", ";&:not(:disabled):not(:focus){", " span{color:inherit;}}", " > *:not(.btn-focus){position:relative;}", " > .ds-icon,> .ds-icon{display:flex;align-items:center;justify-content:center;margin:0;width:24px;height:24px;svg{transition:all .3s cubic-bezier(.645,.045,.355,1);}}", " &&.ant-btn-default:not(.ds-expander):not(.ds-button-creator):not(.read-only):not([disabled]),&&.ant-btn-secondary:not(.ds-expander):not(.ds-button-creator):not(.read-only):not([disabled]){&:active{", "}&:focus:not(:active){color:", ";svg{fill:currentColor;}background:", ";}&:hover:not(:disabled):not(:focus){background-color:", ";&.ant-btn .btn-focus{box-shadow:inset 0 0 0 1px ", ";}", " > .ds-icon:before{background-color:", ";}}&:active{color:", ";svg{fill:", ";!important;}}}", " ", ";", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " &:hover:not(:disabled):not(:focus){", " span{color:", ";cursor:inherit;}}}"], function (props) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}, function (props) {
|
|
75
|
-
return props.theme.palette['grey-050'];
|
|
76
|
-
}, function (props) {
|
|
77
|
-
return props.theme.palette['blue-050'];
|
|
78
|
-
}, function (props) {
|
|
79
|
-
return props.theme.palette['blue-300'];
|
|
80
|
-
}, ButtonLabel, function (props) {
|
|
81
|
-
return props.theme.palette['blue-200'];
|
|
82
|
-
}, function (props) {
|
|
83
|
-
return props.theme.palette['blue-600'];
|
|
84
|
-
}, function (props) {
|
|
85
|
-
return props.theme.palette['blue-600'];
|
|
86
|
-
}, function (props) {
|
|
87
|
-
return props.readOnly && props.type !== 'custom-color-ghost' && css(["&&.ant-btn{cursor:default;transition:none;}&&.ant-btn-secondary{&:hover,&:focus{background:", ";.btn-focus{box-shadow:inset 0 0 0 1px ", ";}", ",svg{color:", ";}svg{fill:", " !important;}}}&&.ant-btn-primary{&:hover,&:focus{background:", ";.btn-focus{box-shadow:inset 0 0 0 1px ", ";}", ",svg{color:", ";}svg{fill:", " !important;}}}&&.ant-btn-tertiary{&:hover,&:focus{background:", ";.btn-focus{box-shadow:inset 0 0 0 0 ", ";}", ",svg{color:", ";}svg{fill:", " !important;}}}&&.ant-btn-tertiary-white{&:hover,&:focus{background:rgba(219,224,227,0.15);.btn-focus{box-shadow:inset 0 0 0 0 rgba(219,224,227,0.15);}", ",svg{color:", ";}svg{fill:", " !important;}}}&&.ant-btn-ghost-primary{&:hover,&:focus{background:", ";.btn-focus{box-shadow:inset 0 0 0 0 ", ";}", ",svg{color:", ";}svg{fill:", " !important;}}}&&.ant-btn-ghost{&:hover,&:focus{background:", ";.btn-focus{box-shadow:inset 0 0 0 0 ", ";}", ",svg{color:", ";}svg{fill:", " !important;}}}&&.ant-btn-ghost-white{&:hover,&:focus{background:", ";.btn-focus{box-shadow:inset 0 0 0 0 ", ";}", ",svg{color:", ";}svg{fill:", " !important;}}}"], props.theme.palette['grey-050'], props.theme.palette['grey-300'], ButtonLabel, props.theme.palette['grey-700'], props.theme.palette['grey-700'], props.theme.palette['blue-600'], props.theme.palette['blue-600'], ButtonLabel, props.theme.palette['grey-050'], props.theme.palette['grey-050'], props.theme.palette['grey-100'], props.theme.palette['grey-100'], ButtonLabel, props.theme.palette['grey-700'], props.theme.palette['grey-700'], ButtonLabel, props.theme.palette['grey-050'], props.theme.palette['grey-050'], props.theme.palette.white, props.theme.palette.white, ButtonLabel, props.theme.palette['blue-600'], props.theme.palette['blue-600'], props.theme.palette.white, props.theme.palette.white, ButtonLabel, props.theme.palette['grey-600'], props.theme.palette['grey-600'], props.theme.palette['grey-600'], props.theme.palette['grey-600'], ButtonLabel, props.theme.palette['grey-050'], props.theme.palette['grey-050']);
|
|
88
|
-
}, function (props) {
|
|
89
|
-
return props.loading && css(["> *:not(.btn-focus){opacity:0;visibility:hidden;}", "{opacity:1;visibility:visible;}"], Spinner);
|
|
90
|
-
}, function (props) {
|
|
91
|
-
return buttonTypes.includes(props.type) && !props.error && css(["&.ant-btn{&:not(:disabled){svg{fill:", ";}&:hover{svg{fill:currentColor;}}}}"], props.iconColor ? props.theme.palette[props.iconColor + "-600"] : 'currentColor');
|
|
92
|
-
}, function (props) {
|
|
93
|
-
return props.mode === 'split' && css(["&.ant-btn{padding-right:0;transition:0s;", "{position:relative;}", " > .ds-icon{margin:0 4px 0 15px;position:relative;&:before{content:'';background-color:", ";top:", ";height:", ";width:1px;left:-4px;position:absolute;transition:all 0.3s ease;}}}"], ButtonLabel, ButtonLabel, !splitTypes.includes(props.type) ? "rgba(255, 255, 255, 0.15);" : props.theme.palette['grey-300'], props.size === 'large' ? '-12px' : '-4px', props.size === 'large' ? '48px' : '32px');
|
|
94
|
-
}, function (props) {
|
|
95
|
-
return props.mode === 'two-icons' && css(["&.ant-btn{padding:0;transition:0s;", " > ", ":first-of-type,", " > .ds-icon:first-of-type,& > ", ":first-of-type,& > .ds-icon:first-of-type{margin:", ";}", " > ", ":nth-of-type(2),", " > .ds-icon:nth-of-type(2),& > ", ":nth-of-type(2),& > .ds-icon:nth-of-type(2){margin:", ";}}", "{margin:0 12px 0 0;}"], ButtonLabel, IconContainer, ButtonLabel, IconContainer, leftIcon, ButtonLabel, IconContainer, ButtonLabel, IconContainer, rightIcon, Tag);
|
|
96
|
-
}, function (props) {
|
|
97
|
-
return props.mode === 'label-icon' && css(["&.ant-btn{padding-right:0;transition:0s;", " > ", ",", " > .ds-icon,& > ", ",& > .ds-icon{margin:", ";}}", "{margin:0 12px 0 0;}"], ButtonLabel, IconContainer, ButtonLabel, IconContainer, rightIcon, Tag);
|
|
98
|
-
}, function (props) {
|
|
99
|
-
return props.mode === 'icon-label' && css(["&.ant-btn{padding-left:0;transition:0s;", " > ", ",", " > .ds-icon,& > ", ",& > .ds-icon{margin:", ";}}"], ButtonLabel, IconContainer, ButtonLabel, IconContainer, leftIcon);
|
|
100
|
-
}, function (props) {
|
|
101
|
-
return props.mode === 'single-icon' && css(["&.ant-btn:not(.ds-expander){display:flex;align-items:center;justify-content:center;padding:0;transition:0s;width:32px;", " > ", ",", " > .ds-icon,& > ", ",& > .ds-icon{margin:0 4px 0 4px;}}"], ButtonLabel, IconContainer, ButtonLabel, IconContainer);
|
|
102
|
-
}, function (props) {
|
|
103
|
-
return props.mode === 'single-icon' && props.size === 'large' && css(["&.ant-btn{width:48px;}"]);
|
|
104
|
-
}, function (props) {
|
|
105
|
-
return props.groupVariant === 'squared' && css(["&.ant-btn{border-radius:0;}"]);
|
|
106
|
-
}, function (props) {
|
|
107
|
-
return props.groupVariant === 'left-rounded' && css(["&.ant-btn{border-radius:3px 0 0 3px;}"]);
|
|
108
|
-
}, function (props) {
|
|
109
|
-
return props.groupVariant === 'right-rounded' && css(["&.ant-btn{border-radius:0 3px 3px 0;}"]);
|
|
110
|
-
}, function (props) {
|
|
111
|
-
return props.error && css(["&.ant-btn{background-color:", ";box-shadow:inset 0 0 0 1px ", ";", "{color:", ";}svg{fill:", ";}.btn-focus{box-shadow:none;}&&&:hover:not(:disabled):not(:focus){background-color:", ";box-shadow:inset 0 0 0 1px ", ";", "{color:", ";}svg{fill:", " !important;}}&:active{background-color:", ";box-shadow:none;", "{color:", ";}svg{fill:", ";}}&&&:focus:not(:active){border:none !important;background-color:", ";", "{color:", ";}.btn-focus{box-shadow:inset 0 0 0 2px ", ";}}svg{fill:", ";}}", "{background-color:", ";}"], props.theme.palette["red-100"], props.theme.palette['red-600'], ButtonLabel, props.theme.palette["red-600"], props.theme.palette["red-600"], props.theme.palette["red-200"], props.theme.palette['red-600'], ButtonLabel, props.theme.palette["red-600"], props.theme.palette["red-600"], props.theme.palette["red-700"], ButtonLabel, props.theme.palette.white, props.theme.palette.white, props.theme.palette["red-100"], ButtonLabel, props.theme.palette["red-600"], props.theme.palette['blue-600'], props.theme.palette["red-600"], RippleEffect, props.theme.palette["red-700"]);
|
|
112
|
-
}, function (props) {
|
|
113
|
-
return props.error && props.type === 'secondary' && css(["&&&.ant-btn{", "{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:", ";", "{color:", ";}svg{fill:", ";}}", "{background-color:", ";}}"], ButtonLabel, 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"], ButtonLabel, props.theme.palette.white, props.theme.palette.white, RippleEffect, props.theme.palette["red-700"]);
|
|
114
|
-
}, function (props) {
|
|
115
|
-
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);
|
|
116
|
-
}, function (props) {
|
|
117
|
-
return props.type === 'custom-color-ghost' && !props.error && css(["&&&{color:", ";.ds-icon > svg{fill:", ";}&: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 + "-600"], props.theme.palette[props.customColor + "-600"]);
|
|
118
|
-
}, function (props) {
|
|
119
|
-
return props.readOnly && props.type === 'custom-color-ghost' && css(["&&.ant-btn{cursor:default;transition:none;}&&.ant-btn-ghost-primary{&:hover,&:focus{background:", ";.btn-focus{box-shadow:inset 0 0 0 0 ", ";}", ",svg{color:", ";}svg{fill:", ";!important;}}}"], props.theme.palette.white, props.theme.palette.white, ButtonLabel, props.theme.palette[props.customColor + "-600"], props.theme.palette[props.customColor + "-600"]);
|
|
120
|
-
}, Tag, function (props) {
|
|
121
|
-
return props.theme.palette.white;
|
|
122
|
-
});
|
|
64
|
+
})([" &&{-webkit-mask-image:-webkit-radial-gradient(white,black);display:inline-flex;align-items:center;padding:0 12px;position:relative;overflow:hidden;justify-content:", ";", ";&:not(:disabled):not(:focus){", " span{color:inherit;}}", " > *:not(.btn-focus){position:relative;}", " > .ds-icon,> .ds-icon{display:flex;align-items:center;justify-content:center;margin:0;width:24px;height:24px;svg{transition:all .3s cubic-bezier(.645,.045,.355,1);}}", " &&.ant-btn-default:not(.ds-expander):not(.ds-button-creator):not(.read-only):not([disabled]),&&.ant-btn-secondary:not(.ds-expander):not(.ds-button-creator):not(.read-only):not([disabled]){&:active{", "}&:focus:not(:active){color:", ";svg{fill:currentColor;}background:", ";}&:hover:not(:disabled):not(:focus){background-color:", ";&.ant-btn .btn-focus{box-shadow:inset 0 0 0 1px ", ";}", " > .ds-icon:before{background-color:", ";}}&:active{color:", ";svg{fill:", ";!important;}}}", " ", ";", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " ", " &:hover:not(:disabled):not(:focus){", " span{color:", ";cursor:inherit;}}}"], (props) => props.justifyContent, (props) => props.shape && props.shape === "circle" && css(["border-radius:50%;"]), ButtonLabel, ButtonLabel, ButtonLabel, (props) => props.mode !== "single-icon" && css(["&.ant-btn:not(.ds-expander):not(.ds-button-creator):not( .btn-search ):not(.btn-search-open){min-width:54px;}"]), (props) => pressedStyles(props), (props) => props.error ? props.theme.palette["red-600"] : props.theme.palette["grey-600"], (props) => props.theme.palette["grey-050"], (props) => props.theme.palette["blue-050"], (props) => props.theme.palette["blue-300"], ButtonLabel, (props) => props.theme.palette["blue-200"], (props) => props.theme.palette["blue-600"], (props) => props.theme.palette["blue-600"], (props) => props.readOnly && props.type !== "custom-color-ghost" && css(["&&.ant-btn{cursor:default;transition:none;}&&.ant-btn-secondary{&:hover,&:focus{background:", ";.btn-focus{box-shadow:inset 0 0 0 1px ", ";}", ",svg{color:", ";}svg{fill:", " !important;}}}&&.ant-btn-primary{&:hover,&:focus{background:", ";.btn-focus{box-shadow:inset 0 0 0 1px ", ";}", ",svg{color:", ";}svg{fill:", " !important;}}}&&.ant-btn-tertiary{&:hover,&:focus{background:", ";.btn-focus{box-shadow:inset 0 0 0 0 ", ";}", ",svg{color:", ";}svg{fill:", " !important;}}}&&.ant-btn-tertiary-white{&:hover,&:focus{background:rgba(219,224,227,0.15);.btn-focus{box-shadow:inset 0 0 0 0 rgba(219,224,227,0.15);}", ",svg{color:", ";}svg{fill:", " !important;}}}&&.ant-btn-ghost-primary{&:hover,&:focus{background:", ";.btn-focus{box-shadow:inset 0 0 0 0 ", ";}", ",svg{color:", ";}svg{fill:", " !important;}}}&&.ant-btn-ghost{&:hover,&:focus{background:", ";.btn-focus{box-shadow:inset 0 0 0 0 ", ";}", ",svg{color:", ";}svg{fill:", " !important;}}}&&.ant-btn-ghost-white{&:hover,&:focus{background:", ";.btn-focus{box-shadow:inset 0 0 0 0 ", ";}", ",svg{color:", ";}svg{fill:", " !important;}}}"], props.theme.palette["grey-050"], props.theme.palette["grey-300"], ButtonLabel, props.theme.palette["grey-700"], props.theme.palette["grey-700"], props.theme.palette["blue-600"], props.theme.palette["blue-600"], ButtonLabel, props.theme.palette["grey-050"], props.theme.palette["grey-050"], props.theme.palette["grey-100"], props.theme.palette["grey-100"], ButtonLabel, props.theme.palette["grey-700"], props.theme.palette["grey-700"], ButtonLabel, props.theme.palette["grey-050"], props.theme.palette["grey-050"], props.theme.palette.white, props.theme.palette.white, ButtonLabel, props.theme.palette["blue-600"], props.theme.palette["blue-600"], props.theme.palette.white, props.theme.palette.white, ButtonLabel, props.theme.palette["grey-600"], props.theme.palette["grey-600"], props.theme.palette["grey-600"], props.theme.palette["grey-600"], ButtonLabel, props.theme.palette["grey-050"], props.theme.palette["grey-050"]), (props) => props.loading && css(["> *:not(.btn-focus){opacity:0;visibility:hidden;}", "{opacity:1;visibility:visible;}"], Spinner), (props) => buttonTypes.includes(props.type) && !props.error && css(["&.ant-btn{&:not(:disabled){svg{fill:", ";}&:hover{svg{fill:currentColor;}}}}"], props.iconColor ? props.theme.palette[`${props.iconColor}-600`] : "currentColor"), (props) => props.mode === "split" && css(["&.ant-btn{padding-right:0;transition:0s;", "{position:relative;}", " > .ds-icon{margin:0 4px 0 15px;position:relative;&:before{content:'';background-color:", ";top:", ";height:", ";width:1px;left:-4px;position:absolute;transition:all 0.3s ease;}}}"], ButtonLabel, ButtonLabel, !splitTypes.includes(props.type) ? `rgba(255, 255, 255, 0.15);` : props.theme.palette["grey-300"], props.size === "large" ? "-12px" : "-4px", props.size === "large" ? "48px" : "32px"), (props) => props.mode === "two-icons" && css(["&.ant-btn{padding:0;transition:0s;", " > ", ":first-of-type,", " > .ds-icon:first-of-type,& > ", ":first-of-type,& > .ds-icon:first-of-type{margin:", ";}", " > ", ":nth-of-type(2),", " > .ds-icon:nth-of-type(2),& > ", ":nth-of-type(2),& > .ds-icon:nth-of-type(2){margin:", ";}}", "{margin:0 12px 0 0;}"], ButtonLabel, IconContainer, ButtonLabel, IconContainer, leftIcon, ButtonLabel, IconContainer, ButtonLabel, IconContainer, rightIcon, Tag), (props) => props.mode === "label-icon" && css(["&.ant-btn{padding-right:0;transition:0s;", " > ", ",", " > .ds-icon,& > ", ",& > .ds-icon{margin:", ";}}", "{margin:0 12px 0 0;}"], ButtonLabel, IconContainer, ButtonLabel, IconContainer, rightIcon, Tag), (props) => props.mode === "icon-label" && css(["&.ant-btn{padding-left:0;transition:0s;", " > ", ",", " > .ds-icon,& > ", ",& > .ds-icon{margin:", ";}}"], ButtonLabel, IconContainer, ButtonLabel, IconContainer, leftIcon), (props) => props.mode === "single-icon" && css(["&.ant-btn:not(.ds-expander){display:flex;align-items:center;justify-content:center;padding:0;transition:0s;width:32px;", " > ", ",", " > .ds-icon,& > ", ",& > .ds-icon{margin:0 4px 0 4px;}}"], ButtonLabel, IconContainer, ButtonLabel, IconContainer), (props) => props.mode === "single-icon" && props.size === "large" && css(["&.ant-btn{width:48px;}"]), (props) => props.groupVariant === "squared" && css(["&.ant-btn{border-radius:0;}"]), (props) => props.groupVariant === "left-rounded" && css(["&.ant-btn{border-radius:3px 0 0 3px;}"]), (props) => props.groupVariant === "right-rounded" && css(["&.ant-btn{border-radius:0 3px 3px 0;}"]), (props) => props.error && css(["&.ant-btn{background-color:", ";box-shadow:inset 0 0 0 1px ", ";", "{color:", ";}svg{fill:", ";}.btn-focus{box-shadow:none;}&&&:hover:not(:disabled):not(:focus){background-color:", ";box-shadow:inset 0 0 0 1px ", ";", "{color:", ";}svg{fill:", " !important;}}&:active{background-color:", ";box-shadow:none;", "{color:", ";}svg{fill:", ";}}&&&:focus:not(:active){border:none !important;background-color:", ";", "{color:", ";}.btn-focus{box-shadow:inset 0 0 0 2px ", ";}}svg{fill:", ";}}", "{background-color:", ";}"], props.theme.palette[`red-100`], props.theme.palette["red-600"], ButtonLabel, props.theme.palette[`red-600`], props.theme.palette[`red-600`], props.theme.palette[`red-200`], props.theme.palette["red-600"], ButtonLabel, props.theme.palette[`red-600`], props.theme.palette[`red-600`], props.theme.palette[`red-700`], ButtonLabel, props.theme.palette.white, props.theme.palette.white, props.theme.palette[`red-100`], ButtonLabel, props.theme.palette[`red-600`], props.theme.palette["blue-600"], props.theme.palette[`red-600`], RippleEffect, props.theme.palette[`red-700`]), (props) => props.error && props.type === "secondary" && css(["&&&.ant-btn{", "{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:", ";", "{color:", ";}svg{fill:", ";}}", "{background-color:", ";}}"], ButtonLabel, 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`], ButtonLabel, props.theme.palette.white, props.theme.palette.white, RippleEffect, props.theme.palette[`red-700`]), (props) => 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), (props) => props.type === "custom-color-ghost" && !props.error && css(["&&&{color:", ";.ds-icon > svg{fill:", ";}&: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}-600`], props.theme.palette[`${props.customColor}-600`]), (props) => props.readOnly && props.type === "custom-color-ghost" && css(["&&.ant-btn{cursor:default;transition:none;}&&.ant-btn-ghost-primary{&:hover,&:focus{background:", ";.btn-focus{box-shadow:inset 0 0 0 0 ", ";}", ",svg{color:", ";}svg{fill:", ";!important;}}}"], props.theme.palette.white, props.theme.palette.white, ButtonLabel, props.theme.palette[`${props.customColor}-600`], props.theme.palette[`${props.customColor}-600`]), Tag, (props) => props.theme.palette.white);
|
|
65
|
+
export {
|
|
66
|
+
AntdButton,
|
|
67
|
+
ButtonFocus,
|
|
68
|
+
ButtonLabel,
|
|
69
|
+
RIPPLE_ANIMATION_TIME,
|
|
70
|
+
RippleEffect,
|
|
71
|
+
Spinner,
|
|
72
|
+
Tag
|
|
73
|
+
};
|