From a6fab681d5c45bba81558245c2b677beddec71af Mon Sep 17 00:00:00 2001 From: Spanzer Date: Wed, 11 Sep 2024 14:22:53 +0530 Subject: [PATCH] Refactor TableHead to Use renderHead Function for Header Rows. Added `renderHead` function to TableHead component for dynamic header row rendering. --- .changeset/README.md | 16 +- .changeset/config.json | 22 +- .changeset/plenty-lemons-bow.md | 10 +- .editorconfig | 20 +- .github/CODE_OF_CONDUCT.md | 146 +- .github/CONTRIBUTING.md | 352 +-- .github/FUNDING.yml | 6 +- .github/ISSUE_TEMPLATE/bug_report.md | 54 +- .github/ISSUE_TEMPLATE/feature_request.md | 30 +- .github/PULL_REQUEST_TEMPLATE.md | 14 +- .github/actions/setup/action.yml | 38 +- .github/workflows/ci.yml | 144 +- .github/workflows/release.yml | 56 +- .gitignore | 26 +- .vscode/extensions.json | 22 +- .vscode/settings.json | 36 +- LICENSE | 42 +- apps/storybook/.gitignore | 2 +- apps/storybook/.storybook/main.ts | 56 +- apps/storybook/.storybook/preview.ts | 60 +- apps/storybook/.storybook/style.css | 40 +- apps/storybook/package.json | 72 +- apps/storybook/postcss.config.cjs | 12 +- apps/storybook/tailwind.config.cjs | 16 +- apps/storybook/tsconfig.json | 50 +- apps/storybook/tsconfig.node.json | 20 +- apps/storybook/turbo.json | 16 +- apps/storybook/vite.config.mjs | 12 +- apps/web/.eslintrc.cjs | 48 +- apps/web/.gitignore | 24 +- apps/web/app/docs/[[...slug]]/page.tsx | 330 +-- apps/web/app/docs/layout.tsx | 384 +-- apps/web/app/examples/[name]/layout.tsx | 24 +- apps/web/app/examples/[name]/page.tsx | 38 +- apps/web/app/layout.tsx | 136 +- apps/web/app/not-found.tsx | 34 +- apps/web/app/page.tsx | 68 +- apps/web/components/banner.tsx | 80 +- apps/web/components/carbon-ads.tsx | 80 +- apps/web/components/code-demo.tsx | 774 +++--- apps/web/components/code-highlight.tsx | 62 +- apps/web/components/docsearch-input.tsx | 20 +- apps/web/components/fathom-script.tsx | 24 +- .../homepage/components-section.tsx | 166 +- .../homepage/contributors-section.tsx | 208 +- .../dark-mode-section/dark-mode-section.tsx | 194 +- .../dark-mode-section/dark-mode-switcher.tsx | 166 +- .../homepage/dark-mode-section/index.ts | 2 +- .../components/homepage/featured-section.tsx | 340 +-- .../web/components/homepage/figma-section.tsx | 506 ++-- .../hero-section/copy-package-input.tsx | 90 +- .../homepage/hero-section/hero-section.tsx | 114 +- .../components/homepage/hero-section/index.ts | 2 +- apps/web/components/homepage/home-navbar.tsx | 68 +- apps/web/components/homepage/index.ts | 20 +- .../web/components/homepage/react-section.tsx | 200 +- .../homepage/social-proof-section.tsx | 418 ++-- .../components/homepage/tailwind-section.tsx | 172 +- apps/web/components/main-footer.tsx | 246 +- apps/web/components/mdx.tsx | 158 +- apps/web/components/navbar.tsx | 198 +- .../quickstart/integration-guides.tsx | 106 +- apps/web/components/text-divider.tsx | 22 +- .../web/content/docs/components/accordion.mdx | 72 +- apps/web/content/docs/components/alert.mdx | 136 +- apps/web/content/docs/components/avatar.mdx | 188 +- apps/web/content/docs/components/badge.mdx | 112 +- apps/web/content/docs/components/banner.mdx | 108 +- .../content/docs/components/breadcrumb.mdx | 72 +- .../content/docs/components/button-group.mdx | 108 +- apps/web/content/docs/components/button.mdx | 206 +- apps/web/content/docs/components/card.mdx | 190 +- apps/web/content/docs/components/carousel.mdx | 144 +- .../web/content/docs/components/clipboard.mdx | 84 +- .../content/docs/components/datepicker.mdx | 160 +- apps/web/content/docs/components/drawer.mdx | 228 +- apps/web/content/docs/components/dropdown.mdx | 172 +- apps/web/content/docs/components/footer.mdx | 100 +- apps/web/content/docs/components/forms.mdx | 340 +-- apps/web/content/docs/components/kbd.mdx | 132 +- .../content/docs/components/list-group.mdx | 96 +- .../web/content/docs/components/mega-menu.mdx | 110 +- apps/web/content/docs/components/modal.mdx | 140 +- apps/web/content/docs/components/navbar.mdx | 92 +- .../content/docs/components/pagination.mdx | 132 +- apps/web/content/docs/components/popover.mdx | 152 +- apps/web/content/docs/components/progress.mdx | 108 +- apps/web/content/docs/components/rating.mdx | 120 +- apps/web/content/docs/components/sidebar.mdx | 124 +- apps/web/content/docs/components/spinner.mdx | 104 +- apps/web/content/docs/components/table.mdx | 96 +- apps/web/content/docs/components/tabs.mdx | 128 +- apps/web/content/docs/components/timeline.mdx | 84 +- apps/web/content/docs/components/toast.mdx | 120 +- apps/web/content/docs/components/tooltip.mdx | 128 +- apps/web/content/docs/customize/dark-mode.mdx | 114 +- apps/web/content/docs/customize/theme.mdx | 148 +- apps/web/content/docs/forms/file-input.mdx | 108 +- .../web/content/docs/forms/floating-label.mdx | 96 +- apps/web/content/docs/getting-started/cli.mdx | 168 +- .../docs/getting-started/contributing.mdx | 358 +-- .../docs/getting-started/editor-setup.mdx | 196 +- .../docs/getting-started/introduction.mdx | 144 +- .../content/docs/getting-started/license.mdx | 56 +- .../docs/getting-started/quickstart.mdx | 56 +- .../getting-started/server-components.mdx | 200 +- apps/web/content/docs/guides/adonis-js.mdx | 298 +-- apps/web/content/docs/guides/astro.mdx | 330 +-- .../content/docs/guides/create-react-app.mdx | 224 +- apps/web/content/docs/guides/gatsby.mdx | 222 +- apps/web/content/docs/guides/laravel.mdx | 160 +- apps/web/content/docs/guides/next-js.mdx | 424 ++-- apps/web/content/docs/guides/parcel.mdx | 474 ++-- apps/web/content/docs/guides/redwood-js.mdx | 182 +- apps/web/content/docs/guides/remix.mdx | 310 +-- apps/web/content/docs/guides/vite.mdx | 224 +- .../content/docs/typography/blockquote.mdx | 208 +- apps/web/content/docs/typography/hr.mdx | 92 +- apps/web/content/docs/typography/list.mdx | 128 +- apps/web/contentlayer.config.js | 78 +- apps/web/data/components.tsx | 832 +++---- apps/web/data/docs-sidebar.ts | 202 +- .../accordion/accordion.collapseAll.tsx | 498 ++-- .../web/examples/accordion/accordion.root.tsx | 498 ++-- apps/web/examples/accordion/index.ts | 4 +- .../alert/alert.additionalContent.tsx | 270 +-- apps/web/examples/alert/alert.allOptions.tsx | 150 +- .../web/examples/alert/alert.borderAccent.tsx | 116 +- apps/web/examples/alert/alert.dismissible.tsx | 74 +- apps/web/examples/alert/alert.root.tsx | 108 +- apps/web/examples/alert/alert.rounded.tsx | 108 +- apps/web/examples/alert/alert.withIcon.tsx | 114 +- apps/web/examples/alert/index.ts | 14 +- apps/web/examples/avatar/avatar.colors.tsx | 186 +- .../examples/avatar/avatar.dotIndicator.tsx | 126 +- apps/web/examples/avatar/avatar.dropdown.tsx | 180 +- .../examples/avatar/avatar.overrideImage.tsx | 234 +- .../examples/avatar/avatar.placeholder.tsx | 114 +- .../avatar/avatar.placeholderInitials.tsx | 114 +- apps/web/examples/avatar/avatar.root.tsx | 114 +- apps/web/examples/avatar/avatar.sizes.tsx | 132 +- .../examples/avatar/avatar.stackedLayout.tsx | 186 +- .../web/examples/avatar/avatar.withBorder.tsx | 114 +- apps/web/examples/avatar/avatar.withText.tsx | 126 +- apps/web/examples/avatar/index.ts | 22 +- apps/web/examples/badge/badge.asLink.tsx | 126 +- apps/web/examples/badge/badge.root.tsx | 150 +- apps/web/examples/badge/badge.sizes.tsx | 246 +- apps/web/examples/badge/badge.withIcon.tsx | 132 +- .../web/examples/badge/badge.withIconOnly.tsx | 132 +- apps/web/examples/badge/index.ts | 10 +- .../examples/banner/banner.bottomPosition.tsx | 246 +- .../examples/banner/banner.informational.tsx | 282 +-- .../examples/banner/banner.marketingCTA.tsx | 240 +- .../web/examples/banner/banner.newsletter.tsx | 210 +- apps/web/examples/banner/banner.root.tsx | 228 +- apps/web/examples/banner/index.ts | 10 +- .../examples/blockquote/blockquote.center.tsx | 114 +- .../examples/blockquote/blockquote.icon.tsx | 168 +- .../examples/blockquote/blockquote.large.tsx | 114 +- .../examples/blockquote/blockquote.left.tsx | 114 +- .../examples/blockquote/blockquote.medium.tsx | 114 +- .../blockquote.paragraphContext.tsx | 240 +- .../examples/blockquote/blockquote.right.tsx | 114 +- .../examples/blockquote/blockquote.root.tsx | 114 +- .../examples/blockquote/blockquote.small.tsx | 114 +- .../blockquote/blockquote.solidBackground.tsx | 168 +- .../blockquote/blockquote.userReview.tsx | 234 +- .../blockquote/blockquote.userTestimonial.tsx | 234 +- apps/web/examples/blockquote/index.ts | 24 +- .../breadcrumb/breadcrumb.backgroundColor.tsx | 138 +- .../examples/breadcrumb/breadcrumb.root.tsx | 138 +- apps/web/examples/breadcrumb/index.ts | 4 +- apps/web/examples/button/button.disabled.tsx | 84 +- .../examples/button/button.gradientDuo.tsx | 144 +- .../examples/button/button.gradientMono.tsx | 150 +- apps/web/examples/button/button.iconOnly.tsx | 180 +- apps/web/examples/button/button.loading.tsx | 192 +- .../examples/button/button.loadingSpinner.tsx | 114 +- apps/web/examples/button/button.outline.tsx | 228 +- apps/web/examples/button/button.pill.tsx | 252 +- apps/web/examples/button/button.polymorph.tsx | 144 +- apps/web/examples/button/button.root.tsx | 156 +- apps/web/examples/button/button.sizes.tsx | 132 +- apps/web/examples/button/button.withIcon.tsx | 156 +- apps/web/examples/button/button.withLabel.tsx | 84 +- apps/web/examples/button/index.ts | 26 +- .../buttonGroup/buttonGroup.colorOptions.tsx | 192 +- .../buttonGroup/buttonGroup.outline.tsx | 192 +- .../buttonGroup.outlineWithIcons.tsx | 360 +-- .../examples/buttonGroup/buttonGroup.root.tsx | 120 +- .../buttonGroup/buttonGroup.withIcons.tsx | 180 +- apps/web/examples/buttonGroup/index.ts | 10 +- apps/web/examples/card/card.CTA.tsx | 426 ++-- apps/web/examples/card/card.CTAButton.tsx | 198 +- apps/web/examples/card/card.crypto.tsx | 612 ++--- apps/web/examples/card/card.eCommerce.tsx | 480 ++-- apps/web/examples/card/card.horizontal.tsx | 140 +- apps/web/examples/card/card.pricing.tsx | 828 +++---- apps/web/examples/card/card.renderImage.tsx | 162 +- apps/web/examples/card/card.root.tsx | 138 +- apps/web/examples/card/card.userProfile.tsx | 426 ++-- apps/web/examples/card/card.withForm.tsx | 216 +- apps/web/examples/card/card.withImage.tsx | 162 +- apps/web/examples/card/card.withList.tsx | 732 +++--- apps/web/examples/card/index.ts | 24 +- .../examples/carousel/carousel.controls.tsx | 144 +- .../web/examples/carousel/carousel.events.tsx | 114 +- .../examples/carousel/carousel.indicators.tsx | 186 +- .../carousel/carousel.pauseOnHover.tsx | 144 +- apps/web/examples/carousel/carousel.root.tsx | 144 +- apps/web/examples/carousel/carousel.slide.tsx | 144 +- .../carousel/carousel.slideInterval.tsx | 144 +- .../carousel/carousel.sliderContent.tsx | 168 +- apps/web/examples/carousel/index.ts | 16 +- .../web/examples/clipboard/clipboard.root.tsx | 118 +- .../examples/clipboard/clipboard.withIcon.tsx | 130 +- .../clipboard/clipboard.withIconText.tsx | 130 +- apps/web/examples/clipboard/index.ts | 6 +- .../datepicker/datepicker.autoHide.tsx | 84 +- .../examples/datepicker/datepicker.inline.tsx | 84 +- .../datepicker/datepicker.localization.tsx | 84 +- .../examples/datepicker/datepicker.range.tsx | 84 +- .../examples/datepicker/datepicker.root.tsx | 84 +- .../examples/datepicker/datepicker.title.tsx | 84 +- .../datepicker/datepicker.weekStart.tsx | 108 +- apps/web/examples/datepicker/index.ts | 14 +- apps/web/examples/drawer/drawer.backdrop.tsx | 340 +-- .../examples/drawer/drawer.bodyScrolling.tsx | 462 ++-- apps/web/examples/drawer/drawer.bottom.tsx | 276 +-- .../examples/drawer/drawer.contactForm.tsx | 272 +-- .../examples/drawer/drawer.formElements.tsx | 328 +-- apps/web/examples/drawer/drawer.left.tsx | 276 +-- .../web/examples/drawer/drawer.navigation.tsx | 340 +-- .../web/examples/drawer/drawer.noBackdrop.tsx | 340 +-- .../drawer/drawer.noBodyScrolling.tsx | 340 +-- apps/web/examples/drawer/drawer.right.tsx | 276 +-- apps/web/examples/drawer/drawer.root.tsx | 276 +-- .../examples/drawer/drawer.swipeableEdge.tsx | 664 +++--- apps/web/examples/drawer/drawer.top.tsx | 276 +-- apps/web/examples/drawer/index.ts | 26 +- .../examples/dropdown/dropdown.customItem.tsx | 140 +- .../dropdown/dropdown.customTrigger.tsx | 86 +- .../examples/dropdown/dropdown.divider.tsx | 130 +- .../web/examples/dropdown/dropdown.events.tsx | 86 +- .../web/examples/dropdown/dropdown.header.tsx | 146 +- .../web/examples/dropdown/dropdown.inline.tsx | 126 +- .../dropdown/dropdown.itemsWithIcon.tsx | 110 +- .../examples/dropdown/dropdown.placement.tsx | 318 +-- apps/web/examples/dropdown/dropdown.root.tsx | 126 +- apps/web/examples/dropdown/dropdown.sizes.tsx | 174 +- apps/web/examples/dropdown/index.ts | 20 +- .../examples/fileInput/fileInput.dropzone.tsx | 266 +-- .../examples/fileInput/fileInput.helper.tsx | 128 +- .../examples/fileInput/fileInput.multiple.tsx | 128 +- .../web/examples/fileInput/fileInput.root.tsx | 128 +- .../examples/fileInput/fileInput.sizes.tsx | 212 +- apps/web/examples/fileInput/index.ts | 10 +- .../floatingLabel/floatingLabel.disabled.tsx | 120 +- .../floatingLabel.helperText.tsx | 120 +- .../floatingLabel/floatingLabel.root.tsx | 120 +- .../floatingLabel/floatingLabel.sizes.tsx | 162 +- .../floatingLabel.validation.tsx | 162 +- apps/web/examples/floatingLabel/index.ts | 10 +- apps/web/examples/footer/footer.root.tsx | 146 +- .../examples/footer/footer.sitemapLinks.tsx | 404 ++-- .../footer/footer.socialMediaIcons.tsx | 422 ++-- apps/web/examples/footer/footer.withLogo.tsx | 212 +- apps/web/examples/footer/index.ts | 8 +- apps/web/examples/forms/forms.checkbox.tsx | 324 +-- .../examples/forms/forms.disabledInputs.tsx | 126 +- apps/web/examples/forms/forms.fileInput.tsx | 126 +- apps/web/examples/forms/forms.helperText.tsx | 210 +- apps/web/examples/forms/forms.inputAddon.tsx | 126 +- apps/web/examples/forms/forms.inputColors.tsx | 282 +-- .../examples/forms/forms.inputLeftIcon.tsx | 132 +- .../forms/forms.inputLeftRightIcon.tsx | 132 +- .../examples/forms/forms.inputRightIcon.tsx | 132 +- apps/web/examples/forms/forms.inputSizing.tsx | 210 +- apps/web/examples/forms/forms.radioButton.tsx | 240 +- apps/web/examples/forms/forms.rangeSlider.tsx | 282 +-- apps/web/examples/forms/forms.root.tsx | 204 +- apps/web/examples/forms/forms.select.tsx | 156 +- .../web/examples/forms/forms.shadowInputs.tsx | 276 +-- apps/web/examples/forms/forms.textarea.tsx | 126 +- .../web/examples/forms/forms.toggleSwitch.tsx | 110 +- apps/web/examples/forms/forms.validation.tsx | 294 +-- apps/web/examples/forms/index.ts | 36 +- apps/web/examples/hr/hr.icon.tsx | 164 +- apps/web/examples/hr/hr.root.tsx | 120 +- apps/web/examples/hr/hr.square.tsx | 164 +- apps/web/examples/hr/hr.text.tsx | 164 +- apps/web/examples/hr/hr.trimmed.tsx | 164 +- apps/web/examples/hr/index.ts | 10 +- apps/web/examples/index.ts | 74 +- apps/web/examples/kbd/index.ts | 14 +- apps/web/examples/kbd/kbd.arrowKeys.tsx | 132 +- apps/web/examples/kbd/kbd.functionKeys.tsx | 174 +- apps/web/examples/kbd/kbd.insideTable.tsx | 300 +-- apps/web/examples/kbd/kbd.insideText.tsx | 108 +- apps/web/examples/kbd/kbd.letterKeys.tsx | 252 +- apps/web/examples/kbd/kbd.numberKeys.tsx | 162 +- apps/web/examples/kbd/kbd.root.tsx | 144 +- apps/web/examples/list/index.ts | 14 +- apps/web/examples/list/list.advanced.tsx | 402 ++-- apps/web/examples/list/list.horizontal.tsx | 144 +- apps/web/examples/list/list.icon.tsx | 126 +- apps/web/examples/list/list.nested.tsx | 246 +- apps/web/examples/list/list.ordered.tsx | 120 +- apps/web/examples/list/list.root.tsx | 120 +- apps/web/examples/list/list.unstyled.tsx | 120 +- apps/web/examples/listGroup/index.ts | 8 +- .../listGroup/listGroup.itemsAsLink.tsx | 150 +- .../web/examples/listGroup/listGroup.root.tsx | 138 +- .../listGroup/listGroup.withButtons.tsx | 102 +- .../listGroup/listGroup.withIcons.tsx | 156 +- apps/web/examples/megaMenu/index.ts | 10 +- .../examples/megaMenu/megaMenu.fullWidth.tsx | 700 +++--- .../megaMenu/megaMenu.fullWidthCTA.tsx | 602 ++--- .../megaMenu/megaMenu.fullWidthImage.tsx | 616 ++--- apps/web/examples/megaMenu/megaMenu.icons.tsx | 1056 ++++----- apps/web/examples/megaMenu/megaMenu.root.tsx | 662 +++--- apps/web/examples/modal/index.ts | 14 +- apps/web/examples/modal/modal.dismissible.tsx | 176 +- .../web/examples/modal/modal.initialFocus.tsx | 244 +- apps/web/examples/modal/modal.popup.tsx | 168 +- apps/web/examples/modal/modal.position.tsx | 248 +- apps/web/examples/modal/modal.root.tsx | 176 +- apps/web/examples/modal/modal.sizes.tsx | 244 +- .../examples/modal/modal.withFormElements.tsx | 288 +-- apps/web/examples/navbar/index.ts | 6 +- apps/web/examples/navbar/navbar.root.tsx | 212 +- .../examples/navbar/navbar.withCTAButton.tsx | 212 +- .../examples/navbar/navbar.withDropdown.tsx | 352 +-- apps/web/examples/pagination/index.ts | 14 +- .../pagination.controlButtonText.tsx | 126 +- .../pagination/pagination.navigation.tsx | 94 +- .../pagination.navigationWithIcons.tsx | 118 +- .../examples/pagination/pagination.root.tsx | 94 +- .../examples/pagination/pagination.table.tsx | 94 +- .../pagination/pagination.tableWithIcons.tsx | 94 +- .../pagination/pagination.withIcons.tsx | 94 +- apps/web/examples/popover/index.ts | 16 +- .../examples/popover/popover.controlled.tsx | 208 +- .../examples/popover/popover.disableArrow.tsx | 126 +- apps/web/examples/popover/popover.image.tsx | 278 +-- .../web/examples/popover/popover.password.tsx | 430 ++-- .../examples/popover/popover.placement.tsx | 158 +- apps/web/examples/popover/popover.profile.tsx | 278 +-- apps/web/examples/popover/popover.root.tsx | 122 +- apps/web/examples/popover/popover.trigger.tsx | 204 +- apps/web/examples/progress/index.ts | 10 +- .../web/examples/progress/progress.colors.tsx | 246 +- .../progress/progress.positioning.tsx | 144 +- apps/web/examples/progress/progress.root.tsx | 84 +- .../web/examples/progress/progress.sizing.tsx | 150 +- .../examples/progress/progress.withLabels.tsx | 84 +- apps/web/examples/rating/index.ts | 10 +- apps/web/examples/rating/rating.advanced.tsx | 234 +- apps/web/examples/rating/rating.count.tsx | 138 +- apps/web/examples/rating/rating.root.tsx | 132 +- apps/web/examples/rating/rating.sizing.tsx | 228 +- apps/web/examples/rating/rating.withText.tsx | 138 +- apps/web/examples/sidebar/index.ts | 12 +- .../web/examples/sidebar/sidebar.dropdown.tsx | 190 +- .../sidebar/sidebar.dropdownWithChevron.tsx | 262 +- apps/web/examples/sidebar/sidebar.root.tsx | 178 +- .../examples/sidebar/sidebar.separator.tsx | 226 +- .../examples/sidebar/sidebar.withButton.tsx | 314 +-- .../web/examples/sidebar/sidebar.withLogo.tsx | 190 +- apps/web/examples/spinner/index.ts | 10 +- .../examples/spinner/spinner.alignment.tsx | 156 +- apps/web/examples/spinner/spinner.colors.tsx | 138 +- .../spinner/spinner.loadingButtons.tsx | 150 +- apps/web/examples/spinner/spinner.root.tsx | 84 +- apps/web/examples/spinner/spinner.sizing.tsx | 132 +- apps/web/examples/table/index.ts | 8 +- apps/web/examples/table/table.hover.tsx | 402 ++-- apps/web/examples/table/table.root.tsx | 402 ++-- apps/web/examples/table/table.striped.tsx | 546 ++--- .../examples/table/table.withCheckboxes.tsx | 474 ++-- apps/web/examples/tabs/index.ts | 12 +- apps/web/examples/tabs/tabs.fullWidth.tsx | 174 +- apps/web/examples/tabs/tabs.root.tsx | 166 +- apps/web/examples/tabs/tabs.stateOptions.tsx | 254 +- apps/web/examples/tabs/tabs.withIcons.tsx | 166 +- apps/web/examples/tabs/tabs.withPills.tsx | 126 +- apps/web/examples/tabs/tabs.withUnderline.tsx | 166 +- apps/web/examples/timeline/index.ts | 6 +- .../examples/timeline/timeline.horizontal.tsx | 370 +-- apps/web/examples/timeline/timeline.root.tsx | 360 +-- .../examples/timeline/timeline.vertical.tsx | 368 +-- apps/web/examples/toast/index.ts | 12 +- apps/web/examples/toast/toast.colors.tsx | 234 +- .../examples/toast/toast.customDismissal.tsx | 126 +- apps/web/examples/toast/toast.feedback.tsx | 120 +- apps/web/examples/toast/toast.interactive.tsx | 228 +- apps/web/examples/toast/toast.root.tsx | 138 +- apps/web/examples/toast/toast.withButton.tsx | 162 +- apps/web/examples/tooltip/index.ts | 12 +- .../examples/tooltip/tooltip.animation.tsx | 192 +- .../examples/tooltip/tooltip.disableArrow.tsx | 108 +- .../examples/tooltip/tooltip.placement.tsx | 174 +- apps/web/examples/tooltip/tooltip.root.tsx | 108 +- apps/web/examples/tooltip/tooltip.styles.tsx | 138 +- apps/web/examples/tooltip/tooltip.trigger.tsx | 138 +- apps/web/helpers/http.ts | 18 +- apps/web/next-env.d.ts | 10 +- apps/web/next.config.js | 292 +-- apps/web/package.json | 90 +- apps/web/postcss.config.cjs | 14 +- apps/web/prettier.config.cjs | 20 +- apps/web/public/browserconfig.xml | 18 +- apps/web/public/favicon.svg | 98 +- .../images/components/accordion-dark.svg | 98 +- .../public/images/components/accordion.svg | 98 +- .../public/images/components/alerts-dark.svg | 22 +- apps/web/public/images/components/alerts.svg | 22 +- .../public/images/components/avatar-dark.svg | 294 +-- apps/web/public/images/components/avatar.svg | 294 +-- .../public/images/components/badges-dark.svg | 10 +- apps/web/public/images/components/badges.svg | 10 +- .../public/images/components/banner-dark.svg | 68 +- apps/web/public/images/components/banner.svg | 66 +- .../images/components/blockquote-dark.svg | 16 +- .../public/images/components/blockquote.svg | 16 +- .../images/components/breadcrumbs-dark.svg | 14 +- .../public/images/components/breadcrumbs.svg | 14 +- .../images/components/button-group-dark.svg | 20 +- .../public/images/components/button-group.svg | 20 +- .../public/images/components/buttons-dark.svg | 20 +- apps/web/public/images/components/buttons.svg | 20 +- .../public/images/components/cards-dark.svg | 70 +- apps/web/public/images/components/cards.svg | 72 +- .../images/components/carousel-dark.svg | 44 +- .../web/public/images/components/carousel.svg | 44 +- .../images/components/datepicker-dark.svg | 134 +- .../public/images/components/datepicker.svg | 134 +- .../images/components/dropdown-dark.svg | 70 +- .../web/public/images/components/dropdown.svg | 70 +- .../images/components/file-input-dark.svg | 118 +- .../public/images/components/file-input.svg | 92 +- .../images/components/floating-label-dark.svg | 22 +- .../images/components/floating-label.svg | 22 +- .../public/images/components/footer-dark.svg | 104 +- apps/web/public/images/components/footer.svg | 100 +- .../public/images/components/forms-dark.svg | 150 +- apps/web/public/images/components/forms.svg | 150 +- .../images/components/keyboard-dark.svg | 920 +++---- .../web/public/images/components/keyboard.svg | 924 ++++---- .../public/images/components/list-dark.svg | 52 +- .../images/components/list-group-dark.svg | 72 +- .../public/images/components/list-group.svg | 112 +- apps/web/public/images/components/list.svg | 52 +- .../public/images/components/modal-dark.svg | 64 +- apps/web/public/images/components/modal.svg | 66 +- .../public/images/components/navbar-dark.svg | 156 +- apps/web/public/images/components/navbar.svg | 156 +- .../images/components/pagination-dark.svg | 100 +- .../public/images/components/pagination.svg | 100 +- .../images/components/progress-dark.svg | 20 +- .../web/public/images/components/progress.svg | 20 +- .../public/images/components/rating-dark.svg | 124 +- apps/web/public/images/components/rating.svg | 124 +- .../public/images/components/sidebar-dark.svg | 34 +- apps/web/public/images/components/sidebar.svg | 36 +- .../public/images/components/spinner-dark.svg | 12 +- apps/web/public/images/components/spinner.svg | 12 +- .../public/images/components/table-dark.svg | 94 +- apps/web/public/images/components/table.svg | 94 +- .../public/images/components/tabs-dark.svg | 20 +- apps/web/public/images/components/tabs.svg | 20 +- .../images/components/timeline-dark.svg | 38 +- .../web/public/images/components/timeline.svg | 38 +- .../public/images/components/toast-dark.svg | 98 +- apps/web/public/images/components/toast.svg | 98 +- .../images/components/tooltips-dark.svg | 14 +- .../web/public/images/components/tooltips.svg | 14 +- apps/web/public/logos/astro.svg | 2 +- apps/web/public/logos/create-react-app.svg | 2 +- apps/web/public/logos/gatsby.svg | 2 +- apps/web/public/logos/laravel.svg | 2 +- apps/web/public/logos/next-js.svg | 2 +- apps/web/public/logos/parcel.svg | 2 +- apps/web/public/logos/redwood-js.svg | 6 +- apps/web/public/logos/remix.svg | 2 +- apps/web/public/logos/vite.svg | 2 +- apps/web/public/safari-pinned-tab.svg | 244 +- apps/web/public/site.webmanifest | 38 +- apps/web/styles/docs.css | 1368 +++++------ apps/web/styles/docsearch.css | 440 ++-- apps/web/styles/globals.css | 6 +- apps/web/tailwind.config.cjs | 190 +- apps/web/tsconfig.json | 58 +- apps/web/turbo.json | 42 +- package.json | 100 +- packages/cli/.gitignore | 2 +- packages/cli/CHANGELOG.md | 62 +- packages/cli/README.md | 168 +- packages/cli/package.json | 144 +- packages/cli/src/actions/create-project.ts | 44 +- packages/cli/src/actions/git.ts | 60 +- packages/cli/src/actions/help.ts | 42 +- packages/cli/src/actions/intro.ts | 16 +- packages/cli/src/actions/next-steps.ts | 14 +- packages/cli/src/actions/project-name.ts | 72 +- packages/cli/src/actions/template.ts | 66 +- packages/cli/src/actions/version.ts | 10 +- packages/cli/src/context.ts | 56 +- packages/cli/src/data.ts | 28 +- packages/cli/src/index.ts | 62 +- packages/cli/src/utils/validators.ts | 30 +- packages/cli/tsconfig.json | 58 +- packages/cli/tsup.config.ts | 20 +- packages/cli/turbo.json | 16 +- packages/ui/.eslintrc.cjs | 122 +- packages/ui/.gitignore | 4 +- packages/ui/CHANGELOG.md | 2112 ++++++++--------- packages/ui/README.md | 676 +++--- packages/ui/package.json | 212 +- packages/ui/postcss.config.cjs | 12 +- packages/ui/prettier.config.cjs | 20 +- packages/ui/rollup.config.mjs | 150 +- .../components/Accordion/Accordion.spec.tsx | 586 ++--- .../Accordion/Accordion.stories.tsx | 212 +- .../ui/src/components/Accordion/Accordion.tsx | 172 +- .../components/Accordion/AccordionContent.tsx | 76 +- .../components/Accordion/AccordionPanel.tsx | 52 +- .../Accordion/AccordionPanelContext.tsx | 36 +- .../components/Accordion/AccordionTitle.tsx | 118 +- packages/ui/src/components/Accordion/index.ts | 16 +- packages/ui/src/components/Accordion/theme.ts | 68 +- .../ui/src/components/Alert/Alert.spec.tsx | 406 ++-- .../ui/src/components/Alert/Alert.stories.tsx | 280 +-- packages/ui/src/components/Alert/Alert.tsx | 160 +- packages/ui/src/components/Alert/index.ts | 4 +- packages/ui/src/components/Alert/theme.ts | 120 +- .../ui/src/components/Avatar/Avatar.spec.tsx | 216 +- .../src/components/Avatar/Avatar.stories.tsx | 70 +- packages/ui/src/components/Avatar/Avatar.tsx | 338 +-- .../components/Avatar/AvatarGroup.spec.tsx | 52 +- .../components/Avatar/AvatarGroup.stories.tsx | 44 +- .../ui/src/components/Avatar/AvatarGroup.tsx | 50 +- .../Avatar/AvatarGroupCounter.spec.tsx | 38 +- .../components/Avatar/AvatarGroupCounter.tsx | 64 +- packages/ui/src/components/Avatar/index.ts | 32 +- packages/ui/src/components/Avatar/theme.ts | 126 +- .../ui/src/components/Badge/Badge.spec.tsx | 192 +- .../ui/src/components/Badge/Badge.stories.tsx | 108 +- packages/ui/src/components/Badge/Badge.tsx | 148 +- packages/ui/src/components/Badge/index.ts | 16 +- packages/ui/src/components/Badge/theme.ts | 96 +- .../ui/src/components/Banner/Banner.spec.tsx | 44 +- .../src/components/Banner/Banner.stories.tsx | 76 +- packages/ui/src/components/Banner/Banner.tsx | 36 +- .../Banner/BannerCollapseButton.tsx | 48 +- packages/ui/src/components/Banner/index.ts | 8 +- packages/ui/src/components/Banner/theme.ts | 6 +- .../components/Blockquote/Blockquote.spec.tsx | 66 +- .../Blockquote/Blockquote.stories.tsx | 42 +- .../src/components/Blockquote/Blockquote.tsx | 58 +- .../ui/src/components/Blockquote/index.ts | 4 +- .../ui/src/components/Blockquote/theme.ts | 16 +- .../components/Breadcrumb/Breadcrumb.spec.tsx | 214 +- .../Breadcrumb/Breadcrumb.stories.tsx | 54 +- .../src/components/Breadcrumb/Breadcrumb.tsx | 84 +- .../components/Breadcrumb/BreadcrumbItem.tsx | 94 +- .../ui/src/components/Breadcrumb/index.ts | 8 +- .../ui/src/components/Breadcrumb/theme.ts | 36 +- .../ui/src/components/Button/Button.spec.tsx | 786 +++--- .../src/components/Button/Button.stories.tsx | 62 +- packages/ui/src/components/Button/Button.tsx | 354 +-- .../ui/src/components/Button/ButtonBase.tsx | 40 +- .../components/Button/ButtonGroup.spec.tsx | 276 +-- .../components/Button/ButtonGroup.stories.tsx | 40 +- .../ui/src/components/Button/ButtonGroup.tsx | 154 +- packages/ui/src/components/Button/index.ts | 28 +- packages/ui/src/components/Button/theme.ts | 256 +- packages/ui/src/components/Card/Card.spec.tsx | 380 +-- .../ui/src/components/Card/Card.stories.tsx | 82 +- packages/ui/src/components/Card/Card.tsx | 198 +- packages/ui/src/components/Card/index.ts | 4 +- packages/ui/src/components/Card/theme.ts | 42 +- .../src/components/Carousel/Carousel.spec.tsx | 296 +-- .../components/Carousel/Carousel.stories.tsx | 94 +- .../ui/src/components/Carousel/Carousel.tsx | 460 ++-- packages/ui/src/components/Carousel/index.ts | 22 +- packages/ui/src/components/Carousel/theme.ts | 66 +- .../src/components/Checkbox/Checkbox.spec.tsx | 70 +- .../components/Checkbox/Checkbox.stories.tsx | 28 +- .../ui/src/components/Checkbox/Checkbox.tsx | 74 +- packages/ui/src/components/Checkbox/index.ts | 4 +- packages/ui/src/components/Checkbox/theme.ts | 56 +- .../Clipboard/Clipboard.stories.tsx | 144 +- .../ui/src/components/Clipboard/Clipboard.tsx | 116 +- .../Clipboard/ClipboardWithIcon.tsx | 92 +- .../Clipboard/ClipboardWithIconText.tsx | 116 +- .../ui/src/components/Clipboard/helpers.ts | 30 +- packages/ui/src/components/Clipboard/index.ts | 16 +- .../ui/src/components/Clipboard/theme.tsx | 56 +- .../DarkThemeToggle/DarkThemeToggle.spec.tsx | 44 +- .../DarkThemeToggle.stories.tsx | 36 +- .../DarkThemeToggle/DarkThemeToggle.tsx | 126 +- .../src/components/DarkThemeToggle/index.ts | 12 +- .../src/components/DarkThemeToggle/theme.ts | 18 +- .../components/Datepicker/Datepicker.spec.tsx | 432 ++-- .../Datepicker/Datepicker.stories.tsx | 126 +- .../src/components/Datepicker/Datepicker.tsx | 720 +++--- .../Datepicker/DatepickerContext.tsx | 68 +- .../src/components/Datepicker/Views/Days.tsx | 168 +- .../components/Datepicker/Views/Decades.tsx | 122 +- .../components/Datepicker/Views/Months.tsx | 142 +- .../src/components/Datepicker/Views/Years.tsx | 126 +- .../components/Datepicker/helpers.spec.tsx | 378 +-- .../ui/src/components/Datepicker/helpers.ts | 316 +-- .../ui/src/components/Datepicker/index.ts | 6 +- .../ui/src/components/Datepicker/theme.ts | 172 +- .../ui/src/components/Drawer/Drawer.spec.tsx | 98 +- .../src/components/Drawer/Drawer.stories.tsx | 122 +- packages/ui/src/components/Drawer/Drawer.tsx | 192 +- .../src/components/Drawer/DrawerContext.tsx | 46 +- .../ui/src/components/Drawer/DrawerHeader.tsx | 120 +- .../ui/src/components/Drawer/DrawerItems.tsx | 58 +- packages/ui/src/components/Drawer/index.ts | 16 +- packages/ui/src/components/Drawer/theme.ts | 88 +- .../src/components/Dropdown/Dropdown.spec.tsx | 446 ++-- .../components/Dropdown/Dropdown.stories.tsx | 262 +- .../ui/src/components/Dropdown/Dropdown.tsx | 476 ++-- .../components/Dropdown/DropdownContext.tsx | 50 +- .../components/Dropdown/DropdownDivider.tsx | 44 +- .../components/Dropdown/DropdownHeader.tsx | 60 +- .../src/components/Dropdown/DropdownItem.tsx | 134 +- packages/ui/src/components/Dropdown/index.ts | 16 +- packages/ui/src/components/Dropdown/theme.ts | 72 +- .../FileInput/FileInput.stories.tsx | 28 +- .../ui/src/components/FileInput/FileInput.tsx | 126 +- packages/ui/src/components/FileInput/index.ts | 16 +- packages/ui/src/components/FileInput/theme.ts | 58 +- .../ui/src/components/Floating/Floating.tsx | 306 +-- .../ui/src/components/Floating/helpers.ts | 78 +- packages/ui/src/components/Floating/index.ts | 4 +- .../FloatingLabel/FloatingLabel.spec.tsx | 60 +- .../FloatingLabel/FloatingLabel.stories.tsx | 220 +- .../FloatingLabel/FloatingLabel.tsx | 140 +- .../ui/src/components/FloatingLabel/index.ts | 16 +- .../ui/src/components/FloatingLabel/theme.ts | 198 +- .../src/components/Flowbite/Flowbite.spec.tsx | 180 +- .../ui/src/components/Flowbite/Flowbite.tsx | 50 +- .../src/components/Flowbite/FlowbiteTheme.ts | 352 +-- packages/ui/src/components/Flowbite/index.ts | 30 +- .../ui/src/components/Footer/Footer.spec.tsx | 610 ++--- .../src/components/Footer/Footer.stories.tsx | 322 +-- packages/ui/src/components/Footer/Footer.tsx | 160 +- .../ui/src/components/Footer/FooterBrand.tsx | 110 +- .../src/components/Footer/FooterCopyright.tsx | 88 +- .../src/components/Footer/FooterDivider.tsx | 38 +- .../ui/src/components/Footer/FooterIcon.tsx | 94 +- .../ui/src/components/Footer/FooterLink.tsx | 70 +- .../src/components/Footer/FooterLinkGroup.tsx | 66 +- .../ui/src/components/Footer/FooterTitle.tsx | 62 +- packages/ui/src/components/Footer/index.ts | 32 +- packages/ui/src/components/Footer/theme.ts | 76 +- packages/ui/src/components/HR/HR.spec.tsx | 86 +- packages/ui/src/components/HR/HR.stories.tsx | 86 +- packages/ui/src/components/HR/HR.tsx | 98 +- packages/ui/src/components/HR/HRIcon.tsx | 84 +- packages/ui/src/components/HR/HRSquare.tsx | 60 +- packages/ui/src/components/HR/HRText.tsx | 72 +- packages/ui/src/components/HR/HRTrimmed.tsx | 60 +- packages/ui/src/components/HR/index.ts | 28 +- packages/ui/src/components/HR/theme.ts | 54 +- .../src/components/HelperText/HelperText.tsx | 88 +- .../ui/src/components/HelperText/index.ts | 4 +- .../ui/src/components/HelperText/theme.ts | 30 +- packages/ui/src/components/Kbd/Kbd.spec.tsx | 102 +- .../ui/src/components/Kbd/Kbd.stories.tsx | 56 +- packages/ui/src/components/Kbd/Kbd.tsx | 64 +- packages/ui/src/components/Kbd/index.ts | 4 +- packages/ui/src/components/Kbd/theme.ts | 18 +- .../ui/src/components/Label/Label.spec.tsx | 264 +-- .../ui/src/components/Label/Label.stories.tsx | 32 +- packages/ui/src/components/Label/Label.tsx | 104 +- packages/ui/src/components/Label/index.ts | 4 +- packages/ui/src/components/Label/theme.ts | 32 +- packages/ui/src/components/List/List.spec.tsx | 74 +- .../ui/src/components/List/List.stories.tsx | 396 ++-- packages/ui/src/components/List/List.tsx | 142 +- packages/ui/src/components/List/ListItem.tsx | 60 +- packages/ui/src/components/List/index.ts | 8 +- packages/ui/src/components/List/theme.ts | 44 +- .../components/ListGroup/ListGroup.spec.tsx | 268 +-- .../ListGroup/ListGroup.stories.tsx | 138 +- .../ui/src/components/ListGroup/ListGroup.tsx | 74 +- .../components/ListGroup/ListGroupItem.tsx | 128 +- packages/ui/src/components/ListGroup/index.ts | 8 +- packages/ui/src/components/ListGroup/theme.ts | 54 +- .../src/components/MegaMenu/MegaMenu.spec.tsx | 144 +- .../components/MegaMenu/MegaMenu.stories.tsx | 206 +- .../ui/src/components/MegaMenu/MegaMenu.tsx | 64 +- .../components/MegaMenu/MegaMenuDropdown.tsx | 142 +- .../MegaMenu/MegaMenuDropdownToggle.tsx | 132 +- packages/ui/src/components/MegaMenu/index.ts | 12 +- packages/ui/src/components/MegaMenu/theme.ts | 56 +- .../ui/src/components/Modal/Modal.spec.tsx | 392 +-- .../ui/src/components/Modal/Modal.stories.tsx | 248 +- packages/ui/src/components/Modal/Modal.tsx | 294 +-- .../ui/src/components/Modal/ModalBody.tsx | 56 +- .../ui/src/components/Modal/ModalContext.tsx | 46 +- .../ui/src/components/Modal/ModalFooter.tsx | 56 +- .../ui/src/components/Modal/ModalHeader.tsx | 116 +- packages/ui/src/components/Modal/index.ts | 30 +- packages/ui/src/components/Modal/theme.ts | 112 +- .../ui/src/components/Navbar/Navbar.spec.tsx | 116 +- .../src/components/Navbar/Navbar.stories.tsx | 212 +- packages/ui/src/components/Navbar/Navbar.tsx | 176 +- .../ui/src/components/Navbar/NavbarBrand.tsx | 70 +- .../src/components/Navbar/NavbarCollapse.tsx | 68 +- .../src/components/Navbar/NavbarContext.tsx | 44 +- .../ui/src/components/Navbar/NavbarLink.tsx | 120 +- .../ui/src/components/Navbar/NavbarToggle.tsx | 90 +- packages/ui/src/components/Navbar/index.ts | 20 +- packages/ui/src/components/Navbar/theme.ts | 98 +- .../components/Pagination/Pagination.spec.tsx | 362 +-- .../Pagination/Pagination.stories.tsx | 128 +- .../src/components/Pagination/Pagination.tsx | 258 +- .../Pagination/PaginationButton.tsx | 144 +- .../src/components/Pagination/helpers.spec.ts | 26 +- .../ui/src/components/Pagination/helpers.ts | 14 +- .../ui/src/components/Pagination/index.ts | 32 +- .../ui/src/components/Pagination/theme.ts | 60 +- .../src/components/Popover/Popover.spec.tsx | 196 +- .../components/Popover/Popover.stories.tsx | 192 +- .../ui/src/components/Popover/Popover.tsx | 254 +- packages/ui/src/components/Popover/index.ts | 4 +- packages/ui/src/components/Popover/theme.ts | 20 +- .../src/components/Progress/Progress.spec.tsx | 142 +- .../components/Progress/Progress.stories.tsx | 152 +- .../ui/src/components/Progress/Progress.tsx | 172 +- packages/ui/src/components/Progress/index.ts | 4 +- packages/ui/src/components/Progress/theme.ts | 56 +- .../ui/src/components/Radio/Radio.spec.tsx | 70 +- .../ui/src/components/Radio/Radio.stories.tsx | 28 +- packages/ui/src/components/Radio/Radio.tsx | 56 +- packages/ui/src/components/Radio/index.ts | 4 +- packages/ui/src/components/Radio/theme.ts | 16 +- .../RangeSlider/RangeSlider.spec.tsx | 554 ++--- .../RangeSlider/RangeSlider.stories.tsx | 62 +- .../components/RangeSlider/RangeSlider.tsx | 104 +- .../ui/src/components/RangeSlider/index.ts | 14 +- .../ui/src/components/RangeSlider/theme.ts | 38 +- .../ui/src/components/Rating/Rating.spec.tsx | 92 +- .../src/components/Rating/Rating.stories.tsx | 146 +- packages/ui/src/components/Rating/Rating.tsx | 88 +- .../src/components/Rating/RatingAdvanced.tsx | 88 +- .../src/components/Rating/RatingContext.tsx | 46 +- .../ui/src/components/Rating/RatingStar.tsx | 90 +- packages/ui/src/components/Rating/index.ts | 12 +- packages/ui/src/components/Rating/theme.ts | 56 +- .../ui/src/components/Select/Select.spec.tsx | 26 +- .../src/components/Select/Select.stories.tsx | 78 +- packages/ui/src/components/Select/Select.tsx | 192 +- packages/ui/src/components/Select/index.ts | 4 +- packages/ui/src/components/Select/theme.ts | 90 +- .../src/components/Sidebar/Sidebar.spec.tsx | 758 +++--- .../components/Sidebar/Sidebar.stories.tsx | 578 ++--- .../ui/src/components/Sidebar/Sidebar.tsx | 144 +- .../ui/src/components/Sidebar/SidebarCTA.tsx | 102 +- .../components/Sidebar/SidebarCollapse.tsx | 228 +- .../src/components/Sidebar/SidebarContext.tsx | 42 +- .../ui/src/components/Sidebar/SidebarItem.tsx | 290 +-- .../components/Sidebar/SidebarItemContext.tsx | 38 +- .../components/Sidebar/SidebarItemGroup.tsx | 70 +- .../src/components/Sidebar/SidebarItems.tsx | 58 +- .../ui/src/components/Sidebar/SidebarLogo.tsx | 106 +- packages/ui/src/components/Sidebar/index.ts | 28 +- packages/ui/src/components/Sidebar/theme.ts | 164 +- .../src/components/Spinner/Spinner.spec.tsx | 178 +- .../components/Spinner/Spinner.stories.tsx | 130 +- .../ui/src/components/Spinner/Spinner.tsx | 154 +- packages/ui/src/components/Spinner/index.ts | 4 +- packages/ui/src/components/Spinner/theme.ts | 96 +- .../ui/src/components/Table/Table.spec.tsx | 216 +- .../ui/src/components/Table/Table.stories.tsx | 176 +- packages/ui/src/components/Table/Table.tsx | 118 +- .../ui/src/components/Table/TableBody.tsx | 72 +- .../src/components/Table/TableBodyContext.tsx | 40 +- .../ui/src/components/Table/TableCell.tsx | 62 +- .../ui/src/components/Table/TableContext.tsx | 44 +- .../ui/src/components/Table/TableHead.tsx | 73 +- .../ui/src/components/Table/TableHeadCell.tsx | 62 +- .../src/components/Table/TableHeadContext.tsx | 40 +- packages/ui/src/components/Table/TableRow.tsx | 76 +- packages/ui/src/components/Table/index.ts | 24 +- packages/ui/src/components/Table/theme.ts | 54 +- packages/ui/src/components/Tabs/TabItem.tsx | 28 +- packages/ui/src/components/Tabs/Tabs.spec.tsx | 464 ++-- .../ui/src/components/Tabs/Tabs.stories.tsx | 210 +- packages/ui/src/components/Tabs/Tabs.tsx | 372 +-- packages/ui/src/components/Tabs/index.ts | 24 +- packages/ui/src/components/Tabs/theme.ts | 120 +- .../components/TextInput/TextInput.spec.tsx | 38 +- .../TextInput/TextInput.stories.tsx | 28 +- .../ui/src/components/TextInput/TextInput.tsx | 222 +- packages/ui/src/components/TextInput/index.ts | 14 +- packages/ui/src/components/TextInput/theme.ts | 106 +- .../src/components/Textarea/Textarea.spec.tsx | 26 +- .../components/Textarea/Textarea.stories.tsx | 32 +- .../ui/src/components/Textarea/Textarea.tsx | 88 +- packages/ui/src/components/Textarea/index.ts | 4 +- packages/ui/src/components/Textarea/theme.ts | 40 +- .../ThemeModeScript/ThemeModeScript.spec.tsx | 30 +- .../ThemeModeScript/ThemeModeScript.tsx | 84 +- .../src/components/ThemeModeScript/index.ts | 4 +- .../src/components/Timeline/Timeline.spec.tsx | 350 +-- .../components/Timeline/Timeline.stories.tsx | 100 +- .../ui/src/components/Timeline/Timeline.tsx | 144 +- .../src/components/Timeline/TimelineBody.tsx | 54 +- .../components/Timeline/TimelineContent.tsx | 102 +- .../Timeline/TimelineContentContext.tsx | 40 +- .../components/Timeline/TimelineContext.tsx | 42 +- .../src/components/Timeline/TimelineItem.tsx | 82 +- .../Timeline/TimelineItemContext.tsx | 40 +- .../src/components/Timeline/TimelinePoint.tsx | 124 +- .../src/components/Timeline/TimelineTime.tsx | 54 +- .../src/components/Timeline/TimelineTitle.tsx | 70 +- packages/ui/src/components/Timeline/index.ts | 28 +- packages/ui/src/components/Timeline/theme.ts | 102 +- .../ui/src/components/Toast/Toast.spec.tsx | 190 +- .../ui/src/components/Toast/Toast.stories.tsx | 46 +- packages/ui/src/components/Toast/Toast.tsx | 138 +- .../ui/src/components/Toast/ToastContext.tsx | 54 +- .../ui/src/components/Toast/ToastToggle.tsx | 112 +- packages/ui/src/components/Toast/index.ts | 8 +- packages/ui/src/components/Toast/theme.ts | 26 +- .../ToggleSwitch/ToggleSwitch.spec.tsx | 444 ++-- .../ToggleSwitch/ToggleSwitch.stories.tsx | 112 +- .../components/ToggleSwitch/ToggleSwitch.tsx | 222 +- .../ui/src/components/ToggleSwitch/index.ts | 14 +- .../ui/src/components/ToggleSwitch/theme.ts | 88 +- .../src/components/Tooltip/Tooltip.spec.tsx | 162 +- .../components/Tooltip/Tooltip.stories.tsx | 92 +- .../ui/src/components/Tooltip/Tooltip.tsx | 108 +- packages/ui/src/components/Tooltip/index.ts | 4 +- packages/ui/src/components/Tooltip/theme.ts | 48 +- packages/ui/src/helpers/clone-deep.spec.ts | 46 +- packages/ui/src/helpers/clone-deep.ts | 30 +- packages/ui/src/helpers/create-theme.ts | 12 +- packages/ui/src/helpers/drag-scroll/index.tsx | 776 +++--- packages/ui/src/helpers/generic-as-prop.ts | 42 +- packages/ui/src/helpers/is-client.ts | 6 +- packages/ui/src/helpers/is-object.spec.ts | 56 +- packages/ui/src/helpers/is-object.ts | 16 +- packages/ui/src/helpers/merge-deep.spec.ts | 146 +- packages/ui/src/helpers/merge-deep.ts | 56 +- packages/ui/src/helpers/omit.spec.ts | 16 +- packages/ui/src/helpers/omit.ts | 32 +- packages/ui/src/hooks/use-floating.ts | 120 +- packages/ui/src/hooks/use-is-mounted.ts | 22 +- packages/ui/src/hooks/use-theme-mode.ts | 262 +- .../src/hooks/use-watch-localstorage-value.ts | 46 +- packages/ui/src/index.ts | 120 +- packages/ui/src/tailwind.ts | 88 +- packages/ui/src/theme-store/index.tsx | 60 +- packages/ui/src/theme-store/init/client.tsx | 28 +- packages/ui/src/theme-store/init/index.tsx | 40 +- packages/ui/src/theme-store/init/mode.tsx | 32 +- packages/ui/src/theme-store/init/server.tsx | 24 +- packages/ui/src/theme.ts | 188 +- packages/ui/src/types/index.ts | 26 +- packages/ui/tailwind.config.cjs | 16 +- packages/ui/tsconfig.build.json | 18 +- packages/ui/tsconfig.json | 62 +- packages/ui/turbo.json | 16 +- packages/ui/vitest-setup.ts | 2 +- packages/ui/vitest.config.mjs | 28 +- prettier.config.cjs | 14 +- turbo.json | 44 +- 877 files changed, 61393 insertions(+), 61388 deletions(-) diff --git a/.changeset/README.md b/.changeset/README.md index e5b6d8d6a..c63edce49 100644 --- a/.changeset/README.md +++ b/.changeset/README.md @@ -1,8 +1,8 @@ -# Changesets - -Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works -with multi-package repos, or single-package repos to help you version and publish your code. You can -find the full documentation for it [in our repository](https://github.com/changesets/changesets) - -We have a quick list of common questions to get you started engaging with this project in -[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) +# Changesets + +Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works +with multi-package repos, or single-package repos to help you version and publish your code. You can +find the full documentation for it [in our repository](https://github.com/changesets/changesets) + +We have a quick list of common questions to get you started engaging with this project in +[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) diff --git a/.changeset/config.json b/.changeset/config.json index a4ba8a296..8e57d89f7 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -1,11 +1,11 @@ -{ - "$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json", - "changelog": ["@changesets/changelog-github", { "repo": "themesberg/flowbite-react" }], - "commit": false, - "fixed": [], - "linked": [], - "access": "public", - "baseBranch": "main", - "updateInternalDependencies": "patch", - "ignore": ["storybook", "web"] -} +{ + "$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json", + "changelog": ["@changesets/changelog-github", { "repo": "themesberg/flowbite-react" }], + "commit": false, + "fixed": [], + "linked": [], + "access": "public", + "baseBranch": "main", + "updateInternalDependencies": "patch", + "ignore": ["storybook", "web"] +} diff --git a/.changeset/plenty-lemons-bow.md b/.changeset/plenty-lemons-bow.md index 29ebd753d..14307e4f7 100644 --- a/.changeset/plenty-lemons-bow.md +++ b/.changeset/plenty-lemons-bow.md @@ -1,5 +1,5 @@ ---- -"flowbite-react": patch ---- - -fix: autocomplete for string enums with dynamic value not working +--- +"flowbite-react": patch +--- + +fix: autocomplete for string enums with dynamic value not working diff --git a/.editorconfig b/.editorconfig index ae10a5cce..b2b5a4ae3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,10 +1,10 @@ -# editorconfig.org -root = true - -[*] -charset = utf-8 -end_of_line = lf -indent_size = 2 -indent_style = space -insert_final_newline = true -trim_trailing_whitespace = true +# editorconfig.org +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index 3abb837be..b05805c78 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -1,73 +1,73 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, gender identity and expression, level of experience, -education, socio-economic status, nationality, personal appearance, race, -religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -- Using welcoming and inclusive language -- Being respectful of differing viewpoints and experiences -- Gracefully accepting constructive criticism -- Focusing on what is best for the community -- Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -- The use of sexualized language or imagery and unwelcome sexual attention or - advances -- Trolling, insulting/derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or electronic - address, without explicit permission -- Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at {{ email }}. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html - -[homepage]: https://www.contributor-covenant.org +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +education, socio-economic status, nationality, personal appearance, race, +religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic + address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at {{ email }}. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index edd224e21..5dc0968bb 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,176 +1,176 @@ -# Contributing to flowbite-react - -First off, thanks for taking the time to contribute! ❤️ - -All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉 - -And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: - -- Star the project -- Tweet about it -- Refer this project in your project's readme -- Mention the project at local meetups and tell your friends/colleagues - -## Code of Conduct - -This project has adopted the [Contributor Covenant](https://www.contributor-covenant.org/) as its Code of Conduct. Everyone is expected to adhere to these rules, so please read the [full text](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). Thank you. - -## I Have a Question - -**If you want to ask a question, we assume that you have read the available [Documentation](https://flowbite-react.com/docs/getting-started/introduction).** - -Before you ask a question, it is best to search for existing [Issues](https://github.com/themesberg/flowbite-react/issues) that might help you. We also have a [Discord server](https://discord.gg/flowbite-902911619032576090) where you can ask questions and get help from the community directly. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. - -If you then still feel the need to ask a question and need clarification, we recommend the following: - -- Open an [Issue](https://github.com/themesberg/flowbite-react/issues/new). -- Follow the [Issue template](https://github.com/themesberg/flowbite-react/blob/main/.github/ISSUE_TEMPLATE/bug_report.md) and fill it out as completely as possible. Don't forget to: - - Provide as much context as you can about what you're running into. - - Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant. - -We will then take care of the issue as soon as possible. - -## I Want To Contribute - -### Legal Notice - -When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the [project license](https://github.com/themesberg/flowbite-react/blob/main/LICENSE). - -### Reporting Bugs - -#### Before Submitting a Bug Report - -A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. - -- Make sure that you are using the latest version. -- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](https://flowbite-react.com/docs/getting-started/introduction). If you are looking for support, you might want to check [this section](#i-have-a-question)). -- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/themesberg/flowbite-react/issues?q=label%3A%22%3Abug%3A+bug%22). -- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. -- Can you reliably reproduce the issue? And can you also reproduce it with older versions? - -#### How Do I Submit a Good Bug Report? - -We use GitHub issues to track bugs and errors. If you run into an issue with the project: - -- Open an [Issue](https://github.com/themesberg/flowbite-react/issues/new). -- Follow the [Issue template for bug reports](https://github.com/themesberg/flowbite-react/blob/main/.github/ISSUE_TEMPLATE/bug_report.md) to the best of your ability. - -Don't forget to: - -- Explain the behavior you would expect and the actual behavior. -- Please provide as much context as possible and describe the _reproduction steps_ that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. -- Provide the information you collected in the previous section. - -Once it's filed: - -- The project team will label the issue accordingly. -- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs info`. Bugs with the `needs info` tag will not be addressed until they are reproduced. -- If the team is able to reproduce the issue, it will be marked `confirmed`, as well as possibly other tags (such as `bug`, `help wanted`), and the issue will be left to be [implemented by someone](#your-first-code-contribution). - -### Suggesting Enhancements - -This section guides you through submitting an enhancement suggestion for flowbite-react, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. - -#### Before Submitting an Enhancement - -- Make sure that you are using the latest version. -- Read the [documentation](https://flowbite-react.com/docs/getting-started/introduction) carefully and find out if the functionality is already covered, maybe by an individual configuration. -- Perform a [search](https://github.com/themesberg/flowbite-react/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. -- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library. - -#### How Do I Submit a Good Enhancement Suggestion? - -Enhancement suggestions are tracked as [GitHub issues](https://github.com/themesberg/flowbite-react/issues). - -- Use a **clear and descriptive title** for the issue to identify the suggestion. -- Follow the [Issue template for feature requests](https://github.com/themesberg/flowbite-react/blob/main/.github/ISSUE_TEMPLATE/feature_request.md) to the best of your ability. - -Don't forget to: - -- Provide a **step-by-step description of the suggested enhancement** in as many details as possible. -- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. -- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux. -- **Explain why this enhancement would be useful** to most flowbite-react users. You may also want to point out the other projects that solved it better and which could serve as inspiration. - -### Your First Code Contribution - -#### Prerequisites - -- You need to understand how to use a terminal, `Git`, `Node.js`, and `Bun` -- You should be able to write `Markdown` and `React TypeScript` -- You should be familiar with `Tailwind` `CSS`, `ESLint`, and `Prettier` -- You should understand what [vitest](https://vitest.dev/) is, and be able to write tests if your contribution changes the behavior of the library in some way -- You should strongly consider using [Visual Studio Code](https://code.visualstudio.com/) as your editor, as it has plugins for `Tailwind CSS`, `ESLint`, and `Prettier` which will automatically fix most style issues for you, and offer suggestions for how to fix the rest - -#### Creating a Pull Request - -1. [Fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo) -2. Clone the fork and add a remote called `upstream`: - -```bash -git clone https://github.com//flowbite-react.git -cd flowbite-react -git remote add upstream https://github.com/themesberg/flowbite-react.git -``` - -3. Create a new branch named after your PR: - -```bash -git checkout -b fix/accordion-alwaysopen -``` - -4. Install dependencies with [`bun`](https://bun.sh/): - -```bash -bun install -``` - -5. Start a development server on your machine: - -```bash -bun run dev -``` - -6. Make sure your changes work and don't break anything else: - -```bash -bun run format && bun run lint:fix && bun run test && bun run build -``` - -7. Push to your forked repository - -```bash -git push -u origin fix/accordion-alwaysopen -``` - -8. Go to [the repository](https://github.com/themesberg/flowbite-react) and [create a Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) - -9. Fill out the Pull Request template, which will be available automatically - -#### What Happens Next? - -If you have followed the steps above, your Pull Request will be reviewed by a maintainer soon. If it passes review, it will be merged into the `main` branch and will be included in the next release. If not, you will receive feedback about what needs to be improved until it is ready to be merged. - -Please note that you will be expected to update the [documentation](https://flowbite-react.com/docs/getting-started/introduction) and write appropriate unit tests if your contribution changes the behavior of the library in some way. - -### Improving The Documentation - -The [documentation at flowbite-react.com](https://flowbite-react.com/docs/getting-started/introduction) can all be found inside the `app` folder of this repository. It's written in [Next.js](https://nextjs.org/), and we use [Markdown](https://www.markdownguide.org/cheat-sheet/) for almost all of the content, so you don't need to even be able to write React TypeScript to make documentation changes! - -## Styleguides - -### Files - -We use [Prettier](https://prettier.io/) to format all of our code. Please make sure to run `bun run format` before committing any changes. You can also use VS Code as your editor, and install the Prettier and Tailwind CSS IntelliSense plugins to automatically format your code each time you save. - -Please refer to the code written already in the project to see how we format our code, what naming conventions we use, and so on. The more consistent your code is with the rest of the project, the easier it will be to review and merge your Pull Request. - -### Branches & Pull Requests - -Please follow the same guidelines published by [commitizen](https://github.com/commitizen/cz-cli) when you name a branch that will be used for a Pull Request. The branch name should be prefixed with the most significant change that will be introduced in the Pull Request. - -For example, if you are fixing a bug in the accordion component, the branch name should be something like, `fix/accordion-does-x-wrong`. - -## Attribution - -This guide is based on the **contributing-gen**. [Make your own](https://github.com/bttger/contributing-gen)! +# Contributing to flowbite-react + +First off, thanks for taking the time to contribute! ❤️ + +All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. Please make sure to read the relevant section before making your contribution. It will make it a lot easier for us maintainers and smooth out the experience for all involved. The community looks forward to your contributions. 🎉 + +And if you like the project, but just don't have time to contribute, that's fine. There are other easy ways to support the project and show your appreciation, which we would also be very happy about: + +- Star the project +- Tweet about it +- Refer this project in your project's readme +- Mention the project at local meetups and tell your friends/colleagues + +## Code of Conduct + +This project has adopted the [Contributor Covenant](https://www.contributor-covenant.org/) as its Code of Conduct. Everyone is expected to adhere to these rules, so please read the [full text](https://www.contributor-covenant.org/version/2/1/code_of_conduct/). Thank you. + +## I Have a Question + +**If you want to ask a question, we assume that you have read the available [Documentation](https://flowbite-react.com/docs/getting-started/introduction).** + +Before you ask a question, it is best to search for existing [Issues](https://github.com/themesberg/flowbite-react/issues) that might help you. We also have a [Discord server](https://discord.gg/flowbite-902911619032576090) where you can ask questions and get help from the community directly. In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. + +If you then still feel the need to ask a question and need clarification, we recommend the following: + +- Open an [Issue](https://github.com/themesberg/flowbite-react/issues/new). +- Follow the [Issue template](https://github.com/themesberg/flowbite-react/blob/main/.github/ISSUE_TEMPLATE/bug_report.md) and fill it out as completely as possible. Don't forget to: + - Provide as much context as you can about what you're running into. + - Provide project and platform versions (nodejs, npm, etc), depending on what seems relevant. + +We will then take care of the issue as soon as possible. + +## I Want To Contribute + +### Legal Notice + +When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the [project license](https://github.com/themesberg/flowbite-react/blob/main/LICENSE). + +### Reporting Bugs + +#### Before Submitting a Bug Report + +A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. + +- Make sure that you are using the latest version. +- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [documentation](https://flowbite-react.com/docs/getting-started/introduction). If you are looking for support, you might want to check [this section](#i-have-a-question)). +- To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the [bug tracker](https://github.com/themesberg/flowbite-react/issues?q=label%3A%22%3Abug%3A+bug%22). +- Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. +- Can you reliably reproduce the issue? And can you also reproduce it with older versions? + +#### How Do I Submit a Good Bug Report? + +We use GitHub issues to track bugs and errors. If you run into an issue with the project: + +- Open an [Issue](https://github.com/themesberg/flowbite-react/issues/new). +- Follow the [Issue template for bug reports](https://github.com/themesberg/flowbite-react/blob/main/.github/ISSUE_TEMPLATE/bug_report.md) to the best of your ability. + +Don't forget to: + +- Explain the behavior you would expect and the actual behavior. +- Please provide as much context as possible and describe the _reproduction steps_ that someone else can follow to recreate the issue on their own. This usually includes your code. For good bug reports you should isolate the problem and create a reduced test case. +- Provide the information you collected in the previous section. + +Once it's filed: + +- The project team will label the issue accordingly. +- A team member will try to reproduce the issue with your provided steps. If there are no reproduction steps or no obvious way to reproduce the issue, the team will ask you for those steps and mark the issue as `needs info`. Bugs with the `needs info` tag will not be addressed until they are reproduced. +- If the team is able to reproduce the issue, it will be marked `confirmed`, as well as possibly other tags (such as `bug`, `help wanted`), and the issue will be left to be [implemented by someone](#your-first-code-contribution). + +### Suggesting Enhancements + +This section guides you through submitting an enhancement suggestion for flowbite-react, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. + +#### Before Submitting an Enhancement + +- Make sure that you are using the latest version. +- Read the [documentation](https://flowbite-react.com/docs/getting-started/introduction) carefully and find out if the functionality is already covered, maybe by an individual configuration. +- Perform a [search](https://github.com/themesberg/flowbite-react/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. +- Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library. + +#### How Do I Submit a Good Enhancement Suggestion? + +Enhancement suggestions are tracked as [GitHub issues](https://github.com/themesberg/flowbite-react/issues). + +- Use a **clear and descriptive title** for the issue to identify the suggestion. +- Follow the [Issue template for feature requests](https://github.com/themesberg/flowbite-react/blob/main/.github/ISSUE_TEMPLATE/feature_request.md) to the best of your ability. + +Don't forget to: + +- Provide a **step-by-step description of the suggested enhancement** in as many details as possible. +- **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. +- You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux. +- **Explain why this enhancement would be useful** to most flowbite-react users. You may also want to point out the other projects that solved it better and which could serve as inspiration. + +### Your First Code Contribution + +#### Prerequisites + +- You need to understand how to use a terminal, `Git`, `Node.js`, and `Bun` +- You should be able to write `Markdown` and `React TypeScript` +- You should be familiar with `Tailwind` `CSS`, `ESLint`, and `Prettier` +- You should understand what [vitest](https://vitest.dev/) is, and be able to write tests if your contribution changes the behavior of the library in some way +- You should strongly consider using [Visual Studio Code](https://code.visualstudio.com/) as your editor, as it has plugins for `Tailwind CSS`, `ESLint`, and `Prettier` which will automatically fix most style issues for you, and offer suggestions for how to fix the rest + +#### Creating a Pull Request + +1. [Fork the repository](https://docs.github.com/en/get-started/quickstart/fork-a-repo) +2. Clone the fork and add a remote called `upstream`: + +```bash +git clone https://github.com//flowbite-react.git +cd flowbite-react +git remote add upstream https://github.com/themesberg/flowbite-react.git +``` + +3. Create a new branch named after your PR: + +```bash +git checkout -b fix/accordion-alwaysopen +``` + +4. Install dependencies with [`bun`](https://bun.sh/): + +```bash +bun install +``` + +5. Start a development server on your machine: + +```bash +bun run dev +``` + +6. Make sure your changes work and don't break anything else: + +```bash +bun run format && bun run lint:fix && bun run test && bun run build +``` + +7. Push to your forked repository + +```bash +git push -u origin fix/accordion-alwaysopen +``` + +8. Go to [the repository](https://github.com/themesberg/flowbite-react) and [create a Pull Request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) + +9. Fill out the Pull Request template, which will be available automatically + +#### What Happens Next? + +If you have followed the steps above, your Pull Request will be reviewed by a maintainer soon. If it passes review, it will be merged into the `main` branch and will be included in the next release. If not, you will receive feedback about what needs to be improved until it is ready to be merged. + +Please note that you will be expected to update the [documentation](https://flowbite-react.com/docs/getting-started/introduction) and write appropriate unit tests if your contribution changes the behavior of the library in some way. + +### Improving The Documentation + +The [documentation at flowbite-react.com](https://flowbite-react.com/docs/getting-started/introduction) can all be found inside the `app` folder of this repository. It's written in [Next.js](https://nextjs.org/), and we use [Markdown](https://www.markdownguide.org/cheat-sheet/) for almost all of the content, so you don't need to even be able to write React TypeScript to make documentation changes! + +## Styleguides + +### Files + +We use [Prettier](https://prettier.io/) to format all of our code. Please make sure to run `bun run format` before committing any changes. You can also use VS Code as your editor, and install the Prettier and Tailwind CSS IntelliSense plugins to automatically format your code each time you save. + +Please refer to the code written already in the project to see how we format our code, what naming conventions we use, and so on. The more consistent your code is with the rest of the project, the easier it will be to review and merge your Pull Request. + +### Branches & Pull Requests + +Please follow the same guidelines published by [commitizen](https://github.com/commitizen/cz-cli) when you name a branch that will be used for a Pull Request. The branch name should be prefixed with the most significant change that will be introduced in the Pull Request. + +For example, if you are fixing a bug in the accordion component, the branch name should be something like, `fix/accordion-does-x-wrong`. + +## Attribution + +This guide is based on the **contributing-gen**. [Make your own](https://github.com/bttger/contributing-gen)! diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 2e357e5f1..9d499affa 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,3 @@ -# These are supported funding model platforms - -github: [rluders, tulup-conner, SutuSebastian] +# These are supported funding model platforms + +github: [rluders, tulup-conner, SutuSebastian] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index d9dac3677..1a9092312 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,27 +1,27 @@ ---- -name: Bug report -about: Report a bug in Flowbite React ---- - -- [ ] I have searched the [Issues](https://github.com/themesberg/flowbite-react/issues) to see if this bug has already been reported -- [ ] I have tested the latest version - -## Steps to reproduce - -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' - -## Current behavior - -Describe what is currently happening and why it's a problem. - -## Expected behavior - -Describe what you expected to happen. - -## Context - -What are you trying to accomplish? Does this only happen on a specific browser, screen size, or operating system? - -If possible, provide a live example URL, screenshot, video, or a repository with the minimal reproduction of the issue. +--- +name: Bug report +about: Report a bug in Flowbite React +--- + +- [ ] I have searched the [Issues](https://github.com/themesberg/flowbite-react/issues) to see if this bug has already been reported +- [ ] I have tested the latest version + +## Steps to reproduce + +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' + +## Current behavior + +Describe what is currently happening and why it's a problem. + +## Expected behavior + +Describe what you expected to happen. + +## Context + +What are you trying to accomplish? Does this only happen on a specific browser, screen size, or operating system? + +If possible, provide a live example URL, screenshot, video, or a repository with the minimal reproduction of the issue. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index e2a20a2e3..da5403c39 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -1,15 +1,15 @@ ---- -name: Feature request -about: Suggest an idea for Flowbite React ---- - -- [ ] I have searched the [Issues](https://github.com/themesberg/flowbite-react/issues) to see if this bug has already been reported -- [ ] I have tested the latest version - -## Summary - -Describe how it should work, and provide examples of the solution, which might include screenshots or code snippets. - -## Context - -What are you trying to accomplish? How is your use case affected by not having this feature? +--- +name: Feature request +about: Suggest an idea for Flowbite React +--- + +- [ ] I have searched the [Issues](https://github.com/themesberg/flowbite-react/issues) to see if this bug has already been reported +- [ ] I have tested the latest version + +## Summary + +Describe how it should work, and provide examples of the solution, which might include screenshots or code snippets. + +## Context + +What are you trying to accomplish? How is your use case affected by not having this feature? diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 899a97634..03123f031 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,7 +1,7 @@ -- [ ] I have followed the [Your First Code Contribution section of the Contributing guide](https://github.com/themesberg/flowbite-react/blob/main/CONTRIBUTING.md#your-first-code-contribution) - -Summarize the changes made and the motivation behind them. - -Reference related issues using `#` followed by the issue number. - -If there are breaking API changes - like adding or removing props, or changing the structure of the theme - describe them, and provide steps to update existing code. +- [ ] I have followed the [Your First Code Contribution section of the Contributing guide](https://github.com/themesberg/flowbite-react/blob/main/CONTRIBUTING.md#your-first-code-contribution) + +Summarize the changes made and the motivation behind them. + +Reference related issues using `#` followed by the issue number. + +If there are breaking API changes - like adding or removing props, or changing the structure of the theme - describe them, and provide steps to update existing code. diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 00926bafa..e779a92a0 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -1,19 +1,19 @@ -name: Setup -description: Setup Bun, Node and install packages - -runs: - using: composite - steps: - - name: Setup Bun - uses: oven-sh/setup-bun@v1 - with: - bun-version: 1.1.21 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 20 - - - name: Install packages - shell: bash - run: bun install +name: Setup +description: Setup Bun, Node and install packages + +runs: + using: composite + steps: + - name: Setup Bun + uses: oven-sh/setup-bun@v1 + with: + bun-version: 1.1.21 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Install packages + shell: bash + run: bun install diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2d9e2e24..9747eddff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,72 +1,72 @@ -name: CI - -on: - pull_request: - branches: - - main - -jobs: - format: - name: 💅 Format - runs-on: ubuntu-latest - steps: - - name: Checkout branch - uses: actions/checkout@v4 - - - name: Setup - uses: ./.github/actions/setup - - - name: Run format - run: bun run format:check - - lint: - name: 🕵 Lint - runs-on: ubuntu-latest - steps: - - name: Checkout branch - uses: actions/checkout@v4 - - - name: Setup - uses: ./.github/actions/setup - - - name: Run lint - run: bun run lint - - typecheck: - name: ✅ Typecheck - runs-on: ubuntu-latest - steps: - - name: Checkout branch - uses: actions/checkout@v4 - - - name: Setup - uses: ./.github/actions/setup - - - name: Run typecheck - run: bun run typecheck - - test: - name: 🔬 Test - runs-on: ubuntu-latest - steps: - - name: Checkout branch - uses: actions/checkout@v4 - - - name: Setup - uses: ./.github/actions/setup - - - name: Run unit tests - run: bun run test:coverage - - build: - name: 🧰 Build - runs-on: ubuntu-latest - steps: - - name: Checkout branch - uses: actions/checkout@v4 - - - name: Setup - uses: ./.github/actions/setup - - - name: Run build - run: bun run build +name: CI + +on: + pull_request: + branches: + - main + +jobs: + format: + name: 💅 Format + runs-on: ubuntu-latest + steps: + - name: Checkout branch + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Run format + run: bun run format:check + + lint: + name: 🕵 Lint + runs-on: ubuntu-latest + steps: + - name: Checkout branch + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Run lint + run: bun run lint + + typecheck: + name: ✅ Typecheck + runs-on: ubuntu-latest + steps: + - name: Checkout branch + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Run typecheck + run: bun run typecheck + + test: + name: 🔬 Test + runs-on: ubuntu-latest + steps: + - name: Checkout branch + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Run unit tests + run: bun run test:coverage + + build: + name: 🧰 Build + runs-on: ubuntu-latest + steps: + - name: Checkout branch + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Run build + run: bun run build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 344331497..707b304ca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,28 +1,28 @@ -name: Release - -on: - push: - branches: - - main - -concurrency: ${{ github.workflow }}-${{ github.ref }} - -jobs: - release: - name: Release - runs-on: ubuntu-latest - steps: - - name: Checkout branch - uses: actions/checkout@v4 - - - name: Setup - uses: ./.github/actions/setup - - - name: Create Release Pull Request or Publish to NPM - id: changesets - uses: changesets/action@v1 - with: - publish: bun run release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} +name: Release + +on: + push: + branches: + - main + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout branch + uses: actions/checkout@v4 + + - name: Setup + uses: ./.github/actions/setup + + - name: Create Release Pull Request or Publish to NPM + id: changesets + uses: changesets/action@v1 + with: + publish: bun run release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index 95c165173..86b442a91 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,13 @@ -# dependencies -node_modules - -# misc -.DS_Store -*.backup -*.pem - -# typescript -tsconfig.tsbuildinfo - -# turbo -.turbo +# dependencies +node_modules + +# misc +.DS_Store +*.backup +*.pem + +# typescript +tsconfig.tsbuildinfo + +# turbo +.turbo diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 7ceb3b627..447895bb6 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,11 +1,11 @@ -{ - "recommendations": [ - "oven.bun-vscode", - "esbenp.prettier-vscode", - "dbaeumer.vscode-eslint", - "yoavbls.pretty-ts-errors", - "bradlc.vscode-tailwindcss", - "unifiedjs.vscode-mdx", - "DavidAnson.vscode-markdownlint" - ] -} +{ + "recommendations": [ + "oven.bun-vscode", + "esbenp.prettier-vscode", + "dbaeumer.vscode-eslint", + "yoavbls.pretty-ts-errors", + "bradlc.vscode-tailwindcss", + "unifiedjs.vscode-mdx", + "DavidAnson.vscode-markdownlint" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 8dbffc577..9e50fde82 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,18 +1,18 @@ -{ - "editor.codeActionsOnSave": { - "source.fixAll.eslint": "explicit" - }, - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true, - "eslint.workingDirectories": ["apps/web", "packages/ui"], - "tailwindCSS.classAttributes": ["class", "className", "theme"], - "tailwindCSS.experimental.classRegex": [ - ["twMerge\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"], - ["createTheme\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"] - ], - "tailwindCSS.experimental.configFile": { - "apps/web/tailwind.config.cjs": "apps/web/**", - "packages/ui/tailwind.config.cjs": "packages/ui/**" - }, - "typescript.tsdk": "node_modules/typescript/lib" -} +{ + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit" + }, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + "eslint.workingDirectories": ["apps/web", "packages/ui"], + "tailwindCSS.classAttributes": ["class", "className", "theme"], + "tailwindCSS.experimental.classRegex": [ + ["twMerge\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"], + ["createTheme\\(([^)]*)\\)", "[\"'`]([^\"'`]*).*?[\"'`]"] + ], + "tailwindCSS.experimental.configFile": { + "apps/web/tailwind.config.cjs": "apps/web/**", + "packages/ui/tailwind.config.cjs": "packages/ui/**" + }, + "typescript.tsdk": "node_modules/typescript/lib" +} diff --git a/LICENSE b/LICENSE index 5164b9225..4ff375d68 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,21 @@ -MIT License - -Copyright (c) 2024 Bergside Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +MIT License + +Copyright (c) 2024 Bergside Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/apps/storybook/.gitignore b/apps/storybook/.gitignore index 20687473b..6140bddfb 100644 --- a/apps/storybook/.gitignore +++ b/apps/storybook/.gitignore @@ -1 +1 @@ -storybook-static +storybook-static diff --git a/apps/storybook/.storybook/main.ts b/apps/storybook/.storybook/main.ts index 2daa674b2..cc08efcc5 100644 --- a/apps/storybook/.storybook/main.ts +++ b/apps/storybook/.storybook/main.ts @@ -1,28 +1,28 @@ -import { dirname, join } from "path"; -import type { StorybookConfig } from "@storybook/react-vite"; - -/** - * This function is used to resolve the absolute path of a package. - * It is needed in projects that use Yarn PnP or are set up within a monorepo. - */ - -function getAbsolutePath(value: string): any { - return dirname(require.resolve(join(value, "package.json"))); -} -const config: StorybookConfig = { - stories: ["../../../packages/ui/**/*.stories.@(ts|tsx)"], - addons: [ - getAbsolutePath("@storybook/addon-links"), - getAbsolutePath("@storybook/addon-essentials"), - getAbsolutePath("@storybook/addon-interactions"), - getAbsolutePath("@storybook/addon-themes"), - ], - framework: { - name: getAbsolutePath("@storybook/react-vite"), - options: {}, - }, - docs: { - autodocs: "tag", - }, -}; -export default config; +import { dirname, join } from "path"; +import type { StorybookConfig } from "@storybook/react-vite"; + +/** + * This function is used to resolve the absolute path of a package. + * It is needed in projects that use Yarn PnP or are set up within a monorepo. + */ + +function getAbsolutePath(value: string): any { + return dirname(require.resolve(join(value, "package.json"))); +} +const config: StorybookConfig = { + stories: ["../../../packages/ui/**/*.stories.@(ts|tsx)"], + addons: [ + getAbsolutePath("@storybook/addon-links"), + getAbsolutePath("@storybook/addon-essentials"), + getAbsolutePath("@storybook/addon-interactions"), + getAbsolutePath("@storybook/addon-themes"), + ], + framework: { + name: getAbsolutePath("@storybook/react-vite"), + options: {}, + }, + docs: { + autodocs: "tag", + }, +}; +export default config; diff --git a/apps/storybook/.storybook/preview.ts b/apps/storybook/.storybook/preview.ts index bd89877ad..5e19d2999 100644 --- a/apps/storybook/.storybook/preview.ts +++ b/apps/storybook/.storybook/preview.ts @@ -1,30 +1,30 @@ -import { withThemeByClassName } from "@storybook/addon-themes"; -import type { Preview } from "@storybook/react"; - -import "./style.css"; - -const preview: Preview = { - parameters: { - actions: { - argTypesRegex: "^on[A-Z].*", - }, - controls: { - matchers: { - color: /(background|color)$/i, - date: /Date$/i, - }, - }, - }, -}; - -export const decorators = [ - withThemeByClassName({ - themes: { - light: "light", - dark: "dark", - }, - defaultTheme: "light", - }), -]; - -export default preview; +import { withThemeByClassName } from "@storybook/addon-themes"; +import type { Preview } from "@storybook/react"; + +import "./style.css"; + +const preview: Preview = { + parameters: { + actions: { + argTypesRegex: "^on[A-Z].*", + }, + controls: { + matchers: { + color: /(background|color)$/i, + date: /Date$/i, + }, + }, + }, +}; + +export const decorators = [ + withThemeByClassName({ + themes: { + light: "light", + dark: "dark", + }, + defaultTheme: "light", + }), +]; + +export default preview; diff --git a/apps/storybook/.storybook/style.css b/apps/storybook/.storybook/style.css index d69619447..5df2f7e98 100644 --- a/apps/storybook/.storybook/style.css +++ b/apps/storybook/.storybook/style.css @@ -1,20 +1,20 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -@layer base { - @font-face { - font-family: "Inter"; - src: url(inter.woff2) format("woff2"); - font-weight: 100 200 300 400 500 600 700 800 900; - font-display: swap; - } - - html { - font-family: "Inter", sans-serif; - } - - html.dark { - background-color: #101827; - } -} +@tailwind base; +@tailwind components; +@tailwind utilities; + +@layer base { + @font-face { + font-family: "Inter"; + src: url(inter.woff2) format("woff2"); + font-weight: 100 200 300 400 500 600 700 800 900; + font-display: swap; + } + + html { + font-family: "Inter", sans-serif; + } + + html.dark { + background-color: #101827; + } +} diff --git a/apps/storybook/package.json b/apps/storybook/package.json index 09201890d..2563d7f85 100644 --- a/apps/storybook/package.json +++ b/apps/storybook/package.json @@ -1,36 +1,36 @@ -{ - "name": "storybook", - "version": "0.0.0", - "private": true, - "scripts": { - "build": "storybook build", - "clean": "rimraf .turbo node_modules storybook-static", - "dev": "storybook dev -p 6006", - "format": "prettier . --write", - "format:check": "prettier . --check", - "typecheck": "tsc --noEmit" - }, - "dependencies": { - "react": "18.3.1", - "react-dom": "18.3.1" - }, - "devDependencies": { - "@storybook/addon-essentials": "8.1.10", - "@storybook/addon-interactions": "8.1.10", - "@storybook/addon-links": "8.1.10", - "@storybook/addon-themes": "8.1.10", - "@storybook/blocks": "8.1.10", - "@storybook/react": "8.1.10", - "@storybook/react-vite": "8.1.10", - "@storybook/test": "8.1.10", - "@types/react": "18.3.3", - "@types/react-dom": "18.3.0", - "@vitejs/plugin-react": "4.3.1", - "autoprefixer": "10.4.20", - "postcss": "8.4.41", - "storybook": "8.1.10", - "tailwindcss": "3.4.7", - "typescript": "5.5.4", - "vite": "5.3.5" - } -} +{ + "name": "storybook", + "version": "0.0.0", + "private": true, + "scripts": { + "build": "storybook build", + "clean": "rimraf .turbo node_modules storybook-static", + "dev": "storybook dev -p 6006", + "format": "prettier . --write", + "format:check": "prettier . --check", + "typecheck": "tsc --noEmit" + }, + "dependencies": { + "react": "18.3.1", + "react-dom": "18.3.1" + }, + "devDependencies": { + "@storybook/addon-essentials": "8.1.10", + "@storybook/addon-interactions": "8.1.10", + "@storybook/addon-links": "8.1.10", + "@storybook/addon-themes": "8.1.10", + "@storybook/blocks": "8.1.10", + "@storybook/react": "8.1.10", + "@storybook/react-vite": "8.1.10", + "@storybook/test": "8.1.10", + "@types/react": "18.3.3", + "@types/react-dom": "18.3.0", + "@vitejs/plugin-react": "4.3.1", + "autoprefixer": "10.4.20", + "postcss": "8.4.41", + "storybook": "8.1.10", + "tailwindcss": "3.4.7", + "typescript": "5.5.4", + "vite": "5.3.5" + } +} diff --git a/apps/storybook/postcss.config.cjs b/apps/storybook/postcss.config.cjs index 12a703d90..a1b36d24e 100644 --- a/apps/storybook/postcss.config.cjs +++ b/apps/storybook/postcss.config.cjs @@ -1,6 +1,6 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -}; +module.exports = { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +}; diff --git a/apps/storybook/tailwind.config.cjs b/apps/storybook/tailwind.config.cjs index a0e0fe2be..5a6811a3c 100644 --- a/apps/storybook/tailwind.config.cjs +++ b/apps/storybook/tailwind.config.cjs @@ -1,8 +1,8 @@ -/** @type {import('tailwindcss').Config} */ -module.exports = { - content: ["../../packages/ui/src/**/*.{ts,tsx}"], - theme: { - extend: {}, - }, - plugins: [require("flowbite/plugin")], -}; +/** @type {import('tailwindcss').Config} */ +module.exports = { + content: ["../../packages/ui/src/**/*.{ts,tsx}"], + theme: { + extend: {}, + }, + plugins: [require("flowbite/plugin")], +}; diff --git a/apps/storybook/tsconfig.json b/apps/storybook/tsconfig.json index a7fc6fbf2..9bdaa778c 100644 --- a/apps/storybook/tsconfig.json +++ b/apps/storybook/tsconfig.json @@ -1,25 +1,25 @@ -{ - "compilerOptions": { - "target": "ES2020", - "useDefineForClassFields": true, - "lib": ["ES2020", "DOM", "DOM.Iterable"], - "module": "ESNext", - "skipLibCheck": true, - - /* Bundler mode */ - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react-jsx", - - /* Linting */ - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true - }, - "include": ["src"], - "references": [{ "path": "./tsconfig.node.json" }] -} +{ + "compilerOptions": { + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "resolveJsonModule": true, + "isolatedModules": true, + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true + }, + "include": ["src"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/apps/storybook/tsconfig.node.json b/apps/storybook/tsconfig.node.json index 42872c59f..165a9ba72 100644 --- a/apps/storybook/tsconfig.node.json +++ b/apps/storybook/tsconfig.node.json @@ -1,10 +1,10 @@ -{ - "compilerOptions": { - "composite": true, - "skipLibCheck": true, - "module": "ESNext", - "moduleResolution": "bundler", - "allowSyntheticDefaultImports": true - }, - "include": ["vite.config.ts"] -} +{ + "compilerOptions": { + "composite": true, + "skipLibCheck": true, + "module": "ESNext", + "moduleResolution": "bundler", + "allowSyntheticDefaultImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/apps/storybook/turbo.json b/apps/storybook/turbo.json index 5da1fb4c5..b741fcc8f 100644 --- a/apps/storybook/turbo.json +++ b/apps/storybook/turbo.json @@ -1,8 +1,8 @@ -{ - "extends": ["//"], - "tasks": { - "build": { - "outputs": ["storybook-static/**"] - } - } -} +{ + "extends": ["//"], + "tasks": { + "build": { + "outputs": ["storybook-static/**"] + } + } +} diff --git a/apps/storybook/vite.config.mjs b/apps/storybook/vite.config.mjs index 58676f788..592620177 100644 --- a/apps/storybook/vite.config.mjs +++ b/apps/storybook/vite.config.mjs @@ -1,6 +1,6 @@ -import react from "@vitejs/plugin-react"; -import { defineConfig } from "vite"; - -export default defineConfig({ - plugins: [react()], -}); +import react from "@vitejs/plugin-react"; +import { defineConfig } from "vite"; + +export default defineConfig({ + plugins: [react()], +}); diff --git a/apps/web/.eslintrc.cjs b/apps/web/.eslintrc.cjs index 9bde37089..c6eebdb91 100644 --- a/apps/web/.eslintrc.cjs +++ b/apps/web/.eslintrc.cjs @@ -1,24 +1,24 @@ -/** @type {import("eslint").Linter.Config} */ -module.exports = { - root: true, - extends: ["next/core-web-vitals", "plugin:tailwindcss/recommended", "prettier"], - settings: { - tailwindcss: { - callees: ["twMerge", "createTheme"], - classRegex: "^(class(Name)|theme)?$", - }, - }, - rules: { - "react/no-unescaped-entities": "off", - "tailwindcss/classnames-order": "off", - }, - overrides: [ - { - files: ["examples/**"], - rules: { - "@next/next/no-img-element": "off", - "tailwindcss/enforces-shorthand": "off", - }, - }, - ], -}; +/** @type {import("eslint").Linter.Config} */ +module.exports = { + root: true, + extends: ["next/core-web-vitals", "plugin:tailwindcss/recommended", "prettier"], + settings: { + tailwindcss: { + callees: ["twMerge", "createTheme"], + classRegex: "^(class(Name)|theme)?$", + }, + }, + rules: { + "react/no-unescaped-entities": "off", + "tailwindcss/classnames-order": "off", + }, + overrides: [ + { + files: ["examples/**"], + rules: { + "@next/next/no-img-element": "off", + "tailwindcss/enforces-shorthand": "off", + }, + }, + ], +}; diff --git a/apps/web/.gitignore b/apps/web/.gitignore index f833c17ee..b90345789 100644 --- a/apps/web/.gitignore +++ b/apps/web/.gitignore @@ -1,12 +1,12 @@ -# next.js -.next -out - -# production -build - -# vercel -.vercel - -# contentlayer -.contentlayer +# next.js +.next +out + +# production +build + +# vercel +.vercel + +# contentlayer +.contentlayer diff --git a/apps/web/app/docs/[[...slug]]/page.tsx b/apps/web/app/docs/[[...slug]]/page.tsx index 20f7bdfca..306c0f248 100644 --- a/apps/web/app/docs/[[...slug]]/page.tsx +++ b/apps/web/app/docs/[[...slug]]/page.tsx @@ -1,165 +1,165 @@ -import { allDocs, type Doc } from "contentlayer/generated"; -import type { Metadata } from "next"; -import Link from "next/link"; -import { notFound } from "next/navigation"; -import Markdown from "react-markdown"; -import { CarbonAds } from "~/components/carbon-ads"; -import { Mdx } from "~/components/mdx"; -import { DOCS_SIDEBAR } from "~/data/docs-sidebar"; - -interface Props { - params: { - slug: string[]; - }; -} - -function getDoc({ params }: Props) { - const slug = params.slug?.join("/") || ""; - - return allDocs.find((doc) => doc.url === slug); -} - -export function generateMetadata({ params }: Props): Metadata { - const doc = getDoc({ params }); - - if (!doc) return {}; - - return { - title: doc.title, - description: doc.description, - openGraph: { - type: "article", - title: doc.title, - description: doc.description, - images: "https://flowbite.s3.amazonaws.com/github/flowbite-react.png", - }, - twitter: { - card: "summary_large_image", - title: doc.title, - description: doc.description, - images: ["https://flowbite.s3.amazonaws.com/github/flowbite-react.png"], - }, - }; -} - -export function generateStaticParams() { - return allDocs.map((doc) => ({ slug: doc.url.split("/") })); -} - -export default function DocPage({ params }: Props) { - const doc = getDoc({ params }); - - if (!doc) notFound(); - - return ( -
-
-
- - - -
- - -
- -
- ); -} - -interface ContentLayoutProps { - title: string; - description: string; - children: React.ReactNode; -} - -function ContentLayout({ title, description, children }: ContentLayoutProps) { - return ( -
-
-

- {title} -

-

{description}

-
-
- {children} -
-
- ); -} - -function DocsPager({ doc }: { doc: Doc }) { - const DOCS_SIDEBAR_ITEMS = DOCS_SIDEBAR.flatMap((section) => section.items); - const currentDocIndex = DOCS_SIDEBAR_ITEMS.findIndex((item) => item.href === `/${doc._raw.flattenedPath}`); - const prevDoc = DOCS_SIDEBAR_ITEMS[currentDocIndex - 1]; - const nextDoc = DOCS_SIDEBAR_ITEMS[currentDocIndex + 1]; - - return ( - - ); -} - -function ToC({ doc }: { doc: Doc }) { - return ( -
-
-
-

- On this page -

- -
-
-
- ); -} +import { allDocs, type Doc } from "contentlayer/generated"; +import type { Metadata } from "next"; +import Link from "next/link"; +import { notFound } from "next/navigation"; +import Markdown from "react-markdown"; +import { CarbonAds } from "~/components/carbon-ads"; +import { Mdx } from "~/components/mdx"; +import { DOCS_SIDEBAR } from "~/data/docs-sidebar"; + +interface Props { + params: { + slug: string[]; + }; +} + +function getDoc({ params }: Props) { + const slug = params.slug?.join("/") || ""; + + return allDocs.find((doc) => doc.url === slug); +} + +export function generateMetadata({ params }: Props): Metadata { + const doc = getDoc({ params }); + + if (!doc) return {}; + + return { + title: doc.title, + description: doc.description, + openGraph: { + type: "article", + title: doc.title, + description: doc.description, + images: "https://flowbite.s3.amazonaws.com/github/flowbite-react.png", + }, + twitter: { + card: "summary_large_image", + title: doc.title, + description: doc.description, + images: ["https://flowbite.s3.amazonaws.com/github/flowbite-react.png"], + }, + }; +} + +export function generateStaticParams() { + return allDocs.map((doc) => ({ slug: doc.url.split("/") })); +} + +export default function DocPage({ params }: Props) { + const doc = getDoc({ params }); + + if (!doc) notFound(); + + return ( +
+
+
+ + + +
+ + +
+ +
+ ); +} + +interface ContentLayoutProps { + title: string; + description: string; + children: React.ReactNode; +} + +function ContentLayout({ title, description, children }: ContentLayoutProps) { + return ( +
+
+

+ {title} +

+

{description}

+
+
+ {children} +
+
+ ); +} + +function DocsPager({ doc }: { doc: Doc }) { + const DOCS_SIDEBAR_ITEMS = DOCS_SIDEBAR.flatMap((section) => section.items); + const currentDocIndex = DOCS_SIDEBAR_ITEMS.findIndex((item) => item.href === `/${doc._raw.flattenedPath}`); + const prevDoc = DOCS_SIDEBAR_ITEMS[currentDocIndex - 1]; + const nextDoc = DOCS_SIDEBAR_ITEMS[currentDocIndex + 1]; + + return ( + + ); +} + +function ToC({ doc }: { doc: Doc }) { + return ( +
+
+
+

+ On this page +

+ +
+
+
+ ); +} diff --git a/apps/web/app/docs/layout.tsx b/apps/web/app/docs/layout.tsx index f775c337a..d104cb3c5 100644 --- a/apps/web/app/docs/layout.tsx +++ b/apps/web/app/docs/layout.tsx @@ -1,192 +1,192 @@ -"use client"; - -import { Navbar } from "flowbite-react"; -import Image from "next/image"; -import Link from "next/link"; -import { usePathname } from "next/navigation"; -import type { PropsWithChildren } from "react"; -import { useEffect, useState } from "react"; -import { HiMenuAlt1, HiX } from "react-icons/hi"; -import { twMerge } from "tailwind-merge"; -import { DocSearchInput } from "~/components/docsearch-input"; -import { MainFooter } from "~/components/main-footer"; -import { NavbarIcons, NavbarLinks } from "~/components/navbar"; -import { DOCS_SIDEBAR, type DocsSidebarItem } from "~/data/docs-sidebar"; - -import "~/styles/docs.css"; - -interface DocsLayoutState { - isCollapsed: boolean; - setCollapsed: (collapsed: boolean) => void; -} - -export default function DocsLayout({ children }: PropsWithChildren) { - const [isCollapsed, setCollapsed] = useState(true); - - const state: DocsLayoutState = { - isCollapsed, - setCollapsed, - }; - - return ( -
-
- {/* */} - -
- -
{children}
-
- -
-
- ); -} - -function DocsNavbar({ isCollapsed, setCollapsed }: DocsLayoutState) { - return ( - -
- {isCollapsed ? ( - - ) : ( - - )} - - Flowbite React logo - Flowbite React - -
- -
-
-
- - -
-
- ); -} - -function DocsSidebar({ isCollapsed, setCollapsed }: DocsLayoutState) { - const pathname = usePathname(); - - // collapse sidebar on small screens when navigating to a new page - useEffect(() => { - if (typeof window !== "undefined" && window.innerWidth < 768) { - setCollapsed(true); - } - }, [pathname, setCollapsed]); - - return ( - <> -
- -
- {!isCollapsed && ( -
setCollapsed(true)} - onKeyUp={(key) => key.code === "Escape" && setCollapsed(true)} - className="fixed inset-0 z-40 bg-gray-900/50 lg:hidden dark:bg-gray-900/60" - /> - )} - - ); -} - -function SidebarSection({ title, children }: PropsWithChildren<{ title: string }>) { - return ( -
  • -
    - {title} -
    -
      {children}
    -
  • - ); -} - -function SidebarItem({ title, href, isNew, isExternal, onClick }: DocsSidebarItem & { onClick(): void }) { - return ( -
  • - - {isNew ? {title} : title} - -
  • - ); -} - -function SidebarLink({ - children, - href, - isExternal, - onClick, -}: PropsWithChildren<{ href: string; isExternal?: boolean; onClick(): void }>) { - const pathname = usePathname(); - - return ( - - {children} - - ); -} - -function NewBadge({ children }: PropsWithChildren) { - return ( - - {children} - - new - - - ); -} +"use client"; + +import { Navbar } from "flowbite-react"; +import Image from "next/image"; +import Link from "next/link"; +import { usePathname } from "next/navigation"; +import type { PropsWithChildren } from "react"; +import { useEffect, useState } from "react"; +import { HiMenuAlt1, HiX } from "react-icons/hi"; +import { twMerge } from "tailwind-merge"; +import { DocSearchInput } from "~/components/docsearch-input"; +import { MainFooter } from "~/components/main-footer"; +import { NavbarIcons, NavbarLinks } from "~/components/navbar"; +import { DOCS_SIDEBAR, type DocsSidebarItem } from "~/data/docs-sidebar"; + +import "~/styles/docs.css"; + +interface DocsLayoutState { + isCollapsed: boolean; + setCollapsed: (collapsed: boolean) => void; +} + +export default function DocsLayout({ children }: PropsWithChildren) { + const [isCollapsed, setCollapsed] = useState(true); + + const state: DocsLayoutState = { + isCollapsed, + setCollapsed, + }; + + return ( +
    +
    + {/* */} + +
    + +
    {children}
    +
    + +
    +
    + ); +} + +function DocsNavbar({ isCollapsed, setCollapsed }: DocsLayoutState) { + return ( + +
    + {isCollapsed ? ( + + ) : ( + + )} + + Flowbite React logo + Flowbite React + +
    + +
    +
    +
    + + +
    +
    + ); +} + +function DocsSidebar({ isCollapsed, setCollapsed }: DocsLayoutState) { + const pathname = usePathname(); + + // collapse sidebar on small screens when navigating to a new page + useEffect(() => { + if (typeof window !== "undefined" && window.innerWidth < 768) { + setCollapsed(true); + } + }, [pathname, setCollapsed]); + + return ( + <> +
    + +
    + {!isCollapsed && ( +
    setCollapsed(true)} + onKeyUp={(key) => key.code === "Escape" && setCollapsed(true)} + className="fixed inset-0 z-40 bg-gray-900/50 lg:hidden dark:bg-gray-900/60" + /> + )} + + ); +} + +function SidebarSection({ title, children }: PropsWithChildren<{ title: string }>) { + return ( +
  • +
    + {title} +
    +
      {children}
    +
  • + ); +} + +function SidebarItem({ title, href, isNew, isExternal, onClick }: DocsSidebarItem & { onClick(): void }) { + return ( +
  • + + {isNew ? {title} : title} + +
  • + ); +} + +function SidebarLink({ + children, + href, + isExternal, + onClick, +}: PropsWithChildren<{ href: string; isExternal?: boolean; onClick(): void }>) { + const pathname = usePathname(); + + return ( + + {children} + + ); +} + +function NewBadge({ children }: PropsWithChildren) { + return ( + + {children} + + new + + + ); +} diff --git a/apps/web/app/examples/[name]/layout.tsx b/apps/web/app/examples/[name]/layout.tsx index 1ed424f75..75e95c777 100644 --- a/apps/web/app/examples/[name]/layout.tsx +++ b/apps/web/app/examples/[name]/layout.tsx @@ -1,12 +1,12 @@ -"use client"; - -import { useSearchParams } from "next/navigation"; -import type { PropsWithChildren } from "react"; -import { twMerge } from "tailwind-merge"; - -export default function ExamplePageLayout({ children }: PropsWithChildren) { - const searchParams = useSearchParams(); - const noPadding = searchParams.get("noPadding"); - - return
    {children}
    ; -} +"use client"; + +import { useSearchParams } from "next/navigation"; +import type { PropsWithChildren } from "react"; +import { twMerge } from "tailwind-merge"; + +export default function ExamplePageLayout({ children }: PropsWithChildren) { + const searchParams = useSearchParams(); + const noPadding = searchParams.get("noPadding"); + + return
    {children}
    ; +} diff --git a/apps/web/app/examples/[name]/page.tsx b/apps/web/app/examples/[name]/page.tsx index 08b0bb22d..86de2ddec 100644 --- a/apps/web/app/examples/[name]/page.tsx +++ b/apps/web/app/examples/[name]/page.tsx @@ -1,19 +1,19 @@ -import { notFound } from "next/navigation"; - -interface Props { - params: { - name: string; - }; -} - -export default async function ExamplePage({ params }: Props) { - try { - const [key] = params.name.split("."); - - const { Component } = await import(`~/examples/${key}/${params.name}`); - - return Component ? : notFound(); - } catch (e) { - notFound(); - } -} +import { notFound } from "next/navigation"; + +interface Props { + params: { + name: string; + }; +} + +export default async function ExamplePage({ params }: Props) { + try { + const [key] = params.name.split("."); + + const { Component } = await import(`~/examples/${key}/${params.name}`); + + return Component ? : notFound(); + } catch (e) { + notFound(); + } +} diff --git a/apps/web/app/layout.tsx b/apps/web/app/layout.tsx index 2e851f266..f66331e6d 100644 --- a/apps/web/app/layout.tsx +++ b/apps/web/app/layout.tsx @@ -1,68 +1,68 @@ -import { ThemeModeScript } from "flowbite-react"; -import { Inter as InterFont } from "next/font/google"; -import type { Metadata, Viewport } from "next/types"; -import type { PropsWithChildren } from "react"; -import { FathomScript } from "~/components/fathom-script"; - -import "~/styles/globals.css"; - -const interFont = InterFont({ - subsets: ["latin"], - variable: "--font-inter", -}); - -export const metadata: Metadata = { - description: - "Flowbite React is an open-source UI component library built with React components, Tailwind CSS utility classes and based on the Flowbite design system and components.", - icons: { - icon: [ - { url: "/favicon-32x32.png", type: "image/png", sizes: "32x32" }, - { url: "/favicon-16x16.png", type: "image/png", sizes: "16x16" }, - ], - shortcut: "/favicon.ico", - apple: [{ url: "/apple-touch-icon.png", sizes: "180x180" }], - }, - manifest: "/site.webmanifest", - other: { - charSet: "utf-8", - lang: "en", - }, - title: "Flowbite React - UI Component Library", - openGraph: { - description: - "Flowbite React is an open-source UI component library built with React components, Tailwind CSS utility classes and based on the Flowbite design system and components.", - images: "https://flowbite.s3.amazonaws.com/github/flowbite-react.png", - title: "Flowbite React - UI Component Library", - }, - twitter: { - card: "summary_large_image", - title: "Flowbite React - UI component library", - description: - "Flowbite React is an open-source UI component library built with React components, Tailwind CSS utility classes and based on the Flowbite design system and components.", - creator: "@zoltanszogyenyi", - images: ["https://flowbite.s3.amazonaws.com/github/flowbite-react.png"], - }, -}; - -export const viewport: Viewport = { - width: "device-width", - initialScale: 1, - themeColor: [ - { media: "(prefers-color-scheme: light)", color: "#ffffff" }, - { media: "(prefers-color-scheme: dark)", color: "#1f2937" }, - ], -}; - -export default function RootLayout({ children }: PropsWithChildren) { - return ( - - - - - - {children} - - - - ); -} +import { ThemeModeScript } from "flowbite-react"; +import { Inter as InterFont } from "next/font/google"; +import type { Metadata, Viewport } from "next/types"; +import type { PropsWithChildren } from "react"; +import { FathomScript } from "~/components/fathom-script"; + +import "~/styles/globals.css"; + +const interFont = InterFont({ + subsets: ["latin"], + variable: "--font-inter", +}); + +export const metadata: Metadata = { + description: + "Flowbite React is an open-source UI component library built with React components, Tailwind CSS utility classes and based on the Flowbite design system and components.", + icons: { + icon: [ + { url: "/favicon-32x32.png", type: "image/png", sizes: "32x32" }, + { url: "/favicon-16x16.png", type: "image/png", sizes: "16x16" }, + ], + shortcut: "/favicon.ico", + apple: [{ url: "/apple-touch-icon.png", sizes: "180x180" }], + }, + manifest: "/site.webmanifest", + other: { + charSet: "utf-8", + lang: "en", + }, + title: "Flowbite React - UI Component Library", + openGraph: { + description: + "Flowbite React is an open-source UI component library built with React components, Tailwind CSS utility classes and based on the Flowbite design system and components.", + images: "https://flowbite.s3.amazonaws.com/github/flowbite-react.png", + title: "Flowbite React - UI Component Library", + }, + twitter: { + card: "summary_large_image", + title: "Flowbite React - UI component library", + description: + "Flowbite React is an open-source UI component library built with React components, Tailwind CSS utility classes and based on the Flowbite design system and components.", + creator: "@zoltanszogyenyi", + images: ["https://flowbite.s3.amazonaws.com/github/flowbite-react.png"], + }, +}; + +export const viewport: Viewport = { + width: "device-width", + initialScale: 1, + themeColor: [ + { media: "(prefers-color-scheme: light)", color: "#ffffff" }, + { media: "(prefers-color-scheme: dark)", color: "#1f2937" }, + ], +}; + +export default function RootLayout({ children }: PropsWithChildren) { + return ( + + + + + + {children} + + + + ); +} diff --git a/apps/web/app/not-found.tsx b/apps/web/app/not-found.tsx index f3b2d42f7..a318467fe 100644 --- a/apps/web/app/not-found.tsx +++ b/apps/web/app/not-found.tsx @@ -1,17 +1,17 @@ -import { HomeNavbar } from "~/components/homepage"; -import { MainFooter } from "~/components/main-footer"; - -export default function NotFoundPage() { - return ( -
    - -
    -

    404 - Page Not Found

    -

    - Whoops! That page doesn’t exist. But do not fret, check out our other resources to get started. -

    -
    - -
    - ); -} +import { HomeNavbar } from "~/components/homepage"; +import { MainFooter } from "~/components/main-footer"; + +export default function NotFoundPage() { + return ( +
    + +
    +

    404 - Page Not Found

    +

    + Whoops! That page doesn’t exist. But do not fret, check out our other resources to get started. +

    +
    + +
    + ); +} diff --git a/apps/web/app/page.tsx b/apps/web/app/page.tsx index dfb6d2c50..041ba1642 100644 --- a/apps/web/app/page.tsx +++ b/apps/web/app/page.tsx @@ -1,34 +1,34 @@ -import { - ComponentsSection, - ContributorsSection, - DarkModeSection, - FeaturedSection, - FigmaSection, - HeroSection, - HomeNavbar, - ReactSection, - SocialProofSection, - TailwindSection, -} from "~/components/homepage"; -import { MainFooter } from "~/components/main-footer"; - -export default function HomePage() { - return ( -
    - {/* */} - -
    - - - - - - - - - -
    - -
    - ); -} +import { + ComponentsSection, + ContributorsSection, + DarkModeSection, + FeaturedSection, + FigmaSection, + HeroSection, + HomeNavbar, + ReactSection, + SocialProofSection, + TailwindSection, +} from "~/components/homepage"; +import { MainFooter } from "~/components/main-footer"; + +export default function HomePage() { + return ( +
    + {/* */} + +
    + + + + + + + + + +
    + +
    + ); +} diff --git a/apps/web/components/banner.tsx b/apps/web/components/banner.tsx index d8bf6f479..bc2d45b1d 100644 --- a/apps/web/components/banner.tsx +++ b/apps/web/components/banner.tsx @@ -1,40 +1,40 @@ -import Link from "next/link"; - -export function Banner() { - return ( -
    -
    -

    - - New - - Flowbite React now supports Server Components and has full Next.js App Router support! - - Check it out - - -

    -
    -
    - ); -} +import Link from "next/link"; + +export function Banner() { + return ( +
    +
    +

    + + New + + Flowbite React now supports Server Components and has full Next.js App Router support! + + Check it out + + +

    +
    +
    + ); +} diff --git a/apps/web/components/carbon-ads.tsx b/apps/web/components/carbon-ads.tsx index 14603bb6e..6de1166c4 100644 --- a/apps/web/components/carbon-ads.tsx +++ b/apps/web/components/carbon-ads.tsx @@ -1,40 +1,40 @@ -"use client"; - -import { usePathname } from "next/navigation"; -import { useEffect } from "react"; - -interface WindowWithCarbonAds extends Window { - _carbonads: { - refresh: () => void; - }; -} - -export function CarbonAds() { - const pathname = usePathname(); - - const isDevelopmentMode = process.env.NODE_ENV === "development"; - - useEffect(() => { - const isCarbonAdsRendered = document.querySelector("#carbonads"); - - if (isCarbonAdsRendered) { - (window as unknown as WindowWithCarbonAds)._carbonads.refresh(); - } else { - const script = document.createElement("script"); - script.async = true; - script.id = "_carbonads_js"; - script.src = "//cdn.carbonads.com/carbon.js?serve=CEAIC53L&placement=flowbite-reactcom"; - - const container = document.querySelector("#carbon-container"); - if (container) { - container.appendChild(script); - } - } - }, [pathname]); - - return isDevelopmentMode ? null : ( - - ); -} +"use client"; + +import { usePathname } from "next/navigation"; +import { useEffect } from "react"; + +interface WindowWithCarbonAds extends Window { + _carbonads: { + refresh: () => void; + }; +} + +export function CarbonAds() { + const pathname = usePathname(); + + const isDevelopmentMode = process.env.NODE_ENV === "development"; + + useEffect(() => { + const isCarbonAdsRendered = document.querySelector("#carbonads"); + + if (isCarbonAdsRendered) { + (window as unknown as WindowWithCarbonAds)._carbonads.refresh(); + } else { + const script = document.createElement("script"); + script.async = true; + script.id = "_carbonads_js"; + script.src = "//cdn.carbonads.com/carbon.js?serve=CEAIC53L&placement=flowbite-reactcom"; + + const container = document.querySelector("#carbon-container"); + if (container) { + container.appendChild(script); + } + } + }, [pathname]); + + return isDevelopmentMode ? null : ( + + ); +} diff --git a/apps/web/components/code-demo.tsx b/apps/web/components/code-demo.tsx index b83d0465c..34fdb7a6a 100644 --- a/apps/web/components/code-demo.tsx +++ b/apps/web/components/code-demo.tsx @@ -1,387 +1,387 @@ -"use client"; - -import { Select, Tooltip, useThemeMode } from "flowbite-react"; -import type { ComponentProps, PropsWithChildren } from "react"; -import { useEffect, useRef, useState } from "react"; -import type { IconType } from "react-icons"; -import { FaCopy } from "react-icons/fa"; -import { HiMoon, HiSun } from "react-icons/hi"; -import { HiMiniDeviceTablet } from "react-icons/hi2"; -import { PiDesktop } from "react-icons/pi"; -import { TfiMobile } from "react-icons/tfi"; -import { twMerge } from "tailwind-merge"; -import { CodeHighlight, type Language } from "./code-highlight"; - -type IFrameData = number | IFrameOptions; - -interface IFrameOptions { - height: number; - noPadding?: boolean; -} - -interface BaseCodeData { - type: T; - githubSlug: string; - component: React.ReactNode; - iframe?: IFrameData; -} - -interface VariantCodeData extends BaseCodeData<"variant"> { - variant: V; - code: CodeVariant; -} - -interface SingleCodeData extends BaseCodeData<"single"> { - code: Code; -} - -interface CodeItem { - fileName: string; - language: Language; - code: string; -} - -type Variant = string; -type CodeVariant = Record; -type Code = CodeItem | [CodeItem, ...CodeItem[]]; - -export type CodeData = SingleCodeData | VariantCodeData; - -type View = "desktop" | "tablet" | "mobile"; - -interface CodeDemoProps { - data: CodeData; -} - -export function CodeDemo({ data }: CodeDemoProps) { - const { computedMode } = useThemeMode(); - - const [tabIndex, setTabIndex] = useState(0); - const [variant, setVariant] = useState(getInitialVariant(data)); - - const [view, setView] = useState("desktop"); - const [isRTL, setIsRTL] = useState(false); - const [isDarkMode, setDarkMode] = useState(null); - const [isExpanded, setExpanded] = useState(false); - const [isJustCopied, setJustCopied] = useState(false); - - useEffect(() => setDarkMode(computedMode === "dark"), [computedMode]); - - function copyToClipboard(value: string) { - setJustCopied(true); - navigator.clipboard.writeText(value); - setTimeout(() => setJustCopied(false), 2000); - } - - function getInitialVariant(data: CodeData): Variant { - if (data.type === "variant") return data.variant; - - return ""; - } - - function getVariants(data: CodeData): Variant[] { - if (data.type === "variant") return Object.keys(data.code); - - return []; - } - - function getCode(data: CodeData, variant: Variant): Code { - if (data.type === "variant") return data.code[variant]; - - return data.code; - } - - function getCodeItems(code: Code): CodeItem[] { - return Array.isArray(code) ? code : [code]; - } - - function getCurrent(items: CodeItem[], index: number): CodeItem { - return items[index]; - } - - function handleSelectVariant(variant: Variant) { - setTabIndex(0); - setVariant(variant); - } - - function getShouldExpand(rawCode: string) { - const rem = 16; - const offset = 41; // expand/collapse button height - const padding = 28; - const maxHeight = 18 * rem + offset; // mirror `max-h-72` - const codeHeight = getTextHeight(rawCode) + padding; - - return codeHeight > maxHeight; - } - - function getTextHeight(value: string) { - const fontSize = 16.5; - const lineHeight = 1.25; - - return countLines(value) * fontSize * lineHeight; - } - - function countLines(value: string) { - return (value.match(/\n/g) || "").length + 1; - } - - const variants = getVariants(data); - const code = getCode(data, variant); - const codeItems = getCodeItems(code); - const current = getCurrent(codeItems, tabIndex); - const shouldExpand = getShouldExpand(current.code.trim()); - - return ( -
    -
    -
    - - -
    - setIsRTL((state) => !state)} /> - setDarkMode((state) => !state)} /> -
    -
    -
    - - {data.iframe ?