@bitrise/bitkit 11.4.2 → 11.5.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/package.json
CHANGED
|
@@ -4,7 +4,10 @@ import {
|
|
|
4
4
|
usePrefersReducedMotion,
|
|
5
5
|
} from '@chakra-ui/react';
|
|
6
6
|
|
|
7
|
-
export type
|
|
7
|
+
export type AccordionButtonSize = 'sm' | 'md';
|
|
8
|
+
|
|
9
|
+
export type AccordionProps = Omit<ChakraAccordionProps, 'defaultIndex'> & {
|
|
10
|
+
buttonSize?: AccordionButtonSize;
|
|
8
11
|
defaultIndex: number[];
|
|
9
12
|
};
|
|
10
13
|
|
|
@@ -13,12 +16,13 @@ export type AccordionProps = Omit<ChakraAccordionProps, 'onChange' | 'defaultInd
|
|
|
13
16
|
*/
|
|
14
17
|
const Accordion = (props: AccordionProps) => {
|
|
15
18
|
const prefersReducedMotion = usePrefersReducedMotion({ ssr: false });
|
|
16
|
-
const { children, colorScheme, defaultIndex, variant, ...rest } = props;
|
|
19
|
+
const { buttonSize = 'md', children, colorScheme, defaultIndex, variant, ...rest } = props;
|
|
17
20
|
|
|
18
21
|
return (
|
|
19
22
|
<ChakraAccordion
|
|
20
23
|
allowMultiple
|
|
21
24
|
allowToggle
|
|
25
|
+
buttonSize={buttonSize}
|
|
22
26
|
colorScheme={colorScheme}
|
|
23
27
|
variant={variant}
|
|
24
28
|
reduceMotion={prefersReducedMotion}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { StyleFunctionProps } from '@chakra-ui/styled-system';
|
|
2
2
|
import type { ComponentStyleConfig } from '@chakra-ui/theme';
|
|
3
3
|
import { CSSObject } from '@emotion/react';
|
|
4
|
+
import { AccordionButtonSize } from '../Accordion/Accordion';
|
|
4
5
|
|
|
5
6
|
type ColorObj = {
|
|
6
7
|
[key: string]: {
|
|
@@ -126,7 +127,12 @@ const LegacyBaseStyle: ({ colorScheme, variant }: Pick<StyleFunctionProps, 'colo
|
|
|
126
127
|
},
|
|
127
128
|
});
|
|
128
129
|
|
|
129
|
-
const
|
|
130
|
+
const buttonPaddingBlockSizes: Record<AccordionButtonSize, string> = {
|
|
131
|
+
sm: '12',
|
|
132
|
+
md: '20',
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
const BaseStyle: (buttonSize: AccordionButtonSize) => CSSObject = (buttonSize) => ({
|
|
130
136
|
item: {
|
|
131
137
|
borderTop: '1px solid',
|
|
132
138
|
borderTopColor: 'neutral.90',
|
|
@@ -137,7 +143,7 @@ const BaseStyle: () => CSSObject = () => ({
|
|
|
137
143
|
justifyContent: 'space-between',
|
|
138
144
|
width: '100%',
|
|
139
145
|
paddingInline: '16',
|
|
140
|
-
paddingBlock:
|
|
146
|
+
paddingBlock: buttonPaddingBlockSizes[buttonSize],
|
|
141
147
|
borderColor: 'neutral.93',
|
|
142
148
|
_hover: {
|
|
143
149
|
background: 'neutral.93',
|
|
@@ -162,8 +168,10 @@ const BaseStyle: () => CSSObject = () => ({
|
|
|
162
168
|
});
|
|
163
169
|
|
|
164
170
|
const AccordionTheme: ComponentStyleConfig = {
|
|
165
|
-
baseStyle: ({ colorScheme, variant }) => {
|
|
166
|
-
return variant === 'legacy' || variant === 'flat'
|
|
171
|
+
baseStyle: ({ buttonSize, colorScheme, variant }) => {
|
|
172
|
+
return variant === 'legacy' || variant === 'flat'
|
|
173
|
+
? LegacyBaseStyle({ colorScheme, variant })
|
|
174
|
+
: BaseStyle(buttonSize);
|
|
167
175
|
},
|
|
168
176
|
};
|
|
169
177
|
|