@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 CHANGED
@@ -1010,7 +1010,8 @@ function Container({
1010
1010
  minWidth = "none",
1011
1011
  maxWidth = "none",
1012
1012
  minHeight = "none",
1013
- maxHeight = "none"
1013
+ maxHeight = "none",
1014
+ gap = "none"
1014
1015
  }) {
1015
1016
  const alignClasses2 = {
1016
1017
  start: "mr-auto",
@@ -1031,6 +1032,7 @@ function Container({
1031
1032
  const maxWidthClass = maxWidth !== "none" ? containerMaxWidths[maxWidth] : "";
1032
1033
  const minHeightClass = minHeight !== "none" ? containerMinHeights[minHeight] : "";
1033
1034
  const maxHeightClass = maxHeight !== "none" ? containerMaxHeights[maxHeight] : "";
1035
+ const gapClass = gap !== "none" ? gapSizes[gap] : "";
1034
1036
  const dimensionClasses = [widthClass, heightClass, minWidthClass, minHeightClass, maxWidthClass, maxHeightClass].join(" ").trim();
1035
1037
  const alignClass = mX === "none" || mX === "auto" ? alignClasses2[align] : "";
1036
1038
  const alignItemsClass = alignItems ? alignItemsClasses[alignItems] : "";
@@ -1044,7 +1046,7 @@ function Container({
1044
1046
  return /* @__PURE__ */ jsxRuntime.jsx(
1045
1047
  "div",
1046
1048
  {
1047
- className: `${dimensionClasses} ${paddingClass} ${marginXClass} ${marginYClass} ${alignClass} ${alignItemsClass} ${className}`,
1049
+ className: `${dimensionClasses} ${paddingClass} ${marginXClass} ${marginYClass} ${alignClass} ${alignItemsClass} ${gapClass} ${className}`,
1048
1050
  style: Object.keys(inlineStyles).length > 0 ? inlineStyles : void 0,
1049
1051
  id,
1050
1052
  children
@@ -4985,6 +4987,31 @@ function Input({
4985
4987
  }
4986
4988
  Input.displayName = "Input";
4987
4989
  var input_default = Input;
4990
+ function useDebounce(callback, delay) {
4991
+ const timeoutRef = React4.useRef(null);
4992
+ const callbackRef = React4.useRef(callback);
4993
+ React4.useEffect(() => {
4994
+ callbackRef.current = callback;
4995
+ }, [callback]);
4996
+ React4.useEffect(() => {
4997
+ return () => {
4998
+ if (timeoutRef.current) {
4999
+ clearTimeout(timeoutRef.current);
5000
+ }
5001
+ };
5002
+ }, []);
5003
+ return React4.useCallback(
5004
+ (...args) => {
5005
+ if (timeoutRef.current) {
5006
+ clearTimeout(timeoutRef.current);
5007
+ }
5008
+ timeoutRef.current = setTimeout(() => {
5009
+ callbackRef.current(...args);
5010
+ }, delay);
5011
+ },
5012
+ [delay]
5013
+ );
5014
+ }
4988
5015
  function FormInput({
4989
5016
  // FormField props
4990
5017
  label,
@@ -4999,8 +5026,14 @@ function FormInput({
4999
5026
  width,
5000
5027
  align = "center",
5001
5028
  reserveMessageSpace = false,
5029
+ debounce,
5030
+ onChange,
5002
5031
  ...inputProps
5003
5032
  }) {
5033
+ const debouncedOnChange = useDebounce((e) => {
5034
+ onChange?.(e);
5035
+ }, debounce ?? 0);
5036
+ const handleChange = debounce ? debouncedOnChange : onChange;
5004
5037
  return /* @__PURE__ */ jsxRuntime.jsx(
5005
5038
  form_field_default,
5006
5039
  {
@@ -5014,7 +5047,18 @@ function FormInput({
5014
5047
  width,
5015
5048
  align,
5016
5049
  reserveMessageSpace,
5017
- children: /* @__PURE__ */ jsxRuntime.jsx(input_default, { ...inputProps, required, disabled, id, pattern, title })
5050
+ children: /* @__PURE__ */ jsxRuntime.jsx(
5051
+ input_default,
5052
+ {
5053
+ ...inputProps,
5054
+ onChange: handleChange,
5055
+ required,
5056
+ disabled,
5057
+ id,
5058
+ pattern,
5059
+ title
5060
+ }
5061
+ )
5018
5062
  }
5019
5063
  );
5020
5064
  }
@@ -5153,9 +5197,14 @@ function FormTextarea({
5153
5197
  required,
5154
5198
  disabled,
5155
5199
  id,
5156
- // Textarea props
5200
+ debounce,
5201
+ onChange,
5157
5202
  ...textareaProps
5158
5203
  }) {
5204
+ const debouncedOnChange = useDebounce((e) => {
5205
+ onChange?.(e);
5206
+ }, debounce ?? 0);
5207
+ const handleChange = debounce ? debouncedOnChange : onChange;
5159
5208
  return /* @__PURE__ */ jsxRuntime.jsx(
5160
5209
  form_field_default,
5161
5210
  {
@@ -5166,7 +5215,7 @@ function FormTextarea({
5166
5215
  required,
5167
5216
  disabled,
5168
5217
  id,
5169
- children: /* @__PURE__ */ jsxRuntime.jsx(textarea_default, { ...textareaProps, required, disabled, id })
5218
+ children: /* @__PURE__ */ jsxRuntime.jsx(textarea_default, { ...textareaProps, onChange: handleChange, required, disabled, id })
5170
5219
  }
5171
5220
  );
5172
5221
  }
@@ -5187,7 +5236,8 @@ function InputGroup({
5187
5236
  prefix,
5188
5237
  suffix,
5189
5238
  validationState = "default",
5190
- disabled = false
5239
+ disabled = false,
5240
+ className
5191
5241
  }) {
5192
5242
  const isTextPrefix = typeof prefix === "string" || typeof prefix === "number";
5193
5243
  const isTextSuffix = typeof suffix === "string" || typeof suffix === "number";
@@ -5197,7 +5247,7 @@ function InputGroup({
5197
5247
  return /* @__PURE__ */ jsxRuntime.jsxs(
5198
5248
  "div",
5199
5249
  {
5200
- className: `${containerBaseClasses} ${borderClass} ${inputResetClasses} ${buttonResetClasses} ${disabledClass}`.trim(),
5250
+ className: `${containerBaseClasses} ${borderClass} ${inputResetClasses} ${buttonResetClasses} ${disabledClass} ${className ?? ""}`.trim(),
5201
5251
  children: [
5202
5252
  prefix && /* @__PURE__ */ jsxRuntime.jsx(
5203
5253
  "div",