ai-design-system 0.1.82 → 0.1.84
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/blocks/FormReportsSection/FormReportsSection.tsx +1 -1
- package/components/composites/DataTable/EnhancedDataTable.tsx +16 -12
- package/components/composites/FormReports/FormReportsDrawerForm.tsx +23 -23
- package/dist/index.cjs +86 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +6 -24
- package/dist/index.d.ts +81 -81
- package/dist/index.js +86 -87
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -269,21 +269,25 @@ export function EnhancedDataTable({
|
|
|
269
269
|
const renderType = column.renderType ?? "text"
|
|
270
270
|
const value = toDisplayValue(rawValue)
|
|
271
271
|
|
|
272
|
-
if (renderType === "
|
|
272
|
+
if (renderType === "status") {
|
|
273
273
|
const lower = value.toLowerCase()
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
274
|
+
const isDone = lower.includes("complete") || lower.includes("done") || lower.includes("success")
|
|
275
|
+
const isFailed = lower.includes("fail") || lower.includes("error") || lower.includes("reject")
|
|
276
|
+
const isInProgress = lower.includes("progress") || lower.includes("running") || lower.includes("pending") || lower.includes("process")
|
|
277
|
+
|
|
278
|
+
return (
|
|
279
|
+
<Badge variant="outline" className="px-1.5 text-muted-foreground gap-1.5 font-normal">
|
|
280
|
+
{isDone && <span className="size-2 rounded-full bg-emerald-500 shrink-0" />}
|
|
281
|
+
{isFailed && <span className="size-2 rounded-full bg-rose-500 shrink-0" />}
|
|
282
|
+
{isInProgress && <Icon name="loader-2" size="xs" className="animate-spin text-amber-500 shrink-0" />}
|
|
283
|
+
{value}
|
|
284
|
+
</Badge>
|
|
285
|
+
)
|
|
286
|
+
}
|
|
284
287
|
|
|
288
|
+
if (renderType === "badge") {
|
|
285
289
|
return (
|
|
286
|
-
<Badge variant="outline" className=
|
|
290
|
+
<Badge variant="outline" className="px-1.5 text-muted-foreground font-normal">
|
|
287
291
|
{value}
|
|
288
292
|
</Badge>
|
|
289
293
|
)
|
|
@@ -112,14 +112,13 @@ 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>
|
|
116
|
+
<DrawerHeader className="gap-1">
|
|
117
117
|
<DrawerTitle>{title}</DrawerTitle>
|
|
118
118
|
{description ? <DrawerDescription>{description}</DrawerDescription> : null}
|
|
119
119
|
</DrawerHeader>
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
<div className="flex-1 min-h-0 overflow-y-auto px-4 py-2 flex flex-col gap-4">
|
|
120
|
+
<div className="flex flex-col gap-4 overflow-y-auto px-4 text-sm">
|
|
121
|
+
<form id="form-reports-drawer-form" className="flex flex-col gap-4" onSubmit={handleSubmit}>
|
|
123
122
|
{fields.map((field) => {
|
|
124
123
|
const value = values[field.name]
|
|
125
124
|
|
|
@@ -202,24 +201,25 @@ export const FormReportsDrawerForm = React.memo<FormReportsDrawerFormProps>(
|
|
|
202
201
|
</div>
|
|
203
202
|
)
|
|
204
203
|
})}
|
|
205
|
-
</
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
204
|
+
</form>
|
|
205
|
+
</div>
|
|
206
|
+
<DrawerFooter>
|
|
207
|
+
<Button form="form-reports-drawer-form" type="submit">
|
|
208
|
+
{submitLabel}
|
|
209
|
+
</Button>
|
|
210
|
+
<DrawerClose asChild>
|
|
211
|
+
<Button
|
|
212
|
+
type="button"
|
|
213
|
+
variant="outline"
|
|
214
|
+
onClick={() => {
|
|
215
|
+
onCancel?.()
|
|
216
|
+
onOpenChange(false)
|
|
217
|
+
}}
|
|
218
|
+
>
|
|
219
|
+
{cancelLabel}
|
|
220
|
+
</Button>
|
|
221
|
+
</DrawerClose>
|
|
222
|
+
</DrawerFooter>
|
|
223
223
|
</DrawerContent>
|
|
224
224
|
</Drawer>
|
|
225
225
|
)
|
package/dist/index.cjs
CHANGED
|
@@ -9979,19 +9979,20 @@ function EnhancedDataTable({
|
|
|
9979
9979
|
var _a2;
|
|
9980
9980
|
const renderType = (_a2 = column.renderType) != null ? _a2 : "text";
|
|
9981
9981
|
const value = toDisplayValue(rawValue);
|
|
9982
|
-
if (renderType === "
|
|
9982
|
+
if (renderType === "status") {
|
|
9983
9983
|
const lower = value.toLowerCase();
|
|
9984
|
-
|
|
9985
|
-
|
|
9986
|
-
|
|
9987
|
-
|
|
9988
|
-
|
|
9989
|
-
|
|
9990
|
-
|
|
9991
|
-
|
|
9992
|
-
|
|
9993
|
-
|
|
9994
|
-
|
|
9984
|
+
const isDone = lower.includes("complete") || lower.includes("done") || lower.includes("success");
|
|
9985
|
+
const isFailed = lower.includes("fail") || lower.includes("error") || lower.includes("reject");
|
|
9986
|
+
const isInProgress = lower.includes("progress") || lower.includes("running") || lower.includes("pending") || lower.includes("process");
|
|
9987
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Badge2, { variant: "outline", className: "px-1.5 text-muted-foreground gap-1.5 font-normal", children: [
|
|
9988
|
+
isDone && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-2 rounded-full bg-emerald-500 shrink-0" }),
|
|
9989
|
+
isFailed && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "size-2 rounded-full bg-rose-500 shrink-0" }),
|
|
9990
|
+
isInProgress && /* @__PURE__ */ jsxRuntime.jsx(Icon, { name: "loader-2", size: "xs", className: "animate-spin text-amber-500 shrink-0" }),
|
|
9991
|
+
value
|
|
9992
|
+
] });
|
|
9993
|
+
}
|
|
9994
|
+
if (renderType === "badge") {
|
|
9995
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Badge2, { variant: "outline", className: "px-1.5 text-muted-foreground font-normal", children: value });
|
|
9995
9996
|
}
|
|
9996
9997
|
if (renderType === "progress") {
|
|
9997
9998
|
const progress = Math.max(0, Math.min(100, toNumberValue(rawValue)));
|
|
@@ -10449,89 +10450,87 @@ var FormReportsDrawerForm = React3__namespace.memo(
|
|
|
10449
10450
|
},
|
|
10450
10451
|
[onSubmit, values]
|
|
10451
10452
|
);
|
|
10452
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Drawer2, { open, onOpenChange, direction: isMobile ? "bottom" : "right", children: /* @__PURE__ */ jsxRuntime.jsxs(DrawerContent2, {
|
|
10453
|
-
/* @__PURE__ */ jsxRuntime.jsxs(DrawerHeader2, { className: "gap-1
|
|
10453
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Drawer2, { open, onOpenChange, direction: isMobile ? "bottom" : "right", children: /* @__PURE__ */ jsxRuntime.jsxs(DrawerContent2, { children: [
|
|
10454
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DrawerHeader2, { className: "gap-1", children: [
|
|
10454
10455
|
/* @__PURE__ */ jsxRuntime.jsx(DrawerTitle2, { children: title }),
|
|
10455
10456
|
description ? /* @__PURE__ */ jsxRuntime.jsx(DrawerDescription2, { children: description }) : null
|
|
10456
10457
|
] }),
|
|
10457
|
-
/* @__PURE__ */ jsxRuntime.
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10467
|
-
|
|
10468
|
-
{
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
|
|
10477
|
-
|
|
10478
|
-
|
|
10479
|
-
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
children:
|
|
10483
|
-
|
|
10484
|
-
|
|
10485
|
-
|
|
10486
|
-
|
|
10487
|
-
|
|
10488
|
-
|
|
10489
|
-
|
|
10490
|
-
Checkbox2,
|
|
10491
|
-
{
|
|
10492
|
-
id: `form-reports-${field.name}`,
|
|
10493
|
-
checked: Boolean(value),
|
|
10494
|
-
onCheckedChange: (checked) => setField(field.name, Boolean(checked)),
|
|
10495
|
-
onBlur: () => onFieldBlur == null ? void 0 : onFieldBlur(field.name, Boolean(value), values)
|
|
10496
|
-
}
|
|
10497
|
-
),
|
|
10498
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label4, { htmlFor: `form-reports-${field.name}`, children: (_c = field.placeholder) != null ? _c : `Enable ${field.label}` })
|
|
10499
|
-
] }) : null,
|
|
10500
|
-
field.type === "text" || field.type === "number" || field.type === "date" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10501
|
-
Input2,
|
|
10458
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4 overflow-y-auto px-4 text-sm", children: /* @__PURE__ */ jsxRuntime.jsx("form", { id: "form-reports-drawer-form", className: "flex flex-col gap-4", onSubmit: handleSubmit, children: fields.map((field) => {
|
|
10459
|
+
var _a, _b, _c;
|
|
10460
|
+
const value = values[field.name];
|
|
10461
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
10462
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Label4, { htmlFor: `form-reports-${field.name}`, children: [
|
|
10463
|
+
field.label,
|
|
10464
|
+
field.required ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-1 text-destructive", children: "*" }) : null
|
|
10465
|
+
] }),
|
|
10466
|
+
field.type === "textarea" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10467
|
+
Textarea2,
|
|
10468
|
+
{
|
|
10469
|
+
id: `form-reports-${field.name}`,
|
|
10470
|
+
value: toInputValue(value),
|
|
10471
|
+
placeholder: field.placeholder,
|
|
10472
|
+
onChange: (event) => setField(field.name, event.target.value),
|
|
10473
|
+
onBlur: (event) => onFieldBlur == null ? void 0 : onFieldBlur(field.name, event.target.value, values),
|
|
10474
|
+
rows: 4
|
|
10475
|
+
}
|
|
10476
|
+
) : null,
|
|
10477
|
+
field.type === "select" ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
10478
|
+
Select2,
|
|
10479
|
+
{
|
|
10480
|
+
value: toInputValue(value),
|
|
10481
|
+
onValueChange: (nextValue) => setField(field.name, nextValue),
|
|
10482
|
+
children: [
|
|
10483
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectTrigger2, { id: `form-reports-${field.name}`, children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue2, { placeholder: (_a = field.placeholder) != null ? _a : `Select ${field.label}` }) }),
|
|
10484
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent2, { children: ((_b = field.options) != null ? _b : []).map((option) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem2, { value: option.value, children: option.label }, option.value)) })
|
|
10485
|
+
]
|
|
10486
|
+
}
|
|
10487
|
+
) : null,
|
|
10488
|
+
field.type === "boolean" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 rounded-md border px-3 py-2", children: [
|
|
10489
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
10490
|
+
Checkbox2,
|
|
10502
10491
|
{
|
|
10503
10492
|
id: `form-reports-${field.name}`,
|
|
10504
|
-
|
|
10505
|
-
|
|
10506
|
-
|
|
10507
|
-
onChange: (event) => {
|
|
10508
|
-
const nextValue = field.type === "number" ? event.target.value === "" ? "" : Number(event.target.value) : event.target.value;
|
|
10509
|
-
setField(field.name, nextValue);
|
|
10510
|
-
},
|
|
10511
|
-
onBlur: (event) => {
|
|
10512
|
-
const blurValue = field.type === "number" ? event.target.value === "" ? "" : Number(event.target.value) : event.target.value;
|
|
10513
|
-
onFieldBlur == null ? void 0 : onFieldBlur(field.name, blurValue, values);
|
|
10514
|
-
}
|
|
10493
|
+
checked: Boolean(value),
|
|
10494
|
+
onCheckedChange: (checked) => setField(field.name, Boolean(checked)),
|
|
10495
|
+
onBlur: () => onFieldBlur == null ? void 0 : onFieldBlur(field.name, Boolean(value), values)
|
|
10515
10496
|
}
|
|
10516
|
-
)
|
|
10517
|
-
|
|
10518
|
-
] },
|
|
10519
|
-
|
|
10520
|
-
|
|
10521
|
-
/* @__PURE__ */ jsxRuntime.jsx(Button2, { type: "submit", children: submitLabel }),
|
|
10522
|
-
/* @__PURE__ */ jsxRuntime.jsx(DrawerClose2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10523
|
-
Button2,
|
|
10497
|
+
),
|
|
10498
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label4, { htmlFor: `form-reports-${field.name}`, children: (_c = field.placeholder) != null ? _c : `Enable ${field.label}` })
|
|
10499
|
+
] }) : null,
|
|
10500
|
+
field.type === "text" || field.type === "number" || field.type === "date" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10501
|
+
Input2,
|
|
10524
10502
|
{
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10503
|
+
id: `form-reports-${field.name}`,
|
|
10504
|
+
type: field.type === "text" ? "text" : field.type,
|
|
10505
|
+
value: toInputValue(value),
|
|
10506
|
+
placeholder: field.placeholder,
|
|
10507
|
+
onChange: (event) => {
|
|
10508
|
+
const nextValue = field.type === "number" ? event.target.value === "" ? "" : Number(event.target.value) : event.target.value;
|
|
10509
|
+
setField(field.name, nextValue);
|
|
10530
10510
|
},
|
|
10531
|
-
|
|
10511
|
+
onBlur: (event) => {
|
|
10512
|
+
const blurValue = field.type === "number" ? event.target.value === "" ? "" : Number(event.target.value) : event.target.value;
|
|
10513
|
+
onFieldBlur == null ? void 0 : onFieldBlur(field.name, blurValue, values);
|
|
10514
|
+
}
|
|
10532
10515
|
}
|
|
10533
|
-
)
|
|
10534
|
-
|
|
10516
|
+
) : null,
|
|
10517
|
+
field.description ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: field.description }) : null
|
|
10518
|
+
] }, field.name);
|
|
10519
|
+
}) }) }),
|
|
10520
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DrawerFooter2, { children: [
|
|
10521
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button2, { form: "form-reports-drawer-form", type: "submit", children: submitLabel }),
|
|
10522
|
+
/* @__PURE__ */ jsxRuntime.jsx(DrawerClose2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
10523
|
+
Button2,
|
|
10524
|
+
{
|
|
10525
|
+
type: "button",
|
|
10526
|
+
variant: "outline",
|
|
10527
|
+
onClick: () => {
|
|
10528
|
+
onCancel == null ? void 0 : onCancel();
|
|
10529
|
+
onOpenChange(false);
|
|
10530
|
+
},
|
|
10531
|
+
children: cancelLabel
|
|
10532
|
+
}
|
|
10533
|
+
) })
|
|
10535
10534
|
] })
|
|
10536
10535
|
] }) });
|
|
10537
10536
|
}
|
|
@@ -14540,7 +14539,7 @@ var FormReportsSection = React3__namespace.memo(
|
|
|
14540
14539
|
tableLeftActions,
|
|
14541
14540
|
enableRowSelection
|
|
14542
14541
|
}) => {
|
|
14543
|
-
return /* @__PURE__ */ jsxRuntime.jsx("section", { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14542
|
+
return /* @__PURE__ */ jsxRuntime.jsx("section", { className: "flex min-h-0 flex-1 flex-col overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14544
14543
|
FormReportsTable,
|
|
14545
14544
|
{
|
|
14546
14545
|
items,
|