@atlaskit/editor-shared-styles 2.1.4 → 2.2.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-shared-styles
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`73d9a2fa116`](https://bitbucket.org/atlassian/atlassian-frontend/commits/73d9a2fa116) - ED-15568 Restore table's FloatingContextualMenu, extract utils/UI components
8
+
9
+ ## 2.1.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [`a6df7e823d8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a6df7e823d8) - [ux] Fixed trello card overflow issue in table cells & fixed merged table cells selection / hover state
14
+ - Updated dependencies
15
+
3
16
  ## 2.1.4
4
17
 
5
18
  ### Patch Changes
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.scrollbarStyles = void 0;
7
+
8
+ var _constants = require("@atlaskit/theme/constants");
9
+
10
+ var _tokens = require("@atlaskit/tokens");
11
+
12
+ var akGridSize = (0, _constants.gridSize)() + 'px'; // TODO: https://product-fabric.atlassian.net/browse/DSP-4494
13
+
14
+ var scrollbarStyles = "\n -ms-overflow-style: -ms-autohiding-scrollbar;\n\n &::-webkit-scrollbar {\n height: ".concat(akGridSize, ";\n width: ").concat(akGridSize, ";\n }\n\n &::-webkit-scrollbar-corner {\n display: none;\n }\n\n &::-webkit-scrollbar-thumb {\n background-color: ").concat((0, _tokens.token)('color.background.neutral.subtle', 'rgba(0, 0, 0, 0)'), ";\n }\n\n &:hover::-webkit-scrollbar-thumb {\n background-color: ").concat((0, _tokens.token)('color.background.neutral.bold', 'rgba(0, 0, 0, 0.2)'), ";\n border-radius: ").concat(akGridSize, ";\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background-color: ").concat((0, _tokens.token)('color.background.neutral.bold.hovered', 'rgba(0, 0, 0, 0.4)'), ";\n }\n");
15
+ exports.scrollbarStyles = scrollbarStyles;
@@ -34,7 +34,7 @@ exports.hideNativeBrowserTextSelectionStyles = hideNativeBrowserTextSelectionSty
34
34
  var getSelectionStyle = function getSelectionStyle(style) {
35
35
  switch (style) {
36
36
  case _types.SelectionStyle.Border:
37
- return "border: ".concat(_consts.akEditorSelectedBorder, ";");
37
+ return "\n border: ".concat(_consts.akEditorSelectedBorder, ";\n\n // Fixes ED-15246: Trello card is visible through a border of a table border\n &::after {\n height: 100%;\n content: '\\00a0';\n background: ").concat(_consts.akEditorSelectedBorderColor, ";\n position: absolute;\n right: -1px;\n top: 0;\n bottom: 0;\n width: 1px;\n border: none;\n display: inline-block;\n }\n ");
38
38
 
39
39
  case _types.SelectionStyle.BoxShadow:
40
40
  return "\n box-shadow: ".concat(_consts.akEditorSelectedBoxShadow, ";\n border-color: transparent;\n ");
@@ -43,7 +43,7 @@ var getSelectionStyle = function getSelectionStyle(style) {
43
43
  return "background-color: ".concat((0, _tokens.token)('color.background.selected', _consts.akEditorSelectedBgColor), ";");
44
44
 
45
45
  case _types.SelectionStyle.Blanket:
46
- return "\n position: relative;\n\n // Fixes ED-9263, where emoji or inline card in panel makes selection go outside the panel\n // in Safari. Looks like it's caused by user-select: all in the emoji element\n -webkit-user-select: text;\n\n ::after {\n position: absolute;\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n pointer-events: none;\n background-color: ".concat((0, _tokens.token)('color.blanket.selected', '#B3D4FF4C'), "\n }");
46
+ return "\n position: relative;\n\n // Fixes ED-9263, where emoji or inline card in panel makes selection go outside the panel\n // in Safari. Looks like it's caused by user-select: all in the emoji element\n -webkit-user-select: text;\n\n ::before {\n position: absolute;\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n pointer-events: none;\n z-index: ".concat(_consts.akEditorSmallZIndex, ";\n background-color: ").concat((0, _tokens.token)('color.blanket.selected', '#B3D4FF4C'), "\n }");
47
47
 
48
48
  default:
49
49
  return '';
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "shortcutStyle", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _shortcut.shortcutStyle;
10
+ }
11
+ });
12
+
13
+ var _shortcut = require("./shortcut");
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.shortcutStyle = void 0;
9
+
10
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
12
+ var _react = require("@emotion/react");
13
+
14
+ var _colors = require("@atlaskit/theme/colors");
15
+
16
+ var _constants = require("@atlaskit/theme/constants");
17
+
18
+ var _tokens = require("@atlaskit/tokens");
19
+
20
+ var _consts = require("../consts");
21
+
22
+ var _templateObject;
23
+
24
+ var shortcutStyle = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background-color: ", "; /* N60 at 50% */\n color: ", ";\n border-radius: ", "px;\n padding: 4px;\n line-height: 12px;\n font-size: ", ";\n align-self: flex-end;\n @media (max-width: ", "px) {\n display: none;\n }\n"])), (0, _tokens.token)('color.background.neutral', 'rgba(223, 225, 229, 0.5)'), (0, _tokens.token)('color.text.subtle', _colors.N100), (0, _constants.borderRadius)(), (0, _consts.relativeFontSizeToBase16)(11.67), _consts.akEditorMobileMaxWidth);
25
+ exports.shortcutStyle = shortcutStyle;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-shared-styles",
3
- "version": "2.1.4",
3
+ "version": "2.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,29 @@
1
+ import { gridSize } from '@atlaskit/theme/constants';
2
+ import { token } from '@atlaskit/tokens';
3
+ const akGridSize = gridSize() + 'px'; // TODO: https://product-fabric.atlassian.net/browse/DSP-4494
4
+
5
+ export const scrollbarStyles = `
6
+ -ms-overflow-style: -ms-autohiding-scrollbar;
7
+
8
+ &::-webkit-scrollbar {
9
+ height: ${akGridSize};
10
+ width: ${akGridSize};
11
+ }
12
+
13
+ &::-webkit-scrollbar-corner {
14
+ display: none;
15
+ }
16
+
17
+ &::-webkit-scrollbar-thumb {
18
+ background-color: ${token('color.background.neutral.subtle', 'rgba(0, 0, 0, 0)')};
19
+ }
20
+
21
+ &:hover::-webkit-scrollbar-thumb {
22
+ background-color: ${token('color.background.neutral.bold', 'rgba(0, 0, 0, 0.2)')};
23
+ border-radius: ${akGridSize};
24
+ }
25
+
26
+ &::-webkit-scrollbar-thumb:hover {
27
+ background-color: ${token('color.background.neutral.bold.hovered', 'rgba(0, 0, 0, 0.4)')};
28
+ }
29
+ `;
@@ -1,5 +1,5 @@
1
1
  import { token } from '@atlaskit/tokens';
2
- import { akEditorSelectedBgColor, akEditorSelectedBorder, akEditorSelectedBoxShadow } from '../consts';
2
+ import { akEditorSelectedBgColor, akEditorSelectedBorder, akEditorSelectedBorderColor, akEditorSelectedBoxShadow, akEditorSmallZIndex } from '../consts';
3
3
  import { SelectionStyle } from './types';
4
4
  /**
5
5
  * Adds correct selection styling for a node
@@ -25,7 +25,23 @@ export const hideNativeBrowserTextSelectionStyles = `
25
25
  const getSelectionStyle = style => {
26
26
  switch (style) {
27
27
  case SelectionStyle.Border:
28
- return `border: ${akEditorSelectedBorder};`;
28
+ return `
29
+ border: ${akEditorSelectedBorder};
30
+
31
+ // Fixes ED-15246: Trello card is visible through a border of a table border
32
+ &::after {
33
+ height: 100%;
34
+ content: '\\00a0';
35
+ background: ${akEditorSelectedBorderColor};
36
+ position: absolute;
37
+ right: -1px;
38
+ top: 0;
39
+ bottom: 0;
40
+ width: 1px;
41
+ border: none;
42
+ display: inline-block;
43
+ }
44
+ `;
29
45
 
30
46
  case SelectionStyle.BoxShadow:
31
47
  return `
@@ -44,14 +60,16 @@ const getSelectionStyle = style => {
44
60
  // in Safari. Looks like it's caused by user-select: all in the emoji element
45
61
  -webkit-user-select: text;
46
62
 
47
- ::after {
63
+ ::before {
48
64
  position: absolute;
49
65
  content: '';
50
66
  left: 0;
51
67
  right: 0;
52
68
  top: 0;
53
69
  bottom: 0;
70
+ width: 100%;
54
71
  pointer-events: none;
72
+ z-index: ${akEditorSmallZIndex};
55
73
  background-color: ${token('color.blanket.selected', '#B3D4FF4C')}
56
74
  }`;
57
75
 
@@ -0,0 +1 @@
1
+ export { shortcutStyle } from './shortcut';
@@ -0,0 +1,17 @@
1
+ import { css } from '@emotion/react';
2
+ import { N100 } from '@atlaskit/theme/colors';
3
+ import { borderRadius } from '@atlaskit/theme/constants';
4
+ import { token } from '@atlaskit/tokens';
5
+ import { akEditorMobileMaxWidth, relativeFontSizeToBase16 } from '../consts';
6
+ export const shortcutStyle = css`
7
+ background-color: ${token('color.background.neutral', 'rgba(223, 225, 229, 0.5)')}; /* N60 at 50% */
8
+ color: ${token('color.text.subtle', N100)};
9
+ border-radius: ${borderRadius()}px;
10
+ padding: 4px;
11
+ line-height: 12px;
12
+ font-size: ${relativeFontSizeToBase16(11.67)};
13
+ align-self: flex-end;
14
+ @media (max-width: ${akEditorMobileMaxWidth}px) {
15
+ display: none;
16
+ }
17
+ `;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-shared-styles",
3
- "version": "2.1.4",
3
+ "version": "2.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,5 @@
1
+ import { gridSize } from '@atlaskit/theme/constants';
2
+ import { token } from '@atlaskit/tokens';
3
+ var akGridSize = gridSize() + 'px'; // TODO: https://product-fabric.atlassian.net/browse/DSP-4494
4
+
5
+ export var scrollbarStyles = "\n -ms-overflow-style: -ms-autohiding-scrollbar;\n\n &::-webkit-scrollbar {\n height: ".concat(akGridSize, ";\n width: ").concat(akGridSize, ";\n }\n\n &::-webkit-scrollbar-corner {\n display: none;\n }\n\n &::-webkit-scrollbar-thumb {\n background-color: ").concat(token('color.background.neutral.subtle', 'rgba(0, 0, 0, 0)'), ";\n }\n\n &:hover::-webkit-scrollbar-thumb {\n background-color: ").concat(token('color.background.neutral.bold', 'rgba(0, 0, 0, 0.2)'), ";\n border-radius: ").concat(akGridSize, ";\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background-color: ").concat(token('color.background.neutral.bold.hovered', 'rgba(0, 0, 0, 0.4)'), ";\n }\n");
@@ -1,5 +1,5 @@
1
1
  import { token } from '@atlaskit/tokens';
2
- import { akEditorSelectedBgColor, akEditorSelectedBorder, akEditorSelectedBoxShadow } from '../consts';
2
+ import { akEditorSelectedBgColor, akEditorSelectedBorder, akEditorSelectedBorderColor, akEditorSelectedBoxShadow, akEditorSmallZIndex } from '../consts';
3
3
  import { SelectionStyle } from './types';
4
4
  /**
5
5
  * Adds correct selection styling for a node
@@ -22,7 +22,7 @@ export var hideNativeBrowserTextSelectionStyles = "\n ::selection,*::selection
22
22
  var getSelectionStyle = function getSelectionStyle(style) {
23
23
  switch (style) {
24
24
  case SelectionStyle.Border:
25
- return "border: ".concat(akEditorSelectedBorder, ";");
25
+ return "\n border: ".concat(akEditorSelectedBorder, ";\n\n // Fixes ED-15246: Trello card is visible through a border of a table border\n &::after {\n height: 100%;\n content: '\\00a0';\n background: ").concat(akEditorSelectedBorderColor, ";\n position: absolute;\n right: -1px;\n top: 0;\n bottom: 0;\n width: 1px;\n border: none;\n display: inline-block;\n }\n ");
26
26
 
27
27
  case SelectionStyle.BoxShadow:
28
28
  return "\n box-shadow: ".concat(akEditorSelectedBoxShadow, ";\n border-color: transparent;\n ");
@@ -31,7 +31,7 @@ var getSelectionStyle = function getSelectionStyle(style) {
31
31
  return "background-color: ".concat(token('color.background.selected', akEditorSelectedBgColor), ";");
32
32
 
33
33
  case SelectionStyle.Blanket:
34
- return "\n position: relative;\n\n // Fixes ED-9263, where emoji or inline card in panel makes selection go outside the panel\n // in Safari. Looks like it's caused by user-select: all in the emoji element\n -webkit-user-select: text;\n\n ::after {\n position: absolute;\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n pointer-events: none;\n background-color: ".concat(token('color.blanket.selected', '#B3D4FF4C'), "\n }");
34
+ return "\n position: relative;\n\n // Fixes ED-9263, where emoji or inline card in panel makes selection go outside the panel\n // in Safari. Looks like it's caused by user-select: all in the emoji element\n -webkit-user-select: text;\n\n ::before {\n position: absolute;\n content: '';\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n width: 100%;\n pointer-events: none;\n z-index: ".concat(akEditorSmallZIndex, ";\n background-color: ").concat(token('color.blanket.selected', '#B3D4FF4C'), "\n }");
35
35
 
36
36
  default:
37
37
  return '';
@@ -0,0 +1 @@
1
+ export { shortcutStyle } from './shortcut';
@@ -0,0 +1,10 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
+
3
+ var _templateObject;
4
+
5
+ import { css } from '@emotion/react';
6
+ import { N100 } from '@atlaskit/theme/colors';
7
+ import { borderRadius } from '@atlaskit/theme/constants';
8
+ import { token } from '@atlaskit/tokens';
9
+ import { akEditorMobileMaxWidth, relativeFontSizeToBase16 } from '../consts';
10
+ export var shortcutStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", "; /* N60 at 50% */\n color: ", ";\n border-radius: ", "px;\n padding: 4px;\n line-height: 12px;\n font-size: ", ";\n align-self: flex-end;\n @media (max-width: ", "px) {\n display: none;\n }\n"])), token('color.background.neutral', 'rgba(223, 225, 229, 0.5)'), token('color.text.subtle', N100), borderRadius(), relativeFontSizeToBase16(11.67), akEditorMobileMaxWidth);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-shared-styles",
3
- "version": "2.1.4",
3
+ "version": "2.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1 @@
1
+ export declare const scrollbarStyles: string;
@@ -0,0 +1 @@
1
+ export { shortcutStyle } from './shortcut';
@@ -0,0 +1 @@
1
+ export declare const shortcutStyle: import("@emotion/react").SerializedStyles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-shared-styles",
3
- "version": "2.1.4",
3
+ "version": "2.2.0",
4
4
  "description": "Style values used in the editor/renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -22,10 +22,12 @@
22
22
  "af:exports": {
23
23
  "./consts": "./src/consts/index.ts",
24
24
  "./selection": "./src/selection/index.ts",
25
+ "./shortcut": "./src/shortcut/index.ts",
26
+ "./scrollbar": "./src/scrollbar-styles.ts",
25
27
  ".": "./src/index.ts"
26
28
  },
27
29
  "dependencies": {
28
- "@atlaskit/theme": "^12.1.0",
30
+ "@atlaskit/theme": "^12.2.0",
29
31
  "@atlaskit/tokens": "^0.10.0",
30
32
  "@babel/runtime": "^7.0.0",
31
33
  "@emotion/react": "^11.7.1"
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@atlaskit/editor-shared-styles/scrollbar",
3
+ "main": "../dist/cjs/scrollbar-styles.js",
4
+ "module": "../dist/esm/scrollbar-styles.js",
5
+ "module:es2019": "../dist/es2019/scrollbar-styles.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/scrollbar-styles.d.ts"
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "name": "@atlaskit/editor-shared-styles/shortcut",
3
+ "main": "../dist/cjs/shortcut/index.js",
4
+ "module": "../dist/esm/shortcut/index.js",
5
+ "module:es2019": "../dist/es2019/shortcut/index.js",
6
+ "sideEffects": false,
7
+ "types": "../dist/types/shortcut/index.d.ts"
8
+ }
@@ -0,0 +1,40 @@
1
+ import { gridSize } from '@atlaskit/theme/constants';
2
+ import { token } from '@atlaskit/tokens';
3
+
4
+ const akGridSize = gridSize() + 'px';
5
+
6
+ // TODO: https://product-fabric.atlassian.net/browse/DSP-4494
7
+ export const scrollbarStyles = `
8
+ -ms-overflow-style: -ms-autohiding-scrollbar;
9
+
10
+ &::-webkit-scrollbar {
11
+ height: ${akGridSize};
12
+ width: ${akGridSize};
13
+ }
14
+
15
+ &::-webkit-scrollbar-corner {
16
+ display: none;
17
+ }
18
+
19
+ &::-webkit-scrollbar-thumb {
20
+ background-color: ${token(
21
+ 'color.background.neutral.subtle',
22
+ 'rgba(0, 0, 0, 0)',
23
+ )};
24
+ }
25
+
26
+ &:hover::-webkit-scrollbar-thumb {
27
+ background-color: ${token(
28
+ 'color.background.neutral.bold',
29
+ 'rgba(0, 0, 0, 0.2)',
30
+ )};
31
+ border-radius: ${akGridSize};
32
+ }
33
+
34
+ &::-webkit-scrollbar-thumb:hover {
35
+ background-color: ${token(
36
+ 'color.background.neutral.bold.hovered',
37
+ 'rgba(0, 0, 0, 0.4)',
38
+ )};
39
+ }
40
+ `;
@@ -15,7 +15,7 @@ describe('selection plugin: utils', () => {
15
15
  style: SelectionStyle.Background,
16
16
  regex: /background\-color\:/,
17
17
  },
18
- { name: 'blanket', style: SelectionStyle.Blanket, regex: /\:\:after/ },
18
+ { name: 'blanket', style: SelectionStyle.Blanket, regex: /\:\:before/ },
19
19
  ];
20
20
 
21
21
  for (const selectionStyle of selectionStyles) {
@@ -3,7 +3,9 @@ import { token } from '@atlaskit/tokens';
3
3
  import {
4
4
  akEditorSelectedBgColor,
5
5
  akEditorSelectedBorder,
6
+ akEditorSelectedBorderColor,
6
7
  akEditorSelectedBoxShadow,
8
+ akEditorSmallZIndex,
7
9
  } from '../consts';
8
10
 
9
11
  import { SelectionStyle } from './types';
@@ -38,7 +40,23 @@ export const hideNativeBrowserTextSelectionStyles = `
38
40
  const getSelectionStyle = (style: SelectionStyle): string => {
39
41
  switch (style) {
40
42
  case SelectionStyle.Border:
41
- return `border: ${akEditorSelectedBorder};`;
43
+ return `
44
+ border: ${akEditorSelectedBorder};
45
+
46
+ // Fixes ED-15246: Trello card is visible through a border of a table border
47
+ &::after {
48
+ height: 100%;
49
+ content: '\\00a0';
50
+ background: ${akEditorSelectedBorderColor};
51
+ position: absolute;
52
+ right: -1px;
53
+ top: 0;
54
+ bottom: 0;
55
+ width: 1px;
56
+ border: none;
57
+ display: inline-block;
58
+ }
59
+ `;
42
60
  case SelectionStyle.BoxShadow:
43
61
  return `
44
62
  box-shadow: ${akEditorSelectedBoxShadow};
@@ -57,14 +75,16 @@ const getSelectionStyle = (style: SelectionStyle): string => {
57
75
  // in Safari. Looks like it's caused by user-select: all in the emoji element
58
76
  -webkit-user-select: text;
59
77
 
60
- ::after {
78
+ ::before {
61
79
  position: absolute;
62
80
  content: '';
63
81
  left: 0;
64
82
  right: 0;
65
83
  top: 0;
66
84
  bottom: 0;
85
+ width: 100%;
67
86
  pointer-events: none;
87
+ z-index: ${akEditorSmallZIndex};
68
88
  background-color: ${token('color.blanket.selected', '#B3D4FF4C')}
69
89
  }`;
70
90
  default:
@@ -0,0 +1 @@
1
+ export { shortcutStyle } from './shortcut';
@@ -0,0 +1,23 @@
1
+ import { css } from '@emotion/react';
2
+
3
+ import { N100 } from '@atlaskit/theme/colors';
4
+ import { borderRadius } from '@atlaskit/theme/constants';
5
+ import { token } from '@atlaskit/tokens';
6
+
7
+ import { akEditorMobileMaxWidth, relativeFontSizeToBase16 } from '../consts';
8
+
9
+ export const shortcutStyle = css`
10
+ background-color: ${token(
11
+ 'color.background.neutral',
12
+ 'rgba(223, 225, 229, 0.5)',
13
+ )}; /* N60 at 50% */
14
+ color: ${token('color.text.subtle', N100)};
15
+ border-radius: ${borderRadius()}px;
16
+ padding: 4px;
17
+ line-height: 12px;
18
+ font-size: ${relativeFontSizeToBase16(11.67)};
19
+ align-self: flex-end;
20
+ @media (max-width: ${akEditorMobileMaxWidth}px) {
21
+ display: none;
22
+ }
23
+ `;