@newtonschool/grauity 0.1.11 → 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.
Files changed (100) hide show
  1. package/package.json +1 -2
  2. package/ui/.gitkeep +0 -0
  3. package/ui/README.md +0 -3
  4. package/ui/core/README.md +0 -4
  5. package/ui/core/colors/colorTypes.ts +0 -3
  6. package/ui/core/colors/index.ts +0 -25
  7. package/ui/core/icons/iconTags.ts +0 -1600
  8. package/ui/core/icons/iconTypes.ts +0 -1188
  9. package/ui/core/icons/index.ts +0 -3
  10. package/ui/core/index.ts +0 -14
  11. package/ui/core/miscellaneous-choices/index.ts +0 -24
  12. package/ui/core/miscellaneous-choices/miscellaneousTypes.ts +0 -3
  13. package/ui/core/sizes/index.ts +0 -29
  14. package/ui/core/sizes/sizeTypes.ts +0 -26
  15. package/ui/css/animations.scss +0 -8
  16. package/ui/css/fonts.scss +0 -9
  17. package/ui/css/index.scss +0 -3
  18. package/ui/css/reset.scss +0 -512
  19. package/ui/elements/Alert/Alert.styles.ts +0 -66
  20. package/ui/elements/Alert/Alert.test.tsx +0 -81
  21. package/ui/elements/Alert/Alert.tsx +0 -153
  22. package/ui/elements/Alert/constants.ts +0 -169
  23. package/ui/elements/Alert/index.ts +0 -6
  24. package/ui/elements/Alert/types.ts +0 -150
  25. package/ui/elements/Alert/utils.ts +0 -0
  26. package/ui/elements/AlertBanner/AlertBanner.styles.ts +0 -35
  27. package/ui/elements/AlertBanner/AlertBanner.test.tsx +0 -70
  28. package/ui/elements/AlertBanner/AlertBanner.tsx +0 -137
  29. package/ui/elements/AlertBanner/constants.ts +0 -179
  30. package/ui/elements/AlertBanner/index.ts +0 -6
  31. package/ui/elements/AlertBanner/types.ts +0 -133
  32. package/ui/elements/AlertBanner/utils.ts +0 -52
  33. package/ui/elements/Button/Button.styles.ts +0 -88
  34. package/ui/elements/Button/Button.test.tsx +0 -78
  35. package/ui/elements/Button/Button.tsx +0 -134
  36. package/ui/elements/Button/ButtonGroup.styles.ts +0 -7
  37. package/ui/elements/Button/ButtonGroup.tsx +0 -21
  38. package/ui/elements/Button/IconButton.test.tsx +0 -39
  39. package/ui/elements/Button/IconButton.tsx +0 -118
  40. package/ui/elements/Button/constants.ts +0 -304
  41. package/ui/elements/Button/index.ts +0 -8
  42. package/ui/elements/Button/types.ts +0 -282
  43. package/ui/elements/Button/utils.ts +0 -0
  44. package/ui/elements/Icon/Icon.styles.ts +0 -99
  45. package/ui/elements/Icon/Icon.tsx +0 -139
  46. package/ui/elements/Icon/index.ts +0 -2
  47. package/ui/elements/Icon/types.ts +0 -96
  48. package/ui/elements/Modal/ConfirmationDialog/index.test.tsx +0 -116
  49. package/ui/elements/Modal/ConfirmationDialog/index.tsx +0 -151
  50. package/ui/elements/Modal/Modal.styles.ts +0 -230
  51. package/ui/elements/Modal/Modal.test.tsx +0 -117
  52. package/ui/elements/Modal/Modal.tsx +0 -179
  53. package/ui/elements/Modal/MultiStepModal/index.test.tsx +0 -116
  54. package/ui/elements/Modal/MultiStepModal/index.tsx +0 -184
  55. package/ui/elements/Modal/constants.ts +0 -0
  56. package/ui/elements/Modal/index.ts +0 -4
  57. package/ui/elements/Modal/types.ts +0 -379
  58. package/ui/elements/Modal/utils.tsx +0 -0
  59. package/ui/elements/MultiSelectDropdown/DropdownListItem.tsx +0 -33
  60. package/ui/elements/MultiSelectDropdown/MultiSelectDropdown.styles.ts +0 -127
  61. package/ui/elements/MultiSelectDropdown/MultiSelectDropdown.test.tsx +0 -224
  62. package/ui/elements/MultiSelectDropdown/MultiSelectDropdown.tsx +0 -156
  63. package/ui/elements/MultiSelectDropdown/index.ts +0 -2
  64. package/ui/elements/MultiSelectDropdown/types.ts +0 -87
  65. package/ui/elements/SelectDropdown/SelectDropdown.styles.ts +0 -99
  66. package/ui/elements/SelectDropdown/SelectDropdown.test.tsx +0 -86
  67. package/ui/elements/SelectDropdown/SelectDropdown.tsx +0 -94
  68. package/ui/elements/SelectDropdown/index.tsx +0 -2
  69. package/ui/elements/SelectDropdown/types.ts +0 -73
  70. package/ui/elements/Table/Table.styles.ts +0 -178
  71. package/ui/elements/Table/Table.test.tsx +0 -72
  72. package/ui/elements/Table/Table.tsx +0 -118
  73. package/ui/elements/Table/constants.ts +0 -0
  74. package/ui/elements/Table/index.ts +0 -2
  75. package/ui/elements/Table/types.ts +0 -270
  76. package/ui/elements/Table/utils.ts +0 -0
  77. package/ui/elements/Typography/Typography.styles.ts +0 -29
  78. package/ui/elements/Typography/Typography.tsx +0 -70
  79. package/ui/elements/Typography/constants.ts +0 -292
  80. package/ui/elements/Typography/index.ts +0 -9
  81. package/ui/elements/Typography/types.ts +0 -116
  82. package/ui/elements/Typography/utils.ts +0 -11
  83. package/ui/fonts/Switzer-Variable.ttf +0 -0
  84. package/ui/fonts/grauity-icons.eot +0 -0
  85. package/ui/fonts/grauity-icons.ttf +0 -0
  86. package/ui/fonts/grauity-icons.woff +0 -0
  87. package/ui/fonts/grauity-icons.woff2 +0 -0
  88. package/ui/helpers/README.md +0 -3
  89. package/ui/helpers/classNameBuilders.ts +0 -48
  90. package/ui/helpers/index.ts +0 -7
  91. package/ui/index.ts +0 -48
  92. package/ui/init/GrauityInit.tsx +0 -85
  93. package/ui/init/index.ts +0 -2
  94. package/ui/themes/GlobalStyle.ts +0 -273
  95. package/ui/themes/ThemeContext.tsx +0 -140
  96. package/ui/themes/constants.ts +0 -8
  97. package/ui/themes/darkThemeConstants.ts +0 -73
  98. package/ui/themes/lightThemeConstants.ts +0 -73
  99. package/ui/themes/tokens.ts +0 -0
  100. package/ui/themes/types.ts +0 -77
@@ -1,282 +0,0 @@
1
- import React from 'react';
2
-
3
- import { grauityIconName, grauityIconSizeName } from '../../core';
4
-
5
- export type ButtonTypeAttribute = 'button' | 'submit' | 'reset';
6
-
7
- export type ButtonVariants =
8
- | 'primary'
9
- | 'secondary'
10
- | 'tertiary'
11
- | 'success'
12
- | 'danger'
13
- | 'warning'
14
- | 'primary-outlined'
15
- | 'secondary-outlined'
16
- | 'tertiary-outlined'
17
- | 'success-outlined'
18
- | 'danger-outlined'
19
- | 'warning-outlined';
20
-
21
- export type ButtonSizes = 'small' | 'medium' | 'large' | 'extra-large';
22
-
23
- export type ButtonIconPositions = 'left' | 'right';
24
-
25
- export interface ButtonProps {
26
- /**
27
- * Variant of the button
28
- *
29
- * Available choices: `primary`, `secondary`, `tertiary`, `success`, `danger`, `warning`, `primary-outlined`, `secondary-outlined`, `tertiary-outlined`, `success-outlined`, `danger-outlined`, `warning-outlined`
30
- *
31
- * Default: `primary`
32
- * */
33
- variant?: ButtonVariants;
34
-
35
- /**
36
- * Size of the button
37
- * Available choices: `small`, `medium`, `large`
38
- *
39
- * Default: `medium`
40
- * */
41
- size?: ButtonSizes;
42
-
43
- /**
44
- * Icon to be displayed in the button.
45
- * */
46
- icon?: grauityIconName;
47
-
48
- /**
49
- * Size of the icon
50
- * */
51
- iconSize?: grauityIconSizeName;
52
-
53
- /**
54
- * Position of the icon
55
- *
56
- * Available choices: `left`, `right`
57
- *
58
- * Default: `left`
59
- * */
60
- iconPosition?: ButtonIconPositions;
61
-
62
- /**
63
- * Additional classes to be added to the component.
64
- * */
65
- className?: string;
66
-
67
- /**
68
- * Show that the button is inactive
69
- *
70
- * Default: `false`
71
- * */
72
- disabled?: boolean;
73
-
74
- /**
75
- * Show that the button is loading
76
- *
77
- * Default: `false`
78
- * */
79
- loading?: boolean;
80
-
81
- /**
82
- * Function to be called on click
83
- *
84
- * If the button is disabled, the function will not be called
85
- * */
86
- onClick?: (e?: any) => void;
87
-
88
- /**
89
- * Additional styles to be used over the element
90
- *
91
- * Default: `{}`
92
- * */
93
- style?: React.CSSProperties;
94
-
95
- /**
96
- * Make the button full width
97
- *
98
- * Default: `false`
99
- * */
100
- fullWidth?: boolean;
101
-
102
- /**
103
- * Children of the component
104
- * */
105
- children?: React.ReactNode;
106
-
107
- /**
108
- * Type of the button
109
- *
110
- * Default: `button`
111
- * */
112
- type?: 'button' | 'submit' | 'reset';
113
-
114
- /**
115
- * Aria label for the button
116
- * */
117
- ariaLabel?: string;
118
-
119
- /**
120
- * Tooltip to be displayed on hover, uses the `title` attribute
121
- * */
122
- tooltip?: string;
123
-
124
- /**
125
- * Tab index of the button
126
- * */
127
- tabIndex?: number;
128
-
129
- /**
130
- * Function to be called on mouse enter
131
- * */
132
- onMouseEnter?: (e: React.MouseEvent<HTMLButtonElement>) => void;
133
-
134
- /**
135
- * Function to be called on mouse leave
136
- * */
137
- onMouseLeave?: (e: React.MouseEvent<HTMLButtonElement>) => void;
138
-
139
- /**
140
- * Additional props to be passed to the button element
141
- * */
142
- buttonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;
143
- }
144
-
145
- export interface IconButtonProps {
146
- /**
147
- * Variant of the button
148
- *
149
- * Available choices: `primary`, `secondary`, `tertiary`, `success`, `danger`, `warning`, `primary-outlined`, `secondary-outlined`, `tertiary-outlined`, `success-outlined`, `danger-outlined`, `warning-outlined`
150
- *
151
- * Default: `primary`
152
- * */
153
- variant?: ButtonVariants;
154
-
155
- /**
156
- * Size of the button
157
- * Available choices: `small`, `medium`, `large`
158
- *
159
- * Default: `medium`
160
- * */
161
- size?: ButtonSizes;
162
-
163
- /**
164
- * Icon to be displayed in the button.
165
- * */
166
- icon?: grauityIconName;
167
-
168
- /**
169
- * Size of the icon
170
- * */
171
- iconSize?: grauityIconSizeName;
172
-
173
- /**
174
- * Additional classes to be added to the component.
175
- * */
176
- className?: string;
177
-
178
- /**
179
- * Show that the button is inactive
180
- *
181
- * Default: `false`
182
- * */
183
- disabled?: boolean;
184
-
185
- /**
186
- * Show that the button is loading
187
- *
188
- * Default: `false`
189
- * */
190
- loading?: boolean;
191
-
192
- /**
193
- * Function to be called on click
194
- *
195
- * If the button is disabled, the function will not be called
196
- * */
197
- onClick?: (e?: any) => void;
198
-
199
- /**
200
- * Additional styles to be used over the element
201
- *
202
- * Default: `{}`
203
- * */
204
- style?: React.CSSProperties;
205
-
206
- /**
207
- * Make the button full width
208
- *
209
- * Default: `false`
210
- * */
211
- fullWidth?: boolean;
212
-
213
- /**
214
- * Type of the button
215
- *
216
- * Default: `button`
217
- * */
218
- type?: 'button' | 'submit' | 'reset';
219
-
220
- /**
221
- * Aria label for the button
222
- * */
223
- ariaLabel?: string;
224
-
225
- /**
226
- * Tooltip to be displayed on hover, uses the `title` attribute
227
- * */
228
- tooltip?: string;
229
-
230
- /**
231
- * Tab index of the button
232
- * */
233
- tabIndex?: number;
234
-
235
- /**
236
- * Function to be called on mouse enter
237
- * */
238
- onMouseEnter?: (e: React.MouseEvent<HTMLButtonElement>) => void;
239
-
240
- /**
241
- * Function to be called on mouse leave
242
- * */
243
- onMouseLeave?: (e: React.MouseEvent<HTMLButtonElement>) => void;
244
-
245
- /**
246
- * Additional props to be passed to the button element
247
- * */
248
- buttonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;
249
- }
250
-
251
- export interface ButtonComponentProps
252
- extends React.ButtonHTMLAttributes<HTMLButtonElement> {
253
- variant?: ButtonVariants;
254
- size?: ButtonSizes;
255
- icon?: string | number;
256
- iconSize?: string;
257
- iconPosition?: 'left' | 'right';
258
- className?: string;
259
- disabled?: boolean;
260
- isLoading?: boolean;
261
- style?: React.CSSProperties;
262
- onClick?: (e?: any) => void;
263
- fullWidth?: boolean;
264
- isIconButton?: boolean;
265
- children?: React.ReactNode;
266
- ref?: React.Ref<HTMLButtonElement>;
267
- type?: ButtonTypeAttribute;
268
- ariaLabel?: string;
269
- title?: string;
270
- tabIndex?: number;
271
- onMouseEnter?: (e: React.MouseEvent<HTMLButtonElement>) => void;
272
- onMouseLeave?: (e: React.MouseEvent<HTMLButtonElement>) => void;
273
- }
274
-
275
- export interface ButtonContentProps {
276
- id?: string;
277
- children: React.ReactNode;
278
- }
279
-
280
- export interface ButtonGroupProps {
281
- children: React.ReactNode;
282
- }
File without changes
@@ -1,99 +0,0 @@
1
- import styled, { css, keyframes } from 'styled-components';
2
-
3
- import { IconProps } from './types';
4
-
5
- const iconLoading = keyframes`
6
- 0% { transform: rotate(0deg); }
7
- 100% { transform: rotate(360deg); }
8
- `;
9
-
10
- export const StyledIcon = styled.i.attrs((props: IconProps) => ({
11
- as: props.as || 'i',
12
- }))<IconProps>`
13
- display: flex;
14
- align-items: center;
15
- justify-content: center;
16
- margin: 0;
17
- line-height: 1em;
18
- backface-visibility: hidden;
19
- speak: none;
20
- text-decoration: inherit;
21
- opacity: 1;
22
- text-align: center;
23
-
24
- ${({ size }) => css`
25
- font-size: ${size}px;
26
- `}
27
-
28
- ${({ color }) => css`
29
- color: ${color};
30
-
31
- &.bordered,
32
- &.circular {
33
- box-shadow: 0 0 0 0.1em ${color} inset;
34
- height: 1em;
35
- width: 1em;
36
-
37
- &.inverted {
38
- color: var(--icon-color-white);
39
- background-color: ${color};
40
- }
41
- }
42
-
43
- &.disabled {
44
- color: ${color};
45
-
46
- &.bordered,
47
- &.circular {
48
- box-shadow: 0 0 0 0.1em ${color} inset;
49
- height: 1em;
50
- width: 1em;
51
-
52
- &.inverted {
53
- color: var(--disabled-icon-color-white);
54
- background-color: ${color};
55
- }
56
- }
57
- }
58
- `}
59
-
60
-
61
- &.loading {
62
- animation: ${iconLoading} 2s linear infinite;
63
- }
64
-
65
- &.fitted {
66
- width: auto;
67
- margin: 0 !important;
68
- }
69
-
70
- &.horizontally-flipped {
71
- transform: scaleX(-1);
72
- }
73
-
74
- &.vertically-flipped {
75
- transform: scaleY(-1);
76
- }
77
-
78
- &.clockwise-rotated {
79
- transform: rotate(90deg);
80
- }
81
-
82
- &.counterclockwise-rotated {
83
- transform: rotate(-90deg);
84
- }
85
-
86
- &.link {
87
- cursor: pointer;
88
- opacity: 0.8;
89
- transition: opacity 0.1s ease-in-out;
90
-
91
- &:hover {
92
- opacity: 1;
93
- }
94
- }
95
-
96
- &.circular {
97
- border-radius: 50%;
98
- }
99
- `;
@@ -1,139 +0,0 @@
1
- import classnames from 'classnames';
2
- import _ from 'lodash';
3
- import PropTypes from 'prop-types';
4
- import * as React from 'react';
5
-
6
- import {
7
- GRAUITY_ICON_FLIPPED_CHOICES,
8
- GRAUITY_ICON_ROTATED_CHOICES,
9
- GRAUITY_ICON_SIZES,
10
- ICON_TAGS,
11
- } from '../../core';
12
- import { useKeyOnly, useValueAndKey } from '../../helpers';
13
- import { StyledIcon } from './Icon.styles';
14
- import { IconProps } from './types';
15
-
16
- /**
17
- * An icon is a glyph used to represent something else.
18
- */
19
- function Icon({
20
- ariaHidden,
21
- ariaLabel,
22
- as,
23
- bordered,
24
- circular,
25
- color,
26
- className,
27
- disabled,
28
- fitted,
29
- flipped,
30
- inverted,
31
- link,
32
- loading,
33
- name,
34
- rotated,
35
- size,
36
- style,
37
- ...props
38
- }: IconProps) {
39
- const getIconAriaOptions = () => {
40
- const ariaOptions: {
41
- 'aria-hidden'?: string;
42
- 'aria-label'?: string;
43
- } = {};
44
-
45
- if (_.isNil(ariaLabel)) {
46
- ariaOptions['aria-hidden'] = 'true';
47
- } else {
48
- ariaOptions['aria-label'] = ariaLabel;
49
- }
50
-
51
- if (!_.isNil(ariaHidden)) {
52
- ariaOptions['aria-hidden'] = ariaHidden;
53
- }
54
-
55
- return ariaOptions;
56
- };
57
-
58
- const handleClick = (e?: any) => {
59
- if (disabled) {
60
- e.preventDefault();
61
- return;
62
- }
63
-
64
- _.invoke(props, 'onClick', e, props);
65
- };
66
-
67
- const ariaOptions = getIconAriaOptions();
68
-
69
- const classes = classnames(
70
- 'grauity-icon',
71
- `grauity-icon-${name}`,
72
- useKeyOnly(color, color),
73
- useKeyOnly(bordered, 'bordered'),
74
- useKeyOnly(circular, 'circular'),
75
- useKeyOnly(disabled, 'disabled'),
76
- useKeyOnly(fitted, 'fitted'),
77
- useKeyOnly(inverted, 'inverted'),
78
- useKeyOnly(link, 'link'),
79
- useKeyOnly(loading, 'loading'),
80
- useValueAndKey(flipped, 'flipped'),
81
- useValueAndKey(rotated, 'rotated'),
82
- className
83
- );
84
-
85
- return (
86
- <StyledIcon
87
- as={as}
88
- name={name}
89
- size={size}
90
- onClick={handleClick}
91
- color={color}
92
- {...ariaOptions}
93
- className={classes}
94
- style={style}
95
- data-testid="testid-icon"
96
- />
97
- );
98
- }
99
-
100
- Icon.propTypes = {
101
- ariaHidden: PropTypes.string,
102
- ariaLabel: PropTypes.string,
103
- as: PropTypes.elementType,
104
- bordered: PropTypes.bool,
105
- circular: PropTypes.bool,
106
- color: PropTypes.string,
107
- className: PropTypes.string,
108
- disabled: PropTypes.bool,
109
- fitted: PropTypes.bool,
110
- flipped: PropTypes.oneOf(GRAUITY_ICON_FLIPPED_CHOICES),
111
- inverted: PropTypes.bool,
112
- link: PropTypes.bool,
113
- loading: PropTypes.bool,
114
- name: PropTypes.oneOf(Object.keys(ICON_TAGS)).isRequired,
115
- rotated: PropTypes.oneOf(GRAUITY_ICON_ROTATED_CHOICES),
116
- size: PropTypes.oneOf(GRAUITY_ICON_SIZES),
117
- style: PropTypes.object,
118
- };
119
-
120
- Icon.defaultProps = {
121
- ariaHidden: 'true',
122
- ariaLabel: undefined,
123
- as: 'i',
124
- bordered: false,
125
- circular: false,
126
- color: 'grey',
127
- className: undefined,
128
- disabled: false,
129
- fitted: false,
130
- flipped: undefined,
131
- inverted: false,
132
- link: false,
133
- loading: false,
134
- rotated: undefined,
135
- size: '24',
136
- style: undefined,
137
- };
138
-
139
- export default Icon;
@@ -1,2 +0,0 @@
1
- export { default as Icon } from './Icon';
2
- export { IconProps } from './types';
@@ -1,96 +0,0 @@
1
- import React from 'react';
2
- import {
3
- grauityFlippedChoiceName,
4
- grauityIconName,
5
- grauityIconSizeName,
6
- grauityRotatedChoiceName,
7
- } from 'ui/core';
8
-
9
- interface IconProps {
10
- /**
11
- * Icon can have the aria hidden attribute
12
- * */
13
- ariaHidden?: string;
14
-
15
- /**
16
- * Icon can have the aria label attribute
17
- * */
18
- ariaLabel?: string;
19
-
20
- /**
21
- * An element type to render as (string or function).
22
- * */
23
- as?: React.ElementType;
24
-
25
- /**
26
- * Format the icon to appear bordered
27
- * */
28
- bordered?: boolean;
29
-
30
- /**
31
- * Format the icon to appear circular
32
- * */
33
- circular?: boolean;
34
-
35
- /**
36
- * Color of the icon
37
- * */
38
- color?: string;
39
-
40
- /**
41
- * Additional classes to be added to the component
42
- * */
43
- className?: string;
44
-
45
- /**
46
- * Show that the icon is inactive
47
- * */
48
- disabled?: boolean;
49
-
50
- /**
51
- * Fitted, without space to left or right of Icon
52
- * */
53
- fitted?: boolean;
54
-
55
- /**
56
- * Icon can be flipped
57
- * */
58
- flipped?: grauityFlippedChoiceName;
59
-
60
- /**
61
- * The colors of the icon can be inverted in case of used with border
62
- * * */
63
- inverted?: boolean;
64
-
65
- /**
66
- * Icon can be formatted as a link
67
- * */
68
- link?: boolean;
69
-
70
- /**
71
- * Icon can be used as a simple loader
72
- * */
73
- loading?: boolean;
74
-
75
- /**
76
- * Name of the icon
77
- * */
78
- name: grauityIconName;
79
-
80
- /**
81
- * Icon can be rotated
82
- * */
83
- rotated?: grauityRotatedChoiceName;
84
-
85
- /**
86
- * Size of the icon
87
- * */
88
- size?: grauityIconSizeName;
89
-
90
- /**
91
- * Additional styles to be used over the element
92
- * */
93
- style?: React.CSSProperties;
94
- }
95
-
96
- export { IconProps };