react-better-html 1.1.91 → 1.1.93
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 +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +85 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +85 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -381,6 +381,7 @@ type InputFieldComponentType = {
|
|
|
381
381
|
maxDate?: Date;
|
|
382
382
|
}>) => React.ReactElement;
|
|
383
383
|
time: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
|
|
384
|
+
color: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
|
|
384
385
|
};
|
|
385
386
|
declare const InputFieldComponent: InputFieldComponentType;
|
|
386
387
|
declare const InputField: typeof InputFieldComponent & {
|
|
@@ -392,6 +393,15 @@ declare const InputField: typeof InputFieldComponent & {
|
|
|
392
393
|
date: typeof InputFieldComponent.date;
|
|
393
394
|
dateTime: typeof InputFieldComponent.dateTime;
|
|
394
395
|
time: typeof InputFieldComponent.time;
|
|
396
|
+
color: typeof InputFieldComponent.color;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
type Country = {
|
|
400
|
+
code: string;
|
|
401
|
+
name: string;
|
|
402
|
+
timeZone: string;
|
|
403
|
+
phoneNumberExtension: string;
|
|
404
|
+
phoneNumberFormat?: string;
|
|
395
405
|
};
|
|
396
406
|
|
|
397
407
|
type DropdownOption<Value, Data = unknown> = {
|
|
@@ -435,9 +445,12 @@ type DropdownProps<Value, Data = unknown> = {
|
|
|
435
445
|
} & OmitProps<DivProps, "onChange" | "defaultChecked">;
|
|
436
446
|
type DropdownComponentType = {
|
|
437
447
|
<Value, Data>(props: ComponentPropWithRef<HTMLDivElement, DropdownProps<Value, Data>>): React.ReactElement;
|
|
448
|
+
countries: (props: ComponentPropWithRef<HTMLDivElement, OmitProps<DropdownProps<string, Country>, "options">>) => React.ReactElement;
|
|
438
449
|
};
|
|
439
450
|
declare const DropdownComponent: DropdownComponentType;
|
|
440
|
-
declare const Dropdown: typeof DropdownComponent & {
|
|
451
|
+
declare const Dropdown: typeof DropdownComponent & {
|
|
452
|
+
countries: typeof DropdownComponent.countries;
|
|
453
|
+
};
|
|
441
454
|
|
|
442
455
|
type ToggleInputRef = {};
|
|
443
456
|
type InternalToggleInputProps<Value> = {
|
package/dist/index.d.ts
CHANGED
|
@@ -381,6 +381,7 @@ type InputFieldComponentType = {
|
|
|
381
381
|
maxDate?: Date;
|
|
382
382
|
}>) => React.ReactElement;
|
|
383
383
|
time: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
|
|
384
|
+
color: (props: ComponentPropWithRef<HTMLInputElement, InputFieldProps>) => React.ReactElement;
|
|
384
385
|
};
|
|
385
386
|
declare const InputFieldComponent: InputFieldComponentType;
|
|
386
387
|
declare const InputField: typeof InputFieldComponent & {
|
|
@@ -392,6 +393,15 @@ declare const InputField: typeof InputFieldComponent & {
|
|
|
392
393
|
date: typeof InputFieldComponent.date;
|
|
393
394
|
dateTime: typeof InputFieldComponent.dateTime;
|
|
394
395
|
time: typeof InputFieldComponent.time;
|
|
396
|
+
color: typeof InputFieldComponent.color;
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
type Country = {
|
|
400
|
+
code: string;
|
|
401
|
+
name: string;
|
|
402
|
+
timeZone: string;
|
|
403
|
+
phoneNumberExtension: string;
|
|
404
|
+
phoneNumberFormat?: string;
|
|
395
405
|
};
|
|
396
406
|
|
|
397
407
|
type DropdownOption<Value, Data = unknown> = {
|
|
@@ -435,9 +445,12 @@ type DropdownProps<Value, Data = unknown> = {
|
|
|
435
445
|
} & OmitProps<DivProps, "onChange" | "defaultChecked">;
|
|
436
446
|
type DropdownComponentType = {
|
|
437
447
|
<Value, Data>(props: ComponentPropWithRef<HTMLDivElement, DropdownProps<Value, Data>>): React.ReactElement;
|
|
448
|
+
countries: (props: ComponentPropWithRef<HTMLDivElement, OmitProps<DropdownProps<string, Country>, "options">>) => React.ReactElement;
|
|
438
449
|
};
|
|
439
450
|
declare const DropdownComponent: DropdownComponentType;
|
|
440
|
-
declare const Dropdown: typeof DropdownComponent & {
|
|
451
|
+
declare const Dropdown: typeof DropdownComponent & {
|
|
452
|
+
countries: typeof DropdownComponent.countries;
|
|
453
|
+
};
|
|
441
454
|
|
|
442
455
|
type ToggleInputRef = {};
|
|
443
456
|
type InternalToggleInputProps<Value> = {
|
package/dist/index.js
CHANGED
|
@@ -1882,7 +1882,7 @@ function useComponentInputFieldDateProps(props, holderRef, disabled) {
|
|
|
1882
1882
|
}, [isOpen]);
|
|
1883
1883
|
(0, import_react2.useEffect)(() => {
|
|
1884
1884
|
const handleClickOutside = (event) => {
|
|
1885
|
-
if (holderRef.current && !holderRef.current.contains(event.target)) {
|
|
1885
|
+
if (holderRef && holderRef.current && !holderRef.current.contains(event.target)) {
|
|
1886
1886
|
setIsOpen.setFalse();
|
|
1887
1887
|
}
|
|
1888
1888
|
};
|
|
@@ -2556,7 +2556,7 @@ Image.profileImage = (0, import_react8.forwardRef)(function ProfileImage({ size
|
|
|
2556
2556
|
justifyContent: "center",
|
|
2557
2557
|
ref,
|
|
2558
2558
|
...props,
|
|
2559
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { fontWeight: 700, children: letters.toUpperCase().slice(0, 2) })
|
|
2559
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text_default, { fontSize: size / 2.5, fontWeight: 700, children: letters.toUpperCase().slice(0, 2) })
|
|
2560
2560
|
}
|
|
2561
2561
|
) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Image, { width: size, height: size, borderRadius: 999, objectFit: "cover", ref, ...props });
|
|
2562
2562
|
});
|
|
@@ -4925,6 +4925,7 @@ function Label({ text, required, isError, color, htmlFor }) {
|
|
|
4925
4925
|
Text_default,
|
|
4926
4926
|
{
|
|
4927
4927
|
as: "label",
|
|
4928
|
+
width: "fit-content",
|
|
4928
4929
|
height: 16,
|
|
4929
4930
|
fontSize: 14,
|
|
4930
4931
|
color: isError ? theme2.colors.error : color ?? theme2.colors.textSecondary,
|
|
@@ -5227,7 +5228,39 @@ var DropdownComponent = (0, import_react16.forwardRef)(function Dropdown({
|
|
|
5227
5228
|
)
|
|
5228
5229
|
] }) });
|
|
5229
5230
|
});
|
|
5231
|
+
DropdownComponent.countries = (0, import_react16.forwardRef)(function Countries({ ...props }, ref) {
|
|
5232
|
+
const theme2 = useTheme();
|
|
5233
|
+
const renderOption = (0, import_react16.useCallback)(
|
|
5234
|
+
(option, index, isSelected) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(Div_default.row, { alignItems: "center", gap: theme2.styles.gap, children: [
|
|
5235
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Image_default, { src: `https://flagcdn.com/w80/${option.data?.code.toString().toLowerCase()}.webp`, width: 20 }),
|
|
5236
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Text_default, { children: option.label })
|
|
5237
|
+
] }),
|
|
5238
|
+
[]
|
|
5239
|
+
);
|
|
5240
|
+
const options = (0, import_react16.useMemo)(
|
|
5241
|
+
() => countries.map(
|
|
5242
|
+
(country) => ({
|
|
5243
|
+
value: country.code,
|
|
5244
|
+
label: country.name,
|
|
5245
|
+
data: country,
|
|
5246
|
+
searchValues: [country.code]
|
|
5247
|
+
})
|
|
5248
|
+
),
|
|
5249
|
+
[]
|
|
5250
|
+
);
|
|
5251
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
5252
|
+
DropdownComponent,
|
|
5253
|
+
{
|
|
5254
|
+
placeholder: "Select a country",
|
|
5255
|
+
options,
|
|
5256
|
+
renderOption,
|
|
5257
|
+
ref,
|
|
5258
|
+
...props
|
|
5259
|
+
}
|
|
5260
|
+
);
|
|
5261
|
+
});
|
|
5230
5262
|
var Dropdown2 = (0, import_react16.memo)(DropdownComponent);
|
|
5263
|
+
Dropdown2.countries = DropdownComponent.countries;
|
|
5231
5264
|
var Dropdown_default = Dropdown2;
|
|
5232
5265
|
|
|
5233
5266
|
// src/components/Calendar.tsx
|
|
@@ -5412,6 +5445,9 @@ var Calendar_default = (0, import_react17.memo)(Calendar);
|
|
|
5412
5445
|
// src/components/InputField.tsx
|
|
5413
5446
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
5414
5447
|
var buttonWidth = 50;
|
|
5448
|
+
var colorPickerSpacing = 4;
|
|
5449
|
+
var colorPickerColorWidth = 12 + 27 + colorPickerSpacing;
|
|
5450
|
+
var colorPickerValueWidth = 12 + 74 + colorPickerSpacing;
|
|
5415
5451
|
var InputElement = import_styled_components9.default.input.withConfig({
|
|
5416
5452
|
shouldForwardProp: (prop) => !["theme", "withLeftIcon", "withRightIcon", "normalStyle", "hoverStyle"].includes(prop)
|
|
5417
5453
|
})`
|
|
@@ -5460,6 +5496,17 @@ var InputElement = import_styled_components9.default.input.withConfig({
|
|
|
5460
5496
|
}
|
|
5461
5497
|
}
|
|
5462
5498
|
|
|
5499
|
+
&[type="color"] {
|
|
5500
|
+
--color-spacing: ${(props) => (props.theme.styles.space + props.theme.styles.gap) / 2}px;
|
|
5501
|
+
|
|
5502
|
+
width: calc(var(--color-spacing) + 27px + ${colorPickerValueWidth}px);
|
|
5503
|
+
height: 48px;
|
|
5504
|
+
padding: 0px;
|
|
5505
|
+
padding-block: calc(var(--color-spacing) - 3px);
|
|
5506
|
+
padding-left: var(--color-spacing);
|
|
5507
|
+
padding-right: ${colorPickerValueWidth}px;
|
|
5508
|
+
}
|
|
5509
|
+
|
|
5463
5510
|
&.react-better-html-phone-number-holder {
|
|
5464
5511
|
border-right: none;
|
|
5465
5512
|
border-top-right-radius: 0px;
|
|
@@ -6172,6 +6219,41 @@ InputFieldComponent.time = (0, import_react18.forwardRef)(function Time({ ...pro
|
|
|
6172
6219
|
}
|
|
6173
6220
|
);
|
|
6174
6221
|
});
|
|
6222
|
+
InputFieldComponent.color = (0, import_react18.forwardRef)(function Color2({ value, onChangeValue, ...props }, ref) {
|
|
6223
|
+
const [inputFieldValue, setInputFieldValue] = (0, import_react18.useState)(value ?? "#000000");
|
|
6224
|
+
const onChangeValueElement = (0, import_react18.useCallback)(
|
|
6225
|
+
(value2) => {
|
|
6226
|
+
setInputFieldValue(value2);
|
|
6227
|
+
onChangeValue?.(value2);
|
|
6228
|
+
},
|
|
6229
|
+
[onChangeValue]
|
|
6230
|
+
);
|
|
6231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6232
|
+
InputFieldComponent,
|
|
6233
|
+
{
|
|
6234
|
+
type: "color",
|
|
6235
|
+
insideInputFieldComponent: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
6236
|
+
Div_default.row,
|
|
6237
|
+
{
|
|
6238
|
+
position: "absolute",
|
|
6239
|
+
width: "100%",
|
|
6240
|
+
height: "100%",
|
|
6241
|
+
top: 0,
|
|
6242
|
+
left: colorPickerSpacing,
|
|
6243
|
+
alignItems: "center",
|
|
6244
|
+
pointerEvents: "none",
|
|
6245
|
+
userSelect: "none",
|
|
6246
|
+
paddingLeft: colorPickerColorWidth,
|
|
6247
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Text_default, { children: inputFieldValue })
|
|
6248
|
+
}
|
|
6249
|
+
),
|
|
6250
|
+
value: inputFieldValue,
|
|
6251
|
+
onChangeValue: onChangeValueElement,
|
|
6252
|
+
ref,
|
|
6253
|
+
...props
|
|
6254
|
+
}
|
|
6255
|
+
);
|
|
6256
|
+
});
|
|
6175
6257
|
var InputField2 = (0, import_react18.memo)(InputFieldComponent);
|
|
6176
6258
|
InputField2.multiline = InputFieldComponent.multiline;
|
|
6177
6259
|
InputField2.email = InputFieldComponent.email;
|
|
@@ -6181,6 +6263,7 @@ InputField2.phoneNumber = InputFieldComponent.phoneNumber;
|
|
|
6181
6263
|
InputField2.date = InputFieldComponent.date;
|
|
6182
6264
|
InputField2.dateTime = InputFieldComponent.dateTime;
|
|
6183
6265
|
InputField2.time = InputFieldComponent.time;
|
|
6266
|
+
InputField2.color = InputFieldComponent.color;
|
|
6184
6267
|
var InputField_default = InputField2;
|
|
6185
6268
|
|
|
6186
6269
|
// src/components/ToggleInput.tsx
|