@mittwald/flow-react-components 0.2.0-alpha.353 → 0.2.0-alpha.355
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 +8 -0
- package/dist/assets/doc-properties.json +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/CopyButton/CopyButton.mjs +1 -1
- package/dist/js/components/src/components/CopyButton/CopyButton.mjs.map +1 -1
- package/dist/js/components/src/components/PasswordCreationField/PasswordCreationField.mjs +44 -33
- package/dist/js/components/src/components/PasswordCreationField/PasswordCreationField.mjs.map +1 -1
- package/dist/js/components/src/components/SearchField/SearchField.mjs +12 -4
- package/dist/js/components/src/components/SearchField/SearchField.mjs.map +1 -1
- package/dist/js/components/src/components/TextArea/TextArea.mjs +3 -4
- package/dist/js/components/src/components/TextArea/TextArea.mjs.map +1 -1
- package/dist/js/components/src/lib/promises/useAbortablePromise.mjs +5 -5
- package/dist/js/components/src/lib/promises/useAbortablePromise.mjs.map +1 -1
- package/dist/js/components/src/lib/react/ReactAriaControlledValueFix.mjs +18 -15
- package/dist/js/components/src/lib/react/ReactAriaControlledValueFix.mjs.map +1 -1
- package/dist/types/components/CopyButton/CopyButton.d.ts +1 -1
- package/dist/types/components/CopyButton/CopyButton.d.ts.map +1 -1
- package/dist/types/components/PasswordCreationField/PasswordCreationField.d.ts.map +1 -1
- package/dist/types/components/SearchField/SearchField.d.ts.map +1 -1
- package/dist/types/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/types/lib/promises/useAbortablePromise.d.ts +1 -5
- package/dist/types/lib/promises/useAbortablePromise.d.ts.map +1 -1
- package/dist/types/lib/react/ReactAriaControlledValueFix.d.ts.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.2.0-alpha.355](https://github.com/mittwald/flow/compare/0.2.0-alpha.354...0.2.0-alpha.355) (2025-07-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @mittwald/flow-react-components
|
|
9
|
+
|
|
10
|
+
# [0.2.0-alpha.354](https://github.com/mittwald/flow/compare/0.2.0-alpha.353...0.2.0-alpha.354) (2025-07-22)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @mittwald/flow-react-components
|
|
13
|
+
|
|
6
14
|
# [0.2.0-alpha.353](https://github.com/mittwald/flow/compare/0.2.0-alpha.352...0.2.0-alpha.353) (2025-07-22)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @mittwald/flow-react-components
|
|
@@ -153016,7 +153016,7 @@
|
|
|
153016
153016
|
"name": "CopyButtonProps"
|
|
153017
153017
|
}
|
|
153018
153018
|
],
|
|
153019
|
-
"required":
|
|
153019
|
+
"required": false,
|
|
153020
153020
|
"type": {
|
|
153021
153021
|
"name": "string"
|
|
153022
153022
|
}
|
|
@@ -45,11 +45,11 @@ const Autocomplete = flowComponent("Autocomplete", (props) => {
|
|
|
45
45
|
const input = triggerRef.current;
|
|
46
46
|
if (input) {
|
|
47
47
|
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
|
|
48
|
-
|
|
48
|
+
Object.getPrototypeOf(input),
|
|
49
49
|
"value"
|
|
50
50
|
)?.set;
|
|
51
51
|
nativeInputValueSetter?.call(input, String(key));
|
|
52
|
-
const event = new Event("
|
|
52
|
+
const event = new Event("change", { bubbles: true });
|
|
53
53
|
input.dispatchEvent(event);
|
|
54
54
|
}
|
|
55
55
|
},
|
|
@@ -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 {\n UNSAFE_PortalProvider,\n useFocusWithin,\n useLocalizedStringFormatter,\n} from \"react-aria\";\nimport styles from \"./Autocomplete.module.scss\";\nimport locales from \"./locales/*.locale.json\";\nimport { Text } from \"@/components/Text\";\nimport type { SearchFieldProps } from \"@/components/SearchField\";\nimport type { TextFieldProps } from \"@/components/TextField\";\n\nexport interface AutocompleteProps\n extends PropsWithChildren,\n PropsWithClassName,\n FlowComponentProps,\n Omit<Aria.AutocompleteProps, \"children\" | \"onInputChange\" | \"inputValue\"> {}\n\n/** @flr-generate all */\nexport const Autocomplete = flowComponent(\"Autocomplete\", (props) => {\n const { children, ...rest } = props;\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const { contains } = Aria.useFilter({ sensitivity: \"base\" });\n\n const triggerRef = useRef<HTMLInputElement>(null);\n const container = useRef(null);\n\n const controller = useOverlayController(\"ContextMenu\", {\n reuseControllerFromContext: false,\n });\n const focusWithin = useFocusWithin({\n onBlurWithin: controller.close,\n });\n const menuIsOpen = controller.useIsOpen();\n\n const inputProps: SearchFieldProps & TextFieldProps = {\n onKeyDown: (e) => {\n if (e.key === \"Enter\" && menuIsOpen) {\n e.preventDefault();\n }\n },\n ref: triggerRef,\n };\n\n const propsContext: PropsContext = {\n ContextMenu: {\n placement: \"bottom start\",\n controller,\n isNonModal: true,\n renderEmptyState: () => (\n <Text className={styles.empty}>\n {stringFormatter.format(\"autocomplete.empty\")}\n </Text>\n ),\n onAction: (key) => {\n const input = triggerRef.current;\n if (input) {\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(\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 {\n UNSAFE_PortalProvider,\n useFocusWithin,\n useLocalizedStringFormatter,\n} from \"react-aria\";\nimport styles from \"./Autocomplete.module.scss\";\nimport locales from \"./locales/*.locale.json\";\nimport { Text } from \"@/components/Text\";\nimport type { SearchFieldProps } from \"@/components/SearchField\";\nimport type { TextFieldProps } from \"@/components/TextField\";\n\nexport interface AutocompleteProps\n extends PropsWithChildren,\n PropsWithClassName,\n FlowComponentProps,\n Omit<Aria.AutocompleteProps, \"children\" | \"onInputChange\" | \"inputValue\"> {}\n\n/** @flr-generate all */\nexport const Autocomplete = flowComponent(\"Autocomplete\", (props) => {\n const { children, ...rest } = props;\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const { contains } = Aria.useFilter({ sensitivity: \"base\" });\n\n const triggerRef = useRef<HTMLInputElement>(null);\n const container = useRef(null);\n\n const controller = useOverlayController(\"ContextMenu\", {\n reuseControllerFromContext: false,\n });\n const focusWithin = useFocusWithin({\n onBlurWithin: controller.close,\n });\n const menuIsOpen = controller.useIsOpen();\n\n const inputProps: SearchFieldProps & TextFieldProps = {\n onKeyDown: (e) => {\n if (e.key === \"Enter\" && menuIsOpen) {\n e.preventDefault();\n }\n },\n ref: triggerRef,\n };\n\n const propsContext: PropsContext = {\n ContextMenu: {\n placement: \"bottom start\",\n controller,\n isNonModal: true,\n renderEmptyState: () => (\n <Text className={styles.empty}>\n {stringFormatter.format(\"autocomplete.empty\")}\n </Text>\n ),\n onAction: (key) => {\n const input = triggerRef.current;\n if (input) {\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(\n Object.getPrototypeOf(input),\n \"value\",\n )?.set;\n nativeInputValueSetter?.call(input, String(key));\n const event = new Event(\"change\", { bubbles: true });\n input.dispatchEvent(event);\n }\n },\n triggerRef,\n },\n SearchField: inputProps,\n TextField: inputProps,\n };\n\n const handleOnInputChange = (value: string) => {\n if (!value) {\n controller.close();\n } else if (!menuIsOpen) {\n controller.open();\n }\n };\n\n return (\n <PropsContextProvider\n props={propsContext}\n mergeInParentContext\n dependencies={[menuIsOpen, controller]}\n >\n <div {...focusWithin.focusWithinProps} ref={container}>\n <UNSAFE_PortalProvider getContainer={() => container.current}>\n <Aria.Autocomplete\n onInputChange={handleOnInputChange}\n filter={contains}\n {...rest}\n >\n {children}\n </Aria.Autocomplete>\n </UNSAFE_PortalProvider>\n </div>\n </PropsContextProvider>\n );\n});\n\nexport default Autocomplete;\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA2BO,MAAM,YAAe,GAAA,aAAA,CAAc,cAAgB,EAAA,CAAC,KAAU,KAAA;AACnE,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,IAAA,EAAS,GAAA,KAAA;AAC9B,EAAM,MAAA,eAAA,GAAkB,4BAA4B,OAAO,CAAA;AAE3D,EAAM,MAAA,EAAE,UAAa,GAAA,IAAA,CAAK,UAAU,EAAE,WAAA,EAAa,QAAQ,CAAA;AAE3D,EAAM,MAAA,UAAA,GAAa,OAAyB,IAAI,CAAA;AAChD,EAAM,MAAA,SAAA,GAAY,OAAO,IAAI,CAAA;AAE7B,EAAM,MAAA,UAAA,GAAa,qBAAqB,aAAe,EAAA;AAAA,IACrD,0BAA4B,EAAA;AAAA,GAC7B,CAAA;AACD,EAAA,MAAM,cAAc,cAAe,CAAA;AAAA,IACjC,cAAc,UAAW,CAAA;AAAA,GAC1B,CAAA;AACD,EAAM,MAAA,UAAA,GAAa,WAAW,SAAU,EAAA;AAExC,EAAA,MAAM,UAAgD,GAAA;AAAA,IACpD,SAAA,EAAW,CAAC,CAAM,KAAA;AAChB,MAAI,IAAA,CAAA,CAAE,GAAQ,KAAA,OA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EAAA,YAAA;AAAA,MACP,oBAAoB,EAAA,IAAA;AAAA,MACpB,YAAA,EAAc,CAAC,UAAA,EAAY,UAAU,CAAA;AAAA,MAErC,QAAC,kBAAA,GAAA,CAAA,KAAA,EAAA,EAAK,GAAG,WAAA,CAAY,gBAAkB,EAAA,GAAA,EAAK,SAC1C,EAAA,QAAA,kBAAA,GAAA,CAAC,qBAAsB,EAAA,EAAA,YAAA,EAAc,MAAM,SAAA,CAAU,OACnD,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,IAAK,CAAA,YAAA;AAAA,QAAL;AAAA,UACC,aAAe,EAAA,mBAAA;AAAA,UACf,MAAQ,EAAA,QAAA;AAAA,UACP,GAAG,IAAA;AAAA,UAEH;AAAA;AAAA,SAEL,CACF,EAAA;AAAA;AAAA,GACF;AAEJ,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyButton.mjs","sources":["../../../../../../src/components/CopyButton/CopyButton.tsx"],"sourcesContent":["import copy from \"copy-to-clipboard\";\nimport type { ButtonProps } from \"@/components/Button\";\nimport { Button } from \"@/components/Button\";\nimport { IconCopy } from \"@/components/Icon/components/icons\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport { Tooltip, TooltipTrigger } from \"@/components/Tooltip\";\nimport { onlyText } from \"react-children-utilities\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { Action } from \"@/components/Action\";\n\nexport interface CopyButtonProps\n extends Omit<ButtonProps, \"onPress\" | \"aria-label\" | \"render\">,\n FlowComponentProps<HTMLButtonElement> {\n /** The text to copy. */\n text
|
|
1
|
+
{"version":3,"file":"CopyButton.mjs","sources":["../../../../../../src/components/CopyButton/CopyButton.tsx"],"sourcesContent":["import copy from \"copy-to-clipboard\";\nimport type { ButtonProps } from \"@/components/Button\";\nimport { Button } from \"@/components/Button\";\nimport { IconCopy } from \"@/components/Icon/components/icons\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport { Tooltip, TooltipTrigger } from \"@/components/Tooltip\";\nimport { onlyText } from \"react-children-utilities\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { Action } from \"@/components/Action\";\n\nexport interface CopyButtonProps\n extends Omit<ButtonProps, \"onPress\" | \"aria-label\" | \"render\">,\n FlowComponentProps<HTMLButtonElement> {\n /** The text to copy. */\n text?: string;\n}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const CopyButton = flowComponent(\"CopyButton\", (props) => {\n const {\n text = \"\",\n ref,\n variant = \"plain\",\n color = \"secondary\",\n ...buttonProps\n } = props;\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const tooltip = stringFormatter.format(\"copyButton.copy\");\n\n const copyValue = () => {\n copy(onlyText(text));\n };\n\n return (\n <ClearPropsContext>\n <TooltipTrigger>\n <Action action={copyValue} showFeedback>\n <Button\n aria-label={tooltip}\n {...buttonProps}\n ref={ref}\n variant={variant}\n color={color}\n >\n <IconCopy />\n </Button>\n </Action>\n <Tooltip>{tooltip}</Tooltip>\n </TooltipTrigger>\n </ClearPropsContext>\n );\n});\n\nexport default CopyButton;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAwBO,MAAM,UAAa,GAAA,aAAA,CAAc,YAAc,EAAA,CAAC,KAAU,KAAA;AAC/D,EAAM,MAAA;AAAA,IACJ,IAAO,GAAA,EAAA;AAAA,IACP,GAAA;AAAA,IACA,OAAU,GAAA,OAAA;AAAA,IACV,KAAQ,GAAA,WAAA;AAAA,IACR,GAAG;AAAA,GACD,GAAA,KAAA;AAEJ,EAAM,MAAA,eAAA,GAAkB,4BAA4B,OAAO,CAAA;AAE3D,EAAM,MAAA,OAAA,GAAU,eAAgB,CAAA,MAAA,CAAO,iBAAiB,CAAA;AAExD,EAAA,MAAM,YAAY,MAAM;AACtB,IAAK,IAAA,CAAA,QAAA,CAAS,IAAI,CAAC,CAAA;AAAA,GACrB;AAEA,EACE,uBAAA,GAAA,CAAC,iBACC,EAAA,EAAA,QAAA,kBAAA,IAAA,CAAC,cACC,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,MAAO,EAAA,EAAA,MAAA,EAAQ,SAAW,EAAA,YAAA,EAAY,IACrC,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,YAAY,EAAA,OAAA;AAAA,QACX,GAAG,WAAA;AAAA,QACJ,GAAA;AAAA,QACA,OAAA;AAAA,QACA,KAAA;AAAA,QAEA,8BAAC,QAAS,EAAA,EAAA;AAAA;AAAA,KAEd,EAAA,CAAA;AAAA,oBACA,GAAA,CAAC,WAAS,QAAQ,EAAA,OAAA,EAAA;AAAA,GAAA,EACpB,CACF,EAAA,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
|
-
import { useState,
|
|
4
|
+
import { useState, useDeferredValue } from 'react';
|
|
5
5
|
import { ClearPropsContext } from '../ClearPropsContext/ClearPropsContext.mjs';
|
|
6
6
|
import '../../lib/propsContext/propsContext.mjs';
|
|
7
7
|
import { dynamic } from '../../lib/propsContext/dynamicProps/dynamic.mjs';
|
|
@@ -22,7 +22,6 @@ import { FieldDescription } from '../FieldDescription/FieldDescription.mjs';
|
|
|
22
22
|
import { ComplexityIndicator } from './components/ComplexityIndicator/ComplexityIndicator.mjs';
|
|
23
23
|
import '@mittwald/password-tools-js/policy';
|
|
24
24
|
import '@mittwald/password-tools-js/rules';
|
|
25
|
-
import { useDebounceValue } from 'usehooks-ts';
|
|
26
25
|
import { generatePassword } from './worker/generatePassword.mjs';
|
|
27
26
|
import { TogglePasswordVisibilityButton } from './components/TogglePasswordVisibilityButton/TogglePasswordVisibilityButton.mjs';
|
|
28
27
|
import { useAbortablePromise } from '../../lib/promises/useAbortablePromise.mjs';
|
|
@@ -33,12 +32,11 @@ import 'mobx';
|
|
|
33
32
|
import '../../lib/controller/overlay/context.mjs';
|
|
34
33
|
import { useIsMounted } from '../../lib/hooks/useIsMounted.mjs';
|
|
35
34
|
import '@react-aria/utils';
|
|
36
|
-
import 'remeda';
|
|
35
|
+
import { isPromise } from 'remeda';
|
|
37
36
|
import { ValidationResultButton } from './components/ValidationResultButton/ValidationResultButton.mjs';
|
|
38
37
|
import { PasswordGenerateButton } from './components/PasswordGenerateButton/PasswordGenerateButton.mjs';
|
|
39
38
|
import { useLocalizedContextStringFormatter } from '../TranslationProvider/useLocalizedContextStringFormatter.mjs';
|
|
40
39
|
|
|
41
|
-
const validationDebounceMilliseconds = 200;
|
|
42
40
|
const PasswordCreationField = flowComponent(
|
|
43
41
|
"PasswordCreationField",
|
|
44
42
|
(props) => {
|
|
@@ -47,13 +45,30 @@ const PasswordCreationField = flowComponent(
|
|
|
47
45
|
className,
|
|
48
46
|
ref,
|
|
49
47
|
isDisabled,
|
|
50
|
-
onChange,
|
|
48
|
+
onChange: onChangeFromProps,
|
|
51
49
|
isInvalid: invalidFromProps,
|
|
52
50
|
validationPolicy = defaultPasswordCreationPolicy,
|
|
53
51
|
isRequired,
|
|
54
|
-
value,
|
|
52
|
+
value: valueFromProps,
|
|
53
|
+
defaultValue,
|
|
55
54
|
...rest
|
|
56
55
|
} = props;
|
|
56
|
+
const isControlled = typeof valueFromProps !== "undefined";
|
|
57
|
+
const hasDefaultValue = typeof defaultValue !== "undefined";
|
|
58
|
+
const [internalValue, setInternalValue] = useState(
|
|
59
|
+
hasDefaultValue ? defaultValue : ""
|
|
60
|
+
);
|
|
61
|
+
const deferredValue = useDeferredValue(
|
|
62
|
+
internalValue,
|
|
63
|
+
hasDefaultValue ? defaultValue : ""
|
|
64
|
+
);
|
|
65
|
+
const value = isControlled ? valueFromProps : internalValue;
|
|
66
|
+
const onChangeHandler = (value2) => {
|
|
67
|
+
if (onChangeFromProps) {
|
|
68
|
+
onChangeFromProps(value2);
|
|
69
|
+
}
|
|
70
|
+
setInternalValue(() => value2);
|
|
71
|
+
};
|
|
57
72
|
const translate = useLocalizedContextStringFormatter(locales);
|
|
58
73
|
const [isPasswordRevealed, setIsPasswordRevealed] = useState(false);
|
|
59
74
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -82,31 +97,24 @@ const PasswordCreationField = flowComponent(
|
|
|
82
97
|
translationValues
|
|
83
98
|
);
|
|
84
99
|
}
|
|
85
|
-
const [bouncedValue, setDebouncedValue] = useDebounceValue(
|
|
86
|
-
"",
|
|
87
|
-
validationDebounceMilliseconds
|
|
88
|
-
);
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
setDebouncedValue(value ?? "");
|
|
91
|
-
}, [value]);
|
|
92
100
|
const isMounted = useIsMounted();
|
|
93
101
|
const isEmptyValue = !value;
|
|
94
102
|
const isValidFromValidationResult = !isEmptyValue && stateFromValidationResult?.isValid;
|
|
95
103
|
const isInvalidFromValidationResult = !isEmptyValue && !stateFromValidationResult?.isValid;
|
|
96
104
|
const isInvalid = invalidFromProps || isInvalidFromValidationResult;
|
|
97
105
|
const setOptimisticPolicyValidationResult = (isValid = true) => {
|
|
98
|
-
setPolicyValidationResult({
|
|
106
|
+
setPolicyValidationResult(() => ({
|
|
99
107
|
...initialPolicyValidationState,
|
|
100
108
|
isValid
|
|
101
|
-
});
|
|
109
|
+
}));
|
|
102
110
|
};
|
|
103
111
|
useAbortablePromise(
|
|
104
112
|
async (signal) => {
|
|
105
113
|
if (signal.aborted) {
|
|
106
114
|
return;
|
|
107
115
|
}
|
|
108
|
-
const validationResult = validationPolicy.validate(
|
|
109
|
-
if (
|
|
116
|
+
const validationResult = validationPolicy.validate(value);
|
|
117
|
+
if (!isPromise(validationResult.isValid)) {
|
|
110
118
|
setIsLoading(false);
|
|
111
119
|
setPolicyValidationResult((old) => ({
|
|
112
120
|
...old,
|
|
@@ -114,8 +122,8 @@ const PasswordCreationField = flowComponent(
|
|
|
114
122
|
ruleResults: validationResult.ruleResults,
|
|
115
123
|
complexity: validationResult.complexity
|
|
116
124
|
}));
|
|
117
|
-
if (
|
|
118
|
-
|
|
125
|
+
if (isMounted) {
|
|
126
|
+
onChangeHandler(value);
|
|
119
127
|
}
|
|
120
128
|
return;
|
|
121
129
|
}
|
|
@@ -127,8 +135,13 @@ const PasswordCreationField = flowComponent(
|
|
|
127
135
|
setOptimisticPolicyValidationResult();
|
|
128
136
|
}
|
|
129
137
|
void Promise.all([
|
|
130
|
-
Promise.resolve(
|
|
131
|
-
...validationResult.ruleResults
|
|
138
|
+
Promise.resolve(value),
|
|
139
|
+
...validationResult.ruleResults.map(async (r) => {
|
|
140
|
+
if (signal.aborted) {
|
|
141
|
+
throw Error();
|
|
142
|
+
}
|
|
143
|
+
return r;
|
|
144
|
+
})
|
|
132
145
|
]).then(([resolvedValue, ...validationResults]) => {
|
|
133
146
|
if (signal.aborted) {
|
|
134
147
|
return;
|
|
@@ -140,21 +153,18 @@ const PasswordCreationField = flowComponent(
|
|
|
140
153
|
isValid,
|
|
141
154
|
ruleResults: validationResults
|
|
142
155
|
}));
|
|
143
|
-
if (
|
|
144
|
-
|
|
156
|
+
if (isMounted) {
|
|
157
|
+
onChangeHandler(resolvedValue);
|
|
145
158
|
}
|
|
146
159
|
});
|
|
147
160
|
},
|
|
148
|
-
[
|
|
161
|
+
[deferredValue]
|
|
149
162
|
);
|
|
150
|
-
const onChangeValueHandler = (value2) => {
|
|
151
|
-
onChange?.(value2);
|
|
152
|
-
};
|
|
153
163
|
const onPasswordGenerateHandler = async () => {
|
|
154
164
|
const generatedPassword = await generatePassword(validationPolicy);
|
|
155
165
|
setOptimisticPolicyValidationResult();
|
|
156
166
|
setIsPasswordRevealed(true);
|
|
157
|
-
|
|
167
|
+
onChangeHandler(generatedPassword);
|
|
158
168
|
};
|
|
159
169
|
const onPasswordPasteHandler = (event) => {
|
|
160
170
|
const pastedValue = event.clipboardData.getData("text");
|
|
@@ -180,7 +190,8 @@ const PasswordCreationField = flowComponent(
|
|
|
180
190
|
variant: "plain",
|
|
181
191
|
color: "secondary",
|
|
182
192
|
isDisabled,
|
|
183
|
-
className: styles.button
|
|
193
|
+
className: styles.button,
|
|
194
|
+
text: value
|
|
184
195
|
},
|
|
185
196
|
Label: {
|
|
186
197
|
className: formFieldStyles.label,
|
|
@@ -224,9 +235,9 @@ const PasswordCreationField = flowComponent(
|
|
|
224
235
|
Aria.TextField,
|
|
225
236
|
{
|
|
226
237
|
...rest,
|
|
227
|
-
type: isPasswordRevealed ? "text" : "password",
|
|
228
238
|
value,
|
|
229
|
-
|
|
239
|
+
type: isPasswordRevealed ? "text" : "password",
|
|
240
|
+
onChange: onChangeHandler,
|
|
230
241
|
onPaste: onPasswordPasteHandler,
|
|
231
242
|
className: clsx(className, formFieldStyles.formField),
|
|
232
243
|
isDisabled,
|
|
@@ -244,8 +255,8 @@ const PasswordCreationField = flowComponent(
|
|
|
244
255
|
ReactAriaControlledValueFix,
|
|
245
256
|
{
|
|
246
257
|
inputContext: Aria.InputContext,
|
|
247
|
-
props,
|
|
248
|
-
children: /* @__PURE__ */ jsx(Aria.Input, { className: styles.input
|
|
258
|
+
props: { ...props, value },
|
|
259
|
+
children: /* @__PURE__ */ jsx(Aria.Input, { ref, className: styles.input })
|
|
249
260
|
}
|
|
250
261
|
),
|
|
251
262
|
/* @__PURE__ */ jsxs(Aria.Group, { className: styles.buttonContainer, children: [
|
package/dist/js/components/src/components/PasswordCreationField/PasswordCreationField.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordCreationField.mjs","sources":["../../../../../../src/components/PasswordCreationField/PasswordCreationField.tsx"],"sourcesContent":["import React, {\n type PropsWithChildren,\n useState,\n type ClipboardEvent,\n useEffect,\n} from \"react\";\nimport {\n ClearPropsContext,\n dynamic,\n type PropsContext,\n PropsContextProvider,\n} from \"@/lib/propsContext\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport styles from \"./PasswordCreationField.module.scss\";\nimport * as Aria from \"react-aria-components\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport clsx from \"clsx\";\nimport { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport type { Policy } from \"@mittwald/password-tools-js/policy\";\nimport { type ActionFn } from \"@/components/Action\";\nimport getStateFromLatestPolicyValidationResult from \"@/components/PasswordCreationField/lib/getStateFromLatestPolicyValidationResult\";\nimport locales from \"./locales/*.locale.json\";\nimport generateValidationTranslation from \"@/components/PasswordCreationField/lib/generateValidationTranslation\";\nimport { FieldError } from \"@/components/FieldError\";\nimport FieldDescription from \"@/components/FieldDescription\";\nimport ComplexityIndicator from \"@/components/PasswordCreationField/components/ComplexityIndicator/ComplexityIndicator\";\nimport { type PolicyValidationResult } from \"@mittwald/password-tools-js/policy\";\nimport { type RuleValidationResult } from \"@mittwald/password-tools-js/rules\";\nimport { useDebounceValue } from \"usehooks-ts\";\nimport { generatePassword } from \"@/components/PasswordCreationField/worker/generatePassword\";\nimport TogglePasswordVisibilityButton from \"@/components/PasswordCreationField/components/TogglePasswordVisibilityButton/TogglePasswordVisibilityButton\";\nimport { useAbortablePromise } from \"@/lib/promises/useAbortablePromise\";\nimport { defaultPasswordCreationPolicy } from \"@/components/PasswordCreationField/defaultPasswordCreationPolicy\";\nimport { FieldErrorContext } from \"react-aria-components\";\nimport { Wrap } from \"@/components/Wrap\";\nimport { ReactAriaControlledValueFix } from \"@/lib/react/ReactAriaControlledValueFix\";\nimport { useIsMounted } from \"@/lib/hooks\";\nimport { ValidationResultButton } from \"@/components/PasswordCreationField/components/ValidationResultButton/ValidationResultButton\";\nimport { PasswordGenerateButton } from \"@/components/PasswordCreationField/components/PasswordGenerateButton/PasswordGenerateButton\";\nimport { useLocalizedContextStringFormatter } from \"@/components/TranslationProvider/useLocalizedContextStringFormatter\";\n\nconst validationDebounceMilliseconds = 200;\n\nexport interface PasswordCreationFieldProps\n extends PropsWithChildren<\n Omit<Aria.TextFieldProps, \"children\" | \"value\" | \"defaultValue\"> &\n Partial<Pick<Aria.FieldErrorRenderProps, \"validationErrors\">>\n >,\n FlowComponentProps<HTMLInputElement> {\n value?: string;\n defaultValue?: string;\n placeholder?: string;\n validationPolicy?: Policy;\n}\n\nexport interface ResolvedPolicyValidationResult\n extends Omit<PolicyValidationResult, \"isValid\"> {\n isValid: boolean | \"indeterminate\";\n ruleResults: RuleValidationResult[];\n}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const PasswordCreationField = flowComponent(\n \"PasswordCreationField\",\n (props) => {\n const {\n children,\n className,\n ref,\n isDisabled,\n onChange,\n isInvalid: invalidFromProps,\n validationPolicy = defaultPasswordCreationPolicy,\n isRequired,\n value,\n ...rest\n } = props;\n\n const translate = useLocalizedContextStringFormatter(locales);\n\n const [isPasswordRevealed, setIsPasswordRevealed] = useState(false);\n const [isLoading, setIsLoading] = useState(false);\n\n const initialPolicyValidationState: ResolvedPolicyValidationResult = {\n isValid: false,\n complexity: {\n min: validationPolicy.minComplexity,\n actual: 4,\n warning: null,\n },\n ruleResults: [],\n };\n\n const [policyValidationResult, setPolicyValidationResult] = useState(\n initialPolicyValidationState,\n );\n\n const stateFromValidationResult = getStateFromLatestPolicyValidationResult(\n policyValidationResult,\n );\n let latestValidationErrorText = undefined;\n if (stateFromValidationResult) {\n const [translationKey, translationValues] = generateValidationTranslation(\n stateFromValidationResult,\n );\n latestValidationErrorText = translate.format(\n translationKey,\n translationValues,\n );\n }\n\n const [bouncedValue, setDebouncedValue] = useDebounceValue(\n \"\",\n validationDebounceMilliseconds,\n );\n\n useEffect(() => {\n setDebouncedValue(value ?? \"\");\n }, [value]);\n\n const isMounted = useIsMounted();\n const isEmptyValue = !value;\n\n const isValidFromValidationResult =\n !isEmptyValue && stateFromValidationResult?.isValid;\n\n const isInvalidFromValidationResult =\n !isEmptyValue && !stateFromValidationResult?.isValid;\n\n const isInvalid = invalidFromProps || isInvalidFromValidationResult;\n\n const setOptimisticPolicyValidationResult = (\n isValid: ResolvedPolicyValidationResult[\"isValid\"] = true,\n ) => {\n setPolicyValidationResult({\n ...initialPolicyValidationState,\n isValid,\n });\n };\n\n useAbortablePromise(\n async (signal) => {\n if (signal.aborted) {\n return;\n }\n\n const validationResult = validationPolicy.validate(bouncedValue);\n if (typeof validationResult.isValid === \"boolean\") {\n setIsLoading(false);\n setPolicyValidationResult((old) => ({\n ...old,\n isValid: validationResult.isValid as boolean,\n ruleResults: validationResult.ruleResults as RuleValidationResult[],\n complexity: validationResult.complexity,\n }));\n\n if (onChange && isMounted) {\n onChange(bouncedValue);\n }\n return;\n }\n\n const nonPromiseValidationsInvalid = validationResult.ruleResults\n .filter((r): r is RuleValidationResult => !(r instanceof Promise))\n .some((r) => !r.isValid);\n\n if (!isEmptyValue) {\n setIsLoading(true);\n }\n if (!nonPromiseValidationsInvalid) {\n setOptimisticPolicyValidationResult();\n }\n\n void Promise.all([\n Promise.resolve(bouncedValue),\n ...validationResult.ruleResults,\n ]).then(([resolvedValue, ...validationResults]) => {\n if (signal.aborted) {\n return;\n }\n\n const isValid = !validationResults.some((r) => !r.isValid);\n\n setIsLoading(false);\n setPolicyValidationResult((old) => ({\n ...old,\n isValid,\n ruleResults: validationResults,\n }));\n\n if (onChange && isMounted) {\n onChange(resolvedValue);\n }\n });\n },\n [bouncedValue],\n );\n\n const onChangeValueHandler = (value: string) => {\n onChange?.(value);\n };\n\n const onPasswordGenerateHandler: ActionFn = async () => {\n const generatedPassword = await generatePassword(validationPolicy);\n setOptimisticPolicyValidationResult();\n setIsPasswordRevealed(true);\n onChangeValueHandler(generatedPassword);\n };\n\n const onPasswordPasteHandler = (event: ClipboardEvent) => {\n const pastedValue = event.clipboardData.getData(\"text\");\n if (pastedValue !== value) {\n setOptimisticPolicyValidationResult(\"indeterminate\");\n }\n };\n\n const togglePasswordVisibilityHandler = () => {\n setIsPasswordRevealed((old) => !old);\n };\n\n const propsContext: PropsContext = {\n Button: {\n tunnelId: \"button\",\n size: \"m\",\n variant: \"plain\",\n color: \"secondary\",\n isDisabled: isDisabled,\n className: styles.button,\n },\n CopyButton: {\n tunnelId: \"button\",\n size: \"m\",\n variant: \"plain\",\n color: \"secondary\",\n isDisabled: isDisabled,\n className: styles.button,\n },\n Label: {\n className: formFieldStyles.label,\n tunnelId: \"label\",\n optional: !isRequired,\n isDisabled: isDisabled,\n children: dynamic((localProps) => {\n return (\n <>\n {localProps.children}\n <PasswordGenerateButton\n isDisabled={isDisabled}\n onGeneratePasswordAction={onPasswordGenerateHandler}\n />\n <ValidationResultButton\n isEmptyValue={isEmptyValue}\n isDisabled={isDisabled}\n policyValidationResult={policyValidationResult}\n />\n </>\n );\n }),\n },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n },\n FieldError: {\n className: formFieldStyles.customFieldError,\n children: dynamic(() => {\n if (latestValidationErrorText) {\n return latestValidationErrorText;\n }\n }),\n },\n };\n\n return (\n <ClearPropsContext>\n <TunnelProvider>\n <Aria.TextField\n {...rest}\n type={isPasswordRevealed ? \"text\" : \"password\"}\n value={value}\n onChange={onChangeValueHandler}\n onPaste={onPasswordPasteHandler}\n className={clsx(className, formFieldStyles.formField)}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isRequired={isRequired}\n >\n <TunnelExit id=\"label\" />\n <Aria.Group\n isDisabled={isDisabled}\n className={clsx(styles.inputGroup)}\n >\n <ReactAriaControlledValueFix\n inputContext={Aria.InputContext}\n props={props}\n >\n <Aria.Input className={styles.input} ref={ref} />\n </ReactAriaControlledValueFix>\n <Aria.Group className={styles.buttonContainer}>\n <TogglePasswordVisibilityButton\n className={styles.button}\n isVisible={isPasswordRevealed}\n isDisabled={isDisabled}\n onPress={togglePasswordVisibilityHandler}\n />\n <TunnelExit id=\"button\" />\n </Aria.Group>\n <ComplexityIndicator\n isEmptyValue={isEmptyValue}\n isLoading={isLoading}\n policyValidationResult={policyValidationResult}\n />\n </Aria.Group>\n <PropsContextProvider props={propsContext}>\n {isValidFromValidationResult && (\n <FieldDescription>{latestValidationErrorText}</FieldDescription>\n )}\n {isInvalidFromValidationResult &&\n policyValidationResult.isValid !== \"indeterminate\" && (\n <FieldError>{latestValidationErrorText}</FieldError>\n )}\n <Wrap if={isInvalidFromValidationResult}>\n <FieldErrorContext.Provider\n value={{\n isInvalid: false,\n validationErrors: [],\n validationDetails: {\n customError: false,\n valid: true,\n typeMismatch: false,\n stepMismatch: false,\n valueMissing: false,\n tooShort: false,\n tooLong: false,\n rangeUnderflow: false,\n patternMismatch: false,\n badInput: false,\n rangeOverflow: false,\n },\n }}\n >\n {children}\n </FieldErrorContext.Provider>\n </Wrap>\n </PropsContextProvider>\n </Aria.TextField>\n </TunnelProvider>\n </ClearPropsContext>\n );\n },\n);\n\nexport default PasswordCreationField;\n"],"names":["value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAM,8BAAiC,GAAA,GAAA;AAwBhC,MAAM,qBAAwB,GAAA,aAAA;AAAA,EACnC,uBAAA;AAAA,EACA,CAAC,KAAU,KAAA;AACT,IAAM,MAAA;AAAA,MACJ,QAAA;AAAA,MACA,SAAA;AAAA,MACA,GAAA;AAAA,MACA,UAAA;AAAA,MACA,QAAA;AAAA,MACA,SAAW,EAAA,gBAAA;AAAA,MACX,gBAAmB,GAAA,6BAAA;AAAA,MACnB,UAAA;AAAA,MACA,KAAA;AAAA,MACA,GAAG;AAAA,KACD,GAAA,KAAA;AAEJ,IAAM,MAAA,SAAA,GAAY,mCAAmC,OAAO,CAAA;AAE5D,IAAA,MAAM,CAAC,kBAAA,EAAoB,qBAAqB,CAAA,G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oBACA,SAAA;AAAA,oBACA;AAAA;AAAA;AACF;AAAA;AAAA,WACF;AAAA,0BACA,IAAA,CAAC,oBAAqB,EAAA,EAAA,KAAA,EAAO,YAC1B,EAAA,QAAA,EAAA;AAAA,YACC,2BAAA,oBAAA,GAAA,CAAC,oBAAkB,QAA0B,EAAA,yBAAA,EAAA,CAAA;AAAA,YAE9C,iCACC,sBAAuB,CAAA,OAAA,KAAY,eACjC,oBAAA,GAAA,CAAC,cAAY,QAA0B,EAAA,yBAAA,EAAA,CAAA;AAAA,4BAE3C,GAAA,CAAC,IAAK,EAAA,EAAA,EAAA,EAAI,6BACR,EAAA,QAAA,kBAAA,GAAA;AAAA,cAAC,iBAAkB,CAAA,QAAA;AAAA,cAAlB;AAAA,gBACC,KAAO,EAAA;AAAA,kBACL,SAAW,EAAA,KAAA;AAAA,kBACX,kBAAkB,EAAC;AAAA,kBACnB,iBAAmB,EAAA;AAAA,oBACjB,WAAa,EAAA,KAAA;AAAA,oBACb,KAAO,EAAA,IAAA;AAAA,oBACP,YAAc,EAAA,KAAA;AAAA,oBACd,YAAc,EAAA,KAAA;AAAA,oBACd,YAAc,EAAA,KAAA;AAAA,oBACd,QAAU,EAAA,KAAA;AAAA,oBACV,OAAS,EAAA,KAAA;AAAA,oBACT,cAAgB,EAAA,KAAA;AAAA,oBAChB,eAAiB,EAAA,KAAA;AAAA,oBACjB,QAAU,EAAA,KAAA;AAAA,oBACV,aAAe,EAAA;AAAA;AACjB,iBACF;AAAA,gBAEC;AAAA;AAAA,aAEL,EAAA;AAAA,WACF,EAAA;AAAA;AAAA;AAAA,OAEJ,CACF,EAAA,CAAA;AAAA;AAGN;;;;"}
|
|
1
|
+
{"version":3,"file":"PasswordCreationField.mjs","sources":["../../../../../../src/components/PasswordCreationField/PasswordCreationField.tsx"],"sourcesContent":["import React, {\n type PropsWithChildren,\n useState,\n type ClipboardEvent,\n useDeferredValue,\n} from \"react\";\nimport {\n ClearPropsContext,\n dynamic,\n type PropsContext,\n PropsContextProvider,\n} from \"@/lib/propsContext\";\nimport {\n flowComponent,\n type FlowComponentProps,\n} from \"@/lib/componentFactory/flowComponent\";\nimport styles from \"./PasswordCreationField.module.scss\";\nimport * as Aria from \"react-aria-components\";\nimport formFieldStyles from \"@/components/FormField/FormField.module.scss\";\nimport clsx from \"clsx\";\nimport { TunnelExit, TunnelProvider } from \"@mittwald/react-tunnel\";\nimport type { Policy } from \"@mittwald/password-tools-js/policy\";\nimport { type ActionFn } from \"@/components/Action\";\nimport getStateFromLatestPolicyValidationResult from \"@/components/PasswordCreationField/lib/getStateFromLatestPolicyValidationResult\";\nimport locales from \"./locales/*.locale.json\";\nimport generateValidationTranslation from \"@/components/PasswordCreationField/lib/generateValidationTranslation\";\nimport { FieldError } from \"@/components/FieldError\";\nimport FieldDescription from \"@/components/FieldDescription\";\nimport ComplexityIndicator from \"@/components/PasswordCreationField/components/ComplexityIndicator/ComplexityIndicator\";\nimport { type PolicyValidationResult } from \"@mittwald/password-tools-js/policy\";\nimport { type RuleValidationResult } from \"@mittwald/password-tools-js/rules\";\nimport { generatePassword } from \"@/components/PasswordCreationField/worker/generatePassword\";\nimport TogglePasswordVisibilityButton from \"@/components/PasswordCreationField/components/TogglePasswordVisibilityButton/TogglePasswordVisibilityButton\";\nimport { useAbortablePromise } from \"@/lib/promises/useAbortablePromise\";\nimport { defaultPasswordCreationPolicy } from \"@/components/PasswordCreationField/defaultPasswordCreationPolicy\";\nimport { FieldErrorContext } from \"react-aria-components\";\nimport { Wrap } from \"@/components/Wrap\";\nimport { ReactAriaControlledValueFix } from \"@/lib/react/ReactAriaControlledValueFix\";\nimport { useIsMounted } from \"@/lib/hooks\";\nimport { ValidationResultButton } from \"@/components/PasswordCreationField/components/ValidationResultButton/ValidationResultButton\";\nimport { PasswordGenerateButton } from \"@/components/PasswordCreationField/components/PasswordGenerateButton/PasswordGenerateButton\";\nimport { useLocalizedContextStringFormatter } from \"@/components/TranslationProvider/useLocalizedContextStringFormatter\";\nimport { isPromise } from \"remeda\";\n\nexport interface PasswordCreationFieldProps\n extends PropsWithChildren<\n Omit<Aria.TextFieldProps, \"children\" | \"value\" | \"defaultValue\"> &\n Partial<Pick<Aria.FieldErrorRenderProps, \"validationErrors\">>\n >,\n FlowComponentProps<HTMLInputElement> {\n value?: string;\n defaultValue?: string;\n placeholder?: string;\n validationPolicy?: Policy;\n}\n\nexport interface ResolvedPolicyValidationResult\n extends Omit<PolicyValidationResult, \"isValid\"> {\n isValid: boolean | \"indeterminate\";\n ruleResults: RuleValidationResult[];\n}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const PasswordCreationField = flowComponent(\n \"PasswordCreationField\",\n (props) => {\n const {\n children,\n className,\n ref,\n isDisabled,\n onChange: onChangeFromProps,\n isInvalid: invalidFromProps,\n validationPolicy = defaultPasswordCreationPolicy,\n isRequired,\n value: valueFromProps,\n defaultValue,\n ...rest\n } = props;\n\n const isControlled = typeof valueFromProps !== \"undefined\";\n const hasDefaultValue = typeof defaultValue !== \"undefined\";\n const [internalValue, setInternalValue] = useState(\n hasDefaultValue ? defaultValue : \"\",\n );\n const deferredValue = useDeferredValue(\n internalValue,\n hasDefaultValue ? defaultValue : \"\",\n );\n\n const value = isControlled ? valueFromProps : internalValue;\n\n const onChangeHandler = (value: string) => {\n if (onChangeFromProps) {\n onChangeFromProps(value);\n }\n\n setInternalValue(() => value);\n };\n\n const translate = useLocalizedContextStringFormatter(locales);\n\n const [isPasswordRevealed, setIsPasswordRevealed] = useState(false);\n const [isLoading, setIsLoading] = useState(false);\n\n const initialPolicyValidationState: ResolvedPolicyValidationResult = {\n isValid: false,\n complexity: {\n min: validationPolicy.minComplexity,\n actual: 4,\n warning: null,\n },\n ruleResults: [],\n };\n\n const [policyValidationResult, setPolicyValidationResult] = useState(\n initialPolicyValidationState,\n );\n\n const stateFromValidationResult = getStateFromLatestPolicyValidationResult(\n policyValidationResult,\n );\n let latestValidationErrorText = undefined;\n if (stateFromValidationResult) {\n const [translationKey, translationValues] = generateValidationTranslation(\n stateFromValidationResult,\n );\n latestValidationErrorText = translate.format(\n translationKey,\n translationValues,\n );\n }\n\n const isMounted = useIsMounted();\n const isEmptyValue = !value;\n\n const isValidFromValidationResult =\n !isEmptyValue && stateFromValidationResult?.isValid;\n\n const isInvalidFromValidationResult =\n !isEmptyValue && !stateFromValidationResult?.isValid;\n\n const isInvalid = invalidFromProps || isInvalidFromValidationResult;\n\n const setOptimisticPolicyValidationResult = (\n isValid: ResolvedPolicyValidationResult[\"isValid\"] = true,\n ) => {\n setPolicyValidationResult(() => ({\n ...initialPolicyValidationState,\n isValid,\n }));\n };\n\n useAbortablePromise(\n async (signal) => {\n if (signal.aborted) {\n return;\n }\n\n const validationResult = validationPolicy.validate(value);\n if (!isPromise(validationResult.isValid)) {\n setIsLoading(false);\n setPolicyValidationResult((old) => ({\n ...old,\n isValid: validationResult.isValid as boolean,\n ruleResults: validationResult.ruleResults as RuleValidationResult[],\n complexity: validationResult.complexity,\n }));\n\n if (isMounted) {\n onChangeHandler(value);\n }\n return;\n }\n\n const nonPromiseValidationsInvalid = validationResult.ruleResults\n .filter((r): r is RuleValidationResult => !(r instanceof Promise))\n .some((r) => !r.isValid);\n\n if (!isEmptyValue) {\n setIsLoading(true);\n }\n if (!nonPromiseValidationsInvalid) {\n setOptimisticPolicyValidationResult();\n }\n\n void Promise.all([\n Promise.resolve(value),\n ...validationResult.ruleResults.map(async (r) => {\n if (signal.aborted) {\n throw Error();\n }\n\n return r;\n }),\n ]).then(([resolvedValue, ...validationResults]) => {\n if (signal.aborted) {\n return;\n }\n\n const isValid = !validationResults.some((r) => !r.isValid);\n\n setIsLoading(false);\n setPolicyValidationResult((old) => ({\n ...old,\n isValid,\n ruleResults: validationResults,\n }));\n\n if (isMounted) {\n onChangeHandler(resolvedValue);\n }\n });\n },\n [deferredValue],\n );\n\n const onPasswordGenerateHandler: ActionFn = async () => {\n const generatedPassword = await generatePassword(validationPolicy);\n setOptimisticPolicyValidationResult();\n setIsPasswordRevealed(true);\n onChangeHandler(generatedPassword);\n };\n\n const onPasswordPasteHandler = (event: ClipboardEvent) => {\n const pastedValue = event.clipboardData.getData(\"text\");\n if (pastedValue !== value) {\n setOptimisticPolicyValidationResult(\"indeterminate\");\n }\n };\n\n const togglePasswordVisibilityHandler = () => {\n setIsPasswordRevealed((old) => !old);\n };\n\n const propsContext: PropsContext = {\n Button: {\n tunnelId: \"button\",\n size: \"m\",\n variant: \"plain\",\n color: \"secondary\",\n isDisabled: isDisabled,\n className: styles.button,\n },\n CopyButton: {\n tunnelId: \"button\",\n size: \"m\",\n variant: \"plain\",\n color: \"secondary\",\n isDisabled: isDisabled,\n className: styles.button,\n text: value,\n },\n Label: {\n className: formFieldStyles.label,\n tunnelId: \"label\",\n optional: !isRequired,\n isDisabled: isDisabled,\n children: dynamic((localProps) => {\n return (\n <>\n {localProps.children}\n <PasswordGenerateButton\n isDisabled={isDisabled}\n onGeneratePasswordAction={onPasswordGenerateHandler}\n />\n <ValidationResultButton\n isEmptyValue={isEmptyValue}\n isDisabled={isDisabled}\n policyValidationResult={policyValidationResult}\n />\n </>\n );\n }),\n },\n FieldDescription: {\n className: formFieldStyles.fieldDescription,\n },\n FieldError: {\n className: formFieldStyles.customFieldError,\n children: dynamic(() => {\n if (latestValidationErrorText) {\n return latestValidationErrorText;\n }\n }),\n },\n };\n\n return (\n <ClearPropsContext>\n <TunnelProvider>\n <Aria.TextField\n {...rest}\n value={value}\n type={isPasswordRevealed ? \"text\" : \"password\"}\n onChange={onChangeHandler}\n onPaste={onPasswordPasteHandler}\n className={clsx(className, formFieldStyles.formField)}\n isDisabled={isDisabled}\n isInvalid={isInvalid}\n isRequired={isRequired}\n >\n <TunnelExit id=\"label\" />\n <Aria.Group\n isDisabled={isDisabled}\n className={clsx(styles.inputGroup)}\n >\n <ReactAriaControlledValueFix\n inputContext={Aria.InputContext}\n props={{ ...props, value }}\n >\n <Aria.Input ref={ref} className={styles.input} />\n </ReactAriaControlledValueFix>\n <Aria.Group className={styles.buttonContainer}>\n <TogglePasswordVisibilityButton\n className={styles.button}\n isVisible={isPasswordRevealed}\n isDisabled={isDisabled}\n onPress={togglePasswordVisibilityHandler}\n />\n <TunnelExit id=\"button\" />\n </Aria.Group>\n <ComplexityIndicator\n isEmptyValue={isEmptyValue}\n isLoading={isLoading}\n policyValidationResult={policyValidationResult}\n />\n </Aria.Group>\n <PropsContextProvider props={propsContext}>\n {isValidFromValidationResult && (\n <FieldDescription>{latestValidationErrorText}</FieldDescription>\n )}\n {isInvalidFromValidationResult &&\n policyValidationResult.isValid !== \"indeterminate\" && (\n <FieldError>{latestValidationErrorText}</FieldError>\n )}\n <Wrap if={isInvalidFromValidationResult}>\n <FieldErrorContext.Provider\n value={{\n isInvalid: false,\n validationErrors: [],\n validationDetails: {\n customError: false,\n valid: true,\n typeMismatch: false,\n stepMismatch: false,\n valueMissing: false,\n tooShort: false,\n tooLong: false,\n rangeUnderflow: false,\n patternMismatch: false,\n badInput: false,\n rangeOverflow: false,\n },\n }}\n >\n {children}\n </FieldErrorContext.Provider>\n </Wrap>\n </PropsContextProvider>\n </Aria.TextField>\n </TunnelProvider>\n </ClearPropsContext>\n );\n },\n);\n\nexport default PasswordCreationField;\n"],"names":["value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEO,MAAM,qBAAwB,GAAA,aAAA;AAAA,EACnC,uBAAA;AAAA,EACA,CAAC,KAAU,KAAA;AACT,IAAM,MAAA;AAAA,MACJ,QAAA;AAAA,MACA,SAAA;AAAA,MACA,GAAA;AAAA,MACA,UAAA;AAAA,MACA,QAAU,EAAA,iBAAA;AAAA,MACV,SAAW,EAAA,gBAAA;AAAA,MACX,gBAAmB,GAAA,6BAAA;AAAA,MACnB,UAAA;AAAA,MACA,KAAO,EAAA,cAAA;AAAA,MACP,YAAA;AAAA,MACA,GAAG;AAAA,KACD,GAAA,KAAA;AAEJ,IAAM,MAAA,YAAA,GAAe,OAAO,cAAmB,KA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,YAAc,EAAA,KAAA;AAAA,oBACd,QAAU,EAAA,KAAA;AAAA,oBACV,OAAS,EAAA,KAAA;AAAA,oBACT,cAAgB,EAAA,KAAA;AAAA,oBAChB,eAAiB,EAAA,KAAA;AAAA,oBACjB,QAAU,EAAA,KAAA;AAAA,oBACV,aAAe,EAAA;AAAA;AACjB,iBACF;AAAA,gBAEC;AAAA;AAAA,aAEL,EAAA;AAAA,WACF,EAAA;AAAA;AAAA;AAAA,OAEJ,CACF,EAAA,CAAA;AAAA;AAGN;;;;"}
|
|
@@ -19,6 +19,7 @@ import { IconClose } from '../Icon/components/icons/IconClose.mjs';
|
|
|
19
19
|
import { IconSearch } from '../Icon/components/icons/IconSearch.mjs';
|
|
20
20
|
import locales from '../../../../_virtual/_.locale.json@e940efc6da10fdf09417eb079b65a343.mjs';
|
|
21
21
|
import { useLocalizedStringFormatter } from 'react-aria';
|
|
22
|
+
import { ReactAriaControlledValueFix } from '../../lib/react/ReactAriaControlledValueFix.mjs';
|
|
22
23
|
|
|
23
24
|
const SearchField = flowComponent("SearchField", (props) => {
|
|
24
25
|
const { children, className, ref, ...rest } = props;
|
|
@@ -52,11 +53,18 @@ const SearchField = flowComponent("SearchField", (props) => {
|
|
|
52
53
|
/* @__PURE__ */ jsxs("div", { className: styles.inputContainer, children: [
|
|
53
54
|
/* @__PURE__ */ jsx(IconSearch, { className: styles.searchIcon }),
|
|
54
55
|
/* @__PURE__ */ jsx(
|
|
55
|
-
|
|
56
|
+
ReactAriaControlledValueFix,
|
|
56
57
|
{
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
inputContext: Aria.InputContext,
|
|
59
|
+
props,
|
|
60
|
+
children: /* @__PURE__ */ jsx(
|
|
61
|
+
Aria.Input,
|
|
62
|
+
{
|
|
63
|
+
placeholder: searchText,
|
|
64
|
+
className: styles.input,
|
|
65
|
+
ref
|
|
66
|
+
}
|
|
67
|
+
)
|
|
60
68
|
}
|
|
61
69
|
),
|
|
62
70
|
/* @__PURE__ */ jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchField.mjs","sources":["../../../../../../src/components/SearchField/SearchField.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport React from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport formFieldStyles from \"../FormField/FormField.module.scss\";\nimport styles from \"./SearchField.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { FieldError } from \"@/components/FieldError\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { Button } from \"@/components/Button\";\nimport { IconClose, IconSearch } from \"@/components/Icon/components/icons\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\n\nexport interface SearchFieldProps\n extends PropsWithChildren<Omit<Aria.SearchFieldProps, \"children\">>,\n FlowComponentProps<HTMLInputElement> {}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const SearchField = flowComponent(\"SearchField\", (props) => {\n const { children, className, ref, ...rest } = props;\n\n const rootClassName = clsx(\n formFieldStyles.formField,\n styles.searchField,\n className,\n );\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const searchText = stringFormatter.format(`searchField.search`);\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 return (\n <ClearPropsContext>\n <Aria.SearchField\n aria-label={searchText}\n {...rest}\n className={rootClassName}\n >\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n <div className={styles.inputContainer}>\n <IconSearch className={styles.searchIcon} />\n <Aria.Input\n
|
|
1
|
+
{"version":3,"file":"SearchField.mjs","sources":["../../../../../../src/components/SearchField/SearchField.tsx"],"sourcesContent":["import type { PropsWithChildren } from \"react\";\nimport React from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport formFieldStyles from \"../FormField/FormField.module.scss\";\nimport styles from \"./SearchField.module.scss\";\nimport clsx from \"clsx\";\nimport type { PropsContext } from \"@/lib/propsContext\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport { PropsContextProvider } from \"@/lib/propsContext\";\nimport { FieldError } from \"@/components/FieldError\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { Button } from \"@/components/Button\";\nimport { IconClose, IconSearch } from \"@/components/Icon/components/icons\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport { ReactAriaControlledValueFix } from \"@/lib/react/ReactAriaControlledValueFix\";\n\nexport interface SearchFieldProps\n extends PropsWithChildren<Omit<Aria.SearchFieldProps, \"children\">>,\n FlowComponentProps<HTMLInputElement> {}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const SearchField = flowComponent(\"SearchField\", (props) => {\n const { children, className, ref, ...rest } = props;\n\n const rootClassName = clsx(\n formFieldStyles.formField,\n styles.searchField,\n className,\n );\n\n const stringFormatter = useLocalizedStringFormatter(locales);\n\n const searchText = stringFormatter.format(`searchField.search`);\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 return (\n <ClearPropsContext>\n <Aria.SearchField\n aria-label={searchText}\n {...rest}\n className={rootClassName}\n >\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n <div className={styles.inputContainer}>\n <IconSearch className={styles.searchIcon} />\n <ReactAriaControlledValueFix\n inputContext={Aria.InputContext}\n props={props}\n >\n <Aria.Input\n placeholder={searchText}\n className={styles.input}\n ref={ref}\n />\n </ReactAriaControlledValueFix>\n <Button\n className={styles.clearButton}\n variant=\"plain\"\n color=\"secondary\"\n >\n <IconClose />\n </Button>\n </div>\n <FieldError className={formFieldStyles.fieldError} />\n </Aria.SearchField>\n </ClearPropsContext>\n );\n});\n\nexport default SearchField;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AA0BO,MAAM,WAAc,GAAA,aAAA,CAAc,aAAe,EAAA,CAAC,KAAU,KAAA;AACjE,EAAA,MAAM,EAAE,QAAU,EAAA,SAAA,EAAW,GAAK,EAAA,GAAG,MAAS,GAAA,KAAA;AAE9C,EAAA,MAAM,aAAgB,GAAA,IAAA;AAAA,IACpB,eAAgB,CAAA,SAAA;AAAA,IAChB,MAAO,CAAA,WAAA;AAAA,IACP;AAAA,GACF;AAEA,EAAM,MAAA,eAAA,GAAkB,4BAA4B,OAAO,CAAA;AAE3D,EAAM,MAAA,UAAA,GAAa,eAAgB,CAAA,MAAA,CAAO,CAAoB,kBAAA,CAAA,CAAA;AAE9D,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;AAC7B,GACF;AAEA,EAAA,2BACG,iBACC,EAAA,EAAA,QAAA,kBAAA,IAAA;AAAA,IAAC,IAAK,CAAA,WAAA;AAAA,IAAL;AAAA,MACC,YAAY,EAAA,UAAA;AAAA,MACX,GAAG,IAAA;AAAA,MACJ,SAAW,EAAA,aAAA;AAAA,MAEX,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,oBAAA,EAAA,EAAqB,KAAO,EAAA,YAAA,EAC1B,QACH,EAAA,CAAA;AAAA,wBACC,IAAA,CAAA,KAAA,EAAA,EAAI,SAAW,EAAA,MAAA,CAAO,cACrB,EAAA,QAAA,EAAA;AAAA,0BAAC,GAAA,CAAA,UAAA,EAAA,EAAW,SAAW,EAAA,MAAA,CAAO,UAAY,EAAA,CAAA;AAAA,0BAC1C,GAAA;AAAA,YAAC,2BAAA;AAAA,YAAA;AAAA,cACC,cAAc,IAAK,CAAA,YAAA;AAAA,cACnB,KAAA;AAAA,cAEA,QAAA,kBAAA,GAAA;AAAA,gBAAC,IAAK,CAAA,KAAA;AAAA,gBAAL;AAAA,kBACC,WAAa,EAAA,UAAA;AAAA,kBACb,WAAW,MAAO,CAAA,KAAA;AAAA,kBAClB;AAAA;AAAA;AACF;AAAA,WACF;AAAA,0BACA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,WAAW,MAAO,CAAA,WAAA;AAAA,cAClB,OAAQ,EAAA,OAAA;AAAA,cACR,KAAM,EAAA,WAAA;AAAA,cAEN,8BAAC,SAAU,EAAA,EAAA;AAAA;AAAA;AACb,SACF,EAAA,CAAA;AAAA,wBACC,GAAA,CAAA,UAAA,EAAA,EAAW,SAAW,EAAA,eAAA,CAAgB,UAAY,EAAA;AAAA;AAAA;AAAA,GAEvD,EAAA,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
|
-
import { useRef } from 'react';
|
|
5
4
|
import * as Aria from 'react-aria-components';
|
|
6
5
|
import { TextFieldBase } from '../TextFieldBase/TextFieldBase.mjs';
|
|
7
6
|
import styles from './TextArea.module.scss.mjs';
|
|
8
7
|
import { ClearPropsContext } from '../ClearPropsContext/ClearPropsContext.mjs';
|
|
9
8
|
import { flowComponent } from '../../lib/componentFactory/flowComponent.mjs';
|
|
10
|
-
import {
|
|
9
|
+
import { useObjectRef } from '@react-aria/utils';
|
|
11
10
|
import { ReactAriaControlledValueFix } from '../../lib/react/ReactAriaControlledValueFix.mjs';
|
|
12
11
|
|
|
13
12
|
const TextArea = flowComponent("TextArea", (props) => {
|
|
@@ -19,7 +18,7 @@ const TextArea = flowComponent("TextArea", (props) => {
|
|
|
19
18
|
ref,
|
|
20
19
|
...rest
|
|
21
20
|
} = props;
|
|
22
|
-
const localRef =
|
|
21
|
+
const localRef = useObjectRef(ref);
|
|
23
22
|
const getHeight = (rows2) => {
|
|
24
23
|
return `calc(var(--line-height--m) * ${rows2} + (var(--form-control--padding-y) * 2))`;
|
|
25
24
|
};
|
|
@@ -41,7 +40,7 @@ const TextArea = flowComponent("TextArea", (props) => {
|
|
|
41
40
|
rows,
|
|
42
41
|
placeholder,
|
|
43
42
|
className: styles.textArea,
|
|
44
|
-
ref:
|
|
43
|
+
ref: localRef,
|
|
45
44
|
onChange: updateHeight,
|
|
46
45
|
style: {
|
|
47
46
|
minHeight: getHeight(rows),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.mjs","sources":["../../../../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"TextArea.mjs","sources":["../../../../../../src/components/TextArea/TextArea.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport type { TextFieldBaseProps } from \"@/components/TextFieldBase\";\nimport { TextFieldBase } from \"@/components/TextFieldBase\";\nimport styles from \"./TextArea.module.scss\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport { useObjectRef } from \"@react-aria/utils\";\nimport { ReactAriaControlledValueFix } from \"@/lib/react/ReactAriaControlledValueFix\";\n\nexport interface TextAreaProps\n extends Omit<TextFieldBaseProps, \"input\" | \"ref\">,\n Pick<Aria.TextAreaProps, \"placeholder\" | \"rows\">,\n FlowComponentProps<HTMLTextAreaElement> {\n /**\n * Whether the text area should grow if its content gets longer than its\n * initial height.\n */\n autoResizeMaxRows?: number;\n}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const TextArea = flowComponent(\"TextArea\", (props) => {\n const {\n children,\n placeholder,\n rows = 5,\n autoResizeMaxRows = rows,\n ref,\n ...rest\n } = props;\n\n const localRef = useObjectRef(ref);\n\n const getHeight = (rows: number) => {\n return `calc(var(--line-height--m) * ${rows} + (var(--form-control--padding-y) * 2))`;\n };\n\n const updateHeight = () => {\n if (localRef.current && rows !== autoResizeMaxRows) {\n // https://stackoverflow.com/a/60795884\n localRef.current.style.height = \"0px\";\n const scrollHeight = localRef.current.scrollHeight;\n localRef.current.style.height = scrollHeight + \"px\";\n }\n };\n\n const input = (\n <ReactAriaControlledValueFix\n inputContext={Aria.TextAreaContext}\n props={props}\n >\n <Aria.TextArea\n rows={rows}\n placeholder={placeholder}\n className={styles.textArea}\n ref={localRef}\n onChange={updateHeight}\n style={{\n minHeight: getHeight(rows),\n maxHeight: getHeight(autoResizeMaxRows),\n }}\n />\n </ReactAriaControlledValueFix>\n );\n\n return (\n <ClearPropsContext>\n <TextFieldBase {...rest} input={input}>\n {children}\n </TextFieldBase>\n </ClearPropsContext>\n );\n});\n\nexport default TextArea;\n"],"names":["rows"],"mappings":";;;;;;;;;AAyBO,MAAM,QAAW,GAAA,aAAA,CAAc,UAAY,EAAA,CAAC,KAAU,KAAA;AAC3D,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,WAAA;AAAA,IACA,IAAO,GAAA,CAAA;AAAA,IACP,iBAAoB,GAAA,IAAA;AAAA,IACpB,GAAA;AAAA,IACA,GAAG;AAAA,GACD,GAAA,KAAA;AAEJ,EAAM,MAAA,QAAA,GAAW,aAAa,GAAG,CAAA;AAEjC,EAAM,MAAA,SAAA,GAAY,CAACA,KAAiB,KAAA;AAClC,IAAA,OAAO,gCAAgCA,KAAI,CAAA,wCAAA,CAAA;AAAA,GAC7C;AAEA,EAAA,MAAM,eAAe,MAAM;AACzB,IAAI,IAAA,QAAA,CAAS,OAAW,IAAA,IAAA,KAAS,iBAAmB,EAAA;AAElD,MAAS,QAAA,CAAA,OAAA,CAAQ,MAAM,MAAS,GAAA,KAAA;AAChC,MAAM,MAAA,YAAA,GAAe,SAAS,OAAQ,CAAA,YAAA;AACtC,MAAS,QAAA,CAAA,OAAA,CAAQ,KAAM,CAAA,MAAA,GAAS,YAAe,GAAA,IAAA;AAAA;AACjD,GACF;AAEA,EAAA,MAAM,KACJ,mBAAA,GAAA;AAAA,IAAC,2BAAA;AAAA,IAAA;AAAA,MACC,cAAc,IAAK,CAAA,eAAA;AAAA,MACnB,KAAA;AAAA,MAEA,QAAA,kBAAA,GAAA;AAAA,QAAC,IAAK,CAAA,QAAA;AAAA,QAAL;AAAA,UACC,IAAA;AAAA,UACA,WAAA;AAAA,UACA,WAAW,MAAO,CAAA,QAAA;AAAA,UAClB,GAAK,EAAA,QAAA;AAAA,UACL,QAAU,EAAA,YAAA;AAAA,UACV,KAAO,EAAA;AAAA,YACL,SAAA,EAAW,UAAU,IAAI,CAAA;AAAA,YACzB,SAAA,EAAW,UAAU,iBAAiB;AAAA;AACxC;AAAA;AACF;AAAA,GACF;AAGF,EACE,uBAAA,GAAA,CAAC,qBACC,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EAAe,GAAG,IAAM,EAAA,KAAA,EACtB,UACH,CACF,EAAA,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
/* */
|
|
3
|
-
import {
|
|
3
|
+
import { useLayoutEffect } from 'react';
|
|
4
4
|
|
|
5
5
|
const useAbortablePromise = (asyncFn, dependencies) => {
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
void asyncFn(signal);
|
|
6
|
+
useLayoutEffect(() => {
|
|
7
|
+
const controller = new AbortController();
|
|
8
|
+
void asyncFn(controller.signal);
|
|
9
9
|
return () => {
|
|
10
|
-
|
|
10
|
+
controller.abort();
|
|
11
11
|
};
|
|
12
12
|
}, dependencies);
|
|
13
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAbortablePromise.mjs","sources":["../../../../../../src/lib/promises/useAbortablePromise.ts"],"sourcesContent":["import { type DependencyList,
|
|
1
|
+
{"version":3,"file":"useAbortablePromise.mjs","sources":["../../../../../../src/lib/promises/useAbortablePromise.ts"],"sourcesContent":["import { type DependencyList, useLayoutEffect } from \"react\";\n\nexport const useAbortablePromise = (\n asyncFn: (signal: AbortSignal) => Promise<void>,\n dependencies: DependencyList,\n) => {\n useLayoutEffect(() => {\n const controller = new AbortController();\n void asyncFn(controller.signal);\n return () => {\n controller.abort();\n };\n }, dependencies);\n};\n"],"names":[],"mappings":";;AAEa,MAAA,mBAAA,GAAsB,CACjC,OAAA,EACA,YACG,KAAA;AACH,EAAA,eAAA,CAAgB,MAAM;AACpB,IAAM,MAAA,UAAA,GAAa,IAAI,eAAgB,EAAA;AACvC,IAAK,KAAA,OAAA,CAAQ,WAAW,MAAM,CAAA;AAC9B,IAAA,OAAO,MAAM;AACX,MAAA,UAAA,CAAW,KAAM,EAAA;AAAA,KACnB;AAAA,KACC,YAAY,CAAA;AACjB;;;;"}
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
/* */
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
import * as Aria from 'react-aria-components';
|
|
5
|
-
import { Children, isValidElement,
|
|
6
|
-
import { mergeRefs } from '@react-aria/utils';
|
|
5
|
+
import { Children, isValidElement, useLayoutEffect } from 'react';
|
|
7
6
|
|
|
8
7
|
const ReactAriaControlledValueFix = (props) => {
|
|
9
8
|
const { inputContext: context, children } = props;
|
|
@@ -11,29 +10,33 @@ const ReactAriaControlledValueFix = (props) => {
|
|
|
11
10
|
if (!isValidElement(child)) {
|
|
12
11
|
throw new Error("Expected valid element");
|
|
13
12
|
}
|
|
14
|
-
const inputProps = child.props;
|
|
15
|
-
const ref = inputProps["ref"];
|
|
13
|
+
const { ref, ...inputProps } = child.props;
|
|
16
14
|
const [contextProps, contextRef] = Aria.useContextProps(
|
|
17
15
|
inputProps,
|
|
18
16
|
ref,
|
|
19
17
|
context
|
|
20
18
|
);
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
useLayoutEffect(() => {
|
|
20
|
+
const element = contextRef.current;
|
|
21
|
+
if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) {
|
|
22
|
+
const newValue = String(contextProps.value ?? "");
|
|
23
|
+
try {
|
|
24
|
+
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
|
|
25
|
+
Object.getPrototypeOf(element),
|
|
26
|
+
"value"
|
|
27
|
+
)?.set;
|
|
28
|
+
nativeInputValueSetter?.call(element, newValue);
|
|
29
|
+
} catch (ignoredError) {
|
|
30
|
+
element.value = newValue;
|
|
31
|
+
}
|
|
24
32
|
}
|
|
25
|
-
},
|
|
33
|
+
}, [contextProps.value]);
|
|
26
34
|
const uncontrolledContextProps = {
|
|
27
35
|
...contextProps,
|
|
28
36
|
value: void 0,
|
|
29
|
-
ref:
|
|
37
|
+
ref: contextRef
|
|
30
38
|
};
|
|
31
|
-
|
|
32
|
-
...inputProps,
|
|
33
|
-
ref: void 0,
|
|
34
|
-
value: void 0
|
|
35
|
-
};
|
|
36
|
-
return /* @__PURE__ */ jsx(Aria.Provider, { values: [[context, uncontrolledContextProps]], children: cloneElement(child, uncontrolledInputProps) });
|
|
39
|
+
return /* @__PURE__ */ jsx(Aria.Provider, { values: [[context, uncontrolledContextProps]], children: child });
|
|
37
40
|
};
|
|
38
41
|
|
|
39
42
|
export { ReactAriaControlledValueFix };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactAriaControlledValueFix.mjs","sources":["../../../../../../src/lib/react/ReactAriaControlledValueFix.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport {\n Children,\n
|
|
1
|
+
{"version":3,"file":"ReactAriaControlledValueFix.mjs","sources":["../../../../../../src/lib/react/ReactAriaControlledValueFix.tsx"],"sourcesContent":["import * as Aria from \"react-aria-components\";\nimport {\n Children,\n isValidElement,\n type Context,\n type FC,\n type ForwardedRef,\n type PropsWithChildren,\n useLayoutEffect,\n} from \"react\";\n\nexport interface ReactAriaControlledValueFixProps extends PropsWithChildren {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n inputContext: Context<any>;\n props: unknown;\n}\n\ninterface ChildProps {\n [key: string]: unknown;\n ref: ForwardedRef<Element>;\n}\n\n/**\n * React Aria (accidentally?!) enforces controlled inputs by always setting the\n * value prop on Inputs and TextAreas with its context props API. This component\n * also uses this API to only unset the value prop. Furthermore setting an input\n * value is finally done by directly on the DOM element.\n *\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/textfield/src/useTextField.ts#L182\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/numberfield/src/useNumberField.ts#L206\n */\nexport const ReactAriaControlledValueFix: FC<\n ReactAriaControlledValueFixProps\n> = (props) => {\n const { inputContext: context, children } = props;\n\n const child = Children.only(children);\n if (!isValidElement<ChildProps>(child)) {\n throw new Error(\"Expected valid element\");\n }\n\n const { ref, ...inputProps } = child.props;\n const [contextProps, contextRef] = Aria.useContextProps(\n inputProps,\n ref,\n context,\n );\n\n useLayoutEffect(() => {\n const element = contextRef.current;\n\n if (\n element instanceof HTMLInputElement ||\n element instanceof HTMLTextAreaElement\n ) {\n const newValue = String(contextProps.value ?? \"\");\n try {\n const nativeInputValueSetter = Object.getOwnPropertyDescriptor(\n Object.getPrototypeOf(element),\n \"value\",\n )?.set;\n nativeInputValueSetter?.call(element, newValue);\n } catch (ignoredError) {\n element.value = newValue;\n }\n }\n }, [contextProps.value]);\n\n const uncontrolledContextProps = {\n ...contextProps,\n value: undefined,\n ref: contextRef,\n };\n\n return (\n <Aria.Provider values={[[context, u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EA,EACE,uBAAA,GAAA,CAAC,IAAK,CAAA,QAAA,EAAL,EAAc,MAAA,EAAQ,CAAC,CAAC,OAAS,EAAA,wBAAwB,CAAC,CAAA,EACxD,QACH,EAAA,KAAA,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -2,7 +2,7 @@ import { ButtonProps } from '../Button';
|
|
|
2
2
|
import { FlowComponentProps } from '../../lib/componentFactory/flowComponent';
|
|
3
3
|
export interface CopyButtonProps extends Omit<ButtonProps, "onPress" | "aria-label" | "render">, FlowComponentProps<HTMLButtonElement> {
|
|
4
4
|
/** The text to copy. */
|
|
5
|
-
text
|
|
5
|
+
text?: string;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
8
|
* @flr-generate all
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CopyButton.d.ts","sourceRoot":"","sources":["../../../../src/components/CopyButton/CopyButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAQvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAI/E,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC,EAC5D,kBAAkB,CAAC,iBAAiB,CAAC;IACvC,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"CopyButton.d.ts","sourceRoot":"","sources":["../../../../src/components/CopyButton/CopyButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAQvD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAI/E,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,YAAY,GAAG,QAAQ,CAAC,EAC5D,kBAAkB,CAAC,iBAAiB,CAAC;IACvC,wBAAwB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,uGAmCrB,CAAC;AAEH,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PasswordCreationField.d.ts","sourceRoot":"","sources":["../../../../src/components/PasswordCreationField/PasswordCreationField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,KAAK,iBAAiB,EAIvB,MAAM,OAAO,CAAC;AAOf,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAI9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAQjE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"PasswordCreationField.d.ts","sourceRoot":"","sources":["../../../../src/components/PasswordCreationField/PasswordCreationField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,KAAK,iBAAiB,EAIvB,MAAM,OAAO,CAAC;AAOf,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAI9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAQjE,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAc9E,MAAM,WAAW,0BACf,SAAQ,iBAAiB,CACrB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,GAAG,OAAO,GAAG,cAAc,CAAC,GAC9D,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,kBAAkB,CAAC,CAAC,CAChE,EACD,kBAAkB,CAAC,gBAAgB,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,8BACf,SAAQ,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC;IAC/C,OAAO,EAAE,OAAO,GAAG,eAAe,CAAC;IACnC,WAAW,EAAE,oBAAoB,EAAE,CAAC;CACrC;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,6FA8SjC,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchField.d.ts","sourceRoot":"","sources":["../../../../src/components/SearchField/SearchField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAQ9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchField.d.ts","sourceRoot":"","sources":["../../../../src/components/SearchField/SearchField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAQ9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAQ/E,MAAM,WAAW,gBACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAC,EAChE,kBAAkB,CAAC,gBAAgB,CAAC;CAAG;AAE3C;;;GAGG;AACH,eAAO,MAAM,WAAW,mFA4DtB,CAAC;AAEH,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../src/components/TextArea/TextArea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAIrE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAK/E,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,KAAK,CAAC,EAC/C,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,GAAG,MAAM,CAAC,EAChD,kBAAkB,CAAC,mBAAmB,CAAC;IACzC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,uGAmDnB,CAAC;AAEH,eAAe,QAAQ,CAAC"}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
1
|
import { DependencyList } from 'react';
|
|
2
|
-
|
|
3
|
-
aborted: boolean;
|
|
4
|
-
}
|
|
5
|
-
export declare const useAbortablePromise: (asyncFn: (signal: Signal) => Promise<void>, dependencies: DependencyList) => void;
|
|
6
|
-
export {};
|
|
2
|
+
export declare const useAbortablePromise: (asyncFn: (signal: AbortSignal) => Promise<void>, dependencies: DependencyList) => void;
|
|
7
3
|
//# sourceMappingURL=useAbortablePromise.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAbortablePromise.d.ts","sourceRoot":"","sources":["../../../../src/lib/promises/useAbortablePromise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"useAbortablePromise.d.ts","sourceRoot":"","sources":["../../../../src/lib/promises/useAbortablePromise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAmB,MAAM,OAAO,CAAC;AAE7D,eAAO,MAAM,mBAAmB,GAC9B,SAAS,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,EAC/C,cAAc,cAAc,SAS7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactAriaControlledValueFix.d.ts","sourceRoot":"","sources":["../../../../src/lib/react/ReactAriaControlledValueFix.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"ReactAriaControlledValueFix.d.ts","sourceRoot":"","sources":["../../../../src/lib/react/ReactAriaControlledValueFix.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,OAAO,EACZ,KAAK,EAAE,EAEP,KAAK,iBAAiB,EAEvB,MAAM,OAAO,CAAC;AAEf,MAAM,WAAW,gCAAiC,SAAQ,iBAAiB;IAEzE,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,KAAK,EAAE,OAAO,CAAC;CAChB;AAOD;;;;;;;;GAQG;AACH,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAC1C,gCAAgC,CA+CjC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/flow-react-components",
|
|
3
|
-
"version": "0.2.0-alpha.
|
|
3
|
+
"version": "0.2.0-alpha.355",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React implementation of Flow, mittwald’s design system",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@chakra-ui/live-region": "^2.1.0",
|
|
59
59
|
"@internationalized/string-compiler": "^3.2.6",
|
|
60
60
|
"@mittwald/password-tools-js": "^2.1.6",
|
|
61
|
-
"@mittwald/react-tunnel": "0.2.0-alpha.
|
|
61
|
+
"@mittwald/react-tunnel": "0.2.0-alpha.355",
|
|
62
62
|
"@mittwald/react-use-promise": "^3.0.4",
|
|
63
63
|
"@react-aria/form": "^3.0.18",
|
|
64
64
|
"@react-aria/utils": "^3.29.1",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"@faker-js/faker": "^9.9.0",
|
|
100
100
|
"@internationalized/date": "^3.8.2",
|
|
101
101
|
"@mittwald/flow-core": "",
|
|
102
|
-
"@mittwald/flow-design-tokens": "0.2.0-alpha.
|
|
102
|
+
"@mittwald/flow-design-tokens": "0.2.0-alpha.355",
|
|
103
103
|
"@mittwald/react-use-promise": "^3.0.4",
|
|
104
104
|
"@mittwald/remote-dom-react": "1.2.2-mittwald.3",
|
|
105
105
|
"@mittwald/typescript-config": "",
|
|
@@ -172,5 +172,5 @@
|
|
|
172
172
|
"optional": true
|
|
173
173
|
}
|
|
174
174
|
},
|
|
175
|
-
"gitHead": "
|
|
175
|
+
"gitHead": "7bf3810a7246de960df0353fee822c90cb04753b"
|
|
176
176
|
}
|