@bitrise/bitkit 10.20.0 → 10.22.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.
Files changed (33) hide show
  1. package/package.json +1 -1
  2. package/src/Components/Dropdown/Dropdown.stories.tsx +2 -2
  3. package/src/Components/Dropdown/Dropdown.test.tsx +7 -0
  4. package/src/Components/Dropdown/Dropdown.tsx +16 -20
  5. package/src/Components/Dropdown/hooks/useFloatingDropdown.ts +28 -6
  6. package/src/Components/Table/Table.stories.tsx +8 -1
  7. package/src/Components/Table/Table.theme.ts +1 -3
  8. package/src/Components/Table/Tr.tsx +27 -8
  9. package/src/Old/DatePicker/DatePickerGrid.tsx +5 -3
  10. package/src/Old/DatePicker/DatePickerMonth.tsx +2 -2
  11. package/src/Old/Placement/Placement.tsx +3 -8
  12. package/src/Old/Progress/ProgressBitbot.tsx +3 -3
  13. package/src/old.ts +0 -31
  14. package/src/tsconfig.tsbuildinfo +1 -1
  15. package/src/Old/Grid/Grid.css +0 -40
  16. package/src/Old/Grid/Grid.test.tsx +0 -49
  17. package/src/Old/Grid/Grid.tsx +0 -76
  18. package/src/Old/Grid/__snapshots__/Grid.test.tsx.snap +0 -127
  19. package/src/Old/Logo/Logo.css +0 -3
  20. package/src/Old/Logo/Logo.tsx +0 -50
  21. package/src/Old/Modal/ModalContext.ts +0 -6
  22. package/src/Old/Status/Status500.tsx +0 -40
  23. package/src/Old/Table/Table.css +0 -77
  24. package/src/Old/Table/Table.tsx +0 -28
  25. package/src/Old/Table/TableBody.tsx +0 -14
  26. package/src/Old/Table/TableCell.tsx +0 -23
  27. package/src/Old/Table/TableHeader.tsx +0 -14
  28. package/src/Old/Table/TableHeaderCell.tsx +0 -62
  29. package/src/Old/Table/TableHeaderRow.tsx +0 -14
  30. package/src/Old/Table/TableRow.tsx +0 -23
  31. package/src/Old/Text/Text.css +0 -33
  32. package/src/Old/Text/Text.tsx +0 -87
  33. package/src/Old/Text/TextSizes.css +0 -0
@@ -1,40 +0,0 @@
1
- .Grid {
2
- display: grid;
3
- }
4
-
5
- .Grid--gap-x1 { grid-gap: var(--size--x1); }
6
- .Grid--gap-x2 { grid-gap: var(--size--x2); }
7
- .Grid--gap-x3 { grid-gap: var(--size--x3); }
8
- .Grid--gap-x4 { grid-gap: var(--size--x4); }
9
- .Grid--gap-x5 { grid-gap: var(--size--x5); }
10
- .Grid--gap-x6 { grid-gap: var(--size--x6); }
11
- .Grid--gap-x8 { grid-gap: var(--size--x8); }
12
- .Grid--gap-x10 { grid-gap: var(--size--x10); }
13
- .Grid--gap-x12 { grid-gap: var(--size--x12); }
14
- .Grid--gap-x16 { grid-gap: var(--size--x16); }
15
-
16
- .Grid--gap-horizontal-x1 { grid-column-gap: var(--size--x1); }
17
- .Grid--gap-horizontal-x2 { grid-column-gap: var(--size--x2); }
18
- .Grid--gap-horizontal-x3 { grid-column-gap: var(--size--x3); }
19
- .Grid--gap-horizontal-x4 { grid-column-gap: var(--size--x4); }
20
- .Grid--gap-horizontal-x5 { grid-column-gap: var(--size--x5); }
21
- .Grid--gap-horizontal-x6 { grid-column-gap: var(--size--x6); }
22
- .Grid--gap-horizontal-x8 { grid-column-gap: var(--size--x8); }
23
- .Grid--gap-horizontal-x10 { grid-column-gap: var(--size--x10); }
24
- .Grid--gap-horizontal-x12 { grid-column-gap: var(--size--x12); }
25
- .Grid--gap-horizontal-x16 { grid-column-gap: var(--size--x16); }
26
-
27
- .Grid--gap-vertical-x1 { grid-row-gap: var(--size--x1); }
28
- .Grid--gap-vertical-x2 { grid-row-gap: var(--size--x2); }
29
- .Grid--gap-vertical-x3 { grid-row-gap: var(--size--x3); }
30
- .Grid--gap-vertical-x4 { grid-row-gap: var(--size--x4); }
31
- .Grid--gap-vertical-x5 { grid-row-gap: var(--size--x5); }
32
- .Grid--gap-vertical-x6 { grid-row-gap: var(--size--x6); }
33
- .Grid--gap-vertical-x8 { grid-row-gap: var(--size--x8); }
34
- .Grid--gap-vertical-x10 { grid-row-gap: var(--size--x10); }
35
- .Grid--gap-vertical-x12 { grid-row-gap: var(--size--x12); }
36
- .Grid--gap-vertical-x16 { grid-row-gap: var(--size--x16); }
37
-
38
- .Grid--align-start { justify-content: start; }
39
- .Grid--align-middle { justify-content: center; }
40
- .Grid--align-end { justify-content: end; }
@@ -1,49 +0,0 @@
1
- import { shallow } from 'enzyme';
2
- import { shallowToJson } from 'enzyme-to-json';
3
- import Grid from './Grid';
4
-
5
- describe('Grid', () => {
6
- test('alignChildren', () => {
7
- expect(shallowToJson(shallow(<Grid alignChildren="start">*</Grid>))).toMatchSnapshot();
8
- });
9
-
10
- test('gap', () => {
11
- expect(shallowToJson(shallow(<Grid gap="x1">*</Grid>))).toMatchSnapshot();
12
- });
13
-
14
- test('gapHorizontal', () => {
15
- expect(shallowToJson(shallow(<Grid gapHorizontal="x1">*</Grid>))).toMatchSnapshot();
16
- });
17
-
18
- test('gapVertical', () => {
19
- expect(shallowToJson(shallow(<Grid gapVertical="x1">*</Grid>))).toMatchSnapshot();
20
- });
21
-
22
- test('repeat', () => {
23
- expect(shallowToJson(shallow(<Grid repeat="3">*</Grid>))).toMatchSnapshot();
24
- });
25
-
26
- test('repeatWidth', () => {
27
- expect(shallowToJson(shallow(<Grid repeatWidth="1fr">*</Grid>))).toMatchSnapshot();
28
- });
29
-
30
- test('repeatWidthMin', () => {
31
- expect(shallowToJson(shallow(<Grid repeatWidthMin="4rem">*</Grid>))).toMatchSnapshot();
32
- });
33
-
34
- test('repeatWidthMax', () => {
35
- expect(
36
- shallowToJson(
37
- shallow(
38
- <Grid repeatWidthMax="2fr" repeatWidthMin="4rem">
39
- *
40
- </Grid>,
41
- ),
42
- ),
43
- ).toMatchSnapshot();
44
- });
45
-
46
- test('rowSize', () => {
47
- expect(shallowToJson(shallow(<Grid rowSize="1fr">*</Grid>))).toMatchSnapshot();
48
- });
49
- });
@@ -1,76 +0,0 @@
1
- import * as React from 'react';
2
- import classnames from 'classnames';
3
- import { TypeSizes } from '../Base/Base';
4
- import Flex, { Props as FlexProps } from '../Flex/Flex';
5
- import './Grid.css';
6
-
7
- export interface Props extends FlexProps {
8
- /** Controls the horizontal alignment of the items */
9
- alignChildren?: 'start' | 'middle' | 'end';
10
- /** @Ignore */
11
- className?: string;
12
- /** Sets the distances between items to a multiple value. E.g. 'x1'. */
13
- gap?: TypeSizes;
14
- /** Sets the horizontal distances between items to a multiple value. E.g. 'x1'. */
15
- gapHorizontal?: TypeSizes;
16
- /** Sets the vertical distances between items to a multiple value. E.g. 'x1'. */
17
- gapVertical?: TypeSizes;
18
- /** Sets the primary repeat value */
19
- repeat?: number | string | 'auto-fill' | 'auto-fit';
20
- /** Sets the explicit width the repeated items will be resized */
21
- repeatWidth?: string | 'max-content' | 'min-content';
22
- /** Sets the maximum width the repeated items can be resized to */
23
- repeatWidthMax?: string;
24
- /** Sets the minimum width the repeated items can be resized to */
25
- repeatWidthMin?: string;
26
- /** Sets the implicit row size */
27
- rowSize?: string | 'max-content' | 'min-content';
28
- /** @Ignore */
29
- style?: React.CSSProperties | { [key: string]: number | string };
30
- }
31
-
32
- const Grid: React.FunctionComponent<Props> = (props: Props) => {
33
- const {
34
- alignChildren,
35
- className,
36
- gap,
37
- gapHorizontal,
38
- gapVertical,
39
- repeat,
40
- repeatWidth,
41
- repeatWidthMax,
42
- repeatWidthMin,
43
- rowSize,
44
- ...rest
45
- } = props;
46
-
47
- const classes = classnames(
48
- 'Grid',
49
- {
50
- [`Grid--align-${alignChildren}`]: alignChildren,
51
- [`Grid--gap-${gap}`]: gap,
52
- [`Grid--gap-horizontal-${gapHorizontal}`]: gapHorizontal,
53
- [`Grid--gap-vertical-${gapVertical}`]: gapVertical,
54
- },
55
- className,
56
- );
57
-
58
- const style = {
59
- ...rest.style,
60
- gridTemplateColumns: `repeat(${repeat}, ${
61
- repeatWidthMin ? `minmax(${repeatWidthMin}, ${repeatWidthMax})` : repeatWidth
62
- })`,
63
- gridAutoRows: rowSize,
64
- };
65
-
66
- return <Flex {...rest} className={classes} style={style} />;
67
- };
68
-
69
- Grid.defaultProps = {
70
- repeat: 'auto-fit',
71
- repeatWidth: 'max-content',
72
- repeatWidthMax: '1fr',
73
- rowSize: 'max-content',
74
- };
75
-
76
- export default Grid;
@@ -1,127 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Grid alignChildren 1`] = `
4
- <Flex
5
- className="Grid Grid--align-start"
6
- style={
7
- Object {
8
- "gridAutoRows": "max-content",
9
- "gridTemplateColumns": "repeat(auto-fit, max-content)",
10
- }
11
- }
12
- >
13
- *
14
- </Flex>
15
- `;
16
-
17
- exports[`Grid gap 1`] = `
18
- <Flex
19
- className="Grid Grid--gap-x1"
20
- style={
21
- Object {
22
- "gridAutoRows": "max-content",
23
- "gridTemplateColumns": "repeat(auto-fit, max-content)",
24
- }
25
- }
26
- >
27
- *
28
- </Flex>
29
- `;
30
-
31
- exports[`Grid gapHorizontal 1`] = `
32
- <Flex
33
- className="Grid Grid--gap-horizontal-x1"
34
- style={
35
- Object {
36
- "gridAutoRows": "max-content",
37
- "gridTemplateColumns": "repeat(auto-fit, max-content)",
38
- }
39
- }
40
- >
41
- *
42
- </Flex>
43
- `;
44
-
45
- exports[`Grid gapVertical 1`] = `
46
- <Flex
47
- className="Grid Grid--gap-vertical-x1"
48
- style={
49
- Object {
50
- "gridAutoRows": "max-content",
51
- "gridTemplateColumns": "repeat(auto-fit, max-content)",
52
- }
53
- }
54
- >
55
- *
56
- </Flex>
57
- `;
58
-
59
- exports[`Grid repeat 1`] = `
60
- <Flex
61
- className="Grid"
62
- style={
63
- Object {
64
- "gridAutoRows": "max-content",
65
- "gridTemplateColumns": "repeat(3, max-content)",
66
- }
67
- }
68
- >
69
- *
70
- </Flex>
71
- `;
72
-
73
- exports[`Grid repeatWidth 1`] = `
74
- <Flex
75
- className="Grid"
76
- style={
77
- Object {
78
- "gridAutoRows": "max-content",
79
- "gridTemplateColumns": "repeat(auto-fit, 1fr)",
80
- }
81
- }
82
- >
83
- *
84
- </Flex>
85
- `;
86
-
87
- exports[`Grid repeatWidthMax 1`] = `
88
- <Flex
89
- className="Grid"
90
- style={
91
- Object {
92
- "gridAutoRows": "max-content",
93
- "gridTemplateColumns": "repeat(auto-fit, minmax(4rem, 2fr))",
94
- }
95
- }
96
- >
97
- *
98
- </Flex>
99
- `;
100
-
101
- exports[`Grid repeatWidthMin 1`] = `
102
- <Flex
103
- className="Grid"
104
- style={
105
- Object {
106
- "gridAutoRows": "max-content",
107
- "gridTemplateColumns": "repeat(auto-fit, minmax(4rem, 1fr))",
108
- }
109
- }
110
- >
111
- *
112
- </Flex>
113
- `;
114
-
115
- exports[`Grid rowSize 1`] = `
116
- <Flex
117
- className="Grid"
118
- style={
119
- Object {
120
- "gridAutoRows": "1fr",
121
- "gridTemplateColumns": "repeat(auto-fit, max-content)",
122
- }
123
- }
124
- >
125
- *
126
- </Flex>
127
- `;
@@ -1,3 +0,0 @@
1
- .Logo {
2
- display: block;
3
- }
@@ -1,50 +0,0 @@
1
- import * as React from 'react';
2
- import Base, { Props as BaseProps } from '../Base/Base';
3
- import './Logo.css';
4
-
5
- export interface Props extends BaseProps {
6
- /**
7
- * Sets the height of the logo. Note to keep correct proportions
8
- * correct, if height is supplied the width should be omitted and
9
- * it will be derived from the height.
10
- * */
11
- height?: number;
12
- /**
13
- * Sets the width of the logo. Note to keep correct proportions
14
- * correct, if width is supplied the height should be omitted and
15
- * it will be derived from the width.
16
- * */
17
- width?: number;
18
- }
19
-
20
- const viewBoxHeight = 29;
21
- const viewBoxWidth = 35;
22
- const viewBox = `0 0 ${viewBoxWidth} ${viewBoxHeight}`;
23
- const viewBoxScale = viewBoxWidth / viewBoxHeight;
24
-
25
- /**
26
- * Bitrise Logo
27
- */
28
- const Logo: React.FunctionComponent<Props> = (props: Props) => {
29
- const { height, width } = props;
30
- const scaledHeight = width ? width / viewBoxScale : height;
31
- const scaledWidth = height ? height * viewBoxScale : width;
32
-
33
- return (
34
- <Base
35
- Component="svg"
36
- className="Logo"
37
- height={scaledHeight}
38
- viewBox={viewBox}
39
- width={scaledWidth}
40
- xmlns="http://www.w3.org/2000/svg"
41
- >
42
- <g fill="currentColor" fillRule="evenodd">
43
- <path d="M17.103 22.771a3.804 3.804 0 0 1-3.803-3.804h7.607c0 2.101-1.703 3.804-3.804 3.804zM8.602 14.27a2.349 2.349 0 0 0-2.349 2.349h4.697a2.349 2.349 0 0 0-2.348-2.349M25.622 14.27a2.349 2.349 0 0 0-2.349 2.35h4.697a2.349 2.349 0 0 0-2.348-2.35M17.103 3.08a1.455 1.455 0 1 0 0-2.91 1.455 1.455 0 0 0 0 2.91" />
44
- <path d="M31.19 24.734a2.615 2.615 0 0 1-1.84.876c-2.937.137-7.444.301-12.247.301-4.802 0-9.31-.164-12.245-.3a2.615 2.615 0 0 1-1.842-.877 2.607 2.607 0 0 1-.661-1.922c.154-2.349.364-4.428.622-6.18.383-2.6.959-5.24 1.374-6.997a2.611 2.611 0 0 1 2.393-2.017c2.129-.133 5.654-.29 10.36-.29 4.704 0 8.23.157 10.36.29a2.611 2.611 0 0 1 2.392 2.017c.416 1.757.991 4.398 1.374 6.997.258 1.752.467 3.831.622 6.18a2.608 2.608 0 0 1-.662 1.922m2.363-8.444c-.394-2.682-.985-5.393-1.412-7.196a4.947 4.947 0 0 0-4.532-3.82c-2.162-.135-5.74-.296-10.506-.296-4.765 0-8.343.161-10.505.296a4.947 4.947 0 0 0-4.532 3.82c-.427 1.802-1.018 4.513-1.413 7.196-.267 1.814-.483 3.956-.642 6.367A4.937 4.937 0 0 0 1.265 26.3a4.945 4.945 0 0 0 3.483 1.657c2.96.139 7.508.304 12.355.304 4.848 0 9.395-.165 12.356-.304a4.945 4.945 0 0 0 3.483-1.657 4.937 4.937 0 0 0 1.254-3.642c-.16-2.41-.375-4.553-.643-6.367" />
45
- </g>
46
- </Base>
47
- );
48
- };
49
-
50
- export default Logo;
@@ -1,6 +0,0 @@
1
- import { createContext } from 'react';
2
-
3
- export const ModalContext = createContext<{
4
- modalElement: HTMLElement | null;
5
- onClose?: () => void;
6
- }>({ modalElement: null });
@@ -1,40 +0,0 @@
1
- import * as React from 'react';
2
- import { useMediaQuery } from '../hooks';
3
- import Flex, { Props as FlexProps } from '../Flex/Flex';
4
- import Image from '../../Components/Image/Image';
5
- import Text from '../../Components/Text/Text';
6
-
7
- export type Props = FlexProps;
8
-
9
- /**
10
- * A composite component used as a placeholder page for when there
11
- * is a 500 server error.
12
- */
13
- const Status500: React.FunctionComponent<Props> = (props: Props) => {
14
- const match = useMediaQuery(['65rem']);
15
-
16
- return (
17
- <Flex {...props} alignChildrenHorizontal="middle" direction="vertical" paddingHorizontal="x6">
18
- <Flex
19
- alignChildren="middle"
20
- direction={match('65rem') ? 'horizontal' : 'vertical'}
21
- gap={match('65rem') ? 'x8' : 'x4'}
22
- >
23
- <Text align="center" size="7" fontWeight="bold">
24
- 500
25
- </Text>
26
- <Text align="center" size="2" textTransform="uppercase" fontWeight="bold">
27
- Something went wrong
28
- </Text>
29
- </Flex>
30
-
31
- <Text align="center" letterSpacing="8" marginY="20" size="4">
32
- Everything is under control, we will be back soon. Until then keep refreshing your browser.
33
- </Text>
34
-
35
- <Image marginY="64" src="https://bitrise-bitkit.s3.us-east-2.amazonaws.com/assets/Status500.svg" />
36
- </Flex>
37
- );
38
- };
39
-
40
- export default Status500;
@@ -1,77 +0,0 @@
1
- /* stylelint-disable no-descending-specificity */
2
-
3
- .Table {
4
- width: 100%;
5
- border-spacing: 0;
6
- text-align: left;
7
- }
8
-
9
- .Table__header-cell {
10
- font-weight: var(--fontWeights-bold);
11
- vertical-align: bottom;
12
- }
13
-
14
- .Table__header-cell--sortable:hover {
15
- color: var(--color-grape--3);
16
- cursor: pointer;
17
- }
18
-
19
- .Table__row:not(:last-child) .Table__cell {
20
- border-bottom: 0.0625rem solid var(--color-gray--2);
21
- }
22
-
23
- .Table__cell {
24
- background-color: var(--color-white);
25
- transition-property: background-color, color;
26
- transition-duration: var(--transition-duration--fast);
27
- transition-timing-function: var(--transition-timing-function);
28
- }
29
-
30
- .Table__cell--shrink {
31
- width: 0.0625rem;
32
- white-space: nowrap;
33
- }
34
-
35
- .Table__row--clickable:hover .Table__cell {
36
- color: var(--color-grape--3);
37
- cursor: pointer;
38
- }
39
-
40
- .Table--type-card .Table__body {
41
- border-radius: var(--size--x2);
42
- box-shadow: var(--shadow-elevation--x2);
43
- }
44
-
45
- .Table--type-card .Table__row:first-child .Table__cell:first-child {
46
- border-top-left-radius: var(--size--x2);
47
- }
48
-
49
- .Table--type-card .Table__row:first-child .Table__cell:last-child {
50
- border-top-right-radius: var(--size--x2);
51
- }
52
-
53
- .Table--type-card .Table__row:last-child .Table__cell:first-child {
54
- border-bottom-left-radius: var(--size--x2);
55
- }
56
-
57
- .Table--type-card .Table__row:last-child .Table__cell:last-child {
58
- border-bottom-right-radius: var(--size--x2);
59
- }
60
-
61
- .Table--type-card .Table__header-cell,
62
- .Table--type-card .Table__cell {
63
- padding: var(--size--x4);
64
- }
65
-
66
- .Table--type-flat .Table__header-cell,
67
- .Table--type-flat .Table__cell {
68
- padding: var(--size--x3) var(--size--x4);
69
- }
70
-
71
- .Table--type-flat .Table__header-row .Table__header-cell {
72
- border-bottom: 0.0625rem solid var(--color-gray--2);
73
- }
74
-
75
- .Table--type-flat .Table__header-row:last-child .Table__header-cell {
76
- border-bottom-width: 0.125rem;
77
- }
@@ -1,28 +0,0 @@
1
- import * as React from 'react';
2
- import classnames from 'classnames';
3
- import Base, { Props as BaseProps } from '../Base/Base';
4
- import './Table.css';
5
-
6
- export interface Props extends BaseProps {
7
- /**
8
- * Controls the style of table which are applicable
9
- * in different contexts within the UI.
10
- */
11
- type?: 'card' | 'flat';
12
- }
13
-
14
- /**
15
- * A styled, standard data table component.
16
- */
17
- const Table: React.FunctionComponent<Props> = (props: Props) => {
18
- const { type, ...rest } = props;
19
- const classes = classnames('Table', `Table--type-${type}`);
20
-
21
- return <Base {...rest} Component="table" className={classes} />;
22
- };
23
-
24
- Table.defaultProps = {
25
- type: 'card',
26
- };
27
-
28
- export default Table;
@@ -1,14 +0,0 @@
1
- import * as React from 'react';
2
- import Base, { Props as BaseProps } from '../Base/Base';
3
-
4
- export type Props = BaseProps;
5
-
6
- /**
7
- * The body of the table that holds the TableRow components. Should be
8
- * a direct descendant of the Table component.
9
- */
10
- const TableBody: React.FunctionComponent<Props> = (props: Props) => {
11
- return <Base {...props} Component="tbody" className="Table__body" />;
12
- };
13
-
14
- export default TableBody;
@@ -1,23 +0,0 @@
1
- import * as React from 'react';
2
- import classnames from 'classnames';
3
- import Text, { Props as TextProps } from '../Text/Text';
4
-
5
- export interface Props extends TextProps {
6
- /** Forces the width of the table cell to shrink to the content. */
7
- shrink?: boolean;
8
- }
9
-
10
- /**
11
- * The table cell, that holds the data to be displayed. Should be a direct
12
- * descendant of the TableRow component.
13
- */
14
- const TableCell: React.FunctionComponent<Props> = (props: Props) => {
15
- const { shrink, ...rest } = props;
16
- const classes = classnames('Table__cell', {
17
- 'Table__cell--shrink': shrink,
18
- });
19
-
20
- return <Text {...rest} Component="td" className={classes} textColor="neutral.40" />;
21
- };
22
-
23
- export default TableCell;
@@ -1,14 +0,0 @@
1
- import * as React from 'react';
2
- import Base, { Props as BaseProps } from '../Base/Base';
3
-
4
- export type Props = BaseProps;
5
-
6
- /**
7
- * The header of the table that holds the TableHeaderRow components. Should be
8
- * a direct descendant of the Table component.
9
- */
10
- const TableHeader: React.FunctionComponent<Props> = (props: Props) => {
11
- return <Base {...props} Component="thead" className="Table__header" />;
12
- };
13
-
14
- export default TableHeader;
@@ -1,62 +0,0 @@
1
- import * as React from 'react';
2
- import classnames from 'classnames';
3
- import Flex from '../Flex/Flex';
4
- import Icon from '../../Components/Icon/Icon';
5
- import Text, { Props as TextProps } from '../Text/Text';
6
- import Visibility from '../Visibility/Visibility';
7
- import VisibilityContainer from '../Visibility/VisibilityContainer';
8
-
9
- export type TypeTableSort = 'asc' | 'desc';
10
-
11
- export interface Props extends TextProps {
12
- /**
13
- * Indicates that the cell is sortable, the provided value is what is
14
- * indicated as the sort direction when clicked.
15
- */
16
- sortable?: TypeTableSort;
17
- /**
18
- * When provided, it indicates that this table is currently being
19
- * sorted in the given direction.
20
- */
21
- sorted?: TypeTableSort;
22
- }
23
-
24
- /**
25
- * The header cell. Should be a direct descendant of the TableHeaderRow component.
26
- */
27
- const TableHeaderCell: React.FunctionComponent<Props> = (props: Props) => {
28
- const { align, children, sortable, sorted } = props;
29
- const classes = classnames('Table__header-cell', {
30
- 'Table__header-cell--sortable': sortable,
31
- });
32
-
33
- return (
34
- <Text {...props} Component="th" className={classes}>
35
- <VisibilityContainer
36
- alignChildrenHorizontal={align}
37
- alignChildrenVertical="middle"
38
- direction="horizontal"
39
- enabled={!!sortable}
40
- gap="x2"
41
- >
42
- <Flex>{children}</Flex>
43
-
44
- {sortable && (
45
- <Visibility visible={sorted ? true : undefined}>
46
- <Icon
47
- name={
48
- (sorted === 'asc' && 'ArrowUp') ||
49
- (sorted === 'desc' && 'ArrowDown') ||
50
- (sortable === 'asc' && 'ArrowUp') ||
51
- (sortable === 'desc' && 'ArrowDown') ||
52
- 'ArrowDown'
53
- }
54
- />
55
- </Visibility>
56
- )}
57
- </VisibilityContainer>
58
- </Text>
59
- );
60
- };
61
-
62
- export default TableHeaderCell;
@@ -1,14 +0,0 @@
1
- import * as React from 'react';
2
- import Base, { Props as BaseProps } from '../Base/Base';
3
-
4
- export type Props = BaseProps;
5
-
6
- /**
7
- * The header row that holds the TableHeaderCell components. Should be
8
- * a direct descendant of the TableHeader component.
9
- */
10
- const TableHeaderRow: React.FunctionComponent<Props> = (props: Props) => {
11
- return <Base {...props} Component="tr" className="Table__header-row" />;
12
- };
13
-
14
- export default TableHeaderRow;
@@ -1,23 +0,0 @@
1
- import * as React from 'react';
2
- import classnames from 'classnames';
3
- import Base, { Props as BaseProps } from '../Base/Base';
4
-
5
- export interface Props extends BaseProps {
6
- /** @Ignore */
7
- onClick?: () => void;
8
- }
9
-
10
- /**
11
- * The row that holds the TableCell components. Should be
12
- * a direct descendant of the TableBody component.
13
- */
14
- const TableRow: React.FunctionComponent<Props> = (props: Props) => {
15
- const { onClick, ...rest } = props;
16
- const classes = classnames('Table__row', {
17
- 'Table__row--clickable': onClick,
18
- });
19
-
20
- return <Base {...rest} Component="tr" className={classes} onClick={onClick} />;
21
- };
22
-
23
- export default TableRow;