@buildcanada/components 0.3.2 → 0.3.4
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/dist/content/Card/Card.d.ts +62 -0
- package/dist/content/Card/Card.d.ts.map +1 -0
- package/dist/content/Card/Card.js +45 -0
- package/dist/content/Card/index.d.ts +3 -0
- package/dist/content/Card/index.d.ts.map +1 -0
- package/dist/content/Card/index.js +2 -0
- package/dist/content/Hero/Hero.d.ts +28 -0
- package/dist/content/Hero/Hero.d.ts.map +1 -0
- package/dist/content/Hero/Hero.js +16 -0
- package/dist/content/Hero/index.d.ts +3 -0
- package/dist/content/Hero/index.d.ts.map +1 -0
- package/dist/content/Hero/index.js +2 -0
- package/dist/content/StatBlock/StatBlock.d.ts +15 -0
- package/dist/content/StatBlock/StatBlock.d.ts.map +1 -0
- package/dist/content/StatBlock/StatBlock.js +10 -0
- package/dist/content/StatBlock/index.d.ts +3 -0
- package/dist/content/StatBlock/index.d.ts.map +1 -0
- package/dist/content/StatBlock/index.js +2 -0
- package/dist/feedback/Dialog/Dialog.d.ts +18 -0
- package/dist/feedback/Dialog/Dialog.d.ts.map +1 -0
- package/dist/feedback/Dialog/Dialog.js +33 -0
- package/{src/feedback/Dialog/index.ts → dist/feedback/Dialog/index.d.ts} +2 -1
- package/dist/feedback/Dialog/index.d.ts.map +1 -0
- package/dist/feedback/Dialog/index.js +1 -0
- package/dist/feedback/PopupForm/PopupForm.d.ts +24 -0
- package/dist/feedback/PopupForm/PopupForm.d.ts.map +1 -0
- package/dist/feedback/PopupForm/PopupForm.js +13 -0
- package/dist/feedback/PopupForm/index.d.ts +2 -0
- package/dist/feedback/PopupForm/index.d.ts.map +1 -0
- package/dist/feedback/PopupForm/index.js +1 -0
- package/{src/index.ts → dist/index.d.ts} +16 -56
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/layout/Container/Container.d.ts +11 -0
- package/dist/layout/Container/Container.d.ts.map +1 -0
- package/dist/layout/Container/Container.js +7 -0
- package/dist/layout/Container/index.d.ts +3 -0
- package/dist/layout/Container/index.d.ts.map +1 -0
- package/dist/layout/Container/index.js +2 -0
- package/dist/layout/Divider/Divider.d.ts +12 -0
- package/dist/layout/Divider/Divider.d.ts.map +1 -0
- package/dist/layout/Divider/Divider.js +7 -0
- package/dist/layout/Divider/index.d.ts +3 -0
- package/dist/layout/Divider/index.d.ts.map +1 -0
- package/dist/layout/Divider/index.js +2 -0
- package/dist/layout/Grid/Grid.d.ts +24 -0
- package/dist/layout/Grid/Grid.d.ts.map +1 -0
- package/dist/layout/Grid/Grid.js +11 -0
- package/dist/layout/Grid/index.d.ts +3 -0
- package/dist/layout/Grid/index.d.ts.map +1 -0
- package/dist/layout/Grid/index.js +2 -0
- package/dist/layout/Section/Section.d.ts +13 -0
- package/dist/layout/Section/Section.d.ts.map +1 -0
- package/dist/layout/Section/Section.js +7 -0
- package/dist/layout/Section/index.d.ts +3 -0
- package/dist/layout/Section/index.d.ts.map +1 -0
- package/dist/layout/Section/index.js +2 -0
- package/dist/layout/Stack/Stack.d.ts +18 -0
- package/dist/layout/Stack/Stack.d.ts.map +1 -0
- package/dist/layout/Stack/Stack.js +7 -0
- package/dist/layout/Stack/index.d.ts +3 -0
- package/dist/layout/Stack/index.d.ts.map +1 -0
- package/dist/layout/Stack/index.js +2 -0
- package/dist/navigation/Footer/Footer.d.ts +31 -0
- package/dist/navigation/Footer/Footer.d.ts.map +1 -0
- package/dist/navigation/Footer/Footer.js +21 -0
- package/dist/navigation/Footer/index.d.ts +3 -0
- package/dist/navigation/Footer/index.d.ts.map +1 -0
- package/dist/navigation/Footer/index.js +2 -0
- package/dist/navigation/Header/Header.d.ts +23 -0
- package/dist/navigation/Header/Header.d.ts.map +1 -0
- package/dist/navigation/Header/Header.js +16 -0
- package/dist/navigation/Header/index.d.ts +3 -0
- package/dist/navigation/Header/index.d.ts.map +1 -0
- package/dist/navigation/Header/index.js +2 -0
- package/dist/primitives/Button/Button.d.ts +31 -0
- package/dist/primitives/Button/Button.d.ts.map +1 -0
- package/dist/primitives/Button/Button.js +36 -0
- package/dist/primitives/Button/index.d.ts +3 -0
- package/dist/primitives/Button/index.d.ts.map +1 -0
- package/dist/primitives/Button/index.js +2 -0
- package/dist/primitives/Checkbox/Checkbox.d.ts +13 -0
- package/dist/primitives/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/primitives/Checkbox/Checkbox.js +10 -0
- package/dist/primitives/Checkbox/index.d.ts +3 -0
- package/dist/primitives/Checkbox/index.d.ts.map +1 -0
- package/dist/primitives/Checkbox/index.js +2 -0
- package/dist/primitives/TextField/TextField.d.ts +22 -0
- package/dist/primitives/TextField/TextField.d.ts.map +1 -0
- package/dist/primitives/TextField/TextField.js +14 -0
- package/dist/primitives/TextField/index.d.ts +3 -0
- package/dist/primitives/TextField/index.d.ts.map +1 -0
- package/dist/primitives/TextField/index.js +2 -0
- package/package.json +11 -11
- package/src/assets/fonts/financier-text-regular.woff2 +0 -0
- package/src/assets/fonts/founders-grotesk-mono-regular.woff2 +0 -0
- package/src/assets/fonts/soehne-kraftig.woff2 +0 -0
- package/src/content/Card/Card.tsx +0 -170
- package/src/content/Card/index.ts +0 -22
- package/src/content/Hero/Hero.tsx +0 -63
- package/src/content/Hero/index.ts +0 -13
- package/src/content/StatBlock/StatBlock.tsx +0 -52
- package/src/content/StatBlock/index.ts +0 -2
- package/src/feedback/Dialog/Dialog.tsx +0 -120
- package/src/feedback/PopupForm/PopupForm.tsx +0 -90
- package/src/feedback/PopupForm/index.ts +0 -1
- package/src/layout/Container/Container.tsx +0 -29
- package/src/layout/Container/index.ts +0 -2
- package/src/layout/Divider/Divider.tsx +0 -32
- package/src/layout/Divider/index.ts +0 -2
- package/src/layout/Grid/Grid.tsx +0 -75
- package/src/layout/Grid/index.ts +0 -2
- package/src/layout/Section/Section.tsx +0 -37
- package/src/layout/Section/index.ts +0 -2
- package/src/layout/Stack/Stack.tsx +0 -48
- package/src/layout/Stack/index.ts +0 -9
- package/src/navigation/Footer/Footer.tsx +0 -174
- package/src/navigation/Footer/index.ts +0 -2
- package/src/navigation/Header/Header.tsx +0 -185
- package/src/navigation/Header/index.ts +0 -2
- package/src/primitives/Button/Button.tsx +0 -120
- package/src/primitives/Button/index.ts +0 -2
- package/src/primitives/Checkbox/Checkbox.tsx +0 -75
- package/src/primitives/Checkbox/index.ts +0 -2
- package/src/primitives/TextField/TextField.tsx +0 -105
- package/src/primitives/TextField/index.ts +0 -2
- /package/{src → dist}/content/Card/Card.scss +0 -0
- /package/{src → dist}/content/Hero/Hero.scss +0 -0
- /package/{src → dist}/content/StatBlock/StatBlock.scss +0 -0
- /package/{src → dist}/feedback/Dialog/Dialog.scss +0 -0
- /package/{src → dist}/feedback/PopupForm/PopupForm.scss +0 -0
- /package/{src → dist}/layout/Container/Container.scss +0 -0
- /package/{src → dist}/layout/Divider/Divider.scss +0 -0
- /package/{src → dist}/layout/Grid/Grid.scss +0 -0
- /package/{src → dist}/layout/Section/Section.scss +0 -0
- /package/{src → dist}/layout/Stack/Stack.scss +0 -0
- /package/{src → dist}/navigation/Footer/Footer.scss +0 -0
- /package/{src → dist}/navigation/Header/Header.scss +0 -0
- /package/{src → dist}/primitives/Button/Button.scss +0 -0
- /package/{src → dist}/primitives/Checkbox/Checkbox.scss +0 -0
- /package/{src → dist}/primitives/TextField/TextField.scss +0 -0
- /package/{src → dist}/styles/fonts.scss +0 -0
- /package/{src → dist}/styles/main.scss +0 -0
- /package/{src → dist}/styles/tokens.scss +0 -0
- /package/{src → dist}/styles/typography.scss +0 -0
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import cx from "classnames"
|
|
2
|
-
|
|
3
|
-
export type CardVariant = "default" | "project" | "memo" | "feature" | "stat" | "profile"
|
|
4
|
-
|
|
5
|
-
export interface CardProps {
|
|
6
|
-
children: React.ReactNode
|
|
7
|
-
className?: string
|
|
8
|
-
style?: React.CSSProperties
|
|
9
|
-
variant?: CardVariant
|
|
10
|
-
href?: string
|
|
11
|
-
onClick?: () => void
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function Card({
|
|
15
|
-
children,
|
|
16
|
-
className,
|
|
17
|
-
style,
|
|
18
|
-
variant = "default",
|
|
19
|
-
href,
|
|
20
|
-
onClick,
|
|
21
|
-
}: CardProps) {
|
|
22
|
-
const isInteractive = Boolean(href || onClick)
|
|
23
|
-
const isButton = Boolean(onClick)
|
|
24
|
-
|
|
25
|
-
const classes = cx(
|
|
26
|
-
"bc-card",
|
|
27
|
-
`bc-card--${variant}`,
|
|
28
|
-
{
|
|
29
|
-
"bc-card--interactive": isInteractive,
|
|
30
|
-
"bc-card--button": isButton,
|
|
31
|
-
},
|
|
32
|
-
className
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
if (href) {
|
|
36
|
-
return (
|
|
37
|
-
<a href={href} className={classes} style={style}>
|
|
38
|
-
{children}
|
|
39
|
-
</a>
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (onClick) {
|
|
44
|
-
return (
|
|
45
|
-
<button type="button" className={classes} style={style} onClick={onClick}>
|
|
46
|
-
{children}
|
|
47
|
-
</button>
|
|
48
|
-
)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<div className={classes} style={style}>
|
|
53
|
-
{children}
|
|
54
|
-
</div>
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/*******************************************************************************
|
|
59
|
-
* Card Subcomponents
|
|
60
|
-
******************************************************************************/
|
|
61
|
-
|
|
62
|
-
export interface CardImageProps {
|
|
63
|
-
src: string
|
|
64
|
-
alt: string
|
|
65
|
-
className?: string
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export function CardImage({ src, alt, className }: CardImageProps) {
|
|
69
|
-
return (
|
|
70
|
-
<div className={cx("bc-card__image", className)}>
|
|
71
|
-
<img src={src} alt={alt} />
|
|
72
|
-
</div>
|
|
73
|
-
)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface CardIconProps {
|
|
77
|
-
children: React.ReactNode
|
|
78
|
-
className?: string
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export function CardIcon({ children, className }: CardIconProps) {
|
|
82
|
-
return <div className={cx("bc-card__icon", className)}>{children}</div>
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface CardContentProps {
|
|
86
|
-
children: React.ReactNode
|
|
87
|
-
className?: string
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export function CardContent({ children, className }: CardContentProps) {
|
|
91
|
-
return <div className={cx("bc-card__content", className)}>{children}</div>
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface CardTitleProps {
|
|
95
|
-
children: React.ReactNode
|
|
96
|
-
className?: string
|
|
97
|
-
as?: "h2" | "h3" | "h4" | "h5" | "h6"
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export function CardTitle({ children, className, as: Component = "h3" }: CardTitleProps) {
|
|
101
|
-
return <Component className={cx("bc-card__title", className)}>{children}</Component>
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface CardDescriptionProps {
|
|
105
|
-
children: React.ReactNode
|
|
106
|
-
className?: string
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export function CardDescription({ children, className }: CardDescriptionProps) {
|
|
110
|
-
return <p className={cx("bc-card__description", className)}>{children}</p>
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export interface CardMetaProps {
|
|
114
|
-
children: React.ReactNode
|
|
115
|
-
className?: string
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export function CardMeta({ children, className }: CardMetaProps) {
|
|
119
|
-
return <div className={cx("bc-card__meta", className)}>{children}</div>
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export interface CardStatProps {
|
|
123
|
-
value: string | number
|
|
124
|
-
label: string
|
|
125
|
-
change?: string
|
|
126
|
-
changeDirection?: "up" | "down" | "neutral"
|
|
127
|
-
className?: string
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export function CardStat({ value, label, change, changeDirection, className }: CardStatProps) {
|
|
131
|
-
return (
|
|
132
|
-
<div className={cx("bc-card__stat", className)}>
|
|
133
|
-
<span className="bc-card__stat-value">{value}</span>
|
|
134
|
-
<span className="bc-card__stat-label">{label}</span>
|
|
135
|
-
{change && (
|
|
136
|
-
<span
|
|
137
|
-
className={cx("bc-card__stat-change", {
|
|
138
|
-
"bc-card__stat-change--up": changeDirection === "up",
|
|
139
|
-
"bc-card__stat-change--down": changeDirection === "down",
|
|
140
|
-
})}
|
|
141
|
-
>
|
|
142
|
-
{change}
|
|
143
|
-
</span>
|
|
144
|
-
)}
|
|
145
|
-
</div>
|
|
146
|
-
)
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export interface CardAuthorProps {
|
|
150
|
-
name: string
|
|
151
|
-
role?: string
|
|
152
|
-
avatar?: string
|
|
153
|
-
className?: string
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
export function CardAuthor({ name, role, avatar, className }: CardAuthorProps) {
|
|
157
|
-
return (
|
|
158
|
-
<div className={cx("bc-card__author", className)}>
|
|
159
|
-
{avatar && (
|
|
160
|
-
<img src={avatar} alt={name} className="bc-card__author-avatar" />
|
|
161
|
-
)}
|
|
162
|
-
<div className="bc-card__author-info">
|
|
163
|
-
<span className="bc-card__author-name">{name}</span>
|
|
164
|
-
{role && <span className="bc-card__author-role">{role}</span>}
|
|
165
|
-
</div>
|
|
166
|
-
</div>
|
|
167
|
-
)
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
export default Card
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export {
|
|
2
|
-
Card,
|
|
3
|
-
CardImage,
|
|
4
|
-
CardIcon,
|
|
5
|
-
CardContent,
|
|
6
|
-
CardTitle,
|
|
7
|
-
CardDescription,
|
|
8
|
-
CardMeta,
|
|
9
|
-
CardStat,
|
|
10
|
-
CardAuthor,
|
|
11
|
-
type CardProps,
|
|
12
|
-
type CardVariant,
|
|
13
|
-
type CardImageProps,
|
|
14
|
-
type CardIconProps,
|
|
15
|
-
type CardContentProps,
|
|
16
|
-
type CardTitleProps,
|
|
17
|
-
type CardDescriptionProps,
|
|
18
|
-
type CardMetaProps,
|
|
19
|
-
type CardStatProps,
|
|
20
|
-
type CardAuthorProps,
|
|
21
|
-
} from "./Card"
|
|
22
|
-
export { default } from "./Card"
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import cx from "classnames"
|
|
2
|
-
|
|
3
|
-
export type HeroVariant = "home" | "page" | "centered"
|
|
4
|
-
export type HeroBackground = "white" | "linen" | "charcoal"
|
|
5
|
-
|
|
6
|
-
export interface HeroProps {
|
|
7
|
-
children: React.ReactNode
|
|
8
|
-
className?: string
|
|
9
|
-
style?: React.CSSProperties
|
|
10
|
-
variant?: HeroVariant
|
|
11
|
-
background?: HeroBackground
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function Hero({
|
|
15
|
-
children,
|
|
16
|
-
className,
|
|
17
|
-
style,
|
|
18
|
-
variant = "page",
|
|
19
|
-
background = "linen",
|
|
20
|
-
}: HeroProps) {
|
|
21
|
-
const classes = cx(
|
|
22
|
-
"bc-hero",
|
|
23
|
-
`bc-hero--${variant}`,
|
|
24
|
-
`bc-hero--bg-${background}`,
|
|
25
|
-
className
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<div className={classes} style={style}>
|
|
30
|
-
<div className="bc-hero__inner">{children}</div>
|
|
31
|
-
</div>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface HeroTitleProps {
|
|
36
|
-
children: React.ReactNode
|
|
37
|
-
className?: string
|
|
38
|
-
as?: "h1" | "h2"
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function HeroTitle({ children, className, as: Component = "h1" }: HeroTitleProps) {
|
|
42
|
-
return <Component className={cx("bc-hero__title", className)}>{children}</Component>
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface HeroSubtitleProps {
|
|
46
|
-
children: React.ReactNode
|
|
47
|
-
className?: string
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function HeroSubtitle({ children, className }: HeroSubtitleProps) {
|
|
51
|
-
return <p className={cx("bc-hero__subtitle", className)}>{children}</p>
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface HeroActionsProps {
|
|
55
|
-
children: React.ReactNode
|
|
56
|
-
className?: string
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function HeroActions({ children, className }: HeroActionsProps) {
|
|
60
|
-
return <div className={cx("bc-hero__actions", className)}>{children}</div>
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default Hero
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import cx from "classnames"
|
|
2
|
-
|
|
3
|
-
export type StatBlockSize = "sm" | "md" | "lg"
|
|
4
|
-
export type StatBlockTrend = "up" | "down" | "neutral"
|
|
5
|
-
|
|
6
|
-
export interface StatBlockProps {
|
|
7
|
-
value: string | number
|
|
8
|
-
label: string
|
|
9
|
-
description?: string
|
|
10
|
-
change?: string
|
|
11
|
-
trend?: StatBlockTrend
|
|
12
|
-
size?: StatBlockSize
|
|
13
|
-
className?: string
|
|
14
|
-
style?: React.CSSProperties
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function StatBlock({
|
|
18
|
-
value,
|
|
19
|
-
label,
|
|
20
|
-
description,
|
|
21
|
-
change,
|
|
22
|
-
trend,
|
|
23
|
-
size = "md",
|
|
24
|
-
className,
|
|
25
|
-
style,
|
|
26
|
-
}: StatBlockProps) {
|
|
27
|
-
const classes = cx("bc-stat-block", `bc-stat-block--${size}`, className)
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<div className={classes} style={style}>
|
|
31
|
-
<span className="bc-stat-block__value">{value}</span>
|
|
32
|
-
<span className="bc-stat-block__label">{label}</span>
|
|
33
|
-
{description && (
|
|
34
|
-
<span className="bc-stat-block__description">{description}</span>
|
|
35
|
-
)}
|
|
36
|
-
{change && (
|
|
37
|
-
<span
|
|
38
|
-
className={cx("bc-stat-block__change", {
|
|
39
|
-
"bc-stat-block__change--up": trend === "up",
|
|
40
|
-
"bc-stat-block__change--down": trend === "down",
|
|
41
|
-
})}
|
|
42
|
-
>
|
|
43
|
-
{trend === "up" && "↑ "}
|
|
44
|
-
{trend === "down" && "↓ "}
|
|
45
|
-
{change}
|
|
46
|
-
</span>
|
|
47
|
-
)}
|
|
48
|
-
</div>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export default StatBlock
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useCallback } from "react"
|
|
2
|
-
import cx from "classnames"
|
|
3
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
|
|
4
|
-
import { faXmark } from "@fortawesome/free-solid-svg-icons"
|
|
5
|
-
|
|
6
|
-
export type DialogPosition =
|
|
7
|
-
| "top-left"
|
|
8
|
-
| "top-right"
|
|
9
|
-
| "bottom-left"
|
|
10
|
-
| "bottom-right"
|
|
11
|
-
| "center"
|
|
12
|
-
|
|
13
|
-
export interface DialogProps {
|
|
14
|
-
open: boolean
|
|
15
|
-
onClose: () => void
|
|
16
|
-
children: React.ReactNode
|
|
17
|
-
title?: string
|
|
18
|
-
description?: string
|
|
19
|
-
position?: DialogPosition
|
|
20
|
-
className?: string
|
|
21
|
-
closeOnEscape?: boolean
|
|
22
|
-
showCloseButton?: boolean
|
|
23
|
-
ariaLabelledBy?: string
|
|
24
|
-
ariaDescribedBy?: string
|
|
25
|
-
offset?: number
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function Dialog({
|
|
29
|
-
open,
|
|
30
|
-
onClose,
|
|
31
|
-
children,
|
|
32
|
-
title,
|
|
33
|
-
description,
|
|
34
|
-
position = "bottom-right",
|
|
35
|
-
className,
|
|
36
|
-
closeOnEscape = true,
|
|
37
|
-
showCloseButton = true,
|
|
38
|
-
ariaLabelledBy,
|
|
39
|
-
ariaDescribedBy,
|
|
40
|
-
offset = 16,
|
|
41
|
-
}: DialogProps) {
|
|
42
|
-
const dialogRef = useRef<HTMLDivElement>(null)
|
|
43
|
-
|
|
44
|
-
const handleClose = useCallback(() => {
|
|
45
|
-
onClose()
|
|
46
|
-
}, [onClose])
|
|
47
|
-
|
|
48
|
-
// Handle escape key
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
if (!closeOnEscape || !open) return
|
|
51
|
-
|
|
52
|
-
const handleKeyDown = (e: KeyboardEvent) => {
|
|
53
|
-
if (e.key === "Escape") {
|
|
54
|
-
handleClose()
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
document.addEventListener("keydown", handleKeyDown)
|
|
59
|
-
return () => document.removeEventListener("keydown", handleKeyDown)
|
|
60
|
-
}, [closeOnEscape, open, handleClose])
|
|
61
|
-
|
|
62
|
-
if (!open) return null
|
|
63
|
-
|
|
64
|
-
const classes = cx(
|
|
65
|
-
"bc-dialog",
|
|
66
|
-
`bc-dialog--${position}`,
|
|
67
|
-
className
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
const titleId = ariaLabelledBy || (title ? "bc-dialog-title" : undefined)
|
|
71
|
-
const descriptionId = ariaDescribedBy || (description ? "bc-dialog-description" : undefined)
|
|
72
|
-
|
|
73
|
-
const style = {
|
|
74
|
-
"--bc-dialog-offset": `${offset}px`,
|
|
75
|
-
} as React.CSSProperties
|
|
76
|
-
|
|
77
|
-
return (
|
|
78
|
-
<div
|
|
79
|
-
ref={dialogRef}
|
|
80
|
-
className={classes}
|
|
81
|
-
style={style}
|
|
82
|
-
role="dialog"
|
|
83
|
-
aria-modal="false"
|
|
84
|
-
aria-labelledby={titleId}
|
|
85
|
-
aria-describedby={descriptionId}
|
|
86
|
-
>
|
|
87
|
-
<div className="bc-dialog__container">
|
|
88
|
-
{(title || showCloseButton) && (
|
|
89
|
-
<header className="bc-dialog__header">
|
|
90
|
-
{title && (
|
|
91
|
-
<h2 id={titleId} className="bc-dialog__title">
|
|
92
|
-
{title}
|
|
93
|
-
</h2>
|
|
94
|
-
)}
|
|
95
|
-
{showCloseButton && (
|
|
96
|
-
<button
|
|
97
|
-
type="button"
|
|
98
|
-
className="bc-dialog__close"
|
|
99
|
-
onClick={handleClose}
|
|
100
|
-
aria-label="Close dialog"
|
|
101
|
-
>
|
|
102
|
-
<FontAwesomeIcon icon={faXmark} />
|
|
103
|
-
</button>
|
|
104
|
-
)}
|
|
105
|
-
</header>
|
|
106
|
-
)}
|
|
107
|
-
{description && (
|
|
108
|
-
<p id={descriptionId} className="bc-dialog__description">
|
|
109
|
-
{description}
|
|
110
|
-
</p>
|
|
111
|
-
)}
|
|
112
|
-
<div className="bc-dialog__content">
|
|
113
|
-
{children}
|
|
114
|
-
</div>
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export default Dialog
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import cx from "classnames"
|
|
2
|
-
|
|
3
|
-
import { Dialog, type DialogPosition } from "../Dialog"
|
|
4
|
-
import { Button, type ButtonVariant } from "../../primitives/Button"
|
|
5
|
-
|
|
6
|
-
export interface PopupFormProps {
|
|
7
|
-
open: boolean
|
|
8
|
-
onClose: () => void
|
|
9
|
-
onSubmit: (e: React.FormEvent<HTMLFormElement>) => void
|
|
10
|
-
children: React.ReactNode
|
|
11
|
-
title?: string
|
|
12
|
-
description?: string
|
|
13
|
-
position?: DialogPosition
|
|
14
|
-
offset?: number
|
|
15
|
-
className?: string
|
|
16
|
-
submitText?: string
|
|
17
|
-
submitVariant?: ButtonVariant
|
|
18
|
-
cancelText?: string
|
|
19
|
-
cancelVariant?: ButtonVariant
|
|
20
|
-
showCancel?: boolean
|
|
21
|
-
isSubmitting?: boolean
|
|
22
|
-
submitDisabled?: boolean
|
|
23
|
-
closeOnEscape?: boolean
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function PopupForm({
|
|
27
|
-
open,
|
|
28
|
-
onClose,
|
|
29
|
-
onSubmit,
|
|
30
|
-
children,
|
|
31
|
-
title,
|
|
32
|
-
description,
|
|
33
|
-
position = "bottom-right",
|
|
34
|
-
offset,
|
|
35
|
-
className,
|
|
36
|
-
submitText = "Submit",
|
|
37
|
-
submitVariant = "solid-auburn",
|
|
38
|
-
cancelText = "Cancel",
|
|
39
|
-
cancelVariant = "outline-charcoal",
|
|
40
|
-
showCancel = true,
|
|
41
|
-
isSubmitting = false,
|
|
42
|
-
submitDisabled = false,
|
|
43
|
-
closeOnEscape = true,
|
|
44
|
-
}: PopupFormProps) {
|
|
45
|
-
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
|
|
46
|
-
e.preventDefault()
|
|
47
|
-
onSubmit(e)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const classes = cx("bc-popup-form", className)
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<Dialog
|
|
54
|
-
open={open}
|
|
55
|
-
onClose={onClose}
|
|
56
|
-
title={title}
|
|
57
|
-
description={description}
|
|
58
|
-
position={position}
|
|
59
|
-
offset={offset}
|
|
60
|
-
closeOnEscape={closeOnEscape}
|
|
61
|
-
>
|
|
62
|
-
<form onSubmit={handleSubmit} className={classes}>
|
|
63
|
-
<div className="bc-popup-form__fields">
|
|
64
|
-
{children}
|
|
65
|
-
</div>
|
|
66
|
-
<div className="bc-popup-form__actions">
|
|
67
|
-
{showCancel && (
|
|
68
|
-
<Button
|
|
69
|
-
type="button"
|
|
70
|
-
text={cancelText}
|
|
71
|
-
variant={cancelVariant}
|
|
72
|
-
onClick={onClose}
|
|
73
|
-
disabled={isSubmitting}
|
|
74
|
-
icon={null}
|
|
75
|
-
/>
|
|
76
|
-
)}
|
|
77
|
-
<Button
|
|
78
|
-
type="submit"
|
|
79
|
-
text={isSubmitting ? "Submitting..." : submitText}
|
|
80
|
-
variant={submitVariant}
|
|
81
|
-
disabled={submitDisabled || isSubmitting}
|
|
82
|
-
icon={null}
|
|
83
|
-
/>
|
|
84
|
-
</div>
|
|
85
|
-
</form>
|
|
86
|
-
</Dialog>
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export default PopupForm
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { PopupForm, type PopupFormProps } from "./PopupForm"
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import cx from "classnames"
|
|
2
|
-
|
|
3
|
-
export type ContainerSize = "sm" | "md" | "lg" | "xl" | "full"
|
|
4
|
-
|
|
5
|
-
export interface ContainerProps {
|
|
6
|
-
children: React.ReactNode
|
|
7
|
-
className?: string
|
|
8
|
-
style?: React.CSSProperties
|
|
9
|
-
size?: ContainerSize
|
|
10
|
-
as?: "div" | "main" | "article" | "section"
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function Container({
|
|
14
|
-
children,
|
|
15
|
-
className,
|
|
16
|
-
style,
|
|
17
|
-
size = "lg",
|
|
18
|
-
as: Component = "div",
|
|
19
|
-
}: ContainerProps) {
|
|
20
|
-
const classes = cx("bc-container", `bc-container--${size}`, className)
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<Component className={classes} style={style}>
|
|
24
|
-
{children}
|
|
25
|
-
</Component>
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export default Container
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import cx from "classnames"
|
|
2
|
-
|
|
3
|
-
export type DividerOrientation = "horizontal" | "vertical"
|
|
4
|
-
export type DividerVariant = "solid" | "dashed" | "construction"
|
|
5
|
-
|
|
6
|
-
export interface DividerProps {
|
|
7
|
-
className?: string
|
|
8
|
-
style?: React.CSSProperties
|
|
9
|
-
orientation?: DividerOrientation
|
|
10
|
-
variant?: DividerVariant
|
|
11
|
-
spacing?: "none" | "sm" | "md" | "lg"
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function Divider({
|
|
15
|
-
className,
|
|
16
|
-
style,
|
|
17
|
-
orientation = "horizontal",
|
|
18
|
-
variant = "solid",
|
|
19
|
-
spacing = "md",
|
|
20
|
-
}: DividerProps) {
|
|
21
|
-
const classes = cx(
|
|
22
|
-
"bc-divider",
|
|
23
|
-
`bc-divider--${orientation}`,
|
|
24
|
-
`bc-divider--${variant}`,
|
|
25
|
-
`bc-divider--spacing-${spacing}`,
|
|
26
|
-
className
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
return <hr className={classes} style={style} />
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default Divider
|
package/src/layout/Grid/Grid.tsx
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import cx from "classnames"
|
|
2
|
-
|
|
3
|
-
export type GridColumns = 1 | 2 | 3 | 4 | 6 | 12
|
|
4
|
-
export type GridGap = "none" | "sm" | "md" | "lg"
|
|
5
|
-
|
|
6
|
-
export interface GridProps {
|
|
7
|
-
children: React.ReactNode
|
|
8
|
-
className?: string
|
|
9
|
-
style?: React.CSSProperties
|
|
10
|
-
columns?: GridColumns
|
|
11
|
-
columnsMd?: GridColumns
|
|
12
|
-
columnsLg?: GridColumns
|
|
13
|
-
gap?: GridGap
|
|
14
|
-
as?: "div" | "ul" | "ol"
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function Grid({
|
|
18
|
-
children,
|
|
19
|
-
className,
|
|
20
|
-
style,
|
|
21
|
-
columns = 1,
|
|
22
|
-
columnsMd,
|
|
23
|
-
columnsLg,
|
|
24
|
-
gap = "md",
|
|
25
|
-
as: Component = "div",
|
|
26
|
-
}: GridProps) {
|
|
27
|
-
const classes = cx(
|
|
28
|
-
"bc-grid",
|
|
29
|
-
`bc-grid--cols-${columns}`,
|
|
30
|
-
`bc-grid--gap-${gap}`,
|
|
31
|
-
columnsMd && `bc-grid--cols-md-${columnsMd}`,
|
|
32
|
-
columnsLg && `bc-grid--cols-lg-${columnsLg}`,
|
|
33
|
-
className
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<Component className={classes} style={style}>
|
|
38
|
-
{children}
|
|
39
|
-
</Component>
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface GridItemProps {
|
|
44
|
-
children: React.ReactNode
|
|
45
|
-
className?: string
|
|
46
|
-
style?: React.CSSProperties
|
|
47
|
-
span?: number
|
|
48
|
-
spanMd?: number
|
|
49
|
-
spanLg?: number
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export function GridItem({
|
|
53
|
-
children,
|
|
54
|
-
className,
|
|
55
|
-
style,
|
|
56
|
-
span,
|
|
57
|
-
spanMd,
|
|
58
|
-
spanLg,
|
|
59
|
-
}: GridItemProps) {
|
|
60
|
-
const classes = cx(
|
|
61
|
-
"bc-grid__item",
|
|
62
|
-
span && `bc-grid__item--span-${span}`,
|
|
63
|
-
spanMd && `bc-grid__item--span-md-${spanMd}`,
|
|
64
|
-
spanLg && `bc-grid__item--span-lg-${spanLg}`,
|
|
65
|
-
className
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<div className={classes} style={style}>
|
|
70
|
-
{children}
|
|
71
|
-
</div>
|
|
72
|
-
)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export default Grid
|
package/src/layout/Grid/index.ts
DELETED