@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,357 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
|
|
9
|
+
var _react2 = require("@storybook/react");
|
|
10
|
+
|
|
11
|
+
var _react3 = require("@storybook/addon-knobs/react");
|
|
12
|
+
|
|
13
|
+
var _FormBuilder = _interopRequireDefault(require("./FormBuilder"));
|
|
14
|
+
|
|
15
|
+
var _Modal = _interopRequireDefault(require("../../../Modal/Modal"));
|
|
16
|
+
|
|
17
|
+
var _Page = _interopRequireWildcard(require("../../../Page"));
|
|
18
|
+
|
|
19
|
+
var _Card = require("../../../Card");
|
|
20
|
+
|
|
21
|
+
var _Layout = _interopRequireWildcard(require("../../../Layout"));
|
|
22
|
+
|
|
23
|
+
var stories = (0, _react2.storiesOf)('FormBuilder', module);
|
|
24
|
+
stories.addDecorator(_react3.withKnobs); // stories.addDecorator(withLayout)
|
|
25
|
+
|
|
26
|
+
stories.add('Basic', function () {
|
|
27
|
+
return _react["default"].createElement(_Page["default"], null, _react["default"].createElement(_Page.PageContent, null, _react["default"].createElement(_Layout["default"], null, _react["default"].createElement(_Layout.LayoutSection, null, _react["default"].createElement(_Card.Card, null, _react["default"].createElement(_Card.CardBody, null, _react["default"].createElement(_FormBuilder["default"], {
|
|
28
|
+
kind: "page" // validate={console.log}
|
|
29
|
+
,
|
|
30
|
+
sections: (0, _react3.object)('sections', [{
|
|
31
|
+
title: 'Appointment Settings',
|
|
32
|
+
fields: [{
|
|
33
|
+
name: 'guestSMSCancellations',
|
|
34
|
+
type: 'boolean',
|
|
35
|
+
props: {
|
|
36
|
+
label: 'Guest SMS cancellations',
|
|
37
|
+
helper: 'Guests can cancel an appointment via SMS'
|
|
38
|
+
}
|
|
39
|
+
}, {
|
|
40
|
+
name: 'Personalized Message',
|
|
41
|
+
type: 'text',
|
|
42
|
+
props: {
|
|
43
|
+
label: 'Confirmation message',
|
|
44
|
+
helper: 'You have {{Organization.name}} and {{Location.name}}'
|
|
45
|
+
}
|
|
46
|
+
}]
|
|
47
|
+
}]),
|
|
48
|
+
initialValues: {},
|
|
49
|
+
formLayout: {
|
|
50
|
+
spacing: 'base'
|
|
51
|
+
},
|
|
52
|
+
onSubmit: function onSubmit(values) {
|
|
53
|
+
return console.log('Submit', {
|
|
54
|
+
values: values
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
})))))));
|
|
58
|
+
}).add('With Submit', function () {
|
|
59
|
+
return _react["default"].createElement(_Page["default"], null, _react["default"].createElement(_Page.PageContent, null, _react["default"].createElement(_Layout["default"], null, _react["default"].createElement(_Layout.LayoutSection, null, _react["default"].createElement(_Card.Card, null, _react["default"].createElement(_Card.CardBody, null, _react["default"].createElement(_FormBuilder["default"], {
|
|
60
|
+
validate: function validate(values) {
|
|
61
|
+
console.log('Validate: ', {
|
|
62
|
+
values: values
|
|
63
|
+
});
|
|
64
|
+
var errors = {};
|
|
65
|
+
|
|
66
|
+
if (!values.publicName) {
|
|
67
|
+
errors.publicName = 'Please include a public name';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (!values.streetAddress) {
|
|
71
|
+
errors.streetAddress = 'Please include a street address';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (!values.city) {
|
|
75
|
+
errors.city = 'Please include a city';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (!values.postalCode) {
|
|
79
|
+
errors.postalCode = 'Please include a postal/zip code';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (!values.country) {
|
|
83
|
+
errors.country = 'Please include a country';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (!values.region) {
|
|
87
|
+
errors.region = 'Please include a state or region';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return errors;
|
|
91
|
+
},
|
|
92
|
+
onSubmit: function onSubmit(values) {
|
|
93
|
+
return console.log('Submit', {
|
|
94
|
+
values: values
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
initialValues: {
|
|
98
|
+
publicName: 'Chimera Hair Salon',
|
|
99
|
+
streetAddress: '',
|
|
100
|
+
streetAddress2: '',
|
|
101
|
+
city: '',
|
|
102
|
+
postalCode: '',
|
|
103
|
+
country: 'United States',
|
|
104
|
+
region: ''
|
|
105
|
+
},
|
|
106
|
+
formLayout: {
|
|
107
|
+
spacing: 'tight'
|
|
108
|
+
},
|
|
109
|
+
sections: (0, _react3.object)('sections', [{
|
|
110
|
+
fields: [{
|
|
111
|
+
type: 'text',
|
|
112
|
+
name: 'publicName',
|
|
113
|
+
props: {
|
|
114
|
+
label: 'Public Name',
|
|
115
|
+
helper: 'This is the name that your guests will see',
|
|
116
|
+
required: true
|
|
117
|
+
}
|
|
118
|
+
}, {
|
|
119
|
+
type: 'text',
|
|
120
|
+
name: 'streetAddress',
|
|
121
|
+
props: {
|
|
122
|
+
label: 'Street Address',
|
|
123
|
+
placeholder: '123 High St',
|
|
124
|
+
required: true
|
|
125
|
+
}
|
|
126
|
+
}, {
|
|
127
|
+
type: 'text',
|
|
128
|
+
name: 'streetAddress2',
|
|
129
|
+
props: {
|
|
130
|
+
label: 'Unit, Suite, Etc… (Optional)',
|
|
131
|
+
required: false
|
|
132
|
+
}
|
|
133
|
+
}, {
|
|
134
|
+
name: 'city',
|
|
135
|
+
type: 'text',
|
|
136
|
+
props: {
|
|
137
|
+
label: 'City',
|
|
138
|
+
placeholder: 'Springfield',
|
|
139
|
+
required: true
|
|
140
|
+
}
|
|
141
|
+
}, {
|
|
142
|
+
name: 'postalCode',
|
|
143
|
+
type: 'text',
|
|
144
|
+
props: {
|
|
145
|
+
label: 'Postal / Zip Code',
|
|
146
|
+
placeholder: '888888',
|
|
147
|
+
required: true
|
|
148
|
+
}
|
|
149
|
+
}, {
|
|
150
|
+
name: 'country',
|
|
151
|
+
type: 'text',
|
|
152
|
+
props: {
|
|
153
|
+
label: 'Country',
|
|
154
|
+
placeholder: 'Select an option…',
|
|
155
|
+
required: true
|
|
156
|
+
}
|
|
157
|
+
}, {
|
|
158
|
+
name: 'region',
|
|
159
|
+
type: 'text',
|
|
160
|
+
props: {
|
|
161
|
+
label: 'State',
|
|
162
|
+
placeholder: 'Select an option…',
|
|
163
|
+
required: true
|
|
164
|
+
}
|
|
165
|
+
}]
|
|
166
|
+
}]),
|
|
167
|
+
primaryCTA: {
|
|
168
|
+
text: 'Add location'
|
|
169
|
+
}
|
|
170
|
+
})))))));
|
|
171
|
+
}).add('Settings page', function () {
|
|
172
|
+
return _react["default"].createElement(_Page["default"], null, _react["default"].createElement(_Page.PageContent, null, _react["default"].createElement(_FormBuilder["default"], {
|
|
173
|
+
kind: "page",
|
|
174
|
+
initialValues: {
|
|
175
|
+
pastApptEditingCutoff: '45min',
|
|
176
|
+
pastApptBookingCutoff: '10min',
|
|
177
|
+
guestUpdateDelays: '1min',
|
|
178
|
+
autoConfirmAppts: true,
|
|
179
|
+
apptReminder1: '24hrs',
|
|
180
|
+
apptReminder1Buffer: '48hrs',
|
|
181
|
+
apptReminder2: '1hr',
|
|
182
|
+
apptReminder2Buffer: '2hrs'
|
|
183
|
+
},
|
|
184
|
+
validate: function validate(values) {
|
|
185
|
+
var errors = {};
|
|
186
|
+
|
|
187
|
+
if (!values.pastApptEditingCutoff) {
|
|
188
|
+
errors.pastApptEditingCutoff = 'Please include a cutoff time';
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
if (!values.pastApptBookingCutoff) {
|
|
192
|
+
errors.pastApptBookingCutoff = 'Please include a cutoff time';
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
if (!values.guestUpdateDelays) {
|
|
196
|
+
errors.guestUpdateDelays = 'Please include a delay';
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (!values.apptReminder1) {
|
|
200
|
+
errors.apptReminder1 = 'Please include a reminder time';
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (!values.apptReminder1Buffer) {
|
|
204
|
+
errors.apptReminder1Buffer = 'Please include a buffer time';
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (!values.apptReminder2) {
|
|
208
|
+
errors.apptReminder2 = 'Please include a reminder time';
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (!values.apptReminder2Buffer) {
|
|
212
|
+
errors.apptReminder2Buffer = 'Please include a buffer time';
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return errors;
|
|
216
|
+
},
|
|
217
|
+
onSubmit: function onSubmit(values) {
|
|
218
|
+
return console.log('Submit', {
|
|
219
|
+
values: values
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
formLayout: {
|
|
223
|
+
spacing: 'tight'
|
|
224
|
+
},
|
|
225
|
+
sections: (0, _react3.object)('sections', [{
|
|
226
|
+
title: 'Appointment settings',
|
|
227
|
+
fields: [{
|
|
228
|
+
type: 'duration',
|
|
229
|
+
name: 'pastApptEditingCutoff',
|
|
230
|
+
props: {
|
|
231
|
+
minMinutes: 5,
|
|
232
|
+
maxMinutes: 60 * 5,
|
|
233
|
+
label: 'Cutoff for editing appointments in the past',
|
|
234
|
+
helper: 'Once an appointment is past, how many minutes should I wait until I block the ability to edit it? Note: Paid appointments cannot be edited.',
|
|
235
|
+
required: true
|
|
236
|
+
}
|
|
237
|
+
}, {
|
|
238
|
+
type: 'text',
|
|
239
|
+
name: 'pastApptBookingCutoff',
|
|
240
|
+
props: {
|
|
241
|
+
label: 'Booking past appointment cutoff',
|
|
242
|
+
helper: 'How far in the past should I allow appointments to be booked?',
|
|
243
|
+
required: true
|
|
244
|
+
}
|
|
245
|
+
}, {
|
|
246
|
+
type: 'text',
|
|
247
|
+
name: 'guestUpdateDelays',
|
|
248
|
+
props: {
|
|
249
|
+
label: 'Guest update delays',
|
|
250
|
+
helper: 'How long should I wait before sending an update text to the guest when changes are made to their appointment? This gives you time to make a few edits back-to-back without the guest receiving a ton of texts.',
|
|
251
|
+
required: true
|
|
252
|
+
}
|
|
253
|
+
}, {
|
|
254
|
+
name: 'autoConfirm',
|
|
255
|
+
type: 'boolean',
|
|
256
|
+
props: {
|
|
257
|
+
label: 'Auto-Confirm Appointments',
|
|
258
|
+
helper: 'Should I auto-confirm all booked appointments?',
|
|
259
|
+
defaultValue: false
|
|
260
|
+
}
|
|
261
|
+
}]
|
|
262
|
+
}, {
|
|
263
|
+
title: 'Reminder Settings',
|
|
264
|
+
fields: [{
|
|
265
|
+
name: 'apptReminder1',
|
|
266
|
+
type: 'text',
|
|
267
|
+
props: {
|
|
268
|
+
label: 'Appointment Reminder 1',
|
|
269
|
+
helper: 'How many hours before an appointment should I send the first reminder?',
|
|
270
|
+
required: true
|
|
271
|
+
}
|
|
272
|
+
}, {
|
|
273
|
+
name: 'apptReminder1Buffer',
|
|
274
|
+
type: 'text',
|
|
275
|
+
props: {
|
|
276
|
+
label: 'Appointment Reminder 1 Buffer',
|
|
277
|
+
helper: "How many hours before an appointment does a guest need to book to activate the first reminder? Example, I don't want to send a 24 hour reminder if someone booked 25 hours ago because they'd get a confirmation text and then a reminder an hour later.",
|
|
278
|
+
required: true
|
|
279
|
+
}
|
|
280
|
+
}, {
|
|
281
|
+
name: 'apptReminder2',
|
|
282
|
+
type: 'text',
|
|
283
|
+
props: {
|
|
284
|
+
label: 'Appointment Reminder 2',
|
|
285
|
+
helper: 'How many hours before an appointment should I send the second reminder?'
|
|
286
|
+
}
|
|
287
|
+
}, {
|
|
288
|
+
name: 'apptReminder2Buffer',
|
|
289
|
+
type: 'text',
|
|
290
|
+
props: {
|
|
291
|
+
label: 'Appointment Reminder 2 Buffer',
|
|
292
|
+
helper: "How many hours before an appointment does a guest need to book to activate the second reminder? Example, I don't want to send an hour reminder if someone booked 61 minutes ago because they'd get a confirmation text and then a reminder a minute later.",
|
|
293
|
+
required: true
|
|
294
|
+
}
|
|
295
|
+
}, {
|
|
296
|
+
name: 'appointmentSync',
|
|
297
|
+
type: 'select',
|
|
298
|
+
props: {
|
|
299
|
+
label: 'How often should I sync appointments?',
|
|
300
|
+
helper: 'How often should I check for new appointments and sync them?',
|
|
301
|
+
options: {
|
|
302
|
+
hourly: 'Hourly',
|
|
303
|
+
daily: 'Daily',
|
|
304
|
+
weekly: 'Weekly'
|
|
305
|
+
},
|
|
306
|
+
defaultValue: 'weekly',
|
|
307
|
+
required: true
|
|
308
|
+
}
|
|
309
|
+
}]
|
|
310
|
+
}])
|
|
311
|
+
})));
|
|
312
|
+
}).add('In a modal', function () {
|
|
313
|
+
return _react["default"].createElement(_Page["default"], null, _react["default"].createElement(_Page.PageContent, null, _react["default"].createElement(_Modal["default"], {
|
|
314
|
+
isOpen: true,
|
|
315
|
+
isSmall: true
|
|
316
|
+
}, _react["default"].createElement(_Modal["default"].Header, {
|
|
317
|
+
title: "New location group"
|
|
318
|
+
}), _react["default"].createElement(_FormBuilder["default"], {
|
|
319
|
+
initialValues: {
|
|
320
|
+
groupName: ''
|
|
321
|
+
},
|
|
322
|
+
validate: function validate() {
|
|
323
|
+
var errors = {}; // TODO: Hook up groupName custom error
|
|
324
|
+
// if (!groupName) {
|
|
325
|
+
// errors.groupName = 'Please name this group'
|
|
326
|
+
// }
|
|
327
|
+
|
|
328
|
+
return errors;
|
|
329
|
+
},
|
|
330
|
+
onSubmit: function onSubmit(values) {
|
|
331
|
+
return console.log('Submit', {
|
|
332
|
+
values: values
|
|
333
|
+
});
|
|
334
|
+
},
|
|
335
|
+
formLayout: {
|
|
336
|
+
spacing: 'tight'
|
|
337
|
+
},
|
|
338
|
+
kind: "modal",
|
|
339
|
+
sections: [{
|
|
340
|
+
fields: [{
|
|
341
|
+
name: 'groupName',
|
|
342
|
+
type: 'text',
|
|
343
|
+
props: {
|
|
344
|
+
label: 'Group Name',
|
|
345
|
+
placeholder: 'e.g. East, West, Midwest, etc…'
|
|
346
|
+
}
|
|
347
|
+
}]
|
|
348
|
+
}],
|
|
349
|
+
primaryCTA: {
|
|
350
|
+
text: 'Create group'
|
|
351
|
+
},
|
|
352
|
+
secondaryCTA: {
|
|
353
|
+
text: 'Cancel'
|
|
354
|
+
}
|
|
355
|
+
}))));
|
|
356
|
+
});
|
|
357
|
+
//# sourceMappingURL=FormBuilder-story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Forms/components/FormBuilder/FormBuilder-story.js"],"names":["stories","module","addDecorator","withKnobs","add","title","fields","name","type","props","label","helper","spacing","values","console","log","errors","publicName","streetAddress","city","postalCode","country","region","streetAddress2","required","placeholder","text","pastApptEditingCutoff","pastApptBookingCutoff","guestUpdateDelays","autoConfirmAppts","apptReminder1","apptReminder1Buffer","apptReminder2","apptReminder2Buffer","minMinutes","maxMinutes","defaultValue","options","hourly","daily","weekly","groupName"],"mappings":";;;;;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA,IAAMA,OAAO,GAAG,uBAAU,aAAV,EAAyBC,MAAzB,CAAhB;AAEAD,OAAO,CAACE,YAAR,CAAqBC,iBAArB,E,CACA;;AAEAH,OAAO,CACLI,GADF,CACM,OADN,EACe;AAAA,SACb,gCAAC,gBAAD,QACC,gCAAC,iBAAD,QACC,gCAAC,kBAAD,QACC,gCAAC,qBAAD,QACC,gCAAC,UAAD,QACC,gCAAC,cAAD,QACC,gCAAC,uBAAD;AACC,IA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O;AApCf,IAFD,CADD,CADD,CADkB;AAAA,CAtUpB","sourcesContent":["// @flow\nimport React from 'react'\nimport { storiesOf } from '@storybook/react'\nimport { withKnobs, object } from '@storybook/addon-knobs/react'\nimport FormBuilder from './FormBuilder'\nimport Modal from '../../../Modal/Modal'\nimport Page, { PageContent } from '../../../Page'\nimport { Card, CardBody } from '../../../Card'\nimport Layout, { LayoutSection } from '../../../Layout'\n\nconst stories = storiesOf('FormBuilder', module)\n\nstories.addDecorator(withKnobs)\n// stories.addDecorator(withLayout)\n\nstories\n\t.add('Basic', () => (\n\t\t<Page>\n\t\t\t<PageContent>\n\t\t\t\t<Layout>\n\t\t\t\t\t<LayoutSection>\n\t\t\t\t\t\t<Card>\n\t\t\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t\t\t<FormBuilder\n\t\t\t\t\t\t\t\t\tkind=\"page\"\n\t\t\t\t\t\t\t\t\t// validate={console.log}\n\t\t\t\t\t\t\t\t\tsections={object('sections', [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\ttitle: 'Appointment Settings',\n\t\t\t\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tname: 'guestSMSCancellations',\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Guest SMS cancellations',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thelper: 'Guests can cancel an appointment via SMS'\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tname: 'Personalized Message',\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Confirmation message',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thelper:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'You have {{Organization.name}} and {{Location.name}}'\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t])}\n\t\t\t\t\t\t\t\t\tinitialValues={{}}\n\t\t\t\t\t\t\t\t\tformLayout={{ spacing: 'base' }}\n\t\t\t\t\t\t\t\t\tonSubmit={values => console.log('Submit', { values })}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</CardBody>\n\t\t\t\t\t\t</Card>\n\t\t\t\t\t</LayoutSection>\n\t\t\t\t</Layout>\n\t\t\t</PageContent>\n\t\t</Page>\n\t))\n\t.add('With Submit', () => (\n\t\t<Page>\n\t\t\t<PageContent>\n\t\t\t\t<Layout>\n\t\t\t\t\t<LayoutSection>\n\t\t\t\t\t\t<Card>\n\t\t\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t\t\t<FormBuilder\n\t\t\t\t\t\t\t\t\tvalidate={values => {\n\t\t\t\t\t\t\t\t\t\tconsole.log('Validate: ', { values })\n\t\t\t\t\t\t\t\t\t\tlet errors = {}\n\t\t\t\t\t\t\t\t\t\tif (!values.publicName) {\n\t\t\t\t\t\t\t\t\t\t\terrors.publicName = 'Please include a public name'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (!values.streetAddress) {\n\t\t\t\t\t\t\t\t\t\t\terrors.streetAddress = 'Please include a street address'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (!values.city) {\n\t\t\t\t\t\t\t\t\t\t\terrors.city = 'Please include a city'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (!values.postalCode) {\n\t\t\t\t\t\t\t\t\t\t\terrors.postalCode = 'Please include a postal/zip code'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (!values.country) {\n\t\t\t\t\t\t\t\t\t\t\terrors.country = 'Please include a country'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tif (!values.region) {\n\t\t\t\t\t\t\t\t\t\t\terrors.region = 'Please include a state or region'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\treturn errors\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonSubmit={values => console.log('Submit', { values })}\n\t\t\t\t\t\t\t\t\tinitialValues={{\n\t\t\t\t\t\t\t\t\t\tpublicName: 'Chimera Hair Salon',\n\t\t\t\t\t\t\t\t\t\tstreetAddress: '',\n\t\t\t\t\t\t\t\t\t\tstreetAddress2: '',\n\t\t\t\t\t\t\t\t\t\tcity: '',\n\t\t\t\t\t\t\t\t\t\tpostalCode: '',\n\t\t\t\t\t\t\t\t\t\tcountry: 'United States',\n\t\t\t\t\t\t\t\t\t\tregion: ''\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tformLayout={{\n\t\t\t\t\t\t\t\t\t\tspacing: 'tight'\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tsections={object('sections', [\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\t\tname: 'publicName',\n\t\t\t\t\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Public Name',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\thelper:\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t'This is the name that your guests will see',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trequired: true\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\t\tname: 'streetAddress',\n\t\t\t\t\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Street Address',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder: '123 High St',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trequired: true\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\t\tname: 'streetAddress2',\n\t\t\t\t\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Unit, Suite, Etc… (Optional)',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trequired: false\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tname: 'city',\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'City',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder: 'Springfield',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trequired: true\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tname: 'postalCode',\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Postal / Zip Code',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder: '888888',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trequired: true\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tname: 'country',\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'Country',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder: 'Select an option…',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trequired: true\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tname: 'region',\n\t\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: 'State',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tplaceholder: 'Select an option…',\n\t\t\t\t\t\t\t\t\t\t\t\t\t\trequired: true\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t])}\n\t\t\t\t\t\t\t\t\tprimaryCTA={{\n\t\t\t\t\t\t\t\t\t\ttext: 'Add location'\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</CardBody>\n\t\t\t\t\t\t</Card>\n\t\t\t\t\t</LayoutSection>\n\t\t\t\t</Layout>\n\t\t\t</PageContent>\n\t\t</Page>\n\t))\n\t.add('Settings page', () => (\n\t\t<Page>\n\t\t\t<PageContent>\n\t\t\t\t<FormBuilder\n\t\t\t\t\tkind=\"page\"\n\t\t\t\t\tinitialValues={{\n\t\t\t\t\t\tpastApptEditingCutoff: '45min',\n\t\t\t\t\t\tpastApptBookingCutoff: '10min',\n\t\t\t\t\t\tguestUpdateDelays: '1min',\n\t\t\t\t\t\tautoConfirmAppts: true,\n\t\t\t\t\t\tapptReminder1: '24hrs',\n\t\t\t\t\t\tapptReminder1Buffer: '48hrs',\n\t\t\t\t\t\tapptReminder2: '1hr',\n\t\t\t\t\t\tapptReminder2Buffer: '2hrs'\n\t\t\t\t\t}}\n\t\t\t\t\tvalidate={values => {\n\t\t\t\t\t\tlet errors = {}\n\t\t\t\t\t\tif (!values.pastApptEditingCutoff) {\n\t\t\t\t\t\t\terrors.pastApptEditingCutoff = 'Please include a cutoff time'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!values.pastApptBookingCutoff) {\n\t\t\t\t\t\t\terrors.pastApptBookingCutoff = 'Please include a cutoff time'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!values.guestUpdateDelays) {\n\t\t\t\t\t\t\terrors.guestUpdateDelays = 'Please include a delay'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!values.apptReminder1) {\n\t\t\t\t\t\t\terrors.apptReminder1 = 'Please include a reminder time'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!values.apptReminder1Buffer) {\n\t\t\t\t\t\t\terrors.apptReminder1Buffer = 'Please include a buffer time'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!values.apptReminder2) {\n\t\t\t\t\t\t\terrors.apptReminder2 = 'Please include a reminder time'\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!values.apptReminder2Buffer) {\n\t\t\t\t\t\t\terrors.apptReminder2Buffer = 'Please include a buffer time'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn errors\n\t\t\t\t\t}}\n\t\t\t\t\tonSubmit={values => console.log('Submit', { values })}\n\t\t\t\t\tformLayout={{\n\t\t\t\t\t\tspacing: 'tight'\n\t\t\t\t\t}}\n\t\t\t\t\tsections={object('sections', [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: 'Appointment settings',\n\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttype: 'duration',\n\t\t\t\t\t\t\t\t\tname: 'pastApptEditingCutoff',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tminMinutes: 5,\n\t\t\t\t\t\t\t\t\t\tmaxMinutes: 60 * 5,\n\t\t\t\t\t\t\t\t\t\tlabel: 'Cutoff for editing appointments in the past',\n\t\t\t\t\t\t\t\t\t\thelper:\n\t\t\t\t\t\t\t\t\t\t\t'Once an appointment is past, how many minutes should I wait until I block the ability to edit it? Note: Paid appointments cannot be edited.',\n\t\t\t\t\t\t\t\t\t\trequired: true\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\tname: 'pastApptBookingCutoff',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tlabel: 'Booking past appointment cutoff',\n\t\t\t\t\t\t\t\t\t\thelper:\n\t\t\t\t\t\t\t\t\t\t\t'How far in the past should I allow appointments to be booked?',\n\t\t\t\t\t\t\t\t\t\trequired: true\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\tname: 'guestUpdateDelays',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tlabel: 'Guest update delays',\n\t\t\t\t\t\t\t\t\t\thelper:\n\t\t\t\t\t\t\t\t\t\t\t'How long should I wait before sending an update text to the guest when changes are made to their appointment? This gives you time to make a few edits back-to-back without the guest receiving a ton of texts.',\n\t\t\t\t\t\t\t\t\t\trequired: true\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: 'autoConfirm',\n\t\t\t\t\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tlabel: 'Auto-Confirm Appointments',\n\t\t\t\t\t\t\t\t\t\thelper: 'Should I auto-confirm all booked appointments?',\n\t\t\t\t\t\t\t\t\t\tdefaultValue: false\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: 'Reminder Settings',\n\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: 'apptReminder1',\n\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tlabel: 'Appointment Reminder 1',\n\t\t\t\t\t\t\t\t\t\thelper:\n\t\t\t\t\t\t\t\t\t\t\t'How many hours before an appointment should I send the first reminder?',\n\t\t\t\t\t\t\t\t\t\trequired: true\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: 'apptReminder1Buffer',\n\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tlabel: 'Appointment Reminder 1 Buffer',\n\t\t\t\t\t\t\t\t\t\thelper:\n\t\t\t\t\t\t\t\t\t\t\t\"How many hours before an appointment does a guest need to book to activate the first reminder? Example, I don't want to send a 24 hour reminder if someone booked 25 hours ago because they'd get a confirmation text and then a reminder an hour later.\",\n\t\t\t\t\t\t\t\t\t\trequired: true\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: 'apptReminder2',\n\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tlabel: 'Appointment Reminder 2',\n\t\t\t\t\t\t\t\t\t\thelper:\n\t\t\t\t\t\t\t\t\t\t\t'How many hours before an appointment should I send the second reminder?'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: 'apptReminder2Buffer',\n\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tlabel: 'Appointment Reminder 2 Buffer',\n\t\t\t\t\t\t\t\t\t\thelper:\n\t\t\t\t\t\t\t\t\t\t\t\"How many hours before an appointment does a guest need to book to activate the second reminder? Example, I don't want to send an hour reminder if someone booked 61 minutes ago because they'd get a confirmation text and then a reminder a minute later.\",\n\t\t\t\t\t\t\t\t\t\trequired: true\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tname: 'appointmentSync',\n\t\t\t\t\t\t\t\t\ttype: 'select',\n\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\tlabel: 'How often should I sync appointments?',\n\t\t\t\t\t\t\t\t\t\thelper:\n\t\t\t\t\t\t\t\t\t\t\t'How often should I check for new appointments and sync them?',\n\t\t\t\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\t\t\t\thourly: 'Hourly',\n\t\t\t\t\t\t\t\t\t\t\tdaily: 'Daily',\n\t\t\t\t\t\t\t\t\t\t\tweekly: 'Weekly'\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\tdefaultValue: 'weekly',\n\t\t\t\t\t\t\t\t\t\trequired: true\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t])}\n\t\t\t\t/>\n\t\t\t</PageContent>\n\t\t</Page>\n\t))\n\t.add('In a modal', () => (\n\t\t<Page>\n\t\t\t<PageContent>\n\t\t\t\t<Modal isOpen isSmall>\n\t\t\t\t\t<Modal.Header title=\"New location group\" />\n\t\t\t\t\t<FormBuilder\n\t\t\t\t\t\tinitialValues={{\n\t\t\t\t\t\t\tgroupName: ''\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tvalidate={() => {\n\t\t\t\t\t\t\tlet errors = {}\n\n\t\t\t\t\t\t\t// TODO: Hook up groupName custom error\n\t\t\t\t\t\t\t// if (!groupName) {\n\t\t\t\t\t\t\t// \terrors.groupName = 'Please name this group'\n\t\t\t\t\t\t\t// }\n\n\t\t\t\t\t\t\treturn errors\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonSubmit={values => console.log('Submit', { values })}\n\t\t\t\t\t\tformLayout={{\n\t\t\t\t\t\t\tspacing: 'tight'\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tkind=\"modal\"\n\t\t\t\t\t\tsections={[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tfields: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'groupName',\n\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\tprops: {\n\t\t\t\t\t\t\t\t\t\t\tlabel: 'Group Name',\n\t\t\t\t\t\t\t\t\t\t\tplaceholder: 'e.g. East, West, Midwest, etc…'\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t]}\n\t\t\t\t\t\tprimaryCTA={{\n\t\t\t\t\t\t\ttext: 'Create group'\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tsecondaryCTA={{\n\t\t\t\t\t\t\ttext: 'Cancel'\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t</PageContent>\n\t\t</Page>\n\t))\n"],"file":"FormBuilder-story.js"}
|
|
@@ -0,0 +1,121 @@
|
|
|
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 _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _formik = require("formik");
|
|
17
|
+
|
|
18
|
+
var _FormInner = _interopRequireDefault(require("./components/FormInner/FormInner"));
|
|
19
|
+
|
|
20
|
+
var _Card = require("../../../Card");
|
|
21
|
+
|
|
22
|
+
var _Layout = _interopRequireWildcard(require("../../../Layout"));
|
|
23
|
+
|
|
24
|
+
var _Core = require("../../../Core");
|
|
25
|
+
|
|
26
|
+
var _Modal = _interopRequireDefault(require("../../../Modal/Modal"));
|
|
27
|
+
|
|
28
|
+
var FormBuilder = function FormBuilder(props) {
|
|
29
|
+
var kind = props.kind,
|
|
30
|
+
onSubmit = props.onSubmit,
|
|
31
|
+
sections = props.sections,
|
|
32
|
+
formLayout = props.formLayout,
|
|
33
|
+
primaryCTA = props.primaryCTA,
|
|
34
|
+
secondaryCTA = props.secondaryCTA,
|
|
35
|
+
validate = props.validate;
|
|
36
|
+
var initialValues = sections.reduce(function (values, section) {
|
|
37
|
+
values = section.fields.reduce(function (values, field) {
|
|
38
|
+
values[field.name] = field.currentValue;
|
|
39
|
+
return values;
|
|
40
|
+
}, values);
|
|
41
|
+
return values;
|
|
42
|
+
}, {});
|
|
43
|
+
return _react["default"].createElement(_formik.Formik, {
|
|
44
|
+
initialValues: initialValues,
|
|
45
|
+
validate: validate,
|
|
46
|
+
onSubmit: onSubmit,
|
|
47
|
+
validateOnBlur: true,
|
|
48
|
+
validateOnChange: false,
|
|
49
|
+
render: function render(props) {
|
|
50
|
+
var handleSubmit = props.handleSubmit,
|
|
51
|
+
handleReset = props.handleReset,
|
|
52
|
+
dirty = props.dirty,
|
|
53
|
+
isValid = props.isValid,
|
|
54
|
+
isSubmitting = props.isSubmitting;
|
|
55
|
+
return _react["default"].createElement(_formik.Form, {
|
|
56
|
+
className: "formbuilder"
|
|
57
|
+
}, kind === 'page' && sections && sections.length > 0 && _react["default"].createElement(_Layout["default"], null, sections.map(function (section) {
|
|
58
|
+
return _react["default"].createElement(_Layout.LayoutSection, {
|
|
59
|
+
key: section.id,
|
|
60
|
+
id: section.id
|
|
61
|
+
}, _react["default"].createElement(_Card.Card, null, section.title && _react["default"].createElement(_Card.CardHeader, {
|
|
62
|
+
title: section.title
|
|
63
|
+
}), _react["default"].createElement(_Card.CardBody, null, _react["default"].createElement(_FormInner["default"], {
|
|
64
|
+
formLayout: formLayout,
|
|
65
|
+
fields: section.fields,
|
|
66
|
+
formikProps: props
|
|
67
|
+
}))));
|
|
68
|
+
}), _react["default"].createElement(_Core.SaveBar, {
|
|
69
|
+
isVisible: dirty,
|
|
70
|
+
onSave: handleSubmit,
|
|
71
|
+
onDiscard: handleReset,
|
|
72
|
+
isSaveDisabled: !isValid,
|
|
73
|
+
isSaving: isSubmitting,
|
|
74
|
+
isDiscardDisabled: isSubmitting
|
|
75
|
+
}), _react["default"].createElement("button", {
|
|
76
|
+
type: "submit",
|
|
77
|
+
text: "submit",
|
|
78
|
+
style: {
|
|
79
|
+
display: 'none'
|
|
80
|
+
}
|
|
81
|
+
})), kind === 'default' && sections && sections.length > 0 && sections.map(function (section, idx) {
|
|
82
|
+
return _react["default"].createElement(_FormInner["default"], {
|
|
83
|
+
key: "section-".concat(idx),
|
|
84
|
+
formLayout: formLayout,
|
|
85
|
+
fields: section.fields,
|
|
86
|
+
formikProps: props,
|
|
87
|
+
primaryCTA: primaryCTA,
|
|
88
|
+
secondaryCTA: secondaryCTA
|
|
89
|
+
});
|
|
90
|
+
}), kind === 'modal' && _react["default"].createElement(_react.Fragment, null, _react["default"].createElement(_Modal["default"].Body, null, sections && sections.length > 0 && sections.map(function (section, idx) {
|
|
91
|
+
return _react["default"].createElement(_FormInner["default"], {
|
|
92
|
+
key: "section-".concat(idx),
|
|
93
|
+
formLayout: formLayout,
|
|
94
|
+
fields: section.fields,
|
|
95
|
+
formikProps: props
|
|
96
|
+
});
|
|
97
|
+
})), primaryCTA && _react["default"].createElement(_Modal["default"].Footer, {
|
|
98
|
+
primaryAction: (0, _objectSpread2["default"])({}, primaryCTA, {
|
|
99
|
+
type: 'submit',
|
|
100
|
+
disabled: !isValid || isSubmitting,
|
|
101
|
+
isLoading: isSubmitting
|
|
102
|
+
}),
|
|
103
|
+
secondaryAction: (0, _objectSpread2["default"])({}, secondaryCTA, {
|
|
104
|
+
disabled: isSubmitting
|
|
105
|
+
})
|
|
106
|
+
})));
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
FormBuilder.defaultProps = {
|
|
112
|
+
kind: 'default',
|
|
113
|
+
validate: function validate() {
|
|
114
|
+
return null;
|
|
115
|
+
},
|
|
116
|
+
primaryCTA: null,
|
|
117
|
+
secondaryCTA: null
|
|
118
|
+
};
|
|
119
|
+
var _default = FormBuilder;
|
|
120
|
+
exports["default"] = _default;
|
|
121
|
+
//# sourceMappingURL=FormBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Forms/components/FormBuilder/FormBuilder.js"],"names":["FormBuilder","props","kind","onSubmit","sections","formLayout","primaryCTA","secondaryCTA","validate","initialValues","reduce","values","section","fields","field","name","currentValue","handleSubmit","handleReset","dirty","isValid","isSubmitting","length","map","id","title","display","idx","type","disabled","isLoading","defaultProps"],"mappings":";;;;;;;;;;;;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA2CA,IAAMA,WAAW,GAAG,SAAdA,WAAc,CAACC,KAAD,EAAkB;AAAA,MAEpCC,IAFoC,GASjCD,KATiC,CAEpCC,IAFoC;AAAA,MAGpCC,QAHoC,GASjCF,KATiC,CAGpCE,QAHoC;AAAA,MAIpCC,QAJoC,GASjCH,KATiC,CAIpCG,QAJoC;AAAA,MAKpCC,UALoC,GASjCJ,KATiC,CAKpCI,UALoC;AAAA,MAMpCC,UANoC,GASjCL,KATiC,CAMpCK,UANoC;AAAA,MAOpCC,YAPoC,GASjCN,KATiC,CAOpCM,YAPoC;AAAA,MAQpCC,QARoC,GASjCP,KATiC,CAQpCO,QARoC;AAWrC,MAAMC,aAAa,GAAGL,QAAQ,CAACM,MAAT,CAAgB,UAACC,MAAD,EAASC,OAAT,EAAqB;AAC1DD,IAAAA,MAAM,GAAGC,OAAO,CAACC,MAAR,CAAeH,MAAf,CAAsB,UAACC,MAAD,EAASG,KAAT,EAAmB;AACjDH,MAAAA,MAAM,CAACG,KAAK,CAACC,IAAP,CAAN,GAAqBD,KAAK,CAACE,YAA3B;AACA,aAAOL,MAAP;AACA,KAHQ,EAGNA,MAHM,CAAT;AAKA,WAAOA,MAAP;AACA,GAPqB,EAOnB,EAPmB,CAAtB;AASA,SACC,gCAAC,cAAD;AACC,IAAA,aAAa,EAAEF,aADhB;AAEC,IAAA,QAAQ,EAAED,QAFX;AAGC,IAAA,QAAQ,EAAEL,QAHX;AAIC,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AA2B;AAC1B7B,EAAAA,IAAI,EAAE,SADoB;AAE1BM,EAAAA,QAAQ,EAAE;AAAA,WAAM,IAAN;AAAA,GAFgB;AAG1BF,EAAAA,UAAU,EAAE,IAHc;AAI1BC,EAAAA,YAAY,EAAE;AAJY,CAA3B;eAOeP,W","sourcesContent":["// @flow\nimport React, { Fragment } from 'react'\nimport { Formik, Form } from 'formik'\nimport FormInner from './components/FormInner/FormInner'\nimport { Card, CardBody, CardHeader } from '../../../Card'\nimport Layout, { LayoutSection } from '../../../Layout'\nimport { SaveBar } from '../../../Core'\nimport Modal from '../../../Modal/Modal'\n\nimport type { FormInnerFieldProps } from './components/FormInner/FormInner'\nimport type { FormLayoutProps } from '../FormLayout/FormLayout'\nimport type { Props as ButtonProps } from '../../../Button/Button'\n\ntype SectionProps = {\n\t/** Unique id for the section */\n\tid: string,\n\n\t/** Optional title to show at the top of the card */\n\ttitle?: string,\n\n\t/** Fields for this card */\n\tfields: Array<FormInnerFieldProps & { currentValue: any }>\n}\n\ntype Props = {\n\t/** Determines how the form should be build. Default builds a simple form */\n\tkind?: 'default' | 'page' | 'modal',\n\n\t/** Initial values to be passed into the form */\n\tinitialValues: Object,\n\n\t/** Submit handler */\n\tonSubmit: Function,\n\n\t/** Use sections when the form to be built is a full page */\n\tsections: Array<SectionProps>,\n\n\t/** Form layout props */\n\tformLayout: FormLayoutProps,\n\n\t/** Validation handler. This isn't needed when the form is made of toggles only. */\n\tvalidate?: Function,\n\n\t/** Optional when rendering a primary cta in the form */\n\tprimaryCTA?: ButtonProps,\n\n\t/** Optional when using a secondary cta in the form */\n\tsecondaryCTA?: ButtonProps\n}\n\nconst FormBuilder = (props: Props) => {\n\tconst {\n\t\tkind,\n\t\tonSubmit,\n\t\tsections,\n\t\tformLayout,\n\t\tprimaryCTA,\n\t\tsecondaryCTA,\n\t\tvalidate\n\t} = props\n\n\tconst initialValues = sections.reduce((values, section) => {\n\t\tvalues = section.fields.reduce((values, field) => {\n\t\t\tvalues[field.name] = field.currentValue\n\t\t\treturn values\n\t\t}, values)\n\n\t\treturn values\n\t}, {})\n\n\treturn (\n\t\t<Formik\n\t\t\tinitialValues={initialValues}\n\t\t\tvalidate={validate}\n\t\t\tonSubmit={onSubmit}\n\t\t\tvalidateOnBlur={true}\n\t\t\tvalidateOnChange={false}\n\t\t\trender={props => {\n\t\t\t\tconst {\n\t\t\t\t\thandleSubmit,\n\t\t\t\t\thandleReset,\n\t\t\t\t\tdirty,\n\t\t\t\t\tisValid,\n\t\t\t\t\tisSubmitting\n\t\t\t\t} = props\n\n\t\t\t\treturn (\n\t\t\t\t\t<Form className=\"formbuilder\">\n\t\t\t\t\t\t{kind === 'page' && sections && sections.length > 0 && (\n\t\t\t\t\t\t\t<Layout>\n\t\t\t\t\t\t\t\t{sections.map(section => (\n\t\t\t\t\t\t\t\t\t<LayoutSection key={section.id} id={section.id}>\n\t\t\t\t\t\t\t\t\t\t<Card>\n\t\t\t\t\t\t\t\t\t\t\t{section.title && <CardHeader title={section.title} />}\n\t\t\t\t\t\t\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t\t\t\t\t\t\t<FormInner\n\t\t\t\t\t\t\t\t\t\t\t\t\tformLayout={formLayout}\n\t\t\t\t\t\t\t\t\t\t\t\t\tfields={section.fields}\n\t\t\t\t\t\t\t\t\t\t\t\t\tformikProps={props}\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t</CardBody>\n\t\t\t\t\t\t\t\t\t\t</Card>\n\t\t\t\t\t\t\t\t\t</LayoutSection>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t<SaveBar\n\t\t\t\t\t\t\t\t\tisVisible={dirty}\n\t\t\t\t\t\t\t\t\tonSave={handleSubmit}\n\t\t\t\t\t\t\t\t\tonDiscard={handleReset}\n\t\t\t\t\t\t\t\t\tisSaveDisabled={!isValid}\n\t\t\t\t\t\t\t\t\tisSaving={isSubmitting}\n\t\t\t\t\t\t\t\t\tisDiscardDisabled={isSubmitting}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t{/* NOTE: The form won't submit on enter key pressed without this hidden button */}\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\ttext=\"submit\"\n\t\t\t\t\t\t\t\t\tstyle={{ display: 'none' }}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</Layout>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{kind === 'default' &&\n\t\t\t\t\t\t\tsections &&\n\t\t\t\t\t\t\tsections.length > 0 &&\n\t\t\t\t\t\t\tsections.map((section, idx) => (\n\t\t\t\t\t\t\t\t<FormInner\n\t\t\t\t\t\t\t\t\tkey={`section-${idx}`}\n\t\t\t\t\t\t\t\t\tformLayout={formLayout}\n\t\t\t\t\t\t\t\t\tfields={section.fields}\n\t\t\t\t\t\t\t\t\tformikProps={props}\n\t\t\t\t\t\t\t\t\tprimaryCTA={primaryCTA}\n\t\t\t\t\t\t\t\t\tsecondaryCTA={secondaryCTA}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t{kind === 'modal' && (\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t<Modal.Body>\n\t\t\t\t\t\t\t\t\t{sections &&\n\t\t\t\t\t\t\t\t\t\tsections.length > 0 &&\n\t\t\t\t\t\t\t\t\t\tsections.map((section, idx) => (\n\t\t\t\t\t\t\t\t\t\t\t<FormInner\n\t\t\t\t\t\t\t\t\t\t\t\tkey={`section-${idx}`}\n\t\t\t\t\t\t\t\t\t\t\t\tformLayout={formLayout}\n\t\t\t\t\t\t\t\t\t\t\t\tfields={section.fields}\n\t\t\t\t\t\t\t\t\t\t\t\tformikProps={props}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t</Modal.Body>\n\t\t\t\t\t\t\t\t{primaryCTA && (\n\t\t\t\t\t\t\t\t\t<Modal.Footer\n\t\t\t\t\t\t\t\t\t\tprimaryAction={{\n\t\t\t\t\t\t\t\t\t\t\t...primaryCTA,\n\t\t\t\t\t\t\t\t\t\t\ttype: 'submit',\n\t\t\t\t\t\t\t\t\t\t\tdisabled: !isValid || isSubmitting,\n\t\t\t\t\t\t\t\t\t\t\tisLoading: isSubmitting\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\tsecondaryAction={{\n\t\t\t\t\t\t\t\t\t\t\t...secondaryCTA,\n\t\t\t\t\t\t\t\t\t\t\tdisabled: isSubmitting\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Form>\n\t\t\t\t)\n\t\t\t}}\n\t\t/>\n\t)\n}\n\nFormBuilder.defaultProps = {\n\tkind: 'default',\n\tvalidate: () => null,\n\tprimaryCTA: null,\n\tsecondaryCTA: null\n}\n\nexport default FormBuilder\n"],"file":"FormBuilder.js"}
|