@optilogic/core 1.0.0-beta.2 → 1.0.0-beta.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/index.cjs +734 -219
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +308 -6
- package/dist/index.d.ts +308 -6
- package/dist/index.js +669 -168
- package/dist/index.js.map +1 -1
- package/package.json +20 -20
- package/src/components/board.tsx +251 -0
- package/src/components/card.tsx +656 -12
- package/src/components/context-menu.tsx +1 -1
- package/src/components/data-grid/hooks/useKeyboardNavigation.ts +1 -1
- package/src/index.ts +33 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optilogic/core",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"description": "Core UI components for Optilogic - A professional React component library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -38,22 +38,22 @@
|
|
|
38
38
|
"README.md"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@radix-ui/react-accordion": "^1.2.
|
|
42
|
-
"@radix-ui/react-alert-dialog": "^1.1.
|
|
43
|
-
"@radix-ui/react-checkbox": "^1.1.
|
|
44
|
-
"@radix-ui/react-dropdown-menu": "^2.1.
|
|
45
|
-
"@radix-ui/react-label": "^2.1.
|
|
46
|
-
"@radix-ui/react-popover": "^1.1.
|
|
47
|
-
"@radix-ui/react-progress": "^1.1.
|
|
48
|
-
"@radix-ui/react-select": "^2.1.
|
|
49
|
-
"@radix-ui/react-separator": "^1.1.
|
|
50
|
-
"@radix-ui/react-slot": "^1.
|
|
51
|
-
"@radix-ui/react-switch": "^1.1.
|
|
52
|
-
"@radix-ui/react-tabs": "^1.1.
|
|
53
|
-
"@radix-ui/react-tooltip": "^1.1.
|
|
41
|
+
"@radix-ui/react-accordion": "^1.2.2",
|
|
42
|
+
"@radix-ui/react-alert-dialog": "^1.1.4",
|
|
43
|
+
"@radix-ui/react-checkbox": "^1.1.3",
|
|
44
|
+
"@radix-ui/react-dropdown-menu": "^2.1.4",
|
|
45
|
+
"@radix-ui/react-label": "^2.1.1",
|
|
46
|
+
"@radix-ui/react-popover": "^1.1.4",
|
|
47
|
+
"@radix-ui/react-progress": "^1.1.1",
|
|
48
|
+
"@radix-ui/react-select": "^2.1.4",
|
|
49
|
+
"@radix-ui/react-separator": "^1.1.1",
|
|
50
|
+
"@radix-ui/react-slot": "^1.2.4",
|
|
51
|
+
"@radix-ui/react-switch": "^1.1.2",
|
|
52
|
+
"@radix-ui/react-tabs": "^1.1.2",
|
|
53
|
+
"@radix-ui/react-tooltip": "^1.1.5",
|
|
54
54
|
"class-variance-authority": "^0.7.1",
|
|
55
55
|
"clsx": "^2.1.1",
|
|
56
|
-
"lucide-react": "^0.
|
|
56
|
+
"lucide-react": "^0.563.0",
|
|
57
57
|
"tailwind-merge": "^3.0.1"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
@@ -80,15 +80,15 @@
|
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
|
-
"@types/react": "^
|
|
84
|
-
"@types/react-dom": "^
|
|
83
|
+
"@types/react": "^19.0.0",
|
|
84
|
+
"@types/react-dom": "^19.0.0",
|
|
85
85
|
"autoprefixer": "^10.4.20",
|
|
86
86
|
"date-fns": "^4.1.0",
|
|
87
87
|
"postcss": "^8.4.49",
|
|
88
|
-
"react": "^
|
|
88
|
+
"react": "^19.0.0",
|
|
89
89
|
"react-day-picker": "^9.13.0",
|
|
90
|
-
"react-dom": "^
|
|
91
|
-
"tailwindcss": "^3.4.
|
|
90
|
+
"react-dom": "^19.0.0",
|
|
91
|
+
"tailwindcss": "^3.4.19",
|
|
92
92
|
"tsup": "^8.3.5",
|
|
93
93
|
"typescript": "^5.7.2"
|
|
94
94
|
},
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
|
+
|
|
4
|
+
import { cn } from "../utils/cn";
|
|
5
|
+
|
|
6
|
+
// =============================================================================
|
|
7
|
+
// Board Variants
|
|
8
|
+
// =============================================================================
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Board variant styles using class-variance-authority.
|
|
12
|
+
* Provides elevation (shadow), border, padding, radius, background, and hover options.
|
|
13
|
+
*/
|
|
14
|
+
const boardVariants = cva("text-card-foreground", {
|
|
15
|
+
variants: {
|
|
16
|
+
/**
|
|
17
|
+
* Elevation (shadow depth) - similar to MUI Paper
|
|
18
|
+
*/
|
|
19
|
+
elevation: {
|
|
20
|
+
none: "",
|
|
21
|
+
sm: "shadow-sm",
|
|
22
|
+
md: "shadow",
|
|
23
|
+
lg: "shadow-lg",
|
|
24
|
+
xl: "shadow-xl",
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* Border style
|
|
28
|
+
*/
|
|
29
|
+
border: {
|
|
30
|
+
none: "",
|
|
31
|
+
default: "border",
|
|
32
|
+
muted: "border border-muted",
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* Padding size
|
|
36
|
+
*/
|
|
37
|
+
padding: {
|
|
38
|
+
none: "",
|
|
39
|
+
sm: "p-2",
|
|
40
|
+
md: "p-4",
|
|
41
|
+
lg: "p-6",
|
|
42
|
+
xl: "p-8",
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Border radius
|
|
46
|
+
*/
|
|
47
|
+
radius: {
|
|
48
|
+
none: "rounded-none",
|
|
49
|
+
sm: "rounded-sm",
|
|
50
|
+
md: "rounded-md",
|
|
51
|
+
lg: "rounded-lg",
|
|
52
|
+
xl: "rounded-xl",
|
|
53
|
+
full: "rounded-full",
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* Background color
|
|
57
|
+
*/
|
|
58
|
+
background: {
|
|
59
|
+
default: "bg-card",
|
|
60
|
+
muted: "bg-muted",
|
|
61
|
+
transparent: "bg-transparent",
|
|
62
|
+
},
|
|
63
|
+
/**
|
|
64
|
+
* Hover effect styles
|
|
65
|
+
*/
|
|
66
|
+
hover: {
|
|
67
|
+
none: "",
|
|
68
|
+
border: "transition-colors duration-200 hover:border-accent",
|
|
69
|
+
elevate: "transition-shadow duration-200 hover:shadow-lg",
|
|
70
|
+
"border-success": "transition-colors duration-200 hover:border-success",
|
|
71
|
+
"border-warning": "transition-colors duration-200 hover:border-warning",
|
|
72
|
+
"border-destructive":
|
|
73
|
+
"transition-colors duration-200 hover:border-destructive",
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
defaultVariants: {
|
|
77
|
+
elevation: "none",
|
|
78
|
+
border: "default",
|
|
79
|
+
padding: "none",
|
|
80
|
+
radius: "lg",
|
|
81
|
+
background: "default",
|
|
82
|
+
hover: "none",
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
// =============================================================================
|
|
87
|
+
// Board Component
|
|
88
|
+
// =============================================================================
|
|
89
|
+
|
|
90
|
+
export interface BoardProps
|
|
91
|
+
extends React.HTMLAttributes<HTMLDivElement>,
|
|
92
|
+
VariantProps<typeof boardVariants> {
|
|
93
|
+
/**
|
|
94
|
+
* Custom CSS class for hover border color.
|
|
95
|
+
* Use Tailwind classes like "hover:border-blue-500" or custom CSS variables.
|
|
96
|
+
* This overrides the hover variant's border color if specified.
|
|
97
|
+
*/
|
|
98
|
+
hoverBorderClass?: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Board - General-purpose container component with elevation support
|
|
103
|
+
*
|
|
104
|
+
* A flexible container similar to MUI's Paper component. Supports configurable
|
|
105
|
+
* elevation (shadows), borders, padding, border radius, background colors,
|
|
106
|
+
* and hover effects. Use with BoardHeader and BoardContent for structured layouts.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* // Simple container
|
|
110
|
+
* <Board elevation="md" padding="md">
|
|
111
|
+
* <p>Content here</p>
|
|
112
|
+
* </Board>
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* // With header and content
|
|
116
|
+
* <Board elevation="lg" border="default">
|
|
117
|
+
* <BoardHeader>
|
|
118
|
+
* <span className="font-semibold">Section Title</span>
|
|
119
|
+
* </BoardHeader>
|
|
120
|
+
* <BoardContent>
|
|
121
|
+
* Main content goes here
|
|
122
|
+
* </BoardContent>
|
|
123
|
+
* </Board>
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* // Transparent background with hover effect
|
|
127
|
+
* <Board background="transparent" hover="border" border="muted">
|
|
128
|
+
* <BoardContent>Hoverable content</BoardContent>
|
|
129
|
+
* </Board>
|
|
130
|
+
*/
|
|
131
|
+
const Board = React.forwardRef<HTMLDivElement, BoardProps>(
|
|
132
|
+
(
|
|
133
|
+
{
|
|
134
|
+
className,
|
|
135
|
+
elevation,
|
|
136
|
+
border,
|
|
137
|
+
padding,
|
|
138
|
+
radius,
|
|
139
|
+
background,
|
|
140
|
+
hover,
|
|
141
|
+
hoverBorderClass,
|
|
142
|
+
...props
|
|
143
|
+
},
|
|
144
|
+
ref
|
|
145
|
+
) => {
|
|
146
|
+
return (
|
|
147
|
+
<div
|
|
148
|
+
ref={ref}
|
|
149
|
+
className={cn(
|
|
150
|
+
boardVariants({
|
|
151
|
+
elevation,
|
|
152
|
+
border,
|
|
153
|
+
padding,
|
|
154
|
+
radius,
|
|
155
|
+
background,
|
|
156
|
+
hover,
|
|
157
|
+
}),
|
|
158
|
+
// Custom hover border color overrides variant if provided
|
|
159
|
+
hoverBorderClass && "transition-colors duration-200",
|
|
160
|
+
hoverBorderClass,
|
|
161
|
+
className
|
|
162
|
+
)}
|
|
163
|
+
{...props}
|
|
164
|
+
/>
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
Board.displayName = "Board";
|
|
169
|
+
|
|
170
|
+
// =============================================================================
|
|
171
|
+
// BoardHeader Component
|
|
172
|
+
// =============================================================================
|
|
173
|
+
|
|
174
|
+
export interface BoardHeaderProps
|
|
175
|
+
extends React.HTMLAttributes<HTMLDivElement> {}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* BoardHeader - Header section with bottom separator
|
|
179
|
+
*
|
|
180
|
+
* Renders a header area with a bottom border divider. Accepts any children
|
|
181
|
+
* including text, icons, badges, or custom layouts.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* <Board>
|
|
185
|
+
* <BoardHeader>
|
|
186
|
+
* <span className="font-semibold">Title</span>
|
|
187
|
+
* </BoardHeader>
|
|
188
|
+
* <BoardContent>Content</BoardContent>
|
|
189
|
+
* </Board>
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* // With custom layout
|
|
193
|
+
* <BoardHeader className="flex items-center justify-between">
|
|
194
|
+
* <div className="flex items-center gap-2">
|
|
195
|
+
* <FileIcon />
|
|
196
|
+
* <span>Documents</span>
|
|
197
|
+
* </div>
|
|
198
|
+
* <Badge>12</Badge>
|
|
199
|
+
* </BoardHeader>
|
|
200
|
+
*/
|
|
201
|
+
const BoardHeader = React.forwardRef<HTMLDivElement, BoardHeaderProps>(
|
|
202
|
+
({ className, ...props }, ref) => (
|
|
203
|
+
<div
|
|
204
|
+
ref={ref}
|
|
205
|
+
className={cn("flex items-center p-4 border-b", className)}
|
|
206
|
+
{...props}
|
|
207
|
+
/>
|
|
208
|
+
)
|
|
209
|
+
);
|
|
210
|
+
BoardHeader.displayName = "BoardHeader";
|
|
211
|
+
|
|
212
|
+
// =============================================================================
|
|
213
|
+
// BoardContent Component
|
|
214
|
+
// =============================================================================
|
|
215
|
+
|
|
216
|
+
export interface BoardContentProps
|
|
217
|
+
extends React.HTMLAttributes<HTMLDivElement> {}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* BoardContent - Main content area with consistent padding
|
|
221
|
+
*
|
|
222
|
+
* Provides a padded container for the main content. Useful when using
|
|
223
|
+
* BoardHeader to maintain proper spacing.
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* <Board>
|
|
227
|
+
* <BoardHeader>Title</BoardHeader>
|
|
228
|
+
* <BoardContent>
|
|
229
|
+
* Main content goes here
|
|
230
|
+
* </BoardContent>
|
|
231
|
+
* </Board>
|
|
232
|
+
*/
|
|
233
|
+
const BoardContent = React.forwardRef<HTMLDivElement, BoardContentProps>(
|
|
234
|
+
({ className, ...props }, ref) => (
|
|
235
|
+
<div ref={ref} className={cn("p-4", className)} {...props} />
|
|
236
|
+
)
|
|
237
|
+
);
|
|
238
|
+
BoardContent.displayName = "BoardContent";
|
|
239
|
+
|
|
240
|
+
// =============================================================================
|
|
241
|
+
// Exports
|
|
242
|
+
// =============================================================================
|
|
243
|
+
|
|
244
|
+
export {
|
|
245
|
+
// Components
|
|
246
|
+
Board,
|
|
247
|
+
BoardHeader,
|
|
248
|
+
BoardContent,
|
|
249
|
+
// Variants (for advanced customization)
|
|
250
|
+
boardVariants,
|
|
251
|
+
};
|