@dimaan/ui 0.0.3 → 0.0.4

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.cjs CHANGED
@@ -1386,6 +1386,91 @@ function SortIndicator({ active, direction }) {
1386
1386
  return direction === "asc" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronUp, { "aria-hidden": "true", className }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { "aria-hidden": "true", className });
1387
1387
  }
1388
1388
 
1389
+ // src/components/textarea/textareaVariants.ts
1390
+ var textareaVariantClass = {
1391
+ default: "border border-input bg-background hover:border-ring",
1392
+ filled: "border border-transparent bg-muted hover:bg-muted/80",
1393
+ ghost: "border border-transparent bg-transparent hover:bg-accent"
1394
+ };
1395
+ var textareaSizeClass = {
1396
+ sm: "rounded-md px-2.5 py-1.5 text-sm",
1397
+ md: "rounded-md px-3 py-2 text-sm",
1398
+ lg: "rounded-md px-4 py-2.5 text-base"
1399
+ };
1400
+ var textareaResizeClass = {
1401
+ none: "resize-none",
1402
+ vertical: "resize-y",
1403
+ horizontal: "resize-x",
1404
+ both: "resize"
1405
+ };
1406
+ var textareaBaseClass = "group/textarea relative flex w-full text-foreground outline-none transition-[background-color,border-color,box-shadow] focus-within:ring-2 focus-within:ring-ring/40 focus-within:ring-offset-1 focus-within:ring-offset-background aria-[invalid=true]:border-destructive aria-[invalid=true]:focus-within:ring-destructive/40 has-[textarea:disabled]:pointer-events-none has-[textarea:disabled]:opacity-50";
1407
+ var Textarea = react.forwardRef(function Textarea2({
1408
+ variant = "default",
1409
+ textareaSize = "md",
1410
+ resize = "vertical",
1411
+ label,
1412
+ helperText,
1413
+ error,
1414
+ fullWidth = true,
1415
+ rows = 4,
1416
+ id,
1417
+ className,
1418
+ wrapperClassName,
1419
+ containerClassName,
1420
+ "aria-invalid": ariaInvalidProp,
1421
+ "aria-describedby": ariaDescribedByProp,
1422
+ disabled,
1423
+ ...props
1424
+ }, ref) {
1425
+ const generatedId = react.useId();
1426
+ const textareaId = id ?? generatedId;
1427
+ const helperId = `${textareaId}-helper`;
1428
+ const errorId = `${textareaId}-error`;
1429
+ const hasError = error !== void 0 && error !== null && error !== false;
1430
+ const ariaInvalid = ariaInvalidProp ?? (hasError ? true : void 0);
1431
+ const describedByIds = [
1432
+ ariaDescribedByProp,
1433
+ hasError ? errorId : null,
1434
+ !hasError && helperText ? helperId : null
1435
+ ].filter(Boolean).join(" ");
1436
+ const ariaDescribedBy = describedByIds.length > 0 ? describedByIds : void 0;
1437
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("flex flex-col gap-1.5", fullWidth && "w-full", containerClassName), children: [
1438
+ label !== void 0 && label !== null && /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: textareaId, className: "text-sm font-medium text-foreground select-none", children: label }),
1439
+ /* @__PURE__ */ jsxRuntime.jsx(
1440
+ "div",
1441
+ {
1442
+ "data-slot": "textarea-wrapper",
1443
+ className: cn(
1444
+ textareaBaseClass,
1445
+ textareaVariantClass[variant],
1446
+ textareaSizeClass[textareaSize],
1447
+ wrapperClassName
1448
+ ),
1449
+ "aria-invalid": ariaInvalid,
1450
+ "data-disabled": disabled ? "true" : void 0,
1451
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1452
+ "textarea",
1453
+ {
1454
+ ref,
1455
+ id: textareaId,
1456
+ rows,
1457
+ disabled,
1458
+ "aria-invalid": ariaInvalid,
1459
+ "aria-describedby": ariaDescribedBy,
1460
+ className: cn(
1461
+ "w-full min-w-0 flex-1 bg-transparent outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed",
1462
+ textareaResizeClass[resize],
1463
+ className
1464
+ ),
1465
+ ...props
1466
+ }
1467
+ )
1468
+ }
1469
+ ),
1470
+ hasError ? /* @__PURE__ */ jsxRuntime.jsx("p", { id: errorId, className: "text-xs text-destructive", children: error }) : helperText ? /* @__PURE__ */ jsxRuntime.jsx("p", { id: helperId, className: "text-xs text-muted-foreground", children: helperText }) : null
1471
+ ] });
1472
+ });
1473
+
1389
1474
  exports.AppShell = AppShell;
1390
1475
  exports.Avatar = Avatar;
1391
1476
  exports.Button = Button;
@@ -1409,6 +1494,7 @@ exports.SidebarNav = SidebarNav;
1409
1494
  exports.SidebarNavGroup = SidebarNavGroup;
1410
1495
  exports.SidebarNavItem = SidebarNavItem;
1411
1496
  exports.Table = Table;
1497
+ exports.Textarea = Textarea;
1412
1498
  exports.buttonBaseClass = buttonBaseClass;
1413
1499
  exports.buttonSizeClass = buttonSizeClass;
1414
1500
  exports.buttonVariantClass = buttonVariantClass;
@@ -1421,6 +1507,10 @@ exports.tableBaseClass = tableBaseClass;
1421
1507
  exports.tableSelectedRowClass = selectedRowClass;
1422
1508
  exports.tableSizeClass = tableSizeClass;
1423
1509
  exports.tableSortIconClass = sortIconClass;
1510
+ exports.textareaBaseClass = textareaBaseClass;
1511
+ exports.textareaResizeClass = textareaResizeClass;
1512
+ exports.textareaSizeClass = textareaSizeClass;
1513
+ exports.textareaVariantClass = textareaVariantClass;
1424
1514
  exports.useDashboardLayout = useDashboardLayout;
1425
1515
  exports.useDirection = useDirection;
1426
1516
  //# sourceMappingURL=index.cjs.map