@react-typed-forms/schemas-rn 2.0.1 → 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.
@@ -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
- export declare function RNHtmlRenderer({ className, html }: RNHtmlRendererProps): import("react/jsx-runtime").JSX.Element | undefined;
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$b = ["className", "asChild"];
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$b);
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$a = ["className", "variant", "size"];
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$a);
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$9 = ["className"];
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$9);
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$8 = ["renderOptions", "control", "readonly"],
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$8);
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$7 = ["control", "mode", "locale", "is24Hour", "className"];
455
+ var _excluded$9 = ["control", "mode", "locale", "is24Hour", "className"];
456
456
  function createRNDateTimePickerRenderer(options) {
457
457
  if (options === void 0) {
458
458
  options = {};
@@ -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$7);
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$6 = ["className", "checked", "onChange"];
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$6);
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$5 = ["state", "options", "className", "convert", "required", "emptyText", "requiredText", "portalHost", "readonly"],
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$5);
719
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
715
720
  var insets = reactNativeSafeAreaContext.useSafeAreaInsets();
716
721
  var contentInsets = {
717
722
  top: insets.top,
@@ -891,7 +896,7 @@ var SelectItem = /*#__PURE__*/React__namespace.forwardRef(function (_ref5, ref)
891
896
  });
892
897
  SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
893
898
 
894
- var _excluded$4 = ["className"],
899
+ var _excluded$5 = ["className"],
895
900
  _excluded2$3 = ["className", "children"],
896
901
  _excluded3$1 = ["className", "children", "portalHost", "closeOnOutsidePress"],
897
902
  _excluded4$1 = ["className"];
@@ -903,7 +908,7 @@ function DialogOverlayWeb(_ref) {
903
908
  var _effect = core.useComponentTracking();
904
909
  try {
905
910
  var className = _ref.className,
906
- props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
911
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
907
912
  var _DialogPrimitive$useR = DialogPrimitive__namespace.useRootContext(),
908
913
  open = _DialogPrimitive$useR.open;
909
914
  return jsxRuntime.jsx(DialogPrimitive__namespace.Overlay, _extends({
@@ -1139,6 +1144,7 @@ function RNScrollListRenderer(_ref) {
1139
1144
  }
1140
1145
  }
1141
1146
 
1147
+ var _excluded$4 = ["htmlClassName"];
1142
1148
  function createDefaultDisplayRenderer(options) {
1143
1149
  if (options === void 0) {
1144
1150
  options = {};
@@ -1191,12 +1197,13 @@ function DefaultDisplay(_ref) {
1191
1197
  inline: displayProps.inline
1192
1198
  });
1193
1199
  case schemas.DisplayDataType.Html:
1194
- return jsxRuntime.jsx(Div, {
1200
+ var htmlClassName = options.htmlClassName,
1201
+ props = _objectWithoutPropertiesLoose(options, _excluded$4);
1202
+ return jsxRuntime.jsx(RNHtmlRenderer, _extends({
1195
1203
  style: style,
1196
- className: schemas.rendererClass(className, options.htmlClassName),
1197
- inline: displayProps.inline,
1204
+ className: schemas.rendererClass(className, htmlClassName),
1198
1205
  html: display ? schemas.coerceToString(display.value) : data.html
1199
- });
1206
+ }, props));
1200
1207
  case schemas.DisplayDataType.Custom:
1201
1208
  return jsxRuntime.jsx(Div, {
1202
1209
  children: jsxRuntime.jsxs(B, {