@gravity-ui/chartkit 0.7.2

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 (79) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/LICENSE +21 -0
  3. package/README.md +64 -0
  4. package/build/components/ChartKit.css +4 -0
  5. package/build/components/ChartKit.d.ts +19 -0
  6. package/build/components/ChartKit.js +42 -0
  7. package/build/components/ErrorBoundary/ErrorBoundary.d.ts +18 -0
  8. package/build/components/ErrorBoundary/ErrorBoundary.js +27 -0
  9. package/build/components/ErrorView/ErrorView.d.ts +7 -0
  10. package/build/components/ErrorView/ErrorView.js +6 -0
  11. package/build/components/Loader/Loader.css +7 -0
  12. package/build/components/Loader/Loader.d.ts +6 -0
  13. package/build/components/Loader/Loader.js +9 -0
  14. package/build/constants/common.d.ts +1 -0
  15. package/build/constants/common.js +2 -0
  16. package/build/constants/index.d.ts +1 -0
  17. package/build/constants/index.js +1 -0
  18. package/build/i18n/index.d.ts +7 -0
  19. package/build/i18n/index.js +10 -0
  20. package/build/i18n/keysets/en.json +11 -0
  21. package/build/i18n/keysets/ru.json +11 -0
  22. package/build/index.d.ts +5 -0
  23. package/build/index.js +4 -0
  24. package/build/libs/chartkit-error/__tests__/chartkit-error.d.ts +1 -0
  25. package/build/libs/chartkit-error/__tests__/chartkit-error.js +27 -0
  26. package/build/libs/chartkit-error/chartkit-error.d.ts +16 -0
  27. package/build/libs/chartkit-error/chartkit-error.js +19 -0
  28. package/build/libs/index.d.ts +3 -0
  29. package/build/libs/index.js +2 -0
  30. package/build/libs/settings/__tests__/settings.test.d.ts +1 -0
  31. package/build/libs/settings/__tests__/settings.test.js +7 -0
  32. package/build/libs/settings/settings.d.ts +16 -0
  33. package/build/libs/settings/settings.js +43 -0
  34. package/build/plugins/index.d.ts +4 -0
  35. package/build/plugins/index.js +2 -0
  36. package/build/plugins/indicator/__stories__/Indicator.stories.d.ts +4 -0
  37. package/build/plugins/indicator/__stories__/Indicator.stories.js +45 -0
  38. package/build/plugins/indicator/index.d.ts +2 -0
  39. package/build/plugins/indicator/index.js +5 -0
  40. package/build/plugins/indicator/renderer/IndicatorItem.d.ts +6 -0
  41. package/build/plugins/indicator/renderer/IndicatorItem.js +15 -0
  42. package/build/plugins/indicator/renderer/IndicatorWidget.css +62 -0
  43. package/build/plugins/indicator/renderer/IndicatorWidget.d.ts +6 -0
  44. package/build/plugins/indicator/renderer/IndicatorWidget.js +28 -0
  45. package/build/plugins/indicator/types.d.ts +21 -0
  46. package/build/plugins/indicator/types.js +1 -0
  47. package/build/plugins/yagr/__stories__/Yagr.stories.d.ts +4 -0
  48. package/build/plugins/yagr/__stories__/Yagr.stories.js +21 -0
  49. package/build/plugins/yagr/__stories__/mocks/line10.d.ts +2 -0
  50. package/build/plugins/yagr/__stories__/mocks/line10.js +66 -0
  51. package/build/plugins/yagr/index.d.ts +2 -0
  52. package/build/plugins/yagr/index.js +5 -0
  53. package/build/plugins/yagr/renderer/YagrWidget.css +4 -0
  54. package/build/plugins/yagr/renderer/YagrWidget.d.ts +7 -0
  55. package/build/plugins/yagr/renderer/YagrWidget.js +196 -0
  56. package/build/plugins/yagr/renderer/polyfills.d.ts +1 -0
  57. package/build/plugins/yagr/renderer/polyfills.js +17 -0
  58. package/build/plugins/yagr/renderer/synchronizeTooltipTablesCellsWidth.d.ts +1 -0
  59. package/build/plugins/yagr/renderer/synchronizeTooltipTablesCellsWidth.js +43 -0
  60. package/build/plugins/yagr/renderer/tooltip/helpers/escapeHTML.d.ts +1 -0
  61. package/build/plugins/yagr/renderer/tooltip/helpers/escapeHTML.js +5 -0
  62. package/build/plugins/yagr/renderer/tooltip/tooltip.css +368 -0
  63. package/build/plugins/yagr/renderer/tooltip/tooltip.d.ts +141 -0
  64. package/build/plugins/yagr/renderer/tooltip/tooltip.js +229 -0
  65. package/build/plugins/yagr/types.d.ts +21 -0
  66. package/build/plugins/yagr/types.js +1 -0
  67. package/build/types/index.d.ts +33 -0
  68. package/build/types/index.js +1 -0
  69. package/build/types/widget.d.ts +13 -0
  70. package/build/types/widget.js +1 -0
  71. package/build/utils/__tests__/common.test.d.ts +1 -0
  72. package/build/utils/__tests__/common.test.js +9 -0
  73. package/build/utils/common.d.ts +1 -0
  74. package/build/utils/common.js +8 -0
  75. package/build/utils/index.d.ts +2 -0
  76. package/build/utils/index.js +2 -0
  77. package/build/utils/react.d.ts +1 -0
  78. package/build/utils/react.js +4 -0
  79. package/package.json +93 -0
@@ -0,0 +1,229 @@
1
+ import { i18n } from '../../../../i18n';
2
+ import { escapeHTML } from './helpers/escapeHTML';
3
+ import './tooltip.css';
4
+ export const SERIES_NAME_DATA_ATTRIBUTE = 'data-series-name';
5
+ export const SERIES_IDX_DATA_ATTRIBUTE = 'data-series-idx';
6
+ export const TOOLTIP_CONTAINER_CLASS_NAME = '_tooltip';
7
+ export const TOOLTIP_ROW_NAME_CLASS_NANE = '_tooltip-rows__name-td';
8
+ export const TOOLTIP_ROW_CLASS_NAME = '_tooltip-row';
9
+ export const TOOLTIP_HEADER_CLASS_NAME = '_tooltip-header';
10
+ export const TOOLTIP_LIST_CLASS_NAME = '_tooltip-list';
11
+ export const TOOLTIP_FOOTER_CLASS_NAME = '_tooltip-footer';
12
+ const renderEmptyCell = () => '<td />';
13
+ const renderColorCell = (line) => `<td class="_tooltip-rows__bubble-td">
14
+ <div class="_tooltip-rows__bubble-div" style="background-color:${line.seriesColor};"></div>
15
+ </td>`;
16
+ const renderNameCell = (line) => `<td class="${TOOLTIP_ROW_NAME_CLASS_NANE}">
17
+ ${line.hideSeriesName ? '' : escapeHTML(line.seriesName)}
18
+ </td>`;
19
+ const renderPercentCell = (line) => `<td class="_tooltip-rows__percent-td">
20
+ ${line.percentValue ? line.percentValue + '%' : ''}
21
+ </td>`;
22
+ const renderValueCell = (line) => `<td class="_tooltip-rows__value-td">
23
+ ${line.value}
24
+ </td>`;
25
+ const renderDiffCell = (line) => `<td class="_tooltip-rows__diff-td">
26
+ ${line.diff ? ` (${line.diff})` : ''}
27
+ </td>`;
28
+ const renderAdditionalSection = (data, splitTooltip = false, colspanNumber = 1) => {
29
+ return `<td class="_tooltip-right__td ${splitTooltip ? '_tooltip-right__td_with-split-tooltip' : ''}" colspan="${colspanNumber || 1}">
30
+ ${data.holiday
31
+ ? `<div class="_tooltip-right__holiday-div">
32
+ <div class="_tooltip-right__holiday-emoji">🎈</div>
33
+ <div>
34
+ ${data.holidayText}
35
+ ${data.region
36
+ ? `<span class="_tooltip-right__holiday-region">[${data.region}]</span>`
37
+ : ''}
38
+ </div>
39
+ </div>`
40
+ : ''}
41
+
42
+ ${data.commentDateText
43
+ ? `<div class="${data.xComments ? '_tooltip-right__margin-bot' : ''}">${data.commentDateText}</div>`
44
+ : ''}
45
+
46
+ ${data.xComments
47
+ ? data.xComments
48
+ .map((comment) => `<div class="_tooltip-right__traf-div ${splitTooltip
49
+ ? '_tooltip-right__traf-div_for-split-tooltip'
50
+ : ''}" style="border-color: ${comment.color};">${comment.text}</div>`)
51
+ .join('')
52
+ : ''}
53
+ </td>`;
54
+ };
55
+ const renderRow = (line, { isSelectedLine, cellsRenderers, isSingleLine, allowComment, withDarkBackground, rowIndex, }) => {
56
+ const hasComment = line.commentText || line.xyCommentText;
57
+ const needRenderComment = allowComment && hasComment;
58
+ const fullCellsRenderers = cellsRenderers.slice();
59
+ const rowKey = `${String(rowIndex) || ''}-${String(escapeHTML(line.seriesName))
60
+ .slice(0, 20)
61
+ .replace(/(\r\n|\n|\r)/gm, '')}`;
62
+ if (line.insertCellAt) {
63
+ (Object.keys(line.insertCellAt) || []).forEach((index) => {
64
+ fullCellsRenderers.splice(Number(index), 0, renderEmptyCell);
65
+ });
66
+ }
67
+ if (line.customRender) {
68
+ return `<tr class="${TOOLTIP_ROW_CLASS_NAME}${isSelectedLine ? ' _tooltip-selected-row' : ''}${isSingleLine ? ' _tooltip-uniq-row' : ''}${withDarkBackground ? ' _tooltip-row-dark-bg' : ''}" ${SERIES_NAME_DATA_ATTRIBUTE}="${rowKey}" ${line.seriesIdx ? `${SERIES_IDX_DATA_ATTRIBUTE}="${line.seriesIdx}"` : ''}>
69
+ ${line.customRender.trim().indexOf('<td') === 0
70
+ ? line.customRender
71
+ : `<td colspan="${cellsRenderers.length}">${line.customRender}</td>`}
72
+ </tr>
73
+ ${needRenderComment
74
+ ? `<tr class="_tooltip-comment-row${isSelectedLine ? ' _tooltip-selected-row' : ''}${withDarkBackground ? ' _tooltip-row-dark-bg' : ''}">
75
+ <td>
76
+ ${line.commentText
77
+ ? `<div class="_tooltip-rows__comment-div">${line.commentText}</div>`
78
+ : ''}
79
+ ${line.xyCommentText
80
+ ? `<div class="_tooltip-rows__comment-div">${line.xyCommentText}</div>`
81
+ : ''}
82
+ </td>
83
+ </tr>`
84
+ : ''}`;
85
+ }
86
+ return `<tr class="${TOOLTIP_ROW_CLASS_NAME}${isSelectedLine ? ' _tooltip-selected-row' : ''}${isSingleLine ? ' _tooltip-uniq-row' : ''}${withDarkBackground ? ' _tooltip-row-dark-bg' : ''}" ${SERIES_NAME_DATA_ATTRIBUTE}="${rowKey}" ${line.seriesIdx ? `${SERIES_IDX_DATA_ATTRIBUTE}="${line.seriesIdx}"` : ''}>
87
+ ${fullCellsRenderers
88
+ .map((render, index) => {
89
+ if (line.replaceCellAt && line.replaceCellAt[index]) {
90
+ return typeof line.replaceCellAt[index] === 'string'
91
+ ? line.replaceCellAt[index]
92
+ : line.replaceCellAt[index](line);
93
+ }
94
+ else if (line.insertCellAt && line.insertCellAt[index]) {
95
+ return typeof line.insertCellAt[index] === 'string'
96
+ ? line.insertCellAt[index]
97
+ : line.insertCellAt[index](line);
98
+ }
99
+ else {
100
+ return render(line);
101
+ }
102
+ })
103
+ .join('')}
104
+ </tr>
105
+
106
+ ${needRenderComment
107
+ ? `<tr class="_tooltip-comment-row${isSelectedLine ? ' _tooltip-selected-row' : ''}${withDarkBackground ? ' _tooltip-row-dark-bg' : ''}">
108
+ <td colspan="4">
109
+ ${line.commentText
110
+ ? `<div class="_tooltip-rows__comment-div">${line.commentText}</div>`
111
+ : ''}
112
+ ${line.xyCommentText
113
+ ? `<div class="_tooltip-rows__comment-div">${line.xyCommentText}</div>`
114
+ : ''}
115
+ </td>
116
+ </tr>`
117
+ : ''}`;
118
+ };
119
+ export const formatTooltip = (data, tooltip) => {
120
+ const { splitTooltip, activeRowAlwaysFirstInTooltip } = data;
121
+ const selectedLineIndex = data.lines.findIndex(({ selectedSeries }) => selectedSeries);
122
+ const selectedLine = data.lines[selectedLineIndex];
123
+ const lines = data.lines.slice(0, (tooltip.lastVisibleRowIndex || data.lines.length) + 1);
124
+ const cellsRenderers = [];
125
+ cellsRenderers.push(renderColorCell);
126
+ if (data.shared) {
127
+ cellsRenderers.push(renderNameCell);
128
+ }
129
+ if (data.withPercent) {
130
+ cellsRenderers.push(renderPercentCell);
131
+ }
132
+ cellsRenderers.push(renderValueCell);
133
+ if (data.useCompareFrom) {
134
+ cellsRenderers.push(renderDiffCell);
135
+ }
136
+ const rowRenderingConfig = {
137
+ isSingleLine: lines.length === 1,
138
+ cellsRenderers,
139
+ };
140
+ const rowRenderingConfigForSelectedLine = {
141
+ cellsRenderers,
142
+ useCompareFrom: data.useCompareFrom,
143
+ isSelectedLine: true,
144
+ allowComment: selectedLineIndex > tooltip.lastVisibleRowIndex,
145
+ };
146
+ const windowHeight =
147
+ // @ts-ignore
148
+ document.body.clientHeight / ((window.visualViewport && window.visualViewport.scale) || 1);
149
+ function getRowRenderConfig(index) {
150
+ return Object.assign(Object.assign({}, rowRenderingConfig), { rowIndex: index, isSelectedLine: lines.length > 1 && index === selectedLineIndex, withDarkBackground: lines.length > 2 && Boolean(index % 2), allowComment: index !== selectedLineIndex || !rowRenderingConfigForSelectedLine.allowComment });
151
+ }
152
+ let tooltipContainerClassNames = TOOLTIP_CONTAINER_CLASS_NAME;
153
+ if (splitTooltip) {
154
+ tooltipContainerClassNames += ` ${TOOLTIP_CONTAINER_CLASS_NAME}_split-tooltip`;
155
+ }
156
+ return `
157
+ <div class="${tooltipContainerClassNames}" style="${tooltip.preFixationHeight ? `height: ${tooltip.preFixationHeight}px; ` : ''}max-height: ${splitTooltip ? 'auto' : `${windowHeight}px`}">
158
+ ${data.tooltipHeader
159
+ ? `<div title="${(document.createRange().createContextualFragment(data.tooltipHeader).textContent ||
160
+ '').trim()}" class="_tooltip-date">
161
+ ${data.tooltipHeader.trim()}
162
+ </div>`
163
+ : ''}
164
+ ${splitTooltip &&
165
+ (data.holiday || data.commentDateText || (data.xComments && data.xComments.length))
166
+ ? `<table border="0" cellpadding="0" cellspacing="0">
167
+ <tbody>
168
+ <tr>
169
+ ${renderAdditionalSection(data, true, cellsRenderers.length)}
170
+ </tr>
171
+ </tbody>
172
+ </table>`
173
+ : ''}
174
+ <table border="0" cellpadding="0" cellspacing="0">
175
+ <tr>
176
+ <td class="_tooltip-left__td">
177
+ <table class="_tooltip-rows__table">
178
+ ${splitTooltip
179
+ ? ''
180
+ : `<thead class=${TOOLTIP_HEADER_CLASS_NAME}>
181
+ ${selectedLine &&
182
+ (activeRowAlwaysFirstInTooltip ||
183
+ (tooltip.lastVisibleRowIndex &&
184
+ selectedLineIndex > tooltip.lastVisibleRowIndex))
185
+ ? renderRow(selectedLine, rowRenderingConfigForSelectedLine)
186
+ : ''}
187
+ <tr class="_tooltip-fake-row">${Array(cellsRenderers.length)
188
+ .fill('<td></td>')
189
+ .join('')}</tr>
190
+ </thead>`}
191
+ <tbody class="${TOOLTIP_LIST_CLASS_NAME}">
192
+ ${lines
193
+ .map((line, index) => renderRow(line, getRowRenderConfig(index)))
194
+ .join('')}
195
+ </tbody>
196
+ ${splitTooltip
197
+ ? ''
198
+ : `<tbody class="${TOOLTIP_FOOTER_CLASS_NAME}">
199
+ ${tooltip.lastVisibleRowIndex && data.hiddenRowsNumber > 0
200
+ ? `<tr class="${TOOLTIP_ROW_CLASS_NAME} _hidden-rows-sum${lines.length % 2 ? ' _hidden-rows-sum-dark-bg' : ''}">
201
+ <td colspan="${cellsRenderers.length - 1}" class="_hidden-rows-number">
202
+ ${i18n('common', 'tooltip-rest')} ${data.hiddenRowsNumber}
203
+ </td>
204
+ <td class="_hidden-rows-value">${data.hiddenRowsSum}</td>
205
+ </tr>`
206
+ : ''}
207
+ <tr class="_tooltip-fake-row">${Array(cellsRenderers.length)
208
+ .fill('<td></td>')
209
+ .join('')}</tr>
210
+ ${data.sum
211
+ ? `<tr class="_tooltip-rows__summ-tr">
212
+ <td class="_tooltip-rows__summ-td" colspan="${cellsRenderers.length - 1}">${i18n('common', 'tooltip-sum')}</td>
213
+ <td class="_tooltip-rows__summ-td _tooltip-rows__summ-td-value">
214
+ ${data.sum}
215
+ </td>
216
+ </tr>`
217
+ : ''}
218
+ </tbody>`}
219
+ </table>
220
+ </td>
221
+
222
+ ${!splitTooltip &&
223
+ (data.holiday || data.commentDateText || (data.xComments && data.xComments.length))
224
+ ? renderAdditionalSection(data)
225
+ : ''}
226
+ </tr>
227
+ </table>
228
+ </div>`;
229
+ };
@@ -0,0 +1,21 @@
1
+ import type { default as YagrLib, RawSerieData, YagrConfig } from 'yagr';
2
+ import type { ChartKitLang, ChartKitOnLoadData } from '../../types';
3
+ export declare type Yagr = YagrLib;
4
+ export declare type YagrWidgetData = {
5
+ data: {
6
+ graphs: RawSerieData[];
7
+ timeline: number[];
8
+ };
9
+ libraryConfig: Partial<YagrConfig>;
10
+ sources?: Record<number, {
11
+ data: {
12
+ program: string;
13
+ };
14
+ }>;
15
+ };
16
+ export declare type YagrWidgetProps = {
17
+ id: string;
18
+ data: YagrWidgetData;
19
+ lang?: ChartKitLang;
20
+ onLoad?: (data?: ChartKitOnLoadData<'yagr'>) => void;
21
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,33 @@
1
+ /// <reference types="react" />
2
+ import type { ChartkitWidget } from './widget';
3
+ export declare type ChartKitLang = 'ru' | 'en';
4
+ export declare type ChartkitType = keyof ChartkitWidget;
5
+ export declare type ChartKitRef = {
6
+ reflow: (details?: unknown) => void;
7
+ };
8
+ export declare type ChartKitWidgetRef = {
9
+ reflow?: ChartKitRef['reflow'];
10
+ };
11
+ export declare type ChartKitOnLoadData<T extends ChartkitType> = {
12
+ widget?: ChartkitWidget[T]['widget'];
13
+ widgetRendering?: number;
14
+ };
15
+ export declare type ChartKitOnError = (data: {
16
+ error: any;
17
+ }) => void;
18
+ export declare type ChartKitFormatNumber = <T = any>(value: number, options?: T) => string;
19
+ export declare type ChartKitProps<T extends ChartkitType> = {
20
+ type: T;
21
+ data: ChartkitWidget[T]['data'];
22
+ id?: string;
23
+ onLoad?: (data?: ChartKitOnLoadData<T>) => void;
24
+ onError?: ChartKitOnError;
25
+ formatNumber?: ChartKitFormatNumber;
26
+ } & {
27
+ [key in keyof Omit<ChartkitWidget[T], 'data' | 'widget'>]: ChartkitWidget[T][key];
28
+ };
29
+ export declare type ChartKitPlugin = {
30
+ type: ChartkitType;
31
+ renderer: React.LazyExoticComponent<any>;
32
+ };
33
+ export type { ChartkitWidget };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,13 @@
1
+ import type Yagr from 'yagr';
2
+ import type { YagrWidgetData } from '../plugins/yagr/types';
3
+ import type { IndicatorWidgetData } from '../plugins/indicator/types';
4
+ export interface ChartkitWidget {
5
+ yagr: {
6
+ data: YagrWidgetData;
7
+ widget: Yagr;
8
+ };
9
+ indicator: {
10
+ data: IndicatorWidgetData;
11
+ widget: never;
12
+ };
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import { getRandomCKId } from '../common';
2
+ // length of "ck." + 10 random symbols
3
+ const ID_LENGTH = 13;
4
+ describe('utils/getRandomCKId', () => {
5
+ it('Id should have 13 symbols', () => {
6
+ const result = getRandomCKId();
7
+ expect(result.length).toBe(ID_LENGTH);
8
+ });
9
+ });
@@ -0,0 +1 @@
1
+ export declare const getRandomCKId: () => string;
@@ -0,0 +1,8 @@
1
+ const randomString = (length, chars) => {
2
+ let result = '';
3
+ for (let i = length; i > 0; --i) {
4
+ result += chars[Math.floor(Math.random() * chars.length)];
5
+ }
6
+ return result;
7
+ };
8
+ export const getRandomCKId = () => `ck.${randomString(10, '0123456789abcdefghijklmnopqrstuvwxyz')}`;
@@ -0,0 +1,2 @@
1
+ export { getRandomCKId } from './common';
2
+ export { typedMemo } from './react';
@@ -0,0 +1,2 @@
1
+ export { getRandomCKId } from './common';
2
+ export { typedMemo } from './react';
@@ -0,0 +1 @@
1
+ export declare const typedMemo: <T>(component: T) => T;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ // For some reason React.memo drops the generic prop type and creates a regular union type
3
+ // https://github.com/DefinitelyTyped/DefinitelyTyped/issues/37087#issuecomment-542793243
4
+ export const typedMemo = React.memo;
package/package.json ADDED
@@ -0,0 +1,93 @@
1
+ {
2
+ "name": "@gravity-ui/chartkit",
3
+ "version": "0.7.2",
4
+ "description": "React component used to render charts based on any sources you need",
5
+ "license": "MIT",
6
+ "repository": "git@github.com:gravity-ui/ChartKit.git",
7
+ "main": "build/index.js",
8
+ "typings": "build/index.d.ts",
9
+ "files": [
10
+ "build"
11
+ ],
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "dependencies": {
16
+ "bem-cn-lite": "^4.1.0",
17
+ "lodash": "^4.17.21",
18
+ "yagr": "1.3.7"
19
+ },
20
+ "devDependencies": {
21
+ "@gravity-ui/eslint-config": "^1.0.2",
22
+ "@gravity-ui/prettier-config": "^1.0.1",
23
+ "@gravity-ui/stylelint-config": "^1.0.1",
24
+ "@gravity-ui/tsconfig": "^1.0.0",
25
+ "@gravity-ui/uikit": "^3.0.2",
26
+ "@storybook/addon-essentials": "^6.5.9",
27
+ "@storybook/addon-knobs": "^6.4.0",
28
+ "@storybook/preset-scss": "^1.0.3",
29
+ "@storybook/react": "^6.5.9",
30
+ "@types/jest": "^28.1.3",
31
+ "@types/lodash": "^4.14.177",
32
+ "@types/node": "^18.0.0",
33
+ "@types/react": "^17.0.48",
34
+ "@types/react-dom": "^17.0.17",
35
+ "@typescript-eslint/eslint-plugin": "^5.31.0",
36
+ "@yandex-cloud/i18n": "^0.5.0",
37
+ "eslint": "^8.11.0",
38
+ "gulp": "^4.0.2",
39
+ "gulp-cli": "^2.3.0",
40
+ "gulp-dart-sass": "^1.0.2",
41
+ "gulp-replace": "^1.1.3",
42
+ "gulp-typescript": "^5.0.1",
43
+ "husky": "^4.2.5",
44
+ "jest": "^28.1.3",
45
+ "jest-environment-jsdom": "^28.1.2",
46
+ "lint-staged": "^10.2.7",
47
+ "moment": "^2.29.4",
48
+ "npm-run-all": "^4.1.5",
49
+ "prettier": "^2.6.0",
50
+ "react": "^17.0.2",
51
+ "react-dom": "^17.0.2",
52
+ "rimraf": "^3.0.2",
53
+ "sass-loader": "^10.2.1",
54
+ "stylelint": "^14.6.0",
55
+ "ts-jest": "^28.0.5",
56
+ "ts-node": "^10.2.1",
57
+ "typescript": "^4.2.3"
58
+ },
59
+ "peerDependencies": {
60
+ "react": "^16.0.0 || ^17.0.0",
61
+ "moment": "^2.19.3",
62
+ "@gravity-ui/uikit": "^3.0.0",
63
+ "@yandex-cloud/i18n": "^0.5.0"
64
+ },
65
+ "scripts": {
66
+ "test": "jest",
67
+ "test:watch": "jest --watchAll",
68
+ "clean": "gulp clean",
69
+ "start": "start-storybook -p 7007",
70
+ "build": "gulp",
71
+ "lint:js": "eslint --quiet --ext .js,.jsx,.ts,.tsx .",
72
+ "lint:styles": "stylelint '{styles,src}/**/*.scss' --quiet",
73
+ "lint:prettier": "prettier --check --loglevel=error '**/*.{js,jsx,ts,tsx,scss}'",
74
+ "lint": "run-p lint:*",
75
+ "typecheck": "tsc --noEmit",
76
+ "prepublishOnly": "npm run build"
77
+ },
78
+ "husky": {
79
+ "hooks": {
80
+ "pre-commit": "lint-staged"
81
+ }
82
+ },
83
+ "lint-staged": {
84
+ "*.{css,scss}": [
85
+ "stylelint --fix --quiet",
86
+ "prettier --write"
87
+ ],
88
+ "*.{js,jsx,ts,tsx}": [
89
+ "eslint --fix --quiet",
90
+ "prettier --write"
91
+ ]
92
+ }
93
+ }