ai-design-system 0.1.80 → 0.1.82
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/components/composites/DataTable/EnhancedDataTable.tsx +13 -1
- package/components/composites/DataTable/RowDetailDrawer.tsx +3 -3
- package/components/composites/FormReports/FormReportsDrawerForm.tsx +87 -85
- package/dist/index.cjs +21 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +32 -0
- package/dist/index.js +21 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -270,8 +270,20 @@ export function EnhancedDataTable({
|
|
|
270
270
|
const value = toDisplayValue(rawValue)
|
|
271
271
|
|
|
272
272
|
if (renderType === "badge" || renderType === "status") {
|
|
273
|
+
const lower = value.toLowerCase()
|
|
274
|
+
let statusClass = "text-muted-foreground border-border"
|
|
275
|
+
if (lower.includes("complete") || lower.includes("done") || lower.includes("success") || lower.includes("approved")) {
|
|
276
|
+
statusClass = "text-emerald-400 bg-emerald-500/10 border-emerald-500/20"
|
|
277
|
+
} else if (lower.includes("fail") || lower.includes("error") || lower.includes("reject")) {
|
|
278
|
+
statusClass = "text-rose-400 bg-rose-500/10 border-rose-500/20"
|
|
279
|
+
} else if (lower.includes("cancel")) {
|
|
280
|
+
statusClass = "text-muted-foreground bg-muted/30 border-border"
|
|
281
|
+
} else if (lower.includes("progress") || lower.includes("running") || lower.includes("pending")) {
|
|
282
|
+
statusClass = "text-amber-400 bg-amber-500/10 border-amber-500/20"
|
|
283
|
+
}
|
|
284
|
+
|
|
273
285
|
return (
|
|
274
|
-
<Badge variant="outline" className=
|
|
286
|
+
<Badge variant="outline" className={`px-2 py-0.5 text-xs font-medium ${statusClass}`}>
|
|
275
287
|
{value}
|
|
276
288
|
</Badge>
|
|
277
289
|
)
|
|
@@ -69,12 +69,12 @@ export function RowDetailDrawer({ item, onChange }: RowDetailDrawerProps) {
|
|
|
69
69
|
{item.header as React.ReactNode}
|
|
70
70
|
</Button>
|
|
71
71
|
</DrawerTrigger>
|
|
72
|
-
<DrawerContent>
|
|
73
|
-
<DrawerHeader className="gap-1">
|
|
72
|
+
<DrawerContent className="max-h-[90vh] sm:max-h-full flex flex-col">
|
|
73
|
+
<DrawerHeader className="gap-1 shrink-0">
|
|
74
74
|
<DrawerTitle>{item.header as React.ReactNode}</DrawerTitle>
|
|
75
75
|
<DrawerDescription>Showing total visitors for the last 6 months</DrawerDescription>
|
|
76
76
|
</DrawerHeader>
|
|
77
|
-
<div className="flex flex-col gap-4 overflow-y-auto px-4 text-sm">
|
|
77
|
+
<div className="flex-1 min-h-0 flex flex-col gap-4 overflow-y-auto px-4 text-sm">
|
|
78
78
|
{open && !isMobile ? (
|
|
79
79
|
<>
|
|
80
80
|
<ChartContainer config={chartConfig} className="h-[220px] w-full">
|
|
@@ -112,97 +112,99 @@ export const FormReportsDrawerForm = React.memo<FormReportsDrawerFormProps>(
|
|
|
112
112
|
|
|
113
113
|
return (
|
|
114
114
|
<Drawer open={open} onOpenChange={onOpenChange} direction={isMobile ? "bottom" : "right"}>
|
|
115
|
-
<DrawerContent>
|
|
116
|
-
<DrawerHeader className="gap-1">
|
|
115
|
+
<DrawerContent className="max-h-[90vh] sm:max-h-full flex flex-col">
|
|
116
|
+
<DrawerHeader className="gap-1 shrink-0">
|
|
117
117
|
<DrawerTitle>{title}</DrawerTitle>
|
|
118
118
|
{description ? <DrawerDescription>{description}</DrawerDescription> : null}
|
|
119
119
|
</DrawerHeader>
|
|
120
120
|
|
|
121
|
-
<form className="flex flex-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
<
|
|
128
|
-
{field.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
<
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
{option.
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
<
|
|
121
|
+
<form className="flex min-h-0 flex-1 flex-col overflow-hidden text-sm" onSubmit={handleSubmit}>
|
|
122
|
+
<div className="flex-1 min-h-0 overflow-y-auto px-4 py-2 flex flex-col gap-4">
|
|
123
|
+
{fields.map((field) => {
|
|
124
|
+
const value = values[field.name]
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<div key={field.name} className="flex flex-col gap-2">
|
|
128
|
+
<Label htmlFor={`form-reports-${field.name}`}>
|
|
129
|
+
{field.label}
|
|
130
|
+
{field.required ? <span className="ml-1 text-destructive">*</span> : null}
|
|
131
|
+
</Label>
|
|
132
|
+
|
|
133
|
+
{field.type === "textarea" ? (
|
|
134
|
+
<Textarea
|
|
135
|
+
id={`form-reports-${field.name}`}
|
|
136
|
+
value={toInputValue(value)}
|
|
137
|
+
placeholder={field.placeholder}
|
|
138
|
+
onChange={(event) => setField(field.name, event.target.value)}
|
|
139
|
+
onBlur={(event) => onFieldBlur?.(field.name, event.target.value, values)}
|
|
140
|
+
rows={4}
|
|
141
|
+
/>
|
|
142
|
+
) : null}
|
|
143
|
+
|
|
144
|
+
{field.type === "select" ? (
|
|
145
|
+
<Select
|
|
146
|
+
value={toInputValue(value)}
|
|
147
|
+
onValueChange={(nextValue) => setField(field.name, nextValue)}
|
|
148
|
+
>
|
|
149
|
+
<SelectTrigger id={`form-reports-${field.name}`}>
|
|
150
|
+
<SelectValue placeholder={field.placeholder ?? `Select ${field.label}`} />
|
|
151
|
+
</SelectTrigger>
|
|
152
|
+
<SelectContent>
|
|
153
|
+
{(field.options ?? []).map((option: FormFieldOption) => (
|
|
154
|
+
<SelectItem key={option.value} value={option.value}>
|
|
155
|
+
{option.label}
|
|
156
|
+
</SelectItem>
|
|
157
|
+
))}
|
|
158
|
+
</SelectContent>
|
|
159
|
+
</Select>
|
|
160
|
+
) : null}
|
|
161
|
+
|
|
162
|
+
{field.type === "boolean" ? (
|
|
163
|
+
<div className="flex items-center gap-2 rounded-md border px-3 py-2">
|
|
164
|
+
<Checkbox
|
|
165
|
+
id={`form-reports-${field.name}`}
|
|
166
|
+
checked={Boolean(value)}
|
|
167
|
+
onCheckedChange={(checked) => setField(field.name, Boolean(checked))}
|
|
168
|
+
onBlur={() => onFieldBlur?.(field.name, Boolean(value), values)}
|
|
169
|
+
/>
|
|
170
|
+
<Label htmlFor={`form-reports-${field.name}`}>{field.placeholder ?? `Enable ${field.label}`}</Label>
|
|
171
|
+
</div>
|
|
172
|
+
) : null}
|
|
173
|
+
|
|
174
|
+
{field.type === "text" || field.type === "number" || field.type === "date" ? (
|
|
175
|
+
<Input
|
|
164
176
|
id={`form-reports-${field.name}`}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
177
|
+
type={field.type === "text" ? "text" : field.type}
|
|
178
|
+
value={toInputValue(value)}
|
|
179
|
+
placeholder={field.placeholder}
|
|
180
|
+
onChange={(event) => {
|
|
181
|
+
const nextValue =
|
|
182
|
+
field.type === "number"
|
|
183
|
+
? event.target.value === ""
|
|
184
|
+
? ""
|
|
185
|
+
: Number(event.target.value)
|
|
186
|
+
: event.target.value
|
|
187
|
+
setField(field.name, nextValue)
|
|
188
|
+
}}
|
|
189
|
+
onBlur={(event) => {
|
|
190
|
+
const blurValue =
|
|
191
|
+
field.type === "number"
|
|
192
|
+
? event.target.value === ""
|
|
193
|
+
? ""
|
|
194
|
+
: Number(event.target.value)
|
|
195
|
+
: event.target.value
|
|
196
|
+
onFieldBlur?.(field.name, blurValue, values)
|
|
197
|
+
}}
|
|
168
198
|
/>
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
placeholder={field.placeholder}
|
|
179
|
-
onChange={(event) => {
|
|
180
|
-
const nextValue =
|
|
181
|
-
field.type === "number"
|
|
182
|
-
? event.target.value === ""
|
|
183
|
-
? ""
|
|
184
|
-
: Number(event.target.value)
|
|
185
|
-
: event.target.value
|
|
186
|
-
setField(field.name, nextValue)
|
|
187
|
-
}}
|
|
188
|
-
onBlur={(event) => {
|
|
189
|
-
const blurValue =
|
|
190
|
-
field.type === "number"
|
|
191
|
-
? event.target.value === ""
|
|
192
|
-
? ""
|
|
193
|
-
: Number(event.target.value)
|
|
194
|
-
: event.target.value
|
|
195
|
-
onFieldBlur?.(field.name, blurValue, values)
|
|
196
|
-
}}
|
|
197
|
-
/>
|
|
198
|
-
) : null}
|
|
199
|
-
|
|
200
|
-
{field.description ? <p className="text-xs text-muted-foreground">{field.description}</p> : null}
|
|
201
|
-
</div>
|
|
202
|
-
)
|
|
203
|
-
})}
|
|
204
|
-
|
|
205
|
-
<DrawerFooter className="px-0">
|
|
199
|
+
) : null}
|
|
200
|
+
|
|
201
|
+
{field.description ? <p className="text-xs text-muted-foreground">{field.description}</p> : null}
|
|
202
|
+
</div>
|
|
203
|
+
)
|
|
204
|
+
})}
|
|
205
|
+
</div>
|
|
206
|
+
|
|
207
|
+
<DrawerFooter className="px-4 py-3 border-t shrink-0">
|
|
206
208
|
<Button type="submit">{submitLabel}</Button>
|
|
207
209
|
<DrawerClose asChild>
|
|
208
210
|
<Button
|
package/dist/index.cjs
CHANGED
|
@@ -9607,12 +9607,12 @@ function RowDetailDrawer({ item, onChange }) {
|
|
|
9607
9607
|
const [open, setOpen] = React3__namespace.useState(false);
|
|
9608
9608
|
return /* @__PURE__ */ jsxRuntime.jsxs(Drawer2, { open, onOpenChange: setOpen, direction: isMobile ? "bottom" : "right", children: [
|
|
9609
9609
|
/* @__PURE__ */ jsxRuntime.jsx(DrawerTrigger2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(Button2, { variant: "link", className: "w-fit px-0 text-left text-foreground", children: item.header }) }),
|
|
9610
|
-
/* @__PURE__ */ jsxRuntime.jsxs(DrawerContent2, { children: [
|
|
9611
|
-
/* @__PURE__ */ jsxRuntime.jsxs(DrawerHeader2, { className: "gap-1", children: [
|
|
9610
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DrawerContent2, { className: "max-h-[90vh] sm:max-h-full flex flex-col", children: [
|
|
9611
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DrawerHeader2, { className: "gap-1 shrink-0", children: [
|
|
9612
9612
|
/* @__PURE__ */ jsxRuntime.jsx(DrawerTitle2, { children: item.header }),
|
|
9613
9613
|
/* @__PURE__ */ jsxRuntime.jsx(DrawerDescription2, { children: "Showing total visitors for the last 6 months" })
|
|
9614
9614
|
] }),
|
|
9615
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4 overflow-y-auto px-4 text-sm", children: [
|
|
9615
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-h-0 flex flex-col gap-4 overflow-y-auto px-4 text-sm", children: [
|
|
9616
9616
|
open && !isMobile ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
9617
9617
|
/* @__PURE__ */ jsxRuntime.jsx(ChartContainer2, { config: chartConfig, className: "h-[220px] w-full", children: /* @__PURE__ */ jsxRuntime.jsxs(RechartsPrimitive.AreaChart, { data: chartData, margin: { left: 0, right: 10 }, children: [
|
|
9618
9618
|
/* @__PURE__ */ jsxRuntime.jsx(RechartsPrimitive.CartesianGrid, { vertical: false }),
|
|
@@ -9980,7 +9980,18 @@ function EnhancedDataTable({
|
|
|
9980
9980
|
const renderType = (_a2 = column.renderType) != null ? _a2 : "text";
|
|
9981
9981
|
const value = toDisplayValue(rawValue);
|
|
9982
9982
|
if (renderType === "badge" || renderType === "status") {
|
|
9983
|
-
|
|
9983
|
+
const lower = value.toLowerCase();
|
|
9984
|
+
let statusClass = "text-muted-foreground border-border";
|
|
9985
|
+
if (lower.includes("complete") || lower.includes("done") || lower.includes("success") || lower.includes("approved")) {
|
|
9986
|
+
statusClass = "text-emerald-400 bg-emerald-500/10 border-emerald-500/20";
|
|
9987
|
+
} else if (lower.includes("fail") || lower.includes("error") || lower.includes("reject")) {
|
|
9988
|
+
statusClass = "text-rose-400 bg-rose-500/10 border-rose-500/20";
|
|
9989
|
+
} else if (lower.includes("cancel")) {
|
|
9990
|
+
statusClass = "text-muted-foreground bg-muted/30 border-border";
|
|
9991
|
+
} else if (lower.includes("progress") || lower.includes("running") || lower.includes("pending")) {
|
|
9992
|
+
statusClass = "text-amber-400 bg-amber-500/10 border-amber-500/20";
|
|
9993
|
+
}
|
|
9994
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Badge2, { variant: "outline", className: `px-2 py-0.5 text-xs font-medium ${statusClass}`, children: value });
|
|
9984
9995
|
}
|
|
9985
9996
|
if (renderType === "progress") {
|
|
9986
9997
|
const progress = Math.max(0, Math.min(100, toNumberValue(rawValue)));
|
|
@@ -10438,13 +10449,13 @@ var FormReportsDrawerForm = React3__namespace.memo(
|
|
|
10438
10449
|
},
|
|
10439
10450
|
[onSubmit, values]
|
|
10440
10451
|
);
|
|
10441
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Drawer2, { open, onOpenChange, direction: isMobile ? "bottom" : "right", children: /* @__PURE__ */ jsxRuntime.jsxs(DrawerContent2, { children: [
|
|
10442
|
-
/* @__PURE__ */ jsxRuntime.jsxs(DrawerHeader2, { className: "gap-1", children: [
|
|
10452
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Drawer2, { open, onOpenChange, direction: isMobile ? "bottom" : "right", children: /* @__PURE__ */ jsxRuntime.jsxs(DrawerContent2, { className: "max-h-[90vh] sm:max-h-full flex flex-col", children: [
|
|
10453
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DrawerHeader2, { className: "gap-1 shrink-0", children: [
|
|
10443
10454
|
/* @__PURE__ */ jsxRuntime.jsx(DrawerTitle2, { children: title }),
|
|
10444
10455
|
description ? /* @__PURE__ */ jsxRuntime.jsx(DrawerDescription2, { children: description }) : null
|
|
10445
10456
|
] }),
|
|
10446
|
-
/* @__PURE__ */ jsxRuntime.jsxs("form", { className: "flex flex-
|
|
10447
|
-
fields.map((field) => {
|
|
10457
|
+
/* @__PURE__ */ jsxRuntime.jsxs("form", { className: "flex min-h-0 flex-1 flex-col overflow-hidden text-sm", onSubmit: handleSubmit, children: [
|
|
10458
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 min-h-0 overflow-y-auto px-4 py-2 flex flex-col gap-4", children: fields.map((field) => {
|
|
10448
10459
|
var _a, _b, _c;
|
|
10449
10460
|
const value = values[field.name];
|
|
10450
10461
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
@@ -10505,8 +10516,8 @@ var FormReportsDrawerForm = React3__namespace.memo(
|
|
|
10505
10516
|
) : null,
|
|
10506
10517
|
field.description ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: field.description }) : null
|
|
10507
10518
|
] }, field.name);
|
|
10508
|
-
}),
|
|
10509
|
-
/* @__PURE__ */ jsxRuntime.jsxs(DrawerFooter2, { className: "px-0", children: [
|
|
10519
|
+
}) }),
|
|
10520
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DrawerFooter2, { className: "px-4 py-3 border-t shrink-0", children: [
|
|
10510
10521
|
/* @__PURE__ */ jsxRuntime.jsx(Button2, { type: "submit", children: submitLabel }),
|
|
10511
10522
|
/* @__PURE__ */ jsxRuntime.jsx(DrawerClose2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10512
10523
|
Button2,
|