react-hook-form-cloudscape 1.7.3 → 1.7.5

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,6 +1,6 @@
1
- import Fe, { useMemo as hr, useCallback as x } from "react";
2
- import { AttributeEditor as Er, Autosuggest as yr, Checkbox as mr, Cards as Rr, CodeEditor as _r, DatePicker as xr, DateRangePicker as gr, FileUpload as jr, Input as Tr, Multiselect as Or, PropertyFilter as Sr, RadioGroup as Pr, S3ResourceSelector as wr, Select as kr, Slider as Cr, TagEditor as Fr, TextFilter as Dr, Textarea as Ar, Tiles as Ir, TimeInput as $r, Toggle as Wr } from "@cloudscape-design/components";
3
- import { useFormState as Yr, useFieldArray as Mr, get as Ur, Controller as S } from "react-hook-form";
1
+ import Fe, { useCallback as x, useMemo as hr } from "react";
2
+ import { Input as Er, Checkbox as yr, Select as mr, Textarea as Rr, DatePicker as _r, DateRangePicker as xr, FileUpload as gr, Multiselect as jr, PropertyFilter as Tr, RadioGroup as Or, S3ResourceSelector as Sr, Slider as Pr, TagEditor as wr, TextFilter as kr, TimeInput as Cr, Toggle as Fr, Autosuggest as Dr, Cards as Ar, CodeEditor as Ir, AttributeEditor as $r, Tiles as Wr } from "@cloudscape-design/components";
3
+ import { Controller as S, useFormState as Yr, useFieldArray as Mr, get as Ur } from "react-hook-form";
4
4
  var G = { exports: {} }, U = {};
5
5
  /**
6
6
  * @license React
@@ -631,40 +631,6 @@ function Nr() {
631
631
  }
632
632
  var h = Nr();
633
633
  const zr = ({
634
- name: u,
635
- control: f,
636
- definition: s,
637
- defaultValue: c,
638
- handleState: d = !0,
639
- onAddButtonClick: t,
640
- onRemoveButtonClick: l,
641
- ...p
642
- }) => {
643
- const { errors: n } = Yr({ control: f }), { fields: a, append: i, remove: v } = Mr({
644
- name: u,
645
- control: f
646
- }), m = hr(
647
- () => s.map((_) => ({
648
- errorText: (T, K) => _.label && Ur(n, `${u}.${K}.${_.label.toString().toLowerCase()}.message`),
649
- ..._
650
- })),
651
- [s, n, u]
652
- );
653
- return /* @__PURE__ */ h.jsx(
654
- Er,
655
- {
656
- definition: m,
657
- items: a || [],
658
- onAddButtonClick: (_) => {
659
- d && i(c), t == null || t(_, i);
660
- },
661
- onRemoveButtonClick: (_) => {
662
- d && v(_.detail.itemIndex), l == null || l(_, v);
663
- },
664
- ...p
665
- }
666
- );
667
- }, Xr = ({
668
634
  name: u,
669
635
  control: f,
670
636
  defaultValue: s,
@@ -675,14 +641,13 @@ const zr = ({
675
641
  ...p
676
642
  }) => {
677
643
  const n = x(
678
- (i, v) => {
679
- var m;
680
- (m = v.detail) != null && m.value && i(v.detail.value), t == null || t(v);
644
+ (i) => {
645
+ t == null || t(i);
681
646
  },
682
647
  [t]
683
648
  ), a = x(
684
- (i, v) => {
685
- i(v.detail.value), l == null || l(v);
649
+ (i) => {
650
+ l == null || l(i);
686
651
  },
687
652
  [l]
688
653
  );
@@ -693,13 +658,17 @@ const zr = ({
693
658
  defaultValue: s,
694
659
  name: u,
695
660
  render: ({ field: { ref: i, onBlur: v, onChange: m, value: _ } }) => /* @__PURE__ */ h.jsx(
696
- yr,
661
+ Er,
697
662
  {
698
663
  ref: i,
699
664
  name: u,
700
- value: _ || "",
701
- onBlur: n.bind(null, v),
702
- onChange: a.bind(null, m),
665
+ value: _,
666
+ onBlur: (T) => {
667
+ v(), n(T);
668
+ },
669
+ onChange: (T) => {
670
+ m(T.detail.value), a(T);
671
+ },
703
672
  ...p
704
673
  }
705
674
  ),
@@ -707,7 +676,7 @@ const zr = ({
707
676
  shouldUnregister: d
708
677
  }
709
678
  );
710
- }, Hr = ({
679
+ }, Xr = ({
711
680
  name: u,
712
681
  control: f,
713
682
  defaultValue: s,
@@ -728,33 +697,45 @@ const zr = ({
728
697
  control: f,
729
698
  defaultValue: s,
730
699
  name: u,
731
- render: ({ field: { ref: n, onChange: a, value: i = !1 } }) => /* @__PURE__ */ h.jsx(
732
- mr,
733
- {
734
- ref: n,
735
- checked: i,
736
- onChange: p.bind(null, a),
737
- ...l
738
- }
739
- ),
700
+ render: ({ field: { ref: n, onChange: a, value: i = !1 } }) => /* @__PURE__ */ h.jsx(yr, { ref: n, checked: i, onChange: p.bind(null, a), ...l }),
740
701
  rules: c,
741
702
  shouldUnregister: d
742
703
  }
743
704
  );
744
- }, Zr = ({
705
+ }, De = (u = [], f) => {
706
+ let s = null;
707
+ return u && f && (s = u.reduce(
708
+ (c, d) => {
709
+ if ("options" in d) {
710
+ const t = De(d.options, f);
711
+ t && c.push(t);
712
+ }
713
+ return "value" in d && d.value === f && c.push(d), c;
714
+ },
715
+ []
716
+ )[0]), s || null;
717
+ }, qr = {
718
+ mapSelectedOptionWithOptions: De
719
+ }, Hr = ({
745
720
  name: u,
746
721
  control: f,
747
722
  defaultValue: s,
748
723
  rules: c,
749
724
  shouldUnregister: d = !1,
750
- onSelectionChange: t,
751
- ...l
725
+ onBlur: t,
726
+ onChange: l,
727
+ ...p
752
728
  }) => {
753
- const p = x(
754
- (n, a) => {
755
- n(a.detail.selectedItems), t == null || t(a);
729
+ const n = x(
730
+ (i, v) => {
731
+ i(), t == null || t(v);
756
732
  },
757
733
  [t]
734
+ ), a = x(
735
+ (i, v) => {
736
+ i(v.detail.selectedOption.value), l == null || l(v);
737
+ },
738
+ [l]
758
739
  );
759
740
  return /* @__PURE__ */ h.jsx(
760
741
  S,
@@ -762,45 +743,63 @@ const zr = ({
762
743
  control: f,
763
744
  defaultValue: s,
764
745
  name: u,
765
- render: ({ field: { onChange: n, value: a } }) => /* @__PURE__ */ h.jsx(
766
- Rr,
746
+ render: ({ field: { ref: i, onChange: v, onBlur: m, value: _ } }) => /* @__PURE__ */ h.jsx(
747
+ mr,
767
748
  {
768
- selectedItems: a,
769
- onSelectionChange: p.bind(null, n),
770
- ...l
749
+ ref: i,
750
+ selectedOption: qr.mapSelectedOptionWithOptions(p.options, _),
751
+ onBlur: n.bind(null, m),
752
+ onChange: a.bind(null, v),
753
+ ...p
771
754
  }
772
755
  ),
773
756
  rules: c,
774
757
  shouldUnregister: d
775
758
  }
776
759
  );
777
- }, Qr = ({
760
+ }, Zr = ({
778
761
  name: u,
779
762
  control: f,
780
- onChange: s,
781
- defaultValue: c,
782
- rules: d,
783
- shouldUnregister: t = !1,
784
- ...l
763
+ defaultValue: s,
764
+ rules: c,
765
+ shouldUnregister: d = !1,
766
+ onBlur: t,
767
+ onChange: l,
768
+ ...p
785
769
  }) => {
786
- const p = x(
787
- (n, a) => {
788
- n(a.detail.value), s == null || s(a);
770
+ const n = x(
771
+ (i, v) => {
772
+ i(), t == null || t(v);
789
773
  },
790
- [s]
774
+ [t]
775
+ ), a = x(
776
+ (i, v) => {
777
+ i(v.detail.value), l == null || l(v);
778
+ },
779
+ [l]
791
780
  );
792
781
  return /* @__PURE__ */ h.jsx(
793
782
  S,
794
783
  {
795
784
  control: f,
796
- defaultValue: c,
785
+ defaultValue: s,
797
786
  name: u,
798
- render: ({ field: { onChange: n, value: a } }) => /* @__PURE__ */ h.jsx(_r, { value: a || "", onChange: p.bind(null, n), ...l }),
799
- rules: d,
800
- shouldUnregister: t
787
+ render: ({ field: { onChange: i, onBlur: v, value: m, ref: _ } }) => /* @__PURE__ */ h.jsx(
788
+ Rr,
789
+ {
790
+ ref: _,
791
+ name: u,
792
+ value: m,
793
+ onBlur: n.bind(null, v),
794
+ onChange: a.bind(null, i),
795
+ ...p
796
+ }
797
+ ),
798
+ rules: c,
799
+ shouldUnregister: d
801
800
  }
802
801
  );
803
- }, Br = ({
802
+ }, Qr = ({
804
803
  name: u,
805
804
  control: f,
806
805
  defaultValue: s,
@@ -828,7 +827,7 @@ const zr = ({
828
827
  defaultValue: s,
829
828
  name: u,
830
829
  render: ({ field: { ref: i, onChange: v, onBlur: m, value: _ } }) => /* @__PURE__ */ h.jsx(
831
- xr,
830
+ _r,
832
831
  {
833
832
  ref: i,
834
833
  name: u,
@@ -846,7 +845,7 @@ const zr = ({
846
845
  shouldUnregister: d
847
846
  }
848
847
  );
849
- }, et = ({
848
+ }, Br = ({
850
849
  name: u,
851
850
  control: f,
852
851
  onBlur: s,
@@ -874,7 +873,7 @@ const zr = ({
874
873
  defaultValue: d,
875
874
  name: u,
876
875
  render: ({ field: { ref: i, onBlur: v, onChange: m, value: _ } }) => /* @__PURE__ */ h.jsx(
877
- gr,
876
+ xr,
878
877
  {
879
878
  ref: i,
880
879
  value: _,
@@ -891,7 +890,7 @@ const zr = ({
891
890
  shouldUnregister: l
892
891
  }
893
892
  );
894
- }, rt = ({
893
+ }, et = ({
895
894
  name: u,
896
895
  control: f,
897
896
  defaultValue: s,
@@ -913,7 +912,7 @@ const zr = ({
913
912
  defaultValue: s,
914
913
  name: u,
915
914
  render: ({ field: { ref: a, onChange: i, value: v } }) => /* @__PURE__ */ h.jsx(
916
- jr,
915
+ gr,
917
916
  {
918
917
  ref: a,
919
918
  value: p(v),
@@ -925,68 +924,16 @@ const zr = ({
925
924
  shouldUnregister: d
926
925
  }
927
926
  );
928
- }, tt = ({
929
- name: u,
930
- control: f,
931
- defaultValue: s,
932
- rules: c,
933
- shouldUnregister: d = !1,
934
- onBlur: t,
935
- onChange: l,
936
- ...p
937
- }) => {
938
- const n = x(
939
- (i) => {
940
- t == null || t(i);
941
- },
942
- [t]
943
- ), a = x(
944
- (i) => {
945
- l == null || l(i);
946
- },
947
- [l]
948
- );
949
- return /* @__PURE__ */ h.jsx(
950
- S,
951
- {
952
- control: f,
953
- defaultValue: s,
954
- name: u,
955
- render: ({ field: { ref: i, onBlur: v, onChange: m, value: _ } }) => /* @__PURE__ */ h.jsx(
956
- Tr,
957
- {
958
- ref: i,
959
- name: u,
960
- value: _,
961
- onBlur: (T) => {
962
- v(), n(T);
963
- },
964
- onChange: (T) => {
965
- m(T.detail.value), a(T);
966
- },
967
- ...p
968
- }
969
- ),
970
- rules: c,
971
- shouldUnregister: d
972
- }
973
- );
974
- }, te = (u = []) => u != null && u.length ? u.map((f) => "options" in f ? te(f.options) : f.value).flat() : [], ne = (u = [], f = []) => u != null && u.length && (f != null && f.length) ? u.reduce(
975
- (s, c) => {
976
- if (u != null && u.length) {
977
- if ("options" in c) {
978
- const d = ne(
979
- c.options,
980
- f
981
- );
982
- d != null && d.length && s.push(...d);
983
- }
984
- "value" in c && f.find((d) => d === c.value) && s.push(c);
927
+ }, te = (u = []) => u != null && u.length ? u.map((f) => "options" in f ? te(f.options) : f.value).flat() : [], ne = (u = [], f = []) => u != null && u.length && (f != null && f.length) ? u.reduce((s, c) => {
928
+ if (u != null && u.length) {
929
+ if ("options" in c) {
930
+ const d = ne(c.options, f);
931
+ d != null && d.length && s.push(...d);
985
932
  }
986
- return s;
987
- },
988
- []
989
- ).flat() : [], nt = { transformMultiselectOptionsToArray: te, mapSelectedOptionsWithOptions: ne }, at = ({
933
+ "value" in c && f.find((d) => d === c.value) && s.push(c);
934
+ }
935
+ return s;
936
+ }, []).flat() : [], rt = { transformMultiselectOptionsToArray: te, mapSelectedOptionsWithOptions: ne }, tt = ({
990
937
  name: u,
991
938
  control: f,
992
939
  options: s,
@@ -1015,7 +962,7 @@ const zr = ({
1015
962
  defaultValue: c,
1016
963
  name: u,
1017
964
  render: ({ field: { ref: v, onChange: m, onBlur: _, value: T } }) => /* @__PURE__ */ h.jsx(
1018
- Or,
965
+ jr,
1019
966
  {
1020
967
  ref: v,
1021
968
  options: s,
@@ -1029,7 +976,7 @@ const zr = ({
1029
976
  shouldUnregister: p
1030
977
  }
1031
978
  );
1032
- }, it = ({
979
+ }, nt = ({
1033
980
  name: u,
1034
981
  control: f,
1035
982
  defaultValue: s,
@@ -1049,12 +996,12 @@ const zr = ({
1049
996
  control: f,
1050
997
  defaultValue: s,
1051
998
  name: u,
1052
- render: ({ field: { onChange: p, value: n } }) => /* @__PURE__ */ h.jsx(Sr, { query: n, onChange: l.bind(null, p), ...t }),
999
+ render: ({ field: { onChange: p, value: n } }) => /* @__PURE__ */ h.jsx(Tr, { query: n, onChange: l.bind(null, p), ...t }),
1053
1000
  rules: c,
1054
1001
  shouldUnregister: d
1055
1002
  }
1056
1003
  );
1057
- }, lt = ({
1004
+ }, at = ({
1058
1005
  name: u,
1059
1006
  control: f,
1060
1007
  onChange: s,
@@ -1076,7 +1023,7 @@ const zr = ({
1076
1023
  defaultValue: d,
1077
1024
  name: u,
1078
1025
  render: ({ field: { onChange: n, value: a } }) => /* @__PURE__ */ h.jsx(
1079
- Pr,
1026
+ Or,
1080
1027
  {
1081
1028
  items: l.items,
1082
1029
  value: a,
@@ -1088,7 +1035,7 @@ const zr = ({
1088
1035
  shouldUnregister: t
1089
1036
  }
1090
1037
  );
1091
- }, st = ({
1038
+ }, it = ({
1092
1039
  name: u,
1093
1040
  control: f,
1094
1041
  defaultValue: s,
@@ -1110,7 +1057,7 @@ const zr = ({
1110
1057
  defaultValue: s,
1111
1058
  name: u,
1112
1059
  render: ({ field: { ref: n, onChange: a, value: i } }) => /* @__PURE__ */ h.jsx(
1113
- wr,
1060
+ Sr,
1114
1061
  {
1115
1062
  ref: n,
1116
1063
  resource: i ?? { uri: "" },
@@ -1122,65 +1069,7 @@ const zr = ({
1122
1069
  shouldUnregister: d
1123
1070
  }
1124
1071
  );
1125
- }, De = (u = [], f) => {
1126
- let s = null;
1127
- return u && f && (s = u.reduce(
1128
- (c, d) => {
1129
- if ("options" in d) {
1130
- const t = De(
1131
- d.options,
1132
- f
1133
- );
1134
- t && c.push(t);
1135
- }
1136
- return "value" in d && d.value === f && c.push(d), c;
1137
- },
1138
- []
1139
- )[0]), s || null;
1140
- }, qr = {
1141
- mapSelectedOptionWithOptions: De
1142
- }, ut = ({
1143
- name: u,
1144
- control: f,
1145
- defaultValue: s,
1146
- rules: c,
1147
- shouldUnregister: d = !1,
1148
- onBlur: t,
1149
- onChange: l,
1150
- ...p
1151
- }) => {
1152
- const n = x(
1153
- (i, v) => {
1154
- i(), t == null || t(v);
1155
- },
1156
- [t]
1157
- ), a = x(
1158
- (i, v) => {
1159
- i(v.detail.selectedOption.value), l == null || l(v);
1160
- },
1161
- [l]
1162
- );
1163
- return /* @__PURE__ */ h.jsx(
1164
- S,
1165
- {
1166
- control: f,
1167
- defaultValue: s,
1168
- name: u,
1169
- render: ({ field: { ref: i, onChange: v, onBlur: m, value: _ } }) => /* @__PURE__ */ h.jsx(
1170
- kr,
1171
- {
1172
- ref: i,
1173
- selectedOption: qr.mapSelectedOptionWithOptions(p.options, _),
1174
- onBlur: n.bind(null, m),
1175
- onChange: a.bind(null, v),
1176
- ...p
1177
- }
1178
- ),
1179
- rules: c,
1180
- shouldUnregister: d
1181
- }
1182
- );
1183
- }, ot = ({
1072
+ }, lt = ({
1184
1073
  name: u,
1185
1074
  control: f,
1186
1075
  defaultValue: s,
@@ -1202,7 +1091,7 @@ const zr = ({
1202
1091
  defaultValue: s,
1203
1092
  name: u,
1204
1093
  render: ({ field: { onChange: n, value: a } }) => /* @__PURE__ */ h.jsx(
1205
- Cr,
1094
+ Pr,
1206
1095
  {
1207
1096
  value: a,
1208
1097
  onChange: (i) => {
@@ -1215,7 +1104,7 @@ const zr = ({
1215
1104
  shouldUnregister: d
1216
1105
  }
1217
1106
  );
1218
- }, ft = ({
1107
+ }, st = ({
1219
1108
  name: u,
1220
1109
  control: f,
1221
1110
  onChange: s,
@@ -1237,7 +1126,7 @@ const zr = ({
1237
1126
  defaultValue: c,
1238
1127
  name: u,
1239
1128
  render: ({ field: { ref: n, onChange: a, value: i } }) => /* @__PURE__ */ h.jsx(
1240
- Fr,
1129
+ wr,
1241
1130
  {
1242
1131
  ref: n,
1243
1132
  tags: i || [],
@@ -1249,7 +1138,7 @@ const zr = ({
1249
1138
  shouldUnregister: t
1250
1139
  }
1251
1140
  );
1252
- }, ct = ({
1141
+ }, ut = ({
1253
1142
  name: u,
1254
1143
  control: f,
1255
1144
  defaultValue: s,
@@ -1271,7 +1160,7 @@ const zr = ({
1271
1160
  defaultValue: s,
1272
1161
  name: u,
1273
1162
  render: ({ field: { ref: n, onChange: a, value: i } }) => /* @__PURE__ */ h.jsx(
1274
- Dr,
1163
+ kr,
1275
1164
  {
1276
1165
  ref: n,
1277
1166
  filteringText: i,
@@ -1283,7 +1172,7 @@ const zr = ({
1283
1172
  shouldUnregister: d
1284
1173
  }
1285
1174
  );
1286
- }, dt = ({
1175
+ }, ot = ({
1287
1176
  name: u,
1288
1177
  control: f,
1289
1178
  defaultValue: s,
@@ -1310,14 +1199,14 @@ const zr = ({
1310
1199
  control: f,
1311
1200
  defaultValue: s,
1312
1201
  name: u,
1313
- render: ({ field: { onChange: i, onBlur: v, value: m, ref: _ } }) => /* @__PURE__ */ h.jsx(
1314
- Ar,
1202
+ render: ({ field: { ref: i, onChange: v, onBlur: m, value: _ } }) => /* @__PURE__ */ h.jsx(
1203
+ Cr,
1315
1204
  {
1316
- ref: _,
1205
+ ref: i,
1317
1206
  name: u,
1318
- value: m,
1319
- onBlur: n.bind(null, v),
1320
- onChange: a.bind(null, i),
1207
+ value: _,
1208
+ onBlur: n.bind(null, m),
1209
+ onChange: a.bind(null, v),
1321
1210
  ...p
1322
1211
  }
1323
1212
  ),
@@ -1325,41 +1214,42 @@ const zr = ({
1325
1214
  shouldUnregister: d
1326
1215
  }
1327
1216
  );
1328
- }, vt = ({
1217
+ }, ft = ({
1329
1218
  name: u,
1330
1219
  control: f,
1331
- onChange: s,
1332
- defaultValue: c,
1333
- rules: d,
1334
- shouldUnregister: t = !1,
1220
+ defaultValue: s,
1221
+ rules: c,
1222
+ shouldUnregister: d = !1,
1223
+ onChange: t,
1335
1224
  ...l
1336
1225
  }) => {
1337
1226
  const p = x(
1338
1227
  (n, a) => {
1339
- n(a.detail.value), s == null || s(a);
1228
+ n(a.detail.checked), t == null || t(a);
1340
1229
  },
1341
- [s]
1230
+ [t]
1342
1231
  );
1343
1232
  return /* @__PURE__ */ h.jsx(
1344
1233
  S,
1345
1234
  {
1346
1235
  control: f,
1347
- defaultValue: c,
1236
+ defaultValue: s,
1348
1237
  name: u,
1349
- render: ({ field: { onChange: n, value: a } }) => /* @__PURE__ */ h.jsx(
1350
- Ir,
1238
+ render: ({ field: { ref: n, onChange: a, value: i = !1 } }) => /* @__PURE__ */ h.jsx(
1239
+ Fr,
1351
1240
  {
1352
- items: l.items,
1353
- value: a,
1354
- onChange: p.bind(null, n),
1241
+ ref: n,
1242
+ checked: i,
1243
+ name: u,
1244
+ onChange: p.bind(null, a),
1355
1245
  ...l
1356
1246
  }
1357
1247
  ),
1358
- rules: d,
1359
- shouldUnregister: t
1248
+ rules: c,
1249
+ shouldUnregister: d
1360
1250
  }
1361
1251
  );
1362
- }, pt = ({
1252
+ }, ct = ({
1363
1253
  name: u,
1364
1254
  control: f,
1365
1255
  defaultValue: s,
@@ -1371,7 +1261,8 @@ const zr = ({
1371
1261
  }) => {
1372
1262
  const n = x(
1373
1263
  (i, v) => {
1374
- i(), t == null || t(v);
1264
+ var m;
1265
+ (m = v.detail) != null && m.value && i(v.detail.value), t == null || t(v);
1375
1266
  },
1376
1267
  [t]
1377
1268
  ), a = x(
@@ -1386,14 +1277,14 @@ const zr = ({
1386
1277
  control: f,
1387
1278
  defaultValue: s,
1388
1279
  name: u,
1389
- render: ({ field: { ref: i, onChange: v, onBlur: m, value: _ } }) => /* @__PURE__ */ h.jsx(
1390
- $r,
1280
+ render: ({ field: { ref: i, onBlur: v, onChange: m, value: _ } }) => /* @__PURE__ */ h.jsx(
1281
+ Dr,
1391
1282
  {
1392
1283
  ref: i,
1393
1284
  name: u,
1394
- value: _,
1395
- onBlur: n.bind(null, m),
1396
- onChange: a.bind(null, v),
1285
+ value: _ || "",
1286
+ onBlur: n.bind(null, v),
1287
+ onChange: a.bind(null, m),
1397
1288
  ...p
1398
1289
  }
1399
1290
  ),
@@ -1401,18 +1292,18 @@ const zr = ({
1401
1292
  shouldUnregister: d
1402
1293
  }
1403
1294
  );
1404
- }, bt = ({
1295
+ }, dt = ({
1405
1296
  name: u,
1406
1297
  control: f,
1407
1298
  defaultValue: s,
1408
1299
  rules: c,
1409
1300
  shouldUnregister: d = !1,
1410
- onChange: t,
1301
+ onSelectionChange: t,
1411
1302
  ...l
1412
1303
  }) => {
1413
1304
  const p = x(
1414
1305
  (n, a) => {
1415
- n(a.detail.checked), t == null || t(a);
1306
+ n(a.detail.selectedItems), t == null || t(a);
1416
1307
  },
1417
1308
  [t]
1418
1309
  );
@@ -1422,44 +1313,121 @@ const zr = ({
1422
1313
  control: f,
1423
1314
  defaultValue: s,
1424
1315
  name: u,
1425
- render: ({ field: { ref: n, onChange: a, value: i = !1 } }) => /* @__PURE__ */ h.jsx(
1426
- Wr,
1427
- {
1428
- ref: n,
1429
- checked: i,
1430
- name: u,
1431
- onChange: p.bind(null, a),
1432
- ...l
1433
- }
1434
- ),
1316
+ render: ({ field: { onChange: n, value: a } }) => /* @__PURE__ */ h.jsx(Ar, { selectedItems: a, onSelectionChange: p.bind(null, n), ...l }),
1435
1317
  rules: c,
1436
1318
  shouldUnregister: d
1437
1319
  }
1438
1320
  );
1321
+ }, vt = ({
1322
+ name: u,
1323
+ control: f,
1324
+ onChange: s,
1325
+ defaultValue: c,
1326
+ rules: d,
1327
+ shouldUnregister: t = !1,
1328
+ ...l
1329
+ }) => {
1330
+ const p = x(
1331
+ (n, a) => {
1332
+ n(a.detail.value), s == null || s(a);
1333
+ },
1334
+ [s]
1335
+ );
1336
+ return /* @__PURE__ */ h.jsx(
1337
+ S,
1338
+ {
1339
+ control: f,
1340
+ defaultValue: c,
1341
+ name: u,
1342
+ render: ({ field: { onChange: n, value: a } }) => /* @__PURE__ */ h.jsx(Ir, { value: a || "", onChange: p.bind(null, n), ...l }),
1343
+ rules: d,
1344
+ shouldUnregister: t
1345
+ }
1346
+ );
1347
+ }, pt = ({
1348
+ name: u,
1349
+ control: f,
1350
+ definition: s,
1351
+ defaultValue: c,
1352
+ handleState: d = !0,
1353
+ onAddButtonClick: t,
1354
+ onRemoveButtonClick: l,
1355
+ ...p
1356
+ }) => {
1357
+ const { errors: n } = Yr({ control: f }), { fields: a, append: i, remove: v } = Mr({
1358
+ name: u,
1359
+ control: f
1360
+ }), m = hr(
1361
+ () => s.map((_) => ({
1362
+ errorText: (T, K) => _.label && Ur(n, `${u}.${K}.${_.label.toString().toLowerCase()}.message`),
1363
+ ..._
1364
+ })),
1365
+ [s, n, u]
1366
+ );
1367
+ return /* @__PURE__ */ h.jsx(
1368
+ $r,
1369
+ {
1370
+ definition: m,
1371
+ items: a || [],
1372
+ onAddButtonClick: (_) => {
1373
+ d && i(c), t == null || t(_, i);
1374
+ },
1375
+ onRemoveButtonClick: (_) => {
1376
+ d && v(_.detail.itemIndex), l == null || l(_, v);
1377
+ },
1378
+ ...p
1379
+ }
1380
+ );
1381
+ }, bt = ({
1382
+ name: u,
1383
+ control: f,
1384
+ onChange: s,
1385
+ defaultValue: c,
1386
+ rules: d,
1387
+ shouldUnregister: t = !1,
1388
+ ...l
1389
+ }) => {
1390
+ const p = x(
1391
+ (n, a) => {
1392
+ n(a.detail.value), s == null || s(a);
1393
+ },
1394
+ [s]
1395
+ );
1396
+ return /* @__PURE__ */ h.jsx(
1397
+ S,
1398
+ {
1399
+ control: f,
1400
+ defaultValue: c,
1401
+ name: u,
1402
+ render: ({ field: { onChange: n, value: a } }) => /* @__PURE__ */ h.jsx(Wr, { items: l.items, value: a, onChange: p.bind(null, n), ...l }),
1403
+ rules: d,
1404
+ shouldUnregister: t
1405
+ }
1406
+ );
1439
1407
  };
1440
1408
  export {
1441
- zr as CAttributeEditor,
1442
- Xr as CAutosuggest,
1443
- Zr as CCards,
1444
- Hr as CCheckbox,
1445
- Qr as CCodeEditor,
1446
- Br as CDatePicker,
1447
- et as CDateRangePicker,
1448
- rt as CFileUpload,
1449
- tt as CInput,
1450
- at as CMultiselect,
1451
- it as CPropertyFilter,
1452
- lt as CRadioGroup,
1453
- st as CS3ResourceSelector,
1454
- ut as CSelect,
1455
- ot as CSlider,
1456
- ft as CTagEditor,
1457
- ct as CTextFilter,
1458
- dt as CTextarea,
1459
- vt as CTiles,
1460
- pt as CTimeInput,
1461
- bt as CToggle,
1462
- nt as MultiSelectUtils,
1409
+ pt as CAttributeEditor,
1410
+ ct as CAutosuggest,
1411
+ dt as CCards,
1412
+ Xr as CCheckbox,
1413
+ vt as CCodeEditor,
1414
+ Qr as CDatePicker,
1415
+ Br as CDateRangePicker,
1416
+ et as CFileUpload,
1417
+ zr as CInput,
1418
+ tt as CMultiselect,
1419
+ nt as CPropertyFilter,
1420
+ at as CRadioGroup,
1421
+ it as CS3ResourceSelector,
1422
+ Hr as CSelect,
1423
+ lt as CSlider,
1424
+ st as CTagEditor,
1425
+ ut as CTextFilter,
1426
+ Zr as CTextarea,
1427
+ bt as CTiles,
1428
+ ot as CTimeInput,
1429
+ ft as CToggle,
1430
+ rt as MultiSelectUtils,
1463
1431
  qr as SelectUtils
1464
1432
  };
1465
1433
  //# sourceMappingURL=react-hook-form-cloudscape.es.js.map