@react-ui-org/react-ui 0.44.1 → 0.47.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. package/CONTRIBUTING.md +7 -0
  2. package/README.md +15 -16
  3. package/dist/lib.development.js +271 -415
  4. package/dist/lib.js +1 -1
  5. package/package.json +11 -13
  6. package/src/lib/components/Alert/Alert.jsx +45 -44
  7. package/src/lib/components/Alert/Alert.scss +48 -48
  8. package/src/lib/components/Alert/README.mdx +2 -5
  9. package/src/lib/components/Alert/_settings.scss +4 -4
  10. package/src/lib/components/Alert/_theme.scss +50 -50
  11. package/src/lib/components/Alert/_tools.scss +6 -6
  12. package/src/lib/components/Badge/Badge.jsx +9 -11
  13. package/src/lib/components/Badge/Badge.scss +57 -57
  14. package/src/lib/components/Button/Button.jsx +14 -13
  15. package/src/lib/components/Button/Button.scss +2 -2
  16. package/src/lib/components/Button/README.mdx +11 -6
  17. package/src/lib/components/Button/_base.scss +69 -69
  18. package/src/lib/components/Button/_priorities.scss +49 -49
  19. package/src/lib/components/Button/_settings.scss +10 -10
  20. package/src/lib/components/Button/_theme.scss +18 -15
  21. package/src/lib/components/Button/_tools.scss +98 -100
  22. package/src/lib/components/Button/helpers/getRootLabelVisibilityClassName.js +4 -4
  23. package/src/lib/components/ButtonGroup/ButtonGroup.jsx +41 -25
  24. package/src/lib/components/ButtonGroup/ButtonGroup.scss +3 -3
  25. package/src/lib/components/ButtonGroup/README.mdx +1 -1
  26. package/src/lib/components/Card/Card.jsx +10 -9
  27. package/src/lib/components/Card/Card.scss +28 -28
  28. package/src/lib/components/Card/CardBody.jsx +17 -12
  29. package/src/lib/components/Card/CardFooter.jsx +22 -9
  30. package/src/lib/components/Card/_theme.scss +50 -50
  31. package/src/lib/components/Card/_tools.scss +6 -6
  32. package/src/lib/components/CheckboxField/CheckboxField.jsx +21 -20
  33. package/src/lib/components/CheckboxField/CheckboxField.scss +20 -20
  34. package/src/lib/components/CheckboxField/README.mdx +1 -1
  35. package/src/lib/components/FileInputField/FileInputField.jsx +16 -15
  36. package/src/lib/components/FileInputField/FileInputField.scss +19 -19
  37. package/src/lib/components/FileInputField/README.mdx +1 -1
  38. package/src/lib/components/FormLayout/FormLayout.jsx +19 -17
  39. package/src/lib/components/FormLayout/FormLayout.scss +17 -17
  40. package/src/lib/components/FormLayout/FormLayoutCustomField.jsx +18 -12
  41. package/src/lib/components/FormLayout/FormLayoutCustomField.scss +18 -18
  42. package/src/lib/components/FormLayout/README.mdx +26 -49
  43. package/src/lib/components/Grid/Grid.jsx +25 -24
  44. package/src/lib/components/Grid/Grid.scss +33 -29
  45. package/src/lib/components/Grid/GridSpan.jsx +11 -10
  46. package/src/lib/components/Grid/README.mdx +46 -20
  47. package/src/lib/components/Grid/{helpers → _helpers}/generateResponsiveCustomProperties.js +0 -2
  48. package/src/lib/components/Grid/_theme.scss +9 -9
  49. package/src/lib/components/Grid/_tools.scss +20 -20
  50. package/src/lib/components/Modal/Modal.jsx +38 -32
  51. package/src/lib/components/Modal/Modal.scss +73 -73
  52. package/src/lib/components/Modal/README.mdx +2 -5
  53. package/src/lib/components/Modal/_settings.scss +5 -5
  54. package/src/lib/components/Modal/_theme.scss +17 -17
  55. package/src/lib/components/Paper/Paper.jsx +9 -9
  56. package/src/lib/components/Paper/Paper.scss +8 -8
  57. package/src/lib/components/Popover/Popover.jsx +94 -0
  58. package/src/lib/components/Popover/Popover.scss +235 -0
  59. package/src/lib/components/Popover/PopoverWrapper.jsx +46 -0
  60. package/src/lib/components/Popover/README.mdx +333 -0
  61. package/src/lib/components/Popover/_helpers/getRootAlignmentClassName.js +13 -0
  62. package/src/lib/components/Popover/_helpers/getRootSideClassName.js +17 -0
  63. package/src/lib/components/Popover/_theme.scss +16 -0
  64. package/src/lib/components/Popover/index.js +2 -0
  65. package/src/lib/components/Radio/README.mdx +1 -1
  66. package/src/lib/components/Radio/Radio.jsx +15 -14
  67. package/src/lib/components/Radio/Radio.scss +26 -26
  68. package/src/lib/components/ScrollView/README.mdx +5 -5
  69. package/src/lib/components/ScrollView/ScrollView.jsx +22 -22
  70. package/src/lib/components/ScrollView/ScrollView.scss +113 -113
  71. package/src/lib/{services/elementPositionService.js → components/ScrollView/_helpers/getElementsPositionDifference.js} +0 -2
  72. package/src/lib/{hooks → components/ScrollView/_hooks}/useLoadResizeHook.js +1 -1
  73. package/src/lib/{hooks → components/ScrollView/_hooks}/useScrollPositionHook.js +1 -1
  74. package/src/lib/components/SelectField/README.mdx +1 -1
  75. package/src/lib/components/SelectField/SelectField.jsx +17 -16
  76. package/src/lib/components/SelectField/SelectField.scss +30 -30
  77. package/src/lib/components/Table/README.mdx +1 -1
  78. package/src/lib/components/Table/Table.jsx +3 -3
  79. package/src/lib/components/Table/Table.scss +28 -35
  80. package/src/lib/components/Table/_settings.scss +5 -5
  81. package/src/lib/components/Tabs/Tabs.jsx +4 -5
  82. package/src/lib/components/Tabs/Tabs.scss +21 -21
  83. package/src/lib/components/Tabs/TabsItem.jsx +7 -6
  84. package/src/lib/components/Tabs/TabsItem.scss +78 -78
  85. package/src/lib/components/Text/README.mdx +3 -3
  86. package/src/lib/components/Text/Text.jsx +16 -9
  87. package/src/lib/components/Text/Text.scss +23 -13
  88. package/src/lib/components/Text/_helpers/getRootClampClassName.js +11 -0
  89. package/src/lib/components/Text/{helpers → _helpers}/getRootHyphensClassName.js +1 -1
  90. package/src/lib/components/Text/{helpers → _helpers}/getRootWordWrappingClassName.js +1 -1
  91. package/src/lib/components/TextArea/README.mdx +1 -1
  92. package/src/lib/components/TextArea/TextArea.jsx +21 -17
  93. package/src/lib/components/TextArea/TextArea.scss +27 -27
  94. package/src/lib/components/TextField/README.mdx +1 -1
  95. package/src/lib/components/TextField/TextField.jsx +19 -18
  96. package/src/lib/components/TextField/TextField.scss +28 -28
  97. package/src/lib/components/TextLink/README.mdx +77 -0
  98. package/src/lib/components/TextLink/TextLink.jsx +44 -0
  99. package/src/lib/components/TextLink/TextLink.scss +11 -0
  100. package/src/lib/components/TextLink/_theme.scss +4 -0
  101. package/src/lib/components/TextLink/index.js +1 -0
  102. package/src/lib/components/Toggle/README.mdx +1 -1
  103. package/src/lib/components/Toggle/Toggle.jsx +21 -20
  104. package/src/lib/components/Toggle/Toggle.scss +20 -20
  105. package/src/lib/components/Toolbar/README.mdx +33 -5
  106. package/src/lib/components/Toolbar/Toolbar.jsx +33 -17
  107. package/src/lib/components/Toolbar/Toolbar.scss +29 -42
  108. package/src/lib/components/Toolbar/ToolbarGroup.jsx +28 -16
  109. package/src/lib/components/Toolbar/ToolbarItem.jsx +36 -10
  110. package/src/lib/{helpers → components/_helpers}/getRootColorClassName.js +1 -1
  111. package/src/lib/{helpers → components/_helpers}/getRootSizeClassName.js +1 -1
  112. package/src/lib/{helpers → components/_helpers}/getRootValidationStateClassName.js +1 -1
  113. package/src/lib/components/_helpers/isChildrenEmpty.js +3 -0
  114. package/src/lib/{helpers → components/_helpers}/resolveContextOrProp.js +0 -0
  115. package/src/lib/{utils → components/_helpers}/transferProps.js +1 -1
  116. package/src/lib/foundation.scss +11 -11
  117. package/src/lib/helpers.scss +2 -2
  118. package/src/lib/index.js +8 -17
  119. package/src/lib/provider/index.js +2 -1
  120. package/src/lib/provider/withGlobalProps.jsx +21 -0
  121. package/src/lib/styles/_utilities.scss +13 -13
  122. package/src/lib/styles/elements/_code.scss +7 -7
  123. package/src/lib/styles/elements/_links.scss +8 -8
  124. package/src/lib/styles/elements/_lists.scss +3 -3
  125. package/src/lib/styles/elements/_page.scss +14 -14
  126. package/src/lib/styles/elements/_rulers.scss +6 -6
  127. package/src/lib/styles/elements/_small.scss +2 -2
  128. package/src/lib/styles/generic/_box-sizing.scss +3 -2
  129. package/src/lib/styles/generic/_forms.scss +3 -3
  130. package/src/lib/styles/generic/_reset.scss +6 -6
  131. package/src/lib/styles/generic/_shared.scss +3 -3
  132. package/src/lib/styles/helpers/_animation.scss +8 -8
  133. package/src/lib/styles/settings/_breakpoints.scss +7 -7
  134. package/src/lib/styles/settings/_escaped-characters.scss +5 -5
  135. package/src/lib/styles/settings/_form-fields.scss +24 -24
  136. package/src/lib/styles/settings/_utilities.scss +112 -100
  137. package/src/lib/styles/theme/_colors.scss +50 -50
  138. package/src/lib/styles/theme/_form-fields.scss +32 -32
  139. package/src/lib/styles/theme/_spacing.scss +11 -11
  140. package/src/lib/styles/theme/_typography.scss +12 -11
  141. package/src/lib/styles/theme-constants/_breakpoints.scss +4 -4
  142. package/src/lib/styles/theme-constants/_colors.scss +2 -2
  143. package/src/lib/styles/theme-constants/_svg.scss +1 -2
  144. package/src/lib/styles/tools/_accessibility.scss +29 -29
  145. package/src/lib/styles/tools/_breakpoint.scss +11 -14
  146. package/src/lib/styles/tools/_caret.scss +8 -8
  147. package/src/lib/styles/tools/_colors.scss +3 -3
  148. package/src/lib/styles/tools/_reset.scss +24 -21
  149. package/src/lib/styles/tools/_scrollbar.scss +4 -4
  150. package/src/lib/styles/tools/_spacing.scss +14 -22
  151. package/src/lib/styles/tools/_string.scss +9 -9
  152. package/src/lib/styles/tools/_svg.scss +13 -16
  153. package/src/lib/styles/tools/_transition.scss +42 -44
  154. package/src/lib/styles/tools/_utilities.scss +19 -19
  155. package/src/lib/styles/tools/form-fields/_box-field-elements.scss +88 -88
  156. package/src/lib/styles/tools/form-fields/_box-field-layout.scss +147 -147
  157. package/src/lib/styles/tools/form-fields/_box-field-sizes.scss +13 -15
  158. package/src/lib/styles/tools/form-fields/_foundation.scss +12 -12
  159. package/src/lib/styles/tools/form-fields/_inline-field-elements.scss +82 -71
  160. package/src/lib/styles/tools/form-fields/_inline-field-layout.scss +88 -47
  161. package/src/lib/styles/tools/form-fields/_variants.scss +104 -106
  162. package/src/lib/theme.scss +959 -954
  163. package/src/lib/utils/classNames.js +8 -0
  164. package/src/lib/components/CTA/CTA.jsx +0 -60
  165. package/src/lib/components/CTA/CTA.scss +0 -71
  166. package/src/lib/components/CTA/CTACenter.jsx +0 -27
  167. package/src/lib/components/CTA/CTAEnd.jsx +0 -27
  168. package/src/lib/components/CTA/CTAStart.jsx +0 -27
  169. package/src/lib/components/CTA/README.mdx +0 -119
  170. package/src/lib/components/CTA/index.js +0 -4
  171. package/src/lib/components/Center/Center.jsx +0 -27
  172. package/src/lib/components/Center/Center.scss +0 -7
  173. package/src/lib/components/Center/README.mdx +0 -52
  174. package/src/lib/components/Center/index.js +0 -1
  175. package/src/lib/components/Link/Link.jsx +0 -45
  176. package/src/lib/components/Link/Link.scss +0 -11
  177. package/src/lib/components/Link/README.mdx +0 -85
  178. package/src/lib/components/Link/_theme.scss +0 -4
  179. package/src/lib/components/Link/index.js +0 -1
  180. package/src/lib/components/List/List.jsx +0 -71
  181. package/src/lib/components/List/List.scss +0 -53
  182. package/src/lib/components/List/ListItem.jsx +0 -31
  183. package/src/lib/components/List/README.mdx +0 -114
  184. package/src/lib/components/List/_theme.scss +0 -1
  185. package/src/lib/components/List/index.js +0 -2
  186. package/src/lib/components/Media/Media.jsx +0 -29
  187. package/src/lib/components/Media/Media.scss +0 -16
  188. package/src/lib/components/Media/MediaBody.jsx +0 -21
  189. package/src/lib/components/Media/MediaObject.jsx +0 -21
  190. package/src/lib/components/Media/README.mdx +0 -63
  191. package/src/lib/components/Media/index.js +0 -3
  192. package/src/lib/provider/withProviderContext.jsx +0 -32
@@ -1,7 +1,8 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import getRootColorClassName from '../../helpers/getRootColorClassName';
4
- import { withProviderContext } from '../../provider';
3
+ import { withGlobalProps } from '../../provider';
4
+ import { classNames } from '../../utils/classNames';
5
+ import { getRootColorClassName } from '../_helpers/getRootColorClassName';
5
6
  import styles from './Card.scss';
6
7
 
7
8
  export const Card = ({
@@ -13,13 +14,13 @@ export const Card = ({
13
14
  color,
14
15
  }) => (
15
16
  <div
16
- className={[
17
+ className={classNames(
17
18
  styles.root,
18
19
  getRootColorClassName(color, styles),
19
- dense ? styles.rootDense : '',
20
- raised ? styles.rootRaised : '',
21
- disabled ? styles.isDisabled : '',
22
- ].join(' ')}
20
+ dense && styles.rootDense,
21
+ raised && styles.rootRaised,
22
+ disabled && styles.isDisabled,
23
+ )}
23
24
  id={id}
24
25
  >
25
26
  {children}
@@ -66,6 +67,6 @@ Card.propTypes = {
66
67
  raised: PropTypes.bool,
67
68
  };
68
69
 
69
- export const CardWithContext = withProviderContext(Card, 'Card');
70
+ export const CardWithGlobalProps = withGlobalProps(Card, 'Card');
70
71
 
71
- export default CardWithContext;
72
+ export default CardWithGlobalProps;
@@ -1,79 +1,79 @@
1
1
  // 1. Retain equal card widths in flex and grid layouts independently on their content.
2
2
 
3
- @use '../../styles/theme/colors';
4
- @use 'theme';
5
- @use 'tools';
3
+ @use "../../styles/theme/colors";
4
+ @use "theme";
5
+ @use "tools";
6
6
 
7
7
  .root {
8
- --rui-local-padding: #{theme.$padding};
8
+ --rui-local-padding: #{theme.$padding};
9
9
 
10
- display: flex;
11
- flex-direction: column;
12
- min-width: 0; // 1.
13
- color: var(--rui-local-color);
14
- border: theme.$border-width solid var(--rui-local-border-color);
15
- border-radius: theme.$border-radius;
16
- background-color: var(--rui-local-background-color);
10
+ display: flex;
11
+ flex-direction: column;
12
+ min-width: 0; // 1.
13
+ color: var(--rui-local-color);
14
+ border: theme.$border-width solid var(--rui-local-border-color);
15
+ border-radius: theme.$border-radius;
16
+ background-color: var(--rui-local-background-color);
17
17
  }
18
18
 
19
19
  .body {
20
- flex: 1 0 auto;
21
- padding: var(--rui-local-padding);
20
+ flex: 1 0 auto;
21
+ padding: var(--rui-local-padding);
22
22
  }
23
23
 
24
24
  .footer {
25
- padding: var(--rui-local-padding);
25
+ padding: var(--rui-local-padding);
26
26
  }
27
27
 
28
28
  .rootDense {
29
- --rui-local-padding: #{theme.$dense-padding};
29
+ --rui-local-padding: #{theme.$dense-padding};
30
30
  }
31
31
 
32
32
  .rootRaised {
33
- box-shadow: theme.$raised-box-shadow;
33
+ box-shadow: theme.$raised-box-shadow;
34
34
  }
35
35
 
36
36
  .rootColorPrimary {
37
- @include tools.color(primary);
37
+ @include tools.color(primary);
38
38
  }
39
39
 
40
40
  .rootColorSecondary {
41
- @include tools.color(secondary);
41
+ @include tools.color(secondary);
42
42
  }
43
43
 
44
44
  .rootColorSuccess {
45
- @include tools.color(success);
45
+ @include tools.color(success);
46
46
  }
47
47
 
48
48
  .rootColorWarning {
49
- @include tools.color(warning);
49
+ @include tools.color(warning);
50
50
  }
51
51
 
52
52
  .rootColorDanger {
53
- @include tools.color(danger);
53
+ @include tools.color(danger);
54
54
  }
55
55
 
56
56
  .rootColorHelp {
57
- @include tools.color(help);
57
+ @include tools.color(help);
58
58
  }
59
59
 
60
60
  .rootColorInfo {
61
- @include tools.color(info);
61
+ @include tools.color(info);
62
62
  }
63
63
 
64
64
  .rootColorNote {
65
- @include tools.color(note);
65
+ @include tools.color(note);
66
66
  }
67
67
 
68
68
  .rootColorLight {
69
- @include tools.color(light);
69
+ @include tools.color(light);
70
70
  }
71
71
 
72
72
  .rootColorDark {
73
- @include tools.color(dark);
73
+ @include tools.color(dark);
74
74
  }
75
75
 
76
76
  .isDisabled {
77
- background-color: theme.$disabled-background-color;
78
- opacity: theme.$disabled-opacity;
77
+ background-color: theme.$disabled-background-color;
78
+ opacity: theme.$disabled-opacity;
79
79
  }
@@ -1,18 +1,19 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { withProviderContext } from '../../provider';
3
+ import { withGlobalProps } from '../../provider';
4
4
  import styles from './Card.scss';
5
5
 
6
- export const CardBody = (props) => {
7
- const {
8
- children,
9
- } = props;
6
+ export const CardBody = ({
7
+ children,
8
+ id,
9
+ }) => (
10
+ <div className={styles.body} id={id}>
11
+ {children}
12
+ </div>
13
+ );
10
14
 
11
- return (
12
- <div className={styles.body}>
13
- {children}
14
- </div>
15
- );
15
+ CardBody.defaultProps = {
16
+ id: undefined,
16
17
  };
17
18
 
18
19
  CardBody.propTypes = {
@@ -20,8 +21,12 @@ CardBody.propTypes = {
20
21
  * Content of the card.
21
22
  */
22
23
  children: PropTypes.node.isRequired,
24
+ /**
25
+ * ID of the root HTML element.
26
+ */
27
+ id: PropTypes.string,
23
28
  };
24
29
 
25
- export const CardBodyWithContext = withProviderContext(CardBody, 'CardBody');
30
+ export const CardBodyWithGlobalProps = withGlobalProps(CardBody, 'CardBody');
26
31
 
27
- export default CardBodyWithContext;
32
+ export default CardBodyWithGlobalProps;
@@ -1,27 +1,40 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { withProviderContext } from '../../provider';
3
+ import { withGlobalProps } from '../../provider';
4
+ import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
4
5
  import styles from './Card.scss';
5
6
 
6
- export const CardFooter = (props) => {
7
- const {
8
- children,
9
- } = props;
7
+ export const CardFooter = ({
8
+ children,
9
+ id,
10
+ }) => {
11
+ if (isChildrenEmpty(children)) {
12
+ return null;
13
+ }
10
14
 
11
15
  return (
12
- <div className={styles.footer}>
16
+ <div className={styles.footer} id={id}>
13
17
  {children}
14
18
  </div>
15
19
  );
16
20
  };
17
21
 
22
+ CardFooter.defaultProps = {
23
+ children: null,
24
+ id: undefined,
25
+ };
26
+
18
27
  CardFooter.propTypes = {
19
28
  /**
20
29
  * Card actions, usually buttons.
21
30
  */
22
- children: PropTypes.node.isRequired,
31
+ children: PropTypes.node,
32
+ /**
33
+ * ID of the root HTML element.
34
+ */
35
+ id: PropTypes.string,
23
36
  };
24
37
 
25
- export const CardFooterWithContext = withProviderContext(CardFooter, 'CardFooter');
38
+ export const CardFooterWithGlobalProps = withGlobalProps(CardFooter, 'CardFooter');
26
39
 
27
- export default CardFooterWithContext;
40
+ export default CardFooterWithGlobalProps;
@@ -9,54 +9,54 @@ $disabled-background-color: var(--rui-Card--disabled__background-color);
9
9
  $disabled-opacity: var(--rui-Card--disabled__opacity);
10
10
 
11
11
  $colors: (
12
- primary: (
13
- color: var(--rui-Card--primary__color),
14
- border-color: var(--rui-Card--primary__border-color),
15
- background-color: var(--rui-Card--primary__background-color),
16
- ),
17
- secondary: (
18
- color: var(--rui-Card--secondary__color),
19
- border-color: var(--rui-Card--secondary__border-color),
20
- background-color: var(--rui-Card--secondary__background-color),
21
- ),
22
- success: (
23
- color: var(--rui-Card--success__color),
24
- border-color: var(--rui-Card--success__border-color),
25
- background-color: var(--rui-Card--success__background-color),
26
- ),
27
- warning: (
28
- color: var(--rui-Card--warning__color),
29
- border-color: var(--rui-Card--warning__border-color),
30
- background-color: var(--rui-Card--warning__background-color),
31
- ),
32
- danger: (
33
- color: var(--rui-Card--danger__color),
34
- border-color: var(--rui-Card--danger__border-color),
35
- background-color: var(--rui-Card--danger__background-color),
36
- ),
37
- info: (
38
- color: var(--rui-Card--info__color),
39
- border-color: var(--rui-Card--info__border-color),
40
- background-color: var(--rui-Card--info__background-color),
41
- ),
42
- help: (
43
- color: var(--rui-Card--help__color),
44
- border-color: var(--rui-Card--help__border-color),
45
- background-color: var(--rui-Card--help__background-color),
46
- ),
47
- note: (
48
- color: var(--rui-Card--note__color),
49
- border-color: var(--rui-Card--note__border-color),
50
- background-color: var(--rui-Card--note__background-color),
51
- ),
52
- light: (
53
- color: var(--rui-Card--light__color),
54
- border-color: var(--rui-Card--light__border-color),
55
- background-color: var(--rui-Card--light__background-color),
56
- ),
57
- dark: (
58
- color: var(--rui-Card--dark__color),
59
- border-color: var(--rui-Card--dark__border-color),
60
- background-color: var(--rui-Card--dark__background-color),
61
- ),
12
+ primary: (
13
+ color: var(--rui-Card--primary__color),
14
+ border-color: var(--rui-Card--primary__border-color),
15
+ background-color: var(--rui-Card--primary__background-color),
16
+ ),
17
+ secondary: (
18
+ color: var(--rui-Card--secondary__color),
19
+ border-color: var(--rui-Card--secondary__border-color),
20
+ background-color: var(--rui-Card--secondary__background-color),
21
+ ),
22
+ success: (
23
+ color: var(--rui-Card--success__color),
24
+ border-color: var(--rui-Card--success__border-color),
25
+ background-color: var(--rui-Card--success__background-color),
26
+ ),
27
+ warning: (
28
+ color: var(--rui-Card--warning__color),
29
+ border-color: var(--rui-Card--warning__border-color),
30
+ background-color: var(--rui-Card--warning__background-color),
31
+ ),
32
+ danger: (
33
+ color: var(--rui-Card--danger__color),
34
+ border-color: var(--rui-Card--danger__border-color),
35
+ background-color: var(--rui-Card--danger__background-color),
36
+ ),
37
+ info: (
38
+ color: var(--rui-Card--info__color),
39
+ border-color: var(--rui-Card--info__border-color),
40
+ background-color: var(--rui-Card--info__background-color),
41
+ ),
42
+ help: (
43
+ color: var(--rui-Card--help__color),
44
+ border-color: var(--rui-Card--help__border-color),
45
+ background-color: var(--rui-Card--help__background-color),
46
+ ),
47
+ note: (
48
+ color: var(--rui-Card--note__color),
49
+ border-color: var(--rui-Card--note__border-color),
50
+ background-color: var(--rui-Card--note__background-color),
51
+ ),
52
+ light: (
53
+ color: var(--rui-Card--light__color),
54
+ border-color: var(--rui-Card--light__border-color),
55
+ background-color: var(--rui-Card--light__background-color),
56
+ ),
57
+ dark: (
58
+ color: var(--rui-Card--dark__color),
59
+ border-color: var(--rui-Card--dark__border-color),
60
+ background-color: var(--rui-Card--dark__background-color),
61
+ ),
62
62
  );
@@ -1,10 +1,10 @@
1
- @use 'sass:map';
2
- @use 'theme';
1
+ @use "sass:map";
2
+ @use "theme";
3
3
 
4
4
  @mixin color($color) {
5
- $color-variant-properties: map.get(theme.$colors, $color);
5
+ $color-variant-properties: map.get(theme.$colors, $color);
6
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)};
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
10
  }
@@ -1,8 +1,9 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
- import getRootValidationStateClassName from '../../helpers/getRootValidationStateClassName';
4
- import { withProviderContext } from '../../provider';
5
- import transferProps from '../../utils/transferProps';
3
+ import { withGlobalProps } from '../../provider';
4
+ import { classNames } from '../../utils/classNames';
5
+ import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
6
+ import { transferProps } from '../_helpers/transferProps';
6
7
  import { FormLayoutContext } from '../FormLayout';
7
8
  import withForwardedRef from '../withForwardedRef';
8
9
  import styles from './CheckboxField.scss';
@@ -26,19 +27,28 @@ export const CheckboxField = ({
26
27
 
27
28
  return (
28
29
  <label
29
- className={[
30
+ className={classNames(
30
31
  styles.root,
31
- context ? styles.isRootInFormLayout : '',
32
+ context && styles.isRootInFormLayout,
32
33
  context && context.layout === 'horizontal' ? styles.rootLayoutHorizontal : styles.rootLayoutVertical,
33
- labelPosition === 'before' ? styles.hasRootLabelBefore : '',
34
- disabled ? styles.isRootDisabled : '',
35
- required ? styles.isRootRequired : '',
34
+ labelPosition === 'before' && styles.hasRootLabelBefore,
35
+ disabled && styles.isRootDisabled,
36
+ required && styles.isRootRequired,
36
37
  getRootValidationStateClassName(validationState, styles),
37
- ].join(' ')}
38
+ )}
38
39
  htmlFor={id}
39
40
  id={id && `${id}__label`}
40
41
  >
41
42
  <div className={styles.field}>
43
+ <div
44
+ className={classNames(
45
+ styles.label,
46
+ !isLabelVisible && styles.isLabelHidden,
47
+ )}
48
+ id={id && `${id}__labelText`}
49
+ >
50
+ {label}
51
+ </div>
42
52
  <input
43
53
  {...transferProps(restProps)}
44
54
  checked={checked}
@@ -50,15 +60,6 @@ export const CheckboxField = ({
50
60
  type="checkbox"
51
61
  value={value}
52
62
  />
53
- <div
54
- className={[
55
- styles.label,
56
- isLabelVisible ? '' : styles.isLabelHidden,
57
- ].join(' ')}
58
- id={id && `${id}__labelText`}
59
- >
60
- {label}
61
- </div>
62
63
  </div>
63
64
  {helpText && (
64
65
  <div
@@ -159,6 +160,6 @@ CheckboxField.propTypes = {
159
160
  ]),
160
161
  };
161
162
 
162
- export const CheckboxFieldWithContext = withForwardedRef(withProviderContext(CheckboxField, 'CheckboxField'));
163
+ export const CheckboxFieldWithGlobalProps = withForwardedRef(withGlobalProps(CheckboxField, 'CheckboxField'));
163
164
 
164
- export default CheckboxFieldWithContext;
165
+ export default CheckboxFieldWithGlobalProps;
@@ -1,61 +1,61 @@
1
- @use '../../styles/tools/form-fields/foundation';
2
- @use '../../styles/tools/form-fields/inline-field-elements';
3
- @use '../../styles/tools/form-fields/inline-field-layout';
4
- @use '../../styles/tools/form-fields/variants';
5
- @use '../../styles/tools/accessibility';
1
+ @use "../../styles/tools/form-fields/foundation";
2
+ @use "../../styles/tools/form-fields/inline-field-elements";
3
+ @use "../../styles/tools/form-fields/inline-field-layout";
4
+ @use "../../styles/tools/form-fields/variants";
5
+ @use "../../styles/tools/accessibility";
6
6
 
7
7
  // Foundation
8
8
  .root {
9
- @include foundation.root();
10
- @include inline-field-layout.root();
11
- @include inline-field-elements.min-tap-target($type: checkbox);
12
- @include variants.visual(check);
9
+ @include foundation.root();
10
+ @include inline-field-layout.root();
11
+ @include inline-field-elements.min-tap-target($type: checkbox);
12
+ @include variants.visual(check);
13
13
  }
14
14
 
15
15
  .label {
16
- @include foundation.label();
16
+ @include foundation.label();
17
17
  }
18
18
 
19
19
  .field {
20
- @include inline-field-layout.field();
20
+ @include inline-field-layout.field($type: checkbox);
21
21
  }
22
22
 
23
23
  .input {
24
- @include inline-field-elements.check-input($type: checkbox);
24
+ @include inline-field-elements.check-input($type: checkbox);
25
25
  }
26
26
 
27
27
  .helpText,
28
28
  .validationText {
29
- @include foundation.help-text();
29
+ @include foundation.help-text();
30
30
  }
31
31
 
32
32
  .isRootRequired .label {
33
- @include foundation.label-required();
33
+ @include foundation.label-required();
34
34
  }
35
35
 
36
36
  // States
37
37
  .isRootStateInvalid {
38
- @include variants.validation(invalid);
38
+ @include variants.validation(invalid);
39
39
  }
40
40
 
41
41
  .isRootStateValid {
42
- @include variants.validation(valid);
42
+ @include variants.validation(valid);
43
43
  }
44
44
 
45
45
  .isRootStateWarning {
46
- @include variants.validation(warning);
46
+ @include variants.validation(warning);
47
47
  }
48
48
 
49
49
  // Invisible label
50
50
  .isLabelHidden {
51
- @include accessibility.hide-text();
51
+ @include accessibility.hide-text();
52
52
  }
53
53
 
54
54
  // Layouts
55
55
  .hasRootLabelBefore {
56
- @include inline-field-layout.has-label-before();
56
+ @include inline-field-layout.has-label-before();
57
57
  }
58
58
 
59
59
  .isRootInFormLayout {
60
- @include inline-field-layout.in-form-layout();
60
+ @include inline-field-layout.in-form-layout();
61
61
  }
@@ -185,7 +185,7 @@ Disabled state makes the input unavailable.
185
185
 
186
186
  In addition to the options below, you can specify [React synthetic events] or
187
187
  any custom HTML attributes that do not interfere with the API, and they will be
188
- passed to the `input` HTML element. This enables making the component
188
+ passed to the `<input>` HTML element. This enables making the component
189
189
  interactive and helps improve its accessibility.
190
190
 
191
191
  <Props table of={CheckboxField} />
@@ -1,9 +1,10 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
- import getRootValidationStateClassName from '../../helpers/getRootValidationStateClassName';
4
- import { resolveContextOrProp } from '../../helpers/resolveContextOrProp';
5
- import { withProviderContext } from '../../provider';
6
- import transferProps from '../../utils/transferProps';
3
+ import { withGlobalProps } from '../../provider';
4
+ import { classNames } from '../../utils/classNames';
5
+ import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
6
+ import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
7
+ import { transferProps } from '../_helpers/transferProps';
7
8
  import { FormLayoutContext } from '../FormLayout';
8
9
  import withForwardedRef from '../withForwardedRef';
9
10
  import styles from './FileInputField.scss';
@@ -26,25 +27,25 @@ export const FileInputField = ({
26
27
 
27
28
  return (
28
29
  <label
29
- className={[
30
+ className={classNames(
30
31
  styles.root,
31
- fullWidth ? styles.isRootFullWidth : '',
32
- context ? styles.isRootInFormLayout : '',
32
+ fullWidth && styles.isRootFullWidth,
33
+ context && styles.isRootInFormLayout,
33
34
  resolveContextOrProp(context && context.layout, layout) === 'horizontal'
34
35
  ? styles.rootLayoutHorizontal
35
36
  : styles.rootLayoutVertical,
36
- disabled ? styles.isRootDisabled : '',
37
- required ? styles.isRootRequired : '',
37
+ disabled && styles.isRootDisabled,
38
+ required && styles.isRootRequired,
38
39
  getRootValidationStateClassName(validationState, styles),
39
- ].join(' ')}
40
+ )}
40
41
  htmlFor={id}
41
42
  id={id && `${id}__label`}
42
43
  >
43
44
  <div
44
- className={[
45
+ className={classNames(
45
46
  styles.label,
46
- isLabelVisible ? '' : styles.isLabelHidden,
47
- ].join(' ')}
47
+ !isLabelVisible && styles.isLabelHidden,
48
+ )}
48
49
  id={id && `${id}__labelText`}
49
50
  >
50
51
  {label}
@@ -157,6 +158,6 @@ FileInputField.propTypes = {
157
158
  validationText: PropTypes.node,
158
159
  };
159
160
 
160
- export const FileInputFieldWithContext = withForwardedRef(withProviderContext(FileInputField, 'FileInputField'));
161
+ export const FileInputFieldWithGlobalProps = withForwardedRef(withGlobalProps(FileInputField, 'FileInputField'));
161
162
 
162
- export default FileInputFieldWithContext;
163
+ export default FileInputFieldWithGlobalProps;