@dimaan/ui 0.0.0 → 0.0.1
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 +101 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -1
- package/dist/index.d.ts +29 -1
- package/dist/index.js +99 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -150,6 +150,34 @@ declare const HeaderSearch: react.ForwardRefExoticComponent<HeaderSearchProps &
|
|
|
150
150
|
type HeaderTitleProps = HTMLAttributes<HTMLDivElement>;
|
|
151
151
|
declare function HeaderTitle({ className, children, ...props }: HeaderTitleProps): react_jsx_runtime.JSX.Element;
|
|
152
152
|
|
|
153
|
+
type InputVariant = 'default' | 'filled' | 'ghost';
|
|
154
|
+
type InputSize = 'sm' | 'md' | 'lg';
|
|
155
|
+
declare const inputVariantClass: Record<InputVariant, string>;
|
|
156
|
+
declare const inputSizeClass: Record<InputSize, string>;
|
|
157
|
+
declare const inputBaseClass = "group/input relative inline-flex w-full items-center 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-[input:disabled]:pointer-events-none has-[input:disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0";
|
|
158
|
+
|
|
159
|
+
interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size' | 'prefix'> {
|
|
160
|
+
variant?: InputVariant;
|
|
161
|
+
inputSize?: InputSize;
|
|
162
|
+
/** Optional label rendered above the field. */
|
|
163
|
+
label?: ReactNode;
|
|
164
|
+
/** Helper text rendered under the field when not in an error state. */
|
|
165
|
+
helperText?: ReactNode;
|
|
166
|
+
/** Error message — renders in destructive style and sets aria-invalid. */
|
|
167
|
+
error?: ReactNode;
|
|
168
|
+
/** Element rendered before the input (icon, prefix text, etc.). */
|
|
169
|
+
leadingIcon?: ReactNode;
|
|
170
|
+
/** Element rendered after the input (icon, suffix text, etc.). */
|
|
171
|
+
trailingIcon?: ReactNode;
|
|
172
|
+
/** Stretch the wrapper to fill the parent's inline width. Defaults to `true`. */
|
|
173
|
+
fullWidth?: boolean;
|
|
174
|
+
/** Class applied to the outer wrapper that holds the icons + input. */
|
|
175
|
+
wrapperClassName?: string;
|
|
176
|
+
/** Class applied to the field container (`<label>` block). */
|
|
177
|
+
containerClassName?: string;
|
|
178
|
+
}
|
|
179
|
+
declare const Input: react.ForwardRefExoticComponent<InputProps & react.RefAttributes<HTMLInputElement>>;
|
|
180
|
+
|
|
153
181
|
type SidebarProps = HTMLAttributes<HTMLElement>;
|
|
154
182
|
declare function Sidebar({ className, children, ...props }: SidebarProps): react_jsx_runtime.JSX.Element;
|
|
155
183
|
|
|
@@ -318,4 +346,4 @@ declare function useDirection(): Direction;
|
|
|
318
346
|
|
|
319
347
|
declare function cn(...inputs: ClassValue[]): string;
|
|
320
348
|
|
|
321
|
-
export { AppShell, type AppShellBrand, type AppShellNavGroup, type AppShellNavItem, type AppShellNavSection, 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, 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, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, useDashboardLayout, useDirection };
|
|
349
|
+
export { AppShell, type AppShellBrand, type AppShellNavGroup, type AppShellNavItem, type AppShellNavSection, 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 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 };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createContext, forwardRef, Children, isValidElement, cloneElement, useRef, useImperativeHandle, useLayoutEffect, useContext, useState, useCallback, useMemo, useEffect
|
|
1
|
+
import { createContext, forwardRef, Children, isValidElement, cloneElement, useRef, useImperativeHandle, useLayoutEffect, useId, useContext, useState, useCallback, useMemo, useEffect } from 'react';
|
|
2
2
|
import { clsx } from 'clsx';
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
4
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
@@ -750,6 +750,103 @@ var Checkbox = forwardRef(function Checkbox2({
|
|
|
750
750
|
)
|
|
751
751
|
] });
|
|
752
752
|
});
|
|
753
|
+
|
|
754
|
+
// src/components/input/inputVariants.ts
|
|
755
|
+
var inputVariantClass = {
|
|
756
|
+
default: "border border-input bg-background hover:border-ring",
|
|
757
|
+
filled: "border border-transparent bg-muted hover:bg-muted/80",
|
|
758
|
+
ghost: "border border-transparent bg-transparent hover:bg-accent"
|
|
759
|
+
};
|
|
760
|
+
var inputSizeClass = {
|
|
761
|
+
sm: "h-8 rounded-md px-2.5 text-sm gap-1.5",
|
|
762
|
+
md: "h-9 rounded-md px-3 text-sm gap-2",
|
|
763
|
+
lg: "h-11 rounded-md px-4 text-base gap-2.5"
|
|
764
|
+
};
|
|
765
|
+
var inputBaseClass = "group/input relative inline-flex w-full items-center 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-[input:disabled]:pointer-events-none has-[input:disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0";
|
|
766
|
+
var Input = forwardRef(function Input2({
|
|
767
|
+
variant = "default",
|
|
768
|
+
inputSize = "md",
|
|
769
|
+
label,
|
|
770
|
+
helperText,
|
|
771
|
+
error,
|
|
772
|
+
leadingIcon,
|
|
773
|
+
trailingIcon,
|
|
774
|
+
fullWidth = true,
|
|
775
|
+
type = "text",
|
|
776
|
+
id,
|
|
777
|
+
className,
|
|
778
|
+
wrapperClassName,
|
|
779
|
+
containerClassName,
|
|
780
|
+
"aria-invalid": ariaInvalidProp,
|
|
781
|
+
"aria-describedby": ariaDescribedByProp,
|
|
782
|
+
disabled,
|
|
783
|
+
...props
|
|
784
|
+
}, ref) {
|
|
785
|
+
const generatedId = useId();
|
|
786
|
+
const inputId = id ?? generatedId;
|
|
787
|
+
const helperId = `${inputId}-helper`;
|
|
788
|
+
const errorId = `${inputId}-error`;
|
|
789
|
+
const hasError = error !== void 0 && error !== null && error !== false;
|
|
790
|
+
const ariaInvalid = ariaInvalidProp ?? (hasError ? true : void 0);
|
|
791
|
+
const describedByIds = [
|
|
792
|
+
ariaDescribedByProp,
|
|
793
|
+
hasError ? errorId : null,
|
|
794
|
+
!hasError && helperText ? helperId : null
|
|
795
|
+
].filter(Boolean).join(" ");
|
|
796
|
+
const ariaDescribedBy = describedByIds.length > 0 ? describedByIds : void 0;
|
|
797
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex flex-col gap-1.5", fullWidth && "w-full", containerClassName), children: [
|
|
798
|
+
label !== void 0 && label !== null && /* @__PURE__ */ jsx("label", { htmlFor: inputId, className: "text-sm font-medium text-foreground select-none", children: label }),
|
|
799
|
+
/* @__PURE__ */ jsxs(
|
|
800
|
+
"div",
|
|
801
|
+
{
|
|
802
|
+
"data-slot": "input-wrapper",
|
|
803
|
+
className: cn(
|
|
804
|
+
inputBaseClass,
|
|
805
|
+
inputVariantClass[variant],
|
|
806
|
+
inputSizeClass[inputSize],
|
|
807
|
+
wrapperClassName
|
|
808
|
+
),
|
|
809
|
+
"aria-invalid": ariaInvalid,
|
|
810
|
+
"data-disabled": disabled ? "true" : void 0,
|
|
811
|
+
children: [
|
|
812
|
+
leadingIcon ? /* @__PURE__ */ jsx(
|
|
813
|
+
"span",
|
|
814
|
+
{
|
|
815
|
+
"aria-hidden": "true",
|
|
816
|
+
className: "inline-flex h-4 w-4 items-center justify-center text-muted-foreground",
|
|
817
|
+
children: leadingIcon
|
|
818
|
+
}
|
|
819
|
+
) : null,
|
|
820
|
+
/* @__PURE__ */ jsx(
|
|
821
|
+
"input",
|
|
822
|
+
{
|
|
823
|
+
ref,
|
|
824
|
+
id: inputId,
|
|
825
|
+
type,
|
|
826
|
+
disabled,
|
|
827
|
+
"aria-invalid": ariaInvalid,
|
|
828
|
+
"aria-describedby": ariaDescribedBy,
|
|
829
|
+
className: cn(
|
|
830
|
+
"h-full w-full min-w-0 flex-1 bg-transparent outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed",
|
|
831
|
+
className
|
|
832
|
+
),
|
|
833
|
+
...props
|
|
834
|
+
}
|
|
835
|
+
),
|
|
836
|
+
trailingIcon ? /* @__PURE__ */ jsx(
|
|
837
|
+
"span",
|
|
838
|
+
{
|
|
839
|
+
"aria-hidden": "true",
|
|
840
|
+
className: "inline-flex h-4 w-4 items-center justify-center text-muted-foreground",
|
|
841
|
+
children: trailingIcon
|
|
842
|
+
}
|
|
843
|
+
) : null
|
|
844
|
+
]
|
|
845
|
+
}
|
|
846
|
+
),
|
|
847
|
+
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
|
|
848
|
+
] });
|
|
849
|
+
});
|
|
753
850
|
function readDocumentDirection() {
|
|
754
851
|
if (typeof document === "undefined") return "ltr";
|
|
755
852
|
const dir = document.documentElement.getAttribute("dir");
|
|
@@ -1258,6 +1355,6 @@ function SortIndicator({ active, direction }) {
|
|
|
1258
1355
|
return direction === "asc" ? /* @__PURE__ */ jsx(ChevronUp, { "aria-hidden": "true", className }) : /* @__PURE__ */ jsx(ChevronDown, { "aria-hidden": "true", className });
|
|
1259
1356
|
}
|
|
1260
1357
|
|
|
1261
|
-
export { AppShell, Avatar, Button, Checkbox, DashboardContent, DashboardHeader, DashboardLayout, DashboardMain, HeaderActions, HeaderCollapseTrigger, HeaderMobileTrigger, HeaderSearch, HeaderTitle, Sidebar, SidebarFooter, SidebarGroup, SidebarHeader, SidebarNav, SidebarNavGroup, SidebarNavItem, Table, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, useDashboardLayout, useDirection };
|
|
1358
|
+
export { AppShell, Avatar, Button, Checkbox, DashboardContent, DashboardHeader, DashboardLayout, DashboardMain, HeaderActions, HeaderCollapseTrigger, HeaderMobileTrigger, HeaderSearch, HeaderTitle, Input, Sidebar, SidebarFooter, SidebarGroup, SidebarHeader, SidebarNav, SidebarNavGroup, SidebarNavItem, Table, buttonBaseClass, buttonSizeClass, buttonVariantClass, cn, inputBaseClass, inputSizeClass, inputVariantClass, alignClass as tableAlignClass, tableBaseClass, selectedRowClass as tableSelectedRowClass, tableSizeClass, sortIconClass as tableSortIconClass, useDashboardLayout, useDirection };
|
|
1262
1359
|
//# sourceMappingURL=index.js.map
|
|
1263
1360
|
//# sourceMappingURL=index.js.map
|