@react-typed-forms/schemas-rn 2.2.0 → 2.2.2

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
@@ -61,6 +61,7 @@ const defaultTailwindTheme = {
61
61
  buttonClass: "rounded-lg p-3 text-white disabled:opacity-75",
62
62
  primaryClass: "bg-primary-500",
63
63
  secondaryClass: "bg-secondary-500",
64
+ linkTextClass: "text-primary-500 underline",
64
65
  iconBeforeClass: "px-2",
65
66
  iconAfterClass: "px-2",
66
67
  busyIcon: fontAwesomeIcon("spinner fa-spin")
@@ -73,7 +74,7 @@ const defaultTailwindTheme = {
73
74
  inputClass: "border rounded p-2",
74
75
  displayOnlyClass: "flex flex-row items-center gap-2",
75
76
  checkOptions: {
76
- className: "flex items-center gap-4",
77
+ className: "flex gap-4",
77
78
  entryClass: "flex items-center gap-1"
78
79
  },
79
80
  selectOptions: {
@@ -114,7 +115,7 @@ const defaultRnTailwindTheme = deepMerge({
114
115
  data: {
115
116
  checkOptions: {
116
117
  entryClass: "flex flex-row items-center gap-[8px]",
117
- labelClass: "flex-1"
118
+ labelClass: "body shrink"
118
119
  },
119
120
  selectOptions: {
120
121
  emptyText: "select"
@@ -170,14 +171,14 @@ function cn(...inputs) {
170
171
  return twMerge(clsx(inputs));
171
172
  }
172
173
 
173
- const _excluded$d = ["className", "asChild"];
174
+ const _excluded$e = ["className", "asChild"];
174
175
  const TextClassContext = /*#__PURE__*/React.createContext(undefined);
175
176
  const RNText = /*#__PURE__*/React.forwardRef((_ref, ref) => {
176
177
  let {
177
178
  className,
178
179
  asChild = false
179
180
  } = _ref,
180
- props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
181
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$e);
181
182
  const textClass = React.useContext(TextClassContext);
182
183
  const Component = asChild ? Slot.Text : Text;
183
184
  return jsx(Component, _extends({
@@ -187,7 +188,7 @@ const RNText = /*#__PURE__*/React.forwardRef((_ref, ref) => {
187
188
  });
188
189
  RNText.displayName = "RNText";
189
190
 
190
- const _excluded$c = ["className", "variant", "size"];
191
+ const _excluded$d = ["className", "variant", "size"];
191
192
  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
193
  variants: {
193
194
  variant: {
@@ -238,7 +239,7 @@ const RNButton$1 = /*#__PURE__*/React.forwardRef((_ref, ref) => {
238
239
  variant,
239
240
  size
240
241
  } = _ref,
241
- props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
242
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$d);
242
243
  return jsx(TextClassContext.Provider, {
243
244
  value: buttonTextVariants({
244
245
  variant,
@@ -294,7 +295,7 @@ function Icon({
294
295
  }
295
296
  }
296
297
 
297
- const _excluded$b = ["className"];
298
+ const _excluded$c = ["className"];
298
299
  function createRNCheckboxRenderer(options = {}) {
299
300
  return createDataRenderer((props, renderer) => p => _extends({}, p, {
300
301
  label: undefined,
@@ -348,7 +349,7 @@ const RNCheckbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
348
349
  let {
349
350
  className
350
351
  } = _ref,
351
- props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
352
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$c);
352
353
  return jsx(CheckboxPrimitive.Root, _extends({
353
354
  ref: ref,
354
355
  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 +368,7 @@ const RNCheckbox = /*#__PURE__*/React.forwardRef((_ref, ref) => {
367
368
  });
368
369
  RNCheckbox.displayName = CheckboxPrimitive.Root.displayName;
369
370
 
370
- const _excluded$a = ["renderOptions", "control", "readonly"],
371
+ const _excluded$b = ["renderOptions", "control", "readonly"],
371
372
  _excluded2$5 = ["className", "placeholderClassName"];
372
373
  function createRNTextInputRenderer(inputClass, inputTextClass) {
373
374
  return createDataRenderer(p => {
@@ -376,7 +377,7 @@ function createRNTextInputRenderer(inputClass, inputTextClass) {
376
377
  control,
377
378
  readonly
378
379
  } = p,
379
- rest = _objectWithoutPropertiesLoose(p, _excluded$a);
380
+ rest = _objectWithoutPropertiesLoose(p, _excluded$b);
380
381
  const {
381
382
  disabled
382
383
  } = formControlProps(control);
@@ -423,7 +424,7 @@ function RNTextInput(_ref) {
423
424
  }
424
425
  RNTextInput.displayName = "RNInput";
425
426
 
426
- const _excluded$9 = ["control", "mode", "locale", "is24Hour", "className"];
427
+ const _excluded$a = ["control", "mode", "locale", "is24Hour", "className"];
427
428
  function createRNDateTimePickerRenderer(options = {}) {
428
429
  return createDataRenderer(p => {
429
430
  const mode = p.field.type == FieldType.DateTime ? "datetime" : p.field.type == FieldType.Time ? "time" : "date";
@@ -447,7 +448,7 @@ function RNDateTimePicker(_ref) {
447
448
  is24Hour = true,
448
449
  className
449
450
  } = _ref,
450
- props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
451
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$a);
451
452
  const disabled = control.disabled;
452
453
  const {
453
454
  maximumDate,
@@ -571,7 +572,7 @@ function RNDateTimePicker(_ref) {
571
572
  }
572
573
  }
573
574
 
574
- const _excluded$8 = ["className", "html", "style", "contentWidth"];
575
+ const _excluded$9 = ["className", "html", "style", "contentWidth", "noSelection"];
575
576
  function RNHtmlRenderer(_ref) {
576
577
  var _effect = useComponentTracking();
577
578
  try {
@@ -579,9 +580,10 @@ function RNHtmlRenderer(_ref) {
579
580
  className,
580
581
  html,
581
582
  style,
582
- contentWidth
583
+ contentWidth,
584
+ noSelection
583
585
  } = _ref,
584
- props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
586
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
585
587
  if (!html) return;
586
588
  const source = {
587
589
  html: html
@@ -591,7 +593,7 @@ function RNHtmlRenderer(_ref) {
591
593
  className: className,
592
594
  children: jsx(RenderHtml, _extends({
593
595
  defaultTextProps: {
594
- selectable: true
596
+ selectable: !noSelection
595
597
  },
596
598
  contentWidth: contentWidth != null ? contentWidth : Dimensions.get("window").width,
597
599
  source: source
@@ -602,14 +604,14 @@ function RNHtmlRenderer(_ref) {
602
604
  }
603
605
  }
604
606
 
605
- const _excluded$7 = ["className", "checked", "onChange"];
607
+ const _excluded$8 = ["className", "checked", "onChange"];
606
608
  const RNRadioItem = /*#__PURE__*/React.forwardRef((_ref, ref) => {
607
609
  let {
608
610
  className,
609
611
  checked,
610
612
  onChange
611
613
  } = _ref,
612
- props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
614
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
613
615
  return jsx(Pressable, _extends({
614
616
  ref: ref,
615
617
  onPress: onChange,
@@ -640,10 +642,10 @@ function createSelectConversion(ft) {
640
642
  }
641
643
  }
642
644
 
643
- const _excluded$6 = ["state", "options", "className", "convert", "required", "emptyText", "requiredText", "portalHost", "readonly"],
645
+ const _excluded$7 = ["state", "options", "className", "convert", "required", "emptyText", "requiredText", "portalHost", "readonly"],
644
646
  _excluded2$4 = ["ref", "className", "children"],
645
647
  _excluded3$2 = ["className", "children", "position", "portalHost"],
646
- _excluded4$2 = ["className"],
648
+ _excluded4$1 = ["className"],
647
649
  _excluded5 = ["className", "children"];
648
650
  function createRNSelectRenderer(options = {}) {
649
651
  return createDataRenderer((props, asArray) => {
@@ -680,7 +682,7 @@ function RNSelectRenderer(_ref) {
680
682
  portalHost,
681
683
  readonly
682
684
  } = _ref,
683
- props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
685
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
684
686
  const insets = useSafeAreaInsets();
685
687
  const contentInsets = {
686
688
  top: insets.top,
@@ -826,7 +828,7 @@ const SelectLabel = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
826
828
  let {
827
829
  className
828
830
  } = _ref4,
829
- props = _objectWithoutPropertiesLoose(_ref4, _excluded4$2);
831
+ props = _objectWithoutPropertiesLoose(_ref4, _excluded4$1);
830
832
  return jsx(SelectPrimitive.Label, _extends({
831
833
  ref: ref,
832
834
  className: cn("py-1.5 native:pb-2 pl-2 native:pl-2 pr-2 text-popover-foreground text-sm native:text-base font-semibold", className)
@@ -857,10 +859,10 @@ const SelectItem = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
857
859
  });
858
860
  SelectItem.displayName = SelectPrimitive.Item.displayName;
859
861
 
860
- const _excluded$5 = ["className"],
862
+ const _excluded$6 = ["className"],
861
863
  _excluded2$3 = ["className", "children"],
862
864
  _excluded3$1 = ["className", "children", "portalHost", "closeOnOutsidePress"],
863
- _excluded4$1 = ["className"];
865
+ _excluded4 = ["className"];
864
866
  const Dialog = DialogPrimitive.Root;
865
867
  const DialogTrigger = DialogPrimitive.Trigger;
866
868
  const DialogPortal = DialogPrimitive.Portal;
@@ -871,7 +873,7 @@ function DialogOverlayWeb(_ref) {
871
873
  let {
872
874
  className
873
875
  } = _ref,
874
- props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
876
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
875
877
  const {
876
878
  open
877
879
  } = DialogPrimitive.useRootContext();
@@ -937,7 +939,7 @@ const DialogTitle = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
937
939
  let {
938
940
  className
939
941
  } = _ref4,
940
- props = _objectWithoutPropertiesLoose(_ref4, _excluded4$1);
942
+ props = _objectWithoutPropertiesLoose(_ref4, _excluded4);
941
943
  return jsx(DialogPrimitive.Title, _extends({
942
944
  ref: ref,
943
945
  className: cn(className)
@@ -1110,6 +1112,60 @@ function RNScrollListRenderer({
1110
1112
  }
1111
1113
  }
1112
1114
 
1115
+ const _excluded$5 = ["className", "html", "children", "textClass", "text", "style", "inline", "role", "selectable"];
1116
+ function RNDiv(_ref) {
1117
+ var _effect = useComponentTracking();
1118
+ try {
1119
+ let {
1120
+ className,
1121
+ html,
1122
+ children,
1123
+ textClass,
1124
+ text,
1125
+ style,
1126
+ inline,
1127
+ role,
1128
+ selectable
1129
+ } = _ref,
1130
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
1131
+ if (html != null) {
1132
+ return jsx(RNHtmlRenderer, _extends({}, props, {
1133
+ html: html,
1134
+ noSelection: !selectable
1135
+ }));
1136
+ }
1137
+ if (inline) {
1138
+ return jsx(Text, {
1139
+ style: style,
1140
+ className: textClass,
1141
+ selectable: selectable,
1142
+ children: text != null ? text : children
1143
+ });
1144
+ }
1145
+ if (text != null) {
1146
+ return jsx(View, _extends({
1147
+ className: className,
1148
+ style: style,
1149
+ role: role
1150
+ }, props, {
1151
+ children: jsx(Text, {
1152
+ className: textClass,
1153
+ selectable: selectable,
1154
+ children: text
1155
+ })
1156
+ }));
1157
+ }
1158
+ return jsx(View, _extends({
1159
+ className: className,
1160
+ style: style,
1161
+ children: children,
1162
+ role: role
1163
+ }, props));
1164
+ } finally {
1165
+ _effect();
1166
+ }
1167
+ }
1168
+
1113
1169
  const _excluded$4 = ["htmlClassName"];
1114
1170
  function createDefaultDisplayRenderer(options = {}) {
1115
1171
  return {
@@ -1140,8 +1196,7 @@ function DefaultDisplay({
1140
1196
  I,
1141
1197
  Div,
1142
1198
  B,
1143
- H1,
1144
- Span
1199
+ H1
1145
1200
  } = renderer.html;
1146
1201
  switch (data.type) {
1147
1202
  case DisplayDataType.Icon:
@@ -1154,12 +1209,13 @@ function DefaultDisplay({
1154
1209
  });
1155
1210
  case DisplayDataType.Text:
1156
1211
  const text = display ? coerceToString(display.value) : data.text;
1157
- return jsx(Div, {
1212
+ return jsx(RNDiv, {
1158
1213
  style: style,
1159
1214
  className: rendererClass(className, options.textClassName),
1160
1215
  textClass: rendererClass(textClass, options.textTextClass),
1161
1216
  text: text,
1162
- inline: displayProps.inline
1217
+ inline: displayProps.inline,
1218
+ selectable: !displayProps.noSelection
1163
1219
  });
1164
1220
  case DisplayDataType.Html:
1165
1221
  const {
@@ -1169,6 +1225,7 @@ function DefaultDisplay({
1169
1225
  return jsx(RNHtmlRenderer, _extends({
1170
1226
  style: style,
1171
1227
  className: rendererClass(className, htmlClassName),
1228
+ noSelection: displayProps.noSelection,
1172
1229
  html: display ? coerceToString(display.value) : data.html
1173
1230
  }, props));
1174
1231
  case DisplayDataType.Custom:
@@ -1333,7 +1390,7 @@ function RNCheckButtons(props) {
1333
1390
  }
1334
1391
  }), jsx(Label, {
1335
1392
  className: classes.labelClass,
1336
- textClass: classes.labelClass,
1393
+ textClass: classes.labelTextClass,
1337
1394
  htmlFor: name + "_" + i,
1338
1395
  children: o.name
1339
1396
  })]
@@ -1372,7 +1429,7 @@ function DefaultDisplayOnly({
1372
1429
  textClass: textClass,
1373
1430
  text: text,
1374
1431
  inline: inline,
1375
- noSelection: noSelection
1432
+ selectable: !noSelection
1376
1433
  });
1377
1434
  } finally {
1378
1435
  _effect();
@@ -2317,8 +2374,7 @@ function createButtonActionRenderer(actionId, options = {}) {
2317
2374
  const iconPlacement = busyIcon ? busyPlacement : stdIconPlacement;
2318
2375
  const {
2319
2376
  Button,
2320
- I,
2321
- Span
2377
+ I
2322
2378
  } = renderer.html;
2323
2379
  const isLink = actionStyle == ActionStyle.Link;
2324
2380
  const isGroup = actionStyle == ActionStyle.Group;
@@ -2329,7 +2385,7 @@ function createButtonActionRenderer(actionId, options = {}) {
2329
2385
  iconLibrary: icon.library,
2330
2386
  className: rendererClass(textClassNames, iconPlacement == IconPlacement.BeforeText ? options.iconBeforeClass : options.iconAfterClass)
2331
2387
  });
2332
- const textElement = actionContent != null ? actionContent : actionText && jsx(Span, {
2388
+ const textElement = actionContent != null ? actionContent : actionText && jsx(Text, {
2333
2389
  className: textClassNames,
2334
2390
  children: actionText
2335
2391
  });
@@ -2353,8 +2409,7 @@ function createButtonActionRenderer(actionId, options = {}) {
2353
2409
 
2354
2410
  const _excluded = ["inline", "textClass", "children", "notWrapInText", "androidRippleColor", "nonTextContent", "onClick"],
2355
2411
  _excluded2 = ["className", "html", "children", "textClass", "text", "style", "inline", "role"],
2356
- _excluded3 = ["className", "html", "children", "textClass", "text", "style", "inline", "role", "noSelection"],
2357
- _excluded4 = ["id", "type", "onChangeValue", "onChangeChecked", "checked", "value"];
2412
+ _excluded3 = ["id", "type", "onChangeValue", "onChangeChecked", "checked", "value"];
2358
2413
  function createDefaultDataRenderer(options = {}) {
2359
2414
  var _options$checkboxOpti, _options$checkboxOpti2, _options$radioOptions, _options$checkListOpt;
2360
2415
  const elementSelectedRenderer = createElementSelectedRenderer((_options$checkboxOpti = options.checkboxOptions) != null ? _options$checkboxOpti : options.checkOptions);
@@ -2413,7 +2468,7 @@ function createDefaultDataRenderer(options = {}) {
2413
2468
  inline: props.inline,
2414
2469
  renderer: renderers,
2415
2470
  emptyText: isDisplayOnlyRenderer(renderOptions) && renderOptions.emptyText ? renderOptions.emptyText : defaultEmptyText,
2416
- noSelection: isDisplayOnlyRenderer(renderOptions) ? renderOptions.noSelection : undefined
2471
+ noSelection: props.definition.noSelection
2417
2472
  })
2418
2473
  });
2419
2474
  };
@@ -2687,59 +2742,8 @@ function RNLabel(_ref3) {
2687
2742
  _effect4();
2688
2743
  }
2689
2744
  }
2690
- function RNDiv(_ref4) {
2691
- var _effect5 = useComponentTracking();
2692
- try {
2693
- let {
2694
- className,
2695
- html,
2696
- children,
2697
- textClass,
2698
- text,
2699
- style,
2700
- inline,
2701
- role,
2702
- noSelection
2703
- } = _ref4,
2704
- props = _objectWithoutPropertiesLoose(_ref4, _excluded3);
2705
- if (html != null) {
2706
- return jsx(RNHtmlRenderer, _extends({}, props, {
2707
- html: html
2708
- }));
2709
- }
2710
- if (inline) {
2711
- return jsx(Text, {
2712
- style: style,
2713
- className: textClass,
2714
- selectable: !noSelection,
2715
- children: text != null ? text : children
2716
- });
2717
- }
2718
- if (text != null) {
2719
- return jsx(View, _extends({
2720
- className: className,
2721
- style: style,
2722
- role: role
2723
- }, props, {
2724
- children: jsx(Text, {
2725
- className: textClass,
2726
- selectable: !noSelection,
2727
- children: text
2728
- })
2729
- }));
2730
- }
2731
- return jsx(View, _extends({
2732
- className: className,
2733
- style: style,
2734
- children: children,
2735
- role: role
2736
- }, props));
2737
- } finally {
2738
- _effect5();
2739
- }
2740
- }
2741
2745
  function RNInput(props) {
2742
- var _effect6 = useComponentTracking();
2746
+ var _effect5 = useComponentTracking();
2743
2747
  try {
2744
2748
  const {
2745
2749
  id,
@@ -2749,7 +2753,7 @@ function RNInput(props) {
2749
2753
  checked,
2750
2754
  value
2751
2755
  } = props,
2752
- rest = _objectWithoutPropertiesLoose(props, _excluded4);
2756
+ rest = _objectWithoutPropertiesLoose(props, _excluded3);
2753
2757
  switch (type) {
2754
2758
  case "radio":
2755
2759
  return jsx(RNRadioItem, _extends({}, rest, {
@@ -2768,7 +2772,7 @@ function RNInput(props) {
2768
2772
  }));
2769
2773
  }
2770
2774
  } finally {
2771
- _effect6();
2775
+ _effect5();
2772
2776
  }
2773
2777
  }
2774
2778
  // React Native HTML Components
@@ -2818,5 +2822,5 @@ function isNodeEmpty(node) {
2818
2822
  return false;
2819
2823
  }
2820
2824
 
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 };
2825
+ 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 };
2822
2826
  //# sourceMappingURL=index.js.map