@react-typed-forms/schemas-rn 2.0.1 → 2.2.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/index.js CHANGED
@@ -170,14 +170,14 @@ function cn(...inputs) {
170
170
  return twMerge(clsx(inputs));
171
171
  }
172
172
 
173
- const _excluded$b = ["className", "asChild"];
173
+ const _excluded$d = ["className", "asChild"];
174
174
  const TextClassContext = /*#__PURE__*/React.createContext(undefined);
175
175
  const RNText = /*#__PURE__*/React.forwardRef((_ref, ref) => {
176
176
  let {
177
177
  className,
178
178
  asChild = false
179
179
  } = _ref,
180
- props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
180
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
181
181
  const textClass = React.useContext(TextClassContext);
182
182
  const Component = asChild ? Slot.Text : Text;
183
183
  return jsx(Component, _extends({
@@ -187,7 +187,7 @@ const RNText = /*#__PURE__*/React.forwardRef((_ref, ref) => {
187
187
  });
188
188
  RNText.displayName = "RNText";
189
189
 
190
- const _excluded$a = ["className", "variant", "size"];
190
+ const _excluded$c = ["className", "variant", "size"];
191
191
  const buttonVariants = 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", {
192
192
  variants: {
193
193
  variant: {
@@ -238,7 +238,7 @@ const RNButton$1 = /*#__PURE__*/React.forwardRef((_ref, ref) => {
238
238
  variant,
239
239
  size
240
240
  } = _ref,
241
- props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
241
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
242
242
  return jsx(TextClassContext.Provider, {
243
243
  value: buttonTextVariants({
244
244
  variant,
@@ -294,7 +294,7 @@ function Icon({
294
294
  }
295
295
  }
296
296
 
297
- const _excluded$9 = ["className"];
297
+ const _excluded$b = ["className"];
298
298
  function createRNCheckboxRenderer(options = {}) {
299
299
  return createDataRenderer((props, renderer) => p => _extends({}, p, {
300
300
  label: undefined,
@@ -348,7 +348,7 @@ const RNCheckbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
348
348
  let {
349
349
  className
350
350
  } = _ref,
351
- props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
351
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
352
352
  return jsx(CheckboxPrimitive.Root, _extends({
353
353
  ref: ref,
354
354
  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)
@@ -367,7 +367,7 @@ const RNCheckbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
367
367
  });
368
368
  RNCheckbox.displayName = CheckboxPrimitive.Root.displayName;
369
369
 
370
- const _excluded$8 = ["renderOptions", "control", "readonly"],
370
+ const _excluded$a = ["renderOptions", "control", "readonly"],
371
371
  _excluded2$5 = ["className", "placeholderClassName"];
372
372
  function createRNTextInputRenderer(inputClass, inputTextClass) {
373
373
  return createDataRenderer(p => {
@@ -376,7 +376,7 @@ function createRNTextInputRenderer(inputClass, inputTextClass) {
376
376
  control,
377
377
  readonly
378
378
  } = p,
379
- rest = _objectWithoutPropertiesLoose(p, _excluded$8);
379
+ rest = _objectWithoutPropertiesLoose(p, _excluded$a);
380
380
  const {
381
381
  disabled
382
382
  } = formControlProps(control);
@@ -423,7 +423,7 @@ function RNTextInput(_ref) {
423
423
  }
424
424
  RNTextInput.displayName = "RNInput";
425
425
 
426
- const _excluded$7 = ["control", "mode", "locale", "is24Hour", "className"];
426
+ const _excluded$9 = ["control", "mode", "locale", "is24Hour", "className"];
427
427
  function createRNDateTimePickerRenderer(options = {}) {
428
428
  return createDataRenderer(p => {
429
429
  const mode = p.field.type == FieldType.DateTime ? "datetime" : p.field.type == FieldType.Time ? "time" : "date";
@@ -447,7 +447,7 @@ function RNDateTimePicker(_ref) {
447
447
  is24Hour = true,
448
448
  className
449
449
  } = _ref,
450
- props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
450
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
451
451
  const disabled = control.disabled;
452
452
  const {
453
453
  maximumDate,
@@ -571,36 +571,45 @@ function RNDateTimePicker(_ref) {
571
571
  }
572
572
  }
573
573
 
574
- function RNHtmlRenderer({
575
- className,
576
- html
577
- }) {
574
+ const _excluded$8 = ["className", "html", "style", "contentWidth"];
575
+ function RNHtmlRenderer(_ref) {
578
576
  var _effect = useComponentTracking();
579
577
  try {
578
+ let {
579
+ className,
580
+ html,
581
+ style,
582
+ contentWidth
583
+ } = _ref,
584
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
580
585
  if (!html) return;
581
586
  const source = {
582
587
  html: html
583
588
  };
584
589
  return jsx(View, {
590
+ style: style,
585
591
  className: className,
586
- children: jsx(RenderHtml, {
587
- contentWidth: Dimensions.get("window").width,
592
+ children: jsx(RenderHtml, _extends({
593
+ defaultTextProps: {
594
+ selectable: true
595
+ },
596
+ contentWidth: contentWidth != null ? contentWidth : Dimensions.get("window").width,
588
597
  source: source
589
- })
598
+ }, props))
590
599
  });
591
600
  } finally {
592
601
  _effect();
593
602
  }
594
603
  }
595
604
 
596
- const _excluded$6 = ["className", "checked", "onChange"];
605
+ const _excluded$7 = ["className", "checked", "onChange"];
597
606
  const RNRadioItem = /*#__PURE__*/React.forwardRef((_ref, ref) => {
598
607
  let {
599
608
  className,
600
609
  checked,
601
610
  onChange
602
611
  } = _ref,
603
- props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
612
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
604
613
  return jsx(Pressable, _extends({
605
614
  ref: ref,
606
615
  onPress: onChange,
@@ -631,7 +640,7 @@ function createSelectConversion(ft) {
631
640
  }
632
641
  }
633
642
 
634
- const _excluded$5 = ["state", "options", "className", "convert", "required", "emptyText", "requiredText", "portalHost", "readonly"],
643
+ const _excluded$6 = ["state", "options", "className", "convert", "required", "emptyText", "requiredText", "portalHost", "readonly"],
635
644
  _excluded2$4 = ["ref", "className", "children"],
636
645
  _excluded3$2 = ["className", "children", "position", "portalHost"],
637
646
  _excluded4$2 = ["className"],
@@ -671,7 +680,7 @@ function RNSelectRenderer(_ref) {
671
680
  portalHost,
672
681
  readonly
673
682
  } = _ref,
674
- props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
683
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
675
684
  const insets = useSafeAreaInsets();
676
685
  const contentInsets = {
677
686
  top: insets.top,
@@ -848,7 +857,7 @@ const SelectItem = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
848
857
  });
849
858
  SelectItem.displayName = SelectPrimitive.Item.displayName;
850
859
 
851
- const _excluded$4 = ["className"],
860
+ const _excluded$5 = ["className"],
852
861
  _excluded2$3 = ["className", "children"],
853
862
  _excluded3$1 = ["className", "children", "portalHost", "closeOnOutsidePress"],
854
863
  _excluded4$1 = ["className"];
@@ -862,7 +871,7 @@ function DialogOverlayWeb(_ref) {
862
871
  let {
863
872
  className
864
873
  } = _ref,
865
- props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
874
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
866
875
  const {
867
876
  open
868
877
  } = DialogPrimitive.useRootContext();
@@ -1101,6 +1110,7 @@ function RNScrollListRenderer({
1101
1110
  }
1102
1111
  }
1103
1112
 
1113
+ const _excluded$4 = ["htmlClassName"];
1104
1114
  function createDefaultDisplayRenderer(options = {}) {
1105
1115
  return {
1106
1116
  render: (props, renderer) => jsx(DefaultDisplay, {
@@ -1152,12 +1162,15 @@ function DefaultDisplay({
1152
1162
  inline: displayProps.inline
1153
1163
  });
1154
1164
  case DisplayDataType.Html:
1155
- return jsx(Div, {
1165
+ const {
1166
+ htmlClassName
1167
+ } = options,
1168
+ props = _objectWithoutPropertiesLoose(options, _excluded$4);
1169
+ return jsx(RNHtmlRenderer, _extends({
1156
1170
  style: style,
1157
- className: rendererClass(className, options.htmlClassName),
1158
- inline: displayProps.inline,
1171
+ className: rendererClass(className, htmlClassName),
1159
1172
  html: display ? coerceToString(display.value) : data.html
1160
- });
1173
+ }, props));
1161
1174
  case DisplayDataType.Custom:
1162
1175
  return jsx(Div, {
1163
1176
  children: jsxs(B, {
@@ -1338,6 +1351,7 @@ function DefaultDisplayOnly({
1338
1351
  dataNode,
1339
1352
  className,
1340
1353
  emptyText,
1354
+ noSelection,
1341
1355
  schemaInterface,
1342
1356
  style,
1343
1357
  renderer,
@@ -1352,15 +1366,13 @@ function DefaultDisplayOnly({
1352
1366
  display
1353
1367
  } = state.resolved;
1354
1368
  const text = display != null ? display : (_ref = schemaInterface.isEmptyValue(dataNode.schema.field, dataNode.control.value) ? emptyText : schemaInterface.textValueForData(dataNode)) != null ? _ref : "";
1355
- const {
1356
- Div
1357
- } = renderer.html;
1358
- return jsx(Div, {
1369
+ return jsx(RNDiv, {
1359
1370
  style: style,
1360
1371
  className: className,
1361
1372
  textClass: textClass,
1362
1373
  text: text,
1363
- inline: inline
1374
+ inline: inline,
1375
+ noSelection: noSelection
1364
1376
  });
1365
1377
  } finally {
1366
1378
  _effect();
@@ -2341,7 +2353,7 @@ function createButtonActionRenderer(actionId, options = {}) {
2341
2353
 
2342
2354
  const _excluded = ["inline", "textClass", "children", "notWrapInText", "androidRippleColor", "nonTextContent", "onClick"],
2343
2355
  _excluded2 = ["className", "html", "children", "textClass", "text", "style", "inline", "role"],
2344
- _excluded3 = ["className", "html", "children", "textClass", "text", "style", "inline", "role"],
2356
+ _excluded3 = ["className", "html", "children", "textClass", "text", "style", "inline", "role", "noSelection"],
2345
2357
  _excluded4 = ["id", "type", "onChangeValue", "onChangeChecked", "checked", "value"];
2346
2358
  function createDefaultDataRenderer(options = {}) {
2347
2359
  var _options$checkboxOpti, _options$checkboxOpti2, _options$radioOptions, _options$checkListOpt;
@@ -2400,7 +2412,8 @@ function createDefaultDataRenderer(options = {}) {
2400
2412
  style: props.style,
2401
2413
  inline: props.inline,
2402
2414
  renderer: renderers,
2403
- emptyText: isDisplayOnlyRenderer(renderOptions) && renderOptions.emptyText ? renderOptions.emptyText : defaultEmptyText
2415
+ emptyText: isDisplayOnlyRenderer(renderOptions) && renderOptions.emptyText ? renderOptions.emptyText : defaultEmptyText,
2416
+ noSelection: isDisplayOnlyRenderer(renderOptions) ? renderOptions.noSelection : undefined
2404
2417
  })
2405
2418
  });
2406
2419
  };
@@ -2685,7 +2698,8 @@ function RNDiv(_ref4) {
2685
2698
  text,
2686
2699
  style,
2687
2700
  inline,
2688
- role
2701
+ role,
2702
+ noSelection
2689
2703
  } = _ref4,
2690
2704
  props = _objectWithoutPropertiesLoose(_ref4, _excluded3);
2691
2705
  if (html != null) {
@@ -2697,6 +2711,7 @@ function RNDiv(_ref4) {
2697
2711
  return jsx(Text, {
2698
2712
  style: style,
2699
2713
  className: textClass,
2714
+ selectable: !noSelection,
2700
2715
  children: text != null ? text : children
2701
2716
  });
2702
2717
  }
@@ -2708,6 +2723,7 @@ function RNDiv(_ref4) {
2708
2723
  }, props, {
2709
2724
  children: jsx(Text, {
2710
2725
  className: textClass,
2726
+ selectable: !noSelection,
2711
2727
  children: text
2712
2728
  })
2713
2729
  }));
@@ -2802,5 +2818,5 @@ function isNodeEmpty(node) {
2802
2818
  return false;
2803
2819
  }
2804
2820
 
2805
- export { DefaultBoolOptions, Dialog, DialogClose, DialogContent, DialogPortal, DialogTitle, DialogTrigger, Icon, RNButton$1 as RNButton, RNCheckbox, RNDialog, RNHtmlRenderer, RNRadioItem, RNSelectRenderer, RNText, RNTextInput, ReactNativeHtmlComponents, TextClassContext, buttonTextVariants, buttonVariants, createButtonActionRenderer, createDefaultAdornmentRenderer, createDefaultDataRenderer, createDefaultLabelRenderer, createDefaultRenderers, createRNCheckboxRenderer, createRNDateTimePickerRenderer, createRNScrollListRenderer, createRNSelectRenderer, createRNTextInputRenderer, createSelectConversion, defaultRnTailwindTheme, defaultTailwindTheme };
2821
+ export { DefaultBoolOptions, Dialog, DialogClose, DialogContent, DialogPortal, DialogTitle, DialogTrigger, Icon, RNButton$1 as RNButton, RNCheckbox, RNDialog, RNDiv, RNHtmlRenderer, RNRadioItem, RNSelectRenderer, RNText, RNTextInput, ReactNativeHtmlComponents, TextClassContext, buttonTextVariants, buttonVariants, createButtonActionRenderer, createDefaultAdornmentRenderer, createDefaultDataRenderer, createDefaultLabelRenderer, createDefaultRenderers, createRNCheckboxRenderer, createRNDateTimePickerRenderer, createRNScrollListRenderer, createRNSelectRenderer, createRNTextInputRenderer, createSelectConversion, defaultRnTailwindTheme, defaultTailwindTheme };
2806
2822
  //# sourceMappingURL=index.js.map