@snack-uikit/accordion 0.5.9 → 0.6.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/components/CollapseBlockPrimary/CollapseBlockPrimary.d.ts +2 -2
- package/dist/components/CollapseBlockPrimary/CollapseBlockPrimary.js +2 -2
- package/dist/components/CollapseBlockPrimary/styles.module.css +25 -3
- package/dist/components/CollapseBlockSecondary/CollapseBlockSecondary.d.ts +2 -2
- package/dist/types.d.ts +6 -1
- package/package.json +2 -2
- package/src/components/CollapseBlockPrimary/CollapseBlockPrimary.tsx +15 -3
- package/src/components/CollapseBlockPrimary/styles.module.scss +23 -4
- package/src/components/CollapseBlockSecondary/CollapseBlockSecondary.tsx +9 -2
- package/src/types.ts +8 -1
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.6.0 (2024-02-21)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **FF-4296:** add outline prop into CollapseBlockPrimary ([91c7e82](https://github.com/cloud-ru-tech/snack-uikit/commit/91c7e82064ed123e51075478ad2718f00d3f50cf))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 0.5.9 (2024-02-20)
|
|
7
18
|
|
|
8
19
|
### Only dependencies have been changed
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function CollapseBlockPrimary({ id, header, children, actions, className, ...rest }:
|
|
1
|
+
import { CollapseBlockPrimaryProps } from '../../types';
|
|
2
|
+
export declare function CollapseBlockPrimary({ id, header, children, actions, className, outline, ...rest }: CollapseBlockPrimaryProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -16,7 +16,7 @@ import { extractSupportProps } from '@snack-uikit/utils';
|
|
|
16
16
|
import { CollapseBlockHeaderContainer, CollapseBlockPrivate } from '../../helperComponents';
|
|
17
17
|
import styles from './styles.module.css';
|
|
18
18
|
export function CollapseBlockPrimary(_a) {
|
|
19
|
-
var { id, header, children, actions, className } = _a, rest = __rest(_a, ["id", "header", "children", "actions", "className"]);
|
|
19
|
+
var { id, header, children, actions, className, outline } = _a, rest = __rest(_a, ["id", "header", "children", "actions", "className", "outline"]);
|
|
20
20
|
const { isChecked: isExpanded, handleClick: handleExpandedChange } = useToggleGroup({ value: id });
|
|
21
|
-
return (_jsx(CollapseBlockPrivate, Object.assign({ className: cn(styles.container, className), header: _jsx(CollapseBlockHeaderContainer, { expanded: isExpanded, toggleExpanded: handleExpandedChange, actions: actions, children: header }), expanded: isExpanded }, extractSupportProps(rest), { children: children })));
|
|
21
|
+
return (_jsx(CollapseBlockPrivate, Object.assign({ className: cn(styles.containerBase, { [styles.container]: !outline, [styles.containerOutline]: outline }, className), header: _jsx(CollapseBlockHeaderContainer, { expanded: isExpanded, toggleExpanded: handleExpandedChange, actions: actions, children: header }), expanded: isExpanded }, extractSupportProps(rest), { children: children })));
|
|
22
22
|
}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
.containerBase{
|
|
2
|
+
max-width:100%;
|
|
3
|
+
background-color:var(--sys-neutral-background1-level, #fafafc);
|
|
4
|
+
}
|
|
5
|
+
.containerBase:focus-within, .containerBase:hover{
|
|
6
|
+
background-color:var(--sys-neutral-background2-level, #ffffff);
|
|
7
|
+
}
|
|
8
|
+
|
|
1
9
|
.container{
|
|
2
10
|
padding-top:var(--space-accordion-collapse-block-primary-vertical-padding, 32px);
|
|
3
11
|
padding-bottom:var(--space-accordion-collapse-block-primary-vertical-padding, 32px);
|
|
@@ -5,10 +13,24 @@
|
|
|
5
13
|
padding-right:var(--space-accordion-collapse-block-primary-horizontal-padding, 32px);
|
|
6
14
|
gap:var(--space-accordion-collapse-block-primary-gap, 32px);
|
|
7
15
|
border-radius:var(--radius-accordion-collapse-block-primary, 24px);
|
|
8
|
-
max-width:100%;
|
|
9
|
-
background-color:var(--sys-neutral-background1-level, #fafafc);
|
|
10
16
|
}
|
|
11
17
|
.container:focus-within, .container:hover{
|
|
12
|
-
background-color:var(--sys-neutral-background2-level, #ffffff);
|
|
13
18
|
box-shadow:var(--box-shadow-elevation-level2, 0px 0px 4px 0px rgba(0, 0, 0, 0.0392156863), 0px 4px 8px 0px rgba(0, 0, 0, 0.0392156863));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.containerOutline{
|
|
22
|
+
padding-top:var(--space-accordion-collapse-block-primary-vertical-padding, 32px);
|
|
23
|
+
padding-bottom:var(--space-accordion-collapse-block-primary-vertical-padding, 32px);
|
|
24
|
+
padding-left:var(--space-accordion-collapse-block-primary-horizontal-padding, 32px);
|
|
25
|
+
padding-right:var(--space-accordion-collapse-block-primary-horizontal-padding, 32px);
|
|
26
|
+
gap:var(--space-accordion-collapse-block-primary-gap, 32px);
|
|
27
|
+
border-radius:var(--radius-accordion-collapse-block-primary, 24px);
|
|
28
|
+
border-width:var(--border-width-accordion-collapse-block-primary, 1px);
|
|
29
|
+
border-width:0;
|
|
30
|
+
outline-color:var(--sys-neutral-decor-default, #dfe2ec);
|
|
31
|
+
outline-style:solid;
|
|
32
|
+
outline-width:var(--border-width-accordion-collapse-block-primary, 1px);
|
|
33
|
+
}
|
|
34
|
+
.containerOutline:focus-within, .containerOutline:hover{
|
|
35
|
+
outline-color:var(--sys-neutral-decor-hovered, #cfd2dc);
|
|
14
36
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function CollapseBlockSecondary({ header, children, id, actions, className, ...rest }:
|
|
1
|
+
import { CollapseBlockSecondaryProps } from '../../types';
|
|
2
|
+
export declare function CollapseBlockSecondary({ header, children, id, actions, className, ...rest }: CollapseBlockSecondaryProps): import("react/jsx-runtime").JSX.Element;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { WithSupportProps } from '@snack-uikit/utils';
|
|
3
3
|
import { SELECTION_MODE } from './constants';
|
|
4
|
-
export type
|
|
4
|
+
export type CollapseBlockSecondaryProps = WithSupportProps<{
|
|
5
5
|
/** Уникальный id блока */
|
|
6
6
|
id: string;
|
|
7
7
|
/** Заголовок */
|
|
@@ -13,6 +13,11 @@ export type CollapseBlockProps = WithSupportProps<{
|
|
|
13
13
|
/** CSS-класс */
|
|
14
14
|
className?: string;
|
|
15
15
|
}>;
|
|
16
|
+
export type CollapseBlockPrimaryProps = CollapseBlockSecondaryProps & {
|
|
17
|
+
/** Внешний бордер */
|
|
18
|
+
outline?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type CollapseBlockProps = CollapseBlockPrimaryProps | CollapseBlockSecondaryProps;
|
|
16
21
|
export type AccordionProps = WithSupportProps<{
|
|
17
22
|
/** Вложенный контент */
|
|
18
23
|
children: ReactElement<CollapseBlockProps> | ReactElement<CollapseBlockProps>[];
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Accordion",
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.6.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.css",
|
|
10
10
|
"*.woff",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"@snack-uikit/utils": "3.2.0",
|
|
42
42
|
"classnames": "2.3.2"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "3e7a22f46aa4c135fababaf8d147bdf860a37e39"
|
|
45
45
|
}
|
|
@@ -4,15 +4,27 @@ import { useToggleGroup } from '@snack-uikit/toggles';
|
|
|
4
4
|
import { extractSupportProps } from '@snack-uikit/utils';
|
|
5
5
|
|
|
6
6
|
import { CollapseBlockHeaderContainer, CollapseBlockPrivate } from '../../helperComponents';
|
|
7
|
-
import {
|
|
7
|
+
import { CollapseBlockPrimaryProps } from '../../types';
|
|
8
8
|
import styles from './styles.module.scss';
|
|
9
9
|
|
|
10
|
-
export function CollapseBlockPrimary({
|
|
10
|
+
export function CollapseBlockPrimary({
|
|
11
|
+
id,
|
|
12
|
+
header,
|
|
13
|
+
children,
|
|
14
|
+
actions,
|
|
15
|
+
className,
|
|
16
|
+
outline,
|
|
17
|
+
...rest
|
|
18
|
+
}: CollapseBlockPrimaryProps) {
|
|
11
19
|
const { isChecked: isExpanded, handleClick: handleExpandedChange } = useToggleGroup({ value: id });
|
|
12
20
|
|
|
13
21
|
return (
|
|
14
22
|
<CollapseBlockPrivate
|
|
15
|
-
className={cn(
|
|
23
|
+
className={cn(
|
|
24
|
+
styles.containerBase,
|
|
25
|
+
{ [styles.container]: !outline, [styles.containerOutline]: outline },
|
|
26
|
+
className,
|
|
27
|
+
)}
|
|
16
28
|
header={
|
|
17
29
|
<CollapseBlockHeaderContainer expanded={isExpanded} toggleExpanded={handleExpandedChange} actions={actions}>
|
|
18
30
|
{header}
|
|
@@ -1,14 +1,33 @@
|
|
|
1
1
|
@import '@snack-uikit/figma-tokens/build/scss/components/styles-tokens-accordion';
|
|
2
2
|
|
|
3
|
-
.
|
|
4
|
-
@include composite-var($collapse-block-container-primary);
|
|
5
|
-
|
|
3
|
+
.containerBase {
|
|
6
4
|
max-width: 100%;
|
|
7
5
|
background-color: $sys-neutral-background1-level;
|
|
8
6
|
|
|
9
7
|
&:focus-within,
|
|
10
|
-
&:hover{
|
|
8
|
+
&:hover {
|
|
11
9
|
background-color: $sys-neutral-background2-level;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.container {
|
|
14
|
+
@include composite-var($collapse-block-container-primary);
|
|
15
|
+
|
|
16
|
+
&:focus-within,
|
|
17
|
+
&:hover {
|
|
12
18
|
box-shadow: $box-shadow-elevation-level2;
|
|
13
19
|
}
|
|
14
20
|
}
|
|
21
|
+
|
|
22
|
+
.containerOutline {
|
|
23
|
+
@include composite-var($collapse-block-container-primary-outline);
|
|
24
|
+
|
|
25
|
+
border-width: 0;
|
|
26
|
+
outline-color: $sys-neutral-decor-default;
|
|
27
|
+
outline-style: solid;
|
|
28
|
+
outline-width: $border-width-accordion-collapse-block-primary;
|
|
29
|
+
&:focus-within,
|
|
30
|
+
&:hover {
|
|
31
|
+
outline-color: $sys-neutral-decor-hovered;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -4,10 +4,17 @@ import { useToggleGroup } from '@snack-uikit/toggles';
|
|
|
4
4
|
import { extractSupportProps } from '@snack-uikit/utils';
|
|
5
5
|
|
|
6
6
|
import { CollapseBlockHeaderContainer, CollapseBlockPrivate } from '../../helperComponents';
|
|
7
|
-
import {
|
|
7
|
+
import { CollapseBlockSecondaryProps } from '../../types';
|
|
8
8
|
import styles from './styles.module.scss';
|
|
9
9
|
|
|
10
|
-
export function CollapseBlockSecondary({
|
|
10
|
+
export function CollapseBlockSecondary({
|
|
11
|
+
header,
|
|
12
|
+
children,
|
|
13
|
+
id,
|
|
14
|
+
actions,
|
|
15
|
+
className,
|
|
16
|
+
...rest
|
|
17
|
+
}: CollapseBlockSecondaryProps) {
|
|
11
18
|
const { isChecked: isExpanded, handleClick: handleExpandedChange } = useToggleGroup({ value: id });
|
|
12
19
|
|
|
13
20
|
return (
|
package/src/types.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { WithSupportProps } from '@snack-uikit/utils';
|
|
|
4
4
|
|
|
5
5
|
import { SELECTION_MODE } from './constants';
|
|
6
6
|
|
|
7
|
-
export type
|
|
7
|
+
export type CollapseBlockSecondaryProps = WithSupportProps<{
|
|
8
8
|
/** Уникальный id блока */
|
|
9
9
|
id: string;
|
|
10
10
|
/** Заголовок */
|
|
@@ -17,6 +17,13 @@ export type CollapseBlockProps = WithSupportProps<{
|
|
|
17
17
|
className?: string;
|
|
18
18
|
}>;
|
|
19
19
|
|
|
20
|
+
export type CollapseBlockPrimaryProps = CollapseBlockSecondaryProps & {
|
|
21
|
+
/** Внешний бордер */
|
|
22
|
+
outline?: boolean;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type CollapseBlockProps = CollapseBlockPrimaryProps | CollapseBlockSecondaryProps;
|
|
26
|
+
|
|
20
27
|
export type AccordionProps = WithSupportProps<{
|
|
21
28
|
/** Вложенный контент */
|
|
22
29
|
children: ReactElement<CollapseBlockProps> | ReactElement<CollapseBlockProps>[];
|