@react-ui-org/react-ui 0.53.0 → 0.55.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. package/README.md +7 -5
  2. package/dist/react-ui.css +36 -38
  3. package/dist/react-ui.development.css +10800 -0
  4. package/dist/react-ui.development.js +1568 -0
  5. package/dist/react-ui.js +1 -1
  6. package/package.json +7 -4
  7. package/src/components/Alert/Alert.jsx +1 -1
  8. package/src/components/Alert/Alert.module.scss +100 -0
  9. package/src/components/Alert/README.md +9 -7
  10. package/src/components/Badge/Badge.jsx +1 -1
  11. package/src/components/Badge/Badge.module.scss +109 -0
  12. package/src/components/Badge/README.md +9 -7
  13. package/src/components/Button/Button.jsx +1 -1
  14. package/src/components/Button/README.md +9 -7
  15. package/src/components/Button/_base.scss +117 -115
  16. package/src/components/Button/_priorities.scss +135 -133
  17. package/src/components/ButtonGroup/ButtonGroup.jsx +1 -1
  18. package/src/components/ButtonGroup/ButtonGroup.module.scss +35 -0
  19. package/src/components/ButtonGroup/README.md +10 -8
  20. package/src/components/Card/Card.jsx +1 -1
  21. package/src/components/Card/Card.module.scss +72 -0
  22. package/src/components/Card/CardBody.jsx +1 -1
  23. package/src/components/Card/CardFooter.jsx +1 -1
  24. package/src/components/Card/README.md +9 -7
  25. package/src/components/CheckboxField/CheckboxField.jsx +1 -1
  26. package/src/components/CheckboxField/CheckboxField.module.scss +63 -0
  27. package/src/components/CheckboxField/README.md +10 -8
  28. package/src/components/FileInputField/FileInputField.jsx +1 -1
  29. package/src/components/FileInputField/FileInputField.module.scss +65 -0
  30. package/src/components/FileInputField/README.md +10 -8
  31. package/src/components/FormLayout/FormLayout.jsx +1 -1
  32. package/src/components/FormLayout/{FormLayout.scss → FormLayout.module.scss} +30 -28
  33. package/src/components/FormLayout/FormLayoutCustomField.jsx +1 -1
  34. package/src/components/FormLayout/FormLayoutCustomField.module.scss +65 -0
  35. package/src/components/FormLayout/README.md +11 -9
  36. package/src/components/Grid/Grid.jsx +1 -1
  37. package/src/components/Grid/Grid.module.scss +66 -0
  38. package/src/components/Grid/GridSpan.jsx +1 -1
  39. package/src/components/Grid/README.md +11 -8
  40. package/src/components/InputGroup/InputGroup.jsx +9 -1
  41. package/src/components/InputGroup/InputGroup.module.scss +93 -0
  42. package/src/components/InputGroup/README.md +27 -10
  43. package/src/components/Modal/Modal.jsx +1 -1
  44. package/src/components/Modal/Modal.module.scss +80 -0
  45. package/src/components/Modal/ModalBody.jsx +1 -1
  46. package/src/components/Modal/ModalBody.module.scss +20 -0
  47. package/src/components/Modal/ModalCloseButton.jsx +1 -1
  48. package/src/components/Modal/ModalCloseButton.module.scss +20 -0
  49. package/src/components/Modal/ModalContent.jsx +1 -1
  50. package/src/components/Modal/ModalContent.module.scss +7 -0
  51. package/src/components/Modal/ModalFooter.jsx +1 -1
  52. package/src/components/Modal/ModalFooter.module.scss +37 -0
  53. package/src/components/Modal/ModalHeader.jsx +1 -1
  54. package/src/components/Modal/ModalHeader.module.scss +32 -0
  55. package/src/components/Modal/ModalTitle.jsx +1 -1
  56. package/src/components/Modal/ModalTitle.module.scss +12 -0
  57. package/src/components/Modal/README.md +17 -14
  58. package/src/components/Paper/Paper.jsx +1 -1
  59. package/src/components/Paper/Paper.module.scss +19 -0
  60. package/src/components/Paper/README.md +9 -7
  61. package/src/components/Popover/Popover.jsx +1 -1
  62. package/src/components/Popover/Popover.module.scss +238 -0
  63. package/src/components/Popover/PopoverWrapper.jsx +1 -2
  64. package/src/components/Popover/PopoverWrapper.module.scss +5 -0
  65. package/src/components/Popover/README.md +9 -7
  66. package/src/components/Radio/README.md +12 -10
  67. package/src/components/Radio/Radio.jsx +1 -1
  68. package/src/components/Radio/Radio.module.scss +85 -0
  69. package/src/components/ScrollView/README.md +10 -8
  70. package/src/components/ScrollView/ScrollView.jsx +1 -1
  71. package/src/components/ScrollView/ScrollView.module.scss +233 -0
  72. package/src/components/SelectField/README.md +10 -8
  73. package/src/components/SelectField/SelectField.jsx +1 -1
  74. package/src/components/SelectField/SelectField.module.scss +111 -0
  75. package/src/components/Table/README.md +10 -8
  76. package/src/components/Table/Table.jsx +1 -1
  77. package/src/components/Table/Table.module.scss +30 -0
  78. package/src/components/Table/_components/TableBodyCell/TableBodyCell.jsx +1 -1
  79. package/src/components/Table/_components/TableCell.module.scss +28 -0
  80. package/src/components/Table/_components/TableHeaderCell/TableHeaderCell.jsx +1 -1
  81. package/src/components/Tabs/README.md +16 -10
  82. package/src/components/Tabs/Tabs.jsx +1 -1
  83. package/src/components/Tabs/Tabs.module.scss +31 -0
  84. package/src/components/Tabs/TabsItem.jsx +1 -1
  85. package/src/components/Tabs/TabsItem.module.scss +119 -0
  86. package/src/components/Text/README.md +15 -9
  87. package/src/components/Text/Text.jsx +1 -1
  88. package/src/components/Text/Text.module.scss +42 -0
  89. package/src/components/TextArea/README.md +10 -8
  90. package/src/components/TextArea/TextArea.jsx +1 -1
  91. package/src/components/TextArea/TextArea.module.scss +97 -0
  92. package/src/components/TextField/README.md +13 -8
  93. package/src/components/TextField/TextField.jsx +1 -1
  94. package/src/components/TextField/TextField.module.scss +109 -0
  95. package/src/components/TextLink/README.md +10 -8
  96. package/src/components/TextLink/TextLink.jsx +1 -1
  97. package/src/components/TextLink/TextLink.module.scss +18 -0
  98. package/src/components/Toggle/README.md +10 -8
  99. package/src/components/Toggle/Toggle.jsx +1 -1
  100. package/src/components/Toggle/Toggle.module.scss +63 -0
  101. package/src/components/Toolbar/README.md +9 -7
  102. package/src/components/Toolbar/Toolbar.jsx +1 -1
  103. package/src/components/Toolbar/Toolbar.module.scss +85 -0
  104. package/src/components/Toolbar/ToolbarGroup.jsx +1 -1
  105. package/src/components/Toolbar/ToolbarItem.jsx +1 -1
  106. package/src/components/_helpers/transferProps.js +47 -7
  107. package/src/foundation.scss +22 -17
  108. package/src/helpers.scss +12 -8
  109. package/src/index.js +3 -4
  110. package/src/index.scss +7 -0
  111. package/src/layers.scss +4 -0
  112. package/src/styles/elements/_page.scss +0 -4
  113. package/src/styles/helpers/_animation.scss +2 -2
  114. package/src/styles/tools/_utilities.scss +1 -1
  115. package/src/theme.scss +1040 -1038
  116. package/CODEOWNERS +0 -23
  117. package/src/components/Alert/Alert.scss +0 -98
  118. package/src/components/Badge/Badge.scss +0 -107
  119. package/src/components/ButtonGroup/ButtonGroup.scss +0 -33
  120. package/src/components/Card/Card.scss +0 -70
  121. package/src/components/CheckboxField/CheckboxField.scss +0 -61
  122. package/src/components/FileInputField/FileInputField.scss +0 -63
  123. package/src/components/FormLayout/FormLayoutCustomField.scss +0 -63
  124. package/src/components/Grid/Grid.scss +0 -63
  125. package/src/components/InputGroup/InputGroup.scss +0 -87
  126. package/src/components/Modal/Modal.scss +0 -78
  127. package/src/components/Modal/ModalBody.scss +0 -18
  128. package/src/components/Modal/ModalCloseButton.scss +0 -18
  129. package/src/components/Modal/ModalContent.scss +0 -5
  130. package/src/components/Modal/ModalFooter.scss +0 -35
  131. package/src/components/Modal/ModalHeader.scss +0 -30
  132. package/src/components/Modal/ModalTitle.scss +0 -10
  133. package/src/components/Paper/Paper.scss +0 -17
  134. package/src/components/Popover/Popover.scss +0 -236
  135. package/src/components/Popover/PopoverWrapper.scss +0 -3
  136. package/src/components/Radio/Radio.scss +0 -83
  137. package/src/components/ScrollView/ScrollView.scss +0 -227
  138. package/src/components/SelectField/SelectField.scss +0 -109
  139. package/src/components/Table/Table.scss +0 -28
  140. package/src/components/Table/_components/TableCell.scss +0 -26
  141. package/src/components/Tabs/Tabs.scss +0 -28
  142. package/src/components/Tabs/TabsItem.scss +0 -117
  143. package/src/components/Text/Text.scss +0 -40
  144. package/src/components/TextArea/TextArea.scss +0 -95
  145. package/src/components/TextField/TextField.scss +0 -107
  146. package/src/components/TextLink/TextLink.scss +0 -16
  147. package/src/components/Toggle/Toggle.scss +0 -61
  148. package/src/components/Toolbar/Toolbar.scss +0 -83
  149. /package/src/components/Button/{Button.scss → Button.module.scss} +0 -0
@@ -0,0 +1,80 @@
1
+ @use "sass:map";
2
+ @use "../../styles/theme/typography";
3
+ @use "../../styles/tools/accessibility";
4
+ @use "../../styles/tools/breakpoint";
5
+ @use "../../styles/tools/reset";
6
+ @use "../../styles/tools/spacing";
7
+ @use "settings";
8
+ @use "theme";
9
+
10
+ @layer components.modal {
11
+ .root {
12
+ --rui-local-outer-spacing: #{theme.$outer-spacing-xs};
13
+ --rui-local-max-width: calc(100% - (2 * var(--rui-local-outer-spacing)));
14
+ --rui-local-max-height: calc(100% - (2 * var(--rui-local-outer-spacing)));
15
+
16
+ position: fixed;
17
+ left: 50%;
18
+ z-index: settings.$z-index;
19
+ display: flex;
20
+ flex-direction: column;
21
+ max-width: var(--rui-local-max-width);
22
+ max-height: var(--rui-local-max-height);
23
+ overflow-y: auto;
24
+ overscroll-behavior: contain;
25
+ border-radius: settings.$border-radius;
26
+ background: theme.$background;
27
+ box-shadow: theme.$box-shadow;
28
+ transform: translateX(-50%);
29
+
30
+ @include breakpoint.up(sm) {
31
+ --rui-local-outer-spacing: #{theme.$outer-spacing-sm};
32
+ }
33
+ }
34
+
35
+ .backdrop {
36
+ position: fixed;
37
+ top: 0;
38
+ left: 0;
39
+ z-index: settings.$backdrop-z-index;
40
+ width: 100vw;
41
+ height: 100vh;
42
+ background: theme.$backdrop-background;
43
+ }
44
+
45
+ .isRootSizeSmall {
46
+ width: map.get(theme.$sizes, small, width);
47
+ }
48
+
49
+ .isRootSizeMedium {
50
+ width: map.get(theme.$sizes, medium, width);
51
+ }
52
+
53
+ .isRootSizeLarge {
54
+ width: map.get(theme.$sizes, large, width);
55
+ }
56
+
57
+ .isRootSizeFullscreen {
58
+ width: map.get(theme.$sizes, fullscreen, width);
59
+ height: map.get(theme.$sizes, fullscreen, height);
60
+ }
61
+
62
+ .isRootSizeFullscreen .content {
63
+ height: 100%;
64
+ }
65
+
66
+ .isRootSizeAuto {
67
+ width: auto;
68
+ min-width: min(var(--rui-local-max-width), #{map.get(theme.$sizes, auto, min-width)});
69
+ max-width: min(var(--rui-local-max-width), #{map.get(theme.$sizes, auto, max-width)});
70
+ }
71
+
72
+ .isRootPositionCenter {
73
+ top: 50%;
74
+ transform: translate(-50%, -50%);
75
+ }
76
+
77
+ .isRootPositionTop {
78
+ top: var(--rui-local-outer-spacing);
79
+ }
80
+ }
@@ -5,7 +5,7 @@ import { transferProps } from '../_helpers/transferProps';
5
5
  import { classNames } from '../../utils/classNames';
6
6
  import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
7
7
  import { getScrollingClassName } from './_helpers/getScrollingClassName';
8
- import styles from './ModalBody.scss';
8
+ import styles from './ModalBody.module.scss';
9
9
 
10
10
  export const ModalBody = ({
11
11
  children,
@@ -0,0 +1,20 @@
1
+ @layer components.modal {
2
+ .root {
3
+ flex: 1 1 auto;
4
+ }
5
+
6
+ .isRootScrollingAuto,
7
+ .isRootScrollingCustom {
8
+ min-height: 0;
9
+ }
10
+
11
+ .isRootScrollingAuto {
12
+ overflow-y: auto;
13
+ overscroll-behavior: contain;
14
+ }
15
+
16
+ .isRootScrollingCustom {
17
+ display: flex;
18
+ flex-direction: column;
19
+ }
20
+ }
@@ -5,7 +5,7 @@ import {
5
5
  withGlobalProps,
6
6
  } from '../../provider';
7
7
  import { transferProps } from '../_helpers/transferProps';
8
- import styles from './ModalCloseButton.scss';
8
+ import styles from './ModalCloseButton.module.scss';
9
9
 
10
10
  export const ModalCloseButton = React.forwardRef((props, ref) => {
11
11
  const {
@@ -0,0 +1,20 @@
1
+ @use "sass:map";
2
+ @use "../../styles/theme/typography";
3
+ @use "../../styles/tools/accessibility";
4
+ @use "../../styles/tools/reset";
5
+ @use "../../styles/tools/spacing";
6
+
7
+ @layer components.modal {
8
+ .root {
9
+ @include reset.button();
10
+ @include accessibility.min-tap-target();
11
+
12
+ font-size: map.get(typography.$font-size-values, 4);
13
+ line-height: 1;
14
+ color: inherit;
15
+
16
+ &:disabled {
17
+ cursor: var(--rui-cursor-not-allowed);
18
+ }
19
+ }
20
+ }
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import { withGlobalProps } from '../../provider';
4
4
  import { isChildrenEmpty } from '../_helpers/isChildrenEmpty';
5
5
  import { transferProps } from '../_helpers/transferProps';
6
- import styles from './ModalContent.scss';
6
+ import styles from './ModalContent.module.scss';
7
7
 
8
8
  export const ModalContent = ({
9
9
  children,
@@ -0,0 +1,7 @@
1
+ @use "theme";
2
+
3
+ @layer components.modal {
4
+ .root {
5
+ padding: theme.$padding-y theme.$padding-x;
6
+ }
7
+ }
@@ -4,7 +4,7 @@ import { withGlobalProps } from '../../provider';
4
4
  import { transferProps } from '../_helpers/transferProps';
5
5
  import { classNames } from '../../utils/classNames';
6
6
  import { getJustifyClassName } from './_helpers/getJustifyClassName';
7
- import styles from './ModalFooter.scss';
7
+ import styles from './ModalFooter.module.scss';
8
8
 
9
9
  export const ModalFooter = ({
10
10
  children,
@@ -0,0 +1,37 @@
1
+ @use "settings";
2
+ @use "theme";
3
+
4
+ @layer components.modal {
5
+ .root {
6
+ display: flex;
7
+ flex: none;
8
+ flex-wrap: wrap;
9
+ gap: theme.$footer-gap;
10
+ align-items: center;
11
+ padding: theme.$padding-y theme.$padding-x;
12
+ border-top: theme.$separator-width solid theme.$separator-color;
13
+ border-bottom-right-radius: settings.$border-radius;
14
+ border-bottom-left-radius: settings.$border-radius;
15
+ background: theme.$footer-background;
16
+ }
17
+
18
+ .isRootJustifiedToStart {
19
+ justify-content: flex-start;
20
+ }
21
+
22
+ .isRootJustifiedToCenter {
23
+ justify-content: center;
24
+ }
25
+
26
+ .isRootJustifiedToEnd {
27
+ justify-content: flex-end;
28
+ }
29
+
30
+ .isRootJustifiedToSpaceBetween {
31
+ justify-content: space-between;
32
+ }
33
+
34
+ .isRootJustifiedToStretch {
35
+ display: block;
36
+ }
37
+ }
@@ -6,7 +6,7 @@ import {
6
6
  import { transferProps } from '../_helpers/transferProps';
7
7
  import { classNames } from '../../utils/classNames';
8
8
  import { getJustifyClassName } from './_helpers/getJustifyClassName';
9
- import styles from './ModalHeader.scss';
9
+ import styles from './ModalHeader.module.scss';
10
10
 
11
11
  export const ModalHeader = ({
12
12
  children,
@@ -0,0 +1,32 @@
1
+ @use "theme";
2
+
3
+ @layer components.modal {
4
+ .root {
5
+ display: flex;
6
+ flex: none;
7
+ gap: theme.$header-gap;
8
+ align-items: baseline;
9
+ padding: theme.$padding-y theme.$padding-x;
10
+ border-bottom: theme.$separator-width solid theme.$separator-color;
11
+ }
12
+
13
+ .isRootJustifiedToStart {
14
+ justify-content: flex-start;
15
+ }
16
+
17
+ .isRootJustifiedToCenter {
18
+ justify-content: center;
19
+ }
20
+
21
+ .isRootJustifiedToEnd {
22
+ justify-content: flex-end;
23
+ }
24
+
25
+ .isRootJustifiedToSpaceBetween {
26
+ justify-content: space-between;
27
+ }
28
+
29
+ .isRootJustifiedToStretch {
30
+ display: block;
31
+ }
32
+ }
@@ -4,7 +4,7 @@ import {
4
4
  withGlobalProps,
5
5
  } from '../../provider';
6
6
  import { transferProps } from '../_helpers/transferProps';
7
- import styles from './ModalTitle.scss';
7
+ import styles from './ModalTitle.module.scss';
8
8
 
9
9
  export const ModalTitle = ({
10
10
  children,
@@ -0,0 +1,12 @@
1
+ @use "settings";
2
+
3
+ @layer components.modal {
4
+ .root {
5
+ margin-block: 0;
6
+ font-size: settings.$title-font-size;
7
+
8
+ &:not(:last-child) {
9
+ margin-bottom: 0;
10
+ }
11
+ }
12
+ }
@@ -1015,22 +1015,25 @@ opened.
1015
1015
  ## Forwarding HTML Attributes
1016
1016
 
1017
1017
  In addition to the options below in the [component's API](#api) section, you
1018
- can specify [React synthetic events] or **any HTML attribute you like.** All
1019
- attributes that don't interfere with the API are forwarded to the:
1018
+ can specify **any HTML attribute you like.** All attributes that don't interfere
1019
+ with the API of the React component are forwarded to:
1020
1020
 
1021
- - `<div>` HTML element in case of the `Modal` component. This `<div>` is not the
1022
- root, but its first child which represents the modal window.
1023
- - root `<div>` HTML element in case of `ModalHeader`, `ModalBody`, `ModalContent`
1021
+ - the `<div>` HTML element in case of the `Modal` component. This `<div>` is not
1022
+ the root, but its first child which represents the modal window.
1023
+ - the root `<div>` HTML element in case of `ModalHeader`, `ModalBody`, `ModalContent`
1024
1024
  and `ModalFooter` components.
1025
- - heading HTML element, which level can be specified through `level` option, in
1026
- case of the `ModalTitle` component.
1027
- - native HTML `<button>` in case of the `ModalCloseButton` component.
1025
+ - the heading (e.g. `<h1>`) HTML element in case of the `ModalTitle` component.
1026
+ - the native HTML `<button>` in case of the `ModalCloseButton` component.
1028
1027
 
1029
1028
  This enables making the component interactive and helps to improve its
1030
1029
  accessibility.
1031
1030
 
1032
- 👉 Refer to the MDN reference for the full list of supported attributes of the
1033
- [div], [heading] and [button] element.
1031
+ 👉 For the full list of supported attributes refer to:
1032
+
1033
+ - [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
1034
+ - [`<h1>`-`<h6>` HTML element attributes][heading-attributes]{:target="_blank"}
1035
+ - [`<button>` HTML element attributes][button-attributes]{:target="_blank"}
1036
+ - [React common props]{:target="_blank"}
1034
1037
 
1035
1038
  ## API
1036
1039
 
@@ -1084,7 +1087,7 @@ accessibility.
1084
1087
  | `--rui-Modal--fullscreen__width` | Width of fullscreen modal |
1085
1088
  | `--rui-Modal--fullscreen__height` | Height of fullscreen modal |
1086
1089
 
1087
- [React synthetic events]: https://reactjs.org/docs/events.html
1088
- [div]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
1089
- [heading]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements#attributes
1090
- [button]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes
1090
+ [button-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button#attributes
1091
+ [div-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
1092
+ [heading-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements#attributes
1093
+ [React common props]: https://react.dev/reference/react-dom/components/common#common-props
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import { withGlobalProps } from '../../provider';
4
4
  import { classNames } from '../../utils/classNames';
5
5
  import { transferProps } from '../_helpers/transferProps';
6
- import styles from './Paper.scss';
6
+ import styles from './Paper.module.scss';
7
7
 
8
8
  export const Paper = ({
9
9
  children,
@@ -0,0 +1,19 @@
1
+ @use "theme";
2
+
3
+ @layer components.paper {
4
+ .root {
5
+ padding: theme.$padding;
6
+ border: theme.$border-width solid theme.$border-color;
7
+ border-radius: theme.$border-radius;
8
+ background-color: theme.$background-color;
9
+ }
10
+
11
+ .isRootMuted {
12
+ background-color: theme.$muted-background-color;
13
+ opacity: theme.$muted-opacity;
14
+ }
15
+
16
+ .isRootRaised {
17
+ box-shadow: theme.$raised-box-shadow;
18
+ }
19
+ }
@@ -54,13 +54,15 @@ Dim background and add transparency to visually suppress the Paper.
54
54
  ## Forwarding HTML Attributes
55
55
 
56
56
  In addition to the options below in the [component's API](#api) section, you
57
- can specify [React synthetic events] or **any HTML attribute you like.** All
58
- attributes that don't interfere with the API are forwarded to the root `<div>`
59
- HTML element. This enables making the component interactive and helps to improve
57
+ can specify **any HTML attribute you like.** All attributes that don't interfere
58
+ with the API of the React component are forwarded to the root `<div>` HTML
59
+ element. This enables making the component interactive and helps to improve
60
60
  its accessibility.
61
61
 
62
- 👉 Refer to the MDN reference for the full list of supported attributes of the
63
- [div] element.
62
+ 👉 For the full list of supported attributes refer to:
63
+
64
+ - [`<div>` HTML element attributes][div-attributes]{:target="_blank"}
65
+ - [React common props]{:target="_blank"}
64
66
 
65
67
  ## API
66
68
 
@@ -79,5 +81,5 @@ its accessibility.
79
81
  | `--rui-Paper--muted__opacity` | Opacity of muted paper |
80
82
  | `--rui-Paper--raised__box-shadow` | Box shadow of raised paper |
81
83
 
82
- [React synthetic events]: https://reactjs.org/docs/events.html
83
- [div]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
84
+ [div-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
85
+ [React common props]: https://react.dev/reference/react-dom/components/common#common-props
@@ -6,7 +6,7 @@ import { classNames } from '../../utils/classNames';
6
6
  import { transferProps } from '../_helpers/transferProps';
7
7
  import getRootSideClassName from './_helpers/getRootSideClassName';
8
8
  import getRootAlignmentClassName from './_helpers/getRootAlignmentClassName';
9
- import styles from './Popover.scss';
9
+ import styles from './Popover.module.scss';
10
10
 
11
11
  export const Popover = React.forwardRef((props, ref) => {
12
12
  const {
@@ -0,0 +1,238 @@
1
+ // 1. Reset positioning for controlled variant.
2
+ // 2. Shift Popover so there is space for the arrow between Popover and reference element.
3
+ // 3. Add top offset in case it's not defined by external library.
4
+
5
+ @use "theme";
6
+
7
+ @layer components.popover {
8
+ .root {
9
+ position: absolute;
10
+ width: max-content;
11
+ max-width: theme.$max-width;
12
+ padding: theme.$padding;
13
+ text-align: left;
14
+ white-space: normal;
15
+ word-break: normal;
16
+ word-wrap: break-word;
17
+ color: theme.$color;
18
+ border: theme.$border-width solid theme.$border-color;
19
+ border-radius: theme.$border-radius;
20
+ background-color: theme.$background-color;
21
+ box-shadow: theme.$box-shadow;
22
+ }
23
+
24
+ .arrow {
25
+ position: absolute;
26
+ width: theme.$arrow-width;
27
+ height: theme.$arrow-height;
28
+ transform-origin: center bottom;
29
+
30
+ &::before,
31
+ &::after {
32
+ content: "";
33
+ position: absolute;
34
+ display: block;
35
+ border-style: solid;
36
+ border-color: transparent;
37
+ }
38
+
39
+ &::before {
40
+ bottom: 0;
41
+ border-width: theme.$arrow-height theme.$arrow-height 0;
42
+ border-top-color: theme.$border-color;
43
+ }
44
+
45
+ &::after {
46
+ bottom: theme.$border-width;
47
+ border-width: theme.$arrow-height theme.$arrow-height 0;
48
+ border-top-color: theme.$background-color;
49
+ }
50
+ }
51
+
52
+ // Sides
53
+ .isRootAtTop {
54
+ bottom: 100%;
55
+ }
56
+
57
+ .isRootAtBottom {
58
+ top: 100%;
59
+ }
60
+
61
+ .isRootAtLeft {
62
+ right: 100%;
63
+ }
64
+
65
+ .isRootAtRight {
66
+ left: 100%;
67
+ }
68
+
69
+ // Arrows
70
+ .isRootAtTop > .arrow {
71
+ top: 100%;
72
+ }
73
+
74
+ .isRootAtBottom > .arrow {
75
+ bottom: 100%;
76
+ }
77
+
78
+ .isRootAtLeft > .arrow {
79
+ left: 100%;
80
+ }
81
+
82
+ .isRootAtRight > .arrow {
83
+ right: 100%;
84
+ }
85
+
86
+ // Side alignments: top
87
+ .isRootAtTop.isRootAtCenter {
88
+ left: 50%;
89
+ transform: translate(-50%, #{-1 * theme.$arrow-height});
90
+ }
91
+
92
+ .isRootAtTop.isRootAtStart {
93
+ left: 0;
94
+ transform: translate(0, #{-1 * theme.$arrow-height});
95
+ }
96
+
97
+ .isRootAtTop.isRootAtEnd {
98
+ right: 0;
99
+ transform: translate(0, #{-1 * theme.$arrow-height});
100
+ }
101
+
102
+ .isRootAtTop.isRootAtCenter > .arrow {
103
+ left: 50%;
104
+ transform: translate(-50%, 0) rotateZ(0);
105
+ }
106
+
107
+ .isRootAtTop.isRootAtStart > .arrow {
108
+ left: theme.$arrow-corner-offset;
109
+ transform: translate(0, 0) rotateZ(0);
110
+ }
111
+
112
+ .isRootAtTop.isRootAtEnd > .arrow {
113
+ right: theme.$arrow-corner-offset;
114
+ transform: translate(0, 0) rotateZ(0);
115
+ }
116
+
117
+ // Side alignments: bottom
118
+ .isRootAtBottom.isRootAtCenter {
119
+ left: 50%;
120
+ transform: translate(-50%, #{theme.$arrow-height});
121
+ }
122
+
123
+ .isRootAtBottom.isRootAtStart {
124
+ left: 0;
125
+ transform: translate(0, #{theme.$arrow-height});
126
+ }
127
+
128
+ .isRootAtBottom.isRootAtEnd {
129
+ right: 0;
130
+ transform: translate(0, #{theme.$arrow-height});
131
+ }
132
+
133
+ .isRootAtBottom.isRootAtCenter > .arrow {
134
+ left: 50%;
135
+ transform: translate(-50%, -100%) rotateZ(180deg);
136
+ }
137
+
138
+ .isRootAtBottom.isRootAtStart > .arrow {
139
+ left: theme.$arrow-corner-offset;
140
+ transform: translate(0, -100%) rotateZ(180deg);
141
+ }
142
+
143
+ .isRootAtBottom.isRootAtEnd > .arrow {
144
+ right: theme.$arrow-corner-offset;
145
+ transform: translate(0, -100%) rotateZ(180deg);
146
+ }
147
+
148
+ // Side alignments: left
149
+ .isRootAtLeft.isRootAtCenter {
150
+ top: 50%;
151
+ transform: translate(#{-1 * theme.$arrow-height}, -50%);
152
+ }
153
+
154
+ .isRootAtLeft.isRootAtStart {
155
+ top: 0;
156
+ transform: translate(#{-1 * theme.$arrow-height}, 0);
157
+ }
158
+
159
+ .isRootAtLeft.isRootAtEnd {
160
+ bottom: 0;
161
+ transform: translate(#{-1 * theme.$arrow-height}, 0);
162
+ }
163
+
164
+ .isRootAtLeft.isRootAtCenter > .arrow {
165
+ top: 50%;
166
+ transform: translate(0, -100%) rotateZ(-90deg);
167
+ }
168
+
169
+ .isRootAtLeft.isRootAtStart > .arrow {
170
+ top: theme.$arrow-corner-offset;
171
+ transform: translate(0, 0) rotateZ(-90deg);
172
+ }
173
+
174
+ .isRootAtLeft.isRootAtEnd > .arrow {
175
+ bottom: theme.$arrow-corner-offset;
176
+ transform: translate(0, -100%) rotateZ(-90deg);
177
+ }
178
+
179
+ // Side alignments: right
180
+ .isRootAtRight.isRootAtCenter {
181
+ top: 50%;
182
+ transform: translate(#{theme.$arrow-height}, -50%);
183
+ }
184
+
185
+ .isRootAtRight.isRootAtStart {
186
+ top: 0;
187
+ transform: translate(#{theme.$arrow-height}, 0);
188
+ }
189
+
190
+ .isRootAtRight.isRootAtEnd {
191
+ bottom: 0;
192
+ transform: translate(#{theme.$arrow-height}, 0);
193
+ }
194
+
195
+ .isRootAtRight.isRootAtCenter > .arrow {
196
+ top: 50%;
197
+ transform: translate(0, -100%) rotateZ(90deg);
198
+ }
199
+
200
+ .isRootAtRight.isRootAtStart > .arrow {
201
+ top: theme.$arrow-corner-offset;
202
+ transform: translate(0, 0) rotateZ(90deg);
203
+ }
204
+
205
+ .isRootAtRight.isRootAtEnd > .arrow {
206
+ bottom: theme.$arrow-corner-offset;
207
+ transform: translate(0, -100%) rotateZ(90deg);
208
+ }
209
+
210
+ // Controlled placement
211
+ .isRootControlled.isRootAtTop,
212
+ .isRootControlled.isRootAtBottom,
213
+ .isRootControlled.isRootAtLeft,
214
+ .isRootControlled.isRootAtRight {
215
+ inset: unset; // 1.
216
+ }
217
+
218
+ .isRootControlled.isRootAtTop {
219
+ transform: translate(0, #{-1 * theme.$arrow-height}); // 2.
220
+ }
221
+
222
+ .isRootControlled.isRootAtBottom {
223
+ transform: translate(0, #{theme.$arrow-height}); // 2.
224
+ }
225
+
226
+ .isRootControlled.isRootAtLeft {
227
+ transform: translate(#{-1 * theme.$arrow-height}, 0); // 2.
228
+ }
229
+
230
+ .isRootControlled.isRootAtRight {
231
+ transform: translate(#{theme.$arrow-height}, 0); // 2.
232
+ }
233
+
234
+ .isRootControlled.isRootAtLeft.isRootAtStart,
235
+ .isRootControlled.isRootAtRight.isRootAtStart {
236
+ top: 0; // 3.
237
+ }
238
+ }
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import { withGlobalProps } from '../../provider';
4
4
  import { transferProps } from '../_helpers/transferProps';
5
- import styles from './PopoverWrapper.scss';
5
+ import styles from './PopoverWrapper.module.scss';
6
6
 
7
7
  export const PopoverWrapper = ({
8
8
  children,
@@ -36,4 +36,3 @@ PopoverWrapper.propTypes = {
36
36
  export const PopoverWrapperWithContext = withGlobalProps(PopoverWrapper, 'PopoverWrapper');
37
37
 
38
38
  export default PopoverWrapperWithContext;
39
-
@@ -0,0 +1,5 @@
1
+ @layer components.popover {
2
+ .root {
3
+ position: relative;
4
+ }
5
+ }