@transferwise/components 46.50.0 → 46.51.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/build/accordion/AccordionItem/AccordionItem.js +3 -7
- package/build/accordion/AccordionItem/AccordionItem.js.map +1 -1
- package/build/accordion/AccordionItem/AccordionItem.mjs +3 -3
- package/build/accordion/AccordionItem/AccordionItem.mjs.map +1 -1
- package/build/actionButton/ActionButton.js +2 -6
- package/build/actionButton/ActionButton.js.map +1 -1
- package/build/actionButton/ActionButton.mjs +2 -2
- package/build/actionButton/ActionButton.mjs.map +1 -1
- package/build/actionOption/ActionOption.js +2 -6
- package/build/actionOption/ActionOption.js.map +1 -1
- package/build/actionOption/ActionOption.mjs +2 -2
- package/build/actionOption/ActionOption.mjs.map +1 -1
- package/build/alert/Alert.js +3 -7
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +3 -3
- package/build/alert/Alert.mjs.map +1 -1
- package/build/avatar/Avatar.js +2 -6
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +2 -2
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/badge/Badge.js +2 -6
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +2 -2
- package/build/badge/Badge.mjs.map +1 -1
- package/build/body/Body.js +2 -6
- package/build/body/Body.js.map +1 -1
- package/build/body/Body.mjs +2 -2
- package/build/body/Body.mjs.map +1 -1
- package/build/button/Button.js +2 -6
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +2 -2
- package/build/button/Button.mjs.map +1 -1
- package/build/card/Card.js +4 -8
- package/build/card/Card.js.map +1 -1
- package/build/card/Card.mjs +4 -4
- package/build/card/Card.mjs.map +1 -1
- package/build/carousel/Carousel.js +5 -9
- package/build/carousel/Carousel.js.map +1 -1
- package/build/carousel/Carousel.mjs +5 -5
- package/build/carousel/Carousel.mjs.map +1 -1
- package/build/checkbox/Checkbox.js +3 -7
- package/build/checkbox/Checkbox.js.map +1 -1
- package/build/checkbox/Checkbox.mjs +3 -3
- package/build/checkbox/Checkbox.mjs.map +1 -1
- package/build/checkboxButton/CheckboxButton.js +2 -6
- package/build/checkboxButton/CheckboxButton.js.map +1 -1
- package/build/checkboxButton/CheckboxButton.mjs +2 -2
- package/build/checkboxButton/CheckboxButton.mjs.map +1 -1
- package/build/chevron/Chevron.js +3 -7
- package/build/chevron/Chevron.js.map +1 -1
- package/build/chevron/Chevron.mjs +3 -3
- package/build/chevron/Chevron.mjs.map +1 -1
- package/build/chips/Chip.js +2 -6
- package/build/chips/Chip.js.map +1 -1
- package/build/chips/Chip.mjs +2 -2
- package/build/chips/Chip.mjs.map +1 -1
- package/build/chips/Chips.js +3 -7
- package/build/chips/Chips.js.map +1 -1
- package/build/chips/Chips.mjs +3 -3
- package/build/chips/Chips.mjs.map +1 -1
- package/build/circularButton/CircularButton.js +3 -7
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +3 -3
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/Option/Option.js +3 -7
- package/build/common/Option/Option.js.map +1 -1
- package/build/common/Option/Option.mjs +3 -3
- package/build/common/Option/Option.mjs.map +1 -1
- package/build/common/RadioButton/RadioButton.js +2 -6
- package/build/common/RadioButton/RadioButton.js.map +1 -1
- package/build/common/RadioButton/RadioButton.mjs +2 -2
- package/build/common/RadioButton/RadioButton.mjs.map +1 -1
- package/build/common/action/Action.js +2 -6
- package/build/common/action/Action.js.map +1 -1
- package/build/common/action/Action.mjs +2 -2
- package/build/common/action/Action.mjs.map +1 -1
- package/build/common/bottomSheet/BottomSheet.js +2 -6
- package/build/common/bottomSheet/BottomSheet.js.map +1 -1
- package/build/common/bottomSheet/BottomSheet.mjs +2 -2
- package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
- package/build/common/card/Card.js +2 -6
- package/build/common/card/Card.js.map +1 -1
- package/build/common/card/Card.mjs +2 -2
- package/build/common/card/Card.mjs.map +1 -1
- package/build/common/closeButton/CloseButton.js +2 -6
- package/build/common/closeButton/CloseButton.js.map +1 -1
- package/build/common/closeButton/CloseButton.mjs +2 -2
- package/build/common/closeButton/CloseButton.mjs.map +1 -1
- package/build/common/flowHeader/FlowHeader.js +3 -6
- package/build/common/flowHeader/FlowHeader.js.map +1 -1
- package/build/common/flowHeader/FlowHeader.mjs +3 -3
- package/build/common/flowHeader/FlowHeader.mjs.map +1 -1
- package/build/common/panel/Panel.js +4 -8
- package/build/common/panel/Panel.js.map +1 -1
- package/build/common/panel/Panel.mjs +4 -4
- package/build/common/panel/Panel.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +4 -8
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +4 -4
- package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
- package/build/dateInput/DateInput.js +2 -6
- package/build/dateInput/DateInput.js.map +1 -1
- package/build/dateInput/DateInput.mjs +2 -2
- package/build/dateInput/DateInput.mjs.map +1 -1
- package/build/dateLookup/DateLookup.js +2 -6
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +2 -2
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/dateLookup/dateHeader/DateHeader.js +2 -6
- package/build/dateLookup/dateHeader/DateHeader.js.map +1 -1
- package/build/dateLookup/dateHeader/DateHeader.mjs +2 -2
- package/build/dateLookup/dateHeader/DateHeader.mjs.map +1 -1
- package/build/dateLookup/tableLink/TableLink.js +15 -21
- package/build/dateLookup/tableLink/TableLink.js.map +1 -1
- package/build/dateLookup/tableLink/TableLink.mjs +16 -18
- package/build/dateLookup/tableLink/TableLink.mjs.map +1 -1
- package/build/decision/Decision.js +3 -7
- package/build/decision/Decision.js.map +1 -1
- package/build/decision/Decision.mjs +3 -3
- package/build/decision/Decision.mjs.map +1 -1
- package/build/definitionList/DefinitionList.js +4 -8
- package/build/definitionList/DefinitionList.js.map +1 -1
- package/build/definitionList/DefinitionList.mjs +4 -4
- package/build/definitionList/DefinitionList.mjs.map +1 -1
- package/build/dimmer/Dimmer.js +6 -10
- package/build/dimmer/Dimmer.js.map +1 -1
- package/build/dimmer/Dimmer.mjs +6 -6
- package/build/dimmer/Dimmer.mjs.map +1 -1
- package/build/display/Display.js +2 -6
- package/build/display/Display.js.map +1 -1
- package/build/display/Display.mjs +2 -2
- package/build/display/Display.mjs.map +1 -1
- package/build/drawer/Drawer.js +5 -9
- package/build/drawer/Drawer.js.map +1 -1
- package/build/drawer/Drawer.mjs +5 -5
- package/build/drawer/Drawer.mjs.map +1 -1
- package/build/field/Field.js +2 -6
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs +2 -2
- package/build/field/Field.mjs.map +1 -1
- package/build/flowNavigation/FlowNavigation.js +4 -8
- package/build/flowNavigation/FlowNavigation.js.map +1 -1
- package/build/flowNavigation/FlowNavigation.mjs +4 -4
- package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.js +3 -7
- package/build/flowNavigation/animatedLabel/AnimatedLabel.js.map +1 -1
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs +3 -3
- package/build/flowNavigation/animatedLabel/AnimatedLabel.mjs.map +1 -1
- package/build/flowNavigation/backButton/BackButton.js +2 -6
- package/build/flowNavigation/backButton/BackButton.js.map +1 -1
- package/build/flowNavigation/backButton/BackButton.mjs +2 -2
- package/build/flowNavigation/backButton/BackButton.mjs.map +1 -1
- package/build/header/Header.js +3 -7
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +3 -3
- package/build/header/Header.mjs.map +1 -1
- package/build/i18n/zh-HK.json +2 -0
- package/build/i18n/zh-HK.json.js +2 -0
- package/build/i18n/zh-HK.json.js.map +1 -1
- package/build/i18n/zh-HK.json.mjs +2 -0
- package/build/i18n/zh-HK.json.mjs.map +1 -1
- package/build/image/Image.js +2 -6
- package/build/image/Image.js.map +1 -1
- package/build/image/Image.mjs +2 -2
- package/build/image/Image.mjs.map +1 -1
- package/build/info/Info.js +2 -6
- package/build/info/Info.js.map +1 -1
- package/build/info/Info.mjs +2 -2
- package/build/info/Info.mjs.map +1 -1
- package/build/inlineAlert/InlineAlert.js +2 -6
- package/build/inlineAlert/InlineAlert.js.map +1 -1
- package/build/inlineAlert/InlineAlert.mjs +2 -2
- package/build/inlineAlert/InlineAlert.mjs.map +1 -1
- package/build/inputs/Input.js +2 -6
- package/build/inputs/Input.js.map +1 -1
- package/build/inputs/Input.mjs +2 -2
- package/build/inputs/Input.mjs.map +1 -1
- package/build/inputs/InputGroup.js +3 -7
- package/build/inputs/InputGroup.js.map +1 -1
- package/build/inputs/InputGroup.mjs +3 -3
- package/build/inputs/InputGroup.mjs.map +1 -1
- package/build/inputs/SelectInput.js +12 -13
- package/build/inputs/SelectInput.js.map +1 -1
- package/build/inputs/SelectInput.mjs +12 -12
- package/build/inputs/SelectInput.mjs.map +1 -1
- package/build/inputs/TextArea.js +2 -6
- package/build/inputs/TextArea.js.map +1 -1
- package/build/inputs/TextArea.mjs +2 -2
- package/build/inputs/TextArea.mjs.map +1 -1
- package/build/inputs/_BottomSheet.js +2 -6
- package/build/inputs/_BottomSheet.js.map +1 -1
- package/build/inputs/_BottomSheet.mjs +2 -2
- package/build/inputs/_BottomSheet.mjs.map +1 -1
- package/build/inputs/_ButtonInput.js +2 -6
- package/build/inputs/_ButtonInput.js.map +1 -1
- package/build/inputs/_ButtonInput.mjs +2 -2
- package/build/inputs/_ButtonInput.mjs.map +1 -1
- package/build/inputs/_Popover.js +3 -7
- package/build/inputs/_Popover.js.map +1 -1
- package/build/inputs/_Popover.mjs +3 -3
- package/build/inputs/_Popover.mjs.map +1 -1
- package/build/inputs/_common.js +2 -6
- package/build/inputs/_common.js.map +1 -1
- package/build/inputs/_common.mjs +2 -2
- package/build/inputs/_common.mjs.map +1 -1
- package/build/instructionsList/InstructionsList.js +2 -6
- package/build/instructionsList/InstructionsList.js.map +1 -1
- package/build/instructionsList/InstructionsList.mjs +2 -2
- package/build/instructionsList/InstructionsList.mjs.map +1 -1
- package/build/label/Label.js +2 -6
- package/build/label/Label.js.map +1 -1
- package/build/label/Label.mjs +2 -2
- package/build/label/Label.mjs.map +1 -1
- package/build/link/Link.js +2 -6
- package/build/link/Link.js.map +1 -1
- package/build/link/Link.mjs +2 -2
- package/build/link/Link.mjs.map +1 -1
- package/build/listItem/ListItem.js +3 -7
- package/build/listItem/ListItem.js.map +1 -1
- package/build/listItem/ListItem.mjs +3 -3
- package/build/listItem/ListItem.mjs.map +1 -1
- package/build/loader/Loader.js +2 -6
- package/build/loader/Loader.js.map +1 -1
- package/build/loader/Loader.mjs +4 -4
- package/build/loader/Loader.mjs.map +1 -1
- package/build/logo/Logo.js +2 -6
- package/build/logo/Logo.js.map +1 -1
- package/build/logo/Logo.mjs +2 -2
- package/build/logo/Logo.mjs.map +1 -1
- package/build/modal/Modal.js +7 -11
- package/build/modal/Modal.js.map +1 -1
- package/build/modal/Modal.mjs +7 -7
- package/build/modal/Modal.mjs.map +1 -1
- package/build/moneyInput/MoneyInput.js +17 -39
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +17 -35
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/navigationOption/NavigationOption.js +2 -6
- package/build/navigationOption/NavigationOption.js.map +1 -1
- package/build/navigationOption/NavigationOption.mjs +2 -2
- package/build/navigationOption/NavigationOption.mjs.map +1 -1
- package/build/nudge/Nudge.js +4 -8
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs +4 -4
- package/build/nudge/Nudge.mjs.map +1 -1
- package/build/overlayHeader/OverlayHeader.js +3 -7
- package/build/overlayHeader/OverlayHeader.js.map +1 -1
- package/build/overlayHeader/OverlayHeader.mjs +3 -3
- package/build/overlayHeader/OverlayHeader.mjs.map +1 -1
- package/build/popover/Popover.js +2 -6
- package/build/popover/Popover.js.map +1 -1
- package/build/popover/Popover.mjs +2 -2
- package/build/popover/Popover.mjs.map +1 -1
- package/build/processIndicator/ProcessIndicator.js +2 -6
- package/build/processIndicator/ProcessIndicator.js.map +1 -1
- package/build/processIndicator/ProcessIndicator.mjs +2 -2
- package/build/processIndicator/ProcessIndicator.mjs.map +1 -1
- package/build/progress/Progress.js +2 -6
- package/build/progress/Progress.js.map +1 -1
- package/build/progress/Progress.mjs +2 -2
- package/build/progress/Progress.mjs.map +1 -1
- package/build/progressBar/ProgressBar.js +2 -6
- package/build/progressBar/ProgressBar.js.map +1 -1
- package/build/progressBar/ProgressBar.mjs +2 -2
- package/build/progressBar/ProgressBar.mjs.map +1 -1
- package/build/promoCard/PromoCard.js +3 -4
- package/build/promoCard/PromoCard.js.map +1 -1
- package/build/promoCard/PromoCard.mjs +3 -3
- package/build/promoCard/PromoCard.mjs.map +1 -1
- package/build/promoCard/PromoCardGroup.js +2 -3
- package/build/promoCard/PromoCardGroup.js.map +1 -1
- package/build/promoCard/PromoCardGroup.mjs +2 -2
- package/build/promoCard/PromoCardGroup.mjs.map +1 -1
- package/build/promoCard/PromoCardIndicator.js +2 -6
- package/build/promoCard/PromoCardIndicator.js.map +1 -1
- package/build/promoCard/PromoCardIndicator.mjs +2 -2
- package/build/promoCard/PromoCardIndicator.mjs.map +1 -1
- package/build/radio/Radio.js +5 -9
- package/build/radio/Radio.js.map +1 -1
- package/build/radio/Radio.mjs +5 -5
- package/build/radio/Radio.mjs.map +1 -1
- package/build/section/Section.js +2 -6
- package/build/section/Section.js.map +1 -1
- package/build/section/Section.mjs +2 -2
- package/build/section/Section.mjs.map +1 -1
- package/build/segmentedControl/SegmentedControl.js +5 -9
- package/build/segmentedControl/SegmentedControl.js.map +1 -1
- package/build/segmentedControl/SegmentedControl.mjs +5 -5
- package/build/segmentedControl/SegmentedControl.mjs.map +1 -1
- package/build/select/Select.js +9 -10
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +9 -9
- package/build/select/Select.mjs.map +1 -1
- package/build/select/option/Option.js +2 -6
- package/build/select/option/Option.js.map +1 -1
- package/build/select/option/Option.mjs +2 -2
- package/build/select/option/Option.mjs.map +1 -1
- package/build/select/searchBox/SearchBox.js +4 -8
- package/build/select/searchBox/SearchBox.js.map +1 -1
- package/build/select/searchBox/SearchBox.mjs +6 -6
- package/build/select/searchBox/SearchBox.mjs.map +1 -1
- package/build/selectOption/SelectOption.js +4 -8
- package/build/selectOption/SelectOption.js.map +1 -1
- package/build/selectOption/SelectOption.mjs +4 -4
- package/build/selectOption/SelectOption.mjs.map +1 -1
- package/build/slidingPanel/SlidingPanel.js +2 -6
- package/build/slidingPanel/SlidingPanel.js.map +1 -1
- package/build/slidingPanel/SlidingPanel.mjs +2 -2
- package/build/slidingPanel/SlidingPanel.mjs.map +1 -1
- package/build/statusIcon/StatusIcon.js +3 -7
- package/build/statusIcon/StatusIcon.js.map +1 -1
- package/build/statusIcon/StatusIcon.mjs +3 -3
- package/build/statusIcon/StatusIcon.mjs.map +1 -1
- package/build/stepper/Stepper.js +8 -9
- package/build/stepper/Stepper.js.map +1 -1
- package/build/stepper/Stepper.mjs +8 -5
- package/build/stepper/Stepper.mjs.map +1 -1
- package/build/summary/Summary.js +2 -6
- package/build/summary/Summary.js.map +1 -1
- package/build/summary/Summary.mjs +2 -2
- package/build/summary/Summary.mjs.map +1 -1
- package/build/switch/Switch.js +2 -6
- package/build/switch/Switch.js.map +1 -1
- package/build/switch/Switch.mjs +2 -2
- package/build/switch/Switch.mjs.map +1 -1
- package/build/tabs/Tab.js +6 -7
- package/build/tabs/Tab.js.map +1 -1
- package/build/tabs/Tab.mjs +6 -6
- package/build/tabs/Tab.mjs.map +1 -1
- package/build/tabs/Tabs.js +2 -3
- package/build/tabs/Tabs.js.map +1 -1
- package/build/tabs/Tabs.mjs +2 -2
- package/build/tabs/Tabs.mjs.map +1 -1
- package/build/tile/Tile.js +3 -7
- package/build/tile/Tile.js.map +1 -1
- package/build/tile/Tile.mjs +3 -3
- package/build/tile/Tile.mjs.map +1 -1
- package/build/title/Title.js +3 -7
- package/build/title/Title.js.map +1 -1
- package/build/title/Title.mjs +3 -3
- package/build/title/Title.mjs.map +1 -1
- package/build/tooltip/Tooltip.js +3 -7
- package/build/tooltip/Tooltip.js.map +1 -1
- package/build/tooltip/Tooltip.mjs +3 -3
- package/build/tooltip/Tooltip.mjs.map +1 -1
- package/build/typeahead/Typeahead.js +6 -7
- package/build/typeahead/Typeahead.js.map +1 -1
- package/build/typeahead/Typeahead.mjs +6 -6
- package/build/typeahead/Typeahead.mjs.map +1 -1
- package/build/typeahead/typeaheadInput/TypeaheadInput.js +2 -6
- package/build/typeahead/typeaheadInput/TypeaheadInput.js.map +1 -1
- package/build/typeahead/typeaheadInput/TypeaheadInput.mjs +2 -2
- package/build/typeahead/typeaheadInput/TypeaheadInput.mjs.map +1 -1
- package/build/typeahead/typeaheadOption/TypeaheadOption.js +2 -6
- package/build/typeahead/typeaheadOption/TypeaheadOption.js.map +1 -1
- package/build/typeahead/typeaheadOption/TypeaheadOption.mjs +2 -2
- package/build/typeahead/typeaheadOption/TypeaheadOption.mjs.map +1 -1
- package/build/types/accordion/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/build/types/chevron/Chevron.d.ts.map +1 -1
- package/build/types/circularButton/CircularButton.d.ts.map +1 -1
- package/build/types/dateLookup/tableLink/TableLink.d.ts.map +1 -1
- package/build/types/flowNavigation/FlowNavigation.d.ts.map +1 -1
- package/build/types/link/Link.d.ts.map +1 -1
- package/build/types/modal/Modal.d.ts.map +1 -1
- package/build/types/moneyInput/MoneyInput.d.ts +0 -1
- package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
- package/build/types/select/searchBox/SearchBox.d.ts.map +1 -1
- package/build/types/stepper/Stepper.d.ts +4 -0
- package/build/types/stepper/Stepper.d.ts.map +1 -1
- package/build/types/tabs/Tab.d.ts.map +1 -1
- package/build/types/uploadInput/uploadButton/UploadButton.d.ts.map +1 -1
- package/build/upload/Upload.js +2 -6
- package/build/upload/Upload.js.map +1 -1
- package/build/upload/Upload.mjs +2 -2
- package/build/upload/Upload.mjs.map +1 -1
- package/build/uploadInput/UploadInput.js +2 -6
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +2 -2
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.js +5 -9
- package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.mjs +5 -5
- package/build/uploadInput/uploadButton/UploadButton.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.js +3 -7
- package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.mjs +3 -3
- package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItemLink.js +2 -6
- package/build/uploadInput/uploadItem/UploadItemLink.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItemLink.mjs +2 -2
- package/build/uploadInput/uploadItem/UploadItemLink.mjs.map +1 -1
- package/package.json +3 -3
- package/src/accordion/AccordionItem/AccordionItem.tsx +5 -9
- package/src/actionButton/ActionButton.tsx +2 -2
- package/src/actionOption/ActionOption.tsx +2 -2
- package/src/alert/Alert.tsx +3 -3
- package/src/avatar/Avatar.tsx +2 -2
- package/src/badge/Badge.tsx +2 -2
- package/src/body/Body.tsx +2 -2
- package/src/button/Button.tsx +2 -2
- package/src/card/Card.tsx +4 -4
- package/src/carousel/Carousel.tsx +5 -5
- package/src/checkbox/Checkbox.tsx +3 -3
- package/src/checkboxButton/CheckboxButton.tsx +2 -2
- package/src/chevron/Chevron.tsx +3 -12
- package/src/chips/Chip.tsx +2 -2
- package/src/chips/Chips.tsx +3 -3
- package/src/circularButton/CircularButton.tsx +4 -7
- package/src/common/Option/Option.tsx +3 -3
- package/src/common/RadioButton/RadioButton.tsx +2 -2
- package/src/common/action/Action.tsx +2 -2
- package/src/common/bottomSheet/BottomSheet.tsx +2 -2
- package/src/common/card/Card.tsx +2 -2
- package/src/common/closeButton/CloseButton.tsx +2 -2
- package/src/common/flowHeader/FlowHeader.tsx +3 -3
- package/src/common/panel/Panel.tsx +4 -4
- package/src/criticalBanner/CriticalCommsBanner.tsx +4 -4
- package/src/dateInput/DateInput.tsx +2 -2
- package/src/dateLookup/DateLookup.tsx +2 -2
- package/src/dateLookup/dateHeader/DateHeader.tsx +2 -2
- package/src/dateLookup/tableLink/TableLink.tsx +3 -5
- package/src/decision/Decision.tsx +3 -3
- package/src/definitionList/DefinitionList.tsx +4 -4
- package/src/dimmer/Dimmer.tsx +6 -6
- package/src/display/Display.tsx +2 -2
- package/src/drawer/Drawer.tsx +5 -5
- package/src/field/Field.tsx +3 -3
- package/src/flowNavigation/FlowNavigation.tsx +6 -7
- package/src/flowNavigation/__snapshots__/FlowNavigation.spec.js.snap +4 -4
- package/src/flowNavigation/animatedLabel/AnimatedLabel.tsx +3 -3
- package/src/flowNavigation/backButton/BackButton.tsx +2 -2
- package/src/header/Header.tsx +3 -3
- package/src/i18n/zh-HK.json +2 -0
- package/src/image/Image.tsx +2 -2
- package/src/info/Info.tsx +2 -2
- package/src/inlineAlert/InlineAlert.tsx +2 -2
- package/src/inputs/Input.tsx +2 -2
- package/src/inputs/InputGroup.tsx +3 -3
- package/src/inputs/SelectInput.story.tsx +2 -2
- package/src/inputs/SelectInput.tsx +12 -12
- package/src/inputs/TextArea.tsx +2 -2
- package/src/inputs/_BottomSheet.tsx +2 -2
- package/src/inputs/_ButtonInput.tsx +2 -2
- package/src/inputs/_Popover.tsx +3 -3
- package/src/inputs/_common.ts +2 -2
- package/src/instructionsList/InstructionsList.tsx +3 -3
- package/src/label/Label.tsx +2 -2
- package/src/link/Link.tsx +2 -7
- package/src/listItem/ListItem.tsx +3 -3
- package/src/loader/Loader.tsx +2 -2
- package/src/logo/Logo.tsx +2 -2
- package/src/modal/Modal.tsx +9 -15
- package/src/moneyInput/MoneyInput.story.tsx +0 -34
- package/src/moneyInput/MoneyInput.tsx +6 -29
- package/src/navigationOption/NavigationOption.tsx +2 -2
- package/src/nudge/Nudge.tsx +4 -4
- package/src/overlayHeader/OverlayHeader.tsx +3 -3
- package/src/popover/Popover.tsx +2 -2
- package/src/processIndicator/ProcessIndicator.tsx +2 -2
- package/src/progress/Progress.tsx +2 -2
- package/src/progressBar/ProgressBar.tsx +2 -2
- package/src/promoCard/PromoCard.tsx +4 -4
- package/src/promoCard/PromoCardGroup.tsx +2 -2
- package/src/promoCard/PromoCardIndicator.tsx +2 -2
- package/src/radio/Radio.tsx +5 -5
- package/src/section/Section.tsx +2 -2
- package/src/segmentedControl/SegmentedControl.tsx +5 -5
- package/src/select/Select.js +9 -9
- package/src/select/option/Option.tsx +2 -2
- package/src/select/searchBox/SearchBox.tsx +4 -7
- package/src/selectOption/SelectOption.tsx +5 -5
- package/src/slidingPanel/SlidingPanel.tsx +2 -2
- package/src/statusIcon/StatusIcon.tsx +3 -3
- package/src/stepper/Stepper.less +2 -2
- package/src/stepper/Stepper.story.tsx +49 -0
- package/src/stepper/Stepper.tsx +10 -6
- package/src/summary/Summary.tsx +2 -2
- package/src/switch/Switch.tsx +2 -2
- package/src/tabs/Tab.js +8 -12
- package/src/tabs/Tabs.js +2 -2
- package/src/tile/Tile.tsx +3 -3
- package/src/title/Title.tsx +3 -3
- package/src/tooltip/Tooltip.tsx +3 -3
- package/src/typeahead/Typeahead.tsx +6 -6
- package/src/typeahead/typeaheadInput/TypeaheadInput.tsx +2 -2
- package/src/typeahead/typeaheadOption/TypeaheadOption.tsx +2 -2
- package/src/upload/Upload.tsx +2 -2
- package/src/uploadInput/UploadInput.tsx +2 -2
- package/src/uploadInput/uploadButton/UploadButton.tsx +5 -9
- package/src/uploadInput/uploadItem/UploadItem.tsx +3 -3
- package/src/uploadInput/uploadItem/UploadItemLink.tsx +2 -2
- package/src/stepper/Stepper.story.js +0 -40
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chips.mjs","sources":["../../src/chips/Chips.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Chips.mjs","sources":["../../src/chips/Chips.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { useIntl } from 'react-intl';\n\nimport { CommonProps, AriaLabelProperty } from '../common';\n\nimport Chip from './Chip';\nimport messages from './Chips.messages';\n\nexport type ChipValue = string | number;\n\nexport type Chip = {\n value: ChipValue;\n label: string;\n};\n\nexport type ChipsProps = CommonProps &\n AriaLabelProperty & {\n /** List of chips with string labels and string/number values */\n chips: readonly Chip[];\n /** Callback which is invoked when a chip is selected or deselected */\n onChange: ({\n isEnabled,\n selectedValue,\n }: {\n isEnabled: boolean;\n selectedValue: ChipValue;\n }) => void;\n /** Used to manage which chips are selected */\n selected: ChipValue | readonly ChipValue[];\n /** Used to activate multi-selection */\n multiple?: boolean;\n };\n\nconst Chips = ({\n chips,\n onChange,\n selected,\n 'aria-label': ariaLabel,\n className,\n multiple,\n}: ChipsProps) => {\n const intl = useIntl();\n\n const isSelected = (value: ChipValue) =>\n Array.isArray(selected) ? selected.includes(value) : selected === value;\n\n const handleOnChange = (selectedValue: ChipValue, isCurrentlyEnabled: boolean) => {\n onChange({ isEnabled: !isCurrentlyEnabled, selectedValue });\n };\n\n return (\n <div\n className={clsx('np-chips d-flex', className)}\n aria-label={ariaLabel}\n role={!multiple ? 'radiogroup' : undefined}\n >\n {chips.map((chip) => {\n const chipSelected = isSelected(chip.value);\n return (\n <Chip\n key={chip.value}\n value={chip.value}\n label={chip.label}\n closeButton={{\n 'aria-label': intl.formatMessage(messages.ariaLabel, { choice: chip.label }),\n }}\n className={clsx('text-xs-nowrap', {\n 'np-chip--selected': chipSelected,\n 'p-r-1': multiple && chipSelected,\n })}\n {...(multiple && chipSelected\n ? {\n onRemove: () => handleOnChange(chip.value, chipSelected),\n 'aria-label': chip.label,\n }\n : {\n onClick: () => handleOnChange(chip.value, chipSelected),\n onKeyPress: () => handleOnChange(chip.value, chipSelected),\n role: !multiple ? 'radio' : undefined,\n 'aria-checked': chipSelected,\n })}\n />\n );\n })}\n </div>\n );\n};\n\nexport default Chips;\n"],"names":["Chips","chips","onChange","selected","ariaLabel","className","multiple","intl","useIntl","isSelected","value","Array","isArray","includes","handleOnChange","selectedValue","isCurrentlyEnabled","isEnabled","_jsx","clsx","role","undefined","children","map","chip","chipSelected","Chip","label","closeButton","formatMessage","messages","choice","onRemove","onClick","onKeyPress"],"mappings":";;;;;;AAiCMA,MAAAA,KAAK,GAAGA,CAAC;EACbC,KAAK;EACLC,QAAQ;EACRC,QAAQ;AACR,EAAA,YAAY,EAAEC,SAAS;EACvBC,SAAS;AACTC,EAAAA,QAAAA;AAAQ,CACG,KAAI;AACf,EAAA,MAAMC,IAAI,GAAGC,OAAO,EAAE,CAAA;EAEtB,MAAMC,UAAU,GAAIC,KAAgB,IAClCC,KAAK,CAACC,OAAO,CAACT,QAAQ,CAAC,GAAGA,QAAQ,CAACU,QAAQ,CAACH,KAAK,CAAC,GAAGP,QAAQ,KAAKO,KAAK,CAAA;AAEzE,EAAA,MAAMI,cAAc,GAAGA,CAACC,aAAwB,EAAEC,kBAA2B,KAAI;AAC/Ed,IAAAA,QAAQ,CAAC;MAAEe,SAAS,EAAE,CAACD,kBAAkB;AAAED,MAAAA,aAAAA;AAAe,KAAA,CAAC,CAAA;GAC5D,CAAA;AAED,EAAA,oBACEG,GAAA,CAAA,KAAA,EAAA;AACEb,IAAAA,SAAS,EAAEc,IAAI,CAAC,iBAAiB,EAAEd,SAAS,CAAE;AAC9C,IAAA,YAAA,EAAYD,SAAU;AACtBgB,IAAAA,IAAI,EAAE,CAACd,QAAQ,GAAG,YAAY,GAAGe,SAAU;AAAAC,IAAAA,QAAA,EAE1CrB,KAAK,CAACsB,GAAG,CAAEC,IAAI,IAAI;AAClB,MAAA,MAAMC,YAAY,GAAGhB,UAAU,CAACe,IAAI,CAACd,KAAK,CAAC,CAAA;MAC3C,oBACEQ,GAAA,CAACQ,IAAI,EAAA;QAEHhB,KAAK,EAAEc,IAAI,CAACd,KAAM;QAClBiB,KAAK,EAAEH,IAAI,CAACG,KAAM;AAClBC,QAAAA,WAAW,EAAE;UACX,YAAY,EAAErB,IAAI,CAACsB,aAAa,CAACC,QAAQ,CAAC1B,SAAS,EAAE;YAAE2B,MAAM,EAAEP,IAAI,CAACG,KAAAA;WAAO,CAAA;SAC3E;AACFtB,QAAAA,SAAS,EAAEc,IAAI,CAAC,gBAAgB,EAAE;AAChC,UAAA,mBAAmB,EAAEM,YAAY;UACjC,OAAO,EAAEnB,QAAQ,IAAImB,YAAAA;AACtB,SAAA,CAAE;QAAA,IACEnB,QAAQ,IAAImB,YAAY,GACzB;UACEO,QAAQ,EAAEA,MAAMlB,cAAc,CAACU,IAAI,CAACd,KAAK,EAAEe,YAAY,CAAC;UACxD,YAAY,EAAED,IAAI,CAACG,KAAAA;AACpB,SAAA,GACD;UACEM,OAAO,EAAEA,MAAMnB,cAAc,CAACU,IAAI,CAACd,KAAK,EAAEe,YAAY,CAAC;UACvDS,UAAU,EAAEA,MAAMpB,cAAc,CAACU,IAAI,CAACd,KAAK,EAAEe,YAAY,CAAC;AAC1DL,UAAAA,IAAI,EAAE,CAACd,QAAQ,GAAG,OAAO,GAAGe,SAAS;AACrC,UAAA,cAAc,EAAEI,YAAAA;SACjB,CAAA;OApBAD,EAAAA,IAAI,CAACd,KAqBV,CAAA,CAAA;KAEL,CAAA;AAAC,GACC,CAAC,CAAA;AAEV;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var clsx = require('clsx');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var Body = require('../body/Body.js');
|
|
6
6
|
var classMap = require('../button/classMap.js');
|
|
@@ -8,10 +8,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
8
8
|
var typography = require('../common/propsValues/typography.js');
|
|
9
9
|
var control = require('../common/propsValues/control.js');
|
|
10
10
|
|
|
11
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
|
|
13
|
-
var classNames__default = /*#__PURE__*/_interopDefault(classNames);
|
|
14
|
-
|
|
15
11
|
const CircularButton = ({
|
|
16
12
|
className,
|
|
17
13
|
children,
|
|
@@ -21,12 +17,12 @@ const CircularButton = ({
|
|
|
21
17
|
type = control.ControlType.ACCENT,
|
|
22
18
|
...rest
|
|
23
19
|
}) => {
|
|
24
|
-
const classes =
|
|
20
|
+
const classes = clsx.clsx('btn np-btn', classMap.typeClassMap[type], classMap.priorityClassMap[priority]);
|
|
25
21
|
const iconElement = Number(icon.props.size) !== 24 ? /*#__PURE__*/React.cloneElement(icon, {
|
|
26
22
|
size: 24
|
|
27
23
|
}) : icon;
|
|
28
24
|
return /*#__PURE__*/jsxRuntime.jsxs("label", {
|
|
29
|
-
className:
|
|
25
|
+
className: clsx.clsx('np-circular-btn', priority, type, disabled && 'disabled', className),
|
|
30
26
|
children: [/*#__PURE__*/jsxRuntime.jsx("input", {
|
|
31
27
|
type: "button",
|
|
32
28
|
"aria-label": children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CircularButton.js","sources":["../../src/circularButton/CircularButton.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"CircularButton.js","sources":["../../src/circularButton/CircularButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { cloneElement } from 'react';\n\nimport Body from '../body/Body';\nimport { typeClassMap, priorityClassMap } from '../button/classMap';\nimport { ControlType, Priority , Typography } from '../common';\n\nexport interface CircularButtonProps {\n className?: string;\n children: string;\n disabled?: boolean;\n icon: React.ReactElement<{ size?: unknown }>;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n priority?: `${Priority.PRIMARY | Priority.SECONDARY}`;\n type?: `${ControlType.ACCENT | ControlType.POSITIVE | ControlType.NEGATIVE}`;\n}\n\nconst CircularButton = ({\n className,\n children,\n disabled,\n icon,\n priority = Priority.PRIMARY,\n type = ControlType.ACCENT,\n ...rest\n}: CircularButtonProps) => {\n const classes = clsx('btn np-btn', typeClassMap[type], priorityClassMap[priority]);\n\n const iconElement = Number(icon.props.size) !== 24 ? cloneElement(icon, { size: 24 }) : icon;\n\n return (\n <label className={clsx('np-circular-btn', priority, type, disabled && 'disabled', className)}>\n <input\n type=\"button\"\n aria-label={children}\n className={classes}\n disabled={disabled}\n {...rest}\n />\n {iconElement}\n <Body as=\"span\" className=\"np-circular-btn__label\" type={Typography.BODY_DEFAULT_BOLD}>\n {children}\n </Body>\n </label>\n );\n};\n\nexport default CircularButton;\n"],"names":["CircularButton","className","children","disabled","icon","priority","Priority","PRIMARY","type","ControlType","ACCENT","rest","classes","clsx","typeClassMap","priorityClassMap","iconElement","Number","props","size","cloneElement","_jsxs","_jsx","Body","as","Typography","BODY_DEFAULT_BOLD"],"mappings":";;;;;;;;;;AAiBMA,MAAAA,cAAc,GAAGA,CAAC;EACtBC,SAAS;EACTC,QAAQ;EACRC,QAAQ;EACRC,IAAI;EACJC,QAAQ,GAAGC,gBAAQ,CAACC,OAAO;EAC3BC,IAAI,GAAGC,mBAAW,CAACC,MAAM;EACzB,GAAGC,IAAAA;AACiB,CAAA,KAAI;AACxB,EAAA,MAAMC,OAAO,GAAGC,SAAI,CAAC,YAAY,EAAEC,qBAAY,CAACN,IAAI,CAAC,EAAEO,yBAAgB,CAACV,QAAQ,CAAC,CAAC,CAAA;AAElF,EAAA,MAAMW,WAAW,GAAGC,MAAM,CAACb,IAAI,CAACc,KAAK,CAACC,IAAI,CAAC,KAAK,EAAE,gBAAGC,kBAAY,CAAChB,IAAI,EAAE;AAAEe,IAAAA,IAAI,EAAE,EAAA;GAAI,CAAC,GAAGf,IAAI,CAAA;AAE5F,EAAA,oBACEiB,eAAA,CAAA,OAAA,EAAA;AAAOpB,IAAAA,SAAS,EAAEY,SAAI,CAAC,iBAAiB,EAAER,QAAQ,EAAEG,IAAI,EAAEL,QAAQ,IAAI,UAAU,EAAEF,SAAS,CAAE;AAAAC,IAAAA,QAAA,gBAC3FoB,cAAA,CAAA,OAAA,EAAA;AACEd,MAAAA,IAAI,EAAC,QAAQ;AACb,MAAA,YAAA,EAAYN,QAAS;AACrBD,MAAAA,SAAS,EAAEW,OAAQ;AACnBT,MAAAA,QAAQ,EAAEA,QAAS;MAAA,GACfQ,IAAAA;AAAI,KAEV,CAAA,EAACK,WAAW,eACZM,cAAA,CAACC,IAAI,EAAA;AAACC,MAAAA,EAAE,EAAC,MAAM;AAACvB,MAAAA,SAAS,EAAC,wBAAwB;MAACO,IAAI,EAAEiB,qBAAU,CAACC,iBAAkB;AAAAxB,MAAAA,QAAA,EACnFA,QAAAA;AAAQ,KACL,CACR,CAAA;AAAA,GAAO,CAAC,CAAA;AAEZ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
2
|
import { cloneElement } from 'react';
|
|
3
3
|
import Body from '../body/Body.mjs';
|
|
4
4
|
import { typeClassMap, priorityClassMap } from '../button/classMap.mjs';
|
|
@@ -15,12 +15,12 @@ const CircularButton = ({
|
|
|
15
15
|
type = ControlType.ACCENT,
|
|
16
16
|
...rest
|
|
17
17
|
}) => {
|
|
18
|
-
const classes =
|
|
18
|
+
const classes = clsx('btn np-btn', typeClassMap[type], priorityClassMap[priority]);
|
|
19
19
|
const iconElement = Number(icon.props.size) !== 24 ? /*#__PURE__*/cloneElement(icon, {
|
|
20
20
|
size: 24
|
|
21
21
|
}) : icon;
|
|
22
22
|
return /*#__PURE__*/jsxs("label", {
|
|
23
|
-
className:
|
|
23
|
+
className: clsx('np-circular-btn', priority, type, disabled && 'disabled', className),
|
|
24
24
|
children: [/*#__PURE__*/jsx("input", {
|
|
25
25
|
type: "button",
|
|
26
26
|
"aria-label": children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CircularButton.mjs","sources":["../../src/circularButton/CircularButton.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"CircularButton.mjs","sources":["../../src/circularButton/CircularButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { cloneElement } from 'react';\n\nimport Body from '../body/Body';\nimport { typeClassMap, priorityClassMap } from '../button/classMap';\nimport { ControlType, Priority , Typography } from '../common';\n\nexport interface CircularButtonProps {\n className?: string;\n children: string;\n disabled?: boolean;\n icon: React.ReactElement<{ size?: unknown }>;\n onClick?: React.MouseEventHandler<HTMLInputElement>;\n priority?: `${Priority.PRIMARY | Priority.SECONDARY}`;\n type?: `${ControlType.ACCENT | ControlType.POSITIVE | ControlType.NEGATIVE}`;\n}\n\nconst CircularButton = ({\n className,\n children,\n disabled,\n icon,\n priority = Priority.PRIMARY,\n type = ControlType.ACCENT,\n ...rest\n}: CircularButtonProps) => {\n const classes = clsx('btn np-btn', typeClassMap[type], priorityClassMap[priority]);\n\n const iconElement = Number(icon.props.size) !== 24 ? cloneElement(icon, { size: 24 }) : icon;\n\n return (\n <label className={clsx('np-circular-btn', priority, type, disabled && 'disabled', className)}>\n <input\n type=\"button\"\n aria-label={children}\n className={classes}\n disabled={disabled}\n {...rest}\n />\n {iconElement}\n <Body as=\"span\" className=\"np-circular-btn__label\" type={Typography.BODY_DEFAULT_BOLD}>\n {children}\n </Body>\n </label>\n );\n};\n\nexport default CircularButton;\n"],"names":["CircularButton","className","children","disabled","icon","priority","Priority","PRIMARY","type","ControlType","ACCENT","rest","classes","clsx","typeClassMap","priorityClassMap","iconElement","Number","props","size","cloneElement","_jsxs","_jsx","Body","as","Typography","BODY_DEFAULT_BOLD"],"mappings":";;;;;;;;AAiBMA,MAAAA,cAAc,GAAGA,CAAC;EACtBC,SAAS;EACTC,QAAQ;EACRC,QAAQ;EACRC,IAAI;EACJC,QAAQ,GAAGC,QAAQ,CAACC,OAAO;EAC3BC,IAAI,GAAGC,WAAW,CAACC,MAAM;EACzB,GAAGC,IAAAA;AACiB,CAAA,KAAI;AACxB,EAAA,MAAMC,OAAO,GAAGC,IAAI,CAAC,YAAY,EAAEC,YAAY,CAACN,IAAI,CAAC,EAAEO,gBAAgB,CAACV,QAAQ,CAAC,CAAC,CAAA;AAElF,EAAA,MAAMW,WAAW,GAAGC,MAAM,CAACb,IAAI,CAACc,KAAK,CAACC,IAAI,CAAC,KAAK,EAAE,gBAAGC,YAAY,CAAChB,IAAI,EAAE;AAAEe,IAAAA,IAAI,EAAE,EAAA;GAAI,CAAC,GAAGf,IAAI,CAAA;AAE5F,EAAA,oBACEiB,IAAA,CAAA,OAAA,EAAA;AAAOpB,IAAAA,SAAS,EAAEY,IAAI,CAAC,iBAAiB,EAAER,QAAQ,EAAEG,IAAI,EAAEL,QAAQ,IAAI,UAAU,EAAEF,SAAS,CAAE;AAAAC,IAAAA,QAAA,gBAC3FoB,GAAA,CAAA,OAAA,EAAA;AACEd,MAAAA,IAAI,EAAC,QAAQ;AACb,MAAA,YAAA,EAAYN,QAAS;AACrBD,MAAAA,SAAS,EAAEW,OAAQ;AACnBT,MAAAA,QAAQ,EAAEA,QAAS;MAAA,GACfQ,IAAAA;AAAI,KAEV,CAAA,EAACK,WAAW,eACZM,GAAA,CAACC,IAAI,EAAA;AAACC,MAAAA,EAAE,EAAC,MAAM;AAACvB,MAAAA,SAAS,EAAC,wBAAwB;MAACO,IAAI,EAAEiB,UAAU,CAACC,iBAAkB;AAAAxB,MAAAA,QAAA,EACnFA,QAAAA;AAAQ,KACL,CACR,CAAA;AAAA,GAAO,CAAC,CAAA;AAEZ;;;;"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var clsx = require('clsx');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var Body = require('../../body/Body.js');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
|
|
8
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
|
|
10
|
-
var classNames__default = /*#__PURE__*/_interopDefault(classNames);
|
|
11
|
-
|
|
12
8
|
const Option = /*#__PURE__*/React.forwardRef(({
|
|
13
9
|
media = '',
|
|
14
10
|
title,
|
|
@@ -29,7 +25,7 @@ const Option = /*#__PURE__*/React.forwardRef(({
|
|
|
29
25
|
return /*#__PURE__*/jsxRuntime.jsx(Element, {
|
|
30
26
|
...rest,
|
|
31
27
|
ref: reference,
|
|
32
|
-
className:
|
|
28
|
+
className: clsx.clsx('np-option', className, {
|
|
33
29
|
'decision-complex': complex,
|
|
34
30
|
decision,
|
|
35
31
|
disabled,
|
|
@@ -42,7 +38,7 @@ const Option = /*#__PURE__*/React.forwardRef(({
|
|
|
42
38
|
children: [media && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
43
39
|
className: "media-left",
|
|
44
40
|
children: showMediaCircle ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
45
|
-
className:
|
|
41
|
+
className: clsx.clsx('circle circle-sm text-primary', {
|
|
46
42
|
'circle-inverse': inverseMediaCircle
|
|
47
43
|
}),
|
|
48
44
|
children: media
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Option.js","sources":["../../../src/common/Option/Option.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Option.js","sources":["../../../src/common/Option/Option.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { MouseEvent, forwardRef, HTMLAttributes, ReactNode, ElementType } from 'react';\n\nimport Body from '../../body';\nimport { LinkProps } from '../commonProps';\n\nexport interface BaseOptionProps extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'content'> {\n 'aria-label'?: string;\n media?: ReactNode;\n name?: string;\n htmlFor?: string;\n title: ReactNode;\n content?: ReactNode;\n onClick?: (event: MouseEvent<HTMLElement>) => void;\n as?: ElementType;\n disabled?: boolean;\n button?: ReactNode;\n decision?: boolean;\n complex?: boolean;\n inverseMediaCircle?: boolean;\n className?: string;\n showMediaAtAllSizes?: boolean;\n showMediaCircle?: boolean;\n isContainerAligned?: boolean;\n}\n\ninterface AnchorOptionProps extends BaseOptionProps, LinkProps {\n as: 'a';\n}\n\nexport type OptionProps = BaseOptionProps | AnchorOptionProps;\n\nexport type ReferenceType = HTMLElement | HTMLAnchorElement;\n\nconst Option = forwardRef<ReferenceType, OptionProps>(\n (\n {\n media = '',\n title,\n content,\n as: component,\n button,\n decision = true,\n disabled = false,\n complex,\n inverseMediaCircle = true,\n className,\n showMediaAtAllSizes,\n showMediaCircle = true,\n isContainerAligned = false,\n ...rest\n },\n reference,\n ) => {\n const Element = component ?? 'label';\n\n return (\n <Element\n {...rest}\n ref={reference}\n className={clsx('np-option', className, {\n 'decision-complex': complex,\n decision,\n disabled,\n 'np-option__sm-media': showMediaAtAllSizes,\n 'np-option__container-aligned': isContainerAligned,\n })}\n disabled={disabled && Element === 'button'}\n >\n <div className=\"media\">\n {media && (\n <div className=\"media-left\">\n {showMediaCircle ? (\n <div\n className={clsx('circle circle-sm text-primary', {\n 'circle-inverse': inverseMediaCircle,\n })}\n >\n {media}\n </div>\n ) : (\n <div className=\"np-option__no-media-circle\">{media}</div>\n )}\n </div>\n )}\n <div className=\"media-body\">\n <h4 className=\"np-text-body-large-bold text-primary np-option__title\">{title}</h4>\n {content && <Body className=\"d-block np-option__body\">{content}</Body>}\n </div>\n <div className=\"media-right\">{button}</div>\n </div>\n </Element>\n );\n },\n);\n\nexport default Option;\n"],"names":["Option","forwardRef","media","title","content","as","component","button","decision","disabled","complex","inverseMediaCircle","className","showMediaAtAllSizes","showMediaCircle","isContainerAligned","rest","reference","Element","_jsx","ref","clsx","children","_jsxs","Body"],"mappings":";;;;;;;AAkCA,MAAMA,MAAM,gBAAGC,gBAAU,CACvB,CACE;AACEC,EAAAA,KAAK,GAAG,EAAE;EACVC,KAAK;EACLC,OAAO;AACPC,EAAAA,EAAE,EAAEC,SAAS;EACbC,MAAM;AACNC,EAAAA,QAAQ,GAAG,IAAI;AACfC,EAAAA,Q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QAAA,gBACzBH,cAAA,CAAA,IAAA,EAAA;AAAIP,UAAAA,SAAS,EAAC,uDAAuD;AAAAU,UAAAA,QAAA,EAAEnB,KAAAA;AAAK,SAAK,CACjF,EAACC,OAAO,iBAAIe,cAAA,CAACK,IAAI,EAAA;AAACZ,UAAAA,SAAS,EAAC,yBAAyB;AAAAU,UAAAA,QAAA,EAAElB,OAAAA;AAAO,SAAO,CAAC,CAAA;OACnE,CACL,eAAAe,cAAA,CAAA,KAAA,EAAA;AAAKP,QAAAA,SAAS,EAAC,aAAa;AAAAU,QAAAA,QAAA,EAAEf,MAAAA;AAAM,OAAM,CAC5C,CAAA;KAAK,CAAA;AACP,GAAS,CAAC,CAAA;AAEd,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import Body from '../../body/Body.mjs';
|
|
4
4
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
@@ -23,7 +23,7 @@ const Option = /*#__PURE__*/forwardRef(({
|
|
|
23
23
|
return /*#__PURE__*/jsx(Element, {
|
|
24
24
|
...rest,
|
|
25
25
|
ref: reference,
|
|
26
|
-
className:
|
|
26
|
+
className: clsx('np-option', className, {
|
|
27
27
|
'decision-complex': complex,
|
|
28
28
|
decision,
|
|
29
29
|
disabled,
|
|
@@ -36,7 +36,7 @@ const Option = /*#__PURE__*/forwardRef(({
|
|
|
36
36
|
children: [media && /*#__PURE__*/jsx("div", {
|
|
37
37
|
className: "media-left",
|
|
38
38
|
children: showMediaCircle ? /*#__PURE__*/jsx("div", {
|
|
39
|
-
className:
|
|
39
|
+
className: clsx('circle circle-sm text-primary', {
|
|
40
40
|
'circle-inverse': inverseMediaCircle
|
|
41
41
|
}),
|
|
42
42
|
children: media
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Option.mjs","sources":["../../../src/common/Option/Option.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Option.mjs","sources":["../../../src/common/Option/Option.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { MouseEvent, forwardRef, HTMLAttributes, ReactNode, ElementType } from 'react';\n\nimport Body from '../../body';\nimport { LinkProps } from '../commonProps';\n\nexport interface BaseOptionProps extends Omit<HTMLAttributes<HTMLElement>, 'title' | 'content'> {\n 'aria-label'?: string;\n media?: ReactNode;\n name?: string;\n htmlFor?: string;\n title: ReactNode;\n content?: ReactNode;\n onClick?: (event: MouseEvent<HTMLElement>) => void;\n as?: ElementType;\n disabled?: boolean;\n button?: ReactNode;\n decision?: boolean;\n complex?: boolean;\n inverseMediaCircle?: boolean;\n className?: string;\n showMediaAtAllSizes?: boolean;\n showMediaCircle?: boolean;\n isContainerAligned?: boolean;\n}\n\ninterface AnchorOptionProps extends BaseOptionProps, LinkProps {\n as: 'a';\n}\n\nexport type OptionProps = BaseOptionProps | AnchorOptionProps;\n\nexport type ReferenceType = HTMLElement | HTMLAnchorElement;\n\nconst Option = forwardRef<ReferenceType, OptionProps>(\n (\n {\n media = '',\n title,\n content,\n as: component,\n button,\n decision = true,\n disabled = false,\n complex,\n inverseMediaCircle = true,\n className,\n showMediaAtAllSizes,\n showMediaCircle = true,\n isContainerAligned = false,\n ...rest\n },\n reference,\n ) => {\n const Element = component ?? 'label';\n\n return (\n <Element\n {...rest}\n ref={reference}\n className={clsx('np-option', className, {\n 'decision-complex': complex,\n decision,\n disabled,\n 'np-option__sm-media': showMediaAtAllSizes,\n 'np-option__container-aligned': isContainerAligned,\n })}\n disabled={disabled && Element === 'button'}\n >\n <div className=\"media\">\n {media && (\n <div className=\"media-left\">\n {showMediaCircle ? (\n <div\n className={clsx('circle circle-sm text-primary', {\n 'circle-inverse': inverseMediaCircle,\n })}\n >\n {media}\n </div>\n ) : (\n <div className=\"np-option__no-media-circle\">{media}</div>\n )}\n </div>\n )}\n <div className=\"media-body\">\n <h4 className=\"np-text-body-large-bold text-primary np-option__title\">{title}</h4>\n {content && <Body className=\"d-block np-option__body\">{content}</Body>}\n </div>\n <div className=\"media-right\">{button}</div>\n </div>\n </Element>\n );\n },\n);\n\nexport default Option;\n"],"names":["Option","forwardRef","media","title","content","as","component","button","decision","disabled","complex","inverseMediaCircle","className","showMediaAtAllSizes","showMediaCircle","isContainerAligned","rest","reference","Element","_jsx","ref","clsx","children","_jsxs","Body"],"mappings":";;;;;AAkCA,MAAMA,MAAM,gBAAGC,UAAU,CACvB,CACE;AACEC,EAAAA,KAAK,GAAG,EAAE;EACVC,KAAK;EACLC,OAAO;AACPC,EAAAA,EAAE,EAAEC,SAAS;EACbC,MAAM;AACNC,EAAAA,QAAQ,GAAG,IAAI;AACfC,EAAAA,QAAQ,GAAG,KAAK;EAChBC,OAAO;AACPC,EAAAA,kBAAkB,GAAG,IAAI;EACzBC,SAAS;EACTC,mBAAmB;AACnBC,EAAAA,eAAe,GAAG,IAAI;AACtBC,EAAAA,kBAAkB,GAAG,KAAK;EAC1B,GAAGC,IAAAA;AACJ,CAAA,EACDC,SAAS,KACP;AACF,EAAA,MAAMC,OAAO,GAAGZ,SAAS,IAAI,OAAO,CAAA;EAEpC,oBACEa,GAAA,CAACD,OAAO,EAAA;AAAA,IAAA,GACFF,IAAI;AACRI,IAAAA,GAAG,EAAEH,SAAU;AACfL,IAAAA,SAAS,EAAES,IAAI,CAAC,WAAW,EAAET,SAAS,EAAE;AACtC,MAAA,kBAAkB,EAAEF,OAAO;MAC3BF,QAAQ;MACRC,QAAQ;AACR,MAAA,qBAAqB,EAAEI,mBAAmB;AAC1C,MAAA,8BAA8B,EAAEE,kBAAAA;KACjC,CAAE;AACHN,IAAAA,QAAQ,EAAEA,QAAQ,IAAIS,OAAO,KAAK,QAAS;AAAAI,IAAAA,QAAA,eAE3CC,IAAA,CAAA,KAAA,EAAA;AAAKX,MAAAA,SAAS,EAAC,OAAO;MAAAU,QAAA,EAAA,CACnBpB,KAAK,iBACJiB,GAAA,CAAA,KAAA,EAAA;AAAKP,QAAAA,SAAS,EAAC,YAAY;QAAAU,QAAA,EACxBR,eAAe,gBACdK,GAAA,CAAA,KAAA,EAAA;AACEP,UAAAA,SAAS,EAAES,IAAI,CAAC,+BAA+B,EAAE;AAC/C,YAAA,gBAAgB,EAAEV,kBAAAA;AACnB,WAAA,CAAE;AAAAW,UAAAA,QAAA,EAEFpB,KAAAA;SACE,CAAC,gBAENiB,GAAA,CAAA,KAAA,EAAA;AAAKP,UAAAA,SAAS,EAAC,4BAA4B;AAAAU,UAAAA,QAAA,EAAEpB,KAAAA;SAAW,CAAA;OAEvD,CACN,eACDqB,IAAA,CAAA,KAAA,EAAA;AAAKX,QAAAA,SAAS,EAAC,YAAY;AAAAU,QAAAA,QAAA,gBACzBH,GAAA,CAAA,IAAA,EAAA;AAAIP,UAAAA,SAAS,EAAC,uDAAuD;AAAAU,UAAAA,QAAA,EAAEnB,KAAAA;AAAK,SAAK,CACjF,EAACC,OAAO,iBAAIe,GAAA,CAACK,IAAI,EAAA;AAACZ,UAAAA,SAAS,EAAC,yBAAyB;AAAAU,UAAAA,QAAA,EAAElB,OAAAA;AAAO,SAAO,CAAC,CAAA;OACnE,CACL,eAAAe,GAAA,CAAA,KAAA,EAAA;AAAKP,QAAAA,SAAS,EAAC,aAAa;AAAAU,QAAAA,QAAA,EAAEf,MAAAA;AAAM,OAAM,CAC5C,CAAA;KAAK,CAAA;AACP,GAAS,CAAC,CAAA;AAEd,CAAC;;;;"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var clsx = require('clsx');
|
|
4
4
|
var jsxRuntime = require('react/jsx-runtime');
|
|
5
5
|
|
|
6
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
-
|
|
8
|
-
var classNames__default = /*#__PURE__*/_interopDefault(classNames);
|
|
9
|
-
|
|
10
6
|
function RadioButton({
|
|
11
7
|
id,
|
|
12
8
|
value = '',
|
|
@@ -31,7 +27,7 @@ function RadioButton({
|
|
|
31
27
|
}
|
|
32
28
|
}
|
|
33
29
|
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
34
|
-
className:
|
|
30
|
+
className: clsx.clsx('tw-radio-button', {
|
|
35
31
|
checked,
|
|
36
32
|
disabled: disabled || readOnly
|
|
37
33
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButton.js","sources":["../../../src/common/RadioButton/RadioButton.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"RadioButton.js","sources":["../../../src/common/RadioButton/RadioButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nexport interface RadioButtonProps<T extends string | number = string> {\n id?: string;\n name: string;\n checked?: boolean;\n onChange?: (value: T) => void;\n disabled?: boolean;\n value?: T;\n readOnly?: boolean;\n}\n\nexport default function RadioButton<T extends string | number = ''>({\n id,\n value = '' as T,\n name,\n checked,\n onChange,\n disabled,\n readOnly,\n}: RadioButtonProps<T>) {\n return (\n <>\n <input\n type=\"radio\"\n className=\"sr-only\"\n id={id}\n value={value}\n name={name}\n checked={checked}\n disabled={disabled || readOnly}\n onChange={() => {\n if (!checked) {\n onChange?.(value);\n }\n }}\n />\n <span className={clsx('tw-radio-button', { checked, disabled: disabled || readOnly })}>\n <span className=\"tw-radio-check\" />\n </span>\n </>\n );\n}\n"],"names":["RadioButton","id","value","name","checked","onChange","disabled","readOnly","_jsxs","_Fragment","children","_jsx","type","className","clsx"],"mappings":";;;;;AAYwB,SAAAA,WAAWA,CAAiC;EAClEC,EAAE;AACFC,EAAAA,KAAK,GAAG,EAAO;EACfC,IAAI;EACJC,OAAO;EACPC,QAAQ;EACRC,QAAQ;AACRC,EAAAA,QAAAA;AACoB,CAAA,EAAA;EACpB,oBACEC,eAAA,CAAAC,mBAAA,EAAA;AAAAC,IAAAA,QAAA,gBACEC,cAAA,CAAA,OAAA,EAAA;AACEC,MAAAA,IAAI,EAAC,OAAO;AACZC,MAAAA,SAAS,EAAC,SAAS;AACnBZ,MAAAA,EAAE,EAAEA,EAAG;AACPC,MAAAA,KAAK,EAAEA,KAAM;AACbC,MAAAA,IAAI,EAAEA,IAAK;AACXC,MAAAA,OAAO,EAAEA,OAAQ;MACjBE,QAAQ,EAAEA,QAAQ,IAAIC,QAAS;MAC/BF,QAAQ,EAAEA,MAAK;QACb,IAAI,CAACD,OAAO,EAAE;UACZC,QAAQ,GAAGH,KAAK,CAAC,CAAA;AACnB,SAAA;AACF,OAAA;KAEF,CAAA,eAAAS,cAAA,CAAA,MAAA,EAAA;AAAME,MAAAA,SAAS,EAAEC,SAAI,CAAC,iBAAiB,EAAE;QAAEV,OAAO;QAAEE,QAAQ,EAAEA,QAAQ,IAAIC,QAAAA;AAAU,OAAA,CAAE;AAAAG,MAAAA,QAAA,eACpFC,cAAA,CAAA,MAAA,EAAA;AAAME,QAAAA,SAAS,EAAC,gBAAA;OAClB,CAAA;AAAA,KAAM,CACR,CAAA;AAAA,GAAA,CAAG,CAAA;AAEP;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
3
|
|
|
4
4
|
function RadioButton({
|
|
@@ -25,7 +25,7 @@ function RadioButton({
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}), /*#__PURE__*/jsx("span", {
|
|
28
|
-
className:
|
|
28
|
+
className: clsx('tw-radio-button', {
|
|
29
29
|
checked,
|
|
30
30
|
disabled: disabled || readOnly
|
|
31
31
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioButton.mjs","sources":["../../../src/common/RadioButton/RadioButton.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"RadioButton.mjs","sources":["../../../src/common/RadioButton/RadioButton.tsx"],"sourcesContent":["import { clsx } from 'clsx';\n\nexport interface RadioButtonProps<T extends string | number = string> {\n id?: string;\n name: string;\n checked?: boolean;\n onChange?: (value: T) => void;\n disabled?: boolean;\n value?: T;\n readOnly?: boolean;\n}\n\nexport default function RadioButton<T extends string | number = ''>({\n id,\n value = '' as T,\n name,\n checked,\n onChange,\n disabled,\n readOnly,\n}: RadioButtonProps<T>) {\n return (\n <>\n <input\n type=\"radio\"\n className=\"sr-only\"\n id={id}\n value={value}\n name={name}\n checked={checked}\n disabled={disabled || readOnly}\n onChange={() => {\n if (!checked) {\n onChange?.(value);\n }\n }}\n />\n <span className={clsx('tw-radio-button', { checked, disabled: disabled || readOnly })}>\n <span className=\"tw-radio-check\" />\n </span>\n </>\n );\n}\n"],"names":["RadioButton","id","value","name","checked","onChange","disabled","readOnly","_jsxs","_Fragment","children","_jsx","type","className","clsx"],"mappings":";;;AAYwB,SAAAA,WAAWA,CAAiC;EAClEC,EAAE;AACFC,EAAAA,KAAK,GAAG,EAAO;EACfC,IAAI;EACJC,OAAO;EACPC,QAAQ;EACRC,QAAQ;AACRC,EAAAA,QAAAA;AACoB,CAAA,EAAA;EACpB,oBACEC,IAAA,CAAAC,QAAA,EAAA;AAAAC,IAAAA,QAAA,gBACEC,GAAA,CAAA,OAAA,EAAA;AACEC,MAAAA,IAAI,EAAC,OAAO;AACZC,MAAAA,SAAS,EAAC,SAAS;AACnBZ,MAAAA,EAAE,EAAEA,EAAG;AACPC,MAAAA,KAAK,EAAEA,KAAM;AACbC,MAAAA,IAAI,EAAEA,IAAK;AACXC,MAAAA,OAAO,EAAEA,OAAQ;MACjBE,QAAQ,EAAEA,QAAQ,IAAIC,QAAS;MAC/BF,QAAQ,EAAEA,MAAK;QACb,IAAI,CAACD,OAAO,EAAE;UACZC,QAAQ,GAAGH,KAAK,CAAC,CAAA;AACnB,SAAA;AACF,OAAA;KAEF,CAAA,eAAAS,GAAA,CAAA,MAAA,EAAA;AAAME,MAAAA,SAAS,EAAEC,IAAI,CAAC,iBAAiB,EAAE;QAAEV,OAAO;QAAEE,QAAQ,EAAEA,QAAQ,IAAIC,QAAAA;AAAU,OAAA,CAAE;AAAAG,MAAAA,QAAA,eACpFC,GAAA,CAAA,MAAA,EAAA;AAAME,QAAAA,SAAS,EAAC,gBAAA;OAClB,CAAA;AAAA,KAAM,CACR,CAAA;AAAA,GAAA,CAAG,CAAA;AAEP;;;;"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var clsx = require('clsx');
|
|
4
4
|
var Link = require('../../link/Link.js');
|
|
5
5
|
var typography = require('../propsValues/typography.js');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
|
|
8
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
|
-
|
|
10
|
-
var classNames__default = /*#__PURE__*/_interopDefault(classNames);
|
|
11
|
-
|
|
12
8
|
function Action({
|
|
13
9
|
action,
|
|
14
10
|
className
|
|
@@ -27,7 +23,7 @@ function Action({
|
|
|
27
23
|
return /*#__PURE__*/jsxRuntime.jsx("button", {
|
|
28
24
|
type: "button",
|
|
29
25
|
"aria-label": action['aria-label'],
|
|
30
|
-
className:
|
|
26
|
+
className: clsx.clsx('btn-unstyled np-text-link-large', className),
|
|
31
27
|
onClick: action.onClick,
|
|
32
28
|
children: action.text
|
|
33
29
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Action.js","sources":["../../../src/common/action/Action.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Action.js","sources":["../../../src/common/action/Action.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport Link from '../../link';\nimport { Typography } from '../propsValues/typography';\n\nexport type ActionOptions = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n};\n\ntype Props = {\n action: ActionOptions;\n className?: string;\n};\n\nexport function Action({ action, className }: Props) {\n if ('href' in action) {\n return (\n <Link\n href={action.href}\n className={className}\n aria-label={action['aria-label']}\n target={action.target}\n type={Typography.LINK_LARGE}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n );\n }\n\n return (\n <button\n type=\"button\"\n aria-label={action['aria-label']}\n className={clsx('btn-unstyled np-text-link-large', className)}\n onClick={action.onClick}\n >\n {action.text}\n </button>\n );\n}\n"],"names":["Action","action","className","_jsx","Link","href","target","type","Typography","LINK_LARGE","onClick","children","text","clsx"],"mappings":";;;;;;;SAiBgBA,MAAMA,CAAC;EAAEC,MAAM;AAAEC,EAAAA,SAAAA;AAAkB,CAAA,EAAA;EACjD,IAAI,MAAM,IAAID,MAAM,EAAE;IACpB,oBACEE,cAAA,CAACC,IAAI,EAAA;MACHC,IAAI,EAAEJ,MAAM,CAACI,IAAK;AAClBH,MAAAA,SAAS,EAAEA,SAAU;MACrB,YAAYD,EAAAA,MAAM,CAAC,YAAY,CAAE;MACjCK,MAAM,EAAEL,MAAM,CAACK,MAAO;MACtBC,IAAI,EAAEC,qBAAU,CAACC,UAAW;MAC5BC,OAAO,EAAET,MAAM,CAACS,OAAQ;MAAAC,QAAA,EAEvBV,MAAM,CAACW,IAAAA;AAAI,KACR,CAAC,CAAA;AAEX,GAAA;AAEA,EAAA,oBACET,cAAA,CAAA,QAAA,EAAA;AACEI,IAAAA,IAAI,EAAC,QAAQ;IACb,YAAYN,EAAAA,MAAM,CAAC,YAAY,CAAE;AACjCC,IAAAA,SAAS,EAAEW,SAAI,CAAC,iCAAiC,EAAEX,SAAS,CAAE;IAC9DQ,OAAO,EAAET,MAAM,CAACS,OAAQ;IAAAC,QAAA,EAEvBV,MAAM,CAACW,IAAAA;AAAI,GACN,CAAC,CAAA;AAEb;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
2
|
import Link from '../../link/Link.mjs';
|
|
3
3
|
import { Typography } from '../propsValues/typography.mjs';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -21,7 +21,7 @@ function Action({
|
|
|
21
21
|
return /*#__PURE__*/jsx("button", {
|
|
22
22
|
type: "button",
|
|
23
23
|
"aria-label": action['aria-label'],
|
|
24
|
-
className:
|
|
24
|
+
className: clsx('btn-unstyled np-text-link-large', className),
|
|
25
25
|
onClick: action.onClick,
|
|
26
26
|
children: action.text
|
|
27
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Action.mjs","sources":["../../../src/common/action/Action.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"Action.mjs","sources":["../../../src/common/action/Action.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport Link from '../../link';\nimport { Typography } from '../propsValues/typography';\n\nexport type ActionOptions = {\n 'aria-label'?: string;\n href?: string;\n target?: string;\n text: React.ReactNode;\n onClick?: () => void;\n};\n\ntype Props = {\n action: ActionOptions;\n className?: string;\n};\n\nexport function Action({ action, className }: Props) {\n if ('href' in action) {\n return (\n <Link\n href={action.href}\n className={className}\n aria-label={action['aria-label']}\n target={action.target}\n type={Typography.LINK_LARGE}\n onClick={action.onClick}\n >\n {action.text}\n </Link>\n );\n }\n\n return (\n <button\n type=\"button\"\n aria-label={action['aria-label']}\n className={clsx('btn-unstyled np-text-link-large', className)}\n onClick={action.onClick}\n >\n {action.text}\n </button>\n );\n}\n"],"names":["Action","action","className","_jsx","Link","href","target","type","Typography","LINK_LARGE","onClick","children","text","clsx"],"mappings":";;;;;SAiBgBA,MAAMA,CAAC;EAAEC,MAAM;AAAEC,EAAAA,SAAAA;AAAkB,CAAA,EAAA;EACjD,IAAI,MAAM,IAAID,MAAM,EAAE;IACpB,oBACEE,GAAA,CAACC,IAAI,EAAA;MACHC,IAAI,EAAEJ,MAAM,CAACI,IAAK;AAClBH,MAAAA,SAAS,EAAEA,SAAU;MACrB,YAAYD,EAAAA,MAAM,CAAC,YAAY,CAAE;MACjCK,MAAM,EAAEL,MAAM,CAACK,MAAO;MACtBC,IAAI,EAAEC,UAAU,CAACC,UAAW;MAC5BC,OAAO,EAAET,MAAM,CAACS,OAAQ;MAAAC,QAAA,EAEvBV,MAAM,CAACW,IAAAA;AAAI,KACR,CAAC,CAAA;AAEX,GAAA;AAEA,EAAA,oBACET,GAAA,CAAA,QAAA,EAAA;AACEI,IAAAA,IAAI,EAAC,QAAQ;IACb,YAAYN,EAAAA,MAAM,CAAC,YAAY,CAAE;AACjCC,IAAAA,SAAS,EAAEW,IAAI,CAAC,iCAAiC,EAAEX,SAAS,CAAE;IAC9DQ,OAAO,EAAET,MAAM,CAACS,OAAQ;IAAAC,QAAA,EAEvBV,MAAM,CAACW,IAAAA;AAAI,GACN,CAAC,CAAA;AAEb;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var clsx = require('clsx');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var Dimmer = require('../../dimmer/Dimmer.js');
|
|
6
6
|
var Drawer = require('../../drawer/Drawer.js');
|
|
@@ -14,10 +14,6 @@ var position = require('../propsValues/position.js');
|
|
|
14
14
|
var jsxRuntime = require('react/jsx-runtime');
|
|
15
15
|
var useConditionalListener = require('../hooks/useConditionalListener/useConditionalListener.js');
|
|
16
16
|
|
|
17
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
-
|
|
19
|
-
var classNames__default = /*#__PURE__*/_interopDefault(classNames);
|
|
20
|
-
|
|
21
17
|
const INITIAL_Y_POSITION = 0;
|
|
22
18
|
const CONTENT_SCROLL_THRESHOLD = 1;
|
|
23
19
|
const MOVE_OFFSET_THRESHOLD = 50;
|
|
@@ -161,7 +157,7 @@ const BottomSheet = props => {
|
|
|
161
157
|
ref: bottomSheetReference,
|
|
162
158
|
open: props.open,
|
|
163
159
|
position: position.Position.BOTTOM,
|
|
164
|
-
className:
|
|
160
|
+
className: clsx.clsx('np-bottom-sheet', props.className),
|
|
165
161
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
166
162
|
id: overlayId,
|
|
167
163
|
role: "dialog",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.js","sources":["../../../src/common/bottomSheet/BottomSheet.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport {\n CSSProperties,\n PropsWithChildren,\n SyntheticEvent,\n useContext,\n useRef,\n useState,\n} from 'react';\n\nimport Dimmer from '../../dimmer';\nimport Drawer from '../../drawer';\nimport { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';\nimport SlidingPanel from '../../slidingPanel';\nimport { CloseButton } from '../closeButton';\nimport { CommonProps } from '../commonProps';\nimport { isServerSide } from '../domHelpers';\nimport { useConditionalListener } from '../hooks';\nimport { useMedia } from '../hooks/useMedia';\nimport { Breakpoint } from '../propsValues/breakpoint';\nimport { Position } from '../propsValues/position';\n\nconst INITIAL_Y_POSITION = 0;\n\nconst CONTENT_SCROLL_THRESHOLD = 1;\n\nconst MOVE_OFFSET_THRESHOLD = 50;\n\nexport type BottomSheetProps = PropsWithChildren<\n {\n onClose?: (event: Event | SyntheticEvent) => void;\n open: boolean;\n } & CommonProps\n>;\n\n/**\n * Neptune: https://transferwise.github.io/neptune/components/bottom-sheet/\n *\n * Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet\n *\n */\nconst BottomSheet = (props: BottomSheetProps) => {\n const bottomSheetReference = useRef<HTMLDivElement>(null);\n const topBarReference = useRef<HTMLDivElement>(null);\n const contentReference = useRef<HTMLDivElement>(null);\n\n const [pressed, setPressed] = useState<boolean>(false);\n\n /**\n * Used to track `requestAnimationFrame` requests\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame#return_value\n */\n const animationId = useRef<number>(0);\n\n /**\n * Difference between initial coordinate ({@link initialYCoordinate})\n * and new position (when user moves component), it's get calculated on `onTouchMove` and `onMouseMove` events\n *\n * @see {@link calculateOffsetAfterMove}\n */\n const moveOffset = useRef<number>(0);\n const initialYCoordinate = useRef<number>(0);\n\n // apply shadow to the bottom of top-bar when scroll over content\n useConditionalListener({\n attachListener: props.open && !isServerSide(),\n callback: () => {\n if (topBarReference.current !== null) {\n const { classList } = topBarReference.current;\n if (!isContentScrollPositionAtTop()) {\n classList.add('np-bottom-sheet--top-bar--shadow');\n } else {\n classList.remove('np-bottom-sheet--top-bar--shadow');\n }\n }\n },\n eventType: 'scroll',\n parent: isServerSide() ? undefined : document,\n });\n\n function move(newHeight: number): void {\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.transform = `translateY(${newHeight}px)`;\n }\n }\n\n function close(event: Event | SyntheticEvent): void {\n setPressed(false);\n moveOffset.current = INITIAL_Y_POSITION;\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.removeProperty('transform');\n }\n if (props.onClose) {\n props.onClose(event);\n }\n }\n\n const onSwipeStart = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n initialYCoordinate.current = ('touches' in event ? event.touches[0] : event).clientY;\n setPressed(true);\n };\n\n const onSwipeMove = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n if (pressed) {\n const { clientY } = 'touches' in event ? event.touches[0] : event;\n\n const offset = calculateOffsetAfterMove(clientY);\n // check whether move is to the bottom only and content scroll position is at the top\n if (offset > INITIAL_Y_POSITION && isContentScrollPositionAtTop()) {\n moveOffset.current = offset;\n animationId.current = requestAnimationFrame(() => {\n if (animationId.current !== undefined && bottomSheetReference.current !== null) {\n move(offset);\n }\n });\n }\n }\n };\n\n function onSwipeEnd(\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void {\n // stop moving component\n cancelAnimationFrame(animationId.current);\n setPressed(false);\n // check whether move down is strong enough\n // and content scroll position is at the top to close the component\n if (moveOffset.current > MOVE_OFFSET_THRESHOLD && isContentScrollPositionAtTop()) {\n close(event);\n }\n // otherwise move component back to default (initial) position\n else {\n move(INITIAL_Y_POSITION);\n }\n moveOffset.current = INITIAL_Y_POSITION;\n }\n\n function isContentScrollPositionAtTop(): boolean {\n return (\n contentReference?.current?.scrollTop !== undefined &&\n contentReference.current.scrollTop <= CONTENT_SCROLL_THRESHOLD\n );\n }\n\n /**\n * Calculates how hard user moves component,\n * result value used to determine whether to hide component or re-position to default state\n *\n * @param afterMoveYCoordinate\n */\n function calculateOffsetAfterMove(afterMoveYCoordinate: number): number {\n return afterMoveYCoordinate - initialYCoordinate.current;\n }\n\n /**\n * Set `max-height` for content part (in order to keep it scrollable for content overflow cases) of the component\n * and ensures space for safe zone (32px) at the top.\n */\n function setContentMaxHeight(): CSSProperties {\n const safeZoneHeight = '64px';\n const topbarHeight = '32px';\n const windowHight: number = isServerSide() ? 0 : window.innerHeight;\n /**\n * Calculate _real_ height of the screen (taking into account parts of browser interface).\n *\n * See https://css-tricks.com/the-trick-to-viewport-units-on-mobile for more details.\n */\n const screenHeight = `${windowHight * 0.01 * 100}px`;\n return {\n maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`,\n };\n }\n\n const is400Zoom = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n\n const overlayId = useContext(OverlayIdContext);\n\n return is400Zoom ? (\n <Drawer open={props.open} className={props.className} onClose={close}>\n {props.children}\n </Drawer>\n ) : (\n <Dimmer open={props.open} fadeContentOnEnter fadeContentOnExit onClose={close}>\n <SlidingPanel\n ref={bottomSheetReference}\n open={props.open}\n position={Position.BOTTOM}\n className={classNames('np-bottom-sheet', props.className)}\n >\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}\n <div\n id={overlayId}\n role=\"dialog\"\n aria-modal\n onTouchStart={onSwipeStart}\n onTouchMove={onSwipeMove}\n onTouchEnd={onSwipeEnd}\n onMouseDown={onSwipeStart}\n onMouseMove={onSwipeMove}\n onMouseUp={onSwipeEnd}\n >\n <div ref={topBarReference} className=\"np-bottom-sheet--top-bar\">\n <div className=\"np-bottom-sheet--handler\" />\n <CloseButton size=\"sm\" className=\"sr-only np-bottom-sheet--close-btn\" onClick={close} />\n </div>\n <div\n ref={contentReference}\n style={setContentMaxHeight()}\n className=\"np-bottom-sheet--content\"\n >\n {props.children}\n </div>\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n};\n\nexport default BottomSheet;\n"],"names":["INITIAL_Y_POSITION","CONTENT_SCROLL_THRESHOLD","MOVE_OFFSET_THRESHOLD","BottomSheet","props","bottomSheetReference","useRef","topBarReference","contentReference","pressed","setPressed","useState","animationId","moveOffset","initialYCoordinate","useConditionalListener","attachListener","open","isServerSide","callback","current","classList","isContentScrollPositionAtTop","add","remove","eventType","parent","undefined","document","move","newHeight","style","transform","close","event","removeProperty","onClose","onSwipeStart","touches","clientY","onSwipeMove","offset","calculateOffsetAfterMove","requestAnimationFrame","onSwipeEnd","cancelAnimationFrame","scrollTop","afterMoveYCoordinate","setContentMaxHeight","safeZoneHeight","topbarHeight","windowHight","window","innerHeight","screenHeight","maxHeight","is400Zoom","useMedia","Breakpoint","ZOOM_400","overlayId","useContext","OverlayIdContext","_jsx","Drawer","className","children","Dimmer","fadeContentOnEnter","fadeContentOnExit","SlidingPanel","ref","position","Position","BOTTOM","classNames","_jsxs","id","role","onTouchStart","onTouchMove","onTouchEnd","onMouseDown","onMouseMove","onMouseUp","CloseButton","size","onClick"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,MAAMA,kBAAkB,GAAG,CAAC,CAAA;AAE5B,MAAMC,wBAAwB,GAAG,CAAC,CAAA;AAElC,MAAMC,qBAAqB,GAAG,EAAE,CAAA;AAShC;;;;;AAKG;AACGC,MAAAA,WAAW,GAAIC,KAAuB,IAAI;AAC9C,EAAA,MAAMC,oBAAoB,GAAGC,YAAM,CAAiB,IAAI,CAAC,CAAA;AACzD,EAAA,MAAMC,eAAe,GAAGD,YAAM,CAAiB,IAAI,CAAC,CAAA;AACpD,EAAA,MAAME,gBAAgB,GAAGF,YAAM,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AA,KAAA,EAAA;AAAKE,YAAAA,SAAS,EAAC,0BAAA;AAA0B,WACzC,CAAA,eAAAF,cAAA,CAACsB,uBAAW,EAAA;AAACC,YAAAA,IAAI,EAAC,IAAI;AAACrB,YAAAA,SAAS,EAAC,oCAAoC;AAACsB,YAAAA,OAAO,EAAEtD,KAAAA;AAAM,WACvF,CAAA,CAAA;SAAK,CACL,eAAA8B,cAAA,CAAA,KAAA,EAAA;AACEQ,UAAAA,GAAG,EAAE/D,gBAAiB;UACtBuB,KAAK,EAAEiB,mBAAmB,EAAG;AAC7BiB,UAAAA,SAAS,EAAC,0BAA0B;UAAAC,QAAA,EAEnC9D,KAAK,CAAC8D,QAAAA;AAAQ,SACZ,CACP,CAAA;OAAK,CAAA;KACO,CAAA;AAChB,GAAQ,CACT,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"BottomSheet.js","sources":["../../../src/common/bottomSheet/BottomSheet.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport {\n CSSProperties,\n PropsWithChildren,\n SyntheticEvent,\n useContext,\n useRef,\n useState,\n} from 'react';\n\nimport Dimmer from '../../dimmer';\nimport Drawer from '../../drawer';\nimport { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';\nimport SlidingPanel from '../../slidingPanel';\nimport { CloseButton } from '../closeButton';\nimport { CommonProps } from '../commonProps';\nimport { isServerSide } from '../domHelpers';\nimport { useConditionalListener } from '../hooks';\nimport { useMedia } from '../hooks/useMedia';\nimport { Breakpoint } from '../propsValues/breakpoint';\nimport { Position } from '../propsValues/position';\n\nconst INITIAL_Y_POSITION = 0;\n\nconst CONTENT_SCROLL_THRESHOLD = 1;\n\nconst MOVE_OFFSET_THRESHOLD = 50;\n\nexport type BottomSheetProps = PropsWithChildren<\n {\n onClose?: (event: Event | SyntheticEvent) => void;\n open: boolean;\n } & CommonProps\n>;\n\n/**\n * Neptune: https://transferwise.github.io/neptune/components/bottom-sheet/\n *\n * Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet\n *\n */\nconst BottomSheet = (props: BottomSheetProps) => {\n const bottomSheetReference = useRef<HTMLDivElement>(null);\n const topBarReference = useRef<HTMLDivElement>(null);\n const contentReference = useRef<HTMLDivElement>(null);\n\n const [pressed, setPressed] = useState<boolean>(false);\n\n /**\n * Used to track `requestAnimationFrame` requests\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame#return_value\n */\n const animationId = useRef<number>(0);\n\n /**\n * Difference between initial coordinate ({@link initialYCoordinate})\n * and new position (when user moves component), it's get calculated on `onTouchMove` and `onMouseMove` events\n *\n * @see {@link calculateOffsetAfterMove}\n */\n const moveOffset = useRef<number>(0);\n const initialYCoordinate = useRef<number>(0);\n\n // apply shadow to the bottom of top-bar when scroll over content\n useConditionalListener({\n attachListener: props.open && !isServerSide(),\n callback: () => {\n if (topBarReference.current !== null) {\n const { classList } = topBarReference.current;\n if (!isContentScrollPositionAtTop()) {\n classList.add('np-bottom-sheet--top-bar--shadow');\n } else {\n classList.remove('np-bottom-sheet--top-bar--shadow');\n }\n }\n },\n eventType: 'scroll',\n parent: isServerSide() ? undefined : document,\n });\n\n function move(newHeight: number): void {\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.transform = `translateY(${newHeight}px)`;\n }\n }\n\n function close(event: Event | SyntheticEvent): void {\n setPressed(false);\n moveOffset.current = INITIAL_Y_POSITION;\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.removeProperty('transform');\n }\n if (props.onClose) {\n props.onClose(event);\n }\n }\n\n const onSwipeStart = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n initialYCoordinate.current = ('touches' in event ? event.touches[0] : event).clientY;\n setPressed(true);\n };\n\n const onSwipeMove = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n if (pressed) {\n const { clientY } = 'touches' in event ? event.touches[0] : event;\n\n const offset = calculateOffsetAfterMove(clientY);\n // check whether move is to the bottom only and content scroll position is at the top\n if (offset > INITIAL_Y_POSITION && isContentScrollPositionAtTop()) {\n moveOffset.current = offset;\n animationId.current = requestAnimationFrame(() => {\n if (animationId.current !== undefined && bottomSheetReference.current !== null) {\n move(offset);\n }\n });\n }\n }\n };\n\n function onSwipeEnd(\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void {\n // stop moving component\n cancelAnimationFrame(animationId.current);\n setPressed(false);\n // check whether move down is strong enough\n // and content scroll position is at the top to close the component\n if (moveOffset.current > MOVE_OFFSET_THRESHOLD && isContentScrollPositionAtTop()) {\n close(event);\n }\n // otherwise move component back to default (initial) position\n else {\n move(INITIAL_Y_POSITION);\n }\n moveOffset.current = INITIAL_Y_POSITION;\n }\n\n function isContentScrollPositionAtTop(): boolean {\n return (\n contentReference?.current?.scrollTop !== undefined &&\n contentReference.current.scrollTop <= CONTENT_SCROLL_THRESHOLD\n );\n }\n\n /**\n * Calculates how hard user moves component,\n * result value used to determine whether to hide component or re-position to default state\n *\n * @param afterMoveYCoordinate\n */\n function calculateOffsetAfterMove(afterMoveYCoordinate: number): number {\n return afterMoveYCoordinate - initialYCoordinate.current;\n }\n\n /**\n * Set `max-height` for content part (in order to keep it scrollable for content overflow cases) of the component\n * and ensures space for safe zone (32px) at the top.\n */\n function setContentMaxHeight(): CSSProperties {\n const safeZoneHeight = '64px';\n const topbarHeight = '32px';\n const windowHight: number = isServerSide() ? 0 : window.innerHeight;\n /**\n * Calculate _real_ height of the screen (taking into account parts of browser interface).\n *\n * See https://css-tricks.com/the-trick-to-viewport-units-on-mobile for more details.\n */\n const screenHeight = `${windowHight * 0.01 * 100}px`;\n return {\n maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`,\n };\n }\n\n const is400Zoom = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n\n const overlayId = useContext(OverlayIdContext);\n\n return is400Zoom ? (\n <Drawer open={props.open} className={props.className} onClose={close}>\n {props.children}\n </Drawer>\n ) : (\n <Dimmer open={props.open} fadeContentOnEnter fadeContentOnExit onClose={close}>\n <SlidingPanel\n ref={bottomSheetReference}\n open={props.open}\n position={Position.BOTTOM}\n className={clsx('np-bottom-sheet', props.className)}\n >\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}\n <div\n id={overlayId}\n role=\"dialog\"\n aria-modal\n onTouchStart={onSwipeStart}\n onTouchMove={onSwipeMove}\n onTouchEnd={onSwipeEnd}\n onMouseDown={onSwipeStart}\n onMouseMove={onSwipeMove}\n onMouseUp={onSwipeEnd}\n >\n <div ref={topBarReference} className=\"np-bottom-sheet--top-bar\">\n <div className=\"np-bottom-sheet--handler\" />\n <CloseButton size=\"sm\" className=\"sr-only np-bottom-sheet--close-btn\" onClick={close} />\n </div>\n <div\n ref={contentReference}\n style={setContentMaxHeight()}\n className=\"np-bottom-sheet--content\"\n >\n {props.children}\n </div>\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n};\n\nexport default BottomSheet;\n"],"names":["INITIAL_Y_POSITION","CONTENT_SCROLL_THRESHOLD","MOVE_OFFSET_THRESHOLD","BottomSheet","props","bottomSheetReference","useRef","topBarReference","contentReference","pressed","setPressed","useState","animationId","moveOffset","initialYCoordinate","useConditionalListener","attachListener","open","isServerSide","callback","current","classList","isContentScrollPositionAtTop","add","remove","eventType","parent","undefined","document","move","newHeight","style","transform","close","event","removeProperty","onClose","onSwipeStart","touches","clientY","onSwipeMove","offset","calculateOffsetAfterMove","requestAnimationFrame","onSwipeEnd","cancelAnimationFrame","scrollTop","afterMoveYCoordinate","setContentMaxHeight","safeZoneHeight","topbarHeight","windowHight","window","innerHeight","screenHeight","maxHeight","is400Zoom","useMedia","Breakpoint","ZOOM_400","overlayId","useContext","OverlayIdContext","_jsx","Drawer","className","children","Dimmer","fadeContentOnEnter","fadeContentOnExit","SlidingPanel","ref","position","Position","BOTTOM","clsx","_jsxs","id","role","onTouchStart","onTouchMove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AAA,IAAI,EAAC,QAAQ;QACb,YAAU,EAAA,IAAA;AACVC,QAAAA,YAAY,EAAE1C,YAAa;AAC3B2C,QAAAA,WAAW,EAAExC,WAAY;AACzByC,QAAAA,UAAU,EAAErC,UAAW;AACvBsC,QAAAA,WAAW,EAAE7C,YAAa;AAC1B8C,QAAAA,WAAW,EAAE3C,WAAY;AACzB4C,QAAAA,SAAS,EAAExC,UAAW;AAAAsB,QAAAA,QAAA,gBAEtBU,eAAA,CAAA,KAAA,EAAA;AAAKL,UAAAA,GAAG,EAAEhE,eAAgB;AAAC0D,UAAAA,SAAS,EAAC,0BAA0B;AAAAC,UAAAA,QAAA,gBAC7DH,cAAA,CAAA,KAAA,EAAA;AAAKE,YAAAA,SAAS,EAAC,0BAAA;AAA0B,WACzC,CAAA,eAAAF,cAAA,CAACsB,uBAAW,EAAA;AAACC,YAAAA,IAAI,EAAC,IAAI;AAACrB,YAAAA,SAAS,EAAC,oCAAoC;AAACsB,YAAAA,OAAO,EAAEtD,KAAAA;AAAM,WACvF,CAAA,CAAA;SAAK,CACL,eAAA8B,cAAA,CAAA,KAAA,EAAA;AACEQ,UAAAA,GAAG,EAAE/D,gBAAiB;UACtBuB,KAAK,EAAEiB,mBAAmB,EAAG;AAC7BiB,UAAAA,SAAS,EAAC,0BAA0B;UAAAC,QAAA,EAEnC9D,KAAK,CAAC8D,QAAAA;AAAQ,SACZ,CACP,CAAA;OAAK,CAAA;KACO,CAAA;AAChB,GAAQ,CACT,CAAA;AACH;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from 'clsx';
|
|
2
2
|
import { useRef, useState, useContext } from 'react';
|
|
3
3
|
import Dimmer from '../../dimmer/Dimmer.mjs';
|
|
4
4
|
import Drawer from '../../drawer/Drawer.mjs';
|
|
@@ -155,7 +155,7 @@ const BottomSheet = props => {
|
|
|
155
155
|
ref: bottomSheetReference,
|
|
156
156
|
open: props.open,
|
|
157
157
|
position: Position.BOTTOM,
|
|
158
|
-
className:
|
|
158
|
+
className: clsx('np-bottom-sheet', props.className),
|
|
159
159
|
children: /*#__PURE__*/jsxs("div", {
|
|
160
160
|
id: overlayId,
|
|
161
161
|
role: "dialog",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.mjs","sources":["../../../src/common/bottomSheet/BottomSheet.tsx"],"sourcesContent":["import classNames from 'classnames';\nimport {\n CSSProperties,\n PropsWithChildren,\n SyntheticEvent,\n useContext,\n useRef,\n useState,\n} from 'react';\n\nimport Dimmer from '../../dimmer';\nimport Drawer from '../../drawer';\nimport { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';\nimport SlidingPanel from '../../slidingPanel';\nimport { CloseButton } from '../closeButton';\nimport { CommonProps } from '../commonProps';\nimport { isServerSide } from '../domHelpers';\nimport { useConditionalListener } from '../hooks';\nimport { useMedia } from '../hooks/useMedia';\nimport { Breakpoint } from '../propsValues/breakpoint';\nimport { Position } from '../propsValues/position';\n\nconst INITIAL_Y_POSITION = 0;\n\nconst CONTENT_SCROLL_THRESHOLD = 1;\n\nconst MOVE_OFFSET_THRESHOLD = 50;\n\nexport type BottomSheetProps = PropsWithChildren<\n {\n onClose?: (event: Event | SyntheticEvent) => void;\n open: boolean;\n } & CommonProps\n>;\n\n/**\n * Neptune: https://transferwise.github.io/neptune/components/bottom-sheet/\n *\n * Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet\n *\n */\nconst BottomSheet = (props: BottomSheetProps) => {\n const bottomSheetReference = useRef<HTMLDivElement>(null);\n const topBarReference = useRef<HTMLDivElement>(null);\n const contentReference = useRef<HTMLDivElement>(null);\n\n const [pressed, setPressed] = useState<boolean>(false);\n\n /**\n * Used to track `requestAnimationFrame` requests\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame#return_value\n */\n const animationId = useRef<number>(0);\n\n /**\n * Difference between initial coordinate ({@link initialYCoordinate})\n * and new position (when user moves component), it's get calculated on `onTouchMove` and `onMouseMove` events\n *\n * @see {@link calculateOffsetAfterMove}\n */\n const moveOffset = useRef<number>(0);\n const initialYCoordinate = useRef<number>(0);\n\n // apply shadow to the bottom of top-bar when scroll over content\n useConditionalListener({\n attachListener: props.open && !isServerSide(),\n callback: () => {\n if (topBarReference.current !== null) {\n const { classList } = topBarReference.current;\n if (!isContentScrollPositionAtTop()) {\n classList.add('np-bottom-sheet--top-bar--shadow');\n } else {\n classList.remove('np-bottom-sheet--top-bar--shadow');\n }\n }\n },\n eventType: 'scroll',\n parent: isServerSide() ? undefined : document,\n });\n\n function move(newHeight: number): void {\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.transform = `translateY(${newHeight}px)`;\n }\n }\n\n function close(event: Event | SyntheticEvent): void {\n setPressed(false);\n moveOffset.current = INITIAL_Y_POSITION;\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.removeProperty('transform');\n }\n if (props.onClose) {\n props.onClose(event);\n }\n }\n\n const onSwipeStart = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n initialYCoordinate.current = ('touches' in event ? event.touches[0] : event).clientY;\n setPressed(true);\n };\n\n const onSwipeMove = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n if (pressed) {\n const { clientY } = 'touches' in event ? event.touches[0] : event;\n\n const offset = calculateOffsetAfterMove(clientY);\n // check whether move is to the bottom only and content scroll position is at the top\n if (offset > INITIAL_Y_POSITION && isContentScrollPositionAtTop()) {\n moveOffset.current = offset;\n animationId.current = requestAnimationFrame(() => {\n if (animationId.current !== undefined && bottomSheetReference.current !== null) {\n move(offset);\n }\n });\n }\n }\n };\n\n function onSwipeEnd(\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void {\n // stop moving component\n cancelAnimationFrame(animationId.current);\n setPressed(false);\n // check whether move down is strong enough\n // and content scroll position is at the top to close the component\n if (moveOffset.current > MOVE_OFFSET_THRESHOLD && isContentScrollPositionAtTop()) {\n close(event);\n }\n // otherwise move component back to default (initial) position\n else {\n move(INITIAL_Y_POSITION);\n }\n moveOffset.current = INITIAL_Y_POSITION;\n }\n\n function isContentScrollPositionAtTop(): boolean {\n return (\n contentReference?.current?.scrollTop !== undefined &&\n contentReference.current.scrollTop <= CONTENT_SCROLL_THRESHOLD\n );\n }\n\n /**\n * Calculates how hard user moves component,\n * result value used to determine whether to hide component or re-position to default state\n *\n * @param afterMoveYCoordinate\n */\n function calculateOffsetAfterMove(afterMoveYCoordinate: number): number {\n return afterMoveYCoordinate - initialYCoordinate.current;\n }\n\n /**\n * Set `max-height` for content part (in order to keep it scrollable for content overflow cases) of the component\n * and ensures space for safe zone (32px) at the top.\n */\n function setContentMaxHeight(): CSSProperties {\n const safeZoneHeight = '64px';\n const topbarHeight = '32px';\n const windowHight: number = isServerSide() ? 0 : window.innerHeight;\n /**\n * Calculate _real_ height of the screen (taking into account parts of browser interface).\n *\n * See https://css-tricks.com/the-trick-to-viewport-units-on-mobile for more details.\n */\n const screenHeight = `${windowHight * 0.01 * 100}px`;\n return {\n maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`,\n };\n }\n\n const is400Zoom = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n\n const overlayId = useContext(OverlayIdContext);\n\n return is400Zoom ? (\n <Drawer open={props.open} className={props.className} onClose={close}>\n {props.children}\n </Drawer>\n ) : (\n <Dimmer open={props.open} fadeContentOnEnter fadeContentOnExit onClose={close}>\n <SlidingPanel\n ref={bottomSheetReference}\n open={props.open}\n position={Position.BOTTOM}\n className={classNames('np-bottom-sheet', props.className)}\n >\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}\n <div\n id={overlayId}\n role=\"dialog\"\n aria-modal\n onTouchStart={onSwipeStart}\n onTouchMove={onSwipeMove}\n onTouchEnd={onSwipeEnd}\n onMouseDown={onSwipeStart}\n onMouseMove={onSwipeMove}\n onMouseUp={onSwipeEnd}\n >\n <div ref={topBarReference} className=\"np-bottom-sheet--top-bar\">\n <div className=\"np-bottom-sheet--handler\" />\n <CloseButton size=\"sm\" className=\"sr-only np-bottom-sheet--close-btn\" onClick={close} />\n </div>\n <div\n ref={contentReference}\n style={setContentMaxHeight()}\n className=\"np-bottom-sheet--content\"\n >\n {props.children}\n </div>\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n};\n\nexport default BottomSheet;\n"],"names":["INITIAL_Y_POSITION","CONTENT_SCROLL_THRESHOLD","MOVE_OFFSET_THRESHOLD","BottomSheet","props","bottomSheetReference","useRef","topBarReference","contentReference","pressed","setPressed","useState","animationId","moveOffset","initialYCoordinate","useConditionalListener","attachListener","open","isServerSide","callback","current","classList","isContentScrollPositionAtTop","add","remove","eventType","parent","undefined","document","move","newHeight","style","transform","close","event","removeProperty","onClose","onSwipeStart","touches","clientY","onSwipeMove","offset","calculateOffsetAfterMove","requestAnimationFrame","onSwipeEnd","cancelAnimationFrame","scrollTop","afterMoveYCoordinate","setContentMaxHeight","safeZoneHeight","topbarHeight","windowHight","window","innerHeight","screenHeight","maxHeight","is400Zoom","useMedia","Breakpoint","ZOOM_400","overlayId","useContext","OverlayIdContext","_jsx","Drawer","className","children","Dimmer","fadeContentOnEnter","fadeContentOnExit","SlidingPanel","ref","position","Position","BOTTOM","classNames","_jsxs","id","role","onTouchStart","onTouchMove","onTouchEnd","onMouseDown","onMouseMove","onMouseUp","CloseButton","size","onClick"],"mappings":";;;;;;;;;;;;;;AAsBA,MAAMA,kBAAkB,GAAG,CAAC,CAAA;AAE5B,MAAMC,wBAAwB,GAAG,CAAC,CAAA;AAElC,MAAMC,qBAAqB,GAAG,EAAE,CAAA;AAShC;;;;;AAKG;AACGC,MAAAA,WAAW,GAAIC,KAAuB,IAAI;AAC9C,EAAA,MAAMC,oBAAoB,GAAGC,MAAM,CAAiB,IAAI,CAAC,CAAA;AACzD,EAAA,MAAMC,eAAe,GA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AAAA,SAAS,EAAC,0BAA0B;AAAAC,UAAAA,QAAA,gBAC7DH,GAAA,CAAA,KAAA,EAAA;AAAKE,YAAAA,SAAS,EAAC,0BAAA;AAA0B,WACzC,CAAA,eAAAF,GAAA,CAACsB,WAAW,EAAA;AAACC,YAAAA,IAAI,EAAC,IAAI;AAACrB,YAAAA,SAAS,EAAC,oCAAoC;AAACsB,YAAAA,OAAO,EAAEtD,KAAAA;AAAM,WACvF,CAAA,CAAA;SAAK,CACL,eAAA8B,GAAA,CAAA,KAAA,EAAA;AACEQ,UAAAA,GAAG,EAAE/D,gBAAiB;UACtBuB,KAAK,EAAEiB,mBAAmB,EAAG;AAC7BiB,UAAAA,SAAS,EAAC,0BAA0B;UAAAC,QAAA,EAEnC9D,KAAK,CAAC8D,QAAAA;AAAQ,SACZ,CACP,CAAA;OAAK,CAAA;KACO,CAAA;AAChB,GAAQ,CACT,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"BottomSheet.mjs","sources":["../../../src/common/bottomSheet/BottomSheet.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport {\n CSSProperties,\n PropsWithChildren,\n SyntheticEvent,\n useContext,\n useRef,\n useState,\n} from 'react';\n\nimport Dimmer from '../../dimmer';\nimport Drawer from '../../drawer';\nimport { OverlayIdContext } from '../../provider/overlay/OverlayIdProvider';\nimport SlidingPanel from '../../slidingPanel';\nimport { CloseButton } from '../closeButton';\nimport { CommonProps } from '../commonProps';\nimport { isServerSide } from '../domHelpers';\nimport { useConditionalListener } from '../hooks';\nimport { useMedia } from '../hooks/useMedia';\nimport { Breakpoint } from '../propsValues/breakpoint';\nimport { Position } from '../propsValues/position';\n\nconst INITIAL_Y_POSITION = 0;\n\nconst CONTENT_SCROLL_THRESHOLD = 1;\n\nconst MOVE_OFFSET_THRESHOLD = 50;\n\nexport type BottomSheetProps = PropsWithChildren<\n {\n onClose?: (event: Event | SyntheticEvent) => void;\n open: boolean;\n } & CommonProps\n>;\n\n/**\n * Neptune: https://transferwise.github.io/neptune/components/bottom-sheet/\n *\n * Neptune Web: https://transferwise.github.io/neptune-web/components/overlays/BottomSheet\n *\n */\nconst BottomSheet = (props: BottomSheetProps) => {\n const bottomSheetReference = useRef<HTMLDivElement>(null);\n const topBarReference = useRef<HTMLDivElement>(null);\n const contentReference = useRef<HTMLDivElement>(null);\n\n const [pressed, setPressed] = useState<boolean>(false);\n\n /**\n * Used to track `requestAnimationFrame` requests\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame#return_value\n */\n const animationId = useRef<number>(0);\n\n /**\n * Difference between initial coordinate ({@link initialYCoordinate})\n * and new position (when user moves component), it's get calculated on `onTouchMove` and `onMouseMove` events\n *\n * @see {@link calculateOffsetAfterMove}\n */\n const moveOffset = useRef<number>(0);\n const initialYCoordinate = useRef<number>(0);\n\n // apply shadow to the bottom of top-bar when scroll over content\n useConditionalListener({\n attachListener: props.open && !isServerSide(),\n callback: () => {\n if (topBarReference.current !== null) {\n const { classList } = topBarReference.current;\n if (!isContentScrollPositionAtTop()) {\n classList.add('np-bottom-sheet--top-bar--shadow');\n } else {\n classList.remove('np-bottom-sheet--top-bar--shadow');\n }\n }\n },\n eventType: 'scroll',\n parent: isServerSide() ? undefined : document,\n });\n\n function move(newHeight: number): void {\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.transform = `translateY(${newHeight}px)`;\n }\n }\n\n function close(event: Event | SyntheticEvent): void {\n setPressed(false);\n moveOffset.current = INITIAL_Y_POSITION;\n if (bottomSheetReference.current !== null) {\n bottomSheetReference.current.style.removeProperty('transform');\n }\n if (props.onClose) {\n props.onClose(event);\n }\n }\n\n const onSwipeStart = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n initialYCoordinate.current = ('touches' in event ? event.touches[0] : event).clientY;\n setPressed(true);\n };\n\n const onSwipeMove = (\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void => {\n if (pressed) {\n const { clientY } = 'touches' in event ? event.touches[0] : event;\n\n const offset = calculateOffsetAfterMove(clientY);\n // check whether move is to the bottom only and content scroll position is at the top\n if (offset > INITIAL_Y_POSITION && isContentScrollPositionAtTop()) {\n moveOffset.current = offset;\n animationId.current = requestAnimationFrame(() => {\n if (animationId.current !== undefined && bottomSheetReference.current !== null) {\n move(offset);\n }\n });\n }\n }\n };\n\n function onSwipeEnd(\n event: React.MouseEvent<HTMLDivElement> | React.TouchEvent<HTMLDivElement>,\n ): void {\n // stop moving component\n cancelAnimationFrame(animationId.current);\n setPressed(false);\n // check whether move down is strong enough\n // and content scroll position is at the top to close the component\n if (moveOffset.current > MOVE_OFFSET_THRESHOLD && isContentScrollPositionAtTop()) {\n close(event);\n }\n // otherwise move component back to default (initial) position\n else {\n move(INITIAL_Y_POSITION);\n }\n moveOffset.current = INITIAL_Y_POSITION;\n }\n\n function isContentScrollPositionAtTop(): boolean {\n return (\n contentReference?.current?.scrollTop !== undefined &&\n contentReference.current.scrollTop <= CONTENT_SCROLL_THRESHOLD\n );\n }\n\n /**\n * Calculates how hard user moves component,\n * result value used to determine whether to hide component or re-position to default state\n *\n * @param afterMoveYCoordinate\n */\n function calculateOffsetAfterMove(afterMoveYCoordinate: number): number {\n return afterMoveYCoordinate - initialYCoordinate.current;\n }\n\n /**\n * Set `max-height` for content part (in order to keep it scrollable for content overflow cases) of the component\n * and ensures space for safe zone (32px) at the top.\n */\n function setContentMaxHeight(): CSSProperties {\n const safeZoneHeight = '64px';\n const topbarHeight = '32px';\n const windowHight: number = isServerSide() ? 0 : window.innerHeight;\n /**\n * Calculate _real_ height of the screen (taking into account parts of browser interface).\n *\n * See https://css-tricks.com/the-trick-to-viewport-units-on-mobile for more details.\n */\n const screenHeight = `${windowHight * 0.01 * 100}px`;\n return {\n maxHeight: `calc(${screenHeight} - ${safeZoneHeight} - ${topbarHeight})`,\n };\n }\n\n const is400Zoom = useMedia(`(max-width: ${Breakpoint.ZOOM_400}px)`);\n\n const overlayId = useContext(OverlayIdContext);\n\n return is400Zoom ? (\n <Drawer open={props.open} className={props.className} onClose={close}>\n {props.children}\n </Drawer>\n ) : (\n <Dimmer open={props.open} fadeContentOnEnter fadeContentOnExit onClose={close}>\n <SlidingPanel\n ref={bottomSheetReference}\n open={props.open}\n position={Position.BOTTOM}\n className={clsx('np-bottom-sheet', props.className)}\n >\n {/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */}\n <div\n id={overlayId}\n role=\"dialog\"\n aria-modal\n onTouchStart={onSwipeStart}\n onTouchMove={onSwipeMove}\n onTouchEnd={onSwipeEnd}\n onMouseDown={onSwipeStart}\n onMouseMove={onSwipeMove}\n onMouseUp={onSwipeEnd}\n >\n <div ref={topBarReference} className=\"np-bottom-sheet--top-bar\">\n <div className=\"np-bottom-sheet--handler\" />\n <CloseButton size=\"sm\" className=\"sr-only np-bottom-sheet--close-btn\" onClick={close} />\n </div>\n <div\n ref={contentReference}\n style={setContentMaxHeight()}\n className=\"np-bottom-sheet--content\"\n >\n {props.children}\n </div>\n </div>\n </SlidingPanel>\n </Dimmer>\n );\n};\n\nexport default BottomSheet;\n"],"names":["INITIAL_Y_POSITION","CONTENT_SCROLL_THRESHOLD","MOVE_OFFSET_THRESHOLD","BottomSheet","props","bottomSheetReference","useRef","topBarReference","contentReference","pressed","setPressed","useState","animationId","moveOffset","initialYCoordinate","useConditionalListener","attachListener","open","isServerSide","callback","current","classList","isContentScrollPositionAtTop","add","remove","eventType","parent","undefined","document","move","newHeight","style","transform","close","event","removeProperty","onClose","onSwipeStart","touches","clientY","onSwipeMove","offset","calculateOffsetAfterMove","requestAnimationFrame","onSwipeEnd","cancelAnimationFrame","scrollTop","afterMoveYCoordinate","setContentMaxHeight","safeZoneHeight","topbarHeight","windowHight","window","innerHeight","screenHeight","maxHeight","is400Zoom","useMedia","Breakpoint","ZOOM_400","overlayId","useContext","OverlayIdContext","_jsx","Drawer","className","children","Dimmer","fadeContentOnEnter","fadeContentOnExit","SlidingPanel","ref","position","Position","BOTTOM","clsx","_jsxs","id","role","onTouchStart","onTouchMove","onTouchEnd","onMouseDown","onMouseMove","onMouseUp","CloseButton","size","onClick"],"mappings":";;;;;;;;;;;;;;AAsBA,MAAMA,kBAAkB,GAAG,CAAC,CAAA;AAE5B,MAAMC,wBAAwB,GAAG,CAAC,CAAA;AAElC,MAAMC,qBAAqB,GAAG,EAAE,CAAA;AAShC;;;;;AAKG;AACGC,MAAAA,WAAW,GAAIC,KAAuB,IAAI;AAC9C,EAAA,MAAMC,oBAAoB,GAAGC,MAAM,CAAiB,IAAI,CAAC,CAAA;AACzD,EAAA,MAAMC,eAAe,GAAGD,MAAM,CAAiB,IAAI,CAAC,CAAA;AACpD,EAAA,MAAME,gBAAgB,GAAGF,MAAM,CAAiB,IAAI,CAAC,CAAA;EAErD,MAAM,CAACG,OAAO,EAAEC,UAAU,CAAC,GAAGC,QAAQ,CAAU,KAAK,CAAC,CAAA;AAEtD;;;;AAIG;AACH,EAAA,MAAMC,WAAW,GAAGN,MAAM,CAAS,CAAC,CAAC,CAAA;AAErC;;;;;AAKG;AACH,EAAA,MAAMO,UAAU,GAAGP,MAAM,CAAS,CAAC,CAAC,CAAA;AACpC,EAAA,MAAMQ,kBAAkB,GAAGR,MAAM,CAAS,CAAC,CAAC,CAAA;AAE5C;AACAS,EAAAA,sBAAsB,CAAC;IACrBC,cAAc,EAAEZ,KAAK,CAACa,IAAI,IAAI,CAACC,YAAY,EAAE;IAC7CC,QAAQ,EAAEA,MAAK;AACb,MAAA,IAAIZ,eAAe,CAACa,OAAO,KAAK,IAAI,EAAE;QACpC,MAAM;AAAEC,UAAAA,SAAAA;SAAW,GAAGd,eAAe,CAACa,OAAO,CAAA;AAC7C,QAAA,IAAI,CAACE,4BAA4B,EAAE,EAAE;AACnCD,UAAAA,SAAS,CAACE,GAAG,CAAC,kCAAkC,CAAC,CAAA;AACnD,SAAC,MAAM;AACLF,UAAAA,SAAS,CAACG,MAAM,CAAC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AAA,EAAA;AACEC,QAAAA,EAAE,EAAEjB,SAAU;AACdkB,QAAAA,IAAI,EAAC,QAAQ;QACb,YAAU,EAAA,IAAA;AACVC,QAAAA,YAAY,EAAE1C,YAAa;AAC3B2C,QAAAA,WAAW,EAAExC,WAAY;AACzByC,QAAAA,UAAU,EAAErC,UAAW;AACvBsC,QAAAA,WAAW,EAAE7C,YAAa;AAC1B8C,QAAAA,WAAW,EAAE3C,WAAY;AACzB4C,QAAAA,SAAS,EAAExC,UAAW;AAAAsB,QAAAA,QAAA,gBAEtBU,IAAA,CAAA,KAAA,EAAA;AAAKL,UAAAA,GAAG,EAAEhE,eAAgB;AAAC0D,UAAAA,SAAS,EAAC,0BAA0B;AAAAC,UAAAA,QAAA,gBAC7DH,GAAA,CAAA,KAAA,EAAA;AAAKE,YAAAA,SAAS,EAAC,0BAAA;AAA0B,WACzC,CAAA,eAAAF,GAAA,CAACsB,WAAW,EAAA;AAACC,YAAAA,IAAI,EAAC,IAAI;AAACrB,YAAAA,SAAS,EAAC,oCAAoC;AAACsB,YAAAA,OAAO,EAAEtD,KAAAA;AAAM,WACvF,CAAA,CAAA;SAAK,CACL,eAAA8B,GAAA,CAAA,KAAA,EAAA;AACEQ,UAAAA,GAAG,EAAE/D,gBAAiB;UACtBuB,KAAK,EAAEiB,mBAAmB,EAAG;AAC7BiB,UAAAA,SAAS,EAAC,0BAA0B;UAAAC,QAAA,EAEnC9D,KAAK,CAAC8D,QAAAA;AAAQ,SACZ,CACP,CAAA;OAAK,CAAA;KACO,CAAA;AAChB,GAAQ,CACT,CAAA;AACH;;;;"}
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var clsx = require('clsx');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var CloseButton = require('../closeButton/CloseButton.js');
|
|
6
6
|
var documentIosClick = require('../domHelpers/documentIosClick.js');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
|
|
9
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
|
|
11
|
-
var classNames__default = /*#__PURE__*/_interopDefault(classNames);
|
|
12
|
-
|
|
13
9
|
const Card = /*#__PURE__*/React.forwardRef(({
|
|
14
10
|
className,
|
|
15
11
|
children = null,
|
|
@@ -23,7 +19,7 @@ const Card = /*#__PURE__*/React.forwardRef(({
|
|
|
23
19
|
const closeButtonReference = React.useRef(null);
|
|
24
20
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
25
21
|
ref: ref,
|
|
26
|
-
className:
|
|
22
|
+
className: clsx.clsx('np-Card', {
|
|
27
23
|
'np-Card--small': !!isSmall,
|
|
28
24
|
'is-disabled': !!isDisabled
|
|
29
25
|
}, className),
|