@newtonschool/grauity 0.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.
- package/CHANGELOG.md +22 -0
- package/LICENSE +674 -0
- package/README.md +15 -0
- package/dist/core/colors/colorTypes.d.ts +3 -0
- package/dist/core/colors/colorTypes.d.ts.map +1 -0
- package/dist/core/colors/index.d.ts +14 -0
- package/dist/core/colors/index.d.ts.map +1 -0
- package/dist/core/icons/iconTags.d.ts +16 -0
- package/dist/core/icons/iconTags.d.ts.map +1 -0
- package/dist/core/icons/iconTypes.d.ts +10 -0
- package/dist/core/icons/iconTypes.d.ts.map +1 -0
- package/dist/core/icons/index.d.ts +4 -0
- package/dist/core/icons/index.d.ts.map +1 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/miscellaneous-choices/index.d.ts +12 -0
- package/dist/core/miscellaneous-choices/index.d.ts.map +1 -0
- package/dist/core/miscellaneous-choices/miscellaneousTypes.d.ts +3 -0
- package/dist/core/miscellaneous-choices/miscellaneousTypes.d.ts.map +1 -0
- package/dist/core/sizes/index.d.ts +17 -0
- package/dist/core/sizes/index.d.ts.map +1 -0
- package/dist/core/sizes/sizeTypes.d.ts +3 -0
- package/dist/core/sizes/sizeTypes.d.ts.map +1 -0
- package/dist/elements/Icon/Icon.d.ts +115 -0
- package/dist/elements/Icon/Icon.d.ts.map +1 -0
- package/dist/elements/Icon/index.d.ts +3 -0
- package/dist/elements/Icon/index.d.ts.map +1 -0
- package/dist/elements/index.d.ts +3 -0
- package/dist/elements/index.d.ts.map +1 -0
- package/dist/helpers/classNameBuilders.d.ts +35 -0
- package/dist/helpers/classNameBuilders.d.ts.map +1 -0
- package/dist/helpers/getElementTypeFromProps.d.ts +14 -0
- package/dist/helpers/getElementTypeFromProps.d.ts.map +1 -0
- package/dist/helpers/index.d.ts +4 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/init/GrauityInit.d.ts +41 -0
- package/dist/init/GrauityInit.d.ts.map +1 -0
- package/dist/init/index.d.ts +3 -0
- package/dist/init/index.d.ts.map +1 -0
- package/dist/main.cjs +2 -0
- package/dist/main.cjs.map +1 -0
- package/dist/main.css +2 -0
- package/dist/main.css.map +1 -0
- package/dist/module.css +2 -0
- package/dist/module.css.map +1 -0
- package/dist/module.mjs +2 -0
- package/dist/module.mjs.map +1 -0
- package/package.json +158 -0
- package/ui/.gitkeep +0 -0
- package/ui/README.md +3 -0
- package/ui/core/README.md +4 -0
- package/ui/core/colors/colorTypes.d.ts.map +1 -0
- package/ui/core/colors/colorTypes.ts +21 -0
- package/ui/core/colors/index.d.ts.map +1 -0
- package/ui/core/colors/index.ts +25 -0
- package/ui/core/icons/iconTags.d.ts.map +1 -0
- package/ui/core/icons/iconTags.ts +15 -0
- package/ui/core/icons/iconTypes.d.ts.map +1 -0
- package/ui/core/icons/iconTypes.ts +21 -0
- package/ui/core/icons/index.d.ts.map +1 -0
- package/ui/core/icons/index.ts +5 -0
- package/ui/core/index.d.ts.map +1 -0
- package/ui/core/index.ts +17 -0
- package/ui/core/miscellaneous-choices/index.ts +24 -0
- package/ui/core/miscellaneous-choices/miscellaneousTypes.ts +3 -0
- package/ui/core/sizes/index.ts +29 -0
- package/ui/core/sizes/sizeTypes.ts +25 -0
- package/ui/css/animations.scss +8 -0
- package/ui/css/colors.scss +131 -0
- package/ui/css/fonts.scss +17 -0
- package/ui/css/icons.scss +92 -0
- package/ui/css/index.scss +11 -0
- package/ui/css/reset.scss +515 -0
- package/ui/css/sizes.scss +0 -0
- package/ui/elements/Icon/Icon.tsx +229 -0
- package/ui/elements/Icon/index.ts +3 -0
- package/ui/elements/index.ts +2 -0
- package/ui/helpers/README.md +3 -0
- package/ui/helpers/classNameBuilders.ts +48 -0
- package/ui/helpers/getElementTypeFromProps.ts +32 -0
- package/ui/helpers/index.ts +13 -0
- package/ui/index.ts +9 -0
- package/ui/init/GrauityInit.tsx +62 -0
- package/ui/init/index.ts +3 -0
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* # Gra.UI.ty 1.0.0 - Reset
|
|
3
|
+
* https://github.com/Newton-School/grauity
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* Released under the MIT license
|
|
7
|
+
* http://opensource.org/licenses/MIT
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/*******************************
|
|
13
|
+
Reset
|
|
14
|
+
*******************************/
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/* Border-Box */
|
|
18
|
+
*,
|
|
19
|
+
*:before,
|
|
20
|
+
*:after {
|
|
21
|
+
box-sizing: inherit;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
html {
|
|
25
|
+
box-sizing: border-box;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* iPad Input Shadows */
|
|
29
|
+
input[type="text"],
|
|
30
|
+
input[type="email"],
|
|
31
|
+
input[type="search"],
|
|
32
|
+
input[type="password"] {
|
|
33
|
+
-webkit-appearance: none;
|
|
34
|
+
-moz-appearance: none;
|
|
35
|
+
|
|
36
|
+
/* mobile firefox too! */
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/*! normalize.css v7.0.0 | MIT License | github.com/necolas/normalize.css */
|
|
40
|
+
|
|
41
|
+
/* Document
|
|
42
|
+
========================================================================== */
|
|
43
|
+
/**
|
|
44
|
+
* 1. Correct the line height in all browsers.
|
|
45
|
+
* 2. Prevent adjustments of font size after orientation changes in
|
|
46
|
+
* IE on Windows Phone and in iOS.
|
|
47
|
+
*/
|
|
48
|
+
html {
|
|
49
|
+
line-height: 1.15;
|
|
50
|
+
|
|
51
|
+
/* 1 */
|
|
52
|
+
-ms-text-size-adjust: 100%;
|
|
53
|
+
|
|
54
|
+
/* 2 */
|
|
55
|
+
-webkit-text-size-adjust: 100%;
|
|
56
|
+
|
|
57
|
+
/* 2 */
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/* Sections
|
|
61
|
+
========================================================================== */
|
|
62
|
+
/**
|
|
63
|
+
* Remove the margin in all browsers (opinionated).
|
|
64
|
+
*/
|
|
65
|
+
body {
|
|
66
|
+
margin: 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Add the correct display in IE 9-.
|
|
71
|
+
*/
|
|
72
|
+
article,
|
|
73
|
+
aside,
|
|
74
|
+
footer,
|
|
75
|
+
header,
|
|
76
|
+
nav,
|
|
77
|
+
section {
|
|
78
|
+
display: block;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Correct the font size and margin on `h1` elements within `section` and
|
|
83
|
+
* `article` contexts in Chrome, Firefox, and Safari.
|
|
84
|
+
*/
|
|
85
|
+
h1 {
|
|
86
|
+
font-size: 2em;
|
|
87
|
+
margin: 0.67em 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* Grouping content
|
|
91
|
+
========================================================================== */
|
|
92
|
+
/**
|
|
93
|
+
* Add the correct display in IE 9-.
|
|
94
|
+
* 1. Add the correct display in IE.
|
|
95
|
+
*/
|
|
96
|
+
figcaption,
|
|
97
|
+
figure,
|
|
98
|
+
main {
|
|
99
|
+
|
|
100
|
+
/* 1 */
|
|
101
|
+
display: block;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Add the correct margin in IE 8.
|
|
106
|
+
*/
|
|
107
|
+
figure {
|
|
108
|
+
margin: 1em 40px;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 1. Add the correct box sizing in Firefox.
|
|
113
|
+
* 2. Show the overflow in Edge and IE.
|
|
114
|
+
*/
|
|
115
|
+
hr {
|
|
116
|
+
box-sizing: content-box;
|
|
117
|
+
|
|
118
|
+
/* 1 */
|
|
119
|
+
height: 0;
|
|
120
|
+
|
|
121
|
+
/* 1 */
|
|
122
|
+
overflow: visible;
|
|
123
|
+
|
|
124
|
+
/* 2 */
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* 1. Correct the inheritance and scaling of font size in all browsers.
|
|
129
|
+
* 2. Correct the odd `em` font sizing in all browsers.
|
|
130
|
+
*/
|
|
131
|
+
pre {
|
|
132
|
+
font-family: monospace, monospace;
|
|
133
|
+
|
|
134
|
+
/* 1 */
|
|
135
|
+
font-size: 1em;
|
|
136
|
+
|
|
137
|
+
/* 2 */
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/* Text-level semantics
|
|
141
|
+
========================================================================== */
|
|
142
|
+
/**
|
|
143
|
+
* 1. Remove the gray background on active links in IE 10.
|
|
144
|
+
* 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
|
|
145
|
+
*/
|
|
146
|
+
a {
|
|
147
|
+
background-color: transparent;
|
|
148
|
+
|
|
149
|
+
/* 1 */
|
|
150
|
+
-webkit-text-decoration-skip: objects;
|
|
151
|
+
|
|
152
|
+
/* 2 */
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* 1. Remove the bottom border in Chrome 57- and Firefox 39-.
|
|
157
|
+
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
|
|
158
|
+
*/
|
|
159
|
+
abbr[title] {
|
|
160
|
+
border-bottom: none;
|
|
161
|
+
|
|
162
|
+
/* 1 */
|
|
163
|
+
text-decoration: underline;
|
|
164
|
+
|
|
165
|
+
/* 2 */
|
|
166
|
+
-webkit-text-decoration: underline dotted;
|
|
167
|
+
text-decoration: underline dotted;
|
|
168
|
+
|
|
169
|
+
/* 2 */
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Prevent the duplicate application of `bolder` by the next rule in Safari 6.
|
|
174
|
+
*/
|
|
175
|
+
b,
|
|
176
|
+
strong {
|
|
177
|
+
font-weight: inherit;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Add the correct font weight in Chrome, Edge, and Safari.
|
|
182
|
+
*/
|
|
183
|
+
b,
|
|
184
|
+
strong {
|
|
185
|
+
font-weight: bolder;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* 1. Correct the inheritance and scaling of font size in all browsers.
|
|
190
|
+
* 2. Correct the odd `em` font sizing in all browsers.
|
|
191
|
+
*/
|
|
192
|
+
code,
|
|
193
|
+
kbd,
|
|
194
|
+
samp {
|
|
195
|
+
font-family: monospace, monospace;
|
|
196
|
+
|
|
197
|
+
/* 1 */
|
|
198
|
+
font-size: 1em;
|
|
199
|
+
|
|
200
|
+
/* 2 */
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Add the correct font style in Android 4.3-.
|
|
205
|
+
*/
|
|
206
|
+
dfn {
|
|
207
|
+
font-style: italic;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Add the correct background and color in IE 9-.
|
|
212
|
+
*/
|
|
213
|
+
mark {
|
|
214
|
+
background-color: #ff0;
|
|
215
|
+
color: #000;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Add the correct font size in all browsers.
|
|
220
|
+
*/
|
|
221
|
+
small {
|
|
222
|
+
font-size: 80%;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Prevent `sub` and `sup` elements from affecting the line height in
|
|
227
|
+
* all browsers.
|
|
228
|
+
*/
|
|
229
|
+
sub,
|
|
230
|
+
sup {
|
|
231
|
+
font-size: 75%;
|
|
232
|
+
line-height: 0;
|
|
233
|
+
position: relative;
|
|
234
|
+
vertical-align: baseline;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
sub {
|
|
238
|
+
bottom: -0.25em;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
sup {
|
|
242
|
+
top: -0.5em;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/* Embedded content
|
|
246
|
+
========================================================================== */
|
|
247
|
+
/**
|
|
248
|
+
* Add the correct display in IE 9-.
|
|
249
|
+
*/
|
|
250
|
+
audio,
|
|
251
|
+
video {
|
|
252
|
+
display: inline-block;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Add the correct display in iOS 4-7.
|
|
257
|
+
*/
|
|
258
|
+
audio:not([controls]) {
|
|
259
|
+
display: none;
|
|
260
|
+
height: 0;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Remove the border on images inside links in IE 10-.
|
|
265
|
+
*/
|
|
266
|
+
img {
|
|
267
|
+
border-style: none;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Hide the overflow in IE.
|
|
272
|
+
*/
|
|
273
|
+
svg:not(:root) {
|
|
274
|
+
overflow: hidden;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/* Forms
|
|
278
|
+
========================================================================== */
|
|
279
|
+
/**
|
|
280
|
+
* 1. Change the font styles in all browsers (opinionated).
|
|
281
|
+
* 2. Remove the margin in Firefox and Safari.
|
|
282
|
+
*/
|
|
283
|
+
button,
|
|
284
|
+
input,
|
|
285
|
+
optgroup,
|
|
286
|
+
select,
|
|
287
|
+
textarea {
|
|
288
|
+
font-family: sans-serif;
|
|
289
|
+
|
|
290
|
+
/* 1 */
|
|
291
|
+
font-size: 100%;
|
|
292
|
+
|
|
293
|
+
/* 1 */
|
|
294
|
+
line-height: 1.15;
|
|
295
|
+
|
|
296
|
+
/* 1 */
|
|
297
|
+
margin: 0;
|
|
298
|
+
|
|
299
|
+
/* 2 */
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Show the overflow in IE.
|
|
304
|
+
* 1. Show the overflow in Edge.
|
|
305
|
+
*/
|
|
306
|
+
button,
|
|
307
|
+
input {
|
|
308
|
+
|
|
309
|
+
/* 1 */
|
|
310
|
+
overflow: visible;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Remove the inheritance of text transform in Edge, Firefox, and IE.
|
|
315
|
+
* 1. Remove the inheritance of text transform in Firefox.
|
|
316
|
+
*/
|
|
317
|
+
button,
|
|
318
|
+
select {
|
|
319
|
+
|
|
320
|
+
/* 1 */
|
|
321
|
+
text-transform: none;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
|
|
326
|
+
* controls in Android 4.
|
|
327
|
+
* 2. Correct the inability to style clickable types in iOS and Safari.
|
|
328
|
+
*/
|
|
329
|
+
button,
|
|
330
|
+
html [type="button"],
|
|
331
|
+
[type="reset"],
|
|
332
|
+
[type="submit"] {
|
|
333
|
+
-webkit-appearance: button;
|
|
334
|
+
|
|
335
|
+
/* 2 */
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Remove the inner border and padding in Firefox.
|
|
340
|
+
*/
|
|
341
|
+
button::-moz-focus-inner,
|
|
342
|
+
[type="button"]::-moz-focus-inner,
|
|
343
|
+
[type="reset"]::-moz-focus-inner,
|
|
344
|
+
[type="submit"]::-moz-focus-inner {
|
|
345
|
+
border-style: none;
|
|
346
|
+
padding: 0;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Restore the focus styles unset by the previous rule.
|
|
351
|
+
*/
|
|
352
|
+
button:-moz-focusring,
|
|
353
|
+
[type="button"]:-moz-focusring,
|
|
354
|
+
[type="reset"]:-moz-focusring,
|
|
355
|
+
[type="submit"]:-moz-focusring {
|
|
356
|
+
outline: 1px dotted ButtonText;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Correct the padding in Firefox.
|
|
361
|
+
*/
|
|
362
|
+
fieldset {
|
|
363
|
+
padding: 0.35em 0.75em 0.625em;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* 1. Correct the text wrapping in Edge and IE.
|
|
368
|
+
* 2. Correct the color inheritance from `fieldset` elements in IE.
|
|
369
|
+
* 3. Remove the padding so developers are not caught out when they zero out
|
|
370
|
+
* `fieldset` elements in all browsers.
|
|
371
|
+
*/
|
|
372
|
+
legend {
|
|
373
|
+
box-sizing: border-box;
|
|
374
|
+
|
|
375
|
+
/* 1 */
|
|
376
|
+
color: inherit;
|
|
377
|
+
|
|
378
|
+
/* 2 */
|
|
379
|
+
display: table;
|
|
380
|
+
|
|
381
|
+
/* 1 */
|
|
382
|
+
max-width: 100%;
|
|
383
|
+
|
|
384
|
+
/* 1 */
|
|
385
|
+
padding: 0;
|
|
386
|
+
|
|
387
|
+
/* 3 */
|
|
388
|
+
white-space: normal;
|
|
389
|
+
|
|
390
|
+
/* 1 */
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* 1. Add the correct display in IE 9-.
|
|
395
|
+
* 2. Add the correct vertical alignment in Chrome, Firefox, and Opera.
|
|
396
|
+
*/
|
|
397
|
+
progress {
|
|
398
|
+
display: inline-block;
|
|
399
|
+
|
|
400
|
+
/* 1 */
|
|
401
|
+
vertical-align: baseline;
|
|
402
|
+
|
|
403
|
+
/* 2 */
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Remove the default vertical scrollbar in IE.
|
|
408
|
+
*/
|
|
409
|
+
textarea {
|
|
410
|
+
overflow: auto;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* 1. Add the correct box sizing in IE 10-.
|
|
415
|
+
* 2. Remove the padding in IE 10-.
|
|
416
|
+
*/
|
|
417
|
+
[type="checkbox"],
|
|
418
|
+
[type="radio"] {
|
|
419
|
+
box-sizing: border-box;
|
|
420
|
+
|
|
421
|
+
/* 1 */
|
|
422
|
+
padding: 0;
|
|
423
|
+
|
|
424
|
+
/* 2 */
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Correct the cursor style of increment and decrement buttons in Chrome.
|
|
429
|
+
*/
|
|
430
|
+
[type="number"]::-webkit-inner-spin-button,
|
|
431
|
+
[type="number"]::-webkit-outer-spin-button {
|
|
432
|
+
height: auto;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* 1. Correct the odd appearance in Chrome and Safari.
|
|
437
|
+
* 2. Correct the outline style in Safari.
|
|
438
|
+
*/
|
|
439
|
+
[type="search"] {
|
|
440
|
+
-webkit-appearance: textfield;
|
|
441
|
+
|
|
442
|
+
/* 1 */
|
|
443
|
+
outline-offset: -2px;
|
|
444
|
+
|
|
445
|
+
/* 2 */
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
|
+
* Remove the inner padding and cancel buttons in Chrome and Safari on macOS.
|
|
450
|
+
*/
|
|
451
|
+
[type="search"]::-webkit-search-cancel-button,
|
|
452
|
+
[type="search"]::-webkit-search-decoration {
|
|
453
|
+
-webkit-appearance: none;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* 1. Correct the inability to style clickable types in iOS and Safari.
|
|
458
|
+
* 2. Change font properties to `inherit` in Safari.
|
|
459
|
+
*/
|
|
460
|
+
::-webkit-file-upload-button {
|
|
461
|
+
-webkit-appearance: button;
|
|
462
|
+
|
|
463
|
+
/* 1 */
|
|
464
|
+
font: inherit;
|
|
465
|
+
|
|
466
|
+
/* 2 */
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/* Interactive
|
|
470
|
+
========================================================================== */
|
|
471
|
+
/*
|
|
472
|
+
* Add the correct display in IE 9-.
|
|
473
|
+
* 1. Add the correct display in Edge, IE, and Firefox.
|
|
474
|
+
*/
|
|
475
|
+
details,
|
|
476
|
+
menu {
|
|
477
|
+
display: block;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/*
|
|
481
|
+
* Add the correct display in all browsers.
|
|
482
|
+
*/
|
|
483
|
+
summary {
|
|
484
|
+
display: list-item;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
/* Scripting
|
|
488
|
+
========================================================================== */
|
|
489
|
+
/**
|
|
490
|
+
* Add the correct display in IE 9-.
|
|
491
|
+
*/
|
|
492
|
+
canvas {
|
|
493
|
+
display: inline-block;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Add the correct display in IE.
|
|
498
|
+
*/
|
|
499
|
+
template {
|
|
500
|
+
display: none;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/* Hidden
|
|
504
|
+
========================================================================== */
|
|
505
|
+
/**
|
|
506
|
+
* Add the correct display in IE 10-.
|
|
507
|
+
*/
|
|
508
|
+
[hidden] {
|
|
509
|
+
display: none;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
/*******************************
|
|
514
|
+
Site Overrides
|
|
515
|
+
*******************************/
|
|
File without changes
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
getElementTypeFromProps,
|
|
8
|
+
useKeyOnly,
|
|
9
|
+
useValueAndKey,
|
|
10
|
+
} from '../../helpers';
|
|
11
|
+
import {
|
|
12
|
+
GRAUITY_ICON_COLORS,
|
|
13
|
+
GRAUITY_ICON_FLIPPED_CHOICES,
|
|
14
|
+
GRAUITY_ICON_ROTATED_CHOICES,
|
|
15
|
+
GRAUITY_ICON_SIZES,
|
|
16
|
+
grauityFlippedChoiceName,
|
|
17
|
+
grauityIconColorName,
|
|
18
|
+
grauityIconName,
|
|
19
|
+
grauityIconSizeName,
|
|
20
|
+
grauityRotatedChoiceName,
|
|
21
|
+
ICON_TAGS,
|
|
22
|
+
} from '../../core';
|
|
23
|
+
|
|
24
|
+
export interface IconProps {
|
|
25
|
+
/**
|
|
26
|
+
* Icon can have the aria hidden attribute
|
|
27
|
+
* */
|
|
28
|
+
ariaHidden?: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Icon can have the aria label attribute
|
|
32
|
+
* */
|
|
33
|
+
ariaLabel?: string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* An element type to render as (string or function).
|
|
37
|
+
* */
|
|
38
|
+
as?: React.ElementType;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Format the icon to appear bordered
|
|
42
|
+
* */
|
|
43
|
+
bordered?: boolean;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Format the icon to appear circular
|
|
47
|
+
* */
|
|
48
|
+
circular?: boolean;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Color of the icon
|
|
52
|
+
* */
|
|
53
|
+
color?: grauityIconColorName;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Additional classes to be added to the component
|
|
57
|
+
* */
|
|
58
|
+
className?: string;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Show that the icon is inactive
|
|
62
|
+
* */
|
|
63
|
+
disabled?: boolean;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Fitted, without space to left or right of Icon
|
|
67
|
+
* */
|
|
68
|
+
fitted?: boolean;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Icon can be flipped
|
|
72
|
+
* */
|
|
73
|
+
flipped?: grauityFlippedChoiceName;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The colors of the icon can be inverted in case of used with border
|
|
77
|
+
* * */
|
|
78
|
+
inverted?: boolean;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Icon can be formatted as a link
|
|
82
|
+
* */
|
|
83
|
+
link?: boolean;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Icon can be used as a simple loader
|
|
87
|
+
* */
|
|
88
|
+
loading?: boolean;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Name of the icon
|
|
92
|
+
* */
|
|
93
|
+
name: grauityIconName;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Icon can be rotated
|
|
97
|
+
* */
|
|
98
|
+
rotated?: grauityRotatedChoiceName;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Size of the icon
|
|
102
|
+
* */
|
|
103
|
+
size?: grauityIconSizeName;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Additional styles to be used over the element
|
|
107
|
+
* */
|
|
108
|
+
style?: React.CSSProperties;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function Icon({
|
|
112
|
+
ariaHidden,
|
|
113
|
+
ariaLabel,
|
|
114
|
+
as,
|
|
115
|
+
bordered,
|
|
116
|
+
circular,
|
|
117
|
+
color,
|
|
118
|
+
className,
|
|
119
|
+
disabled,
|
|
120
|
+
fitted,
|
|
121
|
+
flipped,
|
|
122
|
+
inverted,
|
|
123
|
+
link,
|
|
124
|
+
loading,
|
|
125
|
+
name,
|
|
126
|
+
rotated,
|
|
127
|
+
size,
|
|
128
|
+
style,
|
|
129
|
+
...props
|
|
130
|
+
}: IconProps) {
|
|
131
|
+
const Element = getElementTypeFromProps({ as });
|
|
132
|
+
|
|
133
|
+
const getIconAriaOptions = () => {
|
|
134
|
+
const ariaOptions: {
|
|
135
|
+
'aria-hidden'?: string;
|
|
136
|
+
'aria-label'?: string;
|
|
137
|
+
} = {};
|
|
138
|
+
|
|
139
|
+
if (_.isNil(ariaLabel)) {
|
|
140
|
+
ariaOptions['aria-hidden'] = 'true';
|
|
141
|
+
} else {
|
|
142
|
+
ariaOptions['aria-label'] = ariaLabel;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (!_.isNil(ariaHidden)) {
|
|
146
|
+
ariaOptions['aria-hidden'] = ariaHidden;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return ariaOptions;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const handleClick = (e?: any) => {
|
|
153
|
+
if (disabled) {
|
|
154
|
+
e.preventDefault();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
_.invoke(props, 'onClick', e, props);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const ariaOptions = getIconAriaOptions();
|
|
162
|
+
|
|
163
|
+
const classes = classnames(
|
|
164
|
+
'grauity-icon',
|
|
165
|
+
`grauity-icon-${name}`,
|
|
166
|
+
`size-${size}`,
|
|
167
|
+
useKeyOnly(color, color),
|
|
168
|
+
useKeyOnly(bordered, 'bordered'),
|
|
169
|
+
useKeyOnly(circular, 'circular'),
|
|
170
|
+
useKeyOnly(disabled, 'disabled'),
|
|
171
|
+
useKeyOnly(fitted, 'fitted'),
|
|
172
|
+
useKeyOnly(inverted, 'inverted'),
|
|
173
|
+
useKeyOnly(link, 'link'),
|
|
174
|
+
useKeyOnly(loading, 'loading'),
|
|
175
|
+
useValueAndKey(flipped, 'flipped'),
|
|
176
|
+
useValueAndKey(rotated, 'rotated'),
|
|
177
|
+
className
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
return (
|
|
181
|
+
<Element
|
|
182
|
+
onClick={handleClick}
|
|
183
|
+
{...ariaOptions}
|
|
184
|
+
className={classes}
|
|
185
|
+
style={style}
|
|
186
|
+
/>
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
Icon.propTypes = {
|
|
191
|
+
ariaHidden: PropTypes.string,
|
|
192
|
+
ariaLabel: PropTypes.string,
|
|
193
|
+
as: PropTypes.elementType,
|
|
194
|
+
bordered: PropTypes.bool,
|
|
195
|
+
circular: PropTypes.bool,
|
|
196
|
+
color: PropTypes.oneOf(GRAUITY_ICON_COLORS),
|
|
197
|
+
className: PropTypes.string,
|
|
198
|
+
disabled: PropTypes.bool,
|
|
199
|
+
fitted: PropTypes.bool,
|
|
200
|
+
flipped: PropTypes.oneOf(GRAUITY_ICON_FLIPPED_CHOICES),
|
|
201
|
+
inverted: PropTypes.bool,
|
|
202
|
+
link: PropTypes.bool,
|
|
203
|
+
loading: PropTypes.bool,
|
|
204
|
+
name: PropTypes.oneOf(Object.keys(ICON_TAGS)).isRequired,
|
|
205
|
+
rotated: PropTypes.oneOf(GRAUITY_ICON_ROTATED_CHOICES),
|
|
206
|
+
size: PropTypes.oneOf(GRAUITY_ICON_SIZES),
|
|
207
|
+
style: PropTypes.object,
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
Icon.defaultProps = {
|
|
211
|
+
ariaHidden: 'true',
|
|
212
|
+
ariaLabel: undefined,
|
|
213
|
+
as: 'i',
|
|
214
|
+
bordered: false,
|
|
215
|
+
circular: false,
|
|
216
|
+
color: 'grey',
|
|
217
|
+
className: undefined,
|
|
218
|
+
disabled: false,
|
|
219
|
+
fitted: false,
|
|
220
|
+
flipped: undefined,
|
|
221
|
+
inverted: false,
|
|
222
|
+
link: false,
|
|
223
|
+
loading: false,
|
|
224
|
+
rotated: undefined,
|
|
225
|
+
size: '16',
|
|
226
|
+
style: undefined,
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
export default Icon;
|