torch-glare 1.0.1 → 1.0.3
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/lib/components/ SearchField.tsx +48 -0
- package/lib/components/Badge.tsx +6 -6
- package/lib/components/Checkbox.tsx +35 -17
- package/lib/components/Dialog.tsx +129 -0
- package/lib/components/ImageAttachment.tsx +51 -42
- package/lib/components/LinkButton.tsx +10 -6
- package/lib/components/LoginButton.tsx +57 -0
- package/lib/components/Radio.tsx +16 -8
- package/lib/components/RadioCard.tsx +3 -2
- package/lib/components/RadioLabel.tsx +107 -0
- package/lib/components/{Switcher.tsx → Switch.tsx} +31 -5
- package/lib/components/TransparentLabel.tsx +73 -0
- package/lib/components/TreeDropDown.tsx +1 -1
- package/lib/layouts/CLayout.tsx +20 -15
- package/lib/layouts/TreeSubLayout.tsx +2 -2
- package/lib/utils/convertImgToURL.ts +17 -0
- package/package.json +1 -1
- package/lib/components/RingLoading.tsx +0 -190
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { forwardRef, ReactNode } from "react";
|
|
2
|
+
import { Props, InputField } from "./InputField";
|
|
3
|
+
|
|
4
|
+
interface SearchProps extends Props {
|
|
5
|
+
Searchplaceholder?: ReactNode
|
|
6
|
+
secondaryPlaceholder?: ReactNode
|
|
7
|
+
}
|
|
8
|
+
// Use InputField types in the SearchInput component
|
|
9
|
+
export const SearchField = forwardRef<HTMLInputElement, SearchProps>(
|
|
10
|
+
({ Searchplaceholder, secondaryPlaceholder, ...props }, forwardedRef) => {
|
|
11
|
+
return (
|
|
12
|
+
<div className="mb-[10px] w-full h-fit justify-center items-center rounded-[12px] p-[3px] bg-[rgba(106,112,144,0.60)] shadow-[0px_0px_18px_0px_rgba(0,0,0,0.75)] backdrop-blur-[21px]">
|
|
13
|
+
<InputField
|
|
14
|
+
{...props}
|
|
15
|
+
ref={forwardedRef}
|
|
16
|
+
type="text"
|
|
17
|
+
variant="SystemStyle"
|
|
18
|
+
size="M"
|
|
19
|
+
className="h-[54px] rounded-[9px] p-[15px] border-border-system-global-primary bg-[rgba(0,0,0,0.60)]"
|
|
20
|
+
icon={
|
|
21
|
+
<SearchInputPlaceholder value={props.value} secondaryPlaceholder={secondaryPlaceholder} Searchplaceholder={Searchplaceholder} />
|
|
22
|
+
}
|
|
23
|
+
/>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
SearchField.displayName = " SearchField"; // Set displayName for debugging
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
function SearchInputPlaceholder({ Searchplaceholder, secondaryPlaceholder, value }: { Searchplaceholder?: ReactNode, secondaryPlaceholder?: ReactNode, value: any }) {
|
|
33
|
+
return (
|
|
34
|
+
<div className="flex gap-[10px] justify-center items-center ">
|
|
35
|
+
<i className="ri-search-2-line text-[24px] text-[#E5E5E5]"></i>
|
|
36
|
+
|
|
37
|
+
{
|
|
38
|
+
value == "" ? (
|
|
39
|
+
<div className="flex gap-[5px] justify-center items-center ">
|
|
40
|
+
<p className="text-content-system-global-primary typography-headers-medium-regular leading-none opacity-[0.8]">{Searchplaceholder}</p>
|
|
41
|
+
<p className="text-content-system-global-primary typography-body-medium-medium leading-none opacity-30 mix-blend-luminosity mt-[2px]">{secondaryPlaceholder}</p>
|
|
42
|
+
</div>
|
|
43
|
+
) : null
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
}
|
package/lib/components/Badge.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { Themes } from "../utils/types";
|
|
|
6
6
|
export const badgeBase = cva(
|
|
7
7
|
[
|
|
8
8
|
"px-[6px]",
|
|
9
|
-
"[&
|
|
9
|
+
"[&_div]:text-content-presentation-action-light-primary",
|
|
10
10
|
"[&_i]:!leading-0",
|
|
11
11
|
"flex",
|
|
12
12
|
"justify-center",
|
|
@@ -23,12 +23,12 @@ export const badgeBase = cva(
|
|
|
23
23
|
{
|
|
24
24
|
variants: {
|
|
25
25
|
size: {
|
|
26
|
-
XS: "h-[18px] [&_i]:text-[12px] [&
|
|
27
|
-
S: "h-[22px] [&_i]:text-[12px] [&
|
|
28
|
-
M: "h-[26px] [&_i]:text-[16px] [&
|
|
26
|
+
XS: "h-[18px] [&_i]:text-[12px] [&_div]:typography-body-small-medium",
|
|
27
|
+
S: "h-[22px] [&_i]:text-[12px] [&_div]:typography-body-small-medium",
|
|
28
|
+
M: "h-[26px] [&_i]:text-[16px] [&_div]:typography-body-medium-medium",
|
|
29
29
|
},
|
|
30
30
|
variant: {
|
|
31
|
-
highlight: ["h-[20px] [&_i]:text-[12px] [&
|
|
31
|
+
highlight: ["h-[20px] [&_i]:text-[12px] [&_div]:typography-body-small-medium",
|
|
32
32
|
"bg-background-presentation-badge-gray border-transparent px-[3px]"
|
|
33
33
|
],
|
|
34
34
|
green: "border-border-presentation-badge-green bg-background-presentation-badge-green [&_i]:text-content-presentation-badge-green",
|
|
@@ -93,7 +93,7 @@ export const Badge: React.FC<BadgeProps> = ({
|
|
|
93
93
|
)}
|
|
94
94
|
</div>
|
|
95
95
|
|
|
96
|
-
<
|
|
96
|
+
<div className="px-[3px] whitespace-nowrap">{label}</div>
|
|
97
97
|
{isSelected && (
|
|
98
98
|
<button
|
|
99
99
|
onClick={onUnselect}
|
|
@@ -11,25 +11,43 @@ interface CheckBoxProps
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const Checkbox = forwardRef<HTMLInputElement, CheckBoxProps>(
|
|
14
|
-
({ size = "M", ...props }, ref) => {
|
|
14
|
+
({ size = "M", children, ...props }, ref) => {
|
|
15
15
|
const [checked, setChecked] = useState(props.checked);
|
|
16
16
|
return (
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
17
|
+
children ?
|
|
18
|
+
<label htmlFor={props.id} className="flex items-center justify-center gap-1">
|
|
19
|
+
<input
|
|
20
|
+
{...props}
|
|
21
|
+
children={null}
|
|
22
|
+
id={props.id}
|
|
23
|
+
onChange={(e) => {
|
|
24
|
+
props.onChange?.(e);
|
|
25
|
+
setChecked(e.target.checked);
|
|
26
|
+
}}
|
|
27
|
+
type="checkbox"
|
|
28
|
+
hidden
|
|
29
|
+
ref={ref}
|
|
30
|
+
/>
|
|
31
|
+
<CheckboxIcon size={size} checked={checked} disabled={props.disabled} />
|
|
32
|
+
{children}
|
|
33
|
+
</label>
|
|
34
|
+
:
|
|
35
|
+
<div>
|
|
36
|
+
<input
|
|
37
|
+
{...props}
|
|
38
|
+
children={null}
|
|
39
|
+
id={props.id}
|
|
40
|
+
onChange={(e) => {
|
|
41
|
+
props.onChange?.(e);
|
|
42
|
+
setChecked(e.target.checked);
|
|
43
|
+
}}
|
|
44
|
+
type="checkbox"
|
|
45
|
+
hidden
|
|
46
|
+
ref={ref}
|
|
47
|
+
/>
|
|
48
|
+
<CheckboxIcon size={size} checked={checked} disabled={props.disabled} />
|
|
49
|
+
</div>
|
|
50
|
+
|
|
33
51
|
);
|
|
34
52
|
}
|
|
35
53
|
);
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../utils/cn"
|
|
7
|
+
|
|
8
|
+
const Dialog = DialogPrimitive.Root
|
|
9
|
+
|
|
10
|
+
const DialogTrigger = DialogPrimitive.Trigger
|
|
11
|
+
|
|
12
|
+
const DialogPortal = DialogPrimitive.Portal
|
|
13
|
+
|
|
14
|
+
const DialogClose = DialogPrimitive.Close
|
|
15
|
+
|
|
16
|
+
const DialogOverlay = React.forwardRef<
|
|
17
|
+
React.ElementRef<typeof DialogPrimitive.Overlay>,
|
|
18
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
|
|
19
|
+
>(({ className, ...props }, ref) => (
|
|
20
|
+
<DialogPrimitive.Overlay
|
|
21
|
+
ref={ref}
|
|
22
|
+
className={cn(
|
|
23
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
24
|
+
className
|
|
25
|
+
)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
))
|
|
29
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
|
|
30
|
+
|
|
31
|
+
const DialogContent = React.forwardRef<
|
|
32
|
+
React.ElementRef<typeof DialogPrimitive.Content>,
|
|
33
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
|
34
|
+
>(({ className, children, ...props }, ref) => (
|
|
35
|
+
<DialogPortal>
|
|
36
|
+
<DialogOverlay />
|
|
37
|
+
<DialogPrimitive.Content
|
|
38
|
+
ref={ref}
|
|
39
|
+
className={cn(
|
|
40
|
+
"fixed left-[50%] top-[50%] z-50 flex flex-col items-start w-full translate-x-[-50%] translate-y-[-50%] shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]",
|
|
41
|
+
"flex justify-center items-center",
|
|
42
|
+
className
|
|
43
|
+
)}
|
|
44
|
+
{...props}
|
|
45
|
+
>
|
|
46
|
+
{children}
|
|
47
|
+
|
|
48
|
+
</DialogPrimitive.Content>
|
|
49
|
+
</DialogPortal>
|
|
50
|
+
))
|
|
51
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
const DialogCloseButton = React.forwardRef<
|
|
55
|
+
React.ElementRef<typeof DialogPrimitive.Close>,
|
|
56
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Close>
|
|
57
|
+
>(({ className, children, ...props }, ref) => (
|
|
58
|
+
<DialogPrimitive.Close ref={ref} {...props} className={cn("m-0 p-0 h-fit", className)}>
|
|
59
|
+
{children}
|
|
60
|
+
</DialogPrimitive.Close>
|
|
61
|
+
))
|
|
62
|
+
const DialogHeader = ({
|
|
63
|
+
className,
|
|
64
|
+
...props
|
|
65
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
66
|
+
<div
|
|
67
|
+
className={cn(
|
|
68
|
+
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
69
|
+
className
|
|
70
|
+
)}
|
|
71
|
+
{...props}
|
|
72
|
+
/>
|
|
73
|
+
)
|
|
74
|
+
DialogHeader.displayName = "DialogHeader"
|
|
75
|
+
|
|
76
|
+
const DialogFooter = ({
|
|
77
|
+
className,
|
|
78
|
+
...props
|
|
79
|
+
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
80
|
+
<div
|
|
81
|
+
className={cn(
|
|
82
|
+
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
83
|
+
className
|
|
84
|
+
)}
|
|
85
|
+
{...props}
|
|
86
|
+
/>
|
|
87
|
+
)
|
|
88
|
+
DialogFooter.displayName = "DialogFooter"
|
|
89
|
+
|
|
90
|
+
const DialogTitle = React.forwardRef<
|
|
91
|
+
React.ElementRef<typeof DialogPrimitive.Title>,
|
|
92
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
|
|
93
|
+
>(({ className, ...props }, ref) => (
|
|
94
|
+
<DialogPrimitive.Title
|
|
95
|
+
ref={ref}
|
|
96
|
+
className={cn(
|
|
97
|
+
"text-lg font-semibold leading-none tracking-tight",
|
|
98
|
+
className
|
|
99
|
+
)}
|
|
100
|
+
{...props}
|
|
101
|
+
/>
|
|
102
|
+
))
|
|
103
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName
|
|
104
|
+
|
|
105
|
+
const DialogDescription = React.forwardRef<
|
|
106
|
+
React.ElementRef<typeof DialogPrimitive.Description>,
|
|
107
|
+
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
|
|
108
|
+
>(({ className, ...props }, ref) => (
|
|
109
|
+
<DialogPrimitive.Description
|
|
110
|
+
ref={ref}
|
|
111
|
+
className={cn("text-sm text-muted-foreground", className)}
|
|
112
|
+
{...props}
|
|
113
|
+
/>
|
|
114
|
+
))
|
|
115
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName
|
|
116
|
+
|
|
117
|
+
export {
|
|
118
|
+
Dialog,
|
|
119
|
+
DialogPortal,
|
|
120
|
+
DialogOverlay,
|
|
121
|
+
DialogTrigger,
|
|
122
|
+
DialogClose,
|
|
123
|
+
DialogContent,
|
|
124
|
+
DialogHeader,
|
|
125
|
+
DialogFooter,
|
|
126
|
+
DialogTitle,
|
|
127
|
+
DialogDescription,
|
|
128
|
+
DialogCloseButton
|
|
129
|
+
}
|
|
@@ -3,6 +3,7 @@ import { Button } from "./Button";
|
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import { cn } from "../utils/cn";
|
|
5
5
|
import { Themes } from "../utils/types";
|
|
6
|
+
import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogCancel } from "./AlertDialog";
|
|
6
7
|
|
|
7
8
|
const dropZoneStyles = cva(
|
|
8
9
|
[
|
|
@@ -19,42 +20,33 @@ const dropZoneStyles = cva(
|
|
|
19
20
|
}
|
|
20
21
|
);
|
|
21
22
|
|
|
22
|
-
interface Props extends InputHTMLAttributes<HTMLInputElement> {
|
|
23
|
+
interface Props extends InputHTMLAttributes<HTMLInputElement | HTMLDivElement> {
|
|
23
24
|
isDropAreaActive?: boolean;
|
|
24
25
|
mainLabel: string;
|
|
25
26
|
secondaryLabel: string;
|
|
26
27
|
theme?: Themes
|
|
27
28
|
expandLabel: ReactNode
|
|
28
|
-
|
|
29
|
-
onExpand?: () => void
|
|
29
|
+
children?: ReactNode
|
|
30
30
|
getRootProps?: () => any
|
|
31
|
-
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
const ImageAttachment = forwardRef<HTMLInputElement, Props>(
|
|
35
34
|
(
|
|
36
35
|
{
|
|
37
36
|
isDropAreaActive,
|
|
38
37
|
mainLabel,
|
|
39
38
|
theme,
|
|
40
39
|
secondaryLabel,
|
|
41
|
-
expandLabel,
|
|
42
|
-
uploadedImage,
|
|
43
|
-
onExpand,
|
|
44
40
|
className,
|
|
45
41
|
getRootProps,
|
|
42
|
+
children,
|
|
46
43
|
...props
|
|
47
44
|
}: Props,
|
|
48
45
|
ref
|
|
49
46
|
) => {
|
|
50
47
|
return (
|
|
51
48
|
<section className="flex items-center justify-center w-full gap-1">
|
|
52
|
-
|
|
53
|
-
theme={theme}
|
|
54
|
-
selectedImg={uploadedImage}
|
|
55
|
-
expandLabel={expandLabel}
|
|
56
|
-
onExpand={onExpand}
|
|
57
|
-
/>
|
|
49
|
+
{children}
|
|
58
50
|
<Button
|
|
59
51
|
{...getRootProps?.()}
|
|
60
52
|
theme={theme}
|
|
@@ -79,28 +71,52 @@ export const ImageAttachment = forwardRef<HTMLInputElement, Props>(
|
|
|
79
71
|
|
|
80
72
|
ImageAttachment.displayName = "ImageAttachment"
|
|
81
73
|
|
|
82
|
-
|
|
83
|
-
|
|
74
|
+
export {
|
|
75
|
+
ImageAttachment,
|
|
76
|
+
ExpandableImage,
|
|
77
|
+
AttachmentImagePreview
|
|
78
|
+
}
|
|
84
79
|
|
|
85
80
|
|
|
86
81
|
interface ExpandableImageProps extends HTMLAttributes<HTMLDivElement> {
|
|
87
|
-
|
|
88
|
-
onExpand?: () => void
|
|
82
|
+
previewSrc: any
|
|
89
83
|
expandLabel: ReactNode
|
|
84
|
+
placeholderLabel?: string
|
|
90
85
|
theme?: Themes
|
|
91
86
|
}
|
|
92
87
|
|
|
93
|
-
const ExpandableImage =
|
|
88
|
+
const ExpandableImage = ({ theme, previewSrc, expandLabel, placeholderLabel = "Upload Image", className, ...props }: ExpandableImageProps) => {
|
|
94
89
|
return (
|
|
95
90
|
<section data-theme={theme} className={cn("flex items-center justify-center w-[65px] h-[65px] rounded-md relative overflow-hidden border-none group", className)}>
|
|
96
|
-
{
|
|
97
|
-
|
|
91
|
+
{previewSrc ? <SelectedImg src={previewSrc} /> : <PlaceHolder label={placeholderLabel} />}
|
|
92
|
+
|
|
93
|
+
{
|
|
94
|
+
previewSrc && (
|
|
95
|
+
<AlertDialog>
|
|
96
|
+
<AlertDialogTrigger asChild>
|
|
97
|
+
<button
|
|
98
|
+
className='flex w-full h-full justify-center items-center flex-col absolute z-10 opacity-0 bg-black/50 transition-all duration-250 ease-in-out hover:opacity-100'
|
|
99
|
+
>
|
|
100
|
+
<svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
101
|
+
<path d="M15.5 3.5L17.8 5.8L14.91 8.67L16.33 10.09L19.2 7.2L21.5 9.5V3.5H15.5ZM3.5 9.5L5.8 7.2L8.67 10.09L10.09 8.67L7.2 5.8L9.5 3.5H3.5V9.5ZM9.5 21.5L7.2 19.2L10.09 16.33L8.67 14.91L5.8 17.8L3.5 15.5V21.5H9.5ZM21.5 15.5L19.2 17.8L16.33 14.91L14.91 16.33L17.8 19.2L15.5 21.5H21.5V15.5Z" fill="#F9F9F9" />
|
|
102
|
+
</svg>
|
|
103
|
+
<p className='text-content-presentation-action-hover typography-labels-small-regular max-w-[50px] break-words m-0'>
|
|
104
|
+
{expandLabel}
|
|
105
|
+
</p>
|
|
106
|
+
</button>
|
|
107
|
+
</AlertDialogTrigger>
|
|
108
|
+
<AlertDialogContent className="w-fit bg-transparent border-none">
|
|
109
|
+
{props.children}
|
|
110
|
+
</AlertDialogContent>
|
|
111
|
+
</AlertDialog>
|
|
112
|
+
)
|
|
113
|
+
}
|
|
98
114
|
</section>
|
|
99
115
|
);
|
|
100
|
-
}
|
|
116
|
+
}
|
|
101
117
|
|
|
102
118
|
|
|
103
|
-
function
|
|
119
|
+
function PlaceHolder({ label }: any) {
|
|
104
120
|
return (
|
|
105
121
|
<section className={cn([
|
|
106
122
|
'w-full h-full gap-[2px] flex flex-col justify-center items-center px-1',
|
|
@@ -115,21 +131,13 @@ function ExpandableBaseComponent({ label }: any) {
|
|
|
115
131
|
</section>
|
|
116
132
|
)
|
|
117
133
|
}
|
|
118
|
-
function ExpandImage({ onExpand, expandLabel = "Expand Pic" }: any) {
|
|
119
|
-
return (
|
|
120
|
-
<button onClick={onExpand} className='flex w-full h-full justify-center items-center flex-col absolute z-10 opacity-0 bg-black/50 transition-all duration-250 ease-in-out hover:opacity-100' >
|
|
121
|
-
<svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
122
|
-
<path d="M15.5 3.5L17.8 5.8L14.91 8.67L16.33 10.09L19.2 7.2L21.5 9.5V3.5H15.5ZM3.5 9.5L5.8 7.2L8.67 10.09L10.09 8.67L7.2 5.8L9.5 3.5H3.5V9.5ZM9.5 21.5L7.2 19.2L10.09 16.33L8.67 14.91L5.8 17.8L3.5 15.5V21.5H9.5ZM21.5 15.5L19.2 17.8L16.33 14.91L14.91 16.33L17.8 19.2L15.5 21.5H21.5V15.5Z" fill="#F9F9F9" />
|
|
123
|
-
</svg>
|
|
124
|
-
<p className='text-content-presentation-action-hover typography-labels-small-regular max-w-[50px] break-words m-0'>{expandLabel}</p>
|
|
125
|
-
</button>
|
|
126
|
-
)
|
|
127
|
-
}
|
|
128
134
|
|
|
129
|
-
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
function SelectedImg({ src }: any) {
|
|
130
138
|
return (
|
|
131
|
-
<section className='bg-white'>
|
|
132
|
-
<img src={
|
|
139
|
+
<section className='bg-white rounded-md border border-border-presentation-global-primary'>
|
|
140
|
+
<img src={src} className='w-full h-full object-cover object-center' />
|
|
133
141
|
</section>
|
|
134
142
|
)
|
|
135
143
|
}
|
|
@@ -138,11 +146,10 @@ function SelectedImg({ imageSrc }: any) {
|
|
|
138
146
|
interface AttachmentImagePreviewProps extends HTMLAttributes<HTMLDivElement> {
|
|
139
147
|
src: any;
|
|
140
148
|
header?: ReactNode;
|
|
141
|
-
onHide?: () => void;
|
|
142
149
|
theme?: Themes
|
|
143
150
|
}
|
|
144
151
|
|
|
145
|
-
|
|
152
|
+
function AttachmentImagePreview({ theme, src, header, className, ...props }: AttachmentImagePreviewProps) {
|
|
146
153
|
return (
|
|
147
154
|
<section
|
|
148
155
|
{...props}
|
|
@@ -156,12 +163,14 @@ export function AttachmentImagePreview({ theme, src, header, onHide, className,
|
|
|
156
163
|
<p className="m-0 text-content-presentation-global-primary typography-display-medium-semibold">
|
|
157
164
|
{header}
|
|
158
165
|
</p>
|
|
159
|
-
<
|
|
160
|
-
<
|
|
161
|
-
|
|
166
|
+
<AlertDialogCancel asChild>
|
|
167
|
+
<Button theme={theme} size="M" buttonType="icon">
|
|
168
|
+
<i className="ri-close-line text-[16px]"></i>
|
|
169
|
+
</Button>
|
|
170
|
+
</AlertDialogCancel>
|
|
162
171
|
</section>
|
|
163
172
|
|
|
164
|
-
<img className="w-full object-cover object-center rounded-md" src={src} />
|
|
173
|
+
<img className="w-full object-cover object-center rounded-md border shadow-md border-border-presentation-global-primary" src={src} />
|
|
165
174
|
|
|
166
175
|
<section className="flex items-center justify-end w-full gap-2">
|
|
167
176
|
{props.children}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, { AnchorHTMLAttributes, SVGProps } from "react";
|
|
1
|
+
import React, { AnchorHTMLAttributes, HTMLAttributes, SVGProps } from "react";
|
|
2
2
|
import { cva } from "class-variance-authority";
|
|
3
3
|
import { cn } from "../utils/cn";
|
|
4
4
|
import { Themes } from "../utils/types";
|
|
5
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
5
6
|
|
|
6
7
|
// Link button base styles
|
|
7
8
|
export const linkButtonStyles = cva(
|
|
@@ -28,14 +29,17 @@ export const linkButtonStyles = cva(
|
|
|
28
29
|
}
|
|
29
30
|
);
|
|
30
31
|
|
|
31
|
-
interface Props extends
|
|
32
|
+
interface Props extends HTMLAttributes<HTMLAnchorElement | HTMLSpanElement> {
|
|
32
33
|
size?: "S" | "M"; // this props will change the button style size see on figma design file
|
|
33
34
|
theme?: Themes
|
|
35
|
+
asChild?: boolean
|
|
36
|
+
href?: string
|
|
34
37
|
}
|
|
35
38
|
|
|
36
|
-
export const LinkButton: React.FC<Props> = ({ theme, size = "S",
|
|
39
|
+
export const LinkButton: React.FC<Props> = ({ theme, className, size = "S", asChild, ...props }) => {
|
|
40
|
+
const Component = asChild ? Slot : props.href ? "a" : "span";
|
|
37
41
|
return (
|
|
38
|
-
<
|
|
42
|
+
<Component
|
|
39
43
|
{...props}
|
|
40
44
|
data-theme={theme}
|
|
41
45
|
className={cn(
|
|
@@ -45,7 +49,7 @@ export const LinkButton: React.FC<Props> = ({ theme, size = "S", className, ...p
|
|
|
45
49
|
className
|
|
46
50
|
)}
|
|
47
51
|
>
|
|
48
|
-
<
|
|
52
|
+
<div className="px-[3px]">{props.children}</div>
|
|
49
53
|
<div
|
|
50
54
|
className={cn(
|
|
51
55
|
"rounded-[4px]",
|
|
@@ -67,7 +71,7 @@ export const LinkButton: React.FC<Props> = ({ theme, size = "S", className, ...p
|
|
|
67
71
|
})}
|
|
68
72
|
/>
|
|
69
73
|
</div>
|
|
70
|
-
</
|
|
74
|
+
</Component>
|
|
71
75
|
);
|
|
72
76
|
};
|
|
73
77
|
|
|
@@ -54,3 +54,60 @@ export function LoginButton({
|
|
|
54
54
|
</button>
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
|
+
|
|
58
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
59
|
+
import { cn } from "../utils/cn"; // Assuming you have a `cn` utility
|
|
60
|
+
import { ButtonHTMLAttributes } from "react";
|
|
61
|
+
import { LoadingIcon } from "./Button";
|
|
62
|
+
import { Themes } from "../utils/types";
|
|
63
|
+
|
|
64
|
+
const buttonVariants = cva(
|
|
65
|
+
"w-full h-[42px] rounded-[8px] typography-body-large-regular flex justify-center items-center transition-all duration-250 ease-in-out border",
|
|
66
|
+
{
|
|
67
|
+
variants: {
|
|
68
|
+
variant: {
|
|
69
|
+
default: [
|
|
70
|
+
"bg-background-system-body-primary",
|
|
71
|
+
"text-content-system-global-primary",
|
|
72
|
+
"border-border-system-global-primary",
|
|
73
|
+
"hover:border-[#9748FF]",
|
|
74
|
+
],
|
|
75
|
+
noBg: [
|
|
76
|
+
"bg-transparent",
|
|
77
|
+
"border-border-system-global-primary",
|
|
78
|
+
"text-content-system-global-primary",
|
|
79
|
+
"hover:border-[#9748FF]",
|
|
80
|
+
"no-underline",
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
defaultVariants: {
|
|
85
|
+
variant: "default",
|
|
86
|
+
},
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
export interface ButtonProps
|
|
91
|
+
extends ButtonHTMLAttributes<HTMLButtonElement>,
|
|
92
|
+
VariantProps<typeof buttonVariants> {
|
|
93
|
+
isLoading?: boolean;
|
|
94
|
+
theme?: Themes
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function LoginButton({
|
|
98
|
+
variant = "default",
|
|
99
|
+
className,
|
|
100
|
+
isLoading,
|
|
101
|
+
theme,
|
|
102
|
+
...props
|
|
103
|
+
}: ButtonProps) {
|
|
104
|
+
return (
|
|
105
|
+
<button data-theme={theme} {...props} className={cn(buttonVariants({ variant, className }))}>
|
|
106
|
+
{isLoading ? (
|
|
107
|
+
<LoadingIcon className="w-[20px] h-[20px]" />
|
|
108
|
+
) : (
|
|
109
|
+
props.children
|
|
110
|
+
)}
|
|
111
|
+
</button>
|
|
112
|
+
);
|
|
113
|
+
}
|
package/lib/components/Radio.tsx
CHANGED
|
@@ -44,25 +44,33 @@ interface Props extends Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "ch
|
|
|
44
44
|
export const Radio = forwardRef<HTMLInputElement, Props>(
|
|
45
45
|
({ size = "M", className, children, theme, radioClassName, ...props }, ref) => {
|
|
46
46
|
return (
|
|
47
|
-
|
|
47
|
+
children ?
|
|
48
|
+
<label data-theme={theme} htmlFor={props.id} className={cn("flex items-center justify-start gap-1", className)}>
|
|
49
|
+
<input
|
|
50
|
+
{...props}
|
|
51
|
+
ref={ref}
|
|
52
|
+
type="radio"
|
|
53
|
+
className={cn(
|
|
54
|
+
glareRadioStyles({
|
|
55
|
+
size,
|
|
56
|
+
}),
|
|
57
|
+
radioClassName
|
|
58
|
+
)}
|
|
59
|
+
/>
|
|
60
|
+
{children}
|
|
61
|
+
</label>
|
|
62
|
+
:
|
|
48
63
|
<input
|
|
49
64
|
{...props}
|
|
50
|
-
onChange={(e) => {
|
|
51
|
-
props.onChange?.(e);
|
|
52
|
-
}}
|
|
53
65
|
ref={ref}
|
|
54
|
-
id={props.id}
|
|
55
66
|
type="radio"
|
|
56
67
|
className={cn(
|
|
57
68
|
glareRadioStyles({
|
|
58
69
|
size,
|
|
59
|
-
|
|
60
70
|
}),
|
|
61
71
|
radioClassName
|
|
62
72
|
)}
|
|
63
73
|
/>
|
|
64
|
-
{children}
|
|
65
|
-
</label>
|
|
66
74
|
);
|
|
67
75
|
}
|
|
68
76
|
);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { forwardRef, InputHTMLAttributes, ReactNode } from "react";
|
|
2
|
-
import { cva } from "class-variance-authority";
|
|
3
2
|
import { cn } from "../utils/cn";
|
|
4
3
|
import { Radio } from "./Radio";
|
|
5
4
|
import { Card, CardContent, CardDescription, CardHeader } from "./Card";
|
|
@@ -23,6 +22,7 @@ export const RadioCard = forwardRef<HTMLInputElement, Props>(
|
|
|
23
22
|
<Card
|
|
24
23
|
data-theme={theme}
|
|
25
24
|
htmlFor={id}
|
|
25
|
+
as="label"
|
|
26
26
|
className={cn(
|
|
27
27
|
"relative border-border-presentation-global-primary group",
|
|
28
28
|
// Disabled state
|
|
@@ -31,7 +31,8 @@ export const RadioCard = forwardRef<HTMLInputElement, Props>(
|
|
|
31
31
|
disabled && "hover:border-border-presentation-global-primary",
|
|
32
32
|
// Checked state
|
|
33
33
|
props.checked && "border-border-presentation-global-primary",
|
|
34
|
-
props.checked && "hover:border-border-presentation-global-primary"
|
|
34
|
+
props.checked && "hover:border-border-presentation-global-primary",
|
|
35
|
+
className
|
|
35
36
|
)}
|
|
36
37
|
>
|
|
37
38
|
<section
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { InputHTMLAttributes, forwardRef } from "react";
|
|
3
|
+
import { Label } from "./Label";
|
|
4
|
+
import { cn } from "../utils/cn";
|
|
5
|
+
import { cva } from "class-variance-authority";
|
|
6
|
+
|
|
7
|
+
interface Props extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
8
|
+
label?: string;
|
|
9
|
+
secondaryLabel?: string;
|
|
10
|
+
requiredLabel?: string;
|
|
11
|
+
size?: "S" | "M" | "L";
|
|
12
|
+
directions?: "vertical" | "horizontal";
|
|
13
|
+
theme?: "dark" | "light" | "default";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const RadioLabel = forwardRef<HTMLInputElement, Props>(
|
|
17
|
+
(
|
|
18
|
+
{
|
|
19
|
+
label,
|
|
20
|
+
theme,
|
|
21
|
+
secondaryLabel,
|
|
22
|
+
requiredLabel,
|
|
23
|
+
size = "M",
|
|
24
|
+
type = "radio",
|
|
25
|
+
directions,
|
|
26
|
+
...props
|
|
27
|
+
},
|
|
28
|
+
ref
|
|
29
|
+
) => {
|
|
30
|
+
return (
|
|
31
|
+
<label
|
|
32
|
+
data-theme={theme}
|
|
33
|
+
htmlFor={props.id}
|
|
34
|
+
className={cn("flex items-center gap-1 group", props.className)}
|
|
35
|
+
>
|
|
36
|
+
<Radio {...props} checked={props.checked} size={size} ref={ref} />
|
|
37
|
+
{label && (
|
|
38
|
+
<Label
|
|
39
|
+
htmlFor={props.id}
|
|
40
|
+
label={label}
|
|
41
|
+
secondaryLabel={secondaryLabel}
|
|
42
|
+
requiredLabel={requiredLabel}
|
|
43
|
+
size={size}
|
|
44
|
+
directions={directions}
|
|
45
|
+
/>
|
|
46
|
+
)}
|
|
47
|
+
</label>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
RadioLabel.displayName = "RadioLabel";
|
|
53
|
+
|
|
54
|
+
const glareRadioStyles = cva(
|
|
55
|
+
[
|
|
56
|
+
"w-[12px]",
|
|
57
|
+
"h-[12px]",
|
|
58
|
+
"rounded-full",
|
|
59
|
+
"border",
|
|
60
|
+
"border-border-presentation-action-checkbox-primary",
|
|
61
|
+
"bg-background-presentation-action-borderstyle",
|
|
62
|
+
"transition-[background,border-color,background-color] duration-200",
|
|
63
|
+
"hover:bg-blue-sparkle-alpha-15 hover:border-border-presentation-state-focus",
|
|
64
|
+
"appearance-none",
|
|
65
|
+
"checked:border-background-presentation-state-information-primary checked:hover:bg-white checked:bg-white",
|
|
66
|
+
"disabled:bg-background-presentation-action-disabled disabled:border-border-presentation-global-primary",
|
|
67
|
+
"disabled:cursor-not-allowed",
|
|
68
|
+
],
|
|
69
|
+
{
|
|
70
|
+
variants: {
|
|
71
|
+
size: {
|
|
72
|
+
S: ["w-[12px] checked:border-[5px]", "h-[12px]"],
|
|
73
|
+
M: ["w-[24px] checked:border-[9px]", "h-[24px]"],
|
|
74
|
+
L: ["w-[24px] checked:border-[9px]", "h-[24px]"],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
defaultVariants: {
|
|
78
|
+
size: "M",
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
interface Props extends Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
84
|
+
size?: "S" | "M" | "L";
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const Radio = forwardRef<HTMLInputElement, Props>(
|
|
88
|
+
({ size = "M", ...props }, ref) => {
|
|
89
|
+
return (
|
|
90
|
+
<input
|
|
91
|
+
{...props}
|
|
92
|
+
onChange={(e) => {
|
|
93
|
+
props.onChange?.(e);
|
|
94
|
+
}}
|
|
95
|
+
ref={ref}
|
|
96
|
+
id={props.id}
|
|
97
|
+
type="radio"
|
|
98
|
+
className={cn(
|
|
99
|
+
glareRadioStyles({
|
|
100
|
+
size,
|
|
101
|
+
})
|
|
102
|
+
)}
|
|
103
|
+
/>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
Radio.displayName = "Radio";
|
|
@@ -1,15 +1,41 @@
|
|
|
1
|
-
|
|
1
|
+
'use client'
|
|
2
2
|
import { cn } from "../utils/cn";
|
|
3
|
-
import
|
|
3
|
+
import * as SwitchPrimitives from "@radix-ui/react-switch"
|
|
4
|
+
import React from "react";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
const Switch = React.forwardRef<
|
|
7
|
+
React.ElementRef<typeof SwitchPrimitives.Root>,
|
|
8
|
+
React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>
|
|
9
|
+
>(({ className, ...props }, ref) => (
|
|
10
|
+
<SwitchPrimitives.Root
|
|
11
|
+
className={cn(
|
|
12
|
+
"peer inline-flex w-[48px] h-[28px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-background-presentation-switcher-active data-[state=unchecked]:bg-background-presentation-switcher-disabled",
|
|
13
|
+
className
|
|
14
|
+
)}
|
|
15
|
+
{...props}
|
|
16
|
+
ref={ref}
|
|
17
|
+
>
|
|
18
|
+
<SwitchPrimitives.Thumb
|
|
19
|
+
className={cn(
|
|
20
|
+
"pointer-events-none block w-[24px] h-[24px] rounded-full bg-background-presentation-switcher-knob shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-[22px] data-[state=unchecked]:translate-x-0"
|
|
21
|
+
)}
|
|
22
|
+
/>
|
|
23
|
+
</SwitchPrimitives.Root>
|
|
24
|
+
))
|
|
25
|
+
Switch.displayName = SwitchPrimitives.Root.displayName
|
|
26
|
+
|
|
27
|
+
export { Switch }
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/* interface Props extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
6
32
|
active: boolean;
|
|
7
33
|
activeLabel?: string;
|
|
8
34
|
disabledLabel?: string;
|
|
9
35
|
theme?: "dark" | "light" | "default";
|
|
10
36
|
}
|
|
11
37
|
|
|
12
|
-
|
|
38
|
+
function Switchers({
|
|
13
39
|
active,
|
|
14
40
|
activeLabel,
|
|
15
41
|
disabledLabel,
|
|
@@ -53,4 +79,4 @@ export function Switcher({
|
|
|
53
79
|
)}
|
|
54
80
|
</section>
|
|
55
81
|
);
|
|
56
|
-
}
|
|
82
|
+
} */
|
|
@@ -70,3 +70,76 @@ export const TransparentLabel = ({ size, className, ...props }: Props) => {
|
|
|
70
70
|
<p {...props} className={cn(TransparentLabelStyles({ size }), className)}></p>
|
|
71
71
|
);
|
|
72
72
|
};
|
|
73
|
+
|
|
74
|
+
import { cn } from "../utils/cn";
|
|
75
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
76
|
+
import { HTMLAttributes } from "react";
|
|
77
|
+
|
|
78
|
+
export const TransparentLabelStyles = cva(
|
|
79
|
+
"[mask-image:linear-gradient(to_right,black_0%,black_0%,black_85%,transparent_100%)] rtl:[mask-image:linear-gradient(to_left,black_0%,black_0%,black_85%,transparent_100%)]",
|
|
80
|
+
{
|
|
81
|
+
variants: {
|
|
82
|
+
size: {
|
|
83
|
+
"display-large-bold": "typography-display-large-bold",
|
|
84
|
+
"display-large-semibold": "typography-display-large-semibold",
|
|
85
|
+
"display-large-medium": "typography-display-large-medium",
|
|
86
|
+
"display-large-regular": "typography-display-large-regular",
|
|
87
|
+
"display-medium-bold": "typography-display-medium-bold",
|
|
88
|
+
"display-medium-semibold": "typography-display-medium-semibold",
|
|
89
|
+
"display-medium-medium": "typography-display-medium-medium",
|
|
90
|
+
"display-medium-regular": "typography-display-medium-regular",
|
|
91
|
+
"display-small-bold": "typography-display-small-bold",
|
|
92
|
+
"display-small-semibold": "typography-display-small-semibold",
|
|
93
|
+
"display-small-medium": "typography-display-small-medium",
|
|
94
|
+
"display-small-regular": "typography-display-small-regular",
|
|
95
|
+
"headers-large-bold": "typography-headers-large-bold",
|
|
96
|
+
"headers-large-semibold": "typography-headers-large-semibold",
|
|
97
|
+
"headers-large-medium": "typography-headers-large-medium",
|
|
98
|
+
"headers-large-regular": "typography-headers-large-regular",
|
|
99
|
+
"headers-medium-bold": "typography-headers-medium-bold",
|
|
100
|
+
"headers-medium-semibold": "typography-headers-medium-semibold",
|
|
101
|
+
"headers-medium-medium": "typography-headers-medium-medium",
|
|
102
|
+
"headers-medium-regular": "typography-headers-medium-regular",
|
|
103
|
+
"headers-small-bold": "typography-headers-small-bold",
|
|
104
|
+
"headers-small-semibold": "typography-headers-small-semibold",
|
|
105
|
+
"headers-small-medium": "typography-headers-small-medium",
|
|
106
|
+
"headers-small-regular": "typography-headers-small-regular",
|
|
107
|
+
"body-large-bold": "typography-body-large-bold",
|
|
108
|
+
"body-large-semibold": "typography-body-large-semibold",
|
|
109
|
+
"body-large-medium": "typography-body-large-medium",
|
|
110
|
+
"body-large-regular": "typography-body-large-regular",
|
|
111
|
+
"body-medium-bold": "typography-body-medium-bold",
|
|
112
|
+
"body-medium-semibold": "typography-body-medium-semibold",
|
|
113
|
+
"body-medium-medium": "typography-body-medium-medium",
|
|
114
|
+
"body-medium-regular": "typography-body-medium-regular",
|
|
115
|
+
"body-small-bold": "typography-body-small-bold",
|
|
116
|
+
"body-small-semibold": "typography-body-small-semibold",
|
|
117
|
+
"body-small-medium": "typography-body-small-medium",
|
|
118
|
+
"body-small-regular": "typography-body-small-regular",
|
|
119
|
+
"labels-large-bold": "typography-labels-large-bold",
|
|
120
|
+
"labels-large-semibold": "typography-labels-large-semibold",
|
|
121
|
+
"labels-large-medium": "typography-labels-large-medium",
|
|
122
|
+
"labels-large-regular": "typography-labels-large-regular",
|
|
123
|
+
"labels-medium-bold": "typography-labels-medium-bold",
|
|
124
|
+
"labels-medium-semibold": "typography-labels-medium-semibold",
|
|
125
|
+
"labels-medium-medium": "typography-labels-medium-medium",
|
|
126
|
+
"labels-medium-regular": "typography-labels-medium-regular",
|
|
127
|
+
"labels-small-bold": "typography-labels-small-bold",
|
|
128
|
+
"labels-small-semibold": "typography-labels-small-semibold",
|
|
129
|
+
"labels-small-medium": "typography-labels-small-medium",
|
|
130
|
+
"labels-small-regular": "typography-labels-small-regular",
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
defaultVariants: {
|
|
134
|
+
size: "body-medium-regular",
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
interface Props extends HTMLAttributes<HTMLParagraphElement>, VariantProps<typeof TransparentLabelStyles> { }
|
|
140
|
+
|
|
141
|
+
export const TransparentLabel = ({ size, className, ...props }: Props) => {
|
|
142
|
+
return (
|
|
143
|
+
<p {...props} className={cn(TransparentLabelStyles({ size }), className)}></p>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
@@ -56,7 +56,7 @@ export const TreeDropDown = ({ childrenContainerClassName, className, variant =
|
|
|
56
56
|
<button className={cn("outline-none border-none flex-0 leading-0 transition-transform ease-in-out flex justify-center items-center bg-background-system-body-tertiary h-[28px] w-[28px] rounded-full text-[20px] text-content-system-global-primary", { "rotate-180": isActive })}>
|
|
57
57
|
<i className={cn("leading-none ri-arrow-down-s-line ")}></i>
|
|
58
58
|
</button>
|
|
59
|
-
<
|
|
59
|
+
<div className={cn("text-content-system-global-primary typography-body-medium-medium transition-all ease-in-out duration-100 flex-1")}>{treeLabel}</div>
|
|
60
60
|
</div>
|
|
61
61
|
<div className={cn("mt-0 pl-[22px] relative overflow-auto scrollbar-hide transition-all duration-500 ease-in-out", {
|
|
62
62
|
"max-h-[20000px] mt-1": isActive, "max-h-0": !isActive,
|
package/lib/layouts/CLayout.tsx
CHANGED
|
@@ -11,23 +11,27 @@ interface LayoutProps
|
|
|
11
11
|
}
|
|
12
12
|
function Layout({ ...props }: LayoutProps) {
|
|
13
13
|
return (
|
|
14
|
-
<
|
|
14
|
+
<div {...props} className="flex h-[100dvh] flex-1 lg:gap-[10px] bg-background-system-body-base lg:p-[16px]">
|
|
15
15
|
{props.children}
|
|
16
|
-
</
|
|
16
|
+
</div>
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
interface BodyProps
|
|
20
|
+
interface ContentProps
|
|
22
21
|
extends HTMLAttributes<HTMLDivElement> {
|
|
23
22
|
}
|
|
24
|
-
function Body({ ...props }:
|
|
23
|
+
function Body({ ...props }: ContentProps) {
|
|
25
24
|
return (
|
|
26
|
-
<main {...props} className={cn("flex flex-grow flex-1 overflow-
|
|
27
|
-
<div className="flex lg:rounded-
|
|
25
|
+
<main {...props} className={cn("flex flex-grow flex-1 overflow-y-auto", props.className)}>
|
|
26
|
+
<div className="flex lg:rounded-[12px] bg-background-system-body-tertiary shadow-[0px_0px_18px_0px_rgba(0,0,0,0.75)] flex-1 flex-grow lg:p-1">
|
|
28
27
|
<div
|
|
29
|
-
className="lg:rounded-lg flex-1 flex-grow overflow-scroll scrollbar-hide lg:p-[2px] lg:bg-[linear-gradient(
|
|
28
|
+
className="relative lg:rounded-lg flex-1 flex-grow overflow-scroll scrollbar-hide lg:p-[2px] lg:bg-[linear-gradient(143deg,var(--blue-sparkle-600)_0px,rgba(44,45,46,1)_55px)]"
|
|
30
29
|
>
|
|
30
|
+
<div
|
|
31
|
+
className="absolute top-[2px] w-[170px] rounded-t-[6px] z-10 lg:h-[60px]
|
|
32
|
+
left-[2px] ltr:lg:bg-[linear-gradient(132deg,#0D0F4E_0%,#000_50%)]
|
|
33
|
+
rtl:right-[2px] rtl:left-[unset] rtl:lg:bg-[linear-gradient(-132deg,#0D0F4E_0%,#000_50%)]"
|
|
34
|
+
></div>
|
|
31
35
|
{props.children}
|
|
32
36
|
</div>
|
|
33
37
|
</div>
|
|
@@ -35,7 +39,6 @@ function Body({ ...props }: BodyProps) {
|
|
|
35
39
|
);
|
|
36
40
|
}
|
|
37
41
|
|
|
38
|
-
|
|
39
42
|
interface SideBarProps
|
|
40
43
|
extends HTMLAttributes<HTMLDivElement> {
|
|
41
44
|
iconButtons?: ReactNode
|
|
@@ -97,6 +100,7 @@ function SideBar({ children, footerChildren, headerChild, navigationChildren, ic
|
|
|
97
100
|
}
|
|
98
101
|
|
|
99
102
|
|
|
103
|
+
|
|
100
104
|
interface ChildProps
|
|
101
105
|
extends HTMLAttributes<HTMLDivElement> {
|
|
102
106
|
theme?: Themes
|
|
@@ -111,6 +115,7 @@ const SideBarChildContainer = ({ theme, ...props }: ChildProps) => {
|
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
|
|
118
|
+
|
|
114
119
|
const SideBarItemStyles = cva([
|
|
115
120
|
"h-[40px] w-full px-[8px] flex gap-[6px] typography-body-small-medium justify-start items-center",
|
|
116
121
|
"text-content-system-global-primary border-l-[2px] rtl:border-r-[2px] border-transparent outline-none",
|
|
@@ -186,11 +191,11 @@ interface Props
|
|
|
186
191
|
active?: boolean
|
|
187
192
|
disabled?: boolean
|
|
188
193
|
}
|
|
189
|
-
const SideBarItem = ({ active, disabled, iconOnly, asChild, as: Tag = "span", theme, variant, ...props }: Props) => {
|
|
194
|
+
const SideBarItem = ({ active, disabled, iconOnly, asChild, as: Tag = "span", theme, className, variant, ...props }: Props) => {
|
|
190
195
|
const Component = asChild ? Slot : Tag;
|
|
191
196
|
|
|
192
197
|
return (
|
|
193
|
-
<Component {...props} data-theme={theme} disabled={disabled} className={cn(SideBarItemStyles({ variant, iconOnly, active, disabled }),
|
|
198
|
+
<Component {...props} data-theme={theme} disabled={disabled} className={cn(SideBarItemStyles({ variant, iconOnly, active, disabled }), className)}>
|
|
194
199
|
|
|
195
200
|
</Component>
|
|
196
201
|
)
|
|
@@ -247,13 +252,13 @@ interface SideBarIconButtonProps
|
|
|
247
252
|
disabled?: boolean
|
|
248
253
|
}
|
|
249
254
|
|
|
250
|
-
const SideBarIconButton = ({ count, active, asChild, message, as: Tag = "button", theme, variant, ...props }: SideBarIconButtonProps) => {
|
|
255
|
+
const SideBarIconButton = ({ count, active, asChild, message, as: Tag = "button", theme, variant, className, ...props }: SideBarIconButtonProps) => {
|
|
251
256
|
const Component = asChild ? Slot : Tag;
|
|
252
257
|
|
|
253
258
|
return (
|
|
254
259
|
message ?
|
|
255
260
|
<Tooltip variant={"highlight"} text={message} toolTipSide='left' className='z-[1000]'>
|
|
256
|
-
<Component {...props} data-theme={theme} className={cn(SideBarIconButtonStyles({ variant, active }))}>
|
|
261
|
+
<Component {...props} data-theme={theme} className={cn(SideBarIconButtonStyles({ variant, active }), className)}>
|
|
257
262
|
{props.children}
|
|
258
263
|
{count && <Counter className=' absolute top-[2px] right-[2px]' label={count} />}
|
|
259
264
|
</Component>
|
|
@@ -301,14 +306,14 @@ const glareFeedbackItemStyle = cva(
|
|
|
301
306
|
|
|
302
307
|
|
|
303
308
|
const SideBarFooterItem: React.FC<SideBarFooterItemProps> = ({ asChild,
|
|
304
|
-
as: Tag = "button", theme, variant, ...props }) => {
|
|
309
|
+
as: Tag = "button", theme, variant, className, ...props }) => {
|
|
305
310
|
const Component = asChild ? Slot : Tag;
|
|
306
311
|
|
|
307
312
|
return (
|
|
308
313
|
<Component
|
|
309
314
|
data-theme={theme}
|
|
310
315
|
{...props}
|
|
311
|
-
className={cn(glareFeedbackItemStyle({ variant }),
|
|
316
|
+
className={cn(glareFeedbackItemStyle({ variant }), className)}
|
|
312
317
|
>
|
|
313
318
|
</Component>
|
|
314
319
|
);
|
|
@@ -36,10 +36,10 @@ export default function TreeSubLayout({
|
|
|
36
36
|
return (
|
|
37
37
|
<div
|
|
38
38
|
className={cn(
|
|
39
|
-
"flex
|
|
39
|
+
"flex h-full overflow-hidden transition-all ease-in-out delay-150 lg:bg-none lg:rounded-2 ",
|
|
40
40
|
)}
|
|
41
41
|
>
|
|
42
|
-
<div className="grid grid-rows-[
|
|
42
|
+
<div className="grid grid-rows-[auto_1fr] h-full flex-1 lg:gap-[2px] rounded-2 flex-shrink-0 min-w-[300px]">
|
|
43
43
|
<HeaderPage
|
|
44
44
|
title={treeData[pathname]?.pageHeader}
|
|
45
45
|
subTitle={treeData[pathname]?.subTitle}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from "react";
|
|
2
|
+
|
|
3
|
+
export const convertImageFileToDataUrl = async (
|
|
4
|
+
file: File | null,
|
|
5
|
+
setter: Dispatch<SetStateAction<string>>
|
|
6
|
+
) => {
|
|
7
|
+
if (file && file.type.startsWith("image/")) {
|
|
8
|
+
const reader = new FileReader();
|
|
9
|
+
reader.onload = (e: ProgressEvent<FileReader>) => {
|
|
10
|
+
const result = e.target?.result;
|
|
11
|
+
if (typeof result === "string") {
|
|
12
|
+
setter(result);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
reader.readAsDataURL(file);
|
|
16
|
+
}
|
|
17
|
+
};
|
package/package.json
CHANGED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes } from "react";
|
|
2
|
-
import { cva } from "class-variance-authority";
|
|
3
|
-
import { cn } from "../utils/cn";
|
|
4
|
-
|
|
5
|
-
export const loadingFrame = cva("relative flex justify-center items-center", {
|
|
6
|
-
variants: {
|
|
7
|
-
size: {
|
|
8
|
-
S: "w-[200px] h-[200px]",
|
|
9
|
-
M: "w-[400px] h-[400px]",
|
|
10
|
-
L: "w-[500px] h-[500px]",
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
defaultVariants: {
|
|
14
|
-
size: "S",
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export const loadingAnimationTextContainer = cva("", {
|
|
19
|
-
variants: {
|
|
20
|
-
size: {
|
|
21
|
-
S: "w-[150px] h-[150px]",
|
|
22
|
-
M: "w-[200px] h-[200px]",
|
|
23
|
-
L: "w-[300px] h-[300px]",
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
defaultVariants: {
|
|
27
|
-
size: "S",
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
interface Props extends HTMLAttributes<HTMLDivElement> {
|
|
32
|
-
size?: "S" | "M" | "L"; // this is used to change the size style of the component
|
|
33
|
-
theme?: "light" | "dark" | "default";
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export default function RingLoading({ className, theme = "light", size = "M", ...props }: Props) {
|
|
37
|
-
return (
|
|
38
|
-
<section data-theme={theme} {...props} className={cn(loadingFrame({ size }), className)}>
|
|
39
|
-
<DarkRingLoadingIcon
|
|
40
|
-
data-theme={theme}
|
|
41
|
-
className="w-full h-full animate-spin bg-transparent object-cover object-center hidden data-[theme=dark]:flex"
|
|
42
|
-
/>
|
|
43
|
-
|
|
44
|
-
{/* Light Theme Loader */}
|
|
45
|
-
<RingLoadingIcon
|
|
46
|
-
data-theme={theme}
|
|
47
|
-
className="w-full h-full animate-spin bg-transparent object-cover object-center hidden data-[theme=light]:flex"
|
|
48
|
-
/>
|
|
49
|
-
<section
|
|
50
|
-
className={cn(
|
|
51
|
-
"absolute flex justify-center items-center top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2"
|
|
52
|
-
)}
|
|
53
|
-
>
|
|
54
|
-
{props.children}
|
|
55
|
-
</section>
|
|
56
|
-
</section>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const DarkRingLoadingIcon = (props: HTMLAttributes<HTMLOrSVGElement>) => (
|
|
64
|
-
<svg
|
|
65
|
-
{...props}
|
|
66
|
-
id="e7Ze8cPfGzd1"
|
|
67
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
68
|
-
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
69
|
-
viewBox="0 0 216 216"
|
|
70
|
-
shapeRendering="geometricPrecision"
|
|
71
|
-
textRendering="geometricPrecision"
|
|
72
|
-
>
|
|
73
|
-
<defs>
|
|
74
|
-
<filter
|
|
75
|
-
id="e7Ze8cPfGzd3-filter"
|
|
76
|
-
x="-150%"
|
|
77
|
-
width="400%"
|
|
78
|
-
y="-150%"
|
|
79
|
-
height="400%"
|
|
80
|
-
>
|
|
81
|
-
<feGaussianBlur
|
|
82
|
-
id="e7Ze8cPfGzd3-filter-blur-0"
|
|
83
|
-
stdDeviation="4,4"
|
|
84
|
-
result="result"
|
|
85
|
-
/>
|
|
86
|
-
</filter>
|
|
87
|
-
<linearGradient
|
|
88
|
-
id="e7Ze8cPfGzd4-fill"
|
|
89
|
-
x1="16"
|
|
90
|
-
y1="116"
|
|
91
|
-
x2="126.065"
|
|
92
|
-
y2="28.6871"
|
|
93
|
-
spreadMethod="pad"
|
|
94
|
-
gradientUnits="userSpaceOnUse"
|
|
95
|
-
gradientTransform="translate(0 0)"
|
|
96
|
-
>
|
|
97
|
-
<stop
|
|
98
|
-
id="e7Ze8cPfGzd4-fill-0"
|
|
99
|
-
offset="0%"
|
|
100
|
-
stopColor="rgba(83,23,255,0)"
|
|
101
|
-
/>
|
|
102
|
-
<stop id="e7Ze8cPfGzd4-fill-1" offset="100%" stopColor="#b900d8" />
|
|
103
|
-
</linearGradient>
|
|
104
|
-
<filter
|
|
105
|
-
id="e7Ze8cPfGzd5-filter"
|
|
106
|
-
x="-150%"
|
|
107
|
-
width="400%"
|
|
108
|
-
y="-150%"
|
|
109
|
-
height="400%"
|
|
110
|
-
>
|
|
111
|
-
<feGaussianBlur
|
|
112
|
-
id="e7Ze8cPfGzd5-filter-blur-0"
|
|
113
|
-
stdDeviation="8,8"
|
|
114
|
-
result="result"
|
|
115
|
-
/>
|
|
116
|
-
</filter>
|
|
117
|
-
<linearGradient
|
|
118
|
-
id="e7Ze8cPfGzd6-fill"
|
|
119
|
-
x1="16"
|
|
120
|
-
y1="116"
|
|
121
|
-
x2="126.065"
|
|
122
|
-
y2="28.6871"
|
|
123
|
-
spreadMethod="pad"
|
|
124
|
-
gradientUnits="userSpaceOnUse"
|
|
125
|
-
gradientTransform="translate(0 0)"
|
|
126
|
-
>
|
|
127
|
-
<stop
|
|
128
|
-
id="e7Ze8cPfGzd6-fill-0"
|
|
129
|
-
offset="0%"
|
|
130
|
-
stopColor="rgba(83,23,255,0)"
|
|
131
|
-
/>
|
|
132
|
-
<stop id="e7Ze8cPfGzd6-fill-1" offset="100%" stopColor="#b900d8" />
|
|
133
|
-
</linearGradient>
|
|
134
|
-
<linearGradient
|
|
135
|
-
id="e7Ze8cPfGzd7-fill"
|
|
136
|
-
x1="16"
|
|
137
|
-
y1="116"
|
|
138
|
-
x2="126.065"
|
|
139
|
-
y2="28.6871"
|
|
140
|
-
spreadMethod="pad"
|
|
141
|
-
gradientUnits="userSpaceOnUse"
|
|
142
|
-
gradientTransform="translate(0 0)"
|
|
143
|
-
>
|
|
144
|
-
<stop
|
|
145
|
-
id="e7Ze8cPfGzd7-fill-0"
|
|
146
|
-
offset="0%"
|
|
147
|
-
stopColor="rgba(83,23,255,0.3)"
|
|
148
|
-
/>
|
|
149
|
-
<stop id="e7Ze8cPfGzd7-fill-1" offset="100%" stopColor="#e75cff" />
|
|
150
|
-
</linearGradient>
|
|
151
|
-
</defs>
|
|
152
|
-
<path
|
|
153
|
-
d="M116,16c55.228,0,100,44.7715,100,100c0,55.228-44.772,100-100,100-55.2285,0-100-44.772-100-100C16,60.7715,60.7715,16,116,16Zm0,195c52.467,0,95-42.533,95-95s-42.533-95-95-95-95,42.5329-95,95c0,52.467,42.5329,95,95,95Z"
|
|
154
|
-
transform="translate(-8-8)"
|
|
155
|
-
fillOpacity="0.1"
|
|
156
|
-
/>
|
|
157
|
-
<g transform="translate(-7.999968-8)" filter="url(#e7Ze8cPfGzd3-filter)">
|
|
158
|
-
<path
|
|
159
|
-
d="M116,18.5c0-1.3807-1.119-2.5033-2.5-2.4688-12.28.3071-24.4062,2.8745-35.7684,7.5808-12.1325,5.0255-23.1564,12.3915-32.4423,21.6773-9.2858,9.2859-16.6518,20.3098-21.6773,32.4424C18.9057,89.0939,16.3383,101.22,16.0312,113.5c-.0345,1.381,1.0881,2.5,2.4688,2.5s2.4966-1.12,2.5329-2.5c.3059-11.623,2.7434-23.0994,7.1985-33.8549c4.7742-11.5259,11.7719-21.9987,20.5934-30.8202s19.2943-15.8193,30.8203-20.5935c10.7555-4.4551,22.2319-6.8926,33.8549-7.1985c1.38-.0363,2.5-1.1522,2.5-2.5329Z"
|
|
160
|
-
fill="url(#e7Ze8cPfGzd4-fill)"
|
|
161
|
-
/>
|
|
162
|
-
</g>
|
|
163
|
-
<g transform="translate(-8-8)" filter="url(#e7Ze8cPfGzd5-filter)">
|
|
164
|
-
<path
|
|
165
|
-
d="M116,18.5c0-1.3807-1.119-2.5033-2.5-2.4688-12.28.3071-24.4062,2.8745-35.7684,7.5808-12.1325,5.0255-23.1564,12.3915-32.4423,21.6773-9.2858,9.2859-16.6518,20.3098-21.6773,32.4424C18.9057,89.0939,16.3383,101.22,16.0312,113.5c-.0345,1.381,1.0881,2.5,2.4688,2.5s2.4966-1.12,2.5329-2.5c.3059-11.623,2.7434-23.0994,7.1985-33.8549c4.7742-11.5259,11.7719-21.9987,20.5934-30.8202s19.2943-15.8193,30.8203-20.5935c10.7555-4.4551,22.2319-6.8926,33.8549-7.1985c1.38-.0363,2.5-1.1522,2.5-2.5329Z"
|
|
166
|
-
fill="url(#e7Ze8cPfGzd6-fill)"
|
|
167
|
-
/>
|
|
168
|
-
</g>
|
|
169
|
-
<path
|
|
170
|
-
d="M116,18.5c0-1.3807-1.119-2.5033-2.5-2.4688-12.28.3071-24.4062,2.8745-35.7684,7.5808-12.1325,5.0255-23.1564,12.3915-32.4423,21.6773-9.2858,9.2859-16.6518,20.3098-21.6773,32.4424C18.9057,89.0939,16.3383,101.22,16.0312,113.5c-.0345,1.381,1.0881,2.5,2.4688,2.5s2.4966-1.12,2.5329-2.5c.3059-11.623,2.7434-23.0994,7.1985-33.8549c4.7742-11.5259,11.7719-21.9987,20.5934-30.8202s19.2943-15.8193,30.8203-20.5935c10.7555-4.4551,22.2319-6.8926,33.8549-7.1985c1.38-.0363,2.5-1.1522,2.5-2.5329Z"
|
|
171
|
-
transform="translate(-8-8)"
|
|
172
|
-
fill="url(#e7Ze8cPfGzd7-fill)"
|
|
173
|
-
/>
|
|
174
|
-
</svg>
|
|
175
|
-
);
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
const RingLoadingIcon = (props: HTMLAttributes<HTMLOrSVGElement>) => (
|
|
180
|
-
<svg {...props} width="200" height="200" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
181
|
-
<path d="M200 100C200 155.228 155.228 200 100 200C44.7715 200 0 155.228 0 100C0 44.7715 44.7715 0 100 0C155.228 0 200 44.7715 200 100ZM5 100C5 152.467 47.5329 195 100 195C152.467 195 195 152.467 195 100C195 47.5329 152.467 5 100 5C47.5329 5 5 47.5329 5 100Z" fill="black" fillOpacity="0.1" />
|
|
182
|
-
<path d="M197.5 100C198.881 100 200.003 98.8805 199.969 97.5002C199.662 85.22 197.094 73.0938 192.388 61.7317C187.362 49.5991 179.997 38.5752 170.711 29.2893C161.425 20.0035 150.401 12.6375 138.268 7.61205C126.906 2.90567 114.78 0.338305 102.5 0.031247C101.119 -0.00326585 100 1.11929 100 2.5C100 3.88071 101.12 4.99656 102.5 5.03289C114.123 5.33884 125.599 7.77635 136.355 12.2314C147.881 17.0056 158.354 24.0033 167.175 32.8249C175.997 41.6464 182.994 52.1191 187.769 63.6451C192.224 74.4006 194.661 85.8767 194.967 97.5002C195.003 98.8805 196.119 100 197.5 100Z" fill="url(#paint0_linear_10856_138364)" />
|
|
183
|
-
<defs>
|
|
184
|
-
<linearGradient id="paint0_linear_10856_138364" x1="3.4045" y1="-9.09091" x2="225.705" y2="19.8973" gradientUnits="userSpaceOnUse">
|
|
185
|
-
<stop stopColor="#D500F9" />
|
|
186
|
-
<stop offset="1" stopColor="#5317FF" />
|
|
187
|
-
</linearGradient>
|
|
188
|
-
</defs>
|
|
189
|
-
</svg>
|
|
190
|
-
);
|