@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/dist/Button.types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
1
|
+
import { ButtonProps as AntdButtonProps } from 'antd/lib/button';
|
|
2
|
+
import { JustifyContentProperty } from 'csstype';
|
|
3
|
+
import { ForwardRefExoticComponent, MouseEvent, RefAttributes } from 'react';
|
|
4
|
+
import { StyledComponent } from 'styled-components';
|
|
5
|
+
import { TagProps } from '@synerise/ds-tag';
|
|
6
|
+
import { TooltipProps } from '@synerise/ds-tooltip';
|
|
7
|
+
import { LiteralStringUnion } from '@synerise/ds-utils';
|
|
8
8
|
export declare enum ButtonMode {
|
|
9
9
|
SINGLE_ICON = "single-icon",
|
|
10
10
|
SPLIT = "split",
|
package/dist/Button.types.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return
|
|
8
|
-
}({});
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
var ButtonMode = /* @__PURE__ */ ((ButtonMode2) => {
|
|
2
|
+
ButtonMode2["SINGLE_ICON"] = "single-icon";
|
|
3
|
+
ButtonMode2["SPLIT"] = "split";
|
|
4
|
+
ButtonMode2["TWO_ICONS"] = "two-icons";
|
|
5
|
+
ButtonMode2["LABEL_ICON"] = "label-icon";
|
|
6
|
+
ButtonMode2["ICON_LABEL"] = "icon-label";
|
|
7
|
+
return ButtonMode2;
|
|
8
|
+
})(ButtonMode || {});
|
|
9
|
+
export {
|
|
10
|
+
ButtonMode
|
|
11
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ButtonToggleProps } from './ButtonToggle.types';
|
|
3
3
|
declare const ButtonToggle: ({ activated, type, ...buttonProps }: ButtonToggleProps) => React.JSX.Element;
|
|
4
4
|
export default ButtonToggle;
|
|
@@ -1,33 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var mappedButtonType = useMemo(function () {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { ButtonToggle as ButtonToggle$1 } from "./ButtonToggle.styles.js";
|
|
4
|
+
const ButtonToggle = ({
|
|
5
|
+
activated,
|
|
6
|
+
type,
|
|
7
|
+
...buttonProps
|
|
8
|
+
}) => {
|
|
9
|
+
const mappedButtonType = useMemo(() => {
|
|
11
10
|
switch (type) {
|
|
12
|
-
case
|
|
13
|
-
return activated ?
|
|
14
|
-
case
|
|
11
|
+
case "ghost":
|
|
12
|
+
return activated ? "ghost" : "ghost";
|
|
13
|
+
case "solid":
|
|
15
14
|
default:
|
|
16
|
-
return activated ?
|
|
15
|
+
return activated ? "primary" : "secondary";
|
|
17
16
|
}
|
|
18
17
|
}, [activated, type]);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
buttonProps.onPointerUp
|
|
22
|
-
setTimeout(
|
|
18
|
+
const handlePointerUp = (event) => {
|
|
19
|
+
const button = event.currentTarget;
|
|
20
|
+
buttonProps.onPointerUp?.(event);
|
|
21
|
+
setTimeout(() => {
|
|
23
22
|
button && button.blur();
|
|
24
23
|
}, 200);
|
|
25
24
|
};
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
type: mappedButtonType
|
|
31
|
-
}));
|
|
25
|
+
return /* @__PURE__ */ jsx(ButtonToggle$1, { ...buttonProps, toggleType: type, activated, onPointerUp: handlePointerUp, type: mappedButtonType });
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
ButtonToggle as default
|
|
32
29
|
};
|
|
33
|
-
export default ButtonToggle;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare const ButtonToggle: import(
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare const ButtonToggle: import('styled-components').StyledComponent<({ toggleType, activated, ...rest }: any) => React.JSX.Element, any, {}, never>;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return /*#__PURE__*/React.createElement(Button, rest);
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import styled, { css } from "styled-components";
|
|
3
|
+
import Button from "../Button.js";
|
|
4
|
+
import { ButtonFocus } from "../Button.styles.js";
|
|
5
|
+
const ButtonToggle = /* @__PURE__ */ styled(({
|
|
6
|
+
toggleType,
|
|
7
|
+
activated,
|
|
8
|
+
...rest
|
|
9
|
+
}) => {
|
|
10
|
+
return /* @__PURE__ */ jsx(Button, { ...rest });
|
|
12
11
|
}).withConfig({
|
|
13
12
|
displayName: "ButtonTogglestyles__ButtonToggle",
|
|
14
13
|
componentId: "sc-1m60zt6-0"
|
|
15
|
-
})(["", ""],
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
})(["", ""], (props) => props.toggleType === "ghost" && css(["&:hover:not(:disabled):not(:focus){color:", ";}", ""], props.theme.palette["grey-600"], !props.activated ? css(["&:hover:not(:disabled):not(:focus){color:", ";svg{fill:currentColor;}}"], props.theme.palette["grey-600"]) : css(["", ""], !props.disabled && css(["&&{background:", ";color:", ";svg{fill:currentColor;}", "{box-shadow:none;}}}"], props.theme.palette["blue-050"], props.theme.palette["blue-600"], ButtonFocus))));
|
|
15
|
+
export {
|
|
16
|
+
ButtonToggle
|
|
17
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CheckboxButtonProps } from './Checkbox.types';
|
|
3
3
|
declare const CheckboxButton: (props: CheckboxButtonProps) => React.ReactElement;
|
|
4
4
|
export default CheckboxButton;
|
|
@@ -1,75 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
indeterminate = _ref.indeterminate;
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import Icon, { CheckboxIndeterminateM, CheckboxSelectedFillM } from "@synerise/ds-icon";
|
|
4
|
+
import Button from "../Button.js";
|
|
5
|
+
import { IconWrapper, DefaultIcon, HoverIcon } from "./Checkbox.styles.js";
|
|
6
|
+
const CheckboxButtonIcon = ({
|
|
7
|
+
checked,
|
|
8
|
+
indeterminate
|
|
9
|
+
}) => {
|
|
11
10
|
if (indeterminate) {
|
|
12
|
-
return
|
|
11
|
+
return /* @__PURE__ */ jsx(CheckboxIndeterminateM, {});
|
|
13
12
|
}
|
|
14
13
|
if (checked) {
|
|
15
|
-
return
|
|
14
|
+
return /* @__PURE__ */ jsx(CheckboxSelectedFillM, {});
|
|
16
15
|
}
|
|
17
|
-
return
|
|
16
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
17
|
+
/* @__PURE__ */ jsx(DefaultIcon, {}),
|
|
18
|
+
/* @__PURE__ */ jsx(HoverIcon, {})
|
|
19
|
+
] });
|
|
18
20
|
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
const getNextCheckedState = (prevState, {
|
|
22
|
+
checked,
|
|
23
|
+
indeterminate
|
|
24
|
+
}) => {
|
|
22
25
|
if (indeterminate === true) {
|
|
23
26
|
return true;
|
|
24
27
|
}
|
|
25
|
-
if (checked ===
|
|
28
|
+
if (checked === void 0) {
|
|
26
29
|
return !prevState;
|
|
27
30
|
}
|
|
28
31
|
return !checked;
|
|
29
32
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
defaultChecked =
|
|
34
|
-
hasError
|
|
35
|
-
indeterminate
|
|
36
|
-
onChange
|
|
37
|
-
onClick
|
|
38
|
-
restProps
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (typeof onClick === 'function') {
|
|
33
|
+
const CheckboxButton = (props) => {
|
|
34
|
+
const {
|
|
35
|
+
checked,
|
|
36
|
+
defaultChecked = false,
|
|
37
|
+
hasError,
|
|
38
|
+
indeterminate,
|
|
39
|
+
onChange,
|
|
40
|
+
onClick,
|
|
41
|
+
...restProps
|
|
42
|
+
} = props;
|
|
43
|
+
const [isCheckedState, setIsCheckedState] = React.useState(defaultChecked);
|
|
44
|
+
const handleButtonClick = (e) => {
|
|
45
|
+
if (typeof onClick === "function") {
|
|
44
46
|
onClick(e);
|
|
45
47
|
}
|
|
46
|
-
setIsCheckedState(
|
|
47
|
-
|
|
48
|
-
if (typeof onChange ===
|
|
48
|
+
setIsCheckedState((prevState) => {
|
|
49
|
+
const nextState = getNextCheckedState(prevState, props);
|
|
50
|
+
if (typeof onChange === "function") {
|
|
49
51
|
onChange(nextState);
|
|
50
52
|
}
|
|
51
53
|
return nextState;
|
|
52
54
|
});
|
|
53
55
|
};
|
|
54
|
-
|
|
55
|
-
return
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
},
|
|
62
|
-
tabIndex: 0,
|
|
63
|
-
type: "ghost-primary",
|
|
64
|
-
onClick: handleButtonClick
|
|
65
|
-
}, restProps), /*#__PURE__*/React.createElement(S.IconWrapper, {
|
|
66
|
-
active: indeterminate || isChecked,
|
|
67
|
-
error: hasError
|
|
68
|
-
}, /*#__PURE__*/React.createElement(Icon, {
|
|
69
|
-
component: /*#__PURE__*/React.createElement(CheckboxButtonIcon, {
|
|
70
|
-
checked: isChecked,
|
|
71
|
-
indeterminate: indeterminate
|
|
72
|
-
})
|
|
73
|
-
})));
|
|
56
|
+
const isChecked = checked !== void 0 ? checked : isCheckedState;
|
|
57
|
+
return /* @__PURE__ */ jsx(Button, { "aria-checked": indeterminate ? "mixed" : isChecked, mode: "single-icon", role: "checkbox", style: {
|
|
58
|
+
transition: "none"
|
|
59
|
+
}, tabIndex: 0, type: "ghost-primary", onClick: handleButtonClick, ...restProps, children: /* @__PURE__ */ jsx(IconWrapper, { active: indeterminate || isChecked, error: hasError, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(CheckboxButtonIcon, { checked: isChecked, indeterminate }) }) }) });
|
|
60
|
+
};
|
|
61
|
+
export {
|
|
62
|
+
CheckboxButton as default
|
|
74
63
|
};
|
|
75
|
-
export default CheckboxButton;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export declare const IconWrapper: import(
|
|
1
|
+
export declare const IconWrapper: import('styled-components').StyledComponent<"span", any, {
|
|
2
2
|
active?: boolean;
|
|
3
3
|
error?: boolean;
|
|
4
4
|
}, never>;
|
|
5
|
-
export declare const DefaultIcon: import(
|
|
6
|
-
export declare const HoverIcon: import(
|
|
5
|
+
export declare const DefaultIcon: import('styled-components').StyledComponent<(props: React.SVGProps<SVGSVGElement>) => JSX.Element, any, {}, never>;
|
|
6
|
+
export declare const HoverIcon: import('styled-components').StyledComponent<(props: React.SVGProps<SVGSVGElement>) => JSX.Element, any, {}, never>;
|
|
7
7
|
declare const _default: {
|
|
8
|
-
IconWrapper: import(
|
|
8
|
+
IconWrapper: import('styled-components').StyledComponent<"span", any, {
|
|
9
9
|
active?: boolean;
|
|
10
10
|
error?: boolean;
|
|
11
11
|
}, never>;
|
|
@@ -1,45 +1,49 @@
|
|
|
1
|
-
import styled from
|
|
2
|
-
import { CheckboxDeafultM, CheckboxM } from
|
|
3
|
-
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { CheckboxDeafultM, CheckboxM } from "@synerise/ds-icon";
|
|
3
|
+
const IconWrapper = /* @__PURE__ */ styled.span.withConfig({
|
|
4
4
|
displayName: "Checkboxstyles__IconWrapper",
|
|
5
5
|
componentId: "sc-ssgaoj-0"
|
|
6
|
-
})(["&&&&{color:", ";svg{fill:", ";}}.ant-btn[disabled] & .ds-icon svg{fill:", " !important;}.ant-btn:hover & .ds-icon svg,.ant-btn:focus:hover & .ds-icon svg{fill:", ";}.ds-button.ant-btn &::before{content:'';display:'block';position:absolute;bottom:0;left:0;right:0;top:0;margin:5px;z-index:-1;}.ds-button.ant-btn &::before,.ds-button.ant-btn:hover &::before,.ds-button.ant-btn:focus:hover &::before{background:", ";}.ds-button.ant-btn[disabled] &::before,.ds-button.ant-btn[disabled]:hover &::before{background:", ";}"],
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
})(["&&&&{color:", ";svg{fill:", ";}}.ant-btn[disabled] & .ds-icon svg{fill:", " !important;}.ant-btn:hover & .ds-icon svg,.ant-btn:focus:hover & .ds-icon svg{fill:", ";}.ds-button.ant-btn &::before{content:'';display:'block';position:absolute;bottom:0;left:0;right:0;top:0;margin:5px;z-index:-1;}.ds-button.ant-btn &::before,.ds-button.ant-btn:hover &::before,.ds-button.ant-btn:focus:hover &::before{background:", ";}.ds-button.ant-btn[disabled] &::before,.ds-button.ant-btn[disabled]:hover &::before{background:", ";}"], ({
|
|
7
|
+
theme,
|
|
8
|
+
active,
|
|
9
|
+
error
|
|
10
|
+
}) => {
|
|
10
11
|
if (error) {
|
|
11
|
-
return theme.palette[
|
|
12
|
+
return theme.palette["red-600"];
|
|
12
13
|
}
|
|
13
|
-
return active ? theme.palette[
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
return active ? theme.palette["blue-600"] : theme.palette["grey-300"];
|
|
15
|
+
}, ({
|
|
16
|
+
theme,
|
|
17
|
+
active,
|
|
18
|
+
error
|
|
19
|
+
}) => {
|
|
18
20
|
if (error) {
|
|
19
|
-
return theme.palette[
|
|
21
|
+
return theme.palette["red-600"];
|
|
20
22
|
}
|
|
21
|
-
return active ? theme.palette[
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var theme = _ref6.theme;
|
|
33
|
-
return theme.palette['grey-050'];
|
|
34
|
-
});
|
|
35
|
-
export var DefaultIcon = styled(CheckboxDeafultM).withConfig({
|
|
23
|
+
return active ? theme.palette["blue-600"] : theme.palette["grey-300"];
|
|
24
|
+
}, ({
|
|
25
|
+
theme
|
|
26
|
+
}) => theme.palette["grey-200"], ({
|
|
27
|
+
theme
|
|
28
|
+
}) => theme.palette["blue-600"], ({
|
|
29
|
+
theme
|
|
30
|
+
}) => theme.palette.white, ({
|
|
31
|
+
theme
|
|
32
|
+
}) => theme.palette["grey-050"]);
|
|
33
|
+
const DefaultIcon = /* @__PURE__ */ styled(CheckboxDeafultM).withConfig({
|
|
36
34
|
displayName: "Checkboxstyles__DefaultIcon",
|
|
37
35
|
componentId: "sc-ssgaoj-1"
|
|
38
36
|
})(["display:block;.ds-button.ant-btn:not([disabled]):hover &{display:none;}"]);
|
|
39
|
-
|
|
37
|
+
const HoverIcon = /* @__PURE__ */ styled(CheckboxM).withConfig({
|
|
40
38
|
displayName: "Checkboxstyles__HoverIcon",
|
|
41
39
|
componentId: "sc-ssgaoj-2"
|
|
42
40
|
})(["display:none;.ds-button.ant-btn:not([disabled]):hover &{display:block;}"]);
|
|
43
|
-
|
|
44
|
-
IconWrapper
|
|
45
|
-
};
|
|
41
|
+
const Checkbox_styles = {
|
|
42
|
+
IconWrapper
|
|
43
|
+
};
|
|
44
|
+
export {
|
|
45
|
+
DefaultIcon,
|
|
46
|
+
HoverIcon,
|
|
47
|
+
IconWrapper,
|
|
48
|
+
Checkbox_styles as default
|
|
49
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Props as ButtonProps } from '../Button.types';
|
|
2
2
|
type ButtonPropsOmitted = Omit<ButtonProps, 'type' | 'block' | 'color' | 'groupVariant' | 'icon' | 'iconColor' | 'mode' | 'size' | 'onChange'>;
|
|
3
3
|
export type CheckboxButtonProps = ButtonPropsOmitted & {
|
|
4
4
|
checked?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { CreatorProps } from './Creator.types';
|
|
3
3
|
declare const Creator: React.ForwardRefExoticComponent<Omit<CreatorProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
4
4
|
export default Creator;
|
package/dist/Creator/Creator.js
CHANGED
|
@@ -1,46 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _useState = useState(false),
|
|
19
|
-
pressed = _useState[0],
|
|
20
|
-
setPressed = _useState[1];
|
|
21
|
-
var onPress = useCallback(function () {
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import classnames from "classnames";
|
|
3
|
+
import { forwardRef, useState, useCallback } from "react";
|
|
4
|
+
import Icon, { AddM } from "@synerise/ds-icon";
|
|
5
|
+
import { Creator as Creator$1, CreatorLabel } from "./Creator.styles.js";
|
|
6
|
+
const Creator = forwardRef(({
|
|
7
|
+
onClick,
|
|
8
|
+
disabled,
|
|
9
|
+
label,
|
|
10
|
+
block,
|
|
11
|
+
status,
|
|
12
|
+
className,
|
|
13
|
+
labelAlign = "center",
|
|
14
|
+
...htmlAttributes
|
|
15
|
+
}, ref) => {
|
|
16
|
+
const [pressed, setPressed] = useState(false);
|
|
17
|
+
const onPress = useCallback(() => {
|
|
22
18
|
setPressed(true);
|
|
23
19
|
}, []);
|
|
24
|
-
|
|
20
|
+
const onRelease = useCallback(() => {
|
|
25
21
|
setPressed(false);
|
|
26
22
|
}, []);
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
className: classnames([className, 'ds-button-creator']),
|
|
32
|
-
disabled: disabled,
|
|
33
|
-
onClick: onClick,
|
|
34
|
-
onMouseDown: onPress,
|
|
35
|
-
onMouseUp: onRelease,
|
|
36
|
-
onMouseLeave: onRelease,
|
|
37
|
-
withLabel: Boolean(label),
|
|
38
|
-
pressed: pressed,
|
|
39
|
-
status: status
|
|
40
|
-
}, htmlAttributes), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, {
|
|
41
|
-
component: /*#__PURE__*/React.createElement(AddM, null)
|
|
42
|
-
}), label && /*#__PURE__*/React.createElement(S.CreatorLabel, {
|
|
43
|
-
"data-testid": "ds-add-button-label"
|
|
44
|
-
}, label)));
|
|
23
|
+
return /* @__PURE__ */ jsx(Creator$1, { ref, block, labelAlign, className: classnames([className, "ds-button-creator"]), disabled, onClick, onMouseDown: onPress, onMouseUp: onRelease, onMouseLeave: onRelease, withLabel: Boolean(label), pressed, status, ...htmlAttributes, children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24
|
+
/* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(AddM, {}) }),
|
|
25
|
+
label && /* @__PURE__ */ jsx(CreatorLabel, { "data-testid": "ds-add-button-label", children: label })
|
|
26
|
+
] }) });
|
|
45
27
|
});
|
|
46
|
-
export
|
|
28
|
+
export {
|
|
29
|
+
Creator as default
|
|
30
|
+
};
|
|
@@ -1,32 +1,10 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export declare const CreatorLabel: import(
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export declare const CreatorLabel: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
3
3
|
type StyledCreatorProps = {
|
|
4
4
|
withLabel: boolean;
|
|
5
5
|
pressed: boolean;
|
|
6
6
|
status?: string;
|
|
7
7
|
labelAlign: 'left' | 'center';
|
|
8
8
|
};
|
|
9
|
-
export declare const Creator: import(
|
|
10
|
-
href: string;
|
|
11
|
-
target?: string;
|
|
12
|
-
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
13
|
-
} & import("antd/lib/button/button").BaseButtonProps & Omit<React.AnchorHTMLAttributes<any>, "type" | "onClick"> & {
|
|
14
|
-
htmlType?: import("antd/lib/button/button").ButtonHTMLType;
|
|
15
|
-
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
16
|
-
} & Omit<React.ButtonHTMLAttributes<any>, "type" | "onClick">>, "ghost" | "type"> & {
|
|
17
|
-
type?: import("@synerise/ds-utils").LiteralStringUnion<import("Button.types").ButtonType>;
|
|
18
|
-
mode?: import("@synerise/ds-utils").LiteralStringUnion<"single-icon" | "split" | "two-icons" | "label-icon" | "icon-label">;
|
|
19
|
-
color?: import("@synerise/ds-utils").LiteralStringUnion<"blue" | "grey" | "red" | "green" | "yellow" | "pink" | "mars" | "orange" | "fern" | "cyan" | "purple" | "violet">;
|
|
20
|
-
groupVariant?: import("@synerise/ds-utils").LiteralStringUnion<"left-rounded" | "squared" | "right-rounded">;
|
|
21
|
-
justifyContent?: import("csstype").JustifyContentProperty;
|
|
22
|
-
loading?: boolean | {
|
|
23
|
-
delay?: number;
|
|
24
|
-
};
|
|
25
|
-
onClick?: (event: React.MouseEvent<HTMLElement>) => void;
|
|
26
|
-
iconColor?: import("@synerise/ds-utils").LiteralStringUnion<"blue" | "grey" | "red" | "green" | "yellow" | "pink" | "mars" | "orange" | "fern" | "cyan" | "purple" | "violet">;
|
|
27
|
-
error?: boolean;
|
|
28
|
-
readOnly?: boolean;
|
|
29
|
-
tagProps?: import("@synerise/ds-tag").TagProps;
|
|
30
|
-
tooltipProps?: import("@synerise/ds-tooltip").TooltipProps;
|
|
31
|
-
} & StyledCreatorProps & React.RefAttributes<HTMLButtonElement>>, any, StyledCreatorProps, never>;
|
|
9
|
+
export declare const Creator: import('styled-components').StyledComponent<React.ForwardRefExoticComponent<any>, any, StyledCreatorProps, never>;
|
|
32
10
|
export {};
|