react-better-html 1.1.207 → 1.1.209
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/index.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +31 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +97 -68
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -373,7 +373,7 @@ declare const PageHolder: typeof PageHolderComponent & {
|
|
|
373
373
|
center: typeof PageHolderComponent.center;
|
|
374
374
|
};
|
|
375
375
|
|
|
376
|
-
type ChipProps = {
|
|
376
|
+
type ChipProps<Value = unknown> = {
|
|
377
377
|
text: string;
|
|
378
378
|
/** @default theme.colors.textPrimary */
|
|
379
379
|
color?: string;
|
|
@@ -383,9 +383,12 @@ type ChipProps = {
|
|
|
383
383
|
borderRadius?: number;
|
|
384
384
|
/** @default false */
|
|
385
385
|
isCircle?: boolean;
|
|
386
|
+
value?: Value;
|
|
387
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement, globalThis.MouseEvent>) => void;
|
|
388
|
+
onClickWithValue?: (value: Value) => void;
|
|
386
389
|
} & Pick<DivProps, "border" | "borderColor" | "borderWidth" | "borderStyle"> & Pick<TextProps, "fontFamily" | "fontSize" | "fontWeight" | "fontStyle">;
|
|
387
390
|
type ChipComponentType = {
|
|
388
|
-
(props: ComponentPropWithRef<HTMLDivElement, ChipProps
|
|
391
|
+
<Value>(props: ComponentPropWithRef<HTMLDivElement, ChipProps<Value>>): React.ReactElement;
|
|
389
392
|
colored: (props: ComponentPropWithRef<HTMLDivElement, OmitProps<ChipProps, "color" | "backgroundColor"> & {
|
|
390
393
|
color?: string;
|
|
391
394
|
}>) => React.ReactElement;
|
package/dist/index.d.ts
CHANGED
|
@@ -373,7 +373,7 @@ declare const PageHolder: typeof PageHolderComponent & {
|
|
|
373
373
|
center: typeof PageHolderComponent.center;
|
|
374
374
|
};
|
|
375
375
|
|
|
376
|
-
type ChipProps = {
|
|
376
|
+
type ChipProps<Value = unknown> = {
|
|
377
377
|
text: string;
|
|
378
378
|
/** @default theme.colors.textPrimary */
|
|
379
379
|
color?: string;
|
|
@@ -383,9 +383,12 @@ type ChipProps = {
|
|
|
383
383
|
borderRadius?: number;
|
|
384
384
|
/** @default false */
|
|
385
385
|
isCircle?: boolean;
|
|
386
|
+
value?: Value;
|
|
387
|
+
onClick?: (event: React.MouseEvent<HTMLDivElement, globalThis.MouseEvent>) => void;
|
|
388
|
+
onClickWithValue?: (value: Value) => void;
|
|
386
389
|
} & Pick<DivProps, "border" | "borderColor" | "borderWidth" | "borderStyle"> & Pick<TextProps, "fontFamily" | "fontSize" | "fontWeight" | "fontStyle">;
|
|
387
390
|
type ChipComponentType = {
|
|
388
|
-
(props: ComponentPropWithRef<HTMLDivElement, ChipProps
|
|
391
|
+
<Value>(props: ComponentPropWithRef<HTMLDivElement, ChipProps<Value>>): React.ReactElement;
|
|
389
392
|
colored: (props: ComponentPropWithRef<HTMLDivElement, OmitProps<ChipProps, "color" | "backgroundColor"> & {
|
|
390
393
|
color?: string;
|
|
391
394
|
}>) => React.ReactElement;
|
package/dist/index.js
CHANGED
|
@@ -1923,7 +1923,18 @@ Image.profileImage = (0, import_react5.forwardRef)(function ProfileImage({ size
|
|
|
1923
1923
|
...props,
|
|
1924
1924
|
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Text_default, { fontSize: size / 2.5, fontWeight: 700, children: letters.toUpperCase().slice(0, 2) })
|
|
1925
1925
|
}
|
|
1926
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1926
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1927
|
+
Image,
|
|
1928
|
+
{
|
|
1929
|
+
width: size,
|
|
1930
|
+
height: size,
|
|
1931
|
+
border: `solid 1px ${theme2.colors.border}`,
|
|
1932
|
+
borderRadius: 999,
|
|
1933
|
+
objectFit: "cover",
|
|
1934
|
+
ref,
|
|
1935
|
+
...props
|
|
1936
|
+
}
|
|
1937
|
+
);
|
|
1927
1938
|
});
|
|
1928
1939
|
var MemoizedImage = (0, import_react5.memo)(Image);
|
|
1929
1940
|
MemoizedImage.profileImage = Image.profileImage;
|
|
@@ -4036,8 +4047,25 @@ var desaturateColor = (hexColor, amount) => {
|
|
|
4036
4047
|
|
|
4037
4048
|
// src/components/Chip.tsx
|
|
4038
4049
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
4039
|
-
var ChipComponent = (0, import_react16.forwardRef)(function Chip({
|
|
4050
|
+
var ChipComponent = (0, import_react16.forwardRef)(function Chip({
|
|
4051
|
+
text,
|
|
4052
|
+
color,
|
|
4053
|
+
backgroundColor,
|
|
4054
|
+
borderRadius,
|
|
4055
|
+
isCircle,
|
|
4056
|
+
value,
|
|
4057
|
+
onClick,
|
|
4058
|
+
onClickWithValue,
|
|
4059
|
+
...props
|
|
4060
|
+
}, ref) {
|
|
4040
4061
|
const theme2 = useTheme();
|
|
4062
|
+
const onClickElement = (0, import_react16.useCallback)(
|
|
4063
|
+
(event) => {
|
|
4064
|
+
onClick?.(event);
|
|
4065
|
+
onClickWithValue?.(value);
|
|
4066
|
+
},
|
|
4067
|
+
[onClick, onClickWithValue, value]
|
|
4068
|
+
);
|
|
4041
4069
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
4042
4070
|
Div_default,
|
|
4043
4071
|
{
|
|
@@ -4046,6 +4074,7 @@ var ChipComponent = (0, import_react16.forwardRef)(function Chip({ text, color,
|
|
|
4046
4074
|
borderRadius: isCircle ? 999 : borderRadius ?? theme2.styles.borderRadius / 1.3,
|
|
4047
4075
|
paddingBlock: theme2.styles.gap / 2,
|
|
4048
4076
|
paddingInline: theme2.styles.space / 1.5,
|
|
4077
|
+
onClick: onClickElement,
|
|
4049
4078
|
...props,
|
|
4050
4079
|
ref,
|
|
4051
4080
|
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text_default, { color: color ?? theme2.colors.textPrimary, children: text })
|