ai-design-system 0.1.81 → 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.
@@ -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-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
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
- checked={Boolean(value)}
166
- onCheckedChange={(checked) => setField(field.name, Boolean(checked))}
167
- onBlur={() => onFieldBlur?.(field.name, Boolean(value), values)}
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
- <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">
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 }),
@@ -10449,13 +10449,13 @@ var FormReportsDrawerForm = React3__namespace.memo(
10449
10449
  },
10450
10450
  [onSubmit, values]
10451
10451
  );
10452
- return /* @__PURE__ */ jsxRuntime.jsx(Drawer2, { open, onOpenChange, direction: isMobile ? "bottom" : "right", children: /* @__PURE__ */ jsxRuntime.jsxs(DrawerContent2, { children: [
10453
- /* @__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: [
10454
10454
  /* @__PURE__ */ jsxRuntime.jsx(DrawerTitle2, { children: title }),
10455
10455
  description ? /* @__PURE__ */ jsxRuntime.jsx(DrawerDescription2, { children: description }) : null
10456
10456
  ] }),
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) => {
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
10459
  var _a, _b, _c;
10460
10460
  const value = values[field.name];
10461
10461
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
@@ -10516,8 +10516,8 @@ var FormReportsDrawerForm = React3__namespace.memo(
10516
10516
  ) : null,
10517
10517
  field.description ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: field.description }) : null
10518
10518
  ] }, field.name);
10519
- }),
10520
- /* @__PURE__ */ jsxRuntime.jsxs(DrawerFooter2, { className: "px-0", children: [
10519
+ }) }),
10520
+ /* @__PURE__ */ jsxRuntime.jsxs(DrawerFooter2, { className: "px-4 py-3 border-t shrink-0", children: [
10521
10521
  /* @__PURE__ */ jsxRuntime.jsx(Button2, { type: "submit", children: submitLabel }),
10522
10522
  /* @__PURE__ */ jsxRuntime.jsx(DrawerClose2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
10523
10523
  Button2,