@react-ui-org/react-ui 0.58.0 → 0.59.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 (92) hide show
  1. package/README.md +2 -11
  2. package/dist/react-ui.css +17 -17
  3. package/dist/react-ui.development.css +1228 -1051
  4. package/dist/react-ui.development.js +126 -66
  5. package/dist/react-ui.js +1 -1
  6. package/package.json +5 -5
  7. package/src/components/Alert/Alert.jsx +4 -4
  8. package/src/components/Alert/README.md +0 -26
  9. package/src/components/Alert/_settings.scss +1 -2
  10. package/src/components/Badge/Badge.jsx +2 -2
  11. package/src/components/Button/Button.jsx +2 -2
  12. package/src/components/ButtonGroup/ButtonGroup.jsx +2 -2
  13. package/src/components/Card/Card.jsx +6 -6
  14. package/src/components/Card/Card.module.scss +2 -2
  15. package/src/components/Card/CardBody.jsx +1 -1
  16. package/src/components/Card/CardFooter.jsx +1 -1
  17. package/src/components/Card/README.md +2 -21
  18. package/src/components/Card/_settings.scss +1 -2
  19. package/src/components/Card/_theme.scss +1 -0
  20. package/src/components/CheckboxField/CheckboxField.jsx +2 -2
  21. package/src/components/FileInputField/FileInputField.jsx +147 -21
  22. package/src/components/FileInputField/FileInputField.module.scss +87 -1
  23. package/src/components/FileInputField/README.md +83 -2
  24. package/src/components/FileInputField/_settings.scss +15 -0
  25. package/src/components/FormLayout/FormLayout.jsx +2 -2
  26. package/src/components/FormLayout/FormLayoutCustomField.jsx +2 -2
  27. package/src/components/FormLayout/README.md +1 -0
  28. package/src/components/Grid/Grid.jsx +1 -1
  29. package/src/components/Grid/Grid.module.scss +2 -2
  30. package/src/components/Grid/GridSpan.jsx +1 -1
  31. package/src/components/InputGroup/InputGroup.jsx +2 -2
  32. package/src/components/InputGroup/InputGroup.module.scss +3 -3
  33. package/src/components/InputGroup/README.md +1 -1
  34. package/src/components/Modal/Modal.jsx +117 -45
  35. package/src/components/Modal/Modal.module.scss +34 -18
  36. package/src/components/Modal/ModalBody.jsx +2 -2
  37. package/src/components/Modal/ModalBody.module.scss +18 -0
  38. package/src/components/Modal/ModalCloseButton.jsx +1 -1
  39. package/src/components/Modal/ModalContent.jsx +1 -1
  40. package/src/components/Modal/ModalFooter.jsx +2 -2
  41. package/src/components/Modal/ModalFooter.module.scss +6 -2
  42. package/src/components/Modal/ModalHeader.jsx +2 -2
  43. package/src/components/Modal/ModalHeader.module.scss +8 -1
  44. package/src/components/Modal/ModalTitle.jsx +1 -1
  45. package/src/components/Modal/README.md +391 -171
  46. package/src/components/Modal/_animations.scss +9 -0
  47. package/src/components/Modal/_helpers/dialogOnCancelHandler.js +28 -0
  48. package/src/components/Modal/_helpers/dialogOnClickHandler.js +46 -0
  49. package/src/components/Modal/_helpers/dialogOnCloseHandler.js +28 -0
  50. package/src/components/Modal/_helpers/dialogOnKeyDownHandler.js +62 -0
  51. package/src/components/Modal/_helpers/getPositionClassName.js +1 -1
  52. package/src/components/Modal/_hooks/useModalFocus.js +24 -91
  53. package/src/components/Modal/_settings.scss +4 -3
  54. package/src/components/Modal/_theme.scss +1 -0
  55. package/src/components/Paper/Paper.jsx +2 -2
  56. package/src/components/Popover/Popover.jsx +2 -2
  57. package/src/components/Popover/PopoverWrapper.jsx +1 -1
  58. package/src/components/Radio/Radio.jsx +2 -2
  59. package/src/components/ScrollView/ScrollView.jsx +2 -2
  60. package/src/components/SelectField/SelectField.jsx +2 -2
  61. package/src/components/Table/Table.jsx +1 -1
  62. package/src/components/Tabs/Tabs.jsx +1 -1
  63. package/src/components/Tabs/TabsItem.jsx +2 -2
  64. package/src/components/Text/Text.jsx +2 -2
  65. package/src/components/TextArea/TextArea.jsx +2 -2
  66. package/src/components/TextField/TextField.jsx +2 -2
  67. package/src/components/TextLink/TextLink.jsx +1 -1
  68. package/src/components/Toggle/Toggle.jsx +2 -2
  69. package/src/components/Toolbar/Toolbar.jsx +2 -2
  70. package/src/components/Toolbar/ToolbarGroup.jsx +2 -2
  71. package/src/components/Toolbar/ToolbarItem.jsx +2 -2
  72. package/src/helpers/classNames/README.md +65 -0
  73. package/src/helpers/classNames/classNames.js +11 -0
  74. package/src/helpers/classNames/index.js +1 -0
  75. package/src/helpers/transferProps/README.md +46 -0
  76. package/src/helpers/transferProps/index.js +1 -0
  77. package/src/index.js +3 -3
  78. package/src/styles/elements/_links.scss +2 -14
  79. package/src/styles/generic/_focus.scss +1 -1
  80. package/src/styles/theme/_form-fields.scss +5 -5
  81. package/src/styles/tools/_accessibility.scss +3 -5
  82. package/src/styles/tools/_collections.scss +3 -20
  83. package/src/styles/tools/_links.scss +17 -0
  84. package/src/styles/tools/form-fields/_box-field-elements.scss +21 -9
  85. package/src/styles/tools/form-fields/_box-field-layout.scss +2 -2
  86. package/src/styles/tools/form-fields/_box-field-sizes.scss +6 -10
  87. package/src/styles/tools/form-fields/_variants.scss +10 -10
  88. package/src/theme.scss +51 -1
  89. package/src/translations/en.js +5 -0
  90. package/src/styles/settings/_z-indexes.scss +0 -2
  91. package/src/utils/classNames.js +0 -8
  92. /package/src/{utils → helpers/transferProps}/transferProps.js +0 -0
package/src/index.js CHANGED
@@ -61,6 +61,6 @@ export {
61
61
  export { GlobalPropsProvider } from './providers/globalProps';
62
62
  export { TranslationsProvider } from './providers/translations';
63
63
 
64
- // Utils
65
- export { classNames } from './utils/classNames';
66
- export { transferProps } from './utils/transferProps';
64
+ // Helpers
65
+ export { classNames } from './helpers/classNames';
66
+ export { transferProps } from './helpers/transferProps';
@@ -1,17 +1,5 @@
1
- @use "../theme/links";
1
+ @use "../tools/links";
2
2
 
3
3
  a {
4
- text-decoration: links.$decoration;
5
- text-underline-offset: links.$underline-offset;
6
- color: links.$color;
7
-
8
- &:hover {
9
- text-decoration: links.$hover-decoration;
10
- color: links.$hover-color;
11
- }
12
-
13
- &:active {
14
- text-decoration: links.$active-decoration;
15
- color: links.$active-color;
16
- }
4
+ @include links.base();
17
5
  }
@@ -6,6 +6,6 @@
6
6
  outline: none;
7
7
  }
8
8
 
9
- :is(a, button, input, select, textarea, [type="button"], [type="submit"]) {
9
+ :is(a, button, input, select, textarea, [type="button"], [type="submit"]):focus-visible {
10
10
  @include accessibility.focus-ring();
11
11
  }
@@ -33,15 +33,15 @@ $horizontal-full-width-label-width: var(--rui-FormField--horizontal--full-width_
33
33
  // Form fields: links in validation states
34
34
  $link-validation-colors: (
35
35
  invalid: (
36
+ default: var(--rui-color-feedback-danger),
37
+ hover: var(--rui-color-feedback-danger-hover),
38
+ active: var(--rui-color-feedback-danger-active),
39
+ ),
40
+ valid: (
36
41
  default: var(--rui-color-feedback-success),
37
42
  hover: var(--rui-color-feedback-success-hover),
38
43
  active: var(--rui-color-feedback-success-active),
39
44
  ),
40
- valid: (
41
- default: var(--rui-color-feedback-valid),
42
- hover: var(--rui-color-feedback-valid-hover),
43
- active: var(--rui-color-feedback-valid-active),
44
- ),
45
45
  warning: (
46
46
  default: var(--rui-color-feedback-warning),
47
47
  hover: var(--rui-color-feedback-warning-hover),
@@ -45,9 +45,7 @@
45
45
  }
46
46
 
47
47
  @mixin focus-ring() {
48
- &:focus-visible {
49
- outline: theme.$focus-outline;
50
- outline-offset: theme.$focus-outline-offset;
51
- box-shadow: theme.$focus-box-shadow;
52
- }
48
+ outline: theme.$focus-outline;
49
+ outline-offset: theme.$focus-outline-offset;
50
+ box-shadow: theme.$focus-box-shadow;
53
51
  }
@@ -25,22 +25,6 @@
25
25
  + ")";
26
26
  }
27
27
 
28
- // Function to get the matching link color for a component variant.
29
- //
30
- // @param {String} $value - The value to get the link color for.
31
-
32
- @function _get-link-color-by-value($value) {
33
- @if $value == "light" {
34
- @return "dark";
35
- }
36
-
37
- @if $value == "dark" {
38
- @return "light";
39
- }
40
-
41
- @return $value;
42
- }
43
-
44
28
  // Mixin to generate CSS custom properties for a component theme.
45
29
  //
46
30
  // 1. Generates a CSS custom property for each property in the `$properties` list.
@@ -133,11 +117,10 @@
133
117
 
134
118
  @mixin generate-link-properties($prefix, $variant-value) {
135
119
  $color-category: _get-category-by-value($value: $variant-value, $collections: collections.$colors);
136
- $resolved-variant-value: _get-link-color-by-value($variant-value);
137
120
 
138
- --#{$prefix}local-link-color: var(--rui-color-#{$color-category}-#{$resolved-variant-value});
139
- --#{$prefix}local-link-color-hover: var(--rui-color-#{$color-category}-#{$resolved-variant-value}-hover);
140
- --#{$prefix}local-link-color-active: var(--rui-color-#{$color-category}-#{$resolved-variant-value}-active);
121
+ --#{$prefix}local-link-color: var(--rui-color-#{$color-category}-#{$variant-value});
122
+ --#{$prefix}local-link-color-hover: var(--rui-color-#{$color-category}-#{$variant-value}-hover);
123
+ --#{$prefix}local-link-color-active: var(--rui-color-#{$color-category}-#{$variant-value}-active);
141
124
  }
142
125
 
143
126
  // Mixin to generate CSS classes for a component variant.
@@ -0,0 +1,17 @@
1
+ @use "../theme/links";
2
+
3
+ @mixin base() {
4
+ text-decoration: links.$decoration;
5
+ text-underline-offset: links.$underline-offset;
6
+ color: links.$color;
7
+
8
+ &:hover {
9
+ text-decoration: links.$hover-decoration;
10
+ color: links.$hover-color;
11
+ }
12
+
13
+ &:active {
14
+ text-decoration: links.$active-decoration;
15
+ color: links.$active-color;
16
+ }
17
+ }
@@ -4,6 +4,7 @@
4
4
  // 3. Let inputs properly fit various layout scenarios.
5
5
  // 4. Leave out space for SelectField caret.
6
6
  // 5. Use a block-level display mode to prevent extra white space below grouped inputs in Safari.
7
+ // 6. Pull out the focused input from the group.
7
8
 
8
9
  @use "../../settings/form-fields" as settings;
9
10
  @use "../../theme/form-fields" as theme;
@@ -18,24 +19,29 @@
18
19
  max-width: 100%; // 3.
19
20
  }
20
21
 
21
- @mixin input() {
22
+ @mixin base() {
22
23
  @include transition.add((opacity, color, border-color, background-color, box-shadow));
23
24
 
24
- appearance: none;
25
25
  width: theme.$box-input-width;
26
26
  min-width: theme.$box-input-min-width;
27
27
  max-width: 100%; // 3.
28
28
  height: var(--rui-local-height);
29
29
  padding: var(--rui-local-padding-y) var(--rui-local-padding-x);
30
+ color: var(--rui-local-color);
31
+ border: theme.$box-border-width solid var(--rui-local-border-color);
32
+ border-radius: theme.$box-border-radius;
33
+ background: var(--rui-local-background);
34
+ }
35
+
36
+ @mixin input() {
37
+ @include base();
38
+
39
+ appearance: none;
30
40
  font-weight: settings.$box-input-font-weight;
31
41
  font-size: var(--rui-local-font-size);
32
42
  line-height: settings.$box-input-line-height;
33
43
  font-family: settings.$box-input-font-family;
34
44
  vertical-align: middle;
35
- color: var(--rui-local-color);
36
- border: theme.$box-border-width solid var(--rui-local-border-color);
37
- border-radius: theme.$box-border-radius;
38
- background: var(--rui-local-background);
39
45
  box-shadow: var(--rui-local-box-shadow);
40
46
 
41
47
  &::placeholder {
@@ -124,17 +130,23 @@
124
130
  }
125
131
  }
126
132
 
127
- @mixin in-group-layout() {
133
+ @mixin in-group-layout($input-element-selector: ".input") {
134
+ // 6.
135
+ &:focus-within {
136
+ isolation: isolate;
137
+ z-index: 1;
138
+ }
139
+
128
140
  .inputContainer {
129
141
  display: block; // 5.
130
142
  }
131
143
 
132
- &:not(:first-child) .input {
144
+ &:not(:first-child) #{$input-element-selector} {
133
145
  border-start-start-radius: var(--rui-local-inner-border-radius);
134
146
  border-end-start-radius: var(--rui-local-inner-border-radius);
135
147
  }
136
148
 
137
- &:not(:last-child) .input {
149
+ &:not(:last-child) #{$input-element-selector} {
138
150
  border-start-end-radius: var(--rui-local-inner-border-radius);
139
151
  border-end-end-radius: var(--rui-local-inner-border-radius);
140
152
  }
@@ -166,14 +166,14 @@
166
166
  }
167
167
  }
168
168
 
169
- @mixin full-width() {
169
+ @mixin full-width($input-element-selector: ".input") {
170
170
  display: flex;
171
171
  flex-direction: column;
172
172
  width: 100%;
173
173
 
174
174
  .field,
175
175
  .inputContainer,
176
- .input {
176
+ #{$input-element-selector} {
177
177
  width: 100%;
178
178
  }
179
179
 
@@ -1,22 +1,18 @@
1
1
  @use "sass:map";
2
2
  @use "../../theme/form-fields" as theme;
3
3
 
4
- @mixin size($size, $has-input: true, $is-multiline: false) {
4
+ @mixin size($size, $is-multiline: false) {
5
5
  $size-properties: map.get(theme.$box-sizes, $size);
6
6
 
7
+ --rui-local-height: #{map.get($size-properties, height)};
7
8
  --rui-local-padding-y: #{map.get($size-properties, padding-y)};
8
9
  --rui-local-padding-x: #{map.get($size-properties, padding-x)};
10
+ --rui-local-font-size: #{map.get($size-properties, font-size)};
9
11
 
10
- @if $has-input {
11
- --rui-local-font-size: #{map.get($size-properties, font-size)};
12
-
12
+ @if $is-multiline {
13
13
  .input {
14
- @if $is-multiline {
15
- height: auto;
16
- min-height: map.get($size-properties, height);
17
- } @else {
18
- --rui-local-height: #{map.get($size-properties, height)};
19
- }
14
+ height: auto;
15
+ min-height: map.get($size-properties, height);
20
16
  }
21
17
  }
22
18
  }
@@ -13,11 +13,6 @@
13
13
  @use "../../settings/form-fields" as settings;
14
14
  @use "../../theme/form-fields" as theme;
15
15
 
16
- @mixin _disabled-state() {
17
- opacity: theme.$disabled-opacity;
18
- cursor: theme.$disabled-cursor;
19
- }
20
-
21
16
  // 1.
22
17
  @mixin _generate-custom-properties($type, $variant, $state) {
23
18
  @if not list.index(map.keys(map.get(settings.$themeable-variant-states, $type)), $variant) {
@@ -113,11 +108,16 @@
113
108
  }
114
109
  }
115
110
 
111
+ @mixin disabled-state() {
112
+ opacity: theme.$disabled-opacity;
113
+ cursor: theme.$disabled-cursor;
114
+ }
115
+
116
116
  @mixin visual($type, $variant: "default", $has-caret: false) {
117
117
  @include _get-theme($type, $variant);
118
118
 
119
119
  .input:disabled {
120
- @include _disabled-state();
120
+ @include disabled-state();
121
121
  }
122
122
 
123
123
  @if $type == "box" and $variant == "filled" {
@@ -137,15 +137,15 @@
137
137
  }
138
138
 
139
139
  &.isRootDisabled .caret {
140
- @include _disabled-state();
140
+ @include disabled-state();
141
141
  }
142
142
  }
143
143
  }
144
144
 
145
145
  @mixin validation($variant) {
146
- --rui-local-link-color: map.get(theme.$link-validation-colors, $variant, default);
147
- --rui-local-link-color-hover: map.get(theme.$link-validation-colors, $variant, hover);
148
- --rui-local-link-color-active: map.get(theme.$link-validation-colors, $variant, active);
146
+ --rui-local-link-color: #{map.get(theme.$link-validation-colors, $variant, default)};
147
+ --rui-local-link-color-hover: #{map.get(theme.$link-validation-colors, $variant, hover)};
148
+ --rui-local-link-color-active: #{map.get(theme.$link-validation-colors, $variant, active)};
149
149
 
150
150
  @include _get-theme(validation, $variant);
151
151
  }
package/src/theme.scss CHANGED
@@ -49,7 +49,31 @@
49
49
  // Font Families
50
50
  // =============
51
51
 
52
- --rui-font-family-base: "Titillium Web", helvetica, roboto, arial, sans-serif;
52
+ // Native font stack inspired by Bootstrap.
53
+ // @see https://getbootstrap.com/docs/5.0/content/reboot/#native-font-stack
54
+ // @see https://css-tricks.com/snippets/css/system-font-stack/
55
+ --rui-font-family-base:
56
+ /* Cross-platform generic font family (default user interface font) */
57
+ system-ui,
58
+ /* Safari for macOS and iOS (San Francisco)*/
59
+ -apple-system,
60
+ /* Windows*/
61
+ "Segoe UI",
62
+ /* Android*/
63
+ roboto,
64
+ /* Basic web fallback*/
65
+ "Helvetica Neue",
66
+ arial,
67
+ /* Linux*/
68
+ "Noto Sans",
69
+ "Liberation Sans",
70
+ /* Sans serif fallback*/
71
+ sans-serif,
72
+ /* Emoji fonts*/
73
+ "Apple Color Emoji",
74
+ "Segoe UI Emoji",
75
+ "Segoe UI Symbol",
76
+ "Noto Color Emoji";
53
77
  --rui-font-family-monospace:
54
78
  "SFMono-Regular",
55
79
  "Menlo",
@@ -803,6 +827,7 @@
803
827
  --rui-Card__padding: var(--rui-dimension-space-4);
804
828
  --rui-Card__border-width: var(--rui-dimension-border-width-1);
805
829
  --rui-Card__border-radius: var(--rui-dimension-radius-2);
830
+ --rui-Card__background-color: var(--rui-color-background-layer-1);
806
831
  --rui-Card--dense__padding: var(--rui-dimension-space-2);
807
832
  --rui-Card--raised__box-shadow: var(--rui-shadow-layer-1);
808
833
  --rui-Card--disabled__background-color: var(--rui-color-background-disabled);
@@ -1012,6 +1037,31 @@
1012
1037
  --rui-Modal--large__width: 60rem;
1013
1038
  --rui-Modal--fullscreen__width: 100%;
1014
1039
  --rui-Modal--fullscreen__height: 100%;
1040
+ --rui-Modal__animation__duration: 0.25s;
1041
+
1042
+ // Modal: success variant
1043
+ --rui-Modal--success__border-color: var(--rui-color-feedback-success);
1044
+ --rui-Modal--success__background-color: var(--rui-color-background-success);
1045
+
1046
+ // Modal: warning variant
1047
+ --rui-Modal--warning__border-color: var(--rui-color-feedback-warning);
1048
+ --rui-Modal--warning__background-color: var(--rui-color-background-warning);
1049
+
1050
+ // Modal: danger variant
1051
+ --rui-Modal--danger__border-color: var(--rui-color-feedback-danger);
1052
+ --rui-Modal--danger__background-color: var(--rui-color-background-danger);
1053
+
1054
+ // Modal: info variant
1055
+ --rui-Modal--info__border-color: var(--rui-color-feedback-info);
1056
+ --rui-Modal--info__background-color: var(--rui-color-background-info);
1057
+
1058
+ // Modal: help variant
1059
+ --rui-Modal--help__border-color: var(--rui-color-feedback-help);
1060
+ --rui-Modal--help__background-color: var(--rui-color-background-help);
1061
+
1062
+ // Modal: note variant
1063
+ --rui-Modal--note__border-color: var(--rui-color-feedback-note);
1064
+ --rui-Modal--note__background-color: var(--rui-color-background-note);
1015
1065
 
1016
1066
  //
1017
1067
  // Paper
@@ -2,6 +2,11 @@ export default {
2
2
  Alert: {
3
3
  close: 'Close',
4
4
  },
5
+ FileInputField: {
6
+ browse: 'Browse',
7
+ drop: 'or drop file here',
8
+ filesSelected: 'files selected',
9
+ },
5
10
  ModalCloseButton: {
6
11
  close: 'Close',
7
12
  },
@@ -1,2 +0,0 @@
1
- $modal-backdrop: 2000;
2
- $modal: 2100;
@@ -1,8 +0,0 @@
1
- export const classNames = (...classes) => {
2
- const filteredClassNames = classes.filter(
3
- (className) => typeof className === 'string'
4
- && className.trim().length > 0,
5
- );
6
-
7
- return filteredClassNames.length > 0 ? filteredClassNames.join(' ') : undefined;
8
- };