@boyernick/standard-ui-react 0.1.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/README.md +9 -0
- package/package.json +46 -0
- package/src/accordion.tsx +84 -0
- package/src/alert-dialog.tsx +101 -0
- package/src/attachment.tsx +138 -0
- package/src/autocomplete.tsx +281 -0
- package/src/avatar.tsx +56 -0
- package/src/badge.tsx +28 -0
- package/src/brand.tsx +70 -0
- package/src/breadcrumb.tsx +81 -0
- package/src/button.tsx +129 -0
- package/src/calendar.tsx +84 -0
- package/src/card.tsx +54 -0
- package/src/carousel.tsx +253 -0
- package/src/chart.tsx +185 -0
- package/src/checkbox-group.tsx +14 -0
- package/src/checkbox.tsx +31 -0
- package/src/code-block.tsx +124 -0
- package/src/collapsible.tsx +61 -0
- package/src/combobox.tsx +324 -0
- package/src/command.tsx +377 -0
- package/src/context-menu.tsx +250 -0
- package/src/dialog.tsx +78 -0
- package/src/drawer.tsx +156 -0
- package/src/empty.tsx +52 -0
- package/src/field.tsx +75 -0
- package/src/fieldset.tsx +25 -0
- package/src/form.tsx +14 -0
- package/src/icons.tsx +91 -0
- package/src/illustrations.tsx +167 -0
- package/src/image-modal.tsx +110 -0
- package/src/index.ts +833 -0
- package/src/input.tsx +68 -0
- package/src/lib/cn.ts +3 -0
- package/src/lib/motion.ts +23 -0
- package/src/markdown-editor.tsx +302 -0
- package/src/menu.tsx +205 -0
- package/src/menubar.tsx +22 -0
- package/src/meter.tsx +61 -0
- package/src/navigation-menu.tsx +217 -0
- package/src/number-field.tsx +119 -0
- package/src/orb.tsx +33 -0
- package/src/otp-field.tsx +45 -0
- package/src/pagination.tsx +91 -0
- package/src/popover.tsx +92 -0
- package/src/preview-card.tsx +103 -0
- package/src/progress.tsx +60 -0
- package/src/radio.tsx +43 -0
- package/src/scroll-area.tsx +67 -0
- package/src/select.tsx +161 -0
- package/src/separator.tsx +17 -0
- package/src/sidebar.tsx +82 -0
- package/src/skeleton.tsx +32 -0
- package/src/slider.tsx +56 -0
- package/src/sounds.tsx +270 -0
- package/src/spinner.tsx +45 -0
- package/src/switch.tsx +19 -0
- package/src/table.tsx +81 -0
- package/src/tabs.tsx +62 -0
- package/src/text-animate.tsx +155 -0
- package/src/textarea.tsx +58 -0
- package/src/ticker.tsx +74 -0
- package/src/toast.tsx +142 -0
- package/src/toggle.tsx +32 -0
- package/src/toolbar.tsx +75 -0
- package/src/tooltip.tsx +55 -0
- package/src/video-player.tsx +241 -0
package/src/icons.tsx
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import type { CentralIconBaseProps } from "@central-icons-react/round-outlined-radius-2-stroke-2/CentralIconBase"
|
|
4
|
+
import { IconBell as IconBellBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconBell"
|
|
5
|
+
import { IconChainLink1 as IconChainLink1Base } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconChainLink1"
|
|
6
|
+
import { IconCheckmark1 as IconCheckmark1Base } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconCheckmark1"
|
|
7
|
+
import { IconChevronBottom as IconChevronBottomBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconChevronBottom"
|
|
8
|
+
import { IconChevronDownSmall as IconChevronDownSmallBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconChevronDownSmall"
|
|
9
|
+
import { IconChevronRightSmall as IconChevronRightSmallBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconChevronRightSmall"
|
|
10
|
+
import { IconClipboard as IconClipboardBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconClipboard"
|
|
11
|
+
import { IconCrossSmall as IconCrossSmallBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconCrossSmall"
|
|
12
|
+
import { IconHome as IconHomeBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconHome"
|
|
13
|
+
import { IconMagnifyingGlass as IconMagnifyingGlassBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconMagnifyingGlass"
|
|
14
|
+
import { IconMinusMedium as IconMinusBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconMinusMedium"
|
|
15
|
+
import { IconMoon as IconMoonBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconMoon"
|
|
16
|
+
import { IconPeople as IconPeopleBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconPeople"
|
|
17
|
+
import { IconPlusMedium as IconPlusBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconPlusMedium"
|
|
18
|
+
import { IconSettingsGear1 as IconSettingsGear1Base } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconSettingsGear1"
|
|
19
|
+
import { IconSquareBehindSquare6 as IconSquareBehindSquare6Base } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconSquareBehindSquare6"
|
|
20
|
+
import { IconSun as IconSunBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconSun"
|
|
21
|
+
import { IconX as IconXBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconX"
|
|
22
|
+
import type { ComponentType } from "react"
|
|
23
|
+
|
|
24
|
+
/** Round outlined Central Icons: 2px radius, 2px stroke, default 20px. */
|
|
25
|
+
export const CENTRAL_ICON_SIZE = 20
|
|
26
|
+
|
|
27
|
+
export type CentralIconProps = Omit<CentralIconBaseProps, "size"> & {
|
|
28
|
+
size?: CentralIconBaseProps["size"]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export type CentralIconComponent = ComponentType<CentralIconProps>
|
|
32
|
+
|
|
33
|
+
export const withCentralIconDefaults = (
|
|
34
|
+
Icon: ComponentType<CentralIconBaseProps>,
|
|
35
|
+
): CentralIconComponent => {
|
|
36
|
+
const CentralIcon = ({
|
|
37
|
+
size = CENTRAL_ICON_SIZE,
|
|
38
|
+
...props
|
|
39
|
+
}: CentralIconProps) => <Icon size={size} {...props} />
|
|
40
|
+
|
|
41
|
+
CentralIcon.displayName = Icon.displayName ?? Icon.name
|
|
42
|
+
return CentralIcon
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const IconBell = withCentralIconDefaults(IconBellBase)
|
|
46
|
+
export const IconChainLink1 = withCentralIconDefaults(IconChainLink1Base)
|
|
47
|
+
export const IconCheckmark1 = withCentralIconDefaults(IconCheckmark1Base)
|
|
48
|
+
export const IconChevronBottom = withCentralIconDefaults(IconChevronBottomBase)
|
|
49
|
+
export const IconChevronDownSmall = withCentralIconDefaults(
|
|
50
|
+
IconChevronDownSmallBase,
|
|
51
|
+
)
|
|
52
|
+
export const IconChevronRightSmall = withCentralIconDefaults(
|
|
53
|
+
IconChevronRightSmallBase,
|
|
54
|
+
)
|
|
55
|
+
export const IconClipboard = withCentralIconDefaults(IconClipboardBase)
|
|
56
|
+
export const IconCrossSmall = withCentralIconDefaults(IconCrossSmallBase)
|
|
57
|
+
export const IconHome = withCentralIconDefaults(IconHomeBase)
|
|
58
|
+
export const IconMagnifyingGlass = withCentralIconDefaults(
|
|
59
|
+
IconMagnifyingGlassBase,
|
|
60
|
+
)
|
|
61
|
+
export const IconMinus = withCentralIconDefaults(IconMinusBase)
|
|
62
|
+
export const IconMoon = withCentralIconDefaults(IconMoonBase)
|
|
63
|
+
export const IconPeople = withCentralIconDefaults(IconPeopleBase)
|
|
64
|
+
export const IconPlus = withCentralIconDefaults(IconPlusBase)
|
|
65
|
+
export const IconSettingsGear1 = withCentralIconDefaults(IconSettingsGear1Base)
|
|
66
|
+
export const IconSquareBehindSquare6 = withCentralIconDefaults(
|
|
67
|
+
IconSquareBehindSquare6Base,
|
|
68
|
+
)
|
|
69
|
+
export const IconSun = withCentralIconDefaults(IconSunBase)
|
|
70
|
+
export const IconX = withCentralIconDefaults(IconXBase)
|
|
71
|
+
|
|
72
|
+
export const iconGallery = [
|
|
73
|
+
{ name: "IconHome", Icon: IconHome },
|
|
74
|
+
{ name: "IconMagnifyingGlass", Icon: IconMagnifyingGlass },
|
|
75
|
+
{ name: "IconSettingsGear1", Icon: IconSettingsGear1 },
|
|
76
|
+
{ name: "IconBell", Icon: IconBell },
|
|
77
|
+
{ name: "IconPeople", Icon: IconPeople },
|
|
78
|
+
{ name: "IconSun", Icon: IconSun },
|
|
79
|
+
{ name: "IconMoon", Icon: IconMoon },
|
|
80
|
+
{ name: "IconPlus", Icon: IconPlus },
|
|
81
|
+
{ name: "IconMinus", Icon: IconMinus },
|
|
82
|
+
{ name: "IconCrossSmall", Icon: IconCrossSmall },
|
|
83
|
+
{ name: "IconX", Icon: IconX },
|
|
84
|
+
{ name: "IconCheckmark1", Icon: IconCheckmark1 },
|
|
85
|
+
{ name: "IconChevronBottom", Icon: IconChevronBottom },
|
|
86
|
+
{ name: "IconChevronDownSmall", Icon: IconChevronDownSmall },
|
|
87
|
+
{ name: "IconChevronRightSmall", Icon: IconChevronRightSmall },
|
|
88
|
+
{ name: "IconClipboard", Icon: IconClipboard },
|
|
89
|
+
{ name: "IconSquareBehindSquare6", Icon: IconSquareBehindSquare6 },
|
|
90
|
+
{ name: "IconChainLink1", Icon: IconChainLink1 },
|
|
91
|
+
] as const
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import type { SVGProps } from "react"
|
|
2
|
+
import { cn } from "./lib/cn"
|
|
3
|
+
|
|
4
|
+
export type IllustrationProps = SVGProps<SVGSVGElement>
|
|
5
|
+
|
|
6
|
+
const illustrationProps = {
|
|
7
|
+
viewBox: "0 0 240 160",
|
|
8
|
+
fill: "none",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
} as const
|
|
11
|
+
|
|
12
|
+
export const IllustrationEmpty = ({
|
|
13
|
+
className,
|
|
14
|
+
...props
|
|
15
|
+
}: IllustrationProps) => (
|
|
16
|
+
<svg
|
|
17
|
+
{...illustrationProps}
|
|
18
|
+
className={cn("text-fg-tertiary", className)}
|
|
19
|
+
aria-hidden
|
|
20
|
+
{...props}
|
|
21
|
+
>
|
|
22
|
+
<path
|
|
23
|
+
d="M52 65 79 40h82l27 25v55H52V65Z"
|
|
24
|
+
className="fill-background-secondary"
|
|
25
|
+
stroke="currentColor"
|
|
26
|
+
strokeWidth="2"
|
|
27
|
+
/>
|
|
28
|
+
<path
|
|
29
|
+
d="M52 65h45l8 13h30l8-13h45"
|
|
30
|
+
stroke="currentColor"
|
|
31
|
+
strokeWidth="2"
|
|
32
|
+
strokeLinejoin="round"
|
|
33
|
+
/>
|
|
34
|
+
<path
|
|
35
|
+
d="M97 31h46"
|
|
36
|
+
className="text-brand-primary"
|
|
37
|
+
stroke="currentColor"
|
|
38
|
+
strokeWidth="4"
|
|
39
|
+
strokeLinecap="round"
|
|
40
|
+
/>
|
|
41
|
+
<circle cx="120" cy="104" r="4" className="fill-brand-primary" />
|
|
42
|
+
</svg>
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
export const IllustrationError = ({
|
|
46
|
+
className,
|
|
47
|
+
...props
|
|
48
|
+
}: IllustrationProps) => (
|
|
49
|
+
<svg
|
|
50
|
+
{...illustrationProps}
|
|
51
|
+
className={cn("text-fg-tertiary", className)}
|
|
52
|
+
aria-hidden
|
|
53
|
+
{...props}
|
|
54
|
+
>
|
|
55
|
+
<rect
|
|
56
|
+
x="47"
|
|
57
|
+
y="28"
|
|
58
|
+
width="146"
|
|
59
|
+
height="104"
|
|
60
|
+
rx="16"
|
|
61
|
+
className="fill-background-secondary"
|
|
62
|
+
stroke="currentColor"
|
|
63
|
+
strokeWidth="2"
|
|
64
|
+
/>
|
|
65
|
+
<path
|
|
66
|
+
d="M47 54h146"
|
|
67
|
+
stroke="currentColor"
|
|
68
|
+
strokeWidth="2"
|
|
69
|
+
/>
|
|
70
|
+
<circle cx="63" cy="41" r="3" className="fill-brand-primary" />
|
|
71
|
+
<circle cx="74" cy="41" r="3" fill="currentColor" opacity=".45" />
|
|
72
|
+
<circle cx="85" cy="41" r="3" fill="currentColor" opacity=".25" />
|
|
73
|
+
<path
|
|
74
|
+
d="m103 78 34 34m0-34-34 34"
|
|
75
|
+
className="text-brand-primary"
|
|
76
|
+
stroke="currentColor"
|
|
77
|
+
strokeWidth="5"
|
|
78
|
+
strokeLinecap="round"
|
|
79
|
+
/>
|
|
80
|
+
</svg>
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
export const IllustrationSuccess = ({
|
|
84
|
+
className,
|
|
85
|
+
...props
|
|
86
|
+
}: IllustrationProps) => (
|
|
87
|
+
<svg
|
|
88
|
+
{...illustrationProps}
|
|
89
|
+
className={cn("text-fg-tertiary", className)}
|
|
90
|
+
aria-hidden
|
|
91
|
+
{...props}
|
|
92
|
+
>
|
|
93
|
+
<circle
|
|
94
|
+
cx="120"
|
|
95
|
+
cy="80"
|
|
96
|
+
r="53"
|
|
97
|
+
className="fill-background-secondary"
|
|
98
|
+
stroke="currentColor"
|
|
99
|
+
strokeWidth="2"
|
|
100
|
+
/>
|
|
101
|
+
<circle
|
|
102
|
+
cx="120"
|
|
103
|
+
cy="80"
|
|
104
|
+
r="37"
|
|
105
|
+
className="fill-brand-primary text-brand-primary"
|
|
106
|
+
stroke="currentColor"
|
|
107
|
+
strokeWidth="2"
|
|
108
|
+
/>
|
|
109
|
+
<path
|
|
110
|
+
d="m99 80 14 14 29-31"
|
|
111
|
+
className="text-brand-foreground"
|
|
112
|
+
stroke="currentColor"
|
|
113
|
+
strokeWidth="6"
|
|
114
|
+
strokeLinecap="round"
|
|
115
|
+
strokeLinejoin="round"
|
|
116
|
+
/>
|
|
117
|
+
<path
|
|
118
|
+
d="M63 42h13M69.5 35.5v13M168 118h13m-6.5-6.5v13"
|
|
119
|
+
className="text-brand-primary"
|
|
120
|
+
stroke="currentColor"
|
|
121
|
+
strokeWidth="3"
|
|
122
|
+
strokeLinecap="round"
|
|
123
|
+
/>
|
|
124
|
+
</svg>
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
export const IllustrationSearch = ({
|
|
128
|
+
className,
|
|
129
|
+
...props
|
|
130
|
+
}: IllustrationProps) => (
|
|
131
|
+
<svg
|
|
132
|
+
{...illustrationProps}
|
|
133
|
+
className={cn("text-fg-tertiary", className)}
|
|
134
|
+
aria-hidden
|
|
135
|
+
{...props}
|
|
136
|
+
>
|
|
137
|
+
<path
|
|
138
|
+
d="M42 38h113a12 12 0 0 1 12 12v69H42V38Z"
|
|
139
|
+
className="fill-background-secondary"
|
|
140
|
+
stroke="currentColor"
|
|
141
|
+
strokeWidth="2"
|
|
142
|
+
/>
|
|
143
|
+
<path d="M42 58h125" stroke="currentColor" strokeWidth="2" />
|
|
144
|
+
<path
|
|
145
|
+
d="M59 76h48M59 89h34M59 102h53"
|
|
146
|
+
stroke="currentColor"
|
|
147
|
+
strokeWidth="4"
|
|
148
|
+
strokeLinecap="round"
|
|
149
|
+
opacity=".5"
|
|
150
|
+
/>
|
|
151
|
+
<circle
|
|
152
|
+
cx="155"
|
|
153
|
+
cy="91"
|
|
154
|
+
r="27"
|
|
155
|
+
className="fill-surface text-brand-primary"
|
|
156
|
+
stroke="currentColor"
|
|
157
|
+
strokeWidth="5"
|
|
158
|
+
/>
|
|
159
|
+
<path
|
|
160
|
+
d="m174 111 22 22"
|
|
161
|
+
className="text-brand-primary"
|
|
162
|
+
stroke="currentColor"
|
|
163
|
+
strokeWidth="7"
|
|
164
|
+
strokeLinecap="round"
|
|
165
|
+
/>
|
|
166
|
+
</svg>
|
|
167
|
+
)
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import type { ComponentProps, ImgHTMLAttributes } from "react"
|
|
4
|
+
import { Button } from "./button"
|
|
5
|
+
import {
|
|
6
|
+
Dialog,
|
|
7
|
+
DialogBackdrop,
|
|
8
|
+
DialogClose,
|
|
9
|
+
DialogPopup,
|
|
10
|
+
DialogPortal,
|
|
11
|
+
DialogTitle,
|
|
12
|
+
DialogTrigger,
|
|
13
|
+
} from "./dialog"
|
|
14
|
+
import { cn } from "./lib/cn"
|
|
15
|
+
import { motion } from "./lib/motion"
|
|
16
|
+
|
|
17
|
+
export type ImageModalProps = ComponentProps<typeof Dialog>
|
|
18
|
+
export type ImageModalTriggerProps = ComponentProps<typeof DialogTrigger>
|
|
19
|
+
export type ImageModalContentProps = ComponentProps<typeof DialogPopup> & {
|
|
20
|
+
src: string
|
|
21
|
+
alt: string
|
|
22
|
+
caption?: string
|
|
23
|
+
imgProps?: Omit<ImgHTMLAttributes<HTMLImageElement>, "src" | "alt">
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const ImageModal = (props: ImageModalProps) => <Dialog {...props} />
|
|
27
|
+
|
|
28
|
+
export const ImageModalTrigger = ({
|
|
29
|
+
className,
|
|
30
|
+
...props
|
|
31
|
+
}: ImageModalTriggerProps) => (
|
|
32
|
+
<DialogTrigger
|
|
33
|
+
className={cn(
|
|
34
|
+
"cursor-pointer rounded-xl outline-none focus-visible:ring-[3px] focus-visible:ring-offset-1 focus-visible:ring-offset-background-primary focus-visible:ring-ring/20",
|
|
35
|
+
className,
|
|
36
|
+
)}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
export const ImageModalContent = ({
|
|
42
|
+
src,
|
|
43
|
+
alt,
|
|
44
|
+
caption,
|
|
45
|
+
className,
|
|
46
|
+
imgProps,
|
|
47
|
+
children,
|
|
48
|
+
...props
|
|
49
|
+
}: ImageModalContentProps) => (
|
|
50
|
+
<DialogPortal>
|
|
51
|
+
<DialogBackdrop className="bg-black/70 dark:bg-black/80" />
|
|
52
|
+
<DialogPopup
|
|
53
|
+
data-slot="image-modal-content"
|
|
54
|
+
className={cn(
|
|
55
|
+
"max-h-[90vh] w-full max-w-4xl gap-0 overflow-hidden border-border-primary bg-surface p-0 shadow-lg max-sm:max-w-[calc(100vw-1.5rem)]",
|
|
56
|
+
motion.popupCenter,
|
|
57
|
+
className,
|
|
58
|
+
)}
|
|
59
|
+
{...props}
|
|
60
|
+
>
|
|
61
|
+
<div className="relative">
|
|
62
|
+
<DialogTitle className="sr-only">{alt}</DialogTitle>
|
|
63
|
+
{/* eslint-disable-next-line @next/next/no-img-element */}
|
|
64
|
+
<img
|
|
65
|
+
src={src}
|
|
66
|
+
alt={alt}
|
|
67
|
+
className={cn(
|
|
68
|
+
"max-h-[min(80vh,56rem)] w-full object-contain bg-background-secondary",
|
|
69
|
+
imgProps?.className,
|
|
70
|
+
)}
|
|
71
|
+
{...imgProps}
|
|
72
|
+
/>
|
|
73
|
+
<DialogClose
|
|
74
|
+
render={
|
|
75
|
+
<Button
|
|
76
|
+
type="button"
|
|
77
|
+
variant="secondary"
|
|
78
|
+
size="sm"
|
|
79
|
+
iconOnly
|
|
80
|
+
rounded
|
|
81
|
+
aria-label="Close"
|
|
82
|
+
className="absolute top-3 right-3"
|
|
83
|
+
/>
|
|
84
|
+
}
|
|
85
|
+
>
|
|
86
|
+
<CloseIcon />
|
|
87
|
+
</DialogClose>
|
|
88
|
+
</div>
|
|
89
|
+
{caption || children ? (
|
|
90
|
+
<div className="border-t border-border-primary px-4 py-3">
|
|
91
|
+
{caption ? (
|
|
92
|
+
<p className="text-sm text-fg-secondary">{caption}</p>
|
|
93
|
+
) : null}
|
|
94
|
+
{children}
|
|
95
|
+
</div>
|
|
96
|
+
) : null}
|
|
97
|
+
</DialogPopup>
|
|
98
|
+
</DialogPortal>
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
const CloseIcon = () => (
|
|
102
|
+
<svg viewBox="0 0 24 24" fill="none" className="size-4" aria-hidden>
|
|
103
|
+
<path
|
|
104
|
+
d="M7 7l10 10M17 7 7 17"
|
|
105
|
+
stroke="currentColor"
|
|
106
|
+
strokeWidth="2"
|
|
107
|
+
strokeLinecap="round"
|
|
108
|
+
/>
|
|
109
|
+
</svg>
|
|
110
|
+
)
|