@wavv/ui 2.4.8-alpha.3 → 2.4.8-alpha.4
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.
|
@@ -427,7 +427,7 @@ declare const Accordion: {
|
|
|
427
427
|
className?: import("react-aria-components").DisclosurePanelProps["className"];
|
|
428
428
|
style?: import("react-aria-components").DisclosurePanelProps["style"];
|
|
429
429
|
background?: string;
|
|
430
|
-
} & MaxHeight & import("react-aria-components").DisclosurePanelProps): import("react/jsx-runtime").JSX.Element;
|
|
430
|
+
} & MaxHeight & import("../types").Padding & import("react-aria-components").DisclosurePanelProps): import("react/jsx-runtime").JSX.Element;
|
|
431
431
|
displayName: string;
|
|
432
432
|
};
|
|
433
433
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type DisclosurePanelProps } from 'react-aria-components';
|
|
2
|
-
import type { MaxHeight } from '../types';
|
|
2
|
+
import type { MaxHeight, Padding } from '../types';
|
|
3
3
|
type PanelProps = {
|
|
4
4
|
children: DisclosurePanelProps['children'];
|
|
5
5
|
className?: DisclosurePanelProps['className'];
|
|
6
6
|
style?: DisclosurePanelProps['style'];
|
|
7
7
|
background?: string;
|
|
8
|
-
} & MaxHeight & DisclosurePanelProps;
|
|
8
|
+
} & MaxHeight & Padding & DisclosurePanelProps;
|
|
9
9
|
declare const Panel: {
|
|
10
10
|
({ children, maxHeight, ...props }: PanelProps): import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
displayName: string;
|
|
@@ -4,6 +4,7 @@ import { useRef, useState } from "react";
|
|
|
4
4
|
import { DisclosurePanel } from "react-aria-components";
|
|
5
5
|
import { useElementObserver } from "../../hooks/index.js";
|
|
6
6
|
import isPropAllowed from "../helpers/isPropAllowed.js";
|
|
7
|
+
import { paddingProps } from "../helpers/styledProps.js";
|
|
7
8
|
const Panel = ({ children, maxHeight, ...props })=>{
|
|
8
9
|
const contentRef = useRef(null);
|
|
9
10
|
const [calculatedMaxHeight, setCalculatedMaxHeight] = useState();
|
|
@@ -42,7 +43,10 @@ const PanelContainer = styled(DisclosurePanel, {
|
|
|
42
43
|
'defaultPadding',
|
|
43
44
|
'maxHeight'
|
|
44
45
|
])
|
|
45
|
-
})(({ theme, maxHeight, defaultPadding, background })=>
|
|
46
|
+
})(({ theme, maxHeight, defaultPadding, background, ...props })=>{
|
|
47
|
+
const hasPaddingProps = void 0 !== props.padding || void 0 !== props.paddingTop || void 0 !== props.paddingBottom || void 0 !== props.paddingRight || void 0 !== props.paddingLeft;
|
|
48
|
+
const paddingValue = !hasPaddingProps && defaultPadding ? '8px 16px' : void 0;
|
|
49
|
+
return {
|
|
46
50
|
backgroundColor: background || theme.scale0,
|
|
47
51
|
color: theme.scale10,
|
|
48
52
|
fontSize: theme.font.size.md,
|
|
@@ -56,9 +60,13 @@ const PanelContainer = styled(DisclosurePanel, {
|
|
|
56
60
|
opacity: 0
|
|
57
61
|
},
|
|
58
62
|
'&[aria-hidden="false"]': {
|
|
59
|
-
|
|
63
|
+
...paddingProps({
|
|
64
|
+
padding: paddingValue,
|
|
65
|
+
...props
|
|
66
|
+
})
|
|
60
67
|
}
|
|
61
|
-
}
|
|
68
|
+
};
|
|
69
|
+
});
|
|
62
70
|
Panel.displayName = 'Accordion.Panel';
|
|
63
71
|
const Accordion_Panel = Panel;
|
|
64
72
|
export { Accordion_Panel as default };
|