@react-ui-org/react-ui 0.55.1 → 0.57.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. package/.nvmrc +1 -1
  2. package/dist/react-ui.css +15 -20
  3. package/dist/react-ui.development.css +2336 -846
  4. package/dist/react-ui.development.js +106 -96
  5. package/dist/react-ui.js +1 -1
  6. package/package.json +41 -39
  7. package/src/CNAME +1 -0
  8. package/src/components/Alert/Alert.jsx +3 -2
  9. package/src/components/Alert/Alert.module.scss +9 -31
  10. package/src/components/Alert/README.md +11 -9
  11. package/src/components/Alert/_settings.scss +5 -0
  12. package/src/components/Alert/_theme.scss +0 -43
  13. package/src/components/Badge/Badge.jsx +5 -3
  14. package/src/components/Badge/Badge.module.scss +29 -74
  15. package/src/components/Badge/README.md +24 -6
  16. package/src/components/Badge/_settings.scss +8 -0
  17. package/src/components/Button/Button.jsx +4 -3
  18. package/src/components/Button/Button.module.scss +183 -2
  19. package/src/components/Button/README.md +28 -24
  20. package/src/components/Button/_settings.scss +8 -3
  21. package/src/components/Button/_theme.scss +0 -3
  22. package/src/components/Button/_tools.scss +7 -71
  23. package/src/components/ButtonGroup/ButtonGroup.jsx +2 -2
  24. package/src/components/ButtonGroup/README.md +5 -4
  25. package/src/components/Card/Card.jsx +3 -2
  26. package/src/components/Card/Card.module.scss +10 -31
  27. package/src/components/Card/CardBody.jsx +1 -1
  28. package/src/components/Card/CardFooter.jsx +1 -1
  29. package/src/components/Card/README.md +11 -10
  30. package/src/components/Card/_settings.scss +5 -0
  31. package/src/components/Card/_theme.scss +0 -43
  32. package/src/components/CheckboxField/CheckboxField.jsx +2 -2
  33. package/src/components/CheckboxField/README.md +8 -4
  34. package/src/components/FileInputField/FileInputField.jsx +3 -3
  35. package/src/components/FileInputField/README.md +8 -4
  36. package/src/components/FormLayout/FormLayout.jsx +1 -1
  37. package/src/components/FormLayout/FormLayoutCustomField.jsx +1 -1
  38. package/src/components/FormLayout/README.md +5 -4
  39. package/src/components/Grid/Grid.jsx +1 -1
  40. package/src/components/Grid/Grid.module.scss +5 -0
  41. package/src/components/Grid/GridSpan.jsx +1 -1
  42. package/src/components/Grid/README.md +6 -4
  43. package/src/components/Grid/_settings.scss +2 -2
  44. package/src/components/InputGroup/InputGroup.jsx +2 -2
  45. package/src/components/InputGroup/README.md +5 -4
  46. package/src/components/Modal/Modal.jsx +1 -1
  47. package/src/components/Modal/Modal.module.scss +1 -1
  48. package/src/components/Modal/ModalBody.jsx +1 -1
  49. package/src/components/Modal/ModalCloseButton.jsx +1 -1
  50. package/src/components/Modal/ModalContent.jsx +1 -1
  51. package/src/components/Modal/ModalFooter.jsx +1 -1
  52. package/src/components/Modal/ModalHeader.jsx +2 -4
  53. package/src/components/Modal/ModalTitle.jsx +2 -4
  54. package/src/components/Modal/README.md +3 -2
  55. package/src/components/Paper/Paper.jsx +1 -1
  56. package/src/components/Paper/README.md +5 -4
  57. package/src/components/Popover/Popover.jsx +1 -1
  58. package/src/components/Popover/Popover.module.scss +16 -16
  59. package/src/components/Popover/PopoverWrapper.jsx +1 -1
  60. package/src/components/Popover/README.md +5 -4
  61. package/src/components/Popover/_theme.scss +4 -2
  62. package/src/components/Radio/README.md +8 -4
  63. package/src/components/Radio/Radio.jsx +2 -2
  64. package/src/components/ScrollView/README.md +5 -4
  65. package/src/components/ScrollView/ScrollView.jsx +1 -1
  66. package/src/components/ScrollView/ScrollView.module.scss +2 -4
  67. package/src/components/SelectField/README.md +8 -4
  68. package/src/components/SelectField/SelectField.jsx +2 -2
  69. package/src/components/Table/README.md +5 -4
  70. package/src/components/Table/Table.jsx +1 -1
  71. package/src/components/Tabs/README.md +3 -2
  72. package/src/components/Tabs/Tabs.jsx +1 -1
  73. package/src/components/Tabs/TabsItem.jsx +1 -1
  74. package/src/components/Text/README.md +3 -2
  75. package/src/components/Text/Text.jsx +1 -1
  76. package/src/components/TextArea/README.md +8 -4
  77. package/src/components/TextArea/TextArea.jsx +2 -2
  78. package/src/components/TextField/README.md +8 -4
  79. package/src/components/TextField/TextField.jsx +2 -2
  80. package/src/components/TextLink/README.md +5 -4
  81. package/src/components/TextLink/TextLink.jsx +1 -1
  82. package/src/components/Toggle/README.md +8 -4
  83. package/src/components/Toggle/Toggle.jsx +2 -2
  84. package/src/components/Toolbar/README.md +5 -4
  85. package/src/components/Toolbar/Toolbar.jsx +1 -1
  86. package/src/components/Toolbar/ToolbarGroup.jsx +1 -1
  87. package/src/components/Toolbar/ToolbarItem.jsx +1 -1
  88. package/src/components/_helpers/getRootPriorityClassName.js +1 -1
  89. package/src/index.js +1 -0
  90. package/src/provider/RUIProvider.jsx +6 -3
  91. package/src/styles/settings/_collections.scss +9 -0
  92. package/src/styles/tools/_collections.scss +191 -0
  93. package/src/styles/tools/_string.scss +5 -2
  94. package/src/styles/tools/form-fields/_box-field-layout.scss +5 -0
  95. package/src/styles/tools/form-fields/_inline-field-layout.scss +1 -0
  96. package/src/theme.scss +64 -0
  97. package/src/utils/mergeDeep.js +28 -0
  98. package/src/{components/_helpers → utils}/transferProps.js +0 -8
  99. package/src/components/Alert/_tools.scss +0 -10
  100. package/src/components/Button/_base.scss +0 -159
  101. package/src/components/Button/_priorities.scss +0 -149
  102. package/src/components/Card/_tools.scss +0 -10
package/src/theme.scss CHANGED
@@ -306,6 +306,70 @@
306
306
  --rui-Alert--dark__foreground-color: var(--rui-color-neutral-on-dark);
307
307
  --rui-Alert--dark__background-color: var(--rui-color-background-dark);
308
308
 
309
+ //
310
+ // Badge
311
+ // =====
312
+
313
+ // Badge: filled priority
314
+
315
+ // Badge: filled priority: success variant
316
+ --rui-Badge--filled--success__color: var(--rui-color-feedback-on-success);
317
+ --rui-Badge--filled--success__background-color: var(--rui-color-feedback-success);
318
+
319
+ // Badge: filled priority: warning variant
320
+ --rui-Badge--filled--warning__color: var(--rui-color-feedback-on-warning);
321
+ --rui-Badge--filled--warning__background-color: var(--rui-color-feedback-warning);
322
+
323
+ // Badge: filled priority: danger variant
324
+ --rui-Badge--filled--danger__color: var(--rui-color-feedback-on-danger);
325
+ --rui-Badge--filled--danger__background-color: var(--rui-color-feedback-danger);
326
+
327
+ // Badge: filled priority: help variant
328
+ --rui-Badge--filled--help__color: var(--rui-color-feedback-on-help);
329
+ --rui-Badge--filled--help__background-color: var(--rui-color-feedback-help);
330
+
331
+ // Badge: filled priority: info variant
332
+ --rui-Badge--filled--info__color: var(--rui-color-feedback-on-info);
333
+ --rui-Badge--filled--info__background-color: var(--rui-color-feedback-info);
334
+
335
+ // Badge: filled priority: note variant
336
+ --rui-Badge--filled--note__color: var(--rui-color-feedback-on-note);
337
+ --rui-Badge--filled--note__background-color: var(--rui-color-feedback-note);
338
+
339
+ // Badge: filled priority: light variant
340
+ --rui-Badge--filled--light__color: var(--rui-color-neutral-on-light);
341
+ --rui-Badge--filled--light__background-color: var(--rui-color-neutral-light);
342
+
343
+ // Badge: filled priority: dark variant
344
+ --rui-Badge--filled--dark__color: var(--rui-color-neutral-on-dark);
345
+ --rui-Badge--filled--dark__background-color: var(--rui-color-neutral-dark);
346
+
347
+ // Badge: outline priority
348
+
349
+ // Badge: outline priority: success variant
350
+ --rui-Badge--outline--success__color: var(--rui-color-feedback-success);
351
+
352
+ // Badge: outline priority: warning variant
353
+ --rui-Badge--outline--warning__color: var(--rui-color-feedback-warning);
354
+
355
+ // Badge: outline priority: danger variant
356
+ --rui-Badge--outline--danger__color: var(--rui-color-feedback-danger);
357
+
358
+ // Badge: outline priority: help variant
359
+ --rui-Badge--outline--help__color: var(--rui-color-feedback-help);
360
+
361
+ // Badge: outline priority: info variant
362
+ --rui-Badge--outline--info__color: var(--rui-color-feedback-info);
363
+
364
+ // Badge: outline priority: note variant
365
+ --rui-Badge--outline--note__color: var(--rui-color-feedback-note);
366
+
367
+ // Badge: outline priority: light variant
368
+ --rui-Badge--outline--light__color: var(--rui-color-neutral-light);
369
+
370
+ // Badge: outline priority: dark variant
371
+ --rui-Badge--outline--dark__color: var(--rui-color-neutral-dark);
372
+
309
373
  //
310
374
  // Button
311
375
  // ======
@@ -0,0 +1,28 @@
1
+ const isObject = (obj) => obj && typeof obj === 'object' && !Array.isArray(obj);
2
+
3
+ /**
4
+ * Performs a deep merge of objects and returns new object.
5
+ *
6
+ * @param {...object} objects
7
+ * @returns {object}
8
+ */
9
+ export const mergeDeep = (...objects) => objects.reduce((prev, obj) => {
10
+ if (obj == null) {
11
+ return prev;
12
+ }
13
+
14
+ const newObject = { ...prev };
15
+
16
+ Object.keys(obj).forEach((key) => {
17
+ const previousVal = prev[key];
18
+ const currentVal = obj[key];
19
+
20
+ if (isObject(previousVal) && isObject(currentVal)) {
21
+ newObject[key] = mergeDeep(previousVal, currentVal);
22
+ } else {
23
+ newObject[key] = currentVal;
24
+ }
25
+ });
26
+
27
+ return newObject;
28
+ }, {});
@@ -1,12 +1,4 @@
1
1
  /**
2
- * Controls passing of props from the React component to the HTML element
3
- *
4
- * Sometimes it is useful to have a mechanism to pass props from the React component to a rendered HTML element.
5
- * It enables making the component interactive and helps improve its accessibility. However some props should
6
- * never be passed to the HTML element as it would break things. This function is used to filter out such props.
7
- *
8
- * When run in development mode, the function will log the error to the console if any invalid props are passed.
9
- *
10
2
  * @param props The props that were passed to the React component and were not used by it
11
3
  * @returns The props to be passed to the HTML element
12
4
  */
@@ -1,10 +0,0 @@
1
- @use "sass:map";
2
- @use "theme";
3
-
4
- @mixin color($color) {
5
- $color-variant-properties: map.get(theme.$colors, $color);
6
-
7
- --rui-local-color: #{map.get($color-variant-properties, color)};
8
- --rui-local-foreground-color: #{map.get($color-variant-properties, foreground-color)};
9
- --rui-local-background-color: #{map.get($color-variant-properties, background-color)};
10
- }
@@ -1,159 +0,0 @@
1
- // 1. ButtonGroup gap is implemented using the `margin` property so the buttons can overlap and reduce duplicate
2
- // borders.
3
-
4
- @use "sass:map";
5
- @use "../../styles/tools/breakpoint";
6
- @use "settings";
7
- @use "theme";
8
- @use "tools";
9
-
10
- @layer components.button {
11
- .root {
12
- @include tools.button();
13
- }
14
-
15
- .label {
16
- display: block;
17
- }
18
-
19
- .beforeLabel,
20
- .afterLabel,
21
- .startCorner,
22
- .endCorner,
23
- .feedbackIcon {
24
- display: flex;
25
- align-items: baseline;
26
- justify-content: center;
27
- }
28
-
29
- .startCorner,
30
- .endCorner {
31
- position: absolute;
32
- top: -0.35rem;
33
- z-index: 2;
34
- }
35
-
36
- .startCorner {
37
- left: 0;
38
- margin-left: -0.35rem;
39
- }
40
-
41
- .endCorner {
42
- right: 0;
43
- margin-right: -0.35rem;
44
- }
45
-
46
- .feedbackIcon {
47
- position: absolute;
48
- top: 0;
49
- right: 0;
50
- bottom: 0;
51
- left: 0;
52
- z-index: 1;
53
- align-items: center;
54
- }
55
-
56
- .isRootSizeSmall {
57
- @include tools.button-size(small);
58
- }
59
-
60
- .isRootSizeMedium {
61
- @include tools.button-size(medium);
62
- }
63
-
64
- .isRootSizeLarge {
65
- @include tools.button-size(large);
66
- }
67
-
68
- .isRootBlock {
69
- width: 100%;
70
- }
71
-
72
- .hasRootFeedback:disabled {
73
- opacity: theme.$feedback-opacity;
74
- cursor: theme.$feedback-cursor;
75
- }
76
-
77
- .hasRootFeedback .label,
78
- .hasRootFeedback .beforeLabel,
79
- .hasRootFeedback .afterLabel {
80
- color: transparent;
81
- }
82
-
83
- .isRootInButtonGroup,
84
- .isRootInInputGroup {
85
- z-index: map.get(settings.$group-z-indexes, button);
86
-
87
- &:not(:first-child) {
88
- border-start-start-radius: var(--rui-local-inner-border-radius);
89
- border-end-start-radius: var(--rui-local-inner-border-radius);
90
- }
91
-
92
- &:not(:last-child) {
93
- border-start-end-radius: var(--rui-local-inner-border-radius);
94
- border-end-end-radius: var(--rui-local-inner-border-radius);
95
- }
96
- }
97
-
98
- .isRootInButtonGroup:not(:first-child) {
99
- margin-inline-start: var(--rui-local-gap); // 1.
100
- }
101
-
102
- .isRootInButtonGroup:focus,
103
- .isRootInButtonGroup:not(:disabled):hover {
104
- z-index: map.get(settings.$group-z-indexes, button-hover);
105
- }
106
-
107
- .isRootInButtonGroup .startCorner,
108
- .isRootInInputGroup .startCorner,
109
- .isRootInButtonGroup .endCorner,
110
- .isRootInInputGroup .endCorner {
111
- z-index: map.get(settings.$group-z-indexes, button-overflowing-elements);
112
- }
113
-
114
- .hasLabelHidden,
115
- .hasLabelVisibleSm,
116
- .hasLabelVisibleMd,
117
- .hasLabelVisibleLg,
118
- .hasLabelVisibleXl,
119
- .hasLabelVisibleX2l,
120
- .hasLabelVisibleX3l {
121
- @include tools.hide-label();
122
- }
123
-
124
- .hasLabelVisibleSm {
125
- @include breakpoint.up(sm) {
126
- @include tools.show-label();
127
- }
128
- }
129
-
130
- .hasLabelVisibleMd {
131
- @include breakpoint.up(md) {
132
- @include tools.show-label();
133
- }
134
- }
135
-
136
- .hasLabelVisibleLg {
137
- @include breakpoint.up(lg) {
138
- @include tools.show-label();
139
- }
140
- }
141
-
142
- .hasLabelVisibleXl {
143
- @include breakpoint.up(xl) {
144
- @include tools.show-label();
145
- }
146
- }
147
-
148
- .hasLabelVisibleX2l {
149
- @include breakpoint.up(x2l) {
150
- @include tools.show-label();
151
- }
152
- }
153
-
154
- .hasLabelVisibleX3l {
155
- @include breakpoint.up(x3l) {
156
- @include tools.show-label();
157
- }
158
- }
159
- }
@@ -1,149 +0,0 @@
1
- @use "sass:map";
2
- @use "settings";
3
- @use "theme";
4
- @use "tools";
5
-
6
- @layer components.button {
7
- .isRootPriorityFilled.isRootColorPrimary {
8
- @include tools.button-color(filled, primary);
9
- }
10
-
11
- .isRootPriorityFilled.isRootColorSecondary {
12
- @include tools.button-color(filled, secondary);
13
- }
14
-
15
- .isRootPriorityFilled.isRootColorSelected {
16
- @include tools.button-color(filled, selected);
17
- }
18
-
19
- .isRootPriorityFilled.isRootColorSuccess {
20
- @include tools.button-color(filled, success);
21
- }
22
-
23
- .isRootPriorityFilled.isRootColorWarning {
24
- @include tools.button-color(filled, warning);
25
- }
26
-
27
- .isRootPriorityFilled.isRootColorDanger {
28
- @include tools.button-color(filled, danger);
29
- }
30
-
31
- .isRootPriorityFilled.isRootColorHelp {
32
- @include tools.button-color(filled, help);
33
- }
34
-
35
- .isRootPriorityFilled.isRootColorInfo {
36
- @include tools.button-color(filled, info);
37
- }
38
-
39
- .isRootPriorityFilled.isRootColorNote {
40
- @include tools.button-color(filled, note);
41
- }
42
-
43
- .isRootPriorityFilled.isRootColorLight {
44
- @include tools.button-color(filled, light);
45
- }
46
-
47
- .isRootPriorityFilled.isRootColorDark {
48
- @include tools.button-color(filled, dark);
49
- }
50
-
51
- .isRootPriorityOutline.isRootColorPrimary {
52
- @include tools.button-color(outline, primary);
53
- }
54
-
55
- .isRootPriorityOutline.isRootColorSecondary {
56
- @include tools.button-color(outline, secondary);
57
- }
58
-
59
- .isRootPriorityOutline.isRootColorSelected {
60
- @include tools.button-color(outline, selected);
61
- }
62
-
63
- .isRootPriorityOutline.isRootColorSuccess {
64
- @include tools.button-color(outline, success);
65
- }
66
-
67
- .isRootPriorityOutline.isRootColorWarning {
68
- @include tools.button-color(outline, warning);
69
- }
70
-
71
- .isRootPriorityOutline.isRootColorDanger {
72
- @include tools.button-color(outline, danger);
73
- }
74
-
75
- .isRootPriorityOutline.isRootColorHelp {
76
- @include tools.button-color(outline, help);
77
- }
78
-
79
- .isRootPriorityOutline.isRootColorInfo {
80
- @include tools.button-color(outline, info);
81
- }
82
-
83
- .isRootPriorityOutline.isRootColorNote {
84
- @include tools.button-color(outline, note);
85
- }
86
-
87
- .isRootPriorityOutline.isRootColorLight {
88
- @include tools.button-color(outline, light);
89
- }
90
-
91
- .isRootPriorityOutline.isRootColorDark {
92
- @include tools.button-color(outline, dark);
93
- }
94
-
95
- .isRootPriorityFlat.isRootColorPrimary {
96
- @include tools.button-color(flat, primary);
97
- }
98
-
99
- .isRootPriorityFlat.isRootColorSecondary {
100
- @include tools.button-color(flat, secondary);
101
- }
102
-
103
- .isRootPriorityFlat.isRootColorSelected {
104
- @include tools.button-color(flat, selected);
105
- }
106
-
107
- .isRootPriorityFlat.isRootColorSuccess {
108
- @include tools.button-color(flat, success);
109
- }
110
-
111
- .isRootPriorityFlat.isRootColorWarning {
112
- @include tools.button-color(flat, warning);
113
- }
114
-
115
- .isRootPriorityFlat.isRootColorDanger {
116
- @include tools.button-color(flat, danger);
117
- }
118
-
119
- .isRootPriorityFlat.isRootColorHelp {
120
- @include tools.button-color(flat, help);
121
- }
122
-
123
- .isRootPriorityFlat.isRootColorInfo {
124
- @include tools.button-color(flat, info);
125
- }
126
-
127
- .isRootPriorityFlat.isRootColorNote {
128
- @include tools.button-color(flat, note);
129
- }
130
-
131
- .isRootPriorityFlat.isRootColorLight {
132
- @include tools.button-color(flat, light);
133
- }
134
-
135
- .isRootPriorityFlat.isRootColorDark {
136
- @include tools.button-color(flat, dark);
137
- }
138
-
139
- .isRootInButtonGroup:not(:first-child)::before {
140
- content: "";
141
- position: absolute;
142
- top: calc(-1 * #{theme.$border-width});
143
- bottom: calc(-1 * #{theme.$border-width});
144
- left: calc(-1 * #{theme.$border-width});
145
- z-index: map.get(settings.$group-z-indexes, separator);
146
- border-left: var(--rui-local-separator-width) solid var(--rui-local-separator-color);
147
- transform: translateX(calc(-0.5 * var(--rui-local-gap) - 50%));
148
- }
149
- }
@@ -1,10 +0,0 @@
1
- @use "sass:map";
2
- @use "theme";
3
-
4
- @mixin color($color) {
5
- $color-variant-properties: map.get(theme.$colors, $color);
6
-
7
- --rui-local-color: #{map.get($color-variant-properties, color)};
8
- --rui-local-border-color: #{map.get($color-variant-properties, border-color)};
9
- --rui-local-background-color: #{map.get($color-variant-properties, background-color)};
10
- }