qstd 0.3.40 → 0.3.42

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;AAO9B,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,kBAAkB,2CAuF5D"}
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,2CAgH5D"}
@@ -2946,10 +2946,13 @@ function Backdrop(props) {
2946
2946
  );
2947
2947
  }
2948
2948
  function useMatchMedia(queries) {
2949
+ const isClient = typeof window !== "undefined";
2949
2950
  const [value, setValue] = React13__namespace.default.useState(() => {
2951
+ if (!isClient) return queries.map(() => false);
2950
2952
  return queries.map((q) => window.matchMedia(q).matches);
2951
2953
  });
2952
2954
  React13__namespace.default.useLayoutEffect(() => {
2955
+ if (!isClient) return;
2953
2956
  const mediaQueryLists = queries.map((q) => window.matchMedia(q));
2954
2957
  const handler = () => {
2955
2958
  setValue(mediaQueryLists.map((mql) => mql.matches));
@@ -2959,7 +2962,7 @@ function useMatchMedia(queries) {
2959
2962
  return () => mediaQueryLists.forEach(
2960
2963
  (mql) => mql.removeEventListener("change", handler)
2961
2964
  );
2962
- }, [queries]);
2965
+ }, [queries, isClient]);
2963
2966
  return value;
2964
2967
  }
2965
2968
  var MotionDiv5 = motionTags.div;
@@ -3746,7 +3749,13 @@ var Base6 = base;
3746
3749
  var Svg = motionTags.svg;
3747
3750
  var CheckboxBtn = motionTags.button;
3748
3751
  function Checkbox(props) {
3749
- const { children, onClick, onAnimationStart, onAnimationComplete, ...rest } = props;
3752
+ const {
3753
+ children,
3754
+ onClick: _onClick,
3755
+ onAnimationStart: _onAnimationStart,
3756
+ onAnimationComplete: _onAnimationComplete,
3757
+ ...rest
3758
+ } = props;
3750
3759
  const [checked, setChecked] = React13__namespace.default.useState(false);
3751
3760
  const [indeterminate, setIndeterminate] = React13__namespace.default.useState(false);
3752
3761
  React13__namespace.default.useEffect(() => {
@@ -3756,6 +3765,10 @@ function Checkbox(props) {
3756
3765
  setIndeterminate(!!rest.indeterminate);
3757
3766
  }, [rest.indeterminate]);
3758
3767
  const isIndeterminate = typeof rest.indeterminate === "boolean";
3768
+ const checkboxSelector = rest._checkbox;
3769
+ const hasCheckboxBg = checkboxSelector && hasAnyProp(checkboxSelector, ["bg", "background", "backgroundColor"]);
3770
+ const checkedSelector = rest._checked;
3771
+ const hasCheckedBg = checkedSelector && hasAnyProp(checkedSelector, ["bg", "background", "backgroundColor"]);
3759
3772
  return /* @__PURE__ */ jsxRuntime.jsxs(
3760
3773
  Base6,
3761
3774
  {
@@ -3780,8 +3793,12 @@ function Checkbox(props) {
3780
3793
  cursor: "pointer",
3781
3794
  boxSizing: "border-box",
3782
3795
  outline: "none !important",
3783
- bg: { base: "neutral.200", _dark: "neutral.700" },
3784
- _checked: { bg: "blue.500", transition: ".14s background ease-out" },
3796
+ ...!hasCheckboxBg && {
3797
+ bg: { base: "neutral.200", _dark: "neutral.700" }
3798
+ },
3799
+ ...!hasCheckedBg && {
3800
+ _checked: { bg: "blue.500", transition: ".14s background ease-out" }
3801
+ },
3785
3802
  _active: { scale: 0.9 },
3786
3803
  color: "neutral.100",
3787
3804
  transition: ".14s background ease-out .1s",
@@ -4127,18 +4144,23 @@ function useThrottle(value, interval = 500) {
4127
4144
  }
4128
4145
  function useMatchMedia2(queries, defaultValues = []) {
4129
4146
  const initialValues = defaultValues.length ? defaultValues : Array(queries.length).fill(false);
4130
- const mediaQueryLists = queries.map((q) => window.matchMedia(q));
4131
- const getValue = () => {
4132
- const matchedQueries = mediaQueryLists.map((mql) => mql.matches);
4133
- return matchedQueries;
4134
- };
4135
- const [value, setValue] = React13__namespace.default.useState(getValue);
4147
+ const isClient = typeof window !== "undefined";
4148
+ const [value, setValue] = React13__namespace.default.useState(() => {
4149
+ if (!isClient) return initialValues;
4150
+ return queries.map((q) => window.matchMedia(q).matches);
4151
+ });
4136
4152
  React13__namespace.default.useLayoutEffect(() => {
4137
- const handler = () => setValue(getValue);
4138
- mediaQueryLists.forEach((mql) => mql.addListener(handler));
4139
- return () => mediaQueryLists.forEach((mql) => mql.removeListener(handler));
4140
- }, []);
4141
- if (typeof window === "undefined") return initialValues;
4153
+ if (!isClient) return;
4154
+ const mediaQueryLists = queries.map((q) => window.matchMedia(q));
4155
+ const handler = () => {
4156
+ setValue(mediaQueryLists.map((mql) => mql.matches));
4157
+ };
4158
+ handler();
4159
+ mediaQueryLists.forEach((mql) => mql.addEventListener("change", handler));
4160
+ return () => mediaQueryLists.forEach(
4161
+ (mql) => mql.removeEventListener("change", handler)
4162
+ );
4163
+ }, [queries, isClient]);
4142
4164
  return value;
4143
4165
  }
4144
4166
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAKH,OAAO,gCAAgC,CAAC;AAKxC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMlD,MAAM,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC;AAClC,MAAM,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC;AAErC;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,MAAY,UAe7D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAY,UAkChE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,UAAU,EACnB,aAAa,GAAE,YAAiB,GAC/B,YAAY,CAkCd;AAED,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAKH,OAAO,gCAAgC,CAAC;AAKxC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAMlD,MAAM,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC;AAClC,MAAM,MAAM,YAAY,GAAG,OAAO,EAAE,CAAC;AAErC;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAE,MAAY,UAe7D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAY,UAkChE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,UAAU,EACnB,aAAa,GAAE,YAAiB,GAC/B,YAAY,CAoCd;AAED,cAAc,aAAa,CAAC"}
@@ -2923,10 +2923,13 @@ function Backdrop(props) {
2923
2923
  );
2924
2924
  }
2925
2925
  function useMatchMedia(queries) {
2926
+ const isClient = typeof window !== "undefined";
2926
2927
  const [value, setValue] = React13__default.useState(() => {
2928
+ if (!isClient) return queries.map(() => false);
2927
2929
  return queries.map((q) => window.matchMedia(q).matches);
2928
2930
  });
2929
2931
  React13__default.useLayoutEffect(() => {
2932
+ if (!isClient) return;
2930
2933
  const mediaQueryLists = queries.map((q) => window.matchMedia(q));
2931
2934
  const handler = () => {
2932
2935
  setValue(mediaQueryLists.map((mql) => mql.matches));
@@ -2936,7 +2939,7 @@ function useMatchMedia(queries) {
2936
2939
  return () => mediaQueryLists.forEach(
2937
2940
  (mql) => mql.removeEventListener("change", handler)
2938
2941
  );
2939
- }, [queries]);
2942
+ }, [queries, isClient]);
2940
2943
  return value;
2941
2944
  }
2942
2945
  var MotionDiv5 = motionTags.div;
@@ -3723,7 +3726,13 @@ var Base6 = base;
3723
3726
  var Svg = motionTags.svg;
3724
3727
  var CheckboxBtn = motionTags.button;
3725
3728
  function Checkbox(props) {
3726
- const { children, onClick, onAnimationStart, onAnimationComplete, ...rest } = props;
3729
+ const {
3730
+ children,
3731
+ onClick: _onClick,
3732
+ onAnimationStart: _onAnimationStart,
3733
+ onAnimationComplete: _onAnimationComplete,
3734
+ ...rest
3735
+ } = props;
3727
3736
  const [checked, setChecked] = React13__default.useState(false);
3728
3737
  const [indeterminate, setIndeterminate] = React13__default.useState(false);
3729
3738
  React13__default.useEffect(() => {
@@ -3733,6 +3742,10 @@ function Checkbox(props) {
3733
3742
  setIndeterminate(!!rest.indeterminate);
3734
3743
  }, [rest.indeterminate]);
3735
3744
  const isIndeterminate = typeof rest.indeterminate === "boolean";
3745
+ const checkboxSelector = rest._checkbox;
3746
+ const hasCheckboxBg = checkboxSelector && hasAnyProp(checkboxSelector, ["bg", "background", "backgroundColor"]);
3747
+ const checkedSelector = rest._checked;
3748
+ const hasCheckedBg = checkedSelector && hasAnyProp(checkedSelector, ["bg", "background", "backgroundColor"]);
3736
3749
  return /* @__PURE__ */ jsxs(
3737
3750
  Base6,
3738
3751
  {
@@ -3757,8 +3770,12 @@ function Checkbox(props) {
3757
3770
  cursor: "pointer",
3758
3771
  boxSizing: "border-box",
3759
3772
  outline: "none !important",
3760
- bg: { base: "neutral.200", _dark: "neutral.700" },
3761
- _checked: { bg: "blue.500", transition: ".14s background ease-out" },
3773
+ ...!hasCheckboxBg && {
3774
+ bg: { base: "neutral.200", _dark: "neutral.700" }
3775
+ },
3776
+ ...!hasCheckedBg && {
3777
+ _checked: { bg: "blue.500", transition: ".14s background ease-out" }
3778
+ },
3762
3779
  _active: { scale: 0.9 },
3763
3780
  color: "neutral.100",
3764
3781
  transition: ".14s background ease-out .1s",
@@ -4104,18 +4121,23 @@ function useThrottle(value, interval = 500) {
4104
4121
  }
4105
4122
  function useMatchMedia2(queries, defaultValues = []) {
4106
4123
  const initialValues = defaultValues.length ? defaultValues : Array(queries.length).fill(false);
4107
- const mediaQueryLists = queries.map((q) => window.matchMedia(q));
4108
- const getValue = () => {
4109
- const matchedQueries = mediaQueryLists.map((mql) => mql.matches);
4110
- return matchedQueries;
4111
- };
4112
- const [value, setValue] = React13__default.useState(getValue);
4124
+ const isClient = typeof window !== "undefined";
4125
+ const [value, setValue] = React13__default.useState(() => {
4126
+ if (!isClient) return initialValues;
4127
+ return queries.map((q) => window.matchMedia(q).matches);
4128
+ });
4113
4129
  React13__default.useLayoutEffect(() => {
4114
- const handler = () => setValue(getValue);
4115
- mediaQueryLists.forEach((mql) => mql.addListener(handler));
4116
- return () => mediaQueryLists.forEach((mql) => mql.removeListener(handler));
4117
- }, []);
4118
- if (typeof window === "undefined") return initialValues;
4130
+ if (!isClient) return;
4131
+ const mediaQueryLists = queries.map((q) => window.matchMedia(q));
4132
+ const handler = () => {
4133
+ setValue(mediaQueryLists.map((mql) => mql.matches));
4134
+ };
4135
+ handler();
4136
+ mediaQueryLists.forEach((mql) => mql.addEventListener("change", handler));
4137
+ return () => mediaQueryLists.forEach(
4138
+ (mql) => mql.removeEventListener("change", handler)
4139
+ );
4140
+ }, [queries, isClient]);
4119
4141
  return value;
4120
4142
  }
4121
4143
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qstd",
3
- "version": "0.3.40",
3
+ "version": "0.3.42",
4
4
  "description": "Standard Block component and utilities library with Panda CSS",
5
5
  "author": "malin1",
6
6
  "license": "MIT",