@finsweet/webflow-apps-utils 1.0.1
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/README.md +45 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/router/Link.svelte +166 -0
- package/dist/router/Link.svelte.d.ts +26 -0
- package/dist/router/README.md +397 -0
- package/dist/router/Route.svelte +82 -0
- package/dist/router/Route.svelte.d.ts +24 -0
- package/dist/router/Router.svelte +71 -0
- package/dist/router/Router.svelte.d.ts +20 -0
- package/dist/router/hooks.svelte.d.ts +77 -0
- package/dist/router/hooks.svelte.js +148 -0
- package/dist/router/index.svelte.d.ts +107 -0
- package/dist/router/index.svelte.js +400 -0
- package/dist/stores/breakpoints.d.ts +10 -0
- package/dist/stores/breakpoints.js +2 -0
- package/dist/stores/componentInjectErrors.d.ts +1 -0
- package/dist/stores/componentInjectErrors.js +2 -0
- package/dist/stores/forms.d.ts +110 -0
- package/dist/stores/forms.js +307 -0
- package/dist/stores/globalStore.d.ts +10 -0
- package/dist/stores/globalStore.js +10 -0
- package/dist/stores/index.d.ts +7 -0
- package/dist/stores/index.js +7 -0
- package/dist/stores/router.d.ts +4 -0
- package/dist/stores/router.js +5 -0
- package/dist/stores/showConfirmActionModal.d.ts +1 -0
- package/dist/stores/showConfirmActionModal.js +2 -0
- package/dist/stores/siteInfo.d.ts +13 -0
- package/dist/stores/siteInfo.js +2 -0
- package/dist/types/auth.d.ts +40 -0
- package/dist/types/auth.js +1 -0
- package/dist/types/customCode.d.ts +16 -0
- package/dist/types/customCode.js +1 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +5 -0
- package/dist/types/license.d.ts +5 -0
- package/dist/types/license.js +1 -0
- package/dist/types/webflow.d.ts +125 -0
- package/dist/types/webflow.js +1 -0
- package/dist/types/window.d.ts +14 -0
- package/dist/types/window.js +1 -0
- package/dist/ui/components/ButtonGroup.svelte +106 -0
- package/dist/ui/components/ButtonGroup.svelte.d.ts +28 -0
- package/dist/ui/components/Checkbox.svelte +94 -0
- package/dist/ui/components/Checkbox.svelte.d.ts +36 -0
- package/dist/ui/components/Copy.svelte +329 -0
- package/dist/ui/components/Copy.svelte.d.ts +35 -0
- package/dist/ui/components/CustomModal.svelte +192 -0
- package/dist/ui/components/CustomModal.svelte.d.ts +45 -0
- package/dist/ui/components/DisableInEditMode.svelte +66 -0
- package/dist/ui/components/DisableInEditMode.svelte.d.ts +33 -0
- package/dist/ui/components/Divider.svelte +31 -0
- package/dist/ui/components/Divider.svelte.d.ts +31 -0
- package/dist/ui/components/Header.svelte +30 -0
- package/dist/ui/components/Header.svelte.d.ts +20 -0
- package/dist/ui/components/Iframe.svelte +89 -0
- package/dist/ui/components/Iframe.svelte.d.ts +40 -0
- package/dist/ui/components/ImageUpload.svelte +213 -0
- package/dist/ui/components/ImageUpload.svelte.d.ts +42 -0
- package/dist/ui/components/InjectComponent.svelte +297 -0
- package/dist/ui/components/InjectComponent.svelte.d.ts +27 -0
- package/dist/ui/components/Loader.svelte +68 -0
- package/dist/ui/components/Loader.svelte.d.ts +24 -0
- package/dist/ui/components/LoadingScreen.svelte +71 -0
- package/dist/ui/components/LoadingScreen.svelte.d.ts +26 -0
- package/dist/ui/components/Modal.svelte +139 -0
- package/dist/ui/components/Modal.svelte.d.ts +42 -0
- package/dist/ui/components/Navbar.svelte +132 -0
- package/dist/ui/components/Navbar.svelte.d.ts +29 -0
- package/dist/ui/components/NoSettingsNeeded.svelte +31 -0
- package/dist/ui/components/NoSettingsNeeded.svelte.d.ts +18 -0
- package/dist/ui/components/Notification.svelte +193 -0
- package/dist/ui/components/Notification.svelte.d.ts +64 -0
- package/dist/ui/components/PlusMinusButton.svelte +91 -0
- package/dist/ui/components/PlusMinusButton.svelte.d.ts +22 -0
- package/dist/ui/components/PreviewBar.svelte +40 -0
- package/dist/ui/components/PreviewBar.svelte.d.ts +20 -0
- package/dist/ui/components/ScrollableContent.svelte +18 -0
- package/dist/ui/components/ScrollableContent.svelte.d.ts +31 -0
- package/dist/ui/components/Section.svelte +97 -0
- package/dist/ui/components/Section.svelte.d.ts +50 -0
- package/dist/ui/components/SelectBodyOrDivBlock.svelte +26 -0
- package/dist/ui/components/SelectBodyOrDivBlock.svelte.d.ts +26 -0
- package/dist/ui/components/Spacer.svelte +9 -0
- package/dist/ui/components/Spacer.svelte.d.ts +22 -0
- package/dist/ui/components/SpinnerPlusMinus.svelte +75 -0
- package/dist/ui/components/SpinnerPlusMinus.svelte.d.ts +23 -0
- package/dist/ui/components/SpinnerUpDown.svelte +194 -0
- package/dist/ui/components/SpinnerUpDown.svelte.d.ts +31 -0
- package/dist/ui/components/Tabs.svelte +71 -0
- package/dist/ui/components/Tabs.svelte.d.ts +26 -0
- package/dist/ui/components/ToggleItem.svelte +29 -0
- package/dist/ui/components/ToggleItem.svelte.d.ts +28 -0
- package/dist/ui/components/ToggleList.svelte +57 -0
- package/dist/ui/components/ToggleList.svelte.d.ts +39 -0
- package/dist/ui/components/breakpoints/BreakpointItem.svelte +84 -0
- package/dist/ui/components/breakpoints/BreakpointItem.svelte.d.ts +37 -0
- package/dist/ui/components/breakpoints/breakpointOptions.d.ts +12 -0
- package/dist/ui/components/breakpoints/breakpointOptions.js +38 -0
- package/dist/ui/components/breakpoints/index.d.ts +3 -0
- package/dist/ui/components/breakpoints/index.js +3 -0
- package/dist/ui/components/button/Button.stories.svelte +275 -0
- package/dist/ui/components/button/Button.stories.svelte.d.ts +27 -0
- package/dist/ui/components/button/Button.svelte +389 -0
- package/dist/ui/components/button/Button.svelte.d.ts +84 -0
- package/dist/ui/components/button/index.d.ts +2 -0
- package/dist/ui/components/button/index.js +1 -0
- package/dist/ui/components/button/types.d.ts +23 -0
- package/dist/ui/components/button/types.js +1 -0
- package/dist/ui/components/buttons/FooterButton.svelte +277 -0
- package/dist/ui/components/buttons/FooterButton.svelte.d.ts +10 -0
- package/dist/ui/components/buttons/index.d.ts +5 -0
- package/dist/ui/components/buttons/index.js +5 -0
- package/dist/ui/components/buttons/types.d.ts +28 -0
- package/dist/ui/components/buttons/types.js +1 -0
- package/dist/ui/components/clickable/Clickable.stories.svelte +213 -0
- package/dist/ui/components/clickable/Clickable.stories.svelte.d.ts +27 -0
- package/dist/ui/components/clickable/Clickable.svelte +93 -0
- package/dist/ui/components/clickable/Clickable.svelte.d.ts +4 -0
- package/dist/ui/components/clickable/index.d.ts +2 -0
- package/dist/ui/components/clickable/index.js +1 -0
- package/dist/ui/components/clickable/types.d.ts +17 -0
- package/dist/ui/components/clickable/types.js +1 -0
- package/dist/ui/components/index.d.ts +46 -0
- package/dist/ui/components/index.js +46 -0
- package/dist/ui/components/input/Input.stories.d.ts +109 -0
- package/dist/ui/components/input/Input.stories.js +337 -0
- package/dist/ui/components/input/Input.svelte +422 -0
- package/dist/ui/components/input/Input.svelte.d.ts +4 -0
- package/dist/ui/components/input/index.d.ts +2 -0
- package/dist/ui/components/input/index.js +1 -0
- package/dist/ui/components/input/types.d.ts +109 -0
- package/dist/ui/components/input/types.js +1 -0
- package/dist/ui/components/layout/ExampleLayout.svelte +538 -0
- package/dist/ui/components/layout/ExampleLayout.svelte.d.ts +3 -0
- package/dist/ui/components/layout/Layout.stories.svelte +24 -0
- package/dist/ui/components/layout/Layout.stories.svelte.d.ts +18 -0
- package/dist/ui/components/layout/Layout.svelte +551 -0
- package/dist/ui/components/layout/Layout.svelte.d.ts +30 -0
- package/dist/ui/components/layout/common/EditModeMessage.svelte +59 -0
- package/dist/ui/components/layout/common/EditModeMessage.svelte.d.ts +3 -0
- package/dist/ui/components/layout/common/index.d.ts +1 -0
- package/dist/ui/components/layout/common/index.js +1 -0
- package/dist/ui/components/layout/index.d.ts +3 -0
- package/dist/ui/components/layout/index.js +2 -0
- package/dist/ui/components/layout/types.d.ts +59 -0
- package/dist/ui/components/layout/types.js +1 -0
- package/dist/ui/components/select/Select.stories.d.ts +94 -0
- package/dist/ui/components/select/Select.stories.js +396 -0
- package/dist/ui/components/select/Select.svelte +705 -0
- package/dist/ui/components/select/Select.svelte.d.ts +11 -0
- package/dist/ui/components/select/index.d.ts +2 -0
- package/dist/ui/components/select/index.js +1 -0
- package/dist/ui/components/select/types.d.ts +94 -0
- package/dist/ui/components/select/types.js +1 -0
- package/dist/ui/components/switch/Switch.stories.d.ts +58 -0
- package/dist/ui/components/switch/Switch.stories.js +198 -0
- package/dist/ui/components/switch/Switch.svelte +220 -0
- package/dist/ui/components/switch/Switch.svelte.d.ts +4 -0
- package/dist/ui/components/switch/index.d.ts +2 -0
- package/dist/ui/components/switch/index.js +1 -0
- package/dist/ui/components/switch/types.d.ts +47 -0
- package/dist/ui/components/switch/types.js +1 -0
- package/dist/ui/components/text/README.md +73 -0
- package/dist/ui/components/text/Text.stories.svelte +203 -0
- package/dist/ui/components/text/Text.stories.svelte.d.ts +27 -0
- package/dist/ui/components/text/Text.svelte +778 -0
- package/dist/ui/components/text/Text.svelte.d.ts +8 -0
- package/dist/ui/components/text/index.d.ts +3 -0
- package/dist/ui/components/text/index.js +2 -0
- package/dist/ui/components/text/types.d.ts +46 -0
- package/dist/ui/components/text/types.js +1 -0
- package/dist/ui/components/tooltip/Tooltip.stories.svelte +128 -0
- package/dist/ui/components/tooltip/Tooltip.stories.svelte.d.ts +27 -0
- package/dist/ui/components/tooltip/Tooltip.svelte +463 -0
- package/dist/ui/components/tooltip/Tooltip.svelte.d.ts +7 -0
- package/dist/ui/components/tooltip/index.d.ts +2 -0
- package/dist/ui/components/tooltip/index.js +1 -0
- package/dist/ui/components/tooltip/types.d.ts +114 -0
- package/dist/ui/components/tooltip/types.js +1 -0
- package/dist/ui/icons/AccordionDownArrow.svelte +8 -0
- package/dist/ui/icons/AccordionDownArrow.svelte.d.ts +26 -0
- package/dist/ui/icons/AccordionUpArrow.svelte +8 -0
- package/dist/ui/icons/AccordionUpArrow.svelte.d.ts +26 -0
- package/dist/ui/icons/AccountIcon.svelte +14 -0
- package/dist/ui/icons/AccountIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ArrowIcon.svelte +6 -0
- package/dist/ui/icons/ArrowIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/BackIcon.svelte +8 -0
- package/dist/ui/icons/BackIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/BodyIcon.svelte +8 -0
- package/dist/ui/icons/BodyIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/BookmarkIcon.svelte +13 -0
- package/dist/ui/icons/BookmarkIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/BoxAddIcon.svelte +8 -0
- package/dist/ui/icons/BoxAddIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/BrushIcon.svelte +10 -0
- package/dist/ui/icons/BrushIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/BuilderEditIcon.svelte +12 -0
- package/dist/ui/icons/BuilderEditIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/BuilderIcon.svelte +14 -0
- package/dist/ui/icons/BuilderIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CMSIcon.svelte +8 -0
- package/dist/ui/icons/CMSIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CheckCircleIcon.svelte +8 -0
- package/dist/ui/icons/CheckCircleIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CheckCircleOutlinedIcon.svelte +15 -0
- package/dist/ui/icons/CheckCircleOutlinedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CheckIcon.svelte +9 -0
- package/dist/ui/icons/CheckIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CheckboxCheckedIcon.svelte +15 -0
- package/dist/ui/icons/CheckboxCheckedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ChevronIcon.svelte +8 -0
- package/dist/ui/icons/ChevronIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ChevronRightIcon.svelte +8 -0
- package/dist/ui/icons/ChevronRightIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CircleIcon.svelte +3 -0
- package/dist/ui/icons/CircleIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CloseCircleIcon.svelte +6 -0
- package/dist/ui/icons/CloseCircleIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CloseIcon.svelte +8 -0
- package/dist/ui/icons/CloseIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CodeIcon.svelte +8 -0
- package/dist/ui/icons/CodeIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ComponentsIcon.svelte +7 -0
- package/dist/ui/icons/ComponentsIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CookieIcon.svelte +15 -0
- package/dist/ui/icons/CookieIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/CopyIcon.svelte +19 -0
- package/dist/ui/icons/CopyIcon.svelte.d.ts +20 -0
- package/dist/ui/icons/CrossIcon.svelte +4 -0
- package/dist/ui/icons/CrossIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/DOMElement.svelte +19 -0
- package/dist/ui/icons/DOMElement.svelte.d.ts +28 -0
- package/dist/ui/icons/DeleteIcon.svelte +8 -0
- package/dist/ui/icons/DeleteIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/DeleteOutlinedIcon.svelte +8 -0
- package/dist/ui/icons/DeleteOutlinedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/Desktop.svelte +19 -0
- package/dist/ui/icons/Desktop.svelte.d.ts +21 -0
- package/dist/ui/icons/DesktopWithStar.svelte +21 -0
- package/dist/ui/icons/DesktopWithStar.svelte.d.ts +21 -0
- package/dist/ui/icons/DivBlock.svelte +14 -0
- package/dist/ui/icons/DivBlock.svelte.d.ts +28 -0
- package/dist/ui/icons/EditIcon.svelte +15 -0
- package/dist/ui/icons/EditIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ExpertIcon.svelte +16 -0
- package/dist/ui/icons/ExpertIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/EyeCancelIcon.svelte +12 -0
- package/dist/ui/icons/EyeCancelIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/EyeIcon.svelte +12 -0
- package/dist/ui/icons/EyeIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FavouriteIcon.svelte +6 -0
- package/dist/ui/icons/FavouriteIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FileUploadIcon.svelte +18 -0
- package/dist/ui/icons/FileUploadIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FilterIcon.svelte +8 -0
- package/dist/ui/icons/FilterIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FinsweetLibraryIcon.svelte +21 -0
- package/dist/ui/icons/FinsweetLibraryIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FinsweetLogoIcon.svelte +20 -0
- package/dist/ui/icons/FinsweetLogoIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FolderIcon.svelte +6 -0
- package/dist/ui/icons/FolderIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FolderOutlinedIcon.svelte +8 -0
- package/dist/ui/icons/FolderOutlinedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FolderPlusIcon.svelte +10 -0
- package/dist/ui/icons/FolderPlusIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/FreeComponentIcon.svelte +8 -0
- package/dist/ui/icons/FreeComponentIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/GlobeIcon.svelte +14 -0
- package/dist/ui/icons/GlobeIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/HandPointUpIcon.svelte +9 -0
- package/dist/ui/icons/HandPointUpIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/HeartIcon.svelte +8 -0
- package/dist/ui/icons/HeartIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/HeartIconOutlined.svelte +8 -0
- package/dist/ui/icons/HeartIconOutlined.svelte.d.ts +26 -0
- package/dist/ui/icons/HelpAltIcon.svelte +23 -0
- package/dist/ui/icons/HelpAltIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/HelpIcon.svelte +16 -0
- package/dist/ui/icons/HelpIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/HomeIcon.svelte +8 -0
- package/dist/ui/icons/HomeIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/InfoIcon.svelte +14 -0
- package/dist/ui/icons/InfoIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ListIcon.svelte +18 -0
- package/dist/ui/icons/ListIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/LockIcon.svelte +13 -0
- package/dist/ui/icons/LockIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/MessageIcon.svelte +10 -0
- package/dist/ui/icons/MessageIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/MobileLandscape.svelte +20 -0
- package/dist/ui/icons/MobileLandscape.svelte.d.ts +21 -0
- package/dist/ui/icons/MobilePortrait.svelte +20 -0
- package/dist/ui/icons/MobilePortrait.svelte.d.ts +21 -0
- package/dist/ui/icons/NavigatorIcon.svelte +8 -0
- package/dist/ui/icons/NavigatorIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/OpenBookIcon.svelte +8 -0
- package/dist/ui/icons/OpenBookIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PageDraftIcon.svelte +8 -0
- package/dist/ui/icons/PageDraftIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PageIcon.svelte +9 -0
- package/dist/ui/icons/PageIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PageLockedIcon.svelte +8 -0
- package/dist/ui/icons/PageLockedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PageOutlinedIcon.svelte +8 -0
- package/dist/ui/icons/PageOutlinedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PageSectionIcon.svelte +10 -0
- package/dist/ui/icons/PageSectionIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/Pencil.svelte +12 -0
- package/dist/ui/icons/Pencil.svelte.d.ts +20 -0
- package/dist/ui/icons/PencilOutlinedIcon.svelte +15 -0
- package/dist/ui/icons/PencilOutlinedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PinIcon.svelte +8 -0
- package/dist/ui/icons/PinIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PlayIcon.svelte +8 -0
- package/dist/ui/icons/PlayIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PlusIcon.svelte +8 -0
- package/dist/ui/icons/PlusIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PreviewEyeIcon.svelte +12 -0
- package/dist/ui/icons/PreviewEyeIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ProfileIcon.svelte +12 -0
- package/dist/ui/icons/ProfileIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PublishCancelIcon.svelte +8 -0
- package/dist/ui/icons/PublishCancelIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/PublishIcon.svelte +12 -0
- package/dist/ui/icons/PublishIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/RefreshIcon.svelte +10 -0
- package/dist/ui/icons/RefreshIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/RepairIcon.svelte +10 -0
- package/dist/ui/icons/RepairIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/SaveIcon.svelte +14 -0
- package/dist/ui/icons/SaveIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/SearchIcon.svelte +8 -0
- package/dist/ui/icons/SearchIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/SelectIcon.svelte +7 -0
- package/dist/ui/icons/SelectIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/SettingsIcon.svelte +8 -0
- package/dist/ui/icons/SettingsIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/SidebarToggleIcon.svelte +28 -0
- package/dist/ui/icons/SidebarToggleIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/SliderAppIcon.svelte +14 -0
- package/dist/ui/icons/SliderAppIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/SquareCheckIcon.svelte +3 -0
- package/dist/ui/icons/SquareCheckIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/StarIcon.svelte +6 -0
- package/dist/ui/icons/StarIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/StarOutlinedIcon.svelte +6 -0
- package/dist/ui/icons/StarOutlinedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/StaticContentIcon.svelte +8 -0
- package/dist/ui/icons/StaticContentIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/SubtractIcon.svelte +9 -0
- package/dist/ui/icons/SubtractIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/TabNewIcon.svelte +6 -0
- package/dist/ui/icons/TabNewIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/TableAppIcon.svelte +19 -0
- package/dist/ui/icons/TableAppIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/Tablet.svelte +20 -0
- package/dist/ui/icons/Tablet.svelte.d.ts +21 -0
- package/dist/ui/icons/TabletPreview.svelte +20 -0
- package/dist/ui/icons/TabletPreview.svelte.d.ts +21 -0
- package/dist/ui/icons/TabsIcon.svelte +17 -0
- package/dist/ui/icons/TabsIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ThreeDotsIcon.svelte +14 -0
- package/dist/ui/icons/ThreeDotsIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/TimesIcon.svelte +4 -0
- package/dist/ui/icons/TimesIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/ToolTipInfoCircleIcon.svelte +11 -0
- package/dist/ui/icons/ToolTipInfoCircleIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/TooltipInfoCircleFilled.svelte +13 -0
- package/dist/ui/icons/TooltipInfoCircleFilled.svelte.d.ts +26 -0
- package/dist/ui/icons/TooltipInfoSquaredIcon.svelte +16 -0
- package/dist/ui/icons/TooltipInfoSquaredIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/TriangleDownIcon.svelte +7 -0
- package/dist/ui/icons/TriangleDownIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/TriangleDownIconToggle.svelte +21 -0
- package/dist/ui/icons/TriangleDownIconToggle.svelte.d.ts +20 -0
- package/dist/ui/icons/UndoIcon.svelte +6 -0
- package/dist/ui/icons/UndoIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/UploadFileIcon.svelte +10 -0
- package/dist/ui/icons/UploadFileIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/WarningCircleIcon.svelte +7 -0
- package/dist/ui/icons/WarningCircleIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/WarningCircleOutlineIcon.svelte +14 -0
- package/dist/ui/icons/WarningCircleOutlineIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/WarningTriangleIcon.svelte +6 -0
- package/dist/ui/icons/WarningTriangleIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/WarningTriangleOutlineIcon.svelte +14 -0
- package/dist/ui/icons/WarningTriangleOutlineIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/WebflowComponentIcon.svelte +14 -0
- package/dist/ui/icons/WebflowComponentIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/WebflowComponentOutlinedIcon.svelte +10 -0
- package/dist/ui/icons/WebflowComponentOutlinedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/WebflowInsightsIcon.svelte +6 -0
- package/dist/ui/icons/WebflowInsightsIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/WizedLogoIcon.svelte +39 -0
- package/dist/ui/icons/WizedLogoIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/XL.svelte +19 -0
- package/dist/ui/icons/XL.svelte.d.ts +21 -0
- package/dist/ui/icons/XXL.svelte +19 -0
- package/dist/ui/icons/XXL.svelte.d.ts +21 -0
- package/dist/ui/icons/XXXL.svelte +19 -0
- package/dist/ui/icons/XXXL.svelte.d.ts +21 -0
- package/dist/ui/icons/apps/FsConsentIcon.svelte +22 -0
- package/dist/ui/icons/apps/FsConsentIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsCursorIcon.svelte +12 -0
- package/dist/ui/icons/apps/FsCursorIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsExampleIcon.svelte +10 -0
- package/dist/ui/icons/apps/FsExampleIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsInstagramFeedIcon.svelte +27 -0
- package/dist/ui/icons/apps/FsInstagramFeedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsMarqueeIcon.svelte +13 -0
- package/dist/ui/icons/apps/FsMarqueeIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsNumberCountIcon.svelte +46 -0
- package/dist/ui/icons/apps/FsNumberCountIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsSliderIcon.svelte +13 -0
- package/dist/ui/icons/apps/FsSliderIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsTablesIcon.svelte +19 -0
- package/dist/ui/icons/apps/FsTablesIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsTabsIcon.svelte +24 -0
- package/dist/ui/icons/apps/FsTabsIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsTooltipIcon.svelte +12 -0
- package/dist/ui/icons/apps/FsTooltipIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/FsYouTubeFeedIcon.svelte +43 -0
- package/dist/ui/icons/apps/FsYouTubeFeedIcon.svelte.d.ts +26 -0
- package/dist/ui/icons/apps/index.d.ts +15 -0
- package/dist/ui/icons/apps/index.js +15 -0
- package/dist/ui/icons/index.d.ts +120 -0
- package/dist/ui/icons/index.js +120 -0
- package/dist/ui/index.css +494 -0
- package/dist/ui/index.d.ts +2 -0
- package/dist/ui/index.js +2 -0
- package/dist/utils/api/checkIfAppModeIsDesign.d.ts +5 -0
- package/dist/utils/api/checkIfAppModeIsDesign.js +20 -0
- package/dist/utils/api/clipboard/handlePaste.d.ts +46 -0
- package/dist/utils/api/clipboard/handlePaste.js +53 -0
- package/dist/utils/api/clipboard/index.d.ts +1 -0
- package/dist/utils/api/clipboard/index.js +1 -0
- package/dist/utils/api/copyPaste/index.d.ts +18 -0
- package/dist/utils/api/copyPaste/index.js +1 -0
- package/dist/utils/api/getAllAssets.d.ts +12 -0
- package/dist/utils/api/getAllAssets.js +21 -0
- package/dist/utils/api/getFinsweetComponentsEnvironment.d.ts +9 -0
- package/dist/utils/api/getFinsweetComponentsEnvironment.js +70 -0
- package/dist/utils/api/index.d.ts +6 -0
- package/dist/utils/api/index.js +6 -0
- package/dist/utils/api/insertWithXSCP.d.ts +5 -0
- package/dist/utils/api/insertWithXSCP.js +13 -0
- package/dist/utils/auth/crossWindowLogin.d.ts +2 -0
- package/dist/utils/auth/crossWindowLogin.js +49 -0
- package/dist/utils/auth/index.d.ts +61 -0
- package/dist/utils/auth/index.js +196 -0
- package/dist/utils/browser-storage/index.d.ts +2 -0
- package/dist/utils/browser-storage/index.js +2 -0
- package/dist/utils/browser-storage/localStorage.d.ts +24 -0
- package/dist/utils/browser-storage/localStorage.js +56 -0
- package/dist/utils/browser-storage/sessionStorage.d.ts +24 -0
- package/dist/utils/browser-storage/sessionStorage.js +56 -0
- package/dist/utils/constants.d.ts +61 -0
- package/dist/utils/constants.js +73 -0
- package/dist/utils/custom-code/api.d.ts +17 -0
- package/dist/utils/custom-code/api.js +41 -0
- package/dist/utils/custom-code/index.d.ts +1 -0
- package/dist/utils/custom-code/index.js +1 -0
- package/dist/utils/helpers/cleanupTooltipMessage.d.ts +5 -0
- package/dist/utils/helpers/cleanupTooltipMessage.js +25 -0
- package/dist/utils/helpers/goto.d.ts +7 -0
- package/dist/utils/helpers/goto.js +35 -0
- package/dist/utils/helpers/index.d.ts +5 -0
- package/dist/utils/helpers/index.js +5 -0
- package/dist/utils/helpers/noop.d.ts +4 -0
- package/dist/utils/helpers/noop.js +7 -0
- package/dist/utils/helpers/numbers.d.ts +27 -0
- package/dist/utils/helpers/numbers.js +61 -0
- package/dist/utils/helpers/objectsToModuleExports.d.ts +9 -0
- package/dist/utils/helpers/objectsToModuleExports.js +13 -0
- package/dist/utils/helpers/trimText.d.ts +15 -0
- package/dist/utils/helpers/trimText.js +33 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/logger/index.d.ts +19 -0
- package/dist/utils/logger/index.js +41 -0
- package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.d.ts +6 -0
- package/dist/utils/webflow-canvas/attributes/getAllWebflowElementAttributes.js +19 -0
- package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.d.ts +8 -0
- package/dist/utils/webflow-canvas/attributes/getInstanceNamesFromObject.js +21 -0
- package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.d.ts +7 -0
- package/dist/utils/webflow-canvas/attributes/getWebflowElementAttribute.js +25 -0
- package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.d.ts +6 -0
- package/dist/utils/webflow-canvas/attributes/getWebflowElementTextContent.js +26 -0
- package/dist/utils/webflow-canvas/attributes/index.d.ts +7 -0
- package/dist/utils/webflow-canvas/attributes/index.js +7 -0
- package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.d.ts +7 -0
- package/dist/utils/webflow-canvas/attributes/removeWebflowElementAttribute.js +37 -0
- package/dist/utils/webflow-canvas/attributes/setStyles.d.ts +10 -0
- package/dist/utils/webflow-canvas/attributes/setStyles.js +36 -0
- package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.d.ts +11 -0
- package/dist/utils/webflow-canvas/attributes/setWebflowElementAttribute.js +61 -0
- package/dist/utils/webflow-canvas/findInstanceElement.d.ts +32 -0
- package/dist/utils/webflow-canvas/findInstanceElement.js +144 -0
- package/dist/utils/webflow-canvas/getAllPages.d.ts +29 -0
- package/dist/utils/webflow-canvas/getAllPages.js +93 -0
- package/dist/utils/webflow-canvas/getSiteStagingUrl.d.ts +7 -0
- package/dist/utils/webflow-canvas/getSiteStagingUrl.js +14 -0
- package/dist/utils/webflow-canvas/index.d.ts +3 -0
- package/dist/utils/webflow-canvas/index.js +3 -0
- package/package.json +107 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Component } from 'svelte';
|
|
2
|
+
import type { TextProps } from './types';
|
|
3
|
+
type $$ComponentProps = TextProps & {
|
|
4
|
+
onclick?: (event: MouseEvent) => void;
|
|
5
|
+
};
|
|
6
|
+
declare const Text: Component<$$ComponentProps, {}, "">;
|
|
7
|
+
type Text = ReturnType<typeof Text>;
|
|
8
|
+
export default Text;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { Component, Snippet } from 'svelte';
|
|
2
|
+
import type { TooltipProps } from '../tooltip/types';
|
|
3
|
+
export type TEXT_SIZES = 'normal' | 'large';
|
|
4
|
+
export type TEXT_WEIGHTS = 'normal' | 'bold';
|
|
5
|
+
export interface TextClickEvent {
|
|
6
|
+
detail: MouseEvent;
|
|
7
|
+
}
|
|
8
|
+
export interface TextPopupActionEvent {
|
|
9
|
+
detail: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface PopupConfig {
|
|
12
|
+
/** Whether the popup functionality is disabled */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Title text for the popup */
|
|
15
|
+
title?: string;
|
|
16
|
+
/** Subtitle text for the popup */
|
|
17
|
+
subtitle?: string;
|
|
18
|
+
/** Description text for the popup */
|
|
19
|
+
description?: string;
|
|
20
|
+
/** Icon component for the popup */
|
|
21
|
+
icon?: Component | null;
|
|
22
|
+
/** Whether the popup trigger is currently active */
|
|
23
|
+
active?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface TextProps {
|
|
26
|
+
label?: string;
|
|
27
|
+
class?: string;
|
|
28
|
+
raw?: boolean;
|
|
29
|
+
capitalize?: boolean;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
title?: string;
|
|
32
|
+
wrap?: 'nowrap' | 'normal';
|
|
33
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
34
|
+
fontSize?: TEXT_SIZES | string;
|
|
35
|
+
fontWeight?: TEXT_WEIGHTS | string;
|
|
36
|
+
fontColor?: string;
|
|
37
|
+
height?: string;
|
|
38
|
+
ellipsisOnWidth?: string;
|
|
39
|
+
tooltip?: Partial<TooltipProps>;
|
|
40
|
+
popup?: PopupConfig;
|
|
41
|
+
icon?: Component | null;
|
|
42
|
+
loading?: boolean;
|
|
43
|
+
link?: boolean;
|
|
44
|
+
children?: Snippet;
|
|
45
|
+
pill?: Snippet;
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<script module>
|
|
2
|
+
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
3
|
+
import { fn } from 'storybook/test';
|
|
4
|
+
|
|
5
|
+
import { HelpIcon, InfoIcon, WarningTriangleIcon } from '../../icons';
|
|
6
|
+
import Tooltip from './Tooltip.svelte';
|
|
7
|
+
|
|
8
|
+
const { Story } = defineMeta({
|
|
9
|
+
title: 'UI/Tooltip',
|
|
10
|
+
component: Tooltip,
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
argTypes: {
|
|
13
|
+
message: { control: { type: 'text' } },
|
|
14
|
+
placement: {
|
|
15
|
+
control: { type: 'select' },
|
|
16
|
+
options: ['top', 'bottom', 'left', 'right']
|
|
17
|
+
},
|
|
18
|
+
listener: {
|
|
19
|
+
control: { type: 'select' },
|
|
20
|
+
options: ['hover', 'click']
|
|
21
|
+
},
|
|
22
|
+
listenerout: {
|
|
23
|
+
control: { type: 'select' },
|
|
24
|
+
options: ['hover', 'click']
|
|
25
|
+
},
|
|
26
|
+
showArrow: { control: { type: 'boolean' } },
|
|
27
|
+
disabled: { control: { type: 'boolean' } },
|
|
28
|
+
width: { control: { type: 'text' } },
|
|
29
|
+
targetText: { control: { type: 'text' } },
|
|
30
|
+
bgColor: { control: { type: 'color' } },
|
|
31
|
+
fontColor: { control: { type: 'color' } }
|
|
32
|
+
},
|
|
33
|
+
args: {
|
|
34
|
+
message: 'This is a tooltip!',
|
|
35
|
+
listener: 'hover',
|
|
36
|
+
listenerout: 'hover',
|
|
37
|
+
showArrow: true
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<Story
|
|
43
|
+
name="Default"
|
|
44
|
+
args={{
|
|
45
|
+
message: 'This tooltip appears on hover'
|
|
46
|
+
}}
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
<Story
|
|
50
|
+
name="Click Trigger"
|
|
51
|
+
args={{
|
|
52
|
+
message: 'Click to show, click outside to hide',
|
|
53
|
+
listener: 'click',
|
|
54
|
+
listenerout: 'click'
|
|
55
|
+
}}
|
|
56
|
+
/>
|
|
57
|
+
|
|
58
|
+
<Story
|
|
59
|
+
name="Top Placement"
|
|
60
|
+
args={{
|
|
61
|
+
message: 'Positioned on top',
|
|
62
|
+
placement: 'top'
|
|
63
|
+
}}
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
<Story
|
|
67
|
+
name="No Arrow"
|
|
68
|
+
args={{
|
|
69
|
+
message: 'Clean tooltip without arrow',
|
|
70
|
+
showArrow: false
|
|
71
|
+
}}
|
|
72
|
+
/>
|
|
73
|
+
|
|
74
|
+
<Story
|
|
75
|
+
name="Custom Width"
|
|
76
|
+
args={{
|
|
77
|
+
message: 'This is a wider tooltip with custom width',
|
|
78
|
+
width: '250px'
|
|
79
|
+
}}
|
|
80
|
+
/>
|
|
81
|
+
|
|
82
|
+
<Story
|
|
83
|
+
name="With Icon"
|
|
84
|
+
args={{
|
|
85
|
+
message: 'Information tooltip with icon',
|
|
86
|
+
tooltipIcon: InfoIcon,
|
|
87
|
+
tooltipIconColor: '#2196F3'
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
|
|
91
|
+
<Story
|
|
92
|
+
name="Error State"
|
|
93
|
+
args={{
|
|
94
|
+
message: 'This field is required',
|
|
95
|
+
fontColor: '#f44336',
|
|
96
|
+
tooltipIcon: WarningTriangleIcon,
|
|
97
|
+
tooltipIconColor: '#f44336'
|
|
98
|
+
}}
|
|
99
|
+
/>
|
|
100
|
+
|
|
101
|
+
<Story
|
|
102
|
+
name="Disabled"
|
|
103
|
+
args={{
|
|
104
|
+
message: 'This tooltip is disabled',
|
|
105
|
+
disabled: true,
|
|
106
|
+
targetText: 'Disabled (no tooltip)'
|
|
107
|
+
}}
|
|
108
|
+
/>
|
|
109
|
+
|
|
110
|
+
<Story
|
|
111
|
+
name="Custom Background Color"
|
|
112
|
+
args={{
|
|
113
|
+
message: 'Custom colored tooltip with matching arrow',
|
|
114
|
+
bgColor: '#007bff',
|
|
115
|
+
fontColor: '#ffffff',
|
|
116
|
+
width: '220px'
|
|
117
|
+
}}
|
|
118
|
+
/>
|
|
119
|
+
|
|
120
|
+
<Story
|
|
121
|
+
name="Dark Theme"
|
|
122
|
+
args={{
|
|
123
|
+
message: 'Dark themed tooltip',
|
|
124
|
+
bgColor: '#1a1a1a',
|
|
125
|
+
fontColor: '#ffffff',
|
|
126
|
+
showArrow: true
|
|
127
|
+
}}
|
|
128
|
+
/>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default Tooltip;
|
|
2
|
+
type Tooltip = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Tooltip: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
import Tooltip from './Tooltip.svelte';
|
|
15
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
16
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
17
|
+
$$bindings?: Bindings;
|
|
18
|
+
} & Exports;
|
|
19
|
+
(internal: unknown, props: {
|
|
20
|
+
$$events?: Events;
|
|
21
|
+
$$slots?: Slots;
|
|
22
|
+
}): Exports & {
|
|
23
|
+
$set?: any;
|
|
24
|
+
$on?: any;
|
|
25
|
+
};
|
|
26
|
+
z_$$bindings?: Bindings;
|
|
27
|
+
}
|
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
arrow,
|
|
4
|
+
autoUpdate,
|
|
5
|
+
computePosition,
|
|
6
|
+
flip,
|
|
7
|
+
offset,
|
|
8
|
+
type Placement,
|
|
9
|
+
shift
|
|
10
|
+
} from '@floating-ui/dom';
|
|
11
|
+
import { tick } from 'svelte';
|
|
12
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
13
|
+
|
|
14
|
+
import { cleanupTooltipMessage } from '../../../utils/index.js';
|
|
15
|
+
|
|
16
|
+
import type { TooltipEvents, TooltipInstance, TooltipProps } from './types.js';
|
|
17
|
+
|
|
18
|
+
type Props = TooltipProps;
|
|
19
|
+
|
|
20
|
+
let {
|
|
21
|
+
bgColor = 'var(--background3)',
|
|
22
|
+
message = '',
|
|
23
|
+
listener = 'hover',
|
|
24
|
+
listenerout = 'hover',
|
|
25
|
+
placement = 'right',
|
|
26
|
+
position = 'absolute',
|
|
27
|
+
class: classNames = '',
|
|
28
|
+
showArrow = true,
|
|
29
|
+
offsetVal = 10,
|
|
30
|
+
hidden = $bindable(false),
|
|
31
|
+
disabled = false,
|
|
32
|
+
tooltipIcon = null,
|
|
33
|
+
tooltipIconColor = '',
|
|
34
|
+
width = '150px',
|
|
35
|
+
padding = '6px',
|
|
36
|
+
raw = false,
|
|
37
|
+
isActive = $bindable(false),
|
|
38
|
+
fallbackPlacements = [],
|
|
39
|
+
stopPropagation = true,
|
|
40
|
+
fontColor = 'var(--text2)',
|
|
41
|
+
target,
|
|
42
|
+
tooltipContent,
|
|
43
|
+
targetText
|
|
44
|
+
}: Props = $props();
|
|
45
|
+
|
|
46
|
+
// Generate appropriate target text based on trigger if not provided
|
|
47
|
+
let defaultTargetText = $derived(
|
|
48
|
+
targetText ||
|
|
49
|
+
(listener === 'click' && listenerout === 'click'
|
|
50
|
+
? 'Click me!'
|
|
51
|
+
: listener === 'click' && listenerout === 'hover'
|
|
52
|
+
? 'Click to show'
|
|
53
|
+
: listener === 'hover' && listenerout === 'click'
|
|
54
|
+
? 'Hover to show'
|
|
55
|
+
: 'Hover me!')
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
// State management with runes
|
|
59
|
+
let tooltipInstance: TooltipInstance | null = $state(null);
|
|
60
|
+
let targetElement: HTMLDivElement = $state()!;
|
|
61
|
+
let tooltipElement: HTMLDivElement = $state()!;
|
|
62
|
+
let arrowElement: HTMLDivElement = $state()!;
|
|
63
|
+
let observer: MutationObserver | null = $state(null);
|
|
64
|
+
|
|
65
|
+
// Generate unique ID for this tooltip instance
|
|
66
|
+
const tooltipId = $derived(`tooltip-${uuidv4()}`);
|
|
67
|
+
|
|
68
|
+
// Format message with cleanup utility
|
|
69
|
+
let formattedMessage = $derived(cleanupTooltipMessage(message));
|
|
70
|
+
|
|
71
|
+
// Tooltip visibility state
|
|
72
|
+
let isTooltipVisible = $derived(tooltipElement ? tooltipElement.style.display === 'flex' : false);
|
|
73
|
+
|
|
74
|
+
// Global store for tracking active tooltips
|
|
75
|
+
let activeTooltips: string[] = $state([]);
|
|
76
|
+
|
|
77
|
+
// Event dispatcher
|
|
78
|
+
function dispatchEvent(eventType: keyof TooltipEvents, detail: boolean) {
|
|
79
|
+
const event = new CustomEvent(eventType, {
|
|
80
|
+
detail,
|
|
81
|
+
bubbles: true,
|
|
82
|
+
cancelable: true
|
|
83
|
+
});
|
|
84
|
+
targetElement?.dispatchEvent(event);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Dismisses other tooltips based on trigger compatibility.
|
|
89
|
+
* Dismissal rules:
|
|
90
|
+
* - hover tooltips can dismiss other hover tooltips
|
|
91
|
+
* - click tooltips can dismiss other click tooltips
|
|
92
|
+
* - hover tooltips should NOT dismiss click tooltips (they're "sticky")
|
|
93
|
+
* - click tooltips CAN dismiss hover tooltips (higher priority)
|
|
94
|
+
*/
|
|
95
|
+
function dismissOtherTooltips() {
|
|
96
|
+
const currentTriggerType = listener === 'click' && listenerout === 'click' ? 'click' : 'hover';
|
|
97
|
+
|
|
98
|
+
document.querySelectorAll<HTMLDivElement>('.tooltip[role="tooltip"]').forEach((item) => {
|
|
99
|
+
if (item.id !== tooltipId) {
|
|
100
|
+
const existingTriggerType = item.getAttribute('data-trigger-type');
|
|
101
|
+
|
|
102
|
+
const shouldDismiss =
|
|
103
|
+
currentTriggerType === 'click' ||
|
|
104
|
+
(currentTriggerType === 'hover' && existingTriggerType === 'hover');
|
|
105
|
+
|
|
106
|
+
if (shouldDismiss) {
|
|
107
|
+
item.style.display = 'none';
|
|
108
|
+
item.setAttribute('aria-hidden', 'true');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
activeTooltips = [tooltipId];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Sets up the tooltip with floating-ui positioning
|
|
118
|
+
*/
|
|
119
|
+
function setupTooltip(
|
|
120
|
+
toggle: HTMLElement,
|
|
121
|
+
tooltipEl: HTMLElement,
|
|
122
|
+
arrowEl?: HTMLElement
|
|
123
|
+
): TooltipInstance {
|
|
124
|
+
/**
|
|
125
|
+
* Updates the tooltip position using floating-ui
|
|
126
|
+
*/
|
|
127
|
+
const update = () => {
|
|
128
|
+
computePosition(toggle, tooltipEl, {
|
|
129
|
+
placement: placement,
|
|
130
|
+
middleware: [
|
|
131
|
+
offset(offsetVal),
|
|
132
|
+
flip(
|
|
133
|
+
fallbackPlacements?.length > 0
|
|
134
|
+
? { fallbackPlacements }
|
|
135
|
+
: {
|
|
136
|
+
fallbackAxisSideDirection: 'start',
|
|
137
|
+
fallbackStrategy: 'bestFit'
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
shift({ padding: 5 }),
|
|
141
|
+
showArrow && arrowEl ? arrow({ element: arrowEl }) : undefined
|
|
142
|
+
].filter(Boolean)
|
|
143
|
+
}).then(({ x, y, placement: finalPlacement, middlewareData }) => {
|
|
144
|
+
// Position tooltip
|
|
145
|
+
Object.assign(tooltipEl.style, {
|
|
146
|
+
left: `${x}px`,
|
|
147
|
+
top: `${y}px`
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// Position arrow using floating-ui's default behavior
|
|
151
|
+
if (showArrow && arrowEl && middlewareData?.arrow) {
|
|
152
|
+
const { x: arrowX, y: arrowY } = middlewareData.arrow;
|
|
153
|
+
const side = finalPlacement.split('-')[0];
|
|
154
|
+
|
|
155
|
+
const staticSide = {
|
|
156
|
+
top: 'bottom',
|
|
157
|
+
right: 'left',
|
|
158
|
+
bottom: 'top',
|
|
159
|
+
left: 'right'
|
|
160
|
+
}[side];
|
|
161
|
+
|
|
162
|
+
Object.assign(arrowEl.style, {
|
|
163
|
+
left: arrowX != null ? `${arrowX}px` : '',
|
|
164
|
+
top: arrowY != null ? `${arrowY}px` : '',
|
|
165
|
+
right: '',
|
|
166
|
+
bottom: '',
|
|
167
|
+
[staticSide as string]: '-4px'
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Shows the tooltip
|
|
175
|
+
*/
|
|
176
|
+
const showTooltip = () => {
|
|
177
|
+
if (disabled) return;
|
|
178
|
+
|
|
179
|
+
dismissOtherTooltips();
|
|
180
|
+
|
|
181
|
+
tooltipEl.style.display = 'flex';
|
|
182
|
+
tooltipEl.setAttribute('aria-hidden', 'false');
|
|
183
|
+
|
|
184
|
+
// Set trigger type for dismissal logic
|
|
185
|
+
const triggerType = listener === 'click' && listenerout === 'click' ? 'click' : 'hover';
|
|
186
|
+
tooltipEl.setAttribute('data-trigger-type', triggerType);
|
|
187
|
+
|
|
188
|
+
isActive = true;
|
|
189
|
+
hidden = false;
|
|
190
|
+
|
|
191
|
+
if (!activeTooltips.includes(tooltipId)) {
|
|
192
|
+
activeTooltips = [...activeTooltips.filter((id) => id !== tooltipId), tooltipId];
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
update();
|
|
196
|
+
dispatchEvent('show', true);
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Hides the tooltip
|
|
201
|
+
*/
|
|
202
|
+
const hideTooltip = () => {
|
|
203
|
+
// Hide immediately in test environment
|
|
204
|
+
const isTestEnv =
|
|
205
|
+
(typeof process !== 'undefined' && process.env?.NODE_ENV === 'test') ||
|
|
206
|
+
(typeof globalThis !== 'undefined' && '__vitest__' in globalThis);
|
|
207
|
+
const delay = isTestEnv ? 0 : 50;
|
|
208
|
+
|
|
209
|
+
setTimeout(() => {
|
|
210
|
+
tooltipEl.style.display = 'none';
|
|
211
|
+
tooltipEl.setAttribute('aria-hidden', 'true');
|
|
212
|
+
tooltipEl.removeAttribute('data-trigger-type');
|
|
213
|
+
isActive = false;
|
|
214
|
+
hidden = true;
|
|
215
|
+
|
|
216
|
+
activeTooltips = activeTooltips.filter((id) => id !== tooltipId);
|
|
217
|
+
|
|
218
|
+
dispatchEvent('close', true);
|
|
219
|
+
}, delay);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
// Set up event listeners based on trigger configuration
|
|
223
|
+
let eventOptions: Array<[string, () => void]> = [];
|
|
224
|
+
|
|
225
|
+
if (listener === 'click' && listenerout === 'click') {
|
|
226
|
+
eventOptions = [['click', showTooltip]];
|
|
227
|
+
|
|
228
|
+
// Global click handler for dismissal
|
|
229
|
+
const handleGlobalClick = (event: MouseEvent) => {
|
|
230
|
+
if (!tooltipEl.contains(event.target as Node) && !toggle.contains(event.target as Node)) {
|
|
231
|
+
hideTooltip();
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
document.addEventListener('click', handleGlobalClick);
|
|
236
|
+
|
|
237
|
+
// Return cleanup function that removes global listener
|
|
238
|
+
const originalCleanup = autoUpdate(toggle, tooltipEl, update);
|
|
239
|
+
const cleanup = () => {
|
|
240
|
+
originalCleanup();
|
|
241
|
+
document.removeEventListener('click', handleGlobalClick);
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
// Add event listeners to toggle element
|
|
245
|
+
eventOptions.forEach(([event, handler]) => {
|
|
246
|
+
toggle.addEventListener(event, (evt) => {
|
|
247
|
+
if (stopPropagation) {
|
|
248
|
+
evt.stopPropagation();
|
|
249
|
+
evt.preventDefault();
|
|
250
|
+
}
|
|
251
|
+
handler();
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
return {
|
|
256
|
+
toggle,
|
|
257
|
+
tooltip: tooltipEl,
|
|
258
|
+
arrowElement: arrowEl,
|
|
259
|
+
cleanup,
|
|
260
|
+
showTooltip,
|
|
261
|
+
hideTooltip
|
|
262
|
+
};
|
|
263
|
+
} else {
|
|
264
|
+
eventOptions = [
|
|
265
|
+
listener === 'click' ? ['click', showTooltip] : undefined,
|
|
266
|
+
listener === 'hover' ? ['mouseenter', showTooltip] : undefined,
|
|
267
|
+
listener === 'hover' ? ['mouseleave', hideTooltip] : undefined,
|
|
268
|
+
listener === 'hover' ? ['focus', showTooltip] : undefined,
|
|
269
|
+
['blur', hideTooltip]
|
|
270
|
+
].filter(Boolean) as Array<[string, () => void]>;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// Add event listeners
|
|
274
|
+
eventOptions.forEach(([event, handler]) => {
|
|
275
|
+
toggle.addEventListener(event, (evt) => {
|
|
276
|
+
if (stopPropagation) {
|
|
277
|
+
evt.stopPropagation();
|
|
278
|
+
evt.preventDefault();
|
|
279
|
+
}
|
|
280
|
+
handler();
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
const cleanup = autoUpdate(toggle, tooltipEl, update);
|
|
285
|
+
|
|
286
|
+
return { toggle, tooltip: tooltipEl, arrowElement: arrowEl, cleanup, showTooltip, hideTooltip };
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Initializes the tooltip instance
|
|
291
|
+
*/
|
|
292
|
+
async function initTooltip(): Promise<TooltipInstance | null> {
|
|
293
|
+
if (!tooltipElement || (showArrow && !arrowElement) || !targetElement) return null;
|
|
294
|
+
return setupTooltip(targetElement, tooltipElement, arrowElement);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
// Public API methods
|
|
298
|
+
export function show() {
|
|
299
|
+
tooltipInstance?.showTooltip();
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export function hide() {
|
|
303
|
+
tooltipInstance?.hideTooltip();
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Effect to handle hidden prop changes
|
|
307
|
+
$effect(() => {
|
|
308
|
+
if (hidden) {
|
|
309
|
+
setTimeout(() => {
|
|
310
|
+
tooltipInstance?.hideTooltip();
|
|
311
|
+
const wrapper = document.querySelector<HTMLDivElement>('.finsweet-components');
|
|
312
|
+
if (wrapper) {
|
|
313
|
+
wrapper.click();
|
|
314
|
+
wrapper.focus();
|
|
315
|
+
}
|
|
316
|
+
}, 10);
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
// Initialize tooltip when component mounts
|
|
321
|
+
$effect(() => {
|
|
322
|
+
if (targetElement && tooltipElement) {
|
|
323
|
+
tick().then(async () => {
|
|
324
|
+
tooltipInstance = await initTooltip();
|
|
325
|
+
|
|
326
|
+
if (tooltipElement) {
|
|
327
|
+
observer = new MutationObserver((mutations) => {
|
|
328
|
+
mutations.forEach((mutation) => {
|
|
329
|
+
if (mutation.type === 'attributes' && tooltipElement?.style) {
|
|
330
|
+
const isVisible = tooltipElement.style.display !== 'none';
|
|
331
|
+
dispatchEvent(isVisible ? 'show' : 'close', true);
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
observer.observe(tooltipElement, { attributes: true });
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// Cleanup effect
|
|
342
|
+
return () => {
|
|
343
|
+
if (tooltipInstance) {
|
|
344
|
+
tooltipInstance.cleanup();
|
|
345
|
+
activeTooltips = activeTooltips.filter((id) => id !== tooltipId);
|
|
346
|
+
}
|
|
347
|
+
if (observer) {
|
|
348
|
+
observer.disconnect();
|
|
349
|
+
observer = null;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
});
|
|
353
|
+
</script>
|
|
354
|
+
|
|
355
|
+
<div class="target {classNames}" bind:this={targetElement} aria-describedby={tooltipId}>
|
|
356
|
+
{#if target}
|
|
357
|
+
{@render target()}
|
|
358
|
+
{:else}
|
|
359
|
+
<!-- Default target for Storybook compatibility -->
|
|
360
|
+
<button
|
|
361
|
+
style="
|
|
362
|
+
padding: 4px 8px;
|
|
363
|
+
background: #007bff;
|
|
364
|
+
color: white;
|
|
365
|
+
border: none;
|
|
366
|
+
border-radius: 4px;
|
|
367
|
+
cursor: pointer;
|
|
368
|
+
"
|
|
369
|
+
>
|
|
370
|
+
{defaultTargetText}
|
|
371
|
+
</button>
|
|
372
|
+
{/if}
|
|
373
|
+
|
|
374
|
+
<div
|
|
375
|
+
class="tooltip"
|
|
376
|
+
bind:this={tooltipElement}
|
|
377
|
+
role="tooltip"
|
|
378
|
+
id={tooltipId}
|
|
379
|
+
aria-hidden={isTooltipVisible ? 'false' : 'true'}
|
|
380
|
+
style="position:{position}; width:{width}; padding:{padding}; background:{bgColor};"
|
|
381
|
+
>
|
|
382
|
+
{#if tooltipIcon}
|
|
383
|
+
{@const IconComponent = tooltipIcon}
|
|
384
|
+
<div class="icon" style="color:{tooltipIconColor};">
|
|
385
|
+
<IconComponent />
|
|
386
|
+
</div>
|
|
387
|
+
{/if}
|
|
388
|
+
|
|
389
|
+
<div class="content-wrapper">
|
|
390
|
+
{#if tooltipContent}
|
|
391
|
+
{@render tooltipContent()}
|
|
392
|
+
{:else if message && raw}
|
|
393
|
+
<div class="message" style="color:{fontColor};">
|
|
394
|
+
{@html message}
|
|
395
|
+
</div>
|
|
396
|
+
{:else if message}
|
|
397
|
+
<div class="message">
|
|
398
|
+
<span>{formattedMessage}</span>
|
|
399
|
+
</div>
|
|
400
|
+
{/if}
|
|
401
|
+
</div>
|
|
402
|
+
|
|
403
|
+
{#if showArrow}
|
|
404
|
+
<div class="arrow" bind:this={arrowElement} style="background: {bgColor};"></div>
|
|
405
|
+
{/if}
|
|
406
|
+
</div>
|
|
407
|
+
</div>
|
|
408
|
+
|
|
409
|
+
<style>
|
|
410
|
+
.tooltip {
|
|
411
|
+
display: none;
|
|
412
|
+
top: 0;
|
|
413
|
+
left: 0;
|
|
414
|
+
z-index: 99999999999;
|
|
415
|
+
border-radius: 4px;
|
|
416
|
+
background: var(--background3);
|
|
417
|
+
box-shadow:
|
|
418
|
+
0px 0.5px 1px 0px #000,
|
|
419
|
+
0px 0.5px 0.5px 0px rgba(255, 255, 255, 0.12) inset;
|
|
420
|
+
color: var(--text2);
|
|
421
|
+
font-family: Inter;
|
|
422
|
+
line-height: 120%;
|
|
423
|
+
width: 150px;
|
|
424
|
+
padding: 6px;
|
|
425
|
+
flex-direction: row;
|
|
426
|
+
gap: 4px;
|
|
427
|
+
align-items: start;
|
|
428
|
+
justify-content: start;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.content-wrapper {
|
|
432
|
+
flex: 1;
|
|
433
|
+
min-width: 0;
|
|
434
|
+
z-index: 3;
|
|
435
|
+
background: inherit;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.message {
|
|
439
|
+
text-wrap: normal;
|
|
440
|
+
white-space: normal;
|
|
441
|
+
color: var(--text2);
|
|
442
|
+
font-weight: 500;
|
|
443
|
+
font-size: 11px;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.arrow {
|
|
447
|
+
position: absolute;
|
|
448
|
+
width: 10px;
|
|
449
|
+
height: 10px;
|
|
450
|
+
transform: rotate(45deg);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.target {
|
|
454
|
+
display: flex;
|
|
455
|
+
align-items: center;
|
|
456
|
+
justify-content: center;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.icon {
|
|
460
|
+
position: relative;
|
|
461
|
+
z-index: 1;
|
|
462
|
+
}
|
|
463
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Tooltip } from './Tooltip.svelte';
|