@semcore/accordion 5.49.0-prerelease.0 → 5.49.0-prerelease.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/Accordion.js +62 -47
- package/lib/cjs/Accordion.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/accordion.shadow.css +9 -1
- package/lib/es6/Accordion.js +51 -41
- package/lib/es6/Accordion.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/accordion.shadow.css +9 -1
- package/lib/esm/Accordion.mjs +64 -50
- package/lib/esm/index.mjs +2 -2
- package/lib/esm/style/accordion.shadow.css +9 -1
- package/lib/types/index.d.ts +124 -2
- package/package.json +8 -8
- package/lib/cjs/Accordion.type.js +0 -2
- package/lib/cjs/Accordion.type.js.map +0 -1
- package/lib/es6/Accordion.type.js +0 -2
- package/lib/es6/Accordion.type.js.map +0 -1
- package/lib/esm/Accordion.type.mjs +0 -1
- package/lib/types/Accordion.d.ts +0 -68
- package/lib/types/Accordion.type.d.ts +0 -142
|
@@ -6,6 +6,15 @@ SItemToggle {
|
|
|
6
6
|
outline: 0;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
SItemToggle[keyboardFocused]:not([tabIndex='-1'])::after {
|
|
10
|
+
position: absolute;
|
|
11
|
+
display: block;
|
|
12
|
+
content: '';
|
|
13
|
+
inset: 3px;
|
|
14
|
+
box-shadow: var(--intergalactic-keyboard-focus, 0px 0px 0px 3px oklch(0.376 0.247 264.2 / 0.441));
|
|
15
|
+
pointer-events: none;
|
|
16
|
+
z-index: 3;
|
|
17
|
+
}
|
|
9
18
|
SItemToggle[use][use] {
|
|
10
19
|
color: var(--intergalactic-text-primary, oklch(0.1 0.03 137 / 0.899));
|
|
11
20
|
font-weight: var(--intergalactic-regular, 400);
|
|
@@ -25,7 +34,6 @@ SItemToggle[disabled] {
|
|
|
25
34
|
}
|
|
26
35
|
|
|
27
36
|
SItemChevron {
|
|
28
|
-
margin-right: var(--intergalactic-spacing-2x, 8px);
|
|
29
37
|
transform: rotate(0deg);
|
|
30
38
|
transition: transform calc(var(--intergalactic-duration-accordion, 200) * 1ms) ease-out;
|
|
31
39
|
fill: var(--intergalactic-icon-primary-neutral, oklch(0.092 0.024 152.2 / 0.526));
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,2 +1,124 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { BoxProps, FlexProps, Flex } from '@semcore/flex-box';
|
|
2
|
+
import { PropGetterFn, Intergalactic, UnknownProperties } from '@semcore/core';
|
|
3
|
+
import { CollapseProps } from '@semcore/animation';
|
|
4
|
+
import { KeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
5
|
+
import { Text } from '@semcore/typography';
|
|
6
|
+
|
|
7
|
+
export type AccordionValue = null | number | string | Array<number | string | null>;
|
|
8
|
+
|
|
9
|
+
export type AccordionProps<T extends AccordionValue = AccordionValue> = FlexProps & {
|
|
10
|
+
/** Value for the active tab. Can be set as stroke, number, null or as array.
|
|
11
|
+
* @type AccordionValue
|
|
12
|
+
* */
|
|
13
|
+
value?: T;
|
|
14
|
+
/**
|
|
15
|
+
* Value of the active tabs selected by default
|
|
16
|
+
* @type AccordionValue
|
|
17
|
+
* @default []
|
|
18
|
+
*/
|
|
19
|
+
defaultValue?: T;
|
|
20
|
+
/** Called when the selection is changed
|
|
21
|
+
* @type (value: AccordionValue, event?: React.SyntheticEvent) => void
|
|
22
|
+
* */
|
|
23
|
+
onChange?:
|
|
24
|
+
| ((value: T, event?: React.SyntheticEvent) => void)
|
|
25
|
+
| React.Dispatch<React.SetStateAction<T>>;
|
|
26
|
+
/** Animation duration of each Accordion.Item inside
|
|
27
|
+
* @default 350 */
|
|
28
|
+
duration?: number;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Changes the visual appearance of the component
|
|
32
|
+
* @default secondary
|
|
33
|
+
*/
|
|
34
|
+
use?: 'primary' | 'secondary';
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export interface IAccordionProps<T extends AccordionValue = AccordionValue>
|
|
38
|
+
extends AccordionProps<T> {}
|
|
39
|
+
|
|
40
|
+
/** @deprecated */
|
|
41
|
+
export interface IAccordionContext extends AccordionContext, UnknownProperties {}
|
|
42
|
+
export type AccordionContext = {
|
|
43
|
+
getItemProps: PropGetterFn;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** @deprecated */
|
|
47
|
+
export interface IAccordionHandlers extends AccordionHandlers, UnknownProperties {}
|
|
48
|
+
export type AccordionHandlers = {
|
|
49
|
+
value: (value: AccordionValue) => void;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** @deprecated */
|
|
53
|
+
export interface IAccordionItemProps extends AccordionItemProps, UnknownProperties {}
|
|
54
|
+
export type AccordionItemProps = {
|
|
55
|
+
/** Tab value */
|
|
56
|
+
value: string | number;
|
|
57
|
+
/** Disabling selection changes */
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
/** Animation duration
|
|
60
|
+
* @default 350 */
|
|
61
|
+
duration?: number;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** @deprecated */
|
|
65
|
+
export interface IAccordionItemContext extends AccordionItemContext, UnknownProperties {}
|
|
66
|
+
export type AccordionItemContext = {
|
|
67
|
+
getToggleProps?: PropGetterFn;
|
|
68
|
+
getCollapseProps?: PropGetterFn;
|
|
69
|
+
getChevronProps?: PropGetterFn;
|
|
70
|
+
selected?: boolean;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export type AccordionItemToggleProps = BoxProps &
|
|
74
|
+
KeyboardFocusProps & {
|
|
75
|
+
tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
76
|
+
};
|
|
77
|
+
export type ChevronItemProps = BoxProps & {
|
|
78
|
+
/**
|
|
79
|
+
* Chevron size
|
|
80
|
+
* @default m
|
|
81
|
+
*/
|
|
82
|
+
size?: 'm' | 'l';
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
type IntergalacticAccordionComponent<PropsExtending = {}> = (<
|
|
86
|
+
Value extends AccordionValue,
|
|
87
|
+
Tag extends Intergalactic.Tag = 'div',
|
|
88
|
+
>(
|
|
89
|
+
props: Intergalactic.InternalTypings.ComponentProps<
|
|
90
|
+
Tag,
|
|
91
|
+
'div',
|
|
92
|
+
AccordionProps<Value>,
|
|
93
|
+
AccordionContext & { value: Value },
|
|
94
|
+
[handlers: AccordionHandlers]
|
|
95
|
+
> &
|
|
96
|
+
PropsExtending,
|
|
97
|
+
) => Intergalactic.InternalTypings.ComponentRenderingResults) &
|
|
98
|
+
Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', AccordionProps>;
|
|
99
|
+
|
|
100
|
+
declare const Accordion: IntergalacticAccordionComponent & {
|
|
101
|
+
Item: Intergalactic.Component<
|
|
102
|
+
'div',
|
|
103
|
+
AccordionItemProps,
|
|
104
|
+
AccordionItemContext,
|
|
105
|
+
[handlers: AccordionHandlers]
|
|
106
|
+
> & {
|
|
107
|
+
Toggle: Intergalactic.Component<typeof Text, AccordionItemToggleProps>;
|
|
108
|
+
ToggleButton: Intergalactic.Component<typeof Flex, {}>;
|
|
109
|
+
Chevron: Intergalactic.Component<'div', ChevronItemProps>;
|
|
110
|
+
Collapse: Intergalactic.Component<'div', CollapseProps>;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
declare const wrapAccordion: <PropsExtending extends {}>(
|
|
115
|
+
wrapper: (
|
|
116
|
+
props: Intergalactic.InternalTypings.UntypeRefAndTag<
|
|
117
|
+
Intergalactic.InternalTypings.ComponentPropsNesting<IntergalacticAccordionComponent>
|
|
118
|
+
> &
|
|
119
|
+
PropsExtending,
|
|
120
|
+
) => React.ReactNode,
|
|
121
|
+
) => IntergalacticAccordionComponent<PropsExtending>;
|
|
122
|
+
export { wrapAccordion };
|
|
123
|
+
|
|
124
|
+
export default Accordion;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/accordion",
|
|
3
3
|
"description": "Semrush Accordion Component",
|
|
4
|
-
"version": "5.49.0-prerelease.
|
|
4
|
+
"version": "5.49.0-prerelease.1",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,15 +14,15 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/animation": "2.42.0-prerelease.
|
|
18
|
-
"@semcore/flex-box": "5.42.0-prerelease.
|
|
19
|
-
"@semcore/icon": "4.63.0-prerelease.
|
|
20
|
-
"@semcore/utils": "4.49.0-prerelease.
|
|
21
|
-
"@semcore/button": "5.44.0-prerelease.
|
|
22
|
-
"@semcore/typography": "5.54.0-prerelease.
|
|
17
|
+
"@semcore/animation": "2.42.0-prerelease.1",
|
|
18
|
+
"@semcore/flex-box": "5.42.0-prerelease.1",
|
|
19
|
+
"@semcore/icon": "4.63.0-prerelease.1",
|
|
20
|
+
"@semcore/utils": "4.49.0-prerelease.1",
|
|
21
|
+
"@semcore/button": "5.44.0-prerelease.1",
|
|
22
|
+
"@semcore/typography": "5.54.0-prerelease.1"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@semcore/core": "^2.40.0-prerelease.
|
|
25
|
+
"@semcore/core": "^2.40.0-prerelease.1",
|
|
26
26
|
"react": "16.8 - 18",
|
|
27
27
|
"react-dom": "16.8 - 18"
|
|
28
28
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.type.js","names":[],"sources":["../../src/Accordion.type.ts"],"sourcesContent":["import type { BoxProps, FlexProps, Flex } from '@semcore/base-components';\nimport type { PropGetterFn, Intergalactic } from '@semcore/core';\nimport type { Text } from '@semcore/typography';\nimport type { Property } from 'csstype';\n\ndeclare namespace NSAccordion {\n // TODO: It looks like the value isn't accurate. Revise and align it with the component's logic.\n type Value = null | number | string | Array<number | string | null>;\n type Props<V extends NSAccordion.Value = NSAccordion.Value> = FlexProps & {\n /** Value for the active tab. Can be set as stroke, number, null or as array.\n * @type AccordionValue\n * */\n value?: V;\n /**\n * Value of the active tabs selected by default\n * @type AccordionValue\n * @default []\n */\n defaultValue?: V;\n /** Called when the selection is changed\n * @type (value: AccordionValue, event?: React.SyntheticEvent) => void\n * */\n onChange?:\n | ((value: V, event?: React.SyntheticEvent) => void)\n | React.Dispatch<React.SetStateAction<V>>;\n /** Animation duration of each Accordion.Item inside\n * @default 350 */\n duration?: number;\n /**\n * Changes the visual appearance of the component\n * @default secondary\n */\n use?: 'primary' | 'secondary';\n };\n type Ctx = {\n getItemProps: PropGetterFn;\n };\n type Handlers = {\n value: Props['value'];\n };\n namespace Item {\n type Props = {\n /** Tab value */\n value: string | number;\n /** Disabling selection changes */\n disabled?: boolean;\n /** Animation duration\n * @default 350 */\n duration?: number;\n };\n type Ctx = {\n getToggleProps?: PropGetterFn;\n getCollapseProps?: PropGetterFn;\n getChevronProps?: PropGetterFn;\n selected?: boolean;\n };\n namespace Toggle {\n type Props = BoxProps & {\n tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n };\n type Component = Intergalactic.Component<typeof Text, Props>;\n }\n namespace ToggleButton {\n type Props = {};\n type Component = Intergalactic.Component<typeof Flex, Props>;\n }\n namespace Chevron {\n type Props = BoxProps & {\n /**\n * Chevron size\n * @default m\n */\n size?: 'm' | 'l';\n };\n\n type Component = Intergalactic.Component<'div', Props>;\n }\n\n namespace Collapse {\n type Props = BoxProps & {\n /** Animation titles */\n keyframes?: [string, string];\n /** Enables animation on first rendering\n * @default false\n */\n initialAnimation?: boolean;\n /**\n * @default ease-out\n */\n timingFunction?: Property.AnimationTimingFunction;\n /**\n * @default false\n */\n animationsDisabled?: boolean;\n /** Animation duration in ms\n * @default 0\n */\n duration?: number | [number, number];\n /** If it set to `true`, animated node is persisted in dom even if `visible=false` */\n preserveNode?: boolean;\n /**\n * Add overflow=clip when passing animation\n * @default true\n * */\n overflowHidden?: boolean;\n /**\n * Value for height after animation\n * @default auto\n */\n defaultHeight?: 'auto' | '100%';\n };\n type Component = Intergalactic.Component<'div', Props>;\n }\n\n type Component = Intergalactic.Component<'div', Props, Ctx> & {\n Toggle: Toggle.Component;\n ToggleButton: ToggleButton.Component;\n Chevron: Chevron.Component;\n Collapse: Collapse.Component;\n };\n }\n\n type WrapComponent<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 & { value: V },\n [handlers: Handlers]\n > & PropsExtending,\n ) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', Props>;\n\n type Component = WrapComponent & {\n Item: Item.Component;\n };\n}\n\n/** @deprecated It will be removed in v18. */\nexport type AccordionValue = NSAccordion.Value;\n/** @deprecated It will be removed in v18. */\nexport type AccordionProps<V extends AccordionValue = AccordionValue> = NSAccordion.Props<V>;\n/** @deprecated It will be removed in v18. */\nexport type AccordionContext = NSAccordion.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type AccordionHandlers = NSAccordion.Handlers;\n/** @deprecated It will be removed in v18. */\nexport type AccordionItemProps = NSAccordion.Item.Props;\n/** @deprecated It will be removed in v18. */\nexport type AccordionItemContext = NSAccordion.Item.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type AccordionItemToggleProps = NSAccordion.Item.Toggle.Props;\n/** @deprecated It will be removed in v18. */\nexport type ChevronItemProps = NSAccordion.Item.Chevron.Props;\n/** @deprecated It will be removed in v18. */\nexport type AccordionCollapseProps = NSAccordion.Item.Collapse.Props;\n\nexport type { NSAccordion };\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.type.js","names":[],"sources":["../../src/Accordion.type.ts"],"sourcesContent":["import type { BoxProps, FlexProps, Flex } from '@semcore/base-components';\nimport type { PropGetterFn, Intergalactic } from '@semcore/core';\nimport type { Text } from '@semcore/typography';\nimport type { Property } from 'csstype';\n\ndeclare namespace NSAccordion {\n // TODO: It looks like the value isn't accurate. Revise and align it with the component's logic.\n type Value = null | number | string | Array<number | string | null>;\n type Props<V extends NSAccordion.Value = NSAccordion.Value> = FlexProps & {\n /** Value for the active tab. Can be set as stroke, number, null or as array.\n * @type AccordionValue\n * */\n value?: V;\n /**\n * Value of the active tabs selected by default\n * @type AccordionValue\n * @default []\n */\n defaultValue?: V;\n /** Called when the selection is changed\n * @type (value: AccordionValue, event?: React.SyntheticEvent) => void\n * */\n onChange?:\n | ((value: V, event?: React.SyntheticEvent) => void)\n | React.Dispatch<React.SetStateAction<V>>;\n /** Animation duration of each Accordion.Item inside\n * @default 350 */\n duration?: number;\n /**\n * Changes the visual appearance of the component\n * @default secondary\n */\n use?: 'primary' | 'secondary';\n };\n type Ctx = {\n getItemProps: PropGetterFn;\n };\n type Handlers = {\n value: Props['value'];\n };\n namespace Item {\n type Props = {\n /** Tab value */\n value: string | number;\n /** Disabling selection changes */\n disabled?: boolean;\n /** Animation duration\n * @default 350 */\n duration?: number;\n };\n type Ctx = {\n getToggleProps?: PropGetterFn;\n getCollapseProps?: PropGetterFn;\n getChevronProps?: PropGetterFn;\n selected?: boolean;\n };\n namespace Toggle {\n type Props = BoxProps & {\n tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n };\n type Component = Intergalactic.Component<typeof Text, Props>;\n }\n namespace ToggleButton {\n type Props = {};\n type Component = Intergalactic.Component<typeof Flex, Props>;\n }\n namespace Chevron {\n type Props = BoxProps & {\n /**\n * Chevron size\n * @default m\n */\n size?: 'm' | 'l';\n };\n\n type Component = Intergalactic.Component<'div', Props>;\n }\n\n namespace Collapse {\n type Props = BoxProps & {\n /** Animation titles */\n keyframes?: [string, string];\n /** Enables animation on first rendering\n * @default false\n */\n initialAnimation?: boolean;\n /**\n * @default ease-out\n */\n timingFunction?: Property.AnimationTimingFunction;\n /**\n * @default false\n */\n animationsDisabled?: boolean;\n /** Animation duration in ms\n * @default 0\n */\n duration?: number | [number, number];\n /** If it set to `true`, animated node is persisted in dom even if `visible=false` */\n preserveNode?: boolean;\n /**\n * Add overflow=clip when passing animation\n * @default true\n * */\n overflowHidden?: boolean;\n /**\n * Value for height after animation\n * @default auto\n */\n defaultHeight?: 'auto' | '100%';\n };\n type Component = Intergalactic.Component<'div', Props>;\n }\n\n type Component = Intergalactic.Component<'div', Props, Ctx> & {\n Toggle: Toggle.Component;\n ToggleButton: ToggleButton.Component;\n Chevron: Chevron.Component;\n Collapse: Collapse.Component;\n };\n }\n\n type WrapComponent<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 & { value: V },\n [handlers: Handlers]\n > & PropsExtending,\n ) => Intergalactic.InternalTypings.ComponentRenderingResults) &\n Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', Props>;\n\n type Component = WrapComponent & {\n Item: Item.Component;\n };\n}\n\n/** @deprecated It will be removed in v18. */\nexport type AccordionValue = NSAccordion.Value;\n/** @deprecated It will be removed in v18. */\nexport type AccordionProps<V extends AccordionValue = AccordionValue> = NSAccordion.Props<V>;\n/** @deprecated It will be removed in v18. */\nexport type AccordionContext = NSAccordion.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type AccordionHandlers = NSAccordion.Handlers;\n/** @deprecated It will be removed in v18. */\nexport type AccordionItemProps = NSAccordion.Item.Props;\n/** @deprecated It will be removed in v18. */\nexport type AccordionItemContext = NSAccordion.Item.Ctx;\n/** @deprecated It will be removed in v18. */\nexport type AccordionItemToggleProps = NSAccordion.Item.Toggle.Props;\n/** @deprecated It will be removed in v18. */\nexport type ChevronItemProps = NSAccordion.Item.Chevron.Props;\n/** @deprecated It will be removed in v18. */\nexport type AccordionCollapseProps = NSAccordion.Item.Collapse.Props;\n\nexport type { NSAccordion };\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/lib/types/Accordion.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import type { Intergalactic } from '@semcore/core';
|
|
2
|
-
import { Component } from '@semcore/core';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import type { NSAccordion } from './Accordion.type';
|
|
5
|
-
declare class RootAccordion extends Component<Intergalactic.InternalTypings.InferComponentProps<NSAccordion.Component>, typeof RootAccordion.enhance, NSAccordion.Handlers> {
|
|
6
|
-
static displayName: string;
|
|
7
|
-
static style: {
|
|
8
|
-
[key: string]: string;
|
|
9
|
-
};
|
|
10
|
-
static defaultProps: {
|
|
11
|
-
defaultValue: never[];
|
|
12
|
-
use: string;
|
|
13
|
-
};
|
|
14
|
-
static enhance: readonly [<T extends {}>(props: T) => T & {
|
|
15
|
-
duration: string;
|
|
16
|
-
}];
|
|
17
|
-
uncontrolledProps(): {
|
|
18
|
-
value: null;
|
|
19
|
-
};
|
|
20
|
-
handleToggleInteraction: (newValue: NSAccordion.Item.Props["value"]) => void;
|
|
21
|
-
getItemProps({ value }: NSAccordion.Item.Props): {
|
|
22
|
-
selected: boolean;
|
|
23
|
-
duration: never;
|
|
24
|
-
use: "primary" | "secondary" | undefined;
|
|
25
|
-
$handleInteraction: (newValue: NSAccordion.Item.Props["value"]) => void;
|
|
26
|
-
};
|
|
27
|
-
render(): React.JSX.Element;
|
|
28
|
-
}
|
|
29
|
-
export declare class RootItem extends Component<Intergalactic.InternalTypings.InferChildComponentProps<NSAccordion.Item.Component, typeof RootAccordion, 'Item'>, typeof RootItem.enhance> {
|
|
30
|
-
static displayName: string;
|
|
31
|
-
static style: {
|
|
32
|
-
[key: string]: string;
|
|
33
|
-
};
|
|
34
|
-
static enhance: readonly [(props: any) => {
|
|
35
|
-
uid: ReturnType<typeof import("@semcore/core/lib/utils/uniqueID").useUID>;
|
|
36
|
-
}];
|
|
37
|
-
handleClick: () => void;
|
|
38
|
-
getToggleProps(): {
|
|
39
|
-
use: "primary" | "secondary" | undefined;
|
|
40
|
-
disabled: boolean | undefined;
|
|
41
|
-
onClick: (() => void) | undefined;
|
|
42
|
-
id: string;
|
|
43
|
-
tag: string;
|
|
44
|
-
size: number;
|
|
45
|
-
tabIndex: number;
|
|
46
|
-
};
|
|
47
|
-
getToggleButtonProps(): {
|
|
48
|
-
disabled: boolean | undefined;
|
|
49
|
-
id: string;
|
|
50
|
-
'aria-expanded': string;
|
|
51
|
-
'aria-controls': string | undefined;
|
|
52
|
-
};
|
|
53
|
-
getCollapseProps(): {
|
|
54
|
-
selected: boolean;
|
|
55
|
-
duration: number | undefined;
|
|
56
|
-
id: string;
|
|
57
|
-
role: string;
|
|
58
|
-
'aria-labelledby': string;
|
|
59
|
-
};
|
|
60
|
-
getChevronProps(): {
|
|
61
|
-
selected: boolean;
|
|
62
|
-
size: number | undefined;
|
|
63
|
-
};
|
|
64
|
-
render(): React.JSX.Element;
|
|
65
|
-
}
|
|
66
|
-
declare const Accordion: NSAccordion.Component;
|
|
67
|
-
export declare const wrapAccordion: <PropsExtending extends {}>(wrapper: (props: Intergalactic.InternalTypings.UntypeRefAndTag<Intergalactic.InternalTypings.ComponentPropsNesting<NSAccordion.WrapComponent>> & PropsExtending) => React.ReactNode) => NSAccordion.WrapComponent<PropsExtending>;
|
|
68
|
-
export default Accordion;
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import type { BoxProps, FlexProps, Flex } from '@semcore/base-components';
|
|
2
|
-
import type { PropGetterFn, Intergalactic } from '@semcore/core';
|
|
3
|
-
import type { Text } from '@semcore/typography';
|
|
4
|
-
import type { Property } from 'csstype';
|
|
5
|
-
declare namespace NSAccordion {
|
|
6
|
-
type Value = null | number | string | Array<number | string | null>;
|
|
7
|
-
type Props<V extends NSAccordion.Value = NSAccordion.Value> = FlexProps & {
|
|
8
|
-
/** Value for the active tab. Can be set as stroke, number, null or as array.
|
|
9
|
-
* @type AccordionValue
|
|
10
|
-
* */
|
|
11
|
-
value?: V;
|
|
12
|
-
/**
|
|
13
|
-
* Value of the active tabs selected by default
|
|
14
|
-
* @type AccordionValue
|
|
15
|
-
* @default []
|
|
16
|
-
*/
|
|
17
|
-
defaultValue?: V;
|
|
18
|
-
/** Called when the selection is changed
|
|
19
|
-
* @type (value: AccordionValue, event?: React.SyntheticEvent) => void
|
|
20
|
-
* */
|
|
21
|
-
onChange?: ((value: V, event?: React.SyntheticEvent) => void) | React.Dispatch<React.SetStateAction<V>>;
|
|
22
|
-
/** Animation duration of each Accordion.Item inside
|
|
23
|
-
* @default 350 */
|
|
24
|
-
duration?: number;
|
|
25
|
-
/**
|
|
26
|
-
* Changes the visual appearance of the component
|
|
27
|
-
* @default secondary
|
|
28
|
-
*/
|
|
29
|
-
use?: 'primary' | 'secondary';
|
|
30
|
-
};
|
|
31
|
-
type Ctx = {
|
|
32
|
-
getItemProps: PropGetterFn;
|
|
33
|
-
};
|
|
34
|
-
type Handlers = {
|
|
35
|
-
value: Props['value'];
|
|
36
|
-
};
|
|
37
|
-
namespace Item {
|
|
38
|
-
type Props = {
|
|
39
|
-
/** Tab value */
|
|
40
|
-
value: string | number;
|
|
41
|
-
/** Disabling selection changes */
|
|
42
|
-
disabled?: boolean;
|
|
43
|
-
/** Animation duration
|
|
44
|
-
* @default 350 */
|
|
45
|
-
duration?: number;
|
|
46
|
-
};
|
|
47
|
-
type Ctx = {
|
|
48
|
-
getToggleProps?: PropGetterFn;
|
|
49
|
-
getCollapseProps?: PropGetterFn;
|
|
50
|
-
getChevronProps?: PropGetterFn;
|
|
51
|
-
selected?: boolean;
|
|
52
|
-
};
|
|
53
|
-
namespace Toggle {
|
|
54
|
-
type Props = BoxProps & {
|
|
55
|
-
tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
56
|
-
};
|
|
57
|
-
type Component = Intergalactic.Component<typeof Text, Props>;
|
|
58
|
-
}
|
|
59
|
-
namespace ToggleButton {
|
|
60
|
-
type Props = {};
|
|
61
|
-
type Component = Intergalactic.Component<typeof Flex, Props>;
|
|
62
|
-
}
|
|
63
|
-
namespace Chevron {
|
|
64
|
-
type Props = BoxProps & {
|
|
65
|
-
/**
|
|
66
|
-
* Chevron size
|
|
67
|
-
* @default m
|
|
68
|
-
*/
|
|
69
|
-
size?: 'm' | 'l';
|
|
70
|
-
};
|
|
71
|
-
type Component = Intergalactic.Component<'div', Props>;
|
|
72
|
-
}
|
|
73
|
-
namespace Collapse {
|
|
74
|
-
type Props = BoxProps & {
|
|
75
|
-
/** Animation titles */
|
|
76
|
-
keyframes?: [string, string];
|
|
77
|
-
/** Enables animation on first rendering
|
|
78
|
-
* @default false
|
|
79
|
-
*/
|
|
80
|
-
initialAnimation?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* @default ease-out
|
|
83
|
-
*/
|
|
84
|
-
timingFunction?: Property.AnimationTimingFunction;
|
|
85
|
-
/**
|
|
86
|
-
* @default false
|
|
87
|
-
*/
|
|
88
|
-
animationsDisabled?: boolean;
|
|
89
|
-
/** Animation duration in ms
|
|
90
|
-
* @default 0
|
|
91
|
-
*/
|
|
92
|
-
duration?: number | [number, number];
|
|
93
|
-
/** If it set to `true`, animated node is persisted in dom even if `visible=false` */
|
|
94
|
-
preserveNode?: boolean;
|
|
95
|
-
/**
|
|
96
|
-
* Add overflow=clip when passing animation
|
|
97
|
-
* @default true
|
|
98
|
-
* */
|
|
99
|
-
overflowHidden?: boolean;
|
|
100
|
-
/**
|
|
101
|
-
* Value for height after animation
|
|
102
|
-
* @default auto
|
|
103
|
-
*/
|
|
104
|
-
defaultHeight?: 'auto' | '100%';
|
|
105
|
-
};
|
|
106
|
-
type Component = Intergalactic.Component<'div', Props>;
|
|
107
|
-
}
|
|
108
|
-
type Component = Intergalactic.Component<'div', Props, Ctx> & {
|
|
109
|
-
Toggle: Toggle.Component;
|
|
110
|
-
ToggleButton: ToggleButton.Component;
|
|
111
|
-
Chevron: Chevron.Component;
|
|
112
|
-
Collapse: Collapse.Component;
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
type WrapComponent<PropsExtending = {}> = (<V extends Value, Tag extends Intergalactic.Tag = 'div'>(props: Intergalactic.InternalTypings.ComponentProps<Tag, 'div', Props<V>, Ctx & {
|
|
116
|
-
value: V;
|
|
117
|
-
}, [
|
|
118
|
-
handlers: Handlers
|
|
119
|
-
]> & PropsExtending) => Intergalactic.InternalTypings.ComponentRenderingResults) & Intergalactic.InternalTypings.ComponentAdditive<'div', 'div', Props>;
|
|
120
|
-
type Component = WrapComponent & {
|
|
121
|
-
Item: Item.Component;
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
/** @deprecated It will be removed in v18. */
|
|
125
|
-
export type AccordionValue = NSAccordion.Value;
|
|
126
|
-
/** @deprecated It will be removed in v18. */
|
|
127
|
-
export type AccordionProps<V extends AccordionValue = AccordionValue> = NSAccordion.Props<V>;
|
|
128
|
-
/** @deprecated It will be removed in v18. */
|
|
129
|
-
export type AccordionContext = NSAccordion.Ctx;
|
|
130
|
-
/** @deprecated It will be removed in v18. */
|
|
131
|
-
export type AccordionHandlers = NSAccordion.Handlers;
|
|
132
|
-
/** @deprecated It will be removed in v18. */
|
|
133
|
-
export type AccordionItemProps = NSAccordion.Item.Props;
|
|
134
|
-
/** @deprecated It will be removed in v18. */
|
|
135
|
-
export type AccordionItemContext = NSAccordion.Item.Ctx;
|
|
136
|
-
/** @deprecated It will be removed in v18. */
|
|
137
|
-
export type AccordionItemToggleProps = NSAccordion.Item.Toggle.Props;
|
|
138
|
-
/** @deprecated It will be removed in v18. */
|
|
139
|
-
export type ChevronItemProps = NSAccordion.Item.Chevron.Props;
|
|
140
|
-
/** @deprecated It will be removed in v18. */
|
|
141
|
-
export type AccordionCollapseProps = NSAccordion.Item.Collapse.Props;
|
|
142
|
-
export type { NSAccordion };
|