@semcore/button 5.44.0-prerelease.0 → 5.44.0-prerelease.4
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/lib/cjs/component/AbstractButton/AbstractButton.js +182 -0
- package/lib/cjs/component/AbstractButton/AbstractButton.js.map +1 -0
- package/lib/cjs/component/AbstractButton/AbstractButton.type.js +2 -0
- package/lib/cjs/component/AbstractButton/AbstractButton.type.js.map +1 -0
- package/lib/cjs/component/{Button → AbstractButton}/SpinButton.js +4 -3
- package/lib/cjs/component/AbstractButton/SpinButton.js.map +1 -0
- package/lib/cjs/component/Button/Button.js +64 -166
- 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 +20 -12
- package/lib/cjs/component/ButtonLink/ButtonLink.js +68 -35
- 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 +151 -12
- package/lib/cjs/index.js +4 -3
- package/lib/cjs/index.js.map +1 -1
- package/lib/es6/component/AbstractButton/AbstractButton.js +175 -0
- package/lib/es6/component/AbstractButton/AbstractButton.js.map +1 -0
- package/lib/es6/component/AbstractButton/AbstractButton.type.js +2 -0
- package/lib/es6/component/AbstractButton/AbstractButton.type.js.map +1 -0
- package/lib/es6/component/{Button → AbstractButton}/SpinButton.js +1 -1
- package/lib/es6/component/AbstractButton/SpinButton.js.map +1 -0
- package/lib/es6/component/Button/Button.js +57 -163
- 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 +20 -12
- package/lib/es6/component/ButtonLink/ButtonLink.js +65 -34
- 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 +151 -12
- package/lib/es6/index.js +2 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/esm/component/AbstractButton/AbstractButton.mjs +152 -0
- package/lib/esm/component/{Button → AbstractButton}/SpinButton.mjs +3 -2
- package/lib/esm/component/Button/Button.mjs +56 -142
- package/lib/esm/component/Button/button.shadow.css +20 -12
- package/lib/esm/component/ButtonLink/ButtonLink.mjs +61 -33
- package/lib/esm/component/ButtonLink/buttonLink.shadow.css +151 -12
- package/lib/esm/index.mjs +2 -3
- package/lib/types/component/AbstractButton/AbstractButton.d.ts +24 -0
- package/lib/types/component/AbstractButton/AbstractButton.type.d.ts +39 -0
- package/lib/types/component/{Button → AbstractButton}/SpinButton.d.ts +2 -2
- package/lib/types/component/Button/Button.d.ts +1 -28
- package/lib/types/component/Button/Button.type.d.ts +39 -40
- package/lib/types/component/ButtonLink/ButtonLink.d.ts +1 -1
- package/lib/types/component/ButtonLink/ButtonLink.type.d.ts +21 -15
- package/lib/types/index.d.ts +2 -1
- package/package.json +7 -7
- package/src/component/Button/button.shadow.css +80 -80
- package/src/component/ButtonLink/buttonLink.shadow.css +7 -7
- package/lib/cjs/component/Button/SpinButton.js.map +0 -1
- package/lib/es6/component/Button/SpinButton.js.map +0 -1
- package/lib/esm/component/Button/Button.type.mjs +0 -1
- package/lib/esm/component/ButtonLink/ButtonLink.type.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.type.js","names":[],"sources":["../../../../src/component/Button/Button.type.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Button.type.js","names":[],"sources":["../../../../src/component/Button/Button.type.ts"],"sourcesContent":["import { UnknownProperties, Intergalactic } from '@semcore/core';\n\nimport {\n AbstractButtonAddonProps,\n AbstractButtonContext,\n AbstractButtonTextProps,\n AbstractButtonProps,\n} from '../AbstractButton/AbstractButton.type';\n\n/**\n * Button size\n * @default m\n */\nexport type ButtonSize = 'l' | 'm';\n/**\n * Button type\n * @default secondary\n */\ntype Use = 'primary' | 'secondary' | 'tertiary';\n\n/**\n * @deprecated don't use it. use `danger` for incorrect or danger behavior and `brand` for the orange one.\n */\ntype DeprecatedTheme = 'warning';\n\n/** Button theme */\ntype Theme = 'info' | 'success' | 'brand' | 'danger' | 'muted' | 'invert';\n\n/** @deprecated */\nexport interface IButtonProps extends ButtonProps, UnknownProperties {}\nexport type ButtonProps = AbstractButtonProps<ButtonSize, Use, Theme | DeprecatedTheme>;\n\n/** @deprecated */\nexport interface IButtonTextProps extends ButtonTextProps, UnknownProperties {}\nexport type ButtonTextProps = AbstractButtonTextProps<ButtonSize>;\n\n/** @deprecated */\nexport interface IButtonAddonProps extends ButtonAddonProps, UnknownProperties {}\nexport type ButtonAddonProps = AbstractButtonAddonProps<ButtonSize>;\n\n/** @deprecated */\nexport interface IButtonContext extends ButtonContext, UnknownProperties {}\nexport type ButtonContext = AbstractButtonContext;\n\nexport type ButtonChildren = {\n Text: Intergalactic.Component<'span', ButtonTextProps>;\n Addon: Intergalactic.Component<'span', ButtonAddonProps>;\n};\n\nexport type ButtonComponent = Intergalactic.Component<'button', ButtonProps, ButtonContext> & {\n Text: Intergalactic.Component<'span', ButtonTextProps>;\n Addon: Intergalactic.Component<'span', ButtonAddonProps>;\n};\n"],"mappings":""}
|
|
@@ -12,6 +12,7 @@ SButton {
|
|
|
12
12
|
text-align: center;
|
|
13
13
|
vertical-align: middle;
|
|
14
14
|
border: 1px solid transparent;
|
|
15
|
+
outline: 0;
|
|
15
16
|
box-shadow: none;
|
|
16
17
|
cursor: pointer;
|
|
17
18
|
box-sizing: border-box;
|
|
@@ -29,11 +30,18 @@ SButton {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
&:active,
|
|
32
|
-
&:hover
|
|
33
|
+
&:hover,
|
|
34
|
+
&:focus {
|
|
35
|
+
outline: 0;
|
|
33
36
|
text-decoration: none;
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
39
|
|
|
40
|
+
SButton[keyboardFocused] {
|
|
41
|
+
box-shadow: var(--intergalactic-keyboard-focus, 0px 0px 0px 3px oklch(0.424 0.269 264.2 / 0.469));
|
|
42
|
+
z-index: 1;
|
|
43
|
+
}
|
|
44
|
+
|
|
37
45
|
SButton[disabled] {
|
|
38
46
|
opacity: var(--intergalactic-disabled-opacity, 0.4);
|
|
39
47
|
cursor: default;
|
|
@@ -176,19 +184,19 @@ SButton[theme='secondary-muted'] {
|
|
|
176
184
|
}
|
|
177
185
|
|
|
178
186
|
SButton[theme='secondary-info'] {
|
|
179
|
-
background-color: var(--intergalactic-control-secondary-info, oklch(0.
|
|
180
|
-
color: var(--intergalactic-text-link, oklch(0.53 0.
|
|
187
|
+
background-color: var(--intergalactic-control-secondary-info, oklch(0.527 0.264 262.9 / 0.039));
|
|
188
|
+
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
181
189
|
border-color: var(--intergalactic-control-primary-info, oklch(0.23 0.01 140));
|
|
182
190
|
|
|
183
191
|
&:hover {
|
|
184
|
-
color: var(--intergalactic-text-link, oklch(0.53 0.
|
|
185
|
-
background-color: var(--intergalactic-control-secondary-info-hover, oklch(0.
|
|
192
|
+
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
193
|
+
background-color: var(--intergalactic-control-secondary-info-hover, oklch(0.525 0.265 263 / 0.077));
|
|
186
194
|
}
|
|
187
195
|
|
|
188
196
|
&:active,
|
|
189
197
|
&[active] {
|
|
190
|
-
color: var(--intergalactic-text-link, oklch(0.53 0.
|
|
191
|
-
background-color: var(--intergalactic-control-secondary-info-active, oklch(0.
|
|
198
|
+
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
199
|
+
background-color: var(--intergalactic-control-secondary-info-active, oklch(0.524 0.266 263.1 / 0.116));
|
|
192
200
|
}
|
|
193
201
|
}
|
|
194
202
|
|
|
@@ -211,18 +219,18 @@ SButton[theme='secondary-invert'] {
|
|
|
211
219
|
}
|
|
212
220
|
|
|
213
221
|
SButton[theme='tertiary-info'] {
|
|
214
|
-
color: var(--intergalactic-text-link, oklch(0.53 0.
|
|
222
|
+
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
215
223
|
background-color: var(--intergalactic-control-tertiary-info, transparent);
|
|
216
224
|
|
|
217
225
|
&:hover {
|
|
218
|
-
color: var(--intergalactic-text-link, oklch(0.53 0.
|
|
219
|
-
background-color: var(--intergalactic-control-tertiary-info-hover, oklch(0.
|
|
226
|
+
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
227
|
+
background-color: var(--intergalactic-control-tertiary-info-hover, oklch(0.525 0.265 263 / 0.077));
|
|
220
228
|
}
|
|
221
229
|
|
|
222
230
|
&:active,
|
|
223
231
|
&[active] {
|
|
224
|
-
color: var(--intergalactic-text-link, oklch(0.53 0.
|
|
225
|
-
background-color: var(--intergalactic-control-tertiary-info-active, oklch(0.
|
|
232
|
+
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
233
|
+
background-color: var(--intergalactic-control-tertiary-info-active, oklch(0.524 0.266 263.1 / 0.116));
|
|
226
234
|
}
|
|
227
235
|
}
|
|
228
236
|
|
|
@@ -1,57 +1,88 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _callSuper from "@babel/runtime/helpers/callSuper";
|
|
5
4
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
5
|
+
import _createSuper from "@babel/runtime/helpers/createSuper";
|
|
6
6
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
7
|
-
import { sstyled as _sstyled } from "@semcore/core";
|
|
7
|
+
import { sstyled as _sstyled } from "@semcore/utils/lib/core/index";
|
|
8
|
+
import { assignProps as _assignProps2 } from "@semcore/core";
|
|
8
9
|
import { assignProps as _assignProps } from "@semcore/core";
|
|
9
|
-
import { createComponent, sstyled, Root, Component } from '@semcore/core';
|
|
10
|
-
import Link from '@semcore/link';
|
|
11
10
|
import React from 'react';
|
|
11
|
+
import createComponent, { sstyled, Root } from '@semcore/core';
|
|
12
12
|
/*!__reshadow-styles__:"./buttonLink.shadow.css"*/
|
|
13
|
-
var style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
13
|
+
var style = ( /*__reshadow_css_start__*/_sstyled.insert( /*__inner_css_start__*/".___SButton_ewssl_gg_{display:inline-flex;font-family:inherit;font-size:var(--intergalactic-fs-200, 14px);color:var(--intergalactic-text-link, rgb(35, 95, 226));line-height:normal;position:relative;cursor:pointer;-webkit-text-decoration:none;text-decoration:none;border:0;padding:0;margin:0;box-shadow:none;-webkit-tap-highlight-color:transparent;outline:0;background:0 0;transition:color .15s ease-in-out}.___SButton_ewssl_gg_:active,.___SButton_ewssl_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SButton_ewssl_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___SButton_ewssl_gg_::-moz-focus-inner{border:0;padding:0}.___SButton_ewssl_gg_.__active_ewssl_gg_,.___SButton_ewssl_gg_:active{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}@media (hover:hover){.___SButton_ewssl_gg_:hover{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}}.___SButton_ewssl_gg_.__active_ewssl_gg_ .___SText_ewssl_gg_,.___SButton_ewssl_gg_:active .___SText_ewssl_gg_{border-color:currentColor}@media (hover:hover){.___SButton_ewssl_gg_:hover .___SText_ewssl_gg_{border-color:currentColor}}.___SButton_ewssl_gg_.__enableVisited_ewssl_gg_:visited{color:var(--intergalactic-text-link-visited, rgb(128, 41, 236))}@media (hover:hover){.___SButton_ewssl_gg_.__enableVisited_ewssl_gg_:visited:hover{color:var(--intergalactic-text-link-visited, rgb(128, 41, 236))}}.___SButton_ewssl_gg_ .___SText_ewssl_gg_{border-bottom-width:1px;border-bottom-style:solid;border-color:transparent;transition:border-bottom-color .15s ease-in-out}.___SButton_ewssl_gg_.__keyboardFocused_ewssl_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 33, 220, 0.469));outline-style:solid;outline-width:3px}@supports (color:color(display-p3 0 0 0)){.___SButton_ewssl_gg_.__keyboardFocused_ewssl_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, rgba(0, 33, 220, 0.469))}@media (color-gamut:p3){.___SButton_ewssl_gg_.__keyboardFocused_ewssl_gg_{outline-color:var(--intergalactic-keyboard-focus-outline, color(display-p3 0.03256 0.12227 0.83249 / 0.469))}}}.___SButton_ewssl_gg_.__disabled_ewssl_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4);cursor:default;pointer-events:none}.___SButton_ewssl_gg_._use_secondary_ewssl_gg_{color:var(--intergalactic-text-hint, rgba(0, 3, 0, 0.583))}@supports (color:color(display-p3 0 0 0)){.___SButton_ewssl_gg_._use_secondary_ewssl_gg_{color:var(--intergalactic-text-hint, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___SButton_ewssl_gg_._use_secondary_ewssl_gg_{color:var(--intergalactic-text-hint, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}.___SButton_ewssl_gg_._use_secondary_ewssl_gg_.__active_ewssl_gg_,.___SButton_ewssl_gg_._use_secondary_ewssl_gg_:active{color:var(--intergalactic-text-hint-hover-active, rgba(0, 3, 0, 0.605))}@media (hover:hover){.___SButton_ewssl_gg_._use_secondary_ewssl_gg_:hover{color:var(--intergalactic-text-hint-hover-active, rgba(0, 3, 0, 0.605))}}.___SButton_ewssl_gg_._use_secondary_ewssl_gg_ .___SText_ewssl_gg_{border-bottom-width:1px;border-bottom-style:dashed;border-color:currentColor}.___SAddon_ewssl_gg_,.___SInner_ewssl_gg_{display:inline-flex;justify-content:center;align-items:center}.___SInner_ewssl_gg_{height:100%;width:100%}.___SAddon_ewssl_gg_{vertical-align:middle;pointer-events:none}.___SButton_ewssl_gg_ .___SAddon_ewssl_gg_:not(:only-child):first-child{margin-right:var(--intergalactic-spacing-1x, 4px)}.___SButton_ewssl_gg_ .___SAddon_ewssl_gg_:not(:only-child):last-child{margin-left:var(--intergalactic-spacing-1x, 4px)}.___SButton_ewssl_gg_.__text-color_ewssl_gg_{color:var(--text-color_ewssl)}.___SButton_ewssl_gg_.__text-color_ewssl_gg_.__active_ewssl_gg_,.___SButton_ewssl_gg_.__text-color_ewssl_gg_:active{color:var(--text-color_ewssl);filter:brightness(.8)}@media (hover:hover){.___SButton_ewssl_gg_.__text-color_ewssl_gg_:hover{color:var(--text-color_ewssl);filter:brightness(.8)}}.___SButton_ewssl_gg_._size_100_ewssl_gg_{font-size:var(--intergalactic-fs-100, 12px);line-height:var(--intergalactic-lh-100, 133%)}.___SButton_ewssl_gg_._size_200_ewssl_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%)}.___SButton_ewssl_gg_._size_300_ewssl_gg_{font-size:var(--intergalactic-fs-300, 16px);line-height:var(--intergalactic-lh-300, 150%)}.___SButton_ewssl_gg_._size_400_ewssl_gg_{font-size:var(--intergalactic-fs-400, 20px);line-height:var(--intergalactic-lh-400, 120%)}.___SButton_ewssl_gg_._size_500_ewssl_gg_{font-size:var(--intergalactic-fs-500, 24px);line-height:var(--intergalactic-lh-500, 117%)}.___SButton_ewssl_gg_._size_600_ewssl_gg_{font-size:var(--intergalactic-fs-600, 32px);line-height:var(--intergalactic-lh-600, 125%)}.___SButton_ewssl_gg_._size_700_ewssl_gg_{font-size:var(--intergalactic-fs-700, 36px);line-height:var(--intergalactic-lh-700, 110%)}.___SButton_ewssl_gg_._size_800_ewssl_gg_{font-size:var(--intergalactic-fs-800, 48px);line-height:var(--intergalactic-lh-800, 117%)}@media (prefers-reduced-motion){.___SButton_ewssl_gg_,.___SText_ewssl_gg_{transition:none}}", /*__inner_css_end__*/"ewssl_gg_"),
|
|
14
14
|
/*__reshadow_css_end__*/
|
|
15
15
|
{
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
16
|
+
"__SButton": "___SButton_ewssl_gg_",
|
|
17
|
+
"_keyboardFocused": "__keyboardFocused_ewssl_gg_",
|
|
18
|
+
"_disabled": "__disabled_ewssl_gg_",
|
|
19
|
+
"__SInner": "___SInner_ewssl_gg_",
|
|
20
|
+
"__SAddon": "___SAddon_ewssl_gg_",
|
|
21
|
+
"_size_100": "_size_100_ewssl_gg_",
|
|
22
|
+
"_size_200": "_size_200_ewssl_gg_",
|
|
23
|
+
"_size_300": "_size_300_ewssl_gg_",
|
|
24
|
+
"_size_400": "_size_400_ewssl_gg_",
|
|
25
|
+
"_size_500": "_size_500_ewssl_gg_",
|
|
26
|
+
"_size_600": "_size_600_ewssl_gg_",
|
|
27
|
+
"_size_700": "_size_700_ewssl_gg_",
|
|
28
|
+
"_size_800": "_size_800_ewssl_gg_",
|
|
29
|
+
"__SText": "___SText_ewssl_gg_",
|
|
30
|
+
"_active": "__active_ewssl_gg_",
|
|
31
|
+
"_enableVisited": "__enableVisited_ewssl_gg_",
|
|
32
|
+
"_use_secondary": "_use_secondary_ewssl_gg_",
|
|
33
|
+
"_text-color": "__text-color_ewssl_gg_",
|
|
34
|
+
"--text-color": "--text-color_ewssl"
|
|
22
35
|
});
|
|
23
|
-
|
|
36
|
+
import keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
37
|
+
import { Box } from '@semcore/flex-box';
|
|
38
|
+
import { AbstractButton } from '../AbstractButton/AbstractButton';
|
|
39
|
+
import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
|
|
40
|
+
var enhance = {
|
|
41
|
+
keyboardFocused: keyboardFocusEnhance(),
|
|
42
|
+
resolveColor: resolveColorEnhance()
|
|
43
|
+
};
|
|
44
|
+
var RootButtonLink = /*#__PURE__*/function (_AbstractButton) {
|
|
45
|
+
_inherits(RootButtonLink, _AbstractButton);
|
|
46
|
+
var _super = _createSuper(RootButtonLink);
|
|
24
47
|
function RootButtonLink() {
|
|
25
48
|
_classCallCheck(this, RootButtonLink);
|
|
26
|
-
return
|
|
49
|
+
return _super.apply(this, arguments);
|
|
27
50
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
var disabled = this.asProps.disabled;
|
|
36
|
-
return _ref2 = sstyled(style), /*#__PURE__*/React.createElement(SButtonLink, _ref2.cn("SButtonLink", _objectSpread({}, _assignProps({
|
|
37
|
-
"tag": 'button',
|
|
38
|
-
"type": 'button',
|
|
39
|
-
"use:disabled": disabled,
|
|
40
|
-
"use:tabIndex": 0
|
|
41
|
-
}, _ref))));
|
|
51
|
+
_createClass(RootButtonLink, [{
|
|
52
|
+
key: "getTextColor",
|
|
53
|
+
value: function getTextColor() {
|
|
54
|
+
var _ref5 = this.asProps,
|
|
55
|
+
color = _ref5.color,
|
|
56
|
+
resolveColor = _ref5.resolveColor;
|
|
57
|
+
return resolveColor(color);
|
|
42
58
|
}
|
|
43
59
|
}]);
|
|
44
|
-
|
|
60
|
+
return RootButtonLink;
|
|
61
|
+
}(AbstractButton);
|
|
45
62
|
_defineProperty(RootButtonLink, "displayName", 'ButtonLink');
|
|
63
|
+
_defineProperty(RootButtonLink, "enhance", Object.values(enhance));
|
|
46
64
|
_defineProperty(RootButtonLink, "style", style);
|
|
47
65
|
_defineProperty(RootButtonLink, "defaultProps", {
|
|
48
|
-
use: 'primary'
|
|
49
|
-
size: 200
|
|
66
|
+
use: 'primary'
|
|
50
67
|
});
|
|
68
|
+
function Text(props) {
|
|
69
|
+
var _ref = arguments[0],
|
|
70
|
+
_ref3;
|
|
71
|
+
var SText = Box;
|
|
72
|
+
return _ref3 = sstyled(props.styles), /*#__PURE__*/React.createElement(SText, _ref3.cn("SText", _objectSpread({}, _assignProps({
|
|
73
|
+
"tag": 'span'
|
|
74
|
+
}, _ref))));
|
|
75
|
+
}
|
|
76
|
+
function Addon(props) {
|
|
77
|
+
var _ref2 = arguments[0],
|
|
78
|
+
_ref4;
|
|
79
|
+
var SAddon = Box;
|
|
80
|
+
return _ref4 = sstyled(props.styles), /*#__PURE__*/React.createElement(SAddon, _ref4.cn("SAddon", _objectSpread({}, _assignProps2({
|
|
81
|
+
"tag": 'span'
|
|
82
|
+
}, _ref2))));
|
|
83
|
+
}
|
|
51
84
|
export var ButtonLink = createComponent(RootButtonLink, {
|
|
52
|
-
Text:
|
|
53
|
-
Addon:
|
|
54
|
-
}, {
|
|
55
|
-
parent: Link
|
|
85
|
+
Text: Text,
|
|
86
|
+
Addon: Addon
|
|
56
87
|
});
|
|
57
88
|
//# sourceMappingURL=ButtonLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonLink.js","names":["createComponent","sstyled","Root","
|
|
1
|
+
{"version":3,"file":"ButtonLink.js","names":["React","createComponent","sstyled","Root","style","_sstyled","insert","keyboardFocusEnhance","Box","AbstractButton","resolveColorEnhance","enhance","keyboardFocused","resolveColor","RootButtonLink","_AbstractButton","_inherits","_super","_createSuper","_classCallCheck","apply","arguments","_createClass","key","value","getTextColor","_ref5","asProps","color","_defineProperty","Object","values","use","Text","props","_ref","arguments[0]","_ref3","SText","styles","createElement","cn","_objectSpread","_assignProps","Addon","_ref2","_ref4","SAddon","_assignProps2","ButtonLink"],"sources":["../../../../src/component/ButtonLink/ButtonLink.tsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { sstyled, Root } from '@semcore/core';\nimport style from './buttonLink.shadow.css';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport { Box } from '@semcore/flex-box';\nimport { AbstractButton } from '../AbstractButton/AbstractButton';\nimport resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';\nimport { ButtonLinkAddonProps, ButtonLinkComponent, ButtonLinkTextProps } from './ButtonLink.type';\n\nconst enhance = {\n keyboardFocused: keyboardFocusEnhance(),\n resolveColor: resolveColorEnhance(),\n};\n\nclass RootButtonLink extends AbstractButton {\n static displayName = 'ButtonLink';\n static enhance = Object.values(enhance);\n static style = style;\n static defaultProps = {\n use: 'primary',\n };\n\n protected getTextColor(): string | undefined {\n const { color, resolveColor } = this.asProps as any;\n return resolveColor(color);\n }\n}\n\nfunction Text(props: ButtonLinkTextProps) {\n const SText = Root;\n return sstyled(props.styles)(<SText render={Box} tag='span' />);\n}\n\nfunction Addon(props: ButtonLinkAddonProps) {\n const SAddon = Root;\n return sstyled(props.styles)(<SAddon render={Box} tag='span' />);\n}\n\nexport const ButtonLink = createComponent(RootButtonLink, {\n Text,\n Addon,\n}) as ButtonLinkComponent;\n"],"mappings":";;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAE/D,OAAOC,oBAAoB,MAAM,kDAAkD;AACnF,SAASC,GAAG,QAAQ,mBAAmB;AACvC,SAASC,cAAc,QAAQ,kCAAkC;AACjE,OAAOC,mBAAmB,MAAM,iDAAiD;AAGjF,IAAMC,OAAO,GAAG;EACdC,eAAe,EAAEL,oBAAoB,EAAE;EACvCM,YAAY,EAAEH,mBAAmB;AACnC,CAAC;AAAC,IAEII,cAAc,0BAAAC,eAAA;EAAAC,SAAA,CAAAF,cAAA,EAAAC,eAAA;EAAA,IAAAE,MAAA,GAAAC,YAAA,CAAAJ,cAAA;EAAA,SAAAA,eAAA;IAAAK,eAAA,OAAAL,cAAA;IAAA,OAAAG,MAAA,CAAAG,KAAA,OAAAC,SAAA;EAAA;EAAAC,YAAA,CAAAR,cAAA;IAAAS,GAAA;IAAAC,KAAA,EAQlB,SAAAC,aAAA,EAA6C;MAC3C,IAAAC,KAAA,GAAgC,IAAI,CAACC,OAAO;QAApCC,KAAK,GAAAF,KAAA,CAALE,KAAK;QAAEf,YAAY,GAAAa,KAAA,CAAZb,YAAY;MAC3B,OAAOA,YAAY,CAACe,KAAK,CAAC;IAC5B;EAAC;EAAA,OAAAd,cAAA;AAAA,EAX0BL,cAAc;AAAAoB,eAAA,CAArCf,cAAc,iBACG,YAAY;AAAAe,eAAA,CAD7Bf,cAAc,aAEDgB,MAAM,CAACC,MAAM,CAACpB,OAAO,CAAC;AAAAkB,eAAA,CAFnCf,cAAc,WAGHV,KAAK;AAAAyB,eAAA,CAHhBf,cAAc,kBAII;EACpBkB,GAAG,EAAE;AACP,CAAC;AAQH,SAASC,IAAIA,CAACC,KAA0B,EAAE;EAAA,IAAAC,IAAA,GAAAC,YAAA;IAAAC,KAAA;EACxC,IAAMC,KAAK,GACiC9B,GAAG;EAA/C,OAAA6B,KAAA,GAAOnC,OAAO,CAACgC,KAAK,CAACK,MAAM,CAAC,eAACvC,KAAA,CAAAwC,aAAA,CAACF,KAAK,EAAAD,KAAA,CAAAI,EAAA,UAAAC,aAAA,KAAAC,YAAA;IAAA,OAAkB;EAAM,GAAAR,IAAA,IAAG;AAChE;AAEA,SAASS,KAAKA,CAACV,KAA2B,EAAE;EAAA,IAAAW,KAAA,GAAAT,YAAA;IAAAU,KAAA;EAC1C,IAAMC,MAAM,GACiCvC,GAAG;EAAhD,OAAAsC,KAAA,GAAO5C,OAAO,CAACgC,KAAK,CAACK,MAAM,CAAC,eAACvC,KAAA,CAAAwC,aAAA,CAACO,MAAM,EAAAD,KAAA,CAAAL,EAAA,WAAAC,aAAA,KAAAM,aAAA;IAAA,OAAkB;EAAM,GAAAH,KAAA,IAAG;AACjE;AAEA,OAAO,IAAMI,UAAU,GAAGhD,eAAe,CAACa,cAAc,EAAE;EACxDmB,IAAI,EAAJA,IAAI;EACJW,KAAK,EAALA;AACF,CAAC,CAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ButtonLink.type.js","names":[],"sources":["../../../../src/component/ButtonLink/ButtonLink.type.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"ButtonLink.type.js","names":[],"sources":["../../../../src/component/ButtonLink/ButtonLink.type.ts"],"sourcesContent":["import { UnknownProperties, Intergalactic } from '@semcore/core';\n\nimport {\n AbstractButtonAddonProps,\n AbstractButtonContext,\n AbstractButtonTextProps,\n AbstractButtonProps,\n} from '../AbstractButton/AbstractButton.type';\n\n/**\n * Button link size\n * @default m\n */\nexport type ButtonLinkSize = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800;\n/**\n * Button link type\n * @default primary\n */\ntype Use = 'primary' | 'secondary';\n\nexport type ButtonLinkProps = AbstractButtonProps<ButtonLinkSize, Use, never>;\n\nexport type ButtonLinkTextProps = AbstractButtonTextProps<ButtonLinkSize>;\n\nexport type ButtonLinkAddonProps = AbstractButtonAddonProps<ButtonLinkSize>;\n\nexport type ButtonLinkContext = AbstractButtonContext;\n\nexport type ButtonLinkChildren = {\n Text: Intergalactic.Component<'span', ButtonLinkTextProps>;\n Addon: Intergalactic.Component<'span', ButtonLinkAddonProps>;\n};\n\nexport type ButtonLinkComponent = Intergalactic.Component<\n 'button',\n ButtonLinkProps,\n ButtonLinkContext\n> & {\n Text: Intergalactic.Component<'span', ButtonLinkTextProps>;\n Addon: Intergalactic.Component<'span', ButtonLinkAddonProps>;\n};\n"],"mappings":""}
|
|
@@ -1,19 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
SButton {
|
|
2
|
+
display: inline-flex;
|
|
3
3
|
font-family: inherit;
|
|
4
|
-
|
|
4
|
+
font-size: var(--intergalactic-fs-200, 14px);
|
|
5
|
+
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
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
|
+
outline: 0;
|
|
16
|
+
background: none;
|
|
17
|
+
transition: color 0.15s ease-in-out;
|
|
5
18
|
|
|
6
|
-
|
|
7
|
-
|
|
19
|
+
&:active,
|
|
20
|
+
&:hover,
|
|
21
|
+
&:focus {
|
|
22
|
+
outline: 0;
|
|
23
|
+
text-decoration: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&::-moz-focus-inner {
|
|
27
|
+
border: none;
|
|
28
|
+
padding: 0;
|
|
29
|
+
}
|
|
8
30
|
|
|
9
31
|
&[active],
|
|
10
|
-
&:
|
|
11
|
-
&:
|
|
12
|
-
color: var(--intergalactic-text-link-hover-active, oklch(0.51 0.
|
|
32
|
+
&:hover,
|
|
33
|
+
&:active {
|
|
34
|
+
color: var(--intergalactic-text-link-hover-active, oklch(0.51 0.202 263));
|
|
35
|
+
|
|
36
|
+
& SText {
|
|
37
|
+
border-color: currentColor;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&[enableVisited]:visited,
|
|
42
|
+
&[enableVisited]:visited:hover {
|
|
43
|
+
color: var(--intergalactic-text-link-visited, oklch(0.53 0.26 296));
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
SText {
|
|
47
|
+
border-bottom-width: 1px;
|
|
48
|
+
border-bottom-style: solid;
|
|
49
|
+
border-color: transparent;
|
|
50
|
+
transition: border-bottom-color 0.15s ease-in-out;
|
|
13
51
|
}
|
|
14
52
|
}
|
|
15
53
|
|
|
16
|
-
|
|
54
|
+
SButton[keyboardFocused] {
|
|
55
|
+
outline-color: var(--intergalactic-keyboard-focus-outline, oklch(0.424 0.269 264.2 / 0.469));
|
|
56
|
+
outline-style: solid;
|
|
57
|
+
outline-width: 3px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
SButton[disabled] {
|
|
61
|
+
opacity: var(--intergalactic-disabled-opacity, 0.4);
|
|
62
|
+
cursor: default;
|
|
63
|
+
/* Disable link interactions */
|
|
64
|
+
pointer-events: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
SButton[use='secondary'] {
|
|
17
68
|
color: var(--intergalactic-text-hint, oklch(0.088 0.026 147.7 / 0.583));
|
|
18
69
|
|
|
19
70
|
&[active],
|
|
@@ -21,9 +72,97 @@ SButtonLink[use='secondary']:not([color]) {
|
|
|
21
72
|
&:hover {
|
|
22
73
|
color: var(--intergalactic-text-hint-hover-active, oklch(0.086 0.026 145.8 / 0.605));
|
|
23
74
|
}
|
|
75
|
+
|
|
76
|
+
SText {
|
|
77
|
+
border-bottom-width: 1px;
|
|
78
|
+
border-bottom-style: dashed;
|
|
79
|
+
border-color: currentColor;
|
|
80
|
+
}
|
|
24
81
|
}
|
|
25
82
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
83
|
+
SInner {
|
|
84
|
+
display: inline-flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
height: 100%;
|
|
88
|
+
width: 100%;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
SAddon {
|
|
92
|
+
display: inline-flex;
|
|
93
|
+
justify-content: center;
|
|
94
|
+
align-items: center;
|
|
95
|
+
vertical-align: middle;
|
|
96
|
+
pointer-events: none;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
SButton SAddon {
|
|
100
|
+
&:not(:only-child):first-child {
|
|
101
|
+
margin-right: var(--intergalactic-spacing-1x, 4px);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&:not(:only-child):last-child {
|
|
105
|
+
margin-left: var(--intergalactic-spacing-1x, 4px);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
SButton[text-color] {
|
|
110
|
+
color: var(--text-color);
|
|
111
|
+
|
|
112
|
+
&[active],
|
|
113
|
+
&:hover,
|
|
114
|
+
&:active {
|
|
115
|
+
color: var(--text-color);
|
|
116
|
+
filter: brightness(0.8);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
SButton[size='100'] {
|
|
121
|
+
font-size: var(--intergalactic-fs-100, 12px);
|
|
122
|
+
line-height: var(--intergalactic-lh-100, 133%);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
SButton[size='200'] {
|
|
126
|
+
font-size: var(--intergalactic-fs-200, 14px);
|
|
127
|
+
line-height: var(--intergalactic-lh-200, 142%);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
SButton[size='300'] {
|
|
131
|
+
font-size: var(--intergalactic-fs-300, 16px);
|
|
132
|
+
line-height: var(--intergalactic-lh-300, 150%);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
SButton[size='400'] {
|
|
136
|
+
font-size: var(--intergalactic-fs-400, 20px);
|
|
137
|
+
line-height: var(--intergalactic-lh-400, 120%);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
SButton[size='500'] {
|
|
141
|
+
font-size: var(--intergalactic-fs-500, 24px);
|
|
142
|
+
line-height: var(--intergalactic-lh-500, 117%);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
SButton[size='600'] {
|
|
146
|
+
font-size: var(--intergalactic-fs-600, 32px);
|
|
147
|
+
line-height: var(--intergalactic-lh-600, 125%);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
SButton[size='700'] {
|
|
151
|
+
font-size: var(--intergalactic-fs-700, 36px);
|
|
152
|
+
line-height: var(--intergalactic-lh-700, 110%);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
SButton[size='800'] {
|
|
156
|
+
font-size: var(--intergalactic-fs-800, 48px);
|
|
157
|
+
line-height: var(--intergalactic-lh-800, 117%);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@media (prefers-reduced-motion) {
|
|
161
|
+
SButton {
|
|
162
|
+
transition: none;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
SText {
|
|
166
|
+
transition: none;
|
|
167
|
+
}
|
|
29
168
|
}
|
package/lib/es6/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } 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';
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","MAP_USE_DEFAULT_THEME"],"sources":["../../src/index.ts"],"sourcesContent":["export { default
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","MAP_USE_DEFAULT_THEME"],"sources":["../../src/index.ts"],"sourcesContent":["export { default } from './component/Button/Button';\nexport * from './component/Button/Button.type';\nexport * from './component/ButtonLink/ButtonLink';\nexport * from './component/ButtonLink/ButtonLink.type';\nexport { MAP_USE_DEFAULT_THEME } from './component/AbstractButton/AbstractButton';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,2BAA2B;AACnD,cAAc,gCAAgC;AAC9C,cAAc,mCAAmC;AACjD,cAAc,wCAAwC;AACtD,SAASC,qBAAqB,QAAQ,2CAA2C"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
+
import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
|
+
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import { sstyled, assignProps, CORE_INSTANCE, Component } from "@semcore/core";
|
|
9
|
+
import React from "react";
|
|
10
|
+
import { Box } from "@semcore/flex-box";
|
|
11
|
+
import { Hint } from "@semcore/tooltip";
|
|
12
|
+
import NeighborLocation from "@semcore/neighbor-location";
|
|
13
|
+
import addonTextChildren from "@semcore/utils/lib/addonTextChildren";
|
|
14
|
+
import logger from "@semcore/utils/lib/logger";
|
|
15
|
+
import SpinButton from "./SpinButton.mjs";
|
|
16
|
+
import hasLabels from "@semcore/utils/lib/hasLabels";
|
|
17
|
+
var MAP_USE_DEFAULT_THEME = {
|
|
18
|
+
primary: "info",
|
|
19
|
+
secondary: "muted",
|
|
20
|
+
tertiary: "info"
|
|
21
|
+
};
|
|
22
|
+
var AbstractButton = /* @__PURE__ */ function(_Component) {
|
|
23
|
+
_inherits(AbstractButton2, _Component);
|
|
24
|
+
var _super = _createSuper(AbstractButton2);
|
|
25
|
+
function AbstractButton2() {
|
|
26
|
+
var _this;
|
|
27
|
+
_classCallCheck(this, AbstractButton2);
|
|
28
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
29
|
+
args[_key] = arguments[_key];
|
|
30
|
+
}
|
|
31
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
32
|
+
_defineProperty(_assertThisInitialized(_this), "containerRef", /* @__PURE__ */ React.createRef());
|
|
33
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
34
|
+
ariaLabelledByContent: null
|
|
35
|
+
});
|
|
36
|
+
return _this;
|
|
37
|
+
}
|
|
38
|
+
_createClass(AbstractButton2, [{
|
|
39
|
+
key: "getTextProps",
|
|
40
|
+
value: function getTextProps() {
|
|
41
|
+
var size = this.asProps.size;
|
|
42
|
+
return {
|
|
43
|
+
size
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}, {
|
|
47
|
+
key: "getAddonProps",
|
|
48
|
+
value: function getAddonProps() {
|
|
49
|
+
var size = this.asProps.size;
|
|
50
|
+
return {
|
|
51
|
+
size
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}, {
|
|
55
|
+
key: "componentDidMount",
|
|
56
|
+
value: function componentDidMount() {
|
|
57
|
+
var _this2 = this;
|
|
58
|
+
if (process.env.NODE_ENV !== "production") {
|
|
59
|
+
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"] || AbstractButton2.displayName);
|
|
60
|
+
logger.warn(this.asProps.theme === "warning", "Warning theme is deprecated and will be removed in the next major release.", this.asProps["data-ui-name"] || AbstractButton2.displayName);
|
|
61
|
+
}
|
|
62
|
+
var ariaLabelledby = this.asProps["aria-labelledby"];
|
|
63
|
+
if (ariaLabelledby) {
|
|
64
|
+
setTimeout(function() {
|
|
65
|
+
var _document$getElementB, _document$getElementB2;
|
|
66
|
+
_this2.setState({
|
|
67
|
+
ariaLabelledByContent: (_document$getElementB = (_document$getElementB2 = document.getElementById(ariaLabelledby)) === null || _document$getElementB2 === void 0 ? void 0 : _document$getElementB2.textContent) !== null && _document$getElementB !== void 0 ? _document$getElementB : ""
|
|
68
|
+
});
|
|
69
|
+
}, 0);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, {
|
|
73
|
+
key: "renderButton",
|
|
74
|
+
value: function renderButton(_ref6) {
|
|
75
|
+
var _ref = this.asProps, _ref3;
|
|
76
|
+
var buttonProps = _ref6.buttonProps, children = _ref6.children;
|
|
77
|
+
var styles = this.asProps.styles;
|
|
78
|
+
var SButton = Box;
|
|
79
|
+
return _ref3 = sstyled(styles), /* @__PURE__ */ React.createElement(SButton, _ref3.cn("SButton", _objectSpread({}, assignProps(_objectSpread({}, buttonProps), _ref))), children);
|
|
80
|
+
}
|
|
81
|
+
}, {
|
|
82
|
+
key: "renderButtonWithHint",
|
|
83
|
+
value: function renderButtonWithHint(_ref7) {
|
|
84
|
+
var _ref2 = this.asProps, _ref4;
|
|
85
|
+
var buttonProps = _ref7.buttonProps, children = _ref7.children, hintProps = _ref7.hintProps;
|
|
86
|
+
var styles = this.asProps.styles;
|
|
87
|
+
var SButton = Hint;
|
|
88
|
+
return _ref4 = sstyled(styles), /* @__PURE__ */ React.createElement(SButton, _ref4.cn("SButton", _objectSpread({}, assignProps(_objectSpread(_objectSpread({}, buttonProps), hintProps), _ref2))), children);
|
|
89
|
+
}
|
|
90
|
+
}, {
|
|
91
|
+
key: "render",
|
|
92
|
+
value: function render() {
|
|
93
|
+
var _ref8, _ref9, _this3 = this;
|
|
94
|
+
var _this$asProps = this.asProps, styles = _this$asProps.styles, use = _this$asProps.use, _this$asProps$theme = _this$asProps.theme, theme = _this$asProps$theme === void 0 ? typeof use === "string" && MAP_USE_DEFAULT_THEME[use] : _this$asProps$theme, loading = _this$asProps.loading, _this$asProps$disable = _this$asProps.disabled, disabled = _this$asProps$disable === void 0 ? loading : _this$asProps$disable, size = _this$asProps.size, neighborLocation = _this$asProps.neighborLocation, hasChildren = _this$asProps.children, title = _this$asProps.title, ariaLabel = _this$asProps["aria-label"], Children = _this$asProps.Children, AddonLeft = _this$asProps.addonLeft, AddonRight = _this$asProps.addonRight, hintPlacement = _this$asProps.hintPlacement;
|
|
95
|
+
var Button = this[CORE_INSTANCE];
|
|
96
|
+
var useTheme = use && theme ? "".concat(use, "-").concat(theme) : false;
|
|
97
|
+
var SInner = Box;
|
|
98
|
+
var SSpin = Box;
|
|
99
|
+
var buttonAriaLabel = (_ref8 = (_ref9 = title !== null && title !== void 0 ? title : ariaLabel) !== null && _ref9 !== void 0 ? _ref9 : this.state.ariaLabelledByContent) !== null && _ref8 !== void 0 ? _ref8 : "";
|
|
100
|
+
var buttonProps = {
|
|
101
|
+
type: "button",
|
|
102
|
+
tag: "button",
|
|
103
|
+
disabled,
|
|
104
|
+
"use:theme": useTheme,
|
|
105
|
+
ref: this.containerRef,
|
|
106
|
+
"text-color": this.getTextColor(),
|
|
107
|
+
"aria-busy": loading,
|
|
108
|
+
__excludeProps: ["title"]
|
|
109
|
+
};
|
|
110
|
+
var hintProps = {
|
|
111
|
+
title: buttonAriaLabel,
|
|
112
|
+
timeout: [250, 50],
|
|
113
|
+
placement: hintPlacement,
|
|
114
|
+
theme: theme === "invert" ? "invert" : void 0,
|
|
115
|
+
__excludeProps: []
|
|
116
|
+
};
|
|
117
|
+
return /* @__PURE__ */ React.createElement(NeighborLocation.Detect, {
|
|
118
|
+
neighborLocation
|
|
119
|
+
}, function(neighborLocation2) {
|
|
120
|
+
var _ref5;
|
|
121
|
+
var children = (_ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SInner, _ref5.cn("SInner", {
|
|
122
|
+
"tag": "span",
|
|
123
|
+
"loading": loading
|
|
124
|
+
}), AddonLeft ? /* @__PURE__ */ React.createElement(Button.Addon, null, /* @__PURE__ */ React.createElement(AddonLeft, _ref5.cn("AddonLeft", {}))) : null, addonTextChildren(Children, Button.Text, Button.Addon), AddonRight ? /* @__PURE__ */ React.createElement(Button.Addon, null, /* @__PURE__ */ React.createElement(AddonRight, _ref5.cn("AddonRight", {}))) : null), loading && /* @__PURE__ */ React.createElement(SSpin, _ref5.cn("SSpin", {
|
|
125
|
+
"tag": "span"
|
|
126
|
+
}), /* @__PURE__ */ React.createElement(SpinButton, _ref5.cn("SpinButton", {
|
|
127
|
+
"centered": true,
|
|
128
|
+
"size": size,
|
|
129
|
+
"theme": useTheme
|
|
130
|
+
})))));
|
|
131
|
+
buttonProps.neighborLocation = neighborLocation2;
|
|
132
|
+
if (hasChildren === void 0 || title) {
|
|
133
|
+
return _this3.renderButtonWithHint({
|
|
134
|
+
buttonProps,
|
|
135
|
+
hintProps,
|
|
136
|
+
children
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return _this3.renderButton({
|
|
140
|
+
buttonProps,
|
|
141
|
+
children
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}]);
|
|
146
|
+
return AbstractButton2;
|
|
147
|
+
}(Component);
|
|
148
|
+
_defineProperty(AbstractButton, "displayName", "AbstractButton");
|
|
149
|
+
export {
|
|
150
|
+
AbstractButton,
|
|
151
|
+
MAP_USE_DEFAULT_THEME
|
|
152
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
import Spin from "@semcore/spin";
|
|
4
3
|
import React from "react";
|
|
4
|
+
import Spin from "@semcore/spin";
|
|
5
5
|
var _excluded = ["theme", "size"];
|
|
6
6
|
var SPIN_SIZE_MAP = {
|
|
7
7
|
xl: "m",
|
|
@@ -10,7 +10,8 @@ var SPIN_SIZE_MAP = {
|
|
|
10
10
|
s: "xxs"
|
|
11
11
|
};
|
|
12
12
|
function SpinButton(_ref) {
|
|
13
|
-
|
|
13
|
+
_ref.theme;
|
|
14
|
+
var size = _ref.size, others = _objectWithoutProperties(_ref, _excluded);
|
|
14
15
|
return /* @__PURE__ */ React.createElement(Spin, _extends({
|
|
15
16
|
size: typeof size === "string" ? SPIN_SIZE_MAP[size] : size,
|
|
16
17
|
theme: "currentColor"
|