@react-ui-org/react-ui 0.64.1 → 0.66.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 (311) hide show
  1. package/README.md +3 -6
  2. package/dist/react-ui.css +16 -16
  3. package/dist/react-ui.d.ts +1936 -0
  4. package/dist/react-ui.development.css +3591 -3003
  5. package/dist/react-ui.development.js +2028 -1060
  6. package/dist/react-ui.js +1 -1
  7. package/package.json +74 -70
  8. package/src/components/Alert/{Alert.jsx → Alert.tsx} +8 -43
  9. package/src/components/Alert/Alert.types.ts +34 -0
  10. package/src/components/Alert/README.md +1 -1
  11. package/src/components/Alert/index.ts +2 -0
  12. package/src/components/Badge/Badge.tsx +30 -0
  13. package/src/components/Badge/Badge.types.ts +24 -0
  14. package/src/components/Badge/README.md +1 -1
  15. package/src/components/Badge/index.ts +5 -0
  16. package/src/components/Button/Button.tsx +110 -0
  17. package/src/components/Button/Button.types.ts +93 -0
  18. package/src/components/Button/README.md +1 -1
  19. package/src/components/Button/helpers/{getRootLabelVisibilityClassName.js → getRootLabelVisibilityClassName.ts} +5 -2
  20. package/src/components/Button/index.ts +6 -0
  21. package/src/components/ButtonGroup/{ButtonGroup.jsx → ButtonGroup.tsx} +9 -40
  22. package/src/components/ButtonGroup/ButtonGroup.types.ts +45 -0
  23. package/src/components/ButtonGroup/ButtonGroupContext.ts +4 -0
  24. package/src/components/ButtonGroup/README.md +1 -1
  25. package/src/components/ButtonGroup/{index.js → index.ts} +4 -0
  26. package/src/components/Card/Card.tsx +33 -0
  27. package/src/components/Card/Card.types.ts +46 -0
  28. package/src/components/Card/{CardBody.jsx → CardBody.tsx} +4 -11
  29. package/src/components/Card/{CardFooter.jsx → CardFooter.tsx} +4 -15
  30. package/src/components/Card/README.md +6 -7
  31. package/src/components/Card/{index.js → index.ts} +5 -0
  32. package/src/components/CheckboxField/CheckboxField.module.scss +7 -3
  33. package/src/components/CheckboxField/CheckboxField.tsx +81 -0
  34. package/src/components/CheckboxField/CheckboxField.types.ts +64 -0
  35. package/src/components/CheckboxField/README.md +92 -45
  36. package/src/components/CheckboxField/index.ts +5 -0
  37. package/src/components/FileInputField/FileInputField.module.scss +7 -3
  38. package/src/components/FileInputField/{FileInputField.jsx → FileInputField.tsx} +43 -129
  39. package/src/components/FileInputField/FileInputField.types.ts +101 -0
  40. package/src/components/FileInputField/README.md +21 -4
  41. package/src/components/FileInputField/index.ts +6 -0
  42. package/src/components/FormLayout/FormLayout.module.scss +5 -7
  43. package/src/components/FormLayout/{FormLayout.jsx → FormLayout.tsx} +15 -50
  44. package/src/components/FormLayout/FormLayout.types.ts +55 -0
  45. package/src/components/FormLayout/FormLayoutContext.ts +4 -0
  46. package/src/components/FormLayout/FormLayoutCustomField.module.scss +7 -3
  47. package/src/components/FormLayout/{FormLayoutCustomField.jsx → FormLayoutCustomField.tsx} +12 -67
  48. package/src/components/FormLayout/FormLayoutCustomField.types.ts +60 -0
  49. package/src/components/FormLayout/FormLayoutCustomFieldContext.ts +4 -0
  50. package/src/components/FormLayout/README.md +6 -15
  51. package/src/components/FormLayout/index.ts +14 -0
  52. package/src/components/Grid/Grid.module.scss +1 -1
  53. package/src/components/Grid/Grid.tsx +50 -0
  54. package/src/components/Grid/Grid.types.ts +108 -0
  55. package/src/components/Grid/GridSpan.tsx +36 -0
  56. package/src/components/Grid/README.md +2 -2
  57. package/src/components/Grid/_helpers/generateResponsiveCustomProperties.ts +33 -0
  58. package/src/components/Grid/index.ts +9 -0
  59. package/src/components/InputGroup/InputGroup.module.scss +7 -3
  60. package/src/components/InputGroup/{InputGroup.jsx → InputGroup.tsx} +25 -95
  61. package/src/components/InputGroup/InputGroup.types.ts +80 -0
  62. package/src/components/InputGroup/InputGroupContext.ts +4 -0
  63. package/src/components/InputGroup/README.md +40 -8
  64. package/src/components/InputGroup/{index.js → index.ts} +4 -0
  65. package/src/components/Modal/Modal.tsx +172 -0
  66. package/src/components/Modal/Modal.types.ts +181 -0
  67. package/src/components/Modal/ModalBody.tsx +34 -0
  68. package/src/components/Modal/{ModalCloseButton.jsx → ModalCloseButton.tsx} +6 -19
  69. package/src/components/Modal/{ModalContent.jsx → ModalContent.tsx} +4 -15
  70. package/src/components/Modal/ModalFooter.tsx +27 -0
  71. package/src/components/Modal/ModalHeader.tsx +27 -0
  72. package/src/components/Modal/ModalTitle.tsx +29 -0
  73. package/src/components/Modal/README.md +9 -9
  74. package/src/components/Modal/_helpers/{dialogOnCancelHandler.js → dialogOnCancelHandler.ts} +11 -1
  75. package/src/components/Modal/_helpers/{dialogOnClickHandler.js → dialogOnClickHandler.ts} +13 -7
  76. package/src/components/Modal/_helpers/{dialogOnCloseHandler.js → dialogOnCloseHandler.ts} +11 -1
  77. package/src/components/Modal/_helpers/{dialogOnKeyDownHandler.js → dialogOnKeyDownHandler.ts} +19 -6
  78. package/src/components/Modal/_helpers/{getJustifyClassName.js → getJustifyClassName.ts} +4 -1
  79. package/src/components/Modal/_helpers/getPositionClassName.ts +10 -0
  80. package/src/components/Modal/_helpers/getScrollingClassName.ts +14 -0
  81. package/src/components/Modal/_helpers/{getSizeClassName.js → getSizeClassName.ts} +4 -1
  82. package/src/components/Modal/_hooks/{useModalFocus.js → useModalFocus.ts} +9 -5
  83. package/src/components/Modal/_hooks/{useModalScrollPrevention.js → useModalScrollPrevention.ts} +4 -1
  84. package/src/components/Modal/{index.js → index.ts} +14 -0
  85. package/src/components/Paper/{Paper.jsx → Paper.tsx} +6 -26
  86. package/src/components/Paper/Paper.types.ts +19 -0
  87. package/src/components/Paper/README.md +3 -4
  88. package/src/components/Paper/index.ts +2 -0
  89. package/src/components/Popover/Popover.module.scss +1 -1
  90. package/src/components/Popover/Popover.tsx +61 -0
  91. package/src/components/Popover/Popover.types.ts +75 -0
  92. package/src/components/Popover/PopoverWrapper.tsx +27 -0
  93. package/src/components/Popover/README.md +34 -22
  94. package/src/components/Popover/_helpers/{cleanPlacementStyle.js → cleanPlacementStyle.ts} +4 -1
  95. package/src/components/Popover/_helpers/{getRootAlignmentClassName.js → getRootAlignmentClassName.ts} +4 -1
  96. package/src/components/Popover/_helpers/{getRootSideClassName.js → getRootSideClassName.ts} +4 -1
  97. package/src/components/Popover/index.ts +8 -0
  98. package/src/components/Radio/README.md +125 -48
  99. package/src/components/Radio/Radio.module.scss +7 -3
  100. package/src/components/Radio/Radio.tsx +116 -0
  101. package/src/components/Radio/Radio.types.ts +91 -0
  102. package/src/components/Radio/index.ts +5 -0
  103. package/src/components/ScrollView/README.md +1 -1
  104. package/src/components/ScrollView/ScrollView.module.scss +5 -0
  105. package/src/components/ScrollView/{ScrollView.jsx → ScrollView.tsx} +55 -166
  106. package/src/components/ScrollView/ScrollView.types.ts +121 -0
  107. package/src/components/ScrollView/_helpers/getElementsPositionDifference.ts +17 -0
  108. package/src/components/ScrollView/_hooks/{useLoadResizeHook.js → useLoadResizeHook.ts} +14 -3
  109. package/src/components/ScrollView/_hooks/{useScrollPositionHook.js → useScrollPositionHook.ts} +11 -4
  110. package/src/components/ScrollView/index.ts +6 -0
  111. package/src/components/SelectField/README.md +137 -51
  112. package/src/components/SelectField/SelectField.module.scss +7 -3
  113. package/src/components/SelectField/SelectField.tsx +139 -0
  114. package/src/components/SelectField/SelectField.types.ts +121 -0
  115. package/src/components/SelectField/_components/Option/Option.tsx +19 -0
  116. package/src/components/SelectField/_components/Option/Option.types.ts +21 -0
  117. package/src/components/SelectField/_components/Option/index.ts +2 -0
  118. package/src/components/SelectField/index.ts +7 -0
  119. package/src/components/Table/README.md +1 -1
  120. package/src/components/Table/{Table.jsx → Table.tsx} +4 -43
  121. package/src/components/Table/Table.types.ts +51 -0
  122. package/src/components/Table/_components/TableBodyCell/TableBodyCell.tsx +20 -0
  123. package/src/components/Table/_components/TableBodyCell/TableBodyCell.types.ts +20 -0
  124. package/src/components/Table/_components/TableBodyCell/index.ts +2 -0
  125. package/src/components/Table/_components/TableHeaderCell/{TableHeaderCell.jsx → TableHeaderCell.tsx} +3 -34
  126. package/src/components/Table/_components/TableHeaderCell/TableHeaderCell.types.ts +20 -0
  127. package/src/components/Table/_components/TableHeaderCell/index.ts +2 -0
  128. package/src/components/Table/index.ts +8 -0
  129. package/src/components/Tabs/README.md +2 -2
  130. package/src/components/Tabs/{Tabs.jsx → Tabs.tsx} +4 -20
  131. package/src/components/Tabs/Tabs.types.ts +19 -0
  132. package/src/components/Tabs/TabsItem.tsx +49 -0
  133. package/src/components/Tabs/TabsItem.types.ts +42 -0
  134. package/src/components/Tabs/index.ts +4 -0
  135. package/src/components/Text/README.md +1 -1
  136. package/src/components/Text/Text.module.scss +5 -7
  137. package/src/components/Text/Text.tsx +46 -0
  138. package/src/components/Text/Text.types.ts +31 -0
  139. package/src/components/Text/_helpers/getRootClampClassName.ts +13 -0
  140. package/src/components/Text/_helpers/getRootHyphensClassName.ts +14 -0
  141. package/src/components/Text/_helpers/getRootWordWrappingClassName.ts +14 -0
  142. package/src/components/Text/index.ts +6 -0
  143. package/src/components/TextArea/README.md +35 -14
  144. package/src/components/TextArea/TextArea.module.scss +7 -3
  145. package/src/components/TextArea/TextArea.tsx +95 -0
  146. package/src/components/TextArea/TextArea.types.ts +76 -0
  147. package/src/components/TextArea/index.ts +5 -0
  148. package/src/components/TextField/README.md +35 -13
  149. package/src/components/TextField/TextField.module.scss +7 -3
  150. package/src/components/TextField/TextField.tsx +112 -0
  151. package/src/components/TextField/TextField.types.ts +95 -0
  152. package/src/components/TextField/index.ts +6 -0
  153. package/src/components/TextLink/README.md +2 -2
  154. package/src/components/TextLink/{TextLink.jsx → TextLink.tsx} +4 -15
  155. package/src/components/TextLink/TextLink.types.ts +12 -0
  156. package/src/components/TextLink/index.ts +2 -0
  157. package/src/components/Toggle/README.md +92 -45
  158. package/src/components/Toggle/Toggle.module.scss +7 -3
  159. package/src/components/Toggle/Toggle.tsx +82 -0
  160. package/src/components/Toggle/Toggle.types.ts +59 -0
  161. package/src/components/Toggle/index.ts +5 -0
  162. package/src/components/Toolbar/README.md +3 -3
  163. package/src/components/Toolbar/Toolbar.tsx +41 -0
  164. package/src/components/Toolbar/Toolbar.types.ts +74 -0
  165. package/src/components/Toolbar/ToolbarGroup.tsx +38 -0
  166. package/src/components/Toolbar/{ToolbarItem.jsx → ToolbarItem.tsx} +5 -21
  167. package/src/components/Toolbar/_helpers/{getAlignClassName.js → getAlignClassName.ts} +8 -1
  168. package/src/components/Toolbar/_helpers/{getJustifyClassName.js → getJustifyClassName.ts} +4 -1
  169. package/src/components/Toolbar/{index.js → index.ts} +7 -0
  170. package/src/components/_helpers/{getRootColorClassName.js → getRootColorClassName.ts} +7 -2
  171. package/src/components/_helpers/{getRootPriorityClassName.js → getRootPriorityClassName.ts} +7 -2
  172. package/src/components/_helpers/{getRootSizeClassName.js → getRootSizeClassName.ts} +7 -2
  173. package/src/components/_helpers/getRootStateClassName.ts +24 -0
  174. package/src/components/_helpers/resolveContextOrProp.ts +13 -0
  175. package/src/helpers/classNames/{classNames.js → classNames.ts} +2 -2
  176. package/src/helpers/isChildrenEmpty/isChildrenEmpty.ts +5 -0
  177. package/src/helpers/transferProps/transferProps.ts +50 -0
  178. package/src/helpers/transferProps/transferProps.types.ts +11 -0
  179. package/src/index.ts +211 -0
  180. package/src/providers/globalProps/GlobalProps.types.ts +30 -0
  181. package/src/providers/globalProps/GlobalPropsContext.ts +6 -0
  182. package/src/providers/globalProps/{GlobalPropsProvider.jsx → GlobalPropsProvider.tsx} +8 -15
  183. package/src/providers/globalProps/{index.js → index.ts} +4 -0
  184. package/src/providers/globalProps/withGlobalProps.tsx +36 -0
  185. package/src/providers/translations/Translations.types.ts +26 -0
  186. package/src/providers/translations/TranslationsContext.ts +7 -0
  187. package/src/providers/translations/{TranslationsProvider.jsx → TranslationsProvider.tsx} +8 -15
  188. package/src/providers/translations/{index.js → index.ts} +5 -0
  189. package/src/styles/settings/_form-fields.scss +2 -1
  190. package/src/styles/theme/_form-fields.scss +16 -11
  191. package/src/styles/theme-constants/_colors.scss +21 -0
  192. package/src/styles/tools/_accessibility.scss +2 -2
  193. package/src/styles/tools/form-fields/_box-field-layout.scss +5 -8
  194. package/src/styles/tools/form-fields/_inline-field-elements.scss +0 -7
  195. package/src/styles/tools/form-fields/_inline-field-layout.scss +0 -8
  196. package/src/styles/tools/form-fields/_variants.scss +7 -7
  197. package/src/theme.scss +37 -12
  198. package/src/translations/{en.js → en.ts} +3 -1
  199. package/src/types/breakpoints.ts +1 -0
  200. package/src/types/colors.ts +7 -0
  201. package/src/types/index.ts +13 -0
  202. package/src/types/labelPositions.ts +1 -0
  203. package/src/types/layouts.ts +1 -0
  204. package/src/types/modules.d.ts +16 -0
  205. package/src/types/priorities.ts +1 -0
  206. package/src/types/sizes.ts +1 -0
  207. package/src/types/states.ts +1 -0
  208. package/src/types/styles.ts +4 -0
  209. package/src/utils/mergeDeep.ts +34 -0
  210. package/src/utils/mergeDeep.types.ts +4 -0
  211. package/.claude/agents/code-reviewer.md +0 -122
  212. package/.claude/rules/code.md +0 -22
  213. package/.claude/rules/docs.md +0 -35
  214. package/.claude/rules/frontend.md +0 -72
  215. package/.claude/rules/git.md +0 -13
  216. package/.claude/rules/safety-guards.md +0 -9
  217. package/.claude/rules/styling.md +0 -32
  218. package/.claude/rules/testing.md +0 -59
  219. package/.claude/settings.json +0 -32
  220. package/.claude/skills/commit/SKILL.md +0 -54
  221. package/.devcontainer/devcontainer.json +0 -23
  222. package/.eslintrc-ts +0 -40
  223. package/.mcp.json +0 -8
  224. package/.nvmrc +0 -1
  225. package/CLAUDE.md +0 -82
  226. package/docker-compose.base.yml +0 -93
  227. package/docker-compose.yml.dist +0 -41
  228. package/jest.config-ts.js +0 -34
  229. package/opencode.json +0 -10
  230. package/playwright-ct.config.ts +0 -68
  231. package/scripts/auto-start-mkdocs.sh +0 -5
  232. package/scripts/auto-start-node.sh +0 -33
  233. package/scripts/mcps/chrome-host/README.md +0 -118
  234. package/scripts/mcps/chrome-host/cdp_proxy.py +0 -90
  235. package/scripts/mcps/chrome-host/mcp-entry.sh +0 -33
  236. package/scripts/mcps/chrome-host/mcp-launch.sh +0 -36
  237. package/scripts/mcps/chrome-host/mcp-setup.sh +0 -70
  238. package/scripts/mcps/chrome-host/start-host-chrome.sh +0 -267
  239. package/setup.sh +0 -107
  240. package/src/CNAME +0 -1
  241. package/src/components/Alert/index.js +0 -1
  242. package/src/components/Badge/Badge.jsx +0 -51
  243. package/src/components/Badge/index.js +0 -1
  244. package/src/components/Button/Button.jsx +0 -203
  245. package/src/components/Button/helpers/getRootPriorityClassName.js +0 -15
  246. package/src/components/Button/index.js +0 -1
  247. package/src/components/ButtonGroup/ButtonGroupContext.js +0 -3
  248. package/src/components/Card/Card.jsx +0 -67
  249. package/src/components/CheckboxField/CheckboxField.jsx +0 -144
  250. package/src/components/CheckboxField/index.js +0 -1
  251. package/src/components/FileInputField/index.js +0 -1
  252. package/src/components/FormLayout/FormLayoutContext.js +0 -3
  253. package/src/components/FormLayout/FormLayoutCustomFieldContext.js +0 -3
  254. package/src/components/FormLayout/index.js +0 -4
  255. package/src/components/Grid/Grid.jsx +0 -225
  256. package/src/components/Grid/GridSpan.jsx +0 -88
  257. package/src/components/Grid/_helpers/generateResponsiveCustomProperties.js +0 -22
  258. package/src/components/Grid/index.js +0 -2
  259. package/src/components/InputGroup/InputGroupContext.js +0 -3
  260. package/src/components/Modal/Modal.jsx +0 -262
  261. package/src/components/Modal/ModalBody.jsx +0 -60
  262. package/src/components/Modal/ModalFooter.jsx +0 -42
  263. package/src/components/Modal/ModalHeader.jsx +0 -42
  264. package/src/components/Modal/ModalTitle.jsx +0 -42
  265. package/src/components/Modal/_helpers/getPositionClassName.js +0 -7
  266. package/src/components/Modal/_helpers/getScrollingClassName.js +0 -11
  267. package/src/components/Paper/index.js +0 -1
  268. package/src/components/Popover/Popover.jsx +0 -124
  269. package/src/components/Popover/PopoverWrapper.jsx +0 -38
  270. package/src/components/Popover/index.js +0 -2
  271. package/src/components/Radio/Radio.jsx +0 -212
  272. package/src/components/Radio/index.js +0 -1
  273. package/src/components/ScrollView/_helpers/getElementsPositionDifference.js +0 -11
  274. package/src/components/ScrollView/index.js +0 -1
  275. package/src/components/SelectField/SelectField.jsx +0 -272
  276. package/src/components/SelectField/_components/Option/Option.jsx +0 -46
  277. package/src/components/SelectField/_components/Option/index.js +0 -1
  278. package/src/components/SelectField/index.js +0 -1
  279. package/src/components/Table/_components/TableBodyCell/TableBodyCell.jsx +0 -46
  280. package/src/components/Table/_components/TableBodyCell/index.js +0 -1
  281. package/src/components/Table/_components/TableHeaderCell/index.js +0 -1
  282. package/src/components/Table/index.js +0 -1
  283. package/src/components/Tabs/TabsItem.jsx +0 -91
  284. package/src/components/Tabs/index.js +0 -2
  285. package/src/components/Text/Text.jsx +0 -76
  286. package/src/components/Text/_helpers/getRootClampClassName.js +0 -11
  287. package/src/components/Text/_helpers/getRootHyphensClassName.js +0 -11
  288. package/src/components/Text/_helpers/getRootWordWrappingClassName.js +0 -11
  289. package/src/components/Text/index.js +0 -1
  290. package/src/components/TextArea/TextArea.jsx +0 -174
  291. package/src/components/TextArea/index.js +0 -1
  292. package/src/components/TextField/TextField.jsx +0 -208
  293. package/src/components/TextField/index.js +0 -1
  294. package/src/components/TextLink/index.js +0 -1
  295. package/src/components/Toggle/Toggle.jsx +0 -144
  296. package/src/components/Toggle/index.js +0 -1
  297. package/src/components/Toolbar/Toolbar.jsx +0 -76
  298. package/src/components/Toolbar/ToolbarGroup.jsx +0 -64
  299. package/src/components/_helpers/getRootValidationStateClassName.js +0 -15
  300. package/src/components/_helpers/resolveContextOrProp.js +0 -10
  301. package/src/helpers/isChildrenEmpty/isChildrenEmpty.js +0 -3
  302. package/src/helpers/transferProps/transferProps.js +0 -38
  303. package/src/index.js +0 -67
  304. package/src/providers/globalProps/GlobalPropsContext.jsx +0 -5
  305. package/src/providers/globalProps/withGlobalProps.jsx +0 -38
  306. package/src/providers/translations/TranslationsContext.jsx +0 -6
  307. package/src/utils/mergeDeep.js +0 -28
  308. package/tsconfig.json +0 -27
  309. /package/src/helpers/classNames/{index.js → index.ts} +0 -0
  310. /package/src/helpers/isChildrenEmpty/{index.js → index.ts} +0 -0
  311. /package/src/helpers/transferProps/{index.js → index.ts} +0 -0
@@ -5,3 +5,17 @@ export { default as ModalContent } from './ModalContent';
5
5
  export { default as ModalHeader } from './ModalHeader';
6
6
  export { default as ModalFooter } from './ModalFooter';
7
7
  export { default as ModalTitle } from './ModalTitle';
8
+ export type {
9
+ ModalBodyProps,
10
+ ModalCloseButtonProps,
11
+ ModalContentProps,
12
+ ModalFooterProps,
13
+ ModalHeaderProps,
14
+ ModalJustify,
15
+ ModalPosition,
16
+ ModalProps,
17
+ ModalScrolling,
18
+ ModalScrollPrevention,
19
+ ModalSize,
20
+ ModalTitleProps,
21
+ } from './Modal.types';
@@ -1,16 +1,16 @@
1
- import PropTypes from 'prop-types';
2
1
  import React from 'react';
3
2
  import { withGlobalProps } from '../../providers/globalProps';
4
3
  import { classNames } from '../../helpers/classNames/classNames';
5
4
  import { transferProps } from '../../helpers/transferProps';
6
5
  import styles from './Paper.module.scss';
6
+ import type { PaperProps } from './Paper.types';
7
7
 
8
- export const Paper = ({
8
+ export const Paper: React.FunctionComponent<PaperProps> = ({
9
9
  children,
10
- muted,
11
- raised,
10
+ muted = false,
11
+ raised = false,
12
12
  ...restProps
13
- }) => (
13
+ }: PaperProps) => (
14
14
  <div
15
15
  {...transferProps(restProps)}
16
16
  className={classNames(
@@ -23,26 +23,6 @@ export const Paper = ({
23
23
  </div>
24
24
  );
25
25
 
26
- Paper.defaultProps = {
27
- muted: false,
28
- raised: false,
29
- };
30
-
31
- Paper.propTypes = {
32
- /**
33
- * Content to be placed onto Paper.
34
- */
35
- children: PropTypes.node.isRequired,
36
- /**
37
- * Visually suppress Paper.
38
- */
39
- muted: PropTypes.bool,
40
- /**
41
- * Add shadow to pull the Paper above surface.
42
- */
43
- raised: PropTypes.bool,
44
- };
45
-
46
- export const PaperWithGlobalProps = withGlobalProps(Paper, 'Paper');
26
+ export const PaperWithGlobalProps = withGlobalProps<PaperProps, never>(Paper, 'Paper');
47
27
 
48
28
  export default PaperWithGlobalProps;
@@ -0,0 +1,19 @@
1
+ import type {
2
+ HTMLAttributes,
3
+ ReactNode,
4
+ } from 'react';
5
+
6
+ export type PaperProps = HTMLAttributes<HTMLDivElement> & {
7
+ /**
8
+ * Content to be placed onto Paper.
9
+ */
10
+ children: ReactNode;
11
+ /**
12
+ * Visually suppress Paper.
13
+ */
14
+ muted?: boolean;
15
+ /**
16
+ * Add shadow to pull the Paper above surface.
17
+ */
18
+ raised?: boolean;
19
+ };
@@ -22,9 +22,8 @@ See [API](#api) for all available options.
22
22
 
23
23
  ## General Guidelines
24
24
 
25
- - Paper is **designed for non-white background.** You may want to either use its
26
- [raised variant](#raised-paper) or [customize](/docs/customize/theming/overview)
27
- the default appearance to make it stand out on white background.
25
+ - Paper is **designed for non-white background.** You may want to use its
26
+ [raised variant](#raised-paper) to make it stand out on white background.
28
27
 
29
28
  - **Paper, or Card?** Paper is a basic surface to put content on. However,
30
29
  there is also the [Card](/components/Card) component. While Paper is
@@ -67,7 +66,7 @@ helps to improve its accessibility.
67
66
 
68
67
  ## API
69
68
 
70
- <docoff-react-props src="/components/Paper/Paper.jsx"></docoff-react-props>
69
+ <docoff-react-props src="/components/Paper/Paper.tsx" name="Paper"></docoff-react-props>
71
70
 
72
71
  ## Theming
73
72
 
@@ -0,0 +1,2 @@
1
+ export { default as Paper } from './Paper';
2
+ export type { PaperProps } from './Paper.types';
@@ -20,7 +20,7 @@
20
20
  text-align: left;
21
21
  white-space: normal;
22
22
  word-break: normal;
23
- word-wrap: break-word;
23
+ overflow-wrap: break-word;
24
24
  color: theme.$color;
25
25
  border: theme.$border-width solid theme.$border-color;
26
26
  border-radius: theme.$border-radius;
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ import { createPortal } from 'react-dom';
3
+ import { transferProps } from '../../helpers/transferProps';
4
+ import { classNames } from '../../helpers/classNames';
5
+ import { withGlobalProps } from '../../providers/globalProps';
6
+ import cleanPlacementStyle from './_helpers/cleanPlacementStyle';
7
+ import getRootSideClassName from './_helpers/getRootSideClassName';
8
+ import getRootAlignmentClassName from './_helpers/getRootAlignmentClassName';
9
+ import styles from './Popover.module.scss';
10
+ import type { PopoverProps } from './Popover.types';
11
+
12
+ export const Popover = React.forwardRef<HTMLDivElement, PopoverProps>(({
13
+ placement = 'bottom',
14
+ children,
15
+ placementStyle,
16
+ popoverTargetId,
17
+ portalId,
18
+ ...restProps
19
+ }, ref) => {
20
+ const PopoverEl = (
21
+ <>
22
+ {/**
23
+ * This hack is needed because the default behavior of the Popover API is to place the popover into a
24
+ * top-layer. It is currently not possible to position an element in the top-layer relative to a normal element.
25
+ * This will create a hidden browser popover, then with CSS it will open and close the RUI popover.
26
+ */}
27
+ {!!popoverTargetId && (
28
+ <div
29
+ className={styles.helper}
30
+ id={popoverTargetId}
31
+ popover="auto"
32
+ />
33
+ )}
34
+ <div
35
+ {...transferProps(restProps)}
36
+ className={classNames(
37
+ styles.root,
38
+ ref && styles.isRootControlled,
39
+ popoverTargetId && styles.controlledPopover,
40
+ getRootSideClassName(styles, placement),
41
+ getRootAlignmentClassName(styles, placement),
42
+ )}
43
+ ref={ref}
44
+ style={placementStyle ? cleanPlacementStyle(placementStyle) : undefined}
45
+ >
46
+ {children}
47
+ <span className={styles.arrow} />
48
+ </div>
49
+ </>
50
+ );
51
+
52
+ if (portalId === undefined) {
53
+ return PopoverEl;
54
+ }
55
+
56
+ return createPortal(PopoverEl, document.getElementById(portalId) as HTMLElement);
57
+ });
58
+
59
+ export const PopoverWithGlobalProps = withGlobalProps<PopoverProps, HTMLDivElement>(Popover, 'Popover');
60
+
61
+ export default PopoverWithGlobalProps;
@@ -0,0 +1,75 @@
1
+ import type {
2
+ HTMLAttributes,
3
+ ReactNode,
4
+ } from 'react';
5
+
6
+ export type PopoverPlacement = 'top'
7
+ | 'top-start'
8
+ | 'top-end'
9
+ | 'right'
10
+ | 'right-start'
11
+ | 'right-end'
12
+ | 'bottom'
13
+ | 'bottom-start'
14
+ | 'bottom-end'
15
+ | 'left'
16
+ | 'left-start'
17
+ | 'left-end';
18
+
19
+ export type PopoverPlacementStyle = {
20
+ bottom?: string;
21
+ inset?: string;
22
+ 'inset-block-end'?: string;
23
+ 'inset-block-start'?: string;
24
+ 'inset-inline-end'?: string;
25
+ 'inset-inline-start'?: string;
26
+ left?: string;
27
+ position?: string;
28
+ right?: string;
29
+ top?: string;
30
+ 'transform-origin'?: string;
31
+ translate?: string;
32
+ visibility?: string;
33
+ };
34
+
35
+ /**
36
+ * Props of the `Popover` component.
37
+ */
38
+ export type PopoverProps = Omit<HTMLAttributes<HTMLDivElement>, 'style'> & {
39
+ /**
40
+ * Popover content.
41
+ */
42
+ children: ReactNode;
43
+ /**
44
+ * Popover placement affects position of the arrow.
45
+ * Compatible with [Floating UI API](https://floating-ui.com/docs/computePosition#placement).
46
+ */
47
+ placement?: PopoverPlacement;
48
+ /**
49
+ * Used for positioning the popover with a library like Floating UI. It is filtered,
50
+ * then passed to the popover as the `style` prop.
51
+ */
52
+ placementStyle?: PopoverPlacementStyle;
53
+ /**
54
+ * If set, the popover will become controlled, meaning it will be hidden by default and will need a trigger to open.
55
+ * This sets the ID of the internal helper element for the popover.
56
+ * Assign the same ID to `popovertarget` of a trigger to make it open and close.
57
+ */
58
+ popoverTargetId?: string;
59
+ /**
60
+ * If set, popover is rendered in the React Portal with that ID.
61
+ */
62
+ portalId?: string;
63
+ };
64
+
65
+ export type PopoverWrapperProps = HTMLAttributes<HTMLElement> & {
66
+ /**
67
+ * Popover reference and the Popover itself.
68
+ */
69
+ children: ReactNode;
70
+ /**
71
+ * HTML tag to render. Can be any valid HTML tag of your choice, usually a
72
+ * [block-level element](https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements).
73
+ */
74
+ tag?: string;
75
+ };
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import type { ElementType } from 'react';
3
+ import { withGlobalProps } from '../../providers/globalProps';
4
+ import { transferProps } from '../../helpers/transferProps';
5
+ import styles from './PopoverWrapper.module.scss';
6
+ import type { PopoverWrapperProps } from './Popover.types';
7
+
8
+ export const PopoverWrapper: React.FunctionComponent<PopoverWrapperProps> = ({
9
+ children,
10
+ tag = 'div',
11
+ ...restProps
12
+ }: PopoverWrapperProps) => {
13
+ const Tag = tag as ElementType;
14
+
15
+ return (
16
+ <Tag
17
+ {...transferProps(restProps)}
18
+ className={styles.root}
19
+ >
20
+ {children}
21
+ </Tag>
22
+ );
23
+ };
24
+
25
+ export const PopoverWrapperWithContext = withGlobalProps<PopoverWrapperProps, HTMLElement>(PopoverWrapper, 'PopoverWrapper');
26
+
27
+ export default PopoverWrapperWithContext;
@@ -312,28 +312,17 @@ React.createElement(() => {
312
312
  });
313
313
  ```
314
314
 
315
- ## z-index
315
+ ## Scrollable Containers
316
316
 
317
- By default, the Popover's `z-index` is `auto`, which means it participates in
318
- the stacking context of its nearest positioned ancestor. This works well in most
319
- cases, but can cause the Popover to appear behind other positioned elements such
320
- as sticky headers, fixed toolbars, or modals.
317
+ When Popover is rendered inside a scrollable container (e.g. an element with
318
+ `overflow: auto`) and its closest positioned parent is the container itself or
319
+ an element inside it, Popover is clipped by the container and scrolls along
320
+ with its content. This is always the case inside
321
+ [ScrollView](/components/ScrollView), and it also applies to Popover wrapped in
322
+ PopoverWrapper.
321
323
 
322
- When that happens, set `--rui-Popover__z-index` to a numeric value high enough
323
- to place the Popover above the conflicting layer. The override can be applied
324
- globally or scoped to a specific context:
325
-
326
- ```css
327
- /* Global override */
328
- :root {
329
- --rui-Popover__z-index: 1000;
330
- }
331
-
332
- /* Scoped override */
333
- .my-context {
334
- --rui-Popover__z-index: 1000;
335
- }
336
- ```
324
+ If Popover needs to overflow the scrollable container, use Floating UI with the
325
+ `fixed` positioning strategy (see [Advanced Positioning](#advanced-positioning)).
337
326
 
338
327
  ## Controlled Popover
339
328
 
@@ -389,11 +378,11 @@ which enables [Advanced Positioning](#advanced-positioning).
389
378
 
390
379
  ## API
391
380
 
392
- <docoff-react-props src="/components/Popover/Popover.jsx"></docoff-react-props>
381
+ <docoff-react-props src="/components/Popover/Popover.tsx" name="Popover"></docoff-react-props>
393
382
 
394
383
  ### PopoverWrapper API
395
384
 
396
- <docoff-react-props src="/components/Popover/PopoverWrapper.jsx"></docoff-react-props>
385
+ <docoff-react-props src="/components/Popover/PopoverWrapper.tsx" name="PopoverWrapper"></docoff-react-props>
397
386
 
398
387
  ## Theming
399
388
 
@@ -409,6 +398,29 @@ which enables [Advanced Positioning](#advanced-positioning).
409
398
  | `--rui-Popover__box-shadow` | Popover box shadow |
410
399
  | `--rui-Popover__z-index` | Popover z-index (default: `auto`) |
411
400
 
401
+ ### z-index
402
+
403
+ By default, the Popover's `z-index` is `auto`, which means it participates in
404
+ the stacking context of its nearest positioned ancestor. This works well in most
405
+ cases, but can cause the Popover to appear behind other positioned elements such
406
+ as sticky headers, fixed toolbars, or modals.
407
+
408
+ When that happens, set `--rui-Popover__z-index` to a numeric value high enough
409
+ to place the Popover above the conflicting layer. The override can be applied
410
+ globally or scoped to a specific context:
411
+
412
+ ```css
413
+ /* Global override */
414
+ :root {
415
+ --rui-Popover__z-index: 1000;
416
+ }
417
+
418
+ /* Scoped override */
419
+ .my-context {
420
+ --rui-Popover__z-index: 1000;
421
+ }
422
+ ```
423
+
412
424
  [div-attributes]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div#attributes
413
425
  [Floating UI]: https://floating-ui.com/docs/react-dom
414
426
  [mdn-inset]: https://developer.mozilla.org/en-US/docs/Web/CSS/inset
@@ -1,4 +1,7 @@
1
- export default (placementStyle) => {
1
+ import type { CSSProperties } from 'react';
2
+ import type { PopoverPlacementStyle } from '../Popover.types';
3
+
4
+ export default (placementStyle: PopoverPlacementStyle): CSSProperties => {
2
5
  const validProps = [
3
6
  'position',
4
7
  'inset',
@@ -1,4 +1,7 @@
1
- export default (placement, styles) => {
1
+ import type { CssModuleClasses } from '../../../types';
2
+ import type { PopoverPlacement } from '../Popover.types';
3
+
4
+ export default (styles: CssModuleClasses, placement: PopoverPlacement) => {
2
5
  const alignment = placement.split('-')[1];
3
6
 
4
7
  if (alignment === 'start') {
@@ -1,4 +1,7 @@
1
- export default (placement, styles) => {
1
+ import type { CssModuleClasses } from '../../../types';
2
+ import type { PopoverPlacement } from '../Popover.types';
3
+
4
+ export default (styles: CssModuleClasses, placement: PopoverPlacement) => {
2
5
  const side = placement.split('-')[0];
3
6
 
4
7
  if (side === 'top') {
@@ -0,0 +1,8 @@
1
+ export { default as Popover } from './Popover';
2
+ export { default as PopoverWrapper } from './PopoverWrapper';
3
+ export type {
4
+ PopoverPlacement,
5
+ PopoverPlacementStyle,
6
+ PopoverProps,
7
+ PopoverWrapperProps,
8
+ } from './Popover.types';
@@ -210,7 +210,7 @@ have.
210
210
  onChange={(e) => setFruit(e.target.value)}
211
211
  options={options}
212
212
  required
213
- validationState="valid"
213
+ state="valid"
214
214
  validationText="Great, they're in stock!"
215
215
  value={fruit}
216
216
  />
@@ -219,7 +219,7 @@ have.
219
219
  onChange={(e) => setFruit(e.target.value)}
220
220
  options={options}
221
221
  required
222
- validationState="warning"
222
+ state="warning"
223
223
  validationText="Oh, really?"
224
224
  value={fruit}
225
225
  />
@@ -228,7 +228,7 @@ have.
228
228
  onChange={(e) => setFruit(e.target.value)}
229
229
  options={options}
230
230
  required
231
- validationState="invalid"
231
+ state="invalid"
232
232
  validationText="You must select one kind of fruit."
233
233
  value={fruit}
234
234
  />
@@ -237,6 +237,43 @@ have.
237
237
  })
238
238
  ```
239
239
 
240
+ ### Changed State
241
+
242
+ Changed state highlights fields whose value differs from the saved one, so users
243
+ can review their edits before saving.
244
+
245
+ A field shows one state at a time. When a changed value is also invalid, it's
246
+ up to you to pick the state that matters more to the user.
247
+
248
+ ```docoff-react-preview
249
+ React.createElement(() => {
250
+ const [fruit, setFruit] = React.useState('banana');
251
+ const options = [
252
+ {
253
+ label: 'Apple',
254
+ value: 'apple',
255
+ },
256
+ {
257
+ label: 'Banana',
258
+ value: 'banana',
259
+ },
260
+ {
261
+ label: 'Grapefruit',
262
+ value: 'grapefruit',
263
+ },
264
+ ];
265
+ return (
266
+ <Radio
267
+ label="Your favourite fruit"
268
+ onChange={(e) => setFruit(e.target.value)}
269
+ options={options}
270
+ state="changed"
271
+ value={fruit}
272
+ />
273
+ );
274
+ })
275
+ ```
276
+
240
277
  ### Required State
241
278
 
242
279
  The required state indicates that the input is mandatory.
@@ -269,18 +306,10 @@ React.createElement(() => {
269
306
  })
270
307
  ```
271
308
 
272
- #### Styling the Required State
273
-
274
- All form fields in React UI can be
275
- [styled](/docs/customize/theming/forms/#required-state)
276
- to indicate the required state.
277
-
278
- However, you may find yourself in a situation where a form field is valid in
279
- both selected and unselected states, for example to turn on or off a feature.
280
- If your project uses the label color as the primary means to indicate the
281
- required state of input fields and the usual asterisk `*` is omitted, you may
282
- want to keep the label color consistent for both states to avoid confusion.
309
+ #### Rendering as Required
283
310
 
311
+ A form field may be valid in both selected and unselected states, for example
312
+ to turn on or off a feature, while your design still needs it to look required.
284
313
  For this edge case, there is the `renderAsRequired` prop:
285
314
 
286
315
  ```docoff-react-preview
@@ -301,40 +330,23 @@ React.createElement(() => {
301
330
  },
302
331
  ];
303
332
  return (
304
- <React.Fragment>
305
- <style>
306
- {`
307
- .example {
308
- display: flex;
309
- flex-wrap: wrap;
310
- gap: 1rem 0.5rem;
311
- }
312
-
313
- .example--themed-form-fields {
314
- --rui-FormField__label__color: var(--rui-color-text-secondary);
315
- --rui-FormField--required__label__color: var(--rui-color-text-primary);
316
- --rui-FormField--required__sign: '';
317
- }
318
- `}
319
- </style>
320
- <div class="example example--themed-form-fields">
321
- <Radio
322
- label="This field is optional"
323
- onChange={(e) => setFruit(e.target.value)}
324
- options={options}
325
- value={fruit}
326
- />
327
- <Radio
328
- label="This field is optional but looks like required"
329
- onChange={(e) => setFruit(e.target.value)}
330
- options={options}
331
- value={fruit}
332
- renderAsRequired
333
- />
334
- </div>
335
- </React.Fragment>
333
+ <>
334
+ <Radio
335
+ label="This field is optional"
336
+ onChange={(e) => setFruit(e.target.value)}
337
+ options={options}
338
+ value={fruit}
339
+ />
340
+ <Radio
341
+ label="This field is optional but looks like required"
342
+ onChange={(e) => setFruit(e.target.value)}
343
+ options={options}
344
+ value={fruit}
345
+ renderAsRequired
346
+ />
347
+ </>
336
348
  );
337
- })
349
+ });
338
350
  ```
339
351
 
340
352
  It renders the field as if it was required, but doesn't add the `required`
@@ -398,7 +410,7 @@ to improve its accessibility.
398
410
 
399
411
  ## API
400
412
 
401
- <docoff-react-props src="/components/Radio/Radio.jsx"></docoff-react-props>
413
+ <docoff-react-props src="/components/Radio/Radio.tsx" name="Radio"></docoff-react-props>
402
414
 
403
415
  ## Theming
404
416
 
@@ -410,6 +422,71 @@ options. On top of that, the following options are available for Radio.
410
422
  | `--rui-FormField--check__input--radio__border-radius` | Input corner radius |
411
423
  | `--rui-FormField--check__input--radio--checked__background-image` | Checked input background image (inline, URL, …) |
412
424
 
425
+ ### Theming the Required State
426
+
427
+ Required fields are indicated by
428
+ [shared theming options](/docs/customize/theming/forms/#required-state).
429
+
430
+ If your project uses the label color as the primary means to indicate the
431
+ required state of input fields and the usual asterisk `*` is omitted, you may
432
+ want to keep the label color consistent for fields that are valid in both
433
+ selected and unselected states. Pair the theming options with the
434
+ [`renderAsRequired`](#rendering-as-required) prop to achieve that:
435
+
436
+ ```docoff-react-preview
437
+ React.createElement(() => {
438
+ const [fruit, setFruit] = React.useState('apple');
439
+ const options = [
440
+ {
441
+ label: 'Apple',
442
+ value: 'apple',
443
+ },
444
+ {
445
+ label: 'Banana',
446
+ value: 'banana',
447
+ },
448
+ {
449
+ label: 'Grapefruit',
450
+ value: 'grapefruit',
451
+ },
452
+ ];
453
+ return (
454
+ <React.Fragment>
455
+ <style>
456
+ {`
457
+ .example {
458
+ display: flex;
459
+ flex-wrap: wrap;
460
+ gap: 1rem 0.5rem;
461
+ }
462
+
463
+ .example--themed-form-fields {
464
+ --rui-FormField__label__color: var(--rui-color-text-secondary);
465
+ --rui-FormField--required__label__color: var(--rui-color-text-primary);
466
+ --rui-FormField--required__sign: '';
467
+ }
468
+ `}
469
+ </style>
470
+ <div class="example example--themed-form-fields">
471
+ <Radio
472
+ label="This field is optional"
473
+ onChange={(e) => setFruit(e.target.value)}
474
+ options={options}
475
+ value={fruit}
476
+ />
477
+ <Radio
478
+ label="This field is optional but looks like required"
479
+ onChange={(e) => setFruit(e.target.value)}
480
+ options={options}
481
+ value={fruit}
482
+ renderAsRequired
483
+ />
484
+ </div>
485
+ </React.Fragment>
486
+ );
487
+ });
488
+ ```
489
+
413
490
  [accessibility]: https://www.w3.org/WAI/tutorials/forms/grouping/
414
491
  [fieldset]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/fieldset
415
492
  [nng-radio]: https://www.nngroup.com/articles/checkboxes-vs-radio-buttons/
@@ -57,16 +57,20 @@
57
57
  }
58
58
 
59
59
  // States
60
+ .isRootStateChanged {
61
+ @include variants.state(changed);
62
+ }
63
+
60
64
  .isRootStateInvalid {
61
- @include variants.validation(invalid);
65
+ @include variants.state(invalid);
62
66
  }
63
67
 
64
68
  .isRootStateValid {
65
- @include variants.validation(valid);
69
+ @include variants.state(valid);
66
70
  }
67
71
 
68
72
  .isRootStateWarning {
69
- @include variants.validation(warning);
73
+ @include variants.state(warning);
70
74
  }
71
75
 
72
76
  // Layouts