@buildcanada/components 0.3.3 → 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 (145) hide show
  1. package/dist/content/Card/Card.d.ts +62 -0
  2. package/dist/content/Card/Card.d.ts.map +1 -0
  3. package/dist/content/Card/Card.js +45 -0
  4. package/dist/content/Card/Card.scss +281 -0
  5. package/dist/content/Card/index.d.ts +3 -0
  6. package/dist/content/Card/index.d.ts.map +1 -0
  7. package/dist/content/Card/index.js +2 -0
  8. package/dist/content/Hero/Hero.d.ts +28 -0
  9. package/dist/content/Hero/Hero.d.ts.map +1 -0
  10. package/dist/content/Hero/Hero.js +16 -0
  11. package/dist/content/Hero/Hero.scss +150 -0
  12. package/dist/content/Hero/index.d.ts +3 -0
  13. package/dist/content/Hero/index.d.ts.map +1 -0
  14. package/dist/content/Hero/index.js +2 -0
  15. package/dist/content/StatBlock/StatBlock.d.ts +15 -0
  16. package/dist/content/StatBlock/StatBlock.d.ts.map +1 -0
  17. package/dist/content/StatBlock/StatBlock.js +10 -0
  18. package/dist/content/StatBlock/StatBlock.scss +83 -0
  19. package/dist/content/StatBlock/index.d.ts +3 -0
  20. package/dist/content/StatBlock/index.d.ts.map +1 -0
  21. package/dist/content/StatBlock/index.js +2 -0
  22. package/dist/feedback/Dialog/Dialog.d.ts +18 -0
  23. package/dist/feedback/Dialog/Dialog.d.ts.map +1 -0
  24. package/dist/feedback/Dialog/Dialog.js +33 -0
  25. package/dist/feedback/Dialog/Dialog.scss +158 -0
  26. package/dist/feedback/Dialog/index.d.ts +2 -0
  27. package/dist/feedback/Dialog/index.d.ts.map +1 -0
  28. package/dist/feedback/Dialog/index.js +1 -0
  29. package/dist/feedback/PopupForm/PopupForm.d.ts +24 -0
  30. package/dist/feedback/PopupForm/PopupForm.d.ts.map +1 -0
  31. package/dist/feedback/PopupForm/PopupForm.js +13 -0
  32. package/dist/feedback/PopupForm/PopupForm.scss +34 -0
  33. package/dist/feedback/PopupForm/index.d.ts +2 -0
  34. package/dist/feedback/PopupForm/index.d.ts.map +1 -0
  35. package/dist/feedback/PopupForm/index.js +1 -0
  36. package/dist/index.d.ts +21 -0
  37. package/dist/index.d.ts.map +1 -0
  38. package/dist/index.js +25 -0
  39. package/dist/layout/Container/Container.d.ts +11 -0
  40. package/dist/layout/Container/Container.d.ts.map +1 -0
  41. package/dist/layout/Container/Container.js +7 -0
  42. package/dist/layout/Container/Container.scss +40 -0
  43. package/dist/layout/Container/index.d.ts +3 -0
  44. package/dist/layout/Container/index.d.ts.map +1 -0
  45. package/dist/layout/Container/index.js +2 -0
  46. package/dist/layout/Divider/Divider.d.ts +12 -0
  47. package/dist/layout/Divider/Divider.d.ts.map +1 -0
  48. package/dist/layout/Divider/Divider.js +7 -0
  49. package/dist/layout/Divider/Divider.scss +117 -0
  50. package/dist/layout/Divider/index.d.ts +3 -0
  51. package/dist/layout/Divider/index.d.ts.map +1 -0
  52. package/dist/layout/Divider/index.js +2 -0
  53. package/dist/layout/Grid/Grid.d.ts +24 -0
  54. package/dist/layout/Grid/Grid.d.ts.map +1 -0
  55. package/dist/layout/Grid/Grid.js +11 -0
  56. package/dist/layout/Grid/Grid.scss +81 -0
  57. package/dist/layout/Grid/index.d.ts +3 -0
  58. package/dist/layout/Grid/index.d.ts.map +1 -0
  59. package/dist/layout/Grid/index.js +2 -0
  60. package/dist/layout/Section/Section.d.ts +13 -0
  61. package/dist/layout/Section/Section.d.ts.map +1 -0
  62. package/dist/layout/Section/Section.js +7 -0
  63. package/dist/layout/Section/Section.scss +74 -0
  64. package/dist/layout/Section/index.d.ts +3 -0
  65. package/dist/layout/Section/index.d.ts.map +1 -0
  66. package/dist/layout/Section/index.js +2 -0
  67. package/dist/layout/Stack/Stack.d.ts +18 -0
  68. package/dist/layout/Stack/Stack.d.ts.map +1 -0
  69. package/dist/layout/Stack/Stack.js +7 -0
  70. package/dist/layout/Stack/Stack.scss +61 -0
  71. package/dist/layout/Stack/index.d.ts +3 -0
  72. package/dist/layout/Stack/index.d.ts.map +1 -0
  73. package/dist/layout/Stack/index.js +2 -0
  74. package/dist/navigation/Footer/Footer.d.ts +31 -0
  75. package/dist/navigation/Footer/Footer.d.ts.map +1 -0
  76. package/dist/navigation/Footer/Footer.js +21 -0
  77. package/dist/navigation/Footer/Footer.scss +233 -0
  78. package/dist/navigation/Footer/index.d.ts +3 -0
  79. package/dist/navigation/Footer/index.d.ts.map +1 -0
  80. package/dist/navigation/Footer/index.js +2 -0
  81. package/dist/navigation/Header/Header.d.ts +23 -0
  82. package/dist/navigation/Header/Header.d.ts.map +1 -0
  83. package/dist/navigation/Header/Header.js +16 -0
  84. package/dist/navigation/Header/Header.scss +325 -0
  85. package/dist/navigation/Header/index.d.ts +3 -0
  86. package/dist/navigation/Header/index.d.ts.map +1 -0
  87. package/dist/navigation/Header/index.js +2 -0
  88. package/dist/primitives/Button/Button.d.ts +31 -0
  89. package/dist/primitives/Button/Button.d.ts.map +1 -0
  90. package/dist/primitives/Button/Button.js +36 -0
  91. package/dist/primitives/Button/Button.scss +218 -0
  92. package/dist/primitives/Button/index.d.ts +3 -0
  93. package/dist/primitives/Button/index.d.ts.map +1 -0
  94. package/dist/primitives/Button/index.js +2 -0
  95. package/dist/primitives/Checkbox/Checkbox.d.ts +13 -0
  96. package/dist/primitives/Checkbox/Checkbox.d.ts.map +1 -0
  97. package/dist/primitives/Checkbox/Checkbox.js +10 -0
  98. package/dist/primitives/Checkbox/Checkbox.scss +114 -0
  99. package/dist/primitives/Checkbox/index.d.ts +3 -0
  100. package/dist/primitives/Checkbox/index.d.ts.map +1 -0
  101. package/dist/primitives/Checkbox/index.js +2 -0
  102. package/dist/primitives/TextField/TextField.d.ts +22 -0
  103. package/dist/primitives/TextField/TextField.d.ts.map +1 -0
  104. package/dist/primitives/TextField/TextField.js +14 -0
  105. package/dist/primitives/TextField/TextField.scss +93 -0
  106. package/dist/primitives/TextField/index.d.ts +3 -0
  107. package/dist/primitives/TextField/index.d.ts.map +1 -0
  108. package/dist/primitives/TextField/index.js +2 -0
  109. package/dist/styles/fonts.scss +27 -0
  110. package/dist/styles/main.scss +36 -0
  111. package/dist/styles/tokens.scss +301 -0
  112. package/dist/styles/typography.scss +232 -0
  113. package/package.json +12 -11
  114. package/src/content/Card/Card.stories.tsx +389 -0
  115. package/src/content/Card/index.ts +2 -2
  116. package/src/content/Hero/Hero.stories.tsx +299 -0
  117. package/src/content/Hero/index.ts +2 -2
  118. package/src/content/StatBlock/StatBlock.stories.tsx +331 -0
  119. package/src/content/StatBlock/index.ts +2 -2
  120. package/src/feedback/Dialog/Dialog.stories.tsx +286 -0
  121. package/src/feedback/Dialog/index.ts +1 -1
  122. package/src/feedback/PopupForm/PopupForm.stories.tsx +341 -0
  123. package/src/feedback/PopupForm/PopupForm.tsx +2 -2
  124. package/src/feedback/PopupForm/index.ts +1 -1
  125. package/src/index.ts +15 -15
  126. package/src/layout/Container/Container.stories.tsx +153 -0
  127. package/src/layout/Container/index.ts +2 -2
  128. package/src/layout/Divider/Divider.stories.tsx +204 -0
  129. package/src/layout/Divider/index.ts +2 -2
  130. package/src/layout/Grid/Grid.stories.tsx +263 -0
  131. package/src/layout/Grid/index.ts +2 -2
  132. package/src/layout/Section/Section.stories.tsx +173 -0
  133. package/src/layout/Section/index.ts +2 -2
  134. package/src/layout/Stack/Stack.stories.tsx +342 -0
  135. package/src/layout/Stack/index.ts +2 -2
  136. package/src/navigation/Footer/Footer.stories.tsx +351 -0
  137. package/src/navigation/Footer/index.ts +2 -2
  138. package/src/navigation/Header/Header.stories.tsx +346 -0
  139. package/src/navigation/Header/index.ts +2 -2
  140. package/src/primitives/Button/Button.stories.tsx +300 -0
  141. package/src/primitives/Button/index.ts +2 -2
  142. package/src/primitives/Checkbox/Checkbox.stories.tsx +204 -0
  143. package/src/primitives/Checkbox/index.ts +2 -2
  144. package/src/primitives/TextField/TextField.stories.tsx +265 -0
  145. package/src/primitives/TextField/index.ts +2 -2
@@ -0,0 +1,331 @@
1
+ import type { Meta, StoryObj } from "@storybook/react"
2
+
3
+ import { StatBlock } from "./StatBlock"
4
+
5
+ const meta: Meta<typeof StatBlock> = {
6
+ title: "Components/Content/StatBlock",
7
+ component: StatBlock,
8
+ parameters: {
9
+ docs: {
10
+ description: {
11
+ component: `
12
+ A component for displaying key statistics with optional trend indicators.
13
+
14
+ ## Usage
15
+
16
+ \`\`\`tsx
17
+ import { StatBlock } from "@buildcanada/components"
18
+
19
+ <StatBlock
20
+ value="$456.2B"
21
+ label="Federal Spending"
22
+ change="+8.3%"
23
+ trend="up"
24
+ />
25
+ \`\`\`
26
+
27
+ ## With Description
28
+
29
+ \`\`\`tsx
30
+ <StatBlock
31
+ value="$1.2T"
32
+ label="Total Revenue"
33
+ description="Combined federal and provincial revenues"
34
+ change="+7.8%"
35
+ trend="up"
36
+ size="lg"
37
+ />
38
+ \`\`\`
39
+
40
+ ## Trend Indicators
41
+
42
+ - **up**: Green indicator for positive trends
43
+ - **down**: Red indicator for negative trends
44
+ - **neutral**: Gray indicator for no change
45
+ `,
46
+ },
47
+ },
48
+ },
49
+ argTypes: {
50
+ size: {
51
+ control: "select",
52
+ options: ["sm", "md", "lg"],
53
+ description: "Size of the stat display",
54
+ },
55
+ trend: {
56
+ control: "select",
57
+ options: [undefined, "up", "down", "neutral"],
58
+ description: "Trend direction for the change indicator",
59
+ },
60
+ value: { description: "The main statistic value to display" },
61
+ label: { description: "Label describing the statistic" },
62
+ description: { description: "Additional context or description" },
63
+ change: { description: "Change value (e.g., '+8.3%', '-2.1%')" },
64
+ },
65
+ }
66
+
67
+ export default meta
68
+ type Story = StoryObj<typeof StatBlock>
69
+
70
+ export const Default: Story = {
71
+ args: {
72
+ value: "$456.2B",
73
+ label: "Federal Spending",
74
+ size: "md",
75
+ },
76
+ }
77
+
78
+ export const WithDescription: Story = {
79
+ args: {
80
+ value: "$456.2B",
81
+ label: "Federal Spending",
82
+ description: "Total federal government expenditure for fiscal year 2023-24",
83
+ size: "md",
84
+ },
85
+ }
86
+
87
+ export const TrendUp: Story = {
88
+ args: {
89
+ value: "$89.5B",
90
+ label: "Healthcare Budget",
91
+ change: "+12.3%",
92
+ trend: "up",
93
+ size: "md",
94
+ },
95
+ }
96
+
97
+ export const TrendDown: Story = {
98
+ args: {
99
+ value: "2.1M",
100
+ label: "Employment",
101
+ change: "-3.4%",
102
+ trend: "down",
103
+ size: "md",
104
+ },
105
+ }
106
+
107
+ export const TrendNeutral: Story = {
108
+ args: {
109
+ value: "14",
110
+ label: "Provinces & Territories",
111
+ change: "No change",
112
+ trend: "neutral",
113
+ size: "md",
114
+ },
115
+ }
116
+
117
+ export const Small: Story = {
118
+ args: {
119
+ value: "$12.8B",
120
+ label: "Education",
121
+ change: "+5.2%",
122
+ trend: "up",
123
+ size: "sm",
124
+ },
125
+ }
126
+
127
+ export const Medium: Story = {
128
+ args: {
129
+ value: "$12.8B",
130
+ label: "Education",
131
+ change: "+5.2%",
132
+ trend: "up",
133
+ size: "md",
134
+ },
135
+ }
136
+
137
+ export const Large: Story = {
138
+ args: {
139
+ value: "$12.8B",
140
+ label: "Education",
141
+ change: "+5.2%",
142
+ trend: "up",
143
+ size: "lg",
144
+ },
145
+ }
146
+
147
+ export const PercentageValue: Story = {
148
+ args: {
149
+ value: "42.5%",
150
+ label: "Debt-to-GDP Ratio",
151
+ description: "Compared to 38.2% in the previous year",
152
+ size: "md",
153
+ },
154
+ }
155
+
156
+ export const LargeNumber: Story = {
157
+ args: {
158
+ value: "38,941,457",
159
+ label: "Population of Canada",
160
+ description: "2023 Census estimate",
161
+ size: "lg",
162
+ },
163
+ }
164
+
165
+ export const WithFullContext: Story = {
166
+ args: {
167
+ value: "$1.2T",
168
+ label: "Total Government Revenue",
169
+ description: "Combined federal, provincial, and territorial revenues",
170
+ change: "+7.8% YoY",
171
+ trend: "up",
172
+ size: "lg",
173
+ },
174
+ }
175
+
176
+ export const StatBlocksRow: Story = {
177
+ render: () => (
178
+ <div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(200px, 1fr))", gap: "24px" }}>
179
+ <StatBlock
180
+ value="$456.2B"
181
+ label="Federal Spending"
182
+ change="+8.3%"
183
+ trend="up"
184
+ size="md"
185
+ />
186
+ <StatBlock
187
+ value="$89.5B"
188
+ label="Healthcare"
189
+ change="+12.3%"
190
+ trend="up"
191
+ size="md"
192
+ />
193
+ <StatBlock
194
+ value="$45.1B"
195
+ label="Defense"
196
+ change="-2.1%"
197
+ trend="down"
198
+ size="md"
199
+ />
200
+ <StatBlock
201
+ value="$67.3B"
202
+ label="Education"
203
+ change="+5.7%"
204
+ trend="up"
205
+ size="md"
206
+ />
207
+ </div>
208
+ ),
209
+ }
210
+
211
+ export const AllSizes: Story = {
212
+ render: () => (
213
+ <div style={{ display: "flex", flexDirection: "column", gap: "32px" }}>
214
+ <div>
215
+ <p style={{ fontFamily: "sans-serif", marginBottom: "8px" }}>Small</p>
216
+ <StatBlock
217
+ value="$456.2B"
218
+ label="Federal Spending"
219
+ change="+8.3%"
220
+ trend="up"
221
+ size="sm"
222
+ />
223
+ </div>
224
+ <div>
225
+ <p style={{ fontFamily: "sans-serif", marginBottom: "8px" }}>Medium</p>
226
+ <StatBlock
227
+ value="$456.2B"
228
+ label="Federal Spending"
229
+ change="+8.3%"
230
+ trend="up"
231
+ size="md"
232
+ />
233
+ </div>
234
+ <div>
235
+ <p style={{ fontFamily: "sans-serif", marginBottom: "8px" }}>Large</p>
236
+ <StatBlock
237
+ value="$456.2B"
238
+ label="Federal Spending"
239
+ change="+8.3%"
240
+ trend="up"
241
+ size="lg"
242
+ />
243
+ </div>
244
+ </div>
245
+ ),
246
+ }
247
+
248
+ export const AllTrends: Story = {
249
+ render: () => (
250
+ <div style={{ display: "flex", flexWrap: "wrap", gap: "24px" }}>
251
+ <StatBlock
252
+ value="$89.5B"
253
+ label="Healthcare"
254
+ change="+12.3%"
255
+ trend="up"
256
+ size="md"
257
+ />
258
+ <StatBlock
259
+ value="$45.1B"
260
+ label="Defense"
261
+ change="-2.1%"
262
+ trend="down"
263
+ size="md"
264
+ />
265
+ <StatBlock
266
+ value="14"
267
+ label="Provinces"
268
+ change="No change"
269
+ trend="neutral"
270
+ size="md"
271
+ />
272
+ </div>
273
+ ),
274
+ }
275
+
276
+ export const DashboardExample: Story = {
277
+ render: () => (
278
+ <div style={{
279
+ backgroundColor: "#F6ECE3",
280
+ padding: "32px",
281
+ borderRadius: "0"
282
+ }}>
283
+ <h2 style={{
284
+ fontFamily: "sans-serif",
285
+ margin: "0 0 24px",
286
+ fontSize: "24px",
287
+ fontWeight: 500
288
+ }}>
289
+ 2024 Budget Overview
290
+ </h2>
291
+ <div style={{ display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(180px, 1fr))", gap: "16px" }}>
292
+ <div style={{ backgroundColor: "#ffffff", padding: "16px" }}>
293
+ <StatBlock
294
+ value="$496.8B"
295
+ label="Total Revenue"
296
+ change="+6.2%"
297
+ trend="up"
298
+ size="sm"
299
+ />
300
+ </div>
301
+ <div style={{ backgroundColor: "#ffffff", padding: "16px" }}>
302
+ <StatBlock
303
+ value="$537.4B"
304
+ label="Total Expenses"
305
+ change="+4.8%"
306
+ trend="up"
307
+ size="sm"
308
+ />
309
+ </div>
310
+ <div style={{ backgroundColor: "#ffffff", padding: "16px" }}>
311
+ <StatBlock
312
+ value="$40.6B"
313
+ label="Deficit"
314
+ change="-15.3%"
315
+ trend="down"
316
+ size="sm"
317
+ />
318
+ </div>
319
+ <div style={{ backgroundColor: "#ffffff", padding: "16px" }}>
320
+ <StatBlock
321
+ value="1.12T"
322
+ label="Federal Debt"
323
+ change="+3.7%"
324
+ trend="up"
325
+ size="sm"
326
+ />
327
+ </div>
328
+ </div>
329
+ </div>
330
+ ),
331
+ }
@@ -1,2 +1,2 @@
1
- export { StatBlock, type StatBlockProps, type StatBlockSize, type StatBlockTrend } from "./StatBlock"
2
- export { default } from "./StatBlock"
1
+ export { StatBlock, type StatBlockProps, type StatBlockSize, type StatBlockTrend } from "./StatBlock.js"
2
+ export { default } from "./StatBlock.js"
@@ -0,0 +1,286 @@
1
+ import { useState } from "react"
2
+ import type { Meta, StoryObj } from "@storybook/react"
3
+
4
+ import { Dialog, type DialogPosition } from "./Dialog"
5
+ import { Button } from "../../primitives/Button"
6
+
7
+ const meta: Meta<typeof Dialog> = {
8
+ title: "Components/Feedback/Dialog",
9
+ component: Dialog,
10
+ parameters: {
11
+ layout: "fullscreen",
12
+ docs: {
13
+ description: {
14
+ component: `
15
+ A non-modal floating panel that doesn't block interaction with the rest of the UI.
16
+
17
+ ## Usage
18
+
19
+ \`\`\`tsx
20
+ import { Dialog } from "@buildcanada/components"
21
+
22
+ function MyComponent() {
23
+ const [open, setOpen] = useState(false)
24
+
25
+ return (
26
+ <>
27
+ <Button text="Open Dialog" onClick={() => setOpen(true)} />
28
+ <Dialog
29
+ open={open}
30
+ onClose={() => setOpen(false)}
31
+ title="Dialog Title"
32
+ position="bottom-right"
33
+ >
34
+ <p>Dialog content goes here.</p>
35
+ </Dialog>
36
+ </>
37
+ )
38
+ }
39
+ \`\`\`
40
+
41
+ ## Key Features
42
+
43
+ - **Non-modal**: Does not block interaction with the rest of the UI
44
+ - **Content-sized**: Automatically sizes to fit its contents
45
+ - **Corner positioning**: Place in any corner or center of the screen
46
+ - **No rounded corners**: Sharp edges for a clean, modern look
47
+
48
+ ## Positions
49
+
50
+ - \`top-left\`
51
+ - \`top-right\`
52
+ - \`bottom-left\`
53
+ - \`bottom-right\` (default)
54
+ - \`center\`
55
+
56
+ ## Offset
57
+
58
+ Use the \`offset\` prop to control distance from screen edges (default: 16px).
59
+ `,
60
+ },
61
+ },
62
+ },
63
+ args: {
64
+ open: true,
65
+ title: "Dialog Title",
66
+ description: "",
67
+ position: "bottom-right",
68
+ offset: 16,
69
+ closeOnEscape: true,
70
+ showCloseButton: true,
71
+ },
72
+ argTypes: {
73
+ open: {
74
+ control: "boolean",
75
+ description: "Whether the dialog is open",
76
+ },
77
+ title: {
78
+ control: "text",
79
+ description: "Title displayed in the dialog header",
80
+ },
81
+ description: {
82
+ control: "text",
83
+ description: "Optional description below the title",
84
+ },
85
+ position: {
86
+ control: "select",
87
+ options: ["top-left", "top-right", "bottom-left", "bottom-right", "center"],
88
+ description: "Position of the dialog on screen",
89
+ },
90
+ offset: {
91
+ control: { type: "number", min: 0, max: 100 },
92
+ description: "Distance from screen edges in pixels",
93
+ },
94
+ closeOnEscape: {
95
+ control: "boolean",
96
+ description: "Whether pressing Escape closes the dialog",
97
+ },
98
+ showCloseButton: {
99
+ control: "boolean",
100
+ description: "Whether to show the close button",
101
+ },
102
+ },
103
+ decorators: [
104
+ (Story) => (
105
+ <div style={{ minHeight: "400px" }}>
106
+ <PageContent />
107
+ <Story />
108
+ </div>
109
+ ),
110
+ ],
111
+ }
112
+
113
+ export default meta
114
+ type Story = StoryObj<typeof Dialog>
115
+
116
+ // Page content to demonstrate non-blocking behavior
117
+ function PageContent() {
118
+ return (
119
+ <div style={{ padding: "24px", fontFamily: "sans-serif" }}>
120
+ <h1>Page Content</h1>
121
+ <p>This content remains interactive when the dialog is open.</p>
122
+ <p>
123
+ <button onClick={() => console.log("Button clicked!")} style={{ padding: "8px 16px" }}>
124
+ Clickable Button
125
+ </button>
126
+ </p>
127
+ <p>
128
+ <input
129
+ type="text"
130
+ placeholder="Type here while dialog is open..."
131
+ style={{ padding: "8px", width: "300px" }}
132
+ />
133
+ </p>
134
+ </div>
135
+ )
136
+ }
137
+
138
+ // Simple template that renders the dialog with args
139
+ function DialogTemplate(args: React.ComponentProps<typeof Dialog>) {
140
+ return (
141
+ <Dialog
142
+ {...args}
143
+ onClose={() => console.log("Dialog closed")}
144
+ >
145
+ <p style={{ fontFamily: "sans-serif", margin: 0, maxWidth: "280px" }}>
146
+ This dialog doesn't block interaction with the page behind it.
147
+ </p>
148
+ </Dialog>
149
+ )
150
+ }
151
+
152
+ export const Default: Story = {
153
+ render: (args) => <DialogTemplate {...args} />,
154
+ }
155
+
156
+ export const TopLeft: Story = {
157
+ args: {
158
+ position: "top-left",
159
+ title: "Top Left",
160
+ },
161
+ render: (args) => <DialogTemplate {...args} />,
162
+ }
163
+
164
+ export const TopRight: Story = {
165
+ args: {
166
+ position: "top-right",
167
+ title: "Top Right",
168
+ },
169
+ render: (args) => <DialogTemplate {...args} />,
170
+ }
171
+
172
+ export const BottomLeft: Story = {
173
+ args: {
174
+ position: "bottom-left",
175
+ title: "Bottom Left",
176
+ },
177
+ render: (args) => <DialogTemplate {...args} />,
178
+ }
179
+
180
+ export const BottomRight: Story = {
181
+ args: {
182
+ position: "bottom-right",
183
+ title: "Bottom Right",
184
+ },
185
+ render: (args) => <DialogTemplate {...args} />,
186
+ }
187
+
188
+ export const Centered: Story = {
189
+ args: {
190
+ position: "center",
191
+ title: "Centered",
192
+ },
193
+ render: (args) => <DialogTemplate {...args} />,
194
+ }
195
+
196
+ export const WithDescription: Story = {
197
+ args: {
198
+ title: "Notifications",
199
+ description: "You have 3 unread messages.",
200
+ },
201
+ render: (args) => <DialogTemplate {...args} />,
202
+ }
203
+
204
+ export const CustomOffset: Story = {
205
+ args: {
206
+ title: "Custom Offset",
207
+ offset: 48,
208
+ },
209
+ render: (args) => <DialogTemplate {...args} />,
210
+ }
211
+
212
+ export const NoCloseButton: Story = {
213
+ args: {
214
+ title: "No Close Button",
215
+ showCloseButton: false,
216
+ description: "Press Escape to close.",
217
+ },
218
+ render: (args) => <DialogTemplate {...args} />,
219
+ }
220
+
221
+ export const WideContent: Story = {
222
+ args: {
223
+ title: "Wide Content",
224
+ },
225
+ render: (args) => (
226
+ <Dialog {...args} onClose={() => console.log("Dialog closed")}>
227
+ <div style={{ fontFamily: "sans-serif", width: "400px" }}>
228
+ <p>This dialog has wider content and will size accordingly.</p>
229
+ <p>The dialog always sizes to fit its contents.</p>
230
+ </div>
231
+ </Dialog>
232
+ ),
233
+ }
234
+
235
+ export const AllPositions: Story = {
236
+ parameters: {
237
+ controls: { disable: true },
238
+ },
239
+ render: function AllPositionsDemo() {
240
+ const [openDialog, setOpenDialog] = useState<string | null>(null)
241
+
242
+ const positions = [
243
+ { key: "top-left", label: "Top Left" },
244
+ { key: "top-right", label: "Top Right" },
245
+ { key: "bottom-left", label: "Bottom Left" },
246
+ { key: "bottom-right", label: "Bottom Right" },
247
+ { key: "center", label: "Center" },
248
+ ] as const
249
+
250
+ return (
251
+ <>
252
+ <div style={{
253
+ position: "fixed",
254
+ top: "24px",
255
+ right: "24px",
256
+ display: "flex",
257
+ flexDirection: "column",
258
+ gap: "8px",
259
+ zIndex: 1
260
+ }}>
261
+ {positions.map(({ key, label }) => (
262
+ <Button
263
+ key={key}
264
+ text={label}
265
+ onClick={() => setOpenDialog(openDialog === key ? null : key)}
266
+ variant={openDialog === key ? "solid-auburn" : "outline-charcoal"}
267
+ />
268
+ ))}
269
+ </div>
270
+ {positions.map(({ key, label }) => (
271
+ <Dialog
272
+ key={key}
273
+ open={openDialog === key}
274
+ onClose={() => setOpenDialog(null)}
275
+ title={label}
276
+ position={key}
277
+ >
278
+ <p style={{ fontFamily: "sans-serif", margin: 0 }}>
279
+ Positioned: {label}
280
+ </p>
281
+ </Dialog>
282
+ ))}
283
+ </>
284
+ )
285
+ },
286
+ }
@@ -1 +1 @@
1
- export { Dialog, type DialogProps, type DialogPosition } from "./Dialog"
1
+ export { Dialog, type DialogProps, type DialogPosition } from "./Dialog.js"