@ohos-ports/sprucelabs-react-heartwood-components 9.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +59 -0
- package/lib/__mocks__/stubs/events.js +166 -0
- package/lib/__mocks__/stubs/events.js.map +1 -0
- package/lib/__mocks__/stubs/location.js +34 -0
- package/lib/__mocks__/stubs/location.js.map +1 -0
- package/lib/__mocks__/stubs/users.js +225 -0
- package/lib/__mocks__/stubs/users.js.map +1 -0
- package/lib/__tests__/components/Pagination/Pagination.test.js +127 -0
- package/lib/__tests__/components/Pagination/Pagination.test.js.map +1 -0
- package/lib/components/Avatar/Avatar-story.js +34 -0
- package/lib/components/Avatar/Avatar-story.js.map +1 -0
- package/lib/components/Avatar/Avatar.d.ts +40 -0
- package/lib/components/Avatar/Avatar.d.ts.map +1 -0
- package/lib/components/Avatar/Avatar.js +91 -0
- package/lib/components/Avatar/Avatar.js.map +1 -0
- package/lib/components/Avatar/UserAvatar.js +45 -0
- package/lib/components/Avatar/UserAvatar.js.map +1 -0
- package/lib/components/BotText/BotText-story.d.ts +2 -0
- package/lib/components/BotText/BotText-story.d.ts.map +1 -0
- package/lib/components/BotText/BotText-story.js +21 -0
- package/lib/components/BotText/BotText-story.js.map +1 -0
- package/lib/components/BotText/BotText.d.ts +12 -0
- package/lib/components/BotText/BotText.d.ts.map +1 -0
- package/lib/components/BotText/BotText.js +52 -0
- package/lib/components/BotText/BotText.js.map +1 -0
- package/lib/components/Button/Button-story.js +109 -0
- package/lib/components/Button/Button-story.js.map +1 -0
- package/lib/components/Button/Button.d.ts +47 -0
- package/lib/components/Button/Button.d.ts.map +1 -0
- package/lib/components/Button/Button.js +155 -0
- package/lib/components/Button/Button.js.map +1 -0
- package/lib/components/ButtonGroup/ButtonGroup-story.js +27 -0
- package/lib/components/ButtonGroup/ButtonGroup-story.js.map +1 -0
- package/lib/components/ButtonGroup/ButtonGroup.d.ts +19 -0
- package/lib/components/ButtonGroup/ButtonGroup.d.ts.map +1 -0
- package/lib/components/ButtonGroup/ButtonGroup.js +64 -0
- package/lib/components/ButtonGroup/ButtonGroup.js.map +1 -0
- package/lib/components/Card/Card-story.d.ts +2 -0
- package/lib/components/Card/Card-story.d.ts.map +1 -0
- package/lib/components/Card/Card-story.js +389 -0
- package/lib/components/Card/Card-story.js.map +1 -0
- package/lib/components/Card/Card.d.ts +69 -0
- package/lib/components/Card/Card.d.ts.map +1 -0
- package/lib/components/Card/Card.js +113 -0
- package/lib/components/Card/Card.js.map +1 -0
- package/lib/components/Card/components/CardBody.d.ts +27 -0
- package/lib/components/Card/components/CardBody.d.ts.map +1 -0
- package/lib/components/Card/components/CardBody.js +45 -0
- package/lib/components/Card/components/CardBody.js.map +1 -0
- package/lib/components/Card/components/CardBuilder.d.ts +50 -0
- package/lib/components/Card/components/CardBuilder.d.ts.map +1 -0
- package/lib/components/Card/components/CardBuilder.js +139 -0
- package/lib/components/Card/components/CardBuilder.js.map +1 -0
- package/lib/components/Card/components/CardFooter.d.ts +11 -0
- package/lib/components/Card/components/CardFooter.d.ts.map +1 -0
- package/lib/components/Card/components/CardFooter.js +22 -0
- package/lib/components/Card/components/CardFooter.js.map +1 -0
- package/lib/components/Card/components/CardHeader.d.ts +28 -0
- package/lib/components/Card/components/CardHeader.d.ts.map +1 -0
- package/lib/components/Card/components/CardHeader.js +70 -0
- package/lib/components/Card/components/CardHeader.js.map +1 -0
- package/lib/components/Card/components/CardSection.d.ts +10 -0
- package/lib/components/Card/components/CardSection.d.ts.map +1 -0
- package/lib/components/Card/components/CardSection.js +27 -0
- package/lib/components/Card/components/CardSection.js.map +1 -0
- package/lib/components/Card/components/OnboardingCard.d.ts +27 -0
- package/lib/components/Card/components/OnboardingCard.d.ts.map +1 -0
- package/lib/components/Card/components/OnboardingCard.js +129 -0
- package/lib/components/Card/components/OnboardingCard.js.map +1 -0
- package/lib/components/Card/components/Scores.d.ts +15 -0
- package/lib/components/Card/components/Scores.d.ts.map +1 -0
- package/lib/components/Card/components/Scores.js +39 -0
- package/lib/components/Card/components/Scores.js.map +1 -0
- package/lib/components/Card/index.d.ts +11 -0
- package/lib/components/Card/index.d.ts.map +1 -0
- package/lib/components/Card/index.js +120 -0
- package/lib/components/Card/index.js.map +1 -0
- package/lib/components/CircleLoader/CircleLoader-story.d.ts +2 -0
- package/lib/components/CircleLoader/CircleLoader-story.d.ts.map +1 -0
- package/lib/components/CircleLoader/CircleLoader-story.js +20 -0
- package/lib/components/CircleLoader/CircleLoader-story.js.map +1 -0
- package/lib/components/CircleLoader/CircleLoader.d.ts +13 -0
- package/lib/components/CircleLoader/CircleLoader.d.ts.map +1 -0
- package/lib/components/CircleLoader/CircleLoader.js +28 -0
- package/lib/components/CircleLoader/CircleLoader.js.map +1 -0
- package/lib/components/ContextMenu/ContextMenu-story.js +31 -0
- package/lib/components/ContextMenu/ContextMenu-story.js.map +1 -0
- package/lib/components/ContextMenu/ContextMenu.d.ts +70 -0
- package/lib/components/ContextMenu/ContextMenu.d.ts.map +1 -0
- package/lib/components/ContextMenu/ContextMenu.js +315 -0
- package/lib/components/ContextMenu/ContextMenu.js.map +1 -0
- package/lib/components/Core/components/FeedBuilder/FeedBuilder-story.js +101 -0
- package/lib/components/Core/components/FeedBuilder/FeedBuilder-story.js.map +1 -0
- package/lib/components/Core/components/FeedBuilder/FeedBuilder.js +290 -0
- package/lib/components/Core/components/FeedBuilder/FeedBuilder.js.map +1 -0
- package/lib/components/Core/components/FooterPrimary/FooterPrimary.js +20 -0
- package/lib/components/Core/components/FooterPrimary/FooterPrimary.js.map +1 -0
- package/lib/components/Core/components/FooterPrimary/components/HelpButton/HelpButton.js +52 -0
- package/lib/components/Core/components/FooterPrimary/components/HelpButton/HelpButton.js.map +1 -0
- package/lib/components/Core/components/FooterPrimary/components/Legal/Legal.js +38 -0
- package/lib/components/Core/components/FooterPrimary/components/Legal/Legal.js.map +1 -0
- package/lib/components/Core/components/FooterPrimary/index.js +30 -0
- package/lib/components/Core/components/FooterPrimary/index.js.map +1 -0
- package/lib/components/Core/components/HeaderPrimary/HeaderPrimary-story.js +134 -0
- package/lib/components/Core/components/HeaderPrimary/HeaderPrimary-story.js.map +1 -0
- package/lib/components/Core/components/HeaderPrimary/HeaderPrimary.js +238 -0
- package/lib/components/Core/components/HeaderPrimary/HeaderPrimary.js.map +1 -0
- package/lib/components/Core/components/HeaderPrimary/components/DefaultLockup/DefaultLockup.js +32 -0
- package/lib/components/Core/components/HeaderPrimary/components/DefaultLockup/DefaultLockup.js.map +1 -0
- package/lib/components/Core/components/HeaderPrimary/components/Hamburger/Hamburger.js +58 -0
- package/lib/components/Core/components/HeaderPrimary/components/Hamburger/Hamburger.js.map +1 -0
- package/lib/components/Core/components/HeaderPrimary/components/LocationMenu/LocationMenu.js +169 -0
- package/lib/components/Core/components/HeaderPrimary/components/LocationMenu/LocationMenu.js.map +1 -0
- package/lib/components/Core/components/HeaderPrimary/components/UserMenu/UserMenu.js +56 -0
- package/lib/components/Core/components/HeaderPrimary/components/UserMenu/UserMenu.js.map +1 -0
- package/lib/components/Core/components/ProfileSummary/ProfileSummary-story.js +26 -0
- package/lib/components/Core/components/ProfileSummary/ProfileSummary-story.js.map +1 -0
- package/lib/components/Core/components/ProfileSummary/ProfileSummary.js +46 -0
- package/lib/components/Core/components/ProfileSummary/ProfileSummary.js.map +1 -0
- package/lib/components/Core/components/SaveBar/SaveBar-story.js +68 -0
- package/lib/components/Core/components/SaveBar/SaveBar-story.js.map +1 -0
- package/lib/components/Core/components/SaveBar/SaveBar.js +127 -0
- package/lib/components/Core/components/SaveBar/SaveBar.js.map +1 -0
- package/lib/components/Core/components/Sidebar/Sidebar-story.js +204 -0
- package/lib/components/Core/components/Sidebar/Sidebar-story.js.map +1 -0
- package/lib/components/Core/components/Sidebar/Sidebar.js +87 -0
- package/lib/components/Core/components/Sidebar/Sidebar.js.map +1 -0
- package/lib/components/Core/components/Sidebar/components/SidebarExpander/SidebarExpander.js +48 -0
- package/lib/components/Core/components/Sidebar/components/SidebarExpander/SidebarExpander.js.map +1 -0
- package/lib/components/Core/components/Sidebar/components/SidebarFooter/SidebarFooter.js +25 -0
- package/lib/components/Core/components/Sidebar/components/SidebarFooter/SidebarFooter.js.map +1 -0
- package/lib/components/Core/components/Sidebar/components/SidebarHeader/SidebarHeader.d.ts +12 -0
- package/lib/components/Core/components/Sidebar/components/SidebarHeader/SidebarHeader.d.ts.map +1 -0
- package/lib/components/Core/components/Sidebar/components/SidebarHeader/SidebarHeader.js +47 -0
- package/lib/components/Core/components/Sidebar/components/SidebarHeader/SidebarHeader.js.map +1 -0
- package/lib/components/Core/components/Sidebar/components/SidebarItem/SidebarItem.js +115 -0
- package/lib/components/Core/components/Sidebar/components/SidebarItem/SidebarItem.js.map +1 -0
- package/lib/components/Core/components/Sidebar/components/SidebarSection/SidebarSection.js +38 -0
- package/lib/components/Core/components/Sidebar/components/SidebarSection/SidebarSection.js.map +1 -0
- package/lib/components/Core/index.js +80 -0
- package/lib/components/Core/index.js.map +1 -0
- package/lib/components/Dropzone/Dropzone-story.js +119 -0
- package/lib/components/Dropzone/Dropzone-story.js.map +1 -0
- package/lib/components/Dropzone/Dropzone.js +317 -0
- package/lib/components/Dropzone/Dropzone.js.map +1 -0
- package/lib/components/EmptyState/EmptyState-story.d.ts +2 -0
- package/lib/components/EmptyState/EmptyState-story.d.ts.map +1 -0
- package/lib/components/EmptyState/EmptyState-story.js +60 -0
- package/lib/components/EmptyState/EmptyState-story.js.map +1 -0
- package/lib/components/EmptyState/EmptyState.d.ts +28 -0
- package/lib/components/EmptyState/EmptyState.d.ts.map +1 -0
- package/lib/components/EmptyState/EmptyState.js +54 -0
- package/lib/components/EmptyState/EmptyState.js.map +1 -0
- package/lib/components/EventDetails/EventDetails-story.d.ts +2 -0
- package/lib/components/EventDetails/EventDetails-story.d.ts.map +1 -0
- package/lib/components/EventDetails/EventDetails-story.js +112 -0
- package/lib/components/EventDetails/EventDetails-story.js.map +1 -0
- package/lib/components/EventDetails/EventDetails.d.ts +18 -0
- package/lib/components/EventDetails/EventDetails.d.ts.map +1 -0
- package/lib/components/EventDetails/EventDetails.js +75 -0
- package/lib/components/EventDetails/EventDetails.js.map +1 -0
- package/lib/components/EventDetails/EventDetailsUtilities.d.ts +11 -0
- package/lib/components/EventDetails/EventDetailsUtilities.d.ts.map +1 -0
- package/lib/components/EventDetails/EventDetailsUtilities.js +56 -0
- package/lib/components/EventDetails/EventDetailsUtilities.js.map +1 -0
- package/lib/components/EventDetails/components/EventDetailsItem/EventDetailsItem.d.ts +18 -0
- package/lib/components/EventDetails/components/EventDetailsItem/EventDetailsItem.d.ts.map +1 -0
- package/lib/components/EventDetails/components/EventDetailsItem/EventDetailsItem.js +111 -0
- package/lib/components/EventDetails/components/EventDetailsItem/EventDetailsItem.js.map +1 -0
- package/lib/components/EventDetails/eventDetailsMock.d.ts +10 -0
- package/lib/components/EventDetails/eventDetailsMock.d.ts.map +1 -0
- package/lib/components/EventDetails/eventDetailsMock.js +840 -0
- package/lib/components/EventDetails/eventDetailsMock.js.map +1 -0
- package/lib/components/FontLoader/FontLoader-story.js +16 -0
- package/lib/components/FontLoader/FontLoader-story.js.map +1 -0
- package/lib/components/FontLoader/FontLoader.js +148 -0
- package/lib/components/FontLoader/FontLoader.js.map +1 -0
- package/lib/components/Forms/FormPartials.js +70 -0
- package/lib/components/Forms/FormPartials.js.map +1 -0
- package/lib/components/Forms/Forms-story.js +297 -0
- package/lib/components/Forms/Forms-story.js.map +1 -0
- package/lib/components/Forms/components/Autosuggest/Autosuggest.d.ts +71 -0
- package/lib/components/Forms/components/Autosuggest/Autosuggest.d.ts.map +1 -0
- package/lib/components/Forms/components/Autosuggest/Autosuggest.js +372 -0
- package/lib/components/Forms/components/Autosuggest/Autosuggest.js.map +1 -0
- package/lib/components/Forms/components/Checkbox/Checkbox.d.ts +23 -0
- package/lib/components/Forms/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/lib/components/Forms/components/Checkbox/Checkbox.js +162 -0
- package/lib/components/Forms/components/Checkbox/Checkbox.js.map +1 -0
- package/lib/components/Forms/components/DatePicker/DatePicker.js +236 -0
- package/lib/components/Forms/components/DatePicker/DatePicker.js.map +1 -0
- package/lib/components/Forms/components/DomainInput/DomainInput.js +29 -0
- package/lib/components/Forms/components/DomainInput/DomainInput.js.map +1 -0
- package/lib/components/Forms/components/DurationInput/DurationInput.js +270 -0
- package/lib/components/Forms/components/DurationInput/DurationInput.js.map +1 -0
- package/lib/components/Forms/components/FormBuilder/FormBuilder-story.js +357 -0
- package/lib/components/Forms/components/FormBuilder/FormBuilder-story.js.map +1 -0
- package/lib/components/Forms/components/FormBuilder/FormBuilder.js +121 -0
- package/lib/components/Forms/components/FormBuilder/FormBuilder.js.map +1 -0
- package/lib/components/Forms/components/FormBuilder/components/FormInner/FormInner.js +201 -0
- package/lib/components/Forms/components/FormBuilder/components/FormInner/FormInner.js.map +1 -0
- package/lib/components/Forms/components/FormLayout/FormLayout.js +35 -0
- package/lib/components/Forms/components/FormLayout/FormLayout.js.map +1 -0
- package/lib/components/Forms/components/FormLayout/components/FormLayoutGroup/FormLayoutGroup.js +30 -0
- package/lib/components/Forms/components/FormLayout/components/FormLayoutGroup/FormLayoutGroup.js.map +1 -0
- package/lib/components/Forms/components/FormLayout/components/FormLayoutItem/FormLayoutItem.js +32 -0
- package/lib/components/Forms/components/FormLayout/components/FormLayoutItem/FormLayoutItem.js.map +1 -0
- package/lib/components/Forms/components/FormLayout/index.js +32 -0
- package/lib/components/Forms/components/FormLayout/index.js.map +1 -0
- package/lib/components/Forms/components/PhoneInput/PhoneInput.d.ts +30 -0
- package/lib/components/Forms/components/PhoneInput/PhoneInput.d.ts.map +1 -0
- package/lib/components/Forms/components/PhoneInput/PhoneInput.js +119 -0
- package/lib/components/Forms/components/PhoneInput/PhoneInput.js.map +1 -0
- package/lib/components/Forms/components/Radio/Radio.d.ts +15 -0
- package/lib/components/Forms/components/Radio/Radio.d.ts.map +1 -0
- package/lib/components/Forms/components/Radio/Radio.js +92 -0
- package/lib/components/Forms/components/Radio/Radio.js.map +1 -0
- package/lib/components/Forms/components/Search/Search.js +96 -0
- package/lib/components/Forms/components/Search/Search.js.map +1 -0
- package/lib/components/Forms/components/Select/Select.js +95 -0
- package/lib/components/Forms/components/Select/Select.js.map +1 -0
- package/lib/components/Forms/components/Slider/Slider.js +100 -0
- package/lib/components/Forms/components/Slider/Slider.js.map +1 -0
- package/lib/components/Forms/components/Stars/Stars.js +101 -0
- package/lib/components/Forms/components/Stars/Stars.js.map +1 -0
- package/lib/components/Forms/components/Tag/Tag.js +60 -0
- package/lib/components/Forms/components/Tag/Tag.js.map +1 -0
- package/lib/components/Forms/components/TextArea/TextArea.js +55 -0
- package/lib/components/Forms/components/TextArea/TextArea.js.map +1 -0
- package/lib/components/Forms/components/TextInput/TextInput.d.ts +28 -0
- package/lib/components/Forms/components/TextInput/TextInput.d.ts.map +1 -0
- package/lib/components/Forms/components/TextInput/TextInput.js +57 -0
- package/lib/components/Forms/components/TextInput/TextInput.js.map +1 -0
- package/lib/components/Forms/components/Toggle/Toggle.d.ts +9 -0
- package/lib/components/Forms/components/Toggle/Toggle.d.ts.map +1 -0
- package/lib/components/Forms/components/Toggle/Toggle.js +43 -0
- package/lib/components/Forms/components/Toggle/Toggle.js.map +1 -0
- package/lib/components/Forms/index.d.ts +18 -0
- package/lib/components/Forms/index.d.ts.map +1 -0
- package/lib/components/Forms/index.js +182 -0
- package/lib/components/Forms/index.js.map +1 -0
- package/lib/components/Heading/Heading-story.js +18 -0
- package/lib/components/Heading/Heading-story.js.map +1 -0
- package/lib/components/Heading/Heading.d.ts +13 -0
- package/lib/components/Heading/Heading.d.ts.map +1 -0
- package/lib/components/Heading/Heading.js +32 -0
- package/lib/components/Heading/Heading.js.map +1 -0
- package/lib/components/Icon/Icon-story.d.ts +2 -0
- package/lib/components/Icon/Icon-story.d.ts.map +1 -0
- package/lib/components/Icon/Icon-story.js +44 -0
- package/lib/components/Icon/Icon-story.js.map +1 -0
- package/lib/components/Icon/Icon.d.ts +13 -0
- package/lib/components/Icon/Icon.d.ts.map +1 -0
- package/lib/components/Icon/Icon.js +52 -0
- package/lib/components/Icon/Icon.js.map +1 -0
- package/lib/components/Image/Image.d.ts +11 -0
- package/lib/components/Image/Image.d.ts.map +1 -0
- package/lib/components/Image/Image.js +32 -0
- package/lib/components/Image/Image.js.map +1 -0
- package/lib/components/ImageCropper/ImageCropper-story.js +219 -0
- package/lib/components/ImageCropper/ImageCropper-story.js.map +1 -0
- package/lib/components/ImageCropper/ImageCropper.js +256 -0
- package/lib/components/ImageCropper/ImageCropper.js.map +1 -0
- package/lib/components/ImageSSR/ImageSSR.js +32 -0
- package/lib/components/ImageSSR/ImageSSR.js.map +1 -0
- package/lib/components/Layout/Layout-story.js +128 -0
- package/lib/components/Layout/Layout-story.js.map +1 -0
- package/lib/components/Layout/Layout.js +43 -0
- package/lib/components/Layout/Layout.js.map +1 -0
- package/lib/components/Layout/components/LayoutSection/LayoutSection.js +38 -0
- package/lib/components/Layout/components/LayoutSection/LayoutSection.js.map +1 -0
- package/lib/components/Layout/index.js +24 -0
- package/lib/components/Layout/index.js.map +1 -0
- package/lib/components/List/List-story.d.ts +2 -0
- package/lib/components/List/List-story.d.ts.map +1 -0
- package/lib/components/List/List-story.js +241 -0
- package/lib/components/List/List-story.js.map +1 -0
- package/lib/components/List/List.d.ts +34 -0
- package/lib/components/List/List.d.ts.map +1 -0
- package/lib/components/List/List.js +83 -0
- package/lib/components/List/List.js.map +1 -0
- package/lib/components/List/components/ExpandableListItem/ExpandableListItem.d.ts +27 -0
- package/lib/components/List/components/ExpandableListItem/ExpandableListItem.d.ts.map +1 -0
- package/lib/components/List/components/ExpandableListItem/ExpandableListItem.js +93 -0
- package/lib/components/List/components/ExpandableListItem/ExpandableListItem.js.map +1 -0
- package/lib/components/List/components/ListHeader/ListHeader.d.ts +16 -0
- package/lib/components/List/components/ListHeader/ListHeader.d.ts.map +1 -0
- package/lib/components/List/components/ListHeader/ListHeader.js +51 -0
- package/lib/components/List/components/ListHeader/ListHeader.js.map +1 -0
- package/lib/components/List/components/ListItem/ListItem.d.ts +67 -0
- package/lib/components/List/components/ListItem/ListItem.d.ts.map +1 -0
- package/lib/components/List/components/ListItem/ListItem.js +206 -0
- package/lib/components/List/components/ListItem/ListItem.js.map +1 -0
- package/lib/components/List/components/SortableList/SortableList.d.ts +35 -0
- package/lib/components/List/components/SortableList/SortableList.d.ts.map +1 -0
- package/lib/components/List/components/SortableList/SortableList.js +180 -0
- package/lib/components/List/components/SortableList/SortableList.js.map +1 -0
- package/lib/components/List/index.d.ts +6 -0
- package/lib/components/List/index.d.ts.map +1 -0
- package/lib/components/List/index.js +74 -0
- package/lib/components/List/index.js.map +1 -0
- package/lib/components/Loader/Loader-story.js +30 -0
- package/lib/components/Loader/Loader-story.js.map +1 -0
- package/lib/components/Loader/Loader.js +36 -0
- package/lib/components/Loader/Loader.js.map +1 -0
- package/lib/components/Loader/Loader.test.js +17 -0
- package/lib/components/Loader/Loader.test.js.map +1 -0
- package/lib/components/MarkdownText/MarkdownText.d.ts +8 -0
- package/lib/components/MarkdownText/MarkdownText.d.ts.map +1 -0
- package/lib/components/MarkdownText/MarkdownText.js +26 -0
- package/lib/components/MarkdownText/MarkdownText.js.map +1 -0
- package/lib/components/Message/Message-story.js +135 -0
- package/lib/components/Message/Message-story.js.map +1 -0
- package/lib/components/Message/Message.js +147 -0
- package/lib/components/Message/Message.js.map +1 -0
- package/lib/components/Message/components/MessageBuilder.js +132 -0
- package/lib/components/Message/components/MessageBuilder.js.map +1 -0
- package/lib/components/Message/index.js +24 -0
- package/lib/components/Message/index.js.map +1 -0
- package/lib/components/Modal/Modal-story.js +239 -0
- package/lib/components/Modal/Modal-story.js.map +1 -0
- package/lib/components/Modal/Modal.js +86 -0
- package/lib/components/Modal/Modal.js.map +1 -0
- package/lib/components/Modal/components/ModalBody/ModalBody.js +30 -0
- package/lib/components/Modal/components/ModalBody/ModalBody.js.map +1 -0
- package/lib/components/Modal/components/ModalFooter/ModalFooter.js +31 -0
- package/lib/components/Modal/components/ModalFooter/ModalFooter.js.map +1 -0
- package/lib/components/Modal/components/ModalHeader/ModalHeader.js +84 -0
- package/lib/components/Modal/components/ModalHeader/ModalHeader.js.map +1 -0
- package/lib/components/Page/Page-story.js +115 -0
- package/lib/components/Page/Page-story.js.map +1 -0
- package/lib/components/Page/Page.js +55 -0
- package/lib/components/Page/Page.js.map +1 -0
- package/lib/components/Page/components/PageContent/PageContent.js +22 -0
- package/lib/components/Page/components/PageContent/PageContent.js.map +1 -0
- package/lib/components/Page/components/PageHeader/PageHeader.js +127 -0
- package/lib/components/Page/components/PageHeader/PageHeader.js.map +1 -0
- package/lib/components/Page/index.js +32 -0
- package/lib/components/Page/index.js.map +1 -0
- package/lib/components/PagedModal/PagedModal-story.js +121 -0
- package/lib/components/PagedModal/PagedModal-story.js.map +1 -0
- package/lib/components/PagedModal/PagedModal.js +84 -0
- package/lib/components/PagedModal/PagedModal.js.map +1 -0
- package/lib/components/Pagination/Pagination-story.js +35 -0
- package/lib/components/Pagination/Pagination-story.js.map +1 -0
- package/lib/components/Pagination/Pagination.js +157 -0
- package/lib/components/Pagination/Pagination.js.map +1 -0
- package/lib/components/RecordSelectionList/RecordSelectList-story.js +491 -0
- package/lib/components/RecordSelectionList/RecordSelectList-story.js.map +1 -0
- package/lib/components/RecordSelectionList/RecordSelectionList.d.ts +112 -0
- package/lib/components/RecordSelectionList/RecordSelectionList.d.ts.map +1 -0
- package/lib/components/RecordSelectionList/RecordSelectionList.js +702 -0
- package/lib/components/RecordSelectionList/RecordSelectionList.js.map +1 -0
- package/lib/components/RecordSelectionList/RecordSelectionListItem.d.ts +5 -0
- package/lib/components/RecordSelectionList/RecordSelectionListItem.d.ts.map +1 -0
- package/lib/components/RecordSelectionList/RecordSelectionListItem.js +20 -0
- package/lib/components/RecordSelectionList/RecordSelectionListItem.js.map +1 -0
- package/lib/components/RecordTable/RecordTable-story.d.ts +2 -0
- package/lib/components/RecordTable/RecordTable-story.d.ts.map +1 -0
- package/lib/components/RecordTable/RecordTable-story.js +242 -0
- package/lib/components/RecordTable/RecordTable-story.js.map +1 -0
- package/lib/components/RecordTable/RecordTable.d.ts +133 -0
- package/lib/components/RecordTable/RecordTable.d.ts.map +1 -0
- package/lib/components/RecordTable/RecordTable.js +523 -0
- package/lib/components/RecordTable/RecordTable.js.map +1 -0
- package/lib/components/SplitButton/SplitButton-story.js +60 -0
- package/lib/components/SplitButton/SplitButton-story.js.map +1 -0
- package/lib/components/SplitButton/SplitButton.d.ts +47 -0
- package/lib/components/SplitButton/SplitButton.d.ts.map +1 -0
- package/lib/components/SplitButton/SplitButton.js +296 -0
- package/lib/components/SplitButton/SplitButton.js.map +1 -0
- package/lib/components/Subheading/Subheading-story.js +18 -0
- package/lib/components/Subheading/Subheading-story.js.map +1 -0
- package/lib/components/Subheading/Subheading.js +40 -0
- package/lib/components/Subheading/Subheading.js.map +1 -0
- package/lib/components/Table/Table-story.js +428 -0
- package/lib/components/Table/Table-story.js.map +1 -0
- package/lib/components/Table/Table.d.ts +63 -0
- package/lib/components/Table/Table.d.ts.map +1 -0
- package/lib/components/Table/Table.js +395 -0
- package/lib/components/Table/Table.js.map +1 -0
- package/lib/components/Table/components/TableFilters/TableFilters.js +31 -0
- package/lib/components/Table/components/TableFilters/TableFilters.js.map +1 -0
- package/lib/components/Table/components/TableSearch/TableSearch.d.ts +7 -0
- package/lib/components/Table/components/TableSearch/TableSearch.d.ts.map +1 -0
- package/lib/components/Table/components/TableSearch/TableSearch.js +30 -0
- package/lib/components/Table/components/TableSearch/TableSearch.js.map +1 -0
- package/lib/components/Table/index.d.ts +4 -0
- package/lib/components/Table/index.d.ts.map +1 -0
- package/lib/components/Table/index.js +40 -0
- package/lib/components/Table/index.js.map +1 -0
- package/lib/components/Tabs/Tabs-story.d.ts +2 -0
- package/lib/components/Tabs/Tabs-story.d.ts.map +1 -0
- package/lib/components/Tabs/Tabs-story.js +36 -0
- package/lib/components/Tabs/Tabs-story.js.map +1 -0
- package/lib/components/Tabs/Tabs.d.ts +40 -0
- package/lib/components/Tabs/Tabs.d.ts.map +1 -0
- package/lib/components/Tabs/Tabs.js +244 -0
- package/lib/components/Tabs/Tabs.js.map +1 -0
- package/lib/components/Tabs/components/Tab/Tab.d.ts +26 -0
- package/lib/components/Tabs/components/Tab/Tab.d.ts.map +1 -0
- package/lib/components/Tabs/components/Tab/Tab.js +46 -0
- package/lib/components/Tabs/components/Tab/Tab.js.map +1 -0
- package/lib/components/Text/Text-story.d.ts +2 -0
- package/lib/components/Text/Text-story.d.ts.map +1 -0
- package/lib/components/Text/Text-story.js +51 -0
- package/lib/components/Text/Text-story.js.map +1 -0
- package/lib/components/Text/Text.d.ts +18 -0
- package/lib/components/Text/Text.d.ts.map +1 -0
- package/lib/components/Text/Text.js +123 -0
- package/lib/components/Text/Text.js.map +1 -0
- package/lib/components/TextContainer/TextContainer-story.js +32 -0
- package/lib/components/TextContainer/TextContainer-story.js.map +1 -0
- package/lib/components/TextContainer/TextContainer.js +33 -0
- package/lib/components/TextContainer/TextContainer.js.map +1 -0
- package/lib/components/TextStyle/TextStyle-story.js +28 -0
- package/lib/components/TextStyle/TextStyle-story.js.map +1 -0
- package/lib/components/TextStyle/TextStyle.js +41 -0
- package/lib/components/TextStyle/TextStyle.js.map +1 -0
- package/lib/components/Toast/Toast-story.d.ts +2 -0
- package/lib/components/Toast/Toast-story.d.ts.map +1 -0
- package/lib/components/Toast/Toast-story.js +210 -0
- package/lib/components/Toast/Toast-story.js.map +1 -0
- package/lib/components/Toast/Toast.d.ts +24 -0
- package/lib/components/Toast/Toast.d.ts.map +1 -0
- package/lib/components/Toast/Toast.js +76 -0
- package/lib/components/Toast/Toast.js.map +1 -0
- package/lib/components/Toast/components/ToastWrapper/ToastWrapper.d.ts +24 -0
- package/lib/components/Toast/components/ToastWrapper/ToastWrapper.d.ts.map +1 -0
- package/lib/components/Toast/components/ToastWrapper/ToastWrapper.js +131 -0
- package/lib/components/Toast/components/ToastWrapper/ToastWrapper.js.map +1 -0
- package/lib/components/TruncatedList/TruncatedList-story.js +222 -0
- package/lib/components/TruncatedList/TruncatedList-story.js.map +1 -0
- package/lib/components/TruncatedList/TruncatedList.d.ts +49 -0
- package/lib/components/TruncatedList/TruncatedList.d.ts.map +1 -0
- package/lib/components/TruncatedList/TruncatedList.js +188 -0
- package/lib/components/TruncatedList/TruncatedList.js.map +1 -0
- package/lib/components/View/View-story.js +485 -0
- package/lib/components/View/View-story.js.map +1 -0
- package/lib/components/View/View.d.ts +26 -0
- package/lib/components/View/View.d.ts.map +1 -0
- package/lib/components/View/View.js +91 -0
- package/lib/components/View/View.js.map +1 -0
- package/lib/components/_utilities/Anchor.js +28 -0
- package/lib/components/_utilities/Anchor.js.map +1 -0
- package/lib/custom-types.d.js +2 -0
- package/lib/custom-types.d.js.map +1 -0
- package/lib/icons.js +3328 -0
- package/lib/icons.js.map +1 -0
- package/lib/index.d.ts +46 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +707 -0
- package/lib/index.js.map +1 -0
- package/lib/stubs/events.js +166 -0
- package/lib/stubs/events.js.map +1 -0
- package/lib/stubs/location.js +34 -0
- package/lib/stubs/location.js.map +1 -0
- package/lib/stubs/users.js +225 -0
- package/lib/stubs/users.js.map +1 -0
- package/lib/utilities.js +23 -0
- package/lib/utilities.js.map +1 -0
- package/package.json +174 -0
- package/static/android-chrome-192x192.png +0 -0
- package/static/android-chrome-256x256.png +0 -0
- package/static/apple-touch-icon.png +0 -0
- package/static/assets/bg.jpeg +0 -0
- package/static/assets/icons/Design/Rotate/rotate-back.svg +9 -0
- package/static/assets/icons/Design/Rotate/rotate-forward.svg +9 -0
- package/static/assets/icons/Interface-Essential/Alerts/alert-triangle--16w.svg +3 -0
- package/static/assets/icons/Interface-Essential/Alerts/alert-triangle--56w.svg +5 -0
- package/static/assets/icons/Interface-Essential/Alerts/alert-triangle.svg +3 -0
- package/static/assets/icons/Interface-Essential/Dashboard/gauge-dashboard-1.svg +11 -0
- package/static/assets/icons/Interface-Essential/Date/Calendar/calendar-3.svg +12 -0
- package/static/assets/icons/Interface-Essential/Date/Calendar/calendar-date.svg +9 -0
- package/static/assets/icons/Interface-Essential/Delete/bin.svg +7 -0
- package/static/assets/icons/Interface-Essential/Edit/pencil-write.svg +5 -0
- package/static/assets/icons/Interface-Essential/Form-Edition/paper-write.svg +8 -0
- package/static/assets/icons/Interface-Essential/Form-Validation/check-circle-1.svg +4 -0
- package/static/assets/icons/Interface-Essential/Help/question-help-square--16w.svg +5 -0
- package/static/assets/icons/Interface-Essential/Help/question-help-square.svg +5 -0
- package/static/assets/icons/Interface-Essential/Home/house-1--16w.svg +4 -0
- package/static/assets/icons/Interface-Essential/Home/house-1.svg +4 -0
- package/static/assets/icons/Interface-Essential/Lists/list-bullets-1.svg +8 -0
- package/static/assets/icons/Interface-Essential/Lock/Unlock/Lock/Unlock-4.svg +5 -0
- package/static/assets/icons/Interface-Essential/Lock/Unlock/lock-6--16w.svg +3 -0
- package/static/assets/icons/Interface-Essential/Lock/Unlock/lock-6.svg +5 -0
- package/static/assets/icons/Interface-Essential/Login/Logout/logout.svg +5 -0
- package/static/assets/icons/Interface-Essential/Menu/navigation-menu-horizontal.svg +5 -0
- package/static/assets/icons/Interface-Essential/Select/cursor-select-4.svg +14 -0
- package/static/assets/icons/Interface-Essential/Time/stopwatch.svg +8 -0
- package/static/assets/icons/Interface-Essential/Time-Files/time-clock-file-check.svg +7 -0
- package/static/assets/icons/Interface-Essential/Time-Files/time-clock-file-upload.svg +9 -0
- package/static/assets/icons/Maps-Navigation/Pins/pin-2.svg +4 -0
- package/static/assets/icons/Maps-Navigation/Pins/pin.svg +4 -0
- package/static/assets/icons/Messages-Chat-Smileys/Conversation/conversation-text--16w.svg +8 -0
- package/static/assets/icons/Messages-Chat-Smileys/Conversation/conversation-text.svg +8 -0
- package/static/assets/icons/Messages-Chat-Smileys/Messages-Speech-Bubbles/messages-bubble-square-text.svg +5 -0
- package/static/assets/icons/Phones-Mobile-Devices/Phone/phone-retro-1.svg +7 -0
- package/static/assets/icons/Programming-Apps-Websites/Plugins/Modules/module-puzzle.svg +3 -0
- package/static/assets/icons/Shopping-E-Commerce/Shops/shop-1--56w.svg +6 -0
- package/static/assets/icons/Shopping-E-Commerce/Shops/shop-1.svg +7 -0
- package/static/assets/icons/Social-Medias-Rewards-Rating/Rating/rating-star-1-1.svg +3 -0
- package/static/assets/icons/Social-Medias-Rewards-Rating/Rating/rating-star-1.svg +3 -0
- package/static/assets/icons/Transportation/Aircraft/aircraft-military-plane.svg +18 -0
- package/static/assets/icons/Users/Geometric-Close-Up-Single-User-Actions-Neutral/single-neutral-actions-image--56w.svg +7 -0
- package/static/assets/icons/Users/Geometric-Close-Up-Single-User-Actions-Neutral/single-neutral-actions-up-down.svg +8 -0
- package/static/assets/icons/Users/Geometric-Close-Up-Single-User-Neutral/single-neutral-id-card-3.svg +8 -0
- package/static/assets/icons/Users/Geometric-Full-Body-Multiple-Users/multiple-users-1.svg +8 -0
- package/static/assets/icons/Work-Office-Companies/Human-Resources/human-resources-search-team--16w.svg +8 -0
- package/static/assets/icons/Work-Office-Companies/Human-Resources/human-resources-search-team.svg +8 -0
- package/static/assets/icons/ic_add.svg +5 -0
- package/static/assets/icons/ic_add_circle_outline.svg +3 -0
- package/static/assets/icons/ic_arrow_back.svg +3 -0
- package/static/assets/icons/ic_arrow_drop_down.svg +3 -0
- package/static/assets/icons/ic_arrow_forward.svg +3 -0
- package/static/assets/icons/ic_button.svg +3 -0
- package/static/assets/icons/ic_calendar.svg +12 -0
- package/static/assets/icons/ic_cancel.svg +8 -0
- package/static/assets/icons/ic_caution.svg +3 -0
- package/static/assets/icons/ic_caution_light_large.svg +5 -0
- package/static/assets/icons/ic_check_box.svg +3 -0
- package/static/assets/icons/ic_check_box_outline_blank.svg +3 -0
- package/static/assets/icons/ic_check_circle.svg +3 -0
- package/static/assets/icons/ic_close.svg +3 -0
- package/static/assets/icons/ic_colors.svg +8 -0
- package/static/assets/icons/ic_complete.svg +4 -0
- package/static/assets/icons/ic_css.svg +7 -0
- package/static/assets/icons/ic_dashboard.svg +11 -0
- package/static/assets/icons/ic_date.svg +9 -0
- package/static/assets/icons/ic_date_disable.svg +8 -0
- package/static/assets/icons/ic_delete.svg +7 -0
- package/static/assets/icons/ic_disable.svg +3 -0
- package/static/assets/icons/ic_drag_handle.svg +3 -0
- package/static/assets/icons/ic_drop_light_large.svg +14 -0
- package/static/assets/icons/ic_edit.svg +5 -0
- package/static/assets/icons/ic_email.svg +6 -0
- package/static/assets/icons/ic_fonts.svg +6 -0
- package/static/assets/icons/ic_fullscreen.svg +3 -0
- package/static/assets/icons/ic_fullscreen_exit.svg +3 -0
- package/static/assets/icons/ic_guests.svg +8 -0
- package/static/assets/icons/ic_help.svg +5 -0
- package/static/assets/icons/ic_home.svg +4 -0
- package/static/assets/icons/ic_indeterminate_check_box.svg +3 -0
- package/static/assets/icons/ic_keyboard_arrow_left.svg +3 -0
- package/static/assets/icons/ic_keyboard_arrow_right.svg +3 -0
- package/static/assets/icons/ic_late.svg +5 -0
- package/static/assets/icons/ic_launch.svg +18 -0
- package/static/assets/icons/ic_location.svg +4 -0
- package/static/assets/icons/ic_logout.svg +5 -0
- package/static/assets/icons/ic_menu.svg +3 -0
- package/static/assets/icons/ic_message.svg +5 -0
- package/static/assets/icons/ic_message_failed.svg +7 -0
- package/static/assets/icons/ic_messages.svg +8 -0
- package/static/assets/icons/ic_more.svg +5 -0
- package/static/assets/icons/ic_new_tab.svg +3 -0
- package/static/assets/icons/ic_note.svg +8 -0
- package/static/assets/icons/ic_payment_failed_solid.svg +5 -0
- package/static/assets/icons/ic_payment_success_solid.svg +5 -0
- package/static/assets/icons/ic_phone.svg +7 -0
- package/static/assets/icons/ic_pin.svg +4 -0
- package/static/assets/icons/ic_pin_outline.svg +4 -0
- package/static/assets/icons/ic_power.svg +4 -0
- package/static/assets/icons/ic_private.svg +5 -0
- package/static/assets/icons/ic_profile_image_light_large.svg +7 -0
- package/static/assets/icons/ic_public.svg +5 -0
- package/static/assets/icons/ic_radio_button_checked.svg +3 -0
- package/static/assets/icons/ic_radio_button_unchecked.svg +3 -0
- package/static/assets/icons/ic_rotate_left.svg +9 -0
- package/static/assets/icons/ic_rotate_right.svg +9 -0
- package/static/assets/icons/ic_search.svg +3 -0
- package/static/assets/icons/ic_settings.svg +4 -0
- package/static/assets/icons/ic_shop_light_large.svg +6 -0
- package/static/assets/icons/ic_show.svg +4 -0
- package/static/assets/icons/ic_skill.svg +3 -0
- package/static/assets/icons/ic_star_outline.svg +3 -0
- package/static/assets/icons/ic_star_solid.svg +3 -0
- package/static/assets/icons/ic_status.svg +8 -0
- package/static/assets/icons/ic_store.svg +7 -0
- package/static/assets/icons/ic_switch_users.svg +8 -0
- package/static/assets/icons/ic_team.svg +8 -0
- package/static/assets/icons/ic_teammates.svg +8 -0
- package/static/assets/icons/ic_unordered_list.svg +8 -0
- package/static/assets/icons/ic_upload.svg +8 -0
- package/static/assets/icons/ic_upload_file_light_large.svg +9 -0
- package/static/assets/icons/ic_upload_file_success_light_large.svg +7 -0
- package/static/assets/icons/ic_user_avatar.svg +3 -0
- package/static/assets/icons/ic_wifi.svg +9 -0
- package/static/assets/icons/s-ic_spruce-logo-02.svg +3 -0
- package/static/assets/icons/s-ic_spruce-logo.svg +3 -0
- package/static/assets/logo.png +0 -0
- package/static/assets/users/user-01--96w.png +0 -0
- package/static/assets/users/user-01.png +0 -0
- package/static/assets/users/user-02--96w.png +0 -0
- package/static/assets/users/user-03--96w.png +0 -0
- package/static/assets/users/user-04--96w.png +0 -0
- package/static/assets/users/user-04.png +0 -0
- package/static/assets/users/user-05--96w.png +0 -0
- package/static/assets/users/user-05.png +0 -0
- package/static/assets/users/user-06--96w.png +0 -0
- package/static/assets/users/user-06.png +0 -0
- package/static/assets/users/user-07--96w.png +0 -0
- package/static/assets/users/user-07.png +0 -0
- package/static/assets/users/user-08--96w.png +0 -0
- package/static/assets/users/user-08.png +0 -0
- package/static/assets/users/user-09--96w.png +0 -0
- package/static/assets/users/user-09.png +0 -0
- package/static/assets/users/user-placeholder--96w.png +0 -0
- package/static/assets/users/user-placeholder.png +0 -0
- package/static/browserconfig.xml +9 -0
- package/static/favicon-16x16.png +0 -0
- package/static/favicon-32x32.png +0 -0
- package/static/favicon.ico +0 -0
- package/static/mstile-150x150.png +0 -0
- package/static/safari-pinned-tab.svg +26 -0
- package/static/site.webmanifest +19 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
+
|
|
16
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
17
|
+
|
|
18
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
19
|
+
|
|
20
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
21
|
+
|
|
22
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
23
|
+
|
|
24
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
25
|
+
|
|
26
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
27
|
+
|
|
28
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
29
|
+
|
|
30
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
31
|
+
|
|
32
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
33
|
+
|
|
34
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
35
|
+
|
|
36
|
+
require("react-dates/initialize");
|
|
37
|
+
|
|
38
|
+
var _reactDates = require("react-dates");
|
|
39
|
+
|
|
40
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
41
|
+
|
|
42
|
+
var ArrowNext = function ArrowNext(props) {
|
|
43
|
+
return _react["default"].createElement("svg", props, _react["default"].createElement("path", {
|
|
44
|
+
fillRule: "evenodd",
|
|
45
|
+
clipRule: "evenodd",
|
|
46
|
+
d: "M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8-8-8z"
|
|
47
|
+
}));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
ArrowNext.defaultProps = {
|
|
51
|
+
width: "24",
|
|
52
|
+
height: "24",
|
|
53
|
+
viewBox: "0 0 24 24",
|
|
54
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
var ArrowBack = function ArrowBack(props) {
|
|
58
|
+
return _react["default"].createElement("svg", props, _react["default"].createElement("path", {
|
|
59
|
+
fillRule: "evenodd",
|
|
60
|
+
clipRule: "evenodd",
|
|
61
|
+
d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
ArrowBack.defaultProps = {
|
|
66
|
+
width: "24",
|
|
67
|
+
height: "24",
|
|
68
|
+
viewBox: "0 0 24 24",
|
|
69
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
var DatePicker =
|
|
73
|
+
/*#__PURE__*/
|
|
74
|
+
function (_Component) {
|
|
75
|
+
(0, _inherits2["default"])(DatePicker, _Component);
|
|
76
|
+
|
|
77
|
+
function DatePicker(props) {
|
|
78
|
+
var _this;
|
|
79
|
+
|
|
80
|
+
(0, _classCallCheck2["default"])(this, DatePicker);
|
|
81
|
+
_this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(DatePicker).call(this, props));
|
|
82
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toggleFocus", function () {
|
|
83
|
+
_this.setState(function (prevState) {
|
|
84
|
+
return {
|
|
85
|
+
isFocused: !prevState.isFocused
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleFocusChange", function (focusedInput) {
|
|
90
|
+
_this.setState({
|
|
91
|
+
// Force the focusedInput to always be truthy so that dates are always selectable
|
|
92
|
+
focusedInput: !focusedInput ? 'startDate' : focusedInput
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleDateChange",
|
|
96
|
+
/*#__PURE__*/
|
|
97
|
+
function () {
|
|
98
|
+
var _ref = (0, _asyncToGenerator2["default"])(
|
|
99
|
+
/*#__PURE__*/
|
|
100
|
+
_regenerator["default"].mark(function _callee(date) {
|
|
101
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
102
|
+
while (1) {
|
|
103
|
+
switch (_context.prev = _context.next) {
|
|
104
|
+
case 0:
|
|
105
|
+
_this.datePickerRef.current.setState({
|
|
106
|
+
currentMonth: date
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
_this.setState({
|
|
110
|
+
date: date
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
if (_this.props.onSelectDate) {
|
|
114
|
+
_this.props.onSelectDate(date);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
case 3:
|
|
118
|
+
case "end":
|
|
119
|
+
return _context.stop();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}, _callee);
|
|
123
|
+
}));
|
|
124
|
+
|
|
125
|
+
return function (_x) {
|
|
126
|
+
return _ref.apply(this, arguments);
|
|
127
|
+
};
|
|
128
|
+
}());
|
|
129
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleDatesChange",
|
|
130
|
+
/*#__PURE__*/
|
|
131
|
+
function () {
|
|
132
|
+
var _ref3 = (0, _asyncToGenerator2["default"])(
|
|
133
|
+
/*#__PURE__*/
|
|
134
|
+
_regenerator["default"].mark(function _callee2(_ref2) {
|
|
135
|
+
var startDate, endDate;
|
|
136
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
137
|
+
while (1) {
|
|
138
|
+
switch (_context2.prev = _context2.next) {
|
|
139
|
+
case 0:
|
|
140
|
+
startDate = _ref2.startDate, endDate = _ref2.endDate;
|
|
141
|
+
|
|
142
|
+
_this.setState({
|
|
143
|
+
startDate: startDate,
|
|
144
|
+
endDate: endDate
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
if (_this.props.onSelectDateRange) {
|
|
148
|
+
_this.props.onSelectDateRange({
|
|
149
|
+
startDate: startDate,
|
|
150
|
+
endDate: endDate
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
case 3:
|
|
155
|
+
case "end":
|
|
156
|
+
return _context2.stop();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}, _callee2);
|
|
160
|
+
}));
|
|
161
|
+
|
|
162
|
+
return function (_x2) {
|
|
163
|
+
return _ref3.apply(this, arguments);
|
|
164
|
+
};
|
|
165
|
+
}());
|
|
166
|
+
_this.state = {
|
|
167
|
+
isFocused: true,
|
|
168
|
+
date: _this.props.date || (0, _moment["default"])(),
|
|
169
|
+
startDate: _this.props.initialStartDate,
|
|
170
|
+
endDate: _this.props.initialEndDate,
|
|
171
|
+
focusedInput: 'startDate'
|
|
172
|
+
};
|
|
173
|
+
_this.datePickerRef = _react["default"].createRef();
|
|
174
|
+
return _this;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
(0, _createClass2["default"])(DatePicker, [{
|
|
178
|
+
key: "componentWillReceiveProps",
|
|
179
|
+
value: function componentWillReceiveProps(nextProps) {
|
|
180
|
+
if (this.props.date !== nextProps.date) {
|
|
181
|
+
this.setState({
|
|
182
|
+
date: nextProps.date
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}, {
|
|
187
|
+
key: "render",
|
|
188
|
+
value: function render() {
|
|
189
|
+
var _this2 = this;
|
|
190
|
+
|
|
191
|
+
var _this$state = this.state,
|
|
192
|
+
isFocused = _this$state.isFocused,
|
|
193
|
+
focusedInput = _this$state.focusedInput,
|
|
194
|
+
date = _this$state.date,
|
|
195
|
+
startDate = _this$state.startDate,
|
|
196
|
+
endDate = _this$state.endDate;
|
|
197
|
+
var _this$props = this.props,
|
|
198
|
+
kind = _this$props.kind,
|
|
199
|
+
rest = (0, _objectWithoutProperties2["default"])(_this$props, ["kind"]);
|
|
200
|
+
return kind === 'singleDate' ? _react["default"].createElement(_reactDates.DayPickerSingleDateController, (0, _extends2["default"])({
|
|
201
|
+
ref: this.datePickerRef,
|
|
202
|
+
date: date,
|
|
203
|
+
initialVisibleMonth: function initialVisibleMonth() {
|
|
204
|
+
return date;
|
|
205
|
+
},
|
|
206
|
+
focused: isFocused,
|
|
207
|
+
onDateChange: function onDateChange(date) {
|
|
208
|
+
return _this2.handleDateChange(date);
|
|
209
|
+
},
|
|
210
|
+
onFocusChange: this.toggleFocus,
|
|
211
|
+
navNext: _react["default"].createElement(ArrowNext, null),
|
|
212
|
+
navPrev: _react["default"].createElement(ArrowBack, null),
|
|
213
|
+
hideKeyboardShortcutsPanel: true
|
|
214
|
+
}, rest)) : _react["default"].createElement(_reactDates.DayPickerRangeController, (0, _extends2["default"])({
|
|
215
|
+
onDatesChange: this.handleDatesChange,
|
|
216
|
+
onFocusChange: this.handleFocusChange,
|
|
217
|
+
focusedInput: focusedInput,
|
|
218
|
+
startDate: startDate,
|
|
219
|
+
endDate: endDate,
|
|
220
|
+
navNext: _react["default"].createElement(ArrowNext, null),
|
|
221
|
+
navPrev: _react["default"].createElement(ArrowBack, null),
|
|
222
|
+
hideKeyboardShortcutsPanel: true
|
|
223
|
+
}, rest));
|
|
224
|
+
}
|
|
225
|
+
}]);
|
|
226
|
+
return DatePicker;
|
|
227
|
+
}(_react.Component);
|
|
228
|
+
|
|
229
|
+
exports["default"] = DatePicker;
|
|
230
|
+
(0, _defineProperty2["default"])(DatePicker, "defaultProps", {
|
|
231
|
+
kind: 'singleDate',
|
|
232
|
+
initialStartDate: null,
|
|
233
|
+
initialEndDate: null,
|
|
234
|
+
daySize: 40
|
|
235
|
+
});
|
|
236
|
+
//# sourceMappingURL=DatePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Forms/components/DatePicker/DatePicker.js"],"names":["ArrowNext","ArrowBack","DatePicker","props","setState","prevState","isFocused","focusedInput","date","datePickerRef","current","currentMonth","onSelectDate","startDate","endDate","onSelectDateRange","state","initialStartDate","initialEndDate","React","createRef","nextProps","kind","rest","handleDateChange","toggleFocus","handleDatesChange","handleFocusChange","Component","daySize"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AAIA;;IACOA,S,YAAAA,S;;;;;;;;AAAAA,S;;;;;;;IACAC,S,YAAAA,S;;;;;;;;AAAAA,S;;;;;;;IAoBcC,U;;;;;AAUpB,sBAAYC,KAAZ,EAAmB;AAAA;;AAAA;AAClB,sHAAMA,KAAN;AADkB,oGAmBL,YAAM;AACnB,YAAKC,QAAL,CAAc,UAAAC,SAAS;AAAA,eAAK;AAC3BC,UAAAA,SAAS,EAAE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EAAE,KAAKG,iBADrB;AAEC,QAAA,aAAa,EAAE,KAAKC,iBAFrB;AAGC,QAAA,YAAY,EAAEpB,YAHf;AAIC,QAAA,SAAS,EAAEM,SAJZ;AAKC,QAAA,OAAO,EAAEC,OALV;AAMC,QAAA,OAAO,EAAE,gCAAC,SAAD,OANV;AAOC,QAAA,OAAO,EAAE,gCAAC,SAAD,OAPV;AAQC,QAAA,0BAA0B,EAAE;AAR7B,SASKS,IATL,EAdD;AA0BA;;;EA9FsCK,gB;;;iCAAnB1B,U,kBAGE;AACrBoB,EAAAA,IAAI,EAAE,YADe;AAErBL,EAAAA,gBAAgB,EAAE,IAFG;AAGrBC,EAAAA,cAAc,EAAE,IAHK;AAIrBW,EAAAA,OAAO,EAAE;AAJY,C","sourcesContent":["// @flow\nimport React, { Component } from 'react'\nimport 'react-dates/initialize'\nimport {\n\tDayPickerSingleDateController,\n\tDayPickerRangeController\n} from 'react-dates'\nimport moment from 'moment'\nimport ArrowNext from '../../../../../static/assets/icons/ic_arrow_forward.svg'\nimport ArrowBack from '../../../../../static/assets/icons/ic_arrow_back.svg'\n\nexport type Props = {\n\tkind: 'singleDate' | 'dateRange',\n\tonSelectDate?: Function,\n\tonSelectDateRange?: Function,\n\tdate?: Object,\n\tinitialStartDate?: Object,\n\tinitialEndDate?: Object,\n\tdaySize?: number\n}\n\ntype State = {\n\tdate: Object,\n\tstartDate: Object,\n\tendDate: Object,\n\tisFocused: boolean,\n\tfocusedInput: string\n}\n\nexport default class DatePicker extends Component<Props, State> {\n\tdatePickerRef: any\n\n\tstatic defaultProps = {\n\t\tkind: 'singleDate',\n\t\tinitialStartDate: null,\n\t\tinitialEndDate: null,\n\t\tdaySize: 40\n\t}\n\n\tconstructor(props) {\n\t\tsuper(props)\n\t\tthis.state = {\n\t\t\tisFocused: true,\n\t\t\tdate: this.props.date || moment(),\n\t\t\tstartDate: this.props.initialStartDate,\n\t\t\tendDate: this.props.initialEndDate,\n\t\t\tfocusedInput: 'startDate'\n\t\t}\n\n\t\tthis.datePickerRef = React.createRef()\n\t}\n\n\tcomponentWillReceiveProps(nextProps) {\n\t\tif (this.props.date !== nextProps.date) {\n\t\t\tthis.setState({ date: nextProps.date })\n\t\t}\n\t}\n\n\ttoggleFocus = () => {\n\t\tthis.setState(prevState => ({\n\t\t\tisFocused: !prevState.isFocused\n\t\t}))\n\t}\n\n\thandleFocusChange = focusedInput => {\n\t\tthis.setState({\n\t\t\t// Force the focusedInput to always be truthy so that dates are always selectable\n\t\t\tfocusedInput: !focusedInput ? 'startDate' : focusedInput\n\t\t})\n\t}\n\n\thandleDateChange = async (date: any) => {\n\t\tthis.datePickerRef.current.setState({ currentMonth: date })\n\n\t\tthis.setState({\n\t\t\tdate\n\t\t})\n\t\tif (this.props.onSelectDate) {\n\t\t\tthis.props.onSelectDate(date)\n\t\t}\n\t}\n\n\thandleDatesChange = async ({ startDate, endDate }) => {\n\t\tthis.setState({\n\t\t\tstartDate,\n\t\t\tendDate\n\t\t})\n\n\t\tif (this.props.onSelectDateRange) {\n\t\t\tthis.props.onSelectDateRange({ startDate, endDate })\n\t\t}\n\t}\n\n\trender() {\n\t\tconst { isFocused, focusedInput, date, startDate, endDate } = this.state\n\t\tconst { kind, ...rest } = this.props\n\n\t\treturn kind === 'singleDate' ? (\n\t\t\t<DayPickerSingleDateController\n\t\t\t\tref={this.datePickerRef}\n\t\t\t\tdate={date}\n\t\t\t\tinitialVisibleMonth={() => date}\n\t\t\t\tfocused={isFocused}\n\t\t\t\tonDateChange={date => this.handleDateChange(date)}\n\t\t\t\tonFocusChange={this.toggleFocus}\n\t\t\t\tnavNext={<ArrowNext />}\n\t\t\t\tnavPrev={<ArrowBack />}\n\t\t\t\thideKeyboardShortcutsPanel={true}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t) : (\n\t\t\t<DayPickerRangeController\n\t\t\t\tonDatesChange={this.handleDatesChange}\n\t\t\t\tonFocusChange={this.handleFocusChange}\n\t\t\t\tfocusedInput={focusedInput}\n\t\t\t\tstartDate={startDate}\n\t\t\t\tendDate={endDate}\n\t\t\t\tnavNext={<ArrowNext />}\n\t\t\t\tnavPrev={<ArrowBack />}\n\t\t\t\thideKeyboardShortcutsPanel={true}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t)\n\t}\n}\n"],"file":"DatePicker.js"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
|
|
12
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
|
|
16
|
+
var _TextInput = _interopRequireDefault(require("../TextInput/TextInput"));
|
|
17
|
+
|
|
18
|
+
// TODO: May be better as a stateful component in order to trim itself
|
|
19
|
+
var DomainInput = function DomainInput(props) {
|
|
20
|
+
var id = props.id,
|
|
21
|
+
rest = (0, _objectWithoutProperties2["default"])(props, ["id"]);
|
|
22
|
+
return _react["default"].createElement(_TextInput["default"], (0, _extends2["default"])({
|
|
23
|
+
id: id
|
|
24
|
+
}, rest));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var _default = DomainInput;
|
|
28
|
+
exports["default"] = _default;
|
|
29
|
+
//# sourceMappingURL=DomainInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Forms/components/DomainInput/DomainInput.js"],"names":["DomainInput","props","id","rest"],"mappings":";;;;;;;;;;;;;AAEA;;AACA;;AAFA;AASA,IAAMA,WAAW,GAAG,SAAdA,WAAc,CAACC,KAAD,EAAkB;AAAA,MAC7BC,EAD6B,GACbD,KADa,CAC7BC,EAD6B;AAAA,MACtBC,IADsB,6CACbF,KADa;AAErC,SAAO,gCAAC,qBAAD;AAAW,IAAA,EAAE,EAAEC;AAAf,KAAuBC,IAAvB,EAAP;AACA,CAHD;;eAKeH,W","sourcesContent":["// @flow\n// TODO: May be better as a stateful component in order to trim itself\nimport React from 'react'\nimport TextInput from '../TextInput/TextInput'\n\ntype Props = {\n\t/** Unique identifier */\n\tid: string\n}\n\nconst DomainInput = (props: Props) => {\n\tconst { id, ...rest } = props\n\treturn <TextInput id={id} {...rest} />\n}\n\nexport default DomainInput\n"],"file":"DomainInput.js"}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
+
|
|
16
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
+
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
+
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
+
|
|
22
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
23
|
+
|
|
24
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
25
|
+
|
|
26
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
27
|
+
|
|
28
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
29
|
+
|
|
30
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
31
|
+
|
|
32
|
+
var _lodash = require("lodash");
|
|
33
|
+
|
|
34
|
+
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
35
|
+
|
|
36
|
+
var _Autosuggest = _interopRequireDefault(require("../Autosuggest/Autosuggest"));
|
|
37
|
+
|
|
38
|
+
var _Button = _interopRequireDefault(require("../../../Button/Button"));
|
|
39
|
+
|
|
40
|
+
var DurationInput =
|
|
41
|
+
/*#__PURE__*/
|
|
42
|
+
function (_Component) {
|
|
43
|
+
(0, _inherits2["default"])(DurationInput, _Component);
|
|
44
|
+
(0, _createClass2["default"])(DurationInput, null, [{
|
|
45
|
+
key: "getDerivedStateFromProps",
|
|
46
|
+
value: function getDerivedStateFromProps(props, state) {
|
|
47
|
+
if (props.value !== state.prevPropsValue) {
|
|
48
|
+
return {
|
|
49
|
+
prevPropsValue: props.value,
|
|
50
|
+
value: DurationInput.minutesToStr(props.value)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}]);
|
|
57
|
+
|
|
58
|
+
function DurationInput(props) {
|
|
59
|
+
var _this;
|
|
60
|
+
|
|
61
|
+
(0, _classCallCheck2["default"])(this, DurationInput);
|
|
62
|
+
_this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(DurationInput).call(this, props));
|
|
63
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "renderSuggestion", function (suggestion) {
|
|
64
|
+
if (suggestion.isEmptyMessage) {
|
|
65
|
+
var _this$props = _this.props,
|
|
66
|
+
noResultsTitle = _this$props.noResultsTitle,
|
|
67
|
+
noResultsSubtitle = _this$props.noResultsSubtitle;
|
|
68
|
+
return _react["default"].createElement("div", {
|
|
69
|
+
className: "autosuggest__no-results"
|
|
70
|
+
}, _react["default"].createElement("p", {
|
|
71
|
+
className: "autosuggest__no-results-title"
|
|
72
|
+
}, noResultsTitle), _react["default"].createElement("p", {
|
|
73
|
+
className: "autosuggest__no-results-subtitle"
|
|
74
|
+
}, noResultsSubtitle));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return _react["default"].createElement(_Button["default"], {
|
|
78
|
+
isSmall: true,
|
|
79
|
+
className: "autosuggest__list-item-inner",
|
|
80
|
+
text: suggestion.text
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "generateSuggestions", (0, _memoizeOne["default"])(function (min, max, skip) {
|
|
84
|
+
return (0, _lodash.range)(min, max + skip, skip).map(function (minutes) {
|
|
85
|
+
var duration = DurationInput.minutesToStr(minutes);
|
|
86
|
+
return {
|
|
87
|
+
text: duration,
|
|
88
|
+
search: duration.replace(/[^0-9hm]/g, ''),
|
|
89
|
+
minutes: minutes
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
}));
|
|
93
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "strToMinutes", function (str) {
|
|
94
|
+
var _this$props2 = _this.props,
|
|
95
|
+
minMinutes = _this$props2.minMinutes,
|
|
96
|
+
maxMinutes = _this$props2.maxMinutes,
|
|
97
|
+
skipMinutes = _this$props2.skipMinutes;
|
|
98
|
+
|
|
99
|
+
var suggestions = _this.generateSuggestions(minMinutes, maxMinutes, skipMinutes);
|
|
100
|
+
|
|
101
|
+
var idx = (0, _lodash.findIndex)(suggestions, function (suggestion) {
|
|
102
|
+
return suggestion.text === str;
|
|
103
|
+
});
|
|
104
|
+
var suggestion = suggestions[idx];
|
|
105
|
+
return suggestion.minutes;
|
|
106
|
+
});
|
|
107
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleChange", function (e) {
|
|
108
|
+
var value = e.target.value;
|
|
109
|
+
|
|
110
|
+
_this.setState({
|
|
111
|
+
value: value
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleBlur", function (e) {
|
|
115
|
+
var _this$props3 = _this.props,
|
|
116
|
+
onBlur = _this$props3.onBlur,
|
|
117
|
+
onChange = _this$props3.onChange,
|
|
118
|
+
required = _this$props3.required;
|
|
119
|
+
|
|
120
|
+
if (!required && (!value || value.length === 0)) {
|
|
121
|
+
_this.setState({
|
|
122
|
+
value: '',
|
|
123
|
+
validationError: null
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
onChange && onChange(null, e);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
var value = e.target.value;
|
|
130
|
+
|
|
131
|
+
var matches = _this.searchSuggestions(value);
|
|
132
|
+
|
|
133
|
+
if (value.length > 0 && matches.length > 0) {
|
|
134
|
+
_this.setState({
|
|
135
|
+
value: matches[0].text,
|
|
136
|
+
validationError: null
|
|
137
|
+
}); // only fire on change if the new value is valid
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
onChange && onChange(_this.strToMinutes(matches[0].text), e);
|
|
141
|
+
} else if (required && value.length > 0) {
|
|
142
|
+
_this.setState({
|
|
143
|
+
validationError: 'You must select a valid duration.'
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
onBlur && onBlur(e);
|
|
148
|
+
});
|
|
149
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleSelectSuggestion", function (e, suggestion) {
|
|
150
|
+
var onChange = _this.props.onChange;
|
|
151
|
+
var value = suggestion.suggestionValue;
|
|
152
|
+
|
|
153
|
+
_this.setState({
|
|
154
|
+
value: value
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
var matches = _this.searchSuggestions(value);
|
|
158
|
+
|
|
159
|
+
if (value.length > 0 && matches.length > 0) {
|
|
160
|
+
_this.setState({
|
|
161
|
+
value: matches[0].text,
|
|
162
|
+
validationError: null
|
|
163
|
+
}); // only fire on change if the new value is valid
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
onChange && onChange(_this.strToMinutes(matches[0].text), e);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleGetSuggestions", function (value) {
|
|
170
|
+
var matches = _this.searchSuggestions(value); // Here you could add click events to buttons or whatever else they need
|
|
171
|
+
// No Results Message
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
if (matches.length === 0) {
|
|
175
|
+
return [{
|
|
176
|
+
text: 'NO RESULTS',
|
|
177
|
+
isEmptyMessage: true
|
|
178
|
+
}];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return matches;
|
|
182
|
+
});
|
|
183
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "searchSuggestions", (0, _memoizeOne["default"])(function (value) {
|
|
184
|
+
var _this$props4 = _this.props,
|
|
185
|
+
minMinutes = _this$props4.minMinutes,
|
|
186
|
+
maxMinutes = _this$props4.maxMinutes,
|
|
187
|
+
skipMinutes = _this$props4.skipMinutes;
|
|
188
|
+
var search = value.replace(/[^0-9hm]/g, ''); // we typed something, but it was nothing valid
|
|
189
|
+
|
|
190
|
+
if (value.length > 0 && search.length === 0) {
|
|
191
|
+
return [];
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
var suggestions = _this.generateSuggestions(minMinutes, maxMinutes, skipMinutes);
|
|
195
|
+
|
|
196
|
+
var results = suggestions.filter(function (suggestion) {
|
|
197
|
+
return suggestion.search.search(search) > -1;
|
|
198
|
+
});
|
|
199
|
+
return results;
|
|
200
|
+
}));
|
|
201
|
+
_this.state = {
|
|
202
|
+
value: props.defaultValue || props.value ? DurationInput.minutesToStr(props.defaultValue || props.value) : '',
|
|
203
|
+
prevPropsValue: props.value,
|
|
204
|
+
validationError: null
|
|
205
|
+
};
|
|
206
|
+
return _this;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
(0, _createClass2["default"])(DurationInput, [{
|
|
210
|
+
key: "render",
|
|
211
|
+
value: function render() {
|
|
212
|
+
var _this$props5 = this.props,
|
|
213
|
+
minMinutes = _this$props5.minMinutes,
|
|
214
|
+
maxMinutes = _this$props5.maxMinutes,
|
|
215
|
+
skipMinutes = _this$props5.skipMinutes,
|
|
216
|
+
error = _this$props5.error,
|
|
217
|
+
placeholder = _this$props5.placeholder,
|
|
218
|
+
props = (0, _objectWithoutProperties2["default"])(_this$props5, ["minMinutes", "maxMinutes", "skipMinutes", "error", "placeholder"]);
|
|
219
|
+
var _this$state = this.state,
|
|
220
|
+
value = _this$state.value,
|
|
221
|
+
validationError = _this$state.validationError;
|
|
222
|
+
var suggestions = this.generateSuggestions(minMinutes, maxMinutes, skipMinutes);
|
|
223
|
+
return _react["default"].createElement(_Autosuggest["default"], (0, _extends2["default"])({
|
|
224
|
+
inputProps: {
|
|
225
|
+
value: value,
|
|
226
|
+
onChange: this.handleChange,
|
|
227
|
+
onBlur: this.handleBlur
|
|
228
|
+
},
|
|
229
|
+
error: validationError || error,
|
|
230
|
+
defaultSuggestions: suggestions,
|
|
231
|
+
shouldRenderSuggestions: function shouldRenderSuggestions() {
|
|
232
|
+
return true;
|
|
233
|
+
},
|
|
234
|
+
renderSuggestion: this.renderSuggestion,
|
|
235
|
+
getSuggestionValue: function getSuggestionValue(value) {
|
|
236
|
+
return value.text;
|
|
237
|
+
},
|
|
238
|
+
getSuggestions: this.handleGetSuggestions,
|
|
239
|
+
onSuggestionSelected: this.handleSelectSuggestion,
|
|
240
|
+
placeholder: placeholder && typeof placeholder === 'number' ? DurationInput.minutesToStr(placeholder) : placeholder
|
|
241
|
+
}, props));
|
|
242
|
+
}
|
|
243
|
+
}]);
|
|
244
|
+
return DurationInput;
|
|
245
|
+
}(_react.Component);
|
|
246
|
+
|
|
247
|
+
exports["default"] = DurationInput;
|
|
248
|
+
(0, _defineProperty2["default"])(DurationInput, "defaultProps", {
|
|
249
|
+
minMinutes: 5,
|
|
250
|
+
maxMinutes: 180,
|
|
251
|
+
skipMinutes: 5,
|
|
252
|
+
noResultsTitle: 'Invalid duration.',
|
|
253
|
+
noResultsSubtitle: 'Please adjust your search and try again.'
|
|
254
|
+
});
|
|
255
|
+
(0, _defineProperty2["default"])(DurationInput, "minutesToStr", function (num) {
|
|
256
|
+
var hours = Math.floor(num / 60);
|
|
257
|
+
var minutes = num % 60;
|
|
258
|
+
var value = '';
|
|
259
|
+
|
|
260
|
+
if (hours > 0) {
|
|
261
|
+
value += "".concat(hours, "hr");
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (minutes > 0) {
|
|
265
|
+
value += "".concat(minutes, "min");
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return value.trim();
|
|
269
|
+
});
|
|
270
|
+
//# sourceMappingURL=DurationInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Forms/components/DurationInput/DurationInput.js"],"names":["DurationInput","props","state","value","prevPropsValue","minutesToStr","suggestion","isEmptyMessage","noResultsTitle","noResultsSubtitle","text","min","max","skip","map","minutes","duration","search","replace","str","minMinutes","maxMinutes","skipMinutes","suggestions","generateSuggestions","idx","e","target","setState","onBlur","onChange","required","length","validationError","matches","searchSuggestions","strToMinutes","suggestionValue","results","filter","defaultValue","error","placeholder","handleChange","handleBlur","renderSuggestion","handleGetSuggestions","handleSelectSuggestion","Component","num","hours","Math","floor","trim"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AAEA;;AACA;;IA0CqBA,a;;;;;;6CASYC,K,EAAOC,K,EAAO;AAC7C,UAAID,KAAK,CAACE,KAAN,KAAgBD,KAAK,CAACE,cAA1B,EAA0C;AACzC,eAAO;AACNA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cAAc,EAAE,mBAJK;AAKrBC,EAAAA,iBAAiB,EAAE;AALE,C;iCADFT,a,kBAmBE,UAACiD,GAAD,EAAyB;AAC9C,MAAIC,KAAK,GAAGC,IAAI,CAACC,KAAL,CAAWH,GAAG,GAAG,EAAjB,CAAZ;AACA,MAAIlC,OAAO,GAAGkC,GAAG,GAAG,EAApB;AAEA,MAAI9C,KAAK,GAAG,EAAZ;;AAEA,MAAI+C,KAAK,GAAG,CAAZ,EAAe;AACd/C,IAAAA,KAAK,cAAO+C,KAAP,OAAL;AACA;;AAED,MAAInC,OAAO,GAAG,CAAd,EAAiB;AAChBZ,IAAAA,KAAK,cAAOY,OAAP,QAAL;AACA;;AAED,SAAOZ,KAAK,CAACkD,IAAN,EAAP;AACA,C","sourcesContent":["// @flow\nimport React, { Component } from 'react'\nimport { range, findIndex } from 'lodash'\nimport memoize from 'memoize-one'\n\nimport Autosuggest from '../Autosuggest/Autosuggest'\nimport Button from '../../../Button/Button'\n\nimport type { Props as AutoSuggestProps } from '../Autosuggest/Autosuggest'\n\ntype Props = {\n\t/** minimum time someone can select */\n\tminMinutes?: number,\n\n\t/** maximum time someone can select */\n\tmaxMinutes?: number,\n\n\t/** when generating suggestions, how much much time is there between suggestions */\n\tskipMinutes?: number,\n\n\t/** Default value (in minutes) */\n\tdefaultValue?: number,\n\n\t/** placeholder to be formatted nicely (expects minutes) */\n\tplaceholder?: string,\n\n\t/** title rendered when no results are found */\n\tnoResultsTitle?: string,\n\n\t/** subtitle rendered when no results are found */\n\tnoResultsSubtitle?: string,\n\n\t/** pass an error message to the input, this is show only after a valid duration is selected */\n\terror?: string,\n\n\t/** is this field required? */\n\trequired?: boolean,\n\n\t/** a slighly different onChange */\n\tonChange?: (durationInMinutes: number | null, e: KeyboardEvent) => {}\n} & AutoSuggestProps\n\ntype State = {\n\tvalue: ?string,\n\tprevPropsValue: ?string,\n\tvalidationError: ?string\n}\n\nexport default class DurationInput extends Component<Props, State> {\n\tstatic defaultProps = {\n\t\tminMinutes: 5,\n\t\tmaxMinutes: 180,\n\t\tskipMinutes: 5,\n\t\tnoResultsTitle: 'Invalid duration.',\n\t\tnoResultsSubtitle: 'Please adjust your search and try again.'\n\t}\n\n\tstatic getDerivedStateFromProps(props, state) {\n\t\tif (props.value !== state.prevPropsValue) {\n\t\t\treturn {\n\t\t\t\tprevPropsValue: props.value,\n\t\t\t\tvalue: DurationInput.minutesToStr(props.value)\n\t\t\t}\n\t\t}\n\t\treturn null\n\t}\n\n\tstatic minutesToStr = (num: number): string => {\n\t\tlet hours = Math.floor(num / 60)\n\t\tlet minutes = num % 60\n\n\t\tlet value = ''\n\n\t\tif (hours > 0) {\n\t\t\tvalue += `${hours}hr`\n\t\t}\n\n\t\tif (minutes > 0) {\n\t\t\tvalue += `${minutes}min`\n\t\t}\n\n\t\treturn value.trim()\n\t}\n\n\tconstructor(props: Props) {\n\t\tsuper(props)\n\t\tthis.state = {\n\t\t\tvalue:\n\t\t\t\tprops.defaultValue || props.value\n\t\t\t\t\t? DurationInput.minutesToStr(props.defaultValue || props.value)\n\t\t\t\t\t: '',\n\t\t\tprevPropsValue: props.value,\n\t\t\tvalidationError: null\n\t\t}\n\t}\n\n\trenderSuggestion = (suggestion: any) => {\n\t\tif (suggestion.isEmptyMessage) {\n\t\t\tconst { noResultsTitle, noResultsSubtitle } = this.props\n\t\t\treturn (\n\t\t\t\t<div className=\"autosuggest__no-results\">\n\t\t\t\t\t<p className=\"autosuggest__no-results-title\">{noResultsTitle}</p>\n\t\t\t\t\t<p className=\"autosuggest__no-results-subtitle\">\n\t\t\t\t\t\t{noResultsSubtitle}\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t)\n\t\t}\n\t\treturn (\n\t\t\t<Button\n\t\t\t\tisSmall\n\t\t\t\tclassName=\"autosuggest__list-item-inner\"\n\t\t\t\ttext={suggestion.text}\n\t\t\t/>\n\t\t)\n\t}\n\n\tgenerateSuggestions = memoize((min, max, skip) => {\n\t\treturn range(min, max + skip, skip).map(minutes => {\n\t\t\tconst duration = DurationInput.minutesToStr(minutes)\n\t\t\treturn {\n\t\t\t\ttext: duration,\n\t\t\t\tsearch: duration.replace(/[^0-9hm]/g, ''),\n\t\t\t\tminutes\n\t\t\t}\n\t\t})\n\t})\n\n\tstrToMinutes = (str: string): number => {\n\t\tconst { minMinutes, maxMinutes, skipMinutes } = this.props\n\t\tconst suggestions = this.generateSuggestions(\n\t\t\tminMinutes,\n\t\t\tmaxMinutes,\n\t\t\tskipMinutes\n\t\t)\n\t\tconst idx = findIndex(suggestions, suggestion => suggestion.text === str)\n\n\t\tconst suggestion = suggestions[idx]\n\t\treturn suggestion.minutes\n\t}\n\n\thandleChange = e => {\n\t\tconst { value } = e.target\n\t\tthis.setState({ value })\n\t}\n\n\thandleBlur = e => {\n\t\tconst { onBlur, onChange, required } = this.props\n\n\t\tif (!required && (!value || value.length === 0)) {\n\t\t\tthis.setState({ value: '', validationError: null })\n\t\t\tonChange && onChange(null, e)\n\t\t}\n\n\t\tconst value = e.target.value\n\t\tconst matches = this.searchSuggestions(value)\n\n\t\tif (value.length > 0 && matches.length > 0) {\n\t\t\tthis.setState({ value: matches[0].text, validationError: null })\n\t\t\t// only fire on change if the new value is valid\n\t\t\tonChange && onChange(this.strToMinutes(matches[0].text), e)\n\t\t} else if (required && value.length > 0) {\n\t\t\tthis.setState({ validationError: 'You must select a valid duration.' })\n\t\t}\n\n\t\tonBlur && onBlur(e)\n\t}\n\n\thandleSelectSuggestion = (e: KeyboardEvent, suggestion: Object) => {\n\t\tconst { onChange } = this.props\n\n\t\tconst value = suggestion.suggestionValue\n\n\t\tthis.setState({ value })\n\t\tconst matches = this.searchSuggestions(value)\n\n\t\tif (value.length > 0 && matches.length > 0) {\n\t\t\tthis.setState({ value: matches[0].text, validationError: null })\n\t\t\t// only fire on change if the new value is valid\n\t\t\tonChange && onChange(this.strToMinutes(matches[0].text), e)\n\t\t}\n\t}\n\n\thandleGetSuggestions = value => {\n\t\tconst matches = this.searchSuggestions(value)\n\t\t// Here you could add click events to buttons or whatever else they need\n\t\t// No Results Message\n\t\tif (matches.length === 0) {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttext: 'NO RESULTS',\n\t\t\t\t\tisEmptyMessage: true\n\t\t\t\t}\n\t\t\t]\n\t\t}\n\t\treturn matches\n\t}\n\n\tsearchSuggestions = memoize(\n\t\t(value): Array<string> => {\n\t\t\tconst { minMinutes, maxMinutes, skipMinutes } = this.props\n\n\t\t\tconst search = value.replace(/[^0-9hm]/g, '')\n\n\t\t\t// we typed something, but it was nothing valid\n\t\t\tif (value.length > 0 && search.length === 0) {\n\t\t\t\treturn []\n\t\t\t}\n\n\t\t\tconst suggestions = this.generateSuggestions(\n\t\t\t\tminMinutes,\n\t\t\t\tmaxMinutes,\n\t\t\t\tskipMinutes\n\t\t\t)\n\n\t\t\tconst results = suggestions.filter(\n\t\t\t\tsuggestion => suggestion.search.search(search) > -1\n\t\t\t)\n\n\t\t\treturn results\n\t\t}\n\t)\n\n\trender() {\n\t\tconst {\n\t\t\tminMinutes,\n\t\t\tmaxMinutes,\n\t\t\tskipMinutes,\n\t\t\terror,\n\t\t\tplaceholder,\n\t\t\t...props\n\t\t} = this.props\n\n\t\tconst { value, validationError } = this.state\n\n\t\tconst suggestions = this.generateSuggestions(\n\t\t\tminMinutes,\n\t\t\tmaxMinutes,\n\t\t\tskipMinutes\n\t\t)\n\n\t\treturn (\n\t\t\t<Autosuggest\n\t\t\t\tinputProps={{\n\t\t\t\t\tvalue,\n\t\t\t\t\tonChange: this.handleChange,\n\t\t\t\t\tonBlur: this.handleBlur\n\t\t\t\t}}\n\t\t\t\terror={validationError || error}\n\t\t\t\tdefaultSuggestions={suggestions}\n\t\t\t\tshouldRenderSuggestions={() => true}\n\t\t\t\trenderSuggestion={this.renderSuggestion}\n\t\t\t\tgetSuggestionValue={value => value.text}\n\t\t\t\tgetSuggestions={this.handleGetSuggestions}\n\t\t\t\tonSuggestionSelected={this.handleSelectSuggestion}\n\t\t\t\tplaceholder={\n\t\t\t\t\tplaceholder && typeof placeholder === 'number'\n\t\t\t\t\t\t? DurationInput.minutesToStr(placeholder)\n\t\t\t\t\t\t: placeholder\n\t\t\t\t}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t)\n\t}\n}\n"],"file":"DurationInput.js"}
|