@ostack.tech/ui-kform 0.16.3 → 1.0.0-rc.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.
Files changed (37) hide show
  1. package/dist/chunks/{en-CKrk2smU.js → en-CBhjKaFE.js} +2 -1
  2. package/dist/chunks/{en-CKrk2smU.js.map → en-CBhjKaFE.js.map} +1 -1
  3. package/dist/locales/en-GB.js +1 -1
  4. package/dist/locales/en-US.js +1 -1
  5. package/dist/locales/fr-FR.js +1 -0
  6. package/dist/locales/fr-FR.js.map +1 -1
  7. package/dist/locales/pt-PT.js +1 -0
  8. package/dist/locales/pt-PT.js.map +1 -1
  9. package/dist/ostack-ui-kform.css +17 -1
  10. package/dist/ostack-ui-kform.js +349 -185
  11. package/dist/ostack-ui-kform.js.map +1 -1
  12. package/package.json +2 -2
  13. package/scss/components/Annexes/_Annexes.scss +6 -0
  14. package/scss/components/TopBar/_TopBar.scss +13 -1
  15. package/types/components/FileControl/FileControl.d.ts +1 -1
  16. package/types/components/LoadAction/LoadAction.d.ts +2 -5
  17. package/types/components/PathLink/PathLink.d.ts +22 -1
  18. package/types/components/PrintAction/PrintAction.d.ts +2 -5
  19. package/types/components/ResetOnChange/ResetOnChange.d.ts +40 -0
  20. package/types/components/ResetOnChange/ResetOnChangeContext.d.ts +7 -0
  21. package/types/components/ResetOnChange/index.d.ts +3 -0
  22. package/types/components/ResetOnChange/useResetOnChange.d.ts +96 -0
  23. package/types/components/SaveAction/SaveAction.d.ts +8 -10
  24. package/types/components/SubmitAction/SubmitAction.d.ts +2 -4
  25. package/types/components/TableControl/TableControl.d.ts +4 -1
  26. package/types/components/TableControl/TableControlAddRowTrigger.d.ts +2 -4
  27. package/types/components/TableControl/TableControlColumnFns.d.ts +8 -28
  28. package/types/components/TableControl/TableControlContent.d.ts +1 -1
  29. package/types/components/TableControl/TableControlRemoveRowTrigger.d.ts +11 -21
  30. package/types/components/TopBar/TopBarActions.d.ts +4 -4
  31. package/types/components/TopBar/TopBarActionsSecondary.d.ts +6 -0
  32. package/types/components/TopBar/index.d.ts +1 -0
  33. package/types/components/ValidateAction/ValidateAction.d.ts +2 -5
  34. package/types/index.d.ts +1 -1
  35. package/types/providers/LocalizationProvider/LocalizationObject.d.ts +2 -1
  36. package/types/utils/extractConfirmDialogOptions.d.ts +13 -0
  37. package/types/utils/useResetOnChange.d.ts +0 -98
@@ -2,18 +2,18 @@ import { locale } from "./locales/en-GB.js";
2
2
  import { locale as locale$1 } from "./locales/en-US.js";
3
3
  import { locale as locale$2 } from "./locales/fr-FR.js";
4
4
  import { locale as locale$3 } from "./locales/pt-PT.js";
5
- import { Alert, AlertDialog, AlertDialogAction, AlertDialogBody, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, Button, ButtonGroup, Card, CardBody, CardHeader, CardTitle, Checkbox, CheckboxGroup, CloseButton, Code, Container, ControlAddon, DataTable, DataTableCell, DataTableContent, DataTablePagination, DataTableRow, DataTableRowsPerPage, DateInput, DateRangeInput, DescriptionList, DescriptionListItem, Dialog, DialogBody, DialogContent, DialogHeader, DialogTitle, DialogTrigger, DocumentTitle, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EMPTY_STORE, ErrorBoundary, Feedback, FeedbackList, FeedbackPopover, FeedbackProvider, Field, Icon, IconButton, Input, Layer, Link, LocalizationProvider as LocalizationProvider$1, MenuList, MenuListItem, NATIVE_CONTROLS, NumericInput, Option, OptionsGroup, Popover, PopoverContent, PopoverTrigger, PrefixProvider, PrinterTrigger, Radio, RadioGroup, Root, Select, Slot, Spinner, Stack, Step, StepContent, StepList, Stepper, StepperFinishTrigger, StepperNextTrigger, StepperPreviousTrigger, Tab, TabContent, TabList, Tabs, TextArea, Tooltip, VisuallyHidden, boolDataAttr, combineAriaIds, combineEventHandlers, computed, controlStatusToAccent, cx, parseChildren, setBoolDataAttr, useAlertDialog, useCombinedRef, useConstant, useControllableState, useCssVars, useDataTableApiRef, useDataTableColumnLabel, useDateTransformer, useErrorReporter, useIntersectionObserver, useIsInRoot, useIsInTableCell, useKeyboardShortcut, useLatestRef, useMeasure, useMediaBreakpointUp, useOnLabelChange, usePrefix as usePrefix$1, usePrevious, usePrint, usePrintClassNames, usePrintInProgress, usePrinterDocumentTitle, usePrinting, useResponsiveValues, useScrollPosition, useSpacing, useStartPrintingTask, useToastManager, warnOnce } from "@ostack.tech/ui";
5
+ import { Action, ActionSplit, Actions, ActionsSecondary, Alert, AlertDialog, AlertDialogAction, AlertDialogBody, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, Button, Card, CardBody, CardHeader, CardTitle, Checkbox, CheckboxGroup, CloseButton, Code, Container, ControlAddon, DataTable, DataTableCell, DataTableContent, DataTablePagination, DataTableRow, DataTableRowsPerPage, DateInput, DateRangeInput, DescriptionList, DescriptionListItem, Dialog, DialogBody, DialogContent, DialogHeader, DialogTitle, DialogTrigger, DocumentTitle, DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EMPTY_STORE, ErrorBoundary, Feedback, FeedbackList, FeedbackPopover, FeedbackProvider, Field, Icon, IconButton, Input, Layer, Link, LocalizationProvider as LocalizationProvider$1, MenuList, MenuListItem, NATIVE_CONTROLS, NumericInput, Option, OptionsGroup, Popover, PopoverContent, PopoverTrigger, PrefixProvider, PrinterTrigger, Radio, RadioGroup, Root, Select, Slot, Spinner, Stack, Step, StepContent, StepList, Stepper, StepperFinishTrigger, StepperNextTrigger, StepperPreviousTrigger, Tab, TabContent, TabList, Tabs, TextArea, Tooltip, VisuallyHidden, boolDataAttr, combineAriaIds, combineEventHandlers, computed, controlStatusToAccent, cx, parseChildren, setBoolDataAttr, useActionsContext, useAlertDialog, useCombinedRef, useConstant, useControllableState, useCssVars, useDataTableApiRef, useDataTableColumnLabel, useDateTransformer, useErrorReporter, useIntersectionObserver, useIsInRoot, useIsInTableCell, useKeyboardShortcut, useLatestRef, useMeasure, useMediaBreakpointUp, useOnLabelChange, usePrefix as usePrefix$1, usePrevious, usePrint, usePrintClassNames, usePrintInProgress, usePrinterDocumentTitle, usePrinting, useResponsiveValues, useScrollPosition, useSpacing, useStartPrintingTask, useToastManager, warnOnce } from "@ostack.tech/ui";
6
6
  import { DEV } from "esm-env";
7
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
8
  import { AtPathError, CurrentPath, FormContext, FormattedValue, InvalidPathError, equals, formatNumericAsString, formatTemporalAsString, toFileList, useController, useCurrentPath, useFileInput, useForm, useFormContext, useFormController, useFormManager, useFormattedValue, useFormatter, useInput, useIssuesTracker, useListableInput, useNumericInput, useResolvedPath, useTemporalInput } from "@ostack.tech/kform-react";
9
9
  import { Children, Fragment as Fragment$1, Suspense, createContext, isValidElement, startTransition, useCallback, useContext, useDeferredValue, useEffect, useEffectEvent, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
10
10
  import { createStore, useStore } from "zustand";
11
11
  import { useShallow } from "zustand/react/shallow";
12
- import { AbsolutePath, AbsolutePathFragment, Path, PathMultimap, PromiseCancellationException, ValidationFailure, arrayToTable, compareSchemaPaths, isComputedSchema, isKtList, isTable, nullableSchemaInnerSchema, sliceTableRows, tableIdsToArray, tableRowsToArray, tableSize } from "@ostack.tech/kform";
12
+ import { AbsolutePath, AbsolutePathFragment, Path, PathMultimap, PromiseCancellationException, ValidationFailure, ValueEvent, arrayToTable, compareSchemaPaths, isComputedSchema, isKtList, isTable, nullableSchemaInnerSchema, sliceTableRows, tableIdsToArray, tableRowsToArray, tableSize } from "@ostack.tech/kform";
13
13
  import { subscribeWithSelector } from "zustand/middleware";
14
14
  import { shallow } from "zustand/shallow";
15
15
  import { fileOpen, fileSave, supported } from "browser-fs-access";
16
- import { faAngleLeft, faAngleRight, faAnglesLeft, faAnglesRight, faArrowRight, faArrowsToDot, faBug, faCaretDown, faChevronDown, faChevronUp, faCircleCheck, faCircleExclamation, faCircleQuestion, faDownload, faFileLines, faFloppyDisk, faFolderOpen, faPlus, faPrint, faTrash, faTriangleExclamation } from "@fortawesome/free-solid-svg-icons";
16
+ import { faAngleLeft, faAngleRight, faAnglesLeft, faAnglesRight, faArrowRight, faArrowsToDot, faBug, faChevronDown, faChevronUp, faCircleCheck, faCircleExclamation, faCircleQuestion, faDownload, faFileLines, faFloppyDisk, faFolderOpen, faPlus, faPrint, faTrash, faTriangleExclamation } from "@fortawesome/free-solid-svg-icons";
17
17
  import { addDays, format, formatISO, max, min, parseISO } from "date-fns";
18
18
  import { faCircleCheck as faCircleCheck$1 } from "@fortawesome/free-regular-svg-icons";
19
19
  //#region src/providers/PrefixSuffixProvider/defaultPrefixSuffix.ts
@@ -1807,20 +1807,38 @@ function TopBar({ className, ref, ...otherProps }) {
1807
1807
  }
1808
1808
  //#endregion
1809
1809
  //#region src/components/TopBar/TopBarActions.tsx
1810
- /** Container used to display actions within the top bar. */
1811
- function TopBarActions({ className, children, ...otherProps }) {
1810
+ /** Container of the top bar actions. */
1811
+ function TopBarActions({ className, containerProps, children, ...otherProps }) {
1812
1812
  const prefix = usePrefix();
1813
1813
  const issuesDisplayMode = useIssuesDisplayMode();
1814
- return /* @__PURE__ */ jsxs(Stack, {
1814
+ return /* @__PURE__ */ jsxs(Actions, {
1815
1815
  className: cx(prefix("top-bar__actions"), className),
1816
- direction: "row",
1817
- gap: 2,
1818
- justifyContent: "flex-end",
1816
+ primaryLayout: {
1817
+ xs: ["horizontal", "vertical"],
1818
+ sm: "horizontal"
1819
+ },
1820
+ secondaryLayout: {
1821
+ xs: "dropdown",
1822
+ md: ["vertical", "dropdown"]
1823
+ },
1824
+ containerProps: {
1825
+ ...containerProps,
1826
+ className: cx(prefix("top-bar__actions-container"), containerProps?.className)
1827
+ },
1819
1828
  ...otherProps,
1820
1829
  children: [issuesDisplayMode === "inline" && /* @__PURE__ */ jsx(IssuesPopover, { children: /* @__PURE__ */ jsx(IssueMessages, {}) }), children]
1821
1830
  });
1822
1831
  }
1823
1832
  //#endregion
1833
+ //#region src/components/TopBar/TopBarActionsSecondary.tsx
1834
+ /** Container of the secondary top bar actions. */
1835
+ function TopBarActionsSecondary(props) {
1836
+ return /* @__PURE__ */ jsx(ActionsSecondary, {
1837
+ color: "success",
1838
+ ...props
1839
+ });
1840
+ }
1841
+ //#endregion
1824
1842
  //#region src/components/Annexes/AnnexesMenu.tsx
1825
1843
  /** Component that allows to navigate between, add, and remove annexes. */
1826
1844
  function AnnexesMenu({ menuButtonText, menuButtonLabel, addAnnexText, removeAnnexButtonLabel, removeAnnexKeyboardHint, removeAnnexConfirmDialogTitle, removeAnnexConfirmDialogMessage, removeAnnexConfirmDialogOkText, removeAnnexConfirmDialogCancelText, defaultOpen = false, open: controlledOpen, onOpenChange, menuTriggerProps, menuContentProps, ...otherProps }) {
@@ -2142,6 +2160,7 @@ function AnnexesTabList({ hideNonActiveOnSmallScreens, rootProps, className, ...
2142
2160
  const store = useAnnexesContext();
2143
2161
  const activeAnnex = useStore(store, (state) => state.activeAnnex);
2144
2162
  const tabStates = useStore(store, useShallow((state) => state.tabStates()));
2163
+ const printing = usePrinting();
2145
2164
  const isLargeScreen = useMediaBreakpointUp("sm");
2146
2165
  return /* @__PURE__ */ jsx(TabList, {
2147
2166
  className: cx(prefix("annexes__tab-list"), className),
@@ -2150,7 +2169,7 @@ function AnnexesTabList({ hideNonActiveOnSmallScreens, rootProps, className, ...
2150
2169
  className: cx(prefix("annexes__tab-list-root"), rootProps?.className)
2151
2170
  },
2152
2171
  ...otherProps,
2153
- children: tabStates.map((state) => !hideNonActiveOnSmallScreens || isLargeScreen || state.path.equals(activeAnnex) ? /* @__PURE__ */ jsx(AnnexTab, { ...state }, state.path.toString()) : null)
2172
+ children: tabStates.map((state) => printing || !hideNonActiveOnSmallScreens || isLargeScreen || state.path.equals(activeAnnex) ? /* @__PURE__ */ jsx(AnnexTab, { ...state }, state.path.toString()) : null)
2154
2173
  });
2155
2174
  }
2156
2175
  //#endregion
@@ -2486,6 +2505,186 @@ function DebugInfoControlAddonTrigger({ label, ...otherProps }) {
2486
2505
  });
2487
2506
  }
2488
2507
  //#endregion
2508
+ //#region src/components/ResetOnChange/ResetOnChangeContext.ts
2509
+ /** Reset on change context. */
2510
+ var ResetOnChangeContext = createContext(void 0);
2511
+ /** Function providing access to the reset on change context value. */
2512
+ function useResetOnChangeContext() {
2513
+ return useContext(ResetOnChangeContext);
2514
+ }
2515
+ //#endregion
2516
+ //#region src/utils/extractConfirmDialogOptions.ts
2517
+ /** Function used to extract confirm dialog options with a given prefix. */
2518
+ function extractConfirmDialogOptions(options, prefix = "confirmDialog", newPrefix = "") {
2519
+ const confirmDialogOptions = {};
2520
+ const otherOptions = {};
2521
+ for (const k in options) {
2522
+ const v = options[k];
2523
+ if (k.startsWith(prefix)) {
2524
+ const unprefixed = k.slice(prefix.length);
2525
+ const opt = newPrefix ? newPrefix + unprefixed : unprefixed.charAt(0).toLowerCase() + unprefixed.slice(1);
2526
+ confirmDialogOptions[opt] = v;
2527
+ } else otherOptions[k] = v;
2528
+ }
2529
+ return [confirmDialogOptions, otherOptions];
2530
+ }
2531
+ //#endregion
2532
+ //#region src/components/ResetOnChange/useResetOnChange.tsx
2533
+ var ALWAYS_RESET = () => true;
2534
+ /**
2535
+ * Hook which returns an `onValueChange` event handler which resets the fields
2536
+ * at the provided `reset` path(s) to their initial value when a value changes
2537
+ * (according to the `when` function).
2538
+ *
2539
+ * Optionally requests user-confirmation via alert dialog if `showConfirmation`
2540
+ * is provided.
2541
+ *
2542
+ * When using wildcards in `reset`, certain fields may be excluded via
2543
+ * `exclude`.
2544
+ *
2545
+ * Example usage:
2546
+ *
2547
+ * ```tsx
2548
+ * import {
2549
+ * CheckboxControl,
2550
+ * useResetOnChange,
2551
+ * } from "@ostack.tech/ui-kform";
2552
+ *
2553
+ * function NoTransactionsControl() {
2554
+ * const handleOnChange = useResetOnChange("/transactions", {
2555
+ * when: ({ value }) => Boolean(value),
2556
+ * confirmDialogTitle: "Confirm no transactions",
2557
+ * confirmDialogMessage: (
2558
+ * <>
2559
+ * By checking this box, the “Itemised transactions” table will be
2560
+ * cleared. Are you sure you want to continue?
2561
+ * </>
2562
+ * ),
2563
+ * confirmDialogOkText: "Confirm",
2564
+ * });
2565
+ *
2566
+ * return (
2567
+ * <CheckboxControl
2568
+ * path="/noTransactions"
2569
+ * onValueChange={handleOnChange}
2570
+ * >
2571
+ * I declare that no taxable transactions were performed during this
2572
+ * filing period.
2573
+ * </CheckboxControl>
2574
+ * );
2575
+ * }
2576
+ * ```
2577
+ *
2578
+ * @param reset Path(s) to reset when the value changes (relative to the current
2579
+ * path). Wildcards in paths (`*` or `**`) are supported.
2580
+ * @param options Hook options. See {@link UseResetOnChangeOptions}.
2581
+ */
2582
+ function useResetOnChange(reset, { when = ALWAYS_RESET, exclude, confirmDialogMessage, showConfirmation = Boolean(confirmDialogMessage), setUntouched = true, setPristine = true, undo = undoValueChange, ...confirmDialogOptions } = {}) {
2583
+ const [unprefixedConfirmDialogOptions] = extractConfirmDialogOptions(confirmDialogOptions);
2584
+ const { confirm } = useAlertDialog();
2585
+ const formManager = useFormManager();
2586
+ const currentPath = useCurrentPath();
2587
+ const undoing = useRef(false);
2588
+ const toReset = useMemo(() => {
2589
+ let resolvedReset = (Array.isArray(reset) ? reset : [reset]).map((path) => currentPath.resolve(path));
2590
+ if (exclude) {
2591
+ const resolvedExclude = (Array.isArray(exclude) ? exclude : [exclude]).map((path) => currentPath.resolve(path));
2592
+ resolvedReset = excludePaths(formManager, resolvedReset, resolvedExclude);
2593
+ }
2594
+ return resolvedReset;
2595
+ }, [
2596
+ currentPath,
2597
+ exclude,
2598
+ formManager,
2599
+ reset
2600
+ ]);
2601
+ const handleValueChange = async (event) => {
2602
+ if (!undoing.current && when(event)) {
2603
+ if (showConfirmation) {
2604
+ if (await someIsDirty(formManager, toReset) && !await confirm(confirmDialogMessage, {
2605
+ color: "warning",
2606
+ ...unprefixedConfirmDialogOptions
2607
+ })) {
2608
+ undoing.current = true;
2609
+ Promise.resolve(undo(formManager, event)).finally(() => undoing.current = false);
2610
+ return;
2611
+ }
2612
+ }
2613
+ await resetAll(formManager, toReset, setUntouched, setPristine);
2614
+ }
2615
+ };
2616
+ return (event) => void handleValueChange(event);
2617
+ }
2618
+ /** `undoChange` implementation which sets the old value onto the storage. */
2619
+ function undoValueChange(formManager, event) {
2620
+ if (!(event instanceof ValueEvent.Change)) throw new Error("Unable to undo change. Please provide a custom `undo` function.");
2621
+ return formManager.set(event.path, event.oldValue);
2622
+ }
2623
+ /**
2624
+ * Returns an "expanded" (without wildcards) list of all paths in `path` that
2625
+ * **do not** match those in `toExclude`.
2626
+ */
2627
+ function excludePaths(formManager, paths, exclude) {
2628
+ return paths.flatMap((path) => Array.from(formManager.schemaInfo(path)).map((info) => info.path)).filter((path) => !exclude.some((toIgnore) => path.matches(toIgnore)));
2629
+ }
2630
+ /**
2631
+ * Returns a promise that resolves with whether at least one of the provided
2632
+ * paths is dirty.
2633
+ */
2634
+ async function someIsDirty(formManager, paths) {
2635
+ return (await Promise.all(paths.map((path) => formManager.isDirty(path)))).some((isDirty) => isDirty);
2636
+ }
2637
+ /**
2638
+ * Resets all the provided paths by calling `reset`, `setPristine` and
2639
+ * `setUntouched` on them.
2640
+ */
2641
+ async function resetAll(formManager, toReset, setPristine, setUntouched) {
2642
+ await Promise.all(toReset.flatMap((path) => [
2643
+ formManager.reset(path),
2644
+ setPristine && formManager.setPristine(path),
2645
+ setUntouched && formManager.setUntouched(path)
2646
+ ]));
2647
+ }
2648
+ //#endregion
2649
+ //#region src/components/ResetOnChange/ResetOnChange.tsx
2650
+ /**
2651
+ * Component used to reset path(s) to their initial value when the value of
2652
+ * controls within it change (according to the `when` function). Built on top of
2653
+ * the `useResetOnChange` hook.
2654
+ *
2655
+ * Optionally requests user-confirmation via alert dialog if `showConfirmation`
2656
+ * is provided.
2657
+ *
2658
+ * When using wildcards in `reset`, certain fields may be excluded via
2659
+ * `exclude`.
2660
+ *
2661
+ * Example usage:
2662
+ *
2663
+ * ```tsx
2664
+ * import { CheckboxControl, ResetOnChange } from "@ostack.tech/ui-kform";
2665
+ *
2666
+ * function SameAddressControl() {
2667
+ * return (
2668
+ * <ResetOnChange
2669
+ * reset="/mailingAddress"
2670
+ * when={({ value }) => Boolean(value)}
2671
+ * >
2672
+ * <CheckboxControl path="/sameAddress">
2673
+ * Same as residential address
2674
+ * </CheckboxControl>
2675
+ * </ResetOnChange>
2676
+ * );
2677
+ * }
2678
+ * ```
2679
+ */
2680
+ function ResetOnChange({ reset, children, ...otherProps }) {
2681
+ const resetOnChange = useResetOnChange(reset, otherProps);
2682
+ return /* @__PURE__ */ jsx(ResetOnChangeContext, {
2683
+ value: resetOnChange,
2684
+ children
2685
+ });
2686
+ }
2687
+ //#endregion
2489
2688
  //#region src/components/CheckboxControl/CheckboxControl.tsx
2490
2689
  /**
2491
2690
  * The checkbox control component is a KForm form control for values with
@@ -2525,7 +2724,7 @@ function CheckboxControl({ path, issueMessages, issuesPanelLabel, displayIssues
2525
2724
  formManager,
2526
2725
  onInitialized,
2527
2726
  onFormManagerEvent,
2528
- onValueChange,
2727
+ onValueChange: combineEventHandlers(onValueChange, useResetOnChangeContext()),
2529
2728
  onValidationStatusChange,
2530
2729
  onDisplayStatusChange,
2531
2730
  onDirtyStatusChange,
@@ -2757,7 +2956,7 @@ function CheckboxGroupControl({ path, options, issueMessages, issuesPanelLabel,
2757
2956
  formManager,
2758
2957
  onInitialized,
2759
2958
  onFormManagerEvent,
2760
- onValueChange,
2959
+ onValueChange: combineEventHandlers(onValueChange, useResetOnChangeContext()),
2761
2960
  onValidationStatusChange,
2762
2961
  onDisplayStatusChange,
2763
2962
  onDirtyStatusChange,
@@ -2912,7 +3111,7 @@ function DateControl({ path, issueMessages, issuesPanelLabel, displayIssues = tr
2912
3111
  formManager,
2913
3112
  onInitialized,
2914
3113
  onFormManagerEvent,
2915
- onValueChange,
3114
+ onValueChange: combineEventHandlers(onValueChange, useResetOnChangeContext()),
2916
3115
  onValidationStatusChange,
2917
3116
  onDisplayStatusChange,
2918
3117
  onDirtyStatusChange,
@@ -3011,6 +3210,7 @@ function DateRangeControl({ startPath, endPath, startIssueMessages, endIssueMess
3011
3210
  const parseToString = useCallback((formattedValue, state) => parse(formattedValue, state.schema), [parse]);
3012
3211
  const formatFromString = useCallback((stringValue, state) => format(stringValue, state.schema), [format]);
3013
3212
  const formIsLoading = useFormIsLoading();
3213
+ const resetOnChange = useResetOnChangeContext();
3014
3214
  const startController = useTemporalInput(startPath, {
3015
3215
  enabled: !formIsLoading,
3016
3216
  parseToString,
@@ -3021,7 +3221,7 @@ function DateRangeControl({ startPath, endPath, startIssueMessages, endIssueMess
3021
3221
  })), []),
3022
3222
  onInitialized: onStartInitialized,
3023
3223
  onFormManagerEvent: onStartFormManagerEvent,
3024
- onValueChange: onStartValueChange,
3224
+ onValueChange: combineEventHandlers(onStartValueChange, resetOnChange),
3025
3225
  onValidationStatusChange: onStartValidationStatusChange,
3026
3226
  onDisplayStatusChange: onStartDisplayStatusChange,
3027
3227
  onDirtyStatusChange: onStartDirtyStatusChange,
@@ -3037,7 +3237,7 @@ function DateRangeControl({ startPath, endPath, startIssueMessages, endIssueMess
3037
3237
  })), []),
3038
3238
  onInitialized: onEndInitialized,
3039
3239
  onFormManagerEvent: onEndFormManagerEvent,
3040
- onValueChange: onEndValueChange,
3240
+ onValueChange: combineEventHandlers(onEndValueChange, resetOnChange),
3041
3241
  onValidationStatusChange: onEndValidationStatusChange,
3042
3242
  onDisplayStatusChange: onEndDisplayStatusChange,
3043
3243
  onDirtyStatusChange: onEndDirtyStatusChange,
@@ -3245,7 +3445,7 @@ function FileControl({ path, issueMessages, issuesPanelLabel, displayIssues = tr
3245
3445
  }, []),
3246
3446
  onInitialized,
3247
3447
  onFormManagerEvent,
3248
- onValueChange,
3448
+ onValueChange: combineEventHandlers(onValueChange, useResetOnChangeContext()),
3249
3449
  onValidationStatusChange,
3250
3450
  onDisplayStatusChange,
3251
3451
  onDirtyStatusChange,
@@ -4880,16 +5080,17 @@ function LoadAction({ label, keybinds, showWhenReadOnly, fileSystemId, loading,
4880
5080
  target: formAppEl,
4881
5081
  preventDefault: true
4882
5082
  });
4883
- return showAction && /* @__PURE__ */ jsx(Button, {
4884
- vertical: true,
5083
+ const { secondary } = useActionsContext() ?? {};
5084
+ return showAction && /* @__PURE__ */ jsx(Action, {
5085
+ layout: secondary ? void 0 : "vertical",
5086
+ label,
4885
5087
  variant: "subtle",
4886
5088
  icon: faFolderOpen,
4887
5089
  ...otherProps,
4888
5090
  onClick: combineEventHandlers(() => load(), onClick),
4889
5091
  disabled: showDisabled,
4890
5092
  loading: showLoading,
4891
- keybinds,
4892
- children: label
5093
+ keybinds
4893
5094
  });
4894
5095
  }
4895
5096
  //#endregion
@@ -4955,7 +5156,7 @@ function NumericControl({ path, issueMessages, issuesPanelLabel, displayIssues =
4955
5156
  formManager,
4956
5157
  onInitialized,
4957
5158
  onFormManagerEvent,
4958
- onValueChange,
5159
+ onValueChange: combineEventHandlers(onValueChange, useResetOnChangeContext()),
4959
5160
  onValidationStatusChange,
4960
5161
  onDisplayStatusChange,
4961
5162
  onDirtyStatusChange,
@@ -5023,7 +5224,28 @@ function NumericControl({ path, issueMessages, issuesPanelLabel, displayIssues =
5023
5224
  }
5024
5225
  //#endregion
5025
5226
  //#region src/components/PathLink/PathLink.tsx
5026
- /** Link to a KForm path. */
5227
+ /**
5228
+ * The path link component creates a link (although typically rendered as a
5229
+ * `<button>`) to a part of the form identified by the provided path. It is
5230
+ * built on top of the [`Link`
5231
+ * component](/docs/ostack-ui-typography-link--docs).
5232
+ *
5233
+ * Example usage:
5234
+ *
5235
+ * ```tsx
5236
+ * import { Alert } from "@ostack.tech/ui";
5237
+ * import { PathLink } from "@ostack.tech/ui-kform";
5238
+ *
5239
+ * function ProfileNotice() {
5240
+ * return (
5241
+ * <Alert>
5242
+ * Your profile URL will be generated using your handle. To change it,
5243
+ * update your <PathLink to="/username">username</PathLink>.
5244
+ * </Alert>
5245
+ * );
5246
+ * }
5247
+ * ```
5248
+ */
5027
5249
  function PathLink({ as = "button", to, onClick, ...otherProps }) {
5028
5250
  const focus = useFocus();
5029
5251
  const path = useResolvedPath(to);
@@ -5105,17 +5327,18 @@ function PrintAction({ label, keybinds, showWhenReadOnly = true, disabled, loadi
5105
5327
  target: formAppEl,
5106
5328
  preventDefault: true
5107
5329
  });
5330
+ const { secondary } = useActionsContext() ?? {};
5108
5331
  return showAction && /* @__PURE__ */ jsx(PrinterTrigger, {
5109
5332
  onClick: combineEventHandlers(onClick, handlePrint, { checkDefaultPrevented: true }),
5110
- children: /* @__PURE__ */ jsx(Button, {
5111
- vertical: true,
5333
+ children: /* @__PURE__ */ jsx(Action, {
5334
+ label,
5335
+ layout: secondary ? void 0 : "vertical",
5112
5336
  variant: "subtle",
5113
5337
  icon: faPrint,
5114
5338
  ...otherProps,
5115
5339
  disabled: showDisabled,
5116
5340
  loading: showLoading,
5117
- keybinds,
5118
- children: label
5341
+ keybinds
5119
5342
  })
5120
5343
  });
5121
5344
  }
@@ -5185,7 +5408,7 @@ function RadioGroupControl({ path, options, issueMessages, issuesPanelLabel, dis
5185
5408
  formManager,
5186
5409
  onInitialized,
5187
5410
  onFormManagerEvent,
5188
- onValueChange,
5411
+ onValueChange: combineEventHandlers(onValueChange, useResetOnChangeContext()),
5189
5412
  onValidationStatusChange,
5190
5413
  onDisplayStatusChange,
5191
5414
  onDirtyStatusChange,
@@ -5387,7 +5610,7 @@ var DEFAULT_SAVE_AS_KEYBINDS = "$mod+Shift+S";
5387
5610
  * }
5388
5611
  * ```
5389
5612
  */
5390
- function SaveAction({ label, keybinds, showWhenReadOnly = true, fileSystemId, disableOverwrite, saveOptionsLabel, saveAsLabel, saveAsKeybinds, loading, disabled, onClick, variant = "subtle", color, path, encode, fileName, extensions, description, mimeTypes, startIn, excludeAcceptAllOption, successMessage, errorMessage, saveOptionsProps, dropdownMenuProps, ...otherProps }) {
5613
+ function SaveAction({ label, keybinds, showWhenReadOnly = true, fileSystemId, disableOverwrite, saveOptionsLabel, saveAsLabel, saveAsKeybinds, loading, disabled, onClick, variant = "subtle", color, path, encode, fileName, extensions, description, mimeTypes, startIn, excludeAcceptAllOption, successMessage, errorMessage, groupCollapsed, defaultOpen, open, onOpenChange, modal, groupLabel, saveOptionsPlacement, buttonGroupProps, saveOptionsProps, dropdownMenuGroupProps, dropdownMenuContentProps, ...otherProps }) {
5391
5614
  const [locale] = useLocale();
5392
5615
  label ??= locale.SaveAction.label;
5393
5616
  if (keybinds === void 0) keybinds = locale.SaveAction.keybinds ?? "$mod+S";
@@ -5426,8 +5649,9 @@ function SaveAction({ label, keybinds, showWhenReadOnly = true, fileSystemId, di
5426
5649
  target: formAppEl,
5427
5650
  preventDefault: true
5428
5651
  });
5429
- const saveButton = /* @__PURE__ */ jsx(Button, {
5430
- vertical: true,
5652
+ const { secondary } = useActionsContext() ?? {};
5653
+ const saveActionProps = {
5654
+ layout: secondary ? void 0 : "vertical",
5431
5655
  variant,
5432
5656
  color,
5433
5657
  icon: faFloppyDisk,
@@ -5436,30 +5660,36 @@ function SaveAction({ label, keybinds, showWhenReadOnly = true, fileSystemId, di
5436
5660
  disabled: showDisabled,
5437
5661
  loading: showLoading,
5438
5662
  keybinds,
5439
- children: label
5440
- });
5441
- return showAction && (supportsFileSystemAPIs && !disableOverwrite ? /* @__PURE__ */ jsxs(ButtonGroup, { children: [saveButton, /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, { children: /* @__PURE__ */ jsx(IconButton, {
5442
- variant,
5443
- color,
5444
- icon: faCaretDown,
5445
- ...saveOptionsProps,
5446
- label: saveOptionsLabel,
5447
- disabled: showDisabled || saveOptionsProps?.disabled,
5448
- style: {
5449
- minWidth: 20,
5450
- ...saveOptionsProps?.style
5451
- }
5452
- }) }), /* @__PURE__ */ jsx(DropdownMenuContent, {
5453
- align: "end",
5454
- ...dropdownMenuProps,
5455
- children: /* @__PURE__ */ jsx(DropdownMenuItem, {
5663
+ label
5664
+ };
5665
+ return showAction && (supportsFileSystemAPIs && !disableOverwrite ? /* @__PURE__ */ jsx(ActionSplit, {
5666
+ ...saveActionProps,
5667
+ groupCollapsed,
5668
+ defaultOpen,
5669
+ open,
5670
+ onOpenChange,
5671
+ modal,
5672
+ groupLabel,
5673
+ splitPlacement: saveOptionsPlacement,
5674
+ buttonGroupProps,
5675
+ dropdownMenuGroupProps,
5676
+ splitLabel: saveOptionsLabel,
5677
+ splitProps: {
5678
+ ...saveOptionsProps,
5679
+ disabled: showDisabled || saveOptionsProps?.disabled
5680
+ },
5681
+ dropdownMenuContentProps: {
5682
+ align: "end",
5683
+ ...dropdownMenuContentProps
5684
+ },
5685
+ children: /* @__PURE__ */ jsx(Action, {
5686
+ label: saveAsLabel,
5456
5687
  onClick: () => save(),
5457
5688
  disabled: showDisabled,
5458
5689
  loading: showLoading,
5459
- keybinds: saveAsKeybinds,
5460
- children: saveAsLabel
5690
+ keybinds: saveAsKeybinds
5461
5691
  })
5462
- })] })] }) : saveButton);
5692
+ }) : /* @__PURE__ */ jsx(Action, { ...saveActionProps }));
5463
5693
  }
5464
5694
  //#endregion
5465
5695
  //#region src/components/SelectControl/SelectControlItem.tsx
@@ -5549,7 +5779,7 @@ function SelectControl({ path, options: groupedOptions, issueMessages, issuesPan
5549
5779
  formManager,
5550
5780
  onInitialized,
5551
5781
  onFormManagerEvent,
5552
- onValueChange,
5782
+ onValueChange: combineEventHandlers(onValueChange, useResetOnChangeContext()),
5553
5783
  onValidationStatusChange,
5554
5784
  onDisplayStatusChange,
5555
5785
  onDirtyStatusChange,
@@ -5740,7 +5970,7 @@ function SelectMultipleControl({ path, options: groupedOptions, issueMessages, i
5740
5970
  formManager,
5741
5971
  onInitialized,
5742
5972
  onFormManagerEvent,
5743
- onValueChange,
5973
+ onValueChange: combineEventHandlers(onValueChange, useResetOnChangeContext()),
5744
5974
  onValidationStatusChange,
5745
5975
  onDisplayStatusChange,
5746
5976
  onDirtyStatusChange,
@@ -5953,7 +6183,8 @@ function SubmitAction({ onSubmit, onInvalidSubmit, onSuccessfulSubmit, onFailedS
5953
6183
  return showAction && /* @__PURE__ */ jsxs(AlertDialog, {
5954
6184
  open: confirmingSubmission,
5955
6185
  onOpenChange: handleOpenChange,
5956
- children: [/* @__PURE__ */ jsx(AlertDialogTrigger, { children: /* @__PURE__ */ jsx(Button, {
6186
+ children: [/* @__PURE__ */ jsx(AlertDialogTrigger, { children: /* @__PURE__ */ jsx(Action, {
6187
+ label,
5957
6188
  type: "submit",
5958
6189
  color: "success",
5959
6190
  icon: faArrowRight,
@@ -5962,8 +6193,7 @@ function SubmitAction({ onSubmit, onInvalidSubmit, onSuccessfulSubmit, onFailedS
5962
6193
  onClick: combineEventHandlers(onClick, handleAction),
5963
6194
  disabled: showDisabled,
5964
6195
  loading: showLoading,
5965
- keybinds,
5966
- children: label
6196
+ keybinds
5967
6197
  }) }), /* @__PURE__ */ jsx(AlertDialogContent, {
5968
6198
  color: "primary",
5969
6199
  ...dialogContentProps,
@@ -6191,7 +6421,10 @@ function TableControlRow({ row, index, ...otherProps }) {
6191
6421
  * <TableControlActionsColumn removeRowLabel="Remove item" />
6192
6422
  * </TableControlColumns>
6193
6423
  * <TableControlAddRowTrigger label="Add item" />
6194
- * <TableControlContent caption="Inventory" />
6424
+ * <TableControlContent
6425
+ * caption="Inventory"
6426
+ * emptyMessage="No items added."
6427
+ * />
6195
6428
  * </TableControl>
6196
6429
  * );
6197
6430
  * }
@@ -6208,7 +6441,7 @@ function TableControl({ path, issueMessages, issuesPanelLabel, displayIssues = t
6208
6441
  setFormattedValue: setIds,
6209
6442
  onInitialized,
6210
6443
  onFormManagerEvent,
6211
- onValueChange,
6444
+ onValueChange: combineEventHandlers(onValueChange, useResetOnChangeContext()),
6212
6445
  onValidationStatusChange,
6213
6446
  onDisplayStatusChange,
6214
6447
  onDirtyStatusChange,
@@ -6401,9 +6634,10 @@ function TableControlIndexColumnLabel() {
6401
6634
  * By default, it renders an icon button with label `defaultButtonLabel`,
6402
6635
  * however, this can be overriden by providing `children`.
6403
6636
  */
6404
- function TableControlRemoveRowTrigger({ showConfirmation, onConfirmRowRemoval, onRowRemoved, confirmDialogTitle, confirmDialogMessage, confirmDialogOkText, confirmDialogCancelText, showWhenReadOnly, disabled, onClick, children, ...otherProps }) {
6637
+ function TableControlRemoveRowTrigger({ onConfirmRowRemoval, onRowRemoved, confirmDialogMessage, confirmDialogTitle, confirmDialogOkText, confirmDialogCancelText, showConfirmation = Boolean(confirmDialogMessage), showWhenReadOnly, disabled, onClick, children, ...otherProps }) {
6405
6638
  const [locale] = useLocale();
6406
- const { defaultButtonLabel, label = defaultButtonLabel ?? locale.TableControlRemoveRowTrigger.label, ...iconButtonProps } = otherProps;
6639
+ const [confirmDialogOptions, nonConfirmDialogProps] = extractConfirmDialogOptions(otherProps);
6640
+ const { defaultButtonLabel, label = defaultButtonLabel ?? locale.TableControlRemoveRowTrigger.label, ...iconButtonProps } = nonConfirmDialogProps;
6407
6641
  confirmDialogTitle ??= locale.TableControlRemoveRowTrigger.confirmDialogTitle ?? label;
6408
6642
  confirmDialogMessage ??= locale.TableControlRemoveRowTrigger.confirmDialogMessage;
6409
6643
  confirmDialogOkText ??= locale.TableControlRemoveRowTrigger.confirmDialogOkText;
@@ -6416,15 +6650,17 @@ function TableControlRemoveRowTrigger({ showConfirmation, onConfirmRowRemoval, o
6416
6650
  const initialized = useInitialized();
6417
6651
  const exists = useExists();
6418
6652
  const setLatestInteraction = useSetLatestInteraction();
6653
+ const actionsContext = useActionsContext();
6419
6654
  const [removing, setRemoving] = useState(false);
6420
6655
  const handleClick = async () => {
6421
6656
  setLatestInteraction(controller.getState().path);
6422
6657
  const { path, dirty } = getState();
6423
- if (removing || showConfirmation && dirty && !await confirm(confirmDialogMessage(index), {
6658
+ if (removing || showConfirmation && dirty && !await confirm(typeof confirmDialogMessage === "function" ? confirmDialogMessage(index) : confirmDialogMessage, {
6424
6659
  title: confirmDialogTitle,
6425
6660
  color: "danger",
6426
6661
  okText: confirmDialogOkText,
6427
- cancelText: confirmDialogCancelText
6662
+ cancelText: confirmDialogCancelText,
6663
+ ...confirmDialogOptions
6428
6664
  })) return;
6429
6665
  setRemoving(true);
6430
6666
  try {
@@ -6440,9 +6676,10 @@ function TableControlRemoveRowTrigger({ showConfirmation, onConfirmRowRemoval, o
6440
6676
  disabled: !initialized || !exists || controlIsDisabled || disabled || controlIsReadOnly || removing && children !== void 0,
6441
6677
  onClick: combineEventHandlers(onClick, handleClick, { checkDefaultPrevented: true })
6442
6678
  };
6443
- if (children === void 0) return /* @__PURE__ */ jsx(IconButton, {
6444
- icon: faTrash,
6679
+ if (children === void 0) return /* @__PURE__ */ jsx(Action, {
6680
+ layout: actionsContext ? void 0 : "icon",
6445
6681
  label,
6682
+ icon: faTrash,
6446
6683
  color: "danger",
6447
6684
  loading: !initialized || removing,
6448
6685
  circle: true,
@@ -6450,7 +6687,7 @@ function TableControlRemoveRowTrigger({ showConfirmation, onConfirmRowRemoval, o
6450
6687
  ...commonProps
6451
6688
  });
6452
6689
  return /* @__PURE__ */ jsx(Slot, {
6453
- ...otherProps,
6690
+ ...nonConfirmDialogProps,
6454
6691
  ...commonProps,
6455
6692
  children
6456
6693
  });
@@ -6499,7 +6736,8 @@ function tableControlIndexColumn({ render, ...otherProps } = {}) {
6499
6736
  * @param overrides Column properties used to display the actions of each row.
6500
6737
  * @returns Table control column used to display the actions of each row.
6501
6738
  */
6502
- function tableControlActionsColumn({ removeRowLabel, showRowRemovalConfirmation, onConfirmRowRemoval, onRowRemoved, confirmRowRemovalDialogTitle, confirmRowRemovalDialogMessage, confirmRowRemovalDialogOkText, confirmRowRemovalDialogCancelText, removeRowProps, render, ...otherProps } = {}) {
6739
+ function tableControlActionsColumn({ removeRowLabel, showRowRemovalConfirmation, onConfirmRowRemoval, onRowRemoved, confirmRowRemovalDialogMessage, removeRowProps, render, actionsProps, ...otherProps } = {}) {
6740
+ const [confirmRowRemovalDialogProps, columnProps] = extractConfirmDialogOptions(otherProps, "confirmRowRemovalDialog", "confirmDialog");
6503
6741
  return {
6504
6742
  label: /* @__PURE__ */ jsx(TableControlActionsColumnLabel, {}),
6505
6743
  sticky: "right",
@@ -6508,18 +6746,32 @@ function tableControlActionsColumn({ removeRowLabel, showRowRemovalConfirmation,
6508
6746
  align: "center",
6509
6747
  showWhilePrinting: false,
6510
6748
  showWhenReadOnly: false,
6511
- render: render ?? /* @__PURE__ */ jsx(TableControlRemoveRowTrigger, {
6512
- label: removeRowLabel,
6513
- showConfirmation: showRowRemovalConfirmation,
6514
- onConfirmRowRemoval,
6515
- onRowRemoved,
6516
- confirmDialogTitle: confirmRowRemovalDialogTitle,
6517
- confirmDialogMessage: confirmRowRemovalDialogMessage,
6518
- confirmDialogOkText: confirmRowRemovalDialogOkText,
6519
- confirmDialogCancelText: confirmRowRemovalDialogCancelText,
6520
- ...removeRowProps
6521
- }),
6522
- ...otherProps
6749
+ render: (...args) => {
6750
+ const removeRowTrigger = /* @__PURE__ */ jsx(TableControlRemoveRowTrigger, {
6751
+ label: removeRowLabel,
6752
+ showConfirmation: showRowRemovalConfirmation,
6753
+ onConfirmRowRemoval,
6754
+ onRowRemoved,
6755
+ confirmDialogMessage: confirmRowRemovalDialogMessage,
6756
+ ...confirmRowRemovalDialogProps,
6757
+ ...removeRowProps
6758
+ });
6759
+ return render ? /* @__PURE__ */ jsx(Actions, {
6760
+ primaryLayout: "icon",
6761
+ secondaryLayout: "dropdown",
6762
+ gap: 1,
6763
+ ...actionsProps,
6764
+ containerProps: {
6765
+ ...actionsProps?.containerProps,
6766
+ style: {
6767
+ justifyContent: "center",
6768
+ ...actionsProps?.containerProps?.style
6769
+ }
6770
+ },
6771
+ children: typeof render === "function" ? render(...args) : render
6772
+ }) : removeRowTrigger;
6773
+ },
6774
+ ...columnProps
6523
6775
  };
6524
6776
  }
6525
6777
  //#endregion
@@ -6556,6 +6808,7 @@ function TableControlAddRowTrigger({ disableWhileAdding, onRowAdded, preferRight
6556
6808
  const controlIsDisabled = useFormIsDisabled();
6557
6809
  const controlIsReadOnly = useFormIsReadOnly();
6558
6810
  const setLatestInteraction = useSetLatestInteraction();
6811
+ const actionsContext = useActionsContext();
6559
6812
  const gettingRowValue = controller.useState((state) => state.gettingRowValue);
6560
6813
  const [adding, setAdding] = useState(false);
6561
6814
  const handleClick = async () => {
@@ -6578,14 +6831,18 @@ function TableControlAddRowTrigger({ disableWhileAdding, onRowAdded, preferRight
6578
6831
  };
6579
6832
  if (children === void 0) {
6580
6833
  const { defaultButtonText, label = defaultButtonText ?? locale.TableControlAddRowTrigger.label, ...buttonProps } = otherProps;
6581
- return /* @__PURE__ */ jsx(Button, {
6834
+ return /* @__PURE__ */ jsx(Action, {
6835
+ layout: actionsContext ? void 0 : {
6836
+ xs: "vertical",
6837
+ sm: "horizontal"
6838
+ },
6839
+ label,
6582
6840
  icon: faPlus,
6583
6841
  color: "primary",
6584
6842
  loading: gettingRowValue || adding && disableWhileAdding,
6585
6843
  showSpinner: adding && !disableWhileAdding,
6586
6844
  ...buttonProps,
6587
- ...commonProps,
6588
- children: label
6845
+ ...commonProps
6589
6846
  });
6590
6847
  }
6591
6848
  return /* @__PURE__ */ jsx(Slot, {
@@ -6603,7 +6860,9 @@ function useTableControlApiRef() {
6603
6860
  //#endregion
6604
6861
  //#region src/components/TableControl/TableControlContent.tsx
6605
6862
  /** Component containing the content of the table control. */
6606
- function TableControlContent({ scrollableProps, ...otherProps }) {
6863
+ function TableControlContent({ emptyMessage, scrollableProps, ...otherProps }) {
6864
+ const [locale] = useLocale();
6865
+ emptyMessage ??= locale.TableControlContent.emptyMessage;
6607
6866
  const { autofocusRef, handleFocus, controller, debug } = useTableControlContext();
6608
6867
  const printing = usePrinting();
6609
6868
  const absolutePath = controller.usePath();
@@ -6619,6 +6878,7 @@ function TableControlContent({ scrollableProps, ...otherProps }) {
6619
6878
  editable: true,
6620
6879
  variant: "control",
6621
6880
  status: printing ? void 0 : displayStatusToControlStatus(deferredDisplayStatus),
6881
+ emptyMessage,
6622
6882
  scrollableProps: {
6623
6883
  onFocus: combineEventHandlers(scrollableProps?.onFocus, handleFocus),
6624
6884
  onBlur: combineEventHandlers(scrollableProps?.onBlur, handleContainerOnBlur),
@@ -6685,7 +6945,7 @@ function TextControl({ path, issueMessages, issuesPanelLabel, displayIssues = tr
6685
6945
  formManager,
6686
6946
  onInitialized,
6687
6947
  onFormManagerEvent,
6688
- onValueChange,
6948
+ onValueChange: combineEventHandlers(onValueChange, useResetOnChangeContext()),
6689
6949
  onValidationStatusChange,
6690
6950
  onDisplayStatusChange,
6691
6951
  onDirtyStatusChange,
@@ -6784,118 +7044,22 @@ function ValidateAction({ label, keybinds, showWhenReadOnly, loading, disabled,
6784
7044
  target: formAppEl,
6785
7045
  preventDefault: true
6786
7046
  });
6787
- return showAction && /* @__PURE__ */ jsx(Button, {
7047
+ const { secondary } = useActionsContext() ?? {};
7048
+ return showAction && /* @__PURE__ */ jsx(Action, {
7049
+ layout: secondary ? void 0 : "vertical",
7050
+ label,
7051
+ variant: "solid",
6788
7052
  color: "primary",
6789
7053
  icon: faCircleCheck$1,
6790
- vertical: true,
6791
7054
  ...otherProps,
6792
7055
  onClick: combineEventHandlers(validate, onClick),
6793
7056
  disabled: showDisabled,
6794
7057
  loading: showLoading,
6795
7058
  showSpinner: deferredValidatingAutomatically,
6796
- keybinds,
6797
- children: label
7059
+ keybinds
6798
7060
  });
6799
7061
  }
6800
7062
  //#endregion
6801
- //#region src/utils/useResetOnChange.tsx
6802
- var ALWAYS_RESET = () => true;
6803
- /**
6804
- * Hook which returns an `onValueChange` event handler which resets the fields
6805
- * at the provided `toReset` paths to their initial value when the value changes
6806
- * (according to the `when` function).
6807
- *
6808
- * Optionally requests user-confirmation via dialog if `confirmation` is
6809
- * provided.
6810
- *
6811
- * When using wildcards in `toReset`, certain fields may be excluded via
6812
- * `exclude`.
6813
- *
6814
- * Example usage:
6815
- *
6816
- * ```tsx
6817
- * function NoTransactionsControl() {
6818
- * const handleOnChange = useResetOnChange("/transactions/*", {
6819
- * when: ({ value }) => value,
6820
- * confirmation: {
6821
- * title: "Confirm no transactions",
6822
- * message: (
6823
- * <>
6824
- * By checking this box, all fields in section “Transactions” will
6825
- * be cleared. Are you sure you want to continue?
6826
- * </>
6827
- * ),
6828
- * okText: "Confirm",
6829
- * },
6830
- * });
6831
- *
6832
- * return (
6833
- * <CheckboxControl
6834
- * path="noTransactions"
6835
- * onValueChange={handleOnChange}
6836
- * />
6837
- * );
6838
- * }
6839
- * ```
6840
- *
6841
- * @param toReset Paths to reset up when the value changes (relative to the
6842
- * current path). Wildcards in paths (`*` or `**`) are supported.
6843
- * @param options Hook options. See {@link UseResetOnChangeOptions}.
6844
- */
6845
- function useResetOnChange(toReset, { when = ALWAYS_RESET, exclude, confirmation, setUntouched = true, setPristine = true } = {}) {
6846
- const { confirm } = useAlertDialog();
6847
- const formManager = useFormManager();
6848
- const currentPath = useCurrentPath();
6849
- const resettingValue = useRef(false);
6850
- const handleValueChange = async (event) => {
6851
- if (!resettingValue.current && when(event)) {
6852
- let resolvedToReset = (Array.isArray(toReset) ? toReset : [toReset]).map((path) => currentPath.resolve(path));
6853
- if (exclude) {
6854
- const resolvedExclude = (Array.isArray(exclude) ? exclude : [exclude]).map((path) => currentPath.resolve(path));
6855
- resolvedToReset = excludePaths(formManager, resolvedToReset, resolvedExclude);
6856
- }
6857
- if (confirmation) {
6858
- const { message, ...confirmOptions } = confirmation;
6859
- if (await someIsDirty(formManager, resolvedToReset) && !await confirm(message, {
6860
- color: "warning",
6861
- ...confirmOptions
6862
- })) {
6863
- resettingValue.current = true;
6864
- formManager.set(event.path, event.oldValue).finally(() => resettingValue.current = false);
6865
- return;
6866
- }
6867
- }
6868
- await resetAll(formManager, resolvedToReset, setUntouched, setPristine);
6869
- }
6870
- };
6871
- return (event) => void handleValueChange(event);
6872
- }
6873
- /**
6874
- * Returns an "expanded" (without wildcards) list of all paths in `path` that
6875
- * **do not** match those in `toExclude`.
6876
- */
6877
- function excludePaths(formManager, paths, exclude) {
6878
- return paths.flatMap((path) => Array.from(formManager.schemaInfo(path)).map((info) => info.path)).filter((path) => !exclude.some((toIgnore) => path.matches(toIgnore)));
6879
- }
6880
- /**
6881
- * Returns a promise that resolves with whether at least one of the provided
6882
- * paths is dirty.
6883
- */
6884
- async function someIsDirty(formManager, paths) {
6885
- return (await Promise.all(paths.map((path) => formManager.isDirty(path)))).some((isDirty) => isDirty);
6886
- }
6887
- /**
6888
- * Resets all the provided paths by calling `reset`, `setPristine` and
6889
- * `setUntouched` on them.
6890
- */
6891
- async function resetAll(formManager, toReset, setPristine, setUntouched) {
6892
- await Promise.all(toReset.flatMap((path) => [
6893
- formManager.reset(path),
6894
- setPristine && formManager.setPristine(path),
6895
- setUntouched && formManager.setUntouched(path)
6896
- ]));
6897
- }
6898
- //#endregion
6899
- export { ActivePathContext, ActivePathProvider, Annex, AnnexRegistrar, Annexes, AnnexesManager, CheckboxControl, CheckboxGroupControl, CheckboxGroupControlItem, ControlField, DEFAULT_FIRST_ISSUE_KEYBINDS, DEFAULT_FOCUS_KEYBINDS, DEFAULT_LAST_ISSUE_KEYBINDS, DEFAULT_LOAD_KEYBINDS, DEFAULT_NEXT_ISSUE_KEYBINDS, DEFAULT_PREVIOUS_ISSUE_KEYBINDS, DEFAULT_PRINT_KEYBINDS, DEFAULT_SAVE_AS_KEYBINDS, DEFAULT_SAVE_KEYBINDS, DEFAULT_SUBMIT_KEYBINDS, DEFAULT_VALIDATE_KEYBINDS, DateControl, DateRangeControl, DebugInfo, DebugInfoControlAddonTrigger, FileControl, FormApp, FormAppIssueMessages, FormAppStatus, FormPage, FormPageRegistrar, FormPages, FormPagesNavigation, FormStep, FormStepContent, FormStepList, FormStepRegistrar, FormStepper, FormStepperFinishTrigger, FormStepperNextTrigger, FormStepperPreviousTrigger, IssueMessages, IssuesAlert, IssuesPanel, IssuesPopover, LoadAction, LocalizationContext, LocalizationProvider, NumericControl, PathLink, PrefixSuffixContext, PrefixSuffixProvider, PrintAction, RadioGroupControl, RadioGroupControlItem, RepetitiveAnnexRegistrar, SaveAction, SelectControl, SelectControlItem, SelectControlItemGroup, SelectMultipleControl, SelectMultipleControlItem, SelectMultipleControlItemGroup, SubmitAction, TableControl, TableControlActionsColumn, TableControlAddRowTrigger, TableControlCellRenderer, TableControlColumn, TableControlColumnGroup, TableControlColumns, TableControlContent, TableControlIndexColumn, TableControlPagination, TableControlRemoveRowTrigger, TableControlRowsPerPage, TextControl, TopBar, TopBarActions, ValidateAction, displayStatusToColor, displayStatusToControlStatus, locale as enGB, locale$1 as enUS, locale$2 as fr, locale$2 as frFR, locale$3 as pt, locale$3 as ptPT, setDefaultPrefixSuffix, tableControlActionsColumn, tableControlIndexColumn, useActiveIssuesPanelBreadcrumb, useActivePathContext, useControlIssues, useDisplayIssueCodesInIssueMessages, useFocus, useFormAppElement, useFormInDebugMode, useFormIsDisabled, useFormIsLoading, useFormIsReadOnly, useFormIsSaving, useFormIsValidating, useFormLoader, useFormSaver, useFormTitle, useFormValidator, useIsInControlField, useIsRegistered, useIssuesDisplayMode, useLocale, useOnPathFocus, usePrefix, useRegisterControl, useRegisterController, useRegisterControllerWithinControlField, useRegisterIssueMessages, useRegisterLabel, useRegisteredIssueMessage, useResetFocus, useResetOnChange, useSetBottomPanelHeight, useSetLeftSidebarWidth, useSetTopBarHeight, useStartIssuesNavigation, useTableControlApiRef, useTopBarElement };
7063
+ export { ActivePathContext, ActivePathProvider, Annex, AnnexRegistrar, Annexes, AnnexesManager, CheckboxControl, CheckboxGroupControl, CheckboxGroupControlItem, ControlField, DEFAULT_FIRST_ISSUE_KEYBINDS, DEFAULT_FOCUS_KEYBINDS, DEFAULT_LAST_ISSUE_KEYBINDS, DEFAULT_LOAD_KEYBINDS, DEFAULT_NEXT_ISSUE_KEYBINDS, DEFAULT_PREVIOUS_ISSUE_KEYBINDS, DEFAULT_PRINT_KEYBINDS, DEFAULT_SAVE_AS_KEYBINDS, DEFAULT_SAVE_KEYBINDS, DEFAULT_SUBMIT_KEYBINDS, DEFAULT_VALIDATE_KEYBINDS, DateControl, DateRangeControl, DebugInfo, DebugInfoControlAddonTrigger, FileControl, FormApp, FormAppIssueMessages, FormAppStatus, FormPage, FormPageRegistrar, FormPages, FormPagesNavigation, FormStep, FormStepContent, FormStepList, FormStepRegistrar, FormStepper, FormStepperFinishTrigger, FormStepperNextTrigger, FormStepperPreviousTrigger, IssueMessages, IssuesAlert, IssuesPanel, IssuesPopover, LoadAction, LocalizationContext, LocalizationProvider, NumericControl, PathLink, PrefixSuffixContext, PrefixSuffixProvider, PrintAction, RadioGroupControl, RadioGroupControlItem, RepetitiveAnnexRegistrar, ResetOnChange, SaveAction, SelectControl, SelectControlItem, SelectControlItemGroup, SelectMultipleControl, SelectMultipleControlItem, SelectMultipleControlItemGroup, SubmitAction, TableControl, TableControlActionsColumn, TableControlAddRowTrigger, TableControlCellRenderer, TableControlColumn, TableControlColumnGroup, TableControlColumns, TableControlContent, TableControlIndexColumn, TableControlPagination, TableControlRemoveRowTrigger, TableControlRowsPerPage, TextControl, TopBar, TopBarActions, TopBarActionsSecondary, ValidateAction, displayStatusToColor, displayStatusToControlStatus, locale as enGB, locale$1 as enUS, locale$2 as fr, locale$2 as frFR, locale$3 as pt, locale$3 as ptPT, setDefaultPrefixSuffix, tableControlActionsColumn, tableControlIndexColumn, useActiveIssuesPanelBreadcrumb, useActivePathContext, useControlIssues, useDisplayIssueCodesInIssueMessages, useFocus, useFormAppElement, useFormInDebugMode, useFormIsDisabled, useFormIsLoading, useFormIsReadOnly, useFormIsSaving, useFormIsValidating, useFormLoader, useFormSaver, useFormTitle, useFormValidator, useIsInControlField, useIsRegistered, useIssuesDisplayMode, useLocale, useOnPathFocus, usePrefix, useRegisterControl, useRegisterController, useRegisterControllerWithinControlField, useRegisterIssueMessages, useRegisterLabel, useRegisteredIssueMessage, useResetFocus, useResetOnChange, useResetOnChangeContext, useSetBottomPanelHeight, useSetLeftSidebarWidth, useSetTopBarHeight, useStartIssuesNavigation, useTableControlApiRef, useTopBarElement };
6900
7064
 
6901
7065
  //# sourceMappingURL=ostack-ui-kform.js.map