@bitrise/bitkit 9.41.0-alpha-chakra.2 → 10.0.2

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.
@@ -1,30 +0,0 @@
1
- import { ComponentStory, ComponentMeta } from '@storybook/react';
2
- import Breadcrumb from './Breadcrumb';
3
- import BreadcrumbLink from './BreadcrumbLink';
4
-
5
- export default {
6
- title: 'Components/Breadcrumb',
7
- component: Breadcrumb,
8
- subcomponents: { BreadcrumbLink },
9
- } as ComponentMeta<typeof Breadcrumb>;
10
-
11
- const Template: ComponentStory<typeof Breadcrumb> = (props) => (
12
- <Breadcrumb {...props}>
13
- <BreadcrumbLink
14
- avatarUrl="https://bitrise-public-content-production.s3.amazonaws.com/org-icons/default_avatar-02.png"
15
- href="#"
16
- >
17
- Bitrise #Core
18
- </BreadcrumbLink>
19
- <BreadcrumbLink avatarName="Bitkit" href="#">
20
- bitkit
21
- </BreadcrumbLink>
22
- <BreadcrumbLink isCurrentPage>settings</BreadcrumbLink>
23
- </Breadcrumb>
24
- );
25
-
26
- export const WithProps = Template.bind({});
27
- WithProps.args = {
28
- hasSeparatorAfterLast: false,
29
- hasSeparatorBeforeFirst: false,
30
- };
@@ -1,25 +0,0 @@
1
- import type { SystemStyleObject } from '@chakra-ui/theme-tools';
2
-
3
- const BreadcrumbTheme: SystemStyleObject = {
4
- baseStyle: {
5
- container: {
6
- '> ol': {
7
- display: 'flex',
8
- alignItems: 'center',
9
- },
10
- },
11
- link: {
12
- display: 'flex',
13
- alignItems: 'center',
14
- gap: '8',
15
- '[aria-current]': {
16
- color: 'red',
17
- },
18
- },
19
- separator: {
20
- display: 'flex',
21
- },
22
- },
23
- };
24
-
25
- export default BreadcrumbTheme;
@@ -1,50 +0,0 @@
1
- import { Children } from 'react';
2
- import {
3
- Breadcrumb as ChakraBreadcrumb,
4
- BreadcrumbProps as ChakraBreadcrumbProps,
5
- BreadcrumbItem,
6
- BreadcrumbSeparator,
7
- forwardRef,
8
- useBreakpointValue,
9
- } from '@chakra-ui/react';
10
- import Icon, { TypeIconName } from '../Icon/Icon';
11
-
12
- export interface BreadcrumbProps extends ChakraBreadcrumbProps {
13
- hasSeparatorAfterLast?: boolean;
14
- hasSeparatorBeforeFirst?: boolean;
15
- separatorIconName?: TypeIconName;
16
- }
17
-
18
- /**
19
- * Breadcrumbs is a navigation pattern that helps users understand the hierarchy of a website.
20
- */
21
- const Breadcrumb = forwardRef<BreadcrumbProps, 'nav'>((props, ref) => {
22
- const { children, hasSeparatorAfterLast, hasSeparatorBeforeFirst, separatorIconName, ...rest } = props;
23
- const isMobile = !!useBreakpointValue({ mobile: true, desktop: false }, 'desktop');
24
-
25
- const childrenCount = Children.count(children);
26
- const items = Children.map(children, (child, index) => {
27
- return (
28
- <BreadcrumbItem>
29
- {hasSeparatorBeforeFirst && index === 0 && <BreadcrumbSeparator />}
30
- {child}
31
- {hasSeparatorAfterLast && index === childrenCount - 1 && <BreadcrumbSeparator />}
32
- </BreadcrumbItem>
33
- );
34
- });
35
-
36
- const defaultIconName = isMobile ? 'ChevronLeft' : 'ChevronRight';
37
- const properties = {
38
- separator: <Icon name={separatorIconName || defaultIconName} color="neutral.70" size="16" />,
39
- ...rest,
40
- };
41
- return (
42
- <ChakraBreadcrumb {...properties} ref={ref}>
43
- {items}
44
- </ChakraBreadcrumb>
45
- );
46
- });
47
-
48
- Breadcrumb.defaultProps = {};
49
-
50
- export default Breadcrumb;
@@ -1,33 +0,0 @@
1
- import {
2
- BreadcrumbLink as ChakraBreadcrumbLink,
3
- BreadcrumbLinkProps as ChakraBreadcrumbLinkProps,
4
- forwardRef,
5
- useBreakpointValue,
6
- } from '@chakra-ui/react';
7
- import Avatar from '../Avatar/Avatar';
8
-
9
- export interface BreadcrumbLinkProps extends ChakraBreadcrumbLinkProps {
10
- avatarName?: string;
11
- avatarUrl?: string;
12
- }
13
-
14
- const Breadcrumb = forwardRef<BreadcrumbLinkProps, 'a'>((props, ref) => {
15
- const { avatarName, avatarUrl, children, isCurrentPage, ...rest } = props;
16
- const isMobile = !!useBreakpointValue({ mobile: true, desktop: false }, 'desktop');
17
-
18
- const properties: ChakraBreadcrumbLinkProps = {
19
- color: isCurrentPage ? 'neutral.40' : 'inherit',
20
- isCurrentPage,
21
- ...rest,
22
- };
23
- return (
24
- <ChakraBreadcrumbLink {...properties} color={isCurrentPage ? 'neutral.40' : 'inherit'} ref={ref}>
25
- {!isMobile && (avatarName || avatarUrl) && (
26
- <Avatar name={avatarName || children?.toString()} src={avatarUrl} borderRadius="4" />
27
- )}
28
- {children}
29
- </ChakraBreadcrumbLink>
30
- );
31
- });
32
-
33
- export default Breadcrumb;
@@ -1,116 +0,0 @@
1
- .Appear {
2
- animation-timing-function: var(--transition-timing-function);
3
- }
4
-
5
- .Appear--fast {
6
- transition-duration: var(--transition-duration--fast);
7
- animation-duration: var(--transition-duration--fast);
8
- }
9
-
10
- .Appear--base {
11
- transition-duration: var(--transition-duration--base);
12
- animation-duration: var(--transition-duration--base);
13
- }
14
-
15
- .Appear--slow {
16
- transition-duration: var(--transition-duration--slow);
17
- animation-duration: var(--transition-duration--slow);
18
- }
19
-
20
- .Appear--Fade {
21
- opacity: 0;
22
- transition-property: opacity;
23
- }
24
-
25
- .Appear--Fade-appear-active,
26
- .Appear--Fade-appear-done,
27
- .Appear--Fade-enter-active,
28
- .Appear--Fade-enter-done,
29
- .Appear--Fade-exit {
30
- opacity: 1;
31
- }
32
-
33
- .Appear--Fade-appear,
34
- .Appear--Fade-enter,
35
- .Appear--Fade-exit-active,
36
- .Appear--Fade-exit-done {
37
- opacity: 0;
38
- }
39
-
40
- .Appear--FadeSlideDown,
41
- .Appear--FadeSlideUp {
42
- opacity: 0;
43
- transition-property: transform, opacity;
44
- }
45
-
46
- .Appear--FadeSlideUp { transform: translateY(var(--size--x4)); }
47
- .Appear--FadeSlideDown { transform: translateY(calc(var(--size--x4) * -1)); }
48
-
49
- .Appear--FadeSlideDown-appear-active,
50
- .Appear--FadeSlideDown-appear-done,
51
- .Appear--FadeSlideDown-enter-active,
52
- .Appear--FadeSlideDown-enter-done,
53
- .Appear--FadeSlideDown-exit,
54
- .Appear--FadeSlideUp-appear-active,
55
- .Appear--FadeSlideUp-appear-done,
56
- .Appear--FadeSlideUp-enter-active,
57
- .Appear--FadeSlideUp-enter-done,
58
- .Appear--FadeSlideUp-exit {
59
- transform: translateY(0);
60
- opacity: 1;
61
- }
62
-
63
- .Appear--FadeSlideDown-appear,
64
- .Appear--FadeSlideDown-enter,
65
- .Appear--FadeSlideDown-exit-active,
66
- .Appear--FadeSlideDown-exit-done {
67
- transform: translateY(calc(var(--size--x4) * -1));
68
- opacity: 0;
69
- }
70
-
71
- .Appear--FadeSlideUp-appear,
72
- .Appear--FadeSlideUp-enter,
73
- .Appear--FadeSlideUp-exit-active,
74
- .Appear--FadeSlideUp-exit-done {
75
- transform: translateY(var(--size--x4));
76
- opacity: 0;
77
- }
78
-
79
- .Appear--FadeSlideRight,
80
- .Appear--FadeSlideLeft {
81
- opacity: 0;
82
- transition-property: transform, opacity;
83
- }
84
-
85
- .Appear--FadeSlideRight { transform: translateX(calc(var(--size--x4) * -1)); }
86
- .Appear--FadeSlideLeft { transform: translateX(var(--size--x4)); }
87
-
88
- .Appear--FadeSlideRight-appear-active,
89
- .Appear--FadeSlideRight-appear-done,
90
- .Appear--FadeSlideRight-enter-active,
91
- .Appear--FadeSlideRight-enter-done,
92
- .Appear--FadeSlideRight-exit,
93
- .Appear--FadeSlideLeft-appear-active,
94
- .Appear--FadeSlideLeft-appear-done,
95
- .Appear--FadeSlideLeft-enter-active,
96
- .Appear--FadeSlideLeft-enter-done,
97
- .Appear--FadeSlideLeft-exit {
98
- transform: translateX(0);
99
- opacity: 1;
100
- }
101
-
102
- .Appear--FadeSlideRight-appear,
103
- .Appear--FadeSlideRight-enter,
104
- .Appear--FadeSlideRight-exit-active,
105
- .Appear--FadeSlideRight-exit-done {
106
- transform: translateX(calc(var(--size--x4) * -1));
107
- opacity: 0;
108
- }
109
-
110
- .Appear--FadeSlideLeft-appear,
111
- .Appear--FadeSlideLeft-enter,
112
- .Appear--FadeSlideLeft-exit-active,
113
- .Appear--FadeSlideLeft-exit-done {
114
- transform: translateX(var(--size--x4));
115
- opacity: 0;
116
- }
@@ -1,74 +0,0 @@
1
- import * as React from 'react';
2
- import { CSSTransition } from 'react-transition-group';
3
- import classnames from 'classnames';
4
- import { transitionDurationFast, transitionDurationBase, transitionDurationSlow } from '../variables';
5
- import Base, { Props as BaseProps } from '../Base/Base';
6
- import './Appear.css';
7
-
8
- const isClient = typeof window !== 'undefined';
9
-
10
- const durations = {
11
- fast: transitionDurationFast,
12
- base: transitionDurationBase,
13
- slow: transitionDurationSlow,
14
- };
15
-
16
- export type TypeAppearAnimationName = 'Fade' | 'FadeSlideUp' | 'FadeSlideRight' | 'FadeSlideDown' | 'FadeSlideLeft';
17
-
18
- export interface Props extends BaseProps {
19
- /** Type of enter and exit animation */
20
- animation: TypeAppearAnimationName;
21
- className?: string;
22
- /** Entrance delay time */
23
- delay?: number;
24
- /** Entrance duration */
25
- duration?: 'slow' | 'base' | 'fast';
26
- style?: React.CSSProperties;
27
- /** Flag if the element is visible or not */
28
- visible?: boolean;
29
- }
30
-
31
- /** Enter and exit components into view with a bit of bedazzle */
32
- const Appear: React.FunctionComponent<Props> = (props: Props) => {
33
- const { animation, className, delay, duration = 'fast', style, visible, ...rest } = props;
34
-
35
- const classes = classnames(className, 'Appear', `Appear--${animation}`, `Appear--${duration}`, {
36
- [`Appear--${animation}-appear`]: !isClient && visible,
37
- });
38
-
39
- const transition = {
40
- appear: `Appear--${animation}-appear`,
41
- appearActive: `Appear--${animation}-appear-active`,
42
- enter: `Appear--${animation}-enter`,
43
- enterActive: `Appear--${animation}-enter-active`,
44
- enterDone: `Appear--${animation}-enter-done`,
45
- exit: `Appear--${animation}-exit`,
46
- exitActive: `Appear--${animation}-exit-active`,
47
- exitDone: `Appear--${animation}-exit-done`,
48
- };
49
-
50
- const newStyle = {
51
- ...style,
52
- animationDelay: `${delay}ms`,
53
- transitionDelay: `${delay}ms`,
54
- };
55
-
56
- return (
57
- <CSSTransition
58
- appear={isClient && visible}
59
- classNames={transition}
60
- in={isClient && visible}
61
- timeout={durations[duration]}
62
- >
63
- <Base {...rest} className={classes} style={newStyle} />
64
- </CSSTransition>
65
- );
66
- };
67
-
68
- Appear.defaultProps = {
69
- delay: 0,
70
- duration: 'fast',
71
- visible: true,
72
- };
73
-
74
- export default Appear;