@atlaskit/editor-palette 1.1.0 → 1.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,11 @@
1
1
  # @atlaskit/editor-palette
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`bf04c417bfd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/bf04c417bfd) - Add "border" mark to stage0 ADF schema
8
+
3
9
  ## 1.1.0
4
10
 
5
11
  ### Minor Changes
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.editorBorderPalette = void 0;
8
+ exports.hexToEditorBorderPaletteColor = hexToEditorBorderPaletteColor;
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _editorBorderPalette;
11
+ // This import will be stripped on build
12
+ // eslint-disable-next-line import/no-extraneous-dependencies
13
+
14
+ /**
15
+ * This takes an adf hex color and returns a matching border palette color.
16
+ *
17
+ * By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
18
+ *
19
+ * Example usage
20
+ * ```tsx
21
+ * const cssValue = hexToEditorBorderPaletteColor('#091E4224');
22
+ * // ^? const cssValue: string
23
+ * <div style={{borderColor: cssValue}} />
24
+ * ```
25
+ * The names of tokens can change over time, and the values of tokens will differ between themes.
26
+ * The exact output of this function is an implementation detail and should only be used when rendering
27
+ * content to the user, on a client with a matching major version of `@atlaskit/tokens`.
28
+ * - **DO NOT**: store the output of these functions in any user-generated content or back-end.
29
+ * - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
30
+ */
31
+
32
+ function hexToEditorBorderPaletteColor(hexColor) {
33
+ // Ts ignore used to allow use of conditional return type
34
+ // (preferencing better type on consumption over safety in implementation)
35
+ // @ts-ignore
36
+ return editorBorderPalette[hexColor.toUpperCase()];
37
+ }
38
+ var editorBorderPalette = (_editorBorderPalette = {}, (0, _defineProperty2.default)(_editorBorderPalette, '#091E4224', "var(--ds-border, #091E4224)"), (0, _defineProperty2.default)(_editorBorderPalette, '#758195', "var(--ds-border-bold, #758195)"), (0, _defineProperty2.default)(_editorBorderPalette, '#172B4D', "var(--ds-text, #172B4D)"), _editorBorderPalette);
39
+ exports.editorBorderPalette = editorBorderPalette;
package/dist/cjs/index.js CHANGED
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "hexToEditorBackgroundPaletteColorTokenName", {
15
15
  return _background.hexToEditorBackgroundPaletteColorTokenName;
16
16
  }
17
17
  });
18
+ Object.defineProperty(exports, "hexToEditorBorderPaletteColor", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _border.hexToEditorBorderPaletteColor;
22
+ }
23
+ });
18
24
  Object.defineProperty(exports, "hexToEditorTableChartsPaletteColor", {
19
25
  enumerable: true,
20
26
  get: function get() {
@@ -28,5 +34,6 @@ Object.defineProperty(exports, "hexToEditorTextPaletteColor", {
28
34
  }
29
35
  });
30
36
  var _background = require("./background");
37
+ var _border = require("./border");
31
38
  var _text = require("./text");
32
39
  var _tableCharts = require("./table-charts");
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-palette",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,36 @@
1
+ // This import will be stripped on build
2
+ // eslint-disable-next-line import/no-extraneous-dependencies
3
+
4
+ /**
5
+ * This takes an adf hex color and returns a matching border palette color.
6
+ *
7
+ * By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
8
+ *
9
+ * Example usage
10
+ * ```tsx
11
+ * const cssValue = hexToEditorBorderPaletteColor('#091E4224');
12
+ * // ^? const cssValue: string
13
+ * <div style={{borderColor: cssValue}} />
14
+ * ```
15
+ * The names of tokens can change over time, and the values of tokens will differ between themes.
16
+ * The exact output of this function is an implementation detail and should only be used when rendering
17
+ * content to the user, on a client with a matching major version of `@atlaskit/tokens`.
18
+ * - **DO NOT**: store the output of these functions in any user-generated content or back-end.
19
+ * - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
20
+ */
21
+
22
+ export function hexToEditorBorderPaletteColor(hexColor) {
23
+ // Ts ignore used to allow use of conditional return type
24
+ // (preferencing better type on consumption over safety in implementation)
25
+ // @ts-ignore
26
+ return editorBorderPalette[hexColor.toUpperCase()];
27
+ }
28
+ export const editorBorderPalette = {
29
+ // gray
30
+ /** gray - subtle */
31
+ ['#091E4224']: "var(--ds-border, #091E4224)",
32
+ /** gray */
33
+ ['#758195']: "var(--ds-border-bold, #758195)",
34
+ /** gray - bold */
35
+ ['#172B4D']: "var(--ds-text, #172B4D)"
36
+ };
@@ -1,3 +1,4 @@
1
1
  export { hexToEditorBackgroundPaletteColor, hexToEditorBackgroundPaletteColorTokenName } from './background';
2
+ export { hexToEditorBorderPaletteColor } from './border';
2
3
  export { hexToEditorTextPaletteColor } from './text';
3
4
  export { hexToEditorTableChartsPaletteColor } from './table-charts';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-palette",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,30 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
+ var _editorBorderPalette;
3
+ // This import will be stripped on build
4
+ // eslint-disable-next-line import/no-extraneous-dependencies
5
+
6
+ /**
7
+ * This takes an adf hex color and returns a matching border palette color.
8
+ *
9
+ * By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
10
+ *
11
+ * Example usage
12
+ * ```tsx
13
+ * const cssValue = hexToEditorBorderPaletteColor('#091E4224');
14
+ * // ^? const cssValue: string
15
+ * <div style={{borderColor: cssValue}} />
16
+ * ```
17
+ * The names of tokens can change over time, and the values of tokens will differ between themes.
18
+ * The exact output of this function is an implementation detail and should only be used when rendering
19
+ * content to the user, on a client with a matching major version of `@atlaskit/tokens`.
20
+ * - **DO NOT**: store the output of these functions in any user-generated content or back-end.
21
+ * - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
22
+ */
23
+
24
+ export function hexToEditorBorderPaletteColor(hexColor) {
25
+ // Ts ignore used to allow use of conditional return type
26
+ // (preferencing better type on consumption over safety in implementation)
27
+ // @ts-ignore
28
+ return editorBorderPalette[hexColor.toUpperCase()];
29
+ }
30
+ export var editorBorderPalette = (_editorBorderPalette = {}, _defineProperty(_editorBorderPalette, '#091E4224', "var(--ds-border, #091E4224)"), _defineProperty(_editorBorderPalette, '#758195', "var(--ds-border-bold, #758195)"), _defineProperty(_editorBorderPalette, '#172B4D', "var(--ds-text, #172B4D)"), _editorBorderPalette);
package/dist/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { hexToEditorBackgroundPaletteColor, hexToEditorBackgroundPaletteColorTokenName } from './background';
2
+ export { hexToEditorBorderPaletteColor } from './border';
2
3
  export { hexToEditorTextPaletteColor } from './text';
3
4
  export { hexToEditorTableChartsPaletteColor } from './table-charts';
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-palette",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * This takes an adf hex color and returns a matching border palette color.
3
+ *
4
+ * By providing a design token, this enables ADF content to be rendered in new themes such as dark mode.
5
+ *
6
+ * Example usage
7
+ * ```tsx
8
+ * const cssValue = hexToEditorBorderPaletteColor('#091E4224');
9
+ * // ^? const cssValue: string
10
+ * <div style={{borderColor: cssValue}} />
11
+ * ```
12
+ * The names of tokens can change over time, and the values of tokens will differ between themes.
13
+ * The exact output of this function is an implementation detail and should only be used when rendering
14
+ * content to the user, on a client with a matching major version of `@atlaskit/tokens`.
15
+ * - **DO NOT**: store the output of these functions in any user-generated content or back-end.
16
+ * - **DO**: store the ADF hex color, and use these utilities at render time to display the themed version of the color
17
+ */
18
+ export declare function hexToEditorBorderPaletteColor<HexColor extends string>(hexColor: HexColor): HexColor extends EditorBorderPaletteKey ? EditorBorderPalette[HexColor] : string | undefined;
19
+ declare type EditorBorderPalette = typeof editorBorderPalette;
20
+ export declare type EditorBorderPaletteKey = keyof EditorBorderPalette;
21
+ export declare const editorBorderPalette: {
22
+ /** gray - subtle */
23
+ "#091E4224": "var(--ds-border, #091E4224)";
24
+ /** gray */
25
+ "#758195": "var(--ds-border-bold, #758195)";
26
+ /** gray - bold */
27
+ "#172B4D": "var(--ds-text, #172B4D)";
28
+ };
29
+ export {};
@@ -1,3 +1,4 @@
1
1
  export { hexToEditorBackgroundPaletteColor, hexToEditorBackgroundPaletteColorTokenName, } from './background';
2
+ export { hexToEditorBorderPaletteColor } from './border';
2
3
  export { hexToEditorTextPaletteColor } from './text';
3
4
  export { hexToEditorTableChartsPaletteColor } from './table-charts';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-palette",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "The editor palette",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
package/report.api.md CHANGED
@@ -112,6 +112,19 @@ type EditorBackgroundPaletteKey = keyof EditorBackgroundPalette;
112
112
  // @public (undocumented)
113
113
  type EditorBackgroundPaletteTokenNames = typeof tokenNames[number];
114
114
 
115
+ // @public (undocumented)
116
+ type EditorBorderPalette = typeof editorBorderPalette;
117
+
118
+ // @public (undocumented)
119
+ const editorBorderPalette: {
120
+ '#091E4224': 'var(--ds-border, #091E4224)';
121
+ '#758195': 'var(--ds-border-bold, #758195)';
122
+ '#172B4D': 'var(--ds-text, #172B4D)';
123
+ };
124
+
125
+ // @public (undocumented)
126
+ type EditorBorderPaletteKey = keyof EditorBorderPalette;
127
+
115
128
  // @public (undocumented)
116
129
  type EditorTableChartsPalette = typeof editorTableChartsPalette;
117
130
 
@@ -205,6 +218,13 @@ export function hexToEditorBackgroundPaletteColorTokenName<
205
218
  ? EditorBackgroundPalette[HexColor]['tokenName']
206
219
  : EditorBackgroundPaletteTokenNames | undefined;
207
220
 
221
+ // @public
222
+ export function hexToEditorBorderPaletteColor<HexColor extends string>(
223
+ hexColor: HexColor,
224
+ ): HexColor extends EditorBorderPaletteKey
225
+ ? EditorBorderPalette[HexColor]
226
+ : string | undefined;
227
+
208
228
  // @public
209
229
  export function hexToEditorTableChartsPaletteColor<HexColor extends string>(
210
230
  hexColor: HexColor,