@atlaskit/code 14.1.3 → 14.3.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/bidi-warning/package.json +7 -0
  3. package/bidi-warning-decorator/package.json +7 -0
  4. package/dist/cjs/bidi-warning/bidi-warning-decorator.js +73 -0
  5. package/dist/cjs/bidi-warning/index.js +15 -0
  6. package/dist/cjs/bidi-warning/ui/index.js +55 -0
  7. package/dist/cjs/bidi-warning/ui/styled.js +74 -0
  8. package/dist/cjs/bidi-warning/ui/types.js +5 -0
  9. package/dist/cjs/code-block.js +14 -2
  10. package/dist/cjs/code.js +65 -2
  11. package/dist/cjs/internal/hooks/use-highlight.js +1 -2
  12. package/dist/cjs/react-syntax-highlighter-bidi-warning-renderer.js +180 -0
  13. package/dist/cjs/version.json +1 -1
  14. package/dist/es2019/bidi-warning/bidi-warning-decorator.js +42 -0
  15. package/dist/es2019/bidi-warning/index.js +1 -0
  16. package/dist/es2019/bidi-warning/ui/index.js +40 -0
  17. package/dist/es2019/bidi-warning/ui/styled.js +65 -0
  18. package/dist/es2019/bidi-warning/ui/types.js +1 -0
  19. package/dist/es2019/code-block.js +11 -2
  20. package/dist/es2019/code.js +54 -2
  21. package/dist/es2019/react-syntax-highlighter-bidi-warning-renderer.js +156 -0
  22. package/dist/es2019/version.json +1 -1
  23. package/dist/esm/bidi-warning/bidi-warning-decorator.js +61 -0
  24. package/dist/esm/bidi-warning/index.js +1 -0
  25. package/dist/esm/bidi-warning/ui/index.js +41 -0
  26. package/dist/esm/bidi-warning/ui/styled.js +64 -0
  27. package/dist/esm/bidi-warning/ui/types.js +1 -0
  28. package/dist/esm/code-block.js +13 -2
  29. package/dist/esm/code.js +56 -2
  30. package/dist/esm/internal/hooks/use-highlight.js +1 -2
  31. package/dist/esm/react-syntax-highlighter-bidi-warning-renderer.js +168 -0
  32. package/dist/esm/version.json +1 -1
  33. package/dist/types/bidi-warning/bidi-warning-decorator.d.ts +5 -0
  34. package/dist/types/bidi-warning/index.d.ts +1 -0
  35. package/dist/types/bidi-warning/ui/index.d.ts +2 -0
  36. package/dist/types/bidi-warning/ui/styled.d.ts +7 -0
  37. package/dist/types/bidi-warning/ui/types.d.ts +29 -0
  38. package/dist/types/code.d.ts +3 -2
  39. package/dist/types/internal/theme/get-theme.d.ts +1 -1
  40. package/dist/types/internal/types.d.ts +19 -0
  41. package/dist/types/internal/utils/get-normalized-language.d.ts +1 -1
  42. package/dist/types/react-syntax-highlighter-bidi-warning-renderer.d.ts +9 -0
  43. package/dist/types/types.d.ts +19 -0
  44. package/package.json +10 -6
package/dist/esm/code.js CHANGED
@@ -2,9 +2,11 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
3
 
4
4
  /** @jsx jsx */
5
- import { forwardRef, memo, useMemo } from 'react';
5
+ import React, { forwardRef, memo, useMemo } from 'react';
6
6
  import { jsx } from '@emotion/core';
7
7
  import { useGlobalTheme } from '@atlaskit/theme/components';
8
+ import CodeBidiWarning from './bidi-warning';
9
+ import codeBidiWarningDecorator from './bidi-warning/bidi-warning-decorator';
8
10
  import { getCodeStyles } from './internal/theme/styles';
9
11
  var Code = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Code(_ref, ref) {
10
12
  var testId = _ref.testId,
@@ -14,12 +16,64 @@ var Code = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Code(_ref, ref) {
14
16
  var styles = useMemo(function () {
15
17
  return getCodeStyles(theme);
16
18
  }, [theme]);
19
+
20
+ var children = props.children,
21
+ _props$codeBidiWarnin = props.codeBidiWarnings,
22
+ codeBidiWarnings = _props$codeBidiWarnin === void 0 ? true : _props$codeBidiWarnin,
23
+ codeBidiWarningLabel = props.codeBidiWarningLabel,
24
+ _props$codeBidiWarnin2 = props.codeBidiWarningTooltipEnabled,
25
+ codeBidiWarningTooltipEnabled = _props$codeBidiWarnin2 === void 0 ? true : _props$codeBidiWarnin2,
26
+ otherProps = _objectWithoutProperties(props, ["children", "codeBidiWarnings", "codeBidiWarningLabel", "codeBidiWarningTooltipEnabled"]);
27
+
28
+ var decoratedChildren = codeBidiWarnings ? jsx(RenderCodeChildrenWithBidiWarnings, {
29
+ codeBidiWarningLabel: codeBidiWarningLabel,
30
+ codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
31
+ }, children) : children;
17
32
  return jsx("code", _extends({
18
33
  ref: ref,
19
34
  "data-testid": testId,
20
35
  css: styles
21
- }, props));
36
+ }, otherProps), decoratedChildren);
22
37
  }));
38
+
39
+ function RenderCodeChildrenWithBidiWarnings(_ref2) {
40
+ var children = _ref2.children,
41
+ codeBidiWarningLabel = _ref2.codeBidiWarningLabel,
42
+ codeBidiWarningTooltipEnabled = _ref2.codeBidiWarningTooltipEnabled;
43
+ var replacedChildren = React.Children.map(children, function (childNode) {
44
+ if (typeof childNode === 'string') {
45
+ var decorated = codeBidiWarningDecorator(childNode, function (_ref3) {
46
+ var bidiCharacter = _ref3.bidiCharacter,
47
+ index = _ref3.index;
48
+ return jsx(CodeBidiWarning, {
49
+ bidiCharacter: bidiCharacter,
50
+ key: index,
51
+ label: codeBidiWarningLabel,
52
+ tooltipEnabled: codeBidiWarningTooltipEnabled
53
+ });
54
+ });
55
+ return decorated;
56
+ }
57
+
58
+ if (isReactElement(childNode) && childNode.props.children) {
59
+ var newChildNode = /*#__PURE__*/React.cloneElement(childNode, {
60
+ children: jsx(RenderCodeChildrenWithBidiWarnings, {
61
+ codeBidiWarningLabel: codeBidiWarningLabel,
62
+ codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
63
+ }, childNode.props.children)
64
+ });
65
+ return newChildNode;
66
+ }
67
+
68
+ return childNode;
69
+ });
70
+ return jsx(React.Fragment, null, replacedChildren);
71
+ }
72
+
73
+ function isReactElement(child) {
74
+ return !!child.type;
75
+ }
76
+
23
77
  Code.displayName = 'Code';
24
78
  export { getCodeStyles };
25
79
  export default Code;
@@ -29,8 +29,7 @@ export var useHighlightLines = function useHighlightLines(_ref) {
29
29
  if (num.indexOf('-') > 0) {
30
30
  // We found a line group, e.g. 1-3
31
31
  var _num$split$map$sort = num.split('-').map(Number) // Sort by lowest value first, highest value last.
32
- . // Sort by lowest value first, highest value last.
33
- sort(function (a, b) {
32
+ .sort(function (a, b) {
34
33
  return a - b;
35
34
  }),
36
35
  _num$split$map$sort2 = _slicedToArray(_num$split$map$sort, 2),
@@ -0,0 +1,168 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
5
+
6
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
7
+
8
+ // @ts-nocheck
9
+ import React from 'react';
10
+ import CodeBidiWarning from './bidi-warning';
11
+ import codeBidiWarningDecorator from './bidi-warning/bidi-warning-decorator'; // File mostly vendored from react-syntax-highlighter
12
+ //
13
+ // - https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/efc3f7b7537d1729193b7a472067bcbe6cbecaf1/src/highlight.js#L272-L281
14
+ // - https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/efc3f7b7537d1729193b7a472067bcbe6cbecaf1/src/create-element.js
15
+ //
16
+ // Patching react syntax-highlighter with a decoration feature is likely preferable
17
+
18
+ export function createBidiWarningRenderer(codeBidiWarningConfig) {
19
+ return function bidiWarningRenderer(_ref) {
20
+ var rows = _ref.rows,
21
+ stylesheet = _ref.stylesheet,
22
+ useInlineStyles = _ref.useInlineStyles;
23
+ return rows.map(function (node, i) {
24
+ return createElement({
25
+ node: node,
26
+ stylesheet: stylesheet,
27
+ useInlineStyles: useInlineStyles,
28
+ codeBidiWarningConfig: codeBidiWarningConfig,
29
+ key: "code-segement".concat(i)
30
+ });
31
+ });
32
+ };
33
+ } // Get all possible permutations of all power sets
34
+ //
35
+ // Super simple, non-algorithmic solution since the
36
+ // number of class names will not be greater than 4
37
+
38
+ function powerSetPermutations(arr) {
39
+ var arrLength = arr.length;
40
+
41
+ if (arrLength === 0 || arrLength === 1) {
42
+ return arr;
43
+ }
44
+
45
+ if (arrLength === 2) {
46
+ // prettier-ignore
47
+ return [arr[0], arr[1], "".concat(arr[0], ".").concat(arr[1]), "".concat(arr[1], ".").concat(arr[0])];
48
+ }
49
+
50
+ if (arrLength === 3) {
51
+ return [arr[0], arr[1], arr[2], "".concat(arr[0], ".").concat(arr[1]), "".concat(arr[0], ".").concat(arr[2]), "".concat(arr[1], ".").concat(arr[0]), "".concat(arr[1], ".").concat(arr[2]), "".concat(arr[2], ".").concat(arr[0]), "".concat(arr[2], ".").concat(arr[1]), "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[2]), "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[1]), "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[2]), "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[0]), "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[1]), "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[0])];
52
+ }
53
+
54
+ if (arrLength >= 4) {
55
+ // Currently does not support more than 4 extra
56
+ // class names (after `.token` has been removed)
57
+ return [arr[0], arr[1], arr[2], arr[3], "".concat(arr[0], ".").concat(arr[1]), "".concat(arr[0], ".").concat(arr[2]), "".concat(arr[0], ".").concat(arr[3]), "".concat(arr[1], ".").concat(arr[0]), "".concat(arr[1], ".").concat(arr[2]), "".concat(arr[1], ".").concat(arr[3]), "".concat(arr[2], ".").concat(arr[0]), "".concat(arr[2], ".").concat(arr[1]), "".concat(arr[2], ".").concat(arr[3]), "".concat(arr[3], ".").concat(arr[0]), "".concat(arr[3], ".").concat(arr[1]), "".concat(arr[3], ".").concat(arr[2]), "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[2]), "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[3]), "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[1]), "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[3]), "".concat(arr[0], ".").concat(arr[3], ".").concat(arr[1]), "".concat(arr[0], ".").concat(arr[3], ".").concat(arr[2]), "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[2]), "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[3]), "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[0]), "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[3]), "".concat(arr[1], ".").concat(arr[3], ".").concat(arr[0]), "".concat(arr[1], ".").concat(arr[3], ".").concat(arr[2]), "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[1]), "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[3]), "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[0]), "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[3]), "".concat(arr[2], ".").concat(arr[3], ".").concat(arr[0]), "".concat(arr[2], ".").concat(arr[3], ".").concat(arr[1]), "".concat(arr[3], ".").concat(arr[0], ".").concat(arr[1]), "".concat(arr[3], ".").concat(arr[0], ".").concat(arr[2]), "".concat(arr[3], ".").concat(arr[1], ".").concat(arr[0]), "".concat(arr[3], ".").concat(arr[1], ".").concat(arr[2]), "".concat(arr[3], ".").concat(arr[2], ".").concat(arr[0]), "".concat(arr[3], ".").concat(arr[2], ".").concat(arr[1]), "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[2], ".").concat(arr[3]), "".concat(arr[0], ".").concat(arr[1], ".").concat(arr[3], ".").concat(arr[2]), "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[1], ".").concat(arr[3]), "".concat(arr[0], ".").concat(arr[2], ".").concat(arr[3], ".").concat(arr[1]), "".concat(arr[0], ".").concat(arr[3], ".").concat(arr[1], ".").concat(arr[2]), "".concat(arr[0], ".").concat(arr[3], ".").concat(arr[2], ".").concat(arr[1]), "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[2], ".").concat(arr[3]), "".concat(arr[1], ".").concat(arr[0], ".").concat(arr[3], ".").concat(arr[2]), "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[0], ".").concat(arr[3]), "".concat(arr[1], ".").concat(arr[2], ".").concat(arr[3], ".").concat(arr[0]), "".concat(arr[1], ".").concat(arr[3], ".").concat(arr[0], ".").concat(arr[2]), "".concat(arr[1], ".").concat(arr[3], ".").concat(arr[2], ".").concat(arr[0]), "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[1], ".").concat(arr[3]), "".concat(arr[2], ".").concat(arr[0], ".").concat(arr[3], ".").concat(arr[1]), "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[0], ".").concat(arr[3]), "".concat(arr[2], ".").concat(arr[1], ".").concat(arr[3], ".").concat(arr[0]), "".concat(arr[2], ".").concat(arr[3], ".").concat(arr[0], ".").concat(arr[1]), "".concat(arr[2], ".").concat(arr[3], ".").concat(arr[1], ".").concat(arr[0]), "".concat(arr[3], ".").concat(arr[0], ".").concat(arr[1], ".").concat(arr[2]), "".concat(arr[3], ".").concat(arr[0], ".").concat(arr[2], ".").concat(arr[1]), "".concat(arr[3], ".").concat(arr[1], ".").concat(arr[0], ".").concat(arr[2]), "".concat(arr[3], ".").concat(arr[1], ".").concat(arr[2], ".").concat(arr[0]), "".concat(arr[3], ".").concat(arr[2], ".").concat(arr[0], ".").concat(arr[1]), "".concat(arr[3], ".").concat(arr[2], ".").concat(arr[1], ".").concat(arr[0])];
58
+ }
59
+ }
60
+
61
+ var classNameCombinations = {};
62
+
63
+ function getClassNameCombinations(classNames) {
64
+ if (classNames.length === 0 || classNames.length === 1) {
65
+ return classNames;
66
+ }
67
+
68
+ var key = classNames.join('.');
69
+
70
+ if (!classNameCombinations[key]) {
71
+ classNameCombinations[key] = powerSetPermutations(classNames);
72
+ }
73
+
74
+ return classNameCombinations[key];
75
+ }
76
+
77
+ export function createStyleObject(classNames) {
78
+ var elementStyle = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
79
+ var stylesheet = arguments.length > 2 ? arguments[2] : undefined;
80
+ var nonTokenClassNames = classNames.filter(function (className) {
81
+ return className !== 'token';
82
+ });
83
+ var classNamesCombinations = getClassNameCombinations(nonTokenClassNames);
84
+ return classNamesCombinations.reduce(function (styleObject, className) {
85
+ return _objectSpread(_objectSpread({}, styleObject), stylesheet[className]);
86
+ }, elementStyle);
87
+ }
88
+ export function createClassNameString(classNames) {
89
+ return classNames.join(' ');
90
+ }
91
+ export function createChildren(stylesheet, useInlineStyles, codeBidiWarningConfig) {
92
+ var childrenCount = 0;
93
+ return function (children) {
94
+ childrenCount += 1;
95
+ return children.map(function (child, i) {
96
+ return createElement({
97
+ node: child,
98
+ stylesheet: stylesheet,
99
+ useInlineStyles: useInlineStyles,
100
+ codeBidiWarningConfig: codeBidiWarningConfig,
101
+ key: "code-segment-".concat(childrenCount, "-").concat(i)
102
+ });
103
+ });
104
+ };
105
+ }
106
+
107
+ function createElement(_ref2) {
108
+ var node = _ref2.node,
109
+ stylesheet = _ref2.stylesheet,
110
+ _ref2$style = _ref2.style,
111
+ style = _ref2$style === void 0 ? {} : _ref2$style,
112
+ useInlineStyles = _ref2.useInlineStyles,
113
+ codeBidiWarningConfig = _ref2.codeBidiWarningConfig,
114
+ key = _ref2.key;
115
+ var properties = node.properties,
116
+ type = node.type,
117
+ TagName = node.tagName,
118
+ value = node.value;
119
+
120
+ if (type === 'text') {
121
+ // occasionally react-syntax-highlighter passes a numeric value when the
122
+ // type is text
123
+ var textValue = value + '';
124
+ var decorated = codeBidiWarningDecorator(textValue, function (_ref3) {
125
+ var bidiCharacter = _ref3.bidiCharacter,
126
+ index = _ref3.index;
127
+ return /*#__PURE__*/React.createElement(CodeBidiWarning, {
128
+ bidiCharacter: bidiCharacter,
129
+ key: index,
130
+ label: codeBidiWarningConfig.codeBidiWarningLabel,
131
+ tooltipEnabled: codeBidiWarningConfig.codeBidiWarningTooltipEnabled
132
+ });
133
+ });
134
+ return decorated;
135
+ } else if (TagName) {
136
+ var childrenCreator = createChildren(stylesheet, useInlineStyles, codeBidiWarningConfig);
137
+ var props;
138
+
139
+ if (!useInlineStyles) {
140
+ props = _objectSpread(_objectSpread({}, properties), {}, {
141
+ className: createClassNameString(properties.className)
142
+ });
143
+ } else {
144
+ var allStylesheetSelectors = Object.keys(stylesheet).reduce(function (classes, selector) {
145
+ selector.split('.').forEach(function (className) {
146
+ if (!classes.includes(className)) {
147
+ classes.push(className);
148
+ }
149
+ });
150
+ return classes;
151
+ }, []); // For compatibility with older versions of react-syntax-highlighter
152
+
153
+ var startingClassName = properties.className && properties.className.includes('token') ? ['token'] : [];
154
+ var className = properties.className && startingClassName.concat(properties.className.filter(function (className) {
155
+ return !allStylesheetSelectors.includes(className);
156
+ }));
157
+ props = _objectSpread(_objectSpread({}, properties), {}, {
158
+ className: createClassNameString(className) || undefined,
159
+ style: createStyleObject(properties.className, Object.assign({}, properties.style, style), stylesheet)
160
+ });
161
+ }
162
+
163
+ var children = childrenCreator(node.children);
164
+ return /*#__PURE__*/React.createElement(TagName, _extends({
165
+ key: key
166
+ }, props), children);
167
+ }
168
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/code",
3
- "version": "14.1.3",
3
+ "version": "14.3.0",
4
4
  "sideEffects": false
5
5
  }
@@ -0,0 +1,5 @@
1
+ export declare const bidiCharacterRegex: RegExp;
2
+ export default function codeBidiWarningDecorator<DecoratorOutput>(originalText: string, decorate: (options: {
3
+ bidiCharacter: string;
4
+ index?: number;
5
+ }) => DecoratorOutput): string | (string | DecoratorOutput)[];
@@ -0,0 +1 @@
1
+ export { default } from './ui';
@@ -0,0 +1,2 @@
1
+ import { CodeBidiWarningProps } from './types';
2
+ export default function BidiWarning({ testId, bidiCharacter, skipChildren, tooltipEnabled, label, }: CodeBidiWarningProps): JSX.Element;
@@ -0,0 +1,7 @@
1
+ /** @jsx jsx */
2
+ import { ReactNode } from 'react';
3
+ export declare function Decorator({ bidiCharacter, children, testId, }: {
4
+ bidiCharacter: string;
5
+ children: ReactNode;
6
+ testId?: string;
7
+ }): JSX.Element;
@@ -0,0 +1,29 @@
1
+ export declare type CodeBidiWarningProps = {
2
+ /**
3
+ * A `testId` prop is provided for specified elements, which is a unique
4
+ * string that appears as a data attribute `data-testid` in the rendered code,
5
+ * serving as a hook for automated tests */
6
+ testId?: string;
7
+ /**
8
+ * A bidi character which can be used to perform a "bidi override attack".
9
+ *
10
+ * See the following document for details.
11
+ *
12
+ * https://hello.atlassian.net/wiki/spaces/PRODSEC/pages/1347434677/PSHELP-2943+Investigate+Trojan+Source+Attack+Vulnerability#1)-Providing-visual-cues-for-our-Customers-in-our-affected-products
13
+ */
14
+ bidiCharacter: string;
15
+ /**
16
+ * Defaults to enabled (true)
17
+ *
18
+ * Intended to be disabled when used in a mobile view, such as in the editor
19
+ * via mobile bridge, where the tooltip could end up being cut off of otherwise
20
+ * not work as expected.
21
+ */
22
+ tooltipEnabled?: boolean;
23
+ skipChildren?: boolean;
24
+ /**
25
+ * Labels for the previous and next buttons used in pagination.
26
+ * Defaults to `Bidirectional characters change the order that text is rendered. This could be used to obscure malicious code.`.
27
+ */
28
+ label?: string;
29
+ };
@@ -1,6 +1,7 @@
1
- /// <reference types="react" />
1
+ /** @jsx jsx */
2
+ import React from 'react';
2
3
  import { getCodeStyles } from './internal/theme/styles';
3
4
  import type { CodeProps } from './types';
4
- declare const Code: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<Pick<CodeProps, "as" | "css" | "name" | "color" | "content" | "height" | "width" | "start" | "hidden" | "size" | "style" | "default" | "wrap" | "open" | "multiple" | "disabled" | "testId" | "children" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "cite" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "data" | "dateTime" | "defer" | "download" | "encType" | "form" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "label" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "muted" | "nonce" | "noValidate" | "optimum" | "pattern" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "span" | "src" | "srcDoc" | "srcLang" | "srcSet" | "step" | "summary" | "target" | "type" | "useMap" | "value" | "wmode" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "id" | "lang" | "slot" | "spellCheck" | "tabIndex" | "title" | "inputMode" | "is" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key"> & import("react").RefAttributes<HTMLElement>>>;
5
+ declare const Code: React.MemoExoticComponent<React.ForwardRefExoticComponent<Pick<CodeProps, "as" | "css" | "name" | "color" | "content" | "height" | "width" | "start" | "children" | "testId" | "default" | "cite" | "data" | "form" | "label" | "span" | "style" | "summary" | "title" | "pattern" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "controls" | "coords" | "crossOrigin" | "dateTime" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "nonce" | "noValidate" | "open" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "size" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "step" | "target" | "type" | "useMap" | "value" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "slot" | "spellCheck" | "tabIndex" | "inputMode" | "is" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "codeBidiWarnings" | "codeBidiWarningLabel" | "codeBidiWarningTooltipEnabled"> & React.RefAttributes<HTMLElement>>>;
5
6
  export { getCodeStyles };
6
7
  export default Code;
@@ -2,6 +2,6 @@ import type { Theme } from '@atlaskit/theme/types';
2
2
  import type { CodeBlockTheme, CodeTheme } from './types';
3
3
  export declare const getBaseTheme: (theme: Theme) => CodeTheme;
4
4
  export declare const defaultBaseTheme: CodeTheme;
5
- export declare const getColorPalette: (theme: Theme) => CodeBlockTheme;
5
+ export declare const getColorPalette: import("memoize-one").MemoizedFn<(theme: Theme) => CodeBlockTheme>;
6
6
  declare const getTheme: (theme: Theme) => CodeBlockTheme;
7
7
  export default getTheme;
@@ -34,6 +34,25 @@ export interface CodeBlockProps {
34
34
  * Screen reader text for the end of a highlighted line
35
35
  */
36
36
  highlightedEndText?: string;
37
+ /**
38
+ * When false, disables decorating code with bidi warnings
39
+ *
40
+ * defaults to true
41
+ */
42
+ codeBidiWarnings?: boolean;
43
+ /**
44
+ * Labels for the previous and next buttons used in pagination.
45
+ * Defaults to `Bidirectional characters change the order that text is rendered. This could be used to obscure malicious code.`.
46
+ */
47
+ codeBidiWarningLabel?: string;
48
+ /**
49
+ * Defaults to enabled (true)
50
+ *
51
+ * Intended to be disabled when used in a mobile view, such as in the editor
52
+ * via mobile bridge, where the tooltip could end up being cut off of otherwise
53
+ * not work as expected.
54
+ */
55
+ codeBidiWarningTooltipEnabled?: boolean;
37
56
  }
38
57
  export type { SupportedLanguages, LanguageAlias, Language } from '../constants';
39
58
  export type { CodeBlockTheme, CodeTheme } from './theme/types';
@@ -1 +1 @@
1
- export declare const normalizeLanguage: (language?: "PHP" | "php" | "php3" | "php4" | "php5" | "Java" | "java" | "CSharp" | "csharp" | "c#" | "Python" | "python" | "py" | "JavaScript" | "javascript" | "js" | "Html" | "html" | "xml" | "C++" | "c++" | "cpp" | "clike" | "Ruby" | "ruby" | "rb" | "duby" | "Objective-C" | "objective-c" | "objectivec" | "obj-c" | "objc" | "C" | "c" | "Swift" | "swift" | "TeX" | "tex" | "latex" | "Shell" | "shell" | "bash" | "sh" | "ksh" | "zsh" | "Scala" | "scala" | "Go" | "go" | "ActionScript" | "actionscript" | "actionscript3" | "as" | "ColdFusion" | "coldfusion" | "JavaFX" | "javafx" | "jfx" | "VbNet" | "vbnet" | "vb.net" | "vfp" | "clipper" | "xbase" | "JSON" | "json" | "MATLAB" | "matlab" | "Groovy" | "groovy" | "SQL" | "sql" | "postgresql" | "postgres" | "plpgsql" | "psql" | "postgresql-console" | "postgres-console" | "tsql" | "t-sql" | "mysql" | "sqlite" | "R" | "r" | "Perl" | "perl" | "pl" | "Lua" | "lua" | "Pascal" | "pas" | "pascal" | "objectpascal" | "delphi" | "XML" | "TypeScript" | "typescript" | "ts" | "CoffeeScript" | "coffeescript" | "coffee-script" | "coffee" | "Haskell" | "haskell" | "hs" | "Puppet" | "puppet" | "Arduino" | "arduino" | "Fortran" | "fortran" | "Erlang" | "erlang" | "erl" | "PowerShell" | "powershell" | "posh" | "ps1" | "psm1" | "Haxe" | "haxe" | "hx" | "hxsl" | "Elixir" | "elixir" | "ex" | "exs" | "Verilog" | "verilog" | "v" | "Rust" | "rust" | "VHDL" | "vhdl" | "Sass" | "sass" | "OCaml" | "ocaml" | "Dart" | "dart" | "CSS" | "css" | "reStructuredText" | "restructuredtext" | "rst" | "rest" | "Kotlin" | "kotlin" | "D" | "d" | "Octave" | "octave" | "QML" | "qbs" | "qml" | "Prolog" | "prolog" | "FoxPro" | "foxpro" | "purebasic" | "Scheme" | "scheme" | "scm" | "CUDA" | "cuda" | "cu" | "Julia" | "julia" | "jl" | "Racket" | "racket" | "rkt" | "Ada" | "ada" | "ada95" | "ada2005" | "Tcl" | "tcl" | "Mathematica" | "mathematica" | "mma" | "nb" | "Autoit" | "autoit" | "StandardML" | "standardmL" | "sml" | "standardml" | "Objective-J" | "objective-j" | "objectivej" | "obj-j" | "objj" | "Smalltalk" | "smalltalk" | "squeak" | "st" | "Vala" | "vala" | "vapi" | "ABAP" | "abap" | "LiveScript" | "livescript" | "live-script" | "XQuery" | "xquery" | "xqy" | "xq" | "xql" | "xqm" | "PlainText" | "text" | "plaintext" | "Yaml" | "yaml" | "yml" | "GraphQL" | "graphql" | "AppleScript" | "applescript" | "Clojure" | "clojure" | "Diff" | "diff" | "VisualBasic" | "visualbasic" | "JSX" | "jsx" | "TSX" | "tsx" | "SplunkSPL" | "splunk-spl" | undefined) => string;
1
+ export declare const normalizeLanguage: import("memoize-one").MemoizedFn<(language?: "PHP" | "php" | "php3" | "php4" | "php5" | "Java" | "java" | "CSharp" | "csharp" | "c#" | "Python" | "python" | "py" | "JavaScript" | "javascript" | "js" | "Html" | "html" | "xml" | "C++" | "c++" | "cpp" | "clike" | "Ruby" | "ruby" | "rb" | "duby" | "Objective-C" | "objective-c" | "objectivec" | "obj-c" | "objc" | "C" | "c" | "Swift" | "swift" | "TeX" | "tex" | "latex" | "Shell" | "shell" | "bash" | "sh" | "ksh" | "zsh" | "Scala" | "scala" | "Go" | "go" | "ActionScript" | "actionscript" | "actionscript3" | "as" | "ColdFusion" | "coldfusion" | "JavaFX" | "javafx" | "jfx" | "VbNet" | "vbnet" | "vb.net" | "vfp" | "clipper" | "xbase" | "JSON" | "json" | "MATLAB" | "matlab" | "Groovy" | "groovy" | "SQL" | "sql" | "postgresql" | "postgres" | "plpgsql" | "psql" | "postgresql-console" | "postgres-console" | "tsql" | "t-sql" | "mysql" | "sqlite" | "R" | "r" | "Perl" | "perl" | "pl" | "Lua" | "lua" | "Pascal" | "pas" | "pascal" | "objectpascal" | "delphi" | "XML" | "TypeScript" | "typescript" | "ts" | "CoffeeScript" | "coffeescript" | "coffee-script" | "coffee" | "Haskell" | "haskell" | "hs" | "Puppet" | "puppet" | "Arduino" | "arduino" | "Fortran" | "fortran" | "Erlang" | "erlang" | "erl" | "PowerShell" | "powershell" | "posh" | "ps1" | "psm1" | "Haxe" | "haxe" | "hx" | "hxsl" | "Elixir" | "elixir" | "ex" | "exs" | "Verilog" | "verilog" | "v" | "Rust" | "rust" | "VHDL" | "vhdl" | "Sass" | "sass" | "OCaml" | "ocaml" | "Dart" | "dart" | "CSS" | "css" | "reStructuredText" | "restructuredtext" | "rst" | "rest" | "Kotlin" | "kotlin" | "D" | "d" | "Octave" | "octave" | "QML" | "qbs" | "qml" | "Prolog" | "prolog" | "FoxPro" | "foxpro" | "purebasic" | "Scheme" | "scheme" | "scm" | "CUDA" | "cuda" | "cu" | "Julia" | "julia" | "jl" | "Racket" | "racket" | "rkt" | "Ada" | "ada" | "ada95" | "ada2005" | "Tcl" | "tcl" | "Mathematica" | "mathematica" | "mma" | "nb" | "Autoit" | "autoit" | "StandardML" | "standardmL" | "sml" | "standardml" | "Objective-J" | "objective-j" | "objectivej" | "obj-j" | "objj" | "Smalltalk" | "smalltalk" | "squeak" | "st" | "Vala" | "vala" | "vapi" | "ABAP" | "abap" | "LiveScript" | "livescript" | "live-script" | "XQuery" | "xquery" | "xqy" | "xq" | "xql" | "xqm" | "PlainText" | "text" | "plaintext" | "Yaml" | "yaml" | "yml" | "GraphQL" | "graphql" | "AppleScript" | "applescript" | "Clojure" | "clojure" | "Diff" | "diff" | "VisualBasic" | "visualbasic" | "JSX" | "jsx" | "TSX" | "tsx" | "SplunkSPL" | "splunk-spl" | undefined) => string>;
@@ -0,0 +1,9 @@
1
+ declare type CodeBidiWarningConfig = {
2
+ codeBidiWarningLabel?: string;
3
+ codeBidiWarningTooltipEnabled: boolean;
4
+ };
5
+ export declare function createBidiWarningRenderer(codeBidiWarningConfig: CodeBidiWarningConfig): ({ rows, stylesheet, useInlineStyles, }: any) => any;
6
+ export declare function createStyleObject(classNames: any, elementStyle: {} | undefined, stylesheet: any): any;
7
+ export declare function createClassNameString(classNames: any): any;
8
+ export declare function createChildren(stylesheet: any, useInlineStyles: any, codeBidiWarningConfig: any): (children: any) => any;
9
+ export {};
@@ -10,4 +10,23 @@ export interface CodeProps extends HTMLProps<HTMLElement> {
10
10
  * Content to be rendered in the inline code block
11
11
  */
12
12
  children?: ReactNode;
13
+ /**
14
+ * When false, disables decorating code with bidi warnings
15
+ *
16
+ * defaults to true
17
+ */
18
+ codeBidiWarnings?: boolean;
19
+ /**
20
+ * Labels for the previous and next buttons used in pagination.
21
+ * Defaults to `Bidirectional characters change the order that text is rendered. This could be used to obscure malicious code.`.
22
+ */
23
+ codeBidiWarningLabel?: string;
24
+ /**
25
+ * Defaults to enabled (true)
26
+ *
27
+ * Intended to be disabled when used in a mobile view, such as in the editor
28
+ * via mobile bridge, where the tooltip could end up being cut off of otherwise
29
+ * not work as expected.
30
+ */
31
+ codeBidiWarningTooltipEnabled?: boolean;
13
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/code",
3
- "version": "14.1.3",
3
+ "version": "14.3.0",
4
4
  "description": "Code highlights short strings of code snippets inline with body text.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -26,11 +26,12 @@
26
26
  "access": "public"
27
27
  },
28
28
  "dependencies": {
29
- "@atlaskit/codemod-utils": "^3.2.0",
30
- "@atlaskit/theme": "^11.3.0",
29
+ "@atlaskit/codemod-utils": "^3.4.0",
30
+ "@atlaskit/theme": "^12.0.0",
31
+ "@atlaskit/tooltip": "^17.5.0",
31
32
  "@babel/runtime": "^7.0.0",
32
33
  "@emotion/core": "^10.0.9",
33
- "memoize-one": "^5.1.0",
34
+ "memoize-one": "^6.0.0",
34
35
  "react-syntax-highlighter": "^15.4.3"
35
36
  },
36
37
  "peerDependencies": {
@@ -38,8 +39,9 @@
38
39
  },
39
40
  "devDependencies": {
40
41
  "@atlaskit/build-utils": "*",
41
- "@atlaskit/button": "^15.1.4",
42
+ "@atlaskit/button": "^16.0.0",
42
43
  "@atlaskit/docs": "^9.0.0",
44
+ "@atlaskit/section-message": "^6.0.0",
43
45
  "@atlaskit/ssr": "*",
44
46
  "@atlaskit/visual-regression": "*",
45
47
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
@@ -60,6 +62,8 @@
60
62
  "af:exports": {
61
63
  "./types": "./src/entry-points/types.ts",
62
64
  ".": "./src/index.ts",
65
+ "./bidi-warning": "./src/bidi-warning/index.ts",
66
+ "./bidi-warning-decorator": "./src/bidi-warning/bidi-warning-decorator.tsx",
63
67
  "./block": "./src/entry-points/block.ts",
64
68
  "./inline": "./src/entry-points/inline.ts",
65
69
  "./constants": "./src/entry-points/constants.ts"
@@ -76,7 +80,7 @@
76
80
  "analytics-next"
77
81
  ],
78
82
  "theming": [
79
- "new-theming-api"
83
+ "react-context"
80
84
  ],
81
85
  "deprecation": [
82
86
  "no-deprecated-imports"