@transferwise/components 0.0.0-experimental-1ea2b9d → 0.0.0-experimental-d4643d9
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 -19
- package/build/accordion/AccordionItem/AccordionItem.js.map +1 -1
- package/build/accordion/AccordionItem/AccordionItem.mjs +3 -19
- package/build/accordion/AccordionItem/AccordionItem.mjs.map +1 -1
- package/build/actionButton/ActionButton.js +1 -19
- package/build/actionButton/ActionButton.js.map +1 -1
- package/build/actionButton/ActionButton.mjs +1 -19
- package/build/actionButton/ActionButton.mjs.map +1 -1
- package/build/actionOption/ActionOption.js +1 -19
- package/build/actionOption/ActionOption.js.map +1 -1
- package/build/actionOption/ActionOption.mjs +1 -19
- package/build/actionOption/ActionOption.mjs.map +1 -1
- package/build/alert/Alert.js +4 -20
- package/build/alert/Alert.js.map +1 -1
- package/build/alert/Alert.mjs +4 -20
- package/build/alert/Alert.mjs.map +1 -1
- package/build/alert/inlineMarkdown/InlineMarkdown.js +1 -19
- package/build/alert/inlineMarkdown/InlineMarkdown.js.map +1 -1
- package/build/alert/inlineMarkdown/InlineMarkdown.mjs +1 -19
- package/build/alert/inlineMarkdown/InlineMarkdown.mjs.map +1 -1
- package/build/avatar/Avatar.js +1 -19
- package/build/avatar/Avatar.js.map +1 -1
- package/build/avatar/Avatar.mjs +1 -19
- package/build/avatar/Avatar.mjs.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.js +2 -19
- package/build/avatarWrapper/AvatarWrapper.js.map +1 -1
- package/build/avatarWrapper/AvatarWrapper.mjs +2 -19
- package/build/avatarWrapper/AvatarWrapper.mjs.map +1 -1
- package/build/badge/Badge.js +2 -19
- package/build/badge/Badge.js.map +1 -1
- package/build/badge/Badge.mjs +2 -19
- package/build/badge/Badge.mjs.map +1 -1
- package/build/button/Button.js +2 -19
- package/build/button/Button.js.map +1 -1
- package/build/button/Button.mjs +2 -19
- package/build/button/Button.mjs.map +1 -1
- package/build/button/classMap.js +0 -18
- package/build/button/classMap.js.map +1 -1
- package/build/button/classMap.mjs +0 -18
- package/build/button/classMap.mjs.map +1 -1
- package/build/button/legacyUtils/legacyUtils.js +2 -18
- package/build/button/legacyUtils/legacyUtils.js.map +1 -1
- package/build/button/legacyUtils/legacyUtils.mjs +2 -18
- package/build/button/legacyUtils/legacyUtils.mjs.map +1 -1
- package/build/card/Card.js +2 -19
- package/build/card/Card.js.map +1 -1
- package/build/card/Card.mjs +2 -19
- package/build/card/Card.mjs.map +1 -1
- package/build/checkbox/Checkbox.js +1 -19
- package/build/checkbox/Checkbox.js.map +1 -1
- package/build/checkbox/Checkbox.mjs +1 -19
- package/build/checkbox/Checkbox.mjs.map +1 -1
- package/build/chevron/Chevron.js +1 -18
- package/build/chevron/Chevron.js.map +1 -1
- package/build/chevron/Chevron.mjs +1 -18
- package/build/chevron/Chevron.mjs.map +1 -1
- package/build/chips/Chip.js +1 -19
- package/build/chips/Chip.js.map +1 -1
- package/build/chips/Chip.mjs +1 -19
- package/build/chips/Chip.mjs.map +1 -1
- package/build/circularButton/CircularButton.js +2 -19
- package/build/circularButton/CircularButton.js.map +1 -1
- package/build/circularButton/CircularButton.mjs +2 -19
- package/build/circularButton/CircularButton.mjs.map +1 -1
- package/build/common/bottomSheet/BottomSheet.js +2 -3
- package/build/common/bottomSheet/BottomSheet.js.map +1 -1
- package/build/common/bottomSheet/BottomSheet.mjs +2 -3
- package/build/common/bottomSheet/BottomSheet.mjs.map +1 -1
- package/build/common/hooks/useHasIntersected/useHasIntersected.js +9 -7
- package/build/common/hooks/useHasIntersected/useHasIntersected.js.map +1 -1
- package/build/common/hooks/useHasIntersected/useHasIntersected.mjs +9 -7
- package/build/common/hooks/useHasIntersected/useHasIntersected.mjs.map +1 -1
- package/build/common/locale/index.js +0 -18
- package/build/common/locale/index.js.map +1 -1
- package/build/common/locale/index.mjs +0 -18
- package/build/common/locale/index.mjs.map +1 -1
- package/build/common/panel/Panel.js +1 -19
- package/build/common/panel/Panel.js.map +1 -1
- package/build/common/panel/Panel.mjs +1 -19
- package/build/common/panel/Panel.mjs.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.js +2 -22
- package/build/common/responsivePanel/ResponsivePanel.js.map +1 -1
- package/build/common/responsivePanel/ResponsivePanel.mjs +2 -22
- package/build/common/responsivePanel/ResponsivePanel.mjs.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.js +3 -19
- package/build/criticalBanner/CriticalCommsBanner.js.map +1 -1
- package/build/criticalBanner/CriticalCommsBanner.mjs +3 -19
- package/build/criticalBanner/CriticalCommsBanner.mjs.map +1 -1
- package/build/dateInput/DateInput.js +4 -19
- package/build/dateInput/DateInput.js.map +1 -1
- package/build/dateInput/DateInput.mjs +4 -19
- package/build/dateInput/DateInput.mjs.map +1 -1
- package/build/dateLookup/DateLookup.js +5 -20
- package/build/dateLookup/DateLookup.js.map +1 -1
- package/build/dateLookup/DateLookup.mjs +5 -20
- package/build/dateLookup/DateLookup.mjs.map +1 -1
- package/build/dateLookup/dateHeader/DateHeader.js +4 -23
- package/build/dateLookup/dateHeader/DateHeader.js.map +1 -1
- package/build/dateLookup/dateHeader/DateHeader.mjs +4 -23
- package/build/dateLookup/dateHeader/DateHeader.mjs.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.js +3 -19
- package/build/dateLookup/dateTrigger/DateTrigger.js.map +1 -1
- package/build/dateLookup/dateTrigger/DateTrigger.mjs +3 -19
- package/build/dateLookup/dateTrigger/DateTrigger.mjs.map +1 -1
- package/build/decision/Decision.js +2 -19
- package/build/decision/Decision.js.map +1 -1
- package/build/decision/Decision.mjs +2 -19
- package/build/decision/Decision.mjs.map +1 -1
- package/build/definitionList/DefinitionList.js +1 -19
- package/build/definitionList/DefinitionList.js.map +1 -1
- package/build/definitionList/DefinitionList.mjs +1 -19
- package/build/definitionList/DefinitionList.mjs.map +1 -1
- package/build/dimmer/Dimmer.js +1 -20
- package/build/dimmer/Dimmer.js.map +1 -1
- package/build/dimmer/Dimmer.mjs +1 -20
- package/build/dimmer/Dimmer.mjs.map +1 -1
- package/build/display/Display.js +1 -19
- package/build/display/Display.js.map +1 -1
- package/build/display/Display.mjs +1 -19
- package/build/display/Display.mjs.map +1 -1
- package/build/drawer/Drawer.js +4 -23
- package/build/drawer/Drawer.js.map +1 -1
- package/build/drawer/Drawer.mjs +4 -23
- package/build/drawer/Drawer.mjs.map +1 -1
- package/build/field/Field.js +1 -19
- package/build/field/Field.js.map +1 -1
- package/build/field/Field.mjs +1 -19
- package/build/field/Field.mjs.map +1 -1
- package/build/flowNavigation/FlowNavigation.js +2 -19
- package/build/flowNavigation/FlowNavigation.js.map +1 -1
- package/build/flowNavigation/FlowNavigation.mjs +2 -19
- package/build/flowNavigation/FlowNavigation.mjs.map +1 -1
- package/build/header/Header.js +1 -19
- package/build/header/Header.js.map +1 -1
- package/build/header/Header.mjs +1 -19
- package/build/header/Header.mjs.map +1 -1
- package/build/image/Image.js +1 -4
- package/build/image/Image.js.map +1 -1
- package/build/image/Image.mjs +1 -4
- package/build/image/Image.mjs.map +1 -1
- package/build/index.js +62 -64
- package/build/index.js.map +1 -1
- package/build/index.mjs +20 -22
- package/build/index.mjs.map +1 -1
- package/build/info/Info.js +2 -19
- package/build/info/Info.js.map +1 -1
- package/build/info/Info.mjs +2 -19
- package/build/info/Info.mjs.map +1 -1
- package/build/inlineAlert/InlineAlert.js +2 -19
- package/build/inlineAlert/InlineAlert.js.map +1 -1
- package/build/inlineAlert/InlineAlert.mjs +2 -19
- package/build/inlineAlert/InlineAlert.mjs.map +1 -1
- package/build/inputs/SearchInput.js +1 -19
- package/build/inputs/SearchInput.js.map +1 -1
- package/build/inputs/SearchInput.mjs +1 -19
- package/build/inputs/SearchInput.mjs.map +1 -1
- package/build/instructionsList/InstructionsList.js +1 -19
- package/build/instructionsList/InstructionsList.js.map +1 -1
- package/build/instructionsList/InstructionsList.mjs +1 -19
- package/build/instructionsList/InstructionsList.mjs.map +1 -1
- package/build/loader/Loader.js +1 -19
- package/build/loader/Loader.js.map +1 -1
- package/build/loader/Loader.mjs +1 -19
- package/build/loader/Loader.mjs.map +1 -1
- package/build/main.css +6 -0
- package/build/markdown/Markdown.js +1 -19
- package/build/markdown/Markdown.js.map +1 -1
- package/build/markdown/Markdown.mjs +1 -19
- package/build/markdown/Markdown.mjs.map +1 -1
- package/build/modal/Modal.js +5 -22
- package/build/modal/Modal.js.map +1 -1
- package/build/modal/Modal.mjs +5 -22
- package/build/modal/Modal.mjs.map +1 -1
- package/build/moneyInput/MoneyInput.js +2 -19
- package/build/moneyInput/MoneyInput.js.map +1 -1
- package/build/moneyInput/MoneyInput.mjs +2 -19
- package/build/moneyInput/MoneyInput.mjs.map +1 -1
- package/build/navigationOption/NavigationOption.js +1 -19
- package/build/navigationOption/NavigationOption.js.map +1 -1
- package/build/navigationOption/NavigationOption.mjs +1 -19
- package/build/navigationOption/NavigationOption.mjs.map +1 -1
- package/build/nudge/Nudge.js +1 -19
- package/build/nudge/Nudge.js.map +1 -1
- package/build/nudge/Nudge.mjs +1 -19
- package/build/nudge/Nudge.mjs.map +1 -1
- package/build/overlayHeader/OverlayHeader.js +1 -19
- package/build/overlayHeader/OverlayHeader.js.map +1 -1
- package/build/overlayHeader/OverlayHeader.mjs +1 -19
- package/build/overlayHeader/OverlayHeader.mjs.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.js +1 -19
- package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
- package/build/phoneNumberInput/PhoneNumberInput.mjs +1 -19
- package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
- package/build/popover/Popover.js +4 -21
- package/build/popover/Popover.js.map +1 -1
- package/build/popover/Popover.mjs +4 -21
- package/build/popover/Popover.mjs.map +1 -1
- package/build/processIndicator/ProcessIndicator.js +1 -19
- package/build/processIndicator/ProcessIndicator.js.map +1 -1
- package/build/processIndicator/ProcessIndicator.mjs +1 -19
- package/build/processIndicator/ProcessIndicator.mjs.map +1 -1
- package/build/progressBar/ProgressBar.js +1 -19
- package/build/progressBar/ProgressBar.js.map +1 -1
- package/build/progressBar/ProgressBar.mjs +1 -19
- package/build/progressBar/ProgressBar.mjs.map +1 -1
- package/build/promoCard/PromoCard.js +1 -19
- package/build/promoCard/PromoCard.js.map +1 -1
- package/build/promoCard/PromoCard.mjs +1 -19
- package/build/promoCard/PromoCard.mjs.map +1 -1
- package/build/promoCard/PromoCardIndicator.js +1 -19
- package/build/promoCard/PromoCardIndicator.js.map +1 -1
- package/build/promoCard/PromoCardIndicator.mjs +1 -19
- package/build/promoCard/PromoCardIndicator.mjs.map +1 -1
- package/build/provider/Provider.js +1 -20
- package/build/provider/Provider.js.map +1 -1
- package/build/provider/Provider.mjs +1 -20
- package/build/provider/Provider.mjs.map +1 -1
- package/build/radio/Radio.js +1 -19
- package/build/radio/Radio.js.map +1 -1
- package/build/radio/Radio.mjs +1 -19
- package/build/radio/Radio.mjs.map +1 -1
- package/build/segmentedControl/SegmentedControl.js +1 -19
- package/build/segmentedControl/SegmentedControl.js.map +1 -1
- package/build/segmentedControl/SegmentedControl.mjs +1 -19
- package/build/segmentedControl/SegmentedControl.mjs.map +1 -1
- package/build/select/Select.js +3 -23
- package/build/select/Select.js.map +1 -1
- package/build/select/Select.mjs +3 -23
- package/build/select/Select.mjs.map +1 -1
- package/build/select/option/Option.js +1 -19
- package/build/select/option/Option.js.map +1 -1
- package/build/select/option/Option.mjs +1 -19
- package/build/select/option/Option.mjs.map +1 -1
- package/build/selectOption/SelectOption.js +3 -20
- package/build/selectOption/SelectOption.js.map +1 -1
- package/build/selectOption/SelectOption.mjs +3 -20
- package/build/selectOption/SelectOption.mjs.map +1 -1
- package/build/stepper/Stepper.js +2 -21
- package/build/stepper/Stepper.js.map +1 -1
- package/build/stepper/Stepper.mjs +2 -21
- package/build/stepper/Stepper.mjs.map +1 -1
- package/build/sticky/Sticky.js +1 -19
- package/build/sticky/Sticky.js.map +1 -1
- package/build/sticky/Sticky.mjs +1 -19
- package/build/sticky/Sticky.mjs.map +1 -1
- package/build/styles/main.css +6 -0
- package/build/styles/upload/Upload.css +6 -0
- package/build/summary/Summary.js +4 -19
- package/build/summary/Summary.js.map +1 -1
- package/build/summary/Summary.mjs +4 -19
- package/build/summary/Summary.mjs.map +1 -1
- package/build/tabs/Tabs.js +2 -19
- package/build/tabs/Tabs.js.map +1 -1
- package/build/tabs/Tabs.mjs +2 -19
- package/build/tabs/Tabs.mjs.map +1 -1
- package/build/tile/Tile.js +1 -19
- package/build/tile/Tile.js.map +1 -1
- package/build/tile/Tile.mjs +1 -19
- package/build/tile/Tile.mjs.map +1 -1
- package/build/title/Title.js +1 -19
- package/build/title/Title.js.map +1 -1
- package/build/title/Title.mjs +1 -19
- package/build/title/Title.mjs.map +1 -1
- package/build/tooltip/Tooltip.js +1 -19
- package/build/tooltip/Tooltip.js.map +1 -1
- package/build/tooltip/Tooltip.mjs +1 -19
- package/build/tooltip/Tooltip.mjs.map +1 -1
- package/build/typeahead/Typeahead.js +3 -20
- package/build/typeahead/Typeahead.js.map +1 -1
- package/build/typeahead/Typeahead.mjs +3 -20
- package/build/typeahead/Typeahead.mjs.map +1 -1
- package/build/types/common/hooks/index.d.ts +4 -4
- package/build/types/common/hooks/index.d.ts.map +1 -1
- package/build/types/common/hooks/useConditionalListener/index.d.ts +1 -1
- package/build/types/common/hooks/useConditionalListener/index.d.ts.map +1 -1
- package/build/types/common/hooks/useDirection/index.d.ts +1 -1
- package/build/types/common/hooks/useDirection/index.d.ts.map +1 -1
- package/build/types/common/hooks/useHasIntersected/index.d.ts +1 -1
- package/build/types/common/hooks/useHasIntersected/index.d.ts.map +1 -1
- package/build/types/common/hooks/useHasIntersected/useHasIntersected.d.ts +4 -15
- package/build/types/common/hooks/useHasIntersected/useHasIntersected.d.ts.map +1 -1
- package/build/types/common/index.d.ts +24 -24
- package/build/types/common/index.d.ts.map +1 -1
- package/build/types/common/responsivePanel/index.d.ts +1 -1
- package/build/types/common/responsivePanel/index.d.ts.map +1 -1
- package/build/types/upload/steps/uploadImageStep/uploadImageStep.d.ts.map +1 -1
- package/build/types/utilities/deprecatedProperty/deprecatedProperty.d.ts +6 -8
- package/build/types/utilities/deprecatedProperty/deprecatedProperty.d.ts.map +1 -1
- package/build/types/utilities/deprecatedProperty/index.d.ts +1 -1
- package/build/types/utilities/deprecatedProperty/index.d.ts.map +1 -1
- package/build/types/utilities/index.d.ts +2 -2
- package/build/types/utilities/index.d.ts.map +1 -1
- package/build/types/utilities/logActionRequired.d.ts +2 -2
- package/build/types/utilities/logActionRequired.d.ts.map +1 -1
- package/build/upload/Upload.js +1 -19
- package/build/upload/Upload.js.map +1 -1
- package/build/upload/Upload.mjs +1 -19
- package/build/upload/Upload.mjs.map +1 -1
- package/build/upload/steps/processingStep/processingStep.js +2 -19
- package/build/upload/steps/processingStep/processingStep.js.map +1 -1
- package/build/upload/steps/processingStep/processingStep.mjs +2 -19
- package/build/upload/steps/processingStep/processingStep.mjs.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.js +3 -19
- package/build/upload/steps/uploadImageStep/uploadImageStep.js.map +1 -1
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs +3 -19
- package/build/upload/steps/uploadImageStep/uploadImageStep.mjs.map +1 -1
- package/build/uploadInput/UploadInput.js +2 -19
- package/build/uploadInput/UploadInput.js.map +1 -1
- package/build/uploadInput/UploadInput.mjs +2 -19
- package/build/uploadInput/UploadInput.mjs.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.js +1 -19
- package/build/uploadInput/uploadButton/UploadButton.js.map +1 -1
- package/build/uploadInput/uploadButton/UploadButton.mjs +1 -19
- package/build/uploadInput/uploadButton/UploadButton.mjs.map +1 -1
- package/build/uploadInput/uploadButton/defaults.js +0 -18
- package/build/uploadInput/uploadButton/defaults.js.map +1 -1
- package/build/uploadInput/uploadButton/defaults.mjs +0 -18
- package/build/uploadInput/uploadButton/defaults.mjs.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.js +3 -19
- package/build/uploadInput/uploadItem/UploadItem.js.map +1 -1
- package/build/uploadInput/uploadItem/UploadItem.mjs +3 -19
- package/build/uploadInput/uploadItem/UploadItem.mjs.map +1 -1
- package/build/utilities/logActionRequired.js.map +1 -1
- package/build/utilities/logActionRequired.mjs.map +1 -1
- package/build/withDisplayFormat/WithDisplayFormat.js +1 -20
- package/build/withDisplayFormat/WithDisplayFormat.js.map +1 -1
- package/build/withDisplayFormat/WithDisplayFormat.mjs +1 -20
- package/build/withDisplayFormat/WithDisplayFormat.mjs.map +1 -1
- package/package.json +3 -3
- package/src/common/{fakeEvents.ts → fakeEvents.js} +1 -1
- package/src/common/hooks/useHasIntersected/{useHasIntersected.ts → useHasIntersected.js} +11 -17
- package/src/common/{requirements.ts → requirements.js} +36 -106
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.js +85 -0
- package/src/main.css +6 -0
- package/src/upload/Upload.css +6 -0
- package/src/upload/Upload.less +8 -0
- package/src/upload/steps/uploadImageStep/uploadImageStep.tsx +1 -0
- package/src/utilities/deprecatedProperty/{deprecatedProperty.ts → deprecatedProperty.js} +3 -24
- package/src/utilities/{logActionRequired.ts → logActionRequired.js} +2 -2
- package/build/types/common/fakeEvents.d.ts +0 -23
- package/build/types/common/fakeEvents.d.ts.map +0 -1
- package/build/types/common/requirements.d.ts +0 -47
- package/build/types/common/requirements.d.ts.map +0 -1
- package/src/inputWithDisplayFormat/InputWithDisplayFormat.story.tsx +0 -78
- /package/src/common/hooks/{index.ts → index.js} +0 -0
- /package/src/common/hooks/useConditionalListener/{index.ts → index.js} +0 -0
- /package/src/common/hooks/useDirection/{index.ts → index.js} +0 -0
- /package/src/common/hooks/useHasIntersected/{index.ts → index.js} +0 -0
- /package/src/common/{index.ts → index.js} +0 -0
- /package/src/common/responsivePanel/{index.ts → index.js} +0 -0
- /package/src/utilities/deprecatedProperty/{index.ts → index.js} +0 -0
- /package/src/utilities/{index.ts → index.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
|
-
const ObserverParams
|
|
3
|
+
const ObserverParams = {
|
|
4
4
|
threshold: 0.1,
|
|
5
5
|
};
|
|
6
6
|
|
|
@@ -9,19 +9,13 @@ const ObserverParams: IntersectionObserverInit = {
|
|
|
9
9
|
* Use this custom hook to detect when an element has became visible inside the viewport. This hook checks only if the intersection happend.
|
|
10
10
|
* Once the intersection has happened the hook will not return false even if the element gets out of the viewport.
|
|
11
11
|
*
|
|
12
|
-
* @param
|
|
13
|
-
* @param {object} [
|
|
14
|
-
* @param {
|
|
12
|
+
* @param elRef.elRef
|
|
13
|
+
* @param {object} [elRef] - node object that contains a react reference to the element that needs to be observed.
|
|
14
|
+
* @param {strimng} [loading = 'eager'] - string that contains the type of loading.
|
|
15
15
|
* @param elRef.loading
|
|
16
16
|
* @usage `const [hasIntersected] = useHasIntersected({imageRef,loading});`
|
|
17
17
|
*/
|
|
18
|
-
export const useHasIntersected = ({
|
|
19
|
-
elRef,
|
|
20
|
-
loading = 'eager',
|
|
21
|
-
}: {
|
|
22
|
-
elRef: React.RefObject<HTMLElement>;
|
|
23
|
-
loading?: 'eager' | 'lazy';
|
|
24
|
-
}) => {
|
|
18
|
+
export const useHasIntersected = ({ elRef, loading }) => {
|
|
25
19
|
const [hasIntersected, setHasIntersected] = useState(false);
|
|
26
20
|
|
|
27
21
|
const { current } = elRef || {};
|
|
@@ -30,29 +24,29 @@ export const useHasIntersected = ({
|
|
|
30
24
|
return elRef && current;
|
|
31
25
|
};
|
|
32
26
|
|
|
33
|
-
const handleOnIntersect
|
|
27
|
+
const handleOnIntersect = (entries, observer) => {
|
|
34
28
|
entries.forEach((entry) => {
|
|
35
29
|
if (entry.isIntersecting) {
|
|
36
30
|
setHasIntersected(true);
|
|
37
|
-
observer.unobserve(current
|
|
31
|
+
observer.unobserve(current);
|
|
38
32
|
}
|
|
39
33
|
});
|
|
40
34
|
};
|
|
41
35
|
|
|
42
36
|
useEffect(() => {
|
|
43
|
-
let observer
|
|
37
|
+
let observer;
|
|
44
38
|
let didCancel = false;
|
|
45
39
|
|
|
46
|
-
// Check if window is
|
|
40
|
+
// Check if window is define for SSR and Old browsers fallback
|
|
47
41
|
if (typeof window === 'undefined' || !window.IntersectionObserver || !isValidReference()) {
|
|
48
42
|
setHasIntersected(true);
|
|
49
|
-
} else if (
|
|
43
|
+
} else if (!didCancel) {
|
|
50
44
|
observer = new IntersectionObserver(handleOnIntersect, ObserverParams);
|
|
51
45
|
observer.observe(current);
|
|
52
46
|
}
|
|
53
47
|
return () => {
|
|
54
48
|
didCancel = true;
|
|
55
|
-
if (observer
|
|
49
|
+
if (observer) {
|
|
56
50
|
observer.unobserve(current);
|
|
57
51
|
}
|
|
58
52
|
};
|
|
@@ -1,67 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-unused-vars */
|
|
2
2
|
/* eslint-disable no-param-reassign */
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type ValidationMessages = Record<string, string>;
|
|
7
|
-
|
|
8
|
-
type Value = {
|
|
9
|
-
label?: string;
|
|
10
|
-
title?: string;
|
|
11
|
-
name?: string;
|
|
12
|
-
value?: PrimitiveType;
|
|
13
|
-
code?: string | number;
|
|
14
|
-
key?: PrimitiveType;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
type Field = {
|
|
18
|
-
name?: string;
|
|
19
|
-
title?: string;
|
|
20
|
-
type?: string;
|
|
21
|
-
control?: string;
|
|
22
|
-
format?: string;
|
|
23
|
-
pattern?: string;
|
|
24
|
-
minimum?: number;
|
|
25
|
-
maximum?: number;
|
|
26
|
-
max?: number;
|
|
27
|
-
min?: number;
|
|
28
|
-
width?: string;
|
|
29
|
-
example?: string;
|
|
30
|
-
placeholder?: string;
|
|
31
|
-
info?: string;
|
|
32
|
-
tooltip?: string;
|
|
33
|
-
help?: { message: string };
|
|
34
|
-
valuesAllowed?: Value[];
|
|
35
|
-
values?: Value[];
|
|
36
|
-
default?: Value;
|
|
37
|
-
value?: Value;
|
|
38
|
-
validationMessages?: ValidationMessages;
|
|
39
|
-
validationRegexp?: string;
|
|
40
|
-
properties: Record<string, Field>;
|
|
41
|
-
hidden?: boolean;
|
|
42
|
-
key?: string;
|
|
43
|
-
fields?: Field[];
|
|
44
|
-
groups?: Field[];
|
|
45
|
-
[otherKey: string]: any; // For additional fields
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
type FieldMapType = Record<string, Field>;
|
|
49
|
-
|
|
50
|
-
type Alternative = {
|
|
51
|
-
title?: string;
|
|
52
|
-
label?: string;
|
|
53
|
-
type?: string;
|
|
54
|
-
types: string[];
|
|
55
|
-
name?: string;
|
|
56
|
-
description?: string;
|
|
57
|
-
tooltip?: string;
|
|
58
|
-
fields?: Field[];
|
|
59
|
-
fieldGroups?: Field[];
|
|
60
|
-
properties?: Record<string, any>;
|
|
61
|
-
prepared?: boolean;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const prepRequirements = (alternatives: Alternative[]) => {
|
|
4
|
+
const prepRequirements = (alternatives) => {
|
|
65
5
|
if (!alternatives || alternatives.length === 0) {
|
|
66
6
|
return [];
|
|
67
7
|
}
|
|
@@ -75,8 +15,7 @@ const prepRequirements = (alternatives: Alternative[]) => {
|
|
|
75
15
|
|
|
76
16
|
prepLegacyAlternatives(alternative);
|
|
77
17
|
|
|
78
|
-
|
|
79
|
-
alternative.properties = prepFields(fieldsToPrep) || alternative.properties;
|
|
18
|
+
alternative.properties = prepFields(alternative.properties || alternative.fields);
|
|
80
19
|
|
|
81
20
|
// If we're still treating type as a special case, move it to a hidden value
|
|
82
21
|
if (alternative.type && alternative.type !== 'object' && !alternative.types) {
|
|
@@ -96,14 +35,16 @@ const prepRequirements = (alternatives: Alternative[]) => {
|
|
|
96
35
|
return preppedAlternatives;
|
|
97
36
|
};
|
|
98
37
|
|
|
99
|
-
const prepFields = (fields
|
|
38
|
+
const prepFields = (fields, model, validationMessages) => {
|
|
100
39
|
if (!fields) {
|
|
101
40
|
return {};
|
|
102
41
|
}
|
|
103
42
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
);
|
|
43
|
+
let preparedFields = copyOf(fields);
|
|
44
|
+
|
|
45
|
+
preparedFields = flattenFieldsWithGroups(preparedFields);
|
|
46
|
+
preparedFields = transformFieldArrayToMap(preparedFields);
|
|
47
|
+
preparedFields = transformNestedKeysToNestedSpecs(preparedFields);
|
|
107
48
|
|
|
108
49
|
Object.keys(preparedFields).forEach((key) => {
|
|
109
50
|
preparedFields[key] = prepField(preparedFields[key], model, validationMessages);
|
|
@@ -112,7 +53,7 @@ const prepFields = (fields: Field[], model?: any, validationMessages?: any): Fie
|
|
|
112
53
|
return preparedFields;
|
|
113
54
|
};
|
|
114
55
|
|
|
115
|
-
const prepField = (field
|
|
56
|
+
const prepField = (field, model, validationMessages) => {
|
|
116
57
|
const preparedField = copyOf(field);
|
|
117
58
|
|
|
118
59
|
prepLegacyProps(preparedField);
|
|
@@ -130,10 +71,9 @@ const prepField = (field: Field, model: unknown, validationMessages: ValidationM
|
|
|
130
71
|
*
|
|
131
72
|
* @param fields
|
|
132
73
|
*/
|
|
133
|
-
const flattenFieldsWithGroups = (fields
|
|
74
|
+
const flattenFieldsWithGroups = (fields) => {
|
|
134
75
|
if (Array.isArray(fields)) {
|
|
135
|
-
let flattenedFields
|
|
136
|
-
|
|
76
|
+
let flattenedFields = [];
|
|
137
77
|
fields.forEach((field) => {
|
|
138
78
|
// If we've been given a group with nested fields, break them out.
|
|
139
79
|
if (field.fields) {
|
|
@@ -147,11 +87,10 @@ const flattenFieldsWithGroups = (fields?: Field[]): Field[] => {
|
|
|
147
87
|
});
|
|
148
88
|
return flattenedFields;
|
|
149
89
|
}
|
|
150
|
-
|
|
151
|
-
return fields || [];
|
|
90
|
+
return fields;
|
|
152
91
|
};
|
|
153
92
|
|
|
154
|
-
const flattenFieldWithGroup = (field
|
|
93
|
+
const flattenFieldWithGroup = (field, subFields) => {
|
|
155
94
|
// If first field doesn't have a label, use the one from the group
|
|
156
95
|
if (field.name && subFields.length > 0 && !subFields[0].name) {
|
|
157
96
|
subFields[0].name = field.name;
|
|
@@ -190,26 +129,18 @@ const flattenFieldWithGroup = (field: Field, subFields: Field[]): Field[] => {
|
|
|
190
129
|
* Some older requirements return an array of fields, where it should be a map
|
|
191
130
|
* from the property name to the spec. This converts arrays to maps.
|
|
192
131
|
*/
|
|
193
|
-
const transformFieldArrayToMap = (fields
|
|
132
|
+
const transformFieldArrayToMap = (fields) => {
|
|
194
133
|
if (Array.isArray(fields)) {
|
|
195
|
-
const fieldMap
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
if ('key' in field) {
|
|
201
|
-
delete field.key;
|
|
202
|
-
}
|
|
134
|
+
const fieldMap = {};
|
|
135
|
+
fields.forEach((field) => {
|
|
136
|
+
const key = field.key || field.name;
|
|
137
|
+
delete field.key;
|
|
203
138
|
|
|
204
|
-
|
|
205
|
-
fieldMap[newKey] = copyOf(field);
|
|
206
|
-
}
|
|
139
|
+
fieldMap[key] = copyOf(field);
|
|
207
140
|
});
|
|
208
|
-
|
|
209
141
|
return fieldMap;
|
|
210
142
|
}
|
|
211
|
-
|
|
212
|
-
return fields ?? {};
|
|
143
|
+
return fields;
|
|
213
144
|
};
|
|
214
145
|
|
|
215
146
|
/*
|
|
@@ -218,13 +149,12 @@ const transformFieldArrayToMap = (fields?: Field[]): FieldMapType => {
|
|
|
218
149
|
* type 'object', and nests such fields inside of it. When we render we pass
|
|
219
150
|
* this object spec to a nested fieldset.
|
|
220
151
|
*/
|
|
221
|
-
const transformNestedKeysToNestedSpecs = (fieldMap
|
|
152
|
+
const transformNestedKeysToNestedSpecs = (fieldMap) => {
|
|
222
153
|
if (Array.isArray(fieldMap)) {
|
|
223
154
|
throw new TypeError('Expecting a map of fields, not an array');
|
|
224
155
|
}
|
|
225
156
|
|
|
226
|
-
const nestedFields
|
|
227
|
-
|
|
157
|
+
const nestedFields = {};
|
|
228
158
|
Object.keys(fieldMap).forEach((key) => {
|
|
229
159
|
if (key.indexOf('.') > 0) {
|
|
230
160
|
// If the key contains a period we need to nest the fields in another object
|
|
@@ -246,8 +176,8 @@ const transformNestedKeysToNestedSpecs = (fieldMap: FieldMapType): Record<string
|
|
|
246
176
|
return nestedFields;
|
|
247
177
|
};
|
|
248
178
|
|
|
249
|
-
const prepType = (field
|
|
250
|
-
const type = field.type
|
|
179
|
+
const prepType = (field) => {
|
|
180
|
+
const type = field.type && field.type.toLowerCase && field.type.toLowerCase();
|
|
251
181
|
|
|
252
182
|
switch (type) {
|
|
253
183
|
case 'text':
|
|
@@ -294,7 +224,7 @@ const prepType = (field: Field) => {
|
|
|
294
224
|
}
|
|
295
225
|
};
|
|
296
226
|
|
|
297
|
-
const prepLegacyAlternatives = (alternative
|
|
227
|
+
const prepLegacyAlternatives = (alternative) => {
|
|
298
228
|
if (!alternative.title && alternative.label) {
|
|
299
229
|
alternative.title = alternative.label;
|
|
300
230
|
}
|
|
@@ -313,7 +243,7 @@ const prepLegacyAlternatives = (alternative: Alternative) => {
|
|
|
313
243
|
}
|
|
314
244
|
};
|
|
315
245
|
|
|
316
|
-
const prepLegacyProps = (field
|
|
246
|
+
const prepLegacyProps = (field) => {
|
|
317
247
|
if (field.name && !field.title) {
|
|
318
248
|
field.title = field.name;
|
|
319
249
|
delete field.name;
|
|
@@ -349,7 +279,7 @@ const prepLegacyProps = (field: Field) => {
|
|
|
349
279
|
delete field.valuesAllowed;
|
|
350
280
|
}
|
|
351
281
|
|
|
352
|
-
if (field.values &&
|
|
282
|
+
if (field.values && field.values.map) {
|
|
353
283
|
field.values = prepLegacyValues(field.values);
|
|
354
284
|
}
|
|
355
285
|
|
|
@@ -374,9 +304,9 @@ const prepLegacyProps = (field: Field) => {
|
|
|
374
304
|
}
|
|
375
305
|
};
|
|
376
306
|
|
|
377
|
-
const prepLegacyValues = (values
|
|
307
|
+
const prepLegacyValues = (values) => values.map(prepLegacyValue);
|
|
378
308
|
|
|
379
|
-
const prepLegacyValue = (value
|
|
309
|
+
const prepLegacyValue = (value) => {
|
|
380
310
|
if (!value.label && value.title) {
|
|
381
311
|
value.label = value.title;
|
|
382
312
|
delete value.title;
|
|
@@ -398,7 +328,7 @@ const prepLegacyValue = (value: Value) => {
|
|
|
398
328
|
return value;
|
|
399
329
|
};
|
|
400
330
|
|
|
401
|
-
const prepPattern = (field
|
|
331
|
+
const prepPattern = (field) => {
|
|
402
332
|
if (field.pattern) {
|
|
403
333
|
try {
|
|
404
334
|
new RegExp(field.pattern);
|
|
@@ -412,7 +342,7 @@ const prepPattern = (field: Field) => {
|
|
|
412
342
|
}
|
|
413
343
|
};
|
|
414
344
|
|
|
415
|
-
const prepValidationMessages = (field
|
|
345
|
+
const prepValidationMessages = (field, validationMessages) => {
|
|
416
346
|
field.validationMessages = field.validationMessages
|
|
417
347
|
? field.validationMessages
|
|
418
348
|
: validationMessages;
|
|
@@ -432,7 +362,7 @@ const prepValidationMessages = (field: Field, validationMessages?: ValidationMes
|
|
|
432
362
|
}
|
|
433
363
|
};
|
|
434
364
|
|
|
435
|
-
const getControlType = (field
|
|
365
|
+
const getControlType = (field) => {
|
|
436
366
|
if (field.control) {
|
|
437
367
|
return field.control.toLowerCase();
|
|
438
368
|
}
|
|
@@ -456,7 +386,7 @@ const getControlType = (field: Field) => {
|
|
|
456
386
|
}
|
|
457
387
|
};
|
|
458
388
|
|
|
459
|
-
const getControlForStringFormat = (format
|
|
389
|
+
const getControlForStringFormat = (format) => {
|
|
460
390
|
switch (format) {
|
|
461
391
|
case 'date':
|
|
462
392
|
return 'date';
|
|
@@ -475,7 +405,7 @@ const getControlForStringFormat = (format?: string) => {
|
|
|
475
405
|
}
|
|
476
406
|
};
|
|
477
407
|
|
|
478
|
-
const getSelectionType = (field
|
|
408
|
+
const getSelectionType = (field) => {
|
|
479
409
|
if (field.control) {
|
|
480
410
|
return field.control;
|
|
481
411
|
}
|
|
@@ -492,14 +422,14 @@ const getSelectionType = (field: Field) => {
|
|
|
492
422
|
return 'select';
|
|
493
423
|
};
|
|
494
424
|
|
|
495
|
-
const copyOf =
|
|
425
|
+
const copyOf = (object) => JSON.parse(JSON.stringify(object));
|
|
496
426
|
|
|
497
427
|
/**
|
|
498
428
|
* Some older requirments formats do not include a label for alternatives
|
|
499
429
|
*
|
|
500
430
|
* @param tabType
|
|
501
431
|
*/
|
|
502
|
-
const getNameFromType = (tabType
|
|
432
|
+
const getNameFromType = (tabType) => {
|
|
503
433
|
if (tabType && tabType.length > 0) {
|
|
504
434
|
const tabNameWithSpaces = tabType.toLowerCase().split('_').join(' '); // String.replace method only replaces first instance
|
|
505
435
|
return tabNameWithSpaces.charAt(0).toUpperCase() + tabNameWithSpaces.slice(1);
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { text } from '@storybook/addon-knobs';
|
|
2
|
+
import { userEvent, within } from '@storybook/test';
|
|
3
|
+
|
|
4
|
+
import InputWithDisplayFormat from '.';
|
|
5
|
+
import { Field } from '../field/Field';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
component: InputWithDisplayFormat,
|
|
9
|
+
title: 'Forms/InputWithDisplayFormat',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Basic = () => {
|
|
13
|
+
const placeholder = text('Placeholder', '**-**-**');
|
|
14
|
+
const displayPattern = text('DisplayPattern', '**-**-**');
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<Field label="Display pattern is controlled via knobs" id="Basic">
|
|
18
|
+
<InputWithDisplayFormat
|
|
19
|
+
id="Basic"
|
|
20
|
+
placeholder={placeholder}
|
|
21
|
+
displayPattern={displayPattern}
|
|
22
|
+
className="form-control"
|
|
23
|
+
onChange={(v) => console.log(v)}
|
|
24
|
+
onBlur={(v) => console.log(v)}
|
|
25
|
+
onFocus={(v) => console.log(v)}
|
|
26
|
+
/>
|
|
27
|
+
</Field>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const Template = (args) => {
|
|
32
|
+
const placeholder = args.pattern;
|
|
33
|
+
const displayPattern = args.pattern;
|
|
34
|
+
const label = args.label;
|
|
35
|
+
const id = label.replaceAll(' ', '-').toLowerCase();
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<Field label={label} id={id}>
|
|
39
|
+
<InputWithDisplayFormat
|
|
40
|
+
id={id}
|
|
41
|
+
placeholder={placeholder}
|
|
42
|
+
displayPattern={displayPattern}
|
|
43
|
+
className="form-control"
|
|
44
|
+
onChange={(v) => console.log(v)}
|
|
45
|
+
onBlur={(v) => console.log(v)}
|
|
46
|
+
onFocus={(v) => console.log(v)}
|
|
47
|
+
/>
|
|
48
|
+
</Field>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const CardNumber = Template.bind({});
|
|
53
|
+
CardNumber.args = {
|
|
54
|
+
label: 'Card Number',
|
|
55
|
+
pattern: '**** **** **** **** ***',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const CVC = Template.bind({});
|
|
59
|
+
CVC.args = {
|
|
60
|
+
label: 'CVC',
|
|
61
|
+
pattern: '***',
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const ExpiryDate = Template.bind({});
|
|
65
|
+
ExpiryDate.args = {
|
|
66
|
+
label: 'Expiry Date',
|
|
67
|
+
pattern: '** / **',
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const SecurityPin = Template.bind({});
|
|
71
|
+
SecurityPin.args = {
|
|
72
|
+
label: 'Security Pin',
|
|
73
|
+
pattern: '*-*-*-*-*-*',
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const SecurityPinPlay = Template.bind({});
|
|
77
|
+
SecurityPinPlay.args = {
|
|
78
|
+
label: 'Security Pin',
|
|
79
|
+
pattern: '*-*-*-*-*-*',
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
SecurityPinPlay.play = async ({ canvasElement }) => {
|
|
83
|
+
const canvas = within(canvasElement);
|
|
84
|
+
await userEvent.type(canvas.getByPlaceholderText('*-*-*-*-*-*'), '123456');
|
|
85
|
+
};
|
package/src/main.css
CHANGED
|
@@ -5449,6 +5449,12 @@ html:not([dir="rtl"]) .np-navigation-option {
|
|
|
5449
5449
|
.tw-droppable-sm {
|
|
5450
5450
|
min-height: 245px;
|
|
5451
5451
|
}
|
|
5452
|
+
.tw-droppable-lg .btn:focus-visible,
|
|
5453
|
+
.tw-droppable-md .btn:focus-visible,
|
|
5454
|
+
.tw-droppable-sm .btn:focus-visible {
|
|
5455
|
+
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
5456
|
+
outline-offset: var(--ring-outline-offset);
|
|
5457
|
+
}
|
|
5452
5458
|
.upload-error-message {
|
|
5453
5459
|
margin-top: 24px;
|
|
5454
5460
|
margin-top: var(--padding-medium);
|
package/src/upload/Upload.css
CHANGED
|
@@ -13,6 +13,12 @@
|
|
|
13
13
|
.tw-droppable-sm {
|
|
14
14
|
min-height: 245px;
|
|
15
15
|
}
|
|
16
|
+
.tw-droppable-lg .btn:focus-visible,
|
|
17
|
+
.tw-droppable-md .btn:focus-visible,
|
|
18
|
+
.tw-droppable-sm .btn:focus-visible {
|
|
19
|
+
outline: var(--ring-outline-color) solid var(--ring-outline-width);
|
|
20
|
+
outline-offset: var(--ring-outline-offset);
|
|
21
|
+
}
|
|
16
22
|
.upload-error-message {
|
|
17
23
|
margin-top: 24px;
|
|
18
24
|
margin-top: var(--padding-medium);
|
package/src/upload/Upload.less
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@import (reference) "../../node_modules/@transferwise/neptune-css/src/less/ring.less";
|
|
2
|
+
|
|
1
3
|
// This css is a quick workaround on the height of the upload container collapsing if UploadImageStep is
|
|
2
4
|
// not rendered.
|
|
3
5
|
.tw-droppable-lg {
|
|
@@ -20,6 +22,12 @@
|
|
|
20
22
|
min-height: 245px;
|
|
21
23
|
}
|
|
22
24
|
|
|
25
|
+
.tw-droppable-lg, .tw-droppable-md, .tw-droppable-sm {
|
|
26
|
+
.btn:focus-visible {
|
|
27
|
+
.ring();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
.upload-error-message {
|
|
24
32
|
margin-top: var(--padding-medium);
|
|
25
33
|
border-top: 1px solid var(--color-border-neutral);
|
|
@@ -68,6 +68,7 @@ export default class UploadImageStep extends PureComponent<UploadImageStepProps>
|
|
|
68
68
|
className={`btn btn-primary btn-md ${usDisabled ? 'disabled' : ''}`}
|
|
69
69
|
role="button"
|
|
70
70
|
aria-disabled={usDisabled}
|
|
71
|
+
tabIndex={0}
|
|
71
72
|
>
|
|
72
73
|
{usButtonText ? (
|
|
73
74
|
<span>{usButtonText}</span>
|
|
@@ -1,22 +1,6 @@
|
|
|
1
1
|
import { logActionRequired } from '../logActionRequired';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
component: string;
|
|
5
|
-
propName: string;
|
|
6
|
-
message: string;
|
|
7
|
-
expiryDate?: Date;
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
type ValidatorType = (props: Record<string, any>, propName: string, ...rest: any[]) => Error | null;
|
|
11
|
-
|
|
12
|
-
type DeprecatedOptionsType = {
|
|
13
|
-
component: string;
|
|
14
|
-
message?: string;
|
|
15
|
-
newProp?: string | null;
|
|
16
|
-
expiryDate?: Date;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const deprecatedMessage = ({ component, propName, message, expiryDate }: DeprecatedMessageType) => {
|
|
3
|
+
const deprecatedMessage = ({ component, propName, message, expiryDate }) => {
|
|
20
4
|
const messages = [`${component} has deprecated the use of ${propName}.`];
|
|
21
5
|
|
|
22
6
|
if (message) {
|
|
@@ -37,11 +21,8 @@ const deprecatedMessage = ({ component, propName, message, expiryDate }: Depreca
|
|
|
37
21
|
};
|
|
38
22
|
|
|
39
23
|
const deprecated =
|
|
40
|
-
(
|
|
41
|
-
|
|
42
|
-
{ component, message = '', newProp: newProperty = null, expiryDate }: DeprecatedOptionsType,
|
|
43
|
-
) =>
|
|
44
|
-
(props: Record<string, any>, propertyName: string, ...rest: any[]) => {
|
|
24
|
+
(validator, { component, message = '', newProp: newProperty = null, expiryDate = null }) =>
|
|
25
|
+
(props, propertyName, ...rest) => {
|
|
45
26
|
const newPropertyMessage = newProperty ? `Please use ${newProperty} instead.` : message;
|
|
46
27
|
|
|
47
28
|
if (props[propertyName] != null && typeof props[propertyName] !== 'undefined') {
|
|
@@ -54,8 +35,6 @@ const deprecated =
|
|
|
54
35
|
}),
|
|
55
36
|
);
|
|
56
37
|
}
|
|
57
|
-
|
|
58
|
-
// Fix: include `componentName` when calling the validator
|
|
59
38
|
return validator(props, propertyName, ...rest);
|
|
60
39
|
};
|
|
61
40
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export function logActionRequired(message
|
|
1
|
+
export function logActionRequired(message) {
|
|
2
2
|
if (typeof process !== 'undefined' && process.env?.NODE_ENV !== 'production') {
|
|
3
3
|
// eslint-disable-next-line no-console
|
|
4
4
|
console.warn(message);
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
export function logActionRequiredIf(message
|
|
8
|
+
export function logActionRequiredIf(message, conditional) {
|
|
9
9
|
if (conditional) {
|
|
10
10
|
logActionRequired(message);
|
|
11
11
|
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export declare const fakeEvent: () => {
|
|
2
|
-
nativeEvent: {
|
|
3
|
-
stopImmediatePropagation(): void;
|
|
4
|
-
};
|
|
5
|
-
stopPropagation(): void;
|
|
6
|
-
preventDefault(): void;
|
|
7
|
-
};
|
|
8
|
-
export declare const fakeKeyDownEventForKey: (key: string) => {
|
|
9
|
-
key: string;
|
|
10
|
-
nativeEvent: {
|
|
11
|
-
stopImmediatePropagation(): void;
|
|
12
|
-
};
|
|
13
|
-
stopPropagation(): void;
|
|
14
|
-
preventDefault(): void;
|
|
15
|
-
};
|
|
16
|
-
export declare const fakeKeyDownEvent: (eventAttribute?: {}) => {
|
|
17
|
-
nativeEvent: {
|
|
18
|
-
stopImmediatePropagation(): void;
|
|
19
|
-
};
|
|
20
|
-
stopPropagation(): void;
|
|
21
|
-
preventDefault(): void;
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=fakeEvents.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fakeEvents.d.ts","sourceRoot":"","sources":["../../../src/common/fakeEvents.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;CAIpB,CAAC;AAEH,eAAO,MAAM,sBAAsB,QAAS,MAAM;;;;;;;CAGhD,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;CAG3B,CAAC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { PrimitiveType } from 'react-intl';
|
|
2
|
-
type ValidationMessages = Record<string, string>;
|
|
3
|
-
type Value = {
|
|
4
|
-
label?: string;
|
|
5
|
-
title?: string;
|
|
6
|
-
name?: string;
|
|
7
|
-
value?: PrimitiveType;
|
|
8
|
-
code?: string | number;
|
|
9
|
-
key?: PrimitiveType;
|
|
10
|
-
};
|
|
11
|
-
type Field = {
|
|
12
|
-
name?: string;
|
|
13
|
-
title?: string;
|
|
14
|
-
type?: string;
|
|
15
|
-
control?: string;
|
|
16
|
-
format?: string;
|
|
17
|
-
pattern?: string;
|
|
18
|
-
minimum?: number;
|
|
19
|
-
maximum?: number;
|
|
20
|
-
max?: number;
|
|
21
|
-
min?: number;
|
|
22
|
-
width?: string;
|
|
23
|
-
example?: string;
|
|
24
|
-
placeholder?: string;
|
|
25
|
-
info?: string;
|
|
26
|
-
tooltip?: string;
|
|
27
|
-
help?: {
|
|
28
|
-
message: string;
|
|
29
|
-
};
|
|
30
|
-
valuesAllowed?: Value[];
|
|
31
|
-
values?: Value[];
|
|
32
|
-
default?: Value;
|
|
33
|
-
value?: Value;
|
|
34
|
-
validationMessages?: ValidationMessages;
|
|
35
|
-
validationRegexp?: string;
|
|
36
|
-
properties: Record<string, Field>;
|
|
37
|
-
hidden?: boolean;
|
|
38
|
-
key?: string;
|
|
39
|
-
fields?: Field[];
|
|
40
|
-
groups?: Field[];
|
|
41
|
-
[otherKey: string]: any;
|
|
42
|
-
};
|
|
43
|
-
type FieldMapType = Record<string, Field>;
|
|
44
|
-
declare const prepFields: (fields: Field[], model?: any, validationMessages?: any) => FieldMapType;
|
|
45
|
-
declare const getControlType: (field: Field) => string;
|
|
46
|
-
export { prepFields, getControlType };
|
|
47
|
-
//# sourceMappingURL=requirements.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"requirements.d.ts","sourceRoot":"","sources":["../../../src/common/requirements.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,KAAK,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjD,KAAK,KAAK,GAAG;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,GAAG,CAAC,EAAE,aAAa,CAAC;CACrB,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3B,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAClC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACjB,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;IACjB,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC;CACzB,CAAC;AAEF,KAAK,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAmD1C,QAAA,MAAM,UAAU,WAAY,KAAK,EAAE,UAAU,GAAG,uBAAuB,GAAG,KAAG,YAc5E,CAAC;AAkUF,QAAA,MAAM,cAAc,UAAW,KAAK,WAsBnC,CAAC;AAqDF,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC"}
|