@onewelcome/react-lib-components 0.2.0 → 0.2.3
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/dist/Breadcrumbs/Breadcrumbs.d.ts +4 -4
- package/dist/Button/BaseButton.d.ts +4 -4
- package/dist/Button/Button.d.ts +3 -3
- package/dist/Button/IconButton.d.ts +4 -4
- package/dist/ContextMenu/ContextMenu.d.ts +5 -5
- package/dist/ContextMenu/ContextMenuItem.d.ts +2 -2
- package/dist/DataGrid/DataGrid.d.ts +6 -6
- package/dist/DataGrid/DataGridActions/DataGridActions.d.ts +4 -4
- package/dist/DataGrid/DataGridActions/DataGridColumnsToggle.d.ts +3 -3
- package/dist/DataGrid/DataGridBody/DataGridBody.d.ts +3 -3
- package/dist/DataGrid/DataGridBody/DataGridCell.d.ts +2 -2
- package/dist/DataGrid/DataGridBody/DataGridRow.d.ts +3 -3
- package/dist/DataGrid/DataGridHeader/DataGridHeader.d.ts +3 -3
- package/dist/DataGrid/DataGridHeader/DataGridHeaderCell.d.ts +3 -3
- package/dist/DataGrid/datagrid.interfaces.d.ts +1 -1
- package/dist/Form/Checkbox/Checkbox.d.ts +5 -5
- package/dist/Form/Fieldset/Fieldset.d.ts +3 -3
- package/dist/Form/Form.d.ts +1 -1
- package/dist/Form/FormControl/FormControl.d.ts +3 -3
- package/dist/Form/FormGroup/FormGroup.d.ts +5 -5
- package/dist/Form/FormHelperText/FormHelperText.d.ts +3 -3
- package/dist/Form/FormSelectorWrapper/FormSelectorWrapper.d.ts +6 -6
- package/dist/Form/Input/Input.d.ts +5 -5
- package/dist/Form/Label/Label.d.ts +2 -2
- package/dist/Form/Radio/Radio.d.ts +5 -5
- package/dist/Form/Select/Option.d.ts +2 -2
- package/dist/Form/Select/Select.d.ts +5 -5
- package/dist/Form/Textarea/Textarea.d.ts +6 -6
- package/dist/Form/Toggle/Toggle.d.ts +3 -3
- package/dist/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.d.ts +4 -4
- package/dist/Form/Wrapper/InputWrapper/InputWrapper.d.ts +4 -4
- package/dist/Form/Wrapper/RadioWrapper/RadioWrapper.d.ts +4 -4
- package/dist/Form/Wrapper/SelectWrapper/SelectWrapper.d.ts +4 -4
- package/dist/Form/Wrapper/TextareaWrapper/TextareaWrapper.d.ts +4 -4
- package/dist/Form/Wrapper/Wrapper/Wrapper.d.ts +6 -6
- package/dist/Form/form.interfaces.d.ts +1 -1
- package/dist/Icon/Icon.d.ts +3 -3
- package/dist/Link/Link.d.ts +7 -7
- package/dist/Notifications/BaseModal/BaseModal.d.ts +4 -4
- package/dist/Notifications/BaseModal/BaseModalActions/BaseModalActions.d.ts +2 -2
- package/dist/Notifications/BaseModal/BaseModalContent/BaseModalContent.d.ts +2 -2
- package/dist/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.d.ts +2 -2
- package/dist/Notifications/Dialog/Dialog.d.ts +5 -5
- package/dist/Notifications/Dialog/DialogActions/DialogActions.d.ts +3 -3
- package/dist/Notifications/Dialog/DialogTitle/DialogTitle.d.ts +2 -2
- package/dist/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.d.ts +3 -3
- package/dist/Notifications/DiscardChangesModal/DiscardChangesModal.d.ts +7 -7
- package/dist/Notifications/Modal/Modal.d.ts +1 -1
- package/dist/Notifications/Modal/ModalActions/ModalActions.d.ts +1 -1
- package/dist/Notifications/Modal/ModalContent/ModalContent.d.ts +1 -1
- package/dist/Notifications/Modal/ModalHeader/ModalHeader.d.ts +1 -1
- package/dist/Notifications/SlideInModal/SlideInModal.d.ts +3 -3
- package/dist/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.d.ts +3 -3
- package/dist/Notifications/Snackbar/SnackbarItem/SnackbarItem.d.ts +2 -2
- package/dist/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.d.ts +3 -3
- package/dist/Notifications/Snackbar/SnackbarProvider/SnackbarStateProvider.d.ts +2 -2
- package/dist/Notifications/Snackbar/interfaces.d.ts +2 -2
- package/dist/Pagination/Pagination.d.ts +3 -3
- package/dist/Popover/Popover.d.ts +3 -3
- package/dist/Skeleton/Skeleton.d.ts +3 -3
- package/dist/StatusIndicator/StatusIndicator.d.ts +5 -5
- package/dist/Tabs/Tab.d.ts +1 -1
- package/dist/Tabs/TabButton.d.ts +2 -2
- package/dist/Tabs/TabPanel.d.ts +2 -2
- package/dist/Tabs/Tabs.d.ts +4 -4
- package/dist/TextEllipsis/TextEllipsis.d.ts +2 -2
- package/dist/Tiles/Tile.d.ts +5 -5
- package/dist/Tiles/Tiles.d.ts +2 -2
- package/dist/Tooltip/Tooltip.d.ts +3 -3
- package/dist/Typography/Typography.d.ts +3 -3
- package/dist/Wizard/BaseWizardSteps/BaseWizardSteps.d.ts +2 -2
- package/dist/Wizard/Wizard.d.ts +3 -3
- package/dist/Wizard/WizardActions/WizardActions.d.ts +2 -2
- package/dist/Wizard/WizardStateProvider.d.ts +2 -2
- package/dist/Wizard/WizardSteps/WizardSteps.d.ts +2 -2
- package/dist/Wizard/wizardStateReducer.d.ts +5 -5
- package/dist/_BaseStyling_/BaseStyling.d.ts +1 -1
- package/dist/hooks/usePosition.d.ts +4 -4
- package/dist/hooks/useRepeater.d.ts +1 -1
- package/dist/hooks/useScroll.d.ts +1 -1
- package/dist/hooks/useSpacing.d.ts +1 -1
- package/dist/hooks/useWrapper.d.ts +1 -1
- package/dist/index.d.ts +55 -55
- package/dist/react-lib-components.cjs.development.js +676 -578
- package/dist/react-lib-components.cjs.development.js.map +1 -1
- package/dist/react-lib-components.cjs.production.min.js +1 -1
- package/dist/react-lib-components.cjs.production.min.js.map +1 -1
- package/dist/react-lib-components.esm.js +676 -578
- package/dist/react-lib-components.esm.js.map +1 -1
- package/package.json +27 -16
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +15 -15
- package/src/Breadcrumbs/Breadcrumbs.tsx +11 -11
- package/src/Button/BaseButton.module.scss +1 -1
- package/src/Button/BaseButton.test.tsx +27 -27
- package/src/Button/BaseButton.tsx +8 -8
- package/src/Button/Button.module.scss +5 -5
- package/src/Button/Button.test.tsx +39 -39
- package/src/Button/Button.tsx +10 -10
- package/src/Button/IconButton.module.scss +5 -5
- package/src/Button/IconButton.test.tsx +29 -29
- package/src/Button/IconButton.tsx +11 -11
- package/src/ContextMenu/ContextMenu.test.tsx +97 -76
- package/src/ContextMenu/ContextMenu.tsx +48 -42
- package/src/ContextMenu/ContextMenuItem.module.scss +1 -1
- package/src/ContextMenu/ContextMenuItem.tsx +7 -5
- package/src/DataGrid/DataGrid.test.tsx +193 -193
- package/src/DataGrid/DataGrid.tsx +26 -26
- package/src/DataGrid/DataGridActions/DataGridActions.test.tsx +63 -63
- package/src/DataGrid/DataGridActions/DataGridActions.tsx +15 -15
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.module.scss +1 -1
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.test.tsx +21 -21
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.tsx +20 -20
- package/src/DataGrid/DataGridBody/DataGridBody.test.tsx +40 -40
- package/src/DataGrid/DataGridBody/DataGridBody.tsx +10 -10
- package/src/DataGrid/DataGridBody/DataGridCell.module.scss +1 -1
- package/src/DataGrid/DataGridBody/DataGridCell.test.tsx +25 -25
- package/src/DataGrid/DataGridBody/DataGridCell.tsx +6 -6
- package/src/DataGrid/DataGridBody/DataGridRow.test.tsx +38 -38
- package/src/DataGrid/DataGridBody/DataGridRow.tsx +8 -8
- package/src/DataGrid/DataGridHeader/DataGridHeader.module.scss +1 -2
- package/src/DataGrid/DataGridHeader/DataGridHeader.test.tsx +119 -119
- package/src/DataGrid/DataGridHeader/DataGridHeader.tsx +13 -13
- package/src/DataGrid/DataGridHeader/DataGridHeaderCell.module.scss +2 -0
- package/src/DataGrid/DataGridHeader/DataGridHeaderCell.test.tsx +51 -51
- package/src/DataGrid/DataGridHeader/DataGridHeaderCell.tsx +14 -14
- package/src/DataGrid/datagrid.interfaces.ts +1 -1
- package/src/Form/Checkbox/Checkbox.test.tsx +74 -74
- package/src/Form/Checkbox/Checkbox.tsx +27 -27
- package/src/Form/Fieldset/Fieldset.module.scss +1 -1
- package/src/Form/Fieldset/Fieldset.test.tsx +35 -35
- package/src/Form/Fieldset/Fieldset.tsx +27 -27
- package/src/Form/Form.test.tsx +18 -18
- package/src/Form/Form.tsx +3 -3
- package/src/Form/FormControl/FormControl.test.tsx +22 -22
- package/src/Form/FormControl/FormControl.tsx +10 -10
- package/src/Form/FormGroup/FormGroup.test.tsx +37 -37
- package/src/Form/FormGroup/FormGroup.tsx +16 -16
- package/src/Form/FormHelperText/FormHelperText.test.tsx +18 -18
- package/src/Form/FormHelperText/FormHelperText.tsx +7 -7
- package/src/Form/FormSelectorWrapper/FormSelectorWrapper.test.tsx +15 -15
- package/src/Form/FormSelectorWrapper/FormSelectorWrapper.tsx +14 -14
- package/src/Form/Input/Input.module.scss +20 -44
- package/src/Form/Input/Input.test.tsx +121 -73
- package/src/Form/Input/Input.tsx +96 -35
- package/src/Form/Label/Label.test.tsx +13 -13
- package/src/Form/Label/Label.tsx +6 -6
- package/src/Form/Radio/Radio.test.tsx +35 -35
- package/src/Form/Radio/Radio.tsx +17 -17
- package/src/Form/Select/Option.test.tsx +10 -10
- package/src/Form/Select/Option.tsx +8 -8
- package/src/Form/Select/Select.module.scss +7 -9
- package/src/Form/Select/Select.test.tsx +144 -141
- package/src/Form/Select/Select.tsx +79 -78
- package/src/Form/Textarea/Textarea.module.scss +8 -18
- package/src/Form/Textarea/Textarea.test.tsx +27 -27
- package/src/Form/Textarea/Textarea.tsx +33 -13
- package/src/Form/Toggle/Toggle.module.scss +1 -1
- package/src/Form/Toggle/Toggle.test.tsx +22 -22
- package/src/Form/Toggle/Toggle.tsx +10 -10
- package/src/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.test.tsx +39 -39
- package/src/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.tsx +12 -12
- package/src/Form/Wrapper/InputWrapper/InputWrapper.module.scss +2 -8
- package/src/Form/Wrapper/InputWrapper/InputWrapper.test.tsx +55 -55
- package/src/Form/Wrapper/InputWrapper/InputWrapper.tsx +30 -35
- package/src/Form/Wrapper/RadioWrapper/RadioWrapper.test.tsx +35 -35
- package/src/Form/Wrapper/RadioWrapper/RadioWrapper.tsx +12 -12
- package/src/Form/Wrapper/SelectWrapper/SelectWrapper.test.tsx +55 -55
- package/src/Form/Wrapper/SelectWrapper/SelectWrapper.tsx +12 -12
- package/src/Form/Wrapper/TextareaWrapper/TextareaWrapper.module.scss +2 -11
- package/src/Form/Wrapper/TextareaWrapper/TextareaWrapper.test.tsx +50 -50
- package/src/Form/Wrapper/TextareaWrapper/TextareaWrapper.tsx +22 -22
- package/src/Form/Wrapper/Wrapper/Wrapper.module.scss +2 -2
- package/src/Form/Wrapper/Wrapper/Wrapper.test.tsx +11 -11
- package/src/Form/Wrapper/Wrapper/Wrapper.tsx +17 -17
- package/src/Form/form.interfaces.ts +1 -1
- package/src/Icon/Icon.module.scss +71 -71
- package/src/Icon/Icon.test.tsx +18 -18
- package/src/Icon/Icon.tsx +70 -70
- package/src/Link/Link.module.scss +5 -5
- package/src/Link/Link.test.tsx +76 -76
- package/src/Link/Link.tsx +27 -27
- package/src/Link/types.d.ts +1 -1
- package/src/Notifications/BaseModal/BaseModal.module.scss +1 -1
- package/src/Notifications/BaseModal/BaseModal.test.tsx +53 -53
- package/src/Notifications/BaseModal/BaseModal.tsx +16 -16
- package/src/Notifications/BaseModal/BaseModalActions/BaseModalActions.test.tsx +13 -13
- package/src/Notifications/BaseModal/BaseModalActions/BaseModalActions.tsx +5 -5
- package/src/Notifications/BaseModal/BaseModalContent/BaseModalContent.test.tsx +16 -16
- package/src/Notifications/BaseModal/BaseModalContent/BaseModalContent.tsx +5 -5
- package/src/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.test.tsx +19 -19
- package/src/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.tsx +10 -10
- package/src/Notifications/Dialog/Dialog.test.tsx +35 -35
- package/src/Notifications/Dialog/Dialog.tsx +19 -19
- package/src/Notifications/Dialog/DialogActions/DialogActions.test.tsx +14 -14
- package/src/Notifications/Dialog/DialogActions/DialogActions.tsx +6 -6
- package/src/Notifications/Dialog/DialogTitle/DialogTitle.test.tsx +12 -12
- package/src/Notifications/Dialog/DialogTitle/DialogTitle.tsx +6 -6
- package/src/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.test.tsx +20 -20
- package/src/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.tsx +7 -7
- package/src/Notifications/DiscardChangesModal/DiscardChangesModal.test.tsx +36 -36
- package/src/Notifications/DiscardChangesModal/DiscardChangesModal.tsx +8 -8
- package/src/Notifications/Modal/Modal.test.tsx +6 -6
- package/src/Notifications/Modal/Modal.tsx +1 -1
- package/src/Notifications/Modal/ModalActions/ModalActions.tsx +2 -2
- package/src/Notifications/Modal/ModalContent/ModalContent.tsx +2 -2
- package/src/Notifications/Modal/ModalHeader/ModalHeader.tsx +2 -2
- package/src/Notifications/SlideInModal/SlideInModal.test.tsx +16 -16
- package/src/Notifications/SlideInModal/SlideInModal.tsx +16 -11
- package/src/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.test.tsx +16 -16
- package/src/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.tsx +6 -6
- package/src/Notifications/Snackbar/SnackbarItem/SnackbarItem.module.scss +2 -2
- package/src/Notifications/Snackbar/SnackbarItem/SnackbarItem.test.tsx +17 -17
- package/src/Notifications/Snackbar/SnackbarItem/SnackbarItem.tsx +23 -23
- package/src/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.test.tsx +32 -32
- package/src/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.tsx +18 -18
- package/src/Notifications/Snackbar/SnackbarProvider/SnackbarStateProvider.tsx +3 -3
- package/src/Notifications/Snackbar/interfaces.ts +2 -2
- package/src/Notifications/Snackbar/useSnackbar.ts +2 -2
- package/src/Pagination/Pagination.module.scss +2 -0
- package/src/Pagination/Pagination.test.tsx +47 -47
- package/src/Pagination/Pagination.tsx +35 -35
- package/src/Popover/Popover.test.tsx +19 -19
- package/src/Popover/Popover.tsx +7 -7
- package/src/Skeleton/Skeleton.module.scss +2 -2
- package/src/Skeleton/Skeleton.test.tsx +29 -29
- package/src/Skeleton/Skeleton.tsx +10 -10
- package/src/StatusIndicator/StatusIndicator.test.tsx +38 -38
- package/src/StatusIndicator/StatusIndicator.tsx +9 -9
- package/src/Tabs/Tab.test.tsx +13 -13
- package/src/Tabs/Tab.tsx +1 -1
- package/src/Tabs/TabButton.test.tsx +28 -28
- package/src/Tabs/TabButton.tsx +7 -7
- package/src/Tabs/TabPanel.test.tsx +30 -30
- package/src/Tabs/TabPanel.tsx +4 -4
- package/src/Tabs/Tabs.test.tsx +93 -93
- package/src/Tabs/Tabs.tsx +25 -25
- package/src/TextEllipsis/TextEllipsis.test.tsx +22 -22
- package/src/TextEllipsis/TextEllipsis.tsx +6 -6
- package/src/Tiles/Tile.module.scss +1 -1
- package/src/Tiles/Tile.test.tsx +42 -42
- package/src/Tiles/Tile.tsx +22 -22
- package/src/Tiles/Tiles.test.tsx +30 -30
- package/src/Tiles/Tiles.tsx +9 -9
- package/src/Tooltip/Tooltip.test.tsx +35 -35
- package/src/Tooltip/Tooltip.tsx +21 -21
- package/src/Typography/Typography.module.scss +1 -1
- package/src/Typography/Typography.test.tsx +49 -49
- package/src/Typography/Typography.tsx +42 -42
- package/src/Wizard/BaseWizardSteps/BaseWizardSteps.module.scss +1 -1
- package/src/Wizard/BaseWizardSteps/BaseWizardSteps.test.tsx +26 -26
- package/src/Wizard/BaseWizardSteps/BaseWizardSteps.tsx +24 -24
- package/src/Wizard/Wizard.test.tsx +56 -56
- package/src/Wizard/Wizard.tsx +6 -6
- package/src/Wizard/WizardActions/WizardActions.test.tsx +34 -34
- package/src/Wizard/WizardActions/WizardActions.tsx +14 -14
- package/src/Wizard/WizardStateProvider.tsx +3 -3
- package/src/Wizard/WizardSteps/WizardSteps.test.tsx +27 -27
- package/src/Wizard/WizardSteps/WizardSteps.tsx +7 -7
- package/src/Wizard/wizardStateReducer.ts +9 -9
- package/src/_BaseStyling_/BaseStyling.test.tsx +14 -14
- package/src/_BaseStyling_/BaseStyling.tsx +50 -50
- package/src/hooks/useAnimation.test.tsx +12 -12
- package/src/hooks/useAnimation.ts +4 -4
- package/src/hooks/useBodyClick.test.tsx +8 -8
- package/src/hooks/useBodyClick.ts +3 -3
- package/src/hooks/useFormSelector.test.ts +17 -17
- package/src/hooks/useFormSelector.ts +4 -4
- package/src/hooks/usePosition.test.tsx +215 -215
- package/src/hooks/usePosition.ts +68 -68
- package/src/hooks/useRepeater.test.tsx +26 -26
- package/src/hooks/useRepeater.ts +5 -5
- package/src/hooks/useScroll.test.tsx +5 -5
- package/src/hooks/useScroll.ts +3 -3
- package/src/hooks/useSpacing.test.ts +40 -40
- package/src/hooks/useSpacing.ts +3 -3
- package/src/hooks/useWrapper.test.ts +12 -12
- package/src/hooks/useWrapper.ts +14 -7
- package/src/index.ts +67 -67
- package/src/mixins.module.scss +76 -27
- package/src/types.d.ts +1 -1
- package/src/util/helper.test.tsx +25 -25
- package/src/util/helper.tsx +64 -64
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/** The empty className property on FormHelperText is on purpose! We want to basically "filter" out the className from helperProps because we're adding this to the surrounding div. This makes it so also the errormessage receives this styling. */
|
|
2
2
|
|
|
3
|
-
import React, { ComponentPropsWithRef, ReactChild } from
|
|
4
|
-
import classes from
|
|
5
|
-
import { FormHelperText, Props as HelperProps } from
|
|
6
|
-
import { Icon, Icons } from
|
|
3
|
+
import React, { ComponentPropsWithRef, ReactChild } from "react";
|
|
4
|
+
import classes from "./FormGroup.module.scss";
|
|
5
|
+
import { FormHelperText, Props as HelperProps } from "../FormHelperText/FormHelperText";
|
|
6
|
+
import { Icon, Icons } from "../../Icon/Icon";
|
|
7
7
|
|
|
8
|
-
export interface Props extends ComponentPropsWithRef<
|
|
8
|
+
export interface Props extends ComponentPropsWithRef<"div"> {
|
|
9
9
|
children: ReactChild[] | ReactChild;
|
|
10
10
|
error?: boolean;
|
|
11
11
|
errorMessageIcon?: Icons;
|
|
12
|
-
errorMessageIconPosition?:
|
|
12
|
+
errorMessageIconPosition?: "before" | "after";
|
|
13
13
|
errorMessage?: string;
|
|
14
14
|
errorId?: string;
|
|
15
15
|
helperIndent?: number;
|
|
@@ -28,7 +28,7 @@ export const FormGroup = React.forwardRef<HTMLDivElement, Props>(
|
|
|
28
28
|
errorMessage,
|
|
29
29
|
errorId,
|
|
30
30
|
errorMessageIcon,
|
|
31
|
-
errorMessageIconPosition =
|
|
31
|
+
errorMessageIconPosition = "before",
|
|
32
32
|
helperText,
|
|
33
33
|
helperId,
|
|
34
34
|
helperProps,
|
|
@@ -41,35 +41,35 @@ export const FormGroup = React.forwardRef<HTMLDivElement, Props>(
|
|
|
41
41
|
<div
|
|
42
42
|
{...rest}
|
|
43
43
|
ref={ref}
|
|
44
|
-
className={`${classes[
|
|
44
|
+
className={`${classes["form-group"]} ${error ? classes.error : ""} ${className ?? ""}`}
|
|
45
45
|
>
|
|
46
46
|
{children}
|
|
47
47
|
|
|
48
48
|
{(helperText || (errorMessage && error)) && (
|
|
49
49
|
<div
|
|
50
50
|
style={{ marginLeft: `${helperIndent}px` }}
|
|
51
|
-
className={`${classes[
|
|
52
|
-
helperProps?.className ? helperProps.className :
|
|
51
|
+
className={`${classes["default-helper"]} ${
|
|
52
|
+
helperProps?.className ? helperProps.className : ""
|
|
53
53
|
}`}
|
|
54
54
|
>
|
|
55
55
|
{helperText && !error && (
|
|
56
|
-
<FormHelperText {...helperProps} className={
|
|
56
|
+
<FormHelperText {...helperProps} className={""} id={helperId}>
|
|
57
57
|
{(helperProps && helperProps.children) || helperText}
|
|
58
58
|
</FormHelperText>
|
|
59
59
|
)}
|
|
60
60
|
{error && errorMessage && (
|
|
61
|
-
<span className={classes[
|
|
61
|
+
<span className={classes["error-message"]}>
|
|
62
62
|
<span className={classes.message} id={errorId}>
|
|
63
|
-
{errorMessageIcon && errorMessageIconPosition ===
|
|
63
|
+
{errorMessageIcon && errorMessageIconPosition === "before" && (
|
|
64
64
|
<Icon
|
|
65
|
-
className={`${classes[
|
|
65
|
+
className={`${classes["error-icon"]} ${classes["error-icon-before"]}`}
|
|
66
66
|
icon={errorMessageIcon}
|
|
67
67
|
/>
|
|
68
68
|
)}
|
|
69
69
|
{errorMessage}
|
|
70
|
-
{errorMessageIcon && errorMessageIconPosition ===
|
|
70
|
+
{errorMessageIcon && errorMessageIconPosition === "after" && (
|
|
71
71
|
<Icon
|
|
72
|
-
className={`${classes[
|
|
72
|
+
className={`${classes["error-icon"]} ${classes["error-icon-after"]}`}
|
|
73
73
|
icon={errorMessageIcon}
|
|
74
74
|
/>
|
|
75
75
|
)}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from
|
|
2
|
-
import { FormHelperText, Props } from
|
|
3
|
-
import { render } from
|
|
1
|
+
import React, { useEffect, useRef } from "react";
|
|
2
|
+
import { FormHelperText, Props } from "./FormHelperText";
|
|
3
|
+
import { render } from "@testing-library/react";
|
|
4
4
|
|
|
5
5
|
const defaultParams: Props = {
|
|
6
6
|
error: false,
|
|
7
|
-
children:
|
|
7
|
+
children: "This is a field description"
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
const createFormHelperText = (params?: (defaultParams: Props) => Props) => {
|
|
@@ -13,26 +13,26 @@ const createFormHelperText = (params?: (defaultParams: Props) => Props) => {
|
|
|
13
13
|
parameters = params(defaultParams);
|
|
14
14
|
}
|
|
15
15
|
const queries = render(<FormHelperText {...parameters} data-testid="formhelpertext" />);
|
|
16
|
-
const formhelpertext = queries.getByTestId(
|
|
16
|
+
const formhelpertext = queries.getByTestId("formhelpertext");
|
|
17
17
|
|
|
18
18
|
return {
|
|
19
19
|
...queries,
|
|
20
|
-
formhelpertext
|
|
20
|
+
formhelpertext
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
describe(
|
|
25
|
-
it(
|
|
24
|
+
describe("FormHelperText should render", () => {
|
|
25
|
+
it("renders without crashing", () => {
|
|
26
26
|
const { formhelpertext } = createFormHelperText();
|
|
27
27
|
|
|
28
28
|
expect(formhelpertext).toBeTruthy();
|
|
29
29
|
});
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
describe(
|
|
33
|
-
it(
|
|
32
|
+
describe("ref should work", () => {
|
|
33
|
+
it("should give back the proper data prop, this also checks if the component propagates ...rest properly", () => {
|
|
34
34
|
const ExampleComponent = ({
|
|
35
|
-
propagateRef
|
|
35
|
+
propagateRef
|
|
36
36
|
}: {
|
|
37
37
|
propagateRef?: (ref: React.RefObject<HTMLElement>) => void;
|
|
38
38
|
}) => {
|
|
@@ -48,21 +48,21 @@ describe('ref should work', () => {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
const refCheck = (ref: React.RefObject<HTMLElement>) => {
|
|
51
|
-
expect(ref.current).toHaveAttribute(
|
|
51
|
+
expect(ref.current).toHaveAttribute("data-ref", "testing");
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
render(<ExampleComponent propagateRef={refCheck} />);
|
|
55
55
|
});
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
describe(
|
|
59
|
-
it(
|
|
60
|
-
const { formhelpertext } = createFormHelperText(
|
|
58
|
+
describe("Attributes", () => {
|
|
59
|
+
it("contains the error class", () => {
|
|
60
|
+
const { formhelpertext } = createFormHelperText(defaultParams => ({
|
|
61
61
|
...defaultParams,
|
|
62
|
-
error: true
|
|
62
|
+
error: true
|
|
63
63
|
}));
|
|
64
64
|
|
|
65
|
-
expect(formhelpertext).toHaveClass(
|
|
66
|
-
expect(formhelpertext).toHaveStyle({ color:
|
|
65
|
+
expect(formhelpertext).toHaveClass("error");
|
|
66
|
+
expect(formhelpertext).toHaveStyle({ color: "rgb(226, 42, 29);" });
|
|
67
67
|
});
|
|
68
68
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, { ComponentPropsWithRef, ReactNode } from
|
|
2
|
-
import classes from
|
|
3
|
-
import { Typography } from
|
|
4
|
-
import { FormElement } from
|
|
1
|
+
import React, { ComponentPropsWithRef, ReactNode } from "react";
|
|
2
|
+
import classes from "./FormHelperText.module.scss";
|
|
3
|
+
import { Typography } from "../../Typography/Typography";
|
|
4
|
+
import { FormElement } from "../form.interfaces";
|
|
5
5
|
|
|
6
|
-
export interface Props extends ComponentPropsWithRef<
|
|
6
|
+
export interface Props extends ComponentPropsWithRef<"div">, FormElement {
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
}
|
|
9
9
|
|
|
@@ -15,8 +15,8 @@ export const FormHelperText = React.forwardRef<HTMLDivElement, Props>(
|
|
|
15
15
|
ref={ref}
|
|
16
16
|
variant="sub-text"
|
|
17
17
|
tag="div"
|
|
18
|
-
className={`${classes[
|
|
19
|
-
className ??
|
|
18
|
+
className={`${classes["form-helper-text"]} ${error ? classes.error : ""} ${
|
|
19
|
+
className ?? ""
|
|
20
20
|
}`}
|
|
21
21
|
>
|
|
22
22
|
{children}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import React, { useRef, useEffect } from
|
|
2
|
-
import { FormSelectorWrapper, Props } from
|
|
3
|
-
import { render } from
|
|
1
|
+
import React, { useRef, useEffect } from "react";
|
|
2
|
+
import { FormSelectorWrapper, Props } from "./FormSelectorWrapper";
|
|
3
|
+
import { render } from "@testing-library/react";
|
|
4
4
|
|
|
5
5
|
const defaultParams: Props = {};
|
|
6
6
|
|
|
@@ -14,26 +14,26 @@ const createFormSelectorWrapper = (params?: (defaultParams: Props) => Props) =>
|
|
|
14
14
|
formSelectorWrapper content
|
|
15
15
|
</FormSelectorWrapper>
|
|
16
16
|
);
|
|
17
|
-
const formSelectorWrapper = queries.getByTestId(
|
|
17
|
+
const formSelectorWrapper = queries.getByTestId("formSelectorWrapper");
|
|
18
18
|
|
|
19
19
|
return {
|
|
20
20
|
...queries,
|
|
21
|
-
formSelectorWrapper
|
|
21
|
+
formSelectorWrapper
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
describe(
|
|
26
|
-
it(
|
|
25
|
+
describe("FormSelectorWrapper should render", () => {
|
|
26
|
+
it("renders without crashing", () => {
|
|
27
27
|
const { formSelectorWrapper } = createFormSelectorWrapper();
|
|
28
28
|
|
|
29
29
|
expect(formSelectorWrapper).toBeDefined();
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
describe(
|
|
34
|
-
it(
|
|
33
|
+
describe("ref should work", () => {
|
|
34
|
+
it("should give back the proper data prop, this also checks if the component propagates ...rest properly", () => {
|
|
35
35
|
const ExampleComponent = ({
|
|
36
|
-
propagateRef
|
|
36
|
+
propagateRef
|
|
37
37
|
}: {
|
|
38
38
|
propagateRef?: (
|
|
39
39
|
ref: React.RefObject<HTMLElement>,
|
|
@@ -54,9 +54,9 @@ describe('ref should work', () => {
|
|
|
54
54
|
return (
|
|
55
55
|
<FormSelectorWrapper
|
|
56
56
|
{...defaultParams}
|
|
57
|
-
containerProps={{
|
|
57
|
+
containerProps={{ "data-ref": "testing", ref: containerRef }}
|
|
58
58
|
helperText="helpertext"
|
|
59
|
-
helperProps={{
|
|
59
|
+
helperProps={{ "data-ref": "testing", ref: helperRef }}
|
|
60
60
|
data-ref="testing"
|
|
61
61
|
ref={ref}
|
|
62
62
|
/>
|
|
@@ -68,9 +68,9 @@ describe('ref should work', () => {
|
|
|
68
68
|
ref2: React.RefObject<HTMLElement>,
|
|
69
69
|
ref3: React.RefObject<HTMLElement>
|
|
70
70
|
) => {
|
|
71
|
-
expect(ref.current).toHaveAttribute(
|
|
72
|
-
expect(ref2.current).toHaveAttribute(
|
|
73
|
-
expect(ref3.current).toHaveAttribute(
|
|
71
|
+
expect(ref.current).toHaveAttribute("data-ref", "testing");
|
|
72
|
+
expect(ref2.current).toHaveAttribute("data-ref", "testing");
|
|
73
|
+
expect(ref3.current).toHaveAttribute("data-ref", "testing");
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
render(<ExampleComponent propagateRef={refCheck} />);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import React, { ComponentPropsWithRef, createRef, ReactNode } from
|
|
2
|
-
import { Icon, Icons } from
|
|
3
|
-
import { KeyValuePair } from
|
|
4
|
-
import { FormSelector } from
|
|
5
|
-
import { FormHelperText, Props as FormHelperTextProps } from
|
|
6
|
-
import classes from
|
|
1
|
+
import React, { ComponentPropsWithRef, createRef, ReactNode } from "react";
|
|
2
|
+
import { Icon, Icons } from "../../Icon/Icon";
|
|
3
|
+
import { KeyValuePair } from "../../interfaces";
|
|
4
|
+
import { FormSelector } from "../form.interfaces";
|
|
5
|
+
import { FormHelperText, Props as FormHelperTextProps } from "../FormHelperText/FormHelperText";
|
|
6
|
+
import classes from "./FormSelectorWrapper.module.scss";
|
|
7
7
|
|
|
8
|
-
export interface Props extends ComponentPropsWithRef<
|
|
8
|
+
export interface Props extends ComponentPropsWithRef<"div">, FormSelector {
|
|
9
9
|
children?: ReactNode;
|
|
10
10
|
nestedChildren?: ReactNode;
|
|
11
|
-
containerProps?: ComponentPropsWithRef<
|
|
11
|
+
containerProps?: ComponentPropsWithRef<"div"> & KeyValuePair;
|
|
12
12
|
helperProps?: FormHelperTextProps;
|
|
13
13
|
disabled?: boolean;
|
|
14
14
|
errorId?: string;
|
|
@@ -40,8 +40,8 @@ export const FormSelectorWrapper = React.forwardRef<HTMLDivElement, Props>(
|
|
|
40
40
|
<div
|
|
41
41
|
{...rest}
|
|
42
42
|
ref={ref}
|
|
43
|
-
className={`${error ? classes[
|
|
44
|
-
className ??
|
|
43
|
+
className={`${error ? classes["error"] : ""} ${disabled ? classes["disabled"] : ""} ${
|
|
44
|
+
className ?? ""
|
|
45
45
|
}`}
|
|
46
46
|
>
|
|
47
47
|
<div {...containerProps}>{children}</div>
|
|
@@ -51,16 +51,16 @@ export const FormSelectorWrapper = React.forwardRef<HTMLDivElement, Props>(
|
|
|
51
51
|
{...helperProps}
|
|
52
52
|
ref={helperRef}
|
|
53
53
|
id={`${identifier}`}
|
|
54
|
-
className={`${classes[
|
|
55
|
-
error ? classes[
|
|
54
|
+
className={`${classes["helper-text"]} ${helperProps?.className ?? ""} ${
|
|
55
|
+
error ? classes["error"] : ""
|
|
56
56
|
}`}
|
|
57
57
|
>
|
|
58
58
|
{(helperProps && helperProps.children) || helperText}
|
|
59
59
|
</FormHelperText>
|
|
60
60
|
)}
|
|
61
61
|
{errorMessage && !parentErrorId && error && (
|
|
62
|
-
<span className={classes[
|
|
63
|
-
<Icon className={classes[
|
|
62
|
+
<span className={classes["error-message"]}>
|
|
63
|
+
<Icon className={classes["error-icon"]} icon={Icons.Error} />
|
|
64
64
|
<span id={errorId}>{errorMessage}</span>
|
|
65
65
|
</span>
|
|
66
66
|
)}
|
|
@@ -1,70 +1,46 @@
|
|
|
1
|
+
@import "../../mixins.module.scss";
|
|
2
|
+
|
|
1
3
|
.input-wrapper {
|
|
2
4
|
position: relative;
|
|
3
5
|
display: flex;
|
|
4
6
|
align-items: center;
|
|
5
|
-
height:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
background-color: var(--input-background-color);
|
|
9
|
-
border-color: var(--input-border-color);
|
|
10
|
-
border-style: var(--input-border-style);
|
|
11
|
-
border-width: var(--input-border-width);
|
|
7
|
+
height: 4rem;
|
|
8
|
+
border: 0;
|
|
12
9
|
border-radius: var(--input-border-radius);
|
|
10
|
+
background-color: var(--input-background-color);
|
|
11
|
+
padding: 0 1.25rem;
|
|
13
12
|
transition: all 0.2s ease-in-out;
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
height: calc(4rem - (2 * var(--input-border-width)));
|
|
17
|
-
padding: 0 1.25rem;
|
|
18
|
-
|
|
19
|
-
border-color: var(--default);
|
|
20
|
-
border-width: var(--input-border-width);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
&.disabled,
|
|
24
|
-
&.disabled input {
|
|
25
|
-
background-color: var(--disabled);
|
|
26
|
-
border-color: #fff;
|
|
27
|
-
cursor: not-allowed;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
&.error {
|
|
31
|
-
border-color: var(--error);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
&.focus {
|
|
35
|
-
height: calc(4rem - (2 * var(--input-border-width-focus)));
|
|
36
|
-
padding: 0 calc(1.25rem - var(--input-border-width));
|
|
37
|
-
border-width: var(--input-border-width-focus);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&.focus:not(.error) {
|
|
41
|
-
border-color: var(--color-primary);
|
|
42
|
-
}
|
|
14
|
+
@include outlineStates;
|
|
43
15
|
}
|
|
44
16
|
|
|
45
17
|
.input {
|
|
46
|
-
|
|
47
|
-
|
|
18
|
+
padding: 0;
|
|
19
|
+
height: 4rem;
|
|
48
20
|
color: var(--greyed-out);
|
|
49
21
|
font-size: var(--font-size);
|
|
50
22
|
font-family: var(--font-family);
|
|
51
23
|
width: 100%;
|
|
52
24
|
box-sizing: border-box;
|
|
53
|
-
|
|
25
|
+
border: 0;
|
|
26
|
+
border-radius: var(--input-border-radius);
|
|
54
27
|
|
|
55
|
-
&:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
border-color: var(--color-primary);
|
|
28
|
+
&:disabled {
|
|
29
|
+
background-color: var(--disabled);
|
|
30
|
+
cursor: not-allowed;
|
|
59
31
|
}
|
|
32
|
+
|
|
33
|
+
@include browserOutlineDisabled;
|
|
60
34
|
}
|
|
61
35
|
|
|
36
|
+
@include outline;
|
|
37
|
+
|
|
62
38
|
.error input {
|
|
63
39
|
color: var(--error);
|
|
64
|
-
padding-right: 3.
|
|
40
|
+
padding-right: 3.5rem;
|
|
65
41
|
|
|
66
42
|
&.remove-extra-indent {
|
|
67
|
-
padding-right:
|
|
43
|
+
padding-right: 0rem;
|
|
68
44
|
}
|
|
69
45
|
}
|
|
70
46
|
|