@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,705 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
autoUpdate,
|
|
4
|
+
computePosition,
|
|
5
|
+
flip,
|
|
6
|
+
offset,
|
|
7
|
+
type Placement,
|
|
8
|
+
shift
|
|
9
|
+
} from '@floating-ui/dom';
|
|
10
|
+
import debounce from 'just-debounce';
|
|
11
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
12
|
+
|
|
13
|
+
import { CheckIcon, ChevronIcon, UndoIcon } from '../../icons';
|
|
14
|
+
|
|
15
|
+
import { Text } from '../text';
|
|
16
|
+
import type { DropdownInstance, SelectInstanceManager, SelectProps } from './types.js';
|
|
17
|
+
|
|
18
|
+
let {
|
|
19
|
+
id = uuidv4(),
|
|
20
|
+
defaultText = 'Select',
|
|
21
|
+
label = '',
|
|
22
|
+
dialog = true,
|
|
23
|
+
hide = false,
|
|
24
|
+
enableSearch = false,
|
|
25
|
+
tooltipMessage = '',
|
|
26
|
+
ref = '',
|
|
27
|
+
width = '200px',
|
|
28
|
+
tooltipWidth = '150px',
|
|
29
|
+
dropdownWidth = '200px',
|
|
30
|
+
dropdownHeight = '200px',
|
|
31
|
+
options,
|
|
32
|
+
selected = $bindable(null),
|
|
33
|
+
preventNoSelection = false,
|
|
34
|
+
disabled = false,
|
|
35
|
+
placement = 'bottom',
|
|
36
|
+
className = '',
|
|
37
|
+
onchange,
|
|
38
|
+
children
|
|
39
|
+
}: SelectProps = $props();
|
|
40
|
+
|
|
41
|
+
// State variables
|
|
42
|
+
// eslint-disable-next-line svelte/prefer-writable-derived -- optionsStore is mutated by search functionality
|
|
43
|
+
let optionsStore = $state<typeof options>([]);
|
|
44
|
+
let showConfirmDialog = $state(false);
|
|
45
|
+
let selectedLabel = $state(defaultText);
|
|
46
|
+
let lastHoveredItem = $state<HTMLElement | null>(null);
|
|
47
|
+
let activeElement = $state<HTMLElement | null>(null);
|
|
48
|
+
let isOpen = $state(false);
|
|
49
|
+
let isHovered = $state(false);
|
|
50
|
+
let isFocused = $state(false);
|
|
51
|
+
let hasError = $state(false);
|
|
52
|
+
|
|
53
|
+
// Element bindings with proper Svelte 5 state management
|
|
54
|
+
let confirmDialogElement = $state<HTMLElement>();
|
|
55
|
+
let dropdownWrapper = $state<HTMLElement>();
|
|
56
|
+
let target = $state<HTMLDivElement>();
|
|
57
|
+
let dropdownItems = $state<HTMLDivElement>();
|
|
58
|
+
let instances = $state<SelectInstanceManager | undefined>();
|
|
59
|
+
|
|
60
|
+
// Reactive updates
|
|
61
|
+
$effect(() => {
|
|
62
|
+
optionsStore = options;
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
$effect(() => {
|
|
66
|
+
if (!disabled) {
|
|
67
|
+
init();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const selectedOption = options?.find((option) => option?.value === selected);
|
|
71
|
+
if (selectedOption) {
|
|
72
|
+
selectedLabel = selectedOption.label;
|
|
73
|
+
} else {
|
|
74
|
+
selectedLabel = defaultText;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
$effect(() => {
|
|
79
|
+
if (showConfirmDialog) {
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
document?.addEventListener('click', dismissPopupDialog);
|
|
82
|
+
}, 300);
|
|
83
|
+
} else {
|
|
84
|
+
document?.removeEventListener('click', dismissPopupDialog);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// Computed styles based on state
|
|
89
|
+
const dropdownStyles = $derived(() => {
|
|
90
|
+
const base = {
|
|
91
|
+
borderRadius: 'var(--border-radius, 4px)',
|
|
92
|
+
background:
|
|
93
|
+
'var(--Action-actionSecondaryBackground, linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.10) 100%), rgba(255, 255, 255, 0.08))',
|
|
94
|
+
boxShadow: '0px 0.5px 1px 0px #000, 0px 0.5px 0.5px 0px rgba(255, 255, 255, 0.12) inset'
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
if (disabled) {
|
|
98
|
+
return {
|
|
99
|
+
...base,
|
|
100
|
+
opacity: '0.4'
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (hasError) {
|
|
105
|
+
return {
|
|
106
|
+
...base,
|
|
107
|
+
border: '1px solid var(--redBorder)'
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (isFocused) {
|
|
112
|
+
return {
|
|
113
|
+
...base,
|
|
114
|
+
border: '1px solid var(--blueBorder)'
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (isHovered) {
|
|
119
|
+
return {
|
|
120
|
+
...base,
|
|
121
|
+
background:
|
|
122
|
+
'var(--Action-actionSecondaryBackgroundHover, linear-gradient(180deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.16) 100%), rgba(255, 255, 255, 0.14))'
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return base;
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Handles the option selection.
|
|
131
|
+
*/
|
|
132
|
+
const handleSelect = (value: string, label = defaultText, element: HTMLButtonElement) => {
|
|
133
|
+
if (disabled) return;
|
|
134
|
+
updateActiveElement(element);
|
|
135
|
+
|
|
136
|
+
if (selected === value && !preventNoSelection) {
|
|
137
|
+
resetDropdown();
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
selected = value;
|
|
142
|
+
selectedLabel = label;
|
|
143
|
+
closeDropdown();
|
|
144
|
+
|
|
145
|
+
onchange?.({ value });
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Dismiss dropdown when clicking outside of it.
|
|
150
|
+
*/
|
|
151
|
+
const dismissTooltip = (event: Event): void => {
|
|
152
|
+
const isClickInside = dropdownWrapper?.contains(event.target as Node);
|
|
153
|
+
|
|
154
|
+
if (!isClickInside) {
|
|
155
|
+
closeDropdown();
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Closes the dropdown.
|
|
161
|
+
*/
|
|
162
|
+
const closeDropdown = () => {
|
|
163
|
+
isOpen = false;
|
|
164
|
+
isFocused = false;
|
|
165
|
+
|
|
166
|
+
if (!dropdownItems) return;
|
|
167
|
+
|
|
168
|
+
dropdownItems.style.display = 'none';
|
|
169
|
+
dropdownItems.setAttribute('aria-hidden', 'true');
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Resets the dropdown.
|
|
174
|
+
*/
|
|
175
|
+
const resetDropdown = (): void => {
|
|
176
|
+
selected = null;
|
|
177
|
+
selectedLabel = defaultText;
|
|
178
|
+
closeDropdown();
|
|
179
|
+
showConfirmDialog = false;
|
|
180
|
+
|
|
181
|
+
onchange?.({ value: null });
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Dismiss dropdown confirm dialog when clicking outside of it.
|
|
186
|
+
*/
|
|
187
|
+
const dismissPopupDialog = (event: Event): void => {
|
|
188
|
+
const { target } = event;
|
|
189
|
+
const popups = document?.querySelectorAll<HTMLDivElement>(`.dropdown-wrapper .popup`);
|
|
190
|
+
|
|
191
|
+
if (popups && popups.length > 0 && showConfirmDialog) {
|
|
192
|
+
popups.forEach((popup) => {
|
|
193
|
+
if (popup && !popup.contains(target as Node)) {
|
|
194
|
+
popup.style.display = 'none';
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
showConfirmDialog = false;
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Updates the active element.
|
|
204
|
+
*/
|
|
205
|
+
const updateActiveElement = (newActiveElement: HTMLButtonElement) => {
|
|
206
|
+
if (activeElement) {
|
|
207
|
+
activeElement.setAttribute('aria-hidden', 'true');
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (newActiveElement) {
|
|
211
|
+
newActiveElement.setAttribute('aria-hidden', 'false');
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
activeElement = newActiveElement;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Handles keyboard navigation for the dropdown.
|
|
219
|
+
*/
|
|
220
|
+
const handleKeyDown = (event: KeyboardEvent): void => {
|
|
221
|
+
if (!isOpen || !dropdownItems) return;
|
|
222
|
+
|
|
223
|
+
const items = Array.from(dropdownItems.querySelectorAll('.dropdown-item'));
|
|
224
|
+
let currentIndex = lastHoveredItem ? items.indexOf(lastHoveredItem) : -1;
|
|
225
|
+
let newIndex = -1;
|
|
226
|
+
|
|
227
|
+
switch (event.key) {
|
|
228
|
+
case 'ArrowDown':
|
|
229
|
+
newIndex = currentIndex < items.length - 1 ? currentIndex + 1 : 0;
|
|
230
|
+
break;
|
|
231
|
+
case 'ArrowUp':
|
|
232
|
+
newIndex = currentIndex > 0 ? currentIndex - 1 : items.length - 1;
|
|
233
|
+
break;
|
|
234
|
+
case 'Enter': {
|
|
235
|
+
const selectedItem = items[currentIndex] as HTMLButtonElement;
|
|
236
|
+
selectedItem.click();
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
239
|
+
case 'Escape':
|
|
240
|
+
closeDropdown();
|
|
241
|
+
break;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (newIndex > -1) {
|
|
245
|
+
if (lastHoveredItem) {
|
|
246
|
+
lastHoveredItem.classList.remove('hover-state');
|
|
247
|
+
lastHoveredItem.setAttribute('tabindex', '-1');
|
|
248
|
+
}
|
|
249
|
+
lastHoveredItem = items[newIndex] as HTMLElement;
|
|
250
|
+
lastHoveredItem.classList.add('hover-state');
|
|
251
|
+
lastHoveredItem.setAttribute('tabindex', '0');
|
|
252
|
+
lastHoveredItem.focus();
|
|
253
|
+
event.preventDefault();
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Sets focus to the hovered dropdown item.
|
|
259
|
+
*/
|
|
260
|
+
const handleMouseEnter = (event: MouseEvent): void => {
|
|
261
|
+
const target = event.currentTarget as HTMLElement;
|
|
262
|
+
|
|
263
|
+
if (lastHoveredItem && lastHoveredItem !== target) {
|
|
264
|
+
lastHoveredItem.classList.remove('hover-state');
|
|
265
|
+
lastHoveredItem.setAttribute('tabindex', '-1');
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
target.classList.add('hover-state');
|
|
269
|
+
target.setAttribute('tabindex', '0');
|
|
270
|
+
lastHoveredItem = target;
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
type EventOption = [string, () => void];
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Inits the dropdown.
|
|
277
|
+
*/
|
|
278
|
+
const initDropdown = (): DropdownInstance[] => {
|
|
279
|
+
const instances: DropdownInstance[] = [];
|
|
280
|
+
|
|
281
|
+
if (!dropdownItems || !target) return instances;
|
|
282
|
+
|
|
283
|
+
document?.addEventListener('click', dismissTooltip);
|
|
284
|
+
instances.push(setupDropdown(target, dropdownItems));
|
|
285
|
+
|
|
286
|
+
return instances;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Cleans up the dropdown instances.
|
|
291
|
+
*/
|
|
292
|
+
const cleanupDropdownInstances = (instances: DropdownInstance[]) => {
|
|
293
|
+
instances.forEach((instance) => instance.cleanup());
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Inits the attribute.
|
|
298
|
+
*/
|
|
299
|
+
export const init = async () => {
|
|
300
|
+
if (disabled) return;
|
|
301
|
+
|
|
302
|
+
const DropdownInstances = initDropdown();
|
|
303
|
+
|
|
304
|
+
return {
|
|
305
|
+
result: DropdownInstances,
|
|
306
|
+
destroy() {
|
|
307
|
+
cleanupDropdownInstances(DropdownInstances);
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Sets up the dropdown.
|
|
314
|
+
*/
|
|
315
|
+
const setupDropdown = (toggle: HTMLElement, tooltip: HTMLElement): DropdownInstance => {
|
|
316
|
+
const update = () => {
|
|
317
|
+
computePosition(toggle, tooltip, {
|
|
318
|
+
placement,
|
|
319
|
+
middleware: [offset(-24), flip(), shift({ padding: 5 })]
|
|
320
|
+
}).then(({ x, y }) => {
|
|
321
|
+
Object.assign(tooltip.style, {
|
|
322
|
+
left: `${x}px`,
|
|
323
|
+
top: `${y}px`
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
const showDropdown = () => {
|
|
329
|
+
if (disabled) return;
|
|
330
|
+
|
|
331
|
+
tooltip.setAttribute('aria-hidden', 'false');
|
|
332
|
+
update();
|
|
333
|
+
|
|
334
|
+
const selectedItemButton = tooltip.querySelector(
|
|
335
|
+
`.dropdown-item[aria-selected="true"]`
|
|
336
|
+
) as HTMLElement;
|
|
337
|
+
const firstItemButton = tooltip.querySelector('.dropdown-item') as HTMLElement;
|
|
338
|
+
const itemToFocus = selectedItemButton || firstItemButton;
|
|
339
|
+
|
|
340
|
+
const searchInput = tooltip?.querySelector<HTMLInputElement>('input[type="text"]');
|
|
341
|
+
if (searchInput && enableSearch) {
|
|
342
|
+
searchInput.focus();
|
|
343
|
+
} else {
|
|
344
|
+
if (itemToFocus) {
|
|
345
|
+
itemToFocus.focus();
|
|
346
|
+
|
|
347
|
+
if (lastHoveredItem) {
|
|
348
|
+
lastHoveredItem.classList.remove('hover-state');
|
|
349
|
+
lastHoveredItem.setAttribute('tabindex', '-1');
|
|
350
|
+
}
|
|
351
|
+
lastHoveredItem = itemToFocus;
|
|
352
|
+
lastHoveredItem.classList.add('hover-state');
|
|
353
|
+
lastHoveredItem.setAttribute('tabindex', '0');
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
tooltip.style.display = 'flex';
|
|
358
|
+
isOpen = true;
|
|
359
|
+
isFocused = true;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
const options: EventOption[] = [['click', showDropdown]].filter(Boolean) as EventOption[];
|
|
363
|
+
|
|
364
|
+
options.forEach(([event, listener]) => {
|
|
365
|
+
toggle.addEventListener(event, listener);
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
const cleanup = autoUpdate(toggle, tooltip, update);
|
|
369
|
+
|
|
370
|
+
return { toggle, tooltip, cleanup };
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Debounces the filter options.
|
|
375
|
+
*/
|
|
376
|
+
const debouncedFilterOptions = debounce((searchValue: string, data: typeof options) => {
|
|
377
|
+
const filteredOptions = data.filter((option) =>
|
|
378
|
+
option.label.toLowerCase().includes(searchValue.toLowerCase())
|
|
379
|
+
);
|
|
380
|
+
optionsStore = filteredOptions;
|
|
381
|
+
}, 50);
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Handles the search input.
|
|
385
|
+
*/
|
|
386
|
+
const handleSearch = (event: Event) => {
|
|
387
|
+
const searchValue = (event.target as HTMLInputElement).value;
|
|
388
|
+
|
|
389
|
+
if (!options) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
debouncedFilterOptions(searchValue, options);
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
// Lifecycle cleanup
|
|
397
|
+
$effect(() => {
|
|
398
|
+
return () => {
|
|
399
|
+
if (instances) instances.destroy();
|
|
400
|
+
};
|
|
401
|
+
});
|
|
402
|
+
</script>
|
|
403
|
+
|
|
404
|
+
<div
|
|
405
|
+
class="dropdown-wrapper {className}"
|
|
406
|
+
bind:this={dropdownWrapper}
|
|
407
|
+
style="{hide ? 'display:none;' : ''} width: {width};"
|
|
408
|
+
>
|
|
409
|
+
<div
|
|
410
|
+
class="dropdown"
|
|
411
|
+
class:disabled
|
|
412
|
+
{id}
|
|
413
|
+
style="width:{width}; {Object.entries(dropdownStyles())
|
|
414
|
+
.map(([key, value]) => `${key.replace(/([A-Z])/g, '-$1').toLowerCase()}: ${value}`)
|
|
415
|
+
.join('; ')}"
|
|
416
|
+
aria-disabled={disabled}
|
|
417
|
+
tabindex={disabled || isOpen ? -1 : 0}
|
|
418
|
+
role="button"
|
|
419
|
+
aria-haspopup="listbox"
|
|
420
|
+
aria-labelledby={id}
|
|
421
|
+
bind:this={target}
|
|
422
|
+
onmouseenter={() => (isHovered = true)}
|
|
423
|
+
onmouseleave={() => (isHovered = false)}
|
|
424
|
+
onfocus={() => (isFocused = true)}
|
|
425
|
+
onblur={() => (isFocused = false)}
|
|
426
|
+
>
|
|
427
|
+
<div class="dropdown-header" aria-disabled={disabled}>
|
|
428
|
+
<div class="label">
|
|
429
|
+
{selected ? selectedLabel || defaultText : defaultText}
|
|
430
|
+
</div>
|
|
431
|
+
<div class="arrow" style="transform:rotate({isOpen ? '270deg' : '90deg'})">
|
|
432
|
+
<ChevronIcon />
|
|
433
|
+
</div>
|
|
434
|
+
</div>
|
|
435
|
+
|
|
436
|
+
<div
|
|
437
|
+
tabindex={disabled || isOpen ? -1 : 0}
|
|
438
|
+
class="dropdown-list"
|
|
439
|
+
role="listbox"
|
|
440
|
+
style="width:{dropdownWidth}; max-height:{dropdownHeight};"
|
|
441
|
+
onkeydown={(e) => {
|
|
442
|
+
e.stopPropagation();
|
|
443
|
+
e.preventDefault();
|
|
444
|
+
handleKeyDown(e);
|
|
445
|
+
}}
|
|
446
|
+
bind:this={dropdownItems}
|
|
447
|
+
>
|
|
448
|
+
{#if selectedLabel}
|
|
449
|
+
<div class="selected">
|
|
450
|
+
<div class="label">
|
|
451
|
+
<Text label={selectedLabel} fontSize="normal" fontColor="var(--text1)" />
|
|
452
|
+
</div>
|
|
453
|
+
</div>
|
|
454
|
+
{/if}
|
|
455
|
+
|
|
456
|
+
{#if enableSearch}
|
|
457
|
+
<div class="search-container">
|
|
458
|
+
<input
|
|
459
|
+
type="text"
|
|
460
|
+
placeholder="Search"
|
|
461
|
+
oninput={(e) => {
|
|
462
|
+
e.stopPropagation();
|
|
463
|
+
e.preventDefault();
|
|
464
|
+
handleSearch(e);
|
|
465
|
+
}}
|
|
466
|
+
onkeydown={(e) => e.stopPropagation()}
|
|
467
|
+
/>
|
|
468
|
+
</div>
|
|
469
|
+
{/if}
|
|
470
|
+
|
|
471
|
+
{#each optionsStore?.length > 0 ? optionsStore : options as { label, value, className = null, description = null, labelIcon = null, descriptionTitle = null, isDisabled = false }, index (index)}
|
|
472
|
+
{@const indexId = index + 1}
|
|
473
|
+
{@const itemId = ref ? ref.replace(' ', '-') : 'dropdown'}
|
|
474
|
+
<button
|
|
475
|
+
aria-posinset={indexId}
|
|
476
|
+
aria-selected={value === selected && selected?.trim() !== '' ? 'true' : 'false'}
|
|
477
|
+
id={`${itemId}-list-${indexId}-${id}`}
|
|
478
|
+
data-value={value}
|
|
479
|
+
class="dropdown-item {isDisabled ? 'disabled' : ''} {className}"
|
|
480
|
+
role="option"
|
|
481
|
+
onclick={(e) => {
|
|
482
|
+
e.stopPropagation();
|
|
483
|
+
if (isDisabled) return;
|
|
484
|
+
handleSelect(value, label, e.currentTarget);
|
|
485
|
+
}}
|
|
486
|
+
onkeydown={(e) => {
|
|
487
|
+
e.stopPropagation();
|
|
488
|
+
e.preventDefault();
|
|
489
|
+
}}
|
|
490
|
+
onmouseenter={handleMouseEnter}
|
|
491
|
+
aria-hidden={!isOpen}
|
|
492
|
+
tabindex={value === selected ? 0 : -1}
|
|
493
|
+
style={description ? 'align-items:start;' : ''}
|
|
494
|
+
>
|
|
495
|
+
<div class="icon" aria-label={label}>
|
|
496
|
+
{#if value === selected && selected?.trim() !== ''}
|
|
497
|
+
<CheckIcon />
|
|
498
|
+
{/if}
|
|
499
|
+
</div>
|
|
500
|
+
<div class="label">
|
|
501
|
+
{#if description || descriptionTitle || labelIcon}
|
|
502
|
+
<div class="label-content">
|
|
503
|
+
<div class="label-name">
|
|
504
|
+
<Text {label} />
|
|
505
|
+
{#if labelIcon}
|
|
506
|
+
{@const IconComponent = labelIcon}
|
|
507
|
+
<IconComponent />
|
|
508
|
+
{/if}
|
|
509
|
+
</div>
|
|
510
|
+
<div class="label-description-title">
|
|
511
|
+
<Text
|
|
512
|
+
label={descriptionTitle || ''}
|
|
513
|
+
fontColor="var(--greenText)"
|
|
514
|
+
fontSize="10px"
|
|
515
|
+
/>
|
|
516
|
+
</div>
|
|
517
|
+
<div class="label-description">
|
|
518
|
+
<Text label={description || ''} fontColor="var(--text2)" fontSize="10px" />
|
|
519
|
+
</div>
|
|
520
|
+
</div>
|
|
521
|
+
{:else}
|
|
522
|
+
<Text {label} fontSize="normal" />
|
|
523
|
+
{/if}
|
|
524
|
+
</div>
|
|
525
|
+
</button>
|
|
526
|
+
{/each}
|
|
527
|
+
</div>
|
|
528
|
+
</div>
|
|
529
|
+
</div>
|
|
530
|
+
|
|
531
|
+
<style>
|
|
532
|
+
.dropdown-item.disabled {
|
|
533
|
+
opacity: 0.75;
|
|
534
|
+
cursor: not-allowed;
|
|
535
|
+
}
|
|
536
|
+
.label .label-description-title,
|
|
537
|
+
.label .label-description {
|
|
538
|
+
height: max-content;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
.search-container {
|
|
542
|
+
display: flex;
|
|
543
|
+
align-items: center;
|
|
544
|
+
align-self: stretch;
|
|
545
|
+
gap: 4px;
|
|
546
|
+
padding: 4px;
|
|
547
|
+
}
|
|
548
|
+
.search-container input {
|
|
549
|
+
flex: 1 0 0;
|
|
550
|
+
align-self: stretch;
|
|
551
|
+
height: 25px;
|
|
552
|
+
width: 100%;
|
|
553
|
+
}
|
|
554
|
+
.label .label-name {
|
|
555
|
+
color: var(--text1);
|
|
556
|
+
font-family: Inter;
|
|
557
|
+
font-size: 11.5px;
|
|
558
|
+
font-style: normal;
|
|
559
|
+
font-weight: 400;
|
|
560
|
+
line-height: 16px;
|
|
561
|
+
letter-spacing: -0.115px;
|
|
562
|
+
display: flex;
|
|
563
|
+
align-items: center;
|
|
564
|
+
gap: 4px;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
.label .label-description {
|
|
568
|
+
color: var(--text2, #bdbdbd);
|
|
569
|
+
font-family: Inter;
|
|
570
|
+
font-size: 10px;
|
|
571
|
+
font-style: normal;
|
|
572
|
+
font-weight: 400;
|
|
573
|
+
line-height: 16px;
|
|
574
|
+
white-space: normal;
|
|
575
|
+
overflow-wrap: break-word;
|
|
576
|
+
}
|
|
577
|
+
.label .label-content {
|
|
578
|
+
display: flex;
|
|
579
|
+
flex-direction: column;
|
|
580
|
+
align-items: flex-start;
|
|
581
|
+
flex: 1 0 0;
|
|
582
|
+
}
|
|
583
|
+
.popup :global(.wrapper) {
|
|
584
|
+
width: 200px;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
:global(.dropdown-label.active .labels:not(.dropdown-label.active [role='tooltip'] .labels)) {
|
|
588
|
+
color: rgb(138, 194, 255);
|
|
589
|
+
background: rgba(0, 132, 255, 0.18);
|
|
590
|
+
cursor: pointer;
|
|
591
|
+
border-radius: 4px;
|
|
592
|
+
}
|
|
593
|
+
.dropdown-wrapper {
|
|
594
|
+
display: flex;
|
|
595
|
+
gap: 0;
|
|
596
|
+
align-items: center;
|
|
597
|
+
}
|
|
598
|
+
.dropdown-item :global(.labels .text) {
|
|
599
|
+
line-height: normal !important;
|
|
600
|
+
}
|
|
601
|
+
.dropdown {
|
|
602
|
+
display: flex;
|
|
603
|
+
align-items: center;
|
|
604
|
+
gap: 4px;
|
|
605
|
+
}
|
|
606
|
+
.dropdown.disabled {
|
|
607
|
+
cursor: not-allowed !important;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
.dropdown-header[aria-disabled='true'] {
|
|
611
|
+
cursor: not-allowed !important;
|
|
612
|
+
}
|
|
613
|
+
.dropdown-header {
|
|
614
|
+
display: flex;
|
|
615
|
+
align-items: center;
|
|
616
|
+
padding: 4px;
|
|
617
|
+
cursor: pointer;
|
|
618
|
+
width: 100%;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.dropdown-list :global(.dropdown-item.hover-state) {
|
|
622
|
+
border: 1px solid var(--blueBorder);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
.dropdown-list {
|
|
626
|
+
display: none;
|
|
627
|
+
padding: 0;
|
|
628
|
+
width: 100%;
|
|
629
|
+
position: absolute;
|
|
630
|
+
flex-direction: column;
|
|
631
|
+
align-items: flex-start;
|
|
632
|
+
gap: 4px;
|
|
633
|
+
border-radius: 4px;
|
|
634
|
+
border: 1px solid var(--border-border-1, #363636);
|
|
635
|
+
background: var(--background3, #383838);
|
|
636
|
+
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.15);
|
|
637
|
+
|
|
638
|
+
overflow-y: auto;
|
|
639
|
+
z-index: 99999;
|
|
640
|
+
}
|
|
641
|
+
.dropdown-list .selected {
|
|
642
|
+
display: flex;
|
|
643
|
+
padding: 4px 8px;
|
|
644
|
+
align-items: center;
|
|
645
|
+
gap: 4px;
|
|
646
|
+
align-self: stretch;
|
|
647
|
+
color: var(--text2, #bdbdbd);
|
|
648
|
+
font-family: Inter;
|
|
649
|
+
font-size: 11px;
|
|
650
|
+
font-style: normal;
|
|
651
|
+
font-weight: 500;
|
|
652
|
+
line-height: 16px;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
.label {
|
|
656
|
+
display: flex;
|
|
657
|
+
flex-direction: column;
|
|
658
|
+
align-items: flex-start;
|
|
659
|
+
flex: 1 0 0;
|
|
660
|
+
white-space: nowrap;
|
|
661
|
+
overflow: hidden;
|
|
662
|
+
text-overflow: ellipsis;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
.popup {
|
|
666
|
+
position: absolute;
|
|
667
|
+
z-index: 9999999;
|
|
668
|
+
top: 100px;
|
|
669
|
+
left: 73px;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
.dropdown-item {
|
|
673
|
+
all: unset;
|
|
674
|
+
cursor: pointer;
|
|
675
|
+
display: grid;
|
|
676
|
+
grid-template-columns: 16px 1fr;
|
|
677
|
+
align-items: center;
|
|
678
|
+
padding: 4px 8px;
|
|
679
|
+
gap: 4px;
|
|
680
|
+
align-self: stretch;
|
|
681
|
+
color: var(--text-text-1, #d9d9d9);
|
|
682
|
+
font-family: Inter;
|
|
683
|
+
font-size: 11px;
|
|
684
|
+
font-style: normal;
|
|
685
|
+
font-weight: 400;
|
|
686
|
+
line-height: 16px;
|
|
687
|
+
border: 1px solid transparent;
|
|
688
|
+
}
|
|
689
|
+
.dropdown-item .icon,
|
|
690
|
+
.dropdown-list .selected .icon {
|
|
691
|
+
display: flex;
|
|
692
|
+
width: 16px;
|
|
693
|
+
height: 16px;
|
|
694
|
+
align-items: center;
|
|
695
|
+
gap: 2px;
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
.arrow {
|
|
699
|
+
width: 12px;
|
|
700
|
+
overflow: hidden;
|
|
701
|
+
display: flex;
|
|
702
|
+
justify-content: center;
|
|
703
|
+
align-items: center;
|
|
704
|
+
}
|
|
705
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DropdownInstance, SelectProps } from './types.js';
|
|
2
|
+
declare const Select: import("svelte").Component<SelectProps, {
|
|
3
|
+
/**
|
|
4
|
+
* Inits the attribute.
|
|
5
|
+
*/ init: () => Promise<{
|
|
6
|
+
result: DropdownInstance[];
|
|
7
|
+
destroy(): void;
|
|
8
|
+
} | undefined>;
|
|
9
|
+
}, "selected">;
|
|
10
|
+
type Select = ReturnType<typeof Select>;
|
|
11
|
+
export default Select;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { default as Select } from './Select.svelte';
|
|
2
|
+
export type { SelectOption, SelectProps, SelectChangeEvent, SelectChangeHandler, SelectState, DropdownInstance, DropdownConfig, SelectStyles, NavigationKey, KeyboardNavigationEvent, SearchConfig, FilterFunction, SelectElementRefs, SelectInstanceManager } from './types.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Select } from './Select.svelte';
|