@firecms/core 3.5.2-canary.a36570e → 3.5.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.
Files changed (29) hide show
  1. package/dist/{de-CUF9f7S-.js → de-CNfJQcnh.js} +1 -1
  2. package/dist/{de-CUF9f7S-.js.map → de-CNfJQcnh.js.map} +1 -1
  3. package/dist/{editor-WZytSO_1.js → editor-D0A5yaaJ.js} +1 -1
  4. package/dist/{editor-WZytSO_1.js.map → editor-D0A5yaaJ.js.map} +1 -1
  5. package/dist/{fr-DmkMX6hp.js → fr-CBtSvDVp.js} +1 -1
  6. package/dist/{fr-DmkMX6hp.js.map → fr-CBtSvDVp.js.map} +1 -1
  7. package/dist/{hi-BKuaMr7w.js → hi-Delc4l61.js} +1 -1
  8. package/dist/{hi-BKuaMr7w.js.map → hi-Delc4l61.js.map} +1 -1
  9. package/dist/index.es.js +32 -12
  10. package/dist/index.es.js.map +1 -1
  11. package/dist/index.umd.js +24 -4
  12. package/dist/index.umd.js.map +1 -1
  13. package/dist/{it-BwQflFGz.js → it-CdsoaRVO.js} +1 -1
  14. package/dist/{it-BwQflFGz.js.map → it-CdsoaRVO.js.map} +1 -1
  15. package/dist/{pl-BPsAvZvc.js → pl-DoTvWcwp.js} +1 -1
  16. package/dist/{pl-BPsAvZvc.js.map → pl-DoTvWcwp.js.map} +1 -1
  17. package/dist/preview/components/__tests__/DatePreview.test.d.ts +1 -0
  18. package/dist/{pt-D5q7OQp1.js → pt-DCfk8Nkq.js} +1 -1
  19. package/dist/{pt-D5q7OQp1.js.map → pt-DCfk8Nkq.js.map} +1 -1
  20. package/dist/types/locales.d.ts +1 -1
  21. package/dist/util/__tests__/locales.test.d.ts +1 -0
  22. package/dist/util/date_fns_locales.d.ts +13 -0
  23. package/package.json +3 -3
  24. package/src/form/field_bindings/BlockFieldBinding.tsx +2 -1
  25. package/src/preview/components/DatePreview.tsx +14 -2
  26. package/src/preview/components/__tests__/DatePreview.test.tsx +39 -0
  27. package/src/types/locales.ts +2 -0
  28. package/src/util/__tests__/locales.test.ts +46 -0
  29. package/src/util/date_fns_locales.ts +28 -0
package/dist/index.umd.js CHANGED
@@ -4848,6 +4848,16 @@
4848
4848
  function _temp$I(count) {
4849
4849
  return count + 1;
4850
4850
  }
4851
+ const supportedLocales = new Map([...Object.keys(loaders), "en", "fil"].map((locale) => [locale.toLowerCase(), locale]));
4852
+ function resolveLocale(value) {
4853
+ if (typeof value !== "string") return void 0;
4854
+ const parts = value.trim().split(/[-_\s]+/).filter(Boolean);
4855
+ if (parts.length === 0) return void 0;
4856
+ return supportedLocales.get(parts.join("").toLowerCase()) ?? supportedLocales.get(parts[0].toLowerCase());
4857
+ }
4858
+ function localeToLanguageTag(locale) {
4859
+ return locale.replace(/^([a-z]{2,3})([A-Z][A-Za-z]+)$/, "$1-$2");
4860
+ }
4851
4861
  const CONTAINER_FULL_WIDTH = "100vw";
4852
4862
  const ADDITIONAL_TAB_WIDTH = "55vw";
4853
4863
  const FORM_CONTAINER_WIDTH = "768px";
@@ -7730,6 +7740,13 @@
7730
7740
  }
7731
7741
  return t3;
7732
7742
  }
7743
+ function dateTimeFormat(locale, options) {
7744
+ try {
7745
+ return new Intl.DateTimeFormat(locale ? localeToLanguageTag(locale) : "en-US", options);
7746
+ } catch {
7747
+ return new Intl.DateTimeFormat("en-US", options);
7748
+ }
7749
+ }
7733
7750
  function DatePreview(t0) {
7734
7751
  const $ = reactCompilerRuntime.c(22);
7735
7752
  const {
@@ -7763,7 +7780,7 @@
7763
7780
  options.hour = "2-digit";
7764
7781
  options.minute = "2-digit";
7765
7782
  }
7766
- const formatter = new Intl.DateTimeFormat(customizationController?.locale ?? "en-US", options);
7783
+ const formatter = dateTimeFormat(customizationController?.locale, options);
7767
7784
  t22 = formatter.format(date);
7768
7785
  $[1] = customizationController?.locale;
7769
7786
  $[2] = date;
@@ -15872,10 +15889,11 @@
15872
15889
  setValue(null);
15873
15890
  }, children: /* @__PURE__ */ jsxRuntime.jsx(ui.CloseIcon, { size: "small" }) })
15874
15891
  ] });
15892
+ const canAddElements = !property.disabled && !isSubmitting && !disabled && (property.canAddElements ?? true);
15875
15893
  const firstOneOfKey = Object.keys(property.oneOf.properties)[0];
15876
15894
  const body = /* @__PURE__ */ jsxRuntime.jsx(ArrayContainer, { value, className: "flex flex-col gap-3", droppableId: propertyKey, addLabel: property.name ? t("add_to_field", {
15877
15895
  fieldName: property.name
15878
- }) : t("add_entry"), buildEntry, onInternalIdAdded: setLastAddedId, disabled: isSubmitting || Boolean(property.disabled), canAddElements: !property.disabled, onValueChange: (value_0) => setFieldValue(propertyKey, value_0), newDefaultEntry: {
15896
+ }) : t("add_entry"), buildEntry, onInternalIdAdded: setLastAddedId, disabled: isSubmitting || Boolean(property.disabled), canAddElements, onValueChange: (value_0) => setFieldValue(propertyKey, value_0), newDefaultEntry: {
15879
15897
  [property.oneOf.typeField ?? DEFAULT_ONE_OF_TYPE]: firstOneOfKey,
15880
15898
  [property.oneOf.valueField ?? DEFAULT_ONE_OF_VALUE]: getDefaultValueFor(property.oneOf.properties[firstOneOfKey])
15881
15899
  } });
@@ -32652,7 +32670,7 @@
32652
32670
  children,
32653
32671
  entityLinkBuilder,
32654
32672
  userConfigPersistence,
32655
- dateTimeFormat,
32673
+ dateTimeFormat: dateTimeFormat2,
32656
32674
  locale,
32657
32675
  authController,
32658
32676
  storageSource,
@@ -32701,7 +32719,7 @@
32701
32719
  const pluginsLoading = plugins?.some((p_0) => p_0.loading) ?? false;
32702
32720
  const loading = authController.initialLoading || navigationController.loading || pluginsLoading;
32703
32721
  const customizationController = {
32704
- dateTimeFormat,
32722
+ dateTimeFormat: dateTimeFormat2,
32705
32723
  locale,
32706
32724
  entityLinkBuilder,
32707
32725
  plugins,
@@ -45094,6 +45112,7 @@ ul[data-type="taskList"] li[data-checked="true"] > div > p {
45094
45112
  exports2.jsonStringifyReplacer = jsonStringifyReplacer;
45095
45113
  exports2.lazyEager = lazyEager;
45096
45114
  exports2.loadDateFnsLocale = loadDateFnsLocale;
45115
+ exports2.localeToLanguageTag = localeToLanguageTag;
45097
45116
  exports2.makePropertiesEditable = makePropertiesEditable;
45098
45117
  exports2.mergeCallbacks = mergeCallbacks;
45099
45118
  exports2.mergeCollection = mergeCollection;
@@ -45131,6 +45150,7 @@ ul[data-type="taskList"] li[data-checked="true"] > div > p {
45131
45150
  exports2.resolveEntityAction = resolveEntityAction;
45132
45151
  exports2.resolveEntityView = resolveEntityView;
45133
45152
  exports2.resolveEnumValues = resolveEnumValues;
45153
+ exports2.resolveLocale = resolveLocale;
45134
45154
  exports2.resolveNavigationFrom = resolveNavigationFrom;
45135
45155
  exports2.resolvePermissions = resolvePermissions;
45136
45156
  exports2.resolveProperties = resolveProperties;