@semcore/tab-panel 4.43.0-prerelease.0 → 4.43.0-prerelease.4
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 +56 -71
- package/lib/cjs/TabPanel.js.map +1 -1
- package/lib/cjs/index.d.js +2 -0
- package/lib/cjs/index.d.js.map +1 -0
- package/lib/cjs/index.js +5 -14
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/tab-panel.shadow.css +21 -4
- package/lib/es6/TabPanel.js +46 -65
- package/lib/es6/TabPanel.js.map +1 -1
- package/lib/es6/index.d.js +2 -0
- package/lib/es6/index.d.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 +21 -4
- package/lib/esm/TabPanel.mjs +53 -65
- package/lib/esm/index.mjs +0 -1
- package/lib/esm/style/tab-panel.shadow.css +21 -4
- package/lib/types/index.d.ts +92 -2
- package/package.json +4 -4
- package/lib/cjs/TabPanel.type.js +0 -2
- package/lib/cjs/TabPanel.type.js.map +0 -1
- package/lib/es6/TabPanel.type.js +0 -2
- package/lib/es6/TabPanel.type.js.map +0 -1
- package/lib/esm/TabPanel.type.mjs +0 -1
- package/lib/types/TabPanel.d.ts +0 -6
- package/lib/types/TabPanel.type.d.ts +0 -71
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","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,iBAAiB,MAAM,2CAA2C;AACzE,OAAOC,WAAW,MAAM,8CAA8C;AACtE,SAASC,IAAI,IAAIC,SAAS,QAAQ,qBAAqB;AACvD,OAAOC,KAAK,MAAM,OAAO;AAAC;AAAA,IAAAC,KAAA,8BAAAC,QAAA,CAAAC,MAAA;AAAA;AAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;AAAA;AAAA,IAKpBC,YAAY,0BAAAC,UAAA;EAAA,SAAAD,aAAA;IAAA,IAAAE,KAAA;IAAAC,eAAA,OAAAH,YAAA;IAAA,SAAAI,IAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAC,IAAA,OAAAC,KAAA,CAAAJ,IAAA,GAAAK,IAAA,MAAAA,IAAA,GAAAL,IAAA,EAAAK,IAAA;MAAAF,IAAA,CAAAE,IAAA,IAAAJ,SAAA,CAAAI,IAAA;IAAA;IAAAP,KAAA,GAAAQ,UAAA,OAAAV,YAAA,KAAAW,MAAA,CAAAJ,IAAA;IAAAK,eAAA,CAAAV,KAAA,oBA0B+D,EAAE;IAAAU,eAAA,CAAAV,KAAA,iBAQnE,UAACW,KAAgC;MAAA,OAAK,UAACC,KAA0C,EAAK;QAClGZ,KAAA,CAAKa,QAAQ,CAACF,KAAK,CAACA,KAAK,EAAEC,KAAK,CAAC;MACnC,CAAC;IAAA;IAAAF,eAAA,CAAAV,KAAA,mBAEe,UAACW,KAAgC;MAAA,OAAK,UAACC,KAA6C,EAAK;QAC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aAAA,CAAC4B,KAAK,EAAAD,KAAA,CAAA1B,EAAA,UAAAC,aAAA,KAAA6B,aAAA;IAAA,QAA0B,GAAG;IAAA,YAAYD,QAAQ;IAAA;IAAA,mBAA0BtC,cAAc,CAACL,KAAK;EAAC,GAAAuC,KAAA,GAAG,CAAC;AACnI;AAEA,SAASF,KAAKA,CACZtC,KAAyF,EACzF;EAAA,IAAA8C,KAAA,GAAAnB,YAAA;IAAAoB,KAAA;EACA,IAAMC,MAAM,GAE2BnF,GAAG;EAD1C,IAAQgD,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":[]}
|
|
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,YAAY,0BAAAC,UAAA;EAAAC,S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BjF,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"}
|
|
@@ -0,0 +1 @@
|
|
|
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.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default
|
|
2
|
-
export * from './TabPanel
|
|
1
|
+
export { default } from './TabPanel';
|
|
2
|
+
export * from './TabPanel';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/lib/es6/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default"
|
|
1
|
+
{"version":3,"file":"index.js","names":["default"],"sources":["../../src/index.js"],"sourcesContent":["export { default } from './TabPanel';\nexport * from './TabPanel';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AACpC,cAAc,YAAY"}
|
|
@@ -35,18 +35,27 @@ STabPanelItem {
|
|
|
35
35
|
box-shadow: none;
|
|
36
36
|
text-decoration: none;
|
|
37
37
|
-webkit-tap-highlight-color: transparent;
|
|
38
|
+
outline: 0;
|
|
38
39
|
text-align: center;
|
|
39
40
|
vertical-align: middle;
|
|
40
41
|
font-family: inherit;
|
|
41
42
|
cursor: pointer;
|
|
42
43
|
|
|
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
|
+
|
|
43
50
|
&::-moz-focus-inner {
|
|
44
51
|
border: none;
|
|
45
52
|
padding: 0;
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
&:active,
|
|
49
|
-
&:hover
|
|
56
|
+
&:hover,
|
|
57
|
+
&:focus {
|
|
58
|
+
outline: 0;
|
|
50
59
|
text-decoration: none;
|
|
51
60
|
}
|
|
52
61
|
|
|
@@ -75,13 +84,17 @@ STabPanelItem[disabled] {
|
|
|
75
84
|
}
|
|
76
85
|
}
|
|
77
86
|
|
|
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
|
+
|
|
78
91
|
STabPanelItem[selected] {
|
|
79
|
-
color: var(--intergalactic-text-link, oklch(0.53 0.
|
|
92
|
+
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
80
93
|
border-color: var(--intergalactic-border-primary, oklch(0.137 0.026 175.7 / 0.161));
|
|
81
94
|
flex-shrink: 0;
|
|
82
95
|
|
|
83
96
|
&:hover {
|
|
84
|
-
color: var(--intergalactic-text-link-hover-active, oklch(0.51 0.
|
|
97
|
+
color: var(--intergalactic-text-link-hover-active, oklch(0.51 0.202 263));
|
|
85
98
|
}
|
|
86
99
|
|
|
87
100
|
&::after {
|
|
@@ -90,7 +103,11 @@ STabPanelItem[selected] {
|
|
|
90
103
|
}
|
|
91
104
|
|
|
92
105
|
SText {
|
|
106
|
+
display: inline-block;
|
|
93
107
|
margin: auto var(--intergalactic-spacing-2x, 8px);
|
|
108
|
+
white-space: nowrap;
|
|
109
|
+
overflow: hidden;
|
|
110
|
+
text-overflow: ellipsis;
|
|
94
111
|
}
|
|
95
112
|
|
|
96
113
|
SAddon {
|
|
@@ -110,4 +127,4 @@ SAddon:not(:only-child):last-child {
|
|
|
110
127
|
SAddon:only-child {
|
|
111
128
|
margin-right: var(--intergalactic-spacing-2x, 8px);
|
|
112
129
|
margin-left: var(--intergalactic-spacing-2x, 8px);
|
|
113
|
-
}
|
|
130
|
+
}
|
package/lib/esm/TabPanel.mjs
CHANGED
|
@@ -1,48 +1,63 @@
|
|
|
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 _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
|
|
5
5
|
import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
6
|
+
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
|
|
6
7
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
7
|
-
import { sstyled
|
|
8
|
-
import {
|
|
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";
|
|
8
|
+
import { sstyled } from "@semcore/utils/lib/core/index";
|
|
9
|
+
import createComponent, { sstyled as sstyled$1, assignProps, Component } from "@semcore/core";
|
|
12
10
|
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";
|
|
13
15
|
/*!__reshadow-styles__:"./style/tab-panel.shadow.css"*/
|
|
14
16
|
var style = (
|
|
15
17
|
/*__reshadow_css_start__*/
|
|
16
18
|
(sstyled.insert(
|
|
17
19
|
/*__inner_css_start__*/
|
|
18
|
-
'.
|
|
20
|
+
'.___STabPanel_1907k_gg_{display:flex;width:100%;max-width:100%}.___STabPanel_1907k_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_1907k_gg_::after{border-bottom:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___STabPanel_1907k_gg_::after{border-bottom:1px solid var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___STabPanelItem_1907k_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;outline:0;text-align:center;vertical-align:middle;font-family:inherit;cursor:pointer}@supports (color:color(display-p3 0 0 0)){.___STabPanelItem_1907k_gg_{color:var(--intergalactic-text-secondary, rgba(0, 3, 0, 0.583))}@media (color-gamut:p3){.___STabPanelItem_1907k_gg_{color:var(--intergalactic-text-secondary, color(display-p3 0.00228 0.01289 0.00252 / 0.583))}}}.___STabPanelItem_1907k_gg_ .___SText_1907k_gg_{font-size:var(--intergalactic-fs-200, 14px);line-height:var(--intergalactic-lh-200, 142%);font-weight:var(--intergalactic-medium, 500)}.___STabPanelItem_1907k_gg_::-moz-focus-inner{border:0;padding:0}.___STabPanelItem_1907k_gg_:active,.___STabPanelItem_1907k_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___STabPanelItem_1907k_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none;color:var(--intergalactic-text-primary, rgba(1, 5, 0, 0.899))}}.___STabPanelItem_1907k_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_1907k_gg_::after{border-bottom:1px solid var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___STabPanelItem_1907k_gg_::after{border-bottom:1px solid var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}.___STabPanelItem_1907k_gg_.__disabled_1907k_gg_{cursor:default;pointer-events:none}.___STabPanelItem_1907k_gg_.__disabled_1907k_gg_ .___SAddon_1907k_gg_,.___STabPanelItem_1907k_gg_.__disabled_1907k_gg_ .___SText_1907k_gg_{opacity:var(--intergalactic-disabled-opacity, 0.4)}.___STabPanelItem_1907k_gg_.__keyboardFocused_1907k_gg_{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 33, 220, 0.469))}@supports (color:color(display-p3 0 0 0)){.___STabPanelItem_1907k_gg_.__keyboardFocused_1907k_gg_{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 33, 220, 0.469))}@media (color-gamut:p3){.___STabPanelItem_1907k_gg_.__keyboardFocused_1907k_gg_{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px color(display-p3 0.03256 0.12227 0.83249 / 0.469))}}}.___STabPanelItem_1907k_gg_.__selected_1907k_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_1907k_gg_.__selected_1907k_gg_{border-color:var(--intergalactic-border-primary, rgba(0, 12, 8, 0.161))}@media (color-gamut:p3){.___STabPanelItem_1907k_gg_.__selected_1907k_gg_{border-color:var(--intergalactic-border-primary, color(display-p3 0.00798 0.04498 0.03219 / 0.161))}}}@media (hover:hover){.___STabPanelItem_1907k_gg_.__selected_1907k_gg_:hover{color:var(--intergalactic-text-link-hover-active, rgb(33, 89, 215))}}.___STabPanelItem_1907k_gg_.__selected_1907k_gg_::after{border-bottom:none}.___SText_1907k_gg_{display:inline-block;margin:auto var(--intergalactic-spacing-2x, 8px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.___SAddon_1907k_gg_{display:inline-flex;align-items:center;justify-content:center}.___SAddon_1907k_gg_:not(:only-child):first-child{margin-left:var(--intergalactic-spacing-2x, 8px)}.___SAddon_1907k_gg_:not(:only-child):last-child{margin-right:var(--intergalactic-spacing-2x, 8px)}.___SAddon_1907k_gg_:only-child{margin-right:var(--intergalactic-spacing-2x, 8px);margin-left:var(--intergalactic-spacing-2x, 8px)}',
|
|
19
21
|
/*__inner_css_end__*/
|
|
20
|
-
"
|
|
22
|
+
"1907k_gg_"
|
|
21
23
|
), /*__reshadow_css_end__*/
|
|
22
24
|
{
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
25
|
+
"__STabPanelItem": "___STabPanelItem_1907k_gg_",
|
|
26
|
+
"_keyboardFocused": "__keyboardFocused_1907k_gg_",
|
|
27
|
+
"__SText": "___SText_1907k_gg_",
|
|
28
|
+
"__SAddon": "___SAddon_1907k_gg_",
|
|
29
|
+
"__STabPanel": "___STabPanel_1907k_gg_",
|
|
30
|
+
"_disabled": "__disabled_1907k_gg_",
|
|
31
|
+
"_selected": "__selected_1907k_gg_"
|
|
29
32
|
})
|
|
30
33
|
);
|
|
31
|
-
var
|
|
34
|
+
var optionsA11yEnhance = {
|
|
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);
|
|
32
48
|
function TabPanelRoot2() {
|
|
33
49
|
var _this;
|
|
34
50
|
_classCallCheck(this, TabPanelRoot2);
|
|
35
51
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
36
52
|
args[_key] = arguments[_key];
|
|
37
53
|
}
|
|
38
|
-
_this =
|
|
39
|
-
_defineProperty(_this, "
|
|
40
|
-
_defineProperty(_this, "handleClick", function(value) {
|
|
54
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
55
|
+
_defineProperty(_assertThisInitialized(_this), "handleClick", function(value) {
|
|
41
56
|
return function(event) {
|
|
42
57
|
_this.handlers.value(value, event);
|
|
43
58
|
};
|
|
44
59
|
});
|
|
45
|
-
_defineProperty(_this, "handleKeyDown", function(value) {
|
|
60
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function(value) {
|
|
46
61
|
return function(event) {
|
|
47
62
|
if (event.key === "Enter" || event.key === " ") {
|
|
48
63
|
event.preventDefault();
|
|
@@ -52,8 +67,7 @@ var TabPanelRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
52
67
|
});
|
|
53
68
|
return _this;
|
|
54
69
|
}
|
|
55
|
-
|
|
56
|
-
return _createClass(TabPanelRoot2, [{
|
|
70
|
+
_createClass(TabPanelRoot2, [{
|
|
57
71
|
key: "uncontrolledProps",
|
|
58
72
|
value: function uncontrolledProps() {
|
|
59
73
|
return {
|
|
@@ -66,21 +80,11 @@ var TabPanelRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
66
80
|
var value = this.asProps.value;
|
|
67
81
|
var isSelected = value === props.value;
|
|
68
82
|
return {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
|
83
|
+
selected: isSelected,
|
|
84
|
+
onClick: this.handleClick(props.value),
|
|
85
|
+
onKeyDown: this.handleKeyDown(props.value),
|
|
86
|
+
tabIndex: isSelected ? 0 : -1,
|
|
87
|
+
"aria-selected": isSelected
|
|
84
88
|
};
|
|
85
89
|
}
|
|
86
90
|
}, {
|
|
@@ -89,64 +93,48 @@ var TabPanelRoot = /* @__PURE__ */ (function(_Component) {
|
|
|
89
93
|
var _ref = this.asProps, _ref5;
|
|
90
94
|
var STabPanel = Box;
|
|
91
95
|
var styles = this.asProps.styles;
|
|
92
|
-
return _ref5 = sstyled(styles), /* @__PURE__ */ React.createElement(STabPanel, _ref5.cn("STabPanel", _objectSpread({}, assignProps({
|
|
96
|
+
return _ref5 = sstyled$1(styles), /* @__PURE__ */ React.createElement(STabPanel, _ref5.cn("STabPanel", _objectSpread({}, assignProps({
|
|
93
97
|
"role": "tablist"
|
|
94
98
|
}, _ref))));
|
|
95
99
|
}
|
|
96
100
|
}]);
|
|
97
|
-
|
|
101
|
+
return TabPanelRoot2;
|
|
102
|
+
}(Component);
|
|
98
103
|
_defineProperty(TabPanelRoot, "displayName", "TabPanel");
|
|
99
104
|
_defineProperty(TabPanelRoot, "style", style);
|
|
100
105
|
_defineProperty(TabPanelRoot, "defaultProps", {
|
|
101
106
|
defaultValue: null,
|
|
102
107
|
behavior: "manual"
|
|
103
108
|
});
|
|
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
|
-
;
|
|
109
|
+
_defineProperty(TabPanelRoot, "enhance", [a11yEnhance(optionsA11yEnhance)]);
|
|
116
110
|
function TabPanelItem(props) {
|
|
117
111
|
var _ref2 = arguments[0], _ref6;
|
|
118
112
|
var STabPanelItem = Box;
|
|
119
|
-
var Children = props.Children, styles = props.styles, addonLeft = props.addonLeft, addonRight = props.addonRight
|
|
120
|
-
|
|
121
|
-
buttonRefsList[index] = buttonRef;
|
|
122
|
-
return _ref6 = sstyled(styles), /* @__PURE__ */ React.createElement(STabPanelItem, _ref6.cn("STabPanelItem", _objectSpread({}, assignProps({
|
|
113
|
+
var Children = props.Children, styles = props.styles, addonLeft = props.addonLeft, addonRight = props.addonRight;
|
|
114
|
+
return _ref6 = sstyled$1(styles), /* @__PURE__ */ React.createElement(STabPanelItem, _ref6.cn("STabPanelItem", _objectSpread({}, assignProps({
|
|
123
115
|
"type": "button",
|
|
124
116
|
"tag": "button",
|
|
125
|
-
"
|
|
126
|
-
"role": "tab",
|
|
127
|
-
"ref": buttonRef
|
|
117
|
+
"role": "tab"
|
|
128
118
|
}, _ref2))), addonLeft ? /* @__PURE__ */ React.createElement(TabPanel.Item.Addon, {
|
|
129
119
|
tag: addonLeft
|
|
130
120
|
}) : null, addonTextChildren(Children, TabPanel.Item.Text, TabPanel.Item.Addon), addonRight ? /* @__PURE__ */ React.createElement(TabPanel.Item.Addon, {
|
|
131
121
|
tag: addonRight
|
|
132
122
|
}) : null);
|
|
133
123
|
}
|
|
124
|
+
TabPanelItem.enhance = [keyboardFocusEnhance()];
|
|
134
125
|
function Text(props) {
|
|
135
126
|
var _ref3 = arguments[0], _ref7;
|
|
136
|
-
var SText =
|
|
137
|
-
var styles = props.styles
|
|
138
|
-
return _ref7 = sstyled(styles), /* @__PURE__ */ React.createElement(SText, _ref7.cn("SText", _objectSpread({}, assignProps({
|
|
139
|
-
"
|
|
140
|
-
"ellipsis": ellipsis,
|
|
141
|
-
"medium": true,
|
|
142
|
-
"hint:triggerRef": buttonRefsList[index]
|
|
127
|
+
var SText = Box;
|
|
128
|
+
var styles = props.styles;
|
|
129
|
+
return _ref7 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SText, _ref7.cn("SText", _objectSpread({}, assignProps({
|
|
130
|
+
"tag": "span"
|
|
143
131
|
}, _ref3))));
|
|
144
132
|
}
|
|
145
133
|
function Addon(props) {
|
|
146
134
|
var _ref4 = arguments[0], _ref8;
|
|
147
135
|
var SAddon = Box;
|
|
148
136
|
var styles = props.styles;
|
|
149
|
-
return _ref8 = sstyled(styles), /* @__PURE__ */ React.createElement(SAddon, _ref8.cn("SAddon", _objectSpread({}, assignProps({
|
|
137
|
+
return _ref8 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SAddon, _ref8.cn("SAddon", _objectSpread({}, assignProps({
|
|
150
138
|
"tag": "span"
|
|
151
139
|
}, _ref4))));
|
|
152
140
|
}
|
package/lib/esm/index.mjs
CHANGED
|
@@ -35,18 +35,27 @@ STabPanelItem {
|
|
|
35
35
|
box-shadow: none;
|
|
36
36
|
text-decoration: none;
|
|
37
37
|
-webkit-tap-highlight-color: transparent;
|
|
38
|
+
outline: 0;
|
|
38
39
|
text-align: center;
|
|
39
40
|
vertical-align: middle;
|
|
40
41
|
font-family: inherit;
|
|
41
42
|
cursor: pointer;
|
|
42
43
|
|
|
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
|
+
|
|
43
50
|
&::-moz-focus-inner {
|
|
44
51
|
border: none;
|
|
45
52
|
padding: 0;
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
&:active,
|
|
49
|
-
&:hover
|
|
56
|
+
&:hover,
|
|
57
|
+
&:focus {
|
|
58
|
+
outline: 0;
|
|
50
59
|
text-decoration: none;
|
|
51
60
|
}
|
|
52
61
|
|
|
@@ -75,13 +84,17 @@ STabPanelItem[disabled] {
|
|
|
75
84
|
}
|
|
76
85
|
}
|
|
77
86
|
|
|
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
|
+
|
|
78
91
|
STabPanelItem[selected] {
|
|
79
|
-
color: var(--intergalactic-text-link, oklch(0.53 0.
|
|
92
|
+
color: var(--intergalactic-text-link, oklch(0.53 0.21 263));
|
|
80
93
|
border-color: var(--intergalactic-border-primary, oklch(0.137 0.026 175.7 / 0.161));
|
|
81
94
|
flex-shrink: 0;
|
|
82
95
|
|
|
83
96
|
&:hover {
|
|
84
|
-
color: var(--intergalactic-text-link-hover-active, oklch(0.51 0.
|
|
97
|
+
color: var(--intergalactic-text-link-hover-active, oklch(0.51 0.202 263));
|
|
85
98
|
}
|
|
86
99
|
|
|
87
100
|
&::after {
|
|
@@ -90,7 +103,11 @@ STabPanelItem[selected] {
|
|
|
90
103
|
}
|
|
91
104
|
|
|
92
105
|
SText {
|
|
106
|
+
display: inline-block;
|
|
93
107
|
margin: auto var(--intergalactic-spacing-2x, 8px);
|
|
108
|
+
white-space: nowrap;
|
|
109
|
+
overflow: hidden;
|
|
110
|
+
text-overflow: ellipsis;
|
|
94
111
|
}
|
|
95
112
|
|
|
96
113
|
SAddon {
|
|
@@ -110,4 +127,4 @@ SAddon:not(:only-child):last-child {
|
|
|
110
127
|
SAddon:only-child {
|
|
111
128
|
margin-right: var(--intergalactic-spacing-2x, 8px);
|
|
112
129
|
margin-left: var(--intergalactic-spacing-2x, 8px);
|
|
113
|
-
}
|
|
130
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,2 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
|
|
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;
|
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.4",
|
|
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.4",
|
|
18
|
+
"@semcore/flex-box": "5.42.0-prerelease.4"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@semcore/core": "^2.40.0-prerelease.
|
|
21
|
+
"@semcore/core": "^2.40.0-prerelease.4",
|
|
22
22
|
"react": "16.8 - 18",
|
|
23
23
|
"react-dom": "16.8 - 18"
|
|
24
24
|
},
|
package/lib/cjs/TabPanel.type.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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/TabPanel.type.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/lib/types/TabPanel.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
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;
|