qstd 0.3.37 → 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,9 +1111,16 @@ var extractElAndStyles = (extract, anyProps) => {
1108
1111
  }
1109
1112
  }
1110
1113
  const cursor = anyProps.isLoading ? "not-allowed" : "pointer";
1111
- const btnClassName = extract.is === "btn" ? css({ display: "flex", alignI: "center", cursor }) : "";
1114
+ const hasCustomLayout = hasAnyProp(remaining, ["grid", "flex", "display"]);
1115
+ const hasCustomColor = hasAnyProp(remaining, ["color"]);
1116
+ const btnClassName = extract.is === "btn" ? css({
1117
+ ...!hasCustomLayout && { display: "flex", alignI: "center" },
1118
+ cursor
1119
+ }) : "";
1112
1120
  const linkClassName = extract.isLink ? css({
1113
- color: { base: "blue.500", _dark: "blue.400" },
1121
+ ...!hasCustomColor && {
1122
+ color: { base: "blue.500", _dark: "blue.400" }
1123
+ },
1114
1124
  _hover: { textDecoration: "underline" },
1115
1125
  cursor
1116
1126
  }) : "";
@@ -1377,9 +1387,11 @@ function Switch(props) {
1377
1387
  return /* @__PURE__ */ jsxRuntime.jsx(SwitchContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxRuntime.jsx(framerMotion.MotionConfig, { transition: _motion, children: /* @__PURE__ */ jsxRuntime.jsx(
1378
1388
  Button,
1379
1389
  {
1380
- flex: true,
1381
- alignItems: "center",
1382
- justifyContent: "center",
1390
+ ...!hasAnyProp(rest, ["grid", "flex", "display"]) && {
1391
+ justifyContent: "center",
1392
+ alignItems: "center",
1393
+ flex: true
1394
+ },
1383
1395
  px: 1,
1384
1396
  py: 1,
1385
1397
  h: "fit-content",
@@ -1536,8 +1548,8 @@ function Radio(props) {
1536
1548
  options,
1537
1549
  renderOption,
1538
1550
  onKeyDown: onKeyDownProp,
1539
- onAnimationStart,
1540
- onAnimationComplete,
1551
+ onAnimationStart: _onAnimationStart,
1552
+ onAnimationComplete: _onAnimationComplete,
1541
1553
  ...rest
1542
1554
  } = props;
1543
1555
  const groupId = React13__namespace.default.useId();
@@ -1545,7 +1557,7 @@ function Radio(props) {
1545
1557
  const [uncontrolled, setUncontrolled] = React13__namespace.default.useState(
1546
1558
  defaultValue
1547
1559
  );
1548
- const selectedValue = isControlled ? controlledValue : uncontrolled;
1560
+ const selectedValue = isControlled ? controlledValue ?? null : uncontrolled;
1549
1561
  const itemsRef = React13__namespace.default.useRef([]);
1550
1562
  const [activeId, setActiveId] = React13__namespace.default.useState("");
1551
1563
  const setSelectedValue = (val) => {
@@ -1669,37 +1681,33 @@ function Item(props) {
1669
1681
  onClick: onClickProp,
1670
1682
  onFocus: onFocusProp,
1671
1683
  onBlur: onBlurProp,
1672
- onAnimationStart,
1673
- onAnimationComplete,
1684
+ onAnimationStart: _onAnimationStart,
1685
+ onAnimationComplete: _onAnimationComplete,
1674
1686
  ...rest
1675
1687
  } = props;
1676
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]);
1677
1702
  if (!ctx) {
1678
1703
  return /* @__PURE__ */ jsxRuntime.jsxs(Base2, { flex: true, alignI: true, cursor: "pointer", ...rest, children: [
1679
1704
  /* @__PURE__ */ jsxRuntime.jsx(Base2, { "data-radio-circle": true, w: 24, h: 24, br: 9999, mr: 8 }),
1680
1705
  children
1681
1706
  ] });
1682
1707
  }
1683
- const {
1684
- groupId,
1685
- registerItem,
1686
- unregisterItem,
1687
- selectedValue,
1688
- setSelectedValue,
1689
- isActiveId,
1690
- setActiveById,
1691
- disabled: groupDisabled
1692
- } = ctx;
1693
- const disabled = !!(groupDisabled || itemDisabled);
1694
- const id = `radio-item-${groupId}-${value}`;
1695
- const ref = React13__namespace.default.useRef(null);
1696
- React13__namespace.default.useEffect(() => {
1697
- registerItem({ id, value, disabled, ref });
1698
- return () => unregisterItem(id);
1699
- }, [id, value, disabled]);
1708
+ const { selectedValue, setSelectedValue, isActiveId, setActiveById } = ctx;
1700
1709
  const isSelected = selectedValue === value;
1701
1710
  const isActive = isActiveId(id);
1702
- const [isFocused, setIsFocused] = React13__namespace.default.useState(false);
1703
1711
  const shouldUseGrid = gridProp || !!colsProp;
1704
1712
  const renderLabel = () => {
1705
1713
  const onlyChild = React13__namespace.default.Children.count(children) === 1 ? React13__namespace.default.Children.toArray(children)[0] : null;
@@ -1709,26 +1717,23 @@ function Item(props) {
1709
1717
  if (React13__namespace.default.isValidElement(onlyChild)) {
1710
1718
  return React13__namespace.default.cloneElement(
1711
1719
  onlyChild,
1712
- {
1713
- ...onlyChild.props || {},
1714
- ["data-radio-label"]: true
1715
- }
1720
+ { "data-radio-label": true }
1716
1721
  );
1717
1722
  }
1718
1723
  return /* @__PURE__ */ jsxRuntime.jsx(Base2, { "data-radio-label": true, children });
1719
1724
  };
1725
+ const hasCustomLayout = hasAnyProp(rest, ["flex", "display"]) || gridProp;
1720
1726
  return /* @__PURE__ */ jsxRuntime.jsxs(
1721
1727
  Base2,
1722
1728
  {
1723
1729
  ref,
1724
- flex: true,
1725
- alignI: true,
1726
1730
  outline: "none",
1727
1731
  role: "radio",
1728
1732
  tabIndex: isActive ? 0 : -1,
1729
1733
  "aria-checked": isSelected,
1730
1734
  "aria-disabled": disabled,
1731
- ...shouldUseGrid ? { grid: true } : { flex: true, alignI: true },
1735
+ ...!hasCustomLayout && { flex: true, alignI: true },
1736
+ ...shouldUseGrid && { grid: true },
1732
1737
  ...colsProp && { cols: colsProp },
1733
1738
  gap: shouldUseGrid ? void 0 : "8px",
1734
1739
  cursor: disabled ? "not-allowed" : "pointer",
@@ -1953,11 +1958,11 @@ function Textarea(props) {
1953
1958
  children,
1954
1959
  _motion,
1955
1960
  error,
1956
- onAnimationStart,
1957
- onAnimationComplete,
1961
+ onAnimationStart: _onAnimationStart,
1962
+ onAnimationComplete: _onAnimationComplete,
1958
1963
  ...rest
1959
1964
  } = props;
1960
- const isControlled = rest.value !== void 0;
1965
+ const isControlled = props.value !== void 0;
1961
1966
  const libRef = React13__namespace.default.useRef(null);
1962
1967
  const ref = assignRefs(libRef, userRef);
1963
1968
  const heightRef = React13__namespace.default.useRef(0);
@@ -1972,15 +1977,15 @@ function Textarea(props) {
1972
1977
  value: props.value,
1973
1978
  error
1974
1979
  }) : null;
1975
- const resizeTextarea = () => {
1980
+ const resizeTextarea = React13__namespace.default.useCallback(() => {
1976
1981
  const node = libRef.current;
1977
1982
  if (!node) return;
1978
1983
  const nodeSizingData = getSizingData(node);
1979
1984
  if (!nodeSizingData) return;
1980
- const value2 = node.value || node.placeholder || "x";
1985
+ const nodeValue = node.value || node.placeholder || "x";
1981
1986
  const [height, rowHeight] = calculateNodeHeight(
1982
1987
  nodeSizingData,
1983
- value2,
1988
+ nodeValue,
1984
1989
  minRows,
1985
1990
  maxRows
1986
1991
  );
@@ -1989,7 +1994,7 @@ function Textarea(props) {
1989
1994
  node.style.setProperty("height", `${height}px`, "important");
1990
1995
  onHeightChange?.(height, { rowHeight });
1991
1996
  }
1992
- };
1997
+ }, [minRows, maxRows, onHeightChange]);
1993
1998
  const handleChange = (e) => {
1994
1999
  if (!isControlled) resizeTextarea();
1995
2000
  _setValue(e.target.value);
@@ -1997,20 +2002,20 @@ function Textarea(props) {
1997
2002
  };
1998
2003
  useIsomorphicLayoutEffect(() => {
1999
2004
  resizeTextarea();
2000
- }, [rest.value, rest.placeholder, minRows, maxRows]);
2005
+ }, [rest.value, rest.placeholder, resizeTextarea]);
2001
2006
  React13__namespace.default.useEffect(() => {
2002
2007
  if (!isBrowser) return;
2003
2008
  const onResize = () => resizeTextarea();
2004
2009
  window.addEventListener("resize", onResize);
2005
2010
  return () => window.removeEventListener("resize", onResize);
2006
- }, [minRows, maxRows, rest.placeholder, rest.value]);
2011
+ }, [rest.placeholder, rest.value, resizeTextarea]);
2007
2012
  React13__namespace.default.useEffect(() => {
2008
2013
  const fonts = isBrowser ? document.fonts : void 0;
2009
2014
  if (!fonts || typeof fonts.addEventListener !== "function") return;
2010
2015
  const onFontsLoaded = () => resizeTextarea();
2011
2016
  fonts.addEventListener("loadingdone", onFontsLoaded);
2012
2017
  return () => fonts.removeEventListener("loadingdone", onFontsLoaded);
2013
- }, [minRows, maxRows, rest.placeholder, rest.value]);
2018
+ }, [rest.placeholder, rest.value, resizeTextarea]);
2014
2019
  React13__namespace.default.useEffect(() => {
2015
2020
  const node = libRef.current;
2016
2021
  const form = node?.form;
@@ -2023,9 +2028,9 @@ function Textarea(props) {
2023
2028
  };
2024
2029
  form.addEventListener("reset", onReset);
2025
2030
  return () => form.removeEventListener("reset", onReset);
2026
- }, [isControlled]);
2031
+ }, [isControlled, resizeTextarea]);
2027
2032
  const resize = props.resize ?? "none";
2028
- const hasDebug = "debug" in rest && rest.debug !== void 0;
2033
+ const hasDebug = hasAnyProp(rest, ["debug"]);
2029
2034
  return /* @__PURE__ */ jsxRuntime.jsxs(Base3, { grid: true, rows: "/ 4", children: [
2030
2035
  /* @__PURE__ */ jsxRuntime.jsxs(Base3, { grid: true, relative: true, children: [
2031
2036
  labelWithProps,
@@ -2081,8 +2086,8 @@ function Label(props) {
2081
2086
  error,
2082
2087
  required,
2083
2088
  children,
2084
- onAnimationStart,
2085
- onAnimationComplete,
2089
+ onAnimationStart: _onAnimationStart,
2090
+ onAnimationComplete: _onAnimationComplete,
2086
2091
  ...rest
2087
2092
  } = props;
2088
2093
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2173,7 +2178,7 @@ function Input(props) {
2173
2178
  onAnimationComplete: _onAnimationComplete,
2174
2179
  ...rest
2175
2180
  } = props;
2176
- const hasDebug = "debug" in rest && rest.debug !== void 0;
2181
+ const hasDebug = hasAnyProp(rest, ["debug"]);
2177
2182
  const label = findChildrenByDisplayName(
2178
2183
  children,
2179
2184
  LabelNameKey2
@@ -3754,8 +3759,10 @@ function Checkbox(props) {
3754
3759
  return /* @__PURE__ */ jsxRuntime.jsxs(
3755
3760
  Base6,
3756
3761
  {
3757
- flex: true,
3758
- alignI: true,
3762
+ ...!hasAnyProp(rest, ["grid", "flex", "display"]) && {
3763
+ alignI: true,
3764
+ flex: true
3765
+ },
3759
3766
  gap: 2,
3760
3767
  cursor: "pointer",
3761
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,9 +1088,16 @@ var extractElAndStyles = (extract, anyProps) => {
1085
1088
  }
1086
1089
  }
1087
1090
  const cursor = anyProps.isLoading ? "not-allowed" : "pointer";
1088
- const btnClassName = extract.is === "btn" ? css({ display: "flex", alignI: "center", cursor }) : "";
1091
+ const hasCustomLayout = hasAnyProp(remaining, ["grid", "flex", "display"]);
1092
+ const hasCustomColor = hasAnyProp(remaining, ["color"]);
1093
+ const btnClassName = extract.is === "btn" ? css({
1094
+ ...!hasCustomLayout && { display: "flex", alignI: "center" },
1095
+ cursor
1096
+ }) : "";
1089
1097
  const linkClassName = extract.isLink ? css({
1090
- color: { base: "blue.500", _dark: "blue.400" },
1098
+ ...!hasCustomColor && {
1099
+ color: { base: "blue.500", _dark: "blue.400" }
1100
+ },
1091
1101
  _hover: { textDecoration: "underline" },
1092
1102
  cursor
1093
1103
  }) : "";
@@ -1354,9 +1364,11 @@ function Switch(props) {
1354
1364
  return /* @__PURE__ */ jsx(SwitchContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(MotionConfig, { transition: _motion, children: /* @__PURE__ */ jsx(
1355
1365
  Button,
1356
1366
  {
1357
- flex: true,
1358
- alignItems: "center",
1359
- justifyContent: "center",
1367
+ ...!hasAnyProp(rest, ["grid", "flex", "display"]) && {
1368
+ justifyContent: "center",
1369
+ alignItems: "center",
1370
+ flex: true
1371
+ },
1360
1372
  px: 1,
1361
1373
  py: 1,
1362
1374
  h: "fit-content",
@@ -1513,8 +1525,8 @@ function Radio(props) {
1513
1525
  options,
1514
1526
  renderOption,
1515
1527
  onKeyDown: onKeyDownProp,
1516
- onAnimationStart,
1517
- onAnimationComplete,
1528
+ onAnimationStart: _onAnimationStart,
1529
+ onAnimationComplete: _onAnimationComplete,
1518
1530
  ...rest
1519
1531
  } = props;
1520
1532
  const groupId = React13__default.useId();
@@ -1522,7 +1534,7 @@ function Radio(props) {
1522
1534
  const [uncontrolled, setUncontrolled] = React13__default.useState(
1523
1535
  defaultValue
1524
1536
  );
1525
- const selectedValue = isControlled ? controlledValue : uncontrolled;
1537
+ const selectedValue = isControlled ? controlledValue ?? null : uncontrolled;
1526
1538
  const itemsRef = React13__default.useRef([]);
1527
1539
  const [activeId, setActiveId] = React13__default.useState("");
1528
1540
  const setSelectedValue = (val) => {
@@ -1646,37 +1658,33 @@ function Item(props) {
1646
1658
  onClick: onClickProp,
1647
1659
  onFocus: onFocusProp,
1648
1660
  onBlur: onBlurProp,
1649
- onAnimationStart,
1650
- onAnimationComplete,
1661
+ onAnimationStart: _onAnimationStart,
1662
+ onAnimationComplete: _onAnimationComplete,
1651
1663
  ...rest
1652
1664
  } = props;
1653
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]);
1654
1679
  if (!ctx) {
1655
1680
  return /* @__PURE__ */ jsxs(Base2, { flex: true, alignI: true, cursor: "pointer", ...rest, children: [
1656
1681
  /* @__PURE__ */ jsx(Base2, { "data-radio-circle": true, w: 24, h: 24, br: 9999, mr: 8 }),
1657
1682
  children
1658
1683
  ] });
1659
1684
  }
1660
- const {
1661
- groupId,
1662
- registerItem,
1663
- unregisterItem,
1664
- selectedValue,
1665
- setSelectedValue,
1666
- isActiveId,
1667
- setActiveById,
1668
- disabled: groupDisabled
1669
- } = ctx;
1670
- const disabled = !!(groupDisabled || itemDisabled);
1671
- const id = `radio-item-${groupId}-${value}`;
1672
- const ref = React13__default.useRef(null);
1673
- React13__default.useEffect(() => {
1674
- registerItem({ id, value, disabled, ref });
1675
- return () => unregisterItem(id);
1676
- }, [id, value, disabled]);
1685
+ const { selectedValue, setSelectedValue, isActiveId, setActiveById } = ctx;
1677
1686
  const isSelected = selectedValue === value;
1678
1687
  const isActive = isActiveId(id);
1679
- const [isFocused, setIsFocused] = React13__default.useState(false);
1680
1688
  const shouldUseGrid = gridProp || !!colsProp;
1681
1689
  const renderLabel = () => {
1682
1690
  const onlyChild = React13__default.Children.count(children) === 1 ? React13__default.Children.toArray(children)[0] : null;
@@ -1686,26 +1694,23 @@ function Item(props) {
1686
1694
  if (React13__default.isValidElement(onlyChild)) {
1687
1695
  return React13__default.cloneElement(
1688
1696
  onlyChild,
1689
- {
1690
- ...onlyChild.props || {},
1691
- ["data-radio-label"]: true
1692
- }
1697
+ { "data-radio-label": true }
1693
1698
  );
1694
1699
  }
1695
1700
  return /* @__PURE__ */ jsx(Base2, { "data-radio-label": true, children });
1696
1701
  };
1702
+ const hasCustomLayout = hasAnyProp(rest, ["flex", "display"]) || gridProp;
1697
1703
  return /* @__PURE__ */ jsxs(
1698
1704
  Base2,
1699
1705
  {
1700
1706
  ref,
1701
- flex: true,
1702
- alignI: true,
1703
1707
  outline: "none",
1704
1708
  role: "radio",
1705
1709
  tabIndex: isActive ? 0 : -1,
1706
1710
  "aria-checked": isSelected,
1707
1711
  "aria-disabled": disabled,
1708
- ...shouldUseGrid ? { grid: true } : { flex: true, alignI: true },
1712
+ ...!hasCustomLayout && { flex: true, alignI: true },
1713
+ ...shouldUseGrid && { grid: true },
1709
1714
  ...colsProp && { cols: colsProp },
1710
1715
  gap: shouldUseGrid ? void 0 : "8px",
1711
1716
  cursor: disabled ? "not-allowed" : "pointer",
@@ -1930,11 +1935,11 @@ function Textarea(props) {
1930
1935
  children,
1931
1936
  _motion,
1932
1937
  error,
1933
- onAnimationStart,
1934
- onAnimationComplete,
1938
+ onAnimationStart: _onAnimationStart,
1939
+ onAnimationComplete: _onAnimationComplete,
1935
1940
  ...rest
1936
1941
  } = props;
1937
- const isControlled = rest.value !== void 0;
1942
+ const isControlled = props.value !== void 0;
1938
1943
  const libRef = React13__default.useRef(null);
1939
1944
  const ref = assignRefs(libRef, userRef);
1940
1945
  const heightRef = React13__default.useRef(0);
@@ -1949,15 +1954,15 @@ function Textarea(props) {
1949
1954
  value: props.value,
1950
1955
  error
1951
1956
  }) : null;
1952
- const resizeTextarea = () => {
1957
+ const resizeTextarea = React13__default.useCallback(() => {
1953
1958
  const node = libRef.current;
1954
1959
  if (!node) return;
1955
1960
  const nodeSizingData = getSizingData(node);
1956
1961
  if (!nodeSizingData) return;
1957
- const value2 = node.value || node.placeholder || "x";
1962
+ const nodeValue = node.value || node.placeholder || "x";
1958
1963
  const [height, rowHeight] = calculateNodeHeight(
1959
1964
  nodeSizingData,
1960
- value2,
1965
+ nodeValue,
1961
1966
  minRows,
1962
1967
  maxRows
1963
1968
  );
@@ -1966,7 +1971,7 @@ function Textarea(props) {
1966
1971
  node.style.setProperty("height", `${height}px`, "important");
1967
1972
  onHeightChange?.(height, { rowHeight });
1968
1973
  }
1969
- };
1974
+ }, [minRows, maxRows, onHeightChange]);
1970
1975
  const handleChange = (e) => {
1971
1976
  if (!isControlled) resizeTextarea();
1972
1977
  _setValue(e.target.value);
@@ -1974,20 +1979,20 @@ function Textarea(props) {
1974
1979
  };
1975
1980
  useIsomorphicLayoutEffect(() => {
1976
1981
  resizeTextarea();
1977
- }, [rest.value, rest.placeholder, minRows, maxRows]);
1982
+ }, [rest.value, rest.placeholder, resizeTextarea]);
1978
1983
  React13__default.useEffect(() => {
1979
1984
  if (!isBrowser) return;
1980
1985
  const onResize = () => resizeTextarea();
1981
1986
  window.addEventListener("resize", onResize);
1982
1987
  return () => window.removeEventListener("resize", onResize);
1983
- }, [minRows, maxRows, rest.placeholder, rest.value]);
1988
+ }, [rest.placeholder, rest.value, resizeTextarea]);
1984
1989
  React13__default.useEffect(() => {
1985
1990
  const fonts = isBrowser ? document.fonts : void 0;
1986
1991
  if (!fonts || typeof fonts.addEventListener !== "function") return;
1987
1992
  const onFontsLoaded = () => resizeTextarea();
1988
1993
  fonts.addEventListener("loadingdone", onFontsLoaded);
1989
1994
  return () => fonts.removeEventListener("loadingdone", onFontsLoaded);
1990
- }, [minRows, maxRows, rest.placeholder, rest.value]);
1995
+ }, [rest.placeholder, rest.value, resizeTextarea]);
1991
1996
  React13__default.useEffect(() => {
1992
1997
  const node = libRef.current;
1993
1998
  const form = node?.form;
@@ -2000,9 +2005,9 @@ function Textarea(props) {
2000
2005
  };
2001
2006
  form.addEventListener("reset", onReset);
2002
2007
  return () => form.removeEventListener("reset", onReset);
2003
- }, [isControlled]);
2008
+ }, [isControlled, resizeTextarea]);
2004
2009
  const resize = props.resize ?? "none";
2005
- const hasDebug = "debug" in rest && rest.debug !== void 0;
2010
+ const hasDebug = hasAnyProp(rest, ["debug"]);
2006
2011
  return /* @__PURE__ */ jsxs(Base3, { grid: true, rows: "/ 4", children: [
2007
2012
  /* @__PURE__ */ jsxs(Base3, { grid: true, relative: true, children: [
2008
2013
  labelWithProps,
@@ -2058,8 +2063,8 @@ function Label(props) {
2058
2063
  error,
2059
2064
  required,
2060
2065
  children,
2061
- onAnimationStart,
2062
- onAnimationComplete,
2066
+ onAnimationStart: _onAnimationStart,
2067
+ onAnimationComplete: _onAnimationComplete,
2063
2068
  ...rest
2064
2069
  } = props;
2065
2070
  return /* @__PURE__ */ jsxs(
@@ -2150,7 +2155,7 @@ function Input(props) {
2150
2155
  onAnimationComplete: _onAnimationComplete,
2151
2156
  ...rest
2152
2157
  } = props;
2153
- const hasDebug = "debug" in rest && rest.debug !== void 0;
2158
+ const hasDebug = hasAnyProp(rest, ["debug"]);
2154
2159
  const label = findChildrenByDisplayName(
2155
2160
  children,
2156
2161
  LabelNameKey2
@@ -3731,8 +3736,10 @@ function Checkbox(props) {
3731
3736
  return /* @__PURE__ */ jsxs(
3732
3737
  Base6,
3733
3738
  {
3734
- flex: true,
3735
- alignI: true,
3739
+ ...!hasAnyProp(rest, ["grid", "flex", "display"]) && {
3740
+ alignI: true,
3741
+ flex: true
3742
+ },
3736
3743
  gap: 2,
3737
3744
  cursor: "pointer",
3738
3745
  userSelect: "none",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qstd",
3
- "version": "0.3.37",
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",