@bitrise/bitkit 11.4.1 → 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,12 +127,14 @@ 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
|
-
|
|
132
|
-
boxShadow: 'none',
|
|
133
|
-
borderTopStyle: 'solid',
|
|
134
|
-
borderTopWidth: '1px',
|
|
137
|
+
borderTop: '1px solid',
|
|
135
138
|
borderTopColor: 'neutral.90',
|
|
136
139
|
},
|
|
137
140
|
button: {
|
|
@@ -140,14 +143,12 @@ const BaseStyle: () => CSSObject = () => ({
|
|
|
140
143
|
justifyContent: 'space-between',
|
|
141
144
|
width: '100%',
|
|
142
145
|
paddingInline: '16',
|
|
143
|
-
paddingBlock:
|
|
146
|
+
paddingBlock: buttonPaddingBlockSizes[buttonSize],
|
|
144
147
|
borderColor: 'neutral.93',
|
|
145
148
|
_hover: {
|
|
146
149
|
background: 'neutral.93',
|
|
147
150
|
},
|
|
148
|
-
|
|
149
|
-
borderBottomLeftRadius: '0',
|
|
150
|
-
borderBottomRightRadius: '0',
|
|
151
|
+
_active: {
|
|
151
152
|
background: 'neutral.90',
|
|
152
153
|
},
|
|
153
154
|
},
|
|
@@ -157,13 +158,20 @@ const BaseStyle: () => CSSObject = () => ({
|
|
|
157
158
|
marginLeft: '16',
|
|
158
159
|
},
|
|
159
160
|
panel: {
|
|
160
|
-
|
|
161
|
+
paddingBlockEnd: '16',
|
|
162
|
+
paddingInline: '16',
|
|
163
|
+
},
|
|
164
|
+
root: {
|
|
165
|
+
borderBottom: '1px solid',
|
|
166
|
+
borderBottomColor: 'neutral.90',
|
|
161
167
|
},
|
|
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
|
|