@astral/ui 4.103.1 → 4.103.2
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/components/Accordion/Accordion.js +2 -2
- package/components/Accordion/styles.d.ts +0 -4
- package/components/Accordion/styles.js +6 -7
- package/components/Accordion/useLogic/useLogic.d.ts +1 -1
- package/node/components/Accordion/Accordion.js +1 -1
- package/node/components/Accordion/styles.d.ts +0 -4
- package/node/components/Accordion/styles.js +7 -8
- package/node/components/Accordion/useLogic/useLogic.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { Collapse } from '../Collapse';
|
|
4
|
-
import { Chevron, ChevronWrapper, ContentWrapper, Header, SubtitleWrapper, Summary,
|
|
4
|
+
import { Chevron, ChevronWrapper, ContentWrapper, Header, SubtitleWrapper, Summary, } from './styles';
|
|
5
5
|
import { useLogic } from './useLogic';
|
|
6
6
|
export const Accordion = forwardRef(({ summary, startAdornment, isExpanded, onChange, children, summaryVariant = 'h6', subtitle, }, forwardedRef) => {
|
|
7
7
|
const { actualIsExpanded, hasStartAdornment, handleClick, handleKeyDown, hasSubtitle, } = useLogic({ startAdornment, isExpanded, onChange, subtitle });
|
|
8
|
-
return (_jsxs(
|
|
8
|
+
return (_jsxs("div", { ref: forwardedRef, children: [_jsxs(Header, { role: "button", tabIndex: 0, onClick: handleClick, onKeyDown: handleKeyDown, "$withStartAdornment": hasStartAdornment, "$hasSubtitle": hasSubtitle, children: [startAdornment, typeof summary === 'string' ? (_jsx(Summary, { variant: summaryVariant, children: summary })) : (summary), _jsx(ChevronWrapper, { children: _jsx(Chevron, { "$isActive": actualIsExpanded }) }), hasSubtitle && (_jsx(SubtitleWrapper, { "$withStartAdornment": hasStartAdornment, children: subtitle }))] }), _jsx(Collapse, { in: actualIsExpanded, unmountOnExit: true, children: _jsx(ContentWrapper, { "$withStartAdornment": hasStartAdornment, "$hasSubtitle": hasSubtitle, children: children }) })] }));
|
|
9
9
|
});
|
|
@@ -34,10 +34,6 @@ export declare const ChevronWrapper: import("../styled").StyledComponent<{
|
|
|
34
34
|
theme?: import("@emotion/react").Theme | undefined;
|
|
35
35
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
36
36
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
37
|
-
export declare const Wrapper: import("../styled").StyledComponent<{
|
|
38
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
39
|
-
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
40
|
-
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
41
37
|
export declare const Chevron: import("../styled").StyledComponent<{
|
|
42
38
|
children?: import("react").ReactNode;
|
|
43
39
|
color?: string | undefined;
|
|
@@ -11,6 +11,8 @@ export const Header = styled.header `
|
|
|
11
11
|
grid-template-columns: ${({ $withStartAdornment }) => $withStartAdornment ? '20px 1fr 20px' : ' 1fr 20px'};
|
|
12
12
|
grid-template-rows: ${({ $hasSubtitle }) => $hasSubtitle ? '20px 1fr' : '1fr'};
|
|
13
13
|
|
|
14
|
+
border-radius: ${({ theme }) => theme.shape.medium};
|
|
15
|
+
|
|
14
16
|
${({ theme }) => theme.breakpoints.down('mobile')} {
|
|
15
17
|
grid-row-gap: ${({ theme }) => theme.spacing(1)};
|
|
16
18
|
grid-template-rows: ${({ $hasSubtitle }) => $hasSubtitle ? '24px 1fr' : '1fr'};
|
|
@@ -18,6 +20,10 @@ export const Header = styled.header `
|
|
|
18
20
|
/* Убирает highlight на мобильных устройствах */
|
|
19
21
|
-webkit-tap-highlight-color: transparent;
|
|
20
22
|
}
|
|
23
|
+
|
|
24
|
+
&:focus-visible {
|
|
25
|
+
outline: 2px solid ${({ theme }) => theme.palette.components.focused};
|
|
26
|
+
}
|
|
21
27
|
|
|
22
28
|
& .${svgIconClassnames.root} {
|
|
23
29
|
font-size: 20px;
|
|
@@ -54,13 +60,6 @@ export const ChevronWrapper = styled.div `
|
|
|
54
60
|
height: 24px;
|
|
55
61
|
}
|
|
56
62
|
`;
|
|
57
|
-
export const Wrapper = styled.div `
|
|
58
|
-
border-radius: ${({ theme }) => theme.shape.medium};
|
|
59
|
-
|
|
60
|
-
&:focus-visible {
|
|
61
|
-
outline: 2px solid ${({ theme }) => theme.palette.components.focused};
|
|
62
|
-
}
|
|
63
|
-
`;
|
|
64
63
|
export const Chevron = styled(DownOutlineMd, {
|
|
65
64
|
shouldForwardProp: (prop) => !['$isActive'].includes(prop),
|
|
66
65
|
}) `
|
|
@@ -3,7 +3,7 @@ import { type AccordionProps } from '../types';
|
|
|
3
3
|
type UseLogicParams = Pick<AccordionProps, 'startAdornment' | 'isExpanded' | 'onChange' | 'subtitle'>;
|
|
4
4
|
export declare const useLogic: ({ startAdornment, isExpanded, onChange, subtitle, }: UseLogicParams) => {
|
|
5
5
|
handleClick: (event: SyntheticEvent<HTMLElement>) => void;
|
|
6
|
-
handleKeyDown: (event: KeyboardEvent<
|
|
6
|
+
handleKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
|
|
7
7
|
actualIsExpanded: boolean;
|
|
8
8
|
isUncontrolledExpanded: boolean;
|
|
9
9
|
hasStartAdornment: boolean;
|
|
@@ -8,5 +8,5 @@ const styles_1 = require("./styles");
|
|
|
8
8
|
const useLogic_1 = require("./useLogic");
|
|
9
9
|
exports.Accordion = (0, react_1.forwardRef)(({ summary, startAdornment, isExpanded, onChange, children, summaryVariant = 'h6', subtitle, }, forwardedRef) => {
|
|
10
10
|
const { actualIsExpanded, hasStartAdornment, handleClick, handleKeyDown, hasSubtitle, } = (0, useLogic_1.useLogic)({ startAdornment, isExpanded, onChange, subtitle });
|
|
11
|
-
return ((0, jsx_runtime_1.jsxs)(
|
|
11
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ref: forwardedRef, children: [(0, jsx_runtime_1.jsxs)(styles_1.Header, { role: "button", tabIndex: 0, onClick: handleClick, onKeyDown: handleKeyDown, "$withStartAdornment": hasStartAdornment, "$hasSubtitle": hasSubtitle, children: [startAdornment, typeof summary === 'string' ? ((0, jsx_runtime_1.jsx)(styles_1.Summary, { variant: summaryVariant, children: summary })) : (summary), (0, jsx_runtime_1.jsx)(styles_1.ChevronWrapper, { children: (0, jsx_runtime_1.jsx)(styles_1.Chevron, { "$isActive": actualIsExpanded }) }), hasSubtitle && ((0, jsx_runtime_1.jsx)(styles_1.SubtitleWrapper, { "$withStartAdornment": hasStartAdornment, children: subtitle }))] }), (0, jsx_runtime_1.jsx)(Collapse_1.Collapse, { in: actualIsExpanded, unmountOnExit: true, children: (0, jsx_runtime_1.jsx)(styles_1.ContentWrapper, { "$withStartAdornment": hasStartAdornment, "$hasSubtitle": hasSubtitle, children: children }) })] }));
|
|
12
12
|
});
|
|
@@ -34,10 +34,6 @@ export declare const ChevronWrapper: import("@emotion/styled/dist/declarations/s
|
|
|
34
34
|
theme?: import("@emotion/react").Theme | undefined;
|
|
35
35
|
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
36
36
|
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
37
|
-
export declare const Wrapper: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
38
|
-
theme?: import("@emotion/react").Theme | undefined;
|
|
39
|
-
as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
|
|
40
|
-
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
41
37
|
export declare const Chevron: import("@emotion/styled/dist/declarations/src/types").StyledComponent<{
|
|
42
38
|
children?: import("react").ReactNode;
|
|
43
39
|
color?: string | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Chevron = exports.
|
|
3
|
+
exports.Chevron = exports.ChevronWrapper = exports.Summary = exports.ContentWrapper = exports.SubtitleWrapper = exports.Header = void 0;
|
|
4
4
|
const DownOutlineMd_1 = require("../../icons/DownOutlineMd");
|
|
5
5
|
const SvgIcon_1 = require("../SvgIcon");
|
|
6
6
|
const styled_1 = require("../styled");
|
|
@@ -14,6 +14,8 @@ exports.Header = styled_1.styled.header `
|
|
|
14
14
|
grid-template-columns: ${({ $withStartAdornment }) => $withStartAdornment ? '20px 1fr 20px' : ' 1fr 20px'};
|
|
15
15
|
grid-template-rows: ${({ $hasSubtitle }) => $hasSubtitle ? '20px 1fr' : '1fr'};
|
|
16
16
|
|
|
17
|
+
border-radius: ${({ theme }) => theme.shape.medium};
|
|
18
|
+
|
|
17
19
|
${({ theme }) => theme.breakpoints.down('mobile')} {
|
|
18
20
|
grid-row-gap: ${({ theme }) => theme.spacing(1)};
|
|
19
21
|
grid-template-rows: ${({ $hasSubtitle }) => $hasSubtitle ? '24px 1fr' : '1fr'};
|
|
@@ -21,6 +23,10 @@ exports.Header = styled_1.styled.header `
|
|
|
21
23
|
/* Убирает highlight на мобильных устройствах */
|
|
22
24
|
-webkit-tap-highlight-color: transparent;
|
|
23
25
|
}
|
|
26
|
+
|
|
27
|
+
&:focus-visible {
|
|
28
|
+
outline: 2px solid ${({ theme }) => theme.palette.components.focused};
|
|
29
|
+
}
|
|
24
30
|
|
|
25
31
|
& .${SvgIcon_1.svgIconClassnames.root} {
|
|
26
32
|
font-size: 20px;
|
|
@@ -57,13 +63,6 @@ exports.ChevronWrapper = styled_1.styled.div `
|
|
|
57
63
|
height: 24px;
|
|
58
64
|
}
|
|
59
65
|
`;
|
|
60
|
-
exports.Wrapper = styled_1.styled.div `
|
|
61
|
-
border-radius: ${({ theme }) => theme.shape.medium};
|
|
62
|
-
|
|
63
|
-
&:focus-visible {
|
|
64
|
-
outline: 2px solid ${({ theme }) => theme.palette.components.focused};
|
|
65
|
-
}
|
|
66
|
-
`;
|
|
67
66
|
exports.Chevron = (0, styled_1.styled)(DownOutlineMd_1.DownOutlineMd, {
|
|
68
67
|
shouldForwardProp: (prop) => !['$isActive'].includes(prop),
|
|
69
68
|
}) `
|
|
@@ -3,7 +3,7 @@ import { type AccordionProps } from '../types';
|
|
|
3
3
|
type UseLogicParams = Pick<AccordionProps, 'startAdornment' | 'isExpanded' | 'onChange' | 'subtitle'>;
|
|
4
4
|
export declare const useLogic: ({ startAdornment, isExpanded, onChange, subtitle, }: UseLogicParams) => {
|
|
5
5
|
handleClick: (event: SyntheticEvent<HTMLElement>) => void;
|
|
6
|
-
handleKeyDown: (event: KeyboardEvent<
|
|
6
|
+
handleKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
|
|
7
7
|
actualIsExpanded: boolean;
|
|
8
8
|
isUncontrolledExpanded: boolean;
|
|
9
9
|
hasStartAdornment: boolean;
|