react-better-html 1.1.16 → 1.1.18

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.
@@ -2,13 +2,21 @@ import { ThemeConfig } from "./theme";
2
2
  import { AssetsConfig } from "./asset";
3
3
  import { IconsConfig } from "./icon";
4
4
  import { LoaderConfig } from "./loader";
5
+ import { ComponentHoverStyle, ComponentStyle } from "./components";
5
6
  export type AppConfig = {
6
7
  contentMaxWidth: number;
7
8
  };
9
+ type ComponentConfig<Subcomponents extends string> = {
10
+ [key in Subcomponents]?: ComponentStyle & ComponentHoverStyle;
11
+ };
8
12
  export type BetterHtmlConfig = {
9
13
  app: AppConfig;
10
14
  theme: ThemeConfig;
11
15
  icons: Partial<IconsConfig>;
12
16
  assets: Partial<AssetsConfig>;
13
17
  loaders: Partial<LoaderConfig>;
18
+ components: {
19
+ button?: ComponentConfig<"default" | "secondary" | "destructive" | "icon" | "upload">;
20
+ };
14
21
  };
22
+ export {};
@@ -9,11 +9,7 @@ exports.useMediaQuery = useMediaQuery;
9
9
  exports.useBooleanState = useBooleanState;
10
10
  exports.useDebounceState = useDebounceState;
11
11
  const react_1 = require("react");
12
- const cssProps = Object.keys(document.documentElement.style).reduce((previousValue, currentValue) => {
13
- previousValue[currentValue.toLowerCase()] = true;
14
- previousValue[`${currentValue}Hover`.toLowerCase()] = true;
15
- return previousValue;
16
- }, {});
12
+ const css_1 = require("../constants/css");
17
13
  const cssPropsToExclude = [
18
14
  "position",
19
15
  "top",
@@ -56,7 +52,7 @@ excludeProps) {
56
52
  hoverStyle[normalKey] = props[key];
57
53
  }
58
54
  else {
59
- if (!cssProps[key.toLowerCase()])
55
+ if (!css_1.cssProps[key.toLowerCase()])
60
56
  continue;
61
57
  normalStyle[key] = props[key];
62
58
  }
@@ -91,7 +87,7 @@ function useComponentPropsWithExcludedStyle(props) {
91
87
  }
92
88
  function useComponentPropsWithoutStyle(props) {
93
89
  return (0, react_1.useMemo)(() => Object.keys(props).reduce((previousValue, currentValue) => {
94
- if (!cssProps[currentValue.toLowerCase()])
90
+ if (!css_1.cssProps[currentValue.toLowerCase()])
95
91
  previousValue[currentValue] = props[currentValue];
96
92
  return previousValue;
97
93
  }, {}), [props]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-better-html",
3
- "version": "1.1.16",
3
+ "version": "1.1.18",
4
4
  "description": "A component library for react that is as close to plane html as possible",
5
5
  "main": "dist/index.js",
6
6
  "files": [