@atlaskit/editor-toolbar 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/editor-toolbar
2
2
 
3
+ ## 1.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.0.10
10
+
11
+ ### Patch Changes
12
+
13
+ - [`bb13ee29107b7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bb13ee29107b7) -
14
+ Editor-6656: Fix TypeError: .at() is not a function in ToolbarButtonGroup by replacing
15
+ Array.prototype.at() calls
16
+ - Updated dependencies
17
+
3
18
  ## 1.0.9
4
19
 
5
20
  ### Patch Changes
@@ -10,6 +10,7 @@ require("./ToolbarButtonGroup.compiled.css");
10
10
  var _react = _interopRequireWildcard(require("react"));
11
11
  var React = _react;
12
12
  var _runtime = require("@compiled/react/runtime");
13
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
13
14
  var _compiled = require("@atlaskit/primitives/compiled");
14
15
  var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
15
16
  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); }
@@ -24,8 +25,10 @@ var styles = {
24
25
  var ToolbarButtonGroup = exports.ToolbarButtonGroup = function ToolbarButtonGroup(_ref) {
25
26
  var children = _ref.children;
26
27
  var items = _react.Children.toArray(children);
27
- var FirstChild = items.at(0);
28
- var LastChild = items.at(-1);
28
+ // The .at() method is a relatively newer JavaScript API (ES2022) that isn't supported in older browsers
29
+ // Using items[i] is more compatible with older browsers.
30
+ var FirstChild = (0, _platformFeatureFlags.fg)('platform_editor_fix_t_at_is_not_a_function') ? items[0] : items.at(0);
31
+ var LastChild = (0, _platformFeatureFlags.fg)('platform_editor_fix_t_at_is_not_a_function') ? items[items.length - 1] : items.at(-1);
29
32
  var middleChildren = items.slice(1, -1);
30
33
  return /*#__PURE__*/React.createElement(_compiled.Box, {
31
34
  xcss: (0, _expValEquals.expValEquals)('platform_editor_toolbar_split_button_ui', 'isEnabled', true) ? styles.containerNew : styles.container,
@@ -3,6 +3,7 @@ import "./ToolbarButtonGroup.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import { Children, Fragment } from 'react';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { Box } from '@atlaskit/primitives/compiled';
7
8
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
9
  const styles = {
@@ -17,8 +18,10 @@ export const ToolbarButtonGroup = ({
17
18
  children
18
19
  }) => {
19
20
  const items = Children.toArray(children);
20
- const FirstChild = items.at(0);
21
- const LastChild = items.at(-1);
21
+ // The .at() method is a relatively newer JavaScript API (ES2022) that isn't supported in older browsers
22
+ // Using items[i] is more compatible with older browsers.
23
+ const FirstChild = fg('platform_editor_fix_t_at_is_not_a_function') ? items[0] : items.at(0);
24
+ const LastChild = fg('platform_editor_fix_t_at_is_not_a_function') ? items[items.length - 1] : items.at(-1);
22
25
  const middleChildren = items.slice(1, -1);
23
26
  return /*#__PURE__*/React.createElement(Box, {
24
27
  xcss: expValEquals('platform_editor_toolbar_split_button_ui', 'isEnabled', true) ? styles.containerNew : styles.container,
@@ -3,6 +3,7 @@ import "./ToolbarButtonGroup.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import { Children, Fragment } from 'react';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { Box } from '@atlaskit/primitives/compiled';
7
8
  import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
8
9
  var styles = {
@@ -16,8 +17,10 @@ var styles = {
16
17
  export var ToolbarButtonGroup = function ToolbarButtonGroup(_ref) {
17
18
  var children = _ref.children;
18
19
  var items = Children.toArray(children);
19
- var FirstChild = items.at(0);
20
- var LastChild = items.at(-1);
20
+ // The .at() method is a relatively newer JavaScript API (ES2022) that isn't supported in older browsers
21
+ // Using items[i] is more compatible with older browsers.
22
+ var FirstChild = fg('platform_editor_fix_t_at_is_not_a_function') ? items[0] : items.at(0);
23
+ var LastChild = fg('platform_editor_fix_t_at_is_not_a_function') ? items[items.length - 1] : items.at(-1);
21
24
  var middleChildren = items.slice(1, -1);
22
25
  return /*#__PURE__*/React.createElement(Box, {
23
26
  xcss: expValEquals('platform_editor_toolbar_split_button_ui', 'isEnabled', true) ? styles.containerNew : styles.container,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "registry": "https://registry.npmjs.org/"
5
5
  },
6
- "version": "1.0.9",
6
+ "version": "1.0.11",
7
7
  "description": "Common UI for Toolbars across the platform",
8
8
  "atlassian": {
9
9
  "react-compiler": {
@@ -37,7 +37,7 @@
37
37
  "@atlaskit/platform-feature-flags": "^1.1.0",
38
38
  "@atlaskit/popup": "^4.17.0",
39
39
  "@atlaskit/primitives": "^19.0.0",
40
- "@atlaskit/tmp-editor-statsig": "^70.2.0",
40
+ "@atlaskit/tmp-editor-statsig": "^71.0.0",
41
41
  "@atlaskit/tokens": "^13.0.0",
42
42
  "@atlaskit/tooltip": "^21.2.0",
43
43
  "@babel/runtime": "^7.0.0",
@@ -92,6 +92,9 @@
92
92
  "platform-feature-flags": {
93
93
  "platform_editor_block_menu_v2_patch_2": {
94
94
  "type": "boolean"
95
+ },
96
+ "platform_editor_fix_t_at_is_not_a_function": {
97
+ "type": "boolean"
95
98
  }
96
99
  }
97
100
  }