@salutejs/plasma-new-hope 0.336.0-canary.2219.17586567115.0 → 0.336.0-canary.2219.17638454714.0
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/cjs/engines/common.js +11 -1
- package/cjs/engines/common.js.map +1 -1
- package/emotion/cjs/engines/common.js +14 -1
- package/emotion/es/engines/common.js +14 -1
- package/emotion/es/examples/components/Combobox/Combobox.js +7 -0
- package/es/engines/common.js +12 -2
- package/es/engines/common.js.map +1 -1
- package/package.json +2 -2
- package/styled-components/cjs/engines/common.js +14 -1
- package/styled-components/es/engines/common.js +14 -1
- package/styled-components/es/examples/components/Combobox/Combobox.js +0 -7
- package/types/components/NumberFormat/NumberFormat.d.ts.map +1 -1
- package/types/components/NumberFormat/NumberFormat.types.d.ts +1 -1
- package/types/components/TextField/TextField.types.d.ts +2 -2
- package/types/engines/common.d.ts.map +1 -1
- package/types/examples/components/NumberFormat/NumberFormat.d.ts.map +1 -1
package/cjs/engines/common.js
CHANGED
@@ -37,10 +37,20 @@ var mergeConfig = function mergeConfig(baseConfig, userConfig) {
|
|
37
37
|
}
|
38
38
|
return res;
|
39
39
|
};
|
40
|
+
|
41
|
+
// INFO: Метод, который проводит слияние двух объектов
|
42
|
+
// INFO: если значение явно указанно как undefined/null/пустая строка, то будет взято значение указанное в default
|
43
|
+
function mergeWithoutNullable(defaults, componentProps) {
|
44
|
+
var props = Object.keys(defaults).reduce(function (acc, key) {
|
45
|
+
return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, acc), {}, _rollupPluginBabelHelpers.defineProperty({}, key, [null, undefined, ''].includes(componentProps[key]) ? defaults[key] : componentProps[key]));
|
46
|
+
}, {});
|
47
|
+
return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, componentProps), props);
|
48
|
+
}
|
40
49
|
function component(config) {
|
41
50
|
var Comp = config.layout(linaria._component(config));
|
42
51
|
return /*#__PURE__*/React__default.default.forwardRef(function (props, ref) {
|
43
|
-
|
52
|
+
var mergedProps = mergeWithoutNullable(config === null || config === void 0 ? void 0 : config.defaults, props);
|
53
|
+
return /*#__PURE__*/React__default.default.createElement(Comp, _rollupPluginBabelHelpers.extends({}, mergedProps, {
|
44
54
|
ref: ref
|
45
55
|
}));
|
46
56
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"common.js","sources":["../../src/engines/common.tsx"],"sourcesContent":["import React from 'react';\n\nimport { _component } from './linaria';\nimport type {\n ComponentConfig,\n HTMLTagList,\n PropsType,\n Variants,\n HTMLAttributesWithoutOnChange,\n HTMLAttributesWithoutOnChangeAndDefaultValue,\n} from './types';\n\nexport const mergeConfig = <\n Tag extends HTMLTagList,\n VariantList extends Variants,\n VariantsProps extends PropsType<VariantList>,\n LayoutPropsBase extends\n | React.HTMLAttributes<HTMLElement>\n | HTMLAttributesWithoutOnChange<HTMLElement>\n | HTMLAttributesWithoutOnChangeAndDefaultValue<HTMLElement>,\n LayoutPropsUser extends\n | React.HTMLAttributes<HTMLElement>\n | HTMLAttributesWithoutOnChange<HTMLElement>\n | HTMLAttributesWithoutOnChangeAndDefaultValue<HTMLElement>\n | undefined = undefined\n>(\n baseConfig: ComponentConfig<Tag, Variants, PropsType & LayoutPropsBase, LayoutPropsBase>,\n userConfig?: Partial<ComponentConfig<Tag, VariantList, VariantsProps, LayoutPropsUser>>,\n) => {\n const res = { ...baseConfig, ...userConfig };\n\n if (res.variations) {\n // copy variations base css\n // eslint-disable-next-line guard-for-in\n for (const key in res.variations) {\n const variant = baseConfig.variations[key];\n\n res.variations[key].css = variant?.css;\n /* start of bad decision */\n if (!res.variations[key].true && variant?.true) {\n res.variations[key].true = variant.true;\n }\n /* end of bad decision */\n if (variant?.attrs) {\n res.variations[key].attrs = variant.attrs;\n }\n }\n }\n\n // eslint-disable-next-line guard-for-in\n for (const key in baseConfig.defaults || {}) {\n if (!(key in res.defaults)) {\n res.defaults[key] = baseConfig.defaults[key];\n }\n }\n\n return res as ComponentConfig<\n Tag,\n VariantList,\n PropsType<VariantList>,\n LayoutPropsUser extends undefined ? LayoutPropsBase : LayoutPropsUser\n >;\n};\n\nexport function component<\n Tag extends HTMLTagList,\n VariantList extends Variants,\n VariantsProps extends PropsType<VariantList>,\n LayoutProps extends\n | React.HTMLAttributes<HTMLElement>\n | HTMLAttributesWithoutOnChange<HTMLElement>\n | HTMLAttributesWithoutOnChangeAndDefaultValue<HTMLElement>\n>(\n config: ComponentConfig<Tag, VariantList, VariantsProps, LayoutProps>,\n): React.FunctionComponent<VariantsProps & LayoutProps> {\n const Comp = config.layout(_component((config as unknown) as ComponentConfig));\n\n return React.forwardRef<VariantsProps & LayoutProps, any>((props, ref) =>
|
1
|
+
{"version":3,"file":"common.js","sources":["../../src/engines/common.tsx"],"sourcesContent":["import React from 'react';\n\nimport { _component } from './linaria';\nimport type {\n ComponentConfig,\n HTMLTagList,\n PropsType,\n Variants,\n HTMLAttributesWithoutOnChange,\n HTMLAttributesWithoutOnChangeAndDefaultValue,\n} from './types';\n\nexport const mergeConfig = <\n Tag extends HTMLTagList,\n VariantList extends Variants,\n VariantsProps extends PropsType<VariantList>,\n LayoutPropsBase extends\n | React.HTMLAttributes<HTMLElement>\n | HTMLAttributesWithoutOnChange<HTMLElement>\n | HTMLAttributesWithoutOnChangeAndDefaultValue<HTMLElement>,\n LayoutPropsUser extends\n | React.HTMLAttributes<HTMLElement>\n | HTMLAttributesWithoutOnChange<HTMLElement>\n | HTMLAttributesWithoutOnChangeAndDefaultValue<HTMLElement>\n | undefined = undefined\n>(\n baseConfig: ComponentConfig<Tag, Variants, PropsType & LayoutPropsBase, LayoutPropsBase>,\n userConfig?: Partial<ComponentConfig<Tag, VariantList, VariantsProps, LayoutPropsUser>>,\n) => {\n const res = { ...baseConfig, ...userConfig };\n\n if (res.variations) {\n // copy variations base css\n // eslint-disable-next-line guard-for-in\n for (const key in res.variations) {\n const variant = baseConfig.variations[key];\n\n res.variations[key].css = variant?.css;\n /* start of bad decision */\n if (!res.variations[key].true && variant?.true) {\n res.variations[key].true = variant.true;\n }\n /* end of bad decision */\n if (variant?.attrs) {\n res.variations[key].attrs = variant.attrs;\n }\n }\n }\n\n // eslint-disable-next-line guard-for-in\n for (const key in baseConfig.defaults || {}) {\n if (!(key in res.defaults)) {\n res.defaults[key] = baseConfig.defaults[key];\n }\n }\n\n return res as ComponentConfig<\n Tag,\n VariantList,\n PropsType<VariantList>,\n LayoutPropsUser extends undefined ? LayoutPropsBase : LayoutPropsUser\n >;\n};\n\n// INFO: Метод, который проводит слияние двух объектов\n// INFO: если значение явно указанно как undefined/null/пустая строка, то будет взято значение указанное в default\nfunction mergeWithoutNullable(defaults: any, componentProps: any) {\n const props = Object.keys(defaults).reduce((acc, key) => {\n return {\n ...acc,\n [key]: [null, undefined, ''].includes(componentProps[key]) ? defaults[key] : componentProps[key],\n };\n }, {});\n\n return { ...componentProps, ...props };\n}\n\nexport function component<\n Tag extends HTMLTagList,\n VariantList extends Variants,\n VariantsProps extends PropsType<VariantList>,\n LayoutProps extends\n | React.HTMLAttributes<HTMLElement>\n | HTMLAttributesWithoutOnChange<HTMLElement>\n | HTMLAttributesWithoutOnChangeAndDefaultValue<HTMLElement>\n>(\n config: ComponentConfig<Tag, VariantList, VariantsProps, LayoutProps>,\n): React.FunctionComponent<VariantsProps & LayoutProps> {\n const Comp = config.layout(_component((config as unknown) as ComponentConfig));\n\n return React.forwardRef<VariantsProps & LayoutProps, any>((props, ref) => {\n const mergedProps = mergeWithoutNullable(config?.defaults, props);\n\n return <Comp {...mergedProps} ref={ref} />;\n });\n}\n"],"names":["mergeConfig","baseConfig","userConfig","res","_objectSpread","variations","key","variant","css","attrs","defaults","mergeWithoutNullable","componentProps","props","Object","keys","reduce","acc","_defineProperty","undefined","includes","component","config","Comp","layout","_component","React","forwardRef","ref","mergedProps","createElement","_extends"],"mappings":";;;;;;;;;;;;AAYO,IAAMA,WAAW,GAAG,SA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CAAE,CAAC,CAAA;AAC9C,GAAC,CAAC,CAAA;AACN;;;;;"}
|
@@ -99,10 +99,23 @@ var mergeConfig = function(baseConfig, userConfig) {
|
|
99
99
|
}
|
100
100
|
return res;
|
101
101
|
};
|
102
|
+
// INFO: Метод, который проводит слияние двух объектов
|
103
|
+
// INFO: если значение явно указанно как undefined/null/пустая строка, то будет взято значение указанное в default
|
104
|
+
function mergeWithoutNullable(defaults, componentProps) {
|
105
|
+
var props = Object.keys(defaults).reduce(function(acc, key) {
|
106
|
+
return _object_spread_props(_object_spread({}, acc), _define_property({}, key, [
|
107
|
+
null,
|
108
|
+
undefined,
|
109
|
+
''
|
110
|
+
].includes(componentProps[key]) ? defaults[key] : componentProps[key]));
|
111
|
+
}, {});
|
112
|
+
return _object_spread({}, componentProps, props);
|
113
|
+
}
|
102
114
|
function component(config) {
|
103
115
|
var Comp = config.layout((0, _emotion._component)(config));
|
104
116
|
return /*#__PURE__*/ _react.default.forwardRef(function(props, ref) {
|
105
|
-
|
117
|
+
var mergedProps = mergeWithoutNullable(config === null || config === void 0 ? void 0 : config.defaults, props);
|
118
|
+
return /*#__PURE__*/ _react.default.createElement(Comp, _object_spread_props(_object_spread({}, mergedProps), {
|
106
119
|
ref: ref
|
107
120
|
}));
|
108
121
|
});
|
@@ -76,10 +76,23 @@ export var mergeConfig = function(baseConfig, userConfig) {
|
|
76
76
|
}
|
77
77
|
return res;
|
78
78
|
};
|
79
|
+
// INFO: Метод, который проводит слияние двух объектов
|
80
|
+
// INFO: если значение явно указанно как undefined/null/пустая строка, то будет взято значение указанное в default
|
81
|
+
function mergeWithoutNullable(defaults, componentProps) {
|
82
|
+
var props = Object.keys(defaults).reduce(function(acc, key) {
|
83
|
+
return _object_spread_props(_object_spread({}, acc), _define_property({}, key, [
|
84
|
+
null,
|
85
|
+
undefined,
|
86
|
+
''
|
87
|
+
].includes(componentProps[key]) ? defaults[key] : componentProps[key]));
|
88
|
+
}, {});
|
89
|
+
return _object_spread({}, componentProps, props);
|
90
|
+
}
|
79
91
|
export function component(config) {
|
80
92
|
var Comp = config.layout(_component(config));
|
81
93
|
return /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
82
|
-
|
94
|
+
var mergedProps = mergeWithoutNullable(config === null || config === void 0 ? void 0 : config.defaults, props);
|
95
|
+
return /*#__PURE__*/ React.createElement(Comp, _object_spread_props(_object_spread({}, mergedProps), {
|
83
96
|
ref: ref
|
84
97
|
}));
|
85
98
|
});
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { component, mergeConfig } from "../../../engines";
|
2
|
+
import { comboboxNewConfig } from "../../..";
|
3
|
+
import { config } from "./Combobox.config";
|
4
|
+
var mergedConfig = mergeConfig(comboboxNewConfig, config);
|
5
|
+
var ComboboxComponent = component(mergedConfig);
|
6
|
+
var Combobox = ComboboxComponent;
|
7
|
+
export { Combobox };
|
package/es/engines/common.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { objectSpread2 as _objectSpread2, extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js';
|
1
|
+
import { objectSpread2 as _objectSpread2, extends as _extends, defineProperty as _defineProperty } from '../_virtual/_rollupPluginBabelHelpers.js';
|
2
2
|
import React from 'react';
|
3
3
|
import { _component } from './linaria.js';
|
4
4
|
|
@@ -29,10 +29,20 @@ var mergeConfig = function mergeConfig(baseConfig, userConfig) {
|
|
29
29
|
}
|
30
30
|
return res;
|
31
31
|
};
|
32
|
+
|
33
|
+
// INFO: Метод, который проводит слияние двух объектов
|
34
|
+
// INFO: если значение явно указанно как undefined/null/пустая строка, то будет взято значение указанное в default
|
35
|
+
function mergeWithoutNullable(defaults, componentProps) {
|
36
|
+
var props = Object.keys(defaults).reduce(function (acc, key) {
|
37
|
+
return _objectSpread2(_objectSpread2({}, acc), {}, _defineProperty({}, key, [null, undefined, ''].includes(componentProps[key]) ? defaults[key] : componentProps[key]));
|
38
|
+
}, {});
|
39
|
+
return _objectSpread2(_objectSpread2({}, componentProps), props);
|
40
|
+
}
|
32
41
|
function component(config) {
|
33
42
|
var Comp = config.layout(_component(config));
|
34
43
|
return /*#__PURE__*/React.forwardRef(function (props, ref) {
|
35
|
-
|
44
|
+
var mergedProps = mergeWithoutNullable(config === null || config === void 0 ? void 0 : config.defaults, props);
|
45
|
+
return /*#__PURE__*/React.createElement(Comp, _extends({}, mergedProps, {
|
36
46
|
ref: ref
|
37
47
|
}));
|
38
48
|
});
|
package/es/engines/common.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"common.js","sources":["../../src/engines/common.tsx"],"sourcesContent":["import React from 'react';\n\nimport { _component } from './linaria';\nimport type {\n ComponentConfig,\n HTMLTagList,\n PropsType,\n Variants,\n HTMLAttributesWithoutOnChange,\n HTMLAttributesWithoutOnChangeAndDefaultValue,\n} from './types';\n\nexport const mergeConfig = <\n Tag extends HTMLTagList,\n VariantList extends Variants,\n VariantsProps extends PropsType<VariantList>,\n LayoutPropsBase extends\n | React.HTMLAttributes<HTMLElement>\n | HTMLAttributesWithoutOnChange<HTMLElement>\n | HTMLAttributesWithoutOnChangeAndDefaultValue<HTMLElement>,\n LayoutPropsUser extends\n | React.HTMLAttributes<HTMLElement>\n | HTMLAttributesWithoutOnChange<HTMLElement>\n | HTMLAttributesWithoutOnChangeAndDefaultValue<HTMLElement>\n | undefined = undefined\n>(\n baseConfig: ComponentConfig<Tag, Variants, PropsType & LayoutPropsBase, LayoutPropsBase>,\n userConfig?: Partial<ComponentConfig<Tag, VariantList, VariantsProps, LayoutPropsUser>>,\n) => {\n const res = { ...baseConfig, ...userConfig };\n\n if (res.variations) {\n // copy variations base css\n // eslint-disable-next-line guard-for-in\n for (const key in res.variations) {\n const variant = baseConfig.variations[key];\n\n res.variations[key].css = variant?.css;\n /* start of bad decision */\n if (!res.variations[key].true && variant?.true) {\n res.variations[key].true = variant.true;\n }\n /* end of bad decision */\n if (variant?.attrs) {\n res.variations[key].attrs = variant.attrs;\n }\n }\n }\n\n // eslint-disable-next-line guard-for-in\n for (const key in baseConfig.defaults || {}) {\n if (!(key in res.defaults)) {\n res.defaults[key] = baseConfig.defaults[key];\n }\n }\n\n return res as ComponentConfig<\n Tag,\n VariantList,\n PropsType<VariantList>,\n LayoutPropsUser extends undefined ? LayoutPropsBase : LayoutPropsUser\n >;\n};\n\nexport function component<\n Tag extends HTMLTagList,\n VariantList extends Variants,\n VariantsProps extends PropsType<VariantList>,\n LayoutProps extends\n | React.HTMLAttributes<HTMLElement>\n | HTMLAttributesWithoutOnChange<HTMLElement>\n | HTMLAttributesWithoutOnChangeAndDefaultValue<HTMLElement>\n>(\n config: ComponentConfig<Tag, VariantList, VariantsProps, LayoutProps>,\n): React.FunctionComponent<VariantsProps & LayoutProps> {\n const Comp = config.layout(_component((config as unknown) as ComponentConfig));\n\n return React.forwardRef<VariantsProps & LayoutProps, any>((props, ref) =>
|
1
|
+
{"version":3,"file":"common.js","sources":["../../src/engines/common.tsx"],"sourcesContent":["import React from 'react';\n\nimport { _component } from './linaria';\nimport type {\n ComponentConfig,\n HTMLTagList,\n PropsType,\n Variants,\n HTMLAttributesWithoutOnChange,\n HTMLAttributesWithoutOnChangeAndDefaultValue,\n} from './types';\n\nexport const mergeConfig = <\n Tag extends HTMLTagList,\n VariantList extends Variants,\n VariantsProps extends PropsType<VariantList>,\n LayoutPropsBase extends\n | React.HTMLAttributes<HTMLElement>\n | HTMLAttributesWithoutOnChange<HTMLElement>\n | HTMLAttributesWithoutOnChangeAndDefaultValue<HTMLElement>,\n LayoutPropsUser extends\n | React.HTMLAttributes<HTMLElement>\n | HTMLAttributesWithoutOnChange<HTMLElement>\n | HTMLAttributesWithoutOnChangeAndDefaultValue<HTMLElement>\n | undefined = undefined\n>(\n baseConfig: ComponentConfig<Tag, Variants, PropsType & LayoutPropsBase, LayoutPropsBase>,\n userConfig?: Partial<ComponentConfig<Tag, VariantList, VariantsProps, LayoutPropsUser>>,\n) => {\n const res = { ...baseConfig, ...userConfig };\n\n if (res.variations) {\n // copy variations base css\n // eslint-disable-next-line guard-for-in\n for (const key in res.variations) {\n const variant = baseConfig.variations[key];\n\n res.variations[key].css = variant?.css;\n /* start of bad decision */\n if (!res.variations[key].true && variant?.true) {\n res.variations[key].true = variant.true;\n }\n /* end of bad decision */\n if (variant?.attrs) {\n res.variations[key].attrs = variant.attrs;\n }\n }\n }\n\n // eslint-disable-next-line guard-for-in\n for (const key in baseConfig.defaults || {}) {\n if (!(key in res.defaults)) {\n res.defaults[key] = baseConfig.defaults[key];\n }\n }\n\n return res as ComponentConfig<\n Tag,\n VariantList,\n PropsType<VariantList>,\n LayoutPropsUser extends undefined ? LayoutPropsBase : LayoutPropsUser\n >;\n};\n\n// INFO: Метод, который проводит слияние двух объектов\n// INFO: если значение явно указанно как undefined/null/пустая строка, то будет взято значение указанное в default\nfunction mergeWithoutNullable(defaults: any, componentProps: any) {\n const props = Object.keys(defaults).reduce((acc, key) => {\n return {\n ...acc,\n [key]: [null, undefined, ''].includes(componentProps[key]) ? defaults[key] : componentProps[key],\n };\n }, {});\n\n return { ...componentProps, ...props };\n}\n\nexport function component<\n Tag extends HTMLTagList,\n VariantList extends Variants,\n VariantsProps extends PropsType<VariantList>,\n LayoutProps extends\n | React.HTMLAttributes<HTMLElement>\n | HTMLAttributesWithoutOnChange<HTMLElement>\n | HTMLAttributesWithoutOnChangeAndDefaultValue<HTMLElement>\n>(\n config: ComponentConfig<Tag, VariantList, VariantsProps, LayoutProps>,\n): React.FunctionComponent<VariantsProps & LayoutProps> {\n const Comp = config.layout(_component((config as unknown) as ComponentConfig));\n\n return React.forwardRef<VariantsProps & LayoutProps, any>((props, ref) => {\n const mergedProps = mergeWithoutNullable(config?.defaults, props);\n\n return <Comp {...mergedProps} ref={ref} />;\n });\n}\n"],"names":["mergeConfig","baseConfig","userConfig","res","_objectSpread","variations","key","variant","css","attrs","defaults","mergeWithoutNullable","componentProps","props","Object","keys","reduce","acc","_defineProperty","undefined","includes","component","config","Comp","layout","_component","React","forwardRef","ref","mergedProps","createEl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,GAAG,EAAEA,GAAAA;AAAI,KAAA,CAAE,CAAC,CAAA;AAC9C,GAAC,CAAC,CAAA;AACN;;;;"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@salutejs/plasma-new-hope",
|
3
|
-
"version": "0.336.0-canary.2219.
|
3
|
+
"version": "0.336.0-canary.2219.17638454714.0",
|
4
4
|
"description": "Salute Design System blueprint",
|
5
5
|
"main": "cjs/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -137,5 +137,5 @@
|
|
137
137
|
"sideEffects": [
|
138
138
|
"*.css"
|
139
139
|
],
|
140
|
-
"gitHead": "
|
140
|
+
"gitHead": "7f9b216bb858c0c4dbbc12f5ca72fcd9d33bdeaf"
|
141
141
|
}
|
@@ -99,10 +99,23 @@ var mergeConfig = function(baseConfig, userConfig) {
|
|
99
99
|
}
|
100
100
|
return res;
|
101
101
|
};
|
102
|
+
// INFO: Метод, который проводит слияние двух объектов
|
103
|
+
// INFO: если значение явно указанно как undefined/null/пустая строка, то будет взято значение указанное в default
|
104
|
+
function mergeWithoutNullable(defaults, componentProps) {
|
105
|
+
var props = Object.keys(defaults).reduce(function(acc, key) {
|
106
|
+
return _object_spread_props(_object_spread({}, acc), _define_property({}, key, [
|
107
|
+
null,
|
108
|
+
undefined,
|
109
|
+
''
|
110
|
+
].includes(componentProps[key]) ? defaults[key] : componentProps[key]));
|
111
|
+
}, {});
|
112
|
+
return _object_spread({}, componentProps, props);
|
113
|
+
}
|
102
114
|
function component(config) {
|
103
115
|
var Comp = config.layout((0, _styledcomponents._component)(config));
|
104
116
|
return /*#__PURE__*/ _react.default.forwardRef(function(props, ref) {
|
105
|
-
|
117
|
+
var mergedProps = mergeWithoutNullable(config === null || config === void 0 ? void 0 : config.defaults, props);
|
118
|
+
return /*#__PURE__*/ _react.default.createElement(Comp, _object_spread_props(_object_spread({}, mergedProps), {
|
106
119
|
ref: ref
|
107
120
|
}));
|
108
121
|
});
|
@@ -76,10 +76,23 @@ export var mergeConfig = function(baseConfig, userConfig) {
|
|
76
76
|
}
|
77
77
|
return res;
|
78
78
|
};
|
79
|
+
// INFO: Метод, который проводит слияние двух объектов
|
80
|
+
// INFO: если значение явно указанно как undefined/null/пустая строка, то будет взято значение указанное в default
|
81
|
+
function mergeWithoutNullable(defaults, componentProps) {
|
82
|
+
var props = Object.keys(defaults).reduce(function(acc, key) {
|
83
|
+
return _object_spread_props(_object_spread({}, acc), _define_property({}, key, [
|
84
|
+
null,
|
85
|
+
undefined,
|
86
|
+
''
|
87
|
+
].includes(componentProps[key]) ? defaults[key] : componentProps[key]));
|
88
|
+
}, {});
|
89
|
+
return _object_spread({}, componentProps, props);
|
90
|
+
}
|
79
91
|
export function component(config) {
|
80
92
|
var Comp = config.layout(_component(config));
|
81
93
|
return /*#__PURE__*/ React.forwardRef(function(props, ref) {
|
82
|
-
|
94
|
+
var mergedProps = mergeWithoutNullable(config === null || config === void 0 ? void 0 : config.defaults, props);
|
95
|
+
return /*#__PURE__*/ React.createElement(Comp, _object_spread_props(_object_spread({}, mergedProps), {
|
83
96
|
ref: ref
|
84
97
|
}));
|
85
98
|
});
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import { component, mergeConfig } from "../../../engines";
|
2
|
-
import { comboboxNewConfig } from "../../..";
|
3
|
-
import { config } from "./Combobox.config";
|
4
|
-
var mergedConfig = mergeConfig(comboboxNewConfig, config);
|
5
|
-
var ComboboxComponent = component(mergedConfig);
|
6
|
-
var Combobox = ComboboxComponent;
|
7
|
-
export { Combobox };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"NumberFormat.d.ts","sourceRoot":"","sources":["../../../src/components/NumberFormat/NumberFormat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,EAAE,EAAkB,MAAM,OAAO,CAAC;AAE7D,OAAO,KAAK,EAAE,kBAAkB,EAAc,MAAM,qBAAqB,CAAC;AAG1E,OAAO,KAAK,EAER,wBAAwB,EACxB,0BAA0B,EAC7B,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,0BAA0B,kBAAkB,EAAE,CAAC,CAAC,CAAC;;;;;;;;;qBA+
|
1
|
+
{"version":3,"file":"NumberFormat.d.ts","sourceRoot":"","sources":["../../../src/components/NumberFormat/NumberFormat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,EAAE,EAAkB,MAAM,OAAO,CAAC;AAE7D,OAAO,KAAK,EAAE,kBAAkB,EAAc,MAAM,qBAAqB,CAAC;AAG1E,OAAO,KAAK,EAER,wBAAwB,EACxB,0BAA0B,EAC7B,MAAM,sBAAsB,CAAC;AAE9B,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,0BAA0B,kBAAkB,EAAE,CAAC,CAAC,CAAC;;;;;;;;;qBA+C3D,CAAC,uCAEb,CAAhB;mGA+BP,CAAC"}
|
@@ -47,7 +47,7 @@ export type CustomNumberFormatProps = {
|
|
47
47
|
*/
|
48
48
|
isAllowed?: (values: NumberFormatValues) => boolean;
|
49
49
|
/**
|
50
|
-
*
|
50
|
+
* Callback, вызываемый при изменении значения в поле ввода.
|
51
51
|
* Принимает событие изменения (ChangeEvent) и объект NumberFormatValues:
|
52
52
|
* ```
|
53
53
|
* floatValue: number | undefined;
|
@@ -211,11 +211,11 @@ export type TextFieldPropsBase = {
|
|
211
211
|
*/
|
212
212
|
contentRight?: React.ReactElement;
|
213
213
|
/**
|
214
|
-
* Слот для вспомогательного текста
|
214
|
+
* Слот для вспомогательного текста слева.
|
215
215
|
*/
|
216
216
|
textBefore?: string;
|
217
217
|
/**
|
218
|
-
* Слот для вспомогательного текста
|
218
|
+
* Слот для вспомогательного текста справа.
|
219
219
|
*/
|
220
220
|
textAfter?: string;
|
221
221
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/engines/common.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EACR,eAAe,EACf,WAAW,EACX,SAAS,EACT,QAAQ,EACR,6BAA6B,EAC7B,4CAA4C,EAC/C,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,WAAW,GACpB,GAAG,SAAS,WAAW,EACvB,WAAW,SAAS,QAAQ,EAC5B,aAAa,SAAS,SAAS,CAAC,WAAW,CAAC,EAC5C,eAAe,SACT,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,GACjC,6BAA6B,CAAC,WAAW,CAAC,GAC1C,4CAA4C,CAAC,WAAW,CAAC,EAC/D,eAAe,SACT,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,GACjC,6BAA6B,CAAC,WAAW,CAAC,GAC1C,4CAA4C,CAAC,WAAW,CAAC,GACzD,SAAS,0BAEH,eAAe,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,GAAG,eAAe,EAAE,eAAe,CAAC,eAC3E,OAAO,CAAC,eAAe,CAAC,GAAG,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC,KA6BzE,eAAe,CACzB,GAAG,EACH,WAAW,EACX,SAAS,CAAC,WAAW,CAAC,EACtB,eAAe,SAAS,SAAS,GAAG,eAAe,GAAG,eAAe,CAE5E,CAAC;
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/engines/common.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EACR,eAAe,EACf,WAAW,EACX,SAAS,EACT,QAAQ,EACR,6BAA6B,EAC7B,4CAA4C,EAC/C,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,WAAW,GACpB,GAAG,SAAS,WAAW,EACvB,WAAW,SAAS,QAAQ,EAC5B,aAAa,SAAS,SAAS,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