@react-typed-forms/schemas-rn 2.2.1 → 2.2.3

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", "noSelection"];
575
+ const _excluded$9 = ["className", "html", "style", "contentWidth", "noSelection"];
575
576
  function RNHtmlRenderer(_ref) {
576
577
  var _effect = useComponentTracking();
577
578
  try {
@@ -582,7 +583,7 @@ function RNHtmlRenderer(_ref) {
582
583
  contentWidth,
583
584
  noSelection
584
585
  } = _ref,
585
- props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
586
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$9);
586
587
  if (!html) return;
587
588
  const source = {
588
589
  html: html
@@ -603,14 +604,14 @@ function RNHtmlRenderer(_ref) {
603
604
  }
604
605
  }
605
606
 
606
- const _excluded$7 = ["className", "checked", "onChange"];
607
+ const _excluded$8 = ["className", "checked", "onChange"];
607
608
  const RNRadioItem = /*#__PURE__*/React.forwardRef((_ref, ref) => {
608
609
  let {
609
610
  className,
610
611
  checked,
611
612
  onChange
612
613
  } = _ref,
613
- props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
614
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$8);
614
615
  return jsx(Pressable, _extends({
615
616
  ref: ref,
616
617
  onPress: onChange,
@@ -641,10 +642,10 @@ function createSelectConversion(ft) {
641
642
  }
642
643
  }
643
644
 
644
- 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"],
645
646
  _excluded2$4 = ["ref", "className", "children"],
646
647
  _excluded3$2 = ["className", "children", "position", "portalHost"],
647
- _excluded4$2 = ["className"],
648
+ _excluded4$1 = ["className"],
648
649
  _excluded5 = ["className", "children"];
649
650
  function createRNSelectRenderer(options = {}) {
650
651
  return createDataRenderer((props, asArray) => {
@@ -681,7 +682,7 @@ function RNSelectRenderer(_ref) {
681
682
  portalHost,
682
683
  readonly
683
684
  } = _ref,
684
- props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
685
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$7);
685
686
  const insets = useSafeAreaInsets();
686
687
  const contentInsets = {
687
688
  top: insets.top,
@@ -827,7 +828,7 @@ const SelectLabel = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
827
828
  let {
828
829
  className
829
830
  } = _ref4,
830
- props = _objectWithoutPropertiesLoose(_ref4, _excluded4$2);
831
+ props = _objectWithoutPropertiesLoose(_ref4, _excluded4$1);
831
832
  return jsx(SelectPrimitive.Label, _extends({
832
833
  ref: ref,
833
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)
@@ -858,10 +859,10 @@ const SelectItem = /*#__PURE__*/React.forwardRef((_ref5, ref) => {
858
859
  });
859
860
  SelectItem.displayName = SelectPrimitive.Item.displayName;
860
861
 
861
- const _excluded$5 = ["className"],
862
+ const _excluded$6 = ["className"],
862
863
  _excluded2$3 = ["className", "children"],
863
864
  _excluded3$1 = ["className", "children", "portalHost", "closeOnOutsidePress"],
864
- _excluded4$1 = ["className"];
865
+ _excluded4 = ["className"];
865
866
  const Dialog = DialogPrimitive.Root;
866
867
  const DialogTrigger = DialogPrimitive.Trigger;
867
868
  const DialogPortal = DialogPrimitive.Portal;
@@ -872,7 +873,7 @@ function DialogOverlayWeb(_ref) {
872
873
  let {
873
874
  className
874
875
  } = _ref,
875
- props = _objectWithoutPropertiesLoose(_ref, _excluded$5);
876
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$6);
876
877
  const {
877
878
  open
878
879
  } = DialogPrimitive.useRootContext();
@@ -938,7 +939,7 @@ const DialogTitle = /*#__PURE__*/React.forwardRef((_ref4, ref) => {
938
939
  let {
939
940
  className
940
941
  } = _ref4,
941
- props = _objectWithoutPropertiesLoose(_ref4, _excluded4$1);
942
+ props = _objectWithoutPropertiesLoose(_ref4, _excluded4);
942
943
  return jsx(DialogPrimitive.Title, _extends({
943
944
  ref: ref,
944
945
  className: cn(className)
@@ -1111,6 +1112,60 @@ function RNScrollListRenderer({
1111
1112
  }
1112
1113
  }
1113
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
+
1114
1169
  const _excluded$4 = ["htmlClassName"];
1115
1170
  function createDefaultDisplayRenderer(options = {}) {
1116
1171
  return {
@@ -1141,8 +1196,7 @@ function DefaultDisplay({
1141
1196
  I,
1142
1197
  Div,
1143
1198
  B,
1144
- H1,
1145
- Span
1199
+ H1
1146
1200
  } = renderer.html;
1147
1201
  switch (data.type) {
1148
1202
  case DisplayDataType.Icon:
@@ -1161,7 +1215,7 @@ function DefaultDisplay({
1161
1215
  textClass: rendererClass(textClass, options.textTextClass),
1162
1216
  text: text,
1163
1217
  inline: displayProps.inline,
1164
- noSelection: displayProps.noSelection
1218
+ selectable: !displayProps.noSelection
1165
1219
  });
1166
1220
  case DisplayDataType.Html:
1167
1221
  const {
@@ -1336,7 +1390,7 @@ function RNCheckButtons(props) {
1336
1390
  }
1337
1391
  }), jsx(Label, {
1338
1392
  className: classes.labelClass,
1339
- textClass: classes.labelClass,
1393
+ textClass: classes.labelTextClass,
1340
1394
  htmlFor: name + "_" + i,
1341
1395
  children: o.name
1342
1396
  })]
@@ -1375,7 +1429,7 @@ function DefaultDisplayOnly({
1375
1429
  textClass: textClass,
1376
1430
  text: text,
1377
1431
  inline: inline,
1378
- noSelection: noSelection
1432
+ selectable: !noSelection
1379
1433
  });
1380
1434
  } finally {
1381
1435
  _effect();
@@ -2234,18 +2288,16 @@ function createDefaultGroupRenderer(options, adornmentOptions) {
2234
2288
  } : {
2235
2289
  className: standardClassName
2236
2290
  };
2237
- const {
2238
- Div
2239
- } = renderer.html;
2240
2291
  const inline = renderOptions.type == GroupRenderType.Inline;
2241
2292
  const children = formNode.children.map((c, i) => renderChild(c, {
2242
2293
  inline
2243
2294
  }));
2244
- return jsx(Div, {
2295
+ return jsx(RNDiv, {
2245
2296
  className: rendererClass(props.className, clsx$1(className, gcn)),
2246
2297
  textClass: props.textClass,
2247
2298
  style: style,
2248
2299
  inline: inline,
2300
+ selectable: inline && !props.definition.noSelection,
2249
2301
  children: children
2250
2302
  });
2251
2303
  }
@@ -2320,8 +2372,7 @@ function createButtonActionRenderer(actionId, options = {}) {
2320
2372
  const iconPlacement = busyIcon ? busyPlacement : stdIconPlacement;
2321
2373
  const {
2322
2374
  Button,
2323
- I,
2324
- Span
2375
+ I
2325
2376
  } = renderer.html;
2326
2377
  const isLink = actionStyle == ActionStyle.Link;
2327
2378
  const isGroup = actionStyle == ActionStyle.Group;
@@ -2332,7 +2383,7 @@ function createButtonActionRenderer(actionId, options = {}) {
2332
2383
  iconLibrary: icon.library,
2333
2384
  className: rendererClass(textClassNames, iconPlacement == IconPlacement.BeforeText ? options.iconBeforeClass : options.iconAfterClass)
2334
2385
  });
2335
- const textElement = actionContent != null ? actionContent : actionText && jsx(Span, {
2386
+ const textElement = actionContent != null ? actionContent : actionText && jsx(Text, {
2336
2387
  className: textClassNames,
2337
2388
  children: actionText
2338
2389
  });
@@ -2356,8 +2407,7 @@ function createButtonActionRenderer(actionId, options = {}) {
2356
2407
 
2357
2408
  const _excluded = ["inline", "textClass", "children", "notWrapInText", "androidRippleColor", "nonTextContent", "onClick"],
2358
2409
  _excluded2 = ["className", "html", "children", "textClass", "text", "style", "inline", "role"],
2359
- _excluded3 = ["className", "html", "children", "textClass", "text", "style", "inline", "role", "noSelection"],
2360
- _excluded4 = ["id", "type", "onChangeValue", "onChangeChecked", "checked", "value"];
2410
+ _excluded3 = ["id", "type", "onChangeValue", "onChangeChecked", "checked", "value"];
2361
2411
  function createDefaultDataRenderer(options = {}) {
2362
2412
  var _options$checkboxOpti, _options$checkboxOpti2, _options$radioOptions, _options$checkListOpt;
2363
2413
  const elementSelectedRenderer = createElementSelectedRenderer((_options$checkboxOpti = options.checkboxOptions) != null ? _options$checkboxOpti : options.checkOptions);
@@ -2690,60 +2740,8 @@ function RNLabel(_ref3) {
2690
2740
  _effect4();
2691
2741
  }
2692
2742
  }
2693
- function RNDiv(_ref4) {
2694
- var _effect5 = useComponentTracking();
2695
- try {
2696
- let {
2697
- className,
2698
- html,
2699
- children,
2700
- textClass,
2701
- text,
2702
- style,
2703
- inline,
2704
- role,
2705
- noSelection
2706
- } = _ref4,
2707
- props = _objectWithoutPropertiesLoose(_ref4, _excluded3);
2708
- if (html != null) {
2709
- return jsx(RNHtmlRenderer, _extends({}, props, {
2710
- html: html,
2711
- noSelection: noSelection
2712
- }));
2713
- }
2714
- if (inline) {
2715
- return jsx(Text, {
2716
- style: style,
2717
- className: textClass,
2718
- selectable: !noSelection,
2719
- children: text != null ? text : children
2720
- });
2721
- }
2722
- if (text != null) {
2723
- return jsx(View, _extends({
2724
- className: className,
2725
- style: style,
2726
- role: role
2727
- }, props, {
2728
- children: jsx(Text, {
2729
- className: textClass,
2730
- selectable: !noSelection,
2731
- children: text
2732
- })
2733
- }));
2734
- }
2735
- return jsx(View, _extends({
2736
- className: className,
2737
- style: style,
2738
- children: children,
2739
- role: role
2740
- }, props));
2741
- } finally {
2742
- _effect5();
2743
- }
2744
- }
2745
2743
  function RNInput(props) {
2746
- var _effect6 = useComponentTracking();
2744
+ var _effect5 = useComponentTracking();
2747
2745
  try {
2748
2746
  const {
2749
2747
  id,
@@ -2753,7 +2751,7 @@ function RNInput(props) {
2753
2751
  checked,
2754
2752
  value
2755
2753
  } = props,
2756
- rest = _objectWithoutPropertiesLoose(props, _excluded4);
2754
+ rest = _objectWithoutPropertiesLoose(props, _excluded3);
2757
2755
  switch (type) {
2758
2756
  case "radio":
2759
2757
  return jsx(RNRadioItem, _extends({}, rest, {
@@ -2772,7 +2770,7 @@ function RNInput(props) {
2772
2770
  }));
2773
2771
  }
2774
2772
  } finally {
2775
- _effect6();
2773
+ _effect5();
2776
2774
  }
2777
2775
  }
2778
2776
  // React Native HTML Components
@@ -2822,5 +2820,5 @@ function isNodeEmpty(node) {
2822
2820
  return false;
2823
2821
  }
2824
2822
 
2825
- 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 };
2823
+ 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 };
2826
2824
  //# sourceMappingURL=index.js.map