@react-typed-forms/schemas-rn 2.0.0 → 2.1.0
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/lib/components/RNHtmlRenderer.d.ts +5 -2
- package/lib/index.cjs +51 -34
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +53 -35
- package/lib/index.js.map +1 -1
- package/lib/rendererOptions.d.ts +4 -0
- package/package.json +1 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { RenderHTMLProps } from "react-native-render-html";
|
|
2
|
+
import React from "react";
|
|
1
3
|
export type RNHtmlRendererProps = {
|
|
2
4
|
className?: string;
|
|
3
5
|
html?: string;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
style?: React.CSSProperties | undefined;
|
|
7
|
+
} & Pick<RenderHTMLProps, "baseStyle" | "tagsStyles" | "systemFonts" | "contentWidth">;
|
|
8
|
+
export declare function RNHtmlRenderer({ className, html, style, contentWidth, ...props }: RNHtmlRendererProps): import("react/jsx-runtime").JSX.Element | undefined;
|
package/lib/index.cjs
CHANGED
|
@@ -205,13 +205,13 @@ function cn() {
|
|
|
205
205
|
return tailwindMerge.twMerge(clsx.clsx([].slice.call(arguments)));
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
-
var _excluded$
|
|
208
|
+
var _excluded$d = ["className", "asChild"];
|
|
209
209
|
var TextClassContext = /*#__PURE__*/React__namespace.createContext(undefined);
|
|
210
210
|
var RNText = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
211
211
|
var className = _ref.className,
|
|
212
212
|
_ref$asChild = _ref.asChild,
|
|
213
213
|
asChild = _ref$asChild === void 0 ? false : _ref$asChild,
|
|
214
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
214
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
|
|
215
215
|
var textClass = React__namespace.useContext(TextClassContext);
|
|
216
216
|
var Component = asChild ? Slot__namespace.Text : reactNative.Text;
|
|
217
217
|
return jsxRuntime.jsx(Component, _extends({
|
|
@@ -221,7 +221,7 @@ var RNText = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
|
221
221
|
});
|
|
222
222
|
RNText.displayName = "RNText";
|
|
223
223
|
|
|
224
|
-
var _excluded$
|
|
224
|
+
var _excluded$c = ["className", "variant", "size"];
|
|
225
225
|
var buttonVariants = classVarianceAuthority.cva("group flex items-center justify-center rounded-md web:ring-offset-background web:transition-colors web:focus-visible:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2", {
|
|
226
226
|
variants: {
|
|
227
227
|
variant: {
|
|
@@ -270,7 +270,7 @@ var RNButton$1 = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
|
270
270
|
var className = _ref.className,
|
|
271
271
|
variant = _ref.variant,
|
|
272
272
|
size = _ref.size,
|
|
273
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
273
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
|
|
274
274
|
return jsxRuntime.jsx(TextClassContext.Provider, {
|
|
275
275
|
value: buttonTextVariants({
|
|
276
276
|
variant: variant,
|
|
@@ -326,7 +326,7 @@ function Icon(_ref) {
|
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
var _excluded$
|
|
329
|
+
var _excluded$b = ["className"];
|
|
330
330
|
function createRNCheckboxRenderer(options) {
|
|
331
331
|
if (options === void 0) {
|
|
332
332
|
options = {};
|
|
@@ -382,7 +382,7 @@ function CheckBoxRenderer(_ref) {
|
|
|
382
382
|
}
|
|
383
383
|
var RNCheckbox = /*#__PURE__*/React__namespace.forwardRef(function (_ref2, ref) {
|
|
384
384
|
var className = _ref2.className,
|
|
385
|
-
props = _objectWithoutPropertiesLoose(_ref2, _excluded$
|
|
385
|
+
props = _objectWithoutPropertiesLoose(_ref2, _excluded$b);
|
|
386
386
|
return jsxRuntime.jsx(CheckboxPrimitive__namespace.Root, _extends({
|
|
387
387
|
ref: ref,
|
|
388
388
|
className: cn("web:peer h-4 w-4 native:h-[24px] native:w-[24px] shrink-0 rounded-sm native:rounded border border-accent web:ring-offset-background web:focus-visible:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className)
|
|
@@ -401,14 +401,14 @@ var RNCheckbox = /*#__PURE__*/React__namespace.forwardRef(function (_ref2, ref)
|
|
|
401
401
|
});
|
|
402
402
|
RNCheckbox.displayName = CheckboxPrimitive__namespace.Root.displayName;
|
|
403
403
|
|
|
404
|
-
var _excluded$
|
|
404
|
+
var _excluded$a = ["renderOptions", "control", "readonly"],
|
|
405
405
|
_excluded2$5 = ["className", "placeholderClassName"];
|
|
406
406
|
function createRNTextInputRenderer(inputClass, inputTextClass) {
|
|
407
407
|
return schemas.createDataRenderer(function (p) {
|
|
408
408
|
var renderOptions = p.renderOptions,
|
|
409
409
|
control = p.control,
|
|
410
410
|
readonly = p.readonly,
|
|
411
|
-
rest = _objectWithoutPropertiesLoose(p, _excluded$
|
|
411
|
+
rest = _objectWithoutPropertiesLoose(p, _excluded$a);
|
|
412
412
|
var _formControlProps = core.formControlProps(control),
|
|
413
413
|
disabled = _formControlProps.disabled;
|
|
414
414
|
var placeholder = renderOptions.placeholder,
|
|
@@ -452,7 +452,7 @@ function RNTextInput(_ref) {
|
|
|
452
452
|
}
|
|
453
453
|
RNTextInput.displayName = "RNInput";
|
|
454
454
|
|
|
455
|
-
var _excluded$
|
|
455
|
+
var _excluded$9 = ["control", "mode", "locale", "is24Hour", "className"];
|
|
456
456
|
function createRNDateTimePickerRenderer(options) {
|
|
457
457
|
if (options === void 0) {
|
|
458
458
|
options = {};
|
|
@@ -482,7 +482,7 @@ function RNDateTimePicker(_ref) {
|
|
|
482
482
|
try {
|
|
483
483
|
switch (mode) {
|
|
484
484
|
case "date":
|
|
485
|
-
return date.parseDate(dateString).toDate(
|
|
485
|
+
return date.parseDate(dateString).toDate("UTC");
|
|
486
486
|
case "datetime":
|
|
487
487
|
return date.parseAbsolute(dateString, date.getLocalTimeZone()).toDate();
|
|
488
488
|
case "time":
|
|
@@ -502,7 +502,7 @@ function RNDateTimePicker(_ref) {
|
|
|
502
502
|
day: "2-digit",
|
|
503
503
|
month: "2-digit",
|
|
504
504
|
year: "numeric",
|
|
505
|
-
timeZone:
|
|
505
|
+
timeZone: "UTC"
|
|
506
506
|
};
|
|
507
507
|
break;
|
|
508
508
|
case "datetime":
|
|
@@ -538,7 +538,7 @@ function RNDateTimePicker(_ref) {
|
|
|
538
538
|
_ref$is24Hour = _ref.is24Hour,
|
|
539
539
|
is24Hour = _ref$is24Hour === void 0 ? true : _ref$is24Hour,
|
|
540
540
|
className = _ref.className,
|
|
541
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
541
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
|
|
542
542
|
var disabled = control.disabled;
|
|
543
543
|
var maximumDate = props.maximumDate,
|
|
544
544
|
minimumDate = props.minimumDate;
|
|
@@ -601,33 +601,38 @@ function RNDateTimePicker(_ref) {
|
|
|
601
601
|
}
|
|
602
602
|
}
|
|
603
603
|
|
|
604
|
+
var _excluded$8 = ["className", "html", "style", "contentWidth"];
|
|
604
605
|
function RNHtmlRenderer(_ref) {
|
|
605
606
|
var _effect = core.useComponentTracking();
|
|
606
607
|
try {
|
|
607
608
|
var className = _ref.className,
|
|
608
|
-
html = _ref.html
|
|
609
|
+
html = _ref.html,
|
|
610
|
+
style = _ref.style,
|
|
611
|
+
contentWidth = _ref.contentWidth,
|
|
612
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
|
|
609
613
|
if (!html) return;
|
|
610
614
|
var source = {
|
|
611
615
|
html: html
|
|
612
616
|
};
|
|
613
617
|
return jsxRuntime.jsx(reactNative.View, {
|
|
618
|
+
style: style,
|
|
614
619
|
className: className,
|
|
615
|
-
children: jsxRuntime.jsx(RenderHtml__default["default"], {
|
|
616
|
-
contentWidth: reactNative.Dimensions.get("window").width,
|
|
620
|
+
children: jsxRuntime.jsx(RenderHtml__default["default"], _extends({
|
|
621
|
+
contentWidth: contentWidth != null ? contentWidth : reactNative.Dimensions.get("window").width,
|
|
617
622
|
source: source
|
|
618
|
-
})
|
|
623
|
+
}, props))
|
|
619
624
|
});
|
|
620
625
|
} finally {
|
|
621
626
|
_effect();
|
|
622
627
|
}
|
|
623
628
|
}
|
|
624
629
|
|
|
625
|
-
var _excluded$
|
|
630
|
+
var _excluded$7 = ["className", "checked", "onChange"];
|
|
626
631
|
var RNRadioItem = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
|
|
627
632
|
var className = _ref.className,
|
|
628
633
|
checked = _ref.checked,
|
|
629
634
|
onChange = _ref.onChange,
|
|
630
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
635
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
631
636
|
return jsxRuntime.jsx(reactNative.Pressable, _extends({
|
|
632
637
|
ref: ref,
|
|
633
638
|
onPress: onChange,
|
|
@@ -660,7 +665,7 @@ function createSelectConversion(ft) {
|
|
|
660
665
|
}
|
|
661
666
|
}
|
|
662
667
|
|
|
663
|
-
var _excluded$
|
|
668
|
+
var _excluded$6 = ["state", "options", "className", "convert", "required", "emptyText", "requiredText", "portalHost", "readonly"],
|
|
664
669
|
_excluded2$4 = ["ref", "className", "children"],
|
|
665
670
|
_excluded3$2 = ["className", "children", "position", "portalHost"],
|
|
666
671
|
_excluded4$2 = ["className"],
|
|
@@ -711,7 +716,7 @@ function RNSelectRenderer(_ref) {
|
|
|
711
716
|
requiredText = _ref$requiredText === void 0 ? "Please select" : _ref$requiredText,
|
|
712
717
|
portalHost = _ref.portalHost,
|
|
713
718
|
readonly = _ref.readonly,
|
|
714
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
719
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
|
|
715
720
|
var insets = reactNativeSafeAreaContext.useSafeAreaInsets();
|
|
716
721
|
var contentInsets = {
|
|
717
722
|
top: insets.top,
|
|
@@ -813,10 +818,11 @@ function SelectTrigger(_ref2) {
|
|
|
813
818
|
props = _objectWithoutPropertiesLoose(_ref2, _excluded2$4);
|
|
814
819
|
return jsxRuntime.jsxs(SelectPrimitive__namespace.Trigger, _extends({
|
|
815
820
|
ref: ref,
|
|
816
|
-
className: cn("flex flex-row h-10 native:h-12 items-center text-sm justify-between border border-[#E7E7E8] bg-background px-3 py-2 [&>span]:line-clamp-1 min-w-[128px]", props.disabled && "opacity-50", className)
|
|
821
|
+
className: cn("flex flex-row min-h-10 native:min-h-12 items-center text-sm justify-between border border-[#E7E7E8] bg-background px-3 py-2 [&>span]:line-clamp-1 min-w-[128px]", props.disabled && "opacity-50", className)
|
|
817
822
|
}, props, {
|
|
818
823
|
children: [jsxRuntime.jsx(reactNative.Pressable, {
|
|
819
824
|
pointerEvents: "none",
|
|
825
|
+
className: "flex-1",
|
|
820
826
|
children: children
|
|
821
827
|
}), jsxRuntime.jsx(Icon, {
|
|
822
828
|
name: "chevron-down",
|
|
@@ -890,7 +896,7 @@ var SelectItem = /*#__PURE__*/React__namespace.forwardRef(function (_ref5, ref)
|
|
|
890
896
|
});
|
|
891
897
|
SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
|
|
892
898
|
|
|
893
|
-
var _excluded$
|
|
899
|
+
var _excluded$5 = ["className"],
|
|
894
900
|
_excluded2$3 = ["className", "children"],
|
|
895
901
|
_excluded3$1 = ["className", "children", "portalHost", "closeOnOutsidePress"],
|
|
896
902
|
_excluded4$1 = ["className"];
|
|
@@ -902,7 +908,7 @@ function DialogOverlayWeb(_ref) {
|
|
|
902
908
|
var _effect = core.useComponentTracking();
|
|
903
909
|
try {
|
|
904
910
|
var className = _ref.className,
|
|
905
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
911
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
|
|
906
912
|
var _DialogPrimitive$useR = DialogPrimitive__namespace.useRootContext(),
|
|
907
913
|
open = _DialogPrimitive$useR.open;
|
|
908
914
|
return jsxRuntime.jsx(DialogPrimitive__namespace.Overlay, _extends({
|
|
@@ -1138,6 +1144,7 @@ function RNScrollListRenderer(_ref) {
|
|
|
1138
1144
|
}
|
|
1139
1145
|
}
|
|
1140
1146
|
|
|
1147
|
+
var _excluded$4 = ["htmlClassName"];
|
|
1141
1148
|
function createDefaultDisplayRenderer(options) {
|
|
1142
1149
|
if (options === void 0) {
|
|
1143
1150
|
options = {};
|
|
@@ -1190,12 +1197,13 @@ function DefaultDisplay(_ref) {
|
|
|
1190
1197
|
inline: displayProps.inline
|
|
1191
1198
|
});
|
|
1192
1199
|
case schemas.DisplayDataType.Html:
|
|
1193
|
-
|
|
1200
|
+
var htmlClassName = options.htmlClassName,
|
|
1201
|
+
props = _objectWithoutPropertiesLoose(options, _excluded$4);
|
|
1202
|
+
return jsxRuntime.jsx(RNHtmlRenderer, _extends({
|
|
1194
1203
|
style: style,
|
|
1195
|
-
className: schemas.rendererClass(className,
|
|
1196
|
-
inline: displayProps.inline,
|
|
1204
|
+
className: schemas.rendererClass(className, htmlClassName),
|
|
1197
1205
|
html: display ? schemas.coerceToString(display.value) : data.html
|
|
1198
|
-
});
|
|
1206
|
+
}, props));
|
|
1199
1207
|
case schemas.DisplayDataType.Custom:
|
|
1200
1208
|
return jsxRuntime.jsx(Div, {
|
|
1201
1209
|
children: jsxRuntime.jsxs(B, {
|
|
@@ -1346,7 +1354,7 @@ function RNCheckButtons(props) {
|
|
|
1346
1354
|
return jsxRuntime.jsxs(Button, {
|
|
1347
1355
|
className: clsx.clsx(schemas.rendererClass(controlClasses == null ? void 0 : controlClasses.entryWrapperClass, classes.entryWrapperClass), selOrUnsel),
|
|
1348
1356
|
onClick: function onClick() {
|
|
1349
|
-
return !readonly && setChecked(control, o, !checked);
|
|
1357
|
+
return !(readonly || disabled) && setChecked(control, o, !checked);
|
|
1350
1358
|
},
|
|
1351
1359
|
notWrapInText: true,
|
|
1352
1360
|
children: [jsxRuntime.jsxs(Div, {
|
|
@@ -2250,12 +2258,21 @@ function DefaultDialogRenderer(_ref) {
|
|
|
2250
2258
|
})
|
|
2251
2259
|
})
|
|
2252
2260
|
})]
|
|
2253
|
-
}),
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2261
|
+
}), jsxRuntime.jsx(reactNative.ScrollView, {
|
|
2262
|
+
persistentScrollbar: true,
|
|
2263
|
+
children: jsxRuntime.jsx(reactNative.View, {
|
|
2264
|
+
className: "flex flex-col gap-[12px]",
|
|
2265
|
+
onStartShouldSetResponder: function onStartShouldSetResponder() {
|
|
2266
|
+
return true;
|
|
2267
|
+
},
|
|
2268
|
+
children: allChildren.filter(function (x) {
|
|
2269
|
+
return !x.definition.placement || x.definition.placement === "dialog";
|
|
2270
|
+
}).map(function (x, i) {
|
|
2271
|
+
return props.renderChild(x, {
|
|
2272
|
+
actionOnClick: actionOnClick
|
|
2273
|
+
});
|
|
2274
|
+
})
|
|
2275
|
+
})
|
|
2259
2276
|
})]
|
|
2260
2277
|
})]
|
|
2261
2278
|
});
|