@mittwald/flow-react-components 1.5.54 → 1.5.56

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 (32) hide show
  1. package/dist/assets/component-index.json +1 -1
  2. package/dist/assets/doc-properties.json +1 -1
  3. package/dist/css/all-layered.css +1 -1
  4. package/dist/css/all.css +1 -1
  5. package/dist/js/packages/components/src/components/Action/lib/ariaLive.mjs.map +1 -1
  6. package/dist/js/packages/components/src/components/LightBox/components/LightBoxGallery/LightBoxGallery.mjs.map +1 -1
  7. package/dist/js/packages/components/src/components/List/components/Items/components/Item/hooks/useGridItemProps.mjs.map +1 -1
  8. package/dist/js/packages/components/src/components/List/hooks/useAriaAnnounceSearchState.mjs.map +1 -1
  9. package/dist/js/packages/components/src/components/List/model/List.mjs +3 -2
  10. package/dist/js/packages/components/src/components/List/model/List.mjs.map +1 -1
  11. package/dist/js/packages/components/src/components/List/model/loading/IncrementalLoader.mjs +9 -6
  12. package/dist/js/packages/components/src/components/List/model/loading/IncrementalLoader.mjs.map +1 -1
  13. package/dist/js/packages/components/src/components/Markdown/Markdown.mjs +4 -0
  14. package/dist/js/packages/components/src/components/Markdown/Markdown.mjs.map +1 -1
  15. package/dist/js/packages/components/src/components/Markdown/Markdown.module.mjs +3 -1
  16. package/dist/js/packages/components/src/components/Markdown/Markdown.module.mjs.map +1 -1
  17. package/dist/js/packages/components/src/components/PasswordCreationField/lib/ariaAnnounce.mjs.map +1 -1
  18. package/dist/js/packages/components/src/components/PasswordCreationField/lib/usePolicyValidationResult.mjs.map +1 -1
  19. package/dist/js/packages/components/src/components/SettingsProvider/SettingsProvider.mjs.map +1 -1
  20. package/dist/js/packages/components/src/components/TextArea/TextArea.mjs.map +1 -1
  21. package/dist/js/packages/components/src/integrations/react-hook-form/components/Form/Form.mjs.map +1 -1
  22. package/dist/js/packages/components/src/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction.mjs.map +1 -1
  23. package/dist/js/packages/components/src/lib/controller/overlay/OverlayController.mjs +7 -5
  24. package/dist/js/packages/components/src/lib/controller/overlay/OverlayController.mjs.map +1 -1
  25. package/dist/js/packages/components/src/lib/hooks/dom/useMakeFocusable.mjs.map +1 -1
  26. package/dist/js/packages/components/src/lib/hooks/useFieldError.mjs.map +1 -1
  27. package/dist/js/packages/components/src/lib/hooks/useOnChange.mjs.map +1 -1
  28. package/dist/js/packages/components/src/lib/mobx/useSelector.mjs.map +1 -1
  29. package/dist/js/packages/components/src/lib/remote/useControlledHostValueProps.mjs +1 -1
  30. package/dist/js/packages/components/src/lib/remote/useControlledHostValueProps.mjs.map +1 -1
  31. package/package.json +10 -10
  32. package/dist/types/lib/mobx/useAutorunEffect.d.ts +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"useMakeFocusable.mjs","names":[],"sources":["../../../../../../../../src/lib/hooks/dom/useMakeFocusable.ts"],"sourcesContent":["import { type RefObject, useEffect } from \"react\";\n\n/**\n * A hook that makes an element focusable and calls a callback when it receives\n * focus.\n */\nexport const useMakeFocusable = (\n ref: RefObject<unknown>,\n onFocus?: CallableFunction,\n) => {\n useEffect(() => {\n const element = ref.current;\n const shouldProcessElement = element && element instanceof HTMLElement;\n\n if (!shouldProcessElement) {\n return;\n }\n\n const onFocusHandler = () => onFocus?.();\n element.addEventListener(\"focus\", onFocusHandler);\n\n const hasTabIndex = element.hasAttribute(\"tabIndex\");\n if (!hasTabIndex) {\n // when we have no tabIndex, we set it to -1 to make it focusable\n element.setAttribute(\"tabIndex\", \"-1\");\n }\n\n return () => {\n element.removeEventListener(\"focus\", onFocusHandler);\n if (!hasTabIndex) {\n element.removeAttribute(\"tabIndex\");\n }\n };\n }, [ref.current, onFocus]);\n};\n"],"mappings":";;;;;;;;AAMA,IAAa,oBACX,KACA,YACG;CACH,gBAAgB;EACd,MAAM,UAAU,IAAI;EAGpB,IAAI,EAFyB,WAAW,mBAAmB,cAGzD;EAGF,MAAM,uBAAuB,UAAU;EACvC,QAAQ,iBAAiB,SAAS,cAAc;EAEhD,MAAM,cAAc,QAAQ,aAAa,UAAU;EACnD,IAAI,CAAC,aAEH,QAAQ,aAAa,YAAY,IAAI;EAGvC,aAAa;GACX,QAAQ,oBAAoB,SAAS,cAAc;GACnD,IAAI,CAAC,aACH,QAAQ,gBAAgB,UAAU;EAEtC;CACF,GAAG,CAAC,IAAI,SAAS,OAAO,CAAC;AAC3B"}
1
+ {"version":3,"file":"useMakeFocusable.mjs","names":[],"sources":["../../../../../../../../src/lib/hooks/dom/useMakeFocusable.ts"],"sourcesContent":["import { type RefObject, useEffect } from \"react\";\n\n/**\n * A hook that makes an element focusable and calls a callback when it receives\n * focus.\n */\nexport const useMakeFocusable = (\n ref: RefObject<unknown>,\n onFocus?: CallableFunction,\n) => {\n useEffect(() => {\n const element = ref.current;\n const shouldProcessElement = element && element instanceof HTMLElement;\n\n if (!shouldProcessElement) {\n return;\n }\n\n const onFocusHandler = () => onFocus?.();\n element.addEventListener(\"focus\", onFocusHandler);\n\n const hasTabIndex = element.hasAttribute(\"tabIndex\");\n if (!hasTabIndex) {\n // when we have no tabIndex, we set it to -1 to make it focusable\n element.setAttribute(\"tabIndex\", \"-1\");\n }\n\n return () => {\n element.removeEventListener(\"focus\", onFocusHandler);\n if (!hasTabIndex) {\n element.removeAttribute(\"tabIndex\");\n }\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- re-attach when the ref points to a new element\n }, [ref.current, onFocus]);\n};\n"],"mappings":";;;;;;;;AAMA,IAAa,oBACX,KACA,YACG;CACH,gBAAgB;EACd,MAAM,UAAU,IAAI;EAGpB,IAAI,EAFyB,WAAW,mBAAmB,cAGzD;EAGF,MAAM,uBAAuB,UAAU;EACvC,QAAQ,iBAAiB,SAAS,cAAc;EAEhD,MAAM,cAAc,QAAQ,aAAa,UAAU;EACnD,IAAI,CAAC,aAEH,QAAQ,aAAa,YAAY,IAAI;EAGvC,aAAa;GACX,QAAQ,oBAAoB,SAAS,cAAc;GACnD,IAAI,CAAC,aACH,QAAQ,gBAAgB,UAAU;EAEtC;CAEF,GAAG,CAAC,IAAI,SAAS,OAAO,CAAC;AAC3B"}
@@ -1 +1 @@
1
- {"version":3,"file":"useFieldError.mjs","names":["formFieldStyles"],"sources":["../../../../../../../src/lib/hooks/useFieldError.tsx"],"sourcesContent":["import React, {\n type FC,\n type PropsWithChildren,\n useMemo,\n useState,\n} from \"react\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport ClearPropsContext from \"@/lib/propsContext/components/ClearPropsContext\";\nimport { useProps } from \"@/lib/hooks/useProps\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\nimport { FieldErrorRenderedContext } from \"@/lib/hooks/fieldErrorRenderedContext\";\n\nexport interface UseFieldErrorOptions {\n fieldErrorId: string;\n tunnelId?: string;\n component: FlowComponentName;\n}\n\nexport const useFieldError = (options: UseFieldErrorOptions) => {\n const fieldErrorProps = useProps(\"FieldError\", {});\n const currentTunnelId = fieldErrorProps.tunnel?.id;\n const tunnelId =\n options.tunnelId ?? currentTunnelId ?? `${options.fieldErrorId}.fieldError`;\n\n const fieldErrorCapturePropsContext: PropsContext = {\n FieldError: {\n id: options.fieldErrorId,\n tunnel: { id: tunnelId, component: options.component },\n className: formFieldStyles.fieldError,\n },\n };\n\n const [renderedFieldErrorId, setRenderedFieldErrorId] = useState<string>();\n\n const FieldErrorCaptureContext: FC<PropsWithChildren> = useMemo(\n () => (props) => {\n return (\n <PropsContextProvider\n props={fieldErrorCapturePropsContext}\n dependencies={[tunnelId]}\n >\n {props.children}\n </PropsContextProvider>\n );\n },\n [tunnelId],\n );\n\n // Keep the component identity stable: a new one per render makes React\n // remount the error on every render of the field (each keystroke).\n const FieldErrorView: FC = useMemo(\n () => () => {\n if (currentTunnelId) {\n return null;\n }\n\n return (\n <FieldErrorRenderedContext value={setRenderedFieldErrorId}>\n <UiComponentTunnelExit id={tunnelId} component={options.component}>\n {(children) => {\n const childrenArray = React.Children.toArray(children);\n return <ClearPropsContext>{childrenArray[0]}</ClearPropsContext>;\n }}\n </UiComponentTunnelExit>\n </FieldErrorRenderedContext>\n );\n },\n [currentTunnelId, tunnelId, options.component],\n );\n\n return {\n FieldErrorCaptureContext,\n FieldErrorView,\n /**\n * The id of the error while one is rendered for this field. A nested field\n * (a `Checkbox` inside a `CheckboxButton`) renders its error at the outer\n * one, so only the outer field ever gets an id here.\n */\n renderedFieldErrorId,\n } as const;\n};\n"],"mappings":";;;;;;;;;;;AAoBA,IAAa,iBAAiB,YAAkC;CAE9D,MAAM,kBADkB,SAAS,cAAc,CAAC,CACxB,CAAA,CAAgB,QAAQ;CAChD,MAAM,WACJ,QAAQ,YAAY,mBAAmB,GAAG,QAAQ,aAAa;CAEjE,MAAM,gCAA8C,EAClD,YAAY;EACV,IAAI,QAAQ;EACZ,QAAQ;GAAE,IAAI;GAAU,WAAW,QAAQ;EAAU;EACrD,WAAWA,yBAAgB;CAC7B,EACF;CAEA,MAAM,CAAC,sBAAsB,2BAA2B,SAAiB;CAsCzE,OAAO;EACL,0BArCsD,eAC/C,UAAU;GACf,OACE,oBAAC,sBAAD;IACE,OAAO;IACP,cAAc,CAAC,QAAQ;IAEtB,UAAA,MAAM;GACa,CAAA;EAE1B,GACA,CAAC,QAAQ,CA0BT;EACA,gBAtByB,oBACb;GACV,IAAI,iBACF,OAAO;GAGT,OACE,oBAAC,2BAAD;IAA2B,OAAO;IAChC,UAAA,oBAAC,uBAAD;KAAuB,IAAI;KAAU,WAAW,QAAQ;KACpD,WAAA,aAAa;MACb,MAAM,gBAAgB,MAAM,SAAS,QAAQ,QAAQ;MACrD,OAAO,oBAAC,mBAAD,EAAA,UAAoB,cAAc,GAAsB,CAAA;KACjE;IACqB,CAAA;GACE,CAAA;EAE/B,GACA;GAAC;GAAiB;GAAU,QAAQ;EAAS,CAK7C;;;;;;EAMA;CACF;AACF"}
1
+ {"version":3,"file":"useFieldError.mjs","names":["formFieldStyles"],"sources":["../../../../../../../src/lib/hooks/useFieldError.tsx"],"sourcesContent":["import React, {\n type FC,\n type PropsWithChildren,\n useMemo,\n useState,\n} from \"react\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport ClearPropsContext from \"@/lib/propsContext/components/ClearPropsContext\";\nimport { useProps } from \"@/lib/hooks/useProps\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\nimport { FieldErrorRenderedContext } from \"@/lib/hooks/fieldErrorRenderedContext\";\n\nexport interface UseFieldErrorOptions {\n fieldErrorId: string;\n tunnelId?: string;\n component: FlowComponentName;\n}\n\nexport const useFieldError = (options: UseFieldErrorOptions) => {\n const fieldErrorProps = useProps(\"FieldError\", {});\n const currentTunnelId = fieldErrorProps.tunnel?.id;\n const tunnelId =\n options.tunnelId ?? currentTunnelId ?? `${options.fieldErrorId}.fieldError`;\n\n const fieldErrorCapturePropsContext: PropsContext = {\n FieldError: {\n id: options.fieldErrorId,\n tunnel: { id: tunnelId, component: options.component },\n className: formFieldStyles.fieldError,\n },\n };\n\n const [renderedFieldErrorId, setRenderedFieldErrorId] = useState<string>();\n\n const FieldErrorCaptureContext: FC<PropsWithChildren> = useMemo(\n () => (props) => {\n return (\n <PropsContextProvider\n props={fieldErrorCapturePropsContext}\n dependencies={[tunnelId]}\n >\n {props.children}\n </PropsContextProvider>\n );\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps -- the props context is new each render and only changes with tunnelId\n [tunnelId],\n );\n\n // Keep the component identity stable: a new one per render makes React\n // remount the error on every render of the field (each keystroke).\n const FieldErrorView: FC = useMemo(\n () => () => {\n if (currentTunnelId) {\n return null;\n }\n\n return (\n <FieldErrorRenderedContext value={setRenderedFieldErrorId}>\n <UiComponentTunnelExit id={tunnelId} component={options.component}>\n {(children) => {\n const childrenArray = React.Children.toArray(children);\n return <ClearPropsContext>{childrenArray[0]}</ClearPropsContext>;\n }}\n </UiComponentTunnelExit>\n </FieldErrorRenderedContext>\n );\n },\n [currentTunnelId, tunnelId, options.component],\n );\n\n return {\n FieldErrorCaptureContext,\n FieldErrorView,\n /**\n * The id of the error while one is rendered for this field. A nested field\n * (a `Checkbox` inside a `CheckboxButton`) renders its error at the outer\n * one, so only the outer field ever gets an id here.\n */\n renderedFieldErrorId,\n } as const;\n};\n"],"mappings":";;;;;;;;;;;AAoBA,IAAa,iBAAiB,YAAkC;CAE9D,MAAM,kBADkB,SAAS,cAAc,CAAC,CACxB,CAAA,CAAgB,QAAQ;CAChD,MAAM,WACJ,QAAQ,YAAY,mBAAmB,GAAG,QAAQ,aAAa;CAEjE,MAAM,gCAA8C,EAClD,YAAY;EACV,IAAI,QAAQ;EACZ,QAAQ;GAAE,IAAI;GAAU,WAAW,QAAQ;EAAU;EACrD,WAAWA,yBAAgB;CAC7B,EACF;CAEA,MAAM,CAAC,sBAAsB,2BAA2B,SAAiB;CAuCzE,OAAO;EACL,0BAtCsD,eAC/C,UAAU;GACf,OACE,oBAAC,sBAAD;IACE,OAAO;IACP,cAAc,CAAC,QAAQ;IAEtB,UAAA,MAAM;GACa,CAAA;EAE1B,GAEA,CAAC,QAAQ,CA0BT;EACA,gBAtByB,oBACb;GACV,IAAI,iBACF,OAAO;GAGT,OACE,oBAAC,2BAAD;IAA2B,OAAO;IAChC,UAAA,oBAAC,uBAAD;KAAuB,IAAI;KAAU,WAAW,QAAQ;KACpD,WAAA,aAAa;MACb,MAAM,gBAAgB,MAAM,SAAS,QAAQ,QAAQ;MACrD,OAAO,oBAAC,mBAAD,EAAA,UAAoB,cAAc,GAAsB,CAAA;KACjE;IACqB,CAAA;GACE,CAAA;EAE/B,GACA;GAAC;GAAiB;GAAU,QAAQ;EAAS,CAK7C;;;;;;EAMA;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"useOnChange.mjs","names":[],"sources":["../../../../../../../src/lib/hooks/useOnChange.ts"],"sourcesContent":["import type { DependencyList } from \"react\";\nimport { useEffect, useRef } from \"react\";\n\nexport const useOnChange = (\n value: unknown,\n callback: () => void,\n dependencies: DependencyList = [],\n) => {\n const oldValue = useRef(value);\n\n useEffect(() => {\n if (oldValue.current !== value) {\n callback();\n }\n oldValue.current = value;\n }, [value, callback, ...dependencies]);\n};\n"],"mappings":";;;;AAGA,IAAa,eACX,OACA,UACA,eAA+B,CAAC,MAC7B;CACH,MAAM,WAAW,OAAO,KAAK;CAE7B,gBAAgB;EACd,IAAI,SAAS,YAAY,OACvB,SAAS;EAEX,SAAS,UAAU;CACrB,GAAG;EAAC;EAAO;EAAU,GAAG;CAAY,CAAC;AACvC"}
1
+ {"version":3,"file":"useOnChange.mjs","names":[],"sources":["../../../../../../../src/lib/hooks/useOnChange.ts"],"sourcesContent":["import type { DependencyList } from \"react\";\nimport { useEffect, useRef } from \"react\";\n\nexport const useOnChange = (\n value: unknown,\n callback: () => void,\n dependencies: DependencyList = [],\n) => {\n const oldValue = useRef(value);\n\n useEffect(() => {\n if (oldValue.current !== value) {\n callback();\n }\n oldValue.current = value;\n // eslint-disable-next-line react-hooks/exhaustive-deps -- the caller passes the callback's dependencies\n }, [value, callback, ...dependencies]);\n};\n"],"mappings":";;;;AAGA,IAAa,eACX,OACA,UACA,eAA+B,CAAC,MAC7B;CACH,MAAM,WAAW,OAAO,KAAK;CAE7B,gBAAgB;EACd,IAAI,SAAS,YAAY,OACvB,SAAS;EAEX,SAAS,UAAU;CAErB,GAAG;EAAC;EAAO;EAAU,GAAG;CAAY,CAAC;AACvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"useSelector.mjs","names":[],"sources":["../../../../../../../src/lib/mobx/useSelector.ts"],"sourcesContent":["import { autorun } from \"mobx\";\nimport { useEffect, useState } from \"react\";\n\nexport type MobXSelector<T> = () => T;\n\n/** Use this hook to select reactive state from the store */\nexport const useSelector = <T>(\n select: MobXSelector<T>,\n deps: unknown[] = [],\n): T => {\n const [selected, setSelected] = useState<T>(select());\n\n useEffect(() => {\n return autorun(() => {\n setSelected(select());\n });\n }, deps);\n\n return selected;\n};\n\nexport default useSelector;\n"],"mappings":";;;;;;AAMA,IAAa,eACX,QACA,OAAkB,CAAC,MACb;CACN,MAAM,CAAC,UAAU,eAAe,SAAY,OAAO,CAAC;CAEpD,gBAAgB;EACd,OAAO,cAAc;GACnB,YAAY,OAAO,CAAC;EACtB,CAAC;CACH,GAAG,IAAI;CAEP,OAAO;AACT"}
1
+ {"version":3,"file":"useSelector.mjs","names":[],"sources":["../../../../../../../src/lib/mobx/useSelector.ts"],"sourcesContent":["import { autorun } from \"mobx\";\nimport { useEffect, useState } from \"react\";\n\nexport type MobXSelector<T> = () => T;\n\n/** Use this hook to select reactive state from the store */\nexport const useSelector = <T>(\n select: MobXSelector<T>,\n deps: unknown[] = [],\n): T => {\n const [selected, setSelected] = useState<T>(select());\n\n useEffect(() => {\n return autorun(() => {\n setSelected(select());\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps -- the caller passes the selector's dependencies\n }, deps);\n\n return selected;\n};\n\nexport default useSelector;\n"],"mappings":";;;;;;AAMA,IAAa,eACX,QACA,OAAkB,CAAC,MACb;CACN,MAAM,CAAC,UAAU,eAAe,SAAY,OAAO,CAAC;CAEpD,gBAAgB;EACd,OAAO,cAAc;GACnB,YAAY,OAAO,CAAC;EACtB,CAAC;CAEH,GAAG,IAAI;CAEP,OAAO;AACT"}
@@ -22,7 +22,7 @@ var useControlledHostValueProps = (props, emptyValue) => {
22
22
  const [value, setValue] = useState(regularValue !== void 0 ? regularValue : defaultValue !== void 0 ? defaultValue : emptyValue);
23
23
  useLayoutEffect(() => {
24
24
  if (regularValue !== void 0) setValue(regularValue);
25
- }, [valueFromProps]);
25
+ }, [regularValue]);
26
26
  const onChange = (v) => {
27
27
  setValue(v);
28
28
  onChangeFromProps?.(v);
@@ -1 +1 @@
1
- {"version":3,"file":"useControlledHostValueProps.mjs","names":[],"sources":["../../../../../../../src/lib/remote/useControlledHostValueProps.ts"],"sourcesContent":["import { useLayoutEffect, useState } from \"react\";\nimport { controlledRemoteValueMarker } from \"./useControlledRemoteValueProps\";\nimport type { FieldProps } from \"@/lib/remote/types\";\n\n/**\n * Returns props with controlled value handling for remote components. It works\n * by omitting values resulting from a remotely executed event handler. These\n * values are marked by the `controlledRemoteValueMarker`.\n *\n * This hook is only necessary for text inputs. If not used the controlled input\n * value may be corrupted by interleaved host inputs and remote events.\n *\n * @param emptyValue What the field reports while nothing has been entered —\n * `\"\"` for a text input, `NaN` for a number, `null` for a date range. It is\n * the sentinel that keeps the field controlled from the first render; see\n * that convention in the package's AGENTS.md.\n */\nexport const useControlledHostValueProps = <T, P>(\n props: FieldProps<T, P>,\n emptyValue: T,\n) => {\n const {\n value: valueFromProps,\n onChange: onChangeFromProps,\n defaultValue,\n } = props;\n\n const regularValue =\n valueFromProps === controlledRemoteValueMarker ? undefined : valueFromProps;\n\n /*\n * Only `undefined` falls back, because only `undefined` reads as\n * uncontrolled: a caller-supplied `null` controls a `DateRangePicker` with no\n * range selected, so `??` would swallow it. The marker cannot appear on the\n * first render, so `regularValue` is the caller's own value here.\n */\n const [value, setValue] = useState(\n regularValue !== undefined\n ? regularValue\n : defaultValue !== undefined\n ? defaultValue\n : emptyValue,\n );\n\n useLayoutEffect(() => {\n if (regularValue !== undefined) {\n setValue(regularValue);\n }\n }, [valueFromProps]);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const onChange = (v: any) => {\n setValue(v);\n onChangeFromProps?.(v);\n };\n\n return {\n ...props,\n value,\n onChange,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,IAAa,+BACX,OACA,eACG;CACH,MAAM,EACJ,OAAO,gBACP,UAAU,mBACV,iBACE;CAEJ,MAAM,eACJ,mBAAA,oCAAiD,KAAA,IAAY;CAQ/D,MAAM,CAAC,OAAO,YAAY,SACxB,iBAAiB,KAAA,IACb,eACA,iBAAiB,KAAA,IACf,eACA,UACR;CAEA,sBAAsB;EACpB,IAAI,iBAAiB,KAAA,GACnB,SAAS,YAAY;CAEzB,GAAG,CAAC,cAAc,CAAC;CAGnB,MAAM,YAAY,MAAW;EAC3B,SAAS,CAAC;EACV,oBAAoB,CAAC;CACvB;CAEA,OAAO;EACL,GAAG;EACH;EACA;CACF;AACF"}
1
+ {"version":3,"file":"useControlledHostValueProps.mjs","names":[],"sources":["../../../../../../../src/lib/remote/useControlledHostValueProps.ts"],"sourcesContent":["import { useLayoutEffect, useState } from \"react\";\nimport { controlledRemoteValueMarker } from \"./useControlledRemoteValueProps\";\nimport type { FieldProps } from \"@/lib/remote/types\";\n\n/**\n * Returns props with controlled value handling for remote components. It works\n * by omitting values resulting from a remotely executed event handler. These\n * values are marked by the `controlledRemoteValueMarker`.\n *\n * This hook is only necessary for text inputs. If not used the controlled input\n * value may be corrupted by interleaved host inputs and remote events.\n *\n * @param emptyValue What the field reports while nothing has been entered —\n * `\"\"` for a text input, `NaN` for a number, `null` for a date range. It is\n * the sentinel that keeps the field controlled from the first render; see\n * that convention in the package's AGENTS.md.\n */\nexport const useControlledHostValueProps = <T, P>(\n props: FieldProps<T, P>,\n emptyValue: T,\n) => {\n const {\n value: valueFromProps,\n onChange: onChangeFromProps,\n defaultValue,\n } = props;\n\n const regularValue =\n valueFromProps === controlledRemoteValueMarker ? undefined : valueFromProps;\n\n /*\n * Only `undefined` falls back, because only `undefined` reads as\n * uncontrolled: a caller-supplied `null` controls a `DateRangePicker` with no\n * range selected, so `??` would swallow it. The marker cannot appear on the\n * first render, so `regularValue` is the caller's own value here.\n */\n const [value, setValue] = useState(\n regularValue !== undefined\n ? regularValue\n : defaultValue !== undefined\n ? defaultValue\n : emptyValue,\n );\n\n useLayoutEffect(() => {\n if (regularValue !== undefined) {\n setValue(regularValue);\n }\n }, [regularValue]);\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const onChange = (v: any) => {\n setValue(v);\n onChangeFromProps?.(v);\n };\n\n return {\n ...props,\n value,\n onChange,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiBA,IAAa,+BACX,OACA,eACG;CACH,MAAM,EACJ,OAAO,gBACP,UAAU,mBACV,iBACE;CAEJ,MAAM,eACJ,mBAAA,oCAAiD,KAAA,IAAY;CAQ/D,MAAM,CAAC,OAAO,YAAY,SACxB,iBAAiB,KAAA,IACb,eACA,iBAAiB,KAAA,IACf,eACA,UACR;CAEA,sBAAsB;EACpB,IAAI,iBAAiB,KAAA,GACnB,SAAS,YAAY;CAEzB,GAAG,CAAC,YAAY,CAAC;CAGjB,MAAM,YAAY,MAAW;EAC3B,SAAS,CAAC;EACV,oBAAoB,CAAC;CACvB;CAEA,OAAO;EACL,GAAG;EACH;EACA;CACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/flow-react-components",
3
- "version": "1.5.54",
3
+ "version": "1.5.56",
4
4
  "type": "module",
5
5
  "description": "A React implementation of Flow, mittwald’s design system",
6
6
  "homepage": "https://flow.mittwald.de",
@@ -84,9 +84,9 @@
84
84
  "@internationalized/string-compiler": "^3.4.1",
85
85
  "@lezer/common": "^1.5.2",
86
86
  "@lezer/highlight": "^1.2.3",
87
- "@mittwald/flow-icons": "^1.5.54",
87
+ "@mittwald/flow-icons": "^1.5.56",
88
88
  "@mittwald/password-tools-js": "^3.0.0",
89
- "@mittwald/react-tunnel": "^1.5.54",
89
+ "@mittwald/react-tunnel": "^1.5.56",
90
90
  "@mittwald/react-use-promise": "^4.2.2",
91
91
  "@react-aria/form": "^3.2.1",
92
92
  "@react-aria/i18n": "^3.13.1",
@@ -139,13 +139,13 @@
139
139
  "@internationalized/date": "^3.12.3",
140
140
  "@lezer/generator": "^1.8.0",
141
141
  "@lezer/lr": "^1.4.10",
142
- "@mittwald/flow-components-base": "1.5.54",
143
- "@mittwald/flow-core": "1.5.54",
144
- "@mittwald/flow-design-tokens": "1.5.54",
145
- "@mittwald/flow-icons-base": "1.5.54",
142
+ "@mittwald/flow-components-base": "1.5.56",
143
+ "@mittwald/flow-core": "1.5.56",
144
+ "@mittwald/flow-design-tokens": "1.5.56",
145
+ "@mittwald/flow-icons-base": "1.5.56",
146
146
  "@mittwald/react-use-promise": "^4.2.2",
147
147
  "@mittwald/remote-dom-react": "1.2.2-mittwald.10",
148
- "@mittwald/typescript-config": "1.5.54",
148
+ "@mittwald/typescript-config": "1.5.56",
149
149
  "@nx/storybook": "^22.7.6",
150
150
  "@storybook/addon-a11y": "^10.5.10",
151
151
  "@storybook/addon-actions": "^9.0.8",
@@ -199,7 +199,7 @@
199
199
  },
200
200
  "peerDependencies": {
201
201
  "@internationalized/date": "^3.12.2",
202
- "@mittwald/flow-icons-pro": "1.5.54",
202
+ "@mittwald/flow-icons-pro": "1.5.56",
203
203
  "@mittwald/react-use-promise": "^4.2.2",
204
204
  "next": "^16.2.3",
205
205
  "react": "^19.2.0",
@@ -223,5 +223,5 @@
223
223
  "browserslist": [
224
224
  "baseline widely available"
225
225
  ],
226
- "gitHead": "9687b1dc1d3832af14d898b71451f88e2c1a1d3c"
226
+ "gitHead": "f40c5fb8b47b8316f452e9b58d377b8345d1398e"
227
227
  }
@@ -1 +0,0 @@
1
- export declare const useAutorunEffect: (effect: () => void) => void;