@onewelcome/react-lib-components 0.2.6 → 1.0.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/LICENSE +202 -21
- package/dist/Breadcrumbs/Breadcrumbs.d.ts +2 -2
- package/dist/Button/BaseButton.d.ts +1 -1
- package/dist/Button/Button.d.ts +1 -1
- package/dist/Button/IconButton.d.ts +1 -1
- package/dist/ContextMenu/ContextMenu.d.ts +1 -1
- package/dist/ContextMenu/ContextMenuItem.d.ts +1 -1
- package/dist/DataGrid/DataGridActions/DataGridActions.d.ts +1 -1
- package/dist/DataGrid/DataGridActions/DataGridColumnsToggle.d.ts +1 -1
- package/dist/DataGrid/DataGridBody/DataGridCell.d.ts +1 -1
- package/dist/DataGrid/DataGridBody/DataGridRow.d.ts +1 -1
- package/dist/DataGrid/DataGridHeader/DataGridHeader.d.ts +1 -1
- package/dist/DataGrid/DataGridHeader/DataGridHeaderCell.d.ts +1 -1
- package/dist/Form/Checkbox/Checkbox.d.ts +1 -1
- package/dist/Form/Fieldset/Fieldset.d.ts +1 -1
- package/dist/Form/FormControl/FormControl.d.ts +1 -1
- package/dist/Form/FormGroup/FormGroup.d.ts +1 -1
- package/dist/Form/FormHelperText/FormHelperText.d.ts +1 -1
- package/dist/Form/FormSelectorWrapper/FormSelectorWrapper.d.ts +1 -1
- package/dist/Form/Input/Input.d.ts +2 -3
- package/dist/Form/Label/Label.d.ts +1 -1
- package/dist/Form/Radio/Radio.d.ts +1 -1
- package/dist/Form/Select/Option.d.ts +1 -1
- package/dist/Form/Select/Select.d.ts +1 -2
- package/dist/Form/Select/Select.interfaces.d.ts +22 -0
- package/dist/Form/Select/SelectService.d.ts +12 -0
- package/dist/Form/Textarea/Textarea.d.ts +1 -1
- package/dist/Form/Toggle/Toggle.d.ts +1 -1
- package/dist/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.d.ts +1 -1
- package/dist/Form/Wrapper/InputWrapper/InputWrapper.d.ts +1 -1
- package/dist/Form/Wrapper/RadioWrapper/RadioWrapper.d.ts +1 -1
- package/dist/Form/Wrapper/SelectWrapper/SelectWrapper.d.ts +1 -2
- package/dist/Form/Wrapper/TextareaWrapper/TextareaWrapper.d.ts +1 -1
- package/dist/Form/Wrapper/Wrapper/Wrapper.d.ts +1 -1
- package/dist/Icon/Icon.d.ts +1 -1
- package/dist/Link/Link.d.ts +3 -4
- package/dist/Notifications/BaseModal/BaseModal.d.ts +1 -1
- package/dist/Notifications/BaseModal/BaseModalActions/BaseModalActions.d.ts +2 -2
- package/dist/Notifications/BaseModal/BaseModalContent/BaseModalContent.d.ts +1 -1
- package/dist/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.d.ts +2 -2
- package/dist/Notifications/Dialog/Dialog.d.ts +1 -1
- package/dist/Notifications/Dialog/DialogActions/DialogActions.d.ts +1 -1
- package/dist/Notifications/Dialog/DialogTitle/DialogTitle.d.ts +1 -1
- package/dist/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.d.ts +1 -1
- package/dist/Notifications/SlideInModal/SlideInModal.d.ts +1 -1
- package/dist/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.d.ts +11 -0
- package/dist/Notifications/Snackbar/SnackbarProvider/SnackbarStateProvider.d.ts +3 -0
- package/dist/Notifications/Snackbar/useSnackbar.d.ts +5 -1
- package/dist/Pagination/Pagination.d.ts +1 -1
- package/dist/Popover/Popover.d.ts +1 -1
- package/dist/Skeleton/Skeleton.d.ts +1 -1
- package/dist/StatusIndicator/StatusIndicator.d.ts +1 -1
- package/dist/Tabs/TabButton.d.ts +1 -1
- package/dist/Tabs/TabPanel.d.ts +1 -1
- package/dist/TextEllipsis/TextEllipsis.d.ts +1 -1
- package/dist/Tiles/Tile.d.ts +1 -1
- package/dist/Tiles/Tiles.d.ts +1 -1
- package/dist/Tooltip/Tooltip.d.ts +1 -1
- package/dist/Wizard/BaseWizardSteps/BaseWizardSteps.d.ts +1 -2
- package/dist/Wizard/Wizard.d.ts +0 -1
- package/dist/Wizard/WizardSteps/WizardSteps.d.ts +1 -1
- package/dist/Wizard/wizardStateReducer.d.ts +1 -3
- package/dist/_BaseStyling_/BaseStyling.d.ts +10 -4
- package/dist/react-lib-components.cjs.development.js +1171 -1565
- 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 +1171 -1565
- package/dist/react-lib-components.esm.js.map +1 -1
- package/package.json +31 -24
- package/src/Breadcrumbs/Breadcrumbs.module.scss +16 -0
- package/src/Breadcrumbs/Breadcrumbs.test.tsx +17 -1
- package/src/Breadcrumbs/Breadcrumbs.tsx +18 -2
- package/src/Button/BaseButton.module.scss +16 -0
- package/src/Button/BaseButton.test.tsx +16 -0
- package/src/Button/BaseButton.tsx +16 -0
- package/src/Button/Button.module.scss +16 -0
- package/src/Button/Button.test.tsx +16 -0
- package/src/Button/Button.tsx +16 -0
- package/src/Button/IconButton.module.scss +16 -0
- package/src/Button/IconButton.test.tsx +16 -0
- package/src/Button/IconButton.tsx +16 -0
- package/src/ContextMenu/ContextMenu.module.scss +16 -0
- package/src/ContextMenu/ContextMenu.test.tsx +16 -0
- package/src/ContextMenu/ContextMenu.tsx +16 -0
- package/src/ContextMenu/ContextMenuItem.module.scss +16 -0
- package/src/ContextMenu/ContextMenuItem.tsx +16 -0
- package/src/DataGrid/DataGrid.module.scss +16 -0
- package/src/DataGrid/DataGrid.test.tsx +16 -0
- package/src/DataGrid/DataGrid.tsx +16 -0
- package/src/DataGrid/DataGridActions/DataGridActions.module.scss +16 -0
- package/src/DataGrid/DataGridActions/DataGridActions.test.tsx +16 -0
- package/src/DataGrid/DataGridActions/DataGridActions.tsx +16 -0
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.module.scss +16 -0
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.test.tsx +16 -0
- package/src/DataGrid/DataGridActions/DataGridColumnsToggle.tsx +16 -0
- package/src/DataGrid/DataGridBody/DataGridBody.module.scss +16 -0
- package/src/DataGrid/DataGridBody/DataGridBody.test.tsx +16 -0
- package/src/DataGrid/DataGridBody/DataGridBody.tsx +16 -0
- package/src/DataGrid/DataGridBody/DataGridCell.module.scss +16 -0
- package/src/DataGrid/DataGridBody/DataGridCell.test.tsx +16 -0
- package/src/DataGrid/DataGridBody/DataGridCell.tsx +16 -0
- package/src/DataGrid/DataGridBody/DataGridRow.module.scss +16 -0
- package/src/DataGrid/DataGridBody/DataGridRow.test.tsx +16 -0
- package/src/DataGrid/DataGridBody/DataGridRow.tsx +16 -0
- package/src/DataGrid/DataGridHeader/DataGridHeader.module.scss +17 -1
- package/src/DataGrid/DataGridHeader/DataGridHeader.test.tsx +16 -0
- package/src/DataGrid/DataGridHeader/DataGridHeader.tsx +16 -0
- package/src/DataGrid/DataGridHeader/DataGridHeaderCell.module.scss +16 -0
- package/src/DataGrid/DataGridHeader/DataGridHeaderCell.test.tsx +16 -0
- package/src/DataGrid/DataGridHeader/DataGridHeaderCell.tsx +16 -0
- package/src/DataGrid/datagrid.interfaces.ts +16 -0
- package/src/Form/Checkbox/Checkbox.module.scss +20 -6
- package/src/Form/Checkbox/Checkbox.test.tsx +16 -0
- package/src/Form/Checkbox/Checkbox.tsx +16 -0
- package/src/Form/Fieldset/Fieldset.module.scss +16 -0
- package/src/Form/Fieldset/Fieldset.test.tsx +16 -0
- package/src/Form/Fieldset/Fieldset.tsx +21 -3
- package/src/Form/Form.module.scss +16 -0
- package/src/Form/Form.test.tsx +16 -0
- package/src/Form/Form.tsx +16 -0
- package/src/Form/FormControl/FormControl.module.scss +16 -0
- package/src/Form/FormControl/FormControl.test.tsx +16 -0
- package/src/Form/FormControl/FormControl.tsx +16 -0
- package/src/Form/FormGroup/FormGroup.module.scss +16 -0
- package/src/Form/FormGroup/FormGroup.test.tsx +16 -0
- package/src/Form/FormGroup/FormGroup.tsx +17 -1
- package/src/Form/FormHelperText/FormHelperText.module.scss +16 -0
- package/src/Form/FormHelperText/FormHelperText.test.tsx +16 -0
- package/src/Form/FormHelperText/FormHelperText.tsx +16 -0
- package/src/Form/FormSelectorWrapper/FormSelectorWrapper.module.scss +16 -0
- package/src/Form/FormSelectorWrapper/FormSelectorWrapper.test.tsx +16 -0
- package/src/Form/FormSelectorWrapper/FormSelectorWrapper.tsx +16 -0
- package/src/Form/Input/Input.module.scss +65 -5
- package/src/Form/Input/Input.test.tsx +16 -0
- package/src/Form/Input/Input.tsx +19 -57
- package/src/Form/Label/Label.module.scss +16 -0
- package/src/Form/Label/Label.test.tsx +16 -0
- package/src/Form/Label/Label.tsx +16 -0
- package/src/Form/Radio/Radio.module.scss +20 -6
- package/src/Form/Radio/Radio.test.tsx +16 -0
- package/src/Form/Radio/Radio.tsx +16 -0
- package/src/Form/Select/Option.test.tsx +16 -0
- package/src/Form/Select/Option.tsx +16 -0
- package/src/Form/Select/Select.interfaces.ts +39 -0
- package/src/Form/Select/Select.module.scss +28 -13
- package/src/Form/Select/Select.test.tsx +16 -57
- package/src/Form/Select/Select.tsx +36 -190
- package/src/Form/Select/SelectService.ts +204 -0
- package/src/Form/Textarea/Textarea.module.scss +16 -0
- package/src/Form/Textarea/Textarea.test.tsx +16 -0
- package/src/Form/Textarea/Textarea.tsx +16 -0
- package/src/Form/Toggle/Toggle.module.scss +17 -1
- package/src/Form/Toggle/Toggle.test.tsx +16 -0
- package/src/Form/Toggle/Toggle.tsx +16 -0
- package/src/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.module.scss +16 -0
- package/src/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.test.tsx +16 -0
- package/src/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.tsx +16 -0
- package/src/Form/Wrapper/InputWrapper/InputWrapper.module.scss +45 -14
- package/src/Form/Wrapper/InputWrapper/InputWrapper.test.tsx +36 -0
- package/src/Form/Wrapper/InputWrapper/InputWrapper.tsx +26 -4
- package/src/Form/Wrapper/RadioWrapper/RadioWrapper.module.scss +16 -0
- package/src/Form/Wrapper/RadioWrapper/RadioWrapper.test.tsx +16 -0
- package/src/Form/Wrapper/RadioWrapper/RadioWrapper.tsx +16 -0
- package/src/Form/Wrapper/SelectWrapper/SelectWrapper.module.scss +16 -0
- package/src/Form/Wrapper/SelectWrapper/SelectWrapper.test.tsx +17 -19
- package/src/Form/Wrapper/SelectWrapper/SelectWrapper.tsx +17 -15
- package/src/Form/Wrapper/TextareaWrapper/TextareaWrapper.module.scss +41 -33
- package/src/Form/Wrapper/TextareaWrapper/TextareaWrapper.test.tsx +16 -0
- package/src/Form/Wrapper/TextareaWrapper/TextareaWrapper.tsx +23 -7
- package/src/Form/Wrapper/Wrapper/Wrapper.module.scss +38 -18
- package/src/Form/Wrapper/Wrapper/Wrapper.test.tsx +16 -0
- package/src/Form/Wrapper/Wrapper/Wrapper.tsx +18 -1
- package/src/Form/form.interfaces.ts +16 -0
- package/src/Icon/Icon.module.scss +16 -0
- package/src/Icon/Icon.test.tsx +16 -0
- package/src/Icon/Icon.tsx +16 -0
- package/src/Link/Link.module.scss +21 -5
- package/src/Link/Link.test.tsx +16 -0
- package/src/Link/Link.tsx +18 -8
- package/src/Notifications/BaseModal/BaseModal.module.scss +16 -0
- package/src/Notifications/BaseModal/BaseModal.test.tsx +16 -0
- package/src/Notifications/BaseModal/BaseModal.tsx +16 -0
- package/src/Notifications/BaseModal/BaseModalActions/BaseModalActions.module.scss +16 -0
- package/src/Notifications/BaseModal/BaseModalActions/BaseModalActions.test.tsx +16 -0
- package/src/Notifications/BaseModal/BaseModalActions/BaseModalActions.tsx +20 -4
- package/src/Notifications/BaseModal/BaseModalContent/BaseModalContent.module.scss +16 -0
- package/src/Notifications/BaseModal/BaseModalContent/BaseModalContent.test.tsx +16 -0
- package/src/Notifications/BaseModal/BaseModalContent/BaseModalContent.tsx +16 -0
- package/src/Notifications/BaseModal/BaseModalContext.ts +16 -0
- package/src/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.module.scss +16 -0
- package/src/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.test.tsx +16 -0
- package/src/Notifications/BaseModal/BaseModalHeader/BaseModalHeader.tsx +17 -1
- package/src/Notifications/Dialog/Dialog.module.scss +16 -0
- package/src/Notifications/Dialog/Dialog.test.tsx +18 -2
- package/src/Notifications/Dialog/Dialog.tsx +16 -0
- package/src/Notifications/Dialog/DialogActions/DialogActions.module.scss +16 -0
- package/src/Notifications/Dialog/DialogActions/DialogActions.test.tsx +16 -0
- package/src/Notifications/Dialog/DialogActions/DialogActions.tsx +17 -1
- package/src/Notifications/Dialog/DialogTitle/DialogTitle.module.scss +16 -0
- package/src/Notifications/Dialog/DialogTitle/DialogTitle.test.tsx +16 -0
- package/src/Notifications/Dialog/DialogTitle/DialogTitle.tsx +16 -0
- package/src/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.test.tsx +16 -0
- package/src/Notifications/DiscardChangesModal/DiscardChangesDialog/DiscardChangesDialog.tsx +16 -0
- package/src/Notifications/DiscardChangesModal/DiscardChangesModal.test.tsx +16 -0
- package/src/Notifications/DiscardChangesModal/DiscardChangesModal.tsx +16 -0
- package/src/Notifications/Modal/Modal.tsx +16 -0
- package/src/Notifications/Modal/ModalActions/ModalActions.tsx +16 -0
- package/src/Notifications/Modal/ModalContent/ModalContent.tsx +16 -0
- package/src/Notifications/Modal/ModalHeader/ModalHeader.tsx +16 -0
- package/src/Notifications/SlideInModal/SlideInModal.module.scss +16 -0
- package/src/Notifications/SlideInModal/SlideInModal.test.tsx +16 -0
- package/src/Notifications/SlideInModal/SlideInModal.tsx +16 -0
- package/src/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.module.scss +19 -0
- package/src/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.test.tsx +16 -0
- package/src/Notifications/Snackbar/SnackbarContainer/SnackbarContainer.tsx +57 -2
- package/src/Notifications/Snackbar/SnackbarItem/SnackbarItem.module.scss +18 -0
- package/src/Notifications/Snackbar/SnackbarItem/SnackbarItem.test.tsx +16 -0
- package/src/Notifications/Snackbar/SnackbarItem/SnackbarItem.tsx +34 -1
- package/src/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.test.tsx +18 -2
- package/src/Notifications/Snackbar/SnackbarProvider/SnackbarProvider.tsx +38 -2
- package/src/Notifications/Snackbar/SnackbarProvider/SnackbarStateProvider.tsx +22 -1
- package/src/Notifications/Snackbar/interfaces.ts +16 -0
- package/src/Notifications/Snackbar/useSnackbar.ts +25 -1
- package/src/Pagination/Pagination.module.scss +17 -1
- package/src/Pagination/Pagination.test.tsx +17 -1
- package/src/Pagination/Pagination.tsx +16 -0
- package/src/Popover/Popover.module.scss +17 -1
- package/src/Popover/Popover.test.tsx +16 -0
- package/src/Popover/Popover.tsx +22 -0
- package/src/Skeleton/Skeleton.module.scss +16 -0
- package/src/Skeleton/Skeleton.test.tsx +17 -1
- package/src/Skeleton/Skeleton.tsx +16 -0
- package/src/StatusIndicator/StatusIndicator.module.scss +16 -0
- package/src/StatusIndicator/StatusIndicator.test.tsx +16 -0
- package/src/StatusIndicator/StatusIndicator.tsx +16 -0
- package/src/Tabs/Tab.test.tsx +16 -0
- package/src/Tabs/Tab.tsx +16 -0
- package/src/Tabs/TabButton.module.scss +20 -0
- package/src/Tabs/TabButton.test.tsx +16 -0
- package/src/Tabs/TabButton.tsx +16 -0
- package/src/Tabs/TabPanel.module.scss +20 -0
- package/src/Tabs/TabPanel.test.tsx +16 -0
- package/src/Tabs/TabPanel.tsx +16 -0
- package/src/Tabs/Tabs.module.scss +18 -2
- package/src/Tabs/Tabs.test.tsx +16 -0
- package/src/Tabs/Tabs.tsx +17 -1
- package/src/TextEllipsis/TextEllipsis.module.scss +16 -0
- package/src/TextEllipsis/TextEllipsis.test.tsx +16 -0
- package/src/TextEllipsis/TextEllipsis.tsx +16 -0
- package/src/Tiles/Tile.module.scss +18 -2
- package/src/Tiles/Tile.test.tsx +16 -0
- package/src/Tiles/Tile.tsx +16 -0
- package/src/Tiles/Tiles.module.scss +16 -0
- package/src/Tiles/Tiles.test.tsx +16 -0
- package/src/Tiles/Tiles.tsx +16 -0
- package/src/Tooltip/Tooltip.module.scss +17 -1
- package/src/Tooltip/Tooltip.test.tsx +26 -0
- package/src/Tooltip/Tooltip.tsx +18 -1
- package/src/Typography/Typography.module.scss +16 -0
- package/src/Typography/Typography.test.tsx +16 -0
- package/src/Typography/Typography.tsx +16 -0
- package/src/Wizard/BaseWizardSteps/BaseWizardSteps.module.scss +19 -7
- package/src/Wizard/BaseWizardSteps/BaseWizardSteps.test.tsx +16 -1
- package/src/Wizard/BaseWizardSteps/BaseWizardSteps.tsx +18 -19
- package/src/Wizard/Wizard.test.tsx +16 -1
- package/src/Wizard/Wizard.tsx +23 -8
- package/src/Wizard/WizardActions/WizardActions.test.tsx +16 -1
- package/src/Wizard/WizardActions/WizardActions.tsx +16 -0
- package/src/Wizard/WizardStateProvider.tsx +16 -0
- package/src/Wizard/WizardSteps/WizardSteps.test.tsx +16 -1
- package/src/Wizard/WizardSteps/WizardSteps.tsx +17 -2
- package/src/Wizard/wizardStateReducer.ts +18 -8
- package/src/_BaseStyling_/BaseStyling.test.tsx +16 -0
- package/src/_BaseStyling_/BaseStyling.tsx +41 -16
- package/src/hooks/useAnimation.test.tsx +16 -0
- package/src/hooks/useAnimation.ts +16 -0
- package/src/hooks/useBodyClick.test.tsx +16 -0
- package/src/hooks/useBodyClick.ts +16 -0
- package/src/hooks/useFormSelector.test.ts +16 -0
- package/src/hooks/useFormSelector.ts +16 -0
- package/src/hooks/usePosition.test.tsx +16 -0
- package/src/hooks/usePosition.ts +16 -0
- package/src/hooks/useRepeater.test.tsx +16 -0
- package/src/hooks/useRepeater.ts +16 -0
- package/src/hooks/useScroll.test.tsx +16 -0
- package/src/hooks/useScroll.ts +16 -0
- package/src/hooks/useSpacing.test.ts +16 -0
- package/src/hooks/useSpacing.ts +16 -0
- package/src/hooks/useWrapper.test.ts +16 -0
- package/src/hooks/useWrapper.ts +16 -0
- package/src/index.ts +16 -0
- package/src/interfaces.ts +16 -0
- package/src/mixins.module.scss +22 -7
- package/src/readyclasses.module.scss +16 -0
- package/src/types.d.ts +16 -0
- package/src/util/helper.test.tsx +16 -0
- package/src/util/helper.tsx +16 -0
- package/src/Link/types.d.ts +0 -9
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
@import "../../mixins.module.scss";
|
|
2
18
|
|
|
3
19
|
.textarea-wrapper {
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
import React, { useEffect, useRef } from "react";
|
|
2
18
|
import { Textarea, Props } from "./Textarea";
|
|
3
19
|
import { render } from "@testing-library/react";
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
import React, { ComponentPropsWithRef, useState } from "react";
|
|
2
18
|
import { Icon, Props as IconProps, Icons } from "../../Icon/Icon";
|
|
3
19
|
import classes from "./Textarea.module.scss";
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
$borderRadius: 2.5rem;
|
|
2
18
|
|
|
3
19
|
.toggle-wrapper {
|
|
@@ -23,7 +39,7 @@ $borderRadius: 2.5rem;
|
|
|
23
39
|
height: 1rem;
|
|
24
40
|
border-radius: 50%;
|
|
25
41
|
display: block;
|
|
26
|
-
background-color:
|
|
42
|
+
background-color: var(--light);
|
|
27
43
|
position: absolute;
|
|
28
44
|
top: 50%;
|
|
29
45
|
transform: translateY(-50%) translateX(0);
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
import React, { useRef, useEffect } from "react";
|
|
2
18
|
import { Toggle, Props } from "./Toggle";
|
|
3
19
|
import { render } from "@testing-library/react";
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
import React, { ComponentPropsWithRef } from "react";
|
|
2
18
|
import { Checkbox, Props as CheckboxProps } from "../Checkbox/Checkbox";
|
|
3
19
|
import classes from "./Toggle.module.scss";
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
.checkbox-wrapper-helper {
|
|
2
18
|
margin-top: 1.25rem;
|
|
3
19
|
}
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
import React, { useEffect, useRef } from "react";
|
|
2
18
|
import { CheckboxWrapper, Props } from "./CheckboxWrapper";
|
|
3
19
|
import { Checkbox, Props as CheckboxProps } from "../../Checkbox/Checkbox";
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
import React, { ComponentPropsWithRef, ReactElement, useEffect } from "react";
|
|
2
18
|
import classes from "./CheckboxWrapper.module.scss";
|
|
3
19
|
import { useWrapper } from "../../../hooks/useWrapper";
|
|
@@ -1,10 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
@import "../../../mixins.module.scss";
|
|
2
18
|
|
|
3
|
-
@include inputLabelPrimaryColorOnFocus("label.input-label");
|
|
19
|
+
@include inputLabelPrimaryColorOnFocus("label.input-label.focus");
|
|
4
20
|
|
|
5
21
|
input {
|
|
6
22
|
&.floating-label {
|
|
7
|
-
padding-top:
|
|
23
|
+
padding-top: 1rem;
|
|
8
24
|
}
|
|
9
25
|
}
|
|
10
26
|
|
|
@@ -12,23 +28,38 @@ input {
|
|
|
12
28
|
margin-top: 0.25rem;
|
|
13
29
|
}
|
|
14
30
|
|
|
15
|
-
.input-wrapper
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
31
|
+
.input-wrapper {
|
|
32
|
+
[data-icon]:before {
|
|
33
|
+
transition: 0.2s ease-in-out;
|
|
34
|
+
transform: translateY(0px);
|
|
35
|
+
font-size: 1.125rem;
|
|
36
|
+
}
|
|
20
37
|
|
|
21
|
-
.
|
|
22
|
-
|
|
23
|
-
}
|
|
38
|
+
.floating-label-active [data-icon]:before {
|
|
39
|
+
transform: translateY(5px);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
[data-prefix],
|
|
43
|
+
[data-suffix] {
|
|
44
|
+
transform: translateY(-0.125rem);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
[data-prefix] + input {
|
|
48
|
+
padding-left: 0.5rem;
|
|
49
|
+
}
|
|
24
50
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
51
|
+
input + [data-suffix] {
|
|
52
|
+
padding-left: 0.5rem;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.disabled {
|
|
56
|
+
background-color: var(--disabled);
|
|
57
|
+
cursor: not-allowed;
|
|
58
|
+
}
|
|
28
59
|
}
|
|
29
60
|
|
|
30
61
|
.floating-label-active [data-prefix],
|
|
31
62
|
.floating-label-active [data-suffix] {
|
|
32
|
-
padding-top:
|
|
63
|
+
padding-top: 1rem;
|
|
33
64
|
transform: translateY(0);
|
|
34
65
|
}
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
import React, { useEffect, useRef } from "react";
|
|
2
18
|
import { InputWrapper, Props } from "./InputWrapper";
|
|
3
19
|
import { render } from "@testing-library/react";
|
|
@@ -58,6 +74,26 @@ describe("InputWrapper should render", () => {
|
|
|
58
74
|
|
|
59
75
|
expect(input).toHaveAttribute("aria-describedby", helperId);
|
|
60
76
|
});
|
|
77
|
+
|
|
78
|
+
it("disabled input", () => {
|
|
79
|
+
const { getByLabelText } = createInputWrapper(defaultParams => ({
|
|
80
|
+
...defaultParams,
|
|
81
|
+
disabled: true
|
|
82
|
+
}));
|
|
83
|
+
|
|
84
|
+
const input = getByLabelText("Example label");
|
|
85
|
+
|
|
86
|
+
expect(input).toBeDisabled();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it("consume wrapper props classname", () => {
|
|
90
|
+
const { container } = createInputWrapper(defaultParams => ({
|
|
91
|
+
...defaultParams,
|
|
92
|
+
inputProps: { wrapperProps: { className: "testClass" } }
|
|
93
|
+
}));
|
|
94
|
+
|
|
95
|
+
expect(container.querySelector(".testClass")).toBeDefined();
|
|
96
|
+
});
|
|
61
97
|
});
|
|
62
98
|
|
|
63
99
|
describe("ref should work", () => {
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
import React, { ComponentPropsWithRef, useEffect, useRef, useState } from "react";
|
|
2
18
|
import { Input, Type, Props as InputProps } from "../../Input/Input";
|
|
3
19
|
import classes from "./InputWrapper.module.scss";
|
|
@@ -56,6 +72,7 @@ export const InputWrapper = React.forwardRef<HTMLDivElement, Props>(
|
|
|
56
72
|
onChange,
|
|
57
73
|
onBlur,
|
|
58
74
|
onFocus,
|
|
75
|
+
disabled,
|
|
59
76
|
...rest
|
|
60
77
|
}: Props,
|
|
61
78
|
ref
|
|
@@ -72,15 +89,21 @@ export const InputWrapper = React.forwardRef<HTMLDivElement, Props>(
|
|
|
72
89
|
const { prefix, suffix } = inputProps || {};
|
|
73
90
|
const input = useRef<HTMLInputElement>(null);
|
|
74
91
|
const hasValueOrActiveFloatingLabel = !!value || floatingLabelActive;
|
|
75
|
-
const labelClasses = [classes["input-label"]];
|
|
76
92
|
const { labelOffset } = useLabelOffset(
|
|
77
93
|
(inputProps && (inputProps.ref as React.RefObject<HTMLInputElement>)) || input,
|
|
78
94
|
floatingLabelActive,
|
|
79
95
|
prefix
|
|
80
96
|
);
|
|
81
97
|
|
|
98
|
+
const labelClasses = [classes["input-label"]];
|
|
82
99
|
hasFocus && labelClasses.push(classes["focus"]);
|
|
83
100
|
|
|
101
|
+
const inputWrapperClasses = [];
|
|
102
|
+
floatingLabelActive && inputWrapperClasses.push(classes["floating-label-active"]);
|
|
103
|
+
inputProps?.wrapperProps?.className &&
|
|
104
|
+
inputWrapperClasses.push(inputProps?.wrapperProps?.className);
|
|
105
|
+
disabled && inputWrapperClasses.push(classes["disabled"]);
|
|
106
|
+
|
|
84
107
|
return (
|
|
85
108
|
<Wrapper
|
|
86
109
|
{...rest}
|
|
@@ -102,15 +125,14 @@ export const InputWrapper = React.forwardRef<HTMLDivElement, Props>(
|
|
|
102
125
|
className: `${classes["input-wrapper-helper"]} ${helperProps?.className ?? ""} `
|
|
103
126
|
}}
|
|
104
127
|
helperIndent={20}
|
|
128
|
+
disabled={disabled}
|
|
105
129
|
>
|
|
106
130
|
<Input
|
|
107
131
|
{...inputProps}
|
|
108
132
|
prefix={hasValueOrActiveFloatingLabel ? prefix : ""}
|
|
109
133
|
suffix={hasValueOrActiveFloatingLabel ? suffix : ""}
|
|
110
134
|
wrapperProps={{
|
|
111
|
-
className:
|
|
112
|
-
inputProps?.wrapperProps?.className ?? ""
|
|
113
|
-
}`
|
|
135
|
+
className: inputWrapperClasses.join(" ")
|
|
114
136
|
}}
|
|
115
137
|
ref={(inputProps && inputProps.ref) || input}
|
|
116
138
|
aria-labelledby={labelId}
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
.radio-wrapper-helper {
|
|
2
18
|
margin-top: 1.25rem;
|
|
3
19
|
}
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
import React from "react";
|
|
2
18
|
import { RadioWrapper, Props } from "./RadioWrapper";
|
|
3
19
|
import { Radio } from "../../Radio/Radio";
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
import React, { ComponentPropsWithRef, ReactElement, useEffect } from "react";
|
|
2
18
|
import classes from "./RadioWrapper.module.scss";
|
|
3
19
|
import { Wrapper, WrapperProps } from "../Wrapper/Wrapper";
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
.select-label {
|
|
2
18
|
left: calc(
|
|
3
19
|
1.25rem + 2px
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
import React, { useEffect, useRef } from "react";
|
|
2
18
|
import { SelectWrapper, Props } from "./SelectWrapper";
|
|
3
19
|
import { render } from "@testing-library/react";
|
|
@@ -5,7 +21,6 @@ import { Option } from "../../Select/Option";
|
|
|
5
21
|
import userEvent from "@testing-library/user-event";
|
|
6
22
|
|
|
7
23
|
const onChangeHandler = jest.fn();
|
|
8
|
-
const onClearHandler = jest.fn();
|
|
9
24
|
|
|
10
25
|
const defaultParams: Props = {
|
|
11
26
|
children: [
|
|
@@ -29,8 +44,7 @@ const defaultParams: Props = {
|
|
|
29
44
|
errorMessage: "errormessage",
|
|
30
45
|
error: false,
|
|
31
46
|
value: "option1",
|
|
32
|
-
onChange: onChangeHandler
|
|
33
|
-
onClear: onClearHandler
|
|
47
|
+
onChange: onChangeHandler
|
|
34
48
|
};
|
|
35
49
|
|
|
36
50
|
const createSelectWrapper = (params?: (defaultParams: Props) => Props) => {
|
|
@@ -168,20 +182,4 @@ describe("SelectWrapper & Select have the right attributes", () => {
|
|
|
168
182
|
|
|
169
183
|
expect(onChangeHandler).toHaveBeenCalled();
|
|
170
184
|
});
|
|
171
|
-
|
|
172
|
-
it("Fires the onClear event", async () => {
|
|
173
|
-
const { select, findByText } = createSelectWrapper();
|
|
174
|
-
|
|
175
|
-
userEvent.click(select as Element);
|
|
176
|
-
|
|
177
|
-
const option3 = await findByText("Option 3");
|
|
178
|
-
|
|
179
|
-
userEvent.click(option3 as Element);
|
|
180
|
-
|
|
181
|
-
const clearButton = select!.querySelector("[data-clear]")!;
|
|
182
|
-
|
|
183
|
-
userEvent.click(clearButton);
|
|
184
|
-
|
|
185
|
-
expect(onClearHandler).toHaveBeenCalled();
|
|
186
|
-
});
|
|
187
185
|
});
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
import React, { ComponentPropsWithRef, ReactChild, ReactElement } from "react";
|
|
2
18
|
import classes from "./SelectWrapper.module.scss";
|
|
3
19
|
import { Wrapper, WrapperProps } from "../Wrapper/Wrapper";
|
|
@@ -15,22 +31,11 @@ export interface Props
|
|
|
15
31
|
error?: boolean;
|
|
16
32
|
selectProps?: PartialSelectProps;
|
|
17
33
|
onChange?: (event: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
18
|
-
onClear?: (event: React.MouseEvent<HTMLDivElement> | React.KeyboardEvent<HTMLDivElement>) => void;
|
|
19
34
|
}
|
|
20
35
|
|
|
21
36
|
export const SelectWrapper = React.forwardRef<HTMLDivElement, Props>(
|
|
22
37
|
(
|
|
23
|
-
{
|
|
24
|
-
children,
|
|
25
|
-
error,
|
|
26
|
-
value,
|
|
27
|
-
placeholder,
|
|
28
|
-
selectProps,
|
|
29
|
-
helperProps,
|
|
30
|
-
onChange,
|
|
31
|
-
onClear,
|
|
32
|
-
...rest
|
|
33
|
-
}: Props,
|
|
38
|
+
{ children, error, value, placeholder, selectProps, helperProps, onChange, ...rest }: Props,
|
|
34
39
|
ref
|
|
35
40
|
) => {
|
|
36
41
|
const { errorId, floatingLabelActive, helperId, labelId } = useWrapper(value, placeholder);
|
|
@@ -56,9 +61,6 @@ export const SelectWrapper = React.forwardRef<HTMLDivElement, Props>(
|
|
|
56
61
|
error={error}
|
|
57
62
|
describedBy={error ? errorId : helperId}
|
|
58
63
|
onChange={onChange}
|
|
59
|
-
onClear={e => {
|
|
60
|
-
onClear && onClear(e);
|
|
61
|
-
}}
|
|
62
64
|
placeholder={placeholder}
|
|
63
65
|
className={`${floatingLabelActive ? classes["floating-label-active"] : ""} ${
|
|
64
66
|
selectProps?.className ?? ""
|
|
@@ -1,7 +1,48 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2022 OneWelcome B.V.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
1
17
|
@import "../../../mixins.module.scss";
|
|
2
18
|
|
|
3
19
|
@include inputLabelPrimaryColorOnFocus("label.textarea-label");
|
|
4
20
|
|
|
21
|
+
.textarea-wrapper {
|
|
22
|
+
&:after {
|
|
23
|
+
content: "";
|
|
24
|
+
transition: all 0.15s ease-in-out;
|
|
25
|
+
display: block;
|
|
26
|
+
width: calc(95%);
|
|
27
|
+
height: 1.625rem;
|
|
28
|
+
background-color: var(--light);
|
|
29
|
+
position: absolute;
|
|
30
|
+
z-index: 0;
|
|
31
|
+
left: 1px;
|
|
32
|
+
top: 1px;
|
|
33
|
+
border-radius: var(--input-border-radius) var(--input-border-radius) 0 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&.disabled:after {
|
|
37
|
+
background-color: var(--disabled);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&.focus:after {
|
|
41
|
+
left: 2px;
|
|
42
|
+
top: 2px;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
5
46
|
.textarea {
|
|
6
47
|
padding-top: 1.625rem;
|
|
7
48
|
|
|
@@ -9,10 +50,6 @@
|
|
|
9
50
|
border-color: var(--color-primary);
|
|
10
51
|
}
|
|
11
52
|
|
|
12
|
-
&:hover:not(:disabled):not(.error) {
|
|
13
|
-
border-color: var(--default);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
53
|
&:focus:not(:disabled) {
|
|
17
54
|
outline: none;
|
|
18
55
|
}
|
|
@@ -23,35 +60,6 @@
|
|
|
23
60
|
margin-left: 1.25rem;
|
|
24
61
|
}
|
|
25
62
|
|
|
26
|
-
.textarea-wrapper {
|
|
27
|
-
padding-top: 1.75rem;
|
|
28
|
-
padding-right: 3.75rem;
|
|
29
|
-
padding-bottom: 0.75rem;
|
|
30
|
-
border-color: var(--input-border-color);
|
|
31
|
-
border-style: var(--input-border-style);
|
|
32
|
-
border-width: var(--input-border-width);
|
|
33
|
-
border-radius: var(--input-border-radius);
|
|
34
|
-
|
|
35
|
-
&.error {
|
|
36
|
-
border-color: var(--error);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&.hover {
|
|
40
|
-
border-color: var(--default);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
&.focus {
|
|
44
|
-
border-color: var(--color-primary);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
&.disabled {
|
|
48
|
-
color: var(--greyed-out);
|
|
49
|
-
background-color: var(--disabled);
|
|
50
|
-
border-color: #fff;
|
|
51
|
-
cursor: not-allowed;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
63
|
.error-icon {
|
|
56
64
|
top: 1.75rem;
|
|
57
65
|
}
|