trepur_components 2.3.8 → 2.3.9
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/package.json +3 -2
- package/src/components/Accordion/Accordion.stories.tsx +23 -100
- package/src/components/Accordion/const.tsx +34 -0
- package/src/components/Accordion/index.tsx +18 -17
- package/src/components/AlertBar/AlertBar.stories.tsx +79 -85
- package/src/components/AlertBar/index.tsx +69 -100
- package/src/components/Avatar/Avatar.stories.tsx +3 -8
- package/src/components/Avatar/index.tsx +31 -31
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +17 -34
- package/src/components/Breadcrumbs/index.tsx +78 -29
- package/src/components/Button/Button.stories.tsx +11 -137
- package/src/components/Button/index.tsx +47 -92
- package/src/components/Calendar/Calendar.stories.tsx +12 -73
- package/src/components/Calendar/index.tsx +54 -34
- package/src/components/Card/Card.stories.tsx +3 -64
- package/src/components/Card/index.tsx +23 -80
- package/src/components/Carousel/Carousel.stories.tsx +32 -439
- package/src/components/Carousel/index.tsx +205 -286
- package/src/components/Carousel/utils.ts +53 -0
- package/src/components/CarouselThumbnail/CarouselThumbnail.stories.tsx +16 -337
- package/src/components/CarouselThumbnail/const.ts +17 -0
- package/src/components/CarouselThumbnail/index.tsx +92 -216
- package/src/components/CarouselThumbnail/utils.ts +87 -0
- package/src/components/Checkbox/Checkbox.stories.tsx +12 -19
- package/src/components/Checkbox/index.tsx +37 -34
- package/src/components/Collapsible/Collapsible.stories.tsx +50 -50
- package/src/components/Collapsible/index.tsx +151 -110
- package/src/components/Counter/Counter.stories.tsx +10 -9
- package/src/components/Counter/index.tsx +81 -25
- package/src/components/DetailUpdater/DetailUpdater.stories.tsx +11 -69
- package/src/components/DetailUpdater/index.tsx +7 -8
- package/src/components/Dialog/Dialog.stories.tsx +13 -78
- package/src/components/Dialog/index.tsx +5 -69
- package/src/components/Dropdown/Dropdown.stories.tsx +22 -0
- package/src/components/Dropdown/index.tsx +117 -0
- package/src/components/Dropdown/utils.ts +15 -0
- package/src/components/FileUploader/FilePreview.tsx +2 -2
- package/src/components/FileUploader/FileUploader.stories.tsx +10 -8
- package/src/components/FileUploader/index.tsx +113 -68
- package/src/components/Footer/Footer.stories.tsx +38 -50
- package/src/components/Footer/index.tsx +84 -36
- package/src/components/FooterNav/FooterNav.stories.tsx +14 -104
- package/src/components/FooterNav/index.tsx +71 -45
- package/src/components/Form/Form.stories.tsx +9 -9
- package/src/components/Form/index.tsx +10 -15
- package/src/components/Gallery/Gallery.stories.tsx +39 -0
- package/src/components/Gallery/index.tsx +31 -0
- package/src/components/Greeting/Greeting.stories.tsx +6 -31
- package/src/components/Greeting/index.tsx +44 -25
- package/src/components/HamburgerIcon/HamburgerIcon.stories.tsx +3 -21
- package/src/components/HamburgerIcon/index.tsx +40 -62
- package/src/components/Icon/Icon.stories.tsx +30 -11
- package/src/components/Icon/index.tsx +28 -20
- package/src/components/Image/Image.stories.tsx +5 -75
- package/src/components/Image/index.tsx +17 -119
- package/src/components/ImageCard/ImageCard.stories.tsx +29 -0
- package/src/components/ImageCard/index.tsx +75 -0
- package/src/components/Input/Input.stories.tsx +12 -71
- package/src/components/Input/index.tsx +107 -98
- package/src/components/MenuButton/MenuButton.stories.tsx +5 -5
- package/src/components/MenuButton/index.tsx +4 -4
- package/src/components/Modal/Modal.stories.tsx +7 -7
- package/src/components/Modal/index.tsx +4 -4
- package/src/components/Nav/Nav.stories.tsx +80 -0
- package/src/components/Nav/index.tsx +171 -0
- package/src/components/NavItem/NavItem.stories.tsx +7 -80
- package/src/components/NavItem/index.tsx +34 -38
- package/src/components/Pill/Pill.stories.tsx +42 -35
- package/src/components/Pill/index.tsx +64 -49
- package/src/components/Search/Search.stories.tsx +8 -8
- package/src/components/Search/index.tsx +3 -3
- package/src/components/Select/Select.stories.tsx +5 -5
- package/src/components/Select/index.tsx +8 -9
- package/src/components/Showcase/Showcase.stories.tsx +3 -3
- package/src/components/Showcase/index.tsx +12 -19
- package/src/components/SideNav/SideNav.stories.tsx +7 -7
- package/src/components/SideNav/index.tsx +2 -2
- package/src/components/SocialButton/SocialButton.stories.tsx +11 -11
- package/src/components/SocialButton/index.tsx +6 -7
- package/src/components/SplitCard/SplitCard.stories.tsx +34 -0
- package/src/components/SplitCard/index.tsx +132 -0
- package/src/components/Stars/Star.stories.tsx +18 -0
- package/src/components/Stars/index.tsx +38 -0
- package/src/components/Testimonial/Testimonial.stories.tsx +25 -97
- package/src/components/Testimonial/index.tsx +121 -53
- package/src/components/TextArea/TextArea.stories.tsx +11 -42
- package/src/components/TextArea/index.tsx +104 -95
- package/src/components/Timeline/Timeline.stories.tsx +32 -79
- package/src/components/Timeline/index.tsx +55 -246
- package/src/components/Tubestops/Tubestops.stories.tsx +10 -30
- package/src/components/Tubestops/index.tsx +125 -47
- package/src/components/Video/Video.stories.tsx +47 -12
- package/src/components/Video/assets/example.mp4 +0 -0
- package/src/components/Video/assets/example.ogv +0 -0
- package/src/components/Video/assets/example.webm +0 -0
- package/src/components/Video/index.tsx +83 -36
- package/src/components/index.ts +7 -53
- package/src/custom.d.ts +14 -0
- package/src/documentation/Colours.mdx +33 -33
- package/src/documentation/Introduction.mdx +9 -5
- package/src/documentation/assets/index.ts +3 -0
- package/src/documentation/assets/trepurComponentsLogo.svg +32 -0
- package/src/{components → documentation}/typography/Fonts/Fonts.stories.tsx +1 -1
- package/src/{components → documentation}/typography/Fonts/Fonts.tsx +20 -21
- package/src/styles/global.css +1 -1
- package/src/styles/themes/local.css +61 -9
- package/src/styles/themes/test.css +28 -0
- package/src/utils/screens.ts +1 -1
- package/tailwind/colors.ts +53 -385
- package/tailwind/preset.ts +4 -0
- package/tailwind.config.ts +12 -80
- package/archive/theme.ts +0 -39
- package/lib/_virtual/react.js +0 -4
- package/lib/components/Accordion/Accordion.stories.d.ts +0 -95
- package/lib/components/Accordion/index.d.ts +0 -6
- package/lib/components/Accordion/index.js +0 -6
- package/lib/components/AlertBar/AlertBar.stories.d.ts +0 -163
- package/lib/components/AlertBar/index.d.ts +0 -12
- package/lib/components/AlertBar/index.js +0 -49
- package/lib/components/Avatar/Avatar.stories.d.ts +0 -44
- package/lib/components/Avatar/index.d.ts +0 -3
- package/lib/components/Breadcrumbs/Breadcrumbs.stories.d.ts +0 -62
- package/lib/components/Breadcrumbs/index.d.ts +0 -9
- package/lib/components/Breadcrumbs/index.js +0 -12
- package/lib/components/BreadcrumbsBordered/BreadcrumbsBordered.stories.d.ts +0 -67
- package/lib/components/BreadcrumbsBordered/index.d.ts +0 -6
- package/lib/components/BreadcrumbsBordered/index.js +0 -28
- package/lib/components/BreadcrumbsItem/BreadcrumbsItem.stories.d.ts +0 -74
- package/lib/components/BreadcrumbsItem/index.d.ts +0 -10
- package/lib/components/BreadcrumbsItem/index.js +0 -117
- package/lib/components/Button/Button.stories.d.ts +0 -192
- package/lib/components/Button/index.d.ts +0 -19
- package/lib/components/Button/index.js +0 -66
- package/lib/components/Calendar/Calendar.stories.d.ts +0 -136
- package/lib/components/Calendar/index.d.ts +0 -15
- package/lib/components/Calendar/index.js +0 -46
- package/lib/components/Calendar/style.css.js +0 -1
- package/lib/components/Card/Card.stories.d.ts +0 -108
- package/lib/components/Card/index.d.ts +0 -17
- package/lib/components/Card/index.js +0 -51
- package/lib/components/CardWithTopImage/CardWithTopImage.stories.d.ts +0 -83
- package/lib/components/CardWithTopImage/index.d.ts +0 -9
- package/lib/components/CardWithTopImage/index.js +0 -28
- package/lib/components/Carousel/Carousel.stories.d.ts +0 -562
- package/lib/components/Carousel/index.d.ts +0 -77
- package/lib/components/Carousel/index.js +0 -248
- package/lib/components/CarouselThumbnail/CarouselThumbnail.stories.d.ts +0 -546
- package/lib/components/CarouselThumbnail/index.d.ts +0 -50
- package/lib/components/CarouselThumbnail/index.js +0 -205
- package/lib/components/Checkbox/Checkbox.stories.d.ts +0 -52
- package/lib/components/Checkbox/index.d.ts +0 -7
- package/lib/components/Checkbox/index.js +0 -31
- package/lib/components/Collapsible/Collapsible.stories.d.ts +0 -82
- package/lib/components/Collapsible/index.d.ts +0 -12
- package/lib/components/Collapsible/index.js +0 -88
- package/lib/components/Column/Column.stories.d.ts +0 -116
- package/lib/components/Column/index.d.ts +0 -10
- package/lib/components/Column/index.js +0 -8
- package/lib/components/ComponentWrapper/ComponentWrapper.stories.d.ts +0 -77
- package/lib/components/ComponentWrapper/index.d.ts +0 -14
- package/lib/components/ComponentWrapper/index.js +0 -27
- package/lib/components/Container/Container.stories.d.ts +0 -75
- package/lib/components/Container/index.d.ts +0 -7
- package/lib/components/Container/index.js +0 -12
- package/lib/components/Counter/Counter.stories.d.ts +0 -45
- package/lib/components/Counter/index.d.ts +0 -6
- package/lib/components/Counter/index.js +0 -31
- package/lib/components/DetailUpdater/DetailUpdater.stories.d.ts +0 -104
- package/lib/components/DetailUpdater/index.d.ts +0 -18
- package/lib/components/DetailUpdater/index.js +0 -63
- package/lib/components/Dialog/Dialog.stories.d.ts +0 -145
- package/lib/components/Dialog/index.d.ts +0 -12
- package/lib/components/Dialog/index.js +0 -78
- package/lib/components/DropdownMenu/DropdownMenu.stories.d.ts +0 -76
- package/lib/components/DropdownMenu/index.d.ts +0 -14
- package/lib/components/DropdownMenu/index.js +0 -27
- package/lib/components/DynamicTextSection/DynamicTextSection.stories.d.ts +0 -100
- package/lib/components/DynamicTextSection/index.d.ts +0 -11
- package/lib/components/DynamicTextSection/index.js +0 -18
- package/lib/components/FileUploader/FilePreview.d.ts +0 -8
- package/lib/components/FileUploader/FileUploader.stories.d.ts +0 -50
- package/lib/components/FileUploader/index.d.ts +0 -9
- package/lib/components/FilterItem/FilterItem.stories.d.ts +0 -57
- package/lib/components/FilterItem/index.d.ts +0 -8
- package/lib/components/FilterItem/index.js +0 -60
- package/lib/components/Footer/Footer.stories.d.ts +0 -105
- package/lib/components/Footer/index.d.ts +0 -10
- package/lib/components/Footer/index.js +0 -36
- package/lib/components/FooterNav/FooterNav.stories.d.ts +0 -135
- package/lib/components/FooterNav/index.d.ts +0 -13
- package/lib/components/FooterNav/index.js +0 -28
- package/lib/components/FooterNavItem/FooterNavItem.stories.d.ts +0 -93
- package/lib/components/FooterNavItem/index.d.ts +0 -16
- package/lib/components/FooterNavItem/index.js +0 -27
- package/lib/components/Form/Form.stories.d.ts +0 -117
- package/lib/components/Form/index.d.ts +0 -13
- package/lib/components/Form/index.js +0 -28
- package/lib/components/FyreCard/FyreCard.stories.d.ts +0 -58
- package/lib/components/FyreCard/index.d.ts +0 -12
- package/lib/components/FyreCard/index.js +0 -27
- package/lib/components/Greeting/Greeting.stories.d.ts +0 -83
- package/lib/components/Greeting/index.d.ts +0 -8
- package/lib/components/Greeting/index.js +0 -13
- package/lib/components/HamburgerIcon/HamburgerIcon.stories.d.ts +0 -64
- package/lib/components/HamburgerIcon/index.d.ts +0 -7
- package/lib/components/HamburgerIcon/index.js +0 -93
- package/lib/components/HorizontalLine/HorizontalLine.stories.d.ts +0 -96
- package/lib/components/HorizontalLine/index.d.ts +0 -11
- package/lib/components/HorizontalLine/index.js +0 -24
- package/lib/components/Icon/Icon.stories.d.ts +0 -47
- package/lib/components/Icon/index.d.ts +0 -10
- package/lib/components/Icon/index.js +0 -15
- package/lib/components/IconCard/IconCard.stories.d.ts +0 -51
- package/lib/components/IconCard/index.d.ts +0 -13
- package/lib/components/IconCard/index.js +0 -27
- package/lib/components/Image/Image.stories.d.ts +0 -158
- package/lib/components/Image/index.d.ts +0 -15
- package/lib/components/Image/index.js +0 -99
- package/lib/components/ImageInfo/ImageInfo.stories.d.ts +0 -69
- package/lib/components/ImageInfo/index.d.ts +0 -14
- package/lib/components/ImageLink/ImageLink.stories.d.ts +0 -63
- package/lib/components/ImageLink/index.d.ts +0 -14
- package/lib/components/ImageLink/index.js +0 -39
- package/lib/components/ImageLinkList/ImageLinkList.stories.d.ts +0 -48
- package/lib/components/ImageLinkList/index.d.ts +0 -8
- package/lib/components/ImageLinkList/index.js +0 -18
- package/lib/components/InformationIcon/InformationIcon.stories.d.ts +0 -54
- package/lib/components/InformationIcon/index.d.ts +0 -12
- package/lib/components/InformationIcon/index.js +0 -65
- package/lib/components/InformationIconBlock/InformationIconBlock.stories.d.ts +0 -55
- package/lib/components/InformationIconBlock/index.d.ts +0 -12
- package/lib/components/Input/Input.stories.d.ts +0 -114
- package/lib/components/Input/index.d.ts +0 -29
- package/lib/components/Input/index.js +0 -89
- package/lib/components/Jumbotron/Jumbotron.stories.d.ts +0 -48
- package/lib/components/Jumbotron/index.d.ts +0 -8
- package/lib/components/Jumbotron/index.js +0 -9
- package/lib/components/MenuButton/MenuButton.stories.d.ts +0 -76
- package/lib/components/MenuButton/index.d.ts +0 -14
- package/lib/components/MenuButton/index.js +0 -56
- package/lib/components/Modal/Modal.stories.d.ts +0 -67
- package/lib/components/Modal/index.d.ts +0 -10
- package/lib/components/Modal/index.js +0 -45
- package/lib/components/NavItem/NavItem.stories.d.ts +0 -154
- package/lib/components/NavItem/index.d.ts +0 -16
- package/lib/components/NavItem/index.js +0 -25
- package/lib/components/NavOld/NavOld.stories.d.ts +0 -290
- package/lib/components/NavOld/StickyNav.d.ts +0 -22
- package/lib/components/NavOld/StickyNav.js +0 -135
- package/lib/components/NavOld/index.d.ts +0 -26
- package/lib/components/NavOld/index.js +0 -187
- package/lib/components/NavTwo/Dropdown.d.ts +0 -7
- package/lib/components/NavTwo/Dropdown.js +0 -21
- package/lib/components/NavTwo/Nav.stories.d.ts +0 -62
- package/lib/components/NavTwo/Sidebar.d.ts +0 -7
- package/lib/components/NavTwo/Sidebar.js +0 -21
- package/lib/components/NavTwo/StickyNav.d.ts +0 -7
- package/lib/components/NavTwo/StickyNav.js +0 -20
- package/lib/components/NavTwo/index.d.ts +0 -13
- package/lib/components/NavTwo/index.js +0 -28
- package/lib/components/NewsCard/NewsCard.stories.d.ts +0 -102
- package/lib/components/NewsCard/index.d.ts +0 -13
- package/lib/components/NewsCard/index.js +0 -26
- package/lib/components/Pill/Pill.stories.d.ts +0 -84
- package/lib/components/Pill/index.d.ts +0 -8
- package/lib/components/Pill/index.js +0 -31
- package/lib/components/ProductCard/ProductCard.stories.d.ts +0 -86
- package/lib/components/ProductCard/index.d.ts +0 -18
- package/lib/components/ProductCard/index.js +0 -69
- package/lib/components/ProductCardV2/ProductCardV2.stories.d.ts +0 -75
- package/lib/components/ProductCardV2/index.d.ts +0 -21
- package/lib/components/ProductCardV2/index.js +0 -67
- package/lib/components/Proficiencies/Proficiencies.stories.d.ts +0 -51
- package/lib/components/Proficiencies/index.d.ts +0 -12
- package/lib/components/Profile/Profile.stories.d.ts +0 -80
- package/lib/components/Profile/index.d.ts +0 -17
- package/lib/components/Profile/index.js +0 -78
- package/lib/components/Row/Row.stories.d.ts +0 -62
- package/lib/components/Row/index.d.ts +0 -6
- package/lib/components/Row/index.js +0 -9
- package/lib/components/Search/Search.stories.d.ts +0 -86
- package/lib/components/Search/index.d.ts +0 -12
- package/lib/components/Search/index.js +0 -42
- package/lib/components/Select/Select.stories.d.ts +0 -56
- package/lib/components/Select/index.d.ts +0 -11
- package/lib/components/Select/index.js +0 -68
- package/lib/components/Showcase/Showcase.stories.d.ts +0 -55
- package/lib/components/Showcase/index.d.ts +0 -15
- package/lib/components/SideNav/SideNav.stories.d.ts +0 -80
- package/lib/components/SideNav/index.d.ts +0 -12
- package/lib/components/SocialBlock/SocialBlock.stories.d.ts +0 -101
- package/lib/components/SocialBlock/index.d.ts +0 -14
- package/lib/components/SocialBlock/index.js +0 -37
- package/lib/components/SocialButton/SocialButton.stories.d.ts +0 -130
- package/lib/components/SocialButton/index.d.ts +0 -12
- package/lib/components/SocialButton/index.js +0 -37
- package/lib/components/StarRating/StarRating.stories.d.ts +0 -49
- package/lib/components/StarRating/index.d.ts +0 -9
- package/lib/components/StarRating/index.js +0 -47
- package/lib/components/Testimonial/Testimonial.stories.d.ts +0 -172
- package/lib/components/Testimonial/index.d.ts +0 -16
- package/lib/components/Testimonial/index.js +0 -42
- package/lib/components/TextAndTitle/TextAndTitle.stories.d.ts +0 -97
- package/lib/components/TextAndTitle/index.d.ts +0 -25
- package/lib/components/TextAndTitle/index.js +0 -70
- package/lib/components/TextArea/TextArea.stories.d.ts +0 -85
- package/lib/components/TextArea/index.d.ts +0 -26
- package/lib/components/TextArea/index.js +0 -86
- package/lib/components/Timeline/Timeline.stories.d.ts +0 -81
- package/lib/components/Timeline/index.d.ts +0 -17
- package/lib/components/Timeline/index.js +0 -172
- package/lib/components/TimelineV2/TimelineV2.stories.d.ts +0 -87
- package/lib/components/TimelineV2/index.d.ts +0 -20
- package/lib/components/Tubestops/Tubestops.stories.d.ts +0 -54
- package/lib/components/Tubestops/index.d.ts +0 -8
- package/lib/components/Tubestops/index.js +0 -44
- package/lib/components/UserIcon/UserIcon.stories.d.ts +0 -81
- package/lib/components/UserIcon/index.d.ts +0 -10
- package/lib/components/UserIcon/index.js +0 -34
- package/lib/components/Video/Video.stories.d.ts +0 -49
- package/lib/components/Video/index.d.ts +0 -15
- package/lib/components/Video/index.js +0 -34
- package/lib/components/index.d.ts +0 -60
- package/lib/components/typography/Fonts/Fonts.d.ts +0 -2
- package/lib/components/typography/Fonts/Fonts.stories.d.ts +0 -10
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -118
- package/lib/node_modules/keen-slider/keen-slider.min.css.js +0 -1
- package/lib/node_modules/keen-slider/react.js +0 -591
- package/lib/style.css +0 -1
- package/lib/styles/global.css +0 -75
- package/lib/styles/themes/local.css +0 -40
- package/lib/styles/themes/palette.css +0 -131
- package/lib/tailwind/boxShadow.ts +0 -9
- package/lib/tailwind/colors.ts +0 -410
- package/lib/tailwind/container.ts +0 -11
- package/lib/tailwind/preset.ts +0 -88
- package/lib/tailwind/spacing.ts +0 -14
- package/lib/utils/controls.d.ts +0 -36
- package/lib/utils/matchMedia.d.ts +0 -2
- package/lib/utils/matchMedia.js +0 -9
- package/lib/utils/screens.d.ts +0 -7
- package/src/components/BreadcrumbsBordered/BreadcrumbsBordered.stories.tsx +0 -52
- package/src/components/BreadcrumbsBordered/index.tsx +0 -41
- package/src/components/BreadcrumbsItem/BreadcrumbsItem.stories.tsx +0 -40
- package/src/components/BreadcrumbsItem/index.tsx +0 -147
- package/src/components/CardWithTopImage/CardWithTopImage.stories.tsx +0 -50
- package/src/components/CardWithTopImage/index.tsx +0 -35
- package/src/components/Column/Column.stories.tsx +0 -89
- package/src/components/Column/index.tsx +0 -18
- package/src/components/ComponentWrapper/ComponentWrapper.stories.tsx +0 -40
- package/src/components/ComponentWrapper/index.tsx +0 -48
- package/src/components/Container/Container.stories.tsx +0 -40
- package/src/components/Container/index.tsx +0 -21
- package/src/components/DropdownMenu/DropdownMenu.stories.tsx +0 -59
- package/src/components/DropdownMenu/index.tsx +0 -45
- package/src/components/DynamicTextSection/DynamicTextSection.stories.tsx +0 -76
- package/src/components/DynamicTextSection/index.tsx +0 -32
- package/src/components/FilterItem/FilterItem.stories.tsx +0 -33
- package/src/components/FilterItem/index.tsx +0 -97
- package/src/components/FooterNavItem/FooterNavItem.stories.tsx +0 -53
- package/src/components/FooterNavItem/index.tsx +0 -58
- package/src/components/Form/style.module.css +0 -0
- package/src/components/FyreCard/FyreCard.stories.tsx +0 -31
- package/src/components/FyreCard/index.tsx +0 -44
- package/src/components/HorizontalLine/HorizontalLine.stories.tsx +0 -54
- package/src/components/HorizontalLine/index.tsx +0 -32
- package/src/components/IconCard/IconCard.stories.tsx +0 -26
- package/src/components/IconCard/index.tsx +0 -54
- package/src/components/ImageInfo/ImageInfo.stories.tsx +0 -38
- package/src/components/ImageInfo/index.tsx +0 -84
- package/src/components/ImageLink/ImageLink.stories.tsx +0 -36
- package/src/components/ImageLink/index.tsx +0 -58
- package/src/components/ImageLinkList/ImageLinkList.stories.tsx +0 -34
- package/src/components/ImageLinkList/index.tsx +0 -28
- package/src/components/InformationIcon/InformationIcon.stories.tsx +0 -29
- package/src/components/InformationIcon/index.tsx +0 -105
- package/src/components/InformationIconBlock/InformationIconBlock.stories.tsx +0 -38
- package/src/components/InformationIconBlock/index.tsx +0 -56
- package/src/components/Jumbotron/Jumbotron.stories.tsx +0 -21
- package/src/components/Jumbotron/index.tsx +0 -19
- package/src/components/NavOld/NavOld.stories.tsx +0 -193
- package/src/components/NavOld/StickyNav.tsx +0 -187
- package/src/components/NavOld/index.tsx +0 -265
- package/src/components/NavTwo/Dropdown.tsx +0 -30
- package/src/components/NavTwo/Nav.stories.tsx +0 -32
- package/src/components/NavTwo/Sidebar.tsx +0 -30
- package/src/components/NavTwo/StickyNav.tsx +0 -29
- package/src/components/NavTwo/index.tsx +0 -37
- package/src/components/NewsCard/NewsCard.stories.tsx +0 -72
- package/src/components/NewsCard/index.tsx +0 -44
- package/src/components/ProductCard/ProductCard.stories.tsx +0 -61
- package/src/components/ProductCard/index.tsx +0 -110
- package/src/components/ProductCardV2/ProductCardV2.stories.tsx +0 -50
- package/src/components/ProductCardV2/index.tsx +0 -98
- package/src/components/Proficiencies/Proficiencies.stories.tsx +0 -50
- package/src/components/Proficiencies/index.tsx +0 -51
- package/src/components/Profile/Profile.stories.tsx +0 -49
- package/src/components/Profile/index.tsx +0 -103
- package/src/components/Row/Row.stories.tsx +0 -53
- package/src/components/Row/index.tsx +0 -17
- package/src/components/SocialBlock/SocialBlock.stories.tsx +0 -58
- package/src/components/SocialBlock/index.tsx +0 -59
- package/src/components/StarRating/StarRating.stories.tsx +0 -23
- package/src/components/StarRating/index.tsx +0 -65
- package/src/components/TextAndTitle/TextAndTitle.stories.tsx +0 -71
- package/src/components/TextAndTitle/index.tsx +0 -119
- package/src/components/TimelineV2/TimelineV2.stories.tsx +0 -95
- package/src/components/TimelineV2/index.tsx +0 -70
- package/src/components/UserIcon/UserIcon.stories.tsx +0 -52
- package/src/components/UserIcon/index.tsx +0 -43
- package/src/styles/themes/palette.css +0 -131
- package/svg.d.ts +0 -4
- /package/src/{components/fonts → fonts}/Sora/OFL.txt +0 -0
- /package/src/{components/fonts → fonts}/Sora/README.txt +0 -0
- /package/src/{components/fonts → fonts}/Sora/Sora-VariableFont_wght.ttf +0 -0
- /package/src/{components/fonts → fonts}/Sora/static/Sora-Bold.ttf +0 -0
- /package/src/{components/fonts → fonts}/Sora/static/Sora-ExtraBold.ttf +0 -0
- /package/src/{components/fonts → fonts}/Sora/static/Sora-ExtraLight.ttf +0 -0
- /package/src/{components/fonts → fonts}/Sora/static/Sora-Light.ttf +0 -0
- /package/src/{components/fonts → fonts}/Sora/static/Sora-Medium.ttf +0 -0
- /package/src/{components/fonts → fonts}/Sora/static/Sora-Regular.ttf +0 -0
- /package/src/{components/fonts → fonts}/Sora/static/Sora-SemiBold.ttf +0 -0
- /package/src/{components/fonts → fonts}/Sora/static/Sora-Thin.ttf +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
|
|
3
3
|
import { action } from '@storybook/addon-actions';
|
|
4
|
+
import { Meta } from '@storybook/react';
|
|
4
5
|
|
|
5
6
|
import { Dialog } from '.';
|
|
6
7
|
import { Button } from '../Button';
|
|
@@ -9,72 +10,6 @@ import { Modal } from '../Modal';
|
|
|
9
10
|
const meta = {
|
|
10
11
|
title: 'Components/Dialog',
|
|
11
12
|
component: Dialog,
|
|
12
|
-
parameters: {
|
|
13
|
-
docs: {
|
|
14
|
-
description: {
|
|
15
|
-
component: 'A dialog component',
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
layout: 'padded',
|
|
19
|
-
},
|
|
20
|
-
argTypes: {
|
|
21
|
-
id: {
|
|
22
|
-
type: { name: 'string', required: false },
|
|
23
|
-
description: 'HTML id attribute',
|
|
24
|
-
table: { type: { summary: 'string' } },
|
|
25
|
-
},
|
|
26
|
-
className: {
|
|
27
|
-
type: { name: 'string', required: false },
|
|
28
|
-
description: 'Additional classes to be appended to the component',
|
|
29
|
-
table: { type: { summary: 'string' } },
|
|
30
|
-
},
|
|
31
|
-
onDismissClick: {
|
|
32
|
-
type: { name: 'function', required: false },
|
|
33
|
-
description:
|
|
34
|
-
'Used to determine the onClick action when the dismiss cta is pressed',
|
|
35
|
-
action: 'onClick',
|
|
36
|
-
table: {
|
|
37
|
-
type: { summary: 'function' },
|
|
38
|
-
defaultValue: { summary: 'undefined' },
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
title: {
|
|
42
|
-
type: { name: 'string', required: false },
|
|
43
|
-
description: 'Used to specify the title to display on the component',
|
|
44
|
-
table: {
|
|
45
|
-
type: { summary: 'string' },
|
|
46
|
-
defaultValue: { summary: 'undefined' },
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
paragraph: {
|
|
50
|
-
type: { name: 'string', required: false },
|
|
51
|
-
description:
|
|
52
|
-
'Used to the specify paragraph text to display on the component',
|
|
53
|
-
table: {
|
|
54
|
-
type: { summary: 'string' },
|
|
55
|
-
defaultValue: { summary: 'undefined' },
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
dismissText: {
|
|
59
|
-
type: { name: 'string', required: false },
|
|
60
|
-
description: 'Used to specify dismiss text to display on the component',
|
|
61
|
-
table: {
|
|
62
|
-
type: { summary: 'string' },
|
|
63
|
-
defaultValue: { summary: 'undefined' },
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
primaryCta: {
|
|
67
|
-
type: { name: 'other', value: 'ButtonProps', required: false },
|
|
68
|
-
description: 'A collection of props to pass to the button component',
|
|
69
|
-
table: { type: { summary: 'ButtonProps' } },
|
|
70
|
-
},
|
|
71
|
-
secondaryCta: {
|
|
72
|
-
type: { name: 'other', value: 'ButtonProps', required: false },
|
|
73
|
-
description:
|
|
74
|
-
'A collection of props to pass to the second button component',
|
|
75
|
-
table: { type: { summary: 'ButtonProps' } },
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
13
|
args: {
|
|
79
14
|
title: 'This is a title',
|
|
80
15
|
paragraph:
|
|
@@ -82,17 +17,17 @@ const meta = {
|
|
|
82
17
|
dismissText: 'Close',
|
|
83
18
|
imageUrl: 'https://picsum.photos/500/300',
|
|
84
19
|
onDismissClick: action('dismissed'),
|
|
85
|
-
primaryCta: {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
secondaryCta: {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
20
|
+
// primaryCta: {
|
|
21
|
+
// children: 'Add bank details',
|
|
22
|
+
// palette: 'secondary',
|
|
23
|
+
// },
|
|
24
|
+
// secondaryCta: {
|
|
25
|
+
// children: 'Add bank details',
|
|
26
|
+
// variant: 'secondary',
|
|
27
|
+
// palette: 'secondary',
|
|
28
|
+
// },
|
|
29
|
+
},
|
|
30
|
+
} satisfies Meta<typeof Dialog>;
|
|
96
31
|
|
|
97
32
|
const Template = (args: any): React.ReactElement => {
|
|
98
33
|
const [visible, setVisible] = useState<boolean>(false);
|
|
@@ -123,7 +58,7 @@ const Template = (args: any): React.ReactElement => {
|
|
|
123
58
|
</Modal>
|
|
124
59
|
</div>
|
|
125
60
|
);
|
|
126
|
-
}
|
|
61
|
+
};
|
|
127
62
|
|
|
128
63
|
export const _Dialog = Template.bind({});
|
|
129
64
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { Button,
|
|
1
|
+
import { Button, ButtonProps } from '@components/Button';
|
|
2
2
|
import { Image } from '@components/Image';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
|
|
5
|
+
import { Card } from '..';
|
|
6
|
+
|
|
5
7
|
export interface Props extends Partial<Pick<HTMLElement, 'className' | 'id'>> {
|
|
6
8
|
title: string;
|
|
7
9
|
paragraph: string;
|
|
@@ -23,71 +25,5 @@ export const Dialog = ({
|
|
|
23
25
|
secondaryCta,
|
|
24
26
|
imageUrl,
|
|
25
27
|
}: Props) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const ctaButton = hasCta && (
|
|
30
|
-
<Button
|
|
31
|
-
{...primaryCta}
|
|
32
|
-
className={classNames(
|
|
33
|
-
{
|
|
34
|
-
'w-full': hasCta2,
|
|
35
|
-
},
|
|
36
|
-
primaryCta?.className,
|
|
37
|
-
'mt-2 w-full md:ml-6 md:mt-0',
|
|
38
|
-
)}
|
|
39
|
-
/>
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
const ctaButton2 = hasCta2 && (
|
|
43
|
-
<Button
|
|
44
|
-
{...secondaryCta}
|
|
45
|
-
className={classNames(
|
|
46
|
-
{
|
|
47
|
-
'w-full': hasCta,
|
|
48
|
-
},
|
|
49
|
-
secondaryCta?.className,
|
|
50
|
-
'mt-2 w-full md:ml-6 md:mt-0',
|
|
51
|
-
)}
|
|
52
|
-
/>
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
const buttonWrapperClassList = classNames(
|
|
56
|
-
{
|
|
57
|
-
'w-full': ctaButton2,
|
|
58
|
-
},
|
|
59
|
-
'flex flex-wrap pt-6 md:flex-nowrap',
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
const titleClassList = classNames({}, 'text-md font-regular');
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<div
|
|
66
|
-
id={id}
|
|
67
|
-
className={classNames(
|
|
68
|
-
className,
|
|
69
|
-
'mx-auto w-full rounded-xl bg-white p-6 text-ink md:w-[608px]',
|
|
70
|
-
)}
|
|
71
|
-
>
|
|
72
|
-
<div className="relative pb-2">
|
|
73
|
-
{imageUrl !== undefined && (
|
|
74
|
-
<Image src={imageUrl} height={3} width={3} />
|
|
75
|
-
)}
|
|
76
|
-
<p
|
|
77
|
-
className="absolute right-0 top-0 cursor-pointer text-sm font-regular"
|
|
78
|
-
onClick={onDismissClick}
|
|
79
|
-
>
|
|
80
|
-
{dismissText}
|
|
81
|
-
</p>
|
|
82
|
-
</div>
|
|
83
|
-
<p className={titleClassList}>{title}</p>
|
|
84
|
-
<p className="pt-1 font-light">{paragraph}</p>
|
|
85
|
-
{(hasCta || hasCta2) && (
|
|
86
|
-
<div className={buttonWrapperClassList}>
|
|
87
|
-
{ctaButton}
|
|
88
|
-
{ctaButton2}
|
|
89
|
-
</div>
|
|
90
|
-
)}
|
|
91
|
-
</div>
|
|
92
|
-
);
|
|
93
|
-
}
|
|
28
|
+
return <Card className="max-w-[600px]"></Card>;
|
|
29
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Dropdown } from './';
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'V2Components/Dropdown',
|
|
6
|
+
component: Dropdown,
|
|
7
|
+
args: {
|
|
8
|
+
children: [
|
|
9
|
+
<Dropdown.Label>Label</Dropdown.Label>,
|
|
10
|
+
<Dropdown.List>
|
|
11
|
+
<Dropdown.Item>Item 1</Dropdown.Item>
|
|
12
|
+
<Dropdown.Item>Item 2</Dropdown.Item>
|
|
13
|
+
</Dropdown.List>,
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
} satisfies Meta<typeof Dropdown>;
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
|
|
20
|
+
type Story = StoryObj<typeof Dropdown>;
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useState,
|
|
3
|
+
forwardRef,
|
|
4
|
+
HTMLAttributes,
|
|
5
|
+
useContext,
|
|
6
|
+
createContext,
|
|
7
|
+
useMemo,
|
|
8
|
+
useRef,
|
|
9
|
+
} from 'react';
|
|
10
|
+
|
|
11
|
+
import { Button } from '../';
|
|
12
|
+
import { ButtonProps } from '@components/Button';
|
|
13
|
+
import { faChevronDown } from '@fortawesome/fontawesome-free-solid';
|
|
14
|
+
|
|
15
|
+
import { useClickOutside } from './utils';
|
|
16
|
+
|
|
17
|
+
export interface DropdownContextProps {
|
|
18
|
+
showDropdown?: boolean;
|
|
19
|
+
setShowDropdown?: (val: boolean) => void;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const DropdownContext = createContext<DropdownContextProps | null>(null);
|
|
23
|
+
|
|
24
|
+
const DropdownComponent = forwardRef<
|
|
25
|
+
HTMLDivElement,
|
|
26
|
+
HTMLAttributes<HTMLDivElement>
|
|
27
|
+
>(({ children }) => {
|
|
28
|
+
const [showDropdown, setShowDropdown] = useState(false);
|
|
29
|
+
const ref = useRef<HTMLDivElement>(null);
|
|
30
|
+
|
|
31
|
+
const state = useMemo(
|
|
32
|
+
() => ({
|
|
33
|
+
showDropdown,
|
|
34
|
+
setShowDropdown,
|
|
35
|
+
}),
|
|
36
|
+
[showDropdown, setShowDropdown],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
useClickOutside(ref, () => {
|
|
40
|
+
setShowDropdown(false);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<DropdownContext.Provider value={state}>
|
|
45
|
+
<div ref={ref} className="relative inline-block text-left">
|
|
46
|
+
{children}
|
|
47
|
+
</div>
|
|
48
|
+
</DropdownContext.Provider>
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const DropdownLabel = forwardRef<
|
|
53
|
+
HTMLButtonElement,
|
|
54
|
+
HTMLAttributes<HTMLButtonElement> & ButtonProps
|
|
55
|
+
>(({ children }) => {
|
|
56
|
+
const { showDropdown, setShowDropdown } = useContext(DropdownContext) || {};
|
|
57
|
+
return (
|
|
58
|
+
<Button onClick={() => setShowDropdown?.(!showDropdown)}>
|
|
59
|
+
{children}
|
|
60
|
+
<Button.Icon icon={faChevronDown} />
|
|
61
|
+
</Button>
|
|
62
|
+
);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
const DropdownList = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
|
|
66
|
+
({ children }) => {
|
|
67
|
+
const { showDropdown } = useContext(DropdownContext) || {};
|
|
68
|
+
if (!showDropdown) return <div></div>;
|
|
69
|
+
return (
|
|
70
|
+
<div
|
|
71
|
+
className="z-50 mt-2 w-48 rounded-lg border-2 bg-primary text-white"
|
|
72
|
+
role="menu"
|
|
73
|
+
aria-orientation="vertical"
|
|
74
|
+
aria-labelledby="menu-button"
|
|
75
|
+
>
|
|
76
|
+
<ul className="py-1 text-sm">{children}</ul>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
},
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const DropdownItem = forwardRef<HTMLLIElement, HTMLAttributes<HTMLLIElement>>(
|
|
83
|
+
({ children, onClick }) => {
|
|
84
|
+
const { showDropdown, setShowDropdown } = useContext(DropdownContext) || {};
|
|
85
|
+
return (
|
|
86
|
+
<li
|
|
87
|
+
className="px-4 py-2"
|
|
88
|
+
onClick={(e) => {
|
|
89
|
+
const target = e?.target as HTMLElement;
|
|
90
|
+
// onClick?.(target?.parentNode?.textContent ?? '');
|
|
91
|
+
setShowDropdown?.(false);
|
|
92
|
+
}}
|
|
93
|
+
onKeyDown={(e) => {
|
|
94
|
+
if (e.key === 'Enter') {
|
|
95
|
+
const target = e?.target as HTMLElement;
|
|
96
|
+
// onClick?.(target?.parentNode?.textContent ?? '');
|
|
97
|
+
}
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
{children}
|
|
101
|
+
</li>
|
|
102
|
+
);
|
|
103
|
+
},
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
DropdownComponent.displayName = 'Dropdown';
|
|
107
|
+
DropdownLabel.displayName = 'Dropdown.Label';
|
|
108
|
+
DropdownList.displayName = 'Dropdown.List';
|
|
109
|
+
DropdownItem.displayName = 'Dropdown.Item';
|
|
110
|
+
|
|
111
|
+
const Dropdown = Object.assign(DropdownComponent, {
|
|
112
|
+
Label: DropdownLabel,
|
|
113
|
+
List: DropdownList,
|
|
114
|
+
Item: DropdownItem,
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
export { Dropdown };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
export function useClickOutside(ref: any, onClickOutside: () => void) {
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
function handleClickOutside(event: MouseEvent) {
|
|
6
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
7
|
+
onClickOutside();
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
11
|
+
return () => {
|
|
12
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
13
|
+
};
|
|
14
|
+
}, [ref, onClickOutside]);
|
|
15
|
+
}
|
|
@@ -15,7 +15,7 @@ export const FilePreview = ({
|
|
|
15
15
|
}: FilePreviewProps) => {
|
|
16
16
|
const handleDismiss = (fileName: string): void => {
|
|
17
17
|
onDismiss?.(fileName);
|
|
18
|
-
}
|
|
18
|
+
};
|
|
19
19
|
|
|
20
20
|
return (
|
|
21
21
|
<ul
|
|
@@ -42,4 +42,4 @@ export const FilePreview = ({
|
|
|
42
42
|
})}
|
|
43
43
|
</ul>
|
|
44
44
|
);
|
|
45
|
-
}
|
|
45
|
+
};
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { FileUploader } from './';
|
|
2
2
|
import { action } from '@storybook/addon-actions';
|
|
3
|
-
import { Meta,
|
|
3
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
4
4
|
import { idAndClassName } from '@utils/controls';
|
|
5
5
|
|
|
6
6
|
const meta = {
|
|
7
|
-
title: '
|
|
7
|
+
title: 'V2Components/FileUploader',
|
|
8
8
|
component: FileUploader,
|
|
9
9
|
argTypes: {
|
|
10
10
|
...idAndClassName,
|
|
11
11
|
},
|
|
12
12
|
args: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
children: [
|
|
14
|
+
<FileUploader.Input>You can select multiple Files</FileUploader.Input>,
|
|
15
|
+
<FileUploader.Text>or drag & drop your files here</FileUploader.Text>,
|
|
16
|
+
<FileUploader.FilePreview />,
|
|
17
|
+
],
|
|
16
18
|
onDrop: (files: any) => {
|
|
17
19
|
action('files:')(files[0].name);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
} satisfies Meta<typeof FileUploader>;
|
|
21
23
|
|
|
22
24
|
export default meta;
|
|
23
25
|
|
|
@@ -1,55 +1,61 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
forwardRef,
|
|
4
|
+
HTMLAttributes,
|
|
5
|
+
useContext,
|
|
6
|
+
useMemo,
|
|
7
|
+
useState,
|
|
8
|
+
} from 'react';
|
|
5
9
|
|
|
6
10
|
import { FilePreview } from './FilePreview';
|
|
7
11
|
|
|
8
|
-
export interface
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
onDrop?: ([]) => void;
|
|
12
|
+
export interface FileUploaderContextProps {
|
|
13
|
+
fileList?: any;
|
|
14
|
+
setFileList: (open: any) => void;
|
|
15
|
+
inDropZone?: boolean;
|
|
16
|
+
setInDropZone?: (val: boolean) => void;
|
|
17
|
+
onDrop: React.DragEventHandler<HTMLDivElement> | undefined;
|
|
15
18
|
}
|
|
16
19
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
20
|
+
const FileUploaderContext = createContext<FileUploaderContextProps | null>(
|
|
21
|
+
null,
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const FileUploaderComponent = forwardRef<
|
|
25
|
+
HTMLDivElement,
|
|
26
|
+
HTMLAttributes<HTMLDivElement> & FileUploaderContextProps
|
|
27
|
+
>(({ children, onDrop }, ref) => {
|
|
25
28
|
const [inDropZone, setInDropZone] = useState(false);
|
|
26
29
|
const [fileList, setFileList] = useState<any>([]);
|
|
27
30
|
|
|
28
|
-
const
|
|
29
|
-
{
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const state = useMemo(
|
|
32
|
+
() => ({
|
|
33
|
+
onDrop,
|
|
34
|
+
inDropZone,
|
|
35
|
+
setInDropZone,
|
|
36
|
+
fileList,
|
|
37
|
+
setFileList,
|
|
38
|
+
}),
|
|
39
|
+
[inDropZone, setInDropZone, fileList, setFileList, onDrop],
|
|
40
|
+
);
|
|
35
41
|
|
|
36
42
|
const handleDragEnter = (e: any): void => {
|
|
37
43
|
e.preventDefault();
|
|
38
44
|
e.stopPropagation();
|
|
39
45
|
setInDropZone(true);
|
|
40
|
-
}
|
|
46
|
+
};
|
|
41
47
|
|
|
42
48
|
const handleDragLeave = (e: any): void => {
|
|
43
49
|
e.preventDefault();
|
|
44
50
|
e.stopPropagation();
|
|
45
51
|
setInDropZone(false);
|
|
46
|
-
}
|
|
52
|
+
};
|
|
47
53
|
|
|
48
54
|
const handleDragOver = (e: any): void => {
|
|
49
55
|
e.preventDefault();
|
|
50
56
|
e.stopPropagation();
|
|
51
57
|
setInDropZone(true);
|
|
52
|
-
}
|
|
58
|
+
};
|
|
53
59
|
|
|
54
60
|
const handleDrop = (e: any): void => {
|
|
55
61
|
e.preventDefault();
|
|
@@ -64,8 +70,39 @@ export const FileUploader = ({
|
|
|
64
70
|
setFileList(files);
|
|
65
71
|
setInDropZone(false);
|
|
66
72
|
}
|
|
67
|
-
onDrop?.(files);
|
|
68
|
-
}
|
|
73
|
+
onDrop?.(files[0]);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<FileUploaderContext.Provider value={state}>
|
|
78
|
+
<div
|
|
79
|
+
ref={ref}
|
|
80
|
+
className="flex flex-col items-center justify-center rounded-2xl border-4 border-dashed border-primary py-8"
|
|
81
|
+
onDragEnter={(e) => {
|
|
82
|
+
handleDragEnter(e);
|
|
83
|
+
}}
|
|
84
|
+
onDragOver={(e) => {
|
|
85
|
+
handleDragOver(e);
|
|
86
|
+
}}
|
|
87
|
+
onDragLeave={(e) => {
|
|
88
|
+
handleDragLeave(e);
|
|
89
|
+
}}
|
|
90
|
+
onDrop={(e) => {
|
|
91
|
+
handleDrop(e);
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
{children}
|
|
95
|
+
</div>
|
|
96
|
+
</FileUploaderContext.Provider>
|
|
97
|
+
);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const FileUploaderInput = forwardRef<
|
|
101
|
+
HTMLDivElement,
|
|
102
|
+
HTMLAttributes<HTMLDivElement>
|
|
103
|
+
>(({ children }, ref) => {
|
|
104
|
+
const { onDrop, fileList, setFileList } =
|
|
105
|
+
useContext(FileUploaderContext) || {};
|
|
69
106
|
|
|
70
107
|
const handleFileSelect = (e: any): void => {
|
|
71
108
|
let files = [...e.target.files];
|
|
@@ -73,36 +110,13 @@ export const FileUploader = ({
|
|
|
73
110
|
if (files?.length > 0) {
|
|
74
111
|
const existingFiles = fileList?.fileList?.map((f: any) => f.name);
|
|
75
112
|
files = files.filter((f) => !existingFiles?.includes(f.name));
|
|
76
|
-
setFileList(files);
|
|
77
|
-
onDrop?.(files);
|
|
113
|
+
setFileList?.(files);
|
|
114
|
+
onDrop?.(files[0]);
|
|
78
115
|
}
|
|
79
116
|
};
|
|
80
117
|
|
|
81
|
-
const handleDismiss = (fileName: string): void => {
|
|
82
|
-
setFileList(fileList.filter((file: any) => file.name !== fileName));
|
|
83
|
-
}
|
|
84
|
-
|
|
85
118
|
return (
|
|
86
|
-
<div
|
|
87
|
-
id={id}
|
|
88
|
-
className={classList}
|
|
89
|
-
onDragEnter={(e) => {
|
|
90
|
-
handleDragEnter(e);
|
|
91
|
-
}}
|
|
92
|
-
onDragOver={(e) => {
|
|
93
|
-
handleDragOver(e);
|
|
94
|
-
}}
|
|
95
|
-
onDragLeave={(e) => {
|
|
96
|
-
handleDragLeave(e);
|
|
97
|
-
}}
|
|
98
|
-
onDrop={(e) => {
|
|
99
|
-
handleDrop(e);
|
|
100
|
-
}}
|
|
101
|
-
>
|
|
102
|
-
{imageUrl && (
|
|
103
|
-
<Image src={imageUrl} altText="upload" height={5} width={5} />
|
|
104
|
-
)}
|
|
105
|
-
|
|
119
|
+
<div ref={ref}>
|
|
106
120
|
<input
|
|
107
121
|
id="fileSelect"
|
|
108
122
|
type="file"
|
|
@@ -112,21 +126,52 @@ export const FileUploader = ({
|
|
|
112
126
|
handleFileSelect(e);
|
|
113
127
|
}}
|
|
114
128
|
/>
|
|
115
|
-
|
|
116
129
|
<label
|
|
117
130
|
className="mb-2 mt-4 inline-block cursor-pointer text-center"
|
|
118
131
|
htmlFor="fileSelect"
|
|
119
132
|
>
|
|
120
|
-
{
|
|
133
|
+
{children}
|
|
121
134
|
</label>
|
|
122
|
-
|
|
123
|
-
<h3 className="mt-8">{text}</h3>
|
|
124
|
-
<FilePreview
|
|
125
|
-
fileData={fileList}
|
|
126
|
-
onDismiss={(e: any) => {
|
|
127
|
-
handleDismiss(e);
|
|
128
|
-
}}
|
|
129
|
-
/>
|
|
130
135
|
</div>
|
|
131
136
|
);
|
|
132
|
-
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const FileUploaderFilePreview = forwardRef<
|
|
140
|
+
HTMLDivElement,
|
|
141
|
+
HTMLAttributes<HTMLDivElement>
|
|
142
|
+
>(() => {
|
|
143
|
+
const { fileList, setFileList } = useContext(FileUploaderContext) || {};
|
|
144
|
+
|
|
145
|
+
const handleDismiss = (fileName: string): void => {
|
|
146
|
+
setFileList?.(fileList.filter((file: any) => file.name !== fileName));
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<FilePreview
|
|
151
|
+
fileData={fileList}
|
|
152
|
+
onDismiss={(e: any) => {
|
|
153
|
+
handleDismiss(e);
|
|
154
|
+
}}
|
|
155
|
+
/>
|
|
156
|
+
);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
const FileUploaderText = forwardRef<
|
|
160
|
+
HTMLParagraphElement,
|
|
161
|
+
HTMLAttributes<HTMLParagraphElement>
|
|
162
|
+
>(({ ...props }, ref) => (
|
|
163
|
+
<p className="md:text-md truncate text-sm" ref={ref} {...props} />
|
|
164
|
+
));
|
|
165
|
+
|
|
166
|
+
FileUploaderComponent.displayName = 'FileUploader';
|
|
167
|
+
FileUploaderInput.displayName = 'FileUploader.Input';
|
|
168
|
+
FileUploaderText.displayName = 'FileUploader.Text';
|
|
169
|
+
FileUploaderFilePreview.displayName = 'FileUploader.FilePreview';
|
|
170
|
+
|
|
171
|
+
const FileUploader = Object.assign(FileUploaderComponent, {
|
|
172
|
+
Input: FileUploaderInput,
|
|
173
|
+
Text: FileUploaderText,
|
|
174
|
+
FilePreview: FileUploaderFilePreview,
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
export { FileUploader };
|