@fabrica_communications/design-system 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 +54 -0
- package/package.json +91 -0
- package/src/app/components/page.tsx +19 -0
- package/src/app/favicon.ico +0 -0
- package/src/app/foundations/colors/page.tsx +11 -0
- package/src/app/foundations/page.tsx +11 -0
- package/src/app/foundations/typography/page.tsx +11 -0
- package/src/app/getting-started/page.tsx +11 -0
- package/src/app/globals.css +3 -0
- package/src/app/layout.tsx +61 -0
- package/src/app/page.tsx +994 -0
- package/src/components/shared/gap.tsx +103 -0
- package/src/components/shared/page-header.tsx +11 -0
- package/src/components/shared/page-top-button.tsx +27 -0
- package/src/components/ui/accordion.tsx +66 -0
- package/src/components/ui/alert-dialog.tsx +157 -0
- package/src/components/ui/aspect-ratio.tsx +11 -0
- package/src/components/ui/badge.tsx +46 -0
- package/src/components/ui/breadcrumb.tsx +109 -0
- package/src/components/ui/button.mdx +39 -0
- package/src/components/ui/button.stories.tsx +88 -0
- package/src/components/ui/button.tsx +53 -0
- package/src/components/ui/card.tsx +92 -0
- package/src/components/ui/carousel.tsx +241 -0
- package/src/components/ui/checkbox.tsx +32 -0
- package/src/components/ui/dialog.tsx +143 -0
- package/src/components/ui/field.tsx +248 -0
- package/src/components/ui/heading.tsx +51 -0
- package/src/components/ui/icon-definitions.ts +532 -0
- package/src/components/ui/icon.tsx +115 -0
- package/src/components/ui/input-group.tsx +170 -0
- package/src/components/ui/input.tsx +21 -0
- package/src/components/ui/label.tsx +24 -0
- package/src/components/ui/native-select.tsx +48 -0
- package/src/components/ui/pagination.tsx +127 -0
- package/src/components/ui/radio-group.tsx +45 -0
- package/src/components/ui/scroll-area.tsx +58 -0
- package/src/components/ui/section-container.tsx +24 -0
- package/src/components/ui/select.tsx +187 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/skeleton.tsx +13 -0
- package/src/components/ui/sonner.tsx +40 -0
- package/src/components/ui/switch.mdx +20 -0
- package/src/components/ui/switch.stories.tsx +54 -0
- package/src/components/ui/switch.tsx +66 -0
- package/src/components/ui/table.tsx +119 -0
- package/src/components/ui/tabs.tsx +66 -0
- package/src/components/ui/text-link.tsx +72 -0
- package/src/components/ui/text.tsx +54 -0
- package/src/components/ui/textarea.tsx +18 -0
- package/src/components/ui/toggle.tsx +47 -0
- package/src/components/ui/tooltip.tsx +61 -0
- package/src/index.ts +37 -0
- package/src/lib/utils.ts +6 -0
- package/src/styles/globals.css +162 -0
- package/src/styles/variables.css +261 -0
- package/tokens/design-tokens.tokens.json +1652 -0
- package/tokens/design-tokens.tokens/344/270/213/345/261/244.json +1659 -0
- package/tokens//345/205/250/343/203/227/343/203/255/343/202/270/343/202/247/343/202/257/343/203/210/345/205/261/351/200/232_design-tokens.tokens.json +572 -0
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useMemo } from "react"
|
|
4
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
5
|
+
|
|
6
|
+
import { cn } from "../../lib/utils"
|
|
7
|
+
import { Label } from "./label"
|
|
8
|
+
import { Separator } from "./separator"
|
|
9
|
+
|
|
10
|
+
function FieldSet({ className, ...props }: React.ComponentProps<"fieldset">) {
|
|
11
|
+
return (
|
|
12
|
+
<fieldset
|
|
13
|
+
data-slot="field-set"
|
|
14
|
+
className={cn(
|
|
15
|
+
"flex flex-col gap-6",
|
|
16
|
+
"has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3",
|
|
17
|
+
className
|
|
18
|
+
)}
|
|
19
|
+
{...props}
|
|
20
|
+
/>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function FieldLegend({
|
|
25
|
+
className,
|
|
26
|
+
variant = "legend",
|
|
27
|
+
...props
|
|
28
|
+
}: React.ComponentProps<"legend"> & { variant?: "legend" | "label" }) {
|
|
29
|
+
return (
|
|
30
|
+
<legend
|
|
31
|
+
data-slot="field-legend"
|
|
32
|
+
data-variant={variant}
|
|
33
|
+
className={cn(
|
|
34
|
+
"mb-3 font-medium",
|
|
35
|
+
"data-[variant=legend]:text-base",
|
|
36
|
+
"data-[variant=label]:text-sm",
|
|
37
|
+
className
|
|
38
|
+
)}
|
|
39
|
+
{...props}
|
|
40
|
+
/>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function FieldGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
45
|
+
return (
|
|
46
|
+
<div
|
|
47
|
+
data-slot="field-group"
|
|
48
|
+
className={cn(
|
|
49
|
+
"group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",
|
|
50
|
+
className
|
|
51
|
+
)}
|
|
52
|
+
{...props}
|
|
53
|
+
/>
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const fieldVariants = cva(
|
|
58
|
+
"group/field flex w-full gap-3 data-[invalid=true]:text-destructive",
|
|
59
|
+
{
|
|
60
|
+
variants: {
|
|
61
|
+
orientation: {
|
|
62
|
+
vertical: ["flex-col [&>*]:w-full [&>.sr-only]:w-auto"],
|
|
63
|
+
horizontal: [
|
|
64
|
+
"flex-row items-center",
|
|
65
|
+
"[&>[data-slot=field-label]]:flex-auto",
|
|
66
|
+
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
67
|
+
],
|
|
68
|
+
responsive: [
|
|
69
|
+
"flex-col [&>*]:w-full [&>.sr-only]:w-auto @md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto",
|
|
70
|
+
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
71
|
+
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
defaultVariants: {
|
|
76
|
+
orientation: "vertical",
|
|
77
|
+
},
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
function Field({
|
|
82
|
+
className,
|
|
83
|
+
orientation = "vertical",
|
|
84
|
+
...props
|
|
85
|
+
}: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>) {
|
|
86
|
+
return (
|
|
87
|
+
<div
|
|
88
|
+
role="group"
|
|
89
|
+
data-slot="field"
|
|
90
|
+
data-orientation={orientation}
|
|
91
|
+
className={cn(fieldVariants({ orientation }), className)}
|
|
92
|
+
{...props}
|
|
93
|
+
/>
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function FieldContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
98
|
+
return (
|
|
99
|
+
<div
|
|
100
|
+
data-slot="field-content"
|
|
101
|
+
className={cn(
|
|
102
|
+
"group/field-content flex flex-1 flex-col gap-1.5 leading-snug",
|
|
103
|
+
className
|
|
104
|
+
)}
|
|
105
|
+
{...props}
|
|
106
|
+
/>
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function FieldLabel({
|
|
111
|
+
className,
|
|
112
|
+
...props
|
|
113
|
+
}: React.ComponentProps<typeof Label>) {
|
|
114
|
+
return (
|
|
115
|
+
<Label
|
|
116
|
+
data-slot="field-label"
|
|
117
|
+
className={cn(
|
|
118
|
+
"group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50",
|
|
119
|
+
"has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4",
|
|
120
|
+
"has-data-[state=checked]:bg-primary/5 has-data-[state=checked]:border-primary dark:has-data-[state=checked]:bg-primary/10",
|
|
121
|
+
className
|
|
122
|
+
)}
|
|
123
|
+
{...props}
|
|
124
|
+
/>
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function FieldTitle({ className, ...props }: React.ComponentProps<"div">) {
|
|
129
|
+
return (
|
|
130
|
+
<div
|
|
131
|
+
data-slot="field-label"
|
|
132
|
+
className={cn(
|
|
133
|
+
"flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50",
|
|
134
|
+
className
|
|
135
|
+
)}
|
|
136
|
+
{...props}
|
|
137
|
+
/>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function FieldDescription({ className, ...props }: React.ComponentProps<"p">) {
|
|
142
|
+
return (
|
|
143
|
+
<p
|
|
144
|
+
data-slot="field-description"
|
|
145
|
+
className={cn(
|
|
146
|
+
"text-muted-foreground text-sm leading-normal font-normal group-has-[[data-orientation=horizontal]]/field:text-balance",
|
|
147
|
+
"last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5",
|
|
148
|
+
"[&>a:hover]:text-primary [&>a]:underline [&>a]:underline-offset-4",
|
|
149
|
+
className
|
|
150
|
+
)}
|
|
151
|
+
{...props}
|
|
152
|
+
/>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function FieldSeparator({
|
|
157
|
+
children,
|
|
158
|
+
className,
|
|
159
|
+
...props
|
|
160
|
+
}: React.ComponentProps<"div"> & {
|
|
161
|
+
children?: React.ReactNode
|
|
162
|
+
}) {
|
|
163
|
+
return (
|
|
164
|
+
<div
|
|
165
|
+
data-slot="field-separator"
|
|
166
|
+
data-content={!!children}
|
|
167
|
+
className={cn(
|
|
168
|
+
"relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2",
|
|
169
|
+
className
|
|
170
|
+
)}
|
|
171
|
+
{...props}
|
|
172
|
+
>
|
|
173
|
+
<Separator className="absolute inset-0 top-1/2" />
|
|
174
|
+
{children && (
|
|
175
|
+
<span
|
|
176
|
+
className="bg-background text-muted-foreground relative mx-auto block w-fit px-2"
|
|
177
|
+
data-slot="field-separator-content"
|
|
178
|
+
>
|
|
179
|
+
{children}
|
|
180
|
+
</span>
|
|
181
|
+
)}
|
|
182
|
+
</div>
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function FieldError({
|
|
187
|
+
className,
|
|
188
|
+
children,
|
|
189
|
+
errors,
|
|
190
|
+
...props
|
|
191
|
+
}: React.ComponentProps<"div"> & {
|
|
192
|
+
errors?: Array<{ message?: string } | undefined>
|
|
193
|
+
}) {
|
|
194
|
+
const content = useMemo(() => {
|
|
195
|
+
if (children) {
|
|
196
|
+
return children
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (!errors?.length) {
|
|
200
|
+
return null
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const uniqueErrors = [
|
|
204
|
+
...new Map(errors.map((error) => [error?.message, error])).values(),
|
|
205
|
+
]
|
|
206
|
+
|
|
207
|
+
if (uniqueErrors?.length == 1) {
|
|
208
|
+
return uniqueErrors[0]?.message
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return (
|
|
212
|
+
<ul className="ml-4 flex list-disc flex-col gap-1">
|
|
213
|
+
{uniqueErrors.map(
|
|
214
|
+
(error, index) =>
|
|
215
|
+
error?.message && <li key={index}>{error.message}</li>
|
|
216
|
+
)}
|
|
217
|
+
</ul>
|
|
218
|
+
)
|
|
219
|
+
}, [children, errors])
|
|
220
|
+
|
|
221
|
+
if (!content) {
|
|
222
|
+
return null
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return (
|
|
226
|
+
<div
|
|
227
|
+
role="alert"
|
|
228
|
+
data-slot="field-error"
|
|
229
|
+
className={cn("text-destructive text-sm font-normal", className)}
|
|
230
|
+
{...props}
|
|
231
|
+
>
|
|
232
|
+
{content}
|
|
233
|
+
</div>
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export {
|
|
238
|
+
Field,
|
|
239
|
+
FieldLabel,
|
|
240
|
+
FieldDescription,
|
|
241
|
+
FieldError,
|
|
242
|
+
FieldGroup,
|
|
243
|
+
FieldLegend,
|
|
244
|
+
FieldSeparator,
|
|
245
|
+
FieldSet,
|
|
246
|
+
FieldContent,
|
|
247
|
+
FieldTitle,
|
|
248
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot"
|
|
5
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
6
|
+
|
|
7
|
+
import { cn } from "../../lib/utils"
|
|
8
|
+
|
|
9
|
+
const headingVariants = cva("font-bold", {
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
// page_title: "text-[length:var(--font-size-usage-pagetitle)] leading-[1.25]",
|
|
13
|
+
page_title: "text-[length:var(--text-5xl)] leading-[1.25]",
|
|
14
|
+
h1: "text-[length:var(--text-4xl)] leading-[1.25]",
|
|
15
|
+
h2: "text-[length:var(--text-3xl)] leading-[1.3]",
|
|
16
|
+
h3: "text-[length:var(--text-2xl)] leading-[1.35]",
|
|
17
|
+
h4: "text-[length:var(--text-xl)] leading-[1.4]",
|
|
18
|
+
h5: "text-[length:var(--text-base)] leading-[1.45]",
|
|
19
|
+
h6: "text-[length:var(--text-xs)] leading-[1.5] uppercase tracking-wide",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
variant: "h2",
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
interface HeadingProps
|
|
28
|
+
extends React.ComponentProps<"h2">,
|
|
29
|
+
VariantProps<typeof headingVariants> {
|
|
30
|
+
asChild?: boolean
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function Heading({
|
|
34
|
+
className,
|
|
35
|
+
variant = "h2",
|
|
36
|
+
asChild = false,
|
|
37
|
+
...props
|
|
38
|
+
}: HeadingProps) {
|
|
39
|
+
const Comp = asChild ? Slot : "h2"
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<Comp
|
|
43
|
+
data-slot="heading"
|
|
44
|
+
className={cn(headingVariants({ variant }), className)}
|
|
45
|
+
{...props}
|
|
46
|
+
/>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { Heading, headingVariants }
|
|
51
|
+
|