@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,40 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import { Component } from 'react';
|
|
3
|
+
import { ITabProps } from './components/Tab/Tab';
|
|
4
|
+
export interface ITabsProps {
|
|
5
|
+
/** The tabs for this group */
|
|
6
|
+
tabs: Array<ITabProps>;
|
|
7
|
+
/** Adds horizontal Padding */
|
|
8
|
+
isPadded?: boolean;
|
|
9
|
+
/** Set false to prevent truncation behavior */
|
|
10
|
+
isTruncatable?: boolean;
|
|
11
|
+
/** Optional class to add to the tab group */
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ITabsState {
|
|
15
|
+
activeTabIndex: number;
|
|
16
|
+
contextTabWidth: number | null;
|
|
17
|
+
disclosureTabWidth: number[];
|
|
18
|
+
hiddenTabIndices: number[];
|
|
19
|
+
isContextTabVisible: boolean;
|
|
20
|
+
tabWidths: number[];
|
|
21
|
+
}
|
|
22
|
+
export default class Tabs extends Component<ITabsProps, ITabsState> {
|
|
23
|
+
static defaultProps: {
|
|
24
|
+
isPadded: boolean;
|
|
25
|
+
isTruncatable: boolean;
|
|
26
|
+
className: string;
|
|
27
|
+
};
|
|
28
|
+
state: ITabsState;
|
|
29
|
+
tabGroup: any;
|
|
30
|
+
contextTab: any;
|
|
31
|
+
debouncedResize: (() => void) & import("lodash").Cancelable;
|
|
32
|
+
componentDidMount(): void;
|
|
33
|
+
componentWillUnmount(): void;
|
|
34
|
+
handleWindowResize: () => void;
|
|
35
|
+
handleInitialMeasurement: () => void;
|
|
36
|
+
handleMeasurement: () => void;
|
|
37
|
+
setRef: (ref: any) => void;
|
|
38
|
+
render(): JSX.Element;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=Tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":";AACA,OAAc,EAAE,SAAS,EAAY,MAAM,OAAO,CAAA;AAIlD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAGhD,MAAM,WAAW,UAAU;IAC1B,8BAA8B;IAC9B,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;IAEtB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,OAAO,CAAA;IAEvB,6CAA6C;IAC7C,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,UAAU;IAC1B,cAAc,EAAE,MAAM,CAAA;IACtB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,kBAAkB,EAAE,MAAM,EAAE,CAAA;IAC5B,gBAAgB,EAAE,MAAM,EAAE,CAAA;IAC1B,mBAAmB,EAAE,OAAO,CAAA;IAC5B,SAAS,EAAE,MAAM,EAAE,CAAA;CACnB;AAOD,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC;IAClE,MAAM,CAAC,YAAY;;;;MAIlB;IAED,KAAK,EAAE,UAAU,CAOhB;IAED,QAAQ,EAAE,GAAG,CAAA;IACb,UAAU,EAAE,GAAG,CAAA;IAEf,eAAe,6CAAiD;IAEhE,iBAAiB;IAUjB,oBAAoB;IAUpB,kBAAkB,aAEjB;IAED,wBAAwB,aAwBvB;IAED,iBAAiB,aA+BhB;IAED,MAAM,qBAGL;IAED,MAAM;CAoDN"}
|
|
@@ -0,0 +1,244 @@
|
|
|
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 _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
15
|
+
|
|
16
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
+
|
|
18
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
+
|
|
20
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
21
|
+
|
|
22
|
+
var _getPrototypeOf3 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
23
|
+
|
|
24
|
+
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
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 _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
33
|
+
|
|
34
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
35
|
+
|
|
36
|
+
var _Tab = _interopRequireDefault(require("./components/Tab/Tab"));
|
|
37
|
+
|
|
38
|
+
var _ContextMenu = _interopRequireDefault(require("../ContextMenu/ContextMenu"));
|
|
39
|
+
|
|
40
|
+
// TODO: Figure out how to split tabs up based on what's visible in the viewport
|
|
41
|
+
var getActiveTabIndex = function getActiveTabIndex(tabs) {
|
|
42
|
+
var activeTabIndex = tabs.findIndex(function (tab) {
|
|
43
|
+
return tab.isCurrent;
|
|
44
|
+
});
|
|
45
|
+
return activeTabIndex;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
var Tabs =
|
|
49
|
+
/*#__PURE__*/
|
|
50
|
+
function (_Component) {
|
|
51
|
+
(0, _inherits2["default"])(Tabs, _Component);
|
|
52
|
+
|
|
53
|
+
function Tabs() {
|
|
54
|
+
var _getPrototypeOf2;
|
|
55
|
+
|
|
56
|
+
var _this;
|
|
57
|
+
|
|
58
|
+
(0, _classCallCheck2["default"])(this, Tabs);
|
|
59
|
+
|
|
60
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
61
|
+
args[_key] = arguments[_key];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
_this = (0, _possibleConstructorReturn2["default"])(this, (_getPrototypeOf2 = (0, _getPrototypeOf3["default"])(Tabs)).call.apply(_getPrototypeOf2, [this].concat(args)));
|
|
65
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "state", {
|
|
66
|
+
activeTabIndex: getActiveTabIndex(_this.props.tabs),
|
|
67
|
+
contextTabWidth: null,
|
|
68
|
+
disclosureTabWidth: [],
|
|
69
|
+
hiddenTabIndices: [],
|
|
70
|
+
isContextTabVisible: true,
|
|
71
|
+
tabWidths: []
|
|
72
|
+
});
|
|
73
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "debouncedResize", (0, _debounce["default"])(function () {
|
|
74
|
+
return _this.handleWindowResize();
|
|
75
|
+
}, 500));
|
|
76
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleWindowResize", function () {
|
|
77
|
+
_this.handleMeasurement();
|
|
78
|
+
});
|
|
79
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleInitialMeasurement", function () {
|
|
80
|
+
// Purpose: get the initial measurements for child tabs
|
|
81
|
+
if (_this.tabGroup) {
|
|
82
|
+
var wrapper = _this.tabGroup;
|
|
83
|
+
var wrapperWidth = wrapper.offsetWidth;
|
|
84
|
+
var contextTabWidth = _this.contextTab.offsetWidth;
|
|
85
|
+
var children = wrapper.childNodes;
|
|
86
|
+
var childrenArray = Array.prototype.slice.call(children);
|
|
87
|
+
var tabWidths = [];
|
|
88
|
+
childrenArray.forEach(function (child) {
|
|
89
|
+
if (!child.classList.contains('context-tab')) {
|
|
90
|
+
tabWidths.push(child.offsetWidth);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
var totalTabsWidth = tabWidths.reduce(function (a, b) {
|
|
94
|
+
return a + b;
|
|
95
|
+
}, 0);
|
|
96
|
+
|
|
97
|
+
_this.setState({
|
|
98
|
+
tabWidths: tabWidths,
|
|
99
|
+
contextTabWidth: contextTabWidth,
|
|
100
|
+
isContextTabVisible: totalTabsWidth > wrapperWidth
|
|
101
|
+
}, function () {
|
|
102
|
+
return _this.handleMeasurement();
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleMeasurement", function () {
|
|
107
|
+
// TODO: Make this fire when sidebars change
|
|
108
|
+
if (_this.tabGroup) {
|
|
109
|
+
var wrapper = _this.tabGroup;
|
|
110
|
+
var wrapperWidth = wrapper.offsetWidth;
|
|
111
|
+
var contextTabWidth = _this.contextTab.offsetWidth;
|
|
112
|
+
var tabs = _this.props.tabs;
|
|
113
|
+
var _this$state = _this.state,
|
|
114
|
+
tabWidths = _this$state.tabWidths,
|
|
115
|
+
activeTabIndex = _this$state.activeTabIndex;
|
|
116
|
+
var totalTabsWidth = tabWidths.reduce(function (a, b) {
|
|
117
|
+
return a + b;
|
|
118
|
+
}, 0);
|
|
119
|
+
var hiddenTabIndices = [];
|
|
120
|
+
var width = activeTabIndex > -1 ? tabWidths[activeTabIndex] : tabWidths[0];
|
|
121
|
+
|
|
122
|
+
if (wrapperWidth > totalTabsWidth) {
|
|
123
|
+
_this.setState({
|
|
124
|
+
hiddenTabIndices: [],
|
|
125
|
+
isContextTabVisible: false
|
|
126
|
+
});
|
|
127
|
+
} else {
|
|
128
|
+
tabs.forEach(function (tab, idx) {
|
|
129
|
+
if (width + contextTabWidth > wrapperWidth) {
|
|
130
|
+
hiddenTabIndices.push(idx);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
width += tabWidths[idx + 1];
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
_this.setState({
|
|
137
|
+
hiddenTabIndices: hiddenTabIndices,
|
|
138
|
+
isContextTabVisible: true
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setRef", function (ref) {
|
|
144
|
+
_this.tabGroup = ref;
|
|
145
|
+
setTimeout(function () {
|
|
146
|
+
return _this.handleInitialMeasurement();
|
|
147
|
+
}, 250);
|
|
148
|
+
});
|
|
149
|
+
return _this;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
(0, _createClass2["default"])(Tabs, [{
|
|
153
|
+
key: "componentDidMount",
|
|
154
|
+
value: function componentDidMount() {
|
|
155
|
+
var isTruncatable = this.props.isTruncatable;
|
|
156
|
+
|
|
157
|
+
if (isTruncatable) {
|
|
158
|
+
if (typeof window !== 'undefined') {
|
|
159
|
+
window.addEventListener('resize', this.debouncedResize, false);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}, {
|
|
164
|
+
key: "componentWillUnmount",
|
|
165
|
+
value: function componentWillUnmount() {
|
|
166
|
+
var isTruncatable = this.props.isTruncatable;
|
|
167
|
+
|
|
168
|
+
if (isTruncatable) {
|
|
169
|
+
if (typeof window !== 'undefined') {
|
|
170
|
+
window.removeEventListener('resize', this.debouncedResize, false);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}, {
|
|
175
|
+
key: "render",
|
|
176
|
+
value: function render() {
|
|
177
|
+
var _this2 = this;
|
|
178
|
+
|
|
179
|
+
var _this$props = this.props,
|
|
180
|
+
tabs = _this$props.tabs,
|
|
181
|
+
isPadded = _this$props.isPadded,
|
|
182
|
+
isTruncatable = _this$props.isTruncatable,
|
|
183
|
+
className = _this$props.className;
|
|
184
|
+
var _this$state2 = this.state,
|
|
185
|
+
hiddenTabIndices = _this$state2.hiddenTabIndices,
|
|
186
|
+
isContextTabVisible = _this$state2.isContextTabVisible,
|
|
187
|
+
activeTabIndex = _this$state2.activeTabIndex;
|
|
188
|
+
var hiddenTabs = [];
|
|
189
|
+
var activeTab = tabs.find(function (tab) {
|
|
190
|
+
return tab.isCurrent;
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
if (hiddenTabIndices.length > 0) {
|
|
194
|
+
hiddenTabIndices.forEach(function (idx) {
|
|
195
|
+
if (idx !== activeTabIndex) {
|
|
196
|
+
hiddenTabs.push(tabs[idx]);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
var tabsToShow = (0, _toConsumableArray2["default"])(tabs);
|
|
202
|
+
|
|
203
|
+
if (activeTabIndex > -1 && hiddenTabIndices.length > 0 && hiddenTabIndices.indexOf(activeTabIndex) > -1) {
|
|
204
|
+
tabsToShow.splice(activeTabIndex, 1);
|
|
205
|
+
tabsToShow = [tabs[activeTabIndex]].concat((0, _toConsumableArray2["default"])(tabsToShow));
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return _react["default"].createElement(_react.Fragment, null, _react["default"].createElement("ul", {
|
|
209
|
+
ref: this.setRef,
|
|
210
|
+
className: (0, _classnames["default"])('tab-group', className, {
|
|
211
|
+
'tab-group--is-padded': isPadded,
|
|
212
|
+
'tab-group--spacing-even': hiddenTabIndices.length > 0
|
|
213
|
+
})
|
|
214
|
+
}, tabsToShow.map(function (tab, idx) {
|
|
215
|
+
if (hiddenTabIndices.indexOf(idx) > -1) {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return _react["default"].createElement(_Tab["default"], (0, _extends2["default"])({
|
|
220
|
+
key: tab.text
|
|
221
|
+
}, tab));
|
|
222
|
+
}), isTruncatable && _react["default"].createElement("li", {
|
|
223
|
+
ref: function ref(_ref) {
|
|
224
|
+
return _this2.contextTab = _ref;
|
|
225
|
+
},
|
|
226
|
+
className: (0, _classnames["default"])('tab context-tab', {
|
|
227
|
+
'context-tab--is-visible': isContextTabVisible
|
|
228
|
+
})
|
|
229
|
+
}, _react["default"].createElement(_ContextMenu["default"], {
|
|
230
|
+
actions: hiddenTabs,
|
|
231
|
+
closeOnSelectAction: true
|
|
232
|
+
}))), activeTab && activeTab.panel);
|
|
233
|
+
}
|
|
234
|
+
}]);
|
|
235
|
+
return Tabs;
|
|
236
|
+
}(_react.Component);
|
|
237
|
+
|
|
238
|
+
exports["default"] = Tabs;
|
|
239
|
+
(0, _defineProperty2["default"])(Tabs, "defaultProps", {
|
|
240
|
+
isPadded: true,
|
|
241
|
+
isTruncatable: true,
|
|
242
|
+
className: ''
|
|
243
|
+
});
|
|
244
|
+
//# sourceMappingURL=Tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Tabs/Tabs.tsx"],"names":["getActiveTabIndex","tabs","activeTabIndex","findIndex","tab","isCurrent","Tabs","props","contextTabWidth","disclosureTabWidth","hiddenTabIndices","isContextTabVisible","tabWidths","handleWindowResize","handleMeasurement","tabGroup","wrapper","wrapperWidth","offsetWidth","contextTab","children","childNodes","childrenArray","Array","prototype","slice","call","forEach","child","classList","contains","push","totalTabsWidth","reduce","a","b","setState","state","width","idx","ref","setTimeout","handleInitialMeasurement","isTruncatable","window","addEventListener","debouncedResize","removeEventListener","isPadded","className","hiddenTabs","activeTab","find","length","tabsToShow","indexOf","splice","setRef","map","text","panel","Component"],"mappings":"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","sourcesContent":["// TODO: Figure out how to split tabs up based on what's visible in the viewport\nimport React, { Component, Fragment } from 'react'\nimport debounce from 'lodash/debounce'\nimport cx from 'classnames'\nimport Tab from './components/Tab/Tab'\nimport { ITabProps } from './components/Tab/Tab'\nimport ContextMenu from '../ContextMenu/ContextMenu'\n\nexport interface ITabsProps {\n\t/** The tabs for this group */\n\ttabs: Array<ITabProps>\n\n\t/** Adds horizontal Padding */\n\tisPadded?: boolean\n\n\t/** Set false to prevent truncation behavior */\n\tisTruncatable?: boolean\n\n\t/** Optional class to add to the tab group */\n\tclassName?: string\n}\n\nexport interface ITabsState {\n\tactiveTabIndex: number\n\tcontextTabWidth: number | null\n\tdisclosureTabWidth: number[]\n\thiddenTabIndices: number[]\n\tisContextTabVisible: boolean\n\ttabWidths: number[]\n}\n\nconst getActiveTabIndex = (tabs: Array<ITabProps>) => {\n\tconst activeTabIndex = tabs.findIndex(tab => tab.isCurrent)\n\treturn activeTabIndex\n}\n\nexport default class Tabs extends Component<ITabsProps, ITabsState> {\n\tstatic defaultProps = {\n\t\tisPadded: true,\n\t\tisTruncatable: true,\n\t\tclassName: ''\n\t}\n\n\tstate: ITabsState = {\n\t\tactiveTabIndex: getActiveTabIndex(this.props.tabs),\n\t\tcontextTabWidth: null,\n\t\tdisclosureTabWidth: [],\n\t\thiddenTabIndices: [],\n\t\tisContextTabVisible: true,\n\t\ttabWidths: []\n\t}\n\n\ttabGroup: any\n\tcontextTab: any\n\n\tdebouncedResize = debounce(() => this.handleWindowResize(), 500)\n\n\tcomponentDidMount() {\n\t\tconst { isTruncatable } = this.props\n\n\t\tif (isTruncatable) {\n\t\t\tif (typeof window !== 'undefined') {\n\t\t\t\twindow.addEventListener('resize', this.debouncedResize, false)\n\t\t\t}\n\t\t}\n\t}\n\n\tcomponentWillUnmount() {\n\t\tconst { isTruncatable } = this.props\n\n\t\tif (isTruncatable) {\n\t\t\tif (typeof window !== 'undefined') {\n\t\t\t\twindow.removeEventListener('resize', this.debouncedResize, false)\n\t\t\t}\n\t\t}\n\t}\n\n\thandleWindowResize = () => {\n\t\tthis.handleMeasurement()\n\t}\n\n\thandleInitialMeasurement = () => {\n\t\t// Purpose: get the initial measurements for child tabs\n\t\tif (this.tabGroup) {\n\t\t\tconst wrapper = this.tabGroup\n\t\t\tconst wrapperWidth = wrapper.offsetWidth\n\t\t\tconst contextTabWidth = this.contextTab.offsetWidth\n\t\t\tconst children = wrapper.childNodes\n\t\t\tconst childrenArray = Array.prototype.slice.call(children)\n\t\t\tconst tabWidths: number[] = []\n\t\t\tchildrenArray.forEach(child => {\n\t\t\t\tif (!child.classList.contains('context-tab')) {\n\t\t\t\t\ttabWidths.push(child.offsetWidth)\n\t\t\t\t}\n\t\t\t})\n\t\t\tconst totalTabsWidth = tabWidths.reduce((a, b) => a + b, 0)\n\t\t\tthis.setState(\n\t\t\t\t{\n\t\t\t\t\ttabWidths,\n\t\t\t\t\tcontextTabWidth,\n\t\t\t\t\tisContextTabVisible: totalTabsWidth > wrapperWidth\n\t\t\t\t},\n\t\t\t\t() => this.handleMeasurement()\n\t\t\t)\n\t\t}\n\t}\n\n\thandleMeasurement = () => {\n\t\t// TODO: Make this fire when sidebars change\n\t\tif (this.tabGroup) {\n\t\t\tconst wrapper = this.tabGroup\n\t\t\tconst wrapperWidth = wrapper.offsetWidth\n\t\t\tconst contextTabWidth = this.contextTab.offsetWidth\n\t\t\tconst { tabs } = this.props\n\t\t\tconst { tabWidths, activeTabIndex } = this.state\n\t\t\tconst totalTabsWidth = tabWidths.reduce((a, b) => a + b, 0)\n\t\t\tconst hiddenTabIndices: number[] = []\n\t\t\tlet width: number =\n\t\t\t\tactiveTabIndex > -1 ? tabWidths[activeTabIndex] : tabWidths[0]\n\n\t\t\tif (wrapperWidth > totalTabsWidth) {\n\t\t\t\tthis.setState({\n\t\t\t\t\thiddenTabIndices: [],\n\t\t\t\t\tisContextTabVisible: false\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\ttabs.forEach((tab, idx) => {\n\t\t\t\t\tif (width + contextTabWidth > wrapperWidth) {\n\t\t\t\t\t\thiddenTabIndices.push(idx)\n\t\t\t\t\t}\n\t\t\t\t\twidth += tabWidths[idx + 1]\n\t\t\t\t})\n\t\t\t\tthis.setState({\n\t\t\t\t\thiddenTabIndices,\n\t\t\t\t\tisContextTabVisible: true\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\tsetRef = ref => {\n\t\tthis.tabGroup = ref\n\t\tsetTimeout(() => this.handleInitialMeasurement(), 250)\n\t}\n\n\trender() {\n\t\tconst { tabs, isPadded, isTruncatable, className } = this.props\n\t\tconst { hiddenTabIndices, isContextTabVisible, activeTabIndex } = this.state\n\t\tconst hiddenTabs: ITabProps[] = []\n\t\tconst activeTab = tabs.find(tab => tab.isCurrent)\n\t\tif (hiddenTabIndices.length > 0) {\n\t\t\thiddenTabIndices.forEach(idx => {\n\t\t\t\tif (idx !== activeTabIndex) {\n\t\t\t\t\thiddenTabs.push(tabs[idx])\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\t\tlet tabsToShow = [...tabs]\n\t\tif (\n\t\t\tactiveTabIndex > -1 &&\n\t\t\thiddenTabIndices.length > 0 &&\n\t\t\thiddenTabIndices.indexOf(activeTabIndex) > -1\n\t\t) {\n\t\t\ttabsToShow.splice(activeTabIndex, 1)\n\t\t\ttabsToShow = [tabs[activeTabIndex], ...tabsToShow]\n\t\t}\n\n\t\treturn (\n\t\t\t<Fragment>\n\t\t\t\t<ul\n\t\t\t\t\tref={this.setRef}\n\t\t\t\t\tclassName={cx('tab-group', className, {\n\t\t\t\t\t\t'tab-group--is-padded': isPadded,\n\t\t\t\t\t\t'tab-group--spacing-even': hiddenTabIndices.length > 0\n\t\t\t\t\t})}\n\t\t\t\t>\n\t\t\t\t\t{tabsToShow.map((tab, idx) => {\n\t\t\t\t\t\tif (hiddenTabIndices.indexOf(idx) > -1) {\n\t\t\t\t\t\t\treturn null\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn <Tab key={tab.text} {...tab} />\n\t\t\t\t\t})}\n\t\t\t\t\t{isTruncatable && (\n\t\t\t\t\t\t<li\n\t\t\t\t\t\t\tref={ref => (this.contextTab = ref)}\n\t\t\t\t\t\t\tclassName={cx('tab context-tab', {\n\t\t\t\t\t\t\t\t'context-tab--is-visible': isContextTabVisible\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<ContextMenu actions={hiddenTabs} closeOnSelectAction />\n\t\t\t\t\t\t</li>\n\t\t\t\t\t)}\n\t\t\t\t</ul>\n\t\t\t\t{activeTab && activeTab.panel}\n\t\t\t</Fragment>\n\t\t)\n\t}\n}\n"],"file":"Tabs.js"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { IIconProps } from '../../../Icon/Icon';
|
|
3
|
+
export interface ITabProps {
|
|
4
|
+
/** Tab text */
|
|
5
|
+
text: string;
|
|
6
|
+
/** Tab icon */
|
|
7
|
+
icon?: IIconProps | null;
|
|
8
|
+
/** Method used to render anchor, if isAnchor is true */
|
|
9
|
+
AnchorComponent?: Node;
|
|
10
|
+
/** Set true if this is the current tab */
|
|
11
|
+
isCurrent?: boolean;
|
|
12
|
+
/** Panel to show when this tab is current */
|
|
13
|
+
panel?: Record<string, any>;
|
|
14
|
+
/** Optional class */
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const Tab: {
|
|
18
|
+
({ AnchorComponent, text, icon, isCurrent, className, ...rest }: ITabProps): JSX.Element;
|
|
19
|
+
defaultProps: {
|
|
20
|
+
isCurrent: boolean;
|
|
21
|
+
panel: null;
|
|
22
|
+
icon: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export default Tab;
|
|
26
|
+
//# sourceMappingURL=Tab.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../../../src/components/Tabs/components/Tab/Tab.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE/C,MAAM,WAAW,SAAS;IACzB,eAAe;IACf,IAAI,EAAE,MAAM,CAAA;IAEZ,eAAe;IACf,IAAI,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IAExB,wDAAwD;IACxD,eAAe,CAAC,EAAE,IAAI,CAAA;IAEtB,0CAA0C;IAC1C,SAAS,CAAC,EAAE,OAAO,CAAA;IAEnB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAE3B,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,QAAA,MAAM,GAAG;;;;;;;CAqBR,CAAA;AAQD,eAAe,GAAG,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 _classnames = _interopRequireDefault(require("classnames"));
|
|
17
|
+
|
|
18
|
+
var _Button = _interopRequireDefault(require("../../../Button/Button"));
|
|
19
|
+
|
|
20
|
+
var Tab = function Tab(_ref) {
|
|
21
|
+
var AnchorComponent = _ref.AnchorComponent,
|
|
22
|
+
text = _ref.text,
|
|
23
|
+
icon = _ref.icon,
|
|
24
|
+
isCurrent = _ref.isCurrent,
|
|
25
|
+
className = _ref.className,
|
|
26
|
+
rest = (0, _objectWithoutProperties2["default"])(_ref, ["AnchorComponent", "text", "icon", "isCurrent", "className"]);
|
|
27
|
+
return _react["default"].createElement("li", {
|
|
28
|
+
className: (0, _classnames["default"])('tab', className)
|
|
29
|
+
}, _react["default"].createElement(_Button["default"], (0, _extends2["default"])({
|
|
30
|
+
AnchorComponent: AnchorComponent,
|
|
31
|
+
className: (0, _classnames["default"])('tab__inner', {
|
|
32
|
+
'tab--is-current': isCurrent
|
|
33
|
+
}),
|
|
34
|
+
text: text,
|
|
35
|
+
icon: icon
|
|
36
|
+
}, rest)));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
Tab.defaultProps = {
|
|
40
|
+
isCurrent: false,
|
|
41
|
+
panel: null,
|
|
42
|
+
icon: ''
|
|
43
|
+
};
|
|
44
|
+
var _default = Tab;
|
|
45
|
+
exports["default"] = _default;
|
|
46
|
+
//# sourceMappingURL=Tab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/components/Tabs/components/Tab/Tab.tsx"],"names":["Tab","AnchorComponent","text","icon","isCurrent","className","rest","defaultProps","panel"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAuBA,IAAMA,GAAG,GAAG,SAANA,GAAM,OAOK;AAAA,MANhBC,eAMgB,QANhBA,eAMgB;AAAA,MALhBC,IAKgB,QALhBA,IAKgB;AAAA,MAJhBC,IAIgB,QAJhBA,IAIgB;AAAA,MAHhBC,SAGgB,QAHhBA,SAGgB;AAAA,MAFhBC,SAEgB,QAFhBA,SAEgB;AAAA,MADbC,IACa;AAChB,SACC;AAAI,IAAA,SAAS,EAAE,4BAAG,KAAH,EAAUD,SAAV;AAAf,KACC,gCAAC,kBAAD;AACC,IAAA,eAAe,EAAEJ,eADlB;AAEC,IAAA,SAAS,EAAE,4BAAG,YAAH,EAAiB;AAC3B,yBAAmBG;AADQ,KAAjB,CAFZ;AAKC,IAAA,IAAI,EAAEF,IALP;AAMC,IAAA,IAAI,EAAEC;AANP,KAOKG,IAPL,EADD,CADD;AAaA,CArBD;;AAuBAN,GAAG,CAACO,YAAJ,GAAmB;AAClBH,EAAAA,SAAS,EAAE,KADO;AAElBI,EAAAA,KAAK,EAAE,IAFW;AAGlBL,EAAAA,IAAI,EAAE;AAHY,CAAnB;eAMeH,G","sourcesContent":["import React from 'react'\nimport cx from 'classnames'\nimport Button from '../../../Button/Button'\nimport { IIconProps } from '../../../Icon/Icon'\n\nexport interface ITabProps {\n\t/** Tab text */\n\ttext: string\n\n\t/** Tab icon */\n\ticon?: IIconProps | null\n\n\t/** Method used to render anchor, if isAnchor is true */\n\tAnchorComponent?: Node\n\n\t/** Set true if this is the current tab */\n\tisCurrent?: boolean\n\n\t/** Panel to show when this tab is current */\n\tpanel?: Record<string, any>\n\n\t/** Optional class */\n\tclassName?: string\n}\n\nconst Tab = ({\n\tAnchorComponent,\n\ttext,\n\ticon,\n\tisCurrent,\n\tclassName,\n\t...rest\n}: ITabProps) => {\n\treturn (\n\t\t<li className={cx('tab', className)}>\n\t\t\t<Button\n\t\t\t\tAnchorComponent={AnchorComponent}\n\t\t\t\tclassName={cx('tab__inner', {\n\t\t\t\t\t'tab--is-current': isCurrent\n\t\t\t\t})}\n\t\t\t\ttext={text}\n\t\t\t\ticon={icon}\n\t\t\t\t{...rest}\n\t\t\t/>\n\t\t</li>\n\t)\n}\n\nTab.defaultProps = {\n\tisCurrent: false,\n\tpanel: null,\n\ticon: ''\n}\n\nexport default Tab\n"],"file":"Tab.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text-story.d.ts","sourceRoot":"","sources":["../../../src/components/Text/Text-story.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,51 @@
|
|
|
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 _addonKnobs = require("@storybook/addon-knobs");
|
|
12
|
+
|
|
13
|
+
var _Text = _interopRequireWildcard(require("./Text"));
|
|
14
|
+
|
|
15
|
+
var stories = (0, _react2.storiesOf)('Text', module);
|
|
16
|
+
stories.addDecorator(_addonKnobs.withKnobs);
|
|
17
|
+
stories.add('Text', function () {
|
|
18
|
+
return _react["default"].createElement(_Text["default"], {
|
|
19
|
+
isInline: (0, _addonKnobs["boolean"])('Is Inline', false),
|
|
20
|
+
context: (0, _addonKnobs.object)('Context', {
|
|
21
|
+
planet: {
|
|
22
|
+
text: 'World!',
|
|
23
|
+
type: 'style',
|
|
24
|
+
props: {
|
|
25
|
+
type: 'strong'
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
link: {
|
|
29
|
+
text: 'Click me!',
|
|
30
|
+
type: 'button',
|
|
31
|
+
props: {
|
|
32
|
+
href: 'https://www.spruce.ai'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
}, (0, _addonKnobs.text)('children', 'Hello, {{planet}}! {{link}}'));
|
|
37
|
+
}).add('Span', function () {
|
|
38
|
+
return _react["default"].createElement(_Text.Span, {
|
|
39
|
+
isInline: (0, _addonKnobs["boolean"])('is inline', true),
|
|
40
|
+
context: (0, _addonKnobs.object)('Context', {
|
|
41
|
+
planet: {
|
|
42
|
+
text: 'World!',
|
|
43
|
+
type: 'style',
|
|
44
|
+
props: {
|
|
45
|
+
type: 'strong'
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
}, (0, _addonKnobs.text)('children', 'Hello, {{planet}}!'));
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=Text-story.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Text/Text-story.tsx"],"names":["stories","module","addDecorator","withKnobs","add","planet","text","type","props","link","href"],"mappings":";;;;;;AAAA;;AACA;;AACA;;AACA;;AACA,IAAMA,OAAO,GAAG,uBAAU,MAAV,EAAkBC,MAAlB,CAAhB;AAEAD,OAAO,CAACE,YAAR,CAAqBC,qBAArB;AAEAH,OAAO,CACLI,GADF,CACM,MADN,EACc;AAAA,SACZ,gCAAC,gBAAD;AACC,IAAA,QAAQ,EAAE,4BAAQ,WAAR,EAAqB,KAArB,CADX;AAEC,IAAA,OAAO,EAAE,wBAAO,SAAP,EAAkB;AAC1BC,MAAAA,MAAM,EAAE;AACPC,QAAAA,IAAI,EAAE,QADC;AAEPC,QAAAA,IAAI,EAAE,OAFC;AAGPC,QAAAA,KAAK,EAAE;AAAED,UAAAA,IAAI,EAAE;AAAR;AAHA,OADkB;AAM1BE,MAAAA,IAAI,EAAE;AACLH,QAAAA,IAAI,EAAE,WADD;AAELC,QAAAA,IAAI,EAAE,QAFD;AAGLC,QAAAA,KAAK,EAAE;AAAEE,UAAAA,IAAI,EAAE;AAAR;AAHF;AANoB,KAAlB;AAFV,KAeE,sBAAK,UAAL,EAAiB,6BAAjB,CAfF,CADY;AAAA,CADd,EAoBEN,GApBF,CAoBM,MApBN,EAoBc;AAAA,SACZ,gCAAC,UAAD;AACC,IAAA,QAAQ,EAAE,4BAAQ,WAAR,EAAqB,IAArB,CADX;AAEC,IAAA,OAAO,EAAE,wBAAO,SAAP,EAAkB;AAC1BC,MAAAA,MAAM,EAAE;AACPC,QAAAA,IAAI,EAAE,QADC;AAEPC,QAAAA,IAAI,EAAE,OAFC;AAGPC,QAAAA,KAAK,EAAE;AAAED,UAAAA,IAAI,EAAE;AAAR;AAHA;AADkB,KAAlB;AAFV,KAUE,sBAAK,UAAL,EAAiB,oBAAjB,CAVF,CADY;AAAA,CApBd","sourcesContent":["import React from 'react'\nimport { storiesOf } from '@storybook/react'\nimport { withKnobs, text, boolean, object } from '@storybook/addon-knobs'\nimport Text, { Span } from './Text'\nconst stories = storiesOf('Text', module)\n\nstories.addDecorator(withKnobs)\n\nstories\n\t.add('Text', () => (\n\t\t<Text\n\t\t\tisInline={boolean('Is Inline', false)}\n\t\t\tcontext={object('Context', {\n\t\t\t\tplanet: {\n\t\t\t\t\ttext: 'World!',\n\t\t\t\t\ttype: 'style',\n\t\t\t\t\tprops: { type: 'strong' }\n\t\t\t\t},\n\t\t\t\tlink: {\n\t\t\t\t\ttext: 'Click me!',\n\t\t\t\t\ttype: 'button',\n\t\t\t\t\tprops: { href: 'https://www.spruce.ai' }\n\t\t\t\t}\n\t\t\t})}\n\t\t>\n\t\t\t{text('children', 'Hello, {{planet}}! {{link}}')}\n\t\t</Text>\n\t))\n\t.add('Span', () => (\n\t\t<Span\n\t\t\tisInline={boolean('is inline', true)}\n\t\t\tcontext={object('Context', {\n\t\t\t\tplanet: {\n\t\t\t\t\ttext: 'World!',\n\t\t\t\t\ttype: 'style',\n\t\t\t\t\tprops: { type: 'strong' }\n\t\t\t\t}\n\t\t\t})}\n\t\t>\n\t\t\t{text('children', 'Hello, {{planet}}!')}\n\t\t</Span>\n\t))\n"],"file":"Text-story.js"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import { IHWText } from '@sprucelabs/spruce-types';
|
|
3
|
+
export interface ITextProps extends Omit<IHWText, 'id'> {
|
|
4
|
+
/** id for visual caching */
|
|
5
|
+
id?: string;
|
|
6
|
+
/** Contents of the component. */
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
/** Class name for the component */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Context allows basic templatizing of text strings for formatting/rich interaction purposes */
|
|
11
|
+
context?: Record<string, any>;
|
|
12
|
+
/** Is this an inline text element? */
|
|
13
|
+
isInline?: boolean;
|
|
14
|
+
}
|
|
15
|
+
declare const Text: React.StatelessComponent<ITextProps>;
|
|
16
|
+
export declare const Span: React.StatelessComponent<ITextProps>;
|
|
17
|
+
export default Text;
|
|
18
|
+
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../../src/components/Text/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAY,SAAS,EAAkB,MAAM,OAAO,CAAA;AAKlE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AA6DlD,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC;IACtD,4BAA4B;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAA;IAEX,iCAAiC;IACjC,QAAQ,CAAC,EAAE,SAAS,CAAA;IAEpB,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAA;IAElB,iGAAiG;IACjG,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAE7B,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,QAAA,MAAM,IAAI,EAAE,KAAK,CAAC,kBAAkB,CAAC,UAAU,CAyB9C,CAAA;AAED,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,kBAAkB,CAAC,UAAU,CAUrD,CAAA;AAED,eAAe,IAAI,CAAA"}
|
|
@@ -0,0 +1,123 @@
|
|
|
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"] = exports.Span = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread"));
|
|
15
|
+
|
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
17
|
+
|
|
18
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
+
|
|
20
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
21
|
+
|
|
22
|
+
var _Button = _interopRequireDefault(require("../Button/Button"));
|
|
23
|
+
|
|
24
|
+
var _TextStyle = _interopRequireDefault(require("../TextStyle/TextStyle"));
|
|
25
|
+
|
|
26
|
+
// Components available for templating
|
|
27
|
+
var TextComponentKey = {
|
|
28
|
+
style: _TextStyle["default"],
|
|
29
|
+
button: _Button["default"]
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
var renderText = function renderText(child) {
|
|
33
|
+
var _child$props = child.props,
|
|
34
|
+
children = _child$props.children,
|
|
35
|
+
rest = (0, _objectWithoutProperties2["default"])(_child$props, ["children"]);
|
|
36
|
+
var handlerProps = (0, _objectSpread2["default"])({
|
|
37
|
+
children: child.text || children
|
|
38
|
+
}, rest);
|
|
39
|
+
var Handler = child && child.type && TextComponentKey[child.type];
|
|
40
|
+
|
|
41
|
+
if (!Handler) {
|
|
42
|
+
return _react["default"].createElement(_react.Fragment, {
|
|
43
|
+
key: rest.key
|
|
44
|
+
}, children);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return typeof Handler === 'function' ? Handler((0, _objectSpread2["default"])({}, handlerProps)) : _react["default"].createElement(Handler, handlerProps);
|
|
48
|
+
}; // Allows basic templating functionality on text strings
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
var TemplateEngine = function TemplateEngine() {
|
|
52
|
+
var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
53
|
+
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
54
|
+
var re = /{{([^}}]+)?}}/g,
|
|
55
|
+
children = [];
|
|
56
|
+
var cursor = 0;
|
|
57
|
+
|
|
58
|
+
var add = function add(line, templateVar) {
|
|
59
|
+
if (line !== '') {
|
|
60
|
+
children.push({
|
|
61
|
+
props: {
|
|
62
|
+
element: 'span',
|
|
63
|
+
children: line.replace(/"/g, '\\"')
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (templateVar && context[templateVar]) {
|
|
69
|
+
children.push(context[templateVar]);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
var matches = text.match(re);
|
|
74
|
+
|
|
75
|
+
if (matches) {
|
|
76
|
+
matches.forEach(function () {
|
|
77
|
+
var matched = re.exec(text);
|
|
78
|
+
|
|
79
|
+
if (matched) {
|
|
80
|
+
add(text.slice(cursor, matched.index), matched[1]);
|
|
81
|
+
cursor = matched.index + matched[0].length;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
add(text.substr(cursor, text.length - cursor));
|
|
87
|
+
return children.map(renderText);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
var Text = function Text(props) {
|
|
91
|
+
var originalChildren = props.children,
|
|
92
|
+
className = props.className,
|
|
93
|
+
context = props.context,
|
|
94
|
+
textProps = props.text,
|
|
95
|
+
isInline = props.isInline,
|
|
96
|
+
rest = (0, _objectWithoutProperties2["default"])(props, ["children", "className", "context", "text", "isInline"]);
|
|
97
|
+
var Element = isInline ? 'span' : 'p';
|
|
98
|
+
var children = originalChildren;
|
|
99
|
+
var text = children || textProps || context;
|
|
100
|
+
|
|
101
|
+
if (typeof text === 'string') {
|
|
102
|
+
children = TemplateEngine(text, context);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return _react["default"].createElement(Element, (0, _extends2["default"])({
|
|
106
|
+
className: (0, _classnames["default"])('text', className)
|
|
107
|
+
}, rest), children);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
var Span = function Span(props) {
|
|
111
|
+
var children = props.children,
|
|
112
|
+
className = props.className,
|
|
113
|
+
rest = (0, _objectWithoutProperties2["default"])(props, ["children", "className"]);
|
|
114
|
+
return _react["default"].createElement(Text, (0, _extends2["default"])({
|
|
115
|
+
isInline: true,
|
|
116
|
+
className: (0, _classnames["default"])('text', className)
|
|
117
|
+
}, rest), children);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
exports.Span = Span;
|
|
121
|
+
var _default = Text;
|
|
122
|
+
exports["default"] = _default;
|
|
123
|
+
//# sourceMappingURL=Text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Text/Text.tsx"],"names":["TextComponentKey","style","TextStyle","button","Button","renderText","child","props","children","rest","handlerProps","text","Handler","type","key","TemplateEngine","context","re","cursor","add","line","templateVar","push","element","replace","matches","match","forEach","matched","exec","slice","index","length","substr","map","Text","originalChildren","className","textProps","isInline","Element","Span"],"mappings":"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","sourcesContent":["import React, { Fragment, ReactNode /*, HTMLProps*/ } from 'react'\nimport cx from 'classnames'\n\nimport Button from '../Button/Button'\nimport TextStyle from '../TextStyle/TextStyle'\nimport { IHWText } from '@sprucelabs/spruce-types'\n\n// Components available for templating\n\nconst TextComponentKey = {\n\tstyle: TextStyle,\n\tbutton: Button\n}\n\nconst renderText = (child): ReactNode => {\n\tconst { children, ...rest } = child.props\n\tconst handlerProps = { children: child.text || children, ...rest }\n\tconst Handler = child && child.type && TextComponentKey[child.type]\n\n\tif (!Handler) {\n\t\treturn <Fragment key={rest.key}>{children}</Fragment>\n\t}\n\n\treturn typeof Handler === 'function' ? (\n\t\tHandler({ ...handlerProps })\n\t) : (\n\t\t<Handler {...handlerProps} />\n\t)\n}\n\n// Allows basic templating functionality on text strings\nconst TemplateEngine = (text = '', context = {}): ReactNode[] => {\n\tconst re = /{{([^}}]+)?}}/g,\n\t\tchildren: Record<string, any>[] = []\n\n\tlet cursor = 0\n\n\tconst add = function(line: string, templateVar?: string): void {\n\t\tif (line !== '') {\n\t\t\tchildren.push({\n\t\t\t\tprops: { element: 'span', children: line.replace(/\"/g, '\\\\\"') }\n\t\t\t})\n\t\t}\n\t\tif (templateVar && context[templateVar]) {\n\t\t\tchildren.push(context[templateVar])\n\t\t}\n\t}\n\n\tconst matches = text.match(re)\n\n\tif (matches) {\n\t\tmatches.forEach(() => {\n\t\t\tconst matched = re.exec(text)\n\n\t\t\tif (matched) {\n\t\t\t\tadd(text.slice(cursor, matched.index), matched[1])\n\t\t\t\tcursor = matched.index + matched[0].length\n\t\t\t}\n\t\t})\n\t}\n\n\tadd(text.substr(cursor, text.length - cursor))\n\n\treturn children.map(renderText)\n}\n\nexport interface ITextProps extends Omit<IHWText, 'id'> {\n\t/** id for visual caching */\n\tid?: string\n\n\t/** Contents of the component. */\n\tchildren?: ReactNode\n\n\t/** Class name for the component */\n\tclassName?: string\n\n\t/** Context allows basic templatizing of text strings for formatting/rich interaction purposes */\n\tcontext?: Record<string, any>\n\n\t/** Is this an inline text element? */\n\tisInline?: boolean\n}\n\nconst Text: React.StatelessComponent<ITextProps> = (\n\tprops: ITextProps\n): React.ReactElement => {\n\tconst {\n\t\tchildren: originalChildren,\n\t\tclassName,\n\t\tcontext,\n\t\ttext: textProps,\n\t\tisInline,\n\t\t...rest\n\t} = props\n\tconst Element: any = isInline ? 'span' : 'p'\n\tlet children = originalChildren\n\n\tconst text = children || textProps || context\n\n\tif (typeof text === 'string') {\n\t\tchildren = TemplateEngine(text, context)\n\t}\n\n\treturn (\n\t\t<Element className={cx('text', className)} {...rest}>\n\t\t\t{children}\n\t\t</Element>\n\t)\n}\n\nexport const Span: React.StatelessComponent<ITextProps> = (\n\tprops: ITextProps\n): React.ReactElement => {\n\tconst { children, className, ...rest } = props\n\n\treturn (\n\t\t<Text isInline={true} className={cx('text', className)} {...rest}>\n\t\t\t{children}\n\t\t</Text>\n\t)\n}\n\nexport default Text\n"],"file":"Text.js"}
|