@bitrise/bitkit 10.1.0-alpha-chakra.1 → 10.1.0-alpha-chakra.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.
- package/package.json +1 -1
- package/src/Old/Input/InputInlineHelp.tsx +2 -2
- package/src/Old/Input/InputLabel.tsx +3 -1
- package/src/Old/Table/TableCell.tsx +3 -3
- package/src/Old/Table/TableHeaderCell.tsx +5 -6
- package/src/Old/Text/Text.css +33 -0
- package/src/Old/Text/Text.tsx +87 -0
- package/src/Old/Text/TextSizes.css +0 -0
- package/src/tsconfig.tsbuildinfo +1 -1
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.1.0-alpha-chakra.
|
|
4
|
+
"version": "10.1.0-alpha-chakra.2",
|
|
5
5
|
"repository": "git@github.com:bitrise-io/bitkit.git",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"license": "UNLICENSED",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import Text, { TextProps } from '
|
|
2
|
+
import Text, { Props as TextProps } from '../Text/Text';
|
|
3
3
|
|
|
4
4
|
export type Props = TextProps;
|
|
5
5
|
|
|
6
6
|
/** Provides specific styling for an inline input label */
|
|
7
7
|
const InputInlineHelp: React.FunctionComponent<Props> = (props: Props) => {
|
|
8
|
-
return <Text
|
|
8
|
+
return <Text margin="x2" size="2" textColor="neutral.50" {...props} />;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export default InputInlineHelp;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import Text, { TextProps } from '../../Components/Text/Text';
|
|
3
3
|
|
|
4
|
-
export type Props =
|
|
4
|
+
export type Props = {
|
|
5
|
+
htmlFor?: string | undefined;
|
|
6
|
+
} & TextProps;
|
|
5
7
|
|
|
6
8
|
/**
|
|
7
9
|
* Provides specific styling for a label that accompanies an
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
|
-
import
|
|
3
|
+
import Text, { Props as TextProps } from '../Text/Text';
|
|
4
4
|
|
|
5
|
-
export interface Props extends
|
|
5
|
+
export interface Props extends TextProps {
|
|
6
6
|
/** Forces the width of the table cell to shrink to the content. */
|
|
7
7
|
shrink?: boolean;
|
|
8
8
|
}
|
|
@@ -17,7 +17,7 @@ const TableCell: React.FunctionComponent<Props> = (props: Props) => {
|
|
|
17
17
|
'Table__cell--shrink': shrink,
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
return <
|
|
20
|
+
return <Text {...rest} Component="td" className={classes} textColor="neutral.40" />;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export default TableCell;
|
|
@@ -2,14 +2,13 @@ import * as React from 'react';
|
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import Flex from '../Flex/Flex';
|
|
4
4
|
import Icon from '../../Components/Icon/Icon';
|
|
5
|
-
import
|
|
5
|
+
import Text, { Props as TextProps } from '../Text/Text';
|
|
6
6
|
import Visibility from '../Visibility/Visibility';
|
|
7
7
|
import VisibilityContainer from '../Visibility/VisibilityContainer';
|
|
8
8
|
|
|
9
9
|
export type TypeTableSort = 'asc' | 'desc';
|
|
10
10
|
|
|
11
|
-
export interface Props extends
|
|
12
|
-
align?: 'start' | 'middle' | 'end' | 'around' | 'between';
|
|
11
|
+
export interface Props extends TextProps {
|
|
13
12
|
/**
|
|
14
13
|
* Indicates that the cell is sortable, the provided value is what is
|
|
15
14
|
* indicated as the sort direction when clicked.
|
|
@@ -26,13 +25,13 @@ export interface Props extends BoxProps {
|
|
|
26
25
|
* The header cell. Should be a direct descendant of the TableHeaderRow component.
|
|
27
26
|
*/
|
|
28
27
|
const TableHeaderCell: React.FunctionComponent<Props> = (props: Props) => {
|
|
29
|
-
const { align, children, sortable, sorted
|
|
28
|
+
const { align, children, sortable, sorted } = props;
|
|
30
29
|
const classes = classnames('Table__header-cell', {
|
|
31
30
|
'Table__header-cell--sortable': sortable,
|
|
32
31
|
});
|
|
33
32
|
|
|
34
33
|
return (
|
|
35
|
-
<
|
|
34
|
+
<Text {...props} Component="th" className={classes}>
|
|
36
35
|
<VisibilityContainer
|
|
37
36
|
alignChildrenHorizontal={align}
|
|
38
37
|
alignChildrenVertical="middle"
|
|
@@ -56,7 +55,7 @@ const TableHeaderCell: React.FunctionComponent<Props> = (props: Props) => {
|
|
|
56
55
|
</Visibility>
|
|
57
56
|
)}
|
|
58
57
|
</VisibilityContainer>
|
|
59
|
-
</
|
|
58
|
+
</Text>
|
|
60
59
|
);
|
|
61
60
|
};
|
|
62
61
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.Text--align-start { text-align: left; }
|
|
2
|
+
.Text--align-middle { text-align: center; }
|
|
3
|
+
.Text--align-end { text-align: right; }
|
|
4
|
+
|
|
5
|
+
.Text--break-all { word-break: break-all; }
|
|
6
|
+
.Text--break-none { white-space: nowrap; }
|
|
7
|
+
.Text--break-word { word-wrap: break-word; }
|
|
8
|
+
|
|
9
|
+
.Text--letter-spacing-x1 { letter-spacing: var(--letter-spacing--x1); }
|
|
10
|
+
.Text--letter-spacing-x2 { letter-spacing: var(--letter-spacing--x2); }
|
|
11
|
+
.Text--letter-spacing-x3 { letter-spacing: var(--letter-spacing--x3); }
|
|
12
|
+
.Text--letter-spacing-x4 { letter-spacing: var(--letter-spacing--x4); }
|
|
13
|
+
.Text--letter-spacing-x5 { letter-spacing: var(--letter-spacing--x5); }
|
|
14
|
+
|
|
15
|
+
.Text--weight-bold { font-weight: var(--fontWeights-bold); }
|
|
16
|
+
|
|
17
|
+
.Text--ellipsis {
|
|
18
|
+
max-width: 100%;
|
|
19
|
+
text-overflow: ellipsis;
|
|
20
|
+
white-space: nowrap;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.Text--emphasis { font-style: italic; }
|
|
25
|
+
|
|
26
|
+
.Text--titlecase { text-transform: capitalize; }
|
|
27
|
+
.Text--uppercase { text-transform: uppercase; }
|
|
28
|
+
|
|
29
|
+
.Text--monospace {
|
|
30
|
+
font-family: var(--font-family-monospace);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.Text--monospace.Text--weight-bold { font-weight: var(--font-weight-monospace--bold); }
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import Base, { Props as BaseProps } from '../Base/Base';
|
|
4
|
+
import './TextSizes.css';
|
|
5
|
+
import './Text.css';
|
|
6
|
+
|
|
7
|
+
export type TypeTextLetterSpacing = 'x1' | 'x2' | 'x3' | 'x4' | 'x5';
|
|
8
|
+
export type TypeTextSize = '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9';
|
|
9
|
+
export type TypeTextWeight = 'bold' | 'normal';
|
|
10
|
+
|
|
11
|
+
export interface Props extends BaseProps {
|
|
12
|
+
/**
|
|
13
|
+
* Sets the type of component to be rendered. Can be a
|
|
14
|
+
* string for an HTML tag or a React component.
|
|
15
|
+
* */
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
Component?: string | React.ComponentType<any>;
|
|
18
|
+
/* Horizontal alignment of the child text */
|
|
19
|
+
align?: 'start' | 'middle' | 'end';
|
|
20
|
+
/* Sets how the text should break across lines when reaching the container width */
|
|
21
|
+
breakOn?: 'all' | 'none' | 'word';
|
|
22
|
+
/** @ignore */
|
|
23
|
+
className?: string;
|
|
24
|
+
/** Clips overflowing text with an ellipsis */
|
|
25
|
+
ellipsis?: boolean;
|
|
26
|
+
/** Empahsises text with an italic style */
|
|
27
|
+
emphasis?: boolean;
|
|
28
|
+
/** Sets the text to you inline layout */
|
|
29
|
+
inline?: boolean;
|
|
30
|
+
/** Adjusts the texts letter spacing to one of the curated values */
|
|
31
|
+
letterSpacing?: TypeTextLetterSpacing;
|
|
32
|
+
/** Sets the text to use a monospaced font family */
|
|
33
|
+
monospace?: boolean;
|
|
34
|
+
/* Shortcut for setting the correct combination of props for valid typeography design */
|
|
35
|
+
size?: TypeTextSize;
|
|
36
|
+
/** Sets the text to use title casing (first letter of each word is uppercase) */
|
|
37
|
+
titlecase?: boolean;
|
|
38
|
+
/** Sets the text to use uppercasing (every letter of each word is uppercase) */
|
|
39
|
+
uppercase?: boolean;
|
|
40
|
+
/** Adjusts the text weighting */
|
|
41
|
+
weight?: TypeTextWeight;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const InlineComponentMap = (props: Props) =>
|
|
45
|
+
(props.weight === 'bold' && 'strong') || (props.emphasis && 'em') || 'span';
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Generic text component that applies a wide variety of textual
|
|
49
|
+
* styling.
|
|
50
|
+
*/
|
|
51
|
+
const Text: React.FunctionComponent<Props> = (props: Props) => {
|
|
52
|
+
const {
|
|
53
|
+
Component,
|
|
54
|
+
align,
|
|
55
|
+
breakOn,
|
|
56
|
+
className,
|
|
57
|
+
ellipsis,
|
|
58
|
+
emphasis,
|
|
59
|
+
inline,
|
|
60
|
+
letterSpacing,
|
|
61
|
+
monospace,
|
|
62
|
+
size = '3',
|
|
63
|
+
titlecase,
|
|
64
|
+
uppercase,
|
|
65
|
+
weight,
|
|
66
|
+
...rest
|
|
67
|
+
} = props;
|
|
68
|
+
|
|
69
|
+
const classes = classnames(className, 'Text', {
|
|
70
|
+
'Text--ellipsis': ellipsis,
|
|
71
|
+
'Text--emphasis': emphasis,
|
|
72
|
+
'Text--monospace': monospace,
|
|
73
|
+
'Text--titlecase': titlecase,
|
|
74
|
+
'Text--uppercase': uppercase,
|
|
75
|
+
[`Text--align-${align}`]: align,
|
|
76
|
+
[`Text--break-${breakOn}`]: breakOn,
|
|
77
|
+
[`Text--letter-spacing-${letterSpacing}`]: letterSpacing,
|
|
78
|
+
[`Text--size-${size}`]: size,
|
|
79
|
+
'Text--weight-bold': weight === 'bold',
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const component = inline ? InlineComponentMap(props) : Component;
|
|
83
|
+
|
|
84
|
+
return <Base {...rest} Component={component} className={classes} />;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export default Text;
|
|
File without changes
|