@atlaskit/focus-ring 1.0.7 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/focus-ring
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`71bf011db22`](https://bitbucket.org/atlassian/atlassian-frontend/commits/71bf011db22) - Focus ring inset styles are now applied via outline - consistent with offset styles.
8
+
9
+ ## 1.1.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`b5d79ded842`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b5d79ded842) - Updates `@emotion/core` to `@emotion/react`; v10 to v11. There is no expected behavior change.
14
+
3
15
  ## 1.0.7
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,13 @@
1
+ ---
2
+ order: 0
3
+ ---
4
+
5
+ import FocusRingDefault from '../../examples/constellation/focus-ring-default';
6
+
7
+ ## Default
8
+
9
+ A focus ring is used to indicate the currently focused item.
10
+
11
+ <Example Component={FocusRingDefault} packageName="@atlaskit/focus-ring" />
12
+
13
+
@@ -7,21 +7,21 @@ exports.default = void 0;
7
7
 
8
8
  var _react = require("react");
9
9
 
10
- var _core = require("@emotion/core");
11
-
12
- var _colors = require("@atlaskit/theme/colors");
10
+ var _react2 = require("@emotion/react");
13
11
 
14
12
  /** @jsx jsx */
15
13
  var BORDER_WIDTH = 2;
16
- var baseFocusOutsideStyles = (0, _core.css)({
17
- outline: "".concat(BORDER_WIDTH, "px solid ", "var(--ds-border-focused, ".concat(_colors.B100, ")")),
14
+ var baseFocusOutsideStyles = (0, _react2.css)({
15
+ outline: "".concat(BORDER_WIDTH, "px solid ", "var(--ds-border-focused, #4C9AFF)"),
18
16
  outlineOffset: BORDER_WIDTH
19
17
  });
20
- var baseInsetStyles = (0, _core.css)({
21
- boxShadow: "inset 0px 0px 0px ".concat(BORDER_WIDTH, "px ", "var(--ds-border-focused, ".concat(_colors.B100, ")")),
22
- outline: 'none'
18
+ var baseInsetStyles = (0, _react2.css)({
19
+ outlineColor: "var(--ds-border-focused, #4C9AFF)",
20
+ outlineOffset: -BORDER_WIDTH,
21
+ outlineStyle: 'solid',
22
+ outlineWidth: BORDER_WIDTH
23
23
  });
24
- var focusRingStyles = (0, _core.css)({
24
+ var focusRingStyles = (0, _react2.css)({
25
25
  '&:focus-visible': baseFocusOutsideStyles,
26
26
  '@supports not selector(*:focus-visible)': {
27
27
  '&:focus': baseFocusOutsideStyles
@@ -32,7 +32,7 @@ var focusRingStyles = (0, _core.css)({
32
32
  }
33
33
  }
34
34
  });
35
- var insetFocusRingStyles = (0, _core.css)({
35
+ var insetFocusRingStyles = (0, _react2.css)({
36
36
  '&:focus-visible': baseInsetStyles,
37
37
  '@supports not selector(*:focus-visible)': {
38
38
  '&:focus': baseInsetStyles
@@ -70,7 +70,7 @@ var FocusRing = function FocusRing(_ref) {
70
70
  var controlledStyles = isInset ? baseInsetStyles : baseFocusOutsideStyles;
71
71
  var uncontrolledStyles = isInset ? insetFocusRingStyles : focusRingStyles;
72
72
  var focusCls = typeof focus === 'undefined' ? uncontrolledStyles : focus === 'on' && controlledStyles;
73
- return (0, _core.jsx)(_core.ClassNames, null, function (_ref2) {
73
+ return (0, _react2.jsx)(_react2.ClassNames, null, function (_ref2) {
74
74
  var css = _ref2.css,
75
75
  cx = _ref2.cx;
76
76
  return _react.Children.only( // This may look unwieldy but means we skip applying styles / cloning if no className is applicable
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/focus-ring",
3
- "version": "1.0.7",
3
+ "version": "1.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,15 +1,16 @@
1
1
  /** @jsx jsx */
2
2
  import { Children, cloneElement } from 'react';
3
- import { ClassNames, css, jsx } from '@emotion/core';
4
- import { B100 } from '@atlaskit/theme/colors';
3
+ import { ClassNames, css, jsx } from '@emotion/react';
5
4
  const BORDER_WIDTH = 2;
6
5
  const baseFocusOutsideStyles = css({
7
- outline: `${BORDER_WIDTH}px solid ${`var(--ds-border-focused, ${B100})`}`,
6
+ outline: `${BORDER_WIDTH}px solid ${"var(--ds-border-focused, #4C9AFF)"}`,
8
7
  outlineOffset: BORDER_WIDTH
9
8
  });
10
9
  const baseInsetStyles = css({
11
- boxShadow: `inset 0px 0px 0px ${BORDER_WIDTH}px ${`var(--ds-border-focused, ${B100})`}`,
12
- outline: 'none'
10
+ outlineColor: "var(--ds-border-focused, #4C9AFF)",
11
+ outlineOffset: -BORDER_WIDTH,
12
+ outlineStyle: 'solid',
13
+ outlineWidth: BORDER_WIDTH
13
14
  });
14
15
  const focusRingStyles = css({
15
16
  '&:focus-visible': baseFocusOutsideStyles,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/focus-ring",
3
- "version": "1.0.7",
3
+ "version": "1.2.0",
4
4
  "sideEffects": false
5
5
  }
@@ -1,15 +1,16 @@
1
1
  /** @jsx jsx */
2
2
  import { Children, cloneElement } from 'react';
3
- import { ClassNames, css, jsx } from '@emotion/core';
4
- import { B100 } from '@atlaskit/theme/colors';
3
+ import { ClassNames, css, jsx } from '@emotion/react';
5
4
  var BORDER_WIDTH = 2;
6
5
  var baseFocusOutsideStyles = css({
7
- outline: "".concat(BORDER_WIDTH, "px solid ", "var(--ds-border-focused, ".concat(B100, ")")),
6
+ outline: "".concat(BORDER_WIDTH, "px solid ", "var(--ds-border-focused, #4C9AFF)"),
8
7
  outlineOffset: BORDER_WIDTH
9
8
  });
10
9
  var baseInsetStyles = css({
11
- boxShadow: "inset 0px 0px 0px ".concat(BORDER_WIDTH, "px ", "var(--ds-border-focused, ".concat(B100, ")")),
12
- outline: 'none'
10
+ outlineColor: "var(--ds-border-focused, #4C9AFF)",
11
+ outlineOffset: -BORDER_WIDTH,
12
+ outlineStyle: 'solid',
13
+ outlineWidth: BORDER_WIDTH
13
14
  });
14
15
  var focusRingStyles = css({
15
16
  '&:focus-visible': baseFocusOutsideStyles,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/focus-ring",
3
- "version": "1.0.7",
3
+ "version": "1.2.0",
4
4
  "sideEffects": false
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/focus-ring",
3
- "version": "1.0.7",
3
+ "version": "1.2.0",
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",
@@ -8,6 +8,7 @@
8
8
  "registry": "https://registry.npmjs.org/"
9
9
  },
10
10
  "atlassian": {
11
+ "disableProductCI": true,
11
12
  "team": "Design System Team",
12
13
  "releaseModel": "scheduled",
13
14
  "website": {
@@ -20,33 +21,25 @@
20
21
  "module": "dist/esm/index.js",
21
22
  "module:es2019": "dist/es2019/index.js",
22
23
  "types": "dist/types/index.d.ts",
23
- "typesVersions": {
24
- ">=4.0 <4.5": {
25
- "*": [
26
- "dist/types-ts4.0/*"
27
- ]
28
- }
29
- },
30
24
  "sideEffects": false,
31
25
  "atlaskit:src": "src/index.tsx",
32
26
  "af:exports": {
33
27
  ".": "./src/index.tsx"
34
28
  },
35
29
  "dependencies": {
36
- "@atlaskit/theme": "^12.2.0",
37
30
  "@atlaskit/tokens": "^0.10.0",
38
31
  "@babel/runtime": "^7.0.0",
39
- "@emotion/core": "^10.0.9"
32
+ "@emotion/react": "^11.7.1"
40
33
  },
41
34
  "peerDependencies": {
42
35
  "react": "^16.8.0"
43
36
  },
44
37
  "devDependencies": {
45
- "@atlaskit/button": "^16.3.0",
38
+ "@atlaskit/button": "^16.4.0",
46
39
  "@atlaskit/docs": "*",
47
40
  "@atlaskit/progress-indicator": "^9.3.0",
48
41
  "@atlaskit/ssr": "*",
49
- "@atlaskit/textfield": "^5.2.0",
42
+ "@atlaskit/textfield": "^5.3.0",
50
43
  "@atlaskit/visual-regression": "*",
51
44
  "@atlaskit/visually-hidden": "^1.1.0",
52
45
  "@atlaskit/webdriver-runner": "*",
package/report.api.md CHANGED
@@ -2,90 +2,44 @@
2
2
 
3
3
  > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
4
 
5
- ````ts
5
+ <!--
6
+ Generated API Report version: 2.0
7
+ -->
8
+
9
+ [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
10
+
11
+ ```ts
6
12
  import { FC } from 'react';
7
13
  import type { FocusEventHandler } from 'react';
8
14
  import type { ReactElement } from 'react';
9
15
 
10
- export declare interface FocusEventHandlers {
11
- onFocus: FocusEventHandler;
16
+ // @public (undocumented)
17
+ export interface FocusEventHandlers {
18
+ // (undocumented)
12
19
  onBlur: FocusEventHandler;
20
+ // (undocumented)
21
+ onFocus: FocusEventHandler;
13
22
  }
14
23
 
15
- /**
16
- * __Focus ring__
17
- *
18
- * A focus ring is used indicate the currently focused item.
19
- *
20
- * - [Code](https://atlaskit.atlassian.com/packages/design-system/focus-ring)
21
- *
22
- * @example
23
- * ```jsx
24
- * import FocusRing from '@atlaskit/focus-ring';
25
- *
26
- * const InteractiveComponent = () => (
27
- * <FocusRing>
28
- * <button type="button">Hello</button>
29
- * </FocusRing>
30
- * )
31
- * ```
32
- */
33
- declare const FocusRing: FC<FocusRingProps>;
24
+ // @public
25
+ const FocusRing: FC<FocusRingProps>;
34
26
  export default FocusRing;
35
27
 
36
- export declare interface FocusRingProps {
37
- /**
38
- * Makes the `FocusRing` a controlled component (opting out of native focus behavior). The focus ring
39
- * will apply the visual focus indicator when the `focus` prop is set to `on`. This prop should be used
40
- * in conjunction with `useFocusRing`.
41
- */
28
+ // @public (undocumented)
29
+ export interface FocusRingProps {
30
+ children: ReactElement;
42
31
  focus?: FocusState;
43
- /**
44
- * Controls whether the focus ring should be applied around or within the composed element.
45
- */
46
32
  isInset?: boolean;
47
- /**
48
- * The focusable element to be rendered within the `FocusRing`.
49
- */
50
- children: ReactElement;
51
33
  }
52
34
 
53
- export declare type FocusState = 'on' | 'off';
35
+ // @public (undocumented)
36
+ export type FocusState = 'on' | 'off';
54
37
 
55
- /**
56
- * __Use focus ring__
57
- *
58
- * The `useFocusRing` hook is designed to manage focus for the `FocusRing` in cases where the `FocusRing`'s visual application
59
- * and the element that takes focus, differ. See the `focus` prop of `FocusRing` for more information.
60
- *
61
- * @example
62
- * ```jsx
63
- * import VisuallyHidden from '@atlaskit/visuall-hidden';
64
- * import FocusRing, { useFocusRing } from '@atlaskit/focus-ring';
65
- *
66
- * const InteractiveComponent = () => {
67
- * const { focusState, focusProps } = useFocusRing();
68
- *
69
- * return (
70
- * <div>
71
- * <VisuallHidden>
72
- * <input {...focusProps} />
73
- * </VisuallyHidden>
74
- * <FocusRing focus={focusState}>
75
- * <div role="button">Hello</div>
76
- * </FocusRing>
77
- * </div>
78
- * );
79
- *
80
- * }
81
- * ```
82
- */
83
- export declare const useFocusRing: (
84
- initialState?: FocusState,
85
- ) => {
38
+ // @public
39
+ export const useFocusRing: (initialState?: FocusState) => {
86
40
  readonly focusState: 'on' | 'off';
87
41
  readonly focusProps: FocusEventHandlers;
88
42
  };
89
43
 
90
- export {};
91
- ````
44
+ // (No @packageDocumentation comment for this package)
45
+ ```
@@ -1,23 +0,0 @@
1
- /** @jsx jsx */
2
- import { FC } from 'react';
3
- import type { FocusRingProps } from './types';
4
- /**
5
- * __Focus ring__
6
- *
7
- * A focus ring is used indicate the currently focused item.
8
- *
9
- * - [Code](https://atlaskit.atlassian.com/packages/design-system/focus-ring)
10
- *
11
- * @example
12
- * ```jsx
13
- * import FocusRing from '@atlaskit/focus-ring';
14
- *
15
- * const InteractiveComponent = () => (
16
- * <FocusRing>
17
- * <button type="button">Hello</button>
18
- * </FocusRing>
19
- * )
20
- * ```
21
- */
22
- declare const FocusRing: FC<FocusRingProps>;
23
- export default FocusRing;
@@ -1,3 +0,0 @@
1
- export { default } from './focus-ring';
2
- export { default as useFocusRing } from './use-focus-ring';
3
- export type { FocusRingProps, FocusEventHandlers, FocusState } from './types';
@@ -1,22 +0,0 @@
1
- import type { FocusEventHandler, ReactElement } from 'react';
2
- export interface FocusEventHandlers {
3
- onFocus: FocusEventHandler;
4
- onBlur: FocusEventHandler;
5
- }
6
- export declare type FocusState = 'on' | 'off';
7
- export interface FocusRingProps {
8
- /**
9
- * Makes the `FocusRing` a controlled component (opting out of native focus behavior). The focus ring
10
- * will apply the visual focus indicator when the `focus` prop is set to `on`. This prop should be used
11
- * in conjunction with `useFocusRing`.
12
- */
13
- focus?: FocusState;
14
- /**
15
- * Controls whether the focus ring should be applied around or within the composed element.
16
- */
17
- isInset?: boolean;
18
- /**
19
- * The focusable element to be rendered within the `FocusRing`.
20
- */
21
- children: ReactElement;
22
- }
@@ -1,34 +0,0 @@
1
- import type { FocusEventHandlers, FocusState } from './types';
2
- /**
3
- * __Use focus ring__
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.
7
- *
8
- * @example
9
- * ```jsx
10
- * import VisuallyHidden from '@atlaskit/visuall-hidden';
11
- * import FocusRing, { useFocusRing } from '@atlaskit/focus-ring';
12
- *
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
- */
30
- declare const useFocusRing: (initialState?: FocusState) => {
31
- readonly focusState: "on" | "off";
32
- readonly focusProps: FocusEventHandlers;
33
- };
34
- export default useFocusRing;