@gravity-ui/dashkit 6.1.0 → 6.2.0-beta.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.
@@ -0,0 +1,43 @@
1
+ .dashkit-action-panel {
2
+ background-color: var(--g-color-base-float);
3
+ box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
4
+ position: fixed;
5
+ bottom: 20px;
6
+ display: flex;
7
+ border-radius: 8px;
8
+ padding: 8px;
9
+ gap: 0;
10
+ left: 50%;
11
+ transform: translateX(-50%);
12
+ z-index: 1;
13
+ }
14
+ .dashkit-action-panel__item {
15
+ height: 68px;
16
+ width: 98px;
17
+ display: flex;
18
+ flex-direction: column;
19
+ justify-content: center;
20
+ align-items: center;
21
+ transition: 0.3s background-color ease-in-out;
22
+ border-radius: 6px;
23
+ padding: 0 12px;
24
+ box-sizing: border-box;
25
+ white-space: nowrap;
26
+ overflow: hidden;
27
+ }
28
+ .dashkit-action-panel__item:hover {
29
+ cursor: pointer;
30
+ background-color: var(--g-color-base-simple-hover);
31
+ }
32
+ .dashkit-action-panel__icon {
33
+ margin-bottom: 4px;
34
+ }
35
+ .dashkit-action-panel__title {
36
+ font-size: 13px;
37
+ font-weight: 400;
38
+ line-height: 16px;
39
+ max-width: 100%;
40
+ white-space: nowrap;
41
+ overflow: hidden;
42
+ text-overflow: ellipsis;
43
+ }
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export type ActionPanelItem = {
3
+ id: string;
4
+ icon: React.ReactNode;
5
+ title: string;
6
+ onClick?: () => void;
7
+ className?: string;
8
+ };
9
+ export type ActionPanelProps = {
10
+ items: ActionPanelItem[];
11
+ className?: string;
12
+ };
13
+ export declare const ActionPanel: (props: ActionPanelProps) => JSX.Element;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActionPanel = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const react_1 = tslib_1.__importDefault(require("react"));
6
+ const cn_1 = require("../../utils/cn");
7
+ const b = (0, cn_1.cn)('dashkit-action-panel');
8
+ const ActionPanel = (props) => {
9
+ return (react_1.default.createElement("div", { className: b(null, props.className) }, props.items.map((item) => {
10
+ return (react_1.default.createElement("div", { role: "button", className: b('item', item.className), key: `dk-action-panel-${item.id}`, onClick: item.onClick },
11
+ react_1.default.createElement("div", { className: b('icon') }, item.icon),
12
+ react_1.default.createElement("div", { className: b('title'), title: item.title }, item.title)));
13
+ })));
14
+ };
15
+ exports.ActionPanel = ActionPanel;
@@ -1,3 +1,7 @@
1
+ import React from 'react';
2
+ import type { RegisterManager } from '../../utils';
3
+ import type { DashKitProps } from '../DashKit';
4
+ declare const DashKitViewForwardedMeta: React.ForwardRefExoticComponent<DashKitProps & {
5
+ registerManager: RegisterManager;
6
+ } & React.RefAttributes<unknown>>;
1
7
  export default DashKitViewForwardedMeta;
2
- declare const DashKitViewForwardedMeta: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
- import React from "react";
@@ -8,7 +8,7 @@
8
8
  left: 0;
9
9
  right: 0;
10
10
  border-radius: 3px;
11
- background-color: rgba(230, 230, 230, 0.2);
11
+ background-color: var(--g-color-base-generic);
12
12
  border: solid 1px rgba(0, 0, 0, 0.1);
13
13
  }
14
14
  .dashkit-grid-item__item {
@@ -1,11 +1,12 @@
1
1
  .dashkit-overlay-controls {
2
2
  position: absolute;
3
3
  display: flex;
4
+ background-color: var(--g-color-base-float);
5
+ border-radius: var(--g-border-radius-m);
6
+ box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
4
7
  }
5
8
  .dashkit-overlay-controls__default-controls {
6
9
  display: flex;
7
- background: var(--g-color-base-generic-ultralight);
8
- border-radius: var(--g-border-radius-m);
9
10
  }
10
11
  .dashkit-overlay-controls_position_top_right {
11
12
  top: 7px;
@@ -71,6 +71,7 @@ class OverlayControls extends react_1.default.Component {
71
71
  },
72
72
  };
73
73
  localStorage.setItem(constants_1.COPIED_WIDGET_STORE_KEY, JSON.stringify(options));
74
+ window.dispatchEvent(new Event('storage'));
74
75
  };
75
76
  this.onEditItem = () => {
76
77
  this.context.editItem(this.props.configItem);
@@ -210,7 +211,7 @@ class OverlayControls extends react_1.default.Component {
210
211
  OverlayControls.contextType = DashKitContext_1.DashKitContext;
211
212
  OverlayControls.defaultProps = {
212
213
  position: OverlayControlsPosition.TopRight,
213
- view: 'normal',
214
+ view: 'flat',
214
215
  size: 'm',
215
216
  };
216
217
  exports.default = OverlayControls;
@@ -1,2 +1,3 @@
1
1
  export * from './DashKit';
2
2
  export type { OverlayControlItem } from './OverlayControls/OverlayControls';
3
+ export * from './ActionPanel/ActionPanel';
@@ -2,3 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./DashKit"), exports);
5
+ tslib_1.__exportStar(require("./ActionPanel/ActionPanel"), exports);
@@ -0,0 +1,43 @@
1
+ .dashkit-action-panel {
2
+ background-color: var(--g-color-base-float);
3
+ box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
4
+ position: fixed;
5
+ bottom: 20px;
6
+ display: flex;
7
+ border-radius: 8px;
8
+ padding: 8px;
9
+ gap: 0;
10
+ left: 50%;
11
+ transform: translateX(-50%);
12
+ z-index: 1;
13
+ }
14
+ .dashkit-action-panel__item {
15
+ height: 68px;
16
+ width: 98px;
17
+ display: flex;
18
+ flex-direction: column;
19
+ justify-content: center;
20
+ align-items: center;
21
+ transition: 0.3s background-color ease-in-out;
22
+ border-radius: 6px;
23
+ padding: 0 12px;
24
+ box-sizing: border-box;
25
+ white-space: nowrap;
26
+ overflow: hidden;
27
+ }
28
+ .dashkit-action-panel__item:hover {
29
+ cursor: pointer;
30
+ background-color: var(--g-color-base-simple-hover);
31
+ }
32
+ .dashkit-action-panel__icon {
33
+ margin-bottom: 4px;
34
+ }
35
+ .dashkit-action-panel__title {
36
+ font-size: 13px;
37
+ font-weight: 400;
38
+ line-height: 16px;
39
+ max-width: 100%;
40
+ white-space: nowrap;
41
+ overflow: hidden;
42
+ text-overflow: ellipsis;
43
+ }
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import './ActionPanel.css';
3
+ export type ActionPanelItem = {
4
+ id: string;
5
+ icon: React.ReactNode;
6
+ title: string;
7
+ onClick?: () => void;
8
+ className?: string;
9
+ };
10
+ export type ActionPanelProps = {
11
+ items: ActionPanelItem[];
12
+ className?: string;
13
+ };
14
+ export declare const ActionPanel: (props: ActionPanelProps) => JSX.Element;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { cn } from '../../utils/cn';
3
+ import './ActionPanel.css';
4
+ const b = cn('dashkit-action-panel');
5
+ export const ActionPanel = (props) => {
6
+ return (React.createElement("div", { className: b(null, props.className) }, props.items.map((item) => {
7
+ return (React.createElement("div", { role: "button", className: b('item', item.className), key: `dk-action-panel-${item.id}`, onClick: item.onClick },
8
+ React.createElement("div", { className: b('icon') }, item.icon),
9
+ React.createElement("div", { className: b('title'), title: item.title }, item.title)));
10
+ })));
11
+ };
@@ -1,3 +1,8 @@
1
+ import React from 'react';
2
+ import type { RegisterManager } from '../../utils';
3
+ import type { DashKitProps } from '../DashKit';
4
+ import './DashKitView.css';
5
+ declare const DashKitViewForwardedMeta: React.ForwardRefExoticComponent<DashKitProps & {
6
+ registerManager: RegisterManager;
7
+ } & React.RefAttributes<unknown>>;
1
8
  export default DashKitViewForwardedMeta;
2
- declare const DashKitViewForwardedMeta: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
- import React from "react";
@@ -8,7 +8,7 @@
8
8
  left: 0;
9
9
  right: 0;
10
10
  border-radius: 3px;
11
- background-color: rgba(230, 230, 230, 0.2);
11
+ background-color: var(--g-color-base-generic);
12
12
  border: solid 1px rgba(0, 0, 0, 0.1);
13
13
  }
14
14
  .dashkit-grid-item__item {
@@ -1,11 +1,12 @@
1
1
  .dashkit-overlay-controls {
2
2
  position: absolute;
3
3
  display: flex;
4
+ background-color: var(--g-color-base-float);
5
+ border-radius: var(--g-border-radius-m);
6
+ box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
4
7
  }
5
8
  .dashkit-overlay-controls__default-controls {
6
9
  display: flex;
7
- background: var(--g-color-base-generic-ultralight);
8
- border-radius: var(--g-border-radius-m);
9
10
  }
10
11
  .dashkit-overlay-controls_position_top_right {
11
12
  top: 7px;
@@ -68,6 +68,7 @@ class OverlayControls extends React.Component {
68
68
  },
69
69
  };
70
70
  localStorage.setItem(COPIED_WIDGET_STORE_KEY, JSON.stringify(options));
71
+ window.dispatchEvent(new Event('storage'));
71
72
  };
72
73
  this.onEditItem = () => {
73
74
  this.context.editItem(this.props.configItem);
@@ -207,7 +208,7 @@ class OverlayControls extends React.Component {
207
208
  OverlayControls.contextType = DashKitContext;
208
209
  OverlayControls.defaultProps = {
209
210
  position: OverlayControlsPosition.TopRight,
210
- view: 'normal',
211
+ view: 'flat',
211
212
  size: 'm',
212
213
  };
213
214
  export default OverlayControls;
@@ -1,2 +1,3 @@
1
1
  export * from './DashKit';
2
2
  export type { OverlayControlItem } from './OverlayControls/OverlayControls';
3
+ export * from './ActionPanel/ActionPanel';
@@ -1 +1,2 @@
1
1
  export * from './DashKit';
2
+ export * from './ActionPanel/ActionPanel';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/dashkit",
3
- "version": "6.1.0",
3
+ "version": "6.2.0-beta.0",
4
4
  "description": "Library for rendering dashboard grid layout",
5
5
  "license": "MIT",
6
6
  "repository": {