@react-ui-org/react-ui 0.64.0 → 0.65.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 (293) hide show
  1. package/README.md +3 -6
  2. package/dist/react-ui.css +16 -16
  3. package/dist/react-ui.d.ts +1928 -0
  4. package/dist/react-ui.development.css +2916 -2915
  5. package/dist/react-ui.development.js +2019 -1051
  6. package/dist/react-ui.js +1 -1
  7. package/package.json +74 -70
  8. package/scripts/write-lockfile-hash.sh +6 -0
  9. package/src/components/Alert/{Alert.jsx → Alert.tsx} +8 -43
  10. package/src/components/Alert/Alert.types.ts +34 -0
  11. package/src/components/Alert/README.md +1 -1
  12. package/src/components/Alert/index.ts +2 -0
  13. package/src/components/Badge/Badge.tsx +30 -0
  14. package/src/components/Badge/Badge.types.ts +24 -0
  15. package/src/components/Badge/README.md +1 -1
  16. package/src/components/Badge/index.ts +5 -0
  17. package/src/components/Button/Button.tsx +110 -0
  18. package/src/components/Button/Button.types.ts +93 -0
  19. package/src/components/Button/README.md +1 -1
  20. package/src/components/Button/helpers/{getRootLabelVisibilityClassName.js → getRootLabelVisibilityClassName.ts} +4 -1
  21. package/src/components/Button/index.ts +6 -0
  22. package/src/components/ButtonGroup/{ButtonGroup.jsx → ButtonGroup.tsx} +9 -40
  23. package/src/components/ButtonGroup/ButtonGroup.types.ts +45 -0
  24. package/src/components/ButtonGroup/ButtonGroupContext.ts +4 -0
  25. package/src/components/ButtonGroup/README.md +1 -1
  26. package/src/components/ButtonGroup/{index.js → index.ts} +4 -0
  27. package/src/components/Card/Card.tsx +33 -0
  28. package/src/components/Card/Card.types.ts +46 -0
  29. package/src/components/Card/{CardBody.jsx → CardBody.tsx} +4 -11
  30. package/src/components/Card/{CardFooter.jsx → CardFooter.tsx} +4 -15
  31. package/src/components/Card/README.md +6 -7
  32. package/src/components/Card/{index.js → index.ts} +5 -0
  33. package/src/components/CheckboxField/CheckboxField.tsx +81 -0
  34. package/src/components/CheckboxField/CheckboxField.types.ts +63 -0
  35. package/src/components/CheckboxField/README.md +67 -42
  36. package/src/components/CheckboxField/index.ts +5 -0
  37. package/src/components/FileInputField/{FileInputField.jsx → FileInputField.tsx} +42 -128
  38. package/src/components/FileInputField/FileInputField.types.ts +100 -0
  39. package/src/components/FileInputField/README.md +1 -1
  40. package/src/components/FileInputField/index.ts +6 -0
  41. package/src/components/FormLayout/FormLayout.module.scss +1 -1
  42. package/src/components/FormLayout/{FormLayout.jsx → FormLayout.tsx} +15 -50
  43. package/src/components/FormLayout/FormLayout.types.ts +55 -0
  44. package/src/components/FormLayout/FormLayoutContext.ts +4 -0
  45. package/src/components/FormLayout/{FormLayoutCustomField.jsx → FormLayoutCustomField.tsx} +10 -65
  46. package/src/components/FormLayout/FormLayoutCustomField.types.ts +59 -0
  47. package/src/components/FormLayout/FormLayoutCustomFieldContext.ts +4 -0
  48. package/src/components/FormLayout/README.md +4 -6
  49. package/src/components/FormLayout/index.ts +14 -0
  50. package/src/components/Grid/Grid.module.scss +1 -1
  51. package/src/components/Grid/Grid.tsx +50 -0
  52. package/src/components/Grid/Grid.types.ts +108 -0
  53. package/src/components/Grid/GridSpan.tsx +36 -0
  54. package/src/components/Grid/README.md +2 -2
  55. package/src/components/Grid/_helpers/generateResponsiveCustomProperties.ts +32 -0
  56. package/src/components/Grid/index.ts +9 -0
  57. package/src/components/InputGroup/{InputGroup.jsx → InputGroup.tsx} +25 -89
  58. package/src/components/InputGroup/InputGroup.types.ts +80 -0
  59. package/src/components/InputGroup/InputGroupContext.ts +4 -0
  60. package/src/components/InputGroup/README.md +5 -1
  61. package/src/components/InputGroup/{index.js → index.ts} +4 -0
  62. package/src/components/Modal/Modal.tsx +172 -0
  63. package/src/components/Modal/Modal.types.ts +181 -0
  64. package/src/components/Modal/ModalBody.tsx +34 -0
  65. package/src/components/Modal/{ModalCloseButton.jsx → ModalCloseButton.tsx} +6 -19
  66. package/src/components/Modal/{ModalContent.jsx → ModalContent.tsx} +4 -15
  67. package/src/components/Modal/ModalFooter.tsx +27 -0
  68. package/src/components/Modal/ModalHeader.tsx +27 -0
  69. package/src/components/Modal/ModalTitle.tsx +29 -0
  70. package/src/components/Modal/README.md +9 -9
  71. package/src/components/Modal/_helpers/{dialogOnCancelHandler.js → dialogOnCancelHandler.ts} +11 -1
  72. package/src/components/Modal/_helpers/{dialogOnClickHandler.js → dialogOnClickHandler.ts} +13 -7
  73. package/src/components/Modal/_helpers/{dialogOnCloseHandler.js → dialogOnCloseHandler.ts} +11 -1
  74. package/src/components/Modal/_helpers/{dialogOnKeyDownHandler.js → dialogOnKeyDownHandler.ts} +19 -6
  75. package/src/components/Modal/_helpers/{getJustifyClassName.js → getJustifyClassName.ts} +4 -1
  76. package/src/components/Modal/_helpers/getPositionClassName.ts +10 -0
  77. package/src/components/Modal/_helpers/getScrollingClassName.ts +14 -0
  78. package/src/components/Modal/_helpers/{getSizeClassName.js → getSizeClassName.ts} +4 -1
  79. package/src/components/Modal/_hooks/{useModalFocus.js → useModalFocus.ts} +9 -5
  80. package/src/components/Modal/_hooks/{useModalScrollPrevention.js → useModalScrollPrevention.ts} +4 -1
  81. package/src/components/Modal/{index.js → index.ts} +14 -0
  82. package/src/components/Paper/{Paper.jsx → Paper.tsx} +6 -26
  83. package/src/components/Paper/Paper.types.ts +19 -0
  84. package/src/components/Paper/README.md +3 -4
  85. package/src/components/Paper/index.ts +2 -0
  86. package/src/components/Popover/Popover.module.scss +1 -1
  87. package/src/components/Popover/Popover.tsx +61 -0
  88. package/src/components/Popover/Popover.types.ts +75 -0
  89. package/src/components/Popover/PopoverWrapper.tsx +27 -0
  90. package/src/components/Popover/README.md +34 -22
  91. package/src/components/Popover/_helpers/{cleanPlacementStyle.js → cleanPlacementStyle.ts} +4 -1
  92. package/src/components/Popover/_helpers/{getRootAlignmentClassName.js → getRootAlignmentClassName.ts} +4 -1
  93. package/src/components/Popover/_helpers/{getRootSideClassName.js → getRootSideClassName.ts} +4 -1
  94. package/src/components/Popover/index.ts +8 -0
  95. package/src/components/Radio/README.md +85 -45
  96. package/src/components/Radio/{Radio.jsx → Radio.tsx} +11 -107
  97. package/src/components/Radio/Radio.types.ts +90 -0
  98. package/src/components/Radio/index.ts +5 -0
  99. package/src/components/ScrollView/README.md +1 -1
  100. package/src/components/ScrollView/ScrollView.module.scss +5 -0
  101. package/src/components/ScrollView/{ScrollView.jsx → ScrollView.tsx} +55 -166
  102. package/src/components/ScrollView/ScrollView.types.ts +121 -0
  103. package/src/components/ScrollView/_helpers/getElementsPositionDifference.ts +17 -0
  104. package/src/components/ScrollView/_hooks/{useLoadResizeHook.js → useLoadResizeHook.ts} +14 -3
  105. package/src/components/ScrollView/_hooks/{useScrollPositionHook.js → useScrollPositionHook.ts} +11 -4
  106. package/src/components/ScrollView/index.ts +6 -0
  107. package/src/components/SelectField/README.md +84 -45
  108. package/src/components/SelectField/SelectField.tsx +139 -0
  109. package/src/components/SelectField/SelectField.types.ts +120 -0
  110. package/src/components/SelectField/_components/Option/Option.tsx +19 -0
  111. package/src/components/SelectField/_components/Option/Option.types.ts +21 -0
  112. package/src/components/SelectField/_components/Option/index.ts +2 -0
  113. package/src/components/SelectField/index.ts +7 -0
  114. package/src/components/Table/README.md +1 -1
  115. package/src/components/Table/{Table.jsx → Table.tsx} +4 -43
  116. package/src/components/Table/Table.types.ts +51 -0
  117. package/src/components/Table/_components/TableBodyCell/TableBodyCell.tsx +20 -0
  118. package/src/components/Table/_components/TableBodyCell/TableBodyCell.types.ts +20 -0
  119. package/src/components/Table/_components/TableBodyCell/index.ts +2 -0
  120. package/src/components/Table/_components/TableHeaderCell/{TableHeaderCell.jsx → TableHeaderCell.tsx} +3 -34
  121. package/src/components/Table/_components/TableHeaderCell/TableHeaderCell.types.ts +20 -0
  122. package/src/components/Table/_components/TableHeaderCell/index.ts +2 -0
  123. package/src/components/Table/index.ts +8 -0
  124. package/src/components/Tabs/README.md +2 -2
  125. package/src/components/Tabs/{Tabs.jsx → Tabs.tsx} +4 -20
  126. package/src/components/Tabs/Tabs.types.ts +19 -0
  127. package/src/components/Tabs/TabsItem.tsx +49 -0
  128. package/src/components/Tabs/TabsItem.types.ts +42 -0
  129. package/src/components/Tabs/index.ts +4 -0
  130. package/src/components/Text/README.md +1 -1
  131. package/src/components/Text/Text.module.scss +5 -7
  132. package/src/components/Text/Text.tsx +46 -0
  133. package/src/components/Text/Text.types.ts +31 -0
  134. package/src/components/Text/_helpers/getRootClampClassName.ts +13 -0
  135. package/src/components/Text/_helpers/getRootHyphensClassName.ts +14 -0
  136. package/src/components/Text/_helpers/getRootWordWrappingClassName.ts +14 -0
  137. package/src/components/Text/index.ts +6 -0
  138. package/src/components/TextArea/README.md +5 -8
  139. package/src/components/TextArea/TextArea.tsx +95 -0
  140. package/src/components/TextArea/TextArea.types.ts +75 -0
  141. package/src/components/TextArea/index.ts +5 -0
  142. package/src/components/TextField/README.md +5 -7
  143. package/src/components/TextField/TextField.tsx +112 -0
  144. package/src/components/TextField/TextField.types.ts +94 -0
  145. package/src/components/TextField/index.ts +6 -0
  146. package/src/components/TextLink/README.md +1 -1
  147. package/src/components/TextLink/{TextLink.jsx → TextLink.tsx} +4 -15
  148. package/src/components/TextLink/TextLink.types.ts +12 -0
  149. package/src/components/TextLink/index.ts +2 -0
  150. package/src/components/Toggle/README.md +67 -42
  151. package/src/components/Toggle/Toggle.tsx +82 -0
  152. package/src/components/Toggle/Toggle.types.ts +58 -0
  153. package/src/components/Toggle/index.ts +5 -0
  154. package/src/components/Toolbar/README.md +3 -3
  155. package/src/components/Toolbar/Toolbar.tsx +41 -0
  156. package/src/components/Toolbar/Toolbar.types.ts +74 -0
  157. package/src/components/Toolbar/ToolbarGroup.tsx +38 -0
  158. package/src/components/Toolbar/{ToolbarItem.jsx → ToolbarItem.tsx} +5 -21
  159. package/src/components/Toolbar/_helpers/{getAlignClassName.js → getAlignClassName.ts} +8 -1
  160. package/src/components/Toolbar/_helpers/{getJustifyClassName.js → getJustifyClassName.ts} +4 -1
  161. package/src/components/Toolbar/{index.js → index.ts} +7 -0
  162. package/src/components/_helpers/{getRootColorClassName.js → getRootColorClassName.ts} +6 -1
  163. package/src/components/_helpers/{getRootPriorityClassName.js → getRootPriorityClassName.ts} +6 -1
  164. package/src/components/_helpers/{getRootSizeClassName.js → getRootSizeClassName.ts} +6 -1
  165. package/src/components/_helpers/{getRootValidationStateClassName.js → getRootValidationStateClassName.ts} +6 -1
  166. package/src/components/_helpers/resolveContextOrProp.ts +13 -0
  167. package/src/helpers/classNames/{classNames.js → classNames.ts} +2 -2
  168. package/src/helpers/isChildrenEmpty/isChildrenEmpty.ts +5 -0
  169. package/src/helpers/transferProps/transferProps.ts +50 -0
  170. package/src/helpers/transferProps/transferProps.types.ts +11 -0
  171. package/src/index.ts +211 -0
  172. package/src/providers/globalProps/GlobalProps.types.ts +30 -0
  173. package/src/providers/globalProps/GlobalPropsContext.ts +6 -0
  174. package/src/providers/globalProps/{GlobalPropsProvider.jsx → GlobalPropsProvider.tsx} +8 -15
  175. package/src/providers/globalProps/{index.js → index.ts} +4 -0
  176. package/src/providers/globalProps/withGlobalProps.tsx +36 -0
  177. package/src/providers/translations/Translations.types.ts +26 -0
  178. package/src/providers/translations/TranslationsContext.ts +7 -0
  179. package/src/providers/translations/{TranslationsProvider.jsx → TranslationsProvider.tsx} +8 -15
  180. package/src/providers/translations/{index.js → index.ts} +5 -0
  181. package/src/styles/tools/_accessibility.scss +2 -2
  182. package/src/translations/{en.js → en.ts} +3 -1
  183. package/src/types/breakpoints.ts +1 -0
  184. package/src/types/colors.ts +7 -0
  185. package/src/types/index.ts +13 -0
  186. package/src/types/labelPositions.ts +1 -0
  187. package/src/types/layouts.ts +1 -0
  188. package/src/types/modules.d.ts +16 -0
  189. package/src/types/priorities.ts +1 -0
  190. package/src/types/sizes.ts +1 -0
  191. package/src/types/styles.ts +4 -0
  192. package/src/types/validationStates.ts +1 -0
  193. package/src/utils/mergeDeep.ts +34 -0
  194. package/src/utils/mergeDeep.types.ts +4 -0
  195. package/.claude/agents/code-reviewer.md +0 -122
  196. package/.claude/rules/code.md +0 -22
  197. package/.claude/rules/docs.md +0 -35
  198. package/.claude/rules/frontend.md +0 -72
  199. package/.claude/rules/git.md +0 -13
  200. package/.claude/rules/safety-guards.md +0 -9
  201. package/.claude/rules/styling.md +0 -32
  202. package/.claude/rules/testing.md +0 -59
  203. package/.claude/settings.json +0 -32
  204. package/.claude/skills/commit/SKILL.md +0 -54
  205. package/.devcontainer/devcontainer.json +0 -23
  206. package/.eslintrc-ts +0 -40
  207. package/.mcp.json +0 -8
  208. package/.nvmrc +0 -1
  209. package/CLAUDE.md +0 -82
  210. package/docker-compose.base.yml +0 -93
  211. package/docker-compose.yml.dist +0 -41
  212. package/jest.config-ts.js +0 -34
  213. package/opencode.json +0 -10
  214. package/playwright-ct.config.ts +0 -68
  215. package/scripts/auto-start-mkdocs.sh +0 -5
  216. package/scripts/auto-start-node.sh +0 -33
  217. package/scripts/mcps/chrome-host/README.md +0 -118
  218. package/scripts/mcps/chrome-host/cdp_proxy.py +0 -90
  219. package/scripts/mcps/chrome-host/mcp-entry.sh +0 -33
  220. package/scripts/mcps/chrome-host/mcp-launch.sh +0 -36
  221. package/scripts/mcps/chrome-host/mcp-setup.sh +0 -70
  222. package/scripts/mcps/chrome-host/start-host-chrome.sh +0 -267
  223. package/setup.sh +0 -107
  224. package/src/CNAME +0 -1
  225. package/src/components/Alert/index.js +0 -1
  226. package/src/components/Badge/Badge.jsx +0 -51
  227. package/src/components/Badge/index.js +0 -1
  228. package/src/components/Button/Button.jsx +0 -203
  229. package/src/components/Button/helpers/getRootPriorityClassName.js +0 -15
  230. package/src/components/Button/index.js +0 -1
  231. package/src/components/ButtonGroup/ButtonGroupContext.js +0 -3
  232. package/src/components/Card/Card.jsx +0 -67
  233. package/src/components/CheckboxField/CheckboxField.jsx +0 -144
  234. package/src/components/CheckboxField/index.js +0 -1
  235. package/src/components/FileInputField/index.js +0 -1
  236. package/src/components/FormLayout/FormLayoutContext.js +0 -3
  237. package/src/components/FormLayout/FormLayoutCustomFieldContext.js +0 -3
  238. package/src/components/FormLayout/index.js +0 -4
  239. package/src/components/Grid/Grid.jsx +0 -225
  240. package/src/components/Grid/GridSpan.jsx +0 -88
  241. package/src/components/Grid/_helpers/generateResponsiveCustomProperties.js +0 -22
  242. package/src/components/Grid/index.js +0 -2
  243. package/src/components/InputGroup/InputGroupContext.js +0 -3
  244. package/src/components/Modal/Modal.jsx +0 -262
  245. package/src/components/Modal/ModalBody.jsx +0 -60
  246. package/src/components/Modal/ModalFooter.jsx +0 -42
  247. package/src/components/Modal/ModalHeader.jsx +0 -42
  248. package/src/components/Modal/ModalTitle.jsx +0 -42
  249. package/src/components/Modal/_helpers/getPositionClassName.js +0 -7
  250. package/src/components/Modal/_helpers/getScrollingClassName.js +0 -11
  251. package/src/components/Paper/index.js +0 -1
  252. package/src/components/Popover/Popover.jsx +0 -124
  253. package/src/components/Popover/PopoverWrapper.jsx +0 -38
  254. package/src/components/Popover/index.js +0 -2
  255. package/src/components/Radio/index.js +0 -1
  256. package/src/components/ScrollView/_helpers/getElementsPositionDifference.js +0 -11
  257. package/src/components/ScrollView/index.js +0 -1
  258. package/src/components/SelectField/SelectField.jsx +0 -272
  259. package/src/components/SelectField/_components/Option/Option.jsx +0 -46
  260. package/src/components/SelectField/_components/Option/index.js +0 -1
  261. package/src/components/SelectField/index.js +0 -1
  262. package/src/components/Table/_components/TableBodyCell/TableBodyCell.jsx +0 -46
  263. package/src/components/Table/_components/TableBodyCell/index.js +0 -1
  264. package/src/components/Table/_components/TableHeaderCell/index.js +0 -1
  265. package/src/components/Table/index.js +0 -1
  266. package/src/components/Tabs/TabsItem.jsx +0 -91
  267. package/src/components/Tabs/index.js +0 -2
  268. package/src/components/Text/Text.jsx +0 -76
  269. package/src/components/Text/_helpers/getRootClampClassName.js +0 -11
  270. package/src/components/Text/_helpers/getRootHyphensClassName.js +0 -11
  271. package/src/components/Text/_helpers/getRootWordWrappingClassName.js +0 -11
  272. package/src/components/Text/index.js +0 -1
  273. package/src/components/TextArea/TextArea.jsx +0 -174
  274. package/src/components/TextArea/index.js +0 -1
  275. package/src/components/TextField/TextField.jsx +0 -208
  276. package/src/components/TextField/index.js +0 -1
  277. package/src/components/TextLink/index.js +0 -1
  278. package/src/components/Toggle/Toggle.jsx +0 -144
  279. package/src/components/Toggle/index.js +0 -1
  280. package/src/components/Toolbar/Toolbar.jsx +0 -76
  281. package/src/components/Toolbar/ToolbarGroup.jsx +0 -64
  282. package/src/components/_helpers/resolveContextOrProp.js +0 -10
  283. package/src/helpers/isChildrenEmpty/isChildrenEmpty.js +0 -3
  284. package/src/helpers/transferProps/transferProps.js +0 -38
  285. package/src/index.js +0 -67
  286. package/src/providers/globalProps/GlobalPropsContext.jsx +0 -5
  287. package/src/providers/globalProps/withGlobalProps.jsx +0 -38
  288. package/src/providers/translations/TranslationsContext.jsx +0 -6
  289. package/src/utils/mergeDeep.js +0 -28
  290. package/tsconfig.json +0 -27
  291. /package/src/helpers/classNames/{index.js → index.ts} +0 -0
  292. /package/src/helpers/isChildrenEmpty/{index.js → index.ts} +0 -0
  293. /package/src/helpers/transferProps/{index.js → index.ts} +0 -0
@@ -1,76 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- import { withGlobalProps } from '../../providers/globalProps';
4
- import { classNames } from '../../helpers/classNames/classNames';
5
- import { transferProps } from '../../helpers/transferProps';
6
- import { isChildrenEmpty } from '../../helpers/isChildrenEmpty/isChildrenEmpty';
7
- import { getRootClampClassName } from './_helpers/getRootClampClassName';
8
- import { getRootHyphensClassName } from './_helpers/getRootHyphensClassName';
9
- import { getRootWordWrappingClassName } from './_helpers/getRootWordWrappingClassName';
10
- import styles from './Text.module.scss';
11
-
12
- export const Text = ({
13
- blockLevel,
14
- children,
15
- hyphens,
16
- lines,
17
- wordWrapping,
18
- ...restProps
19
- }) => {
20
- if (isChildrenEmpty(children)) {
21
- return null;
22
- }
23
-
24
- const HtmlElement = blockLevel ? 'div' : 'span';
25
-
26
- return (
27
- <HtmlElement
28
- {...transferProps(restProps)}
29
- className={(hyphens !== 'none' || lines > 0 || wordWrapping !== 'normal')
30
- ? classNames(
31
- getRootClampClassName(lines, styles),
32
- getRootHyphensClassName(hyphens, styles),
33
- getRootWordWrappingClassName(wordWrapping, styles),
34
- )
35
- : undefined}
36
- style={(lines > 1) ? { '--rui-custom-lines': lines } : undefined}
37
- >
38
- {children}
39
- </HtmlElement>
40
- );
41
- };
42
-
43
- Text.defaultProps = {
44
- blockLevel: false,
45
- children: undefined,
46
- hyphens: 'none',
47
- lines: undefined,
48
- wordWrapping: 'normal',
49
- };
50
-
51
- Text.propTypes = {
52
- /**
53
- * If true, the root HTML element renders as `<div>` instead of `<span>`.
54
- */
55
- blockLevel: PropTypes.bool,
56
- /**
57
- * Text content to be sanitized. Can contain HTML.
58
- */
59
- children: PropTypes.node,
60
- /**
61
- * Turn on hyphenation. Head to [Hyphens](#hyphens) to learn more.
62
- */
63
- hyphens: PropTypes.oneOf(['none', 'auto', 'manual']),
64
- /**
65
- * Optional number of lines. If exceeded, the content is truncated and appended by an ellipsis (`…`).
66
- */
67
- lines: PropTypes.number,
68
- /**
69
- * How to deal with long words. Head to [Word Wrapping](#word-wrapping) for detailed explanation.
70
- */
71
- wordWrapping: PropTypes.oneOf(['normal', 'long-words', 'anywhere']),
72
- };
73
-
74
- export const TextWithGlobalProps = withGlobalProps(Text, 'Text');
75
-
76
- export default TextWithGlobalProps;
@@ -1,11 +0,0 @@
1
- export const getRootClampClassName = (lines, styles) => {
2
- if (lines === 1) {
3
- return styles.isRootClampSingleLine;
4
- }
5
-
6
- if (lines > 1) {
7
- return styles.isRootClampMultiLine;
8
- }
9
-
10
- return null;
11
- };
@@ -1,11 +0,0 @@
1
- export const getRootHyphensClassName = (hyphens, styles) => {
2
- if (hyphens === 'auto') {
3
- return styles.isRootHyphensAuto;
4
- }
5
-
6
- if (hyphens === 'manual') {
7
- return styles.isRootHyphensManual;
8
- }
9
-
10
- return null;
11
- };
@@ -1,11 +0,0 @@
1
- export const getRootWordWrappingClassName = (wordWrapping, styles) => {
2
- if (wordWrapping === 'anywhere') {
3
- return styles.isRootWordWrappingAnywhere;
4
- }
5
-
6
- if (wordWrapping === 'long-words') {
7
- return styles.isRootWordWrappingLongWords;
8
- }
9
-
10
- return null;
11
- };
@@ -1 +0,0 @@
1
- export { default as Text } from './Text';
@@ -1,174 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React, { useContext } from 'react';
3
- import { withGlobalProps } from '../../providers/globalProps';
4
- import { classNames } from '../../helpers/classNames/classNames';
5
- import { transferProps } from '../../helpers/transferProps';
6
- import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
7
- import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
8
- import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
9
- import {
10
- FormLayoutContext,
11
- FormLayoutCustomFieldContext,
12
- } from '../FormLayout';
13
- import styles from './TextArea.module.scss';
14
-
15
- export const TextArea = React.forwardRef((props, ref) => {
16
- const {
17
- disabled,
18
- fullWidth,
19
- helpText,
20
- id,
21
- isLabelVisible,
22
- label,
23
- layout,
24
- required,
25
- size,
26
- validationState,
27
- validationText,
28
- variant,
29
- ...restProps
30
- } = props;
31
-
32
- const context = useContext(FormLayoutContext);
33
- const formLayoutCustomFieldContext = useContext(FormLayoutCustomFieldContext);
34
-
35
- return (
36
- <label
37
- className={classNames(
38
- styles.root,
39
- fullWidth && styles.isRootFullWidth,
40
- context && styles.isRootInFormLayout,
41
- resolveContextOrProp(context && context.layout, layout) === 'horizontal'
42
- ? styles.isRootLayoutHorizontal
43
- : styles.isRootLayoutVertical,
44
- disabled && styles.isRootDisabled,
45
- required && styles.isRootRequired,
46
- getRootSizeClassName(size, styles),
47
- getRootValidationStateClassName(validationState, styles),
48
- variant === 'filled' ? styles.isRootVariantFilled : styles.isRootVariantOutline,
49
- )}
50
- htmlFor={id}
51
- id={id && `${id}__label`}
52
- >
53
- <div
54
- className={classNames(
55
- styles.label,
56
- (!isLabelVisible || formLayoutCustomFieldContext) && styles.isLabelHidden,
57
- )}
58
- id={id && `${id}__labelText`}
59
- >
60
- {label}
61
- </div>
62
- <div className={styles.field}>
63
- <div className={styles.inputContainer}>
64
- <textarea
65
- {...transferProps(restProps)}
66
- className={styles.input}
67
- disabled={disabled}
68
- id={id}
69
- ref={ref}
70
- required={required}
71
- />
72
- {variant === 'filled' && (
73
- <div className={styles.bottomLine} />
74
- )}
75
- </div>
76
- {helpText && (
77
- <div
78
- className={styles.helpText}
79
- id={id && `${id}__helpText`}
80
- >
81
- {helpText}
82
- </div>
83
- )}
84
- {validationText && (
85
- <div
86
- className={styles.validationText}
87
- id={id && `${id}__validationText`}
88
- >
89
- {validationText}
90
- </div>
91
- )}
92
- </div>
93
- </label>
94
- );
95
- });
96
-
97
- TextArea.defaultProps = {
98
- disabled: false,
99
- fullWidth: false,
100
- helpText: undefined,
101
- id: undefined,
102
- isLabelVisible: true,
103
- layout: 'vertical',
104
- required: false,
105
- size: 'medium',
106
- validationState: undefined,
107
- validationText: undefined,
108
- variant: 'outline',
109
- };
110
-
111
- TextArea.propTypes = {
112
- /**
113
- * If `true`, the input will be disabled.
114
- */
115
- disabled: PropTypes.bool,
116
- /**
117
- * If `true`, the field will span the full width of its parent.
118
- */
119
- fullWidth: PropTypes.bool,
120
- /**
121
- * Optional help text.
122
- */
123
- helpText: PropTypes.node,
124
- /** ID of the input HTML element. It also serves as a prefix for nested elements:
125
- * * `<ID>__label`
126
- * * `<ID>__labelText`
127
- * * `<ID>__helpText`
128
- * * `<ID>__validationText`
129
- */
130
- id: PropTypes.string,
131
- /**
132
- * If `false`, the label will be visually hidden (but remains accessible by assistive
133
- * technologies).
134
- *
135
- * Automatically set to `false` when the component is rendered within `FormLayoutCustomField`
136
- * component.
137
- */
138
- isLabelVisible: PropTypes.bool,
139
- /**
140
- * Text field label.
141
- */
142
- label: PropTypes.node.isRequired,
143
- /**
144
- * Layout of the field.
145
- *
146
- * Ignored if the component is rendered within `FormLayout` component
147
- * as the value is inherited in such case.
148
- */
149
- layout: PropTypes.oneOf(['horizontal', 'vertical']),
150
- /**
151
- * If `true`, the input will be required.
152
- */
153
- required: PropTypes.bool,
154
- /**
155
- * Size of the field.
156
- */
157
- size: PropTypes.oneOf(['small', 'medium', 'large']),
158
- /**
159
- * Alter the field to provide feedback based on validation result.
160
- */
161
- validationState: PropTypes.oneOf(['invalid', 'valid', 'warning']),
162
- /**
163
- * Validation message to be displayed.
164
- */
165
- validationText: PropTypes.node,
166
- /**
167
- * Design variant of the field, further customizable with CSS custom properties.
168
- */
169
- variant: PropTypes.oneOf(['filled', 'outline']),
170
- };
171
-
172
- export const TextAreaWithGlobalProps = withGlobalProps(TextArea, 'TextArea');
173
-
174
- export default TextAreaWithGlobalProps;
@@ -1 +0,0 @@
1
- export { default as TextArea } from './TextArea';
@@ -1,208 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React, { useContext } from 'react';
3
- import { withGlobalProps } from '../../providers/globalProps';
4
- import { classNames } from '../../helpers/classNames/classNames';
5
- import { transferProps } from '../../helpers/transferProps';
6
- import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
7
- import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
8
- import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
9
- import {
10
- FormLayoutContext,
11
- FormLayoutCustomFieldContext,
12
- } from '../FormLayout';
13
- import { InputGroupContext } from '../InputGroup/InputGroupContext';
14
- import styles from './TextField.module.scss';
15
-
16
- const SMALL_INPUT_SIZE = 10;
17
-
18
- export const TextField = React.forwardRef((props, ref) => {
19
- const {
20
- disabled,
21
- fullWidth,
22
- helpText,
23
- id,
24
- inputSize,
25
- isLabelVisible,
26
- label,
27
- layout,
28
- required,
29
- size,
30
- type,
31
- validationState,
32
- validationText,
33
- variant,
34
- ...restProps
35
- } = props;
36
- const formLayoutContext = useContext(FormLayoutContext);
37
- const formLayoutCustomFieldContext = useContext(FormLayoutCustomFieldContext);
38
- const inputGroupContext = useContext(InputGroupContext);
39
- const hasSmallInput = (inputSize !== undefined) && (inputSize <= SMALL_INPUT_SIZE);
40
-
41
- return (
42
- <label
43
- className={classNames(
44
- styles.root,
45
- fullWidth && styles.isRootFullWidth,
46
- hasSmallInput && styles.hasRootSmallInput,
47
- inputSize && styles.hasRootCustomInputSize,
48
- formLayoutContext && styles.isRootInFormLayout,
49
- resolveContextOrProp(inputGroupContext && inputGroupContext.disabled, disabled) && styles.isRootDisabled,
50
- resolveContextOrProp(formLayoutContext && formLayoutContext.layout, layout) === 'horizontal'
51
- ? styles.isRootLayoutHorizontal
52
- : styles.isRootLayoutVertical,
53
- inputGroupContext && styles.isRootGrouped,
54
- required && styles.isRootRequired,
55
- getRootSizeClassName(
56
- resolveContextOrProp(inputGroupContext && inputGroupContext.size, size),
57
- styles,
58
- ),
59
- getRootValidationStateClassName(validationState, styles),
60
- variant === 'filled' ? styles.isRootVariantFilled : styles.isRootVariantOutline,
61
- )}
62
- htmlFor={id}
63
- id={id && `${id}__label`}
64
- {...(inputSize ? { style: { '--rui-custom-input-size': inputSize } } : {})}
65
- >
66
- <div
67
- className={classNames(
68
- styles.label,
69
- (!isLabelVisible || inputGroupContext || formLayoutCustomFieldContext) && styles.isLabelHidden,
70
- )}
71
- id={id && `${id}__labelText`}
72
- >
73
- {label}
74
- </div>
75
- <div className={styles.field}>
76
- <div className={styles.inputContainer}>
77
- <input
78
- {...transferProps(restProps)}
79
- className={styles.input}
80
- disabled={resolveContextOrProp(inputGroupContext && inputGroupContext.disabled, disabled)}
81
- id={id}
82
- ref={ref}
83
- required={required}
84
- size={type !== 'number' ? inputSize : null}
85
- type={type}
86
- />
87
- {variant === 'filled' && (
88
- <div className={styles.bottomLine} />
89
- )}
90
- </div>
91
- {(helpText && !inputGroupContext) && (
92
- <div
93
- className={styles.helpText}
94
- id={id && `${id}__helpText`}
95
- >
96
- {helpText}
97
- </div>
98
- )}
99
- {(validationText && !inputGroupContext) && (
100
- <div
101
- className={styles.validationText}
102
- id={id && `${id}__validationText`}
103
- >
104
- {validationText}
105
- </div>
106
- )}
107
- </div>
108
- </label>
109
- );
110
- });
111
-
112
- TextField.defaultProps = {
113
- disabled: false,
114
- fullWidth: false,
115
- helpText: undefined,
116
- id: undefined,
117
- inputSize: undefined,
118
- isLabelVisible: true,
119
- layout: 'vertical',
120
- required: false,
121
- size: 'medium',
122
- type: 'text',
123
- validationState: undefined,
124
- validationText: undefined,
125
- variant: 'outline',
126
- };
127
-
128
- TextField.propTypes = {
129
- /**
130
- * If `true`, the input will be disabled.
131
- */
132
- disabled: PropTypes.bool,
133
- /**
134
- * If `true`, the field will span the full width of its parent.
135
- */
136
- fullWidth: PropTypes.bool,
137
- /**
138
- * Optional help text.
139
- *
140
- * Help text is never rendered when the component is placed into `InputGroup`.
141
- * If a help text is needed, it must be defined on the `InputGroup` component instead.
142
- */
143
- helpText: PropTypes.node,
144
- /**
145
- * ID of the input HTML element. It also serves as a prefix for nested elements:
146
- * * `<ID>__label`
147
- * * `<ID>__labelText`
148
- * * `<ID>__helpText`
149
- * * `<ID>__validationText`
150
- */
151
- id: PropTypes.string,
152
- /**
153
- * Width of the input field. Translated as `size` attribute for input types other than `number`.
154
- */
155
- inputSize: PropTypes.number,
156
- /**
157
- * If `false`, the label will be visually hidden (but remains accessible by assistive
158
- * technologies).
159
- *
160
- * Automatically set to `false` when the component is rendered within `InputGroup` or
161
- * `FormLayoutCustomField` component.
162
- */
163
- isLabelVisible: PropTypes.bool,
164
- /**
165
- * Text field label.
166
- */
167
- label: PropTypes.node.isRequired,
168
- /**
169
- * Layout of the field.
170
- *
171
- * Ignored if the component is rendered within `FormLayout` component
172
- * as the value is inherited in such case.
173
- */
174
- layout: PropTypes.oneOf(['horizontal', 'vertical']),
175
- /**
176
- * If `true`, the input will be required.
177
- */
178
- required: PropTypes.bool,
179
- /**
180
- * Size of the field.
181
- *
182
- * Ignored if the component is rendered within `InputGroup` component as the value is inherited in such case.
183
- */
184
- size: PropTypes.oneOf(['small', 'medium', 'large']),
185
- /**
186
- * HTML input type, translated as `type` attribute of the input.
187
- */
188
- type: PropTypes.oneOf(['email', 'number', 'password', 'tel', 'text']),
189
- /**
190
- * Alter the field to provide feedback based on validation result.
191
- */
192
- validationState: PropTypes.oneOf(['invalid', 'valid', 'warning']),
193
- /**
194
- * Validation message to be displayed.
195
- *
196
- * Validation text is never rendered when the component is placed into `InputGroup`.
197
- * If a validation text is needed, it must be defined on the `InputGroup` component instead.
198
- */
199
- validationText: PropTypes.node,
200
- /**
201
- * Design variant of the field, further customizable with CSS custom properties.
202
- */
203
- variant: PropTypes.oneOf(['filled', 'outline']),
204
- };
205
-
206
- export const TextFieldWithGlobalProps = withGlobalProps(TextField, 'TextField');
207
-
208
- export default TextFieldWithGlobalProps;
@@ -1 +0,0 @@
1
- export { default as TextField } from './TextField';
@@ -1 +0,0 @@
1
- export { default as TextLink } from './TextLink';
@@ -1,144 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React, { useContext } from 'react';
3
- import { withGlobalProps } from '../../providers/globalProps';
4
- import { classNames } from '../../helpers/classNames/classNames';
5
- import { transferProps } from '../../helpers/transferProps';
6
- import { getRootValidationStateClassName } from '../_helpers/getRootValidationStateClassName';
7
- import { FormLayoutContext } from '../FormLayout';
8
- import styles from './Toggle.module.scss';
9
-
10
- export const Toggle = React.forwardRef((props, ref) => {
11
- const {
12
- disabled,
13
- helpText,
14
- id,
15
- isLabelVisible,
16
- label,
17
- labelPosition,
18
- renderAsRequired,
19
- required,
20
- validationState,
21
- validationText,
22
- ...restProps
23
- } = props;
24
-
25
- const context = useContext(FormLayoutContext);
26
-
27
- return (
28
- <label
29
- className={classNames(
30
- styles.root,
31
- context && styles.isRootInFormLayout,
32
- context && context.layout === 'horizontal' ? styles.isRootLayoutHorizontal : styles.isRootLayoutVertical,
33
- labelPosition === 'before' && styles.hasRootLabelBefore,
34
- disabled && styles.isRootDisabled,
35
- (required || renderAsRequired) && styles.isRootRequired,
36
- getRootValidationStateClassName(validationState, styles),
37
- )}
38
- htmlFor={id}
39
- id={id && `${id}__label`}
40
- >
41
- <div className={styles.field}>
42
- <div
43
- className={classNames(
44
- styles.label,
45
- !isLabelVisible && styles.isLabelHidden,
46
- )}
47
- id={id && `${id}__labelText`}
48
- >
49
- {label}
50
- </div>
51
- <input
52
- {...transferProps(restProps)}
53
- className={styles.input}
54
- disabled={disabled}
55
- id={id}
56
- name={id}
57
- ref={ref}
58
- required={required}
59
- type="checkbox"
60
- />
61
- </div>
62
- {helpText && (
63
- <div
64
- className={styles.helpText}
65
- id={id && `${id}__helpText`}
66
- >
67
- {helpText}
68
- </div>
69
- )}
70
- {validationText && (
71
- <div
72
- className={styles.validationText}
73
- id={id && `${id}__validationText`}
74
- >
75
- {validationText}
76
- </div>
77
- )}
78
- </label>
79
- );
80
- });
81
-
82
- Toggle.defaultProps = {
83
- disabled: false,
84
- helpText: undefined,
85
- id: undefined,
86
- isLabelVisible: true,
87
- labelPosition: 'after',
88
- renderAsRequired: false,
89
- required: false,
90
- validationState: undefined,
91
- validationText: undefined,
92
- };
93
-
94
- Toggle.propTypes = {
95
- /**
96
- * If `true`, the input will be disabled.
97
- */
98
- disabled: PropTypes.bool,
99
- /**
100
- * Optional help text.
101
- */
102
- helpText: PropTypes.node,
103
- /**
104
- * ID of the input HTML element. It also serves as a prefix for nested elements:
105
- * * `<ID>__label`
106
- * * `<ID>__labelText`
107
- * * `<ID>__helpText`
108
- * * `<ID>__validationText`
109
- */
110
- id: PropTypes.string,
111
- /**
112
- * If `false`, the label will be visually hidden (but remains accessible by assistive
113
- * technologies).
114
- */
115
- isLabelVisible: PropTypes.bool,
116
- /**
117
- * Toggle label.
118
- */
119
- label: PropTypes.node.isRequired,
120
- /**
121
- * Placement of the label relative to the input.
122
- */
123
- labelPosition: PropTypes.oneOf(['before', 'after']),
124
- /**
125
- * If `true`, the input will be rendered as if it was required.
126
- */
127
- renderAsRequired: PropTypes.bool,
128
- /**
129
- * If `true`, the input will be made and rendered as required, regardless of the `renderAsRequired` prop.
130
- */
131
- required: PropTypes.bool,
132
- /**
133
- * Alter the field to provide feedback based on validation result.
134
- */
135
- validationState: PropTypes.oneOf(['invalid', 'valid', 'warning']),
136
- /**
137
- * Validation message to be displayed.
138
- */
139
- validationText: PropTypes.node,
140
- };
141
-
142
- export const ToggleWithGlobalProps = withGlobalProps(Toggle, 'Toggle');
143
-
144
- export default ToggleWithGlobalProps;
@@ -1 +0,0 @@
1
- export { default as Toggle } from './Toggle';