@underverse-ui/underverse 1.0.42 → 1.0.44

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.d.cts CHANGED
@@ -161,6 +161,8 @@ interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size">
161
161
  hint?: string;
162
162
  counter?: boolean;
163
163
  maxLength?: number;
164
+ /** Custom content rendered inside the input container (positioned absolutely) */
165
+ rightAddon?: React__default.ReactNode;
164
166
  }
165
167
  declare const Input: React__default.ForwardRefExoticComponent<InputProps & React__default.RefAttributes<HTMLInputElement>>;
166
168
  interface SearchInputProps extends Omit<InputProps, "leftIcon" | "type"> {
package/dist/index.d.ts CHANGED
@@ -161,6 +161,8 @@ interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "size">
161
161
  hint?: string;
162
162
  counter?: boolean;
163
163
  maxLength?: number;
164
+ /** Custom content rendered inside the input container (positioned absolutely) */
165
+ rightAddon?: React__default.ReactNode;
164
166
  }
165
167
  declare const Input: React__default.ForwardRefExoticComponent<InputProps & React__default.RefAttributes<HTMLInputElement>>;
166
168
  interface SearchInputProps extends Omit<InputProps, "leftIcon" | "type"> {
package/dist/index.js CHANGED
@@ -1533,6 +1533,7 @@ var Input = forwardRef3(
1533
1533
  type = "text",
1534
1534
  value,
1535
1535
  maxLength,
1536
+ rightAddon,
1536
1537
  ...rest
1537
1538
  }, ref) => {
1538
1539
  const [localError, setLocalError] = useState4(error);
@@ -1622,6 +1623,7 @@ var Input = forwardRef3(
1622
1623
  onClear: _onClear,
1623
1624
  hint: _hint,
1624
1625
  counter: _counter,
1626
+ rightAddon: _rightAddon,
1625
1627
  ...restInput
1626
1628
  } = rest;
1627
1629
  const handleFocus = (e) => {
@@ -1764,6 +1766,7 @@ var Input = forwardRef3(
1764
1766
  }
1765
1767
  )
1766
1768
  ] }),
1769
+ rightAddon,
1767
1770
  variant === "minimal" && /* @__PURE__ */ jsx7(
1768
1771
  "div",
1769
1772
  {
@@ -1909,80 +1912,89 @@ var NumberInput = forwardRef3(
1909
1912
  onChange({ target: { value: newValue.toString() } });
1910
1913
  }
1911
1914
  };
1912
- return /* @__PURE__ */ jsxs5("div", { className: "relative", children: [
1915
+ const inputSize = props.size || "md";
1916
+ const stepperSizeStyles = {
1917
+ sm: { width: "w-7", icon: { width: 8, height: 5, path: { up: "M4 1L7 4H1L4 1Z", down: "M4 4L1 1H7L4 4Z" } } },
1918
+ md: { width: "w-9", icon: { width: 10, height: 6, path: { up: "M5 1L9 5H1L5 1Z", down: "M5 5L1 1H9L5 5Z" } } },
1919
+ lg: { width: "w-11", icon: { width: 12, height: 7, path: { up: "M6 1L11 6H1L6 1Z", down: "M6 6L1 1H11L6 6Z" } } }
1920
+ };
1921
+ const ss = stepperSizeStyles[inputSize];
1922
+ const stepperAddon = showSteppers ? /* @__PURE__ */ jsxs5("div", { className: cn("absolute right-0 inset-y-0 flex flex-col border-l border-border rounded-r-full overflow-hidden", ss.width), children: [
1913
1923
  /* @__PURE__ */ jsx7(
1914
- Input,
1924
+ "button",
1915
1925
  {
1916
- ref,
1917
- type: formatThousands ? "text" : "number",
1918
- min,
1919
- max,
1920
- step,
1921
- rightIcon: showSteppers ? void 0 : props.rightIcon,
1922
- value: displayValue,
1923
- onChange: (e) => {
1924
- if (!onChange) return;
1925
- if (!formatThousands) return onChange(e);
1926
- const raw = e.target.value;
1927
- const parsed = parse(raw);
1928
- if (Number.isNaN(parsed)) {
1929
- setDisplayValue("");
1930
- onChange({ target: { value: "" } });
1931
- } else {
1932
- const bounded = Math.min(Math.max(parsed, min ?? -Infinity), max ?? Infinity);
1933
- setDisplayValue(format(bounded));
1934
- onChange({ target: { value: bounded.toString() } });
1935
- }
1936
- },
1937
- ...props,
1926
+ type: "button",
1927
+ onClick: handleIncrement,
1928
+ disabled: max !== void 0 && currentValue >= max,
1938
1929
  className: cn(
1939
- showSteppers && [
1940
- "pr-12",
1941
- // Hide native browser steppers
1942
- "[&::-webkit-outer-spin-button]:appearance-none",
1943
- "[&::-webkit-inner-spin-button]:appearance-none",
1944
- "[&::-webkit-inner-spin-button]:m-0",
1945
- "appearance-none"
1946
- ],
1947
- props.className
1948
- )
1930
+ "flex-1 flex items-center justify-center transition-colors",
1931
+ "hover:bg-accent active:bg-accent/80",
1932
+ "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset",
1933
+ "disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent",
1934
+ "text-muted-foreground hover:text-foreground"
1935
+ ),
1936
+ "aria-label": "Increase value",
1937
+ children: /* @__PURE__ */ jsx7("svg", { width: ss.icon.width, height: ss.icon.height, viewBox: `0 0 ${ss.icon.width} ${ss.icon.height}`, fill: "none", className: "shrink-0", children: /* @__PURE__ */ jsx7("path", { d: ss.icon.path.up, fill: "currentColor" }) })
1949
1938
  }
1950
1939
  ),
1951
- showSteppers && /* @__PURE__ */ jsxs5("div", { className: "absolute right-4 top-1/2 -translate-y-1/7 flex flex-col gap-0.5", children: [
1952
- /* @__PURE__ */ jsx7(
1953
- "button",
1954
- {
1955
- type: "button",
1956
- onClick: handleIncrement,
1957
- disabled: max !== void 0 && currentValue >= max,
1958
- className: cn(
1959
- "flex items-center justify-center w-4 h-4 rounded-md transition-colors",
1960
- "hover:bg-accent focus:outline-none focus:bg-accent",
1961
- "disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",
1962
- "text-muted-foreground hover:text-foreground"
1963
- ),
1964
- "aria-label": "Increase value",
1965
- children: /* @__PURE__ */ jsx7("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", className: "shrink-0", children: /* @__PURE__ */ jsx7("path", { d: "M4 2L6 6H2L4 2Z", fill: "currentColor" }) })
1966
- }
1967
- ),
1968
- /* @__PURE__ */ jsx7(
1969
- "button",
1970
- {
1971
- type: "button",
1972
- onClick: handleDecrement,
1973
- disabled: min !== void 0 && currentValue <= min,
1974
- className: cn(
1975
- "flex items-center justify-center w-4 h-4 rounded-md transition-colors",
1976
- "hover:bg-accent focus:outline-none focus:bg-accent",
1977
- "disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-transparent",
1978
- "text-muted-foreground hover:text-foreground"
1979
- ),
1980
- "aria-label": "Decrease value",
1981
- children: /* @__PURE__ */ jsx7("svg", { width: "8", height: "8", viewBox: "0 0 8 8", fill: "none", className: "shrink-0", children: /* @__PURE__ */ jsx7("path", { d: "M4 6L2 2H6L4 6Z", fill: "currentColor" }) })
1940
+ /* @__PURE__ */ jsx7("div", { className: "h-px bg-border" }),
1941
+ /* @__PURE__ */ jsx7(
1942
+ "button",
1943
+ {
1944
+ type: "button",
1945
+ onClick: handleDecrement,
1946
+ disabled: min !== void 0 && currentValue <= min,
1947
+ className: cn(
1948
+ "flex-1 flex items-center justify-center transition-colors",
1949
+ "hover:bg-accent active:bg-accent/80",
1950
+ "focus:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset",
1951
+ "disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:bg-transparent",
1952
+ "text-muted-foreground hover:text-foreground"
1953
+ ),
1954
+ "aria-label": "Decrease value",
1955
+ children: /* @__PURE__ */ jsx7("svg", { width: ss.icon.width, height: ss.icon.height, viewBox: `0 0 ${ss.icon.width} ${ss.icon.height}`, fill: "none", className: "shrink-0", children: /* @__PURE__ */ jsx7("path", { d: ss.icon.path.down, fill: "currentColor" }) })
1956
+ }
1957
+ )
1958
+ ] }) : void 0;
1959
+ return /* @__PURE__ */ jsx7(
1960
+ Input,
1961
+ {
1962
+ ref,
1963
+ type: formatThousands ? "text" : "number",
1964
+ min,
1965
+ max,
1966
+ step,
1967
+ rightIcon: showSteppers ? void 0 : props.rightIcon,
1968
+ rightAddon: stepperAddon,
1969
+ value: displayValue,
1970
+ onChange: (e) => {
1971
+ if (!onChange) return;
1972
+ if (!formatThousands) return onChange(e);
1973
+ const raw = e.target.value;
1974
+ const parsed = parse(raw);
1975
+ if (Number.isNaN(parsed)) {
1976
+ setDisplayValue("");
1977
+ onChange({ target: { value: "" } });
1978
+ } else {
1979
+ const bounded = Math.min(Math.max(parsed, min ?? -Infinity), max ?? Infinity);
1980
+ setDisplayValue(format(bounded));
1981
+ onChange({ target: { value: bounded.toString() } });
1982
1982
  }
1983
+ },
1984
+ ...props,
1985
+ className: cn(
1986
+ showSteppers && [
1987
+ "pr-12",
1988
+ // Hide native browser steppers
1989
+ "[&::-webkit-outer-spin-button]:appearance-none",
1990
+ "[&::-webkit-inner-spin-button]:appearance-none",
1991
+ "[&::-webkit-inner-spin-button]:m-0",
1992
+ "appearance-none"
1993
+ ],
1994
+ props.className
1983
1995
  )
1984
- ] })
1985
- ] });
1996
+ }
1997
+ );
1986
1998
  }
1987
1999
  );
1988
2000
  NumberInput.displayName = "NumberInput";
@@ -2058,7 +2070,7 @@ var Textarea = forwardRef3(
2058
2070
  onFocus: () => setIsFocused(true),
2059
2071
  onBlur: () => setIsFocused(false),
2060
2072
  className: cn(
2061
- "w-full rounded-2xl px-4 py-3 text-sm text-foreground transition-all duration-200",
2073
+ "w-full rounded-2xl md:rounded-3xl px-4 py-3 text-sm text-foreground transition-all duration-200",
2062
2074
  "placeholder:text-muted-foreground focus:outline-none min-h-20",
2063
2075
  "disabled:cursor-not-allowed disabled:opacity-50",
2064
2076
  variantStyles6[variant],