@x15ventures/x15-ui-library 3.16.1 → 3.18.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/dist/cjs/autoGenerated/libraryThemes.js +12 -12
- package/dist/cjs/autoGenerated/libraryThemes.js.map +1 -1
- package/dist/cjs/autoGenerated/libraryThemes.json +12 -12
- package/dist/cjs/components/design/accordion/Accordion.js +7 -23
- package/dist/cjs/components/design/accordion/Accordion.js.map +1 -1
- package/dist/cjs/components/design/banners/pageBanner/PageBanner.js +2 -4
- package/dist/cjs/components/design/banners/pageBanner/PageBanner.js.map +1 -1
- package/dist/cjs/components/design/card/cardContent/CardContentLine.js +2 -2
- package/dist/cjs/components/design/card/cardContent/CardContentLine.js.map +1 -1
- package/dist/cjs/components/design/card/cardHeader/CardHeaderItem.js +2 -2
- package/dist/cjs/components/design/card/cardHeader/CardHeaderItem.js.map +1 -1
- package/dist/cjs/components/design/dialog/Dialog.js +3 -1
- package/dist/cjs/components/design/dialog/Dialog.js.map +1 -1
- package/dist/cjs/components/design/dialog/dialog.css +5 -0
- package/dist/cjs/components/design/headerBar/HeaderBar.js +3 -3
- package/dist/cjs/components/design/headerBar/HeaderBar.js.map +1 -1
- package/dist/cjs/components/design/icons/notificationIcon/NotificationIcon.js +4 -5
- package/dist/cjs/components/design/icons/notificationIcon/NotificationIcon.js.map +1 -1
- package/dist/cjs/components/design/paginators/Paginator.js +4 -12
- package/dist/cjs/components/design/paginators/Paginator.js.map +1 -1
- package/dist/cjs/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.js +89 -0
- package/dist/cjs/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.js.map +1 -0
- package/dist/cjs/components/design/progressIndicators/circularProgressIndicator/circularProgressIndicator.css +301 -0
- package/dist/cjs/components/design/revealMore/RevealMoreBelow.js +1 -3
- package/dist/cjs/components/design/revealMore/RevealMoreBelow.js.map +1 -1
- package/dist/cjs/components/design/revealMore/RevealMoreInline.js +3 -5
- package/dist/cjs/components/design/revealMore/RevealMoreInline.js.map +1 -1
- package/dist/cjs/components/design/revealMore/types/revealMoreTypes.js.map +1 -1
- package/dist/cjs/components/design/sidePanel/SidePanel.js +3 -5
- package/dist/cjs/components/design/sidePanel/SidePanel.js.map +1 -1
- package/dist/cjs/components/design/statusIndicators/statusIconLabel/StatusIconLabel.js +6 -11
- package/dist/cjs/components/design/statusIndicators/statusIconLabel/StatusIconLabel.js.map +1 -1
- package/dist/cjs/components/design/tabs/Tabs.js +2 -2
- package/dist/cjs/components/design/tabs/Tabs.js.map +1 -1
- package/dist/cjs/components/design/themeLoader/ThemeLoader.js +2 -2
- package/dist/cjs/components/design/themeLoader/ThemeLoader.js.map +1 -1
- package/dist/cjs/components/design/tooltip/Tooltip.js +43 -13
- package/dist/cjs/components/design/tooltip/Tooltip.js.map +1 -1
- package/dist/cjs/components/design/tooltip/index.js +6 -0
- package/dist/cjs/components/design/tooltip/index.js.map +1 -1
- package/dist/cjs/components/design/tooltip/tooltip.css +18 -7
- package/dist/cjs/components/form/buttons/SimpleButton.js +3 -3
- package/dist/cjs/components/form/buttons/SimpleButton.js.map +1 -1
- package/dist/cjs/components/form/buttons/button.interface.js.map +1 -1
- package/dist/cjs/components/form/formFields/formFieldWrapper/formFieldProps.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js +5 -5
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.js +176 -0
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.js.map +1 -0
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/_checkboxSwitchVariables.css +0 -0
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitch.css +306 -0
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.js +6 -0
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.js.map +1 -0
- package/dist/cjs/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js +3 -5
- package/dist/cjs/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.js +12 -22
- package/dist/cjs/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/file/fileInputProps.js.map +1 -1
- package/dist/cjs/components/index.js +14 -0
- package/dist/cjs/components/index.js.map +1 -1
- package/dist/cjs/components/navigation/menu/Menu.interfaces.js.map +1 -1
- package/dist/cjs/components/navigation/menu/menuItemContent/MenuItemIcon.js +19 -31
- package/dist/cjs/components/navigation/menu/menuItemContent/MenuItemIcon.js.map +1 -1
- package/dist/cjs/helpers/iconHelpers.js +83 -0
- package/dist/cjs/helpers/iconHelpers.js.map +1 -0
- package/dist/cjs/helpers/index.js +43 -0
- package/dist/cjs/helpers/index.js.map +1 -1
- package/dist/cjs/helpers/objectHelpers.js +9 -2
- package/dist/cjs/helpers/objectHelpers.js.map +1 -1
- package/dist/cjs/hooks/InteractiveHostFocus.js +62 -0
- package/dist/cjs/hooks/InteractiveHostFocus.js.map +1 -0
- package/dist/cjs/hooks/index.js +7 -0
- package/dist/cjs/hooks/index.js.map +1 -1
- package/dist/cjs/index.js +79 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces/headerText.interface.js.map +1 -1
- package/dist/cjs/package.json +16 -28
- package/dist/cjs/styles/index.css +61 -0
- package/dist/cjs/styles/storybook/storybook.css +7 -0
- package/dist/cjs/styles/variables/cssVars/_darkModeVariables.css +21 -0
- package/dist/cjs/styles/variables/cssVars/_formVariables.css +40 -0
- package/dist/cjs/widgets/index.js +14 -0
- package/dist/cjs/widgets/index.js.map +1 -0
- package/dist/cjs/widgets/processLauncher/ProcessLauncher.js +272 -0
- package/dist/cjs/widgets/processLauncher/ProcessLauncher.js.map +1 -0
- package/dist/cjs/widgets/processLauncher/index.js +13 -0
- package/dist/cjs/widgets/processLauncher/index.js.map +1 -0
- package/dist/cjs/widgets/processLauncher/processLauncher.interfaces.js +6 -0
- package/dist/cjs/widgets/processLauncher/processLauncher.interfaces.js.map +1 -0
- package/dist/components/design/accordion/Accordion.d.ts +3 -2
- package/dist/components/design/accordion/Accordion.d.ts.map +1 -1
- package/dist/components/design/banners/pageBanner/PageBanner.d.ts +2 -1
- package/dist/components/design/banners/pageBanner/PageBanner.d.ts.map +1 -1
- package/dist/components/design/card/cardContent/CardContentLine.d.ts +2 -2
- package/dist/components/design/card/cardContent/CardContentLine.d.ts.map +1 -1
- package/dist/components/design/card/cardHeader/CardHeaderItem.d.ts +2 -2
- package/dist/components/design/card/cardHeader/CardHeaderItem.d.ts.map +1 -1
- package/dist/components/design/dialog/Dialog.d.ts.map +1 -1
- package/dist/components/design/headerBar/HeaderBar.d.ts.map +1 -1
- package/dist/components/design/icons/notificationIcon/NotificationIcon.d.ts +2 -2
- package/dist/components/design/icons/notificationIcon/NotificationIcon.d.ts.map +1 -1
- package/dist/components/design/paginators/Paginator.d.ts +3 -2
- package/dist/components/design/paginators/Paginator.d.ts.map +1 -1
- package/dist/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.d.ts +18 -0
- package/dist/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.d.ts.map +1 -0
- package/dist/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.test.d.ts +5 -0
- package/dist/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.test.d.ts.map +1 -0
- package/dist/components/design/revealMore/RevealMoreBelow.d.ts.map +1 -1
- package/dist/components/design/revealMore/RevealMoreInline.d.ts.map +1 -1
- package/dist/components/design/revealMore/types/revealMoreTypes.d.ts +3 -2
- package/dist/components/design/revealMore/types/revealMoreTypes.d.ts.map +1 -1
- package/dist/components/design/sidePanel/SidePanel.d.ts +3 -2
- package/dist/components/design/sidePanel/SidePanel.d.ts.map +1 -1
- package/dist/components/design/statusIndicators/statusIconLabel/StatusIconLabel.d.ts +2 -2
- package/dist/components/design/statusIndicators/statusIconLabel/StatusIconLabel.d.ts.map +1 -1
- package/dist/components/design/tabs/Tabs.d.ts +3 -3
- package/dist/components/design/tabs/Tabs.d.ts.map +1 -1
- package/dist/components/design/tooltip/Tooltip.d.ts +17 -3
- package/dist/components/design/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/design/tooltip/Tooltip.test.d.ts +1 -1
- package/dist/components/design/tooltip/Tooltip.test.d.ts.map +1 -1
- package/dist/components/design/tooltip/index.d.ts +1 -1
- package/dist/components/design/tooltip/index.d.ts.map +1 -1
- package/dist/components/form/buttons/SimpleButton.test.d.ts +5 -0
- package/dist/components/form/buttons/SimpleButton.test.d.ts.map +1 -0
- package/dist/components/form/buttons/button.interface.d.ts +3 -3
- package/dist/components/form/buttons/button.interface.d.ts.map +1 -1
- package/dist/components/form/formFields/formFieldWrapper/formFieldProps.d.ts +2 -1
- package/dist/components/form/formFields/formFieldWrapper/formFieldProps.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.d.ts +29 -0
- package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.d.ts.map +1 -0
- package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.test.d.ts +5 -0
- package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.test.d.ts.map +1 -0
- package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.d.ts +52 -0
- package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.d.ts.map +1 -0
- package/dist/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.d.ts +3 -3
- package/dist/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/inputs/file/fileInputProps.d.ts +4 -3
- package/dist/components/form/formFields/subComponents/inputs/file/fileInputProps.d.ts.map +1 -1
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/navigation/menu/Menu.interfaces.d.ts +4 -3
- package/dist/components/navigation/menu/Menu.interfaces.d.ts.map +1 -1
- package/dist/components/navigation/menu/menuItemContent/MenuItemIcon.d.ts +2 -1
- package/dist/components/navigation/menu/menuItemContent/MenuItemIcon.d.ts.map +1 -1
- package/dist/components/navigation/menu/menuItemContent/MenuItemIcon.test.d.ts +5 -0
- package/dist/components/navigation/menu/menuItemContent/MenuItemIcon.test.d.ts.map +1 -0
- package/dist/esm/autoGenerated/libraryThemes.js +12 -12
- package/dist/esm/autoGenerated/libraryThemes.js.map +1 -1
- package/dist/esm/autoGenerated/libraryThemes.json +12 -12
- package/dist/esm/components/design/accordion/Accordion.js +7 -23
- package/dist/esm/components/design/accordion/Accordion.js.map +1 -1
- package/dist/esm/components/design/banners/pageBanner/PageBanner.js +2 -4
- package/dist/esm/components/design/banners/pageBanner/PageBanner.js.map +1 -1
- package/dist/esm/components/design/card/cardContent/CardContentLine.js +2 -2
- package/dist/esm/components/design/card/cardContent/CardContentLine.js.map +1 -1
- package/dist/esm/components/design/card/cardHeader/CardHeaderItem.js +2 -2
- package/dist/esm/components/design/card/cardHeader/CardHeaderItem.js.map +1 -1
- package/dist/esm/components/design/dialog/Dialog.js +3 -1
- package/dist/esm/components/design/dialog/Dialog.js.map +1 -1
- package/dist/esm/components/design/dialog/dialog.css +5 -0
- package/dist/esm/components/design/headerBar/HeaderBar.js +3 -3
- package/dist/esm/components/design/headerBar/HeaderBar.js.map +1 -1
- package/dist/esm/components/design/icons/notificationIcon/NotificationIcon.js +4 -5
- package/dist/esm/components/design/icons/notificationIcon/NotificationIcon.js.map +1 -1
- package/dist/esm/components/design/paginators/Paginator.js +4 -12
- package/dist/esm/components/design/paginators/Paginator.js.map +1 -1
- package/dist/esm/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.js +82 -0
- package/dist/esm/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.js.map +1 -0
- package/dist/esm/components/design/progressIndicators/circularProgressIndicator/circularProgressIndicator.css +301 -0
- package/dist/esm/components/design/revealMore/RevealMoreBelow.js +1 -3
- package/dist/esm/components/design/revealMore/RevealMoreBelow.js.map +1 -1
- package/dist/esm/components/design/revealMore/RevealMoreInline.js +2 -4
- package/dist/esm/components/design/revealMore/RevealMoreInline.js.map +1 -1
- package/dist/esm/components/design/revealMore/types/revealMoreTypes.js.map +1 -1
- package/dist/esm/components/design/sidePanel/SidePanel.js +3 -5
- package/dist/esm/components/design/sidePanel/SidePanel.js.map +1 -1
- package/dist/esm/components/design/statusIndicators/statusIconLabel/StatusIconLabel.js +6 -11
- package/dist/esm/components/design/statusIndicators/statusIconLabel/StatusIconLabel.js.map +1 -1
- package/dist/esm/components/design/tabs/Tabs.js +2 -2
- package/dist/esm/components/design/tabs/Tabs.js.map +1 -1
- package/dist/esm/components/design/themeLoader/ThemeLoader.js +1 -1
- package/dist/esm/components/design/themeLoader/ThemeLoader.js.map +1 -1
- package/dist/esm/components/design/tooltip/Tooltip.js +41 -12
- package/dist/esm/components/design/tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/design/tooltip/index.js +1 -1
- package/dist/esm/components/design/tooltip/index.js.map +1 -1
- package/dist/esm/components/design/tooltip/tooltip.css +18 -7
- package/dist/esm/components/form/buttons/SimpleButton.js +3 -3
- package/dist/esm/components/form/buttons/SimpleButton.js.map +1 -1
- package/dist/esm/components/form/buttons/button.interface.js.map +1 -1
- package/dist/esm/components/form/formFields/formFieldWrapper/formFieldProps.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js +5 -5
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.js +167 -0
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.js.map +1 -0
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/_checkboxSwitchVariables.css +0 -0
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitch.css +306 -0
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.js +2 -0
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.js.map +1 -0
- package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js +3 -5
- package/dist/esm/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.js +12 -22
- package/dist/esm/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/file/fileInputProps.js.map +1 -1
- package/dist/esm/components/index.js +2 -0
- package/dist/esm/components/index.js.map +1 -1
- package/dist/esm/components/navigation/menu/Menu.interfaces.js.map +1 -1
- package/dist/esm/components/navigation/menu/menuItemContent/MenuItemIcon.js +17 -30
- package/dist/esm/components/navigation/menu/menuItemContent/MenuItemIcon.js.map +1 -1
- package/dist/esm/helpers/iconHelpers.js +73 -0
- package/dist/esm/helpers/iconHelpers.js.map +1 -0
- package/dist/esm/helpers/index.js +2 -1
- package/dist/esm/helpers/index.js.map +1 -1
- package/dist/esm/helpers/objectHelpers.js +7 -3
- package/dist/esm/helpers/objectHelpers.js.map +1 -1
- package/dist/esm/hooks/InteractiveHostFocus.js +56 -0
- package/dist/esm/hooks/InteractiveHostFocus.js.map +1 -0
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/index.js +5 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/headerText.interface.js.map +1 -1
- package/dist/esm/package.json +16 -28
- package/dist/esm/styles/index.css +61 -0
- package/dist/esm/styles/storybook/storybook.css +7 -0
- package/dist/esm/styles/variables/cssVars/_darkModeVariables.css +21 -0
- package/dist/esm/styles/variables/cssVars/_formVariables.css +40 -0
- package/dist/esm/widgets/index.js +4 -0
- package/dist/esm/widgets/index.js.map +1 -0
- package/dist/esm/widgets/processLauncher/ProcessLauncher.js +263 -0
- package/dist/esm/widgets/processLauncher/ProcessLauncher.js.map +1 -0
- package/dist/esm/widgets/processLauncher/index.js +2 -0
- package/dist/esm/widgets/processLauncher/index.js.map +1 -0
- package/dist/esm/widgets/processLauncher/processLauncher.interfaces.js +2 -0
- package/dist/esm/widgets/processLauncher/processLauncher.interfaces.js.map +1 -0
- package/dist/helpers/iconHelpers.d.ts +30 -0
- package/dist/helpers/iconHelpers.d.ts.map +1 -0
- package/dist/helpers/iconHelpers.test.d.ts +5 -0
- package/dist/helpers/iconHelpers.test.d.ts.map +1 -0
- package/dist/helpers/index.d.ts +4 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/objectHelpers.d.ts +10 -3
- package/dist/helpers/objectHelpers.d.ts.map +1 -1
- package/dist/hooks/InteractiveHostFocus.d.ts +12 -0
- package/dist/hooks/InteractiveHostFocus.d.ts.map +1 -0
- package/dist/hooks/InteractiveHostFocus.test.d.ts +5 -0
- package/dist/hooks/InteractiveHostFocus.test.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/interfaces/headerText.interface.d.ts +3 -3
- package/dist/interfaces/headerText.interface.d.ts.map +1 -1
- package/dist/package.json +16 -28
- package/dist/widgets/index.d.ts +3 -0
- package/dist/widgets/index.d.ts.map +1 -0
- package/dist/widgets/processLauncher/ProcessLauncher.d.ts +21 -0
- package/dist/widgets/processLauncher/ProcessLauncher.d.ts.map +1 -0
- package/dist/widgets/processLauncher/ProcessLauncher.test.d.ts +5 -0
- package/dist/widgets/processLauncher/ProcessLauncher.test.d.ts.map +1 -0
- package/dist/widgets/processLauncher/index.d.ts +4 -0
- package/dist/widgets/processLauncher/index.d.ts.map +1 -0
- package/dist/widgets/processLauncher/processLauncher.interfaces.d.ts +45 -0
- package/dist/widgets/processLauncher/processLauncher.interfaces.d.ts.map +1 -0
- package/package.json +16 -28
- package/readme.md +0 -36
|
@@ -6,7 +6,7 @@ import { HookFormWrapper } from '../../../../hookFormWrapper/HookFormWrapper';
|
|
|
6
6
|
import { FormFieldLabel } from '../../labels/FormFieldLabel';
|
|
7
7
|
import { ValidationMessages } from '../../../../validation/ValidationMessages';
|
|
8
8
|
import { Spinner } from '../../../../../design/spinner/Spinner';
|
|
9
|
-
import {
|
|
9
|
+
import { renderIcon } from '../../../../../../helpers/iconHelpers';
|
|
10
10
|
import './inputCheckbox.css';
|
|
11
11
|
export const InputCheckbox = props => /*#__PURE__*/React.createElement(HookFormWrapper, {
|
|
12
12
|
formContext: props.formContext
|
|
@@ -64,11 +64,11 @@ const InputCheckboxField = ({
|
|
|
64
64
|
isRequired,
|
|
65
65
|
customContent
|
|
66
66
|
};
|
|
67
|
-
const checkedIcon = icons?.checked
|
|
68
|
-
|
|
67
|
+
const checkedIcon = renderIcon(icons?.checked, {
|
|
68
|
+
fallback: 'checkbox-checked'
|
|
69
69
|
});
|
|
70
|
-
const uncheckedIcon = icons?.unchecked
|
|
71
|
-
|
|
70
|
+
const uncheckedIcon = renderIcon(icons?.unchecked, {
|
|
71
|
+
fallback: 'checkbox-unchecked'
|
|
72
72
|
});
|
|
73
73
|
const inputProps = {
|
|
74
74
|
type: 'checkbox',
|
package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputCheckbox.js","names":["React","useEffect","useState","useFormContext","HookFormWrapper","FormFieldLabel","ValidationMessages","Spinner","
|
|
1
|
+
{"version":3,"file":"InputCheckbox.js","names":["React","useEffect","useState","useFormContext","HookFormWrapper","FormFieldLabel","ValidationMessages","Spinner","renderIcon","InputCheckbox","props","createElement","formContext","InputCheckboxField","label","field","id","name","value","defaultChecked","onBlur","onChange","onTouched","validation","showSpinner","icons","customCssClasses","customContent","isTouched","setIsTouched","register","getFieldState","setValue","fieldState","shouldValidate","shouldDirty","wrapperCssClass","wrapper","inputCssClass","input","invalid","isRequired","required","HandleOnBlur","event","target","labelProps","inputId","checkedIcon","checked","fallback","uncheckedIcon","unchecked","inputProps","type","String","className","labelId","htmlFor","position","CheckboxInput"],"sources":["../../../../../../../../src/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.tsx"],"sourcesContent":["'use client';\n\nimport React, { useEffect, useState } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { HookFormWrapper } from '../../../../hookFormWrapper/HookFormWrapper';\nimport { FormFieldLabel } from '../../labels/FormFieldLabel';\nimport { ValidationMessages } from '../../../../validation/ValidationMessages';\nimport { Spinner } from '../../../../../design/spinner/Spinner';\nimport { renderIcon } from '../../../../../../helpers/iconHelpers';\n\nimport { InputCheckboxProps } from './inputCheckboxProps';\n\nimport './inputCheckbox.scss';\n\nexport const InputCheckbox: React.FC<InputCheckboxProps> = (props) => (\n <HookFormWrapper formContext={ props.formContext }>\n <InputCheckboxField { ...props } />\n </HookFormWrapper>\n);\n\nconst InputCheckboxField: React.FC<InputCheckboxProps> = (\n {\n label,\n field: {\n id,\n name,\n value,\n defaultChecked,\n onBlur = () => {},\n onChange = () => {},\n onTouched = () => {}\n },\n validation,\n showSpinner,\n icons,\n customCssClasses,\n customContent\n }\n) => {\n const [isTouched, setIsTouched] = useState(false);\n const { register, getFieldState, setValue } = useFormContext();\n const fieldState = getFieldState(name);\n\n // Initialize the form value with defaultChecked on mount\n useEffect(() => {\n if (defaultChecked) {\n setValue(name, true, { shouldValidate: false, shouldDirty: false });\n }\n }, [name, setValue, defaultChecked, value]);\n\n const wrapperCssClass = `formField checkBoxField ${ customCssClasses?.wrapper || '' } ${ isTouched ? 'touched' : '' }`;\n\n const inputCssClass = `${ customCssClasses?.input || '' }${ fieldState?.invalid ? ' invalidField' : '' }`;\n\n const isRequired = validation && typeof validation.required !== 'undefined';\n\n const HandleOnBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n const { target } = event;\n setIsTouched(true);\n if (target) {\n onTouched();\n onBlur(event);\n }\n };\n\n const labelProps = {\n ...label,\n inputId: id,\n isRequired,\n customContent\n };\n\n const checkedIcon = renderIcon(icons?.checked, { fallback: 'checkbox-checked' });\n const uncheckedIcon = renderIcon(icons?.unchecked, { fallback: 'checkbox-unchecked' });\n\n const inputProps = {\n type: 'checkbox',\n id,\n value: String(value),\n className: inputCssClass,\n 'aria-required': isRequired,\n ...register(\n name,\n {\n onChange,\n onBlur: HandleOnBlur,\n value: defaultChecked ? true : value,\n ...validation\n }\n )\n };\n\n return (\n <div\n className={ wrapperCssClass }\n >\n <label\n id={ label.labelId || `${ id }_label` }\n className={ `${ customCssClasses?.label || '' } ${ showSpinner ? 'withSpinner' : '' }` }\n htmlFor={ id }\n >\n\n { label.position === 'left'\n && <FormFieldLabel { ...labelProps } /> }\n\n <div className=\"inputContainer\">\n <input { ...inputProps } />\n { /* The input conveys the checked state, so the icons are decorative. */ }\n <span className=\"checkboxIcons\" aria-hidden=\"true\">\n <span className=\"checkboxIcon checkboxIconUnchecked\">{ uncheckedIcon }</span>\n <span className=\"checkboxIcon checkboxIconChecked\">{ checkedIcon }</span>\n </span>\n </div>\n\n { (!label?.position || label?.position === 'right')\n && <FormFieldLabel { ...labelProps } /> }\n\n {\n showSpinner && <Spinner />\n }\n\n <ValidationMessages name={ name } validation={ validation } />\n </label>\n </div>\n );\n};\n\nexport const CheckboxInput: React.FC<InputCheckboxProps> = (props) => <InputCheckbox { ...props } />;\n"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAClD,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,eAAe,QAAQ,6CAA6C;AAC7E,SAASC,cAAc,QAAQ,6BAA6B;AAC5D,SAASC,kBAAkB,QAAQ,2CAA2C;AAC9E,SAASC,OAAO,QAAQ,uCAAuC;AAC/D,SAASC,UAAU,QAAQ,uCAAuC;AAIlE,OAAO,sBAAsB;AAE7B,OAAO,MAAMC,aAA2C,GAAIC,KAAK,iBAC/DV,KAAA,CAAAW,aAAA,CAACP,eAAe;EAACQ,WAAW,EAAGF,KAAK,CAACE;AAAa,gBAChDZ,KAAA,CAAAW,aAAA,CAACE,kBAAkB,EAAMH,KAAS,CACnB,CAClB;AAED,MAAMG,kBAAgD,GAAGA,CACvD;EACEC,KAAK;EACLC,KAAK,EAAE;IACLC,EAAE;IACFC,IAAI;IACJC,KAAK;IACLC,cAAc;IACdC,MAAM,GAAGA,CAAA,KAAM,CAAC,CAAC;IACjBC,QAAQ,GAAGA,CAAA,KAAM,CAAC,CAAC;IACnBC,SAAS,GAAGA,CAAA,KAAM,CAAC;EACrB,CAAC;EACDC,UAAU;EACVC,WAAW;EACXC,KAAK;EACLC,gBAAgB;EAChBC;AACF,CAAC,KACE;EACH,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAG3B,QAAQ,CAAC,KAAK,CAAC;EAC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GvCtB,WAAW,iBAAIxB,KAAA,CAAAW,aAAA,CAACJ,OAAO,MAAE,CAAC,eAG5BP,KAAA,CAAAW,aAAA,CAACL,kBAAkB;IAACW,IAAI,EAAGA,IAAM;IAACM,UAAU,EAAGA;EAAY,CAAE,CACxD,CACJ,CAAC;AAEV,CAAC;AAED,OAAO,MAAMqC,aAA2C,GAAIlD,KAAK,iBAAKV,KAAA,CAAAW,aAAA,CAACF,aAAa,EAAMC,KAAS,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
|
+
import { useFormContext } from 'react-hook-form';
|
|
6
|
+
import { HookFormWrapper } from '../../../../../hookFormWrapper/HookFormWrapper';
|
|
7
|
+
import { FormFieldLabel } from '../../../labels/FormFieldLabel';
|
|
8
|
+
import { ValidationMessages } from '../../../../../validation/ValidationMessages';
|
|
9
|
+
import { Spinner } from '../../../../../../design/spinner/Spinner';
|
|
10
|
+
import { renderIcon } from '../../../../../../../helpers/iconHelpers';
|
|
11
|
+
import { cssClassesArrayToString } from '../../../../../../../helpers/arrayHelpers';
|
|
12
|
+
import { generateButtonClass } from '../../../../../buttons/button.helpers';
|
|
13
|
+
import './checkboxSwitch.css';
|
|
14
|
+
export const DEFAULT_CHECKBOX_SWITCH_STATES = {
|
|
15
|
+
checked: {
|
|
16
|
+
label: 'On'
|
|
17
|
+
},
|
|
18
|
+
unchecked: {
|
|
19
|
+
label: 'Off'
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export const DEFAULT_POWER_BUTTON_STATES = {
|
|
23
|
+
checked: {
|
|
24
|
+
label: 'On',
|
|
25
|
+
icon: 'switch'
|
|
26
|
+
},
|
|
27
|
+
unchecked: {
|
|
28
|
+
label: 'Off',
|
|
29
|
+
icon: 'switch'
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export const CheckboxSwitchState = ({
|
|
33
|
+
state,
|
|
34
|
+
label,
|
|
35
|
+
icon,
|
|
36
|
+
cssClass,
|
|
37
|
+
buttonStyle,
|
|
38
|
+
hideLabel
|
|
39
|
+
}) => {
|
|
40
|
+
const stateClass = state === 'checked' ? 'checkboxSwitchChecked' : 'checkboxSwitchUnchecked';
|
|
41
|
+
const appearanceClass = buttonStyle ? cssClassesArrayToString('checkboxSwitchButtonState', generateButtonClass({
|
|
42
|
+
cssClass: cssClass || '',
|
|
43
|
+
buttonStyle,
|
|
44
|
+
hideLabel
|
|
45
|
+
})) : cssClass;
|
|
46
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
47
|
+
className: cssClassesArrayToString('checkboxSwitchState', stateClass, appearanceClass)
|
|
48
|
+
}, renderIcon(icon), !hideLabel && label && /*#__PURE__*/React.createElement("span", {
|
|
49
|
+
className: "checkboxSwitchStateLabel"
|
|
50
|
+
}, label));
|
|
51
|
+
};
|
|
52
|
+
export const CheckboxSwitch = props => /*#__PURE__*/React.createElement(HookFormWrapper, {
|
|
53
|
+
formContext: props.formContext
|
|
54
|
+
}, /*#__PURE__*/React.createElement(CheckboxSwitchField, props));
|
|
55
|
+
const CheckboxSwitchField = ({
|
|
56
|
+
label,
|
|
57
|
+
field: {
|
|
58
|
+
id,
|
|
59
|
+
name,
|
|
60
|
+
value,
|
|
61
|
+
defaultChecked,
|
|
62
|
+
disabled,
|
|
63
|
+
onBlur = () => {},
|
|
64
|
+
onChange = () => {},
|
|
65
|
+
onTouched = () => {}
|
|
66
|
+
},
|
|
67
|
+
validation,
|
|
68
|
+
variant = 'slide',
|
|
69
|
+
shape = 'round',
|
|
70
|
+
size = 'm',
|
|
71
|
+
states,
|
|
72
|
+
stateDisplay = 'split',
|
|
73
|
+
glowTheme = 'dark',
|
|
74
|
+
hideStateLabels = false,
|
|
75
|
+
showSpinner,
|
|
76
|
+
customCssClasses,
|
|
77
|
+
customContent
|
|
78
|
+
}) => {
|
|
79
|
+
const [isTouched, setIsTouched] = useState(false);
|
|
80
|
+
const {
|
|
81
|
+
register,
|
|
82
|
+
getFieldState
|
|
83
|
+
} = useFormContext();
|
|
84
|
+
const fieldState = getFieldState(name);
|
|
85
|
+
const requiredRule = validation?.required;
|
|
86
|
+
const isRequired = typeof requiredRule === 'object' && requiredRule !== null ? requiredRule.value : Boolean(requiredRule);
|
|
87
|
+
const isSlide = variant === 'slide';
|
|
88
|
+
const isPowerButton = variant === 'powerButton';
|
|
89
|
+
// Power buttons are always a single icon-only circle.
|
|
90
|
+
const effectiveStateDisplay = isPowerButton ? 'single' : stateDisplay;
|
|
91
|
+
const effectiveHideStateLabels = isPowerButton || hideStateLabels;
|
|
92
|
+
const defaultStates = isPowerButton ? DEFAULT_POWER_BUTTON_STATES : DEFAULT_CHECKBOX_SWITCH_STATES;
|
|
93
|
+
// Button styles fight the slide thumb and power button cap, so those variants ignore them.
|
|
94
|
+
const stripButtonStyle = isSlide || isPowerButton ? {
|
|
95
|
+
buttonStyle: undefined
|
|
96
|
+
} : {};
|
|
97
|
+
const checkedState = {
|
|
98
|
+
...defaultStates.checked,
|
|
99
|
+
...states?.checked,
|
|
100
|
+
...stripButtonStyle
|
|
101
|
+
};
|
|
102
|
+
const uncheckedState = {
|
|
103
|
+
...defaultStates.unchecked,
|
|
104
|
+
...states?.unchecked,
|
|
105
|
+
...stripButtonStyle
|
|
106
|
+
};
|
|
107
|
+
const wrapperCssClass = ['formField', 'checkboxSwitchField', `checkboxSwitch_${variant}`, `checkboxSwitch_${shape}`, `checkboxSwitch_${size}`, `checkboxSwitch_${effectiveStateDisplay}`, variant === 'glow' && glowTheme === 'light' ? 'checkboxSwitch_glowLight' : '', effectiveHideStateLabels ? 'checkboxSwitch_hiddenStateLabels' : '', isTouched ? 'touched' : '', customCssClasses?.wrapper || ''].filter(Boolean).join(' ');
|
|
108
|
+
const inputCssClass = `${customCssClasses?.input || ''}${fieldState?.invalid ? ' invalidField' : ''}`;
|
|
109
|
+
const HandleOnBlur = event => {
|
|
110
|
+
setIsTouched(true);
|
|
111
|
+
onTouched();
|
|
112
|
+
onBlur(event);
|
|
113
|
+
};
|
|
114
|
+
const labelProps = {
|
|
115
|
+
...label,
|
|
116
|
+
inputId: id,
|
|
117
|
+
isRequired,
|
|
118
|
+
customContent
|
|
119
|
+
};
|
|
120
|
+
const inputProps = {
|
|
121
|
+
type: 'checkbox',
|
|
122
|
+
role: 'switch',
|
|
123
|
+
id,
|
|
124
|
+
className: inputCssClass,
|
|
125
|
+
defaultChecked,
|
|
126
|
+
'aria-required': isRequired,
|
|
127
|
+
'aria-invalid': fieldState.invalid,
|
|
128
|
+
...(fieldState.invalid ? {
|
|
129
|
+
'aria-describedby': `${name}_errors`
|
|
130
|
+
} : {}),
|
|
131
|
+
...(typeof value === 'string' ? {
|
|
132
|
+
value
|
|
133
|
+
} : {}),
|
|
134
|
+
...register(name, {
|
|
135
|
+
onChange,
|
|
136
|
+
onBlur: HandleOnBlur,
|
|
137
|
+
disabled,
|
|
138
|
+
...validation
|
|
139
|
+
})
|
|
140
|
+
};
|
|
141
|
+
const isLabelLeft = label.position === 'left';
|
|
142
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
143
|
+
className: wrapperCssClass
|
|
144
|
+
}, /*#__PURE__*/React.createElement("label", {
|
|
145
|
+
id: label.labelId || `${id}_label`,
|
|
146
|
+
className: `checkboxSwitchLabel ${customCssClasses?.label || ''} ${showSpinner ? 'withSpinner' : ''}`,
|
|
147
|
+
htmlFor: id
|
|
148
|
+
}, isLabelLeft && /*#__PURE__*/React.createElement(FormFieldLabel, labelProps), /*#__PURE__*/React.createElement("span", {
|
|
149
|
+
className: "checkboxSwitchControl"
|
|
150
|
+
}, /*#__PURE__*/React.createElement("input", inputProps), /*#__PURE__*/React.createElement("span", {
|
|
151
|
+
className: "checkboxSwitchTrack",
|
|
152
|
+
"aria-hidden": "true"
|
|
153
|
+
}, /*#__PURE__*/React.createElement(CheckboxSwitchState, _extends({}, checkedState, {
|
|
154
|
+
state: "checked",
|
|
155
|
+
hideLabel: effectiveHideStateLabels
|
|
156
|
+
})), /*#__PURE__*/React.createElement(CheckboxSwitchState, _extends({}, uncheckedState, {
|
|
157
|
+
state: "unchecked",
|
|
158
|
+
hideLabel: effectiveHideStateLabels
|
|
159
|
+
})), isSlide && /*#__PURE__*/React.createElement("span", {
|
|
160
|
+
className: "checkboxSwitchThumb"
|
|
161
|
+
}))), !isLabelLeft && /*#__PURE__*/React.createElement(FormFieldLabel, labelProps), showSpinner && /*#__PURE__*/React.createElement(Spinner, null)), /*#__PURE__*/React.createElement(ValidationMessages, {
|
|
162
|
+
name: name,
|
|
163
|
+
validation: validation
|
|
164
|
+
}));
|
|
165
|
+
};
|
|
166
|
+
export default CheckboxSwitch;
|
|
167
|
+
//# sourceMappingURL=CheckboxSwitch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxSwitch.js","names":["_extends","React","useState","useFormContext","HookFormWrapper","FormFieldLabel","ValidationMessages","Spinner","renderIcon","cssClassesArrayToString","generateButtonClass","DEFAULT_CHECKBOX_SWITCH_STATES","checked","label","unchecked","DEFAULT_POWER_BUTTON_STATES","icon","CheckboxSwitchState","state","cssClass","buttonStyle","hideLabel","stateClass","appearanceClass","createElement","className","CheckboxSwitch","props","formContext","CheckboxSwitchField","field","id","name","value","defaultChecked","disabled","onBlur","onChange","onTouched","validation","variant","shape","size","states","stateDisplay","glowTheme","hideStateLabels","showSpinner","customCssClasses","customContent","isTouched","setIsTouched","register","getFieldState","fieldState","requiredRule","required","isRequired","Boolean","isSlide","isPowerButton","effectiveStateDisplay","effectiveHideStateLabels","defaultStates","stripButtonStyle","undefined","checkedState","uncheckedState","wrapperCssClass","wrapper","filter","join","inputCssClass","input","invalid","HandleOnBlur","event","labelProps","inputId","inputProps","type","role","isLabelLeft","position","labelId","htmlFor"],"sources":["../../../../../../../../../src/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.tsx"],"sourcesContent":["'use client';\n\nimport React, { useState } from 'react';\nimport { useFormContext } from 'react-hook-form';\nimport { HookFormWrapper } from '../../../../../hookFormWrapper/HookFormWrapper';\nimport { FormFieldLabel } from '../../../labels/FormFieldLabel';\nimport { ValidationMessages } from '../../../../../validation/ValidationMessages';\nimport { Spinner } from '../../../../../../design/spinner/Spinner';\nimport { renderIcon } from '../../../../../../../helpers/iconHelpers';\nimport { cssClassesArrayToString } from '../../../../../../../helpers/arrayHelpers';\nimport { generateButtonClass } from '../../../../../buttons/button.helpers';\nimport { CheckboxSwitchProps, CheckboxSwitchStateProps } from './checkboxSwitchProps';\n\nimport './checkboxSwitch.scss';\n\nexport const DEFAULT_CHECKBOX_SWITCH_STATES = {\n checked: { label: 'On' },\n unchecked: { label: 'Off' }\n};\n\nexport const DEFAULT_POWER_BUTTON_STATES = {\n checked: { label: 'On', icon: 'switch' },\n unchecked: { label: 'Off', icon: 'switch' }\n};\n\ninterface CheckboxSwitchStateContentProps extends CheckboxSwitchStateProps {\n state: 'checked' | 'unchecked';\n hideLabel: boolean;\n}\n\nexport const CheckboxSwitchState: React.FC<CheckboxSwitchStateContentProps> = (\n {\n state,\n label,\n icon,\n cssClass,\n buttonStyle,\n hideLabel\n }\n) => {\n const stateClass = state === 'checked' ? 'checkboxSwitchChecked' : 'checkboxSwitchUnchecked';\n\n const appearanceClass = buttonStyle\n ? cssClassesArrayToString('checkboxSwitchButtonState', generateButtonClass({ cssClass: cssClass || '', buttonStyle, hideLabel }))\n : cssClass;\n\n return (\n <span className={ cssClassesArrayToString('checkboxSwitchState', stateClass, appearanceClass) }>\n { renderIcon(icon) }\n { !hideLabel && label && <span className=\"checkboxSwitchStateLabel\">{ label }</span> }\n </span>\n );\n};\n\nexport const CheckboxSwitch: React.FC<CheckboxSwitchProps> = (props) => (\n <HookFormWrapper formContext={ props.formContext }>\n <CheckboxSwitchField { ...props } />\n </HookFormWrapper>\n);\n\nconst CheckboxSwitchField: React.FC<CheckboxSwitchProps> = (\n {\n label,\n field: {\n id,\n name,\n value,\n defaultChecked,\n disabled,\n onBlur = () => {},\n onChange = () => {},\n onTouched = () => {}\n },\n validation,\n variant = 'slide',\n shape = 'round',\n size = 'm',\n states,\n stateDisplay = 'split',\n glowTheme = 'dark',\n hideStateLabels = false,\n showSpinner,\n customCssClasses,\n customContent\n }\n) => {\n const [isTouched, setIsTouched] = useState(false);\n const { register, getFieldState } = useFormContext();\n const fieldState = getFieldState(name);\n\n const requiredRule = validation?.required;\n const isRequired = typeof requiredRule === 'object' && requiredRule !== null\n ? requiredRule.value\n : Boolean(requiredRule);\n\n const isSlide = variant === 'slide';\n const isPowerButton = variant === 'powerButton';\n // Power buttons are always a single icon-only circle.\n const effectiveStateDisplay = isPowerButton ? 'single' : stateDisplay;\n const effectiveHideStateLabels = isPowerButton || hideStateLabels;\n const defaultStates = isPowerButton ? DEFAULT_POWER_BUTTON_STATES : DEFAULT_CHECKBOX_SWITCH_STATES;\n // Button styles fight the slide thumb and power button cap, so those variants ignore them.\n const stripButtonStyle = isSlide || isPowerButton ? { buttonStyle: undefined } : {};\n const checkedState = { ...defaultStates.checked, ...states?.checked, ...stripButtonStyle };\n const uncheckedState = { ...defaultStates.unchecked, ...states?.unchecked, ...stripButtonStyle };\n\n const wrapperCssClass = [\n 'formField',\n 'checkboxSwitchField',\n `checkboxSwitch_${ variant }`,\n `checkboxSwitch_${ shape }`,\n `checkboxSwitch_${ size }`,\n `checkboxSwitch_${ effectiveStateDisplay }`,\n variant === 'glow' && glowTheme === 'light' ? 'checkboxSwitch_glowLight' : '',\n effectiveHideStateLabels ? 'checkboxSwitch_hiddenStateLabels' : '',\n isTouched ? 'touched' : '',\n customCssClasses?.wrapper || ''\n ].filter(Boolean).join(' ');\n\n const inputCssClass = `${ customCssClasses?.input || '' }${ fieldState?.invalid ? ' invalidField' : '' }`;\n\n const HandleOnBlur = (event: React.FocusEvent<HTMLInputElement>) => {\n setIsTouched(true);\n onTouched();\n onBlur(event);\n };\n\n const labelProps = {\n ...label,\n inputId: id,\n isRequired,\n customContent\n };\n\n const inputProps = {\n type: 'checkbox',\n role: 'switch',\n id,\n className: inputCssClass,\n defaultChecked,\n 'aria-required': isRequired,\n 'aria-invalid': fieldState.invalid,\n ...(fieldState.invalid ? { 'aria-describedby': `${ name }_errors` } : {}),\n ...(typeof value === 'string' ? { value } : {}),\n ...register(\n name,\n {\n onChange,\n onBlur: HandleOnBlur,\n disabled,\n ...validation\n }\n )\n };\n\n const isLabelLeft = label.position === 'left';\n\n return (\n <div className={ wrapperCssClass }>\n <label\n id={ label.labelId || `${ id }_label` }\n className={ `checkboxSwitchLabel ${ customCssClasses?.label || '' } ${ showSpinner ? 'withSpinner' : '' }` }\n htmlFor={ id }\n >\n { isLabelLeft && <FormFieldLabel { ...labelProps } /> }\n\n <span className=\"checkboxSwitchControl\">\n <input { ...inputProps } />\n { /* The input conveys the checked state, so the state spans are decorative. */ }\n <span className=\"checkboxSwitchTrack\" aria-hidden=\"true\">\n <CheckboxSwitchState { ...checkedState } state=\"checked\" hideLabel={ effectiveHideStateLabels } />\n <CheckboxSwitchState { ...uncheckedState } state=\"unchecked\" hideLabel={ effectiveHideStateLabels } />\n { isSlide && <span className=\"checkboxSwitchThumb\" /> }\n </span>\n </span>\n\n { !isLabelLeft && <FormFieldLabel { ...labelProps } /> }\n\n { showSpinner && <Spinner /> }\n </label>\n\n <ValidationMessages name={ name } validation={ validation } />\n </div>\n );\n};\n\nexport default CheckboxSwitch;\n"],"mappings":"AAAA,YAAY;;AAAC,OAAAA,QAAA;AAEb,OAAOC,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,cAAc,QAAQ,iBAAiB;AAChD,SAASC,eAAe,QAAQ,gDAAgD;AAChF,SAASC,cAAc,QAAQ,gCAAgC;AAC/D,SAASC,kBAAkB,QAAQ,8CAA8C;AACjF,SAASC,OAAO,QAAQ,0CAA0C;AAClE,SAASC,UAAU,QAAQ,0CAA0C;AACrE,SAASC,uBAAu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AMmE,cAAc;IAAGjD,KAAK,EAAC,WAAW;IAACG,SAAS,EAAGyC;EAA0B,EAAE,CAAC,EACpGH,OAAO,iBAAI1D,KAAA,CAAAuB,aAAA;IAAMC,SAAS,EAAC;EAAqB,CAAE,CAChD,CACF,CAAC,EAEL,CAACyD,WAAW,iBAAIjF,KAAA,CAAAuB,aAAA,CAACnB,cAAc,EAAMwE,UAAc,CAAC,EAEpD9B,WAAW,iBAAI9C,KAAA,CAAAuB,aAAA,CAACjB,OAAO,MAAE,CACtB,CAAC,eAERN,KAAA,CAAAuB,aAAA,CAAClB,kBAAkB;IAAC0B,IAAI,EAAGA,IAAM;IAACO,UAAU,EAAGA;EAAY,CAAE,CAC1D,CAAC;AAEV,CAAC;AAED,eAAeb,cAAc","ignoreList":[]}
|
|
File without changes
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/* Popovers */
|
|
2
|
+
.checkboxSwitchField {
|
|
3
|
+
--checkboxSwitchHeight: 30px;
|
|
4
|
+
--checkboxSwitchFontSize: 15px;
|
|
5
|
+
--checkboxSwitchIconSize: 15px;
|
|
6
|
+
--checkboxSwitchPaddingInline: 10px;
|
|
7
|
+
--checkboxSwitchThumbGap: var(--checkboxSwitchThumbGapM, 3px);
|
|
8
|
+
--checkboxSwitchRadius: calc(var(--checkboxSwitchHeight) / 2);
|
|
9
|
+
}
|
|
10
|
+
.checkboxSwitchField.checkboxSwitch_xs {
|
|
11
|
+
--checkboxSwitchHeight: 20px;
|
|
12
|
+
--checkboxSwitchFontSize: 11px;
|
|
13
|
+
--checkboxSwitchIconSize: 11px;
|
|
14
|
+
--checkboxSwitchPaddingInline: 5px;
|
|
15
|
+
--checkboxSwitchThumbGap: var(--checkboxSwitchThumbGapXs, 1px);
|
|
16
|
+
}
|
|
17
|
+
.checkboxSwitchField.checkboxSwitch_s {
|
|
18
|
+
--checkboxSwitchHeight: 25px;
|
|
19
|
+
--checkboxSwitchFontSize: 13px;
|
|
20
|
+
--checkboxSwitchIconSize: 13px;
|
|
21
|
+
--checkboxSwitchPaddingInline: 5px;
|
|
22
|
+
--checkboxSwitchThumbGap: var(--checkboxSwitchThumbGapS, 2px);
|
|
23
|
+
}
|
|
24
|
+
.checkboxSwitchField.checkboxSwitch_m {
|
|
25
|
+
--checkboxSwitchHeight: 30px;
|
|
26
|
+
--checkboxSwitchFontSize: 15px;
|
|
27
|
+
--checkboxSwitchIconSize: 15px;
|
|
28
|
+
--checkboxSwitchPaddingInline: 10px;
|
|
29
|
+
--checkboxSwitchThumbGap: var(--checkboxSwitchThumbGapM, 3px);
|
|
30
|
+
}
|
|
31
|
+
.checkboxSwitchField.checkboxSwitch_l {
|
|
32
|
+
--checkboxSwitchHeight: 40px;
|
|
33
|
+
--checkboxSwitchFontSize: 17px;
|
|
34
|
+
--checkboxSwitchIconSize: 17px;
|
|
35
|
+
--checkboxSwitchPaddingInline: 10px;
|
|
36
|
+
--checkboxSwitchThumbGap: var(--checkboxSwitchThumbGapL, 4px);
|
|
37
|
+
}
|
|
38
|
+
.checkboxSwitchField.checkboxSwitch_xl {
|
|
39
|
+
--checkboxSwitchHeight: 50px;
|
|
40
|
+
--checkboxSwitchFontSize: 19px;
|
|
41
|
+
--checkboxSwitchIconSize: 19px;
|
|
42
|
+
--checkboxSwitchPaddingInline: 15px;
|
|
43
|
+
--checkboxSwitchThumbGap: var(--checkboxSwitchThumbGapXl, 5px);
|
|
44
|
+
}
|
|
45
|
+
.checkboxSwitchField.checkboxSwitch_rectangular {
|
|
46
|
+
--checkboxSwitchRadius: var(--checkboxSwitchRectangularRadius, 5px);
|
|
47
|
+
}
|
|
48
|
+
.checkboxSwitchField .checkboxSwitchLabel {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: row;
|
|
51
|
+
column-gap: 10px;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: flex-start;
|
|
54
|
+
cursor: pointer;
|
|
55
|
+
}
|
|
56
|
+
.checkboxSwitchField .checkboxSwitchControl {
|
|
57
|
+
position: relative;
|
|
58
|
+
display: inline-flex;
|
|
59
|
+
flex: none;
|
|
60
|
+
}
|
|
61
|
+
.checkboxSwitchField .checkboxSwitchControl input[type=checkbox] {
|
|
62
|
+
position: absolute;
|
|
63
|
+
inset: 0;
|
|
64
|
+
z-index: 2;
|
|
65
|
+
width: 100%;
|
|
66
|
+
height: 100%;
|
|
67
|
+
margin: 0;
|
|
68
|
+
opacity: 0.01;
|
|
69
|
+
cursor: pointer;
|
|
70
|
+
}
|
|
71
|
+
.checkboxSwitchField .checkboxSwitchControl input[type=checkbox]:disabled {
|
|
72
|
+
cursor: not-allowed;
|
|
73
|
+
}
|
|
74
|
+
.checkboxSwitchField .checkboxSwitchControl input[type=checkbox]:disabled ~ .checkboxSwitchTrack {
|
|
75
|
+
opacity: var(--checkboxSwitchDisabledOpacity, 0.5);
|
|
76
|
+
}
|
|
77
|
+
.checkboxSwitchField .checkboxSwitchControl input[type=checkbox]:focus-visible ~ .checkboxSwitchTrack {
|
|
78
|
+
outline: var(--inputFocusOutline, 1px dotted);
|
|
79
|
+
outline-offset: 2px;
|
|
80
|
+
}
|
|
81
|
+
.checkboxSwitchField .checkboxSwitchControl input[type=checkbox].invalidField ~ .checkboxSwitchTrack {
|
|
82
|
+
border-color: var(--inputErrorBorderColor, #c00);
|
|
83
|
+
}
|
|
84
|
+
.checkboxSwitchField .checkboxSwitchTrack {
|
|
85
|
+
position: relative;
|
|
86
|
+
box-sizing: border-box;
|
|
87
|
+
display: inline-grid;
|
|
88
|
+
grid-template-columns: 1fr 1fr;
|
|
89
|
+
height: var(--checkboxSwitchHeight);
|
|
90
|
+
border: var(--checkboxSwitchBorder, 1px solid #e5ebef);
|
|
91
|
+
border-radius: var(--checkboxSwitchRadius);
|
|
92
|
+
background: var(--checkboxSwitchTrackBg, #e5ebef);
|
|
93
|
+
color: var(--checkboxSwitchTrackFgColor, #24282b);
|
|
94
|
+
font-size: var(--checkboxSwitchFontSize);
|
|
95
|
+
line-height: 1;
|
|
96
|
+
overflow: hidden;
|
|
97
|
+
transition: background-color var(--checkboxSwitchTransition, 0.2s ease);
|
|
98
|
+
}
|
|
99
|
+
.checkboxSwitchField .checkboxSwitchState {
|
|
100
|
+
display: flex;
|
|
101
|
+
flex-direction: row;
|
|
102
|
+
column-gap: var(--checkboxSwitchStateGap, 5px);
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: center;
|
|
105
|
+
grid-row: 1;
|
|
106
|
+
min-width: var(--checkboxSwitchHeight);
|
|
107
|
+
padding: 0 var(--checkboxSwitchPaddingInline);
|
|
108
|
+
white-space: nowrap;
|
|
109
|
+
transition: opacity var(--checkboxSwitchTransition, 0.2s ease), background-color var(--checkboxSwitchTransition, 0.2s ease), transform var(--checkboxSwitchTransition, 0.2s ease);
|
|
110
|
+
}
|
|
111
|
+
.checkboxSwitchField .checkboxSwitchState .icon {
|
|
112
|
+
font-size: var(--checkboxSwitchIconSize);
|
|
113
|
+
}
|
|
114
|
+
.checkboxSwitchField .checkboxSwitchState .iconSvg {
|
|
115
|
+
width: var(--checkboxSwitchIconSize);
|
|
116
|
+
height: var(--checkboxSwitchIconSize);
|
|
117
|
+
}
|
|
118
|
+
.checkboxSwitchField .checkboxSwitchChecked {
|
|
119
|
+
grid-column: 1;
|
|
120
|
+
}
|
|
121
|
+
.checkboxSwitchField .checkboxSwitchUnchecked {
|
|
122
|
+
grid-column: 2;
|
|
123
|
+
}
|
|
124
|
+
.checkboxSwitchField.checkboxSwitch_slide .checkboxSwitchThumb {
|
|
125
|
+
position: absolute;
|
|
126
|
+
top: var(--checkboxSwitchThumbGap);
|
|
127
|
+
left: var(--checkboxSwitchThumbGap);
|
|
128
|
+
z-index: 1;
|
|
129
|
+
box-sizing: border-box;
|
|
130
|
+
width: calc(50% - var(--checkboxSwitchThumbGap));
|
|
131
|
+
height: calc(100% - var(--checkboxSwitchThumbGap) * 2);
|
|
132
|
+
border-radius: max(0px, var(--checkboxSwitchRadius) - var(--checkboxSwitchThumbGap));
|
|
133
|
+
background: var(--checkboxSwitchThumbBg, #fff);
|
|
134
|
+
box-shadow: var(--checkboxSwitchThumbShadow, 0 1px 3px rgba(0, 0, 0, 0.35));
|
|
135
|
+
transition: left var(--checkboxSwitchTransition, 0.2s ease), transform var(--checkboxSwitchTransition, 0.2s ease);
|
|
136
|
+
}
|
|
137
|
+
.checkboxSwitchField.checkboxSwitch_slide .checkboxSwitchChecked {
|
|
138
|
+
opacity: 0;
|
|
139
|
+
color: var(--checkboxSwitchTrackCheckedFgColor, #fff);
|
|
140
|
+
}
|
|
141
|
+
.checkboxSwitchField.checkboxSwitch_slide input[type=checkbox]:checked ~ .checkboxSwitchTrack {
|
|
142
|
+
background: var(--checkboxSwitchTrackCheckedBg, #516472);
|
|
143
|
+
}
|
|
144
|
+
.checkboxSwitchField.checkboxSwitch_slide input[type=checkbox]:checked ~ .checkboxSwitchTrack .checkboxSwitchThumb {
|
|
145
|
+
left: calc(100% - var(--checkboxSwitchThumbGap));
|
|
146
|
+
transform: translateX(-100%);
|
|
147
|
+
}
|
|
148
|
+
.checkboxSwitchField.checkboxSwitch_slide input[type=checkbox]:checked ~ .checkboxSwitchTrack .checkboxSwitchChecked {
|
|
149
|
+
opacity: 1;
|
|
150
|
+
}
|
|
151
|
+
.checkboxSwitchField.checkboxSwitch_slide input[type=checkbox]:checked ~ .checkboxSwitchTrack .checkboxSwitchUnchecked {
|
|
152
|
+
opacity: 0;
|
|
153
|
+
}
|
|
154
|
+
.checkboxSwitchField.checkboxSwitch_slide.checkboxSwitch_round .checkboxSwitchTrack {
|
|
155
|
+
grid-template-columns: 1fr;
|
|
156
|
+
}
|
|
157
|
+
.checkboxSwitchField.checkboxSwitch_slide.checkboxSwitch_round .checkboxSwitchState {
|
|
158
|
+
grid-column: 1;
|
|
159
|
+
box-sizing: border-box;
|
|
160
|
+
min-width: calc(var(--checkboxSwitchHeight) * 2);
|
|
161
|
+
}
|
|
162
|
+
.checkboxSwitchField.checkboxSwitch_slide.checkboxSwitch_round .checkboxSwitchUnchecked {
|
|
163
|
+
padding-left: calc(var(--checkboxSwitchHeight) + 5px);
|
|
164
|
+
}
|
|
165
|
+
.checkboxSwitchField.checkboxSwitch_slide.checkboxSwitch_round .checkboxSwitchChecked {
|
|
166
|
+
padding-right: calc(var(--checkboxSwitchHeight) + 5px);
|
|
167
|
+
}
|
|
168
|
+
.checkboxSwitchField.checkboxSwitch_slide.checkboxSwitch_round .checkboxSwitchThumb {
|
|
169
|
+
width: auto;
|
|
170
|
+
aspect-ratio: 1;
|
|
171
|
+
border-radius: 50%;
|
|
172
|
+
}
|
|
173
|
+
.checkboxSwitchField.checkboxSwitch_rocker .checkboxSwitchState:not(.checkboxSwitchButtonState) {
|
|
174
|
+
background: var(--checkboxSwitchRockerRaisedBg, linear-gradient(to bottom, #fff 0%, #f6f8fa 60%, #e5ebef 100%));
|
|
175
|
+
color: var(--checkboxSwitchRockerRaisedFgColor, #384147);
|
|
176
|
+
}
|
|
177
|
+
.checkboxSwitchField.checkboxSwitch_rocker .checkboxSwitchChecked {
|
|
178
|
+
border-right: var(--checkboxSwitchBorder, 1px solid #e5ebef);
|
|
179
|
+
}
|
|
180
|
+
.checkboxSwitchField.checkboxSwitch_rocker input[type=checkbox]:not(:checked) ~ .checkboxSwitchTrack .checkboxSwitchUnchecked:not(.checkboxSwitchButtonState) {
|
|
181
|
+
background: var(--checkboxSwitchRockerPressedBg, linear-gradient(to bottom, #c2d0d9 0%, #d3dee4 35%, #e5ebef 100%));
|
|
182
|
+
color: var(--checkboxSwitchRockerPressedFgColor, #181a1b);
|
|
183
|
+
}
|
|
184
|
+
.checkboxSwitchField.checkboxSwitch_rocker input[type=checkbox]:checked ~ .checkboxSwitchTrack .checkboxSwitchChecked:not(.checkboxSwitchButtonState) {
|
|
185
|
+
background: var(--checkboxSwitchRockerCheckedPressedBg, linear-gradient(to bottom, #24282b 0%, #384147 35%, #516472 100%));
|
|
186
|
+
color: var(--checkboxSwitchRockerCheckedPressedFgColor, #fff);
|
|
187
|
+
}
|
|
188
|
+
.checkboxSwitchField.checkboxSwitch_rocker.checkboxSwitch_single input[type=checkbox]:not(:checked) ~ .checkboxSwitchTrack .checkboxSwitchUnchecked:not(.checkboxSwitchButtonState) {
|
|
189
|
+
background: var(--checkboxSwitchRockerRaisedBg, linear-gradient(to bottom, #fff 0%, #f6f8fa 60%, #e5ebef 100%));
|
|
190
|
+
color: var(--checkboxSwitchRockerRaisedFgColor, #384147);
|
|
191
|
+
}
|
|
192
|
+
.checkboxSwitchField.checkboxSwitch_glow.checkboxSwitch_glowLight {
|
|
193
|
+
--checkboxSwitchGlowTrackBg: var(--checkboxSwitchGlowLightTrackBg, linear-gradient(to bottom, #fff 0%, #eef2f4 100%));
|
|
194
|
+
--checkboxSwitchGlowInactiveFgColor: var(--checkboxSwitchGlowLightInactiveFgColor, #7e97a7);
|
|
195
|
+
--checkboxSwitchGlowOffFgColor: var(--checkboxSwitchGlowLightOffFgColor, #24282b);
|
|
196
|
+
--checkboxSwitchGlowOnFgColor: var(--checkboxSwitchGlowLightOnFgColor, color-mix(in srgb, var(--checkboxSwitchGlowColor, #2bff88) 55%, #000));
|
|
197
|
+
}
|
|
198
|
+
.checkboxSwitchField.checkboxSwitch_glow.checkboxSwitch_round.checkboxSwitch_hiddenStateLabels .checkboxSwitchTrack {
|
|
199
|
+
width: var(--checkboxSwitchHeight);
|
|
200
|
+
}
|
|
201
|
+
.checkboxSwitchField.checkboxSwitch_glow.checkboxSwitch_round.checkboxSwitch_hiddenStateLabels .checkboxSwitchState {
|
|
202
|
+
min-width: 0;
|
|
203
|
+
padding: 0;
|
|
204
|
+
}
|
|
205
|
+
.checkboxSwitchField.checkboxSwitch_glow.checkboxSwitch_round.checkboxSwitch_hiddenStateLabels.checkboxSwitch_split .checkboxSwitchTrack {
|
|
206
|
+
width: calc(var(--checkboxSwitchHeight) * 2);
|
|
207
|
+
}
|
|
208
|
+
.checkboxSwitchField.checkboxSwitch_glow .checkboxSwitchTrack {
|
|
209
|
+
background: var(--checkboxSwitchGlowTrackBg, linear-gradient(to bottom, #384147 0%, #24282b 100%));
|
|
210
|
+
}
|
|
211
|
+
.checkboxSwitchField.checkboxSwitch_glow .checkboxSwitchState {
|
|
212
|
+
transition: color var(--checkboxSwitchTransition, 0.2s ease), text-shadow var(--checkboxSwitchTransition, 0.2s ease), opacity var(--checkboxSwitchTransition, 0.2s ease);
|
|
213
|
+
}
|
|
214
|
+
.checkboxSwitchField.checkboxSwitch_glow .checkboxSwitchState:not(.checkboxSwitchButtonState) {
|
|
215
|
+
color: var(--checkboxSwitchGlowInactiveFgColor, #7e97a7);
|
|
216
|
+
}
|
|
217
|
+
.checkboxSwitchField.checkboxSwitch_glow .checkboxSwitchState .iconSvg {
|
|
218
|
+
transition: filter var(--checkboxSwitchTransition, 0.2s ease);
|
|
219
|
+
}
|
|
220
|
+
.checkboxSwitchField.checkboxSwitch_glow .checkboxSwitchChecked {
|
|
221
|
+
border-right: var(--checkboxSwitchBorder, 1px solid #e5ebef);
|
|
222
|
+
}
|
|
223
|
+
.checkboxSwitchField.checkboxSwitch_glow input[type=checkbox]:not(:checked) ~ .checkboxSwitchTrack .checkboxSwitchUnchecked:not(.checkboxSwitchButtonState) {
|
|
224
|
+
color: var(--checkboxSwitchGlowOffFgColor, #e5ebef);
|
|
225
|
+
}
|
|
226
|
+
.checkboxSwitchField.checkboxSwitch_glow input[type=checkbox]:checked ~ .checkboxSwitchTrack .checkboxSwitchChecked:not(.checkboxSwitchButtonState) {
|
|
227
|
+
color: var(--checkboxSwitchGlowOnFgColor, #e8fff2);
|
|
228
|
+
}
|
|
229
|
+
.checkboxSwitchField.checkboxSwitch_glow input[type=checkbox]:checked ~ .checkboxSwitchTrack .checkboxSwitchChecked {
|
|
230
|
+
text-shadow: 0 0 var(--checkboxSwitchGlowRadius, 5px) var(--checkboxSwitchGlowColor, #2bff88), 0 0 calc(var(--checkboxSwitchGlowRadius, 5px) * 2) var(--checkboxSwitchGlowColor, #2bff88);
|
|
231
|
+
}
|
|
232
|
+
.checkboxSwitchField.checkboxSwitch_glow input[type=checkbox]:checked ~ .checkboxSwitchTrack .checkboxSwitchChecked .iconSvg {
|
|
233
|
+
filter: drop-shadow(0 0 calc(var(--checkboxSwitchGlowRadius, 5px) / 2) var(--checkboxSwitchGlowColor, #2bff88)) drop-shadow(0 0 var(--checkboxSwitchGlowRadius, 5px) var(--checkboxSwitchGlowColor, #2bff88));
|
|
234
|
+
}
|
|
235
|
+
.checkboxSwitchField.checkboxSwitch_powerButton .checkboxSwitchTrack {
|
|
236
|
+
width: var(--checkboxSwitchHeight);
|
|
237
|
+
border-radius: 50%;
|
|
238
|
+
background: var(--checkboxSwitchPowerButtonBezelBg, conic-gradient(from -45deg, #fff 0%, #ddd 50%, #fff 100%));
|
|
239
|
+
}
|
|
240
|
+
.checkboxSwitchField.checkboxSwitch_powerButton .checkboxSwitchTrack::after {
|
|
241
|
+
content: "";
|
|
242
|
+
position: absolute;
|
|
243
|
+
z-index: 1;
|
|
244
|
+
inset: var(--checkboxSwitchPowerButtonCapInset, 15%);
|
|
245
|
+
box-sizing: border-box;
|
|
246
|
+
border-radius: 50%;
|
|
247
|
+
border: var(--checkboxSwitchPowerButtonCapBorder, 1px solid #ddd);
|
|
248
|
+
background: var(--checkboxSwitchPowerButtonCapBg, radial-gradient(circle at bottom right, #fff 0%, #ddd 50%, #ccc 100%));
|
|
249
|
+
}
|
|
250
|
+
.checkboxSwitchField.checkboxSwitch_powerButton .checkboxSwitchState {
|
|
251
|
+
position: relative;
|
|
252
|
+
z-index: 2;
|
|
253
|
+
min-width: 0;
|
|
254
|
+
padding: 0;
|
|
255
|
+
color: var(--checkboxSwitchPowerButtonOffFgColor, #ccc);
|
|
256
|
+
text-shadow: var(--checkboxSwitchPowerButtonOffShadow, 0 0 1px #888);
|
|
257
|
+
transition: color var(--checkboxSwitchTransition, 0.2s ease), text-shadow var(--checkboxSwitchTransition, 0.2s ease);
|
|
258
|
+
}
|
|
259
|
+
.checkboxSwitchField.checkboxSwitch_powerButton .checkboxSwitchState .icon {
|
|
260
|
+
font-size: max(11px, var(--checkboxSwitchHeight) * 0.36);
|
|
261
|
+
}
|
|
262
|
+
.checkboxSwitchField.checkboxSwitch_powerButton .checkboxSwitchState .iconSvg {
|
|
263
|
+
width: max(11px, var(--checkboxSwitchHeight) * 0.36);
|
|
264
|
+
height: max(11px, var(--checkboxSwitchHeight) * 0.36);
|
|
265
|
+
}
|
|
266
|
+
.checkboxSwitchField.checkboxSwitch_powerButton input[type=checkbox]:checked ~ .checkboxSwitchTrack .checkboxSwitchChecked {
|
|
267
|
+
color: var(--checkboxSwitchPowerButtonOnFgColor, #f00);
|
|
268
|
+
text-shadow: var(--checkboxSwitchPowerButtonOnShadow, 0 0 1px #030);
|
|
269
|
+
}
|
|
270
|
+
.checkboxSwitchField.checkboxSwitch_single:not(.checkboxSwitch_slide) .checkboxSwitchTrack {
|
|
271
|
+
grid-template-columns: 1fr;
|
|
272
|
+
}
|
|
273
|
+
.checkboxSwitchField.checkboxSwitch_single:not(.checkboxSwitch_slide) .checkboxSwitchState {
|
|
274
|
+
grid-column: 1;
|
|
275
|
+
}
|
|
276
|
+
.checkboxSwitchField.checkboxSwitch_single:not(.checkboxSwitch_slide) .checkboxSwitchChecked {
|
|
277
|
+
border-right: 0;
|
|
278
|
+
}
|
|
279
|
+
.checkboxSwitchField.checkboxSwitch_single:not(.checkboxSwitch_slide) input[type=checkbox]:checked ~ .checkboxSwitchTrack .checkboxSwitchUnchecked,
|
|
280
|
+
.checkboxSwitchField.checkboxSwitch_single:not(.checkboxSwitch_slide) input[type=checkbox]:not(:checked) ~ .checkboxSwitchTrack .checkboxSwitchChecked {
|
|
281
|
+
visibility: hidden;
|
|
282
|
+
}
|
|
283
|
+
.checkboxSwitchField .checkboxSwitchTrack .checkboxSwitchState.checkboxSwitchButtonState {
|
|
284
|
+
box-sizing: border-box;
|
|
285
|
+
width: auto;
|
|
286
|
+
height: auto;
|
|
287
|
+
min-height: 0;
|
|
288
|
+
min-width: var(--checkboxSwitchHeight);
|
|
289
|
+
margin: 0;
|
|
290
|
+
padding: 0 var(--checkboxSwitchPaddingInline);
|
|
291
|
+
border-radius: 0;
|
|
292
|
+
font-size: inherit;
|
|
293
|
+
line-height: inherit;
|
|
294
|
+
cursor: inherit;
|
|
295
|
+
}
|
|
296
|
+
.checkboxSwitchField.checkboxSwitch_split:not(.checkboxSwitch_slide) input[type=checkbox]:checked ~ .checkboxSwitchTrack .checkboxSwitchUnchecked.checkboxSwitchButtonState,
|
|
297
|
+
.checkboxSwitchField.checkboxSwitch_split:not(.checkboxSwitch_slide) input[type=checkbox]:not(:checked) ~ .checkboxSwitchTrack .checkboxSwitchChecked.checkboxSwitchButtonState {
|
|
298
|
+
opacity: var(--checkboxSwitchButtonInactiveOpacity, 0.4);
|
|
299
|
+
}
|
|
300
|
+
@media (prefers-reduced-motion: reduce) {
|
|
301
|
+
.checkboxSwitchField .checkboxSwitchTrack,
|
|
302
|
+
.checkboxSwitchField .checkboxSwitchState,
|
|
303
|
+
.checkboxSwitchField .checkboxSwitchThumb {
|
|
304
|
+
transition: none;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkboxSwitchProps.js","names":[],"sources":["../../../../../../../../../src/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/checkboxSwitchProps.ts"],"sourcesContent":["import { ReactNode } from 'react';\nimport {\n CustomContentProps,\n CustomFieldCssClassesProps,\n FieldProps,\n FormFieldProps,\n LabelProps\n} from '../../../../formFieldWrapper/formFieldProps';\nimport { IconSource } from '../../../../../../../helpers/iconHelpers';\nimport { InputCheckboxValidationProps } from '../inputCheckboxProps';\nimport { ButtonStyles } from '../../../../../buttons/button.interface';\n\nexport type CheckboxSwitchSize = 'xs' | 's' | 'm' | 'l' | 'xl';\n\n/** `slide` moves a thumb across a track; `rocker` presses the active half down like a light switch; `glow` lights up the \"on\" content like a power button; `powerButton` is a circular icon-only button with a raised cap. */\nexport type CheckboxSwitchVariant = 'slide' | 'rocker' | 'glow' | 'powerButton';\n\n/** `round` uses a circular slide thumb; `ellipse` stretches the thumb across half the track. Rocker and glow switches treat both as pill shaped. */\nexport type CheckboxSwitchShape = 'round' | 'ellipse' | 'rectangular';\n\n/** `split` shows both states side by side; `single` shows only the current state as one button. Slide switches always show one state. */\nexport type CheckboxSwitchStateDisplay = 'split' | 'single';\n\n/** Only applies to the `glow` variant. */\nexport type CheckboxSwitchGlowTheme = 'dark' | 'light';\n\nexport type CheckboxSwitchButtonStyle = Omit<ButtonStyles, 'size'>;\n\nexport interface CheckboxSwitchLabelProps extends Omit<LabelProps, 'position'> {\n position?: 'left' | 'right';\n}\n\nexport interface CheckboxSwitchFieldProps extends Pick<FieldProps, 'id' | 'name' | 'disabled' | 'onChange' | 'onBlur' | 'onTouched'> {\n /** Submitted when checked. When omitted the form value is a boolean. */\n value?: string;\n defaultChecked?: boolean;\n}\n\nexport interface CheckboxSwitchStateProps {\n /** Visible text for this state. */\n label?: ReactNode;\n icon?: IconSource;\n cssClass?: string;\n /** Library button appearance for this state. Size and shape come from the switch; ignored by the `slide` variant. */\n buttonStyle?: CheckboxSwitchButtonStyle;\n}\n\nexport interface CheckboxSwitchStatesProps {\n checked?: CheckboxSwitchStateProps;\n unchecked?: CheckboxSwitchStateProps;\n}\n\nexport interface CheckboxSwitchProps extends Omit<FormFieldProps, 'label' | 'field' | 'layout' | 'validation' | 'separateLabelAndField'> {\n label: CheckboxSwitchLabelProps;\n field: CheckboxSwitchFieldProps;\n validation?: InputCheckboxValidationProps;\n variant?: CheckboxSwitchVariant;\n shape?: CheckboxSwitchShape;\n size?: CheckboxSwitchSize;\n states?: CheckboxSwitchStatesProps;\n stateDisplay?: CheckboxSwitchStateDisplay;\n glowTheme?: CheckboxSwitchGlowTheme;\n /** Visually hides the per-state labels while keeping any state icons. */\n hideStateLabels?: boolean;\n showSpinner?: boolean;\n customCssClasses?: CustomFieldCssClassesProps;\n customContent?: CustomContentProps;\n}\n"],"mappings":"","ignoreList":[]}
|
package/dist/esm/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputCheckboxProps.js","names":[],"sources":["../../../../../../../../src/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"inputCheckboxProps.js","names":[],"sources":["../../../../../../../../src/components/form/formFields/subComponents/inputs/checkbox/inputCheckboxProps.ts"],"sourcesContent":["import { IconSource } from '../../../../../../helpers/iconHelpers';\nimport {\n CustomContentProps,\n CustomFieldCssClassesProps,\n FieldProps,\n FormFieldProps,\n LabelProps,\n ValidationProps\n} from '../../../formFieldWrapper/formFieldProps';\n\nexport interface InputCheckboxLabelProps extends Omit<LabelProps, 'hide' | 'position'> {\n position?: 'left' | 'right';\n}\n\nexport interface InputCheckboxIconsProps {\n checked: IconSource;\n unchecked: IconSource;\n}\n\nexport interface InputCheckboxFieldProps extends Omit<FieldProps, 'type' | 'placeholder' | 'value' | 'defaultValue' | 'referenceDate' | 'includeEmptyOption' | 'options'> {\n value: boolean | string;\n defaultChecked?: boolean;\n defaultValue?: boolean | string | number | readonly string[];\n}\n\nexport interface InputCheckboxValidationProps<TFieldValue = unknown, TFormValues = unknown>\n extends Omit<ValidationProps<TFieldValue, TFormValues>, 'validate'> {\n}\n\nexport interface InputCheckboxProps extends Omit<FormFieldProps, 'label' | 'field' | 'layout' | 'validation'> {\n label: InputCheckboxLabelProps,\n field: InputCheckboxFieldProps,\n validation?: InputCheckboxValidationProps;\n showSpinner?: boolean;\n icons?: InputCheckboxIconsProps;\n customCssClasses?: CustomFieldCssClassesProps;\n customContent?: CustomContentProps;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
4
4
|
import { arrowUpFromBracket } from '@x15ventures/x15-ui-library-icons/iconDefinitions';
|
|
5
|
-
import { SvgIcon } from '@x15ventures/x15-ui-library-icons/svgIcon/SvgIcon';
|
|
6
5
|
import { useFormContext } from 'react-hook-form';
|
|
6
|
+
import { renderIcon } from '../../../../../../../helpers/iconHelpers';
|
|
7
7
|
import { HookFormWrapper } from '../../../../../hookFormWrapper/HookFormWrapper';
|
|
8
8
|
import { Spinner } from '../../../../../../design/spinner/Spinner';
|
|
9
9
|
import { FormFieldLabel } from '../../../../subComponents/labels/FormFieldLabel';
|
|
@@ -31,9 +31,7 @@ const DragAndDropFileUploadField = ({
|
|
|
31
31
|
color: 'primary',
|
|
32
32
|
variant: 'outline'
|
|
33
33
|
},
|
|
34
|
-
labelUploadIcon =
|
|
35
|
-
svgDefinition: arrowUpFromBracket
|
|
36
|
-
}),
|
|
34
|
+
labelUploadIcon = arrowUpFromBracket,
|
|
37
35
|
multiple = false,
|
|
38
36
|
restrictionsTxt = '',
|
|
39
37
|
validFiles = {
|
|
@@ -168,7 +166,7 @@ const DragAndDropFileUploadField = ({
|
|
|
168
166
|
}
|
|
169
167
|
}, /*#__PURE__*/React.createElement("span", {
|
|
170
168
|
className: "dragAndDropFileUploadLabel"
|
|
171
|
-
}, labelUploadIcon
|
|
169
|
+
}, renderIcon(labelUploadIcon), /*#__PURE__*/React.createElement(FormFieldLabel, labelProps), restrictionsTxt && /*#__PURE__*/React.createElement("span", {
|
|
172
170
|
className: "fileRestrictionsText"
|
|
173
171
|
}, restrictionsTxt)), /*#__PURE__*/React.createElement("span", {
|
|
174
172
|
className: "inputContainer"
|