@ostack.tech/ui-kform 1.0.0-rc.1 → 1.0.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.
@@ -771,6 +771,11 @@
771
771
  .o-ui-kform-top-bar .o-ui-kform-annexes__tab:focus-visible:not(:disabled):not([data-disabled])[data-status] {
772
772
  box-shadow: inset -1px 0 0 0 #1c2024, inset 1px 0 0 0 #1c2024, inset 0 -2px 0 #1c2024;
773
773
  }
774
+ .o-ui-kform-top-bar__global-issues-container {
775
+ align-self: stretch;
776
+ margin-right: var(--o-ui-space);
777
+ padding-top: calc(var(--o-ui-space) * 0.5);
778
+ }
774
779
  .o-ui-kform-top-bar__actions-container {
775
780
  align-self: stretch;
776
781
  margin: 0 0 var(--o-ui-space) auto;
@@ -1,5 +1,5 @@
1
1
  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";
2
- 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, useIsInFeedbackProvider, 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";
2
+ 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, 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, useIsInFeedbackProvider, 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";
3
3
  import { Children, Fragment, Suspense, createContext, isValidElement, startTransition, useCallback, useContext, useDeferredValue, useEffect, useEffectEvent, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
4
4
  import { createStore, useStore } from "zustand";
5
5
  import { useShallow } from "zustand/react/shallow";
@@ -1543,107 +1543,6 @@ function useReportValidationFailures(info) {
1543
1543
  }, [info, reportError]);
1544
1544
  }
1545
1545
  //#endregion
1546
- //#region src/components/ControlField/ControlFieldContext.ts
1547
- /** Control field context. */
1548
- var ControlFieldContext = createContext(null);
1549
- /** Hook which creates the control field context value. */
1550
- function useCreateControlFieldContext() {
1551
- return useConstant(() => createStore(() => ({ controlStates: {} })));
1552
- }
1553
- /** Hook returning the control field's context value. */
1554
- function useControlFieldContext() {
1555
- return useContext(ControlFieldContext);
1556
- }
1557
- /** Hook that returns access to the control field's store. */
1558
- function useControlFieldStore(selector) {
1559
- return useStore(useControlFieldContext() ?? EMPTY_STORE, selector);
1560
- }
1561
- /** Hook exposing whether a component is being rendered within a control field. */
1562
- function useIsInControlField() {
1563
- return useControlFieldContext() !== null;
1564
- }
1565
- /**
1566
- * Hook that makes a control field aware of a controller.
1567
- *
1568
- * The passed `controller` object should not be different on every render.
1569
- */
1570
- function useRegisterControllerWithinControlField(controller, deferredIssuesToDisplay) {
1571
- const store = useControlFieldContext();
1572
- const formManager = controller.useFormManager();
1573
- const path = controller.usePath();
1574
- const schema = controller.useSchema();
1575
- const exists = controller.useState((state) => state.initialized && state.exists);
1576
- useEffect(() => {
1577
- if (store) {
1578
- const pathStr = path.toString();
1579
- store.setState((state) => ({ controlStates: {
1580
- ...state.controlStates,
1581
- [pathStr]: {
1582
- formManager,
1583
- schema,
1584
- path,
1585
- exists,
1586
- deferredIssuesToDisplay
1587
- }
1588
- } }));
1589
- return () => {
1590
- store.setState(({ controlStates: { [pathStr]: _, ...controlStates } }) => ({ controlStates }));
1591
- };
1592
- }
1593
- }, [
1594
- deferredIssuesToDisplay,
1595
- exists,
1596
- formManager,
1597
- path,
1598
- schema,
1599
- store
1600
- ]);
1601
- }
1602
- //#endregion
1603
- //#region src/components/ControlField/ControlField.tsx
1604
- /**
1605
- * Component used to group controls with a label, helper text, and/or feedback.
1606
- *
1607
- * The component can be conditionally shown via the `shown` property which, by
1608
- * default, when changing from `true` to `false` will reset its inner controls.
1609
- *
1610
- * Added labels automatically "point" to the control and are set to "required"
1611
- * when requested by the control.
1612
- *
1613
- * Aria descriptions and error messages are set on the control based on the
1614
- * provided helper texts or feedbacks.
1615
- */
1616
- function ControlField({ path = Path.CURRENT, shown = true, resetOnHide = true, setUntouchedOnHide = resetOnHide, setPristineOnHide = resetOnHide, ...otherProps }) {
1617
- const formManager = useFormManager();
1618
- const store = useCreateControlFieldContext();
1619
- const controlStates = useStore(store, (state) => state.controlStates);
1620
- useEffect(() => {
1621
- if (!shown) for (const controlState of Object.values(controlStates)) {
1622
- const { formManager, path, exists } = controlState;
1623
- if (exists) {
1624
- if (resetOnHide) formManager.reset(path);
1625
- if (setUntouchedOnHide) formManager.setUntouched(path);
1626
- if (setPristineOnHide) formManager.setPristine(path);
1627
- }
1628
- }
1629
- }, [
1630
- controlStates,
1631
- formManager,
1632
- resetOnHide,
1633
- setPristineOnHide,
1634
- setUntouchedOnHide,
1635
- shown,
1636
- store
1637
- ]);
1638
- return shown && /* @__PURE__ */ jsx(CurrentPath, {
1639
- path,
1640
- children: /* @__PURE__ */ jsx(ControlFieldContext.Provider, {
1641
- value: store,
1642
- children: /* @__PURE__ */ jsx(Field, { ...otherProps })
1643
- })
1644
- });
1645
- }
1646
- //#endregion
1647
1546
  //#region src/components/IssueMessages/IssueMessages.tsx
1648
1547
  /**
1649
1548
  * Component used to display all issues associated with the relevant path.
@@ -1658,36 +1557,29 @@ function ControlField({ path = Path.CURRENT, shown = true, resetOnHide = true, s
1658
1557
  * If `path` contains an issue without an associated issue message, a generic
1659
1558
  * message is displayed together with a console warning.
1660
1559
  */
1661
- function IssueMessages({ path, issues, messages, displayIssueCodes, messagesDataKey, visuallyHiddenErrorCodePrefix, visuallyHiddenWarningCodePrefix, unknownErrorMessage, unknownWarningMessage, unwrapped, ...otherProps }) {
1560
+ function IssueMessages({ path, issues, schema, messages, displayIssueCodes, messagesDataKey, visuallyHiddenErrorCodePrefix, visuallyHiddenWarningCodePrefix, unknownErrorMessage, unknownWarningMessage, unwrapped, ...otherProps }) {
1662
1561
  const prefix = usePrefix();
1663
- const isInControlField = useIsInControlField();
1664
1562
  const formManager = useFormManager();
1665
1563
  const absolutePath = useResolvedPath(path);
1666
- const { info } = useIssuesTracker(absolutePath, { enabled: !issues && !isInControlField });
1564
+ const { info } = useIssuesTracker(absolutePath, { enabled: !issues });
1667
1565
  const messagesToRegister = useMemo(() => messages && { [absolutePath.toString()]: messages }, [absolutePath, messages]);
1668
- const relevantControlState = useControlFieldStore((state) => isInControlField ? state.controlStates?.[absolutePath.toString()] : null);
1669
1566
  const deferredTrackedIssues = useDeferredValue(useMemo(() => info?.flatMap((info) => info.issues) ?? [], [info]));
1670
- const deferredIssuesToDisplay = useMemo(() => issues ?? (isInControlField ? relevantControlState?.deferredIssuesToDisplay ?? [] : deferredTrackedIssues), [
1671
- deferredTrackedIssues,
1672
- isInControlField,
1673
- issues,
1674
- relevantControlState?.deferredIssuesToDisplay
1675
- ]);
1567
+ const deferredIssuesToDisplay = issues ?? deferredTrackedIssues;
1676
1568
  useReportValidationFailures(useMemo(() => [{
1677
1569
  path: absolutePath,
1678
1570
  issues: deferredIssuesToDisplay
1679
1571
  }], [absolutePath, deferredIssuesToDisplay]));
1680
- const schema = useMemo(() => relevantControlState?.schema ?? formManager.schema(absolutePath), [
1572
+ const actualSchema = useMemo(() => schema ?? formManager.schema(absolutePath), [
1681
1573
  absolutePath,
1682
1574
  formManager,
1683
- relevantControlState?.schema
1575
+ schema
1684
1576
  ]);
1685
1577
  const feedbackNodes = useMemo(() => deferredIssuesToDisplay.map((issue, i) => /* @__PURE__ */ jsx(Feedback, {
1686
1578
  type: issue.severity,
1687
1579
  children: /* @__PURE__ */ jsx(IssueMessage, {
1688
1580
  path: absolutePath,
1689
1581
  issue,
1690
- schema,
1582
+ schema: actualSchema,
1691
1583
  displayIssueCode: displayIssueCodes,
1692
1584
  messageDataKey: messagesDataKey,
1693
1585
  visuallyHiddenErrorCodePrefix,
@@ -1699,7 +1591,7 @@ function IssueMessages({ path, issues, messages, displayIssueCodes, messagesData
1699
1591
  }, i)), [
1700
1592
  deferredIssuesToDisplay,
1701
1593
  absolutePath,
1702
- schema,
1594
+ actualSchema,
1703
1595
  displayIssueCodes,
1704
1596
  messagesDataKey,
1705
1597
  visuallyHiddenErrorCodePrefix,
@@ -1783,10 +1675,11 @@ function useTopBarElement() {
1783
1675
  //#endregion
1784
1676
  //#region src/components/TopBar/TopBar.tsx
1785
1677
  /** Top bar component. */
1786
- function TopBar({ className, ref, ...otherProps }) {
1678
+ function TopBar({ className, ref, children, globalIssuesProps, ...otherProps }) {
1787
1679
  const prefix = usePrefix();
1788
1680
  const { printHidden } = usePrintClassNames();
1789
1681
  const setTopBarHeight = useSetTopBarHeight();
1682
+ const issuesDisplayMode = useIssuesDisplayMode();
1790
1683
  const [topBarEl, setTopBarEl] = useState(null);
1791
1684
  useMeasure(topBarEl, useCallback((measurement) => setTopBarHeight(measurement?.height), [setTopBarHeight]));
1792
1685
  const combinedTopBarRef = useCombinedRef(setTopBarEl, ref);
@@ -1794,10 +1687,18 @@ function TopBar({ className, ref, ...otherProps }) {
1794
1687
  value: { topBarEl },
1795
1688
  children: /* @__PURE__ */ jsx(Layer, {
1796
1689
  zIndex: "sticky",
1797
- children: /* @__PURE__ */ jsx("div", {
1690
+ children: /* @__PURE__ */ jsxs("div", {
1798
1691
  className: cx(prefix("top-bar"), printHidden, className),
1799
1692
  ...otherProps,
1800
- ref: combinedTopBarRef
1693
+ ref: combinedTopBarRef,
1694
+ children: [issuesDisplayMode === "inline" && /* @__PURE__ */ jsx(IssuesPopover, {
1695
+ ...globalIssuesProps,
1696
+ buttonContainerProps: {
1697
+ ...globalIssuesProps?.buttonContainerProps,
1698
+ className: cx(prefix("top-bar__global-issues-container"), globalIssuesProps?.buttonContainerProps?.className)
1699
+ },
1700
+ children: /* @__PURE__ */ jsx(IssueMessages, {})
1701
+ }), children]
1801
1702
  })
1802
1703
  })
1803
1704
  });
@@ -1805,10 +1706,9 @@ function TopBar({ className, ref, ...otherProps }) {
1805
1706
  //#endregion
1806
1707
  //#region src/components/TopBar/TopBarActions.tsx
1807
1708
  /** Container of the top bar actions. */
1808
- function TopBarActions({ className, containerProps, children, ...otherProps }) {
1709
+ function TopBarActions({ className, containerProps, ...otherProps }) {
1809
1710
  const prefix = usePrefix();
1810
- const issuesDisplayMode = useIssuesDisplayMode();
1811
- return /* @__PURE__ */ jsxs(Actions, {
1711
+ return /* @__PURE__ */ jsx(Actions, {
1812
1712
  className: cx(prefix("top-bar__actions"), className),
1813
1713
  primaryLayout: {
1814
1714
  xs: ["horizontal", "vertical"],
@@ -1822,8 +1722,7 @@ function TopBarActions({ className, containerProps, children, ...otherProps }) {
1822
1722
  ...containerProps,
1823
1723
  className: cx(prefix("top-bar__actions-container"), containerProps?.className)
1824
1724
  },
1825
- ...otherProps,
1826
- children: [issuesDisplayMode === "inline" && /* @__PURE__ */ jsx(IssuesPopover, { children: /* @__PURE__ */ jsx(IssueMessages, {}) }), children]
1725
+ ...otherProps
1827
1726
  });
1828
1727
  }
1829
1728
  //#endregion
@@ -2080,6 +1979,7 @@ function AnnexTab({ path }) {
2080
1979
  const issuesDisplayMode = useIssuesDisplayMode();
2081
1980
  const deferredIssuesToDisplay = useAnnexState(path, useShallow((state) => state?.deferredIssuesToDisplay ?? []));
2082
1981
  const hasIssues = deferredIssuesToDisplay.length > 0;
1982
+ const schema = useAnnexState(path, (state) => state?.schema);
2083
1983
  const deferredDisplayStatus = useAnnexState(path, (state) => state?.deferredDisplayStatus);
2084
1984
  const title = useAnnexState(path, (state) => state?.title);
2085
1985
  const subtitle = useAnnexState(path, (state) => state?.subtitle);
@@ -2130,6 +2030,7 @@ function AnnexTab({ path }) {
2130
2030
  hidden: true,
2131
2031
  id: issueMessagesId,
2132
2032
  path,
2033
+ schema,
2133
2034
  issues: deferredIssuesToDisplay
2134
2035
  }),
2135
2036
  issuesDisplayMode === "inline" && /* @__PURE__ */ jsx(IssuesPopover, {
@@ -2229,6 +2130,7 @@ function AnnexesManager({ showMenu, menuButtonText, menuButtonLabel, addAnnexTex
2229
2130
  hidden: issuesDisplayMode === "panel",
2230
2131
  children: tablessStates.map((state, i) => /* @__PURE__ */ jsx(IssueMessages, {
2231
2132
  path: state.path,
2133
+ schema: state.schema,
2232
2134
  issues: deferredTablessIssuesToDisplay[i] ?? [],
2233
2135
  unwrapped: true
2234
2136
  }, state.path.toString()))
@@ -2292,7 +2194,7 @@ function AnnexesManager({ showMenu, menuButtonText, menuButtonLabel, addAnnexTex
2292
2194
  //#endregion
2293
2195
  //#region src/utils/useControlIssues.tsx
2294
2196
  /** Hook which helps a control component render its issues. */
2295
- function useControlIssues({ issuesToDisplay, issueMessages, displayIssues = true, issueMessagesProps, variant }) {
2197
+ function useControlIssues({ issuesToDisplay, issueMessages, schemas, displayIssues = true, issueMessagesProps, variant }) {
2296
2198
  const issuesDisplayMode = useIssuesDisplayMode();
2297
2199
  const isInTableCell = useIsInTableCell();
2298
2200
  const showInPopover = variant === "cell" || variant === void 0 && isInTableCell;
@@ -2302,8 +2204,9 @@ function useControlIssues({ issuesToDisplay, issueMessages, displayIssues = true
2302
2204
  hidden: issuesDisplayMode === "panel",
2303
2205
  children: Object.entries(issuesToDisplay).map(([path, issues], i) => /* @__PURE__ */ jsx(IssueMessages, {
2304
2206
  path,
2207
+ schema: schemas[path],
2305
2208
  issues,
2306
- messages: issueMessages?.[path],
2209
+ messages: issueMessages[path],
2307
2210
  displayIssueCodes,
2308
2211
  unknownErrorMessage,
2309
2212
  unknownWarningMessage,
@@ -2339,7 +2242,6 @@ function useRegisterControl({ controller, issuesPanelLabel, ariaLabel, issuesPan
2339
2242
  const columnLabel = useDataTableColumnLabel();
2340
2243
  useRegisterLabel(path, issuesPanelLabel || columnLabel || ariaLabel, issuesPanelLabel ? 1 : -1);
2341
2244
  useRegisterFieldLabel(path, issuesPanelLabelSuffix);
2342
- useRegisterControllerWithinControlField(controller, issuesToDisplay);
2343
2245
  useRegisterController(controller);
2344
2246
  useImperativeHandle(apiRef, () => controller, [controller]);
2345
2247
  const autofocusRef = useControlAutofocus(controller, !preventAutoFocus && !printing);
@@ -2740,9 +2642,11 @@ function CheckboxControl({ path, issueMessages, issuesPanelLabel, displayIssues
2740
2642
  apiRef
2741
2643
  });
2742
2644
  if (schema.typeInfo.name !== "Boolean") throw new InvalidPathError(absolutePath, `Unsupported schema: Expected schema representing (possibly nullable) booleans, but got schema representing values of type '${schema.typeInfo.toString()}'.`);
2645
+ const absolutePathStr = absolutePath.toString();
2743
2646
  const { inlineIssues, popoverIssues } = useControlIssues({
2744
- issuesToDisplay: { [absolutePath.toString()]: issuesToDisplay },
2745
- issueMessages: { [absolutePath.toString()]: issueMessages },
2647
+ issuesToDisplay: { [absolutePathStr]: issuesToDisplay },
2648
+ issueMessages: { [absolutePathStr]: issueMessages },
2649
+ schemas: { [absolutePathStr]: schema },
2746
2650
  displayIssues,
2747
2651
  issueMessagesProps,
2748
2652
  variant: otherProps.variant
@@ -2982,9 +2886,11 @@ function CheckboxGroupControl({ path, options, issueMessages, issuesPanelLabel,
2982
2886
  schema,
2983
2887
  unknownValues
2984
2888
  ]);
2889
+ const absolutePathStr = absolutePath.toString();
2985
2890
  const { inlineIssues, popoverIssues } = useControlIssues({
2986
- issuesToDisplay: { [absolutePath.toString()]: issuesToDisplay },
2987
- issueMessages: { [absolutePath.toString()]: issueMessages },
2891
+ issuesToDisplay: { [absolutePathStr]: issuesToDisplay },
2892
+ issueMessages: { [absolutePathStr]: issueMessages },
2893
+ schemas: { [absolutePathStr]: schema },
2988
2894
  displayIssues,
2989
2895
  issueMessagesProps,
2990
2896
  variant: otherProps.variant
@@ -3026,6 +2932,51 @@ function CheckboxGroupControl({ path, options, issueMessages, issuesPanelLabel,
3026
2932
  }), inlineIssues] });
3027
2933
  }
3028
2934
  //#endregion
2935
+ //#region src/components/ControlField/ControlField.tsx
2936
+ /**
2937
+ * Component used to group controls with a label, helper text, and/or feedback.
2938
+ *
2939
+ * The component can be conditionally shown via the `shown` property which, by
2940
+ * default, when changing from `true` to `false` will reset its inner controls.
2941
+ *
2942
+ * Added labels automatically "point" to the control and are set to "required"
2943
+ * when requested by the control.
2944
+ *
2945
+ * Aria descriptions and error messages are set on the control based on the
2946
+ * provided helper texts or feedbacks.
2947
+ *
2948
+ * @deprecated Use the `@ostack.tech/ui` {@link Field} component instead. Set the
2949
+ * `path` on the control directly instead.
2950
+ *
2951
+ * Change from:
2952
+ *
2953
+ * ```tsx
2954
+ * <ControlField path="name">
2955
+ * <Label>Name</Label>
2956
+ * <TextControl />
2957
+ * </ControlField>;
2958
+ * ```
2959
+ *
2960
+ * To:
2961
+ *
2962
+ * ```tsx
2963
+ * <Field>
2964
+ * <Label>Name</Label>
2965
+ * <TextControl path="name" />
2966
+ * </Field>;
2967
+ * ```
2968
+ *
2969
+ * If you were using `shown` (together with `resetOnHide`), use the
2970
+ * `ResetOnChange` component or the `useResetOnChange` hook instead on the
2971
+ * control that is the cause of the reset instead.
2972
+ */
2973
+ function ControlField({ path = Path.CURRENT, ...otherProps }) {
2974
+ return /* @__PURE__ */ jsx(CurrentPath, {
2975
+ path,
2976
+ children: /* @__PURE__ */ jsx(Field, { ...otherProps })
2977
+ });
2978
+ }
2979
+ //#endregion
3029
2980
  //#region src/utils/dateRestrictions.ts
3030
2981
  /** Returns the minimum date allowed based on a temporal schema's restrictions. */
3031
2982
  function minDateRestriction(schema) {
@@ -3130,9 +3081,11 @@ function DateControl({ path, issueMessages, issuesPanelLabel, displayIssues = tr
3130
3081
  setFormattedValue(formattedValue);
3131
3082
  inputProps.onChange(formattedValue);
3132
3083
  }, [inputProps]);
3084
+ const absolutePathStr = absolutePath.toString();
3133
3085
  const { inlineIssues, popoverIssues } = useControlIssues({
3134
- issuesToDisplay: { [absolutePath.toString()]: issuesToDisplay },
3135
- issueMessages: { [absolutePath.toString()]: issueMessages },
3086
+ issuesToDisplay: { [absolutePathStr]: issuesToDisplay },
3087
+ issueMessages: { [absolutePathStr]: issueMessages },
3088
+ schemas: { [absolutePathStr]: schema },
3136
3089
  displayIssues,
3137
3090
  issueMessagesProps,
3138
3091
  variant: otherProps.variant
@@ -3275,14 +3228,20 @@ function DateRangeControl({ startPath, endPath, startIssueMessages, endIssueMess
3275
3228
  formattedValue.start,
3276
3229
  startControllerInputProps
3277
3230
  ]);
3231
+ const startAbsolutePathStr = startAbsolutePath.toString();
3232
+ const endAbsolutePathStr = endAbsolutePath.toString();
3278
3233
  const { inlineIssues, popoverIssues } = useControlIssues({
3279
3234
  issuesToDisplay: {
3280
- [startAbsolutePath.toString()]: startIssuesToDisplay,
3281
- [endAbsolutePath.toString()]: endIssuesToDisplay
3235
+ [startAbsolutePathStr]: startIssuesToDisplay,
3236
+ [endAbsolutePathStr]: endIssuesToDisplay
3282
3237
  },
3283
3238
  issueMessages: {
3284
- [startAbsolutePath.toString()]: startIssueMessages,
3285
- [endAbsolutePath.toString()]: endIssueMessages
3239
+ [startAbsolutePathStr]: startIssueMessages,
3240
+ [endAbsolutePathStr]: endIssueMessages
3241
+ },
3242
+ schemas: {
3243
+ [startAbsolutePathStr]: startSchema,
3244
+ [endAbsolutePathStr]: endSchema
3286
3245
  },
3287
3246
  displayIssues,
3288
3247
  issueMessagesProps,
@@ -3449,8 +3408,9 @@ function FileControl({ path, issueMessages, issuesPanelLabel, displayIssues = tr
3449
3408
  onTouchedStatusChange
3450
3409
  });
3451
3410
  const { useSchema, usePath, inputProps } = controller;
3452
- const { nullable, restrictions } = useSchema().typeInfo;
3411
+ const schema = useSchema();
3453
3412
  const absolutePath = usePath();
3413
+ const { nullable, restrictions } = schema.typeInfo;
3454
3414
  const showDebugInfo = useFormInDebugMode() || debug;
3455
3415
  const { displayLoading, displayDisabled, displayReadOnly, displayStatusToDisplay, displayValidating, issuesToDisplay, autofocusRef, handleFocus } = useRegisterControl({
3456
3416
  controller,
@@ -3475,9 +3435,11 @@ function FileControl({ path, issueMessages, issuesPanelLabel, displayIssues = tr
3475
3435
  const handleKeyDown = useCallback((evt) => {
3476
3436
  if (evt.code === "Delete" || evt.code === "Backspace") clearButtonRef.current?.click();
3477
3437
  }, []);
3438
+ const absolutePathStr = absolutePath.toString();
3478
3439
  const { inlineIssues, popoverIssues } = useControlIssues({
3479
- issuesToDisplay: { [absolutePath.toString()]: issuesToDisplay },
3480
- issueMessages: { [absolutePath.toString()]: issueMessages },
3440
+ issuesToDisplay: { [absolutePathStr]: issuesToDisplay },
3441
+ issueMessages: { [absolutePathStr]: issueMessages },
3442
+ schemas: { [absolutePathStr]: schema },
3481
3443
  displayIssues,
3482
3444
  issueMessagesProps
3483
3445
  });
@@ -3625,6 +3587,7 @@ function FormPageHeader({ helperText, helperButtonLabel, ownIssueMessages, codeP
3625
3587
  const issuesDisplayMode = useIssuesDisplayMode();
3626
3588
  const deferredIssuesToDisplay = useFormPageState(currentPath, useShallow((state) => !printing && issuesDisplayMode === "inline" && state?.deferredIssuesToDisplay || [])) ?? [];
3627
3589
  const deferredDisplayStatus = useFormPageState(currentPath, (state) => printing ? void 0 : state?.deferredDisplayStatus);
3590
+ const schema = useFormPageState(currentPath, (state) => state?.schema);
3628
3591
  const code = useFormPageState(currentPath, (state) => state?.code);
3629
3592
  const title = useFormPageState(currentPath, (state) => state?.title);
3630
3593
  const visuallyHiddenCodePrefix = useFormPageState(currentPath, (state) => state?.visuallyHiddenCodePrefix ?? locale.FormPage.visuallyHiddenCodePrefix);
@@ -3662,6 +3625,8 @@ function FormPageHeader({ helperText, helperButtonLabel, ownIssueMessages, codeP
3662
3625
  ...issuesPopoverProps?.iconButtonProps
3663
3626
  },
3664
3627
  children: /* @__PURE__ */ jsx(IssueMessages, {
3628
+ path: currentPath,
3629
+ schema,
3665
3630
  issues: deferredIssuesToDisplay,
3666
3631
  messages: ownIssueMessages,
3667
3632
  ...issueMessagesProps
@@ -3792,6 +3757,7 @@ function FormPageRegistrar({ path, title, documentTitle, code, issuesPanelLabel
3792
3757
  onInitialized: finishPrintingTask
3793
3758
  });
3794
3759
  const absolutePath = controller.usePath();
3760
+ const schema = controller.useSchema();
3795
3761
  const exists = controller.useState((state) => state.initialized && state.exists);
3796
3762
  const value = controller.useValue();
3797
3763
  const deferredValue = useDeferredValue(value);
@@ -3805,6 +3771,7 @@ function FormPageRegistrar({ path, title, documentTitle, code, issuesPanelLabel
3805
3771
  registerPageState(absolutePath, {
3806
3772
  exists,
3807
3773
  path: absolutePath,
3774
+ schema,
3808
3775
  deferredIssuesToDisplay,
3809
3776
  deferredDisplayStatus,
3810
3777
  title: actualTitle,
@@ -3819,6 +3786,7 @@ function FormPageRegistrar({ path, title, documentTitle, code, issuesPanelLabel
3819
3786
  deferredDisplayStatus,
3820
3787
  deferredIssuesToDisplay,
3821
3788
  exists,
3789
+ schema,
3822
3790
  store,
3823
3791
  title
3824
3792
  ]);
@@ -5178,11 +5146,13 @@ function NumericControl({ path, issueMessages, issuesPanelLabel, displayIssues =
5178
5146
  setStringValue(stringValue);
5179
5147
  }
5180
5148
  }, [inputProps, latestRef]);
5149
+ const absolutePathStr = absolutePath.toString();
5181
5150
  const schemaIsInteger = INTEGER_TYPES.includes(schema.typeInfo.name);
5182
- if (schemaIsInteger && valueIsInteger !== void 0) warnOnce(`NumericControl: At '${absolutePath.toString()}': Property \`valueIsInteger\` has no effect (it will always be \`true\`) when the control's schema is one of the integer types.`);
5151
+ if (schemaIsInteger && valueIsInteger !== void 0) warnOnce(`NumericControl: At '${absolutePathStr}': Property \`valueIsInteger\` has no effect (it will always be \`true\`) when the control's schema is one of the integer types.`);
5183
5152
  const { inlineIssues, popoverIssues } = useControlIssues({
5184
- issuesToDisplay: { [absolutePath.toString()]: issuesToDisplay },
5185
- issueMessages: { [absolutePath.toString()]: issueMessages },
5153
+ issuesToDisplay: { [absolutePathStr]: issuesToDisplay },
5154
+ issueMessages: { [absolutePathStr]: issueMessages },
5155
+ schemas: { [absolutePathStr]: schema },
5186
5156
  displayIssues,
5187
5157
  issueMessagesProps,
5188
5158
  variant: otherProps.variant
@@ -5438,9 +5408,11 @@ function RadioGroupControl({ path, options, issueMessages, issuesPanelLabel, dis
5438
5408
  const clearedValue = nullable ? null : schema.initialValue;
5439
5409
  const clearedIdx = useMemo(() => options.findIndex((option) => equals(option.value, clearedValue)), [clearedValue, options]);
5440
5410
  const clearedFormattedValue = clearedIdx === -1 ? "" : clearedIdx.toString();
5411
+ const absolutePathStr = absolutePath.toString();
5441
5412
  const { inlineIssues, popoverIssues } = useControlIssues({
5442
- issuesToDisplay: { [absolutePath.toString()]: issuesToDisplay },
5443
- issueMessages: { [absolutePath.toString()]: issueMessages },
5413
+ issuesToDisplay: { [absolutePathStr]: issuesToDisplay },
5414
+ issueMessages: { [absolutePathStr]: issueMessages },
5415
+ schemas: { [absolutePathStr]: schema },
5444
5416
  displayIssues,
5445
5417
  issueMessagesProps,
5446
5418
  variant: otherProps.variant
@@ -5811,9 +5783,11 @@ function SelectControl({ path, options: groupedOptions, issueMessages, issuesPan
5811
5783
  const clearedIdx = useMemo(() => options.findIndex((option) => equals(option.value, clearedValue)), [clearedValue, options]);
5812
5784
  const clearedFormattedValue = clearedIdx === -1 ? "" : clearedIdx.toString();
5813
5785
  const optionNodes = useMemo(() => selectionItemObjectsToNodes(groupedOptions), [groupedOptions]);
5786
+ const absolutePathStr = absolutePath.toString();
5814
5787
  const { inlineIssues, popoverIssues } = useControlIssues({
5815
- issuesToDisplay: { [absolutePath.toString()]: issuesToDisplay },
5816
- issueMessages: { [absolutePath.toString()]: issueMessages },
5788
+ issuesToDisplay: { [absolutePathStr]: issuesToDisplay },
5789
+ issueMessages: { [absolutePathStr]: issueMessages },
5790
+ schemas: { [absolutePathStr]: schema },
5817
5791
  displayIssues,
5818
5792
  issueMessagesProps,
5819
5793
  variant: otherProps.variant
@@ -5997,9 +5971,11 @@ function SelectMultipleControl({ path, options: groupedOptions, issueMessages, i
5997
5971
  unknownValues
5998
5972
  ]);
5999
5973
  const optionNodes = useMemo(() => selectionItemObjectsToNodes(groupedOptions), [groupedOptions]);
5974
+ const absolutePathStr = absolutePath.toString();
6000
5975
  const { inlineIssues, popoverIssues } = useControlIssues({
6001
- issuesToDisplay: { [absolutePath.toString()]: issuesToDisplay },
6002
- issueMessages: { [absolutePath.toString()]: issueMessages },
5976
+ issuesToDisplay: { [absolutePathStr]: issuesToDisplay },
5977
+ issueMessages: { [absolutePathStr]: issueMessages },
5978
+ schemas: { [absolutePathStr]: schema },
6003
5979
  displayIssues,
6004
5980
  issueMessagesProps,
6005
5981
  variant: otherProps.variant
@@ -6548,9 +6524,11 @@ function TableControl({ path, issueMessages, issuesPanelLabel, displayIssues = t
6548
6524
  ...controller,
6549
6525
  ...ownController
6550
6526
  }), [controller, ownController]);
6527
+ const absolutePathStr = absolutePath.toString();
6551
6528
  const { inlineIssues } = useControlIssues({
6552
- issuesToDisplay: { [absolutePath.toString()]: issuesToDisplay },
6553
- issueMessages: { [absolutePath.toString()]: issueMessages },
6529
+ issuesToDisplay: { [absolutePathStr]: issuesToDisplay },
6530
+ issueMessages: { [absolutePathStr]: issueMessages },
6531
+ schemas: { [absolutePathStr]: schema },
6554
6532
  displayIssues,
6555
6533
  issueMessagesProps
6556
6534
  });
@@ -6963,9 +6941,11 @@ function TextControl({ path, issueMessages, issuesPanelLabel, displayIssues = tr
6963
6941
  });
6964
6942
  const [wasMultiline] = useState(multiline);
6965
6943
  if (multiline !== wasMultiline) throw new Error("The `multiline` property cannot not be changed at runtime.");
6944
+ const absolutePathStr = absolutePath.toString();
6966
6945
  const { inlineIssues, popoverIssues } = useControlIssues({
6967
- issuesToDisplay: { [absolutePath.toString()]: issuesToDisplay },
6968
- issueMessages: { [absolutePath.toString()]: issueMessages },
6946
+ issuesToDisplay: { [absolutePathStr]: issuesToDisplay },
6947
+ issueMessages: { [absolutePathStr]: issueMessages },
6948
+ schemas: { [absolutePathStr]: schema },
6969
6949
  displayIssues,
6970
6950
  issueMessagesProps,
6971
6951
  variant: otherProps.variant
@@ -7057,6 +7037,6 @@ function ValidateAction({ label, keybinds, showWhenReadOnly, loading, disabled,
7057
7037
  });
7058
7038
  }
7059
7039
  //#endregion
7060
- 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, 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 };
7040
+ 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, setDefaultPrefixSuffix, tableControlActionsColumn, tableControlIndexColumn, useActiveIssuesPanelBreadcrumb, useActivePathContext, useControlIssues, useDisplayIssueCodesInIssueMessages, useFocus, useFormAppElement, useFormInDebugMode, useFormIsDisabled, useFormIsLoading, useFormIsReadOnly, useFormIsSaving, useFormIsValidating, useFormLoader, useFormSaver, useFormTitle, useFormValidator, useIsRegistered, useIssuesDisplayMode, useLocale, useOnPathFocus, usePrefix, useRegisterControl, useRegisterController, useRegisterIssueMessages, useRegisterLabel, useRegisteredIssueMessage, useResetFocus, useResetOnChange, useResetOnChangeContext, useSetBottomPanelHeight, useSetLeftSidebarWidth, useSetTopBarHeight, useStartIssuesNavigation, useTableControlApiRef, useTopBarElement };
7061
7041
 
7062
7042
  //# sourceMappingURL=ostack-ui-kform.js.map