@mittwald/flow-react-components 0.2.0-alpha.498 → 0.2.0-alpha.499
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 +22680 -22661
- package/dist/css/all.css +1 -1
- package/dist/js/components/src/components/BrowserOnly/BrowserOnly.mjs +2 -1
- package/dist/js/components/src/components/BrowserOnly/BrowserOnly.mjs.map +1 -1
- package/dist/js/components/src/components/CheckboxGroup/CheckboxGroup.mjs +32 -20
- package/dist/js/components/src/components/CheckboxGroup/CheckboxGroup.mjs.map +1 -1
- package/dist/js/components/src/components/ComboBox/ComboBox.mjs +5 -1
- package/dist/js/components/src/components/ComboBox/ComboBox.mjs.map +1 -1
- package/dist/js/components/src/components/DatePicker/DatePicker.mjs +6 -2
- package/dist/js/components/src/components/DatePicker/DatePicker.mjs.map +1 -1
- package/dist/js/components/src/components/DateRangePicker/DateRangePicker.mjs +5 -1
- package/dist/js/components/src/components/DateRangePicker/DateRangePicker.mjs.map +1 -1
- package/dist/js/components/src/components/FileField/FileField.mjs +3 -2
- package/dist/js/components/src/components/FileField/FileField.mjs.map +1 -1
- package/dist/js/components/src/components/FileField/components/FileInput.mjs +1 -1
- package/dist/js/components/src/components/FileField/components/FileInput.mjs.map +1 -1
- package/dist/js/components/src/components/FileField/components/FileInput.module.scss.mjs +3 -1
- package/dist/js/components/src/components/FileField/components/FileInput.module.scss.mjs.map +1 -1
- package/dist/js/components/src/components/List/components/Header/components/SearchField/SearchField.mjs +2 -1
- package/dist/js/components/src/components/List/components/Header/components/SearchField/SearchField.mjs.map +1 -1
- package/dist/js/components/src/components/List/hooks/useAriaAnnounceSearchState.mjs +2 -1
- package/dist/js/components/src/components/List/hooks/useAriaAnnounceSearchState.mjs.map +1 -1
- package/dist/js/components/src/components/RadioGroup/RadioGroup.mjs +6 -6
- package/dist/js/components/src/components/RadioGroup/RadioGroup.mjs.map +1 -1
- package/dist/js/components/src/components/SegmentedControl/SegmentedControl.mjs +6 -1
- package/dist/js/components/src/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
- package/dist/js/components/src/components/Select/Select.mjs +21 -6
- package/dist/js/components/src/components/Select/Select.mjs.map +1 -1
- package/dist/js/components/src/components/Slider/Slider.mjs +81 -60
- package/dist/js/components/src/components/Slider/Slider.mjs.map +1 -1
- package/dist/js/components/src/components/Switch/Switch.mjs +40 -7
- package/dist/js/components/src/components/Switch/Switch.mjs.map +1 -1
- package/dist/js/components/src/components/TimeField/TimeField.mjs +6 -1
- package/dist/js/components/src/components/TimeField/TimeField.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.mjs +5 -1
- package/dist/js/components/src/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.mjs.map +1 -1
- package/dist/js/components/src/lib/getContainerBreakpointSizeClassName.mjs.map +1 -1
- package/dist/js/components/src/lib/hooks/dom/useMakeFocusable.mjs +28 -0
- package/dist/js/components/src/lib/hooks/dom/useMakeFocusable.mjs.map +1 -0
- package/dist/js/components/src/lib/hooks/useProps.mjs +5 -2
- package/dist/js/components/src/lib/hooks/useProps.mjs.map +1 -1
- package/dist/types/components/CheckboxButton/stories/Default.stories.d.ts.map +1 -1
- package/dist/types/components/CheckboxGroup/CheckboxGroup.d.ts.map +1 -1
- package/dist/types/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/dist/types/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/types/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/types/components/FileField/FileField.d.ts.map +1 -1
- package/dist/types/components/FileField/stories/Default.stories.d.ts +0 -1
- package/dist/types/components/FileField/stories/Default.stories.d.ts.map +1 -1
- package/dist/types/components/MarkdownEditor/stories/Default.stories.d.ts +0 -1
- package/dist/types/components/MarkdownEditor/stories/Default.stories.d.ts.map +1 -1
- package/dist/types/components/PasswordCreationField/stories/Default.stories.d.ts +0 -1
- package/dist/types/components/PasswordCreationField/stories/Default.stories.d.ts.map +1 -1
- package/dist/types/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/types/components/SegmentedControl/SegmentedControl.d.ts +2 -2
- package/dist/types/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/types/components/Select/Select.d.ts +1 -3
- package/dist/types/components/Select/Select.d.ts.map +1 -1
- package/dist/types/components/Slider/Slider.d.ts +3 -3
- package/dist/types/components/Slider/Slider.d.ts.map +1 -1
- package/dist/types/components/Switch/Switch.d.ts.map +1 -1
- package/dist/types/components/TextField/stories/Default.stories.d.ts +0 -1
- package/dist/types/components/TextField/stories/Default.stories.d.ts.map +1 -1
- package/dist/types/components/TimeField/TimeField.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/Autocomplete.stories.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/Autocomplete.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/Checkbox.stories.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/Checkbox.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/CheckboxGroup.stories.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/CheckboxGroup.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/ComboBox.stories.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/ComboBox.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/DatePicker.stories.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/DatePicker.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/DateRangePicker.stories.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/DateRangePicker.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/FileField.stories.d.ts +8 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/FileField.stories.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/MarkdownEditor.stories.d.ts +8 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/MarkdownEditor.stories.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/NumberField.stories.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/NumberField.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/PasswordCreationField.stories.d.ts +9 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/PasswordCreationField.stories.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/RadioGroup.stories.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/RadioGroup.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/SearchField.stories.d.ts +8 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/SearchField.stories.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/SegmentedControl.stories.d.ts +8 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/SegmentedControl.stories.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/Select.stories.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/Select.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/Slider.stories.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/Slider.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/Switch.stories.d.ts +8 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/Switch.stories.d.ts.map +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/TextArea.stories.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/TextArea.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/TextField.stories.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/TextField.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/TimeField.stories.d.ts +1 -0
- package/dist/types/integrations/react-hook-form/components/Field/stories/TimeField.stories.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Form/lib/useRegisterActionStateContext.d.ts.map +1 -1
- package/dist/types/lib/getContainerBreakpointSizeClassName.d.ts.map +1 -1
- package/dist/types/lib/hooks/dom/useMakeFocusable.d.ts +7 -0
- package/dist/types/lib/hooks/dom/useMakeFocusable.d.ts.map +1 -0
- package/dist/types/lib/hooks/useProps.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -4,9 +4,10 @@ import 'mobx';
|
|
|
4
4
|
import 'react';
|
|
5
5
|
import '../../lib/controller/overlay/context.mjs';
|
|
6
6
|
import { useIsMounted } from '../../lib/hooks/useIsMounted.mjs';
|
|
7
|
-
import '@react-aria/utils';
|
|
8
7
|
import '../../lib/propsContext/propsContext.mjs';
|
|
9
8
|
import 'remeda';
|
|
9
|
+
import '@react-aria/utils';
|
|
10
|
+
import 'dot-prop';
|
|
10
11
|
|
|
11
12
|
const BrowserOnly = (props) => {
|
|
12
13
|
if (useIsMounted()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserOnly.mjs","sources":["../../../../../../src/components/BrowserOnly/BrowserOnly.tsx"],"sourcesContent":["import { useIsMounted } from \"@/lib/hooks\";\nimport type { PropsWithChildren } from \"react\";\n\nexport type BrowserOnlyProps = PropsWithChildren;\n\nexport const BrowserOnly = (props: PropsWithChildren) => {\n if (useIsMounted()) {\n return props.children;\n }\n};\n\nexport default BrowserOnly;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BrowserOnly.mjs","sources":["../../../../../../src/components/BrowserOnly/BrowserOnly.tsx"],"sourcesContent":["import { useIsMounted } from \"@/lib/hooks\";\nimport type { PropsWithChildren } from \"react\";\n\nexport type BrowserOnlyProps = PropsWithChildren;\n\nexport const BrowserOnly = (props: PropsWithChildren) => {\n if (useIsMounted()) {\n return props.children;\n }\n};\n\nexport default BrowserOnly;\n"],"names":[],"mappings":";;;;;;;;;AAKa,MAAA,WAAA,GAAc,CAAC,KAA6B,KAAA;AACvD,EAAA,IAAI,cAAgB,EAAA;AAClB,IAAA,OAAO,KAAM,CAAA,QAAA;AAAA;AAEjB;;;;"}
|
|
@@ -11,6 +11,8 @@ import clsx from 'clsx';
|
|
|
11
11
|
import * as Aria from 'react-aria-components';
|
|
12
12
|
import formFieldStyles from '../FormField/FormField.module.scss.mjs';
|
|
13
13
|
import styles from './CheckboxGroup.module.scss.mjs';
|
|
14
|
+
import { useObjectRef } from '@react-aria/utils';
|
|
15
|
+
import { useMakeFocusable } from '../../lib/hooks/dom/useMakeFocusable.mjs';
|
|
14
16
|
|
|
15
17
|
const CheckboxGroup = flowComponent("CheckboxGroup", (props) => {
|
|
16
18
|
const { children, className, s, m, l, ref, ...rest } = props;
|
|
@@ -36,26 +38,36 @@ const CheckboxGroup = flowComponent("CheckboxGroup", (props) => {
|
|
|
36
38
|
className: styles.checkboxButton
|
|
37
39
|
}
|
|
38
40
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
className: styles.checkboxGroup,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
41
|
+
const localCheckboxGroupRef = useObjectRef(ref);
|
|
42
|
+
useMakeFocusable(localCheckboxGroupRef);
|
|
43
|
+
return /* @__PURE__ */ jsxs(
|
|
44
|
+
Aria.CheckboxGroup,
|
|
45
|
+
{
|
|
46
|
+
...rest,
|
|
47
|
+
className: rootClassName,
|
|
48
|
+
ref: localCheckboxGroupRef,
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ jsx(PropsContextProvider, { props: propsContext, children: /* @__PURE__ */ jsxs(TunnelProvider, { children: [
|
|
51
|
+
children,
|
|
52
|
+
/* @__PURE__ */ jsx(ColumnLayout, { s, m, l, className: styles.checkboxGroup, children: /* @__PURE__ */ jsx(TunnelExit, { id: "checkboxButtons" }) }),
|
|
53
|
+
/* @__PURE__ */ jsx(
|
|
54
|
+
ColumnLayout,
|
|
55
|
+
{
|
|
56
|
+
s: s ?? [1],
|
|
57
|
+
m: m ?? [1],
|
|
58
|
+
l: l ?? [1],
|
|
59
|
+
rowGap: "s",
|
|
60
|
+
className: styles.checkboxGroup,
|
|
61
|
+
children: /* @__PURE__ */ jsx(TunnelExit, { id: "checkboxes" })
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ jsx(TunnelExit, { id: "fieldDescription" }),
|
|
65
|
+
/* @__PURE__ */ jsx(TunnelExit, { id: "fieldError" })
|
|
66
|
+
] }) }),
|
|
67
|
+
/* @__PURE__ */ jsx(FieldError, { className: formFieldStyles.fieldError })
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
);
|
|
59
71
|
});
|
|
60
72
|
|
|
61
73
|
export { CheckboxGroup, CheckboxGroup as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxGroup.mjs","sources":["../../../../../../src/components/CheckboxGroup/CheckboxGroup.tsx"],"sourcesContent":["import type { ColumnLayoutProps } from \"@/components/ColumnLayout\";\nimport { ColumnLayout } from \"@/components/ColumnLayout\";\nimport { FieldError } from \"@/components/FieldError\";\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 { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport clsx from \"clsx\";\nimport type { PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport formFieldStyles from \"../FormField/FormField.module.scss\";\nimport styles from \"./CheckboxGroup.module.scss\";\n\nexport interface CheckboxGroupProps\n extends PropsWithChildren<Omit<Aria.CheckboxGroupProps, \"children\">>,\n Pick<ColumnLayoutProps, \"s\" | \"m\" | \"l\">,\n FlowComponentProps {}\n\n/** @flr-generate all */\nexport const CheckboxGroup = flowComponent(\"CheckboxGroup\", (props) => {\n const { children, className, s, m, l, ref, ...rest } = props;\n\n const rootClassName = clsx(formFieldStyles.formField, className);\n\n const propsContext: PropsContext = {\n Label: {\n className: formFieldStyles.label,\n },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n tunnelId: \"fieldDescription\",\n },\n FieldError: {\n className: formFieldStyles.customFieldError,\n tunnelId: \"fieldError\",\n },\n Checkbox: {\n tunnelId: \"checkboxes\",\n className: styles.checkbox,\n },\n CheckboxButton: {\n tunnelId: \"checkboxButtons\",\n className: styles.checkboxButton,\n },\n };\n\n return (\n <Aria.CheckboxGroup
|
|
1
|
+
{"version":3,"file":"CheckboxGroup.mjs","sources":["../../../../../../src/components/CheckboxGroup/CheckboxGroup.tsx"],"sourcesContent":["import type { ColumnLayoutProps } from \"@/components/ColumnLayout\";\nimport { ColumnLayout } from \"@/components/ColumnLayout\";\nimport { FieldError } from \"@/components/FieldError\";\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 { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport clsx from \"clsx\";\nimport type { PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport formFieldStyles from \"../FormField/FormField.module.scss\";\nimport styles from \"./CheckboxGroup.module.scss\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\n\nexport interface CheckboxGroupProps\n extends PropsWithChildren<Omit<Aria.CheckboxGroupProps, \"children\">>,\n Pick<ColumnLayoutProps, \"s\" | \"m\" | \"l\">,\n FlowComponentProps {}\n\n/** @flr-generate all */\nexport const CheckboxGroup = flowComponent(\"CheckboxGroup\", (props) => {\n const { children, className, s, m, l, ref, ...rest } = props;\n\n const rootClassName = clsx(formFieldStyles.formField, className);\n\n const propsContext: PropsContext = {\n Label: {\n className: formFieldStyles.label,\n },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n tunnelId: \"fieldDescription\",\n },\n FieldError: {\n className: formFieldStyles.customFieldError,\n tunnelId: \"fieldError\",\n },\n Checkbox: {\n tunnelId: \"checkboxes\",\n className: styles.checkbox,\n },\n CheckboxButton: {\n tunnelId: \"checkboxButtons\",\n className: styles.checkboxButton,\n },\n };\n\n const localCheckboxGroupRef = useObjectRef(ref);\n useMakeFocusable(localCheckboxGroupRef);\n\n return (\n <Aria.CheckboxGroup\n {...rest}\n className={rootClassName}\n ref={localCheckboxGroupRef}\n >\n <PropsContextProvider props={propsContext}>\n <TunnelProvider>\n {children}\n\n <ColumnLayout s={s} m={m} l={l} className={styles.checkboxGroup}>\n <TunnelExit id=\"checkboxButtons\" />\n </ColumnLayout>\n\n <ColumnLayout\n s={s ?? [1]}\n m={m ?? [1]}\n l={l ?? [1]}\n rowGap=\"s\"\n className={styles.checkboxGroup}\n >\n <TunnelExit id=\"checkboxes\" />\n </ColumnLayout>\n\n <TunnelExit id=\"fieldDescription\" />\n <TunnelExit id=\"fieldError\" />\n </TunnelProvider>\n </PropsContextProvider>\n <FieldError className={formFieldStyles.fieldError} />\n </Aria.CheckboxGroup>\n );\n});\n\nexport default CheckboxGroup;\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAsBO,MAAM,aAAgB,GAAA,aAAA,CAAc,eAAiB,EAAA,CAAC,KAAU,KAAA;AACrE,EAAM,MAAA,EAAE,UAAU,SAAW,EAAA,CAAA,EAAG,GAAG,CAA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AAA;AAAA,0BAEA,GAAA;AAAA,YAAC,YAAA;AAAA,YAAA;AAAA,cACC,CAAA,EAAG,CAAK,IAAA,CAAC,CAAC,CAAA;AAAA,cACV,CAAA,EAAG,CAAK,IAAA,CAAC,CAAC,CAAA;AAAA,cACV,CAAA,EAAG,CAAK,IAAA,CAAC,CAAC,CAAA;AAAA,cACV,MAAO,EAAA,GAAA;AAAA,cACP,WAAW,MAAO,CAAA,aAAA;AAAA,cAElB,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,EAAA,EAAG,YAAa,EAAA;AAAA;AAAA,WAC9B;AAAA,0BAEA,GAAA,CAAC,UAAW,EAAA,EAAA,EAAA,EAAG,kBAAmB,EAAA,CAAA;AAAA,0BAClC,GAAA,CAAC,UAAW,EAAA,EAAA,EAAA,EAAG,YAAa,EAAA;AAAA,SAAA,EAC9B,CACF,EAAA,CAAA;AAAA,wBACC,GAAA,CAAA,UAAA,EAAA,EAAW,SAAW,EAAA,eAAA,CAAgB,UAAY,EAAA;AAAA;AAAA;AAAA,GACrD;AAEJ,CAAC;;;;"}
|
|
@@ -20,6 +20,8 @@ import { useLocalizedStringFormatter } from 'react-aria';
|
|
|
20
20
|
import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
|
|
21
21
|
import 'mobx';
|
|
22
22
|
import { useOverlayController } from '../../lib/controller/overlay/useOverlayController.mjs';
|
|
23
|
+
import { useObjectRef } from '@react-aria/utils';
|
|
24
|
+
import { useMakeFocusable } from '../../lib/hooks/dom/useMakeFocusable.mjs';
|
|
23
25
|
|
|
24
26
|
const ComboBox = flowComponent("ComboBox", (props) => {
|
|
25
27
|
const {
|
|
@@ -68,13 +70,15 @@ const ComboBox = flowComponent("ComboBox", (props) => {
|
|
|
68
70
|
reuseControllerFromContext: true
|
|
69
71
|
});
|
|
70
72
|
const controller = controllerFromProps ?? controllerFromContext;
|
|
73
|
+
const localComboBoxRef = useObjectRef(ref);
|
|
74
|
+
useMakeFocusable(localComboBoxRef);
|
|
71
75
|
return /* @__PURE__ */ jsx(
|
|
72
76
|
Aria.ComboBox,
|
|
73
77
|
{
|
|
74
|
-
ref,
|
|
75
78
|
menuTrigger,
|
|
76
79
|
className: rootClassName,
|
|
77
80
|
...rest,
|
|
81
|
+
ref: localComboBoxRef,
|
|
78
82
|
onSelectionChange: handleOnSelectionChange,
|
|
79
83
|
onOpenChange: (isOpen) => controller.setOpen(isOpen),
|
|
80
84
|
children: /* @__PURE__ */ jsx(PropsContextProvider, { props: propsContext, children: /* @__PURE__ */ jsxs(TunnelProvider, { children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboBox.mjs","sources":["../../../../../../src/components/ComboBox/ComboBox.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport type { Key } from \"react-aria-components\";\nimport * as Aria from \"react-aria-components\";\nimport { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport { Button } from \"@/components/Button\";\nimport { IconChevronDown } from \"@/components/Icon/components/icons\";\nimport { Options } from \"@/components/Options\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport styles from \"./ComboBox.module.scss\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { type OverlayController, useOverlayController } from \"@/lib/controller\";\nimport type { OptionsProps } from \"@/components/Options/Options\";\n\nexport interface ComboBoxProps\n extends Omit<Aria.ComboBoxProps<never>, \"children\">,\n Pick<Aria.InputProps, \"placeholder\">,\n Pick<OptionsProps, \"renderEmptyState\">,\n PropsWithChildren,\n FlowComponentProps {\n onChange?: (value: string) => void;\n controller?: OverlayController;\n}\n\n/** @flr-generate all */\nexport const ComboBox = flowComponent(\"ComboBox\", (props) => {\n const {\n children,\n className,\n menuTrigger = \"focus\",\n onChange = () => {\n // default: do nothing\n },\n onSelectionChange = () => {\n // default: do nothing\n },\n controller: controllerFromProps,\n placeholder,\n ref,\n renderEmptyState,\n\n ...rest\n } = props;\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const rootClassName = clsx(\n styles.comboBox,\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 = (key: Key | null) => {\n if (key === null) {\n return;\n }\n onChange(String(key));\n onSelectionChange(key);\n };\n\n const controllerFromContext = useOverlayController(\"ComboBox\", {\n reuseControllerFromContext: true,\n });\n\n const controller = controllerFromProps ?? controllerFromContext;\n\n return (\n <Aria.ComboBox\n
|
|
1
|
+
{"version":3,"file":"ComboBox.mjs","sources":["../../../../../../src/components/ComboBox/ComboBox.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport type { Key } from \"react-aria-components\";\nimport * as Aria from \"react-aria-components\";\nimport { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport { Button } from \"@/components/Button\";\nimport { IconChevronDown } from \"@/components/Icon/components/icons\";\nimport { Options } from \"@/components/Options\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport clsx from \"clsx\";\nimport styles from \"./ComboBox.module.scss\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { type OverlayController, useOverlayController } from \"@/lib/controller\";\nimport type { OptionsProps } from \"@/components/Options/Options\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\n\nexport interface ComboBoxProps\n extends Omit<Aria.ComboBoxProps<never>, \"children\">,\n Pick<Aria.InputProps, \"placeholder\">,\n Pick<OptionsProps, \"renderEmptyState\">,\n PropsWithChildren,\n FlowComponentProps {\n onChange?: (value: string) => void;\n controller?: OverlayController;\n}\n\n/** @flr-generate all */\nexport const ComboBox = flowComponent(\"ComboBox\", (props) => {\n const {\n children,\n className,\n menuTrigger = \"focus\",\n onChange = () => {\n // default: do nothing\n },\n onSelectionChange = () => {\n // default: do nothing\n },\n controller: controllerFromProps,\n placeholder,\n ref,\n renderEmptyState,\n\n ...rest\n } = props;\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const rootClassName = clsx(\n styles.comboBox,\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 = (key: Key | null) => {\n if (key === null) {\n return;\n }\n onChange(String(key));\n onSelectionChange(key);\n };\n\n const controllerFromContext = useOverlayController(\"ComboBox\", {\n reuseControllerFromContext: true,\n });\n\n const controller = controllerFromProps ?? controllerFromContext;\n\n const localComboBoxRef = useObjectRef(ref);\n useMakeFocusable(localComboBoxRef);\n\n return (\n <Aria.ComboBox\n menuTrigger={menuTrigger}\n className={rootClassName}\n {...rest}\n ref={localComboBoxRef}\n onSelectionChange={handleOnSelectionChange}\n onOpenChange={(isOpen) => controller.setOpen(isOpen)}\n >\n <PropsContextProvider props={propsContext}>\n <TunnelProvider>\n <div className={styles.input}>\n <Aria.Input placeholder={placeholder} />\n <Button\n className={styles.toggle}\n aria-label={stringFormatter.format(\"comboBox.showOptions\")}\n variant=\"plain\"\n color=\"secondary\"\n >\n <IconChevronDown />\n </Button>\n </div>\n\n {children}\n\n <Options controller={controller} renderEmptyState={renderEmptyState}>\n <TunnelExit id=\"options\" />\n </Options>\n </TunnelProvider>\n </PropsContextProvider>\n </Aria.ComboBox>\n );\n});\n\nexport default ComboBox;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgCO,MAAM,QAAW,GAAA,aAAA,CAAc,UAAY,EAAA,CAAC,KAAU,KAAA;AAC3D,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAc,GAAA,OAAA;AAAA,IACd,WAAW,MAAM;AAAA,KAEjB;AAAA,IACA,oBAAoB,MAAM;AAAA,KAE1B;AAAA,IACA,UAAY,EAAA,mBAAA;AAAA,IACZ,WAAA;AAAA,IACA,GAAA;AAAA,IACA,gBAAA;AAAA,IAEA,GAAG;AAAA,GACD,GAAA,KAAA;AAEJ,EAAM,MAAA,eAAA,GAAkB,4BAA4B,OAAO,CAAA;AAE3D,EAAA,MAAM,aAAgB,GAAA,IAAA;AAAA,IACpB,MAAO,CAAA,QAAA;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,EAAA;AAAA,MACN,QAAU,EAAA;AAAA;AACZ,GACF;AAEA,EAAM,MAAA,uBAAA,GAA0B,CAAC,GAAoB,KAAA;AACnD,IAAA,IAAI,QAAQ,IAAM,EAAA;AAChB,MAAA;AAAA;AAEF,IAAS,QAAA,CAAA,M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B,8BAAC,UAAW,EAAA,EAAA,EAAA,EAAG,WAAU,CAC3B,EAAA;AAAA,OAAA,EACF,CACF,EAAA;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import 'react';
|
|
4
5
|
import clsx from 'clsx';
|
|
5
6
|
import '../../lib/propsContext/propsContext.mjs';
|
|
6
7
|
import { PropsContextProvider } from '../../lib/propsContext/components/PropsContextProvider.mjs';
|
|
@@ -10,7 +11,6 @@ import { FieldError } from '../FieldError/FieldError.mjs';
|
|
|
10
11
|
import formFieldStyles from '../FormField/FormField.module.scss.mjs';
|
|
11
12
|
import { Popover } from '../Popover/Popover.mjs';
|
|
12
13
|
import 'mobx';
|
|
13
|
-
import 'react';
|
|
14
14
|
import { useOverlayController } from '../../lib/controller/overlay/useOverlayController.mjs';
|
|
15
15
|
import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
|
|
16
16
|
import { Calendar } from '../Calendar/Calendar.mjs';
|
|
@@ -18,6 +18,8 @@ import '../Button/Button.mjs';
|
|
|
18
18
|
import '@tabler/icons-react';
|
|
19
19
|
import '../Icon/Icon.mjs';
|
|
20
20
|
import '../../views/IconView.mjs';
|
|
21
|
+
import { useObjectRef } from '@react-aria/utils';
|
|
22
|
+
import { useMakeFocusable } from '../../lib/hooks/dom/useMakeFocusable.mjs';
|
|
21
23
|
|
|
22
24
|
const DatePicker = flowComponent("DatePicker", (props) => {
|
|
23
25
|
const { children, className, errorMessage, onChange, ref, ...rest } = props;
|
|
@@ -34,11 +36,13 @@ const DatePicker = flowComponent("DatePicker", (props) => {
|
|
|
34
36
|
className: formFieldStyles.customFieldError
|
|
35
37
|
}
|
|
36
38
|
};
|
|
39
|
+
const localRef = useObjectRef(ref);
|
|
40
|
+
useMakeFocusable(localRef);
|
|
37
41
|
const popoverController = useOverlayController("Popover");
|
|
38
42
|
return /* @__PURE__ */ jsxs(
|
|
39
43
|
Aria.DatePicker,
|
|
40
44
|
{
|
|
41
|
-
ref,
|
|
45
|
+
ref: localRef,
|
|
42
46
|
...rest,
|
|
43
47
|
className: rootClassName,
|
|
44
48
|
onOpenChange: (v) => popoverController.setOpen(v),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.mjs","sources":["../../../../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import type
|
|
1
|
+
{"version":3,"file":"DatePicker.mjs","sources":["../../../../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import { type PropsWithChildren, type ReactNode } from \"react\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport * as Aria from \"react-aria-components\";\nimport { DateInput } from \"./components/DateInput\";\nimport { FieldError } from \"@/components/FieldError\";\nimport styles from \"../FormField/FormField.module.scss\";\nimport { Popover } from \"@/components/Popover/Popover\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport { Calendar } from \"@/components/Calendar\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\n\nexport interface DatePickerProps<T extends Aria.DateValue = Aria.DateValue>\n extends PropsWithChildren<Omit<Aria.DatePickerProps<T>, \"children\">>,\n FlowComponentProps {\n /** The error message that is displayed below the input. */\n errorMessage?: ReactNode;\n}\n\n/** @flr-generate all */\nexport const DatePicker = flowComponent(\"DatePicker\", (props) => {\n const { children, className, errorMessage, onChange, ref, ...rest } = props;\n\n const rootClassName = clsx(styles.formField, className);\n\n const propsContext: PropsContext = {\n Label: {\n className: styles.label,\n optional: !props.isRequired,\n },\n FieldDescription: {\n className: styles.fieldDescription,\n },\n FieldError: {\n className: styles.customFieldError,\n },\n };\n\n const localRef = useObjectRef(ref);\n useMakeFocusable(localRef);\n\n const popoverController = useOverlayController(\"Popover\");\n\n return (\n <Aria.DatePicker\n ref={localRef}\n {...rest}\n className={rootClassName}\n onOpenChange={(v) => popoverController.setOpen(v)}\n isOpen={popoverController.isOpen}\n onChange={(value) => {\n if (onChange) {\n onChange(value);\n }\n popoverController.close();\n }}\n >\n <DateInput isDisabled={props.isDisabled} />\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n <FieldError className={styles.fieldError}>{errorMessage}</FieldError>\n <Popover\n placement=\"bottom end\"\n isDialogContent\n controller={popoverController}\n >\n <Calendar />\n </Popover>\n </Aria.DatePicker>\n );\n});\n\nexport default DatePicker;\n"],"names":["styles"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0BO,MAAM,UAAa,GAAA,aAAA,CAAc,YAAc,EAAA,CAAC,KAAU,KAAA;AAC/D,EAAM,MAAA,EAAE,UAAU,SAAW,EAAA,YAAA,EAAc,UAAU,GAAK,EAAA,GAAG,MAAS,GAAA,KAAA;AAEtE,EAAA,MAAM,aAAgB,GAAA,IAAA,CAAKA,eAAO,CAAA,SAAA,EAAW,SAAS,CAAA;AAEtD,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,KAAO,EAAA;AAAA,MACL,WAAWA,eAAO,CAAA,KAAA;AAAA,MAClB,QAAA,EAAU,CAAC,KAAM,CAAA;AAAA,KACnB;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,WAAWA,eAAO,CAAA;AAAA,KACpB;AAAA,IACA,UAAY,EAAA;AAAA,MACV,WAAWA,eAAO,CAAA;AAAA;AACpB,GACF;AAEA,EAAM,MAAA,QAAA,GAAW,aAAa,GAAG,CAAA;AACjC,EAAA,gBAAA,CAAiB,QAAQ,CAAA;AAEzB,EAAM,MAAA,iBAAA,GAAoB,qBAAqB,SAAS,CAAA;AAExD,EACE,uBAAA,IAAA;AAAA,IAAC,IAAK,CAAA,UAAA;AAAA,IAAL;AAAA,MACC,GAAK,EAAA,QAAA;AAAA,MACJ,GAAG,IAAA;AAAA,MACJ,SAAW,EAAA,aAAA;AAAA,MACX,YAAc,EAAA,CAAC,CAAM,KAAA,iBAAA,CAAkB,QAAQ,CAAC,CAAA;AAAA,MAChD,QAAQ,iBAAkB,CAAA,MAAA;AAAA,MAC1B,QAAA,EAAU,CAAC,KAAU,KAAA;AACnB,QAAA,IAAI,QAAU,EAAA;AACZ,UAAA,QAAA,CAAS,KAAK,CAAA;AAAA;AAEhB,QAAA,iBAAA,CAAkB,KAAM,EAAA;AAAA,OAC1B;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,SAAA,EAAA,EAAU,UAAY,EAAA,KAAA,CAAM,UAAY,EAAA,CAAA;AAAA,wBACxC,GAAA,CAAA,oBAAA,EAAA,EAAqB,KAAO,EAAA,YAAA,EAC1B,QACH,EAAA,CAAA;AAAA,wBACC,GAAA,CAAA,UAAA,EAAA,EAAW,SAAW,EAAAA,eAAA,CAAO,YAAa,QAAa,EAAA,YAAA,EAAA,CAAA;AAAA,wBACxD,GAAA;AAAA,UAAC,OAAA;AAAA,UAAA;AAAA,YACC,SAAU,EAAA,YAAA;AAAA,YACV,eAAe,EAAA,IAAA;AAAA,YACf,UAAY,EAAA,iBAAA;AAAA,YAEZ,8BAAC,QAAS,EAAA,EAAA;AAAA;AAAA;AACZ;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
|
|
@@ -14,6 +14,8 @@ import 'mobx';
|
|
|
14
14
|
import 'react';
|
|
15
15
|
import { useOverlayController } from '../../lib/controller/overlay/useOverlayController.mjs';
|
|
16
16
|
import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
|
|
17
|
+
import { useMakeFocusable } from '../../lib/hooks/dom/useMakeFocusable.mjs';
|
|
18
|
+
import { useObjectRef } from '@react-aria/utils';
|
|
17
19
|
|
|
18
20
|
const DateRangePicker = flowComponent("DateRangePicker", (props) => {
|
|
19
21
|
const { children, className, errorMessage, onChange, ref, ...rest } = props;
|
|
@@ -31,10 +33,12 @@ const DateRangePicker = flowComponent("DateRangePicker", (props) => {
|
|
|
31
33
|
}
|
|
32
34
|
};
|
|
33
35
|
const popoverController = useOverlayController("Popover");
|
|
36
|
+
const localDateRangePickerRef = useObjectRef(ref);
|
|
37
|
+
useMakeFocusable(localDateRangePickerRef);
|
|
34
38
|
return /* @__PURE__ */ jsxs(
|
|
35
39
|
Aria.DateRangePicker,
|
|
36
40
|
{
|
|
37
|
-
ref,
|
|
41
|
+
ref: localDateRangePickerRef,
|
|
38
42
|
...rest,
|
|
39
43
|
className: rootClassName,
|
|
40
44
|
onOpenChange: (v) => popoverController.setOpen(v),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangePicker.mjs","sources":["../../../../../../src/components/DateRangePicker/DateRangePicker.tsx"],"sourcesContent":["import type { PropsWithChildren, ReactNode } from \"react\";\nimport styles from \"../FormField/FormField.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport * as Aria from \"react-aria-components\";\nimport { Popover } from \"@/components/Popover/Popover\";\nimport { RangeCalendar } from \"../Calendar/RangeCalendar\";\nimport { DateRangeInput } from \"./components/DateRangeInput\";\nimport { FieldError } from \"@/components/FieldError\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\n\nexport interface DateRangePickerProps<T extends Aria.DateValue = Aria.DateValue>\n extends PropsWithChildren<Omit<Aria.DateRangePickerProps<T>, \"children\">>,\n FlowComponentProps {\n /** The error message that is displayed below the input. */\n errorMessage?: ReactNode;\n}\n\n/** @flr-generate all */\nexport const DateRangePicker = flowComponent(\"DateRangePicker\", (props) => {\n const { children, className, errorMessage, onChange, ref, ...rest } = props;\n\n const rootClassName = clsx(styles.formField, className);\n\n const propsContext: PropsContext = {\n Label: {\n className: styles.label,\n optional: !props.isRequired,\n },\n FieldDescription: {\n className: styles.fieldDescription,\n },\n FieldError: {\n className: styles.customFieldError,\n },\n };\n\n const popoverController = useOverlayController(\"Popover\");\n\n return (\n <Aria.DateRangePicker\n ref={
|
|
1
|
+
{"version":3,"file":"DateRangePicker.mjs","sources":["../../../../../../src/components/DateRangePicker/DateRangePicker.tsx"],"sourcesContent":["import type { PropsWithChildren, ReactNode } from \"react\";\nimport styles from \"../FormField/FormField.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport * as Aria from \"react-aria-components\";\nimport { Popover } from \"@/components/Popover/Popover\";\nimport { RangeCalendar } from \"../Calendar/RangeCalendar\";\nimport { DateRangeInput } from \"./components/DateRangeInput\";\nimport { FieldError } from \"@/components/FieldError\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useObjectRef } from \"@react-aria/utils\";\n\nexport interface DateRangePickerProps<T extends Aria.DateValue = Aria.DateValue>\n extends PropsWithChildren<Omit<Aria.DateRangePickerProps<T>, \"children\">>,\n FlowComponentProps {\n /** The error message that is displayed below the input. */\n errorMessage?: ReactNode;\n}\n\n/** @flr-generate all */\nexport const DateRangePicker = flowComponent(\"DateRangePicker\", (props) => {\n const { children, className, errorMessage, onChange, ref, ...rest } = props;\n\n const rootClassName = clsx(styles.formField, className);\n\n const propsContext: PropsContext = {\n Label: {\n className: styles.label,\n optional: !props.isRequired,\n },\n FieldDescription: {\n className: styles.fieldDescription,\n },\n FieldError: {\n className: styles.customFieldError,\n },\n };\n\n const popoverController = useOverlayController(\"Popover\");\n\n const localDateRangePickerRef = useObjectRef(ref);\n useMakeFocusable(localDateRangePickerRef);\n\n return (\n <Aria.DateRangePicker\n ref={localDateRangePickerRef}\n {...rest}\n className={rootClassName}\n onOpenChange={(v) => popoverController.setOpen(v)}\n isOpen={popoverController.isOpen}\n onChange={(value) => {\n if (onChange) {\n onChange(value);\n }\n popoverController.close();\n }}\n >\n <DateRangeInput isDisabled={props.isDisabled} />\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n <FieldError className={styles.fieldError}>{errorMessage}</FieldError>\n <Popover\n placement=\"bottom end\"\n isDialogContent\n controller={popoverController}\n >\n <RangeCalendar />\n </Popover>\n </Aria.DateRangePicker>\n );\n});\n\nexport default DateRangePicker;\n"],"names":["styles"],"mappings":";;;;;;;;;;;;;;;;;AA0BO,MAAM,eAAkB,GAAA,aAAA,CAAc,iBAAmB,EAAA,CAAC,KAAU,KAAA;AACzE,EAAM,MAAA,EAAE,UAAU,SAAW,EAAA,YAAA,EAAc,UAAU,GAAK,EAAA,GAAG,MAAS,GAAA,KAAA;AAEtE,EAAA,MAAM,aAAgB,GAAA,IAAA,CAAKA,eAAO,CAAA,SAAA,EAAW,SAAS,CAAA;AAEtD,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,KAAO,EAAA;AAAA,MACL,WAAWA,eAAO,CAAA,KAAA;AAAA,MAClB,QAAA,EAAU,CAAC,KAAM,CAAA;AAAA,KACnB;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,WAAWA,eAAO,CAAA;AAAA,KACpB;AAAA,IACA,UAAY,EAAA;AAAA,MACV,WAAWA,eAAO,CAAA;AAAA;AACpB,GACF;AAEA,EAAM,MAAA,iBAAA,GAAoB,qBAAqB,SAAS,CAAA;AAExD,EAAM,MAAA,uBAAA,GAA0B,aAAa,GAAG,CAAA;AAChD,EAAA,gBAAA,CAAiB,uBAAuB,CAAA;AAExC,EACE,uBAAA,IAAA;AAAA,IAAC,IAAK,CAAA,eAAA;AAAA,IAAL;AAAA,MACC,GAAK,EAAA,uBAAA;AAAA,MACJ,GAAG,IAAA;AAAA,MACJ,SAAW,EAAA,aAAA;AAAA,MACX,YAAc,EAAA,CAAC,CAAM,KAAA,iBAAA,CAAkB,QAAQ,CAAC,CAAA;AAAA,MAChD,QAAQ,iBAAkB,CAAA,MAAA;AAAA,MAC1B,QAAA,EAAU,CAAC,KAAU,KAAA;AACnB,QAAA,IAAI,QAAU,EAAA;AACZ,UAAA,QAAA,CAAS,KAAK,CAAA;AAAA;AAEhB,QAAA,iBAAA,CAAkB,KAAM,EAAA;AAAA,OAC1B;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,cAAA,EAAA,EAAe,UAAY,EAAA,KAAA,CAAM,UAAY,EAAA,CAAA;AAAA,wBAC7C,GAAA,CAAA,oBAAA,EAAA,EAAqB,KAAO,EAAA,YAAA,EAC1B,QACH,EAAA,CAAA;AAAA,wBACC,GAAA,CAAA,UAAA,EAAA,EAAW,SAAW,EAAAA,eAAA,CAAO,YAAa,QAAa,EAAA,YAAA,EAAA,CAAA;AAAA,wBACxD,GAAA;AAAA,UAAC,OAAA;AAAA,UAAA;AAAA,YACC,SAAU,EAAA,YAAA;AAAA,YACV,eAAe,EAAA,IAAA;AAAA,YACf,UAAY,EAAA,iBAAA;AAAA,YAEZ,8BAAC,aAAc,EAAA,EAAA;AAAA;AAAA;AACjB;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
|
|
@@ -11,6 +11,7 @@ import '../../lib/propsContext/propsContext.mjs';
|
|
|
11
11
|
import { PropsContextProvider } from '../../lib/propsContext/components/PropsContextProvider.mjs';
|
|
12
12
|
import { useObjectRef } from '@react-aria/utils';
|
|
13
13
|
import { addAwaitedArrayBuffer } from '../../../../core/src/file.mjs';
|
|
14
|
+
import { useMakeFocusable } from '../../lib/hooks/dom/useMakeFocusable.mjs';
|
|
14
15
|
|
|
15
16
|
const FileField = flowComponent("FileField", (props) => {
|
|
16
17
|
const {
|
|
@@ -33,7 +34,6 @@ const FileField = flowComponent("FileField", (props) => {
|
|
|
33
34
|
useFormValidation({ validationBehavior }, formValidationState, inputRef);
|
|
34
35
|
const inputProps = {
|
|
35
36
|
...restInputProps,
|
|
36
|
-
ref: inputRef,
|
|
37
37
|
"aria-invalid": formValidationState.displayValidation.isInvalid,
|
|
38
38
|
value: void 0
|
|
39
39
|
};
|
|
@@ -56,6 +56,7 @@ const FileField = flowComponent("FileField", (props) => {
|
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
+
useMakeFocusable(inputRef);
|
|
59
60
|
return /* @__PURE__ */ jsx(InputContext.Provider, { value: inputProps, children: /* @__PURE__ */ jsx(FieldErrorContext.Provider, { value: formValidationState.displayValidation, children: /* @__PURE__ */ jsx(PropsContextProvider, { props: propsContext, children: /* @__PURE__ */ jsx(
|
|
60
61
|
"div",
|
|
61
62
|
{
|
|
@@ -66,7 +67,7 @@ const FileField = flowComponent("FileField", (props) => {
|
|
|
66
67
|
children: /* @__PURE__ */ jsx(
|
|
67
68
|
FileInput,
|
|
68
69
|
{
|
|
69
|
-
ref,
|
|
70
|
+
ref: inputRef,
|
|
70
71
|
isReadOnly,
|
|
71
72
|
onChange: isReadOnly ? void 0 : handleOnChange,
|
|
72
73
|
isDisabled,
|
|
@@ -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\";\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/** @flr-generate all */\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
|
|
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\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\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/** @flr-generate all */\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 \"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 useMakeFocusable(inputRef);\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={inputRef}\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":";;;;;;;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QAAQ,CAAA;AAEzB,EAAA,2BACG,YAAa,CAAA,QAAA,EAAb,EAAsB,KAAA,EAAO,YAC5B,QAAC,kBAAA,GAAA,CAAA,iBAAA,CAAkB,QAAlB,EAAA,EAA2B,OAAO,mBAAoB,CAAA,iBAAA,EACrD,QAAC,kBAAA,GAAA,CAAA,oBAAA,EAAA,EAAqB,OAAO,YAC3B,EAAA,QAAA,kBAAA,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,GAAK,EAAA,QAAA;AAAA,UACL,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;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.mjs","sources":["../../../../../../../src/components/FileField/components/FileInput.tsx"],"sourcesContent":["import type { FC, PropsWithChildren, Ref } from \"react\";\nimport { 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}>\n {children}\n <Aria.Input\n
|
|
1
|
+
{"version":3,"file":"FileInput.mjs","sources":["../../../../../../../src/components/FileField/components/FileInput.tsx"],"sourcesContent":["import type { FC, PropsWithChildren, Ref } from \"react\";\nimport { 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}>\n {children}\n <Aria.Input\n className={styles.FileInput}\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,EACE,uBAAA,IAAA,CAAC,oBAAqB,EAAA,EAAA,KAAA,EAAO,YAC1B,EAAA,QAAA,EAAA;AAAA,IAAA,QAAA;AAAA,oBACD,GAAA;AAAA,MAAC,IAAK,CAAA,KAAA;AAAA,MAAL;AAAA,QACC,WAAW,MAAO,CAAA,SAAA;AAAA,QAClB,IAAK,EAAA,MAAA;AAAA,QACL,GAAK,EAAA,QAAA;AAAA,QACL,QAAU,EAAA;AAAA;AAAA;AACZ,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
+
const FileInput = "flow--file-field--file-input";
|
|
3
4
|
const trigger = "flow--file-field--trigger";
|
|
4
5
|
const styles = {
|
|
6
|
+
FileInput: FileInput,
|
|
5
7
|
trigger: trigger
|
|
6
8
|
};
|
|
7
9
|
|
|
8
|
-
export { styles as default, trigger };
|
|
10
|
+
export { FileInput, styles as default, trigger };
|
|
9
11
|
//# sourceMappingURL=FileInput.module.scss.mjs.map
|
package/dist/js/components/src/components/FileField/components/FileInput.module.scss.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileInput.module.scss.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FileInput.module.scss.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -5,9 +5,10 @@ import { createElement, useState, useEffect } from 'react';
|
|
|
5
5
|
import 'mobx';
|
|
6
6
|
import '../../../../../../lib/controller/overlay/context.mjs';
|
|
7
7
|
import { useOnChange } from '../../../../../../lib/hooks/useOnChange.mjs';
|
|
8
|
-
import '@react-aria/utils';
|
|
9
8
|
import '../../../../../../lib/propsContext/propsContext.mjs';
|
|
10
9
|
import 'remeda';
|
|
10
|
+
import '@react-aria/utils';
|
|
11
|
+
import 'dot-prop';
|
|
11
12
|
import SearchFieldView from '../../../../../../views/SearchFieldView.mjs';
|
|
12
13
|
import styles from './SearchField.module.scss.mjs';
|
|
13
14
|
import { useAriaAnnounceSearchState } from '../../../../hooks/useAriaAnnounceSearchState.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchField.mjs","sources":["../../../../../../../../../../src/components/List/components/Header/components/SearchField/SearchField.tsx"],"sourcesContent":["import type { FC, KeyboardEvent } from \"react\";\nimport { createElement, useEffect, useState } from \"react\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport type { Search } from \"@/components/List/model/search/Search\";\nimport type { SearchFieldRenderComponent } from \"@/components/List/model/search/types\";\nimport { useOnChange } from \"@/lib/hooks\";\nimport SearchFieldView from \"@/views/SearchFieldView\";\nimport styles from \"./SearchField.module.scss\";\nimport { useAriaAnnounceSearchState } from \"@/components/List/hooks/useAriaAnnounceSearchState\";\n\ninterface Props extends PropsWithClassName {\n search: Search<never>;\n}\n\nconst autoSubmitTimeout = 800;\n\nconst DefaultSearchFieldRender: SearchFieldRenderComponent = (props) => {\n const { onChange, value, autoSubmit = true, ...searchFieldProps } = props;\n\n const [searchString, setSearchString] = useState(value ?? \"\");\n\n const submitSearch = () => {\n if (searchString.trim() === \"\") {\n onChange(undefined);\n } else {\n onChange(searchString);\n }\n };\n\n useEffect(() => {\n if (autoSubmit) {\n const timeout = setTimeout(() => submitSearch(), autoSubmitTimeout);\n return () => clearTimeout(timeout);\n }\n }, [searchString, autoSubmit]);\n\n useAriaAnnounceSearchState();\n\n useOnChange(value, () => {\n setSearchString(value ?? \"\");\n }, [searchString]);\n\n const clearSearch = () => {\n onChange(undefined);\n setSearchString(\"\");\n };\n\n const handleKeyPress = (e: KeyboardEvent) => {\n if (e.key === \"Enter\") {\n submitSearch();\n } else if (e.key === \"Escape\") {\n clearSearch();\n }\n };\n\n return (\n <SearchFieldView\n className={styles.searchField}\n value={searchString}\n onKeyUp={handleKeyPress}\n onChange={(value) => setSearchString(value)}\n onClear={clearSearch}\n {...searchFieldProps}\n />\n );\n};\n\nexport const SearchField: FC<Props> = (props) => {\n const { search } = props;\n const render = search.render ?? DefaultSearchFieldRender;\n\n return createElement(render, {\n value: search.value,\n onChange: search.setValue.bind(search),\n ...search.textFieldProps,\n });\n};\n\nexport default SearchField;\n"],"names":["value"],"mappings":"
|
|
1
|
+
{"version":3,"file":"SearchField.mjs","sources":["../../../../../../../../../../src/components/List/components/Header/components/SearchField/SearchField.tsx"],"sourcesContent":["import type { FC, KeyboardEvent } from \"react\";\nimport { createElement, useEffect, useState } from \"react\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport type { Search } from \"@/components/List/model/search/Search\";\nimport type { SearchFieldRenderComponent } from \"@/components/List/model/search/types\";\nimport { useOnChange } from \"@/lib/hooks\";\nimport SearchFieldView from \"@/views/SearchFieldView\";\nimport styles from \"./SearchField.module.scss\";\nimport { useAriaAnnounceSearchState } from \"@/components/List/hooks/useAriaAnnounceSearchState\";\n\ninterface Props extends PropsWithClassName {\n search: Search<never>;\n}\n\nconst autoSubmitTimeout = 800;\n\nconst DefaultSearchFieldRender: SearchFieldRenderComponent = (props) => {\n const { onChange, value, autoSubmit = true, ...searchFieldProps } = props;\n\n const [searchString, setSearchString] = useState(value ?? \"\");\n\n const submitSearch = () => {\n if (searchString.trim() === \"\") {\n onChange(undefined);\n } else {\n onChange(searchString);\n }\n };\n\n useEffect(() => {\n if (autoSubmit) {\n const timeout = setTimeout(() => submitSearch(), autoSubmitTimeout);\n return () => clearTimeout(timeout);\n }\n }, [searchString, autoSubmit]);\n\n useAriaAnnounceSearchState();\n\n useOnChange(value, () => {\n setSearchString(value ?? \"\");\n }, [searchString]);\n\n const clearSearch = () => {\n onChange(undefined);\n setSearchString(\"\");\n };\n\n const handleKeyPress = (e: KeyboardEvent) => {\n if (e.key === \"Enter\") {\n submitSearch();\n } else if (e.key === \"Escape\") {\n clearSearch();\n }\n };\n\n return (\n <SearchFieldView\n className={styles.searchField}\n value={searchString}\n onKeyUp={handleKeyPress}\n onChange={(value) => setSearchString(value)}\n onClear={clearSearch}\n {...searchFieldProps}\n />\n );\n};\n\nexport const SearchField: FC<Props> = (props) => {\n const { search } = props;\n const render = search.render ?? DefaultSearchFieldRender;\n\n return createElement(render, {\n value: search.value,\n onChange: search.setValue.bind(search),\n ...search.textFieldProps,\n });\n};\n\nexport default SearchField;\n"],"names":["value"],"mappings":";;;;;;;;;;;;;AAcA,MAAM,iBAAoB,GAAA,GAAA;AAE1B,MAAM,wBAAA,GAAuD,CAAC,KAAU,KAAA;AACtE,EAAA,MAAM,EAAE,QAAU,EAAA,KAAA,EAAO,aAAa,IAAM,EAAA,GAAG,kBAAqB,GAAA,KAAA;AAEpE,EAAA,MAAM,CAAC,YAAc,EAAA,eAAe,CAAI,GAAA,QAAA,CAAS,SAAS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;AAEa,MAAA,WAAA,GAAyB,CAAC,KAAU,KAAA;AAC/C,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AACnB,EAAM,MAAA,MAAA,GAAS,OAAO,MAAU,IAAA,wBAAA;AAEhC,EAAA,OAAO,cAAc,MAAQ,EAAA;AAAA,IAC3B,OAAO,MAAO,CAAA,KAAA;AAAA,IACd,QAAU,EAAA,MAAA,CAAO,QAAS,CAAA,IAAA,CAAK,MAAM,CAAA;AAAA,IACrC,GAAG,MAAO,CAAA;AAAA,GACX,CAAA;AACH;;;;"}
|
|
@@ -26,8 +26,9 @@ import '../../Badge/Badge.mjs';
|
|
|
26
26
|
import 'react-aria-components';
|
|
27
27
|
import 'mobx';
|
|
28
28
|
import '../../../lib/controller/overlay/context.mjs';
|
|
29
|
-
import '@react-aria/utils';
|
|
30
29
|
import 'remeda';
|
|
30
|
+
import '@react-aria/utils';
|
|
31
|
+
import 'dot-prop';
|
|
31
32
|
import 'recharts';
|
|
32
33
|
import '../../Heading/Heading.mjs';
|
|
33
34
|
import '../../Text/Text.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAriaAnnounceSearchState.mjs","sources":["../../../../../../../src/components/List/hooks/useAriaAnnounceSearchState.ts"],"sourcesContent":["import { useLocalizedStringFormatter } from \"react-aria\";\nimport locales from \"../locales/*.locale.json\";\nimport { announce } from \"@react-aria/live-announcer\";\nimport { useList } from \"@/index/default\";\nimport { useDebounceCallback } from \"usehooks-ts\";\nimport { useEffect } from \"react\";\n\nconst announceDebounceMs = 600;\n\nexport const useAriaAnnounceSearchState = (): void => {\n const formatter = useLocalizedStringFormatter(locales);\n const list = useList();\n const debouncedAnnounce = useDebounceCallback(announce, announceDebounceMs);\n\n const searchTerm = list.search?.value;\n const resultCount = list.batches.getTotalItemsCount();\n const isLoading = list.loader.loaderState.useIsLoading();\n\n useEffect(() => {\n if (isLoading || !searchTerm) {\n debouncedAnnounce.cancel();\n return;\n }\n\n const text = formatter.format(\n resultCount > 0\n ? \"list.search.announce.result\"\n : \"list.search.announce.noResult\",\n {\n resultCount,\n searchTerm,\n },\n );\n\n debouncedAnnounce(text, \"polite\");\n }, [searchTerm, resultCount, isLoading]);\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useAriaAnnounceSearchState.mjs","sources":["../../../../../../../src/components/List/hooks/useAriaAnnounceSearchState.ts"],"sourcesContent":["import { useLocalizedStringFormatter } from \"react-aria\";\nimport locales from \"../locales/*.locale.json\";\nimport { announce } from \"@react-aria/live-announcer\";\nimport { useList } from \"@/index/default\";\nimport { useDebounceCallback } from \"usehooks-ts\";\nimport { useEffect } from \"react\";\n\nconst announceDebounceMs = 600;\n\nexport const useAriaAnnounceSearchState = (): void => {\n const formatter = useLocalizedStringFormatter(locales);\n const list = useList();\n const debouncedAnnounce = useDebounceCallback(announce, announceDebounceMs);\n\n const searchTerm = list.search?.value;\n const resultCount = list.batches.getTotalItemsCount();\n const isLoading = list.loader.loaderState.useIsLoading();\n\n useEffect(() => {\n if (isLoading || !searchTerm) {\n debouncedAnnounce.cancel();\n return;\n }\n\n const text = formatter.format(\n resultCount > 0\n ? \"list.search.announce.result\"\n : \"list.search.announce.noResult\",\n {\n resultCount,\n searchTerm,\n },\n );\n\n debouncedAnnounce(text, \"polite\");\n }, [searchTerm, resultCount, isLoading]);\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,kBAAqB,GAAA,GAAA;AAEpB,MAAM,6BAA6B,MAAY;AACpD,EAAM,MAAA,SAAA,GAAY,4BAA4B,OAAO,CAAA;AACrD,EAAA,MAAM,OAAO,OAAQ,EAAA;AACrB,EAAM,MAAA,iBAAA,GAAoB,mBAAoB,CAAA,QAAA,EAAU,kBAAkB,CAAA;AAE1E,EAAM,MAAA,UAAA,GAAa,KAAK,MAAQ,EAAA,KAAA;AAChC,EAAM,MAAA,WAAA,GAAc,IAAK,CAAA,OAAA,CAAQ,kBAAmB,EAAA;AACpD,EAAA,MAAM,SAAY,GAAA,IAAA,CAAK,MAAO,CAAA,WAAA,CAAY,YAAa,EAAA;AAEvD,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,SAAA,IAAa,CAAC,UAAY,EAAA;AAC5B,MAAA,iBAAA,CAAkB,MAAO,EAAA;AACzB,MAAA;AAAA;AAGF,IAAA,MAAM,OAAO,SAAU,CAAA,MAAA;AAAA,MACrB,WAAA,GAAc,IACV,6BACA,GAAA,+BAAA;AAAA,MACJ;AAAA,QACE,WAAA;AAAA,QACA;AAAA;AACF,KACF;AAEA,IAAA,iBAAA,CAAkB,MAAM,QAAQ,CAAA;AAAA,GAC/B,EAAA,CAAC,UAAY,EAAA,WAAA,EAAa,SAAS,CAAC,CAAA;AACzC;;;;"}
|
|
@@ -11,14 +11,12 @@ import { ColumnLayout } from '../ColumnLayout/ColumnLayout.mjs';
|
|
|
11
11
|
import { TunnelProvider, TunnelExit } from '@mittwald/react-tunnel';
|
|
12
12
|
import formFieldStyles from '../FormField/FormField.module.scss.mjs';
|
|
13
13
|
import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
|
|
14
|
+
import { useObjectRef } from '@react-aria/utils';
|
|
15
|
+
import { useMakeFocusable } from '../../lib/hooks/dom/useMakeFocusable.mjs';
|
|
14
16
|
|
|
15
17
|
const RadioGroup = flowComponent("RadioGroup", (props) => {
|
|
16
18
|
const { children, className, s, m, l, ref, ...rest } = props;
|
|
17
|
-
const rootClassName = clsx(
|
|
18
|
-
formFieldStyles.formField,
|
|
19
|
-
styles.radioGroupContainer,
|
|
20
|
-
className
|
|
21
|
-
);
|
|
19
|
+
const rootClassName = clsx(formFieldStyles.formField, className);
|
|
22
20
|
const propsContext = {
|
|
23
21
|
Label: {
|
|
24
22
|
className: formFieldStyles.label
|
|
@@ -38,7 +36,9 @@ const RadioGroup = flowComponent("RadioGroup", (props) => {
|
|
|
38
36
|
tunnelId: "radios"
|
|
39
37
|
}
|
|
40
38
|
};
|
|
41
|
-
|
|
39
|
+
const localRadioRef = useObjectRef(ref);
|
|
40
|
+
useMakeFocusable(localRadioRef);
|
|
41
|
+
return /* @__PURE__ */ jsxs(Aria.RadioGroup, { ...rest, className: rootClassName, ref: localRadioRef, children: [
|
|
42
42
|
/* @__PURE__ */ jsx(PropsContextProvider, { dependencies: ["radio"], props: propsContext, children: /* @__PURE__ */ jsxs(TunnelProvider, { children: [
|
|
43
43
|
children,
|
|
44
44
|
/* @__PURE__ */ jsx(ColumnLayout, { s, m, l, className: styles.radioGroup, children: /* @__PURE__ */ jsx(TunnelExit, { id: "radioButtons" }) }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.mjs","sources":["../../../../../../src/components/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport styles from \"./RadioGroup.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 { FieldError } from \"@/components/FieldError\";\nimport type { ColumnLayoutProps } from \"@/components/ColumnLayout\";\nimport { ColumnLayout } from \"@/components/ColumnLayout\";\nimport { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport formFieldStyles from \"../FormField/FormField.module.scss\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\n\nexport interface RadioGroupProps\n extends PropsWithChildren<Omit<Aria.RadioGroupProps, \"children\">>,\n FlowComponentProps,\n Pick<ColumnLayoutProps, \"s\" | \"m\" | \"l\"> {}\n\n/** @flr-generate all */\nexport const RadioGroup = flowComponent(\"RadioGroup\", (props) => {\n const { children, className, s, m, l, ref, ...rest } = props;\n\n const rootClassName = clsx(
|
|
1
|
+
{"version":3,"file":"RadioGroup.mjs","sources":["../../../../../../src/components/RadioGroup/RadioGroup.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport styles from \"./RadioGroup.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 { FieldError } from \"@/components/FieldError\";\nimport type { ColumnLayoutProps } from \"@/components/ColumnLayout\";\nimport { ColumnLayout } from \"@/components/ColumnLayout\";\nimport { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport formFieldStyles from \"../FormField/FormField.module.scss\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\n\nexport interface RadioGroupProps\n extends PropsWithChildren<Omit<Aria.RadioGroupProps, \"children\">>,\n FlowComponentProps,\n Pick<ColumnLayoutProps, \"s\" | \"m\" | \"l\"> {}\n\n/** @flr-generate all */\nexport const RadioGroup = flowComponent(\"RadioGroup\", (props) => {\n const { children, className, s, m, l, ref, ...rest } = props;\n\n const rootClassName = clsx(formFieldStyles.formField, className);\n\n const propsContext: PropsContext = {\n Label: {\n className: formFieldStyles.label,\n },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n tunnelId: \"fieldDescription\",\n },\n FieldError: {\n className: formFieldStyles.customFieldError,\n tunnelId: \"fieldError\",\n },\n RadioButton: {\n tunnelId: \"radioButtons\",\n },\n Radio: {\n tunnelId: \"radios\",\n },\n };\n\n const localRadioRef = useObjectRef(ref);\n useMakeFocusable(localRadioRef);\n\n return (\n <Aria.RadioGroup {...rest} className={rootClassName} ref={localRadioRef}>\n <PropsContextProvider dependencies={[\"radio\"]} props={propsContext}>\n <TunnelProvider>\n {children}\n\n <ColumnLayout s={s} m={m} l={l} className={styles.radioGroup}>\n <TunnelExit id=\"radioButtons\" />\n </ColumnLayout>\n\n <ColumnLayout\n s={s ?? [1]}\n m={m ?? [1]}\n l={l ?? [1]}\n rowGap=\"s\"\n className={styles.radioGroup}\n >\n <TunnelExit id=\"radios\" />\n </ColumnLayout>\n\n <TunnelExit id=\"fieldDescription\" />\n <TunnelExit id=\"fieldError\" />\n </TunnelProvider>\n </PropsContextProvider>\n <FieldError className={formFieldStyles.fieldError} />\n </Aria.RadioGroup>\n );\n});\n\nexport default RadioGroup;\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAsBO,MAAM,UAAa,GAAA,aAAA,CAAc,YAAc,EAAA,CAAC,KAAU,KAAA;AAC/D,EAAM,MAAA,EAAE,UAAU,SAAW,EAAA,CAAA,EAAG,GAAG,CAAG,EAAA,GAAA,EAAK,GAAG,IAAA,EAAS,GAAA,KAAA;AAEvD,EAAA,MAAM,aAAgB,GAAA,IAAA,CAAK,eAAgB,CAAA,SAAA,EAAW,SAAS,CAAA;AAE/D,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,KAAO,EAAA;AAAA,MACL,WAAW,eAAgB,CAAA;AAAA,KAC7B;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,WAAW,eAAgB,CAAA,gBAAA;AAAA,MAC3B,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,UAAY,EAAA;AAAA,MACV,WAAW,eAAgB,CAAA,gBAAA;AAAA,MAC3B,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,WAAa,EAAA;AAAA,MACX,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,KAAO,EAAA;AAAA,MACL,QAAU,EAAA;AAAA;AACZ,GACF;AAEA,EAAM,MAAA,aAAA,GAAgB,aAAa,GAAG,CAAA;AACtC,EAAA,gBAAA,CAAiB,aAAa,CAAA;AAE9B,EACE,uBAAA,IAAA,CAAC,KAAK,UAAL,EAAA,EAAiB,GAAG,IAAM,EAAA,SA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react';
|
|
5
6
|
import * as Aria from 'react-aria-components';
|
|
6
7
|
import formFieldStyles from '../FormField/FormField.module.scss.mjs';
|
|
7
8
|
import styles from './SegmentedControl.module.scss.mjs';
|
|
@@ -11,6 +12,8 @@ import { PropsContextProvider } from '../../lib/propsContext/components/PropsCon
|
|
|
11
12
|
import { TunnelProvider, TunnelExit } from '@mittwald/react-tunnel';
|
|
12
13
|
import { FieldError } from '../FieldError/FieldError.mjs';
|
|
13
14
|
import clsx from 'clsx';
|
|
15
|
+
import { useObjectRef } from '@react-aria/utils';
|
|
16
|
+
import { useMakeFocusable } from '../../lib/hooks/dom/useMakeFocusable.mjs';
|
|
14
17
|
|
|
15
18
|
const SegmentedControl = flowComponent("SegmentedControl", (props) => {
|
|
16
19
|
const {
|
|
@@ -43,7 +46,9 @@ const SegmentedControl = flowComponent("SegmentedControl", (props) => {
|
|
|
43
46
|
className: styles.segment
|
|
44
47
|
}
|
|
45
48
|
};
|
|
46
|
-
|
|
49
|
+
const localRadioRef = useObjectRef(ref);
|
|
50
|
+
useMakeFocusable(localRadioRef);
|
|
51
|
+
return /* @__PURE__ */ jsxs(Aria.RadioGroup, { ...rest, className: rootClassName, ref: localRadioRef, children: [
|
|
47
52
|
/* @__PURE__ */ jsx(PropsContextProvider, { dependencies: ["segment"], props: propsContext, children: /* @__PURE__ */ jsxs(TunnelProvider, { children: [
|
|
48
53
|
children,
|
|
49
54
|
/* @__PURE__ */ jsx("div", { className: styles.segmentedControl, children: /* @__PURE__ */ jsx("div", { className: styles.segments, children: /* @__PURE__ */ jsx(TunnelExit, { id: "segments" }) }) }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.mjs","sources":["../../../../../../src/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport type { PropsWithContainerBreakpointSize } from \"@/lib/types/props\";\nimport
|
|
1
|
+
{"version":3,"file":"SegmentedControl.mjs","sources":["../../../../../../src/components/SegmentedControl/SegmentedControl.tsx"],"sourcesContent":["import {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport type { PropsWithContainerBreakpointSize } from \"@/lib/types/props\";\nimport React, { type PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport styles from \"./SegmentedControl.module.scss\";\nimport { getContainerBreakpointSizeClassName } from \"@/lib/getContainerBreakpointSizeClassName\";\nimport { type PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport { FieldError } from \"@/components/FieldError\";\nimport clsx from \"clsx\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\n\nexport interface SegmentedControlProps\n extends PropsWithChildren<Omit<Aria.RadioGroupProps, \"children\">>,\n FlowComponentProps,\n PropsWithContainerBreakpointSize {}\n\n/** @flr-generate all */\nexport const SegmentedControl = flowComponent(\"SegmentedControl\", (props) => {\n const {\n children,\n className,\n containerBreakpointSize = \"m\",\n ref,\n ...rest\n } = props;\n\n const rootClassName = clsx(\n formFieldStyles.formField,\n styles.segmentedControlContainer,\n className,\n styles[getContainerBreakpointSizeClassName(containerBreakpointSize)],\n );\n\n const propsContext: PropsContext = {\n Label: {\n className: formFieldStyles.label,\n },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n tunnelId: \"fieldDescription\",\n },\n FieldError: {\n className: formFieldStyles.customFieldError,\n tunnelId: \"fieldError\",\n },\n Segment: {\n tunnelId: \"segments\",\n className: styles.segment,\n },\n };\n\n const localRadioRef = useObjectRef(ref);\n useMakeFocusable(localRadioRef);\n\n return (\n <Aria.RadioGroup {...rest} className={rootClassName} ref={localRadioRef}>\n <PropsContextProvider dependencies={[\"segment\"]} props={propsContext}>\n <TunnelProvider>\n {children}\n\n <div className={styles.segmentedControl}>\n <div className={styles.segments}>\n <TunnelExit id=\"segments\" />\n </div>\n </div>\n\n <TunnelExit id=\"fieldDescription\" />\n <TunnelExit id=\"fieldError\" />\n </TunnelProvider>\n </PropsContextProvider>\n <FieldError className={formFieldStyles.fieldError} />\n </Aria.RadioGroup>\n );\n});\n\nexport default SegmentedControl;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAwBO,MAAM,gBAAmB,GAAA,aAAA,CAAc,kBAAoB,EAAA,CAAC,KAAU,KAAA;AAC3E,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,uBAA0B,GAAA,GAAA;AAAA,IAC1B,GAAA;AAAA,IACA,GAAG;AAAA,GACD,GAAA,KAAA;AAEJ,EAAA,MAAM,aAAgB,GAAA,IAAA;AAAA,IACpB,eAAgB,CAAA,SAAA;AAAA,IAChB,MAAO,CAAA,yBAAA;AAAA,IACP,SAAA;AAAA,IACA,MAAA,CAAO,mCAAoC,CAAA,uBAAuB,CAAC;AAAA,GACrE;AAEA,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,KAAO,EAAA;AAAA,MACL,WAAW,eAAgB,CAAA;AAAA,KAC7B;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,WAAW,eAAgB,CAAA,gBAAA;AAAA,MAC3B,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,UAAY,EAAA;AAAA,MACV,WAAW,eAAgB,CAAA,gBAAA;AAAA,MAC3B,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,OAAS,EAAA;AAAA,MACP,QAAU,EAAA,UAAA;AAAA,MACV,WAAW,MAAO,CAAA;AAAA;AACpB,GACF;AAEA,EAAM,MAAA,aAAA,GAAgB,aAAa,GAAG,CAAA;AACtC,EAAA,gBAAA,CAAiB,aAAa,CAAA;AAE9B,EACE,uBAAA,IAAA,CAAC,KAAK,UAAL,EAAA,EAAiB,GAAG,IAAM,EAAA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