@mittwald/flow-react-components 0.2.0-alpha.537 → 0.2.0-alpha.539
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 +12 -0
- package/dist/assets/doc-properties.json +23983 -23964
- package/dist/css/all.css +1 -1
- package/dist/js/components/src/components/Autocomplete/Autocomplete.mjs +2 -2
- package/dist/js/components/src/components/Autocomplete/Autocomplete.mjs.map +1 -1
- package/dist/js/components/src/components/Checkbox/Checkbox.mjs +8 -3
- package/dist/js/components/src/components/Checkbox/Checkbox.mjs.map +1 -1
- package/dist/js/components/src/components/CheckboxButton/CheckboxButton.mjs +2 -2
- package/dist/js/components/src/components/CheckboxButton/CheckboxButton.mjs.map +1 -1
- package/dist/js/components/src/components/CheckboxGroup/CheckboxGroup.mjs +2 -2
- package/dist/js/components/src/components/CheckboxGroup/CheckboxGroup.mjs.map +1 -1
- package/dist/js/components/src/components/ComboBox/ComboBox.mjs +2 -2
- package/dist/js/components/src/components/ComboBox/ComboBox.mjs.map +1 -1
- package/dist/js/components/src/components/DatePicker/DatePicker.mjs +19 -12
- package/dist/js/components/src/components/DatePicker/DatePicker.mjs.map +1 -1
- package/dist/js/components/src/components/DateRangePicker/DateRangePicker.mjs +19 -12
- package/dist/js/components/src/components/DateRangePicker/DateRangePicker.mjs.map +1 -1
- package/dist/js/components/src/components/FieldError/FieldError.mjs +26 -25
- package/dist/js/components/src/components/FieldError/FieldError.mjs.map +1 -1
- package/dist/js/components/src/components/FileDropZone/FileDropZone.mjs +2 -2
- package/dist/js/components/src/components/FileDropZone/FileDropZone.mjs.map +1 -1
- package/dist/js/components/src/components/FileField/FileField.mjs +2 -2
- package/dist/js/components/src/components/FileField/FileField.mjs.map +1 -1
- package/dist/js/components/src/components/NumberField/NumberField.mjs +7 -2
- package/dist/js/components/src/components/NumberField/NumberField.mjs.map +1 -1
- package/dist/js/components/src/components/PasswordCreationField/PasswordCreationField.mjs +56 -82
- package/dist/js/components/src/components/PasswordCreationField/PasswordCreationField.mjs.map +1 -1
- package/dist/js/components/src/components/RadioGroup/RadioGroup.mjs +2 -2
- package/dist/js/components/src/components/RadioGroup/RadioGroup.mjs.map +1 -1
- package/dist/js/components/src/components/SearchField/SearchField.mjs +2 -2
- package/dist/js/components/src/components/SearchField/SearchField.mjs.map +1 -1
- package/dist/js/components/src/components/SegmentedControl/SegmentedControl.mjs +2 -2
- package/dist/js/components/src/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
- package/dist/js/components/src/components/Select/Select.mjs +2 -2
- package/dist/js/components/src/components/Select/Select.mjs.map +1 -1
- package/dist/js/components/src/components/Switch/Switch.mjs +8 -3
- package/dist/js/components/src/components/Switch/Switch.mjs.map +1 -1
- package/dist/js/components/src/components/TextArea/TextArea.mjs +7 -1
- package/dist/js/components/src/components/TextArea/TextArea.mjs.map +1 -1
- package/dist/js/components/src/components/TextField/TextField.mjs +7 -1
- package/dist/js/components/src/components/TextField/TextField.mjs.map +1 -1
- package/dist/js/components/src/components/TextFieldBase/TextFieldBase.mjs +6 -3
- package/dist/js/components/src/components/TextFieldBase/TextFieldBase.mjs.map +1 -1
- package/dist/js/components/src/components/TimeField/TimeField.mjs +10 -3
- package/dist/js/components/src/components/TimeField/TimeField.mjs.map +1 -1
- package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs +12 -28
- package/dist/js/components/src/integrations/react-hook-form/components/Field/Field.mjs.map +1 -1
- package/dist/js/components/src/lib/hooks/useFieldComponent.mjs +5 -9
- package/dist/js/components/src/lib/hooks/useFieldComponent.mjs.map +1 -1
- package/dist/js/components/src/lib/hooks/useFieldError.mjs +132 -21
- package/dist/js/components/src/lib/hooks/useFieldError.mjs.map +1 -1
- package/dist/js/components/src/lib/propsContext/components/PropsContextProvider.mjs +2 -1
- package/dist/js/components/src/lib/propsContext/components/PropsContextProvider.mjs.map +1 -1
- package/dist/js/components/src/lib/propsContext/inherit/lib.mjs +11 -2
- package/dist/js/components/src/lib/propsContext/inherit/lib.mjs.map +1 -1
- package/dist/js/components/src/lib/propsContext/inherit/types.mjs.map +1 -1
- package/dist/js/components/src/views/FieldErrorView.mjs +15 -0
- package/dist/js/components/src/views/FieldErrorView.mjs.map +1 -0
- package/dist/types/components/Checkbox/Checkbox.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/FieldError/FieldError.d.ts.map +1 -1
- package/dist/types/components/LayoutCard/stories/Default.stories.d.ts +1 -0
- package/dist/types/components/LayoutCard/stories/Default.stories.d.ts.map +1 -1
- package/dist/types/components/NumberField/NumberField.d.ts.map +1 -1
- package/dist/types/components/PasswordCreationField/PasswordCreationField.d.ts.map +1 -1
- package/dist/types/components/Switch/Switch.d.ts.map +1 -1
- package/dist/types/components/TextArea/TextArea.d.ts +1 -1
- package/dist/types/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/types/components/TextField/TextField.d.ts +1 -1
- package/dist/types/components/TextField/TextField.d.ts.map +1 -1
- package/dist/types/components/TextFieldBase/TextFieldBase.d.ts +1 -1
- package/dist/types/components/TextFieldBase/TextFieldBase.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/Field.d.ts.map +1 -1
- package/dist/types/integrations/react-hook-form/components/Field/stories/PasswordCreationField.stories.d.ts.map +1 -1
- package/dist/types/lib/hooks/useFieldComponent.d.ts +1 -1
- package/dist/types/lib/hooks/useFieldComponent.d.ts.map +1 -1
- package/dist/types/lib/hooks/useFieldError.d.ts +5 -7
- package/dist/types/lib/hooks/useFieldError.d.ts.map +1 -1
- package/dist/types/lib/propsContext/components/PropsContextProvider.d.ts.map +1 -1
- package/dist/types/lib/propsContext/inherit/lib.d.ts +2 -0
- package/dist/types/lib/propsContext/inherit/lib.d.ts.map +1 -1
- package/dist/types/lib/propsContext/inherit/types.d.ts +1 -1
- package/dist/types/lib/propsContext/inherit/types.d.ts.map +1 -1
- package/dist/types/lib/propsContext/nestedPropsContext/lib.d.ts +1 -1
- package/package.json +4 -4
|
@@ -55,7 +55,7 @@ const Autocomplete = flowComponent("Autocomplete", (props) => {
|
|
|
55
55
|
};
|
|
56
56
|
const {
|
|
57
57
|
FieldErrorView,
|
|
58
|
-
|
|
58
|
+
FieldErrorCaptureContext,
|
|
59
59
|
fieldPropsContext,
|
|
60
60
|
fieldProps
|
|
61
61
|
} = useFieldComponent(props);
|
|
@@ -71,7 +71,7 @@ const Autocomplete = flowComponent("Autocomplete", (props) => {
|
|
|
71
71
|
...fieldPropsContext
|
|
72
72
|
};
|
|
73
73
|
return /* @__PURE__ */ jsxs("div", { ...fieldProps, children: [
|
|
74
|
-
/* @__PURE__ */ jsx(
|
|
74
|
+
/* @__PURE__ */ jsx(FieldErrorCaptureContext, { children: /* @__PURE__ */ jsx(PropsContextProvider, { props: propsContext, children: /* @__PURE__ */ jsx("div", { ...focusWithin.focusWithinProps, ref: container, children: /* @__PURE__ */ jsx(UNSAFE_PortalProvider, { getContainer: () => container.current, children: /* @__PURE__ */ jsxs(
|
|
75
75
|
Aria.Autocomplete,
|
|
76
76
|
{
|
|
77
77
|
onInputChange: handleOnInputChange,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Autocomplete.mjs","sources":["../../../../../../src/components/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import { useRef, type PropsWithChildren } from \"react\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport * as Aria from \"react-aria-components\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport type { SearchFieldProps } from \"@/components/SearchField\";\nimport type { TextFieldProps } from \"@/components/TextField\";\nimport Options from \"@/components/Options\";\nimport { TunnelExit } from \"@mittwald/react-tunnel\";\nimport locales from \"./locales/*.locale.json\";\nimport Text from \"@/components/Text\";\nimport styles from \"./Autocomplete.module.scss\";\nimport {\n UNSAFE_PortalProvider,\n useFocusWithin,\n useLocalizedStringFormatter,\n} from \"react-aria\";\nimport { emitElementValueChange } from \"@/lib/react/emitElementValueChange\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nexport interface AutocompleteProps\n extends PropsWithChildren,\n PropsWithClassName,\n FlowComponentProps,\n Omit<Aria.AutocompleteProps, \"children\" | \"onInputChange\" | \"inputValue\"> {\n isInvalid?: boolean;\n}\n\n/** @flr-generate all */\nexport const Autocomplete = flowComponent(\"Autocomplete\", (props) => {\n const { children, isInvalid, ...rest } = props;\n\n const { contains } = Aria.useFilter({ sensitivity: \"base\" });\n const stringFormatter = useLocalizedStringFormatter(locales);\n const container = useRef(null);\n const triggerRef = useRef<HTMLInputElement>(null);\n\n const controller = useOverlayController(\"Popover\", {\n reuseControllerFromContext: false,\n });\n\n const focusWithin = useFocusWithin({\n onBlurWithin: controller.close,\n });\n\n const inputProps: SearchFieldProps & TextFieldProps = {\n onKeyDown: (e) => {\n if (e.key === \"Enter\" && controller.isOpen) {\n e.preventDefault();\n }\n },\n isInvalid,\n ref: triggerRef,\n };\n\n const renderEmptyState = () => (\n <Text className={styles.empty}>\n {stringFormatter.format(\"autocomplete.empty\")}\n </Text>\n );\n\n const handleOnInputChange = (value: string) => {\n if (!value) {\n controller.close();\n } else if (!controller.isOpen) {\n controller.open();\n }\n };\n\n const handleOptionAction = (key: Aria.Key) => {\n const inputElement = triggerRef.current;\n if (inputElement) {\n // Set value on input element and trigger change event\n emitElementValueChange(inputElement, String(key));\n }\n controller.close();\n };\n\n const {\n FieldErrorView,\n
|
|
1
|
+
{"version":3,"file":"Autocomplete.mjs","sources":["../../../../../../src/components/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import { useRef, type PropsWithChildren } from \"react\";\nimport type { PropsWithClassName } from \"@/lib/types/props\";\nimport { type PropsContext, PropsContextProvider } from \"@/lib/propsContext\";\nimport * as Aria from \"react-aria-components\";\nimport { useOverlayController } from \"@/lib/controller\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport type { SearchFieldProps } from \"@/components/SearchField\";\nimport type { TextFieldProps } from \"@/components/TextField\";\nimport Options from \"@/components/Options\";\nimport { TunnelExit } from \"@mittwald/react-tunnel\";\nimport locales from \"./locales/*.locale.json\";\nimport Text from \"@/components/Text\";\nimport styles from \"./Autocomplete.module.scss\";\nimport {\n UNSAFE_PortalProvider,\n useFocusWithin,\n useLocalizedStringFormatter,\n} from \"react-aria\";\nimport { emitElementValueChange } from \"@/lib/react/emitElementValueChange\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nexport interface AutocompleteProps\n extends PropsWithChildren,\n PropsWithClassName,\n FlowComponentProps,\n Omit<Aria.AutocompleteProps, \"children\" | \"onInputChange\" | \"inputValue\"> {\n isInvalid?: boolean;\n}\n\n/** @flr-generate all */\nexport const Autocomplete = flowComponent(\"Autocomplete\", (props) => {\n const { children, isInvalid, ...rest } = props;\n\n const { contains } = Aria.useFilter({ sensitivity: \"base\" });\n const stringFormatter = useLocalizedStringFormatter(locales);\n const container = useRef(null);\n const triggerRef = useRef<HTMLInputElement>(null);\n\n const controller = useOverlayController(\"Popover\", {\n reuseControllerFromContext: false,\n });\n\n const focusWithin = useFocusWithin({\n onBlurWithin: controller.close,\n });\n\n const inputProps: SearchFieldProps & TextFieldProps = {\n onKeyDown: (e) => {\n if (e.key === \"Enter\" && controller.isOpen) {\n e.preventDefault();\n }\n },\n isInvalid,\n ref: triggerRef,\n };\n\n const renderEmptyState = () => (\n <Text className={styles.empty}>\n {stringFormatter.format(\"autocomplete.empty\")}\n </Text>\n );\n\n const handleOnInputChange = (value: string) => {\n if (!value) {\n controller.close();\n } else if (!controller.isOpen) {\n controller.open();\n }\n };\n\n const handleOptionAction = (key: Aria.Key) => {\n const inputElement = triggerRef.current;\n if (inputElement) {\n // Set value on input element and trigger change event\n emitElementValueChange(inputElement, String(key));\n }\n controller.close();\n };\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props);\n\n const propsContext: PropsContext = {\n SearchField: inputProps,\n TextField: inputProps,\n Option: {\n tunnelId: \"options\",\n },\n Popover: {\n className: styles.popover,\n },\n ...fieldPropsContext,\n };\n\n return (\n <div {...fieldProps}>\n <FieldErrorCaptureContext>\n <PropsContextProvider props={propsContext}>\n <div {...focusWithin.focusWithinProps} ref={container}>\n <UNSAFE_PortalProvider getContainer={() => container.current}>\n <Aria.Autocomplete\n onInputChange={handleOnInputChange}\n filter={contains}\n disableAutoFocusFirst\n {...rest}\n >\n {children}\n <Options\n onAction={handleOptionAction}\n triggerRef={triggerRef}\n controller={controller}\n renderEmptyState={renderEmptyState}\n isNonModal\n placement=\"bottom start\"\n >\n <TunnelExit id=\"options\" />\n </Options>\n </Aria.Autocomplete>\n </UNSAFE_PortalProvider>\n </div>\n </PropsContextProvider>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </div>\n );\n});\n\nexport default Autocomplete;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAgCO,MAAM,YAAA,GAAe,aAAA,CAAc,cAAA,EAAgB,CAAC,KAAA,KAAU;AACnE,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,GAAG,MAAK,GAAI,KAAA;AAEzC,EAAA,MAAM,EAAE,UAAS,GAAI,IAAA,CAAK,UAAU,EAAE,WAAA,EAAa,QAAQ,CAAA;AAC3D,EAAA,MAAM,eAAA,GAAkB,4BAA4B,OAAO,CAAA;AAC3D,EAAA,MAAM,SAAA,GAAY,OAAO,IAAI,CAAA;AAC7B,EAAA,MAAM,UAAA,GAAa,OAAyB,IAAI,CAAA;AAEhD,EAAA,MAAM,UAAA,GAAa,qBAAqB,SAAA,EAAW;AAAA,IACjD,0BAAA,EAA4B;AAAA,GAC7B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Checkbox = flowComponent("Checkbox", (props) => {
|
|
22
22
|
const { children, className, ref, inputClassName, ...rest } = props;
|
|
23
|
-
const {
|
|
23
|
+
const {
|
|
24
|
+
FieldErrorView,
|
|
25
|
+
FieldErrorCaptureContext,
|
|
26
|
+
fieldPropsContext,
|
|
27
|
+
fieldProps
|
|
28
|
+
} = useFieldComponent(props);
|
|
24
29
|
const localCheckboxRef = useObjectRef(ref);
|
|
25
30
|
useMakeFocusable(localCheckboxRef);
|
|
26
31
|
return /* @__PURE__ */ jsxs(
|
|
@@ -30,10 +35,10 @@ const Checkbox = flowComponent("Checkbox", (props) => {
|
|
|
30
35
|
className: clsx(styles.checkbox, className, fieldProps.className),
|
|
31
36
|
ref: localCheckboxRef,
|
|
32
37
|
children: [
|
|
33
|
-
/* @__PURE__ */ jsx(Aria.Checkbox, { ...rest, className: clsx(inputClassName, styles.input), children: ({ isSelected, isIndeterminate }) => /* @__PURE__ */ jsxs(PropsContextProvider, { props: fieldPropsContext, children: [
|
|
38
|
+
/* @__PURE__ */ jsx(FieldErrorCaptureContext, { children: /* @__PURE__ */ jsx(Aria.Checkbox, { ...rest, className: clsx(inputClassName, styles.input), children: ({ isSelected, isIndeterminate }) => /* @__PURE__ */ jsxs(PropsContextProvider, { props: fieldPropsContext, children: [
|
|
34
39
|
isSelected ? /* @__PURE__ */ jsx(IconCheckboxChecked, { className: styles.icon }) : isIndeterminate ? /* @__PURE__ */ jsx(IconCheckboxIndeterminate, { className: styles.icon }) : /* @__PURE__ */ jsx(IconCheckboxEmpty, { className: styles.icon }),
|
|
35
40
|
children
|
|
36
|
-
] }) }),
|
|
41
|
+
] }) }) }),
|
|
37
42
|
/* @__PURE__ */ jsx(FieldErrorView, {})
|
|
38
43
|
]
|
|
39
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.mjs","sources":["../../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import {\n IconCheckboxChecked,\n IconCheckboxEmpty,\n IconCheckboxIndeterminate,\n} from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport clsx from \"clsx\";\nimport type { PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"./Checkbox.module.scss\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\n\nexport interface CheckboxProps\n extends PropsWithChildren<Omit<Aria.CheckboxProps, \"children\">>,\n FlowComponentProps {\n inputClassName?: string;\n}\n\n/** @flr-generate all */\nexport const Checkbox = flowComponent(\"Checkbox\", (props) => {\n const { children, className, ref, inputClassName, ...rest } = props;\n\n const {
|
|
1
|
+
{"version":3,"file":"Checkbox.mjs","sources":["../../../../../../src/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import {\n IconCheckboxChecked,\n IconCheckboxEmpty,\n IconCheckboxIndeterminate,\n} from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport clsx from \"clsx\";\nimport type { PropsWithChildren } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"./Checkbox.module.scss\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\n\nexport interface CheckboxProps\n extends PropsWithChildren<Omit<Aria.CheckboxProps, \"children\">>,\n FlowComponentProps {\n inputClassName?: string;\n}\n\n/** @flr-generate all */\nexport const Checkbox = flowComponent(\"Checkbox\", (props) => {\n const { children, className, ref, inputClassName, ...rest } = props;\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldPropsContext,\n fieldProps,\n } = useFieldComponent(props);\n\n const localCheckboxRef = useObjectRef(ref);\n useMakeFocusable(localCheckboxRef);\n\n return (\n <div\n {...fieldProps}\n className={clsx(styles.checkbox, className, fieldProps.className)}\n ref={localCheckboxRef}\n >\n <FieldErrorCaptureContext>\n <Aria.Checkbox {...rest} className={clsx(inputClassName, styles.input)}>\n {({ isSelected, isIndeterminate }) => (\n <PropsContextProvider props={fieldPropsContext}>\n {isSelected ? (\n <IconCheckboxChecked className={styles.icon} />\n ) : isIndeterminate ? (\n <IconCheckboxIndeterminate className={styles.icon} />\n ) : (\n <IconCheckboxEmpty className={styles.icon} />\n )}\n {children}\n </PropsContextProvider>\n )}\n </Aria.Checkbox>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </div>\n );\n});\n\nexport default Checkbox;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAuBO,MAAM,QAAA,GAAW,aAAA,CAAc,UAAA,EAAY,CAAC,KAAA,KAAU;AAC3D,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,KAAK,cAAA,EAAgB,GAAG,MAAK,GAAI,KAAA;AAE9D,EAAA,MAAM;AAAA,IACJ,cAAA;AAAA,IACA,wBAAA;AAAA,IACA,iBAAA;AAAA,IACA;AAAA,GACF,GAAI,kBAAkB,KAAK,CAAA;AAE3B,EAAA,MAAM,gBAAA,GAAmB,aAAa,GAAG,CAAA;AACzC,EAAA,gBAAA,CAAiB,gBAAgB,CAAA;AAEjC,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACE,GAAG,UAAA;AAAA,MACJ,WAAW,IAAA,CAAK,MAAA,CAAO,QAAA,EAAU,SAAA,EAAW,WAAW,SAAS,CAAA;AAAA,MAChE,GAAA,EAAK,gBAAA;AAAA,MAEL,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,wBAAA,EAAA,EACC,8BAAC,IAAA,CAAK,QAAA,EAAL,EAAe,GAAG,IAAA,EAAM,WAAW,IAAA,CAAK,cAAA,EAAgB,OAAO,KAAK,CAAA,EAClE,WAAC,EAAE,UAAA,EAAY,iBAAgB,qBAC9B,IAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,iBAAA,EAC1B,QAAA,EAAA;AAAA,UAAA,UAAA,uBACE,mBAAA,EAAA,EAAoB,SAAA,EAAW,MAAA,CAAO,IAAA,EAAM,IAC3C,eAAA,mBACF,GAAA,CAAC,yBAAA,EAAA,EAA0B,SAAA,EAAW,OAAO,IAAA,EAAM,CAAA,uBAElD,iBAAA,EAAA,EAAkB,SAAA,EAAW,OAAO,IAAA,EAAM,CAAA;AAAA,UAE5C;AAAA,SAAA,EACH,GAEJ,CAAA,EACF,CAAA;AAAA,4BACC,cAAA,EAAA,EAAe;AAAA;AAAA;AAAA,GAClB;AAEJ,CAAC;;;;"}
|
|
@@ -17,7 +17,7 @@ const CheckboxButton = flowComponent("CheckboxButton", (props) => {
|
|
|
17
17
|
fieldPropsContext,
|
|
18
18
|
fieldProps,
|
|
19
19
|
FieldErrorView,
|
|
20
|
-
|
|
20
|
+
FieldErrorCaptureContext
|
|
21
21
|
} = useFieldComponent(props);
|
|
22
22
|
const mergedPropsContext = {
|
|
23
23
|
Text: {
|
|
@@ -37,7 +37,7 @@ const CheckboxButton = flowComponent("CheckboxButton", (props) => {
|
|
|
37
37
|
className: clsx(fieldProps.className, styles.checkboxButton, className),
|
|
38
38
|
ref: localCheckboxButtonRef,
|
|
39
39
|
children: [
|
|
40
|
-
/* @__PURE__ */ jsx(
|
|
40
|
+
/* @__PURE__ */ jsx(FieldErrorCaptureContext, { children: /* @__PURE__ */ jsx(Checkbox, { ...rest, inputClassName: clsx(inputClassName, styles.input), children: /* @__PURE__ */ jsx(PropsContextProvider, { props: mergedPropsContext, children }) }) }),
|
|
41
41
|
/* @__PURE__ */ jsx(FieldErrorView, {})
|
|
42
42
|
]
|
|
43
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxButton.mjs","sources":["../../../../../../src/components/CheckboxButton/CheckboxButton.tsx"],"sourcesContent":["import styles from \"./CheckboxButton.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport type { CheckboxProps } from \"@/components/Checkbox\";\nimport { Checkbox } from \"@/components/Checkbox\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\n\nexport interface CheckboxButtonProps\n extends CheckboxProps,\n FlowComponentProps {}\n\n/** @flr-generate all */\nexport const CheckboxButton = flowComponent(\"CheckboxButton\", (props) => {\n const { children, className, ref, inputClassName, ...rest } = props;\n\n const {\n fieldPropsContext,\n fieldProps,\n FieldErrorView,\n
|
|
1
|
+
{"version":3,"file":"CheckboxButton.mjs","sources":["../../../../../../src/components/CheckboxButton/CheckboxButton.tsx"],"sourcesContent":["import styles from \"./CheckboxButton.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport type { CheckboxProps } from \"@/components/Checkbox\";\nimport { Checkbox } from \"@/components/Checkbox\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\n\nexport interface CheckboxButtonProps\n extends CheckboxProps,\n FlowComponentProps {}\n\n/** @flr-generate all */\nexport const CheckboxButton = flowComponent(\"CheckboxButton\", (props) => {\n const { children, className, ref, inputClassName, ...rest } = props;\n\n const {\n fieldPropsContext,\n fieldProps,\n FieldErrorView,\n FieldErrorCaptureContext,\n } = useFieldComponent(props);\n\n const mergedPropsContext: PropsContext = {\n Text: {\n className: styles.label,\n },\n Content: {\n className: styles.content,\n },\n ...fieldPropsContext,\n };\n\n const localCheckboxButtonRef = useObjectRef(ref);\n useMakeFocusable(localCheckboxButtonRef);\n\n return (\n <div\n {...fieldProps}\n className={clsx(fieldProps.className, styles.checkboxButton, className)}\n ref={localCheckboxButtonRef}\n >\n <FieldErrorCaptureContext>\n <Checkbox {...rest} inputClassName={clsx(inputClassName, styles.input)}>\n <PropsContextProvider props={mergedPropsContext}>\n {children}\n </PropsContextProvider>\n </Checkbox>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </div>\n );\n});\n\nexport default CheckboxButton;\n"],"names":[],"mappings":";;;;;;;;;;;AAiBO,MAAM,cAAA,GAAiB,aAAA,CAAc,gBAAA,EAAkB,CAAC,KAAA,KAAU;AACvE,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,KAAK,cAAA,EAAgB,GAAG,MAAK,GAAI,KAAA;AAE9D,EAAA,MAAM;AAAA,IACJ,iBAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACF,GAAI,kBAAkB,KAAK,CAAA;AAE3B,EAAA,MAAM,kBAAA,GAAmC;AAAA,IACvC,IAAA,EAAM;AAAA,MACJ,WAAW,MAAA,CAAO;AAAA,KACpB;AAAA,IACA,OAAA,EAAS;AAAA,MACP,WAAW,MAAA,CAAO;AAAA,KACpB;AAAA,IACA,GAAG;AAAA,GACL;AAEA,EAAA,MAAM,sBAAA,GAAyB,aAAa,GAAG,CAAA;AAC/C,EAAA,gBAAA,CAAiB,sBAAsB,CAAA;AAEvC,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACE,GAAG,UAAA;AAAA,MACJ,WAAW,IAAA,CAAK,UAAA,CAAW,SAAA,EAAW,MAAA,CAAO,gBAAgB,SAAS,CAAA;AAAA,MACtE,GAAA,EAAK,sBAAA;AAAA,MAEL,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,4BACC,QAAA,kBAAA,GAAA,CAAC,QAAA,EAAA,EAAU,GAAG,IAAA,EAAM,gBAAgB,IAAA,CAAK,cAAA,EAAgB,MAAA,CAAO,KAAK,GACnE,QAAA,kBAAA,GAAA,CAAC,oBAAA,EAAA,EAAqB,OAAO,kBAAA,EAC1B,QAAA,EACH,GACF,CAAA,EACF,CAAA;AAAA,4BACC,cAAA,EAAA,EAAe;AAAA;AAAA;AAAA,GAClB;AAEJ,CAAC;;;;"}
|
|
@@ -19,7 +19,7 @@ const CheckboxGroup = flowComponent("CheckboxGroup", (props) => {
|
|
|
19
19
|
FieldErrorView,
|
|
20
20
|
fieldPropsContext,
|
|
21
21
|
fieldProps,
|
|
22
|
-
|
|
22
|
+
FieldErrorCaptureContext
|
|
23
23
|
} = useFieldComponent(props);
|
|
24
24
|
const propsContext = {
|
|
25
25
|
Checkbox: {
|
|
@@ -45,7 +45,7 @@ const CheckboxGroup = flowComponent("CheckboxGroup", (props) => {
|
|
|
45
45
|
className: clsx(fieldProps.className, className),
|
|
46
46
|
ref: localCheckboxGroupRef,
|
|
47
47
|
children: /* @__PURE__ */ jsxs(TunnelProvider, { children: [
|
|
48
|
-
/* @__PURE__ */ jsx(
|
|
48
|
+
/* @__PURE__ */ jsx(FieldErrorCaptureContext, { children: /* @__PURE__ */ jsxs(PropsContextProvider, { props: propsContext, clear: true, children: [
|
|
49
49
|
children,
|
|
50
50
|
/* @__PURE__ */ jsx(ColumnLayout, { s, m, l, className: styles.checkboxGroup, children: /* @__PURE__ */ jsx(TunnelExit, { id: "checkboxButtons" }) }),
|
|
51
51
|
/* @__PURE__ */ jsx(
|
|
@@ -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 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 styles from \"./CheckboxGroup.module.scss\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\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, isInvalid, s, m, l, ref, ...rest } = props;\n\n const {\n FieldErrorView,\n fieldPropsContext,\n fieldProps,\n
|
|
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 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 styles from \"./CheckboxGroup.module.scss\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\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, isInvalid, s, m, l, ref, ...rest } = props;\n\n const {\n FieldErrorView,\n fieldPropsContext,\n fieldProps,\n FieldErrorCaptureContext,\n } = useFieldComponent(props);\n\n const propsContext: PropsContext = {\n Checkbox: {\n isInvalid,\n tunnelId: \"checkboxes\",\n className: styles.checkbox,\n },\n CheckboxButton: {\n isInvalid,\n tunnelId: \"checkboxButtons\",\n className: styles.checkboxButton,\n },\n ...fieldPropsContext,\n };\n\n const localCheckboxGroupRef = useObjectRef(ref);\n useMakeFocusable(localCheckboxGroupRef);\n\n return (\n <Aria.CheckboxGroup\n {...rest}\n {...fieldProps}\n isInvalid={isInvalid}\n className={clsx(fieldProps.className, className)}\n ref={localCheckboxGroupRef}\n >\n <TunnelProvider>\n <FieldErrorCaptureContext>\n <PropsContextProvider props={propsContext} clear>\n {children}\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 </PropsContextProvider>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </TunnelProvider>\n </Aria.CheckboxGroup>\n );\n});\n\nexport default CheckboxGroup;\n"],"names":[],"mappings":";;;;;;;;;;;;;AAqBO,MAAM,aAAA,GAAgB,aAAA,CAAc,eAAA,EAAiB,CAAC,K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A,EAAG,iBAAA,EAAkB,CAAA,EACnC,CAAA;AAAA,0BAEA,GAAA;AAAA,YAAC,YAAA;AAAA,YAAA;AAAA,cACC,CAAA,EAAG,CAAA,IAAK,CAAC,CAAC,CAAA;AAAA,cACV,CAAA,EAAG,CAAA,IAAK,CAAC,CAAC,CAAA;AAAA,cACV,CAAA,EAAG,CAAA,IAAK,CAAC,CAAC,CAAA;AAAA,cACV,MAAA,EAAO,GAAA;AAAA,cACP,WAAW,MAAA,CAAO,aAAA;AAAA,cAElB,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,EAAA,EAAG,YAAA,EAAa;AAAA;AAAA;AAC9B,SAAA,EACF,CAAA,EACF,CAAA;AAAA,4BACC,cAAA,EAAA,EAAe;AAAA,OAAA,EAClB;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
|
|
@@ -40,7 +40,7 @@ const ComboBox = flowComponent("ComboBox", (props) => {
|
|
|
40
40
|
} = props;
|
|
41
41
|
const {
|
|
42
42
|
FieldErrorView,
|
|
43
|
-
|
|
43
|
+
FieldErrorCaptureContext,
|
|
44
44
|
fieldProps,
|
|
45
45
|
fieldPropsContext
|
|
46
46
|
} = useFieldComponent(props);
|
|
@@ -76,7 +76,7 @@ const ComboBox = flowComponent("ComboBox", (props) => {
|
|
|
76
76
|
onSelectionChange: handleOnSelectionChange,
|
|
77
77
|
onOpenChange: (isOpen) => controller.setOpen(isOpen),
|
|
78
78
|
children: /* @__PURE__ */ jsx(PropsContextProvider, { props: propsContext, children: /* @__PURE__ */ jsxs(TunnelProvider, { children: [
|
|
79
|
-
/* @__PURE__ */ jsxs(
|
|
79
|
+
/* @__PURE__ */ jsxs(FieldErrorCaptureContext, { children: [
|
|
80
80
|
/* @__PURE__ */ jsxs("div", { className: styles.input, children: [
|
|
81
81
|
/* @__PURE__ */ jsx(Aria.Input, { placeholder }),
|
|
82
82
|
/* @__PURE__ */ jsx(
|
|
@@ -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 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\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\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 {\n FieldErrorView,\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 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\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\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 {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldProps,\n fieldPropsContext,\n } = useFieldComponent(props);\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const rootClassName = clsx(fieldProps.className, styles.comboBox, className);\n\n const propsContext: PropsContext = {\n Option: {\n tunnelId: \"options\",\n },\n ...fieldPropsContext,\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 {...fieldProps}\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 <FieldErrorCaptureContext>\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\n controller={controller}\n renderEmptyState={renderEmptyState}\n >\n <TunnelExit id=\"options\" />\n </Options>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </TunnelProvider>\n </PropsContextProvider>\n </Aria.ComboBox>\n );\n});\n\nexport default ComboBox;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgCO,MAAM,QAAA,GAAW,aAAA,CAAc,UAAA,EAAY,CAAC,KAAA,KAAU;AAC3D,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA,GAAc,OAAA;AAAA,IACd,WAAW,MAAM;AAAA,IAEjB,CAAA;AAAA,IACA,oBAAoB,MAAM;AAAA,IAE1B,CAAA;AAAA,IACA,UAAA,EAAY,mBAAA;AAAA,IACZ,WAAA;AAAA,IACA,GAAA;AAAA,IACA,gBAAA;AAAA,IAEA,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM;AAAA,IACJ,cAAA;AAAA,IACA,wBAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACF,GAAI,kBAAkB,KAAK,CAAA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AAA,EAAI,SAAA,EAAW,MAAA,CAAO,KAAA,EACrB,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,IAAA,CAAK,KAAA,EAAL,EAAW,WAAA,EAA0B,CAAA;AAAA,4BACtC,GAAA;AAAA,cAAC,MAAA;AAAA,cAAA;AAAA,gBACC,WAAW,MAAA,CAAO,MAAA;AAAA,gBAClB,YAAA,EAAY,eAAA,CAAgB,MAAA,CAAO,sBAAsB,CAAA;AAAA,gBACzD,OAAA,EAAQ,OAAA;AAAA,gBACR,KAAA,EAAM,WAAA;AAAA,gBAEN,8BAAC,eAAA,EAAA,EAAgB;AAAA;AAAA;AACnB,WAAA,EACF,CAAA;AAAA,UAEC,QAAA;AAAA,0BAED,GAAA;AAAA,YAAC,OAAA;AAAA,YAAA;AAAA,cACC,UAAA;AAAA,cACA,gBAAA;AAAA,cAEA,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,EAAA,EAAG,SAAA,EAAU;AAAA;AAAA;AAC3B,SAAA,EACF,CAAA;AAAA,4BACC,cAAA,EAAA,EAAe;AAAA,OAAA,EAClB,CAAA,EACF;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
|
|
@@ -23,7 +23,12 @@ import { useFieldComponent } from '../../lib/hooks/useFieldComponent.mjs';
|
|
|
23
23
|
|
|
24
24
|
const DatePicker = flowComponent("DatePicker", (props) => {
|
|
25
25
|
const { children, className, onChange, ref, ...rest } = props;
|
|
26
|
-
const {
|
|
26
|
+
const {
|
|
27
|
+
FieldErrorView,
|
|
28
|
+
FieldErrorCaptureContext,
|
|
29
|
+
fieldProps,
|
|
30
|
+
fieldPropsContext
|
|
31
|
+
} = useFieldComponent(props);
|
|
27
32
|
const rootClassName = clsx(formFieldStyles.formField, className);
|
|
28
33
|
const localRef = useObjectRef(ref);
|
|
29
34
|
useMakeFocusable(localRef);
|
|
@@ -44,17 +49,19 @@ const DatePicker = flowComponent("DatePicker", (props) => {
|
|
|
44
49
|
popoverController.close();
|
|
45
50
|
},
|
|
46
51
|
children: [
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
/* @__PURE__ */ jsxs(FieldErrorCaptureContext, { children: [
|
|
53
|
+
/* @__PURE__ */ jsx(DateInput, { isDisabled: props.isDisabled }),
|
|
54
|
+
/* @__PURE__ */ jsx(PropsContextProvider, { props: fieldPropsContext, children }),
|
|
55
|
+
/* @__PURE__ */ jsx(
|
|
56
|
+
Popover,
|
|
57
|
+
{
|
|
58
|
+
placement: "bottom end",
|
|
59
|
+
isDialogContent: true,
|
|
60
|
+
controller: popoverController,
|
|
61
|
+
children: /* @__PURE__ */ jsx(Calendar, {})
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
] }),
|
|
58
65
|
/* @__PURE__ */ jsx(FieldErrorView, {})
|
|
59
66
|
]
|
|
60
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.mjs","sources":["../../../../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport clsx from \"clsx\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport * as Aria from \"react-aria-components\";\nimport { DateInput } from \"./components/DateInput\";\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\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\n\nexport interface DatePickerProps<T extends Aria.DateValue = Aria.DateValue>\n extends PropsWithChildren<Omit<Aria.DatePickerProps<T>, \"children\">>,\n FlowComponentProps {}\n\n/** @flr-generate all */\nexport const DatePicker = flowComponent(\"DatePicker\", (props) => {\n const { children, className, onChange, ref, ...rest } = props;\n\n const {
|
|
1
|
+
{"version":3,"file":"DatePicker.mjs","sources":["../../../../../../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["import { type PropsWithChildren } from \"react\";\nimport clsx from \"clsx\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport * as Aria from \"react-aria-components\";\nimport { DateInput } from \"./components/DateInput\";\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\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\n\nexport interface DatePickerProps<T extends Aria.DateValue = Aria.DateValue>\n extends PropsWithChildren<Omit<Aria.DatePickerProps<T>, \"children\">>,\n FlowComponentProps {}\n\n/** @flr-generate all */\nexport const DatePicker = flowComponent(\"DatePicker\", (props) => {\n const { children, className, onChange, ref, ...rest } = props;\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldProps,\n fieldPropsContext,\n } = useFieldComponent(props);\n\n const rootClassName = clsx(styles.formField, className);\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 {...fieldProps}\n className={clsx(fieldProps.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 <FieldErrorCaptureContext>\n <DateInput isDisabled={props.isDisabled} />\n <PropsContextProvider props={fieldPropsContext}>\n {children}\n </PropsContextProvider>\n <Popover\n placement=\"bottom end\"\n isDialogContent\n controller={popoverController}\n >\n <Calendar />\n </Popover>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </Aria.DatePicker>\n );\n});\n\nexport default DatePicker;\n"],"names":["styles"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBO,MAAM,UAAA,GAAa,aAAA,CAAc,YAAA,EAAc,CAAC,KAAA,KAAU;AAC/D,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAW,UAAU,GAAA,EAAK,GAAG,MAAK,GAAI,KAAA;AAExD,EAAA,MAAM;AAAA,IACJ,cAAA;AAAA,IACA,wBAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACF,GAAI,kBAAkB,KAAK,CAAA;AAE3B,EAAA,MAAM,aAAA,GAAgB,IAAA,CAAKA,eAAA,CAAO,SAAA,EAAW,SAAS,CAAA;AAEtD,EAAA,MAAM,QAAA,GAAW,aAAa,GAAG,CAAA;AACjC,EAAA,gBAAA,CAAiB,QAAQ,CAAA;AAEzB,EAAA,MAAM,iBAAA,GAAoB,qBAAqB,SAAS,CAAA;AAExD,EAAA,uBACE,IAAA;AAAA,IAAC,IAAA,CAAK,UAAA;AAAA,IAAL;AAAA,MACC,GAAA,EAAK,QAAA;AAAA,MACJ,GAAG,IAAA;AAAA,MACH,GAAG,UAAA;AAAA,MACJ,SAAA,EAAW,IAAA,CAAK,UAAA,CAAW,SAAA,EAAW,aAAa,CAAA;AAAA,MACnD,YAAA,EAAc,CAAC,CAAA,KAAM,iBAAA,CAAkB,QAAQ,CAAC,CAAA;AAAA,MAChD,QAAQ,iBAAA,CAAkB,MAAA;AAAA,MAC1B,QAAA,EAAU,CAAC,KAAA,KAAU;AACnB,QAAA,IAAI,QAAA,EAAU;AACZ,UAAA,QAAA,CAAS,KAAK,CAAA;AAAA,QAChB;AACA,QAAA,iBAAA,CAAkB,KAAA,EAAM;AAAA,MAC1B,CAAA;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,IAAA,CAAC,wBAAA,EAAA,EACC,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,SAAA,EAAA,EAAU,UAAA,EAAY,KAAA,CAAM,UAAA,EAAY,CAAA;AAAA,0BACzC,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,iBAAA,EAC1B,QAAA,EACH,CAAA;AAAA,0BACA,GAAA;AAAA,YAAC,OAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAU,YAAA;AAAA,cACV,eAAA,EAAe,IAAA;AAAA,cACf,UAAA,EAAY,iBAAA;AAAA,cAEZ,8BAAC,QAAA,EAAA,EAAS;AAAA;AAAA;AACZ,SAAA,EACF,CAAA;AAAA,4BACC,cAAA,EAAA,EAAe;AAAA;AAAA;AAAA,GAClB;AAEJ,CAAC;;;;"}
|
|
@@ -18,7 +18,12 @@ import { useFieldComponent } from '../../lib/hooks/useFieldComponent.mjs';
|
|
|
18
18
|
|
|
19
19
|
const DateRangePicker = flowComponent("DateRangePicker", (props) => {
|
|
20
20
|
const { children, className, onChange, ref, ...rest } = props;
|
|
21
|
-
const {
|
|
21
|
+
const {
|
|
22
|
+
FieldErrorView,
|
|
23
|
+
FieldErrorCaptureContext,
|
|
24
|
+
fieldProps,
|
|
25
|
+
fieldPropsContext
|
|
26
|
+
} = useFieldComponent(props);
|
|
22
27
|
const rootClassName = clsx(fieldProps.className, className);
|
|
23
28
|
const popoverController = useOverlayController("Popover");
|
|
24
29
|
const localDateRangePickerRef = useObjectRef(ref);
|
|
@@ -38,17 +43,19 @@ const DateRangePicker = flowComponent("DateRangePicker", (props) => {
|
|
|
38
43
|
popoverController.close();
|
|
39
44
|
},
|
|
40
45
|
children: [
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
/* @__PURE__ */ jsxs(FieldErrorCaptureContext, { children: [
|
|
47
|
+
/* @__PURE__ */ jsx(DateRangeInput, { isDisabled: props.isDisabled }),
|
|
48
|
+
/* @__PURE__ */ jsx(PropsContextProvider, { props: fieldPropsContext, children }),
|
|
49
|
+
/* @__PURE__ */ jsx(
|
|
50
|
+
Popover,
|
|
51
|
+
{
|
|
52
|
+
placement: "bottom end",
|
|
53
|
+
isDialogContent: true,
|
|
54
|
+
controller: popoverController,
|
|
55
|
+
children: /* @__PURE__ */ jsx(RangeCalendar, {})
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
] }),
|
|
52
59
|
/* @__PURE__ */ jsx(FieldErrorView, {})
|
|
53
60
|
]
|
|
54
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangePicker.mjs","sources":["../../../../../../src/components/DateRangePicker/DateRangePicker.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport clsx from \"clsx\";\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 { 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\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\n\nexport interface DateRangePickerProps<T extends Aria.DateValue = Aria.DateValue>\n extends PropsWithChildren<Omit<Aria.DateRangePickerProps<T>, \"children\">>,\n FlowComponentProps {}\n\n/** @flr-generate all */\nexport const DateRangePicker = flowComponent(\"DateRangePicker\", (props) => {\n const { children, className, onChange, ref, ...rest } = props;\n\n const {
|
|
1
|
+
{"version":3,"file":"DateRangePicker.mjs","sources":["../../../../../../src/components/DateRangePicker/DateRangePicker.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport clsx from \"clsx\";\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 { 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\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\n\nexport interface DateRangePickerProps<T extends Aria.DateValue = Aria.DateValue>\n extends PropsWithChildren<Omit<Aria.DateRangePickerProps<T>, \"children\">>,\n FlowComponentProps {}\n\n/** @flr-generate all */\nexport const DateRangePicker = flowComponent(\"DateRangePicker\", (props) => {\n const { children, className, onChange, ref, ...rest } = props;\n\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldProps,\n fieldPropsContext,\n } = useFieldComponent(props);\n\n const rootClassName = clsx(fieldProps.className, className);\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 <FieldErrorCaptureContext>\n <DateRangeInput isDisabled={props.isDisabled} />\n <PropsContextProvider props={fieldPropsContext}>\n {children}\n </PropsContextProvider>\n <Popover\n placement=\"bottom end\"\n isDialogContent\n controller={popoverController}\n >\n <RangeCalendar />\n </Popover>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </Aria.DateRangePic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AAO,iBAAA,EAC1B,QAAA,EACH,CAAA;AAAA,0BACA,GAAA;AAAA,YAAC,OAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAU,YAAA;AAAA,cACV,eAAA,EAAe,IAAA;AAAA,cACf,UAAA,EAAY,iBAAA;AAAA,cAEZ,8BAAC,aAAA,EAAA,EAAc;AAAA;AAAA;AACjB,SAAA,EACF,CAAA;AAAA,4BACC,cAAA,EAAA,EAAe;AAAA;AAAA;AAAA,GAClB;AAEJ,CAAC;;;;"}
|
|
@@ -11,42 +11,43 @@ import '../Icon/Icon.mjs';
|
|
|
11
11
|
import '../../views/IconView.mjs';
|
|
12
12
|
import { IconDanger } from '../Icon/components/icons/IconDanger.mjs';
|
|
13
13
|
import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
|
|
14
|
-
import { onlyText } from 'react-children-utilities';
|
|
15
14
|
|
|
16
15
|
const FieldError = flowComponent("FieldError", (props) => {
|
|
17
16
|
const { children, className, ref, ...rest } = props;
|
|
18
17
|
const rootClassName = clsx(styles.fieldError, className);
|
|
19
18
|
const fieldErrorFromAriaContext = useContext(FieldErrorContext);
|
|
19
|
+
const isInvalidFromChildren = React.Children.count(children) >= 1;
|
|
20
20
|
const mergedErrorState = useMemo(() => {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return fieldErrorFromAriaContext;
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
isInvalid: true,
|
|
28
|
-
validationErrors: [textChildren],
|
|
29
|
-
validationDetails: {
|
|
30
|
-
valid: false,
|
|
31
|
-
badInput: false,
|
|
32
|
-
customError: true,
|
|
33
|
-
patternMismatch: false,
|
|
34
|
-
rangeOverflow: false,
|
|
35
|
-
rangeUnderflow: false,
|
|
36
|
-
stepMismatch: false,
|
|
37
|
-
tooLong: false,
|
|
38
|
-
tooShort: false,
|
|
39
|
-
valueMissing: false,
|
|
40
|
-
typeMismatch: false
|
|
41
|
-
}
|
|
42
|
-
};
|
|
21
|
+
const errors = fieldErrorFromAriaContext?.validationErrors ?? [];
|
|
22
|
+
if (isInvalidFromChildren) {
|
|
23
|
+
errors.push(children);
|
|
43
24
|
}
|
|
44
|
-
|
|
25
|
+
const isInvalid = !!(isInvalidFromChildren || fieldErrorFromAriaContext?.isInvalid);
|
|
26
|
+
const lastError = errors.length >= 1 ? errors[errors.length - 1] : void 0;
|
|
27
|
+
return {
|
|
28
|
+
isInvalid,
|
|
29
|
+
validationDetails: {
|
|
30
|
+
valid: !isInvalid,
|
|
31
|
+
badInput: false,
|
|
32
|
+
customError: isInvalid,
|
|
33
|
+
patternMismatch: false,
|
|
34
|
+
rangeOverflow: false,
|
|
35
|
+
rangeUnderflow: false,
|
|
36
|
+
stepMismatch: false,
|
|
37
|
+
tooLong: false,
|
|
38
|
+
tooShort: false,
|
|
39
|
+
valueMissing: false,
|
|
40
|
+
typeMismatch: false,
|
|
41
|
+
...fieldErrorFromAriaContext?.validationDetails
|
|
42
|
+
},
|
|
43
|
+
...fieldErrorFromAriaContext,
|
|
44
|
+
validationErrors: lastError ? [lastError] : []
|
|
45
|
+
};
|
|
45
46
|
}, [fieldErrorFromAriaContext, children]);
|
|
46
47
|
return /* @__PURE__ */ jsx(FieldErrorContext, { value: mergedErrorState, children: /* @__PURE__ */ jsx(Aria.FieldError, { ref, ...rest, className: rootClassName, children: ({ validationErrors }) => {
|
|
47
48
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
49
|
/* @__PURE__ */ jsx(IconDanger, { size: "s" }),
|
|
49
|
-
/* @__PURE__ */ jsx("span", { children: validationErrors
|
|
50
|
+
/* @__PURE__ */ jsx("span", { children: validationErrors })
|
|
50
51
|
] });
|
|
51
52
|
} }) });
|
|
52
53
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldError.mjs","sources":["../../../../../../src/components/FieldError/FieldError.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"FieldError.mjs","sources":["../../../../../../src/components/FieldError/FieldError.tsx"],"sourcesContent":["import {\n type PropsWithChildren,\n type ReactNode,\n useContext,\n useMemo,\n} from \"react\";\nimport React from \"react\";\nimport styles from \"./FieldError.module.scss\";\nimport * as Aria from \"react-aria-components\";\nimport clsx from \"clsx\";\nimport { IconDanger } from \"@/components/Icon/components/icons\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { FieldErrorContext } from \"react-aria-components\";\n\nexport interface FieldErrorProps\n extends PropsWithChildren<Omit<Aria.FieldErrorProps, \"children\">>,\n FlowComponentProps {}\n\n/** @flr-generate all */\nexport const FieldError = flowComponent(\"FieldError\", (props) => {\n const { children, className, ref, ...rest } = props;\n\n const rootClassName = clsx(styles.fieldError, className);\n const fieldErrorFromAriaContext = useContext(FieldErrorContext);\n const isInvalidFromChildren = React.Children.count(children) >= 1;\n\n const mergedErrorState = useMemo(() => {\n const errors: (string | ReactNode)[] =\n fieldErrorFromAriaContext?.validationErrors ?? [];\n\n if (isInvalidFromChildren) {\n errors.push(children);\n }\n\n const isInvalid = !!(\n isInvalidFromChildren || fieldErrorFromAriaContext?.isInvalid\n );\n const lastError =\n errors.length >= 1 ? errors[errors.length - 1] : undefined;\n\n return {\n isInvalid: isInvalid,\n validationDetails: {\n valid: !isInvalid,\n badInput: false,\n customError: isInvalid,\n patternMismatch: false,\n rangeOverflow: false,\n rangeUnderflow: false,\n stepMismatch: false,\n tooLong: false,\n tooShort: false,\n valueMissing: false,\n typeMismatch: false,\n ...fieldErrorFromAriaContext?.validationDetails,\n },\n ...fieldErrorFromAriaContext,\n validationErrors: lastError ? [lastError] : [],\n };\n }, [fieldErrorFromAriaContext, children]);\n\n return (\n <FieldErrorContext value={mergedErrorState as never}>\n <Aria.FieldError ref={ref} {...rest} className={rootClassName}>\n {({ validationErrors }) => {\n return (\n <>\n <IconDanger size=\"s\" />\n <span>{validationErrors}</span>\n </>\n );\n }}\n </Aria.Fie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AA;AAAA,QACd,GAAG,yBAAA,EAA2B;AAAA,OAChC;AAAA,MACA,GAAG,yBAAA;AAAA,MACH,gBAAA,EAAkB,SAAA,GAAY,CAAC,SAAS,IAAI;AAAC,KAC/C;AAAA,EACF,CAAA,EAAG,CAAC,yBAAA,EAA2B,QAAQ,CAAC,CAAA;AAExC,EAAA,2BACG,iBAAA,EAAA,EAAkB,KAAA,EAAO,gBAAA,EACxB,QAAA,kBAAA,GAAA,CAAC,KAAK,UAAA,EAAL,EAAgB,GAAA,EAAW,GAAG,MAAM,SAAA,EAAW,aAAA,EAC7C,QAAA,EAAA,CAAC,EAAE,kBAAiB,KAAM;AACzB,IAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,MAAK,GAAA,EAAI,CAAA;AAAA,sBACrB,GAAA,CAAC,UAAM,QAAA,EAAA,gBAAA,EAAiB;AAAA,KAAA,EAC1B,CAAA;AAAA,EAEJ,GACF,CAAA,EACF,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -27,7 +27,7 @@ const FileDropZone = flowComponent(
|
|
|
27
27
|
} = props;
|
|
28
28
|
const {
|
|
29
29
|
FieldErrorView,
|
|
30
|
-
|
|
30
|
+
FieldErrorCaptureContext,
|
|
31
31
|
fieldProps,
|
|
32
32
|
fieldPropsContext
|
|
33
33
|
} = useFieldComponent(props);
|
|
@@ -82,7 +82,7 @@ const FileDropZone = flowComponent(
|
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
return /* @__PURE__ */ jsxs("div", { ...fieldProps, children: [
|
|
85
|
-
/* @__PURE__ */ jsx(
|
|
85
|
+
/* @__PURE__ */ jsx(FieldErrorCaptureContext, { children: /* @__PURE__ */ jsx(PropsContextProvider, { props: propsContext, children: /* @__PURE__ */ jsx(
|
|
86
86
|
Aria.DropZone,
|
|
87
87
|
{
|
|
88
88
|
className: rootClassName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileDropZone.mjs","sources":["../../../../../../src/components/FileDropZone/FileDropZone.tsx"],"sourcesContent":["import { type FC, type PropsWithChildren, useRef } 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\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\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 {\n FieldErrorView,\n
|
|
1
|
+
{"version":3,"file":"FileDropZone.mjs","sources":["../../../../../../src/components/FileDropZone/FileDropZone.tsx"],"sourcesContent":["import { type FC, type PropsWithChildren, useRef } 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\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\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 {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldProps,\n fieldPropsContext,\n } = useFieldComponent(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 ...fieldPropsContext,\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 <div {...fieldProps}>\n <FieldErrorCaptureContext>\n <PropsContextProvider props={propsContext}>\n <Aria.DropZone\n className={rootClassName}\n onDrop={onDropHandler}\n isDisabled={isDisabled}\n data-readonly={isReadOnly}\n >\n <IllustratedMessage color=\"dark\">{children}</IllustratedMessage>\n </Aria.DropZone>\n </PropsContextProvider>\n </FieldErrorCaptureContext>\n <FieldErrorView />\n </div>\n );\n },\n);\n\nexport default FileDropZone;\n"],"names":[],"mappings":";;;;;;;;;;;;AA6BO,MAAM,YAAA,GAAsC,aAAA;AAAA,EACjD,cAAA;AAAA,EACA,CAAC,KAAA,KAAU;AACT,IAAA,MAAM;AAAA,MACJ,QAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAA,EAAU,gBAAA;AAAA,MACV,QAAA;AAAA,MACA,IAAA;AAAA,MACA,UAAA;AAAA,MACA;AAAA,KACF,GAAI,KAAA;AAEJ,IAAA,MAAM;AAAA,MACJ,cAAA;AAAA,MACA,wBAAA;AAAA,MACA,UAAA;AAAA,MACA;AAAA,KACF,GAAI,kBAAkB,KAAK,CAAA;AAE3B,IAAA,MAAM,YAAA,GAAe,OAAyB,IAAI,CAAA;AAClD,IAAA,MAAM,aAAA,GAAgB,IAAA;AAAA,MACpB,MAAA,CAAO,YAAA;AAAA,MACP,cAAc,MAAA,CAAO,QAAA;AAAA,MACrB;AAAA,KACF;AAEA,IAAA,MAAM,YAAA,GAA6B;AAAA,MACjC,GAAG,iBAAA;AAAA,MACH,SAAA,EAAW;AAAA,QACT,IAAA;AAAA,QACA,QAAA,EAAU,gBAAA;AAAA,QACV,GAAA,EAAK,YAAA;AAAA,QACL,MAAA;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A,GAAmB,aAAa,KAAK,CAAA;AACrC,QAAA,IAAI,aAAa,OAAA,EAAS;AACxB,UAAA,YAAA,CAAa,OAAA,CAAQ,QAAQ,YAAA,CAAa,KAAA;AAAA,QAC5C;AAAA,MACF;AAAA,IACF,CAAA;AAEA,IAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAK,GAAG,UAAA,EACP,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,wBAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,oBAAA,EAAA,EAAqB,KAAA,EAAO,YAAA,EAC3B,QAAA,kBAAA,GAAA;AAAA,QAAC,IAAA,CAAK,QAAA;AAAA,QAAL;AAAA,UACC,SAAA,EAAW,aAAA;AAAA,UACX,MAAA,EAAQ,aAAA;AAAA,UACR,UAAA;AAAA,UACA,eAAA,EAAe,UAAA;AAAA,UAEf,QAAA,kBAAA,GAAA,CAAC,kBAAA,EAAA,EAAmB,KAAA,EAAM,MAAA,EAAQ,QAAA,EAAS;AAAA;AAAA,SAE/C,CAAA,EACF,CAAA;AAAA,0BACC,cAAA,EAAA,EAAe;AAAA,KAAA,EAClB,CAAA;AAAA,EAEJ;AACF;;;;"}
|
|
@@ -27,7 +27,7 @@ const FileField = flowComponent("FileField", (props) => {
|
|
|
27
27
|
} = props;
|
|
28
28
|
const {
|
|
29
29
|
FieldErrorView,
|
|
30
|
-
|
|
30
|
+
FieldErrorCaptureContext,
|
|
31
31
|
fieldProps,
|
|
32
32
|
fieldPropsContext
|
|
33
33
|
} = useFieldComponent(props);
|
|
@@ -56,7 +56,7 @@ const FileField = flowComponent("FileField", (props) => {
|
|
|
56
56
|
{
|
|
57
57
|
value: formValidationState.displayValidation,
|
|
58
58
|
children: [
|
|
59
|
-
/* @__PURE__ */ jsx(
|
|
59
|
+
/* @__PURE__ */ jsx(FieldErrorCaptureContext, { children: /* @__PURE__ */ jsx(PropsContextProvider, { props: fieldPropsContext, children: /* @__PURE__ */ jsx(
|
|
60
60
|
"div",
|
|
61
61
|
{
|
|
62
62
|
"data-readonly": isReadOnly,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileField.mjs","sources":["../../../../../../src/components/FileField/FileField.tsx"],"sourcesContent":["import { 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 { PropsContextProvider } from \"@/lib/propsContext\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { addAwaitedArrayBuffer } from \"@mittwald/flow-core\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\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\n const {\n FieldErrorView,\n
|
|
1
|
+
{"version":3,"file":"FileField.mjs","sources":["../../../../../../src/components/FileField/FileField.tsx"],"sourcesContent":["import { 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 { PropsContextProvider } from \"@/lib/propsContext\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { addAwaitedArrayBuffer } from \"@mittwald/flow-core\";\nimport { useMakeFocusable } from \"@/lib/hooks/dom/useMakeFocusable\";\nimport { useFieldComponent } from \"@/lib/hooks/useFieldComponent\";\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\n const {\n FieldErrorView,\n FieldErrorCaptureContext,\n fieldProps,\n fieldPropsContext,\n } = useFieldComponent(props);\n\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 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 <div {...fieldProps}>\n <InputContext.Provider value={inputProps}>\n <FieldErrorContext.Provider\n value={formValidationState.displayValidation}\n >\n <FieldErrorCaptureContext>\n <PropsContextProvider props={fieldPropsContext}>\n <div\n data-readonly={isReadOnly}\n data-required={!!isRequired || undefined}\n data-invalid={\n formValidationState.displayValidation.isInvalid || undefined\n }\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 </FieldErrorCaptureContext>\n <FieldErrorView />\n </FieldErrorContext.Provider>\n </InputContext.Provider>\n </div>\n );\n});\nexport default FileField;\n"],"names":[],"mappings":";;;;;;;;;;;;;AA8BO,MAAM,SAAA,GAAY,aAAA,CAAc,WAAA,EAAa,CAAC,KAAA,KAAU;AAC7D,EAAA,MAAM;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,GAAG;AAAA,GACL,GAAI,KAAA;AAEJ,EAAA,MAAM;AAAA,IACJ,cAAA;AAAA,IACA,wBAAA;AAAA,IACA,UAAA;AAAA,IACA;AAAA,GACF,GAAI,kBAAkB,KAAK,CAAA;AAE3B,EAAA,MAAM,QAAA,GAAW,aAAa,GAAG,CAAA;AAEjC,EAAA,MAAM,sBAAsB,sBAAA,CAAuB;AAAA,IACjD,KAAA,EAAO,MAAA;AAAA,IACP,kBAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,iBAAA,CAAkB,EAAE,kBAAA,EAAmB,EAAG,mBAAA,EAAqB,QAAQ,CAAA;AAEvE,EAAA,MAAM,UAAA,GAAa;AAAA,IACjB,GAAG,cAAA;AAAA,IACH,cAAA,EAAgB,oBAAoB,iBAAA,CAAkB,SAAA;AAAA,IACtD,KAAA,EAAO;AAAA,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