@mittwald/flow-react-components 0.2.0-alpha.468 → 0.2.0-alpha.469
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/CHANGELOG.md +6 -0
- package/dist/assets/doc-properties.json +21971 -21800
- package/dist/css/all.css +1 -1
- package/dist/js/components/src/components/Button/Button.mjs +3 -1
- package/dist/js/components/src/components/Button/Button.mjs.map +1 -1
- package/dist/js/components/src/components/Content/Content.mjs +2 -10
- package/dist/js/components/src/components/Content/Content.mjs.map +1 -1
- package/dist/js/components/src/components/FileDropZone/FileDropZone.mjs +8 -2
- package/dist/js/components/src/components/FileDropZone/FileDropZone.mjs.map +1 -1
- package/dist/js/components/src/components/FileField/FileField.mjs +4 -1
- package/dist/js/components/src/components/FileField/FileField.mjs.map +1 -1
- package/dist/js/components/src/components/FileField/components/FileInput.mjs +3 -2
- package/dist/js/components/src/components/FileField/components/FileInput.mjs.map +1 -1
- package/dist/js/components/src/components/Navigation/components/NavigationGroup/NavigationGroup.mjs +1 -1
- package/dist/js/components/src/components/Navigation/components/NavigationGroup/NavigationGroup.mjs.map +1 -1
- package/dist/js/components/src/components/Select/Select.mjs +5 -3
- package/dist/js/components/src/components/Select/Select.mjs.map +1 -1
- package/dist/js/components/src/components/Slider/Slider.mjs +11 -1
- package/dist/js/components/src/components/Slider/Slider.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs +1 -0
- package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs +50 -17
- package/dist/js/components/src/integrations/react-hook-form/components/Form/Form.mjs.map +1 -1
- package/dist/types/components/Button/Button.d.ts +2 -0
- package/dist/types/components/Button/Button.d.ts.map +1 -1
- package/dist/types/components/Button/stories/States.stories.d.ts +1 -0
- package/dist/types/components/Button/stories/States.stories.d.ts.map +1 -1
- package/dist/types/components/Content/Content.d.ts.map +1 -1
- package/dist/types/components/FileDropZone/FileDropZone.d.ts +2 -0
- package/dist/types/components/FileDropZone/FileDropZone.d.ts.map +1 -1
- package/dist/types/components/FileDropZone/stories/Default.stories.d.ts +1 -0
- package/dist/types/components/FileDropZone/stories/Default.stories.d.ts.map +1 -1
- package/dist/types/components/FileField/FileField.d.ts +2 -0
- package/dist/types/components/FileField/FileField.d.ts.map +1 -1
- package/dist/types/components/FileField/stories/Default.stories.d.ts +1 -0
- package/dist/types/components/FileField/stories/Default.stories.d.ts.map +1 -1
- package/dist/types/components/Select/Select.d.ts +2 -0
- package/dist/types/components/Select/Select.d.ts.map +1 -1
- package/dist/types/components/Select/stories/Default.stories.d.ts +1 -0
- package/dist/types/components/Select/stories/Default.stories.d.ts.map +1 -1
- package/dist/types/components/Slider/Slider.d.ts +2 -0
- package/dist/types/components/Slider/Slider.d.ts.map +1 -1
- package/dist/types/components/Slider/stories/Default.stories.d.ts +1 -0
- package/dist/types/components/Slider/stories/Default.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/Field.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Form/Form.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Form/Form.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Form/stories/Form.stories.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Form/stories/Form.stories.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -20,7 +20,7 @@ import { LoadingSpinner } from '../LoadingSpinner/LoadingSpinner.mjs';
|
|
|
20
20
|
import { useAriaAnnounceActionState } from '../Action/lib/ariaLive.mjs';
|
|
21
21
|
|
|
22
22
|
const disablePendingProps = (props) => {
|
|
23
|
-
if (props.isPending || props.isSucceeded || props.isFailed || props["aria-disabled"]) {
|
|
23
|
+
if (props.isPending || props.isSucceeded || props.isFailed || props["aria-disabled"] || props.isReadOnly) {
|
|
24
24
|
props = { ...props };
|
|
25
25
|
props.onPress = void 0;
|
|
26
26
|
props.onPressStart = void 0;
|
|
@@ -48,6 +48,7 @@ const Button = flowComponent("Button", (props) => {
|
|
|
48
48
|
slot: ignoredSlotProp,
|
|
49
49
|
ariaSlot: slot,
|
|
50
50
|
unstyled,
|
|
51
|
+
isReadOnly,
|
|
51
52
|
...restProps
|
|
52
53
|
} = props;
|
|
53
54
|
const rootClassName = unstyled ? className : clsx(
|
|
@@ -103,6 +104,7 @@ const Button = flowComponent("Button", (props) => {
|
|
|
103
104
|
className: rootClassName,
|
|
104
105
|
ref,
|
|
105
106
|
slot,
|
|
107
|
+
"data-readonly": isReadOnly,
|
|
106
108
|
...restProps,
|
|
107
109
|
children: [
|
|
108
110
|
/* @__PURE__ */ jsx(PropsContextProvider, { props: propsContext, children: /* @__PURE__ */ jsx(Wrap, { if: !unstyled, children: /* @__PURE__ */ jsx("span", { className: styles.content, children: /* @__PURE__ */ jsx(Wrap, { if: isStringContent, children: /* @__PURE__ */ jsx(Text, { className: styles.text, children }) }) }) }) }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.mjs","sources":["../../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport React from \"react\";\nimport styles from \"./Button.module.scss\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { IconFailed, IconSucceeded } from \"@/components/Icon/components/icons\";\nimport { Wrap } from \"@/components/Wrap\";\nimport { Text } from \"@/components/Text\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport LoadingSpinner from \"@/components/LoadingSpinner/LoadingSpinner\";\nimport { useAriaAnnounceActionState } from \"@/components/Action/lib/ariaLive\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\n\nexport interface ButtonProps\n extends PropsWithChildren<Aria.ButtonProps>,\n FlowComponentProps<HTMLButtonElement> {\n /** Slot for button placement in action groups. */\n slot?: string;\n /** The color of the button. @default \"primary\" */\n color?: \"primary\" | \"accent\" | \"secondary\" | \"danger\" | \"dark\" | \"light\";\n /** The visual variant of the button. @default \"solid\" */\n variant?: \"plain\" | \"solid\" | \"soft\" | \"outline\";\n /** The size of the button. @default \"m\" */\n size?: \"m\" | \"s\";\n /** Disables button but keeps it focusable. */\n \"aria-disabled\"?: boolean;\n /** Whether the button is in a pending state. */\n isPending?: boolean;\n /** Whether the button is in a succeeded state. */\n isSucceeded?: boolean;\n /** Whether the button is in a failed state. */\n isFailed?: boolean;\n /** @internal */\n unstyled?: boolean;\n /** @internal */\n ariaSlot?: string | null;\n}\n\nconst disablePendingProps = (props: ButtonProps) => {\n if (\n props.isPending ||\n props.isSucceeded ||\n props.isFailed ||\n props[\"aria-disabled\"]\n ) {\n props = { ...props };\n props.onPress = undefined;\n props.onPressStart = undefined;\n props.onPressEnd = undefined;\n props.onPressChange = undefined;\n props.onPressUp = undefined;\n props.onKeyDown = undefined;\n props.onKeyUp = undefined;\n }\n\n return props;\n};\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const Button = flowComponent(\"Button\", (props) => {\n props = disablePendingProps(props);\n\n const {\n color = \"primary\",\n variant = \"solid\",\n children,\n className,\n size = \"m\",\n isPending,\n isSucceeded,\n isFailed,\n \"aria-disabled\": ariaDisabled,\n ref,\n slot: ignoredSlotProp,\n ariaSlot: slot,\n unstyled,\n ...restProps\n } = props;\n\n const rootClassName = unstyled\n ? className\n : clsx(\n styles.button,\n isPending && styles.isPending,\n isSucceeded && styles.isSucceeded,\n isFailed && styles.isFailed,\n styles[`size-${size}`],\n styles[color],\n styles[variant],\n className,\n /**\n * Workaround warning: The Aria.Button does not support \"aria-disabled\"\n * by now, so this Button will be visually disabled via CSS.\n */\n ariaDisabled && styles.ariaDisabled,\n );\n\n useAriaAnnounceActionState(\n isPending\n ? \"isPending\"\n : isSucceeded\n ? \"isSucceeded\"\n : isFailed\n ? \"isFailed\"\n : \"isIdle\",\n );\n\n const propsContext: PropsContext = {\n Icon: {\n className: styles.icon,\n \"aria-hidden\": true,\n size,\n },\n Text: {\n className: styles.text,\n },\n Avatar: {\n className: styles.avatar,\n },\n CounterBadge: {\n className: styles.counterBadge,\n },\n Image: {\n className: styles.image,\n },\n };\n\n const StateIconComponent = isSucceeded\n ? IconSucceeded\n : isFailed\n ? IconFailed\n : isPending\n ? LoadingSpinner\n : undefined;\n\n const stateIcon = StateIconComponent && (\n <StateIconComponent\n size={size}\n className={styles.stateIcon}\n status={isFailed ? \"danger\" : isSucceeded ? \"success\" : undefined}\n />\n );\n\n const isStringContent = typeof children === \"string\";\n\n return (\n <ClearPropsContext>\n <Aria.Button\n className={rootClassName}\n ref={ref}\n slot={slot}\n {...restProps}\n >\n <PropsContextProvider props={propsContext}>\n <Wrap if={!unstyled}>\n <span className={styles.content}>\n <Wrap if={isStringContent}>\n <Text className={styles.text}>{children}</Text>\n </Wrap>\n </span>\n </Wrap>\n </PropsContextProvider>\n {stateIcon}\n </Aria.Button>\n </ClearPropsContext>\n );\n});\n\nexport default Button;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Button.mjs","sources":["../../../../../../src/components/Button/Button.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport React from \"react\";\nimport styles from \"./Button.module.scss\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { IconFailed, IconSucceeded } from \"@/components/Icon/components/icons\";\nimport { Wrap } from \"@/components/Wrap\";\nimport { Text } from \"@/components/Text\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport LoadingSpinner from \"@/components/LoadingSpinner/LoadingSpinner\";\nimport { useAriaAnnounceActionState } from \"@/components/Action/lib/ariaLive\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\n\nexport interface ButtonProps\n extends PropsWithChildren<Aria.ButtonProps>,\n FlowComponentProps<HTMLButtonElement> {\n /** Slot for button placement in action groups. */\n slot?: string;\n /** The color of the button. @default \"primary\" */\n color?: \"primary\" | \"accent\" | \"secondary\" | \"danger\" | \"dark\" | \"light\";\n /** The visual variant of the button. @default \"solid\" */\n variant?: \"plain\" | \"solid\" | \"soft\" | \"outline\";\n /** The size of the button. @default \"m\" */\n size?: \"m\" | \"s\";\n /** Disables button but keeps it focusable. */\n \"aria-disabled\"?: boolean;\n /** Whether the button is in a pending state. */\n isPending?: boolean;\n /** Whether the button is in a succeeded state. */\n isSucceeded?: boolean;\n /** Whether the button is in a failed state. */\n isFailed?: boolean;\n /** Whether the button is in a read only state. */\n isReadOnly?: boolean;\n /** @internal */\n unstyled?: boolean;\n /** @internal */\n ariaSlot?: string | null;\n}\n\nconst disablePendingProps = (props: ButtonProps) => {\n if (\n props.isPending ||\n props.isSucceeded ||\n props.isFailed ||\n props[\"aria-disabled\"] ||\n props.isReadOnly\n ) {\n props = { ...props };\n props.onPress = undefined;\n props.onPressStart = undefined;\n props.onPressEnd = undefined;\n props.onPressChange = undefined;\n props.onPressUp = undefined;\n props.onKeyDown = undefined;\n props.onKeyUp = undefined;\n }\n\n return props;\n};\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const Button = flowComponent(\"Button\", (props) => {\n props = disablePendingProps(props);\n\n const {\n color = \"primary\",\n variant = \"solid\",\n children,\n className,\n size = \"m\",\n isPending,\n isSucceeded,\n isFailed,\n \"aria-disabled\": ariaDisabled,\n ref,\n slot: ignoredSlotProp,\n ariaSlot: slot,\n unstyled,\n isReadOnly,\n ...restProps\n } = props;\n\n const rootClassName = unstyled\n ? className\n : clsx(\n styles.button,\n isPending && styles.isPending,\n isSucceeded && styles.isSucceeded,\n isFailed && styles.isFailed,\n styles[`size-${size}`],\n styles[color],\n styles[variant],\n className,\n /**\n * Workaround warning: The Aria.Button does not support \"aria-disabled\"\n * by now, so this Button will be visually disabled via CSS.\n */\n ariaDisabled && styles.ariaDisabled,\n );\n\n useAriaAnnounceActionState(\n isPending\n ? \"isPending\"\n : isSucceeded\n ? \"isSucceeded\"\n : isFailed\n ? \"isFailed\"\n : \"isIdle\",\n );\n\n const propsContext: PropsContext = {\n Icon: {\n className: styles.icon,\n \"aria-hidden\": true,\n size,\n },\n Text: {\n className: styles.text,\n },\n Avatar: {\n className: styles.avatar,\n },\n CounterBadge: {\n className: styles.counterBadge,\n },\n Image: {\n className: styles.image,\n },\n };\n\n const StateIconComponent = isSucceeded\n ? IconSucceeded\n : isFailed\n ? IconFailed\n : isPending\n ? LoadingSpinner\n : undefined;\n\n const stateIcon = StateIconComponent && (\n <StateIconComponent\n size={size}\n className={styles.stateIcon}\n status={isFailed ? \"danger\" : isSucceeded ? \"success\" : undefined}\n />\n );\n\n const isStringContent = typeof children === \"string\";\n\n return (\n <ClearPropsContext>\n <Aria.Button\n className={rootClassName}\n ref={ref}\n slot={slot}\n data-readonly={isReadOnly}\n {...restProps}\n >\n <PropsContextProvider props={propsContext}>\n <Wrap if={!unstyled}>\n <span className={styles.content}>\n <Wrap if={isStringContent}>\n <Text className={styles.text}>{children}</Text>\n </Wrap>\n </span>\n </Wrap>\n </PropsContextProvider>\n {stateIcon}\n </Aria.Button>\n </ClearPropsContext>\n );\n});\n\nexport default Button;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AA2CA,MAAM,mBAAA,GAAsB,CAAC,KAAuB,KAAA;AAClD,EACE,IAAA,KAAA,CAAM,SACN,IAAA,KAAA,CAAM,WACN,IAAA,KAAA,CAAM,YACN,KAAM,CAAA,eAAe,CACrB,IAAA,KAAA,CAAM,UACN,EAAA;AACA,IAAQ,KAAA,GAAA,EAAE,GAAG,KAAM,EAAA;AACnB,IAAA,KAAA,CAAM,OAAU,GAAA,MAAA;AAChB,IAA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AA,EAAA,SAAA,EAAW,MAAO,CAAA,OAAA,EACtB,8BAAC,IAAK,EAAA,EAAA,EAAA,EAAI,eACR,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,SAAA,EAAW,MAAO,CAAA,IAAA,EAAO,QAAS,EAAA,CAAA,EAC1C,CACF,EAAA,CAAA,EACF,CACF,EAAA,CAAA;AAAA,QACC;AAAA;AAAA;AAAA,GAEL,EAAA,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -2,20 +2,12 @@
|
|
|
2
2
|
/* */
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
import 'react';
|
|
5
|
-
import { ClearPropsContext } from '../ClearPropsContext/ClearPropsContext.mjs';
|
|
6
5
|
import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
|
|
7
|
-
import { Wrap } from '../Wrap/Wrap.mjs';
|
|
8
6
|
|
|
9
7
|
const Content = flowComponent("Content", (props) => {
|
|
10
|
-
const {
|
|
11
|
-
children,
|
|
12
|
-
elementType = "div",
|
|
13
|
-
ref,
|
|
14
|
-
clearPropsContext = true,
|
|
15
|
-
...rest
|
|
16
|
-
} = props;
|
|
8
|
+
const { children, elementType = "div", ref, ...rest } = props;
|
|
17
9
|
const Element = elementType;
|
|
18
|
-
return /* @__PURE__ */ jsx(
|
|
10
|
+
return /* @__PURE__ */ jsx(Element, { ref, ...rest, children });
|
|
19
11
|
});
|
|
20
12
|
|
|
21
13
|
export { Content, Content as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.mjs","sources":["../../../../../../src/components/Content/Content.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport React from \"react\";\nimport
|
|
1
|
+
{"version":3,"file":"Content.mjs","sources":["../../../../../../src/components/Content/Content.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport React from \"react\";\nimport type { PropsWithElementType } from \"@/lib/types/props\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\n\nexport interface ContentProps\n extends PropsWithChildren,\n PropsWithElementType<\"div\" | \"section\" | \"span\">,\n FlowComponentProps {\n /** @internal */\n slot?: string;\n}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const Content = flowComponent(\"Content\", (props) => {\n const { children, elementType = \"div\", ref, ...rest } = props;\n\n const Element = elementType;\n\n return (\n <Element ref={ref} {...rest}>\n {children}\n </Element>\n );\n});\n\nexport default Content;\n"],"names":[],"mappings":";;;;AAkBO,MAAM,OAAU,GAAA,aAAA,CAAc,SAAW,EAAA,CAAC,KAAU,KAAA;AACzD,EAAA,MAAM,EAAE,QAAU,EAAA,WAAA,GAAc,OAAO,GAAK,EAAA,GAAG,MAAS,GAAA,KAAA;AAExD,EAAA,MAAM,OAAU,GAAA,WAAA;AAEhB,EAAA,uBACG,GAAA,CAAA,OAAA,EAAA,EAAQ,GAAW,EAAA,GAAG,MACpB,QACH,EAAA,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -22,7 +22,8 @@ const FileDropZone = flowComponent(
|
|
|
22
22
|
onChange: onChangeDropZone,
|
|
23
23
|
children,
|
|
24
24
|
name,
|
|
25
|
-
isDisabled
|
|
25
|
+
isDisabled,
|
|
26
|
+
isReadOnly
|
|
26
27
|
} = props;
|
|
27
28
|
const fileFieldRef = useRef(null);
|
|
28
29
|
const rootClassName = clsx(
|
|
@@ -38,7 +39,8 @@ const FileDropZone = flowComponent(
|
|
|
38
39
|
accept,
|
|
39
40
|
multiple,
|
|
40
41
|
Button: { variant: "outline", color: "dark" },
|
|
41
|
-
isDisabled
|
|
42
|
+
isDisabled,
|
|
43
|
+
isReadOnly
|
|
42
44
|
},
|
|
43
45
|
Heading: {
|
|
44
46
|
className: styles.heading
|
|
@@ -47,6 +49,9 @@ const FileDropZone = flowComponent(
|
|
|
47
49
|
Text: { className: styles.text }
|
|
48
50
|
};
|
|
49
51
|
const onDropHandler = async (event) => {
|
|
52
|
+
if (isReadOnly) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
50
55
|
const fileDropItems = event.items.filter(
|
|
51
56
|
(file) => file.kind === "file"
|
|
52
57
|
);
|
|
@@ -75,6 +80,7 @@ const FileDropZone = flowComponent(
|
|
|
75
80
|
className: rootClassName,
|
|
76
81
|
onDrop: onDropHandler,
|
|
77
82
|
isDisabled,
|
|
83
|
+
"data-readonly": isReadOnly,
|
|
78
84
|
children: /* @__PURE__ */ jsx(IllustratedMessage, { color: "dark", children: /* @__PURE__ */ jsx(PropsContextProvider, { props: propsContext, mergeInParentContext: true, children }) })
|
|
79
85
|
}
|
|
80
86
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileDropZone.mjs","sources":["../../../../../../src/components/FileDropZone/FileDropZone.tsx"],"sourcesContent":["import { type FC, type PropsWithChildren, useRef } from \"react\";\nimport React from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport { IllustratedMessage } from \"@/components/IllustratedMessage\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport styles from \"./FileDropZone.module.scss\";\nimport clsx from \"clsx\";\nimport type { FileInputOnChangeHandler } from \"@/components/FileField/components/FileInput\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport type { DropEvent, FocusableElement } from \"@react-types/shared\";\nimport { addAwaitedArrayBuffer } from \"@mittwald/flow-core\";\n\nexport interface FileDropZoneProps\n extends PropsWithClassName,\n FlowComponentProps<FocusableElement>,\n PropsWithChildren,\n Pick<Aria.InputProps, \"accept\" | \"multiple\" | \"name\">,\n Pick<Aria.DropZoneProps, \"isDisabled\"> {\n onChange?: FileInputOnChangeHandler;\n}\n\n/** @flr-generate all */\nexport const FileDropZone: FC<FileDropZoneProps> = flowComponent(\n \"FileDropZone\",\n (props) => {\n const {\n multiple,\n accept,\n className,\n onChange: onChangeDropZone,\n children,\n name,\n isDisabled,\n } = props;\n\n const fileFieldRef = useRef<HTMLInputElement>(null);\n const rootClassName = clsx(\n styles.fileDropZone,\n isDisabled && styles.disabled,\n className,\n );\n\n const propsContext: PropsContext = {\n FileField: {\n name,\n onChange: onChangeDropZone,\n ref: fileFieldRef,\n accept: accept,\n multiple: multiple,\n Button: { variant: \"outline\", color: \"dark\" },\n isDisabled,\n },\n Heading: {\n className: styles.heading,\n },\n Icon: { className: styles.icon },\n Text: { className: styles.text },\n };\n\n const onDropHandler = async (event: DropEvent) => {\n const fileDropItems = event.items.filter(\n (file) => file.kind === \"file\",\n ) as Aria.FileDropItem[];\n\n const files = await Promise.all(\n fileDropItems\n .filter((f) => !accept || accept?.includes(f.type))\n .map(async (f) => {\n const file = await f.getFile();\n return await addAwaitedArrayBuffer(file);\n }),\n );\n\n if (files.length > 0) {\n const fileTransfer = new DataTransfer();\n for (const file of multiple ? files : [files[0]]) {\n if (file) {\n fileTransfer.items.add(file);\n }\n }\n\n onChangeDropZone?.(fileTransfer.files);\n if (fileFieldRef.current) {\n fileFieldRef.current.files = fileTransfer.files;\n }\n }\n };\n\n return (\n <Aria.DropZone\n className={rootClassName}\n onDrop={onDropHandler}\n isDisabled={isDisabled}\n >\n <IllustratedMessage color=\"dark\">\n <PropsContextProvider props={propsContext} mergeInParentContext>\n {children}\n </PropsContextProvider>\n </IllustratedMessage>\n </Aria.DropZone>\n );\n },\n);\n\nexport default FileDropZone;\n"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"FileDropZone.mjs","sources":["../../../../../../src/components/FileDropZone/FileDropZone.tsx"],"sourcesContent":["import { type FC, type PropsWithChildren, useRef } from \"react\";\nimport React from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport { IllustratedMessage } from \"@/components/IllustratedMessage\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport styles from \"./FileDropZone.module.scss\";\nimport clsx from \"clsx\";\nimport type { FileInputOnChangeHandler } from \"@/components/FileField/components/FileInput\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport type { DropEvent, FocusableElement } from \"@react-types/shared\";\nimport { addAwaitedArrayBuffer } from \"@mittwald/flow-core\";\n\nexport interface FileDropZoneProps\n extends PropsWithClassName,\n FlowComponentProps<FocusableElement>,\n PropsWithChildren,\n Pick<Aria.InputProps, \"accept\" | \"multiple\" | \"name\">,\n Pick<Aria.DropZoneProps, \"isDisabled\"> {\n onChange?: FileInputOnChangeHandler;\n /** Whether the component is read only. */\n isReadOnly?: boolean;\n}\n\n/** @flr-generate all */\nexport const FileDropZone: FC<FileDropZoneProps> = flowComponent(\n \"FileDropZone\",\n (props) => {\n const {\n multiple,\n accept,\n className,\n onChange: onChangeDropZone,\n children,\n name,\n isDisabled,\n isReadOnly,\n } = props;\n\n const fileFieldRef = useRef<HTMLInputElement>(null);\n const rootClassName = clsx(\n styles.fileDropZone,\n isDisabled && styles.disabled,\n className,\n );\n\n const propsContext: PropsContext = {\n FileField: {\n name,\n onChange: onChangeDropZone,\n ref: fileFieldRef,\n accept: accept,\n multiple: multiple,\n Button: { variant: \"outline\", color: \"dark\" },\n isDisabled,\n isReadOnly,\n },\n Heading: {\n className: styles.heading,\n },\n Icon: { className: styles.icon },\n Text: { className: styles.text },\n };\n\n const onDropHandler = async (event: DropEvent) => {\n if (isReadOnly) {\n return;\n }\n\n const fileDropItems = event.items.filter(\n (file) => file.kind === \"file\",\n ) as Aria.FileDropItem[];\n\n const files = await Promise.all(\n fileDropItems\n .filter((f) => !accept || accept?.includes(f.type))\n .map(async (f) => {\n const file = await f.getFile();\n return await addAwaitedArrayBuffer(file);\n }),\n );\n\n if (files.length > 0) {\n const fileTransfer = new DataTransfer();\n for (const file of multiple ? files : [files[0]]) {\n if (file) {\n fileTransfer.items.add(file);\n }\n }\n\n onChangeDropZone?.(fileTransfer.files);\n if (fileFieldRef.current) {\n fileFieldRef.current.files = fileTransfer.files;\n }\n }\n };\n\n return (\n <Aria.DropZone\n className={rootClassName}\n onDrop={onDropHandler}\n isDisabled={isDisabled}\n data-readonly={isReadOnly}\n >\n <IllustratedMessage color=\"dark\">\n <PropsContextProvider props={propsContext} mergeInParentContext>\n {children}\n </PropsContextProvider>\n </IllustratedMessage>\n </Aria.DropZone>\n );\n },\n);\n\nexport default FileDropZone;\n"],"names":[],"mappings":";;;;;;;;;;;;AA6BO,MAAM,YAAsC,GAAA,aAAA;AAAA,EACjD,cAAA;AAAA,EACA,CAAC,KAAU,KAAA;AACT,IAAM,MAAA;AAAA,MACJ,QAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAU,EAAA,gBAAA;AAAA,MACV,QAAA;AAAA,MACA,IAAA;AAAA,MACA,UAAA;AAAA,MACA;AAAA,KACE,GAAA,KAAA;AAEJ,IAAM,MAAA,YAAA,GAAe,OAAyB,IAAI,CAAA;AAClD,IAAA,MAAM,aAAgB,GAAA,IAAA;AAAA,MACpB,MAAO,CAAA,YAAA;AAAA,MACP,cAAc,MAAO,CAAA,QAAA;AAAA,MACrB;AAAA,KACF;AAEA,IAAA,MAAM,YAA6B,GAAA;AAAA,MACjC,SAAW,EAAA;AAAA,QACT,IAAA;AAAA,QACA,QAAU,EAAA,gBAAA;AAAA,QACV,GAAK,EAAA,YAAA;AAAA,QACL,MAAA;AAAA,QACA,QAAA;AAAA,QACA,MAAQ,EAAA,EAAE,OAAS,EAAA,SAAA,EAAW,OAAO,MAAO,EAAA;AAAA,QAC5C,UAAA;AAAA,QACA;AAAA,OACF;AAAA,MACA,OAAS,EAAA;AAAA,QACP,WAAW,MAAO,CAAA;AAAA,OACpB;AAAA,MACA,IAAM,EAAA,EAAE,SAAW,EAAA,MAAA,CAAO,IAAK,EAAA;AAAA,MAC/B,IAAM,EAAA,EAAE,SAA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AAA;AAAA,QAEf,QAAA,kBAAA,GAAA,CAAC,kBAAmB,EAAA,EAAA,KAAA,EAAM,MACxB,EAAA,QAAA,kBAAA,GAAA,CAAC,oBAAqB,EAAA,EAAA,KAAA,EAAO,YAAc,EAAA,oBAAA,EAAoB,IAC5D,EAAA,QAAA,EACH,CACF,EAAA;AAAA;AAAA,KACF;AAAA;AAGN;;;;"}
|
|
@@ -23,6 +23,7 @@ const FileField = flowComponent("FileField", (props) => {
|
|
|
23
23
|
isDisabled,
|
|
24
24
|
validationBehavior,
|
|
25
25
|
onChange,
|
|
26
|
+
isReadOnly,
|
|
26
27
|
...restInputProps
|
|
27
28
|
} = props;
|
|
28
29
|
const inputRef = useObjectRef(ref);
|
|
@@ -60,6 +61,7 @@ const FileField = flowComponent("FileField", (props) => {
|
|
|
60
61
|
return /* @__PURE__ */ jsx(InputContext.Provider, { value: inputProps, children: /* @__PURE__ */ jsx(FieldErrorContext.Provider, { value: formValidationState.displayValidation, children: /* @__PURE__ */ jsx(PropsContextProvider, { props: propsContext, children: /* @__PURE__ */ jsx(
|
|
61
62
|
"div",
|
|
62
63
|
{
|
|
64
|
+
"data-readonly": isReadOnly,
|
|
63
65
|
"data-required": !!isRequired || void 0,
|
|
64
66
|
"data-invalid": formValidationState.displayValidation.isInvalid || void 0,
|
|
65
67
|
className: formFieldStyles.formField,
|
|
@@ -67,7 +69,8 @@ const FileField = flowComponent("FileField", (props) => {
|
|
|
67
69
|
FileInput,
|
|
68
70
|
{
|
|
69
71
|
ref,
|
|
70
|
-
|
|
72
|
+
isReadOnly,
|
|
73
|
+
onChange: isReadOnly ? void 0 : handleOnChange,
|
|
71
74
|
isDisabled,
|
|
72
75
|
children
|
|
73
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileField.mjs","sources":["../../../../../../src/components/FileField/FileField.tsx"],"sourcesContent":["import formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport { useFormValidation } from \"@react-aria/form\";\nimport { useFormValidationState } from \"@react-stately/form\";\nimport type { PropsWithChildren } from \"react\";\nimport type * as Aria from \"react-aria-components\";\nimport { FieldErrorContext, InputContext } from \"react-aria-components\";\nimport type { FileInputOnChangeHandler } from \"@/components/FileField/components/FileInput\";\nimport { FileInput } from \"@/components/FileField/components/FileInput\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { addAwaitedArrayBuffer } from \"@mittwald/flow-core\";\nexport interface FileFieldProps\n extends PropsWithChildren,\n FlowComponentProps<HTMLInputElement>,\n Pick<Aria.InputProps, \"accept\" | \"multiple\" | \"name\">,\n Pick<\n Aria.TextFieldProps,\n \"isRequired\" | \"isInvalid\" | \"validationBehavior\" | \"isDisabled\"\n > {\n /** Handler that is called when the file input changes. */\n onChange?: FileInputOnChangeHandler;\n}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const FileField = flowComponent(\"FileField\", (props) => {\n const {\n children,\n ref,\n isRequired,\n isInvalid,\n isDisabled,\n validationBehavior,\n onChange,\n ...restInputProps\n } = props;\n const inputRef = useObjectRef(ref);\n\n const formValidationState = useFormValidationState({\n value: undefined,\n validationBehavior,\n isInvalid,\n });\n\n useFormValidation({ validationBehavior }, formValidationState, inputRef);\n\n const inputProps = {\n ...restInputProps,\n ref: inputRef,\n \"aria-invalid\": formValidationState.displayValidation.isInvalid,\n value: undefined,\n };\n\n const propsContext: PropsContext = {\n Label: {\n className: formFieldStyles.label,\n optional: !props.isRequired,\n },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n },\n FieldError: {\n className: formFieldStyles.customFieldError,\n },\n };\n\n const handleOnChange: FileInputOnChangeHandler = (fileList) => {\n if (fileList && onChange) {\n Promise.all(Array.from(fileList).map(addAwaitedArrayBuffer)).then(() =>\n onChange(fileList),\n );\n }\n };\n\n return (\n <InputContext.Provider value={inputProps}>\n <FieldErrorContext.Provider value={formValidationState.displayValidation}>\n <PropsContextProvider props={propsContext}>\n <div\n data-required={!!isRequired || undefined}\n data-invalid={\n formValidationState.displayValidation.isInvalid || undefined\n }\n className={formFieldStyles.formField}\n >\n <FileInput\n ref={ref}\n onChange={handleOnChange}\n isDisabled={isDisabled}\n >\n {children}\n </FileInput>\n </div>\n </PropsContextProvider>\n </FieldErrorContext.Provider>\n </InputContext.Provider>\n );\n});\nexport default FileField;\n"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"FileField.mjs","sources":["../../../../../../src/components/FileField/FileField.tsx"],"sourcesContent":["import formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport { useFormValidation } from \"@react-aria/form\";\nimport { useFormValidationState } from \"@react-stately/form\";\nimport type { PropsWithChildren } from \"react\";\nimport type * as Aria from \"react-aria-components\";\nimport { FieldErrorContext, InputContext } from \"react-aria-components\";\nimport type { FileInputOnChangeHandler } from \"@/components/FileField/components/FileInput\";\nimport { FileInput } from \"@/components/FileField/components/FileInput\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { addAwaitedArrayBuffer } from \"@mittwald/flow-core\";\n\nexport interface FileFieldProps\n extends PropsWithChildren,\n FlowComponentProps<HTMLInputElement>,\n Pick<Aria.InputProps, \"accept\" | \"multiple\" | \"name\">,\n Pick<\n Aria.TextFieldProps,\n \"isRequired\" | \"isInvalid\" | \"validationBehavior\" | \"isDisabled\"\n > {\n /** Handler that is called when the file input changes. */\n onChange?: FileInputOnChangeHandler;\n /** Whether the component is read only. */\n isReadOnly?: boolean;\n}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const FileField = flowComponent(\"FileField\", (props) => {\n const {\n children,\n ref,\n isRequired,\n isInvalid,\n isDisabled,\n validationBehavior,\n onChange,\n isReadOnly,\n ...restInputProps\n } = props;\n const inputRef = useObjectRef(ref);\n\n const formValidationState = useFormValidationState({\n value: undefined,\n validationBehavior,\n isInvalid,\n });\n\n useFormValidation({ validationBehavior }, formValidationState, inputRef);\n\n const inputProps = {\n ...restInputProps,\n ref: inputRef,\n \"aria-invalid\": formValidationState.displayValidation.isInvalid,\n value: undefined,\n };\n\n const propsContext: PropsContext = {\n Label: {\n className: formFieldStyles.label,\n optional: !props.isRequired,\n },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n },\n FieldError: {\n className: formFieldStyles.customFieldError,\n },\n };\n\n const handleOnChange: FileInputOnChangeHandler = (fileList) => {\n if (fileList && onChange) {\n Promise.all(Array.from(fileList).map(addAwaitedArrayBuffer)).then(() =>\n onChange(fileList),\n );\n }\n };\n\n return (\n <InputContext.Provider value={inputProps}>\n <FieldErrorContext.Provider value={formValidationState.displayValidation}>\n <PropsContextProvider props={propsContext}>\n <div\n data-readonly={isReadOnly}\n data-required={!!isRequired || undefined}\n data-invalid={\n formValidationState.displayValidation.isInvalid || undefined\n }\n className={formFieldStyles.formField}\n >\n <FileInput\n ref={ref}\n isReadOnly={isReadOnly}\n onChange={isReadOnly ? undefined : handleOnChange}\n isDisabled={isDisabled}\n >\n {children}\n </FileInput>\n </div>\n </PropsContextProvider>\n </FieldErrorContext.Provider>\n </InputContext.Provider>\n );\n});\nexport default FileField;\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAiCO,MAAM,SAAY,GAAA,aAAA,CAAc,WAAa,EAAA,CAAC,KAAU,KAAA;AAC7D,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,GAAA;AAAA,IACA,UAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA,IACA,kBAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,G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GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,eAAe,EAAA,UAAA;AAAA,MACf,eAAA,EAAe,CAAC,CAAC,UAAc,IAAA,MAAA;AAAA,MAC/B,cAAA,EACE,mBAAoB,CAAA,iBAAA,CAAkB,SAAa,IAAA,MAAA;AAAA,MAErD,WAAW,eAAgB,CAAA,SAAA;AAAA,MAE3B,QAAA,kBAAA,GAAA;AAAA,QAAC,SAAA;AAAA,QAAA;AAAA,UACC,GAAA;AAAA,UACA,UAAA;AAAA,UACA,QAAA,EAAU,aAAa,MAAY,GAAA,cAAA;AAAA,UACnC,UAAA;AAAA,UAEC;AAAA;AAAA;AACH;AAAA,GACF,EACF,GACF,CACF,EAAA,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -10,7 +10,7 @@ import { PropsContextProvider } from '../../../lib/propsContext/PropsContextProv
|
|
|
10
10
|
import styles from './FileInput.module.scss.mjs';
|
|
11
11
|
|
|
12
12
|
const FileInput = (props) => {
|
|
13
|
-
const { children, isDisabled, onChange, ref } = props;
|
|
13
|
+
const { children, isDisabled, onChange, isReadOnly, ref } = props;
|
|
14
14
|
const inputRef = useObjectRef(ref);
|
|
15
15
|
const handlePress = () => {
|
|
16
16
|
if (inputRef.current?.value) {
|
|
@@ -26,7 +26,8 @@ const FileInput = (props) => {
|
|
|
26
26
|
Button: {
|
|
27
27
|
onPress: handlePress,
|
|
28
28
|
className: styles.trigger,
|
|
29
|
-
isDisabled
|
|
29
|
+
isDisabled,
|
|
30
|
+
isReadOnly
|
|
30
31
|
}
|
|
31
32
|
};
|
|
32
33
|
return /* @__PURE__ */ jsxs(PropsContextProvider, { props: propsContext, mergeInParentContext: true, children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.mjs","sources":["../../../../../../../src/components/FileField/components/FileInput.tsx"],"sourcesContent":["import type { FC, PropsWithChildren, Ref } from \"react\";\nimport React, { type ChangeEvent } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport styles from \"./FileInput.module.scss\";\n\nexport type FileInputOnChangeHandler = (files: FileList | null) => void;\n\n/** @internal */\nexport interface FileInputProps extends PropsWithChildren {\n onChange?: FileInputOnChangeHandler;\n isDisabled?: boolean;\n ref?: Ref<HTMLInputElement>;\n}\n\n/** @internal */\nexport const FileInput: FC<FileInputProps> = (props) => {\n const { children, isDisabled, onChange, ref } = props;\n const inputRef = useObjectRef(ref);\n\n const handlePress = () => {\n if (inputRef.current?.value) {\n inputRef.current.value = \"\";\n onChange?.(null);\n }\n inputRef.current?.click();\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n onChange?.(event.target.files);\n };\n\n const propsContext: PropsContext = {\n Button: {\n onPress: handlePress,\n className: styles.trigger,\n isDisabled,\n },\n };\n\n return (\n <PropsContextProvider props={propsContext} mergeInParentContext>\n {children}\n <Aria.Input\n style={{ display: \"none\" }}\n type=\"file\"\n ref={inputRef}\n onChange={handleChange}\n />\n </PropsContextProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"FileInput.mjs","sources":["../../../../../../../src/components/FileField/components/FileInput.tsx"],"sourcesContent":["import type { FC, PropsWithChildren, Ref } from \"react\";\nimport React, { type ChangeEvent } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport styles from \"./FileInput.module.scss\";\n\nexport type FileInputOnChangeHandler = (files: FileList | null) => void;\n\n/** @internal */\nexport interface FileInputProps extends PropsWithChildren {\n onChange?: FileInputOnChangeHandler;\n isDisabled?: boolean;\n ref?: Ref<HTMLInputElement>;\n isReadOnly?: boolean;\n}\n\n/** @internal */\nexport const FileInput: FC<FileInputProps> = (props) => {\n const { children, isDisabled, onChange, isReadOnly, ref } = props;\n const inputRef = useObjectRef(ref);\n\n const handlePress = () => {\n if (inputRef.current?.value) {\n inputRef.current.value = \"\";\n onChange?.(null);\n }\n inputRef.current?.click();\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n onChange?.(event.target.files);\n };\n\n const propsContext: PropsContext = {\n Button: {\n onPress: handlePress,\n className: styles.trigger,\n isDisabled,\n isReadOnly,\n },\n };\n\n return (\n <PropsContextProvider props={propsContext} mergeInParentContext>\n {children}\n <Aria.Input\n style={{ display: \"none\" }}\n type=\"file\"\n ref={inputRef}\n onChange={handleChange}\n />\n </PropsContextProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAmBa,MAAA,SAAA,GAAgC,CAAC,KAAU,KAAA;AACtD,EAAA,MAAM,EAAE,QAAU,EAAA,UAAA,EAAY,QAAU,EAAA,UAAA,EAAY,KAAQ,GAAA,KAAA;AAC5D,EAAM,MAAA,QAAA,GAAW,aAAa,GAAG,CAAA;AAEjC,EAAA,MAAM,cAAc,MAAM;AACxB,IAAI,IAAA,QAAA,CAAS,SAAS,KAAO,EAAA;AAC3B,MAAA,QAAA,CAAS,QAAQ,KAAQ,GAAA,EAAA;AACzB,MAAA,QAAA,GAAW,IAAI,CAAA;AAAA;AAEjB,IAAA,QAAA,CAAS,SAAS,KAAM,EAAA;AAAA,GAC1B;AAEA,EAAM,MAAA,YAAA,GAAe,CAAC,KAAyC,KAAA;AAC7D,IAAW,QAAA,GAAA,KAAA,CAAM,OAAO,KAAK,CAAA;AAAA,GAC/B;AAEA,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,MAAQ,EAAA;AAAA,MACN,OAAS,EAAA,WAAA;AAAA,MACT,WAAW,MAAO,CAAA,OAAA;AAAA,MAClB,UAAA;AAAA,MACA;AAAA;AACF,GACF;AAEA,EAAA,uBACG,IAAA,CAAA,oBAAA,EAAA,EAAqB,KAAO,EAAA,YAAA,EAAc,sBAAoB,IAC5D,EAAA,QAAA,EAAA;AAAA,IAAA,QAAA;AAAA,oBACD,GAAA;AAAA,MAAC,IAAK,CAAA,KAAA;AAAA,MAAL;AAAA,QACC,KAAA,EAAO,EAAE,OAAA,EAAS,MAAO,EAAA;AAAA,QACzB,IAAK,EAAA,MAAA;AAAA,QACL,GAAK,EAAA,QAAA;AAAA,QACL,QAAU,EAAA;AAAA;AAAA;AACZ,GACF,EAAA,CAAA;AAEJ;;;;"}
|
package/dist/js/components/src/components/Navigation/components/NavigationGroup/NavigationGroup.mjs
CHANGED
|
@@ -33,7 +33,7 @@ const NavigationGroup = flowComponent("NavigationGroup", (props) => {
|
|
|
33
33
|
if (collapsable) {
|
|
34
34
|
return /* @__PURE__ */ jsx(PropsContextProvider, { mergeInParentContext: true, props: propsContext, children: /* @__PURE__ */ jsx(TunnelProvider, { children: /* @__PURE__ */ jsxs(Accordion, { defaultExpanded: true, className: rootClassName, children: [
|
|
35
35
|
children,
|
|
36
|
-
/* @__PURE__ */ jsx(Content, {
|
|
36
|
+
/* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx("ul", { children: /* @__PURE__ */ jsx(TunnelExit, { id: "groupLinks" }) }) })
|
|
37
37
|
] }) }) });
|
|
38
38
|
}
|
|
39
39
|
return /* @__PURE__ */ jsx(PropsContextProvider, { mergeInParentContext: true, props: propsContext, children: /* @__PURE__ */ jsx(TunnelProvider, { children: /* @__PURE__ */ jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationGroup.mjs","sources":["../../../../../../../../src/components/Navigation/components/NavigationGroup/NavigationGroup.tsx"],"sourcesContent":["import type { ComponentProps, PropsWithChildren } from \"react\";\nimport React, { useId } from \"react\";\nimport clsx from \"clsx\";\nimport styles from \"./NavigationGroup.module.scss\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport { Accordion } from \"@/components/Accordion\";\nimport { Content } from \"@/components/Content\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\n\nexport interface NavigationGroupProps\n extends PropsWithChildren<ComponentProps<\"section\">>,\n FlowComponentProps<HTMLElement> {\n collapsable?: boolean;\n}\n\n/** @flr-generate all */\nexport const NavigationGroup = flowComponent(\"NavigationGroup\", (props) => {\n const { children, className, collapsable, ...rest } = 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: generatedId,\n className: styles.label,\n \"aria-hidden\": true,\n },\n Link: {\n tunnelId: \"groupLinks\",\n },\n };\n\n if (collapsable) {\n return (\n <PropsContextProvider mergeInParentContext props={propsContext}>\n <TunnelProvider>\n <Accordion defaultExpanded className={rootClassName}>\n {children}\n <Content
|
|
1
|
+
{"version":3,"file":"NavigationGroup.mjs","sources":["../../../../../../../../src/components/Navigation/components/NavigationGroup/NavigationGroup.tsx"],"sourcesContent":["import type { ComponentProps, PropsWithChildren } from \"react\";\nimport React, { useId } from \"react\";\nimport clsx from \"clsx\";\nimport styles from \"./NavigationGroup.module.scss\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport { Accordion } from \"@/components/Accordion\";\nimport { Content } from \"@/components/Content\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\n\nexport interface NavigationGroupProps\n extends PropsWithChildren<ComponentProps<\"section\">>,\n FlowComponentProps<HTMLElement> {\n collapsable?: boolean;\n}\n\n/** @flr-generate all */\nexport const NavigationGroup = flowComponent(\"NavigationGroup\", (props) => {\n const { children, className, collapsable, ...rest } = 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: generatedId,\n className: styles.label,\n \"aria-hidden\": true,\n },\n Link: {\n tunnelId: \"groupLinks\",\n },\n };\n\n if (collapsable) {\n return (\n <PropsContextProvider mergeInParentContext props={propsContext}>\n <TunnelProvider>\n <Accordion defaultExpanded className={rootClassName}>\n {children}\n <Content>\n <ul>\n <TunnelExit id=\"groupLinks\" />\n </ul>\n </Content>\n </Accordion>\n </TunnelProvider>\n </PropsContextProvider>\n );\n }\n\n return (\n <PropsContextProvider mergeInParentContext props={propsContext}>\n <TunnelProvider>\n <section\n aria-labelledby={generatedId}\n className={rootClassName}\n {...rest}\n >\n <PropsContextProvider mergeInParentContext props={propsContext}>\n {children}\n <TunnelExit id=\"Label\" />\n <ul>\n <TunnelExit id=\"groupLinks\" />\n </ul>\n </PropsContextProvider>\n </section>\n </TunnelProvider>\n </PropsContextProvider>\n );\n});\n\nexport default NavigationGroup;\n"],"names":[],"mappings":";;;;;;;;;;;;AAoBO,MAAM,eAAkB,GAAA,aAAA,CAAc,iBAAmB,EAAA,CAAC,KAAU,KAAA;AACzE,EAAA,MAAM,EAAE,QAAU,EAAA,SAAA,EAAW,WAAa,EAAA,GAAG,MAAS,GAAA,KAAA;AAEtD,EAAA,MAAM,aAAgB,GAAA,IAAA;AAAA,IACpB,MAAO,CAAA,eAAA;AAAA,IACP,eAAe,MAAO,CAAA,WAAA;AAAA,IACtB;AAAA,GACF;AAEA,EAAA,MAAM,cAAc,KAAM,EAAA;AAE1B,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,KAAO,EAAA;AAAA,MACL,EAAI,EAAA,WAAA;AAAA,MACJ,WAAW,MAAO,CAAA,KAAA;AAAA,MAClB,aAAe,EAAA;AAAA,KACjB;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,QAAU,EAAA;AAAA;AACZ,GACF;AAEA,EAAA,IAAI,WAAa,EAAA;AACf,IAAA,uBACG,GAAA,CAAA,oBAAA,EAAA,EAAqB,oBAAoB,EAAA,IAAA,EAAC,KAAO,EAAA,YAAA,EAChD,QAAC,kBAAA,GAAA,CAAA,cAAA,EAAA,EACC,QAAC,kBAAA,IAAA,CAAA,SAAA,EAAA,EAAU,eAAe,EAAA,IAAA,EAAC,WAAW,aACnC,EAAA,QAAA,EAAA;AAAA,MAAA,QAAA;AAAA,sBACD,GAAA,CAAC,WACC,QAAC,kBAAA,GAAA,CAAA,IAAA,EAAA,EACC,8BAAC,UAAW,EAAA,EAAA,EAAA,EAAG,YAAa,EAAA,CAAA,EAC9B,CACF,EAAA;AAAA,KAAA,EACF,GACF,CACF,EAAA,CAAA;AAAA;AAIJ,EAAA,2BACG,oBAAqB,EAAA,EAAA,oBAAA,EAAoB,MAAC,KAAO,EAAA,YAAA,EAChD,8BAAC,cACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,iBAAiB,EAAA,WAAA;AAAA,MACjB,SAAW,EAAA,aAAA;AAAA,MACV,GAAG,IAAA;AAAA,MAEJ,QAAC,kBAAA,IAAA,CAAA,oBAAA,EAAA,EAAqB,oBAAoB,EAAA,IAAA,EAAC,OAAO,YAC/C,EAAA,QAAA,EAAA;AAAA,QAAA,QAAA;AAAA,wBACD,GAAA,CAAC,UAAW,EAAA,EAAA,EAAA,EAAG,OAAQ,EAAA,CAAA;AAAA,4BACtB,IACC,EAAA,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,EAAA,EAAG,cAAa,CAC9B,EAAA;AAAA,OACF,EAAA;AAAA;AAAA,KAEJ,CACF,EAAA,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -29,6 +29,7 @@ const Select = flowComponent("Select", (props) => {
|
|
|
29
29
|
},
|
|
30
30
|
controller: controllerFromProps,
|
|
31
31
|
ref,
|
|
32
|
+
isReadOnly,
|
|
32
33
|
...rest
|
|
33
34
|
} = props;
|
|
34
35
|
const rootClassName = clsx(
|
|
@@ -66,11 +67,12 @@ const Select = flowComponent("Select", (props) => {
|
|
|
66
67
|
...rest,
|
|
67
68
|
className: rootClassName,
|
|
68
69
|
ref,
|
|
69
|
-
onSelectionChange: handleOnSelectionChange,
|
|
70
|
-
onOpenChange: (isOpen2) => controller.setOpen(isOpen2),
|
|
70
|
+
onSelectionChange: isReadOnly ? void 0 : handleOnSelectionChange,
|
|
71
|
+
onOpenChange: (isOpen2) => !isReadOnly && controller.setOpen(isOpen2),
|
|
71
72
|
isOpen,
|
|
73
|
+
"data-readonly": isReadOnly,
|
|
72
74
|
children: /* @__PURE__ */ jsx(PropsContextProvider, { props: propsContext, children: /* @__PURE__ */ jsxs(TunnelProvider, { children: [
|
|
73
|
-
/* @__PURE__ */ jsxs(Aria.Button, { className: styles.toggle, children: [
|
|
75
|
+
/* @__PURE__ */ jsxs(Aria.Button, { "data-readonly": isReadOnly, className: styles.toggle, children: [
|
|
74
76
|
/* @__PURE__ */ jsx(Aria.SelectValue, {}),
|
|
75
77
|
/* @__PURE__ */ jsx(IconChevronDown, {})
|
|
76
78
|
] }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.mjs","sources":["../../../../../../src/components/Select/Select.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport type { Key } from \"react-aria-components\";\nimport * as Aria from \"react-aria-components\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport { FieldError } from \"@/components/FieldError\";\nimport styles from \"./Select.module.scss\";\nimport clsx from \"clsx\";\nimport { IconChevronDown } from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { Options } from \"@/components/Options\";\nimport { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { type OverlayController, useOverlayController } from \"@/lib/controller\";\n\nexport interface SelectProps\n extends PropsWithChildren<\n Omit<Aria.SelectProps<{ example: string }>, \"children\" | \"className\">\n >,\n FlowComponentProps,\n PropsWithClassName {\n /** Handler that is called when the selected value changes. */\n onChange?: (value: string | number) => void;\n /** An overlay controller to control the select option popover state. */\n controller?: OverlayController;\n}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const Select = flowComponent(\"Select\", (props) => {\n const {\n children,\n className,\n onChange = () => {\n // default: do nothing\n },\n onSelectionChange = () => {\n // default: do nothing\n },\n controller: controllerFromProps,\n ref,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.select,\n formFieldStyles.formField,\n className,\n );\n\n const propsContext: PropsContext = {\n Label: {\n className: formFieldStyles.label,\n optional: !props.isRequired,\n },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n },\n FieldError: {\n className: formFieldStyles.customFieldError,\n },\n Option: {\n tunnelId: \"options\",\n },\n };\n\n const handleOnSelectionChange = (id: Key | null) => {\n onChange(String(id));\n onSelectionChange(id);\n };\n\n const controllerFromContext = useOverlayController(\"Select\", {\n reuseControllerFromContext: true,\n });\n\n const controller = controllerFromProps ?? controllerFromContext;\n\n const isOpen = controller.useIsOpen();\n\n return (\n <Aria.Select\n {...rest}\n className={rootClassName}\n ref={ref}\n onSelectionChange={handleOnSelectionChange}\n onOpenChange={(isOpen) => controller.setOpen(isOpen)}\n isOpen={isOpen}\n >\n <PropsContextProvider props={propsContext}>\n <TunnelProvider>\n <Aria.Button className={styles.toggle}>\n <Aria.SelectValue />\n <IconChevronDown />\n </Aria.Button>\n\n {children}\n <Options controller={controller}>\n <TunnelExit id=\"options\" />\n </Options>\n\n <FieldError className={formFieldStyles.fieldError} />\n </TunnelProvider>\n </PropsContextProvider>\n </Aria.Select>\n );\n});\n\nexport default Select;\n"],"names":["isOpen"],"mappings":";;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Select.mjs","sources":["../../../../../../src/components/Select/Select.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport type { Key } from \"react-aria-components\";\nimport * as Aria from \"react-aria-components\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport { FieldError } from \"@/components/FieldError\";\nimport styles from \"./Select.module.scss\";\nimport clsx from \"clsx\";\nimport { IconChevronDown } from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { Options } from \"@/components/Options\";\nimport { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { type OverlayController, useOverlayController } from \"@/lib/controller\";\n\nexport interface SelectProps\n extends PropsWithChildren<\n Omit<Aria.SelectProps<{ example: string }>, \"children\" | \"className\">\n >,\n FlowComponentProps,\n PropsWithClassName {\n /** Handler that is called when the selected value changes. */\n onChange?: (value: string | number) => void;\n /** An overlay controller to control the select option popover state. */\n controller?: OverlayController;\n /** Whether the component is read only. */\n isReadOnly?: boolean;\n}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const Select = flowComponent(\"Select\", (props) => {\n const {\n children,\n className,\n onChange = () => {\n // default: do nothing\n },\n onSelectionChange = () => {\n // default: do nothing\n },\n controller: controllerFromProps,\n ref,\n isReadOnly,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.select,\n formFieldStyles.formField,\n className,\n );\n\n const propsContext: PropsContext = {\n Label: {\n className: formFieldStyles.label,\n optional: !props.isRequired,\n },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n },\n FieldError: {\n className: formFieldStyles.customFieldError,\n },\n Option: {\n tunnelId: \"options\",\n },\n };\n\n const handleOnSelectionChange = (id: Key | null) => {\n onChange(String(id));\n onSelectionChange(id);\n };\n\n const controllerFromContext = useOverlayController(\"Select\", {\n reuseControllerFromContext: true,\n });\n\n const controller = controllerFromProps ?? controllerFromContext;\n\n const isOpen = controller.useIsOpen();\n\n return (\n <Aria.Select\n {...rest}\n className={rootClassName}\n ref={ref}\n onSelectionChange={isReadOnly ? undefined : handleOnSelectionChange}\n onOpenChange={(isOpen) => !isReadOnly && controller.setOpen(isOpen)}\n isOpen={isOpen}\n data-readonly={isReadOnly}\n >\n <PropsContextProvider props={propsContext}>\n <TunnelProvider>\n <Aria.Button data-readonly={isReadOnly} className={styles.toggle}>\n <Aria.SelectValue />\n <IconChevronDown />\n </Aria.Button>\n\n {children}\n <Options controller={controller}>\n <TunnelExit id=\"options\" />\n </Options>\n\n <FieldError className={formFieldStyles.fieldError} />\n </TunnelProvider>\n </PropsContextProvider>\n </Aria.Select>\n );\n});\n\nexport default Select;\n"],"names":["isOpen"],"mappings":";;;;;;;;;;;;;;;;;;;AAmCO,MAAM,MAAS,GAAA,aAAA,CAAc,QAAU,EAAA,CAAC,KAAU,KAAA;AACvD,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAW,MAAM;AAAA,KAEjB;AAAA,IACA,oBAAoB,MAAM;AAAA,KAE1B;AAAA,IACA,UAAY,EAAA,mBAAA;AAAA,IACZ,GAAA;AAAA,IACA,UAAA;AAAA,IACA,GAAG;AAAA,GACD,GAAA,KAAA;AAEJ,EAAA,MAAM,aAAgB,GAAA,IAAA;AAAA,IACpB,MAAO,CAAA,MAAA;AAAA,IACP,eAAgB,CAAA,SAAA;AAAA,IAChB;AAAA,GACF;AAEA,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,KAAO,EAAA;AAAA,MACL,WAAW,eAAgB,CAAA,KAAA;AAAA,MAC3B,QAAA,EAAU,CAAC,KAAM,CAAA;AAAA,KACnB;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,WAAW,eAAgB,CAAA;AAAA,KAC7B;AAAA,IACA,UAAY,EAAA;AAAA,MACV,WAAW,eAAgB,CAAA;AAAA,KAC7B;AAAA,IACA,MAAQ,EAA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AA,eAAA,CAAgB,UAAY,EAAA;AAAA,OAAA,EACrD,CACF,EAAA;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
|
|
@@ -25,6 +25,7 @@ const Slider = flowComponent("Slider", (props) => {
|
|
|
25
25
|
isDisabled,
|
|
26
26
|
defaultValue,
|
|
27
27
|
showInitialMarker,
|
|
28
|
+
isReadOnly,
|
|
28
29
|
...rest
|
|
29
30
|
} = props;
|
|
30
31
|
const rootClassName = clsx(
|
|
@@ -61,6 +62,7 @@ const Slider = flowComponent("Slider", (props) => {
|
|
|
61
62
|
className: styles.decrement,
|
|
62
63
|
isDisabled,
|
|
63
64
|
excludeFromTabOrder: true,
|
|
65
|
+
isReadOnly,
|
|
64
66
|
children: /* @__PURE__ */ jsx(IconMinus, {})
|
|
65
67
|
}
|
|
66
68
|
),
|
|
@@ -74,6 +76,7 @@ const Slider = flowComponent("Slider", (props) => {
|
|
|
74
76
|
className: styles.increment,
|
|
75
77
|
isDisabled,
|
|
76
78
|
excludeFromTabOrder: true,
|
|
79
|
+
isReadOnly,
|
|
77
80
|
children: /* @__PURE__ */ jsx(IconPlus, {})
|
|
78
81
|
}
|
|
79
82
|
),
|
|
@@ -93,7 +96,14 @@ const Slider = flowComponent("Slider", (props) => {
|
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
98
|
),
|
|
96
|
-
/* @__PURE__ */ jsx(
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
Aria.SliderThumb,
|
|
101
|
+
{
|
|
102
|
+
name,
|
|
103
|
+
className: styles.handle,
|
|
104
|
+
isDisabled: isReadOnly
|
|
105
|
+
}
|
|
106
|
+
)
|
|
97
107
|
] }) })
|
|
98
108
|
]
|
|
99
109
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Slider.mjs","sources":["../../../../../../src/components/Slider/Slider.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport React from \"react\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"./Slider.module.scss\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { Button } from \"@/components/Button\";\nimport { IconMinus, IconPlus } from \"@/components/Icon/components/icons\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\n\nexport interface SliderProps\n extends FlowComponentProps<HTMLDivElement>,\n PropsWithChildren<Aria.SliderProps>,\n Pick<Aria.SliderThumbProps, \"name\"> {\n showInitialMarker?: boolean;\n}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const Slider = flowComponent(\"Slider\", (props) => {\n const {\n className,\n children,\n name,\n isDisabled,\n defaultValue,\n showInitialMarker,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.slider,\n isDisabled && styles.disabled,\n className,\n );\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const propsContext: PropsContext = {\n Label: {\n unstyled: true,\n },\n };\n\n return (\n <Aria.Slider\n className={rootClassName}\n isDisabled={isDisabled}\n defaultValue={defaultValue}\n {...rest}\n >\n <div className={styles.text}>\n <Aria.SliderOutput className={styles.value} />\n\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n </div>\n\n <Aria.SliderTrack className={styles.track}>\n {({ state }) => (\n <>\n <Button\n onPress={() => state.decrementThumb(0)}\n aria-label={stringFormatter.format(\"slider.decrement\")}\n variant=\"plain\"\n color=\"secondary\"\n className={styles.decrement}\n isDisabled={isDisabled}\n excludeFromTabOrder\n >\n <IconMinus />\n </Button>\n\n <Button\n onPress={() => state.incrementThumb(0)}\n aria-label={stringFormatter.format(\"slider.increment\")}\n variant=\"plain\"\n color=\"secondary\"\n className={styles.increment}\n isDisabled={isDisabled}\n excludeFromTabOrder\n >\n <IconPlus />\n </Button>\n\n <div\n className={styles.fill}\n style={{ width: state.getThumbPercent(0) * 100 + \"%\" }}\n />\n\n {showInitialMarker &&\n defaultValue &&\n typeof defaultValue === \"number\" && (\n <div\n className={styles.initialMarker}\n style={{\n left: `calc(${state.getValuePercent(defaultValue) * 100}% - 2px)`,\n }}\n />\n )}\n\n <Aria.SliderThumb
|
|
1
|
+
{"version":3,"file":"Slider.mjs","sources":["../../../../../../src/components/Slider/Slider.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport React from \"react\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport styles from \"./Slider.module.scss\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { Button } from \"@/components/Button\";\nimport { IconMinus, IconPlus } from \"@/components/Icon/components/icons\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\n\nexport interface SliderProps\n extends FlowComponentProps<HTMLDivElement>,\n PropsWithChildren<Aria.SliderProps>,\n Pick<Aria.SliderThumbProps, \"name\"> {\n showInitialMarker?: boolean;\n /** Whether the component is read only. */\n isReadOnly?: boolean;\n}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const Slider = flowComponent(\"Slider\", (props) => {\n const {\n className,\n children,\n name,\n isDisabled,\n defaultValue,\n showInitialMarker,\n isReadOnly,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n styles.slider,\n isDisabled && styles.disabled,\n className,\n );\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const propsContext: PropsContext = {\n Label: {\n unstyled: true,\n },\n };\n\n return (\n <Aria.Slider\n className={rootClassName}\n isDisabled={isDisabled}\n defaultValue={defaultValue}\n {...rest}\n >\n <div className={styles.text}>\n <Aria.SliderOutput className={styles.value} />\n\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n </div>\n\n <Aria.SliderTrack className={styles.track}>\n {({ state }) => (\n <>\n <Button\n onPress={() => state.decrementThumb(0)}\n aria-label={stringFormatter.format(\"slider.decrement\")}\n variant=\"plain\"\n color=\"secondary\"\n className={styles.decrement}\n isDisabled={isDisabled}\n excludeFromTabOrder\n isReadOnly={isReadOnly}\n >\n <IconMinus />\n </Button>\n\n <Button\n onPress={() => state.incrementThumb(0)}\n aria-label={stringFormatter.format(\"slider.increment\")}\n variant=\"plain\"\n color=\"secondary\"\n className={styles.increment}\n isDisabled={isDisabled}\n excludeFromTabOrder\n isReadOnly={isReadOnly}\n >\n <IconPlus />\n </Button>\n\n <div\n className={styles.fill}\n style={{ width: state.getThumbPercent(0) * 100 + \"%\" }}\n />\n\n {showInitialMarker &&\n defaultValue &&\n typeof defaultValue === \"number\" && (\n <div\n className={styles.initialMarker}\n style={{\n left: `calc(${state.getValuePercent(defaultValue) * 100}% - 2px)`,\n }}\n />\n )}\n\n <Aria.SliderThumb\n name={name}\n className={styles.handle}\n isDisabled={isReadOnly}\n />\n </>\n )}\n </Aria.SliderTrack>\n </Aria.Slider>\n );\n});\n\nexport default Slider;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AA2BO,MAAM,MAAS,GAAA,aAAA,CAAc,QAAU,EAAA,CAAC,KAAU,KAAA;AACvD,EAAM,MAAA;AAAA,IACJ,SAAA;AAAA,IACA,QAAA;AAAA,IACA,IAAA;AAAA,IACA,UAAA;AAAA,IACA,YAAA;AAAA,IACA,iBAAA;AAAA,IACA,UAAA;AAAA,IACA,GAAG;AAAA,GACD,GAAA,KAAA;AAEJ,EAAA,MAAM,aAAgB,GAAA,IAAA;AAAA,IACpB,MAAO,CAAA,MAAA;AAAA,IACP,cAAc,MAAO,CAAA,QAAA;AAAA,IACrB;AAAA,GACF;AAEA,EAAM,MAAA,eAAA,GAAkB,4BAA4B,OAAO,CAAA;AAE3D,EAAA,MAAM,YAA6B,GAAA;AAAA,IACj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eAAgB,CAAA,MAAA,CAAO,kBAAkB,CAAA;AAAA,cACrD,OAAQ,EAAA,OAAA;AAAA,cACR,KAAM,EAAA,WAAA;AAAA,cACN,WAAW,MAAO,CAAA,SAAA;AAAA,cAClB,UAAA;AAAA,cACA,mBAAmB,EAAA,IAAA;AAAA,cACnB,UAAA;AAAA,cAEA,8BAAC,QAAS,EAAA,EAAA;AAAA;AAAA,WACZ;AAAA,0BAEA,GAAA;AAAA,YAAC,KAAA;AAAA,YAAA;AAAA,cACC,WAAW,MAAO,CAAA,IAAA;AAAA,cAClB,KAAA,EAAO,EAAE,KAAO,EAAA,KAAA,CAAM,gBAAgB,CAAC,CAAA,GAAI,MAAM,GAAI;AAAA;AAAA,WACvD;AAAA,UAEC,iBACC,IAAA,YAAA,IACA,OAAO,YAAA,KAAiB,QACtB,oBAAA,GAAA;AAAA,YAAC,KAAA;AAAA,YAAA;AAAA,cACC,WAAW,MAAO,CAAA,aAAA;AAAA,cAClB,KAAO,EAAA;AAAA,gBACL,MAAM,CAAQ,KAAA,EAAA,KAAA,CAAM,eAAgB,CAAA,YAAY,IAAI,GAAG,CAAA,QAAA;AAAA;AACzD;AAAA,WACF;AAAA,0BAGJ,GAAA;AAAA,YAAC,IAAK,CAAA,WAAA;AAAA,YAAL;AAAA,cACC,IAAA;AAAA,cACA,WAAW,MAAO,CAAA,MAAA;AAAA,cAClB,UAAY,EAAA;AAAA;AAAA;AACd,SAAA,EACF,CAEJ,EAAA;AAAA;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/Field/Field.tsx"],"sourcesContent":["import { useFormContext } from \"@/integrations/react-hook-form/components/context/formContext\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { dynamic, PropsContextProvider } from \"@/lib/propsContext\";\nimport type { PropsWithChildren } from \"react\";\nimport {\n useController,\n type ControllerProps,\n type FieldValues,\n type UseFormReturn,\n} from \"react-hook-form\";\nimport FieldErrorView from \"@/views/FieldErrorView\";\n\nexport interface FieldProps<T extends FieldValues>\n extends Omit<ControllerProps<T>, \"render\">,\n PropsWithChildren {}\n\nexport function Field<T extends FieldValues>(props: FieldProps<T>) {\n const { children, name, defaultValue, ...rest } = props;\n\n const controller = useController(props);\n const formContext = useFormContext<T>();\n const value = controller.field.value;\n\n const fieldProps = {\n ...controller.field,\n name,\n form: formContext.id,\n isRequired: !!rest.rules?.required,\n validationBehavior: \"aria\" as const,\n defaultValue,\n isInvalid: controller.fieldState.invalid,\n children: dynamic((p) => {\n if (controller.fieldState.invalid) {\n return (\n <>\n {p.children}\n <FieldErrorView>\n {controller.fieldState.error?.message}\n </FieldErrorView>\n </>\n );\n }\n\n return p.children;\n }),\n };\n\n const { value: ignoredValue, ...fieldPropsWithoutValue } = fieldProps;\n\n const propsContext: PropsContext = {\n SearchField: fieldProps,\n TextField: fieldProps,\n TextArea: fieldProps,\n MarkdownEditor: fieldProps,\n\n Checkbox: {\n ...fieldProps,\n isSelected: value,\n },\n CheckboxGroup: fieldProps,\n CheckboxButton: {\n ...fieldProps,\n isSelected: value,\n },\n FileField: fieldProps,\n FileDropZone: fieldProps,\n NumberField: fieldProps,\n RadioGroup: fieldProps,\n Switch: {\n ...fieldProps,\n isSelected: value,\n },\n Slider: fieldProps,\n PasswordCreationField: fieldProps,\n DatePicker: fieldProps,\n DateRangePicker: fieldProps,\n TimeField: fieldProps,\n SegmentedControl: fieldProps,\n Select: {\n ...fieldProps,\n selectedKey: value,\n },\n ComboBox: {\n ...fieldPropsWithoutValue,\n selectedKey: value,\n },\n };\n\n return (\n <PropsContextProvider\n props={propsContext}\n dependencies={[controller.fieldState, controller.field, value]}\n >\n {children}\n </PropsContextProvider>\n );\n}\n\nexport const typedField = <T extends FieldValues>(\n ignoredForm: UseFormReturn<T> | UseFormReturn<T>[\"control\"],\n): typeof Field<T> => Field;\n\nexport default Field;\n"],"names":[],"mappings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AA,KACd;AAAA,IACA,aAAe,EAAA,UAAA;AAAA,IACf,cAAgB,EAAA;AAAA,MACd,GAAG,UAAA;AAAA,MACH,UAAY,EAAA;AAAA,KACd;AAAA,IACA,SAAW,EAAA,UAAA;AAAA,IACX,YAAc,EAAA,UAAA;AAAA,IACd,WAAa,EAAA,UAAA;AAAA,IACb,UAAY,EAAA,UAAA;AAAA,IACZ,MAAQ,EAAA;AAAA,MACN,GAAG,UAAA;AAAA,MACH,UAAY,EAAA;AAAA,KACd;AAAA,IACA,MAAQ,EAAA,UAAA;AAAA,IACR,qBAAuB,EAAA,UAAA;AAAA,IACvB,UAAY,EAAA,UAAA;AAAA,IACZ,eAAiB,EAAA,UAAA;AAAA,IACjB,SAAW,EAAA,UAAA;AAAA,IACX,gBAAkB,EAAA,UAAA;AAAA,IAClB,MAAQ,EAAA;AAAA,MACN,GAAG,UAAA;AAAA,MACH,WAAa,EAAA;AAAA,KACf;AAAA,IACA,QAAU,EAAA;AAAA,MACR,GAAG,sBAAA;AAAA,MACH,WAAa,EAAA;AAAA;AACf,GACF;AAEA,EACE,uBAAA,GAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA,YAAA;AAAA,MACP,cAAc,CAAC,UAAA,CAAW,UAAY,EAAA,UAAA,CAAW,OAAO,KAAK,CAAA;AAAA,MAE5D;AAAA;AAAA,GACH;AAEJ;AAEa,MAAA,UAAA,GAAa,CACxB,WACoB,KAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"Field.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/Field/Field.tsx"],"sourcesContent":["import { useFormContext } from \"@/integrations/react-hook-form/components/context/formContext\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { dynamic, PropsContextProvider } from \"@/lib/propsContext\";\nimport type { PropsWithChildren } from \"react\";\nimport {\n useController,\n type ControllerProps,\n type FieldValues,\n type UseFormReturn,\n} from \"react-hook-form\";\nimport FieldErrorView from \"@/views/FieldErrorView\";\n\nexport interface FieldProps<T extends FieldValues>\n extends Omit<ControllerProps<T>, \"render\">,\n PropsWithChildren {}\n\nexport function Field<T extends FieldValues>(props: FieldProps<T>) {\n const { children, name, defaultValue, ...rest } = props;\n\n const controller = useController(props);\n const formContext = useFormContext<T>();\n const value = controller.field.value;\n\n const fieldProps = {\n ...controller.field,\n name,\n form: formContext.id,\n isRequired: !!rest.rules?.required,\n validationBehavior: \"aria\" as const,\n defaultValue,\n isInvalid: controller.fieldState.invalid,\n children: dynamic((p) => {\n if (controller.fieldState.invalid) {\n return (\n <>\n {p.children}\n <FieldErrorView>\n {controller.fieldState.error?.message}\n </FieldErrorView>\n </>\n );\n }\n\n return p.children;\n }),\n };\n\n const { value: ignoredValue, ...fieldPropsWithoutValue } = fieldProps;\n\n const propsContext: PropsContext = {\n SearchField: fieldProps,\n TextField: fieldProps,\n TextArea: fieldProps,\n MarkdownEditor: fieldProps,\n\n Checkbox: {\n ...fieldProps,\n isSelected: value,\n },\n CheckboxGroup: fieldProps,\n CheckboxButton: {\n ...fieldProps,\n isSelected: value,\n },\n FileField: fieldProps,\n FileDropZone: fieldProps,\n NumberField: fieldProps,\n RadioGroup: fieldProps,\n Switch: {\n ...fieldProps,\n isSelected: value,\n },\n Slider: fieldProps,\n PasswordCreationField: fieldProps,\n DatePicker: fieldProps,\n DateRangePicker: fieldProps,\n TimeField: fieldProps,\n SegmentedControl: fieldProps,\n Select: {\n ...fieldProps,\n selectedKey: value,\n },\n ComboBox: {\n ...fieldPropsWithoutValue,\n selectedKey: value,\n },\n };\n\n return (\n <PropsContextProvider\n mergeInParentContext\n props={propsContext}\n dependencies={[controller.fieldState, controller.field, value]}\n >\n {children}\n </PropsContextProvider>\n );\n}\n\nexport const typedField = <T extends FieldValues>(\n ignoredForm: UseFormReturn<T> | UseFormReturn<T>[\"control\"],\n): typeof Field<T> => Field;\n\nexport default Field;\n"],"names":[],"mappings":";;;;;;;;;;AAgBO,SAAS,MAA6B,KAAsB,EAAA;A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cAAgB,EAAA;AAAA,MACd,GAAG,UAAA;AAAA,MACH,UAAY,EAAA;AAAA,KACd;AAAA,IACA,SAAW,EAAA,UAAA;AAAA,IACX,YAAc,EAAA,UAAA;AAAA,IACd,WAAa,EAAA,UAAA;AAAA,IACb,UAAY,EAAA,UAAA;AAAA,IACZ,MAAQ,EAAA;AAAA,MACN,GAAG,UAAA;AAAA,MACH,UAAY,EAAA;AAAA,KACd;AAAA,IACA,MAAQ,EAAA,UAAA;AAAA,IACR,qBAAuB,EAAA,UAAA;AAAA,IACvB,UAAY,EAAA,UAAA;AAAA,IACZ,eAAiB,EAAA,UAAA;AAAA,IACjB,SAAW,EAAA,UAAA;AAAA,IACX,gBAAkB,EAAA,UAAA;AAAA,IAClB,MAAQ,EAAA;AAAA,MACN,GAAG,UAAA;AAAA,MACH,WAAa,EAAA;AAAA,KACf;AAAA,IACA,QAAU,EAAA;AAAA,MACR,GAAG,sBAAA;AAAA,MACH,WAAa,EAAA;AAAA;AACf,GACF;AAEA,EACE,uBAAA,GAAA;AAAA,IAAC,oBAAA;AAAA,IAAA;AAAA,MACC,oBAAoB,EAAA,IAAA;AAAA,MACpB,KAAO,EAAA,YAAA;AAAA,MACP,cAAc,CAAC,UAAA,CAAW,UAAY,EAAA,UAAA,CAAW,OAAO,KAAK,CAAA;AAAA,MAE5D;AAAA;AAAA,GACH;AAEJ;AAEa,MAAA,UAAA,GAAa,CACxB,WACoB,KAAA;;;;"}
|
|
@@ -6,6 +6,9 @@ import { FormContextProvider } from '../context/formContext.mjs';
|
|
|
6
6
|
import { useId, useRef, useMemo } from 'react';
|
|
7
7
|
import { FormProvider } from 'react-hook-form';
|
|
8
8
|
import { AfterFormSubmitEffect } from '../AfterFormSubmitEffect/AfterFormSubmitEffect.mjs';
|
|
9
|
+
import '../../../../lib/propsContext/propsContext.mjs';
|
|
10
|
+
import '../../../../lib/viewComponentContext/viewComponentContext.mjs';
|
|
11
|
+
import { PropsContextProvider } from '../../../../lib/propsContext/PropsContextProvider.mjs';
|
|
9
12
|
|
|
10
13
|
const DefaultFormComponent = (p) => /* @__PURE__ */ jsx("form", { ...p });
|
|
11
14
|
function Form(props) {
|
|
@@ -14,6 +17,7 @@ function Form(props) {
|
|
|
14
17
|
children,
|
|
15
18
|
onSubmit,
|
|
16
19
|
formComponent: FormView = DefaultFormComponent,
|
|
20
|
+
isReadOnly,
|
|
17
21
|
...formProps
|
|
18
22
|
} = props;
|
|
19
23
|
const formId = useId();
|
|
@@ -36,23 +40,52 @@ function Form(props) {
|
|
|
36
40
|
return result;
|
|
37
41
|
})(formEvent);
|
|
38
42
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
43
|
+
const propsContext = {
|
|
44
|
+
SearchField: { isReadOnly: true },
|
|
45
|
+
TextField: { isReadOnly: true },
|
|
46
|
+
TextArea: { isReadOnly: true },
|
|
47
|
+
MarkdownEditor: { isReadOnly: true },
|
|
48
|
+
Checkbox: { isReadOnly: true },
|
|
49
|
+
CheckboxGroup: { isReadOnly: true },
|
|
50
|
+
CheckboxButton: { isReadOnly: true },
|
|
51
|
+
FileField: { isReadOnly: true },
|
|
52
|
+
FileDropZone: { isReadOnly: true },
|
|
53
|
+
NumberField: { isReadOnly: true },
|
|
54
|
+
RadioGroup: { isReadOnly: true },
|
|
55
|
+
Switch: { isReadOnly: true },
|
|
56
|
+
Slider: { isReadOnly: true },
|
|
57
|
+
PasswordCreationField: { isReadOnly: true },
|
|
58
|
+
DatePicker: { isReadOnly: true },
|
|
59
|
+
DateRangePicker: { isReadOnly: true },
|
|
60
|
+
TimeField: { isReadOnly: true },
|
|
61
|
+
SegmentedControl: { isReadOnly: true },
|
|
62
|
+
Select: { isReadOnly: true },
|
|
63
|
+
ComboBox: { isReadOnly: true }
|
|
64
|
+
};
|
|
65
|
+
return /* @__PURE__ */ jsx(
|
|
66
|
+
PropsContextProvider,
|
|
67
|
+
{
|
|
68
|
+
props: isReadOnly ? propsContext : {},
|
|
69
|
+
mergeInParentContext: true,
|
|
70
|
+
children: /* @__PURE__ */ jsx(FormProvider, { ...form, children: /* @__PURE__ */ jsxs(FormContextProvider, { value: { form, id: formId }, children: [
|
|
71
|
+
/* @__PURE__ */ jsx(SubmitButtonStateProvider, { isAsyncSubmit, children: /* @__PURE__ */ jsx(
|
|
72
|
+
FormViewComponent,
|
|
73
|
+
{
|
|
74
|
+
...formProps,
|
|
75
|
+
id: formId,
|
|
76
|
+
onSubmit: handleOnSubmit,
|
|
77
|
+
children
|
|
78
|
+
}
|
|
79
|
+
) }),
|
|
80
|
+
/* @__PURE__ */ jsx(
|
|
81
|
+
AfterFormSubmitEffect,
|
|
82
|
+
{
|
|
83
|
+
submitHandlerResultRef
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] }) })
|
|
87
|
+
}
|
|
88
|
+
);
|
|
56
89
|
}
|
|
57
90
|
|
|
58
91
|
export { Form, Form as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"sourcesContent":["import { SubmitButtonStateProvider } from \"@/integrations/react-hook-form/components/ActionGroupWrapper/SubmitButtonStateProvider\";\nimport { FormContextProvider } from \"@/integrations/react-hook-form/components/context/formContext\";\nimport {\n type ComponentProps,\n type ComponentType,\n type FormEvent,\n type FormEventHandler,\n type PropsWithChildren,\n useMemo,\n
|
|
1
|
+
{"version":3,"file":"Form.mjs","sources":["../../../../../../../../src/integrations/react-hook-form/components/Form/Form.tsx"],"sourcesContent":["import { SubmitButtonStateProvider } from \"@/integrations/react-hook-form/components/ActionGroupWrapper/SubmitButtonStateProvider\";\nimport { FormContextProvider } from \"@/integrations/react-hook-form/components/context/formContext\";\nimport {\n type ComponentProps,\n type ComponentType,\n type FormEvent,\n type FormEventHandler,\n type PropsWithChildren,\n useId,\n useMemo,\n useRef,\n} from \"react\";\nimport type { FieldValues, UseFormReturn } from \"react-hook-form\";\nimport { FormProvider as RhfFormContextProvider } from \"react-hook-form\";\nimport { AfterFormSubmitEffect } from \"../AfterFormSubmitEffect/AfterFormSubmitEffect\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\n\nexport type FormOnSubmitHandler<F extends FieldValues> = Parameters<\n UseFormReturn<F>[\"handleSubmit\"]\n>[0];\n\ntype FormComponentType = ComponentType<\n PropsWithChildren<{\n id: string;\n onSubmit?: FormEventHandler | FormOnSubmitHandler<never>;\n }>\n>;\n\nexport interface FormProps<F extends FieldValues>\n extends Omit<ComponentProps<\"form\">, \"onSubmit\">,\n PropsWithChildren {\n form: UseFormReturn<F>;\n onSubmit: FormOnSubmitHandler<F>;\n formComponent?: FormComponentType;\n isReadOnly?: boolean;\n}\n\nconst DefaultFormComponent: FormComponentType = (p) => <form {...p} />;\n\nexport function Form<F extends FieldValues>(props: FormProps<F>) {\n const {\n form,\n children,\n onSubmit,\n formComponent: FormView = DefaultFormComponent,\n isReadOnly,\n ...formProps\n } = props;\n\n const formId = useId();\n const isAsyncSubmit = useRef(false);\n const submitHandlerResultRef = useRef<unknown>(null);\n const FormViewComponent = useMemo(() => FormView, [formId]);\n\n const handleOnSubmit = (e?: FormEvent<HTMLFormElement> | F) => {\n const { isSubmitting, isValidating } = form.control._formState;\n const formEvent =\n e && \"nativeEvent\" in e ? (e as FormEvent<HTMLFormElement>) : undefined;\n\n formEvent?.stopPropagation();\n\n if (isSubmitting || isValidating) {\n formEvent?.preventDefault();\n return;\n }\n\n submitHandlerResultRef.current = undefined;\n\n form.handleSubmit((values) => {\n const result = onSubmit(values, formEvent);\n isAsyncSubmit.current = result instanceof Promise;\n submitHandlerResultRef.current = result;\n return result;\n })(formEvent);\n };\n\n const propsContext: PropsContext = {\n SearchField: { isReadOnly: true },\n TextField: { isReadOnly: true },\n TextArea: { isReadOnly: true },\n MarkdownEditor: { isReadOnly: true },\n Checkbox: { isReadOnly: true },\n CheckboxGroup: { isReadOnly: true },\n CheckboxButton: { isReadOnly: true },\n FileField: { isReadOnly: true },\n FileDropZone: { isReadOnly: true },\n NumberField: { isReadOnly: true },\n RadioGroup: { isReadOnly: true },\n Switch: { isReadOnly: true },\n Slider: { isReadOnly: true },\n PasswordCreationField: { isReadOnly: true },\n DatePicker: { isReadOnly: true },\n DateRangePicker: { isReadOnly: true },\n TimeField: { isReadOnly: true },\n SegmentedControl: { isReadOnly: true },\n Select: { isReadOnly: true },\n ComboBox: { isReadOnly: true },\n };\n\n return (\n <PropsContextProvider\n props={isReadOnly ? propsContext : {}}\n mergeInParentContext\n >\n <RhfFormContextProvider {...form}>\n <FormContextProvider value={{ form, id: formId }}>\n <SubmitButtonStateProvider isAsyncSubmit={isAsyncSubmit}>\n <FormViewComponent\n {...formProps}\n id={formId}\n onSubmit={handleOnSubmit}\n >\n {children}\n </FormViewComponent>\n </SubmitButtonStateProvider>\n <AfterFormSubmitEffect\n submitHandlerResultRef={submitHandlerResultRef}\n />\n </FormContextProvider>\n </RhfFormContextProvider>\n </PropsContextProvider>\n );\n}\n\nexport default Form;\n"],"names":["RhfFormContextProvider"],"mappings":";;;;;;;;;;AAqCA,MAAM,uBAA0C,CAAC,CAAA,qBAAO,GAAA,CAAA,MAAA,EAAA,EAAM,GAAG,CAAG,EAAA,CAAA;AAE7D,SAAS,KAA4B,KAAqB,EAAA;AAC/D,EAAM,MAAA;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,eAAe,QAAW,GAAA,oBAAA;AAAA,IAC1B,UAAA;AAAA,IACA,GAAG;AAAA,GACD,GAAA,KAAA;AAEJ,EAAA,MAAM,SAAS,KAAM,EAAA;AACrB,EAAM,MAAA,aAAA,GAAgB,OAAO,KAAK,CAAA;AAClC,EAAM,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AAA,YAET;AAAA;AAAA,SAEL,EAAA,CAAA;AAAA,wBACA,GAAA;AAAA,UAAC,qBAAA;AAAA,UAAA;AAAA,YACC;AAAA;AAAA;AACF,OAAA,EACF,CACF,EAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -18,6 +18,8 @@ export interface ButtonProps extends PropsWithChildren<Aria.ButtonProps>, FlowCo
|
|
|
18
18
|
isSucceeded?: boolean;
|
|
19
19
|
/** Whether the button is in a failed state. */
|
|
20
20
|
isFailed?: boolean;
|
|
21
|
+
/** Whether the button is in a read only state. */
|
|
22
|
+
isReadOnly?: boolean;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* @flr-generate all
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAO9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAM/E,MAAM,WAAW,WACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,EACzC,kBAAkB,CAAC,iBAAiB,CAAC;IACvC,kDAAkD;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kDAAkD;IAClD,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAC;IACzE,yDAAyD;IACzD,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;IACjD,2CAA2C;IAC3C,IAAI,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IACjB,8CAA8C;IAC9C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gDAAgD;IA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