@mittwald/flow-react-components 0.2.0-alpha.578 → 0.2.0-alpha.579
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.
|
@@ -18,14 +18,14 @@ const getPropsMerger = (options = {}) => (...propsList) => {
|
|
|
18
18
|
const mergedProps = mergeProps(...sortedByLevel);
|
|
19
19
|
if (isObjectType(mergedProps)) {
|
|
20
20
|
if (!mergeClassNames) {
|
|
21
|
-
for (const props of
|
|
21
|
+
for (const props of sortedByLevel) {
|
|
22
22
|
if (isObjectType(props) && "className" in mergedProps && "className" in props) {
|
|
23
23
|
mergedProps.className = props.className;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
if (!mergeEventHandler) {
|
|
28
|
-
for (const props of
|
|
28
|
+
for (const props of sortedByLevel) {
|
|
29
29
|
if (isObjectType(props)) {
|
|
30
30
|
for (const [propName, propValue] of Object.entries(props)) {
|
|
31
31
|
const isEventHandlerProp = /^on[A-Z]/.test(propName);
|
|
@@ -41,7 +41,7 @@ const getPropsMerger = (options = {}) => (...propsList) => {
|
|
|
41
41
|
(p) => p === "ref" || p.endsWith("Ref")
|
|
42
42
|
);
|
|
43
43
|
for (const refProp of refProps) {
|
|
44
|
-
const collectedRefObjects =
|
|
44
|
+
const collectedRefObjects = sortedByLevel.map((p) => isObjectType(p) && refProp in p ? p[refProp] : null).filter((r) => r !== null);
|
|
45
45
|
setProperty(
|
|
46
46
|
mergedProps,
|
|
47
47
|
refProp,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPropsMerger.mjs","sources":["../../../../../../src/lib/react/getPropsMerger.ts"],"sourcesContent":["import { mergeRefs as mergeRefsFn } from \"@react-aria/utils\";\nimport { mergeProps as ariaMergeProps } from \"@react-aria/utils\";\nimport { isObjectType, sortBy } from \"remeda\";\nimport { setProperty } from \"dot-prop\";\nimport type { Ref } from \"react\";\nimport { getNestingLevel } from \"@/lib/propsContext/nestedPropsContext/lib\";\n\ninterface MergePropsOptions {\n mergeClassNames?: boolean;\n mergeEventHandler?: boolean;\n mergeRefs?: boolean;\n}\n\nexport const getPropsMerger =\n (options: MergePropsOptions = {}): typeof ariaMergeProps =>\n (...propsList) => {\n const {\n mergeClassNames = true,\n mergeEventHandler = true,\n mergeRefs = true,\n } = options;\n\n const sortedByLevel = sortBy(\n propsList,\n getNestingLevel,\n ) as typeof propsList;\n\n const mergedProps = ariaMergeProps(...sortedByLevel);\n\n if (isObjectType(mergedProps)) {\n if (!mergeClassNames) {\n // \"Unmerge\" className\n for (const props of
|
|
1
|
+
{"version":3,"file":"getPropsMerger.mjs","sources":["../../../../../../src/lib/react/getPropsMerger.ts"],"sourcesContent":["import { mergeRefs as mergeRefsFn } from \"@react-aria/utils\";\nimport { mergeProps as ariaMergeProps } from \"@react-aria/utils\";\nimport { isObjectType, sortBy } from \"remeda\";\nimport { setProperty } from \"dot-prop\";\nimport type { Ref } from \"react\";\nimport { getNestingLevel } from \"@/lib/propsContext/nestedPropsContext/lib\";\n\ninterface MergePropsOptions {\n mergeClassNames?: boolean;\n mergeEventHandler?: boolean;\n mergeRefs?: boolean;\n}\n\nexport const getPropsMerger =\n (options: MergePropsOptions = {}): typeof ariaMergeProps =>\n (...propsList) => {\n const {\n mergeClassNames = true,\n mergeEventHandler = true,\n mergeRefs = true,\n } = options;\n\n const sortedByLevel = sortBy(\n propsList,\n getNestingLevel,\n ) as typeof propsList;\n\n const mergedProps = ariaMergeProps(...sortedByLevel);\n\n if (isObjectType(mergedProps)) {\n if (!mergeClassNames) {\n // \"Unmerge\" className\n for (const props of sortedByLevel) {\n if (\n isObjectType(props) &&\n \"className\" in mergedProps &&\n \"className\" in props\n ) {\n mergedProps.className = props.className;\n }\n }\n }\n\n if (!mergeEventHandler) {\n // \"Unmerge\" eventHandler\n for (const props of sortedByLevel) {\n if (isObjectType(props)) {\n for (const [propName, propValue] of Object.entries(props)) {\n const isEventHandlerProp = /^on[A-Z]/.test(propName);\n if (isEventHandlerProp) {\n setProperty(mergedProps, propName, propValue);\n }\n }\n }\n }\n }\n\n if (mergeRefs) {\n const refProps = Object.keys(mergedProps).filter(\n (p) => p === \"ref\" || p.endsWith(\"Ref\"),\n );\n\n for (const refProp of refProps) {\n const collectedRefObjects = sortedByLevel\n .map((p) => (isObjectType(p) && refProp in p ? p[refProp] : null))\n .filter((r): r is Ref<unknown> => r !== null);\n\n setProperty(\n mergedProps,\n refProp,\n mergeRefsFn(...collectedRefObjects),\n );\n }\n }\n }\n\n return mergedProps;\n };\n"],"names":["mergeRefs","ariaMergeProps","mergeRefsFn"],"mappings":";;;;;AAaO,MAAM,iBACX,CAAC,OAAA,GAA6B,EAAC,KAC/B,IAAI,SAAA,KAAc;AAChB,EAAA,MAAM;AAAA,IACJ,eAAA,GAAkB,IAAA;AAAA,IAClB,iBAAA,GAAoB,IAAA;AAAA,eACpBA,WAAA,GAAY;AAAA,GACd,GAAI,OAAA;AAEJ,EAAA,MAAM,aAAA,GAAgB,MAAA;AAAA,IACpB,SAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAA,MAAM,WAAA,GAAcC,UAAA,CAAe,GAAG,aAAa,CAAA;AAEnD,EAAA,IAAI,YAAA,CAAa,WAAW,CAAA,EAAG;AAC7B,IAAA,IAAI,CAAC,eAAA,EAAiB;AAEpB,MAAA,KAAA,MAAW,SAAS,aAAA,EAAe;AACjC,QAAA,IACE,aAAa,KAAK,CAAA,IAClB,WAAA,IAAe,WAAA,IACf,eAAe,KAAA,EACf;AACA,UAAA,WAAA,CAAY,YAAY,KAAA,CAAM,SAAA;AAAA,QAChC;AAAA,MACF;AAAA,IACF;AAEA,IAAA,IAAI,CAAC,iBAAA,EAAmB;AAEtB,MAAA,KAAA,MAAW,SAAS,aAAA,EAAe;AACjC,QAAA,IAAI,YAAA,CAAa,KAAK,CAAA,EAAG;AACvB,UAAA,KAAA,MAAW,CAAC,QAAA,EAAU,SAAS,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AACzD,YAAA,MAAM,kBAAA,GAAqB,UAAA,CAAW,IAAA,CAAK,QAAQ,CAAA;AACnD,YAAA,IAAI,kBAAA,EAAoB;AACtB,cAAA,WAAA,CAAY,WAAA,EAAa,UAAU,SAAS,CAAA;AAAA,YAC9C;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAEA,IAAA,IAAID,WAAA,EAAW;AACb,MAAA,MAAM,QAAA,GAAW,MAAA,CAAO,IAAA,CAAK,WAAW,CAAA,CAAE,MAAA;AAAA,QACxC,CAAC,CAAA,KAAM,CAAA,KAAM,KAAA,IAAS,CAAA,CAAE,SAAS,KAAK;AAAA,OACxC;AAEA,MAAA,KAAA,MAAW,WAAW,QAAA,EAAU;AAC9B,QAAA,MAAM,sBAAsB,aAAA,CACzB,GAAA,CAAI,CAAC,CAAA,KAAO,YAAA,CAAa,CAAC,CAAA,IAAK,OAAA,IAAW,IAAI,CAAA,CAAE,OAAO,IAAI,IAAK,CAAA,CAChE,OAAO,CAAC,CAAA,KAAyB,MAAM,IAAI,CAAA;AAE9C,QAAA,WAAA;AAAA,UACE,WAAA;AAAA,UACA,OAAA;AAAA,UACAE,SAAA,CAAY,GAAG,mBAAmB;AAAA,SACpC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,EAAA,OAAO,WAAA;AACT;;;;"}
|
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.579",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A React implementation of Flow, mittwald’s design system",
|
|
6
6
|
"homepage": "https://mittwald.github.io/flow",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@internationalized/string-compiler": "^3.2.6",
|
|
62
62
|
"@mittwald/password-tools-js": "3.0.0-alpha.18",
|
|
63
|
-
"@mittwald/react-tunnel": "0.2.0-alpha.
|
|
63
|
+
"@mittwald/react-tunnel": "0.2.0-alpha.579",
|
|
64
64
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
65
65
|
"@react-aria/form": "^3.1.2",
|
|
66
66
|
"@react-aria/live-announcer": "^3.4.4",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"@faker-js/faker": "^10.1.0",
|
|
106
106
|
"@internationalized/date": "^3.10.0",
|
|
107
107
|
"@mittwald/flow-core": "",
|
|
108
|
-
"@mittwald/flow-design-tokens": "0.2.0-alpha.
|
|
108
|
+
"@mittwald/flow-design-tokens": "0.2.0-alpha.579",
|
|
109
109
|
"@mittwald/react-use-promise": "^4.2.2",
|
|
110
110
|
"@mittwald/remote-dom-react": "1.2.2-mittwald.10",
|
|
111
111
|
"@mittwald/typescript-config": "",
|
|
@@ -174,5 +174,5 @@
|
|
|
174
174
|
"optional": true
|
|
175
175
|
}
|
|
176
176
|
},
|
|
177
|
-
"gitHead": "
|
|
177
|
+
"gitHead": "2ae911d7c856ad58fb46218274dcccaab9f4c6ca"
|
|
178
178
|
}
|