@semcore/button 17.0.0-prerelease.29 → 17.0.0-prerelease.31
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 +1 -1
- package/lib/cjs/component/Button/Button.js +121 -18
- 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/SpinButton.js.map +1 -0
- package/lib/cjs/component/ButtonLink/ButtonLink.js +28 -54
- package/lib/cjs/component/ButtonLink/ButtonLink.js.map +1 -1
- package/lib/cjs/component/ButtonLink/ButtonLink.type.js.map +1 -1
- package/lib/cjs/component/ButtonLink/buttonLink.shadow.css +10 -140
- package/lib/cjs/index.js +3 -4
- package/lib/cjs/index.js.map +1 -1
- package/lib/es6/component/Button/Button.js +123 -20
- 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/SpinButton.js.map +1 -0
- package/lib/es6/component/ButtonLink/ButtonLink.js +29 -56
- package/lib/es6/component/ButtonLink/ButtonLink.js.map +1 -1
- package/lib/es6/component/ButtonLink/ButtonLink.type.js.map +1 -1
- package/lib/es6/component/ButtonLink/buttonLink.shadow.css +10 -140
- package/lib/es6/index.js +1 -2
- package/lib/es6/index.js.map +1 -1
- package/lib/esm/component/Button/Button.mjs +121 -17
- package/lib/esm/component/ButtonLink/ButtonLink.mjs +29 -54
- package/lib/esm/component/ButtonLink/buttonLink.shadow.css +10 -140
- package/lib/esm/index.mjs +1 -2
- package/lib/types/component/Button/Button.d.ts +28 -1
- package/lib/types/component/Button/Button.type.d.ts +40 -23
- package/lib/types/component/ButtonLink/ButtonLink.type.d.ts +14 -19
- package/lib/types/index.d.ts +1 -2
- package/package.json +7 -5
- package/src/component/Button/Button.tsx +148 -10
- package/src/component/Button/Button.type.ts +46 -34
- package/src/component/ButtonLink/ButtonLink.tsx +22 -26
- package/src/component/ButtonLink/ButtonLink.type.ts +15 -26
- package/src/component/ButtonLink/buttonLink.shadow.css +10 -140
- package/src/index.ts +1 -2
- package/lib/cjs/component/AbstractButton/AbstractButton.js +0 -124
- package/lib/cjs/component/AbstractButton/AbstractButton.js.map +0 -1
- package/lib/cjs/component/AbstractButton/AbstractButton.type.js +0 -2
- package/lib/cjs/component/AbstractButton/AbstractButton.type.js.map +0 -1
- package/lib/cjs/component/AbstractButton/SpinButton.js.map +0 -1
- package/lib/es6/component/AbstractButton/AbstractButton.js +0 -117
- package/lib/es6/component/AbstractButton/AbstractButton.js.map +0 -1
- package/lib/es6/component/AbstractButton/AbstractButton.type.js +0 -2
- package/lib/es6/component/AbstractButton/AbstractButton.type.js.map +0 -1
- package/lib/es6/component/AbstractButton/SpinButton.js.map +0 -1
- package/lib/esm/component/AbstractButton/AbstractButton.mjs +0 -119
- package/lib/types/component/AbstractButton/AbstractButton.d.ts +0 -23
- package/lib/types/component/AbstractButton/AbstractButton.type.d.ts +0 -36
- package/src/component/AbstractButton/AbstractButton.tsx +0 -161
- package/src/component/AbstractButton/AbstractButton.type.ts +0 -42
- /package/lib/cjs/component/{AbstractButton → Button}/SpinButton.js +0 -0
- /package/lib/es6/component/{AbstractButton → Button}/SpinButton.js +0 -0
- /package/lib/esm/component/{AbstractButton → Button}/SpinButton.mjs +0 -0
- /package/lib/types/component/{AbstractButton → Button}/SpinButton.d.ts +0 -0
- /package/src/component/{AbstractButton → Button}/SpinButton.tsx +0 -0
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import { createComponent,
|
|
3
|
-
import { Box } from "@semcore/base-components";
|
|
2
|
+
import { sstyled, createComponent, Component, CORE_INSTANCE, assignProps } from "@semcore/core";
|
|
3
|
+
import { NeighborLocation, Box, Hint } from "@semcore/base-components";
|
|
4
|
+
import addonTextChildren from "@semcore/core/lib/utils/addonTextChildren";
|
|
5
|
+
import hasLabels from "@semcore/core/lib/utils/hasLabels";
|
|
6
|
+
import logger from "@semcore/core/lib/utils/logger";
|
|
7
|
+
import { Text } from "@semcore/typography";
|
|
4
8
|
import React from "react";
|
|
5
|
-
import
|
|
9
|
+
import SpinButton from "./SpinButton.mjs";
|
|
6
10
|
/*!__reshadow-styles__:"./button.shadow.css"*/
|
|
7
11
|
const style = (
|
|
8
12
|
/*__reshadow_css_start__*/
|
|
@@ -41,9 +45,109 @@ const style = (
|
|
|
41
45
|
"_theme_tertiary-invert": "_theme_tertiary-invert_1vv7x_gg_"
|
|
42
46
|
})
|
|
43
47
|
);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
const MAP_USE_DEFAULT_THEME = {
|
|
49
|
+
primary: "info",
|
|
50
|
+
secondary: "muted",
|
|
51
|
+
tertiary: "info"
|
|
52
|
+
};
|
|
53
|
+
class RootButton extends Component {
|
|
54
|
+
constructor(...args) {
|
|
55
|
+
super(...args);
|
|
56
|
+
_defineProperty(this, "containerRef", /* @__PURE__ */ React.createRef());
|
|
57
|
+
_defineProperty(this, "state", {
|
|
58
|
+
ariaLabelledByContent: null
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
getTextProps() {
|
|
62
|
+
const {
|
|
63
|
+
size
|
|
64
|
+
} = this.asProps;
|
|
65
|
+
return {
|
|
66
|
+
size,
|
|
67
|
+
"hint:triggerRef": this.containerRef
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
getAddonProps() {
|
|
71
|
+
const {
|
|
72
|
+
size
|
|
73
|
+
} = this.asProps;
|
|
74
|
+
return {
|
|
75
|
+
size
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
componentDidMount() {
|
|
79
|
+
if (process.env.NODE_ENV !== "production") {
|
|
80
|
+
logger.warn(this.containerRef.current && !hasLabels(this.containerRef.current) && !this.asProps.title, `'title' or 'aria-label' or 'aria-labelledby' are required props for buttons without text content`, this.asProps["data-ui-name"] || RootButton.displayName);
|
|
81
|
+
}
|
|
82
|
+
const ariaLabelledby = this.asProps["aria-labelledby"];
|
|
83
|
+
if (ariaLabelledby) {
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
var _a;
|
|
86
|
+
this.setState({
|
|
87
|
+
ariaLabelledByContent: ((_a = document.getElementById(ariaLabelledby)) == null ? void 0 : _a.textContent) ?? ""
|
|
88
|
+
});
|
|
89
|
+
}, 0);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
render() {
|
|
93
|
+
var _ref = this.asProps;
|
|
94
|
+
const {
|
|
95
|
+
styles,
|
|
96
|
+
use,
|
|
97
|
+
theme = typeof use === "string" && MAP_USE_DEFAULT_THEME[use],
|
|
98
|
+
loading,
|
|
99
|
+
disabled = loading,
|
|
100
|
+
size,
|
|
101
|
+
neighborLocation,
|
|
102
|
+
children,
|
|
103
|
+
title,
|
|
104
|
+
["aria-label"]: ariaLabel,
|
|
105
|
+
Children,
|
|
106
|
+
addonLeft: AddonLeft,
|
|
107
|
+
addonRight: AddonRight,
|
|
108
|
+
hintPlacement
|
|
109
|
+
} = this.asProps;
|
|
110
|
+
const SButton = Box;
|
|
111
|
+
const Button2 = this[CORE_INSTANCE];
|
|
112
|
+
const useTheme = use && theme ? `${use}-${theme}` : false;
|
|
113
|
+
const SInner = Box;
|
|
114
|
+
const SSpin = Box;
|
|
115
|
+
const buttonAriaLabel = title ?? ariaLabel ?? this.state.ariaLabelledByContent ?? "";
|
|
116
|
+
const showHint = children === void 0 || title;
|
|
117
|
+
return /* @__PURE__ */ React.createElement(NeighborLocation.Detect, {
|
|
118
|
+
neighborLocation
|
|
119
|
+
}, (neighborLocation2) => {
|
|
120
|
+
var _ref4;
|
|
121
|
+
return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SButton, _ref4.cn("SButton", {
|
|
122
|
+
...assignProps({
|
|
123
|
+
"invertOutline": theme === "invert",
|
|
124
|
+
"type": "button",
|
|
125
|
+
"tag": "button",
|
|
126
|
+
"tabIndex": 0,
|
|
127
|
+
"disabled": disabled,
|
|
128
|
+
"use:theme": useTheme,
|
|
129
|
+
"ref": this.containerRef,
|
|
130
|
+
"aria-busy": loading,
|
|
131
|
+
"__excludeProps": ["title"],
|
|
132
|
+
"aria-label": showHint ? buttonAriaLabel : void 0,
|
|
133
|
+
"neighborLocation": neighborLocation2
|
|
134
|
+
}, _ref)
|
|
135
|
+
}), /* @__PURE__ */ React.createElement(SInner, _ref4.cn("SInner", {
|
|
136
|
+
"tag": "span",
|
|
137
|
+
"loading": loading,
|
|
138
|
+
"data-ui-name": `${this.asProps["data-ui-name"]}.InnerWrapper`
|
|
139
|
+
}), AddonLeft ? /* @__PURE__ */ React.createElement(Button2.Addon, null, /* @__PURE__ */ React.createElement(AddonLeft, _ref4.cn("AddonLeft", {}))) : null, addonTextChildren(Children, Button2.Text, Button2.Addon), AddonRight ? /* @__PURE__ */ React.createElement(Button2.Addon, null, /* @__PURE__ */ React.createElement(AddonRight, _ref4.cn("AddonRight", {}))) : null), loading && /* @__PURE__ */ React.createElement(SSpin, _ref4.cn("SSpin", {
|
|
140
|
+
"tag": "span"
|
|
141
|
+
}), /* @__PURE__ */ React.createElement(SpinButton, _ref4.cn("SpinButton", {
|
|
142
|
+
"centered": true,
|
|
143
|
+
"size": size,
|
|
144
|
+
"theme": useTheme
|
|
145
|
+
})))), showHint && /* @__PURE__ */ React.createElement(Hint, _ref4.cn("Hint", {
|
|
146
|
+
"triggerRef": this.containerRef,
|
|
147
|
+
"timeout": [250, 50],
|
|
148
|
+
"placement": hintPlacement
|
|
149
|
+
}), buttonAriaLabel));
|
|
150
|
+
});
|
|
47
151
|
}
|
|
48
152
|
}
|
|
49
153
|
_defineProperty(RootButton, "displayName", "Button");
|
|
@@ -52,28 +156,28 @@ _defineProperty(RootButton, "defaultProps", {
|
|
|
52
156
|
use: "secondary",
|
|
53
157
|
size: "m"
|
|
54
158
|
});
|
|
55
|
-
function
|
|
56
|
-
var
|
|
57
|
-
const SText =
|
|
58
|
-
return
|
|
59
|
-
...assignProps({
|
|
60
|
-
"tag": "span"
|
|
61
|
-
}, _ref)
|
|
159
|
+
function ButtonText(props) {
|
|
160
|
+
var _ref2 = arguments[0], _ref5;
|
|
161
|
+
const SText = Text;
|
|
162
|
+
return _ref5 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SText, _ref5.cn("SText", {
|
|
163
|
+
...assignProps({}, _ref2)
|
|
62
164
|
}));
|
|
63
165
|
}
|
|
64
166
|
function Addon(props) {
|
|
65
|
-
var
|
|
167
|
+
var _ref3 = arguments[0], _ref6;
|
|
66
168
|
const SAddon = Box;
|
|
67
|
-
return
|
|
169
|
+
return _ref6 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SAddon, _ref6.cn("SAddon", {
|
|
68
170
|
...assignProps({
|
|
69
171
|
"tag": "span"
|
|
70
|
-
},
|
|
172
|
+
}, _ref3)
|
|
71
173
|
}));
|
|
72
174
|
}
|
|
73
175
|
const Button = createComponent(RootButton, {
|
|
74
|
-
Text,
|
|
176
|
+
Text: ButtonText,
|
|
75
177
|
Addon
|
|
76
178
|
});
|
|
77
179
|
export {
|
|
180
|
+
MAP_USE_DEFAULT_THEME,
|
|
181
|
+
RootButton,
|
|
78
182
|
Button as default
|
|
79
183
|
};
|
|
@@ -1,78 +1,53 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import { createComponent, sstyled, assignProps } from "@semcore/core";
|
|
3
|
-
import
|
|
4
|
-
import resolveColorEnhance from "@semcore/core/lib/utils/enhances/resolveColorEnhance";
|
|
2
|
+
import { createComponent, Component, sstyled, assignProps } from "@semcore/core";
|
|
3
|
+
import Link from "@semcore/link";
|
|
5
4
|
import React from "react";
|
|
6
|
-
import { AbstractButton } from "../AbstractButton/AbstractButton.mjs";
|
|
7
5
|
/*!__reshadow-styles__:"./buttonLink.shadow.css"*/
|
|
8
6
|
const style = (
|
|
9
7
|
/*__reshadow_css_start__*/
|
|
10
8
|
(sstyled.insert(
|
|
11
9
|
/*__inner_css_start__*/
|
|
12
|
-
".
|
|
10
|
+
".___SButtonLink_3pzzd_gg_{border:0;font-family:inherit}.___SButtonLink_3pzzd_gg_._use_primary_3pzzd_gg_:not(.__color_3pzzd_gg_){color:var(--intergalactic-text-link, #006dca)}.___SButtonLink_3pzzd_gg_._use_primary_3pzzd_gg_.__active_3pzzd_gg_:not(.__color_3pzzd_gg_),.___SButtonLink_3pzzd_gg_._use_primary_3pzzd_gg_:not(.__color_3pzzd_gg_):active{color:var(--intergalactic-text-link-hover-active, #044792)}@media (hover:hover){.___SButtonLink_3pzzd_gg_._use_primary_3pzzd_gg_:not(.__color_3pzzd_gg_):hover{color:var(--intergalactic-text-link-hover-active, #044792)}}.___SButtonLink_3pzzd_gg_._use_secondary_3pzzd_gg_:not(.__color_3pzzd_gg_){color:var(--intergalactic-text-hint, #6c6e79)}.___SButtonLink_3pzzd_gg_._use_secondary_3pzzd_gg_.__active_3pzzd_gg_:not(.__color_3pzzd_gg_),.___SButtonLink_3pzzd_gg_._use_secondary_3pzzd_gg_:not(.__color_3pzzd_gg_):active{color:var(--intergalactic-text-hint-hover-active, #484a54)}@media (hover:hover){.___SButtonLink_3pzzd_gg_._use_secondary_3pzzd_gg_:not(.__color_3pzzd_gg_):hover{color:var(--intergalactic-text-hint-hover-active, #484a54)}}.___SButtonLink_3pzzd_gg_._use_secondary_3pzzd_gg_ .___SText_3pzzd_gg_{text-decoration-style:dashed;text-decoration-color:currentColor}",
|
|
13
11
|
/*__inner_css_end__*/
|
|
14
|
-
"
|
|
12
|
+
"3pzzd_gg_"
|
|
15
13
|
), /*__reshadow_css_end__*/
|
|
16
14
|
{
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"_size_300": "_size_300_uv2ud_gg_",
|
|
24
|
-
"_size_400": "_size_400_uv2ud_gg_",
|
|
25
|
-
"_size_500": "_size_500_uv2ud_gg_",
|
|
26
|
-
"_size_600": "_size_600_uv2ud_gg_",
|
|
27
|
-
"_size_700": "_size_700_uv2ud_gg_",
|
|
28
|
-
"_size_800": "_size_800_uv2ud_gg_",
|
|
29
|
-
"__SText": "___SText_uv2ud_gg_",
|
|
30
|
-
"_active": "__active_uv2ud_gg_",
|
|
31
|
-
"_enableVisited": "__enableVisited_uv2ud_gg_",
|
|
32
|
-
"_use_secondary": "_use_secondary_uv2ud_gg_",
|
|
33
|
-
"_text-color": "__text-color_uv2ud_gg_",
|
|
34
|
-
"--text-color": "--text-color_uv2ud"
|
|
15
|
+
"__SButtonLink": "___SButtonLink_3pzzd_gg_",
|
|
16
|
+
"_use_secondary": "_use_secondary_3pzzd_gg_",
|
|
17
|
+
"__SText": "___SText_3pzzd_gg_",
|
|
18
|
+
"_use_primary": "_use_primary_3pzzd_gg_",
|
|
19
|
+
"_color": "__color_3pzzd_gg_",
|
|
20
|
+
"_active": "__active_3pzzd_gg_"
|
|
35
21
|
})
|
|
36
22
|
);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
getTextColor() {
|
|
23
|
+
class RootButtonLink extends Component {
|
|
24
|
+
render() {
|
|
25
|
+
var _ref = this.asProps, _ref2;
|
|
26
|
+
const SButtonLink = Link;
|
|
42
27
|
const {
|
|
43
|
-
|
|
44
|
-
resolveColor
|
|
28
|
+
disabled
|
|
45
29
|
} = this.asProps;
|
|
46
|
-
return
|
|
30
|
+
return _ref2 = sstyled(style), /* @__PURE__ */ React.createElement(SButtonLink, _ref2.cn("SButtonLink", {
|
|
31
|
+
...assignProps({
|
|
32
|
+
"tag": "button",
|
|
33
|
+
"type": "button",
|
|
34
|
+
"use:disabled": disabled,
|
|
35
|
+
"use:tabIndex": 0
|
|
36
|
+
}, _ref)
|
|
37
|
+
}));
|
|
47
38
|
}
|
|
48
39
|
}
|
|
49
40
|
_defineProperty(RootButtonLink, "displayName", "ButtonLink");
|
|
50
|
-
_defineProperty(RootButtonLink, "enhance", Object.values(enhance));
|
|
51
41
|
_defineProperty(RootButtonLink, "style", style);
|
|
52
42
|
_defineProperty(RootButtonLink, "defaultProps", {
|
|
53
|
-
use: "primary"
|
|
43
|
+
use: "primary",
|
|
44
|
+
size: 200
|
|
54
45
|
});
|
|
55
|
-
function Text(props) {
|
|
56
|
-
var _ref = arguments[0], _ref3;
|
|
57
|
-
const SText = Box;
|
|
58
|
-
return _ref3 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SText, _ref3.cn("SText", {
|
|
59
|
-
...assignProps({
|
|
60
|
-
"tag": "span"
|
|
61
|
-
}, _ref)
|
|
62
|
-
}));
|
|
63
|
-
}
|
|
64
|
-
function Addon(props) {
|
|
65
|
-
var _ref2 = arguments[0], _ref4;
|
|
66
|
-
const SAddon = Box;
|
|
67
|
-
return _ref4 = sstyled(props.styles), /* @__PURE__ */ React.createElement(SAddon, _ref4.cn("SAddon", {
|
|
68
|
-
...assignProps({
|
|
69
|
-
"tag": "span"
|
|
70
|
-
}, _ref2)
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
73
46
|
const ButtonLink = createComponent(RootButtonLink, {
|
|
74
|
-
Text,
|
|
75
|
-
Addon
|
|
47
|
+
Text: Link.Text,
|
|
48
|
+
Addon: Link.Addon
|
|
49
|
+
}, {
|
|
50
|
+
parent: Link
|
|
76
51
|
});
|
|
77
52
|
export {
|
|
78
53
|
ButtonLink
|
|
@@ -1,59 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
SButtonLink {
|
|
2
|
+
border: none;
|
|
3
3
|
font-family: inherit;
|
|
4
|
-
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
SButtonLink[use='primary']:not([color]) {
|
|
5
7
|
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
8
|
|
|
9
|
+
&[active],
|
|
18
10
|
&:active,
|
|
19
11
|
&: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
12
|
color: var(--intergalactic-text-link-hover-active, #044792);
|
|
32
|
-
|
|
33
|
-
& SText {
|
|
34
|
-
box-shadow: 0 1px 0 0 currentColor;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
&[enableVisited]:visited,
|
|
39
|
-
&[enableVisited]:visited:hover {
|
|
40
|
-
color: var(--intergalactic-text-link-visited, #8649e1);
|
|
41
13
|
}
|
|
42
|
-
|
|
43
|
-
SText {
|
|
44
|
-
box-shadow: 0 1px 0 0 transparent;
|
|
45
|
-
transition: box-shadow 0.15s ease-in-out;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
SButton[disabled] {
|
|
50
|
-
opacity: var(--intergalactic-disabled-opacity, 0.3);
|
|
51
|
-
cursor: default;
|
|
52
|
-
/* Disable link interactions */
|
|
53
|
-
pointer-events: none;
|
|
54
14
|
}
|
|
55
15
|
|
|
56
|
-
|
|
16
|
+
SButtonLink[use='secondary']:not([color]) {
|
|
57
17
|
color: var(--intergalactic-text-hint, #6c6e79);
|
|
58
18
|
|
|
59
19
|
&[active],
|
|
@@ -61,99 +21,9 @@ SButton[use='secondary'] {
|
|
|
61
21
|
&:hover {
|
|
62
22
|
color: var(--intergalactic-text-hint-hover-active, #484a54);
|
|
63
23
|
}
|
|
64
|
-
|
|
65
|
-
SText {
|
|
66
|
-
box-shadow: none;
|
|
67
|
-
border-bottom-width: 1px;
|
|
68
|
-
border-bottom-style: dashed;
|
|
69
|
-
border-color: currentColor;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
SInner {
|
|
74
|
-
display: inline-flex;
|
|
75
|
-
align-items: baseline;
|
|
76
|
-
justify-content: center;
|
|
77
|
-
height: 100%;
|
|
78
|
-
width: 100%;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
SAddon {
|
|
82
|
-
display: inline-flex;
|
|
83
|
-
justify-content: center;
|
|
84
|
-
align-items: baseline;
|
|
85
|
-
vertical-align: middle;
|
|
86
|
-
pointer-events: none;
|
|
87
|
-
align-self: center;
|
|
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
24
|
}
|
|
125
25
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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
|
-
}
|
|
26
|
+
SButtonLink[use='secondary'] SText {
|
|
27
|
+
text-decoration-style: dashed;
|
|
28
|
+
text-decoration-color: currentColor;
|
|
159
29
|
}
|
package/lib/esm/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { default as default2 } from "./component/Button/Button.mjs";
|
|
1
|
+
import { MAP_USE_DEFAULT_THEME, default as default2 } from "./component/Button/Button.mjs";
|
|
2
2
|
import { ButtonLink } from "./component/ButtonLink/ButtonLink.mjs";
|
|
3
|
-
import { MAP_USE_DEFAULT_THEME } from "./component/AbstractButton/AbstractButton.mjs";
|
|
4
3
|
export {
|
|
5
4
|
ButtonLink,
|
|
6
5
|
MAP_USE_DEFAULT_THEME,
|
|
@@ -1,3 +1,30 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Component } from '@semcore/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { ButtonProps, ButtonComponent } from './Button.type';
|
|
4
|
+
export declare const MAP_USE_DEFAULT_THEME: Record<string, string>;
|
|
5
|
+
type State = {
|
|
6
|
+
ariaLabelledByContent: null | string;
|
|
7
|
+
};
|
|
8
|
+
export declare class RootButton extends Component<ButtonProps, [], never, {}, State> {
|
|
9
|
+
static displayName: string;
|
|
10
|
+
static style: {
|
|
11
|
+
[key: string]: string;
|
|
12
|
+
};
|
|
13
|
+
static defaultProps: {
|
|
14
|
+
use: string;
|
|
15
|
+
size: string;
|
|
16
|
+
};
|
|
17
|
+
containerRef: React.RefObject<HTMLButtonElement>;
|
|
18
|
+
state: State;
|
|
19
|
+
getTextProps(): {
|
|
20
|
+
size: "l" | "m" | undefined;
|
|
21
|
+
'hint:triggerRef': React.RefObject<HTMLButtonElement>;
|
|
22
|
+
};
|
|
23
|
+
getAddonProps(): {
|
|
24
|
+
size: "l" | "m" | undefined;
|
|
25
|
+
};
|
|
26
|
+
componentDidMount(): void;
|
|
27
|
+
render(): React.JSX.Element;
|
|
28
|
+
}
|
|
2
29
|
declare const Button: ButtonComponent;
|
|
3
30
|
export default Button;
|
|
@@ -1,27 +1,44 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import type { BoxProps, NeighborItemProps, SimpleHintPopperProps } from '@semcore/base-components';
|
|
2
|
+
import type { Intergalactic, PropGetterFn } from '@semcore/core';
|
|
3
|
+
import type { TextProps } from '@semcore/typography';
|
|
4
|
+
import type React from 'react';
|
|
5
|
+
export type ButtonProps = BoxProps & NeighborItemProps & {
|
|
6
|
+
/** Button activity state */
|
|
7
|
+
active?: boolean;
|
|
8
|
+
/** Disabled button state */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Loading button state */
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
/** Tag for the left Addon */
|
|
13
|
+
addonLeft?: React.ElementType;
|
|
14
|
+
/** Tag for the right Addon */
|
|
15
|
+
addonRight?: React.ElementType;
|
|
16
|
+
/**
|
|
17
|
+
* Placement for hint
|
|
18
|
+
* @default top
|
|
19
|
+
*/
|
|
20
|
+
hintPlacement?: SimpleHintPopperProps['placement'];
|
|
21
|
+
/** Button size.
|
|
22
|
+
* @default `m`
|
|
23
|
+
*/
|
|
24
|
+
size?: 'l' | 'm';
|
|
25
|
+
/** Button usage.
|
|
26
|
+
* @default `primary`
|
|
27
|
+
*/
|
|
28
|
+
use?: 'primary' | 'secondary' | 'tertiary';
|
|
29
|
+
/** Button theme.
|
|
30
|
+
* @default undefined
|
|
31
|
+
*/
|
|
32
|
+
theme?: 'info' | 'success' | 'brand' | 'danger' | 'muted' | 'invert';
|
|
22
33
|
};
|
|
23
|
-
export type
|
|
34
|
+
export type ButtonTextProps = TextProps;
|
|
35
|
+
export type ButtonAddonProps = BoxProps;
|
|
36
|
+
export type ButtonContext = {
|
|
37
|
+
getTextProps: PropGetterFn;
|
|
38
|
+
getAddonProps: PropGetterFn;
|
|
39
|
+
};
|
|
40
|
+
export type ButtonChildren = {
|
|
24
41
|
Text: Intergalactic.Component<'span', ButtonTextProps>;
|
|
25
42
|
Addon: Intergalactic.Component<'span', ButtonAddonProps>;
|
|
26
43
|
};
|
|
27
|
-
export
|
|
44
|
+
export type ButtonComponent = Intergalactic.Component<'button', ButtonProps, ButtonContext> & ButtonChildren;
|
|
@@ -1,24 +1,19 @@
|
|
|
1
|
+
import type { BoxProps } from '@semcore/base-components';
|
|
1
2
|
import type { Intergalactic } from '@semcore/core';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
type Use = 'primary' | 'secondary';
|
|
12
|
-
export type ButtonLinkProps = AbstractButtonProps<ButtonLinkSize, Use, never>;
|
|
13
|
-
export type ButtonLinkTextProps = AbstractButtonTextProps<ButtonLinkSize>;
|
|
14
|
-
export type ButtonLinkAddonProps = AbstractButtonAddonProps<ButtonLinkSize>;
|
|
15
|
-
export type ButtonLinkContext = AbstractButtonContext;
|
|
16
|
-
export type ButtonLinkChildren = {
|
|
17
|
-
Text: Intergalactic.Component<'span', ButtonLinkTextProps>;
|
|
18
|
-
Addon: Intergalactic.Component<'span', ButtonLinkAddonProps>;
|
|
3
|
+
import type { LinkProps } from '@semcore/link';
|
|
4
|
+
import type { TextProps } from '@semcore/typography';
|
|
5
|
+
import type { ButtonContext } from '../Button/Button.type';
|
|
6
|
+
export type ButtonLinkProps = Intergalactic.InternalTypings.EfficientOmit<LinkProps, 'enableVisited'> & {
|
|
7
|
+
/**
|
|
8
|
+
* Button link type
|
|
9
|
+
* @default primary
|
|
10
|
+
*/
|
|
11
|
+
use?: 'primary' | 'secondary';
|
|
19
12
|
};
|
|
20
|
-
export type
|
|
13
|
+
export type ButtonLinkTextProps = TextProps;
|
|
14
|
+
export type ButtonLinkAddonProps = BoxProps;
|
|
15
|
+
export type ButtonLinkChildren = {
|
|
21
16
|
Text: Intergalactic.Component<'span', ButtonLinkTextProps>;
|
|
22
17
|
Addon: Intergalactic.Component<'span', ButtonLinkAddonProps>;
|
|
23
18
|
};
|
|
24
|
-
export
|
|
19
|
+
export type ButtonLinkComponent = Intergalactic.Component<'button', ButtonLinkProps, ButtonContext> & ButtonLinkChildren;
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { default } from './component/Button/Button';
|
|
1
|
+
export { default, MAP_USE_DEFAULT_THEME } from './component/Button/Button';
|
|
2
2
|
export * from './component/Button/Button.type';
|
|
3
3
|
export * from './component/ButtonLink/ButtonLink';
|
|
4
4
|
export * from './component/ButtonLink/ButtonLink.type';
|
|
5
|
-
export { MAP_USE_DEFAULT_THEME } from './component/AbstractButton/AbstractButton';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/button",
|
|
3
3
|
"description": "Semrush Button Component",
|
|
4
|
-
"version": "17.0.0-prerelease.
|
|
4
|
+
"version": "17.0.0-prerelease.31",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/spin": "^17.0.0-prerelease.
|
|
17
|
+
"@semcore/spin": "^17.0.0-prerelease.31",
|
|
18
|
+
"@semcore/typography": "^17.0.0-prerelease.31",
|
|
19
|
+
"@semcore/link": "^17.0.0-prerelease.31"
|
|
18
20
|
},
|
|
19
21
|
"peerDependencies": {
|
|
20
22
|
"@semcore/base-components": "^17.0.0 || ^17.0.0-0"
|
|
@@ -25,10 +27,10 @@
|
|
|
25
27
|
"directory": "semcore/button"
|
|
26
28
|
},
|
|
27
29
|
"devDependencies": {
|
|
28
|
-
"@semcore/core": "17.0.0-prerelease.
|
|
29
|
-
"@semcore/base-components": "17.0.0-prerelease.
|
|
30
|
+
"@semcore/core": "17.0.0-prerelease.31",
|
|
31
|
+
"@semcore/base-components": "17.0.0-prerelease.31",
|
|
30
32
|
"@semcore/testing-utils": "1.0.0",
|
|
31
|
-
"@semcore/icon": "16.7.2-prerelease.
|
|
33
|
+
"@semcore/icon": "16.7.2-prerelease.31"
|
|
32
34
|
},
|
|
33
35
|
"scripts": {
|
|
34
36
|
"build": "pnpm semcore-builder && pnpm vite build"
|