@atlaskit/focus-ring 1.1.0 → 1.2.1

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.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 1.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`71bf011db22`](https://bitbucket.org/atlassian/atlassian-frontend/commits/71bf011db22) - Focus ring inset styles are now applied via outline - consistent with offset styles.
14
+
3
15
  ## 1.1.0
4
16
 
5
17
  ### Minor 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
+
@@ -9,17 +9,17 @@ var _react = require("react");
9
9
 
10
10
  var _react2 = require("@emotion/react");
11
11
 
12
- var _colors = require("@atlaskit/theme/colors");
13
-
14
12
  /** @jsx jsx */
15
13
  var BORDER_WIDTH = 2;
16
14
  var baseFocusOutsideStyles = (0, _react2.css)({
17
- outline: "".concat(BORDER_WIDTH, "px solid ", "var(--ds-border-focused, ".concat(_colors.B100, ")")),
15
+ outline: "".concat(BORDER_WIDTH, "px solid ", "var(--ds-border-focused, #4C9AFF)"),
18
16
  outlineOffset: BORDER_WIDTH
19
17
  });
20
18
  var baseInsetStyles = (0, _react2.css)({
21
- boxShadow: "inset 0px 0px 0px ".concat(BORDER_WIDTH, "px ", "var(--ds-border-focused, ".concat(_colors.B100, ")")),
22
- outline: 'none'
19
+ outlineColor: "var(--ds-border-focused, #4C9AFF)",
20
+ outlineOffset: -BORDER_WIDTH,
21
+ outlineStyle: 'solid',
22
+ outlineWidth: BORDER_WIDTH
23
23
  });
24
24
  var focusRingStyles = (0, _react2.css)({
25
25
  '&:focus-visible': baseFocusOutsideStyles,
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/focus-ring",
3
- "version": "1.1.0",
3
+ "version": "1.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,15 +1,16 @@
1
1
  /** @jsx jsx */
2
2
  import { Children, cloneElement } from 'react';
3
3
  import { ClassNames, css, jsx } from '@emotion/react';
4
- import { B100 } from '@atlaskit/theme/colors';
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.1.0",
3
+ "version": "1.2.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,15 +1,16 @@
1
1
  /** @jsx jsx */
2
2
  import { Children, cloneElement } from 'react';
3
3
  import { ClassNames, css, jsx } from '@emotion/react';
4
- import { B100 } from '@atlaskit/theme/colors';
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.1.0",
3
+ "version": "1.2.1",
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.1.0",
3
+ "version": "1.2.1",
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,21 +21,13 @@
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
- "@atlaskit/tokens": "^0.10.0",
30
+ "@atlaskit/tokens": "^0.11.0",
38
31
  "@babel/runtime": "^7.0.0",
39
32
  "@emotion/react": "^11.7.1"
40
33
  },
@@ -42,7 +35,7 @@
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": "*",
package/report.api.md CHANGED
@@ -1,93 +1,45 @@
1
- ## API Report File for "@atlaskit/focus-ring".
1
+ ## API Report File for "@atlaskit/focus-ring"
2
2
 
3
- > Do not edit this file. This report is auto-generated by [API Extractor](https://api-extractor.com/).
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ <!--
6
+ Generated API Report version: 2.0
7
+ -->
4
8
 
5
9
  [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
6
10
 
7
- ````ts
11
+ ```ts
8
12
  import { FC } from 'react';
9
13
  import type { FocusEventHandler } from 'react';
10
14
  import type { ReactElement } from 'react';
11
15
 
12
- export declare interface FocusEventHandlers {
13
- onFocus: FocusEventHandler;
16
+ // @public (undocumented)
17
+ export interface FocusEventHandlers {
18
+ // (undocumented)
14
19
  onBlur: FocusEventHandler;
20
+ // (undocumented)
21
+ onFocus: FocusEventHandler;
15
22
  }
16
23
 
17
- /**
18
- * __Focus ring__
19
- *
20
- * A focus ring is used indicate the currently focused item.
21
- *
22
- * - [Code](https://atlaskit.atlassian.com/packages/design-system/focus-ring)
23
- *
24
- * @example
25
- * ```jsx
26
- * import FocusRing from '@atlaskit/focus-ring';
27
- *
28
- * const InteractiveComponent = () => (
29
- * <FocusRing>
30
- * <button type="button">Hello</button>
31
- * </FocusRing>
32
- * )
33
- * ```
34
- */
35
- declare const FocusRing: FC<FocusRingProps>;
24
+ // @public
25
+ const FocusRing: FC<FocusRingProps>;
36
26
  export default FocusRing;
37
27
 
38
- export declare interface FocusRingProps {
39
- /**
40
- * Makes the `FocusRing` a controlled component (opting out of native focus behavior). The focus ring
41
- * will apply the visual focus indicator when the `focus` prop is set to `on`. This prop should be used
42
- * in conjunction with `useFocusRing`.
43
- */
28
+ // @public (undocumented)
29
+ export interface FocusRingProps {
30
+ children: ReactElement;
44
31
  focus?: FocusState;
45
- /**
46
- * Controls whether the focus ring should be applied around or within the composed element.
47
- */
48
32
  isInset?: boolean;
49
- /**
50
- * The focusable element to be rendered within the `FocusRing`.
51
- */
52
- children: ReactElement;
53
33
  }
54
34
 
55
- export declare type FocusState = 'on' | 'off';
35
+ // @public (undocumented)
36
+ export type FocusState = 'on' | 'off';
56
37
 
57
- /**
58
- * __Use focus ring__
59
- *
60
- * The `useFocusRing` hook is designed to manage focus for the `FocusRing` in cases where the `FocusRing`'s visual application
61
- * and the element that takes focus, differ. See the `focus` prop of `FocusRing` for more information.
62
- *
63
- * @example
64
- * ```jsx
65
- * import VisuallyHidden from '@atlaskit/visuall-hidden';
66
- * import FocusRing, { useFocusRing } from '@atlaskit/focus-ring';
67
- *
68
- * const InteractiveComponent = () => {
69
- * const { focusState, focusProps } = useFocusRing();
70
- *
71
- * return (
72
- * <div>
73
- * <VisuallHidden>
74
- * <input {...focusProps} />
75
- * </VisuallyHidden>
76
- * <FocusRing focus={focusState}>
77
- * <div role="button">Hello</div>
78
- * </FocusRing>
79
- * </div>
80
- * );
81
- *
82
- * }
83
- * ```
84
- */
85
- export declare const useFocusRing: (
86
- initialState?: FocusState,
87
- ) => {
38
+ // @public
39
+ export const useFocusRing: (initialState?: FocusState) => {
88
40
  readonly focusState: 'on' | 'off';
89
41
  readonly focusProps: FocusEventHandlers;
90
42
  };
91
43
 
92
- export {};
93
- ````
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;