@synerise/ds-button 1.5.26 → 1.5.27
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 +4 -0
- package/README.md +1 -1
- package/dist/BaseButton.d.ts +22 -0
- package/dist/BaseButton.js +89 -0
- package/dist/BaseButton.styles.d.ts +1 -0
- package/dist/BaseButton.styles.js +11 -0
- package/dist/BaseButton.types.d.ts +29 -0
- package/dist/BaseButton.types.js +1 -0
- package/dist/Button.d.ts +5 -11
- package/dist/Button.js +34 -28
- package/dist/Button.styles.d.ts +29 -15
- package/dist/Button.styles.js +9 -31
- package/dist/Button.types.d.ts +18 -20
- package/dist/Button.types.js +7 -8
- package/dist/Button.variants.d.ts +16 -0
- package/dist/Button.variants.js +48 -0
- package/dist/ButtonToggle/ButtonToggle.styles.js +1 -1
- package/dist/Checkbox/Checkbox.styles.js +1 -1
- package/dist/Creator/Creator.styles.d.ts +13 -21
- package/dist/Creator/Creator.styles.js +11 -15
- package/dist/Expander/Expander.js +1 -1
- package/dist/Expander/Expander.styles.d.ts +19 -6
- package/dist/Expander/Expander.styles.js +5 -9
- package/dist/Expander/Expander.types.d.ts +3 -5
- package/dist/Expander/Expander.types.js +4 -5
- package/dist/Star/Star.styles.js +1 -1
- package/dist/Star/Star.types.d.ts +2 -2
- package/dist/index.d.ts +5 -12
- package/package.json +3 -7
- package/dist/assets/style/index-tn0RQdqM.css +0 -0
- package/dist/style/index.css +0 -1
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { css } from "styled-components";
|
|
2
|
+
const buttonColor = (color, background, border) => css(["color:", ";background:", ";border-color:", ";"], color, background, border);
|
|
3
|
+
const buttonDisabled = (color, background, border) => css(["&.disabled,&[disabled]{&,&:hover,&:focus-visible,&:active,&.active{", " box-shadow:none;}}"], buttonColor(color, background, border));
|
|
4
|
+
const buttonHover = (color, background, border) => css(["box-shadow:none;&:not(:disabled):not(:focus-visible):not(.pressed){", " span{color:", ";}}"], buttonColor(color, background, border), color);
|
|
5
|
+
const variantPrimary = (p) => css(["", " .btn-focus{box-shadow:inset 0 0 0 0px ", ";}&:hover{", "}&:focus-visible{", " .btn-focus{box-shadow:inset 0 0 0 2px ", ";}}&.pressed,&.active{", "}.btn-ripple{background-color:", ";}", ""], buttonColor(p.white, p["blue-600"], p["blue-600"]), p["grey-300"], buttonHover(p.white, p["blue-500"], p["blue-500"]), buttonColor(p.white, p["blue-600"], p["blue-700"]), p["blue-700"], buttonColor(p.white, p["blue-700"], p["blue-700"]), p["blue-700"], buttonDisabled(p.white, `rgba(${hexToRgbValues(p["blue-600"])}, 0.4)`, "transparent"));
|
|
6
|
+
const variantDefault = (p) => css(["", " .btn-focus{box-shadow:inset 0 0 0 1px ", ";}&:hover{", "}&:focus-visible{", " .btn-focus{box-shadow:inset 0 0 0 2px ", ";}}&.pressed,&.active{", " border-color:", ";}.btn-ripple{background-color:", ";}", ""], buttonColor(p["grey-600"], p["grey-050"], p["grey-300"]), p["grey-300"], buttonHover(p["blue-600"], p.white, p["grey-300"]), buttonColor(p["grey-600"], p["grey-050"], p["grey-300"]), p["blue-600"], buttonColor(p["grey-600"], p["grey-100"], p["grey-100"]), p["grey-300"], p["grey-100"], buttonDisabled(`rgba(${hexToRgbValues(p["grey-700"])}, 0.4)`, `rgba(${hexToRgbValues(p["grey-050"])}, 0.4)`, p["grey-200"]));
|
|
7
|
+
const variantTertiary = (p) => css(["", " .btn-focus{box-shadow:inset 0 0 0 0px ", ";}&:hover{", "}&:focus-visible{", " .btn-focus{box-shadow:inset 0 0 0 2px ", ";}}&.pressed,&.active{", "}.btn-ripple{background-color:rgba( ", ",", " );}", ""], buttonColor(p["grey-700"], `rgba(${hexToRgbValues(p["grey-400"])}, 0.15)`, "transparent"), p["grey-300"], buttonHover(p["grey-700"], `rgba(${hexToRgbValues(p["grey-400"])}, 0.25)`, "transparent"), buttonColor(p["grey-700"], `rgba(${hexToRgbValues(p["grey-400"])}, 0.15)`, `rgba(${hexToRgbValues(p["grey-400"])}, 0.15)`), p["blue-600"], buttonColor(p["grey-700"], `rgba(${hexToRgbValues(p["grey-400"])}, 0.35)`, `rgba(${hexToRgbValues(p["grey-400"])}, 0.35)`), hexToRgbValues(p["grey-400"]), rippleAlpha(0.25, 0.35), buttonDisabled(`rgba(${hexToRgbValues(p["grey-700"])}, 0.4)`, `rgba(${hexToRgbValues(p["grey-400"])}, 0.15)`, "transparent"));
|
|
8
|
+
const variantTertiaryWhite = (p) => css(["", " .btn-focus{box-shadow:inset 0 0 0 0px ", ";}&:hover{", "}&:focus-visible{", " .btn-focus{box-shadow:inset 0 0 0 2px ", ";}}&.pressed,&.active{", "}.btn-ripple{background-color:rgba( ", ",", " );}", ""], buttonColor(p.white, `rgba(${hexToRgbValues(p["grey-300"])}, 0.15)`, "transparent"), p["blue-600"], buttonHover(p.white, `rgba(${hexToRgbValues(p["grey-300"])}, 0.25)`, "transparent"), buttonColor(p.white, `rgba(${hexToRgbValues(p["grey-300"])}, 0.15)`, `rgba(${hexToRgbValues(p["grey-300"])}, 0.15)`), p["blue-600"], buttonColor(p.white, `rgba(${hexToRgbValues(p["grey-300"])}, 0.1)`, `rgba(${hexToRgbValues(p["grey-300"])}, 0.1)`), hexToRgbValues(p["grey-300"]), rippleAlpha(0.25, 0.1), buttonDisabled(`rgba(255, 255, 255, 0.4)`, `rgba(${hexToRgbValues(p["grey-300"])}, 0.15)`, "transparent"));
|
|
9
|
+
const variantGhost = (p) => css(["", " box-shadow:none;border-color:transparent;.btn-focus{box-shadow:inset 0 0 0 0px transparent;}&:hover{", "}&:focus-visible{", " .btn-focus{box-shadow:inset 0 0 0 2px ", ";}}&.pressed,&.active{", "}.btn-ripple{background-color:rgba( ", ",", " );}", ""], buttonColor(p["grey-600"], "transparent", "transparent"), buttonHover(p["blue-600"], `rgba(${hexToRgbValues(p["grey-400"])}, 0.25)`, "transparent"), buttonColor(p["grey-600"], "transparent", "transparent"), p["blue-600"], buttonColor(p["grey-600"], `rgba(${hexToRgbValues(p["grey-400"])}, 0.35)`, `rgba(${hexToRgbValues(p["grey-400"])}, 0.35)`), hexToRgbValues(p["grey-400"]), rippleAlpha(0.25, 0.35), buttonDisabled(`rgba(${hexToRgbValues(p["grey-700"])}, 0.4)`, "transparent", "transparent"));
|
|
10
|
+
const variantGhostPrimary = (p) => css(["", " .btn-focus{box-shadow:inset 0 0 0 0px transparent;}&:hover{", "}&:focus-visible{", " .btn-focus{box-shadow:inset 0 0 0 2px ", ";}}&.pressed,&.active{", "}.btn-ripple{background-color:rgba( ", ",", " );}", ""], buttonColor(p["blue-600"], "transparent", "transparent"), buttonHover(p["blue-600"], `rgba(${hexToRgbValues(p["grey-400"])}, 0.25)`, "transparent"), buttonColor(p["blue-600"], "transparent", "transparent"), p["blue-600"], buttonColor(p["blue-600"], `rgba(${hexToRgbValues(p["grey-400"])}, 0.35)`, `rgba(${hexToRgbValues(p["grey-400"])}, 0.35)`), hexToRgbValues(p["grey-400"]), rippleAlpha(0.25, 0.35), buttonDisabled(`rgba(${hexToRgbValues(p["blue-600"])}, 0.4)`, "transparent", "transparent"));
|
|
11
|
+
const variantGhostWhite = (p) => css(["", " .btn-focus{box-shadow:inset 0 0 0 0 transparent;}&:hover{", "}&:focus-visible{", " .btn-focus{box-shadow:inset 0 0 0 2px ", ";}}&.pressed,&.active{", "}.btn-ripple{background-color:rgba( ", ",", " );}", ""], buttonColor(p.white, "transparent", "transparent"), buttonHover(p.white, `rgba(${hexToRgbValues(p["grey-500"])}, 0.25)`, "transparent"), buttonColor(p.white, "transparent", "transparent"), p["blue-600"], buttonColor(p.white, `rgba(${hexToRgbValues(p["grey-500"])}, 0.1)`, `rgba(${hexToRgbValues(p["grey-500"])}, 0.1)`), hexToRgbValues(p["grey-500"]), rippleAlpha(0.25, 0.1), buttonDisabled("rgba(255, 255, 255, 0.4)", "transparent", "transparent"));
|
|
12
|
+
const variantDanger = (p) => css(["", " .btn-focus{box-shadow:inset 0 0 0 0 transparent;}&:hover{", " box-shadow:0 2px 4px 0 rgba(255,90,77,0.2);}&:focus-visible{", " .btn-focus{box-shadow:inset 0 0 0 2px ", ";}}&.pressed,&.active{", "}.btn-ripple{background-color:", ";}", ""], buttonColor(p.white, p["red-600"], p["red-600"]), buttonHover(p.white, p["red-500"], p["red-500"]), buttonColor(p.white, p["red-600"], p["red-600"]), p["blue-600"], buttonColor(p.white, p["red-700"], p["red-700"]), p["red-700"], buttonDisabled(p.white, `rgba(${hexToRgbValues(p["red-600"])}, 0.4)`, "transparent"));
|
|
13
|
+
const variantSuccess = (p) => css(["", " .btn-focus{box-shadow:inset 0 0 0 0 transparent;}&:hover{", "}&:focus-visible{", " .btn-focus{box-shadow:inset 0 0 0 2px ", ";}}&.pressed,&.active{", "}.btn-ripple{background-color:", ";}", ""], buttonColor(p.white, p["green-600"], p["green-600"]), buttonHover(p.white, p["green-500"], p["green-500"]), buttonColor(p.white, p["green-600"], p["green-500"]), p["blue-700"], buttonColor(p.white, p["green-700"], p["green-700"]), p["green-700"], buttonDisabled(p.white, `rgba(${hexToRgbValues(p["green-600"])}, 0.4)`, "transparent"));
|
|
14
|
+
const variantWarning = (p) => css(["", " .btn-focus{box-shadow:inset 0 0 0 0 transparent;}&:hover{", "}&:focus-visible{", " .btn-focus{box-shadow:inset 0 0 0 2px ", ";}}&.pressed,&.active{", "}.btn-ripple{background-color:", ";}", ""], buttonColor(p.white, p["yellow-600"], p["yellow-600"]), buttonHover(p.white, p["yellow-500"], p["yellow-500"]), buttonColor(p.white, p["yellow-600"], p["yellow-500"]), p["blue-600"], buttonColor(p.white, p["yellow-700"], p["yellow-700"]), p["yellow-700"], buttonDisabled(p.white, `rgba(${hexToRgbValues(p["yellow-600"])}, 0.4)`, "transparent"));
|
|
15
|
+
const variantMap = {
|
|
16
|
+
primary: variantPrimary,
|
|
17
|
+
default: variantDefault,
|
|
18
|
+
secondary: variantDefault,
|
|
19
|
+
tertiary: variantTertiary,
|
|
20
|
+
"tertiary-white": variantTertiaryWhite,
|
|
21
|
+
ghost: variantGhost,
|
|
22
|
+
"ghost-primary": variantGhostPrimary,
|
|
23
|
+
"custom-color-ghost": variantGhostPrimary,
|
|
24
|
+
"ghost-white": variantGhostWhite,
|
|
25
|
+
danger: variantDanger,
|
|
26
|
+
success: variantSuccess,
|
|
27
|
+
warning: variantWarning
|
|
28
|
+
};
|
|
29
|
+
const getVariantStyles = (type, palette) => {
|
|
30
|
+
const variantFn = variantMap[type || "default"] || variantMap.default;
|
|
31
|
+
return variantFn(palette);
|
|
32
|
+
};
|
|
33
|
+
function hexToRgbValues(hex) {
|
|
34
|
+
const cleaned = hex.replace("#", "");
|
|
35
|
+
const r = parseInt(cleaned.substring(0, 2), 16);
|
|
36
|
+
const g = parseInt(cleaned.substring(2, 4), 16);
|
|
37
|
+
const b = parseInt(cleaned.substring(4, 6), 16);
|
|
38
|
+
return `${r}, ${g}, ${b}`;
|
|
39
|
+
}
|
|
40
|
+
function rippleAlpha(hoverAlpha, pressedAlpha) {
|
|
41
|
+
if (pressedAlpha <= hoverAlpha) {
|
|
42
|
+
return pressedAlpha;
|
|
43
|
+
}
|
|
44
|
+
return (pressedAlpha - hoverAlpha) / (1 - hoverAlpha);
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
getVariantStyles
|
|
48
|
+
};
|
|
@@ -11,7 +11,7 @@ const ButtonToggle = /* @__PURE__ */ styled(({
|
|
|
11
11
|
}).withConfig({
|
|
12
12
|
displayName: "ButtonTogglestyles__ButtonToggle",
|
|
13
13
|
componentId: "sc-1m60zt6-0"
|
|
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;}}
|
|
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
15
|
export {
|
|
16
16
|
ButtonToggle
|
|
17
17
|
};
|
|
@@ -3,7 +3,7 @@ import { CheckboxDeafultM, CheckboxM } from "@synerise/ds-icon";
|
|
|
3
3
|
const IconWrapper = /* @__PURE__ */ styled.span.withConfig({
|
|
4
4
|
displayName: "Checkboxstyles__IconWrapper",
|
|
5
5
|
componentId: "sc-ssgaoj-0"
|
|
6
|
-
})(["
|
|
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
7
|
theme,
|
|
8
8
|
active,
|
|
9
9
|
error
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
export declare const CreatorLabel: import('styled-components').StyledComponent<"span", any, {}, never>;
|
|
3
2
|
type StyledCreatorProps = {
|
|
4
3
|
withLabel: boolean;
|
|
@@ -6,27 +5,20 @@ type StyledCreatorProps = {
|
|
|
6
5
|
status?: string;
|
|
7
6
|
labelAlign: 'left' | 'center';
|
|
8
7
|
};
|
|
9
|
-
export declare const Creator: import('styled-components').StyledComponent<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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;
|
|
8
|
+
export declare const Creator: import('styled-components').StyledComponent<import('react').ForwardRefExoticComponent<Omit<import('react').ButtonHTMLAttributes<HTMLButtonElement>, "type" | "onClick"> & {
|
|
9
|
+
onClick?: (event: import('react').MouseEvent<HTMLElement>) => void;
|
|
10
|
+
type?: string;
|
|
11
|
+
size?: import('../BaseButton.types').ButtonSize;
|
|
22
12
|
loading?: boolean | {
|
|
23
13
|
delay?: number;
|
|
24
14
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} &
|
|
15
|
+
block?: boolean;
|
|
16
|
+
htmlType?: import('../BaseButton.types').ButtonHTMLType;
|
|
17
|
+
href?: string;
|
|
18
|
+
target?: string;
|
|
19
|
+
download?: string | boolean;
|
|
20
|
+
children?: import('react').ReactNode;
|
|
21
|
+
} & import('react').RefAttributes<HTMLAnchorElement | HTMLButtonElement>>, any, {
|
|
22
|
+
type: "ghost";
|
|
23
|
+
} & StyledCreatorProps, "type">;
|
|
32
24
|
export {};
|
|
@@ -1,30 +1,24 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
1
|
import styled, { css } from "styled-components";
|
|
4
2
|
import { IconContainer } from "@synerise/ds-icon";
|
|
5
3
|
import { hexToRgba } from "@synerise/ds-utils";
|
|
6
|
-
import
|
|
7
|
-
import { RippleEffect, ButtonFocus } from "../Button.styles.js";
|
|
4
|
+
import BaseButton from "../BaseButton.js";
|
|
8
5
|
import { CreatorStatus } from "./Creator.types.js";
|
|
9
6
|
const CreatorLabel = /* @__PURE__ */ styled.span.withConfig({
|
|
10
7
|
displayName: "Creatorstyles__CreatorLabel",
|
|
11
8
|
componentId: "sc-1w96u6h-0"
|
|
12
|
-
})(["
|
|
9
|
+
})(["margin:0 12px 0 0;transition:all 0.3s ease;color:inherit;"]);
|
|
13
10
|
const errorStyles = ({
|
|
14
11
|
theme
|
|
15
|
-
}) => css(["border:1px dashed ", ";background:", ";&:focus{background:", ";}&:hover:not(:disabled):not(:focus){border:1px dashed ", ";background:", ";}"], theme.palette["red-600"], theme.palette["red-050"], theme.palette.white, theme.palette["grey-400"], theme.palette.white);
|
|
12
|
+
}) => css(["border:1px dashed ", ";background:", ";&:focus-visible{background:", ";}&:hover:not(:disabled):not(:focus-visible){border:1px dashed ", ";background:", ";}"], theme.palette["red-600"], theme.palette["red-050"], theme.palette.white, theme.palette["grey-400"], theme.palette.white);
|
|
16
13
|
const uploadStyles = ({
|
|
17
14
|
theme
|
|
18
|
-
}) => css(["&{border:1px dashed ", ";background-color:", ";
|
|
19
|
-
const Creator = /* @__PURE__ */ styled(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
withLabel,
|
|
23
|
-
...rest
|
|
24
|
-
}, ref) => /* @__PURE__ */ jsx(Button, { ref, ...rest }))).withConfig({
|
|
15
|
+
}) => css(["&{border:1px dashed ", ";background-color:", ";color:", ";&:hover:not(:disabled):not(:focus-visible){border:1px dashed ", ";background-color:", ";color:", ";}&:focus-visible:active{border:1px dashed ", ";background-color:", ";box-shadow:none;}&:focus-visible{border:1px dashed ", ";box-shadow:none;}&:disabled{color:", ";", "{margin:12px;}}}"], theme.palette["blue-300"], theme.palette["blue-050"], theme.palette["grey-600"], theme.palette["blue-300"], theme.palette["blue-050"], theme.palette["blue-500"], theme.palette["blue-600"], theme.palette["blue-050"], theme.palette["blue-600"], theme.palette["grey-500"], IconContainer);
|
|
16
|
+
const Creator = /* @__PURE__ */ styled(BaseButton).attrs({
|
|
17
|
+
type: "ghost"
|
|
18
|
+
}).withConfig({
|
|
25
19
|
displayName: "Creatorstyles__Creator",
|
|
26
20
|
componentId: "sc-1w96u6h-1"
|
|
27
|
-
})(["
|
|
21
|
+
})(["&&{display:inline-flex;width:", ";opacity:", ";height:48px;padding:", ";border-radius:3px;border:1px dashed ", ";background:transparent;color:", ";transition:all 0.3s ease;justify-content:", ";align-items:center;> span{display:flex;align-items:center;justify-content:", ";}", "{margin:auto 12px;}&:hover:not(:disabled):not(:focus-visible){border:1px dashed ", ";background-color:", ";}", " &:focus-visible:active{border:1px dashed ", " !important;box-shadow:none;background-color:", ";}&:focus-visible{border:1px dashed ", ";box-shadow:none;}&:disabled{border-color:", ";background-color:", ";}", " ", "}"], (props) => {
|
|
28
22
|
if (!props.withLabel) {
|
|
29
23
|
return "48px";
|
|
30
24
|
}
|
|
@@ -34,7 +28,9 @@ const Creator = /* @__PURE__ */ styled(forwardRef(({
|
|
|
34
28
|
return "auto";
|
|
35
29
|
}, (props) => props.disabled ? `0.4` : "1", (props) => props.withLabel ? `0 12px 0 0` : "0", ({
|
|
36
30
|
theme
|
|
37
|
-
}) => theme.palette["grey-300"], (
|
|
31
|
+
}) => theme.palette["grey-300"], ({
|
|
32
|
+
theme
|
|
33
|
+
}) => theme.palette["grey-600"], (props) => props.withLabel && !props.block ? `flex-start` : "center", (props) => props.labelAlign === "center" ? "center" : "flex-start", IconContainer, ({
|
|
38
34
|
theme
|
|
39
35
|
}) => theme.palette["grey-400"], ({
|
|
40
36
|
theme
|
|
@@ -10,7 +10,7 @@ const Expander = ({
|
|
|
10
10
|
onClick,
|
|
11
11
|
className
|
|
12
12
|
}) => {
|
|
13
|
-
return /* @__PURE__ */ jsx(Expander$1, { onClick,
|
|
13
|
+
return /* @__PURE__ */ jsx(Expander$1, { onClick, expanderSize: ExpanderSize[size], className: classnames([className, "ds-expander"]), expanded, disabled, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(AngleDownS, {}) }) });
|
|
14
14
|
};
|
|
15
15
|
export {
|
|
16
16
|
Expander as default
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
import { default as React } from 'react';
|
|
2
1
|
import { Keyframes } from 'styled-components';
|
|
3
2
|
import { ThemeProps } from '@synerise/ds-core';
|
|
4
3
|
export type ExpanderProps = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
expanded: boolean;
|
|
4
|
+
expanderSize?: number;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
expanded?: boolean;
|
|
9
7
|
};
|
|
10
8
|
export declare const focusAnimation: ({ theme }: ThemeProps) => Keyframes;
|
|
11
|
-
export declare const Expander: import('styled-components').StyledComponent<(
|
|
9
|
+
export declare const Expander: import('styled-components').StyledComponent<import('react').ForwardRefExoticComponent<Omit<import('react').ButtonHTMLAttributes<HTMLButtonElement>, "type" | "onClick"> & {
|
|
10
|
+
onClick?: (event: import('react').MouseEvent<HTMLElement>) => void;
|
|
11
|
+
type?: string;
|
|
12
|
+
size?: import('../BaseButton.types').ButtonSize;
|
|
13
|
+
loading?: boolean | {
|
|
14
|
+
delay?: number;
|
|
15
|
+
};
|
|
16
|
+
block?: boolean;
|
|
17
|
+
htmlType?: import('../BaseButton.types').ButtonHTMLType;
|
|
18
|
+
href?: string;
|
|
19
|
+
target?: string;
|
|
20
|
+
download?: string | boolean;
|
|
21
|
+
children?: import('react').ReactNode;
|
|
22
|
+
} & import('react').RefAttributes<HTMLAnchorElement | HTMLButtonElement>>, any, {
|
|
23
|
+
type: "ghost";
|
|
24
|
+
} & ExpanderProps, "type">;
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
1
|
import styled, { css, keyframes } from "styled-components";
|
|
3
2
|
import { IconContainer } from "@synerise/ds-icon";
|
|
4
|
-
import
|
|
3
|
+
import BaseButton from "../BaseButton.js";
|
|
5
4
|
const focusAnimation = ({
|
|
6
5
|
theme
|
|
7
6
|
}) => keyframes(["0%{box-shadow:inset 0 0 0 1px inherit;}50%{box-shadow:inset 0 0 0 1px ", ";}100%{box-shadow:inset 0 0 0 1px inherit;}"], theme.palette["blue-600"]);
|
|
8
7
|
const SIZE_DEFAULT = 24;
|
|
9
|
-
const Expander = /* @__PURE__ */ styled(({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
size,
|
|
13
|
-
...rest
|
|
14
|
-
}) => /* @__PURE__ */ jsx(Button, { mode: "single-icon", ...rest, children })).withConfig({
|
|
8
|
+
const Expander = /* @__PURE__ */ styled(BaseButton).attrs({
|
|
9
|
+
type: "ghost"
|
|
10
|
+
}).withConfig({
|
|
15
11
|
displayName: "Expanderstyles__Expander",
|
|
16
12
|
componentId: "sc-1a3xe1e-0"
|
|
17
|
-
})(["
|
|
13
|
+
})(["&&{display:flex;align-items:center;justify-content:center;padding:0;width:", "px;height:", "px;border-radius:50%;background-color:", ";box-shadow:inset 0 0 0 1px ", ";", "{svg{opacity:", ";fill:", " !important;transition:transform 0.1s linear;transform:rotate( ", " );}}", "}"], (props) => props.expanderSize || SIZE_DEFAULT, (props) => props.expanderSize || SIZE_DEFAULT, (props) => props.theme.palette["grey-050"], (props) => props.disabled ? props.theme.palette["grey-200"] : props.theme.palette["grey-300"], IconContainer, (props) => props.disabled ? `0.4` : `1`, (props) => props.theme.palette["grey-600"], (props) => props.expanded ? "180deg" : "0deg", (props) => !props.disabled && css(["&:hover{box-shadow:inset 0 0 0 1px ", ";background-color:", ";}&:focus-visible:not(:active){animation:", " 1s ease-in-out 0s 1;}"], props.theme.palette["grey-400"], props.theme.palette["grey-050"], focusAnimation(props)));
|
|
18
14
|
export {
|
|
19
15
|
Expander,
|
|
20
16
|
focusAnimation
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
'M' = 32
|
|
4
|
-
}
|
|
1
|
+
import { MouseEvent } from 'react';
|
|
2
|
+
export declare const ExpanderSize: Record<'S' | 'M', number>;
|
|
5
3
|
export type ExpanderProps = {
|
|
6
|
-
onClick?: (event:
|
|
4
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
7
5
|
size?: 'S' | 'M';
|
|
8
6
|
disabled?: boolean;
|
|
9
7
|
expanded?: boolean;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})(ExpanderSize || {});
|
|
1
|
+
const ExpanderSize = {
|
|
2
|
+
S: 24,
|
|
3
|
+
M: 32
|
|
4
|
+
};
|
|
6
5
|
export {
|
|
7
6
|
ExpanderSize
|
|
8
7
|
};
|
package/dist/Star/Star.styles.js
CHANGED
|
@@ -2,7 +2,7 @@ import styled from "styled-components";
|
|
|
2
2
|
const IconWrapper = /* @__PURE__ */ styled.span.withConfig({
|
|
3
3
|
displayName: "Starstyles__IconWrapper",
|
|
4
4
|
componentId: "sc-k1qcv4-0"
|
|
5
|
-
})(["
|
|
5
|
+
})(["&& svg{fill:", ";}.ant-btn-ghost[disabled] & .ds-icon svg{fill:", " !important;}.ant-btn-ghost:hover & .ds-icon svg,.ant-btn-ghost:focus:hover & .ds-icon svg{fill:", ";}.ant-btn-ghost &::before{clip-path:path( 'M 19.606 9.598 l -4.794 -0.686 l -2.141 -4.276 a 0.781 0.781 0 0 0 -1.342 0 L 9.187 8.912 l -4.793 0.686 a 0.75 0.75 0 0 0 -0.414 1.284 l 3.462 3.325 l -0.817 4.691 a 0.751 0.751 0 0 0 0.74 0.88 a 0.742 0.742 0 0 0 0.344 -0.085 L 12 17.472 l 4.29 2.221 a 0.75 0.75 0 0 0 1.084 -0.795 l -0.816 -4.691 l 3.462 -3.325 a 0.75 0.75 0 0 0 -0.414 -1.284 z z' );content:'';position:absolute;bottom:0;left:0;right:0;top:0;margin:0;z-index:-1;}.ant-btn-ghost[disabled] &:before{background:", ";}.ant-btn-ghost &::before,.ant-btn-ghost:hover &:before,.ant-btn-ghost:focus:hover &:before{background:", ";}"], ({
|
|
6
6
|
theme,
|
|
7
7
|
active,
|
|
8
8
|
error
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Props as ButtonProps } from '../Button.types';
|
|
1
|
+
import { Props as ButtonProps, ButtonType } from '../Button.types';
|
|
2
2
|
type ButtonPropsOmitted = Omit<ButtonProps, 'type' | 'block' | 'color' | 'groupVariant' | 'icon' | 'iconColor' | 'mode' | 'size' | 'onChange'>;
|
|
3
3
|
export type StarButtonProps = ButtonPropsOmitted & {
|
|
4
4
|
active?: boolean;
|
|
5
5
|
hasError?: boolean;
|
|
6
6
|
className?: string;
|
|
7
|
-
type?:
|
|
7
|
+
type?: ButtonType;
|
|
8
8
|
};
|
|
9
9
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export { type CreatorProps, CreatorStatus } from './Creator/Creator.types';
|
|
|
14
14
|
export type { StarButtonProps } from './Star/Star.types';
|
|
15
15
|
export type { CheckboxButtonProps } from './Checkbox/Checkbox.types';
|
|
16
16
|
export { ExpanderSize, type ExpanderProps } from './Expander/Expander.types';
|
|
17
|
-
export type { ButtonProps, StyledButton } from './Button.types';
|
|
17
|
+
export type { ButtonProps, ButtonType, StyledButton } from './Button.types';
|
|
18
18
|
export declare const ButtonStyles: {
|
|
19
19
|
Button: typeof MainButtonStyles;
|
|
20
20
|
Creator: typeof CreatorStyles;
|
|
@@ -22,22 +22,15 @@ export declare const ButtonStyles: {
|
|
|
22
22
|
Expander: typeof ExpanderStyles;
|
|
23
23
|
Star: typeof StarStyles;
|
|
24
24
|
};
|
|
25
|
-
declare const _default: import('react').ForwardRefExoticComponent<Omit<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
29
|
-
} & import('antd/lib/button/button').BaseButtonProps & Omit<import('react').AnchorHTMLAttributes<any>, "type" | "onClick"> & {
|
|
30
|
-
htmlType?: import('antd/lib/button/button').ButtonHTMLType;
|
|
31
|
-
onClick?: React.MouseEventHandler<HTMLElement>;
|
|
32
|
-
} & Omit<import('react').ButtonHTMLAttributes<any>, "type" | "onClick">>, "ghost" | "type"> & {
|
|
33
|
-
type?: import('@synerise/ds-utils').LiteralStringUnion<import('./Button.types').ButtonType>;
|
|
34
|
-
mode?: import('@synerise/ds-utils').LiteralStringUnion<"single-icon" | "split" | "two-icons" | "label-icon" | "icon-label">;
|
|
25
|
+
declare const _default: import('react').ForwardRefExoticComponent<Omit<import('./BaseButton.types').BaseButtonProps, "type"> & {
|
|
26
|
+
type?: import('./Button.types').ButtonType;
|
|
27
|
+
mode?: import('@synerise/ds-utils').LiteralStringUnion<import('./Button.types').ButtonMode>;
|
|
35
28
|
color?: import('@synerise/ds-utils').LiteralStringUnion<"blue" | "grey" | "red" | "green" | "yellow" | "pink" | "mars" | "orange" | "fern" | "cyan" | "purple" | "violet">;
|
|
36
29
|
groupVariant?: import('@synerise/ds-utils').LiteralStringUnion<"left-rounded" | "squared" | "right-rounded">;
|
|
37
|
-
justifyContent?: import('csstype').JustifyContentProperty;
|
|
38
30
|
loading?: boolean | {
|
|
39
31
|
delay?: number;
|
|
40
32
|
};
|
|
33
|
+
icon?: import('react').ReactNode;
|
|
41
34
|
onClick?: (event: import('react').MouseEvent<HTMLElement>) => void;
|
|
42
35
|
iconColor?: import('@synerise/ds-utils').LiteralStringUnion<"blue" | "grey" | "red" | "green" | "yellow" | "pink" | "mars" | "orange" | "fern" | "cyan" | "purple" | "violet">;
|
|
43
36
|
error?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-button",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.27",
|
|
4
4
|
"description": "Button UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "synerise/synerise-design",
|
|
@@ -35,10 +35,7 @@
|
|
|
35
35
|
"check:circular-dependencies": "madge --circular --extensions ts,tsx,js,jsx --ts-config tsconfig.json src/ --exclude '/dist/'",
|
|
36
36
|
"upgrade:ds": "ncu -f \"@synerise/ds-*\" -u"
|
|
37
37
|
},
|
|
38
|
-
"sideEffects":
|
|
39
|
-
"dist/style/*",
|
|
40
|
-
"*.less"
|
|
41
|
-
],
|
|
38
|
+
"sideEffects": false,
|
|
42
39
|
"types": "dist/index.d.ts",
|
|
43
40
|
"dependencies": {
|
|
44
41
|
"@synerise/ds-icon": "^1.17.3",
|
|
@@ -50,10 +47,9 @@
|
|
|
50
47
|
},
|
|
51
48
|
"peerDependencies": {
|
|
52
49
|
"@synerise/ds-core": "*",
|
|
53
|
-
"antd": "4.24.16",
|
|
54
50
|
"react": ">=16.9.0 <= 18.3.1",
|
|
55
51
|
"styled-components": "^5.3.3",
|
|
56
52
|
"vitest": "4"
|
|
57
53
|
},
|
|
58
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "0418fb6d3b67c35d3c8bacfe53ce01528c6b6153"
|
|
59
55
|
}
|
|
File without changes
|