react-native-better-html 1.0.26 → 1.0.27
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 +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +48 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -460,13 +460,15 @@ function useForm(options) {
|
|
|
460
460
|
setFieldValue(field, value);
|
|
461
461
|
}
|
|
462
462
|
} : {
|
|
463
|
+
required: requiredFields?.includes(field),
|
|
463
464
|
isChecked: values[field],
|
|
465
|
+
errorMessage: errors[field],
|
|
464
466
|
onChange: (value) => {
|
|
465
467
|
setFieldValue(field, value);
|
|
466
468
|
}
|
|
467
469
|
};
|
|
468
470
|
},
|
|
469
|
-
[values, setFieldValue]
|
|
471
|
+
[values, setFieldValue, errors, requiredFields]
|
|
470
472
|
);
|
|
471
473
|
const reset = useCallback(() => {
|
|
472
474
|
setValues(defaultValues);
|
|
@@ -481,7 +483,9 @@ function useForm(options) {
|
|
|
481
483
|
return Object.keys(validationErrors).length === 0;
|
|
482
484
|
}, [validate, values]);
|
|
483
485
|
const canSubmit = useMemo(() => {
|
|
484
|
-
const requiredFieldsHaveValues = requiredFields?.every(
|
|
486
|
+
const requiredFieldsHaveValues = requiredFields?.every(
|
|
487
|
+
(field) => values[field] !== void 0 && values[field] !== "" && values[field] !== false
|
|
488
|
+
) ?? true;
|
|
485
489
|
return isValid && requiredFieldsHaveValues;
|
|
486
490
|
}, [isValid, requiredFields]);
|
|
487
491
|
return {
|
|
@@ -2274,7 +2278,7 @@ var Switch_default = memo14(Switch);
|
|
|
2274
2278
|
import { memo as memo15, useCallback as useCallback8, useEffect as useEffect8 } from "react";
|
|
2275
2279
|
import { Platform as Platform7 } from "react-native";
|
|
2276
2280
|
import { useBooleanState as useBooleanState6, useTheme as useTheme14 } from "react-better-core";
|
|
2277
|
-
import {
|
|
2281
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2278
2282
|
function CheckBox({
|
|
2279
2283
|
isChecked,
|
|
2280
2284
|
defaultIsChecked,
|
|
@@ -2282,6 +2286,8 @@ function CheckBox({
|
|
|
2282
2286
|
text,
|
|
2283
2287
|
required,
|
|
2284
2288
|
disabled,
|
|
2289
|
+
infoMessage,
|
|
2290
|
+
errorMessage,
|
|
2285
2291
|
onChange
|
|
2286
2292
|
}) {
|
|
2287
2293
|
const theme2 = useTheme14();
|
|
@@ -2342,23 +2348,49 @@ function CheckBox({
|
|
|
2342
2348
|
)
|
|
2343
2349
|
}
|
|
2344
2350
|
);
|
|
2345
|
-
return text ? /* @__PURE__ */
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2351
|
+
return text ? /* @__PURE__ */ jsxs8(View_default, { gap: theme2.styles.gap / 3, children: [
|
|
2352
|
+
/* @__PURE__ */ jsxs8(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.gap, children: [
|
|
2353
|
+
checkBox,
|
|
2354
|
+
/* @__PURE__ */ jsx15(
|
|
2355
|
+
View_default,
|
|
2356
|
+
{
|
|
2357
|
+
width: "100%",
|
|
2358
|
+
flexShrink: 1,
|
|
2359
|
+
pressType: "opacity",
|
|
2360
|
+
pressStrength: pressStrength().p3,
|
|
2361
|
+
onPress: !disabled ? onPressElement : void 0,
|
|
2362
|
+
children: /* @__PURE__ */ jsx15(Animate_default.View, { initialOpacity: 1, animateOpacity: disabled ? 0.6 : 1, children: /* @__PURE__ */ jsxs8(View_default, { isRow: true, alignItems: "flex-start", gap: 2, children: [
|
|
2363
|
+
/* @__PURE__ */ jsx15(View_default, { flexShrink: 1, children: typeof text === "string" ? /* @__PURE__ */ jsx15(Text_default, { children: text }) : text }),
|
|
2364
|
+
required && /* @__PURE__ */ jsx15(Label_default, { required: true })
|
|
2365
|
+
] }) })
|
|
2366
|
+
}
|
|
2367
|
+
)
|
|
2368
|
+
] }),
|
|
2369
|
+
infoMessage && /* @__PURE__ */ jsx15(
|
|
2370
|
+
Animate_default.Text,
|
|
2371
|
+
{
|
|
2372
|
+
fontSize: 14,
|
|
2373
|
+
color: theme2.colors.textSecondary,
|
|
2374
|
+
initialHeight: 0,
|
|
2375
|
+
initialOpacity: 0,
|
|
2376
|
+
animateHeight: 17,
|
|
2377
|
+
animateOpacity: 1,
|
|
2378
|
+
children: infoMessage
|
|
2379
|
+
}
|
|
2380
|
+
),
|
|
2381
|
+
errorMessage && /* @__PURE__ */ jsx15(
|
|
2382
|
+
Animate_default.Text,
|
|
2349
2383
|
{
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
required && /* @__PURE__ */ jsx15(Label_default, { required: true })
|
|
2358
|
-
] })
|
|
2384
|
+
fontSize: 14,
|
|
2385
|
+
color: theme2.colors.error,
|
|
2386
|
+
initialHeight: 0,
|
|
2387
|
+
initialOpacity: 0,
|
|
2388
|
+
animateHeight: 17,
|
|
2389
|
+
animateOpacity: 1,
|
|
2390
|
+
children: errorMessage
|
|
2359
2391
|
}
|
|
2360
2392
|
)
|
|
2361
|
-
] })
|
|
2393
|
+
] }) : checkBox;
|
|
2362
2394
|
}
|
|
2363
2395
|
var CheckBox_default = memo15(CheckBox);
|
|
2364
2396
|
|
|
@@ -2383,7 +2415,7 @@ var StatusBar_default = memo16(StatusBar);
|
|
|
2383
2415
|
// src/components/ListItem.tsx
|
|
2384
2416
|
import { memo as memo17 } from "react";
|
|
2385
2417
|
import { useTheme as useTheme16 } from "react-better-core";
|
|
2386
|
-
import { Fragment as
|
|
2418
|
+
import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2387
2419
|
function ListItem({
|
|
2388
2420
|
icon,
|
|
2389
2421
|
iconIOS,
|
|
@@ -2420,7 +2452,7 @@ function ListItem({
|
|
|
2420
2452
|
title && /* @__PURE__ */ jsx17(Text_default, { fontSize: 20, fontWeight: 700, children: title }),
|
|
2421
2453
|
description && /* @__PURE__ */ jsx17(Text_default.body, { selectable: descriptionSelectable, children: description })
|
|
2422
2454
|
] }) }),
|
|
2423
|
-
rightElement ? /* @__PURE__ */ jsx17(
|
|
2455
|
+
rightElement ? /* @__PURE__ */ jsx17(Fragment5, { children: rightValue !== void 0 || rightElement === "arrow" ? /* @__PURE__ */ jsxs9(View_default, { isRow: true, alignItems: "center", gap: theme2.styles.gap / 2, children: [
|
|
2424
2456
|
rightValue !== void 0 && /* @__PURE__ */ jsx17(Text_default, { fontSize: 14, fontWeight: 700, selectable: rightValueSelectable, children: rightValue }),
|
|
2425
2457
|
rightElement === "arrow" && /* @__PURE__ */ jsx17(
|
|
2426
2458
|
Icon_default,
|