saafe-redirection-flow 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/build-and-deploy.yml +41 -0
- package/.gitlab-ci.yml +108 -0
- package/.releaserc.json +18 -0
- package/.storybook/main.ts +28 -0
- package/.storybook/preview.ts +16 -0
- package/.storybook/vitest.setup.ts +9 -0
- package/.vite/deps/@radix-ui_react-avatar.js +230 -0
- package/.vite/deps/@radix-ui_react-avatar.js.map +7 -0
- package/.vite/deps/@radix-ui_react-slot.js +12 -0
- package/.vite/deps/@radix-ui_react-slot.js.map +7 -0
- package/.vite/deps/_metadata.json +79 -0
- package/.vite/deps/chunk-5VGQBUCU.js +597 -0
- package/.vite/deps/chunk-5VGQBUCU.js.map +7 -0
- package/.vite/deps/chunk-DC5AMYBS.js +38 -0
- package/.vite/deps/chunk-DC5AMYBS.js.map +7 -0
- package/.vite/deps/chunk-HUIEPYH7.js +11265 -0
- package/.vite/deps/chunk-HUIEPYH7.js.map +7 -0
- package/.vite/deps/chunk-TKHB4QMX.js +281 -0
- package/.vite/deps/chunk-TKHB4QMX.js.map +7 -0
- package/.vite/deps/chunk-YLDSBLSF.js +1139 -0
- package/.vite/deps/chunk-YLDSBLSF.js.map +7 -0
- package/.vite/deps/class-variance-authority.js +63 -0
- package/.vite/deps/class-variance-authority.js.map +7 -0
- package/.vite/deps/lucide-react.js +36984 -0
- package/.vite/deps/lucide-react.js.map +7 -0
- package/.vite/deps/package.json +3 -0
- package/.vite/deps/react-dom_client.js +17917 -0
- package/.vite/deps/react-dom_client.js.map +7 -0
- package/.vite/deps/react-router-dom.js +452 -0
- package/.vite/deps/react-router-dom.js.map +7 -0
- package/.vite/deps/react-router.js +234 -0
- package/.vite/deps/react-router.js.map +7 -0
- package/.vite/deps/react.js +5 -0
- package/.vite/deps/react.js.map +7 -0
- package/.vite/deps/react_jsx-dev-runtime.js +470 -0
- package/.vite/deps/react_jsx-dev-runtime.js.map +7 -0
- package/CHANGELOG.md +420 -0
- package/LICENSE +21 -0
- package/README.md +129 -0
- package/RELEASE_CHEATSHEET.md +93 -0
- package/RELEASE_NOTES.md +120 -0
- package/components.json +21 -0
- package/docs/DEPLOYMENT_WORKFLOW.md +262 -0
- package/docs/RELEASE_GUIDE.md +591 -0
- package/docs/architecture.md +432 -0
- package/docs/components.md +199 -0
- package/docs/index.md +69 -0
- package/docs/local-release-workflow.md +234 -0
- package/docs/routes.md +118 -0
- package/docs/sdk-integration.md +325 -0
- package/docs/semantic-release.md +124 -0
- package/docs/user-flow.md +206 -0
- package/eslint.config.js +28 -0
- package/index.html +19 -0
- package/install.sh +198 -0
- package/package.json +115 -0
- package/public/images/bank-logo.png +0 -0
- package/public/saafe-icon.svg +9 -0
- package/src/App.tsx +171 -0
- package/src/__tests__/url-parameters.test.ts +82 -0
- package/src/assets/brand/applestore.svg +13 -0
- package/src/assets/brand/playstore.svg +23 -0
- package/src/assets/brand/saafe-color-white-logo.svg +14 -0
- package/src/assets/brand/saafe-icon.svg +9 -0
- package/src/assets/brand/saafe-logo.svg +18 -0
- package/src/assets/icons/check-icon-dark.svg +27 -0
- package/src/assets/icons/check-icon.svg +23 -0
- package/src/components/ErrorBoundary.tsx +132 -0
- package/src/components/alert/alert.tsx +27 -0
- package/src/components/auth/AuthGuard.tsx +76 -0
- package/src/components/cards/BankCard.stories.tsx +69 -0
- package/src/components/cards/BankCard.tsx +227 -0
- package/src/components/cards/OuterCard.tsx +109 -0
- package/src/components/cards/WrapperCard.tsx +64 -0
- package/src/components/documents/PrivacyContent.tsx +1 -0
- package/src/components/dummyFooter.tsx +29 -0
- package/src/components/icons/github.tsx +12 -0
- package/src/components/language/LanguageSwitcher.tsx +44 -0
- package/src/components/layouts/FrostedLayout.stories.tsx +42 -0
- package/src/components/layouts/FrostedLayout.tsx +333 -0
- package/src/components/layouts/MobileLayout.tsx +403 -0
- package/src/components/mobile-background.tsx +136 -0
- package/src/components/mobileAppDownload.tsx +30 -0
- package/src/components/modal/ModalComp.tsx +27 -0
- package/src/components/mode-toggle.tsx +36 -0
- package/src/components/page-header.tsx +50 -0
- package/src/components/session/SessionTimeoutScreen.tsx +134 -0
- package/src/components/session/SessionTimer.tsx +173 -0
- package/src/components/step-navigation.tsx +87 -0
- package/src/components/title/AppBar.stories.tsx +50 -0
- package/src/components/title/AppBar.tsx +150 -0
- package/src/components/title/SectionTitle.tsx +31 -0
- package/src/components/ui/AnimatedButton.module.css +13 -0
- package/src/components/ui/alert.tsx +66 -0
- package/src/components/ui/animatedButton.tsx +111 -0
- package/src/components/ui/avatar.tsx +51 -0
- package/src/components/ui/badge.tsx +36 -0
- package/src/components/ui/bottom-sheet.tsx +122 -0
- package/src/components/ui/button.tsx +59 -0
- package/src/components/ui/calendar.tsx +86 -0
- package/src/components/ui/card.tsx +92 -0
- package/src/components/ui/checkbox.stories.tsx +49 -0
- package/src/components/ui/checkbox.tsx +67 -0
- package/src/components/ui/collapsible.tsx +45 -0
- package/src/components/ui/dialog.tsx +134 -0
- package/src/components/ui/document-link.tsx +26 -0
- package/src/components/ui/dot-stepper.tsx +57 -0
- package/src/components/ui/dropdown-menu.tsx +255 -0
- package/src/components/ui/form.tsx +165 -0
- package/src/components/ui/frosted-panel.stories.tsx +86 -0
- package/src/components/ui/frosted-panel.tsx +276 -0
- package/src/components/ui/input.tsx +39 -0
- package/src/components/ui/label.stories.tsx +67 -0
- package/src/components/ui/label.tsx +23 -0
- package/src/components/ui/mobile-footer.tsx +54 -0
- package/src/components/ui/modal.tsx +90 -0
- package/src/components/ui/otp-input.stories.tsx +62 -0
- package/src/components/ui/otp-input.tsx +221 -0
- package/src/components/ui/platform-specific-behavior.tsx +28 -0
- package/src/components/ui/popover.tsx +46 -0
- package/src/components/ui/progress.tsx +103 -0
- package/src/components/ui/radio-group.tsx +45 -0
- package/src/components/ui/scroll-area.tsx +56 -0
- package/src/components/ui/sdk-params-docs.tsx +53 -0
- package/src/components/ui/select.tsx +159 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/sheet.tsx +137 -0
- package/src/components/ui/sidebar.tsx +724 -0
- package/src/components/ui/skeleton.stories.tsx +50 -0
- package/src/components/ui/skeleton.tsx +15 -0
- package/src/components/ui/sonner.tsx +23 -0
- package/src/components/ui/step.stories.tsx +132 -0
- package/src/components/ui/step.tsx +234 -0
- package/src/components/ui/stepper-progress.tsx +136 -0
- package/src/components/ui/stepper.tsx +259 -0
- package/src/components/ui/tabs.tsx +55 -0
- package/src/components/ui/tooltip.tsx +61 -0
- package/src/components/ui/url-decode-loader.tsx +36 -0
- package/src/components/ui/version-display.tsx +104 -0
- package/src/components/ui/web-footer.tsx +36 -0
- package/src/config/environments.ts +99 -0
- package/src/config/urls.ts +53 -0
- package/src/const/fiTypeCategoryMap.ts +19 -0
- package/src/contexts/LanguageContext.tsx +41 -0
- package/src/contexts/RTLContext.tsx +42 -0
- package/src/contexts/ThemeContext.tsx +93 -0
- package/src/hooks/use-account-discovery.ts +205 -0
- package/src/hooks/use-auth-query.ts +141 -0
- package/src/hooks/use-fip-query.ts +72 -0
- package/src/hooks/use-media-query.ts +32 -0
- package/src/hooks/use-mobile.ts +24 -0
- package/src/hooks/use-page-title.tsx +48 -0
- package/src/hooks/use-platform.ts +52 -0
- package/src/hooks/use-trusted-count.ts +21 -0
- package/src/hooks/use-url-decode.ts +90 -0
- package/src/hooks/useStep.ts +170 -0
- package/src/index.css +154 -0
- package/src/interfaces/app.interfaces.ts +39 -0
- package/src/interfaces/services.interfaces.ts +65 -0
- package/src/lib/i18n.ts +68 -0
- package/src/lib/utils.ts +6 -0
- package/src/locales/en/common.json +167 -0
- package/src/locales/hi/common.json +137 -0
- package/src/locales/kn/common.json +137 -0
- package/src/locales/ml/common.json +137 -0
- package/src/locales/ta/common.json +137 -0
- package/src/locales/te/common.json +137 -0
- package/src/locales/ur/common.json +138 -0
- package/src/main.tsx +46 -0
- package/src/pages/Login.tsx +363 -0
- package/src/pages/accounts/AccountsToProceed.tsx +396 -0
- package/src/pages/accounts/Discover.tsx +76 -0
- package/src/pages/accounts/DiscoverAccount.tsx +751 -0
- package/src/pages/accounts/LinkSelectedAccounts.tsx +638 -0
- package/src/pages/accounts/OldUser.tsx +329 -0
- package/src/pages/accounts/link-accounts.tsx +913 -0
- package/src/pages/consent/ReviewConsent.tsx +836 -0
- package/src/pages/consent/rejected.tsx +253 -0
- package/src/pages/consent/success.tsx +220 -0
- package/src/providers/query-provider.tsx +24 -0
- package/src/providers/toast-provider.tsx +26 -0
- package/src/services/api/account.service.ts +296 -0
- package/src/services/api/auth.service.ts +206 -0
- package/src/services/api/axios.ts +138 -0
- package/src/services/api/consent.service.ts +142 -0
- package/src/services/api/decode.service.ts +53 -0
- package/src/services/api/feedback.service.ts +34 -0
- package/src/services/api/fip.service.ts +187 -0
- package/src/services/api/index.ts +9 -0
- package/src/services/api/public.service.ts +18 -0
- package/src/services/api.ts +2 -0
- package/src/services/postMessage.service.ts +179 -0
- package/src/store/NavigationBlockContext.tsx +34 -0
- package/src/store/auth.store.ts +79 -0
- package/src/store/fip.store.ts +396 -0
- package/src/store/mandatoryConsent.store.ts +24 -0
- package/src/store/redirect.store.ts +73 -0
- package/src/store/step.store.ts +124 -0
- package/src/stories/Button.stories.ts +53 -0
- package/src/stories/Button.tsx +37 -0
- package/src/stories/Configure.mdx +364 -0
- package/src/stories/Header.stories.ts +33 -0
- package/src/stories/Header.tsx +56 -0
- package/src/stories/Page.stories.ts +32 -0
- package/src/stories/Page.tsx +73 -0
- package/src/stories/button.css +30 -0
- package/src/stories/header.css +32 -0
- package/src/stories/page.css +68 -0
- package/src/styles/rtl-utils.css +90 -0
- package/src/styles/rtl.css +105 -0
- package/src/utils/api-error.ts +26 -0
- package/src/utils/cn.ts +10 -0
- package/src/utils/error-callback.ts +116 -0
- package/src/utils/formatAccountNumber.ts +9 -0
- package/src/utils/handleIdentifiers.ts +90 -0
- package/src/utils/posthog.ts +67 -0
- package/src/utils/toast-helpers.ts +61 -0
- package/src/vite-env.d.ts +1 -0
- package/stage-aa-2506251021.zip +0 -0
- package/tsconfig.app.json +33 -0
- package/tsconfig.json +13 -0
- package/tsconfig.node.json +24 -0
- package/vite.config.ts +45 -0
- package/vitest.shims.d.ts +1 -0
- package/vitest.workspace.ts +46 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
import * as React from 'react'
|
2
|
+
import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area'
|
3
|
+
|
4
|
+
import { cn } from '@/lib/utils'
|
5
|
+
|
6
|
+
function ScrollArea ({
|
7
|
+
className,
|
8
|
+
children,
|
9
|
+
...props
|
10
|
+
}: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
|
11
|
+
return (
|
12
|
+
<ScrollAreaPrimitive.Root
|
13
|
+
data-slot='scroll-area'
|
14
|
+
className={cn('relative', className)}
|
15
|
+
{...props}
|
16
|
+
>
|
17
|
+
<ScrollAreaPrimitive.Viewport
|
18
|
+
data-slot='scroll-area-viewport'
|
19
|
+
className='focus-visible:ring-ring/50 size-[98%] rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1'
|
20
|
+
>
|
21
|
+
{children}
|
22
|
+
</ScrollAreaPrimitive.Viewport>
|
23
|
+
<ScrollBar />
|
24
|
+
<ScrollAreaPrimitive.Corner />
|
25
|
+
</ScrollAreaPrimitive.Root>
|
26
|
+
)
|
27
|
+
}
|
28
|
+
|
29
|
+
function ScrollBar ({
|
30
|
+
className,
|
31
|
+
orientation = 'vertical',
|
32
|
+
...props
|
33
|
+
}: React.ComponentProps<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>) {
|
34
|
+
return (
|
35
|
+
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
36
|
+
data-slot='scroll-area-scrollbar'
|
37
|
+
orientation={orientation}
|
38
|
+
className={cn(
|
39
|
+
'flex touch-none p-px transition-colors select-none',
|
40
|
+
orientation === 'vertical' &&
|
41
|
+
'h-full w-2.5 border-l border-l-transparent',
|
42
|
+
orientation === 'horizontal' &&
|
43
|
+
'h-2.5 flex-col border-t border-t-transparent',
|
44
|
+
className
|
45
|
+
)}
|
46
|
+
{...props}
|
47
|
+
>
|
48
|
+
<ScrollAreaPrimitive.ScrollAreaThumb
|
49
|
+
data-slot='scroll-area-thumb'
|
50
|
+
className='bg-border relative flex-1 rounded-full'
|
51
|
+
/>
|
52
|
+
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
53
|
+
)
|
54
|
+
}
|
55
|
+
|
56
|
+
export { ScrollArea, ScrollBar }
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import { cn } from "@/utils/cn";
|
2
|
+
import { usePlatform } from "@/hooks/use-platform";
|
3
|
+
import { useTheme } from "@/contexts/ThemeContext";
|
4
|
+
|
5
|
+
interface SDKParamsDocsProps {
|
6
|
+
className?: string;
|
7
|
+
}
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Component that displays documentation about the SDK parameters
|
11
|
+
* This is useful for developers integrating with the SDK
|
12
|
+
*/
|
13
|
+
export function SDKParamsDocs({ className }: SDKParamsDocsProps) {
|
14
|
+
const { platform } = usePlatform();
|
15
|
+
const { theme } = useTheme();
|
16
|
+
|
17
|
+
return (
|
18
|
+
<div className={cn("p-4 bg-card rounded-lg border shadow-sm", className)}>
|
19
|
+
<h3 className="text-lg font-semibold mb-4">SDK Integration Parameters</h3>
|
20
|
+
|
21
|
+
<div className="space-y-4">
|
22
|
+
<div>
|
23
|
+
<h4 className="font-medium text-primary">Current Configuration</h4>
|
24
|
+
<ul className="mt-2 space-y-1 text-sm">
|
25
|
+
<li>Platform: <code className="bg-muted px-1 py-0.5 rounded">{platform}</code></li>
|
26
|
+
<li>Theme: <code className="bg-muted px-1 py-0.5 rounded">{theme}</code></li>
|
27
|
+
</ul>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<div>
|
31
|
+
<h4 className="font-medium text-primary">URL Parameters</h4>
|
32
|
+
<ul className="mt-2 space-y-2 text-sm">
|
33
|
+
<li>
|
34
|
+
<code className="bg-muted px-1 py-0.5 rounded">platform</code>
|
35
|
+
<p className="mt-1">Sets the platform type. Supported values: <code>ios</code>, <code>android</code>, <code>react-native</code>, <code>flutter</code>, <code>web</code></p>
|
36
|
+
</li>
|
37
|
+
<li>
|
38
|
+
<code className="bg-muted px-1 py-0.5 rounded">theme</code>
|
39
|
+
<p className="mt-1">Sets the theme preference. Supported values: <code>light</code>, <code>dark</code>, <code>system</code></p>
|
40
|
+
</li>
|
41
|
+
</ul>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div>
|
45
|
+
<h4 className="font-medium text-primary">Example URL</h4>
|
46
|
+
<pre className="bg-muted p-2 rounded text-xs mt-2 overflow-x-auto">
|
47
|
+
{`https://your-app.com/login?fi=value&ecreq=value&reqdate=value&platform=ios&theme=dark`}
|
48
|
+
</pre>
|
49
|
+
</div>
|
50
|
+
</div>
|
51
|
+
</div>
|
52
|
+
);
|
53
|
+
}
|
@@ -0,0 +1,159 @@
|
|
1
|
+
|
2
|
+
import * as React from "react"
|
3
|
+
import * as SelectPrimitive from "@radix-ui/react-select"
|
4
|
+
import { Check, ChevronDown, ChevronUp } from "lucide-react"
|
5
|
+
|
6
|
+
import { cn } from "@/lib/utils"
|
7
|
+
|
8
|
+
const Select = SelectPrimitive.Root
|
9
|
+
|
10
|
+
const SelectGroup = SelectPrimitive.Group
|
11
|
+
|
12
|
+
const SelectValue = SelectPrimitive.Value
|
13
|
+
|
14
|
+
const SelectTrigger = React.forwardRef<
|
15
|
+
React.ElementRef<typeof SelectPrimitive.Trigger>,
|
16
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>
|
17
|
+
>(({ className, children, ...props }, ref) => (
|
18
|
+
<SelectPrimitive.Trigger
|
19
|
+
ref={ref}
|
20
|
+
className={cn(
|
21
|
+
"flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",
|
22
|
+
className
|
23
|
+
)}
|
24
|
+
{...props}
|
25
|
+
>
|
26
|
+
{children}
|
27
|
+
<SelectPrimitive.Icon asChild>
|
28
|
+
<ChevronDown className="h-4 w-4 opacity-50" />
|
29
|
+
</SelectPrimitive.Icon>
|
30
|
+
</SelectPrimitive.Trigger>
|
31
|
+
))
|
32
|
+
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName
|
33
|
+
|
34
|
+
const SelectScrollUpButton = React.forwardRef<
|
35
|
+
React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,
|
36
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>
|
37
|
+
>(({ className, ...props }, ref) => (
|
38
|
+
<SelectPrimitive.ScrollUpButton
|
39
|
+
ref={ref}
|
40
|
+
className={cn(
|
41
|
+
"flex cursor-default items-center justify-center py-1",
|
42
|
+
className
|
43
|
+
)}
|
44
|
+
{...props}
|
45
|
+
>
|
46
|
+
<ChevronUp className="h-4 w-4" />
|
47
|
+
</SelectPrimitive.ScrollUpButton>
|
48
|
+
))
|
49
|
+
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
|
50
|
+
|
51
|
+
const SelectScrollDownButton = React.forwardRef<
|
52
|
+
React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,
|
53
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>
|
54
|
+
>(({ className, ...props }, ref) => (
|
55
|
+
<SelectPrimitive.ScrollDownButton
|
56
|
+
ref={ref}
|
57
|
+
className={cn(
|
58
|
+
"flex cursor-default items-center justify-center py-1",
|
59
|
+
className
|
60
|
+
)}
|
61
|
+
{...props}
|
62
|
+
>
|
63
|
+
<ChevronDown className="h-4 w-4" />
|
64
|
+
</SelectPrimitive.ScrollDownButton>
|
65
|
+
))
|
66
|
+
SelectScrollDownButton.displayName =
|
67
|
+
SelectPrimitive.ScrollDownButton.displayName
|
68
|
+
|
69
|
+
const SelectContent = React.forwardRef<
|
70
|
+
React.ElementRef<typeof SelectPrimitive.Content>,
|
71
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>
|
72
|
+
>(({ className, children, position = "popper", ...props }, ref) => (
|
73
|
+
<SelectPrimitive.Portal>
|
74
|
+
<SelectPrimitive.Content
|
75
|
+
ref={ref}
|
76
|
+
className={cn(
|
77
|
+
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
78
|
+
position === "popper" &&
|
79
|
+
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
80
|
+
className
|
81
|
+
)}
|
82
|
+
position={position}
|
83
|
+
{...props}
|
84
|
+
>
|
85
|
+
<SelectScrollUpButton />
|
86
|
+
<SelectPrimitive.Viewport
|
87
|
+
className={cn(
|
88
|
+
"p-1",
|
89
|
+
position === "popper" &&
|
90
|
+
"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"
|
91
|
+
)}
|
92
|
+
>
|
93
|
+
{children}
|
94
|
+
</SelectPrimitive.Viewport>
|
95
|
+
<SelectScrollDownButton />
|
96
|
+
</SelectPrimitive.Content>
|
97
|
+
</SelectPrimitive.Portal>
|
98
|
+
))
|
99
|
+
SelectContent.displayName = SelectPrimitive.Content.displayName
|
100
|
+
|
101
|
+
const SelectLabel = React.forwardRef<
|
102
|
+
React.ElementRef<typeof SelectPrimitive.Label>,
|
103
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>
|
104
|
+
>(({ className, ...props }, ref) => (
|
105
|
+
<SelectPrimitive.Label
|
106
|
+
ref={ref}
|
107
|
+
className={cn("py-1.5 pl-8 pr-2 text-sm font-semibold", className)}
|
108
|
+
{...props}
|
109
|
+
/>
|
110
|
+
))
|
111
|
+
SelectLabel.displayName = SelectPrimitive.Label.displayName
|
112
|
+
|
113
|
+
const SelectItem = React.forwardRef<
|
114
|
+
React.ElementRef<typeof SelectPrimitive.Item>,
|
115
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>
|
116
|
+
>(({ className, children, ...props }, ref) => (
|
117
|
+
<SelectPrimitive.Item
|
118
|
+
ref={ref}
|
119
|
+
className={cn(
|
120
|
+
"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
121
|
+
className
|
122
|
+
)}
|
123
|
+
{...props}
|
124
|
+
>
|
125
|
+
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
126
|
+
<SelectPrimitive.ItemIndicator>
|
127
|
+
<Check className="h-4 w-4" />
|
128
|
+
</SelectPrimitive.ItemIndicator>
|
129
|
+
</span>
|
130
|
+
|
131
|
+
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
132
|
+
</SelectPrimitive.Item>
|
133
|
+
))
|
134
|
+
SelectItem.displayName = SelectPrimitive.Item.displayName
|
135
|
+
|
136
|
+
const SelectSeparator = React.forwardRef<
|
137
|
+
React.ElementRef<typeof SelectPrimitive.Separator>,
|
138
|
+
React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>
|
139
|
+
>(({ className, ...props }, ref) => (
|
140
|
+
<SelectPrimitive.Separator
|
141
|
+
ref={ref}
|
142
|
+
className={cn("-mx-1 my-1 h-px bg-muted", className)}
|
143
|
+
{...props}
|
144
|
+
/>
|
145
|
+
))
|
146
|
+
SelectSeparator.displayName = SelectPrimitive.Separator.displayName
|
147
|
+
|
148
|
+
export {
|
149
|
+
Select,
|
150
|
+
SelectGroup,
|
151
|
+
SelectValue,
|
152
|
+
SelectTrigger,
|
153
|
+
SelectContent,
|
154
|
+
SelectLabel,
|
155
|
+
SelectItem,
|
156
|
+
SelectSeparator,
|
157
|
+
SelectScrollUpButton,
|
158
|
+
SelectScrollDownButton,
|
159
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use client"
|
2
|
+
|
3
|
+
import * as React from "react"
|
4
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator"
|
5
|
+
|
6
|
+
import { cn } from "@/lib/utils"
|
7
|
+
|
8
|
+
function Separator({
|
9
|
+
className,
|
10
|
+
orientation = "horizontal",
|
11
|
+
decorative = true,
|
12
|
+
...props
|
13
|
+
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
|
14
|
+
return (
|
15
|
+
<SeparatorPrimitive.Root
|
16
|
+
data-slot="separator-root"
|
17
|
+
decorative={decorative}
|
18
|
+
orientation={orientation}
|
19
|
+
className={cn(
|
20
|
+
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
|
21
|
+
className
|
22
|
+
)}
|
23
|
+
{...props}
|
24
|
+
/>
|
25
|
+
)
|
26
|
+
}
|
27
|
+
|
28
|
+
export { Separator }
|
@@ -0,0 +1,137 @@
|
|
1
|
+
import * as React from "react"
|
2
|
+
import * as SheetPrimitive from "@radix-ui/react-dialog"
|
3
|
+
import { XIcon } from "lucide-react"
|
4
|
+
|
5
|
+
import { cn } from "@/lib/utils"
|
6
|
+
|
7
|
+
function Sheet({ ...props }: React.ComponentProps<typeof SheetPrimitive.Root>) {
|
8
|
+
return <SheetPrimitive.Root data-slot="sheet" {...props} />
|
9
|
+
}
|
10
|
+
|
11
|
+
function SheetTrigger({
|
12
|
+
...props
|
13
|
+
}: React.ComponentProps<typeof SheetPrimitive.Trigger>) {
|
14
|
+
return <SheetPrimitive.Trigger data-slot="sheet-trigger" {...props} />
|
15
|
+
}
|
16
|
+
|
17
|
+
function SheetClose({
|
18
|
+
...props
|
19
|
+
}: React.ComponentProps<typeof SheetPrimitive.Close>) {
|
20
|
+
return <SheetPrimitive.Close data-slot="sheet-close" {...props} />
|
21
|
+
}
|
22
|
+
|
23
|
+
function SheetPortal({
|
24
|
+
...props
|
25
|
+
}: React.ComponentProps<typeof SheetPrimitive.Portal>) {
|
26
|
+
return <SheetPrimitive.Portal data-slot="sheet-portal" {...props} />
|
27
|
+
}
|
28
|
+
|
29
|
+
function SheetOverlay({
|
30
|
+
className,
|
31
|
+
...props
|
32
|
+
}: React.ComponentProps<typeof SheetPrimitive.Overlay>) {
|
33
|
+
return (
|
34
|
+
<SheetPrimitive.Overlay
|
35
|
+
data-slot="sheet-overlay"
|
36
|
+
className={cn(
|
37
|
+
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
|
38
|
+
className
|
39
|
+
)}
|
40
|
+
{...props}
|
41
|
+
/>
|
42
|
+
)
|
43
|
+
}
|
44
|
+
|
45
|
+
function SheetContent({
|
46
|
+
className,
|
47
|
+
children,
|
48
|
+
side = "right",
|
49
|
+
...props
|
50
|
+
}: React.ComponentProps<typeof SheetPrimitive.Content> & {
|
51
|
+
side?: "top" | "right" | "bottom" | "left"
|
52
|
+
}) {
|
53
|
+
return (
|
54
|
+
<SheetPortal>
|
55
|
+
<SheetOverlay />
|
56
|
+
<SheetPrimitive.Content
|
57
|
+
data-slot="sheet-content"
|
58
|
+
className={cn(
|
59
|
+
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",
|
60
|
+
side === "right" &&
|
61
|
+
"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",
|
62
|
+
side === "left" &&
|
63
|
+
"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",
|
64
|
+
side === "top" &&
|
65
|
+
"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",
|
66
|
+
side === "bottom" &&
|
67
|
+
"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",
|
68
|
+
className
|
69
|
+
)}
|
70
|
+
{...props}
|
71
|
+
>
|
72
|
+
{children}
|
73
|
+
<SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none">
|
74
|
+
<XIcon className="size-4" />
|
75
|
+
<span className="sr-only">Close</span>
|
76
|
+
</SheetPrimitive.Close>
|
77
|
+
</SheetPrimitive.Content>
|
78
|
+
</SheetPortal>
|
79
|
+
)
|
80
|
+
}
|
81
|
+
|
82
|
+
function SheetHeader({ className, ...props }: React.ComponentProps<"div">) {
|
83
|
+
return (
|
84
|
+
<div
|
85
|
+
data-slot="sheet-header"
|
86
|
+
className={cn("flex flex-col gap-1.5 p-4", className)}
|
87
|
+
{...props}
|
88
|
+
/>
|
89
|
+
)
|
90
|
+
}
|
91
|
+
|
92
|
+
function SheetFooter({ className, ...props }: React.ComponentProps<"div">) {
|
93
|
+
return (
|
94
|
+
<div
|
95
|
+
data-slot="sheet-footer"
|
96
|
+
className={cn("mt-auto flex flex-col gap-2 p-4", className)}
|
97
|
+
{...props}
|
98
|
+
/>
|
99
|
+
)
|
100
|
+
}
|
101
|
+
|
102
|
+
function SheetTitle({
|
103
|
+
className,
|
104
|
+
...props
|
105
|
+
}: React.ComponentProps<typeof SheetPrimitive.Title>) {
|
106
|
+
return (
|
107
|
+
<SheetPrimitive.Title
|
108
|
+
data-slot="sheet-title"
|
109
|
+
className={cn("text-foreground font-semibold", className)}
|
110
|
+
{...props}
|
111
|
+
/>
|
112
|
+
)
|
113
|
+
}
|
114
|
+
|
115
|
+
function SheetDescription({
|
116
|
+
className,
|
117
|
+
...props
|
118
|
+
}: React.ComponentProps<typeof SheetPrimitive.Description>) {
|
119
|
+
return (
|
120
|
+
<SheetPrimitive.Description
|
121
|
+
data-slot="sheet-description"
|
122
|
+
className={cn("text-muted-foreground text-sm", className)}
|
123
|
+
{...props}
|
124
|
+
/>
|
125
|
+
)
|
126
|
+
}
|
127
|
+
|
128
|
+
export {
|
129
|
+
Sheet,
|
130
|
+
SheetTrigger,
|
131
|
+
SheetClose,
|
132
|
+
SheetContent,
|
133
|
+
SheetHeader,
|
134
|
+
SheetFooter,
|
135
|
+
SheetTitle,
|
136
|
+
SheetDescription,
|
137
|
+
}
|