UNPKG

@atlaskit/editor-common

Version:

A package that contains common classes and components for editor and renderer

48 lines (47 loc) 2.13 kB
import { PanelType } from '@atlaskit/adf-schema'; import { hexToEditorBackgroundPaletteColor } from '@atlaskit/editor-palette'; var lightPanelColors = { info: '#DEEBFF', note: '#EAE6FF', tip: '#E3FCEF', success: '#E3FCEF', warning: '#FFFAE6', error: '#FFEBE6' }; var prefix = 'ak-editor-panel'; export var PanelSharedCssClassName = { prefix: prefix, content: "".concat(prefix, "__content"), icon: "".concat(prefix, "__icon"), noIcon: "".concat(prefix, "__no-icon") }; export var PanelSharedSelectors = { infoPanel: ".".concat(prefix, "[data-panel-type=").concat(PanelType.INFO, "]"), notePanel: ".".concat(prefix, "[data-panel-type=").concat(PanelType.NOTE, "]"), warningPanel: ".".concat(prefix, "[data-panel-type=").concat(PanelType.WARNING, "]"), errorPanel: ".".concat(prefix, "[data-panel-type=").concat(PanelType.ERROR, "]"), successPanel: ".".concat(prefix, "[data-panel-type=").concat(PanelType.SUCCESS, "]"), noteButton: "button[aria-label=\"Note\"]", warningButton: "button[aria-label=\"Warning\"]", removeButton: "button[aria-label=\"Remove\"]", colorPalette: "[aria-label=\"Background color\"]", selectedColor: "[aria-label=\"Light green\"]", removeEmojiIcon: "[aria-label=\"Remove emoji\"]", emojiIcon: "[aria-label=\"editor-add-emoji\"]", selectedEmoji: "[aria-label=\":grinning:\"]", addYourOwnEmoji: "#add-custom-emoji", emojiNameInCustomEmoji: "[aria-label=\"Enter a name for the new emoji\"]", title: "#editor-title", emojiPopup: "[aria-label=\"Popup\"]", searchEmoji: "[aria-label=\"Emoji name\"]", orangeWarningIcon: "[aria-label=\":warning:\"]", yellowWarningIcon: "[aria-label=\":warning:\"] span:nth-child(1)", copyButton: "button[aria-label=\"Copy\"]" }; // Provides the color without tokens, used when converting to a custom panel export var getPanelTypeBackgroundNoTokens = function getPanelTypeBackgroundNoTokens(panelType) { return lightPanelColors[panelType] || 'none'; }; export var getPanelTypeBackground = function getPanelTypeBackground(panelType) { return hexToEditorBackgroundPaletteColor(lightPanelColors[panelType]) || 'none'; };