@semcore/tab-panel 2.5.0 → 2.6.3
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 +24 -0
- package/lib/cjs/TabPanel.js +12 -14
- package/lib/cjs/TabPanel.js.map +1 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/tab-panel.shadow.css +3 -3
- package/lib/es6/TabPanel.js +14 -16
- package/lib/es6/TabPanel.js.map +1 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/es6/style/tab-panel.shadow.css +3 -3
- package/lib/types/index.d.ts +43 -2
- package/package.json +3 -2
- package/src/{TabPanel.tsx → TabPanel.js} +6 -56
- package/src/index.d.ts +43 -0
- package/src/{index.tsx → index.js} +0 -0
- package/src/style/tab-panel.shadow.css +3 -3
- package/lib/types/TabPanel.d.ts +0 -59
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [2.6.3] - 2021-12-23
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Changed `line-height` from 1.2 to 1.1 for correct display in all browsers.
|
|
10
|
+
|
|
11
|
+
## [2.6.2] - 2021-8-26
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Add 'sideEffect=false' for more optimal build via webpack
|
|
16
|
+
|
|
17
|
+
## [2.6.1] - 2021-07-05
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Add default type for generic value
|
|
22
|
+
|
|
23
|
+
## [2.6.0] - 2021-06-08
|
|
24
|
+
|
|
25
|
+
### Changed
|
|
26
|
+
|
|
27
|
+
- Rewrite code from TS to JS 🧑💻
|
|
28
|
+
|
|
5
29
|
## [2.5.0] - 2021-04-28
|
|
6
30
|
|
|
7
31
|
### Added
|
package/lib/cjs/TabPanel.js
CHANGED
|
@@ -25,7 +25,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
25
25
|
|
|
26
26
|
var _core = _interopRequireWildcard(require("@semcore/core"));
|
|
27
27
|
|
|
28
|
-
var _react =
|
|
28
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
29
29
|
|
|
30
30
|
var _flexBox = require("@semcore/flex-box");
|
|
31
31
|
|
|
@@ -33,7 +33,7 @@ var _addonTextChildren = _interopRequireDefault(require("@semcore/utils/lib/addo
|
|
|
33
33
|
|
|
34
34
|
var _a11yEnhance = _interopRequireDefault(require("@semcore/utils/lib/enhances/a11yEnhance"));
|
|
35
35
|
|
|
36
|
-
var _keyboardFocusEnhance =
|
|
36
|
+
var _keyboardFocusEnhance = _interopRequireWildcard(require("@semcore/utils/lib/enhances/keyboardFocusEnhance"));
|
|
37
37
|
|
|
38
38
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
39
39
|
|
|
@@ -48,18 +48,18 @@ var style = (
|
|
|
48
48
|
/*__reshadow_css_start__*/
|
|
49
49
|
_core.sstyled.insert(
|
|
50
50
|
/*__inner_css_start__*/
|
|
51
|
-
".
|
|
51
|
+
".___STabPanel_1chaf_gg_{display:flex;width:100%;max-width:100%;border-bottom:1px solid #ccc}.___STabPanelItem_1chaf_gg_{position:relative;bottom:-1px;display:inline-flex;min-width:0;height:32px;font-size:14px;line-height:1.1;color:#666;border:1px solid transparent;border-radius:4px 4px 0 0;background:transparent;align-items:center;justify-content:center;touch-action:manipulation;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:border-box;padding:0;margin:0;box-shadow:none;outline:none;text-decoration:none;-webkit-tap-highlight-color:transparent;outline:0;text-align:center;vertical-align:middle;font-family:inherit;cursor:pointer}.___STabPanelItem_1chaf_gg_::-moz-focus-inner{border:none;padding:0}.___STabPanelItem_1chaf_gg_:active,.___STabPanelItem_1chaf_gg_:focus,.___STabPanelItem_1chaf_gg_:hover{outline:0;text-decoration:none}.___STabPanelItem_1chaf_gg_:hover{color:#333}.___STabPanelItem_1chaf_gg_.__disabled_1chaf_gg_{opacity:.3;cursor:default;pointer-events:none}.___STabPanelItem_1chaf_gg_.__keyboardFocused_1chaf_gg_{box-shadow:0 0 0 3px rgba(43,148,225,.3)}.___STabPanelItem_1chaf_gg_.__selected_1chaf_gg_{color:#0071bc;border-color:#ccc;border-bottom-color:#fff;flex-shrink:0}.___STabPanelItem_1chaf_gg_.__selected_1chaf_gg_:hover{color:#0071bc}.___SText_1chaf_gg_{display:inline-block;margin:auto 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.1}.___SAddon_1chaf_gg_{display:inline-flex;align-items:center;justify-content:center}.___SAddon_1chaf_gg_:not(:only-child):first-child{margin-left:8px}.___SAddon_1chaf_gg_:not(:only-child):last-child{margin-right:8px}"
|
|
52
52
|
/*__inner_css_end__*/
|
|
53
|
-
, "
|
|
53
|
+
, "1trgup5_gg_")
|
|
54
54
|
/*__reshadow_css_end__*/
|
|
55
55
|
, {
|
|
56
|
-
"__STabPanel": "
|
|
57
|
-
"__STabPanelItem": "
|
|
58
|
-
"_disabled": "
|
|
59
|
-
"_keyboardFocused": "
|
|
60
|
-
"
|
|
61
|
-
"__SText": "
|
|
62
|
-
"__SAddon": "
|
|
56
|
+
"__STabPanel": "___STabPanel_1chaf_gg_",
|
|
57
|
+
"__STabPanelItem": "___STabPanelItem_1chaf_gg_",
|
|
58
|
+
"_disabled": "__disabled_1chaf_gg_",
|
|
59
|
+
"_keyboardFocused": "__keyboardFocused_1chaf_gg_",
|
|
60
|
+
"_selected": "__selected_1chaf_gg_",
|
|
61
|
+
"__SText": "___SText_1chaf_gg_",
|
|
62
|
+
"__SAddon": "___SAddon_1chaf_gg_"
|
|
63
63
|
});
|
|
64
64
|
var optionsA11yEnhance = {
|
|
65
65
|
onNeighborChange: function onNeighborChange(neighborElement) {
|
|
@@ -144,14 +144,12 @@ function TabPanelItem(props) {
|
|
|
144
144
|
var STabPanelItem = _flexBox.Box;
|
|
145
145
|
var Children = props.Children,
|
|
146
146
|
styles = props.styles,
|
|
147
|
-
selected = props.selected,
|
|
148
147
|
addonLeft = props.addonLeft,
|
|
149
148
|
addonRight = props.addonRight;
|
|
150
149
|
return _ref6 = (0, _core.sstyled)(styles), /*#__PURE__*/_react["default"].createElement(STabPanelItem, _ref6.cn("STabPanelItem", _objectSpread({}, (0, _core.assignProps)({
|
|
151
150
|
"type": "button",
|
|
152
151
|
"tag": "button",
|
|
153
|
-
"role": "tab"
|
|
154
|
-
"active": selected
|
|
152
|
+
"role": "tab"
|
|
155
153
|
}, _ref2))), addonLeft ? /*#__PURE__*/_react["default"].createElement(TabPanel.Item.Addon, {
|
|
156
154
|
tag: addonLeft
|
|
157
155
|
}) : null, (0, _addonTextChildren["default"])(Children, TabPanel.Item.Text, TabPanel.Item.Addon), addonRight ? /*#__PURE__*/_react["default"].createElement(TabPanel.Item.Addon, {
|
package/lib/cjs/TabPanel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/TabPanel.
|
|
1
|
+
{"version":3,"sources":["../../src/TabPanel.js"],"names":["optionsA11yEnhance","onNeighborChange","neighborElement","focus","click","childSelector","TabPanelRoot","value","e","handlers","props","asProps","isSelected","selected","onClick","bindHandlerClick","tabIndex","STabPanel","Box","styles","Component","style","defaultValue","TabPanelItem","STabPanelItem","Children","addonLeft","addonRight","TabPanel","Item","Text","Addon","enhance","SText","SAddon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AADA;;AAUA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,IA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B,cAAvB;AACD;;AAED,IAAMS,QAAQ,GAAG,sBAAgBtB,YAAhB,EAA8B;AAC7CuB,EAAAA,IAAI,EAAE,CAACN,YAAD,EAAe;AAAEO,IAAAA,IAAI,EAAJA,IAAF;AAAQC,IAAAA,KAAK,EAALA;AAAR,GAAf;AADuC,CAA9B,CAAjB;eAIeH,Q","sourcesContent":["import React, { ComponentProps, HTMLAttributes } from 'react';\nimport createComponent, {\n Component,\n IFunctionProps,\n Merge,\n PropGetterFn,\n PropsAndRef,\n sstyled,\n Root,\n} from '@semcore/core';\nimport { Box, IBoxProps } from '@semcore/flex-box';\nimport addonTextChildren from '@semcore/utils/lib/addonTextChildren';\nimport a11yEnhance from '@semcore/utils/lib/enhances/a11yEnhance';\nimport keyboardFocusEnhance, {\n IKeyboardFocusProps,\n} from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\n\nimport style from './style/tab-panel.shadow.css';\n\nconst optionsA11yEnhance = {\n onNeighborChange: (neighborElement) => {\n if (neighborElement) {\n neighborElement.focus();\n neighborElement.click();\n }\n },\n childSelector: ['role', 'tab'],\n};\n\nclass TabPanelRoot extends Component {\n static displayName = 'TabPanel';\n static style = style;\n static defaultProps = {\n defaultValue: null,\n };\n static enhance = [a11yEnhance(optionsA11yEnhance)];\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n bindHandlerClick = (value) => (e) => {\n this.handlers.value(value, e);\n };\n\n getItemProps(props) {\n const { value } = this.asProps;\n const isSelected = value === props.value;\n return {\n selected: isSelected,\n onClick: this.bindHandlerClick(props.value),\n tabIndex: isSelected ? 0 : -1,\n 'aria-posinset': value,\n 'aria-selected': isSelected,\n };\n }\n\n render() {\n const STabPanel = Root;\n const { styles } = this.asProps;\n\n return sstyled(styles)(<STabPanel render={Box} role=\"tablist\" />);\n }\n}\n\nfunction TabPanelItem(props) {\n const STabPanelItem = Root;\n const { Children, styles, addonLeft, addonRight } = props;\n\n return sstyled(styles)(\n <STabPanelItem render={Box} type=\"button\" tag=\"button\" role=\"tab\">\n {addonLeft ? <TabPanel.Item.Addon tag={addonLeft} /> : null}\n {addonTextChildren(Children, TabPanel.Item.Text, TabPanel.Item.Addon)}\n {addonRight ? <TabPanel.Item.Addon tag={addonRight} /> : null}\n </STabPanelItem>,\n );\n}\n\nTabPanelItem.enhance = [keyboardFocusEnhance()];\n\nfunction Text(props) {\n const SText = Root;\n const { styles } = props;\n return sstyled(styles)(<SText render={Box} tag=\"span\" />);\n}\n\nfunction Addon(props) {\n const SAddon = Root;\n const { styles } = props;\n return sstyled(styles)(<SAddon render={Box} tag=\"span\" />);\n}\n\nconst TabPanel = createComponent(TabPanelRoot, {\n Item: [TabPanelItem, { Text, Addon }],\n});\n\nexport default TabPanel;\n"],"file":"TabPanel.js"}
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.
|
|
1
|
+
{"version":3,"sources":["../../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA","sourcesContent":["export { default } from './TabPanel';\nexport * from './TabPanel';\n"],"file":"index.js"}
|
|
@@ -14,7 +14,7 @@ STabPanelItem {
|
|
|
14
14
|
min-width: 0;
|
|
15
15
|
height: 32px;
|
|
16
16
|
font-size: var(--fs-200);
|
|
17
|
-
line-height: 1.
|
|
17
|
+
line-height: 1.1;
|
|
18
18
|
color: var(--gray40);
|
|
19
19
|
border: 1px solid transparent;
|
|
20
20
|
border-radius: 4px 4px 0 0;
|
|
@@ -63,7 +63,7 @@ STabPanelItem[keyboardFocused] {
|
|
|
63
63
|
box-shadow: var(--keyborad-focus);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
STabPanelItem[
|
|
66
|
+
STabPanelItem[selected] {
|
|
67
67
|
color: var(--denim-blue);
|
|
68
68
|
border-color: var(--gray80);
|
|
69
69
|
border-bottom-color: white;
|
|
@@ -80,7 +80,7 @@ SText {
|
|
|
80
80
|
white-space: nowrap;
|
|
81
81
|
overflow: hidden;
|
|
82
82
|
text-overflow: ellipsis;
|
|
83
|
-
line-height: 1.
|
|
83
|
+
line-height: 1.1;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
SAddon {
|
package/lib/es6/TabPanel.js
CHANGED
|
@@ -19,30 +19,30 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
19
19
|
|
|
20
20
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
21
21
|
|
|
22
|
-
import React from 'react';
|
|
23
|
-
import createComponent, { Component, sstyled, Root } from '@semcore/core';
|
|
24
|
-
import { Box } from '@semcore/flex-box';
|
|
22
|
+
import React, { ComponentProps, HTMLAttributes } from 'react';
|
|
23
|
+
import createComponent, { Component, IFunctionProps, Merge, PropGetterFn, PropsAndRef, sstyled, Root } from '@semcore/core';
|
|
24
|
+
import { Box, IBoxProps } from '@semcore/flex-box';
|
|
25
25
|
import addonTextChildren from '@semcore/utils/lib/addonTextChildren';
|
|
26
26
|
import a11yEnhance from '@semcore/utils/lib/enhances/a11yEnhance';
|
|
27
|
-
import keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
27
|
+
import keyboardFocusEnhance, { IKeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
28
28
|
|
|
29
29
|
/*__reshadow-styles__:"./style/tab-panel.shadow.css"*/
|
|
30
30
|
var style = (
|
|
31
31
|
/*__reshadow_css_start__*/
|
|
32
32
|
_sstyled.insert(
|
|
33
33
|
/*__inner_css_start__*/
|
|
34
|
-
".
|
|
34
|
+
".___STabPanel_1chaf_gg_{display:flex;width:100%;max-width:100%;border-bottom:1px solid #ccc}.___STabPanelItem_1chaf_gg_{position:relative;bottom:-1px;display:inline-flex;min-width:0;height:32px;font-size:14px;line-height:1.1;color:#666;border:1px solid transparent;border-radius:4px 4px 0 0;background:transparent;align-items:center;justify-content:center;touch-action:manipulation;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:border-box;padding:0;margin:0;box-shadow:none;outline:none;text-decoration:none;-webkit-tap-highlight-color:transparent;outline:0;text-align:center;vertical-align:middle;font-family:inherit;cursor:pointer}.___STabPanelItem_1chaf_gg_::-moz-focus-inner{border:none;padding:0}.___STabPanelItem_1chaf_gg_:active,.___STabPanelItem_1chaf_gg_:focus,.___STabPanelItem_1chaf_gg_:hover{outline:0;text-decoration:none}.___STabPanelItem_1chaf_gg_:hover{color:#333}.___STabPanelItem_1chaf_gg_.__disabled_1chaf_gg_{opacity:.3;cursor:default;pointer-events:none}.___STabPanelItem_1chaf_gg_.__keyboardFocused_1chaf_gg_{box-shadow:0 0 0 3px rgba(43,148,225,.3)}.___STabPanelItem_1chaf_gg_.__selected_1chaf_gg_{color:#0071bc;border-color:#ccc;border-bottom-color:#fff;flex-shrink:0}.___STabPanelItem_1chaf_gg_.__selected_1chaf_gg_:hover{color:#0071bc}.___SText_1chaf_gg_{display:inline-block;margin:auto 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:1.1}.___SAddon_1chaf_gg_{display:inline-flex;align-items:center;justify-content:center}.___SAddon_1chaf_gg_:not(:only-child):first-child{margin-left:8px}.___SAddon_1chaf_gg_:not(:only-child):last-child{margin-right:8px}"
|
|
35
35
|
/*__inner_css_end__*/
|
|
36
|
-
, "
|
|
36
|
+
, "1trgup5_gg_")
|
|
37
37
|
/*__reshadow_css_end__*/
|
|
38
38
|
, {
|
|
39
|
-
"__STabPanel": "
|
|
40
|
-
"__STabPanelItem": "
|
|
41
|
-
"_disabled": "
|
|
42
|
-
"_keyboardFocused": "
|
|
43
|
-
"
|
|
44
|
-
"__SText": "
|
|
45
|
-
"__SAddon": "
|
|
39
|
+
"__STabPanel": "___STabPanel_1chaf_gg_",
|
|
40
|
+
"__STabPanelItem": "___STabPanelItem_1chaf_gg_",
|
|
41
|
+
"_disabled": "__disabled_1chaf_gg_",
|
|
42
|
+
"_keyboardFocused": "__keyboardFocused_1chaf_gg_",
|
|
43
|
+
"_selected": "__selected_1chaf_gg_",
|
|
44
|
+
"__SText": "___SText_1chaf_gg_",
|
|
45
|
+
"__SAddon": "___SAddon_1chaf_gg_"
|
|
46
46
|
});
|
|
47
47
|
var optionsA11yEnhance = {
|
|
48
48
|
onNeighborChange: function onNeighborChange(neighborElement) {
|
|
@@ -133,14 +133,12 @@ function TabPanelItem(props) {
|
|
|
133
133
|
var STabPanelItem = Box;
|
|
134
134
|
var Children = props.Children,
|
|
135
135
|
styles = props.styles,
|
|
136
|
-
selected = props.selected,
|
|
137
136
|
addonLeft = props.addonLeft,
|
|
138
137
|
addonRight = props.addonRight;
|
|
139
138
|
return _ref6 = sstyled(styles), /*#__PURE__*/React.createElement(STabPanelItem, _ref6.cn("STabPanelItem", _objectSpread({}, _assignProps2({
|
|
140
139
|
"type": "button",
|
|
141
140
|
"tag": "button",
|
|
142
|
-
"role": "tab"
|
|
143
|
-
"active": selected
|
|
141
|
+
"role": "tab"
|
|
144
142
|
}, _ref2))), addonLeft ? /*#__PURE__*/React.createElement(TabPanel.Item.Addon, {
|
|
145
143
|
tag: addonLeft
|
|
146
144
|
}) : null, addonTextChildren(Children, TabPanel.Item.Text, TabPanel.Item.Addon), addonRight ? /*#__PURE__*/React.createElement(TabPanel.Item.Addon, {
|
package/lib/es6/TabPanel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/TabPanel.
|
|
1
|
+
{"version":3,"sources":["../../src/TabPanel.js"],"names":["React","ComponentProps","HTMLAttributes","createComponent","Component","IFunctionProps","Merge","PropGetterFn","PropsAndRef","sstyled","Root","Box","IBoxProps","addonTextChildren","a11yEnhance","keyboardFocusEnhance","IKeyboardFocusProps","optionsA11yEnhance","onNeighborChange","neighborElement","focus","click","childSelector","TabPanelRoot","value","e","handlers","props","asProps","isSelected","selected","onClick","bindHandlerClick","tabIndex","STabPanel","styles","style","defaultValue","TabPanelItem","STabPanelItem","Children","addonLeft","addonRight","TabPanel","Item","Text","Addon","enhance","SText","SAddon"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,cAAhB,EAAgCC,cAAhC,QAAsD,OAAtD;AACA,OAAOC,eAAP,IACEC,SADF,EAEEC,cAFF,EAGEC,KAHF,EAIEC,YAJF,EAKEC,WALF,EAMEC,OANF,EAOEC,IAPF,QAQO,eARP;AASA,SAASC,GAAT,EAAcC,SAAd,QAA+B,mBAA/B;AACA,OAAOC,iBAAP,MAA8B,sCAA9B;AACA,OAAOC,WAAP,MAAwB,yCAAxB;AACA,OAAOC,oBAAP,IACEC,mBADF,QAEO,kDAFP;;;;;;;;;;;;;;;;;;;;AAMA,IAAMC,kBAAkB,GAAG;AACzBC,EAAAA,gBAAgB,EAAE,0BAACC,eAAD,EAAqB;AACrC,QAAIA,eAAJ,EAAqB;AACnBA,MAAAA,eAAe,CAACC,KAAhB;AACAD,MAAAA,eAAe,CAACE,KAAhB;AACD;AACF,GANwB;AAOzBC,EAAAA,aAAa,EAAE,CAAC,MAAD,EAAS,KAAT;AAPU,CAA3B;;IAUMC,Y;;;;;;;;;;;;;;;;uEAce,UAACC,KAAD;AAAA,aAAW,UAACC,CAAD,EAAO;AACnC,cAAKC,QAAL,CAAcF,KAAd,CAAoBA,KAApB,EAA2BC,CAA3B;AACD,OAFkB;AAAA,K;;;;;;;WANnB,6BAAoB;AAClB,aAAO;AACLD,QAAAA,KAAK,EAAE;AADF,OAAP;AAGD;;;WAMD,sBAAaG,KAAb,EAAoB;AAAA,UACVH,KADU,GACA,KAAKI,OADL,CACVJ,KADU;AAElB,UAAMK,UAAU,GAAGL,KAAK,KAAKG,KAAK,CAACH,KAAnC;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QAAQ,CAACC,IAAT,CAAcE,KAA7C,CAFpB,EAGGJ,UAAU,gBAAG,oBAAC,QAAD,CAAU,IAAV,CAAe,KAAf;AAAqB,IAAA,GAAG,EAAEA;AAA1B,IAAH,GAA8C,IAH3D,CADF;AAOD;;AAEDJ,YAAY,CAACS,OAAb,GAAuB,CAAChC,oBAAoB,EAArB,CAAvB;;AAEA,SAAS8B,IAAT,CAAclB,KAAd,EAAqB;AAAA;AAAA;;AACnB,MAAMqB,KAAK,GAE2BrC,GAFtC;AADmB,MAEXwB,MAFW,GAEAR,KAFA,CAEXQ,MAFW;AAGnB,iBAAO1B,OAAO,CAAC0B,MAAD,CAAd,eAAuB,oBAAC,KAAD;AAAA,WAAwB;AAAxB,cAAvB;AACD;;AAED,SAASW,KAAT,CAAenB,KAAf,EAAsB;AAAA;AAAA;;AACpB,MAAMsB,MAAM,GAE2BtC,GAFvC;AADoB,MAEZwB,MAFY,GAEDR,KAFC,CAEZQ,MAFY;AAGpB,iBAAO1B,OAAO,CAAC0B,MAAD,CAAd,eAAuB,oBAAC,MAAD;AAAA,WAAyB;AAAzB,cAAvB;AACD;;AAED,IAAMQ,QAAQ,GAAGxC,eAAe,CAACoB,YAAD,EAAe;AAC7CqB,EAAAA,IAAI,EAAE,CAACN,YAAD,EAAe;AAAEO,IAAAA,IAAI,EAAJA,IAAF;AAAQC,IAAAA,KAAK,EAALA;AAAR,GAAf;AADuC,CAAf,CAAhC;AAIA,eAAeH,QAAf","sourcesContent":["import React, { ComponentProps, HTMLAttributes } from 'react';\nimport createComponent, {\n Component,\n IFunctionProps,\n Merge,\n PropGetterFn,\n PropsAndRef,\n sstyled,\n Root,\n} from '@semcore/core';\nimport { Box, IBoxProps } from '@semcore/flex-box';\nimport addonTextChildren from '@semcore/utils/lib/addonTextChildren';\nimport a11yEnhance from '@semcore/utils/lib/enhances/a11yEnhance';\nimport keyboardFocusEnhance, {\n IKeyboardFocusProps,\n} from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\n\nimport style from './style/tab-panel.shadow.css';\n\nconst optionsA11yEnhance = {\n onNeighborChange: (neighborElement) => {\n if (neighborElement) {\n neighborElement.focus();\n neighborElement.click();\n }\n },\n childSelector: ['role', 'tab'],\n};\n\nclass TabPanelRoot extends Component {\n static displayName = 'TabPanel';\n static style = style;\n static defaultProps = {\n defaultValue: null,\n };\n static enhance = [a11yEnhance(optionsA11yEnhance)];\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n bindHandlerClick = (value) => (e) => {\n this.handlers.value(value, e);\n };\n\n getItemProps(props) {\n const { value } = this.asProps;\n const isSelected = value === props.value;\n return {\n selected: isSelected,\n onClick: this.bindHandlerClick(props.value),\n tabIndex: isSelected ? 0 : -1,\n 'aria-posinset': value,\n 'aria-selected': isSelected,\n };\n }\n\n render() {\n const STabPanel = Root;\n const { styles } = this.asProps;\n\n return sstyled(styles)(<STabPanel render={Box} role=\"tablist\" />);\n }\n}\n\nfunction TabPanelItem(props) {\n const STabPanelItem = Root;\n const { Children, styles, addonLeft, addonRight } = props;\n\n return sstyled(styles)(\n <STabPanelItem render={Box} type=\"button\" tag=\"button\" role=\"tab\">\n {addonLeft ? <TabPanel.Item.Addon tag={addonLeft} /> : null}\n {addonTextChildren(Children, TabPanel.Item.Text, TabPanel.Item.Addon)}\n {addonRight ? <TabPanel.Item.Addon tag={addonRight} /> : null}\n </STabPanelItem>,\n );\n}\n\nTabPanelItem.enhance = [keyboardFocusEnhance()];\n\nfunction Text(props) {\n const SText = Root;\n const { styles } = props;\n return sstyled(styles)(<SText render={Box} tag=\"span\" />);\n}\n\nfunction Addon(props) {\n const SAddon = Root;\n const { styles } = props;\n return sstyled(styles)(<SAddon render={Box} tag=\"span\" />);\n}\n\nconst TabPanel = createComponent(TabPanelRoot, {\n Item: [TabPanelItem, { Text, Addon }],\n});\n\nexport default TabPanel;\n"],"file":"TabPanel.js"}
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/index.
|
|
1
|
+
{"version":3,"sources":["../../src/index.js"],"names":["default"],"mappings":"AAAA,SAASA,OAAT,QAAwB,YAAxB;AACA,cAAc,YAAd","sourcesContent":["export { default } from './TabPanel';\nexport * from './TabPanel';\n"],"file":"index.js"}
|
|
@@ -14,7 +14,7 @@ STabPanelItem {
|
|
|
14
14
|
min-width: 0;
|
|
15
15
|
height: 32px;
|
|
16
16
|
font-size: var(--fs-200);
|
|
17
|
-
line-height: 1.
|
|
17
|
+
line-height: 1.1;
|
|
18
18
|
color: var(--gray40);
|
|
19
19
|
border: 1px solid transparent;
|
|
20
20
|
border-radius: 4px 4px 0 0;
|
|
@@ -63,7 +63,7 @@ STabPanelItem[keyboardFocused] {
|
|
|
63
63
|
box-shadow: var(--keyborad-focus);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
STabPanelItem[
|
|
66
|
+
STabPanelItem[selected] {
|
|
67
67
|
color: var(--denim-blue);
|
|
68
68
|
border-color: var(--gray80);
|
|
69
69
|
border-bottom-color: white;
|
|
@@ -80,7 +80,7 @@ SText {
|
|
|
80
80
|
white-space: nowrap;
|
|
81
81
|
overflow: hidden;
|
|
82
82
|
text-overflow: ellipsis;
|
|
83
|
-
line-height: 1.
|
|
83
|
+
line-height: 1.1;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
SAddon {
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,2 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CProps, PropGetterFn, ReturnEl } from '@semcore/core';
|
|
3
|
+
import { Box, IBoxProps } from '@semcore/flex-box';
|
|
4
|
+
import { IKeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
5
|
+
|
|
6
|
+
export type TabPanelValue = string | number | boolean;
|
|
7
|
+
|
|
8
|
+
export interface ITabPanelProps<T extends TabPanelValue = TabPanelValue> extends IBoxProps {
|
|
9
|
+
/** Is invoked when changing the selection */
|
|
10
|
+
onChange?: (value: T, e?: React.SyntheticEvent<HTMLButtonElement>) => void;
|
|
11
|
+
/** Value of the selected tab */
|
|
12
|
+
value?: T;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ITabPanelItemProps extends IBoxProps, IKeyboardFocusProps {
|
|
16
|
+
/** Makes a tab selected. This property is determined automatically depending on the value. */
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
/** Disabled state */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** Left addon tag */
|
|
21
|
+
addonLeft?: React.ElementType;
|
|
22
|
+
/** Right addon tag */
|
|
23
|
+
addonRight?: React.ElementType;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ITabPanelContext {
|
|
27
|
+
getItemProps: PropGetterFn;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ITabPanelHandlers {
|
|
31
|
+
value: (value: TabPanelValue) => void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare const TabPanel: (<T, V extends TabPanelValue = TabPanelValue>(
|
|
35
|
+
props: CProps<ITabPanelProps<V> & T, ITabPanelContext, ITabPanelHandlers>,
|
|
36
|
+
) => ReturnEl) & {
|
|
37
|
+
Item: (<T>(props: CProps<ITabPanelItemProps & T, {}, ITabPanelHandlers>) => ReturnEl) & {
|
|
38
|
+
Text: typeof Box;
|
|
39
|
+
Addon: typeof Box;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default TabPanel;
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/tab-panel",
|
|
3
3
|
"description": "SEMRush TabPanel Component",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.6.3",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
8
9
|
"author": "Roman Lysov <r.lysov@semrush.com>",
|
|
9
10
|
"license": "MIT",
|
|
10
11
|
"scripts": {
|
|
11
|
-
"build": "build",
|
|
12
|
+
"build": "build --source=js",
|
|
12
13
|
"test": "jest"
|
|
13
14
|
},
|
|
14
15
|
"dependencies": {
|
|
@@ -17,31 +17,6 @@ import keyboardFocusEnhance, {
|
|
|
17
17
|
|
|
18
18
|
import style from './style/tab-panel.shadow.css';
|
|
19
19
|
|
|
20
|
-
export type TabPanelValue = string | number | boolean;
|
|
21
|
-
|
|
22
|
-
export interface ITabPanelProps<T extends TabPanelValue = TabPanelValue>
|
|
23
|
-
extends IBoxProps {
|
|
24
|
-
/** Is invoked when changing the selection */
|
|
25
|
-
onChange?: (value: T, e?: React.SyntheticEvent<HTMLButtonElement>) => void;
|
|
26
|
-
/** Value of the selected tab */
|
|
27
|
-
value?: T;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface ITabPanelItemProps extends IBoxProps, IKeyboardFocusProps {
|
|
31
|
-
/** Makes a tab selected. This property is determined automatically depending on the value. */
|
|
32
|
-
selected?: boolean;
|
|
33
|
-
/** Disabled state */
|
|
34
|
-
disabled?: boolean;
|
|
35
|
-
/** Left addon tag */
|
|
36
|
-
addonLeft?: React.ElementType;
|
|
37
|
-
/** Right addon tag */
|
|
38
|
-
addonRight?: React.ElementType;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface ITabPanelContext {
|
|
42
|
-
getItemProps: PropGetterFn;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
20
|
const optionsA11yEnhance = {
|
|
46
21
|
onNeighborChange: (neighborElement) => {
|
|
47
22
|
if (neighborElement) {
|
|
@@ -52,7 +27,7 @@ const optionsA11yEnhance = {
|
|
|
52
27
|
childSelector: ['role', 'tab'],
|
|
53
28
|
};
|
|
54
29
|
|
|
55
|
-
class TabPanelRoot extends Component
|
|
30
|
+
class TabPanelRoot extends Component {
|
|
56
31
|
static displayName = 'TabPanel';
|
|
57
32
|
static style = style;
|
|
58
33
|
static defaultProps = {
|
|
@@ -90,22 +65,16 @@ class TabPanelRoot extends Component<ITabPanelProps> {
|
|
|
90
65
|
}
|
|
91
66
|
}
|
|
92
67
|
|
|
93
|
-
function TabPanelItem(props
|
|
68
|
+
function TabPanelItem(props) {
|
|
94
69
|
const STabPanelItem = Root;
|
|
95
|
-
const { Children, styles,
|
|
70
|
+
const { Children, styles, addonLeft, addonRight } = props;
|
|
96
71
|
|
|
97
72
|
return sstyled(styles)(
|
|
98
|
-
<STabPanelItem
|
|
99
|
-
render={Box}
|
|
100
|
-
type="button"
|
|
101
|
-
tag="button"
|
|
102
|
-
role="tab"
|
|
103
|
-
active={selected}
|
|
104
|
-
>
|
|
73
|
+
<STabPanelItem render={Box} type="button" tag="button" role="tab">
|
|
105
74
|
{addonLeft ? <TabPanel.Item.Addon tag={addonLeft} /> : null}
|
|
106
75
|
{addonTextChildren(Children, TabPanel.Item.Text, TabPanel.Item.Addon)}
|
|
107
76
|
{addonRight ? <TabPanel.Item.Addon tag={addonRight} /> : null}
|
|
108
|
-
</STabPanelItem
|
|
77
|
+
</STabPanelItem>,
|
|
109
78
|
);
|
|
110
79
|
}
|
|
111
80
|
|
|
@@ -123,26 +92,7 @@ function Addon(props) {
|
|
|
123
92
|
return sstyled(styles)(<SAddon render={Box} tag="span" />);
|
|
124
93
|
}
|
|
125
94
|
|
|
126
|
-
const TabPanel = createComponent
|
|
127
|
-
TabPanelRoot,
|
|
128
|
-
{
|
|
129
|
-
Item: [
|
|
130
|
-
Merge<ITabPanelItemProps, HTMLAttributes<HTMLButtonElement>>,
|
|
131
|
-
{
|
|
132
|
-
Text: ComponentProps<typeof Box>;
|
|
133
|
-
Addon: ComponentProps<typeof Box>;
|
|
134
|
-
}
|
|
135
|
-
];
|
|
136
|
-
},
|
|
137
|
-
ITabPanelContext,
|
|
138
|
-
<T extends TabPanelValue = TabPanelValue>(
|
|
139
|
-
props: PropsAndRef<
|
|
140
|
-
ITabPanelProps<T>,
|
|
141
|
-
ITabPanelContext,
|
|
142
|
-
ReturnType<TabPanelRoot['uncontrolledProps']>
|
|
143
|
-
>
|
|
144
|
-
) => React.ReactElement
|
|
145
|
-
>(TabPanelRoot, {
|
|
95
|
+
const TabPanel = createComponent(TabPanelRoot, {
|
|
146
96
|
Item: [TabPanelItem, { Text, Addon }],
|
|
147
97
|
});
|
|
148
98
|
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CProps, PropGetterFn, ReturnEl } from '@semcore/core';
|
|
3
|
+
import { Box, IBoxProps } from '@semcore/flex-box';
|
|
4
|
+
import { IKeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
5
|
+
|
|
6
|
+
export type TabPanelValue = string | number | boolean;
|
|
7
|
+
|
|
8
|
+
export interface ITabPanelProps<T extends TabPanelValue = TabPanelValue> extends IBoxProps {
|
|
9
|
+
/** Is invoked when changing the selection */
|
|
10
|
+
onChange?: (value: T, e?: React.SyntheticEvent<HTMLButtonElement>) => void;
|
|
11
|
+
/** Value of the selected tab */
|
|
12
|
+
value?: T;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ITabPanelItemProps extends IBoxProps, IKeyboardFocusProps {
|
|
16
|
+
/** Makes a tab selected. This property is determined automatically depending on the value. */
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
/** Disabled state */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** Left addon tag */
|
|
21
|
+
addonLeft?: React.ElementType;
|
|
22
|
+
/** Right addon tag */
|
|
23
|
+
addonRight?: React.ElementType;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ITabPanelContext {
|
|
27
|
+
getItemProps: PropGetterFn;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface ITabPanelHandlers {
|
|
31
|
+
value: (value: TabPanelValue) => void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare const TabPanel: (<T, V extends TabPanelValue = TabPanelValue>(
|
|
35
|
+
props: CProps<ITabPanelProps<V> & T, ITabPanelContext, ITabPanelHandlers>,
|
|
36
|
+
) => ReturnEl) & {
|
|
37
|
+
Item: (<T>(props: CProps<ITabPanelItemProps & T, {}, ITabPanelHandlers>) => ReturnEl) & {
|
|
38
|
+
Text: typeof Box;
|
|
39
|
+
Addon: typeof Box;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export default TabPanel;
|
|
File without changes
|
|
@@ -14,7 +14,7 @@ STabPanelItem {
|
|
|
14
14
|
min-width: 0;
|
|
15
15
|
height: 32px;
|
|
16
16
|
font-size: var(--fs-200);
|
|
17
|
-
line-height: 1.
|
|
17
|
+
line-height: 1.1;
|
|
18
18
|
color: var(--gray40);
|
|
19
19
|
border: 1px solid transparent;
|
|
20
20
|
border-radius: 4px 4px 0 0;
|
|
@@ -63,7 +63,7 @@ STabPanelItem[keyboardFocused] {
|
|
|
63
63
|
box-shadow: var(--keyborad-focus);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
STabPanelItem[
|
|
66
|
+
STabPanelItem[selected] {
|
|
67
67
|
color: var(--denim-blue);
|
|
68
68
|
border-color: var(--gray80);
|
|
69
69
|
border-bottom-color: white;
|
|
@@ -80,7 +80,7 @@ SText {
|
|
|
80
80
|
white-space: nowrap;
|
|
81
81
|
overflow: hidden;
|
|
82
82
|
text-overflow: ellipsis;
|
|
83
|
-
line-height: 1.
|
|
83
|
+
line-height: 1.1;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
SAddon {
|
package/lib/types/TabPanel.d.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import React, { ComponentProps, HTMLAttributes } from 'react';
|
|
2
|
-
import { Component, Merge, PropGetterFn, PropsAndRef } from '@semcore/core';
|
|
3
|
-
import { Box, IBoxProps } from '@semcore/flex-box';
|
|
4
|
-
import { IKeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
5
|
-
export declare type TabPanelValue = string | number | boolean;
|
|
6
|
-
export interface ITabPanelProps<T extends TabPanelValue = TabPanelValue> extends IBoxProps {
|
|
7
|
-
/** Is invoked when changing the selection */
|
|
8
|
-
onChange?: (value: T, e?: React.SyntheticEvent<HTMLButtonElement>) => void;
|
|
9
|
-
/** Value of the selected tab */
|
|
10
|
-
value?: T;
|
|
11
|
-
}
|
|
12
|
-
export interface ITabPanelItemProps extends IBoxProps, IKeyboardFocusProps {
|
|
13
|
-
/** Makes a tab selected. This property is determined automatically depending on the value. */
|
|
14
|
-
selected?: boolean;
|
|
15
|
-
/** Disabled state */
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
/** Left addon tag */
|
|
18
|
-
addonLeft?: React.ElementType;
|
|
19
|
-
/** Right addon tag */
|
|
20
|
-
addonRight?: React.ElementType;
|
|
21
|
-
}
|
|
22
|
-
export interface ITabPanelContext {
|
|
23
|
-
getItemProps: PropGetterFn;
|
|
24
|
-
}
|
|
25
|
-
declare class TabPanelRoot extends Component<ITabPanelProps> {
|
|
26
|
-
static displayName: string;
|
|
27
|
-
static style: {
|
|
28
|
-
[key: string]: string;
|
|
29
|
-
};
|
|
30
|
-
static defaultProps: {
|
|
31
|
-
defaultValue: any;
|
|
32
|
-
};
|
|
33
|
-
static enhance: ((props: any) => any)[];
|
|
34
|
-
uncontrolledProps(): {
|
|
35
|
-
value: any;
|
|
36
|
-
};
|
|
37
|
-
bindHandlerClick: (value: any) => (e: any) => void;
|
|
38
|
-
getItemProps(props: any): {
|
|
39
|
-
selected: boolean;
|
|
40
|
-
onClick: (e: any) => void;
|
|
41
|
-
tabIndex: number;
|
|
42
|
-
'aria-posinset': TabPanelValue;
|
|
43
|
-
'aria-selected': boolean;
|
|
44
|
-
};
|
|
45
|
-
render(): React.ReactNode;
|
|
46
|
-
}
|
|
47
|
-
declare function Text(props: any): React.ReactNode;
|
|
48
|
-
declare function Addon(props: any): React.ReactNode;
|
|
49
|
-
declare const TabPanel: import("@semcore/core").ComponentType<ITabPanelProps<TabPanelValue>, {
|
|
50
|
-
Item: [Merge<ITabPanelItemProps, HTMLAttributes<HTMLButtonElement>>, {
|
|
51
|
-
Text: ComponentProps<typeof Box>;
|
|
52
|
-
Addon: ComponentProps<typeof Box>;
|
|
53
|
-
}];
|
|
54
|
-
}, ITabPanelContext, {
|
|
55
|
-
value: any;
|
|
56
|
-
}, <T extends TabPanelValue = TabPanelValue>(props: PropsAndRef<ITabPanelProps<T>, ITabPanelContext, {
|
|
57
|
-
value: any;
|
|
58
|
-
}>) => React.ReactElement>;
|
|
59
|
-
export default TabPanel;
|