@indico-data/design-system 1.0.1

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 (161) hide show
  1. package/.babelrc +27 -0
  2. package/.eslintignore +6 -0
  3. package/.eslintrc.js +63 -0
  4. package/.husky/pre-commit +4 -0
  5. package/.prettierignore +3 -0
  6. package/.prettierrc +6 -0
  7. package/.stackblitzrc +4 -0
  8. package/.storybook/indico-data-logo.svg +1 -0
  9. package/.storybook/main.ts +36 -0
  10. package/.storybook/preview-head.html +19 -0
  11. package/.storybook/preview.ts +24 -0
  12. package/.storybook/themes.js +24 -0
  13. package/.yarn/releases/yarn-classic.cjs +179386 -0
  14. package/.yarnrc.yml +1 -0
  15. package/README.md +30 -0
  16. package/package.json +79 -0
  17. package/src/components/Accordion/Accordion.stories.tsx +47 -0
  18. package/src/components/Accordion/Accordion.styles.ts +35 -0
  19. package/src/components/Accordion/Accordion.tsx +30 -0
  20. package/src/components/Accordion/index.ts +1 -0
  21. package/src/components/Icon/Icon.stories.tsx +60 -0
  22. package/src/components/Icon/Icon.tsx +75 -0
  23. package/src/components/Icon/faIcons.tsx +168 -0
  24. package/src/components/Icon/index.ts +2 -0
  25. package/src/components/Icon/indicons.tsx +699 -0
  26. package/src/components/Icon/storyHelpers.tsx +87 -0
  27. package/src/components/ListTable/Header/Header.styles.ts +62 -0
  28. package/src/components/ListTable/Header/Header.tsx +67 -0
  29. package/src/components/ListTable/Header/index.ts +1 -0
  30. package/src/components/ListTable/ListTable.stories.tsx +301 -0
  31. package/src/components/ListTable/ListTable.styles.ts +76 -0
  32. package/src/components/ListTable/ListTable.tsx +135 -0
  33. package/src/components/ListTable/index.ts +1 -0
  34. package/src/components/ListTable/mock-data/index.ts +1 -0
  35. package/src/components/ListTable/mock-data/mock-data.ts +291 -0
  36. package/src/components/Pagination/Pagination.stories.tsx +45 -0
  37. package/src/components/Pagination/Pagination.styles.ts +51 -0
  38. package/src/components/Pagination/Pagination.tsx +118 -0
  39. package/src/components/Pagination/index.ts +1 -0
  40. package/src/components/basic-section/Section/Section.stories.tsx +14 -0
  41. package/src/components/basic-section/Section/Section.styles.ts +8 -0
  42. package/src/components/basic-section/Section/Section.tsx +30 -0
  43. package/src/components/basic-section/Section/index.ts +1 -0
  44. package/src/components/basic-section/SectionBlock/SectionBlock.styles.ts +15 -0
  45. package/src/components/basic-section/SectionBlock/SectionBlock.tsx +37 -0
  46. package/src/components/basic-section/SectionBlock/index.ts +1 -0
  47. package/src/components/basic-section/SectionBody/SectionBody.stories.tsx +16 -0
  48. package/src/components/basic-section/SectionBody/SectionBody.styles.ts +18 -0
  49. package/src/components/basic-section/SectionBody/SectionBody.tsx +30 -0
  50. package/src/components/basic-section/SectionBody/index.ts +1 -0
  51. package/src/components/basic-section/SectionHeader/SectionHeader.stories.tsx +17 -0
  52. package/src/components/basic-section/SectionHeader/SectionHeader.styles.ts +5 -0
  53. package/src/components/basic-section/SectionHeader/SectionHeader.tsx +35 -0
  54. package/src/components/basic-section/SectionHeader/index.ts +1 -0
  55. package/src/components/basic-section/SectionTable/SectionTable.styles.ts +237 -0
  56. package/src/components/basic-section/SectionTable/SectionTable.tsx +229 -0
  57. package/src/components/basic-section/SectionTable/index.ts +1 -0
  58. package/src/components/basic-section/index.ts +5 -0
  59. package/src/components/buttons/Button/Button.stories.tsx +80 -0
  60. package/src/components/buttons/Button/Button.styles.ts +99 -0
  61. package/src/components/buttons/Button/Button.tsx +74 -0
  62. package/src/components/buttons/Button/index.ts +1 -0
  63. package/src/components/buttons/IconButton/IconButton.stories.tsx +96 -0
  64. package/src/components/buttons/IconButton/IconButton.styles.ts +78 -0
  65. package/src/components/buttons/IconButton/IconButton.tsx +109 -0
  66. package/src/components/buttons/IconButton/index.ts +1 -0
  67. package/src/components/buttons/commonStyles.ts +108 -0
  68. package/src/components/buttons/index.ts +2 -0
  69. package/src/components/buttons/types.ts +2 -0
  70. package/src/components/dropdowns/BorderSelect/BorderSelect.stories.tsx +22 -0
  71. package/src/components/dropdowns/BorderSelect/BorderSelect.styles.ts +73 -0
  72. package/src/components/dropdowns/BorderSelect/BorderSelect.tsx +85 -0
  73. package/src/components/dropdowns/BorderSelect/index.ts +1 -0
  74. package/src/components/dropdowns/MultiCombobox/MultiCombobox.stories.tsx +146 -0
  75. package/src/components/dropdowns/MultiCombobox/MultiCombobox.styles.ts +89 -0
  76. package/src/components/dropdowns/MultiCombobox/MultiCombobox.tsx +123 -0
  77. package/src/components/dropdowns/MultiCombobox/index.ts +1 -0
  78. package/src/components/dropdowns/Select/Select.stories.tsx +54 -0
  79. package/src/components/dropdowns/Select/Select.styles.ts +73 -0
  80. package/src/components/dropdowns/Select/Select.tsx +69 -0
  81. package/src/components/dropdowns/Select/index.ts +1 -0
  82. package/src/components/dropdowns/SingleCombobox/SingleCombobox.stories.tsx +61 -0
  83. package/src/components/dropdowns/SingleCombobox/SingleCombobox.styles.ts +56 -0
  84. package/src/components/dropdowns/SingleCombobox/SingleCombobox.tsx +103 -0
  85. package/src/components/dropdowns/SingleCombobox/index.ts +1 -0
  86. package/src/components/dropdowns/commonStyles.ts +65 -0
  87. package/src/components/dropdowns/index.ts +4 -0
  88. package/src/components/dropdowns/types.ts +45 -0
  89. package/src/components/dropdowns/useCombobox.ts +32 -0
  90. package/src/components/dropdowns/utils.tsx +25 -0
  91. package/src/components/index.ts +9 -0
  92. package/src/components/inputs/EditableInput/EditableInput.stories.tsx +26 -0
  93. package/src/components/inputs/EditableInput/EditableInput.styles.ts +21 -0
  94. package/src/components/inputs/EditableInput/EditableInput.tsx +103 -0
  95. package/src/components/inputs/EditableInput/index.ts +1 -0
  96. package/src/components/inputs/NumberInput/NumberInput.stories.tsx +72 -0
  97. package/src/components/inputs/NumberInput/NumberInput.styles.ts +66 -0
  98. package/src/components/inputs/NumberInput/NumberInput.tsx +153 -0
  99. package/src/components/inputs/NumberInput/index.ts +1 -0
  100. package/src/components/inputs/SearchInput/SearchInput.stories.tsx +17 -0
  101. package/src/components/inputs/SearchInput/SearchInput.styles.ts +25 -0
  102. package/src/components/inputs/SearchInput/SearchInput.tsx +47 -0
  103. package/src/components/inputs/SearchInput/index.ts +1 -0
  104. package/src/components/inputs/TextInput/TextInput.stories.tsx +104 -0
  105. package/src/components/inputs/TextInput/TextInput.styles.ts +74 -0
  106. package/src/components/inputs/TextInput/TextInput.tsx +116 -0
  107. package/src/components/inputs/TextInput/index.ts +1 -0
  108. package/src/components/inputs/index.ts +4 -0
  109. package/src/components/inputs/inputsCommon.styles.ts +61 -0
  110. package/src/components/loading-indicators/BarSpinner/BarSpinner.stories.tsx +14 -0
  111. package/src/components/loading-indicators/BarSpinner/BarSpinner.styles.ts +53 -0
  112. package/src/components/loading-indicators/BarSpinner/BarSpinner.tsx +21 -0
  113. package/src/components/loading-indicators/BarSpinner/index.ts +1 -0
  114. package/src/components/loading-indicators/CirclePulse/CirclePulse.stories.tsx +22 -0
  115. package/src/components/loading-indicators/CirclePulse/CirclePulse.styles.ts +81 -0
  116. package/src/components/loading-indicators/CirclePulse/CirclePulse.tsx +61 -0
  117. package/src/components/loading-indicators/CirclePulse/index.ts +1 -0
  118. package/src/components/loading-indicators/CircleSpinner/CircleSpinner.stories.tsx +16 -0
  119. package/src/components/loading-indicators/CircleSpinner/CircleSpinner.tsx +37 -0
  120. package/src/components/loading-indicators/CircleSpinner/index.ts +1 -0
  121. package/src/components/loading-indicators/LoadingList/LoadingList.stories.tsx +14 -0
  122. package/src/components/loading-indicators/LoadingList/LoadingList.styles.ts +42 -0
  123. package/src/components/loading-indicators/LoadingList/LoadingList.tsx +9 -0
  124. package/src/components/loading-indicators/LoadingList/index.ts +1 -0
  125. package/src/components/loading-indicators/PercentageRing/PercentageRing.stories.tsx +18 -0
  126. package/src/components/loading-indicators/PercentageRing/PercentageRing.styles.ts +27 -0
  127. package/src/components/loading-indicators/PercentageRing/PercentageRing.tsx +76 -0
  128. package/src/components/loading-indicators/PercentageRing/index.ts +1 -0
  129. package/src/components/loading-indicators/RandomLoadingMessage/RandomLoadingMessage.stories.tsx +16 -0
  130. package/src/components/loading-indicators/RandomLoadingMessage/RandomLoadingMessage.tsx +18 -0
  131. package/src/components/loading-indicators/RandomLoadingMessage/index.ts +1 -0
  132. package/src/components/loading-indicators/RandomLoadingMessage/random-messages.js +67 -0
  133. package/src/components/loading-indicators/index.ts +6 -0
  134. package/src/components/user-feedback/Shrug/Shrug.stories.tsx +38 -0
  135. package/src/components/user-feedback/Shrug/Shrug.styles.ts +23 -0
  136. package/src/components/user-feedback/Shrug/Shrug.tsx +44 -0
  137. package/src/components/user-feedback/Shrug/index.ts +1 -0
  138. package/src/components/user-feedback/index.ts +1 -0
  139. package/src/index.tsx +18 -0
  140. package/src/styles/globals/buttons.ts +154 -0
  141. package/src/styles/globals/forms.ts +103 -0
  142. package/src/styles/globals/index.tsx +25 -0
  143. package/src/styles/globals/layout.ts +25 -0
  144. package/src/styles/globals/lists.ts +23 -0
  145. package/src/styles/globals/margin-padding.ts +33 -0
  146. package/src/styles/globals/media.ts +13 -0
  147. package/src/styles/globals/tables.ts +34 -0
  148. package/src/styles/globals/typography.ts +95 -0
  149. package/src/styles/globals/utility-classes.ts +76 -0
  150. package/src/tokens/animation.ts +6 -0
  151. package/src/tokens/breakpoints.ts +11 -0
  152. package/src/tokens/colors.ts +279 -0
  153. package/src/tokens/index.ts +20 -0
  154. package/src/tokens/margin.ts +5 -0
  155. package/src/tokens/numbers.js +41 -0
  156. package/src/tokens/padding.ts +5 -0
  157. package/src/tokens/spacings.ts +5 -0
  158. package/src/tokens/typography.ts +37 -0
  159. package/src/types.ts +6 -0
  160. package/tsconfig.json +13 -0
  161. package/webpack.config.js +35 -0
@@ -0,0 +1,76 @@
1
+ import { createGlobalStyle } from 'styled-components';
2
+ import { COLORS } from '@/tokens';
3
+
4
+ export const UtilityClasses = createGlobalStyle`
5
+ .link-style {
6
+ text-decoration: underline;
7
+
8
+ &:hover {
9
+ text-decoration: none;
10
+ }
11
+ }
12
+
13
+ .spin {
14
+ animation: spin 2s infinite linear;
15
+ }
16
+
17
+ @keyframes spin {
18
+ 0% {
19
+ transform: rotate(0deg);
20
+ }
21
+
22
+ 100% {
23
+ transform: rotate(360deg);
24
+ }
25
+ }
26
+
27
+ .card-body {
28
+ background-color: ${COLORS.clay};
29
+ border-radius: 4px;
30
+ border: 1px solid ${COLORS.oxfordBlue};
31
+ padding: 20px;
32
+
33
+ hr {
34
+ margin: 1.25em 0;
35
+ border: 1px solid transparent;
36
+ border-bottom-color: ${COLORS.ebony};
37
+ }
38
+ }
39
+
40
+ .scrollable-vertical {
41
+ overflow: hidden auto;
42
+
43
+ scrollbar-color: ${COLORS.darkGray} transparent;
44
+ scrollbar-gutter: stable;
45
+ scrollbar-width: thin;
46
+
47
+ &::-webkit-scrollbar {
48
+ width: 5px;
49
+ }
50
+
51
+ &::-webkit-scrollbar-track {
52
+ box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
53
+ }
54
+
55
+ &::-webkit-scrollbar-thumb {
56
+ background-color: darkgrey;
57
+ outline: 1px solid slategrey;
58
+ border-radius: 20px;
59
+ }
60
+ }
61
+
62
+ .page-bottom {
63
+ padding-bottom: 20px;
64
+ }
65
+
66
+ .aria-invisible {
67
+ border: 0;
68
+ clip: rect(0 0 0 0);
69
+ height: 1px;
70
+ margin: -1px;
71
+ overflow: hidden;
72
+ padding: 0;
73
+ position: absolute;
74
+ width: 1px;
75
+ }
76
+ `;
@@ -0,0 +1,6 @@
1
+ // This is used for "micro animations" - general purpose values to give the app a general feel
2
+ // By no means is this the rule for building out custom animations for various parts of the application
3
+ export const animation = {
4
+ duration: '200ms',
5
+ timing: 'ease',
6
+ } as const;
@@ -0,0 +1,11 @@
1
+ export const breakpoints = {
2
+ mediumScreen: '600px',
3
+ largeScreen: '900px',
4
+ maxScreen: '1300px',
5
+ } as const;
6
+
7
+ export const mediaQueries = {
8
+ mediumScreen: `only screen and (min-width: ${breakpoints.mediumScreen})`,
9
+ largeScreen: `only screen and (min-width: ${breakpoints.largeScreen})`,
10
+ maxScreen: `only screen and (min-width: ${breakpoints.maxScreen})`,
11
+ };
@@ -0,0 +1,279 @@
1
+ export const allColors = {
2
+ akaroa: '#cbc98f',
3
+ amber: '#f4c401',
4
+ amethyst: '#8e57b3',
5
+ aqua: '#10e4fe',
6
+ astralBlue: '#2f7ca2',
7
+ ateneoBlue: '#0d466a',
8
+ avocado: '#81b12f',
9
+ azure: '#108cf7',
10
+ baliHai: '#8498b6',
11
+ black: '#000',
12
+ blueBayoux: '#4f5e74',
13
+ blueMagenta: '#542f9d',
14
+ blueRibbon: '#0b35ff',
15
+ blueYonder: '#586fd2',
16
+ bouqet: '#a35c9a',
17
+ brick: '#c62828',
18
+ brown: '#785349',
19
+ candyCorn: '#fcef4d',
20
+ carnation: '#ff8adf',
21
+ carrot: '#f29a2d',
22
+ cerise: '#d52a96',
23
+ cerulean: '#008b9e',
24
+ chantilly: '#f7b0eb',
25
+ charcoal: '#474b4b',
26
+ chartreuse: '#34ff01',
27
+ clay: '#283243',
28
+ cocoaBean: '#5c1200',
29
+ comet: '#5a6982',
30
+ cornflower: '#2060ff',
31
+ crimson: '#e53126',
32
+ curiousBlue: '#178ee0',
33
+ cyan: '#0cf',
34
+ darkFontColor: '#0d151d',
35
+ darkGray: '#333',
36
+ darkPurple: '#6f3eae',
37
+ darkRed: '#b30000',
38
+ defaultFontColor: '#bbbfc5',
39
+ dodgerBlue: '#1774ff',
40
+ eagleGreen: '#005557',
41
+ ebony: '#101a26',
42
+ eggplant: '#7a0074',
43
+ electricGreen: '#00ff0a',
44
+ emerald: '#09c199',
45
+ espresso: '#5a3627',
46
+ fieldPromptError: '#fd9693',
47
+ fieldPromptInfo: '#00bfff',
48
+ flamingo: '#f861b6',
49
+ flirt: '#910870',
50
+ forestGreen: '#1f7f1f',
51
+ geraldine: '#fe9486',
52
+ grannysmith: '#92e959',
53
+ green: '#4caf50',
54
+ harlequin: '#20cb00',
55
+ harvestGold: '#e6c079',
56
+ hemlock: '#626740',
57
+ imperial: '#4b0134',
58
+ iron: '#d9dee0',
59
+ japaneseIndigo: '#264359',
60
+ juniper: '#6d9292',
61
+ khaki: '#bba44b',
62
+ koamaru: '#2f346a',
63
+ korma: '#90370e',
64
+ lavender: '#B086E3',
65
+ lavenderRose: '#fb9fda',
66
+ lightGray: '#eee',
67
+ lightPurple: '#b43be4',
68
+ lilac: '#a195d4',
69
+ lincolnGreen: '#254600',
70
+ magenta: '#ff15e0',
71
+ malibu: '#68C2FB',
72
+ mantis: '#4fa83d',
73
+ maroon: '#ad3349',
74
+ mauve: '#e06cfb',
75
+ mediumGray: '#999',
76
+ midFontColor: '#8593b3',
77
+ mint: '#3ac999',
78
+ mirage: '#182432',
79
+ mulberry: '#5c0536',
80
+ olive: '#807300',
81
+ orange: '#ff7200',
82
+ orchid: '#ab00ff',
83
+ oxfordBlue: '#384558',
84
+ pacific: '#00b5b6',
85
+ palm: '#1aa511',
86
+ persian: '#1717cf',
87
+ persianLight: '#0327ce',
88
+ pine: '#017074',
89
+ pink: '#f74f8a',
90
+ pistachio: '#aac609',
91
+ raspberry: '#990030',
92
+ red: '#f95359',
93
+ robinsEggBlue: '#00bcd4',
94
+ romanSilver: '#7d888d',
95
+ salem: '#03832e',
96
+ sapGreen: '#5f7e20',
97
+ seaGreen: '#0b8a51',
98
+ seance: '#7f1f82',
99
+ shiraz: '#c61021',
100
+ sinopia: '#D14200',
101
+ tangerine: '#ff9900',
102
+ teal: '#008285',
103
+ toast: '#997862',
104
+ trueBlue: '#066CC6',
105
+ turquoise: '#00b5b6',
106
+ vermilion: '#b95555',
107
+ viking: '#59cfe0',
108
+ violet: '#3e4eb8',
109
+ violetBlue: '#8060d2',
110
+ walnut: '#783f00',
111
+ white: '#fff',
112
+ windsorTan: '#b35c00',
113
+ yellow: '#ffca28',
114
+ zucchini: '#016422',
115
+ get hiliteFontColor() {
116
+ return this.white;
117
+ },
118
+ get lightFontColor() {
119
+ return this.lightGray;
120
+ },
121
+ get borderColor() {
122
+ return this.lightGray;
123
+ },
124
+ get actionColor() {
125
+ return this.midFontColor;
126
+ },
127
+ get backgroundColor() {
128
+ return this.mirage;
129
+ },
130
+ } as const;
131
+
132
+ export type ColorName = keyof typeof allColors;
133
+
134
+ /**
135
+ * Given an array of valid color names, return an array containing their hex values as strings.
136
+ */
137
+ function returnColorPalette(colorNames: ColorName[]): string[] {
138
+ return colorNames.map((name) => allColors[name]);
139
+ }
140
+
141
+ // Base Colors
142
+ export const baseColors = returnColorPalette([
143
+ 'curiousBlue',
144
+ 'robinsEggBlue',
145
+ 'green',
146
+ 'yellow',
147
+ 'red',
148
+ 'white',
149
+ 'black',
150
+ ]);
151
+
152
+ // Layout Colors
153
+ export const layoutColors = returnColorPalette([
154
+ 'ebony',
155
+ 'mirage',
156
+ 'clay',
157
+ 'oxfordBlue',
158
+ 'blueBayoux',
159
+ 'comet',
160
+ 'baliHai',
161
+ ]);
162
+
163
+ // Grays
164
+ export const grayColors = returnColorPalette(['darkGray', 'mediumGray', 'lightGray', 'iron']);
165
+
166
+ // Font Colors
167
+ export const fontColors = returnColorPalette([
168
+ 'darkFontColor',
169
+ 'hiliteFontColor',
170
+ 'lightFontColor',
171
+ 'defaultFontColor',
172
+ 'midFontColor',
173
+ ]);
174
+
175
+ // Button Palette
176
+ export const buttonColors = returnColorPalette([
177
+ 'turquoise',
178
+ 'violet',
179
+ 'emerald',
180
+ 'seaGreen',
181
+ 'avocado',
182
+ 'brick',
183
+ 'pink',
184
+ 'lightPurple',
185
+ 'charcoal',
186
+ ]);
187
+
188
+ // New Button Palette
189
+ export const newButtonColors = returnColorPalette([
190
+ 'azure',
191
+ 'orchid',
192
+ 'tangerine',
193
+ 'palm',
194
+ 'magenta',
195
+ 'blueRibbon',
196
+ 'orange',
197
+ 'darkRed',
198
+ 'amber',
199
+ 'lilac',
200
+ 'pacific',
201
+ 'carnation',
202
+ 'brown',
203
+ 'khaki',
204
+ 'zucchini',
205
+ 'eggplant',
206
+ //'crimson',
207
+ 'cerulean',
208
+ 'harlequin',
209
+ 'akaroa',
210
+ 'persianLight',
211
+ 'viking',
212
+ 'mauve',
213
+ 'espresso',
214
+ 'toast',
215
+ 'salem',
216
+ 'darkPurple',
217
+ 'cornflower',
218
+ 'grannysmith',
219
+ 'lavender',
220
+ ]);
221
+
222
+ // Visualization Palette
223
+ export const vizColors = returnColorPalette([
224
+ 'aqua',
225
+ 'carrot',
226
+ 'flamingo',
227
+ 'dodgerBlue',
228
+ 'chantilly',
229
+ 'crimson',
230
+ 'candyCorn',
231
+ 'amethyst',
232
+ ]);
233
+
234
+ export const vizColorsArray = returnColorPalette([
235
+ 'aqua',
236
+ 'carrot',
237
+ 'flamingo',
238
+ 'green',
239
+ 'dodgerBlue',
240
+ 'chantilly',
241
+ 'crimson',
242
+ 'candyCorn',
243
+ 'amethyst',
244
+ 'baliHai',
245
+ ]);
246
+
247
+ // ODL Label Palette
248
+ export const fieldColors = returnColorPalette([
249
+ 'trueBlue',
250
+ 'eggplant',
251
+ 'sinopia',
252
+ 'forestGreen',
253
+ 'cerise',
254
+ 'persian',
255
+ 'teal',
256
+ 'violetBlue',
257
+ 'olive',
258
+ 'raspberry',
259
+ 'eagleGreen',
260
+ 'maroon',
261
+ 'brown',
262
+ 'windsorTan',
263
+ 'koamaru',
264
+ 'seance',
265
+ 'cocoaBean',
266
+ 'ateneoBlue',
267
+ 'sapGreen',
268
+ 'vermilion',
269
+ 'blueYonder',
270
+ 'korma',
271
+ 'hemlock',
272
+ 'imperial',
273
+ 'astralBlue',
274
+ 'shiraz',
275
+ 'blueMagenta',
276
+ 'flirt',
277
+ 'lincolnGreen',
278
+ 'bouqet',
279
+ ]);
@@ -0,0 +1,20 @@
1
+ export { animation as ANIMATION } from './animation';
2
+ export { breakpoints as BREAKPOINT, mediaQueries as MEDIA_QUERIES } from './breakpoints';
3
+ export { typography as TYPOGRAPHY, fontSize as FONT_SIZE } from './typography';
4
+ export { padding as PADDINGS } from './padding';
5
+ export { spacings as SPACING } from './spacings';
6
+ export { margin as MARGINS } from './margin';
7
+ export { MATH } from './numbers';
8
+
9
+ export {
10
+ allColors as COLORS,
11
+ baseColors as BASE_COLORS,
12
+ fieldColors as FIELD_COLORS,
13
+ layoutColors as LAYOUT_COLORS,
14
+ grayColors as GRAY_COLORS,
15
+ fontColors as FONT_COLORS,
16
+ buttonColors as BUTTON_COLORS,
17
+ newButtonColors as NEW_BUTTON_COLORS,
18
+ vizColors as VIZ_COLORS,
19
+ vizColorsArray as VIZ_COLORS_ARRAY,
20
+ } from './colors';
@@ -0,0 +1,5 @@
1
+ export const margin = {
2
+ // todo -- get with mike L for other padding values as they become needed. Ideally we should create a formula.
3
+ sm: '15px',
4
+ md: '20px',
5
+ } as const;
@@ -0,0 +1,41 @@
1
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor
2
+
3
+ export const decimalAdjust = (type, value, exp) => {
4
+ // If the exp is undefined or zero...
5
+ if (typeof exp === 'undefined' || +exp === 0) {
6
+ return Math[type](value);
7
+ }
8
+ value = +value;
9
+ exp = +exp;
10
+ // If the value is not a number or the exp is not an integer...
11
+ if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) {
12
+ return NaN;
13
+ }
14
+ // Shift
15
+ value = value.toString().split('e');
16
+ value = Math[type](+(value[0] + 'e' + (value[1] ? +value[1] - exp : -exp)));
17
+ // Shift back
18
+ value = value.toString().split('e');
19
+ return +(value[0] + 'e' + (value[1] ? +value[1] + exp : exp));
20
+ };
21
+
22
+ export const round10 = (value, exp) => {
23
+ return decimalAdjust('round', value, exp);
24
+ };
25
+
26
+ export const clamp = (value, min, max) => {
27
+ value = value < min ? min : value;
28
+ value = value > max ? max : value;
29
+ return value;
30
+ };
31
+
32
+ export const numberWithCommas = (x) => {
33
+ return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
34
+ };
35
+
36
+ export const MATH = {
37
+ decimalAdjust,
38
+ round10,
39
+ clamp,
40
+ numberWithCommas,
41
+ };
@@ -0,0 +1,5 @@
1
+ export const padding = {
2
+ // todo -- get with mike L for other padding values as they become needed. Ideally we should create a formula.
3
+ sm: '15px',
4
+ md: '20px',
5
+ } as const;
@@ -0,0 +1,5 @@
1
+ export const spacings = {
2
+ xs: '8px',
3
+ sm: '12px',
4
+ md: '24px',
5
+ } as const;
@@ -0,0 +1,37 @@
1
+ import { css } from 'styled-components';
2
+
3
+ export const fontStack = ['Noto Sans', 'Avenir Next', 'Avenir', 'Noto', 'sans-serif'] as const;
4
+
5
+ export const fontFamily = {
6
+ base: fontStack.join(','),
7
+ heading: fontStack.join(','),
8
+ };
9
+
10
+ export const fontSize = {
11
+ caption: '12px',
12
+ base: '14px',
13
+ subheadSmall: '16px',
14
+ subheadLarge: '18px',
15
+ subheadXl: '22px',
16
+ display: '30px',
17
+ } as const;
18
+
19
+ export const lineHeight = {
20
+ base: 1.25,
21
+ heading: 1.2,
22
+ } as const;
23
+
24
+ export const spacing = {
25
+ base: `${lineHeight.base}em`,
26
+ half: `${lineHeight.base / 2}em`,
27
+ quarter: `${lineHeight.base / 4}em`,
28
+ third: `${lineHeight.base / 3}em`,
29
+ };
30
+
31
+ export const ellipsis = css`
32
+ overflow: hidden;
33
+ white-space: nowrap;
34
+ text-overflow: ellipsis;
35
+ `;
36
+
37
+ export const typography = { fontFamily, fontSize, lineHeight, spacing, ellipsis };
package/src/types.ts ADDED
@@ -0,0 +1,6 @@
1
+ export type PermafrostComponent = {
2
+ id?: string;
3
+ className?: string;
4
+ 'data-cy'?: string;
5
+ 'data-testid'?: string;
6
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es6",
4
+ "jsx": "react",
5
+ "allowSyntheticDefaultImports": true,
6
+ "moduleResolution": "node",
7
+ "baseUrl": "./",
8
+ "paths": {
9
+ "@/*": ["src/*"]
10
+ }
11
+ },
12
+ "include": ["./src/**/*"]
13
+ }
@@ -0,0 +1,35 @@
1
+ const HtmlWebpackPlugin = require('html-webpack-plugin');
2
+
3
+ process.env.NODE_ENV = 'development';
4
+ const host = process.env.HOST || 'localhost';
5
+
6
+ module.exports = {
7
+ mode: 'development',
8
+ devtool: 'inline-source-map',
9
+ entry: './src/index.tsx',
10
+ output: {
11
+ filename: 'static/js/bundle.js',
12
+ },
13
+ devServer: {
14
+ compress: true,
15
+ hot: true,
16
+ host,
17
+ port: 3000,
18
+ },
19
+ plugins: [new HtmlWebpackPlugin()],
20
+ module: {
21
+ rules: [
22
+ {
23
+ test: /\.m?[jt]sx$/,
24
+ exclude: /node_modules/,
25
+ use: {
26
+ loader: 'babel-loader',
27
+ },
28
+ },
29
+ ],
30
+ },
31
+ resolve: {
32
+ extensions: ['.mjs', '.js', '.cjs', '.jsx', '.tsx', '.ts'],
33
+ modules: ['node_modules'],
34
+ },
35
+ };