@semcore/tab-panel 17.0.1 → 17.0.2-prerelease.1
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 +6 -0
- package/lib/cjs/TabPanel.js +19 -19
- package/lib/cjs/TabPanel.js.map +1 -1
- package/lib/cjs/TabPanel.type.js +2 -0
- package/lib/cjs/TabPanel.type.js.map +1 -0
- package/lib/cjs/index.js +13 -4
- package/lib/cjs/index.js.map +1 -1
- package/lib/es6/TabPanel.js +19 -19
- package/lib/es6/TabPanel.js.map +1 -1
- package/lib/es6/TabPanel.type.js +2 -0
- package/lib/es6/TabPanel.type.js.map +1 -0
- package/lib/es6/index.js +2 -2
- package/lib/es6/index.js.map +1 -1
- package/lib/esm/TabPanel.mjs +20 -20
- package/lib/esm/TabPanel.type.mjs +1 -0
- package/lib/esm/index.mjs +1 -0
- package/lib/types/TabPanel.d.ts +6 -0
- package/lib/types/TabPanel.type.d.ts +71 -0
- package/lib/types/index.d.ts +2 -81
- package/package.json +6 -6
- package/vite.config.ts +1 -1
- package/lib/cjs/index.d.js +0 -2
- package/lib/cjs/index.d.js.map +0 -1
- package/lib/es6/index.d.js +0 -2
- package/lib/es6/index.d.js.map +0 -1
package/CHANGELOG.md
CHANGED
package/lib/cjs/TabPanel.js
CHANGED
|
@@ -13,27 +13,16 @@ var _a11yEnhance = _interopRequireDefault(require("@semcore/core/lib/utils/enhan
|
|
|
13
13
|
var _typography = require("@semcore/typography");
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
/*!__reshadow-styles__:"./style/tab-panel.shadow.css"*/
|
|
16
|
-
const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".
|
|
16
|
+
const style = (/*__reshadow_css_start__*/_core.sstyled.insert(/*__inner_css_start__*/".___STabPanel_10ruz_gg_{display:flex;width:100%;max-width:100%}.___STabPanel_10ruz_gg_::after{content:\"\";position:relative;bottom:-1px;flex:1;border-top:1px solid transparent;border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___STabPanelItem_10ruz_gg_{position:relative;bottom:-1px;display:inline-flex;min-width:0;height:32px;color:var(--intergalactic-text-secondary, #6c6e79);border:1px solid transparent;border-bottom:none;border-radius:var(--intergalactic-control-rounded, 6px) var(--intergalactic-control-rounded, 6px)0 0;background:0 0;align-items:center;justify-content:center;touch-action:manipulation;-webkit-user-select:none;-moz-user-select:none;user-select:none;box-sizing:border-box;padding:0 0 1px;margin:0;box-shadow:none;-webkit-text-decoration:none;text-decoration:none;-webkit-tap-highlight-color:transparent;text-align:center;vertical-align:middle;font-family:inherit;cursor:pointer}.___STabPanelItem_10ruz_gg_::-moz-focus-inner{border:0;padding:0}.___STabPanelItem_10ruz_gg_:active{-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___STabPanelItem_10ruz_gg_:hover{-webkit-text-decoration:none;text-decoration:none;color:var(--intergalactic-text-primary, #191b23)}}.___STabPanelItem_10ruz_gg_::after{content:\"\";position:absolute;left:-1px;bottom:0;width:calc(100% + 2px);border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___STabPanelItem_10ruz_gg_.__disabled_10ruz_gg_{cursor:default;pointer-events:none}.___STabPanelItem_10ruz_gg_.__disabled_10ruz_gg_ .___SAddon_10ruz_gg_,.___STabPanelItem_10ruz_gg_.__disabled_10ruz_gg_ .___SText_10ruz_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___STabPanelItem_10ruz_gg_.__selected_10ruz_gg_{color:var(--intergalactic-text-link, #006dca);border-color:var(--intergalactic-border-primary, #c4c7cf);flex-shrink:0}@media (hover:hover){.___STabPanelItem_10ruz_gg_.__selected_10ruz_gg_:hover{color:var(--intergalactic-text-link-hover-active, #044792)}}.___STabPanelItem_10ruz_gg_.__selected_10ruz_gg_::after{border-bottom:none}.___SText_10ruz_gg_{margin:auto var(--intergalactic-spacing-2x, 8px)}.___SAddon_10ruz_gg_{display:inline-flex;align-items:center;justify-content:center}.___SAddon_10ruz_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SAddon_10ruz_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-2x, 8px)}.___SAddon_10ruz_gg_:only-child{margin-right:var(--intergalactic-spacing-2x, 8px);margin-left:var(--intergalactic-spacing-2x, 8px)}", /*__inner_css_end__*/"10ruz_gg_"),
|
|
17
17
|
/*__reshadow_css_end__*/
|
|
18
18
|
{
|
|
19
|
-
"__SText": "
|
|
20
|
-
"__SAddon": "
|
|
21
|
-
"__STabPanel": "
|
|
22
|
-
"__STabPanelItem": "
|
|
23
|
-
"_disabled": "
|
|
24
|
-
"_selected": "
|
|
19
|
+
"__SText": "___SText_10ruz_gg_",
|
|
20
|
+
"__SAddon": "___SAddon_10ruz_gg_",
|
|
21
|
+
"__STabPanel": "___STabPanel_10ruz_gg_",
|
|
22
|
+
"__STabPanelItem": "___STabPanelItem_10ruz_gg_",
|
|
23
|
+
"_disabled": "__disabled_10ruz_gg_",
|
|
24
|
+
"_selected": "__selected_10ruz_gg_"
|
|
25
25
|
});
|
|
26
|
-
const optionsA11yEnhance = {
|
|
27
|
-
onNeighborChange: (neighborElement, props) => {
|
|
28
|
-
if (neighborElement) {
|
|
29
|
-
neighborElement.focus();
|
|
30
|
-
if (props.behavior === 'auto') {
|
|
31
|
-
neighborElement.click();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
childSelector: ['role', 'tab']
|
|
36
|
-
};
|
|
37
26
|
class TabPanelRoot extends _core.Component {
|
|
38
27
|
constructor(...args) {
|
|
39
28
|
super(...args);
|
|
@@ -94,7 +83,18 @@ class TabPanelRoot extends _core.Component {
|
|
|
94
83
|
defaultValue: null,
|
|
95
84
|
behavior: 'manual'
|
|
96
85
|
});
|
|
97
|
-
(0, _defineProperty2.default)(TabPanelRoot, "enhance", [(0, _a11yEnhance.default)(
|
|
86
|
+
(0, _defineProperty2.default)(TabPanelRoot, "enhance", [(0, _a11yEnhance.default)({
|
|
87
|
+
onNeighborChange: (neighborElement, props) => {
|
|
88
|
+
if (neighborElement) {
|
|
89
|
+
neighborElement.focus();
|
|
90
|
+
if (props.behavior === 'auto') {
|
|
91
|
+
neighborElement.click();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
childSelector: ['role', 'tab']
|
|
96
|
+
})]);
|
|
97
|
+
;
|
|
98
98
|
function TabPanelItem(props) {
|
|
99
99
|
var _ref2 = arguments[0],
|
|
100
100
|
_ref6;
|
package/lib/cjs/TabPanel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabPanel.js","names":["_core","require","_baseComponents","_addonTextChildren","_interopRequireDefault","_a11yEnhance","_typography","_react","style","sstyled","insert","
|
|
1
|
+
{"version":3,"file":"TabPanel.js","names":["_core","require","_baseComponents","_addonTextChildren","_interopRequireDefault","_a11yEnhance","_typography","_react","style","sstyled","insert","TabPanelRoot","Component","constructor","args","_defineProperty2","default","value","event","handlers","key","preventDefault","uncontrolledProps","getItemProps","props","index","asProps","isSelected","handleClick","handleKeyDown","buttonRefsList","getItemTextProps","_","render","_ref","_ref5","STabPanel","Box","styles","createElement","cn","assignProps","defaultValue","behavior","a11yEnhance","onNeighborChange","neighborElement","focus","click","childSelector","TabPanelItem","_ref2","arguments[0]","_ref6","STabPanelItem","Children","addonLeft","addonRight","buttonRef","React","useRef","TabPanel","Item","Addon","tag","addonTextChildren","Text","_ref3","_ref7","SText","UikitText","ellipsis","_ref4","_ref8","SAddon","createComponent","wrapTabPanel","wrapper","exports","_default"],"sources":["../../src/TabPanel.tsx"],"sourcesContent":["import { Box } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';\nimport a11yEnhance from '@semcore/core/lib/utils/enhances/a11yEnhance';\nimport { Text as UikitText } from '@semcore/typography';\nimport React from 'react';\n\nimport style from './style/tab-panel.shadow.css';\nimport type { NSTabPanel } from './TabPanel.type';\n\nclass TabPanelRoot extends Component<\n Intergalactic.InternalTypings.InferComponentProps<NSTabPanel.Component>,\n typeof TabPanelRoot.enhance,\n NSTabPanel.Handlers\n> {\n static displayName = 'TabPanel';\n static style = style;\n static defaultProps = {\n defaultValue: null,\n behavior: 'manual',\n };\n\n static enhance = [\n a11yEnhance({\n onNeighborChange: (neighborElement, props) => {\n if (neighborElement) {\n neighborElement.focus();\n if (props.behavior === 'auto') {\n neighborElement.click();\n }\n }\n },\n childSelector: ['role', 'tab'],\n }),\n ] as const;\n\n buttonRefsList: Array<React.MutableRefObject<HTMLButtonElement | undefined>> = [];\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n handleClick = (value: NSTabPanel.Props['value']) => (event: React.MouseEvent<HTMLButtonElement>) => {\n this.handlers.value(value, event);\n };\n\n handleKeyDown = (value: NSTabPanel.Props['value']) => (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.handlers.value(value, event);\n }\n };\n\n getItemProps(props: NSTabPanel.Item.Props, index: number) {\n const { value } = this.asProps;\n const isSelected = value === props.value;\n return {\n 'selected': isSelected,\n 'onClick': this.handleClick(props.value),\n 'onKeyDown': this.handleKeyDown(props.value),\n 'tabIndex': isSelected ? 0 : -1,\n 'aria-selected': isSelected,\n 'buttonRefsList': this.buttonRefsList,\n index,\n };\n }\n\n getItemTextProps(_: NSTabPanel.Item.Text.Props, index: number) {\n return {\n buttonRefsList: this.buttonRefsList,\n index,\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(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSTabPanel.Item.Component,\n typeof TabPanelRoot,\n 'Item'\n >,\n) {\n const STabPanelItem = Root;\n const { Children, styles, addonLeft, addonRight, buttonRefsList, index } = props;\n const buttonRef = React.useRef<HTMLButtonElement>();\n\n buttonRefsList[index] = buttonRef;\n\n return sstyled(styles)(\n <STabPanelItem render={Box} type='button' tag='button' tabIndex={0} role='tab' ref={buttonRef}>\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\nfunction Text(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSTabPanel.Item.Text.Component,\n typeof TabPanelRoot,\n 'ItemText'\n >,\n) {\n const SText = Root;\n const { styles, ellipsis = true, buttonRefsList, index } = props;\n return sstyled(styles)(<SText render={UikitText} size={200} ellipsis={ellipsis} medium hint:triggerRef={buttonRefsList[index]} />);\n}\n\nfunction Addon(\n props: Intergalactic.InternalTypings.InferComponentProps<NSTabPanel.Item.Addon.Component>,\n) {\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}) as unknown as NSTabPanel.Component;\n\nexport const wrapTabPanel = <PropsExtending extends {}>(wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<NSTabPanel.WrapperComponent>\n > &\n PropsExtending,\n) => React.ReactNode) => wrapper as NSTabPanel.WrapperComponent<PropsExtending>;\n\nexport default TabPanel;\n"],"mappings":";;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AAFA,IAAAC,eAAA,GAAAD,OAAA;AAGA,IAAAE,kBAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,YAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAH,sBAA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AA4C,KAAA,GAAO,IAAA3D,aAAO,EAAC6B,MAAM,CAAC,eAAC/B,MAAA,CAAAS,OAAA,CAAAuB,aAAA,CAAC8B,KAAK,EAAAD,KAAA,CAAA5B,EAAA;IAAA,OAAAxC,KAAA,CAAAyC,WAAA;MAAA,QAA0B,GAAG;MAAA,YAAY8B,QAAQ;MAAA;MAAA,mBAA0BzC,cAAc,CAACL,KAAK;IAAC,GAAA0C,KAAA;EAAA,EAAG,CAAC;AACnI;AAEA,SAASJ,KAAKA,CACZvC,KAAyF,EACzF;EAAA,IAAAgD,KAAA,GAAApB,YAAA;IAAAqB,KAAA;EACA,MAAMC,MAAM,GAE2BrC,mBAAG;EAD1C,MAAM;IAAEC;EAAO,CAAC,GAAGd,KAAK;EACxB,OAAAiD,KAAA,GAAO,IAAAhE,aAAO,EAAC6B,MAAM,CAAC,eAAC/B,MAAA,CAAAS,OAAA,CAAAuB,aAAA,CAACmC,MAAM,EAAAD,KAAA,CAAAjC,EAAA;IAAA,OAAAxC,KAAA,CAAAyC,WAAA;MAAA,OAAkB;IAAM,GAAA+B,KAAA;EAAA,EAAE,CAAC;AAC3D;AAEA,MAAMX,QAAQ,GAAG,IAAAc,qBAAe,EAAChE,YAAY,EAAE;EAC7CmD,IAAI,EAAE,CAACZ,YAAY,EAAE;IAAEgB,IAAI;IAAEH;EAAM,CAAC;AACtC,CAAC,CAAoC;AAE9B,MAAMa,YAAY,GAA+BC,OAKpC,IAAKA,OAAsD;AAACC,OAAA,CAAAF,YAAA,GAAAA,YAAA;AAAA,IAAAG,QAAA,GAAAD,OAAA,CAAA9D,OAAA,GAEjE6C,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabPanel.type.js","names":[],"sources":["../../src/TabPanel.type.ts"],"sourcesContent":["import type { Box, BoxProps } from '@semcore/base-components';\nimport type { Intergalactic, PropGetterFn } from '@semcore/core';\nimport type { NSText } from '@semcore/typography';\n\ndeclare namespace NSTabPanel {\n type Value = string | number | boolean;\n type Props<V extends NSTabPanel.Value = NSTabPanel.Value> = BoxProps & {\n /** Is invoked when changing the selection */\n onChange?:\n | ((value: V, e?: React.SyntheticEvent<HTMLButtonElement>) => void)\n | React.Dispatch<React.SetStateAction<V>>;\n /** Value of the selected tab */\n value?: V;\n /** Default value of the selected tab\n * @default null\n * */\n defaultValue?: V;\n /**\n * Behavior of tabs.\n * In `auto`, changes the tab immediately when press arrow.\n * In `manual`, needs to press `space` or `enter` for select a choice.\n * @default 'auto'\n */\n behavior?: 'auto' | 'manual';\n };\n type Ctx = {\n getItemProps: PropGetterFn;\n };\n type Handlers = {\n value: null;\n };\n\n namespace Item {\n type Props = BoxProps & {\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?: NSTabPanel.Value;\n /** Left addon tag */\n addonLeft?: React.ElementType;\n /** Right addon tag */\n addonRight?: React.ElementType;\n };\n\n namespace Text {\n type Props = NSText.Props;\n type Component = NSText.Component;\n }\n\n namespace Addon {\n type Component = typeof Box;\n }\n\n type Component = Intergalactic.Component<'div', Props, {}, [handlers: NSTabPanel.Handlers]> & {\n Text: Text.Component;\n Addon: Addon.Component;\n };\n }\n\n type WrapperComponent<PropsExtending = {}> = (<\n V extends NSTabPanel.Value,\n Tag extends Intergalactic.Tag = 'div',\n >(\n props: Intergalactic.InternalTypings.ComponentProps<\n Tag,\n 'div',\n Props<V>,\n Ctx,\n [handlers: Handlers]\n > &\n PropsExtending,\n ) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', Props>;\n\n type Component = WrapperComponent & {\n Item: Item.Component;\n };\n}\n\n/** @deprecated It will be removed in v18. */\nexport type TabPanelValue = NSTabPanel.Value;\n/** @deprecated It will be removed in v18. */\nexport type TabPanelProps<T extends TabPanelValue = TabPanelValue> = NSTabPanel.Props<T>;\n/** @deprecated It will be removed in v18. */\nexport type TabPanelItemProps = NSTabPanel.Item.Props;\n/** @deprecated It will be removed in v18. */\nexport type TabPanelContext = NSTabPanel.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type TabPanelHandlers = NSTabPanel.Handlers;\n\nexport type { NSTabPanel };\n"],"mappings":"","ignoreList":[]}
|
package/lib/cjs/index.js
CHANGED
|
@@ -4,22 +4,31 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
var _exportNames = {
|
|
7
|
+
var _exportNames = {
|
|
8
|
+
wrapTabPanel: true
|
|
9
|
+
};
|
|
8
10
|
Object.defineProperty(exports, "default", {
|
|
9
11
|
enumerable: true,
|
|
10
12
|
get: function () {
|
|
11
13
|
return _TabPanel.default;
|
|
12
14
|
}
|
|
13
15
|
});
|
|
16
|
+
Object.defineProperty(exports, "wrapTabPanel", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return _TabPanel.wrapTabPanel;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
14
22
|
var _TabPanel = _interopRequireWildcard(require("./TabPanel"));
|
|
15
|
-
|
|
23
|
+
var _TabPanel2 = require("./TabPanel.type");
|
|
24
|
+
Object.keys(_TabPanel2).forEach(function (key) {
|
|
16
25
|
if (key === "default" || key === "__esModule") return;
|
|
17
26
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
18
|
-
if (key in exports && exports[key] ===
|
|
27
|
+
if (key in exports && exports[key] === _TabPanel2[key]) return;
|
|
19
28
|
Object.defineProperty(exports, key, {
|
|
20
29
|
enumerable: true,
|
|
21
30
|
get: function () {
|
|
22
|
-
return
|
|
31
|
+
return _TabPanel2[key];
|
|
23
32
|
}
|
|
24
33
|
});
|
|
25
34
|
});
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_TabPanel","_interopRequireWildcard","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get"],"sources":["../../src/index.
|
|
1
|
+
{"version":3,"file":"index.js","names":["_TabPanel","_interopRequireWildcard","require","_TabPanel2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get"],"sources":["../../src/index.ts"],"sourcesContent":["export { default, wrapTabPanel } from './TabPanel';\nexport * from './TabPanel.type';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,UAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,UAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,UAAA,CAAAI,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/lib/es6/TabPanel.js
CHANGED
|
@@ -11,27 +11,16 @@ import a11yEnhance from '@semcore/core/lib/utils/enhances/a11yEnhance';
|
|
|
11
11
|
import { Text as UikitText } from '@semcore/typography';
|
|
12
12
|
import React from 'react';
|
|
13
13
|
/*!__reshadow-styles__:"./style/tab-panel.shadow.css"*/
|
|
14
|
-
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".
|
|
14
|
+
const style = (/*__reshadow_css_start__*/_sstyled.insert(/*__inner_css_start__*/".___STabPanel_10ruz_gg_{display:flex;width:100%;max-width:100%}.___STabPanel_10ruz_gg_::after{content:\"\";position:relative;bottom:-1px;flex:1;border-top:1px solid transparent;border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___STabPanelItem_10ruz_gg_{position:relative;bottom:-1px;display:inline-flex;min-width:0;height:32px;color:var(--intergalactic-text-secondary, #6c6e79);border:1px solid transparent;border-bottom:none;border-radius:var(--intergalactic-control-rounded, 6px) var(--intergalactic-control-rounded, 6px)0 0;background:0 0;align-items:center;justify-content:center;touch-action:manipulation;-webkit-user-select:none;-moz-user-select:none;user-select:none;box-sizing:border-box;padding:0 0 1px;margin:0;box-shadow:none;-webkit-text-decoration:none;text-decoration:none;-webkit-tap-highlight-color:transparent;text-align:center;vertical-align:middle;font-family:inherit;cursor:pointer}.___STabPanelItem_10ruz_gg_::-moz-focus-inner{border:0;padding:0}.___STabPanelItem_10ruz_gg_:active{-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___STabPanelItem_10ruz_gg_:hover{-webkit-text-decoration:none;text-decoration:none;color:var(--intergalactic-text-primary, #191b23)}}.___STabPanelItem_10ruz_gg_::after{content:\"\";position:absolute;left:-1px;bottom:0;width:calc(100% + 2px);border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___STabPanelItem_10ruz_gg_.__disabled_10ruz_gg_{cursor:default;pointer-events:none}.___STabPanelItem_10ruz_gg_.__disabled_10ruz_gg_ .___SAddon_10ruz_gg_,.___STabPanelItem_10ruz_gg_.__disabled_10ruz_gg_ .___SText_10ruz_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___STabPanelItem_10ruz_gg_.__selected_10ruz_gg_{color:var(--intergalactic-text-link, #006dca);border-color:var(--intergalactic-border-primary, #c4c7cf);flex-shrink:0}@media (hover:hover){.___STabPanelItem_10ruz_gg_.__selected_10ruz_gg_:hover{color:var(--intergalactic-text-link-hover-active, #044792)}}.___STabPanelItem_10ruz_gg_.__selected_10ruz_gg_::after{border-bottom:none}.___SText_10ruz_gg_{margin:auto var(--intergalactic-spacing-2x, 8px)}.___SAddon_10ruz_gg_{display:inline-flex;align-items:center;justify-content:center}.___SAddon_10ruz_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SAddon_10ruz_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-2x, 8px)}.___SAddon_10ruz_gg_:only-child{margin-right:var(--intergalactic-spacing-2x, 8px);margin-left:var(--intergalactic-spacing-2x, 8px)}", /*__inner_css_end__*/"10ruz_gg_"),
|
|
15
15
|
/*__reshadow_css_end__*/
|
|
16
16
|
{
|
|
17
|
-
"__SText": "
|
|
18
|
-
"__SAddon": "
|
|
19
|
-
"__STabPanel": "
|
|
20
|
-
"__STabPanelItem": "
|
|
21
|
-
"_disabled": "
|
|
22
|
-
"_selected": "
|
|
17
|
+
"__SText": "___SText_10ruz_gg_",
|
|
18
|
+
"__SAddon": "___SAddon_10ruz_gg_",
|
|
19
|
+
"__STabPanel": "___STabPanel_10ruz_gg_",
|
|
20
|
+
"__STabPanelItem": "___STabPanelItem_10ruz_gg_",
|
|
21
|
+
"_disabled": "__disabled_10ruz_gg_",
|
|
22
|
+
"_selected": "__selected_10ruz_gg_"
|
|
23
23
|
});
|
|
24
|
-
const optionsA11yEnhance = {
|
|
25
|
-
onNeighborChange: (neighborElement, props) => {
|
|
26
|
-
if (neighborElement) {
|
|
27
|
-
neighborElement.focus();
|
|
28
|
-
if (props.behavior === 'auto') {
|
|
29
|
-
neighborElement.click();
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
childSelector: ['role', 'tab']
|
|
34
|
-
};
|
|
35
24
|
class TabPanelRoot extends Component {
|
|
36
25
|
constructor(...args) {
|
|
37
26
|
super(...args);
|
|
@@ -92,7 +81,18 @@ _defineProperty(TabPanelRoot, "defaultProps", {
|
|
|
92
81
|
defaultValue: null,
|
|
93
82
|
behavior: 'manual'
|
|
94
83
|
});
|
|
95
|
-
_defineProperty(TabPanelRoot, "enhance", [a11yEnhance(
|
|
84
|
+
_defineProperty(TabPanelRoot, "enhance", [a11yEnhance({
|
|
85
|
+
onNeighborChange: (neighborElement, props) => {
|
|
86
|
+
if (neighborElement) {
|
|
87
|
+
neighborElement.focus();
|
|
88
|
+
if (props.behavior === 'auto') {
|
|
89
|
+
neighborElement.click();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
childSelector: ['role', 'tab']
|
|
94
|
+
})]);
|
|
95
|
+
;
|
|
96
96
|
function TabPanelItem(props) {
|
|
97
97
|
var _ref2 = arguments[0],
|
|
98
98
|
_ref6;
|
package/lib/es6/TabPanel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabPanel.js","names":["Box","createComponent","Component","sstyled","Root","addonTextChildren","a11yEnhance","Text","UikitText","React","style","_sstyled","insert","
|
|
1
|
+
{"version":3,"file":"TabPanel.js","names":["Box","createComponent","Component","sstyled","Root","addonTextChildren","a11yEnhance","Text","UikitText","React","style","_sstyled","insert","TabPanelRoot","constructor","args","_defineProperty","value","event","handlers","key","preventDefault","uncontrolledProps","getItemProps","props","index","asProps","isSelected","handleClick","handleKeyDown","buttonRefsList","getItemTextProps","_","render","_ref","_ref5","STabPanel","styles","createElement","cn","_assignProps","defaultValue","behavior","onNeighborChange","neighborElement","focus","click","childSelector","TabPanelItem","_ref2","arguments[0]","_ref6","STabPanelItem","Children","addonLeft","addonRight","buttonRef","useRef","_assignProps2","TabPanel","Item","Addon","tag","_ref3","_ref7","SText","ellipsis","_assignProps3","_ref4","_ref8","SAddon","_assignProps4","wrapTabPanel","wrapper"],"sources":["../../src/TabPanel.tsx"],"sourcesContent":["import { Box } from '@semcore/base-components';\nimport type { Intergalactic } from '@semcore/core';\nimport { createComponent, Component, sstyled, Root } from '@semcore/core';\nimport addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';\nimport a11yEnhance from '@semcore/core/lib/utils/enhances/a11yEnhance';\nimport { Text as UikitText } from '@semcore/typography';\nimport React from 'react';\n\nimport style from './style/tab-panel.shadow.css';\nimport type { NSTabPanel } from './TabPanel.type';\n\nclass TabPanelRoot extends Component<\n Intergalactic.InternalTypings.InferComponentProps<NSTabPanel.Component>,\n typeof TabPanelRoot.enhance,\n NSTabPanel.Handlers\n> {\n static displayName = 'TabPanel';\n static style = style;\n static defaultProps = {\n defaultValue: null,\n behavior: 'manual',\n };\n\n static enhance = [\n a11yEnhance({\n onNeighborChange: (neighborElement, props) => {\n if (neighborElement) {\n neighborElement.focus();\n if (props.behavior === 'auto') {\n neighborElement.click();\n }\n }\n },\n childSelector: ['role', 'tab'],\n }),\n ] as const;\n\n buttonRefsList: Array<React.MutableRefObject<HTMLButtonElement | undefined>> = [];\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n handleClick = (value: NSTabPanel.Props['value']) => (event: React.MouseEvent<HTMLButtonElement>) => {\n this.handlers.value(value, event);\n };\n\n handleKeyDown = (value: NSTabPanel.Props['value']) => (event: React.KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.handlers.value(value, event);\n }\n };\n\n getItemProps(props: NSTabPanel.Item.Props, index: number) {\n const { value } = this.asProps;\n const isSelected = value === props.value;\n return {\n 'selected': isSelected,\n 'onClick': this.handleClick(props.value),\n 'onKeyDown': this.handleKeyDown(props.value),\n 'tabIndex': isSelected ? 0 : -1,\n 'aria-selected': isSelected,\n 'buttonRefsList': this.buttonRefsList,\n index,\n };\n }\n\n getItemTextProps(_: NSTabPanel.Item.Text.Props, index: number) {\n return {\n buttonRefsList: this.buttonRefsList,\n index,\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(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSTabPanel.Item.Component,\n typeof TabPanelRoot,\n 'Item'\n >,\n) {\n const STabPanelItem = Root;\n const { Children, styles, addonLeft, addonRight, buttonRefsList, index } = props;\n const buttonRef = React.useRef<HTMLButtonElement>();\n\n buttonRefsList[index] = buttonRef;\n\n return sstyled(styles)(\n <STabPanelItem render={Box} type='button' tag='button' tabIndex={0} role='tab' ref={buttonRef}>\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\nfunction Text(\n props: Intergalactic.InternalTypings.InferChildComponentProps<\n NSTabPanel.Item.Text.Component,\n typeof TabPanelRoot,\n 'ItemText'\n >,\n) {\n const SText = Root;\n const { styles, ellipsis = true, buttonRefsList, index } = props;\n return sstyled(styles)(<SText render={UikitText} size={200} ellipsis={ellipsis} medium hint:triggerRef={buttonRefsList[index]} />);\n}\n\nfunction Addon(\n props: Intergalactic.InternalTypings.InferComponentProps<NSTabPanel.Item.Addon.Component>,\n) {\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}) as unknown as NSTabPanel.Component;\n\nexport const wrapTabPanel = <PropsExtending extends {}>(wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<NSTabPanel.WrapperComponent>\n > &\n PropsExtending,\n) => React.ReactNode) => wrapper as NSTabPanel.WrapperComponent<PropsExtending>;\n\nexport default TabPanel;\n"],"mappings":";;;;;;AAAA,SAASA,GAAG,QAAQ,0BAA0B;AAE9C,SAASC,eAAe,EAAEC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,OAAOC,iBAAiB,MAAM,2CAA2C;AACzE,OAAOC,WAAW,MAAM,8CAA8C;AACtE,SAASC,IAAI,IAAIC,SAAS,QAAQ,qBAAqB;AACvD,OAAOC,KAAK,MAAM,OAAO;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A,CACZrC,KAAyF,EACzF;EAAA,IAAA4C,KAAA,GAAAlB,YAAA;IAAAmB,KAAA;EACA,MAAMC,MAAM,GAE2BtE,GAAG;EAD1C,MAAM;IAAEqC;EAAO,CAAC,GAAGb,KAAK;EACxB,OAAA6C,KAAA,GAAOlE,OAAO,CAACkC,MAAM,CAAC,eAAC5B,KAAA,CAAA6B,aAAA,CAACgC,MAAM,EAAAD,KAAA,CAAA9B,EAAA;IAAA,GAAAgC,aAAA;MAAA,OAAkB;IAAM,GAAAH,KAAA;EAAA,EAAE,CAAC;AAC3D;AAEA,MAAMT,QAAQ,GAAG1D,eAAe,CAACY,YAAY,EAAE;EAC7C+C,IAAI,EAAE,CAACZ,YAAY,EAAE;IAAEzC,IAAI;IAAEsD;EAAM,CAAC;AACtC,CAAC,CAAoC;AAErC,OAAO,MAAMW,YAAY,GAA+BC,OAKpC,IAAKA,OAAsD;AAE/E,eAAed,QAAQ","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabPanel.type.js","names":[],"sources":["../../src/TabPanel.type.ts"],"sourcesContent":["import type { Box, BoxProps } from '@semcore/base-components';\nimport type { Intergalactic, PropGetterFn } from '@semcore/core';\nimport type { NSText } from '@semcore/typography';\n\ndeclare namespace NSTabPanel {\n type Value = string | number | boolean;\n type Props<V extends NSTabPanel.Value = NSTabPanel.Value> = BoxProps & {\n /** Is invoked when changing the selection */\n onChange?:\n | ((value: V, e?: React.SyntheticEvent<HTMLButtonElement>) => void)\n | React.Dispatch<React.SetStateAction<V>>;\n /** Value of the selected tab */\n value?: V;\n /** Default value of the selected tab\n * @default null\n * */\n defaultValue?: V;\n /**\n * Behavior of tabs.\n * In `auto`, changes the tab immediately when press arrow.\n * In `manual`, needs to press `space` or `enter` for select a choice.\n * @default 'auto'\n */\n behavior?: 'auto' | 'manual';\n };\n type Ctx = {\n getItemProps: PropGetterFn;\n };\n type Handlers = {\n value: null;\n };\n\n namespace Item {\n type Props = BoxProps & {\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?: NSTabPanel.Value;\n /** Left addon tag */\n addonLeft?: React.ElementType;\n /** Right addon tag */\n addonRight?: React.ElementType;\n };\n\n namespace Text {\n type Props = NSText.Props;\n type Component = NSText.Component;\n }\n\n namespace Addon {\n type Component = typeof Box;\n }\n\n type Component = Intergalactic.Component<'div', Props, {}, [handlers: NSTabPanel.Handlers]> & {\n Text: Text.Component;\n Addon: Addon.Component;\n };\n }\n\n type WrapperComponent<PropsExtending = {}> = (<\n V extends NSTabPanel.Value,\n Tag extends Intergalactic.Tag = 'div',\n >(\n props: Intergalactic.InternalTypings.ComponentProps<\n Tag,\n 'div',\n Props<V>,\n Ctx,\n [handlers: Handlers]\n > &\n PropsExtending,\n ) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', Props>;\n\n type Component = WrapperComponent & {\n Item: Item.Component;\n };\n}\n\n/** @deprecated It will be removed in v18. */\nexport type TabPanelValue = NSTabPanel.Value;\n/** @deprecated It will be removed in v18. */\nexport type TabPanelProps<T extends TabPanelValue = TabPanelValue> = NSTabPanel.Props<T>;\n/** @deprecated It will be removed in v18. */\nexport type TabPanelItemProps = NSTabPanel.Item.Props;\n/** @deprecated It will be removed in v18. */\nexport type TabPanelContext = NSTabPanel.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type TabPanelHandlers = NSTabPanel.Handlers;\n\nexport type { NSTabPanel };\n"],"mappings":"","ignoreList":[]}
|
package/lib/es6/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default } from './TabPanel';
|
|
2
|
-
export * from './TabPanel';
|
|
1
|
+
export { default, wrapTabPanel } from './TabPanel';
|
|
2
|
+
export * from './TabPanel.type';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/index.
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","wrapTabPanel"],"sources":["../../src/index.ts"],"sourcesContent":["export { default, wrapTabPanel } from './TabPanel';\nexport * from './TabPanel.type';\n"],"mappings":"AAAA,SAASA,OAAO,EAAEC,YAAY,QAAQ,YAAY;AAClD,cAAc,iBAAiB","ignoreList":[]}
|
package/lib/esm/TabPanel.mjs
CHANGED
|
@@ -10,30 +10,19 @@ const style = (
|
|
|
10
10
|
/*__reshadow_css_start__*/
|
|
11
11
|
(sstyled.insert(
|
|
12
12
|
/*__inner_css_start__*/
|
|
13
|
-
'.
|
|
13
|
+
'.___STabPanel_10ruz_gg_{display:flex;width:100%;max-width:100%}.___STabPanel_10ruz_gg_::after{content:"";position:relative;bottom:-1px;flex:1;border-top:1px solid transparent;border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___STabPanelItem_10ruz_gg_{position:relative;bottom:-1px;display:inline-flex;min-width:0;height:32px;color:var(--intergalactic-text-secondary, #6c6e79);border:1px solid transparent;border-bottom:none;border-radius:var(--intergalactic-control-rounded, 6px) var(--intergalactic-control-rounded, 6px)0 0;background:0 0;align-items:center;justify-content:center;touch-action:manipulation;-webkit-user-select:none;-moz-user-select:none;user-select:none;box-sizing:border-box;padding:0 0 1px;margin:0;box-shadow:none;-webkit-text-decoration:none;text-decoration:none;-webkit-tap-highlight-color:transparent;text-align:center;vertical-align:middle;font-family:inherit;cursor:pointer}.___STabPanelItem_10ruz_gg_::-moz-focus-inner{border:0;padding:0}.___STabPanelItem_10ruz_gg_:active{-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___STabPanelItem_10ruz_gg_:hover{-webkit-text-decoration:none;text-decoration:none;color:var(--intergalactic-text-primary, #191b23)}}.___STabPanelItem_10ruz_gg_::after{content:"";position:absolute;left:-1px;bottom:0;width:calc(100% + 2px);border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___STabPanelItem_10ruz_gg_.__disabled_10ruz_gg_{cursor:default;pointer-events:none}.___STabPanelItem_10ruz_gg_.__disabled_10ruz_gg_ .___SAddon_10ruz_gg_,.___STabPanelItem_10ruz_gg_.__disabled_10ruz_gg_ .___SText_10ruz_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___STabPanelItem_10ruz_gg_.__selected_10ruz_gg_{color:var(--intergalactic-text-link, #006dca);border-color:var(--intergalactic-border-primary, #c4c7cf);flex-shrink:0}@media (hover:hover){.___STabPanelItem_10ruz_gg_.__selected_10ruz_gg_:hover{color:var(--intergalactic-text-link-hover-active, #044792)}}.___STabPanelItem_10ruz_gg_.__selected_10ruz_gg_::after{border-bottom:none}.___SText_10ruz_gg_{margin:auto var(--intergalactic-spacing-2x, 8px)}.___SAddon_10ruz_gg_{display:inline-flex;align-items:center;justify-content:center}.___SAddon_10ruz_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SAddon_10ruz_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-2x, 8px)}.___SAddon_10ruz_gg_:only-child{margin-right:var(--intergalactic-spacing-2x, 8px);margin-left:var(--intergalactic-spacing-2x, 8px)}',
|
|
14
14
|
/*__inner_css_end__*/
|
|
15
|
-
"
|
|
15
|
+
"10ruz_gg_"
|
|
16
16
|
), /*__reshadow_css_end__*/
|
|
17
17
|
{
|
|
18
|
-
"__SText": "
|
|
19
|
-
"__SAddon": "
|
|
20
|
-
"__STabPanel": "
|
|
21
|
-
"__STabPanelItem": "
|
|
22
|
-
"_disabled": "
|
|
23
|
-
"_selected": "
|
|
18
|
+
"__SText": "___SText_10ruz_gg_",
|
|
19
|
+
"__SAddon": "___SAddon_10ruz_gg_",
|
|
20
|
+
"__STabPanel": "___STabPanel_10ruz_gg_",
|
|
21
|
+
"__STabPanelItem": "___STabPanelItem_10ruz_gg_",
|
|
22
|
+
"_disabled": "__disabled_10ruz_gg_",
|
|
23
|
+
"_selected": "__selected_10ruz_gg_"
|
|
24
24
|
})
|
|
25
25
|
);
|
|
26
|
-
const optionsA11yEnhance = {
|
|
27
|
-
onNeighborChange: (neighborElement, props) => {
|
|
28
|
-
if (neighborElement) {
|
|
29
|
-
neighborElement.focus();
|
|
30
|
-
if (props.behavior === "auto") {
|
|
31
|
-
neighborElement.click();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
childSelector: ["role", "tab"]
|
|
36
|
-
};
|
|
37
26
|
class TabPanelRoot extends Component {
|
|
38
27
|
constructor(...args) {
|
|
39
28
|
super(...args);
|
|
@@ -93,7 +82,18 @@ _defineProperty(TabPanelRoot, "defaultProps", {
|
|
|
93
82
|
defaultValue: null,
|
|
94
83
|
behavior: "manual"
|
|
95
84
|
});
|
|
96
|
-
_defineProperty(TabPanelRoot, "enhance", [a11yEnhance(
|
|
85
|
+
_defineProperty(TabPanelRoot, "enhance", [a11yEnhance({
|
|
86
|
+
onNeighborChange: (neighborElement, props) => {
|
|
87
|
+
if (neighborElement) {
|
|
88
|
+
neighborElement.focus();
|
|
89
|
+
if (props.behavior === "auto") {
|
|
90
|
+
neighborElement.click();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
childSelector: ["role", "tab"]
|
|
95
|
+
})]);
|
|
96
|
+
;
|
|
97
97
|
function TabPanelItem(props) {
|
|
98
98
|
var _ref2 = arguments[0], _ref6;
|
|
99
99
|
const STabPanelItem = Box;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/lib/esm/index.mjs
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Intergalactic } from '@semcore/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { NSTabPanel } from './TabPanel.type';
|
|
4
|
+
declare const TabPanel: NSTabPanel.Component;
|
|
5
|
+
export declare const wrapTabPanel: <PropsExtending extends {}>(wrapper: (props: Intergalactic.InternalTypings.UntypeRefAndTag<Intergalactic.InternalTypings.ComponentPropsNesting<NSTabPanel.WrapperComponent>> & PropsExtending) => React.ReactNode) => NSTabPanel.WrapperComponent<PropsExtending>;
|
|
6
|
+
export default TabPanel;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { Box, BoxProps } from '@semcore/base-components';
|
|
2
|
+
import type { Intergalactic, PropGetterFn } from '@semcore/core';
|
|
3
|
+
import type { NSText } from '@semcore/typography';
|
|
4
|
+
declare namespace NSTabPanel {
|
|
5
|
+
type Value = string | number | boolean;
|
|
6
|
+
type Props<V extends NSTabPanel.Value = NSTabPanel.Value> = BoxProps & {
|
|
7
|
+
/** Is invoked when changing the selection */
|
|
8
|
+
onChange?: ((value: V, e?: React.SyntheticEvent<HTMLButtonElement>) => void) | React.Dispatch<React.SetStateAction<V>>;
|
|
9
|
+
/** Value of the selected tab */
|
|
10
|
+
value?: V;
|
|
11
|
+
/** Default value of the selected tab
|
|
12
|
+
* @default null
|
|
13
|
+
* */
|
|
14
|
+
defaultValue?: V;
|
|
15
|
+
/**
|
|
16
|
+
* Behavior of tabs.
|
|
17
|
+
* In `auto`, changes the tab immediately when press arrow.
|
|
18
|
+
* In `manual`, needs to press `space` or `enter` for select a choice.
|
|
19
|
+
* @default 'auto'
|
|
20
|
+
*/
|
|
21
|
+
behavior?: 'auto' | 'manual';
|
|
22
|
+
};
|
|
23
|
+
type Ctx = {
|
|
24
|
+
getItemProps: PropGetterFn;
|
|
25
|
+
};
|
|
26
|
+
type Handlers = {
|
|
27
|
+
value: null;
|
|
28
|
+
};
|
|
29
|
+
namespace Item {
|
|
30
|
+
type Props = BoxProps & {
|
|
31
|
+
/** Makes a tab selected. This property is determined automatically depending on the value. */
|
|
32
|
+
selected?: boolean;
|
|
33
|
+
/** Disabled state */
|
|
34
|
+
disabled?: boolean;
|
|
35
|
+
/** Tab value */
|
|
36
|
+
value?: NSTabPanel.Value;
|
|
37
|
+
/** Left addon tag */
|
|
38
|
+
addonLeft?: React.ElementType;
|
|
39
|
+
/** Right addon tag */
|
|
40
|
+
addonRight?: React.ElementType;
|
|
41
|
+
};
|
|
42
|
+
namespace Text {
|
|
43
|
+
type Props = NSText.Props;
|
|
44
|
+
type Component = NSText.Component;
|
|
45
|
+
}
|
|
46
|
+
namespace Addon {
|
|
47
|
+
type Component = typeof Box;
|
|
48
|
+
}
|
|
49
|
+
type Component = Intergalactic.Component<'div', Props, {}, [handlers: NSTabPanel.Handlers]> & {
|
|
50
|
+
Text: Text.Component;
|
|
51
|
+
Addon: Addon.Component;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
type WrapperComponent<PropsExtending = {}> = (<V extends NSTabPanel.Value, Tag extends Intergalactic.Tag = 'div'>(props: Intergalactic.InternalTypings.ComponentProps<Tag, 'div', Props<V>, Ctx, [
|
|
55
|
+
handlers: Handlers
|
|
56
|
+
]> & PropsExtending) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', Props>;
|
|
57
|
+
type Component = WrapperComponent & {
|
|
58
|
+
Item: Item.Component;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** @deprecated It will be removed in v18. */
|
|
62
|
+
export type TabPanelValue = NSTabPanel.Value;
|
|
63
|
+
/** @deprecated It will be removed in v18. */
|
|
64
|
+
export type TabPanelProps<T extends TabPanelValue = TabPanelValue> = NSTabPanel.Props<T>;
|
|
65
|
+
/** @deprecated It will be removed in v18. */
|
|
66
|
+
export type TabPanelItemProps = NSTabPanel.Item.Props;
|
|
67
|
+
/** @deprecated It will be removed in v18. */
|
|
68
|
+
export type TabPanelContext = NSTabPanel.Ctx;
|
|
69
|
+
/** @deprecated It will be removed in v18. */
|
|
70
|
+
export type TabPanelHandlers = NSTabPanel.Handlers;
|
|
71
|
+
export type { NSTabPanel };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,81 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { Text } from '@semcore/typography';
|
|
4
|
-
import type React from 'react';
|
|
5
|
-
|
|
6
|
-
export type TabPanelValue = string | number | boolean;
|
|
7
|
-
|
|
8
|
-
export type TabPanelProps<T extends TabPanelValue = TabPanelValue> = BoxProps & {
|
|
9
|
-
/** Is invoked when changing the selection */
|
|
10
|
-
onChange?:
|
|
11
|
-
| ((value: T, e?: React.SyntheticEvent<HTMLButtonElement>) => void)
|
|
12
|
-
| React.Dispatch<React.SetStateAction<T>>;
|
|
13
|
-
/** Value of the selected tab */
|
|
14
|
-
value?: T;
|
|
15
|
-
/** Default value of the selected tab
|
|
16
|
-
* @default null
|
|
17
|
-
* */
|
|
18
|
-
defaultValue?: T;
|
|
19
|
-
/**
|
|
20
|
-
* Behavior of tabs.
|
|
21
|
-
* In `auto`, changes the tab immediately when press arrow.
|
|
22
|
-
* In `manual`, needs to press `space` or `enter` for select a choice.
|
|
23
|
-
* @default 'auto'
|
|
24
|
-
*/
|
|
25
|
-
behavior?: 'auto' | 'manual';
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type TabPanelItemProps = BoxProps & {
|
|
29
|
-
/** Makes a tab selected. This property is determined automatically depending on the value. */
|
|
30
|
-
selected?: boolean;
|
|
31
|
-
/** Disabled state */
|
|
32
|
-
disabled?: boolean;
|
|
33
|
-
/** Tab value */
|
|
34
|
-
value?: TabPanelValue;
|
|
35
|
-
/** Left addon tag */
|
|
36
|
-
addonLeft?: React.ElementType;
|
|
37
|
-
/** Right addon tag */
|
|
38
|
-
addonRight?: React.ElementType;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export type TabPanelContext = {
|
|
42
|
-
getItemProps: PropGetterFn;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export type TabPanelHandlers = {
|
|
46
|
-
value: (value: TabPanelValue) => void;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
type IntergalacticTabPanelComponent<PropsExtending = {}> = (<
|
|
50
|
-
Value extends TabPanelValue,
|
|
51
|
-
Tag extends Intergalactic.Tag = 'div',
|
|
52
|
-
>(
|
|
53
|
-
props: Intergalactic.InternalTypings.ComponentProps<
|
|
54
|
-
Tag,
|
|
55
|
-
'div',
|
|
56
|
-
TabPanelProps<Value>,
|
|
57
|
-
TabPanelContext,
|
|
58
|
-
[handlers: TabPanelHandlers]
|
|
59
|
-
> &
|
|
60
|
-
PropsExtending,
|
|
61
|
-
) => Intergalactic.InternalTypings.ComponentRenderingResults) &
|
|
62
|
-
Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', TabPanelProps>;
|
|
63
|
-
|
|
64
|
-
declare const TabPanel: IntergalacticTabPanelComponent & {
|
|
65
|
-
Item: Intergalactic.Component<'div', TabPanelItemProps, {}, [handlers: TabPanelHandlers]> & {
|
|
66
|
-
Text: typeof Text;
|
|
67
|
-
Addon: typeof Box;
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
declare const wrapTabPanel: <PropsExtending extends {}>(
|
|
72
|
-
wrapper: (
|
|
73
|
-
props: Intergalactic.InternalTypings.UntypeRefAndTag<
|
|
74
|
-
Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticTabPanelComponent>
|
|
75
|
-
> &
|
|
76
|
-
PropsExtending,
|
|
77
|
-
) => React.ReactNode,
|
|
78
|
-
) => IntergalacticTabPanelComponent<PropsExtending>;
|
|
79
|
-
export { wrapTabPanel };
|
|
80
|
-
|
|
81
|
-
export default TabPanel;
|
|
1
|
+
export { default, wrapTabPanel } from './TabPanel';
|
|
2
|
+
export * from './TabPanel.type';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/tab-panel",
|
|
3
3
|
"description": "Semrush TabPanel Component",
|
|
4
|
-
"version": "17.0.1",
|
|
4
|
+
"version": "17.0.2-prerelease.1",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"require": "./lib/cjs/index.js"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/typography": "^17.0.1"
|
|
17
|
+
"@semcore/typography": "^17.0.2-prerelease.1"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@semcore/base-components": "^17.0.
|
|
20
|
+
"@semcore/base-components": "^17.0.2"
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@semcore/core": "17.0.1",
|
|
29
|
-
"@semcore/base-components": "17.0.1",
|
|
29
|
+
"@semcore/base-components": "17.0.2-prerelease.1",
|
|
30
30
|
"@semcore/testing-utils": "1.0.0",
|
|
31
|
-
"@semcore/icon": "17.0.1"
|
|
31
|
+
"@semcore/icon": "17.0.1-prerelease.1"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
|
-
"build": "pnpm semcore-builder
|
|
34
|
+
"build": "pnpm semcore-builder && pnpm vite build"
|
|
35
35
|
}
|
|
36
36
|
}
|
package/vite.config.ts
CHANGED
package/lib/cjs/index.d.js
DELETED
package/lib/cjs/index.d.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { Box, BoxProps } from '@semcore/base-components';\nimport type { PropGetterFn, Intergalactic } from '@semcore/core';\nimport type { Text } from '@semcore/typography';\nimport type React from 'react';\n\nexport type TabPanelValue = string | number | boolean;\n\nexport type TabPanelProps<T extends TabPanelValue = TabPanelValue> = BoxProps & {\n /** Is invoked when changing the selection */\n onChange?:\n | ((value: T, e?: React.SyntheticEvent<HTMLButtonElement>) => void)\n | React.Dispatch<React.SetStateAction<T>>;\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 * Behavior of tabs.\n * In `auto`, changes the tab immediately when press arrow.\n * In `manual`, needs to press `space` or `enter` for select a choice.\n * @default 'auto'\n */\n behavior?: 'auto' | 'manual';\n};\n\nexport type TabPanelItemProps = BoxProps & {\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 type TabPanelContext = {\n getItemProps: PropGetterFn;\n};\n\nexport type TabPanelHandlers = {\n value: (value: TabPanelValue) => void;\n};\n\ntype IntergalacticTabPanelComponent<PropsExtending = {}> = (<\n Value extends TabPanelValue,\n Tag extends Intergalactic.Tag = 'div',\n>(\n props: Intergalactic.InternalTypings.ComponentProps<\n Tag,\n 'div',\n TabPanelProps<Value>,\n TabPanelContext,\n [handlers: TabPanelHandlers]\n > &\n PropsExtending,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\nIntergalactic.InternalTypings.ComponentAdditive<'div', 'div', TabPanelProps>;\n\ndeclare const TabPanel: IntergalacticTabPanelComponent & {\n Item: Intergalactic.Component<'div', TabPanelItemProps, {}, [handlers: TabPanelHandlers]> & {\n Text: typeof Text;\n Addon: typeof Box;\n };\n};\n\ndeclare const wrapTabPanel: <PropsExtending extends {}>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticTabPanelComponent>\n > &\n PropsExtending,\n ) => React.ReactNode,\n) => IntergalacticTabPanelComponent<PropsExtending>;\nexport { wrapTabPanel };\n\nexport default TabPanel;\n"],"mappings":"","ignoreList":[]}
|
package/lib/es6/index.d.js
DELETED
package/lib/es6/index.d.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.js","names":[],"sources":["../../src/index.d.ts"],"sourcesContent":["import type { Box, BoxProps } from '@semcore/base-components';\nimport type { PropGetterFn, Intergalactic } from '@semcore/core';\nimport type { Text } from '@semcore/typography';\nimport type React from 'react';\n\nexport type TabPanelValue = string | number | boolean;\n\nexport type TabPanelProps<T extends TabPanelValue = TabPanelValue> = BoxProps & {\n /** Is invoked when changing the selection */\n onChange?:\n | ((value: T, e?: React.SyntheticEvent<HTMLButtonElement>) => void)\n | React.Dispatch<React.SetStateAction<T>>;\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 * Behavior of tabs.\n * In `auto`, changes the tab immediately when press arrow.\n * In `manual`, needs to press `space` or `enter` for select a choice.\n * @default 'auto'\n */\n behavior?: 'auto' | 'manual';\n};\n\nexport type TabPanelItemProps = BoxProps & {\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 type TabPanelContext = {\n getItemProps: PropGetterFn;\n};\n\nexport type TabPanelHandlers = {\n value: (value: TabPanelValue) => void;\n};\n\ntype IntergalacticTabPanelComponent<PropsExtending = {}> = (<\n Value extends TabPanelValue,\n Tag extends Intergalactic.Tag = 'div',\n>(\n props: Intergalactic.InternalTypings.ComponentProps<\n Tag,\n 'div',\n TabPanelProps<Value>,\n TabPanelContext,\n [handlers: TabPanelHandlers]\n > &\n PropsExtending,\n) => Intergalactic.InternalTypings.ComponentRenderingResults) &\nIntergalactic.InternalTypings.ComponentAdditive<'div', 'div', TabPanelProps>;\n\ndeclare const TabPanel: IntergalacticTabPanelComponent & {\n Item: Intergalactic.Component<'div', TabPanelItemProps, {}, [handlers: TabPanelHandlers]> & {\n Text: typeof Text;\n Addon: typeof Box;\n };\n};\n\ndeclare const wrapTabPanel: <PropsExtending extends {}>(\n wrapper: (\n props: Intergalactic.InternalTypings.UntypeRefAndTag<\n Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticTabPanelComponent>\n > &\n PropsExtending,\n ) => React.ReactNode,\n) => IntergalacticTabPanelComponent<PropsExtending>;\nexport { wrapTabPanel };\n\nexport default TabPanel;\n"],"mappings":"","ignoreList":[]}
|