react-better-html 1.1.90 → 1.1.92
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/README.md +1 -1
- package/dist/index.d.mts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +48 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ A component library for react that is as close to plane html as possible
|
|
|
6
6
|

|
|
7
7
|

|
|
8
8
|
<br/>
|
|
9
|
-

|
|
9
|
+

|
|
10
10
|

|
|
11
11
|
<br/>
|
|
12
12
|
<br/>
|
package/dist/index.d.mts
CHANGED
|
@@ -167,6 +167,8 @@ type ImageComponent = {
|
|
|
167
167
|
profileImage: (props: ComponentPropWithRef<HTMLImageElement, OmitProps<ImageProps, "width" | "height"> & {
|
|
168
168
|
/** @default 40 */
|
|
169
169
|
size?: number;
|
|
170
|
+
letters?: string;
|
|
171
|
+
backgroundColor?: string;
|
|
170
172
|
}>) => React.ReactElement;
|
|
171
173
|
};
|
|
172
174
|
declare const Image: ImageComponent;
|
|
@@ -392,6 +394,14 @@ declare const InputField: typeof InputFieldComponent & {
|
|
|
392
394
|
time: typeof InputFieldComponent.time;
|
|
393
395
|
};
|
|
394
396
|
|
|
397
|
+
type Country = {
|
|
398
|
+
code: string;
|
|
399
|
+
name: string;
|
|
400
|
+
timeZone: string;
|
|
401
|
+
phoneNumberExtension: string;
|
|
402
|
+
phoneNumberFormat?: string;
|
|
403
|
+
};
|
|
404
|
+
|
|
395
405
|
type DropdownOption<Value, Data = unknown> = {
|
|
396
406
|
value: Value;
|
|
397
407
|
label: string;
|
|
@@ -433,9 +443,12 @@ type DropdownProps<Value, Data = unknown> = {
|
|
|
433
443
|
} & OmitProps<DivProps, "onChange" | "defaultChecked">;
|
|
434
444
|
type DropdownComponentType = {
|
|
435
445
|
<Value, Data>(props: ComponentPropWithRef<HTMLDivElement, DropdownProps<Value, Data>>): React.ReactElement;
|
|
446
|
+
countries: (props: ComponentPropWithRef<HTMLDivElement, OmitProps<DropdownProps<string, Country>, "options">>) => React.ReactElement;
|
|
436
447
|
};
|
|
437
448
|
declare const DropdownComponent: DropdownComponentType;
|
|
438
|
-
declare const Dropdown: typeof DropdownComponent & {
|
|
449
|
+
declare const Dropdown: typeof DropdownComponent & {
|
|
450
|
+
countries: typeof DropdownComponent.countries;
|
|
451
|
+
};
|
|
439
452
|
|
|
440
453
|
type ToggleInputRef = {};
|
|
441
454
|
type InternalToggleInputProps<Value> = {
|
package/dist/index.d.ts
CHANGED
|
@@ -167,6 +167,8 @@ type ImageComponent = {
|
|
|
167
167
|
profileImage: (props: ComponentPropWithRef<HTMLImageElement, OmitProps<ImageProps, "width" | "height"> & {
|
|
168
168
|
/** @default 40 */
|
|
169
169
|
size?: number;
|
|
170
|
+
letters?: string;
|
|
171
|
+
backgroundColor?: string;
|
|
170
172
|
}>) => React.ReactElement;
|
|
171
173
|
};
|
|
172
174
|
declare const Image: ImageComponent;
|
|
@@ -392,6 +394,14 @@ declare const InputField: typeof InputFieldComponent & {
|
|
|
392
394
|
time: typeof InputFieldComponent.time;
|
|
393
395
|
};
|
|
394
396
|
|
|
397
|
+
type Country = {
|
|
398
|
+
code: string;
|
|
399
|
+
name: string;
|
|
400
|
+
timeZone: string;
|
|
401
|
+
phoneNumberExtension: string;
|
|
402
|
+
phoneNumberFormat?: string;
|
|
403
|
+
};
|
|
404
|
+
|
|
395
405
|
type DropdownOption<Value, Data = unknown> = {
|
|
396
406
|
value: Value;
|
|
397
407
|
label: string;
|
|
@@ -433,9 +443,12 @@ type DropdownProps<Value, Data = unknown> = {
|
|
|
433
443
|
} & OmitProps<DivProps, "onChange" | "defaultChecked">;
|
|
434
444
|
type DropdownComponentType = {
|
|
435
445
|
<Value, Data>(props: ComponentPropWithRef<HTMLDivElement, DropdownProps<Value, Data>>): React.ReactElement;
|
|
446
|
+
countries: (props: ComponentPropWithRef<HTMLDivElement, OmitProps<DropdownProps<string, Country>, "options">>) => React.ReactElement;
|
|
436
447
|
};
|
|
437
448
|
declare const DropdownComponent: DropdownComponentType;
|
|
438
|
-
declare const Dropdown: typeof DropdownComponent & {
|
|
449
|
+
declare const Dropdown: typeof DropdownComponent & {
|
|
450
|
+
countries: typeof DropdownComponent.countries;
|
|
451
|
+
};
|
|
439
452
|
|
|
440
453
|
type ToggleInputRef = {};
|
|
441
454
|
type InternalToggleInputProps<Value> = {
|
package/dist/index.js
CHANGED
|
@@ -2543,8 +2543,22 @@ var Image = (0, import_react8.forwardRef)(function Image2({ name, src, ...props
|
|
|
2543
2543
|
}
|
|
2544
2544
|
);
|
|
2545
2545
|
});
|
|
2546
|
-
Image.profileImage = (0, import_react8.forwardRef)(function ProfileImage({ size = 40, ...props }, ref) {
|
|
2547
|
-
|
|
2546
|
+
Image.profileImage = (0, import_react8.forwardRef)(function ProfileImage({ size = 40, letters, backgroundColor, ...props }, ref) {
|
|
2547
|
+
const theme2 = useTheme();
|
|
2548
|
+
return letters ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2549
|
+
Div_default.row,
|
|
2550
|
+
{
|
|
2551
|
+
width: size,
|
|
2552
|
+
height: size,
|
|
2553
|
+
backgroundColor: backgroundColor ?? theme2.colors.backgroundSecondary,
|
|
2554
|
+
borderRadius: 999,
|
|
2555
|
+
alignItems: "center",
|
|
2556
|
+
justifyContent: "center",
|
|
2557
|
+
ref,
|
|
2558
|
+
...props,
|
|
2559
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { fontSize: size / 2.5, fontWeight: 700, children: letters.toUpperCase().slice(0, 2) })
|
|
2560
|
+
}
|
|
2561
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Image, { width: size, height: size, borderRadius: 999, objectFit: "cover", ref, ...props });
|
|
2548
2562
|
});
|
|
2549
2563
|
var MemoizedImage = (0, import_react8.memo)(Image);
|
|
2550
2564
|
MemoizedImage.profileImage = Image.profileImage;
|
|
@@ -5213,7 +5227,39 @@ var DropdownComponent = (0, import_react16.forwardRef)(function Dropdown({
|
|
|
5213
5227
|
)
|
|
5214
5228
|
] }) });
|
|
5215
5229
|
});
|
|
5230
|
+
DropdownComponent.countries = (0, import_react16.forwardRef)(function Countries({ ...props }, ref) {
|
|
5231
|
+
const theme2 = useTheme();
|
|
5232
|
+
const renderOption = (0, import_react16.useCallback)(
|
|
5233
|
+
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5234
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
5235
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text_default, { children: option.label })
|
|
5236
|
+
] }),
|
|
5237
|
+
[]
|
|
5238
|
+
);
|
|
5239
|
+
const options = (0, import_react16.useMemo)(
|
|
5240
|
+
() => countries.map(
|
|
5241
|
+
(country) => ({
|
|
5242
|
+
value: country.code,
|
|
5243
|
+
label: country.name,
|
|
5244
|
+
data: country,
|
|
5245
|
+
searchValues: [country.code]
|
|
5246
|
+
})
|
|
5247
|
+
),
|
|
5248
|
+
[]
|
|
5249
|
+
);
|
|
5250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
5251
|
+
DropdownComponent,
|
|
5252
|
+
{
|
|
5253
|
+
placeholder: "Select a country",
|
|
5254
|
+
options,
|
|
5255
|
+
renderOption,
|
|
5256
|
+
ref,
|
|
5257
|
+
...props
|
|
5258
|
+
}
|
|
5259
|
+
);
|
|
5260
|
+
});
|
|
5216
5261
|
var Dropdown2 = (0, import_react16.memo)(DropdownComponent);
|
|
5262
|
+
Dropdown2.countries = DropdownComponent.countries;
|
|
5217
5263
|
var Dropdown_default = Dropdown2;
|
|
5218
5264
|
|
|
5219
5265
|
// src/components/Calendar.tsx
|