@mittwald/flow-react-components 1.6.0-next.56 → 1.6.0-next.58
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.
- package/AGENTS.md +4 -0
- package/dist/assets/component-index.json +1 -1
- package/dist/assets/doc-properties.json +1 -1
- package/dist/js/packages/components/src/components/AccentBox/AccentBox.mjs +2 -1
- package/dist/js/packages/components/src/components/AccentBox/AccentBox.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Accordion/Accordion.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Action/lib/ariaLive.mjs.map +1 -1
- package/dist/js/packages/components/src/components/AlertText/AlertText.mjs +2 -1
- package/dist/js/packages/components/src/components/AlertText/AlertText.mjs.map +1 -1
- package/dist/js/packages/components/src/components/BrowserOnly/BrowserOnly.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Chat/Chat.mjs +2 -1
- package/dist/js/packages/components/src/components/Chat/Chat.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Combine/Combine.mjs +2 -1
- package/dist/js/packages/components/src/components/Combine/Combine.mjs.map +1 -1
- package/dist/js/packages/components/src/components/ComponentUsageProvider/ComponentUsageProvider.mjs.map +1 -1
- package/dist/js/packages/components/src/components/FileCard/FileCard.mjs +2 -1
- package/dist/js/packages/components/src/components/FileCard/FileCard.mjs.map +1 -1
- package/dist/js/packages/components/src/components/FileDropZone/FileDropZone.mjs +4 -4
- package/dist/js/packages/components/src/components/FileDropZone/FileDropZone.mjs.map +1 -1
- package/dist/js/packages/components/src/components/LightBox/components/LightBoxGallery/LightBoxGallery.mjs +6 -3
- package/dist/js/packages/components/src/components/LightBox/components/LightBoxGallery/LightBoxGallery.mjs.map +1 -1
- package/dist/js/packages/components/src/components/LightBox/components/LightBoxGalleryItem/LightBoxGalleryItem.mjs.map +1 -1
- package/dist/js/packages/components/src/components/List/components/Items/components/Item/hooks/useGridItemProps.mjs.map +1 -1
- package/dist/js/packages/components/src/components/List/hooks/useAriaAnnounceSearchState.mjs.map +1 -1
- package/dist/js/packages/components/src/components/List/model/List.mjs +3 -2
- package/dist/js/packages/components/src/components/List/model/List.mjs.map +1 -1
- package/dist/js/packages/components/src/components/List/model/loading/IncrementalLoader.mjs +9 -6
- package/dist/js/packages/components/src/components/List/model/loading/IncrementalLoader.mjs.map +1 -1
- package/dist/js/packages/components/src/components/LoadingSpinner/LoadingSpinner.mjs +18 -12
- package/dist/js/packages/components/src/components/LoadingSpinner/LoadingSpinner.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Message/Message.mjs +2 -1
- package/dist/js/packages/components/src/components/Message/Message.mjs.map +1 -1
- package/dist/js/packages/components/src/components/MessageThread/MessageThread.mjs +2 -1
- package/dist/js/packages/components/src/components/MessageThread/MessageThread.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Navigation/components/NavigationGroup/NavigationGroup.mjs +3 -1
- package/dist/js/packages/components/src/components/Navigation/components/NavigationGroup/NavigationGroup.mjs.map +1 -1
- package/dist/js/packages/components/src/components/PasswordCreationField/lib/ariaAnnounce.mjs.map +1 -1
- package/dist/js/packages/components/src/components/PasswordCreationField/lib/usePolicyValidationResult.mjs.map +1 -1
- package/dist/js/packages/components/src/components/Section/components/SectionHeader/SectionHeader.mjs.map +1 -1
- package/dist/js/packages/components/src/components/SettingsProvider/SettingsProvider.mjs.map +1 -1
- package/dist/js/packages/components/src/components/SuspenseTrigger/SuspenseTrigger.mjs.map +1 -1
- package/dist/js/packages/components/src/components/TextArea/TextArea.mjs.map +1 -1
- package/dist/js/packages/components/src/components/TranslationProvider/TranslationProvider.mjs.map +1 -1
- package/dist/js/packages/components/src/components/TunnelEntry/TunnelEntry.mjs.map +1 -1
- package/dist/js/packages/components/src/components/UiComponentTunnel/UiComponentTunnelEntry.mjs.map +1 -1
- package/dist/js/packages/components/src/components/UiComponentTunnel/UiComponentTunnelExit.mjs.map +1 -1
- package/dist/js/packages/components/src/components/UiComponentTunnel/UiComponentTunnelProvider.mjs.map +1 -1
- package/dist/js/packages/components/src/components/propTypes/index.mjs +1 -1
- package/dist/js/packages/components/src/components/propTypes/index.mjs.map +1 -1
- package/dist/js/packages/components/src/integrations/react-hook-form/components/Form/Form.mjs.map +1 -1
- package/dist/js/packages/components/src/integrations/react-hook-form/components/FormContextProvider/useFormSubmitAction.mjs.map +1 -1
- package/dist/js/packages/components/src/lib/controller/overlay/OverlayController.mjs +7 -5
- package/dist/js/packages/components/src/lib/controller/overlay/OverlayController.mjs.map +1 -1
- package/dist/js/packages/components/src/lib/hooks/dom/useMakeFocusable.mjs.map +1 -1
- package/dist/js/packages/components/src/lib/hooks/useFieldError.mjs.map +1 -1
- package/dist/js/packages/components/src/lib/hooks/useOnChange.mjs.map +1 -1
- package/dist/js/packages/components/src/lib/mobx/useSelector.mjs.map +1 -1
- package/dist/js/packages/components/src/lib/propsContext/components/ClearPropsContext.mjs.map +1 -1
- package/dist/js/packages/components/src/lib/propsContext/components/ComponentPropsContextProvider.mjs.map +1 -1
- package/dist/js/packages/components/src/lib/remote/useControlledHostValueProps.mjs +1 -1
- package/dist/js/packages/components/src/lib/remote/useControlledHostValueProps.mjs.map +1 -1
- package/dist/types/components/AccentBox/AccentBox.d.ts +2 -2
- package/dist/types/components/Accordion/Accordion.d.ts +4 -3
- package/dist/types/components/AlertText/AlertText.d.ts +2 -2
- package/dist/types/components/Chat/Chat.d.ts +4 -3
- package/dist/types/components/FileDropZone/FileDropZone.d.ts +2 -2
- package/dist/types/components/LightBox/components/LightBoxGallery/LightBoxGallery.d.ts +3 -2
- package/dist/types/components/LightBox/components/LightBoxGalleryItem/LightBoxGalleryItem.d.ts +3 -2
- package/dist/types/components/List/components/ListItemView/ListItemView.d.ts +1 -9
- package/dist/types/components/List/typedList.d.ts +27 -35
- package/dist/types/components/LoadingSpinner/LoadingSpinner.d.ts +1 -2
- package/dist/types/components/Message/Message.d.ts +2 -2
- package/dist/types/components/MessageThread/MessageThread.d.ts +2 -2
- package/dist/types/components/Section/components/SectionHeader/SectionHeader.d.ts +6 -3
- package/dist/types/components/propTypes/index.d.ts +4 -4
- package/dist/types/lib/tokens/getCategoricalColorByIndex.d.ts +1 -1
- package/package.json +10 -10
- package/dist/types/lib/mobx/useAutorunEffect.d.ts +0 -1
package/dist/js/packages/components/src/components/List/model/loading/IncrementalLoader.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IncrementalLoader.mjs","names":[],"sources":["../../../../../../../../../src/components/List/model/loading/IncrementalLoader.ts"],"sourcesContent":["import type List from \"@/components/List/model/List\";\nimport type {\n DataLoaderOptions,\n DataLoaderResult,\n DataSource,\n IncrementalLoaderShape,\n LoaderInvocationHook,\n} from \"@/components/List/model/loading/types\";\nimport type { AsyncResource } from \"@mittwald/react-use-promise\";\nimport { getAsyncResource, usePromise } from \"@mittwald/react-use-promise\";\nimport { useEffect } from \"react\";\nimport { times } from \"remeda\";\nimport { IncrementalLoaderState } from \"@/components/List/model/loading/IncrementalLoaderState\";\nimport { getListDataLoaderOptions } from \"@mittwald/flow-components-base\";\nimport { hash } from \"object-code\";\nimport type { PropertyName } from \"@/components/List/model/types\";\nimport { useMemo } from \"react\";\nimport { useComponentDefaults } from \"@/components/ComponentDefaultsProvider\";\n\nconst emptyData: never[] = [];\n\nexport class IncrementalLoader<T> {\n private readonly list: List<T>;\n private readonly dataSource: DataSource<T>;\n public readonly manualSorting: boolean;\n public readonly manualFiltering: boolean;\n public readonly manualPagination: boolean;\n public readonly disableInitialSuspenseBoundary: boolean;\n public readonly loaderState: IncrementalLoaderState<T>;\n public readonly staticDataProperties: PropertyName<T>[] = [];\n\n private constructor(list: List<T>, shape: IncrementalLoaderShape<T> = {}) {\n const { source } = shape;\n\n this.dataSource = source ?? { staticData: emptyData };\n\n const {\n disableInitialSuspenseBoundary: disableInitialSuspenseBoundaryDefault,\n } = useComponentDefaults(\"List\");\n\n this.disableInitialSuspenseBoundary =\n \"disableInitialSuspenseBoundary\" in this.dataSource\n ? (this.dataSource.disableInitialSuspenseBoundary ??\n disableInitialSuspenseBoundaryDefault)\n : disableInitialSuspenseBoundaryDefault;\n\n const manualPagination =\n \"manualPagination\" in this.dataSource\n ? this.dataSource.manualPagination\n : undefined;\n\n const manualFiltering =\n \"manualFiltering\" in this.dataSource\n ? this.dataSource.manualFiltering\n : undefined;\n\n const manualSorting =\n \"manualSorting\" in this.dataSource\n ? this.dataSource.manualSorting\n : undefined;\n\n this.list = list;\n this.loaderState = IncrementalLoaderState.useNew<T>(list);\n\n this.manualPagination = manualPagination ?? false;\n this.manualFiltering = manualFiltering ?? this.manualPagination;\n this.manualSorting = manualSorting ?? this.manualPagination;\n this.list.filters.forEach((f) => f.onFilterUpdated(() => this.reset()));\n this.list.search?.onUpdated(() => this.reset());\n\n this.initStaticDataProperties();\n }\n\n public static useNew<T>(\n list: List<T>,\n shape: IncrementalLoaderShape<T> = {},\n ): IncrementalLoader<T> {\n return new IncrementalLoader(list, shape);\n }\n\n private initStaticDataProperties() {\n const addPropertiesOfDataEntry = (data: unknown) => {\n if (typeof data !== \"object\" || data === null) {\n return;\n }\n\n (Object.keys(data) as PropertyName<T>[])\n .filter((p) => !this.staticDataProperties.includes(p))\n .forEach((p) => {\n this.staticDataProperties.push(p);\n });\n };\n\n if (\"staticData\" in this.dataSource) {\n this.dataSource.staticData\n // collect properties from just the first 100 items\n .slice(0, 100)\n .forEach(addPropertiesOfDataEntry);\n }\n }\n\n private reset(): void {\n this.loaderState.reset();\n }\n\n public useIsLoading(): boolean {\n return this.loaderState.useIsLoading();\n }\n\n public useIsInitiallyLoading(): boolean {\n return this.loaderState.useIsInitiallyLoading();\n }\n\n public useIsLoadingMore(): boolean {\n return this.loaderState.useIsLoadingMore();\n }\n\n public useData(): T[] {\n return this.loaderState.useMergedData();\n }\n\n private getUseData(): (options: DataLoaderOptions<T>) => DataLoaderResult<T> {\n const dataSource = this.dataSource;\n\n return (options: DataLoaderOptions<T>) => {\n if (\"staticData\" in dataSource) {\n return useMemo(\n () => ({\n data: dataSource.staticData,\n itemTotalCount: dataSource.staticData.length,\n }),\n [dataSource.staticData],\n );\n }\n\n if (\"useData\" in dataSource) {\n return dataSource.useData(options);\n }\n\n if (\"asyncLoader\" in dataSource) {\n const asyncLoader = dataSource.asyncLoader;\n const dependencies = dataSource.dependencies;\n const loaderId = dependencies\n ? hash(dependencies).toString()\n : undefined;\n\n return usePromise(asyncLoader, [options], {\n loaderId,\n });\n }\n\n if (\"asyncResourceFactory\" in dataSource) {\n return dataSource.asyncResourceFactory(options).use();\n }\n\n return useMemo(\n () => ({\n data: [],\n itemTotalCount: 0,\n }),\n [],\n );\n };\n }\n\n public getLoaderInvocationHooks(): LoaderInvocationHook[] {\n const batchesCount = times(this.list.batches.getBatchIndex() + 1, (i) => i);\n const useData = this.getUseData();\n\n return batchesCount.map((batchIndex) => ({\n useLoadBatch: () => {\n const loaderOptions = this.getDataLoaderOptions(batchIndex);\n const loaderResult = useData(loaderOptions);\n const { data, itemTotalCount, metadata } = loaderResult;\n\n useEffect(() => {\n this.loaderState.setDataBatch(batchIndex, data);\n\n if (itemTotalCount !== undefined) {\n this.list.batches.updateItemTotalCount(itemTotalCount);\n }\n\n this.loaderState.setMetadata(metadata);\n\n this.loaderState.setBatchLoadingState(batchIndex, \"loaded\");\n }, [loaderResult]);\n },\n\n useRenderSuspense: () => {\n useEffect(() => {\n this.loaderState.setBatchLoadingState(batchIndex, \"loading\");\n }, [batchIndex]);\n },\n }));\n }\n\n private getDataLoaderOptions(batchIndex: number): DataLoaderOptions<T> {\n return getListDataLoaderOptions<T>(\n {\n batchSize: this.list.batches.batchSize,\n modes: this,\n sorting: this.list.sorting,\n filters: this.list.filters,\n searchString: this.list.reactTable.searchString,\n },\n batchIndex,\n );\n }\n\n private getBatchDataAsyncResource(\n batchIndex: number,\n ): AsyncResource<DataLoaderResult<T>> {\n const dataSource = this.dataSource;\n const loaderOptions = this.getDataLoaderOptions(batchIndex);\n\n if (\"staticData\" in dataSource) {\n return getAsyncResource(\n async (staticData) => ({\n data: staticData as T[],\n itemTotalCount: staticData.length,\n }),\n [dataSource.staticData],\n );\n }\n\n if (\"asyncLoader\" in dataSource) {\n const asyncLoader = dataSource.asyncLoader;\n const dependencies = dataSource.dependencies;\n const loaderId = dependencies ? hash(dependencies).toString() : undefined;\n return getAsyncResource(asyncLoader, [loaderOptions], {\n loaderId,\n });\n }\n\n if (\"asyncResourceFactory\" in dataSource) {\n const asyncResourceFactory = dataSource.asyncResourceFactory;\n return asyncResourceFactory(loaderOptions);\n }\n\n throw new Error(\"Unknown data source\");\n }\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"IncrementalLoader.mjs","names":[],"sources":["../../../../../../../../../src/components/List/model/loading/IncrementalLoader.ts"],"sourcesContent":["import type List from \"@/components/List/model/List\";\nimport type {\n DataLoaderOptions,\n DataLoaderResult,\n DataSource,\n IncrementalLoaderShape,\n LoaderInvocationHook,\n} from \"@/components/List/model/loading/types\";\nimport type { AsyncResource } from \"@mittwald/react-use-promise\";\nimport { getAsyncResource, usePromise } from \"@mittwald/react-use-promise\";\nimport { useEffect } from \"react\";\nimport { times } from \"remeda\";\nimport { IncrementalLoaderState } from \"@/components/List/model/loading/IncrementalLoaderState\";\nimport { getListDataLoaderOptions } from \"@mittwald/flow-components-base\";\nimport { hash } from \"object-code\";\nimport type { PropertyName } from \"@/components/List/model/types\";\nimport { useMemo } from \"react\";\nimport { useComponentDefaults } from \"@/components/ComponentDefaultsProvider\";\n\nconst emptyData: never[] = [];\n\nexport class IncrementalLoader<T> {\n private readonly list: List<T>;\n private readonly dataSource: DataSource<T>;\n public readonly manualSorting: boolean;\n public readonly manualFiltering: boolean;\n public readonly manualPagination: boolean;\n public readonly disableInitialSuspenseBoundary: boolean;\n public readonly loaderState: IncrementalLoaderState<T>;\n public readonly staticDataProperties: PropertyName<T>[] = [];\n\n private constructor(list: List<T>, shape: IncrementalLoaderShape<T> = {}) {\n const { source } = shape;\n\n this.dataSource = source ?? { staticData: emptyData };\n\n const {\n disableInitialSuspenseBoundary: disableInitialSuspenseBoundaryDefault,\n } = useComponentDefaults(\"List\");\n\n this.disableInitialSuspenseBoundary =\n \"disableInitialSuspenseBoundary\" in this.dataSource\n ? (this.dataSource.disableInitialSuspenseBoundary ??\n disableInitialSuspenseBoundaryDefault)\n : disableInitialSuspenseBoundaryDefault;\n\n const manualPagination =\n \"manualPagination\" in this.dataSource\n ? this.dataSource.manualPagination\n : undefined;\n\n const manualFiltering =\n \"manualFiltering\" in this.dataSource\n ? this.dataSource.manualFiltering\n : undefined;\n\n const manualSorting =\n \"manualSorting\" in this.dataSource\n ? this.dataSource.manualSorting\n : undefined;\n\n this.list = list;\n this.loaderState = IncrementalLoaderState.useNew<T>(list);\n\n this.manualPagination = manualPagination ?? false;\n this.manualFiltering = manualFiltering ?? this.manualPagination;\n this.manualSorting = manualSorting ?? this.manualPagination;\n this.list.filters.forEach((f) => f.onFilterUpdated(() => this.reset()));\n this.list.search?.onUpdated(() => this.reset());\n\n this.initStaticDataProperties();\n }\n\n public static useNew<T>(\n list: List<T>,\n shape: IncrementalLoaderShape<T> = {},\n ): IncrementalLoader<T> {\n return new IncrementalLoader(list, shape);\n }\n\n private initStaticDataProperties() {\n const addPropertiesOfDataEntry = (data: unknown) => {\n if (typeof data !== \"object\" || data === null) {\n return;\n }\n\n (Object.keys(data) as PropertyName<T>[])\n .filter((p) => !this.staticDataProperties.includes(p))\n .forEach((p) => {\n this.staticDataProperties.push(p);\n });\n };\n\n if (\"staticData\" in this.dataSource) {\n this.dataSource.staticData\n // collect properties from just the first 100 items\n .slice(0, 100)\n .forEach(addPropertiesOfDataEntry);\n }\n }\n\n private reset(): void {\n this.loaderState.reset();\n }\n\n public useIsLoading(): boolean {\n return this.loaderState.useIsLoading();\n }\n\n public useIsInitiallyLoading(): boolean {\n return this.loaderState.useIsInitiallyLoading();\n }\n\n public useIsLoadingMore(): boolean {\n return this.loaderState.useIsLoadingMore();\n }\n\n public useData(): T[] {\n return this.loaderState.useMergedData();\n }\n\n private getUseData(): (options: DataLoaderOptions<T>) => DataLoaderResult<T> {\n const dataSource = this.dataSource;\n\n return (options: DataLoaderOptions<T>) => {\n if (\"staticData\" in dataSource) {\n const staticData = dataSource.staticData;\n return useMemo(\n () => ({\n data: staticData,\n itemTotalCount: staticData.length,\n }),\n [staticData],\n );\n }\n\n if (\"useData\" in dataSource) {\n return dataSource.useData(options);\n }\n\n if (\"asyncLoader\" in dataSource) {\n const asyncLoader = dataSource.asyncLoader;\n const dependencies = dataSource.dependencies;\n const loaderId = dependencies\n ? hash(dependencies).toString()\n : undefined;\n\n return usePromise(asyncLoader, [options], {\n loaderId,\n });\n }\n\n if (\"asyncResourceFactory\" in dataSource) {\n return dataSource.asyncResourceFactory(options).use();\n }\n\n return useMemo(\n () => ({\n data: [],\n itemTotalCount: 0,\n }),\n [],\n );\n };\n }\n\n public getLoaderInvocationHooks(): LoaderInvocationHook[] {\n const batchesCount = times(this.list.batches.getBatchIndex() + 1, (i) => i);\n const useData = this.getUseData();\n\n return batchesCount.map((batchIndex) => ({\n useLoadBatch: () => {\n const loaderOptions = this.getDataLoaderOptions(batchIndex);\n const loaderResult = useData(loaderOptions);\n\n useEffect(() => {\n const { data, itemTotalCount, metadata } = loaderResult;\n this.loaderState.setDataBatch(batchIndex, data);\n\n if (itemTotalCount !== undefined) {\n this.list.batches.updateItemTotalCount(itemTotalCount);\n }\n\n this.loaderState.setMetadata(metadata);\n\n this.loaderState.setBatchLoadingState(batchIndex, \"loaded\");\n }, [loaderResult]);\n },\n\n useRenderSuspense: () => {\n useEffect(() => {\n this.loaderState.setBatchLoadingState(batchIndex, \"loading\");\n }, []);\n },\n }));\n }\n\n private getDataLoaderOptions(batchIndex: number): DataLoaderOptions<T> {\n return getListDataLoaderOptions<T>(\n {\n batchSize: this.list.batches.batchSize,\n modes: this,\n sorting: this.list.sorting,\n filters: this.list.filters,\n searchString: this.list.reactTable.searchString,\n },\n batchIndex,\n );\n }\n\n private getBatchDataAsyncResource(\n batchIndex: number,\n ): AsyncResource<DataLoaderResult<T>> {\n const dataSource = this.dataSource;\n const loaderOptions = this.getDataLoaderOptions(batchIndex);\n\n if (\"staticData\" in dataSource) {\n return getAsyncResource(\n async (staticData) => ({\n data: staticData as T[],\n itemTotalCount: staticData.length,\n }),\n [dataSource.staticData],\n );\n }\n\n if (\"asyncLoader\" in dataSource) {\n const asyncLoader = dataSource.asyncLoader;\n const dependencies = dataSource.dependencies;\n const loaderId = dependencies ? hash(dependencies).toString() : undefined;\n return getAsyncResource(asyncLoader, [loaderOptions], {\n loaderId,\n });\n }\n\n if (\"asyncResourceFactory\" in dataSource) {\n const asyncResourceFactory = dataSource.asyncResourceFactory;\n return asyncResourceFactory(loaderOptions);\n }\n\n throw new Error(\"Unknown data source\");\n }\n}\n"],"mappings":"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"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
+
import { flowComponent } from "../../lib/componentFactory/flowComponent.mjs";
|
|
3
4
|
import { isAlphaColor } from "../../lib/types/props.mjs";
|
|
4
5
|
import { useSkeletonMode } from "../SkeletonMode/skeletonModeContext.mjs";
|
|
5
6
|
import { IconPending } from "../Icon/components/icons/IconPending.mjs";
|
|
@@ -7,34 +8,39 @@ import LoadingSpinner_module_default from "./LoadingSpinner.module.mjs";
|
|
|
7
8
|
import { useDesignTokens } from "../../lib/theming/hooks/useDesignTokens.mjs";
|
|
8
9
|
import { SkeletonIconSurface } from "../SkeletonMode/components/SkeletonIconSurface/SkeletonIconSurface.mjs";
|
|
9
10
|
import clsx from "clsx";
|
|
10
|
-
import "react";
|
|
11
|
+
import { useMemo } from "react";
|
|
11
12
|
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
import { mergeRefs } from "@react-aria/utils";
|
|
12
14
|
import { useReducedMotion } from "framer-motion";
|
|
13
15
|
// src/components/LoadingSpinner/LoadingSpinner.tsx
|
|
14
16
|
var globalSpinnerTime = performance.now();
|
|
15
17
|
/** @flr-generate all */
|
|
16
|
-
var LoadingSpinner = (props) => {
|
|
17
|
-
const { className, color = "default", ...rest } = props;
|
|
18
|
+
var LoadingSpinner = flowComponent("LoadingSpinner", (props) => {
|
|
19
|
+
const { className, color = "default", ref, ...rest } = props;
|
|
18
20
|
const preferReducedMotion = useReducedMotion();
|
|
19
21
|
const isSkeleton = useSkeletonMode();
|
|
20
22
|
const loadingSpinnerTokens = useDesignTokens()["loading-spinner"];
|
|
21
23
|
const animationDurationMs = preferReducedMotion ? parseInt(loadingSpinnerTokens["transition-duration-slow"].value) : parseInt(loadingSpinnerTokens["transition-duration"].value);
|
|
22
24
|
const rootClassName = clsx(LoadingSpinner_module_default.loadingSpinner, isAlphaColor(color) && LoadingSpinner_module_default[color], className);
|
|
25
|
+
const spinnerRef = useMemo(() => mergeRefs(ref, (element) => {
|
|
26
|
+
if (element) {
|
|
27
|
+
const phaseMs = (performance.now() - globalSpinnerTime) % animationDurationMs;
|
|
28
|
+
element.style.setProperty("--animation-delay", `${-phaseMs}ms`);
|
|
29
|
+
}
|
|
30
|
+
}), [ref, animationDurationMs]);
|
|
23
31
|
if (isSkeleton) return /* @__PURE__ */ jsx(SkeletonIconSurface, {
|
|
24
32
|
className,
|
|
25
|
-
children: /* @__PURE__ */ jsx(IconPending, {
|
|
33
|
+
children: /* @__PURE__ */ jsx(IconPending, {
|
|
34
|
+
...rest,
|
|
35
|
+
ref
|
|
36
|
+
})
|
|
26
37
|
});
|
|
27
38
|
return /* @__PURE__ */ jsx(IconPending, {
|
|
28
39
|
className: rootClassName,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const phaseMs = (performance.now() - globalSpinnerTime) % animationDurationMs;
|
|
32
|
-
element.style.setProperty("--animation-delay", `${-phaseMs}ms`);
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
...rest
|
|
40
|
+
...rest,
|
|
41
|
+
ref: spinnerRef
|
|
36
42
|
});
|
|
37
|
-
};
|
|
43
|
+
}, { type: "layout" });
|
|
38
44
|
export { LoadingSpinner, LoadingSpinner as default };
|
|
39
45
|
|
|
40
46
|
//# sourceMappingURL=LoadingSpinner.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LoadingSpinner.mjs","names":["styles"],"sources":["../../../../../../../src/components/LoadingSpinner/LoadingSpinner.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"LoadingSpinner.mjs","names":["styles"],"sources":["../../../../../../../src/components/LoadingSpinner/LoadingSpinner.tsx"],"sourcesContent":["import { IconPending } from \"@/components/Icon/components/icons\";\nimport styles from \"./LoadingSpinner.module.scss\";\nimport type { IconProps } from \"@/components/Icon\";\nimport clsx from \"clsx\";\nimport { type AlphaColor, isAlphaColor } from \"@/lib/types/props\";\nimport { useReducedMotion } from \"framer-motion\";\nimport { useDesignTokens } from \"@/lib/theming\";\nimport { SkeletonIconSurface } from \"@/components/SkeletonMode/components/SkeletonIconSurface\";\nimport { useSkeletonMode } from \"@/components/SkeletonMode/skeletonModeContext\";\nimport { mergeRefs } from \"@react-aria/utils\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useMemo } from \"react\";\n\nexport interface LoadingSpinnerProps extends IconProps {\n /** The color of the loading spinner. @default \"default\" */\n color?: \"default\" | AlphaColor;\n}\n\nconst globalSpinnerTime = performance.now();\n\n/** @flr-generate all */\nexport const LoadingSpinner = flowComponent(\n \"LoadingSpinner\",\n (props) => {\n const { className, color = \"default\", ref, ...rest } = props;\n\n const preferReducedMotion = useReducedMotion();\n const isSkeleton = useSkeletonMode();\n\n const designTokens = useDesignTokens();\n const loadingSpinnerTokens = designTokens[\"loading-spinner\"];\n\n const animationDurationMs = preferReducedMotion\n ? parseInt(loadingSpinnerTokens[\"transition-duration-slow\"].value)\n : parseInt(loadingSpinnerTokens[\"transition-duration\"].value);\n\n const rootClassName = clsx(\n styles.loadingSpinner,\n isAlphaColor(color) && styles[color],\n className,\n );\n\n const spinnerRef = useMemo(\n () =>\n mergeRefs(ref, (element) => {\n if (element) {\n const elapsedMs = performance.now() - globalSpinnerTime;\n const phaseMs = elapsedMs % animationDurationMs;\n\n element.style.setProperty(\"--animation-delay\", `${-phaseMs}ms`);\n }\n }),\n [ref, animationDurationMs],\n );\n\n /* A round surface in the spinner's size, without the spinning. */\n if (isSkeleton) {\n return (\n <SkeletonIconSurface className={className}>\n <IconPending {...rest} ref={ref} />\n </SkeletonIconSurface>\n );\n }\n\n return <IconPending className={rootClassName} {...rest} ref={spinnerRef} />;\n },\n /* The spinner stands in for an icon: `Icon` props contexts (e.g. the size\n `IllustratedMessage` sets) keep reaching its inner icon. */\n { type: \"layout\" },\n);\n\nexport default LoadingSpinner;\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,IAAM,oBAAoB,YAAY,IAAI;;AAG1C,IAAa,iBAAiB,cAC5B,mBACC,UAAU;CACT,MAAM,EAAE,WAAW,QAAQ,WAAW,KAAK,GAAG,SAAS;CAEvD,MAAM,sBAAsB,iBAAiB;CAC7C,MAAM,aAAa,gBAAgB;CAGnC,MAAM,uBADe,gBACQ,CAAA,CAAa;CAE1C,MAAM,sBAAsB,sBACxB,SAAS,qBAAqB,2BAA2B,CAAC,KAAK,IAC/D,SAAS,qBAAqB,sBAAsB,CAAC,KAAK;CAE9D,MAAM,gBAAgB,KACpBA,8BAAO,gBACP,aAAa,KAAK,KAAKA,8BAAO,QAC9B,SACF;CAEA,MAAM,aAAa,cAEf,UAAU,MAAM,YAAY;EAC1B,IAAI,SAAS;GAEX,MAAM,WADY,YAAY,IAAI,IAAI,qBACV;GAE5B,QAAQ,MAAM,YAAY,qBAAqB,GAAG,CAAC,QAAQ,GAAG;EAChE;CACF,CAAC,GACH,CAAC,KAAK,mBAAmB,CAC3B;CAGA,IAAI,YACF,OACE,oBAAC,qBAAD;EAAgC;EAC9B,UAAA,oBAAC,aAAD;GAAa,GAAI;GAAW;EAAM,CAAA;CACf,CAAA;CAIzB,OAAO,oBAAC,aAAD;EAAa,WAAW;EAAe,GAAI;EAAM,KAAK;CAAa,CAAA;AAC5E,GAGA,EAAE,MAAM,SAAS,CACnB"}
|
|
@@ -16,7 +16,7 @@ import * as Aria from "react-aria-components";
|
|
|
16
16
|
// src/components/Message/Message.tsx
|
|
17
17
|
/** @flr-generate all */
|
|
18
18
|
var Message = flowComponent("Message", (props) => {
|
|
19
|
-
const { type = "responder", children, className, color, elementType = "article" } = props;
|
|
19
|
+
const { type = "responder", children, className, color, elementType = "article", ref } = props;
|
|
20
20
|
const Element = elementType;
|
|
21
21
|
const rootClassName = clsx(Message_module_default.message, Message_module_default[type], className);
|
|
22
22
|
const style = color ? { "--message-background": color } : void 0;
|
|
@@ -78,6 +78,7 @@ var Message = flowComponent("Message", (props) => {
|
|
|
78
78
|
return /* @__PURE__ */ jsx(PropsContextProvider, {
|
|
79
79
|
props: propsContext,
|
|
80
80
|
children: /* @__PURE__ */ jsx(Element, {
|
|
81
|
+
ref,
|
|
81
82
|
className: rootClassName,
|
|
82
83
|
style,
|
|
83
84
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Message.mjs","names":["styles","locales","_Fragment"],"sources":["../../../../../../../src/components/Message/Message.tsx"],"sourcesContent":["import { type CSSProperties, type PropsWithChildren } from \"react\";\nimport clsx from \"clsx\";\nimport styles from \"./Message.module.scss\";\nimport type {\n PropsWithClassName,\n PropsWithElementType,\n} from \"@/lib/types/props\";\nimport {\n dynamic,\n type PropsContext,\n PropsContextProvider,\n} from \"@/lib/propsContext\";\nimport { IconContextMenu } from \"@/components/Icon/components/icons\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport ClearPropsContext from \"@/lib/propsContext/components/ClearPropsContext\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider\";\nimport * as Aria from \"react-aria-components\";\nimport { SkeletonRawText } from \"@/components/SkeletonMode/components/SkeletonRawText\";\n\nexport interface MessageProps\n extends\n PropsWithChildren,\n PropsWithClassName,\n FlowComponentProps
|
|
1
|
+
{"version":3,"file":"Message.mjs","names":["styles","locales","_Fragment"],"sources":["../../../../../../../src/components/Message/Message.tsx"],"sourcesContent":["import { type CSSProperties, type PropsWithChildren } from \"react\";\nimport clsx from \"clsx\";\nimport styles from \"./Message.module.scss\";\nimport type {\n PropsWithClassName,\n PropsWithElementType,\n} from \"@/lib/types/props\";\nimport {\n dynamic,\n type PropsContext,\n PropsContextProvider,\n} from \"@/lib/propsContext\";\nimport { IconContextMenu } from \"@/components/Icon/components/icons\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport ClearPropsContext from \"@/lib/propsContext/components/ClearPropsContext\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider\";\nimport * as Aria from \"react-aria-components\";\nimport { SkeletonRawText } from \"@/components/SkeletonMode/components/SkeletonRawText\";\n\nexport interface MessageProps\n extends\n PropsWithChildren,\n PropsWithClassName,\n FlowComponentProps<HTMLElement>,\n PropsWithElementType<\"article\" | \"li\"> {\n /** Determines the color and orientation of the message. @default \"responder\" */\n type?: \"responder\" | \"sender\";\n /** A custom background color of the message as a CSS color value. */\n color?: string;\n}\n\n/** @flr-generate all */\nexport const Message = flowComponent(\"Message\", (props) => {\n const {\n type = \"responder\",\n children,\n className,\n color,\n elementType = \"article\",\n ref,\n } = props;\n\n const Element = elementType;\n\n const rootClassName = clsx(styles.message, styles[type], className);\n\n const style: CSSProperties | undefined = color\n ? { \"--message-background\": color }\n : undefined;\n\n const formatter = useLocalizedStringFormatter(locales, \"Message\");\n\n const senderContext: PropsContext[\"Combine\"] = {\n wrapWith: <ClearPropsContext />,\n className: styles.user,\n Avatar: { Initials: { \"aria-hidden\": true } },\n };\n\n const propsContext: PropsContext = {\n Content: {\n className: styles.content,\n children: dynamic((props) => {\n return (\n <>\n <div className={styles.tipBorder} aria-hidden />\n <div className={styles.tip} aria-hidden />\n {/* The fragment hides raw text from `Content`'s own text rule. */}\n <SkeletonRawText>{props.children}</SkeletonRawText>\n </>\n );\n }),\n },\n Header: {\n className: styles.header,\n Button: {\n className: styles.headerAction,\n size: \"s\",\n variant: \"plain\",\n color: \"secondary\",\n },\n ContextMenuTrigger: {\n Button: {\n className: styles.headerAction,\n size: \"s\",\n variant: \"plain\",\n color: \"secondary\",\n children: <IconContextMenu />,\n \"aria-label\": formatter.format(\"options\"),\n },\n },\n Text: { className: styles.date },\n Combine: senderContext,\n // Deprecated alias of Combine — keep it arranged the same way.\n Align: senderContext,\n children: dynamic((props) => (\n <>\n <Aria.VisuallyHidden>\n {formatter.format(\"headerLabel\")}\n </Aria.VisuallyHidden>\n {props.children}\n </>\n )),\n },\n\n Button: {\n size: \"s\",\n className: styles.action,\n },\n ActionGroup: {\n preserveOrder: true,\n size: \"s\",\n className: styles.actionGroup,\n Button: {\n className: styles.actionGroupAction,\n },\n },\n };\n\n return (\n <PropsContextProvider props={propsContext}>\n <Element ref={ref as never} className={rootClassName} style={style}>\n {children}\n </Element>\n </PropsContextProvider>\n );\n});\n\nexport default Message;\n"],"mappings":";;;;;;;;;;;;;;;;;AAoCA,IAAa,UAAU,cAAc,YAAY,UAAU;CACzD,MAAM,EACJ,OAAO,aACP,UACA,WACA,OACA,cAAc,WACd,QACE;CAEJ,MAAM,UAAU;CAEhB,MAAM,gBAAgB,KAAKA,uBAAO,SAASA,uBAAO,OAAO,SAAS;CAElE,MAAM,QAAmC,QACrC,EAAE,wBAAwB,MAAM,IAChC,KAAA;CAEJ,MAAM,YAAY,4BAA4BC,kBAAS,SAAS;CAEhE,MAAM,gBAAyC;EAC7C,UAAU,oBAAC,mBAAD,CAAoB,CAAA;EAC9B,WAAWD,uBAAO;EAClB,QAAQ,EAAE,UAAU,EAAE,eAAe,KAAK,EAAE;CAC9C;CAEA,MAAM,eAA6B;EACjC,SAAS;GACP,WAAWA,uBAAO;GAClB,UAAU,SAAS,UAAU;IAC3B,OACE,qBAAAE,YAAA,EAAA,UAAA;KACE,oBAAC,OAAD;MAAK,WAAWF,uBAAO;MAAW,eAAA;KAAa,CAAA;KAC/C,oBAAC,OAAD;MAAK,WAAWA,uBAAO;MAAK,eAAA;KAAa,CAAA;KAEzC,oBAAC,iBAAD,EAAA,UAAkB,MAAM,SAA0B,CAAA;IAClD,EAAA,CAAA;GAEN,CAAC;EACH;EACA,QAAQ;GACN,WAAWA,uBAAO;GAClB,QAAQ;IACN,WAAWA,uBAAO;IAClB,MAAM;IACN,SAAS;IACT,OAAO;GACT;GACA,oBAAoB,EAClB,QAAQ;IACN,WAAWA,uBAAO;IAClB,MAAM;IACN,SAAS;IACT,OAAO;IACP,UAAU,oBAAC,iBAAD,CAAkB,CAAA;IAC5B,cAAc,UAAU,OAAO,SAAS;GAC1C,EACF;GACA,MAAM,EAAE,WAAWA,uBAAO,KAAK;GAC/B,SAAS;GAET,OAAO;GACP,UAAU,SAAS,UACjB,qBAAAE,YAAA,EAAA,UAAA,CACE,oBAAC,KAAK,gBAAN,EAAA,UACG,UAAU,OAAO,aAAa,EACZ,CAAA,GACpB,MAAM,QACP,EAAA,CAAA,CACH;EACH;EAEA,QAAQ;GACN,MAAM;GACN,WAAWF,uBAAO;EACpB;EACA,aAAa;GACX,eAAe;GACf,MAAM;GACN,WAAWA,uBAAO;GAClB,QAAQ,EACN,WAAWA,uBAAO,kBACpB;EACF;CACF;CAEA,OACE,oBAAC,sBAAD;EAAsB,OAAO;EAC3B,UAAA,oBAAC,SAAD;GAAc;GAAc,WAAW;GAAsB;GAC1D;EACM,CAAA;CACW,CAAA;AAE1B,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { jsx } from "react/jsx-runtime";
|
|
|
9
9
|
// src/components/MessageThread/MessageThread.tsx
|
|
10
10
|
/** @flr-generate all */
|
|
11
11
|
var MessageThread = flowComponent("MessageThread", (props) => {
|
|
12
|
-
const { children, className } = props;
|
|
12
|
+
const { children, className, ref } = props;
|
|
13
13
|
const rootClassName = clsx(MessageThread_module_default.messageThread, className);
|
|
14
14
|
const propsContext = { Message: {
|
|
15
15
|
className: dynamic((props) => {
|
|
@@ -20,6 +20,7 @@ var MessageThread = flowComponent("MessageThread", (props) => {
|
|
|
20
20
|
return /* @__PURE__ */ jsx(PropsContextProvider, {
|
|
21
21
|
props: propsContext,
|
|
22
22
|
children: /* @__PURE__ */ jsx("ul", {
|
|
23
|
+
ref,
|
|
23
24
|
className: rootClassName,
|
|
24
25
|
children
|
|
25
26
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageThread.mjs","names":["styles"],"sources":["../../../../../../../src/components/MessageThread/MessageThread.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport styles from \"./MessageThread.module.scss\";\nimport {\n dynamic,\n type PropsContext,\n PropsContextProvider,\n} from \"@/lib/propsContext\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\n\nexport type MessageThreadProps = PropsWithChildren &\n PropsWithClassName &\n FlowComponentProps
|
|
1
|
+
{"version":3,"file":"MessageThread.mjs","names":["styles"],"sources":["../../../../../../../src/components/MessageThread/MessageThread.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport clsx from \"clsx\";\nimport styles from \"./MessageThread.module.scss\";\nimport {\n dynamic,\n type PropsContext,\n PropsContextProvider,\n} from \"@/lib/propsContext\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\n\nexport type MessageThreadProps = PropsWithChildren &\n PropsWithClassName &\n FlowComponentProps<HTMLUListElement>;\n\n/** @flr-generate all */\nexport const MessageThread = flowComponent(\"MessageThread\", (props) => {\n const { children, className, ref } = props;\n\n const rootClassName = clsx(styles.messageThread, className);\n\n const propsContext: PropsContext = {\n Message: {\n className: dynamic((props) => {\n return clsx(\n styles.message,\n styles[props.type ?? \"responder\"],\n props.className,\n );\n }),\n elementType: \"li\",\n },\n };\n\n return (\n <PropsContextProvider props={propsContext}>\n <ul ref={ref} className={rootClassName}>\n {children}\n </ul>\n </PropsContextProvider>\n );\n});\n\nexport default MessageThread;\n"],"mappings":";;;;;;;;;;AAmBA,IAAa,gBAAgB,cAAc,kBAAkB,UAAU;CACrE,MAAM,EAAE,UAAU,WAAW,QAAQ;CAErC,MAAM,gBAAgB,KAAKA,6BAAO,eAAe,SAAS;CAE1D,MAAM,eAA6B,EACjC,SAAS;EACP,WAAW,SAAS,UAAU;GAC5B,OAAO,KACLA,6BAAO,SACPA,6BAAO,MAAM,QAAQ,cACrB,MAAM,SACR;EACF,CAAC;EACD,aAAa;CACf,EACF;CAEA,OACE,oBAAC,sBAAD;EAAsB,OAAO;EAC3B,UAAA,oBAAC,MAAD;GAAS;GAAK,WAAW;GACtB;EACC,CAAA;CACgB,CAAA;AAE1B,CAAC"}
|
|
@@ -12,7 +12,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
// src/components/Navigation/components/NavigationGroup/NavigationGroup.tsx
|
|
13
13
|
/** @flr-generate all */
|
|
14
14
|
var NavigationGroup = flowComponent("NavigationGroup", (props) => {
|
|
15
|
-
const { children, className, collapsable, defaultExpanded = true, "aria-label": ariaLabel, ...rest } = props;
|
|
15
|
+
const { children, className, collapsable, defaultExpanded = true, "aria-label": ariaLabel, ref, ...rest } = props;
|
|
16
16
|
const rootClassName = clsx(NavigationGroup_module_default.navigationGroup, collapsable && NavigationGroup_module_default.collapsable, className);
|
|
17
17
|
const generatedId = useId();
|
|
18
18
|
const propsContext = {
|
|
@@ -26,6 +26,7 @@ var NavigationGroup = flowComponent("NavigationGroup", (props) => {
|
|
|
26
26
|
} }
|
|
27
27
|
};
|
|
28
28
|
const collapsableUi = /* @__PURE__ */ jsxs(Accordion, {
|
|
29
|
+
ref,
|
|
29
30
|
defaultExpanded,
|
|
30
31
|
className: rootClassName,
|
|
31
32
|
children: [children, /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(LinkListTunnelExit, {
|
|
@@ -37,6 +38,7 @@ var NavigationGroup = flowComponent("NavigationGroup", (props) => {
|
|
|
37
38
|
"aria-labelledby": ariaLabel ? void 0 : generatedId,
|
|
38
39
|
"aria-label": ariaLabel,
|
|
39
40
|
className: rootClassName,
|
|
41
|
+
ref,
|
|
40
42
|
...rest,
|
|
41
43
|
children: [children, /* @__PURE__ */ jsx(LinkListTunnelExit, {
|
|
42
44
|
id: "groupLinks",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationGroup.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/Navigation/components/NavigationGroup/NavigationGroup.tsx"],"sourcesContent":["import { type ComponentProps, type PropsWithChildren } from \"react\";\nimport { useId } from \"react\";\nimport clsx from \"clsx\";\nimport styles from \"./NavigationGroup.module.scss\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport { Accordion } from \"@/components/Accordion\";\nimport { Content } from \"@/components/Content\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport { LinkListTunnelExit } from \"@/components/Navigation/components/LinkListTunnelExit/LinkListTunnelExit\";\n\nexport interface NavigationGroupProps\n extends\n PropsWithChildren<ComponentProps<\"section\">>,\n FlowComponentProps<HTMLElement> {\n collapsable?: boolean;\n /**\n * Whether a `collapsable` group is initially expanded.\n *\n * @default true\n */\n defaultExpanded?: boolean;\n}\n\n/** @flr-generate all */\nexport const NavigationGroup = flowComponent(\"NavigationGroup\", (props) => {\n const {\n children,\n className,\n collapsable,\n defaultExpanded = true,\n \"aria-label\": ariaLabel,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.navigationGroup,\n collapsable && styles.collapsable,\n className,\n );\n\n const generatedId = useId();\n\n const propsContext: PropsContext = {\n Label: {\n id: ariaLabel ? undefined : generatedId,\n className: styles.label,\n },\n Link: {\n tunnel: {\n id: \"groupLinks\",\n component: \"NavigationGroup\",\n },\n },\n };\n\n const collapsableUi = (\n <Accordion defaultExpanded={defaultExpanded}
|
|
1
|
+
{"version":3,"file":"NavigationGroup.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/Navigation/components/NavigationGroup/NavigationGroup.tsx"],"sourcesContent":["import { type ComponentProps, type PropsWithChildren, type Ref } from \"react\";\nimport { useId } from \"react\";\nimport clsx from \"clsx\";\nimport styles from \"./NavigationGroup.module.scss\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport { Accordion } from \"@/components/Accordion\";\nimport { Content } from \"@/components/Content\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport { LinkListTunnelExit } from \"@/components/Navigation/components/LinkListTunnelExit/LinkListTunnelExit\";\n\nexport interface NavigationGroupProps\n extends\n PropsWithChildren<ComponentProps<\"section\">>,\n FlowComponentProps<HTMLElement> {\n collapsable?: boolean;\n /**\n * Whether a `collapsable` group is initially expanded.\n *\n * @default true\n */\n defaultExpanded?: boolean;\n}\n\n/** @flr-generate all */\nexport const NavigationGroup = flowComponent(\"NavigationGroup\", (props) => {\n const {\n children,\n className,\n collapsable,\n defaultExpanded = true,\n \"aria-label\": ariaLabel,\n ref,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.navigationGroup,\n collapsable && styles.collapsable,\n className,\n );\n\n const generatedId = useId();\n\n const propsContext: PropsContext = {\n Label: {\n id: ariaLabel ? undefined : generatedId,\n className: styles.label,\n },\n Link: {\n tunnel: {\n id: \"groupLinks\",\n component: \"NavigationGroup\",\n },\n },\n };\n\n const collapsableUi = (\n <Accordion\n ref={ref as Ref<HTMLDivElement>}\n defaultExpanded={defaultExpanded}\n className={rootClassName}\n >\n {children}\n <Content>\n <LinkListTunnelExit id=\"groupLinks\" component=\"NavigationGroup\" />\n </Content>\n </Accordion>\n );\n\n const defaultUi = (\n <section\n aria-labelledby={ariaLabel ? undefined : generatedId}\n aria-label={ariaLabel}\n className={rootClassName}\n ref={ref}\n {...rest}\n >\n {children}\n <LinkListTunnelExit id=\"groupLinks\" component=\"NavigationGroup\" />\n </section>\n );\n\n return (\n <PropsContextProvider props={propsContext} dependencies={[generatedId]}>\n {collapsable ? collapsableUi : defaultUi}\n </PropsContextProvider>\n );\n});\n\nexport default NavigationGroup;\n"],"mappings":";;;;;;;;;;;;;AA2BA,IAAa,kBAAkB,cAAc,oBAAoB,UAAU;CACzE,MAAM,EACJ,UACA,WACA,aACA,kBAAkB,MAClB,cAAc,WACd,KACA,GAAG,SACD;CAEJ,MAAM,gBAAgB,KACpBA,+BAAO,iBACP,eAAeA,+BAAO,aACtB,SACF;CAEA,MAAM,cAAc,MAAM;CAE1B,MAAM,eAA6B;EACjC,OAAO;GACL,IAAI,YAAY,KAAA,IAAY;GAC5B,WAAWA,+BAAO;EACpB;EACA,MAAM,EACJ,QAAQ;GACN,IAAI;GACJ,WAAW;EACb,EACF;CACF;CAEA,MAAM,gBACJ,qBAAC,WAAD;EACO;EACY;EACjB,WAAW;EAHb,UAAA,CAKG,UACD,oBAAC,SAAD,EAAA,UACE,oBAAC,oBAAD;GAAoB,IAAG;GAAa,WAAU;EAAmB,CAAA,EAC1D,CAAA,CACA;;CAGb,MAAM,YACJ,qBAAC,WAAD;EACE,mBAAiB,YAAY,KAAA,IAAY;EACzC,cAAY;EACZ,WAAW;EACN;EACL,GAAI;EALN,UAAA,CAOG,UACD,oBAAC,oBAAD;GAAoB,IAAG;GAAa,WAAU;EAAmB,CAAA,CAC1D;;CAGX,OACE,oBAAC,sBAAD;EAAsB,OAAO;EAAc,cAAc,CAAC,WAAW;EAClE,UAAA,cAAc,gBAAgB;CACX,CAAA;AAE1B,CAAC"}
|
package/dist/js/packages/components/src/components/PasswordCreationField/lib/ariaAnnounce.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ariaAnnounce.mjs","names":["locales"],"sources":["../../../../../../../../src/components/PasswordCreationField/lib/ariaAnnounce.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { announce } from \"@react-aria/live-announcer\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider/useLocalizedStringFormatter\";\nimport locales from \"./../locales/*.locale.json\";\n\n/**\n * Announces the current validation message — which rule the password misses, or\n * that it is secure.\n *\n * The same text is wired to the field via `aria-describedby`, but a description\n * is only read when the field receives focus. The field keeps focus while the\n * password is typed, so without a live region a screen reader reports the field\n * as invalid and never says why.\n *\n * @internal\n */\nexport const useAriaAnnounceValidationState = (\n text: string | undefined,\n isAnnounceable: boolean,\n): void => {\n const lastAnnouncedText = useRef<string>(undefined);\n\n useEffect(() => {\n if (!isAnnounceable || !text) {\n // Announce the text again when it comes back after an empty field or a\n // pending validation.\n lastAnnouncedText.current = undefined;\n return;\n }\n\n if (text === lastAnnouncedText.current) {\n return;\n }\n\n lastAnnouncedText.current = text;\n announce(text, \"polite\");\n }, [text, isAnnounceable]);\n};\n\n/**\n * Announces that the password became visible or hidden. The toggle button keeps\n * focus, and a screen reader does not report that the input switched between\n * masked characters and plain text on its own.\n *\n * @internal\n */\nexport const useAriaAnnouncePasswordVisibility = (\n isRevealed: boolean,\n): void => {\n const formatter = useLocalizedStringFormatter(\n locales,\n \"PasswordCreationField\",\n );\n const isInitialRender = useRef(true);\n\n useEffect(() => {\n if (isInitialRender.current) {\n isInitialRender.current = false;\n return;\n }\n\n announce(\n formatter.format(\n isRevealed ? \"password.announce.revealed\" : \"password.announce.hidden\",\n ),\n \"polite\",\n );\n }, [isRevealed]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,IAAa,kCACX,MACA,mBACS;CACT,MAAM,oBAAoB,OAAe,KAAA,CAAS;CAElD,gBAAgB;EACd,IAAI,CAAC,kBAAkB,CAAC,MAAM;GAG5B,kBAAkB,UAAU,KAAA;GAC5B;EACF;EAEA,IAAI,SAAS,kBAAkB,SAC7B;EAGF,kBAAkB,UAAU;EAC5B,SAAS,MAAM,QAAQ;CACzB,GAAG,CAAC,MAAM,cAAc,CAAC;AAC3B;;;;;;;;AASA,IAAa,qCACX,eACS;CACT,MAAM,YAAY,4BAChBA,kBACA,uBACF;CACA,MAAM,kBAAkB,OAAO,IAAI;CAEnC,gBAAgB;EACd,IAAI,gBAAgB,SAAS;GAC3B,gBAAgB,UAAU;GAC1B;EACF;EAEA,SACE,UAAU,OACR,aAAa,+BAA+B,0BAC9C,GACA,QACF;
|
|
1
|
+
{"version":3,"file":"ariaAnnounce.mjs","names":["locales"],"sources":["../../../../../../../../src/components/PasswordCreationField/lib/ariaAnnounce.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { announce } from \"@react-aria/live-announcer\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider/useLocalizedStringFormatter\";\nimport locales from \"./../locales/*.locale.json\";\n\n/**\n * Announces the current validation message — which rule the password misses, or\n * that it is secure.\n *\n * The same text is wired to the field via `aria-describedby`, but a description\n * is only read when the field receives focus. The field keeps focus while the\n * password is typed, so without a live region a screen reader reports the field\n * as invalid and never says why.\n *\n * @internal\n */\nexport const useAriaAnnounceValidationState = (\n text: string | undefined,\n isAnnounceable: boolean,\n): void => {\n const lastAnnouncedText = useRef<string>(undefined);\n\n useEffect(() => {\n if (!isAnnounceable || !text) {\n // Announce the text again when it comes back after an empty field or a\n // pending validation.\n lastAnnouncedText.current = undefined;\n return;\n }\n\n if (text === lastAnnouncedText.current) {\n return;\n }\n\n lastAnnouncedText.current = text;\n announce(text, \"polite\");\n }, [text, isAnnounceable]);\n};\n\n/**\n * Announces that the password became visible or hidden. The toggle button keeps\n * focus, and a screen reader does not report that the input switched between\n * masked characters and plain text on its own.\n *\n * @internal\n */\nexport const useAriaAnnouncePasswordVisibility = (\n isRevealed: boolean,\n): void => {\n const formatter = useLocalizedStringFormatter(\n locales,\n \"PasswordCreationField\",\n );\n const isInitialRender = useRef(true);\n\n useEffect(() => {\n if (isInitialRender.current) {\n isInitialRender.current = false;\n return;\n }\n\n announce(\n formatter.format(\n isRevealed ? \"password.announce.revealed\" : \"password.announce.hidden\",\n ),\n \"polite\",\n );\n // eslint-disable-next-line react-hooks/exhaustive-deps -- announce on toggles only, not when the formatter changes\n }, [isRevealed]);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgBA,IAAa,kCACX,MACA,mBACS;CACT,MAAM,oBAAoB,OAAe,KAAA,CAAS;CAElD,gBAAgB;EACd,IAAI,CAAC,kBAAkB,CAAC,MAAM;GAG5B,kBAAkB,UAAU,KAAA;GAC5B;EACF;EAEA,IAAI,SAAS,kBAAkB,SAC7B;EAGF,kBAAkB,UAAU;EAC5B,SAAS,MAAM,QAAQ;CACzB,GAAG,CAAC,MAAM,cAAc,CAAC;AAC3B;;;;;;;;AASA,IAAa,qCACX,eACS;CACT,MAAM,YAAY,4BAChBA,kBACA,uBACF;CACA,MAAM,kBAAkB,OAAO,IAAI;CAEnC,gBAAgB;EACd,IAAI,gBAAgB,SAAS;GAC3B,gBAAgB,UAAU;GAC1B;EACF;EAEA,SACE,UAAU,OACR,aAAa,+BAA+B,0BAC9C,GACA,QACF;CAEF,GAAG,CAAC,UAAU,CAAC;AACjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePolicyValidationResult.mjs","names":[],"sources":["../../../../../../../../src/components/PasswordCreationField/lib/usePolicyValidationResult.ts"],"sourcesContent":["import { startTransition, useEffect, useRef } from \"react\";\nimport type { Policy } from \"@/integrations/@mittwald/password-tools-js\";\nimport type { ResolvedPolicyValidationResult } from \"@/components/PasswordCreationField/PasswordCreationField\";\nimport { useDebouncedCallback } from \"use-debounce\";\n\n/** @internal */\nexport const usePolicyValidationResult = (\n validationPolicy: Policy,\n password: string,\n onValidationStart?: () => void,\n onValidationResult?: (data: {\n password: string;\n isValid: boolean;\n results: ResolvedPolicyValidationResult;\n }) => void,\n) => {\n const cache = useRef<{\n password: string;\n results: ResolvedPolicyValidationResult;\n } | null>(null);\n /**\n * Validations resolve in any order. A result for a password that is no longer\n * the field's value would overwrite the current one.\n */\n const latestPassword = useRef(password);\n\n const validatePassword = (pwd: string) => {\n onValidationStart?.();\n\n startTransition(async () => {\n if (cache.current?.password === pwd) {\n onValidationResult?.({\n password: cache.current.password,\n isValid: Boolean(cache.current.results.isValid),\n results: cache.current.results,\n });\n return;\n }\n\n const validationResult = await validationPolicy.validate(pwd);\n if (pwd !== latestPassword.current) {\n return;\n }\n cache.current = { password: pwd, results: validationResult };\n onValidationResult?.({\n password: pwd,\n isValid: validationResult.isValid,\n results: validationResult,\n });\n });\n };\n\n const validatePasswordDebounce = useDebouncedCallback(validatePassword, 350, {\n trailing: true,\n });\n\n useEffect(() => {\n latestPassword.current = password;\n if (password) {\n validatePasswordDebounce(password);\n } else {\n validatePassword(password);\n }\n }, [password, validationPolicy]);\n\n /**\n * Stores a result the caller already has (a generated password), so the\n * validation of that password answers from the cache instead of rating it\n * again.\n */\n const rememberValidationResult = (\n pwd: string,\n results: ResolvedPolicyValidationResult,\n ) => {\n cache.current = { password: pwd, results };\n };\n\n return { rememberValidationResult } as const;\n};\n"],"mappings":";;;;;;AAMA,IAAa,6BACX,kBACA,UACA,mBACA,uBAKG;CACH,MAAM,QAAQ,OAGJ,IAAI;;;;;CAKd,MAAM,iBAAiB,OAAO,QAAQ;CAEtC,MAAM,oBAAoB,QAAgB;EACxC,oBAAoB;EAEpB,gBAAgB,YAAY;GAC1B,IAAI,MAAM,SAAS,aAAa,KAAK;IACnC,qBAAqB;KACnB,UAAU,MAAM,QAAQ;KACxB,SAAS,QAAQ,MAAM,QAAQ,QAAQ,OAAO;KAC9C,SAAS,MAAM,QAAQ;IACzB,CAAC;IACD;GACF;GAEA,MAAM,mBAAmB,MAAM,iBAAiB,SAAS,GAAG;GAC5D,IAAI,QAAQ,eAAe,SACzB;GAEF,MAAM,UAAU;IAAE,UAAU;IAAK,SAAS;GAAiB;GAC3D,qBAAqB;IACnB,UAAU;IACV,SAAS,iBAAiB;IAC1B,SAAS;GACX,CAAC;EACH,CAAC;CACH;CAEA,MAAM,2BAA2B,qBAAqB,kBAAkB,KAAK,EAC3E,UAAU,KACZ,CAAC;CAED,gBAAgB;EACd,eAAe,UAAU;EACzB,IAAI,UACF,yBAAyB,QAAQ;OAEjC,iBAAiB,QAAQ;
|
|
1
|
+
{"version":3,"file":"usePolicyValidationResult.mjs","names":[],"sources":["../../../../../../../../src/components/PasswordCreationField/lib/usePolicyValidationResult.ts"],"sourcesContent":["import { startTransition, useEffect, useRef } from \"react\";\nimport type { Policy } from \"@/integrations/@mittwald/password-tools-js\";\nimport type { ResolvedPolicyValidationResult } from \"@/components/PasswordCreationField/PasswordCreationField\";\nimport { useDebouncedCallback } from \"use-debounce\";\n\n/** @internal */\nexport const usePolicyValidationResult = (\n validationPolicy: Policy,\n password: string,\n onValidationStart?: () => void,\n onValidationResult?: (data: {\n password: string;\n isValid: boolean;\n results: ResolvedPolicyValidationResult;\n }) => void,\n) => {\n const cache = useRef<{\n password: string;\n results: ResolvedPolicyValidationResult;\n } | null>(null);\n /**\n * Validations resolve in any order. A result for a password that is no longer\n * the field's value would overwrite the current one.\n */\n const latestPassword = useRef(password);\n\n const validatePassword = (pwd: string) => {\n onValidationStart?.();\n\n startTransition(async () => {\n if (cache.current?.password === pwd) {\n onValidationResult?.({\n password: cache.current.password,\n isValid: Boolean(cache.current.results.isValid),\n results: cache.current.results,\n });\n return;\n }\n\n const validationResult = await validationPolicy.validate(pwd);\n if (pwd !== latestPassword.current) {\n return;\n }\n cache.current = { password: pwd, results: validationResult };\n onValidationResult?.({\n password: pwd,\n isValid: validationResult.isValid,\n results: validationResult,\n });\n });\n };\n\n const validatePasswordDebounce = useDebouncedCallback(validatePassword, 350, {\n trailing: true,\n });\n\n useEffect(() => {\n latestPassword.current = password;\n if (password) {\n validatePasswordDebounce(password);\n } else {\n validatePassword(password);\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps -- validate on input changes only; the validators are new each render\n }, [password, validationPolicy]);\n\n /**\n * Stores a result the caller already has (a generated password), so the\n * validation of that password answers from the cache instead of rating it\n * again.\n */\n const rememberValidationResult = (\n pwd: string,\n results: ResolvedPolicyValidationResult,\n ) => {\n cache.current = { password: pwd, results };\n };\n\n return { rememberValidationResult } as const;\n};\n"],"mappings":";;;;;;AAMA,IAAa,6BACX,kBACA,UACA,mBACA,uBAKG;CACH,MAAM,QAAQ,OAGJ,IAAI;;;;;CAKd,MAAM,iBAAiB,OAAO,QAAQ;CAEtC,MAAM,oBAAoB,QAAgB;EACxC,oBAAoB;EAEpB,gBAAgB,YAAY;GAC1B,IAAI,MAAM,SAAS,aAAa,KAAK;IACnC,qBAAqB;KACnB,UAAU,MAAM,QAAQ;KACxB,SAAS,QAAQ,MAAM,QAAQ,QAAQ,OAAO;KAC9C,SAAS,MAAM,QAAQ;IACzB,CAAC;IACD;GACF;GAEA,MAAM,mBAAmB,MAAM,iBAAiB,SAAS,GAAG;GAC5D,IAAI,QAAQ,eAAe,SACzB;GAEF,MAAM,UAAU;IAAE,UAAU;IAAK,SAAS;GAAiB;GAC3D,qBAAqB;IACnB,UAAU;IACV,SAAS,iBAAiB;IAC1B,SAAS;GACX,CAAC;EACH,CAAC;CACH;CAEA,MAAM,2BAA2B,qBAAqB,kBAAkB,KAAK,EAC3E,UAAU,KACZ,CAAC;CAED,gBAAgB;EACd,eAAe,UAAU;EACzB,IAAI,UACF,yBAAyB,QAAQ;OAEjC,iBAAiB,QAAQ;CAG7B,GAAG,CAAC,UAAU,gBAAgB,CAAC;;;;;;CAO/B,MAAM,4BACJ,KACA,YACG;EACH,MAAM,UAAU;GAAE,UAAU;GAAK;EAAQ;CAC3C;CAEA,OAAO,EAAE,yBAAyB;AACpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SectionHeader.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/Section/components/SectionHeader/SectionHeader.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"SectionHeader.mjs","names":["styles"],"sources":["../../../../../../../../../src/components/Section/components/SectionHeader/SectionHeader.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport styles from \"./SectionHeader.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport {\n overlayTriggersTunneledTo,\n PropsContextProvider,\n} from \"@/lib/propsContext\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\n\nexport type SectionHeaderProps = PropsWithChildren &\n PropsWithClassName &\n FlowComponentProps<HTMLElement>;\n\nexport const SectionHeader = flowComponent(\n \"SectionHeader\",\n (props) => {\n const { children, className, ref } = props;\n\n const rootClassName = clsx(styles.sectionHeader, className);\n\n const actionsTunnel = {\n id: \"actions\",\n component: \"SectionHeader\",\n } as const;\n\n const propsContext: PropsContext = {\n ...overlayTriggersTunneledTo(actionsTunnel),\n Switch: {\n labelPosition: \"leading\",\n tunnel: actionsTunnel,\n },\n Button: {\n size: \"s\",\n tunnel: actionsTunnel,\n },\n ActionGroup: {\n preserveOrder: true,\n size: \"s\",\n tunnel: actionsTunnel,\n Button: {\n tunnel: null,\n },\n Switch: {\n tunnel: null,\n },\n Link: {\n size: \"m\",\n tunnel: null,\n },\n },\n FileField: {\n tunnel: actionsTunnel,\n Button: { size: \"s\" },\n },\n Heading: {\n level: 2,\n },\n Link: {\n tunnel: actionsTunnel,\n },\n };\n\n return (\n <header ref={ref} className={rootClassName}>\n <PropsContextProvider props={propsContext}>\n {children}\n <div className={styles.actions}>\n <UiComponentTunnelExit id=\"actions\" component=\"SectionHeader\" />\n </div>\n </PropsContextProvider>\n </header>\n );\n },\n {\n type: \"layout\",\n },\n);\n\nexport default SectionHeader;\n"],"mappings":";;;;;;;;;;AAmBA,IAAa,gBAAgB,cAC3B,kBACC,UAAU;CACT,MAAM,EAAE,UAAU,WAAW,QAAQ;CAErC,MAAM,gBAAgB,KAAKA,6BAAO,eAAe,SAAS;CAE1D,MAAM,gBAAgB;EACpB,IAAI;EACJ,WAAW;CACb;CAEA,MAAM,eAA6B;EACjC,GAAG,0BAA0B,aAAa;EAC1C,QAAQ;GACN,eAAe;GACf,QAAQ;EACV;EACA,QAAQ;GACN,MAAM;GACN,QAAQ;EACV;EACA,aAAa;GACX,eAAe;GACf,MAAM;GACN,QAAQ;GACR,QAAQ,EACN,QAAQ,KACV;GACA,QAAQ,EACN,QAAQ,KACV;GACA,MAAM;IACJ,MAAM;IACN,QAAQ;GACV;EACF;EACA,WAAW;GACT,QAAQ;GACR,QAAQ,EAAE,MAAM,IAAI;EACtB;EACA,SAAS,EACP,OAAO,EACT;EACA,MAAM,EACJ,QAAQ,cACV;CACF;CAEA,OACE,oBAAC,UAAD;EAAa;EAAK,WAAW;EAC3B,UAAA,qBAAC,sBAAD;GAAsB,OAAO;GAA7B,UAAA,CACG,UACD,oBAAC,OAAD;IAAK,WAAWA,6BAAO;IACrB,UAAA,oBAAC,uBAAD;KAAuB,IAAG;KAAU,WAAU;IAAiB,CAAA;GAC5D,CAAA,CACe;;CAChB,CAAA;AAEZ,GACA,EACE,MAAM,SACR,CACF"}
|
package/dist/js/packages/components/src/components/SettingsProvider/SettingsProvider.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsProvider.mjs","names":[],"sources":["../../../../../../../src/components/SettingsProvider/SettingsProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { createContext, useContext, useEffect, useMemo, useRef } from \"react\";\nimport type { SupportedSettingsBackend } from \"@/components/SettingsProvider/backends/types\";\nimport { autorun } from \"mobx\";\nimport { getAsyncResource } from \"@mittwald/react-use-promise\";\nimport {\n SettingsStore,\n type SettingsStoreOptions,\n} from \"@/components/SettingsProvider/models/SettingsStore\";\nimport { settingsBackendFactory } from \"@/components/SettingsProvider/backends/settingsBackendFactory\";\n\ntype Props = PropsWithChildren &\n SupportedSettingsBackend & {\n id?: string;\n } & Pick<SettingsStoreOptions, \"middleware\">;\n\nconst context = createContext<SettingsStore | undefined>(undefined);\n\nexport const useSettings = () => useContext(context);\n\nexport const SettingsProvider: FC<Props> = (props) => {\n const { children, middleware, id = \"static\", ...storeShape } = props;\n const backend = settingsBackendFactory(storeShape);\n\n const settingsResource = getAsyncResource(() => backend.load(), [], {\n loaderId: id,\n });\n const settings = settingsResource.use();\n\n const storingPromise = useRef(Promise.resolve());\n const parentStore = useSettings();\n\n const settingsStore = useMemo(\n () => SettingsStore.fromJson(settings, { middleware, parentStore }),\n [id],\n );\n\n const watchAndStoreSettings = () => {\n const json = settingsStore.asJson;\n storingPromise.current = storingPromise.current.then(async () => {\n await backend.store(json);\n settingsResource.refresh();\n });\n };\n\n useEffect(() => autorun(watchAndStoreSettings), [id]);\n\n return <context.Provider value={settingsStore}>{children}</context.Provider>;\n};\n\nexport default SettingsProvider;\n"],"mappings":";;;;;;;;;AAgBA,IAAM,UAAU,cAAyC,KAAA,CAAS;AAElE,IAAa,oBAAoB,WAAW,OAAO;
|
|
1
|
+
{"version":3,"file":"SettingsProvider.mjs","names":[],"sources":["../../../../../../../src/components/SettingsProvider/SettingsProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { createContext, useContext, useEffect, useMemo, useRef } from \"react\";\nimport type { SupportedSettingsBackend } from \"@/components/SettingsProvider/backends/types\";\nimport { autorun } from \"mobx\";\nimport { getAsyncResource } from \"@mittwald/react-use-promise\";\nimport {\n SettingsStore,\n type SettingsStoreOptions,\n} from \"@/components/SettingsProvider/models/SettingsStore\";\nimport { settingsBackendFactory } from \"@/components/SettingsProvider/backends/settingsBackendFactory\";\n\ntype Props = PropsWithChildren &\n SupportedSettingsBackend & {\n id?: string;\n } & Pick<SettingsStoreOptions, \"middleware\">;\n\nconst context = createContext<SettingsStore | undefined>(undefined);\n\nexport const useSettings = () => useContext(context);\n\n/* Plain FC: app-level setup without own UI. */\nexport const SettingsProvider: FC<Props> = (props) => {\n const { children, middleware, id = \"static\", ...storeShape } = props;\n const backend = settingsBackendFactory(storeShape);\n\n const settingsResource = getAsyncResource(() => backend.load(), [], {\n loaderId: id,\n });\n const settings = settingsResource.use();\n\n const storingPromise = useRef(Promise.resolve());\n const parentStore = useSettings();\n\n const settingsStore = useMemo(\n () => SettingsStore.fromJson(settings, { middleware, parentStore }),\n // eslint-disable-next-line react-hooks/exhaustive-deps -- one store per settings id\n [id],\n );\n\n const watchAndStoreSettings = () => {\n const json = settingsStore.asJson;\n storingPromise.current = storingPromise.current.then(async () => {\n await backend.store(json);\n settingsResource.refresh();\n });\n };\n\n // eslint-disable-next-line react-hooks/exhaustive-deps -- one autorun per settings id\n useEffect(() => autorun(watchAndStoreSettings), [id]);\n\n return <context.Provider value={settingsStore}>{children}</context.Provider>;\n};\n\nexport default SettingsProvider;\n"],"mappings":";;;;;;;;;AAgBA,IAAM,UAAU,cAAyC,KAAA,CAAS;AAElE,IAAa,oBAAoB,WAAW,OAAO;AAGnD,IAAa,oBAA+B,UAAU;CACpD,MAAM,EAAE,UAAU,YAAY,KAAK,UAAU,GAAG,eAAe;CAC/D,MAAM,UAAU,uBAAuB,UAAU;CAEjD,MAAM,mBAAmB,uBAAuB,QAAQ,KAAK,GAAG,CAAC,GAAG,EAClE,UAAU,GACZ,CAAC;CACD,MAAM,WAAW,iBAAiB,IAAI;CAEtC,MAAM,iBAAiB,OAAO,QAAQ,QAAQ,CAAC;CAC/C,MAAM,cAAc,YAAY;CAEhC,MAAM,gBAAgB,cACd,cAAc,SAAS,UAAU;EAAE;EAAY;CAAY,CAAC,GAElE,CAAC,EAAE,CACL;CAEA,MAAM,8BAA8B;EAClC,MAAM,OAAO,cAAc;EAC3B,eAAe,UAAU,eAAe,QAAQ,KAAK,YAAY;GAC/D,MAAM,QAAQ,MAAM,IAAI;GACxB,iBAAiB,QAAQ;EAC3B,CAAC;CACH;CAGA,gBAAgB,QAAQ,qBAAqB,GAAG,CAAC,EAAE,CAAC;CAEpD,OAAO,oBAAC,QAAQ,UAAT;EAAkB,OAAO;EAAgB;CAA2B,CAAA;AAC7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SuspenseTrigger.mjs","names":[],"sources":["../../../../../../../src/components/SuspenseTrigger/SuspenseTrigger.tsx"],"sourcesContent":["import { lazy, type ComponentType, type FC } from \"react\";\n\nexport interface SuspenseTriggerProps {\n show?: boolean;\n}\n\nconst nonResolvingPromise = new Promise<{ default: ComponentType<unknown> }>(\n () => {\n // no resolve\n },\n);\n\nconst NonResolvingLazy = lazy(() => nonResolvingPromise);\n\nexport const SuspenseTrigger: FC<SuspenseTriggerProps> = (props) => {\n const { show = true } = props;\n return show ? <NonResolvingLazy /> : null;\n};\n\nexport default SuspenseTrigger;\n"],"mappings":";;;;;AAMA,IAAM,sBAAsB,IAAI,cACxB,CAEN,CACF;AAEA,IAAM,mBAAmB,WAAW,mBAAmB;
|
|
1
|
+
{"version":3,"file":"SuspenseTrigger.mjs","names":[],"sources":["../../../../../../../src/components/SuspenseTrigger/SuspenseTrigger.tsx"],"sourcesContent":["import { lazy, type ComponentType, type FC } from \"react\";\n\nexport interface SuspenseTriggerProps {\n show?: boolean;\n}\n\nconst nonResolvingPromise = new Promise<{ default: ComponentType<unknown> }>(\n () => {\n // no resolve\n },\n);\n\nconst NonResolvingLazy = lazy(() => nonResolvingPromise);\n\n/* Plain FC: transparent render utility. */\nexport const SuspenseTrigger: FC<SuspenseTriggerProps> = (props) => {\n const { show = true } = props;\n return show ? <NonResolvingLazy /> : null;\n};\n\nexport default SuspenseTrigger;\n"],"mappings":";;;;;AAMA,IAAM,sBAAsB,IAAI,cACxB,CAEN,CACF;AAEA,IAAM,mBAAmB,WAAW,mBAAmB;AAGvD,IAAa,mBAA6C,UAAU;CAClE,MAAM,EAAE,OAAO,SAAS;CACxB,OAAO,OAAO,oBAAC,kBAAD,CAAmB,CAAA,IAAI;AACvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.mjs","names":["styles","locales"],"sources":["../../../../../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport styles from \"./TextArea.module.scss\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport {\n type PropsWithChildren,\n useEffect,\n useLayoutEffect,\n useState,\n} from \"react\";\nimport { useControlledHostValueProps } from \"@/lib/remote/useControlledHostValueProps\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider/useLocalizedStringFormatter\";\nimport locales from \"./locales/*.locale.json\";\nimport { FieldDescription } from \"@/components/FieldDescription\";\nimport { useWarnDeprecation } from \"@/components/DeprecationWarningProvider\";\n\nexport interface TextAreaProps\n extends\n PropsWithChildren<Omit<Aria.TextFieldProps, \"children\">>,\n Pick<Aria.TextAreaProps, \"placeholder\" | \"rows\" | \"aria-hidden\">,\n FlowComponentProps<HTMLTextAreaElement> {\n /** Whether a character count should be displayed inside the field description. */\n showCharacterCount?: boolean;\n /**\n * Whether the text area should grow if its content gets longer than its\n * initial height.\n */\n autoResizeMaxRows?: number;\n /** Allows the user to manually resize the textArea horizontally. */\n allowResize?: boolean | \"horizontal\" | \"vertical\";\n /** @deprecated Use `allowResize` instead. */\n allowHorizontalResize?: boolean;\n /** @deprecated Use `allowResize` instead. */\n allowVerticalResize?: boolean;\n}\n\n/** @flr-generate all */\nexport const TextArea = flowComponent(\"TextArea\", (props) => {\n const warnDeprecation = useWarnDeprecation();\n const {\n children,\n placeholder,\n rows = 5,\n autoResizeMaxRows = rows,\n ref,\n allowVerticalResize,\n allowHorizontalResize,\n showCharacterCount,\n className,\n onChange,\n isReadOnly,\n value,\n ...rest\n } = useControlledHostValueProps(props, \"\");\n\n if (allowHorizontalResize !== undefined) {\n warnDeprecation(\n \"The 'allowHorizontalResize' prop is deprecated and will be removed in a future release. Use 'allowResize' instead.\",\n );\n }\n if (allowVerticalResize !== undefined) {\n warnDeprecation(\n \"The 'allowVerticalResize' prop is deprecated and will be removed in a future release. Use 'allowResize' instead.\",\n );\n }\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n wrapperProps,\n controlProps,\n skeletonProps,\n } = useFieldComponent(props, \"TextArea\");\n\n let { allowResize } = props;\n if (allowVerticalResize) {\n allowResize = \"vertical\";\n } else if (allowHorizontalResize) {\n allowResize = \"horizontal\";\n }\n\n const rootClassName = clsx(wrapperProps.className, className);\n\n const inputClassName = clsx(\n styles.input,\n typeof allowResize === \"boolean\" && allowResize ? styles.resize : null,\n allowResize === \"horizontal\"\n ? styles.horizontalResize\n : allowResize === \"vertical\"\n ? styles.verticalResize\n : null,\n );\n\n const handleChange = (v: string) => {\n if (isReadOnly) {\n return;\n }\n\n if (onChange) {\n onChange(v);\n }\n };\n\n const translation = useLocalizedStringFormatter(locales, \"TextArea\");\n\n // Derived, so that a value the field never saw typed is counted as well.\n const charactersCountDescription = translation.format(\"characters\", {\n count: value.length,\n maxCount: props.maxLength ?? 0,\n });\n\n const localRef = useObjectRef(ref);\n\n const [resized, setResized] = useState(false);\n\n const autoResizable = rows !== autoResizeMaxRows;\n\n const verticallyResizable =\n allowResize && (!autoResizable || (autoResizable && resized));\n\n useEffect(() => {\n const textarea = localRef.current;\n if (!textarea) return;\n\n const startHeight = textarea.offsetHeight;\n let tracking = false;\n\n const handleMouseDown = () => {\n tracking = true;\n };\n\n const handleMouseMove = () => {\n if (!tracking || resized) return;\n\n const currentHeight = textarea.offsetHeight;\n\n if (currentHeight !== startHeight) {\n setResized(true);\n tracking = false;\n }\n };\n\n const handleMouseUp = () => {\n tracking = false;\n };\n\n window.addEventListener(\"mousedown\", handleMouseDown);\n window.addEventListener(\"mousemove\", handleMouseMove);\n window.addEventListener(\"mouseup\", handleMouseUp);\n\n return () => {\n window.removeEventListener(\"mousedown\", handleMouseDown);\n window.removeEventListener(\"mousemove\", handleMouseMove);\n window.removeEventListener(\"mouseup\", handleMouseUp);\n };\n }, [resized]);\n\n /*\n * The height depends on the rendered content, so it cannot be a style. It is\n * synced to the value instead of to the `change` event, because a value the\n * field never saw typed — an initial value, or a draft loaded into a\n * controlled field — has to resize it just the same.\n */\n useLayoutEffect(() => {\n const textArea = localRef.current;\n if (!textArea || !autoResizable || verticallyResizable) {\n return;\n }\n // https://stackoverflow.com/a/60795884\n textArea.style.height = \"0px\";\n // + 2 to add border height\n textArea.style.height = `${textArea.scrollHeight + 2}px`;\n }, [value, autoResizable, verticallyResizable]);\n\n return (\n <Aria.TextField\n {...rest}\n {...controlProps}\n {...skeletonProps}\n value={value}\n className={rootClassName}\n onChange={handleChange}\n >\n <PropsContextProvider props={fieldPropsContext}>\n <FieldErrorCaptureContext>{children}</FieldErrorCaptureContext>\n <Aria.TextArea\n rows={rows}\n {...(isReadOnly ? { \"data-readonly\": true } : {})}\n aria-readonly={isReadOnly}\n aria-hidden={props[\"aria-hidden\"]}\n placeholder={placeholder}\n className={inputClassName}\n ref={localRef}\n style={{\n \"--text-area--rows\": rows,\n \"--text-area--max-rows\": verticallyResizable\n ? undefined\n : autoResizeMaxRows,\n }}\n />\n {showCharacterCount && (\n <FieldDescription>{charactersCountDescription}</FieldDescription>\n )}\n <FieldErrorView />\n </PropsContextProvider>\n </Aria.TextField>\n );\n});\n\nexport default TextArea;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyCA,IAAa,WAAW,cAAc,aAAa,UAAU;CAC3D,MAAM,kBAAkB,mBAAmB;CAC3C,MAAM,EACJ,UACA,aACA,OAAO,GACP,oBAAoB,MACpB,KACA,qBACA,uBACA,oBACA,WACA,UACA,YACA,OACA,GAAG,SACD,4BAA4B,OAAO,EAAE;CAEzC,IAAI,0BAA0B,KAAA,GAC5B,gBACE,oHACF;CAEF,IAAI,wBAAwB,KAAA,GAC1B,gBACE,kHACF;CAGF,MAAM,EACJ,gBACA,0BACA,mBACA,cACA,cACA,kBACE,kBAAkB,OAAO,UAAU;CAEvC,IAAI,EAAE,gBAAgB;CACtB,IAAI,qBACF,cAAc;MACT,IAAI,uBACT,cAAc;CAGhB,MAAM,gBAAgB,KAAK,aAAa,WAAW,SAAS;CAE5D,MAAM,iBAAiB,KACrBA,wBAAO,OACP,OAAO,gBAAgB,aAAa,cAAcA,wBAAO,SAAS,MAClE,gBAAgB,eACZA,wBAAO,mBACP,gBAAgB,aACdA,wBAAO,iBACP,IACR;CAEA,MAAM,gBAAgB,MAAc;EAClC,IAAI,YACF;EAGF,IAAI,UACF,SAAS,CAAC;CAEd;CAKA,MAAM,6BAHc,4BAA4BC,kBAAS,UAGtB,CAAA,CAAY,OAAO,cAAc;EAClE,OAAO,MAAM;EACb,UAAU,MAAM,aAAa;CAC/B,CAAC;CAED,MAAM,WAAW,aAAa,GAAG;CAEjC,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAE5C,MAAM,gBAAgB,SAAS;CAE/B,MAAM,sBACJ,gBAAgB,CAAC,iBAAkB,iBAAiB;CAEtD,gBAAgB;EACd,MAAM,WAAW,SAAS;EAC1B,IAAI,CAAC,UAAU;EAEf,MAAM,cAAc,SAAS;EAC7B,IAAI,WAAW;EAEf,MAAM,wBAAwB;GAC5B,WAAW;EACb;EAEA,MAAM,wBAAwB;GAC5B,IAAI,CAAC,YAAY,SAAS;GAI1B,IAFsB,SAAS,iBAET,aAAa;IACjC,WAAW,IAAI;IACf,WAAW;GACb;EACF;EAEA,MAAM,sBAAsB;GAC1B,WAAW;EACb;EAEA,OAAO,iBAAiB,aAAa,eAAe;EACpD,OAAO,iBAAiB,aAAa,eAAe;EACpD,OAAO,iBAAiB,WAAW,aAAa;EAEhD,aAAa;GACX,OAAO,oBAAoB,aAAa,eAAe;GACvD,OAAO,oBAAoB,aAAa,eAAe;GACvD,OAAO,oBAAoB,WAAW,aAAa;EACrD;
|
|
1
|
+
{"version":3,"file":"TextArea.mjs","names":["styles","locales"],"sources":["../../../../../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport styles from \"./TextArea.module.scss\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport {\n type PropsWithChildren,\n useEffect,\n useLayoutEffect,\n useState,\n} from \"react\";\nimport { useControlledHostValueProps } from \"@/lib/remote/useControlledHostValueProps\";\nimport { useLocalizedStringFormatter } from \"@/components/TranslationProvider/useLocalizedStringFormatter\";\nimport locales from \"./locales/*.locale.json\";\nimport { FieldDescription } from \"@/components/FieldDescription\";\nimport { useWarnDeprecation } from \"@/components/DeprecationWarningProvider\";\n\nexport interface TextAreaProps\n extends\n PropsWithChildren<Omit<Aria.TextFieldProps, \"children\">>,\n Pick<Aria.TextAreaProps, \"placeholder\" | \"rows\" | \"aria-hidden\">,\n FlowComponentProps<HTMLTextAreaElement> {\n /** Whether a character count should be displayed inside the field description. */\n showCharacterCount?: boolean;\n /**\n * Whether the text area should grow if its content gets longer than its\n * initial height.\n */\n autoResizeMaxRows?: number;\n /** Allows the user to manually resize the textArea horizontally. */\n allowResize?: boolean | \"horizontal\" | \"vertical\";\n /** @deprecated Use `allowResize` instead. */\n allowHorizontalResize?: boolean;\n /** @deprecated Use `allowResize` instead. */\n allowVerticalResize?: boolean;\n}\n\n/** @flr-generate all */\nexport const TextArea = flowComponent(\"TextArea\", (props) => {\n const warnDeprecation = useWarnDeprecation();\n const {\n children,\n placeholder,\n rows = 5,\n autoResizeMaxRows = rows,\n ref,\n allowVerticalResize,\n allowHorizontalResize,\n showCharacterCount,\n className,\n onChange,\n isReadOnly,\n value,\n ...rest\n } = useControlledHostValueProps(props, \"\");\n\n if (allowHorizontalResize !== undefined) {\n warnDeprecation(\n \"The 'allowHorizontalResize' prop is deprecated and will be removed in a future release. Use 'allowResize' instead.\",\n );\n }\n if (allowVerticalResize !== undefined) {\n warnDeprecation(\n \"The 'allowVerticalResize' prop is deprecated and will be removed in a future release. Use 'allowResize' instead.\",\n );\n }\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n wrapperProps,\n controlProps,\n skeletonProps,\n } = useFieldComponent(props, \"TextArea\");\n\n let { allowResize } = props;\n if (allowVerticalResize) {\n allowResize = \"vertical\";\n } else if (allowHorizontalResize) {\n allowResize = \"horizontal\";\n }\n\n const rootClassName = clsx(wrapperProps.className, className);\n\n const inputClassName = clsx(\n styles.input,\n typeof allowResize === \"boolean\" && allowResize ? styles.resize : null,\n allowResize === \"horizontal\"\n ? styles.horizontalResize\n : allowResize === \"vertical\"\n ? styles.verticalResize\n : null,\n );\n\n const handleChange = (v: string) => {\n if (isReadOnly) {\n return;\n }\n\n if (onChange) {\n onChange(v);\n }\n };\n\n const translation = useLocalizedStringFormatter(locales, \"TextArea\");\n\n // Derived, so that a value the field never saw typed is counted as well.\n const charactersCountDescription = translation.format(\"characters\", {\n count: value.length,\n maxCount: props.maxLength ?? 0,\n });\n\n const localRef = useObjectRef(ref);\n\n const [resized, setResized] = useState(false);\n\n const autoResizable = rows !== autoResizeMaxRows;\n\n const verticallyResizable =\n allowResize && (!autoResizable || (autoResizable && resized));\n\n useEffect(() => {\n const textarea = localRef.current;\n if (!textarea) return;\n\n const startHeight = textarea.offsetHeight;\n let tracking = false;\n\n const handleMouseDown = () => {\n tracking = true;\n };\n\n const handleMouseMove = () => {\n if (!tracking || resized) return;\n\n const currentHeight = textarea.offsetHeight;\n\n if (currentHeight !== startHeight) {\n setResized(true);\n tracking = false;\n }\n };\n\n const handleMouseUp = () => {\n tracking = false;\n };\n\n window.addEventListener(\"mousedown\", handleMouseDown);\n window.addEventListener(\"mousemove\", handleMouseMove);\n window.addEventListener(\"mouseup\", handleMouseUp);\n\n return () => {\n window.removeEventListener(\"mousedown\", handleMouseDown);\n window.removeEventListener(\"mousemove\", handleMouseMove);\n window.removeEventListener(\"mouseup\", handleMouseUp);\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- the ref object follows the forwarded ref, which callers may pass inline\n }, [resized]);\n\n /*\n * The height depends on the rendered content, so it cannot be a style. It is\n * synced to the value instead of to the `change` event, because a value the\n * field never saw typed — an initial value, or a draft loaded into a\n * controlled field — has to resize it just the same.\n */\n useLayoutEffect(() => {\n const textArea = localRef.current;\n if (!textArea || !autoResizable || verticallyResizable) {\n return;\n }\n // https://stackoverflow.com/a/60795884\n textArea.style.height = \"0px\";\n // + 2 to add border height\n textArea.style.height = `${textArea.scrollHeight + 2}px`;\n // eslint-disable-next-line react-hooks/exhaustive-deps -- the ref object follows the forwarded ref, which callers may pass inline\n }, [value, autoResizable, verticallyResizable]);\n\n return (\n <Aria.TextField\n {...rest}\n {...controlProps}\n {...skeletonProps}\n value={value}\n className={rootClassName}\n onChange={handleChange}\n >\n <PropsContextProvider props={fieldPropsContext}>\n <FieldErrorCaptureContext>{children}</FieldErrorCaptureContext>\n <Aria.TextArea\n rows={rows}\n {...(isReadOnly ? { \"data-readonly\": true } : {})}\n aria-readonly={isReadOnly}\n aria-hidden={props[\"aria-hidden\"]}\n placeholder={placeholder}\n className={inputClassName}\n ref={localRef}\n style={{\n \"--text-area--rows\": rows,\n \"--text-area--max-rows\": verticallyResizable\n ? undefined\n : autoResizeMaxRows,\n }}\n />\n {showCharacterCount && (\n <FieldDescription>{charactersCountDescription}</FieldDescription>\n )}\n <FieldErrorView />\n </PropsContextProvider>\n </Aria.TextField>\n );\n});\n\nexport default TextArea;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyCA,IAAa,WAAW,cAAc,aAAa,UAAU;CAC3D,MAAM,kBAAkB,mBAAmB;CAC3C,MAAM,EACJ,UACA,aACA,OAAO,GACP,oBAAoB,MACpB,KACA,qBACA,uBACA,oBACA,WACA,UACA,YACA,OACA,GAAG,SACD,4BAA4B,OAAO,EAAE;CAEzC,IAAI,0BAA0B,KAAA,GAC5B,gBACE,oHACF;CAEF,IAAI,wBAAwB,KAAA,GAC1B,gBACE,kHACF;CAGF,MAAM,EACJ,gBACA,0BACA,mBACA,cACA,cACA,kBACE,kBAAkB,OAAO,UAAU;CAEvC,IAAI,EAAE,gBAAgB;CACtB,IAAI,qBACF,cAAc;MACT,IAAI,uBACT,cAAc;CAGhB,MAAM,gBAAgB,KAAK,aAAa,WAAW,SAAS;CAE5D,MAAM,iBAAiB,KACrBA,wBAAO,OACP,OAAO,gBAAgB,aAAa,cAAcA,wBAAO,SAAS,MAClE,gBAAgB,eACZA,wBAAO,mBACP,gBAAgB,aACdA,wBAAO,iBACP,IACR;CAEA,MAAM,gBAAgB,MAAc;EAClC,IAAI,YACF;EAGF,IAAI,UACF,SAAS,CAAC;CAEd;CAKA,MAAM,6BAHc,4BAA4BC,kBAAS,UAGtB,CAAA,CAAY,OAAO,cAAc;EAClE,OAAO,MAAM;EACb,UAAU,MAAM,aAAa;CAC/B,CAAC;CAED,MAAM,WAAW,aAAa,GAAG;CAEjC,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAE5C,MAAM,gBAAgB,SAAS;CAE/B,MAAM,sBACJ,gBAAgB,CAAC,iBAAkB,iBAAiB;CAEtD,gBAAgB;EACd,MAAM,WAAW,SAAS;EAC1B,IAAI,CAAC,UAAU;EAEf,MAAM,cAAc,SAAS;EAC7B,IAAI,WAAW;EAEf,MAAM,wBAAwB;GAC5B,WAAW;EACb;EAEA,MAAM,wBAAwB;GAC5B,IAAI,CAAC,YAAY,SAAS;GAI1B,IAFsB,SAAS,iBAET,aAAa;IACjC,WAAW,IAAI;IACf,WAAW;GACb;EACF;EAEA,MAAM,sBAAsB;GAC1B,WAAW;EACb;EAEA,OAAO,iBAAiB,aAAa,eAAe;EACpD,OAAO,iBAAiB,aAAa,eAAe;EACpD,OAAO,iBAAiB,WAAW,aAAa;EAEhD,aAAa;GACX,OAAO,oBAAoB,aAAa,eAAe;GACvD,OAAO,oBAAoB,aAAa,eAAe;GACvD,OAAO,oBAAoB,WAAW,aAAa;EACrD;CAEF,GAAG,CAAC,OAAO,CAAC;CAQZ,sBAAsB;EACpB,MAAM,WAAW,SAAS;EAC1B,IAAI,CAAC,YAAY,CAAC,iBAAiB,qBACjC;EAGF,SAAS,MAAM,SAAS;EAExB,SAAS,MAAM,SAAS,GAAG,SAAS,eAAe,EAAE;CAEvD,GAAG;EAAC;EAAO;EAAe;CAAmB,CAAC;CAE9C,OACE,oBAAC,KAAK,WAAN;EACE,GAAI;EACJ,GAAI;EACJ,GAAI;EACG;EACP,WAAW;EACX,UAAU;EAEV,UAAA,qBAAC,sBAAD;GAAsB,OAAO;GAA7B,UAAA;IACE,oBAAC,0BAAD,EAA2B,SAAmC,CAAA;IAC9D,oBAAC,KAAK,UAAN;KACQ;KACN,GAAK,aAAa,EAAE,iBAAiB,KAAK,IAAI,CAAC;KAC/C,iBAAe;KACf,eAAa,MAAM;KACN;KACb,WAAW;KACX,KAAK;KACL,OAAO;MACL,qBAAqB;MACrB,yBAAyB,sBACrB,KAAA,IACA;KACN;IACD,CAAA;IACA,sBACC,oBAAC,kBAAD,EAAA,UAAmB,2BAA6C,CAAA;IAElE,oBAAC,gBAAD,CAAiB,CAAA;GACG;;CACR,CAAA;AAEpB,CAAC"}
|
package/dist/js/packages/components/src/components/TranslationProvider/TranslationProvider.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationProvider.mjs","names":[],"sources":["../../../../../../../src/components/TranslationProvider/TranslationProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { createContext, useContext } from \"react\";\nimport type {\n LocalizedComponentName,\n TranslationFunction,\n} from \"@/components/TranslationProvider/useLocalizedStringFormatter\";\n\ntype ComponentTranslationDictionary = Record<\n LocalizedComponentName,\n Record<string, string>\n>;\n\nexport interface Translations {\n [locale: string]: ComponentTranslationDictionary | undefined;\n \"de-DE\"?: ComponentTranslationDictionary;\n \"en-US\"?: ComponentTranslationDictionary;\n}\n\nexport interface TranslationContext {\n translations?: Translations;\n translate?: TranslationFunction;\n}\n\nexport type TranslationProviderProps = PropsWithChildren & TranslationContext;\n\nconst context = createContext<TranslationContext>({});\n\nexport const useTranslationProvider = () => useContext(context);\n\n/** @flr-generate all */\nexport const TranslationProvider: FC<TranslationProviderProps> = (props) => {\n const { children, translations, translate } = props;\n\n return (\n <context.Provider value={{ translations, translate }}>\n {children}\n </context.Provider>\n );\n};\n\nexport default TranslationProvider;\n"],"mappings":";;;;;AAyBA,IAAM,UAAU,cAAkC,CAAC,CAAC;AAEpD,IAAa,+BAA+B,WAAW,OAAO;;
|
|
1
|
+
{"version":3,"file":"TranslationProvider.mjs","names":[],"sources":["../../../../../../../src/components/TranslationProvider/TranslationProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { createContext, useContext } from \"react\";\nimport type {\n LocalizedComponentName,\n TranslationFunction,\n} from \"@/components/TranslationProvider/useLocalizedStringFormatter\";\n\ntype ComponentTranslationDictionary = Record<\n LocalizedComponentName,\n Record<string, string>\n>;\n\nexport interface Translations {\n [locale: string]: ComponentTranslationDictionary | undefined;\n \"de-DE\"?: ComponentTranslationDictionary;\n \"en-US\"?: ComponentTranslationDictionary;\n}\n\nexport interface TranslationContext {\n translations?: Translations;\n translate?: TranslationFunction;\n}\n\nexport type TranslationProviderProps = PropsWithChildren & TranslationContext;\n\nconst context = createContext<TranslationContext>({});\n\nexport const useTranslationProvider = () => useContext(context);\n\n/* Plain FC: app-level setup without own UI. */\n/** @flr-generate all */\nexport const TranslationProvider: FC<TranslationProviderProps> = (props) => {\n const { children, translations, translate } = props;\n\n return (\n <context.Provider value={{ translations, translate }}>\n {children}\n </context.Provider>\n );\n};\n\nexport default TranslationProvider;\n"],"mappings":";;;;;AAyBA,IAAM,UAAU,cAAkC,CAAC,CAAC;AAEpD,IAAa,+BAA+B,WAAW,OAAO;;AAI9D,IAAa,uBAAqD,UAAU;CAC1E,MAAM,EAAE,UAAU,cAAc,cAAc;CAE9C,OACE,oBAAC,QAAQ,UAAT;EAAkB,OAAO;GAAE;GAAc;EAAU;EAChD;CACe,CAAA;AAEtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TunnelEntry.mjs","names":["TunnelEntry","ReactTunnelEntry"],"sources":["../../../../../../../src/components/TunnelEntry/TunnelEntry.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport { TunnelEntry as ReactTunnelEntry } from \"@mittwald/react-tunnel\";\nimport type { TunnelEntryProps } from \"@mittwald/react-tunnel\";\n\nexport type { TunnelEntryProps } from \"@mittwald/react-tunnel\";\n\n/**\n * @flr-generate all\n * @flr-ignore-props providerId\n */\nexport const TunnelEntry: FC<TunnelEntryProps> = (props) => (\n <ReactTunnelEntry {...props} />\n);\n\nexport default TunnelEntry;\n"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"TunnelEntry.mjs","names":["TunnelEntry","ReactTunnelEntry"],"sources":["../../../../../../../src/components/TunnelEntry/TunnelEntry.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport { TunnelEntry as ReactTunnelEntry } from \"@mittwald/react-tunnel\";\nimport type { TunnelEntryProps } from \"@mittwald/react-tunnel\";\n\nexport type { TunnelEntryProps } from \"@mittwald/react-tunnel\";\n\n/* Plain FC: transparent render utility. */\n/**\n * @flr-generate all\n * @flr-ignore-props providerId\n */\nexport const TunnelEntry: FC<TunnelEntryProps> = (props) => (\n <ReactTunnelEntry {...props} />\n);\n\nexport default TunnelEntry;\n"],"mappings":";;;;;;;;;AAWA,IAAaA,iBAAqC,UAChD,oBAACC,aAAD,EAAkB,GAAI,MAAQ,CAAA"}
|
package/dist/js/packages/components/src/components/UiComponentTunnel/UiComponentTunnelEntry.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiComponentTunnelEntry.mjs","names":[],"sources":["../../../../../../../src/components/UiComponentTunnel/UiComponentTunnelEntry.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport { TunnelEntry, type TunnelEntryProps } from \"@mittwald/react-tunnel\";\nimport { getTunnelProviderId } from \"./lib\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\n\nexport type UiComponentTunnelEntryProps = Omit<\n TunnelEntryProps,\n \"providerId\"\n> & {\n component: FlowComponentName;\n};\n\nexport const UiComponentTunnelEntry: FC<UiComponentTunnelEntryProps> = (\n props,\n) => {\n const { component, ...tunnelEntryProps } = props;\n return (\n <TunnelEntry\n {...tunnelEntryProps}\n providerId={getTunnelProviderId(component)}\n />\n );\n};\n"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"UiComponentTunnelEntry.mjs","names":[],"sources":["../../../../../../../src/components/UiComponentTunnel/UiComponentTunnelEntry.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport { TunnelEntry, type TunnelEntryProps } from \"@mittwald/react-tunnel\";\nimport { getTunnelProviderId } from \"./lib\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\n\nexport type UiComponentTunnelEntryProps = Omit<\n TunnelEntryProps,\n \"providerId\"\n> & {\n component: FlowComponentName;\n};\n\n/* Plain FC: factory infrastructure. */\nexport const UiComponentTunnelEntry: FC<UiComponentTunnelEntryProps> = (\n props,\n) => {\n const { component, ...tunnelEntryProps } = props;\n return (\n <TunnelEntry\n {...tunnelEntryProps}\n providerId={getTunnelProviderId(component)}\n />\n );\n};\n"],"mappings":";;;;;;AAaA,IAAa,0BACX,UACG;CACH,MAAM,EAAE,WAAW,GAAG,qBAAqB;CAC3C,OACE,oBAAC,aAAD;EACE,GAAI;EACJ,YAAY,oBAAoB,SAAS;CAC1C,CAAA;AAEL"}
|
package/dist/js/packages/components/src/components/UiComponentTunnel/UiComponentTunnelExit.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiComponentTunnelExit.mjs","names":[],"sources":["../../../../../../../src/components/UiComponentTunnel/UiComponentTunnelExit.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport { TunnelExit, type TunnelExitProps } from \"@mittwald/react-tunnel\";\nimport { getTunnelProviderId } from \"./lib\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\n\nexport type UiComponentTunnelExitProps = Omit<TunnelExitProps, \"providerId\"> & {\n component: FlowComponentName;\n};\n\nexport const UiComponentTunnelExit: FC<UiComponentTunnelExitProps> = (\n props,\n) => {\n const { component, ...tunnelExitProps } = props;\n return (\n <TunnelExit\n {...tunnelExitProps}\n providerId={getTunnelProviderId(component)}\n />\n );\n};\n"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"UiComponentTunnelExit.mjs","names":[],"sources":["../../../../../../../src/components/UiComponentTunnel/UiComponentTunnelExit.tsx"],"sourcesContent":["import type { FC } from \"react\";\nimport { TunnelExit, type TunnelExitProps } from \"@mittwald/react-tunnel\";\nimport { getTunnelProviderId } from \"./lib\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\n\nexport type UiComponentTunnelExitProps = Omit<TunnelExitProps, \"providerId\"> & {\n component: FlowComponentName;\n};\n\n/* Plain FC: factory infrastructure. */\nexport const UiComponentTunnelExit: FC<UiComponentTunnelExitProps> = (\n props,\n) => {\n const { component, ...tunnelExitProps } = props;\n return (\n <TunnelExit\n {...tunnelExitProps}\n providerId={getTunnelProviderId(component)}\n />\n );\n};\n"],"mappings":";;;;;;AAUA,IAAa,yBACX,UACG;CACH,MAAM,EAAE,WAAW,GAAG,oBAAoB;CAC1C,OACE,oBAAC,YAAD;EACE,GAAI;EACJ,YAAY,oBAAoB,SAAS;CAC1C,CAAA;AAEL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiComponentTunnelProvider.mjs","names":[],"sources":["../../../../../../../src/components/UiComponentTunnel/UiComponentTunnelProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { TunnelProvider } from \"@mittwald/react-tunnel\";\nimport { getTunnelProviderId } from \"./lib\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\n\nexport interface UiComponentTunnelProviderProps extends PropsWithChildren {\n component: FlowComponentName;\n}\n\nexport const UiComponentTunnelProvider: FC<UiComponentTunnelProviderProps> = (\n props,\n) => {\n const { children, component } = props;\n\n return (\n <TunnelProvider id={getTunnelProviderId(component)}>\n {children}\n </TunnelProvider>\n );\n};\n"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"UiComponentTunnelProvider.mjs","names":[],"sources":["../../../../../../../src/components/UiComponentTunnel/UiComponentTunnelProvider.tsx"],"sourcesContent":["import type { FC, PropsWithChildren } from \"react\";\nimport { TunnelProvider } from \"@mittwald/react-tunnel\";\nimport { getTunnelProviderId } from \"./lib\";\nimport type { FlowComponentName } from \"@/components/propTypes\";\n\nexport interface UiComponentTunnelProviderProps extends PropsWithChildren {\n component: FlowComponentName;\n}\n\n/* Plain FC: factory infrastructure. */\nexport const UiComponentTunnelProvider: FC<UiComponentTunnelProviderProps> = (\n props,\n) => {\n const { children, component } = props;\n\n return (\n <TunnelProvider id={getTunnelProviderId(component)}>\n {children}\n </TunnelProvider>\n );\n};\n"],"mappings":";;;;;;AAUA,IAAa,6BACX,UACG;CACH,MAAM,EAAE,UAAU,cAAc;CAEhC,OACE,oBAAC,gBAAD;EAAgB,IAAI,oBAAoB,SAAS;EAC9C;CACa,CAAA;AAEpB"}
|
|
@@ -9,7 +9,6 @@ var propsContextSupportingComponents = Object.keys({
|
|
|
9
9
|
Autocomplete: true,
|
|
10
10
|
Alert: true,
|
|
11
11
|
AlertBadge: true,
|
|
12
|
-
AlertIcon: true,
|
|
13
12
|
AlertText: true,
|
|
14
13
|
Align: true,
|
|
15
14
|
Combine: true,
|
|
@@ -58,6 +57,7 @@ var propsContextSupportingComponents = Object.keys({
|
|
|
58
57
|
List: true,
|
|
59
58
|
ListItemView: true,
|
|
60
59
|
ListSummary: true,
|
|
60
|
+
LoadingSpinner: true,
|
|
61
61
|
MarkdownEditor: true,
|
|
62
62
|
MenuItem: true,
|
|
63
63
|
MenuTrigger: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../src/components/propTypes/index.ts"],"sourcesContent":["import type { TextProps } from \"@/components/Text\";\nimport type { ButtonProps } from \"@/components/Button\";\nimport type { IconProps } from \"@/components/Icon\";\nimport type { LabelProps } from \"@/components/Label\";\nimport type { ContentProps } from \"@/components/Content\";\nimport type { LayoutCardProps } from \"@/components/LayoutCard\";\nimport type { LinkProps } from \"@/components/Link\";\nimport type { LightBoxProps } from \"@/components/LightBox\";\nimport type { FieldErrorProps } from \"@/components/FieldError\";\nimport type { FieldDescriptionProps } from \"@/components/FieldDescription\";\nimport type { AlertProps } from \"@/components/Alert\";\nimport type { HeadingProps } from \"@/components/Heading\";\nimport type { TabNavigationProps } from \"@/components/TabNavigation\";\nimport type { InitialsProps } from \"@/components/Initials\";\nimport type { ImageProps } from \"@/components/Image\";\nimport type { CopyButtonProps } from \"@/components/CopyButton\";\nimport type { HeaderProps } from \"@/components/Header/\";\nimport type { SwitchProps } from \"@/components/Switch\";\nimport type { AlertBadgeProps } from \"@/components/AlertBadge\";\nimport type { ActionGroupProps } from \"@/components/ActionGroup\";\nimport type { AvatarProps } from \"@/components/Avatar\";\nimport type { ActionProps } from \"@/components/Action\";\nimport type {\n ContextMenuProps,\n ContextMenuTriggerProps,\n MenuItemProps,\n} from \"@/components/ContextMenu\";\nimport type { SelectProps } from \"@/components/Select\";\nimport type {\n RadioButtonProps,\n RadioGroupProps,\n RadioProps,\n} from \"@/components/RadioGroup\";\nimport type { TextFieldProps } from \"@/components/TextField\";\nimport type { NumberFieldProps } from \"@/components/NumberField\";\nimport type { TextAreaProps } from \"@/components/TextArea\";\nimport type { CheckboxGroupProps } from \"@/components/CheckboxGroup\";\nimport type { CheckboxProps } from \"@/components/Checkbox\";\nimport type { CheckboxButtonProps } from \"@/components/CheckboxButton\";\nimport type { TabsProps } from \"@/components/Tabs\";\nimport type { ModalProps, ModalTriggerProps } from \"@/components/Modal\";\nimport type { SectionProps } from \"@/components/Section\";\nimport type { SliderProps } from \"@/components/Slider\";\nimport type { CounterBadgeProps } from \"@/components/CounterBadge\";\nimport type { FlowComponentName } from \"@/components/propTypes/types\";\nimport type {\n ContextualHelpProps,\n ContextualHelpTriggerProps,\n} from \"@/components/ContextualHelp\";\nimport type { CoachMarkProps } from \"@/components/CoachMark\";\nimport type { PopoverProps, PopoverTriggerProps } from \"@/components/Popover\";\nimport type { ContextMenuSectionProps } from \"@/components/ContextMenu/components/ContextMenuSection\";\nimport type { ListItemViewContentProps, ListProps } from \"@/components/List\";\nimport type { PasswordCreationFieldProps } from \"@/components/PasswordCreationField\";\nimport type { SearchFieldProps } from \"@/components/SearchField\";\nimport type { BadgeProps } from \"@/components/Badge\";\nimport type { DatePickerProps } from \"@/components/DatePicker\";\nimport type * as Aria from \"react-aria-components\";\nimport type { DateRangePickerProps } from \"@/components/DateRangePicker\";\nimport type { TimeFieldProps } from \"@/components/TimeField\";\nimport type { AlertIconProps } from \"@/components/AlertIcon\";\nimport type { ListSummaryProps } from \"@/components/List/components/ListSummary/ListSummary\";\nimport type { SegmentedControlProps } from \"@/components/SegmentedControl\";\nimport type { SegmentProps } from \"@/components/SegmentedControl/components/Segment\";\nimport type { FileCardProps } from \"@/components/FileCard\";\nimport type { FileFieldProps } from \"@/components/FileField\";\nimport type { AlignProps } from \"@/components/Align\";\nimport type { CombineProps } from \"@/components/Combine\";\nimport type { CountryOptionsProps } from \"@/components/CountryOptions\";\nimport type { ComboBoxProps } from \"@/components/ComboBox\";\nimport type { OptionProps } from \"@/components/Option\";\nimport type { MessageProps } from \"@/components/Message\";\nimport type { MessageThreadProps } from \"@/components/MessageThread\";\nimport type { FileCardListProps } from \"@/components/FileCardList\";\nimport type { AccentBoxProps } from \"@/components/AccentBox\";\nimport type { ColumnLayoutProps } from \"@/components/ColumnLayout\";\nimport type {\n DialogTriggerProps,\n MenuTriggerProps,\n} from \"@/components/OverlayTrigger\";\nimport type { ProgressBarProps } from \"@/components/ProgressBar\";\nimport type { FileDropZoneProps } from \"@/components/FileDropZone\";\nimport type { NavigationProps } from \"@/components/Navigation\";\nimport type { NavigationGroupProps } from \"@/components/Navigation/components/NavigationGroup\";\nimport type { AutocompleteProps } from \"@/components/Autocomplete/Autocomplete\";\nimport type { OptionsProps } from \"@/components/Options/Options\";\nimport type { MarkdownEditorProps } from \"@/components/MarkdownEditor\";\nimport type { AlertTextProps } from \"@/components/AlertText\";\nimport type { IllustratedMessageProps } from \"@/components/IllustratedMessage\";\nimport type { RatingProps } from \"@/components/Rating\";\nimport type { RatingSegmentProps } from \"@/components/Rating/components/RatingSegment\";\nimport type { CodeEditorProps } from \"@/components/CodeEditor\";\nimport type { KbdProps } from \"@/components/Kbd/Kbd\";\nimport type { AccordionProps } from \"@/components/Accordion\";\nimport type { AccordionGroupProps } from \"@/components/AccordionGroup\";\nimport type { ChatProps } from \"@/components/Chat\";\nimport type { SectionHeaderProps } from \"@/components/Section/components/SectionHeader/SectionHeader\";\nimport type {\n LightBoxGalleryItemProps,\n LightBoxGalleryProps,\n} from \"@/components/LightBox\";\n\nexport * from \"./types\";\n\nexport interface FlowComponentPropsTypes {\n AccentBox: AccentBoxProps;\n Action: ActionProps;\n ActionGroup: ActionGroupProps;\n Accordion: AccordionProps;\n AccordionGroup: AccordionGroupProps;\n Alert: AlertProps;\n AlertBadge: AlertBadgeProps;\n AlertIcon: AlertIconProps;\n AlertText: AlertTextProps;\n Align: AlignProps;\n Combine: CombineProps;\n Avatar: AvatarProps;\n Autocomplete: AutocompleteProps;\n Badge: BadgeProps;\n Button: ButtonProps;\n CodeEditor: CodeEditorProps;\n Chat: ChatProps;\n Checkbox: CheckboxProps;\n CheckboxButton: CheckboxButtonProps;\n CheckboxGroup: CheckboxGroupProps;\n ColumnLayout: ColumnLayoutProps;\n ComboBox: ComboBoxProps;\n Content: ContentProps;\n ContextMenu: ContextMenuProps;\n ContextMenuSection: ContextMenuSectionProps;\n ContextMenuTrigger: ContextMenuTriggerProps;\n CoachMark: CoachMarkProps;\n ContextualHelp: ContextualHelpProps;\n ContextualHelpTrigger: ContextualHelpTriggerProps;\n CopyButton: CopyButtonProps;\n CounterBadge: CounterBadgeProps;\n CountryOptions: CountryOptionsProps;\n DatePicker: DatePickerProps<Aria.DateValue>;\n DateRangePicker: DateRangePickerProps<Aria.DateValue>;\n DialogTrigger: DialogTriggerProps;\n FieldDescription: FieldDescriptionProps;\n FieldError: FieldErrorProps;\n FileCard: FileCardProps;\n FileCardList: FileCardListProps;\n FileField: FileFieldProps;\n FileDropZone: FileDropZoneProps;\n Header: HeaderProps;\n Heading: HeadingProps;\n TabNavigation: TabNavigationProps;\n Icon: IconProps;\n IllustratedMessage: IllustratedMessageProps;\n Image: ImageProps;\n Initials: InitialsProps;\n Label: LabelProps;\n LayoutCard: LayoutCardProps;\n LightBox: LightBoxProps;\n LightBoxGallery: LightBoxGalleryProps;\n LightBoxGalleryItem: LightBoxGalleryItemProps;\n Link: LinkProps;\n List: ListProps<never>;\n ListItemView: ListItemViewContentProps;\n ListSummary: ListSummaryProps;\n MarkdownEditor: MarkdownEditorProps;\n MenuItem: MenuItemProps;\n MenuTrigger: MenuTriggerProps;\n Message: MessageProps;\n MessageThread: MessageThreadProps;\n Modal: ModalProps;\n ModalTrigger: ModalTriggerProps;\n Navigation: NavigationProps;\n NavigationGroup: NavigationGroupProps;\n NumberField: NumberFieldProps;\n Option: OptionProps;\n Options: OptionsProps;\n Popover: PopoverProps;\n PopoverTrigger: PopoverTriggerProps;\n PasswordCreationField: PasswordCreationFieldProps;\n ProgressBar: ProgressBarProps;\n Radio: RadioProps;\n RadioButton: RadioButtonProps;\n RadioGroup: RadioGroupProps;\n Rating: RatingProps;\n RatingSegment: RatingSegmentProps;\n SearchField: SearchFieldProps;\n Section: SectionProps;\n Segment: SegmentProps;\n SegmentedControl: SegmentedControlProps;\n Select: SelectProps;\n Kbd: KbdProps;\n SectionHeader: SectionHeaderProps;\n Slider: SliderProps;\n Switch: SwitchProps;\n Tabs: TabsProps;\n TabTitle: TabsProps;\n Text: TextProps;\n TextArea: TextAreaProps;\n TextField: TextFieldProps;\n TimeField: TimeFieldProps;\n}\n\nconst propsContextSupportingComponentsMap: Record<\n keyof FlowComponentPropsTypes,\n true\n> = {\n AccentBox: true,\n Action: true,\n ActionGroup: true,\n Accordion: true,\n AccordionGroup: true,\n Avatar: true,\n Autocomplete: true,\n Alert: true,\n AlertBadge: true,\n AlertIcon: true,\n AlertText: true,\n Align: true,\n Combine: true,\n Badge: true,\n Button: true,\n CodeEditor: true,\n Chat: true,\n Checkbox: true,\n CheckboxButton: true,\n CheckboxGroup: true,\n ColumnLayout: true,\n ComboBox: true,\n Content: true,\n ContextMenu: true,\n ContextMenuSection: true,\n ContextMenuTrigger: true,\n CoachMark: true,\n ContextualHelp: true,\n ContextualHelpTrigger: true,\n CopyButton: true,\n CounterBadge: true,\n CountryOptions: true,\n DatePicker: true,\n DateRangePicker: true,\n DialogTrigger: true,\n FieldDescription: true,\n FieldError: true,\n FileCard: true,\n FileCardList: true,\n FileField: true,\n FileDropZone: true,\n Header: true,\n Heading: true,\n TabNavigation: true,\n Icon: true,\n IllustratedMessage: true,\n Image: true,\n Initials: true,\n Kbd: true,\n Label: true,\n LayoutCard: true,\n LightBox: true,\n LightBoxGallery: true,\n LightBoxGalleryItem: true,\n Link: true,\n List: true,\n ListItemView: true,\n ListSummary: true,\n MarkdownEditor: true,\n MenuItem: true,\n MenuTrigger: true,\n Message: true,\n MessageThread: true,\n Modal: true,\n ModalTrigger: true,\n Navigation: true,\n NavigationGroup: true,\n NumberField: true,\n Radio: true,\n Option: true,\n Options: true,\n Popover: true,\n PopoverTrigger: true,\n PasswordCreationField: true,\n ProgressBar: true,\n RadioButton: true,\n RadioGroup: true,\n Rating: true,\n RatingSegment: true,\n SearchField: true,\n Section: true,\n SectionHeader: true,\n Segment: true,\n SegmentedControl: true,\n Select: true,\n Slider: true,\n Switch: true,\n Tabs: true,\n TabTitle: true,\n TestComponent: true,\n Text: true,\n TextArea: true,\n TextField: true,\n TimeField: true,\n};\n\nexport const propsContextSupportingComponents = Object.keys(\n propsContextSupportingComponentsMap,\n) as FlowComponentName[];\n"],"mappings":";AA4SA,IAAa,mCAAmC,OAAO,KACrD;CAjGA,WAAW;CACX,QAAQ;CACR,aAAa;CACb,WAAW;CACX,gBAAgB;CAChB,QAAQ;CACR,cAAc;CACd,OAAO;CACP,YAAY;CACZ,WAAW;CACX,WAAW;CACX,OAAO;CACP,SAAS;CACT,OAAO;CACP,QAAQ;CACR,YAAY;CACZ,MAAM;CACN,UAAU;CACV,gBAAgB;CAChB,eAAe;CACf,cAAc;CACd,UAAU;CACV,SAAS;CACT,aAAa;CACb,oBAAoB;CACpB,oBAAoB;CACpB,WAAW;CACX,gBAAgB;CAChB,uBAAuB;CACvB,YAAY;CACZ,cAAc;CACd,gBAAgB;CAChB,YAAY;CACZ,iBAAiB;CACjB,eAAe;CACf,kBAAkB;CAClB,YAAY;CACZ,UAAU;CACV,cAAc;CACd,WAAW;CACX,cAAc;CACd,QAAQ;CACR,SAAS;CACT,eAAe;CACf,MAAM;CACN,oBAAoB;CACpB,OAAO;CACP,UAAU;CACV,KAAK;CACL,OAAO;CACP,YAAY;CACZ,UAAU;CACV,iBAAiB;CACjB,qBAAqB;CACrB,MAAM;CACN,MAAM;CACN,cAAc;CACd,aAAa;CACb,gBAAgB;CAChB,UAAU;CACV,aAAa;CACb,SAAS;CACT,eAAe;CACf,OAAO;CACP,cAAc;CACd,YAAY;CACZ,iBAAiB;CACjB,aAAa;CACb,OAAO;CACP,QAAQ;CACR,SAAS;CACT,SAAS;CACT,gBAAgB;CAChB,uBAAuB;CACvB,aAAa;CACb,aAAa;CACb,YAAY;CACZ,QAAQ;CACR,eAAe;CACf,aAAa;CACb,SAAS;CACT,eAAe;CACf,SAAS;CACT,kBAAkB;CAClB,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,MAAM;CACN,UAAU;CACV,eAAe;CACf,MAAM;CACN,UAAU;CACV,WAAW;CACX,WAAW;AAIX,CACF"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../../../../src/components/propTypes/index.ts"],"sourcesContent":["import type { TextProps } from \"@/components/Text\";\nimport type { ButtonProps } from \"@/components/Button\";\nimport type { IconProps } from \"@/components/Icon\";\nimport type { LabelProps } from \"@/components/Label\";\nimport type { ContentProps } from \"@/components/Content\";\nimport type { LayoutCardProps } from \"@/components/LayoutCard\";\nimport type { LinkProps } from \"@/components/Link\";\nimport type { LightBoxProps } from \"@/components/LightBox\";\nimport type { FieldErrorProps } from \"@/components/FieldError\";\nimport type { FieldDescriptionProps } from \"@/components/FieldDescription\";\nimport type { AlertProps } from \"@/components/Alert\";\nimport type { HeadingProps } from \"@/components/Heading\";\nimport type { TabNavigationProps } from \"@/components/TabNavigation\";\nimport type { InitialsProps } from \"@/components/Initials\";\nimport type { LoadingSpinnerProps } from \"@/components/LoadingSpinner\";\nimport type { ImageProps } from \"@/components/Image\";\nimport type { CopyButtonProps } from \"@/components/CopyButton\";\nimport type { HeaderProps } from \"@/components/Header/\";\nimport type { SwitchProps } from \"@/components/Switch\";\nimport type { AlertBadgeProps } from \"@/components/AlertBadge\";\nimport type { ActionGroupProps } from \"@/components/ActionGroup\";\nimport type { AvatarProps } from \"@/components/Avatar\";\nimport type { ActionProps } from \"@/components/Action\";\nimport type {\n ContextMenuProps,\n ContextMenuTriggerProps,\n MenuItemProps,\n} from \"@/components/ContextMenu\";\nimport type { SelectProps } from \"@/components/Select\";\nimport type {\n RadioButtonProps,\n RadioGroupProps,\n RadioProps,\n} from \"@/components/RadioGroup\";\nimport type { TextFieldProps } from \"@/components/TextField\";\nimport type { NumberFieldProps } from \"@/components/NumberField\";\nimport type { TextAreaProps } from \"@/components/TextArea\";\nimport type { CheckboxGroupProps } from \"@/components/CheckboxGroup\";\nimport type { CheckboxProps } from \"@/components/Checkbox\";\nimport type { CheckboxButtonProps } from \"@/components/CheckboxButton\";\nimport type { TabsProps } from \"@/components/Tabs\";\nimport type { ModalProps, ModalTriggerProps } from \"@/components/Modal\";\nimport type { SectionProps } from \"@/components/Section\";\nimport type { SliderProps } from \"@/components/Slider\";\nimport type { CounterBadgeProps } from \"@/components/CounterBadge\";\nimport type { FlowComponentName } from \"@/components/propTypes/types\";\nimport type {\n ContextualHelpProps,\n ContextualHelpTriggerProps,\n} from \"@/components/ContextualHelp\";\nimport type { CoachMarkProps } from \"@/components/CoachMark\";\nimport type { PopoverProps, PopoverTriggerProps } from \"@/components/Popover\";\nimport type { ContextMenuSectionProps } from \"@/components/ContextMenu/components/ContextMenuSection\";\nimport type { ListItemViewProps, ListProps } from \"@/components/List\";\nimport type { PasswordCreationFieldProps } from \"@/components/PasswordCreationField\";\nimport type { SearchFieldProps } from \"@/components/SearchField\";\nimport type { BadgeProps } from \"@/components/Badge\";\nimport type { DatePickerProps } from \"@/components/DatePicker\";\nimport type * as Aria from \"react-aria-components\";\nimport type { DateRangePickerProps } from \"@/components/DateRangePicker\";\nimport type { TimeFieldProps } from \"@/components/TimeField\";\nimport type { ListSummaryProps } from \"@/components/List/components/ListSummary/ListSummary\";\nimport type { SegmentedControlProps } from \"@/components/SegmentedControl\";\nimport type { SegmentProps } from \"@/components/SegmentedControl/components/Segment\";\nimport type { FileCardProps } from \"@/components/FileCard\";\nimport type { FileFieldProps } from \"@/components/FileField\";\nimport type { AlignProps } from \"@/components/Align\";\nimport type { CombineProps } from \"@/components/Combine\";\nimport type { CountryOptionsProps } from \"@/components/CountryOptions\";\nimport type { ComboBoxProps } from \"@/components/ComboBox\";\nimport type { OptionProps } from \"@/components/Option\";\nimport type { MessageProps } from \"@/components/Message\";\nimport type { MessageThreadProps } from \"@/components/MessageThread\";\nimport type { FileCardListProps } from \"@/components/FileCardList\";\nimport type { AccentBoxProps } from \"@/components/AccentBox\";\nimport type { ColumnLayoutProps } from \"@/components/ColumnLayout\";\nimport type {\n DialogTriggerProps,\n MenuTriggerProps,\n} from \"@/components/OverlayTrigger\";\nimport type { ProgressBarProps } from \"@/components/ProgressBar\";\nimport type { FileDropZoneProps } from \"@/components/FileDropZone\";\nimport type { NavigationProps } from \"@/components/Navigation\";\nimport type { NavigationGroupProps } from \"@/components/Navigation/components/NavigationGroup\";\nimport type { AutocompleteProps } from \"@/components/Autocomplete/Autocomplete\";\nimport type { OptionsProps } from \"@/components/Options/Options\";\nimport type { MarkdownEditorProps } from \"@/components/MarkdownEditor\";\nimport type { AlertTextProps } from \"@/components/AlertText\";\nimport type { IllustratedMessageProps } from \"@/components/IllustratedMessage\";\nimport type { RatingProps } from \"@/components/Rating\";\nimport type { RatingSegmentProps } from \"@/components/Rating/components/RatingSegment\";\nimport type { CodeEditorProps } from \"@/components/CodeEditor\";\nimport type { KbdProps } from \"@/components/Kbd/Kbd\";\nimport type { AccordionProps } from \"@/components/Accordion\";\nimport type { AccordionGroupProps } from \"@/components/AccordionGroup\";\nimport type { ChatProps } from \"@/components/Chat\";\nimport type { SectionHeaderProps } from \"@/components/Section/components/SectionHeader/SectionHeader\";\nimport type {\n LightBoxGalleryItemProps,\n LightBoxGalleryProps,\n} from \"@/components/LightBox\";\n\nexport * from \"./types\";\n\nexport interface FlowComponentPropsTypes {\n AccentBox: AccentBoxProps;\n Action: ActionProps;\n ActionGroup: ActionGroupProps;\n Accordion: AccordionProps;\n AccordionGroup: AccordionGroupProps;\n Alert: AlertProps;\n AlertBadge: AlertBadgeProps;\n AlertText: AlertTextProps;\n Align: AlignProps;\n Combine: CombineProps;\n Avatar: AvatarProps;\n Autocomplete: AutocompleteProps;\n Badge: BadgeProps;\n Button: ButtonProps;\n CodeEditor: CodeEditorProps;\n Chat: ChatProps;\n Checkbox: CheckboxProps;\n CheckboxButton: CheckboxButtonProps;\n CheckboxGroup: CheckboxGroupProps;\n ColumnLayout: ColumnLayoutProps;\n ComboBox: ComboBoxProps;\n Content: ContentProps;\n ContextMenu: ContextMenuProps;\n ContextMenuSection: ContextMenuSectionProps;\n ContextMenuTrigger: ContextMenuTriggerProps;\n CoachMark: CoachMarkProps;\n ContextualHelp: ContextualHelpProps;\n ContextualHelpTrigger: ContextualHelpTriggerProps;\n CopyButton: CopyButtonProps;\n CounterBadge: CounterBadgeProps;\n CountryOptions: CountryOptionsProps;\n DatePicker: DatePickerProps<Aria.DateValue>;\n DateRangePicker: DateRangePickerProps<Aria.DateValue>;\n DialogTrigger: DialogTriggerProps;\n FieldDescription: FieldDescriptionProps;\n FieldError: FieldErrorProps;\n FileCard: FileCardProps;\n FileCardList: FileCardListProps;\n FileField: FileFieldProps;\n FileDropZone: FileDropZoneProps;\n Header: HeaderProps;\n Heading: HeadingProps;\n TabNavigation: TabNavigationProps;\n Icon: IconProps;\n IllustratedMessage: IllustratedMessageProps;\n Image: ImageProps;\n Initials: InitialsProps;\n Label: LabelProps;\n LayoutCard: LayoutCardProps;\n LightBox: LightBoxProps;\n LightBoxGallery: LightBoxGalleryProps;\n LightBoxGalleryItem: LightBoxGalleryItemProps;\n Link: LinkProps;\n List: ListProps<never>;\n ListItemView: ListItemViewProps;\n ListSummary: ListSummaryProps;\n LoadingSpinner: LoadingSpinnerProps;\n MarkdownEditor: MarkdownEditorProps;\n MenuItem: MenuItemProps;\n MenuTrigger: MenuTriggerProps;\n Message: MessageProps;\n MessageThread: MessageThreadProps;\n Modal: ModalProps;\n ModalTrigger: ModalTriggerProps;\n Navigation: NavigationProps;\n NavigationGroup: NavigationGroupProps;\n NumberField: NumberFieldProps;\n Option: OptionProps;\n Options: OptionsProps;\n Popover: PopoverProps;\n PopoverTrigger: PopoverTriggerProps;\n PasswordCreationField: PasswordCreationFieldProps;\n ProgressBar: ProgressBarProps;\n Radio: RadioProps;\n RadioButton: RadioButtonProps;\n RadioGroup: RadioGroupProps;\n Rating: RatingProps;\n RatingSegment: RatingSegmentProps;\n SearchField: SearchFieldProps;\n Section: SectionProps;\n Segment: SegmentProps;\n SegmentedControl: SegmentedControlProps;\n Select: SelectProps;\n Kbd: KbdProps;\n SectionHeader: SectionHeaderProps;\n Slider: SliderProps;\n Switch: SwitchProps;\n Tabs: TabsProps;\n TabTitle: TabsProps;\n Text: TextProps;\n TextArea: TextAreaProps;\n TextField: TextFieldProps;\n TimeField: TimeFieldProps;\n}\n\nconst propsContextSupportingComponentsMap: Record<\n keyof FlowComponentPropsTypes,\n true\n> = {\n AccentBox: true,\n Action: true,\n ActionGroup: true,\n Accordion: true,\n AccordionGroup: true,\n Avatar: true,\n Autocomplete: true,\n Alert: true,\n AlertBadge: true,\n AlertText: true,\n Align: true,\n Combine: true,\n Badge: true,\n Button: true,\n CodeEditor: true,\n Chat: true,\n Checkbox: true,\n CheckboxButton: true,\n CheckboxGroup: true,\n ColumnLayout: true,\n ComboBox: true,\n Content: true,\n ContextMenu: true,\n ContextMenuSection: true,\n ContextMenuTrigger: true,\n CoachMark: true,\n ContextualHelp: true,\n ContextualHelpTrigger: true,\n CopyButton: true,\n CounterBadge: true,\n CountryOptions: true,\n DatePicker: true,\n DateRangePicker: true,\n DialogTrigger: true,\n FieldDescription: true,\n FieldError: true,\n FileCard: true,\n FileCardList: true,\n FileField: true,\n FileDropZone: true,\n Header: true,\n Heading: true,\n TabNavigation: true,\n Icon: true,\n IllustratedMessage: true,\n Image: true,\n Initials: true,\n Kbd: true,\n Label: true,\n LayoutCard: true,\n LightBox: true,\n LightBoxGallery: true,\n LightBoxGalleryItem: true,\n Link: true,\n List: true,\n ListItemView: true,\n ListSummary: true,\n LoadingSpinner: true,\n MarkdownEditor: true,\n MenuItem: true,\n MenuTrigger: true,\n Message: true,\n MessageThread: true,\n Modal: true,\n ModalTrigger: true,\n Navigation: true,\n NavigationGroup: true,\n NumberField: true,\n Radio: true,\n Option: true,\n Options: true,\n Popover: true,\n PopoverTrigger: true,\n PasswordCreationField: true,\n ProgressBar: true,\n RadioButton: true,\n RadioGroup: true,\n Rating: true,\n RatingSegment: true,\n SearchField: true,\n Section: true,\n SectionHeader: true,\n Segment: true,\n SegmentedControl: true,\n Select: true,\n Slider: true,\n Switch: true,\n Tabs: true,\n TabTitle: true,\n TestComponent: true,\n Text: true,\n TextArea: true,\n TextField: true,\n TimeField: true,\n};\n\nexport const propsContextSupportingComponents = Object.keys(\n propsContextSupportingComponentsMap,\n) as FlowComponentName[];\n"],"mappings":";AA4SA,IAAa,mCAAmC,OAAO,KACrD;CAjGA,WAAW;CACX,QAAQ;CACR,aAAa;CACb,WAAW;CACX,gBAAgB;CAChB,QAAQ;CACR,cAAc;CACd,OAAO;CACP,YAAY;CACZ,WAAW;CACX,OAAO;CACP,SAAS;CACT,OAAO;CACP,QAAQ;CACR,YAAY;CACZ,MAAM;CACN,UAAU;CACV,gBAAgB;CAChB,eAAe;CACf,cAAc;CACd,UAAU;CACV,SAAS;CACT,aAAa;CACb,oBAAoB;CACpB,oBAAoB;CACpB,WAAW;CACX,gBAAgB;CAChB,uBAAuB;CACvB,YAAY;CACZ,cAAc;CACd,gBAAgB;CAChB,YAAY;CACZ,iBAAiB;CACjB,eAAe;CACf,kBAAkB;CAClB,YAAY;CACZ,UAAU;CACV,cAAc;CACd,WAAW;CACX,cAAc;CACd,QAAQ;CACR,SAAS;CACT,eAAe;CACf,MAAM;CACN,oBAAoB;CACpB,OAAO;CACP,UAAU;CACV,KAAK;CACL,OAAO;CACP,YAAY;CACZ,UAAU;CACV,iBAAiB;CACjB,qBAAqB;CACrB,MAAM;CACN,MAAM;CACN,cAAc;CACd,aAAa;CACb,gBAAgB;CAChB,gBAAgB;CAChB,UAAU;CACV,aAAa;CACb,SAAS;CACT,eAAe;CACf,OAAO;CACP,cAAc;CACd,YAAY;CACZ,iBAAiB;CACjB,aAAa;CACb,OAAO;CACP,QAAQ;CACR,SAAS;CACT,SAAS;CACT,gBAAgB;CAChB,uBAAuB;CACvB,aAAa;CACb,aAAa;CACb,YAAY;CACZ,QAAQ;CACR,eAAe;CACf,aAAa;CACb,SAAS;CACT,eAAe;CACf,SAAS;CACT,kBAAkB;CAClB,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,MAAM;CACN,UAAU;CACV,eAAe;CACf,MAAM;CACN,UAAU;CACV,WAAW;CACX,WAAW;AAIX,CACF"}
|
package/dist/js/packages/components/src/integrations/react-hook-form/components/Form/Form.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.mjs","names":["RhfFormContextProvider"],"sources":["../../../../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"sourcesContent":["import { FormContextProvider } from \"@/integrations/react-hook-form/components/FormContextProvider/FormContextProvider\";\nimport { useComponentDefaults } from \"@/components/ComponentDefaultsProvider\";\nimport { type OverlayController, useModalController } from \"@/lib/controller\";\nimport {\n type BaseSyntheticEvent,\n type ComponentProps,\n type FC,\n type PropsWithChildren,\n type Ref,\n type SubmitEventHandler,\n useId,\n useMemo,\n useRef,\n} from \"react\";\nimport type {\n FieldValues,\n Path,\n SubmitHandler,\n UseFormReturn,\n} from \"react-hook-form\";\nimport { FormProvider as RhfFormContextProvider } from \"react-hook-form\";\nimport { useFormRootErrorController } from \"../FormRootError/useFormRootErrorController\";\nimport { FormRootError } from \"../../lib/FormRootError\";\nimport { useFormSettings } from \"../FormSettingsProvider/FormSettingsProvider\";\nimport {\n useFormSubmitController,\n type WithFormSubmitControllerProps,\n} from \"@/integrations/react-hook-form/components/Form/hooks/useFormSubmitController\";\nimport { useHotkeySubmit } from \"@/integrations/react-hook-form/components/Form/hooks/useHotkeySubmit\";\n\nexport type FormOnSubmitHandler<F extends FieldValues> = SubmitHandler<F>;\n\nexport type AfterFormSubmitCallback = (...unknownArgs: unknown[]) => unknown;\n\nexport interface FormAutoResetOptions {\n /**\n * Whether the form is reset to its default values after the surrounding modal\n * has closed.\n *\n * @default true\n */\n onAfterModalClose?: boolean;\n}\n\ntype FormComponentType = FC<\n PropsWithChildren<{\n id: string;\n onSubmit?: SubmitEventHandler | FormOnSubmitHandler<never>;\n ref?: Ref<HTMLFormElement>;\n }>\n>;\n\nexport interface FormProps<F extends FieldValues>\n extends\n Omit<ComponentProps<\"form\">, \"onSubmit\">,\n PropsWithChildren,\n WithFormSubmitControllerProps {\n /** The react-hook-form instance returned by `useForm()`. */\n form: UseFormReturn<F>;\n /**\n * Called with the validated form values when the form is submitted. Returning\n * a promise keeps the submit button pending until it settles.\n */\n onSubmit: FormOnSubmitHandler<F>;\n /**\n * The component rendered as the form element. Use it to render the form with\n * a routers form component. Defaults to a plain `<form />`.\n */\n formComponent?: FC<Omit<FormComponentType, \"ref\">>;\n /**\n * Whether all fields of the form can be read but not edited.\n *\n * @default false\n */\n isReadOnly?: boolean;\n /**\n * When the form is reset to its default values. `true` resets it after the\n * surrounding modal has closed, `false` never resets it.\n *\n * @default true\n */\n autoReset?: FormAutoResetOptions | boolean;\n /**\n * Whether closing the surrounding modal must be confirmed while the form has\n * unsaved changes. Overrides `Form.confirmModalCloseOnUnsavedChanges` of the\n * `ComponentDefaultsProvider`.\n *\n * @default true\n */\n confirmModalCloseOnUnsavedChanges?: boolean;\n}\n\nconst DefaultFormComponent: FormComponentType = (p) => <form {...p} />;\n\n/**\n * Runs `operation` while closing the surrounding Modal is allowed without a\n * confirmation, and drops that permission again as soon as the operation has\n * settled. Scoping it to the operation is what keeps a submit that only\n * advances a wizard step from disarming the confirmation for good (#2775).\n */\nconst runWithGrantedModalClose = (\n modalController: OverlayController,\n operation: () => unknown,\n): unknown => {\n const releaseGrant = modalController.grantCloseWithoutConfirmation();\n\n let result: unknown;\n try {\n result = operation();\n } catch (error) {\n releaseGrant();\n throw error;\n }\n\n if (result instanceof Promise) {\n return result.finally(releaseGrant);\n }\n releaseGrant();\n return result;\n};\n\nexport function Form<F extends FieldValues>(props: FormProps<F>) {\n const {\n form,\n children,\n onSubmit: onSubmitProp,\n formComponent = DefaultFormComponent,\n isReadOnly,\n ref,\n id: idProp,\n autoReset = true,\n confirmModalCloseOnUnsavedChanges: confirmModalCloseOnUnsavedChangesProp,\n submitController: submitControllerFromProps,\n ...formProps\n } = props;\n\n const newFormId = useId();\n const formId = idProp ?? newFormId;\n const FormComponent = useMemo(() => formComponent, [formId]);\n const afterSubmitCallback = useRef<AfterFormSubmitCallback>(undefined);\n const { isDirty } = form.formState;\n const rootErrorController = useFormRootErrorController();\n\n const defaultSubmitController = useFormSubmitController();\n const submitController = submitControllerFromProps\n ? submitControllerFromProps.submit.extend(defaultSubmitController)\n : defaultSubmitController;\n\n const autoResetOptions =\n typeof autoReset === \"boolean\"\n ? { onAfterModalClose: autoReset }\n : autoReset;\n\n const defaults = useComponentDefaults(\"Form\");\n const confirmModalCloseOnUnsavedChanges =\n confirmModalCloseOnUnsavedChangesProp ??\n defaults.confirmModalCloseOnUnsavedChanges;\n\n const modalController = useModalController();\n modalController.useUpdateOptions({\n // A dirty Form contributes one close confirmation source to the surrounding\n // Modal; sources are combined, so a clean Form does not overrule a\n // `<Modal confirmOnClose>`. The Modal renders the confirmation dialog.\n // A Form that switched it off contributes nothing at all.\n confirmOnClose: confirmModalCloseOnUnsavedChanges ? isDirty : undefined,\n });\n modalController.useOnClosed(() => {\n if (autoResetOptions?.onAfterModalClose) {\n form.reset();\n }\n });\n\n const { submitInterceptor } = useFormSettings();\n const onSubmit = submitInterceptor\n ? (values: F, event?: BaseSyntheticEvent) =>\n submitInterceptor<F>(onSubmitProp, values, { form, event })\n : onSubmitProp;\n\n const handleSubmitResult = (result: unknown) => {\n if (typeof result === \"function\") {\n afterSubmitCallback.current = result as AfterFormSubmitCallback;\n }\n const rootError = form.getFieldState(\"root\" as Path<F>)?.error;\n if (rootError && !rootErrorController.errorComponentMounted) {\n throw new FormRootError(rootError);\n }\n };\n\n const handleSubmit = async (e?: BaseSyntheticEvent | F): Promise<void> => {\n const formEvent =\n e && \"nativeEvent\" in e ? (e as BaseSyntheticEvent) : undefined;\n formEvent?.stopPropagation();\n\n // react-hook-form's submit handler resolves with an unknown value; the\n // submit controller only awaits it, so drop the result.\n await form.handleSubmit((values, event) =>\n runWithGrantedModalClose(modalController, () => {\n const submitResult = onSubmit(values, event);\n if (submitResult instanceof Promise) {\n return submitResult.then(handleSubmitResult);\n }\n handleSubmitResult(submitResult);\n }),\n )(formEvent);\n };\n submitController.submit.set(handleSubmit);\n\n const onAfterSuccessFeedback = () => {\n const callback = afterSubmitCallback.current;\n if (!callback) {\n return;\n }\n // The callback runs after the submit itself has finished (and after\n // SubmitButton's success feedback), so it needs its own permission to close\n // the Modal.\n runWithGrantedModalClose(modalController, callback);\n };\n\n const refWithHotkeySubmit = useHotkeySubmit({\n ref,\n submitController,\n });\n\n return (\n <RhfFormContextProvider {...form}>\n <FormContextProvider\n form={form as UseFormReturn}\n isReadOnly={isReadOnly}\n id={formId}\n onAfterSuccessFeedback={onAfterSuccessFeedback}\n rootErrorController={rootErrorController}\n >\n <FormComponent\n {...formProps}\n ref={refWithHotkeySubmit}\n id={formId}\n onSubmit={handleSubmit}\n >\n {children}\n </FormComponent>\n </FormContextProvider>\n </RhfFormContextProvider>\n );\n}\n\nexport default Form;\n"],"mappings":";;;;;;;;;;;;;;AA4FA,IAAM,wBAA2C,MAAM,oBAAC,QAAD,EAAM,GAAI,EAAI,CAAA;;;;;;;AAQrE,IAAM,4BACJ,iBACA,cACY;CACZ,MAAM,eAAe,gBAAgB,8BAA8B;CAEnE,IAAI;CACJ,IAAI;EACF,SAAS,UAAU;CACrB,SAAS,OAAO;EACd,aAAa;EACb,MAAM;CACR;CAEA,IAAI,kBAAkB,SACpB,OAAO,OAAO,QAAQ,YAAY;CAEpC,aAAa;CACb,OAAO;AACT;AAEA,SAAgB,KAA4B,OAAqB;CAC/D,MAAM,EACJ,MACA,UACA,UAAU,cACV,gBAAgB,sBAChB,YACA,KACA,IAAI,QACJ,YAAY,MACZ,mCAAmC,uCACnC,kBAAkB,2BAClB,GAAG,cACD;CAEJ,MAAM,YAAY,MAAM;CACxB,MAAM,SAAS,UAAU;CACzB,MAAM,gBAAgB,cAAc,eAAe,CAAC,MAAM,CAAC;CAC3D,MAAM,sBAAsB,OAAgC,KAAA,CAAS;CACrE,MAAM,EAAE,YAAY,KAAK;CACzB,MAAM,sBAAsB,2BAA2B;CAEvD,MAAM,0BAA0B,wBAAwB;CACxD,MAAM,mBAAmB,4BACrB,0BAA0B,OAAO,OAAO,uBAAuB,IAC/D;CAEJ,MAAM,mBACJ,OAAO,cAAc,YACjB,EAAE,mBAAmB,UAAU,IAC/B;CAEN,MAAM,WAAW,qBAAqB,MAAM;CAC5C,MAAM,oCACJ,yCACA,SAAS;CAEX,MAAM,kBAAkB,mBAAmB;CAC3C,gBAAgB,iBAAiB,EAK/B,gBAAgB,oCAAoC,UAAU,KAAA,EAChE,CAAC;CACD,gBAAgB,kBAAkB;EAChC,IAAI,kBAAkB,mBACpB,KAAK,MAAM;CAEf,CAAC;CAED,MAAM,EAAE,sBAAsB,gBAAgB;CAC9C,MAAM,WAAW,qBACZ,QAAW,UACV,kBAAqB,cAAc,QAAQ;EAAE;EAAM;CAAM,CAAC,IAC5D;CAEJ,MAAM,sBAAsB,WAAoB;EAC9C,IAAI,OAAO,WAAW,YACpB,oBAAoB,UAAU;EAEhC,MAAM,YAAY,KAAK,cAAc,MAAiB,CAAC,EAAE;EACzD,IAAI,aAAa,CAAC,oBAAoB,uBACpC,MAAM,IAAI,cAAc,SAAS;CAErC;CAEA,MAAM,eAAe,OAAO,MAA8C;EACxE,MAAM,YACJ,KAAK,iBAAiB,IAAK,IAA2B,KAAA;EACxD,WAAW,gBAAgB;EAI3B,MAAM,KAAK,cAAc,QAAQ,UAC/B,yBAAyB,uBAAuB;GAC9C,MAAM,eAAe,SAAS,QAAQ,KAAK;GAC3C,IAAI,wBAAwB,SAC1B,OAAO,aAAa,KAAK,kBAAkB;GAE7C,mBAAmB,YAAY;EACjC,CAAC,CACH,CAAC,CAAC,SAAS;CACb;CACA,iBAAiB,OAAO,IAAI,YAAY;CAExC,MAAM,+BAA+B;EACnC,MAAM,WAAW,oBAAoB;EACrC,IAAI,CAAC,UACH;EAKF,yBAAyB,iBAAiB,QAAQ;CACpD;CAEA,MAAM,sBAAsB,gBAAgB;EAC1C;EACA;CACF,CAAC;CAED,OACE,oBAACA,cAAD;EAAwB,GAAI;EAC1B,UAAA,oBAAC,qBAAD;GACQ;GACM;GACZ,IAAI;GACoB;GACH;GAErB,UAAA,oBAAC,eAAD;IACE,GAAI;IACJ,KAAK;IACL,IAAI;IACJ,UAAU;IAET;GACY,CAAA;EACI,CAAA;CACC,CAAA;AAE5B"}
|
|
1
|
+
{"version":3,"file":"Form.mjs","names":["RhfFormContextProvider"],"sources":["../../../../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"sourcesContent":["import { FormContextProvider } from \"@/integrations/react-hook-form/components/FormContextProvider/FormContextProvider\";\nimport { useComponentDefaults } from \"@/components/ComponentDefaultsProvider\";\nimport { type OverlayController, useModalController } from \"@/lib/controller\";\nimport {\n type BaseSyntheticEvent,\n type ComponentProps,\n type FC,\n type PropsWithChildren,\n type Ref,\n type SubmitEventHandler,\n useId,\n useMemo,\n useRef,\n} from \"react\";\nimport type {\n FieldValues,\n Path,\n SubmitHandler,\n UseFormReturn,\n} from \"react-hook-form\";\nimport { FormProvider as RhfFormContextProvider } from \"react-hook-form\";\nimport { useFormRootErrorController } from \"../FormRootError/useFormRootErrorController\";\nimport { FormRootError } from \"../../lib/FormRootError\";\nimport { useFormSettings } from \"../FormSettingsProvider/FormSettingsProvider\";\nimport {\n useFormSubmitController,\n type WithFormSubmitControllerProps,\n} from \"@/integrations/react-hook-form/components/Form/hooks/useFormSubmitController\";\nimport { useHotkeySubmit } from \"@/integrations/react-hook-form/components/Form/hooks/useHotkeySubmit\";\n\nexport type FormOnSubmitHandler<F extends FieldValues> = SubmitHandler<F>;\n\nexport type AfterFormSubmitCallback = (...unknownArgs: unknown[]) => unknown;\n\nexport interface FormAutoResetOptions {\n /**\n * Whether the form is reset to its default values after the surrounding modal\n * has closed.\n *\n * @default true\n */\n onAfterModalClose?: boolean;\n}\n\ntype FormComponentType = FC<\n PropsWithChildren<{\n id: string;\n onSubmit?: SubmitEventHandler | FormOnSubmitHandler<never>;\n ref?: Ref<HTMLFormElement>;\n }>\n>;\n\nexport interface FormProps<F extends FieldValues>\n extends\n Omit<ComponentProps<\"form\">, \"onSubmit\">,\n PropsWithChildren,\n WithFormSubmitControllerProps {\n /** The react-hook-form instance returned by `useForm()`. */\n form: UseFormReturn<F>;\n /**\n * Called with the validated form values when the form is submitted. Returning\n * a promise keeps the submit button pending until it settles.\n */\n onSubmit: FormOnSubmitHandler<F>;\n /**\n * The component rendered as the form element. Use it to render the form with\n * a routers form component. Defaults to a plain `<form />`.\n */\n formComponent?: FC<Omit<FormComponentType, \"ref\">>;\n /**\n * Whether all fields of the form can be read but not edited.\n *\n * @default false\n */\n isReadOnly?: boolean;\n /**\n * When the form is reset to its default values. `true` resets it after the\n * surrounding modal has closed, `false` never resets it.\n *\n * @default true\n */\n autoReset?: FormAutoResetOptions | boolean;\n /**\n * Whether closing the surrounding modal must be confirmed while the form has\n * unsaved changes. Overrides `Form.confirmModalCloseOnUnsavedChanges` of the\n * `ComponentDefaultsProvider`.\n *\n * @default true\n */\n confirmModalCloseOnUnsavedChanges?: boolean;\n}\n\nconst DefaultFormComponent: FormComponentType = (p) => <form {...p} />;\n\n/**\n * Runs `operation` while closing the surrounding Modal is allowed without a\n * confirmation, and drops that permission again as soon as the operation has\n * settled. Scoping it to the operation is what keeps a submit that only\n * advances a wizard step from disarming the confirmation for good (#2775).\n */\nconst runWithGrantedModalClose = (\n modalController: OverlayController,\n operation: () => unknown,\n): unknown => {\n const releaseGrant = modalController.grantCloseWithoutConfirmation();\n\n let result: unknown;\n try {\n result = operation();\n } catch (error) {\n releaseGrant();\n throw error;\n }\n\n if (result instanceof Promise) {\n return result.finally(releaseGrant);\n }\n releaseGrant();\n return result;\n};\n\nexport function Form<F extends FieldValues>(props: FormProps<F>) {\n const {\n form,\n children,\n onSubmit: onSubmitProp,\n formComponent = DefaultFormComponent,\n isReadOnly,\n ref,\n id: idProp,\n autoReset = true,\n confirmModalCloseOnUnsavedChanges: confirmModalCloseOnUnsavedChangesProp,\n submitController: submitControllerFromProps,\n ...formProps\n } = props;\n\n const newFormId = useId();\n const formId = idProp ?? newFormId;\n // eslint-disable-next-line react-hooks/exhaustive-deps -- keep the component identity per form, or the form remounts\n const FormComponent = useMemo(() => formComponent, [formId]);\n const afterSubmitCallback = useRef<AfterFormSubmitCallback>(undefined);\n const { isDirty } = form.formState;\n const rootErrorController = useFormRootErrorController();\n\n const defaultSubmitController = useFormSubmitController();\n const submitController = submitControllerFromProps\n ? submitControllerFromProps.submit.extend(defaultSubmitController)\n : defaultSubmitController;\n\n const autoResetOptions =\n typeof autoReset === \"boolean\"\n ? { onAfterModalClose: autoReset }\n : autoReset;\n\n const defaults = useComponentDefaults(\"Form\");\n const confirmModalCloseOnUnsavedChanges =\n confirmModalCloseOnUnsavedChangesProp ??\n defaults.confirmModalCloseOnUnsavedChanges;\n\n const modalController = useModalController();\n modalController.useUpdateOptions({\n // A dirty Form contributes one close confirmation source to the surrounding\n // Modal; sources are combined, so a clean Form does not overrule a\n // `<Modal confirmOnClose>`. The Modal renders the confirmation dialog.\n // A Form that switched it off contributes nothing at all.\n confirmOnClose: confirmModalCloseOnUnsavedChanges ? isDirty : undefined,\n });\n modalController.useOnClosed(() => {\n if (autoResetOptions?.onAfterModalClose) {\n form.reset();\n }\n });\n\n const { submitInterceptor } = useFormSettings();\n const onSubmit = submitInterceptor\n ? (values: F, event?: BaseSyntheticEvent) =>\n submitInterceptor<F>(onSubmitProp, values, { form, event })\n : onSubmitProp;\n\n const handleSubmitResult = (result: unknown) => {\n if (typeof result === \"function\") {\n afterSubmitCallback.current = result as AfterFormSubmitCallback;\n }\n const rootError = form.getFieldState(\"root\" as Path<F>)?.error;\n if (rootError && !rootErrorController.errorComponentMounted) {\n throw new FormRootError(rootError);\n }\n };\n\n const handleSubmit = async (e?: BaseSyntheticEvent | F): Promise<void> => {\n const formEvent =\n e && \"nativeEvent\" in e ? (e as BaseSyntheticEvent) : undefined;\n formEvent?.stopPropagation();\n\n // react-hook-form's submit handler resolves with an unknown value; the\n // submit controller only awaits it, so drop the result.\n await form.handleSubmit((values, event) =>\n runWithGrantedModalClose(modalController, () => {\n const submitResult = onSubmit(values, event);\n if (submitResult instanceof Promise) {\n return submitResult.then(handleSubmitResult);\n }\n handleSubmitResult(submitResult);\n }),\n )(formEvent);\n };\n submitController.submit.set(handleSubmit);\n\n const onAfterSuccessFeedback = () => {\n const callback = afterSubmitCallback.current;\n if (!callback) {\n return;\n }\n // The callback runs after the submit itself has finished (and after\n // SubmitButton's success feedback), so it needs its own permission to close\n // the Modal.\n runWithGrantedModalClose(modalController, callback);\n };\n\n const refWithHotkeySubmit = useHotkeySubmit({\n ref,\n submitController,\n });\n\n return (\n <RhfFormContextProvider {...form}>\n <FormContextProvider\n form={form as UseFormReturn}\n isReadOnly={isReadOnly}\n id={formId}\n onAfterSuccessFeedback={onAfterSuccessFeedback}\n rootErrorController={rootErrorController}\n >\n <FormComponent\n {...formProps}\n ref={refWithHotkeySubmit}\n id={formId}\n onSubmit={handleSubmit}\n >\n {children}\n </FormComponent>\n </FormContextProvider>\n </RhfFormContextProvider>\n );\n}\n\nexport default Form;\n"],"mappings":";;;;;;;;;;;;;;AA4FA,IAAM,wBAA2C,MAAM,oBAAC,QAAD,EAAM,GAAI,EAAI,CAAA;;;;;;;AAQrE,IAAM,4BACJ,iBACA,cACY;CACZ,MAAM,eAAe,gBAAgB,8BAA8B;CAEnE,IAAI;CACJ,IAAI;EACF,SAAS,UAAU;CACrB,SAAS,OAAO;EACd,aAAa;EACb,MAAM;CACR;CAEA,IAAI,kBAAkB,SACpB,OAAO,OAAO,QAAQ,YAAY;CAEpC,aAAa;CACb,OAAO;AACT;AAEA,SAAgB,KAA4B,OAAqB;CAC/D,MAAM,EACJ,MACA,UACA,UAAU,cACV,gBAAgB,sBAChB,YACA,KACA,IAAI,QACJ,YAAY,MACZ,mCAAmC,uCACnC,kBAAkB,2BAClB,GAAG,cACD;CAEJ,MAAM,YAAY,MAAM;CACxB,MAAM,SAAS,UAAU;CAEzB,MAAM,gBAAgB,cAAc,eAAe,CAAC,MAAM,CAAC;CAC3D,MAAM,sBAAsB,OAAgC,KAAA,CAAS;CACrE,MAAM,EAAE,YAAY,KAAK;CACzB,MAAM,sBAAsB,2BAA2B;CAEvD,MAAM,0BAA0B,wBAAwB;CACxD,MAAM,mBAAmB,4BACrB,0BAA0B,OAAO,OAAO,uBAAuB,IAC/D;CAEJ,MAAM,mBACJ,OAAO,cAAc,YACjB,EAAE,mBAAmB,UAAU,IAC/B;CAEN,MAAM,WAAW,qBAAqB,MAAM;CAC5C,MAAM,oCACJ,yCACA,SAAS;CAEX,MAAM,kBAAkB,mBAAmB;CAC3C,gBAAgB,iBAAiB,EAK/B,gBAAgB,oCAAoC,UAAU,KAAA,EAChE,CAAC;CACD,gBAAgB,kBAAkB;EAChC,IAAI,kBAAkB,mBACpB,KAAK,MAAM;CAEf,CAAC;CAED,MAAM,EAAE,sBAAsB,gBAAgB;CAC9C,MAAM,WAAW,qBACZ,QAAW,UACV,kBAAqB,cAAc,QAAQ;EAAE;EAAM;CAAM,CAAC,IAC5D;CAEJ,MAAM,sBAAsB,WAAoB;EAC9C,IAAI,OAAO,WAAW,YACpB,oBAAoB,UAAU;EAEhC,MAAM,YAAY,KAAK,cAAc,MAAiB,CAAC,EAAE;EACzD,IAAI,aAAa,CAAC,oBAAoB,uBACpC,MAAM,IAAI,cAAc,SAAS;CAErC;CAEA,MAAM,eAAe,OAAO,MAA8C;EACxE,MAAM,YACJ,KAAK,iBAAiB,IAAK,IAA2B,KAAA;EACxD,WAAW,gBAAgB;EAI3B,MAAM,KAAK,cAAc,QAAQ,UAC/B,yBAAyB,uBAAuB;GAC9C,MAAM,eAAe,SAAS,QAAQ,KAAK;GAC3C,IAAI,wBAAwB,SAC1B,OAAO,aAAa,KAAK,kBAAkB;GAE7C,mBAAmB,YAAY;EACjC,CAAC,CACH,CAAC,CAAC,SAAS;CACb;CACA,iBAAiB,OAAO,IAAI,YAAY;CAExC,MAAM,+BAA+B;EACnC,MAAM,WAAW,oBAAoB;EACrC,IAAI,CAAC,UACH;EAKF,yBAAyB,iBAAiB,QAAQ;CACpD;CAEA,MAAM,sBAAsB,gBAAgB;EAC1C;EACA;CACF,CAAC;CAED,OACE,oBAACA,cAAD;EAAwB,GAAI;EAC1B,UAAA,oBAAC,qBAAD;GACQ;GACM;GACZ,IAAI;GACoB;GACH;GAErB,UAAA,oBAAC,eAAD;IACE,GAAI;IACJ,KAAK;IACL,IAAI;IACJ,UAAU;IAET;GACY,CAAA;EACI,CAAA;CACC,CAAA;AAE5B"}
|