@pushwoosh/dumb-components 3.5.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Button/Button.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Spinner } from '../Spinner';
3
- import { ButtonPropsToButtonBoxMap, SpinnerSizeByButtonSizeMap } from './maps';
4
- import { ButtonIcon, ButtonSpinner, ButtonContent } from './styles';
3
+ import { geometryBySizeAndView, spinnerSizeBySize } from './constants';
4
+ import { ButtonBox, ButtonIcon, ButtonSpinner, ButtonContent } from './styles';
5
5
  export function Button(props) {
6
6
  const {
7
7
  type = 'button',
@@ -15,22 +15,33 @@ export function Button(props) {
15
15
  icon,
16
16
  rightIcon,
17
17
  children,
18
+ onClick,
18
19
  ...rest
19
20
  } = props;
20
21
  if (!color) {
21
22
  console.error(`[Button]: required prop color "${color}" is not set`);
22
23
  return null;
23
24
  }
24
- const ButtonBox = ButtonPropsToButtonBoxMap[color][view][size];
25
- if (!ButtonBox) {
25
+ if (!geometryBySizeAndView[size]?.[view]) {
26
26
  console.error(`[Button]: cannot render with color "${color}" and size "${size}" and view "${view}"`);
27
27
  return null;
28
28
  }
29
29
  const isShowOverlaySpinner = !!children && !icon && view !== 'ghost' && isLoading;
30
+ const isDisabledNonButton = !!isDisabled && !!rest.as && rest.as !== 'button';
31
+ const handleClick = isDisabledNonButton ? event => {
32
+ event.preventDefault();
33
+ event.stopPropagation();
34
+ } : onClick;
30
35
  return _jsxs(ButtonBox, {
31
36
  ...rest,
32
37
  type: type,
33
38
  disabled: isDisabled,
39
+ onClick: handleClick,
40
+ "aria-disabled": isDisabledNonButton || undefined,
41
+ tabIndex: isDisabledNonButton ? -1 : rest.tabIndex,
42
+ "$color": color,
43
+ "$view": view,
44
+ "$size": size,
34
45
  "$isDisabled": isDisabled,
35
46
  "$isLoading": isLoading,
36
47
  "$isOpen": isOpen,
@@ -41,7 +52,7 @@ export function Button(props) {
41
52
  ref: boxRef,
42
53
  children: [icon && _jsx(ButtonIcon, {
43
54
  children: isLoading ? _jsx(Spinner, {
44
- size: SpinnerSizeByButtonSizeMap[size]
55
+ size: spinnerSizeBySize[size]
45
56
  }) : icon
46
57
  }), children && _jsx(ButtonContent, {
47
58
  children: _jsx("div", {
@@ -52,7 +63,7 @@ export function Button(props) {
52
63
  }), isShowOverlaySpinner && _jsx(ButtonSpinner, {
53
64
  children: _jsx(Spinner, {
54
65
  color: "danger",
55
- size: SpinnerSizeByButtonSizeMap[size]
66
+ size: spinnerSizeBySize[size]
56
67
  })
57
68
  })]
58
69
  });
@@ -1,3 +1,4 @@
1
+ import type { ButtonColor, ButtonSize, ButtonView } from './types';
1
2
  type Colors = {
2
3
  color: string;
3
4
  bgColor: string;
@@ -8,9 +9,10 @@ type ButtonColors = {
8
9
  disabled: Partial<Colors>;
9
10
  hover: Partial<Colors>;
10
11
  };
11
- export declare const colors: Record<string, Record<string, ButtonColors>>;
12
- export declare function createColors(buttonColors: ButtonColors): import("styled-components").RuleSet<NoInfer<{
12
+ declare function createColors(buttonColors: ButtonColors, opened: Colors): import("styled-components").RuleSet<NoInfer<{
13
13
  $isOpen?: boolean;
14
14
  $isDisabled?: boolean;
15
15
  }>>;
16
+ /** Palette per `color` × `view` × `size`, including the `isOpen` matrix. */
17
+ export declare const colorStyles: Record<ButtonColor, Record<ButtonView, Record<ButtonSize, ReturnType<typeof createColors>>>>;
16
18
  export {};
package/Button/colors.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { css } from 'styled-components';
2
2
  import { Color } from '@pushwoosh/kit-constants';
3
- export const colors = {
3
+ const colors = {
4
4
  primary: {
5
5
  shape: {
6
6
  base: {
@@ -84,7 +84,33 @@ export const colors = {
84
84
  }
85
85
  }
86
86
  };
87
- export function createColors(buttonColors) {
87
+ const openedFilled = {
88
+ color: Color.CLEAR,
89
+ bgColor: Color.MAIN,
90
+ borderColor: Color.MAIN
91
+ };
92
+ const openedText = {
93
+ color: Color.MAIN,
94
+ bgColor: 'transparent',
95
+ borderColor: 'transparent'
96
+ };
97
+ const ghostCompactBaseColor = {
98
+ secondary: `var(--secondary-ghost-base-color, ${Color.SOFT})`
99
+ };
100
+ function toGhostCompact(color, buttonColors) {
101
+ return {
102
+ ...buttonColors,
103
+ base: {
104
+ ...buttonColors.base,
105
+ color: ghostCompactBaseColor[color] ?? buttonColors.base.color
106
+ },
107
+ hover: {
108
+ ...buttonColors.hover,
109
+ bgColor: 'transparent'
110
+ }
111
+ };
112
+ }
113
+ function createColors(buttonColors, opened) {
88
114
  const base = {
89
115
  borderColor: 'transparent',
90
116
  ...buttonColors.base
@@ -97,13 +123,13 @@ export function createColors(buttonColors) {
97
123
  ...base,
98
124
  ...buttonColors.hover
99
125
  };
100
- const hoverCss = css(["&:hover:not([disabled]){color:", ";background-color:", ";border-color:", ";}"], hover.color, hover.bgColor, hover.borderColor);
101
- return css(["color:", ";background-color:", ";border-color:", ";&:disabled{color:", ";background-color:", ";border-color:", ";}", " &:active:not([disabled]){color:", ";background-color:", ";border-color:", ";opacity:0.5;}"], ({
126
+ const hoverCss = css(["&:hover:not([disabled]):not([aria-disabled='true']){color:", ";background-color:", ";border-color:", ";}"], hover.color, hover.bgColor, hover.borderColor);
127
+ return css(["color:", ";background-color:", ";border-color:", ";&:disabled{color:", ";background-color:", ";border-color:", ";}", " &:active:not([disabled]):not([aria-disabled='true']){color:", ";background-color:", ";border-color:", ";opacity:0.5;}"], ({
102
128
  $isOpen,
103
129
  $isDisabled
104
130
  }) => {
105
131
  if ($isOpen) {
106
- return Color.CLEAR;
132
+ return opened.color;
107
133
  }
108
134
  return $isDisabled ? disabled.color : base.color;
109
135
  }, ({
@@ -111,7 +137,7 @@ export function createColors(buttonColors) {
111
137
  $isDisabled
112
138
  }) => {
113
139
  if ($isOpen) {
114
- return Color.MAIN;
140
+ return opened.bgColor;
115
141
  }
116
142
  return $isDisabled ? disabled.bgColor : base.bgColor;
117
143
  }, ({
@@ -119,10 +145,39 @@ export function createColors(buttonColors) {
119
145
  $isDisabled
120
146
  }) => {
121
147
  if ($isOpen) {
122
- return Color.MAIN;
148
+ return opened.borderColor;
123
149
  }
124
150
  return $isDisabled ? disabled.borderColor : base.borderColor;
125
151
  }, disabled.color, disabled.bgColor, disabled.borderColor, ({
126
152
  $isOpen
127
- }) => $isOpen ? '' : hoverCss /* sc-custom "display: none;" */, hover.color, hover.bgColor, hover.borderColor);
128
- }
153
+ }) => $isOpen ? '' : hoverCss, hover.color, hover.bgColor, hover.borderColor);
154
+ }
155
+ function createColorsBySize(color, view) {
156
+ const buttonColors = colors[color][view];
157
+ const field = createColors(buttonColors, openedFilled);
158
+ if (view === 'shape') {
159
+ return {
160
+ field,
161
+ compact: field
162
+ };
163
+ }
164
+ return {
165
+ field,
166
+ compact: createColors(toGhostCompact(color, buttonColors), openedText)
167
+ };
168
+ }
169
+ /** Palette per `color` × `view` × `size`, including the `isOpen` matrix. */
170
+ export const colorStyles = {
171
+ primary: {
172
+ shape: createColorsBySize('primary', 'shape'),
173
+ ghost: createColorsBySize('primary', 'ghost')
174
+ },
175
+ secondary: {
176
+ shape: createColorsBySize('secondary', 'shape'),
177
+ ghost: createColorsBySize('secondary', 'ghost')
178
+ },
179
+ danger: {
180
+ shape: createColorsBySize('danger', 'shape'),
181
+ ghost: createColorsBySize('danger', 'ghost')
182
+ }
183
+ };
@@ -0,0 +1,21 @@
1
+ import type { ButtonSize, ButtonView } from './types';
2
+ /** Geometry and typography resolved from `size` and `view`. */
3
+ export type ButtonGeometry = {
4
+ readonly height: string;
5
+ readonly border: string;
6
+ readonly padding: string;
7
+ readonly labelPadding: string;
8
+ readonly gap: string;
9
+ readonly iconSlot: string;
10
+ readonly fontSize: string;
11
+ readonly lineHeight: number;
12
+ readonly fontWeight: number;
13
+ readonly textTransform: 'none' | 'uppercase';
14
+ };
15
+ /** Geometry per `size` × `view`; colors live in `colors.ts`. */
16
+ export declare const geometryBySizeAndView: Record<ButtonSize, Record<ButtonView, ButtonGeometry>>;
17
+ /** Spinner size used in place of the icon, per button `size`. */
18
+ export declare const spinnerSizeBySize: {
19
+ readonly compact: "small";
20
+ readonly field: "medium";
21
+ };
@@ -0,0 +1,54 @@
1
+ import { FontSize, FontWeight, LineHeight, UnitSize } from '@pushwoosh/kit-constants';
2
+ const fieldTypography = {
3
+ fontSize: FontSize.REGULAR,
4
+ lineHeight: LineHeight.REGULAR,
5
+ fontWeight: FontWeight.MEDIUM,
6
+ textTransform: 'none'
7
+ };
8
+ const compactTypography = {
9
+ fontSize: FontSize.SMALL,
10
+ lineHeight: LineHeight.SMALL,
11
+ fontWeight: FontWeight.BOLD,
12
+ textTransform: 'uppercase'
13
+ };
14
+ const boxed = {
15
+ border: '1px',
16
+ padding: '6px',
17
+ labelPadding: '6px',
18
+ gap: '0px'
19
+ };
20
+ const fieldBox = {
21
+ ...fieldTypography,
22
+ ...boxed,
23
+ height: UnitSize.FIELD_HEIGHT,
24
+ iconSlot: UnitSize.ICON_MEDIUM
25
+ };
26
+ /** Geometry per `size` × `view`; colors live in `colors.ts`. */
27
+ export const geometryBySizeAndView = {
28
+ field: {
29
+ shape: fieldBox,
30
+ ghost: fieldBox
31
+ },
32
+ compact: {
33
+ shape: {
34
+ ...compactTypography,
35
+ ...boxed,
36
+ height: UnitSize.COMPACT_HEIGHT,
37
+ iconSlot: UnitSize.ICON_SMALL
38
+ },
39
+ ghost: {
40
+ ...compactTypography,
41
+ height: '16px',
42
+ border: '0px',
43
+ padding: '0px',
44
+ labelPadding: '0px',
45
+ gap: '6px',
46
+ iconSlot: UnitSize.ICON_SMALL
47
+ }
48
+ }
49
+ };
50
+ /** Spinner size used in place of the icon, per button `size`. */
51
+ export const spinnerSizeBySize = {
52
+ compact: 'small',
53
+ field: 'medium'
54
+ };
@@ -1,3 +1,4 @@
1
+ import type { ButtonColor, ButtonSize, ButtonView } from './types';
1
2
  export declare const ButtonIcon: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
2
3
  style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
3
4
  }> & string;
@@ -7,110 +8,10 @@ export declare const ButtonContent: import("styled-components/dist/types").IStyl
7
8
  export declare const ButtonSpinner: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
8
9
  style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
9
10
  }> & string;
10
- export declare const ButtonBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
11
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
12
- }, {
13
- $isDisabled?: boolean;
14
- $isLoading?: boolean;
15
- $isOpen?: boolean;
16
- $hideContent?: boolean;
17
- $hasLeftIcon?: boolean;
18
- $hasRightIcon?: boolean;
19
- $hasContent?: boolean;
20
- }>> & string;
21
- export declare const ButtonBoxDangerGhostCompact: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
22
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
23
- }, {
24
- $isDisabled?: boolean;
25
- $isLoading?: boolean;
26
- $isOpen?: boolean;
27
- $hideContent?: boolean;
28
- $hasLeftIcon?: boolean;
29
- $hasRightIcon?: boolean;
30
- $hasContent?: boolean;
31
- }>, "as" | "forwardedAs"> & {
32
- as?: import("styled-components").WebTarget | undefined;
33
- forwardedAs?: import("styled-components").WebTarget | undefined;
34
- }, "style"> & {
35
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
36
- [key: `--${string}`]: string | number | undefined;
37
- }) | undefined;
38
- }> & string;
39
- export declare const ButtonBoxDangerGhostField: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
40
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
41
- }, {
42
- $isDisabled?: boolean;
43
- $isLoading?: boolean;
44
- $isOpen?: boolean;
45
- $hideContent?: boolean;
46
- $hasLeftIcon?: boolean;
47
- $hasRightIcon?: boolean;
48
- $hasContent?: boolean;
49
- }>, "as" | "forwardedAs"> & {
50
- as?: import("styled-components").WebTarget | undefined;
51
- forwardedAs?: import("styled-components").WebTarget | undefined;
52
- }, "style"> & {
53
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
54
- [key: `--${string}`]: string | number | undefined;
55
- }) | undefined;
56
- }> & string;
57
- export declare const ButtonBoxDangerShapeCompact: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
58
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
59
- }, {
60
- $isDisabled?: boolean;
61
- $isLoading?: boolean;
62
- $isOpen?: boolean;
63
- $hideContent?: boolean;
64
- $hasLeftIcon?: boolean;
65
- $hasRightIcon?: boolean;
66
- $hasContent?: boolean;
67
- }>, "as" | "forwardedAs"> & {
68
- as?: import("styled-components").WebTarget | undefined;
69
- forwardedAs?: import("styled-components").WebTarget | undefined;
70
- }, "style"> & {
71
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
72
- [key: `--${string}`]: string | number | undefined;
73
- }) | undefined;
74
- }> & string;
75
- export declare const ButtonBoxDangerShapeField: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
76
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
77
- }, {
78
- $isDisabled?: boolean;
79
- $isLoading?: boolean;
80
- $isOpen?: boolean;
81
- $hideContent?: boolean;
82
- $hasLeftIcon?: boolean;
83
- $hasRightIcon?: boolean;
84
- $hasContent?: boolean;
85
- }>, "as" | "forwardedAs"> & {
86
- as?: import("styled-components").WebTarget | undefined;
87
- forwardedAs?: import("styled-components").WebTarget | undefined;
88
- }, "style"> & {
89
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
90
- [key: `--${string}`]: string | number | undefined;
91
- }) | undefined;
92
- }> & string;
93
- export declare const ButtonBoxPrimaryShapeCompact: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
94
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
95
- }, {
96
- $isDisabled?: boolean;
97
- $isLoading?: boolean;
98
- $isOpen?: boolean;
99
- $hideContent?: boolean;
100
- $hasLeftIcon?: boolean;
101
- $hasRightIcon?: boolean;
102
- $hasContent?: boolean;
103
- }>, "as" | "forwardedAs"> & {
104
- as?: import("styled-components").WebTarget | undefined;
105
- forwardedAs?: import("styled-components").WebTarget | undefined;
106
- }, "style"> & {
107
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
108
- [key: `--${string}`]: string | number | undefined;
109
- }) | undefined;
110
- }> & string;
111
- export declare const ButtonBoxPrimaryShapeField: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
112
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
113
- }, {
11
+ type ButtonBoxProps = {
12
+ $color: ButtonColor;
13
+ $view: ButtonView;
14
+ $size: ButtonSize;
114
15
  $isDisabled?: boolean;
115
16
  $isLoading?: boolean;
116
17
  $isOpen?: boolean;
@@ -118,122 +19,11 @@ export declare const ButtonBoxPrimaryShapeField: import("styled-components/dist/
118
19
  $hasLeftIcon?: boolean;
119
20
  $hasRightIcon?: boolean;
120
21
  $hasContent?: boolean;
121
- }>, "as" | "forwardedAs"> & {
122
- as?: import("styled-components").WebTarget | undefined;
123
- forwardedAs?: import("styled-components").WebTarget | undefined;
124
- }, "style"> & {
125
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
126
- [key: `--${string}`]: string | number | undefined;
127
- }) | undefined;
128
- }> & string;
129
- export declare const ButtonBoxPrimaryGhostCompact: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
130
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
131
- }, {
132
- $isDisabled?: boolean;
133
- $isLoading?: boolean;
134
- $isOpen?: boolean;
135
- $hideContent?: boolean;
136
- $hasLeftIcon?: boolean;
137
- $hasRightIcon?: boolean;
138
- $hasContent?: boolean;
139
- }>, "as" | "forwardedAs"> & {
140
- as?: import("styled-components").WebTarget | undefined;
141
- forwardedAs?: import("styled-components").WebTarget | undefined;
142
- }, "style"> & {
143
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
144
- [key: `--${string}`]: string | number | undefined;
145
- }) | undefined;
146
- }> & string;
147
- export declare const ButtonBoxPrimaryGhostField: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
148
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
149
- }, {
150
- $isDisabled?: boolean;
151
- $isLoading?: boolean;
152
- $isOpen?: boolean;
153
- $hideContent?: boolean;
154
- $hasLeftIcon?: boolean;
155
- $hasRightIcon?: boolean;
156
- $hasContent?: boolean;
157
- }>, "as" | "forwardedAs"> & {
158
- as?: import("styled-components").WebTarget | undefined;
159
- forwardedAs?: import("styled-components").WebTarget | undefined;
160
- }, "style"> & {
161
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
162
- [key: `--${string}`]: string | number | undefined;
163
- }) | undefined;
164
- }> & string;
165
- export declare const ButtonBoxSecondaryGhostCompact: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
166
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
167
- }, {
168
- $isDisabled?: boolean;
169
- $isLoading?: boolean;
170
- $isOpen?: boolean;
171
- $hideContent?: boolean;
172
- $hasLeftIcon?: boolean;
173
- $hasRightIcon?: boolean;
174
- $hasContent?: boolean;
175
- }>, "as" | "forwardedAs"> & {
176
- as?: import("styled-components").WebTarget | undefined;
177
- forwardedAs?: import("styled-components").WebTarget | undefined;
178
- }, "style"> & {
179
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
180
- [key: `--${string}`]: string | number | undefined;
181
- }) | undefined;
182
- }> & string;
183
- export declare const ButtonBoxSecondaryGhostField: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
184
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
185
- }, {
186
- $isDisabled?: boolean;
187
- $isLoading?: boolean;
188
- $isOpen?: boolean;
189
- $hideContent?: boolean;
190
- $hasLeftIcon?: boolean;
191
- $hasRightIcon?: boolean;
192
- $hasContent?: boolean;
193
- }>, "as" | "forwardedAs"> & {
194
- as?: import("styled-components").WebTarget | undefined;
195
- forwardedAs?: import("styled-components").WebTarget | undefined;
196
- }, "style"> & {
197
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
198
- [key: `--${string}`]: string | number | undefined;
199
- }) | undefined;
200
- }> & string;
201
- export declare const ButtonBoxSecondaryShapeCompact: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
202
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
203
- }, {
204
- $isDisabled?: boolean;
205
- $isLoading?: boolean;
206
- $isOpen?: boolean;
207
- $hideContent?: boolean;
208
- $hasLeftIcon?: boolean;
209
- $hasRightIcon?: boolean;
210
- $hasContent?: boolean;
211
- }>, "as" | "forwardedAs"> & {
212
- as?: import("styled-components").WebTarget | undefined;
213
- forwardedAs?: import("styled-components").WebTarget | undefined;
214
- }, "style"> & {
215
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
216
- [key: `--${string}`]: string | number | undefined;
217
- }) | undefined;
218
- }> & string;
219
- export declare const ButtonBoxSecondaryShapeField: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
22
+ };
23
+ export declare const ButtonBox: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
220
24
  style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
221
- }, {
222
- $isDisabled?: boolean;
223
- $isLoading?: boolean;
224
- $isOpen?: boolean;
225
- $hideContent?: boolean;
226
- $hasLeftIcon?: boolean;
227
- $hasRightIcon?: boolean;
228
- $hasContent?: boolean;
229
- }>, "as" | "forwardedAs"> & {
230
- as?: import("styled-components").WebTarget | undefined;
231
- forwardedAs?: import("styled-components").WebTarget | undefined;
232
- }, "style"> & {
233
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
234
- [key: `--${string}`]: string | number | undefined;
235
- }) | undefined;
236
- }> & string;
25
+ }, ButtonBoxProps>> & string;
237
26
  export declare const RemoveButtonBox: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
238
27
  style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
239
28
  }> & string;
29
+ export {};
package/Button/styles.js CHANGED
@@ -1,22 +1,33 @@
1
- import styled from 'styled-components';
2
- import { Color, FontSize, LineHeight, ShapeRadius, FontWeight, UnitSize } from '@pushwoosh/kit-constants';
3
- import { colors, createColors } from './colors';
1
+ import styled, { css } from 'styled-components';
2
+ import { Color, ShapeRadius, UnitSize } from '@pushwoosh/kit-constants';
3
+ import { colorStyles } from './colors';
4
+ import { geometryBySizeAndView } from './constants';
4
5
  export const ButtonIcon = styled.div.withConfig({
5
6
  displayName: "ButtonIcon",
6
7
  componentId: "sc-qltvdl-0"
7
- })(["flex:0 0 auto;"]);
8
+ })(["display:flex;align-items:center;justify-content:center;flex:0 0 auto;min-width:var(--btn-icon-slot);"]);
8
9
  export const ButtonContent = styled.div.withConfig({
9
10
  displayName: "ButtonContent",
10
11
  componentId: "sc-qltvdl-1"
11
- })(["display:grid;justify-content:start;& > div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}&:first-child{justify-content:center;}&:first-child:last-child{padding-left:6px;padding-right:6px;}&:last-child:not(:first-child){padding-right:6px;}&:first-child:not(:last-child){padding-left:6px;}"]);
12
+ })(["display:grid;justify-content:start;padding:0 var(--btn-label-padding);& > div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}&:first-child{justify-content:center;}"]);
12
13
  export const ButtonSpinner = styled.div.withConfig({
13
14
  displayName: "ButtonSpinner",
14
15
  componentId: "sc-qltvdl-2"
15
16
  })(["position:absolute;top:0;left:0;right:0;bottom:0;display:flex;flex-wrap:nowrap;align-items:center;justify-content:center;"]);
17
+ function geometryVars(geometry) {
18
+ return css(["--btn-height:", ";--btn-border:", ";--btn-padding:", ";--btn-label-padding:", ";--btn-gap:", ";--btn-icon-slot:", ";font-size:", ";line-height:", ";font-weight:", ";text-transform:", ";"], geometry.height, geometry.border, geometry.padding, geometry.labelPadding, geometry.gap, geometry.iconSlot, geometry.fontSize, geometry.lineHeight, geometry.fontWeight, geometry.textTransform);
19
+ }
20
+ const ghostCompactHitArea = css(["&::before{content:'';position:absolute;inset:calc((var(--btn-height) - ", ") / 2) 0;}"], UnitSize.COMPACT_HEIGHT);
16
21
  export const ButtonBox = styled.button.withConfig({
17
22
  displayName: "ButtonBox",
18
23
  componentId: "sc-qltvdl-3"
19
- })(["position:relative;display:inline-grid;align-items:center;grid-template-columns:", ";gap:4px;appearance:none !important;border:1px solid transparent;border-radius:", ";font-size:", ";line-height:", ";text-decoration:none;cursor:", ";user-select:none;&:hover{text-decoration:none;}&:focus{outline:none;}&:active{pointer-events:", ";}& ", "{opacity:", ";}"], props => `${props.$hasLeftIcon ? 'auto ' : ''}${props.$hasContent ? '1fr' : ''}${props.$hasRightIcon ? ' auto' : ''}`, ShapeRadius.CONTROL, FontSize.REGULAR, LineHeight.REGULAR, props => props.$isDisabled || props.$isLoading ? 'not-allowed!important' : 'pointer', props => props.$isDisabled || props.$isLoading ? 'none' : 'auto', /* sc-selector */ButtonContent, ({
24
+ })(["", " position:relative;display:inline-grid;align-items:center;grid-template-columns:", ";gap:var(--btn-gap);box-sizing:border-box;height:var(--btn-height);padding:0 calc(var(--btn-padding) - var(--btn-border));appearance:none !important;border-style:solid;border-width:var(--btn-border) var(--btn-border-right,var(--btn-border)) var(--btn-border) var(--btn-border-left,var(--btn-border));border-radius:var(--btn-radius-left,", ") var(--btn-radius-right,", ") var(--btn-radius-right,", ") var(--btn-radius-left,", ");text-decoration:none;cursor:", ";user-select:none;&:hover{text-decoration:none;}&:focus{outline:none;}&:active{pointer-events:", ";}", " & ", "{opacity:", ";}", ""], ({
25
+ $size,
26
+ $view
27
+ }) => geometryVars(geometryBySizeAndView[$size][$view]), props => [props.$hasLeftIcon && 'auto', props.$hasContent && 'minmax(0, 1fr)', props.$hasRightIcon && 'auto'].filter(Boolean).join(' '), ShapeRadius.CONTROL, ShapeRadius.CONTROL, ShapeRadius.CONTROL, ShapeRadius.CONTROL, props => props.$isDisabled || props.$isLoading ? 'not-allowed!important' : 'pointer', props => props.$isDisabled || props.$isLoading ? 'none' : 'auto', ({
28
+ $size,
29
+ $view
30
+ }) => $size === 'compact' && $view === 'ghost' && ghostCompactHitArea, /* sc-selector */ButtonContent, ({
20
31
  $hideContent,
21
32
  $isLoading
22
33
  }) => {
@@ -24,85 +35,17 @@ export const ButtonBox = styled.button.withConfig({
24
35
  return 0;
25
36
  }
26
37
  return $isLoading ? 0.5 : 1;
27
- });
28
- // danger ghost --------------
29
- const dangerGhostColors = createColors(colors.danger.ghost);
30
- export const ButtonBoxDangerGhostCompact = styled(ButtonBox).withConfig({
31
- displayName: "ButtonBoxDangerGhostCompact",
32
- componentId: "sc-qltvdl-4"
33
- })(["height:16px;padding:0;font-size:", ";font-weight:", ";text-transform:uppercase;& ", "{padding:0;}", ";--danger-ghost-hover-bg-color:transparent;"], FontSize.SMALL, FontWeight.BOLD, /* sc-selector */ButtonContent, /* sc-custom "display: none;" */dangerGhostColors);
34
- export const ButtonBoxDangerGhostField = styled(ButtonBox).withConfig({
35
- displayName: "ButtonBoxDangerGhostField",
36
- componentId: "sc-qltvdl-5"
37
- })(["height:", ";padding:0 calc(6px - 1px);font-weight:", ";", ";"], UnitSize.FIELD_HEIGHT, FontWeight.MEDIUM, /* sc-custom "display: none;" */dangerGhostColors);
38
- // danger shape --------------
39
- const dangerShapeColors = createColors(colors.danger.shape);
40
- export const ButtonBoxDangerShapeCompact = styled(ButtonBox).withConfig({
41
- displayName: "ButtonBoxDangerShapeCompact",
42
- componentId: "sc-qltvdl-6"
43
- })(["height:28px;padding:0 calc(6px - 1px);font-size:", ";line-height:", ";font-weight:", ";text-transform:uppercase;", ";"], FontSize.SMALL, LineHeight.SMALL, FontWeight.BOLD, /* sc-custom "display: none;" */dangerShapeColors);
44
- export const ButtonBoxDangerShapeField = styled(ButtonBox).withConfig({
45
- displayName: "ButtonBoxDangerShapeField",
46
- componentId: "sc-qltvdl-7"
47
- })(["height:", ";padding:0 calc(6px - 1px);font-weight:", ";", ";"], UnitSize.FIELD_HEIGHT, FontWeight.MEDIUM, /* sc-custom "display: none;" */dangerShapeColors);
48
- // primary shape --------------
49
- const primaryShapeColors = createColors(colors.primary.shape);
50
- export const ButtonBoxPrimaryShapeCompact = styled(ButtonBox).withConfig({
51
- displayName: "ButtonBoxPrimaryShapeCompact",
52
- componentId: "sc-qltvdl-8"
53
- })(["height:28px;padding:0 calc(6px - 1px);font-size:", ";line-height:", ";font-weight:", ";text-transform:uppercase;", ";"], FontSize.SMALL, LineHeight.SMALL, FontWeight.BOLD, /* sc-custom "display: none;" */primaryShapeColors);
54
- export const ButtonBoxPrimaryShapeField = styled(ButtonBox).withConfig({
55
- displayName: "ButtonBoxPrimaryShapeField",
56
- componentId: "sc-qltvdl-9"
57
- })(["height:", ";padding:0 calc(6px - 1px);font-weight:", ";", ";"], UnitSize.FIELD_HEIGHT, FontWeight.MEDIUM, /* sc-custom "display: none;" */primaryShapeColors);
58
- // primary ghost --------------
59
- const primaryGhostColors = createColors(colors.primary.ghost);
60
- export const ButtonBoxPrimaryGhostCompact = styled(ButtonBox).withConfig({
61
- displayName: "ButtonBoxPrimaryGhostCompact",
62
- componentId: "sc-qltvdl-10"
63
- })(["height:", ";padding:0;font-size:", ";line-height:", ";font-weight:", ";text-transform:uppercase;& ", "{padding:4px 0;}", ";--primary-ghost-hover-bg-color:transparent;"], UnitSize.COMPACT_HEIGHT, FontSize.SMALL, LineHeight.SMALL, FontWeight.BOLD, /* sc-selector */ButtonContent, /* sc-custom "display: none;" */primaryGhostColors);
64
- export const ButtonBoxPrimaryGhostField = styled(ButtonBox).withConfig({
65
- displayName: "ButtonBoxPrimaryGhostField",
66
- componentId: "sc-qltvdl-11"
67
- })(["height:", ";padding:0 calc(6px - 1px);font-weight:", ";", ";"], UnitSize.FIELD_HEIGHT, FontWeight.MEDIUM, /* sc-custom "display: none;" */primaryGhostColors);
68
- // secondary ghost --------------
69
- const secondaryGhostColors = createColors(colors.secondary.ghost);
70
- export const ButtonBoxSecondaryGhostCompact = styled(ButtonBox).withConfig({
71
- displayName: "ButtonBoxSecondaryGhostCompact",
72
- componentId: "sc-qltvdl-12"
73
- })(["height:", ";padding:0;font-size:", ";line-height:", ";font-weight:", ";text-transform:uppercase;& ", "{padding:4px 0;}", ";--secondary-ghost-base-color:", ";--secondary-ghost-hover-bg-color:transparent;"], UnitSize.COMPACT_HEIGHT, FontSize.SMALL, LineHeight.SMALL, FontWeight.BOLD, /* sc-selector */ButtonContent, /* sc-custom "display: none;" */secondaryGhostColors, Color.SOFT);
74
- export const ButtonBoxSecondaryGhostField = styled(ButtonBox).withConfig({
75
- displayName: "ButtonBoxSecondaryGhostField",
76
- componentId: "sc-qltvdl-13"
77
- })(["height:", ";padding:0 calc(6px - 1px);font-weight:", ";", ";"], UnitSize.FIELD_HEIGHT, FontWeight.MEDIUM, /* sc-custom "display: none;" */secondaryGhostColors);
78
- // secondary shape --------------
79
- const secondaryShapeColors = createColors(colors.secondary.shape);
80
- export const ButtonBoxSecondaryShapeCompact = styled(ButtonBox).withConfig({
81
- displayName: "ButtonBoxSecondaryShapeCompact",
82
- componentId: "sc-qltvdl-14"
83
- })(["height:28px;padding:0 calc(6px - 1px);font-size:", ";line-height:", ";font-weight:", ";text-transform:uppercase;", ";"], FontSize.SMALL, LineHeight.SMALL, FontWeight.MEDIUM, /* sc-custom "display: none;" */secondaryShapeColors);
84
- export const ButtonBoxSecondaryShapeField = styled(ButtonBox).withConfig({
85
- displayName: "ButtonBoxSecondaryShapeField",
86
- componentId: "sc-qltvdl-15"
87
- })(["height:", ";padding:0 calc(6px - 1px);font-weight:", ";", ";"], UnitSize.FIELD_HEIGHT, FontWeight.MEDIUM, /* sc-custom "display: none;" */secondaryShapeColors);
38
+ }, ({
39
+ $color,
40
+ $view,
41
+ $size
42
+ }) => colorStyles[$color][$view][$size]);
88
43
  export const RemoveButtonBox = styled.button.withConfig({
89
44
  displayName: "RemoveButtonBox",
90
- componentId: "sc-qltvdl-16"
45
+ componentId: "sc-qltvdl-4"
91
46
  })(["width:", ";height:", ";padding:0;appearance:none !important;border:none;background:transparent;cursor:pointer;color:", ";&:hover{color:", ";}&:active{color:", ";}"], UnitSize.ICON_SMALL, UnitSize.ICON_SMALL, Color.PHANTOM, Color.DANGER_HOVER, Color.DANGER_PRESSED);
92
47
  ButtonBox.displayName = 'ButtonBox';
93
48
  ButtonIcon.displayName = 'ButtonIcon';
94
49
  ButtonContent.displayName = 'ButtonContent';
95
50
  ButtonSpinner.displayName = 'ButtonSpinner';
96
- ButtonBoxDangerGhostCompact.displayName = 'ButtonBoxDangerGhostCompact';
97
- ButtonBoxDangerGhostField.displayName = 'ButtonBoxDangerGhostField';
98
- ButtonBoxDangerShapeCompact.displayName = 'ButtonBoxDangerShapeCompact';
99
- ButtonBoxDangerShapeField.displayName = 'ButtonBoxDangerShapeField';
100
- ButtonBoxPrimaryGhostCompact.displayName = 'ButtonBoxPrimaryGhostCompact';
101
- ButtonBoxPrimaryGhostField.displayName = 'ButtonBoxPrimaryGhostField';
102
- ButtonBoxPrimaryShapeCompact.displayName = 'ButtonBoxPrimaryShapeCompact';
103
- ButtonBoxPrimaryShapeField.displayName = 'ButtonBoxPrimaryShapeField';
104
- ButtonBoxSecondaryGhostCompact.displayName = 'ButtonBoxSecondaryGhostCompact';
105
- ButtonBoxSecondaryGhostField.displayName = 'ButtonBoxSecondaryGhostField';
106
- ButtonBoxSecondaryShapeCompact.displayName = 'ButtonBoxSecondaryShapeCompact';
107
- ButtonBoxSecondaryShapeField.displayName = 'ButtonBoxSecondaryShapeField';
108
51
  RemoveButtonBox.displayName = 'RemoveButtonBox';
package/Button/types.d.ts CHANGED
@@ -1,14 +1,20 @@
1
1
  import type { JSX, ReactNode, Ref, ComponentType } from 'react';
2
+ /** Visual intent of a {@link Button}. */
3
+ export type ButtonColor = 'primary' | 'secondary' | 'danger';
4
+ /** Height preset of a {@link Button}. */
5
+ export type ButtonSize = 'field' | 'compact';
6
+ /** Surface style of a {@link Button}. */
7
+ export type ButtonView = 'shape' | 'ghost';
2
8
  /** Props shared by every {@link Button} variant, regardless of the rendered element. */
3
9
  export type RequiredButtonProps = {
4
10
  /** Ref forwarded to the underlying element; prefer the typed `boxRef` on the variant props. */
5
11
  readonly boxRef?: any;
6
12
  /** Visual intent: `primary` (main action), `secondary` (neutral), `danger` (destructive). */
7
- readonly color: 'primary' | 'secondary' | 'danger';
13
+ readonly color: ButtonColor;
8
14
  /** Height preset: `field` (default, form-line height) or `compact` (denser). */
9
- readonly size?: 'field' | 'compact';
15
+ readonly size?: ButtonSize;
10
16
  /** Surface style: `shape` (filled, default) or `ghost` (transparent). */
11
- readonly view?: 'shape' | 'ghost';
17
+ readonly view?: ButtonView;
12
18
  /** Extra CSS class applied to the button element. */
13
19
  readonly className?: string;
14
20
  /** Disable interaction and render the disabled state. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "3.5.0",
3
+ "version": "3.6.0",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
package/Button/maps.d.ts DELETED
@@ -1,240 +0,0 @@
1
- export declare const SpinnerSizeByButtonSizeMap: {
2
- compact: "small";
3
- field: "medium";
4
- };
5
- export declare const ButtonPropsToButtonBoxMap: {
6
- readonly danger: {
7
- readonly shape: {
8
- readonly field: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
9
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
10
- }, {
11
- $isDisabled?: boolean;
12
- $isLoading?: boolean;
13
- $isOpen?: boolean;
14
- $hideContent?: boolean;
15
- $hasLeftIcon?: boolean;
16
- $hasRightIcon?: boolean;
17
- $hasContent?: boolean;
18
- }>, "as" | "forwardedAs"> & {
19
- as?: import("styled-components").WebTarget | undefined;
20
- forwardedAs?: import("styled-components").WebTarget | undefined;
21
- }, "style"> & {
22
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
23
- [key: `--${string}`]: string | number | undefined;
24
- }) | undefined;
25
- }> & string;
26
- readonly compact: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
27
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
28
- }, {
29
- $isDisabled?: boolean;
30
- $isLoading?: boolean;
31
- $isOpen?: boolean;
32
- $hideContent?: boolean;
33
- $hasLeftIcon?: boolean;
34
- $hasRightIcon?: boolean;
35
- $hasContent?: boolean;
36
- }>, "as" | "forwardedAs"> & {
37
- as?: import("styled-components").WebTarget | undefined;
38
- forwardedAs?: import("styled-components").WebTarget | undefined;
39
- }, "style"> & {
40
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
41
- [key: `--${string}`]: string | number | undefined;
42
- }) | undefined;
43
- }> & string;
44
- };
45
- readonly ghost: {
46
- readonly field: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
47
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
48
- }, {
49
- $isDisabled?: boolean;
50
- $isLoading?: boolean;
51
- $isOpen?: boolean;
52
- $hideContent?: boolean;
53
- $hasLeftIcon?: boolean;
54
- $hasRightIcon?: boolean;
55
- $hasContent?: boolean;
56
- }>, "as" | "forwardedAs"> & {
57
- as?: import("styled-components").WebTarget | undefined;
58
- forwardedAs?: import("styled-components").WebTarget | undefined;
59
- }, "style"> & {
60
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
61
- [key: `--${string}`]: string | number | undefined;
62
- }) | undefined;
63
- }> & string;
64
- readonly compact: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
65
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
66
- }, {
67
- $isDisabled?: boolean;
68
- $isLoading?: boolean;
69
- $isOpen?: boolean;
70
- $hideContent?: boolean;
71
- $hasLeftIcon?: boolean;
72
- $hasRightIcon?: boolean;
73
- $hasContent?: boolean;
74
- }>, "as" | "forwardedAs"> & {
75
- as?: import("styled-components").WebTarget | undefined;
76
- forwardedAs?: import("styled-components").WebTarget | undefined;
77
- }, "style"> & {
78
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
79
- [key: `--${string}`]: string | number | undefined;
80
- }) | undefined;
81
- }> & string;
82
- };
83
- };
84
- readonly primary: {
85
- readonly shape: {
86
- readonly field: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
87
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
88
- }, {
89
- $isDisabled?: boolean;
90
- $isLoading?: boolean;
91
- $isOpen?: boolean;
92
- $hideContent?: boolean;
93
- $hasLeftIcon?: boolean;
94
- $hasRightIcon?: boolean;
95
- $hasContent?: boolean;
96
- }>, "as" | "forwardedAs"> & {
97
- as?: import("styled-components").WebTarget | undefined;
98
- forwardedAs?: import("styled-components").WebTarget | undefined;
99
- }, "style"> & {
100
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
101
- [key: `--${string}`]: string | number | undefined;
102
- }) | undefined;
103
- }> & string;
104
- readonly compact: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
105
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
106
- }, {
107
- $isDisabled?: boolean;
108
- $isLoading?: boolean;
109
- $isOpen?: boolean;
110
- $hideContent?: boolean;
111
- $hasLeftIcon?: boolean;
112
- $hasRightIcon?: boolean;
113
- $hasContent?: boolean;
114
- }>, "as" | "forwardedAs"> & {
115
- as?: import("styled-components").WebTarget | undefined;
116
- forwardedAs?: import("styled-components").WebTarget | undefined;
117
- }, "style"> & {
118
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
119
- [key: `--${string}`]: string | number | undefined;
120
- }) | undefined;
121
- }> & string;
122
- };
123
- readonly ghost: {
124
- readonly field: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
125
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
126
- }, {
127
- $isDisabled?: boolean;
128
- $isLoading?: boolean;
129
- $isOpen?: boolean;
130
- $hideContent?: boolean;
131
- $hasLeftIcon?: boolean;
132
- $hasRightIcon?: boolean;
133
- $hasContent?: boolean;
134
- }>, "as" | "forwardedAs"> & {
135
- as?: import("styled-components").WebTarget | undefined;
136
- forwardedAs?: import("styled-components").WebTarget | undefined;
137
- }, "style"> & {
138
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
139
- [key: `--${string}`]: string | number | undefined;
140
- }) | undefined;
141
- }> & string;
142
- readonly compact: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
143
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
144
- }, {
145
- $isDisabled?: boolean;
146
- $isLoading?: boolean;
147
- $isOpen?: boolean;
148
- $hideContent?: boolean;
149
- $hasLeftIcon?: boolean;
150
- $hasRightIcon?: boolean;
151
- $hasContent?: boolean;
152
- }>, "as" | "forwardedAs"> & {
153
- as?: import("styled-components").WebTarget | undefined;
154
- forwardedAs?: import("styled-components").WebTarget | undefined;
155
- }, "style"> & {
156
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
157
- [key: `--${string}`]: string | number | undefined;
158
- }) | undefined;
159
- }> & string;
160
- };
161
- };
162
- readonly secondary: {
163
- readonly shape: {
164
- readonly field: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
165
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
166
- }, {
167
- $isDisabled?: boolean;
168
- $isLoading?: boolean;
169
- $isOpen?: boolean;
170
- $hideContent?: boolean;
171
- $hasLeftIcon?: boolean;
172
- $hasRightIcon?: boolean;
173
- $hasContent?: boolean;
174
- }>, "as" | "forwardedAs"> & {
175
- as?: import("styled-components").WebTarget | undefined;
176
- forwardedAs?: import("styled-components").WebTarget | undefined;
177
- }, "style"> & {
178
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
179
- [key: `--${string}`]: string | number | undefined;
180
- }) | undefined;
181
- }> & string;
182
- readonly compact: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
183
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
184
- }, {
185
- $isDisabled?: boolean;
186
- $isLoading?: boolean;
187
- $isOpen?: boolean;
188
- $hideContent?: boolean;
189
- $hasLeftIcon?: boolean;
190
- $hasRightIcon?: boolean;
191
- $hasContent?: boolean;
192
- }>, "as" | "forwardedAs"> & {
193
- as?: import("styled-components").WebTarget | undefined;
194
- forwardedAs?: import("styled-components").WebTarget | undefined;
195
- }, "style"> & {
196
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
197
- [key: `--${string}`]: string | number | undefined;
198
- }) | undefined;
199
- }> & string;
200
- };
201
- readonly ghost: {
202
- readonly field: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
203
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
204
- }, {
205
- $isDisabled?: boolean;
206
- $isLoading?: boolean;
207
- $isOpen?: boolean;
208
- $hideContent?: boolean;
209
- $hasLeftIcon?: boolean;
210
- $hasRightIcon?: boolean;
211
- $hasContent?: boolean;
212
- }>, "as" | "forwardedAs"> & {
213
- as?: import("styled-components").WebTarget | undefined;
214
- forwardedAs?: import("styled-components").WebTarget | undefined;
215
- }, "style"> & {
216
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
217
- [key: `--${string}`]: string | number | undefined;
218
- }) | undefined;
219
- }> & string;
220
- readonly compact: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style"> & {
221
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
222
- }, {
223
- $isDisabled?: boolean;
224
- $isLoading?: boolean;
225
- $isOpen?: boolean;
226
- $hideContent?: boolean;
227
- $hasLeftIcon?: boolean;
228
- $hasRightIcon?: boolean;
229
- $hasContent?: boolean;
230
- }>, "as" | "forwardedAs"> & {
231
- as?: import("styled-components").WebTarget | undefined;
232
- forwardedAs?: import("styled-components").WebTarget | undefined;
233
- }, "style"> & {
234
- style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | (import("react").CSSProperties & {
235
- [key: `--${string}`]: string | number | undefined;
236
- }) | undefined;
237
- }> & string;
238
- };
239
- };
240
- };
package/Button/maps.js DELETED
@@ -1,37 +0,0 @@
1
- import { ButtonBoxDangerShapeCompact, ButtonBoxDangerGhostCompact, ButtonBoxDangerShapeField, ButtonBoxDangerGhostField, ButtonBoxPrimaryShapeCompact, ButtonBoxPrimaryGhostCompact, ButtonBoxPrimaryShapeField, ButtonBoxPrimaryGhostField, ButtonBoxSecondaryShapeCompact, ButtonBoxSecondaryGhostCompact, ButtonBoxSecondaryShapeField, ButtonBoxSecondaryGhostField } from './styles';
2
- export const SpinnerSizeByButtonSizeMap = {
3
- compact: 'small',
4
- field: 'medium'
5
- };
6
- export const ButtonPropsToButtonBoxMap = {
7
- danger: {
8
- shape: {
9
- field: ButtonBoxDangerShapeField,
10
- compact: ButtonBoxDangerShapeCompact
11
- },
12
- ghost: {
13
- field: ButtonBoxDangerGhostField,
14
- compact: ButtonBoxDangerGhostCompact
15
- }
16
- },
17
- primary: {
18
- shape: {
19
- field: ButtonBoxPrimaryShapeField,
20
- compact: ButtonBoxPrimaryShapeCompact
21
- },
22
- ghost: {
23
- field: ButtonBoxPrimaryGhostField,
24
- compact: ButtonBoxPrimaryGhostCompact
25
- }
26
- },
27
- secondary: {
28
- shape: {
29
- field: ButtonBoxSecondaryShapeField,
30
- compact: ButtonBoxSecondaryShapeCompact
31
- },
32
- ghost: {
33
- field: ButtonBoxSecondaryGhostField,
34
- compact: ButtonBoxSecondaryGhostCompact
35
- }
36
- }
37
- };