@semcore/button 16.0.12-prerelease.1 → 16.0.13-prerelease.8

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +4 -4
  3. package/lib/cjs/component/AbstractButton/AbstractButton.js +100 -165
  4. package/lib/cjs/component/AbstractButton/AbstractButton.js.map +1 -1
  5. package/lib/cjs/component/AbstractButton/AbstractButton.type.js.map +1 -1
  6. package/lib/cjs/component/AbstractButton/SpinButton.js +9 -10
  7. package/lib/cjs/component/AbstractButton/SpinButton.js.map +1 -1
  8. package/lib/cjs/component/Button/Button.js +54 -63
  9. package/lib/cjs/component/Button/Button.js.map +1 -1
  10. package/lib/cjs/component/Button/Button.type.js.map +1 -1
  11. package/lib/cjs/component/ButtonLink/ButtonLink.js +51 -59
  12. package/lib/cjs/component/ButtonLink/ButtonLink.js.map +1 -1
  13. package/lib/cjs/component/ButtonLink/buttonLink.shadow.css +7 -7
  14. package/lib/cjs/index.js +7 -7
  15. package/lib/cjs/index.js.map +1 -1
  16. package/lib/es6/component/AbstractButton/AbstractButton.js +97 -164
  17. package/lib/es6/component/AbstractButton/AbstractButton.js.map +1 -1
  18. package/lib/es6/component/AbstractButton/AbstractButton.type.js.map +1 -1
  19. package/lib/es6/component/AbstractButton/SpinButton.js +6 -7
  20. package/lib/es6/component/AbstractButton/SpinButton.js.map +1 -1
  21. package/lib/es6/component/Button/Button.js +47 -56
  22. package/lib/es6/component/Button/Button.js.map +1 -1
  23. package/lib/es6/component/Button/Button.type.js.map +1 -1
  24. package/lib/es6/component/ButtonLink/ButtonLink.js +44 -52
  25. package/lib/es6/component/ButtonLink/ButtonLink.js.map +1 -1
  26. package/lib/es6/component/ButtonLink/buttonLink.shadow.css +7 -7
  27. package/lib/esm/component/AbstractButton/AbstractButton.mjs +98 -136
  28. package/lib/esm/component/AbstractButton/SpinButton.mjs +6 -6
  29. package/lib/esm/component/Button/Button.mjs +47 -56
  30. package/lib/esm/component/ButtonLink/ButtonLink.mjs +44 -50
  31. package/lib/esm/component/ButtonLink/buttonLink.shadow.css +7 -7
  32. package/lib/types/component/AbstractButton/AbstractButton.d.ts +5 -6
  33. package/lib/types/component/AbstractButton/AbstractButton.type.d.ts +2 -4
  34. package/lib/types/component/Button/Button.type.d.ts +2 -18
  35. package/package.json +6 -9
  36. package/src/component/AbstractButton/AbstractButton.tsx +58 -77
  37. package/src/component/AbstractButton/AbstractButton.type.ts +2 -4
  38. package/src/component/Button/Button.tsx +1 -1
  39. package/src/component/Button/Button.type.ts +1 -14
  40. package/src/component/ButtonLink/ButtonLink.tsx +1 -1
  41. package/src/component/ButtonLink/buttonLink.shadow.css +7 -7
package/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
4
4
 
5
+ ## [16.0.13] - 2026-02-16
6
+
7
+ ### Fixed
8
+
9
+ - Adjusted `ButtonLink` baseline.
10
+
5
11
  ## [16.0.12] - 2025-11-03
6
12
 
7
13
  ### Added
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![version](https://img.shields.io/npm/v/@semcore/button.svg)](https://www.npmjs.com/@semcore/button)
4
4
  [![downloads](https://img.shields.io/npm/dt/@semcore/button.svg)](https://www.npmjs.com/package/@semcore/button)
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/semrush/intergalactic/blob/master/LICENSE)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/semrush/intergalactic/blob/HEAD/LICENSE)
6
6
 
7
7
  > This component is part of the Intergalactic Design System
8
8
 
@@ -20,13 +20,13 @@ npm install @semcore/button
20
20
 
21
21
  ## 👤 Author
22
22
 
23
- [UI-kit team](https://github.com/semrush/intergalactic/blob/master/MAINTAINERS) and [others ❤️](https://github.com/semrush/intergalactic/graphs/contributors)
23
+ [UI-kit team](https://github.com/semrush/intergalactic/blob/HEAD/MAINTAINERS) and [others ❤️](https://github.com/semrush/intergalactic/graphs/contributors)
24
24
 
25
25
  ## 🤝 Contributing
26
26
 
27
27
  Contributions, issues and feature requests are welcome!
28
28
 
29
- Feel free to check [issues page](https://github.com/semrush/intergalactic/issues). You can also take a look at the [contributing guide](https://github.com/semrush/intergalactic/blob/master/CONTRIBUTING.md).
29
+ Feel free to check [issues page](https://github.com/semrush/intergalactic/issues). You can also take a look at the [contributing guide](https://github.com/semrush/intergalactic/blob/HEAD/CONTRIBUTING.md).
30
30
 
31
31
  ## Show your support
32
32
 
@@ -34,4 +34,4 @@ Give a ⭐️ if this project helped you!
34
34
 
35
35
  ## 📝 License
36
36
 
37
- This project is [MIT](https://github.com/semrush/intergalactic/blob/master/LICENSE) licensed.
37
+ This project is [MIT](https://github.com/semrush/intergalactic/blob/HEAD/LICENSE) licensed.
@@ -1,189 +1,124 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.MAP_USE_DEFAULT_THEME = exports.AbstractButton = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
- var _callSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/callSuper"));
12
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
9
  var _core = require("@semcore/core");
10
+ var _baseComponents = require("@semcore/base-components");
15
11
  var _addonTextChildren = _interopRequireDefault(require("@semcore/core/lib/utils/addonTextChildren"));
16
12
  var _hasLabels = _interopRequireDefault(require("@semcore/core/lib/utils/hasLabels"));
17
13
  var _logger = _interopRequireDefault(require("@semcore/core/lib/utils/logger"));
18
- var _flexBox = require("@semcore/flex-box");
19
- var _neighborLocation = _interopRequireDefault(require("@semcore/neighbor-location"));
20
- var _tooltip = require("@semcore/tooltip");
21
14
  var _react = _interopRequireDefault(require("react"));
22
15
  var _SpinButton = _interopRequireDefault(require("./SpinButton"));
23
- var MAP_USE_DEFAULT_THEME = exports.MAP_USE_DEFAULT_THEME = {
16
+ const MAP_USE_DEFAULT_THEME = exports.MAP_USE_DEFAULT_THEME = {
24
17
  primary: 'info',
25
18
  secondary: 'muted',
26
19
  tertiary: 'info'
27
20
  };
28
- var AbstractButton = exports.AbstractButton = /*#__PURE__*/function (_Component) {
29
- function AbstractButton() {
30
- var _this;
31
- (0, _classCallCheck2["default"])(this, AbstractButton);
32
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
33
- args[_key] = arguments[_key];
34
- }
35
- _this = (0, _callSuper2["default"])(this, AbstractButton, [].concat(args));
36
- (0, _defineProperty2["default"])(_this, "containerRef", /*#__PURE__*/_react["default"].createRef());
37
- (0, _defineProperty2["default"])(_this, "state", {
21
+ class AbstractButton extends _core.Component {
22
+ constructor(...args) {
23
+ super(...args);
24
+ (0, _defineProperty2.default)(this, "containerRef", /*#__PURE__*/_react.default.createRef());
25
+ (0, _defineProperty2.default)(this, "state", {
38
26
  ariaLabelledByContent: null
39
27
  });
40
- return _this;
41
28
  }
42
- (0, _inherits2["default"])(AbstractButton, _Component);
43
- return (0, _createClass2["default"])(AbstractButton, [{
44
- key: "getTextProps",
45
- value: function getTextProps() {
46
- var size = this.asProps.size;
47
- return {
48
- size: size
49
- };
50
- }
51
- }, {
52
- key: "getAddonProps",
53
- value: function getAddonProps() {
54
- var size = this.asProps.size;
55
- return {
56
- size: size
57
- };
58
- }
59
- }, {
60
- key: "componentDidMount",
61
- value: function componentDidMount() {
62
- var _this2 = this;
63
- if (process.env.NODE_ENV !== 'production') {
64
- _logger["default"].warn(this.containerRef.current && !(0, _hasLabels["default"])(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'] || AbstractButton.displayName);
65
- _logger["default"].warn(this.asProps.theme === 'warning', 'Warning theme is deprecated and will be removed in the next major release.', this.asProps['data-ui-name'] || AbstractButton.displayName);
66
- }
67
- var ariaLabelledby = this.asProps['aria-labelledby'];
68
- if (ariaLabelledby) {
69
- setTimeout(function () {
70
- var _document$getElementB, _document$getElementB2;
71
- _this2.setState({
72
- 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 : ''
73
- });
74
- }, 0);
75
- }
76
- }
77
- }, {
78
- key: "renderButton",
79
- value: function renderButton(_ref6) {
80
- var _ref = this.asProps,
81
- _ref3;
82
- var buttonProps = _ref6.buttonProps,
83
- children = _ref6.children;
84
- var _this$asProps = this.asProps,
85
- styles = _this$asProps.styles,
86
- theme = _this$asProps.theme;
87
- var SButton = _flexBox.Box;
88
- return _ref3 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SButton, _ref3.cn("SButton", (0, _objectSpread2["default"])({}, (0, _core.assignProps)((0, _objectSpread2["default"])({
89
- "invertOutline": theme === 'invert'
90
- }, buttonProps), _ref))), children);
91
- }
92
- }, {
93
- key: "renderButtonWithHint",
94
- value: function renderButtonWithHint(_ref7) {
95
- var _ref2 = this.asProps,
96
- _ref4;
97
- var buttonProps = _ref7.buttonProps,
98
- children = _ref7.children,
99
- hintProps = _ref7.hintProps;
100
- var _this$asProps2 = this.asProps,
101
- styles = _this$asProps2.styles,
102
- theme = _this$asProps2.theme;
103
- var SButton = _tooltip.Hint;
104
- return _ref4 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(SButton, _ref4.cn("SButton", (0, _objectSpread2["default"])({}, (0, _core.assignProps)((0, _objectSpread2["default"])((0, _objectSpread2["default"])((0, _objectSpread2["default"])({
105
- "invertOutline": theme === 'invert'
106
- }, buttonProps), hintProps), {}, {
107
- "ignorePortalsStacking": true
108
- }), _ref2))), children);
29
+ getTextProps() {
30
+ const {
31
+ size
32
+ } = this.asProps;
33
+ return {
34
+ size
35
+ };
36
+ }
37
+ getAddonProps() {
38
+ const {
39
+ size
40
+ } = this.asProps;
41
+ return {
42
+ size
43
+ };
44
+ }
45
+ componentDidMount() {
46
+ if (process.env.NODE_ENV !== 'production') {
47
+ _logger.default.warn(this.containerRef.current && !(0, _hasLabels.default)(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'] || AbstractButton.displayName);
48
+ _logger.default.warn(this.asProps.theme === 'warning', 'Warning theme is deprecated and will be removed in the next major release.', this.asProps['data-ui-name'] || AbstractButton.displayName);
109
49
  }
110
- }, {
111
- key: "render",
112
- value: function render() {
113
- var _ref8,
114
- _ref9,
115
- _this3 = this;
116
- var _this$asProps3 = this.asProps,
117
- styles = _this$asProps3.styles,
118
- use = _this$asProps3.use,
119
- _this$asProps3$theme = _this$asProps3.theme,
120
- theme = _this$asProps3$theme === void 0 ? typeof use === 'string' && MAP_USE_DEFAULT_THEME[use] : _this$asProps3$theme,
121
- loading = _this$asProps3.loading,
122
- _this$asProps3$disabl = _this$asProps3.disabled,
123
- disabled = _this$asProps3$disabl === void 0 ? loading : _this$asProps3$disabl,
124
- size = _this$asProps3.size,
125
- neighborLocation = _this$asProps3.neighborLocation,
126
- hasChildren = _this$asProps3.children,
127
- title = _this$asProps3.title,
128
- ariaLabel = _this$asProps3['aria-label'],
129
- Children = _this$asProps3.Children,
130
- AddonLeft = _this$asProps3.addonLeft,
131
- AddonRight = _this$asProps3.addonRight,
132
- hintPlacement = _this$asProps3.hintPlacement;
133
- // @ts-ignore
134
- var Button = this[_core.CORE_INSTANCE];
135
- var useTheme = use && theme ? "".concat(use, "-").concat(theme) : false;
136
- var SInner = _flexBox.Box;
137
- var SSpin = _flexBox.Box;
138
- var buttonAriaLabel = (_ref8 = (_ref9 = title !== null && title !== void 0 ? title : ariaLabel) !== null && _ref9 !== void 0 ? _ref9 : this.state.ariaLabelledByContent) !== null && _ref8 !== void 0 ? _ref8 : '';
139
- var buttonProps = {
140
- 'type': 'button',
141
- 'tag': 'button',
142
- disabled: disabled,
143
- 'use:theme': useTheme,
144
- 'ref': this.containerRef,
145
- 'text-color': this.getTextColor(),
146
- 'aria-busy': loading,
147
- '__excludeProps': ['title'],
148
- 'tabIndex': 0
149
- };
150
- var hintProps = {
151
- title: buttonAriaLabel,
152
- timeout: [250, 50],
153
- placement: hintPlacement,
154
- theme: theme === 'invert' ? 'invert' : undefined,
155
- __excludeProps: []
156
- };
157
- return /*#__PURE__*/_react["default"].createElement(_neighborLocation["default"].Detect, {
158
- neighborLocation: neighborLocation
159
- }, function (neighborLocation) {
160
- var _ref5;
161
- var children = (_ref5 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(SInner, _ref5.cn("SInner", {
162
- "tag": 'span',
163
- "loading": loading,
164
- "data-ui-name": "".concat(_this3.asProps['data-ui-name'], ".InnerWrapper")
165
- }), AddonLeft ? /*#__PURE__*/_react["default"].createElement(Button.Addon, null, /*#__PURE__*/_react["default"].createElement(AddonLeft, _ref5.cn("AddonLeft", {}))) : null, (0, _addonTextChildren["default"])(Children, Button.Text, Button.Addon), AddonRight ? /*#__PURE__*/_react["default"].createElement(Button.Addon, null, /*#__PURE__*/_react["default"].createElement(AddonRight, _ref5.cn("AddonRight", {}))) : null), loading && /*#__PURE__*/_react["default"].createElement(SSpin, _ref5.cn("SSpin", {
166
- "tag": 'span'
167
- }), /*#__PURE__*/_react["default"].createElement(_SpinButton["default"], _ref5.cn("SpinButton", {
168
- "centered": true,
169
- "size": size,
170
- "theme": useTheme
171
- })))));
172
- buttonProps.neighborLocation = neighborLocation;
173
- if (hasChildren === undefined || title) {
174
- return _this3.renderButtonWithHint({
175
- buttonProps: buttonProps,
176
- hintProps: hintProps,
177
- children: children
178
- });
179
- }
180
- return _this3.renderButton({
181
- buttonProps: buttonProps,
182
- children: children
50
+ const ariaLabelledby = this.asProps['aria-labelledby'];
51
+ if (ariaLabelledby) {
52
+ setTimeout(() => {
53
+ this.setState({
54
+ ariaLabelledByContent: document.getElementById(ariaLabelledby)?.textContent ?? ''
183
55
  });
184
- });
56
+ }, 0);
185
57
  }
186
- }]);
187
- }(_core.Component);
188
- (0, _defineProperty2["default"])(AbstractButton, "displayName", 'AbstractButton');
58
+ }
59
+ render() {
60
+ var _ref = this.asProps;
61
+ const {
62
+ styles,
63
+ use,
64
+ theme = typeof use === 'string' && MAP_USE_DEFAULT_THEME[use],
65
+ loading,
66
+ disabled = loading,
67
+ size,
68
+ neighborLocation,
69
+ children,
70
+ title,
71
+ ['aria-label']: ariaLabel,
72
+ Children,
73
+ addonLeft: AddonLeft,
74
+ addonRight: AddonRight,
75
+ hintPlacement
76
+ } = this.asProps;
77
+ const SButton = _baseComponents.Box;
78
+ // @ts-ignore
79
+ const Button = this[_core.CORE_INSTANCE];
80
+ const useTheme = use && theme ? `${use}-${theme}` : false;
81
+ const SInner = _baseComponents.Box;
82
+ const SSpin = _baseComponents.Box;
83
+ const buttonAriaLabel = title ?? ariaLabel ?? this.state.ariaLabelledByContent ?? '';
84
+ const showHint = children === undefined || title;
85
+ return /*#__PURE__*/_react.default.createElement(_baseComponents.NeighborLocation.Detect, {
86
+ neighborLocation: neighborLocation
87
+ }, neighborLocation => {
88
+ var _ref2;
89
+ return _ref2 = (0, _core.sstyled)(styles), /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(SButton, _ref2.cn("SButton", {
90
+ ...(0, _core.assignProps)({
91
+ "invertOutline": theme === 'invert',
92
+ "type": 'button',
93
+ "tag": 'button',
94
+ "tabIndex": 0,
95
+ "disabled": disabled,
96
+ "use:theme": useTheme,
97
+ "ref": this.containerRef,
98
+ "text-color": this.getTextColor(),
99
+ "aria-busy": loading,
100
+ "__excludeProps": ['title'],
101
+ "aria-label": showHint ? buttonAriaLabel : undefined,
102
+ "neighborLocation": neighborLocation
103
+ }, _ref)
104
+ }), /*#__PURE__*/_react.default.createElement(SInner, _ref2.cn("SInner", {
105
+ "tag": 'span',
106
+ "loading": loading,
107
+ "data-ui-name": `${this.asProps['data-ui-name']}.InnerWrapper`
108
+ }), AddonLeft ? /*#__PURE__*/_react.default.createElement(Button.Addon, null, /*#__PURE__*/_react.default.createElement(AddonLeft, _ref2.cn("AddonLeft", {}))) : null, (0, _addonTextChildren.default)(Children, Button.Text, Button.Addon), AddonRight ? /*#__PURE__*/_react.default.createElement(Button.Addon, null, /*#__PURE__*/_react.default.createElement(AddonRight, _ref2.cn("AddonRight", {}))) : null), loading && /*#__PURE__*/_react.default.createElement(SSpin, _ref2.cn("SSpin", {
109
+ "tag": 'span'
110
+ }), /*#__PURE__*/_react.default.createElement(_SpinButton.default, _ref2.cn("SpinButton", {
111
+ "centered": true,
112
+ "size": size,
113
+ "theme": useTheme
114
+ })))), showHint && /*#__PURE__*/_react.default.createElement(_baseComponents.Hint, _ref2.cn("Hint", {
115
+ "triggerRef": this.containerRef,
116
+ "timeout": [250, 50],
117
+ "placement": hintPlacement
118
+ }), buttonAriaLabel));
119
+ });
120
+ }
121
+ }
122
+ exports.AbstractButton = AbstractButton;
123
+ (0, _defineProperty2.default)(AbstractButton, "displayName", 'AbstractButton');
189
124
  //# sourceMappingURL=AbstractButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractButton.js","names":["_core","require","_addonTextChildren","_interopRequireDefault","_hasLabels","_logger","_flexBox","_neighborLocation","_tooltip","_react","_SpinButton","MAP_USE_DEFAULT_THEME","exports","primary","secondary","tertiary","AbstractButton","_Component","_this","_classCallCheck2","_len","arguments","length","args","Array","_key","_callSuper2","concat","_defineProperty2","React","createRef","ariaLabelledByContent","_inherits2","_createClass2","key","value","getTextProps","size","asProps","getAddonProps","componentDidMount","_this2","process","env","NODE_ENV","logger","warn","containerRef","current","hasLabels","title","displayName","theme","ariaLabelledby","setTimeout","_document$getElementB","_document$getElementB2","setState","document","getElementById","textContent","renderButton","_ref6","_ref","_ref3","buttonProps","children","_this$asProps","styles","SButton","Box","sstyled","createElement","cn","_objectSpread2","assignProps","renderButtonWithHint","_ref7","_ref2","_ref4","hintProps","_this$asProps2","Hint","render","_ref8","_ref9","_this3","_this$asProps3","use","_this$asProps3$theme","loading","_this$asProps3$disabl","disabled","neighborLocation","hasChildren","ariaLabel","Children","AddonLeft","addonLeft","AddonRight","addonRight","hintPlacement","Button","CORE_INSTANCE","useTheme","SInner","SSpin","buttonAriaLabel","state","getTextColor","timeout","placement","undefined","__excludeProps","Detect","_ref5","Fragment","Addon","addonTextChildren","Text","Component"],"sources":["../../../../src/component/AbstractButton/AbstractButton.tsx"],"sourcesContent":["import { Component, CORE_INSTANCE, Root, sstyled } from '@semcore/core';\nimport addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';\nimport hasLabels from '@semcore/core/lib/utils/hasLabels';\nimport logger from '@semcore/core/lib/utils/logger';\nimport { Box } from '@semcore/flex-box';\nimport NeighborLocation from '@semcore/neighbor-location';\nimport { Hint } from '@semcore/tooltip';\nimport React from 'react';\n\nimport type { AbstractButtonProps } from './AbstractButton.type';\nimport SpinButton from './SpinButton';\n\nexport const MAP_USE_DEFAULT_THEME: Record<string, string> = {\n primary: 'info',\n secondary: 'muted',\n tertiary: 'info',\n};\n\ntype Props = AbstractButtonProps<any, any, any>;\n\nexport abstract class AbstractButton extends Component<Props, {}, {}> {\n static displayName = 'AbstractButton';\n\n containerRef = React.createRef<HTMLButtonElement>();\n\n state = {\n ariaLabelledByContent: null,\n };\n\n protected abstract getTextColor(): string | undefined;\n\n getTextProps() {\n const { size } = this.asProps;\n\n return {\n size,\n };\n }\n\n getAddonProps() {\n const { size } = this.asProps;\n return {\n size,\n };\n }\n\n componentDidMount() {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(\n this.containerRef.current && !hasLabels(this.containerRef.current) && !this.asProps.title,\n `'title' or 'aria-label' or 'aria-labelledby' are required props for buttons without text content`,\n this.asProps['data-ui-name'] || AbstractButton.displayName,\n );\n\n logger.warn(\n this.asProps.theme === 'warning',\n 'Warning theme is deprecated and will be removed in the next major release.',\n this.asProps['data-ui-name'] || AbstractButton.displayName,\n );\n }\n\n const ariaLabelledby = this.asProps['aria-labelledby'];\n\n if (ariaLabelledby) {\n setTimeout(() => {\n this.setState({\n ariaLabelledByContent: document.getElementById(ariaLabelledby)?.textContent ?? '',\n });\n }, 0);\n }\n }\n\n renderButton({ buttonProps, children }: any) {\n const { styles, theme } = this.asProps;\n const SButton = Root;\n\n return sstyled(styles)(\n <SButton render={Box} invertOutline={theme === 'invert'} {...buttonProps}>\n {children}\n </SButton>,\n );\n }\n\n renderButtonWithHint({ buttonProps, children, hintProps }: any) {\n const { styles, theme } = this.asProps;\n const SButton = Root;\n\n return sstyled(styles)(\n <SButton render={Hint} invertOutline={theme === 'invert'} {...buttonProps} {...hintProps} ignorePortalsStacking>\n {children}\n </SButton>,\n );\n }\n\n render() {\n const {\n styles,\n use,\n theme = typeof use === 'string' && MAP_USE_DEFAULT_THEME[use],\n loading,\n disabled = loading,\n size,\n neighborLocation,\n children: hasChildren,\n title,\n ['aria-label']: ariaLabel,\n Children,\n addonLeft: AddonLeft,\n addonRight: AddonRight,\n hintPlacement,\n } = this.asProps;\n // @ts-ignore\n const Button = this[CORE_INSTANCE];\n const useTheme = use && theme ? `${use}-${theme}` : false;\n const SInner = Box;\n const SSpin = Box;\n const buttonAriaLabel = title ?? ariaLabel ?? this.state.ariaLabelledByContent ?? '';\n\n const buttonProps: Record<string, any> = {\n 'type': 'button',\n 'tag': 'button',\n disabled,\n 'use:theme': useTheme,\n 'ref': this.containerRef,\n 'text-color': this.getTextColor(),\n 'aria-busy': loading,\n '__excludeProps': ['title'],\n 'tabIndex': 0,\n };\n\n const hintProps = {\n title: buttonAriaLabel,\n timeout: [250, 50],\n placement: hintPlacement,\n theme: theme === 'invert' ? 'invert' : undefined,\n __excludeProps: [],\n };\n\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) => {\n const children = sstyled(styles)(\n <>\n {/* @ts-ignore */}\n <SInner tag='span' loading={loading} data-ui-name={`${this.asProps['data-ui-name']}.InnerWrapper`}>\n {AddonLeft\n ? (\n <Button.Addon>\n <AddonLeft />\n </Button.Addon>\n )\n : null}\n {addonTextChildren(Children, Button.Text, Button.Addon)}\n {AddonRight\n ? (\n <Button.Addon>\n <AddonRight />\n </Button.Addon>\n )\n : null}\n </SInner>\n {loading && (\n <SSpin tag='span'>\n <SpinButton centered size={size} theme={useTheme} />\n </SSpin>\n )}\n </>,\n );\n buttonProps.neighborLocation = neighborLocation;\n\n if (hasChildren === undefined || title) {\n return this.renderButtonWithHint({ buttonProps, hintProps, children });\n }\n\n return this.renderButton({ buttonProps, children });\n }}\n </NeighborLocation.Detect>\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,UAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,OAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAJ,sBAAA,CAAAF,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAN,sBAAA,CAAAF,OAAA;AAGA,IAAAS,WAAA,GAAAP,sBAAA,CAAAF,OAAA;AAEO,IAAMU,qBAA6C,GAAAC,OAAA,CAAAD,qBAAA,GAAG;EAC3DE,OAAO,EAAE,MAA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A,CAAA1C,EAAA,kBAAE,CACD,CAAC,GAEjB,IACE,CAAC,EACRiB,OAAO,iBACNjF,MAAA,YAAA+D,aAAA,CAACkC,KAAK,EAAAS,KAAA,CAAA1C,EAAA;UAAA,OAAK;QAAM,iBACfhE,MAAA,YAAA+D,aAAA,CAAC9D,WAAA,WAAU,EAAAyG,KAAA,CAAA1C,EAAA;UAAA;UAAA,QAAgBpC,IAAI;UAAA,SAASmE;QAAQ,EAAG,CAC9C,CAET,CAAC,CACJ;QACDvC,WAAW,CAAC4B,gBAAgB,GAAGA,gBAAgB;QAE/C,IAAIC,WAAW,KAAKkB,SAAS,IAAI9D,KAAK,EAAE;UACtC,OAAOoC,MAAI,CAACV,oBAAoB,CAAC;YAAEX,WAAW,EAAXA,WAAW;YAAEe,SAAS,EAATA,SAAS;YAAEd,QAAQ,EAARA;UAAS,CAAC,CAAC;QACxE;QAEA,OAAOoB,MAAI,CAACzB,YAAY,CAAC;UAAEI,WAAW,EAAXA,WAAW;UAAEC,QAAQ,EAARA;QAAS,CAAC,CAAC;MACrD,CACuB,CAAC;IAE9B;EAAC;AAAA,EA9J0CsD,eAAS;AAAA,IAAA5F,gBAAA,aAAhCZ,cAAc,iBACb,gBAAgB","ignoreList":[]}
1
+ {"version":3,"file":"AbstractButton.js","names":["_core","require","_baseComponents","_addonTextChildren","_interopRequireDefault","_hasLabels","_logger","_react","_SpinButton","MAP_USE_DEFAULT_THEME","exports","primary","secondary","tertiary","AbstractButton","Component","constructor","args","_defineProperty2","default","React","createRef","ariaLabelledByContent","getTextProps","size","asProps","getAddonProps","componentDidMount","process","env","NODE_ENV","logger","warn","containerRef","current","hasLabels","title","displayName","theme","ariaLabelledby","setTimeout","setState","document","getElementById","textContent","render","_ref","styles","use","loading","disabled","neighborLocation","children","ariaLabel","Children","addonLeft","AddonLeft","addonRight","AddonRight","hintPlacement","SButton","Box","Button","CORE_INSTANCE","useTheme","SInner","SSpin","buttonAriaLabel","state","showHint","undefined","createElement","NeighborLocation","Detect","_ref2","sstyled","Fragment","cn","assignProps","getTextColor","Addon","addonTextChildren","Text","Hint"],"sources":["../../../../src/component/AbstractButton/AbstractButton.tsx"],"sourcesContent":["import { NeighborLocation, Box, Hint } from '@semcore/base-components';\nimport { Component, CORE_INSTANCE, Root, sstyled } from '@semcore/core';\nimport addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';\nimport hasLabels from '@semcore/core/lib/utils/hasLabels';\nimport logger from '@semcore/core/lib/utils/logger';\nimport React from 'react';\n\nimport type { AbstractButtonProps } from './AbstractButton.type';\nimport SpinButton from './SpinButton';\n\nexport const MAP_USE_DEFAULT_THEME: Record<string, string> = {\n primary: 'info',\n secondary: 'muted',\n tertiary: 'info',\n};\n\ntype Props = AbstractButtonProps<any, any, any>;\n\ntype State = {\n ariaLabelledByContent: null | string;\n};\n\nexport abstract class AbstractButton extends Component<Props, [], never, {}, State> {\n static displayName = 'AbstractButton';\n\n containerRef = React.createRef<HTMLButtonElement>();\n\n state: State = {\n ariaLabelledByContent: null,\n };\n\n protected abstract getTextColor(): string | undefined;\n\n getTextProps() {\n const { size } = this.asProps;\n\n return {\n size,\n };\n }\n\n getAddonProps() {\n const { size } = this.asProps;\n return {\n size,\n };\n }\n\n componentDidMount() {\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(\n this.containerRef.current && !hasLabels(this.containerRef.current) && !this.asProps.title,\n `'title' or 'aria-label' or 'aria-labelledby' are required props for buttons without text content`,\n this.asProps['data-ui-name'] || AbstractButton.displayName,\n );\n\n logger.warn(\n this.asProps.theme === 'warning',\n 'Warning theme is deprecated and will be removed in the next major release.',\n this.asProps['data-ui-name'] || AbstractButton.displayName,\n );\n }\n\n const ariaLabelledby = this.asProps['aria-labelledby'];\n\n if (ariaLabelledby) {\n setTimeout(() => {\n this.setState({\n ariaLabelledByContent: document.getElementById(ariaLabelledby)?.textContent ?? '',\n });\n }, 0);\n }\n }\n\n render() {\n const {\n styles,\n use,\n theme = typeof use === 'string' && MAP_USE_DEFAULT_THEME[use],\n loading,\n disabled = loading,\n size,\n neighborLocation,\n children,\n title,\n ['aria-label']: ariaLabel,\n Children,\n addonLeft: AddonLeft,\n addonRight: AddonRight,\n hintPlacement,\n } = this.asProps;\n const SButton = Root;\n // @ts-ignore\n const Button = this[CORE_INSTANCE];\n const useTheme = use && theme ? `${use}-${theme}` : false;\n const SInner = Box;\n const SSpin = Box;\n const buttonAriaLabel = title ?? ariaLabel ?? this.state.ariaLabelledByContent ?? '';\n\n const showHint = (children === undefined || title);\n\n return (\n <NeighborLocation.Detect neighborLocation={neighborLocation}>\n {(neighborLocation) => {\n return sstyled(styles)(\n <>\n <SButton\n render={Box}\n invertOutline={theme === 'invert'}\n type='button'\n tag='button'\n tabIndex={0}\n disabled={disabled}\n use:theme={useTheme}\n ref={this.containerRef}\n text-color={this.getTextColor()}\n aria-busy={loading}\n __excludeProps={['title']}\n aria-label={showHint ? buttonAriaLabel : undefined}\n neighborLocation={neighborLocation}\n >\n {/* @ts-ignore */}\n <SInner tag='span' loading={loading} data-ui-name={`${this.asProps['data-ui-name']}.InnerWrapper`}>\n {AddonLeft\n ? (\n <Button.Addon>\n <AddonLeft />\n </Button.Addon>\n )\n : null}\n {addonTextChildren(Children, Button.Text, Button.Addon)}\n {AddonRight\n ? (\n <Button.Addon>\n <AddonRight />\n </Button.Addon>\n )\n : null}\n </SInner>\n {loading && (\n <SSpin tag='span'>\n <SpinButton centered size={size} theme={useTheme} />\n </SSpin>\n )}\n </SButton>\n {showHint && (\n <Hint\n triggerRef={this.containerRef}\n timeout={[250, 50]}\n placement={hintPlacement}\n >\n {buttonAriaLabel}\n </Hint>\n )}\n </>,\n );\n }}\n </NeighborLocation.Detect>\n );\n }\n}\n"],"mappings":";;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AADA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAD,sBAAA,CAAAH,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AAA,CAACT,MAAM,CAACkB,KAAK,qBACXzE,MAAA,CAAAY,OAAA,CAAAoD,aAAA,CAACb,UAAU,EAAAgB,KAAA,CAAAG,EAAA,kBAAE,CACD,CAAC,GAEjB,IACE,CAAC,EACR5B,OAAO,iBACN1C,MAAA,CAAAY,OAAA,CAAAoD,aAAA,CAACL,KAAK,EAAAQ,KAAA,CAAAG,EAAA;QAAA,OAAK;MAAM,iBACftE,MAAA,CAAAY,OAAA,CAAAoD,aAAA,CAAC/D,WAAA,CAAAW,OAAU,EAAAuD,KAAA,CAAAG,EAAA;QAAA;QAAA,QAAgBrD,IAAI;QAAA,SAASwC;MAAQ,EAAG,CAC9C,CAEF,CAAC,EACTK,QAAQ,iBACP9D,MAAA,CAAAY,OAAA,CAAAoD,aAAA,CAACrE,eAAA,CAAAiF,IAAI,EAAAT,KAAA,CAAAG,EAAA;QAAA,cACS,IAAI,CAAC5C,YAAY;QAAA,WACpB,CAAC,GAAG,EAAE,EAAE,CAAC;QAAA,aACP0B;MAAa,IAEvBQ,eACG,CAER,CAAC;IAEP,CACuB,CAAC;EAE9B;AACF;AAACzD,OAAA,CAAAI,cAAA,GAAAA,cAAA;AAAA,IAAAI,gBAAA,CAAAC,OAAA,EA1IqBL,cAAc,iBACb,gBAAgB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"AbstractButton.type.js","names":[],"sources":["../../../../src/component/AbstractButton/AbstractButton.type.ts"],"sourcesContent":["import type { PropGetterFn } from '@semcore/core';\nimport type { BoxProps } from '@semcore/flex-box';\nimport type { NeighborItemProps } from '@semcore/neighbor-location';\nimport type { TooltipHintProps } from '@semcore/tooltip';\nimport type React from 'react';\n\nexport type AbstractButtonProps<S, U, T> = BoxProps &\n NeighborItemProps & {\n /** Button activity state */\n active?: boolean;\n /** Disabled button state */\n disabled?: boolean;\n /** Loading button state */\n loading?: boolean;\n /** Tag for the left Addon */\n addonLeft?: React.ElementType;\n /** Tag for the right Addon */\n addonRight?: React.ElementType;\n /**\n * Placement for hint\n * @default top\n */\n hintPlacement?: TooltipHintProps['placement'];\n\n /** Button size. Defined in Button.type or ButtonLink.type */\n size?: S;\n /** Button usage. Defined in Button.type or ButtonLink.type */\n use?: U;\n /** Button theme. Defined in Button.type or ButtonLink.type */\n theme?: T;\n };\n\nexport type AbstractButtonAddonProps<S> = BoxProps & {\n size?: S;\n};\n\nexport type AbstractButtonTextProps<S> = BoxProps & {\n size?: S;\n};\n\nexport type AbstractButtonContext = {\n getTextProps: PropGetterFn;\n getAddonProps: PropGetterFn;\n};\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"AbstractButton.type.js","names":[],"sources":["../../../../src/component/AbstractButton/AbstractButton.type.ts"],"sourcesContent":["import type { BoxProps, NeighborItemProps, SimpleHintPopperProps } from '@semcore/base-components';\nimport type { PropGetterFn } from '@semcore/core';\nimport type React from 'react';\n\nexport type AbstractButtonProps<S, U, T> = BoxProps &\n NeighborItemProps & {\n /** Button activity state */\n active?: boolean;\n /** Disabled button state */\n disabled?: boolean;\n /** Loading button state */\n loading?: boolean;\n /** Tag for the left Addon */\n addonLeft?: React.ElementType;\n /** Tag for the right Addon */\n addonRight?: React.ElementType;\n /**\n * Placement for hint\n * @default top\n */\n hintPlacement?: SimpleHintPopperProps['placement'];\n\n /** Button size. Defined in Button.type or ButtonLink.type */\n size?: S;\n /** Button usage. Defined in Button.type or ButtonLink.type */\n use?: U;\n /** Button theme. Defined in Button.type or ButtonLink.type */\n theme?: T;\n };\n\nexport type AbstractButtonAddonProps<S> = BoxProps & {\n size?: S;\n};\n\nexport type AbstractButtonTextProps<S> = BoxProps & {\n size?: S;\n};\n\nexport type AbstractButtonContext = {\n getTextProps: PropGetterFn;\n getAddonProps: PropGetterFn;\n};\n"],"mappings":"","ignoreList":[]}
@@ -1,27 +1,26 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.SPIN_SIZE_MAP = void 0;
8
- exports["default"] = SpinButton;
8
+ exports.default = SpinButton;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
10
  var _spin = _interopRequireDefault(require("@semcore/spin"));
12
11
  var _react = _interopRequireDefault(require("react"));
13
- var _excluded = ["theme", "size"];
14
- var SPIN_SIZE_MAP = exports.SPIN_SIZE_MAP = {
12
+ const SPIN_SIZE_MAP = exports.SPIN_SIZE_MAP = {
15
13
  xl: 'm',
16
14
  l: 's',
17
15
  m: 'xs',
18
16
  s: 'xxs'
19
17
  };
20
- function SpinButton(_ref) {
21
- var theme = _ref.theme,
22
- size = _ref.size,
23
- others = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
24
- return /*#__PURE__*/_react["default"].createElement(_spin["default"], (0, _extends2["default"])({
18
+ function SpinButton({
19
+ theme,
20
+ size,
21
+ ...others
22
+ }) {
23
+ return /*#__PURE__*/_react.default.createElement(_spin.default, (0, _extends2.default)({
25
24
  size: typeof size === 'string' ? SPIN_SIZE_MAP[size] : size,
26
25
  theme: "currentColor"
27
26
  }, others));
@@ -1 +1 @@
1
- {"version":3,"file":"SpinButton.js","names":["_spin","_interopRequireDefault","require","_react","_excluded","SPIN_SIZE_MAP","exports","xl","l","m","s","SpinButton","_ref","theme","size","others","_objectWithoutProperties2","createElement","_extends2"],"sources":["../../../../src/component/AbstractButton/SpinButton.tsx"],"sourcesContent":["import Spin from '@semcore/spin';\nimport React from 'react';\n\nexport const SPIN_SIZE_MAP: Record<string, string> = {\n xl: 'm',\n l: 's',\n m: 'xs',\n s: 'xxs',\n};\n\nexport default function SpinButton({ theme, size, ...others }: any) {\n return (\n <Spin\n size={typeof size === 'string' ? SPIN_SIZE_MAP[size] : size}\n theme='currentColor'\n {...others}\n />\n );\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA0B,IAAAE,SAAA;AAEnB,IAAMC,aAAqC,GAAAC,OAAA,CAAAD,aAAA,GAAG;EACnDE,EAAE,EAAE,GAAG;EACPC,CAAC,EAAE,GAAG;EACNC,CAAC,EAAE,IAAI;EACPC,CAAC,EAAE;AACL,CAAC;AAEc,SAASC,UAAUA,CAAAC,IAAA,EAAkC;EAAA,IAA/BC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IAAKC,MAAM,OAAAC,yBAAA,aAAAJ,IAAA,EAAAR,SAAA;EACzD,oBACED,MAAA,YAAAc,aAAA,CAACjB,KAAA,WAAI,MAAAkB,SAAA;IACHJ,IAAI,EAAE,OAAOA,IAAI,KAAK,QAAQ,GAAGT,aAAa,CAACS,IAAI,CAAC,GAAGA,IAAK;IAC5DD,KAAK,EAAC;EAAc,GAChBE,MAAM,CACX,CAAC;AAEN","ignoreList":[]}
1
+ {"version":3,"file":"SpinButton.js","names":["_spin","_interopRequireDefault","require","_react","SPIN_SIZE_MAP","exports","xl","l","m","s","SpinButton","theme","size","others","default","createElement","_extends2"],"sources":["../../../../src/component/AbstractButton/SpinButton.tsx"],"sourcesContent":["import Spin from '@semcore/spin';\nimport React from 'react';\n\nexport const SPIN_SIZE_MAP: Record<string, string> = {\n xl: 'm',\n l: 's',\n m: 'xs',\n s: 'xxs',\n};\n\nexport default function SpinButton({ theme, size, ...others }: any) {\n return (\n <Spin\n size={typeof size === 'string' ? SPIN_SIZE_MAP[size] : size}\n theme='currentColor'\n {...others}\n />\n );\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEO,MAAME,aAAqC,GAAAC,OAAA,CAAAD,aAAA,GAAG;EACnDE,EAAE,EAAE,GAAG;EACPC,CAAC,EAAE,GAAG;EACNC,CAAC,EAAE,IAAI;EACPC,CAAC,EAAE;AACL,CAAC;AAEc,SAASC,UAAUA,CAAC;EAAEC,KAAK;EAAEC,IAAI;EAAE,GAAGC;AAAY,CAAC,EAAE;EAClE,oBACEV,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACf,KAAA,CAAAc,OAAI,MAAAE,SAAA,CAAAF,OAAA;IACHF,IAAI,EAAE,OAAOA,IAAI,KAAK,QAAQ,GAAGR,aAAa,CAACQ,IAAI,CAAC,GAAGA,IAAK;IAC5DD,KAAK,EAAC;EAAc,GAChBE,MAAM,CACX,CAAC;AAEN","ignoreList":[]}