@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
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.44.1",
4
+ "version": "0.47.0",
5
5
  "keywords": [
6
6
  "react",
7
7
  "ui",
@@ -29,8 +29,8 @@
29
29
  "url": "https://github.com/react-ui-org/react-ui"
30
30
  },
31
31
  "engines": {
32
- "node": ">=14.15.1",
33
- "npm": ">=6.14.8"
32
+ "node": ">=16.14.0 <17",
33
+ "npm": ">=8.3.0"
34
34
  },
35
35
  "dependencies": {
36
36
  "normalize.css": "^8.0.1"
@@ -44,14 +44,14 @@
44
44
  "@babel/preset-env": "^7.16.0",
45
45
  "@babel/preset-react": "^7.16.0",
46
46
  "@babel/register": "^7.16.0",
47
+ "@floating-ui/react-dom": "^0.7.1",
47
48
  "@nejcm/docz-theme-extended": "^2.0.14",
48
49
  "@testing-library/jest-dom": "^5.15.0",
49
50
  "@testing-library/react": "^12.1.2",
50
51
  "@testing-library/user-event": "^13.5.0",
51
52
  "@visionappscz/eslint-config-visionapps": "^1.5.0",
52
- "@visionappscz/stylelint-config-visionapps": "^2.0.1",
53
- "@visionappscz/stylelint-config-visionapps-order": "^2.1.0",
54
- "autoprefixer": "^10.4.0",
53
+ "@visionappscz/stylelint-config": "^3.0.0-rc1",
54
+ "autoprefixer": "^10.4.2",
55
55
  "babel-core": "^7.0.0-bridge.0",
56
56
  "babel-jest": "^27.3.1",
57
57
  "babel-loader": "^8.2.3",
@@ -73,21 +73,19 @@
73
73
  "jest": "^27.3.1",
74
74
  "markdownlint-cli2": "~0.3.2",
75
75
  "nodemon": "^2.0.15",
76
- "postcss": "^8.3.11",
76
+ "postcss": "^8.4.5",
77
77
  "postcss-loader": "^4.3.0",
78
78
  "prism-react-renderer": "^1.2.1",
79
79
  "prop-types": "^15.7.2",
80
80
  "react": "^17.0.2",
81
81
  "react-dom": "^17.0.2",
82
82
  "rimraf": "^3.0.2",
83
- "sass": "^1.43.4",
83
+ "sass": "^1.47.0",
84
84
  "sass-loader": "^10.2.0",
85
85
  "sinon": "^12.0.1",
86
86
  "style-loader": "^2.0.0",
87
- "stylelint": "^13.13.1",
88
- "stylelint-config-css-modules": "^2.3.0",
89
- "stylelint-order": "^5.0.0",
90
- "stylelint-webpack-plugin": "^3.1.0",
87
+ "stylelint": "^14.2.0",
88
+ "stylelint-webpack-plugin": "^2.3.2",
91
89
  "webpack": "^4.46.0",
92
90
  "webpack-cli": "^3.3.12",
93
91
  "webpack-visualizer-plugin": "^0.1.11"
@@ -108,7 +106,7 @@
108
106
  "lib:build": "concurrently \"webpack --mode development --config webpack.config.js\" \"webpack --mode production --config webpack.config.js\"",
109
107
  "lib:jest": "jest",
110
108
  "lib:test:js": "concurrently \"eslint --ext js,jsx src/lib tests/propTests\" \"npm run lib:jest\"",
111
- "lib:test:css": "stylelint \"src/lib/**/*.scss\" --config stylelint.config.js",
109
+ "lib:test:css": "stylelint \"src/**/*.scss\" --config stylelint.config.js",
112
110
  "markdown:lint": "markdownlint-cli2 \"**/*.md?(x)\" \"#.docz\" \"#dist\" \"#node_modules\" && eslint \"**/*.md?(x)\"",
113
111
  "markdown:watch": "nodemon --watch . --ext md,mdx --exec \"npm run markdown:lint\"",
114
112
  "prepublishOnly": "npm run lib:build",
@@ -1,7 +1,11 @@
1
1
  import PropTypes from 'prop-types';
2
- import React from 'react';
3
- import getRootColorClassName from '../../helpers/getRootColorClassName';
4
- import { withProviderContext } from '../../provider';
2
+ import React, { useContext } from 'react';
3
+ import {
4
+ RUIContext,
5
+ withGlobalProps,
6
+ } from '../../provider';
7
+ import { classNames } from '../../utils/classNames';
8
+ import { getRootColorClassName } from '../_helpers/getRootColorClassName';
5
9
  import styles from './Alert.scss';
6
10
 
7
11
  export const Alert = ({
@@ -10,42 +14,45 @@ export const Alert = ({
10
14
  icon,
11
15
  id,
12
16
  onClose,
13
- translations,
14
- }) => (
15
- <div
16
- className={[
17
- styles.root,
18
- getRootColorClassName(color, styles),
19
- ].join(' ')}
20
- id={id}
21
- role="alert"
22
- >
23
- {icon && (
24
- <div className={styles.icon}>
25
- {icon}
26
- </div>
27
- )}
17
+ }) => {
18
+ const { translations } = useContext(RUIContext);
19
+
20
+ return (
28
21
  <div
29
- className={styles.message}
30
- {...(id && { id: `${id}__content` })}
22
+ className={classNames(
23
+ styles.root,
24
+ getRootColorClassName(color, styles),
25
+ )}
26
+ id={id}
27
+ role="alert"
31
28
  >
32
- {children}
33
- </div>
34
- {onClose && (
35
- <button
36
- type="button"
37
- {...(id && { id: `${id}__close` })}
38
- className={styles.close}
39
- onClick={() => onClose()}
40
- onKeyPress={() => onClose()}
41
- tabIndex="0"
42
- title={translations.close}
29
+ {icon && (
30
+ <div className={styles.icon}>
31
+ {icon}
32
+ </div>
33
+ )}
34
+ <div
35
+ className={styles.message}
36
+ {...(id && { id: `${id}__content` })}
43
37
  >
44
- <span className={styles.closeSign}>×</span>
45
- </button>
46
- )}
47
- </div>
48
- );
38
+ {children}
39
+ </div>
40
+ {onClose && (
41
+ <button
42
+ type="button"
43
+ {...(id && { id: `${id}__close` })}
44
+ className={styles.close}
45
+ onClick={() => onClose()}
46
+ onKeyPress={() => onClose()}
47
+ tabIndex="0"
48
+ title={translations.Alert.close}
49
+ >
50
+ <span className={styles.closeSign}>×</span>
51
+ </button>
52
+ )}
53
+ </div>
54
+ );
55
+ };
49
56
 
50
57
  Alert.defaultProps = {
51
58
  color: 'note',
@@ -82,14 +89,8 @@ Alert.propTypes = {
82
89
  * hidden.
83
90
  */
84
91
  onClose: PropTypes.func,
85
- /**
86
- * Translations required by the component.
87
- */
88
- translations: PropTypes.shape({
89
- close: PropTypes.string.isRequired,
90
- }).isRequired,
91
92
  };
92
93
 
93
- export const AlertWithContext = withProviderContext(Alert, 'Alert');
94
+ export const AlertWithGlobalProps = withGlobalProps(Alert, 'Alert');
94
95
 
95
- export default AlertWithContext;
96
+ export default AlertWithGlobalProps;
@@ -1,106 +1,106 @@
1
- @use 'sass:map';
2
- @use '../../styles/theme/typography';
3
- @use '../../styles/tools/accessibility';
4
- @use '../../styles/tools/reset';
5
- @use 'settings';
6
- @use 'theme';
7
- @use 'tools';
1
+ @use "sass:map";
2
+ @use "../../styles/theme/typography";
3
+ @use "../../styles/tools/accessibility";
4
+ @use "../../styles/tools/reset";
5
+ @use "settings";
6
+ @use "theme";
7
+ @use "tools";
8
8
 
9
9
  .root {
10
- position: relative;
11
- display: flex;
12
- align-items: flex-start;
13
- width: 100%;
14
- color: var(--rui-local-color);
15
- border-width: theme.$border-width theme.$border-width theme.$border-width theme.$stripe-width;
16
- border-style: solid;
17
- border-color: var(--rui-local-foreground-color);
18
- border-radius: theme.$border-radius;
19
- background-color: var(--rui-local-background-color);
10
+ position: relative;
11
+ display: flex;
12
+ align-items: flex-start;
13
+ width: 100%;
14
+ color: var(--rui-local-color);
15
+ border-width: theme.$border-width theme.$border-width theme.$border-width theme.$stripe-width;
16
+ border-style: solid;
17
+ border-color: var(--rui-local-foreground-color);
18
+ border-radius: theme.$border-radius;
19
+ background-color: var(--rui-local-background-color);
20
20
  }
21
21
 
22
22
  .icon,
23
23
  .message {
24
- padding: theme.$padding;
24
+ padding: theme.$padding;
25
25
  }
26
26
 
27
27
  .close,
28
28
  .icon {
29
- height: settings.$min-height;
30
- color: var(--rui-local-foreground-color);
29
+ height: settings.$min-height;
30
+ color: var(--rui-local-foreground-color);
31
31
  }
32
32
 
33
33
  .icon {
34
- display: flex;
35
- flex: none;
36
- align-items: center;
37
- justify-content: center;
38
- padding-right: 0;
34
+ display: flex;
35
+ flex: none;
36
+ align-items: center;
37
+ justify-content: center;
38
+ padding-right: 0;
39
39
  }
40
40
 
41
41
  .message {
42
- flex-grow: 1;
43
- font-weight: theme.$font-weight;
44
- font-size: settings.$font-size;
45
- line-height: settings.$line-height;
42
+ flex-grow: 1;
43
+ font-weight: theme.$font-weight;
44
+ font-size: settings.$font-size;
45
+ line-height: settings.$line-height;
46
46
  }
47
47
 
48
48
  .message a,
49
49
  .message strong {
50
- font-weight: theme.$emphasis-font-weight;
51
- color: var(--rui-local-foreground-color);
50
+ font-weight: theme.$emphasis-font-weight;
51
+ color: var(--rui-local-foreground-color);
52
52
  }
53
53
 
54
54
  .close {
55
- @include reset.button();
56
- @include accessibility.min-tap-target();
55
+ @include reset.button();
56
+ @include accessibility.min-tap-target();
57
57
 
58
- padding: theme.$padding;
59
- font-size: map.get(typography.$size-values, 3);
60
- line-height: 1;
58
+ padding: theme.$padding;
59
+ font-size: map.get(typography.$size-values, 3);
60
+ line-height: 1;
61
61
  }
62
62
 
63
63
  .closeSign {
64
- position: relative;
65
- top: -0.1em;
64
+ position: relative;
65
+ top: -0.1em;
66
66
  }
67
67
 
68
68
  .rootColorPrimary {
69
- @include tools.color(primary);
69
+ @include tools.color(primary);
70
70
  }
71
71
 
72
72
  .rootColorSecondary {
73
- @include tools.color(secondary);
73
+ @include tools.color(secondary);
74
74
  }
75
75
 
76
76
  .rootColorSuccess {
77
- @include tools.color(success);
77
+ @include tools.color(success);
78
78
  }
79
79
 
80
80
  .rootColorWarning {
81
- @include tools.color(warning);
81
+ @include tools.color(warning);
82
82
  }
83
83
 
84
84
  .rootColorDanger {
85
- @include tools.color(danger);
85
+ @include tools.color(danger);
86
86
  }
87
87
 
88
88
  .rootColorHelp {
89
- @include tools.color(help);
89
+ @include tools.color(help);
90
90
  }
91
91
 
92
92
  .rootColorInfo {
93
- @include tools.color(info);
93
+ @include tools.color(info);
94
94
  }
95
95
 
96
96
  .rootColorNote {
97
- @include tools.color(note);
97
+ @include tools.color(note);
98
98
  }
99
99
 
100
100
  .rootColorLight {
101
- @include tools.color(light);
101
+ @include tools.color(light);
102
102
  }
103
103
 
104
104
  .rootColorDark {
105
- @include tools.color(dark);
105
+ @include tools.color(dark);
106
106
  }
@@ -13,10 +13,7 @@ import {
13
13
  import Icon from '../../../docs/_components/Icon'
14
14
  import Placeholder from '../../../docs/_components/Placeholder'
15
15
  import Button from '../Button'
16
- import {
17
- AlertWithContext as Alert,
18
- Alert as ParsableAlert,
19
- } from './Alert'
16
+ import { Alert } from './Alert'
20
17
 
21
18
  Alert presents feedback or important information to users.
22
19
 
@@ -207,7 +204,7 @@ click on the close button:
207
204
 
208
205
  ## API
209
206
 
210
- <Props table of={ParsableAlert} />
207
+ <Props table of={Alert} />
211
208
 
212
209
  ## Theming
213
210
 
@@ -1,7 +1,7 @@
1
- @use 'sass:map';
2
- @use '../../styles/theme/typography';
3
- @use 'theme';
1
+ @use "sass:map";
2
+ @use "../../styles/theme/typography";
3
+ @use "theme";
4
4
 
5
5
  $font-size: map.get(typography.$size-values, 0);
6
- $line-height: 1.5;
6
+ $line-height: typography.$line-height-base;
7
7
  $min-height: calc(#{$font-size} * #{$line-height} + 2 * #{theme.$padding});
@@ -6,54 +6,54 @@ $emphasis-font-weight: var(--rui-Alert__emphasis__font-weight);
6
6
  $stripe-width: var(--rui-Alert__stripe__width);
7
7
 
8
8
  $colors: (
9
- primary: (
10
- color: var(--rui-Alert--primary__color),
11
- foreground-color: var(--rui-Alert--primary__foreground-color),
12
- background-color: var(--rui-Alert--primary__background-color),
13
- ),
14
- secondary: (
15
- color: var(--rui-Alert--secondary__color),
16
- foreground-color: var(--rui-Alert--secondary__foreground-color),
17
- background-color: var(--rui-Alert--secondary__background-color),
18
- ),
19
- success: (
20
- color: var(--rui-Alert--success__color),
21
- foreground-color: var(--rui-Alert--success__foreground-color),
22
- background-color: var(--rui-Alert--success__background-color),
23
- ),
24
- warning: (
25
- color: var(--rui-Alert--warning__color),
26
- foreground-color: var(--rui-Alert--warning__foreground-color),
27
- background-color: var(--rui-Alert--warning__background-color),
28
- ),
29
- danger: (
30
- color: var(--rui-Alert--danger__color),
31
- foreground-color: var(--rui-Alert--danger__foreground-color),
32
- background-color: var(--rui-Alert--danger__background-color),
33
- ),
34
- info: (
35
- color: var(--rui-Alert--info__color),
36
- foreground-color: var(--rui-Alert--info__foreground-color),
37
- background-color: var(--rui-Alert--info__background-color),
38
- ),
39
- help: (
40
- color: var(--rui-Alert--help__color),
41
- foreground-color: var(--rui-Alert--help__foreground-color),
42
- background-color: var(--rui-Alert--help__background-color),
43
- ),
44
- note: (
45
- color: var(--rui-Alert--note__color),
46
- foreground-color: var(--rui-Alert--note__foreground-color),
47
- background-color: var(--rui-Alert--note__background-color),
48
- ),
49
- light: (
50
- color: var(--rui-Alert--light__color),
51
- foreground-color: var(--rui-Alert--light__foreground-color),
52
- background-color: var(--rui-Alert--light__background-color),
53
- ),
54
- dark: (
55
- color: var(--rui-Alert--dark__color),
56
- foreground-color: var(--rui-Alert--dark__foreground-color),
57
- background-color: var(--rui-Alert--dark__background-color),
58
- ),
9
+ primary: (
10
+ color: var(--rui-Alert--primary__color),
11
+ foreground-color: var(--rui-Alert--primary__foreground-color),
12
+ background-color: var(--rui-Alert--primary__background-color),
13
+ ),
14
+ secondary: (
15
+ color: var(--rui-Alert--secondary__color),
16
+ foreground-color: var(--rui-Alert--secondary__foreground-color),
17
+ background-color: var(--rui-Alert--secondary__background-color),
18
+ ),
19
+ success: (
20
+ color: var(--rui-Alert--success__color),
21
+ foreground-color: var(--rui-Alert--success__foreground-color),
22
+ background-color: var(--rui-Alert--success__background-color),
23
+ ),
24
+ warning: (
25
+ color: var(--rui-Alert--warning__color),
26
+ foreground-color: var(--rui-Alert--warning__foreground-color),
27
+ background-color: var(--rui-Alert--warning__background-color),
28
+ ),
29
+ danger: (
30
+ color: var(--rui-Alert--danger__color),
31
+ foreground-color: var(--rui-Alert--danger__foreground-color),
32
+ background-color: var(--rui-Alert--danger__background-color),
33
+ ),
34
+ info: (
35
+ color: var(--rui-Alert--info__color),
36
+ foreground-color: var(--rui-Alert--info__foreground-color),
37
+ background-color: var(--rui-Alert--info__background-color),
38
+ ),
39
+ help: (
40
+ color: var(--rui-Alert--help__color),
41
+ foreground-color: var(--rui-Alert--help__foreground-color),
42
+ background-color: var(--rui-Alert--help__background-color),
43
+ ),
44
+ note: (
45
+ color: var(--rui-Alert--note__color),
46
+ foreground-color: var(--rui-Alert--note__foreground-color),
47
+ background-color: var(--rui-Alert--note__background-color),
48
+ ),
49
+ light: (
50
+ color: var(--rui-Alert--light__color),
51
+ foreground-color: var(--rui-Alert--light__foreground-color),
52
+ background-color: var(--rui-Alert--light__background-color),
53
+ ),
54
+ dark: (
55
+ color: var(--rui-Alert--dark__color),
56
+ foreground-color: var(--rui-Alert--dark__foreground-color),
57
+ background-color: var(--rui-Alert--dark__background-color),
58
+ ),
59
59
  );
@@ -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-foreground-color: #{map.get($color-variant-properties, foreground-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-foreground-color: #{map.get($color-variant-properties, foreground-color)};
9
+ --rui-local-background-color: #{map.get($color-variant-properties, background-color)};
10
10
  }
@@ -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 './Badge.scss';
6
7
 
7
8
  export const Badge = ({
@@ -11,11 +12,11 @@ export const Badge = ({
11
12
  priority,
12
13
  }) => (
13
14
  <div
14
- className={[
15
+ className={classNames(
15
16
  styles.root,
16
- priority === 'outline' ? styles.rootPriorityOutline : '',
17
+ priority === 'outline' && styles.rootPriorityOutline,
17
18
  getRootColorClassName(color, styles),
18
- ].join(' ')}
19
+ )}
19
20
  id={id}
20
21
  >
21
22
  {label}
@@ -42,16 +43,13 @@ Badge.propTypes = {
42
43
  /**
43
44
  * Text to be displayed.
44
45
  */
45
- label: PropTypes.oneOfType([
46
- PropTypes.string,
47
- PropTypes.number,
48
- ]).isRequired,
46
+ label: PropTypes.string.isRequired,
49
47
  /**
50
48
  * Visual priority to highlight or suppress the badge.
51
49
  */
52
50
  priority: PropTypes.oneOf(['filled', 'outline']),
53
51
  };
54
52
 
55
- export const BadgeWithContext = withProviderContext(Badge, 'Badge');
53
+ export const BadgeWithGlobalProps = withGlobalProps(Badge, 'Badge');
56
54
 
57
- export default BadgeWithContext;
55
+ export default BadgeWithGlobalProps;