@buildcanada/components 0.3.4 → 0.3.5

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.
Files changed (69) hide show
  1. package/package.json +3 -2
  2. package/src/assets/fonts/financier-text-regular.woff2 +0 -0
  3. package/src/assets/fonts/founders-grotesk-mono-regular.woff2 +0 -0
  4. package/src/assets/fonts/soehne-kraftig.woff2 +0 -0
  5. package/src/content/Card/Card.scss +281 -0
  6. package/src/content/Card/Card.stories.tsx +389 -0
  7. package/src/content/Card/Card.tsx +170 -0
  8. package/src/content/Card/index.ts +22 -0
  9. package/src/content/Hero/Hero.scss +150 -0
  10. package/src/content/Hero/Hero.stories.tsx +299 -0
  11. package/src/content/Hero/Hero.tsx +63 -0
  12. package/src/content/Hero/index.ts +13 -0
  13. package/src/content/StatBlock/StatBlock.scss +83 -0
  14. package/src/content/StatBlock/StatBlock.stories.tsx +331 -0
  15. package/src/content/StatBlock/StatBlock.tsx +52 -0
  16. package/src/content/StatBlock/index.ts +2 -0
  17. package/src/feedback/Dialog/Dialog.scss +158 -0
  18. package/src/feedback/Dialog/Dialog.stories.tsx +286 -0
  19. package/src/feedback/Dialog/Dialog.tsx +120 -0
  20. package/src/feedback/Dialog/index.ts +1 -0
  21. package/src/feedback/PopupForm/PopupForm.scss +34 -0
  22. package/src/feedback/PopupForm/PopupForm.stories.tsx +341 -0
  23. package/src/feedback/PopupForm/PopupForm.tsx +90 -0
  24. package/src/feedback/PopupForm/index.ts +1 -0
  25. package/src/index.ts +61 -0
  26. package/src/layout/Container/Container.scss +40 -0
  27. package/src/layout/Container/Container.stories.tsx +153 -0
  28. package/src/layout/Container/Container.tsx +29 -0
  29. package/src/layout/Container/index.ts +2 -0
  30. package/src/layout/Divider/Divider.scss +117 -0
  31. package/src/layout/Divider/Divider.stories.tsx +204 -0
  32. package/src/layout/Divider/Divider.tsx +32 -0
  33. package/src/layout/Divider/index.ts +2 -0
  34. package/src/layout/Grid/Grid.scss +81 -0
  35. package/src/layout/Grid/Grid.stories.tsx +263 -0
  36. package/src/layout/Grid/Grid.tsx +75 -0
  37. package/src/layout/Grid/index.ts +2 -0
  38. package/src/layout/Section/Section.scss +74 -0
  39. package/src/layout/Section/Section.stories.tsx +173 -0
  40. package/src/layout/Section/Section.tsx +37 -0
  41. package/src/layout/Section/index.ts +2 -0
  42. package/src/layout/Stack/Stack.scss +61 -0
  43. package/src/layout/Stack/Stack.stories.tsx +342 -0
  44. package/src/layout/Stack/Stack.tsx +48 -0
  45. package/src/layout/Stack/index.ts +9 -0
  46. package/src/navigation/Footer/Footer.scss +233 -0
  47. package/src/navigation/Footer/Footer.stories.tsx +351 -0
  48. package/src/navigation/Footer/Footer.tsx +174 -0
  49. package/src/navigation/Footer/index.ts +2 -0
  50. package/src/navigation/Header/Header.scss +325 -0
  51. package/src/navigation/Header/Header.stories.tsx +346 -0
  52. package/src/navigation/Header/Header.tsx +185 -0
  53. package/src/navigation/Header/index.ts +2 -0
  54. package/src/primitives/Button/Button.scss +218 -0
  55. package/src/primitives/Button/Button.stories.tsx +300 -0
  56. package/src/primitives/Button/Button.tsx +120 -0
  57. package/src/primitives/Button/index.ts +2 -0
  58. package/src/primitives/Checkbox/Checkbox.scss +114 -0
  59. package/src/primitives/Checkbox/Checkbox.stories.tsx +204 -0
  60. package/src/primitives/Checkbox/Checkbox.tsx +75 -0
  61. package/src/primitives/Checkbox/index.ts +2 -0
  62. package/src/primitives/TextField/TextField.scss +93 -0
  63. package/src/primitives/TextField/TextField.stories.tsx +265 -0
  64. package/src/primitives/TextField/TextField.tsx +105 -0
  65. package/src/primitives/TextField/index.ts +2 -0
  66. package/src/styles/fonts.scss +27 -0
  67. package/src/styles/main.scss +36 -0
  68. package/src/styles/tokens.scss +301 -0
  69. package/src/styles/typography.scss +232 -0
@@ -0,0 +1,29 @@
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
@@ -0,0 +1,2 @@
1
+ export { Container, type ContainerProps, type ContainerSize } from "./Container.js"
2
+ export { default } from "./Container.js"
@@ -0,0 +1,117 @@
1
+ @use "../../styles/tokens" as *;
2
+
3
+ /*******************************************************************************
4
+ * Divider Component
5
+ *
6
+ * Construction line motif - blueprint/draft aesthetic
7
+ ******************************************************************************/
8
+
9
+ .bc-divider {
10
+ border: none;
11
+ background-color: $border-default;
12
+
13
+ /***************************************************************************
14
+ * Orientation Variants
15
+ ***************************************************************************/
16
+
17
+ &--horizontal {
18
+ width: 100%;
19
+ height: 1px;
20
+ }
21
+
22
+ &--vertical {
23
+ width: 1px;
24
+ height: 100%;
25
+ min-height: 24px;
26
+ }
27
+
28
+ /***************************************************************************
29
+ * Style Variants
30
+ ***************************************************************************/
31
+
32
+ &--solid {
33
+ background-color: $border-default;
34
+ }
35
+
36
+ &--dashed {
37
+ background-color: transparent;
38
+
39
+ &.bc-divider--horizontal {
40
+ background-image: linear-gradient(
41
+ to right,
42
+ $border-default 50%,
43
+ transparent 50%
44
+ );
45
+ background-size: 8px 1px;
46
+ background-repeat: repeat-x;
47
+ }
48
+
49
+ &.bc-divider--vertical {
50
+ background-image: linear-gradient(
51
+ to bottom,
52
+ $border-default 50%,
53
+ transparent 50%
54
+ );
55
+ background-size: 1px 8px;
56
+ background-repeat: repeat-y;
57
+ }
58
+ }
59
+
60
+ // Construction line motif - blueprint aesthetic
61
+ &--construction {
62
+ background-color: $charcoal;
63
+ opacity: 0.15;
64
+
65
+ &.bc-divider--horizontal {
66
+ height: 1px;
67
+ }
68
+
69
+ &.bc-divider--vertical {
70
+ width: 1px;
71
+ }
72
+ }
73
+
74
+ /***************************************************************************
75
+ * Spacing Variants
76
+ ***************************************************************************/
77
+
78
+ &--spacing-none {
79
+ margin: 0;
80
+ }
81
+
82
+ &--spacing-sm {
83
+ &.bc-divider--horizontal {
84
+ margin-top: $space-2;
85
+ margin-bottom: $space-2;
86
+ }
87
+
88
+ &.bc-divider--vertical {
89
+ margin-left: $space-2;
90
+ margin-right: $space-2;
91
+ }
92
+ }
93
+
94
+ &--spacing-md {
95
+ &.bc-divider--horizontal {
96
+ margin-top: $space-4;
97
+ margin-bottom: $space-4;
98
+ }
99
+
100
+ &.bc-divider--vertical {
101
+ margin-left: $space-4;
102
+ margin-right: $space-4;
103
+ }
104
+ }
105
+
106
+ &--spacing-lg {
107
+ &.bc-divider--horizontal {
108
+ margin-top: $space-6;
109
+ margin-bottom: $space-6;
110
+ }
111
+
112
+ &.bc-divider--vertical {
113
+ margin-left: $space-6;
114
+ margin-right: $space-6;
115
+ }
116
+ }
117
+ }
@@ -0,0 +1,204 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+
3
+ import { Divider } from "./Divider"
4
+
5
+ const meta: Meta<typeof Divider> = {
6
+ title: "Components/Layout/Divider",
7
+ component: Divider,
8
+ parameters: {
9
+ docs: {
10
+ description: {
11
+ component: `
12
+ A visual separator for dividing content sections.
13
+
14
+ ## Usage
15
+
16
+ \`\`\`tsx
17
+ import { Divider } from "@buildcanada/components"
18
+
19
+ <Divider variant="solid" spacing="md" />
20
+ \`\`\`
21
+
22
+ ## Variants
23
+
24
+ - **solid**: Standard solid line
25
+ - **dashed**: Dashed line for lighter separation
26
+ - **construction**: Blueprint-style pattern (Build Canada brand)
27
+
28
+ ## Vertical Orientation
29
+
30
+ Use \`orientation="vertical"\` for horizontal layouts:
31
+
32
+ \`\`\`tsx
33
+ <div style={{ display: "flex" }}>
34
+ <div>Left</div>
35
+ <Divider orientation="vertical" />
36
+ <div>Right</div>
37
+ </div>
38
+ \`\`\`
39
+ `,
40
+ },
41
+ },
42
+ },
43
+ argTypes: {
44
+ orientation: {
45
+ control: "radio",
46
+ options: ["horizontal", "vertical"],
47
+ description: "Direction of the divider",
48
+ },
49
+ variant: {
50
+ control: "select",
51
+ options: ["solid", "dashed", "construction"],
52
+ description: "Visual style of the divider",
53
+ },
54
+ spacing: {
55
+ control: "select",
56
+ options: ["none", "sm", "md", "lg"],
57
+ description: "Margin around the divider",
58
+ },
59
+ },
60
+ }
61
+
62
+ export default meta
63
+ type Story = StoryObj<typeof Divider>
64
+
65
+ export const Default: Story = {
66
+ args: {
67
+ orientation: "horizontal",
68
+ variant: "solid",
69
+ spacing: "md",
70
+ },
71
+ }
72
+
73
+ export const Solid: Story = {
74
+ args: {
75
+ variant: "solid",
76
+ spacing: "md",
77
+ },
78
+ }
79
+
80
+ export const Dashed: Story = {
81
+ args: {
82
+ variant: "dashed",
83
+ spacing: "md",
84
+ },
85
+ }
86
+
87
+ export const Construction: Story = {
88
+ args: {
89
+ variant: "construction",
90
+ spacing: "md",
91
+ },
92
+ }
93
+
94
+ export const NoSpacing: Story = {
95
+ args: {
96
+ variant: "solid",
97
+ spacing: "none",
98
+ },
99
+ }
100
+
101
+ export const SmallSpacing: Story = {
102
+ args: {
103
+ variant: "solid",
104
+ spacing: "sm",
105
+ },
106
+ }
107
+
108
+ export const LargeSpacing: Story = {
109
+ args: {
110
+ variant: "solid",
111
+ spacing: "lg",
112
+ },
113
+ }
114
+
115
+ export const Vertical: Story = {
116
+ args: {
117
+ orientation: "vertical",
118
+ variant: "solid",
119
+ spacing: "md",
120
+ },
121
+ decorators: [
122
+ (Story) => (
123
+ <div style={{ display: "flex", height: "100px", alignItems: "stretch" }}>
124
+ <div style={{ padding: "16px", fontFamily: "sans-serif" }}>Left Content</div>
125
+ <Story />
126
+ <div style={{ padding: "16px", fontFamily: "sans-serif" }}>Right Content</div>
127
+ </div>
128
+ ),
129
+ ],
130
+ }
131
+
132
+ export const VerticalDashed: Story = {
133
+ args: {
134
+ orientation: "vertical",
135
+ variant: "dashed",
136
+ spacing: "md",
137
+ },
138
+ decorators: [
139
+ (Story) => (
140
+ <div style={{ display: "flex", height: "100px", alignItems: "stretch" }}>
141
+ <div style={{ padding: "16px", fontFamily: "sans-serif" }}>Left</div>
142
+ <Story />
143
+ <div style={{ padding: "16px", fontFamily: "sans-serif" }}>Right</div>
144
+ </div>
145
+ ),
146
+ ],
147
+ }
148
+
149
+ export const InContent: Story = {
150
+ render: () => (
151
+ <div style={{ maxWidth: "600px", fontFamily: "sans-serif" }}>
152
+ <h2 style={{ margin: "0 0 8px" }}>Section One</h2>
153
+ <p style={{ margin: "0 0 16px", lineHeight: 1.6 }}>
154
+ This is the first section of content. It contains some text that
155
+ demonstrates how dividers work to separate content.
156
+ </p>
157
+ <Divider variant="solid" spacing="md" />
158
+ <h2 style={{ margin: "0 0 8px" }}>Section Two</h2>
159
+ <p style={{ margin: "0 0 16px", lineHeight: 1.6 }}>
160
+ This is the second section. The solid divider above creates a
161
+ clear visual break between the two sections.
162
+ </p>
163
+ <Divider variant="dashed" spacing="md" />
164
+ <h2 style={{ margin: "0 0 8px" }}>Section Three</h2>
165
+ <p style={{ margin: "0", lineHeight: 1.6 }}>
166
+ The dashed divider provides a lighter separation, suggesting
167
+ related but distinct content.
168
+ </p>
169
+ </div>
170
+ ),
171
+ }
172
+
173
+ export const ConstructionStyle: Story = {
174
+ render: () => (
175
+ <div style={{ maxWidth: "600px", fontFamily: "sans-serif" }}>
176
+ <h2 style={{ margin: "0 0 16px" }}>Build Canada</h2>
177
+ <Divider variant="construction" spacing="lg" />
178
+ <p style={{ margin: 0, lineHeight: 1.6 }}>
179
+ The construction variant uses the blueprint/draft aesthetic that's
180
+ part of the Build Canada design language. It features a distinctive
181
+ pattern that references technical drawings.
182
+ </p>
183
+ </div>
184
+ ),
185
+ }
186
+
187
+ export const AllVariants: Story = {
188
+ render: () => (
189
+ <div style={{ display: "flex", flexDirection: "column", gap: "32px", fontFamily: "sans-serif" }}>
190
+ <div>
191
+ <p style={{ marginBottom: "8px" }}>Solid</p>
192
+ <Divider variant="solid" spacing="none" />
193
+ </div>
194
+ <div>
195
+ <p style={{ marginBottom: "8px" }}>Dashed</p>
196
+ <Divider variant="dashed" spacing="none" />
197
+ </div>
198
+ <div>
199
+ <p style={{ marginBottom: "8px" }}>Construction</p>
200
+ <Divider variant="construction" spacing="none" />
201
+ </div>
202
+ </div>
203
+ ),
204
+ }
@@ -0,0 +1,32 @@
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
@@ -0,0 +1,2 @@
1
+ export { Divider, type DividerProps, type DividerOrientation, type DividerVariant } from "./Divider.js"
2
+ export { default } from "./Divider.js"
@@ -0,0 +1,81 @@
1
+ @use "../../styles/tokens" as *;
2
+
3
+ /*******************************************************************************
4
+ * Grid Component
5
+ *
6
+ * Responsive CSS Grid system
7
+ ******************************************************************************/
8
+
9
+ .bc-grid {
10
+ display: grid;
11
+ width: 100%;
12
+
13
+ /***************************************************************************
14
+ * Column Variants
15
+ ***************************************************************************/
16
+
17
+ &--cols-1 { grid-template-columns: repeat(1, 1fr); }
18
+ &--cols-2 { grid-template-columns: repeat(2, 1fr); }
19
+ &--cols-3 { grid-template-columns: repeat(3, 1fr); }
20
+ &--cols-4 { grid-template-columns: repeat(4, 1fr); }
21
+ &--cols-6 { grid-template-columns: repeat(6, 1fr); }
22
+ &--cols-12 { grid-template-columns: repeat(12, 1fr); }
23
+
24
+ @include md-up {
25
+ &--cols-md-1 { grid-template-columns: repeat(1, 1fr); }
26
+ &--cols-md-2 { grid-template-columns: repeat(2, 1fr); }
27
+ &--cols-md-3 { grid-template-columns: repeat(3, 1fr); }
28
+ &--cols-md-4 { grid-template-columns: repeat(4, 1fr); }
29
+ &--cols-md-6 { grid-template-columns: repeat(6, 1fr); }
30
+ &--cols-md-12 { grid-template-columns: repeat(12, 1fr); }
31
+ }
32
+
33
+ @include lg-up {
34
+ &--cols-lg-1 { grid-template-columns: repeat(1, 1fr); }
35
+ &--cols-lg-2 { grid-template-columns: repeat(2, 1fr); }
36
+ &--cols-lg-3 { grid-template-columns: repeat(3, 1fr); }
37
+ &--cols-lg-4 { grid-template-columns: repeat(4, 1fr); }
38
+ &--cols-lg-6 { grid-template-columns: repeat(6, 1fr); }
39
+ &--cols-lg-12 { grid-template-columns: repeat(12, 1fr); }
40
+ }
41
+
42
+ /***************************************************************************
43
+ * Gap Variants
44
+ ***************************************************************************/
45
+
46
+ &--gap-none { gap: 0; }
47
+ &--gap-sm { gap: $space-2; }
48
+ &--gap-md { gap: $space-3; }
49
+ &--gap-lg { gap: $space-4; }
50
+
51
+ /***************************************************************************
52
+ * Grid Item
53
+ ***************************************************************************/
54
+
55
+ &__item {
56
+ &--span-1 { grid-column: span 1; }
57
+ &--span-2 { grid-column: span 2; }
58
+ &--span-3 { grid-column: span 3; }
59
+ &--span-4 { grid-column: span 4; }
60
+ &--span-6 { grid-column: span 6; }
61
+ &--span-12 { grid-column: span 12; }
62
+
63
+ @include md-up {
64
+ &--span-md-1 { grid-column: span 1; }
65
+ &--span-md-2 { grid-column: span 2; }
66
+ &--span-md-3 { grid-column: span 3; }
67
+ &--span-md-4 { grid-column: span 4; }
68
+ &--span-md-6 { grid-column: span 6; }
69
+ &--span-md-12 { grid-column: span 12; }
70
+ }
71
+
72
+ @include lg-up {
73
+ &--span-lg-1 { grid-column: span 1; }
74
+ &--span-lg-2 { grid-column: span 2; }
75
+ &--span-lg-3 { grid-column: span 3; }
76
+ &--span-lg-4 { grid-column: span 4; }
77
+ &--span-lg-6 { grid-column: span 6; }
78
+ &--span-lg-12 { grid-column: span 12; }
79
+ }
80
+ }
81
+ }