@skbkontur/react-ui 4.22.3 → 4.22.4

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +16 -2
  2. package/cjs/components/Calendar/DayCellView.js +1 -1
  3. package/cjs/components/Calendar/DayCellView.js.map +1 -1
  4. package/cjs/components/Kebab/Kebab.js +6 -1
  5. package/cjs/components/Kebab/Kebab.js.map +1 -1
  6. package/cjs/components/Link/Link.js +2 -1
  7. package/cjs/components/Link/Link.js.map +1 -1
  8. package/cjs/components/MenuItem/MenuItem.js +1 -1
  9. package/cjs/components/MenuItem/MenuItem.js.map +1 -1
  10. package/cjs/components/Paging/Paging.js +8 -3
  11. package/cjs/components/Paging/Paging.js.map +1 -1
  12. package/cjs/components/Tabs/Tab.js +1 -1
  13. package/cjs/components/Tabs/Tab.js.map +1 -1
  14. package/cjs/internal/CommonWrapper/CommonWrapper.js +2 -2
  15. package/cjs/internal/CommonWrapper/CommonWrapper.js.map +1 -1
  16. package/cjs/internal/CommonWrapper/{extractCommonProps.d.ts → utils/extractCommonProps.d.ts} +2 -2
  17. package/cjs/internal/CommonWrapper/utils/extractCommonProps.js.map +1 -0
  18. package/cjs/internal/CommonWrapper/{getCommonVisualStateDataAttributes.js → utils/getCommonVisualStateDataAttributes.js} +3 -4
  19. package/cjs/internal/CommonWrapper/utils/getCommonVisualStateDataAttributes.js.map +1 -0
  20. package/cjs/internal/CommonWrapper/{getVisualStateDataAttributes.d.ts → utils/getVisualStateDataAttributes.d.ts} +1 -1
  21. package/cjs/internal/CommonWrapper/{getVisualStateDataAttributes.js → utils/getVisualStateDataAttributes.js} +3 -3
  22. package/cjs/internal/CommonWrapper/utils/getVisualStateDataAttributes.js.map +1 -0
  23. package/cjs/internal/CommonWrapper/utils/tryGetBoolean.d.ts +1 -0
  24. package/cjs/internal/CommonWrapper/utils/tryGetBoolean.js +1 -0
  25. package/cjs/internal/CommonWrapper/utils/tryGetBoolean.js.map +1 -0
  26. package/components/Calendar/DayCellView/DayCellView.js +1 -1
  27. package/components/Calendar/DayCellView/DayCellView.js.map +1 -1
  28. package/components/Kebab/Kebab/Kebab.js +4 -1
  29. package/components/Kebab/Kebab/Kebab.js.map +1 -1
  30. package/components/Link/Link/Link.js +4 -1
  31. package/components/Link/Link/Link.js.map +1 -1
  32. package/components/MenuItem/MenuItem/MenuItem.js +1 -1
  33. package/components/MenuItem/MenuItem/MenuItem.js.map +1 -1
  34. package/components/Paging/Paging/Paging.js +8 -4
  35. package/components/Paging/Paging/Paging.js.map +1 -1
  36. package/components/Tabs/Tab/Tab.js +2 -2
  37. package/components/Tabs/Tab/Tab.js.map +1 -1
  38. package/internal/CommonWrapper/CommonWrapper/CommonWrapper.js +2 -2
  39. package/internal/CommonWrapper/CommonWrapper/CommonWrapper.js.map +1 -1
  40. package/internal/CommonWrapper/utils/extractCommonProps/extractCommonProps.js.map +1 -0
  41. package/internal/CommonWrapper/{extractCommonProps → utils/extractCommonProps}/package.json +1 -1
  42. package/internal/CommonWrapper/{extractCommonProps.d.ts → utils/extractCommonProps.d.ts} +2 -2
  43. package/internal/CommonWrapper/{getCommonVisualStateDataAttributes → utils/getCommonVisualStateDataAttributes}/getCommonVisualStateDataAttributes.js +1 -5
  44. package/internal/CommonWrapper/utils/getCommonVisualStateDataAttributes/getCommonVisualStateDataAttributes.js.map +1 -0
  45. package/internal/CommonWrapper/{getCommonVisualStateDataAttributes → utils/getCommonVisualStateDataAttributes}/package.json +1 -1
  46. package/internal/CommonWrapper/{getVisualStateDataAttributes → utils/getVisualStateDataAttributes}/getVisualStateDataAttributes.js +3 -3
  47. package/internal/CommonWrapper/utils/getVisualStateDataAttributes/getVisualStateDataAttributes.js.map +1 -0
  48. package/internal/CommonWrapper/{getVisualStateDataAttributes → utils/getVisualStateDataAttributes}/package.json +1 -1
  49. package/internal/CommonWrapper/{getVisualStateDataAttributes.d.ts → utils/getVisualStateDataAttributes.d.ts} +1 -1
  50. package/internal/CommonWrapper/utils/tryGetBoolean/package.json +6 -0
  51. package/internal/CommonWrapper/utils/tryGetBoolean/tryGetBoolean.js +3 -0
  52. package/internal/CommonWrapper/utils/tryGetBoolean/tryGetBoolean.js.map +1 -0
  53. package/internal/CommonWrapper/utils/tryGetBoolean.d.ts +1 -0
  54. package/package.json +3 -3
  55. package/cjs/internal/CommonWrapper/extractCommonProps.js.map +0 -1
  56. package/cjs/internal/CommonWrapper/getCommonVisualStateDataAttributes.js.map +0 -1
  57. package/cjs/internal/CommonWrapper/getVisualStateDataAttributes.js.map +0 -1
  58. package/internal/CommonWrapper/extractCommonProps/extractCommonProps.js.map +0 -1
  59. package/internal/CommonWrapper/getCommonVisualStateDataAttributes/getCommonVisualStateDataAttributes.js.map +0 -1
  60. package/internal/CommonWrapper/getVisualStateDataAttributes/getVisualStateDataAttributes.js.map +0 -1
  61. /package/cjs/internal/CommonWrapper/{extractCommonProps.js → utils/extractCommonProps.js} +0 -0
  62. /package/cjs/internal/CommonWrapper/{getCommonVisualStateDataAttributes.d.ts → utils/getCommonVisualStateDataAttributes.d.ts} +0 -0
  63. /package/internal/CommonWrapper/{extractCommonProps → utils/extractCommonProps}/extractCommonProps.js +0 -0
  64. /package/internal/CommonWrapper/{getCommonVisualStateDataAttributes.d.ts → utils/getCommonVisualStateDataAttributes.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["extractCommonProps.ts"],"names":["extractCommonProps","props","common","rest","prop","isCommonProp","indexOf"],"mappings":";;;AAGA,OAAO,IAAMA,kBAAkB,GAAG,SAArBA,kBAAqB;AAChCC,KADgC;AAEoB;AACpD,MAAMC,MAAM,GAAG,EAAf;AACA,MAAMC,IAAI,GAAG,EAAb;;AAEA,OAAK,IAAMC,IAAX,IAAmBH,KAAnB,EAA0B;AACxB,QAAII,YAAY,CAACD,IAAD,CAAhB,EAA4D;AAC1D;AACAF,MAAAA,MAAM,CAACE,IAAD,CAAN,GAAeH,KAAK,CAACG,IAAD,CAApB;AACD,KAHD,MAGO;AACL;AACAD,MAAAA,IAAI,CAACC,IAAD,CAAJ,GAAaH,KAAK,CAACG,IAAD,CAAlB;AACD;AACF;;AAED,SAAO,CAACF,MAAD,EAASC,IAAT,CAAP;AACD,CAjBM;;AAmBP,IAAME,YAAY,GAAG,SAAfA,YAAe,CAACD,IAAD,EAA4C;AAC/D,UAAQ,IAAR;AACE,SAAKA,IAAI,KAAK,WAAd;AACA,SAAKA,IAAI,KAAK,OAAd;AACA,SAAKA,IAAI,KAAK,aAAd;AACA,SAAKA,IAAI,KAAK,UAAd;AACA,SAAKA,IAAI,CAACE,OAAL,CAAa,OAAb,MAA0B,CAA/B,EAAkC;AAChC,aAAO,IAAP;AACF;AACE,aAAO,KAAP,CARJ;;AAUD,CAXD","sourcesContent":["import type { NotCommonProps } from '../types';\nimport type { CommonPropsWithRootNodeRef } from '../CommonWrapper';\n\nexport const extractCommonProps = <P extends CommonPropsWithRootNodeRef>(\n props: P,\n): [CommonPropsWithRootNodeRef, NotCommonProps<P>] => {\n const common = {} as CommonPropsWithRootNodeRef;\n const rest = {} as NotCommonProps<P>;\n\n for (const prop in props) {\n if (isCommonProp(prop as keyof CommonPropsWithRootNodeRef)) {\n // @ts-expect-error: See: https://github.com/skbkontur/retail-ui/pull/2257#discussion_r565275843 and https://github.com/skbkontur/retail-ui/pull/2257#discussion_r569542736.\n common[prop] = props[prop];\n } else {\n // @ts-expect-error: Read the comment above.\n rest[prop] = props[prop];\n }\n }\n\n return [common, rest];\n};\n\nconst isCommonProp = (prop: keyof CommonPropsWithRootNodeRef) => {\n switch (true) {\n case prop === 'className':\n case prop === 'style':\n case prop === 'rootNodeRef':\n case prop === 'children':\n case prop.indexOf('data-') === 0: // все data-атрибуты\n return true;\n default:\n return false;\n }\n};\n"]}
@@ -1,5 +1,5 @@
1
1
  {
2
- "main": "../../../cjs/internal/CommonWrapper/extractCommonProps.js",
2
+ "main": "../../../../cjs/internal/CommonWrapper/utils/extractCommonProps.js",
3
3
  "module": "extractCommonProps",
4
4
  "types": "../extractCommonProps.d.ts",
5
5
  "sideEffects": false
@@ -1,3 +1,3 @@
1
- import type { NotCommonProps } from './types';
2
- import type { CommonPropsWithRootNodeRef } from './CommonWrapper';
1
+ import type { NotCommonProps } from '../types';
2
+ import type { CommonPropsWithRootNodeRef } from '../CommonWrapper';
3
3
  export declare const extractCommonProps: <P extends CommonPropsWithRootNodeRef>(props: P) => [CommonPropsWithRootNodeRef, NotCommonProps<P>];
@@ -1,9 +1,5 @@
1
1
  import { getVisualStateDataAttributes } from "../getVisualStateDataAttributes";
2
-
3
- var tryGetBoolean = function tryGetBoolean(value) {
4
- return typeof value === 'boolean' ? value : undefined;
5
- };
6
-
2
+ import { tryGetBoolean } from "../tryGetBoolean";
7
3
  export function getCommonVisualStateDataAttributes(componentProps) {
8
4
  return getVisualStateDataAttributes({
9
5
  error: tryGetBoolean(componentProps['error']),
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["getCommonVisualStateDataAttributes.ts"],"names":["getVisualStateDataAttributes","tryGetBoolean","getCommonVisualStateDataAttributes","componentProps","error","warning"],"mappings":"AAAA,SAASA,4BAAT,QAAkF,gCAAlF;AACA,SAASC,aAAT,QAA8B,iBAA9B;;AAEA,OAAO,SAASC,kCAAT;AACLC,cADK;AAEgC;AACrC,SAAOH,4BAA4B,CAAC;AAClCI,IAAAA,KAAK,EAAEH,aAAa,CAACE,cAAc,CAAC,OAAD,CAAf,CADc;AAElCE,IAAAA,OAAO,EAAEJ,aAAa,CAACE,cAAc,CAAC,SAAD,CAAf,CAFY,EAAD,CAAnC;;AAID","sourcesContent":["import { getVisualStateDataAttributes, VisualStateDataAttributesResultType } from './getVisualStateDataAttributes';\nimport { tryGetBoolean } from './tryGetBoolean';\n\nexport function getCommonVisualStateDataAttributes(\n componentProps: Record<string, unknown>,\n): VisualStateDataAttributesResultType {\n return getVisualStateDataAttributes({\n error: tryGetBoolean(componentProps['error']),\n warning: tryGetBoolean(componentProps['warning']),\n });\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  {
2
- "main": "../../../cjs/internal/CommonWrapper/getCommonVisualStateDataAttributes.js",
2
+ "main": "../../../../cjs/internal/CommonWrapper/utils/getCommonVisualStateDataAttributes.js",
3
3
  "module": "getCommonVisualStateDataAttributes",
4
4
  "types": "../getCommonVisualStateDataAttributes.d.ts",
5
5
  "sideEffects": false
@@ -1,9 +1,9 @@
1
- import { toKebabCase } from "../../../lib/toKebabCase";
1
+ import { toKebabCase } from "../../../../lib/toKebabCase";
2
2
  var prefix = "data-visual-state-";
3
3
 
4
4
  function fillResult(result, key, value) {
5
- if (value !== null && value !== undefined) {
6
- result["" + prefix + toKebabCase(key)] = String(value);
5
+ if (value) {
6
+ result["" + prefix + toKebabCase(key)] = '';
7
7
  }
8
8
 
9
9
  return result;
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["getVisualStateDataAttributes.ts"],"names":["toKebabCase","prefix","fillResult","result","key","value","getVisualStateDataAttributes","attributes","Object","entries","reduce","previousValue","currentValue"],"mappings":"AAAA,SAASA,WAAT,QAA4B,0BAA5B;;;;;AAKA,IAAMC,MAAM,uBAAZ;;AAEA,SAASC,UAAT,CAAoBC,MAApB,EAAiEC,GAAjE,EAA8EC,KAA9E,EAAwG;AACtG,MAAIA,KAAJ,EAAW;AACTF,IAAAA,MAAM,MAAIF,MAAJ,GAAaD,WAAW,CAACI,GAAD,CAAxB,CAAN,GAAyC,EAAzC;AACD;;AAED,SAAOD,MAAP;AACD;;AAED,OAAO,SAASG,4BAAT;AACLC,UADK;AAEgC;AACrC,SAAOC,MAAM,CAACC,OAAP,CAAeF,UAAf,EAA2BG,MAA3B;AACL,YAACC,aAAD,EAAgBC,YAAhB,UAAiCV,UAAU,CAACS,aAAD,EAAgBC,YAAY,CAAC,CAAD,CAA5B,EAAiCA,YAAY,CAAC,CAAD,CAA7C,CAA3C,EADK;AAEL,IAFK,CAAP;;AAID","sourcesContent":["import { toKebabCase } from '../../../lib/toKebabCase';\nimport { Nullable } from '../../../typings/utility-types';\n\nexport type VisualStateDataAttributesResultType = Record<string, string>;\n\nconst prefix = `data-visual-state-`;\n\nfunction fillResult(result: VisualStateDataAttributesResultType, key: string, value: Nullable<boolean>) {\n if (value) {\n result[`${prefix}${toKebabCase(key)}`] = '';\n }\n\n return result;\n}\n\nexport function getVisualStateDataAttributes<T extends Record<string, Nullable<boolean>>>(\n attributes: T,\n): VisualStateDataAttributesResultType {\n return Object.entries(attributes).reduce(\n (previousValue, currentValue) => fillResult(previousValue, currentValue[0], currentValue[1]),\n {},\n );\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  {
2
- "main": "../../../cjs/internal/CommonWrapper/getVisualStateDataAttributes.js",
2
+ "main": "../../../../cjs/internal/CommonWrapper/utils/getVisualStateDataAttributes.js",
3
3
  "module": "getVisualStateDataAttributes",
4
4
  "types": "../getVisualStateDataAttributes.d.ts",
5
5
  "sideEffects": false
@@ -1,3 +1,3 @@
1
- import type { Nullable } from '../../typings/utility-types';
1
+ import { Nullable } from '../../../typings/utility-types';
2
2
  export declare type VisualStateDataAttributesResultType = Record<string, string>;
3
3
  export declare function getVisualStateDataAttributes<T extends Record<string, Nullable<boolean>>>(attributes: T): VisualStateDataAttributesResultType;
@@ -0,0 +1,6 @@
1
+ {
2
+ "main": "../../../../cjs/internal/CommonWrapper/utils/tryGetBoolean.js",
3
+ "module": "tryGetBoolean",
4
+ "types": "../tryGetBoolean.d.ts",
5
+ "sideEffects": false
6
+ }
@@ -0,0 +1,3 @@
1
+ export var tryGetBoolean = function tryGetBoolean(value) {
2
+ return typeof value === 'boolean' ? value : undefined;
3
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["tryGetBoolean.ts"],"names":["tryGetBoolean","value","undefined"],"mappings":"AAAA,OAAO,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD,UAA0C,OAAOA,KAAP,KAAiB,SAAjB,GAA6BA,KAA7B,GAAqCC,SAA/E,EAAtB","sourcesContent":["export const tryGetBoolean = (value: unknown): boolean | undefined => (typeof value === 'boolean' ? value : undefined);\n"]}
@@ -0,0 +1 @@
1
+ export declare const tryGetBoolean: (value: unknown) => boolean | undefined;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@skbkontur/react-ui",
3
- "version": "4.22.3",
3
+ "version": "4.22.4",
4
4
  "description": "UI Components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "index.js",
7
7
  "sideEffects": false,
8
- "homepage": "https://tech.skbkontur.ru/react-ui/4.22.3/",
8
+ "homepage": "https://tech.skbkontur.ru/react-ui/4.22.4/",
9
9
  "repository": {
10
10
  "type": "git",
11
11
  "url": "git@github.com:skbkontur/retail-ui.git"
@@ -154,6 +154,6 @@
154
154
  "react-dom": ">=16.9"
155
155
  },
156
156
  "publishConfig": {
157
- "tag": "old-version"
157
+ "tag": "latest"
158
158
  }
159
159
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["extractCommonProps.ts"],"names":["extractCommonProps","props","common","rest","prop","isCommonProp","indexOf"],"mappings":";;;AAGO,IAAMA,kBAAkB,GAAG,SAArBA,kBAAqB;AAChCC,KADgC;AAEoB;AACpD,MAAMC,MAAM,GAAG,EAAf;AACA,MAAMC,IAAI,GAAG,EAAb;;AAEA,OAAK,IAAMC,IAAX,IAAmBH,KAAnB,EAA0B;AACxB,QAAII,YAAY,CAACD,IAAD,CAAhB,EAA4D;AAC1D;AACAF,MAAAA,MAAM,CAACE,IAAD,CAAN,GAAeH,KAAK,CAACG,IAAD,CAApB;AACD,KAHD,MAGO;AACL;AACAD,MAAAA,IAAI,CAACC,IAAD,CAAJ,GAAaH,KAAK,CAACG,IAAD,CAAlB;AACD;AACF;;AAED,SAAO,CAACF,MAAD,EAASC,IAAT,CAAP;AACD,CAjBM,C;;AAmBP,IAAME,YAAY,GAAG,SAAfA,YAAe,CAACD,IAAD,EAA4C;AAC/D,UAAQ,IAAR;AACE,SAAKA,IAAI,KAAK,WAAd;AACA,SAAKA,IAAI,KAAK,OAAd;AACA,SAAKA,IAAI,KAAK,aAAd;AACA,SAAKA,IAAI,KAAK,UAAd;AACA,SAAKA,IAAI,CAACE,OAAL,CAAa,OAAb,MAA0B,CAA/B,EAAkC;AAChC,aAAO,IAAP;AACF;AACE,aAAO,KAAP,CARJ;;AAUD,CAXD","sourcesContent":["import type { NotCommonProps } from './types';\nimport type { CommonPropsWithRootNodeRef } from './CommonWrapper';\n\nexport const extractCommonProps = <P extends CommonPropsWithRootNodeRef>(\n props: P,\n): [CommonPropsWithRootNodeRef, NotCommonProps<P>] => {\n const common = {} as CommonPropsWithRootNodeRef;\n const rest = {} as NotCommonProps<P>;\n\n for (const prop in props) {\n if (isCommonProp(prop as keyof CommonPropsWithRootNodeRef)) {\n // @ts-expect-error: See: https://github.com/skbkontur/retail-ui/pull/2257#discussion_r565275843 and https://github.com/skbkontur/retail-ui/pull/2257#discussion_r569542736.\n common[prop] = props[prop];\n } else {\n // @ts-expect-error: Read the comment above.\n rest[prop] = props[prop];\n }\n }\n\n return [common, rest];\n};\n\nconst isCommonProp = (prop: keyof CommonPropsWithRootNodeRef) => {\n switch (true) {\n case prop === 'className':\n case prop === 'style':\n case prop === 'rootNodeRef':\n case prop === 'children':\n case prop.indexOf('data-') === 0: // все data-атрибуты\n return true;\n default:\n return false;\n }\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["getCommonVisualStateDataAttributes.ts"],"names":["tryGetBoolean","value","undefined","getCommonVisualStateDataAttributes","componentProps","error","warning"],"mappings":"uHAAA;;AAEA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD,UAA0C,OAAOA,KAAP,KAAiB,SAAjB,GAA6BA,KAA7B,GAAqCC,SAA/E,EAAtB;;AAEO,SAASC,kCAAT;AACLC,cADK;AAEgC;AACrC,SAAO,gEAA6B;AAClCC,IAAAA,KAAK,EAAEL,aAAa,CAACI,cAAc,CAAC,OAAD,CAAf,CADc;AAElCE,IAAAA,OAAO,EAAEN,aAAa,CAACI,cAAc,CAAC,SAAD,CAAf,CAFY,EAA7B,CAAP;;AAID","sourcesContent":["import { getVisualStateDataAttributes, VisualStateDataAttributesResultType } from './getVisualStateDataAttributes';\n\nconst tryGetBoolean = (value: unknown): boolean | undefined => (typeof value === 'boolean' ? value : undefined);\n\nexport function getCommonVisualStateDataAttributes(\n componentProps: Record<string, unknown>,\n): VisualStateDataAttributesResultType {\n return getVisualStateDataAttributes({\n error: tryGetBoolean(componentProps['error']),\n warning: tryGetBoolean(componentProps['warning']),\n });\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["getVisualStateDataAttributes.ts"],"names":["prefix","fillResult","result","key","value","undefined","String","getVisualStateDataAttributes","attributes","Object","entries","reduce","previousValue","currentValue"],"mappings":"2GAAA;;;;;AAKA,IAAMA,MAAM,uBAAZ;;AAEA,SAASC,UAAT,CAAoBC,MAApB,EAAiEC,GAAjE,EAA8EC,KAA9E,EAA8F;AAC5F,MAAIA,KAAK,KAAK,IAAV,IAAkBA,KAAK,KAAKC,SAAhC,EAA2C;AACzCH,IAAAA,MAAM,MAAIF,MAAJ,GAAa,8BAAYG,GAAZ,CAAb,CAAN,GAAyCG,MAAM,CAACF,KAAD,CAA/C;AACD;;AAED,SAAOF,MAAP;AACD;;AAEM,SAASK,4BAAT;AACLC,UADK;AAEgC;AACrC,SAAOC,MAAM,CAACC,OAAP,CAAeF,UAAf,EAA2BG,MAA3B;AACL,YAACC,aAAD,EAAgBC,YAAhB,UAAiCZ,UAAU,CAACW,aAAD,EAAgBC,YAAY,CAAC,CAAD,CAA5B,EAAiCA,YAAY,CAAC,CAAD,CAA7C,CAA3C,EADK;AAEL,IAFK,CAAP;;AAID","sourcesContent":["import { toKebabCase } from '../../lib/toKebabCase';\nimport type { Nullable } from '../../typings/utility-types';\n\nexport type VisualStateDataAttributesResultType = Record<string, string>;\n\nconst prefix = `data-visual-state-`;\n\nfunction fillResult(result: VisualStateDataAttributesResultType, key: string, value: unknown) {\n if (value !== null && value !== undefined) {\n result[`${prefix}${toKebabCase(key)}`] = String(value);\n }\n\n return result;\n}\n\nexport function getVisualStateDataAttributes<T extends Record<string, Nullable<boolean>>>(\n attributes: T,\n): VisualStateDataAttributesResultType {\n return Object.entries(attributes).reduce(\n (previousValue, currentValue) => fillResult(previousValue, currentValue[0], currentValue[1]),\n {},\n );\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["extractCommonProps.ts"],"names":["extractCommonProps","props","common","rest","prop","isCommonProp","indexOf"],"mappings":";;;AAGA,OAAO,IAAMA,kBAAkB,GAAG,SAArBA,kBAAqB;AAChCC,KADgC;AAEoB;AACpD,MAAMC,MAAM,GAAG,EAAf;AACA,MAAMC,IAAI,GAAG,EAAb;;AAEA,OAAK,IAAMC,IAAX,IAAmBH,KAAnB,EAA0B;AACxB,QAAII,YAAY,CAACD,IAAD,CAAhB,EAA4D;AAC1D;AACAF,MAAAA,MAAM,CAACE,IAAD,CAAN,GAAeH,KAAK,CAACG,IAAD,CAApB;AACD,KAHD,MAGO;AACL;AACAD,MAAAA,IAAI,CAACC,IAAD,CAAJ,GAAaH,KAAK,CAACG,IAAD,CAAlB;AACD;AACF;;AAED,SAAO,CAACF,MAAD,EAASC,IAAT,CAAP;AACD,CAjBM;;AAmBP,IAAME,YAAY,GAAG,SAAfA,YAAe,CAACD,IAAD,EAA4C;AAC/D,UAAQ,IAAR;AACE,SAAKA,IAAI,KAAK,WAAd;AACA,SAAKA,IAAI,KAAK,OAAd;AACA,SAAKA,IAAI,KAAK,aAAd;AACA,SAAKA,IAAI,KAAK,UAAd;AACA,SAAKA,IAAI,CAACE,OAAL,CAAa,OAAb,MAA0B,CAA/B,EAAkC;AAChC,aAAO,IAAP;AACF;AACE,aAAO,KAAP,CARJ;;AAUD,CAXD","sourcesContent":["import type { NotCommonProps } from './types';\nimport type { CommonPropsWithRootNodeRef } from './CommonWrapper';\n\nexport const extractCommonProps = <P extends CommonPropsWithRootNodeRef>(\n props: P,\n): [CommonPropsWithRootNodeRef, NotCommonProps<P>] => {\n const common = {} as CommonPropsWithRootNodeRef;\n const rest = {} as NotCommonProps<P>;\n\n for (const prop in props) {\n if (isCommonProp(prop as keyof CommonPropsWithRootNodeRef)) {\n // @ts-expect-error: See: https://github.com/skbkontur/retail-ui/pull/2257#discussion_r565275843 and https://github.com/skbkontur/retail-ui/pull/2257#discussion_r569542736.\n common[prop] = props[prop];\n } else {\n // @ts-expect-error: Read the comment above.\n rest[prop] = props[prop];\n }\n }\n\n return [common, rest];\n};\n\nconst isCommonProp = (prop: keyof CommonPropsWithRootNodeRef) => {\n switch (true) {\n case prop === 'className':\n case prop === 'style':\n case prop === 'rootNodeRef':\n case prop === 'children':\n case prop.indexOf('data-') === 0: // все data-атрибуты\n return true;\n default:\n return false;\n }\n};\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["getCommonVisualStateDataAttributes.ts"],"names":["getVisualStateDataAttributes","tryGetBoolean","value","undefined","getCommonVisualStateDataAttributes","componentProps","error","warning"],"mappings":"AAAA,SAASA,4BAAT,QAAkF,gCAAlF;;AAEA,IAAMC,aAAa,GAAG,SAAhBA,aAAgB,CAACC,KAAD,UAA0C,OAAOA,KAAP,KAAiB,SAAjB,GAA6BA,KAA7B,GAAqCC,SAA/E,EAAtB;;AAEA,OAAO,SAASC,kCAAT;AACLC,cADK;AAEgC;AACrC,SAAOL,4BAA4B,CAAC;AAClCM,IAAAA,KAAK,EAAEL,aAAa,CAACI,cAAc,CAAC,OAAD,CAAf,CADc;AAElCE,IAAAA,OAAO,EAAEN,aAAa,CAACI,cAAc,CAAC,SAAD,CAAf,CAFY,EAAD,CAAnC;;AAID","sourcesContent":["import { getVisualStateDataAttributes, VisualStateDataAttributesResultType } from './getVisualStateDataAttributes';\n\nconst tryGetBoolean = (value: unknown): boolean | undefined => (typeof value === 'boolean' ? value : undefined);\n\nexport function getCommonVisualStateDataAttributes(\n componentProps: Record<string, unknown>,\n): VisualStateDataAttributesResultType {\n return getVisualStateDataAttributes({\n error: tryGetBoolean(componentProps['error']),\n warning: tryGetBoolean(componentProps['warning']),\n });\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["getVisualStateDataAttributes.ts"],"names":["toKebabCase","prefix","fillResult","result","key","value","undefined","String","getVisualStateDataAttributes","attributes","Object","entries","reduce","previousValue","currentValue"],"mappings":"AAAA,SAASA,WAAT,QAA4B,uBAA5B;;;;;AAKA,IAAMC,MAAM,uBAAZ;;AAEA,SAASC,UAAT,CAAoBC,MAApB,EAAiEC,GAAjE,EAA8EC,KAA9E,EAA8F;AAC5F,MAAIA,KAAK,KAAK,IAAV,IAAkBA,KAAK,KAAKC,SAAhC,EAA2C;AACzCH,IAAAA,MAAM,MAAIF,MAAJ,GAAaD,WAAW,CAACI,GAAD,CAAxB,CAAN,GAAyCG,MAAM,CAACF,KAAD,CAA/C;AACD;;AAED,SAAOF,MAAP;AACD;;AAED,OAAO,SAASK,4BAAT;AACLC,UADK;AAEgC;AACrC,SAAOC,MAAM,CAACC,OAAP,CAAeF,UAAf,EAA2BG,MAA3B;AACL,YAACC,aAAD,EAAgBC,YAAhB,UAAiCZ,UAAU,CAACW,aAAD,EAAgBC,YAAY,CAAC,CAAD,CAA5B,EAAiCA,YAAY,CAAC,CAAD,CAA7C,CAA3C,EADK;AAEL,IAFK,CAAP;;AAID","sourcesContent":["import { toKebabCase } from '../../lib/toKebabCase';\nimport type { Nullable } from '../../typings/utility-types';\n\nexport type VisualStateDataAttributesResultType = Record<string, string>;\n\nconst prefix = `data-visual-state-`;\n\nfunction fillResult(result: VisualStateDataAttributesResultType, key: string, value: unknown) {\n if (value !== null && value !== undefined) {\n result[`${prefix}${toKebabCase(key)}`] = String(value);\n }\n\n return result;\n}\n\nexport function getVisualStateDataAttributes<T extends Record<string, Nullable<boolean>>>(\n attributes: T,\n): VisualStateDataAttributesResultType {\n return Object.entries(attributes).reduce(\n (previousValue, currentValue) => fillResult(previousValue, currentValue[0], currentValue[1]),\n {},\n );\n}\n"]}