@capillarytech/blaze-ui 0.1.6-alpha.4 → 0.1.6-alpha.40

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 (94) hide show
  1. package/CapInput/CapInput.js +1 -1
  2. package/CapInput/Number.js +1 -1
  3. package/CapInput/Search.js +1 -1
  4. package/CapInput/TextArea.js +1 -1
  5. package/CapSkeleton/CapSkeleton.js +17 -0
  6. package/CapSkeleton/index.js +1 -0
  7. package/CapSpin/CapSpin.js +23 -0
  8. package/CapSpin/index.js +1 -0
  9. package/CapTable/loadable.js +4 -4
  10. package/CapTable/styles.js +1 -1
  11. package/CapTestSelect/CapTestSelect.js +47 -0
  12. package/CapTestSelect/index.js +1 -0
  13. package/CapUnifiedSelect/CapUnifiedSelect.js +249 -59
  14. package/CapUnifiedSelect/index.js +1 -4
  15. package/CapUnifiedSelect/styles.js +272 -26
  16. package/assets/upload.svg +3 -0
  17. package/index.js +7 -1
  18. package/package.json +7 -11
  19. package/utils/index.js +1 -0
  20. package/utils/withStyles.js +24 -0
  21. package/CapHeading/CapHeading.js +0 -71
  22. package/CapHeading/index.js +0 -1
  23. package/CapHeading/styles.js +0 -125
  24. package/CapInfoNote/CapInfoNote.js +0 -54
  25. package/CapInfoNote/index.js +0 -1
  26. package/CapInfoNote/styles.js +0 -63
  27. package/CapInput/loadable.js +0 -9
  28. package/CapLabel/CapLabel.js +0 -106
  29. package/CapLabel/index.js +0 -1
  30. package/CapLabel/styles.js +0 -221
  31. package/CapRow/CapRow.js +0 -22
  32. package/CapRow/index.js +0 -1
  33. package/CapRow/styles.js +0 -9
  34. package/CapTooltip/CapTooltip.js +0 -36
  35. package/CapTooltip/index.js +0 -1
  36. package/CapTooltip/styles.js +0 -42
  37. package/CapUnifiedSelect/loadable.js +0 -3
  38. package/dist/235.index.js +0 -2
  39. package/dist/235.index.js.LICENSE.txt +0 -29
  40. package/dist/603.index.js +0 -1
  41. package/dist/CapInput/CapInput.js +0 -66
  42. package/dist/CapInput/Number.js +0 -42
  43. package/dist/CapInput/Search.js +0 -35
  44. package/dist/CapInput/TextArea.js +0 -42
  45. package/dist/CapInput/index.js +0 -15
  46. package/dist/CapInput/messages.js +0 -32
  47. package/dist/CapInput/styles.js +0 -11
  48. package/dist/CapTable/CapTable.js +0 -148
  49. package/dist/CapTable/index.js +0 -9
  50. package/dist/CapTable/loadable.js +0 -23
  51. package/dist/CapTable/styles.js +0 -26
  52. package/dist/LocaleHoc/index.js +0 -40
  53. package/dist/esm/CapHeading/CapHeading.js +0 -41
  54. package/dist/esm/CapHeading/index.js +0 -1
  55. package/dist/esm/CapHeading/styles.js +0 -123
  56. package/dist/esm/CapInfoNote/CapInfoNote.js +0 -62
  57. package/dist/esm/CapInfoNote/index.js +0 -1
  58. package/dist/esm/CapInfoNote/styles.js +0 -6
  59. package/dist/esm/CapInput/CapInput.js +0 -57
  60. package/dist/esm/CapInput/Number.js +0 -35
  61. package/dist/esm/CapInput/Search.js +0 -28
  62. package/dist/esm/CapInput/TextArea.js +0 -35
  63. package/dist/esm/CapInput/index.js +0 -8
  64. package/dist/esm/CapInput/loadable.js +0 -9
  65. package/dist/esm/CapInput/messages.js +0 -25
  66. package/dist/esm/CapInput/styles.js +0 -3
  67. package/dist/esm/CapLabel/CapLabel.js +0 -50
  68. package/dist/esm/CapLabel/index.js +0 -1
  69. package/dist/esm/CapLabel/styles.js +0 -219
  70. package/dist/esm/CapRow/CapRow.js +0 -22
  71. package/dist/esm/CapRow/index.js +0 -1
  72. package/dist/esm/CapRow/styles.js +0 -5
  73. package/dist/esm/CapTable/CapTable.js +0 -140
  74. package/dist/esm/CapTable/index.js +0 -2
  75. package/dist/esm/CapTable/loadable.js +0 -12
  76. package/dist/esm/CapTable/styles.js +0 -17
  77. package/dist/esm/CapTooltip/CapTooltip.js +0 -34
  78. package/dist/esm/CapTooltip/index.js +0 -1
  79. package/dist/esm/CapTooltip/styles.js +0 -6
  80. package/dist/esm/CapUnifiedSelect/CapUnifiedSelect.js +0 -101
  81. package/dist/esm/CapUnifiedSelect/index.js +0 -3
  82. package/dist/esm/CapUnifiedSelect/loadable.js +0 -4
  83. package/dist/esm/CapUnifiedSelect/messages.js +0 -23
  84. package/dist/esm/CapUnifiedSelect/styles.js +0 -15
  85. package/dist/esm/LocaleHoc/index.js +0 -31
  86. package/dist/esm/index.js +0 -11
  87. package/dist/esm/styled/index.js +0 -5
  88. package/dist/esm/styled/variables.js +0 -88
  89. package/dist/esm/translations/en.js +0 -329
  90. package/dist/index.js +0 -39
  91. package/dist/index.js.LICENSE.txt +0 -7
  92. package/dist/styled/index.js +0 -22
  93. package/dist/styled/variables.js +0 -94
  94. package/dist/translations/en.js +0 -335
@@ -23,26 +23,142 @@ export const HeaderWrapper = styled.div`
23
23
  }
24
24
  `;
25
25
 
26
+ export const DropdownFooter = styled.div`
27
+ display: flex;
28
+ justify-content: space-between;
29
+ align-items: center;
30
+ padding: 8px;
31
+ border-top: 1px solid #f0f0f0;
32
+
33
+ .footer-buttons {
34
+ display: flex;
35
+ align-items: center;
36
+ gap: 8px;
37
+ }
38
+
39
+ .total-count {
40
+ color: #8c8c8c;
41
+ font-size: 12px;
42
+ }
43
+ `;
44
+
45
+ export const SearchInputWrapper = styled.div`
46
+ padding: 8px;
47
+ border-bottom: 1px solid #f0f0f0;
48
+ `;
49
+
50
+ export const SelectAllCheckbox = styled.div`
51
+ display: flex;
52
+ align-items: center;
53
+ padding: 8px 12px;
54
+ cursor: pointer;
55
+ font-weight: 500;
56
+ border-bottom: 1px solid #f0f0f0;
57
+ user-select: none;
58
+
59
+ input[type="checkbox"] {
60
+ cursor: pointer;
61
+ }
62
+ `;
63
+
64
+ export const NoResultWrapper = styled.div`
65
+ display: flex;
66
+ flex-direction: column;
67
+ align-items: center;
68
+ justify-content: center;
69
+ height: 200px;
70
+ color: #8c8c8c;
71
+ font-size: 14px;
72
+ `;
73
+
26
74
 
27
75
 
28
76
  export const StyledInfoIcon = styled.span`
29
- color: ${styledVars.CAP_G2};
77
+ color: ${styledVars.CAP_G05};
30
78
  font-size: 16px;
31
79
  cursor: help;
80
+ margin-left: 4px;
81
+ display: flex;
82
+ align-items: center;
32
83
 
33
84
  &:hover {
34
- color: ${styledVars.CAP_G1};
85
+ color: ${styledVars.CAP_G03};
35
86
  }
36
87
 
37
88
  &.disabled {
38
89
  cursor: not-allowed;
39
90
  &:hover {
40
- color: ${styledVars.CAP_G2};
91
+ color: ${styledVars.CAP_G05};
41
92
  }
42
93
  }
43
94
  `;
44
95
 
45
96
  export const selectStyles = css`
97
+ &.cap-unified-select-container {
98
+ .cap-unified-tree-select{
99
+ height: 32px !important;
100
+ width: 340px !important;
101
+ }
102
+ .ant-select-prefix{
103
+ font-size: 14px !important;
104
+ font-weight: 400 !important;
105
+ color: #091E42 !important;
106
+ line-height: 20px !important;
107
+ }
108
+ .cap-unified-select-header-label{
109
+ font-family: ${styledVars.FONT_FAMILY} !important;
110
+ font-weight: 500 !important;
111
+ font-size: 14px !important;
112
+ line-height: 20px !important;
113
+ letter-spacing: 0px !important;
114
+ }
115
+ .cap-unified-select-header-tooltip{
116
+ width: 16px !important;
117
+ height: 16px !important;
118
+ color: #B3BAC5 !important;
119
+ }
120
+ .cap-unified-select-header-byline-text{
121
+ font-family: ${styledVars.FONT_FAMILY} !important;
122
+ font-weight: 400 !important;
123
+ font-size: 12px !important;
124
+ margin-top: -10px;
125
+ letter-spacing: 0px !important;
126
+ color: #97A0AF !important;
127
+ }
128
+ .cap-unified-tree-select .ant-select-selector:hover{
129
+ border: 1px solid #7A869A !important;
130
+ }
131
+ .cap-unified-tree-select .select-popup-container .ant-select-tree-switcher-noop,
132
+ .cap-unified-tree-select .multiSelect-popup-container .ant-select-tree-switcher-noop {
133
+ display: none !important;
134
+ }
135
+ .ant-tree-select-dropdown .treeSelect-popup-container .ant-select-tree .ant-select-tree-treenode{
136
+ margin: 0px !important;
137
+ }
138
+ .cap-unified-tree-select .multiSelect-popup-container .ant-tree-select-dropdown .ant-select-tree .ant-select-tree-treenode{
139
+ margin-left: 10px !important;
140
+ }
141
+ .multiSelect-popup-container .ant-select-tree-treenode{
142
+ margin-left: 10px !important;
143
+ }
144
+ .cap-unified-select-no-result{
145
+ display: flex;
146
+ flex-direction: column;
147
+ align-items: center;
148
+ justify-content: center;
149
+ height: 200px;
150
+ color: #8c8c8c;
151
+ font-size: 14px;
152
+ }
153
+ .cap-unified-select-no-result-icon{
154
+ font-size: 36px;
155
+ margin-bottom: 8px;
156
+ color: #bfbfbf;
157
+ }
158
+ .cap-unified-select-no-result-text{
159
+ font-weight: 500;
160
+ }
161
+ }
46
162
  &.cap-unified-select {
47
163
  width: 100%;
48
164
  font-family: ${styledVars.FONT_FAMILY};
@@ -91,30 +207,54 @@ export const selectStyles = css`
91
207
  }
92
208
 
93
209
  /* Dropdown styles */
94
- .ant-select-dropdown {
95
- padding: 4px;
96
- border-radius: ${styledVars.RADIUS_04};
97
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
98
-
99
- .ant-select-item {
100
- border-radius: ${styledVars.RADIUS_04};
101
- padding: 8px 12px;
102
- transition: ${styledVars.TRANSITION_ALL};
210
+ .ant-select-dropdown,
211
+ &.ant-select-dropdown,
212
+ &.ant-select-dropdown-placement-bottomLeft {
213
+ padding: 0;
214
+ border-radius: 12px !important;
215
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
216
+ overflow: hidden;
217
+
218
+ /* Option base style - no background */
219
+ .ant-select-item-option {
220
+ padding: 10px 16px;
221
+ font-size: 14px;
222
+ color: #1c2530;
223
+ font-weight: 500;
224
+ background-color: transparent !important;
225
+
226
+ /* Hover state only */
227
+ &:not(.ant-select-item-option-disabled):hover {
228
+ background-color: #fffbe6 !important;
229
+ border-radius: 4px;
230
+ color: #1c2530 !important;
231
+ }
232
+
233
+ /* Ensure unselected hover has proper background even after removal */
234
+ &:hover:not(.ant-select-item-option-disabled):not(.ant-select-item-option-selected) {
235
+ background-color: #fffbe6 !important;
236
+ color: #1c2530 !important;
237
+ border-radius: 4px;
238
+ }
103
239
 
104
- &-option-selected {
105
- background-color: ${styledVars.CAP_PRIMARY.light};
106
- color: ${styledVars.CAP_PRIMARY.base};
240
+ /* Selected state */
241
+ &-selected:not(.ant-select-item-option-disabled) {
242
+ background-color: #e9f0fe !important;
243
+ color: #1c2530 !important;
107
244
  font-weight: 500;
108
245
  }
109
246
 
110
- &-option-active {
111
- background-color: ${styledVars.CAP_G08};
247
+ /* Remove active state background unless hovered */
248
+ &-active:not(:hover):not(.ant-select-item-option-disabled) {
249
+ background-color: transparent !important;
112
250
  }
113
251
  }
114
252
 
115
253
  /* Search input styles */
254
+ .ant-select-dropdown-search,
116
255
  .ant-select-search {
117
- padding: 8px;
256
+ padding: 8px 12px;
257
+ border-bottom: 1px solid #f0f0f0;
118
258
 
119
259
  input {
120
260
  border-radius: ${styledVars.RADIUS_04};
@@ -126,15 +266,90 @@ export const selectStyles = css`
126
266
  }
127
267
  }
128
268
  }
269
+
270
+ /* Scrollbar */
271
+ .rc-virtual-list-scrollbar-thumb {
272
+ background-color: #dcdcdc;
273
+ border-radius: 4px;
274
+ }
275
+
276
+ /* Divider */
277
+ .ant-divider-horizontal {
278
+ margin: 0;
279
+ }
280
+
281
+ /* No result UI */
282
+ .no-result {
283
+ display: flex;
284
+ flex-direction: column;
285
+ align-items: center;
286
+ justify-content: center;
287
+ height: 200px;
288
+ color: #8c8c8c;
289
+ font-size: 14px;
290
+ }
291
+
292
+ /* Dropdown search inside custom popup */
293
+ .dropdown-search {
294
+ padding: 8px;
295
+ border-bottom: 1px solid #f0f0f0;
296
+ }
297
+
298
+ /* Select all checkbox */
299
+ .select-all-checkbox {
300
+ display: flex;
301
+ align-items: center;
302
+ padding: 8px 12px;
303
+ cursor: pointer;
304
+ font-weight: 500;
305
+ border-bottom: 1px solid #f0f0f0;
306
+ user-select: none;
307
+
308
+ input[type="checkbox"] {
309
+ cursor: pointer;
310
+ }
311
+ }
312
+
313
+ /* Footer buttons */
314
+ .dropdown-footer {
315
+ display: flex;
316
+ justify-content: space-between;
317
+ align-items: center;
318
+ padding: 8px;
319
+ border-top: 1px solid #f0f0f0;
320
+ }
321
+
322
+ /* Selected counter */
323
+ .selected-count {
324
+ color: #8c8c8c;
325
+ font-size: 12px;
326
+ }
327
+
328
+ /* Unchecked border color */
329
+ .ant-checkbox-inner {
330
+ border-color: #42b040; /* Your desired border color */
331
+ }
332
+
333
+ /* When checked - change background and border */
334
+ .ant-checkbox-checked .ant-checkbox-inner {
335
+ background-color: #42b040; /* Fill color when checked */
336
+ border-color: #42b040;
337
+ }
338
+
339
+ /* Checkmark color */
340
+ .ant-checkbox-checked .ant-checkbox-inner::after {
341
+ border-color: #42b040; /* The checkmark tick color */
342
+ }
129
343
  }
130
344
 
131
345
  /* Multiple selection styles */
132
346
  &.ant-select-multiple {
133
347
  .ant-select-selection-item {
134
- background-color: ${styledVars.CAP_PRIMARY.light};
135
- border-color: ${styledVars.CAP_PRIMARY.light};
348
+ background-color: #e9f0fe !important;
349
+ border: none;
136
350
  border-radius: ${styledVars.RADIUS_04};
137
- color: ${styledVars.CAP_PRIMARY.base};
351
+ color: #1c2530;
352
+ font-weight: 500;
138
353
  margin: 2px 4px 2px 0;
139
354
  padding: 0 8px;
140
355
  height: 24px;
@@ -162,15 +377,17 @@ export const selectStyles = css`
162
377
  .ant-select-tree-node-content-wrapper {
163
378
  padding: 4px 8px;
164
379
  border-radius: ${styledVars.RADIUS_04};
165
- transition: ${styledVars.TRANSITION_ALL};
380
+ background-color: transparent !important;
381
+ transition: background 0.3s;
166
382
 
167
383
  &:hover {
168
- background-color: ${styledVars.CAP_G08};
384
+ background-color: #fffbe6 !important;
385
+ color: #1c2530 !important;
386
+ border-radius: 4px;
169
387
  }
170
388
 
171
389
  &.ant-select-tree-node-selected {
172
- background-color: ${styledVars.CAP_PRIMARY.light};
173
- color: ${styledVars.CAP_PRIMARY.base};
390
+ color: #1c2530;
174
391
  font-weight: 500;
175
392
  }
176
393
  }
@@ -184,6 +401,25 @@ export const selectStyles = css`
184
401
  .ant-select-tree-checkbox {
185
402
  margin: 4px 8px 4px 0;
186
403
  }
404
+
405
+ .ant-select-tree-treenode {
406
+ padding: 2px 0;
407
+
408
+ &:hover {
409
+ background-color: transparent;
410
+ }
411
+ }
412
+
413
+ .ant-select-tree-checkbox-checked .ant-select-tree-checkbox-inner {
414
+ background-color: #42b040;
415
+ border-color: #42b040;
416
+ }
417
+
418
+ .ant-select-tree-checkbox-checked .ant-select-tree-node-content-wrapper {
419
+ background-color: #e9f0fe !important;
420
+ color: #1c2530 !important;
421
+ font-weight: 500;
422
+ }
187
423
  }
188
424
 
189
425
  /* Size variations */
@@ -217,7 +453,17 @@ export const selectStyles = css`
217
453
  .anticon-loading {
218
454
  color: ${styledVars.CAP_PRIMARY.base};
219
455
  }
220
- }
456
+ }
457
+ }
458
+
459
+ &.cap-unified-tree-select .ant-select-selection-overflow {
460
+ display: none; /* hides pill wrapper */
461
+ }
462
+
463
+ &.cap-unified-tree-select .suffix-counter {
464
+ color: #1c2530;
465
+ font-weight: 500;
466
+ margin-right: 12px; /* optional, adjust spacing */
221
467
  }
222
468
  }
223
469
  `;
@@ -0,0 +1,3 @@
1
+ <svg width="16" height="18" viewBox="0 0 16 18" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M7.00031 13.0631V3.79511L4.46431 6.33111C4.07431 6.72111 3.44131 6.72111 3.05031 6.33111C2.65931 5.94011 2.65931 5.30711 3.05031 4.91611L7.29331 0.674109C7.68331 0.283109 8.31631 0.283109 8.70731 0.674109L12.9493 4.91611C13.3403 5.30711 13.3403 5.94011 12.9493 6.33111C12.5593 6.72111 11.9263 6.72111 11.5353 6.33111L9.00031 3.79511V13.0631C9.00031 13.5761 8.55231 13.9911 8.00031 13.9911C7.44731 13.9911 7.00031 13.5761 7.00031 13.0631ZM14.9975 12.9942C15.5495 12.9942 15.9975 13.4412 15.9975 13.9942V16.9302C15.9985 16.9502 15.9995 16.9712 15.9995 16.9912C15.9995 17.0342 15.9965 17.0772 15.9895 17.1192C15.9285 17.6122 15.5075 17.9942 14.9975 17.9942C14.9565 17.9942 14.9175 17.9922 14.8785 17.9872C14.8405 17.9902 14.8015 17.9912 14.7625 17.9912H1.23751C1.21394 17.9912 1.19217 17.9861 1.1704 17.981C1.15245 17.9768 1.13449 17.9726 1.11551 17.9712C1.10076 17.9725 1.0868 17.9767 1.07275 17.9809C1.05538 17.986 1.03786 17.9912 1.01851 17.9912C0.606512 17.9912 0.253512 17.7412 0.101512 17.3852C0.0365117 17.2642 -0.000488281 17.1312 -0.000488281 16.9912C-0.000488281 16.9769 0.00426292 16.9638 0.00903728 16.9506C0.013294 16.9388 0.017569 16.9269 0.0185117 16.9142V13.9912C0.0185117 13.4382 0.466512 12.9912 1.01851 12.9912C1.57151 12.9912 2.01851 13.4382 2.01851 13.9912V15.9912H13.9975V13.9942C13.9975 13.4412 14.4455 12.9942 14.9975 12.9942Z" fill="#2466EA"/>
3
+ </svg>
package/index.js CHANGED
@@ -1,10 +1,16 @@
1
1
  // Import and export all components
2
2
  export { default as CapInput } from './CapInput';
3
+ export { default as CapSkeleton } from './CapSkeleton';
4
+ export { default as CapSpin } from './CapSpin';
3
5
  export { default as CapTable } from './CapTable';
6
+ export { default as CapUnifiedSelect } from './CapUnifiedSelect';
4
7
 
5
8
  // Export utilities
6
9
  export { default as LocaleHoc } from './LocaleHoc';
7
10
 
8
11
  // Export styled utilities
9
12
  export * as styledVars from './styled/variables';
10
- export { default as styled } from './styled';
13
+ export { default as styled } from './styled';
14
+
15
+ // Export utils
16
+ export * as Utils from './utils';
package/package.json CHANGED
@@ -1,11 +1,9 @@
1
1
  {
2
2
  "name": "@capillarytech/blaze-ui",
3
3
  "author": "Capillary Technologies",
4
- "version": "0.1.6-alpha.4",
5
- "description": "Capillary UI component library",
6
- "main": "./dist/index.js",
7
- "module": "./dist/esm/index.js",
8
- "jsnext:main": "./dist/esm/index.js",
4
+ "version": "0.1.6-alpha.40",
5
+ "description": "Capillary UI component library with Ant Design v5",
6
+ "main": "./index.js",
9
7
  "sideEffects": [
10
8
  "*.css",
11
9
  "*.less",
@@ -26,14 +24,12 @@
26
24
  "!**/tests"
27
25
  ],
28
26
  "homepage": "https://github.com/Capillary/blaze-ui",
29
- "peerDependencies": {
30
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
31
- "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
32
- },
33
27
  "dependencies": {
28
+ "@ant-design/icons": "^5.2.6",
34
29
  "@capillarytech/cap-ui-utils": "^3.0.4",
30
+ "antd-v5": "npm:antd@^5.26.7",
35
31
  "prop-types": "^15.8.1",
36
- "styled-components": "^5.3.11",
37
- "react-intl": "^6.5.0"
32
+ "react-intl": "2.7.2",
33
+ "styled-components": "^5.3.11"
38
34
  }
39
35
  }
package/utils/index.js ADDED
@@ -0,0 +1 @@
1
+ export { default as withStyles } from './withStyles';
@@ -0,0 +1,24 @@
1
+ import styled from 'styled-components';
2
+
3
+ /**
4
+ * Enhances a React component with additional styles using styled-components.
5
+ * @param {React.ComponentType} WrappedComponent - The React component to enhance.
6
+ * @param {TemplateStringsArray} styles - CSS styles as a TemplateStringsArray.
7
+ * @returns {React.ComponentType} Returns the enhanced styled component.
8
+ */
9
+ const withStyledComponent = (WrappedComponent, styles) => {
10
+ /**
11
+ * A styled component generated by combining WrappedComponent with additional styles.
12
+ * @type {React.ComponentType}
13
+ */
14
+ const StyledComponent = styled(WrappedComponent)`
15
+ ${styles};
16
+ `;
17
+
18
+ // Set default props from the original component to the styled component
19
+ StyledComponent.defaultProps = WrappedComponent.defaultProps;
20
+
21
+ return StyledComponent;
22
+ };
23
+
24
+ export default withStyledComponent;
@@ -1,71 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { HeadingWrapper, HeadingSpan } from './styles';
4
-
5
- const CapHeading = ({ type = 'h5', children, as, ...rest }) => {
6
- return (
7
- <HeadingWrapper type={type} as={as || 'div'} {...rest}>
8
- {children}
9
- </HeadingWrapper>
10
- );
11
- };
12
-
13
- CapHeading.propTypes = {
14
- type: PropTypes.oneOf([
15
- 'h0',
16
- 'h1',
17
- 'h2',
18
- 'h3',
19
- 'h4',
20
- 'h5',
21
- 'h6',
22
- 'h7',
23
- 'h8',
24
- 'h9',
25
- 'h10',
26
- 'label1',
27
- 'label2',
28
- 'label3',
29
- 'label4',
30
- 'label5',
31
- 'label6',
32
- ]),
33
- children: PropTypes.node,
34
- as: PropTypes.string,
35
- };
36
-
37
- // Inline span version
38
- const CapHeadingSpan = ({ type = 'h5', children, ...rest }) => {
39
- return (
40
- <HeadingSpan type={type} {...rest}>
41
- {children}
42
- </HeadingSpan>
43
- );
44
- };
45
-
46
- CapHeadingSpan.propTypes = {
47
- type: PropTypes.oneOf([
48
- 'h0',
49
- 'h1',
50
- 'h2',
51
- 'h3',
52
- 'h4',
53
- 'h5',
54
- 'h6',
55
- 'h7',
56
- 'h8',
57
- 'h9',
58
- 'h10',
59
- 'label1',
60
- 'label2',
61
- 'label3',
62
- 'label4',
63
- 'label5',
64
- 'label6',
65
- ]),
66
- children: PropTypes.node,
67
- };
68
-
69
- CapHeading.Span = CapHeadingSpan;
70
-
71
- export default CapHeading;
@@ -1 +0,0 @@
1
- export { default } from './CapHeading';
@@ -1,125 +0,0 @@
1
- import styled, { css } from 'styled-components';
2
- import * as styledVars from '../styled/variables';
3
-
4
- const headings = {
5
- h0: {
6
- fontSize: '28px',
7
- fontWeight: '500',
8
- color: styledVars.CAP_G01,
9
- lineHeight: '36px',
10
- },
11
- h1: {
12
- fontSize: '24px',
13
- fontWeight: '500',
14
- color: styledVars.CAP_G01,
15
- lineHeight: '32px',
16
- },
17
- h2: {
18
- fontSize: '20px',
19
- fontWeight: '500',
20
- color: styledVars.CAP_G01,
21
- lineHeight: '28px',
22
- },
23
- h3: {
24
- fontSize: '16px',
25
- fontWeight: '500',
26
- color: styledVars.CAP_G01,
27
- lineHeight: '24px',
28
- },
29
- h4: {
30
- fontSize: '14px',
31
- fontWeight: '500',
32
- color: styledVars.CAP_G01,
33
- lineHeight: '20px',
34
- },
35
- h5: {
36
- fontSize: '14px',
37
- fontWeight: 'normal',
38
- color: styledVars.CAP_G01,
39
- lineHeight: '20px',
40
- },
41
- h6: {
42
- color: styledVars.CAP_G04,
43
- fontSize: '14px',
44
- fontWeight: 'normal',
45
- lineHeight: '20px',
46
- },
47
- h7: {
48
- fontSize: '20px',
49
- fontWeight: '500',
50
- color: styledVars.CAP_G04,
51
- lineHeight: '28px',
52
- },
53
- h8: {
54
- fontSize: '14px',
55
- fontWeight: '400',
56
- color: styledVars.CAP_G01,
57
- lineHeight: '20px',
58
- },
59
- h9: {
60
- fontSize: '14px',
61
- fontWeight: '500',
62
- color: styledVars.CAP_WHITE,
63
- lineHeight: '20px',
64
- },
65
- h10: {
66
- fontSize: '12px',
67
- fontWeight: '500',
68
- color: styledVars.CAP_G01,
69
- lineHeight: '16px',
70
- },
71
- label1: {
72
- color: styledVars.CAP_G04,
73
- fontSize: '12px',
74
- fontWeight: 'normal',
75
- lineHeight: '20px',
76
- },
77
- label2: {
78
- color: styledVars.CAP_G01,
79
- fontSize: '12px',
80
- fontWeight: 'normal',
81
- lineHeight: '20px',
82
- },
83
- label3: {
84
- color: styledVars.CAP_G05,
85
- fontSize: '12px',
86
- fontWeight: 'normal',
87
- lineHeight: '20px',
88
- },
89
- label4: {
90
- color: styledVars.CAP_G04,
91
- fontSize: '12px',
92
- fontWeight: 'normal',
93
- lineHeight: '16px',
94
- },
95
- label5: {
96
- color: styledVars.CAP_G04,
97
- fontSize: '16px',
98
- fontWeight: 'normal',
99
- lineHeight: '24px',
100
- },
101
- label6: {
102
- color: styledVars.CAP_G01,
103
- fontSize: '16px',
104
- fontWeight: 'normal',
105
- lineHeight: '24px',
106
- },
107
- };
108
-
109
- const headingStyles = css`
110
- font-size: ${props => headings[props.type].fontSize};
111
- font-weight: ${props => headings[props.type].fontWeight};
112
- color: ${props => headings[props.type].color};
113
- line-height: ${props => headings[props.type].lineHeight};
114
- margin: 0;
115
- padding: 0;
116
- `;
117
-
118
- export const HeadingWrapper = styled.div`
119
- ${headingStyles}
120
- `;
121
-
122
- export const HeadingSpan = styled.span`
123
- ${headingStyles}
124
- display: inline-block;
125
- `;