@semcore/button 16.0.0-prerelease.7 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -2
- package/lib/cjs/component/AbstractButton/AbstractButton.js +4 -1
- package/lib/cjs/component/AbstractButton/AbstractButton.js.map +1 -1
- package/lib/cjs/component/Button/Button.js +30 -27
- package/lib/cjs/component/Button/Button.js.map +1 -1
- package/lib/cjs/component/Button/Button.type.js.map +1 -1
- package/lib/cjs/component/Button/button.shadow.css +17 -1
- package/lib/cjs/component/ButtonLink/ButtonLink.js +4 -2
- package/lib/cjs/component/ButtonLink/ButtonLink.js.map +1 -1
- package/lib/es6/component/AbstractButton/AbstractButton.js +4 -1
- package/lib/es6/component/AbstractButton/AbstractButton.js.map +1 -1
- package/lib/es6/component/Button/Button.js +30 -27
- package/lib/es6/component/Button/Button.js.map +1 -1
- package/lib/es6/component/Button/Button.type.js.map +1 -1
- package/lib/es6/component/Button/button.shadow.css +17 -1
- package/lib/es6/component/ButtonLink/ButtonLink.js +4 -2
- package/lib/es6/component/ButtonLink/ButtonLink.js.map +1 -1
- package/lib/esm/component/AbstractButton/AbstractButton.mjs +4 -1
- package/lib/esm/component/Button/Button.mjs +32 -28
- package/lib/esm/component/Button/button.shadow.css +398 -0
- package/lib/esm/component/ButtonLink/ButtonLink.mjs +4 -1
- package/lib/esm/component/ButtonLink/buttonLink.shadow.css +159 -0
- package/lib/types/component/Button/Button.type.d.ts +6 -2
- package/package.json +6 -6
- package/src/component/AbstractButton/AbstractButton.tsx +7 -1
- package/src/component/AbstractButton/AbstractButton.type.ts +1 -3
- package/src/component/Button/Button.type.ts +7 -2
- package/src/component/Button/button.shadow.css +17 -1
|
@@ -9,13 +9,16 @@ import React from "react";
|
|
|
9
9
|
import { Box } from "@semcore/flex-box";
|
|
10
10
|
import { AbstractButton } from "../AbstractButton/AbstractButton.mjs";
|
|
11
11
|
import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
12
|
+
/*!__reshadow-styles__:"./buttonLink.shadow.css"*/
|
|
12
13
|
var style = (
|
|
13
14
|
/*__reshadow_css_start__*/
|
|
14
15
|
(sstyled.insert(
|
|
15
16
|
/*__inner_css_start__*/
|
|
16
17
|
".___SButton_vy4nu_gg_{display:inline-flex;font-family:inherit;font-size:var(--intergalactic-fs-200, 14px);color:var(--intergalactic-text-link, #006dca);line-height:normal;position:relative;cursor:pointer;border:0;padding:0;margin:0;box-shadow:none;-webkit-tap-highlight-color:transparent;background:0 0;transition:color .15s ease-in-out}.___SButton_vy4nu_gg_,.___SButton_vy4nu_gg_:active{-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SButton_vy4nu_gg_:hover{-webkit-text-decoration:none;text-decoration:none}}.___SButton_vy4nu_gg_::-moz-focus-inner{border:0;padding:0}.___SButton_vy4nu_gg_.__active_vy4nu_gg_,.___SButton_vy4nu_gg_:active{color:var(--intergalactic-text-link-hover-active, #044792)}@media (hover:hover){.___SButton_vy4nu_gg_:hover{color:var(--intergalactic-text-link-hover-active, #044792)}}.___SButton_vy4nu_gg_.__active_vy4nu_gg_ .___SText_vy4nu_gg_,.___SButton_vy4nu_gg_:active .___SText_vy4nu_gg_{border-color:currentColor}@media (hover:hover){.___SButton_vy4nu_gg_:hover .___SText_vy4nu_gg_{border-color:currentColor}}.___SButton_vy4nu_gg_.__enableVisited_vy4nu_gg_:visited{color:var(--intergalactic-text-link-visited, #8649e1)}@media (hover:hover){.___SButton_vy4nu_gg_.__enableVisited_vy4nu_gg_:visited:hover{color:var(--intergalactic-text-link-visited, #8649e1)}}.___SButton_vy4nu_gg_ .___SText_vy4nu_gg_{border-bottom-width:1px;border-bottom-style:solid;border-color:transparent;transition:border-bottom-color .15s ease-in-out}.___SButton_vy4nu_gg_.__disabled_vy4nu_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3);cursor:default;pointer-events:none}.___SButton_vy4nu_gg_._use_secondary_vy4nu_gg_{color:var(--intergalactic-text-hint, #6c6e79)}.___SButton_vy4nu_gg_._use_secondary_vy4nu_gg_.__active_vy4nu_gg_,.___SButton_vy4nu_gg_._use_secondary_vy4nu_gg_:active{color:var(--intergalactic-text-hint-hover-active, #484a54)}@media (hover:hover){.___SButton_vy4nu_gg_._use_secondary_vy4nu_gg_:hover{color:var(--intergalactic-text-hint-hover-active, #484a54)}}.___SButton_vy4nu_gg_._use_secondary_vy4nu_gg_ .___SText_vy4nu_gg_{border-bottom-width:1px;border-bottom-style:dashed;border-color:currentColor}.___SAddon_vy4nu_gg_,.___SInner_vy4nu_gg_{display:inline-flex;justify-content:center;align-items:center}.___SInner_vy4nu_gg_{height:100%;width:100%}.___SAddon_vy4nu_gg_{vertical-align:middle;pointer-events:none}.___SButton_vy4nu_gg_ .___SAddon_vy4nu_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SButton_vy4nu_gg_ .___SAddon_vy4nu_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SButton_vy4nu_gg_.__text-color_vy4nu_gg_{color:var(--text-color_vy4nu)}.___SButton_vy4nu_gg_.__text-color_vy4nu_gg_.__active_vy4nu_gg_,.___SButton_vy4nu_gg_.__text-color_vy4nu_gg_:active{color:var(--text-color_vy4nu);filter:brightness(.8)}@media (hover:hover){.___SButton_vy4nu_gg_.__text-color_vy4nu_gg_:hover{color:var(--text-color_vy4nu);filter:brightness(.8)}}.___SButton_vy4nu_gg_._size_100_vy4nu_gg_{font-size:var(--intergalactic-fs-100, 12px);line-height:var(--intergalactic-lh-100, 133%)}.___SButton_vy4nu_gg_._size_200_vy4nu_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SButton_vy4nu_gg_._size_300_vy4nu_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___SButton_vy4nu_gg_._size_400_vy4nu_gg_{font-size:var(--intergalactic-fs-400, 20px);line-height:var(--intergalactic-lh-400, 120%)}.___SButton_vy4nu_gg_._size_500_vy4nu_gg_{font-size:var(--intergalactic-fs-500, 24px);line-height:var(--intergalactic-lh-500, 117%)}.___SButton_vy4nu_gg_._size_600_vy4nu_gg_{font-size:var(--intergalactic-fs-600, 32px);line-height:var(--intergalactic-lh-600, 125%)}.___SButton_vy4nu_gg_._size_700_vy4nu_gg_{font-size:var(--intergalactic-fs-700, 36px);line-height:var(--intergalactic-lh-700, 110%)}.___SButton_vy4nu_gg_._size_800_vy4nu_gg_{font-size:var(--intergalactic-fs-800, 48px);line-height:var(--intergalactic-lh-800, 117%)}@media (prefers-reduced-motion){.___SButton_vy4nu_gg_,.___SText_vy4nu_gg_{transition:none}}",
|
|
18
|
+
/*__inner_css_end__*/
|
|
17
19
|
"vy4nu_gg_"
|
|
18
|
-
),
|
|
20
|
+
), /*__reshadow_css_end__*/
|
|
21
|
+
{
|
|
19
22
|
"__SButton": "___SButton_vy4nu_gg_",
|
|
20
23
|
"_disabled": "__disabled_vy4nu_gg_",
|
|
21
24
|
"__SInner": "___SInner_vy4nu_gg_",
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
SButton {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
font-family: inherit;
|
|
4
|
+
font-size: var(--intergalactic-fs-200, 14px);
|
|
5
|
+
color: var(--intergalactic-text-link, #006dca);
|
|
6
|
+
line-height: normal;
|
|
7
|
+
position: relative;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
text-decoration: none;
|
|
10
|
+
border: none;
|
|
11
|
+
padding: 0;
|
|
12
|
+
margin: 0;
|
|
13
|
+
box-shadow: none;
|
|
14
|
+
-webkit-tap-highlight-color: transparent;
|
|
15
|
+
background: none;
|
|
16
|
+
transition: color 0.15s ease-in-out;
|
|
17
|
+
|
|
18
|
+
&:active,
|
|
19
|
+
&:hover {
|
|
20
|
+
text-decoration: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&::-moz-focus-inner {
|
|
24
|
+
border: none;
|
|
25
|
+
padding: 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&[active],
|
|
29
|
+
&:hover,
|
|
30
|
+
&:active {
|
|
31
|
+
color: var(--intergalactic-text-link-hover-active, #044792);
|
|
32
|
+
|
|
33
|
+
& SText {
|
|
34
|
+
border-color: currentColor;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&[enableVisited]:visited,
|
|
39
|
+
&[enableVisited]:visited:hover {
|
|
40
|
+
color: var(--intergalactic-text-link-visited, #8649e1);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
SText {
|
|
44
|
+
border-bottom-width: 1px;
|
|
45
|
+
border-bottom-style: solid;
|
|
46
|
+
border-color: transparent;
|
|
47
|
+
transition: border-bottom-color 0.15s ease-in-out;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
SButton[disabled] {
|
|
52
|
+
opacity: var(--intergalactic-disabled-opacity, 0.3);
|
|
53
|
+
cursor: default;
|
|
54
|
+
/* Disable link interactions */
|
|
55
|
+
pointer-events: none;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
SButton[use='secondary'] {
|
|
59
|
+
color: var(--intergalactic-text-hint, #6c6e79);
|
|
60
|
+
|
|
61
|
+
&[active],
|
|
62
|
+
&:active,
|
|
63
|
+
&:hover {
|
|
64
|
+
color: var(--intergalactic-text-hint-hover-active, #484a54);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
SText {
|
|
68
|
+
border-bottom-width: 1px;
|
|
69
|
+
border-bottom-style: dashed;
|
|
70
|
+
border-color: currentColor;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
SInner {
|
|
75
|
+
display: inline-flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
height: 100%;
|
|
79
|
+
width: 100%;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
SAddon {
|
|
83
|
+
display: inline-flex;
|
|
84
|
+
justify-content: center;
|
|
85
|
+
align-items: center;
|
|
86
|
+
vertical-align: middle;
|
|
87
|
+
pointer-events: none;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
SButton SAddon {
|
|
91
|
+
&:not(:only-child):first-child {
|
|
92
|
+
margin-right: var(--intergalactic-spacing-1x, 4px);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&:not(:only-child):last-child {
|
|
96
|
+
margin-left: var(--intergalactic-spacing-1x, 4px);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
SButton[text-color] {
|
|
101
|
+
color: var(--text-color);
|
|
102
|
+
|
|
103
|
+
&[active],
|
|
104
|
+
&:hover,
|
|
105
|
+
&:active {
|
|
106
|
+
color: var(--text-color);
|
|
107
|
+
filter: brightness(0.8);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
SButton[size='100'] {
|
|
112
|
+
font-size: var(--intergalactic-fs-100, 12px);
|
|
113
|
+
line-height: var(--intergalactic-lh-100, 133%);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
SButton[size='200'] {
|
|
117
|
+
font-size: var(--intergalactic-fs-200, 14px);
|
|
118
|
+
line-height: var(--intergalactic-lh-200, 142%);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
SButton[size='300'] {
|
|
122
|
+
font-size: var(--intergalactic-fs-300, 16px);
|
|
123
|
+
line-height: var(--intergalactic-lh-300, 150%);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
SButton[size='400'] {
|
|
127
|
+
font-size: var(--intergalactic-fs-400, 20px);
|
|
128
|
+
line-height: var(--intergalactic-lh-400, 120%);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
SButton[size='500'] {
|
|
132
|
+
font-size: var(--intergalactic-fs-500, 24px);
|
|
133
|
+
line-height: var(--intergalactic-lh-500, 117%);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
SButton[size='600'] {
|
|
137
|
+
font-size: var(--intergalactic-fs-600, 32px);
|
|
138
|
+
line-height: var(--intergalactic-lh-600, 125%);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
SButton[size='700'] {
|
|
142
|
+
font-size: var(--intergalactic-fs-700, 36px);
|
|
143
|
+
line-height: var(--intergalactic-lh-700, 110%);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
SButton[size='800'] {
|
|
147
|
+
font-size: var(--intergalactic-fs-800, 48px);
|
|
148
|
+
line-height: var(--intergalactic-lh-800, 117%);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@media (prefers-reduced-motion) {
|
|
152
|
+
SButton {
|
|
153
|
+
transition: none;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
SText {
|
|
157
|
+
transition: none;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -10,12 +10,16 @@ export type ButtonSize = 'l' | 'm';
|
|
|
10
10
|
* @default secondary
|
|
11
11
|
*/
|
|
12
12
|
type Use = 'primary' | 'secondary' | 'tertiary';
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated don't use it. use `danger` for incorrect or danger behavior and `brand` for the orange one.
|
|
15
|
+
*/
|
|
16
|
+
type DeprecatedTheme = 'warning';
|
|
13
17
|
/** Button theme */
|
|
14
|
-
type Theme = 'info' | 'success' | '
|
|
18
|
+
type Theme = 'info' | 'success' | 'brand' | 'danger' | 'muted' | 'invert';
|
|
15
19
|
/** @deprecated */
|
|
16
20
|
export interface IButtonProps extends ButtonProps, UnknownProperties {
|
|
17
21
|
}
|
|
18
|
-
export type ButtonProps = AbstractButtonProps<ButtonSize, Use, Theme>;
|
|
22
|
+
export type ButtonProps = AbstractButtonProps<ButtonSize, Use, Theme | DeprecatedTheme>;
|
|
19
23
|
/** @deprecated */
|
|
20
24
|
export interface IButtonTextProps extends ButtonTextProps, UnknownProperties {
|
|
21
25
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/button",
|
|
3
3
|
"description": "Semrush Button Component",
|
|
4
|
-
"version": "16.0.0
|
|
4
|
+
"version": "16.0.0",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/flex-box": "16.0.0
|
|
18
|
-
"@semcore/neighbor-location": "16.0.0
|
|
19
|
-
"@semcore/spin": "16.0.0
|
|
20
|
-
"@semcore/tooltip": "16.0.0
|
|
17
|
+
"@semcore/flex-box": "16.0.0",
|
|
18
|
+
"@semcore/neighbor-location": "16.0.0",
|
|
19
|
+
"@semcore/spin": "16.0.0",
|
|
20
|
+
"@semcore/tooltip": "16.0.0"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"@semcore/base-components": "^16.0.0
|
|
23
|
+
"@semcore/base-components": "^16.0.0"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
@@ -50,6 +50,12 @@ export abstract class AbstractButton extends Component<Props, {}, {}> {
|
|
|
50
50
|
`'title' or 'aria-label' or 'aria-labelledby' are required props for buttons without text content`,
|
|
51
51
|
this.asProps['data-ui-name'] || AbstractButton.displayName,
|
|
52
52
|
);
|
|
53
|
+
|
|
54
|
+
logger.warn(
|
|
55
|
+
this.asProps.theme === 'warning',
|
|
56
|
+
'Warning theme is deprecated and will be removed in the next major release.',
|
|
57
|
+
this.asProps['data-ui-name'] || AbstractButton.displayName,
|
|
58
|
+
);
|
|
53
59
|
}
|
|
54
60
|
|
|
55
61
|
const ariaLabelledby = this.asProps['aria-labelledby'];
|
|
@@ -79,7 +85,7 @@ export abstract class AbstractButton extends Component<Props, {}, {}> {
|
|
|
79
85
|
const SButton = Root;
|
|
80
86
|
|
|
81
87
|
return sstyled(styles)(
|
|
82
|
-
<SButton render={Hint} {...buttonProps} {...hintProps}>
|
|
88
|
+
<SButton render={Hint} {...buttonProps} {...hintProps} ignorePortalsStacking>
|
|
83
89
|
{children}
|
|
84
90
|
</SButton>,
|
|
85
91
|
);
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PropGetterFn } from '@semcore/core';
|
|
3
|
-
import { KeyboardFocusProps } from '@semcore/core/lib/utils/enhances/keyboardFocusEnhance';
|
|
4
3
|
import { BoxProps } from '@semcore/flex-box';
|
|
5
4
|
import { NeighborItemProps } from '@semcore/neighbor-location';
|
|
6
5
|
import { TooltipHintProps } from '@semcore/tooltip';
|
|
7
6
|
|
|
8
7
|
export type AbstractButtonProps<S, U, T> = BoxProps &
|
|
9
|
-
NeighborItemProps &
|
|
10
|
-
KeyboardFocusProps & {
|
|
8
|
+
NeighborItemProps & {
|
|
11
9
|
/** Button activity state */
|
|
12
10
|
active?: boolean;
|
|
13
11
|
/** Disabled button state */
|
|
@@ -18,12 +18,17 @@ export type ButtonSize = 'l' | 'm';
|
|
|
18
18
|
*/
|
|
19
19
|
type Use = 'primary' | 'secondary' | 'tertiary';
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* @deprecated don't use it. use `danger` for incorrect or danger behavior and `brand` for the orange one.
|
|
23
|
+
*/
|
|
24
|
+
type DeprecatedTheme = 'warning';
|
|
25
|
+
|
|
21
26
|
/** Button theme */
|
|
22
|
-
type Theme = 'info' | 'success' | '
|
|
27
|
+
type Theme = 'info' | 'success' | 'brand' | 'danger' | 'muted' | 'invert';
|
|
23
28
|
|
|
24
29
|
/** @deprecated */
|
|
25
30
|
export interface IButtonProps extends ButtonProps, UnknownProperties {}
|
|
26
|
-
export type ButtonProps = AbstractButtonProps<ButtonSize, Use, Theme>;
|
|
31
|
+
export type ButtonProps = AbstractButtonProps<ButtonSize, Use, Theme | DeprecatedTheme>;
|
|
27
32
|
|
|
28
33
|
/** @deprecated */
|
|
29
34
|
export interface IButtonTextProps extends ButtonTextProps, UnknownProperties {}
|
|
@@ -92,6 +92,22 @@ SButton[theme='primary-success'] {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
SButton[theme='primary-brand'] {
|
|
96
|
+
color: var(--intergalactic-text-primary-invert, #ffffff);
|
|
97
|
+
background-color: var(--intergalactic-control-primary-brand, #ff642d);
|
|
98
|
+
|
|
99
|
+
&:hover {
|
|
100
|
+
color: var(--intergalactic-text-primary-invert, #ffffff);
|
|
101
|
+
background-color: var(--intergalactic-control-primary-brand-hover, #c33909);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&:active,
|
|
105
|
+
&[active] {
|
|
106
|
+
color: var(--intergalactic-text-primary-invert, #ffffff);
|
|
107
|
+
background-color: var(--intergalactic-control-primary-brand-active, #8b1500);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
95
111
|
SButton[theme='primary-warning'] {
|
|
96
112
|
color: var(--intergalactic-text-primary-invert, #ffffff);
|
|
97
113
|
background-color: var(--intergalactic-control-primary-brand, #ff642d);
|
|
@@ -104,7 +120,7 @@ SButton[theme='primary-warning'] {
|
|
|
104
120
|
&:active,
|
|
105
121
|
&[active] {
|
|
106
122
|
color: var(--intergalactic-text-primary-invert, #ffffff);
|
|
107
|
-
background-color: var(--intergalactic-control-primary-brand-active, #
|
|
123
|
+
background-color: var(--intergalactic-control-primary-brand-active, #8b1500);
|
|
108
124
|
}
|
|
109
125
|
}
|
|
110
126
|
|