@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,4 +1,3 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
1
|
import React, {
|
|
3
2
|
useMemo,
|
|
4
3
|
} from 'react';
|
|
@@ -9,15 +8,16 @@ import { getRootPriorityClassName } from '../_helpers/getRootPriorityClassName';
|
|
|
9
8
|
import { isChildrenEmpty } from '../../helpers/isChildrenEmpty/isChildrenEmpty';
|
|
10
9
|
import styles from './ButtonGroup.module.scss';
|
|
11
10
|
import { ButtonGroupContext } from './ButtonGroupContext';
|
|
11
|
+
import type { ButtonGroupProps } from './ButtonGroup.types';
|
|
12
12
|
|
|
13
|
-
export const ButtonGroup = ({
|
|
14
|
-
block,
|
|
15
|
-
disabled,
|
|
13
|
+
export const ButtonGroup: React.FunctionComponent<ButtonGroupProps> = ({
|
|
14
|
+
block = false,
|
|
15
|
+
disabled = false,
|
|
16
16
|
children,
|
|
17
|
-
priority,
|
|
18
|
-
size,
|
|
17
|
+
priority = 'filled',
|
|
18
|
+
size = 'medium',
|
|
19
19
|
...restProps
|
|
20
|
-
}) => {
|
|
20
|
+
}: ButtonGroupProps) => {
|
|
21
21
|
const childProps = useMemo(() => ({
|
|
22
22
|
block,
|
|
23
23
|
disabled,
|
|
@@ -35,7 +35,7 @@ export const ButtonGroup = ({
|
|
|
35
35
|
className={classNames(
|
|
36
36
|
styles.root,
|
|
37
37
|
block && styles.isRootBlock,
|
|
38
|
-
getRootPriorityClassName(
|
|
38
|
+
getRootPriorityClassName(styles, priority),
|
|
39
39
|
)}
|
|
40
40
|
disabled={disabled}
|
|
41
41
|
>
|
|
@@ -46,37 +46,6 @@ export const ButtonGroup = ({
|
|
|
46
46
|
);
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
block: false,
|
|
51
|
-
children: undefined,
|
|
52
|
-
disabled: false,
|
|
53
|
-
priority: 'filled',
|
|
54
|
-
size: 'medium',
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
ButtonGroup.propTypes = {
|
|
58
|
-
/**
|
|
59
|
-
* If `true`, the button group will span the full width of its parent.
|
|
60
|
-
*/
|
|
61
|
-
block: PropTypes.bool,
|
|
62
|
-
/**
|
|
63
|
-
* Buttons to be grouped. If none are provided nothing is rendered.
|
|
64
|
-
*/
|
|
65
|
-
children: PropTypes.node,
|
|
66
|
-
/**
|
|
67
|
-
* If `true`, all buttons inside the group will be disabled.
|
|
68
|
-
*/
|
|
69
|
-
disabled: PropTypes.bool,
|
|
70
|
-
/**
|
|
71
|
-
* Visual priority to highlight or suppress the buttons.
|
|
72
|
-
*/
|
|
73
|
-
priority: PropTypes.oneOf(['filled', 'outline', 'flat']),
|
|
74
|
-
/**
|
|
75
|
-
* Size of the buttons.
|
|
76
|
-
*/
|
|
77
|
-
size: PropTypes.oneOf(['small', 'medium', 'large']),
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const ButtonGroupWithGlobalProps = withGlobalProps(ButtonGroup, 'ButtonGroup');
|
|
49
|
+
export const ButtonGroupWithGlobalProps = withGlobalProps<ButtonGroupProps, never>(ButtonGroup, 'ButtonGroup');
|
|
81
50
|
|
|
82
51
|
export default ButtonGroupWithGlobalProps;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
FieldsetHTMLAttributes,
|
|
3
|
+
ReactNode,
|
|
4
|
+
} from 'react';
|
|
5
|
+
import type {
|
|
6
|
+
Priority,
|
|
7
|
+
Size,
|
|
8
|
+
} from '../../types';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Props of the `ButtonGroup` component.
|
|
12
|
+
*/
|
|
13
|
+
export type ButtonGroupProps = Omit<FieldsetHTMLAttributes<HTMLFieldSetElement>, 'disabled'> & {
|
|
14
|
+
/**
|
|
15
|
+
* If `true`, the button group will span the full width of its parent.
|
|
16
|
+
*/
|
|
17
|
+
block?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Buttons to be grouped. If none are provided nothing is rendered.
|
|
20
|
+
*/
|
|
21
|
+
children?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* If `true`, all buttons inside the group will be disabled.
|
|
24
|
+
*/
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Visual priority to highlight or suppress the buttons.
|
|
28
|
+
*/
|
|
29
|
+
priority?: Priority;
|
|
30
|
+
/**
|
|
31
|
+
* Size of the buttons.
|
|
32
|
+
*/
|
|
33
|
+
size?: Size;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Values `ButtonGroup` provides to the buttons rendered inside it.
|
|
38
|
+
*/
|
|
39
|
+
export type ButtonGroupContextValue = {
|
|
40
|
+
block: boolean;
|
|
41
|
+
disabled: boolean;
|
|
42
|
+
priority: Priority;
|
|
43
|
+
size: Size;
|
|
44
|
+
};
|
|
45
|
+
|
|
@@ -262,7 +262,7 @@ helps to improve its accessibility.
|
|
|
262
262
|
|
|
263
263
|
## API
|
|
264
264
|
|
|
265
|
-
<docoff-react-props src="/components/ButtonGroup/ButtonGroup.
|
|
265
|
+
<docoff-react-props src="/components/ButtonGroup/ButtonGroup.tsx" name="ButtonGroup"></docoff-react-props>
|
|
266
266
|
|
|
267
267
|
## Theming
|
|
268
268
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { withGlobalProps } from '../../providers/globalProps';
|
|
3
|
+
import { classNames } from '../../helpers/classNames/classNames';
|
|
4
|
+
import { transferProps } from '../../helpers/transferProps';
|
|
5
|
+
import { getRootColorClassName } from '../_helpers/getRootColorClassName';
|
|
6
|
+
import styles from './Card.module.scss';
|
|
7
|
+
import type { CardProps } from './Card.types';
|
|
8
|
+
|
|
9
|
+
export const Card: React.FunctionComponent<CardProps> = ({
|
|
10
|
+
children,
|
|
11
|
+
dense = false,
|
|
12
|
+
disabled = false,
|
|
13
|
+
raised = false,
|
|
14
|
+
color,
|
|
15
|
+
...restProps
|
|
16
|
+
}: CardProps) => (
|
|
17
|
+
<div
|
|
18
|
+
{...transferProps(restProps)}
|
|
19
|
+
className={classNames(
|
|
20
|
+
styles.root,
|
|
21
|
+
color && getRootColorClassName(styles, color),
|
|
22
|
+
dense && styles.isRootDense,
|
|
23
|
+
raised && styles.isRootRaised,
|
|
24
|
+
disabled && styles.isRootDisabled,
|
|
25
|
+
)}
|
|
26
|
+
>
|
|
27
|
+
{children}
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
export const CardWithGlobalProps = withGlobalProps<CardProps, never>(Card, 'Card');
|
|
32
|
+
|
|
33
|
+
export default CardWithGlobalProps;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
HTMLAttributes,
|
|
3
|
+
ReactNode,
|
|
4
|
+
} from 'react';
|
|
5
|
+
import type { FeedbackColor } from '../../types';
|
|
6
|
+
|
|
7
|
+
export type CardProps = Omit<HTMLAttributes<HTMLDivElement>, 'color'> & {
|
|
8
|
+
/**
|
|
9
|
+
* Slot for individual card elements that build up the inner layout:
|
|
10
|
+
* * `CardBody`
|
|
11
|
+
* * `CardFooter`
|
|
12
|
+
* * `ScrollView`
|
|
13
|
+
*/
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Color to clarify importance and meaning of the card. Implements
|
|
17
|
+
* [Feedback color collection](/docs/foundation/collections#colors).
|
|
18
|
+
*/
|
|
19
|
+
color?: FeedbackColor;
|
|
20
|
+
/**
|
|
21
|
+
* Make the card more compact.
|
|
22
|
+
*/
|
|
23
|
+
dense?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* If `true`, the card will be disabled.
|
|
26
|
+
*/
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Add shadow to pull the card above surface.
|
|
30
|
+
*/
|
|
31
|
+
raised?: boolean;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type CardBodyProps = HTMLAttributes<HTMLDivElement> & {
|
|
35
|
+
/**
|
|
36
|
+
* Content of the card.
|
|
37
|
+
*/
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type CardFooterProps = HTMLAttributes<HTMLDivElement> & {
|
|
42
|
+
/**
|
|
43
|
+
* Card actions, usually buttons.
|
|
44
|
+
*/
|
|
45
|
+
children?: ReactNode;
|
|
46
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { withGlobalProps } from '../../providers/globalProps';
|
|
4
3
|
import { transferProps } from '../../helpers/transferProps';
|
|
5
4
|
import styles from './Card.module.scss';
|
|
5
|
+
import type { CardBodyProps } from './Card.types';
|
|
6
6
|
|
|
7
|
-
export const CardBody = ({
|
|
7
|
+
export const CardBody: React.FunctionComponent<CardBodyProps> = ({
|
|
8
8
|
children,
|
|
9
9
|
...restProps
|
|
10
|
-
}) => (
|
|
10
|
+
}: CardBodyProps) => (
|
|
11
11
|
<div
|
|
12
12
|
{...transferProps(restProps)}
|
|
13
13
|
className={styles.body}
|
|
@@ -16,13 +16,6 @@ export const CardBody = ({
|
|
|
16
16
|
</div>
|
|
17
17
|
);
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Content of the card.
|
|
22
|
-
*/
|
|
23
|
-
children: PropTypes.node.isRequired,
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const CardBodyWithGlobalProps = withGlobalProps(CardBody, 'CardBody');
|
|
19
|
+
export const CardBodyWithGlobalProps = withGlobalProps<CardBodyProps, never>(CardBody, 'CardBody');
|
|
27
20
|
|
|
28
21
|
export default CardBodyWithGlobalProps;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
1
|
import React from 'react';
|
|
3
2
|
import { transferProps } from '../../helpers/transferProps';
|
|
4
3
|
import { withGlobalProps } from '../../providers/globalProps';
|
|
5
4
|
import { isChildrenEmpty } from '../../helpers/isChildrenEmpty/isChildrenEmpty';
|
|
6
5
|
import styles from './Card.module.scss';
|
|
6
|
+
import type { CardFooterProps } from './Card.types';
|
|
7
7
|
|
|
8
|
-
export const CardFooter = ({
|
|
8
|
+
export const CardFooter: React.FunctionComponent<CardFooterProps> = ({
|
|
9
9
|
children,
|
|
10
10
|
...restProps
|
|
11
|
-
}) => {
|
|
11
|
+
}: CardFooterProps) => {
|
|
12
12
|
if (isChildrenEmpty(children)) {
|
|
13
13
|
return null;
|
|
14
14
|
}
|
|
@@ -23,17 +23,6 @@ export const CardFooter = ({
|
|
|
23
23
|
);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
children: undefined,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
CardFooter.propTypes = {
|
|
31
|
-
/**
|
|
32
|
-
* Card actions, usually buttons.
|
|
33
|
-
*/
|
|
34
|
-
children: PropTypes.node,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export const CardFooterWithGlobalProps = withGlobalProps(CardFooter, 'CardFooter');
|
|
26
|
+
export const CardFooterWithGlobalProps = withGlobalProps<CardFooterProps, never>(CardFooter, 'CardFooter');
|
|
38
27
|
|
|
39
28
|
export default CardFooterWithGlobalProps;
|
|
@@ -25,10 +25,9 @@ See [API](#api) for all available options.
|
|
|
25
25
|
|
|
26
26
|
## General Guidelines
|
|
27
27
|
|
|
28
|
-
- Default card is **designed for non-white background.** You may want to
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
card stand out on white surfaces.
|
|
28
|
+
- Default card is **designed for non-white background.** You may want to use
|
|
29
|
+
the [raised variant](#raised-card) to make the card stand out on white
|
|
30
|
+
surfaces.
|
|
32
31
|
|
|
33
32
|
- Use optional [CardBody](#cardbody) and [CardFooter](#cardfooter) components to
|
|
34
33
|
provide your content with expected spacing.
|
|
@@ -269,21 +268,21 @@ helps to improve its accessibility.
|
|
|
269
268
|
|
|
270
269
|
## API
|
|
271
270
|
|
|
272
|
-
<docoff-react-props src="/components/Card/Card.
|
|
271
|
+
<docoff-react-props src="/components/Card/Card.tsx" name="Card"></docoff-react-props>
|
|
273
272
|
|
|
274
273
|
### CardBody
|
|
275
274
|
|
|
276
275
|
Space your content with CardBody. See [Composition](#composition) for
|
|
277
276
|
all details.
|
|
278
277
|
|
|
279
|
-
<docoff-react-props src="/components/Card/CardBody.
|
|
278
|
+
<docoff-react-props src="/components/Card/CardBody.tsx" name="CardBody"></docoff-react-props>
|
|
280
279
|
|
|
281
280
|
### CardFooter
|
|
282
281
|
|
|
283
282
|
Separate your card actions with CardFooter. See
|
|
284
283
|
[Composition](#composition) for all details.
|
|
285
284
|
|
|
286
|
-
<docoff-react-props src="/components/Card/CardFooter.
|
|
285
|
+
<docoff-react-props src="/components/Card/CardFooter.tsx" name="CardFooter"></docoff-react-props>
|
|
287
286
|
|
|
288
287
|
## Theming
|
|
289
288
|
|
|
@@ -35,16 +35,20 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// States
|
|
38
|
+
.isRootStateChanged {
|
|
39
|
+
@include variants.state(changed);
|
|
40
|
+
}
|
|
41
|
+
|
|
38
42
|
.isRootStateInvalid {
|
|
39
|
-
@include variants.
|
|
43
|
+
@include variants.state(invalid);
|
|
40
44
|
}
|
|
41
45
|
|
|
42
46
|
.isRootStateValid {
|
|
43
|
-
@include variants.
|
|
47
|
+
@include variants.state(valid);
|
|
44
48
|
}
|
|
45
49
|
|
|
46
50
|
.isRootStateWarning {
|
|
47
|
-
@include variants.
|
|
51
|
+
@include variants.state(warning);
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
// Invisible label
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { withGlobalProps } from '../../providers/globalProps';
|
|
3
|
+
import { classNames } from '../../helpers/classNames/classNames';
|
|
4
|
+
import { transferProps } from '../../helpers/transferProps';
|
|
5
|
+
import { getRootStateClassName } from '../_helpers/getRootStateClassName';
|
|
6
|
+
import { FormLayoutContext } from '../FormLayout/FormLayoutContext';
|
|
7
|
+
import styles from './CheckboxField.module.scss';
|
|
8
|
+
import type { CheckboxFieldProps } from './CheckboxField.types';
|
|
9
|
+
|
|
10
|
+
export const CheckboxField = React.forwardRef<HTMLInputElement, CheckboxFieldProps>(({
|
|
11
|
+
disabled = false,
|
|
12
|
+
helpText,
|
|
13
|
+
id,
|
|
14
|
+
isLabelVisible = true,
|
|
15
|
+
label,
|
|
16
|
+
labelPosition = 'after',
|
|
17
|
+
renderAsRequired = false,
|
|
18
|
+
required = false,
|
|
19
|
+
state,
|
|
20
|
+
validationText,
|
|
21
|
+
...restProps
|
|
22
|
+
}, ref) => {
|
|
23
|
+
const context = useContext(FormLayoutContext);
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<label
|
|
27
|
+
className={classNames(
|
|
28
|
+
styles.root,
|
|
29
|
+
context && styles.isRootInFormLayout,
|
|
30
|
+
context && context.layout === 'horizontal' ? styles.isRootLayoutHorizontal : styles.isRootLayoutVertical,
|
|
31
|
+
labelPosition === 'before' && styles.hasRootLabelBefore,
|
|
32
|
+
disabled && styles.isRootDisabled,
|
|
33
|
+
(renderAsRequired || required) && styles.isRootRequired,
|
|
34
|
+
getRootStateClassName(styles, state),
|
|
35
|
+
)}
|
|
36
|
+
htmlFor={id}
|
|
37
|
+
id={id && `${id}__label`}
|
|
38
|
+
>
|
|
39
|
+
<div className={styles.field}>
|
|
40
|
+
<div
|
|
41
|
+
className={classNames(
|
|
42
|
+
styles.label,
|
|
43
|
+
!isLabelVisible && styles.isLabelHidden,
|
|
44
|
+
)}
|
|
45
|
+
id={id && `${id}__labelText`}
|
|
46
|
+
>
|
|
47
|
+
{label}
|
|
48
|
+
</div>
|
|
49
|
+
<input
|
|
50
|
+
{...transferProps(restProps)}
|
|
51
|
+
className={styles.input}
|
|
52
|
+
disabled={disabled}
|
|
53
|
+
id={id}
|
|
54
|
+
ref={ref}
|
|
55
|
+
required={required}
|
|
56
|
+
type="checkbox"
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
{helpText && (
|
|
60
|
+
<div
|
|
61
|
+
className={styles.helpText}
|
|
62
|
+
id={id && `${id}__helpText`}
|
|
63
|
+
>
|
|
64
|
+
{helpText}
|
|
65
|
+
</div>
|
|
66
|
+
)}
|
|
67
|
+
{validationText && (
|
|
68
|
+
<div
|
|
69
|
+
className={styles.validationText}
|
|
70
|
+
id={id && `${id}__validationText`}
|
|
71
|
+
>
|
|
72
|
+
{validationText}
|
|
73
|
+
</div>
|
|
74
|
+
)}
|
|
75
|
+
</label>
|
|
76
|
+
);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export const CheckboxFieldWithGlobalProps = withGlobalProps<CheckboxFieldProps, HTMLInputElement>(CheckboxField, 'CheckboxField');
|
|
80
|
+
|
|
81
|
+
export default CheckboxFieldWithGlobalProps;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
InputHTMLAttributes,
|
|
3
|
+
ReactNode,
|
|
4
|
+
} from 'react';
|
|
5
|
+
import type {
|
|
6
|
+
LabelPosition,
|
|
7
|
+
State,
|
|
8
|
+
} from '../../types';
|
|
9
|
+
|
|
10
|
+
export type CheckboxFieldLabelPosition = LabelPosition;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Props of the `CheckboxField` component.
|
|
14
|
+
*/
|
|
15
|
+
export type CheckboxFieldProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> & {
|
|
16
|
+
/**
|
|
17
|
+
* If `true`, the input will be disabled.
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Optional help text.
|
|
22
|
+
*/
|
|
23
|
+
helpText?: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* ID of the `<input>` HTML element.
|
|
26
|
+
*
|
|
27
|
+
* Also serves as base for ids of nested elements:
|
|
28
|
+
* * `<ID>__label`
|
|
29
|
+
* * `<ID>__labelText`
|
|
30
|
+
* * `<ID>__helpText`
|
|
31
|
+
* * `<ID>__validationText`
|
|
32
|
+
*/
|
|
33
|
+
id?: string;
|
|
34
|
+
/**
|
|
35
|
+
* If `false`, the label will be visually hidden (but remains accessible by assistive
|
|
36
|
+
* technologies).
|
|
37
|
+
*/
|
|
38
|
+
isLabelVisible?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Checkbox field label.
|
|
41
|
+
*/
|
|
42
|
+
label: ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* Placement of the label relative to the input.
|
|
45
|
+
*/
|
|
46
|
+
labelPosition?: CheckboxFieldLabelPosition;
|
|
47
|
+
/**
|
|
48
|
+
* If `true`, the input will be rendered as if it was required.
|
|
49
|
+
*/
|
|
50
|
+
renderAsRequired?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* If `true`, the input will be made and rendered as required, regardless of the `renderAsRequired` prop.
|
|
53
|
+
*/
|
|
54
|
+
required?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Alter the field to reflect the state of its data, e.g. a validation result or a change
|
|
57
|
+
* against the saved value.
|
|
58
|
+
*/
|
|
59
|
+
state?: State;
|
|
60
|
+
/**
|
|
61
|
+
* Validation message to be displayed.
|
|
62
|
+
*/
|
|
63
|
+
validationText?: ReactNode;
|
|
64
|
+
};
|