@snack-uikit/accordion 0.9.10 → 0.10.0
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 +11 -0
- package/dist/cjs/components/CollapseBlockPrimary/CollapseBlockPrimary.d.ts +1 -1
- package/dist/cjs/components/CollapseBlockPrimary/CollapseBlockPrimary.js +5 -3
- package/dist/cjs/components/CollapseBlockSecondary/CollapseBlockSecondary.d.ts +1 -1
- package/dist/cjs/components/CollapseBlockSecondary/CollapseBlockSecondary.js +5 -3
- package/dist/cjs/helperComponents/CollapseBlockPrivate/CollapseBlockPrivate.d.ts +2 -1
- package/dist/cjs/helperComponents/CollapseBlockPrivate/CollapseBlockPrivate.js +4 -3
- package/dist/cjs/types.d.ts +2 -0
- package/dist/esm/components/CollapseBlockPrimary/CollapseBlockPrimary.d.ts +1 -1
- package/dist/esm/components/CollapseBlockPrimary/CollapseBlockPrimary.js +2 -2
- package/dist/esm/components/CollapseBlockSecondary/CollapseBlockSecondary.d.ts +1 -1
- package/dist/esm/components/CollapseBlockSecondary/CollapseBlockSecondary.js +2 -2
- package/dist/esm/helperComponents/CollapseBlockPrivate/CollapseBlockPrivate.d.ts +2 -1
- package/dist/esm/helperComponents/CollapseBlockPrivate/CollapseBlockPrivate.js +2 -2
- package/dist/esm/types.d.ts +2 -0
- package/package.json +2 -2
- package/src/components/CollapseBlockPrimary/CollapseBlockPrimary.tsx +2 -0
- package/src/components/CollapseBlockSecondary/CollapseBlockSecondary.tsx +2 -0
- package/src/helperComponents/CollapseBlockPrivate/CollapseBlockPrivate.tsx +3 -1
- package/src/types.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# 0.10.0 (2025-01-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **PDS-1443:** add a prop with logic that content would be removed from the DOM ([4182ad4](https://github.com/cloud-ru-tech/snack-uikit/commit/4182ad4b7d0ab6bd90293d7f290b2af8e6414f9c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 0.9.10 (2025-01-20)
|
|
7
18
|
|
|
8
19
|
### Only dependencies have been changed
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CollapseBlockPrimaryProps } from '../../types';
|
|
2
|
-
export declare function CollapseBlockPrimary({ id, header, children, actions, className, outline, shape, ...rest }: CollapseBlockPrimaryProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function CollapseBlockPrimary({ id, header, children, actions, className, outline, shape, removeContentFromDOM, ...rest }: CollapseBlockPrimaryProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -31,9 +31,10 @@ function CollapseBlockPrimary(_a) {
|
|
|
31
31
|
actions,
|
|
32
32
|
className,
|
|
33
33
|
outline,
|
|
34
|
-
shape = 'round'
|
|
34
|
+
shape = 'round',
|
|
35
|
+
removeContentFromDOM
|
|
35
36
|
} = _a,
|
|
36
|
-
rest = __rest(_a, ["id", "header", "children", "actions", "className", "outline", "shape"]);
|
|
37
|
+
rest = __rest(_a, ["id", "header", "children", "actions", "className", "outline", "shape", "removeContentFromDOM"]);
|
|
37
38
|
const {
|
|
38
39
|
isExpanded,
|
|
39
40
|
isExpandedDebounced,
|
|
@@ -52,7 +53,8 @@ function CollapseBlockPrimary(_a) {
|
|
|
52
53
|
children: header
|
|
53
54
|
}),
|
|
54
55
|
expanded: isExpanded,
|
|
55
|
-
expandedDebounced: isExpandedDebounced
|
|
56
|
+
expandedDebounced: isExpandedDebounced,
|
|
57
|
+
removeContentFromDOM: removeContentFromDOM
|
|
56
58
|
}, (0, utils_1.extractSupportProps)(rest), {
|
|
57
59
|
children: children
|
|
58
60
|
}));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CollapseBlockSecondaryProps } from '../../types';
|
|
2
|
-
export declare function CollapseBlockSecondary({ header, children, id, actions, className, ...rest }: CollapseBlockSecondaryProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function CollapseBlockSecondary({ header, children, id, actions, className, removeContentFromDOM, ...rest }: CollapseBlockSecondaryProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -29,9 +29,10 @@ function CollapseBlockSecondary(_a) {
|
|
|
29
29
|
children,
|
|
30
30
|
id,
|
|
31
31
|
actions,
|
|
32
|
-
className
|
|
32
|
+
className,
|
|
33
|
+
removeContentFromDOM
|
|
33
34
|
} = _a,
|
|
34
|
-
rest = __rest(_a, ["header", "children", "id", "actions", "className"]);
|
|
35
|
+
rest = __rest(_a, ["header", "children", "id", "actions", "className", "removeContentFromDOM"]);
|
|
35
36
|
const {
|
|
36
37
|
isExpanded,
|
|
37
38
|
isExpandedDebounced,
|
|
@@ -46,7 +47,8 @@ function CollapseBlockSecondary(_a) {
|
|
|
46
47
|
children: header
|
|
47
48
|
}),
|
|
48
49
|
expanded: isExpanded,
|
|
49
|
-
expandedDebounced: isExpandedDebounced
|
|
50
|
+
expandedDebounced: isExpandedDebounced,
|
|
51
|
+
removeContentFromDOM: removeContentFromDOM
|
|
50
52
|
}, (0, utils_1.extractSupportProps)(rest), {
|
|
51
53
|
children: children
|
|
52
54
|
}));
|
|
@@ -5,7 +5,8 @@ export type CollapseBlockPrivateProps = WithSupportProps<{
|
|
|
5
5
|
header: ReactNode;
|
|
6
6
|
expanded: boolean;
|
|
7
7
|
expandedDebounced: boolean;
|
|
8
|
+
removeContentFromDOM?: boolean;
|
|
8
9
|
className?: string;
|
|
9
10
|
shape?: 'round' | 'square';
|
|
10
11
|
}>;
|
|
11
|
-
export declare function CollapseBlockPrivate({ children, expanded, className, header, shape, expandedDebounced, ...rest }: CollapseBlockPrivateProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function CollapseBlockPrivate({ children, expanded, className, header, shape, expandedDebounced, removeContentFromDOM, ...rest }: CollapseBlockPrivateProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -29,9 +29,10 @@ function CollapseBlockPrivate(_a) {
|
|
|
29
29
|
className,
|
|
30
30
|
header,
|
|
31
31
|
shape,
|
|
32
|
-
expandedDebounced
|
|
32
|
+
expandedDebounced,
|
|
33
|
+
removeContentFromDOM = true
|
|
33
34
|
} = _a,
|
|
34
|
-
rest = __rest(_a, ["children", "expanded", "className", "header", "shape", "expandedDebounced"]);
|
|
35
|
+
rest = __rest(_a, ["children", "expanded", "className", "header", "shape", "expandedDebounced", "removeContentFromDOM"]);
|
|
35
36
|
return (0, jsx_runtime_1.jsxs)("div", Object.assign({
|
|
36
37
|
className: (0, classnames_1.default)(styles_module_scss_1.default.accordion, className),
|
|
37
38
|
// eslint-disable-next-line jsx-a11y/aria-role
|
|
@@ -46,7 +47,7 @@ function CollapseBlockPrivate(_a) {
|
|
|
46
47
|
children: (0, jsx_runtime_1.jsx)("div", {
|
|
47
48
|
className: styles_module_scss_1.default.content,
|
|
48
49
|
"data-content": true,
|
|
49
|
-
children: (expanded || expandedDebounced) && children
|
|
50
|
+
children: (!removeContentFromDOM || expanded || expandedDebounced) && children
|
|
50
51
|
})
|
|
51
52
|
})]
|
|
52
53
|
}));
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export type CollapseBlockSecondaryProps = WithSupportProps<{
|
|
|
12
12
|
children: ReactNode;
|
|
13
13
|
/** CSS-класс */
|
|
14
14
|
className?: string;
|
|
15
|
+
/** Проп отвечающий будет ли контент удаляться из DOM дерева */
|
|
16
|
+
removeContentFromDOM?: boolean;
|
|
15
17
|
}>;
|
|
16
18
|
export type CollapseBlockPrimaryProps = CollapseBlockSecondaryProps & {
|
|
17
19
|
/** Внешний бордер */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CollapseBlockPrimaryProps } from '../../types';
|
|
2
|
-
export declare function CollapseBlockPrimary({ id, header, children, actions, className, outline, shape, ...rest }: CollapseBlockPrimaryProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function CollapseBlockPrimary({ id, header, children, actions, className, outline, shape, removeContentFromDOM, ...rest }: CollapseBlockPrimaryProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -16,7 +16,7 @@ import { CollapseBlockHeaderContainer, CollapseBlockPrivate } from '../../helper
|
|
|
16
16
|
import { useExpanded } from '../../hooks';
|
|
17
17
|
import styles from './styles.module.css';
|
|
18
18
|
export function CollapseBlockPrimary(_a) {
|
|
19
|
-
var { id, header, children, actions, className, outline, shape = 'round' } = _a, rest = __rest(_a, ["id", "header", "children", "actions", "className", "outline", "shape"]);
|
|
19
|
+
var { id, header, children, actions, className, outline, shape = 'round', removeContentFromDOM } = _a, rest = __rest(_a, ["id", "header", "children", "actions", "className", "outline", "shape", "removeContentFromDOM"]);
|
|
20
20
|
const { isExpanded, isExpandedDebounced, handleToggleExpanded } = useExpanded(id);
|
|
21
|
-
return (_jsx(CollapseBlockPrivate, Object.assign({ className: cn(styles.containerBase, { [styles.container]: !outline, [styles.containerOutline]: outline }, className), shape: shape, header: _jsx(CollapseBlockHeaderContainer, { expanded: isExpanded, toggleExpanded: handleToggleExpanded, actions: actions, children: header }), expanded: isExpanded, expandedDebounced: isExpandedDebounced }, extractSupportProps(rest), { children: children })));
|
|
21
|
+
return (_jsx(CollapseBlockPrivate, Object.assign({ className: cn(styles.containerBase, { [styles.container]: !outline, [styles.containerOutline]: outline }, className), shape: shape, header: _jsx(CollapseBlockHeaderContainer, { expanded: isExpanded, toggleExpanded: handleToggleExpanded, actions: actions, children: header }), expanded: isExpanded, expandedDebounced: isExpandedDebounced, removeContentFromDOM: removeContentFromDOM }, extractSupportProps(rest), { children: children })));
|
|
22
22
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CollapseBlockSecondaryProps } from '../../types';
|
|
2
|
-
export declare function CollapseBlockSecondary({ header, children, id, actions, className, ...rest }: CollapseBlockSecondaryProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function CollapseBlockSecondary({ header, children, id, actions, className, removeContentFromDOM, ...rest }: CollapseBlockSecondaryProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -16,7 +16,7 @@ import { CollapseBlockHeaderContainer, CollapseBlockPrivate } from '../../helper
|
|
|
16
16
|
import { useExpanded } from '../../hooks';
|
|
17
17
|
import styles from './styles.module.css';
|
|
18
18
|
export function CollapseBlockSecondary(_a) {
|
|
19
|
-
var { header, children, id, actions, className } = _a, rest = __rest(_a, ["header", "children", "id", "actions", "className"]);
|
|
19
|
+
var { header, children, id, actions, className, removeContentFromDOM } = _a, rest = __rest(_a, ["header", "children", "id", "actions", "className", "removeContentFromDOM"]);
|
|
20
20
|
const { isExpanded, isExpandedDebounced, handleToggleExpanded } = useExpanded(id);
|
|
21
|
-
return (_jsx(CollapseBlockPrivate, Object.assign({ className: cn(styles.container, className), header: _jsx(CollapseBlockHeaderContainer, { expanded: isExpanded, toggleExpanded: handleToggleExpanded, actions: actions, children: header }), expanded: isExpanded, expandedDebounced: isExpandedDebounced }, extractSupportProps(rest), { children: children })));
|
|
21
|
+
return (_jsx(CollapseBlockPrivate, Object.assign({ className: cn(styles.container, className), header: _jsx(CollapseBlockHeaderContainer, { expanded: isExpanded, toggleExpanded: handleToggleExpanded, actions: actions, children: header }), expanded: isExpanded, expandedDebounced: isExpandedDebounced, removeContentFromDOM: removeContentFromDOM }, extractSupportProps(rest), { children: children })));
|
|
22
22
|
}
|
|
@@ -5,7 +5,8 @@ export type CollapseBlockPrivateProps = WithSupportProps<{
|
|
|
5
5
|
header: ReactNode;
|
|
6
6
|
expanded: boolean;
|
|
7
7
|
expandedDebounced: boolean;
|
|
8
|
+
removeContentFromDOM?: boolean;
|
|
8
9
|
className?: string;
|
|
9
10
|
shape?: 'round' | 'square';
|
|
10
11
|
}>;
|
|
11
|
-
export declare function CollapseBlockPrivate({ children, expanded, className, header, shape, expandedDebounced, ...rest }: CollapseBlockPrivateProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function CollapseBlockPrivate({ children, expanded, className, header, shape, expandedDebounced, removeContentFromDOM, ...rest }: CollapseBlockPrivateProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -15,8 +15,8 @@ import { extractSupportProps } from '@snack-uikit/utils';
|
|
|
15
15
|
import { TEST_IDS } from '../../testIds';
|
|
16
16
|
import styles from './styles.module.css';
|
|
17
17
|
export function CollapseBlockPrivate(_a) {
|
|
18
|
-
var { children, expanded, className, header, shape, expandedDebounced } = _a, rest = __rest(_a, ["children", "expanded", "className", "header", "shape", "expandedDebounced"]);
|
|
18
|
+
var { children, expanded, className, header, shape, expandedDebounced, removeContentFromDOM = true } = _a, rest = __rest(_a, ["children", "expanded", "className", "header", "shape", "expandedDebounced", "removeContentFromDOM"]);
|
|
19
19
|
return (_jsxs("div", Object.assign({ className: cn(styles.accordion, className),
|
|
20
20
|
// eslint-disable-next-line jsx-a11y/aria-role
|
|
21
|
-
role: 'accordion', "data-shape": shape, "aria-expanded": expanded }, extractSupportProps(rest), { children: [header, _jsx("div", { className: styles.contentWrapper, "aria-hidden": !expanded, "data-test-id": TEST_IDS.content, children: _jsx("div", { className: styles.content, "data-content": true, children: (expanded || expandedDebounced) && children }) })] })));
|
|
21
|
+
role: 'accordion', "data-shape": shape, "aria-expanded": expanded }, extractSupportProps(rest), { children: [header, _jsx("div", { className: styles.contentWrapper, "aria-hidden": !expanded, "data-test-id": TEST_IDS.content, children: _jsx("div", { className: styles.content, "data-content": true, children: (!removeContentFromDOM || expanded || expandedDebounced) && children }) })] })));
|
|
22
22
|
}
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export type CollapseBlockSecondaryProps = WithSupportProps<{
|
|
|
12
12
|
children: ReactNode;
|
|
13
13
|
/** CSS-класс */
|
|
14
14
|
className?: string;
|
|
15
|
+
/** Проп отвечающий будет ли контент удаляться из DOM дерева */
|
|
16
|
+
removeContentFromDOM?: boolean;
|
|
15
17
|
}>;
|
|
16
18
|
export type CollapseBlockPrimaryProps = CollapseBlockSecondaryProps & {
|
|
17
19
|
/** Внешний бордер */
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Accordion",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.10.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -49,5 +49,5 @@
|
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/lodash.debounce": "4.0.8"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "0779454bf78e89221f750755d7a2be3ffe5a5fd3"
|
|
53
53
|
}
|
|
@@ -15,6 +15,7 @@ export function CollapseBlockPrimary({
|
|
|
15
15
|
className,
|
|
16
16
|
outline,
|
|
17
17
|
shape = 'round',
|
|
18
|
+
removeContentFromDOM,
|
|
18
19
|
...rest
|
|
19
20
|
}: CollapseBlockPrimaryProps) {
|
|
20
21
|
const { isExpanded, isExpandedDebounced, handleToggleExpanded } = useExpanded(id);
|
|
@@ -34,6 +35,7 @@ export function CollapseBlockPrimary({
|
|
|
34
35
|
}
|
|
35
36
|
expanded={isExpanded}
|
|
36
37
|
expandedDebounced={isExpandedDebounced}
|
|
38
|
+
removeContentFromDOM={removeContentFromDOM}
|
|
37
39
|
{...extractSupportProps(rest)}
|
|
38
40
|
>
|
|
39
41
|
{children}
|
|
@@ -13,6 +13,7 @@ export function CollapseBlockSecondary({
|
|
|
13
13
|
id,
|
|
14
14
|
actions,
|
|
15
15
|
className,
|
|
16
|
+
removeContentFromDOM,
|
|
16
17
|
...rest
|
|
17
18
|
}: CollapseBlockSecondaryProps) {
|
|
18
19
|
const { isExpanded, isExpandedDebounced, handleToggleExpanded } = useExpanded(id);
|
|
@@ -27,6 +28,7 @@ export function CollapseBlockSecondary({
|
|
|
27
28
|
}
|
|
28
29
|
expanded={isExpanded}
|
|
29
30
|
expandedDebounced={isExpandedDebounced}
|
|
31
|
+
removeContentFromDOM={removeContentFromDOM}
|
|
30
32
|
{...extractSupportProps(rest)}
|
|
31
33
|
>
|
|
32
34
|
{children}
|
|
@@ -11,6 +11,7 @@ export type CollapseBlockPrivateProps = WithSupportProps<{
|
|
|
11
11
|
header: ReactNode;
|
|
12
12
|
expanded: boolean;
|
|
13
13
|
expandedDebounced: boolean;
|
|
14
|
+
removeContentFromDOM?: boolean;
|
|
14
15
|
className?: string;
|
|
15
16
|
shape?: 'round' | 'square';
|
|
16
17
|
}>;
|
|
@@ -22,6 +23,7 @@ export function CollapseBlockPrivate({
|
|
|
22
23
|
header,
|
|
23
24
|
shape,
|
|
24
25
|
expandedDebounced,
|
|
26
|
+
removeContentFromDOM = true,
|
|
25
27
|
...rest
|
|
26
28
|
}: CollapseBlockPrivateProps) {
|
|
27
29
|
return (
|
|
@@ -37,7 +39,7 @@ export function CollapseBlockPrivate({
|
|
|
37
39
|
|
|
38
40
|
<div className={styles.contentWrapper} aria-hidden={!expanded} data-test-id={TEST_IDS.content}>
|
|
39
41
|
<div className={styles.content} data-content>
|
|
40
|
-
{(expanded || expandedDebounced) && children}
|
|
42
|
+
{(!removeContentFromDOM || expanded || expandedDebounced) && children}
|
|
41
43
|
</div>
|
|
42
44
|
</div>
|
|
43
45
|
</div>
|
package/src/types.ts
CHANGED
|
@@ -15,6 +15,8 @@ export type CollapseBlockSecondaryProps = WithSupportProps<{
|
|
|
15
15
|
children: ReactNode;
|
|
16
16
|
/** CSS-класс */
|
|
17
17
|
className?: string;
|
|
18
|
+
/** Проп отвечающий будет ли контент удаляться из DOM дерева */
|
|
19
|
+
removeContentFromDOM?: boolean;
|
|
18
20
|
}>;
|
|
19
21
|
|
|
20
22
|
export type CollapseBlockPrimaryProps = CollapseBlockSecondaryProps & {
|