@mittwald/flow-react-components 0.2.0-alpha.202 → 0.2.0-alpha.204
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 +10 -0
- package/dist/js/components/src/components/TextFieldBase/TextFieldBase.mjs +4 -1
- package/dist/js/components/src/components/TextFieldBase/TextFieldBase.mjs.map +1 -1
- package/dist/types/components/TextFieldBase/TextFieldBase.d.ts.map +1 -1
- package/dist/types/components/TextFieldBase/TextFieldBase.test.d.ts +2 -0
- package/dist/types/components/TextFieldBase/TextFieldBase.test.d.ts.map +1 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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.204](https://github.com/mittwald/flow/compare/0.2.0-alpha.203...0.2.0-alpha.204) (2025-05-23)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **TextField:** fix TextField loses value on blur ([#1499](https://github.com/mittwald/flow/issues/1499)) ([b0ca673](https://github.com/mittwald/flow/commit/b0ca6739e2af1d59c1198377d4eefd905a9eb196))
|
|
11
|
+
|
|
12
|
+
# [0.2.0-alpha.203](https://github.com/mittwald/flow/compare/0.2.0-alpha.202...0.2.0-alpha.203) (2025-05-22)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @mittwald/flow-react-components
|
|
15
|
+
|
|
6
16
|
# [0.2.0-alpha.202](https://github.com/mittwald/flow/compare/0.2.0-alpha.201...0.2.0-alpha.202) (2025-05-22)
|
|
7
17
|
|
|
8
18
|
### Bug Fixes
|
|
@@ -47,6 +47,9 @@ const TextFieldBase = (props) => {
|
|
|
47
47
|
maxCount: props.maxLength ?? 0
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
|
+
const propsWithOptionalStringValue = "value" in props ? {
|
|
51
|
+
value: props.value ?? ""
|
|
52
|
+
} : {};
|
|
50
53
|
return /* @__PURE__ */ jsx(ClearPropsContext, { children: /* @__PURE__ */ jsxs(
|
|
51
54
|
Aria.TextField,
|
|
52
55
|
{
|
|
@@ -54,7 +57,7 @@ const TextFieldBase = (props) => {
|
|
|
54
57
|
...rest,
|
|
55
58
|
className: rootClassName,
|
|
56
59
|
onChange: handleOnChange,
|
|
57
|
-
|
|
60
|
+
...propsWithOptionalStringValue,
|
|
58
61
|
children: [
|
|
59
62
|
input,
|
|
60
63
|
/* @__PURE__ */ jsx(PropsContextProvider, { props: propsContext, children }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextFieldBase.mjs","sources":["../../../../../../src/components/TextFieldBase/TextFieldBase.tsx"],"sourcesContent":["import { type FC, type PropsWithChildren, type ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"../FormField/FormField.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 { FieldDescription } from \"@/components/FieldDescription\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\n\nexport interface TextFieldBaseProps\n extends PropsWithChildren<Omit<Aria.TextFieldProps, \"children\">>,\n Pick<FlowComponentProps<HTMLInputElement>, \"ref\"> {\n /** The input element */\n input: ReactNode;\n /** Whether a character count should be displayed inside the field description. */\n showCharacterCount?: boolean;\n}\n\nexport const TextFieldBase: FC<TextFieldBaseProps> = (props) => {\n const { children, className, input, showCharacterCount, ref, ...rest } =\n props;\n const [charactersCount, setCharactersCount] = useState(\n props.value?.length ?? 0,\n );\n\n const rootClassName = clsx(styles.formField, className);\n\n const translation = useLocalizedStringFormatter(locales);\n\n const propsContext: PropsContext = {\n Label: {\n className: styles.label,\n optional: !props.isRequired,\n },\n FieldDescription: {\n className: styles.fieldDescription,\n },\n FieldError: {\n className: styles.customFieldError,\n },\n };\n\n const handleOnChange = (v: string) => {\n if (showCharacterCount) {\n setCharactersCount(v.length);\n }\n if (props.onChange) {\n props.onChange(v);\n }\n };\n\n const charactersCountDescription = translation.format(\n \"textFieldBase.characters\",\n {\n count: charactersCount,\n maxCount: props.maxLength ?? 0,\n },\n );\n\n return (\n <ClearPropsContext>\n <Aria.TextField\n ref={ref}\n {...rest}\n className={rootClassName}\n onChange={handleOnChange}\n
|
|
1
|
+
{"version":3,"file":"TextFieldBase.mjs","sources":["../../../../../../src/components/TextFieldBase/TextFieldBase.tsx"],"sourcesContent":["import { type FC, type PropsWithChildren, type ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport * as Aria from \"react-aria-components\";\nimport styles from \"../FormField/FormField.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 { FieldDescription } from \"@/components/FieldDescription\";\nimport locales from \"./locales/*.locale.json\";\nimport { useLocalizedStringFormatter } from \"react-aria\";\nimport type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\n\nexport interface TextFieldBaseProps\n extends PropsWithChildren<Omit<Aria.TextFieldProps, \"children\">>,\n Pick<FlowComponentProps<HTMLInputElement>, \"ref\"> {\n /** The input element */\n input: ReactNode;\n /** Whether a character count should be displayed inside the field description. */\n showCharacterCount?: boolean;\n}\n\nexport const TextFieldBase: FC<TextFieldBaseProps> = (props) => {\n const { children, className, input, showCharacterCount, ref, ...rest } =\n props;\n const [charactersCount, setCharactersCount] = useState(\n props.value?.length ?? 0,\n );\n\n const rootClassName = clsx(styles.formField, className);\n\n const translation = useLocalizedStringFormatter(locales);\n\n const propsContext: PropsContext = {\n Label: {\n className: styles.label,\n optional: !props.isRequired,\n },\n FieldDescription: {\n className: styles.fieldDescription,\n },\n FieldError: {\n className: styles.customFieldError,\n },\n };\n\n const handleOnChange = (v: string) => {\n if (showCharacterCount) {\n setCharactersCount(v.length);\n }\n if (props.onChange) {\n props.onChange(v);\n }\n };\n\n const charactersCountDescription = translation.format(\n \"textFieldBase.characters\",\n {\n count: charactersCount,\n maxCount: props.maxLength ?? 0,\n },\n );\n\n /** Prevent weird reset behavior when value is 'undefined' */\n const propsWithOptionalStringValue =\n \"value\" in props\n ? {\n value: props.value ?? \"\",\n }\n : {};\n\n return (\n <ClearPropsContext>\n <Aria.TextField\n ref={ref}\n {...rest}\n className={rootClassName}\n onChange={handleOnChange}\n {...propsWithOptionalStringValue}\n >\n {input}\n <PropsContextProvider props={propsContext}>\n {children}\n </PropsContextProvider>\n {showCharacterCount && (\n <FieldDescription className={styles.fieldDescription}>\n {charactersCountDescription}\n </FieldDescription>\n )}\n <FieldError className={styles.fieldError} />\n </Aria.TextField>\n </ClearPropsContext>\n );\n};\n\nexport default TextFieldBase;\n"],"names":["styles"],"mappings":";;;;;;;;;;;;;AAuBa,MAAA,aAAA,GAAwC,CAAC,KAAU,KAAA;AAC9D,EAAM,MAAA,EAAE,UAAU,SAAW,EAAA,KAAA,EAAO,oBAAoB,GAAK,EAAA,GAAG,MAC9D,GAAA,KAAA;AACF,EAAM,MAAA,CAAC,eAAiB,EAAA,kBAAkB,CAAI,GAAA,QAAA;AAAA,IAC5C,KAAA,CAAM,OAAO,MAAU,IAAA;AAAA,GACzB;AAEA,EAAA,MAAM,aAAgB,GAAA,IAAA,CAAKA,eAAO,CAAA,SAAA,EAAW,SAAS,CAAA;AAEtD,EAAM,MAAA,WAAA,GAAc,4BAA4B,OAAO,CAAA;AAEvD,EAAA,MAAM,YAA6B,GAAA;AAAA,IACjC,KAAO,EAAA;AAAA,MACL,WAAWA,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CAAO,UAAY,EAAA;AAAA;AAAA;AAAA,GAE9C,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextFieldBase.d.ts","sourceRoot":"","sources":["../../../../src/components/TextFieldBase/TextFieldBase.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAU9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,MAAM,WAAW,kBACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,EAC9D,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACnD,wBAAwB;IACxB,KAAK,EAAE,SAAS,CAAC;IACjB,kFAAkF;IAClF,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,
|
|
1
|
+
{"version":3,"file":"TextFieldBase.d.ts","sourceRoot":"","sources":["../../../../src/components/TextFieldBase/TextFieldBase.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,KAAK,IAAI,MAAM,uBAAuB,CAAC;AAU9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,MAAM,WAAW,kBACf,SAAQ,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,EAC9D,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,EAAE,KAAK,CAAC;IACnD,wBAAwB;IACxB,KAAK,EAAE,SAAS,CAAC;IACjB,kFAAkF;IAClF,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAuEhD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextFieldBase.test.d.ts","sourceRoot":"","sources":["../../../../src/components/TextFieldBase/TextFieldBase.test.tsx"],"names":[],"mappings":""}
|
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.204",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React implementation of Flow, mittwald’s design system",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@chakra-ui/live-region": "^2.1.0",
|
|
55
55
|
"@internationalized/string-compiler": "^3.2.6",
|
|
56
|
-
"@mittwald/react-tunnel": "0.2.0-alpha.
|
|
56
|
+
"@mittwald/react-tunnel": "0.2.0-alpha.204",
|
|
57
57
|
"@mittwald/react-use-promise": "^3.0.4",
|
|
58
58
|
"@react-aria/form": "^3.0.14",
|
|
59
59
|
"@react-aria/utils": "^3.28.1",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"devDependencies": {
|
|
93
93
|
"@faker-js/faker": "^9.6.0",
|
|
94
94
|
"@internationalized/date": "^3.7.0",
|
|
95
|
-
"@mittwald/flow-design-tokens": "0.2.0-alpha.
|
|
95
|
+
"@mittwald/flow-design-tokens": "0.2.0-alpha.204",
|
|
96
96
|
"@mittwald/react-use-promise": "^2.6.0",
|
|
97
97
|
"@mittwald/remote-dom-react": "1.2.2-mittwald.3",
|
|
98
98
|
"@mittwald/typescript-config": "",
|
|
@@ -173,5 +173,5 @@
|
|
|
173
173
|
"optional": true
|
|
174
174
|
}
|
|
175
175
|
},
|
|
176
|
-
"gitHead": "
|
|
176
|
+
"gitHead": "1bd4f5aeee162013abe1129b9e68e2b9e9004b75"
|
|
177
177
|
}
|