@semcore/tab-line 16.1.0 → 16.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/lib/cjs/TabLine.js +45 -76
- package/lib/cjs/TabLine.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 +4 -13
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/style/tab-line.shadow.css +19 -2
- package/lib/es6/TabLine.js +39 -70
- package/lib/es6/TabLine.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-line.shadow.css +19 -2
- package/lib/esm/TabLine.mjs +41 -65
- package/lib/esm/index.mjs +0 -1
- package/lib/esm/style/tab-line.shadow.css +19 -2
- package/lib/types/index.d.ts +102 -2
- package/package.json +3 -3
- package/lib/cjs/TabLine.type.js +0 -2
- package/lib/cjs/TabLine.type.js.map +0 -1
- package/lib/es6/TabLine.type.js +0 -2
- package/lib/es6/TabLine.type.js.map +0 -1
- package/lib/esm/TabLine.type.mjs +0 -1
- package/lib/types/TabLine.d.ts +0 -6
- package/lib/types/TabLine.type.d.ts +0 -80
package/lib/types/index.d.ts
CHANGED
|
@@ -1,2 +1,102 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { PropGetterFn, UnknownProperties, Intergalactic } from '@semcore/core';
|
|
2
|
+
import type { Box, BoxProps } from '@semcore/flex-box';
|
|
3
|
+
import type { NeighborItemProps, NeighborLocationProps } from '@semcore/neighbor-location';
|
|
4
|
+
import type React from 'react';
|
|
5
|
+
|
|
6
|
+
export type TabLineValue = string | number | boolean;
|
|
7
|
+
|
|
8
|
+
/** @deprecated */
|
|
9
|
+
export interface ITabLineProps<T extends TabLineValue = TabLineValue>
|
|
10
|
+
extends TabLineProps<T>,
|
|
11
|
+
UnknownProperties {}
|
|
12
|
+
export type TabLineProps<T extends TabLineValue = TabLineValue> = BoxProps &
|
|
13
|
+
NeighborLocationProps & {
|
|
14
|
+
/** TabLine size
|
|
15
|
+
* @default m
|
|
16
|
+
* */
|
|
17
|
+
size?: 'm' | 'l' | false;
|
|
18
|
+
/** Adds a bottom border for the entire component
|
|
19
|
+
* @default true
|
|
20
|
+
* */
|
|
21
|
+
underlined?: boolean;
|
|
22
|
+
/** Is invoked when changing the selection */
|
|
23
|
+
onChange?:
|
|
24
|
+
| ((value: T, e?: React.SyntheticEvent<HTMLButtonElement>) => void)
|
|
25
|
+
| React.Dispatch<React.SetStateAction<T>>;
|
|
26
|
+
/** Value of the selected tab */
|
|
27
|
+
value?: T;
|
|
28
|
+
/** Default value of the selected tab
|
|
29
|
+
* @default null
|
|
30
|
+
* */
|
|
31
|
+
defaultValue?: T;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Behavior of tabs.
|
|
35
|
+
* In `auto`, changes the tab immediately when press arrow.
|
|
36
|
+
* In `manual`, needs to press `space` or `enter` for select a choice.
|
|
37
|
+
* @default 'auto'
|
|
38
|
+
*/
|
|
39
|
+
behavior?: 'auto' | 'manual';
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/** @deprecated */
|
|
43
|
+
export interface ITabLineItemProps extends TabLineItemProps, UnknownProperties {}
|
|
44
|
+
export type TabLineItemProps = BoxProps &
|
|
45
|
+
NeighborItemProps & {
|
|
46
|
+
/** Makes a tab selected. This property is determined automatically depending on the value. */
|
|
47
|
+
selected?: boolean;
|
|
48
|
+
/** Disabled state */
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
/** Tab value */
|
|
51
|
+
value?: TabLineValue;
|
|
52
|
+
/** Left addon tag */
|
|
53
|
+
addonLeft?: React.ElementType;
|
|
54
|
+
/** Right addon tag */
|
|
55
|
+
addonRight?: React.ElementType;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** @deprecated */
|
|
59
|
+
export interface ITabLineContext extends TabLineContext, UnknownProperties {}
|
|
60
|
+
export type TabLineContext = {
|
|
61
|
+
getItemProps: PropGetterFn;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** @deprecated */
|
|
65
|
+
export interface ITabLineHandlers extends TabLineHandlers, UnknownProperties {}
|
|
66
|
+
export type TabLineHandlers = {
|
|
67
|
+
value: (value: TabLineValue) => void;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
type IntergalacticTabLineComponent<PropsExtending = {}> = (<
|
|
71
|
+
Value extends TabLineValue,
|
|
72
|
+
Tag extends Intergalactic.Tag = 'div',
|
|
73
|
+
>(
|
|
74
|
+
props: Intergalactic.InternalTypings.ComponentProps<
|
|
75
|
+
Tag,
|
|
76
|
+
'div',
|
|
77
|
+
TabLineProps<Value>,
|
|
78
|
+
TabLineContext,
|
|
79
|
+
[handlers: TabLineHandlers]
|
|
80
|
+
> &
|
|
81
|
+
PropsExtending,
|
|
82
|
+
) => Intergalactic.InternalTypings.ComponentRenderingResults) &
|
|
83
|
+
Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', TabLineProps>;
|
|
84
|
+
|
|
85
|
+
declare const TabLine: IntergalacticTabLineComponent & {
|
|
86
|
+
Item: Intergalactic.Component<'div', TabLineItemProps, {}, [handlers: TabLineHandlers]> & {
|
|
87
|
+
Text: typeof Box;
|
|
88
|
+
Addon: typeof Box;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
declare const wrapTabLine: <PropsExtending extends {}>(
|
|
93
|
+
wrapper: (
|
|
94
|
+
props: Intergalactic.InternalTypings.UntypeRefAndTag<
|
|
95
|
+
Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticTabLineComponent>
|
|
96
|
+
> &
|
|
97
|
+
PropsExtending,
|
|
98
|
+
) => React.ReactNode,
|
|
99
|
+
) => IntergalacticTabLineComponent<PropsExtending>;
|
|
100
|
+
export { wrapTabLine };
|
|
101
|
+
|
|
102
|
+
export default TabLine;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/tab-line",
|
|
3
3
|
"description": "Semrush TabLine Component",
|
|
4
|
-
"version": "16.1.
|
|
4
|
+
"version": "16.1.1",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/flex-box": "16.1.
|
|
18
|
-
"@semcore/neighbor-location": "16.1.
|
|
17
|
+
"@semcore/flex-box": "16.1.1",
|
|
18
|
+
"@semcore/neighbor-location": "16.1.1"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"@semcore/base-components": "^16.6.0"
|
package/lib/cjs/TabLine.type.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TabLine.type.js","names":[],"sources":["../../src/TabLine.type.ts"],"sourcesContent":["import type { Box, BoxProps, NeighborItemProps, NeighborLocationProps } from '@semcore/base-components';\nimport type { PropGetterFn, Intergalactic } from '@semcore/core';\nimport type { NSText } from '@semcore/typography';\nimport type React from 'react';\n\ndeclare namespace NSTabLine {\n type Value = string | number | boolean;\n type Props<T extends NSTabLine.Value = NSTabLine.Value> = BoxProps &\n NeighborLocationProps & {\n /** TabLine size\n * @default m\n * */\n size?: 'm' | 'l' | false;\n /** Adds a bottom border for the entire component\n * @default true\n * */\n underlined?: boolean;\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 /**\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 NeighborItemProps & {\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?: NSTabLine.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: NSTabLine.Handlers]> & {\n Text: Text.Component;\n Addon: Addon.Component;\n };\n }\n\n type WrapperComponent<PropsExtending = {}> = (<\n V extends 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) &\n 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 TabLineValue = NSTabLine.Value;\n/** @deprecated It will be removed in v18. */\nexport type TabLineProps<T extends TabLineValue = TabLineValue> = NSTabLine.Props<T>;\n/** @deprecated It will be removed in v18. */\nexport type TabLineItemProps = NSTabLine.Item.Props;\n/** @deprecated It will be removed in v18. */\nexport type TabLineContext = NSTabLine.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type TabLineHandlers = NSTabLine.Handlers;\n\nexport type { NSTabLine };\n"],"mappings":"","ignoreList":[]}
|
package/lib/es6/TabLine.type.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TabLine.type.js","names":[],"sources":["../../src/TabLine.type.ts"],"sourcesContent":["import type { Box, BoxProps, NeighborItemProps, NeighborLocationProps } from '@semcore/base-components';\nimport type { PropGetterFn, Intergalactic } from '@semcore/core';\nimport type { NSText } from '@semcore/typography';\nimport type React from 'react';\n\ndeclare namespace NSTabLine {\n type Value = string | number | boolean;\n type Props<T extends NSTabLine.Value = NSTabLine.Value> = BoxProps &\n NeighborLocationProps & {\n /** TabLine size\n * @default m\n * */\n size?: 'm' | 'l' | false;\n /** Adds a bottom border for the entire component\n * @default true\n * */\n underlined?: boolean;\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 /**\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 NeighborItemProps & {\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?: NSTabLine.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: NSTabLine.Handlers]> & {\n Text: Text.Component;\n Addon: Addon.Component;\n };\n }\n\n type WrapperComponent<PropsExtending = {}> = (<\n V extends 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) &\n 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 TabLineValue = NSTabLine.Value;\n/** @deprecated It will be removed in v18. */\nexport type TabLineProps<T extends TabLineValue = TabLineValue> = NSTabLine.Props<T>;\n/** @deprecated It will be removed in v18. */\nexport type TabLineItemProps = NSTabLine.Item.Props;\n/** @deprecated It will be removed in v18. */\nexport type TabLineContext = NSTabLine.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type TabLineHandlers = NSTabLine.Handlers;\n\nexport type { NSTabLine };\n"],"mappings":"","ignoreList":[]}
|
package/lib/esm/TabLine.type.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/lib/types/TabLine.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { Intergalactic } from '@semcore/core';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import type { NSTabLine } from './TabLine.type';
|
|
4
|
-
declare const TabLine: NSTabLine.Component;
|
|
5
|
-
export declare const wrapTabLine: <PropsExtending extends {}>(wrapper: (props: Intergalactic.InternalTypings.UntypeRefAndTag<Intergalactic.InternalTypings.ComponentPropsNesting<NSTabLine.WrapperComponent>> & PropsExtending) => React.ReactNode) => NSTabLine.WrapperComponent<PropsExtending>;
|
|
6
|
-
export default TabLine;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import type { Box, BoxProps, NeighborItemProps, NeighborLocationProps } from '@semcore/base-components';
|
|
2
|
-
import type { PropGetterFn, Intergalactic } from '@semcore/core';
|
|
3
|
-
import type { NSText } from '@semcore/typography';
|
|
4
|
-
import type React from 'react';
|
|
5
|
-
declare namespace NSTabLine {
|
|
6
|
-
type Value = string | number | boolean;
|
|
7
|
-
type Props<T extends NSTabLine.Value = NSTabLine.Value> = BoxProps & NeighborLocationProps & {
|
|
8
|
-
/** TabLine size
|
|
9
|
-
* @default m
|
|
10
|
-
* */
|
|
11
|
-
size?: 'm' | 'l' | false;
|
|
12
|
-
/** Adds a bottom border for the entire component
|
|
13
|
-
* @default true
|
|
14
|
-
* */
|
|
15
|
-
underlined?: boolean;
|
|
16
|
-
/** Is invoked when changing the selection */
|
|
17
|
-
onChange?: ((value: T, e?: React.SyntheticEvent<HTMLButtonElement>) => void) | React.Dispatch<React.SetStateAction<T>>;
|
|
18
|
-
/** Value of the selected tab */
|
|
19
|
-
value?: T;
|
|
20
|
-
/** Default value of the selected tab
|
|
21
|
-
* @default null
|
|
22
|
-
* */
|
|
23
|
-
defaultValue?: T;
|
|
24
|
-
/**
|
|
25
|
-
* Behavior of tabs.
|
|
26
|
-
* In `auto`, changes the tab immediately when press arrow.
|
|
27
|
-
* In `manual`, needs to press `space` or `enter` for select a choice.
|
|
28
|
-
* @default 'auto'
|
|
29
|
-
*/
|
|
30
|
-
behavior?: 'auto' | 'manual';
|
|
31
|
-
};
|
|
32
|
-
type Ctx = {
|
|
33
|
-
getItemProps: PropGetterFn;
|
|
34
|
-
};
|
|
35
|
-
type Handlers = {
|
|
36
|
-
value: null;
|
|
37
|
-
};
|
|
38
|
-
namespace Item {
|
|
39
|
-
type Props = BoxProps & NeighborItemProps & {
|
|
40
|
-
/** Makes a tab selected. This property is determined automatically depending on the value. */
|
|
41
|
-
selected?: boolean;
|
|
42
|
-
/** Disabled state */
|
|
43
|
-
disabled?: boolean;
|
|
44
|
-
/** Tab value */
|
|
45
|
-
value?: NSTabLine.Value;
|
|
46
|
-
/** Left addon tag */
|
|
47
|
-
addonLeft?: React.ElementType;
|
|
48
|
-
/** Right addon tag */
|
|
49
|
-
addonRight?: React.ElementType;
|
|
50
|
-
};
|
|
51
|
-
namespace Text {
|
|
52
|
-
type Props = NSText.Props;
|
|
53
|
-
type Component = NSText.Component;
|
|
54
|
-
}
|
|
55
|
-
namespace Addon {
|
|
56
|
-
type Component = typeof Box;
|
|
57
|
-
}
|
|
58
|
-
type Component = Intergalactic.Component<'div', Props, {}, [handlers: NSTabLine.Handlers]> & {
|
|
59
|
-
Text: Text.Component;
|
|
60
|
-
Addon: Addon.Component;
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
type WrapperComponent<PropsExtending = {}> = (<V extends Value, Tag extends Intergalactic.Tag = 'div'>(props: Intergalactic.InternalTypings.ComponentProps<Tag, 'div', Props<V>, Ctx, [
|
|
64
|
-
handlers: Handlers
|
|
65
|
-
]> & PropsExtending) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', Props>;
|
|
66
|
-
type Component = WrapperComponent & {
|
|
67
|
-
Item: Item.Component;
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
/** @deprecated It will be removed in v18. */
|
|
71
|
-
export type TabLineValue = NSTabLine.Value;
|
|
72
|
-
/** @deprecated It will be removed in v18. */
|
|
73
|
-
export type TabLineProps<T extends TabLineValue = TabLineValue> = NSTabLine.Props<T>;
|
|
74
|
-
/** @deprecated It will be removed in v18. */
|
|
75
|
-
export type TabLineItemProps = NSTabLine.Item.Props;
|
|
76
|
-
/** @deprecated It will be removed in v18. */
|
|
77
|
-
export type TabLineContext = NSTabLine.Ctx;
|
|
78
|
-
/** @deprecated It will be removed in v18. */
|
|
79
|
-
export type TabLineHandlers = NSTabLine.Handlers;
|
|
80
|
-
export type { NSTabLine };
|