@bitrise/bitkit 10.11.0 → 10.11.1

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrise/bitkit",
3
3
  "description": "Bitrise React component library",
4
- "version": "10.11.0",
4
+ "version": "10.11.1",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -25,18 +25,18 @@ const onButtonClick = (e: MouseEvent<HTMLButtonElement>) => {
25
25
  e.stopPropagation();
26
26
  };
27
27
 
28
- const ButtonContentElement = () => {
28
+ const ButtonContentElement = ({ title }: { title: string }) => {
29
29
  return (
30
30
  <Box display="flex" alignItems="center" flexGrow={1}>
31
31
  <Icon name="Doc" />
32
32
  <Text as="p" align="left" size="3" margin="0 auto 0 1rem">
33
- The buttonContent is a React element
33
+ {title}
34
34
  <br />
35
35
  <Text as="span" size="2" textColor="neutral.40">
36
36
  Generated by clone-build workflow
37
37
  </Text>
38
38
  </Text>
39
- <Button as="a" size="small" onClick={onButtonClick} leftIconName="Download">
39
+ <Button as="a" href="#" size="small" onClick={onButtonClick} leftIconName="Download">
40
40
  Download
41
41
  </Button>
42
42
  </Box>
@@ -48,9 +48,13 @@ export const DefaultVariant: ComponentStory<typeof Accordion> = (props) => (
48
48
  <AccordionItem buttonContent="The buttonContent is a string" fontSize="2" id="first">
49
49
  Content - you can use any style prop on AccordionItem
50
50
  </AccordionItem>
51
- <AccordionItem buttonContent={<ButtonContentElement />} fontSize="2" id="second">
51
+ <AccordionItem
52
+ buttonContent={<ButtonContentElement title="The buttonContent is a React element" />}
53
+ fontSize="2"
54
+ id="second"
55
+ >
52
56
  Content - you can use any style prop on AccordionItem
53
57
  </AccordionItem>
54
- <AccordionItem buttonContent="Without children the button is disabled" id="third" />
58
+ <AccordionItem buttonContent={<ButtonContentElement title="Without children" />} id="third" />
55
59
  </Accordion>
56
60
  );
@@ -10,19 +10,18 @@ const AccordionTheme: ComponentStyleConfig = {
10
10
  marginBottom: '16',
11
11
  },
12
12
  button: {
13
+ display: 'flex',
14
+ alignItems: 'center',
15
+ justifyContent: 'space-between',
13
16
  width: '100%',
14
17
  padding: '16',
15
18
  background: colorScheme === 'gray' ? 'neutral.95' : 'neutral.100',
16
19
  borderBottom: '1px solid',
17
20
  borderColor: 'neutral.93',
18
21
  borderRadius: '8',
19
- justifyContent: 'space-between',
20
- _hover: {
22
+ '&[type="button"]:hover': {
21
23
  background: 'purple.95',
22
24
  },
23
- _disabled: {
24
- pointerEvents: 'none',
25
- },
26
25
  '&[aria-expanded="true"]': {
27
26
  borderBottomLeftRadius: '0',
28
27
  borderBottomRightRadius: '0',
@@ -20,6 +20,9 @@ const getItemIds = (props: AccordionProps) => {
20
20
  return ids;
21
21
  };
22
22
 
23
+ /**
24
+ * Accordions display a list of high-level options that can expand/collapse to reveal more information.
25
+ */
23
26
  const Accordion = (props: AccordionProps) => {
24
27
  const prefersReducedMotion = usePrefersReducedMotion();
25
28
  const { children, colorScheme, onChange, ...rest } = props;
@@ -8,6 +8,7 @@ import {
8
8
  AccordionIcon,
9
9
  useMultiStyleConfig,
10
10
  } from '@chakra-ui/react';
11
+ import Box from '../Box/Box';
11
12
  import Text from '../Text/Text';
12
13
 
13
14
  export interface AccordionItemProps extends AccordionPanelProps {
@@ -20,12 +21,14 @@ const AccordionItem = (props: AccordionItemProps) => {
20
21
  const { buttonContent, children, id, ...rest } = props;
21
22
  const styles = useMultiStyleConfig('Accordion');
22
23
 
24
+ const ButtonComponent = children ? AccordionButton : Box;
25
+
23
26
  return (
24
- <ChakraAccordionItem sx={styles.item} id={id} isDisabled={!children}>
25
- <AccordionButton>
27
+ <ChakraAccordionItem sx={styles.item} id={id}>
28
+ <ButtonComponent sx={styles.button}>
26
29
  {isValidElement(buttonContent) ? buttonContent : <Text as="span">{buttonContent}</Text>}
27
- <AccordionIcon />
28
- </AccordionButton>
30
+ <AccordionIcon opacity={children ? 1 : 0.4} />
31
+ </ButtonComponent>
29
32
  {!!children && <AccordionPanel {...rest}>{children}</AccordionPanel>}
30
33
  </ChakraAccordionItem>
31
34
  );