@mittwald/flow-react-components 1.5.0-next.31 → 1.5.0-next.33
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 +10 -1
- package/dist/assets/component-index.json +1 -1
- package/dist/assets/doc-properties.json +1 -1
- package/dist/js/packages/components/src/components/CartesianChart/components/ChartTooltip/TooltipLegendItem.mjs.map +1 -1
- package/dist/js/packages/components/src/components/CodeEditor/CodeEditor.mjs.map +1 -1
- package/dist/js/packages/components/src/components/CodeEditor/hooks/useCodeEditorExtensions.mjs +2 -2
- package/dist/js/packages/components/src/components/CodeEditor/hooks/useCodeEditorExtensions.mjs.map +1 -1
- package/dist/js/packages/components/src/components/CodeEditor/languages/index.mjs +2 -1
- package/dist/js/packages/components/src/components/CodeEditor/languages/index.mjs.map +1 -1
- package/dist/js/packages/components/src/lib/propsContext/nestedPropsContext/types.mjs.map +1 -1
- package/dist/js/packages/components/src/lib/propsContext/overlayTriggerTunnel.mjs.map +1 -1
- package/dist/js/packages/components/src/lib/types/props.mjs.map +1 -1
- package/dist/types/components/CartesianChart/components/ChartTooltip/TooltipLegendItem.d.ts +3 -1
- package/dist/types/components/CodeEditor/CodeEditor.d.ts +5 -2
- package/dist/types/components/CodeEditor/hooks/useCodeEditorExtensions.d.ts +32 -1
- package/dist/types/components/CodeEditor/languages/all.d.ts +1 -1
- package/dist/types/components/CodeEditor/languages/index.d.ts +1 -0
- package/dist/types/components/Modal/components/ModalTrigger/ModalTrigger.d.ts +1 -5
- package/dist/types/lib/dev/parkPointer.d.ts +1 -0
- package/dist/types/lib/propsContext/nestedPropsContext/types.d.ts +3 -0
- package/dist/types/lib/propsContext/overlayTriggerTunnel.d.ts +2 -2
- package/dist/types/lib/types/props.d.ts +14 -0
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipLegendItem.mjs","names":[],"sources":["../../../../../../../../../src/components/CartesianChart/components/ChartTooltip/TooltipLegendItem.tsx"],"sourcesContent":["import { LegendItem } from \"@/components/Legend/components/LegendItem\";\nimport type { FC } from \"react\";\nimport type { DefaultTooltipContentProps } from \"recharts\";\nimport type {\n NameType,\n ValueType,\n} from \"recharts/types/component/DefaultTooltipContent\";\nimport { usePromise } from \"@mittwald/react-use-promise\";\n\nimport type { ChartDataValue } from \"@/components/CartesianChart/types\";\nimport type { WithTooltipFormatters } from \"@/components/CartesianChart/components/ChartTooltip/types\";\n\
|
|
1
|
+
{"version":3,"file":"TooltipLegendItem.mjs","names":[],"sources":["../../../../../../../../../src/components/CartesianChart/components/ChartTooltip/TooltipLegendItem.tsx"],"sourcesContent":["import { LegendItem } from \"@/components/Legend/components/LegendItem\";\nimport type { FC } from \"react\";\nimport type { DefaultTooltipContentProps } from \"recharts\";\nimport type {\n NameType,\n ValueType,\n} from \"recharts/types/component/DefaultTooltipContent\";\nimport { usePromise } from \"@mittwald/react-use-promise\";\n\nimport type { ChartDataValue } from \"@/components/CartesianChart/types\";\nimport type { WithTooltipFormatters } from \"@/components/CartesianChart/components/ChartTooltip/types\";\n\nexport type TooltipPayloadItem = NonNullable<\n DefaultTooltipContentProps<ValueType, NameType>[\"payload\"]\n>[number];\n\n/** @internal */\ninterface LegendItemLabelProps<\n TData extends ChartDataValue = ChartDataValue,\n TTooltipLabelValue extends keyof TData = keyof TData,\n> extends Pick<WithTooltipFormatters<TData, TTooltipLabelValue>, \"formatter\"> {\n item: TooltipPayloadItem;\n index: number;\n}\n\n/** @internal */\nexport const TooltipLegendItem: FC<LegendItemLabelProps> = ({\n formatter,\n item,\n index,\n}) => {\n const { value, dataKey, unit, fill, name } = item;\n\n const formattedLabel = usePromise(\n (value, dataKey, index, unit, formatter, name) =>\n formatter\n ? formatter(value, String(name), index, unit)\n : `${name ?? \"\"} (${value ?? \"\"}${unit ? unit : \"\"})`,\n [value, dataKey, index, unit, formatter, name] as const,\n );\n\n return <LegendItem color={fill}>{formattedLabel}</LegendItem>;\n};\n"],"mappings":";;;;;;;AA0BA,IAAa,qBAA+C,EAC1D,WACA,MACA,YACI;CACJ,MAAM,EAAE,OAAO,SAAS,MAAM,MAAM,SAAS;CAE7C,MAAM,iBAAiB,YACpB,OAAO,SAAS,OAAO,MAAM,WAAW,SACvC,YACI,UAAU,OAAO,OAAO,IAAI,GAAG,OAAO,IAAI,IAC1C,GAAG,QAAQ,GAAG,IAAI,SAAS,KAAK,OAAO,OAAO,GAAG,IACvD;EAAC;EAAO;EAAS;EAAO;EAAM;EAAW;CAAI,CAC/C;CAEA,OAAO,oBAAC,YAAD;EAAY,OAAO;EAAO,UAAA;CAA2B,CAAA;AAC9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.mjs","names":["styles"],"sources":["../../../../../../../src/components/CodeEditor/CodeEditor.tsx"],"sourcesContent":["import type { ReactCodeMirrorProps } from \"@uiw/react-codemirror\";\nimport CodeMirror, { EditorView } from \"@uiw/react-codemirror\";\nimport { useCallback, useId, useState } from \"react\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport { useControlledHostValueProps } from \"@/lib/remote/useControlledHostValueProps\";\nimport { joinIds, useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport styles from \"./CodeEditor.module.scss\";\nimport { type CodeEditorLanguage } from \"@/components/CodeEditor/languages\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useObjectRef } from \"react-aria\";\nimport { defaultLightTheme } from \"@/components/CodeEditor/themes/defaultEditorTheme\";\nimport {\n type CodeEditorSetup,\n useCodeEditorExtensions,\n} from \"@/components/CodeEditor/hooks/useCodeEditorExtensions\";\nimport { CopyButton } from \"@/components/CopyButton\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\n\nexport interface CodeEditorProps\n extends\n Omit<ReactCodeMirrorProps, \"theme\" | \"lang\" | \"basicSetup\" | \"readOnly\">,\n CodeEditorSetup,\n FlowComponentProps {\n /** The initial code of an uncontrolled editor. */\n defaultValue?: string;\n /**\n * Whether the code can be read but not edited.\n *\n * @default false\n */\n isReadOnly?: boolean;\n /**\n * Whether the editor is disabled. The code can neither be edited, focused nor\n * copied.\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Whether the editor is displayed as invalid.\n *\n * @default false\n */\n isInvalid?: boolean;\n /** The elements class name. */\n className?: string;\n /** The language the code is highlighted as. */\n language?: CodeEditorLanguage;\n /**\n * Whether a button to copy the code to the clipboard is shown.\n *\n * @default true\n */\n copyable?: boolean;\n /**\n * Whether the field must be filled in. Only marks the editor as required for\n * assistive technology — the editor does not validate itself.\n *\n * @default false\n */\n isRequired?: boolean;\n /**\n * @internal Set by `<Field />` on every form field. The editor has no\n * react-aria validation to forward it to and drops it.\n */\n validationBehavior?: unknown;\n}\n\n/**\n * @flr-generate all\n * @flowStatus new\n */\nexport const CodeEditor = flowComponent(\"CodeEditor\", (props) => {\n const {\n ref,\n children,\n className,\n language,\n extensions,\n isReadOnly,\n isDisabled,\n isInvalid,\n isRequired,\n validationBehavior: _ignoredValidationBehavior,\n value,\n showLineNumbers = true,\n showCodeFolding = true,\n showCodeIndentationMakers = true,\n showLinterMarkers = true,\n showActiveLineMarker = true,\n copyable = true,\n height,\n minHeight,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...rest\n } = useControlledHostValueProps(props, \"\");\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n wrapperProps,\n controlProps,\n fieldPropsContext,\n } = useFieldComponent(props, \"CodeEditor\");\n\n const rootClassName = clsx(\n wrapperProps.className,\n styles.codeEditor,\n className,\n );\n\n const labelId = useId();\n const descriptionId = useId();\n\n /**\n * Both are optional. Their refs tell whether they are rendered, so the editor\n * never references an element that does not exist – a dangling id fails HTML\n * validators and a11y checks. The callbacks are stable: a new one per render\n * would detach and re-attach on every render.\n */\n const [hasLabel, setHasLabel] = useState(false);\n const [hasDescription, setHasDescription] = useState(false);\n const labelRef = useCallback((element: Element | null) => {\n setHasLabel(!!element);\n }, []);\n const descriptionRef = useCallback((element: Element | null) => {\n setHasDescription(!!element);\n }, []);\n\n /**\n * The label and the field description are declared as children of the code\n * editor, but must be rendered outside of the editor itself. They are\n * tunneled out of the editor – just like the field error. Their ids are the\n * ones the editor references.\n */\n const propsContext: PropsContext = {\n ...fieldPropsContext,\n Label: {\n ...fieldPropsContext.Label,\n id: labelId,\n ref: labelRef,\n tunnel: { id: \"label\", component: \"CodeEditor\" },\n },\n FieldDescription: {\n ...fieldPropsContext.FieldDescription,\n id: descriptionId,\n ref: descriptionRef,\n tunnel: { id: \"fieldDescription\", component: \"CodeEditor\" },\n },\n };\n\n const enabledExtensions = useCodeEditorExtensions(language, extensions, {\n showLineNumbers: showLineNumbers,\n showCodeIndentationMakers: showCodeIndentationMakers,\n showCodeFolding: showCodeFolding,\n showLinterMarkers: showLinterMarkers,\n });\n\n /**\n * The editable element of CodeMirror is the `.cm-content` element – not the\n * root element the props are applied to. Its ARIA attributes are set through\n * the content attributes facet.\n *\n * Without a label, an `aria-label` names the editor instead.\n */\n const labelledBy = joinIds(ariaLabelledBy, hasLabel && labelId);\n const describedBy = joinIds(\n hasDescription && descriptionId,\n controlProps[\"aria-describedby\"],\n );\n\n const contentAttributes = EditorView.contentAttributes.of({\n ...(labelledBy ? { \"aria-labelledby\": labelledBy } : {}),\n ...(ariaLabel ? { \"aria-label\": ariaLabel } : {}),\n ...(describedBy ? { \"aria-describedby\": describedBy } : {}),\n ...(isRequired ? { \"aria-required\": \"true\" } : {}),\n ...(isInvalid ? { \"aria-invalid\": \"true\" } : {}),\n ...(isDisabled ? { \"aria-disabled\": \"true\" } : {}),\n });\n\n const localRef = useObjectRef(ref);\n\n useMakeFocusable(localRef);\n\n return (\n <div className={rootClassName} data-disabled={isDisabled || undefined}>\n <PropsContextProvider props={propsContext}>\n <UiComponentTunnelExit id=\"label\" component=\"CodeEditor\" />\n <FieldErrorCaptureContext>\n <CodeMirror\n {...rest}\n value={value}\n basicSetup={{\n highlightActiveLine: showActiveLineMarker && !isDisabled,\n highlightActiveLineGutter: showActiveLineMarker && !isDisabled,\n autocompletion: false,\n lineNumbers: false,\n foldGutter: false,\n highlightSelectionMatches: false,\n }}\n theme={defaultLightTheme}\n data-invalid={isInvalid || undefined}\n data-disabled={isDisabled || undefined}\n readOnly={isReadOnly || isDisabled}\n editable={!isDisabled}\n className={clsx(styles.codeMirror, isReadOnly && styles.readonly)}\n ref={(codeMirrorRef) => {\n if (codeMirrorRef?.editor) {\n localRef.current = codeMirrorRef.editor;\n }\n }}\n extensions={[...enabledExtensions, contentAttributes]}\n height={height ?? minHeight}\n >\n {copyable && (\n <CopyButton\n className={styles.copyButton}\n size=\"s\"\n variant=\"soft\"\n text={value}\n isDisabled={isDisabled}\n />\n )}\n {children}\n </CodeMirror>\n </FieldErrorCaptureContext>\n <UiComponentTunnelExit id=\"fieldDescription\" component=\"CodeEditor\" />\n <FieldErrorView />\n </PropsContextProvider>\n </div>\n );\n});\n\nexport default CodeEditor;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6EA,IAAa,aAAa,cAAc,eAAe,UAAU;CAC/D,MAAM,EACJ,KACA,UACA,WACA,UACA,YACA,YACA,YACA,WACA,YACA,oBAAoB,4BACpB,OACA,kBAAkB,MAClB,kBAAkB,MAClB,4BAA4B,MAC5B,oBAAoB,MACpB,uBAAuB,MACvB,WAAW,MACX,QACA,WACA,cAAc,WACd,mBAAmB,gBACnB,GAAG,SACD,4BAA4B,OAAO,EAAE;CAEzC,MAAM,EACJ,gBACA,0BACA,cACA,cACA,sBACE,kBAAkB,OAAO,YAAY;CAEzC,MAAM,gBAAgB,KACpB,aAAa,WACbA,0BAAO,YACP,SACF;CAEA,MAAM,UAAU,MAAM;CACtB,MAAM,gBAAgB,MAAM;;;;;;;CAQ5B,MAAM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;KAAuB,IAAG;KAAQ,WAAU;IAAc,CAAA;IAC1D,oBAAC,0BAAD,EAAA,UACE,qBAAC,YAAD;KACE,GAAI;KACG;KACP,YAAY;MACV,qBAAqB,wBAAwB,CAAC;MAC9C,2BAA2B,wBAAwB,CAAC;MACpD,gBAAgB;MAChB,aAAa;MACb,YAAY;MACZ,2BAA2B;KAC7B;KACA,OAAO;KACP,gBAAc,aAAa,KAAA;KAC3B,iBAAe,cAAc,KAAA;KAC7B,UAAU,cAAc;KACxB,UAAU,CAAC;KACX,WAAW,KAAKA,0BAAO,YAAY,cAAcA,0BAAO,QAAQ;KAChE,MAAM,kBAAkB;MACtB,IAAI,eAAe,QACjB,SAAS,UAAU,cAAc;KAErC;KACA,YAAY,CAAC,GAAG,mBAAmB,iBAAiB;KACpD,QAAQ,UAAU;KAvBpB,UAAA,CAyBG,YACC,oBAAC,YAAD;MACE,WAAWA,0BAAO;MAClB,MAAK;MACL,SAAQ;MACR,MAAM;MACM;KACb,CAAA,GAEF,QACS;IACY,CAAA,EAAA,CAAA;IAC1B,oBAAC,uBAAD;KAAuB,IAAG;KAAmB,WAAU;IAAc,CAAA;IACrE,oBAAC,gBAAD,CAAiB,CAAA;GACG;;CACnB,CAAA;AAET,CAAC"}
|
|
1
|
+
{"version":3,"file":"CodeEditor.mjs","names":["styles"],"sources":["../../../../../../../src/components/CodeEditor/CodeEditor.tsx"],"sourcesContent":["import type { ReactCodeMirrorProps } from \"@uiw/react-codemirror\";\nimport CodeMirror, { EditorView } from \"@uiw/react-codemirror\";\nimport { useCallback, useId, useState } from \"react\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport { useControlledHostValueProps } from \"@/lib/remote/useControlledHostValueProps\";\nimport { joinIds, useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport styles from \"./CodeEditor.module.scss\";\nimport { type CodeEditorLanguage } from \"@/components/CodeEditor/languages\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useObjectRef } from \"react-aria\";\nimport { defaultLightTheme } from \"@/components/CodeEditor/themes/defaultEditorTheme\";\nimport {\n type CodeEditorSetup,\n useCodeEditorExtensions,\n} from \"@/components/CodeEditor/hooks/useCodeEditorExtensions\";\nimport { CopyButton } from \"@/components/CopyButton\";\nimport { UiComponentTunnelExit } from \"@/components/UiComponentTunnel/UiComponentTunnelExit\";\n\nexport interface CodeEditorProps\n extends\n Omit<ReactCodeMirrorProps, \"theme\" | \"lang\" | \"basicSetup\" | \"readOnly\">,\n CodeEditorSetup,\n FlowComponentProps {\n /** The initial code of an uncontrolled editor. */\n defaultValue?: string;\n /**\n * Whether the code can be read but not edited.\n *\n * @default false\n */\n isReadOnly?: boolean;\n /**\n * Whether the editor is disabled. The code can neither be edited, focused nor\n * copied.\n *\n * @default false\n */\n isDisabled?: boolean;\n /**\n * Whether the editor is displayed as invalid.\n *\n * @default false\n */\n isInvalid?: boolean;\n /** The elements class name. */\n className?: string;\n /**\n * The language the code is highlighted as. A language the editor does not\n * know is shown as plain text.\n */\n language?: CodeEditorLanguage | (string & {});\n /**\n * Whether a button to copy the code to the clipboard is shown.\n *\n * @default true\n */\n copyable?: boolean;\n /**\n * Whether the field must be filled in. Only marks the editor as required for\n * assistive technology — the editor does not validate itself.\n *\n * @default false\n */\n isRequired?: boolean;\n /**\n * @internal Set by `<Field />` on every form field. The editor has no\n * react-aria validation to forward it to and drops it.\n */\n validationBehavior?: unknown;\n}\n\n/**\n * @flr-generate all\n * @flowStatus new\n */\nexport const CodeEditor = flowComponent(\"CodeEditor\", (props) => {\n const {\n ref,\n children,\n className,\n language,\n extensions,\n isReadOnly,\n isDisabled,\n isInvalid,\n isRequired,\n validationBehavior: _ignoredValidationBehavior,\n value,\n showLineNumbers = true,\n showCodeFolding = true,\n showCodeIndentationMakers = true,\n showLinterMarkers = true,\n showActiveLineMarker = true,\n copyable = true,\n height,\n minHeight,\n \"aria-label\": ariaLabel,\n \"aria-labelledby\": ariaLabelledBy,\n ...rest\n } = useControlledHostValueProps(props, \"\");\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n wrapperProps,\n controlProps,\n fieldPropsContext,\n } = useFieldComponent(props, \"CodeEditor\");\n\n const rootClassName = clsx(\n wrapperProps.className,\n styles.codeEditor,\n className,\n );\n\n const labelId = useId();\n const descriptionId = useId();\n\n /**\n * Both are optional. Their refs tell whether they are rendered, so the editor\n * never references an element that does not exist – a dangling id fails HTML\n * validators and a11y checks. The callbacks are stable: a new one per render\n * would detach and re-attach on every render.\n */\n const [hasLabel, setHasLabel] = useState(false);\n const [hasDescription, setHasDescription] = useState(false);\n const labelRef = useCallback((element: Element | null) => {\n setHasLabel(!!element);\n }, []);\n const descriptionRef = useCallback((element: Element | null) => {\n setHasDescription(!!element);\n }, []);\n\n /**\n * The label and the field description are declared as children of the code\n * editor, but must be rendered outside of the editor itself. They are\n * tunneled out of the editor – just like the field error. Their ids are the\n * ones the editor references.\n */\n const propsContext: PropsContext = {\n ...fieldPropsContext,\n Label: {\n ...fieldPropsContext.Label,\n id: labelId,\n ref: labelRef,\n tunnel: { id: \"label\", component: \"CodeEditor\" },\n },\n FieldDescription: {\n ...fieldPropsContext.FieldDescription,\n id: descriptionId,\n ref: descriptionRef,\n tunnel: { id: \"fieldDescription\", component: \"CodeEditor\" },\n },\n };\n\n const enabledExtensions = useCodeEditorExtensions(language, extensions, {\n showLineNumbers: showLineNumbers,\n showCodeIndentationMakers: showCodeIndentationMakers,\n showCodeFolding: showCodeFolding,\n showLinterMarkers: showLinterMarkers,\n });\n\n /**\n * The editable element of CodeMirror is the `.cm-content` element – not the\n * root element the props are applied to. Its ARIA attributes are set through\n * the content attributes facet.\n *\n * Without a label, an `aria-label` names the editor instead.\n */\n const labelledBy = joinIds(ariaLabelledBy, hasLabel && labelId);\n const describedBy = joinIds(\n hasDescription && descriptionId,\n controlProps[\"aria-describedby\"],\n );\n\n const contentAttributes = EditorView.contentAttributes.of({\n ...(labelledBy ? { \"aria-labelledby\": labelledBy } : {}),\n ...(ariaLabel ? { \"aria-label\": ariaLabel } : {}),\n ...(describedBy ? { \"aria-describedby\": describedBy } : {}),\n ...(isRequired ? { \"aria-required\": \"true\" } : {}),\n ...(isInvalid ? { \"aria-invalid\": \"true\" } : {}),\n ...(isDisabled ? { \"aria-disabled\": \"true\" } : {}),\n });\n\n const localRef = useObjectRef(ref);\n\n useMakeFocusable(localRef);\n\n return (\n <div className={rootClassName} data-disabled={isDisabled || undefined}>\n <PropsContextProvider props={propsContext}>\n <UiComponentTunnelExit id=\"label\" component=\"CodeEditor\" />\n <FieldErrorCaptureContext>\n <CodeMirror\n {...rest}\n value={value}\n basicSetup={{\n highlightActiveLine: showActiveLineMarker && !isDisabled,\n highlightActiveLineGutter: showActiveLineMarker && !isDisabled,\n autocompletion: false,\n lineNumbers: false,\n foldGutter: false,\n highlightSelectionMatches: false,\n }}\n theme={defaultLightTheme}\n data-invalid={isInvalid || undefined}\n data-disabled={isDisabled || undefined}\n readOnly={isReadOnly || isDisabled}\n editable={!isDisabled}\n className={clsx(styles.codeMirror, isReadOnly && styles.readonly)}\n ref={(codeMirrorRef) => {\n if (codeMirrorRef?.editor) {\n localRef.current = codeMirrorRef.editor;\n }\n }}\n extensions={[...enabledExtensions, contentAttributes]}\n height={height ?? minHeight}\n >\n {copyable && (\n <CopyButton\n className={styles.copyButton}\n size=\"s\"\n variant=\"soft\"\n text={value}\n isDisabled={isDisabled}\n />\n )}\n {children}\n </CodeMirror>\n </FieldErrorCaptureContext>\n <UiComponentTunnelExit id=\"fieldDescription\" component=\"CodeEditor\" />\n <FieldErrorView />\n </PropsContextProvider>\n </div>\n );\n});\n\nexport default CodeEditor;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgFA,IAAa,aAAa,cAAc,eAAe,UAAU;CAC/D,MAAM,EACJ,KACA,UACA,WACA,UACA,YACA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1,6 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
import supportedCodeEditorLanguages from "../languages/index.mjs";
|
|
3
|
+
import supportedCodeEditorLanguages, { isCodeEditorLanguage } from "../languages/index.mjs";
|
|
4
4
|
import { gutterSpacer } from "../extensions/gutterSpacer.mjs";
|
|
5
5
|
import { lineNumbers } from "@uiw/react-codemirror";
|
|
6
6
|
import { foldGutter } from "@codemirror/language";
|
|
@@ -32,7 +32,7 @@ var useCodeEditorExtensions = (language, extensions = [], options = {
|
|
|
32
32
|
if (options.showLinterMarkers) extensions.push(lintGutter());
|
|
33
33
|
if (options.showLineNumbers && (!options.showCodeFolding || !options.showLinterMarkers)) extensions.push(gutterSpacer());
|
|
34
34
|
if (options.showCodeIndentationMakers) extensions.push(indentationMarkers({ colors: indentationMarkerColors }));
|
|
35
|
-
if (language) supportedCodeEditorLanguages[language]?.map((loader) => extensions.push(loader()));
|
|
35
|
+
if (language && isCodeEditorLanguage(language)) supportedCodeEditorLanguages[language]?.map((loader) => extensions.push(loader()));
|
|
36
36
|
return extensions;
|
|
37
37
|
};
|
|
38
38
|
//#endregion
|
package/dist/js/packages/components/src/components/CodeEditor/hooks/useCodeEditorExtensions.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCodeEditorExtensions.mjs","names":[],"sources":["../../../../../../../../src/components/CodeEditor/hooks/useCodeEditorExtensions.tsx"],"sourcesContent":["import { type Extension, lineNumbers } from \"@uiw/react-codemirror\";\nimport { lintGutter } from \"@codemirror/lint\";\nimport supportedCodeEditorLanguages, {\n
|
|
1
|
+
{"version":3,"file":"useCodeEditorExtensions.mjs","names":[],"sources":["../../../../../../../../src/components/CodeEditor/hooks/useCodeEditorExtensions.tsx"],"sourcesContent":["import { type Extension, lineNumbers } from \"@uiw/react-codemirror\";\nimport { lintGutter } from \"@codemirror/lint\";\nimport supportedCodeEditorLanguages, {\n isCodeEditorLanguage,\n} from \"@/components/CodeEditor/languages\";\nimport { indentationMarkers } from \"@replit/codemirror-indentation-markers\";\nimport { foldGutter } from \"@codemirror/language\";\nimport { gutterSpacer } from \"@/components/CodeEditor/extensions/gutterSpacer\";\n\n/*\n * Every slot gets the same color: the library picks between its light and dark\n * one by CodeMirror's dark theme flag, which Flow's theme never sets, and the\n * active block needs no color of its own.\n */\nconst markerColor = \"var(--code-editor--indentation-marker-color)\";\nconst indentationMarkerColors = {\n light: markerColor,\n dark: markerColor,\n activeLight: markerColor,\n activeDark: markerColor,\n};\n\nexport interface CodeEditorSetup {\n /**\n * Whether the line the cursor is on is highlighted.\n *\n * @default true\n */\n showActiveLineMarker?: boolean;\n /**\n * Whether the gutter offers controls to fold and unfold code blocks.\n *\n * @default true\n */\n showCodeFolding?: boolean;\n /**\n * Whether indentation levels are visualized with guide lines.\n *\n * @default true\n */\n showCodeIndentationMakers?: boolean;\n /**\n * Whether line numbers are shown in the gutter.\n *\n * @default true\n */\n showLineNumbers?: boolean;\n /**\n * Whether linter results are shown in the gutter.\n *\n * @default true\n */\n showLinterMarkers?: boolean;\n}\n\n/** @internal */\nexport const useCodeEditorExtensions = (\n language?: string,\n extensions: Extension[] = [],\n options: CodeEditorSetup = {\n showCodeFolding: true,\n showCodeIndentationMakers: true,\n showLineNumbers: true,\n showLinterMarkers: true,\n },\n) => {\n if (options.showLineNumbers) {\n extensions.push(lineNumbers());\n }\n\n if (options.showCodeFolding) {\n extensions.push(\n foldGutter({\n markerDOM: (open) => {\n const element = document.createElement(\"span\");\n element.classList.add(\"cm-foldGutter\");\n element.classList.add(\n open ? \"cm-foldGutter-open\" : \"cm-foldGutter-closed\",\n );\n element.innerText = open ? \"⌄\" : \"›\";\n return element;\n },\n }),\n );\n }\n\n if (options.showLinterMarkers) {\n extensions.push(lintGutter());\n }\n\n if (\n options.showLineNumbers &&\n (!options.showCodeFolding || !options.showLinterMarkers)\n ) {\n extensions.push(gutterSpacer());\n }\n\n if (options.showCodeIndentationMakers) {\n extensions.push(indentationMarkers({ colors: indentationMarkerColors }));\n }\n\n if (language && isCodeEditorLanguage(language)) {\n supportedCodeEditorLanguages[language]?.map((loader) =>\n extensions.push(loader()),\n );\n }\n\n return extensions;\n};\n"],"mappings":";;;;;;;;;AAcA,IAAM,cAAc;AACpB,IAAM,0BAA0B;CAC9B,OAAO;CACP,MAAM;CACN,aAAa;CACb,YAAY;AACd;;AAoCA,IAAa,2BACX,UACA,aAA0B,CAAC,GAC3B,UAA2B;CACzB,iBAAiB;CACjB,2BAA2B;CAC3B,iBAAiB;CACjB,mBAAmB;AACrB,MACG;CACH,IAAI,QAAQ,iBACV,WAAW,KAAK,YAAY,CAAC;CAG/B,IAAI,QAAQ,iBACV,WAAW,KACT,WAAW,EACT,YAAY,SAAS;EACnB,MAAM,UAAU,SAAS,cAAc,MAAM;EAC7C,QAAQ,UAAU,IAAI,eAAe;EACrC,QAAQ,UAAU,IAChB,OAAO,uBAAuB,sBAChC;EACA,QAAQ,YAAY,OAAO,MAAM;EACjC,OAAO;CACT,EACF,CAAC,CACH;CAGF,IAAI,QAAQ,mBACV,WAAW,KAAK,WAAW,CAAC;CAG9B,IACE,QAAQ,oBACP,CAAC,QAAQ,mBAAmB,CAAC,QAAQ,oBAEtC,WAAW,KAAK,aAAa,CAAC;CAGhC,IAAI,QAAQ,2BACV,WAAW,KAAK,mBAAmB,EAAE,QAAQ,wBAAwB,CAAC,CAAC;CAGzE,IAAI,YAAY,qBAAqB,QAAQ,GAC3C,6BAA6B,SAAS,EAAE,KAAK,WAC3C,WAAW,KAAK,OAAO,CAAC,CAC1B;CAGF,OAAO;AACT"}
|
|
@@ -9,7 +9,8 @@ Object.keys(langs).forEach((key) => {
|
|
|
9
9
|
supportedCodeEditorLanguages[languageKey] = [langs[languageKey]];
|
|
10
10
|
});
|
|
11
11
|
supportedCodeEditorLanguages.dotEnv = language;
|
|
12
|
+
var isCodeEditorLanguage = (language) => Object.hasOwn(supportedCodeEditorLanguages, language);
|
|
12
13
|
//#endregion
|
|
13
|
-
export { supportedCodeEditorLanguages as default };
|
|
14
|
+
export { supportedCodeEditorLanguages as default, isCodeEditorLanguage };
|
|
14
15
|
|
|
15
16
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["DotEnvLanguage"],"sources":["../../../../../../../../src/components/CodeEditor/languages/index.ts"],"sourcesContent":["import { langs, type LanguageName } from \"@uiw/codemirror-extensions-langs\";\nimport {\n type LanguageSupport,\n type StreamLanguage,\n} from \"@codemirror/language\";\nimport type { linter } from \"@codemirror/lint\";\nimport type { Extension } from \"@uiw/react-codemirror\";\nimport DotEnvLanguage from \"@/components/CodeEditor/languages/dotEnv\";\nimport type { ALL_LANGUAGES } from \"@/components/CodeEditor/languages/all\";\n\nexport type CodeEditorLanguage = (typeof ALL_LANGUAGES)[number];\n\nexport type LanguageFactory = Record<\n CodeEditorLanguage,\n (() =>\n | StreamLanguage<unknown>\n | LanguageSupport\n | Extension\n | ReturnType<typeof linter>)[]\n>;\n\nexport type LanguageContainer = [\n () => Extension,\n () => LanguageSupport,\n () => ReturnType<typeof linter>,\n];\n\nconst supportedCodeEditorLanguages: LanguageFactory = {} as never;\nObject.keys(langs).forEach((key) => {\n const languageKey = key as CodeEditorLanguage;\n supportedCodeEditorLanguages[languageKey] = [\n langs[languageKey as LanguageName],\n ];\n});\n\nsupportedCodeEditorLanguages.dotEnv = DotEnvLanguage;\n\nexport default supportedCodeEditorLanguages;\n"],"mappings":";;;;;AA2BA,IAAM,+BAAgD,CAAC;AACvD,OAAO,KAAK,KAAK,CAAC,CAAC,SAAS,QAAQ;CAClC,MAAM,cAAc;CACpB,6BAA6B,eAAe,CAC1C,MAAM,YACR;AACF,CAAC;AAED,6BAA6B,SAASA"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["DotEnvLanguage"],"sources":["../../../../../../../../src/components/CodeEditor/languages/index.ts"],"sourcesContent":["import { langs, type LanguageName } from \"@uiw/codemirror-extensions-langs\";\nimport {\n type LanguageSupport,\n type StreamLanguage,\n} from \"@codemirror/language\";\nimport type { linter } from \"@codemirror/lint\";\nimport type { Extension } from \"@uiw/react-codemirror\";\nimport DotEnvLanguage from \"@/components/CodeEditor/languages/dotEnv\";\nimport type { ALL_LANGUAGES } from \"@/components/CodeEditor/languages/all\";\n\nexport type CodeEditorLanguage = (typeof ALL_LANGUAGES)[number];\n\nexport type LanguageFactory = Record<\n CodeEditorLanguage,\n (() =>\n | StreamLanguage<unknown>\n | LanguageSupport\n | Extension\n | ReturnType<typeof linter>)[]\n>;\n\nexport type LanguageContainer = [\n () => Extension,\n () => LanguageSupport,\n () => ReturnType<typeof linter>,\n];\n\nconst supportedCodeEditorLanguages: LanguageFactory = {} as never;\nObject.keys(langs).forEach((key) => {\n const languageKey = key as CodeEditorLanguage;\n supportedCodeEditorLanguages[languageKey] = [\n langs[languageKey as LanguageName],\n ];\n});\n\nsupportedCodeEditorLanguages.dotEnv = DotEnvLanguage;\n\nexport const isCodeEditorLanguage = (\n language: string,\n): language is CodeEditorLanguage =>\n Object.hasOwn(supportedCodeEditorLanguages, language);\n\nexport default supportedCodeEditorLanguages;\n"],"mappings":";;;;;AA2BA,IAAM,+BAAgD,CAAC;AACvD,OAAO,KAAK,KAAK,CAAC,CAAC,SAAS,QAAQ;CAClC,MAAM,cAAc;CACpB,6BAA6B,eAAe,CAC1C,MAAM,YACR;AACF,CAAC;AAED,6BAA6B,SAASA;AAEtC,IAAa,wBACX,aAEA,OAAO,OAAO,8BAA8B,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","names":[],"sources":["../../../../../../../../src/lib/propsContext/nestedPropsContext/types.ts"],"sourcesContent":["export const nestingLevelKey = \"___nestingLevel\" as const;\n\nexport type NestingLevelKey = typeof nestingLevelKey;\n\
|
|
1
|
+
{"version":3,"file":"types.mjs","names":[],"sources":["../../../../../../../../src/lib/propsContext/nestedPropsContext/types.ts"],"sourcesContent":["export const nestingLevelKey = \"___nestingLevel\" as const;\n\nexport type NestingLevelKey = typeof nestingLevelKey;\n\nexport interface NestingLevelProps {\n [nestingLevelKey]?: number;\n}\n"],"mappings":";;;AAAA,IAAa,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlayTriggerTunnel.mjs","names":[],"sources":["../../../../../../../src/lib/propsContext/overlayTriggerTunnel.ts"],"sourcesContent":["import type { PropsContext } from \"@/lib/propsContext/types\";\nimport type {
|
|
1
|
+
{"version":3,"file":"overlayTriggerTunnel.mjs","names":[],"sources":["../../../../../../../src/lib/propsContext/overlayTriggerTunnel.ts"],"sourcesContent":["import type { PropsContext } from \"@/lib/propsContext/types\";\nimport type { TunnelTarget } from \"@/lib/types/props\";\n\n/**\n * Props context entries that send every overlay trigger into `tunnel`.\n *\n * A props context that tunnels `Button` has to tunnel the overlay triggers as a\n * whole, not their buttons: `OverlayTrigger` pins its trigger button in place\n * (`tunnel: null`), because react-aria wires the press handling, the trigger\n * ref and `aria-haspopup`/`aria-expanded`/`aria-controls` through a\n * `PressResponder` that only reaches its own subtree. Tunnelling the button\n * alone lifts it out of that subtree and silently drops all of it.\n *\n * `DialogTrigger` is in the list because it is the host-side identity of the\n * triggers that are not `@flr-generate` — `ModalTrigger`, `PopoverTrigger` and\n * `LightBoxTrigger` all render through its view, so a remote tree only ever\n * reaches the host as a `DialogTrigger`. `OverlayTrigger` pins it with `tunnel:\n * null` in turn, so the local tree tunnels the trigger the author wrote and\n * never the `DialogTrigger` inside it.\n *\n * Spread the entries before the context's own, so a single trigger can still be\n * sent somewhere else (see `Label`).\n */\nexport const overlayTriggersTunneledTo = (\n tunnel: TunnelTarget,\n): PropsContext => ({\n ContextMenuTrigger: { tunnel },\n ContextualHelpTrigger: { tunnel },\n DialogTrigger: { tunnel },\n ModalTrigger: { tunnel },\n PopoverTrigger: { tunnel },\n});\n\nexport default overlayTriggersTunneledTo;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAa,6BACX,YACkB;CAClB,oBAAoB,EAAE,OAAO;CAC7B,uBAAuB,EAAE,OAAO;CAChC,eAAe,EAAE,OAAO;CACxB,cAAc,EAAE,OAAO;CACvB,gBAAgB,EAAE,OAAO;AAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.mjs","names":[],"sources":["../../../../../../../src/lib/types/props.ts"],"sourcesContent":["import type { FlowComponentName } from \"@/components/propTypes\";\nimport type { ExoticComponent, HTMLAttributes } from \"react\";\n\nexport const statusTypes = [\n \"info\",\n \"success\",\n \"warning\",\n \"danger\",\n \"unavailable\",\n] as const;\n\nexport type Status = (typeof statusTypes)[number];\n\nexport type PropsWithStatus<T extends Status = Status, P = unknown> = P & {\n /** The elements status */\n status?: T;\n};\n\nexport
|
|
1
|
+
{"version":3,"file":"props.mjs","names":[],"sources":["../../../../../../../src/lib/types/props.ts"],"sourcesContent":["import type { FlowComponentName } from \"@/components/propTypes\";\nimport type { ExoticComponent, HTMLAttributes } from \"react\";\n\nexport const statusTypes = [\n \"info\",\n \"success\",\n \"warning\",\n \"danger\",\n \"unavailable\",\n] as const;\n\nexport type Status = (typeof statusTypes)[number];\n\nexport type PropsWithStatus<T extends Status = Status, P = unknown> = P & {\n /** The elements status */\n status?: T;\n};\n\nexport type TunnelTarget = {\n id: string;\n component: FlowComponentName;\n /**\n * A stable entry id instead of a generated one. Needed wherever the same\n * component is rendered more than once for a single logical element:\n * react-aria renders collection children twice — once into its hidden\n * collection document, once for real — and a generated id would register each\n * render as its own entry, so the tunnel exit renders every element twice.\n * Must be unique among the siblings of one tunnel.\n */\n staticEntryId?: string;\n} | null;\n\nexport interface PropsWithTunnel {\n /** @internal */\n tunnel?: TunnelTarget;\n}\n\nexport interface PropsWithClassName {\n /** The elements class name. */\n className?: string;\n}\n\nexport type PropsWithElementType<\n T extends keyof HTMLElementTagNameMap = never,\n> = HTMLAttributes<HTMLElement> & {\n /** The HTML element or React component rendered as the elements root. */\n elementType?: T | ExoticComponent;\n};\n\nexport type ContainerBreakpointSize = \"xs\" | \"s\" | \"m\" | \"l\" | \"xl\";\n\nexport interface PropsWithContainerBreakpointSize {\n /**\n * The breakpoint at which the element switches to its compact layout.\n * Evaluated as a container query against the surrounding container, not\n * against the viewport.\n */\n containerBreakpointSize?: ContainerBreakpointSize;\n}\n\nexport const alphaColors = [\n \"dark\",\n \"light\",\n \"dark-static\",\n \"light-static\",\n] as const;\n\nexport type AlphaColor = (typeof alphaColors)[number];\n\nexport function isAlphaColor(color: string): color is AlphaColor {\n return alphaColors.includes(color as AlphaColor);\n}\n"],"mappings":";;;AAGA,IAAa,cAAc;CACzB;CACA;CACA;CACA;CACA;AACF;AAmDA,IAAa,cAAc;CACzB;CACA;CACA;CACA;AACF;AAIA,SAAgB,aAAa,OAAoC;CAC/D,OAAO,YAAY,SAAS,KAAmB;AACjD"}
|
|
@@ -26,8 +26,11 @@ export interface CodeEditorProps extends Omit<ReactCodeMirrorProps, "theme" | "l
|
|
|
26
26
|
isInvalid?: boolean;
|
|
27
27
|
/** The elements class name. */
|
|
28
28
|
className?: string;
|
|
29
|
-
/**
|
|
30
|
-
|
|
29
|
+
/**
|
|
30
|
+
* The language the code is highlighted as. A language the editor does not
|
|
31
|
+
* know is shown as plain text.
|
|
32
|
+
*/
|
|
33
|
+
language?: CodeEditorLanguage | (string & {});
|
|
31
34
|
/**
|
|
32
35
|
* Whether a button to copy the code to the clipboard is shown.
|
|
33
36
|
*
|
|
@@ -1 +1,32 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export interface CodeEditorSetup {
|
|
2
|
+
/**
|
|
3
|
+
* Whether the line the cursor is on is highlighted.
|
|
4
|
+
*
|
|
5
|
+
* @default true
|
|
6
|
+
*/
|
|
7
|
+
showActiveLineMarker?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Whether the gutter offers controls to fold and unfold code blocks.
|
|
10
|
+
*
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
showCodeFolding?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether indentation levels are visualized with guide lines.
|
|
16
|
+
*
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
showCodeIndentationMakers?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether line numbers are shown in the gutter.
|
|
22
|
+
*
|
|
23
|
+
* @default true
|
|
24
|
+
*/
|
|
25
|
+
showLineNumbers?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether linter results are shown in the gutter.
|
|
28
|
+
*
|
|
29
|
+
* @default true
|
|
30
|
+
*/
|
|
31
|
+
showLinterMarkers?: boolean;
|
|
32
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const ALL_LANGUAGES: readonly ["apl", "asc", "asn", "asn1", "b", "bash", "bf", "BUILD", "bzl", "c", "c++", "cc", "cfg", "cjs", "cl", "clj", "cljc", "cljs", "cljx", "cmake", "cmake.in", "cob", "coffee", "cpp", "cpy", "cql", "cr", "cs", "css", "cts", "cxx", "cyp", "cypher", "d", "dart", "diff", "dotEnv", "dtd", "dyalog", "dyl", "dylan", "e", "ecl", "edn", "el", "elm", "erl", "f", "f77", "f90", "f95", "factor", "feature", "for", "forth", "fs", "fth", "fun", "go", "gradle", "groovy", "gss", "h", "h++", "handlebars", "hbs", "hh", "hpp", "hs", "htm", "html", "hx", "hxml", "hxx", "in", "ini", "ino", "intr", "j2", "jade", "java", "jinja", "jinja2", "jl", "js", "json", "jsonld", "jsx", "ksh", "kt", "kts", "less", "liquid", "lisp", "ls", "ltx", "lua", "m", "map", "markdown", "mbox", "md", "mjs", "mkd", "ml", "mli", "mll", "mly", "mm", "mo", "mps", "mrc", "msc", "mscgen", "mscin", "msgenny", "mts", "nb", "nix", "nq", "nsh", "nsi", "nt", "nut", "oz", "p", "pas", "patch", "pgp", "php", "php3", "php4", "php5", "php7", "phtml", "pig", "pl", "pls", "pm", "pp", "pro", "properties", "proto", "ps1", "psd1", "psm1", "pug", "pxd", "pxi", "py", "pyw", "pyx", "q", "r", "R", "rb", "rq", "rs", "s", "sas", "sass", "scala", "scm", "scss", "sh", "sieve", "sig", "siv", "smackspec", "sml", "solidity", "sparql", "spec", "sql", "ss", "st", "styl", "sv", "svelte", "svg", "svh", "swift", "tcl", "tex", "text", "textile", "toml", "ts", "tsx", "ttcn", "ttcn3", "ttcnpp", "ttl", "v", "vb", "vbs", "vhd", "vhdl", "vtl", "vue", "wast", "wat", "webidl", "wl", "wls", "xml", "xq", "xqm", "xquery", "xqy", "xsd", "xsl", "xu", "xy", "yaml", "yml", "ys", "z80"];
|
|
@@ -10,4 +10,5 @@ export type LanguageContainer = [
|
|
|
10
10
|
() => ReturnType<typeof linter>
|
|
11
11
|
];
|
|
12
12
|
declare const supportedCodeEditorLanguages: LanguageFactory;
|
|
13
|
+
export declare const isCodeEditorLanguage: (language: string) => language is CodeEditorLanguage;
|
|
13
14
|
export default supportedCodeEditorLanguages;
|
|
@@ -6,11 +6,7 @@ export declare const ModalTrigger: import('react').FunctionComponent<{
|
|
|
6
6
|
isDefaultOpen?: boolean | undefined;
|
|
7
7
|
controller?: import('../../../../lib/controller').OverlayController | undefined;
|
|
8
8
|
wrapWith?: (import('react').ReactElement | null) | undefined;
|
|
9
|
-
tunnel?:
|
|
10
|
-
id: string;
|
|
11
|
-
component: import('../../../propTypes').FlowComponentName;
|
|
12
|
-
staticEntryId?: string;
|
|
13
|
-
} | null | undefined;
|
|
9
|
+
tunnel?: import('../../../../index/internal').TunnelTarget | undefined;
|
|
14
10
|
ref?: import('react').Ref<HTMLDivElement> | undefined;
|
|
15
11
|
key?: import('react').Key | null | undefined;
|
|
16
12
|
children?: import('react').ReactNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const parkPointer: () => Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsContext } from './types';
|
|
2
|
-
import {
|
|
2
|
+
import { TunnelTarget } from '../types/props';
|
|
3
3
|
/**
|
|
4
4
|
* Props context entries that send every overlay trigger into `tunnel`.
|
|
5
5
|
*
|
|
@@ -20,5 +20,5 @@ import { PropsWithTunnel } from '../types/props';
|
|
|
20
20
|
* Spread the entries before the context's own, so a single trigger can still be
|
|
21
21
|
* sent somewhere else (see `Label`).
|
|
22
22
|
*/
|
|
23
|
-
export declare const overlayTriggersTunneledTo: (tunnel:
|
|
23
|
+
export declare const overlayTriggersTunneledTo: (tunnel: TunnelTarget) => PropsContext;
|
|
24
24
|
export default overlayTriggersTunneledTo;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FlowComponentName } from '../../components/propTypes';
|
|
1
2
|
import { ExoticComponent, HTMLAttributes } from 'react';
|
|
2
3
|
export declare const statusTypes: readonly ["info", "success", "warning", "danger", "unavailable"];
|
|
3
4
|
export type Status = (typeof statusTypes)[number];
|
|
@@ -5,6 +6,19 @@ export type PropsWithStatus<T extends Status = Status, P = unknown> = P & {
|
|
|
5
6
|
/** The elements status */
|
|
6
7
|
status?: T;
|
|
7
8
|
};
|
|
9
|
+
export type TunnelTarget = {
|
|
10
|
+
id: string;
|
|
11
|
+
component: FlowComponentName;
|
|
12
|
+
/**
|
|
13
|
+
* A stable entry id instead of a generated one. Needed wherever the same
|
|
14
|
+
* component is rendered more than once for a single logical element:
|
|
15
|
+
* react-aria renders collection children twice — once into its hidden
|
|
16
|
+
* collection document, once for real — and a generated id would register each
|
|
17
|
+
* render as its own entry, so the tunnel exit renders every element twice.
|
|
18
|
+
* Must be unique among the siblings of one tunnel.
|
|
19
|
+
*/
|
|
20
|
+
staticEntryId?: string;
|
|
21
|
+
} | null;
|
|
8
22
|
export interface PropsWithTunnel {
|
|
9
23
|
}
|
|
10
24
|
export interface PropsWithClassName {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-react-components",
|
|
3
|
-
"version": "1.5.0-next.
|
|
3
|
+
"version": "1.5.0-next.33",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React implementation of Flow, mittwald’s design system",
|
|
6
6
|
"homepage": "https://flow.mittwald.de",
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
"@internationalized/string-compiler": "^3.4.1",
|
|
85
85
|
"@lezer/common": "^1.5.2",
|
|
86
86
|
"@lezer/highlight": "^1.2.3",
|
|
87
|
-
"@mittwald/flow-icons": "^1.5.0-next.
|
|
87
|
+
"@mittwald/flow-icons": "^1.5.0-next.33",
|
|
88
88
|
"@mittwald/password-tools-js": "^3.0.0",
|
|
89
|
-
"@mittwald/react-tunnel": "^1.5.0-next.
|
|
89
|
+
"@mittwald/react-tunnel": "^1.5.0-next.33",
|
|
90
90
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
91
91
|
"@react-aria/form": "^3.2.1",
|
|
92
92
|
"@react-aria/i18n": "^3.13.1",
|
|
@@ -139,12 +139,12 @@
|
|
|
139
139
|
"@internationalized/date": "^3.12.3",
|
|
140
140
|
"@lezer/generator": "^1.8.0",
|
|
141
141
|
"@lezer/lr": "^1.4.10",
|
|
142
|
-
"@mittwald/flow-core": "1.5.0-next.
|
|
143
|
-
"@mittwald/flow-design-tokens": "1.5.0-next.
|
|
144
|
-
"@mittwald/flow-icons-base": "1.5.0-next.
|
|
142
|
+
"@mittwald/flow-core": "1.5.0-next.33",
|
|
143
|
+
"@mittwald/flow-design-tokens": "1.5.0-next.33",
|
|
144
|
+
"@mittwald/flow-icons-base": "1.5.0-next.33",
|
|
145
145
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
146
146
|
"@mittwald/remote-dom-react": "1.2.2-mittwald.10",
|
|
147
|
-
"@mittwald/typescript-config": "1.5.0-next.
|
|
147
|
+
"@mittwald/typescript-config": "1.5.0-next.33",
|
|
148
148
|
"@nx/storybook": "^22.7.6",
|
|
149
149
|
"@storybook/addon-a11y": "^10.5.10",
|
|
150
150
|
"@storybook/addon-actions": "^9.0.8",
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
},
|
|
199
199
|
"peerDependencies": {
|
|
200
200
|
"@internationalized/date": "^3.12.2",
|
|
201
|
-
"@mittwald/flow-icons-pro": "1.5.0-next.
|
|
201
|
+
"@mittwald/flow-icons-pro": "1.5.0-next.33",
|
|
202
202
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
203
203
|
"next": "^16.2.3",
|
|
204
204
|
"react": "^19.2.0",
|
|
@@ -222,5 +222,5 @@
|
|
|
222
222
|
"browserslist": [
|
|
223
223
|
"baseline widely available"
|
|
224
224
|
],
|
|
225
|
-
"gitHead": "
|
|
225
|
+
"gitHead": "3a69bf40ea795b0090fd6ea465de82a362825bc3"
|
|
226
226
|
}
|