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.
@@ -33,7 +33,7 @@ export const FormReportsSection = React.memo<FormReportsSectionProps>(
33
33
  enableRowSelection,
34
34
  }) => {
35
35
  return (
36
- <section>
36
+ <section className="flex min-h-0 flex-1 flex-col overflow-hidden">
37
37
  <FormReportsTable
38
38
  items={items}
39
39
  columns={columns}
@@ -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 === "badge" || renderType === "status") {
272
+ if (renderType === "status") {
273
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
- }
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={`px-2 py-0.5 text-xs font-medium ${statusClass}`}>
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 className="max-h-[90vh] sm:max-h-full flex flex-col">
116
- <DrawerHeader className="gap-1 shrink-0">
115
+ <DrawerContent>
116
+ <DrawerHeader className="gap-1">
117
117
  <DrawerTitle>{title}</DrawerTitle>
118
118
  {description ? <DrawerDescription>{description}</DrawerDescription> : null}
119
119
  </DrawerHeader>
120
-
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">
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
- </div>
206
-
207
- <DrawerFooter className="px-4 py-3 border-t shrink-0">
208
- <Button type="submit">{submitLabel}</Button>
209
- <DrawerClose asChild>
210
- <Button
211
- type="button"
212
- variant="outline"
213
- onClick={() => {
214
- onCancel?.()
215
- onOpenChange(false)
216
- }}
217
- >
218
- {cancelLabel}
219
- </Button>
220
- </DrawerClose>
221
- </DrawerFooter>
222
- </form>
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 === "badge" || renderType === "status") {
9982
+ if (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
+ 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, { className: "max-h-[90vh] sm:max-h-full flex flex-col", children: [
10453
- /* @__PURE__ */ jsxRuntime.jsxs(DrawerHeader2, { className: "gap-1 shrink-0", children: [
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.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) => {
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,
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
- 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);
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
- ) : 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, { className: "px-4 py-3 border-t shrink-0", children: [
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
- type: "button",
10526
- variant: "outline",
10527
- onClick: () => {
10528
- onCancel == null ? void 0 : onCancel();
10529
- onOpenChange(false);
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
- children: cancelLabel
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,