@semcore/tab-panel 3.0.8 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -34
- package/LICENSE +21 -0
- package/lib/cjs/TabPanel.js +9 -9
- package/lib/cjs/index.d.js +2 -0
- package/lib/cjs/index.d.js.map +1 -0
- package/lib/cjs/style/tab-panel.shadow.css +5 -0
- package/lib/es6/TabPanel.js +9 -9
- package/lib/es6/index.d.js +2 -0
- package/lib/es6/index.d.js.map +1 -0
- package/lib/es6/style/tab-panel.shadow.css +5 -0
- package/package.json +10 -8
- package/lib/cjs/index.d.ts +0 -49
- package/lib/es6/index.d.ts +0 -49
package/CHANGELOG.md
CHANGED
|
@@ -2,53 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
-
## [3.0
|
|
6
|
-
|
|
7
|
-
### Fixed
|
|
8
|
-
|
|
9
|
-
- Enforced inner text font line height to prevent possible bottom cut.
|
|
10
|
-
|
|
11
|
-
## [3.0.7] - 2022-08-30
|
|
12
|
-
|
|
13
|
-
### Changed
|
|
14
|
-
|
|
15
|
-
- Version patch update due to children dependencies update (`@semcore/utils` [3.37.0 ~> 3.37.1], `@semcore/flex-box` [4.5.10 ~> 4.5.11]).
|
|
16
|
-
|
|
17
|
-
## [3.0.6] - 2022-08-18
|
|
18
|
-
|
|
19
|
-
### Changed
|
|
20
|
-
|
|
21
|
-
- Version patch update due to children dependencies update (`@semcore/utils` [3.36.0 ~> 3.37.0], `@semcore/flex-box` [4.5.9 ~> 4.5.10]).
|
|
22
|
-
|
|
23
|
-
## [3.0.5] - 2022-08-11
|
|
5
|
+
## [3.1.0] - 2022-10-10
|
|
24
6
|
|
|
25
7
|
### Changed
|
|
26
8
|
|
|
27
|
-
-
|
|
9
|
+
- Added support for React 18 🔥
|
|
28
10
|
|
|
29
|
-
## [3.0.
|
|
30
|
-
|
|
31
|
-
### Changed
|
|
11
|
+
## [3.0.9] - 2022-09-30
|
|
32
12
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
## [3.0.3] - 2022-06-02
|
|
36
|
-
|
|
37
|
-
### Changed
|
|
13
|
+
### Added
|
|
38
14
|
|
|
39
|
-
-
|
|
15
|
+
- Added styles for panel consisting only of an icon.
|
|
40
16
|
|
|
41
|
-
## [3.0.
|
|
17
|
+
## [3.0.8] - 2022-09-07
|
|
42
18
|
|
|
43
|
-
###
|
|
19
|
+
### Fixed
|
|
44
20
|
|
|
45
|
-
-
|
|
21
|
+
- Enforced inner text font line height to prevent possible bottom cut.
|
|
46
22
|
|
|
47
|
-
## [3.0.
|
|
23
|
+
## [3.0.7] - 2022-08-30
|
|
48
24
|
|
|
49
25
|
### Changed
|
|
50
26
|
|
|
51
|
-
- Version patch update due to children dependencies update (`@semcore/utils` [3.
|
|
27
|
+
- Version patch update due to children dependencies update (`@semcore/utils` [3.37.0 ~> 3.37.1], `@semcore/flex-box` [4.5.10 ~> 4.5.11]).
|
|
52
28
|
|
|
53
29
|
## [3.0.0] - 2022-05-17
|
|
54
30
|
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright ©, 2022, Semrush Inc. (written by Roman Lysov, Sergey Kobets, Mikhail Karachev, Julia Mnizhek, Elena Krasnopolskaia, Mikhail Sereniti).
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/lib/cjs/TabPanel.js
CHANGED
|
@@ -52,18 +52,18 @@ var style = (
|
|
|
52
52
|
/*__reshadow_css_start__*/
|
|
53
53
|
_core.sstyled.insert(
|
|
54
54
|
/*__inner_css_start__*/
|
|
55
|
-
".
|
|
55
|
+
":root {\n\n /* DEPRECATED START\n Deprecated variables should never be used in\n components styles but preserved for backward\n compatibility if they used in projects\n like `<Badge bg=\"red\">alpha</Badge>`\n */\n /* DEPRECATED END */\n}\n\n.___STabPanel_1lff2_gg_ {\n display: flex;\n width: 100%;\n max-width: 100%;\n border-bottom: 1px solid #c4c7cf;\n}\n\n.___STabPanelItem_1lff2_gg_ {\n position: relative;\n bottom: -1px;\n display: inline-flex;\n min-width: 0;\n height: 32px;\n color: #6c6e79;\n border: 1px solid transparent;\n border-radius: 6px 6px 0 0;\n background: transparent;\n align-items: center;\n justify-content: center;\n touch-action: manipulation;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n box-shadow: none;\n outline: none;\n text-decoration: none;\n -webkit-tap-highlight-color: transparent;\n outline: 0;\n text-align: center;\n vertical-align: middle;\n font-family: inherit;\n cursor: pointer\n}\n\n.___STabPanelItem_1lff2_gg_ .___SText_1lff2_gg_ {\n font-size: 14px;\n line-height: 1.42;\n }\n\n.___STabPanelItem_1lff2_gg_::-moz-focus-inner {\n border: none;\n padding: 0;\n }\n\n.___STabPanelItem_1lff2_gg_:active,\n .___STabPanelItem_1lff2_gg_:hover,\n .___STabPanelItem_1lff2_gg_:focus {\n outline: 0;\n text-decoration: none;\n }\n\n.___STabPanelItem_1lff2_gg_:hover {\n color: #191b23;\n }\n\n.___STabPanelItem_1lff2_gg_.__disabled_1lff2_gg_ {\n opacity: 0.3;\n cursor: default;\n pointer-events: none; /* Disable link interactions */\n}\n\n.___STabPanelItem_1lff2_gg_.__keyboardFocused_1lff2_gg_ {\n box-shadow: 0 0 0 3px rgba(0, 143, 248, 0.2);\n}\n\n.___STabPanelItem_1lff2_gg_.__selected_1lff2_gg_ {\n color: #006dca;\n border-color: #c4c7cf;\n border-bottom-color: #ffffff;\n flex-shrink: 0\n}\n\n.___STabPanelItem_1lff2_gg_.__selected_1lff2_gg_:hover {\n color: #006dca;\n }\n\n.___SText_1lff2_gg_ {\n display: inline-block;\n margin: auto 8px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.___SAddon_1lff2_gg_ {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n.___SAddon_1lff2_gg_:not(:only-child):first-child {\n margin-left: 8px;\n}\n\n.___SAddon_1lff2_gg_:not(:only-child):last-child {\n margin-right: 8px;\n}\n\n.___SAddon_1lff2_gg_:only-child {\n margin-right: 8px;\n margin-left: 8px;\n}\n"
|
|
56
56
|
/*__inner_css_end__*/
|
|
57
|
-
, "
|
|
57
|
+
, "1lff2_gg_")
|
|
58
58
|
/*__reshadow_css_end__*/
|
|
59
59
|
, {
|
|
60
|
-
"__STabPanel": "
|
|
61
|
-
"__STabPanelItem": "
|
|
62
|
-
"__SText": "
|
|
63
|
-
"_disabled": "
|
|
64
|
-
"_keyboardFocused": "
|
|
65
|
-
"_selected": "
|
|
66
|
-
"__SAddon": "
|
|
60
|
+
"__STabPanel": "___STabPanel_1lff2_gg_",
|
|
61
|
+
"__STabPanelItem": "___STabPanelItem_1lff2_gg_",
|
|
62
|
+
"__SText": "___SText_1lff2_gg_",
|
|
63
|
+
"_disabled": "__disabled_1lff2_gg_",
|
|
64
|
+
"_keyboardFocused": "__keyboardFocused_1lff2_gg_",
|
|
65
|
+
"_selected": "__selected_1lff2_gg_",
|
|
66
|
+
"__SAddon": "___SAddon_1lff2_gg_"
|
|
67
67
|
});
|
|
68
68
|
var optionsA11yEnhance = {
|
|
69
69
|
onNeighborChange: function onNeighborChange(neighborElement) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React from 'react';\nimport { CProps, PropGetterFn, ReturnEl } from '@semcore/core';\nimport { Box, IBoxProps } from '@semcore/flex-box';\nimport { IKeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\n\nexport type TabPanelValue = string | number | boolean;\n\nexport interface ITabPanelProps<T extends TabPanelValue = TabPanelValue> extends IBoxProps {\n /** Is invoked when changing the selection */\n onChange?: (value: T, e?: React.SyntheticEvent<HTMLButtonElement>) => void;\n /** Value of the selected tab */\n value?: T;\n /** Default value of the selected tab\n * @default null\n * */\n defaultValue?: T;\n}\n\nexport interface ITabPanelItemProps extends IBoxProps, IKeyboardFocusProps {\n /** Makes a tab selected. This property is determined automatically depending on the value. */\n selected?: boolean;\n /** Disabled state */\n disabled?: boolean;\n /** Tab value */\n value?: TabPanelValue;\n /** Left addon tag */\n addonLeft?: React.ElementType;\n /** Right addon tag */\n addonRight?: React.ElementType;\n}\n\nexport interface ITabPanelContext {\n getItemProps: PropGetterFn;\n}\n\nexport interface ITabPanelHandlers {\n value: (value: TabPanelValue) => void;\n}\n\ndeclare const TabPanel: (<T, V extends TabPanelValue = TabPanelValue>(\n props: CProps<ITabPanelProps<V> & T, ITabPanelContext, ITabPanelHandlers>,\n) => ReturnEl) & {\n Item: (<T>(props: CProps<ITabPanelItemProps & T, {}, ITabPanelHandlers>) => ReturnEl) & {\n Text: typeof Box;\n Addon: typeof Box;\n };\n};\n\nexport default TabPanel;\n"],"mappings":""}
|
package/lib/es6/TabPanel.js
CHANGED
|
@@ -31,18 +31,18 @@ var style = (
|
|
|
31
31
|
/*__reshadow_css_start__*/
|
|
32
32
|
_sstyled.insert(
|
|
33
33
|
/*__inner_css_start__*/
|
|
34
|
-
".
|
|
34
|
+
":root {\n\n /* DEPRECATED START\n Deprecated variables should never be used in\n components styles but preserved for backward\n compatibility if they used in projects\n like `<Badge bg=\"red\">alpha</Badge>`\n */\n /* DEPRECATED END */\n}\n\n.___STabPanel_1lff2_gg_ {\n display: flex;\n width: 100%;\n max-width: 100%;\n border-bottom: 1px solid #c4c7cf;\n}\n\n.___STabPanelItem_1lff2_gg_ {\n position: relative;\n bottom: -1px;\n display: inline-flex;\n min-width: 0;\n height: 32px;\n color: #6c6e79;\n border: 1px solid transparent;\n border-radius: 6px 6px 0 0;\n background: transparent;\n align-items: center;\n justify-content: center;\n touch-action: manipulation;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n box-sizing: border-box;\n padding: 0;\n margin: 0;\n box-shadow: none;\n outline: none;\n text-decoration: none;\n -webkit-tap-highlight-color: transparent;\n outline: 0;\n text-align: center;\n vertical-align: middle;\n font-family: inherit;\n cursor: pointer\n}\n\n.___STabPanelItem_1lff2_gg_ .___SText_1lff2_gg_ {\n font-size: 14px;\n line-height: 1.42;\n }\n\n.___STabPanelItem_1lff2_gg_::-moz-focus-inner {\n border: none;\n padding: 0;\n }\n\n.___STabPanelItem_1lff2_gg_:active,\n .___STabPanelItem_1lff2_gg_:hover,\n .___STabPanelItem_1lff2_gg_:focus {\n outline: 0;\n text-decoration: none;\n }\n\n.___STabPanelItem_1lff2_gg_:hover {\n color: #191b23;\n }\n\n.___STabPanelItem_1lff2_gg_.__disabled_1lff2_gg_ {\n opacity: 0.3;\n cursor: default;\n pointer-events: none; /* Disable link interactions */\n}\n\n.___STabPanelItem_1lff2_gg_.__keyboardFocused_1lff2_gg_ {\n box-shadow: 0 0 0 3px rgba(0, 143, 248, 0.2);\n}\n\n.___STabPanelItem_1lff2_gg_.__selected_1lff2_gg_ {\n color: #006dca;\n border-color: #c4c7cf;\n border-bottom-color: #ffffff;\n flex-shrink: 0\n}\n\n.___STabPanelItem_1lff2_gg_.__selected_1lff2_gg_:hover {\n color: #006dca;\n }\n\n.___SText_1lff2_gg_ {\n display: inline-block;\n margin: auto 8px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.___SAddon_1lff2_gg_ {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n}\n\n.___SAddon_1lff2_gg_:not(:only-child):first-child {\n margin-left: 8px;\n}\n\n.___SAddon_1lff2_gg_:not(:only-child):last-child {\n margin-right: 8px;\n}\n\n.___SAddon_1lff2_gg_:only-child {\n margin-right: 8px;\n margin-left: 8px;\n}\n"
|
|
35
35
|
/*__inner_css_end__*/
|
|
36
|
-
, "
|
|
36
|
+
, "1lff2_gg_")
|
|
37
37
|
/*__reshadow_css_end__*/
|
|
38
38
|
, {
|
|
39
|
-
"__STabPanel": "
|
|
40
|
-
"__STabPanelItem": "
|
|
41
|
-
"__SText": "
|
|
42
|
-
"_disabled": "
|
|
43
|
-
"_keyboardFocused": "
|
|
44
|
-
"_selected": "
|
|
45
|
-
"__SAddon": "
|
|
39
|
+
"__STabPanel": "___STabPanel_1lff2_gg_",
|
|
40
|
+
"__STabPanelItem": "___STabPanelItem_1lff2_gg_",
|
|
41
|
+
"__SText": "___SText_1lff2_gg_",
|
|
42
|
+
"_disabled": "__disabled_1lff2_gg_",
|
|
43
|
+
"_keyboardFocused": "__keyboardFocused_1lff2_gg_",
|
|
44
|
+
"_selected": "__selected_1lff2_gg_",
|
|
45
|
+
"__SAddon": "___SAddon_1lff2_gg_"
|
|
46
46
|
});
|
|
47
47
|
var optionsA11yEnhance = {
|
|
48
48
|
onNeighborChange: function onNeighborChange(neighborElement) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import React from 'react';\nimport { CProps, PropGetterFn, ReturnEl } from '@semcore/core';\nimport { Box, IBoxProps } from '@semcore/flex-box';\nimport { IKeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\n\nexport type TabPanelValue = string | number | boolean;\n\nexport interface ITabPanelProps<T extends TabPanelValue = TabPanelValue> extends IBoxProps {\n /** Is invoked when changing the selection */\n onChange?: (value: T, e?: React.SyntheticEvent<HTMLButtonElement>) => void;\n /** Value of the selected tab */\n value?: T;\n /** Default value of the selected tab\n * @default null\n * */\n defaultValue?: T;\n}\n\nexport interface ITabPanelItemProps extends IBoxProps, IKeyboardFocusProps {\n /** Makes a tab selected. This property is determined automatically depending on the value. */\n selected?: boolean;\n /** Disabled state */\n disabled?: boolean;\n /** Tab value */\n value?: TabPanelValue;\n /** Left addon tag */\n addonLeft?: React.ElementType;\n /** Right addon tag */\n addonRight?: React.ElementType;\n}\n\nexport interface ITabPanelContext {\n getItemProps: PropGetterFn;\n}\n\nexport interface ITabPanelHandlers {\n value: (value: TabPanelValue) => void;\n}\n\ndeclare const TabPanel: (<T, V extends TabPanelValue = TabPanelValue>(\n props: CProps<ITabPanelProps<V> & T, ITabPanelContext, ITabPanelHandlers>,\n) => ReturnEl) & {\n Item: (<T>(props: CProps<ITabPanelItemProps & T, {}, ITabPanelHandlers>) => ReturnEl) & {\n Text: typeof Box;\n Addon: typeof Box;\n };\n};\n\nexport default TabPanel;\n"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/tab-panel",
|
|
3
3
|
"description": "Semrush TabPanel Component",
|
|
4
|
-
"version": "3.0
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"author": "UI-kit team <ui-kit-team@semrush.com>",
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build": "build --source=js",
|
|
13
|
-
"test": "jest"
|
|
14
|
-
},
|
|
15
11
|
"dependencies": {
|
|
16
12
|
"@semcore/utils": "^3.30",
|
|
17
13
|
"@semcore/flex-box": "^4"
|
|
18
14
|
},
|
|
19
15
|
"peerDependencies": {
|
|
20
16
|
"@semcore/core": "^1.11",
|
|
21
|
-
"react": "16.8 -
|
|
17
|
+
"react": "16.8 - 18"
|
|
22
18
|
},
|
|
23
19
|
"jest": {
|
|
24
20
|
"preset": "@semcore/jest-preset-ui"
|
|
@@ -29,6 +25,12 @@
|
|
|
29
25
|
"directory": "semcore/tab-panel"
|
|
30
26
|
},
|
|
31
27
|
"devDependencies": {
|
|
32
|
-
"@
|
|
28
|
+
"@types/react": "18.0.21",
|
|
29
|
+
"@semcore/jest-preset-ui": "1.0.0",
|
|
30
|
+
"@semcore/icon": "*"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "pnpm semcore-builder --source=js",
|
|
34
|
+
"test": "jest"
|
|
33
35
|
}
|
|
34
|
-
}
|
|
36
|
+
}
|
package/lib/cjs/index.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
/** Default value of the selected tab
|
|
14
|
-
* @default null
|
|
15
|
-
* */
|
|
16
|
-
defaultValue?: T;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface ITabPanelItemProps extends IBoxProps, IKeyboardFocusProps {
|
|
20
|
-
/** Makes a tab selected. This property is determined automatically depending on the value. */
|
|
21
|
-
selected?: boolean;
|
|
22
|
-
/** Disabled state */
|
|
23
|
-
disabled?: boolean;
|
|
24
|
-
/** Tab value */
|
|
25
|
-
value?: TabPanelValue;
|
|
26
|
-
/** Left addon tag */
|
|
27
|
-
addonLeft?: React.ElementType;
|
|
28
|
-
/** Right addon tag */
|
|
29
|
-
addonRight?: React.ElementType;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface ITabPanelContext {
|
|
33
|
-
getItemProps: PropGetterFn;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface ITabPanelHandlers {
|
|
37
|
-
value: (value: TabPanelValue) => void;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
declare const TabPanel: (<T, V extends TabPanelValue = TabPanelValue>(
|
|
41
|
-
props: CProps<ITabPanelProps<V> & T, ITabPanelContext, ITabPanelHandlers>,
|
|
42
|
-
) => ReturnEl) & {
|
|
43
|
-
Item: (<T>(props: CProps<ITabPanelItemProps & T, {}, ITabPanelHandlers>) => ReturnEl) & {
|
|
44
|
-
Text: typeof Box;
|
|
45
|
-
Addon: typeof Box;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export default TabPanel;
|
package/lib/es6/index.d.ts
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
/** Default value of the selected tab
|
|
14
|
-
* @default null
|
|
15
|
-
* */
|
|
16
|
-
defaultValue?: T;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface ITabPanelItemProps extends IBoxProps, IKeyboardFocusProps {
|
|
20
|
-
/** Makes a tab selected. This property is determined automatically depending on the value. */
|
|
21
|
-
selected?: boolean;
|
|
22
|
-
/** Disabled state */
|
|
23
|
-
disabled?: boolean;
|
|
24
|
-
/** Tab value */
|
|
25
|
-
value?: TabPanelValue;
|
|
26
|
-
/** Left addon tag */
|
|
27
|
-
addonLeft?: React.ElementType;
|
|
28
|
-
/** Right addon tag */
|
|
29
|
-
addonRight?: React.ElementType;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface ITabPanelContext {
|
|
33
|
-
getItemProps: PropGetterFn;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface ITabPanelHandlers {
|
|
37
|
-
value: (value: TabPanelValue) => void;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
declare const TabPanel: (<T, V extends TabPanelValue = TabPanelValue>(
|
|
41
|
-
props: CProps<ITabPanelProps<V> & T, ITabPanelContext, ITabPanelHandlers>,
|
|
42
|
-
) => ReturnEl) & {
|
|
43
|
-
Item: (<T>(props: CProps<ITabPanelItemProps & T, {}, ITabPanelHandlers>) => ReturnEl) & {
|
|
44
|
-
Text: typeof Box;
|
|
45
|
-
Addon: typeof Box;
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export default TabPanel;
|