@hyddenlabs/hydn-ui 0.3.0-alpha.166 → 0.3.0-alpha.167
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 +57 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -4
- package/dist/index.d.ts +36 -4
- package/dist/index.js +57 -7
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -850,12 +850,14 @@ type ContainerProps = {
|
|
|
850
850
|
minHeight?: ContainerMinHeightSize;
|
|
851
851
|
/** Maximum height constraint */
|
|
852
852
|
maxHeight?: ContainerMaxHeightSize;
|
|
853
|
+
/** Gap spacing between child elements - uses unified size system */
|
|
854
|
+
gap?: GapSize;
|
|
853
855
|
};
|
|
854
856
|
/**
|
|
855
857
|
* Container layout component with responsive max-width and padding
|
|
856
858
|
* Use align prop to control horizontal alignment (default: center)
|
|
857
859
|
*/
|
|
858
|
-
declare function Container({ id, children, className, padding, marginX: mX, marginY: mY, align, alignItems, width, height, minWidth, maxWidth, minHeight, maxHeight }: Readonly<ContainerProps>): react_jsx_runtime.JSX.Element;
|
|
860
|
+
declare function Container({ id, children, className, padding, marginX: mX, marginY: mY, align, alignItems, width, height, minWidth, maxWidth, minHeight, maxHeight, gap }: Readonly<ContainerProps>): react_jsx_runtime.JSX.Element;
|
|
859
861
|
declare namespace Container {
|
|
860
862
|
var displayName: string;
|
|
861
863
|
}
|
|
@@ -3508,6 +3510,8 @@ type FormInputProps = Omit<InputProps, 'validationState'> & {
|
|
|
3508
3510
|
align?: 'left' | 'center' | 'right';
|
|
3509
3511
|
/** Reserve space for error message to prevent layout shift */
|
|
3510
3512
|
reserveMessageSpace?: boolean;
|
|
3513
|
+
/** Debounce delay in milliseconds - when set, onChange will be debounced by this amount */
|
|
3514
|
+
debounce?: number;
|
|
3511
3515
|
};
|
|
3512
3516
|
/**
|
|
3513
3517
|
* FormInput - Input wrapped with FormField for label and error display
|
|
@@ -3540,9 +3544,21 @@ type FormInputProps = Omit<InputProps, 'validationState'> & {
|
|
|
3540
3544
|
*
|
|
3541
3545
|
* // Number with range
|
|
3542
3546
|
* <FormInput label="Age" type="number" min={18} max={120} required />
|
|
3547
|
+
*
|
|
3548
|
+
* // With debounced onChange for search
|
|
3549
|
+
* <FormInput
|
|
3550
|
+
* label="Search"
|
|
3551
|
+
* value={searchQuery}
|
|
3552
|
+
* onChange={(e) => {
|
|
3553
|
+
* setSearchQuery(e.target.value);
|
|
3554
|
+
* fetchSearchResults(e.target.value);
|
|
3555
|
+
* }}
|
|
3556
|
+
* debounce={500}
|
|
3557
|
+
* placeholder="Type to search..."
|
|
3558
|
+
* />
|
|
3543
3559
|
* ```
|
|
3544
3560
|
*/
|
|
3545
|
-
declare function FormInput({ label, helperText, spacing, error, required, disabled, id, pattern, title, width, align, reserveMessageSpace, ...inputProps }: Readonly<FormInputProps>): react_jsx_runtime.JSX.Element;
|
|
3561
|
+
declare function FormInput({ label, helperText, spacing, error, required, disabled, id, pattern, title, width, align, reserveMessageSpace, debounce, onChange, ...inputProps }: Readonly<FormInputProps>): react_jsx_runtime.JSX.Element;
|
|
3546
3562
|
declare namespace FormInput {
|
|
3547
3563
|
var displayName: string;
|
|
3548
3564
|
}
|
|
@@ -3683,6 +3699,8 @@ type FormTextareaProps = Omit<TextareaProps, 'validationState'> & {
|
|
|
3683
3699
|
spacing?: FormSpacing;
|
|
3684
3700
|
/** Error message to display */
|
|
3685
3701
|
error?: string;
|
|
3702
|
+
/** Debounce delay in milliseconds - when set, onChange will be debounced by this amount */
|
|
3703
|
+
debounce?: number;
|
|
3686
3704
|
};
|
|
3687
3705
|
/**
|
|
3688
3706
|
* FormTextarea - Textarea wrapped with FormField for label and error display
|
|
@@ -3695,9 +3713,21 @@ type FormTextareaProps = Omit<TextareaProps, 'validationState'> & {
|
|
|
3695
3713
|
* required
|
|
3696
3714
|
* minLength={10}
|
|
3697
3715
|
* />
|
|
3716
|
+
*
|
|
3717
|
+
* // With debounced onChange for auto-save
|
|
3718
|
+
* <FormTextarea
|
|
3719
|
+
* label="Notes"
|
|
3720
|
+
* value={notes}
|
|
3721
|
+
* onChange={(e) => {
|
|
3722
|
+
* setNotes(e.target.value);
|
|
3723
|
+
* autoSaveNotes(e.target.value);
|
|
3724
|
+
* }}
|
|
3725
|
+
* debounce={1000}
|
|
3726
|
+
* placeholder="Type your notes..."
|
|
3727
|
+
* />
|
|
3698
3728
|
* ```
|
|
3699
3729
|
*/
|
|
3700
|
-
declare function FormTextarea({ label, helperText, spacing, error, required, disabled, id, ...textareaProps }: Readonly<FormTextareaProps>): react_jsx_runtime.JSX.Element;
|
|
3730
|
+
declare function FormTextarea({ label, helperText, spacing, error, required, disabled, id, debounce, onChange, ...textareaProps }: Readonly<FormTextareaProps>): react_jsx_runtime.JSX.Element;
|
|
3701
3731
|
declare namespace FormTextarea {
|
|
3702
3732
|
var displayName: string;
|
|
3703
3733
|
}
|
|
@@ -3713,6 +3743,8 @@ type InputGroupProps = {
|
|
|
3713
3743
|
validationState?: ValidationState$2;
|
|
3714
3744
|
/** Disables the input group */
|
|
3715
3745
|
disabled?: boolean;
|
|
3746
|
+
/** Additional CSS classes for the input group container */
|
|
3747
|
+
className?: string;
|
|
3716
3748
|
};
|
|
3717
3749
|
/**
|
|
3718
3750
|
* InputGroup - Combines input with prefix/suffix elements
|
|
@@ -3735,7 +3767,7 @@ type InputGroupProps = {
|
|
|
3735
3767
|
* </InputGroup>
|
|
3736
3768
|
* ```
|
|
3737
3769
|
*/
|
|
3738
|
-
declare function InputGroup({ children, prefix, suffix, validationState, disabled }: Readonly<InputGroupProps>): react_jsx_runtime.JSX.Element;
|
|
3770
|
+
declare function InputGroup({ children, prefix, suffix, validationState, disabled, className }: Readonly<InputGroupProps>): react_jsx_runtime.JSX.Element;
|
|
3739
3771
|
declare namespace InputGroup {
|
|
3740
3772
|
var displayName: string;
|
|
3741
3773
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -850,12 +850,14 @@ type ContainerProps = {
|
|
|
850
850
|
minHeight?: ContainerMinHeightSize;
|
|
851
851
|
/** Maximum height constraint */
|
|
852
852
|
maxHeight?: ContainerMaxHeightSize;
|
|
853
|
+
/** Gap spacing between child elements - uses unified size system */
|
|
854
|
+
gap?: GapSize;
|
|
853
855
|
};
|
|
854
856
|
/**
|
|
855
857
|
* Container layout component with responsive max-width and padding
|
|
856
858
|
* Use align prop to control horizontal alignment (default: center)
|
|
857
859
|
*/
|
|
858
|
-
declare function Container({ id, children, className, padding, marginX: mX, marginY: mY, align, alignItems, width, height, minWidth, maxWidth, minHeight, maxHeight }: Readonly<ContainerProps>): react_jsx_runtime.JSX.Element;
|
|
860
|
+
declare function Container({ id, children, className, padding, marginX: mX, marginY: mY, align, alignItems, width, height, minWidth, maxWidth, minHeight, maxHeight, gap }: Readonly<ContainerProps>): react_jsx_runtime.JSX.Element;
|
|
859
861
|
declare namespace Container {
|
|
860
862
|
var displayName: string;
|
|
861
863
|
}
|
|
@@ -3508,6 +3510,8 @@ type FormInputProps = Omit<InputProps, 'validationState'> & {
|
|
|
3508
3510
|
align?: 'left' | 'center' | 'right';
|
|
3509
3511
|
/** Reserve space for error message to prevent layout shift */
|
|
3510
3512
|
reserveMessageSpace?: boolean;
|
|
3513
|
+
/** Debounce delay in milliseconds - when set, onChange will be debounced by this amount */
|
|
3514
|
+
debounce?: number;
|
|
3511
3515
|
};
|
|
3512
3516
|
/**
|
|
3513
3517
|
* FormInput - Input wrapped with FormField for label and error display
|
|
@@ -3540,9 +3544,21 @@ type FormInputProps = Omit<InputProps, 'validationState'> & {
|
|
|
3540
3544
|
*
|
|
3541
3545
|
* // Number with range
|
|
3542
3546
|
* <FormInput label="Age" type="number" min={18} max={120} required />
|
|
3547
|
+
*
|
|
3548
|
+
* // With debounced onChange for search
|
|
3549
|
+
* <FormInput
|
|
3550
|
+
* label="Search"
|
|
3551
|
+
* value={searchQuery}
|
|
3552
|
+
* onChange={(e) => {
|
|
3553
|
+
* setSearchQuery(e.target.value);
|
|
3554
|
+
* fetchSearchResults(e.target.value);
|
|
3555
|
+
* }}
|
|
3556
|
+
* debounce={500}
|
|
3557
|
+
* placeholder="Type to search..."
|
|
3558
|
+
* />
|
|
3543
3559
|
* ```
|
|
3544
3560
|
*/
|
|
3545
|
-
declare function FormInput({ label, helperText, spacing, error, required, disabled, id, pattern, title, width, align, reserveMessageSpace, ...inputProps }: Readonly<FormInputProps>): react_jsx_runtime.JSX.Element;
|
|
3561
|
+
declare function FormInput({ label, helperText, spacing, error, required, disabled, id, pattern, title, width, align, reserveMessageSpace, debounce, onChange, ...inputProps }: Readonly<FormInputProps>): react_jsx_runtime.JSX.Element;
|
|
3546
3562
|
declare namespace FormInput {
|
|
3547
3563
|
var displayName: string;
|
|
3548
3564
|
}
|
|
@@ -3683,6 +3699,8 @@ type FormTextareaProps = Omit<TextareaProps, 'validationState'> & {
|
|
|
3683
3699
|
spacing?: FormSpacing;
|
|
3684
3700
|
/** Error message to display */
|
|
3685
3701
|
error?: string;
|
|
3702
|
+
/** Debounce delay in milliseconds - when set, onChange will be debounced by this amount */
|
|
3703
|
+
debounce?: number;
|
|
3686
3704
|
};
|
|
3687
3705
|
/**
|
|
3688
3706
|
* FormTextarea - Textarea wrapped with FormField for label and error display
|
|
@@ -3695,9 +3713,21 @@ type FormTextareaProps = Omit<TextareaProps, 'validationState'> & {
|
|
|
3695
3713
|
* required
|
|
3696
3714
|
* minLength={10}
|
|
3697
3715
|
* />
|
|
3716
|
+
*
|
|
3717
|
+
* // With debounced onChange for auto-save
|
|
3718
|
+
* <FormTextarea
|
|
3719
|
+
* label="Notes"
|
|
3720
|
+
* value={notes}
|
|
3721
|
+
* onChange={(e) => {
|
|
3722
|
+
* setNotes(e.target.value);
|
|
3723
|
+
* autoSaveNotes(e.target.value);
|
|
3724
|
+
* }}
|
|
3725
|
+
* debounce={1000}
|
|
3726
|
+
* placeholder="Type your notes..."
|
|
3727
|
+
* />
|
|
3698
3728
|
* ```
|
|
3699
3729
|
*/
|
|
3700
|
-
declare function FormTextarea({ label, helperText, spacing, error, required, disabled, id, ...textareaProps }: Readonly<FormTextareaProps>): react_jsx_runtime.JSX.Element;
|
|
3730
|
+
declare function FormTextarea({ label, helperText, spacing, error, required, disabled, id, debounce, onChange, ...textareaProps }: Readonly<FormTextareaProps>): react_jsx_runtime.JSX.Element;
|
|
3701
3731
|
declare namespace FormTextarea {
|
|
3702
3732
|
var displayName: string;
|
|
3703
3733
|
}
|
|
@@ -3713,6 +3743,8 @@ type InputGroupProps = {
|
|
|
3713
3743
|
validationState?: ValidationState$2;
|
|
3714
3744
|
/** Disables the input group */
|
|
3715
3745
|
disabled?: boolean;
|
|
3746
|
+
/** Additional CSS classes for the input group container */
|
|
3747
|
+
className?: string;
|
|
3716
3748
|
};
|
|
3717
3749
|
/**
|
|
3718
3750
|
* InputGroup - Combines input with prefix/suffix elements
|
|
@@ -3735,7 +3767,7 @@ type InputGroupProps = {
|
|
|
3735
3767
|
* </InputGroup>
|
|
3736
3768
|
* ```
|
|
3737
3769
|
*/
|
|
3738
|
-
declare function InputGroup({ children, prefix, suffix, validationState, disabled }: Readonly<InputGroupProps>): react_jsx_runtime.JSX.Element;
|
|
3770
|
+
declare function InputGroup({ children, prefix, suffix, validationState, disabled, className }: Readonly<InputGroupProps>): react_jsx_runtime.JSX.Element;
|
|
3739
3771
|
declare namespace InputGroup {
|
|
3740
3772
|
var displayName: string;
|
|
3741
3773
|
}
|
package/dist/index.js
CHANGED
|
@@ -985,7 +985,8 @@ function Container({
|
|
|
985
985
|
minWidth = "none",
|
|
986
986
|
maxWidth = "none",
|
|
987
987
|
minHeight = "none",
|
|
988
|
-
maxHeight = "none"
|
|
988
|
+
maxHeight = "none",
|
|
989
|
+
gap = "none"
|
|
989
990
|
}) {
|
|
990
991
|
const alignClasses2 = {
|
|
991
992
|
start: "mr-auto",
|
|
@@ -1006,6 +1007,7 @@ function Container({
|
|
|
1006
1007
|
const maxWidthClass = maxWidth !== "none" ? containerMaxWidths[maxWidth] : "";
|
|
1007
1008
|
const minHeightClass = minHeight !== "none" ? containerMinHeights[minHeight] : "";
|
|
1008
1009
|
const maxHeightClass = maxHeight !== "none" ? containerMaxHeights[maxHeight] : "";
|
|
1010
|
+
const gapClass = gap !== "none" ? gapSizes[gap] : "";
|
|
1009
1011
|
const dimensionClasses = [widthClass, heightClass, minWidthClass, minHeightClass, maxWidthClass, maxHeightClass].join(" ").trim();
|
|
1010
1012
|
const alignClass = mX === "none" || mX === "auto" ? alignClasses2[align] : "";
|
|
1011
1013
|
const alignItemsClass = alignItems ? alignItemsClasses[alignItems] : "";
|
|
@@ -1019,7 +1021,7 @@ function Container({
|
|
|
1019
1021
|
return /* @__PURE__ */ jsx(
|
|
1020
1022
|
"div",
|
|
1021
1023
|
{
|
|
1022
|
-
className: `${dimensionClasses} ${paddingClass} ${marginXClass} ${marginYClass} ${alignClass} ${alignItemsClass} ${className}`,
|
|
1024
|
+
className: `${dimensionClasses} ${paddingClass} ${marginXClass} ${marginYClass} ${alignClass} ${alignItemsClass} ${gapClass} ${className}`,
|
|
1023
1025
|
style: Object.keys(inlineStyles).length > 0 ? inlineStyles : void 0,
|
|
1024
1026
|
id,
|
|
1025
1027
|
children
|
|
@@ -4960,6 +4962,31 @@ function Input({
|
|
|
4960
4962
|
}
|
|
4961
4963
|
Input.displayName = "Input";
|
|
4962
4964
|
var input_default = Input;
|
|
4965
|
+
function useDebounce(callback, delay) {
|
|
4966
|
+
const timeoutRef = useRef(null);
|
|
4967
|
+
const callbackRef = useRef(callback);
|
|
4968
|
+
useEffect(() => {
|
|
4969
|
+
callbackRef.current = callback;
|
|
4970
|
+
}, [callback]);
|
|
4971
|
+
useEffect(() => {
|
|
4972
|
+
return () => {
|
|
4973
|
+
if (timeoutRef.current) {
|
|
4974
|
+
clearTimeout(timeoutRef.current);
|
|
4975
|
+
}
|
|
4976
|
+
};
|
|
4977
|
+
}, []);
|
|
4978
|
+
return useCallback(
|
|
4979
|
+
(...args) => {
|
|
4980
|
+
if (timeoutRef.current) {
|
|
4981
|
+
clearTimeout(timeoutRef.current);
|
|
4982
|
+
}
|
|
4983
|
+
timeoutRef.current = setTimeout(() => {
|
|
4984
|
+
callbackRef.current(...args);
|
|
4985
|
+
}, delay);
|
|
4986
|
+
},
|
|
4987
|
+
[delay]
|
|
4988
|
+
);
|
|
4989
|
+
}
|
|
4963
4990
|
function FormInput({
|
|
4964
4991
|
// FormField props
|
|
4965
4992
|
label,
|
|
@@ -4974,8 +5001,14 @@ function FormInput({
|
|
|
4974
5001
|
width,
|
|
4975
5002
|
align = "center",
|
|
4976
5003
|
reserveMessageSpace = false,
|
|
5004
|
+
debounce,
|
|
5005
|
+
onChange,
|
|
4977
5006
|
...inputProps
|
|
4978
5007
|
}) {
|
|
5008
|
+
const debouncedOnChange = useDebounce((e) => {
|
|
5009
|
+
onChange?.(e);
|
|
5010
|
+
}, debounce ?? 0);
|
|
5011
|
+
const handleChange = debounce ? debouncedOnChange : onChange;
|
|
4979
5012
|
return /* @__PURE__ */ jsx(
|
|
4980
5013
|
form_field_default,
|
|
4981
5014
|
{
|
|
@@ -4989,7 +5022,18 @@ function FormInput({
|
|
|
4989
5022
|
width,
|
|
4990
5023
|
align,
|
|
4991
5024
|
reserveMessageSpace,
|
|
4992
|
-
children: /* @__PURE__ */ jsx(
|
|
5025
|
+
children: /* @__PURE__ */ jsx(
|
|
5026
|
+
input_default,
|
|
5027
|
+
{
|
|
5028
|
+
...inputProps,
|
|
5029
|
+
onChange: handleChange,
|
|
5030
|
+
required,
|
|
5031
|
+
disabled,
|
|
5032
|
+
id,
|
|
5033
|
+
pattern,
|
|
5034
|
+
title
|
|
5035
|
+
}
|
|
5036
|
+
)
|
|
4993
5037
|
}
|
|
4994
5038
|
);
|
|
4995
5039
|
}
|
|
@@ -5128,9 +5172,14 @@ function FormTextarea({
|
|
|
5128
5172
|
required,
|
|
5129
5173
|
disabled,
|
|
5130
5174
|
id,
|
|
5131
|
-
|
|
5175
|
+
debounce,
|
|
5176
|
+
onChange,
|
|
5132
5177
|
...textareaProps
|
|
5133
5178
|
}) {
|
|
5179
|
+
const debouncedOnChange = useDebounce((e) => {
|
|
5180
|
+
onChange?.(e);
|
|
5181
|
+
}, debounce ?? 0);
|
|
5182
|
+
const handleChange = debounce ? debouncedOnChange : onChange;
|
|
5134
5183
|
return /* @__PURE__ */ jsx(
|
|
5135
5184
|
form_field_default,
|
|
5136
5185
|
{
|
|
@@ -5141,7 +5190,7 @@ function FormTextarea({
|
|
|
5141
5190
|
required,
|
|
5142
5191
|
disabled,
|
|
5143
5192
|
id,
|
|
5144
|
-
children: /* @__PURE__ */ jsx(textarea_default, { ...textareaProps, required, disabled, id })
|
|
5193
|
+
children: /* @__PURE__ */ jsx(textarea_default, { ...textareaProps, onChange: handleChange, required, disabled, id })
|
|
5145
5194
|
}
|
|
5146
5195
|
);
|
|
5147
5196
|
}
|
|
@@ -5162,7 +5211,8 @@ function InputGroup({
|
|
|
5162
5211
|
prefix,
|
|
5163
5212
|
suffix,
|
|
5164
5213
|
validationState = "default",
|
|
5165
|
-
disabled = false
|
|
5214
|
+
disabled = false,
|
|
5215
|
+
className
|
|
5166
5216
|
}) {
|
|
5167
5217
|
const isTextPrefix = typeof prefix === "string" || typeof prefix === "number";
|
|
5168
5218
|
const isTextSuffix = typeof suffix === "string" || typeof suffix === "number";
|
|
@@ -5172,7 +5222,7 @@ function InputGroup({
|
|
|
5172
5222
|
return /* @__PURE__ */ jsxs(
|
|
5173
5223
|
"div",
|
|
5174
5224
|
{
|
|
5175
|
-
className: `${containerBaseClasses} ${borderClass} ${inputResetClasses} ${buttonResetClasses} ${disabledClass}`.trim(),
|
|
5225
|
+
className: `${containerBaseClasses} ${borderClass} ${inputResetClasses} ${buttonResetClasses} ${disabledClass} ${className ?? ""}`.trim(),
|
|
5176
5226
|
children: [
|
|
5177
5227
|
prefix && /* @__PURE__ */ jsx(
|
|
5178
5228
|
"div",
|