@gv-tech/design-system 2.5.0 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/package.json +5 -2
- package/.agent/skills/dogfood-components/SKILL.md +0 -34
- package/.agent/skills/maintain-component/SKILL.md +0 -77
- package/.agent/workflows/native-playground.md +0 -93
- package/.github/CODEOWNERS +0 -2
- package/.github/CONTRIBUTING.md +0 -42
- package/.github/FUNDING.yml +0 -4
- package/.github/PULL_REQUEST_TEMPLATE/build.md +0 -5
- package/.github/PULL_REQUEST_TEMPLATE/standard.md +0 -3
- package/.github/RELEASING.md +0 -37
- package/.github/copilot-instructions.md +0 -61
- package/.github/workflows/ci.yml +0 -91
- package/.github/workflows/codeql-analysis.yml +0 -34
- package/.github/workflows/release-please.yml +0 -79
- package/.husky/pre-commit +0 -1
- package/.prettierignore +0 -3
- package/.release-please-manifest.json +0 -9
- package/.tool-versions +0 -1
- package/.vscode/launch.json +0 -22
- package/.vscode/mcp.json +0 -8
- package/.vscode/settings.json +0 -30
- package/.yarnrc.yml +0 -7
- package/SECURITY.md +0 -9
- package/apps/.gitkeep +0 -0
- package/apps/native-playground/CHANGELOG.md +0 -8
- package/apps/native-playground/app.json +0 -37
- package/apps/native-playground/assets/fonts/.gitkeep +0 -0
- package/apps/native-playground/assets/images/adaptive-icon.png +0 -0
- package/apps/native-playground/assets/images/favicon.png +0 -0
- package/apps/native-playground/assets/images/icon.png +0 -0
- package/apps/native-playground/assets/images/splash-icon.png +0 -0
- package/apps/native-playground/babel.config.js +0 -6
- package/apps/native-playground/eas.json +0 -25
- package/apps/native-playground/index.js +0 -8
- package/apps/native-playground/metro.config.js +0 -26
- package/apps/native-playground/nativewind-env.d.ts +0 -1
- package/apps/native-playground/package.json +0 -23
- package/apps/native-playground/project.json +0 -15
- package/apps/native-playground/src/app/App.tsx +0 -842
- package/apps/native-playground/src/global.css +0 -49
- package/apps/native-playground/tailwind.config.js +0 -49
- package/apps/native-playground/tsconfig.app.json +0 -24
- package/apps/native-playground/tsconfig.json +0 -23
- package/apps/native-playground/tsconfig.spec.json +0 -24
- package/apps/playground-web/CHANGELOG.md +0 -8
- package/apps/playground-web/index.html +0 -13
- package/apps/playground-web/package.json +0 -31
- package/apps/playground-web/public/favicon.png +0 -0
- package/apps/playground-web/public/index.demo.html +0 -40
- package/apps/playground-web/public/logo192.png +0 -0
- package/apps/playground-web/public/logo512.png +0 -0
- package/apps/playground-web/public/manifest.json +0 -25
- package/apps/playground-web/public/robots.txt +0 -2
- package/apps/playground-web/src/App.tsx +0 -179
- package/apps/playground-web/src/components/docs/CodeBlock.tsx +0 -34
- package/apps/playground-web/src/components/docs/CombinedDocsLayout.tsx +0 -103
- package/apps/playground-web/src/components/docs/ComponentShowcase.tsx +0 -96
- package/apps/playground-web/src/components/docs/ErrorBoundary.tsx +0 -55
- package/apps/playground-web/src/components/docs/Footer.tsx +0 -146
- package/apps/playground-web/src/components/docs/PropsTable.tsx +0 -43
- package/apps/playground-web/src/components/docs/Search.tsx +0 -75
- package/apps/playground-web/src/components/docs/Sidebar.tsx +0 -77
- package/apps/playground-web/src/components/docs/ThemeToggle.tsx +0 -19
- package/apps/playground-web/src/components/docs/index.ts +0 -9
- package/apps/playground-web/src/config/docs.ts +0 -293
- package/apps/playground-web/src/globals.css +0 -148
- package/apps/playground-web/src/hooks/useDocMetadata.ts +0 -34
- package/apps/playground-web/src/hooks/usePackageManager.tsx +0 -42
- package/apps/playground-web/src/lib/react-native-shim.js +0 -34
- package/apps/playground-web/src/main.tsx +0 -11
- package/apps/playground-web/src/pages/index.ts +0 -4
- package/apps/playground-web/src/pages/native/AccordionDocs.tsx +0 -85
- package/apps/playground-web/src/pages/native/AlertDialogDocs.tsx +0 -128
- package/apps/playground-web/src/pages/native/AlertDocs.tsx +0 -89
- package/apps/playground-web/src/pages/native/AspectRatioDocs.tsx +0 -52
- package/apps/playground-web/src/pages/native/AvatarDocs.tsx +0 -92
- package/apps/playground-web/src/pages/native/BadgeDocs.tsx +0 -63
- package/apps/playground-web/src/pages/native/BreadcrumbDocs.tsx +0 -71
- package/apps/playground-web/src/pages/native/ButtonDocs.tsx +0 -103
- package/apps/playground-web/src/pages/native/CalendarDocs.tsx +0 -74
- package/apps/playground-web/src/pages/native/CardDocs.tsx +0 -75
- package/apps/playground-web/src/pages/native/CarouselDocs.tsx +0 -113
- package/apps/playground-web/src/pages/native/ChartDocs.tsx +0 -115
- package/apps/playground-web/src/pages/native/CheckboxDocs.tsx +0 -38
- package/apps/playground-web/src/pages/native/CollapsibleDocs.tsx +0 -89
- package/apps/playground-web/src/pages/native/CommandDocs.tsx +0 -170
- package/apps/playground-web/src/pages/native/ContextMenuDocs.tsx +0 -121
- package/apps/playground-web/src/pages/native/DialogDocs.tsx +0 -132
- package/apps/playground-web/src/pages/native/DrawerDocs.tsx +0 -158
- package/apps/playground-web/src/pages/native/DropdownMenuDocs.tsx +0 -168
- package/apps/playground-web/src/pages/native/HoverCardDocs.tsx +0 -119
- package/apps/playground-web/src/pages/native/InputDocs.tsx +0 -86
- package/apps/playground-web/src/pages/native/LabelDocs.tsx +0 -55
- package/apps/playground-web/src/pages/native/MenubarDocs.tsx +0 -197
- package/apps/playground-web/src/pages/native/NavigationMenuDocs.tsx +0 -190
- package/apps/playground-web/src/pages/native/PaginationDocs.tsx +0 -70
- package/apps/playground-web/src/pages/native/PopoverDocs.tsx +0 -156
- package/apps/playground-web/src/pages/native/ProgressDocs.tsx +0 -61
- package/apps/playground-web/src/pages/native/RadioGroupDocs.tsx +0 -125
- package/apps/playground-web/src/pages/native/ResizableDocs.tsx +0 -118
- package/apps/playground-web/src/pages/native/ScrollAreaDocs.tsx +0 -92
- package/apps/playground-web/src/pages/native/SearchDocs.tsx +0 -150
- package/apps/playground-web/src/pages/native/SelectDocs.tsx +0 -141
- package/apps/playground-web/src/pages/native/SeparatorDocs.tsx +0 -72
- package/apps/playground-web/src/pages/native/SheetDocs.tsx +0 -140
- package/apps/playground-web/src/pages/native/SkeletonDocs.tsx +0 -44
- package/apps/playground-web/src/pages/native/SliderDocs.tsx +0 -118
- package/apps/playground-web/src/pages/native/SonnerDocs.tsx +0 -111
- package/apps/playground-web/src/pages/native/SwitchDocs.tsx +0 -87
- package/apps/playground-web/src/pages/native/TableDocs.tsx +0 -67
- package/apps/playground-web/src/pages/native/TabsDocs.tsx +0 -175
- package/apps/playground-web/src/pages/native/TextareaDocs.tsx +0 -61
- package/apps/playground-web/src/pages/native/ThemeToggleDocs.tsx +0 -288
- package/apps/playground-web/src/pages/native/ToastDocs.tsx +0 -124
- package/apps/playground-web/src/pages/native/ToggleDocs.tsx +0 -81
- package/apps/playground-web/src/pages/native/ToggleGroupDocs.tsx +0 -128
- package/apps/playground-web/src/pages/native/TooltipDocs.tsx +0 -140
- package/apps/playground-web/src/pages/native/index.ts +0 -47
- package/apps/playground-web/src/pages/shared/ColorTokensDocs.tsx +0 -234
- package/apps/playground-web/src/pages/shared/GettingStarted.tsx +0 -413
- package/apps/playground-web/src/pages/web/AccordionDocs.tsx +0 -194
- package/apps/playground-web/src/pages/web/AlertDialogDocs.tsx +0 -157
- package/apps/playground-web/src/pages/web/AlertDocs.tsx +0 -110
- package/apps/playground-web/src/pages/web/AspectRatioDocs.tsx +0 -94
- package/apps/playground-web/src/pages/web/AvatarDocs.tsx +0 -81
- package/apps/playground-web/src/pages/web/BadgeDocs.tsx +0 -66
- package/apps/playground-web/src/pages/web/BreadcrumbDocs.tsx +0 -93
- package/apps/playground-web/src/pages/web/ButtonDocs.tsx +0 -129
- package/apps/playground-web/src/pages/web/CalendarDocs.tsx +0 -78
- package/apps/playground-web/src/pages/web/CardDocs.tsx +0 -115
- package/apps/playground-web/src/pages/web/CarouselDocs.tsx +0 -176
- package/apps/playground-web/src/pages/web/ChartDocs.tsx +0 -151
- package/apps/playground-web/src/pages/web/CheckboxDocs.tsx +0 -95
- package/apps/playground-web/src/pages/web/CollapsibleDocs.tsx +0 -111
- package/apps/playground-web/src/pages/web/CommandDocs.tsx +0 -219
- package/apps/playground-web/src/pages/web/ContextMenuDocs.tsx +0 -164
- package/apps/playground-web/src/pages/web/DialogDocs.tsx +0 -175
- package/apps/playground-web/src/pages/web/DrawerDocs.tsx +0 -283
- package/apps/playground-web/src/pages/web/DropdownMenuDocs.tsx +0 -319
- package/apps/playground-web/src/pages/web/FormDocs.tsx +0 -175
- package/apps/playground-web/src/pages/web/HoverCardDocs.tsx +0 -151
- package/apps/playground-web/src/pages/web/InputDocs.tsx +0 -118
- package/apps/playground-web/src/pages/web/LabelDocs.tsx +0 -59
- package/apps/playground-web/src/pages/web/MenubarDocs.tsx +0 -296
- package/apps/playground-web/src/pages/web/NavigationMenuDocs.tsx +0 -263
- package/apps/playground-web/src/pages/web/PaginationDocs.tsx +0 -102
- package/apps/playground-web/src/pages/web/PopoverDocs.tsx +0 -189
- package/apps/playground-web/src/pages/web/ProgressDocs.tsx +0 -70
- package/apps/playground-web/src/pages/web/RadioGroupDocs.tsx +0 -137
- package/apps/playground-web/src/pages/web/ResizableDocs.tsx +0 -143
- package/apps/playground-web/src/pages/web/ScrollAreaDocs.tsx +0 -107
- package/apps/playground-web/src/pages/web/SearchDocs.tsx +0 -203
- package/apps/playground-web/src/pages/web/SelectDocs.tsx +0 -164
- package/apps/playground-web/src/pages/web/SeparatorDocs.tsx +0 -88
- package/apps/playground-web/src/pages/web/SheetDocs.tsx +0 -186
- package/apps/playground-web/src/pages/web/SkeletonDocs.tsx +0 -53
- package/apps/playground-web/src/pages/web/SliderDocs.tsx +0 -119
- package/apps/playground-web/src/pages/web/SonnerDocs.tsx +0 -126
- package/apps/playground-web/src/pages/web/SwitchDocs.tsx +0 -91
- package/apps/playground-web/src/pages/web/TableDocs.tsx +0 -148
- package/apps/playground-web/src/pages/web/TabsDocs.tsx +0 -241
- package/apps/playground-web/src/pages/web/TextareaDocs.tsx +0 -65
- package/apps/playground-web/src/pages/web/ThemeToggleDocs.tsx +0 -303
- package/apps/playground-web/src/pages/web/ToastDocs.tsx +0 -149
- package/apps/playground-web/src/pages/web/ToggleDocs.tsx +0 -85
- package/apps/playground-web/src/pages/web/ToggleGroupDocs.tsx +0 -140
- package/apps/playground-web/src/pages/web/TooltipDocs.tsx +0 -150
- package/apps/playground-web/src/pages/web/index.ts +0 -47
- package/apps/playground-web/src/routes/doc-routes.tsx +0 -363
- package/apps/playground-web/tailwind.config.js +0 -47
- package/apps/playground-web/tsconfig.app.json +0 -16
- package/apps/playground-web/tsconfig.json +0 -4
- package/apps/playground-web/tsconfig.node.json +0 -13
- package/apps/playground-web/vite.config.ts +0 -41
- package/components.json +0 -20
- package/docs/architecture-pivot.md +0 -165
- package/docs/native-setup-decision.md +0 -57
- package/docs/phase-1-tracker.md +0 -144
- package/docs/release-tooling-evaluation.md +0 -67
- package/docs/universal-implementation.md +0 -195
- package/docs/update-plan.md +0 -268
- package/eslint.config.mjs +0 -13
- package/nx.json +0 -50
- package/packages/.gitkeep +0 -0
- package/packages/design-tokens/CHANGELOG.md +0 -8
- package/packages/design-tokens/package.json +0 -20
- package/packages/design-tokens/src/index.ts +0 -35
- package/packages/design-tokens/src/palette.ts +0 -36
- package/packages/design-tokens/src/radii.ts +0 -26
- package/packages/design-tokens/src/shadows.ts +0 -16
- package/packages/design-tokens/src/spacing.ts +0 -33
- package/packages/design-tokens/src/theme.ts +0 -54
- package/packages/design-tokens/src/typography.ts +0 -36
- package/packages/design-tokens/tsconfig.json +0 -17
- package/packages/ui-core/CHANGELOG.md +0 -8
- package/packages/ui-core/package.json +0 -40
- package/packages/ui-core/src/contracts/accordion.ts +0 -23
- package/packages/ui-core/src/contracts/alert-dialog.ts +0 -48
- package/packages/ui-core/src/contracts/alert.ts +0 -17
- package/packages/ui-core/src/contracts/aspect-ratio.ts +0 -7
- package/packages/ui-core/src/contracts/avatar.ts +0 -17
- package/packages/ui-core/src/contracts/badge.ts +0 -7
- package/packages/ui-core/src/contracts/breadcrumb.ts +0 -37
- package/packages/ui-core/src/contracts/button.ts +0 -17
- package/packages/ui-core/src/contracts/calendar.ts +0 -4
- package/packages/ui-core/src/contracts/card.ts +0 -11
- package/packages/ui-core/src/contracts/carousel.ts +0 -29
- package/packages/ui-core/src/contracts/chart.ts +0 -31
- package/packages/ui-core/src/contracts/checkbox.ts +0 -11
- package/packages/ui-core/src/contracts/collapsible.ts +0 -21
- package/packages/ui-core/src/contracts/command.ts +0 -43
- package/packages/ui-core/src/contracts/context-menu.ts +0 -78
- package/packages/ui-core/src/contracts/dialog.ts +0 -29
- package/packages/ui-core/src/contracts/drawer.ts +0 -39
- package/packages/ui-core/src/contracts/dropdown-menu.ts +0 -87
- package/packages/ui-core/src/contracts/form.ts +0 -29
- package/packages/ui-core/src/contracts/hover-card.ts +0 -21
- package/packages/ui-core/src/contracts/input.ts +0 -11
- package/packages/ui-core/src/contracts/label.ts +0 -7
- package/packages/ui-core/src/contracts/menubar.ts +0 -86
- package/packages/ui-core/src/contracts/navigation-menu.ts +0 -55
- package/packages/ui-core/src/contracts/pagination.ts +0 -38
- package/packages/ui-core/src/contracts/popover.ts +0 -28
- package/packages/ui-core/src/contracts/progress.ts +0 -4
- package/packages/ui-core/src/contracts/radio.ts +0 -16
- package/packages/ui-core/src/contracts/resizable.ts +0 -36
- package/packages/ui-core/src/contracts/scroll-area.ts +0 -15
- package/packages/ui-core/src/contracts/search.ts +0 -13
- package/packages/ui-core/src/contracts/select.ts +0 -64
- package/packages/ui-core/src/contracts/separator.ts +0 -5
- package/packages/ui-core/src/contracts/sheet.ts +0 -58
- package/packages/ui-core/src/contracts/skeleton.ts +0 -6
- package/packages/ui-core/src/contracts/slider.ts +0 -15
- package/packages/ui-core/src/contracts/sonner.ts +0 -15
- package/packages/ui-core/src/contracts/switch.ts +0 -11
- package/packages/ui-core/src/contracts/table.ts +0 -41
- package/packages/ui-core/src/contracts/tabs.ts +0 -31
- package/packages/ui-core/src/contracts/text.ts +0 -12
- package/packages/ui-core/src/contracts/textarea.ts +0 -7
- package/packages/ui-core/src/contracts/theme-provider.ts +0 -14
- package/packages/ui-core/src/contracts/theme-toggle.ts +0 -15
- package/packages/ui-core/src/contracts/toast.ts +0 -15
- package/packages/ui-core/src/contracts/toaster.ts +0 -3
- package/packages/ui-core/src/contracts/toggle-group.ts +0 -23
- package/packages/ui-core/src/contracts/toggle.ts +0 -49
- package/packages/ui-core/src/contracts/tooltip.ts +0 -28
- package/packages/ui-core/src/index.ts +0 -327
- package/packages/ui-core/tsconfig.json +0 -18
- package/packages/ui-native/CHANGELOG.md +0 -8
- package/packages/ui-native/package.json +0 -76
- package/packages/ui-native/src/accordion.tsx +0 -93
- package/packages/ui-native/src/alert-dialog.tsx +0 -123
- package/packages/ui-native/src/alert.tsx +0 -50
- package/packages/ui-native/src/aspect-ratio.tsx +0 -9
- package/packages/ui-native/src/avatar.tsx +0 -38
- package/packages/ui-native/src/badge.tsx +0 -51
- package/packages/ui-native/src/breadcrumb.tsx +0 -9
- package/packages/ui-native/src/button.test.tsx +0 -27
- package/packages/ui-native/src/button.tsx +0 -75
- package/packages/ui-native/src/calendar.tsx +0 -9
- package/packages/ui-native/src/card.test.tsx +0 -33
- package/packages/ui-native/src/card.tsx +0 -56
- package/packages/ui-native/src/carousel.tsx +0 -9
- package/packages/ui-native/src/chart.tsx +0 -9
- package/packages/ui-native/src/checkbox.test.tsx +0 -58
- package/packages/ui-native/src/checkbox.tsx +0 -31
- package/packages/ui-native/src/collapsible.test.tsx +0 -50
- package/packages/ui-native/src/collapsible.tsx +0 -15
- package/packages/ui-native/src/command.tsx +0 -9
- package/packages/ui-native/src/context-menu.tsx +0 -9
- package/packages/ui-native/src/dialog.test.tsx +0 -91
- package/packages/ui-native/src/dialog.tsx +0 -121
- package/packages/ui-native/src/drawer.tsx +0 -9
- package/packages/ui-native/src/dropdown-menu.tsx +0 -9
- package/packages/ui-native/src/form.tsx +0 -9
- package/packages/ui-native/src/hover-card.tsx +0 -9
- package/packages/ui-native/src/index.ts +0 -209
- package/packages/ui-native/src/input.test.tsx +0 -27
- package/packages/ui-native/src/input.tsx +0 -27
- package/packages/ui-native/src/label.tsx +0 -29
- package/packages/ui-native/src/lib/render-native.tsx +0 -17
- package/packages/ui-native/src/lib/utils.ts +0 -6
- package/packages/ui-native/src/menubar.tsx +0 -9
- package/packages/ui-native/src/nativewind-env.d.ts +0 -1
- package/packages/ui-native/src/navigation-menu.tsx +0 -9
- package/packages/ui-native/src/pagination.tsx +0 -9
- package/packages/ui-native/src/popover.tsx +0 -9
- package/packages/ui-native/src/progress.tsx +0 -9
- package/packages/ui-native/src/radio-group.test.tsx +0 -77
- package/packages/ui-native/src/radio-group.tsx +0 -42
- package/packages/ui-native/src/resizable.tsx +0 -25
- package/packages/ui-native/src/scroll-area.tsx +0 -9
- package/packages/ui-native/src/search.tsx +0 -17
- package/packages/ui-native/src/select.tsx +0 -229
- package/packages/ui-native/src/separator.tsx +0 -20
- package/packages/ui-native/src/sheet.test.tsx +0 -93
- package/packages/ui-native/src/sheet.tsx +0 -127
- package/packages/ui-native/src/skeleton.test.tsx +0 -29
- package/packages/ui-native/src/skeleton.tsx +0 -31
- package/packages/ui-native/src/slider.tsx +0 -9
- package/packages/ui-native/src/sonner.tsx +0 -9
- package/packages/ui-native/src/switch.tsx +0 -34
- package/packages/ui-native/src/table.tsx +0 -73
- package/packages/ui-native/src/tabs.tsx +0 -74
- package/packages/ui-native/src/text.test.tsx +0 -24
- package/packages/ui-native/src/text.tsx +0 -43
- package/packages/ui-native/src/textarea.test.tsx +0 -27
- package/packages/ui-native/src/textarea.tsx +0 -29
- package/packages/ui-native/src/theme-provider.tsx +0 -6
- package/packages/ui-native/src/theme-toggle.tsx +0 -11
- package/packages/ui-native/src/toast.test.tsx +0 -61
- package/packages/ui-native/src/toast.tsx +0 -88
- package/packages/ui-native/src/toaster.tsx +0 -9
- package/packages/ui-native/src/toggle-group.tsx +0 -78
- package/packages/ui-native/src/toggle.tsx +0 -35
- package/packages/ui-native/src/tooltip.tsx +0 -44
- package/packages/ui-native/tsconfig.json +0 -23
- package/packages/ui-native/vite.config.ts +0 -17
- package/packages/ui-web/CHANGELOG.md +0 -8
- package/packages/ui-web/package.json +0 -84
- package/packages/ui-web/src/accordion.test.tsx +0 -86
- package/packages/ui-web/src/accordion.tsx +0 -58
- package/packages/ui-web/src/alert-dialog.test.tsx +0 -91
- package/packages/ui-web/src/alert-dialog.tsx +0 -121
- package/packages/ui-web/src/alert.test.tsx +0 -47
- package/packages/ui-web/src/alert.tsx +0 -49
- package/packages/ui-web/src/aspect-ratio.test.tsx +0 -34
- package/packages/ui-web/src/aspect-ratio.tsx +0 -7
- package/packages/ui-web/src/avatar.test.tsx +0 -33
- package/packages/ui-web/src/avatar.tsx +0 -40
- package/packages/ui-web/src/badge.test.tsx +0 -24
- package/packages/ui-web/src/badge.tsx +0 -34
- package/packages/ui-web/src/breadcrumb.tsx +0 -105
- package/packages/ui-web/src/button.test.tsx +0 -62
- package/packages/ui-web/src/button.tsx +0 -47
- package/packages/ui-web/src/calendar.test.tsx +0 -23
- package/packages/ui-web/src/calendar.tsx +0 -163
- package/packages/ui-web/src/card.test.tsx +0 -35
- package/packages/ui-web/src/card.tsx +0 -46
- package/packages/ui-web/src/carousel.test.tsx +0 -37
- package/packages/ui-web/src/carousel.tsx +0 -234
- package/packages/ui-web/src/chart.test.tsx +0 -62
- package/packages/ui-web/src/chart.tsx +0 -296
- package/packages/ui-web/src/checkbox.test.tsx +0 -30
- package/packages/ui-web/src/checkbox.tsx +0 -31
- package/packages/ui-web/src/collapsible.test.tsx +0 -51
- package/packages/ui-web/src/collapsible.tsx +0 -15
- package/packages/ui-web/src/command.test.tsx +0 -79
- package/packages/ui-web/src/command.tsx +0 -154
- package/packages/ui-web/src/context-menu.test.tsx +0 -37
- package/packages/ui-web/src/context-menu.tsx +0 -208
- package/packages/ui-web/src/dialog.test.tsx +0 -66
- package/packages/ui-web/src/dialog.tsx +0 -95
- package/packages/ui-web/src/drawer.test.tsx +0 -68
- package/packages/ui-web/src/drawer.tsx +0 -110
- package/packages/ui-web/src/dropdown-menu.test.tsx +0 -93
- package/packages/ui-web/src/dropdown-menu.tsx +0 -212
- package/packages/ui-web/src/form.test.tsx +0 -84
- package/packages/ui-web/src/form.tsx +0 -160
- package/packages/ui-web/src/hooks/use-theme.ts +0 -15
- package/packages/ui-web/src/hooks/use-toast.ts +0 -189
- package/packages/ui-web/src/hover-card.test.tsx +0 -48
- package/packages/ui-web/src/hover-card.tsx +0 -35
- package/packages/ui-web/src/index.ts +0 -474
- package/packages/ui-web/src/input.test.tsx +0 -33
- package/packages/ui-web/src/input.tsx +0 -23
- package/packages/ui-web/src/label.test.tsx +0 -27
- package/packages/ui-web/src/label.tsx +0 -21
- package/packages/ui-web/src/lib/utils.ts +0 -6
- package/packages/ui-web/src/menubar.test.tsx +0 -92
- package/packages/ui-web/src/menubar.tsx +0 -244
- package/packages/ui-web/src/navigation-menu.test.tsx +0 -53
- package/packages/ui-web/src/navigation-menu.tsx +0 -143
- package/packages/ui-web/src/pagination.test.tsx +0 -57
- package/packages/ui-web/src/pagination.tsx +0 -107
- package/packages/ui-web/src/popover.test.tsx +0 -31
- package/packages/ui-web/src/popover.tsx +0 -45
- package/packages/ui-web/src/progress.test.tsx +0 -18
- package/packages/ui-web/src/progress.tsx +0 -28
- package/packages/ui-web/src/radio-group.test.tsx +0 -39
- package/packages/ui-web/src/radio-group.tsx +0 -41
- package/packages/ui-web/src/resizable.test.tsx +0 -23
- package/packages/ui-web/src/resizable.tsx +0 -59
- package/packages/ui-web/src/scroll-area.test.tsx +0 -15
- package/packages/ui-web/src/scroll-area.tsx +0 -42
- package/packages/ui-web/src/search.test.tsx +0 -81
- package/packages/ui-web/src/search.tsx +0 -87
- package/packages/ui-web/src/select.test.tsx +0 -42
- package/packages/ui-web/src/select.tsx +0 -169
- package/packages/ui-web/src/separator.test.tsx +0 -16
- package/packages/ui-web/src/separator.tsx +0 -24
- package/packages/ui-web/src/setupTests.ts +0 -114
- package/packages/ui-web/src/sheet.test.tsx +0 -48
- package/packages/ui-web/src/sheet.tsx +0 -136
- package/packages/ui-web/src/skeleton.test.tsx +0 -13
- package/packages/ui-web/src/skeleton.tsx +0 -10
- package/packages/ui-web/src/slider.test.tsx +0 -18
- package/packages/ui-web/src/slider.tsx +0 -27
- package/packages/ui-web/src/sonner.test.tsx +0 -13
- package/packages/ui-web/src/sonner.tsx +0 -32
- package/packages/ui-web/src/switch.test.tsx +0 -22
- package/packages/ui-web/src/switch.tsx +0 -31
- package/packages/ui-web/src/table.test.tsx +0 -29
- package/packages/ui-web/src/table.tsx +0 -104
- package/packages/ui-web/src/tabs.test.tsx +0 -43
- package/packages/ui-web/src/tabs.tsx +0 -62
- package/packages/ui-web/src/text.test.tsx +0 -34
- package/packages/ui-web/src/text.tsx +0 -55
- package/packages/ui-web/src/textarea.test.tsx +0 -21
- package/packages/ui-web/src/textarea.tsx +0 -25
- package/packages/ui-web/src/theme-provider.tsx +0 -15
- package/packages/ui-web/src/theme-toggle.test.tsx +0 -49
- package/packages/ui-web/src/theme-toggle.tsx +0 -92
- package/packages/ui-web/src/toast.test.tsx +0 -42
- package/packages/ui-web/src/toast.tsx +0 -111
- package/packages/ui-web/src/toaster.tsx +0 -27
- package/packages/ui-web/src/toggle-group.test.tsx +0 -40
- package/packages/ui-web/src/toggle-group.tsx +0 -55
- package/packages/ui-web/src/toggle.test.tsx +0 -21
- package/packages/ui-web/src/toggle.tsx +0 -24
- package/packages/ui-web/src/tooltip.tsx +0 -51
- package/packages/ui-web/tsconfig.json +0 -24
- package/packages/ui-web/vite.config.ts +0 -21
- package/postcss.config.mjs +0 -5
- package/release-please-config.json +0 -60
- package/scripts/build-registry.ts +0 -80
- package/scripts/sync-tokens.ts +0 -86
- package/scripts/validate.ts +0 -74
- package/src/globals.css +0 -146
- package/src/index.ts +0 -4
- package/src/setupTests.ts +0 -47
- package/src/types/nativewind.d.ts +0 -19
- package/tailwind.config.js +0 -48
- package/tsconfig.build.json +0 -22
- package/tsconfig.json +0 -30
- package/tsconfig.node.json +0 -11
- package/vite.config.ts +0 -106
- package/vitest.config.ts +0 -23
- package/wrangler.toml +0 -22
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from 'lucide-react';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { DayButton, DayPicker, getDefaultClassNames } from 'react-day-picker';
|
|
4
|
-
|
|
5
|
-
import { CalendarBaseProps } from '@gv-tech/ui-core';
|
|
6
|
-
import { Button, buttonVariants } from './button';
|
|
7
|
-
import { cn } from './lib/utils';
|
|
8
|
-
|
|
9
|
-
function Calendar({
|
|
10
|
-
className,
|
|
11
|
-
classNames,
|
|
12
|
-
showOutsideDays = true,
|
|
13
|
-
captionLayout = 'label',
|
|
14
|
-
buttonVariant = 'ghost',
|
|
15
|
-
formatters,
|
|
16
|
-
components,
|
|
17
|
-
...props
|
|
18
|
-
}: React.ComponentProps<typeof DayPicker> &
|
|
19
|
-
CalendarBaseProps & {
|
|
20
|
-
buttonVariant?: React.ComponentProps<typeof Button>['variant'];
|
|
21
|
-
}) {
|
|
22
|
-
const defaultClassNames = getDefaultClassNames();
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<DayPicker
|
|
26
|
-
showOutsideDays={showOutsideDays}
|
|
27
|
-
className={cn(
|
|
28
|
-
'bg-background group/calendar p-3 [--cell-size:2.5rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent',
|
|
29
|
-
String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,
|
|
30
|
-
String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,
|
|
31
|
-
'relative',
|
|
32
|
-
className,
|
|
33
|
-
)}
|
|
34
|
-
captionLayout={captionLayout}
|
|
35
|
-
formatters={{
|
|
36
|
-
formatMonthDropdown: (date) => date.toLocaleString('default', { month: 'short' }),
|
|
37
|
-
...formatters,
|
|
38
|
-
}}
|
|
39
|
-
classNames={{
|
|
40
|
-
root: cn('w-fit', defaultClassNames.root),
|
|
41
|
-
months: cn('relative flex flex-col gap-4 md:flex-row', defaultClassNames.months),
|
|
42
|
-
month: cn('flex w-full flex-col gap-4', defaultClassNames.month),
|
|
43
|
-
nav: cn(
|
|
44
|
-
'absolute inset-x-0 top-2 flex items-center justify-between pointer-events-none px-2',
|
|
45
|
-
defaultClassNames.nav,
|
|
46
|
-
),
|
|
47
|
-
button_previous: cn(
|
|
48
|
-
buttonVariants({ variant: buttonVariant }),
|
|
49
|
-
'h-7 w-7 select-none p-0 aria-disabled:opacity-50 pointer-events-auto',
|
|
50
|
-
defaultClassNames.button_previous,
|
|
51
|
-
),
|
|
52
|
-
button_next: cn(
|
|
53
|
-
buttonVariants({ variant: buttonVariant }),
|
|
54
|
-
'h-7 w-7 select-none p-0 aria-disabled:opacity-50 pointer-events-auto',
|
|
55
|
-
defaultClassNames.button_next,
|
|
56
|
-
),
|
|
57
|
-
month_caption: cn(
|
|
58
|
-
'flex h-[--cell-size] w-full items-center justify-center text-sm font-medium',
|
|
59
|
-
defaultClassNames.month_caption,
|
|
60
|
-
),
|
|
61
|
-
dropdowns: cn(
|
|
62
|
-
'flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium',
|
|
63
|
-
defaultClassNames.dropdowns,
|
|
64
|
-
),
|
|
65
|
-
dropdown_root: cn(
|
|
66
|
-
'has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border',
|
|
67
|
-
defaultClassNames.dropdown_root,
|
|
68
|
-
),
|
|
69
|
-
dropdown: cn('bg-popover absolute inset-0 opacity-0', defaultClassNames.dropdown),
|
|
70
|
-
caption_label: cn(
|
|
71
|
-
'select-none font-medium',
|
|
72
|
-
captionLayout === 'label'
|
|
73
|
-
? 'text-sm'
|
|
74
|
-
: '[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5',
|
|
75
|
-
defaultClassNames.caption_label,
|
|
76
|
-
),
|
|
77
|
-
table: 'w-full border-collapse grow',
|
|
78
|
-
weekdays: cn('flex', defaultClassNames.weekdays),
|
|
79
|
-
weekday: cn(
|
|
80
|
-
'text-muted-foreground pt-1 flex-1 select-none rounded-md text-[0.8rem] font-normal uppercase',
|
|
81
|
-
defaultClassNames.weekday,
|
|
82
|
-
),
|
|
83
|
-
week: cn('flex w-full mt-2', defaultClassNames.week),
|
|
84
|
-
week_number_header: cn('w-[--cell-size] select-none', defaultClassNames.week_number_header),
|
|
85
|
-
week_number: cn('text-muted-foreground select-none text-[0.8rem]', defaultClassNames.week_number),
|
|
86
|
-
day: cn(
|
|
87
|
-
'group/day relative flex aspect-square h-10 w-10 select-none items-center justify-center p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md',
|
|
88
|
-
defaultClassNames.day,
|
|
89
|
-
),
|
|
90
|
-
range_start: cn('bg-accent rounded-l-md', defaultClassNames.range_start),
|
|
91
|
-
range_middle: cn('rounded-none', defaultClassNames.range_middle),
|
|
92
|
-
range_end: cn('bg-accent rounded-r-md', defaultClassNames.range_end),
|
|
93
|
-
today: cn(
|
|
94
|
-
'bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none',
|
|
95
|
-
defaultClassNames.today,
|
|
96
|
-
),
|
|
97
|
-
outside: cn('text-muted-foreground aria-selected:text-muted-foreground', defaultClassNames.outside),
|
|
98
|
-
disabled: cn('text-muted-foreground opacity-50', defaultClassNames.disabled),
|
|
99
|
-
hidden: cn('invisible', defaultClassNames.hidden),
|
|
100
|
-
...classNames,
|
|
101
|
-
}}
|
|
102
|
-
components={{
|
|
103
|
-
Root: ({ className, rootRef, ...props }) => {
|
|
104
|
-
return <div data-slot="calendar" ref={rootRef} className={cn(className)} {...props} />;
|
|
105
|
-
},
|
|
106
|
-
Chevron: ({ className, orientation, ...props }) => {
|
|
107
|
-
if (orientation === 'left') {
|
|
108
|
-
return <ChevronLeftIcon className={cn('size-4', className)} {...props} />;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
if (orientation === 'right') {
|
|
112
|
-
return <ChevronRightIcon className={cn('size-4', className)} {...props} />;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
return <ChevronDownIcon className={cn('size-4', className)} {...props} />;
|
|
116
|
-
},
|
|
117
|
-
DayButton: CalendarDayButton,
|
|
118
|
-
WeekNumber: ({ children, ...props }) => {
|
|
119
|
-
return (
|
|
120
|
-
<td {...props}>
|
|
121
|
-
<div className="flex size-[--cell-size] items-center justify-center text-center">{children}</div>
|
|
122
|
-
</td>
|
|
123
|
-
);
|
|
124
|
-
},
|
|
125
|
-
...components,
|
|
126
|
-
}}
|
|
127
|
-
{...props}
|
|
128
|
-
/>
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function CalendarDayButton({ className, day, modifiers, ...props }: React.ComponentProps<typeof DayButton>) {
|
|
133
|
-
const defaultClassNames = getDefaultClassNames();
|
|
134
|
-
|
|
135
|
-
const ref = React.useRef<HTMLButtonElement>(null);
|
|
136
|
-
React.useEffect(() => {
|
|
137
|
-
if (modifiers.focused) ref.current?.focus();
|
|
138
|
-
}, [modifiers.focused]);
|
|
139
|
-
|
|
140
|
-
return (
|
|
141
|
-
<Button
|
|
142
|
-
ref={ref}
|
|
143
|
-
variant="ghost"
|
|
144
|
-
size="icon"
|
|
145
|
-
data-day={day.date.toLocaleDateString()}
|
|
146
|
-
data-selected-single={
|
|
147
|
-
modifiers.selected && !modifiers.range_start && !modifiers.range_end && !modifiers.range_middle
|
|
148
|
-
}
|
|
149
|
-
data-range-start={modifiers.range_start}
|
|
150
|
-
data-range-end={modifiers.range_end}
|
|
151
|
-
data-range-middle={modifiers.range_middle}
|
|
152
|
-
className={cn(
|
|
153
|
-
'data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-full w-full min-w-[--cell-size] items-center justify-center font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70',
|
|
154
|
-
defaultClassNames.day,
|
|
155
|
-
className,
|
|
156
|
-
)}
|
|
157
|
-
{...props}
|
|
158
|
-
/>
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export { Calendar, CalendarDayButton };
|
|
163
|
-
export type { CalendarBaseProps as CalendarProps };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@gv-tech/ui-web';
|
|
2
|
-
import { render, screen } from '@testing-library/react';
|
|
3
|
-
import { describe, expect, it } from 'vitest';
|
|
4
|
-
|
|
5
|
-
describe('Card', () => {
|
|
6
|
-
it('renders correctly', () => {
|
|
7
|
-
render(
|
|
8
|
-
<Card>
|
|
9
|
-
<CardHeader>
|
|
10
|
-
<CardTitle>Title</CardTitle>
|
|
11
|
-
<CardDescription>Description</CardDescription>
|
|
12
|
-
</CardHeader>
|
|
13
|
-
<CardContent>Content</CardContent>
|
|
14
|
-
<CardFooter>Footer</CardFooter>
|
|
15
|
-
</Card>,
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
expect(screen.getByText('Title')).toBeInTheDocument();
|
|
19
|
-
expect(screen.getByText('Description')).toBeInTheDocument();
|
|
20
|
-
expect(screen.getByText('Content')).toBeInTheDocument();
|
|
21
|
-
expect(screen.getByText('Footer')).toBeInTheDocument();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('renders with class names', () => {
|
|
25
|
-
const { container } = render(<Card className="test-class" />);
|
|
26
|
-
expect(container.firstChild).toHaveClass(
|
|
27
|
-
'test-class',
|
|
28
|
-
'rounded-xl',
|
|
29
|
-
'border',
|
|
30
|
-
'bg-card',
|
|
31
|
-
'text-card-foreground',
|
|
32
|
-
'shadow',
|
|
33
|
-
);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import type { CardBaseProps } from '@gv-tech/ui-core';
|
|
4
|
-
import { cn } from './lib/utils';
|
|
5
|
-
|
|
6
|
-
export interface CardProps extends React.HTMLAttributes<HTMLDivElement>, CardBaseProps {}
|
|
7
|
-
|
|
8
|
-
const Card = React.forwardRef<HTMLDivElement, CardProps>(({ className, ...props }, ref) => (
|
|
9
|
-
<div ref={ref} className={cn('rounded-xl border bg-card text-card-foreground shadow', className)} {...props} />
|
|
10
|
-
));
|
|
11
|
-
Card.displayName = 'Card';
|
|
12
|
-
|
|
13
|
-
const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
14
|
-
({ className, ...props }, ref) => (
|
|
15
|
-
<div ref={ref} className={cn('flex flex-col space-y-1.5 p-6', className)} {...props} />
|
|
16
|
-
),
|
|
17
|
-
);
|
|
18
|
-
CardHeader.displayName = 'CardHeader';
|
|
19
|
-
|
|
20
|
-
const CardTitle = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
21
|
-
({ className, ...props }, ref) => (
|
|
22
|
-
<div ref={ref} className={cn('font-semibold leading-none tracking-tight', className)} {...props} />
|
|
23
|
-
),
|
|
24
|
-
);
|
|
25
|
-
CardTitle.displayName = 'CardTitle';
|
|
26
|
-
|
|
27
|
-
const CardDescription = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
28
|
-
({ className, ...props }, ref) => (
|
|
29
|
-
<div ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
|
|
30
|
-
),
|
|
31
|
-
);
|
|
32
|
-
CardDescription.displayName = 'CardDescription';
|
|
33
|
-
|
|
34
|
-
const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
35
|
-
({ className, ...props }, ref) => <div ref={ref} className={cn('p-6 pt-0', className)} {...props} />,
|
|
36
|
-
);
|
|
37
|
-
CardContent.displayName = 'CardContent';
|
|
38
|
-
|
|
39
|
-
const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
|
40
|
-
({ className, ...props }, ref) => (
|
|
41
|
-
<div ref={ref} className={cn('flex items-center p-6 pt-0', className)} {...props} />
|
|
42
|
-
),
|
|
43
|
-
);
|
|
44
|
-
CardFooter.displayName = 'CardFooter';
|
|
45
|
-
|
|
46
|
-
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/react';
|
|
2
|
-
import { describe, expect, it } from 'vitest';
|
|
3
|
-
import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from '.';
|
|
4
|
-
|
|
5
|
-
describe('Carousel', () => {
|
|
6
|
-
it('renders correctly', () => {
|
|
7
|
-
render(
|
|
8
|
-
<Carousel aria-label="carousel">
|
|
9
|
-
<CarouselContent>
|
|
10
|
-
<CarouselItem>Slide 1</CarouselItem>
|
|
11
|
-
<CarouselItem>Slide 2</CarouselItem>
|
|
12
|
-
<CarouselItem>Slide 3</CarouselItem>
|
|
13
|
-
</CarouselContent>
|
|
14
|
-
<CarouselPrevious />
|
|
15
|
-
<CarouselNext />
|
|
16
|
-
</Carousel>,
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
expect(screen.getByRole('region', { name: 'carousel' })).toBeInTheDocument();
|
|
20
|
-
expect(screen.getByText('Slide 1')).toBeInTheDocument();
|
|
21
|
-
expect(screen.getByText('Slide 2')).toBeInTheDocument();
|
|
22
|
-
expect(screen.getByText('Slide 3')).toBeInTheDocument();
|
|
23
|
-
expect(screen.getByRole('button', { name: 'Previous slide' })).toBeInTheDocument();
|
|
24
|
-
expect(screen.getByRole('button', { name: 'Next slide' })).toBeInTheDocument();
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('renders with orientation vertical', () => {
|
|
28
|
-
render(
|
|
29
|
-
<Carousel orientation="vertical" aria-label="carousel">
|
|
30
|
-
<CarouselContent>
|
|
31
|
-
<CarouselItem>Slide 1</CarouselItem>
|
|
32
|
-
</CarouselContent>
|
|
33
|
-
</Carousel>,
|
|
34
|
-
);
|
|
35
|
-
expect(screen.getByRole('region', { name: 'carousel' })).toBeInTheDocument();
|
|
36
|
-
});
|
|
37
|
-
});
|
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
import useEmblaCarousel, { type UseEmblaCarouselType } from 'embla-carousel-react';
|
|
2
|
-
import { ArrowLeft, ArrowRight } from 'lucide-react';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
CarouselBaseProps,
|
|
7
|
-
CarouselContentBaseProps,
|
|
8
|
-
CarouselItemBaseProps,
|
|
9
|
-
CarouselNextBaseProps,
|
|
10
|
-
CarouselPreviousBaseProps,
|
|
11
|
-
} from '@gv-tech/ui-core';
|
|
12
|
-
import { Button } from './button';
|
|
13
|
-
import { cn } from './lib/utils';
|
|
14
|
-
|
|
15
|
-
type CarouselApi = UseEmblaCarouselType[1];
|
|
16
|
-
type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
|
|
17
|
-
type CarouselOptions = UseCarouselParameters[0];
|
|
18
|
-
type CarouselPlugin = UseCarouselParameters[1];
|
|
19
|
-
|
|
20
|
-
type CarouselProps = React.HTMLAttributes<HTMLDivElement> &
|
|
21
|
-
CarouselBaseProps & {
|
|
22
|
-
opts?: CarouselOptions;
|
|
23
|
-
plugins?: CarouselPlugin;
|
|
24
|
-
setApi?: (api: CarouselApi) => void;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
type CarouselContextProps = {
|
|
28
|
-
carouselRef: ReturnType<typeof useEmblaCarousel>[0];
|
|
29
|
-
api: ReturnType<typeof useEmblaCarousel>[1];
|
|
30
|
-
scrollPrev: () => void;
|
|
31
|
-
scrollNext: () => void;
|
|
32
|
-
canScrollPrev: boolean;
|
|
33
|
-
canScrollNext: boolean;
|
|
34
|
-
} & CarouselProps;
|
|
35
|
-
|
|
36
|
-
const CarouselContext = React.createContext<CarouselContextProps | null>(null);
|
|
37
|
-
|
|
38
|
-
function useCarousel() {
|
|
39
|
-
const context = React.useContext(CarouselContext);
|
|
40
|
-
|
|
41
|
-
if (!context) {
|
|
42
|
-
throw new Error('useCarousel must be used within a <Carousel />');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return context;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const Carousel = React.forwardRef<HTMLDivElement, CarouselProps>(
|
|
49
|
-
({ orientation = 'horizontal', opts, setApi, plugins, className, children, ...props }, ref) => {
|
|
50
|
-
const [carouselRef, api] = useEmblaCarousel(
|
|
51
|
-
{
|
|
52
|
-
...opts,
|
|
53
|
-
axis: orientation === 'horizontal' ? 'x' : 'y',
|
|
54
|
-
},
|
|
55
|
-
plugins,
|
|
56
|
-
);
|
|
57
|
-
const [canScrollPrev, setCanScrollPrev] = React.useState(false);
|
|
58
|
-
const [canScrollNext, setCanScrollNext] = React.useState(false);
|
|
59
|
-
|
|
60
|
-
const onSelect = React.useCallback((api: CarouselApi) => {
|
|
61
|
-
if (!api) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
setCanScrollPrev(api.canScrollPrev());
|
|
66
|
-
setCanScrollNext(api.canScrollNext());
|
|
67
|
-
}, []);
|
|
68
|
-
|
|
69
|
-
const scrollPrev = React.useCallback(() => {
|
|
70
|
-
api?.scrollPrev();
|
|
71
|
-
}, [api]);
|
|
72
|
-
|
|
73
|
-
const scrollNext = React.useCallback(() => {
|
|
74
|
-
api?.scrollNext();
|
|
75
|
-
}, [api]);
|
|
76
|
-
|
|
77
|
-
const handleKeyDown = React.useCallback(
|
|
78
|
-
(event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
79
|
-
if (event.key === 'ArrowLeft') {
|
|
80
|
-
event.preventDefault();
|
|
81
|
-
scrollPrev();
|
|
82
|
-
} else if (event.key === 'ArrowRight') {
|
|
83
|
-
event.preventDefault();
|
|
84
|
-
scrollNext();
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
[scrollPrev, scrollNext],
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
React.useEffect(() => {
|
|
91
|
-
if (!api || !setApi) {
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
setApi(api);
|
|
96
|
-
}, [api, setApi]);
|
|
97
|
-
|
|
98
|
-
React.useEffect(() => {
|
|
99
|
-
if (!api) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
onSelect(api);
|
|
104
|
-
api.on('reInit', onSelect);
|
|
105
|
-
api.on('select', onSelect);
|
|
106
|
-
|
|
107
|
-
return () => {
|
|
108
|
-
api?.off('select', onSelect);
|
|
109
|
-
};
|
|
110
|
-
}, [api, onSelect]);
|
|
111
|
-
|
|
112
|
-
return (
|
|
113
|
-
<CarouselContext.Provider
|
|
114
|
-
value={{
|
|
115
|
-
carouselRef,
|
|
116
|
-
api: api,
|
|
117
|
-
opts,
|
|
118
|
-
orientation: orientation || (opts?.axis === 'y' ? 'vertical' : 'horizontal'),
|
|
119
|
-
scrollPrev,
|
|
120
|
-
scrollNext,
|
|
121
|
-
canScrollPrev,
|
|
122
|
-
canScrollNext,
|
|
123
|
-
}}
|
|
124
|
-
>
|
|
125
|
-
<div
|
|
126
|
-
ref={ref}
|
|
127
|
-
onKeyDownCapture={handleKeyDown}
|
|
128
|
-
className={cn('relative', className)}
|
|
129
|
-
role="region"
|
|
130
|
-
aria-roledescription="carousel"
|
|
131
|
-
{...props}
|
|
132
|
-
>
|
|
133
|
-
{children}
|
|
134
|
-
</div>
|
|
135
|
-
</CarouselContext.Provider>
|
|
136
|
-
);
|
|
137
|
-
},
|
|
138
|
-
);
|
|
139
|
-
Carousel.displayName = 'Carousel';
|
|
140
|
-
|
|
141
|
-
const CarouselContent = React.forwardRef<
|
|
142
|
-
HTMLDivElement,
|
|
143
|
-
React.HTMLAttributes<HTMLDivElement> & CarouselContentBaseProps
|
|
144
|
-
>(({ className, ...props }, ref) => {
|
|
145
|
-
const { carouselRef, orientation } = useCarousel();
|
|
146
|
-
|
|
147
|
-
return (
|
|
148
|
-
<div ref={carouselRef} className="overflow-hidden">
|
|
149
|
-
<div
|
|
150
|
-
ref={ref}
|
|
151
|
-
className={cn('flex', orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col', className)}
|
|
152
|
-
{...props}
|
|
153
|
-
/>
|
|
154
|
-
</div>
|
|
155
|
-
);
|
|
156
|
-
});
|
|
157
|
-
CarouselContent.displayName = 'CarouselContent';
|
|
158
|
-
|
|
159
|
-
const CarouselItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & CarouselItemBaseProps>(
|
|
160
|
-
({ className, ...props }, ref) => {
|
|
161
|
-
const { orientation } = useCarousel();
|
|
162
|
-
|
|
163
|
-
return (
|
|
164
|
-
<div
|
|
165
|
-
ref={ref}
|
|
166
|
-
role="group"
|
|
167
|
-
aria-roledescription="slide"
|
|
168
|
-
className={cn('min-w-0 shrink-0 grow-0 basis-full', orientation === 'horizontal' ? 'pl-4' : 'pt-4', className)}
|
|
169
|
-
{...props}
|
|
170
|
-
/>
|
|
171
|
-
);
|
|
172
|
-
},
|
|
173
|
-
);
|
|
174
|
-
CarouselItem.displayName = 'CarouselItem';
|
|
175
|
-
|
|
176
|
-
const CarouselPrevious = React.forwardRef<
|
|
177
|
-
HTMLButtonElement,
|
|
178
|
-
React.ComponentProps<typeof Button> & CarouselPreviousBaseProps
|
|
179
|
-
>(({ className, variant = 'outline', size = 'icon', ...props }, ref) => {
|
|
180
|
-
const { orientation, scrollPrev, canScrollPrev } = useCarousel();
|
|
181
|
-
|
|
182
|
-
return (
|
|
183
|
-
<Button
|
|
184
|
-
ref={ref}
|
|
185
|
-
variant={variant}
|
|
186
|
-
size={size}
|
|
187
|
-
className={cn(
|
|
188
|
-
'absolute h-8 w-8 rounded-full',
|
|
189
|
-
orientation === 'horizontal'
|
|
190
|
-
? '-left-12 top-1/2 -translate-y-1/2'
|
|
191
|
-
: '-top-12 left-1/2 -translate-x-1/2 rotate-90',
|
|
192
|
-
className,
|
|
193
|
-
)}
|
|
194
|
-
disabled={!canScrollPrev}
|
|
195
|
-
onClick={scrollPrev}
|
|
196
|
-
{...props}
|
|
197
|
-
>
|
|
198
|
-
<ArrowLeft className="h-4 w-4" />
|
|
199
|
-
<span className="sr-only">Previous slide</span>
|
|
200
|
-
</Button>
|
|
201
|
-
);
|
|
202
|
-
});
|
|
203
|
-
CarouselPrevious.displayName = 'CarouselPrevious';
|
|
204
|
-
|
|
205
|
-
const CarouselNext = React.forwardRef<HTMLButtonElement, React.ComponentProps<typeof Button> & CarouselNextBaseProps>(
|
|
206
|
-
({ className, variant = 'outline', size = 'icon', ...props }, ref) => {
|
|
207
|
-
const { orientation, scrollNext, canScrollNext } = useCarousel();
|
|
208
|
-
|
|
209
|
-
return (
|
|
210
|
-
<Button
|
|
211
|
-
ref={ref}
|
|
212
|
-
variant={variant}
|
|
213
|
-
size={size}
|
|
214
|
-
className={cn(
|
|
215
|
-
'absolute h-8 w-8 rounded-full',
|
|
216
|
-
orientation === 'horizontal'
|
|
217
|
-
? '-right-12 top-1/2 -translate-y-1/2'
|
|
218
|
-
: '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',
|
|
219
|
-
className,
|
|
220
|
-
)}
|
|
221
|
-
disabled={!canScrollNext}
|
|
222
|
-
onClick={scrollNext}
|
|
223
|
-
{...props}
|
|
224
|
-
>
|
|
225
|
-
<ArrowRight className="h-4 w-4" />
|
|
226
|
-
<span className="sr-only">Next slide</span>
|
|
227
|
-
</Button>
|
|
228
|
-
);
|
|
229
|
-
},
|
|
230
|
-
);
|
|
231
|
-
CarouselNext.displayName = 'CarouselNext';
|
|
232
|
-
|
|
233
|
-
export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, type CarouselApi };
|
|
234
|
-
export type { CarouselProps };
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { render, screen } from '@testing-library/react';
|
|
2
|
-
import { Bar, BarChart, CartesianGrid, XAxis } from 'recharts';
|
|
3
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
4
|
-
import { ChartContainer, ChartTooltip, ChartTooltipContent } from '.';
|
|
5
|
-
|
|
6
|
-
// Mock Recharts ResponsiveContainer to avoid ResizeObserver issues and render children immediately
|
|
7
|
-
vi.mock('recharts', async (importOriginal) => {
|
|
8
|
-
const original = await importOriginal();
|
|
9
|
-
return {
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
|
-
...(original as any),
|
|
12
|
-
ResponsiveContainer: ({ children }: { children: React.ReactNode }) => (
|
|
13
|
-
<div style={{ width: 500, height: 300 }}>{children}</div>
|
|
14
|
-
),
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const chartConfig = {
|
|
19
|
-
desktop: {
|
|
20
|
-
label: 'Desktop',
|
|
21
|
-
color: '#2563eb',
|
|
22
|
-
},
|
|
23
|
-
mobile: {
|
|
24
|
-
label: 'Mobile',
|
|
25
|
-
color: '#60a5fa',
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const chartData = [
|
|
30
|
-
{ month: 'January', desktop: 186, mobile: 80 },
|
|
31
|
-
{ month: 'February', desktop: 305, mobile: 200 },
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
describe('Chart', () => {
|
|
35
|
-
it('renders correctly', () => {
|
|
36
|
-
render(
|
|
37
|
-
<ChartContainer config={chartConfig} className="min-h-[200px] w-full">
|
|
38
|
-
<BarChart accessibilityLayer data={chartData} width={500} height={300}>
|
|
39
|
-
<CartesianGrid vertical={false} />
|
|
40
|
-
<XAxis
|
|
41
|
-
dataKey="month"
|
|
42
|
-
tickLine={false}
|
|
43
|
-
tickMargin={10}
|
|
44
|
-
axisLine={false}
|
|
45
|
-
tickFormatter={(value) => value.slice(0, 3)}
|
|
46
|
-
/>
|
|
47
|
-
<ChartTooltip content={<ChartTooltipContent />} />
|
|
48
|
-
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
49
|
-
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
|
|
50
|
-
</BarChart>
|
|
51
|
-
</ChartContainer>,
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
// Recharts renders SVGs. We can check if the container renders.
|
|
55
|
-
// The accessibilityLayer prop on BarChart adds role="application" or similar?
|
|
56
|
-
// Let's check for the chart container.
|
|
57
|
-
// The ChartContainer adds data-chart attribute.
|
|
58
|
-
// But we can check for text.
|
|
59
|
-
expect(screen.getByText('Jan')).toBeInTheDocument();
|
|
60
|
-
expect(screen.getByText('Feb')).toBeInTheDocument();
|
|
61
|
-
});
|
|
62
|
-
});
|