@newtonschool/grauity 0.1.10 → 1.0.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.
- package/README.md +7 -0
- package/dist/fonts/grauity-icons.eot +0 -0
- package/dist/fonts/grauity-icons.ttf +0 -0
- package/dist/fonts/grauity-icons.woff +0 -0
- package/dist/fonts/grauity-icons.woff2 +0 -0
- package/dist/index.d.ts +280 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.cjs.map +1 -1
- package/dist/main.css +1 -1
- package/dist/main.css.map +1 -1
- package/dist/module.css +1 -1
- package/dist/module.css.map +1 -1
- package/dist/module.mjs +1 -1
- package/dist/module.mjs.map +1 -1
- package/dist/stories/elements/MultiSelectDropdown/index.stories.d.ts +11 -0
- package/dist/stories/elements/MultiSelectDropdown/index.stories.d.ts.map +1 -0
- package/dist/stories/elements/SelectDropdown/index.stories.d.ts +11 -0
- package/dist/stories/elements/SelectDropdown/index.stories.d.ts.map +1 -0
- package/dist/ui/core/icons/iconTags.d.ts +279 -28
- package/dist/ui/core/icons/iconTags.d.ts.map +1 -1
- package/dist/ui/core/icons/iconTypes.d.ts +281 -30
- package/dist/ui/core/icons/iconTypes.d.ts.map +1 -1
- package/dist/ui/elements/Button/Button.d.ts.map +1 -1
- package/dist/ui/elements/Icon/Icon.styles.d.ts.map +1 -1
- package/dist/ui/elements/MultiSelectDropdown/DropdownListItem.d.ts +4 -0
- package/dist/ui/elements/MultiSelectDropdown/DropdownListItem.d.ts.map +1 -0
- package/dist/ui/elements/MultiSelectDropdown/MultiSelectDropdown.d.ts +5 -0
- package/dist/ui/elements/MultiSelectDropdown/MultiSelectDropdown.d.ts.map +1 -0
- package/dist/ui/elements/MultiSelectDropdown/MultiSelectDropdown.styles.d.ts +14 -0
- package/dist/ui/elements/MultiSelectDropdown/MultiSelectDropdown.styles.d.ts.map +1 -0
- package/dist/ui/elements/MultiSelectDropdown/MultiSelectDropdown.test.d.ts +2 -0
- package/dist/ui/elements/MultiSelectDropdown/MultiSelectDropdown.test.d.ts.map +1 -0
- package/dist/ui/elements/MultiSelectDropdown/index.d.ts +3 -0
- package/dist/ui/elements/MultiSelectDropdown/index.d.ts.map +1 -0
- package/dist/ui/elements/MultiSelectDropdown/types.d.ts +70 -0
- package/dist/ui/elements/MultiSelectDropdown/types.d.ts.map +1 -0
- package/dist/ui/elements/SelectDropdown/SelectDropdown.d.ts +5 -0
- package/dist/ui/elements/SelectDropdown/SelectDropdown.d.ts.map +1 -0
- package/dist/ui/elements/SelectDropdown/SelectDropdown.styles.d.ts +10 -0
- package/dist/ui/elements/SelectDropdown/SelectDropdown.styles.d.ts.map +1 -0
- package/dist/ui/elements/SelectDropdown/SelectDropdown.test.d.ts +2 -0
- package/dist/ui/elements/SelectDropdown/SelectDropdown.test.d.ts.map +1 -0
- package/dist/ui/elements/SelectDropdown/index.d.ts +3 -0
- package/dist/ui/elements/SelectDropdown/index.d.ts.map +1 -0
- package/dist/ui/elements/SelectDropdown/types.d.ts +59 -0
- package/dist/ui/elements/SelectDropdown/types.d.ts.map +1 -0
- package/package.json +7 -2
- package/ui/.gitkeep +0 -0
- package/ui/README.md +0 -3
- package/ui/core/README.md +0 -4
- package/ui/core/colors/colorTypes.ts +0 -3
- package/ui/core/colors/index.ts +0 -25
- package/ui/core/icons/iconTags.ts +0 -596
- package/ui/core/icons/iconTypes.ts +0 -435
- package/ui/core/icons/index.ts +0 -3
- package/ui/core/index.ts +0 -14
- package/ui/core/miscellaneous-choices/index.ts +0 -24
- package/ui/core/miscellaneous-choices/miscellaneousTypes.ts +0 -3
- package/ui/core/sizes/index.ts +0 -29
- package/ui/core/sizes/sizeTypes.ts +0 -26
- package/ui/css/animations.scss +0 -8
- package/ui/css/fonts.scss +0 -9
- package/ui/css/index.scss +0 -3
- package/ui/css/reset.scss +0 -512
- package/ui/elements/Alert/Alert.styles.ts +0 -66
- package/ui/elements/Alert/Alert.test.tsx +0 -81
- package/ui/elements/Alert/Alert.tsx +0 -153
- package/ui/elements/Alert/constants.ts +0 -169
- package/ui/elements/Alert/index.ts +0 -6
- package/ui/elements/Alert/types.ts +0 -150
- package/ui/elements/Alert/utils.ts +0 -0
- package/ui/elements/AlertBanner/AlertBanner.styles.ts +0 -35
- package/ui/elements/AlertBanner/AlertBanner.test.tsx +0 -70
- package/ui/elements/AlertBanner/AlertBanner.tsx +0 -137
- package/ui/elements/AlertBanner/constants.ts +0 -179
- package/ui/elements/AlertBanner/index.ts +0 -6
- package/ui/elements/AlertBanner/types.ts +0 -133
- package/ui/elements/AlertBanner/utils.ts +0 -52
- package/ui/elements/Button/Button.styles.ts +0 -88
- package/ui/elements/Button/Button.test.tsx +0 -78
- package/ui/elements/Button/Button.tsx +0 -134
- package/ui/elements/Button/ButtonGroup.styles.ts +0 -7
- package/ui/elements/Button/ButtonGroup.tsx +0 -21
- package/ui/elements/Button/IconButton.test.tsx +0 -39
- package/ui/elements/Button/IconButton.tsx +0 -118
- package/ui/elements/Button/constants.ts +0 -304
- package/ui/elements/Button/index.ts +0 -8
- package/ui/elements/Button/types.ts +0 -282
- package/ui/elements/Button/utils.ts +0 -0
- package/ui/elements/Icon/Icon.styles.ts +0 -98
- package/ui/elements/Icon/Icon.tsx +0 -139
- package/ui/elements/Icon/index.ts +0 -2
- package/ui/elements/Icon/types.ts +0 -96
- package/ui/elements/Modal/ConfirmationDialog/index.test.tsx +0 -116
- package/ui/elements/Modal/ConfirmationDialog/index.tsx +0 -151
- package/ui/elements/Modal/Modal.styles.ts +0 -230
- package/ui/elements/Modal/Modal.test.tsx +0 -117
- package/ui/elements/Modal/Modal.tsx +0 -179
- package/ui/elements/Modal/MultiStepModal/index.test.tsx +0 -116
- package/ui/elements/Modal/MultiStepModal/index.tsx +0 -184
- package/ui/elements/Modal/constants.ts +0 -0
- package/ui/elements/Modal/index.ts +0 -4
- package/ui/elements/Modal/types.ts +0 -379
- package/ui/elements/Modal/utils.tsx +0 -0
- package/ui/elements/Table/Table.styles.ts +0 -178
- package/ui/elements/Table/Table.test.tsx +0 -72
- package/ui/elements/Table/Table.tsx +0 -118
- package/ui/elements/Table/constants.ts +0 -0
- package/ui/elements/Table/index.ts +0 -2
- package/ui/elements/Table/types.ts +0 -270
- package/ui/elements/Table/utils.ts +0 -0
- package/ui/elements/Typography/Typography.styles.ts +0 -29
- package/ui/elements/Typography/Typography.tsx +0 -70
- package/ui/elements/Typography/constants.ts +0 -292
- package/ui/elements/Typography/index.ts +0 -9
- package/ui/elements/Typography/types.ts +0 -116
- package/ui/elements/Typography/utils.ts +0 -11
- package/ui/fonts/Switzer-Variable.ttf +0 -0
- package/ui/fonts/grauity-icons.eot +0 -0
- package/ui/fonts/grauity-icons.ttf +0 -0
- package/ui/fonts/grauity-icons.woff +0 -0
- package/ui/fonts/grauity-icons.woff2 +0 -0
- package/ui/helpers/README.md +0 -3
- package/ui/helpers/classNameBuilders.ts +0 -48
- package/ui/helpers/index.ts +0 -7
- package/ui/index.ts +0 -48
- package/ui/init/GrauityInit.tsx +0 -85
- package/ui/init/index.ts +0 -2
- package/ui/themes/GlobalStyle.ts +0 -273
- package/ui/themes/ThemeContext.tsx +0 -140
- package/ui/themes/constants.ts +0 -8
- package/ui/themes/darkThemeConstants.ts +0 -73
- package/ui/themes/lightThemeConstants.ts +0 -73
- package/ui/themes/tokens.ts +0 -0
- package/ui/themes/types.ts +0 -77
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
StyledTable,
|
|
6
|
-
StyledTableBody,
|
|
7
|
-
StyledTableDataCell,
|
|
8
|
-
StyledTableHead,
|
|
9
|
-
StyledTableHeadingCell,
|
|
10
|
-
StyledTableRow,
|
|
11
|
-
} from './Table.styles';
|
|
12
|
-
import { TableProps } from './types';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* A table is a component that is used to display data in a tabular format.
|
|
16
|
-
* It is composed of rows and columns.
|
|
17
|
-
*/
|
|
18
|
-
const Table = ({ rows, columns, ...props }: TableProps) => (
|
|
19
|
-
<StyledTable
|
|
20
|
-
borderAround={props.borderAround}
|
|
21
|
-
borderWithin={props.borderWithin}
|
|
22
|
-
borderHorizontal={props?.borderHorizontal}
|
|
23
|
-
borderVertical={props?.borderVertical}
|
|
24
|
-
striped={props?.striped}
|
|
25
|
-
className={props?.className}
|
|
26
|
-
style={props?.style}
|
|
27
|
-
role="table"
|
|
28
|
-
>
|
|
29
|
-
<StyledTableHead
|
|
30
|
-
capitalizeHeaders={props?.capitalizeHeaders}
|
|
31
|
-
highlightHeaders={props?.highlightHeaders}
|
|
32
|
-
>
|
|
33
|
-
<StyledTableRow condensed={props.condensed}>
|
|
34
|
-
{columns?.map((column, columnIndex) => (
|
|
35
|
-
<StyledTableHeadingCell
|
|
36
|
-
key={column?.key || `table--column-${columnIndex + 1}`}
|
|
37
|
-
align={column?.align || 'center'}
|
|
38
|
-
width={column?.width || 'auto'}
|
|
39
|
-
colSpan={column?.colSpan || 1}
|
|
40
|
-
rowSpan={column?.rowSpan || 1}
|
|
41
|
-
>
|
|
42
|
-
{column.display}
|
|
43
|
-
</StyledTableHeadingCell>
|
|
44
|
-
))}
|
|
45
|
-
</StyledTableRow>
|
|
46
|
-
</StyledTableHead>
|
|
47
|
-
|
|
48
|
-
<StyledTableBody>
|
|
49
|
-
{rows?.map((row, rowIndex) => (
|
|
50
|
-
<StyledTableRow
|
|
51
|
-
key={`table--row-${rowIndex + 1}`}
|
|
52
|
-
condensed={props.condensed}
|
|
53
|
-
>
|
|
54
|
-
{columns?.map((column) => (
|
|
55
|
-
<StyledTableDataCell
|
|
56
|
-
key={`table--column-${column.key}--row-${
|
|
57
|
-
rowIndex + 1
|
|
58
|
-
}`}
|
|
59
|
-
align={
|
|
60
|
-
row[column.key]?.align ||
|
|
61
|
-
column?.align ||
|
|
62
|
-
'center'
|
|
63
|
-
}
|
|
64
|
-
colSpan={row[column.key]?.colSpan || 1}
|
|
65
|
-
rowSpan={row[column.key]?.rowSpan || 1}
|
|
66
|
-
vAlign={row[column.key]?.vAlign || 'middle'}
|
|
67
|
-
>
|
|
68
|
-
{row[column.key]?.render
|
|
69
|
-
? row[column.key].render(row[column.key])
|
|
70
|
-
: row[column.key]?.display}
|
|
71
|
-
</StyledTableDataCell>
|
|
72
|
-
))}
|
|
73
|
-
</StyledTableRow>
|
|
74
|
-
))}
|
|
75
|
-
</StyledTableBody>
|
|
76
|
-
</StyledTable>
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
Table.propTypes = {
|
|
80
|
-
rows: PropTypes.array,
|
|
81
|
-
columns: PropTypes.array,
|
|
82
|
-
condensed: PropTypes.bool,
|
|
83
|
-
striped: PropTypes.bool,
|
|
84
|
-
borderAround: PropTypes.bool,
|
|
85
|
-
borderWithin: PropTypes.bool,
|
|
86
|
-
borderHorizontal: PropTypes.bool,
|
|
87
|
-
borderVertical: PropTypes.bool,
|
|
88
|
-
className: PropTypes.string,
|
|
89
|
-
loading: PropTypes.bool,
|
|
90
|
-
style: PropTypes.object,
|
|
91
|
-
capitalizeHeaders: PropTypes.bool,
|
|
92
|
-
highlightHeaders: PropTypes.bool,
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
Table.defaultProps = {
|
|
96
|
-
rows: [],
|
|
97
|
-
columns: [],
|
|
98
|
-
condensed: true,
|
|
99
|
-
striped: false,
|
|
100
|
-
borderAround: true,
|
|
101
|
-
borderWithin: true,
|
|
102
|
-
borderHorizontal: true,
|
|
103
|
-
borderVertical: true,
|
|
104
|
-
className: '',
|
|
105
|
-
loading: false,
|
|
106
|
-
style: {},
|
|
107
|
-
capitalizeHeaders: false,
|
|
108
|
-
highlightHeaders: true,
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
Table.Table = StyledTable;
|
|
112
|
-
Table.TableBody = StyledTableBody;
|
|
113
|
-
Table.TableDataCell = StyledTableDataCell;
|
|
114
|
-
Table.TableHead = StyledTableHead;
|
|
115
|
-
Table.TableHeadingCell = StyledTableHeadingCell;
|
|
116
|
-
Table.TableRow = StyledTableRow;
|
|
117
|
-
|
|
118
|
-
export default Table;
|
|
File without changes
|
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
import { grauityIconName } from '../../core';
|
|
4
|
-
|
|
5
|
-
export interface TableColumn {
|
|
6
|
-
/**
|
|
7
|
-
* Column key
|
|
8
|
-
* */
|
|
9
|
-
key: string;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Column display name
|
|
13
|
-
* */
|
|
14
|
-
display: string;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Column width
|
|
18
|
-
* */
|
|
19
|
-
width?: string;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Column alignment, default is center
|
|
23
|
-
* */
|
|
24
|
-
align?: 'left' | 'right' | 'center';
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Row span, default is 1
|
|
28
|
-
* */
|
|
29
|
-
rowSpan?: number;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Col span, default is 1
|
|
33
|
-
* */
|
|
34
|
-
colSpan?: number;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface TableCellInterface {
|
|
38
|
-
/**
|
|
39
|
-
* Cell display, can be a string or a React element
|
|
40
|
-
* */
|
|
41
|
-
display?: ReactNode;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Custom cell render function. If provided, display will be ignored
|
|
45
|
-
* */
|
|
46
|
-
render?: (args: TableCellInterface) => ReactNode;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Row vertical alignment, default is top
|
|
50
|
-
* */
|
|
51
|
-
vAlign?: 'top' | 'bottom' | 'middle';
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Row span, default is 1
|
|
55
|
-
* */
|
|
56
|
-
rowSpan?: number;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Col span, default is 1
|
|
60
|
-
* */
|
|
61
|
-
colSpan?: number;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Row actions (rendered as buttons by default)
|
|
65
|
-
* */
|
|
66
|
-
actions?: TableCellAction[];
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Row alignment
|
|
70
|
-
* */
|
|
71
|
-
align?: 'left' | 'right' | 'center';
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface TableCellAction {
|
|
75
|
-
/**
|
|
76
|
-
* Action key
|
|
77
|
-
* */
|
|
78
|
-
key: string;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Action display, can be a string or a React element
|
|
82
|
-
* */
|
|
83
|
-
display: any;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Action icon
|
|
87
|
-
* */
|
|
88
|
-
icon?: grauityIconName;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Action type, can be a button or a link, default is button
|
|
92
|
-
* */
|
|
93
|
-
as?: 'button' | 'link';
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Action href, only used if the action type is link
|
|
97
|
-
* */
|
|
98
|
-
href?: string;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Action click handler
|
|
102
|
-
* */
|
|
103
|
-
handleClick?: (data: any) => void;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export interface TableRow {
|
|
107
|
-
/**
|
|
108
|
-
* Table data, in JS Object format, with table column keys as keys of object
|
|
109
|
-
*/
|
|
110
|
-
[columnKey: string]: TableCellInterface;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface TableColumnRow {
|
|
114
|
-
/**
|
|
115
|
-
* Row key
|
|
116
|
-
* */
|
|
117
|
-
key: string;
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* Row cells
|
|
121
|
-
* */
|
|
122
|
-
cells: TableColumn[];
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface TableProps {
|
|
126
|
-
/**
|
|
127
|
-
* Table columns, see type `TableColumn`
|
|
128
|
-
* */
|
|
129
|
-
columns?: TableColumn[];
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Table rows, see type `TableRow`
|
|
133
|
-
* */
|
|
134
|
-
rows?: TableRow[];
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Determines if the table is condensed (Reduced padding).
|
|
138
|
-
* Available choices: true, false
|
|
139
|
-
*
|
|
140
|
-
* Default: `true`
|
|
141
|
-
* */
|
|
142
|
-
condensed?: boolean;
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Are alternate rows striped (shaded).
|
|
146
|
-
* Available choices: true, false
|
|
147
|
-
*
|
|
148
|
-
* Default: `false`
|
|
149
|
-
* */
|
|
150
|
-
striped?: boolean;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Determines if the table has a border around it.
|
|
154
|
-
* Available choices: true, false
|
|
155
|
-
*
|
|
156
|
-
* Default: `true`
|
|
157
|
-
* */
|
|
158
|
-
borderAround?: boolean;
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Determines if the table has a border between rows.
|
|
162
|
-
* Available choices: true, false
|
|
163
|
-
*
|
|
164
|
-
* Has more precedence than `borderHorizontal` and `borderVertical`.
|
|
165
|
-
*
|
|
166
|
-
* Default: `true`
|
|
167
|
-
* */
|
|
168
|
-
borderWithin?: boolean;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Determines if the table has a border between columns.
|
|
172
|
-
*
|
|
173
|
-
* Default: `true`
|
|
174
|
-
* */
|
|
175
|
-
borderHorizontal?: boolean;
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Determines if the table has a border between rows.
|
|
179
|
-
*
|
|
180
|
-
* Default: `true`
|
|
181
|
-
* */
|
|
182
|
-
borderVertical?: boolean;
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Additional classes to be added to the component.
|
|
186
|
-
* */
|
|
187
|
-
className?: string;
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Show that the table is loading
|
|
191
|
-
*
|
|
192
|
-
* Default: `false`
|
|
193
|
-
* */
|
|
194
|
-
loading?: boolean;
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Additional styles to be used over the element
|
|
198
|
-
*
|
|
199
|
-
* Default: `{}`
|
|
200
|
-
* */
|
|
201
|
-
style?: React.CSSProperties;
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Capitalize the header
|
|
205
|
-
*
|
|
206
|
-
* Default: `true`
|
|
207
|
-
* */
|
|
208
|
-
capitalizeHeaders?: boolean;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Determines if table headers should be highlighted
|
|
212
|
-
*
|
|
213
|
-
* Default: `true`
|
|
214
|
-
* */
|
|
215
|
-
highlightHeaders?: boolean;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// Interface for NSTableWrapper component props
|
|
219
|
-
export interface TableComponentProps {
|
|
220
|
-
borderAround?: boolean;
|
|
221
|
-
borderWithin?: boolean;
|
|
222
|
-
borderHorizontal?: boolean;
|
|
223
|
-
borderVertical?: boolean;
|
|
224
|
-
striped?: boolean;
|
|
225
|
-
children: ReactNode;
|
|
226
|
-
role?: string;
|
|
227
|
-
className?: string;
|
|
228
|
-
style?: React.CSSProperties;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
// Interface for NSTableHead component props
|
|
232
|
-
export interface TableHeadComponentProps {
|
|
233
|
-
capitalizeHeaders?: boolean;
|
|
234
|
-
highlightHeaders?: boolean;
|
|
235
|
-
children: ReactNode;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// Interface for NSTableBody component props
|
|
239
|
-
export interface TableBodyComponentProps {
|
|
240
|
-
children: ReactNode;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
// Interface for NSTableRow component props
|
|
244
|
-
export interface TableRowComponentProps {
|
|
245
|
-
key?: string;
|
|
246
|
-
condensed?: boolean;
|
|
247
|
-
children: ReactNode;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// Interface for NSTableDataCell component props
|
|
251
|
-
export interface TableDataCellComponentProps {
|
|
252
|
-
key?: string;
|
|
253
|
-
align?: string;
|
|
254
|
-
vAlign?: string;
|
|
255
|
-
flexAlign?: string;
|
|
256
|
-
colSpan?: number;
|
|
257
|
-
rowSpan?: number;
|
|
258
|
-
children: ReactNode;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// Interface for NSTableHeadingCell component props
|
|
262
|
-
export interface TableHeadingCellComponentProps {
|
|
263
|
-
key?: string;
|
|
264
|
-
align?: string;
|
|
265
|
-
width?: string;
|
|
266
|
-
flexAlign?: string;
|
|
267
|
-
colSpan?: number;
|
|
268
|
-
rowSpan?: number;
|
|
269
|
-
children: ReactNode;
|
|
270
|
-
}
|
|
File without changes
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components';
|
|
2
|
-
|
|
3
|
-
import { StyledTypographyInterface } from './types';
|
|
4
|
-
import { getTypographyVariantStyles } from './utils';
|
|
5
|
-
|
|
6
|
-
export const StyledTypography = styled.p.attrs(
|
|
7
|
-
(props: StyledTypographyInterface) => ({
|
|
8
|
-
as: props.as || 'p',
|
|
9
|
-
})
|
|
10
|
-
)<StyledTypographyInterface>`
|
|
11
|
-
margin: 0;
|
|
12
|
-
padding: 0;
|
|
13
|
-
|
|
14
|
-
font-family: var(--font-family, 'Mona Sans');
|
|
15
|
-
color: var(--text-primary, #16191d);
|
|
16
|
-
|
|
17
|
-
${({ variant }) =>
|
|
18
|
-
css`
|
|
19
|
-
${getTypographyVariantStyles(variant)}
|
|
20
|
-
`};
|
|
21
|
-
|
|
22
|
-
${({ textAlign }) => textAlign && `text-align: ${textAlign};`}
|
|
23
|
-
${({ textTransform }) =>
|
|
24
|
-
textTransform && `text-transform: ${textTransform};`}
|
|
25
|
-
${({ fontSize }) => fontSize && `font-size: ${fontSize};`}
|
|
26
|
-
${({ color }) => color && `color: ${color};`};
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
export default StyledTypography;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
TYPOGRAPHY_AS_ENUM,
|
|
6
|
-
TYPOGRAPHY_VARIANT_AS_MAPPING,
|
|
7
|
-
TYPOGRAPHY_VARIANTS,
|
|
8
|
-
} from './constants';
|
|
9
|
-
import { TypographyProps } from './types';
|
|
10
|
-
import { StyledTypography } from './Typography.styles';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* A typography component can be used to display text in different styles.
|
|
14
|
-
*
|
|
15
|
-
* Use the prop `variant` to select the style of the text.
|
|
16
|
-
*
|
|
17
|
-
* By default, prop `as` is set to `'auto'`, and the component will automatically
|
|
18
|
-
* select the HTML tag based on the prop `variant`.
|
|
19
|
-
|
|
20
|
-
* If you want the text to be rendered as a different HTML tag, provide your desired
|
|
21
|
-
* value to prop `as`, such as `'h1'`, `'h2'`, `'p'`, etc.
|
|
22
|
-
*/
|
|
23
|
-
const Typography = ({
|
|
24
|
-
variant,
|
|
25
|
-
as,
|
|
26
|
-
color,
|
|
27
|
-
textAlign,
|
|
28
|
-
textTransform,
|
|
29
|
-
fontSize,
|
|
30
|
-
children = '',
|
|
31
|
-
}: TypographyProps) => {
|
|
32
|
-
const asType =
|
|
33
|
-
as === TYPOGRAPHY_AS_ENUM.AUTO
|
|
34
|
-
? TYPOGRAPHY_VARIANT_AS_MAPPING[variant]
|
|
35
|
-
: as;
|
|
36
|
-
return (
|
|
37
|
-
<StyledTypography
|
|
38
|
-
variant={variant}
|
|
39
|
-
as={asType}
|
|
40
|
-
color={color}
|
|
41
|
-
textAlign={textAlign}
|
|
42
|
-
textTransform={textTransform}
|
|
43
|
-
fontSize={fontSize}
|
|
44
|
-
>
|
|
45
|
-
{children}
|
|
46
|
-
</StyledTypography>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
Typography.propTypes = {
|
|
51
|
-
variant: PropTypes.oneOf(TYPOGRAPHY_VARIANTS),
|
|
52
|
-
as: PropTypes.string,
|
|
53
|
-
color: PropTypes.string,
|
|
54
|
-
textAlign: PropTypes.string,
|
|
55
|
-
textTransform: PropTypes.string,
|
|
56
|
-
fontSize: PropTypes.string,
|
|
57
|
-
children: PropTypes.any,
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
Typography.defaultProps = {
|
|
61
|
-
variant: 'paragraph-medium-body1',
|
|
62
|
-
as: 'auto',
|
|
63
|
-
color: 'var(--text-primary, #16191d)',
|
|
64
|
-
textAlign: null,
|
|
65
|
-
textTransform: null,
|
|
66
|
-
fontSize: null,
|
|
67
|
-
children: 'Enter the text here',
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export default Typography;
|