@react-ui-org/react-ui 0.57.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 (118) hide show
  1. package/.nvmrc +1 -1
  2. package/README.md +2 -11
  3. package/dist/react-ui.css +19 -19
  4. package/dist/react-ui.development.css +1351 -963
  5. package/dist/react-ui.development.js +187 -87
  6. package/dist/react-ui.js +1 -1
  7. package/package.json +16 -5
  8. package/src/components/Alert/Alert.jsx +7 -9
  9. package/src/components/Alert/Alert.module.scss +3 -3
  10. package/src/components/Alert/README.md +18 -32
  11. package/src/components/Alert/_settings.scss +1 -2
  12. package/src/components/Badge/Badge.jsx +3 -3
  13. package/src/components/Button/Button.jsx +3 -3
  14. package/src/components/ButtonGroup/ButtonGroup.jsx +3 -3
  15. package/src/components/Card/Card.jsx +7 -7
  16. package/src/components/Card/Card.module.scss +8 -7
  17. package/src/components/Card/CardBody.jsx +2 -2
  18. package/src/components/Card/CardFooter.jsx +2 -2
  19. package/src/components/Card/README.md +20 -17
  20. package/src/components/Card/_settings.scss +1 -2
  21. package/src/components/Card/_theme.scss +1 -0
  22. package/src/components/CheckboxField/CheckboxField.jsx +11 -5
  23. package/src/components/CheckboxField/README.md +110 -5
  24. package/src/components/FileInputField/FileInputField.jsx +148 -22
  25. package/src/components/FileInputField/FileInputField.module.scss +87 -1
  26. package/src/components/FileInputField/README.md +83 -2
  27. package/src/components/FileInputField/_settings.scss +15 -0
  28. package/src/components/FormLayout/FormLayout.jsx +3 -3
  29. package/src/components/FormLayout/FormLayoutCustomField.jsx +3 -3
  30. package/src/components/FormLayout/README.md +1 -0
  31. package/src/components/Grid/Grid.jsx +2 -2
  32. package/src/components/Grid/Grid.module.scss +2 -2
  33. package/src/components/Grid/GridSpan.jsx +2 -2
  34. package/src/components/InputGroup/InputGroup.jsx +4 -4
  35. package/src/components/InputGroup/InputGroup.module.scss +12 -8
  36. package/src/components/InputGroup/README.md +1 -1
  37. package/src/components/Modal/Modal.jsx +118 -46
  38. package/src/components/Modal/Modal.module.scss +34 -18
  39. package/src/components/Modal/ModalBody.jsx +3 -3
  40. package/src/components/Modal/ModalBody.module.scss +18 -0
  41. package/src/components/Modal/ModalCloseButton.jsx +4 -6
  42. package/src/components/Modal/ModalContent.jsx +2 -2
  43. package/src/components/Modal/ModalFooter.jsx +3 -3
  44. package/src/components/Modal/ModalFooter.module.scss +6 -2
  45. package/src/components/Modal/ModalHeader.jsx +3 -3
  46. package/src/components/Modal/ModalHeader.module.scss +8 -1
  47. package/src/components/Modal/ModalTitle.jsx +2 -2
  48. package/src/components/Modal/README.md +407 -187
  49. package/src/components/Modal/_animations.scss +9 -0
  50. package/src/components/Modal/_helpers/dialogOnCancelHandler.js +28 -0
  51. package/src/components/Modal/_helpers/dialogOnClickHandler.js +46 -0
  52. package/src/components/Modal/_helpers/dialogOnCloseHandler.js +28 -0
  53. package/src/components/Modal/_helpers/dialogOnKeyDownHandler.js +62 -0
  54. package/src/components/Modal/_helpers/getPositionClassName.js +1 -1
  55. package/src/components/Modal/_hooks/useModalFocus.js +24 -91
  56. package/src/components/Modal/_settings.scss +4 -3
  57. package/src/components/Modal/_theme.scss +1 -0
  58. package/src/components/Paper/Paper.jsx +3 -3
  59. package/src/components/Popover/Popover.jsx +60 -15
  60. package/src/components/Popover/Popover.module.scss +37 -9
  61. package/src/components/Popover/PopoverWrapper.jsx +2 -2
  62. package/src/components/Popover/README.md +60 -3
  63. package/src/components/Popover/_helpers/cleanPlacementStyle.js +20 -0
  64. package/src/components/Radio/README.md +103 -0
  65. package/src/components/Radio/Radio.jsx +11 -5
  66. package/src/components/Radio/Radio.module.scss +4 -0
  67. package/src/components/ScrollView/ScrollView.jsx +5 -7
  68. package/src/components/SelectField/README.md +103 -0
  69. package/src/components/SelectField/SelectField.jsx +11 -5
  70. package/src/components/Table/Table.jsx +2 -2
  71. package/src/components/Tabs/Tabs.jsx +2 -2
  72. package/src/components/Tabs/TabsItem.jsx +3 -3
  73. package/src/components/Text/Text.jsx +3 -3
  74. package/src/components/TextArea/TextArea.jsx +3 -3
  75. package/src/components/TextField/README.md +14 -2
  76. package/src/components/TextField/TextField.jsx +3 -3
  77. package/src/components/TextLink/README.md +10 -3
  78. package/src/components/TextLink/TextLink.jsx +2 -2
  79. package/src/components/TextLink/_theme.scss +3 -3
  80. package/src/components/Toggle/README.md +83 -1
  81. package/src/components/Toggle/Toggle.jsx +11 -5
  82. package/src/components/Toolbar/Toolbar.jsx +3 -3
  83. package/src/components/Toolbar/ToolbarGroup.jsx +3 -3
  84. package/src/components/Toolbar/ToolbarItem.jsx +3 -3
  85. package/src/components/_helpers/resolveContextOrProp.js +6 -3
  86. package/src/helpers/classNames/README.md +65 -0
  87. package/src/helpers/classNames/classNames.js +11 -0
  88. package/src/helpers/classNames/index.js +1 -0
  89. package/src/helpers/transferProps/README.md +46 -0
  90. package/src/helpers/transferProps/index.js +1 -0
  91. package/src/index.js +6 -5
  92. package/src/providers/globalProps/GlobalPropsContext.jsx +5 -0
  93. package/src/providers/globalProps/GlobalPropsProvider.jsx +33 -0
  94. package/src/providers/globalProps/index.js +3 -0
  95. package/src/{provider → providers/globalProps}/withGlobalProps.jsx +16 -16
  96. package/src/providers/translations/TranslationsContext.jsx +6 -0
  97. package/src/providers/translations/TranslationsProvider.jsx +33 -0
  98. package/src/providers/translations/index.js +2 -0
  99. package/src/styles/elements/_links.scss +2 -9
  100. package/src/styles/generic/_focus.scss +1 -1
  101. package/src/styles/theme/_form-fields.scss +19 -0
  102. package/src/styles/theme/_links.scss +4 -3
  103. package/src/styles/tools/_accessibility.scss +3 -5
  104. package/src/styles/tools/_collections.scss +62 -5
  105. package/src/styles/tools/_links.scss +17 -0
  106. package/src/styles/tools/form-fields/_box-field-elements.scss +21 -9
  107. package/src/styles/tools/form-fields/_box-field-layout.scss +2 -2
  108. package/src/styles/tools/form-fields/_box-field-sizes.scss +6 -10
  109. package/src/styles/tools/form-fields/_foundation.scss +6 -4
  110. package/src/styles/tools/form-fields/_variants.scss +12 -8
  111. package/src/theme.scss +53 -2
  112. package/src/translations/en.js +5 -0
  113. package/src/provider/RUIContext.jsx +0 -9
  114. package/src/provider/RUIProvider.jsx +0 -42
  115. package/src/provider/index.js +0 -3
  116. package/src/styles/settings/_z-indexes.scss +0 -2
  117. package/src/utils/classNames.js +0 -8
  118. /package/src/{utils → helpers/transferProps}/transferProps.js +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-ui-org/react-ui",
3
3
  "description": "React UI is a themeable UI library for React apps.",
4
- "version": "0.57.0",
4
+ "version": "0.59.0",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",
@@ -31,6 +31,17 @@
31
31
  "engines": {
32
32
  "node": ">=20"
33
33
  },
34
+ "devEngines": {
35
+ "runtime": {
36
+ "name": "node",
37
+ "version": "22.x",
38
+ "onFail": "error"
39
+ },
40
+ "packageManager": {
41
+ "name": "npm",
42
+ "onFail": "error"
43
+ }
44
+ },
34
45
  "scripts": {
35
46
  "build": "webpack --mode=production && webpack --mode=development",
36
47
  "copy": "npm run copy:css && npm run copy:js",
@@ -45,7 +56,7 @@
45
56
  "precopy": "rm -rf dist && mkdir dist",
46
57
  "prepublishOnly": "npm run build",
47
58
  "start": "webpack --watch --mode=development",
48
- "stylelint": "stylelint \"src/**/*.scss\" --config stylelint.config.js",
59
+ "stylelint": "stylelint \"src/**/*.{css,scss}\" \"!src/docs/_assets/generated/**\" --config stylelint.config.js",
49
60
  "test": "npm run jest"
50
61
  },
51
62
  "dependencies": {
@@ -65,10 +76,11 @@
65
76
  "@babel/preset-env": "^7.24.7",
66
77
  "@babel/preset-react": "^7.24.7",
67
78
  "@babel/register": "^7.24.6",
79
+ "@happy-dom/jest-environment": "^16.6.0",
68
80
  "@stylistic/stylelint-config": "^1.0.1",
69
81
  "@svgr/webpack": "^8.1.0",
70
- "@testing-library/jest-dom": "^6.4.6",
71
- "@testing-library/react": "^16.0.0",
82
+ "@testing-library/jest-dom": "^6.6.3",
83
+ "@testing-library/react": "^16.1.0",
72
84
  "@testing-library/user-event": "^14.5.2",
73
85
  "@visionappscz/eslint-config-visionapps": "^1.7.0",
74
86
  "@visionappscz/stylelint-config": "^4.0.0",
@@ -86,7 +98,6 @@
86
98
  "eslint-plugin-react-hooks": "^4.6.2",
87
99
  "identity-obj-proxy": "^3.0.0",
88
100
  "jest": "^29.7.0",
89
- "jest-environment-jsdom": "^29.7.0",
90
101
  "markdownlint-cli2": "^0.13.0",
91
102
  "mini-css-extract-plugin": "^2.9.0",
92
103
  "postcss": "^8.4.39",
@@ -1,11 +1,9 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
- import {
4
- RUIContext,
5
- withGlobalProps,
6
- } from '../../provider';
7
- import { classNames } from '../../utils/classNames';
8
- import { transferProps } from '../../utils/transferProps';
3
+ import { withGlobalProps } from '../../providers/globalProps';
4
+ import { TranslationsContext } from '../../providers/translations';
5
+ import { classNames } from '../../helpers/classNames/classNames';
6
+ import { transferProps } from '../../helpers/transferProps';
9
7
  import { getRootColorClassName } from '../_helpers/getRootColorClassName';
10
8
  import styles from './Alert.module.scss';
11
9
 
@@ -17,7 +15,7 @@ export const Alert = ({
17
15
  onClose,
18
16
  ...restProps
19
17
  }) => {
20
- const { translations } = useContext(RUIContext);
18
+ const translations = useContext(TranslationsContext);
21
19
 
22
20
  return (
23
21
  <div
@@ -71,9 +69,9 @@ Alert.propTypes = {
71
69
  children: PropTypes.node.isRequired,
72
70
  /**
73
71
  * Color variant to clarify importance and meaning of the alert. Implements
74
- * [Feedback and Neutral color collections](/docs/foundation/collections#colors).
72
+ * [Feedback color collection](/docs/foundation/collections#colors).
75
73
  */
76
- color: PropTypes.oneOf(['success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark']),
74
+ color: PropTypes.oneOf(['success', 'warning', 'danger', 'help', 'info', 'note']),
77
75
  /**
78
76
  * Optional element to be displayed next to the alert body.
79
77
  */
@@ -25,8 +25,8 @@
25
25
  padding: theme.$padding;
26
26
  }
27
27
 
28
- .close,
29
- .icon {
28
+ .icon,
29
+ .close {
30
30
  height: settings.$min-height;
31
31
  color: var(--rui-local-foreground-color);
32
32
  }
@@ -46,7 +46,6 @@
46
46
  line-height: settings.$line-height;
47
47
  }
48
48
 
49
- .message a,
50
49
  .message strong {
51
50
  font-weight: theme.$emphasis-font-weight;
52
51
  color: var(--rui-local-foreground-color);
@@ -73,6 +72,7 @@
73
72
  $variant-name: "color",
74
73
  $variant-value: $color,
75
74
  $properties: settings.$themeable-properties,
75
+ $inherit-link-color: true,
76
76
  );
77
77
  }
78
78
  }
@@ -41,6 +41,8 @@ Success alerts confirm that an operation has been processed successfully.
41
41
  ```docoff-react-preview
42
42
  <Alert color="success">
43
43
  <strong>Success:</strong> Settings have been successfully saved.
44
+ {' '}
45
+ <TextLink href="/" label="Undo" />
44
46
  </Alert>
45
47
  ```
46
48
 
@@ -53,7 +55,7 @@ suggest an action to resolve the problem.
53
55
  <Alert color="warning">
54
56
  <strong>Warning:</strong> Your credit card is going to expire soon.
55
57
  {' '}
56
- <a href="/">Update my payment options</a>
58
+ <TextLink href="/" label="Update my payment options" />
57
59
  </Alert>
58
60
  ```
59
61
 
@@ -68,7 +70,7 @@ problem.
68
70
  <strong>Error:</strong> Cannot connect to the server. Is your internet
69
71
  connection working fine?
70
72
  {' '}
71
- <a href="/">Try again</a>
73
+ <TextLink href="/" label="Try again" />
72
74
  </Alert>
73
75
  ```
74
76
 
@@ -80,6 +82,8 @@ This kind of alert can be used to display helpful information.
80
82
  <Alert color="help">
81
83
  <strong>Help:</strong> You should choose a password you don&apos;t use
82
84
  anywhere else.
85
+ {' '}
86
+ <TextLink href="/" label="Help me choose" />
83
87
  </Alert>
84
88
  ```
85
89
 
@@ -90,6 +94,8 @@ Another common, informative alert.
90
94
  ```docoff-react-preview
91
95
  <Alert color="info">
92
96
  <strong>Info:</strong> This feature depends on user&apos;s OS preferences.
97
+ {' '}
98
+ <TextLink href="/" label="Open preferences" />
93
99
  </Alert>
94
100
  ```
95
101
 
@@ -100,28 +106,8 @@ Neutral informative alert.
100
106
  ```docoff-react-preview
101
107
  <Alert>
102
108
  <strong>Note:</strong> This feature may not be available in all regions.
103
- </Alert>
104
- ```
105
-
106
- ### Light
107
-
108
- Light alert variant.
109
-
110
- ```docoff-react-preview
111
- <docoff-placeholder dark>
112
- <Alert color="light">
113
- <strong>Light alert:</strong> Stands out on dark backgrounds.
114
- </Alert>
115
- </docoff-placeholder>
116
- ```
117
-
118
- ### Dark
119
-
120
- Dark alert variant.
121
-
122
- ```docoff-react-preview
123
- <Alert color="dark">
124
- <strong>Dark alert:</strong> Stands out on light backgrounds.
109
+ {' '}
110
+ <TextLink href="/" label="Show list of regions" />
125
111
  </Alert>
126
112
  ```
127
113
 
@@ -190,14 +176,14 @@ helps to improve its accessibility.
190
176
 
191
177
  ### Common Theming Options
192
178
 
193
- | Custom Property | Description |
194
- |------------------------------------------------------|--------------------------------------------------------------|
195
- | `--rui-Alert__padding` | Padding between border and message |
196
- | `--rui-Alert__font-weight` | Message font weight |
197
- | `--rui-Alert__border-width` | Border width |
198
- | `--rui-Alert__border-radius` | Corner radius |
199
- | `--rui-Alert__emphasis__font-weight` | Font weight of text emphasised with `<strong>` |
200
- | `--rui-Alert__stripe__width` | Width of the border at the start of the Alert |
179
+ | Custom Property | Description |
180
+ |--------------------------------------|------------------------------------------------|
181
+ | `--rui-Alert__padding` | Padding between border and message |
182
+ | `--rui-Alert__font-weight` | Message font weight |
183
+ | `--rui-Alert__border-width` | Border width |
184
+ | `--rui-Alert__border-radius` | Corner radius |
185
+ | `--rui-Alert__emphasis__font-weight` | Font weight of text emphasised with `<strong>` |
186
+ | `--rui-Alert__stripe__width` | Width of the border at the start of the Alert |
201
187
 
202
188
  ### Theming Variants
203
189
 
@@ -1,4 +1,3 @@
1
- @use "sass:list";
2
1
  @use "sass:map";
3
2
  @use "../../styles/settings/collections";
4
3
  @use "../../styles/theme/typography";
@@ -8,5 +7,5 @@ $font-size: map.get(typography.$font-size-values, 1);
8
7
  $line-height: typography.$line-height-base;
9
8
  $min-height: calc(#{$font-size} * #{$line-height} + 2 * #{theme.$padding});
10
9
 
11
- $colors: list.join(collections.$feedback-colors, collections.$neutral-colors);
10
+ $colors: collections.$feedback-colors;
12
11
  $themeable-properties: color, foreground-color, background-color;
@@ -1,8 +1,8 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { withGlobalProps } from '../../provider';
4
- import { classNames } from '../../utils/classNames';
5
- import { transferProps } from '../../utils/transferProps';
3
+ import { withGlobalProps } from '../../providers/globalProps';
4
+ import { classNames } from '../../helpers/classNames/classNames';
5
+ import { transferProps } from '../../helpers/transferProps';
6
6
  import { getRootColorClassName } from '../_helpers/getRootColorClassName';
7
7
  import { getRootPriorityClassName } from '../_helpers/getRootPriorityClassName';
8
8
  import styles from './Badge.module.scss';
@@ -1,8 +1,8 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
- import { withGlobalProps } from '../../provider';
4
- import { classNames } from '../../utils/classNames';
5
- import { transferProps } from '../../utils/transferProps';
3
+ import { withGlobalProps } from '../../providers/globalProps';
4
+ import { classNames } from '../../helpers/classNames/classNames';
5
+ import { transferProps } from '../../helpers/transferProps';
6
6
  import { getRootColorClassName } from '../_helpers/getRootColorClassName';
7
7
  import { getRootPriorityClassName } from '../_helpers/getRootPriorityClassName';
8
8
  import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
@@ -2,9 +2,9 @@ import PropTypes from 'prop-types';
2
2
  import React, {
3
3
  useMemo,
4
4
  } from 'react';
5
- import { withGlobalProps } from '../../provider';
6
- import { classNames } from '../../utils/classNames';
7
- import { transferProps } from '../../utils/transferProps';
5
+ import { withGlobalProps } from '../../providers/globalProps';
6
+ import { classNames } from '../../helpers/classNames/classNames';
7
+ import { transferProps } from '../../helpers/transferProps';
8
8
  import { getRootPriorityClassName } from '../_helpers/getRootPriorityClassName';
9
9
  import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
10
10
  import styles from './ButtonGroup.module.scss';
@@ -1,8 +1,8 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { withGlobalProps } from '../../provider';
4
- import { classNames } from '../../utils/classNames';
5
- import { transferProps } from '../../utils/transferProps';
3
+ import { withGlobalProps } from '../../providers/globalProps';
4
+ import { classNames } from '../../helpers/classNames/classNames';
5
+ import { transferProps } from '../../helpers/transferProps';
6
6
  import { getRootColorClassName } from '../_helpers/getRootColorClassName';
7
7
  import styles from './Card.module.scss';
8
8
 
@@ -18,7 +18,7 @@ export const Card = ({
18
18
  {...transferProps(restProps)}
19
19
  className={classNames(
20
20
  styles.root,
21
- getRootColorClassName(color, styles),
21
+ color && getRootColorClassName(color, styles),
22
22
  dense && styles.isRootDense,
23
23
  raised && styles.isRootRaised,
24
24
  disabled && styles.isRootDisabled,
@@ -29,7 +29,7 @@ export const Card = ({
29
29
  );
30
30
 
31
31
  Card.defaultProps = {
32
- color: 'light',
32
+ color: undefined,
33
33
  dense: false,
34
34
  disabled: false,
35
35
  raised: false,
@@ -45,9 +45,9 @@ Card.propTypes = {
45
45
  children: PropTypes.node.isRequired,
46
46
  /**
47
47
  * Color to clarify importance and meaning of the card. Implements
48
- * [Feedback and Neutral color collections](/docs/foundation/collections#colors).
48
+ * [Feedback color collection](/docs/foundation/collections#colors).
49
49
  */
50
- color: PropTypes.oneOf(['success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark']),
50
+ color: PropTypes.oneOf(['success', 'warning', 'danger', 'help', 'info', 'note']),
51
51
  /**
52
52
  * Make the card more compact.
53
53
  */
@@ -12,9 +12,9 @@
12
12
  flex-direction: column;
13
13
  min-width: 0; // 1.
14
14
  color: var(--rui-local-color);
15
- border: theme.$border-width solid var(--rui-local-border-color);
15
+ border: theme.$border-width solid var(--rui-local-border-color, transparent);
16
16
  border-radius: theme.$border-radius;
17
- background-color: var(--rui-local-background-color);
17
+ background-color: var(--rui-local-background-color, theme.$background-color);
18
18
  }
19
19
 
20
20
  .body {
@@ -34,18 +34,19 @@
34
34
  box-shadow: theme.$raised-box-shadow;
35
35
  }
36
36
 
37
+ .isRootDisabled {
38
+ background-color: theme.$disabled-background-color;
39
+ opacity: theme.$disabled-opacity;
40
+ }
41
+
37
42
  @each $color in settings.$colors {
38
43
  @include collections.generate-class(
39
44
  $prefix: "rui-",
40
45
  $component-name: "Card",
41
46
  $variant-name: "color",
42
47
  $variant-value: $color,
48
+ $inherit-link-color: true,
43
49
  $properties: settings.$themeable-properties,
44
50
  );
45
51
  }
46
-
47
- .isRootDisabled {
48
- background-color: theme.$disabled-background-color;
49
- opacity: theme.$disabled-opacity;
50
- }
51
52
  }
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { withGlobalProps } from '../../provider';
4
- import { transferProps } from '../../utils/transferProps';
3
+ import { withGlobalProps } from '../../providers/globalProps';
4
+ import { transferProps } from '../../helpers/transferProps';
5
5
  import styles from './Card.module.scss';
6
6
 
7
7
  export const CardBody = ({
@@ -1,7 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
- import { withGlobalProps } from '../../provider';
4
- import { transferProps } from '../../utils/transferProps';
3
+ import { transferProps } from '../../helpers/transferProps';
4
+ import { withGlobalProps } from '../../providers/globalProps';
5
5
  import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
6
6
  import styles from './Card.module.scss';
7
7
 
@@ -148,12 +148,14 @@ for card content.
148
148
  ## Color Variants
149
149
 
150
150
  To cover all possible needs of your project, Card is available in colors from
151
- [Feedback and Neutral color collections](/docs/foundation/collections#colors).
151
+ [Feedback color collection](/docs/foundation/collections#colors).
152
152
 
153
153
  ```docoff-react-preview
154
154
  <Card color="success">
155
155
  <CardBody>
156
156
  Hello! I&apos;m success variant of card.
157
+ {' '}
158
+ <TextLink href="/" label="This is a link" />
157
159
  </CardBody>
158
160
  <CardFooter>
159
161
  <Button label="Read more" priority="outline" color="success" />
@@ -162,6 +164,8 @@ To cover all possible needs of your project, Card is available in colors from
162
164
  <Card color="warning">
163
165
  <CardBody>
164
166
  Hello! I&apos;m warning variant of card.
167
+ {' '}
168
+ <TextLink href="/" label="This is a link" />
165
169
  </CardBody>
166
170
  <CardFooter>
167
171
  <Button label="Read more" priority="outline" color="warning" />
@@ -170,6 +174,8 @@ To cover all possible needs of your project, Card is available in colors from
170
174
  <Card color="danger">
171
175
  <CardBody>
172
176
  Hello! I&apos;m danger variant of card.
177
+ {' '}
178
+ <TextLink href="/" label="This is a link" />
173
179
  </CardBody>
174
180
  <CardFooter>
175
181
  <Button label="Read more" priority="outline" color="danger" />
@@ -178,6 +184,8 @@ To cover all possible needs of your project, Card is available in colors from
178
184
  <Card color="help">
179
185
  <CardBody>
180
186
  Hello! I&apos;m help variant of card.
187
+ {' '}
188
+ <TextLink href="/" label="This is a link" />
181
189
  </CardBody>
182
190
  <CardFooter>
183
191
  <Button label="Read more" priority="outline" color="help" />
@@ -186,6 +194,8 @@ To cover all possible needs of your project, Card is available in colors from
186
194
  <Card color="info">
187
195
  <CardBody>
188
196
  Hello! I&apos;m info variant of card.
197
+ {' '}
198
+ <TextLink href="/" label="This is a link" />
189
199
  </CardBody>
190
200
  <CardFooter>
191
201
  <Button label="Read more" priority="outline" color="info" />
@@ -194,27 +204,13 @@ To cover all possible needs of your project, Card is available in colors from
194
204
  <Card color="note">
195
205
  <CardBody>
196
206
  Hello! I&apos;m note variant of card.
207
+ {' '}
208
+ <TextLink href="/" label="This is a link" />
197
209
  </CardBody>
198
210
  <CardFooter>
199
211
  <Button label="Read more" priority="outline" color="note" />
200
212
  </CardFooter>
201
213
  </Card>
202
- <Card>
203
- <CardBody>
204
- Hello! I&apos;m light (default) variant of card.
205
- </CardBody>
206
- <CardFooter>
207
- <Button label="Read more" priority="outline" color="dark" />
208
- </CardFooter>
209
- </Card>
210
- <Card color="dark">
211
- <CardBody>
212
- Hello! I&apos;m dark variant of card.
213
- </CardBody>
214
- <CardFooter>
215
- <Button label="Read more" priority="outline" color="light" />
216
- </CardFooter>
217
- </Card>
218
214
  ```
219
215
 
220
216
  ## States
@@ -228,6 +224,8 @@ its interactive elements to disallow user's interaction.
228
224
  <Card disabled>
229
225
  <CardBody>
230
226
  Hello! I&apos;m a disabled card.
227
+ {' '}
228
+ <TextLink href="/" label="This is a link" />
231
229
  </CardBody>
232
230
  <CardFooter>
233
231
  <Button label="Read more" priority="outline" disabled />
@@ -236,6 +234,8 @@ its interactive elements to disallow user's interaction.
236
234
  <Card disabled raised>
237
235
  <CardBody>
238
236
  Hello! I&apos;m a disabled raised card.
237
+ {' '}
238
+ <TextLink href="/" label="This is a link" />
239
239
  </CardBody>
240
240
  <CardFooter>
241
241
  <Button label="Read more" priority="outline" disabled />
@@ -244,6 +244,8 @@ its interactive elements to disallow user's interaction.
244
244
  <Card color="success" disabled>
245
245
  <CardBody>
246
246
  Hello! I&apos;m a disabled success variant of card.
247
+ {' '}
248
+ <TextLink href="/" label="This is a link" />
247
249
  </CardBody>
248
250
  <CardFooter>
249
251
  <Button label="Read more" priority="outline" color="success" disabled />
@@ -292,6 +294,7 @@ Separate your card actions with CardFooter. See
292
294
  | `--rui-Card__padding` | Padding shared by card header, body and footer |
293
295
  | `--rui-Card__border-width` | Border width |
294
296
  | `--rui-Card__border-radius` | Corner radius |
297
+ | `--rui-Card__background-color` | Card background color |
295
298
  | `--rui-Card--dense__padding` | Padding of dense card |
296
299
  | `--rui-Card--raised__box-shadow` | Box shadow of raised card |
297
300
  | `--rui-Card--disabled__background-color` | Card background color in disabled state |
@@ -1,5 +1,4 @@
1
- @use "sass:list";
2
1
  @use "../../styles/settings/collections";
3
2
 
4
- $colors: list.join(collections.$feedback-colors, collections.$neutral-colors);
3
+ $colors: collections.$feedback-colors;
5
4
  $themeable-properties: color, border-color, background-color;
@@ -1,6 +1,7 @@
1
1
  $padding: var(--rui-Card__padding);
2
2
  $border-width: var(--rui-Card__border-width);
3
3
  $border-radius: var(--rui-Card__border-radius);
4
+ $background-color: var(--rui-Card__background-color);
4
5
 
5
6
  $dense-padding: var(--rui-Card--dense__padding);
6
7
  $raised-box-shadow: var(--rui-Card--raised__box-shadow);
@@ -1,8 +1,8 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React, { useContext } from 'react';
3
- import { withGlobalProps } from '../../provider';
4
- import { classNames } from '../../utils/classNames';
5
- import { transferProps } from '../../utils/transferProps';
3
+ import { withGlobalProps } from '../../providers/globalProps';
4
+ import { classNames } from '../../helpers/classNames/classNames';
5
+ import { transferProps } from '../../helpers/transferProps';
6
6
  import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
7
7
  import { FormLayoutContext } from '../FormLayout';
8
8
  import styles from './CheckboxField.module.scss';
@@ -15,6 +15,7 @@ export const CheckboxField = React.forwardRef((props, ref) => {
15
15
  isLabelVisible,
16
16
  label,
17
17
  labelPosition,
18
+ renderAsRequired,
18
19
  required,
19
20
  validationState,
20
21
  validationText,
@@ -30,7 +31,7 @@ export const CheckboxField = React.forwardRef((props, ref) => {
30
31
  context && context.layout === 'horizontal' ? styles.isRootLayoutHorizontal : styles.isRootLayoutVertical,
31
32
  labelPosition === 'before' && styles.hasRootLabelBefore,
32
33
  disabled && styles.isRootDisabled,
33
- required && styles.isRootRequired,
34
+ (renderAsRequired || required) && styles.isRootRequired,
34
35
  getRootValidationStateClassName(validationState, styles),
35
36
  )}
36
37
  htmlFor={id}
@@ -82,6 +83,7 @@ CheckboxField.defaultProps = {
82
83
  id: undefined,
83
84
  isLabelVisible: true,
84
85
  labelPosition: 'after',
86
+ renderAsRequired: false,
85
87
  required: false,
86
88
  validationState: null,
87
89
  validationText: null,
@@ -120,7 +122,11 @@ CheckboxField.propTypes = {
120
122
  */
121
123
  labelPosition: PropTypes.oneOf(['before', 'after']),
122
124
  /**
123
- * If `true`, the input will be required.
125
+ * If `true`, the input will be rendered as if it was required.
126
+ */
127
+ renderAsRequired: PropTypes.bool,
128
+ /**
129
+ * If `true`, the input will be made and rendered as required, regardless of the `renderAsRequired` prop.
124
130
  */
125
131
  required: PropTypes.bool,
126
132
  /**