@bitrise/bitkit 10.25.0 → 10.25.3

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.25.0",
4
+ "version": "10.25.3",
5
5
  "repository": "git@github.com:bitrise-io/bitkit.git",
6
6
  "main": "src/index.ts",
7
7
  "license": "UNLICENSED",
@@ -24,7 +24,7 @@ const getItemIds = (props: AccordionProps) => {
24
24
  * Accordions display a list of high-level options that can expand/collapse to reveal more information.
25
25
  */
26
26
  const Accordion = (props: AccordionProps) => {
27
- const prefersReducedMotion = usePrefersReducedMotion();
27
+ const prefersReducedMotion = usePrefersReducedMotion({ ssr: false });
28
28
  const { children, colorScheme, onChange, ...rest } = props;
29
29
  const itemIds = getItemIds(props);
30
30
 
@@ -5,10 +5,9 @@ import {
5
5
  BreadcrumbItem,
6
6
  BreadcrumbSeparator,
7
7
  forwardRef,
8
- useBreakpointValue,
9
8
  } from '@chakra-ui/react';
10
- import { BREAKPOINTS } from '../../Foundations/Breakpoints/Breakpoints';
11
9
  import Icon, { TypeIconName } from '../Icon/Icon';
10
+ import { useResponsive } from '../../hooks';
12
11
 
13
12
  export interface BreadcrumbProps extends ChakraBreadcrumbProps {
14
13
  hasSeparatorAfterLast?: boolean;
@@ -21,7 +20,7 @@ export interface BreadcrumbProps extends ChakraBreadcrumbProps {
21
20
  */
22
21
  const Breadcrumb = forwardRef<BreadcrumbProps, 'nav'>((props, ref) => {
23
22
  const { children, hasSeparatorAfterLast, hasSeparatorBeforeFirst, separatorIconName, ...rest } = props;
24
- const isMobile = !!useBreakpointValue({ [BREAKPOINTS.MOBILE]: true, [BREAKPOINTS.DESKTOP]: false }, 'desktop');
23
+ const { isMobile } = useResponsive();
25
24
 
26
25
  const childrenCount = Children.count(children);
27
26
  const items = Children.map(children, (child, index) => {
@@ -2,10 +2,9 @@ import {
2
2
  BreadcrumbLink as ChakraBreadcrumbLink,
3
3
  BreadcrumbLinkProps as ChakraBreadcrumbLinkProps,
4
4
  forwardRef,
5
- useBreakpointValue,
6
5
  } from '@chakra-ui/react';
7
- import { BREAKPOINTS } from '../../Foundations/Breakpoints/Breakpoints';
8
6
  import Avatar from '../Avatar/Avatar';
7
+ import { useResponsive } from '../../hooks';
9
8
 
10
9
  export interface BreadcrumbLinkProps extends ChakraBreadcrumbLinkProps {
11
10
  avatarName?: string;
@@ -14,7 +13,7 @@ export interface BreadcrumbLinkProps extends ChakraBreadcrumbLinkProps {
14
13
 
15
14
  const BreadcrumbLink = forwardRef<BreadcrumbLinkProps, 'a'>((props, ref) => {
16
15
  const { avatarName, avatarUrl, children, isCurrentPage, ...rest } = props;
17
- const isMobile = !!useBreakpointValue({ [BREAKPOINTS.MOBILE]: true, [BREAKPOINTS.DESKTOP]: false }, 'desktop');
16
+ const { isMobile } = useResponsive();
18
17
 
19
18
  const properties: ChakraBreadcrumbLinkProps = {
20
19
  color: isCurrentPage ? 'neutral.40' : 'inherit',
@@ -37,8 +37,8 @@ const Dialog = ({
37
37
  variant,
38
38
  ...rest
39
39
  }: DialogProps) => {
40
- const dialogSize = useBreakpointValue({ [BREAKPOINTS.MOBILE]: 'mobile', [BREAKPOINTS.DESKTOP]: size });
41
- const prefersReducedMotion = usePrefersReducedMotion();
40
+ const dialogSize = useBreakpointValue({ [BREAKPOINTS.MOBILE]: 'mobile', [BREAKPOINTS.TABLET]: size });
41
+ const prefersReducedMotion = usePrefersReducedMotion({ ssr: false });
42
42
 
43
43
  return (
44
44
  <Modal
@@ -16,8 +16,8 @@ export interface LightBoxProps extends Omit<HTMLChakraProps<'section'>, 'scrollB
16
16
  }
17
17
 
18
18
  const LightBox = ({ children, dataTestid, size, isOpen, onClose, ...rest }: LightBoxProps) => {
19
- const prefersReducedMotion = usePrefersReducedMotion();
20
- const dialogSize = useBreakpointValue({ [BREAKPOINTS.MOBILE]: 'mobile', [BREAKPOINTS.DESKTOP]: size });
19
+ const prefersReducedMotion = usePrefersReducedMotion({ ssr: false });
20
+ const dialogSize = useBreakpointValue({ [BREAKPOINTS.MOBILE]: 'mobile', [BREAKPOINTS.TABLET]: size });
21
21
 
22
22
  return (
23
23
  <Modal isOpen={isOpen} motionPreset={prefersReducedMotion ? 'none' : 'scale'} onClose={onClose} size={dialogSize}>
@@ -2,7 +2,6 @@ import { createContext, useContext, useMemo } from 'react';
2
2
  import { Alert as ChakraAlert, AlertProps, forwardRef } from '@chakra-ui/react';
3
3
 
4
4
  import { ColorScheme } from '../../Foundations/Colors/Colors';
5
- import { BREAKPOINTS } from '../../Foundations/Breakpoints/Breakpoints';
6
5
  import CloseButton from '../CloseButton/CloseButton';
7
6
  import ColorButton, { ColorButtonProps } from '../ColorButton/ColorButton';
8
7
  import Icon from '../Icon/Icon';
@@ -62,19 +61,8 @@ const Ribbon = forwardRef<RibbonProps, 'div'>((props, ref) => {
62
61
  {...rest}
63
62
  >
64
63
  <ActionContext.Provider value={actionContext}>
65
- {onClose && (
66
- <Box
67
- display={{ [BREAKPOINTS.MOBILE]: 'none', [BREAKPOINTS.DESKTOP]: 'block' }}
68
- width={24}
69
- height={24}
70
- marginEnd="auto"
71
- />
72
- )}
73
- <Box
74
- display="flex"
75
- flexDirection={{ [BREAKPOINTS.MOBILE]: 'column', [BREAKPOINTS.DESKTOP]: 'row' }}
76
- gap={{ [BREAKPOINTS.MOBILE]: 12, [BREAKPOINTS.DESKTOP]: 16 }}
77
- >
64
+ {onClose && <Box display={['none', 'block']} width={24} height={24} marginEnd="auto" />}
65
+ <Box display="flex" flexDirection={['column', 'row']} gap={['12', '16']}>
78
66
  {children}
79
67
  {actionButton}
80
68
  </Box>
@@ -47,9 +47,9 @@ export const Responsive = () => {
47
47
  This Box is
48
48
  <List>
49
49
  <ListItem>green below 848px (53rem)</ListItem>
50
- <ListItem>purple from 848px (53rem) but below 1280px (80rem)</ListItem>
51
- <ListItem>red from 1280px (80rem) but below 1616px (101rem)</ListItem>
52
- <ListItem>gray from 1616px (101rem)</ListItem>
50
+ <ListItem>purple from 848px (53rem)</ListItem>
51
+ <ListItem>but red from 1280px (80rem)</ListItem>
52
+ <ListItem>but gray from 1616px (101rem)</ListItem>
53
53
  </List>
54
54
  </Box>
55
55
  </CardContent>
@@ -58,10 +58,10 @@ export const Responsive = () => {
58
58
  <Card boxShadow="medium" marginBottom="24" padding="24">
59
59
  <CardContent>
60
60
  <Text as="h3" size="6" marginBottom="12">
61
- With useResponsiveHook
61
+ With useResponsive hook
62
62
  </Text>
63
63
  <Text marginBottom="24">
64
- Use this hook when you want to render something conditionally. It will return an array with 1-4 booleans,
64
+ Use this hook when you want to render something conditionally. It will return an object with 1-4 booleans,
65
65
  like:
66
66
  <br />
67
67
  <Code backgroundColor="neutral.20" color="neutral.93" paddingY="4" paddingX="8">