react-better-html 1.1.14 → 1.1.16
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/components/Button.d.ts +3 -3
- package/dist/components/Div.d.ts +2 -2
- package/dist/components/Dropdown.d.ts +2 -2
- package/dist/components/Icon.d.ts +1 -1
- package/dist/components/Icon.js +2 -2
- package/dist/components/InputField.d.ts +3 -3
- package/dist/constants/assets.js +1 -5
- package/package.json +1 -1
|
@@ -8,14 +8,14 @@ type ButtonProps<Value> = {
|
|
|
8
8
|
href?: string;
|
|
9
9
|
text?: string;
|
|
10
10
|
value?: Value;
|
|
11
|
-
icon?: IconName;
|
|
11
|
+
icon?: IconName | AnyOtherString;
|
|
12
12
|
/** @default "left" */
|
|
13
13
|
iconPosition?: "left" | "right";
|
|
14
14
|
/** @default Same as text color */
|
|
15
15
|
iconColor?: string;
|
|
16
16
|
/** @default 16 */
|
|
17
17
|
iconSize?: number;
|
|
18
|
-
image?: AssetName;
|
|
18
|
+
image?: AssetName | AnyOtherString;
|
|
19
19
|
/** @default "left" */
|
|
20
20
|
imagePosition?: "left" | "right";
|
|
21
21
|
/** @default 16 */
|
|
@@ -40,7 +40,7 @@ type ButtonComponent = {
|
|
|
40
40
|
secondary: <Value>(props: ButtonProps<Value>) => React.ReactElement;
|
|
41
41
|
destructive: <Value>(props: ButtonProps<Value>) => React.ReactElement;
|
|
42
42
|
icon: <Value>(props: OmitProps<ButtonProps<Value>, "icon" | "width" | "height" | "isSmall"> & {
|
|
43
|
-
icon: IconName;
|
|
43
|
+
icon: IconName | AnyOtherString;
|
|
44
44
|
/** @default 16 */
|
|
45
45
|
size?: number;
|
|
46
46
|
/** @default "#000000" */
|
package/dist/components/Div.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WebTarget } from "styled-components";
|
|
2
2
|
import { ComponentHoverStyle, ComponentPropWithRef, ComponentStyle } from "../types/components";
|
|
3
3
|
import { OmitProps } from "../types/app";
|
|
4
4
|
export type DivProps<Value> = {
|
|
5
5
|
value?: Value;
|
|
6
6
|
/** @default "div" */
|
|
7
|
-
as?:
|
|
7
|
+
as?: WebTarget;
|
|
8
8
|
isTabAccessed?: boolean;
|
|
9
9
|
onClickWithValue?: (value: Value) => void;
|
|
10
10
|
} & OmitProps<React.ComponentProps<"div">, "style" | "defaultValue"> & ComponentStyle & ComponentHoverStyle;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentPropWithRef } from "../types/components";
|
|
2
|
-
import { OmitProps } from "../types/app";
|
|
2
|
+
import { AnyOtherString, OmitProps } from "../types/app";
|
|
3
3
|
import { IconName } from "../types/icon";
|
|
4
4
|
import { DivProps } from "./Div";
|
|
5
5
|
export type DropdownOption<Value, Data = unknown> = {
|
|
@@ -18,7 +18,7 @@ type DropdownProps<Value, Data> = {
|
|
|
18
18
|
options: DropdownOption<Value, Data>[];
|
|
19
19
|
value?: Value;
|
|
20
20
|
placeholder?: string;
|
|
21
|
-
leftIcon?: IconName;
|
|
21
|
+
leftIcon?: IconName | AnyOtherString;
|
|
22
22
|
withSearch?: boolean;
|
|
23
23
|
withDebounce?: boolean;
|
|
24
24
|
/** @default 0.5s */
|
|
@@ -5,7 +5,7 @@ type IconProps = {
|
|
|
5
5
|
name: IconName | AnyOtherString;
|
|
6
6
|
/** @default 16 */
|
|
7
7
|
size?: number;
|
|
8
|
-
} & OmitProps<React.ComponentProps<"svg">, "style" | "width" | "height" | "viewBox" | "fill" | "xmlns"> & ComponentStyle & ComponentHoverStyle;
|
|
8
|
+
} & OmitProps<React.ComponentProps<"svg">, "style" | "width" | "height" | "viewBox" | "fill" | "xmlns" | "name"> & ComponentStyle & ComponentHoverStyle;
|
|
9
9
|
type IconComponent = {
|
|
10
10
|
(props: ComponentPropWithRef<SVGSVGElement, IconProps>): React.ReactElement;
|
|
11
11
|
};
|
package/dist/components/Icon.js
CHANGED
|
@@ -27,10 +27,10 @@ const Icon = (0, react_2.forwardRef)(function Icon({ name, size = 16, ...props }
|
|
|
27
27
|
const restProps = (0, hooks_1.useComponentPropsWithoutStyle)(props);
|
|
28
28
|
const svgColor = props.color ?? theme.colors.textPrimary;
|
|
29
29
|
(0, react_2.useEffect)(() => {
|
|
30
|
-
if (!icons[name])
|
|
30
|
+
if (!icons[name.toString()])
|
|
31
31
|
console.warn(`The icon \`${name}\` you are trying to use does not exist. Make sure to add it to the \`icons\` object in \`<BetterHtmlProvider>\` config value prop.`);
|
|
32
32
|
}, [icons, name]);
|
|
33
|
-
return ((0, jsx_runtime_1.jsx)(IconElement, { width: size, height: size, viewBox: `0 0 ${icons[name]?.width ?? 0} ${icons[name]?.height ?? 0}`, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...styledComponentStyles, ...dataProps, ...ariaProps, ...restProps, ref: ref, children: icons[name]?.paths.map((path) => ((0, react_1.createElement)("path", { ...path, fill: path.type === "fill" ? svgColor : undefined, stroke: path.type === "stroke" ? svgColor : undefined, key: path.d }))) }));
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(IconElement, { width: size, height: size, viewBox: `0 0 ${icons[name.toString()]?.width ?? 0} ${icons[name.toString()]?.height ?? 0}`, fill: "none", xmlns: "http://www.w3.org/2000/svg", ...styledComponentStyles, ...dataProps, ...ariaProps, ...restProps, ref: ref, children: icons[name.toString()]?.paths.map((path) => ((0, react_1.createElement)("path", { ...path, fill: path.type === "fill" ? svgColor : undefined, stroke: path.type === "stroke" ? svgColor : undefined, key: path.d }))) }));
|
|
34
34
|
});
|
|
35
35
|
const MemoizedIcon = (0, react_2.memo)(Icon);
|
|
36
36
|
exports.default = { Icon: MemoizedIcon }.Icon;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { ComponentHoverStyle, ComponentPropWithRef, ComponentStyle } from "../types/components";
|
|
3
|
-
import { OmitProps } from "../types/app";
|
|
3
|
+
import { AnyOtherString, OmitProps } from "../types/app";
|
|
4
4
|
import { IconName } from "../types/icon";
|
|
5
5
|
type InputFieldProps = {
|
|
6
6
|
label?: string;
|
|
7
7
|
errorText?: string;
|
|
8
8
|
infoText?: string;
|
|
9
|
-
leftIcon?: IconName;
|
|
10
|
-
rightIcon?: IconName;
|
|
9
|
+
leftIcon?: IconName | AnyOtherString;
|
|
10
|
+
rightIcon?: IconName | AnyOtherString;
|
|
11
11
|
insideInputFieldComponent?: React.ReactNode;
|
|
12
12
|
withDebounce?: boolean;
|
|
13
13
|
/** @default 0.5s */
|
package/dist/constants/assets.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.assets = void 0;
|
|
7
|
-
const logo_svg_1 = __importDefault(require("../assets/logo.svg"));
|
|
8
4
|
exports.assets = {
|
|
9
|
-
logo:
|
|
5
|
+
logo: "",
|
|
10
6
|
};
|