@atlaskit/editor-plugin-accessibility-utils 2.0.6 → 2.0.8

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-plugin-accessibility-utils
2
2
 
3
+ ## 2.0.8
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 2.0.7
10
+
11
+ ### Patch Changes
12
+
13
+ - [#151999](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/151999)
14
+ [`daf7c638efb95`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/daf7c638efb95) -
15
+ Refactor to use sharedPluginStateHookMigratorFactory
16
+ - Updated dependencies
17
+
3
18
  ## 2.0.6
4
19
 
5
20
  ### Patch Changes
@@ -12,7 +12,6 @@ var _hooks = require("@atlaskit/editor-common/hooks");
12
12
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
13
13
  var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
14
14
  var _state = require("@atlaskit/editor-prosemirror/state");
15
- var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
16
15
  var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
17
16
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
18
17
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -83,24 +82,30 @@ var accessibilityUtilsPlugin = exports.accessibilityUtilsPlugin = function acces
83
82
  }
84
83
  };
85
84
  };
85
+ var useAccessibilityUtilsPluginState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
86
+ var ariaLiveElementAttributes = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'accessibilityUtils.ariaLiveElementAttributes');
87
+ var key = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'accessibilityUtils.key');
88
+ var message = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'accessibilityUtils.message');
89
+ return {
90
+ ariaLiveElementAttributes: ariaLiveElementAttributes,
91
+ key: key,
92
+ message: message
93
+ };
94
+ }, function (api) {
95
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['accessibilityUtils']),
96
+ accessibilityUtilsState = _useSharedPluginState.accessibilityUtilsState;
97
+ return {
98
+ ariaLiveElementAttributes: accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.ariaLiveElementAttributes,
99
+ key: accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.key,
100
+ message: accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.message
101
+ };
102
+ });
86
103
  function ContentComponent(_ref2) {
87
104
  var api = _ref2.api;
88
- var _useSharedPluginState = (0, _hooks.useSharedPluginState)(api, ['accessibilityUtils'], {
89
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true)
90
- }),
91
- accessibilityUtilsState = _useSharedPluginState.accessibilityUtilsState;
92
- var ariaLiveElementAttributesSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'accessibilityUtils.ariaLiveElementAttributes', {
93
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
94
- });
95
- var ariaLiveElementAttributes = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? ariaLiveElementAttributesSelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.ariaLiveElementAttributes;
96
- var keySelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'accessibilityUtils.key', {
97
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
98
- });
99
- var key = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? keySelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.key;
100
- var messageSelector = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'accessibilityUtils.message', {
101
- disabled: (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', false)
102
- });
103
- var message = (0, _experiments.editorExperiment)('platform_editor_usesharedpluginstateselector', true) ? messageSelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.message;
105
+ var _useAccessibilityUtil = useAccessibilityUtilsPluginState(api),
106
+ ariaLiveElementAttributes = _useAccessibilityUtil.ariaLiveElementAttributes,
107
+ key = _useAccessibilityUtil.key,
108
+ message = _useAccessibilityUtil.message;
104
109
  var role = (ariaLiveElementAttributes === null || ariaLiveElementAttributes === void 0 ? void 0 : ariaLiveElementAttributes.priority) === 'important' ? 'alert' : 'status';
105
110
  return /*#__PURE__*/_react.default.createElement(_visuallyHidden.default, (0, _extends2.default)({
106
111
  testId: 'accessibility-message-wrapper',
@@ -1,10 +1,9 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import React from 'react';
3
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
+ import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
4
4
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
5
5
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
6
6
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
7
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
8
7
  import VisuallyHidden from '@atlaskit/visually-hidden';
9
8
  export const accessibilityUtilsPluginKey = new PluginKey('accessibilityUtilsPlugin');
10
9
  export const accessibilityUtilsPlugin = ({
@@ -75,26 +74,33 @@ export const accessibilityUtilsPlugin = ({
75
74
  }
76
75
  };
77
76
  };
77
+ const useAccessibilityUtilsPluginState = sharedPluginStateHookMigratorFactory(api => {
78
+ const ariaLiveElementAttributes = useSharedPluginStateSelector(api, 'accessibilityUtils.ariaLiveElementAttributes');
79
+ const key = useSharedPluginStateSelector(api, 'accessibilityUtils.key');
80
+ const message = useSharedPluginStateSelector(api, 'accessibilityUtils.message');
81
+ return {
82
+ ariaLiveElementAttributes,
83
+ key,
84
+ message
85
+ };
86
+ }, api => {
87
+ const {
88
+ accessibilityUtilsState
89
+ } = useSharedPluginState(api, ['accessibilityUtils']);
90
+ return {
91
+ ariaLiveElementAttributes: accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.ariaLiveElementAttributes,
92
+ key: accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.key,
93
+ message: accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.message
94
+ };
95
+ });
78
96
  function ContentComponent({
79
97
  api
80
98
  }) {
81
99
  const {
82
- accessibilityUtilsState
83
- } = useSharedPluginState(api, ['accessibilityUtils'], {
84
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
85
- });
86
- const ariaLiveElementAttributesSelector = useSharedPluginStateSelector(api, 'accessibilityUtils.ariaLiveElementAttributes', {
87
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
88
- });
89
- const ariaLiveElementAttributes = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? ariaLiveElementAttributesSelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.ariaLiveElementAttributes;
90
- const keySelector = useSharedPluginStateSelector(api, 'accessibilityUtils.key', {
91
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
92
- });
93
- const key = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? keySelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.key;
94
- const messageSelector = useSharedPluginStateSelector(api, 'accessibilityUtils.message', {
95
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
96
- });
97
- const message = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? messageSelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.message;
100
+ ariaLiveElementAttributes,
101
+ key,
102
+ message
103
+ } = useAccessibilityUtilsPluginState(api);
98
104
  const role = (ariaLiveElementAttributes === null || ariaLiveElementAttributes === void 0 ? void 0 : ariaLiveElementAttributes.priority) === 'important' ? 'alert' : 'status';
99
105
  return /*#__PURE__*/React.createElement(VisuallyHidden, _extends({
100
106
  testId: 'accessibility-message-wrapper',
@@ -3,11 +3,10 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  import React from 'react';
6
- import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
6
+ import { sharedPluginStateHookMigratorFactory, useSharedPluginState } from '@atlaskit/editor-common/hooks';
7
7
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
8
8
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
9
9
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
10
- import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
11
10
  import VisuallyHidden from '@atlaskit/visually-hidden';
12
11
  export var accessibilityUtilsPluginKey = new PluginKey('accessibilityUtilsPlugin');
13
12
  export var accessibilityUtilsPlugin = function accessibilityUtilsPlugin(_ref) {
@@ -76,24 +75,30 @@ export var accessibilityUtilsPlugin = function accessibilityUtilsPlugin(_ref) {
76
75
  }
77
76
  };
78
77
  };
78
+ var useAccessibilityUtilsPluginState = sharedPluginStateHookMigratorFactory(function (api) {
79
+ var ariaLiveElementAttributes = useSharedPluginStateSelector(api, 'accessibilityUtils.ariaLiveElementAttributes');
80
+ var key = useSharedPluginStateSelector(api, 'accessibilityUtils.key');
81
+ var message = useSharedPluginStateSelector(api, 'accessibilityUtils.message');
82
+ return {
83
+ ariaLiveElementAttributes: ariaLiveElementAttributes,
84
+ key: key,
85
+ message: message
86
+ };
87
+ }, function (api) {
88
+ var _useSharedPluginState = useSharedPluginState(api, ['accessibilityUtils']),
89
+ accessibilityUtilsState = _useSharedPluginState.accessibilityUtilsState;
90
+ return {
91
+ ariaLiveElementAttributes: accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.ariaLiveElementAttributes,
92
+ key: accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.key,
93
+ message: accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.message
94
+ };
95
+ });
79
96
  function ContentComponent(_ref2) {
80
97
  var api = _ref2.api;
81
- var _useSharedPluginState = useSharedPluginState(api, ['accessibilityUtils'], {
82
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', true)
83
- }),
84
- accessibilityUtilsState = _useSharedPluginState.accessibilityUtilsState;
85
- var ariaLiveElementAttributesSelector = useSharedPluginStateSelector(api, 'accessibilityUtils.ariaLiveElementAttributes', {
86
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
87
- });
88
- var ariaLiveElementAttributes = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? ariaLiveElementAttributesSelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.ariaLiveElementAttributes;
89
- var keySelector = useSharedPluginStateSelector(api, 'accessibilityUtils.key', {
90
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
91
- });
92
- var key = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? keySelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.key;
93
- var messageSelector = useSharedPluginStateSelector(api, 'accessibilityUtils.message', {
94
- disabled: editorExperiment('platform_editor_usesharedpluginstateselector', false)
95
- });
96
- var message = editorExperiment('platform_editor_usesharedpluginstateselector', true) ? messageSelector : accessibilityUtilsState === null || accessibilityUtilsState === void 0 ? void 0 : accessibilityUtilsState.message;
98
+ var _useAccessibilityUtil = useAccessibilityUtilsPluginState(api),
99
+ ariaLiveElementAttributes = _useAccessibilityUtil.ariaLiveElementAttributes,
100
+ key = _useAccessibilityUtil.key,
101
+ message = _useAccessibilityUtil.message;
97
102
  var role = (ariaLiveElementAttributes === null || ariaLiveElementAttributes === void 0 ? void 0 : ariaLiveElementAttributes.priority) === 'important' ? 'alert' : 'status';
98
103
  return /*#__PURE__*/React.createElement(VisuallyHidden, _extends({
99
104
  testId: 'accessibility-message-wrapper',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-accessibility-utils",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "description": "Accessibility utils for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,9 +31,9 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^104.0.0",
34
+ "@atlaskit/editor-common": "^105.0.0",
35
35
  "@atlaskit/editor-prosemirror": "7.0.0",
36
- "@atlaskit/tmp-editor-statsig": "^4.16.0",
36
+ "@atlaskit/tmp-editor-statsig": "^4.19.0",
37
37
  "@atlaskit/visually-hidden": "^3.0.0",
38
38
  "@babel/runtime": "^7.0.0"
39
39
  },