@gravity-ui/dashkit 7.2.0-beta.0 → 8.0.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.
@@ -6,6 +6,7 @@ const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const uikit_1 = require("@gravity-ui/uikit");
7
7
  const i18n_1 = require("../../i18n");
8
8
  const cn_1 = require("../../utils/cn");
9
+ const constants_1 = require("../constants");
9
10
  // need to set markdown styles separately
10
11
  // for instance can use yfm-transform
11
12
  const b = (0, cn_1.cn)('dashkit-plugin-text');
@@ -71,7 +72,7 @@ class PluginText extends react_1.default.PureComponent {
71
72
  react_1.default.createElement("br", null)));
72
73
  }
73
74
  renderText() {
74
- return (react_1.default.createElement("div", { className: b({ withMarkdown: this.withMarkdown }) }, this.withMarkdown ? (react_1.default.createElement("div", { className: "yfm" // className из стилей для markdown
75
+ return (react_1.default.createElement("div", { className: b({ withMarkdown: this.withMarkdown }), [constants_1.PLUGIN_ROOT_ATTR_NAME]: 'text' }, this.withMarkdown ? (react_1.default.createElement("div", { className: "yfm" // className из стилей для markdown
75
76
  , dangerouslySetInnerHTML: { __html: this.state.htmlText } })) : (this.state.text)));
76
77
  }
77
78
  async getMarkdown() {
@@ -4,6 +4,7 @@ exports.PluginTitle = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const react_1 = tslib_1.__importDefault(require("react"));
6
6
  const cn_1 = require("../../utils/cn");
7
+ const constants_1 = require("../constants");
7
8
  const b = (0, cn_1.cn)('dashkit-plugin-title');
8
9
  class PluginTitle extends react_1.default.Component {
9
10
  render() {
@@ -11,7 +12,7 @@ class PluginTitle extends react_1.default.Component {
11
12
  const text = data.text ? data.text : '';
12
13
  const size = data.size ? data.size : false;
13
14
  const id = data.showInTOC && text ? encodeURIComponent(text) : undefined;
14
- return (react_1.default.createElement("div", { id: id, className: b({ size }) }, text));
15
+ return (react_1.default.createElement("div", { id: id, className: b({ size }), [constants_1.PLUGIN_ROOT_ATTR_NAME]: 'title' }, text));
15
16
  }
16
17
  }
17
18
  exports.PluginTitle = PluginTitle;
@@ -0,0 +1 @@
1
+ export declare const PLUGIN_ROOT_ATTR_NAME = "data-plugin-root-el";
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PLUGIN_ROOT_ATTR_NAME = void 0;
4
+ exports.PLUGIN_ROOT_ATTR_NAME = 'data-plugin-root-el';
@@ -1,2 +1,3 @@
1
1
  export * from './Text';
2
2
  export * from './Title';
3
+ export * from './constants';
@@ -3,3 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./Text"), exports);
5
5
  tslib_1.__exportStar(require("./Title"), exports);
6
+ tslib_1.__exportStar(require("./constants"), exports);
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { Button, Loader } from '@gravity-ui/uikit';
3
3
  import { i18n } from '../../i18n';
4
4
  import { cn } from '../../utils/cn';
5
+ import { PLUGIN_ROOT_ATTR_NAME } from '../constants';
5
6
  import './Text.css';
6
7
  // need to set markdown styles separately
7
8
  // for instance can use yfm-transform
@@ -68,7 +69,7 @@ export class PluginText extends React.PureComponent {
68
69
  React.createElement("br", null)));
69
70
  }
70
71
  renderText() {
71
- return (React.createElement("div", { className: b({ withMarkdown: this.withMarkdown }) }, this.withMarkdown ? (React.createElement("div", { className: "yfm" // className из стилей для markdown
72
+ return (React.createElement("div", { className: b({ withMarkdown: this.withMarkdown }), [PLUGIN_ROOT_ATTR_NAME]: 'text' }, this.withMarkdown ? (React.createElement("div", { className: "yfm" // className из стилей для markdown
72
73
  , dangerouslySetInnerHTML: { __html: this.state.htmlText } })) : (this.state.text)));
73
74
  }
74
75
  async getMarkdown() {
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { cn } from '../../utils/cn';
3
+ import { PLUGIN_ROOT_ATTR_NAME } from '../constants';
3
4
  import './Title.css';
4
5
  const b = cn('dashkit-plugin-title');
5
6
  export class PluginTitle extends React.Component {
@@ -8,7 +9,7 @@ export class PluginTitle extends React.Component {
8
9
  const text = data.text ? data.text : '';
9
10
  const size = data.size ? data.size : false;
10
11
  const id = data.showInTOC && text ? encodeURIComponent(text) : undefined;
11
- return (React.createElement("div", { id: id, className: b({ size }) }, text));
12
+ return (React.createElement("div", { id: id, className: b({ size }), [PLUGIN_ROOT_ATTR_NAME]: 'title' }, text));
12
13
  }
13
14
  }
14
15
  const plugin = {
@@ -0,0 +1 @@
1
+ export declare const PLUGIN_ROOT_ATTR_NAME = "data-plugin-root-el";
@@ -0,0 +1 @@
1
+ export const PLUGIN_ROOT_ATTR_NAME = 'data-plugin-root-el';
@@ -1,2 +1,3 @@
1
1
  export * from './Text';
2
2
  export * from './Title';
3
+ export * from './constants';
@@ -1,2 +1,3 @@
1
1
  export * from './Text';
2
2
  export * from './Title';
3
+ export * from './constants';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/dashkit",
3
- "version": "7.2.0-beta.0",
3
+ "version": "8.0.0",
4
4
  "description": "Library for rendering dashboard grid layout",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -61,6 +61,7 @@
61
61
  },
62
62
  "dependencies": {
63
63
  "@gravity-ui/icons": "^2.8.1",
64
+ "@bem-react/classname": "^1.6.0",
64
65
  "hashids": "^2.2.8",
65
66
  "immutability-helper": "^3.1.1",
66
67
  "prop-types": "^15.8.1",
@@ -68,12 +69,10 @@
68
69
  "react-transition-group": "^4.4.5"
69
70
  },
70
71
  "peerDependencies": {
71
- "@bem-react/classname": "^1.6.0",
72
72
  "@gravity-ui/uikit": "^6.0.0",
73
73
  "react": "^16.8.0 || ^17 || ^18"
74
74
  },
75
75
  "devDependencies": {
76
- "@bem-react/classname": "^1.6.0",
77
76
  "@commitlint/cli": "^17.0.3",
78
77
  "@commitlint/config-conventional": "^17.0.3",
79
78
  "@gravity-ui/eslint-config": "^3.1.1",