@andreagiugni/tailwind-dashboard-ui 0.5.9 → 0.5.10

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/README.md CHANGED
@@ -168,7 +168,7 @@ Legend: **(+native)** = also extends the element's native HTML attributes.
168
168
  | `Avatar` | `src`, `alt`, `size` (xsmall…xxlarge), `status` (online/offline/busy/none), `statusColor?`, (+native img) |
169
169
  | `AvatarText` | `children`, `className`, (+native div) |
170
170
  | `Dropdown` | `isOpen`, `onClose`, `children`, (+native div) |
171
- | `DropdownItem` | `variant` (default/primary/outline, like Button), `bgColor`/`textColor`/`borderColor` overrides, `tag` (a/button), `href`, `onClick`, `onItemClick`, `baseClassName` (full override) |
171
+ | `DropdownItem` | `variant` (default/primary/outline, like Button), `icon?`, `bgColor`/`textColor`/`borderColor` overrides, `tag` (a/button), `href`, `onClick`, `onItemClick`, `baseClassName` (full override) |
172
172
  | `Modal` | `isOpen`, `onClose`, `showCloseButton`, `isFullscreen`, `closeOnBackdrop?`, `closeOnEsc?`; **alert preset** → `variant` (`success`/`info`/`warning`/`danger`) + `title`, `description`, `actionText?`, `onAction?`; (+native div) |
173
173
  | `Table` (composable) | `TableHeader` / `TableBody` / `TableRow` / `TableCell` with `children`, `isHeader` (cell), (+native table elements; `onClick` / `onDoubleClick` on rows & cells) |
174
174
  | `Table` (data-driven) | pass `data` + `columns` (`key`, `header`, `sortable?`, `align?`, `render?`, `className?`) to get search + per-column sort + pagination: `rowsPerPage?` (max rows/page, default 10), `rowsPerPageOptions?`, `searchKeys?` (**search box shown only when provided**), `searchPlaceholder?`, `defaultSortKey?` / `defaultSortDirection?`, `pagination?`, `paginationAlign?` (`left`/`center`/`right`/`full`, default `right`), `showSizeSelector?`, `onRowClick?`, `getRowId?`, `emptyContent?` |
@@ -200,7 +200,7 @@ Legend: **(+native)** = also extends the element's native HTML attributes.
200
200
  |---|---|
201
201
  | `Input` | `type`, `value` / `defaultValue`, `onChange`, `success`, `error`, `hint`, `disabled`, (+native input) (+override) |
202
202
  | `Label` | `htmlFor`, `children`, (+native label) |
203
- | `Select` | `options`, `placeholder`, `defaultValue`, `onChange(value)`, `disabled` |
203
+ | `Select` | `options` (`{ value, label, icon? }[]`), `placeholder`, `defaultValue`, `onChange(value)`, `disabled` |
204
204
  | `MultiSelect` | `options`, `selected` / `defaultSelected`, `onChange`, `placeholder`, `disabled` |
205
205
  | `Checkbox` | `label`, `checked`, `onChange(checked)`, `disabled`, `checkedColor?` |
206
206
  | `Radio` / `RadioSm` | `id`, `name`, `value`, `checked`, `label`, `onChange(value)`, `disabled` |
package/dist/index.cjs CHANGED
@@ -462,6 +462,7 @@ var DropdownItem = ({
462
462
  onItemClick,
463
463
  variant = "default",
464
464
  baseClassName,
465
+ icon,
465
466
  className,
466
467
  bgColor,
467
468
  textColor,
@@ -477,10 +478,21 @@ var DropdownItem = ({
477
478
  if (onClick) onClick();
478
479
  if (onItemClick) onItemClick();
479
480
  };
481
+ const content = icon ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
482
+ /* @__PURE__ */ jsxRuntime.jsx(
483
+ "span",
484
+ {
485
+ "aria-hidden": "true",
486
+ className: "flex h-5 w-5 shrink-0 items-center justify-center [&>svg]:h-5 [&>svg]:w-5",
487
+ children: icon
488
+ }
489
+ ),
490
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1", children })
491
+ ] }) : children;
480
492
  if (tag === "a" && href) {
481
- return /* @__PURE__ */ jsxRuntime.jsx("a", { href, className: combinedClasses, style, onClick: handleClick, children });
493
+ return /* @__PURE__ */ jsxRuntime.jsx("a", { href, className: combinedClasses, style, onClick: handleClick, children: content });
482
494
  }
483
- return /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: handleClick, className: combinedClasses, style, children });
495
+ return /* @__PURE__ */ jsxRuntime.jsx("button", { onClick: handleClick, className: combinedClasses, style, children: content });
484
496
  };
485
497
  var Dropzone = ({
486
498
  onDrop,
@@ -2549,7 +2561,7 @@ var Select = ({
2549
2561
  onChange(value);
2550
2562
  setIsOpen(false);
2551
2563
  };
2552
- const selectedLabel = options.find((o) => o.value === selectedValue)?.label;
2564
+ const selectedOption = options.find((option) => option.value === selectedValue);
2553
2565
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: rootRef, className: chunkYERNSNT4_cjs.cn("relative w-full", className), children: [
2554
2566
  /* @__PURE__ */ jsxRuntime.jsxs(
2555
2567
  "button",
@@ -2562,10 +2574,20 @@ var Select = ({
2562
2574
  className: chunkYERNSNT4_cjs.cn(
2563
2575
  "flex h-11 w-full items-center justify-between rounded-lg border border-gray-300 bg-white px-4 py-2.5 text-left text-sm shadow-theme-xs transition focus:border-brand-300 focus:outline-hidden focus:ring-3 focus:ring-brand-500/10 dark:border-gray-700 dark:bg-gray-900 dark:focus:border-brand-800",
2564
2576
  disabled && "cursor-not-allowed opacity-50",
2565
- selectedLabel ? "text-gray-800 dark:text-white/90" : "text-gray-400 dark:text-gray-400"
2577
+ selectedOption ? "text-gray-800 dark:text-white/90" : "text-gray-400 dark:text-gray-400"
2566
2578
  ),
2567
2579
  children: [
2568
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: selectedLabel ?? placeholder }),
2580
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [
2581
+ selectedOption?.icon && /* @__PURE__ */ jsxRuntime.jsx(
2582
+ "span",
2583
+ {
2584
+ "aria-hidden": "true",
2585
+ className: "flex h-5 w-5 shrink-0 items-center justify-center [&>svg]:h-4 [&>svg]:w-4",
2586
+ children: selectedOption.icon
2587
+ }
2588
+ ),
2589
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: selectedOption?.label ?? placeholder })
2590
+ ] }),
2569
2591
  /* @__PURE__ */ jsxRuntime.jsx(
2570
2592
  "svg",
2571
2593
  {
@@ -2614,7 +2636,17 @@ var Select = ({
2614
2636
  isSelected ? "bg-brand-50 font-medium text-brand-600 dark:bg-brand-500/15 dark:text-brand-400" : "text-gray-700 dark:text-gray-300"
2615
2637
  ),
2616
2638
  children: [
2617
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: option.label }),
2639
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-center gap-2", children: [
2640
+ option.icon && /* @__PURE__ */ jsxRuntime.jsx(
2641
+ "span",
2642
+ {
2643
+ "aria-hidden": "true",
2644
+ className: "flex h-5 w-5 shrink-0 items-center justify-center [&>svg]:h-4 [&>svg]:w-4",
2645
+ children: option.icon
2646
+ }
2647
+ ),
2648
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: option.label })
2649
+ ] }),
2618
2650
  isSelected && /* @__PURE__ */ jsxRuntime.jsx(
2619
2651
  "svg",
2620
2652
  {