@12-apps/ui 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components-catalog.md +806 -0
- package/components-guidelines.md +347 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/eslint.config.js +77 -0
- package/package.json +247 -0
- package/src/__tests__/package-wiring.test.ts +37 -0
- package/src/__tests__/setup.ts +1 -0
- package/src/__tests__/social-login-button.test.tsx +186 -0
- package/src/__tests__/user-avatar.test.tsx +195 -0
- package/src/button.tsx +22 -0
- package/src/components/command/__tests__/command.test.tsx +112 -0
- package/src/components/data-display/Alert/Alert.md +209 -0
- package/src/components/data-display/Alert/Alert.stories.tsx +561 -0
- package/src/components/data-display/Alert/Alert.test.stories.tsx +709 -0
- package/src/components/data-display/Alert/Alert.tsx +449 -0
- package/src/components/data-display/Alert/Alert.types.ts +79 -0
- package/src/components/data-display/Alert/index.ts +2 -0
- package/src/components/data-display/AlertDialog/AlertDialog.md +408 -0
- package/src/components/data-display/AlertDialog/AlertDialog.stories.tsx +360 -0
- package/src/components/data-display/AlertDialog/AlertDialog.test.stories.tsx +753 -0
- package/src/components/data-display/AlertDialog/AlertDialog.tsx +273 -0
- package/src/components/data-display/AlertDialog/AlertDialog.types.ts +74 -0
- package/src/components/data-display/AlertDialog/index.ts +2 -0
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.stories.tsx +230 -0
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.test.stories.tsx +270 -0
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.tsx +116 -0
- package/src/components/data-display/AsyncStateContainer/AsyncStateContainer.types.ts +70 -0
- package/src/components/data-display/AsyncStateContainer/index.ts +2 -0
- package/src/components/data-display/Avatar/Avatar.md +568 -0
- package/src/components/data-display/Avatar/Avatar.stories.tsx +718 -0
- package/src/components/data-display/Avatar/Avatar.test.stories.tsx +820 -0
- package/src/components/data-display/Avatar/Avatar.tsx +507 -0
- package/src/components/data-display/Avatar/Avatar.types.ts +88 -0
- package/src/components/data-display/Avatar/index.ts +2 -0
- package/src/components/data-display/Badge/Badge.md +469 -0
- package/src/components/data-display/Badge/Badge.stories.tsx +1136 -0
- package/src/components/data-display/Badge/Badge.test.stories.tsx +1193 -0
- package/src/components/data-display/Badge/Badge.tsx +606 -0
- package/src/components/data-display/Badge/Badge.types.ts +118 -0
- package/src/components/data-display/Badge/index.ts +2 -0
- package/src/components/data-display/Banner/Banner.stories.tsx +524 -0
- package/src/components/data-display/Banner/Banner.test.stories.tsx +503 -0
- package/src/components/data-display/Banner/Banner.tsx +350 -0
- package/src/components/data-display/Banner/Banner.types.ts +41 -0
- package/src/components/data-display/Banner/banner.md +141 -0
- package/src/components/data-display/Banner/index.ts +2 -0
- package/src/components/data-display/Carousel/Carousel.md +815 -0
- package/src/components/data-display/Carousel/Carousel.stories.tsx +607 -0
- package/src/components/data-display/Carousel/Carousel.test.stories.tsx +691 -0
- package/src/components/data-display/Carousel/Carousel.tsx +765 -0
- package/src/components/data-display/Carousel/Carousel.types.ts +79 -0
- package/src/components/data-display/Carousel/index.ts +8 -0
- package/src/components/data-display/Chart/Chart.md +352 -0
- package/src/components/data-display/Chart/Chart.stories.tsx +568 -0
- package/src/components/data-display/Chart/Chart.test.stories.tsx +174 -0
- package/src/components/data-display/Chart/Chart.tsx +520 -0
- package/src/components/data-display/Chart/Chart.types.ts +65 -0
- package/src/components/data-display/Chart/index.ts +2 -0
- package/src/components/data-display/Chip/Chip.stories.tsx +251 -0
- package/src/components/data-display/Chip/Chip.test.stories.tsx +263 -0
- package/src/components/data-display/Chip/Chip.tsx +134 -0
- package/src/components/data-display/Chip/Chip.types.ts +51 -0
- package/src/components/data-display/Chip/chip.md +395 -0
- package/src/components/data-display/Chip/index.ts +2 -0
- package/src/components/data-display/DataGrid/DataGrid.md +602 -0
- package/src/components/data-display/DataGrid/DataGrid.stories.tsx +515 -0
- package/src/components/data-display/DataGrid/DataGrid.test.stories.tsx +659 -0
- package/src/components/data-display/DataGrid/DataGrid.tsx +743 -0
- package/src/components/data-display/DataGrid/DataGrid.types.ts +171 -0
- package/src/components/data-display/DataGrid/index.ts +21 -0
- package/src/components/data-display/DateTimeDisplay/DateTimeDisplay.tsx +197 -0
- package/src/components/data-display/DateTimeDisplay/DateTimeDisplay.types.ts +46 -0
- package/src/components/data-display/DateTimeDisplay/index.ts +2 -0
- package/src/components/data-display/DescriptionItem/DescriptionItem.md +226 -0
- package/src/components/data-display/DescriptionItem/DescriptionItem.stories.tsx +254 -0
- package/src/components/data-display/DescriptionItem/DescriptionItem.tsx +100 -0
- package/src/components/data-display/DescriptionItem/DescriptionItem.types.ts +1 -0
- package/src/components/data-display/DescriptionItem/index.ts +2 -0
- package/src/components/data-display/EmptyState/EmptyState.md +265 -0
- package/src/components/data-display/EmptyState/EmptyState.stories.tsx +282 -0
- package/src/components/data-display/EmptyState/EmptyState.test.stories.tsx +441 -0
- package/src/components/data-display/EmptyState/EmptyState.tsx +180 -0
- package/src/components/data-display/EmptyState/EmptyState.types.ts +31 -0
- package/src/components/data-display/EmptyState/index.ts +2 -0
- package/src/components/data-display/ErrorState/ErrorState.stories.tsx +110 -0
- package/src/components/data-display/ErrorState/ErrorState.test.stories.tsx +133 -0
- package/src/components/data-display/ErrorState/ErrorState.tsx +118 -0
- package/src/components/data-display/ErrorState/ErrorState.types.ts +45 -0
- package/src/components/data-display/ErrorState/index.ts +2 -0
- package/src/components/data-display/HoverCard/HoverCard.md +389 -0
- package/src/components/data-display/HoverCard/HoverCard.stories.tsx +648 -0
- package/src/components/data-display/HoverCard/HoverCard.test.stories.tsx +929 -0
- package/src/components/data-display/HoverCard/HoverCard.tsx +657 -0
- package/src/components/data-display/HoverCard/HoverCard.types.ts +116 -0
- package/src/components/data-display/HoverCard/index.ts +2 -0
- package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.md +532 -0
- package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.stories.tsx +411 -0
- package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.tsx +245 -0
- package/src/components/data-display/InteractiveTooltip/InteractiveTooltip.types.ts +64 -0
- package/src/components/data-display/InteractiveTooltip/index.ts +2 -0
- package/src/components/data-display/LazyImage/LazyImage.md +356 -0
- package/src/components/data-display/LazyImage/LazyImage.stories.tsx +387 -0
- package/src/components/data-display/LazyImage/LazyImage.tsx +323 -0
- package/src/components/data-display/LazyImage/LazyImage.types.ts +205 -0
- package/src/components/data-display/LazyImage/index.ts +2 -0
- package/src/components/data-display/Lightbox/Lightbox.stories.tsx +315 -0
- package/src/components/data-display/Lightbox/Lightbox.test.stories.tsx +605 -0
- package/src/components/data-display/Lightbox/Lightbox.tsx +666 -0
- package/src/components/data-display/Lightbox/Lightbox.types.ts +49 -0
- package/src/components/data-display/Lightbox/index.ts +2 -0
- package/src/components/data-display/Lightbox/lightbox.md +298 -0
- package/src/components/data-display/LoadingState/LoadingState.stories.tsx +124 -0
- package/src/components/data-display/LoadingState/LoadingState.test.stories.tsx +99 -0
- package/src/components/data-display/LoadingState/LoadingState.tsx +103 -0
- package/src/components/data-display/LoadingState/LoadingState.types.ts +37 -0
- package/src/components/data-display/LoadingState/index.ts +2 -0
- package/src/components/data-display/MapPreview/MapPreview.md +154 -0
- package/src/components/data-display/MapPreview/MapPreview.stories.tsx +458 -0
- package/src/components/data-display/MapPreview/MapPreview.test.stories.tsx +390 -0
- package/src/components/data-display/MapPreview/MapPreview.tsx +922 -0
- package/src/components/data-display/MapPreview/MapPreview.types.ts +56 -0
- package/src/components/data-display/MapPreview/index.ts +2 -0
- package/src/components/data-display/Popover/Popover.md +245 -0
- package/src/components/data-display/Popover/Popover.stories.tsx +295 -0
- package/src/components/data-display/Popover/Popover.test.stories.tsx +1168 -0
- package/src/components/data-display/Popover/Popover.tsx +132 -0
- package/src/components/data-display/Popover/Popover.types.ts +33 -0
- package/src/components/data-display/Popover/index.ts +2 -0
- package/src/components/data-display/Progress/Progress.md +450 -0
- package/src/components/data-display/Progress/Progress.stories.tsx +481 -0
- package/src/components/data-display/Progress/Progress.test.stories.tsx +2070 -0
- package/src/components/data-display/Progress/Progress.tsx +332 -0
- package/src/components/data-display/Progress/Progress.types.ts +61 -0
- package/src/components/data-display/Progress/index.ts +2 -0
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.md +108 -0
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.stories.tsx +160 -0
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.test.stories.tsx +190 -0
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.tsx +224 -0
- package/src/components/data-display/SectionOnboarding/SectionOnboarding.types.ts +101 -0
- package/src/components/data-display/SectionOnboarding/index.ts +7 -0
- package/src/components/data-display/Sheet/Sheet.md +475 -0
- package/src/components/data-display/Sheet/Sheet.stories.tsx +883 -0
- package/src/components/data-display/Sheet/Sheet.test.stories.tsx +1101 -0
- package/src/components/data-display/Sheet/Sheet.tsx +978 -0
- package/src/components/data-display/Sheet/Sheet.types.ts +93 -0
- package/src/components/data-display/Sheet/index.ts +8 -0
- package/src/components/data-display/Stepper/Stepper.md +542 -0
- package/src/components/data-display/Stepper/Stepper.stories.tsx +540 -0
- package/src/components/data-display/Stepper/Stepper.test.stories.tsx +607 -0
- package/src/components/data-display/Stepper/Stepper.tsx +328 -0
- package/src/components/data-display/Stepper/Stepper.types.ts +97 -0
- package/src/components/data-display/Stepper/index.ts +2 -0
- package/src/components/data-display/Table/Table.md +243 -0
- package/src/components/data-display/Table/Table.stories.tsx +801 -0
- package/src/components/data-display/Table/Table.test.stories.tsx +369 -0
- package/src/components/data-display/Table/Table.tsx +831 -0
- package/src/components/data-display/Table/Table.types.ts +335 -0
- package/src/components/data-display/Table/index.ts +2 -0
- package/src/components/data-display/Timeline/Timeline.md +201 -0
- package/src/components/data-display/Timeline/Timeline.stories.tsx +444 -0
- package/src/components/data-display/Timeline/Timeline.test.stories.tsx +944 -0
- package/src/components/data-display/Timeline/Timeline.tsx +348 -0
- package/src/components/data-display/Timeline/Timeline.types.ts +26 -0
- package/src/components/data-display/Timeline/index.ts +2 -0
- package/src/components/data-display/TimingDiagram/TimingDiagram.md +162 -0
- package/src/components/data-display/TimingDiagram/TimingDiagram.stories.tsx +475 -0
- package/src/components/data-display/TimingDiagram/TimingDiagram.test.stories.tsx +734 -0
- package/src/components/data-display/TimingDiagram/TimingDiagram.tsx +399 -0
- package/src/components/data-display/TimingDiagram/TimingDiagram.types.ts +19 -0
- package/src/components/data-display/TimingDiagram/index.ts +2 -0
- package/src/components/data-display/Tooltip/Tooltip.md +397 -0
- package/src/components/data-display/Tooltip/Tooltip.stories.tsx +465 -0
- package/src/components/data-display/Tooltip/Tooltip.test.stories.tsx +1168 -0
- package/src/components/data-display/Tooltip/Tooltip.tsx +161 -0
- package/src/components/data-display/Tooltip/Tooltip.types.ts +33 -0
- package/src/components/data-display/Tooltip/index.ts +2 -0
- package/src/components/data-display/index.ts +29 -0
- package/src/components/feedback/Dialog/Dialog.md +527 -0
- package/src/components/feedback/Dialog/Dialog.stories.tsx +833 -0
- package/src/components/feedback/Dialog/Dialog.styles.ts +171 -0
- package/src/components/feedback/Dialog/Dialog.test.stories.tsx +955 -0
- package/src/components/feedback/Dialog/Dialog.tsx +256 -0
- package/src/components/feedback/Dialog/Dialog.types.ts +46 -0
- package/src/components/feedback/Dialog/index.ts +9 -0
- package/src/components/feedback/Modal/Modal.md +629 -0
- package/src/components/feedback/Modal/Modal.stories.tsx +765 -0
- package/src/components/feedback/Modal/Modal.test.stories.tsx +251 -0
- package/src/components/feedback/Modal/Modal.tsx +279 -0
- package/src/components/feedback/Modal/Modal.types.ts +26 -0
- package/src/components/feedback/Modal/index.ts +7 -0
- package/src/components/feedback/Sonner/Sonner.stories.tsx +698 -0
- package/src/components/feedback/Sonner/Sonner.test.stories.tsx +896 -0
- package/src/components/feedback/Sonner/Sonner.tsx +493 -0
- package/src/components/feedback/Sonner/Sonner.types.ts +65 -0
- package/src/components/feedback/Sonner/index.ts +8 -0
- package/src/components/feedback/StackedModal/StackedModal.md +273 -0
- package/src/components/feedback/StackedModal/StackedModal.stories.tsx +1785 -0
- package/src/components/feedback/StackedModal/StackedModal.test.stories.tsx +975 -0
- package/src/components/feedback/StackedModal/StackedModal.tsx +664 -0
- package/src/components/feedback/StackedModal/StackedModal.types.ts +70 -0
- package/src/components/feedback/StackedModal/index.ts +11 -0
- package/src/components/feedback/Toast/Toast.md +547 -0
- package/src/components/feedback/Toast/Toast.stories.tsx +548 -0
- package/src/components/feedback/Toast/Toast.test.stories.tsx +834 -0
- package/src/components/feedback/Toast/Toast.tsx +279 -0
- package/src/components/feedback/Toast/Toast.types.ts +59 -0
- package/src/components/feedback/Toast/index.ts +8 -0
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.md +610 -0
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.stories.tsx +691 -0
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.test.stories.tsx +634 -0
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.tsx +554 -0
- package/src/components/feedback/TutorialOverlay/TutorialOverlay.types.ts +30 -0
- package/src/components/feedback/TutorialOverlay/index.ts +2 -0
- package/src/components/feedback/index.ts +6 -0
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.md +633 -0
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.stories.tsx +663 -0
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.test.stories.tsx +723 -0
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.tsx +836 -0
- package/src/components/form/AddressAutocomplete/AddressAutocomplete.types.ts +37 -0
- package/src/components/form/AddressAutocomplete/index.ts +2 -0
- package/src/components/form/Autocomplete/Autocomplete.helpers.ts +115 -0
- package/src/components/form/Autocomplete/Autocomplete.keys.ts +134 -0
- package/src/components/form/Autocomplete/Autocomplete.parts.tsx +337 -0
- package/src/components/form/Autocomplete/Autocomplete.stories.tsx +715 -0
- package/src/components/form/Autocomplete/Autocomplete.test.stories.tsx +825 -0
- package/src/components/form/Autocomplete/Autocomplete.tsx +166 -0
- package/src/components/form/Autocomplete/Autocomplete.types.ts +116 -0
- package/src/components/form/Autocomplete/autocomplete.md +789 -0
- package/src/components/form/Autocomplete/index.ts +8 -0
- package/src/components/form/Autocomplete/useAutocomplete.ts +311 -0
- package/src/components/form/Button/Button.md +411 -0
- package/src/components/form/Button/Button.stories.tsx +362 -0
- package/src/components/form/Button/Button.test.stories.tsx +603 -0
- package/src/components/form/Button/Button.tsx +326 -0
- package/src/components/form/Button/Button.types.ts +74 -0
- package/src/components/form/Button/index.ts +2 -0
- package/src/components/form/Calendar/Calendar.md +807 -0
- package/src/components/form/Calendar/Calendar.stories.tsx +349 -0
- package/src/components/form/Calendar/Calendar.test.stories.tsx +465 -0
- package/src/components/form/Calendar/Calendar.tsx +571 -0
- package/src/components/form/Calendar/Calendar.types.ts +81 -0
- package/src/components/form/Calendar/index.ts +11 -0
- package/src/components/form/Checkbox/Checkbox.md +200 -0
- package/src/components/form/Checkbox/Checkbox.stories.tsx +265 -0
- package/src/components/form/Checkbox/Checkbox.test.stories.tsx +181 -0
- package/src/components/form/Checkbox/Checkbox.tsx +170 -0
- package/src/components/form/Checkbox/Checkbox.types.ts +20 -0
- package/src/components/form/Checkbox/index.ts +2 -0
- package/src/components/form/CodeEditor/CodeEditor.md +350 -0
- package/src/components/form/CodeEditor/CodeEditor.stories.tsx +871 -0
- package/src/components/form/CodeEditor/CodeEditor.test.stories.tsx +575 -0
- package/src/components/form/CodeEditor/CodeEditor.tsx +415 -0
- package/src/components/form/CodeEditor/CodeEditor.types.ts +38 -0
- package/src/components/form/CodeEditor/index.ts +2 -0
- package/src/components/form/Command/Command.md +468 -0
- package/src/components/form/Command/Command.stories.tsx +580 -0
- package/src/components/form/Command/Command.test.stories.tsx +215 -0
- package/src/components/form/Command/Command.tsx +545 -0
- package/src/components/form/Command/Command.types.ts +116 -0
- package/src/components/form/Command/index.ts +12 -0
- package/src/components/form/CreatableSelect/CreatableSelect.md +114 -0
- package/src/components/form/CreatableSelect/CreatableSelect.stories.tsx +112 -0
- package/src/components/form/CreatableSelect/CreatableSelect.test.stories.tsx +134 -0
- package/src/components/form/CreatableSelect/CreatableSelect.tsx +149 -0
- package/src/components/form/CreatableSelect/CreatableSelect.types.ts +37 -0
- package/src/components/form/CreatableSelect/index.ts +2 -0
- package/src/components/form/Form/Form.md +325 -0
- package/src/components/form/Form/Form.stories.tsx +687 -0
- package/src/components/form/Form/Form.test.stories.tsx +601 -0
- package/src/components/form/Form/Form.tsx +136 -0
- package/src/components/form/Form/Form.types.ts +42 -0
- package/src/components/form/Form/index.ts +8 -0
- package/src/components/form/Input/Input.md +252 -0
- package/src/components/form/Input/Input.stories.tsx +256 -0
- package/src/components/form/Input/Input.test.stories.tsx +1184 -0
- package/src/components/form/Input/Input.tsx +263 -0
- package/src/components/form/Input/Input.types.ts +24 -0
- package/src/components/form/Input/index.ts +2 -0
- package/src/components/form/InputOTP/InputOTP.md +419 -0
- package/src/components/form/InputOTP/InputOTP.stories.tsx +774 -0
- package/src/components/form/InputOTP/InputOTP.test.stories.tsx +596 -0
- package/src/components/form/InputOTP/InputOTP.tsx +231 -0
- package/src/components/form/InputOTP/InputOTP.types.ts +68 -0
- package/src/components/form/InputOTP/index.ts +2 -0
- package/src/components/form/Label/Label.md +426 -0
- package/src/components/form/Label/Label.stories.tsx +473 -0
- package/src/components/form/Label/Label.test.stories.tsx +909 -0
- package/src/components/form/Label/Label.tsx +367 -0
- package/src/components/form/Label/Label.types.ts +35 -0
- package/src/components/form/Label/index.ts +2 -0
- package/src/components/form/Menubar/Menubar.md +275 -0
- package/src/components/form/Menubar/Menubar.stories.tsx +472 -0
- package/src/components/form/Menubar/Menubar.test.stories.tsx +588 -0
- package/src/components/form/Menubar/Menubar.tsx +467 -0
- package/src/components/form/Menubar/Menubar.types.ts +71 -0
- package/src/components/form/Menubar/index.ts +8 -0
- package/src/components/form/PasswordStrength/PasswordStrength.md +139 -0
- package/src/components/form/PasswordStrength/PasswordStrength.stories.tsx +562 -0
- package/src/components/form/PasswordStrength/PasswordStrength.test.stories.tsx +327 -0
- package/src/components/form/PasswordStrength/PasswordStrength.tsx +419 -0
- package/src/components/form/PasswordStrength/PasswordStrength.types.ts +18 -0
- package/src/components/form/PasswordStrength/index.ts +2 -0
- package/src/components/form/PhoneInput/PhoneInput.md +578 -0
- package/src/components/form/PhoneInput/PhoneInput.stories.tsx +495 -0
- package/src/components/form/PhoneInput/PhoneInput.test.stories.tsx +666 -0
- package/src/components/form/PhoneInput/PhoneInput.tsx +376 -0
- package/src/components/form/PhoneInput/PhoneInput.types.ts +25 -0
- package/src/components/form/PhoneInput/index.ts +2 -0
- package/src/components/form/RadioGroup/RadioGroup.md +477 -0
- package/src/components/form/RadioGroup/RadioGroup.stories.tsx +518 -0
- package/src/components/form/RadioGroup/RadioGroup.test.stories.tsx +685 -0
- package/src/components/form/RadioGroup/RadioGroup.tsx +664 -0
- package/src/components/form/RadioGroup/RadioGroup.types.ts +82 -0
- package/src/components/form/RadioGroup/index.ts +2 -0
- package/src/components/form/RichTextEditor/RichTextEditor.md +710 -0
- package/src/components/form/RichTextEditor/RichTextEditor.stories.tsx +261 -0
- package/src/components/form/RichTextEditor/RichTextEditor.test.stories.tsx +498 -0
- package/src/components/form/RichTextEditor/RichTextEditor.tsx +468 -0
- package/src/components/form/RichTextEditor/RichTextEditor.types.ts +72 -0
- package/src/components/form/RichTextEditor/index.ts +2 -0
- package/src/components/form/SearchPalette/SearchPalette.md +69 -0
- package/src/components/form/SearchPalette/SearchPalette.parts.tsx +358 -0
- package/src/components/form/SearchPalette/SearchPalette.stories.tsx +135 -0
- package/src/components/form/SearchPalette/SearchPalette.tsx +141 -0
- package/src/components/form/SearchPalette/SearchPalette.types.ts +82 -0
- package/src/components/form/SearchPalette/index.ts +7 -0
- package/src/components/form/Select/Select.md +254 -0
- package/src/components/form/Select/Select.stories.tsx +364 -0
- package/src/components/form/Select/Select.test.stories.tsx +977 -0
- package/src/components/form/Select/Select.tsx +239 -0
- package/src/components/form/Select/Select.types.ts +57 -0
- package/src/components/form/Select/index.ts +2 -0
- package/src/components/form/Slider/Slider.md +326 -0
- package/src/components/form/Slider/Slider.stories.tsx +418 -0
- package/src/components/form/Slider/Slider.test.stories.tsx +1044 -0
- package/src/components/form/Slider/Slider.tsx +374 -0
- package/src/components/form/Slider/Slider.types.ts +113 -0
- package/src/components/form/Slider/index.ts +2 -0
- package/src/components/form/Switch/Switch.md +565 -0
- package/src/components/form/Switch/Switch.stories.tsx +697 -0
- package/src/components/form/Switch/Switch.test.stories.tsx +597 -0
- package/src/components/form/Switch/Switch.tsx +578 -0
- package/src/components/form/Switch/Switch.types.ts +130 -0
- package/src/components/form/Switch/index.ts +2 -0
- package/src/components/form/Textarea/Textarea.stories.tsx +473 -0
- package/src/components/form/Textarea/Textarea.test.stories.tsx +708 -0
- package/src/components/form/Textarea/Textarea.tsx +678 -0
- package/src/components/form/Textarea/Textarea.types.ts +84 -0
- package/src/components/form/Textarea/index.ts +2 -0
- package/src/components/form/Toggle/Toggle.md +234 -0
- package/src/components/form/Toggle/Toggle.stories.tsx +638 -0
- package/src/components/form/Toggle/Toggle.test.stories.tsx +1167 -0
- package/src/components/form/Toggle/Toggle.tsx +265 -0
- package/src/components/form/Toggle/Toggle.types.ts +79 -0
- package/src/components/form/Toggle/index.ts +2 -0
- package/src/components/form/ToggleGroup/ToggleGroup.md +329 -0
- package/src/components/form/ToggleGroup/ToggleGroup.stories.tsx +617 -0
- package/src/components/form/ToggleGroup/ToggleGroup.test.stories.tsx +918 -0
- package/src/components/form/ToggleGroup/ToggleGroup.tsx +129 -0
- package/src/components/form/ToggleGroup/ToggleGroup.types.ts +53 -0
- package/src/components/form/ToggleGroup/index.ts +2 -0
- package/src/components/form/UploadButton/UploadButton.md +44 -0
- package/src/components/form/UploadButton/UploadButton.stories.tsx +366 -0
- package/src/components/form/UploadButton/UploadButton.test.stories.tsx +454 -0
- package/src/components/form/UploadButton/UploadButton.tsx +312 -0
- package/src/components/form/UploadButton/UploadButton.types.ts +58 -0
- package/src/components/form/UploadButton/index.ts +2 -0
- package/src/components/form/index.ts +25 -0
- package/src/components/form/total-form/Fields/SelectField.tsx +57 -0
- package/src/components/form/total-form/Fields/TextField.tsx +58 -0
- package/src/components/form/total-form/Fields/index.ts +4 -0
- package/src/components/form/total-form/FormContainer.tsx +104 -0
- package/src/components/form/total-form/FormContext.tsx +38 -0
- package/src/components/form/total-form/FormErrorSnackbar.tsx +35 -0
- package/src/components/form/total-form/SubmitButton.tsx +27 -0
- package/src/components/form/total-form/index.ts +12 -0
- package/src/components/form/total-form/total-form.test.tsx +97 -0
- package/src/components/index.ts +7 -0
- package/src/components/layout/Accordion/Accordion.md +725 -0
- package/src/components/layout/Accordion/Accordion.stories.tsx +690 -0
- package/src/components/layout/Accordion/Accordion.test.stories.tsx +1362 -0
- package/src/components/layout/Accordion/Accordion.tsx +242 -0
- package/src/components/layout/Accordion/Accordion.types.ts +32 -0
- package/src/components/layout/Accordion/index.ts +8 -0
- package/src/components/layout/Card/Card.md +533 -0
- package/src/components/layout/Card/Card.stories.tsx +593 -0
- package/src/components/layout/Card/Card.test.stories.tsx +1134 -0
- package/src/components/layout/Card/Card.tsx +404 -0
- package/src/components/layout/Card/Card.types.ts +57 -0
- package/src/components/layout/Card/index.ts +8 -0
- package/src/components/layout/Collapsible/Collapsible.md +135 -0
- package/src/components/layout/Collapsible/Collapsible.stories.tsx +180 -0
- package/src/components/layout/Collapsible/Collapsible.test.stories.tsx +304 -0
- package/src/components/layout/Collapsible/Collapsible.tsx +198 -0
- package/src/components/layout/Collapsible/Collapsible.types.ts +35 -0
- package/src/components/layout/Collapsible/index.ts +6 -0
- package/src/components/layout/Container/Container.md +420 -0
- package/src/components/layout/Container/Container.stories.tsx +557 -0
- package/src/components/layout/Container/Container.test.stories.tsx +750 -0
- package/src/components/layout/Container/Container.tsx +72 -0
- package/src/components/layout/Container/Container.types.ts +11 -0
- package/src/components/layout/Container/index.ts +2 -0
- package/src/components/layout/ContentToolbar/ColumnsMenu.tsx +99 -0
- package/src/components/layout/ContentToolbar/ContentToolbar.md +75 -0
- package/src/components/layout/ContentToolbar/ContentToolbar.stories.tsx +129 -0
- package/src/components/layout/ContentToolbar/ContentToolbar.test.stories.tsx +251 -0
- package/src/components/layout/ContentToolbar/ContentToolbar.tsx +108 -0
- package/src/components/layout/ContentToolbar/ContentToolbar.types.ts +229 -0
- package/src/components/layout/ContentToolbar/FilterTrigger.tsx +71 -0
- package/src/components/layout/ContentToolbar/MultiSelectDropdown.tsx +297 -0
- package/src/components/layout/ContentToolbar/SavedViewsMenu.tsx +334 -0
- package/src/components/layout/ContentToolbar/SortByDropdown.tsx +213 -0
- package/src/components/layout/ContentToolbar/ViewSelector.tsx +98 -0
- package/src/components/layout/ContentToolbar/__tests__/ColumnsMenu.test.tsx +39 -0
- package/src/components/layout/ContentToolbar/__tests__/MultiSelectDropdown.test.tsx +110 -0
- package/src/components/layout/ContentToolbar/__tests__/SavedViewsMenu.test.tsx +99 -0
- package/src/components/layout/ContentToolbar/index.ts +24 -0
- package/src/components/layout/ContentToolbar/tests.md +42 -0
- package/src/components/layout/ContentToolbar/track.md +41 -0
- package/src/components/layout/Dashboard/Dashboard.md +71 -0
- package/src/components/layout/Dashboard/Dashboard.stories.tsx +104 -0
- package/src/components/layout/Dashboard/Dashboard.test.stories.tsx +164 -0
- package/src/components/layout/Dashboard/Dashboard.tsx +297 -0
- package/src/components/layout/Dashboard/Dashboard.types.ts +157 -0
- package/src/components/layout/Dashboard/DashboardContext.tsx +47 -0
- package/src/components/layout/Dashboard/DashboardParts.tsx +216 -0
- package/src/components/layout/Dashboard/index.ts +18 -0
- package/src/components/layout/Dashboard/tests.md +46 -0
- package/src/components/layout/Dashboard/track.md +50 -0
- package/src/components/layout/Drawer/Drawer.md +479 -0
- package/src/components/layout/Drawer/Drawer.stories.tsx +660 -0
- package/src/components/layout/Drawer/Drawer.test.stories.tsx +1339 -0
- package/src/components/layout/Drawer/Drawer.tsx +150 -0
- package/src/components/layout/Drawer/Drawer.types.ts +34 -0
- package/src/components/layout/Drawer/index.ts +2 -0
- package/src/components/layout/Resizable/Resizable.md +308 -0
- package/src/components/layout/Resizable/Resizable.stories.tsx +1039 -0
- package/src/components/layout/Resizable/Resizable.test.stories.tsx +750 -0
- package/src/components/layout/Resizable/Resizable.tsx +190 -0
- package/src/components/layout/Resizable/Resizable.types.ts +34 -0
- package/src/components/layout/Resizable/index.ts +2 -0
- package/src/components/layout/ScrollArea/ScrollArea.md +122 -0
- package/src/components/layout/ScrollArea/ScrollArea.stories.tsx +651 -0
- package/src/components/layout/ScrollArea/ScrollArea.test.stories.tsx +619 -0
- package/src/components/layout/ScrollArea/ScrollArea.tsx +449 -0
- package/src/components/layout/ScrollArea/ScrollArea.types.ts +80 -0
- package/src/components/layout/ScrollArea/index.ts +7 -0
- package/src/components/layout/Separator/Separator.stories.tsx +563 -0
- package/src/components/layout/Separator/Separator.test.stories.tsx +527 -0
- package/src/components/layout/Separator/Separator.tsx +187 -0
- package/src/components/layout/Separator/Separator.types.ts +17 -0
- package/src/components/layout/Separator/index.ts +2 -0
- package/src/components/layout/SettingsLayout/SettingsLayout.md +139 -0
- package/src/components/layout/SettingsLayout/SettingsLayout.parts.tsx +357 -0
- package/src/components/layout/SettingsLayout/SettingsLayout.stories.tsx +194 -0
- package/src/components/layout/SettingsLayout/SettingsLayout.test.stories.tsx +175 -0
- package/src/components/layout/SettingsLayout/SettingsLayout.tsx +69 -0
- package/src/components/layout/SettingsLayout/SettingsLayout.types.ts +61 -0
- package/src/components/layout/SettingsLayout/index.ts +6 -0
- package/src/components/layout/Sidebar/Sidebar.md +367 -0
- package/src/components/layout/Sidebar/Sidebar.stories.tsx +611 -0
- package/src/components/layout/Sidebar/Sidebar.test.stories.tsx +1326 -0
- package/src/components/layout/Sidebar/Sidebar.tsx +131 -0
- package/src/components/layout/Sidebar/Sidebar.types.ts +30 -0
- package/src/components/layout/Sidebar/index.ts +7 -0
- package/src/components/layout/Skeleton/Skeleton.md +240 -0
- package/src/components/layout/Skeleton/Skeleton.stories.tsx +689 -0
- package/src/components/layout/Skeleton/Skeleton.test.stories.tsx +521 -0
- package/src/components/layout/Skeleton/Skeleton.tsx +166 -0
- package/src/components/layout/Skeleton/Skeleton.types.ts +19 -0
- package/src/components/layout/Skeleton/index.ts +2 -0
- package/src/components/layout/Spacer/Spacer.md +84 -0
- package/src/components/layout/Spacer/Spacer.stories.tsx +502 -0
- package/src/components/layout/Spacer/Spacer.test.stories.tsx +472 -0
- package/src/components/layout/Spacer/Spacer.tsx +68 -0
- package/src/components/layout/Spacer/Spacer.types.ts +12 -0
- package/src/components/layout/Spacer/index.ts +2 -0
- package/src/components/layout/TableFilter/TableFilter.md +55 -0
- package/src/components/layout/TableFilter/TableFilter.stories.tsx +82 -0
- package/src/components/layout/TableFilter/TableFilter.test.stories.tsx +87 -0
- package/src/components/layout/TableFilter/TableFilter.tsx +383 -0
- package/src/components/layout/TableFilter/TableFilter.types.ts +87 -0
- package/src/components/layout/TableFilter/TableFilterContext.tsx +29 -0
- package/src/components/layout/TableFilter/index.ts +15 -0
- package/src/components/layout/TableFilter/tests.md +37 -0
- package/src/components/layout/TableFilter/track.md +36 -0
- package/src/components/layout/index.ts +14 -0
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.md +558 -0
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.stories.tsx +640 -0
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.test.stories.tsx +1007 -0
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.tsx +516 -0
- package/src/components/navigation/Breadcrumbs/Breadcrumbs.types.ts +132 -0
- package/src/components/navigation/Breadcrumbs/index.ts +2 -0
- package/src/components/navigation/CommandPalette/CommandPalette.md +201 -0
- package/src/components/navigation/CommandPalette/CommandPalette.stories.tsx +384 -0
- package/src/components/navigation/CommandPalette/CommandPalette.test.stories.tsx +437 -0
- package/src/components/navigation/CommandPalette/CommandPalette.tsx +434 -0
- package/src/components/navigation/CommandPalette/CommandPalette.types.ts +25 -0
- package/src/components/navigation/CommandPalette/index.ts +2 -0
- package/src/components/navigation/ContextMenu/ContextMenu.md +535 -0
- package/src/components/navigation/ContextMenu/ContextMenu.stories.tsx +611 -0
- package/src/components/navigation/ContextMenu/ContextMenu.test.stories.tsx +850 -0
- package/src/components/navigation/ContextMenu/ContextMenu.tsx +254 -0
- package/src/components/navigation/ContextMenu/ContextMenu.types.ts +96 -0
- package/src/components/navigation/ContextMenu/index.ts +2 -0
- package/src/components/navigation/DropdownMenu/DropdownMenu.md +514 -0
- package/src/components/navigation/DropdownMenu/DropdownMenu.stories.tsx +580 -0
- package/src/components/navigation/DropdownMenu/DropdownMenu.test.stories.tsx +660 -0
- package/src/components/navigation/DropdownMenu/DropdownMenu.tsx +305 -0
- package/src/components/navigation/DropdownMenu/DropdownMenu.types.ts +116 -0
- package/src/components/navigation/DropdownMenu/index.ts +2 -0
- package/src/components/navigation/NavigationMenu/NavigationMenu.md +580 -0
- package/src/components/navigation/NavigationMenu/NavigationMenu.tsx +874 -0
- package/src/components/navigation/NavigationMenu/NavigationMenu.types.ts +135 -0
- package/src/components/navigation/NavigationMenu/index.ts +2 -0
- package/src/components/navigation/NavigationMenu/stories/NavigationMenu.stories.tsx +518 -0
- package/src/components/navigation/NavigationMenu/stories/NavigationMenu.test.stories.tsx +931 -0
- package/src/components/navigation/NavigationMenu/stories/NavigationMenuHorizontal.stories.tsx +503 -0
- package/src/components/navigation/NavigationMenu/stories/NavigationMenuVertical.stories.tsx +455 -0
- package/src/components/navigation/Pagination/Pagination.md +699 -0
- package/src/components/navigation/Pagination/Pagination.stories.tsx +604 -0
- package/src/components/navigation/Pagination/Pagination.test.stories.tsx +520 -0
- package/src/components/navigation/Pagination/Pagination.tsx +356 -0
- package/src/components/navigation/Pagination/Pagination.types.ts +129 -0
- package/src/components/navigation/Pagination/index.ts +2 -0
- package/src/components/navigation/Tabs/Tabs.md +774 -0
- package/src/components/navigation/Tabs/Tabs.stories.tsx +1006 -0
- package/src/components/navigation/Tabs/Tabs.test.stories.tsx +1225 -0
- package/src/components/navigation/Tabs/Tabs.tsx +433 -0
- package/src/components/navigation/Tabs/Tabs.types.ts +239 -0
- package/src/components/navigation/Tabs/index.ts +2 -0
- package/src/components/navigation/index.ts +7 -0
- package/src/components/typography/Blockquote/Blockquote.md +130 -0
- package/src/components/typography/Blockquote/Blockquote.stories.tsx +359 -0
- package/src/components/typography/Blockquote/Blockquote.test.stories.tsx +432 -0
- package/src/components/typography/Blockquote/Blockquote.tsx +166 -0
- package/src/components/typography/Blockquote/Blockquote.types.ts +11 -0
- package/src/components/typography/Blockquote/index.ts +2 -0
- package/src/components/typography/Code/Code.md +182 -0
- package/src/components/typography/Code/Code.stories.tsx +686 -0
- package/src/components/typography/Code/Code.test.stories.tsx +703 -0
- package/src/components/typography/Code/Code.tsx +228 -0
- package/src/components/typography/Code/Code.types.ts +12 -0
- package/src/components/typography/Code/index.ts +2 -0
- package/src/components/typography/Heading/Heading.md +143 -0
- package/src/components/typography/Heading/Heading.stories.tsx +451 -0
- package/src/components/typography/Heading/Heading.test.stories.tsx +830 -0
- package/src/components/typography/Heading/Heading.tsx +178 -0
- package/src/components/typography/Heading/Heading.types.ts +11 -0
- package/src/components/typography/Heading/index.ts +2 -0
- package/src/components/typography/Paragraph/Paragraph.md +80 -0
- package/src/components/typography/Paragraph/Paragraph.stories.tsx +280 -0
- package/src/components/typography/Paragraph/Paragraph.test.stories.tsx +238 -0
- package/src/components/typography/Paragraph/Paragraph.tsx +99 -0
- package/src/components/typography/Paragraph/Paragraph.types.ts +10 -0
- package/src/components/typography/Paragraph/index.ts +2 -0
- package/src/components/typography/Text/Text.md +129 -0
- package/src/components/typography/Text/Text.stories.tsx +359 -0
- package/src/components/typography/Text/Text.test.stories.tsx +762 -0
- package/src/components/typography/Text/Text.tsx +159 -0
- package/src/components/typography/Text/Text.types.ts +15 -0
- package/src/components/typography/Text/index.ts +2 -0
- package/src/components/typography/index.ts +5 -0
- package/src/components/utility/AnimatedIcon/AnimatedIcon.md +359 -0
- package/src/components/utility/AnimatedIcon/AnimatedIcon.stories.tsx +947 -0
- package/src/components/utility/AnimatedIcon/AnimatedIcon.test.stories.tsx +596 -0
- package/src/components/utility/AnimatedIcon/AnimatedIcon.tsx +595 -0
- package/src/components/utility/AnimatedIcon/AnimatedIcon.types.ts +98 -0
- package/src/components/utility/AnimatedIcon/index.ts +2 -0
- package/src/components/utility/AspectRatio/AspectRatio.md +200 -0
- package/src/components/utility/AspectRatio/AspectRatio.stories.tsx +414 -0
- package/src/components/utility/AspectRatio/AspectRatio.test.stories.tsx +859 -0
- package/src/components/utility/AspectRatio/AspectRatio.tsx +76 -0
- package/src/components/utility/AspectRatio/AspectRatio.types.ts +13 -0
- package/src/components/utility/AspectRatio/index.ts +2 -0
- package/src/components/utility/InfiniteScroll/InfiniteScroll.md +531 -0
- package/src/components/utility/InfiniteScroll/InfiniteScroll.stories.tsx +620 -0
- package/src/components/utility/InfiniteScroll/InfiniteScroll.test.stories.tsx +358 -0
- package/src/components/utility/InfiniteScroll/InfiniteScroll.tsx +204 -0
- package/src/components/utility/InfiniteScroll/InfiniteScroll.types.ts +39 -0
- package/src/components/utility/InfiniteScroll/index.ts +6 -0
- package/src/components/utility/Portal/Portal.button-container.example.tsx +99 -0
- package/src/components/utility/Portal/Portal.md +593 -0
- package/src/components/utility/Portal/Portal.stories.tsx +340 -0
- package/src/components/utility/Portal/Portal.test.stories.tsx +2086 -0
- package/src/components/utility/Portal/Portal.tsx +39 -0
- package/src/components/utility/Portal/Portal.types.ts +7 -0
- package/src/components/utility/Portal/index.ts +2 -0
- package/src/components/utility/Transition/Transition.md +684 -0
- package/src/components/utility/Transition/Transition.stories.tsx +493 -0
- package/src/components/utility/Transition/Transition.test.stories.tsx +854 -0
- package/src/components/utility/Transition/Transition.tsx +140 -0
- package/src/components/utility/Transition/Transition.types.ts +14 -0
- package/src/components/utility/Transition/index.ts +6 -0
- package/src/components/utility/VirtualList/VirtualList.md +520 -0
- package/src/components/utility/VirtualList/VirtualList.stories.tsx +1073 -0
- package/src/components/utility/VirtualList/VirtualList.test.stories.tsx +1074 -0
- package/src/components/utility/VirtualList/VirtualList.tsx +369 -0
- package/src/components/utility/VirtualList/VirtualList.types.ts +56 -0
- package/src/components/utility/VirtualList/index.ts +7 -0
- package/src/components/utility/WorkflowStep/WorkflowStep.md +187 -0
- package/src/components/utility/WorkflowStep/WorkflowStep.stories.tsx +433 -0
- package/src/components/utility/WorkflowStep/WorkflowStep.test.stories.tsx +364 -0
- package/src/components/utility/WorkflowStep/WorkflowStep.tsx +506 -0
- package/src/components/utility/WorkflowStep/WorkflowStep.types.ts +133 -0
- package/src/components/utility/WorkflowStep/index.ts +13 -0
- package/src/components/utility/index.ts +7 -0
- package/src/index.ts +17 -0
- package/src/mui/AppBar.ts +2 -0
- package/src/mui/Box.ts +2 -0
- package/src/mui/CssBaseline.ts +2 -0
- package/src/mui/FormControl.ts +2 -0
- package/src/mui/FormControlLabel.ts +2 -0
- package/src/mui/Grid2.ts +2 -0
- package/src/mui/InputLabel.ts +2 -0
- package/src/mui/List.ts +2 -0
- package/src/mui/ListItem.ts +2 -0
- package/src/mui/ListItemButton.ts +2 -0
- package/src/mui/ListItemText.ts +2 -0
- package/src/mui/Stack.ts +2 -0
- package/src/mui/SvgIcon.ts +2 -0
- package/src/mui/Toolbar.ts +2 -0
- package/src/mui/styles.ts +2 -0
- package/src/mui/useMediaQuery.ts +1 -0
- package/src/social-login-button.tsx +199 -0
- package/src/user-avatar.tsx +102 -0
- package/src/utils/cn.ts +9 -0
- package/src/utils/index.ts +1 -0
|
@@ -0,0 +1,922 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Fullscreen as FullscreenIcon,
|
|
3
|
+
Layers as LayersIcon,
|
|
4
|
+
LocationOn as LocationIcon,
|
|
5
|
+
MyLocation as CenterIcon,
|
|
6
|
+
Navigation as NavigationIcon,
|
|
7
|
+
Place as PlaceIcon,
|
|
8
|
+
Search as SearchIcon,
|
|
9
|
+
ZoomIn as ZoomInIcon,
|
|
10
|
+
ZoomOut as ZoomOutIcon,
|
|
11
|
+
} from '@mui/icons-material';
|
|
12
|
+
import { alpha, Box, IconButton, InputAdornment,Paper, styled, TextField, Tooltip, Typography, useTheme } from '@mui/material';
|
|
13
|
+
import type { FC} from 'react';
|
|
14
|
+
import React, { useCallback,useEffect, useRef, useState } from 'react';
|
|
15
|
+
|
|
16
|
+
import type { HeatmapPoint,MapPreviewProps } from './MapPreview.types';
|
|
17
|
+
|
|
18
|
+
// Styled components
|
|
19
|
+
const MapContainer = styled(Paper)(({ theme }) => ({
|
|
20
|
+
position: 'relative',
|
|
21
|
+
width: '100%',
|
|
22
|
+
borderRadius: theme.shape.borderRadius * 2,
|
|
23
|
+
overflow: 'hidden',
|
|
24
|
+
background: `linear-gradient(135deg, ${alpha(theme.palette.background.paper, 0.9)} 0%, ${alpha(theme.palette.background.paper, 0.8)} 100%)`,
|
|
25
|
+
border: `1px solid ${alpha(theme.palette.divider, 0.18)}`,
|
|
26
|
+
}));
|
|
27
|
+
|
|
28
|
+
const MapWrapper = styled(Box)<{ height: string }>(({ height }) => ({
|
|
29
|
+
width: '100%',
|
|
30
|
+
height,
|
|
31
|
+
position: 'relative',
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
const MapControls = styled(Box)(({ theme }) => ({
|
|
35
|
+
position: 'absolute',
|
|
36
|
+
top: theme.spacing(2),
|
|
37
|
+
right: theme.spacing(2),
|
|
38
|
+
zIndex: 1,
|
|
39
|
+
display: 'flex',
|
|
40
|
+
flexDirection: 'column',
|
|
41
|
+
gap: theme.spacing(1),
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
const ControlButton = styled(IconButton)(({ theme }) => ({
|
|
45
|
+
background: alpha(theme.palette.background.paper, 0.95),
|
|
46
|
+
backdropFilter: 'blur(10px)',
|
|
47
|
+
WebkitBackdropFilter: 'blur(10px)',
|
|
48
|
+
border: `1px solid ${alpha(theme.palette.divider, 0.2)}`,
|
|
49
|
+
boxShadow: theme.shadows[2],
|
|
50
|
+
pointerEvents: 'auto',
|
|
51
|
+
'&:hover': {
|
|
52
|
+
background: theme.palette.background.paper,
|
|
53
|
+
transform: 'scale(1.05)',
|
|
54
|
+
},
|
|
55
|
+
'&:disabled': {
|
|
56
|
+
opacity: 0.5,
|
|
57
|
+
pointerEvents: 'auto',
|
|
58
|
+
},
|
|
59
|
+
}));
|
|
60
|
+
|
|
61
|
+
const CoordinatesDisplay = styled(Box)(({ theme }) => ({
|
|
62
|
+
position: 'absolute',
|
|
63
|
+
bottom: theme.spacing(2),
|
|
64
|
+
left: theme.spacing(2),
|
|
65
|
+
padding: theme.spacing(1, 1.5),
|
|
66
|
+
background: alpha(theme.palette.background.paper, 0.95),
|
|
67
|
+
backdropFilter: 'blur(10px)',
|
|
68
|
+
WebkitBackdropFilter: 'blur(10px)',
|
|
69
|
+
border: `1px solid ${alpha(theme.palette.divider, 0.2)}`,
|
|
70
|
+
borderRadius: theme.shape.borderRadius,
|
|
71
|
+
zIndex: 1,
|
|
72
|
+
}));
|
|
73
|
+
|
|
74
|
+
// Mock Google Maps Service
|
|
75
|
+
class MockGoogleMapsService {
|
|
76
|
+
private static readonly TILE_SIZE = 256;
|
|
77
|
+
private static readonly MAX_ZOOM = 21;
|
|
78
|
+
|
|
79
|
+
// Calculate tile coordinates from lat/lng and zoom
|
|
80
|
+
static getTileCoordinates(lat: number, lng: number, zoom: number) {
|
|
81
|
+
const scale = 1 << zoom;
|
|
82
|
+
const worldCoordinate = this.project(lat, lng);
|
|
83
|
+
const pixelCoordinate = {
|
|
84
|
+
x: Math.floor(worldCoordinate.x * scale),
|
|
85
|
+
y: Math.floor(worldCoordinate.y * scale)
|
|
86
|
+
};
|
|
87
|
+
const tileCoordinate = {
|
|
88
|
+
x: Math.floor(pixelCoordinate.x / this.TILE_SIZE),
|
|
89
|
+
y: Math.floor(pixelCoordinate.y / this.TILE_SIZE)
|
|
90
|
+
};
|
|
91
|
+
return tileCoordinate;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Mercator projection
|
|
95
|
+
static project(lat: number, lng: number) {
|
|
96
|
+
const siny = Math.sin((lat * Math.PI) / 180);
|
|
97
|
+
const boundedSiny = Math.max(-0.9999, Math.min(0.9999, siny));
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
x: this.TILE_SIZE * (0.5 + lng / 360),
|
|
101
|
+
y: this.TILE_SIZE * (0.5 - Math.log((1 + boundedSiny) / (1 - boundedSiny)) / (4 * Math.PI))
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Convert pixel coordinates back to lat/lng
|
|
106
|
+
static unproject(x: number, y: number, zoom: number) {
|
|
107
|
+
const scale = 1 << zoom;
|
|
108
|
+
const worldCoordinate = {
|
|
109
|
+
x: x / scale,
|
|
110
|
+
y: y / scale
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const lng = (worldCoordinate.x / this.TILE_SIZE - 0.5) * 360;
|
|
114
|
+
const latRadians = (0.5 - worldCoordinate.y / this.TILE_SIZE) * 2 * Math.PI;
|
|
115
|
+
const lat = (2 * Math.atan(Math.exp(latRadians)) - Math.PI / 2) * 180 / Math.PI;
|
|
116
|
+
|
|
117
|
+
return { lat, lng };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Calculate distance between two points (Haversine formula)
|
|
121
|
+
static calculateDistance(lat1: number, lng1: number, lat2: number, lng2: number): number {
|
|
122
|
+
const R = 6371; // Earth's radius in km
|
|
123
|
+
const dLat = (lat2 - lat1) * Math.PI / 180;
|
|
124
|
+
const dLng = (lng2 - lng1) * Math.PI / 180;
|
|
125
|
+
const a = Math.sin(dLat/2) * Math.sin(dLat/2) +
|
|
126
|
+
Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) *
|
|
127
|
+
Math.sin(dLng/2) * Math.sin(dLng/2);
|
|
128
|
+
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
|
|
129
|
+
return R * c;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// Get scale bar distance based on zoom level
|
|
133
|
+
static getScaleDistance(zoom: number): string {
|
|
134
|
+
const metersPerPixel = 156543.03392 * Math.cos(0) / Math.pow(2, zoom);
|
|
135
|
+
const scaleWidth = 100; // pixels
|
|
136
|
+
const distance = metersPerPixel * scaleWidth;
|
|
137
|
+
|
|
138
|
+
if (distance >= 1000) {
|
|
139
|
+
return `${Math.round(distance / 1000)} km`;
|
|
140
|
+
} else if (distance >= 100) {
|
|
141
|
+
return `${Math.round(distance / 100) * 100} m`;
|
|
142
|
+
} else {
|
|
143
|
+
return `${Math.round(distance)} m`;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Simulate geocoding
|
|
148
|
+
static async geocode(address: string): Promise<{ lat: number; lng: number } | null> {
|
|
149
|
+
// Simulate API delay
|
|
150
|
+
await new Promise(resolve => window.setTimeout(resolve, 300));
|
|
151
|
+
|
|
152
|
+
// Mock geocoding results
|
|
153
|
+
const mockResults: Record<string, { lat: number; lng: number }> = {
|
|
154
|
+
'san francisco': { lat: 37.7749, lng: -122.4194 },
|
|
155
|
+
'new york': { lat: 40.7128, lng: -74.0060 },
|
|
156
|
+
'london': { lat: 51.5074, lng: -0.1278 },
|
|
157
|
+
'tokyo': { lat: 35.6762, lng: 139.6503 },
|
|
158
|
+
'paris': { lat: 48.8566, lng: 2.3522 },
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const normalizedAddress = address.toLowerCase().trim();
|
|
162
|
+
return mockResults[normalizedAddress] || null;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Static Map Component with realistic map visualization
|
|
167
|
+
const StaticMapView: FC<{
|
|
168
|
+
coordinates: { lat: number; lng: number };
|
|
169
|
+
height: string;
|
|
170
|
+
zoom: number;
|
|
171
|
+
mapType: string;
|
|
172
|
+
marker?: boolean;
|
|
173
|
+
markerPosition?: { lat: number; lng: number };
|
|
174
|
+
panOffset?: { x: number; y: number };
|
|
175
|
+
}> = ({
|
|
176
|
+
height,
|
|
177
|
+
zoom,
|
|
178
|
+
mapType,
|
|
179
|
+
marker,
|
|
180
|
+
markerPosition,
|
|
181
|
+
panOffset = { x: 0, y: 0 },
|
|
182
|
+
}) => {
|
|
183
|
+
const theme = useTheme();
|
|
184
|
+
const mapRef = useRef<HTMLDivElement>(null);
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
// Calculate tile information
|
|
188
|
+
const tileInfo = React.useMemo(() => {
|
|
189
|
+
if (!markerPosition) return null;
|
|
190
|
+
return MockGoogleMapsService.getTileCoordinates(
|
|
191
|
+
markerPosition.lat,
|
|
192
|
+
markerPosition.lng,
|
|
193
|
+
zoom
|
|
194
|
+
);
|
|
195
|
+
}, [markerPosition, zoom]);
|
|
196
|
+
|
|
197
|
+
// Simulate map tiles with realistic grid
|
|
198
|
+
const MapTiles = () => {
|
|
199
|
+
const tileSize = 256;
|
|
200
|
+
const visibleTiles = Math.ceil(800 / tileSize) + 2; // Extra tiles for panning
|
|
201
|
+
const tileOpacity = theme.palette.mode === 'dark' ? 0.15 : 0.1;
|
|
202
|
+
|
|
203
|
+
return (
|
|
204
|
+
<div
|
|
205
|
+
style={{
|
|
206
|
+
position: 'absolute',
|
|
207
|
+
top: '50%',
|
|
208
|
+
left: '50%',
|
|
209
|
+
transform: `translate(calc(-50% + ${panOffset.x}px), calc(-50% + ${panOffset.y}px))`,
|
|
210
|
+
width: tileSize * visibleTiles,
|
|
211
|
+
height: tileSize * visibleTiles,
|
|
212
|
+
display: 'grid',
|
|
213
|
+
gridTemplateColumns: `repeat(${visibleTiles}, ${tileSize}px)`,
|
|
214
|
+
gridTemplateRows: `repeat(${visibleTiles}, ${tileSize}px)`,
|
|
215
|
+
transition: 'transform 0.1s ease-out',
|
|
216
|
+
}}
|
|
217
|
+
>
|
|
218
|
+
{Array.from({ length: visibleTiles * visibleTiles }).map((_, index) => {
|
|
219
|
+
const row = Math.floor(index / visibleTiles);
|
|
220
|
+
const col = index % visibleTiles;
|
|
221
|
+
const tileX = (tileInfo?.x || 0) + col - Math.floor(visibleTiles / 2);
|
|
222
|
+
const tileY = (tileInfo?.y || 0) + row - Math.floor(visibleTiles / 2);
|
|
223
|
+
|
|
224
|
+
return (
|
|
225
|
+
<div
|
|
226
|
+
key={`tile-${tileX}-${tileY}`}
|
|
227
|
+
style={{
|
|
228
|
+
width: tileSize,
|
|
229
|
+
height: tileSize,
|
|
230
|
+
border: `1px solid ${alpha(theme.palette.divider, tileOpacity)}`,
|
|
231
|
+
background: mapType === 'satellite'
|
|
232
|
+
? `linear-gradient(135deg, ${alpha('#1a1a1a', 0.9)} 0%, ${alpha('#2a2a2a', 0.9)} 100%)`
|
|
233
|
+
: mapType === 'terrain'
|
|
234
|
+
? `linear-gradient(135deg, ${alpha('#7cb342', 0.1)} 0%, ${alpha('#558b2f', 0.1)} 100%)`
|
|
235
|
+
: `linear-gradient(135deg, ${alpha(theme.palette.grey[100], 0.5)} 0%, ${alpha(theme.palette.grey[200], 0.5)} 100%)`,
|
|
236
|
+
display: 'flex',
|
|
237
|
+
alignItems: 'center',
|
|
238
|
+
justifyContent: 'center',
|
|
239
|
+
fontSize: '10px',
|
|
240
|
+
color: alpha(theme.palette.text.secondary, 0.3),
|
|
241
|
+
fontFamily: 'monospace',
|
|
242
|
+
userSelect: 'none',
|
|
243
|
+
}}
|
|
244
|
+
>
|
|
245
|
+
{zoom > 10 && `${tileX},${tileY}`}
|
|
246
|
+
</div>
|
|
247
|
+
);
|
|
248
|
+
})}
|
|
249
|
+
</div>
|
|
250
|
+
);
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
// Create a more realistic map visualization
|
|
254
|
+
return (
|
|
255
|
+
<Box
|
|
256
|
+
ref={mapRef}
|
|
257
|
+
data-testid="static-map-view"
|
|
258
|
+
sx={{
|
|
259
|
+
width: '100%',
|
|
260
|
+
height,
|
|
261
|
+
position: 'relative',
|
|
262
|
+
background: mapType === 'satellite'
|
|
263
|
+
? `linear-gradient(135deg, ${theme.palette.grey[900]} 0%, ${theme.palette.grey[800]} 100%)`
|
|
264
|
+
: mapType === 'terrain'
|
|
265
|
+
? `linear-gradient(135deg, ${alpha('#8BC34A', 0.2)} 0%, ${alpha('#4CAF50', 0.3)} 100%)`
|
|
266
|
+
: theme.palette.mode === 'dark'
|
|
267
|
+
? `linear-gradient(135deg, ${theme.palette.grey[900]} 0%, ${theme.palette.grey[800]} 100%)`
|
|
268
|
+
: `linear-gradient(135deg, ${theme.palette.grey[100]} 0%, ${theme.palette.grey[200]} 100%)`,
|
|
269
|
+
overflow: 'hidden',
|
|
270
|
+
}}
|
|
271
|
+
>
|
|
272
|
+
{/* Map tiles */}
|
|
273
|
+
<MapTiles />
|
|
274
|
+
|
|
275
|
+
{/* Simulated map features */}
|
|
276
|
+
<Box
|
|
277
|
+
sx={{
|
|
278
|
+
position: 'absolute',
|
|
279
|
+
top: '20%',
|
|
280
|
+
left: '15%',
|
|
281
|
+
width: '70%',
|
|
282
|
+
height: '60%',
|
|
283
|
+
opacity: 0.2,
|
|
284
|
+
}}
|
|
285
|
+
>
|
|
286
|
+
{/* Simulated roads */}
|
|
287
|
+
<svg width="100%" height="100%" style={{ position: 'absolute' }}>
|
|
288
|
+
<path
|
|
289
|
+
d={`M 10,50 Q 30,30 50,50 T 90,50`}
|
|
290
|
+
stroke={theme.palette.text.secondary}
|
|
291
|
+
strokeWidth="2"
|
|
292
|
+
fill="none"
|
|
293
|
+
opacity="0.3"
|
|
294
|
+
/>
|
|
295
|
+
<path
|
|
296
|
+
d={`M 50,10 L 50,90`}
|
|
297
|
+
stroke={theme.palette.text.secondary}
|
|
298
|
+
strokeWidth="1.5"
|
|
299
|
+
fill="none"
|
|
300
|
+
opacity="0.3"
|
|
301
|
+
/>
|
|
302
|
+
<path
|
|
303
|
+
d={`M 20,30 L 80,70`}
|
|
304
|
+
stroke={theme.palette.text.secondary}
|
|
305
|
+
strokeWidth="1"
|
|
306
|
+
fill="none"
|
|
307
|
+
opacity="0.2"
|
|
308
|
+
/>
|
|
309
|
+
</svg>
|
|
310
|
+
</Box>
|
|
311
|
+
|
|
312
|
+
{/* Center marker */}
|
|
313
|
+
{marker && (
|
|
314
|
+
<Box
|
|
315
|
+
data-testid="map-marker"
|
|
316
|
+
sx={{
|
|
317
|
+
position: 'absolute',
|
|
318
|
+
top: '50%',
|
|
319
|
+
left: '50%',
|
|
320
|
+
transform: 'translate(-50%, -100%)',
|
|
321
|
+
zIndex: 2,
|
|
322
|
+
filter: 'drop-shadow(0 2px 4px rgba(0,0,0,0.3))',
|
|
323
|
+
}}
|
|
324
|
+
>
|
|
325
|
+
<LocationIcon
|
|
326
|
+
sx={{
|
|
327
|
+
fontSize: 36,
|
|
328
|
+
color: theme.palette.error.main,
|
|
329
|
+
animation: 'bounce 2s infinite',
|
|
330
|
+
'@keyframes bounce': {
|
|
331
|
+
'0%, 100%': { transform: 'translateY(0)' },
|
|
332
|
+
'50%': { transform: 'translateY(-10px)' },
|
|
333
|
+
},
|
|
334
|
+
}}
|
|
335
|
+
/>
|
|
336
|
+
</Box>
|
|
337
|
+
)}
|
|
338
|
+
|
|
339
|
+
{/* Additional map markers for realism */}
|
|
340
|
+
<Box
|
|
341
|
+
sx={{
|
|
342
|
+
position: 'absolute',
|
|
343
|
+
top: '30%',
|
|
344
|
+
left: '25%',
|
|
345
|
+
opacity: 0.6,
|
|
346
|
+
}}
|
|
347
|
+
>
|
|
348
|
+
<PlaceIcon sx={{ fontSize: 20, color: theme.palette.primary.main }} />
|
|
349
|
+
</Box>
|
|
350
|
+
<Box
|
|
351
|
+
sx={{
|
|
352
|
+
position: 'absolute',
|
|
353
|
+
top: '65%',
|
|
354
|
+
left: '70%',
|
|
355
|
+
opacity: 0.6,
|
|
356
|
+
}}
|
|
357
|
+
>
|
|
358
|
+
<PlaceIcon sx={{ fontSize: 20, color: theme.palette.primary.main }} />
|
|
359
|
+
</Box>
|
|
360
|
+
|
|
361
|
+
{/* Scale indicator */}
|
|
362
|
+
<Box
|
|
363
|
+
sx={{
|
|
364
|
+
position: 'absolute',
|
|
365
|
+
bottom: theme.spacing(2),
|
|
366
|
+
right: theme.spacing(2),
|
|
367
|
+
display: 'flex',
|
|
368
|
+
alignItems: 'center',
|
|
369
|
+
gap: 0.5,
|
|
370
|
+
padding: theme.spacing(0.5, 1),
|
|
371
|
+
background: alpha(theme.palette.background.paper, 0.9),
|
|
372
|
+
borderRadius: theme.shape.borderRadius,
|
|
373
|
+
fontSize: '0.75rem',
|
|
374
|
+
color: theme.palette.text.secondary,
|
|
375
|
+
}}
|
|
376
|
+
>
|
|
377
|
+
<Box
|
|
378
|
+
sx={{
|
|
379
|
+
width: 40,
|
|
380
|
+
height: 2,
|
|
381
|
+
background: theme.palette.text.secondary,
|
|
382
|
+
position: 'relative',
|
|
383
|
+
'&::before, &::after': {
|
|
384
|
+
content: '""',
|
|
385
|
+
position: 'absolute',
|
|
386
|
+
width: 2,
|
|
387
|
+
height: 6,
|
|
388
|
+
background: theme.palette.text.secondary,
|
|
389
|
+
},
|
|
390
|
+
'&::before': { left: 0, top: -2 },
|
|
391
|
+
'&::after': { right: 0, top: -2 },
|
|
392
|
+
}}
|
|
393
|
+
/>
|
|
394
|
+
<Typography variant="caption">
|
|
395
|
+
{MockGoogleMapsService.getScaleDistance(zoom)}
|
|
396
|
+
</Typography>
|
|
397
|
+
</Box>
|
|
398
|
+
|
|
399
|
+
{/* Compass */}
|
|
400
|
+
<Box
|
|
401
|
+
sx={{
|
|
402
|
+
position: 'absolute',
|
|
403
|
+
top: theme.spacing(2),
|
|
404
|
+
left: theme.spacing(2),
|
|
405
|
+
width: 40,
|
|
406
|
+
height: 40,
|
|
407
|
+
display: 'flex',
|
|
408
|
+
alignItems: 'center',
|
|
409
|
+
justifyContent: 'center',
|
|
410
|
+
background: alpha(theme.palette.background.paper, 0.9),
|
|
411
|
+
borderRadius: '50%',
|
|
412
|
+
boxShadow: theme.shadows[2],
|
|
413
|
+
}}
|
|
414
|
+
>
|
|
415
|
+
<NavigationIcon
|
|
416
|
+
sx={{
|
|
417
|
+
fontSize: 24,
|
|
418
|
+
color: theme.palette.primary.main,
|
|
419
|
+
transform: 'rotate(-45deg)',
|
|
420
|
+
}}
|
|
421
|
+
/>
|
|
422
|
+
</Box>
|
|
423
|
+
</Box>
|
|
424
|
+
);
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
// Search bar component
|
|
428
|
+
const SearchBar = styled(Box)(({ theme }) => ({
|
|
429
|
+
position: 'absolute',
|
|
430
|
+
top: theme.spacing(2),
|
|
431
|
+
left: '50%',
|
|
432
|
+
transform: 'translateX(-50%)',
|
|
433
|
+
zIndex: 2,
|
|
434
|
+
width: '90%',
|
|
435
|
+
maxWidth: 400,
|
|
436
|
+
}));
|
|
437
|
+
|
|
438
|
+
const SearchField = styled(TextField)(({ theme }) => ({
|
|
439
|
+
'& .MuiOutlinedInput-root': {
|
|
440
|
+
background: alpha(theme.palette.background.paper, 0.95),
|
|
441
|
+
backdropFilter: 'blur(10px)',
|
|
442
|
+
WebkitBackdropFilter: 'blur(10px)',
|
|
443
|
+
borderRadius: theme.shape.borderRadius * 2,
|
|
444
|
+
'& fieldset': {
|
|
445
|
+
borderColor: alpha(theme.palette.divider, 0.2),
|
|
446
|
+
},
|
|
447
|
+
},
|
|
448
|
+
}));
|
|
449
|
+
|
|
450
|
+
// Heatmap overlay component
|
|
451
|
+
const HeatmapOverlay: FC<{ points: HeatmapPoint[]; width: number; height: number }> = ({ points, width, height }) => {
|
|
452
|
+
const theme = useTheme();
|
|
453
|
+
|
|
454
|
+
if (!points || points.length === 0) return null;
|
|
455
|
+
|
|
456
|
+
return (
|
|
457
|
+
<svg
|
|
458
|
+
style={{
|
|
459
|
+
position: 'absolute',
|
|
460
|
+
top: 0,
|
|
461
|
+
left: 0,
|
|
462
|
+
width: '100%',
|
|
463
|
+
height: '100%',
|
|
464
|
+
pointerEvents: 'none',
|
|
465
|
+
zIndex: 1,
|
|
466
|
+
}}
|
|
467
|
+
viewBox={`0 0 ${width} ${height}`}
|
|
468
|
+
>
|
|
469
|
+
{points.map((point, index) => {
|
|
470
|
+
const radius = 30 * point.weight;
|
|
471
|
+
const opacity = 0.3 * point.weight;
|
|
472
|
+
return (
|
|
473
|
+
<circle
|
|
474
|
+
key={index}
|
|
475
|
+
cx={width / 2 + (point.lng * 10)}
|
|
476
|
+
cy={height / 2 - (point.lat * 10)}
|
|
477
|
+
r={radius}
|
|
478
|
+
fill={theme.palette.error.main}
|
|
479
|
+
opacity={opacity}
|
|
480
|
+
/>
|
|
481
|
+
);
|
|
482
|
+
})}
|
|
483
|
+
</svg>
|
|
484
|
+
);
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
// Route overlay component
|
|
488
|
+
const RouteOverlay: FC<{ color: string }> = ({ color }) => {
|
|
489
|
+
const theme = useTheme();
|
|
490
|
+
|
|
491
|
+
return (
|
|
492
|
+
<svg
|
|
493
|
+
style={{
|
|
494
|
+
position: 'absolute',
|
|
495
|
+
top: 0,
|
|
496
|
+
left: 0,
|
|
497
|
+
width: '100%',
|
|
498
|
+
height: '100%',
|
|
499
|
+
pointerEvents: 'none',
|
|
500
|
+
zIndex: 1,
|
|
501
|
+
}}
|
|
502
|
+
viewBox="0 0 100 100"
|
|
503
|
+
>
|
|
504
|
+
<path
|
|
505
|
+
d="M 20,20 Q 40,10 50,30 T 80,80"
|
|
506
|
+
stroke={color || theme.palette.primary.main}
|
|
507
|
+
strokeWidth="3"
|
|
508
|
+
fill="none"
|
|
509
|
+
strokeDasharray="5,5"
|
|
510
|
+
opacity="0.8"
|
|
511
|
+
>
|
|
512
|
+
<animate
|
|
513
|
+
attributeName="stroke-dashoffset"
|
|
514
|
+
values="0;10"
|
|
515
|
+
dur="1s"
|
|
516
|
+
repeatCount="indefinite"
|
|
517
|
+
/>
|
|
518
|
+
</path>
|
|
519
|
+
</svg>
|
|
520
|
+
);
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
// Main component
|
|
524
|
+
export const MapPreview: FC<MapPreviewProps> = ({
|
|
525
|
+
center,
|
|
526
|
+
coordinates: legacyCoordinates,
|
|
527
|
+
markers = [],
|
|
528
|
+
marker = true,
|
|
529
|
+
height = '400px',
|
|
530
|
+
interactive = false,
|
|
531
|
+
zoom: initialZoom = 15,
|
|
532
|
+
mapType = 'roadmap',
|
|
533
|
+
variant = 'default',
|
|
534
|
+
showControls = true,
|
|
535
|
+
showSearch = false,
|
|
536
|
+
searchPlaceholder = 'Search location...',
|
|
537
|
+
showRoute = false,
|
|
538
|
+
routeColor,
|
|
539
|
+
heatmapData = [],
|
|
540
|
+
showHeatmap = false,
|
|
541
|
+
animated = true,
|
|
542
|
+
onMarkerDrag,
|
|
543
|
+
onMapClick,
|
|
544
|
+
}) => {
|
|
545
|
+
// Use center prop if provided, otherwise fall back to coordinates
|
|
546
|
+
const coordinates = React.useMemo(() => center || legacyCoordinates || { lat: 0, lng: 0 }, [center, legacyCoordinates]);
|
|
547
|
+
const originalCoordinates = React.useRef(coordinates);
|
|
548
|
+
|
|
549
|
+
const [currentZoom, setCurrentZoom] = useState(initialZoom);
|
|
550
|
+
const [currentMapType, setCurrentMapType] = useState<
|
|
551
|
+
'roadmap' | 'satellite' | 'hybrid' | 'terrain'
|
|
552
|
+
>(mapType);
|
|
553
|
+
const [markerPosition, setMarkerPosition] = useState(coordinates);
|
|
554
|
+
const [isFullscreen, setIsFullscreen] = useState(false);
|
|
555
|
+
const [searchValue, setSearchValue] = useState('');
|
|
556
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
557
|
+
const [isPanning, setIsPanning] = useState(false);
|
|
558
|
+
const [panOffset, setPanOffset] = useState({ x: 0, y: 0 });
|
|
559
|
+
const [, setSearchResults] = useState<{ lat: number; lng: number } | null>(null);
|
|
560
|
+
const [isSearching, setIsSearching] = useState(false);
|
|
561
|
+
const mapContainerRef = useRef<HTMLDivElement>(null);
|
|
562
|
+
const dragStartRef = useRef<{ x: number; y: number; lat: number; lng: number } | null>(null);
|
|
563
|
+
const panStartRef = useRef<{ x: number; y: number; offsetX: number; offsetY: number } | null>(null);
|
|
564
|
+
|
|
565
|
+
// Update marker position when coordinates change
|
|
566
|
+
useEffect(() => {
|
|
567
|
+
setMarkerPosition(coordinates);
|
|
568
|
+
}, [coordinates]);
|
|
569
|
+
|
|
570
|
+
const handleZoomIn = () => {
|
|
571
|
+
const newZoom = Math.min(currentZoom + 1, 20);
|
|
572
|
+
setCurrentZoom(newZoom);
|
|
573
|
+
// Reset pan offset when zooming
|
|
574
|
+
setPanOffset({ x: 0, y: 0 });
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
const handleZoomOut = () => {
|
|
578
|
+
const newZoom = Math.max(currentZoom - 1, 1);
|
|
579
|
+
setCurrentZoom(newZoom);
|
|
580
|
+
// Reset pan offset when zooming
|
|
581
|
+
setPanOffset({ x: 0, y: 0 });
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
const handleCenter = () => {
|
|
585
|
+
originalCoordinates.current = coordinates; // Update ref with current coordinates
|
|
586
|
+
setMarkerPosition({ ...coordinates }); // Reset to current coordinates
|
|
587
|
+
setPanOffset({ x: 0, y: 0 });
|
|
588
|
+
};
|
|
589
|
+
|
|
590
|
+
const handleToggleMapType = () => {
|
|
591
|
+
const types: Array<'roadmap' | 'satellite' | 'hybrid' | 'terrain'> = [
|
|
592
|
+
'roadmap',
|
|
593
|
+
'satellite',
|
|
594
|
+
'hybrid',
|
|
595
|
+
'terrain',
|
|
596
|
+
];
|
|
597
|
+
const currentIndex = types.indexOf(currentMapType);
|
|
598
|
+
const nextIndex = (currentIndex + 1) % types.length;
|
|
599
|
+
const nextType = types[nextIndex] as 'roadmap' | 'satellite' | 'hybrid' | 'terrain';
|
|
600
|
+
setCurrentMapType(nextType);
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
const handleFullscreen = () => {
|
|
604
|
+
if (!isFullscreen && mapContainerRef.current) {
|
|
605
|
+
mapContainerRef.current.requestFullscreen?.();
|
|
606
|
+
} else if (document.fullscreenElement) {
|
|
607
|
+
document.exitFullscreen?.();
|
|
608
|
+
}
|
|
609
|
+
setIsFullscreen(!isFullscreen);
|
|
610
|
+
};
|
|
611
|
+
|
|
612
|
+
// Handle map click for marker placement
|
|
613
|
+
const handleMapClick = useCallback(() => {
|
|
614
|
+
// Don't place marker if we're panning
|
|
615
|
+
if (isPanning) return;
|
|
616
|
+
|
|
617
|
+
// Simple coordinate offset calculation for testing
|
|
618
|
+
const centerLat = coordinates.lat; // Use original coordinates as reference
|
|
619
|
+
const centerLng = coordinates.lng;
|
|
620
|
+
|
|
621
|
+
// Small random offset to simulate coordinate change
|
|
622
|
+
const newCoords = {
|
|
623
|
+
lat: centerLat + (Math.random() - 0.5) * 0.001,
|
|
624
|
+
lng: centerLng + (Math.random() - 0.5) * 0.001
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
if (onMapClick) {
|
|
628
|
+
onMapClick(newCoords.lat, newCoords.lng);
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
if (interactive && onMarkerDrag) {
|
|
632
|
+
setMarkerPosition(newCoords);
|
|
633
|
+
onMarkerDrag(newCoords);
|
|
634
|
+
}
|
|
635
|
+
}, [coordinates.lat, coordinates.lng, interactive, onMarkerDrag, onMapClick, isPanning]);
|
|
636
|
+
|
|
637
|
+
// Handle pan/drag start
|
|
638
|
+
const handleMouseDown = useCallback((event: React.MouseEvent<HTMLDivElement>) => {
|
|
639
|
+
if (interactive) {
|
|
640
|
+
// Check if we're clicking on empty map area (for panning)
|
|
641
|
+
const target = event.target as HTMLElement;
|
|
642
|
+
const isMapBackground = target.dataset.testid === 'static-map-view' ||
|
|
643
|
+
target.closest('[data-testid="static-map-view"]');
|
|
644
|
+
|
|
645
|
+
if (isMapBackground && event.shiftKey) {
|
|
646
|
+
// Shift+drag for panning
|
|
647
|
+
setIsPanning(true);
|
|
648
|
+
panStartRef.current = {
|
|
649
|
+
x: event.clientX,
|
|
650
|
+
y: event.clientY,
|
|
651
|
+
offsetX: panOffset.x,
|
|
652
|
+
offsetY: panOffset.y,
|
|
653
|
+
};
|
|
654
|
+
} else {
|
|
655
|
+
// Regular drag for marker movement
|
|
656
|
+
setIsDragging(true);
|
|
657
|
+
dragStartRef.current = {
|
|
658
|
+
x: event.clientX,
|
|
659
|
+
y: event.clientY,
|
|
660
|
+
lat: markerPosition.lat,
|
|
661
|
+
lng: markerPosition.lng,
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
}, [interactive, markerPosition, panOffset]);
|
|
666
|
+
|
|
667
|
+
// Handle pan/drag movement
|
|
668
|
+
const handleMouseMove = useCallback((event: React.MouseEvent<HTMLDivElement>) => {
|
|
669
|
+
if (isPanning && panStartRef.current) {
|
|
670
|
+
// Handle map panning
|
|
671
|
+
const deltaX = event.clientX - panStartRef.current.x;
|
|
672
|
+
const deltaY = event.clientY - panStartRef.current.y;
|
|
673
|
+
|
|
674
|
+
setPanOffset({
|
|
675
|
+
x: panStartRef.current.offsetX + deltaX,
|
|
676
|
+
y: panStartRef.current.offsetY + deltaY,
|
|
677
|
+
});
|
|
678
|
+
} else if (isDragging && dragStartRef.current) {
|
|
679
|
+
// Handle marker dragging
|
|
680
|
+
const deltaX = event.clientX - dragStartRef.current.x;
|
|
681
|
+
const deltaY = event.clientY - dragStartRef.current.y;
|
|
682
|
+
|
|
683
|
+
// Simple drag simulation for testing
|
|
684
|
+
const newPosition = {
|
|
685
|
+
lat: dragStartRef.current.lat + deltaY * 0.0001,
|
|
686
|
+
lng: dragStartRef.current.lng + deltaX * 0.0001
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
setMarkerPosition(newPosition);
|
|
690
|
+
if (onMarkerDrag) {
|
|
691
|
+
onMarkerDrag(newPosition);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}, [isDragging, isPanning, onMarkerDrag]);
|
|
695
|
+
|
|
696
|
+
// Handle pan/drag end
|
|
697
|
+
const handleMouseUp = useCallback(() => {
|
|
698
|
+
setIsDragging(false);
|
|
699
|
+
setIsPanning(false);
|
|
700
|
+
dragStartRef.current = null;
|
|
701
|
+
panStartRef.current = null;
|
|
702
|
+
}, []);
|
|
703
|
+
|
|
704
|
+
// Handle search
|
|
705
|
+
const handleSearch = useCallback(async (event: React.KeyboardEvent<HTMLInputElement>) => {
|
|
706
|
+
if (event.key === 'Enter' && searchValue) {
|
|
707
|
+
setIsSearching(true);
|
|
708
|
+
try {
|
|
709
|
+
const result = await MockGoogleMapsService.geocode(searchValue);
|
|
710
|
+
if (result) {
|
|
711
|
+
setSearchResults(result);
|
|
712
|
+
setMarkerPosition({ ...result }); // Create new object to ensure update
|
|
713
|
+
setPanOffset({ x: 0, y: 0 });
|
|
714
|
+
// Zoom to appropriate level for city view
|
|
715
|
+
setCurrentZoom(12);
|
|
716
|
+
} else {
|
|
717
|
+
// No results found - could show an error message in production
|
|
718
|
+
// In production, this would trigger an error toast or notification
|
|
719
|
+
}
|
|
720
|
+
} finally {
|
|
721
|
+
setIsSearching(false);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}, [searchValue]);
|
|
725
|
+
|
|
726
|
+
// Get glass effect styles
|
|
727
|
+
const getGlassStyles = () => {
|
|
728
|
+
if (variant === 'glass') {
|
|
729
|
+
return {
|
|
730
|
+
background: alpha(theme.palette.background.paper, 0.7),
|
|
731
|
+
backdropFilter: 'blur(20px)',
|
|
732
|
+
WebkitBackdropFilter: 'blur(20px)',
|
|
733
|
+
border: `1px solid ${alpha(theme.palette.divider, 0.1)}`,
|
|
734
|
+
};
|
|
735
|
+
}
|
|
736
|
+
return {};
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
const theme = useTheme();
|
|
740
|
+
|
|
741
|
+
return (
|
|
742
|
+
<MapContainer
|
|
743
|
+
ref={mapContainerRef}
|
|
744
|
+
elevation={variant === 'glass' ? 0 : 2}
|
|
745
|
+
data-testid="map-preview-container"
|
|
746
|
+
role="img"
|
|
747
|
+
aria-label={`Map preview centered at ${markerPosition.lat.toFixed(4)}, ${markerPosition.lng.toFixed(4)} with zoom level ${currentZoom}`}
|
|
748
|
+
tabIndex={0}
|
|
749
|
+
aria-live="polite"
|
|
750
|
+
aria-atomic="true"
|
|
751
|
+
sx={getGlassStyles()}
|
|
752
|
+
>
|
|
753
|
+
<MapWrapper
|
|
754
|
+
height={isFullscreen ? '100vh' : height}
|
|
755
|
+
onClick={handleMapClick}
|
|
756
|
+
onMouseDown={handleMouseDown}
|
|
757
|
+
onMouseMove={handleMouseMove}
|
|
758
|
+
onMouseUp={handleMouseUp}
|
|
759
|
+
onMouseLeave={handleMouseUp}
|
|
760
|
+
style={{
|
|
761
|
+
cursor: isDragging || isPanning ? 'grabbing' : interactive ? 'grab' : 'default',
|
|
762
|
+
transition: animated ? 'all 0.3s ease' : 'none',
|
|
763
|
+
}}
|
|
764
|
+
>
|
|
765
|
+
{/* Use our realistic static map visualization */}
|
|
766
|
+
<StaticMapView
|
|
767
|
+
coordinates={coordinates}
|
|
768
|
+
height={isFullscreen ? '100vh' : height}
|
|
769
|
+
zoom={currentZoom}
|
|
770
|
+
mapType={currentMapType}
|
|
771
|
+
marker={marker && markers.length === 0}
|
|
772
|
+
markerPosition={markerPosition}
|
|
773
|
+
panOffset={panOffset}
|
|
774
|
+
/>
|
|
775
|
+
|
|
776
|
+
{/* Render multiple markers */}
|
|
777
|
+
{markers.map((markerItem, index) => (
|
|
778
|
+
<Box
|
|
779
|
+
key={index}
|
|
780
|
+
data-testid={`map-marker-${index}`}
|
|
781
|
+
sx={{
|
|
782
|
+
position: 'absolute',
|
|
783
|
+
top: '50%',
|
|
784
|
+
left: '50%',
|
|
785
|
+
transform: `translate(
|
|
786
|
+
${(markerItem.position.lng - markerPosition.lng) * 100}px,
|
|
787
|
+
${-(markerItem.position.lat - markerPosition.lat) * 100}px
|
|
788
|
+
)`,
|
|
789
|
+
zIndex: 3,
|
|
790
|
+
cursor: markerItem.onClick ? 'pointer' : 'default',
|
|
791
|
+
}}
|
|
792
|
+
onClick={markerItem.onClick}
|
|
793
|
+
title={markerItem.title}
|
|
794
|
+
>
|
|
795
|
+
<Tooltip title={markerItem.description || markerItem.title || ''}>
|
|
796
|
+
<LocationIcon
|
|
797
|
+
sx={{
|
|
798
|
+
fontSize: 32,
|
|
799
|
+
color: theme.palette.error.main,
|
|
800
|
+
filter: 'drop-shadow(0 2px 4px rgba(0,0,0,0.3))',
|
|
801
|
+
animation: animated ? 'bounce 2s infinite' : 'none',
|
|
802
|
+
'@keyframes bounce': {
|
|
803
|
+
'0%, 100%': { transform: 'translateY(0)' },
|
|
804
|
+
'50%': { transform: 'translateY(-10px)' },
|
|
805
|
+
},
|
|
806
|
+
}}
|
|
807
|
+
/>
|
|
808
|
+
</Tooltip>
|
|
809
|
+
</Box>
|
|
810
|
+
))}
|
|
811
|
+
|
|
812
|
+
{/* Heatmap overlay */}
|
|
813
|
+
{showHeatmap && heatmapData.length > 0 && (
|
|
814
|
+
<HeatmapOverlay
|
|
815
|
+
points={heatmapData}
|
|
816
|
+
width={800}
|
|
817
|
+
height={400}
|
|
818
|
+
/>
|
|
819
|
+
)}
|
|
820
|
+
|
|
821
|
+
{/* Route overlay */}
|
|
822
|
+
{showRoute && (
|
|
823
|
+
<RouteOverlay color={routeColor || theme.palette.primary.main} />
|
|
824
|
+
)}
|
|
825
|
+
|
|
826
|
+
{/* Search bar */}
|
|
827
|
+
{showSearch && (
|
|
828
|
+
<SearchBar>
|
|
829
|
+
<SearchField
|
|
830
|
+
fullWidth
|
|
831
|
+
size="small"
|
|
832
|
+
placeholder={searchPlaceholder}
|
|
833
|
+
value={searchValue}
|
|
834
|
+
onChange={(e) => setSearchValue(e.target.value)}
|
|
835
|
+
onKeyPress={handleSearch}
|
|
836
|
+
InputProps={{
|
|
837
|
+
startAdornment: (
|
|
838
|
+
<InputAdornment position="start">
|
|
839
|
+
<SearchIcon fontSize="small" sx={{ opacity: isSearching ? 0.5 : 1 }} />
|
|
840
|
+
</InputAdornment>
|
|
841
|
+
),
|
|
842
|
+
}}
|
|
843
|
+
disabled={isSearching}
|
|
844
|
+
aria-label="Search location"
|
|
845
|
+
/>
|
|
846
|
+
</SearchBar>
|
|
847
|
+
)}
|
|
848
|
+
|
|
849
|
+
{showControls && (
|
|
850
|
+
<MapControls data-testid="map-controls">
|
|
851
|
+
<Tooltip title="Zoom in" placement="left">
|
|
852
|
+
<ControlButton
|
|
853
|
+
size="small"
|
|
854
|
+
onClick={handleZoomIn}
|
|
855
|
+
aria-label="Zoom in"
|
|
856
|
+
data-testid="zoom-in-button"
|
|
857
|
+
disabled={currentZoom >= 20}
|
|
858
|
+
>
|
|
859
|
+
<ZoomInIcon fontSize="small" />
|
|
860
|
+
</ControlButton>
|
|
861
|
+
</Tooltip>
|
|
862
|
+
<Tooltip title="Zoom out" placement="left">
|
|
863
|
+
<ControlButton
|
|
864
|
+
size="small"
|
|
865
|
+
onClick={handleZoomOut}
|
|
866
|
+
aria-label="Zoom out"
|
|
867
|
+
data-testid="zoom-out-button"
|
|
868
|
+
disabled={currentZoom <= 1}
|
|
869
|
+
>
|
|
870
|
+
<ZoomOutIcon fontSize="small" />
|
|
871
|
+
</ControlButton>
|
|
872
|
+
</Tooltip>
|
|
873
|
+
<Tooltip title="Center map" placement="left">
|
|
874
|
+
<ControlButton
|
|
875
|
+
size="small"
|
|
876
|
+
onClick={handleCenter}
|
|
877
|
+
aria-label="Center map"
|
|
878
|
+
data-testid="center-button"
|
|
879
|
+
>
|
|
880
|
+
<CenterIcon fontSize="small" />
|
|
881
|
+
</ControlButton>
|
|
882
|
+
</Tooltip>
|
|
883
|
+
<Tooltip title={`Map type: ${currentMapType}`} placement="left">
|
|
884
|
+
<ControlButton
|
|
885
|
+
size="small"
|
|
886
|
+
onClick={handleToggleMapType}
|
|
887
|
+
aria-label="Change map type"
|
|
888
|
+
data-testid="map-type-button"
|
|
889
|
+
>
|
|
890
|
+
<LayersIcon fontSize="small" />
|
|
891
|
+
</ControlButton>
|
|
892
|
+
</Tooltip>
|
|
893
|
+
<Tooltip title="Toggle fullscreen" placement="left">
|
|
894
|
+
<ControlButton
|
|
895
|
+
size="small"
|
|
896
|
+
onClick={handleFullscreen}
|
|
897
|
+
aria-label="Toggle fullscreen"
|
|
898
|
+
data-testid="fullscreen-button"
|
|
899
|
+
>
|
|
900
|
+
<FullscreenIcon fontSize="small" />
|
|
901
|
+
</ControlButton>
|
|
902
|
+
</Tooltip>
|
|
903
|
+
</MapControls>
|
|
904
|
+
)}
|
|
905
|
+
|
|
906
|
+
<CoordinatesDisplay data-testid="coordinates-display">
|
|
907
|
+
<Typography variant="caption" sx={{ fontFamily: 'monospace' }}>
|
|
908
|
+
Lat: {markerPosition.lat.toFixed(6)}, Lng: {markerPosition.lng.toFixed(6)}
|
|
909
|
+
</Typography>
|
|
910
|
+
{currentZoom && (
|
|
911
|
+
<Typography variant="caption" sx={{ fontFamily: 'monospace', display: 'block' }}>
|
|
912
|
+
Zoom: {currentZoom}
|
|
913
|
+
</Typography>
|
|
914
|
+
)}
|
|
915
|
+
</CoordinatesDisplay>
|
|
916
|
+
</MapWrapper>
|
|
917
|
+
</MapContainer>
|
|
918
|
+
);
|
|
919
|
+
};
|
|
920
|
+
|
|
921
|
+
// Export default
|
|
922
|
+
export default MapPreview;
|