@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 +90 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -2
- package/dist/index.d.ts +30 -2
- package/dist/index.js +86 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { HTMLAttributes, ReactNode, ReactElement, ButtonHTMLAttributes, InputHTMLAttributes, ChangeEvent, FieldsetHTMLAttributes, AnchorHTMLAttributes, Ref } from 'react';
|
|
3
|
+
import { HTMLAttributes, ReactNode, ReactElement, ButtonHTMLAttributes, InputHTMLAttributes, ChangeEvent, FieldsetHTMLAttributes, AnchorHTMLAttributes, Ref, TextareaHTMLAttributes } from 'react';
|
|
4
4
|
import { ClassValue } from 'clsx';
|
|
5
5
|
|
|
6
6
|
interface DashboardLayoutContextValue {
|
|
@@ -355,9 +355,37 @@ interface TableProps<T> {
|
|
|
355
355
|
|
|
356
356
|
declare function Table<T>(props: TableProps<T>): react_jsx_runtime.JSX.Element;
|
|
357
357
|
|
|
358
|
+
type TextareaVariant = 'default' | 'filled' | 'ghost';
|
|
359
|
+
type TextareaSize = 'sm' | 'md' | 'lg';
|
|
360
|
+
type TextareaResize = 'none' | 'vertical' | 'horizontal' | 'both';
|
|
361
|
+
declare const textareaVariantClass: Record<TextareaVariant, string>;
|
|
362
|
+
declare const textareaSizeClass: Record<TextareaSize, string>;
|
|
363
|
+
declare const textareaResizeClass: Record<TextareaResize, string>;
|
|
364
|
+
declare const 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";
|
|
365
|
+
|
|
366
|
+
interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> {
|
|
367
|
+
variant?: TextareaVariant;
|
|
368
|
+
textareaSize?: TextareaSize;
|
|
369
|
+
/** Controls the native CSS `resize` behaviour. Defaults to `'vertical'`. */
|
|
370
|
+
resize?: TextareaResize;
|
|
371
|
+
/** Optional label rendered above the field. */
|
|
372
|
+
label?: ReactNode;
|
|
373
|
+
/** Helper text rendered under the field when not in an error state. */
|
|
374
|
+
helperText?: ReactNode;
|
|
375
|
+
/** Error message — renders in destructive style and sets aria-invalid. */
|
|
376
|
+
error?: ReactNode;
|
|
377
|
+
/** Stretch the wrapper to fill the parent's inline width. Defaults to `true`. */
|
|
378
|
+
fullWidth?: boolean;
|
|
379
|
+
/** Class applied to the outer wrapper that frames the textarea. */
|
|
380
|
+
wrapperClassName?: string;
|
|
381
|
+
/** Class applied to the field container (`<label>` block). */
|
|
382
|
+
containerClassName?: string;
|
|
383
|
+
}
|
|
384
|
+
declare const Textarea: react.ForwardRefExoticComponent<TextareaProps & react.RefAttributes<HTMLTextAreaElement>>;
|
|
385
|
+
|
|
358
386
|
type Direction = 'ltr' | 'rtl';
|
|
359
387
|
declare function useDirection(): Direction;
|
|
360
388
|
|
|
361
389
|
declare function cn(...inputs: ClassValue[]): string;
|
|
362
390
|
|
|
363
|
-
export { AppShell, type AppShellBrand, type AppShellNavGroup, type AppShellNavItem, type AppShellProps, Avatar, type AvatarProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, type CheckboxSize, type Column, type ColumnAlign, DashboardContent, type DashboardContentProps, DashboardHeader, type DashboardHeaderProps, DashboardLayout, type DashboardLayoutContextValue, type DashboardLayoutProps, DashboardMain, type DashboardMainProps, type Direction, HeaderActions, type HeaderActionsProps, HeaderCollapseTrigger, type HeaderCollapseTriggerProps, HeaderMobileTrigger, type HeaderMobileTriggerProps, HeaderSearch, type HeaderSearchProps, HeaderTitle, type HeaderTitleProps, Input, type InputProps, type InputSize, type InputVariant, type LanguageOption, LanguageSwitcher, type LanguageSwitcherProps, type PaginationState, type RowSelectionState, Sidebar, SidebarFooter, type SidebarFooterProps, SidebarGroup, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarNav, SidebarNavGroup, type SidebarNavGroupProps, SidebarNavItem, type SidebarNavItemProps, type SidebarNavItemRenderProps, type SidebarNavProps, type SidebarProps, type SortDirection, type SortState, type SortableValue, Table, type TableProps, type TableSize, type TableSizeClasses, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, inputBaseClass, inputSizeClass, inputVariantClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, useDashboardLayout, useDirection };
|
|
391
|
+
export { AppShell, type AppShellBrand, type AppShellNavGroup, type AppShellNavItem, type AppShellProps, Avatar, type AvatarProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, type CheckboxSize, type Column, type ColumnAlign, DashboardContent, type DashboardContentProps, DashboardHeader, type DashboardHeaderProps, DashboardLayout, type DashboardLayoutContextValue, type DashboardLayoutProps, DashboardMain, type DashboardMainProps, type Direction, HeaderActions, type HeaderActionsProps, HeaderCollapseTrigger, type HeaderCollapseTriggerProps, HeaderMobileTrigger, type HeaderMobileTriggerProps, HeaderSearch, type HeaderSearchProps, HeaderTitle, type HeaderTitleProps, Input, type InputProps, type InputSize, type InputVariant, type LanguageOption, LanguageSwitcher, type LanguageSwitcherProps, type PaginationState, type RowSelectionState, Sidebar, SidebarFooter, type SidebarFooterProps, SidebarGroup, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarNav, SidebarNavGroup, type SidebarNavGroupProps, SidebarNavItem, type SidebarNavItemProps, type SidebarNavItemRenderProps, type SidebarNavProps, type SidebarProps, type SortDirection, type SortState, type SortableValue, Table, type TableProps, type TableSize, type TableSizeClasses, Textarea, type TextareaProps, type TextareaResize, type TextareaSize, type TextareaVariant, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, inputBaseClass, inputSizeClass, inputVariantClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, textareaBaseClass, textareaResizeClass, textareaSizeClass, textareaVariantClass, useDashboardLayout, useDirection };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { HTMLAttributes, ReactNode, ReactElement, ButtonHTMLAttributes, InputHTMLAttributes, ChangeEvent, FieldsetHTMLAttributes, AnchorHTMLAttributes, Ref } from 'react';
|
|
3
|
+
import { HTMLAttributes, ReactNode, ReactElement, ButtonHTMLAttributes, InputHTMLAttributes, ChangeEvent, FieldsetHTMLAttributes, AnchorHTMLAttributes, Ref, TextareaHTMLAttributes } from 'react';
|
|
4
4
|
import { ClassValue } from 'clsx';
|
|
5
5
|
|
|
6
6
|
interface DashboardLayoutContextValue {
|
|
@@ -355,9 +355,37 @@ interface TableProps<T> {
|
|
|
355
355
|
|
|
356
356
|
declare function Table<T>(props: TableProps<T>): react_jsx_runtime.JSX.Element;
|
|
357
357
|
|
|
358
|
+
type TextareaVariant = 'default' | 'filled' | 'ghost';
|
|
359
|
+
type TextareaSize = 'sm' | 'md' | 'lg';
|
|
360
|
+
type TextareaResize = 'none' | 'vertical' | 'horizontal' | 'both';
|
|
361
|
+
declare const textareaVariantClass: Record<TextareaVariant, string>;
|
|
362
|
+
declare const textareaSizeClass: Record<TextareaSize, string>;
|
|
363
|
+
declare const textareaResizeClass: Record<TextareaResize, string>;
|
|
364
|
+
declare const 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";
|
|
365
|
+
|
|
366
|
+
interface TextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'size'> {
|
|
367
|
+
variant?: TextareaVariant;
|
|
368
|
+
textareaSize?: TextareaSize;
|
|
369
|
+
/** Controls the native CSS `resize` behaviour. Defaults to `'vertical'`. */
|
|
370
|
+
resize?: TextareaResize;
|
|
371
|
+
/** Optional label rendered above the field. */
|
|
372
|
+
label?: ReactNode;
|
|
373
|
+
/** Helper text rendered under the field when not in an error state. */
|
|
374
|
+
helperText?: ReactNode;
|
|
375
|
+
/** Error message — renders in destructive style and sets aria-invalid. */
|
|
376
|
+
error?: ReactNode;
|
|
377
|
+
/** Stretch the wrapper to fill the parent's inline width. Defaults to `true`. */
|
|
378
|
+
fullWidth?: boolean;
|
|
379
|
+
/** Class applied to the outer wrapper that frames the textarea. */
|
|
380
|
+
wrapperClassName?: string;
|
|
381
|
+
/** Class applied to the field container (`<label>` block). */
|
|
382
|
+
containerClassName?: string;
|
|
383
|
+
}
|
|
384
|
+
declare const Textarea: react.ForwardRefExoticComponent<TextareaProps & react.RefAttributes<HTMLTextAreaElement>>;
|
|
385
|
+
|
|
358
386
|
type Direction = 'ltr' | 'rtl';
|
|
359
387
|
declare function useDirection(): Direction;
|
|
360
388
|
|
|
361
389
|
declare function cn(...inputs: ClassValue[]): string;
|
|
362
390
|
|
|
363
|
-
export { AppShell, type AppShellBrand, type AppShellNavGroup, type AppShellNavItem, type AppShellProps, Avatar, type AvatarProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, type CheckboxSize, type Column, type ColumnAlign, DashboardContent, type DashboardContentProps, DashboardHeader, type DashboardHeaderProps, DashboardLayout, type DashboardLayoutContextValue, type DashboardLayoutProps, DashboardMain, type DashboardMainProps, type Direction, HeaderActions, type HeaderActionsProps, HeaderCollapseTrigger, type HeaderCollapseTriggerProps, HeaderMobileTrigger, type HeaderMobileTriggerProps, HeaderSearch, type HeaderSearchProps, HeaderTitle, type HeaderTitleProps, Input, type InputProps, type InputSize, type InputVariant, type LanguageOption, LanguageSwitcher, type LanguageSwitcherProps, type PaginationState, type RowSelectionState, Sidebar, SidebarFooter, type SidebarFooterProps, SidebarGroup, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarNav, SidebarNavGroup, type SidebarNavGroupProps, SidebarNavItem, type SidebarNavItemProps, type SidebarNavItemRenderProps, type SidebarNavProps, type SidebarProps, type SortDirection, type SortState, type SortableValue, Table, type TableProps, type TableSize, type TableSizeClasses, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, inputBaseClass, inputSizeClass, inputVariantClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, useDashboardLayout, useDirection };
|
|
391
|
+
export { AppShell, type AppShellBrand, type AppShellNavGroup, type AppShellNavItem, type AppShellProps, Avatar, type AvatarProps, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Checkbox, type CheckboxProps, type CheckboxSize, type Column, type ColumnAlign, DashboardContent, type DashboardContentProps, DashboardHeader, type DashboardHeaderProps, DashboardLayout, type DashboardLayoutContextValue, type DashboardLayoutProps, DashboardMain, type DashboardMainProps, type Direction, HeaderActions, type HeaderActionsProps, HeaderCollapseTrigger, type HeaderCollapseTriggerProps, HeaderMobileTrigger, type HeaderMobileTriggerProps, HeaderSearch, type HeaderSearchProps, HeaderTitle, type HeaderTitleProps, Input, type InputProps, type InputSize, type InputVariant, type LanguageOption, LanguageSwitcher, type LanguageSwitcherProps, type PaginationState, type RowSelectionState, Sidebar, SidebarFooter, type SidebarFooterProps, SidebarGroup, type SidebarGroupProps, SidebarHeader, type SidebarHeaderProps, SidebarNav, SidebarNavGroup, type SidebarNavGroupProps, SidebarNavItem, type SidebarNavItemProps, type SidebarNavItemRenderProps, type SidebarNavProps, type SidebarProps, type SortDirection, type SortState, type SortableValue, Table, type TableProps, type TableSize, type TableSizeClasses, Textarea, type TextareaProps, type TextareaResize, type TextareaSize, type TextareaVariant, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, inputBaseClass, inputSizeClass, inputVariantClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, textareaBaseClass, textareaResizeClass, textareaSizeClass, textareaVariantClass, useDashboardLayout, useDirection };
|
package/dist/index.js
CHANGED
|
@@ -1384,6 +1384,91 @@ function SortIndicator({ active, direction }) {
|
|
|
1384
1384
|
return direction === "asc" ? /* @__PURE__ */ jsx(ChevronUp, { "aria-hidden": "true", className }) : /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": "true", className });
|
|
1385
1385
|
}
|
|
1386
1386
|
|
|
1387
|
-
|
|
1387
|
+
// src/components/textarea/textareaVariants.ts
|
|
1388
|
+
var textareaVariantClass = {
|
|
1389
|
+
default: "border border-input bg-background hover:border-ring",
|
|
1390
|
+
filled: "border border-transparent bg-muted hover:bg-muted/80",
|
|
1391
|
+
ghost: "border border-transparent bg-transparent hover:bg-accent"
|
|
1392
|
+
};
|
|
1393
|
+
var textareaSizeClass = {
|
|
1394
|
+
sm: "rounded-md px-2.5 py-1.5 text-sm",
|
|
1395
|
+
md: "rounded-md px-3 py-2 text-sm",
|
|
1396
|
+
lg: "rounded-md px-4 py-2.5 text-base"
|
|
1397
|
+
};
|
|
1398
|
+
var textareaResizeClass = {
|
|
1399
|
+
none: "resize-none",
|
|
1400
|
+
vertical: "resize-y",
|
|
1401
|
+
horizontal: "resize-x",
|
|
1402
|
+
both: "resize"
|
|
1403
|
+
};
|
|
1404
|
+
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";
|
|
1405
|
+
var Textarea = forwardRef(function Textarea2({
|
|
1406
|
+
variant = "default",
|
|
1407
|
+
textareaSize = "md",
|
|
1408
|
+
resize = "vertical",
|
|
1409
|
+
label,
|
|
1410
|
+
helperText,
|
|
1411
|
+
error,
|
|
1412
|
+
fullWidth = true,
|
|
1413
|
+
rows = 4,
|
|
1414
|
+
id,
|
|
1415
|
+
className,
|
|
1416
|
+
wrapperClassName,
|
|
1417
|
+
containerClassName,
|
|
1418
|
+
"aria-invalid": ariaInvalidProp,
|
|
1419
|
+
"aria-describedby": ariaDescribedByProp,
|
|
1420
|
+
disabled,
|
|
1421
|
+
...props
|
|
1422
|
+
}, ref) {
|
|
1423
|
+
const generatedId = useId();
|
|
1424
|
+
const textareaId = id ?? generatedId;
|
|
1425
|
+
const helperId = `${textareaId}-helper`;
|
|
1426
|
+
const errorId = `${textareaId}-error`;
|
|
1427
|
+
const hasError = error !== void 0 && error !== null && error !== false;
|
|
1428
|
+
const ariaInvalid = ariaInvalidProp ?? (hasError ? true : void 0);
|
|
1429
|
+
const describedByIds = [
|
|
1430
|
+
ariaDescribedByProp,
|
|
1431
|
+
hasError ? errorId : null,
|
|
1432
|
+
!hasError && helperText ? helperId : null
|
|
1433
|
+
].filter(Boolean).join(" ");
|
|
1434
|
+
const ariaDescribedBy = describedByIds.length > 0 ? describedByIds : void 0;
|
|
1435
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1.5", fullWidth && "w-full", containerClassName), children: [
|
|
1436
|
+
label !== void 0 && label !== null && /* @__PURE__ */ jsx("label", { htmlFor: textareaId, className: "text-sm font-medium text-foreground select-none", children: label }),
|
|
1437
|
+
/* @__PURE__ */ jsx(
|
|
1438
|
+
"div",
|
|
1439
|
+
{
|
|
1440
|
+
"data-slot": "textarea-wrapper",
|
|
1441
|
+
className: cn(
|
|
1442
|
+
textareaBaseClass,
|
|
1443
|
+
textareaVariantClass[variant],
|
|
1444
|
+
textareaSizeClass[textareaSize],
|
|
1445
|
+
wrapperClassName
|
|
1446
|
+
),
|
|
1447
|
+
"aria-invalid": ariaInvalid,
|
|
1448
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
1449
|
+
children: /* @__PURE__ */ jsx(
|
|
1450
|
+
"textarea",
|
|
1451
|
+
{
|
|
1452
|
+
ref,
|
|
1453
|
+
id: textareaId,
|
|
1454
|
+
rows,
|
|
1455
|
+
disabled,
|
|
1456
|
+
"aria-invalid": ariaInvalid,
|
|
1457
|
+
"aria-describedby": ariaDescribedBy,
|
|
1458
|
+
className: cn(
|
|
1459
|
+
"w-full min-w-0 flex-1 bg-transparent outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed",
|
|
1460
|
+
textareaResizeClass[resize],
|
|
1461
|
+
className
|
|
1462
|
+
),
|
|
1463
|
+
...props
|
|
1464
|
+
}
|
|
1465
|
+
)
|
|
1466
|
+
}
|
|
1467
|
+
),
|
|
1468
|
+
hasError ? /* @__PURE__ */ jsx("p", { id: errorId, className: "text-xs text-destructive", children: error }) : helperText ? /* @__PURE__ */ jsx("p", { id: helperId, className: "text-xs text-muted-foreground", children: helperText }) : null
|
|
1469
|
+
] });
|
|
1470
|
+
});
|
|
1471
|
+
|
|
1472
|
+
export { AppShell, Avatar, Button, Checkbox, DashboardContent, DashboardHeader, DashboardLayout, DashboardMain, HeaderActions, HeaderCollapseTrigger, HeaderMobileTrigger, HeaderSearch, HeaderTitle, Input, LanguageSwitcher, Sidebar, SidebarFooter, SidebarGroup, SidebarHeader, SidebarNav, SidebarNavGroup, SidebarNavItem, Table, Textarea, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, inputBaseClass, inputSizeClass, inputVariantClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, textareaBaseClass, textareaResizeClass, textareaSizeClass, textareaVariantClass, useDashboardLayout, useDirection };
|
|
1388
1473
|
//# sourceMappingURL=index.js.map
|
|
1389
1474
|
//# sourceMappingURL=index.js.map
|