qstd 0.3.38 → 0.3.40

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.
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/block/checkbox.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAM9B,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,2CAqF5D"}
1
+ {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../src/block/checkbox.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAO9B,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,2CAuF5D"}
@@ -2,6 +2,23 @@ import React from "react";
2
2
  import type { SizeProp } from "@fortawesome/fontawesome-svg-core";
3
3
  import * as _t from "./types";
4
4
  type InternalBlockProps = _t.SharedBlockProps & _t.LoadingProps & Record<string, unknown>;
5
+ /**
6
+ * Check if any of the specified props are defined in the object.
7
+ * Used to conditionally skip default styles when consumer provides overrides.
8
+ *
9
+ * @example
10
+ * const hasLayout = hasAnyProp(rest, ["grid", "flex", "display"]);
11
+ * const hasDebug = hasAnyProp(rest, ["debug"]);
12
+ *
13
+ * return (
14
+ * <Base
15
+ * {...(!hasLayout && { flex: true, alignI: true })}
16
+ * {...(!hasDebug && { border: "1px solid", borderColor: "gray.300" })}
17
+ * {...rest}
18
+ * />
19
+ * );
20
+ */
21
+ export declare function hasAnyProp<T extends Record<string, unknown>>(obj: T, keys: readonly string[]): boolean;
5
22
  /**
6
23
  * Get preview, height, and width of image.
7
24
  * @param f
@@ -1 +1 @@
1
- {"version":3,"file":"fns.d.ts","sourceRoot":"","sources":["../../src/block/fns.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAA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AkIF,eAAO,MAAM,QAAQ,GACnB,SAAS,UAAU,CAAC,OAAO,aAAa,CAAC,EACzC,UAAU,kBAAkB;;;CAgC7B,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,MAAM,EACnC,KAAK,CAAC,EACN,MAAM,SAAS,MAAM,EAAE,KACtB,OAAO,CAAC,CAAC,CAkBX,CAAC;AAuCF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAChC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,CAAC,SAAS,MAAM,CAAC,EACjB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,CAmB5E"}
@@ -1 +1 @@
1
- {"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../src/block/radio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,KAAK,cAAc,GAAG,IAAI,CAAC,EAAE,CAAC,cAAc,EAAE,IAAI,CAAC,GAAG;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAyBF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,2CAqKtD;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,cAAc,2CAkLzC"}
1
+ {"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../src/block/radio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAG9B,KAAK,cAAc,GAAG,IA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,CAAC,KAAK,EAAE,UAAU,2CAwCtC;yBAxCe,KAAK;;;AA+ErB,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/block/switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAG9D,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AA8C9B,KAAK,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,UAAU,CAAA;CAAE,CAAC;AAI5C,KAAK,qBAAqB,GAAG,IAAI,CAC/B,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAClC,kBAAkB,GAClB,gBAAgB,GAChB,sBAAsB,GACtB,iBAAiB,GACjB,QAAQ,GACR,aAAa,GACb,WAAW,CACd,CAAC;AAEF,KAAK,wBAAwB,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,qBAAqB,CAAC,CAAC;AAExE,MAAM,MAAM,UAAU,GAAG,wBAAwB,CAAC,EAAE,CAAC,cAAc,CAAC,GAClE,WAAW,CAAC;AAGd,MAAM,MAAM,UAAU,GAAG,wBAAwB,CAAC,EAAE,CAAC,cAAc,CAAC,GAClE,WAAW,CAAC;AAEd,iBAAS,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC,gBAAgB,2CA8MzC;AAGD,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,2CAqCtC;yBArCe,KAAK;;;AAwCrB,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,2CAwCtC;yBAxCe,KAAK;;;AA+ErB,eAAe,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../src/block/textarea.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAG9B;;;;;;;;;;;;;;GAcG;AAEH,KAAK,UAAU,GAAG;IAChB,KAAK,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAqPF;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,2CA+K5D;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,GAAG,UAAU,2CA6C1D;yBA7Ce,KAAK"}
1
+ {"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../src/block/textarea.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAG9B;;;;;;;;;;;;;;GAcG;AAEH,KAAK,UAAU,GAAG;IAChB,KAAK,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAoPF;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,2CAiL5D;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,GAAG,UAAU,2CA6C1D;yBA7Ce,KAAK"}
@@ -877,6 +877,9 @@ function useOutsideClick(ref, handler, enabled = true) {
877
877
  };
878
878
  }, [ref, handler, enabled]);
879
879
  }
880
+ function hasAnyProp(obj, keys) {
881
+ return keys.some((key) => key in obj && obj[key] !== void 0);
882
+ }
880
883
  var extractImageMetadata = (f) => {
881
884
  return new Promise((res, rej) => {
882
885
  if (!f) rej(new Error("No image file provided."));
@@ -1108,16 +1111,16 @@ var extractElAndStyles = (extract, anyProps) => {
1108
1111
  }
1109
1112
  }
1110
1113
  const cursor = anyProps.isLoading ? "not-allowed" : "pointer";
1111
- const hasGridProp = "grid" in remaining && remaining.grid !== void 0;
1112
- const hasFlexProp = "flex" in remaining && remaining.flex !== void 0;
1113
- const hasDisplayProp = "display" in remaining && remaining.display !== void 0;
1114
- const hasCustomLayout = hasGridProp || hasFlexProp || hasDisplayProp;
1114
+ const hasCustomLayout = hasAnyProp(remaining, ["grid", "flex", "display"]);
1115
+ const hasCustomColor = hasAnyProp(remaining, ["color"]);
1115
1116
  const btnClassName = extract.is === "btn" ? css({
1116
- ...hasCustomLayout ? {} : { display: "flex", alignI: "center" },
1117
+ ...!hasCustomLayout && { display: "flex", alignI: "center" },
1117
1118
  cursor
1118
1119
  }) : "";
1119
1120
  const linkClassName = extract.isLink ? css({
1120
- color: { base: "blue.500", _dark: "blue.400" },
1121
+ ...!hasCustomColor && {
1122
+ color: { base: "blue.500", _dark: "blue.400" }
1123
+ },
1121
1124
  _hover: { textDecoration: "underline" },
1122
1125
  cursor
1123
1126
  }) : "";
@@ -1384,9 +1387,11 @@ function Switch(props) {
1384
1387
  return /* @__PURE__ */ jsxRuntime.jsx(SwitchContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.MotionConfig, { transition: _motion, children: /* @__PURE__ */ jsxRuntime.jsx(
1385
1388
  Button,
1386
1389
  {
1387
- flex: true,
1388
- alignItems: "center",
1389
- justifyContent: "center",
1390
+ ...!hasAnyProp(rest, ["grid", "flex", "display"]) && {
1391
+ justifyContent: "center",
1392
+ alignItems: "center",
1393
+ flex: true
1394
+ },
1390
1395
  px: 1,
1391
1396
  py: 1,
1392
1397
  h: "fit-content",
@@ -1543,8 +1548,8 @@ function Radio(props) {
1543
1548
  options,
1544
1549
  renderOption,
1545
1550
  onKeyDown: onKeyDownProp,
1546
- onAnimationStart,
1547
- onAnimationComplete,
1551
+ onAnimationStart: _onAnimationStart,
1552
+ onAnimationComplete: _onAnimationComplete,
1548
1553
  ...rest
1549
1554
  } = props;
1550
1555
  const groupId = React13__namespace.default.useId();
@@ -1552,7 +1557,7 @@ function Radio(props) {
1552
1557
  const [uncontrolled, setUncontrolled] = React13__namespace.default.useState(
1553
1558
  defaultValue
1554
1559
  );
1555
- const selectedValue = isControlled ? controlledValue : uncontrolled;
1560
+ const selectedValue = isControlled ? controlledValue ?? null : uncontrolled;
1556
1561
  const itemsRef = React13__namespace.default.useRef([]);
1557
1562
  const [activeId, setActiveId] = React13__namespace.default.useState("");
1558
1563
  const setSelectedValue = (val) => {
@@ -1676,37 +1681,33 @@ function Item(props) {
1676
1681
  onClick: onClickProp,
1677
1682
  onFocus: onFocusProp,
1678
1683
  onBlur: onBlurProp,
1679
- onAnimationStart,
1680
- onAnimationComplete,
1684
+ onAnimationStart: _onAnimationStart,
1685
+ onAnimationComplete: _onAnimationComplete,
1681
1686
  ...rest
1682
1687
  } = props;
1683
1688
  const ctx = React13__namespace.default.useContext(RadioContext);
1689
+ const ref = React13__namespace.default.useRef(null);
1690
+ const [isFocused, setIsFocused] = React13__namespace.default.useState(false);
1691
+ const groupDisabled = ctx?.disabled;
1692
+ const disabled = !!(groupDisabled || itemDisabled);
1693
+ const groupId = ctx?.groupId ?? "";
1694
+ const id = `radio-item-${groupId}-${value}`;
1695
+ const registerItem = ctx?.registerItem;
1696
+ const unregisterItem = ctx?.unregisterItem;
1697
+ React13__namespace.default.useEffect(() => {
1698
+ if (!registerItem || !unregisterItem) return;
1699
+ registerItem({ id, value, disabled, ref });
1700
+ return () => unregisterItem(id);
1701
+ }, [id, value, disabled, registerItem, unregisterItem]);
1684
1702
  if (!ctx) {
1685
1703
  return /* @__PURE__ */ jsxRuntime.jsxs(Base2, { flex: true, alignI: true, cursor: "pointer", ...rest, children: [
1686
1704
  /* @__PURE__ */ jsxRuntime.jsx(Base2, { "data-radio-circle": true, w: 24, h: 24, br: 9999, mr: 8 }),
1687
1705
  children
1688
1706
  ] });
1689
1707
  }
1690
- const {
1691
- groupId,
1692
- registerItem,
1693
- unregisterItem,
1694
- selectedValue,
1695
- setSelectedValue,
1696
- isActiveId,
1697
- setActiveById,
1698
- disabled: groupDisabled
1699
- } = ctx;
1700
- const disabled = !!(groupDisabled || itemDisabled);
1701
- const id = `radio-item-${groupId}-${value}`;
1702
- const ref = React13__namespace.default.useRef(null);
1703
- React13__namespace.default.useEffect(() => {
1704
- registerItem({ id, value, disabled, ref });
1705
- return () => unregisterItem(id);
1706
- }, [id, value, disabled]);
1708
+ const { selectedValue, setSelectedValue, isActiveId, setActiveById } = ctx;
1707
1709
  const isSelected = selectedValue === value;
1708
1710
  const isActive = isActiveId(id);
1709
- const [isFocused, setIsFocused] = React13__namespace.default.useState(false);
1710
1711
  const shouldUseGrid = gridProp || !!colsProp;
1711
1712
  const renderLabel = () => {
1712
1713
  const onlyChild = React13__namespace.default.Children.count(children) === 1 ? React13__namespace.default.Children.toArray(children)[0] : null;
@@ -1716,26 +1717,23 @@ function Item(props) {
1716
1717
  if (React13__namespace.default.isValidElement(onlyChild)) {
1717
1718
  return React13__namespace.default.cloneElement(
1718
1719
  onlyChild,
1719
- {
1720
- ...onlyChild.props || {},
1721
- ["data-radio-label"]: true
1722
- }
1720
+ { "data-radio-label": true }
1723
1721
  );
1724
1722
  }
1725
1723
  return /* @__PURE__ */ jsxRuntime.jsx(Base2, { "data-radio-label": true, children });
1726
1724
  };
1725
+ const hasCustomLayout = hasAnyProp(rest, ["flex", "display"]) || gridProp;
1727
1726
  return /* @__PURE__ */ jsxRuntime.jsxs(
1728
1727
  Base2,
1729
1728
  {
1730
1729
  ref,
1731
- flex: true,
1732
- alignI: true,
1733
1730
  outline: "none",
1734
1731
  role: "radio",
1735
1732
  tabIndex: isActive ? 0 : -1,
1736
1733
  "aria-checked": isSelected,
1737
1734
  "aria-disabled": disabled,
1738
- ...shouldUseGrid ? { grid: true } : { flex: true, alignI: true },
1735
+ ...!hasCustomLayout && { flex: true, alignI: true },
1736
+ ...shouldUseGrid && { grid: true },
1739
1737
  ...colsProp && { cols: colsProp },
1740
1738
  gap: shouldUseGrid ? void 0 : "8px",
1741
1739
  cursor: disabled ? "not-allowed" : "pointer",
@@ -1960,11 +1958,11 @@ function Textarea(props) {
1960
1958
  children,
1961
1959
  _motion,
1962
1960
  error,
1963
- onAnimationStart,
1964
- onAnimationComplete,
1961
+ onAnimationStart: _onAnimationStart,
1962
+ onAnimationComplete: _onAnimationComplete,
1965
1963
  ...rest
1966
1964
  } = props;
1967
- const isControlled = rest.value !== void 0;
1965
+ const isControlled = props.value !== void 0;
1968
1966
  const libRef = React13__namespace.default.useRef(null);
1969
1967
  const ref = assignRefs(libRef, userRef);
1970
1968
  const heightRef = React13__namespace.default.useRef(0);
@@ -1979,15 +1977,15 @@ function Textarea(props) {
1979
1977
  value: props.value,
1980
1978
  error
1981
1979
  }) : null;
1982
- const resizeTextarea = () => {
1980
+ const resizeTextarea = React13__namespace.default.useCallback(() => {
1983
1981
  const node = libRef.current;
1984
1982
  if (!node) return;
1985
1983
  const nodeSizingData = getSizingData(node);
1986
1984
  if (!nodeSizingData) return;
1987
- const value2 = node.value || node.placeholder || "x";
1985
+ const nodeValue = node.value || node.placeholder || "x";
1988
1986
  const [height, rowHeight] = calculateNodeHeight(
1989
1987
  nodeSizingData,
1990
- value2,
1988
+ nodeValue,
1991
1989
  minRows,
1992
1990
  maxRows
1993
1991
  );
@@ -1996,7 +1994,7 @@ function Textarea(props) {
1996
1994
  node.style.setProperty("height", `${height}px`, "important");
1997
1995
  onHeightChange?.(height, { rowHeight });
1998
1996
  }
1999
- };
1997
+ }, [minRows, maxRows, onHeightChange]);
2000
1998
  const handleChange = (e) => {
2001
1999
  if (!isControlled) resizeTextarea();
2002
2000
  _setValue(e.target.value);
@@ -2004,20 +2002,20 @@ function Textarea(props) {
2004
2002
  };
2005
2003
  useIsomorphicLayoutEffect(() => {
2006
2004
  resizeTextarea();
2007
- }, [rest.value, rest.placeholder, minRows, maxRows]);
2005
+ }, [rest.value, rest.placeholder, resizeTextarea]);
2008
2006
  React13__namespace.default.useEffect(() => {
2009
2007
  if (!isBrowser) return;
2010
2008
  const onResize = () => resizeTextarea();
2011
2009
  window.addEventListener("resize", onResize);
2012
2010
  return () => window.removeEventListener("resize", onResize);
2013
- }, [minRows, maxRows, rest.placeholder, rest.value]);
2011
+ }, [rest.placeholder, rest.value, resizeTextarea]);
2014
2012
  React13__namespace.default.useEffect(() => {
2015
2013
  const fonts = isBrowser ? document.fonts : void 0;
2016
2014
  if (!fonts || typeof fonts.addEventListener !== "function") return;
2017
2015
  const onFontsLoaded = () => resizeTextarea();
2018
2016
  fonts.addEventListener("loadingdone", onFontsLoaded);
2019
2017
  return () => fonts.removeEventListener("loadingdone", onFontsLoaded);
2020
- }, [minRows, maxRows, rest.placeholder, rest.value]);
2018
+ }, [rest.placeholder, rest.value, resizeTextarea]);
2021
2019
  React13__namespace.default.useEffect(() => {
2022
2020
  const node = libRef.current;
2023
2021
  const form = node?.form;
@@ -2030,9 +2028,9 @@ function Textarea(props) {
2030
2028
  };
2031
2029
  form.addEventListener("reset", onReset);
2032
2030
  return () => form.removeEventListener("reset", onReset);
2033
- }, [isControlled]);
2031
+ }, [isControlled, resizeTextarea]);
2034
2032
  const resize = props.resize ?? "none";
2035
- const hasDebug = "debug" in rest && rest.debug !== void 0;
2033
+ const hasDebug = hasAnyProp(rest, ["debug"]);
2036
2034
  return /* @__PURE__ */ jsxRuntime.jsxs(Base3, { grid: true, rows: "/ 4", children: [
2037
2035
  /* @__PURE__ */ jsxRuntime.jsxs(Base3, { grid: true, relative: true, children: [
2038
2036
  labelWithProps,
@@ -2088,8 +2086,8 @@ function Label(props) {
2088
2086
  error,
2089
2087
  required,
2090
2088
  children,
2091
- onAnimationStart,
2092
- onAnimationComplete,
2089
+ onAnimationStart: _onAnimationStart,
2090
+ onAnimationComplete: _onAnimationComplete,
2093
2091
  ...rest
2094
2092
  } = props;
2095
2093
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2180,7 +2178,7 @@ function Input(props) {
2180
2178
  onAnimationComplete: _onAnimationComplete,
2181
2179
  ...rest
2182
2180
  } = props;
2183
- const hasDebug = "debug" in rest && rest.debug !== void 0;
2181
+ const hasDebug = hasAnyProp(rest, ["debug"]);
2184
2182
  const label = findChildrenByDisplayName(
2185
2183
  children,
2186
2184
  LabelNameKey2
@@ -3761,8 +3759,10 @@ function Checkbox(props) {
3761
3759
  return /* @__PURE__ */ jsxRuntime.jsxs(
3762
3760
  Base6,
3763
3761
  {
3764
- flex: true,
3765
- alignI: true,
3762
+ ...!hasAnyProp(rest, ["grid", "flex", "display"]) && {
3763
+ alignI: true,
3764
+ flex: true
3765
+ },
3766
3766
  gap: 2,
3767
3767
  cursor: "pointer",
3768
3768
  userSelect: "none",
@@ -854,6 +854,9 @@ function useOutsideClick(ref, handler, enabled = true) {
854
854
  };
855
855
  }, [ref, handler, enabled]);
856
856
  }
857
+ function hasAnyProp(obj, keys) {
858
+ return keys.some((key) => key in obj && obj[key] !== void 0);
859
+ }
857
860
  var extractImageMetadata = (f) => {
858
861
  return new Promise((res, rej) => {
859
862
  if (!f) rej(new Error("No image file provided."));
@@ -1085,16 +1088,16 @@ var extractElAndStyles = (extract, anyProps) => {
1085
1088
  }
1086
1089
  }
1087
1090
  const cursor = anyProps.isLoading ? "not-allowed" : "pointer";
1088
- const hasGridProp = "grid" in remaining && remaining.grid !== void 0;
1089
- const hasFlexProp = "flex" in remaining && remaining.flex !== void 0;
1090
- const hasDisplayProp = "display" in remaining && remaining.display !== void 0;
1091
- const hasCustomLayout = hasGridProp || hasFlexProp || hasDisplayProp;
1091
+ const hasCustomLayout = hasAnyProp(remaining, ["grid", "flex", "display"]);
1092
+ const hasCustomColor = hasAnyProp(remaining, ["color"]);
1092
1093
  const btnClassName = extract.is === "btn" ? css({
1093
- ...hasCustomLayout ? {} : { display: "flex", alignI: "center" },
1094
+ ...!hasCustomLayout && { display: "flex", alignI: "center" },
1094
1095
  cursor
1095
1096
  }) : "";
1096
1097
  const linkClassName = extract.isLink ? css({
1097
- color: { base: "blue.500", _dark: "blue.400" },
1098
+ ...!hasCustomColor && {
1099
+ color: { base: "blue.500", _dark: "blue.400" }
1100
+ },
1098
1101
  _hover: { textDecoration: "underline" },
1099
1102
  cursor
1100
1103
  }) : "";
@@ -1361,9 +1364,11 @@ function Switch(props) {
1361
1364
  return /* @__PURE__ */ jsx(SwitchContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(MotionConfig, { transition: _motion, children: /* @__PURE__ */ jsx(
1362
1365
  Button,
1363
1366
  {
1364
- flex: true,
1365
- alignItems: "center",
1366
- justifyContent: "center",
1367
+ ...!hasAnyProp(rest, ["grid", "flex", "display"]) && {
1368
+ justifyContent: "center",
1369
+ alignItems: "center",
1370
+ flex: true
1371
+ },
1367
1372
  px: 1,
1368
1373
  py: 1,
1369
1374
  h: "fit-content",
@@ -1520,8 +1525,8 @@ function Radio(props) {
1520
1525
  options,
1521
1526
  renderOption,
1522
1527
  onKeyDown: onKeyDownProp,
1523
- onAnimationStart,
1524
- onAnimationComplete,
1528
+ onAnimationStart: _onAnimationStart,
1529
+ onAnimationComplete: _onAnimationComplete,
1525
1530
  ...rest
1526
1531
  } = props;
1527
1532
  const groupId = React13__default.useId();
@@ -1529,7 +1534,7 @@ function Radio(props) {
1529
1534
  const [uncontrolled, setUncontrolled] = React13__default.useState(
1530
1535
  defaultValue
1531
1536
  );
1532
- const selectedValue = isControlled ? controlledValue : uncontrolled;
1537
+ const selectedValue = isControlled ? controlledValue ?? null : uncontrolled;
1533
1538
  const itemsRef = React13__default.useRef([]);
1534
1539
  const [activeId, setActiveId] = React13__default.useState("");
1535
1540
  const setSelectedValue = (val) => {
@@ -1653,37 +1658,33 @@ function Item(props) {
1653
1658
  onClick: onClickProp,
1654
1659
  onFocus: onFocusProp,
1655
1660
  onBlur: onBlurProp,
1656
- onAnimationStart,
1657
- onAnimationComplete,
1661
+ onAnimationStart: _onAnimationStart,
1662
+ onAnimationComplete: _onAnimationComplete,
1658
1663
  ...rest
1659
1664
  } = props;
1660
1665
  const ctx = React13__default.useContext(RadioContext);
1666
+ const ref = React13__default.useRef(null);
1667
+ const [isFocused, setIsFocused] = React13__default.useState(false);
1668
+ const groupDisabled = ctx?.disabled;
1669
+ const disabled = !!(groupDisabled || itemDisabled);
1670
+ const groupId = ctx?.groupId ?? "";
1671
+ const id = `radio-item-${groupId}-${value}`;
1672
+ const registerItem = ctx?.registerItem;
1673
+ const unregisterItem = ctx?.unregisterItem;
1674
+ React13__default.useEffect(() => {
1675
+ if (!registerItem || !unregisterItem) return;
1676
+ registerItem({ id, value, disabled, ref });
1677
+ return () => unregisterItem(id);
1678
+ }, [id, value, disabled, registerItem, unregisterItem]);
1661
1679
  if (!ctx) {
1662
1680
  return /* @__PURE__ */ jsxs(Base2, { flex: true, alignI: true, cursor: "pointer", ...rest, children: [
1663
1681
  /* @__PURE__ */ jsx(Base2, { "data-radio-circle": true, w: 24, h: 24, br: 9999, mr: 8 }),
1664
1682
  children
1665
1683
  ] });
1666
1684
  }
1667
- const {
1668
- groupId,
1669
- registerItem,
1670
- unregisterItem,
1671
- selectedValue,
1672
- setSelectedValue,
1673
- isActiveId,
1674
- setActiveById,
1675
- disabled: groupDisabled
1676
- } = ctx;
1677
- const disabled = !!(groupDisabled || itemDisabled);
1678
- const id = `radio-item-${groupId}-${value}`;
1679
- const ref = React13__default.useRef(null);
1680
- React13__default.useEffect(() => {
1681
- registerItem({ id, value, disabled, ref });
1682
- return () => unregisterItem(id);
1683
- }, [id, value, disabled]);
1685
+ const { selectedValue, setSelectedValue, isActiveId, setActiveById } = ctx;
1684
1686
  const isSelected = selectedValue === value;
1685
1687
  const isActive = isActiveId(id);
1686
- const [isFocused, setIsFocused] = React13__default.useState(false);
1687
1688
  const shouldUseGrid = gridProp || !!colsProp;
1688
1689
  const renderLabel = () => {
1689
1690
  const onlyChild = React13__default.Children.count(children) === 1 ? React13__default.Children.toArray(children)[0] : null;
@@ -1693,26 +1694,23 @@ function Item(props) {
1693
1694
  if (React13__default.isValidElement(onlyChild)) {
1694
1695
  return React13__default.cloneElement(
1695
1696
  onlyChild,
1696
- {
1697
- ...onlyChild.props || {},
1698
- ["data-radio-label"]: true
1699
- }
1697
+ { "data-radio-label": true }
1700
1698
  );
1701
1699
  }
1702
1700
  return /* @__PURE__ */ jsx(Base2, { "data-radio-label": true, children });
1703
1701
  };
1702
+ const hasCustomLayout = hasAnyProp(rest, ["flex", "display"]) || gridProp;
1704
1703
  return /* @__PURE__ */ jsxs(
1705
1704
  Base2,
1706
1705
  {
1707
1706
  ref,
1708
- flex: true,
1709
- alignI: true,
1710
1707
  outline: "none",
1711
1708
  role: "radio",
1712
1709
  tabIndex: isActive ? 0 : -1,
1713
1710
  "aria-checked": isSelected,
1714
1711
  "aria-disabled": disabled,
1715
- ...shouldUseGrid ? { grid: true } : { flex: true, alignI: true },
1712
+ ...!hasCustomLayout && { flex: true, alignI: true },
1713
+ ...shouldUseGrid && { grid: true },
1716
1714
  ...colsProp && { cols: colsProp },
1717
1715
  gap: shouldUseGrid ? void 0 : "8px",
1718
1716
  cursor: disabled ? "not-allowed" : "pointer",
@@ -1937,11 +1935,11 @@ function Textarea(props) {
1937
1935
  children,
1938
1936
  _motion,
1939
1937
  error,
1940
- onAnimationStart,
1941
- onAnimationComplete,
1938
+ onAnimationStart: _onAnimationStart,
1939
+ onAnimationComplete: _onAnimationComplete,
1942
1940
  ...rest
1943
1941
  } = props;
1944
- const isControlled = rest.value !== void 0;
1942
+ const isControlled = props.value !== void 0;
1945
1943
  const libRef = React13__default.useRef(null);
1946
1944
  const ref = assignRefs(libRef, userRef);
1947
1945
  const heightRef = React13__default.useRef(0);
@@ -1956,15 +1954,15 @@ function Textarea(props) {
1956
1954
  value: props.value,
1957
1955
  error
1958
1956
  }) : null;
1959
- const resizeTextarea = () => {
1957
+ const resizeTextarea = React13__default.useCallback(() => {
1960
1958
  const node = libRef.current;
1961
1959
  if (!node) return;
1962
1960
  const nodeSizingData = getSizingData(node);
1963
1961
  if (!nodeSizingData) return;
1964
- const value2 = node.value || node.placeholder || "x";
1962
+ const nodeValue = node.value || node.placeholder || "x";
1965
1963
  const [height, rowHeight] = calculateNodeHeight(
1966
1964
  nodeSizingData,
1967
- value2,
1965
+ nodeValue,
1968
1966
  minRows,
1969
1967
  maxRows
1970
1968
  );
@@ -1973,7 +1971,7 @@ function Textarea(props) {
1973
1971
  node.style.setProperty("height", `${height}px`, "important");
1974
1972
  onHeightChange?.(height, { rowHeight });
1975
1973
  }
1976
- };
1974
+ }, [minRows, maxRows, onHeightChange]);
1977
1975
  const handleChange = (e) => {
1978
1976
  if (!isControlled) resizeTextarea();
1979
1977
  _setValue(e.target.value);
@@ -1981,20 +1979,20 @@ function Textarea(props) {
1981
1979
  };
1982
1980
  useIsomorphicLayoutEffect(() => {
1983
1981
  resizeTextarea();
1984
- }, [rest.value, rest.placeholder, minRows, maxRows]);
1982
+ }, [rest.value, rest.placeholder, resizeTextarea]);
1985
1983
  React13__default.useEffect(() => {
1986
1984
  if (!isBrowser) return;
1987
1985
  const onResize = () => resizeTextarea();
1988
1986
  window.addEventListener("resize", onResize);
1989
1987
  return () => window.removeEventListener("resize", onResize);
1990
- }, [minRows, maxRows, rest.placeholder, rest.value]);
1988
+ }, [rest.placeholder, rest.value, resizeTextarea]);
1991
1989
  React13__default.useEffect(() => {
1992
1990
  const fonts = isBrowser ? document.fonts : void 0;
1993
1991
  if (!fonts || typeof fonts.addEventListener !== "function") return;
1994
1992
  const onFontsLoaded = () => resizeTextarea();
1995
1993
  fonts.addEventListener("loadingdone", onFontsLoaded);
1996
1994
  return () => fonts.removeEventListener("loadingdone", onFontsLoaded);
1997
- }, [minRows, maxRows, rest.placeholder, rest.value]);
1995
+ }, [rest.placeholder, rest.value, resizeTextarea]);
1998
1996
  React13__default.useEffect(() => {
1999
1997
  const node = libRef.current;
2000
1998
  const form = node?.form;
@@ -2007,9 +2005,9 @@ function Textarea(props) {
2007
2005
  };
2008
2006
  form.addEventListener("reset", onReset);
2009
2007
  return () => form.removeEventListener("reset", onReset);
2010
- }, [isControlled]);
2008
+ }, [isControlled, resizeTextarea]);
2011
2009
  const resize = props.resize ?? "none";
2012
- const hasDebug = "debug" in rest && rest.debug !== void 0;
2010
+ const hasDebug = hasAnyProp(rest, ["debug"]);
2013
2011
  return /* @__PURE__ */ jsxs(Base3, { grid: true, rows: "/ 4", children: [
2014
2012
  /* @__PURE__ */ jsxs(Base3, { grid: true, relative: true, children: [
2015
2013
  labelWithProps,
@@ -2065,8 +2063,8 @@ function Label(props) {
2065
2063
  error,
2066
2064
  required,
2067
2065
  children,
2068
- onAnimationStart,
2069
- onAnimationComplete,
2066
+ onAnimationStart: _onAnimationStart,
2067
+ onAnimationComplete: _onAnimationComplete,
2070
2068
  ...rest
2071
2069
  } = props;
2072
2070
  return /* @__PURE__ */ jsxs(
@@ -2157,7 +2155,7 @@ function Input(props) {
2157
2155
  onAnimationComplete: _onAnimationComplete,
2158
2156
  ...rest
2159
2157
  } = props;
2160
- const hasDebug = "debug" in rest && rest.debug !== void 0;
2158
+ const hasDebug = hasAnyProp(rest, ["debug"]);
2161
2159
  const label = findChildrenByDisplayName(
2162
2160
  children,
2163
2161
  LabelNameKey2
@@ -3738,8 +3736,10 @@ function Checkbox(props) {
3738
3736
  return /* @__PURE__ */ jsxs(
3739
3737
  Base6,
3740
3738
  {
3741
- flex: true,
3742
- alignI: true,
3739
+ ...!hasAnyProp(rest, ["grid", "flex", "display"]) && {
3740
+ alignI: true,
3741
+ flex: true
3742
+ },
3743
3743
  gap: 2,
3744
3744
  cursor: "pointer",
3745
3745
  userSelect: "none",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qstd",
3
- "version": "0.3.38",
3
+ "version": "0.3.40",
4
4
  "description": "Standard Block component and utilities library with Panda CSS",
5
5
  "author": "malin1",
6
6
  "license": "MIT",