diff --git a/README.md b/README.md index 00bb8e8..b1a22a4 100644 --- a/README.md +++ b/README.md @@ -325,6 +325,29 @@ type MenuItem = { DashKit.setSettings({menu: [] as Array}); ``` +| Name | Description | +|-:----------------------------------------------|-:---------------------| +| Action panel variables | | +| `--dashkit-action-panel-color` | Background color | +| `--dashkit-action-panel-border-color` | Border color | +| `--dashkit-action-panel-border-radius` | Border radius | +| Action panel item variables | | +| `--dashkit-action-panel-item-color` | Backgroud color | +| `--dashkit-action-panel-item-text-color` | Text color | +| `--dashkit-action-panel-item-color-hover` | Hover backgroud color | +| `--dashkit-action-panel-item-text-color-hover` | Hover text color | +| Overlay variables | | +| `--dashkit-overlay-border-color` | Border color | +| `--dashkit-overlay-color` | Background color | +| `--dashkit-overlay-opacity` | Opacity | +| Grid item variables | | +| `--dashkit-grid-item-edit-opacity` | Opacity | +| `--dashkit-grid-item-border-radius` | Border radius | +| Placeholder variables | | +| `--dashkit-placeholder-color` | Background color | +| `--dashkit-placeholder-opacity` | Opacity | + + ## Development ### Build & watch diff --git a/src/components/ActionPanel/ActionPanel.scss b/src/components/ActionPanel/ActionPanel.scss index c9848cd..ecfa67f 100644 --- a/src/components/ActionPanel/ActionPanel.scss +++ b/src/components/ActionPanel/ActionPanel.scss @@ -1,14 +1,23 @@ .dashkit-action-panel { $show_panel_transform: translateX(-50%) translateY(0); $hide_panel_transform: translateX(-50%) translateY(calc(100% + 20px)); - $selector: #{&}; - background-color: var(--g-color-base-float); + --_--dashkit-action-panel-color: var(--dashkit-action-panel-color, var(--g-color-base-float)); + --_--dashkit-action-panel-border-color: var( + --dashkit-action-panel-border-color, + var(--g-color-base-brand) + ); + --_--dashkit-action-panel-border-radius: var( + --dashkit-action-panel-border-radius, + var(--g-border-radius-xl) + ); + + background-color: var(--_--dashkit-action-panel-color); position: fixed; bottom: 20px; display: flex; - border-radius: 10px; - border: 2px solid var(--g-color-base-brand); + border-radius: var(--_--dashkit-action-panel-border-radius); + border: 2px solid var(--_--dashkit-action-panel-border-color); padding: 8px; gap: 0; left: 50%; @@ -21,7 +30,7 @@ &-active { transform: $show_panel_transform; - transition: transform 300ms ease-in-out; + transition: transform 300ms ease; } } @@ -31,27 +40,45 @@ &-active { transform: $hide_panel_transform; - transition: transform 300ms ease-in-out; + transition: transform 300ms ease; } } &__item { + --_--dashkit-action-panel-item-color: var(--dashkit-action-panel-item-color, transparent); + --_--dashkit-action-panel-item-text-color: var( + --dashkit-action-panel-item-text-color, + var(--g-color-text-primary) + ); + --_--dashkit-action-panel-item-color-hover: var( + --dashkit-action-panel-item-color-hover, + var(--g-color-base-simple-hover) + ); + --_--dashkit-action-panel-item-text-color-hover: var( + --dashkit-action-panel-item-text-color-hover, + var(--g-color-text-primary) + ); + height: 68px; width: 98px; display: flex; flex-direction: column; justify-content: center; align-items: center; - transition: 0.3s background-color ease-in-out; + transition: 300ms color ease-in-out, 300ms background-color ease-in-out; border-radius: 6px; padding: 0 12px; box-sizing: border-box; white-space: nowrap; overflow: hidden; + background-color: var(--_--dashkit-action-panel-item-color); + color: var(--_--dashkit-action-panel-item-text-color); + will-change: color, backgroung-color; &:hover { cursor: pointer; - background-color: var(--g-color-base-simple-hover); + background-color: var(--_--dashkit-action-panel-item-color-hover); + color: var(--_--dashkit-action-panel-item-text-color-hover); } } diff --git a/src/components/ActionPanel/ActionPanel.tsx b/src/components/ActionPanel/ActionPanel.tsx index a92cd6e..c1dfdcd 100644 --- a/src/components/ActionPanel/ActionPanel.tsx +++ b/src/components/ActionPanel/ActionPanel.tsx @@ -23,7 +23,7 @@ export type ActionPanelProps = { const b = cn('dashkit-action-panel'); export const ActionPanel = (props: ActionPanelProps) => { - const isHidden = props.enable; + const isHidden = !props.enable; const nodeRef = React.useRef(null); const content = ( diff --git a/src/components/DashKit/__stories__/CssApiShowcase.tsx b/src/components/DashKit/__stories__/CssApiShowcase.tsx new file mode 100644 index 0000000..a276fcd --- /dev/null +++ b/src/components/DashKit/__stories__/CssApiShowcase.tsx @@ -0,0 +1,113 @@ +import React from 'react'; +import {Icon} from '@gravity-ui/uikit'; +import { + ChartColumn, + Heading, + Layers3Diagonal, + PlugConnection, + Sliders, + TextAlignLeft, +} from '@gravity-ui/icons'; + +import {Demo, DemoRow} from './Demo'; +import {getConfig} from './utils'; +import {DashKit, ActionPanel, MenuItems} from '../../..'; +import i18n from '../../../i18n'; +import {CogIcon} from '../../../icons/CogIcon'; +import {CopyIcon} from '../../../icons/CopyIcon'; +import {DeleteIcon} from '../../../icons/DeleteIcon'; + +export const CssApiShowcase: React.FC = () => { + React.useEffect(() => { + DashKit.setSettings({ + menu: [ + { + id: 'settings', + title: 'Menu setting text', + icon: , + }, + { + id: MenuItems.Copy, + title: 'Menu setting copy', + icon: , + }, + { + id: MenuItems.Delete, + title: i18n('label_delete'), // for language change check + icon: , + className: 'dashkit-overlay-controls__item_danger', + }, + ], + }); + }, []); + + const items = React.useMemo( + () => [ + { + id: 'chart', + icon: , + title: 'Chart', + className: 'test', + qa: 'chart', + }, + { + id: 'selector', + icon: , + title: 'Selector', + qa: 'selector', + }, + { + id: 'text', + icon: , + title: 'Text', + }, + { + id: 'header', + icon: , + title: 'Header', + }, + { + id: 'links', + icon: , + title: 'Links', + }, + { + id: 'tabs', + icon: , + title: 'Tabs', + }, + ], + [], + ); + + return ( + <> + + + + + + + + + ); +}; diff --git a/src/components/DashKit/__stories__/DashKit.stories.tsx b/src/components/DashKit/__stories__/DashKit.stories.tsx index abd6197..4d82138 100644 --- a/src/components/DashKit/__stories__/DashKit.stories.tsx +++ b/src/components/DashKit/__stories__/DashKit.stories.tsx @@ -5,6 +5,7 @@ import {DashKit, DashKitProps} from '../DashKit'; import pluginTitle from '../../../plugins/Title/Title'; import pluginText from '../../../plugins/Text/Text'; import {DashKitShowcase} from './DashKitShowcase'; +import {CssApiShowcase} from './CssApiShowcase'; import {getConfig} from './utils'; import './DashKit.stories.scss'; @@ -69,3 +70,6 @@ export const Default = DefaultTemplate.bind({}); const ShowcaseTemplate: Story = () => ; export const Showcase = ShowcaseTemplate.bind({}); + +const CssApiShowcaseTemplate: Story = () => ; +export const CSS_API = CssApiShowcaseTemplate.bind({}); diff --git a/src/components/DashKit/__stories__/DashKitShowcase.tsx b/src/components/DashKit/__stories__/DashKitShowcase.tsx index e7af8c6..e1ea3dc 100644 --- a/src/components/DashKit/__stories__/DashKitShowcase.tsx +++ b/src/components/DashKit/__stories__/DashKitShowcase.tsx @@ -175,7 +175,7 @@ export class DashKitShowcase extends React.Component<{}, DashKitDemoState> { {this.state.lastAction}
@@ -64,7 +64,7 @@ class GridItem extends React.PureComponent { in={!isHidden} nodeRef={this.controlsRef} classNames={b('controls')} - timeout={500} + timeout={300} unmountOnExit >