@atlaskit/code 17.2.2 → 17.2.4

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 (50) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/bidi-warning/package.json +1 -1
  3. package/bidi-warning-decorator/package.json +1 -1
  4. package/block/package.json +1 -1
  5. package/constants/package.json +1 -1
  6. package/dist/cjs/bidi-warning/ui/index.js +8 -3
  7. package/dist/cjs/code-block.compiled.css +1 -1
  8. package/dist/cjs/code-block.js +15 -5
  9. package/dist/cjs/code.compiled.css +1 -1
  10. package/dist/cjs/code.js +10 -4
  11. package/dist/cjs/constants.js +4 -0
  12. package/dist/cjs/syntax-highlighter/lib/process/create-line-element.js +4 -1
  13. package/dist/cjs/syntax-highlighter/lib/react-renderer/create-element.js +1 -1
  14. package/dist/es2019/bidi-warning/ui/index.js +8 -3
  15. package/dist/es2019/code-block.compiled.css +1 -1
  16. package/dist/es2019/code-block.js +15 -5
  17. package/dist/es2019/code.compiled.css +1 -1
  18. package/dist/es2019/code.js +9 -3
  19. package/dist/es2019/constants.js +4 -0
  20. package/dist/es2019/syntax-highlighter/lib/process/create-line-element.js +4 -1
  21. package/dist/es2019/syntax-highlighter/lib/react-renderer/create-element.js +1 -1
  22. package/dist/esm/bidi-warning/ui/index.js +8 -3
  23. package/dist/esm/code-block.compiled.css +1 -1
  24. package/dist/esm/code-block.js +15 -5
  25. package/dist/esm/code.compiled.css +1 -1
  26. package/dist/esm/code.js +10 -4
  27. package/dist/esm/constants.js +4 -0
  28. package/dist/esm/syntax-highlighter/lib/process/create-line-element.js +4 -1
  29. package/dist/esm/syntax-highlighter/lib/react-renderer/create-element.js +1 -1
  30. package/dist/types/bidi-warning/ui/index.d.ts +1 -1
  31. package/dist/types/bidi-warning/ui/types.d.ts +15 -0
  32. package/dist/types/code-block.d.ts +0 -1
  33. package/dist/types/constants.d.ts +4 -0
  34. package/dist/types/internal/hooks/use-highlight.d.ts +1 -1
  35. package/dist/types/internal/types.d.ts +20 -0
  36. package/dist/types/syntax-highlighter/lib/highlight.d.ts +0 -1
  37. package/dist/types/syntax-highlighter/lib/process/create-line-element.d.ts +9 -1
  38. package/dist/types/types.d.ts +13 -0
  39. package/dist/types-ts4.5/bidi-warning/ui/index.d.ts +1 -1
  40. package/dist/types-ts4.5/bidi-warning/ui/types.d.ts +15 -0
  41. package/dist/types-ts4.5/code-block.d.ts +0 -1
  42. package/dist/types-ts4.5/constants.d.ts +7 -0
  43. package/dist/types-ts4.5/internal/hooks/use-highlight.d.ts +1 -1
  44. package/dist/types-ts4.5/internal/types.d.ts +20 -0
  45. package/dist/types-ts4.5/syntax-highlighter/lib/highlight.d.ts +0 -1
  46. package/dist/types-ts4.5/syntax-highlighter/lib/process/create-line-element.d.ts +9 -1
  47. package/dist/types-ts4.5/types.d.ts +13 -0
  48. package/inline/package.json +1 -1
  49. package/package.json +12 -22
  50. package/types/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/code
2
2
 
3
+ ## 17.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`74c2f420ee49b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/74c2f420ee49b) -
8
+ Internal changes to how border radius is applied.
9
+
10
+ ## 17.2.3
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
3
16
  ## 17.2.2
4
17
 
5
18
  ### Patch Changes
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "types": "../dist/types/bidi-warning/index.d.ts",
10
10
  "typesVersions": {
11
- ">=4.5 <5.4": {
11
+ ">=4.5 <5.9": {
12
12
  "*": [
13
13
  "../dist/types-ts4.5/bidi-warning/index.d.ts"
14
14
  ]
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "types": "../dist/types/bidi-warning/bidi-warning-decorator.d.ts",
10
10
  "typesVersions": {
11
- ">=4.5 <5.4": {
11
+ ">=4.5 <5.9": {
12
12
  "*": [
13
13
  "../dist/types-ts4.5/bidi-warning/bidi-warning-decorator.d.ts"
14
14
  ]
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "types": "../dist/types/entry-points/block.d.ts",
10
10
  "typesVersions": {
11
- ">=4.5 <5.4": {
11
+ ">=4.5 <5.9": {
12
12
  "*": [
13
13
  "../dist/types-ts4.5/entry-points/block.d.ts"
14
14
  ]
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "types": "../dist/types/entry-points/constants.d.ts",
10
10
  "typesVersions": {
11
- ">=4.5 <5.4": {
11
+ ">=4.5 <5.9": {
12
12
  "*": [
13
13
  "../dist/types-ts4.5/entry-points/constants.d.ts"
14
14
  ]
@@ -23,10 +23,15 @@ function BidiWarning(_ref) {
23
23
  var testId = _ref.testId,
24
24
  bidiCharacter = _ref.bidiCharacter,
25
25
  skipChildren = _ref.skipChildren,
26
+ shouldSkipChildren = _ref.shouldSkipChildren,
26
27
  tooltipEnabled = _ref.tooltipEnabled,
28
+ isTooltipEnabled = _ref.isTooltipEnabled,
27
29
  _ref$label = _ref.label,
28
30
  label = _ref$label === void 0 ? 'Bidirectional characters change the order that text is rendered. This could be used to obscure malicious code.' : _ref$label;
29
- if (tooltipEnabled) {
31
+ // Use new props if provided, otherwise fall back to deprecated props
32
+ var shouldEnableTooltip = isTooltipEnabled !== undefined ? isTooltipEnabled : tooltipEnabled;
33
+ var shouldSkip = shouldSkipChildren !== undefined ? shouldSkipChildren : skipChildren;
34
+ if (shouldEnableTooltip) {
30
35
  return (
31
36
  /*#__PURE__*/
32
37
  // Following patches, this should be updated to use the render props signature which will provide aria attributes.
@@ -38,13 +43,13 @@ function BidiWarning(_ref) {
38
43
  }, /*#__PURE__*/_react.default.createElement(_styled.Decorator, {
39
44
  testId: testId,
40
45
  bidiCharacter: bidiCharacter
41
- }, skipChildren ? null : bidiCharacter))
46
+ }, shouldSkip ? null : bidiCharacter))
42
47
  );
43
48
  }
44
49
  return /*#__PURE__*/_react.default.createElement(_styled.Decorator, {
45
50
  testId: testId,
46
51
  bidiCharacter: bidiCharacter
47
- }, skipChildren ? null : bidiCharacter);
52
+ }, shouldSkip ? null : bidiCharacter);
48
53
  }
49
54
  var CustomizedTagWithRef = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
50
55
  var children = props.children,
@@ -1,7 +1,7 @@
1
1
 
2
2
  ._1ozdn7od code, ._7xinn7od code[class*=language-], ._t7aun7od pre[class*=language-]{all:unset}
3
3
  ._i7ngn7od .token:not([class=token],[data-ds--code--row--highlight],[data-ds--code--row]){all:unset}
4
- ._2rkoglpi{border-radius:var(--ds-border-radius,4px)}
4
+ ._2rko12b0{border-radius:var(--ds-radius-small,4px)}
5
5
  ._1dqoglyw{border-style:none}
6
6
  ._1agb1dyw [data-ds--code--row--highlight]+[data-ds--code--row]:not([data-ds--code--row--highlight]), ._lkm81dyw [data-ds--code--row]:not([data-ds--code--row--highlight])+[data-ds--code--row--highlight]{border-top:1px dashed transparent}
7
7
  ._j1w0ww7y [data-ds--code--row--highlight] .linenumber{border-left:4px solid var(--ds-border-focused,#388bff)}
@@ -22,7 +22,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
22
22
  /* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-selectors */
23
23
  /* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors */
24
24
  var getCodeBlockStyles = {
25
- root: "_2rkoglpi _1dqoglyw _1wyb1crf _k48pi7a9 _1e0c1txw _vwz4gktf _1reo1wug _o572qvpr _1eimjvyg _bfhktkvp _syaz1fxt _ect41odn _1ozdn7od _7xinn7od _t7aun7od _1v15u2gc _ilvcu2gc _m29uu2gc _17wyu2gc _pn28u2gc _gz9fu2gc _1hmyegat _vblregat _vbulegat _wozj1dyw _1agb1dyw _lkm81dyw _tv41hkgb _1hmimyb0 _1ra01n1a _1d4j1y44 _1f8gstnw _1pzyb3bt _j1w0ww7y _13cdh2mm _15ba126e _zvy9f705 _qcxof705 _14y71a66 _j0l11wug _1weckb7n _1na21hna _1xx2grf3 _x7c815vq _lh0y15vq _1m3815vq _qk1e15vq _12l6ysn8 _uga3ysn8 _mx8b7mnp _1kr87mnp _xo19t94y _1bemt94y _nalpstnw _151dstnw _1exb1q9c _1hgu1q9c _1mgnt94y _nhket94y _h909m7j4 _scgayz1z _ipl81e17 _jeky1l04 _1gec1a66 _1gx21e5h _1ls0df4r _vm2c1rh5 _12ok1rh5 _1ls01ule _rude1ule _1q16glyw _1io6glyw _juomusic _lcwuusic _1552u2gc _12afu2gc _28ddu2gc _1i8zu2gc _12tu1a66 _zu0j1a66 _euyxusvi _cahfusvi _zhnuidpf _1amdidpf _mbgcpf9b _bu7zpf9b _131n1giz _gy101giz _1wfuwrk5 _16kzwrk5 _9kk3moej _cjus1w1g _9k2r1m30 _nhmw1m30 _yl021m30 _eiht5x2v _t9zb5x2v _mqok1w1g _3hsg1w1g _i7ngn7od _9wu1fb2s _1xcoh55r _1t361fxt _137bh55r _1k7d1fxt _97lipnps _12nh9lu1 _1g0517qg _i2ig10m5 _326z1fxt _113p131l _1n6tpnps _tgu817qg _1k47pnps _g0lx1fxt _ys4e131l _7gp8h55r _1yvq10m5 _1vww10m5 _1rju10m5 _1v0lh55r _wmyy17qg _748n17qg _1mfn17qg _1d7e17qg _p2vr17qg _19o610m5 _kxov17qg _1np517qg _m2f517qg _1b9tpnps _1tq6pnps _1rd2pnps _1pbkpnps _k3lipnps _13zt131l _2g12fb2s _k86b10m5 _b5iy131l _gti3131l _1f0gpnps _9d3e17qg _qdiapnps _72uvpnps",
25
+ root: "_2rko12b0 _1dqoglyw _1wyb1crf _k48pi7a9 _1e0c1txw _vwz4gktf _1reo1wug _o572qvpr _1eimjvyg _bfhktkvp _syaz1fxt _ect41odn _1ozdn7od _7xinn7od _t7aun7od _1v15u2gc _ilvcu2gc _m29uu2gc _17wyu2gc _pn28u2gc _gz9fu2gc _1hmyegat _vblregat _vbulegat _wozj1dyw _1agb1dyw _lkm81dyw _tv41hkgb _1hmimyb0 _1ra01n1a _1d4j1y44 _1f8gstnw _1pzyb3bt _j1w0ww7y _13cdh2mm _15ba126e _zvy9f705 _qcxof705 _14y71a66 _j0l11wug _1weckb7n _1na21hna _1xx2grf3 _x7c815vq _lh0y15vq _1m3815vq _qk1e15vq _12l6ysn8 _uga3ysn8 _mx8b7mnp _1kr87mnp _xo19t94y _1bemt94y _nalpstnw _151dstnw _1exb1q9c _1hgu1q9c _1mgnt94y _nhket94y _h909m7j4 _scgayz1z _ipl81e17 _jeky1l04 _1gec1a66 _1gx21e5h _1ls0df4r _vm2c1rh5 _12ok1rh5 _1ls01ule _rude1ule _1q16glyw _1io6glyw _juomusic _lcwuusic _1552u2gc _12afu2gc _28ddu2gc _1i8zu2gc _12tu1a66 _zu0j1a66 _euyxusvi _cahfusvi _zhnuidpf _1amdidpf _mbgcpf9b _bu7zpf9b _131n1giz _gy101giz _1wfuwrk5 _16kzwrk5 _9kk3moej _cjus1w1g _9k2r1m30 _nhmw1m30 _yl021m30 _eiht5x2v _t9zb5x2v _mqok1w1g _3hsg1w1g _i7ngn7od _9wu1fb2s _1xcoh55r _1t361fxt _137bh55r _1k7d1fxt _97lipnps _12nh9lu1 _1g0517qg _i2ig10m5 _326z1fxt _113p131l _1n6tpnps _tgu817qg _1k47pnps _g0lx1fxt _ys4e131l _7gp8h55r _1yvq10m5 _1vww10m5 _1rju10m5 _1v0lh55r _wmyy17qg _748n17qg _1mfn17qg _1d7e17qg _p2vr17qg _19o610m5 _kxov17qg _1np517qg _m2f517qg _1b9tpnps _1tq6pnps _1rd2pnps _1pbkpnps _k3lipnps _13zt131l _2g12fb2s _k86b10m5 _b5iy131l _gti3131l _1f0gpnps _9d3e17qg _qdiapnps _72uvpnps",
26
26
  showLineNumbers: "_17071olh _1i3h1txw _1huoidpf _1a9lidpf _20bqidpf _1oggidpf _bympidpf _9nnjidpf",
27
27
  dontShowLineNumbers: "_1i3h1ule _1huou2gc _1a9lu2gc _20bqu2gc _1oggu2gc _bympu2gc _9nnju2gc",
28
28
  shouldWrapLongLines: "_13dgkb7n",
@@ -41,6 +41,7 @@ var getCodeBlockStyles = {
41
41
  var CodeBlock = /*#__PURE__*/(0, _react.memo)(function CodeBlock(_ref) {
42
42
  var _ref$showLineNumbers = _ref.showLineNumbers,
43
43
  showLineNumbers = _ref$showLineNumbers === void 0 ? true : _ref$showLineNumbers,
44
+ shouldShowLineNumbers = _ref.shouldShowLineNumbers,
44
45
  _ref$firstLineNumber = _ref.firstLineNumber,
45
46
  firstLineNumber = _ref$firstLineNumber === void 0 ? 1 : _ref$firstLineNumber,
46
47
  _ref$language = _ref.language,
@@ -55,9 +56,11 @@ var CodeBlock = /*#__PURE__*/(0, _react.memo)(function CodeBlock(_ref) {
55
56
  text = _ref.text,
56
57
  _ref$codeBidiWarnings = _ref.codeBidiWarnings,
57
58
  codeBidiWarnings = _ref$codeBidiWarnings === void 0 ? true : _ref$codeBidiWarnings,
59
+ hasBidiWarnings = _ref.hasBidiWarnings,
58
60
  codeBidiWarningLabel = _ref.codeBidiWarningLabel,
59
61
  _ref$codeBidiWarningT = _ref.codeBidiWarningTooltipEnabled,
60
62
  codeBidiWarningTooltipEnabled = _ref$codeBidiWarningT === void 0 ? true : _ref$codeBidiWarningT,
63
+ isBidiWarningTooltipEnabled = _ref.isBidiWarningTooltipEnabled,
61
64
  _ref$shouldWrapLongLi = _ref.shouldWrapLongLines,
62
65
  shouldWrapLongLines = _ref$shouldWrapLongLi === void 0 ? false : _ref$shouldWrapLongLi,
63
66
  _ref$label = _ref.label,
@@ -67,9 +70,16 @@ var CodeBlock = /*#__PURE__*/(0, _react.memo)(function CodeBlock(_ref) {
67
70
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
68
71
  showContentFocus = _useState2[0],
69
72
  setShowContentFocus = _useState2[1];
73
+
74
+ // Use children if provided, otherwise fall back to deprecated text prop
70
75
  var numLines = (text || '').split('\n').length + (firstLineNumber > 0 ? firstLineNumber : 1) - 1;
71
76
  var lineNumberWidth = numLines ? (0, _styles.getLineNumWidth)(numLines) : 0;
72
77
 
78
+ // Use new props if provided, otherwise fall back to deprecated props
79
+ var shouldShowLineNumbersValue = shouldShowLineNumbers !== undefined ? shouldShowLineNumbers : showLineNumbers;
80
+ var shouldShowBidiWarnings = hasBidiWarnings !== undefined ? hasBidiWarnings : codeBidiWarnings;
81
+ var shouldEnableTooltip = isBidiWarningTooltipEnabled !== undefined ? isBidiWarningTooltipEnabled : codeBidiWarningTooltipEnabled;
82
+
73
83
  // Schedule a content focus on the target element
74
84
  // WARNING: In theory, `target` may not be available when `rafSchedule` hits in concurrent rendering
75
85
  (0, _react.useEffect)(function () {
@@ -109,7 +119,7 @@ var CodeBlock = /*#__PURE__*/(0, _react.memo)(function CodeBlock(_ref) {
109
119
  '--ads-highlighted-start-text': highlightedStartText,
110
120
  '--ads-highlighted-end-text': highlightedEndText
111
121
  },
112
- showLineNumbers: showLineNumbers,
122
+ showLineNumbers: shouldShowLineNumbersValue,
113
123
  firstLineNumber: firstLineNumber,
114
124
  lineProps: getLineProps
115
125
  // shouldCreateParentElementForLines is needed to pass down props to each line.
@@ -118,15 +128,15 @@ var CodeBlock = /*#__PURE__*/(0, _react.memo)(function CodeBlock(_ref) {
118
128
  ,
119
129
  shouldCreateParentElementForLines: highlight.length > 0 || !!testId,
120
130
  shouldWrapLongLines: shouldWrapLongLines,
121
- codeBidiWarnings: codeBidiWarnings,
131
+ codeBidiWarnings: shouldShowBidiWarnings,
122
132
  codeBidiWarningLabel: codeBidiWarningLabel,
123
- codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled,
133
+ codeBidiWarningTooltipEnabled: shouldEnableTooltip,
124
134
  text: text,
125
135
  tabIndex: showContentFocus ? '0' : undefined,
126
136
  "aria-label": showContentFocus ? label : undefined,
127
137
  role: showContentFocus ? 'region' : undefined,
128
138
  scrollRef: scrollableRef,
129
- className: (0, _runtime.ax)([getCodeBlockStyles.root, shouldWrapLongLines ? getCodeBlockStyles.shouldWrapLongLines : getCodeBlockStyles.dontWrapLongLines, showLineNumbers ? getCodeBlockStyles.showLineNumbers : getCodeBlockStyles.dontShowLineNumbers])
139
+ className: (0, _runtime.ax)([getCodeBlockStyles.root, shouldWrapLongLines ? getCodeBlockStyles.shouldWrapLongLines : getCodeBlockStyles.dontWrapLongLines, shouldShowLineNumbersValue ? getCodeBlockStyles.showLineNumbers : getCodeBlockStyles.dontShowLineNumbers])
130
140
  });
131
141
  });
132
142
  var _default = exports.default = CodeBlock;
@@ -1,5 +1,5 @@
1
1
  ._11c81u0j{font:var(--ds-font-code,normal 400 .875em/1 ui-monospace,Menlo,"Segoe UI Mono","Ubuntu Mono",monospace)}
2
- ._2rko1sit{border-radius:var(--ds-border-radius,3px)}
2
+ ._2rkofajl{border-radius:var(--ds-radius-small,3px)}
3
3
  ._1dqoglyw{border-style:none}
4
4
  ._16d9qvcn{-webkit-box-decoration-break:clone;box-decoration-break:clone}
5
5
  ._18m91wug{overflow-y:auto}
package/dist/cjs/code.js CHANGED
@@ -15,10 +15,10 @@ var _react = _interopRequireWildcard(require("react"));
15
15
  var _bidiWarning = _interopRequireDefault(require("./bidi-warning"));
16
16
  var _bidiWarningDecorator = _interopRequireDefault(require("./bidi-warning/bidi-warning-decorator"));
17
17
  var _excluded = ["testId"],
18
- _excluded2 = ["children", "codeBidiWarnings", "codeBidiWarningLabel", "codeBidiWarningTooltipEnabled"];
18
+ _excluded2 = ["children", "codeBidiWarnings", "hasBidiWarnings", "codeBidiWarningLabel", "codeBidiWarningTooltipEnabled", "isBidiWarningTooltipEnabled"];
19
19
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
20
20
  var styles = {
21
- base: "_ca0qyh40 _u5f3m5ip _n3tdyh40 _19bvm5ip _2rko1sit _11c81u0j _1reo1wug _18m91wug _1dqoglyw _1e0c1nu9 _bfhktkvp _16d9qvcn _syaz1fxt _vwz41kw7 _1i4q1hna _o5721jtm"
21
+ base: "_ca0qyh40 _u5f3m5ip _n3tdyh40 _19bvm5ip _2rkofajl _11c81u0j _1reo1wug _18m91wug _1dqoglyw _1e0c1nu9 _bfhktkvp _16d9qvcn _syaz1fxt _vwz41kw7 _1i4q1hna _o5721jtm"
22
22
  };
23
23
 
24
24
  /**
@@ -36,13 +36,19 @@ var Code = /*#__PURE__*/(0, _react.memo)( /*#__PURE__*/(0, _react.forwardRef)(fu
36
36
  var children = props.children,
37
37
  _props$codeBidiWarnin = props.codeBidiWarnings,
38
38
  codeBidiWarnings = _props$codeBidiWarnin === void 0 ? true : _props$codeBidiWarnin,
39
+ hasBidiWarnings = props.hasBidiWarnings,
39
40
  codeBidiWarningLabel = props.codeBidiWarningLabel,
40
41
  _props$codeBidiWarnin2 = props.codeBidiWarningTooltipEnabled,
41
42
  codeBidiWarningTooltipEnabled = _props$codeBidiWarnin2 === void 0 ? true : _props$codeBidiWarnin2,
43
+ isBidiWarningTooltipEnabled = props.isBidiWarningTooltipEnabled,
42
44
  otherProps = (0, _objectWithoutProperties2.default)(props, _excluded2);
43
- var decoratedChildren = codeBidiWarnings ? /*#__PURE__*/_react.default.createElement(RenderCodeChildrenWithBidiWarnings, {
45
+
46
+ // Use new props if provided, otherwise fall back to deprecated props
47
+ var shouldShowBidiWarnings = hasBidiWarnings !== undefined ? hasBidiWarnings : codeBidiWarnings;
48
+ var shouldEnableTooltip = isBidiWarningTooltipEnabled !== undefined ? isBidiWarningTooltipEnabled : codeBidiWarningTooltipEnabled;
49
+ var decoratedChildren = shouldShowBidiWarnings ? /*#__PURE__*/_react.default.createElement(RenderCodeChildrenWithBidiWarnings, {
44
50
  codeBidiWarningLabel: codeBidiWarningLabel,
45
- codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
51
+ codeBidiWarningTooltipEnabled: shouldEnableTooltip
46
52
  }, children) : children;
47
53
  return /*#__PURE__*/_react.default.createElement("code", (0, _extends2.default)({
48
54
  ref: ref,
@@ -334,6 +334,10 @@ var SUPPORTED_LANGUAGES = exports.SUPPORTED_LANGUAGES = [{
334
334
  name: 'Protocol Buffers',
335
335
  alias: ['protobuf', 'proto'],
336
336
  value: 'protobuf'
337
+ }, {
338
+ name: 'TOML',
339
+ alias: ['toml'],
340
+ value: 'toml'
337
341
  }, {
338
342
  name: 'Handlebars',
339
343
  alias: ['handlebars', 'mustache'],
@@ -14,16 +14,19 @@ function createLineElement(_ref) {
14
14
  var children = _ref.children,
15
15
  lineNumber = _ref.lineNumber,
16
16
  showLineNumbers = _ref.showLineNumbers,
17
+ shouldShowLineNumbers = _ref.shouldShowLineNumbers,
17
18
  _ref$lineProps = _ref.lineProps,
18
19
  lineProps = _ref$lineProps === void 0 ? {} : _ref$lineProps,
19
20
  _ref$className = _ref.className,
20
21
  className = _ref$className === void 0 ? [] : _ref$className;
22
+ // Use new prop if provided, otherwise fall back to deprecated prop
23
+ var shouldShowLineNumbersValue = shouldShowLineNumbers !== undefined ? shouldShowLineNumbers : showLineNumbers;
21
24
  var propsPassedInFromCodeBlock = typeof lineProps === 'function' ? lineProps(lineNumber) : lineProps;
22
25
  var properties = _objectSpread(_objectSpread({}, propsPassedInFromCodeBlock), {}, {
23
26
  className: className
24
27
  });
25
28
  var currentChildren = children;
26
- if (lineNumber && showLineNumbers) {
29
+ if (lineNumber && shouldShowLineNumbersValue) {
27
30
  // When syntax highlighting is NOT turned on, the entire LOC is just a single
28
31
  // child. We can then happily create the line number and the LOC as siblings...
29
32
  if (currentChildren.length === 1) {
@@ -36,7 +36,7 @@ function createElement(_ref) {
36
36
  bidiCharacter: bidiCharacter,
37
37
  key: index,
38
38
  label: codeBidiWarningConfig.codeBidiWarningLabel,
39
- tooltipEnabled: codeBidiWarningConfig.codeBidiWarningTooltipEnabled
39
+ isTooltipEnabled: codeBidiWarningConfig.codeBidiWarningTooltipEnabled
40
40
  });
41
41
  });
42
42
  return decorated;
@@ -14,10 +14,15 @@ export default function BidiWarning({
14
14
  testId,
15
15
  bidiCharacter,
16
16
  skipChildren,
17
+ shouldSkipChildren,
17
18
  tooltipEnabled,
19
+ isTooltipEnabled,
18
20
  label = 'Bidirectional characters change the order that text is rendered. This could be used to obscure malicious code.'
19
21
  }) {
20
- if (tooltipEnabled) {
22
+ // Use new props if provided, otherwise fall back to deprecated props
23
+ const shouldEnableTooltip = isTooltipEnabled !== undefined ? isTooltipEnabled : tooltipEnabled;
24
+ const shouldSkip = shouldSkipChildren !== undefined ? shouldSkipChildren : skipChildren;
25
+ if (shouldEnableTooltip) {
21
26
  return (
22
27
  /*#__PURE__*/
23
28
  // Following patches, this should be updated to use the render props signature which will provide aria attributes.
@@ -29,13 +34,13 @@ export default function BidiWarning({
29
34
  }, /*#__PURE__*/React.createElement(Decorator, {
30
35
  testId: testId,
31
36
  bidiCharacter: bidiCharacter
32
- }, skipChildren ? null : bidiCharacter))
37
+ }, shouldSkip ? null : bidiCharacter))
33
38
  );
34
39
  }
35
40
  return /*#__PURE__*/React.createElement(Decorator, {
36
41
  testId: testId,
37
42
  bidiCharacter: bidiCharacter
38
- }, skipChildren ? null : bidiCharacter);
43
+ }, shouldSkip ? null : bidiCharacter);
39
44
  }
40
45
  const CustomizedTagWithRef = /*#__PURE__*/React.forwardRef((props, ref) => {
41
46
  const {
@@ -1,7 +1,7 @@
1
1
 
2
2
  ._1ozdn7od code, ._7xinn7od code[class*=language-], ._t7aun7od pre[class*=language-]{all:unset}
3
3
  ._i7ngn7od .token:not([class=token],[data-ds--code--row--highlight],[data-ds--code--row]){all:unset}
4
- ._2rkoglpi{border-radius:var(--ds-border-radius,4px)}
4
+ ._2rko12b0{border-radius:var(--ds-radius-small,4px)}
5
5
  ._1dqoglyw{border-style:none}
6
6
  ._1agb1dyw [data-ds--code--row--highlight]+[data-ds--code--row]:not([data-ds--code--row--highlight]), ._lkm81dyw [data-ds--code--row]:not([data-ds--code--row--highlight])+[data-ds--code--row--highlight]{border-top:1px dashed transparent}
7
7
  ._j1w0ww7y [data-ds--code--row--highlight] .linenumber{border-left:4px solid var(--ds-border-focused,#388bff)}
@@ -12,7 +12,7 @@ import { getLineNumWidth } from './internal/theme/styles';
12
12
  import { normalizeLanguage } from './internal/utils/get-normalized-language';
13
13
  import SyntaxHighlighter from './syntax-highlighter';
14
14
  const getCodeBlockStyles = {
15
- root: "_2rkoglpi _1dqoglyw _1wyb1crf _k48pi7a9 _1e0c1txw _vwz4gktf _1reo1wug _o572qvpr _1eimjvyg _bfhktkvp _syaz1fxt _ect41odn _1ozdn7od _7xinn7od _t7aun7od _1v15u2gc _ilvcu2gc _m29uu2gc _17wyu2gc _pn28u2gc _gz9fu2gc _1hmyegat _vblregat _vbulegat _wozj1dyw _1agb1dyw _lkm81dyw _tv41hkgb _1hmimyb0 _1ra01n1a _1d4j1y44 _1f8gstnw _1pzyb3bt _j1w0ww7y _13cdh2mm _15ba126e _zvy9f705 _qcxof705 _14y71a66 _j0l11wug _1weckb7n _1na21hna _1xx2grf3 _x7c815vq _lh0y15vq _1m3815vq _qk1e15vq _12l6ysn8 _uga3ysn8 _mx8b7mnp _1kr87mnp _xo19t94y _1bemt94y _nalpstnw _151dstnw _1exb1q9c _1hgu1q9c _1mgnt94y _nhket94y _h909m7j4 _scgayz1z _ipl81e17 _jeky1l04 _1gec1a66 _1gx21e5h _1ls0df4r _vm2c1rh5 _12ok1rh5 _1ls01ule _rude1ule _1q16glyw _1io6glyw _juomusic _lcwuusic _1552u2gc _12afu2gc _28ddu2gc _1i8zu2gc _12tu1a66 _zu0j1a66 _euyxusvi _cahfusvi _zhnuidpf _1amdidpf _mbgcpf9b _bu7zpf9b _131n1giz _gy101giz _1wfuwrk5 _16kzwrk5 _9kk3moej _cjus1w1g _9k2r1m30 _nhmw1m30 _yl021m30 _eiht5x2v _t9zb5x2v _mqok1w1g _3hsg1w1g _i7ngn7od _9wu1fb2s _1xcoh55r _1t361fxt _137bh55r _1k7d1fxt _97lipnps _12nh9lu1 _1g0517qg _i2ig10m5 _326z1fxt _113p131l _1n6tpnps _tgu817qg _1k47pnps _g0lx1fxt _ys4e131l _7gp8h55r _1yvq10m5 _1vww10m5 _1rju10m5 _1v0lh55r _wmyy17qg _748n17qg _1mfn17qg _1d7e17qg _p2vr17qg _19o610m5 _kxov17qg _1np517qg _m2f517qg _1b9tpnps _1tq6pnps _1rd2pnps _1pbkpnps _k3lipnps _13zt131l _2g12fb2s _k86b10m5 _b5iy131l _gti3131l _1f0gpnps _9d3e17qg _qdiapnps _72uvpnps",
15
+ root: "_2rko12b0 _1dqoglyw _1wyb1crf _k48pi7a9 _1e0c1txw _vwz4gktf _1reo1wug _o572qvpr _1eimjvyg _bfhktkvp _syaz1fxt _ect41odn _1ozdn7od _7xinn7od _t7aun7od _1v15u2gc _ilvcu2gc _m29uu2gc _17wyu2gc _pn28u2gc _gz9fu2gc _1hmyegat _vblregat _vbulegat _wozj1dyw _1agb1dyw _lkm81dyw _tv41hkgb _1hmimyb0 _1ra01n1a _1d4j1y44 _1f8gstnw _1pzyb3bt _j1w0ww7y _13cdh2mm _15ba126e _zvy9f705 _qcxof705 _14y71a66 _j0l11wug _1weckb7n _1na21hna _1xx2grf3 _x7c815vq _lh0y15vq _1m3815vq _qk1e15vq _12l6ysn8 _uga3ysn8 _mx8b7mnp _1kr87mnp _xo19t94y _1bemt94y _nalpstnw _151dstnw _1exb1q9c _1hgu1q9c _1mgnt94y _nhket94y _h909m7j4 _scgayz1z _ipl81e17 _jeky1l04 _1gec1a66 _1gx21e5h _1ls0df4r _vm2c1rh5 _12ok1rh5 _1ls01ule _rude1ule _1q16glyw _1io6glyw _juomusic _lcwuusic _1552u2gc _12afu2gc _28ddu2gc _1i8zu2gc _12tu1a66 _zu0j1a66 _euyxusvi _cahfusvi _zhnuidpf _1amdidpf _mbgcpf9b _bu7zpf9b _131n1giz _gy101giz _1wfuwrk5 _16kzwrk5 _9kk3moej _cjus1w1g _9k2r1m30 _nhmw1m30 _yl021m30 _eiht5x2v _t9zb5x2v _mqok1w1g _3hsg1w1g _i7ngn7od _9wu1fb2s _1xcoh55r _1t361fxt _137bh55r _1k7d1fxt _97lipnps _12nh9lu1 _1g0517qg _i2ig10m5 _326z1fxt _113p131l _1n6tpnps _tgu817qg _1k47pnps _g0lx1fxt _ys4e131l _7gp8h55r _1yvq10m5 _1vww10m5 _1rju10m5 _1v0lh55r _wmyy17qg _748n17qg _1mfn17qg _1d7e17qg _p2vr17qg _19o610m5 _kxov17qg _1np517qg _m2f517qg _1b9tpnps _1tq6pnps _1rd2pnps _1pbkpnps _k3lipnps _13zt131l _2g12fb2s _k86b10m5 _b5iy131l _gti3131l _1f0gpnps _9d3e17qg _qdiapnps _72uvpnps",
16
16
  showLineNumbers: "_17071olh _1i3h1txw _1huoidpf _1a9lidpf _20bqidpf _1oggidpf _bympidpf _9nnjidpf",
17
17
  dontShowLineNumbers: "_1i3h1ule _1huou2gc _1a9lu2gc _20bqu2gc _1oggu2gc _bympu2gc _9nnju2gc",
18
18
  shouldWrapLongLines: "_13dgkb7n",
@@ -30,6 +30,7 @@ const getCodeBlockStyles = {
30
30
  */
31
31
  const CodeBlock = /*#__PURE__*/memo(function CodeBlock({
32
32
  showLineNumbers = true,
33
+ shouldShowLineNumbers,
33
34
  firstLineNumber = 1,
34
35
  language: providedLanguage = 'text',
35
36
  highlight = '',
@@ -38,16 +39,25 @@ const CodeBlock = /*#__PURE__*/memo(function CodeBlock({
38
39
  testId,
39
40
  text,
40
41
  codeBidiWarnings = true,
42
+ hasBidiWarnings,
41
43
  codeBidiWarningLabel,
42
44
  codeBidiWarningTooltipEnabled = true,
45
+ isBidiWarningTooltipEnabled,
43
46
  shouldWrapLongLines = false,
44
47
  label = 'Scrollable content'
45
48
  }) {
46
49
  const scrollableRef = useRef(null);
47
50
  const [showContentFocus, setShowContentFocus] = useState(false);
51
+
52
+ // Use children if provided, otherwise fall back to deprecated text prop
48
53
  const numLines = (text || '').split('\n').length + (firstLineNumber > 0 ? firstLineNumber : 1) - 1;
49
54
  const lineNumberWidth = numLines ? getLineNumWidth(numLines) : 0;
50
55
 
56
+ // Use new props if provided, otherwise fall back to deprecated props
57
+ const shouldShowLineNumbersValue = shouldShowLineNumbers !== undefined ? shouldShowLineNumbers : showLineNumbers;
58
+ const shouldShowBidiWarnings = hasBidiWarnings !== undefined ? hasBidiWarnings : codeBidiWarnings;
59
+ const shouldEnableTooltip = isBidiWarningTooltipEnabled !== undefined ? isBidiWarningTooltipEnabled : codeBidiWarningTooltipEnabled;
60
+
51
61
  // Schedule a content focus on the target element
52
62
  // WARNING: In theory, `target` may not be available when `rafSchedule` hits in concurrent rendering
53
63
  useEffect(() => {
@@ -84,7 +94,7 @@ const CodeBlock = /*#__PURE__*/memo(function CodeBlock({
84
94
  '--ads-highlighted-start-text': highlightedStartText,
85
95
  '--ads-highlighted-end-text': highlightedEndText
86
96
  },
87
- showLineNumbers: showLineNumbers,
97
+ showLineNumbers: shouldShowLineNumbersValue,
88
98
  firstLineNumber: firstLineNumber,
89
99
  lineProps: getLineProps
90
100
  // shouldCreateParentElementForLines is needed to pass down props to each line.
@@ -93,15 +103,15 @@ const CodeBlock = /*#__PURE__*/memo(function CodeBlock({
93
103
  ,
94
104
  shouldCreateParentElementForLines: highlight.length > 0 || !!testId,
95
105
  shouldWrapLongLines: shouldWrapLongLines,
96
- codeBidiWarnings: codeBidiWarnings,
106
+ codeBidiWarnings: shouldShowBidiWarnings,
97
107
  codeBidiWarningLabel: codeBidiWarningLabel,
98
- codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled,
108
+ codeBidiWarningTooltipEnabled: shouldEnableTooltip,
99
109
  text: text,
100
110
  tabIndex: showContentFocus ? '0' : undefined,
101
111
  "aria-label": showContentFocus ? label : undefined,
102
112
  role: showContentFocus ? 'region' : undefined,
103
113
  scrollRef: scrollableRef,
104
- className: ax([getCodeBlockStyles.root, shouldWrapLongLines ? getCodeBlockStyles.shouldWrapLongLines : getCodeBlockStyles.dontWrapLongLines, showLineNumbers ? getCodeBlockStyles.showLineNumbers : getCodeBlockStyles.dontShowLineNumbers])
114
+ className: ax([getCodeBlockStyles.root, shouldWrapLongLines ? getCodeBlockStyles.shouldWrapLongLines : getCodeBlockStyles.dontWrapLongLines, shouldShowLineNumbersValue ? getCodeBlockStyles.showLineNumbers : getCodeBlockStyles.dontShowLineNumbers])
105
115
  });
106
116
  });
107
117
  export default CodeBlock;
@@ -1,5 +1,5 @@
1
1
  ._11c81u0j{font:var(--ds-font-code,normal 400 .875em/1 ui-monospace,Menlo,"Segoe UI Mono","Ubuntu Mono",monospace)}
2
- ._2rko1sit{border-radius:var(--ds-border-radius,3px)}
2
+ ._2rkofajl{border-radius:var(--ds-radius-small,3px)}
3
3
  ._1dqoglyw{border-style:none}
4
4
  ._16d9qvcn{-webkit-box-decoration-break:clone;box-decoration-break:clone}
5
5
  ._18m91wug{overflow-y:auto}
@@ -6,7 +6,7 @@ import React, { forwardRef, memo } from 'react';
6
6
  import CodeBidiWarning from './bidi-warning';
7
7
  import codeBidiWarningDecorator from './bidi-warning/bidi-warning-decorator';
8
8
  const styles = {
9
- base: "_ca0qyh40 _u5f3m5ip _n3tdyh40 _19bvm5ip _2rko1sit _11c81u0j _1reo1wug _18m91wug _1dqoglyw _1e0c1nu9 _bfhktkvp _16d9qvcn _syaz1fxt _vwz41kw7 _1i4q1hna _o5721jtm"
9
+ base: "_ca0qyh40 _u5f3m5ip _n3tdyh40 _19bvm5ip _2rkofajl _11c81u0j _1reo1wug _18m91wug _1dqoglyw _1e0c1nu9 _bfhktkvp _16d9qvcn _syaz1fxt _vwz41kw7 _1i4q1hna _o5721jtm"
10
10
  };
11
11
 
12
12
  /**
@@ -25,13 +25,19 @@ const Code = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Code({
25
25
  const {
26
26
  children,
27
27
  codeBidiWarnings = true,
28
+ hasBidiWarnings,
28
29
  codeBidiWarningLabel,
29
30
  codeBidiWarningTooltipEnabled = true,
31
+ isBidiWarningTooltipEnabled,
30
32
  ...otherProps
31
33
  } = props;
32
- const decoratedChildren = codeBidiWarnings ? /*#__PURE__*/React.createElement(RenderCodeChildrenWithBidiWarnings, {
34
+
35
+ // Use new props if provided, otherwise fall back to deprecated props
36
+ const shouldShowBidiWarnings = hasBidiWarnings !== undefined ? hasBidiWarnings : codeBidiWarnings;
37
+ const shouldEnableTooltip = isBidiWarningTooltipEnabled !== undefined ? isBidiWarningTooltipEnabled : codeBidiWarningTooltipEnabled;
38
+ const decoratedChildren = shouldShowBidiWarnings ? /*#__PURE__*/React.createElement(RenderCodeChildrenWithBidiWarnings, {
33
39
  codeBidiWarningLabel: codeBidiWarningLabel,
34
- codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
40
+ codeBidiWarningTooltipEnabled: shouldEnableTooltip
35
41
  }, children) : children;
36
42
  return /*#__PURE__*/React.createElement("code", _extends({
37
43
  ref: ref,
@@ -321,6 +321,10 @@ export const SUPPORTED_LANGUAGES = [{
321
321
  name: 'Protocol Buffers',
322
322
  alias: ['protobuf', 'proto'],
323
323
  value: 'protobuf'
324
+ }, {
325
+ name: 'TOML',
326
+ alias: ['toml'],
327
+ value: 'toml'
324
328
  }, {
325
329
  name: 'Handlebars',
326
330
  alias: ['handlebars', 'mustache'],
@@ -3,16 +3,19 @@ export default function createLineElement({
3
3
  children,
4
4
  lineNumber,
5
5
  showLineNumbers,
6
+ shouldShowLineNumbers,
6
7
  lineProps = {},
7
8
  className = []
8
9
  }) {
10
+ // Use new prop if provided, otherwise fall back to deprecated prop
11
+ const shouldShowLineNumbersValue = shouldShowLineNumbers !== undefined ? shouldShowLineNumbers : showLineNumbers;
9
12
  const propsPassedInFromCodeBlock = typeof lineProps === 'function' ? lineProps(lineNumber) : lineProps;
10
13
  const properties = {
11
14
  ...propsPassedInFromCodeBlock,
12
15
  className
13
16
  };
14
17
  let currentChildren = children;
15
- if (lineNumber && showLineNumbers) {
18
+ if (lineNumber && shouldShowLineNumbersValue) {
16
19
  // When syntax highlighting is NOT turned on, the entire LOC is just a single
17
20
  // child. We can then happily create the line number and the LOC as siblings...
18
21
  if (currentChildren.length === 1) {
@@ -29,7 +29,7 @@ export default function createElement({
29
29
  bidiCharacter: bidiCharacter,
30
30
  key: index,
31
31
  label: codeBidiWarningConfig.codeBidiWarningLabel,
32
- tooltipEnabled: codeBidiWarningConfig.codeBidiWarningTooltipEnabled
32
+ isTooltipEnabled: codeBidiWarningConfig.codeBidiWarningTooltipEnabled
33
33
  }));
34
34
  return decorated;
35
35
  }
@@ -16,10 +16,15 @@ export default function BidiWarning(_ref) {
16
16
  var testId = _ref.testId,
17
17
  bidiCharacter = _ref.bidiCharacter,
18
18
  skipChildren = _ref.skipChildren,
19
+ shouldSkipChildren = _ref.shouldSkipChildren,
19
20
  tooltipEnabled = _ref.tooltipEnabled,
21
+ isTooltipEnabled = _ref.isTooltipEnabled,
20
22
  _ref$label = _ref.label,
21
23
  label = _ref$label === void 0 ? 'Bidirectional characters change the order that text is rendered. This could be used to obscure malicious code.' : _ref$label;
22
- if (tooltipEnabled) {
24
+ // Use new props if provided, otherwise fall back to deprecated props
25
+ var shouldEnableTooltip = isTooltipEnabled !== undefined ? isTooltipEnabled : tooltipEnabled;
26
+ var shouldSkip = shouldSkipChildren !== undefined ? shouldSkipChildren : skipChildren;
27
+ if (shouldEnableTooltip) {
23
28
  return (
24
29
  /*#__PURE__*/
25
30
  // Following patches, this should be updated to use the render props signature which will provide aria attributes.
@@ -31,13 +36,13 @@ export default function BidiWarning(_ref) {
31
36
  }, /*#__PURE__*/React.createElement(Decorator, {
32
37
  testId: testId,
33
38
  bidiCharacter: bidiCharacter
34
- }, skipChildren ? null : bidiCharacter))
39
+ }, shouldSkip ? null : bidiCharacter))
35
40
  );
36
41
  }
37
42
  return /*#__PURE__*/React.createElement(Decorator, {
38
43
  testId: testId,
39
44
  bidiCharacter: bidiCharacter
40
- }, skipChildren ? null : bidiCharacter);
45
+ }, shouldSkip ? null : bidiCharacter);
41
46
  }
42
47
  var CustomizedTagWithRef = /*#__PURE__*/React.forwardRef(function (props, ref) {
43
48
  var children = props.children,
@@ -1,7 +1,7 @@
1
1
 
2
2
  ._1ozdn7od code, ._7xinn7od code[class*=language-], ._t7aun7od pre[class*=language-]{all:unset}
3
3
  ._i7ngn7od .token:not([class=token],[data-ds--code--row--highlight],[data-ds--code--row]){all:unset}
4
- ._2rkoglpi{border-radius:var(--ds-border-radius,4px)}
4
+ ._2rko12b0{border-radius:var(--ds-radius-small,4px)}
5
5
  ._1dqoglyw{border-style:none}
6
6
  ._1agb1dyw [data-ds--code--row--highlight]+[data-ds--code--row]:not([data-ds--code--row--highlight]), ._lkm81dyw [data-ds--code--row]:not([data-ds--code--row--highlight])+[data-ds--code--row--highlight]{border-top:1px dashed transparent}
7
7
  ._j1w0ww7y [data-ds--code--row--highlight] .linenumber{border-left:4px solid var(--ds-border-focused,#388bff)}
@@ -14,7 +14,7 @@ import { getLineNumWidth } from './internal/theme/styles';
14
14
  import { normalizeLanguage } from './internal/utils/get-normalized-language';
15
15
  import SyntaxHighlighter from './syntax-highlighter';
16
16
  var getCodeBlockStyles = {
17
- root: "_2rkoglpi _1dqoglyw _1wyb1crf _k48pi7a9 _1e0c1txw _vwz4gktf _1reo1wug _o572qvpr _1eimjvyg _bfhktkvp _syaz1fxt _ect41odn _1ozdn7od _7xinn7od _t7aun7od _1v15u2gc _ilvcu2gc _m29uu2gc _17wyu2gc _pn28u2gc _gz9fu2gc _1hmyegat _vblregat _vbulegat _wozj1dyw _1agb1dyw _lkm81dyw _tv41hkgb _1hmimyb0 _1ra01n1a _1d4j1y44 _1f8gstnw _1pzyb3bt _j1w0ww7y _13cdh2mm _15ba126e _zvy9f705 _qcxof705 _14y71a66 _j0l11wug _1weckb7n _1na21hna _1xx2grf3 _x7c815vq _lh0y15vq _1m3815vq _qk1e15vq _12l6ysn8 _uga3ysn8 _mx8b7mnp _1kr87mnp _xo19t94y _1bemt94y _nalpstnw _151dstnw _1exb1q9c _1hgu1q9c _1mgnt94y _nhket94y _h909m7j4 _scgayz1z _ipl81e17 _jeky1l04 _1gec1a66 _1gx21e5h _1ls0df4r _vm2c1rh5 _12ok1rh5 _1ls01ule _rude1ule _1q16glyw _1io6glyw _juomusic _lcwuusic _1552u2gc _12afu2gc _28ddu2gc _1i8zu2gc _12tu1a66 _zu0j1a66 _euyxusvi _cahfusvi _zhnuidpf _1amdidpf _mbgcpf9b _bu7zpf9b _131n1giz _gy101giz _1wfuwrk5 _16kzwrk5 _9kk3moej _cjus1w1g _9k2r1m30 _nhmw1m30 _yl021m30 _eiht5x2v _t9zb5x2v _mqok1w1g _3hsg1w1g _i7ngn7od _9wu1fb2s _1xcoh55r _1t361fxt _137bh55r _1k7d1fxt _97lipnps _12nh9lu1 _1g0517qg _i2ig10m5 _326z1fxt _113p131l _1n6tpnps _tgu817qg _1k47pnps _g0lx1fxt _ys4e131l _7gp8h55r _1yvq10m5 _1vww10m5 _1rju10m5 _1v0lh55r _wmyy17qg _748n17qg _1mfn17qg _1d7e17qg _p2vr17qg _19o610m5 _kxov17qg _1np517qg _m2f517qg _1b9tpnps _1tq6pnps _1rd2pnps _1pbkpnps _k3lipnps _13zt131l _2g12fb2s _k86b10m5 _b5iy131l _gti3131l _1f0gpnps _9d3e17qg _qdiapnps _72uvpnps",
17
+ root: "_2rko12b0 _1dqoglyw _1wyb1crf _k48pi7a9 _1e0c1txw _vwz4gktf _1reo1wug _o572qvpr _1eimjvyg _bfhktkvp _syaz1fxt _ect41odn _1ozdn7od _7xinn7od _t7aun7od _1v15u2gc _ilvcu2gc _m29uu2gc _17wyu2gc _pn28u2gc _gz9fu2gc _1hmyegat _vblregat _vbulegat _wozj1dyw _1agb1dyw _lkm81dyw _tv41hkgb _1hmimyb0 _1ra01n1a _1d4j1y44 _1f8gstnw _1pzyb3bt _j1w0ww7y _13cdh2mm _15ba126e _zvy9f705 _qcxof705 _14y71a66 _j0l11wug _1weckb7n _1na21hna _1xx2grf3 _x7c815vq _lh0y15vq _1m3815vq _qk1e15vq _12l6ysn8 _uga3ysn8 _mx8b7mnp _1kr87mnp _xo19t94y _1bemt94y _nalpstnw _151dstnw _1exb1q9c _1hgu1q9c _1mgnt94y _nhket94y _h909m7j4 _scgayz1z _ipl81e17 _jeky1l04 _1gec1a66 _1gx21e5h _1ls0df4r _vm2c1rh5 _12ok1rh5 _1ls01ule _rude1ule _1q16glyw _1io6glyw _juomusic _lcwuusic _1552u2gc _12afu2gc _28ddu2gc _1i8zu2gc _12tu1a66 _zu0j1a66 _euyxusvi _cahfusvi _zhnuidpf _1amdidpf _mbgcpf9b _bu7zpf9b _131n1giz _gy101giz _1wfuwrk5 _16kzwrk5 _9kk3moej _cjus1w1g _9k2r1m30 _nhmw1m30 _yl021m30 _eiht5x2v _t9zb5x2v _mqok1w1g _3hsg1w1g _i7ngn7od _9wu1fb2s _1xcoh55r _1t361fxt _137bh55r _1k7d1fxt _97lipnps _12nh9lu1 _1g0517qg _i2ig10m5 _326z1fxt _113p131l _1n6tpnps _tgu817qg _1k47pnps _g0lx1fxt _ys4e131l _7gp8h55r _1yvq10m5 _1vww10m5 _1rju10m5 _1v0lh55r _wmyy17qg _748n17qg _1mfn17qg _1d7e17qg _p2vr17qg _19o610m5 _kxov17qg _1np517qg _m2f517qg _1b9tpnps _1tq6pnps _1rd2pnps _1pbkpnps _k3lipnps _13zt131l _2g12fb2s _k86b10m5 _b5iy131l _gti3131l _1f0gpnps _9d3e17qg _qdiapnps _72uvpnps",
18
18
  showLineNumbers: "_17071olh _1i3h1txw _1huoidpf _1a9lidpf _20bqidpf _1oggidpf _bympidpf _9nnjidpf",
19
19
  dontShowLineNumbers: "_1i3h1ule _1huou2gc _1a9lu2gc _20bqu2gc _1oggu2gc _bympu2gc _9nnju2gc",
20
20
  shouldWrapLongLines: "_13dgkb7n",
@@ -33,6 +33,7 @@ var getCodeBlockStyles = {
33
33
  var CodeBlock = /*#__PURE__*/memo(function CodeBlock(_ref) {
34
34
  var _ref$showLineNumbers = _ref.showLineNumbers,
35
35
  showLineNumbers = _ref$showLineNumbers === void 0 ? true : _ref$showLineNumbers,
36
+ shouldShowLineNumbers = _ref.shouldShowLineNumbers,
36
37
  _ref$firstLineNumber = _ref.firstLineNumber,
37
38
  firstLineNumber = _ref$firstLineNumber === void 0 ? 1 : _ref$firstLineNumber,
38
39
  _ref$language = _ref.language,
@@ -47,9 +48,11 @@ var CodeBlock = /*#__PURE__*/memo(function CodeBlock(_ref) {
47
48
  text = _ref.text,
48
49
  _ref$codeBidiWarnings = _ref.codeBidiWarnings,
49
50
  codeBidiWarnings = _ref$codeBidiWarnings === void 0 ? true : _ref$codeBidiWarnings,
51
+ hasBidiWarnings = _ref.hasBidiWarnings,
50
52
  codeBidiWarningLabel = _ref.codeBidiWarningLabel,
51
53
  _ref$codeBidiWarningT = _ref.codeBidiWarningTooltipEnabled,
52
54
  codeBidiWarningTooltipEnabled = _ref$codeBidiWarningT === void 0 ? true : _ref$codeBidiWarningT,
55
+ isBidiWarningTooltipEnabled = _ref.isBidiWarningTooltipEnabled,
53
56
  _ref$shouldWrapLongLi = _ref.shouldWrapLongLines,
54
57
  shouldWrapLongLines = _ref$shouldWrapLongLi === void 0 ? false : _ref$shouldWrapLongLi,
55
58
  _ref$label = _ref.label,
@@ -59,9 +62,16 @@ var CodeBlock = /*#__PURE__*/memo(function CodeBlock(_ref) {
59
62
  _useState2 = _slicedToArray(_useState, 2),
60
63
  showContentFocus = _useState2[0],
61
64
  setShowContentFocus = _useState2[1];
65
+
66
+ // Use children if provided, otherwise fall back to deprecated text prop
62
67
  var numLines = (text || '').split('\n').length + (firstLineNumber > 0 ? firstLineNumber : 1) - 1;
63
68
  var lineNumberWidth = numLines ? getLineNumWidth(numLines) : 0;
64
69
 
70
+ // Use new props if provided, otherwise fall back to deprecated props
71
+ var shouldShowLineNumbersValue = shouldShowLineNumbers !== undefined ? shouldShowLineNumbers : showLineNumbers;
72
+ var shouldShowBidiWarnings = hasBidiWarnings !== undefined ? hasBidiWarnings : codeBidiWarnings;
73
+ var shouldEnableTooltip = isBidiWarningTooltipEnabled !== undefined ? isBidiWarningTooltipEnabled : codeBidiWarningTooltipEnabled;
74
+
65
75
  // Schedule a content focus on the target element
66
76
  // WARNING: In theory, `target` may not be available when `rafSchedule` hits in concurrent rendering
67
77
  useEffect(function () {
@@ -101,7 +111,7 @@ var CodeBlock = /*#__PURE__*/memo(function CodeBlock(_ref) {
101
111
  '--ads-highlighted-start-text': highlightedStartText,
102
112
  '--ads-highlighted-end-text': highlightedEndText
103
113
  },
104
- showLineNumbers: showLineNumbers,
114
+ showLineNumbers: shouldShowLineNumbersValue,
105
115
  firstLineNumber: firstLineNumber,
106
116
  lineProps: getLineProps
107
117
  // shouldCreateParentElementForLines is needed to pass down props to each line.
@@ -110,15 +120,15 @@ var CodeBlock = /*#__PURE__*/memo(function CodeBlock(_ref) {
110
120
  ,
111
121
  shouldCreateParentElementForLines: highlight.length > 0 || !!testId,
112
122
  shouldWrapLongLines: shouldWrapLongLines,
113
- codeBidiWarnings: codeBidiWarnings,
123
+ codeBidiWarnings: shouldShowBidiWarnings,
114
124
  codeBidiWarningLabel: codeBidiWarningLabel,
115
- codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled,
125
+ codeBidiWarningTooltipEnabled: shouldEnableTooltip,
116
126
  text: text,
117
127
  tabIndex: showContentFocus ? '0' : undefined,
118
128
  "aria-label": showContentFocus ? label : undefined,
119
129
  role: showContentFocus ? 'region' : undefined,
120
130
  scrollRef: scrollableRef,
121
- className: ax([getCodeBlockStyles.root, shouldWrapLongLines ? getCodeBlockStyles.shouldWrapLongLines : getCodeBlockStyles.dontWrapLongLines, showLineNumbers ? getCodeBlockStyles.showLineNumbers : getCodeBlockStyles.dontShowLineNumbers])
131
+ className: ax([getCodeBlockStyles.root, shouldWrapLongLines ? getCodeBlockStyles.shouldWrapLongLines : getCodeBlockStyles.dontWrapLongLines, shouldShowLineNumbersValue ? getCodeBlockStyles.showLineNumbers : getCodeBlockStyles.dontShowLineNumbers])
122
132
  });
123
133
  });
124
134
  export default CodeBlock;
@@ -1,5 +1,5 @@
1
1
  ._11c81u0j{font:var(--ds-font-code,normal 400 .875em/1 ui-monospace,Menlo,"Segoe UI Mono","Ubuntu Mono",monospace)}
2
- ._2rko1sit{border-radius:var(--ds-border-radius,3px)}
2
+ ._2rkofajl{border-radius:var(--ds-radius-small,3px)}
3
3
  ._1dqoglyw{border-style:none}
4
4
  ._16d9qvcn{-webkit-box-decoration-break:clone;box-decoration-break:clone}
5
5
  ._18m91wug{overflow-y:auto}
package/dist/esm/code.js CHANGED
@@ -2,14 +2,14 @@
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  var _excluded = ["testId"],
5
- _excluded2 = ["children", "codeBidiWarnings", "codeBidiWarningLabel", "codeBidiWarningTooltipEnabled"];
5
+ _excluded2 = ["children", "codeBidiWarnings", "hasBidiWarnings", "codeBidiWarningLabel", "codeBidiWarningTooltipEnabled", "isBidiWarningTooltipEnabled"];
6
6
  import "./code.compiled.css";
7
7
  import { ax, ix } from "@compiled/react/runtime";
8
8
  import React, { forwardRef, memo } from 'react';
9
9
  import CodeBidiWarning from './bidi-warning';
10
10
  import codeBidiWarningDecorator from './bidi-warning/bidi-warning-decorator';
11
11
  var styles = {
12
- base: "_ca0qyh40 _u5f3m5ip _n3tdyh40 _19bvm5ip _2rko1sit _11c81u0j _1reo1wug _18m91wug _1dqoglyw _1e0c1nu9 _bfhktkvp _16d9qvcn _syaz1fxt _vwz41kw7 _1i4q1hna _o5721jtm"
12
+ base: "_ca0qyh40 _u5f3m5ip _n3tdyh40 _19bvm5ip _2rkofajl _11c81u0j _1reo1wug _18m91wug _1dqoglyw _1e0c1nu9 _bfhktkvp _16d9qvcn _syaz1fxt _vwz41kw7 _1i4q1hna _o5721jtm"
13
13
  };
14
14
 
15
15
  /**
@@ -27,13 +27,19 @@ var Code = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Code(_ref, ref) {
27
27
  var children = props.children,
28
28
  _props$codeBidiWarnin = props.codeBidiWarnings,
29
29
  codeBidiWarnings = _props$codeBidiWarnin === void 0 ? true : _props$codeBidiWarnin,
30
+ hasBidiWarnings = props.hasBidiWarnings,
30
31
  codeBidiWarningLabel = props.codeBidiWarningLabel,
31
32
  _props$codeBidiWarnin2 = props.codeBidiWarningTooltipEnabled,
32
33
  codeBidiWarningTooltipEnabled = _props$codeBidiWarnin2 === void 0 ? true : _props$codeBidiWarnin2,
34
+ isBidiWarningTooltipEnabled = props.isBidiWarningTooltipEnabled,
33
35
  otherProps = _objectWithoutProperties(props, _excluded2);
34
- var decoratedChildren = codeBidiWarnings ? /*#__PURE__*/React.createElement(RenderCodeChildrenWithBidiWarnings, {
36
+
37
+ // Use new props if provided, otherwise fall back to deprecated props
38
+ var shouldShowBidiWarnings = hasBidiWarnings !== undefined ? hasBidiWarnings : codeBidiWarnings;
39
+ var shouldEnableTooltip = isBidiWarningTooltipEnabled !== undefined ? isBidiWarningTooltipEnabled : codeBidiWarningTooltipEnabled;
40
+ var decoratedChildren = shouldShowBidiWarnings ? /*#__PURE__*/React.createElement(RenderCodeChildrenWithBidiWarnings, {
35
41
  codeBidiWarningLabel: codeBidiWarningLabel,
36
- codeBidiWarningTooltipEnabled: codeBidiWarningTooltipEnabled
42
+ codeBidiWarningTooltipEnabled: shouldEnableTooltip
37
43
  }, children) : children;
38
44
  return /*#__PURE__*/React.createElement("code", _extends({
39
45
  ref: ref,
@@ -321,6 +321,10 @@ export var SUPPORTED_LANGUAGES = [{
321
321
  name: 'Protocol Buffers',
322
322
  alias: ['protobuf', 'proto'],
323
323
  value: 'protobuf'
324
+ }, {
325
+ name: 'TOML',
326
+ alias: ['toml'],
327
+ value: 'toml'
324
328
  }, {
325
329
  name: 'Handlebars',
326
330
  alias: ['handlebars', 'mustache'],
@@ -7,16 +7,19 @@ export default function createLineElement(_ref) {
7
7
  var children = _ref.children,
8
8
  lineNumber = _ref.lineNumber,
9
9
  showLineNumbers = _ref.showLineNumbers,
10
+ shouldShowLineNumbers = _ref.shouldShowLineNumbers,
10
11
  _ref$lineProps = _ref.lineProps,
11
12
  lineProps = _ref$lineProps === void 0 ? {} : _ref$lineProps,
12
13
  _ref$className = _ref.className,
13
14
  className = _ref$className === void 0 ? [] : _ref$className;
15
+ // Use new prop if provided, otherwise fall back to deprecated prop
16
+ var shouldShowLineNumbersValue = shouldShowLineNumbers !== undefined ? shouldShowLineNumbers : showLineNumbers;
14
17
  var propsPassedInFromCodeBlock = typeof lineProps === 'function' ? lineProps(lineNumber) : lineProps;
15
18
  var properties = _objectSpread(_objectSpread({}, propsPassedInFromCodeBlock), {}, {
16
19
  className: className
17
20
  });
18
21
  var currentChildren = children;
19
- if (lineNumber && showLineNumbers) {
22
+ if (lineNumber && shouldShowLineNumbersValue) {
20
23
  // When syntax highlighting is NOT turned on, the entire LOC is just a single
21
24
  // child. We can then happily create the line number and the LOC as siblings...
22
25
  if (currentChildren.length === 1) {
@@ -29,7 +29,7 @@ export default function createElement(_ref) {
29
29
  bidiCharacter: bidiCharacter,
30
30
  key: index,
31
31
  label: codeBidiWarningConfig.codeBidiWarningLabel,
32
- tooltipEnabled: codeBidiWarningConfig.codeBidiWarningTooltipEnabled
32
+ isTooltipEnabled: codeBidiWarningConfig.codeBidiWarningTooltipEnabled
33
33
  });
34
34
  });
35
35
  return decorated;
@@ -8,4 +8,4 @@ import { type CodeBidiWarningProps } from './types';
8
8
  *
9
9
  * See 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
10
10
  */
11
- export default function BidiWarning({ testId, bidiCharacter, skipChildren, tooltipEnabled, label, }: CodeBidiWarningProps): React.JSX.Element;
11
+ export default function BidiWarning({ testId, bidiCharacter, skipChildren, shouldSkipChildren, tooltipEnabled, isTooltipEnabled, label, }: CodeBidiWarningProps): React.JSX.Element;
@@ -13,14 +13,29 @@ export type CodeBidiWarningProps = {
13
13
  * Intended to be disabled when used in a mobile view, such as in the editor via mobile bridge,
14
14
  * where the tooltip could end up being cut off or otherwise not work as expected.
15
15
  * @default true
16
+ * @deprecated Use `isTooltipEnabled` instead
16
17
  */
17
18
  tooltipEnabled?: boolean;
19
+ /**
20
+ * Sets whether to render tooltip with the warning or not.
21
+ * Intended to be disabled when used in a mobile view, such as in the editor via mobile bridge,
22
+ * where the tooltip could end up being cut off or otherwise not work as expected.
23
+ * @default true
24
+ */
25
+ isTooltipEnabled?: boolean;
18
26
  /**
19
27
  * Sets whether bidi character should be wrapped in decorator.
20
28
  * Useful when wrapping the bidi character with the decoration is not achievable.
21
29
  * @default false
30
+ * @deprecated Use `shouldSkipChildren` instead
22
31
  */
23
32
  skipChildren?: boolean;
33
+ /**
34
+ * Sets whether bidi character should be wrapped in decorator.
35
+ * Useful when wrapping the bidi character with the decoration is not achievable.
36
+ * @default false
37
+ */
38
+ shouldSkipChildren?: boolean;
24
39
  /**
25
40
  * Label for the bidi warning tooltip.
26
41
  * @default "Bidirectional characters change the order that text is rendered. This could be used to obscure malicious code."
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { CodeBlockProps } from './internal/types';
3
2
  /**
4
3
  * __Code block__
@@ -318,6 +318,10 @@ export declare const SUPPORTED_LANGUAGES: readonly [{
318
318
  readonly name: "Protocol Buffers";
319
319
  readonly alias: readonly ["protobuf", "proto"];
320
320
  readonly value: "protobuf";
321
+ }, {
322
+ readonly name: "TOML";
323
+ readonly alias: readonly ["toml"];
324
+ readonly value: "toml";
321
325
  }, {
322
326
  readonly name: "Handlebars";
323
327
  readonly alias: readonly ["handlebars", "mustache"];
@@ -1,6 +1,6 @@
1
1
  import { type HTMLProps } from 'react';
2
2
  import type { CodeBlockProps } from '../types';
3
- export declare const useHighlightLines: ({ highlight, testId, }: Pick<CodeBlockProps, 'highlight' | 'testId'>) => {
3
+ export declare const useHighlightLines: ({ highlight, testId, }: Pick<CodeBlockProps, "highlight" | "testId">) => {
4
4
  getHighlightStyles: (lineNumber: number, highlightedLines: number[]) => HTMLProps<HTMLElement>;
5
5
  highlightedLines: number[];
6
6
  };
@@ -12,8 +12,14 @@ export interface CodeBlockProps {
12
12
  /**
13
13
  * Sets whether to display code line numbers or not.
14
14
  * @default true
15
+ * @deprecated Use `shouldShowLineNumbers` instead
15
16
  */
16
17
  showLineNumbers?: boolean;
18
+ /**
19
+ * Sets whether to display code line numbers or not.
20
+ * @default true
21
+ */
22
+ shouldShowLineNumbers?: boolean;
17
23
  /**
18
24
  * Sets the number of the first line, if showLineNumbers is set to true.
19
25
  * @default 1
@@ -50,8 +56,14 @@ export interface CodeBlockProps {
50
56
  /**
51
57
  * When set to `false`, disables code decorating with bidi warnings.
52
58
  * @default true
59
+ * @deprecated Use `hasBidiWarnings` instead
53
60
  */
54
61
  codeBidiWarnings?: boolean;
62
+ /**
63
+ * When set to `false`, disables code decorating with bidi warnings.
64
+ * @default true
65
+ */
66
+ hasBidiWarnings?: boolean;
55
67
  /**
56
68
  * Label for the bidi warning tooltip.
57
69
  * @default 'Bidirectional characters change the order that text is rendered. This could be used to obscure malicious code.'
@@ -62,8 +74,16 @@ export interface CodeBlockProps {
62
74
  * Intended to be disabled when used in a mobile view, such as in the editor via mobile bridge,
63
75
  * where the tooltip could end up being cut off or otherwise not work as expected.
64
76
  * @default true
77
+ * @deprecated Use `isBidiWarningTooltipEnabled` instead
65
78
  */
66
79
  codeBidiWarningTooltipEnabled?: boolean;
80
+ /**
81
+ * Sets whether to render tooltip with the warning or not.
82
+ * Intended to be disabled when used in a mobile view, such as in the editor via mobile bridge,
83
+ * where the tooltip could end up being cut off or otherwise not work as expected.
84
+ * @default true
85
+ */
86
+ isBidiWarningTooltipEnabled?: boolean;
67
87
  /**
68
88
  * Sets whether long lines will create a horizontally scrolling container.
69
89
  * When set to `true`, these lines will visually wrap instead.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type SyntaxHighlighterProps } from '../types';
3
2
  /**
4
3
  * Takes in a code string and (in the default behaviour):
@@ -2,8 +2,16 @@ import { type AST, type RefractorNode, type SyntaxHighlighterLineProps } from '.
2
2
  export type CreateLineElementProps = {
3
3
  children: RefractorNode[];
4
4
  lineNumber: number;
5
+ /**
6
+ * Sets whether to display code line numbers or not.
7
+ * @deprecated Use `shouldShowLineNumbers` instead
8
+ */
5
9
  showLineNumbers?: boolean;
10
+ /**
11
+ * Sets whether to display code line numbers or not.
12
+ */
13
+ shouldShowLineNumbers?: boolean;
6
14
  lineProps?: SyntaxHighlighterLineProps;
7
15
  className?: string[];
8
16
  };
9
- export default function createLineElement({ children, lineNumber, showLineNumbers, lineProps, className, }: CreateLineElementProps): AST.Element;
17
+ export default function createLineElement({ children, lineNumber, showLineNumbers, shouldShowLineNumbers, lineProps, className, }: CreateLineElementProps): AST.Element;
@@ -12,8 +12,13 @@ export interface CodeProps extends HTMLProps<HTMLElement> {
12
12
  children?: ReactNode;
13
13
  /**
14
14
  * When set to `false`, disables code decorating with bidi warnings. Defaults to `true`.
15
+ * @deprecated Use `hasBidiWarnings` instead
15
16
  */
16
17
  codeBidiWarnings?: boolean;
18
+ /**
19
+ * When set to `false`, disables code decorating with bidi warnings. Defaults to `true`.
20
+ */
21
+ hasBidiWarnings?: boolean;
17
22
  /**
18
23
  * Label for the bidi warning tooltip.
19
24
  *
@@ -26,6 +31,14 @@ export interface CodeProps extends HTMLProps<HTMLElement> {
26
31
  * disabled when used in a mobile view, such as in the editor via mobile
27
32
  * bridge, where the tooltip could end up being cut off or otherwise not work
28
33
  * as expected. Defaults to `true`.
34
+ * @deprecated Use `isBidiWarningTooltipEnabled` instead
29
35
  */
30
36
  codeBidiWarningTooltipEnabled?: boolean;
37
+ /**
38
+ * Sets whether to render tooltip with the warning or not. Intended to be
39
+ * disabled when used in a mobile view, such as in the editor via mobile
40
+ * bridge, where the tooltip could end up being cut off or otherwise not work
41
+ * as expected. Defaults to `true`.
42
+ */
43
+ isBidiWarningTooltipEnabled?: boolean;
31
44
  }
@@ -8,4 +8,4 @@ import { type CodeBidiWarningProps } from './types';
8
8
  *
9
9
  * See 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
10
10
  */
11
- export default function BidiWarning({ testId, bidiCharacter, skipChildren, tooltipEnabled, label, }: CodeBidiWarningProps): React.JSX.Element;
11
+ export default function BidiWarning({ testId, bidiCharacter, skipChildren, shouldSkipChildren, tooltipEnabled, isTooltipEnabled, label, }: CodeBidiWarningProps): React.JSX.Element;
@@ -13,14 +13,29 @@ export type CodeBidiWarningProps = {
13
13
  * Intended to be disabled when used in a mobile view, such as in the editor via mobile bridge,
14
14
  * where the tooltip could end up being cut off or otherwise not work as expected.
15
15
  * @default true
16
+ * @deprecated Use `isTooltipEnabled` instead
16
17
  */
17
18
  tooltipEnabled?: boolean;
19
+ /**
20
+ * Sets whether to render tooltip with the warning or not.
21
+ * Intended to be disabled when used in a mobile view, such as in the editor via mobile bridge,
22
+ * where the tooltip could end up being cut off or otherwise not work as expected.
23
+ * @default true
24
+ */
25
+ isTooltipEnabled?: boolean;
18
26
  /**
19
27
  * Sets whether bidi character should be wrapped in decorator.
20
28
  * Useful when wrapping the bidi character with the decoration is not achievable.
21
29
  * @default false
30
+ * @deprecated Use `shouldSkipChildren` instead
22
31
  */
23
32
  skipChildren?: boolean;
33
+ /**
34
+ * Sets whether bidi character should be wrapped in decorator.
35
+ * Useful when wrapping the bidi character with the decoration is not achievable.
36
+ * @default false
37
+ */
38
+ shouldSkipChildren?: boolean;
24
39
  /**
25
40
  * Label for the bidi warning tooltip.
26
41
  * @default "Bidirectional characters change the order that text is rendered. This could be used to obscure malicious code."
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { CodeBlockProps } from './internal/types';
3
2
  /**
4
3
  * __Code block__
@@ -641,6 +641,13 @@ export declare const SUPPORTED_LANGUAGES: readonly [
641
641
  ];
642
642
  readonly value: "protobuf";
643
643
  },
644
+ {
645
+ readonly name: "TOML";
646
+ readonly alias: readonly [
647
+ "toml"
648
+ ];
649
+ readonly value: "toml";
650
+ },
644
651
  {
645
652
  readonly name: "Handlebars";
646
653
  readonly alias: readonly [
@@ -1,6 +1,6 @@
1
1
  import { type HTMLProps } from 'react';
2
2
  import type { CodeBlockProps } from '../types';
3
- export declare const useHighlightLines: ({ highlight, testId, }: Pick<CodeBlockProps, 'highlight' | 'testId'>) => {
3
+ export declare const useHighlightLines: ({ highlight, testId, }: Pick<CodeBlockProps, "highlight" | "testId">) => {
4
4
  getHighlightStyles: (lineNumber: number, highlightedLines: number[]) => HTMLProps<HTMLElement>;
5
5
  highlightedLines: number[];
6
6
  };
@@ -12,8 +12,14 @@ export interface CodeBlockProps {
12
12
  /**
13
13
  * Sets whether to display code line numbers or not.
14
14
  * @default true
15
+ * @deprecated Use `shouldShowLineNumbers` instead
15
16
  */
16
17
  showLineNumbers?: boolean;
18
+ /**
19
+ * Sets whether to display code line numbers or not.
20
+ * @default true
21
+ */
22
+ shouldShowLineNumbers?: boolean;
17
23
  /**
18
24
  * Sets the number of the first line, if showLineNumbers is set to true.
19
25
  * @default 1
@@ -50,8 +56,14 @@ export interface CodeBlockProps {
50
56
  /**
51
57
  * When set to `false`, disables code decorating with bidi warnings.
52
58
  * @default true
59
+ * @deprecated Use `hasBidiWarnings` instead
53
60
  */
54
61
  codeBidiWarnings?: boolean;
62
+ /**
63
+ * When set to `false`, disables code decorating with bidi warnings.
64
+ * @default true
65
+ */
66
+ hasBidiWarnings?: boolean;
55
67
  /**
56
68
  * Label for the bidi warning tooltip.
57
69
  * @default 'Bidirectional characters change the order that text is rendered. This could be used to obscure malicious code.'
@@ -62,8 +74,16 @@ export interface CodeBlockProps {
62
74
  * Intended to be disabled when used in a mobile view, such as in the editor via mobile bridge,
63
75
  * where the tooltip could end up being cut off or otherwise not work as expected.
64
76
  * @default true
77
+ * @deprecated Use `isBidiWarningTooltipEnabled` instead
65
78
  */
66
79
  codeBidiWarningTooltipEnabled?: boolean;
80
+ /**
81
+ * Sets whether to render tooltip with the warning or not.
82
+ * Intended to be disabled when used in a mobile view, such as in the editor via mobile bridge,
83
+ * where the tooltip could end up being cut off or otherwise not work as expected.
84
+ * @default true
85
+ */
86
+ isBidiWarningTooltipEnabled?: boolean;
67
87
  /**
68
88
  * Sets whether long lines will create a horizontally scrolling container.
69
89
  * When set to `true`, these lines will visually wrap instead.
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { type SyntaxHighlighterProps } from '../types';
3
2
  /**
4
3
  * Takes in a code string and (in the default behaviour):
@@ -2,8 +2,16 @@ import { type AST, type RefractorNode, type SyntaxHighlighterLineProps } from '.
2
2
  export type CreateLineElementProps = {
3
3
  children: RefractorNode[];
4
4
  lineNumber: number;
5
+ /**
6
+ * Sets whether to display code line numbers or not.
7
+ * @deprecated Use `shouldShowLineNumbers` instead
8
+ */
5
9
  showLineNumbers?: boolean;
10
+ /**
11
+ * Sets whether to display code line numbers or not.
12
+ */
13
+ shouldShowLineNumbers?: boolean;
6
14
  lineProps?: SyntaxHighlighterLineProps;
7
15
  className?: string[];
8
16
  };
9
- export default function createLineElement({ children, lineNumber, showLineNumbers, lineProps, className, }: CreateLineElementProps): AST.Element;
17
+ export default function createLineElement({ children, lineNumber, showLineNumbers, shouldShowLineNumbers, lineProps, className, }: CreateLineElementProps): AST.Element;
@@ -12,8 +12,13 @@ export interface CodeProps extends HTMLProps<HTMLElement> {
12
12
  children?: ReactNode;
13
13
  /**
14
14
  * When set to `false`, disables code decorating with bidi warnings. Defaults to `true`.
15
+ * @deprecated Use `hasBidiWarnings` instead
15
16
  */
16
17
  codeBidiWarnings?: boolean;
18
+ /**
19
+ * When set to `false`, disables code decorating with bidi warnings. Defaults to `true`.
20
+ */
21
+ hasBidiWarnings?: boolean;
17
22
  /**
18
23
  * Label for the bidi warning tooltip.
19
24
  *
@@ -26,6 +31,14 @@ export interface CodeProps extends HTMLProps<HTMLElement> {
26
31
  * disabled when used in a mobile view, such as in the editor via mobile
27
32
  * bridge, where the tooltip could end up being cut off or otherwise not work
28
33
  * as expected. Defaults to `true`.
34
+ * @deprecated Use `isBidiWarningTooltipEnabled` instead
29
35
  */
30
36
  codeBidiWarningTooltipEnabled?: boolean;
37
+ /**
38
+ * Sets whether to render tooltip with the warning or not. Intended to be
39
+ * disabled when used in a mobile view, such as in the editor via mobile
40
+ * bridge, where the tooltip could end up being cut off or otherwise not work
41
+ * as expected. Defaults to `true`.
42
+ */
43
+ isBidiWarningTooltipEnabled?: boolean;
31
44
  }
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "types": "../dist/types/entry-points/inline.d.ts",
10
10
  "typesVersions": {
11
- ">=4.5 <5.4": {
11
+ ">=4.5 <5.9": {
12
12
  "*": [
13
13
  "../dist/types-ts4.5/entry-points/inline.d.ts"
14
14
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/code",
3
- "version": "17.2.2",
3
+ "version": "17.2.4",
4
4
  "description": "Code highlights short strings of code snippets inline with body text.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -29,8 +29,8 @@
29
29
  "dependencies": {
30
30
  "@atlaskit/codemod-utils": "^4.2.0",
31
31
  "@atlaskit/platform-feature-flags": "^1.1.0",
32
- "@atlaskit/tokens": "^5.4.0",
33
- "@atlaskit/tooltip": "^20.3.0",
32
+ "@atlaskit/tokens": "^6.2.0",
33
+ "@atlaskit/tooltip": "^20.4.0",
34
34
  "@atlaskit/visually-hidden": "^3.0.0",
35
35
  "@babel/runtime": "^7.0.0",
36
36
  "@compiled/react": "^0.18.3",
@@ -46,17 +46,17 @@
46
46
  "@af/accessibility-testing": "workspace:^",
47
47
  "@af/integration-testing": "workspace:^",
48
48
  "@af/visual-regression": "workspace:^",
49
- "@atlaskit/button": "^23.2.0",
49
+ "@atlaskit/button": "^23.4.0",
50
50
  "@atlaskit/docs": "^11.0.0",
51
- "@atlaskit/ds-lib": "^4.0.0",
52
- "@atlaskit/form": "^12.0.0",
51
+ "@atlaskit/ds-lib": "^5.0.0",
52
+ "@atlaskit/form": "^12.4.0",
53
53
  "@atlaskit/link": "^3.2.0",
54
- "@atlaskit/primitives": "^14.10.0",
55
- "@atlaskit/section-message": "^8.2.0",
54
+ "@atlaskit/primitives": "^14.13.0",
55
+ "@atlaskit/section-message": "^8.7.0",
56
56
  "@atlaskit/ssr": "workspace:^",
57
- "@atlaskit/theme": "^18.0.0",
58
- "@atlaskit/toggle": "^15.0.0",
59
- "@atlassian/ssr-tests": "^0.2.0",
57
+ "@atlaskit/theme": "^20.0.0",
58
+ "@atlaskit/toggle": "^15.1.0",
59
+ "@atlassian/ssr-tests": "^0.3.0",
60
60
  "@testing-library/react": "^13.4.0",
61
61
  "@types/jscodeshift": "^0.11.0",
62
62
  "@types/refractor": "^3.0.2",
@@ -64,8 +64,7 @@
64
64
  "css-loader": "^2.0.0",
65
65
  "prismjs": "^1.30.0",
66
66
  "react-dom": "^18.2.0",
67
- "style-loader": "^0.16.1",
68
- "typescript": "~5.4.2"
67
+ "style-loader": "^0.16.1"
69
68
  },
70
69
  "keywords": [
71
70
  "atlaskit",
@@ -106,14 +105,5 @@
106
105
  ]
107
106
  }
108
107
  },
109
- "af:exports": {
110
- "./types": "./src/entry-points/types.tsx",
111
- ".": "./src/index.tsx",
112
- "./bidi-warning": "./src/bidi-warning/index.tsx",
113
- "./bidi-warning-decorator": "./src/bidi-warning/bidi-warning-decorator.tsx",
114
- "./block": "./src/entry-points/block.tsx",
115
- "./inline": "./src/entry-points/inline.tsx",
116
- "./constants": "./src/entry-points/constants.tsx"
117
- },
118
108
  "homepage": "https://atlassian.design/components/code/"
119
109
  }
@@ -8,7 +8,7 @@
8
8
  ],
9
9
  "types": "../dist/types/entry-points/types.d.ts",
10
10
  "typesVersions": {
11
- ">=4.5 <5.4": {
11
+ ">=4.5 <5.9": {
12
12
  "*": [
13
13
  "../dist/types-ts4.5/entry-points/types.d.ts"
14
14
  ]