ai-design-system 0.1.81 → 0.1.83

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.
@@ -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
  )
@@ -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">
@@ -117,107 +117,109 @@ export const FormReportsDrawerForm = React.memo<FormReportsDrawerFormProps>(
117
117
  <DrawerTitle>{title}</DrawerTitle>
118
118
  {description ? <DrawerDescription>{description}</DrawerDescription> : null}
119
119
  </DrawerHeader>
120
-
121
- <form className="flex flex-col gap-4 overflow-y-auto px-4 text-sm" onSubmit={handleSubmit}>
122
- {fields.map((field) => {
123
- const value = values[field.name]
124
-
125
- return (
126
- <div key={field.name} className="flex flex-col gap-2">
127
- <Label htmlFor={`form-reports-${field.name}`}>
128
- {field.label}
129
- {field.required ? <span className="ml-1 text-destructive">*</span> : null}
130
- </Label>
131
-
132
- {field.type === "textarea" ? (
133
- <Textarea
134
- id={`form-reports-${field.name}`}
135
- value={toInputValue(value)}
136
- placeholder={field.placeholder}
137
- onChange={(event) => setField(field.name, event.target.value)}
138
- onBlur={(event) => onFieldBlur?.(field.name, event.target.value, values)}
139
- rows={4}
140
- />
141
- ) : null}
142
-
143
- {field.type === "select" ? (
144
- <Select
145
- value={toInputValue(value)}
146
- onValueChange={(nextValue) => setField(field.name, nextValue)}
147
- >
148
- <SelectTrigger id={`form-reports-${field.name}`}>
149
- <SelectValue placeholder={field.placeholder ?? `Select ${field.label}`} />
150
- </SelectTrigger>
151
- <SelectContent>
152
- {(field.options ?? []).map((option: FormFieldOption) => (
153
- <SelectItem key={option.value} value={option.value}>
154
- {option.label}
155
- </SelectItem>
156
- ))}
157
- </SelectContent>
158
- </Select>
159
- ) : null}
160
-
161
- {field.type === "boolean" ? (
162
- <div className="flex items-center gap-2 rounded-md border px-3 py-2">
163
- <Checkbox
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}>
122
+ {fields.map((field) => {
123
+ const value = values[field.name]
124
+
125
+ return (
126
+ <div key={field.name} className="flex flex-col gap-2">
127
+ <Label htmlFor={`form-reports-${field.name}`}>
128
+ {field.label}
129
+ {field.required ? <span className="ml-1 text-destructive">*</span> : null}
130
+ </Label>
131
+
132
+ {field.type === "textarea" ? (
133
+ <Textarea
134
+ id={`form-reports-${field.name}`}
135
+ value={toInputValue(value)}
136
+ placeholder={field.placeholder}
137
+ onChange={(event) => setField(field.name, event.target.value)}
138
+ onBlur={(event) => onFieldBlur?.(field.name, event.target.value, values)}
139
+ rows={4}
140
+ />
141
+ ) : null}
142
+
143
+ {field.type === "select" ? (
144
+ <Select
145
+ value={toInputValue(value)}
146
+ onValueChange={(nextValue) => setField(field.name, nextValue)}
147
+ >
148
+ <SelectTrigger id={`form-reports-${field.name}`}>
149
+ <SelectValue placeholder={field.placeholder ?? `Select ${field.label}`} />
150
+ </SelectTrigger>
151
+ <SelectContent>
152
+ {(field.options ?? []).map((option: FormFieldOption) => (
153
+ <SelectItem key={option.value} value={option.value}>
154
+ {option.label}
155
+ </SelectItem>
156
+ ))}
157
+ </SelectContent>
158
+ </Select>
159
+ ) : null}
160
+
161
+ {field.type === "boolean" ? (
162
+ <div className="flex items-center gap-2 rounded-md border px-3 py-2">
163
+ <Checkbox
164
+ id={`form-reports-${field.name}`}
165
+ checked={Boolean(value)}
166
+ onCheckedChange={(checked) => setField(field.name, Boolean(checked))}
167
+ onBlur={() => onFieldBlur?.(field.name, Boolean(value), values)}
168
+ />
169
+ <Label htmlFor={`form-reports-${field.name}`}>{field.placeholder ?? `Enable ${field.label}`}</Label>
170
+ </div>
171
+ ) : null}
172
+
173
+ {field.type === "text" || field.type === "number" || field.type === "date" ? (
174
+ <Input
164
175
  id={`form-reports-${field.name}`}
165
- checked={Boolean(value)}
166
- onCheckedChange={(checked) => setField(field.name, Boolean(checked))}
167
- onBlur={() => onFieldBlur?.(field.name, Boolean(value), values)}
176
+ type={field.type === "text" ? "text" : field.type}
177
+ value={toInputValue(value)}
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
+ }}
168
197
  />
169
- <Label htmlFor={`form-reports-${field.name}`}>{field.placeholder ?? `Enable ${field.label}`}</Label>
170
- </div>
171
- ) : null}
172
-
173
- {field.type === "text" || field.type === "number" || field.type === "date" ? (
174
- <Input
175
- id={`form-reports-${field.name}`}
176
- type={field.type === "text" ? "text" : field.type}
177
- value={toInputValue(value)}
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">
206
- <Button type="submit">{submitLabel}</Button>
207
- <DrawerClose asChild>
208
- <Button
209
- type="button"
210
- variant="outline"
211
- onClick={() => {
212
- onCancel?.()
213
- onOpenChange(false)
214
- }}
215
- >
216
- {cancelLabel}
217
- </Button>
218
- </DrawerClose>
219
- </DrawerFooter>
220
- </form>
198
+ ) : null}
199
+
200
+ {field.description ? <p className="text-xs text-muted-foreground">{field.description}</p> : null}
201
+ </div>
202
+ )
203
+ })}
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>
221
223
  </DrawerContent>
222
224
  </Drawer>
223
225
  )
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 }),
@@ -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)));
@@ -10454,84 +10455,82 @@ var FormReportsDrawerForm = React3__namespace.memo(
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 flex-col gap-4 overflow-y-auto px-4 text-sm", onSubmit: handleSubmit, children: [
10458
- 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-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
  }