@ostack.tech/ui-kform 0.5.0 → 0.6.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.
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { usePrefix as usePrefix$1, useControllableState, useLatestValues, combineEventHandlers, LocalizationProvider as LocalizationProvider$1, usePrinting, useConstant, useSpacing, useCssVars, NATIVE_CONTROLS, useResponsiveValues, useCombinedRef, cx, useIsInRoot, warnOnce, usePrintInProgress, PrefixProvider, Root, computed, TabContent, ErrorBoundary, DocumentTitle, Spinner, useToastManager, useStartPrintingTask, Tabs, useErrorReporter, EMPTY_STORE, Field, Feedback, FeedbackList, FeedbackPopover, useMediaBreakpointUp, DropdownMenu, DropdownMenuTrigger, Button, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuGroup, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, DropdownMenuItem, useAlertDialog, DropdownMenuRadioItem, controlStatusToAccent, VisuallyHidden, IconButton, Tab, boolDataAttr, TabList, useIsInTableCell, useDataTableColumnLabel, useOnFieldLabelChange, Checkbox, OptionsGroup, Option, CheckboxGroup, useDateTransformer, DateInput, DateRangeInput, Input, Dialog, Tooltip, DialogTrigger, ControlAddon, Icon, DialogContent, DialogHeader, DialogTitle, DialogBody, Alert, Stack, Popover, PopoverTrigger, PopoverContent, useMeasure, Container, Select, MenuListItem, MenuList, usePrintClassNames, StepContent, Step, StepList, Stepper, CloseButton, useScrollPosition, setBoolDataAttr, Card, CardHeader, CardTitle, CardBody, useIntersectionObserver, useKeyboardShortcut, NumericInput, Link, usePrint, PrinterTrigger, RadioGroup, Radio, ButtonGroup, AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogBody, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, DataTableCell, DataTableRow, useDataTableApiRef, DataTable, Slot, DataTableContent, DataTablePagination, DataTableRowsPerPage, TextArea, PortalContext } from "@ostack.tech/ui";
2
+ import { usePrefix as usePrefix$1, useControllableState, useLatestValues, combineEventHandlers, LocalizationProvider as LocalizationProvider$1, usePrinting, useConstant, useSpacing, useCssVars, NATIVE_CONTROLS, useResponsiveValues, useCombinedRef, cx, useIsInRoot, warnOnce, usePrintInProgress, PrefixProvider, Root, computed, TabContent, ErrorBoundary, DocumentTitle, Spinner, useToastManager, useStartPrintingTask, Tabs, useErrorReporter, EMPTY_STORE, Field, Feedback, FeedbackList, FeedbackPopover, useMediaBreakpointUp, DropdownMenu, DropdownMenuTrigger, Button, DropdownMenuContent, DropdownMenuRadioGroup, DropdownMenuGroup, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, DropdownMenuItem, useAlertDialog, DropdownMenuRadioItem, controlStatusToAccent, VisuallyHidden, IconButton, Tab, boolDataAttr, TabList, useIsInTableCell, useDataTableColumnLabel, useOnFieldLabelChange, Checkbox, OptionsGroup, Option, CheckboxGroup, useDateTransformer, DateInput, DateRangeInput, usePrintClassNames, Input, Dialog, Tooltip, DialogTrigger, ControlAddon, Icon, DialogContent, DialogHeader, DialogTitle, DialogBody, Alert, Stack, Popover, PopoverTrigger, PopoverContent, useMeasure, Container, Select, MenuListItem, MenuList, StepContent, Step, StepList, Stepper, CloseButton, useScrollPosition, setBoolDataAttr, Card, CardHeader, CardTitle, CardBody, useIntersectionObserver, useKeyboardShortcut, NumericInput, Link, usePrint, usePrinterDocumentTitle, PrinterTrigger, RadioGroup, Radio, ButtonGroup, AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogBody, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, DataTableCell, DataTableRow, useDataTableApiRef, DataTable, Slot, DataTableContent, DataTablePagination, DataTableRowsPerPage, TextArea, PortalContext } from "@ostack.tech/ui";
3
3
  import { AbsolutePath, AbsolutePathFragment, PathMultimap, sliceTable, listableSize, Path, ValidationFailure, nullableSchemaInnerSchema, compareSchemaPaths, PromiseCancellationException, arrayToTable, indexOfTableRowId, isComputedSchema } from "@ostack.tech/kform";
4
4
  import { useResolvedPath, equals, useFormController, useForm, FormContext, CurrentPath, useCurrentPath, useFormManager, useFormattedValue, InvalidPathError, AtPathError, useIssuesTracker, useFormContext, useInput, useListableInput, formatTemporalAsString, useTemporalInput, useFileInput, useController, useNumericInput, formatNumericAsString, useFormatter } from "@ostack.tech/kform-react";
5
5
  import { createContext, useContext, useCallback, useMemo, useRef, useEffect, forwardRef, useState, useImperativeHandle, startTransition, Suspense, useDeferredValue, Children, isValidElement, createElement, memo } from "react";
@@ -9,10 +9,10 @@ import { useShallow } from "zustand/react/shallow";
9
9
  import { shallow } from "zustand/shallow";
10
10
  import { supported, fileOpen, fileSave } from "browser-fs-access";
11
11
  import { addDays, min, max, parseISO, format } from "date-fns";
12
- import { enGB } from "./locales/en-GB.js";
13
- import { enUS } from "./locales/en-US.js";
14
- import { fr } from "./locales/fr.js";
15
- import { pt } from "./locales/pt.js";
12
+ import { locale } from "./locales/en-GB.js";
13
+ import { locale as locale2 } from "./locales/en-US.js";
14
+ import { locale as locale3, locale as locale4 } from "./locales/fr-FR.js";
15
+ import { locale as locale5, locale as locale6 } from "./locales/pt-PT.js";
16
16
  import { faChevronUp, faChevronDown, faTrash, faFileLines, faDownload, faCircleQuestion, faArrowsToDot, faAnglesLeft, faAngleLeft, faAngleRight, faAnglesRight, faCircleCheck, faCircleExclamation, faTriangleExclamation, faFolderOpen, faPrint, faFloppyDisk, faCaretDown, faArrowRight, faPlus } from "@fortawesome/free-solid-svg-icons";
17
17
  import { faCircleCheck as faCircleCheck$1 } from "@fortawesome/free-regular-svg-icons";
18
18
  const DEFAULT_PREFIX_SUFFIX = "kform-";
@@ -100,18 +100,18 @@ function LocalizationProvider({
100
100
  onLocaleChange,
101
101
  children
102
102
  }) {
103
- const [locale, setLocale] = useControllableState(
103
+ const [locale7, setLocale] = useControllableState(
104
104
  defaultLocale,
105
105
  controlledLocale
106
106
  );
107
- return locale === void 0 ? children : /* @__PURE__ */ jsx(
107
+ return locale7 === void 0 ? children : /* @__PURE__ */ jsx(
108
108
  LocalizationContext.Provider,
109
109
  {
110
110
  value: {
111
- locale,
111
+ locale: locale7,
112
112
  setLocale: combineEventHandlers(setLocale, onLocaleChange)
113
113
  },
114
- children: /* @__PURE__ */ jsx(LocalizationProvider$1, { locale: locale.baseLocale, children })
114
+ children: /* @__PURE__ */ jsx(LocalizationProvider$1, { locale: locale7.baseLocale, children })
115
115
  }
116
116
  );
117
117
  }
@@ -842,15 +842,15 @@ const FormApp = forwardRef(function FormApp2({
842
842
  );
843
843
  }
844
844
  const contextLocale = useContext(LocalizationContext)?.locale;
845
- const locale = controlledLocale ?? defaultLocale ?? contextLocale;
846
- if (locale == null) {
845
+ const locale7 = controlledLocale ?? defaultLocale ?? contextLocale;
846
+ if (locale7 == null) {
847
847
  throw new Error(
848
848
  "FormApp: No locale has been provided. Either provide a `defaultLocale`/`locale` property or wrap the component in a `LocalizationProvider`."
849
849
  );
850
850
  }
851
- formTitle ??= locale.FormApp.formTitle;
852
- issuesPanelLabel ??= locale.FormApp.issuesPanelLabel ?? formTitle;
853
- confirmUnloadMessage ??= locale.FormApp.confirmUnloadMessage;
851
+ formTitle ??= locale7.FormApp.formTitle;
852
+ issuesPanelLabel ??= locale7.FormApp.issuesPanelLabel ?? formTitle;
853
+ confirmUnloadMessage ??= locale7.FormApp.confirmUnloadMessage;
854
854
  const controller = useForm(schema, {
855
855
  initialValue,
856
856
  externalContexts,
@@ -949,7 +949,7 @@ const FormApp = forwardRef(function FormApp2({
949
949
  children: /* @__PURE__ */ jsx(
950
950
  FormAppIssueMessages,
951
951
  {
952
- issueMessages: locale.FormApp.issueMessages,
952
+ issueMessages: locale7.FormApp.issueMessages,
953
953
  priority: -1,
954
954
  children: /* @__PURE__ */ jsxs(FormAppIssueMessages, { issueMessages, children: [
955
955
  /* @__PURE__ */ jsx(FormAppAutoFocus, {}),
@@ -1403,7 +1403,7 @@ function useFormLoader({
1403
1403
  successMessage,
1404
1404
  errorMessage
1405
1405
  } = {}) {
1406
- const [locale] = useLocale();
1406
+ const [locale7] = useLocale();
1407
1407
  const formManager = useFormManager();
1408
1408
  const { _setState } = useFormController();
1409
1409
  const { addToast } = useToastManager();
@@ -1426,10 +1426,10 @@ function useFormLoader({
1426
1426
  throw new Error("No `decode` function was provided.");
1427
1427
  }
1428
1428
  if (successMessage2 === void 0) {
1429
- successMessage2 = locale.LoadAction.successMessage;
1429
+ successMessage2 = locale7.LoadAction.successMessage;
1430
1430
  }
1431
1431
  if (errorMessage2 === void 0) {
1432
- errorMessage2 = locale.LoadAction.errorMessage;
1432
+ errorMessage2 = locale7.LoadAction.errorMessage;
1433
1433
  }
1434
1434
  const validationModeIsAuto = formManager.autoValidationStatus !== "inactive";
1435
1435
  let file = null;
@@ -1504,7 +1504,7 @@ function useFormLoader({
1504
1504
  _setState,
1505
1505
  formManager,
1506
1506
  startIssuesNavigation,
1507
- locale.LoadAction,
1507
+ locale7.LoadAction,
1508
1508
  addToast,
1509
1509
  decode,
1510
1510
  path,
@@ -1901,9 +1901,9 @@ function IssueMessage({
1901
1901
  unknownWarningMessage,
1902
1902
  issueCodeProps
1903
1903
  }) {
1904
- const [locale] = useLocale();
1905
- unknownErrorMessage ??= locale.IssueMessages.unknownErrorMessage;
1906
- unknownWarningMessage ??= locale.IssueMessages.unknownWarningMessage;
1904
+ const [locale7] = useLocale();
1905
+ unknownErrorMessage ??= locale7.IssueMessages.unknownErrorMessage;
1906
+ unknownWarningMessage ??= locale7.IssueMessages.unknownWarningMessage;
1907
1907
  let message = useRegisteredIssueMessage(path, issue.code);
1908
1908
  const unknownIssue = message == null;
1909
1909
  if (unknownIssue) {
@@ -2000,8 +2000,8 @@ const IssuesPopover = forwardRef(function IssuesPopover2({
2000
2000
  label,
2001
2001
  ...otherProps
2002
2002
  }, forwardedRef) {
2003
- const [locale] = useLocale();
2004
- label ??= locale.IssuesPopover.label;
2003
+ const [locale7] = useLocale();
2004
+ label ??= locale7.IssuesPopover.label;
2005
2005
  const absolutePath = useResolvedPath(path);
2006
2006
  const [open, setOpen] = useControllableState(defaultOpen, controlledOpen);
2007
2007
  const isInControlField = useIsInControlField();
@@ -2465,16 +2465,16 @@ const AnnexesManager = forwardRef(function AnnexManager2({
2465
2465
  ...otherProps
2466
2466
  }, forwardedRef) {
2467
2467
  const prefix = usePrefix();
2468
- const [locale] = useLocale();
2469
- ariaLabel ??= locale.AnnexesManager["aria-label"];
2470
- menuButtonText ??= locale.AnnexesManager.menuButtonText;
2471
- addAnnexText ??= locale.AnnexesManager.addAnnexText;
2472
- removeAnnexButtonLabel ??= locale.AnnexesManager.removeAnnexButtonLabel;
2473
- removeAnnexKeyboardHint ??= locale.AnnexesManager.removeAnnexKeyboardHint;
2474
- removeAnnexConfirmDialogTitle ??= locale.AnnexesManager.removeAnnexConfirmDialogTitle;
2475
- removeAnnexConfirmDialogMessage ??= locale.AnnexesManager.removeAnnexConfirmDialogMessage;
2476
- removeAnnexConfirmDialogOkText ??= locale.AnnexesManager.removeAnnexConfirmDialogOkText;
2477
- removeAnnexConfirmDialogCancelText ??= locale.AnnexesManager.removeAnnexConfirmDialogCancelText;
2468
+ const [locale7] = useLocale();
2469
+ ariaLabel ??= locale7.AnnexesManager["aria-label"];
2470
+ menuButtonText ??= locale7.AnnexesManager.menuButtonText;
2471
+ addAnnexText ??= locale7.AnnexesManager.addAnnexText;
2472
+ removeAnnexButtonLabel ??= locale7.AnnexesManager.removeAnnexButtonLabel;
2473
+ removeAnnexKeyboardHint ??= locale7.AnnexesManager.removeAnnexKeyboardHint;
2474
+ removeAnnexConfirmDialogTitle ??= locale7.AnnexesManager.removeAnnexConfirmDialogTitle;
2475
+ removeAnnexConfirmDialogMessage ??= locale7.AnnexesManager.removeAnnexConfirmDialogMessage;
2476
+ removeAnnexConfirmDialogOkText ??= locale7.AnnexesManager.removeAnnexConfirmDialogOkText;
2477
+ removeAnnexConfirmDialogCancelText ??= locale7.AnnexesManager.removeAnnexConfirmDialogCancelText;
2478
2478
  const store = useAnnexesContext();
2479
2479
  const issuesDisplayMode = useIssuesDisplayMode();
2480
2480
  const tablessStates = useStore(
@@ -3194,9 +3194,9 @@ const DateRangeControl = forwardRef(function DateRangeControl2({
3194
3194
  endAdornment,
3195
3195
  ...otherProps
3196
3196
  }, forwardedRef) {
3197
- const [locale] = useLocale();
3198
- issuesPanelStartLabelSuffix ??= locale.DateRangeControl.issuesPanelStartLabelSuffix;
3199
- issuesPanelEndLabelSuffix ??= locale.DateRangeControl.issuesPanelEndLabelSuffix;
3197
+ const [locale7] = useLocale();
3198
+ issuesPanelStartLabelSuffix ??= locale7.DateRangeControl.issuesPanelStartLabelSuffix;
3199
+ issuesPanelEndLabelSuffix ??= locale7.DateRangeControl.issuesPanelEndLabelSuffix;
3200
3200
  const { format: format2, parse } = useTemporalStringTransformer({
3201
3201
  locale: dateFnsLocale,
3202
3202
  shortFormat,
@@ -3414,10 +3414,11 @@ const FileControl = forwardRef(function FileControl2({
3414
3414
  ...otherProps
3415
3415
  }, forwardedRef) {
3416
3416
  const prefix = usePrefix();
3417
- const [locale] = useLocale();
3418
- viewFileButtonLabel ??= locale.FileControl.viewFileButtonLabel;
3419
- downloadFileButtonLabel ??= locale.FileControl.downloadFileButtonLabel;
3420
- fallbackText ??= locale.FileControl.fallbackText;
3417
+ const [locale7] = useLocale();
3418
+ viewFileButtonLabel ??= locale7.FileControl.viewFileButtonLabel;
3419
+ downloadFileButtonLabel ??= locale7.FileControl.downloadFileButtonLabel;
3420
+ fallbackText ??= locale7.FileControl.fallbackText;
3421
+ const { printHidden } = usePrintClassNames();
3421
3422
  const latestFileList = useRef(null);
3422
3423
  const [file, setFile] = useState(null);
3423
3424
  const controller = useFileInput(
@@ -3531,7 +3532,7 @@ const FileControl = forwardRef(function FileControl2({
3531
3532
  popoverIssues,
3532
3533
  endAdornment,
3533
3534
  fileInteraction === "view" && file && /* @__PURE__ */ jsxs(Dialog, { children: [
3534
- /* @__PURE__ */ jsx(Tooltip, { content: viewFileButtonLabel, children: /* @__PURE__ */ jsx(DialogTrigger, { children: /* @__PURE__ */ jsx(ControlAddon, { asChild: true, children: /* @__PURE__ */ jsx("button", { type: "button", children: /* @__PURE__ */ jsx(Icon, { fixedWidth: true, icon: faFileLines }) }) }) }) }),
3535
+ /* @__PURE__ */ jsx(Tooltip, { content: viewFileButtonLabel, children: /* @__PURE__ */ jsx(DialogTrigger, { children: /* @__PURE__ */ jsx(ControlAddon, { asChild: true, children: /* @__PURE__ */ jsx("button", { type: "button", className: printHidden, children: /* @__PURE__ */ jsx(Icon, { fixedWidth: true, icon: faFileLines }) }) }) }) }),
3535
3536
  /* @__PURE__ */ jsxs(
3536
3537
  DialogContent,
3537
3538
  {
@@ -3586,7 +3587,15 @@ const FileControl = forwardRef(function FileControl2({
3586
3587
  }
3587
3588
  )
3588
3589
  ] }),
3589
- fileInteraction === "download" && file && /* @__PURE__ */ jsx(Tooltip, { content: downloadFileButtonLabel, children: /* @__PURE__ */ jsx(ControlAddon, { asChild: true, children: /* @__PURE__ */ jsx("a", { href: dataURL, download: file.name, children: /* @__PURE__ */ jsx(Icon, { icon: faDownload }) }) }) })
3590
+ fileInteraction === "download" && file && /* @__PURE__ */ jsx(Tooltip, { content: downloadFileButtonLabel, children: /* @__PURE__ */ jsx(ControlAddon, { asChild: true, children: /* @__PURE__ */ jsx(
3591
+ "a",
3592
+ {
3593
+ className: printHidden,
3594
+ href: dataURL,
3595
+ download: file.name,
3596
+ children: /* @__PURE__ */ jsx(Icon, { icon: faDownload })
3597
+ }
3598
+ ) }) })
3590
3599
  ] }),
3591
3600
  ...otherProps,
3592
3601
  ref: combinedInputRef
@@ -3898,8 +3907,8 @@ const FormPage = forwardRef(
3898
3907
  ...otherProps
3899
3908
  }, forwardedRef) {
3900
3909
  const prefix = usePrefix();
3901
- const [locale] = useLocale();
3902
- helperButtonLabel ??= locale.FormPage.helperButtonLabel;
3910
+ const [locale7] = useLocale();
3911
+ helperButtonLabel ??= locale7.FormPage.helperButtonLabel;
3903
3912
  const printing = usePrinting();
3904
3913
  const store = useFormPagesContext();
3905
3914
  const pagePath = useResolvedPath(path);
@@ -4000,6 +4009,7 @@ function FormPageRegistrar({
4000
4009
  issuesPanelLabel
4001
4010
  }) {
4002
4011
  const store = useFormPagesContext();
4012
+ const printing = usePrinting();
4003
4013
  const finishPrintingTask = useStartPrintingTask();
4004
4014
  const controller = useController(
4005
4015
  path.append(AbsolutePathFragment.RecursiveWildcard),
@@ -4009,15 +4019,17 @@ function FormPageRegistrar({
4009
4019
  const exists = controller.useState(
4010
4020
  (state) => state.initialized && state.exists
4011
4021
  );
4012
- const deferredValue = useDeferredValue(controller.useValue());
4022
+ const value = controller.useValue();
4023
+ const deferredValue = useDeferredValue(value);
4024
+ const relevantValue = printing ? value : deferredValue;
4013
4025
  const deferredIssuesToDisplay = useDeferredValue(
4014
4026
  controller.useState((state) => state.touched ? state.issues : [], {
4015
4027
  equalityFn: shallow
4016
4028
  })
4017
4029
  );
4018
4030
  const deferredDisplayStatus = useDeferredValue(controller.useDisplayStatus());
4019
- const actualTitle = typeof title === "function" ? deferredValue === void 0 ? null : title(deferredValue) : title;
4020
- const actualDocumentTitle = typeof documentTitle === "function" ? deferredValue === void 0 ? null : documentTitle(deferredValue) : documentTitle === void 0 ? actualTitle === null || typeof actualTitle === "string" ? actualTitle : void 0 : documentTitle;
4031
+ const actualTitle = typeof title === "function" ? relevantValue === void 0 ? null : title(relevantValue) : title;
4032
+ const actualDocumentTitle = typeof documentTitle === "function" ? relevantValue === void 0 ? null : documentTitle(relevantValue) : documentTitle === void 0 ? actualTitle === null || typeof actualTitle === "string" ? actualTitle : void 0 : documentTitle;
4021
4033
  useEffect(() => {
4022
4034
  const { registerPageState } = store.getState().actions;
4023
4035
  registerPageState(absolutePath, {
@@ -4355,8 +4367,8 @@ const FormPagesNavigation = forwardRef(function FormPagesNavigation2({
4355
4367
  ...otherProps
4356
4368
  }, forwardedRef) {
4357
4369
  const prefix = usePrefix();
4358
- const [locale] = useLocale();
4359
- ariaLabel ??= locale.FormPagesNavigation["aria-label"];
4370
+ const [locale7] = useLocale();
4371
+ ariaLabel ??= locale7.FormPagesNavigation["aria-label"];
4360
4372
  const { printHidden } = usePrintClassNames();
4361
4373
  const isLargeScreen = useMediaBreakpointUp("sm");
4362
4374
  return /* @__PURE__ */ jsx(
@@ -4638,15 +4650,18 @@ function FormStepRegistrar({
4638
4650
  issuesPanelLabel
4639
4651
  }) {
4640
4652
  const store = useFormStepperContext();
4653
+ const printing = usePrinting();
4641
4654
  const controller = useController(path, { enabled: !useFormIsLoading() });
4642
4655
  const absolutePath = controller.usePath();
4643
4656
  const exists = controller.useState(
4644
4657
  (state) => state.initialized && state.exists
4645
4658
  );
4646
- const deferredValue = useDeferredValue(controller.useValue());
4659
+ const value = controller.useValue();
4660
+ const deferredValue = useDeferredValue(value);
4661
+ const relevantValue = printing ? value : deferredValue;
4647
4662
  const deferredDisplayStatus = useDeferredValue(controller.useDisplayStatus());
4648
- const actualTitle = typeof title === "function" ? deferredValue === void 0 ? null : title(deferredValue) : title;
4649
- const actualDocumentTitle = typeof documentTitle === "function" ? deferredValue === void 0 ? null : documentTitle(deferredValue) : documentTitle === void 0 ? actualTitle === null || typeof actualTitle === "string" ? actualTitle : void 0 : documentTitle;
4663
+ const actualTitle = typeof title === "function" ? relevantValue === void 0 ? null : title(relevantValue) : title;
4664
+ const actualDocumentTitle = typeof documentTitle === "function" ? relevantValue === void 0 ? null : documentTitle(relevantValue) : documentTitle === void 0 ? actualTitle === null || typeof actualTitle === "string" ? actualTitle : void 0 : documentTitle;
4650
4665
  useEffect(() => {
4651
4666
  const { registerStepState } = store.getState().actions;
4652
4667
  registerStepState(absolutePath, {
@@ -5264,18 +5279,18 @@ const IssuesPanel = forwardRef(function ValidationPanel({
5264
5279
  }, forwardedRef) {
5265
5280
  const prefix = usePrefix();
5266
5281
  const printing = usePrinting();
5267
- const [locale] = useLocale();
5268
- errorsLabel ??= locale.IssuesPanel.errorsLabel;
5269
- warningsLabel ??= locale.IssuesPanel.warningsLabel;
5270
- focusButtonLabel ??= locale.IssuesPanel.focusButtonLabel;
5271
- previousIssueButtonLabel ??= locale.IssuesPanel.previousIssueButtonLabel;
5272
- nextIssueButtonLabel ??= locale.IssuesPanel.nextIssueButtonLabel;
5273
- firstIssueButtonLabel ??= locale.IssuesPanel.firstIssueButtonLabel;
5274
- lastIssueButtonLabel ??= locale.IssuesPanel.lastIssueButtonLabel;
5275
- paginationLabel ??= locale.IssuesPanel.paginationLabel;
5276
- noIssuesMessage ??= locale.IssuesPanel.noIssuesMessage;
5277
- resolvedTitle ??= locale.IssuesPanel.resolvedTitle;
5278
- resolvedMessage ??= locale.IssuesPanel.resolvedMessage;
5282
+ const [locale7] = useLocale();
5283
+ errorsLabel ??= locale7.IssuesPanel.errorsLabel;
5284
+ warningsLabel ??= locale7.IssuesPanel.warningsLabel;
5285
+ focusButtonLabel ??= locale7.IssuesPanel.focusButtonLabel;
5286
+ previousIssueButtonLabel ??= locale7.IssuesPanel.previousIssueButtonLabel;
5287
+ nextIssueButtonLabel ??= locale7.IssuesPanel.nextIssueButtonLabel;
5288
+ firstIssueButtonLabel ??= locale7.IssuesPanel.firstIssueButtonLabel;
5289
+ lastIssueButtonLabel ??= locale7.IssuesPanel.lastIssueButtonLabel;
5290
+ paginationLabel ??= locale7.IssuesPanel.paginationLabel;
5291
+ noIssuesMessage ??= locale7.IssuesPanel.noIssuesMessage;
5292
+ resolvedTitle ??= locale7.IssuesPanel.resolvedTitle;
5293
+ resolvedMessage ??= locale7.IssuesPanel.resolvedMessage;
5279
5294
  const [open, setOpen] = useControllableState(defaultOpen, controlledOpen);
5280
5295
  const formIsLoading = useFormIsLoading();
5281
5296
  const issuesTrackerResult = useIssuesTracker(AbsolutePath.MATCH_ALL, {
@@ -5547,9 +5562,9 @@ function LoadAction({
5547
5562
  errorMessage,
5548
5563
  ...otherProps
5549
5564
  }) {
5550
- const [locale] = useLocale();
5551
- label ??= locale.LoadAction.label;
5552
- keybinds ??= locale.LoadAction.keybinds;
5565
+ const [locale7] = useLocale();
5566
+ label ??= locale7.LoadAction.label;
5567
+ keybinds ??= locale7.LoadAction.keybinds;
5553
5568
  const { load } = useFormLoader({
5554
5569
  decode,
5555
5570
  path,
@@ -5749,9 +5764,9 @@ function PrintAction({
5749
5764
  onClick,
5750
5765
  ...otherProps
5751
5766
  }) {
5752
- const [locale] = useLocale();
5753
- label ??= locale.PrintAction.label;
5754
- keybinds ??= locale.PrintAction.keybinds;
5767
+ const [locale7] = useLocale();
5768
+ label ??= locale7.PrintAction.label;
5769
+ keybinds ??= locale7.PrintAction.keybinds;
5755
5770
  const printInProgress = usePrintInProgress();
5756
5771
  const formIsDisabled = useFormIsDisabled();
5757
5772
  const formIsLoading = useFormIsLoading();
@@ -5759,30 +5774,42 @@ function PrintAction({
5759
5774
  const formAppEl = useFormAppElement();
5760
5775
  const formTitle = useFormTitle();
5761
5776
  const print = usePrint();
5777
+ const printerHasDocumentTitle = !!usePrinterDocumentTitle();
5762
5778
  const handlePrint = (evt) => {
5763
5779
  evt.preventDefault();
5764
- void print({ documentTitle: formTitle });
5780
+ void print(
5781
+ printerHasDocumentTitle ? void 0 : { documentTitle: defaultDocumentTitle(formTitle) }
5782
+ );
5765
5783
  };
5766
5784
  useKeyboardShortcut(keybinds, handlePrint, {
5767
5785
  enabled: !shouldDisable,
5768
5786
  target: formAppEl,
5769
5787
  preventDefault: true
5770
5788
  });
5771
- return /* @__PURE__ */ jsx(PrinterTrigger, { children: /* @__PURE__ */ jsx(
5772
- Button,
5789
+ return /* @__PURE__ */ jsx(
5790
+ PrinterTrigger,
5773
5791
  {
5774
- vertical: true,
5775
- variant: "subtle",
5776
- icon: faPrint,
5777
5792
  onClick: combineEventHandlers(onClick, handlePrint, {
5778
5793
  checkDefaultPrevented: true
5779
5794
  }),
5780
- ...otherProps,
5781
- loading: loading || printInProgress,
5782
- disabled: shouldDisable,
5783
- children: label
5795
+ children: /* @__PURE__ */ jsx(
5796
+ Button,
5797
+ {
5798
+ vertical: true,
5799
+ variant: "subtle",
5800
+ icon: faPrint,
5801
+ ...otherProps,
5802
+ loading: loading || printInProgress,
5803
+ disabled: shouldDisable,
5804
+ children: label
5805
+ }
5806
+ )
5784
5807
  }
5785
- ) });
5808
+ );
5809
+ }
5810
+ function defaultDocumentTitle(formTitle) {
5811
+ const date = format(/* @__PURE__ */ new Date(), "yyyy-MM-dd");
5812
+ return [formTitle, date].filter(Boolean).join(" ");
5786
5813
  }
5787
5814
  const RadioGroupControl = forwardRef(function RadioGroupControl2({
5788
5815
  path,
@@ -5940,7 +5967,7 @@ function useFormSaver({
5940
5967
  successMessage,
5941
5968
  errorMessage
5942
5969
  } = {}) {
5943
- const [locale] = useLocale();
5970
+ const [locale7] = useLocale();
5944
5971
  const formManager = useFormManager();
5945
5972
  const { getState, _setState } = useFormController();
5946
5973
  const { addToast } = useToastManager();
@@ -5965,10 +5992,10 @@ function useFormSaver({
5965
5992
  throw new Error("No `encode` function was provided.");
5966
5993
  }
5967
5994
  if (successMessage2 === void 0) {
5968
- successMessage2 = locale.SaveAction.successMessage;
5995
+ successMessage2 = locale7.SaveAction.successMessage;
5969
5996
  }
5970
5997
  if (errorMessage2 === void 0) {
5971
- errorMessage2 = locale.SaveAction.errorMessage;
5998
+ errorMessage2 = locale7.SaveAction.errorMessage;
5972
5999
  }
5973
6000
  _setState({ saving: true });
5974
6001
  let fileHandle = getState().latestFileHandles?.[id2] ?? null;
@@ -6057,8 +6084,8 @@ function useFormSaver({
6057
6084
  formTitle,
6058
6085
  getState,
6059
6086
  id,
6060
- locale.SaveAction.errorMessage,
6061
- locale.SaveAction.successMessage,
6087
+ locale7.SaveAction.errorMessage,
6088
+ locale7.SaveAction.successMessage,
6062
6089
  mimeTypes,
6063
6090
  overwrite,
6064
6091
  path,
@@ -6102,12 +6129,12 @@ function SaveAction({
6102
6129
  dropdownMenuProps,
6103
6130
  ...otherProps
6104
6131
  }) {
6105
- const [locale] = useLocale();
6106
- label ??= locale.SaveAction.label;
6107
- keybinds ??= locale.SaveAction.keybinds;
6108
- saveOptionsLabel ??= locale.SaveAction.saveOptionsLabel;
6109
- saveAsLabel ??= locale.SaveAction.saveAsLabel;
6110
- saveAsKeybinds ??= locale.SaveAction.saveAsKeybinds;
6132
+ const [locale7] = useLocale();
6133
+ label ??= locale7.SaveAction.label;
6134
+ keybinds ??= locale7.SaveAction.keybinds;
6135
+ saveOptionsLabel ??= locale7.SaveAction.saveOptionsLabel;
6136
+ saveAsLabel ??= locale7.SaveAction.saveAsLabel;
6137
+ saveAsKeybinds ??= locale7.SaveAction.saveAsKeybinds;
6111
6138
  const { save, supportsFileSystemAPIs } = useFormSaver({
6112
6139
  path,
6113
6140
  encode,
@@ -6524,20 +6551,20 @@ function SubmitAction({
6524
6551
  ...otherProps
6525
6552
  }) {
6526
6553
  const prefix = usePrefix();
6527
- const [locale] = useLocale();
6528
- label ??= locale.SubmitAction.label;
6529
- keybinds ??= locale.SubmitAction.keybinds;
6530
- dialogTitle ??= locale.SubmitAction.dialogTitle;
6531
- dialogDescription ??= locale.SubmitAction.dialogDescription;
6532
- dialogBody ??= locale.SubmitAction.dialogBody;
6533
- confirmWarningsCheckboxLabel ??= locale.SubmitAction.confirmWarningsCheckboxLabel;
6534
- dialogOkText ??= locale.SubmitAction.dialogOkText ?? label;
6535
- dialogCancelText ??= locale.SubmitAction.dialogCancelText;
6554
+ const [locale7] = useLocale();
6555
+ label ??= locale7.SubmitAction.label;
6556
+ keybinds ??= locale7.SubmitAction.keybinds;
6557
+ dialogTitle ??= locale7.SubmitAction.dialogTitle;
6558
+ dialogDescription ??= locale7.SubmitAction.dialogDescription;
6559
+ dialogBody ??= locale7.SubmitAction.dialogBody;
6560
+ confirmWarningsCheckboxLabel ??= locale7.SubmitAction.confirmWarningsCheckboxLabel;
6561
+ dialogOkText ??= locale7.SubmitAction.dialogOkText ?? label;
6562
+ dialogCancelText ??= locale7.SubmitAction.dialogCancelText;
6536
6563
  if (successMessage === void 0) {
6537
- successMessage = locale.SubmitAction.successMessage;
6564
+ successMessage = locale7.SubmitAction.successMessage;
6538
6565
  }
6539
6566
  if (errorMessage === void 0) {
6540
- errorMessage = locale.SubmitAction.errorMessage;
6567
+ errorMessage = locale7.SubmitAction.errorMessage;
6541
6568
  }
6542
6569
  const [confirmingSubmission, setConfirmingSubmission] = useState(false);
6543
6570
  const startIssuesNavigation = useStartIssuesNavigation();
@@ -7040,8 +7067,8 @@ const TableControlAddRowTrigger = forwardRef(function TableControlAddRowTrigger2
7040
7067
  ...otherProps
7041
7068
  }, forwardedRef) {
7042
7069
  const prefix = usePrefix();
7043
- const [locale] = useLocale();
7044
- defaultButtonText ??= locale.TableControlAddRowTrigger.defaultButtonText;
7070
+ const [locale7] = useLocale();
7071
+ defaultButtonText ??= locale7.TableControlAddRowTrigger.defaultButtonText;
7045
7072
  const printing = usePrinting();
7046
7073
  const { controller, size, maxRows } = useTableControlContext();
7047
7074
  const controlIsDisabled = useFormIsDisabled();
@@ -7088,12 +7115,12 @@ const TableControlRemoveRowTrigger = forwardRef(function TableControlRemoveRowTr
7088
7115
  children,
7089
7116
  ...otherProps
7090
7117
  }, forwardedRef) {
7091
- const [locale] = useLocale();
7092
- defaultButtonLabel ??= locale.TableControlRemoveRowTrigger.defaultButtonLabel;
7093
- confirmDialogTitle ??= locale.TableControlRemoveRowTrigger.confirmDialogTitle;
7094
- confirmDialogMessage ??= locale.TableControlRemoveRowTrigger.confirmDialogMessage;
7095
- confirmDialogOkText ??= locale.TableControlRemoveRowTrigger.confirmDialogOkText;
7096
- confirmDialogCancelText ??= locale.TableControlRemoveRowTrigger.confirmDialogCancelText;
7118
+ const [locale7] = useLocale();
7119
+ defaultButtonLabel ??= locale7.TableControlRemoveRowTrigger.defaultButtonLabel;
7120
+ confirmDialogTitle ??= locale7.TableControlRemoveRowTrigger.confirmDialogTitle;
7121
+ confirmDialogMessage ??= locale7.TableControlRemoveRowTrigger.confirmDialogMessage;
7122
+ confirmDialogOkText ??= locale7.TableControlRemoveRowTrigger.confirmDialogOkText;
7123
+ confirmDialogCancelText ??= locale7.TableControlRemoveRowTrigger.confirmDialogCancelText;
7097
7124
  const { confirm } = useAlertDialog();
7098
7125
  const { controller } = useTableControlContext();
7099
7126
  const controlIsDisabled = useFormIsDisabled();
@@ -7379,9 +7406,9 @@ function ValidateAction({
7379
7406
  onClick,
7380
7407
  ...otherProps
7381
7408
  }) {
7382
- const [locale] = useLocale();
7383
- label ??= locale.ValidateAction.label;
7384
- keybinds ??= locale.ValidateAction.keybinds;
7409
+ const [locale7] = useLocale();
7410
+ label ??= locale7.ValidateAction.label;
7411
+ keybinds ??= locale7.ValidateAction.keybinds;
7385
7412
  const { validate } = useFormValidator();
7386
7413
  const { validatingAutomatically, validatingManually, validating } = useFormIsValidating();
7387
7414
  const deferredValidating = useDeferredValue(validating);
@@ -7464,10 +7491,12 @@ export {
7464
7491
  ValidateAction,
7465
7492
  displayStatusToColor,
7466
7493
  displayStatusToControlStatus,
7467
- enGB,
7468
- enUS,
7469
- fr,
7470
- pt,
7494
+ locale as enGB,
7495
+ locale2 as enUS,
7496
+ locale3 as fr,
7497
+ locale4 as frFR,
7498
+ locale5 as pt,
7499
+ locale6 as ptPT,
7471
7500
  setDefaultPrefixSuffix,
7472
7501
  tableControlActionsColumn,
7473
7502
  tableControlIndexColumn,