@pattern-stack/frontend-patterns 0.1.3 → 0.2.0-alpha.1
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 +69 -74
- package/README.md +17 -2
- package/cli/commands/generate-hooks.ts +15 -6
- package/cli/commands/scaffold.ts +1 -1
- package/cli/index.ts +1 -3
- package/cli/src/codegen/openapi/__tests__/naming-utils.test.js +367 -0
- package/cli/src/codegen/openapi/client-generator.js +90 -35
- package/cli/src/codegen/openapi/confidence-scorer.js +89 -200
- package/cli/src/codegen/openapi/hook-config.js +45 -63
- package/cli/src/codegen/openapi/hook-generator.js +253 -547
- package/cli/src/codegen/openapi/naming-constants.js +98 -0
- package/cli/src/codegen/openapi/naming-utils.js +149 -0
- package/cli/src/codegen/openapi/parser.js +9 -14
- package/cli/src/codegen/openapi/type-generator.js +6 -16
- package/dist/atoms/components/core/Avatar/Avatar.d.ts +6 -6
- package/dist/atoms/components/core/Avatar/Avatar.d.ts.map +1 -1
- package/dist/atoms/components/core/Avatar/index.d.ts +1 -1
- package/dist/atoms/components/core/Badge/Badge.d.ts +6 -6
- package/dist/atoms/components/core/Badge/Badge.d.ts.map +1 -1
- package/dist/atoms/components/core/Badge/index.d.ts +1 -1
- package/dist/atoms/components/core/Button/Button.d.ts +3 -3
- package/dist/atoms/components/core/Button/Button.d.ts.map +1 -1
- package/dist/atoms/components/core/Button/index.d.ts +2 -2
- package/dist/atoms/components/core/Card/Card.d.ts +2 -2
- package/dist/atoms/components/core/Card/Card.d.ts.map +1 -1
- package/dist/atoms/components/core/Card/index.d.ts +2 -2
- package/dist/atoms/components/core/Card/index.d.ts.map +1 -1
- package/dist/atoms/components/core/Checkbox/Checkbox.d.ts +4 -4
- package/dist/atoms/components/core/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/atoms/components/core/Checkbox/index.d.ts +2 -2
- package/dist/atoms/components/core/Input/Input.d.ts +2 -2
- package/dist/atoms/components/core/Input/Input.d.ts.map +1 -1
- package/dist/atoms/components/core/Input/index.d.ts +2 -2
- package/dist/atoms/components/core/Label/Label.d.ts +3 -4
- package/dist/atoms/components/core/Label/Label.d.ts.map +1 -1
- package/dist/atoms/components/core/Label/index.d.ts +2 -2
- package/dist/atoms/components/core/Select/Select.d.ts +5 -5
- package/dist/atoms/components/core/Select/Select.d.ts.map +1 -1
- package/dist/atoms/components/core/Select/index.d.ts +2 -2
- package/dist/atoms/components/core/Select/index.d.ts.map +1 -1
- package/dist/atoms/components/core/Spinner/Spinner.d.ts +4 -4
- package/dist/atoms/components/core/Spinner/Spinner.d.ts.map +1 -1
- package/dist/atoms/components/core/Spinner/index.d.ts +2 -2
- package/dist/atoms/components/core/Switch/Switch.d.ts +4 -4
- package/dist/atoms/components/core/Switch/Switch.d.ts.map +1 -1
- package/dist/atoms/components/core/Switch/index.d.ts +1 -1
- package/dist/atoms/components/core/index.d.ts +10 -10
- package/dist/atoms/components/core/index.d.ts.map +1 -1
- package/dist/atoms/components/data/ActivityFeed/ActivityFeed.d.ts +2 -2
- package/dist/atoms/components/data/ActivityFeed/ActivityFeed.d.ts.map +1 -1
- package/dist/atoms/components/data/ActivityFeed/ActivityFeedItem.d.ts +3 -3
- package/dist/atoms/components/data/ActivityFeed/ActivityFeedItem.d.ts.map +1 -1
- package/dist/atoms/components/data/ActivityFeed/index.d.ts +3 -3
- package/dist/atoms/components/data/ActivityFeed/index.d.ts.map +1 -1
- package/dist/atoms/components/data/ActivityFeed/types.d.ts +3 -3
- package/dist/atoms/components/data/ActivityFeed/types.d.ts.map +1 -1
- package/dist/atoms/components/data/ActivityFeed/utils.d.ts +2 -2
- package/dist/atoms/components/data/ActivityFeed/utils.d.ts.map +1 -1
- package/dist/atoms/components/data/Chart/Chart.d.ts +52 -5
- package/dist/atoms/components/data/Chart/Chart.d.ts.map +1 -1
- package/dist/atoms/components/data/Chart/index.d.ts +2 -2
- package/dist/atoms/components/data/Chart/index.d.ts.map +1 -1
- package/dist/atoms/components/data/DataBadge/DataBadge.d.ts +6 -6
- package/dist/atoms/components/data/DataBadge/DataBadge.d.ts.map +1 -1
- package/dist/atoms/components/data/DataBadge/index.d.ts +1 -1
- package/dist/atoms/components/data/DataTable/DataTable.d.ts +4 -4
- package/dist/atoms/components/data/DataTable/DataTable.d.ts.map +1 -1
- package/dist/atoms/components/data/DataTable/DataTable.types.d.ts +4 -4
- package/dist/atoms/components/data/DataTable/DataTable.types.d.ts.map +1 -1
- package/dist/atoms/components/data/DataTable/TableCellWithTooltip.d.ts +1 -1
- package/dist/atoms/components/data/DataTable/index.d.ts +2 -2
- package/dist/atoms/components/data/DetailedCard/DetailedCard.d.ts +4 -4
- package/dist/atoms/components/data/DetailedCard/DetailedCard.d.ts.map +1 -1
- package/dist/atoms/components/data/DetailedCard/index.d.ts +2 -2
- package/dist/atoms/components/data/EntityIcon/EntityIcon.d.ts +3 -3
- package/dist/atoms/components/data/EntityIcon/EntityIcon.d.ts.map +1 -1
- package/dist/atoms/components/data/EntityIcon/index.d.ts +1 -1
- package/dist/atoms/components/data/IconBadge/IconBadge.d.ts +6 -6
- package/dist/atoms/components/data/IconBadge/IconBadge.d.ts.map +1 -1
- package/dist/atoms/components/data/IconBadge/index.d.ts +2 -2
- package/dist/atoms/components/data/ListCard/ListCard.d.ts +9 -9
- package/dist/atoms/components/data/ListCard/ListCard.d.ts.map +1 -1
- package/dist/atoms/components/data/ListCard/index.d.ts +1 -1
- package/dist/atoms/components/data/ProgressBar/ProgressBar.d.ts +5 -5
- package/dist/atoms/components/data/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/atoms/components/data/ProgressBar/index.d.ts +1 -1
- package/dist/atoms/components/data/StatCard/StatCard.d.ts +3 -3
- package/dist/atoms/components/data/StatCard/StatCard.d.ts.map +1 -1
- package/dist/atoms/components/data/StatCard/index.d.ts +1 -1
- package/dist/atoms/components/data/Table/Table.d.ts +2 -2
- package/dist/atoms/components/data/Table/Table.d.ts.map +1 -1
- package/dist/atoms/components/data/Table/index.d.ts +1 -1
- package/dist/atoms/components/data/TruncatedText/TruncatedText.d.ts +2 -2
- package/dist/atoms/components/data/TruncatedText/TruncatedText.d.ts.map +1 -1
- package/dist/atoms/components/data/TruncatedText/index.d.ts +1 -1
- package/dist/atoms/components/data/index.d.ts +12 -12
- package/dist/atoms/components/data/index.d.ts.map +1 -1
- package/dist/atoms/components/domain/SalesPanel/SalesPanel.d.ts +15 -15
- package/dist/atoms/components/domain/SalesPanel/SalesPanel.d.ts.map +1 -1
- package/dist/atoms/components/domain/SalesPanel/index.d.ts +1 -1
- package/dist/atoms/components/domain/SalesPanel/index.d.ts.map +1 -1
- package/dist/atoms/components/domain/index.d.ts +1 -1
- package/dist/atoms/components/feedback/Alert/Alert.d.ts +4 -4
- package/dist/atoms/components/feedback/Alert/Alert.d.ts.map +1 -1
- package/dist/atoms/components/feedback/Alert/index.d.ts +1 -1
- package/dist/atoms/components/feedback/EmptyState/EmptyState.d.ts +3 -3
- package/dist/atoms/components/feedback/EmptyState/EmptyState.d.ts.map +1 -1
- package/dist/atoms/components/feedback/EmptyState/index.d.ts +1 -1
- package/dist/atoms/components/feedback/ErrorBoundary/ErrorBoundary.d.ts +1 -1
- package/dist/atoms/components/feedback/ErrorBoundary/ErrorBoundary.d.ts.map +1 -1
- package/dist/atoms/components/feedback/ErrorBoundary/index.d.ts +1 -1
- package/dist/atoms/components/feedback/Skeleton/Skeleton.d.ts +30 -4
- package/dist/atoms/components/feedback/Skeleton/Skeleton.d.ts.map +1 -1
- package/dist/atoms/components/feedback/Skeleton/index.d.ts +1 -1
- package/dist/atoms/components/feedback/Toast/Toast.d.ts +4 -4
- package/dist/atoms/components/feedback/Toast/Toast.d.ts.map +1 -1
- package/dist/atoms/components/feedback/Toast/index.d.ts +1 -1
- package/dist/atoms/components/feedback/Toast/index.d.ts.map +1 -1
- package/dist/atoms/components/feedback/index.d.ts +5 -5
- package/dist/atoms/components/feedback/index.d.ts.map +1 -1
- package/dist/atoms/components/forms/DateTimePicker/DateTimePicker.d.ts +6 -6
- package/dist/atoms/components/forms/DateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/dist/atoms/components/forms/DateTimePicker/index.d.ts +2 -2
- package/dist/atoms/components/forms/FileUpload/FileUpload.d.ts +3 -3
- package/dist/atoms/components/forms/FileUpload/FileUpload.d.ts.map +1 -1
- package/dist/atoms/components/forms/FileUpload/index.d.ts +2 -2
- package/dist/atoms/components/forms/FormField/FormField.d.ts +2 -2
- package/dist/atoms/components/forms/FormField/FormField.d.ts.map +1 -1
- package/dist/atoms/components/forms/FormField/index.d.ts +1 -1
- package/dist/atoms/components/forms/index.d.ts +3 -3
- package/dist/atoms/components/index.d.ts +9 -9
- package/dist/atoms/components/layout/Accordion/Accordion.d.ts +3 -3
- package/dist/atoms/components/layout/Accordion/Accordion.d.ts.map +1 -1
- package/dist/atoms/components/layout/Accordion/index.d.ts +1 -1
- package/dist/atoms/components/layout/Accordion/index.d.ts.map +1 -1
- package/dist/atoms/components/layout/Breadcrumb/Breadcrumb.d.ts +2 -3
- package/dist/atoms/components/layout/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/atoms/components/layout/Breadcrumb/index.d.ts +1 -1
- package/dist/atoms/components/layout/Breadcrumb/index.d.ts.map +1 -1
- package/dist/atoms/components/layout/Dialog/Dialog.d.ts +45 -0
- package/dist/atoms/components/layout/Dialog/Dialog.d.ts.map +1 -0
- package/dist/atoms/components/layout/Dialog/index.d.ts +2 -2
- package/dist/atoms/components/layout/Dialog/index.d.ts.map +1 -1
- package/dist/atoms/components/layout/Dropdown/Dropdown.d.ts +9 -9
- package/dist/atoms/components/layout/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/atoms/components/layout/Dropdown/index.d.ts +2 -2
- package/dist/atoms/components/layout/Dropdown/index.d.ts.map +1 -1
- package/dist/atoms/components/layout/Modal/Modal.d.ts +6 -6
- package/dist/atoms/components/layout/Modal/Modal.d.ts.map +1 -1
- package/dist/atoms/components/layout/Modal/index.d.ts +2 -2
- package/dist/atoms/components/layout/Tabs/Tabs.d.ts +46 -0
- package/dist/atoms/components/layout/Tabs/Tabs.d.ts.map +1 -0
- package/dist/atoms/components/layout/Tabs/index.d.ts +1 -1
- package/dist/atoms/components/layout/Tooltip/Tooltip.d.ts +6 -6
- package/dist/atoms/components/layout/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/atoms/components/layout/Tooltip/index.d.ts +1 -1
- package/dist/atoms/components/layout/index.d.ts +7 -7
- package/dist/atoms/components/layout/index.d.ts.map +1 -1
- package/dist/atoms/components/navigation/GlobalSearch/GlobalSearch.d.ts +2 -3
- package/dist/atoms/components/navigation/GlobalSearch/GlobalSearch.d.ts.map +1 -1
- package/dist/atoms/components/navigation/GlobalSearch/index.d.ts +1 -1
- package/dist/atoms/components/navigation/GlobalSearch/index.d.ts.map +1 -1
- package/dist/atoms/components/navigation/index.d.ts +1 -1
- package/dist/atoms/components/theme/ColorSwatch/ColorSwatch.d.ts +2 -2
- package/dist/atoms/components/theme/ColorSwatch/ColorSwatch.d.ts.map +1 -1
- package/dist/atoms/components/theme/ColorSwatch/index.d.ts +1 -1
- package/dist/atoms/components/theme/DarkModeToggle.d.ts.map +1 -1
- package/dist/atoms/components/theme/PaletteSwitcher.d.ts +1 -1
- package/dist/atoms/components/theme/PaletteSwitcher.d.ts.map +1 -1
- package/dist/atoms/components/theme/StyleGuide.d.ts +1 -1
- package/dist/atoms/components/theme/StyleGuide.d.ts.map +1 -1
- package/dist/atoms/components/theme/index.d.ts +4 -4
- package/dist/atoms/components/user/UserAvatar/UserAvatar.d.ts +2 -3
- package/dist/atoms/components/user/UserAvatar/UserAvatar.d.ts.map +1 -1
- package/dist/atoms/components/user/UserAvatar/index.d.ts +1 -1
- package/dist/atoms/components/user/UserAvatar/index.d.ts.map +1 -1
- package/dist/atoms/components/user/UserMenu/UserMenu.d.ts +2 -3
- package/dist/atoms/components/user/UserMenu/UserMenu.d.ts.map +1 -1
- package/dist/atoms/components/user/UserMenu/index.d.ts +1 -1
- package/dist/atoms/components/user/UserMenu/index.d.ts.map +1 -1
- package/dist/atoms/components/user/index.d.ts +2 -2
- package/dist/atoms/config/responsive.d.ts +16 -16
- package/dist/atoms/config/responsive.d.ts.map +1 -1
- package/dist/atoms/hooks/index.d.ts +4 -4
- package/dist/atoms/hooks/use-toast.d.ts +1 -1
- package/dist/atoms/hooks/use-toast.d.ts.map +1 -1
- package/dist/atoms/hooks/useApi.d.ts +2 -2
- package/dist/atoms/hooks/useApi.d.ts.map +1 -1
- package/dist/atoms/hooks/useResponsive.d.ts +1 -1
- package/dist/atoms/hooks/useResponsive.d.ts.map +1 -1
- package/dist/atoms/index.d.ts +6 -7
- package/dist/atoms/index.d.ts.map +1 -1
- package/dist/atoms/primitives/Badge.d.ts +6 -6
- package/dist/atoms/primitives/Badge.d.ts.map +1 -1
- package/dist/atoms/primitives/ErrorBoundary.d.ts +3 -3
- package/dist/atoms/primitives/ErrorBoundary.d.ts.map +1 -1
- package/dist/atoms/primitives/Select.d.ts +9 -7
- package/dist/atoms/primitives/Select.d.ts.map +1 -1
- package/dist/atoms/primitives/Switch.d.ts +4 -3
- package/dist/atoms/primitives/Switch.d.ts.map +1 -1
- package/dist/atoms/primitives/Tabs.d.ts +10 -10
- package/dist/atoms/primitives/Tabs.d.ts.map +1 -1
- package/dist/atoms/primitives/avatar.d.ts.map +1 -1
- package/dist/atoms/primitives/button.d.ts +2 -5
- package/dist/atoms/primitives/button.d.ts.map +1 -1
- package/dist/atoms/primitives/button.variants.d.ts +7 -0
- package/dist/atoms/primitives/button.variants.d.ts.map +1 -0
- package/dist/atoms/primitives/card.d.ts +3 -2
- package/dist/atoms/primitives/card.d.ts.map +1 -1
- package/dist/atoms/primitives/checkbox.d.ts +3 -3
- package/dist/atoms/primitives/checkbox.d.ts.map +1 -1
- package/dist/atoms/primitives/dialog.d.ts +4 -4
- package/dist/atoms/primitives/dialog.d.ts.map +1 -1
- package/dist/atoms/primitives/dropdown-menu.d.ts.map +1 -1
- package/dist/atoms/primitives/index.d.ts +16 -16
- package/dist/atoms/primitives/index.d.ts.map +1 -1
- package/dist/atoms/primitives/input.d.ts.map +1 -1
- package/dist/atoms/primitives/label.d.ts +4 -3
- package/dist/atoms/primitives/label.d.ts.map +1 -1
- package/dist/atoms/primitives/skeleton.d.ts.map +1 -1
- package/dist/atoms/primitives/spinner.d.ts +5 -5
- package/dist/atoms/primitives/spinner.d.ts.map +1 -1
- package/dist/atoms/primitives/table.d.ts.map +1 -1
- package/dist/atoms/services/api/client.d.ts +11 -2
- package/dist/atoms/services/api/client.d.ts.map +1 -1
- package/dist/atoms/services/auth-service.d.ts +1 -1
- package/dist/atoms/services/auth-service.d.ts.map +1 -1
- package/dist/atoms/services/health.d.ts +2 -2
- package/dist/atoms/services/index.d.ts +3 -3
- package/dist/atoms/shared/config/dashboard-sizes.d.ts +17 -17
- package/dist/atoms/shared/config/dashboard-sizes.d.ts.map +1 -1
- package/dist/atoms/shared/config/environment.d.ts.map +1 -1
- package/dist/atoms/shared/index.d.ts +4 -4
- package/dist/atoms/shared/index.d.ts.map +1 -1
- package/dist/atoms/types/auth.d.ts +11 -1
- package/dist/atoms/types/auth.d.ts.map +1 -1
- package/dist/atoms/types/entity-config.d.ts +9 -9
- package/dist/atoms/types/entity-config.d.ts.map +1 -1
- package/dist/atoms/types/generated.d.ts.map +1 -1
- package/dist/atoms/types/index.d.ts +6 -6
- package/dist/atoms/types/loading.d.ts +1 -1
- package/dist/atoms/types/navigation.d.ts +1 -1
- package/dist/atoms/types/navigation.d.ts.map +1 -1
- package/dist/atoms/types/ui-config.d.ts +8 -8
- package/dist/atoms/types/ui-config.d.ts.map +1 -1
- package/dist/atoms/utils/animations.d.ts +7 -7
- package/dist/atoms/utils/animations.d.ts.map +1 -1
- package/dist/atoms/utils/color-manager.d.ts +1 -1
- package/dist/atoms/utils/debounce.d.ts +1 -1
- package/dist/atoms/utils/debounce.d.ts.map +1 -1
- package/dist/atoms/utils/field-detection.d.ts +2 -2
- package/dist/atoms/utils/field-detection.d.ts.map +1 -1
- package/dist/atoms/utils/icon-map.d.ts +68 -0
- package/dist/atoms/utils/icon-map.d.ts.map +1 -0
- package/dist/atoms/utils/icon-resolver.d.ts +7 -67
- package/dist/atoms/utils/icon-resolver.d.ts.map +1 -1
- package/dist/atoms/utils/index.d.ts +4 -4
- package/dist/atoms/utils/metric-engine.d.ts +2 -10
- package/dist/atoms/utils/metric-engine.d.ts.map +1 -1
- package/dist/atoms/utils/tooltip-helpers.d.ts +1 -1
- package/dist/atoms/utils/tooltip-helpers.d.ts.map +1 -1
- package/dist/atoms/utils/ui-mapping.d.ts +6 -4
- package/dist/atoms/utils/ui-mapping.d.ts.map +1 -1
- package/dist/atoms/utils/utils.d.ts +7 -6
- package/dist/atoms/utils/utils.d.ts.map +1 -1
- package/dist/codegen/openapi/bulk-types.d.ts +4 -4
- package/dist/codegen/openapi/bulk-types.d.ts.map +1 -1
- package/dist/features/auth/components/LoginForm.d.ts.map +1 -1
- package/dist/features/auth/components/LogoutButton.d.ts.map +1 -1
- package/dist/features/auth/components/ProtectedRoute.d.ts +2 -2
- package/dist/features/auth/components/ProtectedRoute.d.ts.map +1 -1
- package/dist/features/auth/components/index.d.ts +3 -3
- package/dist/features/auth/hooks/auth-context.d.ts +3 -0
- package/dist/features/auth/hooks/auth-context.d.ts.map +1 -0
- package/dist/features/auth/hooks/index.d.ts +4 -3
- package/dist/features/auth/hooks/index.d.ts.map +1 -1
- package/dist/features/auth/hooks/use-auth.d.ts +3 -0
- package/dist/features/auth/hooks/use-auth.d.ts.map +1 -0
- package/dist/features/auth/hooks/useAuth.d.ts +3 -4
- package/dist/features/auth/hooks/useAuth.d.ts.map +1 -1
- package/dist/features/auth/hooks/useAuthContext.d.ts +1 -1
- package/dist/features/auth/hooks/useAuthContext.d.ts.map +1 -1
- package/dist/features/auth/hooks/usePermissions.d.ts +3 -3
- package/dist/features/auth/index.d.ts +3 -3
- package/dist/features/auth/providers/MockAuthProvider.d.ts +3 -4
- package/dist/features/auth/providers/MockAuthProvider.d.ts.map +1 -1
- package/dist/features/auth/providers/index.d.ts +2 -1
- package/dist/features/auth/providers/index.d.ts.map +1 -1
- package/dist/features/auth/providers/mock-auth-context.d.ts +3 -0
- package/dist/features/auth/providers/mock-auth-context.d.ts.map +1 -0
- package/dist/features/auth/providers/use-mock-auth.d.ts +3 -0
- package/dist/features/auth/providers/use-mock-auth.d.ts.map +1 -0
- package/dist/features/auth/services/mock-auth-service.d.ts +3 -3
- package/dist/features/auth/services/mock-auth-service.d.ts.map +1 -1
- package/dist/features/index.d.ts +1 -1
- package/dist/frontend-patterns.css +713 -576
- package/dist/index.d.ts +17 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +21400 -21788
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +21404 -21792
- package/dist/index.js.map +1 -1
- package/dist/molecules/forms/FormGroup.d.ts +2 -2
- package/dist/molecules/forms/FormGroup.d.ts.map +1 -1
- package/dist/molecules/forms/SearchInput.d.ts +1 -1
- package/dist/molecules/forms/SearchInput.d.ts.map +1 -1
- package/dist/molecules/forms/index.d.ts +2 -2
- package/dist/molecules/forms/index.d.ts.map +1 -1
- package/dist/molecules/index.d.ts +3 -3
- package/dist/molecules/layout/AppHeader/AppHeader.d.ts +1 -1
- package/dist/molecules/layout/AppHeader/AppHeader.d.ts.map +1 -1
- package/dist/molecules/layout/AppHeader/index.d.ts +1 -1
- package/dist/molecules/layout/BulkSelectionBar.d.ts +2 -2
- package/dist/molecules/layout/BulkSelectionBar.d.ts.map +1 -1
- package/dist/molecules/layout/DashboardWithSidePanel/DashboardWithSidePanel.d.ts +1 -1
- package/dist/molecules/layout/DashboardWithSidePanel/index.d.ts +1 -1
- package/dist/molecules/layout/NavigationContext.d.ts +3 -9
- package/dist/molecules/layout/NavigationContext.d.ts.map +1 -1
- package/dist/molecules/layout/PageTemplate.d.ts +1 -1
- package/dist/molecules/layout/PageTemplate.d.ts.map +1 -1
- package/dist/molecules/layout/SectionHeader/SectionHeader.d.ts +4 -4
- package/dist/molecules/layout/SectionHeader/SectionHeader.d.ts.map +1 -1
- package/dist/molecules/layout/SectionHeader/index.d.ts +1 -1
- package/dist/molecules/layout/ShowcaseSection.d.ts +4 -4
- package/dist/molecules/layout/ShowcaseSection.d.ts.map +1 -1
- package/dist/molecules/layout/Sidebar.d.ts.map +1 -1
- package/dist/molecules/layout/SidebarButton/SidebarButton.d.ts +1 -1
- package/dist/molecules/layout/SidebarButton/SidebarButton.d.ts.map +1 -1
- package/dist/molecules/layout/SidebarButton/index.d.ts +1 -1
- package/dist/molecules/layout/SidebarContext.d.ts +1 -8
- package/dist/molecules/layout/SidebarContext.d.ts.map +1 -1
- package/dist/molecules/layout/index.d.ts +14 -11
- package/dist/molecules/layout/index.d.ts.map +1 -1
- package/dist/molecules/layout/navigation-context.d.ts +9 -0
- package/dist/molecules/layout/navigation-context.d.ts.map +1 -0
- package/dist/molecules/layout/sidebar-context.d.ts +7 -0
- package/dist/molecules/layout/sidebar-context.d.ts.map +1 -0
- package/dist/molecules/layout/use-navigation.d.ts +2 -0
- package/dist/molecules/layout/use-navigation.d.ts.map +1 -0
- package/dist/molecules/layout/use-sidebar.d.ts +2 -0
- package/dist/molecules/layout/use-sidebar.d.ts.map +1 -0
- package/dist/molecules/navigation/NavMenu.d.ts +2 -2
- package/dist/molecules/navigation/NavMenu.d.ts.map +1 -1
- package/dist/molecules/navigation/Pagination.d.ts +2 -2
- package/dist/molecules/navigation/index.d.ts +2 -2
- package/dist/organisms/index.d.ts +1 -1
- package/dist/organisms/showcase/ComponentShowcasePage.d.ts +1 -1
- package/dist/organisms/showcase/ComponentShowcasePage.d.ts.map +1 -1
- package/dist/templates/AuthTemplate.d.ts +4 -4
- package/dist/templates/AuthTemplate.d.ts.map +1 -1
- package/dist/templates/ComponentShowcaseTemplate.d.ts +7 -7
- package/dist/templates/ComponentShowcaseTemplate.d.ts.map +1 -1
- package/dist/templates/DashboardTemplate.d.ts +3 -3
- package/dist/templates/DashboardTemplate.d.ts.map +1 -1
- package/dist/templates/DataTemplate.d.ts +3 -3
- package/dist/templates/DataTemplate.d.ts.map +1 -1
- package/dist/templates/EnhancedDataTemplate.d.ts +11 -11
- package/dist/templates/EnhancedDataTemplate.d.ts.map +1 -1
- package/dist/templates/EnhancedDataTemplate.hooks.bulk.d.ts +2 -2
- package/dist/templates/EnhancedDataTemplate.hooks.bulk.d.ts.map +1 -1
- package/dist/templates/EnhancedDataTemplate.hooks.d.ts +4 -4
- package/dist/templates/EnhancedDataTemplate.hooks.d.ts.map +1 -1
- package/dist/templates/admin/AdminCRUDTemplate.d.ts +4 -4
- package/dist/templates/admin/AdminCRUDTemplate.d.ts.map +1 -1
- package/dist/templates/admin/AdminDashboardTemplate.d.ts +7 -7
- package/dist/templates/admin/AdminDashboardTemplate.d.ts.map +1 -1
- package/dist/templates/admin/AdminDetailTemplate.d.ts +4 -4
- package/dist/templates/admin/AdminDetailTemplate.d.ts.map +1 -1
- package/dist/templates/admin/index.d.ts +3 -3
- package/dist/templates/admin/index.d.ts.map +1 -1
- package/dist/templates/api/APIDataTemplate.d.ts +14 -9
- package/dist/templates/api/APIDataTemplate.d.ts.map +1 -1
- package/dist/templates/api/create-api-data-template.d.ts +4 -0
- package/dist/templates/api/create-api-data-template.d.ts.map +1 -0
- package/dist/templates/api/index.d.ts +3 -2
- package/dist/templates/api/index.d.ts.map +1 -1
- package/dist/templates/factory.d.ts +3 -3
- package/dist/templates/factory.d.ts.map +1 -1
- package/dist/templates/index.d.ts +8 -8
- package/dist/templates/index.d.ts.map +1 -1
- package/package.json +10 -7
- package/LICENSE +0 -19
- package/cli/cli/commands/generate-hooks.js +0 -291
- package/cli/cli/commands/init.js +0 -25
- package/cli/cli/commands/scaffold.js +0 -201
- package/cli/cli/index.js +0 -113
- package/cli/commands/generate-hooks.js +0 -291
- package/cli/commands/init.js +0 -25
- package/cli/commands/scaffold.js +0 -201
- package/cli/index.js +0 -6665
- package/cli/src/codegen/openapi/bulk-hook-generator.js +0 -252
- package/cli/src/codegen/openapi/bulk-types.js +0 -89
- package/dist/atoms/components/data/ActivityFeed/ActivityFeed.stories.d.ts +0 -38
- package/dist/atoms/components/data/ActivityFeed/ActivityFeed.stories.d.ts.map +0 -1
- package/dist/codegen/index.d.ts +0 -7
- package/dist/codegen/index.d.ts.map +0 -1
- package/dist/codegen/openapi/bulk-hook-generator.d.ts +0 -40
- package/dist/codegen/openapi/bulk-hook-generator.d.ts.map +0 -1
- package/dist/codegen/openapi/client-generator.d.ts +0 -52
- package/dist/codegen/openapi/client-generator.d.ts.map +0 -1
- package/dist/codegen/openapi/confidence-scorer.d.ts +0 -30
- package/dist/codegen/openapi/confidence-scorer.d.ts.map +0 -1
- package/dist/codegen/openapi/hook-config.d.ts +0 -50
- package/dist/codegen/openapi/hook-config.d.ts.map +0 -1
- package/dist/codegen/openapi/hook-generator.d.ts +0 -108
- package/dist/codegen/openapi/hook-generator.d.ts.map +0 -1
- package/dist/codegen/openapi/index.d.ts +0 -27
- package/dist/codegen/openapi/index.d.ts.map +0 -1
- package/dist/codegen/openapi/parser.d.ts +0 -107
- package/dist/codegen/openapi/parser.d.ts.map +0 -1
- package/dist/codegen/openapi/type-generator.d.ts +0 -53
- package/dist/codegen/openapi/type-generator.d.ts.map +0 -1
- package/dist/generated/client/client.d.ts +0 -23
- package/dist/generated/client/client.d.ts.map +0 -1
- package/dist/generated/client/config.d.ts +0 -10
- package/dist/generated/client/config.d.ts.map +0 -1
- package/dist/generated/client/index.d.ts +0 -12
- package/dist/generated/client/index.d.ts.map +0 -1
- package/dist/generated/client/methods.d.ts +0 -591
- package/dist/generated/client/methods.d.ts.map +0 -1
- package/dist/generated/client/types.d.ts +0 -37
- package/dist/generated/client/types.d.ts.map +0 -1
- package/dist/generated/example.d.ts +0 -8
- package/dist/generated/example.d.ts.map +0 -1
- package/dist/generated/hooks/index.d.ts +0 -11
- package/dist/generated/hooks/index.d.ts.map +0 -1
- package/dist/generated/hooks/keys.d.ts +0 -59
- package/dist/generated/hooks/keys.d.ts.map +0 -1
- package/dist/generated/hooks/mutations.d.ts +0 -551
- package/dist/generated/hooks/mutations.d.ts.map +0 -1
- package/dist/generated/hooks/queries.d.ts +0 -426
- package/dist/generated/hooks/queries.d.ts.map +0 -1
- package/dist/generated/hooks/types.d.ts +0 -318
- package/dist/generated/hooks/types.d.ts.map +0 -1
- package/dist/generated/index.d.ts +0 -13
- package/dist/generated/index.d.ts.map +0 -1
- package/dist/generated/types/endpoints.d.ts +0 -1364
- package/dist/generated/types/endpoints.d.ts.map +0 -1
- package/dist/generated/types/index.d.ts +0 -11
- package/dist/generated/types/index.d.ts.map +0 -1
- package/dist/generated/types/parameters.d.ts +0 -8
- package/dist/generated/types/parameters.d.ts.map +0 -1
- package/dist/generated/types/responses.d.ts +0 -8
- package/dist/generated/types/responses.d.ts.map +0 -1
- package/dist/generated/types/schemas.d.ts +0 -652
- package/dist/generated/types/schemas.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,81 +5,76 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [Unreleased]
|
|
9
9
|
|
|
10
10
|
### Fixed
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
11
|
+
- **TypeScript Build Errors**: Resolved all TypeScript compilation errors across codegen and auth modules
|
|
12
|
+
- Added missing type imports in OpenAPI codegen (`ParsedParameter`, `ClientGeneratorOptions`)
|
|
13
|
+
- Fixed OpenAPIV3 namespace imports and type casting
|
|
14
|
+
- Corrected parser method signatures and response array handling
|
|
15
|
+
- Updated `isListEndpoint` to correctly access responses as array
|
|
16
|
+
- **Auth Type System**: Consolidated user types for better type safety
|
|
17
|
+
- Moved `name`, `roles`, and `permissions` to `BaseUser` as optional fields
|
|
18
|
+
- Made `ExtendedUser` a type alias to `BaseUser` for backward compatibility
|
|
19
|
+
- Updated `MockAuthService` and `MockAuthProvider` to use consolidated types
|
|
20
|
+
- Added proper `RegisterData` interface
|
|
21
|
+
- **Test Suite**: Fixed all test failures
|
|
22
|
+
- Updated hook generator tests to use correct `ParsedEndpoint` response format (array instead of object)
|
|
23
|
+
- All 173 tests now passing
|
|
24
|
+
- **Performance**: Improved MockAuthProvider performance
|
|
25
|
+
- Added memoization to prevent creating new auth service instance on every render
|
|
26
|
+
- **Component Exports**: Standardized component export patterns
|
|
27
|
+
- Consolidated type exports using modern TypeScript syntax (`export { Component, type Props }`)
|
|
15
28
|
|
|
16
29
|
### Changed
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
- **
|
|
42
|
-
- **
|
|
43
|
-
- **
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
-
|
|
68
|
-
|
|
69
|
-
### Infrastructure
|
|
70
|
-
- Vite-based build system
|
|
71
|
-
- ESLint rules for design system compliance
|
|
72
|
-
- Local development testing setup
|
|
73
|
-
- NPM package distribution ready
|
|
74
|
-
|
|
75
|
-
### Documentation
|
|
76
|
-
- Comprehensive README with examples
|
|
77
|
-
- Atomic architecture guidelines
|
|
78
|
-
- Hook generation guide
|
|
79
|
-
- Design system documentation
|
|
80
|
-
|
|
81
|
-
---
|
|
82
|
-
|
|
83
|
-
This is the foundation release of Pattern Stack Frontend Patterns - a reusable React template for building production-ready applications with minimal boilerplate.
|
|
84
|
-
|
|
85
|
-
Built with ❤️ for developers who want to focus on business logic, not infrastructure.
|
|
30
|
+
- **SkeletonAvatar API**: Changed from `size` prop to separate `width` and `height` props
|
|
31
|
+
- **Breaking Change**: `<SkeletonAvatar size={40} />` is no longer supported
|
|
32
|
+
- **Migration**: Use `<SkeletonAvatar width={40} height={40} />` instead
|
|
33
|
+
- Added comprehensive JSDoc with migration examples
|
|
34
|
+
- **DataTable Templates**: Removed unsupported props from DataTemplate usage
|
|
35
|
+
- Removed `onSort`, `selectedRows`, `onSelectionChange` props
|
|
36
|
+
- Added TODO comments for future server-side sorting support (FRO-4)
|
|
37
|
+
|
|
38
|
+
### Removed
|
|
39
|
+
- **Map Components**: Temporarily removed map component suite due to `react-map-gl` type compatibility issues
|
|
40
|
+
- Removed: `MapCluster`, `MapContainer`, `MapHeatmap`, `MapMarker`, `MapPolygon`, `MapPopup`, `MapRoute`
|
|
41
|
+
- Removed: `MapProvider` context system
|
|
42
|
+
- Removed: `DataMap` and `LocationPicker` composed components
|
|
43
|
+
- Removed: Map-related templates and demo pages
|
|
44
|
+
- **Note**: Components preserved in `backup/map-components` branch for future restoration
|
|
45
|
+
- **Impact**: Applications using map components will need to use alternative mapping solutions until type issues are resolved
|
|
46
|
+
- **Entity Templates**: Removed incomplete entity template and organism components
|
|
47
|
+
- Removed: `EntityManagementTemplate`, `EntityPerformanceDashboardTemplate`
|
|
48
|
+
- Removed: `CategoryBreakdownPanel`, `EntityListPanel`, `MetricsOverviewPanel`, `TrendAnalysisPanel`
|
|
49
|
+
- **Reason**: Incomplete implementations with placeholder text and non-functional features
|
|
50
|
+
- **Note**: Will be properly implemented in example applications and promoted back to template when production-ready
|
|
51
|
+
- **Metric Card Refactoring**: Removed incomplete metric card refactoring files
|
|
52
|
+
- Removed: `MetricCardRefactored.tsx`, `NewMetricCard.tsx`, `NewMetricCard.demo.tsx`, `NewMetricCard.meta.ts`, `NewMetricCard.presets.tsx`, `REFACTORING.md`
|
|
53
|
+
- Removed: 16 commented export placeholders in `variants/index.ts`
|
|
54
|
+
- **Reason**: Only 3 of 19 variants were refactored, leaving most functionality using fallback implementations
|
|
55
|
+
- **Note**: Original MetricCard remains fully functional
|
|
56
|
+
- **Bulk Operations Code**: Removed commented placeholder code for future FRO-35 implementation
|
|
57
|
+
- Removed: ~150 lines of commented code from `hook-generator.ts`
|
|
58
|
+
- Removed: `APIConfig` interface, `detectResourceOperations()` method, `createDefaultConfig()` method
|
|
59
|
+
- **Reason**: Placeholder code should not ship in pre-release; will implement from scratch when FRO-35 begins
|
|
60
|
+
- **Impact**: No impact - code was non-functional and commented out
|
|
61
|
+
- **Production Code Cleanup**: Removed debug and temporary code
|
|
62
|
+
- Removed: Console.log statements from `hook-generator.ts`
|
|
63
|
+
- Removed: Placeholder alert() handlers from `UserAvatar.tsx` (replaced with documented extension points)
|
|
64
|
+
- Removed: WIP/TODO comments from `Chart.tsx` (replaced with professional JSDoc)
|
|
65
|
+
|
|
66
|
+
### Internal
|
|
67
|
+
- **Build Status**: Clean TypeScript compilation with zero errors
|
|
68
|
+
- **Test Coverage**: 173/173 tests passing across 17 test files
|
|
69
|
+
- **Type Safety**: Improved type inference throughout auth and codegen modules
|
|
70
|
+
- **Code Quality**:
|
|
71
|
+
- Better component organization and import consistency
|
|
72
|
+
- Removed ~600+ lines of incomplete, commented, or placeholder code
|
|
73
|
+
- No console statements in production code
|
|
74
|
+
- All components have professional documentation
|
|
75
|
+
- Clean pre-release state with no partial implementations
|
|
76
|
+
|
|
77
|
+
## Version History
|
|
78
|
+
|
|
79
|
+
### Pre-release Development
|
|
80
|
+
This is a pre-release version of the React Frontend Template. Breaking changes may occur without prior notice until v1.0.0 release.
|
package/README.md
CHANGED
|
@@ -34,11 +34,26 @@ app.addRoutes("/reports", ReportsRoutes)
|
|
|
34
34
|
|
|
35
35
|
### Installation
|
|
36
36
|
|
|
37
|
+
This is a private package published to npm. Install using standard npm commands:
|
|
38
|
+
|
|
37
39
|
```bash
|
|
38
|
-
# Install
|
|
40
|
+
# Install latest version
|
|
39
41
|
npm install @pattern-stack/frontend-patterns
|
|
40
42
|
|
|
41
|
-
#
|
|
43
|
+
# Install specific version
|
|
44
|
+
npm install @pattern-stack/frontend-patterns@0.2.0-alpha.0
|
|
45
|
+
|
|
46
|
+
# Or add to package.json dependencies
|
|
47
|
+
{
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@pattern-stack/frontend-patterns": "^0.2.0-alpha.0"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
**For Local Development:**
|
|
55
|
+
```bash
|
|
56
|
+
# Install from local filesystem
|
|
42
57
|
npm install file:../path/to/frontend-patterns
|
|
43
58
|
|
|
44
59
|
# Or link for active development
|
|
@@ -7,12 +7,16 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { promises as fs } from 'fs'
|
|
10
|
-
import { join, dirname
|
|
10
|
+
import { join, dirname } from 'path'
|
|
11
|
+
import { fileURLToPath } from 'url'
|
|
11
12
|
import { loadOpenAPISpec, parseOpenAPI } from '../../src/codegen/openapi/parser.js'
|
|
12
13
|
import { generateTypes } from '../../src/codegen/openapi/type-generator.js'
|
|
13
14
|
import { generateAPIClient } from '../../src/codegen/openapi/client-generator.js'
|
|
14
15
|
import { generateHooks } from '../../src/codegen/openapi/hook-generator.js'
|
|
15
16
|
|
|
17
|
+
const __filename = fileURLToPath(import.meta.url)
|
|
18
|
+
const __dirname = dirname(__filename)
|
|
19
|
+
|
|
16
20
|
interface GenerateHooksOptions {
|
|
17
21
|
output: string
|
|
18
22
|
prefix?: string
|
|
@@ -121,6 +125,11 @@ export async function generateHooksCommand(source: string, options: GenerateHook
|
|
|
121
125
|
await writeFile(join(options.output, 'hooks', 'keys.ts'), hooks.keys)
|
|
122
126
|
await writeFile(join(options.output, 'hooks', 'types.ts'), hooks.types)
|
|
123
127
|
await writeFile(join(options.output, 'hooks', 'index.ts'), hooks.index)
|
|
128
|
+
|
|
129
|
+
// Copy bulk-types.ts to output directory (referenced by hooks/types.ts)
|
|
130
|
+
const bulkTypesPath = join(__dirname, '../../src/codegen/openapi/bulk-types.ts')
|
|
131
|
+
const bulkTypesContent = await fs.readFile(bulkTypesPath, 'utf8')
|
|
132
|
+
await writeFile(join(options.output, 'bulk-types.ts'), bulkTypesContent)
|
|
124
133
|
|
|
125
134
|
// Write confidence report if available
|
|
126
135
|
if (hooks.report) {
|
|
@@ -154,10 +163,10 @@ export { queryKeys } from './hooks'`
|
|
|
154
163
|
|
|
155
164
|
await writeFile(join(options.output, 'index.ts'), mainIndex)
|
|
156
165
|
|
|
157
|
-
// Generate usage example
|
|
166
|
+
// Generate usage example (as .tsx since it contains JSX)
|
|
158
167
|
const usageExample = generateUsageExample(spec.info.title, options)
|
|
159
|
-
await writeFile(join(options.output, 'example.
|
|
160
|
-
|
|
168
|
+
await writeFile(join(options.output, 'example.tsx'), usageExample)
|
|
169
|
+
|
|
161
170
|
console.log()
|
|
162
171
|
console.log('✅ Generation complete!')
|
|
163
172
|
console.log(`📦 Generated files in: ${options.output}`)
|
|
@@ -165,7 +174,7 @@ export { queryKeys } from './hooks'`
|
|
|
165
174
|
console.log('🚀 Quick start:')
|
|
166
175
|
console.log(`import { createAPIClient, useGetUsers } from './${options.output}'`)
|
|
167
176
|
console.log()
|
|
168
|
-
console.log('💡 See example.
|
|
177
|
+
console.log('💡 See example.tsx for detailed usage instructions')
|
|
169
178
|
|
|
170
179
|
} catch (error) {
|
|
171
180
|
console.error('❌ Generation failed:')
|
|
@@ -177,7 +186,7 @@ export { queryKeys } from './hooks'`
|
|
|
177
186
|
async function ensureDir(dir: string) {
|
|
178
187
|
try {
|
|
179
188
|
await fs.mkdir(dir, { recursive: true })
|
|
180
|
-
} catch
|
|
189
|
+
} catch {
|
|
181
190
|
// Directory might already exist
|
|
182
191
|
}
|
|
183
192
|
}
|
package/cli/commands/scaffold.ts
CHANGED
package/cli/index.ts
CHANGED
|
@@ -18,9 +18,7 @@ const program = new Command()
|
|
|
18
18
|
program
|
|
19
19
|
.name('pattern-stack')
|
|
20
20
|
.description('Pattern-Stack CLI for code generation and scaffolding')
|
|
21
|
-
.version('0.
|
|
22
|
-
.helpOption('-h, --help', 'Display help for command')
|
|
23
|
-
.addHelpText('after', '\nExamples:\n $ pattern-stack generate hooks ./openapi.json --output ./src/api\n $ pattern-stack scaffold component UserCard\n $ pattern-stack init financial --name my-app')
|
|
21
|
+
.version('1.0.0')
|
|
24
22
|
|
|
25
23
|
// Generate commands
|
|
26
24
|
const generateCommand = program
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
import { singularize, pluralize, isPlural } from '../naming-utils.js';
|
|
2
|
+
|
|
3
|
+
describe('singularize()', () => {
|
|
4
|
+
describe('regular plurals', () => {
|
|
5
|
+
it('should convert cats to cat', () => {
|
|
6
|
+
expect(singularize('cats')).toBe('cat');
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
it('should convert dogs to dog', () => {
|
|
10
|
+
expect(singularize('dogs')).toBe('dog');
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('should convert users to user', () => {
|
|
14
|
+
expect(singularize('users')).toBe('user');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should convert accounts to account', () => {
|
|
18
|
+
expect(singularize('accounts')).toBe('account');
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe('-ies plurals', () => {
|
|
23
|
+
it('should convert activities to activity', () => {
|
|
24
|
+
expect(singularize('activities')).toBe('activity');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should convert categories to category', () => {
|
|
28
|
+
expect(singularize('categories')).toBe('category');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should convert companies to company', () => {
|
|
32
|
+
expect(singularize('companies')).toBe('company');
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should convert opportunities to opportunity', () => {
|
|
36
|
+
expect(singularize('opportunities')).toBe('opportunity');
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe('-es plurals', () => {
|
|
41
|
+
it('should convert boxes to box', () => {
|
|
42
|
+
expect(singularize('boxes')).toBe('box');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('should convert watches to watch', () => {
|
|
46
|
+
expect(singularize('watches')).toBe('watch');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should convert dishes to dish', () => {
|
|
50
|
+
expect(singularize('dishes')).toBe('dish');
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('should convert benches to bench', () => {
|
|
54
|
+
expect(singularize('benches')).toBe('bench');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
describe('-ses plurals (tricky cases)', () => {
|
|
59
|
+
it('should convert addresses to address', () => {
|
|
60
|
+
expect(singularize('addresses')).toBe('address');
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it('should convert businesses to business', () => {
|
|
64
|
+
expect(singularize('businesses')).toBe('business');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('should convert processes to process', () => {
|
|
68
|
+
expect(singularize('processes')).toBe('process');
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
describe('irregular plurals', () => {
|
|
73
|
+
it('should convert people to person', () => {
|
|
74
|
+
expect(singularize('people')).toBe('person');
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('should convert children to child', () => {
|
|
78
|
+
expect(singularize('children')).toBe('child');
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('should convert men to man', () => {
|
|
82
|
+
expect(singularize('men')).toBe('man');
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('should convert women to woman', () => {
|
|
86
|
+
expect(singularize('women')).toBe('woman');
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
describe('already singular', () => {
|
|
91
|
+
it('should keep data as data', () => {
|
|
92
|
+
expect(singularize('data')).toBe('data');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('should keep metadata as metadata', () => {
|
|
96
|
+
expect(singularize('metadata')).toBe('metadata');
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('should keep user as user', () => {
|
|
100
|
+
expect(singularize('user')).toBe('user');
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('should keep account as account', () => {
|
|
104
|
+
expect(singularize('account')).toBe('account');
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
describe('edge cases', () => {
|
|
109
|
+
it('should keep status as status', () => {
|
|
110
|
+
expect(singularize('status')).toBe('status');
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('should keep class as class', () => {
|
|
114
|
+
expect(singularize('class')).toBe('class');
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('should keep bus as bus', () => {
|
|
118
|
+
expect(singularize('bus')).toBe('bus');
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('should convert pass to pass (not pas)', () => {
|
|
122
|
+
expect(singularize('pass')).toBe('pass');
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('should handle empty string', () => {
|
|
126
|
+
expect(singularize('')).toBe('');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it('should handle single character', () => {
|
|
130
|
+
expect(singularize('a')).toBe('a');
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
describe('pluralize()', () => {
|
|
136
|
+
describe('regular plurals', () => {
|
|
137
|
+
it('should convert cat to cats', () => {
|
|
138
|
+
expect(pluralize('cat')).toBe('cats');
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
it('should convert dog to dogs', () => {
|
|
142
|
+
expect(pluralize('dog')).toBe('dogs');
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it('should convert user to users', () => {
|
|
146
|
+
expect(pluralize('user')).toBe('users');
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('should convert account to accounts', () => {
|
|
150
|
+
expect(pluralize('account')).toBe('accounts');
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
describe('-y endings (consonant + y)', () => {
|
|
155
|
+
it('should convert activity to activities', () => {
|
|
156
|
+
expect(pluralize('activity')).toBe('activities');
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it('should convert category to categories', () => {
|
|
160
|
+
expect(pluralize('category')).toBe('categories');
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('should convert company to companies', () => {
|
|
164
|
+
expect(pluralize('company')).toBe('companies');
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('should convert opportunity to opportunities', () => {
|
|
168
|
+
expect(pluralize('opportunity')).toBe('opportunities');
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
describe('vowel + y endings', () => {
|
|
173
|
+
it('should convert day to days', () => {
|
|
174
|
+
expect(pluralize('day')).toBe('days');
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it('should convert key to keys', () => {
|
|
178
|
+
expect(pluralize('key')).toBe('keys');
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it('should convert boy to boys', () => {
|
|
182
|
+
expect(pluralize('boy')).toBe('boys');
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it('should convert array to arrays', () => {
|
|
186
|
+
expect(pluralize('array')).toBe('arrays');
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
describe('-x, -ch, -sh, -s, -ss endings', () => {
|
|
191
|
+
it('should convert box to boxes', () => {
|
|
192
|
+
expect(pluralize('box')).toBe('boxes');
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
it('should convert watch to watches', () => {
|
|
196
|
+
expect(pluralize('watch')).toBe('watches');
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('should convert dish to dishes', () => {
|
|
200
|
+
expect(pluralize('dish')).toBe('dishes');
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it('should convert bench to benches', () => {
|
|
204
|
+
expect(pluralize('bench')).toBe('benches');
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('should convert address to addresses', () => {
|
|
208
|
+
expect(pluralize('address')).toBe('addresses');
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
it('should convert business to businesses', () => {
|
|
212
|
+
expect(pluralize('business')).toBe('businesses');
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('should convert class to classes', () => {
|
|
216
|
+
expect(pluralize('class')).toBe('classes');
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
describe('irregular plurals', () => {
|
|
221
|
+
it('should convert person to people', () => {
|
|
222
|
+
expect(pluralize('person')).toBe('people');
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('should convert child to children', () => {
|
|
226
|
+
expect(pluralize('child')).toBe('children');
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it('should convert man to men', () => {
|
|
230
|
+
expect(pluralize('man')).toBe('men');
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it('should convert woman to women', () => {
|
|
234
|
+
expect(pluralize('woman')).toBe('women');
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
describe('already plural (no double-pluralize)', () => {
|
|
239
|
+
it('should keep accounts as accounts', () => {
|
|
240
|
+
expect(pluralize('accounts')).toBe('accounts');
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it('should keep users as users', () => {
|
|
244
|
+
expect(pluralize('users')).toBe('users');
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it('should keep activities as activities', () => {
|
|
248
|
+
expect(pluralize('activities')).toBe('activities');
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
it('should keep boxes as boxes', () => {
|
|
252
|
+
expect(pluralize('boxes')).toBe('boxes');
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
describe('edge cases', () => {
|
|
257
|
+
it('should handle empty string', () => {
|
|
258
|
+
expect(pluralize('')).toBe('');
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
it('should handle single character', () => {
|
|
262
|
+
expect(pluralize('a')).toBe('as');
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
it('should keep status as status (special case)', () => {
|
|
266
|
+
expect(pluralize('status')).toBe('status');
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
describe('isPlural()', () => {
|
|
272
|
+
describe('should return true for plural words', () => {
|
|
273
|
+
it('should identify cats as plural', () => {
|
|
274
|
+
expect(isPlural('cats')).toBe(true);
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
it('should identify activities as plural', () => {
|
|
278
|
+
expect(isPlural('activities')).toBe(true);
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
it('should identify boxes as plural', () => {
|
|
282
|
+
expect(isPlural('boxes')).toBe(true);
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
it('should identify watches as plural', () => {
|
|
286
|
+
expect(isPlural('watches')).toBe(true);
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
it('should identify addresses as plural', () => {
|
|
290
|
+
expect(isPlural('addresses')).toBe(true);
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
it('should identify people as plural', () => {
|
|
294
|
+
expect(isPlural('people')).toBe(true);
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
it('should identify children as plural', () => {
|
|
298
|
+
expect(isPlural('children')).toBe(true);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
it('should identify users as plural', () => {
|
|
302
|
+
expect(isPlural('users')).toBe(true);
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
it('should identify accounts as plural', () => {
|
|
306
|
+
expect(isPlural('accounts')).toBe(true);
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
describe('should return false for singular words', () => {
|
|
311
|
+
it('should identify cat as singular', () => {
|
|
312
|
+
expect(isPlural('cat')).toBe(false);
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
it('should identify activity as singular', () => {
|
|
316
|
+
expect(isPlural('activity')).toBe(false);
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
it('should identify box as singular', () => {
|
|
320
|
+
expect(isPlural('box')).toBe(false);
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
it('should identify user as singular', () => {
|
|
324
|
+
expect(isPlural('user')).toBe(false);
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
it('should identify account as singular', () => {
|
|
328
|
+
expect(isPlural('account')).toBe(false);
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
|
|
332
|
+
describe('should return false for edge cases', () => {
|
|
333
|
+
it('should identify status as singular', () => {
|
|
334
|
+
expect(isPlural('status')).toBe(false);
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
it('should identify class as singular', () => {
|
|
338
|
+
expect(isPlural('class')).toBe(false);
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
it('should identify bus as singular', () => {
|
|
342
|
+
expect(isPlural('bus')).toBe(false);
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
it('should identify process as singular', () => {
|
|
346
|
+
expect(isPlural('process')).toBe(false);
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
it('should identify data as singular', () => {
|
|
350
|
+
expect(isPlural('data')).toBe(false);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
it('should identify metadata as singular', () => {
|
|
354
|
+
expect(isPlural('metadata')).toBe(false);
|
|
355
|
+
});
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
describe('should handle empty/minimal input', () => {
|
|
359
|
+
it('should return false for empty string', () => {
|
|
360
|
+
expect(isPlural('')).toBe(false);
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
it('should return false for single character', () => {
|
|
364
|
+
expect(isPlural('a')).toBe(false);
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
});
|