@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,978 @@
|
|
|
1
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
2
|
+
import {
|
|
3
|
+
alpha,
|
|
4
|
+
Backdrop,
|
|
5
|
+
Box,
|
|
6
|
+
CircularProgress,
|
|
7
|
+
Divider,
|
|
8
|
+
Drawer,
|
|
9
|
+
Fade,
|
|
10
|
+
IconButton,
|
|
11
|
+
keyframes,
|
|
12
|
+
SwipeableDrawer,
|
|
13
|
+
Typography,
|
|
14
|
+
useTheme,
|
|
15
|
+
} from '@mui/material';
|
|
16
|
+
import type { BackdropProps } from '@mui/material';
|
|
17
|
+
import React, { useCallback, useEffect, useMemo,useRef, useState } from 'react';
|
|
18
|
+
|
|
19
|
+
import type {
|
|
20
|
+
SheetContentProps,
|
|
21
|
+
SheetFooterProps,
|
|
22
|
+
SheetHeaderProps,
|
|
23
|
+
SheetOverlayProps,
|
|
24
|
+
SheetProps,
|
|
25
|
+
} from './Sheet.types';
|
|
26
|
+
|
|
27
|
+
// Spring physics configuration for smooth animations
|
|
28
|
+
const SPRING_CONFIG = {
|
|
29
|
+
tension: 200,
|
|
30
|
+
friction: 25,
|
|
31
|
+
velocity: 0,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// Velocity threshold for snap detection (pixels per millisecond)
|
|
35
|
+
const DEFAULT_VELOCITY_THRESHOLD = 0.5;
|
|
36
|
+
|
|
37
|
+
// Drag resistance factor at boundaries
|
|
38
|
+
const DEFAULT_DRAG_RESISTANCE = 0.3;
|
|
39
|
+
|
|
40
|
+
// Keyframe animations
|
|
41
|
+
const pulseAnimation = keyframes`
|
|
42
|
+
0% {
|
|
43
|
+
box-shadow: 0 0 0 0 rgba(var(--pulse-color), 0.4);
|
|
44
|
+
}
|
|
45
|
+
70% {
|
|
46
|
+
box-shadow: 0 0 0 20px rgba(var(--pulse-color), 0);
|
|
47
|
+
}
|
|
48
|
+
100% {
|
|
49
|
+
box-shadow: 0 0 0 0 rgba(var(--pulse-color), 0);
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
|
|
53
|
+
const shimmerAnimation = keyframes`
|
|
54
|
+
0% {
|
|
55
|
+
background-position: -1000px 0;
|
|
56
|
+
}
|
|
57
|
+
100% {
|
|
58
|
+
background-position: 1000px 0;
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
|
|
62
|
+
const glowAnimation = keyframes`
|
|
63
|
+
0%, 100% {
|
|
64
|
+
box-shadow: 0 0 20px 5px rgba(var(--glow-color), 0.3);
|
|
65
|
+
}
|
|
66
|
+
50% {
|
|
67
|
+
box-shadow: 0 0 35px 10px rgba(var(--glow-color), 0.5);
|
|
68
|
+
}
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
export const Sheet: React.FC<SheetProps> = ({
|
|
72
|
+
open = false,
|
|
73
|
+
onOpenChange,
|
|
74
|
+
children,
|
|
75
|
+
title,
|
|
76
|
+
description,
|
|
77
|
+
position = 'bottom',
|
|
78
|
+
variant = 'default',
|
|
79
|
+
size = 'md',
|
|
80
|
+
color = 'primary',
|
|
81
|
+
glow = false,
|
|
82
|
+
pulse = false,
|
|
83
|
+
glass = false,
|
|
84
|
+
gradient = false,
|
|
85
|
+
loading = false,
|
|
86
|
+
disabled = false,
|
|
87
|
+
className,
|
|
88
|
+
style,
|
|
89
|
+
showOverlay = true,
|
|
90
|
+
closeOnOverlayClick = true,
|
|
91
|
+
closeOnEscape = true,
|
|
92
|
+
showCloseButton = true,
|
|
93
|
+
showHandle = true,
|
|
94
|
+
swipeable = true,
|
|
95
|
+
snapPoints = [0.25, 0.5, 0.75, 1],
|
|
96
|
+
defaultSnapPoint = 0.5,
|
|
97
|
+
onSnapPointChange,
|
|
98
|
+
minSnapPoint = 0,
|
|
99
|
+
maxSnapPoint = 1,
|
|
100
|
+
velocityThreshold = DEFAULT_VELOCITY_THRESHOLD,
|
|
101
|
+
dragResistance = DEFAULT_DRAG_RESISTANCE,
|
|
102
|
+
animationConfig = SPRING_CONFIG,
|
|
103
|
+
onClick,
|
|
104
|
+
onFocus,
|
|
105
|
+
onBlur,
|
|
106
|
+
onClose,
|
|
107
|
+
onOpen,
|
|
108
|
+
onDragStart,
|
|
109
|
+
onDragEnd,
|
|
110
|
+
footer,
|
|
111
|
+
header,
|
|
112
|
+
persistent = false,
|
|
113
|
+
fullHeight = false,
|
|
114
|
+
rounded = true,
|
|
115
|
+
elevation = 16,
|
|
116
|
+
dataTestId = 'sheet',
|
|
117
|
+
...rest
|
|
118
|
+
}) => {
|
|
119
|
+
const theme = useTheme();
|
|
120
|
+
const [isOpen, setIsOpen] = useState(open);
|
|
121
|
+
const [currentSnapPoint, setCurrentSnapPoint] = useState(defaultSnapPoint);
|
|
122
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
123
|
+
const [dragStartY, setDragStartY] = useState(0);
|
|
124
|
+
const [currentHeight, setCurrentHeight] = useState<number | null>(null);
|
|
125
|
+
const [isAnimating, setIsAnimating] = useState(false);
|
|
126
|
+
|
|
127
|
+
const sheetRef = useRef<HTMLDivElement>(null);
|
|
128
|
+
const contentRef = useRef<HTMLDivElement>(null);
|
|
129
|
+
const animationFrameRef = useRef<number | undefined>(undefined);
|
|
130
|
+
const velocityRef = useRef(0);
|
|
131
|
+
const lastYRef = useRef(0);
|
|
132
|
+
const lastTimeRef = useRef(0);
|
|
133
|
+
|
|
134
|
+
// Support both dataTestId prop and data-testid HTML attribute
|
|
135
|
+
const testId = (rest as { 'data-testid'?: string })['data-testid'] || dataTestId;
|
|
136
|
+
|
|
137
|
+
const isDraggableVariant = variant === 'draggable';
|
|
138
|
+
const isBottomSheet = position === 'bottom';
|
|
139
|
+
const isTopSheet = position === 'top';
|
|
140
|
+
const isVerticalSheet = isBottomSheet || isTopSheet;
|
|
141
|
+
|
|
142
|
+
// Sort snap points for easier navigation
|
|
143
|
+
const sortedSnapPoints = useMemo(() => {
|
|
144
|
+
const points = [...snapPoints].sort((a, b) => a - b);
|
|
145
|
+
// Ensure snap points are within bounds
|
|
146
|
+
return points.filter((point) => point >= minSnapPoint && point <= maxSnapPoint);
|
|
147
|
+
}, [snapPoints, minSnapPoint, maxSnapPoint]);
|
|
148
|
+
|
|
149
|
+
const handleClose = useCallback(() => {
|
|
150
|
+
if (!persistent && !disabled) {
|
|
151
|
+
setIsOpen(false);
|
|
152
|
+
onOpenChange?.(false);
|
|
153
|
+
onClose?.();
|
|
154
|
+
}
|
|
155
|
+
}, [persistent, disabled, onOpenChange, onClose]);
|
|
156
|
+
|
|
157
|
+
const updateSheetHeight = useCallback(
|
|
158
|
+
(snapPoint: number) => {
|
|
159
|
+
if (!sheetRef.current || !isVerticalSheet) return;
|
|
160
|
+
|
|
161
|
+
const viewportHeight = window.innerHeight;
|
|
162
|
+
const height = Math.round(viewportHeight * snapPoint);
|
|
163
|
+
|
|
164
|
+
if (isBottomSheet) {
|
|
165
|
+
sheetRef.current.style.height = `${height}px`;
|
|
166
|
+
sheetRef.current.style.transform = 'translateY(0)';
|
|
167
|
+
} else if (isTopSheet) {
|
|
168
|
+
sheetRef.current.style.height = `${height}px`;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
setCurrentHeight(height);
|
|
172
|
+
},
|
|
173
|
+
[isBottomSheet, isTopSheet, isVerticalSheet],
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
const handleOverlayClick = useCallback(() => {
|
|
177
|
+
if (closeOnOverlayClick && !persistent) {
|
|
178
|
+
handleClose();
|
|
179
|
+
}
|
|
180
|
+
}, [closeOnOverlayClick, persistent, handleClose]);
|
|
181
|
+
|
|
182
|
+
const animateToSnapPoint = useCallback(
|
|
183
|
+
(targetSnapPoint: number, velocity = 0) => {
|
|
184
|
+
if (!sheetRef.current || !isVerticalSheet) return;
|
|
185
|
+
|
|
186
|
+
setIsAnimating(true);
|
|
187
|
+
const startSnapPoint = currentSnapPoint;
|
|
188
|
+
const distance = targetSnapPoint - startSnapPoint;
|
|
189
|
+
const startTime = globalThis.performance.now();
|
|
190
|
+
|
|
191
|
+
// Spring animation parameters
|
|
192
|
+
const { tension, friction } = { ...SPRING_CONFIG, ...animationConfig };
|
|
193
|
+
const springLength = 0;
|
|
194
|
+
let currentVelocity = velocity * 1000; // Convert to pixels per second
|
|
195
|
+
|
|
196
|
+
const animate = () => {
|
|
197
|
+
const now = globalThis.performance.now();
|
|
198
|
+
const elapsed = (now - startTime) / 1000; // Convert to seconds
|
|
199
|
+
|
|
200
|
+
// Spring physics calculations
|
|
201
|
+
const springForce = -tension * (startSnapPoint - targetSnapPoint + springLength);
|
|
202
|
+
const dampingForce = -friction * currentVelocity;
|
|
203
|
+
const acceleration = springForce + dampingForce;
|
|
204
|
+
|
|
205
|
+
currentVelocity += acceleration * 0.016; // 60fps timestep
|
|
206
|
+
const progress = Math.min(1, elapsed * 4); // Smooth easing
|
|
207
|
+
|
|
208
|
+
const currentPosition = startSnapPoint + distance * progress;
|
|
209
|
+
|
|
210
|
+
updateSheetHeight(currentPosition);
|
|
211
|
+
|
|
212
|
+
if (progress < 1) {
|
|
213
|
+
animationFrameRef.current = window.requestAnimationFrame(animate);
|
|
214
|
+
} else {
|
|
215
|
+
setIsAnimating(false);
|
|
216
|
+
setCurrentSnapPoint(targetSnapPoint);
|
|
217
|
+
onSnapPointChange?.(targetSnapPoint);
|
|
218
|
+
updateSheetHeight(targetSnapPoint);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
animate();
|
|
223
|
+
},
|
|
224
|
+
[currentSnapPoint, isVerticalSheet, updateSheetHeight, animationConfig, onSnapPointChange],
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
const findClosestSnapPoint = useCallback(
|
|
228
|
+
(currentPosition: number, velocity: number = 0) => {
|
|
229
|
+
// If velocity is significant, snap to next/previous point
|
|
230
|
+
if (Math.abs(velocity) > velocityThreshold) {
|
|
231
|
+
const currentIndex = sortedSnapPoints.findIndex(
|
|
232
|
+
(point) => Math.abs(point - currentSnapPoint) < 0.01,
|
|
233
|
+
);
|
|
234
|
+
|
|
235
|
+
if (velocity > 0 && currentIndex < sortedSnapPoints.length - 1) {
|
|
236
|
+
// Dragging up (for bottom sheet) - go to next higher snap point
|
|
237
|
+
return sortedSnapPoints[currentIndex + 1];
|
|
238
|
+
} else if (velocity < 0 && currentIndex > 0) {
|
|
239
|
+
// Dragging down (for bottom sheet) - go to next lower snap point
|
|
240
|
+
return sortedSnapPoints[currentIndex - 1];
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// Find closest snap point
|
|
245
|
+
return sortedSnapPoints.reduce((closest, point) => {
|
|
246
|
+
const currentDistance = Math.abs(currentPosition - closest);
|
|
247
|
+
const pointDistance = Math.abs(currentPosition - point);
|
|
248
|
+
return pointDistance < currentDistance ? point : closest;
|
|
249
|
+
}, sortedSnapPoints[0] || currentSnapPoint);
|
|
250
|
+
},
|
|
251
|
+
[sortedSnapPoints, currentSnapPoint, velocityThreshold],
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
const handleDragStart = useCallback(
|
|
255
|
+
(e: React.MouseEvent | React.TouchEvent) => {
|
|
256
|
+
if (!isDraggableVariant || !isVerticalSheet || isAnimating) return;
|
|
257
|
+
|
|
258
|
+
e.preventDefault();
|
|
259
|
+
e.stopPropagation();
|
|
260
|
+
|
|
261
|
+
const clientY = 'touches' in e ? (e.touches[0]?.clientY ?? 0) : e.clientY;
|
|
262
|
+
|
|
263
|
+
setIsDragging(true);
|
|
264
|
+
setDragStartY(clientY);
|
|
265
|
+
lastYRef.current = clientY;
|
|
266
|
+
lastTimeRef.current = globalThis.performance.now();
|
|
267
|
+
velocityRef.current = 0;
|
|
268
|
+
|
|
269
|
+
if (animationFrameRef.current) {
|
|
270
|
+
window.cancelAnimationFrame(animationFrameRef.current);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
onDragStart?.();
|
|
274
|
+
},
|
|
275
|
+
[isDraggableVariant, isVerticalSheet, isAnimating, onDragStart],
|
|
276
|
+
);
|
|
277
|
+
|
|
278
|
+
const handleDragMove = useCallback(
|
|
279
|
+
(e: globalThis.MouseEvent | globalThis.TouchEvent) => {
|
|
280
|
+
if (!isDragging || !sheetRef.current || !isVerticalSheet) return;
|
|
281
|
+
|
|
282
|
+
e.preventDefault();
|
|
283
|
+
const clientY = 'touches' in e ? (e.touches[0]?.clientY ?? 0) : e.clientY;
|
|
284
|
+
const currentTime = globalThis.performance.now();
|
|
285
|
+
|
|
286
|
+
// Calculate velocity
|
|
287
|
+
const deltaY = clientY - lastYRef.current;
|
|
288
|
+
const deltaTime = currentTime - lastTimeRef.current;
|
|
289
|
+
if (deltaTime > 0) {
|
|
290
|
+
velocityRef.current = deltaY / deltaTime;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
lastYRef.current = clientY;
|
|
294
|
+
lastTimeRef.current = currentTime;
|
|
295
|
+
|
|
296
|
+
const viewportHeight = window.innerHeight;
|
|
297
|
+
const dragDelta = isBottomSheet ? dragStartY - clientY : clientY - dragStartY;
|
|
298
|
+
const deltaSnapPoint = dragDelta / viewportHeight;
|
|
299
|
+
let newSnapPoint = currentSnapPoint + deltaSnapPoint;
|
|
300
|
+
|
|
301
|
+
// Apply resistance at boundaries
|
|
302
|
+
if (newSnapPoint < minSnapPoint) {
|
|
303
|
+
const overshoot = minSnapPoint - newSnapPoint;
|
|
304
|
+
newSnapPoint = minSnapPoint - overshoot * dragResistance;
|
|
305
|
+
} else if (newSnapPoint > maxSnapPoint) {
|
|
306
|
+
const overshoot = newSnapPoint - maxSnapPoint;
|
|
307
|
+
newSnapPoint = maxSnapPoint + overshoot * dragResistance;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
updateSheetHeight(newSnapPoint);
|
|
311
|
+
},
|
|
312
|
+
[
|
|
313
|
+
isDragging,
|
|
314
|
+
isVerticalSheet,
|
|
315
|
+
isBottomSheet,
|
|
316
|
+
dragStartY,
|
|
317
|
+
currentSnapPoint,
|
|
318
|
+
minSnapPoint,
|
|
319
|
+
maxSnapPoint,
|
|
320
|
+
dragResistance,
|
|
321
|
+
updateSheetHeight,
|
|
322
|
+
],
|
|
323
|
+
);
|
|
324
|
+
|
|
325
|
+
useEffect(() => {
|
|
326
|
+
setIsOpen(open);
|
|
327
|
+
if (open) {
|
|
328
|
+
onOpen?.();
|
|
329
|
+
if (isDraggableVariant && isVerticalSheet) {
|
|
330
|
+
// Initialize at default snap point
|
|
331
|
+
setCurrentSnapPoint(defaultSnapPoint);
|
|
332
|
+
updateSheetHeight(defaultSnapPoint);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}, [open, onOpen, isDraggableVariant, isVerticalSheet, defaultSnapPoint, updateSheetHeight]);
|
|
336
|
+
|
|
337
|
+
useEffect(() => {
|
|
338
|
+
const handleEscape = (e: globalThis.KeyboardEvent) => {
|
|
339
|
+
if (closeOnEscape && e.key === 'Escape' && isOpen) {
|
|
340
|
+
handleClose();
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
if (isOpen) {
|
|
345
|
+
document.addEventListener('keydown', handleEscape);
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
return () => {
|
|
349
|
+
document.removeEventListener('keydown', handleEscape);
|
|
350
|
+
};
|
|
351
|
+
}, [isOpen, closeOnEscape, handleClose]);
|
|
352
|
+
|
|
353
|
+
const handleDragEnd = useCallback(
|
|
354
|
+
(e: globalThis.MouseEvent | globalThis.TouchEvent) => {
|
|
355
|
+
if (!isDragging || !isVerticalSheet) return;
|
|
356
|
+
|
|
357
|
+
e.preventDefault();
|
|
358
|
+
setIsDragging(false);
|
|
359
|
+
|
|
360
|
+
const clientY = 'touches' in e ? (e.touches[0]?.clientY ?? 0) : e.clientY;
|
|
361
|
+
const viewportHeight = window.innerHeight;
|
|
362
|
+
const totalDragDelta = isBottomSheet ? dragStartY - clientY : clientY - dragStartY;
|
|
363
|
+
const deltaSnapPoint = totalDragDelta / viewportHeight;
|
|
364
|
+
const currentPosition = currentSnapPoint + deltaSnapPoint;
|
|
365
|
+
|
|
366
|
+
// Calculate final velocity for momentum-based snapping
|
|
367
|
+
const velocity = isBottomSheet ? -(velocityRef.current || 0) : velocityRef.current || 0;
|
|
368
|
+
|
|
369
|
+
// Find and animate to closest snap point
|
|
370
|
+
const targetSnapPoint = findClosestSnapPoint(currentPosition, velocity);
|
|
371
|
+
if (targetSnapPoint !== undefined) {
|
|
372
|
+
animateToSnapPoint(targetSnapPoint, velocity);
|
|
373
|
+
onDragEnd?.(targetSnapPoint);
|
|
374
|
+
}
|
|
375
|
+
},
|
|
376
|
+
[
|
|
377
|
+
isDragging,
|
|
378
|
+
isVerticalSheet,
|
|
379
|
+
isBottomSheet,
|
|
380
|
+
dragStartY,
|
|
381
|
+
currentSnapPoint,
|
|
382
|
+
findClosestSnapPoint,
|
|
383
|
+
animateToSnapPoint,
|
|
384
|
+
onDragEnd,
|
|
385
|
+
],
|
|
386
|
+
);
|
|
387
|
+
|
|
388
|
+
// Add drag event listeners
|
|
389
|
+
useEffect(() => {
|
|
390
|
+
if (isDragging) {
|
|
391
|
+
const handleMouseMove = (e: globalThis.MouseEvent) => handleDragMove(e);
|
|
392
|
+
const handleMouseUp = (e: globalThis.MouseEvent) => handleDragEnd(e);
|
|
393
|
+
const handleTouchMove = (e: globalThis.TouchEvent) => handleDragMove(e);
|
|
394
|
+
const handleTouchEnd = (e: globalThis.TouchEvent) => handleDragEnd(e);
|
|
395
|
+
|
|
396
|
+
document.addEventListener('mousemove', handleMouseMove);
|
|
397
|
+
document.addEventListener('mouseup', handleMouseUp);
|
|
398
|
+
document.addEventListener('touchmove', handleTouchMove, { passive: false });
|
|
399
|
+
document.addEventListener('touchend', handleTouchEnd);
|
|
400
|
+
|
|
401
|
+
return () => {
|
|
402
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
403
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
404
|
+
document.removeEventListener('touchmove', handleTouchMove);
|
|
405
|
+
document.removeEventListener('touchend', handleTouchEnd);
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
}, [isDragging, handleDragMove, handleDragEnd]);
|
|
409
|
+
|
|
410
|
+
const getSizeStyles = () => {
|
|
411
|
+
const isHorizontal = position === 'left' || position === 'right';
|
|
412
|
+
|
|
413
|
+
// For draggable variant, use dynamic height based on snap point
|
|
414
|
+
if (isDraggableVariant && isVerticalSheet && currentHeight !== null) {
|
|
415
|
+
return { height: currentHeight };
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// Horizontal (left/right) sheets are viewport-aware: a px floor keeps the
|
|
419
|
+
// panel usable, `…vw` lets the larger presets grow on wide screens (lg ≥32%,
|
|
420
|
+
// xl ≥40% of the viewport), and the outer `min(92vw, …)` guarantees the
|
|
421
|
+
// panel never overflows a small screen. Vertical presets stay fixed-height.
|
|
422
|
+
switch (size) {
|
|
423
|
+
case 'xs':
|
|
424
|
+
return isHorizontal ? { width: 'min(92vw, 240px)' } : { height: 200 };
|
|
425
|
+
case 'sm':
|
|
426
|
+
return isHorizontal ? { width: 'min(92vw, 320px)' } : { height: 300 };
|
|
427
|
+
case 'md':
|
|
428
|
+
return isHorizontal ? { width: 'min(92vw, 400px)' } : { height: 400 };
|
|
429
|
+
case 'lg':
|
|
430
|
+
return isHorizontal ? { width: 'min(92vw, max(560px, 32vw))' } : { height: 500 };
|
|
431
|
+
case 'xl':
|
|
432
|
+
return isHorizontal ? { width: 'min(92vw, max(720px, 40vw))' } : { height: 600 };
|
|
433
|
+
case 'full':
|
|
434
|
+
return isHorizontal ? { width: '100%' } : { height: '100%' };
|
|
435
|
+
default:
|
|
436
|
+
return isHorizontal ? { width: 'min(92vw, 400px)' } : { height: 400 };
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
const getVariantStyles = () => {
|
|
441
|
+
// Extract RGB values for CSS variables
|
|
442
|
+
const getRgbValues = (hexColor: string) => {
|
|
443
|
+
const hex = hexColor.replace('#', '');
|
|
444
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
445
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
446
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
447
|
+
return `${r}, ${g}, ${b}`;
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
const colorMain = theme.palette[color]?.main || theme.palette.primary.main;
|
|
451
|
+
const colorRgb = getRgbValues(colorMain);
|
|
452
|
+
|
|
453
|
+
const baseStyles = {
|
|
454
|
+
backgroundColor: theme.palette.background.paper,
|
|
455
|
+
transition:
|
|
456
|
+
!isDragging && !isAnimating
|
|
457
|
+
? theme.transitions.create(['all'], {
|
|
458
|
+
duration: theme.transitions.duration.standard,
|
|
459
|
+
easing: theme.transitions.easing.easeInOut,
|
|
460
|
+
})
|
|
461
|
+
: 'none',
|
|
462
|
+
opacity: disabled ? 0.5 : 1,
|
|
463
|
+
pointerEvents: disabled ? ('none' as const) : ('auto' as const),
|
|
464
|
+
cursor: isDraggableVariant && isVerticalSheet ? 'grab' : 'auto',
|
|
465
|
+
'--pulse-color': colorRgb,
|
|
466
|
+
'--glow-color': colorRgb,
|
|
467
|
+
...(isDragging && { cursor: 'grabbing' }),
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
const glowStyles = glow
|
|
471
|
+
? {
|
|
472
|
+
animation: `${glowAnimation} 2s ease-in-out infinite`,
|
|
473
|
+
filter: 'brightness(1.05)',
|
|
474
|
+
}
|
|
475
|
+
: {};
|
|
476
|
+
|
|
477
|
+
const pulseStyles = pulse
|
|
478
|
+
? {
|
|
479
|
+
animation: `${pulseAnimation} 2s infinite`,
|
|
480
|
+
position: 'relative' as const,
|
|
481
|
+
}
|
|
482
|
+
: {};
|
|
483
|
+
|
|
484
|
+
const roundedStyles =
|
|
485
|
+
rounded && (position === 'top' || position === 'bottom')
|
|
486
|
+
? {
|
|
487
|
+
borderRadius:
|
|
488
|
+
position === 'top'
|
|
489
|
+
? `0 0 ${theme.spacing(2)} ${theme.spacing(2)}`
|
|
490
|
+
: `${theme.spacing(2)} ${theme.spacing(2)} 0 0`,
|
|
491
|
+
}
|
|
492
|
+
: rounded && (position === 'left' || position === 'right')
|
|
493
|
+
? {
|
|
494
|
+
borderRadius:
|
|
495
|
+
position === 'left'
|
|
496
|
+
? `0 ${theme.spacing(2)} ${theme.spacing(2)} 0`
|
|
497
|
+
: `${theme.spacing(2)} 0 0 ${theme.spacing(2)}`,
|
|
498
|
+
}
|
|
499
|
+
: {};
|
|
500
|
+
|
|
501
|
+
switch (variant) {
|
|
502
|
+
case 'draggable':
|
|
503
|
+
return {
|
|
504
|
+
...baseStyles,
|
|
505
|
+
...glowStyles,
|
|
506
|
+
...pulseStyles,
|
|
507
|
+
...roundedStyles,
|
|
508
|
+
boxShadow: `
|
|
509
|
+
${theme.shadows[Math.min(elevation + 4, 24)]},
|
|
510
|
+
0 -2px 10px 0 ${alpha(theme.palette.common.black, 0.1)}
|
|
511
|
+
`,
|
|
512
|
+
border: `1px solid ${alpha(theme.palette.divider, 0.12)}`,
|
|
513
|
+
borderTop: `2px solid ${alpha(theme.palette[color]?.main || theme.palette.primary.main, 0.3)}`,
|
|
514
|
+
transition: theme.transitions.create(['transform', 'box-shadow', 'border-color'], {
|
|
515
|
+
duration: theme.transitions.duration.shorter,
|
|
516
|
+
easing: theme.transitions.easing.easeInOut,
|
|
517
|
+
}),
|
|
518
|
+
'&:hover': {
|
|
519
|
+
borderTopColor: alpha(theme.palette[color]?.main || theme.palette.primary.main, 0.5),
|
|
520
|
+
},
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
case 'glass':
|
|
524
|
+
return {
|
|
525
|
+
...baseStyles,
|
|
526
|
+
...glowStyles,
|
|
527
|
+
...pulseStyles,
|
|
528
|
+
...roundedStyles,
|
|
529
|
+
backgroundColor: alpha(theme.palette.background.paper, glass ? 0.75 : 0.95),
|
|
530
|
+
backdropFilter: 'blur(24px) saturate(180%)',
|
|
531
|
+
WebkitBackdropFilter: 'blur(24px) saturate(180%)',
|
|
532
|
+
border: `1px solid ${alpha(theme.palette.divider, 0.15)}`,
|
|
533
|
+
boxShadow: `
|
|
534
|
+
0 8px 32px 0 ${alpha(theme.palette.common.black, 0.15)},
|
|
535
|
+
inset 0 0 0 1px ${alpha(theme.palette.common.white, 0.1)}
|
|
536
|
+
`,
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
case 'gradient':
|
|
540
|
+
return {
|
|
541
|
+
...baseStyles,
|
|
542
|
+
...glowStyles,
|
|
543
|
+
...pulseStyles,
|
|
544
|
+
...roundedStyles,
|
|
545
|
+
background: gradient
|
|
546
|
+
? `linear-gradient(
|
|
547
|
+
135deg,
|
|
548
|
+
${theme.palette.background.paper} 0%,
|
|
549
|
+
${alpha(theme.palette[color]?.main || theme.palette.primary.main, 0.08)} 50%,
|
|
550
|
+
${alpha(theme.palette[color]?.dark || theme.palette[color]?.main || theme.palette.primary.main, 0.12)} 100%
|
|
551
|
+
)`
|
|
552
|
+
: theme.palette.background.paper,
|
|
553
|
+
position: 'relative' as const,
|
|
554
|
+
overflow: 'hidden' as const,
|
|
555
|
+
'&::before': gradient
|
|
556
|
+
? {
|
|
557
|
+
content: '""',
|
|
558
|
+
position: 'absolute',
|
|
559
|
+
top: 0,
|
|
560
|
+
left: '-100%',
|
|
561
|
+
width: '100%',
|
|
562
|
+
height: '100%',
|
|
563
|
+
background: `linear-gradient(
|
|
564
|
+
90deg,
|
|
565
|
+
transparent,
|
|
566
|
+
${alpha(theme.palette.common.white, 0.2)},
|
|
567
|
+
transparent
|
|
568
|
+
)`,
|
|
569
|
+
animation: `${shimmerAnimation} 3s infinite`,
|
|
570
|
+
}
|
|
571
|
+
: {},
|
|
572
|
+
};
|
|
573
|
+
|
|
574
|
+
case 'elevated':
|
|
575
|
+
return {
|
|
576
|
+
...baseStyles,
|
|
577
|
+
...glowStyles,
|
|
578
|
+
...pulseStyles,
|
|
579
|
+
...roundedStyles,
|
|
580
|
+
boxShadow: `
|
|
581
|
+
${theme.shadows[elevation]},
|
|
582
|
+
0 20px 40px -15px ${alpha(theme.palette.common.black, 0.15)}
|
|
583
|
+
`,
|
|
584
|
+
transform: 'translateZ(0)',
|
|
585
|
+
willChange: 'transform',
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
case 'minimal':
|
|
589
|
+
return {
|
|
590
|
+
...baseStyles,
|
|
591
|
+
...glowStyles,
|
|
592
|
+
...pulseStyles,
|
|
593
|
+
...roundedStyles,
|
|
594
|
+
boxShadow: 'none',
|
|
595
|
+
border: 'none',
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
default:
|
|
599
|
+
return {
|
|
600
|
+
...baseStyles,
|
|
601
|
+
...glowStyles,
|
|
602
|
+
...pulseStyles,
|
|
603
|
+
...roundedStyles,
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
const isSwipeable = swipeable && !isDraggableVariant;
|
|
609
|
+
|
|
610
|
+
// Create a proper BackdropComponent that accepts refs and matches BackdropProps
|
|
611
|
+
const NoBackdrop = React.forwardRef<HTMLDivElement, BackdropProps>((_props, _ref) => null) as React.ComponentType<BackdropProps>;
|
|
612
|
+
NoBackdrop.displayName = 'NoBackdrop';
|
|
613
|
+
|
|
614
|
+
return (
|
|
615
|
+
<>
|
|
616
|
+
{showOverlay && isOpen && (
|
|
617
|
+
<SheetOverlay open={isOpen} onClick={handleOverlayClick} blur={variant === 'glass'} />
|
|
618
|
+
)}
|
|
619
|
+
|
|
620
|
+
{isSwipeable ? (
|
|
621
|
+
<SwipeableDrawer
|
|
622
|
+
onOpen={() => {
|
|
623
|
+
setIsOpen(true);
|
|
624
|
+
onOpenChange?.(true);
|
|
625
|
+
onOpen?.();
|
|
626
|
+
}}
|
|
627
|
+
onClose={handleClose}
|
|
628
|
+
disableSwipeToOpen={false}
|
|
629
|
+
swipeAreaWidth={20}
|
|
630
|
+
anchor={position}
|
|
631
|
+
open={isOpen}
|
|
632
|
+
className={className}
|
|
633
|
+
PaperProps={{
|
|
634
|
+
ref: sheetRef,
|
|
635
|
+
sx: {
|
|
636
|
+
...getSizeStyles(),
|
|
637
|
+
...getVariantStyles(),
|
|
638
|
+
...style,
|
|
639
|
+
overflow: 'visible',
|
|
640
|
+
// Expand only the cross axis so the chosen `size` still governs
|
|
641
|
+
// the main axis: side sheets keep their (responsive) width and go
|
|
642
|
+
// full-height; top/bottom sheets keep their height and go full-width.
|
|
643
|
+
...(fullHeight &&
|
|
644
|
+
!isDraggableVariant &&
|
|
645
|
+
(position === 'left' || position === 'right'
|
|
646
|
+
? { height: '100%' }
|
|
647
|
+
: { width: '100%' })),
|
|
648
|
+
},
|
|
649
|
+
}}
|
|
650
|
+
ModalProps={{
|
|
651
|
+
keepMounted: true,
|
|
652
|
+
BackdropComponent: NoBackdrop,
|
|
653
|
+
}}
|
|
654
|
+
>
|
|
655
|
+
<Box
|
|
656
|
+
ref={contentRef}
|
|
657
|
+
onClick={onClick}
|
|
658
|
+
onFocus={onFocus}
|
|
659
|
+
onBlur={onBlur}
|
|
660
|
+
data-testid={testId}
|
|
661
|
+
sx={{
|
|
662
|
+
height: '100%',
|
|
663
|
+
display: 'flex',
|
|
664
|
+
flexDirection: 'column',
|
|
665
|
+
position: 'relative',
|
|
666
|
+
userSelect: isDragging ? 'none' : 'auto',
|
|
667
|
+
}}
|
|
668
|
+
>
|
|
669
|
+
{(showHandle || title || description || showCloseButton || header) && (
|
|
670
|
+
<SheetHeader
|
|
671
|
+
title={title}
|
|
672
|
+
description={description}
|
|
673
|
+
showCloseButton={showCloseButton}
|
|
674
|
+
onClose={handleClose}
|
|
675
|
+
showHandle={showHandle && isVerticalSheet}
|
|
676
|
+
isDraggable={isDraggableVariant && isVerticalSheet}
|
|
677
|
+
onDragStart={handleDragStart}
|
|
678
|
+
dataTestId={`${testId}-header`}
|
|
679
|
+
>
|
|
680
|
+
{header}
|
|
681
|
+
</SheetHeader>
|
|
682
|
+
)}
|
|
683
|
+
|
|
684
|
+
<SheetContent padded dataTestId={`${testId}-content`}>
|
|
685
|
+
{loading ? (
|
|
686
|
+
<Box
|
|
687
|
+
sx={{
|
|
688
|
+
display: 'flex',
|
|
689
|
+
justifyContent: 'center',
|
|
690
|
+
alignItems: 'center',
|
|
691
|
+
minHeight: 200,
|
|
692
|
+
}}
|
|
693
|
+
>
|
|
694
|
+
<CircularProgress color={color} />
|
|
695
|
+
</Box>
|
|
696
|
+
) : (
|
|
697
|
+
children
|
|
698
|
+
)}
|
|
699
|
+
</SheetContent>
|
|
700
|
+
|
|
701
|
+
{footer && (
|
|
702
|
+
<SheetFooter sticky divider dataTestId={`${testId}-footer`}>
|
|
703
|
+
{footer}
|
|
704
|
+
</SheetFooter>
|
|
705
|
+
)}
|
|
706
|
+
</Box>
|
|
707
|
+
</SwipeableDrawer>
|
|
708
|
+
) : (
|
|
709
|
+
<Drawer
|
|
710
|
+
onClose={handleClose}
|
|
711
|
+
anchor={position}
|
|
712
|
+
open={isOpen}
|
|
713
|
+
className={className}
|
|
714
|
+
PaperProps={{
|
|
715
|
+
ref: sheetRef,
|
|
716
|
+
sx: {
|
|
717
|
+
...getSizeStyles(),
|
|
718
|
+
...getVariantStyles(),
|
|
719
|
+
...style,
|
|
720
|
+
overflow: 'visible',
|
|
721
|
+
// Expand only the cross axis so the chosen `size` still governs
|
|
722
|
+
// the main axis: side sheets keep their (responsive) width and go
|
|
723
|
+
// full-height; top/bottom sheets keep their height and go full-width.
|
|
724
|
+
...(fullHeight &&
|
|
725
|
+
!isDraggableVariant &&
|
|
726
|
+
(position === 'left' || position === 'right'
|
|
727
|
+
? { height: '100%' }
|
|
728
|
+
: { width: '100%' })),
|
|
729
|
+
},
|
|
730
|
+
}}
|
|
731
|
+
ModalProps={{
|
|
732
|
+
keepMounted: true,
|
|
733
|
+
BackdropComponent: NoBackdrop,
|
|
734
|
+
}}
|
|
735
|
+
>
|
|
736
|
+
<Box
|
|
737
|
+
ref={contentRef}
|
|
738
|
+
onClick={onClick}
|
|
739
|
+
onFocus={onFocus}
|
|
740
|
+
onBlur={onBlur}
|
|
741
|
+
data-testid={testId}
|
|
742
|
+
sx={{
|
|
743
|
+
height: '100%',
|
|
744
|
+
display: 'flex',
|
|
745
|
+
flexDirection: 'column',
|
|
746
|
+
position: 'relative',
|
|
747
|
+
userSelect: isDragging ? 'none' : 'auto',
|
|
748
|
+
}}
|
|
749
|
+
>
|
|
750
|
+
{(showHandle || title || description || showCloseButton || header) && (
|
|
751
|
+
<SheetHeader
|
|
752
|
+
title={title}
|
|
753
|
+
description={description}
|
|
754
|
+
showCloseButton={showCloseButton}
|
|
755
|
+
onClose={handleClose}
|
|
756
|
+
showHandle={showHandle && isVerticalSheet}
|
|
757
|
+
isDraggable={isDraggableVariant && isVerticalSheet}
|
|
758
|
+
onDragStart={handleDragStart}
|
|
759
|
+
dataTestId={`${testId}-header`}
|
|
760
|
+
>
|
|
761
|
+
{header}
|
|
762
|
+
</SheetHeader>
|
|
763
|
+
)}
|
|
764
|
+
|
|
765
|
+
<SheetContent padded dataTestId={`${testId}-content`}>
|
|
766
|
+
{loading ? (
|
|
767
|
+
<Box
|
|
768
|
+
sx={{
|
|
769
|
+
display: 'flex',
|
|
770
|
+
justifyContent: 'center',
|
|
771
|
+
alignItems: 'center',
|
|
772
|
+
minHeight: 200,
|
|
773
|
+
}}
|
|
774
|
+
>
|
|
775
|
+
<CircularProgress color={color} />
|
|
776
|
+
</Box>
|
|
777
|
+
) : (
|
|
778
|
+
children
|
|
779
|
+
)}
|
|
780
|
+
</SheetContent>
|
|
781
|
+
|
|
782
|
+
{footer && (
|
|
783
|
+
<SheetFooter sticky divider dataTestId={`${testId}-footer`}>
|
|
784
|
+
{footer}
|
|
785
|
+
</SheetFooter>
|
|
786
|
+
)}
|
|
787
|
+
</Box>
|
|
788
|
+
</Drawer>
|
|
789
|
+
)}
|
|
790
|
+
</>
|
|
791
|
+
);
|
|
792
|
+
};
|
|
793
|
+
|
|
794
|
+
export const SheetHeader: React.FC<SheetHeaderProps> = ({
|
|
795
|
+
title,
|
|
796
|
+
description,
|
|
797
|
+
showCloseButton,
|
|
798
|
+
onClose,
|
|
799
|
+
showHandle,
|
|
800
|
+
isDraggable = false,
|
|
801
|
+
onDragStart,
|
|
802
|
+
className,
|
|
803
|
+
style,
|
|
804
|
+
children,
|
|
805
|
+
dataTestId = 'sheet-header',
|
|
806
|
+
}) => {
|
|
807
|
+
const theme = useTheme();
|
|
808
|
+
|
|
809
|
+
return (
|
|
810
|
+
<Box
|
|
811
|
+
className={className}
|
|
812
|
+
data-testid={dataTestId}
|
|
813
|
+
sx={{
|
|
814
|
+
p: 2,
|
|
815
|
+
pb: showHandle ? 1 : 2,
|
|
816
|
+
cursor: isDraggable ? 'grab' : 'auto',
|
|
817
|
+
'&:active': isDraggable ? { cursor: 'grabbing' } : {},
|
|
818
|
+
...style,
|
|
819
|
+
}}
|
|
820
|
+
onMouseDown={isDraggable ? onDragStart : undefined}
|
|
821
|
+
onTouchStart={isDraggable ? onDragStart : undefined}
|
|
822
|
+
>
|
|
823
|
+
{showHandle && (
|
|
824
|
+
<Box
|
|
825
|
+
sx={{
|
|
826
|
+
display: 'flex',
|
|
827
|
+
justifyContent: 'center',
|
|
828
|
+
mb: 1,
|
|
829
|
+
pointerEvents: isDraggable ? 'none' : 'auto',
|
|
830
|
+
}}
|
|
831
|
+
>
|
|
832
|
+
<Box
|
|
833
|
+
sx={{
|
|
834
|
+
width: isDraggable ? 48 : 32,
|
|
835
|
+
height: isDraggable ? 6 : 4,
|
|
836
|
+
backgroundColor: alpha(theme.palette.text.primary, 0.3),
|
|
837
|
+
borderRadius: 3,
|
|
838
|
+
transition: theme.transitions.create(['all'], {
|
|
839
|
+
duration: theme.transitions.duration.short,
|
|
840
|
+
easing: theme.transitions.easing.easeInOut,
|
|
841
|
+
}),
|
|
842
|
+
position: 'relative',
|
|
843
|
+
overflow: 'hidden',
|
|
844
|
+
'&::after': {
|
|
845
|
+
content: '""',
|
|
846
|
+
position: 'absolute',
|
|
847
|
+
top: 0,
|
|
848
|
+
left: '-100%',
|
|
849
|
+
width: '100%',
|
|
850
|
+
height: '100%',
|
|
851
|
+
background: `linear-gradient(
|
|
852
|
+
90deg,
|
|
853
|
+
transparent,
|
|
854
|
+
${alpha(theme.palette.common.white, 0.3)},
|
|
855
|
+
transparent
|
|
856
|
+
)`,
|
|
857
|
+
animation: isDraggable ? `${shimmerAnimation} 2s infinite` : 'none',
|
|
858
|
+
},
|
|
859
|
+
...(isDraggable && {
|
|
860
|
+
backgroundColor: alpha(theme.palette.primary.main, 0.4),
|
|
861
|
+
boxShadow: `0 2px 4px ${alpha(theme.palette.primary.main, 0.2)}`,
|
|
862
|
+
'&:hover': {
|
|
863
|
+
backgroundColor: theme.palette.primary.main,
|
|
864
|
+
transform: 'scaleX(1.15) scaleY(1.2)',
|
|
865
|
+
boxShadow: `0 3px 6px ${alpha(theme.palette.primary.main, 0.3)}`,
|
|
866
|
+
},
|
|
867
|
+
}),
|
|
868
|
+
}}
|
|
869
|
+
/>
|
|
870
|
+
</Box>
|
|
871
|
+
)}
|
|
872
|
+
|
|
873
|
+
<Box
|
|
874
|
+
sx={{
|
|
875
|
+
display: 'flex',
|
|
876
|
+
alignItems: 'flex-start',
|
|
877
|
+
justifyContent: 'space-between',
|
|
878
|
+
}}
|
|
879
|
+
>
|
|
880
|
+
<Box sx={{ flex: 1 }}>
|
|
881
|
+
{title && (
|
|
882
|
+
<Typography variant="h6" sx={{ fontWeight: 600 }} data-testid={`${dataTestId}-title`}>
|
|
883
|
+
{title}
|
|
884
|
+
</Typography>
|
|
885
|
+
)}
|
|
886
|
+
{description && (
|
|
887
|
+
<Typography variant="body2" color="text.secondary" sx={{ mt: 0.5 }}>
|
|
888
|
+
{description}
|
|
889
|
+
</Typography>
|
|
890
|
+
)}
|
|
891
|
+
{children}
|
|
892
|
+
</Box>
|
|
893
|
+
|
|
894
|
+
{showCloseButton && (
|
|
895
|
+
<IconButton onClick={onClose} size="small" sx={{ ml: 1, mt: -0.5 }} data-testid={`${dataTestId}-close-button`}>
|
|
896
|
+
<CloseIcon data-testid={`${dataTestId}-close-icon`} />
|
|
897
|
+
</IconButton>
|
|
898
|
+
)}
|
|
899
|
+
</Box>
|
|
900
|
+
</Box>
|
|
901
|
+
);
|
|
902
|
+
};
|
|
903
|
+
|
|
904
|
+
export const SheetContent: React.FC<SheetContentProps> = ({
|
|
905
|
+
children,
|
|
906
|
+
className,
|
|
907
|
+
style,
|
|
908
|
+
padded = true,
|
|
909
|
+
dataTestId = 'sheet-content',
|
|
910
|
+
}) => (
|
|
911
|
+
<Box
|
|
912
|
+
className={className}
|
|
913
|
+
data-testid={dataTestId}
|
|
914
|
+
sx={{
|
|
915
|
+
flex: 1,
|
|
916
|
+
overflow: 'auto',
|
|
917
|
+
p: padded ? 2 : 0,
|
|
918
|
+
...style,
|
|
919
|
+
}}
|
|
920
|
+
>
|
|
921
|
+
{children}
|
|
922
|
+
</Box>
|
|
923
|
+
);
|
|
924
|
+
|
|
925
|
+
export const SheetFooter: React.FC<SheetFooterProps> = ({
|
|
926
|
+
children,
|
|
927
|
+
className,
|
|
928
|
+
style,
|
|
929
|
+
sticky = false,
|
|
930
|
+
divider = false,
|
|
931
|
+
dataTestId = 'sheet-footer',
|
|
932
|
+
}) => (
|
|
933
|
+
<>
|
|
934
|
+
{divider && <Divider />}
|
|
935
|
+
<Box
|
|
936
|
+
className={className}
|
|
937
|
+
data-testid={dataTestId}
|
|
938
|
+
sx={{
|
|
939
|
+
p: 2,
|
|
940
|
+
position: sticky ? 'sticky' : 'relative',
|
|
941
|
+
bottom: sticky ? 0 : 'auto',
|
|
942
|
+
backgroundColor: 'background.paper',
|
|
943
|
+
borderTop: sticky ? '1px solid' : 'none',
|
|
944
|
+
borderColor: 'divider',
|
|
945
|
+
...style,
|
|
946
|
+
}}
|
|
947
|
+
>
|
|
948
|
+
{children}
|
|
949
|
+
</Box>
|
|
950
|
+
</>
|
|
951
|
+
);
|
|
952
|
+
|
|
953
|
+
export const SheetOverlay: React.FC<SheetOverlayProps> = ({
|
|
954
|
+
open = false,
|
|
955
|
+
onClick,
|
|
956
|
+
className,
|
|
957
|
+
style,
|
|
958
|
+
blur = false,
|
|
959
|
+
}) => {
|
|
960
|
+
const theme = useTheme();
|
|
961
|
+
|
|
962
|
+
return (
|
|
963
|
+
<Fade in={open} timeout={300}>
|
|
964
|
+
<Backdrop
|
|
965
|
+
open={open}
|
|
966
|
+
onClick={onClick}
|
|
967
|
+
className={className}
|
|
968
|
+
sx={{
|
|
969
|
+
zIndex: theme.zIndex.drawer - 1,
|
|
970
|
+
backgroundColor: alpha(theme.palette.common.black, blur ? 0.6 : 0.5),
|
|
971
|
+
backdropFilter: blur ? 'blur(8px) saturate(180%)' : 'none',
|
|
972
|
+
WebkitBackdropFilter: blur ? 'blur(8px) saturate(180%)' : 'none',
|
|
973
|
+
...style,
|
|
974
|
+
}}
|
|
975
|
+
/>
|
|
976
|
+
</Fade>
|
|
977
|
+
);
|
|
978
|
+
};
|