@zohodesk/components 1.0.0-temp-227 → 1.0.0-temp-228
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/.cli/propValidation_report.html +1 -1
- package/README.md +31 -20
- package/assets/Appearance/dark/mode/Component_v2_DarkMode.module.css +11 -0
- package/assets/Appearance/light/mode/Component_v2_LightMode.module.css +11 -0
- package/assets/Appearance/pureDark/mode/Component_v2_PureDarkMode.module.css +11 -0
- package/es/Accordion/Accordion.js +2 -2
- package/es/Accordion/AccordionItem.js +4 -4
- package/es/Accordion/__tests__/Accordion.spec.js +1 -1
- package/es/Accordion/__tests__/AccordionItem.spec.js +1 -1
- package/es/Accordion/index.js +2 -2
- package/es/Animation/Animation.js +3 -3
- package/es/Animation/__tests__/Animation.spec.js +1 -1
- package/es/Animation/utils.js +1 -1
- package/es/AppContainer/AppContainer.js +13 -14
- package/es/AppContainer/__tests__/AppContainer.spec.js +1 -1
- package/es/Avatar/Avatar.js +5 -5
- package/es/Avatar/__tests__/Avatar.spec.js +1 -1
- package/es/AvatarTeam/AvatarTeam.js +4 -4
- package/es/AvatarTeam/__tests__/AvatarTeam.spec.js +1 -1
- package/es/AvatarTeam/props/propTypes.js +1 -1
- package/es/Button/Button.js +4 -4
- package/es/Button/__tests__/Button.spec.js +2 -135
- package/es/Button/index.js +2 -2
- package/es/Button/props/defaultProps.js +1 -1
- package/es/Buttongroup/Buttongroup.js +3 -3
- package/es/Buttongroup/__tests__/Buttongroup.spec.js +1 -1
- package/es/Card/Card.js +5 -5
- package/es/Card/__tests__/Card.spec.js +1 -1
- package/es/Card/index.js +4 -4
- package/es/CheckBox/CheckBox.js +6 -6
- package/es/CheckBox/__tests__/CheckBox.spec.js +1 -1
- package/es/DateTime/CalendarView.js +6 -6
- package/es/DateTime/DateTime.js +15 -15
- package/es/DateTime/DateTimePopupFooter.js +5 -5
- package/es/DateTime/DateTimePopupHeader.js +4 -4
- package/es/DateTime/DateWidget.js +17 -17
- package/es/DateTime/DaysRow.js +3 -3
- package/es/DateTime/Time.js +5 -5
- package/es/DateTime/YearView.js +6 -6
- package/es/DateTime/__tests__/CalendarView.spec.js +1 -1
- package/es/DateTime/__tests__/DateTime.spec.js +1 -1
- package/es/DateTime/__tests__/DateTimePopupFooter.spec.js +1 -1
- package/es/DateTime/__tests__/DateTimePopupHeader.spec.js +1 -1
- package/es/DateTime/__tests__/DateWidget.spec.js +1 -1
- package/es/DateTime/__tests__/DaysRow.spec.js +1 -1
- package/es/DateTime/__tests__/Time.spec.js +1 -1
- package/es/DateTime/__tests__/YearView.spec.js +3 -2
- package/es/DateTime/__tests__/__snapshots__/YearView.spec.js.snap +61 -0
- package/es/DateTime/dateFormatUtils/dateFormat.js +4 -4
- package/es/DateTime/dateFormatUtils/dayChange.js +2 -2
- package/es/DateTime/dateFormatUtils/index.js +3 -3
- package/es/DateTime/dateFormatUtils/monthChange.js +2 -2
- package/es/DateTime/dateFormatUtils/timeChange.js +2 -2
- package/es/DateTime/dateFormatUtils/yearChange.js +2 -2
- package/es/DateTime/index.js +1 -1
- package/es/DateTime/props/propTypes.js +1 -1
- package/es/DateTime/validator.js +2 -2
- package/es/DropBox/DropBox.js +9 -9
- package/es/DropBox/DropBoxElement/DropBoxElement.js +6 -6
- package/es/DropBox/DropBoxElement/__tests__/DropBoxElement.spec.js +1 -1
- package/es/DropBox/DropBoxElement/css/cssJSLogic.js +1 -1
- package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +1 -1
- package/es/DropBox/__tests__/DropBox.spec.js +1 -1
- package/es/DropBox/css/cssJSLogic.js +1 -1
- package/es/DropBox/props/defaultProps.js +1 -1
- package/es/DropBox/props/propTypes.js +1 -1
- package/es/DropBox/utils/isMobilePopover.js +1 -1
- package/es/DropDown/DropDown.js +4 -4
- package/es/DropDown/DropDownHeading.js +3 -3
- package/es/DropDown/DropDownItem.js +3 -3
- package/es/DropDown/DropDownSearch.js +4 -4
- package/es/DropDown/DropDownSeparator.js +2 -2
- package/es/DropDown/__tests__/DropDown.spec.js +1 -1
- package/es/DropDown/__tests__/DropDownHeading.spec.js +1 -1
- package/es/DropDown/__tests__/DropDownItem.spec.js +1 -1
- package/es/DropDown/__tests__/DropDownSearch.spec.js +1 -1
- package/es/DropDown/__tests__/DropDownSeparator.spec.js +1 -1
- package/es/DropDown/index.js +7 -7
- package/es/DropDown/props/propTypes.js +1 -1
- package/es/Heading/Heading.js +4 -4
- package/es/Heading/__tests__/Heading.spec.js +1 -1
- package/es/Label/Label.js +4 -4
- package/es/Label/__tests__/Label.spec.js +1 -1
- package/es/Layout/Box.js +4 -4
- package/es/Layout/Container.js +4 -4
- package/es/Layout/__tests__/Box.spec.js +1 -1
- package/es/Layout/__tests__/Container.spec.js +1 -1
- package/es/Layout/index.js +2 -2
- package/es/ListItem/ListContainer.js +6 -6
- package/es/ListItem/ListItem.js +5 -5
- package/es/ListItem/ListItemWithAvatar.js +7 -7
- package/es/ListItem/ListItemWithCheckBox.js +6 -6
- package/es/ListItem/ListItemWithIcon.js +5 -5
- package/es/ListItem/ListItemWithRadio.js +6 -6
- package/es/ListItem/__tests__/ListContainer.spec.js +1 -1
- package/es/ListItem/__tests__/ListItem.spec.js +1 -1
- package/es/ListItem/__tests__/ListItemWithAvatar.spec.js +1 -1
- package/es/ListItem/__tests__/ListItemWithCheckBox.spec.js +1 -1
- package/es/ListItem/__tests__/ListItemWithIcon.spec.js +1 -1
- package/es/ListItem/__tests__/ListItemWithRadio.spec.js +1 -1
- package/es/ListItem/index.js +6 -6
- package/es/ListItem/props/propTypes.js +2 -2
- package/es/Modal/Modal.js +3 -3
- package/es/Modal/__tests__/Modal.spec.js +1 -1
- package/es/MultiSelect/AdvancedGroupMultiSelect.js +17 -17
- package/es/MultiSelect/AdvancedMultiSelect.js +17 -17
- package/es/MultiSelect/EmptyState.js +3 -3
- package/es/MultiSelect/MobileHeader/MobileHeader.js +5 -5
- package/es/MultiSelect/MobileHeader/__tests__/MobileHeader.spec.js +1 -1
- package/es/MultiSelect/MultiSelect.js +22 -35
- package/es/MultiSelect/MultiSelectHeader.js +4 -4
- package/es/MultiSelect/MultiSelectWithAvatar.js +16 -16
- package/es/MultiSelect/SelectedOptions.js +5 -5
- package/es/MultiSelect/Suggestions.js +6 -6
- package/es/MultiSelect/__tests__/AdvancedGroupMultiSelect.spec.js +1 -1
- package/es/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +2 -9
- package/es/MultiSelect/__tests__/EmptyState.spec.js +1 -1
- package/es/MultiSelect/__tests__/MultiSelect.spec.js +1 -1
- package/es/MultiSelect/__tests__/MultiSelectHeader.spec.js +1 -1
- package/es/MultiSelect/__tests__/MultiSelectWithAvatar.spec.js +1 -1
- package/es/MultiSelect/__tests__/SelectedOptions.spec.js +1 -1
- package/es/MultiSelect/__tests__/Suggestions.spec.js +1 -1
- package/es/MultiSelect/index.js +4 -4
- package/es/MultiSelect/props/defaultProps.js +1 -1
- package/es/MultiSelect/props/propTypes.js +1 -3
- package/es/PopOver/PopOver.js +6 -6
- package/es/PopOver/__tests__/PopOver.spec.js +1 -1
- package/es/PopOver/index.js +3 -3
- package/es/Popup/Popup.js +7 -7
- package/es/Provider/AvatarSize.js +1 -1
- package/es/Provider/CssProvider.js +1 -1
- package/es/Provider/IdProvider.js +3 -3
- package/es/Provider/LibraryContext.js +5 -3
- package/es/Provider/ZindexProvider.js +2 -2
- package/es/Provider/index.js +4 -4
- package/es/Radio/Radio.js +6 -6
- package/es/Radio/__tests__/Radio.spec.js +1 -1
- package/es/Responsive/CustomResponsive.js +7 -7
- package/es/Responsive/ResizeComponent.js +2 -2
- package/es/Responsive/Responsive.js +6 -6
- package/es/Responsive/index.js +3 -3
- package/es/Responsive/utils/index.js +1 -1
- package/es/Responsive/windowResizeObserver.js +1 -1
- package/es/ResponsiveDropBox/ResponsiveDropBox.js +6 -6
- package/es/ResponsiveDropBox/__tests__/ResponsiveDropBox.spec.js +1 -1
- package/es/ResponsiveDropBox/props/propTypes.js +1 -1
- package/es/Ribbon/Ribbon.js +3 -3
- package/es/Ribbon/__tests__/Ribbon.spec.js +1 -1
- package/es/RippleEffect/RippleEffect.js +4 -4
- package/es/RippleEffect/__tests__/RippleEffect.spec.js +1 -1
- package/es/Select/GroupSelect.js +16 -16
- package/es/Select/Select.js +21 -30
- package/es/Select/SelectWithAvatar.js +17 -17
- package/es/Select/SelectWithIcon.js +13 -13
- package/es/Select/__tests__/GroupSelect.spec.js +1 -1
- package/es/Select/__tests__/Select.spec.js +5 -1131
- package/es/Select/__tests__/SelectWithAvatar.spec.js +1 -1
- package/es/Select/__tests__/SelectWithIcon.spec.js +1 -1
- package/es/Select/__tests__/__snapshots__/Select.spec.js.snap +1 -9621
- package/es/Select/index.js +4 -4
- package/es/Select/props/defaultProps.js +1 -1
- package/es/Select/props/propTypes.js +1 -3
- package/es/Stencils/Stencils.js +15 -8
- package/es/Stencils/Stencils.module.css +7 -11
- package/es/Stencils/__tests__/Stencils.spec.js +2 -10
- package/es/Stencils/__tests__/__snapshots__/Stencils.spec.js.snap +11 -27
- package/es/Stencils/props/defaultProps.js +1 -2
- package/es/Stencils/props/propTypes.js +2 -3
- package/es/Switch/Switch.js +5 -5
- package/es/Switch/__tests__/Switch.spec.js +1 -1
- package/es/Tab/Tab.js +6 -7
- package/es/Tab/TabContent.js +4 -4
- package/es/Tab/TabContentWrapper.js +3 -3
- package/es/Tab/TabWrapper.js +4 -5
- package/es/Tab/Tabs.js +23 -23
- package/es/Tab/__tests__/Tab.spec.js +1 -1
- package/es/Tab/__tests__/TabContent.spec.js +1 -1
- package/es/Tab/__tests__/TabContentWrapper.spec.js +1 -1
- package/es/Tab/__tests__/TabWrapper.spec.js +1 -1
- package/es/Tab/__tests__/Tabs.spec.js +1 -1
- package/es/Tab/index.js +5 -5
- package/es/Tab/props/propTypes.js +2 -2
- package/es/Tag/Tag.js +7 -7
- package/es/Tag/__tests__/Tag.spec.js +2 -9
- package/es/Tag/props/propTypes.js +1 -1
- package/es/TextBox/TextBox.js +3 -3
- package/es/TextBox/__tests__/TextBox.spec.js +1 -1
- package/es/TextBoxIcon/TextBoxIcon.js +8 -12
- package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +1 -1
- package/es/TextBoxIcon/props/propTypes.js +2 -3
- package/es/Textarea/Textarea.js +3 -3
- package/es/Textarea/__tests__/Textarea.spec.js +1 -1
- package/es/Tooltip/Tooltip.js +6 -6
- package/es/Typography/Typography.js +4 -4
- package/es/Typography/css/cssJSLogic.js +1 -1
- package/es/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +3 -3
- package/es/VelocityAnimation/VelocityAnimation/__tests__/VelocityAnimation.spec.js +1 -1
- package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +6 -43
- package/es/VelocityAnimation/VelocityAnimationGroup/__tests__/VelocityAnimationGroup.spec.js +1 -1
- package/es/VelocityAnimation/VelocityAnimationGroup/props/propTypes.js +1 -4
- package/es/VelocityAnimation/index.js +2 -2
- package/es/components-v2/Switch/Switch.js +151 -0
- package/es/components-v2/Switch/contants/index.js +12 -0
- package/es/components-v2/Switch/css/Switch_v2.module.css +140 -0
- package/es/components-v2/Switch/css/cssJSLogic.js +48 -0
- package/es/components-v2/Switch/props/defaultProps.js +12 -0
- package/es/components-v2/Switch/props/propTypes.js +32 -0
- package/es/components-v2/Switch/useSwitch.js +29 -0
- package/es/css.js +37 -37
- package/es/deprecated/PortalLayer/PortalLayer.js +3 -3
- package/es/index.js +39 -39
- package/es/semantic/Button/Button.js +3 -3
- package/es/semantic/Button/__tests__/Button.spec.js +1 -1
- package/es/semantic/index.js +1 -1
- package/es/utils/Common.js +2 -2
- package/es/utils/ContextOptimizer.js +1 -1
- package/es/utils/cssUtils.js +1 -1
- package/es/utils/datetime/common.js +1 -1
- package/es/utils/dropDownUtils.js +1 -1
- package/es/utils/index.js +1 -1
- package/es/v1/Accordion/Accordion.js +2 -2
- package/es/v1/Accordion/AccordionItem.js +4 -4
- package/es/v1/Accordion/index.js +2 -2
- package/es/v1/Animation/Animation.js +3 -3
- package/es/v1/Animation/utils.js +1 -1
- package/es/v1/AppContainer/AppContainer.js +8 -8
- package/es/v1/Avatar/Avatar.js +5 -5
- package/es/v1/AvatarTeam/AvatarTeam.js +4 -4
- package/es/v1/Button/Button.js +4 -4
- package/es/v1/Button/props/defaultProps.js +1 -1
- package/es/v1/Buttongroup/Buttongroup.js +3 -3
- package/es/v1/Card/Card.js +5 -5
- package/es/v1/Card/index.js +4 -4
- package/es/v1/CheckBox/CheckBox.js +6 -6
- package/es/v1/DateTime/CalendarView.js +7 -7
- package/es/v1/DateTime/DateTime.js +15 -15
- package/es/v1/DateTime/DateTimePopupFooter.js +5 -5
- package/es/v1/DateTime/DateTimePopupHeader.js +4 -4
- package/es/v1/DateTime/DateWidget.js +17 -17
- package/es/v1/DateTime/DaysRow.js +3 -3
- package/es/v1/DateTime/Time.js +5 -5
- package/es/v1/DateTime/YearView.js +6 -6
- package/es/v1/DateTime/index.js +1 -1
- package/es/v1/DateTime/props/propTypes.js +1 -1
- package/es/v1/DropBox/DropBox.js +9 -9
- package/es/v1/DropBox/DropBoxElement/DropBoxElement.js +6 -6
- package/es/v1/DropBox/props/defaultProps.js +1 -1
- package/es/v1/DropBox/props/propTypes.js +1 -1
- package/es/v1/DropBox/utils/isMobilePopover.js +1 -1
- package/es/v1/DropDown/DropDown.js +4 -4
- package/es/v1/DropDown/DropDownHeading.js +3 -3
- package/es/v1/DropDown/DropDownItem.js +3 -3
- package/es/v1/DropDown/DropDownSearch.js +4 -4
- package/es/v1/DropDown/DropDownSeparator.js +2 -2
- package/es/v1/DropDown/props/propTypes.js +1 -1
- package/es/v1/Heading/Heading.js +4 -4
- package/es/v1/Label/Label.js +4 -4
- package/es/v1/Layout/Box.js +4 -4
- package/es/v1/Layout/Container.js +4 -4
- package/es/v1/Layout/index.js +2 -2
- package/es/v1/ListItem/ListContainer.js +6 -6
- package/es/v1/ListItem/ListItem.js +5 -5
- package/es/v1/ListItem/ListItemWithAvatar.js +7 -7
- package/es/v1/ListItem/ListItemWithCheckBox.js +6 -6
- package/es/v1/ListItem/ListItemWithIcon.js +5 -5
- package/es/v1/ListItem/ListItemWithRadio.js +6 -6
- package/es/v1/ListItem/index.js +6 -6
- package/es/v1/Modal/Modal.js +3 -3
- package/es/v1/MultiSelect/AdvancedGroupMultiSelect.js +17 -17
- package/es/v1/MultiSelect/AdvancedMultiSelect.js +17 -17
- package/es/v1/MultiSelect/EmptyState.js +3 -3
- package/es/v1/MultiSelect/MobileHeader/MobileHeader.js +5 -5
- package/es/v1/MultiSelect/MultiSelect.js +19 -19
- package/es/v1/MultiSelect/MultiSelectHeader.js +4 -4
- package/es/v1/MultiSelect/MultiSelectWithAvatar.js +16 -16
- package/es/v1/MultiSelect/SelectedOptions.js +5 -5
- package/es/v1/MultiSelect/Suggestions.js +6 -6
- package/es/v1/MultiSelect/index.js +4 -4
- package/es/v1/MultiSelect/props/defaultProps.js +1 -1
- package/es/v1/PopOver/PopOver.js +6 -6
- package/es/v1/Popup/Popup.js +3 -3
- package/es/v1/Radio/Radio.js +5 -5
- package/es/v1/ResponsiveDropBox/ResponsiveDropBox.js +6 -6
- package/es/v1/ResponsiveDropBox/props/propTypes.js +1 -1
- package/es/v1/Ribbon/Ribbon.js +3 -3
- package/es/v1/RippleEffect/RippleEffect.js +4 -4
- package/es/v1/Select/GroupSelect.js +16 -16
- package/es/v1/Select/Select.js +15 -15
- package/es/v1/Select/SelectWithAvatar.js +17 -17
- package/es/v1/Select/SelectWithIcon.js +13 -13
- package/es/v1/Select/index.js +4 -4
- package/es/v1/Select/props/defaultProps.js +1 -1
- package/es/v1/Stencils/Stencils.js +3 -3
- package/es/v1/Switch/Switch.js +5 -5
- package/es/v1/Tab/Tab.js +5 -5
- package/es/v1/Tab/TabContent.js +4 -4
- package/es/v1/Tab/TabContentWrapper.js +3 -3
- package/es/v1/Tab/TabWrapper.js +3 -3
- package/es/v1/Tab/Tabs.js +13 -13
- package/es/v1/Tab/index.js +5 -5
- package/es/v1/Tag/Tag.js +7 -7
- package/es/v1/TextBox/TextBox.js +3 -3
- package/es/v1/TextBoxIcon/TextBoxIcon.js +6 -6
- package/es/v1/TextBoxIcon/props/propTypes.js +1 -1
- package/es/v1/Textarea/Textarea.js +3 -3
- package/es/v1/Tooltip/Tooltip.js +6 -6
- package/es/v1/Typography/Typography.js +4 -4
- package/es/v1/Typography/css/cssJSLogic.js +1 -1
- package/es/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +3 -3
- package/es/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +3 -3
- package/es/v1/semantic/Button/Button.js +3 -3
- package/es/v1/semantic/index.js +1 -1
- package/lib/AppContainer/AppContainer.js +6 -7
- package/lib/Button/__tests__/Button.spec.js +0 -140
- package/lib/DateTime/__tests__/YearView.spec.js +2 -1
- package/lib/DateTime/__tests__/__snapshots__/YearView.spec.js.snap +61 -0
- package/lib/MultiSelect/MultiSelect.js +3 -16
- package/lib/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +0 -8
- package/lib/MultiSelect/props/propTypes.js +1 -3
- package/lib/Provider/IdProvider.js +0 -1
- package/lib/Provider/LibraryContext.js +3 -1
- package/lib/Select/Select.js +7 -16
- package/lib/Select/__tests__/Select.spec.js +3 -1364
- package/lib/Select/__tests__/__snapshots__/Select.spec.js.snap +1 -9621
- package/lib/Select/props/propTypes.js +1 -3
- package/lib/Stencils/Stencils.js +12 -5
- package/lib/Stencils/Stencils.module.css +7 -11
- package/lib/Stencils/__tests__/Stencils.spec.js +3 -11
- package/lib/Stencils/__tests__/__snapshots__/Stencils.spec.js.snap +11 -27
- package/lib/Stencils/props/defaultProps.js +1 -2
- package/lib/Stencils/props/propTypes.js +2 -3
- package/lib/Tab/Tab.js +1 -3
- package/lib/Tab/TabWrapper.js +1 -3
- package/lib/Tab/Tabs.js +10 -11
- package/lib/Tab/props/propTypes.js +2 -2
- package/lib/Tag/__tests__/Tag.spec.js +2 -10
- package/lib/TextBoxIcon/TextBoxIcon.js +2 -6
- package/lib/TextBoxIcon/props/propTypes.js +1 -2
- package/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +26 -80
- package/lib/VelocityAnimation/VelocityAnimationGroup/props/propTypes.js +1 -4
- package/lib/components-v2/Switch/Switch.js +169 -0
- package/lib/components-v2/Switch/contants/index.js +20 -0
- package/lib/components-v2/Switch/css/Switch_v2.module.css +140 -0
- package/lib/components-v2/Switch/css/cssJSLogic.js +37 -0
- package/lib/components-v2/Switch/props/defaultProps.js +19 -0
- package/lib/components-v2/Switch/props/propTypes.js +43 -0
- package/lib/components-v2/Switch/useSwitch.js +52 -0
- package/lib/utils/Common.js +1 -1
- package/package.json +4 -3
- package/react-cli.config.js +2 -2
- package/result.json +1 -0
- package/es/Tab/__tests__/TabLayout.spec.js +0 -34
- package/es/Tab/__tests__/__snapshots__/TabLayout.spec.js.snap +0 -341
- package/es/Tab/utils/tabConfigs.js +0 -18
- package/lib/Tab/__tests__/TabLayout.spec.js +0 -41
- package/lib/Tab/__tests__/__snapshots__/TabLayout.spec.js.snap +0 -341
- package/lib/Tab/utils/tabConfigs.js +0 -27
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _defaultProps = _interopRequireDefault(require("./props/defaultProps"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = require("./props/propTypes");
|
|
15
|
+
|
|
16
|
+
var _cssJSLogic2 = _interopRequireDefault(require("./css/cssJSLogic"));
|
|
17
|
+
|
|
18
|
+
var _utils = require("@zohodesk/utils");
|
|
19
|
+
|
|
20
|
+
var _useSwitch2 = _interopRequireDefault(require("./useSwitch"));
|
|
21
|
+
|
|
22
|
+
var _contants = require("./contants");
|
|
23
|
+
|
|
24
|
+
var _Flex = _interopRequireDefault(require("@zohodesk/layout/es/Flex/Flex"));
|
|
25
|
+
|
|
26
|
+
var _Label = _interopRequireDefault(require("../../Label/Label"));
|
|
27
|
+
|
|
28
|
+
var _LibraryContextInit = _interopRequireDefault(require("../../Provider/LibraryContextInit"));
|
|
29
|
+
|
|
30
|
+
var _Switch_v2Module = _interopRequireDefault(require("./css/Switch_v2.module.css"));
|
|
31
|
+
|
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
33
|
+
|
|
34
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
|
+
|
|
36
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
+
|
|
38
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
39
|
+
|
|
40
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
|
+
|
|
42
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
43
|
+
|
|
44
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
45
|
+
|
|
46
|
+
var Switch = function Switch(props) {
|
|
47
|
+
var name = props.name,
|
|
48
|
+
value = props.value,
|
|
49
|
+
id = props.id,
|
|
50
|
+
size = props.size,
|
|
51
|
+
isCheckedProp = props.isChecked,
|
|
52
|
+
isDefaultChecked = props.isDefaultChecked,
|
|
53
|
+
isDisabled = props.isDisabled,
|
|
54
|
+
isReadOnly = props.isReadOnly,
|
|
55
|
+
onChange = props.onChange,
|
|
56
|
+
hasStateIndication = props.hasStateIndication,
|
|
57
|
+
label = props.label,
|
|
58
|
+
labelPlacement = props.labelPlacement,
|
|
59
|
+
labelSize = props.labelSize,
|
|
60
|
+
title = props.title,
|
|
61
|
+
customProps = props.customProps,
|
|
62
|
+
tagAttributes = props.tagAttributes,
|
|
63
|
+
a11yAttributes = props.a11yAttributes,
|
|
64
|
+
customId = props.customId,
|
|
65
|
+
testId = props.testId,
|
|
66
|
+
customStyle = props.customStyle;
|
|
67
|
+
|
|
68
|
+
var _useContext = (0, _react.useContext)(_LibraryContextInit["default"]),
|
|
69
|
+
shouldIndicateSwitchState = _useContext.shouldIndicateSwitchState;
|
|
70
|
+
|
|
71
|
+
var customProps_container = customProps.container,
|
|
72
|
+
customProps_label = customProps.label;
|
|
73
|
+
var tagAttributes_container = tagAttributes.container,
|
|
74
|
+
tagAttributes_switch = tagAttributes["switch"];
|
|
75
|
+
var a11yAttributes_container = a11yAttributes.container,
|
|
76
|
+
_a11yAttributes$switc = a11yAttributes["switch"],
|
|
77
|
+
a11yAttributes_switch = _a11yAttributes$switc === void 0 ? {} : _a11yAttributes$switc,
|
|
78
|
+
a11yAttributes_label = a11yAttributes.label;
|
|
79
|
+
var _a11yAttributes_switc = a11yAttributes_switch.role,
|
|
80
|
+
role = _a11yAttributes_switc === void 0 ? 'switch' : _a11yAttributes_switc,
|
|
81
|
+
_a11yAttributes_switc2 = a11yAttributes_switch.ariaDisabled,
|
|
82
|
+
ariaDisabled = _a11yAttributes_switc2 === void 0 ? isDisabled : _a11yAttributes_switc2,
|
|
83
|
+
restA11yAttributes_switch = a11yAttributes_switch.restA11yAttributes_switch;
|
|
84
|
+
|
|
85
|
+
var _useSwitch = (0, _useSwitch2["default"])({
|
|
86
|
+
isCheckedProp: isCheckedProp,
|
|
87
|
+
isDefaultChecked: isDefaultChecked,
|
|
88
|
+
onChange: onChange
|
|
89
|
+
}),
|
|
90
|
+
isChecked = _useSwitch.isChecked,
|
|
91
|
+
handleChange = _useSwitch.handleChange;
|
|
92
|
+
|
|
93
|
+
var style = (0, _utils.mergeStyle)(_Switch_v2Module["default"], customStyle);
|
|
94
|
+
|
|
95
|
+
var _cssJSLogic = (0, _cssJSLogic2["default"])({
|
|
96
|
+
props: _objectSpread(_objectSpread({}, props), {}, {
|
|
97
|
+
isChecked: isChecked
|
|
98
|
+
}),
|
|
99
|
+
style: style
|
|
100
|
+
}),
|
|
101
|
+
containerClass = _cssJSLogic.containerClass,
|
|
102
|
+
labelClass = _cssJSLogic.labelClass,
|
|
103
|
+
trackClass = _cssJSLogic.trackClass,
|
|
104
|
+
trackWrapperClass = _cssJSLogic.trackWrapperClass,
|
|
105
|
+
thumbClass = _cssJSLogic.thumbClass,
|
|
106
|
+
labelIndicationClass = _cssJSLogic.labelIndicationClass;
|
|
107
|
+
|
|
108
|
+
return /*#__PURE__*/_react["default"].createElement(_Flex["default"], _extends({
|
|
109
|
+
$ui_displayMode: "inline",
|
|
110
|
+
$ui_direction: labelPlacement === 'left' ? 'row' : 'rowReverse',
|
|
111
|
+
$ui_alignItems: "center",
|
|
112
|
+
$tagAttributes_container: _objectSpread({
|
|
113
|
+
'data-selector-id': customId
|
|
114
|
+
}, tagAttributes_container),
|
|
115
|
+
testId: testId,
|
|
116
|
+
customId: customId,
|
|
117
|
+
customStyle: {
|
|
118
|
+
inlineFlex: containerClass
|
|
119
|
+
},
|
|
120
|
+
$a11yAttributes_container: a11yAttributes_container
|
|
121
|
+
}, customProps_container), label && /*#__PURE__*/_react["default"].createElement(_Label["default"], _extends({
|
|
122
|
+
text: label,
|
|
123
|
+
palette: isDisabled || isReadOnly ? 'primary' : 'default',
|
|
124
|
+
size: labelSize,
|
|
125
|
+
htmlFor: id,
|
|
126
|
+
customClass: labelClass,
|
|
127
|
+
a11y: a11yAttributes_label
|
|
128
|
+
}, customProps_label)), /*#__PURE__*/_react["default"].createElement(_Flex["default"], {
|
|
129
|
+
$flag_shrink: false,
|
|
130
|
+
customStyle: {
|
|
131
|
+
noShrink: trackWrapperClass
|
|
132
|
+
}
|
|
133
|
+
}, /*#__PURE__*/_react["default"].createElement("input", _extends({
|
|
134
|
+
type: "checkbox",
|
|
135
|
+
id: id,
|
|
136
|
+
name: name,
|
|
137
|
+
value: value,
|
|
138
|
+
checked: isChecked,
|
|
139
|
+
readOnly: isReadOnly,
|
|
140
|
+
onChange: !isDisabled && !isReadOnly ? handleChange : null,
|
|
141
|
+
className: trackClass,
|
|
142
|
+
"data-title": title,
|
|
143
|
+
role: role,
|
|
144
|
+
"aria-disabled": ariaDisabled
|
|
145
|
+
}, tagAttributes_switch, restA11yAttributes_switch)), /*#__PURE__*/_react["default"].createElement("svg", {
|
|
146
|
+
className: thumbClass,
|
|
147
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
148
|
+
}, /*#__PURE__*/_react["default"].createElement("circle", {
|
|
149
|
+
cx: "50%",
|
|
150
|
+
cy: "50%",
|
|
151
|
+
r: _contants.THUMB_RADIUS[size]
|
|
152
|
+
})), hasStateIndication || shouldIndicateSwitchState ? /*#__PURE__*/_react["default"].createElement("svg", {
|
|
153
|
+
className: labelIndicationClass,
|
|
154
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
155
|
+
}, isChecked ? /*#__PURE__*/_react["default"].createElement("rect", {
|
|
156
|
+
width: "100%",
|
|
157
|
+
height: "100%",
|
|
158
|
+
rx: "50%"
|
|
159
|
+
}) : /*#__PURE__*/_react["default"].createElement("circle", {
|
|
160
|
+
cx: "50%",
|
|
161
|
+
cy: "50%",
|
|
162
|
+
r: _contants.OFF_LABEL_RADIUS[size]
|
|
163
|
+
})) : null));
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
var _default = Switch;
|
|
167
|
+
exports["default"] = _default;
|
|
168
|
+
Switch.defaultProps = _defaultProps["default"];
|
|
169
|
+
Switch.propTypes = _propTypes.propTypes;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.THUMB_RADIUS = exports.OFF_LABEL_RADIUS = void 0;
|
|
7
|
+
var OFF_LABEL_RADIUS = {
|
|
8
|
+
small: '35.7%',
|
|
9
|
+
medium: '37.5%',
|
|
10
|
+
large: '38.9%',
|
|
11
|
+
xlarge: '40%'
|
|
12
|
+
};
|
|
13
|
+
exports.OFF_LABEL_RADIUS = OFF_LABEL_RADIUS;
|
|
14
|
+
var THUMB_RADIUS = {
|
|
15
|
+
small: '40%',
|
|
16
|
+
medium: '42.85%',
|
|
17
|
+
large: '44.45%',
|
|
18
|
+
xlarge: '45.45%'
|
|
19
|
+
};
|
|
20
|
+
exports.THUMB_RADIUS = THUMB_RADIUS;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
--switch-cursor: pointer;
|
|
3
|
+
--switch-offLabel-stroke: var(--zdt_v2_switch_offLabel);
|
|
4
|
+
gap: var(--zd_size6) ;
|
|
5
|
+
}
|
|
6
|
+
.small {
|
|
7
|
+
--switch-track-width: var(--zd_size22);
|
|
8
|
+
--switch-track-height: var(--zd_size12);
|
|
9
|
+
--switch-track-border-radius: 8px;
|
|
10
|
+
--switch-thumb-size: 10px;
|
|
11
|
+
--switch-onLabel-height: var(--zd_size6);
|
|
12
|
+
--switch-onLabel-left: var(--zd_size5);
|
|
13
|
+
--switch-offLabel-size: var(--zd_size7);
|
|
14
|
+
--switch-offLabel-right: var(--zd_size2);
|
|
15
|
+
}
|
|
16
|
+
.medium {
|
|
17
|
+
--switch-track-width: var(--zd_size28);
|
|
18
|
+
--switch-track-height: var(--zd_size16);
|
|
19
|
+
--switch-track-border-radius: 16px;
|
|
20
|
+
--switch-thumb-size: 14px;
|
|
21
|
+
--switch-onLabel-height: var(--zd_size8);
|
|
22
|
+
--switch-onLabel-left: var(--zd_size6);
|
|
23
|
+
--switch-offLabel-size: var(--zd_size8);
|
|
24
|
+
--switch-offLabel-right: var(--zd_size3);
|
|
25
|
+
}
|
|
26
|
+
.large {
|
|
27
|
+
--switch-track-width: var(--zd_size34);
|
|
28
|
+
--switch-track-height: var(--zd_size20);
|
|
29
|
+
--switch-track-border-radius: 10px;
|
|
30
|
+
--switch-thumb-size: 18px;
|
|
31
|
+
--switch-onLabel-height: var(--zd_size10);
|
|
32
|
+
--switch-onLabel-left: var(--zd_size7);
|
|
33
|
+
--switch-offLabel-size: var(--zd_size9);
|
|
34
|
+
--switch-offLabel-right: var(--zd_size4);
|
|
35
|
+
}
|
|
36
|
+
.xlarge {
|
|
37
|
+
--switch-track-width: var(--zd_size40);
|
|
38
|
+
--switch-track-height: var(--zd_size24);
|
|
39
|
+
--switch-track-border-radius: 12px;
|
|
40
|
+
--switch-thumb-size: 22px;
|
|
41
|
+
--switch-onLabel-height: var(--zd_size12);
|
|
42
|
+
--switch-onLabel-left: var(--zd_size8);
|
|
43
|
+
--switch-offLabel-size: var(--zd_size10);
|
|
44
|
+
--switch-offLabel-right: var(--zd_size5);
|
|
45
|
+
}
|
|
46
|
+
.checked {
|
|
47
|
+
--switch-track-background-color: var(--zdt_v2_switch_track_on_bg);
|
|
48
|
+
--switch-thumb-translateX-value: calc(var(--switch-track-width) - var(--switch-thumb-size) - 2px)
|
|
49
|
+
}
|
|
50
|
+
.unChecked {
|
|
51
|
+
--switch-track-background-color: var(--zdt_v2_switch_track_off_bg);
|
|
52
|
+
--switch-thumb-translateX-value: 0;
|
|
53
|
+
}
|
|
54
|
+
.disabled, .readonly {
|
|
55
|
+
--switch-cursor: not-allowed;
|
|
56
|
+
}
|
|
57
|
+
.checked.enabled:hover {
|
|
58
|
+
--switch-track-background-color: var(--zdt_v2_switch_track_on_hover_bg);
|
|
59
|
+
}
|
|
60
|
+
.unChecked.enabled:hover {
|
|
61
|
+
--switch-track-background-color: var(--zdt_v2_switch_track_off_hover_bg);
|
|
62
|
+
}
|
|
63
|
+
.enabled:hover {
|
|
64
|
+
--switch-offLabel-stroke: var(--zdt_v2_switch_offLabel_hover);
|
|
65
|
+
}
|
|
66
|
+
.trackWrapper {
|
|
67
|
+
position: relative;
|
|
68
|
+
}
|
|
69
|
+
.disabled .trackWrapper {
|
|
70
|
+
opacity: 0.4;
|
|
71
|
+
}
|
|
72
|
+
.track {
|
|
73
|
+
appearance: none;
|
|
74
|
+
display: block;
|
|
75
|
+
position: relative;
|
|
76
|
+
height: var(--switch-track-height);
|
|
77
|
+
width: var(--switch-track-width);
|
|
78
|
+
margin: 0 ;
|
|
79
|
+
border-radius: var(--switch-track-border-radius);
|
|
80
|
+
background-color: var(--switch-track-background-color);
|
|
81
|
+
cursor: var(--switch-cursor);
|
|
82
|
+
}
|
|
83
|
+
.commonSvg {
|
|
84
|
+
display: block;
|
|
85
|
+
position: absolute;
|
|
86
|
+
pointer-events: none;
|
|
87
|
+
top: 50% ;
|
|
88
|
+
}
|
|
89
|
+
.thumb {
|
|
90
|
+
transition: transform var(--zd_transition2) cubic-bezier(0.4, 0, 0.2, 1);
|
|
91
|
+
fill: var(--zdt_v2_switch_thumb_bg);
|
|
92
|
+
height: var(--switch-thumb-size);
|
|
93
|
+
width: var(--switch-thumb-size);
|
|
94
|
+
transform: translateX(var(--switch-thumb-translateX-value)) translateY(-50%);
|
|
95
|
+
}
|
|
96
|
+
[dir=ltr] .thumb {
|
|
97
|
+
left: var(--zd_size1) ;
|
|
98
|
+
}
|
|
99
|
+
[dir=rtl] .thumb {
|
|
100
|
+
right: var(--zd_size1) ;
|
|
101
|
+
}
|
|
102
|
+
.label {
|
|
103
|
+
cursor: var(--switch-cursor);
|
|
104
|
+
}
|
|
105
|
+
.onLabel {
|
|
106
|
+
height: var(--switch-onLabel-height);
|
|
107
|
+
fill: var(--zdt_v2_switch_onLabel);
|
|
108
|
+
transform: translateY(-50%);
|
|
109
|
+
}
|
|
110
|
+
[dir=ltr] .onLabel {
|
|
111
|
+
left: var(--switch-onLabel-left);
|
|
112
|
+
}
|
|
113
|
+
[dir=rtl] .onLabel {
|
|
114
|
+
right: var(--switch-onLabel-left);
|
|
115
|
+
}
|
|
116
|
+
.offLabel {
|
|
117
|
+
height: var(--switch-offLabel-size);
|
|
118
|
+
width: var(--switch-offLabel-size);
|
|
119
|
+
fill: transparent;
|
|
120
|
+
stroke: var(--switch-offLabel-stroke);
|
|
121
|
+
transform: translateY(-50%);
|
|
122
|
+
}
|
|
123
|
+
[dir=ltr] .offLabel {
|
|
124
|
+
right: var(--switch-offLabel-right);
|
|
125
|
+
}
|
|
126
|
+
[dir=rtl] .offLabel {
|
|
127
|
+
left: var(--switch-offLabel-right);
|
|
128
|
+
}
|
|
129
|
+
.small .onLabel {
|
|
130
|
+
width: 1.2px;
|
|
131
|
+
}
|
|
132
|
+
.medium .onLabel {
|
|
133
|
+
width: 1.4px;
|
|
134
|
+
}
|
|
135
|
+
.large .onLabel {
|
|
136
|
+
width: 1.6px;
|
|
137
|
+
}
|
|
138
|
+
.xlarge .onLabel {
|
|
139
|
+
width: 1.8px;
|
|
140
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = cssJSLogic;
|
|
7
|
+
|
|
8
|
+
var _compileClassNames7 = _interopRequireDefault(require("@zohodesk/utils/es/compileClassNames"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
|
|
14
|
+
function cssJSLogic(_ref) {
|
|
15
|
+
var _compileClassNames, _compileClassNames5, _compileClassNames6;
|
|
16
|
+
|
|
17
|
+
var props = _ref.props,
|
|
18
|
+
style = _ref.style;
|
|
19
|
+
var size = props.size,
|
|
20
|
+
isChecked = props.isChecked,
|
|
21
|
+
isDisabled = props.isDisabled,
|
|
22
|
+
isReadOnly = props.isReadOnly;
|
|
23
|
+
var containerClass = (0, _compileClassNames7["default"])((_compileClassNames = {}, _defineProperty(_compileClassNames, style.container, true), _defineProperty(_compileClassNames, style[size], true), _defineProperty(_compileClassNames, style.checked, isChecked), _defineProperty(_compileClassNames, style.unChecked, !isChecked), _defineProperty(_compileClassNames, style.disabled, isDisabled), _defineProperty(_compileClassNames, style.enabled, !isDisabled), _defineProperty(_compileClassNames, style.readonly, isReadOnly), _compileClassNames));
|
|
24
|
+
var trackClass = (0, _compileClassNames7["default"])(_defineProperty({}, style.track, true));
|
|
25
|
+
var labelClass = (0, _compileClassNames7["default"])(_defineProperty({}, style.label, true));
|
|
26
|
+
var trackWrapperClass = (0, _compileClassNames7["default"])(_defineProperty({}, style.trackWrapper, true));
|
|
27
|
+
var thumbClass = (0, _compileClassNames7["default"])((_compileClassNames5 = {}, _defineProperty(_compileClassNames5, style.thumb, true), _defineProperty(_compileClassNames5, style.commonSvg, true), _compileClassNames5));
|
|
28
|
+
var labelIndicationClass = (0, _compileClassNames7["default"])((_compileClassNames6 = {}, _defineProperty(_compileClassNames6, style.onLabel, isChecked), _defineProperty(_compileClassNames6, style.offLabel, !isChecked), _defineProperty(_compileClassNames6, style.commonSvg, true), _compileClassNames6));
|
|
29
|
+
return {
|
|
30
|
+
containerClass: containerClass,
|
|
31
|
+
trackClass: trackClass,
|
|
32
|
+
labelClass: labelClass,
|
|
33
|
+
trackWrapperClass: trackWrapperClass,
|
|
34
|
+
thumbClass: thumbClass,
|
|
35
|
+
labelIndicationClass: labelIndicationClass
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
var _default = {
|
|
8
|
+
size: 'medium',
|
|
9
|
+
isDisabled: false,
|
|
10
|
+
isReadOnly: false,
|
|
11
|
+
// hasStateIndication: true,
|
|
12
|
+
labelPlacement: 'left',
|
|
13
|
+
labelSize: 'medium',
|
|
14
|
+
customProps: {},
|
|
15
|
+
tagAttributes: {},
|
|
16
|
+
a11yAttributes: {},
|
|
17
|
+
customStyle: {}
|
|
18
|
+
};
|
|
19
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = {
|
|
13
|
+
name: _propTypes["default"].string,
|
|
14
|
+
value: _propTypes["default"].string,
|
|
15
|
+
id: _propTypes["default"].string,
|
|
16
|
+
size: _propTypes["default"].oneOf(['small', 'medium', 'large', 'xlarge']),
|
|
17
|
+
isChecked: _propTypes["default"].bool,
|
|
18
|
+
isDisabled: _propTypes["default"].bool,
|
|
19
|
+
isReadOnly: _propTypes["default"].bool,
|
|
20
|
+
onChange: _propTypes["default"].func,
|
|
21
|
+
hasStateIndication: _propTypes["default"].bool,
|
|
22
|
+
label: _propTypes["default"].string,
|
|
23
|
+
labelPlacement: _propTypes["default"].oneOf(['left', 'right']),
|
|
24
|
+
labelSize: _propTypes["default"].oneOf(['xsmall', 'small', 'medium', 'large']),
|
|
25
|
+
title: _propTypes["default"].string,
|
|
26
|
+
customProps: _propTypes["default"].shape({
|
|
27
|
+
container: _propTypes["default"].object,
|
|
28
|
+
label: _propTypes["default"].object
|
|
29
|
+
}),
|
|
30
|
+
tagAttributes: _propTypes["default"].shape({
|
|
31
|
+
container: _propTypes["default"].object,
|
|
32
|
+
"switch": _propTypes["default"].object
|
|
33
|
+
}),
|
|
34
|
+
a11yAttributes: _propTypes["default"].shape({
|
|
35
|
+
container: _propTypes["default"].object,
|
|
36
|
+
"switch": _propTypes["default"].object,
|
|
37
|
+
label: _propTypes["default"].object
|
|
38
|
+
}),
|
|
39
|
+
customId: _propTypes["default"].string,
|
|
40
|
+
testId: _propTypes["default"].string,
|
|
41
|
+
customStyle: _propTypes["default"].object
|
|
42
|
+
};
|
|
43
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
+
|
|
16
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
17
|
+
|
|
18
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
19
|
+
|
|
20
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
21
|
+
|
|
22
|
+
var useSwitch = function useSwitch(props) {
|
|
23
|
+
var isCheckedProp = props.isCheckedProp,
|
|
24
|
+
isDefaultChecked = props.isDefaultChecked,
|
|
25
|
+
onChange = props.onChange;
|
|
26
|
+
var isControlled = isCheckedProp !== undefined;
|
|
27
|
+
|
|
28
|
+
var _useState = (0, _react.useState)(isDefaultChecked),
|
|
29
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
30
|
+
internalChecked = _useState2[0],
|
|
31
|
+
setInternalChecked = _useState2[1];
|
|
32
|
+
|
|
33
|
+
var isChecked = isControlled ? isCheckedProp : internalChecked;
|
|
34
|
+
|
|
35
|
+
var handleChange = function handleChange(e) {
|
|
36
|
+
if (!isControlled) {
|
|
37
|
+
setInternalChecked(!isChecked);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (onChange) {
|
|
41
|
+
onChange(!isChecked, e);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
isChecked: isChecked,
|
|
47
|
+
handleChange: handleChange
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
var _default = useSwitch;
|
|
52
|
+
exports["default"] = _default;
|
package/lib/utils/Common.js
CHANGED
|
@@ -61,7 +61,7 @@ exports.parseDecimal = parseDecimal;
|
|
|
61
61
|
|
|
62
62
|
var getTotalDimension = function getTotalDimension(elem, align) {
|
|
63
63
|
var style = window.getComputedStyle(elem);
|
|
64
|
-
return align === 'vertical
|
|
64
|
+
return align === 'vertical' ? elem.offsetWidth + parseDecimal(style.marginLeft) + parseDecimal(style.marginRight) : elem.offsetHeight + parseDecimal(style.marginTop) + parseDecimal(style.marginBottom);
|
|
65
65
|
};
|
|
66
66
|
|
|
67
67
|
exports.getTotalDimension = getTotalDimension;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zohodesk/components",
|
|
3
|
-
"version": "1.0.0-temp-
|
|
3
|
+
"version": "1.0.0-temp-228",
|
|
4
4
|
"main": "es/index.js",
|
|
5
5
|
"module": "es/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"build:css:umd": "npm run clean && npm run init && react-cli build:css:umd",
|
|
39
39
|
"coverage": "react-cli coverage",
|
|
40
40
|
"prepare": "npm run init && npm run build && npm run rtl && npm run cssVariableConvert ",
|
|
41
|
-
"prepublishOnly": "node prePublish.js && npm run
|
|
41
|
+
"prepublishOnly": "node prePublish.js && npm run download",
|
|
42
42
|
"postpublish": "node postPublish.js",
|
|
43
43
|
"report": "react-cli publish:report",
|
|
44
44
|
"test": "react-cli test",
|
|
@@ -94,6 +94,7 @@
|
|
|
94
94
|
"react-sortable-hoc": "^0.8.3",
|
|
95
95
|
"@zohodesk/hooks": "2.0.5",
|
|
96
96
|
"@zohodesk/utils": "1.3.14",
|
|
97
|
-
"@zohodesk/a11y": "2.3.4"
|
|
97
|
+
"@zohodesk/a11y": "2.3.4",
|
|
98
|
+
"@zohodesk/layout": "3.1.0"
|
|
98
99
|
}
|
|
99
100
|
}
|
package/react-cli.config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
exports.config
|
|
1
|
+
exports.config= {
|
|
2
2
|
"preprocess": {
|
|
3
3
|
"runner": "./preprocess/index.js"
|
|
4
4
|
},
|
|
@@ -14,7 +14,7 @@ exports.config = {
|
|
|
14
14
|
"**/es/**",
|
|
15
15
|
"!**/node_modules/**"
|
|
16
16
|
],
|
|
17
|
-
"hasRTL":
|
|
17
|
+
"hasRTL":[
|
|
18
18
|
"**/src/**",
|
|
19
19
|
"!**/node_modules/**"
|
|
20
20
|
]
|