@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.
- package/README.md +3 -6
- package/dist/react-ui.css +16 -16
- package/dist/react-ui.d.ts +1936 -0
- package/dist/react-ui.development.css +3591 -3003
- package/dist/react-ui.development.js +2028 -1060
- package/dist/react-ui.js +1 -1
- package/package.json +74 -70
- package/src/components/Alert/{Alert.jsx → Alert.tsx} +8 -43
- package/src/components/Alert/Alert.types.ts +34 -0
- package/src/components/Alert/README.md +1 -1
- package/src/components/Alert/index.ts +2 -0
- package/src/components/Badge/Badge.tsx +30 -0
- package/src/components/Badge/Badge.types.ts +24 -0
- package/src/components/Badge/README.md +1 -1
- package/src/components/Badge/index.ts +5 -0
- package/src/components/Button/Button.tsx +110 -0
- package/src/components/Button/Button.types.ts +93 -0
- package/src/components/Button/README.md +1 -1
- package/src/components/Button/helpers/{getRootLabelVisibilityClassName.js → getRootLabelVisibilityClassName.ts} +5 -2
- package/src/components/Button/index.ts +6 -0
- package/src/components/ButtonGroup/{ButtonGroup.jsx → ButtonGroup.tsx} +9 -40
- package/src/components/ButtonGroup/ButtonGroup.types.ts +45 -0
- package/src/components/ButtonGroup/ButtonGroupContext.ts +4 -0
- package/src/components/ButtonGroup/README.md +1 -1
- package/src/components/ButtonGroup/{index.js → index.ts} +4 -0
- package/src/components/Card/Card.tsx +33 -0
- package/src/components/Card/Card.types.ts +46 -0
- package/src/components/Card/{CardBody.jsx → CardBody.tsx} +4 -11
- package/src/components/Card/{CardFooter.jsx → CardFooter.tsx} +4 -15
- package/src/components/Card/README.md +6 -7
- package/src/components/Card/{index.js → index.ts} +5 -0
- package/src/components/CheckboxField/CheckboxField.module.scss +7 -3
- package/src/components/CheckboxField/CheckboxField.tsx +81 -0
- package/src/components/CheckboxField/CheckboxField.types.ts +64 -0
- package/src/components/CheckboxField/README.md +92 -45
- package/src/components/CheckboxField/index.ts +5 -0
- package/src/components/FileInputField/FileInputField.module.scss +7 -3
- package/src/components/FileInputField/{FileInputField.jsx → FileInputField.tsx} +43 -129
- package/src/components/FileInputField/FileInputField.types.ts +101 -0
- package/src/components/FileInputField/README.md +21 -4
- package/src/components/FileInputField/index.ts +6 -0
- package/src/components/FormLayout/FormLayout.module.scss +5 -7
- package/src/components/FormLayout/{FormLayout.jsx → FormLayout.tsx} +15 -50
- package/src/components/FormLayout/FormLayout.types.ts +55 -0
- package/src/components/FormLayout/FormLayoutContext.ts +4 -0
- package/src/components/FormLayout/FormLayoutCustomField.module.scss +7 -3
- package/src/components/FormLayout/{FormLayoutCustomField.jsx → FormLayoutCustomField.tsx} +12 -67
- package/src/components/FormLayout/FormLayoutCustomField.types.ts +60 -0
- package/src/components/FormLayout/FormLayoutCustomFieldContext.ts +4 -0
- package/src/components/FormLayout/README.md +6 -15
- package/src/components/FormLayout/index.ts +14 -0
- package/src/components/Grid/Grid.module.scss +1 -1
- package/src/components/Grid/Grid.tsx +50 -0
- package/src/components/Grid/Grid.types.ts +108 -0
- package/src/components/Grid/GridSpan.tsx +36 -0
- package/src/components/Grid/README.md +2 -2
- package/src/components/Grid/_helpers/generateResponsiveCustomProperties.ts +33 -0
- package/src/components/Grid/index.ts +9 -0
- package/src/components/InputGroup/InputGroup.module.scss +7 -3
- package/src/components/InputGroup/{InputGroup.jsx → InputGroup.tsx} +25 -95
- package/src/components/InputGroup/InputGroup.types.ts +80 -0
- package/src/components/InputGroup/InputGroupContext.ts +4 -0
- package/src/components/InputGroup/README.md +40 -8
- package/src/components/InputGroup/{index.js → index.ts} +4 -0
- package/src/components/Modal/Modal.tsx +172 -0
- package/src/components/Modal/Modal.types.ts +181 -0
- package/src/components/Modal/ModalBody.tsx +34 -0
- package/src/components/Modal/{ModalCloseButton.jsx → ModalCloseButton.tsx} +6 -19
- package/src/components/Modal/{ModalContent.jsx → ModalContent.tsx} +4 -15
- package/src/components/Modal/ModalFooter.tsx +27 -0
- package/src/components/Modal/ModalHeader.tsx +27 -0
- package/src/components/Modal/ModalTitle.tsx +29 -0
- package/src/components/Modal/README.md +9 -9
- package/src/components/Modal/_helpers/{dialogOnCancelHandler.js → dialogOnCancelHandler.ts} +11 -1
- package/src/components/Modal/_helpers/{dialogOnClickHandler.js → dialogOnClickHandler.ts} +13 -7
- package/src/components/Modal/_helpers/{dialogOnCloseHandler.js → dialogOnCloseHandler.ts} +11 -1
- package/src/components/Modal/_helpers/{dialogOnKeyDownHandler.js → dialogOnKeyDownHandler.ts} +19 -6
- package/src/components/Modal/_helpers/{getJustifyClassName.js → getJustifyClassName.ts} +4 -1
- package/src/components/Modal/_helpers/getPositionClassName.ts +10 -0
- package/src/components/Modal/_helpers/getScrollingClassName.ts +14 -0
- package/src/components/Modal/_helpers/{getSizeClassName.js → getSizeClassName.ts} +4 -1
- package/src/components/Modal/_hooks/{useModalFocus.js → useModalFocus.ts} +9 -5
- package/src/components/Modal/_hooks/{useModalScrollPrevention.js → useModalScrollPrevention.ts} +4 -1
- package/src/components/Modal/{index.js → index.ts} +14 -0
- package/src/components/Paper/{Paper.jsx → Paper.tsx} +6 -26
- package/src/components/Paper/Paper.types.ts +19 -0
- package/src/components/Paper/README.md +3 -4
- package/src/components/Paper/index.ts +2 -0
- package/src/components/Popover/Popover.module.scss +1 -1
- package/src/components/Popover/Popover.tsx +61 -0
- package/src/components/Popover/Popover.types.ts +75 -0
- package/src/components/Popover/PopoverWrapper.tsx +27 -0
- package/src/components/Popover/README.md +34 -22
- package/src/components/Popover/_helpers/{cleanPlacementStyle.js → cleanPlacementStyle.ts} +4 -1
- package/src/components/Popover/_helpers/{getRootAlignmentClassName.js → getRootAlignmentClassName.ts} +4 -1
- package/src/components/Popover/_helpers/{getRootSideClassName.js → getRootSideClassName.ts} +4 -1
- package/src/components/Popover/index.ts +8 -0
- package/src/components/Radio/README.md +125 -48
- package/src/components/Radio/Radio.module.scss +7 -3
- package/src/components/Radio/Radio.tsx +116 -0
- package/src/components/Radio/Radio.types.ts +91 -0
- package/src/components/Radio/index.ts +5 -0
- package/src/components/ScrollView/README.md +1 -1
- package/src/components/ScrollView/ScrollView.module.scss +5 -0
- package/src/components/ScrollView/{ScrollView.jsx → ScrollView.tsx} +55 -166
- package/src/components/ScrollView/ScrollView.types.ts +121 -0
- package/src/components/ScrollView/_helpers/getElementsPositionDifference.ts +17 -0
- package/src/components/ScrollView/_hooks/{useLoadResizeHook.js → useLoadResizeHook.ts} +14 -3
- package/src/components/ScrollView/_hooks/{useScrollPositionHook.js → useScrollPositionHook.ts} +11 -4
- package/src/components/ScrollView/index.ts +6 -0
- package/src/components/SelectField/README.md +137 -51
- package/src/components/SelectField/SelectField.module.scss +7 -3
- package/src/components/SelectField/SelectField.tsx +139 -0
- package/src/components/SelectField/SelectField.types.ts +121 -0
- package/src/components/SelectField/_components/Option/Option.tsx +19 -0
- package/src/components/SelectField/_components/Option/Option.types.ts +21 -0
- package/src/components/SelectField/_components/Option/index.ts +2 -0
- package/src/components/SelectField/index.ts +7 -0
- package/src/components/Table/README.md +1 -1
- package/src/components/Table/{Table.jsx → Table.tsx} +4 -43
- package/src/components/Table/Table.types.ts +51 -0
- package/src/components/Table/_components/TableBodyCell/TableBodyCell.tsx +20 -0
- package/src/components/Table/_components/TableBodyCell/TableBodyCell.types.ts +20 -0
- package/src/components/Table/_components/TableBodyCell/index.ts +2 -0
- package/src/components/Table/_components/TableHeaderCell/{TableHeaderCell.jsx → TableHeaderCell.tsx} +3 -34
- package/src/components/Table/_components/TableHeaderCell/TableHeaderCell.types.ts +20 -0
- package/src/components/Table/_components/TableHeaderCell/index.ts +2 -0
- package/src/components/Table/index.ts +8 -0
- package/src/components/Tabs/README.md +2 -2
- package/src/components/Tabs/{Tabs.jsx → Tabs.tsx} +4 -20
- package/src/components/Tabs/Tabs.types.ts +19 -0
- package/src/components/Tabs/TabsItem.tsx +49 -0
- package/src/components/Tabs/TabsItem.types.ts +42 -0
- package/src/components/Tabs/index.ts +4 -0
- package/src/components/Text/README.md +1 -1
- package/src/components/Text/Text.module.scss +5 -7
- package/src/components/Text/Text.tsx +46 -0
- package/src/components/Text/Text.types.ts +31 -0
- package/src/components/Text/_helpers/getRootClampClassName.ts +13 -0
- package/src/components/Text/_helpers/getRootHyphensClassName.ts +14 -0
- package/src/components/Text/_helpers/getRootWordWrappingClassName.ts +14 -0
- package/src/components/Text/index.ts +6 -0
- package/src/components/TextArea/README.md +35 -14
- package/src/components/TextArea/TextArea.module.scss +7 -3
- package/src/components/TextArea/TextArea.tsx +95 -0
- package/src/components/TextArea/TextArea.types.ts +76 -0
- package/src/components/TextArea/index.ts +5 -0
- package/src/components/TextField/README.md +35 -13
- package/src/components/TextField/TextField.module.scss +7 -3
- package/src/components/TextField/TextField.tsx +112 -0
- package/src/components/TextField/TextField.types.ts +95 -0
- package/src/components/TextField/index.ts +6 -0
- package/src/components/TextLink/README.md +2 -2
- package/src/components/TextLink/{TextLink.jsx → TextLink.tsx} +4 -15
- package/src/components/TextLink/TextLink.types.ts +12 -0
- package/src/components/TextLink/index.ts +2 -0
- package/src/components/Toggle/README.md +92 -45
- package/src/components/Toggle/Toggle.module.scss +7 -3
- package/src/components/Toggle/Toggle.tsx +82 -0
- package/src/components/Toggle/Toggle.types.ts +59 -0
- package/src/components/Toggle/index.ts +5 -0
- package/src/components/Toolbar/README.md +3 -3
- package/src/components/Toolbar/Toolbar.tsx +41 -0
- package/src/components/Toolbar/Toolbar.types.ts +74 -0
- package/src/components/Toolbar/ToolbarGroup.tsx +38 -0
- package/src/components/Toolbar/{ToolbarItem.jsx → ToolbarItem.tsx} +5 -21
- package/src/components/Toolbar/_helpers/{getAlignClassName.js → getAlignClassName.ts} +8 -1
- package/src/components/Toolbar/_helpers/{getJustifyClassName.js → getJustifyClassName.ts} +4 -1
- package/src/components/Toolbar/{index.js → index.ts} +7 -0
- package/src/components/_helpers/{getRootColorClassName.js → getRootColorClassName.ts} +7 -2
- package/src/components/_helpers/{getRootPriorityClassName.js → getRootPriorityClassName.ts} +7 -2
- package/src/components/_helpers/{getRootSizeClassName.js → getRootSizeClassName.ts} +7 -2
- package/src/components/_helpers/getRootStateClassName.ts +24 -0
- package/src/components/_helpers/resolveContextOrProp.ts +13 -0
- package/src/helpers/classNames/{classNames.js → classNames.ts} +2 -2
- package/src/helpers/isChildrenEmpty/isChildrenEmpty.ts +5 -0
- package/src/helpers/transferProps/transferProps.ts +50 -0
- package/src/helpers/transferProps/transferProps.types.ts +11 -0
- package/src/index.ts +211 -0
- package/src/providers/globalProps/GlobalProps.types.ts +30 -0
- package/src/providers/globalProps/GlobalPropsContext.ts +6 -0
- package/src/providers/globalProps/{GlobalPropsProvider.jsx → GlobalPropsProvider.tsx} +8 -15
- package/src/providers/globalProps/{index.js → index.ts} +4 -0
- package/src/providers/globalProps/withGlobalProps.tsx +36 -0
- package/src/providers/translations/Translations.types.ts +26 -0
- package/src/providers/translations/TranslationsContext.ts +7 -0
- package/src/providers/translations/{TranslationsProvider.jsx → TranslationsProvider.tsx} +8 -15
- package/src/providers/translations/{index.js → index.ts} +5 -0
- package/src/styles/settings/_form-fields.scss +2 -1
- package/src/styles/theme/_form-fields.scss +16 -11
- package/src/styles/theme-constants/_colors.scss +21 -0
- package/src/styles/tools/_accessibility.scss +2 -2
- package/src/styles/tools/form-fields/_box-field-layout.scss +5 -8
- package/src/styles/tools/form-fields/_inline-field-elements.scss +0 -7
- package/src/styles/tools/form-fields/_inline-field-layout.scss +0 -8
- package/src/styles/tools/form-fields/_variants.scss +7 -7
- package/src/theme.scss +37 -12
- package/src/translations/{en.js → en.ts} +3 -1
- package/src/types/breakpoints.ts +1 -0
- package/src/types/colors.ts +7 -0
- package/src/types/index.ts +13 -0
- package/src/types/labelPositions.ts +1 -0
- package/src/types/layouts.ts +1 -0
- package/src/types/modules.d.ts +16 -0
- package/src/types/priorities.ts +1 -0
- package/src/types/sizes.ts +1 -0
- package/src/types/states.ts +1 -0
- package/src/types/styles.ts +4 -0
- package/src/utils/mergeDeep.ts +34 -0
- package/src/utils/mergeDeep.types.ts +4 -0
- package/.claude/agents/code-reviewer.md +0 -122
- package/.claude/rules/code.md +0 -22
- package/.claude/rules/docs.md +0 -35
- package/.claude/rules/frontend.md +0 -72
- package/.claude/rules/git.md +0 -13
- package/.claude/rules/safety-guards.md +0 -9
- package/.claude/rules/styling.md +0 -32
- package/.claude/rules/testing.md +0 -59
- package/.claude/settings.json +0 -32
- package/.claude/skills/commit/SKILL.md +0 -54
- package/.devcontainer/devcontainer.json +0 -23
- package/.eslintrc-ts +0 -40
- package/.mcp.json +0 -8
- package/.nvmrc +0 -1
- package/CLAUDE.md +0 -82
- package/docker-compose.base.yml +0 -93
- package/docker-compose.yml.dist +0 -41
- package/jest.config-ts.js +0 -34
- package/opencode.json +0 -10
- package/playwright-ct.config.ts +0 -68
- package/scripts/auto-start-mkdocs.sh +0 -5
- package/scripts/auto-start-node.sh +0 -33
- package/scripts/mcps/chrome-host/README.md +0 -118
- package/scripts/mcps/chrome-host/cdp_proxy.py +0 -90
- package/scripts/mcps/chrome-host/mcp-entry.sh +0 -33
- package/scripts/mcps/chrome-host/mcp-launch.sh +0 -36
- package/scripts/mcps/chrome-host/mcp-setup.sh +0 -70
- package/scripts/mcps/chrome-host/start-host-chrome.sh +0 -267
- package/setup.sh +0 -107
- package/src/CNAME +0 -1
- package/src/components/Alert/index.js +0 -1
- package/src/components/Badge/Badge.jsx +0 -51
- package/src/components/Badge/index.js +0 -1
- package/src/components/Button/Button.jsx +0 -203
- package/src/components/Button/helpers/getRootPriorityClassName.js +0 -15
- package/src/components/Button/index.js +0 -1
- package/src/components/ButtonGroup/ButtonGroupContext.js +0 -3
- package/src/components/Card/Card.jsx +0 -67
- package/src/components/CheckboxField/CheckboxField.jsx +0 -144
- package/src/components/CheckboxField/index.js +0 -1
- package/src/components/FileInputField/index.js +0 -1
- package/src/components/FormLayout/FormLayoutContext.js +0 -3
- package/src/components/FormLayout/FormLayoutCustomFieldContext.js +0 -3
- package/src/components/FormLayout/index.js +0 -4
- package/src/components/Grid/Grid.jsx +0 -225
- package/src/components/Grid/GridSpan.jsx +0 -88
- package/src/components/Grid/_helpers/generateResponsiveCustomProperties.js +0 -22
- package/src/components/Grid/index.js +0 -2
- package/src/components/InputGroup/InputGroupContext.js +0 -3
- package/src/components/Modal/Modal.jsx +0 -262
- package/src/components/Modal/ModalBody.jsx +0 -60
- package/src/components/Modal/ModalFooter.jsx +0 -42
- package/src/components/Modal/ModalHeader.jsx +0 -42
- package/src/components/Modal/ModalTitle.jsx +0 -42
- package/src/components/Modal/_helpers/getPositionClassName.js +0 -7
- package/src/components/Modal/_helpers/getScrollingClassName.js +0 -11
- package/src/components/Paper/index.js +0 -1
- package/src/components/Popover/Popover.jsx +0 -124
- package/src/components/Popover/PopoverWrapper.jsx +0 -38
- package/src/components/Popover/index.js +0 -2
- package/src/components/Radio/Radio.jsx +0 -212
- package/src/components/Radio/index.js +0 -1
- package/src/components/ScrollView/_helpers/getElementsPositionDifference.js +0 -11
- package/src/components/ScrollView/index.js +0 -1
- package/src/components/SelectField/SelectField.jsx +0 -272
- package/src/components/SelectField/_components/Option/Option.jsx +0 -46
- package/src/components/SelectField/_components/Option/index.js +0 -1
- package/src/components/SelectField/index.js +0 -1
- package/src/components/Table/_components/TableBodyCell/TableBodyCell.jsx +0 -46
- package/src/components/Table/_components/TableBodyCell/index.js +0 -1
- package/src/components/Table/_components/TableHeaderCell/index.js +0 -1
- package/src/components/Table/index.js +0 -1
- package/src/components/Tabs/TabsItem.jsx +0 -91
- package/src/components/Tabs/index.js +0 -2
- package/src/components/Text/Text.jsx +0 -76
- package/src/components/Text/_helpers/getRootClampClassName.js +0 -11
- package/src/components/Text/_helpers/getRootHyphensClassName.js +0 -11
- package/src/components/Text/_helpers/getRootWordWrappingClassName.js +0 -11
- package/src/components/Text/index.js +0 -1
- package/src/components/TextArea/TextArea.jsx +0 -174
- package/src/components/TextArea/index.js +0 -1
- package/src/components/TextField/TextField.jsx +0 -208
- package/src/components/TextField/index.js +0 -1
- package/src/components/TextLink/index.js +0 -1
- package/src/components/Toggle/Toggle.jsx +0 -144
- package/src/components/Toggle/index.js +0 -1
- package/src/components/Toolbar/Toolbar.jsx +0 -76
- package/src/components/Toolbar/ToolbarGroup.jsx +0 -64
- package/src/components/_helpers/getRootValidationStateClassName.js +0 -15
- package/src/components/_helpers/resolveContextOrProp.js +0 -10
- package/src/helpers/isChildrenEmpty/isChildrenEmpty.js +0 -3
- package/src/helpers/transferProps/transferProps.js +0 -38
- package/src/index.js +0 -67
- package/src/providers/globalProps/GlobalPropsContext.jsx +0 -5
- package/src/providers/globalProps/withGlobalProps.jsx +0 -38
- package/src/providers/translations/TranslationsContext.jsx +0 -6
- package/src/utils/mergeDeep.js +0 -28
- package/tsconfig.json +0 -27
- /package/src/helpers/classNames/{index.js → index.ts} +0 -0
- /package/src/helpers/isChildrenEmpty/{index.js → index.ts} +0 -0
- /package/src/helpers/transferProps/{index.js → index.ts} +0 -0
|
@@ -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;
|
|
@@ -1,88 +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
|
-
export const GridSpan = ({
|
|
10
|
-
children,
|
|
11
|
-
columns,
|
|
12
|
-
rows,
|
|
13
|
-
tag: Tag,
|
|
14
|
-
...restProps
|
|
15
|
-
}) => {
|
|
16
|
-
if (isChildrenEmpty(children)) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return (
|
|
21
|
-
<Tag
|
|
22
|
-
{...transferProps(restProps)}
|
|
23
|
-
className={styles.span}
|
|
24
|
-
style={{
|
|
25
|
-
...generateResponsiveCustomProperties(columns, 'column-span'),
|
|
26
|
-
...generateResponsiveCustomProperties(rows, 'row-span'),
|
|
27
|
-
}}
|
|
28
|
-
>
|
|
29
|
-
{children}
|
|
30
|
-
</Tag>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/* Breakpoints are easier to work with when ordered according to their value, not name. */
|
|
35
|
-
/* eslint-disable sort-keys */
|
|
36
|
-
|
|
37
|
-
GridSpan.defaultProps = {
|
|
38
|
-
children: undefined,
|
|
39
|
-
columns: 1,
|
|
40
|
-
rows: 1,
|
|
41
|
-
tag: 'div',
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
GridSpan.propTypes = {
|
|
45
|
-
/**
|
|
46
|
-
* Items to be aligned in the grid. If none are provided nothing is rendered.
|
|
47
|
-
*/
|
|
48
|
-
children: PropTypes.node,
|
|
49
|
-
/**
|
|
50
|
-
* Number of columns to span.
|
|
51
|
-
*/
|
|
52
|
-
columns: PropTypes.oneOfType([
|
|
53
|
-
PropTypes.number,
|
|
54
|
-
PropTypes.shape({
|
|
55
|
-
xs: PropTypes.number,
|
|
56
|
-
sm: PropTypes.number,
|
|
57
|
-
md: PropTypes.number,
|
|
58
|
-
lg: PropTypes.number,
|
|
59
|
-
xl: PropTypes.number,
|
|
60
|
-
x2l: PropTypes.number,
|
|
61
|
-
x3l: PropTypes.number,
|
|
62
|
-
}),
|
|
63
|
-
]),
|
|
64
|
-
/**
|
|
65
|
-
* Number of rows to span.
|
|
66
|
-
*/
|
|
67
|
-
rows: PropTypes.oneOfType([
|
|
68
|
-
PropTypes.number,
|
|
69
|
-
PropTypes.shape({
|
|
70
|
-
xs: PropTypes.number,
|
|
71
|
-
sm: PropTypes.number,
|
|
72
|
-
md: PropTypes.number,
|
|
73
|
-
lg: PropTypes.number,
|
|
74
|
-
xl: PropTypes.number,
|
|
75
|
-
x2l: PropTypes.number,
|
|
76
|
-
x3l: PropTypes.number,
|
|
77
|
-
}),
|
|
78
|
-
]),
|
|
79
|
-
/**
|
|
80
|
-
* HTML tag to render. Can be any valid HTML tag of your choice, usually a
|
|
81
|
-
* [block-level element](https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements).
|
|
82
|
-
*/
|
|
83
|
-
tag: PropTypes.string,
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
export const GridSpanWithGlobalProps = withGlobalProps(GridSpan, 'GridSpan');
|
|
87
|
-
|
|
88
|
-
export default GridSpanWithGlobalProps;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const prepareValueByType = (value, type) => {
|
|
2
|
-
if (type === 'spacing') {
|
|
3
|
-
return `var(--rui-dimension-space-${value})`;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
return value;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const generateResponsiveCustomProperties = (prop, infix, type = null) => {
|
|
10
|
-
if (typeof prop === 'undefined') {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (typeof prop !== 'object') {
|
|
15
|
-
return { [`--rui-local-${infix}-xs`]: prepareValueByType(prop, type) };
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return Object.keys(prop).reduce((acc, breakpoint) => ({
|
|
19
|
-
...acc,
|
|
20
|
-
[`--rui-local-${infix}-${breakpoint}`]: prepareValueByType(prop[breakpoint], type),
|
|
21
|
-
}), {});
|
|
22
|
-
};
|
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React, {
|
|
3
|
-
useCallback,
|
|
4
|
-
useEffect,
|
|
5
|
-
useImperativeHandle,
|
|
6
|
-
useRef,
|
|
7
|
-
} from 'react';
|
|
8
|
-
import { createPortal } from 'react-dom';
|
|
9
|
-
import { classNames } from '../../helpers/classNames';
|
|
10
|
-
import { transferProps } from '../../helpers/transferProps';
|
|
11
|
-
import { withGlobalProps } from '../../providers/globalProps';
|
|
12
|
-
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
|
|
13
|
-
import { dialogOnCancelHandler } from './_helpers/dialogOnCancelHandler';
|
|
14
|
-
import { dialogOnClickHandler } from './_helpers/dialogOnClickHandler';
|
|
15
|
-
import { dialogOnCloseHandler } from './_helpers/dialogOnCloseHandler';
|
|
16
|
-
import { dialogOnKeyDownHandler } from './_helpers/dialogOnKeyDownHandler';
|
|
17
|
-
import { getPositionClassName } from './_helpers/getPositionClassName';
|
|
18
|
-
import { getSizeClassName } from './_helpers/getSizeClassName';
|
|
19
|
-
import { useModalFocus } from './_hooks/useModalFocus';
|
|
20
|
-
import { useModalScrollPrevention } from './_hooks/useModalScrollPrevention';
|
|
21
|
-
import styles from './Modal.module.scss';
|
|
22
|
-
|
|
23
|
-
const preRender = (
|
|
24
|
-
children,
|
|
25
|
-
color,
|
|
26
|
-
dialogRef,
|
|
27
|
-
position,
|
|
28
|
-
size,
|
|
29
|
-
events,
|
|
30
|
-
restProps,
|
|
31
|
-
) => (
|
|
32
|
-
<dialog
|
|
33
|
-
{...transferProps(restProps)}
|
|
34
|
-
{...transferProps(events)}
|
|
35
|
-
className={classNames(
|
|
36
|
-
styles.root,
|
|
37
|
-
color && getRootColorClassName(color, styles),
|
|
38
|
-
getSizeClassName(size, styles),
|
|
39
|
-
getPositionClassName(position, styles),
|
|
40
|
-
)}
|
|
41
|
-
ref={dialogRef}
|
|
42
|
-
>
|
|
43
|
-
{children}
|
|
44
|
-
</dialog>
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
export const Modal = ({
|
|
48
|
-
allowCloseOnBackdropClick,
|
|
49
|
-
allowCloseOnEscapeKey,
|
|
50
|
-
allowPrimaryActionOnEnterKey,
|
|
51
|
-
autoFocus,
|
|
52
|
-
children,
|
|
53
|
-
closeButtonRef,
|
|
54
|
-
color,
|
|
55
|
-
dialogRef,
|
|
56
|
-
portalId,
|
|
57
|
-
position,
|
|
58
|
-
preventScrollUnderneath,
|
|
59
|
-
primaryButtonRef,
|
|
60
|
-
size,
|
|
61
|
-
...restProps
|
|
62
|
-
}) => {
|
|
63
|
-
const internalDialogRef = useRef();
|
|
64
|
-
const mouseDownTarget = useRef(null);
|
|
65
|
-
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
internalDialogRef.current.showModal();
|
|
68
|
-
}, []);
|
|
69
|
-
|
|
70
|
-
// We need to have a reference to the dialog element to be able to call its methods,
|
|
71
|
-
// but at the same time we want to expose this reference to the parent component for
|
|
72
|
-
// case someone wants to call dialog methods from outside the component.
|
|
73
|
-
useImperativeHandle(dialogRef, () => internalDialogRef.current);
|
|
74
|
-
|
|
75
|
-
useModalFocus(autoFocus, internalDialogRef, primaryButtonRef);
|
|
76
|
-
useModalScrollPrevention(preventScrollUnderneath);
|
|
77
|
-
|
|
78
|
-
const onCancel = useCallback(
|
|
79
|
-
(e) => {
|
|
80
|
-
if (e.target !== internalDialogRef.current) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
dialogOnCancelHandler(e, closeButtonRef, restProps.onCancel);
|
|
84
|
-
},
|
|
85
|
-
[closeButtonRef, restProps.onCancel],
|
|
86
|
-
);
|
|
87
|
-
const onClick = useCallback(
|
|
88
|
-
(e) => dialogOnClickHandler(
|
|
89
|
-
e,
|
|
90
|
-
closeButtonRef,
|
|
91
|
-
internalDialogRef,
|
|
92
|
-
allowCloseOnBackdropClick,
|
|
93
|
-
mouseDownTarget.current,
|
|
94
|
-
),
|
|
95
|
-
[allowCloseOnBackdropClick, closeButtonRef, internalDialogRef],
|
|
96
|
-
);
|
|
97
|
-
const onClose = useCallback(
|
|
98
|
-
(e) => dialogOnCloseHandler(e, closeButtonRef, restProps.onClose),
|
|
99
|
-
[closeButtonRef, restProps.onClose],
|
|
100
|
-
);
|
|
101
|
-
const onKeyDown = useCallback(
|
|
102
|
-
(e) => dialogOnKeyDownHandler(
|
|
103
|
-
e,
|
|
104
|
-
closeButtonRef,
|
|
105
|
-
primaryButtonRef,
|
|
106
|
-
allowCloseOnEscapeKey,
|
|
107
|
-
allowPrimaryActionOnEnterKey,
|
|
108
|
-
),
|
|
109
|
-
[
|
|
110
|
-
allowCloseOnEscapeKey,
|
|
111
|
-
allowPrimaryActionOnEnterKey,
|
|
112
|
-
closeButtonRef,
|
|
113
|
-
primaryButtonRef,
|
|
114
|
-
],
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
const onMouseDown = useCallback((e) => {
|
|
118
|
-
mouseDownTarget.current = e.target;
|
|
119
|
-
}, []);
|
|
120
|
-
|
|
121
|
-
const events = {
|
|
122
|
-
onCancel,
|
|
123
|
-
onClick,
|
|
124
|
-
onClose,
|
|
125
|
-
onKeyDown,
|
|
126
|
-
onMouseDown,
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
if (portalId === undefined) {
|
|
130
|
-
return preRender(
|
|
131
|
-
children,
|
|
132
|
-
color,
|
|
133
|
-
internalDialogRef,
|
|
134
|
-
position,
|
|
135
|
-
size,
|
|
136
|
-
events,
|
|
137
|
-
restProps,
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return createPortal(
|
|
142
|
-
preRender(
|
|
143
|
-
children,
|
|
144
|
-
color,
|
|
145
|
-
internalDialogRef,
|
|
146
|
-
position,
|
|
147
|
-
size,
|
|
148
|
-
events,
|
|
149
|
-
restProps,
|
|
150
|
-
),
|
|
151
|
-
document.getElementById(portalId),
|
|
152
|
-
);
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
Modal.defaultProps = {
|
|
156
|
-
allowCloseOnBackdropClick: true,
|
|
157
|
-
allowCloseOnEscapeKey: true,
|
|
158
|
-
allowPrimaryActionOnEnterKey: true,
|
|
159
|
-
autoFocus: true,
|
|
160
|
-
children: undefined,
|
|
161
|
-
closeButtonRef: undefined,
|
|
162
|
-
color: undefined,
|
|
163
|
-
dialogRef: undefined,
|
|
164
|
-
portalId: undefined,
|
|
165
|
-
position: 'center',
|
|
166
|
-
preventScrollUnderneath: window.document.body,
|
|
167
|
-
primaryButtonRef: undefined,
|
|
168
|
-
size: 'medium',
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
Modal.propTypes = {
|
|
172
|
-
/**
|
|
173
|
-
* If `true`, the `Modal` can be closed by clicking on the backdrop.
|
|
174
|
-
*/
|
|
175
|
-
allowCloseOnBackdropClick: PropTypes.bool,
|
|
176
|
-
/**
|
|
177
|
-
* If `true`, the `Modal` can be closed by pressing the Escape key.
|
|
178
|
-
*/
|
|
179
|
-
allowCloseOnEscapeKey: PropTypes.bool,
|
|
180
|
-
/**
|
|
181
|
-
* If `true`, the `Modal` can be submitted by pressing the Enter key.
|
|
182
|
-
*/
|
|
183
|
-
allowPrimaryActionOnEnterKey: PropTypes.bool,
|
|
184
|
-
/**
|
|
185
|
-
* If `true`, focus the first input element in the `Modal`, or primary button (referenced by the `primaryButtonRef`
|
|
186
|
-
* prop), or other focusable element when the `Modal` is opened. If there are none or `autoFocus` is set to `false`,
|
|
187
|
-
* focus the Modal itself.
|
|
188
|
-
*/
|
|
189
|
-
autoFocus: PropTypes.bool,
|
|
190
|
-
/**
|
|
191
|
-
* Nested elements. Supported types are:
|
|
192
|
-
*
|
|
193
|
-
* * `ModalHeader`
|
|
194
|
-
* * `ModalBody`
|
|
195
|
-
* * `ModalFooter`
|
|
196
|
-
*
|
|
197
|
-
* At least `ModalBody` is required.
|
|
198
|
-
*/
|
|
199
|
-
children: PropTypes.node,
|
|
200
|
-
/**
|
|
201
|
-
* Reference to close button element. It is used to close modal when Escape key is pressed
|
|
202
|
-
* or the backdrop is clicked.
|
|
203
|
-
*/
|
|
204
|
-
closeButtonRef: PropTypes.shape({
|
|
205
|
-
// eslint-disable-next-line react/forbid-prop-types
|
|
206
|
-
current: PropTypes.any,
|
|
207
|
-
}),
|
|
208
|
-
/**
|
|
209
|
-
* Color to clarify importance and meaning of the modal. Implements
|
|
210
|
-
* [Feedback color collection](/docs/foundation/collections#colors).
|
|
211
|
-
*/
|
|
212
|
-
color: PropTypes.oneOf(['success', 'warning', 'danger', 'help', 'info', 'note']),
|
|
213
|
-
/**
|
|
214
|
-
* Reference to dialog element
|
|
215
|
-
*/
|
|
216
|
-
dialogRef: PropTypes.shape({
|
|
217
|
-
// eslint-disable-next-line react/forbid-prop-types
|
|
218
|
-
current: PropTypes.any,
|
|
219
|
-
}),
|
|
220
|
-
/**
|
|
221
|
-
* If set, modal is rendered in the React Portal with that ID.
|
|
222
|
-
*/
|
|
223
|
-
portalId: PropTypes.string,
|
|
224
|
-
/**
|
|
225
|
-
* Vertical position of the modal inside browser window.
|
|
226
|
-
*/
|
|
227
|
-
position: PropTypes.oneOf(['top', 'center']),
|
|
228
|
-
/**
|
|
229
|
-
* Mode in which Modal prevents scroll of elements bellow:
|
|
230
|
-
* * `off` - Modal does not prevent any scroll
|
|
231
|
-
* * [HTMLElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement) - Modal prevents scroll on this HTML element
|
|
232
|
-
* * object
|
|
233
|
-
* * `reset` - method called on Modal's unmount to reset scroll prevention
|
|
234
|
-
* * `start` - method called on Modal's mount to custom scroll prevention
|
|
235
|
-
*/
|
|
236
|
-
preventScrollUnderneath: PropTypes.oneOfType([
|
|
237
|
-
PropTypes.oneOf([
|
|
238
|
-
HTMLElement,
|
|
239
|
-
'off',
|
|
240
|
-
]),
|
|
241
|
-
PropTypes.shape({
|
|
242
|
-
reset: PropTypes.func,
|
|
243
|
-
start: PropTypes.func,
|
|
244
|
-
}),
|
|
245
|
-
]),
|
|
246
|
-
/**
|
|
247
|
-
* Reference to primary button element. It is used to submit modal when Enter key is pressed and as fallback
|
|
248
|
-
* when `autoFocus` functionality does not find any input element to be focused.
|
|
249
|
-
*/
|
|
250
|
-
primaryButtonRef: PropTypes.shape({
|
|
251
|
-
// eslint-disable-next-line react/forbid-prop-types
|
|
252
|
-
current: PropTypes.any,
|
|
253
|
-
}),
|
|
254
|
-
/**
|
|
255
|
-
* Size of the modal.
|
|
256
|
-
*/
|
|
257
|
-
size: PropTypes.oneOf(['small', 'medium', 'large', 'fullscreen', 'auto']),
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
export const ModalWithGlobalProps = withGlobalProps(Modal, 'Modal');
|
|
261
|
-
|
|
262
|
-
export default ModalWithGlobalProps;
|
|
@@ -1,60 +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 { getScrollingClassName } from './_helpers/getScrollingClassName';
|
|
8
|
-
import styles from './ModalBody.module.scss';
|
|
9
|
-
|
|
10
|
-
export const ModalBody = ({
|
|
11
|
-
children,
|
|
12
|
-
scrolling,
|
|
13
|
-
...restProps
|
|
14
|
-
}) => {
|
|
15
|
-
if (isChildrenEmpty(children)) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<div
|
|
21
|
-
{...transferProps(restProps)}
|
|
22
|
-
className={classNames(
|
|
23
|
-
styles.root,
|
|
24
|
-
getScrollingClassName(scrolling, styles),
|
|
25
|
-
)}
|
|
26
|
-
>
|
|
27
|
-
{children}
|
|
28
|
-
</div>
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
ModalBody.defaultProps = {
|
|
33
|
-
children: undefined,
|
|
34
|
-
scrolling: 'auto',
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
ModalBody.propTypes = {
|
|
38
|
-
/**
|
|
39
|
-
* Nested elements. Supported types are:
|
|
40
|
-
*
|
|
41
|
-
* * `ModalContent`
|
|
42
|
-
* * `ScrollView` (`scrolling: 'custom'` must be set)
|
|
43
|
-
*
|
|
44
|
-
* You can also provide a custom component responsible for scrolling and displaying content correctly.
|
|
45
|
-
* At most one nested element is allowed. If none are provided nothing is rendered.
|
|
46
|
-
*/
|
|
47
|
-
children: PropTypes.node,
|
|
48
|
-
/**
|
|
49
|
-
* Scrolling mode:
|
|
50
|
-
*
|
|
51
|
-
* - `auto`: scrolling is enabled on ModalBody.
|
|
52
|
-
* - `custom`: use if providing a custom scrolling component, e.g. an instance of `ScrollView`.
|
|
53
|
-
* - `none`: scrolling is disabled on ModalBody and the entire Modal is scrollable instead.
|
|
54
|
-
*/
|
|
55
|
-
scrolling: PropTypes.oneOf(['auto', 'custom', 'none']),
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const ModalBodyWithGlobalProps = withGlobalProps(ModalBody, 'ModalBody');
|
|
59
|
-
|
|
60
|
-
export default ModalBodyWithGlobalProps;
|
|
@@ -1,42 +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 { getJustifyClassName } from './_helpers/getJustifyClassName';
|
|
7
|
-
import styles from './ModalFooter.module.scss';
|
|
8
|
-
|
|
9
|
-
export const ModalFooter = ({
|
|
10
|
-
children,
|
|
11
|
-
justify,
|
|
12
|
-
...restProps
|
|
13
|
-
}) => (
|
|
14
|
-
<div
|
|
15
|
-
{...transferProps(restProps)}
|
|
16
|
-
className={classNames(
|
|
17
|
-
styles.root,
|
|
18
|
-
getJustifyClassName(justify, styles),
|
|
19
|
-
)}
|
|
20
|
-
>
|
|
21
|
-
{children}
|
|
22
|
-
</div>
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
ModalFooter.defaultProps = {
|
|
26
|
-
justify: 'center',
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
ModalFooter.propTypes = {
|
|
30
|
-
/**
|
|
31
|
-
* Content of the footer (preferably nested `Button` elements).
|
|
32
|
-
*/
|
|
33
|
-
children: PropTypes.node.isRequired,
|
|
34
|
-
/**
|
|
35
|
-
* Horizontal alignment (distribution) of individual buttons.
|
|
36
|
-
*/
|
|
37
|
-
justify: PropTypes.oneOf(['start', 'center', 'end', 'space-between', 'stretch']),
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const ModalFooterWithGlobalProps = withGlobalProps(ModalFooter, 'ModalFooter');
|
|
41
|
-
|
|
42
|
-
export default ModalFooterWithGlobalProps;
|