@atlaskit/focus-ring 1.2.3 → 1.2.5

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,17 @@
1
1
  # @atlaskit/focus-ring
2
2
 
3
+ ## 1.2.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`7f5f23dcb68`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7f5f23dcb68) - Introduce shape tokens to some packages.
8
+
9
+ ## 1.2.4
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 1.2.3
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Focus ring
2
2
 
3
- A focus ring is used indicate the currently focused item.
3
+ A focus ring is used to visually indicate the currently focused item.
4
+
5
+ This component has accessibility issues that we are working to resolve. Do not use without support from the Atlassian Design System accessibility team.
4
6
 
5
7
  ## Usage
6
8
 
@@ -4,12 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _react = require("react");
9
-
10
8
  var _react2 = require("@emotion/react");
11
-
12
9
  /** @jsx jsx */
10
+
13
11
  var BORDER_WIDTH = 2;
14
12
  var baseFocusOutsideStyles = (0, _react2.css)({
15
13
  outline: "".concat(BORDER_WIDTH, "px solid ", "var(--ds-border-focused, #4C9AFF)"),
@@ -44,10 +42,14 @@ var insetFocusRingStyles = (0, _react2.css)({
44
42
  }
45
43
  }
46
44
  });
45
+
47
46
  /**
48
47
  * __Focus ring__
49
48
  *
50
- * A focus ring is used indicate the currently focused item.
49
+ * A focus ring visually indicates the currently focused item.
50
+ *
51
+ * There are known accessibility issues with this component.
52
+ * Do not use without assisitance from the Design System accessibility team.
51
53
  *
52
54
  * - [Code](https://atlaskit.atlassian.com/packages/design-system/focus-ring)
53
55
  *
@@ -62,18 +64,18 @@ var insetFocusRingStyles = (0, _react2.css)({
62
64
  * )
63
65
  * ```
64
66
  */
65
-
66
67
  var FocusRing = function FocusRing(_ref) {
67
68
  var children = _ref.children,
68
- isInset = _ref.isInset,
69
- focus = _ref.focus;
69
+ isInset = _ref.isInset,
70
+ focus = _ref.focus;
70
71
  var controlledStyles = isInset ? baseInsetStyles : baseFocusOutsideStyles;
71
72
  var uncontrolledStyles = isInset ? insetFocusRingStyles : focusRingStyles;
72
73
  var focusCls = typeof focus === 'undefined' ? uncontrolledStyles : focus === 'on' && controlledStyles;
73
74
  return (0, _react2.jsx)(_react2.ClassNames, null, function (_ref2) {
74
75
  var css = _ref2.css,
75
- cx = _ref2.cx;
76
- return _react.Children.only( // This may look unwieldy but means we skip applying styles / cloning if no className is applicable
76
+ cx = _ref2.cx;
77
+ return _react.Children.only(
78
+ // This may look unwieldy but means we skip applying styles / cloning if no className is applicable
77
79
  focusCls ?
78
80
  /*#__PURE__*/
79
81
  // eslint-disable-next-line @repo/internal/react/no-clone-element
@@ -82,6 +84,5 @@ var FocusRing = function FocusRing(_ref) {
82
84
  }) : children);
83
85
  });
84
86
  };
85
-
86
87
  var _default = FocusRing;
87
88
  exports.default = _default;
package/dist/cjs/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -17,7 +16,5 @@ Object.defineProperty(exports, "useFocusRing", {
17
16
  return _useFocusRing.default;
18
17
  }
19
18
  });
20
-
21
19
  var _focusRing = _interopRequireDefault(require("./focus-ring"));
22
-
23
20
  var _useFocusRing = _interopRequireDefault(require("./use-focus-ring"));
@@ -1,52 +1,28 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
-
12
9
  var _react = require("react");
13
-
14
10
  /**
15
11
  * __Use focus ring__
16
12
  *
17
- * The `useFocusRing` hook is designed to manage focus for the `FocusRing` in cases where the `FocusRing`'s visual application
18
- * and the element that takes focus, differ. See the `focus` prop of `FocusRing` for more information.
19
- *
20
- * @example
21
- * ```jsx
22
- * import VisuallyHidden from '@atlaskit/visuall-hidden';
23
- * import FocusRing, { useFocusRing } from '@atlaskit/focus-ring';
13
+ * This component has accessibility issues that we are working to resolve.
14
+ * Do not use without support from the Atlassian Design System accessibility team.
24
15
  *
25
- * const InteractiveComponent = () => {
26
- * const { focusState, focusProps } = useFocusRing();
16
+ * The useFocusRing hook manages focus in the rare cases where the focus ring’s visual application and the element that takes focus differ.
17
+ * This is not typically a good practice for accessibility, so don’t do this unless you’ve consulted with the accessibility team.
27
18
  *
28
- * return (
29
- * <div>
30
- * <VisuallHidden>
31
- * <input {...focusProps} />
32
- * </VisuallyHidden>
33
- * <FocusRing focus={focusState}>
34
- * <div role="button">Hello</div>
35
- * </FocusRing>
36
- * </div>
37
- * );
38
- *
39
- * }
40
- * ```
41
19
  */
42
20
  var useFocusRing = function useFocusRing() {
43
21
  var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'off';
44
-
45
22
  var _useState = (0, _react.useState)(initialState),
46
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
47
- focusState = _useState2[0],
48
- setFocusState = _useState2[1];
49
-
23
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
24
+ focusState = _useState2[0],
25
+ setFocusState = _useState2[1];
50
26
  var focusProps = (0, _react.useRef)({
51
27
  onFocus: function onFocus() {
52
28
  return setFocusState('on');
@@ -60,6 +36,5 @@ var useFocusRing = function useFocusRing() {
60
36
  focusProps: focusProps.current
61
37
  };
62
38
  };
63
-
64
39
  var _default = useFocusRing;
65
40
  exports.default = _default;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/focus-ring",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "sideEffects": false
5
5
  }
@@ -35,10 +35,14 @@ const insetFocusRingStyles = css({
35
35
  }
36
36
  }
37
37
  });
38
+
38
39
  /**
39
40
  * __Focus ring__
40
41
  *
41
- * A focus ring is used indicate the currently focused item.
42
+ * A focus ring visually indicates the currently focused item.
43
+ *
44
+ * There are known accessibility issues with this component.
45
+ * Do not use without assisitance from the Design System accessibility team.
42
46
  *
43
47
  * - [Code](https://atlaskit.atlassian.com/packages/design-system/focus-ring)
44
48
  *
@@ -53,7 +57,6 @@ const insetFocusRingStyles = css({
53
57
  * )
54
58
  * ```
55
59
  */
56
-
57
60
  const FocusRing = ({
58
61
  children,
59
62
  isInset,
@@ -65,7 +68,8 @@ const FocusRing = ({
65
68
  return jsx(ClassNames, null, ({
66
69
  css,
67
70
  cx
68
- }) => Children.only( // This may look unwieldy but means we skip applying styles / cloning if no className is applicable
71
+ }) => Children.only(
72
+ // This may look unwieldy but means we skip applying styles / cloning if no className is applicable
69
73
  focusCls ?
70
74
  /*#__PURE__*/
71
75
  // eslint-disable-next-line @repo/internal/react/no-clone-element
@@ -73,5 +77,4 @@ const FocusRing = ({
73
77
  className: cx([css(focusCls), children.props.className])
74
78
  }) : children));
75
79
  };
76
-
77
80
  export default FocusRing;
@@ -1,32 +1,13 @@
1
1
  import { useRef, useState } from 'react';
2
-
3
2
  /**
4
3
  * __Use focus ring__
5
4
  *
6
- * The `useFocusRing` hook is designed to manage focus for the `FocusRing` in cases where the `FocusRing`'s visual application
7
- * and the element that takes focus, differ. See the `focus` prop of `FocusRing` for more information.
5
+ * This component has accessibility issues that we are working to resolve.
6
+ * Do not use without support from the Atlassian Design System accessibility team.
8
7
  *
9
- * @example
10
- * ```jsx
11
- * import VisuallyHidden from '@atlaskit/visuall-hidden';
12
- * import FocusRing, { useFocusRing } from '@atlaskit/focus-ring';
8
+ * The useFocusRing hook manages focus in the rare cases where the focus ring’s visual application and the element that takes focus differ.
9
+ * This is not typically a good practice for accessibility, so don’t do this unless you’ve consulted with the accessibility team.
13
10
  *
14
- * const InteractiveComponent = () => {
15
- * const { focusState, focusProps } = useFocusRing();
16
- *
17
- * return (
18
- * <div>
19
- * <VisuallHidden>
20
- * <input {...focusProps} />
21
- * </VisuallyHidden>
22
- * <FocusRing focus={focusState}>
23
- * <div role="button">Hello</div>
24
- * </FocusRing>
25
- * </div>
26
- * );
27
- *
28
- * }
29
- * ```
30
11
  */
31
12
  const useFocusRing = (initialState = 'off') => {
32
13
  const [focusState, setFocusState] = useState(initialState);
@@ -39,5 +20,4 @@ const useFocusRing = (initialState = 'off') => {
39
20
  focusProps: focusProps.current
40
21
  };
41
22
  };
42
-
43
23
  export default useFocusRing;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/focus-ring",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "sideEffects": false
5
5
  }
@@ -35,10 +35,14 @@ var insetFocusRingStyles = css({
35
35
  }
36
36
  }
37
37
  });
38
+
38
39
  /**
39
40
  * __Focus ring__
40
41
  *
41
- * A focus ring is used indicate the currently focused item.
42
+ * A focus ring visually indicates the currently focused item.
43
+ *
44
+ * There are known accessibility issues with this component.
45
+ * Do not use without assisitance from the Design System accessibility team.
42
46
  *
43
47
  * - [Code](https://atlaskit.atlassian.com/packages/design-system/focus-ring)
44
48
  *
@@ -53,18 +57,18 @@ var insetFocusRingStyles = css({
53
57
  * )
54
58
  * ```
55
59
  */
56
-
57
60
  var FocusRing = function FocusRing(_ref) {
58
61
  var children = _ref.children,
59
- isInset = _ref.isInset,
60
- focus = _ref.focus;
62
+ isInset = _ref.isInset,
63
+ focus = _ref.focus;
61
64
  var controlledStyles = isInset ? baseInsetStyles : baseFocusOutsideStyles;
62
65
  var uncontrolledStyles = isInset ? insetFocusRingStyles : focusRingStyles;
63
66
  var focusCls = typeof focus === 'undefined' ? uncontrolledStyles : focus === 'on' && controlledStyles;
64
67
  return jsx(ClassNames, null, function (_ref2) {
65
68
  var css = _ref2.css,
66
- cx = _ref2.cx;
67
- return Children.only( // This may look unwieldy but means we skip applying styles / cloning if no className is applicable
69
+ cx = _ref2.cx;
70
+ return Children.only(
71
+ // This may look unwieldy but means we skip applying styles / cloning if no className is applicable
68
72
  focusCls ?
69
73
  /*#__PURE__*/
70
74
  // eslint-disable-next-line @repo/internal/react/no-clone-element
@@ -73,5 +77,4 @@ var FocusRing = function FocusRing(_ref) {
73
77
  }) : children);
74
78
  });
75
79
  };
76
-
77
80
  export default FocusRing;
@@ -1,42 +1,21 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import { useRef, useState } from 'react';
3
-
4
3
  /**
5
4
  * __Use focus ring__
6
5
  *
7
- * The `useFocusRing` hook is designed to manage focus for the `FocusRing` in cases where the `FocusRing`'s visual application
8
- * and the element that takes focus, differ. See the `focus` prop of `FocusRing` for more information.
6
+ * This component has accessibility issues that we are working to resolve.
7
+ * Do not use without support from the Atlassian Design System accessibility team.
9
8
  *
10
- * @example
11
- * ```jsx
12
- * import VisuallyHidden from '@atlaskit/visuall-hidden';
13
- * import FocusRing, { useFocusRing } from '@atlaskit/focus-ring';
9
+ * The useFocusRing hook manages focus in the rare cases where the focus ring’s visual application and the element that takes focus differ.
10
+ * This is not typically a good practice for accessibility, so don’t do this unless you’ve consulted with the accessibility team.
14
11
  *
15
- * const InteractiveComponent = () => {
16
- * const { focusState, focusProps } = useFocusRing();
17
- *
18
- * return (
19
- * <div>
20
- * <VisuallHidden>
21
- * <input {...focusProps} />
22
- * </VisuallyHidden>
23
- * <FocusRing focus={focusState}>
24
- * <div role="button">Hello</div>
25
- * </FocusRing>
26
- * </div>
27
- * );
28
- *
29
- * }
30
- * ```
31
12
  */
32
13
  var useFocusRing = function useFocusRing() {
33
14
  var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'off';
34
-
35
15
  var _useState = useState(initialState),
36
- _useState2 = _slicedToArray(_useState, 2),
37
- focusState = _useState2[0],
38
- setFocusState = _useState2[1];
39
-
16
+ _useState2 = _slicedToArray(_useState, 2),
17
+ focusState = _useState2[0],
18
+ setFocusState = _useState2[1];
40
19
  var focusProps = useRef({
41
20
  onFocus: function onFocus() {
42
21
  return setFocusState('on');
@@ -50,5 +29,4 @@ var useFocusRing = function useFocusRing() {
50
29
  focusProps: focusProps.current
51
30
  };
52
31
  };
53
-
54
32
  export default useFocusRing;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/focus-ring",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "sideEffects": false
5
5
  }
@@ -4,7 +4,10 @@ import type { FocusRingProps } from './types';
4
4
  /**
5
5
  * __Focus ring__
6
6
  *
7
- * A focus ring is used indicate the currently focused item.
7
+ * A focus ring visually indicates the currently focused item.
8
+ *
9
+ * There are known accessibility issues with this component.
10
+ * Do not use without assisitance from the Design System accessibility team.
8
11
  *
9
12
  * - [Code](https://atlaskit.atlassian.com/packages/design-system/focus-ring)
10
13
  *
@@ -2,30 +2,12 @@ import type { FocusEventHandlers, FocusState } from './types';
2
2
  /**
3
3
  * __Use focus ring__
4
4
  *
5
- * The `useFocusRing` hook is designed to manage focus for the `FocusRing` in cases where the `FocusRing`'s visual application
6
- * and the element that takes focus, differ. See the `focus` prop of `FocusRing` for more information.
5
+ * This component has accessibility issues that we are working to resolve.
6
+ * Do not use without support from the Atlassian Design System accessibility team.
7
7
  *
8
- * @example
9
- * ```jsx
10
- * import VisuallyHidden from '@atlaskit/visuall-hidden';
11
- * import FocusRing, { useFocusRing } from '@atlaskit/focus-ring';
8
+ * The useFocusRing hook manages focus in the rare cases where the focus ring’s visual application and the element that takes focus differ.
9
+ * This is not typically a good practice for accessibility, so don’t do this unless you’ve consulted with the accessibility team.
12
10
  *
13
- * const InteractiveComponent = () => {
14
- * const { focusState, focusProps } = useFocusRing();
15
- *
16
- * return (
17
- * <div>
18
- * <VisuallHidden>
19
- * <input {...focusProps} />
20
- * </VisuallyHidden>
21
- * <FocusRing focus={focusState}>
22
- * <div role="button">Hello</div>
23
- * </FocusRing>
24
- * </div>
25
- * );
26
- *
27
- * }
28
- * ```
29
11
  */
30
12
  declare const useFocusRing: (initialState?: FocusState) => {
31
13
  readonly focusState: "on" | "off";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/focus-ring",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "A focus ring is used to indicate the currently focused item.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,7 +27,7 @@
27
27
  ".": "./src/index.tsx"
28
28
  },
29
29
  "dependencies": {
30
- "@atlaskit/tokens": "^0.13.0",
30
+ "@atlaskit/tokens": "^1.2.0",
31
31
  "@babel/runtime": "^7.0.0",
32
32
  "@emotion/react": "^11.7.1"
33
33
  },
@@ -38,6 +38,7 @@
38
38
  "@atlaskit/button": "^16.5.0",
39
39
  "@atlaskit/docs": "*",
40
40
  "@atlaskit/progress-indicator": "^9.4.0",
41
+ "@atlaskit/section-message": "^6.3.10",
41
42
  "@atlaskit/ssr": "*",
42
43
  "@atlaskit/textfield": "^5.3.0",
43
44
  "@atlaskit/visual-regression": "*",
@@ -63,7 +64,9 @@
63
64
  ],
64
65
  "ui-components": "lite-mode",
65
66
  "analytics": "analytics-next",
66
- "theming": "tokens",
67
+ "design-tokens": [
68
+ "color"
69
+ ],
67
70
  "deprecation": "no-deprecated-imports"
68
71
  }
69
72
  },
package/report.api.md CHANGED
@@ -1,4 +1,4 @@
1
- <!-- API Report Version: 2.2 -->
1
+ <!-- API Report Version: 2.3 -->
2
2
 
3
3
  ## API Report File for "@atlaskit/focus-ring"
4
4