@hyddenlabs/hydn-ui 0.3.0-alpha.188 → 0.3.0-alpha.189

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/dist/index.js CHANGED
@@ -3945,6 +3945,110 @@ function CodeBlock({ code, className = "", showCopy = true }) {
3945
3945
  }
3946
3946
  CodeBlock.displayName = "CodeBlock";
3947
3947
  var code_block_default = CodeBlock;
3948
+ function Input({
3949
+ value,
3950
+ defaultValue,
3951
+ onChange,
3952
+ onFocus,
3953
+ onBlur,
3954
+ placeholder,
3955
+ disabled = false,
3956
+ type = "text",
3957
+ ariaLabel,
3958
+ ref,
3959
+ id,
3960
+ name,
3961
+ required = false,
3962
+ size = "md",
3963
+ width,
3964
+ validationState = "default",
3965
+ autoComplete,
3966
+ maxLength,
3967
+ minLength,
3968
+ pattern,
3969
+ title,
3970
+ readOnly = false
3971
+ }) {
3972
+ const widthClass = width ? inputWidthSizes[width] : "w-full";
3973
+ const inputClasses = `${getInputClasses(size, validationState)} ${widthClass}`.trim();
3974
+ return /* @__PURE__ */ jsx(
3975
+ "input",
3976
+ {
3977
+ type,
3978
+ value,
3979
+ defaultValue,
3980
+ ref,
3981
+ onChange,
3982
+ onFocus,
3983
+ onBlur,
3984
+ placeholder,
3985
+ autoComplete,
3986
+ disabled,
3987
+ "aria-label": ariaLabel,
3988
+ id,
3989
+ name,
3990
+ required,
3991
+ readOnly,
3992
+ maxLength,
3993
+ minLength,
3994
+ pattern,
3995
+ title,
3996
+ "aria-invalid": validationState === "error",
3997
+ className: inputClasses
3998
+ }
3999
+ );
4000
+ }
4001
+ Input.displayName = "Input";
4002
+ var input_default = Input;
4003
+ var containerBaseClasses = "inline-flex items-stretch rounded-lg border shadow-sm bg-background focus-within:ring-2 focus-within:ring-ring/20 transition-colors duration-150 overflow-hidden";
4004
+ var inputResetClasses = [
4005
+ "[&>input]:border-0 [&>input]:shadow-none [&>input]:rounded-none [&>input]:ring-0",
4006
+ "[&>input]:focus:ring-0 [&>input]:focus:border-0 [&>input]:bg-transparent",
4007
+ "[&>input]:flex-1 [&>input]:min-w-0"
4008
+ ].join(" ");
4009
+ var buttonResetClasses = [
4010
+ "[&_button]:rounded-none [&_button]:border-0 [&_button]:shadow-none [&_button]:m-0",
4011
+ "[&_button]:h-full"
4012
+ ].join(" ");
4013
+ function InputGroup({
4014
+ children,
4015
+ prefix,
4016
+ suffix,
4017
+ validationState = "default",
4018
+ disabled = false,
4019
+ className
4020
+ }) {
4021
+ const isTextPrefix = typeof prefix === "string" || typeof prefix === "number";
4022
+ const isTextSuffix = typeof suffix === "string" || typeof suffix === "number";
4023
+ const borderClass = validationState === "default" ? "border-input focus-within:border-ring" : validationBorderClasses[validationState].split(" ")[0];
4024
+ const disabledClass = disabled ? "opacity-50 cursor-not-allowed" : "";
4025
+ const enhancedChild = isValidElement(children) && disabled ? cloneElement(children, { disabled: true }) : children;
4026
+ return /* @__PURE__ */ jsxs(
4027
+ "div",
4028
+ {
4029
+ className: `${containerBaseClasses} ${borderClass} ${inputResetClasses} ${buttonResetClasses} ${disabledClass} ${className ?? ""}`.trim(),
4030
+ children: [
4031
+ prefix && /* @__PURE__ */ jsx(
4032
+ "div",
4033
+ {
4034
+ className: `flex items-center shrink-0 ${isTextPrefix ? "px-3 bg-muted/50 text-muted-foreground text-sm" : "px-3 text-muted-foreground"}`,
4035
+ children: prefix
4036
+ }
4037
+ ),
4038
+ enhancedChild,
4039
+ suffix && /* @__PURE__ */ jsx(
4040
+ "div",
4041
+ {
4042
+ className: isTextSuffix ? "flex items-center px-3 bg-muted/50 text-muted-foreground text-sm shrink-0" : "flex items-stretch shrink-0",
4043
+ children: suffix
4044
+ }
4045
+ )
4046
+ ]
4047
+ }
4048
+ );
4049
+ }
4050
+ InputGroup.displayName = "InputGroup";
4051
+ var input_group_default = InputGroup;
3948
4052
  function Table({
3949
4053
  children,
3950
4054
  className = "",
@@ -4075,15 +4179,41 @@ function EmptyState({ title, description, icon, action, className = "" }) {
4075
4179
  }
4076
4180
  EmptyState.displayName = "EmptyState";
4077
4181
  var empty_state_default = EmptyState;
4078
- function useTable({ data, initialSort, pageSize = 10 }) {
4182
+ function useTable({
4183
+ data,
4184
+ initialSort,
4185
+ pageSize = 10,
4186
+ searchQuery = "",
4187
+ searchKeys
4188
+ }) {
4079
4189
  const [sortConfig, setSortConfig] = useState(
4080
4190
  initialSort ? { key: initialSort.key, direction: initialSort.direction } : null
4081
4191
  );
4082
4192
  const [currentPage, setCurrentPage] = useState(1);
4083
4193
  const [selectedRows, setSelectedRows] = useState(/* @__PURE__ */ new Set());
4194
+ useEffect(() => {
4195
+ setCurrentPage(1);
4196
+ }, [searchQuery]);
4197
+ const filteredData = useMemo(() => {
4198
+ if (!searchQuery || searchQuery.trim() === "") return data;
4199
+ const query = searchQuery.toLowerCase();
4200
+ return data.filter((row) => {
4201
+ if (searchKeys && searchKeys.length > 0) {
4202
+ return searchKeys.some((key) => {
4203
+ const value = row[key];
4204
+ if (value == null) return false;
4205
+ return String(value).toLowerCase().includes(query);
4206
+ });
4207
+ }
4208
+ return Object.values(row).some((value) => {
4209
+ if (value == null) return false;
4210
+ return String(value).toLowerCase().includes(query);
4211
+ });
4212
+ });
4213
+ }, [data, searchQuery, searchKeys]);
4084
4214
  const sortedData = useMemo(() => {
4085
- if (!sortConfig) return data;
4086
- const sorted = [...data].sort((a, b) => {
4215
+ if (!sortConfig) return filteredData;
4216
+ const sorted = [...filteredData].sort((a, b) => {
4087
4217
  const aValue = a[sortConfig.key];
4088
4218
  const bValue = b[sortConfig.key];
4089
4219
  if (aValue === bValue) return 0;
@@ -4095,7 +4225,7 @@ function useTable({ data, initialSort, pageSize = 10 }) {
4095
4225
  return sortConfig.direction === "asc" ? 1 : -1;
4096
4226
  });
4097
4227
  return sorted;
4098
- }, [data, sortConfig]);
4228
+ }, [filteredData, sortConfig]);
4099
4229
  const totalPages = Math.ceil(sortedData.length / pageSize);
4100
4230
  const startIndex = (currentPage - 1) * pageSize;
4101
4231
  const endIndex = startIndex + pageSize;
@@ -4145,6 +4275,7 @@ function useTable({ data, initialSort, pageSize = 10 }) {
4145
4275
  return {
4146
4276
  currentData,
4147
4277
  sortedData,
4278
+ filteredData,
4148
4279
  sortConfig,
4149
4280
  handleSort,
4150
4281
  currentPage,
@@ -4176,6 +4307,10 @@ function DataTable({
4176
4307
  paginated = false,
4177
4308
  pageSize = 10,
4178
4309
  selectable = false,
4310
+ searchable = false,
4311
+ searchKeys,
4312
+ searchPlaceholder = "Search...",
4313
+ onSearchChange,
4179
4314
  actions,
4180
4315
  actionsLabel = "Actions",
4181
4316
  actionsWidth = "w-32",
@@ -4187,14 +4322,24 @@ function DataTable({
4187
4322
  title,
4188
4323
  initialSort
4189
4324
  }) {
4325
+ const [searchQuery, setSearchQuery] = useState("");
4326
+ const handleSearchChange = (value) => {
4327
+ setSearchQuery(value);
4328
+ if (onSearchChange) {
4329
+ onSearchChange(value);
4330
+ }
4331
+ };
4190
4332
  const tableOptions = {
4191
4333
  data,
4192
4334
  initialSort,
4193
- pageSize
4335
+ pageSize,
4336
+ searchQuery,
4337
+ searchKeys
4194
4338
  };
4195
4339
  const {
4196
4340
  currentData,
4197
4341
  sortedData,
4342
+ filteredData,
4198
4343
  sortConfig,
4199
4344
  handleSort,
4200
4345
  currentPage,
@@ -4210,7 +4355,7 @@ function DataTable({
4210
4355
  isAllSelected
4211
4356
  } = useTable(tableOptions);
4212
4357
  const displayData = paginated ? currentData : sortedData;
4213
- const hasHeader = Boolean(title && String(title).length > 0 || headerActions);
4358
+ const hasHeader = Boolean(title && String(title).length > 0 || headerActions || searchable);
4214
4359
  const handleToggleRow = (index) => {
4215
4360
  toggleRow(index);
4216
4361
  if (onSelectionChange) {
@@ -4295,126 +4440,152 @@ function DataTable({
4295
4440
  return /* @__PURE__ */ jsx("div", { className: "border border-border rounded-lg", children: /* @__PURE__ */ jsx(empty_state_default, { title: emptyMessage, icon: emptyIcon, className: "py-12" }) });
4296
4441
  }
4297
4442
  return /* @__PURE__ */ jsxs("div", { className, children: [
4298
- hasHeader && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-3", children: [
4299
- /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-foreground", children: title }),
4300
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: Array.isArray(headerActions) && headerActions.map((act, idx) => /* @__PURE__ */ jsxs(
4301
- button_default,
4302
- {
4303
- onClick: act.onClick,
4304
- variant: act.variant,
4305
- style: act.style,
4306
- size: act.size,
4307
- className: act.className,
4308
- ariaLabel: act.label && act.icon && !act.label ? act.label : void 0,
4309
- children: [
4310
- act.icon ? /* @__PURE__ */ jsx(Icon, { name: act.icon, size: "sm" }) : null,
4311
- act.label
4312
- ]
4313
- },
4314
- idx
4315
- )) })
4316
- ] }),
4317
- /* @__PURE__ */ jsx("div", { className: `${stickyHeader ? "overflow-auto max-h-[600px]" : ""} overflow-x-auto`, children: /* @__PURE__ */ jsxs(Table, { striped, bordered, hoverable, compact, children: [
4318
- /* @__PURE__ */ jsx(TableHeader, { className: stickyHeader ? "sticky top-0 z-10 bg-background shadow-sm" : "", children: /* @__PURE__ */ jsxs(TableRow, { children: [
4319
- selectable && /* @__PURE__ */ jsx(TableHeadCell, { className: "w-12", children: /* @__PURE__ */ jsx(checkbox_default, { checked: isAllSelected, onChange: handleToggleAll, ariaLabel: "Select all rows" }) }),
4320
- columns.map((column) => /* @__PURE__ */ jsx(
4321
- TableHeadCell,
4443
+ hasHeader && /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 mb-3", children: [
4444
+ title && /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-foreground", children: title }),
4445
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
4446
+ searchable && /* @__PURE__ */ jsx("div", { className: "flex-1 max-w-md", children: /* @__PURE__ */ jsx(input_group_default, { prefix: /* @__PURE__ */ jsx(Icon, { name: "search", size: "sm" }), className: "w-full", children: /* @__PURE__ */ jsx(
4447
+ input_default,
4322
4448
  {
4323
- align: column.align,
4324
- className: column.width ? `w-[${column.width}]` : "",
4325
- children: column.sortable !== false && sortable ? /* @__PURE__ */ jsxs(
4326
- "button",
4327
- {
4328
- onClick: () => handleSort(column.key),
4329
- className: "flex items-center gap-1 hover:text-foreground transition-colors font-medium",
4330
- type: "button",
4331
- children: [
4332
- column.label,
4333
- renderSortIcon(column.key)
4334
- ]
4335
- }
4336
- ) : column.label
4337
- },
4338
- String(column.key)
4339
- )),
4340
- actions && /* @__PURE__ */ jsx(TableHeadCell, { align: "center", className: actionsWidth, children: actionsLabel })
4341
- ] }) }),
4342
- /* @__PURE__ */ jsx(TableBody, { children: displayData.map((row, rowIndex) => {
4343
- const actualIndex = paginated ? (currentPage - 1) * pageSize + rowIndex : rowIndex;
4344
- const isSelected = isRowSelected(actualIndex);
4345
- return /* @__PURE__ */ jsxs(
4346
- TableRow,
4449
+ type: "text",
4450
+ value: searchQuery,
4451
+ onChange: (e) => handleSearchChange(e.target.value),
4452
+ placeholder: searchPlaceholder
4453
+ }
4454
+ ) }) }),
4455
+ Array.isArray(headerActions) && headerActions.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: headerActions.map((act, idx) => /* @__PURE__ */ jsxs(
4456
+ button_default,
4347
4457
  {
4348
- selected: isSelected,
4349
- onClick: onRowClick ? () => onRowClick(row, actualIndex) : void 0,
4350
- className: onRowClick ? "cursor-pointer" : "",
4458
+ onClick: act.onClick,
4459
+ variant: act.variant,
4460
+ style: act.style,
4461
+ size: act.size,
4462
+ className: act.className,
4463
+ ariaLabel: act.label && act.icon && !act.label ? act.label : void 0,
4351
4464
  children: [
4352
- selectable && /* @__PURE__ */ jsx(TableCell, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(
4353
- checkbox_default,
4465
+ act.icon ? /* @__PURE__ */ jsx(Icon, { name: act.icon, size: "sm" }) : null,
4466
+ act.label
4467
+ ]
4468
+ },
4469
+ idx
4470
+ )) })
4471
+ ] })
4472
+ ] }),
4473
+ filteredData.length === 0 && searchQuery.trim() ? /* @__PURE__ */ jsx("div", { className: "border border-border rounded-lg", children: /* @__PURE__ */ jsx(
4474
+ empty_state_default,
4475
+ {
4476
+ title: "No results found",
4477
+ description: `No items match "${searchQuery}". Try adjusting your search.`,
4478
+ icon: "search",
4479
+ className: "py-12"
4480
+ }
4481
+ ) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
4482
+ /* @__PURE__ */ jsx("div", { className: `${stickyHeader ? "overflow-auto max-h-[600px]" : ""} overflow-x-auto`, children: /* @__PURE__ */ jsxs(Table, { striped, bordered, hoverable, compact, children: [
4483
+ /* @__PURE__ */ jsx(TableHeader, { className: stickyHeader ? "sticky top-0 z-10 bg-background shadow-sm" : "", children: /* @__PURE__ */ jsxs(TableRow, { children: [
4484
+ selectable && /* @__PURE__ */ jsx(TableHeadCell, { className: "w-12", children: /* @__PURE__ */ jsx(checkbox_default, { checked: isAllSelected, onChange: handleToggleAll, ariaLabel: "Select all rows" }) }),
4485
+ columns.map((column) => /* @__PURE__ */ jsx(
4486
+ TableHeadCell,
4487
+ {
4488
+ align: column.align,
4489
+ className: column.width ? `w-[${column.width}]` : "",
4490
+ children: column.sortable !== false && sortable ? /* @__PURE__ */ jsxs(
4491
+ "button",
4354
4492
  {
4355
- checked: isSelected,
4356
- onChange: () => handleToggleRow(actualIndex),
4357
- ariaLabel: `Select row ${actualIndex + 1}`
4493
+ onClick: () => handleSort(column.key),
4494
+ className: "flex items-center gap-1 hover:text-foreground transition-colors font-medium",
4495
+ type: "button",
4496
+ children: [
4497
+ column.label,
4498
+ renderSortIcon(column.key)
4499
+ ]
4358
4500
  }
4359
- ) }),
4360
- columns.map((column) => {
4361
- const value = row[column.key];
4362
- const content = renderCellContent(value, column, row, actualIndex);
4363
- return /* @__PURE__ */ jsx(TableCell, { align: column.align, wrapText: column.wrapText, children: content }, String(column.key));
4364
- }),
4365
- actions && /* @__PURE__ */ jsx(TableCell, { align: "center", onClick: (e) => e.stopPropagation(), children: (() => {
4366
- let rowActions;
4367
- if (Array.isArray(actions)) {
4368
- rowActions = actions;
4369
- } else {
4370
- const result = actions(row, actualIndex);
4371
- if (Array.isArray(result)) {
4372
- rowActions = result;
4373
- } else {
4374
- return result;
4501
+ ) : column.label
4502
+ },
4503
+ String(column.key)
4504
+ )),
4505
+ actions && /* @__PURE__ */ jsx(TableHeadCell, { align: "center", className: actionsWidth, children: actionsLabel })
4506
+ ] }) }),
4507
+ /* @__PURE__ */ jsx(TableBody, { children: displayData.map((row, rowIndex) => {
4508
+ const actualIndex = paginated ? (currentPage - 1) * pageSize + rowIndex : rowIndex;
4509
+ const isSelected = isRowSelected(actualIndex);
4510
+ return /* @__PURE__ */ jsxs(
4511
+ TableRow,
4512
+ {
4513
+ selected: isSelected,
4514
+ onClick: onRowClick ? () => onRowClick(row, actualIndex) : void 0,
4515
+ className: onRowClick ? "cursor-pointer" : "",
4516
+ children: [
4517
+ selectable && /* @__PURE__ */ jsx(TableCell, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsx(
4518
+ checkbox_default,
4519
+ {
4520
+ checked: isSelected,
4521
+ onChange: () => handleToggleRow(actualIndex),
4522
+ ariaLabel: `Select row ${actualIndex + 1}`
4375
4523
  }
4376
- }
4377
- return /* @__PURE__ */ jsx(stack_default, { direction: "horizontal", spacing: "sm", justify: "center", children: rowActions.map((action, actionIndex) => {
4378
- if (action && typeof action === "object" && "onClick" in action) {
4379
- const actionConfig = action;
4380
- const button = /* @__PURE__ */ jsx(
4381
- icon_button_default,
4382
- {
4383
- icon: actionConfig.icon,
4384
- iconSize: actionConfig.iconSize || "md",
4385
- buttonStyle: "ghost",
4386
- variant: actionConfig.variant || "neutral",
4387
- iconColor: actionConfig.iconColor,
4388
- ariaLabel: actionConfig.label,
4389
- onClick: () => actionConfig.onClick(row, actualIndex)
4390
- },
4391
- actionIndex
4392
- );
4393
- return actionConfig.tooltip ? /* @__PURE__ */ jsx(tooltip_default, { content: actionConfig.tooltip, children: button }, actionIndex) : button;
4524
+ ) }),
4525
+ columns.map((column) => {
4526
+ const value = row[column.key];
4527
+ const content = renderCellContent(value, column, row, actualIndex);
4528
+ return /* @__PURE__ */ jsx(TableCell, { align: column.align, wrapText: column.wrapText, children: content }, String(column.key));
4529
+ }),
4530
+ actions && /* @__PURE__ */ jsx(TableCell, { align: "center", onClick: (e) => e.stopPropagation(), children: (() => {
4531
+ let rowActions;
4532
+ if (Array.isArray(actions)) {
4533
+ rowActions = actions;
4394
4534
  } else {
4395
- return /* @__PURE__ */ jsx("div", { children: action }, actionIndex);
4535
+ const result = actions(row, actualIndex);
4536
+ if (Array.isArray(result)) {
4537
+ rowActions = result;
4538
+ } else {
4539
+ return result;
4540
+ }
4396
4541
  }
4397
- }) });
4398
- })() })
4399
- ]
4400
- },
4401
- actualIndex
4402
- );
4403
- }) })
4404
- ] }) }),
4405
- paginated && totalPages > 1 && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-3 border-t border-border", children: [
4406
- /* @__PURE__ */ jsxs("div", { className: "text-sm text-muted-foreground", children: [
4407
- "Page ",
4408
- currentPage,
4409
- " of ",
4410
- totalPages,
4411
- " (",
4412
- data.length,
4413
- " total rows)"
4414
- ] }),
4415
- /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
4416
- /* @__PURE__ */ jsx(button_default, { size: "sm", style: "outline", onClick: prevPage, disabled: !canPrevPage, children: "Previous" }),
4417
- /* @__PURE__ */ jsx(button_default, { size: "sm", style: "outline", onClick: nextPage, disabled: !canNextPage, children: "Next" })
4542
+ return /* @__PURE__ */ jsx(stack_default, { direction: "horizontal", spacing: "sm", justify: "center", children: rowActions.map((action, actionIndex) => {
4543
+ if (action && typeof action === "object" && "onClick" in action) {
4544
+ const actionConfig = action;
4545
+ const button = /* @__PURE__ */ jsx(
4546
+ icon_button_default,
4547
+ {
4548
+ icon: actionConfig.icon,
4549
+ iconSize: actionConfig.iconSize || "md",
4550
+ buttonStyle: "ghost",
4551
+ variant: actionConfig.variant || "neutral",
4552
+ iconColor: actionConfig.iconColor,
4553
+ ariaLabel: actionConfig.label,
4554
+ onClick: () => actionConfig.onClick(row, actualIndex)
4555
+ },
4556
+ actionIndex
4557
+ );
4558
+ return actionConfig.tooltip ? /* @__PURE__ */ jsx(tooltip_default, { content: actionConfig.tooltip, children: button }, actionIndex) : button;
4559
+ } else {
4560
+ return /* @__PURE__ */ jsx("div", { children: action }, actionIndex);
4561
+ }
4562
+ }) });
4563
+ })() })
4564
+ ]
4565
+ },
4566
+ actualIndex
4567
+ );
4568
+ }) })
4569
+ ] }) }),
4570
+ paginated && totalPages > 1 && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 py-3 border-t border-border", children: [
4571
+ /* @__PURE__ */ jsxs("div", { className: "text-sm text-muted-foreground", children: [
4572
+ "Page ",
4573
+ currentPage,
4574
+ " of ",
4575
+ totalPages,
4576
+ " (",
4577
+ filteredData.length,
4578
+ " ",
4579
+ searchQuery.trim() ? "filtered" : "total",
4580
+ " ",
4581
+ "rows",
4582
+ searchQuery.trim() && data.length !== filteredData.length ? ` of ${data.length}` : "",
4583
+ ")"
4584
+ ] }),
4585
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
4586
+ /* @__PURE__ */ jsx(button_default, { size: "sm", style: "outline", onClick: prevPage, disabled: !canPrevPage, children: "Previous" }),
4587
+ /* @__PURE__ */ jsx(button_default, { size: "sm", style: "outline", onClick: nextPage, disabled: !canNextPage, children: "Next" })
4588
+ ] })
4418
4589
  ] })
4419
4590
  ] })
4420
4591
  ] });
@@ -5612,61 +5783,6 @@ function FormField({
5612
5783
  }
5613
5784
  FormField.displayName = "FormField";
5614
5785
  var form_field_default = FormField;
5615
- function Input({
5616
- value,
5617
- defaultValue,
5618
- onChange,
5619
- onFocus,
5620
- onBlur,
5621
- placeholder,
5622
- disabled = false,
5623
- type = "text",
5624
- ariaLabel,
5625
- ref,
5626
- id,
5627
- name,
5628
- required = false,
5629
- size = "md",
5630
- width,
5631
- validationState = "default",
5632
- autoComplete,
5633
- maxLength,
5634
- minLength,
5635
- pattern,
5636
- title,
5637
- readOnly = false
5638
- }) {
5639
- const widthClass = width ? inputWidthSizes[width] : "w-full";
5640
- const inputClasses = `${getInputClasses(size, validationState)} ${widthClass}`.trim();
5641
- return /* @__PURE__ */ jsx(
5642
- "input",
5643
- {
5644
- type,
5645
- value,
5646
- defaultValue,
5647
- ref,
5648
- onChange,
5649
- onFocus,
5650
- onBlur,
5651
- placeholder,
5652
- autoComplete,
5653
- disabled,
5654
- "aria-label": ariaLabel,
5655
- id,
5656
- name,
5657
- required,
5658
- readOnly,
5659
- maxLength,
5660
- minLength,
5661
- pattern,
5662
- title,
5663
- "aria-invalid": validationState === "error",
5664
- className: inputClasses
5665
- }
5666
- );
5667
- }
5668
- Input.displayName = "Input";
5669
- var input_default = Input;
5670
5786
  function FormInput({
5671
5787
  // FormField props
5672
5788
  label,
@@ -5866,55 +5982,6 @@ function FormTextarea({
5866
5982
  }
5867
5983
  FormTextarea.displayName = "FormTextarea";
5868
5984
  var form_textarea_default = FormTextarea;
5869
- var containerBaseClasses = "inline-flex items-stretch rounded-lg border shadow-sm bg-background focus-within:ring-2 focus-within:ring-ring/20 transition-colors duration-150 overflow-hidden";
5870
- var inputResetClasses = [
5871
- "[&>input]:border-0 [&>input]:shadow-none [&>input]:rounded-none [&>input]:ring-0",
5872
- "[&>input]:focus:ring-0 [&>input]:focus:border-0 [&>input]:bg-transparent",
5873
- "[&>input]:flex-1 [&>input]:min-w-0"
5874
- ].join(" ");
5875
- var buttonResetClasses = [
5876
- "[&_button]:rounded-none [&_button]:border-0 [&_button]:shadow-none [&_button]:m-0",
5877
- "[&_button]:h-full"
5878
- ].join(" ");
5879
- function InputGroup({
5880
- children,
5881
- prefix,
5882
- suffix,
5883
- validationState = "default",
5884
- disabled = false,
5885
- className
5886
- }) {
5887
- const isTextPrefix = typeof prefix === "string" || typeof prefix === "number";
5888
- const isTextSuffix = typeof suffix === "string" || typeof suffix === "number";
5889
- const borderClass = validationState === "default" ? "border-input focus-within:border-ring" : validationBorderClasses[validationState].split(" ")[0];
5890
- const disabledClass = disabled ? "opacity-50 cursor-not-allowed" : "";
5891
- const enhancedChild = isValidElement(children) && disabled ? cloneElement(children, { disabled: true }) : children;
5892
- return /* @__PURE__ */ jsxs(
5893
- "div",
5894
- {
5895
- className: `${containerBaseClasses} ${borderClass} ${inputResetClasses} ${buttonResetClasses} ${disabledClass} ${className ?? ""}`.trim(),
5896
- children: [
5897
- prefix && /* @__PURE__ */ jsx(
5898
- "div",
5899
- {
5900
- className: `flex items-center shrink-0 ${isTextPrefix ? "px-3 bg-muted/50 text-muted-foreground text-sm" : "px-3 text-muted-foreground"}`,
5901
- children: prefix
5902
- }
5903
- ),
5904
- enhancedChild,
5905
- suffix && /* @__PURE__ */ jsx(
5906
- "div",
5907
- {
5908
- className: isTextSuffix ? "flex items-center px-3 bg-muted/50 text-muted-foreground text-sm shrink-0" : "flex items-stretch shrink-0",
5909
- children: suffix
5910
- }
5911
- )
5912
- ]
5913
- }
5914
- );
5915
- }
5916
- InputGroup.displayName = "InputGroup";
5917
- var input_group_default = InputGroup;
5918
5985
  function MultiSelect({
5919
5986
  options,
5920
5987
  value = [],