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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. package/.nvmrc +1 -1
  2. package/dist/react-ui.css +16 -21
  3. package/dist/react-ui.development.css +18 -37
  4. package/dist/react-ui.development.js +101 -91
  5. package/dist/react-ui.js +1 -1
  6. package/package.json +41 -39
  7. package/src/components/Alert/Alert.jsx +1 -1
  8. package/src/components/Alert/README.md +5 -4
  9. package/src/components/Badge/Badge.jsx +1 -1
  10. package/src/components/Badge/README.md +5 -4
  11. package/src/components/Button/Button.jsx +1 -1
  12. package/src/components/Button/README.md +20 -18
  13. package/src/components/Button/_base.scss +1 -4
  14. package/src/components/ButtonGroup/ButtonGroup.jsx +1 -1
  15. package/src/components/ButtonGroup/README.md +5 -4
  16. package/src/components/Card/Card.jsx +1 -1
  17. package/src/components/Card/CardBody.jsx +1 -1
  18. package/src/components/Card/CardFooter.jsx +1 -1
  19. package/src/components/Card/README.md +5 -4
  20. package/src/components/CheckboxField/CheckboxField.jsx +2 -2
  21. package/src/components/CheckboxField/README.md +8 -4
  22. package/src/components/FileInputField/FileInputField.jsx +3 -3
  23. package/src/components/FileInputField/README.md +8 -4
  24. package/src/components/FormLayout/FormLayout.jsx +1 -1
  25. package/src/components/FormLayout/FormLayoutCustomField.jsx +1 -1
  26. package/src/components/FormLayout/README.md +5 -4
  27. package/src/components/Grid/Grid.jsx +1 -1
  28. package/src/components/Grid/Grid.module.scss +2 -4
  29. package/src/components/Grid/GridSpan.jsx +1 -1
  30. package/src/components/Grid/README.md +6 -4
  31. package/src/components/Grid/_settings.scss +2 -2
  32. package/src/components/InputGroup/InputGroup.jsx +2 -2
  33. package/src/components/InputGroup/README.md +5 -4
  34. package/src/components/Modal/Modal.jsx +1 -1
  35. package/src/components/Modal/Modal.module.scss +1 -1
  36. package/src/components/Modal/ModalBody.jsx +1 -1
  37. package/src/components/Modal/ModalCloseButton.jsx +1 -1
  38. package/src/components/Modal/ModalContent.jsx +1 -1
  39. package/src/components/Modal/ModalFooter.jsx +1 -1
  40. package/src/components/Modal/ModalHeader.jsx +2 -4
  41. package/src/components/Modal/ModalTitle.jsx +2 -4
  42. package/src/components/Modal/README.md +3 -2
  43. package/src/components/Paper/Paper.jsx +1 -1
  44. package/src/components/Paper/README.md +5 -4
  45. package/src/components/Popover/Popover.jsx +1 -1
  46. package/src/components/Popover/PopoverWrapper.jsx +1 -1
  47. package/src/components/Popover/README.md +5 -4
  48. package/src/components/Radio/README.md +8 -4
  49. package/src/components/Radio/Radio.jsx +2 -2
  50. package/src/components/ScrollView/README.md +5 -4
  51. package/src/components/ScrollView/ScrollView.jsx +1 -1
  52. package/src/components/ScrollView/ScrollView.module.scss +2 -4
  53. package/src/components/SelectField/README.md +8 -4
  54. package/src/components/SelectField/SelectField.jsx +2 -2
  55. package/src/components/Table/README.md +5 -4
  56. package/src/components/Table/Table.jsx +1 -1
  57. package/src/components/Tabs/README.md +3 -2
  58. package/src/components/Tabs/Tabs.jsx +1 -1
  59. package/src/components/Tabs/TabsItem.jsx +1 -1
  60. package/src/components/Text/README.md +3 -2
  61. package/src/components/Text/Text.jsx +1 -1
  62. package/src/components/TextArea/README.md +8 -4
  63. package/src/components/TextArea/TextArea.jsx +2 -2
  64. package/src/components/TextField/README.md +8 -4
  65. package/src/components/TextField/TextField.jsx +2 -2
  66. package/src/components/TextLink/README.md +5 -4
  67. package/src/components/TextLink/TextLink.jsx +1 -1
  68. package/src/components/Toggle/README.md +8 -4
  69. package/src/components/Toggle/Toggle.jsx +2 -2
  70. package/src/components/Toolbar/README.md +5 -4
  71. package/src/components/Toolbar/Toolbar.jsx +1 -1
  72. package/src/components/Toolbar/ToolbarGroup.jsx +1 -1
  73. package/src/components/Toolbar/ToolbarItem.jsx +1 -1
  74. package/src/index.js +1 -0
  75. package/src/provider/RUIProvider.jsx +6 -3
  76. package/src/styles/tools/form-fields/_box-field-layout.scss +1 -2
  77. package/src/styles/tools/form-fields/_inline-field-layout.scss +1 -0
  78. package/src/utils/mergeDeep.js +28 -0
  79. package/src/{components/_helpers → utils}/transferProps.js +0 -8
@@ -1,8 +1,10 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, {
3
+ useContext,
3
4
  useMemo,
4
5
  } from 'react';
5
6
  import defaultTranslations from '../translations/en';
7
+ import { mergeDeep } from '../utils/mergeDeep';
6
8
  import RUIContext from './RUIContext';
7
9
 
8
10
  const RUIProvider = ({
@@ -10,10 +12,11 @@ const RUIProvider = ({
10
12
  globalProps,
11
13
  translations,
12
14
  }) => {
15
+ const context = useContext(RUIContext);
13
16
  const childProps = useMemo(() => ({
14
- globalProps,
15
- translations,
16
- }), [globalProps, translations]);
17
+ globalProps: mergeDeep(context?.globalProps || {}, globalProps),
18
+ translations: mergeDeep(context?.translations || {}, translations),
19
+ }), [context, globalProps, translations]);
17
20
 
18
21
  return (
19
22
  <RUIContext.Provider
@@ -125,8 +125,7 @@
125
125
 
126
126
  .field {
127
127
  grid-area: field;
128
- align-self: theme.$horizontal-field-vertical-alignment; // 13.
129
- justify-self: start; // 7.
128
+ place-self: theme.$horizontal-field-vertical-alignment start; // 13. / 7.
130
129
  }
131
130
  }
132
131
  }
@@ -85,6 +85,7 @@
85
85
 
86
86
  &.isRootLayoutHorizontal .label {
87
87
  grid-column-start: 1;
88
+ align-self: start;
88
89
  width: auto;
89
90
  padding-right: settings.$horizontal-inner-gap;
90
91
  margin-left: 0;
@@ -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
  */