braid-ui 1.0.99 → 1.0.101

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/README.md +327 -44
  2. package/dist/css/braid-ui-variables.css +88 -0
  3. package/dist/css/braid-ui.css +4702 -0
  4. package/dist/css/braid-ui.min.css +1 -0
  5. package/dist/index.cjs +4 -0
  6. package/dist/index.cjs.map +1 -0
  7. package/dist/index.d.cts +2027 -0
  8. package/dist/index.d.ts +2027 -0
  9. package/dist/index.js +4 -0
  10. package/dist/index.js.map +1 -0
  11. package/package.json +115 -55
  12. package/src/styles-only.css +121 -0
  13. package/src/{index.css → styles.css} +4 -10
  14. package/components.json +0 -20
  15. package/eslint.config.js +0 -29
  16. package/index.html +0 -24
  17. package/postcss.config.js +0 -6
  18. package/public/favicon.ico +0 -0
  19. package/public/placeholder.svg +0 -1
  20. package/public/robots.txt +0 -14
  21. package/src/App.css +0 -42
  22. package/src/App.tsx +0 -94
  23. package/src/components/MainLayout.tsx +0 -15
  24. package/src/components/alerts/AlertDocuments.tsx +0 -320
  25. package/src/components/alerts/AlertNotes.tsx +0 -185
  26. package/src/components/alerts/AlertTimeline.tsx +0 -79
  27. package/src/components/alerts/ContextSection.tsx +0 -155
  28. package/src/components/app-sidebar.tsx +0 -341
  29. package/src/components/form-sections/ACHBankCard.tsx +0 -78
  30. package/src/components/form-sections/ACHBasicInfoCard.tsx +0 -100
  31. package/src/components/form-sections/ACHTransferSection.tsx +0 -64
  32. package/src/components/form-sections/AddressForm.tsx +0 -94
  33. package/src/components/form-sections/BankAddressCard.tsx +0 -95
  34. package/src/components/form-sections/BankingDetailsCard.tsx +0 -46
  35. package/src/components/form-sections/BasicInfoCard.tsx +0 -103
  36. package/src/components/form-sections/BasicInfoSection.tsx +0 -34
  37. package/src/components/form-sections/BeneficiaryAddress.tsx +0 -19
  38. package/src/components/form-sections/BeneficiaryCard.tsx +0 -41
  39. package/src/components/form-sections/BeneficiaryDomesticWire.tsx +0 -23
  40. package/src/components/form-sections/BusinessProfileCard.tsx +0 -131
  41. package/src/components/form-sections/BusinessStatusCard.tsx +0 -53
  42. package/src/components/form-sections/ContactInfoCard.tsx +0 -63
  43. package/src/components/form-sections/CounterpartyBasicInfo.tsx +0 -101
  44. package/src/components/form-sections/CounterpartyProfileCard.tsx +0 -104
  45. package/src/components/form-sections/CounterpartyRecordsCard.tsx +0 -41
  46. package/src/components/form-sections/IntermediaryCard.tsx +0 -77
  47. package/src/components/form-sections/IntermediaryFI.tsx +0 -41
  48. package/src/components/form-sections/IntermediaryFIAddress.tsx +0 -14
  49. package/src/components/form-sections/OriginatorCard.tsx +0 -49
  50. package/src/components/form-sections/OriginatorFI.tsx +0 -42
  51. package/src/components/form-sections/OriginatorFIAddress.tsx +0 -14
  52. package/src/components/form-sections/PaymentInformationSection.tsx +0 -163
  53. package/src/components/form-sections/ReceiverCard.tsx +0 -94
  54. package/src/components/form-sections/WireTransferSection.tsx +0 -75
  55. package/src/components/layouts/list-page.tsx +0 -103
  56. package/src/components/transaction/ACHDetailsSection.tsx +0 -95
  57. package/src/components/transaction/WireDetailsSection.tsx +0 -112
  58. package/src/components/ui/account-card.tsx +0 -94
  59. package/src/components/ui/badge.tsx +0 -75
  60. package/src/components/ui/breadcrumb.tsx +0 -78
  61. package/src/components/ui/business-type-badge.tsx +0 -42
  62. package/src/components/ui/button.tsx +0 -56
  63. package/src/components/ui/calendar.tsx +0 -49
  64. package/src/components/ui/card.tsx +0 -223
  65. package/src/components/ui/container.tsx +0 -45
  66. package/src/components/ui/counterparty-type-badge.tsx +0 -53
  67. package/src/components/ui/data-grid.tsx +0 -99
  68. package/src/components/ui/data-table.tsx +0 -152
  69. package/src/components/ui/detail-page-layout.tsx +0 -83
  70. package/src/components/ui/dialog.tsx +0 -120
  71. package/src/components/ui/dropdown-menu.tsx +0 -82
  72. package/src/components/ui/editable-form-card.tsx +0 -106
  73. package/src/components/ui/editable-info-field.tsx +0 -67
  74. package/src/components/ui/enhanced-input.tsx +0 -78
  75. package/src/components/ui/enhanced-select.tsx +0 -101
  76. package/src/components/ui/enhanced-textarea.tsx +0 -64
  77. package/src/components/ui/entity-card.tsx +0 -140
  78. package/src/components/ui/form-card.tsx +0 -40
  79. package/src/components/ui/form-field.tsx +0 -50
  80. package/src/components/ui/form-input.tsx +0 -29
  81. package/src/components/ui/form-provider.tsx +0 -18
  82. package/src/components/ui/form-section.tsx +0 -66
  83. package/src/components/ui/form-select.tsx +0 -35
  84. package/src/components/ui/info-field.tsx +0 -36
  85. package/src/components/ui/json-viewer.tsx +0 -146
  86. package/src/components/ui/label.tsx +0 -24
  87. package/src/components/ui/metric-card.tsx +0 -80
  88. package/src/components/ui/page-layout.tsx +0 -183
  89. package/src/components/ui/popover.tsx +0 -29
  90. package/src/components/ui/responsive-grid.tsx +0 -46
  91. package/src/components/ui/separator.tsx +0 -31
  92. package/src/components/ui/sheet.tsx +0 -140
  93. package/src/components/ui/sidebar.tsx +0 -775
  94. package/src/components/ui/sonner.tsx +0 -29
  95. package/src/components/ui/stack.tsx +0 -77
  96. package/src/components/ui/status-badge.tsx +0 -68
  97. package/src/components/ui/tabs.tsx +0 -52
  98. package/src/components/ui/toast.tsx +0 -127
  99. package/src/components/ui/toaster.tsx +0 -33
  100. package/src/components/ui/tooltip.tsx +0 -28
  101. package/src/components/ui/use-toast.ts +0 -3
  102. package/src/components/ui-kit/dashboard-demo.tsx +0 -156
  103. package/src/components/ui-kit/pattern-library.tsx +0 -248
  104. package/src/components/ui-kit/showcase.tsx +0 -211
  105. package/src/hooks/use-mobile.tsx +0 -19
  106. package/src/hooks/use-toast.ts +0 -191
  107. package/src/hooks/useEditState.ts +0 -70
  108. package/src/hooks/useFormWithEditState.ts +0 -115
  109. package/src/lib/constants.ts +0 -25
  110. package/src/lib/mock-data/alert-data.ts +0 -275
  111. package/src/lib/mock-data/banking-data.ts +0 -72
  112. package/src/lib/mock-data/business-data.ts +0 -71
  113. package/src/lib/mock-data/counterparty-data.ts +0 -70
  114. package/src/lib/mock-data/index.ts +0 -5
  115. package/src/lib/mock-data/transaction-data.ts +0 -283
  116. package/src/lib/mock-data/wire-data.ts +0 -103
  117. package/src/lib/mock-data.tsx +0 -180
  118. package/src/lib/schemas/banking-schemas.ts +0 -30
  119. package/src/lib/schemas/business-schemas.ts +0 -36
  120. package/src/lib/schemas/counterparty-schemas.ts +0 -43
  121. package/src/lib/schemas/index.ts +0 -5
  122. package/src/lib/schemas/wire-schemas.ts +0 -44
  123. package/src/lib/utils.ts +0 -6
  124. package/src/main.tsx +0 -10
  125. package/src/pages/Cases.tsx +0 -16
  126. package/src/pages/Dashboard.tsx +0 -16
  127. package/src/pages/NotFound.tsx +0 -27
  128. package/src/pages/TransactionHistory.tsx +0 -532
  129. package/src/pages/UIKit.tsx +0 -51
  130. package/src/pages/alerts/AlertDetail.tsx +0 -193
  131. package/src/pages/alerts/Alerts.tsx +0 -373
  132. package/src/pages/business/Business.tsx +0 -48
  133. package/src/pages/business/Create.tsx +0 -173
  134. package/src/pages/counterparty/Create.tsx +0 -48
  135. package/src/pages/counterparty/DomesticWire.tsx +0 -78
  136. package/src/pages/counterparty/Manage.tsx +0 -79
  137. package/src/pages/transactions/NewTransaction.tsx +0 -527
  138. package/src/pages/transactions/TransactionDetail.tsx +0 -192
  139. package/src/vite-env.d.ts +0 -1
  140. package/tailwind.config.ts +0 -124
  141. package/tsconfig.app.json +0 -30
  142. package/tsconfig.json +0 -19
  143. package/tsconfig.node.json +0 -22
  144. package/vite.config.ts +0 -22
  145. /package/{src/assets/braid-logo.png → dist/braid-logo-343BOQZ2.png} +0 -0
@@ -1,248 +0,0 @@
1
- import * as React from "react"
2
- import { Container } from "@/components/ui/container"
3
- import { Stack } from "@/components/ui/stack"
4
- import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
5
- import { Badge } from "@/components/ui/badge"
6
- import { Button } from "@/components/ui/button"
7
- import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"
8
- import { ResponsiveGrid } from "@/components/ui/responsive-grid"
9
- import { Copy, Check } from "lucide-react"
10
-
11
- const colorPalette = {
12
- primary: {
13
- name: "Primary",
14
- colors: [
15
- { name: "primary", value: "hsl(204 100% 54%)", class: "bg-primary" },
16
- { name: "primary-foreground", value: "hsl(0 0% 100%)", class: "bg-primary-foreground" },
17
- { name: "primary-glow", value: "hsl(204 100% 64%)", class: "bg-primary-glow" }
18
- ]
19
- },
20
- neutral: {
21
- name: "Neutral",
22
- colors: [
23
- { name: "background", value: "hsl(240 10% 98%)", class: "bg-background" },
24
- { name: "foreground", value: "hsl(240 10% 8%)", class: "bg-foreground" },
25
- { name: "muted", value: "hsl(240 5% 96%)", class: "bg-muted" },
26
- { name: "muted-foreground", value: "hsl(240 4% 46%)", class: "bg-muted-foreground" }
27
- ]
28
- },
29
- semantic: {
30
- name: "Semantic",
31
- colors: [
32
- { name: "success", value: "hsl(142 76% 36%)", class: "bg-success" },
33
- { name: "warning", value: "hsl(38 92% 50%)", class: "bg-warning" },
34
- { name: "destructive", value: "hsl(0 84% 60%)", class: "bg-destructive" }
35
- ]
36
- }
37
- }
38
-
39
- const typography = [
40
- { name: "Heading 1", class: "text-3xl font-bold", example: "The quick brown fox" },
41
- { name: "Heading 2", class: "text-2xl font-semibold", example: "The quick brown fox" },
42
- { name: "Heading 3", class: "text-xl font-medium", example: "The quick brown fox" },
43
- { name: "Body Large", class: "text-lg", example: "The quick brown fox jumps over the lazy dog" },
44
- { name: "Body", class: "text-base", example: "The quick brown fox jumps over the lazy dog" },
45
- { name: "Body Small", class: "text-sm", example: "The quick brown fox jumps over the lazy dog" },
46
- { name: "Caption", class: "text-xs text-muted-foreground", example: "The quick brown fox jumps over the lazy dog" }
47
- ]
48
-
49
- const spacing = [
50
- { name: "None", class: "space-y-0", value: "0" },
51
- { name: "XS", class: "space-y-1", value: "0.25rem" },
52
- { name: "SM", class: "space-y-2", value: "0.5rem" },
53
- { name: "MD", class: "space-y-4", value: "1rem" },
54
- { name: "LG", class: "space-y-6", value: "1.5rem" },
55
- { name: "XL", class: "space-y-8", value: "2rem" }
56
- ]
57
-
58
- const badgeVariants = [
59
- "default", "secondary", "destructive", "outline", "success", "warning",
60
- "business", "individual", "active", "inactive", "pending", "suspended"
61
- ]
62
-
63
- function ColorSwatch({ color }: { color: { name: string; value: string; class: string } }) {
64
- const [copied, setCopied] = React.useState(false)
65
-
66
- const copyToClipboard = () => {
67
- navigator.clipboard.writeText(color.value)
68
- setCopied(true)
69
- setTimeout(() => setCopied(false), 2000)
70
- }
71
-
72
- return (
73
- <div className="group cursor-pointer" onClick={copyToClipboard}>
74
- <div className={`h-16 w-full rounded-lg ${color.class} mb-2 group-hover:scale-105 transition-transform`} />
75
- <div className="text-xs">
76
- <div className="font-medium text-foreground">{color.name}</div>
77
- <div className="text-muted-foreground flex items-center gap-1">
78
- {color.value}
79
- {copied ? <Check className="w-3 h-3 text-success" /> : <Copy className="w-3 h-3 opacity-0 group-hover:opacity-100" />}
80
- </div>
81
- </div>
82
- </div>
83
- )
84
- }
85
-
86
- export function PatternLibrary() {
87
- return (
88
- <Container size="xl">
89
- <Stack spacing="lg">
90
- <div>
91
- <h1 className="text-3xl font-bold text-foreground">Pattern Library</h1>
92
- <p className="text-muted-foreground mt-2">
93
- Design system tokens, components, and usage guidelines
94
- </p>
95
- </div>
96
-
97
- <Tabs defaultValue="colors" className="w-full">
98
- <TabsList className="grid w-full grid-cols-4">
99
- <TabsTrigger value="colors">Colors</TabsTrigger>
100
- <TabsTrigger value="typography">Typography</TabsTrigger>
101
- <TabsTrigger value="spacing">Spacing</TabsTrigger>
102
- <TabsTrigger value="components">Components</TabsTrigger>
103
- </TabsList>
104
-
105
- <TabsContent value="colors" className="mt-6">
106
- <Stack spacing="lg">
107
- {Object.entries(colorPalette).map(([key, palette]) => (
108
- <Card key={key}>
109
- <CardHeader>
110
- <CardTitle>{palette.name}</CardTitle>
111
- </CardHeader>
112
- <CardContent>
113
- <div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-4">
114
- {palette.colors.map((color) => (
115
- <ColorSwatch key={color.name} color={color} />
116
- ))}
117
- </div>
118
- </CardContent>
119
- </Card>
120
- ))}
121
- </Stack>
122
- </TabsContent>
123
-
124
- <TabsContent value="typography" className="mt-6">
125
- <Card>
126
- <CardHeader>
127
- <CardTitle>Typography Scale</CardTitle>
128
- </CardHeader>
129
- <CardContent>
130
- <Stack spacing="lg">
131
- {typography.map((type) => (
132
- <div key={type.name} className="grid grid-cols-1 md:grid-cols-4 gap-4 items-center">
133
- <div className="text-sm font-medium text-muted-foreground">
134
- {type.name}
135
- </div>
136
- <div className="md:col-span-2">
137
- <div className={type.class}>{type.example}</div>
138
- </div>
139
- <div className="text-xs text-muted-foreground font-mono">
140
- {type.class}
141
- </div>
142
- </div>
143
- ))}
144
- </Stack>
145
- </CardContent>
146
- </Card>
147
- </TabsContent>
148
-
149
- <TabsContent value="spacing" className="mt-6">
150
- <Card>
151
- <CardHeader>
152
- <CardTitle>Spacing System</CardTitle>
153
- </CardHeader>
154
- <CardContent>
155
- <Stack spacing="lg">
156
- {spacing.map((space) => (
157
- <div key={space.name} className="grid grid-cols-1 md:grid-cols-4 gap-4 items-center">
158
- <div className="text-sm font-medium text-muted-foreground">
159
- {space.name}
160
- </div>
161
- <div className="md:col-span-2">
162
- <div className={space.class}>
163
- <div className="bg-primary/20 p-2 rounded">Item 1</div>
164
- <div className="bg-primary/20 p-2 rounded">Item 2</div>
165
- </div>
166
- </div>
167
- <div className="text-xs text-muted-foreground font-mono">
168
- {space.value} ({space.class})
169
- </div>
170
- </div>
171
- ))}
172
- </Stack>
173
- </CardContent>
174
- </Card>
175
- </TabsContent>
176
-
177
- <TabsContent value="components" className="mt-6">
178
- <Stack spacing="lg">
179
- {/* Badges */}
180
- <Card>
181
- <CardHeader>
182
- <CardTitle>Badge Variants</CardTitle>
183
- </CardHeader>
184
- <CardContent>
185
- <div className="flex flex-wrap gap-2">
186
- {badgeVariants.map((variant) => (
187
- <Badge key={variant} variant={variant as any}>
188
- {variant}
189
- </Badge>
190
- ))}
191
- </div>
192
- </CardContent>
193
- </Card>
194
-
195
- {/* Buttons */}
196
- <Card>
197
- <CardHeader>
198
- <CardTitle>Button Variants</CardTitle>
199
- </CardHeader>
200
- <CardContent>
201
- <Stack direction="horizontal" spacing="sm" className="flex-wrap">
202
- <Button variant="default">Default</Button>
203
- <Button variant="secondary">Secondary</Button>
204
- <Button variant="outline">Outline</Button>
205
- <Button variant="ghost">Ghost</Button>
206
- <Button variant="link">Link</Button>
207
- <Button variant="destructive">Destructive</Button>
208
- </Stack>
209
- </CardContent>
210
- </Card>
211
-
212
- {/* Grid Examples */}
213
- <Card>
214
- <CardHeader>
215
- <CardTitle>Grid Layouts</CardTitle>
216
- </CardHeader>
217
- <CardContent>
218
- <Stack spacing="md">
219
- <div>
220
- <h4 className="text-sm font-medium mb-2">Cards Grid</h4>
221
- <ResponsiveGrid type="cards" gap="sm">
222
- {[1, 2, 3, 4, 5, 6].map((i) => (
223
- <div key={i} className="bg-muted rounded p-4 text-center text-sm">
224
- Card {i}
225
- </div>
226
- ))}
227
- </ResponsiveGrid>
228
- </div>
229
- <div>
230
- <h4 className="text-sm font-medium mb-2">Forms Grid</h4>
231
- <ResponsiveGrid type="forms" gap="md">
232
- {[1, 2, 3, 4].map((i) => (
233
- <div key={i} className="bg-muted rounded p-4 text-center text-sm">
234
- Form Section {i}
235
- </div>
236
- ))}
237
- </ResponsiveGrid>
238
- </div>
239
- </Stack>
240
- </CardContent>
241
- </Card>
242
- </Stack>
243
- </TabsContent>
244
- </Tabs>
245
- </Stack>
246
- </Container>
247
- )
248
- }
@@ -1,211 +0,0 @@
1
- import * as React from "react"
2
- import { Container } from "@/components/ui/container"
3
- import { Stack } from "@/components/ui/stack"
4
- import { MetricCard } from "@/components/ui/metric-card"
5
- import { DataTable, type DataTableColumn } from "@/components/ui/data-table"
6
- import { AccountCard } from "@/components/ui/account-card"
7
- import { EntityCard } from "@/components/ui/entity-card"
8
- import { FormField } from "@/components/ui/form-field"
9
- import { Breadcrumb } from "@/components/ui/breadcrumb"
10
- import { ResponsiveGrid } from "@/components/ui/responsive-grid"
11
- import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"
12
- import { Button } from "@/components/ui/button"
13
- import { EnhancedInput } from "@/components/ui/enhanced-input"
14
- import { EnhancedSelect } from "@/components/ui/enhanced-select"
15
- import { mockCounterparties, mockAccounts, mockMetrics, mockTableData } from "@/lib/mock-data"
16
- import { Building, Users, Plus, Download } from "lucide-react"
17
-
18
- const tableColumns: DataTableColumn[] = [
19
- { key: "name", title: "Name", sortable: true },
20
- { key: "type", title: "Type", sortable: true },
21
- { key: "status", title: "Status", sortable: true },
22
- { key: "amount", title: "Amount", sortable: true, align: "right" },
23
- { key: "date", title: "Date", sortable: true },
24
- { key: "verified", title: "Verified", sortable: true }
25
- ]
26
-
27
- export function UIKitShowcase() {
28
- const [sortBy, setSortBy] = React.useState<string>()
29
- const [sortDirection, setSortDirection] = React.useState<"asc" | "desc">("asc")
30
-
31
- const handleSort = (key: string) => {
32
- if (sortBy === key) {
33
- setSortDirection(sortDirection === "asc" ? "desc" : "asc")
34
- } else {
35
- setSortBy(key)
36
- setSortDirection("asc")
37
- }
38
- }
39
-
40
- const breadcrumbs = [
41
- { label: "UI Kit", href: "/ui-kit" },
42
- { label: "Showcase" }
43
- ]
44
-
45
- return (
46
- <div className="min-h-screen bg-gradient-subtle">
47
- <Container size="xl">
48
- <Stack spacing="lg">
49
- {/* Breadcrumbs */}
50
- <Breadcrumb items={breadcrumbs} />
51
-
52
- {/* Page Header */}
53
- <div className="flex items-start justify-between">
54
- <Stack spacing="sm">
55
- <h1 className="text-3xl font-bold text-foreground">UI Kit Showcase</h1>
56
- <p className="text-muted-foreground max-w-2xl">
57
- Complete collection of reusable components, layouts, and patterns for building financial applications.
58
- </p>
59
- </Stack>
60
-
61
- <Stack direction="horizontal" spacing="sm">
62
- <Button variant="outline">
63
- <Download className="w-4 h-4" />
64
- Export Kit
65
- </Button>
66
- <Button>
67
- <Plus className="w-4 h-4" />
68
- Create Component
69
- </Button>
70
- </Stack>
71
- </div>
72
-
73
- {/* Metrics Section */}
74
- <Card>
75
- <CardHeader>
76
- <CardTitle>Metric Cards</CardTitle>
77
- </CardHeader>
78
- <CardContent>
79
- <ResponsiveGrid type="cards" gap="md">
80
- {mockMetrics.map((metric, index) => (
81
- <MetricCard key={index} {...metric} />
82
- ))}
83
- </ResponsiveGrid>
84
- </CardContent>
85
- </Card>
86
-
87
- {/* Form Components */}
88
- <Card>
89
- <CardHeader>
90
- <CardTitle>Form Components</CardTitle>
91
- </CardHeader>
92
- <CardContent>
93
- <Stack spacing="md">
94
- <FormField
95
- label="Enhanced Input"
96
- description="Input field with validation and enhanced styling"
97
- required
98
- >
99
- <EnhancedInput
100
- placeholder="Enter your name"
101
- error="This field is required"
102
- />
103
- </FormField>
104
-
105
- <FormField
106
- label="Enhanced Select"
107
- description="Select dropdown with search and validation"
108
- layout="horizontal"
109
- >
110
- <EnhancedSelect
111
- placeholder="Choose an option"
112
- options={[
113
- { value: "option1", label: "Option 1" },
114
- { value: "option2", label: "Option 2" },
115
- { value: "option3", label: "Option 3" }
116
- ]}
117
- />
118
- </FormField>
119
- </Stack>
120
- </CardContent>
121
- </Card>
122
-
123
- {/* Account Cards */}
124
- <Card>
125
- <CardHeader>
126
- <CardTitle>Account Cards</CardTitle>
127
- </CardHeader>
128
- <CardContent>
129
- <ResponsiveGrid type="cards" gap="md">
130
- {mockAccounts.map((account) => (
131
- <AccountCard key={account.id} account={account} />
132
- ))}
133
- </ResponsiveGrid>
134
- </CardContent>
135
- </Card>
136
-
137
- {/* Entity Cards */}
138
- <Card>
139
- <CardHeader>
140
- <CardTitle>Entity Cards</CardTitle>
141
- </CardHeader>
142
- <CardContent>
143
- <ResponsiveGrid type="cards" gap="md">
144
- {mockCounterparties.map((entity) => (
145
- <EntityCard
146
- key={entity.id}
147
- entity={entity}
148
- onView={(id) => console.log("View", id)}
149
- onEdit={(id) => console.log("Edit", id)}
150
- onDelete={(id) => console.log("Delete", id)}
151
- />
152
- ))}
153
- </ResponsiveGrid>
154
- </CardContent>
155
- </Card>
156
-
157
- {/* Data Table */}
158
- <Card>
159
- <CardHeader>
160
- <CardTitle>Data Table</CardTitle>
161
- </CardHeader>
162
- <CardContent>
163
- <DataTable
164
- columns={tableColumns}
165
- data={mockTableData}
166
- sortBy={sortBy}
167
- sortDirection={sortDirection}
168
- onSort={handleSort}
169
- />
170
- </CardContent>
171
- </Card>
172
-
173
- {/* Layout Examples */}
174
- <Card>
175
- <CardHeader>
176
- <CardTitle>Layout Components</CardTitle>
177
- </CardHeader>
178
- <CardContent>
179
- <Stack spacing="md">
180
- <div>
181
- <h4 className="text-sm font-medium text-foreground mb-2">Container Sizes</h4>
182
- <Stack spacing="sm">
183
- <div className="bg-primary/10 rounded p-2 text-center text-xs">
184
- Small Container (max-w-2xl)
185
- </div>
186
- <div className="bg-primary/10 rounded p-2 text-center text-xs max-w-4xl">
187
- Medium Container (max-w-4xl)
188
- </div>
189
- <div className="bg-primary/10 rounded p-2 text-center text-xs max-w-6xl">
190
- Large Container (max-w-6xl)
191
- </div>
192
- </Stack>
193
- </div>
194
-
195
- <div>
196
- <h4 className="text-sm font-medium text-foreground mb-2">Responsive Grids</h4>
197
- <ResponsiveGrid type="forms" gap="sm">
198
- <div className="bg-secondary rounded p-4 text-center text-sm">Form Grid 1</div>
199
- <div className="bg-secondary rounded p-4 text-center text-sm">Form Grid 2</div>
200
- <div className="bg-secondary rounded p-4 text-center text-sm">Form Grid 3</div>
201
- <div className="bg-secondary rounded p-4 text-center text-sm">Form Grid 4</div>
202
- </ResponsiveGrid>
203
- </div>
204
- </Stack>
205
- </CardContent>
206
- </Card>
207
- </Stack>
208
- </Container>
209
- </div>
210
- )
211
- }
@@ -1,19 +0,0 @@
1
- import * as React from "react"
2
-
3
- const MOBILE_BREAKPOINT = 768
4
-
5
- export function useIsMobile() {
6
- const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
7
-
8
- React.useEffect(() => {
9
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
10
- const onChange = () => {
11
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
12
- }
13
- mql.addEventListener("change", onChange)
14
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
15
- return () => mql.removeEventListener("change", onChange)
16
- }, [])
17
-
18
- return !!isMobile
19
- }
@@ -1,191 +0,0 @@
1
- import * as React from "react"
2
-
3
- import type {
4
- ToastActionElement,
5
- ToastProps,
6
- } from "@/components/ui/toast"
7
-
8
- const TOAST_LIMIT = 1
9
- const TOAST_REMOVE_DELAY = 1000000
10
-
11
- type ToasterToast = ToastProps & {
12
- id: string
13
- title?: React.ReactNode
14
- description?: React.ReactNode
15
- action?: ToastActionElement
16
- }
17
-
18
- const actionTypes = {
19
- ADD_TOAST: "ADD_TOAST",
20
- UPDATE_TOAST: "UPDATE_TOAST",
21
- DISMISS_TOAST: "DISMISS_TOAST",
22
- REMOVE_TOAST: "REMOVE_TOAST",
23
- } as const
24
-
25
- let count = 0
26
-
27
- function genId() {
28
- count = (count + 1) % Number.MAX_SAFE_INTEGER
29
- return count.toString()
30
- }
31
-
32
- type ActionType = typeof actionTypes
33
-
34
- type Action =
35
- | {
36
- type: ActionType["ADD_TOAST"]
37
- toast: ToasterToast
38
- }
39
- | {
40
- type: ActionType["UPDATE_TOAST"]
41
- toast: Partial<ToasterToast>
42
- }
43
- | {
44
- type: ActionType["DISMISS_TOAST"]
45
- toastId?: ToasterToast["id"]
46
- }
47
- | {
48
- type: ActionType["REMOVE_TOAST"]
49
- toastId?: ToasterToast["id"]
50
- }
51
-
52
- interface State {
53
- toasts: ToasterToast[]
54
- }
55
-
56
- const toastTimeouts = new Map<string, ReturnType<typeof setTimeout>>()
57
-
58
- const addToRemoveQueue = (toastId: string) => {
59
- if (toastTimeouts.has(toastId)) {
60
- return
61
- }
62
-
63
- const timeout = setTimeout(() => {
64
- toastTimeouts.delete(toastId)
65
- dispatch({
66
- type: "REMOVE_TOAST",
67
- toastId: toastId,
68
- })
69
- }, TOAST_REMOVE_DELAY)
70
-
71
- toastTimeouts.set(toastId, timeout)
72
- }
73
-
74
- export const reducer = (state: State, action: Action): State => {
75
- switch (action.type) {
76
- case "ADD_TOAST":
77
- return {
78
- ...state,
79
- toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),
80
- }
81
-
82
- case "UPDATE_TOAST":
83
- return {
84
- ...state,
85
- toasts: state.toasts.map((t) =>
86
- t.id === action.toast.id ? { ...t, ...action.toast } : t
87
- ),
88
- }
89
-
90
- case "DISMISS_TOAST": {
91
- const { toastId } = action
92
-
93
- // ! Side effects ! - This could be extracted into a dismissToast() action,
94
- // but I'll keep it here for simplicity
95
- if (toastId) {
96
- addToRemoveQueue(toastId)
97
- } else {
98
- state.toasts.forEach((toast) => {
99
- addToRemoveQueue(toast.id)
100
- })
101
- }
102
-
103
- return {
104
- ...state,
105
- toasts: state.toasts.map((t) =>
106
- t.id === toastId || toastId === undefined
107
- ? {
108
- ...t,
109
- open: false,
110
- }
111
- : t
112
- ),
113
- }
114
- }
115
- case "REMOVE_TOAST":
116
- if (action.toastId === undefined) {
117
- return {
118
- ...state,
119
- toasts: [],
120
- }
121
- }
122
- return {
123
- ...state,
124
- toasts: state.toasts.filter((t) => t.id !== action.toastId),
125
- }
126
- }
127
- }
128
-
129
- const listeners: Array<(state: State) => void> = []
130
-
131
- let memoryState: State = { toasts: [] }
132
-
133
- function dispatch(action: Action) {
134
- memoryState = reducer(memoryState, action)
135
- listeners.forEach((listener) => {
136
- listener(memoryState)
137
- })
138
- }
139
-
140
- type Toast = Omit<ToasterToast, "id">
141
-
142
- function toast({ ...props }: Toast) {
143
- const id = genId()
144
-
145
- const update = (props: ToasterToast) =>
146
- dispatch({
147
- type: "UPDATE_TOAST",
148
- toast: { ...props, id },
149
- })
150
- const dismiss = () => dispatch({ type: "DISMISS_TOAST", toastId: id })
151
-
152
- dispatch({
153
- type: "ADD_TOAST",
154
- toast: {
155
- ...props,
156
- id,
157
- open: true,
158
- onOpenChange: (open) => {
159
- if (!open) dismiss()
160
- },
161
- },
162
- })
163
-
164
- return {
165
- id: id,
166
- dismiss,
167
- update,
168
- }
169
- }
170
-
171
- function useToast() {
172
- const [state, setState] = React.useState<State>(memoryState)
173
-
174
- React.useEffect(() => {
175
- listeners.push(setState)
176
- return () => {
177
- const index = listeners.indexOf(setState)
178
- if (index > -1) {
179
- listeners.splice(index, 1)
180
- }
181
- }
182
- }, [state])
183
-
184
- return {
185
- ...state,
186
- toast,
187
- dismiss: (toastId?: string) => dispatch({ type: "DISMISS_TOAST", toastId }),
188
- }
189
- }
190
-
191
- export { useToast, toast }