@semcore/tab-panel 4.43.0-prerelease.4 → 4.43.0-prerelease.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/TabPanel.js +71 -56
- 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 +14 -5
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/tab-panel.shadow.css +2 -19
- package/lib/es6/TabPanel.js +65 -46
- 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/es6/style/tab-panel.shadow.css +2 -19
- package/lib/esm/TabPanel.mjs +65 -53
- package/lib/esm/TabPanel.type.mjs +1 -0
- package/lib/esm/index.mjs +1 -0
- package/lib/esm/style/tab-panel.shadow.css +2 -19
- package/lib/types/TabPanel.d.ts +6 -0
- package/lib/types/TabPanel.type.d.ts +71 -0
- package/lib/types/index.d.ts +2 -92
- package/package.json +4 -4
- 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/lib/es6/TabPanel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabPanel.js","names":["React","createComponent","Component","sstyled","Root","Box","addonTextChildren","a11yEnhance","keyboardFocusEnhance","style","_sstyled","insert","optionsA11yEnhance","onNeighborChange","neighborElement","props","focus","behavior","click","childSelector","TabPanelRoot","_Component","_inherits","_super","_createSuper","_this","_classCallCheck","_len","arguments","length","args","Array","_key","call","apply","concat","_defineProperty","_assertThisInitialized","value","event","handlers","key","preventDefault","_createClass","uncontrolledProps","getItemProps","index","asProps","isSelected","selected","onClick","handleClick","onKeyDown","handleKeyDown","tabIndex","render","_ref","_ref5","STabPanel","styles","createElement","cn","_objectSpread","_assignProps","defaultValue","TabPanelItem","_ref2","arguments[0]","_ref6","STabPanelItem","Children","addonLeft","addonRight","_assignProps2","TabPanel","Item","Addon","tag","Text","enhance","_ref3","_ref7","SText","_assignProps3","_ref4","_ref8","SAddon","_assignProps4","wrapTabPanel","wrapper"],"sources":["../../src/TabPanel.jsx"],"sourcesContent":["import React from 'react';\nimport createComponent, { Component, sstyled, Root } from '@semcore/core';\nimport { Box } from '@semcore/flex-box';\nimport addonTextChildren from '@semcore/utils/lib/addonTextChildren';\nimport a11yEnhance from '@semcore/utils/lib/enhances/a11yEnhance';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\n\nimport style from './style/tab-panel.shadow.css';\n\nconst optionsA11yEnhance = {\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\nclass TabPanelRoot extends Component {\n static displayName = 'TabPanel';\n static style = style;\n static defaultProps = {\n defaultValue: null,\n behavior: 'manual',\n };\n static enhance = [a11yEnhance(optionsA11yEnhance)];\n\n uncontrolledProps() {\n return {\n value: null,\n };\n }\n\n handleClick = (value) => (event) => {\n this.handlers.value(value, event);\n };\n\n handleKeyDown = (value) => (event) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this.handlers.value(value, event);\n }\n };\n\n getItemProps(props, index) {\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 };\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 const wrapTabPanel = (wrapper) => wrapper;\n\nexport default TabPanel;\n"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,eAAe,IAAIC,SAAS,EAAEC,OAAO,EAAEC,IAAI,QAAQ,eAAe;AACzE,SAASC,GAAG,QAAQ,mBAAmB;AACvC,OAAOC,iBAAiB,MAAM,sCAAsC;AACpE,OAAOC,WAAW,MAAM,yCAAyC;AACjE,OAAOC,oBAAoB,MAAM,kDAAkD;AAAC;AAAA,IAAAC,KAAA,+BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAIpF,IAAMC,kBAAkB,GAAG;EACzBC,gBAAgB,EAAE,SAAAA,iBAACC,eAAe,EAAEC,KAAK,EAAK;IAC5C,IAAID,eAAe,EAAE;MACnBA,eAAe,CAACE,KAAK,EAAE;MACvB,IAAID,KAAK,CAACE,QAAQ,KAAK,MAAM,EAAE;QAC7BH,eAAe,CAACI,KAAK,EAAE;MACzB;IACF;EACF,CAAC;EACDC,aAAa,EAAE,CAAC,MAAM,EAAE,KAAK;AAC/B,CAAC;AAAC,IAEIC,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AAA;EACpB,IAAMC,MAAM,GAE2BjF,GAAG;EAD1C,IAAQsD,MAAM,GAAK5C,KAAK,CAAhB4C,MAAM;EACd,OAAA0B,KAAA,GAAOlF,OAAO,CAACwD,MAAM,CAAC,eAAC3D,KAAA,CAAA4D,aAAA,CAAC0B,MAAM,EAAAD,KAAA,CAAAxB,EAAA,WAAAC,aAAA,KAAAyB,aAAA;IAAA,OAAkB;EAAM,GAAAH,KAAA,IAAG;AAC3D;AAEA,IAAMV,QAAQ,GAAGzE,eAAe,CAACmB,YAAY,EAAE;EAC7CuD,IAAI,EAAE,CAACV,YAAY,EAAE;IAAEa,IAAI,EAAJA,IAAI;IAAEF,KAAK,EAALA;EAAM,CAAC;AACtC,CAAC,CAAC;AAEF,OAAO,IAAMY,YAAY,GAAG,SAAfA,YAAYA,CAAIC,OAAO;EAAA,OAAKA,OAAO;AAAA;AAEhD,eAAef,QAAQ"}
|
|
1
|
+
{"version":3,"file":"TabPanel.js","names":["Box","createComponent","Component","sstyled","Root","addonTextChildren","a11yEnhance","Text","UikitText","React","style","_sstyled","insert","TabPanelRoot","_Component","_this","_classCallCheck","_len","arguments","length","args","Array","_key","_callSuper","concat","_defineProperty","value","event","handlers","key","preventDefault","_inherits","_createClass","uncontrolledProps","getItemProps","props","index","asProps","isSelected","handleClick","handleKeyDown","buttonRefsList","getItemTextProps","_","render","_ref","_ref5","STabPanel","styles","createElement","cn","_objectSpread","_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","_props$ellipsis","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,i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D,MAAM,GAAKb,KAAK,CAAhBa,MAAM;EACd,OAAAkC,KAAA,GAAO/E,OAAO,CAAC6C,MAAM,CAAC,eAACvC,KAAA,CAAAwC,aAAA,CAACkC,MAAM,EAAAD,KAAA,CAAAhC,EAAA,WAAAC,aAAA,KAAAiC,aAAA;IAAA,OAAkB;EAAM,GAAAH,KAAA,GAAE,CAAC;AAC3D;AAEA,IAAMV,QAAQ,GAAGtE,eAAe,CAACY,YAAY,EAAE;EAC7C2D,IAAI,EAAE,CAACZ,YAAY,EAAE;IAAErD,IAAI,EAAJA,IAAI;IAAEkE,KAAK,EAALA;EAAM,CAAC;AACtC,CAAC,CAAoC;AAErC,OAAO,IAAMY,YAAY,GAAG,SAAfA,YAAYA,CAA+BC,OAKpC;EAAA,OAAKA,OAAO;AAAA,CAA+C;AAE/E,eAAef,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":[]}
|
|
@@ -35,27 +35,18 @@ STabPanelItem {
|
|
|
35
35
|
box-shadow: none;
|
|
36
36
|
text-decoration: none;
|
|
37
37
|
-webkit-tap-highlight-color: transparent;
|
|
38
|
-
outline: 0;
|
|
39
38
|
text-align: center;
|
|
40
39
|
vertical-align: middle;
|
|
41
40
|
font-family: inherit;
|
|
42
41
|
cursor: pointer;
|
|
43
42
|
|
|
44
|
-
& SText {
|
|
45
|
-
font-size: var(--intergalactic-fs-200, 14px);
|
|
46
|
-
line-height: var(--intergalactic-lh-200, 142%);
|
|
47
|
-
font-weight: var(--intergalactic-medium, 500);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
43
|
&::-moz-focus-inner {
|
|
51
44
|
border: none;
|
|
52
45
|
padding: 0;
|
|
53
46
|
}
|
|
54
47
|
|
|
55
48
|
&:active,
|
|
56
|
-
&:hover
|
|
57
|
-
&:focus {
|
|
58
|
-
outline: 0;
|
|
49
|
+
&:hover {
|
|
59
50
|
text-decoration: none;
|
|
60
51
|
}
|
|
61
52
|
|
|
@@ -84,10 +75,6 @@ STabPanelItem[disabled] {
|
|
|
84
75
|
}
|
|
85
76
|
}
|
|
86
77
|
|
|
87
|
-
STabPanelItem[keyboardFocused] {
|
|
88
|
-
box-shadow: var(--intergalactic-keyboard-focus, 0px 0px 0px 3px oklch(0.424 0.269 264.2 / 0.469));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
78
|
STabPanelItem[selected] {
|
|
92
79
|
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
93
80
|
border-color: var(--intergalactic-border-primary, oklch(0.137 0.026 175.7 / 0.161));
|
|
@@ -103,11 +90,7 @@ STabPanelItem[selected] {
|
|
|
103
90
|
}
|
|
104
91
|
|
|
105
92
|
SText {
|
|
106
|
-
display: inline-block;
|
|
107
93
|
margin: auto var(--intergalactic-spacing-2x, 8px);
|
|
108
|
-
white-space: nowrap;
|
|
109
|
-
overflow: hidden;
|
|
110
|
-
text-overflow: ellipsis;
|
|
111
94
|
}
|
|
112
95
|
|
|
113
96
|
SAddon {
|
|
@@ -127,4 +110,4 @@ SAddon:not(:only-child):last-child {
|
|
|
127
110
|
SAddon:only-child {
|
|
128
111
|
margin-right: var(--intergalactic-spacing-2x, 8px);
|
|
129
112
|
margin-left: var(--intergalactic-spacing-2x, 8px);
|
|
130
|
-
}
|
|
113
|
+
}
|
package/lib/esm/TabPanel.mjs
CHANGED
|
@@ -1,63 +1,48 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
4
|
-
import
|
|
4
|
+
import _callSuper from "@babel/runtime/helpers/esm/callSuper";
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
-
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
7
6
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
-
import { sstyled } from "@semcore/
|
|
9
|
-
import
|
|
7
|
+
import { sstyled, assignProps, Component, createComponent } from "@semcore/core";
|
|
8
|
+
import { Box } from "@semcore/base-components";
|
|
9
|
+
import addonTextChildren from "@semcore/core/lib/utils/addonTextChildren";
|
|
10
|
+
import a11yEnhance from "@semcore/core/lib/utils/enhances/a11yEnhance";
|
|
11
|
+
import { Text as Text$1 } from "@semcore/typography";
|
|
10
12
|
import React from "react";
|
|
11
|
-
import { Box } from "@semcore/flex-box";
|
|
12
|
-
import addonTextChildren from "@semcore/utils/lib/addonTextChildren";
|
|
13
|
-
import a11yEnhance from "@semcore/utils/lib/enhances/a11yEnhance";
|
|
14
|
-
import keyboardFocusEnhance from "@semcore/utils/lib/enhances/keyboardFocusEnhance";
|
|
15
13
|
/*!__reshadow-styles__:"./style/tab-panel.shadow.css"*/
|
|
16
14
|
var style = (
|
|
17
15
|
/*__reshadow_css_start__*/
|
|
18
16
|
(sstyled.insert(
|
|
19
17
|
/*__inner_css_start__*/
|
|
20
|
-
'.
|
|
18
|
+
'.___STabPanel_13pnv_gg_{display:flex;width:100%;max-width:100%}.___STabPanel_13pnv_gg_::after{content:"";position:relative;bottom:-1px;flex:1;border-top:1px solid transparent;border-bottom:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@supports (color:color(display-p3 0 0 0%)){.___STabPanel_13pnv_gg_::after{border-bottom:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___STabPanel_13pnv_gg_::after{border-bottom:1px solid var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___STabPanelItem_13pnv_gg_{position:relative;bottom:-1px;display:inline-flex;min-width:0;height:32px;color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583));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}@supports (color:color(display-p3 0 0 0%)){.___STabPanelItem_13pnv_gg_{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___STabPanelItem_13pnv_gg_{color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}.___STabPanelItem_13pnv_gg_::-moz-focus-inner{border:0;padding:0}.___STabPanelItem_13pnv_gg_:active{-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___STabPanelItem_13pnv_gg_:hover{-webkit-text-decoration:none;text-decoration:none;color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}}.___STabPanelItem_13pnv_gg_::after{content:"";position:absolute;left:-1px;bottom:0;width:calc(100% + 2px);border-bottom:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@supports (color:color(display-p3 0 0 0%)){.___STabPanelItem_13pnv_gg_::after{border-bottom:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___STabPanelItem_13pnv_gg_::after{border-bottom:1px solid var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___STabPanelItem_13pnv_gg_.__disabled_13pnv_gg_{cursor:default;pointer-events:none}.___STabPanelItem_13pnv_gg_.__disabled_13pnv_gg_ .___SAddon_13pnv_gg_,.___STabPanelItem_13pnv_gg_.__disabled_13pnv_gg_ .___SText_13pnv_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4)}.___STabPanelItem_13pnv_gg_.__selected_13pnv_gg_{color:var(--intergalactic-text-link, rgb(35, 95, 226));border-color:var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161));flex-shrink:0}@supports (color:color(display-p3 0 0 0%)){.___STabPanelItem_13pnv_gg_.__selected_13pnv_gg_{border-color:var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___STabPanelItem_13pnv_gg_.__selected_13pnv_gg_{border-color:var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}@media (hover:hover){.___STabPanelItem_13pnv_gg_.__selected_13pnv_gg_:hover{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}}.___STabPanelItem_13pnv_gg_.__selected_13pnv_gg_::after{border-bottom:none}.___SText_13pnv_gg_{margin:auto var(--intergalactic-spacing-2x, 8px)}.___SAddon_13pnv_gg_{display:inline-flex;align-items:center;justify-content:center}.___SAddon_13pnv_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SAddon_13pnv_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-2x, 8px)}.___SAddon_13pnv_gg_:only-child{margin-right:var(--intergalactic-spacing-2x, 8px);margin-left:var(--intergalactic-spacing-2x, 8px)}',
|
|
21
19
|
/*__inner_css_end__*/
|
|
22
|
-
"
|
|
20
|
+
"13pnv_gg_"
|
|
23
21
|
), /*__reshadow_css_end__*/
|
|
24
22
|
{
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"_selected": "__selected_1907k_gg_"
|
|
23
|
+
"__SText": "___SText_13pnv_gg_",
|
|
24
|
+
"__SAddon": "___SAddon_13pnv_gg_",
|
|
25
|
+
"__STabPanel": "___STabPanel_13pnv_gg_",
|
|
26
|
+
"__STabPanelItem": "___STabPanelItem_13pnv_gg_",
|
|
27
|
+
"_disabled": "__disabled_13pnv_gg_",
|
|
28
|
+
"_selected": "__selected_13pnv_gg_"
|
|
32
29
|
})
|
|
33
30
|
);
|
|
34
|
-
var
|
|
35
|
-
onNeighborChange: function onNeighborChange(neighborElement, props) {
|
|
36
|
-
if (neighborElement) {
|
|
37
|
-
neighborElement.focus();
|
|
38
|
-
if (props.behavior === "auto") {
|
|
39
|
-
neighborElement.click();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
childSelector: ["role", "tab"]
|
|
44
|
-
};
|
|
45
|
-
var TabPanelRoot = /* @__PURE__ */ function(_Component) {
|
|
46
|
-
_inherits(TabPanelRoot2, _Component);
|
|
47
|
-
var _super = _createSuper(TabPanelRoot2);
|
|
31
|
+
var TabPanelRoot = /* @__PURE__ */ (function(_Component) {
|
|
48
32
|
function TabPanelRoot2() {
|
|
49
33
|
var _this;
|
|
50
34
|
_classCallCheck(this, TabPanelRoot2);
|
|
51
35
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
52
36
|
args[_key] = arguments[_key];
|
|
53
37
|
}
|
|
54
|
-
_this =
|
|
55
|
-
_defineProperty(
|
|
38
|
+
_this = _callSuper(this, TabPanelRoot2, [].concat(args));
|
|
39
|
+
_defineProperty(_this, "buttonRefsList", []);
|
|
40
|
+
_defineProperty(_this, "handleClick", function(value) {
|
|
56
41
|
return function(event) {
|
|
57
42
|
_this.handlers.value(value, event);
|
|
58
43
|
};
|
|
59
44
|
});
|
|
60
|
-
_defineProperty(
|
|
45
|
+
_defineProperty(_this, "handleKeyDown", function(value) {
|
|
61
46
|
return function(event) {
|
|
62
47
|
if (event.key === "Enter" || event.key === " ") {
|
|
63
48
|
event.preventDefault();
|
|
@@ -67,7 +52,8 @@ var TabPanelRoot = /* @__PURE__ */ function(_Component) {
|
|
|
67
52
|
});
|
|
68
53
|
return _this;
|
|
69
54
|
}
|
|
70
|
-
|
|
55
|
+
_inherits(TabPanelRoot2, _Component);
|
|
56
|
+
return _createClass(TabPanelRoot2, [{
|
|
71
57
|
key: "uncontrolledProps",
|
|
72
58
|
value: function uncontrolledProps() {
|
|
73
59
|
return {
|
|
@@ -80,11 +66,21 @@ var TabPanelRoot = /* @__PURE__ */ function(_Component) {
|
|
|
80
66
|
var value = this.asProps.value;
|
|
81
67
|
var isSelected = value === props.value;
|
|
82
68
|
return {
|
|
83
|
-
selected: isSelected,
|
|
84
|
-
onClick: this.handleClick(props.value),
|
|
85
|
-
onKeyDown: this.handleKeyDown(props.value),
|
|
86
|
-
tabIndex: isSelected ? 0 : -1,
|
|
87
|
-
"aria-selected": isSelected
|
|
69
|
+
"selected": isSelected,
|
|
70
|
+
"onClick": this.handleClick(props.value),
|
|
71
|
+
"onKeyDown": this.handleKeyDown(props.value),
|
|
72
|
+
"tabIndex": isSelected ? 0 : -1,
|
|
73
|
+
"aria-selected": isSelected,
|
|
74
|
+
"buttonRefsList": this.buttonRefsList,
|
|
75
|
+
index
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
79
|
+
key: "getItemTextProps",
|
|
80
|
+
value: function getItemTextProps(_, index) {
|
|
81
|
+
return {
|
|
82
|
+
buttonRefsList: this.buttonRefsList,
|
|
83
|
+
index
|
|
88
84
|
};
|
|
89
85
|
}
|
|
90
86
|
}, {
|
|
@@ -93,48 +89,64 @@ var TabPanelRoot = /* @__PURE__ */ function(_Component) {
|
|
|
93
89
|
var _ref = this.asProps, _ref5;
|
|
94
90
|
var STabPanel = Box;
|
|
95
91
|
var styles = this.asProps.styles;
|
|
96
|
-
return _ref5 = sstyled
|
|
92
|
+
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(STabPanel, _ref5.cn("STabPanel", _objectSpread({}, assignProps({
|
|
97
93
|
"role": "tablist"
|
|
98
94
|
}, _ref))));
|
|
99
95
|
}
|
|
100
96
|
}]);
|
|
101
|
-
|
|
102
|
-
}(Component);
|
|
97
|
+
})(Component);
|
|
103
98
|
_defineProperty(TabPanelRoot, "displayName", "TabPanel");
|
|
104
99
|
_defineProperty(TabPanelRoot, "style", style);
|
|
105
100
|
_defineProperty(TabPanelRoot, "defaultProps", {
|
|
106
101
|
defaultValue: null,
|
|
107
102
|
behavior: "manual"
|
|
108
103
|
});
|
|
109
|
-
_defineProperty(TabPanelRoot, "enhance", [a11yEnhance(
|
|
104
|
+
_defineProperty(TabPanelRoot, "enhance", [a11yEnhance({
|
|
105
|
+
onNeighborChange: function onNeighborChange(neighborElement, props) {
|
|
106
|
+
if (neighborElement) {
|
|
107
|
+
neighborElement.focus();
|
|
108
|
+
if (props.behavior === "auto") {
|
|
109
|
+
neighborElement.click();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
childSelector: ["role", "tab"]
|
|
114
|
+
})]);
|
|
115
|
+
;
|
|
110
116
|
function TabPanelItem(props) {
|
|
111
117
|
var _ref2 = arguments[0], _ref6;
|
|
112
118
|
var STabPanelItem = Box;
|
|
113
|
-
var Children = props.Children, styles = props.styles, addonLeft = props.addonLeft, addonRight = props.addonRight;
|
|
114
|
-
|
|
119
|
+
var Children = props.Children, styles = props.styles, addonLeft = props.addonLeft, addonRight = props.addonRight, buttonRefsList = props.buttonRefsList, index = props.index;
|
|
120
|
+
var buttonRef = React.useRef();
|
|
121
|
+
buttonRefsList[index] = buttonRef;
|
|
122
|
+
return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(STabPanelItem, _ref6.cn("STabPanelItem", _objectSpread({}, assignProps({
|
|
115
123
|
"type": "button",
|
|
116
124
|
"tag": "button",
|
|
117
|
-
"
|
|
125
|
+
"tabIndex": 0,
|
|
126
|
+
"role": "tab",
|
|
127
|
+
"ref": buttonRef
|
|
118
128
|
}, _ref2))), addonLeft ? /* @__PURE__ */ React.createElement(TabPanel.Item.Addon, {
|
|
119
129
|
tag: addonLeft
|
|
120
130
|
}) : null, addonTextChildren(Children, TabPanel.Item.Text, TabPanel.Item.Addon), addonRight ? /* @__PURE__ */ React.createElement(TabPanel.Item.Addon, {
|
|
121
131
|
tag: addonRight
|
|
122
132
|
}) : null);
|
|
123
133
|
}
|
|
124
|
-
TabPanelItem.enhance = [keyboardFocusEnhance()];
|
|
125
134
|
function Text(props) {
|
|
126
135
|
var _ref3 = arguments[0], _ref7;
|
|
127
|
-
var SText =
|
|
128
|
-
var styles = props.styles;
|
|
129
|
-
return _ref7 = sstyled
|
|
130
|
-
"
|
|
136
|
+
var SText = Text$1;
|
|
137
|
+
var styles = props.styles, _props$ellipsis = props.ellipsis, ellipsis = _props$ellipsis === void 0 ? true : _props$ellipsis, buttonRefsList = props.buttonRefsList, index = props.index;
|
|
138
|
+
return _ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(SText, _ref7.cn("SText", _objectSpread({}, assignProps({
|
|
139
|
+
"size": 200,
|
|
140
|
+
"ellipsis": ellipsis,
|
|
141
|
+
"medium": true,
|
|
142
|
+
"hint:triggerRef": buttonRefsList[index]
|
|
131
143
|
}, _ref3))));
|
|
132
144
|
}
|
|
133
145
|
function Addon(props) {
|
|
134
146
|
var _ref4 = arguments[0], _ref8;
|
|
135
147
|
var SAddon = Box;
|
|
136
148
|
var styles = props.styles;
|
|
137
|
-
return _ref8 = sstyled
|
|
149
|
+
return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(SAddon, _ref8.cn("SAddon", _objectSpread({}, assignProps({
|
|
138
150
|
"tag": "span"
|
|
139
151
|
}, _ref4))));
|
|
140
152
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/lib/esm/index.mjs
CHANGED
|
@@ -35,27 +35,18 @@ STabPanelItem {
|
|
|
35
35
|
box-shadow: none;
|
|
36
36
|
text-decoration: none;
|
|
37
37
|
-webkit-tap-highlight-color: transparent;
|
|
38
|
-
outline: 0;
|
|
39
38
|
text-align: center;
|
|
40
39
|
vertical-align: middle;
|
|
41
40
|
font-family: inherit;
|
|
42
41
|
cursor: pointer;
|
|
43
42
|
|
|
44
|
-
& SText {
|
|
45
|
-
font-size: var(--intergalactic-fs-200, 14px);
|
|
46
|
-
line-height: var(--intergalactic-lh-200, 142%);
|
|
47
|
-
font-weight: var(--intergalactic-medium, 500);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
43
|
&::-moz-focus-inner {
|
|
51
44
|
border: none;
|
|
52
45
|
padding: 0;
|
|
53
46
|
}
|
|
54
47
|
|
|
55
48
|
&:active,
|
|
56
|
-
&:hover
|
|
57
|
-
&:focus {
|
|
58
|
-
outline: 0;
|
|
49
|
+
&:hover {
|
|
59
50
|
text-decoration: none;
|
|
60
51
|
}
|
|
61
52
|
|
|
@@ -84,10 +75,6 @@ STabPanelItem[disabled] {
|
|
|
84
75
|
}
|
|
85
76
|
}
|
|
86
77
|
|
|
87
|
-
STabPanelItem[keyboardFocused] {
|
|
88
|
-
box-shadow: var(--intergalactic-keyboard-focus, 0px 0px 0px 3px oklch(0.424 0.269 264.2 / 0.469));
|
|
89
|
-
}
|
|
90
|
-
|
|
91
78
|
STabPanelItem[selected] {
|
|
92
79
|
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
93
80
|
border-color: var(--intergalactic-border-primary, oklch(0.137 0.026 175.7 / 0.161));
|
|
@@ -103,11 +90,7 @@ STabPanelItem[selected] {
|
|
|
103
90
|
}
|
|
104
91
|
|
|
105
92
|
SText {
|
|
106
|
-
display: inline-block;
|
|
107
93
|
margin: auto var(--intergalactic-spacing-2x, 8px);
|
|
108
|
-
white-space: nowrap;
|
|
109
|
-
overflow: hidden;
|
|
110
|
-
text-overflow: ellipsis;
|
|
111
94
|
}
|
|
112
95
|
|
|
113
96
|
SAddon {
|
|
@@ -127,4 +110,4 @@ SAddon:not(:only-child):last-child {
|
|
|
127
110
|
SAddon:only-child {
|
|
128
111
|
margin-right: var(--intergalactic-spacing-2x, 8px);
|
|
129
112
|
margin-left: var(--intergalactic-spacing-2x, 8px);
|
|
130
|
-
}
|
|
113
|
+
}
|
|
@@ -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,92 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Box, BoxProps } from '@semcore/flex-box';
|
|
4
|
-
import { KeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
5
|
-
|
|
6
|
-
export type TabPanelValue = string | number | boolean;
|
|
7
|
-
|
|
8
|
-
/** @deprecated */
|
|
9
|
-
export interface ITabPanelProps<T extends TabPanelValue = TabPanelValue>
|
|
10
|
-
extends TabPanelProps<T>,
|
|
11
|
-
UnknownProperties {}
|
|
12
|
-
export type TabPanelProps<T extends TabPanelValue = TabPanelValue> = BoxProps & {
|
|
13
|
-
/** Is invoked when changing the selection */
|
|
14
|
-
onChange?:
|
|
15
|
-
| ((value: T, e?: React.SyntheticEvent<HTMLButtonElement>) => void)
|
|
16
|
-
| React.Dispatch<React.SetStateAction<T>>;
|
|
17
|
-
/** Value of the selected tab */
|
|
18
|
-
value?: T;
|
|
19
|
-
/** Default value of the selected tab
|
|
20
|
-
* @default null
|
|
21
|
-
* */
|
|
22
|
-
defaultValue?: T;
|
|
23
|
-
/**
|
|
24
|
-
* Behavior of tabs.
|
|
25
|
-
* In `auto`, changes the tab immediately when press arrow.
|
|
26
|
-
* In `manual`, needs to press `space` or `enter` for select a choice.
|
|
27
|
-
* @default 'auto'
|
|
28
|
-
*/
|
|
29
|
-
behavior?: 'auto' | 'manual';
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/** @deprecated */
|
|
33
|
-
export interface ITabPanelItemProps extends TabPanelItemProps, UnknownProperties {}
|
|
34
|
-
export type TabPanelItemProps = BoxProps &
|
|
35
|
-
KeyboardFocusProps & {
|
|
36
|
-
/** Makes a tab selected. This property is determined automatically depending on the value. */
|
|
37
|
-
selected?: boolean;
|
|
38
|
-
/** Disabled state */
|
|
39
|
-
disabled?: boolean;
|
|
40
|
-
/** Tab value */
|
|
41
|
-
value?: TabPanelValue;
|
|
42
|
-
/** Left addon tag */
|
|
43
|
-
addonLeft?: React.ElementType;
|
|
44
|
-
/** Right addon tag */
|
|
45
|
-
addonRight?: React.ElementType;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
/** @deprecated */
|
|
49
|
-
export interface ITabPanelContext extends TabPanelContext, UnknownProperties {}
|
|
50
|
-
export type TabPanelContext = {
|
|
51
|
-
getItemProps: PropGetterFn;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/** @deprecated */
|
|
55
|
-
export interface ITabPanelHandlers extends TabPanelHandlers, UnknownProperties {}
|
|
56
|
-
export type TabPanelHandlers = {
|
|
57
|
-
value: (value: TabPanelValue) => void;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
type IntergalacticTabPanelComponent<PropsExtending = {}> = (<
|
|
61
|
-
Value extends TabPanelValue,
|
|
62
|
-
Tag extends Intergalactic.Tag = 'div',
|
|
63
|
-
>(
|
|
64
|
-
props: Intergalactic.InternalTypings.ComponentProps<
|
|
65
|
-
Tag,
|
|
66
|
-
'div',
|
|
67
|
-
TabPanelProps<Value>,
|
|
68
|
-
TabPanelContext,
|
|
69
|
-
[handlers: TabPanelHandlers]
|
|
70
|
-
> &
|
|
71
|
-
PropsExtending,
|
|
72
|
-
) => Intergalactic.InternalTypings.ComponentRenderingResults) &
|
|
73
|
-
Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', TabPanelProps>;
|
|
74
|
-
|
|
75
|
-
declare const TabPanel: IntergalacticTabPanelComponent & {
|
|
76
|
-
Item: Intergalactic.Component<'div', TabPanelItemProps, {}, [handlers: TabPanelHandlers]> & {
|
|
77
|
-
Text: typeof Box;
|
|
78
|
-
Addon: typeof Box;
|
|
79
|
-
};
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
declare const wrapTabPanel: <PropsExtending extends {}>(
|
|
83
|
-
wrapper: (
|
|
84
|
-
props: Intergalactic.InternalTypings.UntypeRefAndTag<
|
|
85
|
-
Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticTabPanelComponent>
|
|
86
|
-
> &
|
|
87
|
-
PropsExtending,
|
|
88
|
-
) => React.ReactNode,
|
|
89
|
-
) => IntergalacticTabPanelComponent<PropsExtending>;
|
|
90
|
-
export { wrapTabPanel };
|
|
91
|
-
|
|
92
|
-
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": "4.43.0-prerelease.
|
|
4
|
+
"version": "4.43.0-prerelease.5",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/utils": "4.49.0-prerelease.
|
|
18
|
-
"@semcore/flex-box": "5.42.0-prerelease.
|
|
17
|
+
"@semcore/utils": "4.49.0-prerelease.5",
|
|
18
|
+
"@semcore/flex-box": "5.42.0-prerelease.5"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@semcore/core": "^2.40.0-prerelease.
|
|
21
|
+
"@semcore/core": "^2.40.0-prerelease.5",
|
|
22
22
|
"react": "16.8 - 18",
|
|
23
23
|
"react-dom": "16.8 - 18"
|
|
24
24
|
},
|
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 React from 'react';\nimport { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport { KeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\n\nexport type TabPanelValue = string | number | boolean;\n\n/** @deprecated */\nexport interface ITabPanelProps<T extends TabPanelValue = TabPanelValue>\n extends TabPanelProps<T>,\n UnknownProperties {}\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\n/** @deprecated */\nexport interface ITabPanelItemProps extends TabPanelItemProps, UnknownProperties {}\nexport type TabPanelItemProps = BoxProps &\n KeyboardFocusProps & {\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\n/** @deprecated */\nexport interface ITabPanelContext extends TabPanelContext, UnknownProperties {}\nexport type TabPanelContext = {\n getItemProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface ITabPanelHandlers extends TabPanelHandlers, UnknownProperties {}\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) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', TabPanelProps>;\n\ndeclare const TabPanel: IntergalacticTabPanelComponent & {\n Item: Intergalactic.Component<'div', TabPanelItemProps, {}, [handlers: TabPanelHandlers]> & {\n Text: typeof Box;\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":""}
|
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 React from 'react';\nimport { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';\nimport { Box, BoxProps } from '@semcore/flex-box';\nimport { KeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\n\nexport type TabPanelValue = string | number | boolean;\n\n/** @deprecated */\nexport interface ITabPanelProps<T extends TabPanelValue = TabPanelValue>\n extends TabPanelProps<T>,\n UnknownProperties {}\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\n/** @deprecated */\nexport interface ITabPanelItemProps extends TabPanelItemProps, UnknownProperties {}\nexport type TabPanelItemProps = BoxProps &\n KeyboardFocusProps & {\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\n/** @deprecated */\nexport interface ITabPanelContext extends TabPanelContext, UnknownProperties {}\nexport type TabPanelContext = {\n getItemProps: PropGetterFn;\n};\n\n/** @deprecated */\nexport interface ITabPanelHandlers extends TabPanelHandlers, UnknownProperties {}\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) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', TabPanelProps>;\n\ndeclare const TabPanel: IntergalacticTabPanelComponent & {\n Item: Intergalactic.Component<'div', TabPanelItemProps, {}, [handlers: TabPanelHandlers]> & {\n Text: typeof Box;\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":""}
|