editor.js/src/styles/variables.css
Tatiana Fomina 581289c03e
Block tunes as a popover (#2091)
* Default tunes to popover

* Add the rest of default tunes

* Add popover

* Cleanup

* Rename custom content

* Cleanup

* Add ability to open block settings upwards

* Fix tests

* Cleanup default tunes

* Rename and cleanup

* Add ability to display rendered custom tunes

* cleanup

* Rename

* Add flag to close tunes popover

* Cleanup

* i18n

* Cleanup

* Fix build and tests

* Fix for iframe

* Add comments

* Display active item, move closeOnActivate to popover

* Add confirmation support to popover

* Handle boolean value in confirmation param

* Clarify flippable logic in popover

* Comments

* Pass editor element as a param of popover constructor

* Fix readability

* Tests

* Fix flipper for confirmation element

* Update confirmation config structure

* Rename onClick to onActivate

* Fix tests and build

* Make confirmation props optional

* Simplify processing tunes

* Renamings

* Fix text block tunes

* Docs

* Update event type

* Move enabling confirmation state to separate method

* move popover types

* Unhardcode color

* Support toggling

* Add support of disabled items

* Fix tab in empty block leading to selecting second item in popover

* Remove margins for styles api settings button class

* Fix arrow navigation between blocks after opening block tunes

* Cleaup in default tunes code

* Fix chaining confirmations

* Colors

* Types

* Change the way flippable elements of popover custom area are set

* Remove borders around popover icons

* Fix untabbable inline toolbar

* Fix locked scroll after closing tunes popover on mobile

* Cleanup

* Set max popover width

* Make popover icon's border outside

* Fix tab issue

* Fix focus/hover issue

* Reformat

* Cleanup

* Fix opening block tunes via keyboard

* Add disableSpecialHoverAndFocusBehavior

* Add deprecated comment

* Cleanup

* Fix popover active state

* Fix checklist deletion with confirmation

* Fix checklist deletion 2

* Fix popover focus

* Fix popover items being impossible to flip after searching

* Fix popover item highlighting issue

* Update flipper.spec.ts

* Fixes after review

* Add Tunes Api tests

* Fix multiple popover entries configured by one tune

* Add tool's renderSettings() tests

* Add popover confirmation state test

* Fix popover width on mobile

* Add popover tests

* Add changelog and update version

* Update changelog

* Fix block tunes being unable to open after tune activation

Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
2022-11-03 20:52:33 +03:00

250 lines
4.9 KiB
CSS

/**
* Updating values in media queries should also include changes in utils.ts@isMobile
*/
@custom-media --mobile (width <= 650px);
@custom-media --not-mobile (width >= 651px);
@custom-media --can-hover (hover: hover);
:root {
/**
* Selection color
*/
--selectionColor: #e1f2ff;
--inlineSelectionColor: #d4ecff;
/**
* Toolbar buttons
*/
--bg-light: #eff2f5;
/**
* All gray texts: placeholders, settings
*/
--grayText: #707684;
/**
* Gray icons hover
*/
--color-dark: #1D202B;
/**
* Blue icons
*/
--color-active-icon: #388AE5;
/**
* Gray border, loaders
* @deprecated — use --color-line-gray instead
*/
--color-gray-border: rgba(201, 201, 204, 0.48);
/**
* Block content width
* Should be set in a constant at the modules/ui.js
*/
--content-width: 650px;
/**
* In narrow mode, we increase right zone contained Block Actions button
*/
--narrow-mode-right-padding: 50px;
/**
* Toolbar buttons height and width
*/
--toolbar-buttons-size: 34px;
/**
* Toolbar Plus Button and Toolbox buttons height and width
*/
--toolbox-buttons-size: 26px;
--toolbox-buttons-size--mobile: 36px;
/**
* The main `.cdx-block` wrapper has such vertical paddings
* And the Block Actions toggler too
*/
--block-padding-vertical: 0.4em;
/**
* Confirm deletion bg
*/
--color-confirm: #E24A4A;
--color-confirm-hover: #CE4343;
--color-line-gray: #EFF0F1;
--overlay-pane: {
position: absolute;
background-color: #FFFFFF;
border: 1px solid #E8E8EB;
box-shadow: 0 3px 15px -3px rgba(13,20,33,0.13);
border-radius: 6px;
z-index: 2;
@media (--mobile){
box-shadow: 0 8px 6px -6px rgb(33 48 73 / 19%);
border-bottom-color: #c7c7c7;
}
&--left-oriented {
&::before {
left: 15px;
margin-left: 0;
}
}
&--right-oriented {
&::before {
left: auto;
right: 15px;
margin-left: 0;
}
}
};
--button-focused: {
box-shadow: inset 0 0 0px 1px rgba(7, 161, 227, 0.08);
background: rgba(34, 186, 255, 0.08) !important;
};
--button-active: {
background: rgba(56, 138, 229, 0.1);
color: var(--color-active-icon);
};
--button-disabled: {
color: var(--grayText);
cursor: default;
pointer-events: none;
}
/**
* Styles for Toolbox Buttons and Plus Button
*/
--toolbox-button: {
color: var(--color-dark);
cursor: pointer;
width: var(--toolbox-buttons-size);
height: var(--toolbox-buttons-size);
border-radius: 7px;
display: inline-flex;
justify-content: center;
align-items: center;
user-select: none;
@media (--mobile){
width: var(--toolbox-buttons-size--mobile);
height: var(--toolbox-buttons-size--mobile);
}
@media (--can-hover) {
&:hover {
background-color: var(--bg-light);
}
}
&--active {
background-color: var(--bg-light);
animation: bounceIn 0.75s 1;
animation-fill-mode: forwards;
}
};
/**
* Styles for Settings Button in Toolbar
*/
--toolbar-button: {
display: inline-flex;
align-items: center;
justify-content: center;
width: var(--toolbar-buttons-size);
height: var(--toolbar-buttons-size);
line-height: var(--toolbar-buttons-size);
padding: 0 !important;
text-align: center;
border-radius: 3px;
cursor: pointer;
border: 0;
outline: none;
background-color: transparent;
vertical-align: bottom;
color: #000;
margin: 0;
&:hover {
background-color: var(--bg-light);
}
&--active {
color: var(--color-active-icon);
}
&--focused {
@apply --button-focused;
&-animated {
animation-name: buttonClicked;
animation-duration: 250ms;
}
}
};
/**
* Element of the Toolbox. Has icon and label
*/
--popover-button: {
display: grid;
grid-template-columns: auto auto 1fr;
grid-template-rows: auto;
justify-content: start;
white-space: nowrap;
padding: 3px;
font-size: 14px;
line-height: 20px;
font-weight: 500;
cursor: pointer;
align-items: center;
border-radius: 6px;
&:not(:last-of-type){
margin-bottom: 1px;
}
@media (--mobile) {
font-size: 16px;
padding: 4px;
}
};
/**
* Tool icon with border
*/
--tool-icon: {
display: inline-flex;
width: var(--toolbox-buttons-size);
height: var(--toolbox-buttons-size);
box-shadow: 0 0 0 1px var(--color-gray-border);
border-radius: 5px;
align-items: center;
justify-content: center;
background: #fff;
box-sizing: content-box;
flex-shrink: 0;
margin-right: 10px;
@media (--mobile) {
width: var(--toolbox-buttons-size--mobile);
height: var(--toolbox-buttons-size--mobile);
border-radius: 8px;
}
svg {
width: 12px;
height: 12px;
}
}
}