@react-ui-org/react-ui 0.64.1 → 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 (292) 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/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} +4 -1
  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.tsx +81 -0
  33. package/src/components/CheckboxField/CheckboxField.types.ts +63 -0
  34. package/src/components/CheckboxField/README.md +67 -42
  35. package/src/components/CheckboxField/index.ts +5 -0
  36. package/src/components/FileInputField/{FileInputField.jsx → FileInputField.tsx} +42 -128
  37. package/src/components/FileInputField/FileInputField.types.ts +100 -0
  38. package/src/components/FileInputField/README.md +1 -1
  39. package/src/components/FileInputField/index.ts +6 -0
  40. package/src/components/FormLayout/FormLayout.module.scss +1 -1
  41. package/src/components/FormLayout/{FormLayout.jsx → FormLayout.tsx} +15 -50
  42. package/src/components/FormLayout/FormLayout.types.ts +55 -0
  43. package/src/components/FormLayout/FormLayoutContext.ts +4 -0
  44. package/src/components/FormLayout/{FormLayoutCustomField.jsx → FormLayoutCustomField.tsx} +10 -65
  45. package/src/components/FormLayout/FormLayoutCustomField.types.ts +59 -0
  46. package/src/components/FormLayout/FormLayoutCustomFieldContext.ts +4 -0
  47. package/src/components/FormLayout/README.md +4 -6
  48. package/src/components/FormLayout/index.ts +14 -0
  49. package/src/components/Grid/Grid.module.scss +1 -1
  50. package/src/components/Grid/Grid.tsx +50 -0
  51. package/src/components/Grid/Grid.types.ts +108 -0
  52. package/src/components/Grid/GridSpan.tsx +36 -0
  53. package/src/components/Grid/README.md +2 -2
  54. package/src/components/Grid/_helpers/generateResponsiveCustomProperties.ts +32 -0
  55. package/src/components/Grid/index.ts +9 -0
  56. package/src/components/InputGroup/{InputGroup.jsx → InputGroup.tsx} +25 -89
  57. package/src/components/InputGroup/InputGroup.types.ts +80 -0
  58. package/src/components/InputGroup/InputGroupContext.ts +4 -0
  59. package/src/components/InputGroup/README.md +5 -1
  60. package/src/components/InputGroup/{index.js → index.ts} +4 -0
  61. package/src/components/Modal/Modal.tsx +172 -0
  62. package/src/components/Modal/Modal.types.ts +181 -0
  63. package/src/components/Modal/ModalBody.tsx +34 -0
  64. package/src/components/Modal/{ModalCloseButton.jsx → ModalCloseButton.tsx} +6 -19
  65. package/src/components/Modal/{ModalContent.jsx → ModalContent.tsx} +4 -15
  66. package/src/components/Modal/ModalFooter.tsx +27 -0
  67. package/src/components/Modal/ModalHeader.tsx +27 -0
  68. package/src/components/Modal/ModalTitle.tsx +29 -0
  69. package/src/components/Modal/README.md +9 -9
  70. package/src/components/Modal/_helpers/{dialogOnCancelHandler.js → dialogOnCancelHandler.ts} +11 -1
  71. package/src/components/Modal/_helpers/{dialogOnClickHandler.js → dialogOnClickHandler.ts} +13 -7
  72. package/src/components/Modal/_helpers/{dialogOnCloseHandler.js → dialogOnCloseHandler.ts} +11 -1
  73. package/src/components/Modal/_helpers/{dialogOnKeyDownHandler.js → dialogOnKeyDownHandler.ts} +19 -6
  74. package/src/components/Modal/_helpers/{getJustifyClassName.js → getJustifyClassName.ts} +4 -1
  75. package/src/components/Modal/_helpers/getPositionClassName.ts +10 -0
  76. package/src/components/Modal/_helpers/getScrollingClassName.ts +14 -0
  77. package/src/components/Modal/_helpers/{getSizeClassName.js → getSizeClassName.ts} +4 -1
  78. package/src/components/Modal/_hooks/{useModalFocus.js → useModalFocus.ts} +9 -5
  79. package/src/components/Modal/_hooks/{useModalScrollPrevention.js → useModalScrollPrevention.ts} +4 -1
  80. package/src/components/Modal/{index.js → index.ts} +14 -0
  81. package/src/components/Paper/{Paper.jsx → Paper.tsx} +6 -26
  82. package/src/components/Paper/Paper.types.ts +19 -0
  83. package/src/components/Paper/README.md +3 -4
  84. package/src/components/Paper/index.ts +2 -0
  85. package/src/components/Popover/Popover.module.scss +1 -1
  86. package/src/components/Popover/Popover.tsx +61 -0
  87. package/src/components/Popover/Popover.types.ts +75 -0
  88. package/src/components/Popover/PopoverWrapper.tsx +27 -0
  89. package/src/components/Popover/README.md +34 -22
  90. package/src/components/Popover/_helpers/{cleanPlacementStyle.js → cleanPlacementStyle.ts} +4 -1
  91. package/src/components/Popover/_helpers/{getRootAlignmentClassName.js → getRootAlignmentClassName.ts} +4 -1
  92. package/src/components/Popover/_helpers/{getRootSideClassName.js → getRootSideClassName.ts} +4 -1
  93. package/src/components/Popover/index.ts +8 -0
  94. package/src/components/Radio/README.md +85 -45
  95. package/src/components/Radio/{Radio.jsx → Radio.tsx} +11 -107
  96. package/src/components/Radio/Radio.types.ts +90 -0
  97. package/src/components/Radio/index.ts +5 -0
  98. package/src/components/ScrollView/README.md +1 -1
  99. package/src/components/ScrollView/ScrollView.module.scss +5 -0
  100. package/src/components/ScrollView/{ScrollView.jsx → ScrollView.tsx} +55 -166
  101. package/src/components/ScrollView/ScrollView.types.ts +121 -0
  102. package/src/components/ScrollView/_helpers/getElementsPositionDifference.ts +17 -0
  103. package/src/components/ScrollView/_hooks/{useLoadResizeHook.js → useLoadResizeHook.ts} +14 -3
  104. package/src/components/ScrollView/_hooks/{useScrollPositionHook.js → useScrollPositionHook.ts} +11 -4
  105. package/src/components/ScrollView/index.ts +6 -0
  106. package/src/components/SelectField/README.md +84 -45
  107. package/src/components/SelectField/SelectField.tsx +139 -0
  108. package/src/components/SelectField/SelectField.types.ts +120 -0
  109. package/src/components/SelectField/_components/Option/Option.tsx +19 -0
  110. package/src/components/SelectField/_components/Option/Option.types.ts +21 -0
  111. package/src/components/SelectField/_components/Option/index.ts +2 -0
  112. package/src/components/SelectField/index.ts +7 -0
  113. package/src/components/Table/README.md +1 -1
  114. package/src/components/Table/{Table.jsx → Table.tsx} +4 -43
  115. package/src/components/Table/Table.types.ts +51 -0
  116. package/src/components/Table/_components/TableBodyCell/TableBodyCell.tsx +20 -0
  117. package/src/components/Table/_components/TableBodyCell/TableBodyCell.types.ts +20 -0
  118. package/src/components/Table/_components/TableBodyCell/index.ts +2 -0
  119. package/src/components/Table/_components/TableHeaderCell/{TableHeaderCell.jsx → TableHeaderCell.tsx} +3 -34
  120. package/src/components/Table/_components/TableHeaderCell/TableHeaderCell.types.ts +20 -0
  121. package/src/components/Table/_components/TableHeaderCell/index.ts +2 -0
  122. package/src/components/Table/index.ts +8 -0
  123. package/src/components/Tabs/README.md +2 -2
  124. package/src/components/Tabs/{Tabs.jsx → Tabs.tsx} +4 -20
  125. package/src/components/Tabs/Tabs.types.ts +19 -0
  126. package/src/components/Tabs/TabsItem.tsx +49 -0
  127. package/src/components/Tabs/TabsItem.types.ts +42 -0
  128. package/src/components/Tabs/index.ts +4 -0
  129. package/src/components/Text/README.md +1 -1
  130. package/src/components/Text/Text.module.scss +5 -7
  131. package/src/components/Text/Text.tsx +46 -0
  132. package/src/components/Text/Text.types.ts +31 -0
  133. package/src/components/Text/_helpers/getRootClampClassName.ts +13 -0
  134. package/src/components/Text/_helpers/getRootHyphensClassName.ts +14 -0
  135. package/src/components/Text/_helpers/getRootWordWrappingClassName.ts +14 -0
  136. package/src/components/Text/index.ts +6 -0
  137. package/src/components/TextArea/README.md +5 -8
  138. package/src/components/TextArea/TextArea.tsx +95 -0
  139. package/src/components/TextArea/TextArea.types.ts +75 -0
  140. package/src/components/TextArea/index.ts +5 -0
  141. package/src/components/TextField/README.md +5 -7
  142. package/src/components/TextField/TextField.tsx +112 -0
  143. package/src/components/TextField/TextField.types.ts +94 -0
  144. package/src/components/TextField/index.ts +6 -0
  145. package/src/components/TextLink/README.md +1 -1
  146. package/src/components/TextLink/{TextLink.jsx → TextLink.tsx} +4 -15
  147. package/src/components/TextLink/TextLink.types.ts +12 -0
  148. package/src/components/TextLink/index.ts +2 -0
  149. package/src/components/Toggle/README.md +67 -42
  150. package/src/components/Toggle/Toggle.tsx +82 -0
  151. package/src/components/Toggle/Toggle.types.ts +58 -0
  152. package/src/components/Toggle/index.ts +5 -0
  153. package/src/components/Toolbar/README.md +3 -3
  154. package/src/components/Toolbar/Toolbar.tsx +41 -0
  155. package/src/components/Toolbar/Toolbar.types.ts +74 -0
  156. package/src/components/Toolbar/ToolbarGroup.tsx +38 -0
  157. package/src/components/Toolbar/{ToolbarItem.jsx → ToolbarItem.tsx} +5 -21
  158. package/src/components/Toolbar/_helpers/{getAlignClassName.js → getAlignClassName.ts} +8 -1
  159. package/src/components/Toolbar/_helpers/{getJustifyClassName.js → getJustifyClassName.ts} +4 -1
  160. package/src/components/Toolbar/{index.js → index.ts} +7 -0
  161. package/src/components/_helpers/{getRootColorClassName.js → getRootColorClassName.ts} +6 -1
  162. package/src/components/_helpers/{getRootPriorityClassName.js → getRootPriorityClassName.ts} +6 -1
  163. package/src/components/_helpers/{getRootSizeClassName.js → getRootSizeClassName.ts} +6 -1
  164. package/src/components/_helpers/{getRootValidationStateClassName.js → getRootValidationStateClassName.ts} +6 -1
  165. package/src/components/_helpers/resolveContextOrProp.ts +13 -0
  166. package/src/helpers/classNames/{classNames.js → classNames.ts} +2 -2
  167. package/src/helpers/isChildrenEmpty/isChildrenEmpty.ts +5 -0
  168. package/src/helpers/transferProps/transferProps.ts +50 -0
  169. package/src/helpers/transferProps/transferProps.types.ts +11 -0
  170. package/src/index.ts +211 -0
  171. package/src/providers/globalProps/GlobalProps.types.ts +30 -0
  172. package/src/providers/globalProps/GlobalPropsContext.ts +6 -0
  173. package/src/providers/globalProps/{GlobalPropsProvider.jsx → GlobalPropsProvider.tsx} +8 -15
  174. package/src/providers/globalProps/{index.js → index.ts} +4 -0
  175. package/src/providers/globalProps/withGlobalProps.tsx +36 -0
  176. package/src/providers/translations/Translations.types.ts +26 -0
  177. package/src/providers/translations/TranslationsContext.ts +7 -0
  178. package/src/providers/translations/{TranslationsProvider.jsx → TranslationsProvider.tsx} +8 -15
  179. package/src/providers/translations/{index.js → index.ts} +5 -0
  180. package/src/styles/tools/_accessibility.scss +2 -2
  181. package/src/translations/{en.js → en.ts} +3 -1
  182. package/src/types/breakpoints.ts +1 -0
  183. package/src/types/colors.ts +7 -0
  184. package/src/types/index.ts +13 -0
  185. package/src/types/labelPositions.ts +1 -0
  186. package/src/types/layouts.ts +1 -0
  187. package/src/types/modules.d.ts +16 -0
  188. package/src/types/priorities.ts +1 -0
  189. package/src/types/sizes.ts +1 -0
  190. package/src/types/styles.ts +4 -0
  191. package/src/types/validationStates.ts +1 -0
  192. package/src/utils/mergeDeep.ts +34 -0
  193. package/src/utils/mergeDeep.types.ts +4 -0
  194. package/.claude/agents/code-reviewer.md +0 -122
  195. package/.claude/rules/code.md +0 -22
  196. package/.claude/rules/docs.md +0 -35
  197. package/.claude/rules/frontend.md +0 -72
  198. package/.claude/rules/git.md +0 -13
  199. package/.claude/rules/safety-guards.md +0 -9
  200. package/.claude/rules/styling.md +0 -32
  201. package/.claude/rules/testing.md +0 -59
  202. package/.claude/settings.json +0 -32
  203. package/.claude/skills/commit/SKILL.md +0 -54
  204. package/.devcontainer/devcontainer.json +0 -23
  205. package/.eslintrc-ts +0 -40
  206. package/.mcp.json +0 -8
  207. package/.nvmrc +0 -1
  208. package/CLAUDE.md +0 -82
  209. package/docker-compose.base.yml +0 -93
  210. package/docker-compose.yml.dist +0 -41
  211. package/jest.config-ts.js +0 -34
  212. package/opencode.json +0 -10
  213. package/playwright-ct.config.ts +0 -68
  214. package/scripts/auto-start-mkdocs.sh +0 -5
  215. package/scripts/auto-start-node.sh +0 -33
  216. package/scripts/mcps/chrome-host/README.md +0 -118
  217. package/scripts/mcps/chrome-host/cdp_proxy.py +0 -90
  218. package/scripts/mcps/chrome-host/mcp-entry.sh +0 -33
  219. package/scripts/mcps/chrome-host/mcp-launch.sh +0 -36
  220. package/scripts/mcps/chrome-host/mcp-setup.sh +0 -70
  221. package/scripts/mcps/chrome-host/start-host-chrome.sh +0 -267
  222. package/setup.sh +0 -107
  223. package/src/CNAME +0 -1
  224. package/src/components/Alert/index.js +0 -1
  225. package/src/components/Badge/Badge.jsx +0 -51
  226. package/src/components/Badge/index.js +0 -1
  227. package/src/components/Button/Button.jsx +0 -203
  228. package/src/components/Button/helpers/getRootPriorityClassName.js +0 -15
  229. package/src/components/Button/index.js +0 -1
  230. package/src/components/ButtonGroup/ButtonGroupContext.js +0 -3
  231. package/src/components/Card/Card.jsx +0 -67
  232. package/src/components/CheckboxField/CheckboxField.jsx +0 -144
  233. package/src/components/CheckboxField/index.js +0 -1
  234. package/src/components/FileInputField/index.js +0 -1
  235. package/src/components/FormLayout/FormLayoutContext.js +0 -3
  236. package/src/components/FormLayout/FormLayoutCustomFieldContext.js +0 -3
  237. package/src/components/FormLayout/index.js +0 -4
  238. package/src/components/Grid/Grid.jsx +0 -225
  239. package/src/components/Grid/GridSpan.jsx +0 -88
  240. package/src/components/Grid/_helpers/generateResponsiveCustomProperties.js +0 -22
  241. package/src/components/Grid/index.js +0 -2
  242. package/src/components/InputGroup/InputGroupContext.js +0 -3
  243. package/src/components/Modal/Modal.jsx +0 -262
  244. package/src/components/Modal/ModalBody.jsx +0 -60
  245. package/src/components/Modal/ModalFooter.jsx +0 -42
  246. package/src/components/Modal/ModalHeader.jsx +0 -42
  247. package/src/components/Modal/ModalTitle.jsx +0 -42
  248. package/src/components/Modal/_helpers/getPositionClassName.js +0 -7
  249. package/src/components/Modal/_helpers/getScrollingClassName.js +0 -11
  250. package/src/components/Paper/index.js +0 -1
  251. package/src/components/Popover/Popover.jsx +0 -124
  252. package/src/components/Popover/PopoverWrapper.jsx +0 -38
  253. package/src/components/Popover/index.js +0 -2
  254. package/src/components/Radio/index.js +0 -1
  255. package/src/components/ScrollView/_helpers/getElementsPositionDifference.js +0 -11
  256. package/src/components/ScrollView/index.js +0 -1
  257. package/src/components/SelectField/SelectField.jsx +0 -272
  258. package/src/components/SelectField/_components/Option/Option.jsx +0 -46
  259. package/src/components/SelectField/_components/Option/index.js +0 -1
  260. package/src/components/SelectField/index.js +0 -1
  261. package/src/components/Table/_components/TableBodyCell/TableBodyCell.jsx +0 -46
  262. package/src/components/Table/_components/TableBodyCell/index.js +0 -1
  263. package/src/components/Table/_components/TableHeaderCell/index.js +0 -1
  264. package/src/components/Table/index.js +0 -1
  265. package/src/components/Tabs/TabsItem.jsx +0 -91
  266. package/src/components/Tabs/index.js +0 -2
  267. package/src/components/Text/Text.jsx +0 -76
  268. package/src/components/Text/_helpers/getRootClampClassName.js +0 -11
  269. package/src/components/Text/_helpers/getRootHyphensClassName.js +0 -11
  270. package/src/components/Text/_helpers/getRootWordWrappingClassName.js +0 -11
  271. package/src/components/Text/index.js +0 -1
  272. package/src/components/TextArea/TextArea.jsx +0 -174
  273. package/src/components/TextArea/index.js +0 -1
  274. package/src/components/TextField/TextField.jsx +0 -208
  275. package/src/components/TextField/index.js +0 -1
  276. package/src/components/TextLink/index.js +0 -1
  277. package/src/components/Toggle/Toggle.jsx +0 -144
  278. package/src/components/Toggle/index.js +0 -1
  279. package/src/components/Toolbar/Toolbar.jsx +0 -76
  280. package/src/components/Toolbar/ToolbarGroup.jsx +0 -64
  281. package/src/components/_helpers/resolveContextOrProp.js +0 -10
  282. package/src/helpers/isChildrenEmpty/isChildrenEmpty.js +0 -3
  283. package/src/helpers/transferProps/transferProps.js +0 -38
  284. package/src/index.js +0 -67
  285. package/src/providers/globalProps/GlobalPropsContext.jsx +0 -5
  286. package/src/providers/globalProps/withGlobalProps.jsx +0 -38
  287. package/src/providers/translations/TranslationsContext.jsx +0 -6
  288. package/src/utils/mergeDeep.js +0 -28
  289. package/tsconfig.json +0 -27
  290. /package/src/helpers/classNames/{index.js → index.ts} +0 -0
  291. /package/src/helpers/isChildrenEmpty/{index.js → index.ts} +0 -0
  292. /package/src/helpers/transferProps/{index.js → index.ts} +0 -0
@@ -1,203 +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 { getRootColorClassName } from '../_helpers/getRootColorClassName';
7
- import { getRootPriorityClassName } from '../_helpers/getRootPriorityClassName';
8
- import { getRootSizeClassName } from '../_helpers/getRootSizeClassName';
9
- import { resolveContextOrProp } from '../_helpers/resolveContextOrProp';
10
- import { ButtonGroupContext } from '../ButtonGroup';
11
- import { FormLayoutContext } from '../FormLayout';
12
- import { InputGroupContext } from '../InputGroup/InputGroupContext';
13
- import getRootLabelVisibilityClassName from './helpers/getRootLabelVisibilityClassName';
14
- import styles from './Button.module.scss';
15
-
16
- export const Button = React.forwardRef((props, ref) => {
17
- const {
18
- afterLabel,
19
- beforeLabel,
20
- block,
21
- disabled,
22
- endCorner,
23
- feedbackIcon,
24
- id,
25
- label,
26
- labelVisibility,
27
- priority,
28
- size,
29
- startCorner,
30
- color,
31
- ...restProps
32
- } = props;
33
- const buttonGroupContext = useContext(ButtonGroupContext);
34
- const formLayoutContext = useContext(FormLayoutContext);
35
- const inputGroupContext = useContext(InputGroupContext);
36
-
37
- if (buttonGroupContext && inputGroupContext) {
38
- throw new Error('Button cannot be placed both in `ButtonGroup` and `InputGroup`.');
39
- }
40
-
41
- const primaryContext = buttonGroupContext ?? inputGroupContext;
42
-
43
- return (
44
- /* No worries, `type` is always assigned correctly through props. */
45
- /* eslint-disable react/button-has-type */
46
- <button
47
- {...transferProps(restProps)}
48
- className={classNames(
49
- styles.root,
50
- getRootPriorityClassName(
51
- resolveContextOrProp(buttonGroupContext && buttonGroupContext.priority, priority),
52
- styles,
53
- ),
54
- getRootColorClassName(color, styles),
55
- getRootSizeClassName(
56
- resolveContextOrProp(primaryContext && primaryContext.size, size),
57
- styles,
58
- ),
59
- getRootLabelVisibilityClassName(labelVisibility, styles),
60
- resolveContextOrProp(buttonGroupContext && buttonGroupContext.block, block) && styles.isRootBlock,
61
- buttonGroupContext && styles.isRootInButtonGroup,
62
- inputGroupContext && styles.isRootInInputGroup,
63
- formLayoutContext && styles.isRootInFormLayout,
64
- formLayoutContext && formLayoutContext.layout === 'horizontal' && styles.isRootLayoutHorizontal,
65
- feedbackIcon && styles.hasRootFeedback,
66
- )}
67
- disabled={resolveContextOrProp(primaryContext && primaryContext.disabled, disabled) || !!feedbackIcon}
68
- id={id}
69
- ref={ref}
70
- >
71
- {startCorner && (
72
- <span className={styles.startCorner}>
73
- {startCorner}
74
- </span>
75
- )}
76
- {beforeLabel && (
77
- <span className={styles.beforeLabel}>
78
- {beforeLabel}
79
- </span>
80
- )}
81
- <span
82
- className={styles.label}
83
- {...(id && { id: `${id}__labelText` })}
84
- >
85
- {label}
86
- </span>
87
- {afterLabel && (
88
- <span className={styles.afterLabel}>
89
- {afterLabel}
90
- </span>
91
- )}
92
- {endCorner && (
93
- <span className={styles.endCorner}>
94
- {endCorner}
95
- </span>
96
- )}
97
- {feedbackIcon && (
98
- <span className={styles.feedbackIcon}>
99
- {feedbackIcon}
100
- </span>
101
- )}
102
- </button>
103
- /* eslint-enable react/button-has-type */
104
- );
105
- });
106
-
107
- Button.defaultProps = {
108
- afterLabel: undefined,
109
- beforeLabel: undefined,
110
- block: false,
111
- color: 'primary',
112
- disabled: false,
113
- endCorner: undefined,
114
- feedbackIcon: undefined,
115
- id: undefined,
116
- labelVisibility: 'xs',
117
- priority: 'filled',
118
- size: 'medium',
119
- startCorner: undefined,
120
- type: 'button',
121
- };
122
-
123
- Button.propTypes = {
124
- /**
125
- * Element to be displayed after label, eg. an icon.
126
- */
127
- afterLabel: PropTypes.node,
128
- /**
129
- * Element to be displayed before label, eg. an icon.
130
- */
131
- beforeLabel: PropTypes.node,
132
- /**
133
- * If `true`, the button will span the full width of its parent.
134
- *
135
- * Ignored if the component is rendered within `ButtonGroup` component
136
- * as the value is inherited in such case.
137
- */
138
- block: PropTypes.bool,
139
- /**
140
- * Color variant to clarify importance and meaning of the alert. Implements
141
- * [Action, Feedback and Neutral color collections](/docs/foundation/collections#colors).
142
- */
143
- color: PropTypes.oneOf(
144
- ['primary', 'secondary', 'selected', 'success', 'warning', 'danger', 'help', 'info', 'note', 'light', 'dark'],
145
- ),
146
- /**
147
- * If `true`, the button will be disabled.
148
- *
149
- * Ignored if the component is rendered within `ButtonGroup` component
150
- * as the value is inherited in such case.
151
- */
152
- disabled: PropTypes.bool,
153
- /**
154
- * Element to be displayed in the top right corner.
155
- */
156
- endCorner: PropTypes.node,
157
- /**
158
- * Element to be displayed as a feedback icon on top of button label. When defined, it implies the
159
- * button is in feedback state.
160
- */
161
- feedbackIcon: PropTypes.node,
162
- /**
163
- * ID of the root HTML element.
164
- *
165
- * Also serves as base for ids of nested elements:
166
- * * `<ID>__labelText`
167
- */
168
- id: PropTypes.string,
169
- /**
170
- * Button label.
171
- */
172
- label: PropTypes.string.isRequired,
173
- /**
174
- * Defines minimum breakpoint from which the button label will be visible.
175
- */
176
- labelVisibility: PropTypes.oneOf(['xs', 'sm', 'md', 'lg', 'xl', 'x2l', 'x3l', 'none']),
177
- /**
178
- * Visual priority to highlight or suppress the button.
179
- *
180
- * Ignored if the component is rendered within `ButtonGroup` component
181
- * as the value is inherited in such case.
182
- */
183
- priority: PropTypes.oneOf(['filled', 'outline', 'flat']),
184
- /**
185
- * Size of the button.
186
- *
187
- * Ignored if the component is rendered within `ButtonGroup` or `InputGroup` component as the value is inherited in
188
- * such case.
189
- */
190
- size: PropTypes.oneOf(['small', 'medium', 'large']),
191
- /**
192
- * Element to be displayed in the top left corner.
193
- */
194
- startCorner: PropTypes.node,
195
- /**
196
- * Set the HTML `type` attribute of the `button` element.
197
- */
198
- type: PropTypes.oneOf(['button', 'submit']),
199
- };
200
-
201
- export const ButtonWithGlobalProps = withGlobalProps(Button, 'Button');
202
-
203
- export default ButtonWithGlobalProps;
@@ -1,15 +0,0 @@
1
- export default (priority, styles) => {
2
- if (priority === 'filled') {
3
- return styles.isRootPriorityFilled;
4
- }
5
-
6
- if (priority === 'outline') {
7
- return styles.isRootPriorityOutline;
8
- }
9
-
10
- if (priority === 'flat') {
11
- return styles.isRootPriorityFlat;
12
- }
13
-
14
- return null;
15
- };
@@ -1 +0,0 @@
1
- export { default as Button } from './Button';
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
-
3
- export const ButtonGroupContext = React.createContext(null);
@@ -1,67 +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 { getRootColorClassName } from '../_helpers/getRootColorClassName';
7
- import styles from './Card.module.scss';
8
-
9
- export const Card = ({
10
- children,
11
- dense,
12
- disabled,
13
- raised,
14
- color,
15
- ...restProps
16
- }) => (
17
- <div
18
- {...transferProps(restProps)}
19
- className={classNames(
20
- styles.root,
21
- color && getRootColorClassName(color, styles),
22
- dense && styles.isRootDense,
23
- raised && styles.isRootRaised,
24
- disabled && styles.isRootDisabled,
25
- )}
26
- >
27
- {children}
28
- </div>
29
- );
30
-
31
- Card.defaultProps = {
32
- color: undefined,
33
- dense: false,
34
- disabled: false,
35
- raised: false,
36
- };
37
-
38
- Card.propTypes = {
39
- /**
40
- * Slot for individual card elements that build up the inner layout:
41
- * * `CardBody`
42
- * * `CardFooter`
43
- * * `ScrollView`
44
- */
45
- children: PropTypes.node.isRequired,
46
- /**
47
- * Color to clarify importance and meaning of the card. Implements
48
- * [Feedback color collection](/docs/foundation/collections#colors).
49
- */
50
- color: PropTypes.oneOf(['success', 'warning', 'danger', 'help', 'info', 'note']),
51
- /**
52
- * Make the card more compact.
53
- */
54
- dense: PropTypes.bool,
55
- /**
56
- * If `true`, the card will be disabled.
57
- */
58
- disabled: PropTypes.bool,
59
- /**
60
- * Add shadow to pull the card above surface.
61
- */
62
- raised: PropTypes.bool,
63
- };
64
-
65
- export const CardWithGlobalProps = withGlobalProps(Card, 'Card');
66
-
67
- export default CardWithGlobalProps;
@@ -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 './CheckboxField.module.scss';
9
-
10
- export const CheckboxField = 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
- const context = useContext(FormLayoutContext);
25
-
26
- return (
27
- <label
28
- className={classNames(
29
- styles.root,
30
- context && styles.isRootInFormLayout,
31
- context && context.layout === 'horizontal' ? styles.isRootLayoutHorizontal : styles.isRootLayoutVertical,
32
- labelPosition === 'before' && styles.hasRootLabelBefore,
33
- disabled && styles.isRootDisabled,
34
- (renderAsRequired || required) && styles.isRootRequired,
35
- getRootValidationStateClassName(validationState, styles),
36
- )}
37
- htmlFor={id}
38
- id={id && `${id}__label`}
39
- >
40
- <div className={styles.field}>
41
- <div
42
- className={classNames(
43
- styles.label,
44
- !isLabelVisible && styles.isLabelHidden,
45
- )}
46
- id={id && `${id}__labelText`}
47
- >
48
- {label}
49
- </div>
50
- <input
51
- {...transferProps(restProps)}
52
- className={styles.input}
53
- disabled={disabled}
54
- id={id}
55
- ref={ref}
56
- required={required}
57
- type="checkbox"
58
- />
59
- </div>
60
- {helpText && (
61
- <div
62
- className={styles.helpText}
63
- id={id && `${id}__helpText`}
64
- >
65
- {helpText}
66
- </div>
67
- )}
68
- {validationText && (
69
- <div
70
- className={styles.validationText}
71
- id={id && `${id}__validationText`}
72
- >
73
- {validationText}
74
- </div>
75
- )}
76
- </label>
77
- );
78
- });
79
-
80
- CheckboxField.defaultProps = {
81
- disabled: false,
82
- helpText: undefined,
83
- id: undefined,
84
- isLabelVisible: true,
85
- labelPosition: 'after',
86
- renderAsRequired: false,
87
- required: false,
88
- validationState: undefined,
89
- validationText: undefined,
90
- };
91
-
92
- CheckboxField.propTypes = {
93
- /**
94
- * If `true`, the input will be disabled.
95
- */
96
- disabled: PropTypes.bool,
97
- /**
98
- * Optional help text.
99
- */
100
- helpText: PropTypes.node,
101
- /**
102
- * ID of the `<input>` HTML element.
103
- *
104
- * Also serves as base for ids of 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
- * Checkbox field 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 CheckboxFieldWithGlobalProps = withGlobalProps(CheckboxField, 'CheckboxField');
143
-
144
- export default CheckboxFieldWithGlobalProps;
@@ -1 +0,0 @@
1
- export { default as CheckboxField } from './CheckboxField';
@@ -1 +0,0 @@
1
- export { default as FileInputField } from './FileInputField';
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
-
3
- export const FormLayoutContext = React.createContext(null);
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
-
3
- export const FormLayoutCustomFieldContext = React.createContext(null);
@@ -1,4 +0,0 @@
1
- export { default as FormLayout } from './FormLayout';
2
- export { FormLayoutContext } from './FormLayoutContext';
3
- export { FormLayoutCustomFieldContext } from './FormLayoutCustomFieldContext';
4
- export { default as FormLayoutCustomField } from './FormLayoutCustomField';
@@ -1,225 +0,0 @@
1
- import PropTypes from 'prop-types';
2
- import React from 'react';
3
- import { withGlobalProps } from '../../providers/globalProps';
4
- import { transferProps } from '../../helpers/transferProps';
5
- import { isChildrenEmpty } from '../../helpers/isChildrenEmpty/isChildrenEmpty';
6
- import { generateResponsiveCustomProperties } from './_helpers/generateResponsiveCustomProperties';
7
- import styles from './Grid.module.scss';
8
-
9
- const SPACING_VALUES = [0, 1, 2, 3, 4, 5, 6, 7];
10
-
11
- export const Grid = ({
12
- alignContent,
13
- alignItems,
14
- autoFlow,
15
- children,
16
- columnGap,
17
- columns,
18
- justifyContent,
19
- justifyItems,
20
- rowGap,
21
- rows,
22
- tag: Tag,
23
- ...restProps
24
- }) => {
25
- if (isChildrenEmpty(children)) {
26
- return null;
27
- }
28
-
29
- return (
30
- <Tag
31
- {...transferProps(restProps)}
32
- className={styles.root}
33
- style={{
34
- ...generateResponsiveCustomProperties(columns, 'columns'),
35
- ...generateResponsiveCustomProperties(columnGap, 'column-gap', 'spacing'),
36
- ...generateResponsiveCustomProperties(rows, 'rows'),
37
- ...generateResponsiveCustomProperties(rowGap, 'row-gap', 'spacing'),
38
- ...generateResponsiveCustomProperties(autoFlow, 'auto-flow'),
39
- ...generateResponsiveCustomProperties(alignContent, 'align-content'),
40
- ...generateResponsiveCustomProperties(alignItems, 'align-items'),
41
- ...generateResponsiveCustomProperties(justifyContent, 'justify-content'),
42
- ...generateResponsiveCustomProperties(justifyItems, 'justify-items'),
43
- }}
44
- >
45
- {children}
46
- </Tag>
47
- );
48
- };
49
-
50
- /* Breakpoints are easier to work with when ordered according to their value, not name. */
51
- /* eslint-disable sort-keys */
52
-
53
- Grid.defaultProps = {
54
- alignContent: undefined,
55
- alignItems: undefined,
56
- autoFlow: undefined,
57
- children: undefined,
58
- columnGap: 4,
59
- columns: '1fr',
60
- justifyContent: undefined,
61
- justifyItems: undefined,
62
- rowGap: 4,
63
- rows: 'auto',
64
- tag: 'div',
65
- };
66
-
67
- Grid.propTypes = {
68
- /**
69
- * Content alignment. Accepts any valid value of `align-content` CSS property.
70
- * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/align-content) for more.
71
- */
72
- alignContent: PropTypes.oneOfType([
73
- PropTypes.string,
74
- PropTypes.shape({
75
- xs: PropTypes.string,
76
- sm: PropTypes.string,
77
- md: PropTypes.string,
78
- lg: PropTypes.string,
79
- xl: PropTypes.string,
80
- x2l: PropTypes.string,
81
- x3l: PropTypes.string,
82
- }),
83
- ]),
84
- /**
85
- * Items alignment. Accepts any valid value of `align-items` CSS property.
86
- * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items) for more.
87
- */
88
- alignItems: PropTypes.oneOfType([
89
- PropTypes.string,
90
- PropTypes.shape({
91
- xs: PropTypes.string,
92
- sm: PropTypes.string,
93
- md: PropTypes.string,
94
- lg: PropTypes.string,
95
- xl: PropTypes.string,
96
- x2l: PropTypes.string,
97
- x3l: PropTypes.string,
98
- }),
99
- ]),
100
- /**
101
- * Grid auto-flow algorithm to be used. Accepts any valid value of `grid-auto-flow` CSS property.
102
- * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow) for more.
103
- */
104
- autoFlow: PropTypes.oneOfType([
105
- PropTypes.string,
106
- PropTypes.shape({
107
- xs: PropTypes.string,
108
- sm: PropTypes.string,
109
- md: PropTypes.string,
110
- lg: PropTypes.string,
111
- xl: PropTypes.string,
112
- x2l: PropTypes.string,
113
- x3l: PropTypes.string,
114
- }),
115
- ]),
116
- /**
117
- * Items to be aligned in the grid. If none are provided nothing is rendered.
118
- */
119
- children: PropTypes.node,
120
- /**
121
- * Gap between columns. Accepts any of [spacing values](/docs/foundation/spacing-values) as number.
122
- * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/column-gap) for more about `column-gap`.
123
- */
124
- columnGap: PropTypes.oneOfType([
125
- PropTypes.oneOf(SPACING_VALUES),
126
- PropTypes.shape({
127
- xs: PropTypes.oneOf(SPACING_VALUES),
128
- sm: PropTypes.oneOf(SPACING_VALUES),
129
- md: PropTypes.oneOf(SPACING_VALUES),
130
- lg: PropTypes.oneOf(SPACING_VALUES),
131
- xl: PropTypes.oneOf(SPACING_VALUES),
132
- x2l: PropTypes.oneOf(SPACING_VALUES),
133
- x3l: PropTypes.oneOf(SPACING_VALUES),
134
- }),
135
- ]),
136
- /**
137
- * Grid columns. Accepts any valid value of `grid-template-columns` CSS property.
138
- * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns) for more.
139
- */
140
- columns: PropTypes.oneOfType([
141
- PropTypes.string,
142
- PropTypes.shape({
143
- xs: PropTypes.string,
144
- sm: PropTypes.string,
145
- md: PropTypes.string,
146
- lg: PropTypes.string,
147
- xl: PropTypes.string,
148
- x2l: PropTypes.string,
149
- x3l: PropTypes.string,
150
- }),
151
- ]),
152
- /**
153
- * Content justification. Accepts any valid value of `justify-content` CSS property.
154
- * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) for more.
155
- */
156
- justifyContent: PropTypes.oneOfType([
157
- PropTypes.string,
158
- PropTypes.shape({
159
- xs: PropTypes.string,
160
- sm: PropTypes.string,
161
- md: PropTypes.string,
162
- lg: PropTypes.string,
163
- xl: PropTypes.string,
164
- x2l: PropTypes.string,
165
- x3l: PropTypes.string,
166
- }),
167
- ]),
168
- /**
169
- * Items justification. Accepts any valid value of `justify-items` CSS property.
170
- * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items) for more.
171
- */
172
- justifyItems: PropTypes.oneOfType([
173
- PropTypes.string,
174
- PropTypes.shape({
175
- xs: PropTypes.string,
176
- sm: PropTypes.string,
177
- md: PropTypes.string,
178
- lg: PropTypes.string,
179
- xl: PropTypes.string,
180
- x2l: PropTypes.string,
181
- x3l: PropTypes.string,
182
- }),
183
- ]),
184
- /**
185
- * Gap between rows. Accepts any of [spacing values](/docs/foundation/spacing-values) as number.
186
- * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/row-gap) for more about `row-gap`.
187
- */
188
- rowGap: PropTypes.oneOfType([
189
- PropTypes.oneOf(SPACING_VALUES),
190
- PropTypes.shape({
191
- xs: PropTypes.oneOf(SPACING_VALUES),
192
- sm: PropTypes.oneOf(SPACING_VALUES),
193
- md: PropTypes.oneOf(SPACING_VALUES),
194
- lg: PropTypes.oneOf(SPACING_VALUES),
195
- xl: PropTypes.oneOf(SPACING_VALUES),
196
- x2l: PropTypes.oneOf(SPACING_VALUES),
197
- x3l: PropTypes.oneOf(SPACING_VALUES),
198
- }),
199
- ]),
200
- /**
201
- * Grid rows. Accepts any valid value of `grid-template-rows` CSS property.
202
- * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-rows) for more.
203
- */
204
- rows: PropTypes.oneOfType([
205
- PropTypes.string,
206
- PropTypes.shape({
207
- xs: PropTypes.string,
208
- sm: PropTypes.string,
209
- md: PropTypes.string,
210
- lg: PropTypes.string,
211
- xl: PropTypes.string,
212
- x2l: PropTypes.string,
213
- x3l: PropTypes.string,
214
- }),
215
- ]),
216
- /**
217
- * HTML tag to render. Can be any valid HTML tag of your choice, usually a
218
- * [block-level element](https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements).
219
- */
220
- tag: PropTypes.string,
221
- };
222
-
223
- export const GridWithGlobalProps = withGlobalProps(Grid, 'Grid');
224
-
225
- export default GridWithGlobalProps;