@atlaskit/spotlight 0.3.2 → 0.3.3

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/cjs/controllers/context.js +17 -2
  3. package/dist/cjs/ui/actions/index.js +1 -1
  4. package/dist/cjs/ui/body/index.js +1 -1
  5. package/dist/cjs/ui/card/caret/index.js +1 -1
  6. package/dist/cjs/ui/card/index.js +1 -1
  7. package/dist/cjs/ui/controls/index.js +1 -1
  8. package/dist/cjs/ui/dismiss-control/index.js +2 -1
  9. package/dist/cjs/ui/footer/index.js +1 -1
  10. package/dist/cjs/ui/header/index.js +1 -1
  11. package/dist/cjs/ui/headline/index.js +5 -1
  12. package/dist/cjs/ui/media/index.js +1 -1
  13. package/dist/cjs/ui/popover-content/index.js +11 -4
  14. package/dist/cjs/ui/popover-provider/index.js +1 -1
  15. package/dist/cjs/ui/popover-target/index.js +1 -1
  16. package/dist/cjs/ui/primary-action/index.js +4 -2
  17. package/dist/cjs/ui/secondary-action/index.js +4 -2
  18. package/dist/cjs/ui/show-more-control/index.js +1 -1
  19. package/dist/cjs/ui/step-count/index.js +4 -2
  20. package/dist/es2019/controllers/context.js +14 -4
  21. package/dist/es2019/ui/actions/index.js +1 -1
  22. package/dist/es2019/ui/body/index.js +1 -1
  23. package/dist/es2019/ui/card/caret/index.js +1 -1
  24. package/dist/es2019/ui/card/index.js +1 -1
  25. package/dist/es2019/ui/controls/index.js +1 -1
  26. package/dist/es2019/ui/dismiss-control/index.js +2 -1
  27. package/dist/es2019/ui/footer/index.js +1 -1
  28. package/dist/es2019/ui/header/index.js +1 -1
  29. package/dist/es2019/ui/headline/index.js +7 -2
  30. package/dist/es2019/ui/media/index.js +1 -1
  31. package/dist/es2019/ui/popover-content/index.js +11 -4
  32. package/dist/es2019/ui/popover-provider/index.js +1 -1
  33. package/dist/es2019/ui/popover-target/index.js +1 -1
  34. package/dist/es2019/ui/primary-action/index.js +3 -1
  35. package/dist/es2019/ui/secondary-action/index.js +3 -1
  36. package/dist/es2019/ui/show-more-control/index.js +1 -1
  37. package/dist/es2019/ui/step-count/index.js +3 -2
  38. package/dist/esm/controllers/context.js +18 -3
  39. package/dist/esm/ui/actions/index.js +1 -1
  40. package/dist/esm/ui/body/index.js +1 -1
  41. package/dist/esm/ui/card/caret/index.js +1 -1
  42. package/dist/esm/ui/card/index.js +1 -1
  43. package/dist/esm/ui/controls/index.js +1 -1
  44. package/dist/esm/ui/dismiss-control/index.js +2 -1
  45. package/dist/esm/ui/footer/index.js +1 -1
  46. package/dist/esm/ui/header/index.js +1 -1
  47. package/dist/esm/ui/headline/index.js +6 -2
  48. package/dist/esm/ui/media/index.js +1 -1
  49. package/dist/esm/ui/popover-content/index.js +11 -4
  50. package/dist/esm/ui/popover-provider/index.js +1 -1
  51. package/dist/esm/ui/popover-target/index.js +1 -1
  52. package/dist/esm/ui/primary-action/index.js +4 -2
  53. package/dist/esm/ui/secondary-action/index.js +4 -2
  54. package/dist/esm/ui/show-more-control/index.js +1 -1
  55. package/dist/esm/ui/step-count/index.js +3 -2
  56. package/dist/types/controllers/context.d.ts +4 -0
  57. package/dist/types/ui/popover-content/index.d.ts +7 -1
  58. package/dist/types/ui/primary-action/index.d.ts +4 -0
  59. package/dist/types/ui/secondary-action/index.d.ts +4 -0
  60. package/dist/types-ts4.5/controllers/context.d.ts +4 -0
  61. package/dist/types-ts4.5/ui/popover-content/index.d.ts +7 -1
  62. package/dist/types-ts4.5/ui/primary-action/index.d.ts +4 -0
  63. package/dist/types-ts4.5/ui/secondary-action/index.d.ts +4 -0
  64. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @atlaskit/spotlight
2
2
 
3
+ ## 0.3.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`bd8e43d78afb8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bd8e43d78afb8) - -
8
+ Add `role="dialog"` to PopoverContent. `aria-labelledby` is internally managed by
9
+ `SpotlightContext`.
10
+ - Add `aria-label='Dismiss'` to `SpotlightDismissControl`.
11
+ - Add `aria-label'` prop to `SpotlightPrimaryAction`.
12
+ - Add `aria-label'` prop to `SpotlightSecondaryAction`.
13
+
3
14
  ## 0.3.2
4
15
 
5
16
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- /* context.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* context.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -19,20 +19,35 @@ var SpotlightContext = exports.SpotlightContext = /*#__PURE__*/(0, _react.create
19
19
  placement: 'bottom-end',
20
20
  setPlacement: function setPlacement() {
21
21
  return undefined;
22
+ },
23
+ heading: {
24
+ id: '',
25
+ setId: function setId() {
26
+ return undefined;
27
+ }
22
28
  }
23
29
  });
24
30
 
25
31
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
26
32
  var SpotlightContextProvider = exports.SpotlightContextProvider = function SpotlightContextProvider(_ref) {
27
33
  var children = _ref.children;
34
+ var id = (0, _react.useId)();
28
35
  var _useState = (0, _react.useState)('bottom-end'),
29
36
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
30
37
  placement = _useState2[0],
31
38
  setPlacement = _useState2[1];
39
+ var _useState3 = (0, _react.useState)("".concat(id, "-heading")),
40
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
41
+ headingId = _useState4[0],
42
+ setHeadingId = _useState4[1];
32
43
  return /*#__PURE__*/React.createElement(SpotlightContext.Provider, {
33
44
  value: {
34
45
  placement: placement,
35
- setPlacement: setPlacement
46
+ setPlacement: setPlacement,
47
+ heading: {
48
+ id: headingId,
49
+ setId: setHeadingId
50
+ }
36
51
  }
37
52
  }, children);
38
53
  };
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -27,6 +27,7 @@ var SpotlightDismissControl = exports.SpotlightDismissControl = /*#__PURE__*/(0,
27
27
  var onClick = _ref.onClick,
28
28
  testId = _ref.testId;
29
29
  return /*#__PURE__*/React.createElement(_compiled.Pressable, {
30
+ "aria-label": "Dismiss",
30
31
  xcss: styles.root,
31
32
  onClick: onClick,
32
33
  ref: ref,
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -11,6 +11,7 @@ var _react = _interopRequireWildcard(require("react"));
11
11
  var React = _react;
12
12
  var _runtime = require("@compiled/react/runtime");
13
13
  var _heading = _interopRequireDefault(require("@atlaskit/heading"));
14
+ var _context = require("../../controllers/context");
14
15
  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); }
15
16
  /**
16
17
  * __SpotlightHeadline__
@@ -21,7 +22,10 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
21
22
  var SpotlightHeadline = exports.SpotlightHeadline = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
22
23
  var children = _ref.children,
23
24
  testId = _ref.testId;
25
+ var _useContext = (0, _react.useContext)(_context.SpotlightContext),
26
+ heading = _useContext.heading;
24
27
  return /*#__PURE__*/React.createElement(_heading.default, {
28
+ id: heading.id,
25
29
  ref: ref,
26
30
  testId: testId,
27
31
  size: "xsmall"
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -58,9 +58,11 @@ var PopoverContent = exports.PopoverContent = function PopoverContent(_ref) {
58
58
  var children = _ref.children,
59
59
  placement = _ref.placement,
60
60
  _ref$isVisible = _ref.isVisible,
61
- isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible;
61
+ isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible,
62
+ testId = _ref.testId;
62
63
  var _useContext = (0, _react.useContext)(_context.SpotlightContext),
63
- setPlacement = _useContext.setPlacement;
64
+ setPlacement = _useContext.setPlacement,
65
+ heading = _useContext.heading;
64
66
  var visibility = isVisible ? 'visible' : 'hidden';
65
67
  (0, _react.useEffect)(function () {
66
68
  setPlacement(placement);
@@ -72,7 +74,12 @@ var PopoverContent = exports.PopoverContent = function PopoverContent(_ref) {
72
74
  var ref = _ref2.ref,
73
75
  style = _ref2.style;
74
76
  return /*#__PURE__*/React.createElement("div", {
75
- ref: ref,
77
+ role: "dialog",
78
+ "data-testid": testId,
79
+ "aria-labelledby": heading.id,
80
+ ref: ref
81
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
82
+ ,
76
83
  style: style,
77
84
  className: (0, _runtime.ax)([styles.root, visibilityStyles[visibility]])
78
85
  }, children);
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -23,10 +23,12 @@ var styles = {
23
23
  *
24
24
  */
25
25
  var SpotlightPrimaryAction = exports.SpotlightPrimaryAction = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
26
- var onClick = _ref.onClick,
26
+ var ariaLabel = _ref['aria-label'],
27
+ onClick = _ref.onClick,
27
28
  children = _ref.children,
28
29
  testId = _ref.testId;
29
30
  return /*#__PURE__*/React.createElement(_compiled.Pressable, {
31
+ "aria-label": ariaLabel,
30
32
  ref: ref,
31
33
  testId: testId,
32
34
  xcss: styles.root,
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _typeof = require("@babel/runtime/helpers/typeof");
@@ -23,10 +23,12 @@ var styles = {
23
23
  *
24
24
  */
25
25
  var SpotlightSecondaryAction = exports.SpotlightSecondaryAction = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
26
- var onClick = _ref.onClick,
26
+ var ariaLabel = _ref['aria-label'],
27
+ onClick = _ref.onClick,
27
28
  children = _ref.children,
28
29
  testId = _ref.testId;
29
30
  return /*#__PURE__*/React.createElement(_compiled.Pressable, {
31
+ "aria-label": ariaLabel,
30
32
  ref: ref,
31
33
  testId: testId,
32
34
  xcss: styles.root,
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -1,6 +1,7 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  "use strict";
3
3
 
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
5
  var _typeof = require("@babel/runtime/helpers/typeof");
5
6
  Object.defineProperty(exports, "__esModule", {
6
7
  value: true
@@ -11,6 +12,7 @@ var _react = _interopRequireWildcard(require("react"));
11
12
  var React = _react;
12
13
  var _runtime = require("@compiled/react/runtime");
13
14
  var _compiled = require("@atlaskit/primitives/compiled");
15
+ var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden"));
14
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); }
15
17
  var styles = {
16
18
  root: "_1ul91ris"
@@ -29,5 +31,5 @@ var SpotlightStepCount = exports.SpotlightStepCount = /*#__PURE__*/(0, _react.fo
29
31
  }, /*#__PURE__*/React.createElement(_compiled.Text, {
30
32
  ref: ref,
31
33
  testId: testId
32
- }, children));
34
+ }, children, ' ', /*#__PURE__*/React.createElement(_visuallyHidden.default, null, "steps")));
33
35
  });
@@ -1,25 +1,35 @@
1
- /* context.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* context.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import * as React from 'react';
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
- import { createContext, useState } from 'react';
4
+ import { createContext, useId, useState } from 'react';
5
5
 
6
6
  // eslint-disable-next-line @repo/internal/react/consistent-types-definitions
7
7
 
8
8
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
9
9
  export const SpotlightContext = /*#__PURE__*/createContext({
10
10
  placement: 'bottom-end',
11
- setPlacement: () => undefined
11
+ setPlacement: () => undefined,
12
+ heading: {
13
+ id: '',
14
+ setId: () => undefined
15
+ }
12
16
  });
13
17
 
14
18
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
15
19
  export const SpotlightContextProvider = ({
16
20
  children
17
21
  }) => {
22
+ const id = useId();
18
23
  const [placement, setPlacement] = useState('bottom-end');
24
+ const [headingId, setHeadingId] = useState(`${id}-heading`);
19
25
  return /*#__PURE__*/React.createElement(SpotlightContext.Provider, {
20
26
  value: {
21
27
  placement,
22
- setPlacement
28
+ setPlacement,
29
+ heading: {
30
+ id: headingId,
31
+ setId: setHeadingId
32
+ }
23
33
  }
24
34
  }, children);
25
35
  };
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -19,6 +19,7 @@ export const SpotlightDismissControl = /*#__PURE__*/forwardRef(({
19
19
  testId
20
20
  }, ref) => {
21
21
  return /*#__PURE__*/React.createElement(Pressable, {
22
+ "aria-label": "Dismiss",
22
23
  xcss: styles.root,
23
24
  onClick: onClick,
24
25
  ref: ref,
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,8 +1,9 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import * as React from 'react';
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
- import { forwardRef } from 'react';
4
+ import { forwardRef, useContext } from 'react';
5
5
  import Heading from '@atlaskit/heading';
6
+ import { SpotlightContext } from '../../controllers/context';
6
7
  /**
7
8
  * __SpotlightHeadline__
8
9
  *
@@ -13,7 +14,11 @@ export const SpotlightHeadline = /*#__PURE__*/forwardRef(({
13
14
  children,
14
15
  testId
15
16
  }, ref) => {
17
+ const {
18
+ heading
19
+ } = useContext(SpotlightContext);
16
20
  return /*#__PURE__*/React.createElement(Heading, {
21
+ id: heading.id,
17
22
  ref: ref,
18
23
  testId: testId,
19
24
  size: "xsmall"
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -49,10 +49,12 @@ const popperPlacementMap = {
49
49
  export const PopoverContent = ({
50
50
  children,
51
51
  placement,
52
- isVisible = true
52
+ isVisible = true,
53
+ testId
53
54
  }) => {
54
55
  const {
55
- setPlacement
56
+ setPlacement,
57
+ heading
56
58
  } = useContext(SpotlightContext);
57
59
  const visibility = isVisible ? 'visible' : 'hidden';
58
60
  useEffect(() => {
@@ -65,7 +67,12 @@ export const PopoverContent = ({
65
67
  ref,
66
68
  style
67
69
  }) => /*#__PURE__*/React.createElement("div", {
68
- ref: ref,
70
+ role: "dialog",
71
+ "data-testid": testId,
72
+ "aria-labelledby": heading.id,
73
+ ref: ref
74
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
75
+ ,
69
76
  style: style,
70
77
  className: ax([styles.root, visibilityStyles[visibility]])
71
78
  }, children));
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import * as React from 'react';
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import { Manager } from '@atlaskit/popper';
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -15,11 +15,13 @@ const styles = {
15
15
  *
16
16
  */
17
17
  export const SpotlightPrimaryAction = /*#__PURE__*/forwardRef(({
18
+ 'aria-label': ariaLabel,
18
19
  onClick,
19
20
  children,
20
21
  testId
21
22
  }, ref) => {
22
23
  return /*#__PURE__*/React.createElement(Pressable, {
24
+ "aria-label": ariaLabel,
23
25
  ref: ref,
24
26
  testId: testId,
25
27
  xcss: styles.root,
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -15,11 +15,13 @@ const styles = {
15
15
  *
16
16
  */
17
17
  export const SpotlightSecondaryAction = /*#__PURE__*/forwardRef(({
18
+ 'aria-label': ariaLabel,
18
19
  onClick,
19
20
  children,
20
21
  testId
21
22
  }, ref) => {
22
23
  return /*#__PURE__*/React.createElement(Pressable, {
24
+ "aria-label": ariaLabel,
23
25
  ref: ref,
24
26
  testId: testId,
25
27
  xcss: styles.root,
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,9 +1,10 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import { forwardRef } from 'react';
6
6
  import { Flex, Text } from '@atlaskit/primitives/compiled';
7
+ import VisuallyHidden from '@atlaskit/visually-hidden';
7
8
  const styles = {
8
9
  root: "_1ul91ris"
9
10
  };
@@ -22,5 +23,5 @@ export const SpotlightStepCount = /*#__PURE__*/forwardRef(({
22
23
  }, /*#__PURE__*/React.createElement(Text, {
23
24
  ref: ref,
24
25
  testId: testId
25
- }, children));
26
+ }, children, ' ', /*#__PURE__*/React.createElement(VisuallyHidden, null, "steps")));
26
27
  });
@@ -1,8 +1,8 @@
1
- /* context.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* context.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
- import { createContext, useState } from 'react';
5
+ import { createContext, useId, useState } from 'react';
6
6
 
7
7
  // eslint-disable-next-line @repo/internal/react/consistent-types-definitions
8
8
 
@@ -11,20 +11,35 @@ export var SpotlightContext = /*#__PURE__*/createContext({
11
11
  placement: 'bottom-end',
12
12
  setPlacement: function setPlacement() {
13
13
  return undefined;
14
+ },
15
+ heading: {
16
+ id: '',
17
+ setId: function setId() {
18
+ return undefined;
19
+ }
14
20
  }
15
21
  });
16
22
 
17
23
  // eslint-disable-next-line @repo/internal/react/require-jsdoc
18
24
  export var SpotlightContextProvider = function SpotlightContextProvider(_ref) {
19
25
  var children = _ref.children;
26
+ var id = useId();
20
27
  var _useState = useState('bottom-end'),
21
28
  _useState2 = _slicedToArray(_useState, 2),
22
29
  placement = _useState2[0],
23
30
  setPlacement = _useState2[1];
31
+ var _useState3 = useState("".concat(id, "-heading")),
32
+ _useState4 = _slicedToArray(_useState3, 2),
33
+ headingId = _useState4[0],
34
+ setHeadingId = _useState4[1];
24
35
  return /*#__PURE__*/React.createElement(SpotlightContext.Provider, {
25
36
  value: {
26
37
  placement: placement,
27
- setPlacement: setPlacement
38
+ setPlacement: setPlacement,
39
+ heading: {
40
+ id: headingId,
41
+ setId: setHeadingId
42
+ }
28
43
  }
29
44
  }, children);
30
45
  };
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -18,6 +18,7 @@ export var SpotlightDismissControl = /*#__PURE__*/forwardRef(function (_ref, ref
18
18
  var onClick = _ref.onClick,
19
19
  testId = _ref.testId;
20
20
  return /*#__PURE__*/React.createElement(Pressable, {
21
+ "aria-label": "Dismiss",
21
22
  xcss: styles.root,
22
23
  onClick: onClick,
23
24
  ref: ref,
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,8 +1,9 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import * as React from 'react';
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
- import { forwardRef } from 'react';
4
+ import { forwardRef, useContext } from 'react';
5
5
  import Heading from '@atlaskit/heading';
6
+ import { SpotlightContext } from '../../controllers/context';
6
7
  /**
7
8
  * __SpotlightHeadline__
8
9
  *
@@ -12,7 +13,10 @@ import Heading from '@atlaskit/heading';
12
13
  export var SpotlightHeadline = /*#__PURE__*/forwardRef(function (_ref, ref) {
13
14
  var children = _ref.children,
14
15
  testId = _ref.testId;
16
+ var _useContext = useContext(SpotlightContext),
17
+ heading = _useContext.heading;
15
18
  return /*#__PURE__*/React.createElement(Heading, {
19
+ id: heading.id,
16
20
  ref: ref,
17
21
  testId: testId,
18
22
  size: "xsmall"
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -50,9 +50,11 @@ export var PopoverContent = function PopoverContent(_ref) {
50
50
  var children = _ref.children,
51
51
  placement = _ref.placement,
52
52
  _ref$isVisible = _ref.isVisible,
53
- isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible;
53
+ isVisible = _ref$isVisible === void 0 ? true : _ref$isVisible,
54
+ testId = _ref.testId;
54
55
  var _useContext = useContext(SpotlightContext),
55
- setPlacement = _useContext.setPlacement;
56
+ setPlacement = _useContext.setPlacement,
57
+ heading = _useContext.heading;
56
58
  var visibility = isVisible ? 'visible' : 'hidden';
57
59
  useEffect(function () {
58
60
  setPlacement(placement);
@@ -64,7 +66,12 @@ export var PopoverContent = function PopoverContent(_ref) {
64
66
  var ref = _ref2.ref,
65
67
  style = _ref2.style;
66
68
  return /*#__PURE__*/React.createElement("div", {
67
- ref: ref,
69
+ role: "dialog",
70
+ "data-testid": testId,
71
+ "aria-labelledby": heading.id,
72
+ ref: ref
73
+ // eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
74
+ ,
68
75
  style: style,
69
76
  className: ax([styles.root, visibilityStyles[visibility]])
70
77
  }, children);
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import * as React from 'react';
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import { Manager } from '@atlaskit/popper';
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -15,10 +15,12 @@ var styles = {
15
15
  *
16
16
  */
17
17
  export var SpotlightPrimaryAction = /*#__PURE__*/forwardRef(function (_ref, ref) {
18
- var onClick = _ref.onClick,
18
+ var ariaLabel = _ref['aria-label'],
19
+ onClick = _ref.onClick,
19
20
  children = _ref.children,
20
21
  testId = _ref.testId;
21
22
  return /*#__PURE__*/React.createElement(Pressable, {
23
+ "aria-label": ariaLabel,
22
24
  ref: ref,
23
25
  testId: testId,
24
26
  xcss: styles.root,
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -15,10 +15,12 @@ var styles = {
15
15
  *
16
16
  */
17
17
  export var SpotlightSecondaryAction = /*#__PURE__*/forwardRef(function (_ref, ref) {
18
- var onClick = _ref.onClick,
18
+ var ariaLabel = _ref['aria-label'],
19
+ onClick = _ref.onClick,
19
20
  children = _ref.children,
20
21
  testId = _ref.testId;
21
22
  return /*#__PURE__*/React.createElement(Pressable, {
23
+ "aria-label": ariaLabel,
22
24
  ref: ref,
23
25
  testId: testId,
24
26
  xcss: styles.root,
@@ -1,4 +1,4 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
@@ -1,9 +1,10 @@
1
- /* index.tsx generated by @compiled/babel-plugin v0.36.1 */
1
+ /* index.tsx generated by @compiled/babel-plugin v0.38.1 */
2
2
  import "./index.compiled.css";
3
3
  import * as React from 'react';
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import { forwardRef } from 'react';
6
6
  import { Flex, Text } from '@atlaskit/primitives/compiled';
7
+ import VisuallyHidden from '@atlaskit/visually-hidden';
7
8
  var styles = {
8
9
  root: "_1ul91ris"
9
10
  };
@@ -21,5 +22,5 @@ export var SpotlightStepCount = /*#__PURE__*/forwardRef(function (_ref, ref) {
21
22
  }, /*#__PURE__*/React.createElement(Text, {
22
23
  ref: ref,
23
24
  testId: testId
24
- }, children));
25
+ }, children, ' ', /*#__PURE__*/React.createElement(VisuallyHidden, null, "steps")));
25
26
  });
@@ -7,6 +7,10 @@ import type { Placement } from '../types';
7
7
  interface SpotlightContextType {
8
8
  placement: Placement;
9
9
  setPlacement: Dispatch<SetStateAction<Placement>>;
10
+ heading: {
11
+ id: string;
12
+ setId: Dispatch<SetStateAction<string>>;
13
+ };
10
14
  }
11
15
  export declare const SpotlightContext: import("react").Context<SpotlightContextType>;
12
16
  export declare const SpotlightContextProvider: ({ children }: {
@@ -5,6 +5,12 @@
5
5
  import { type ReactNode } from 'react';
6
6
  import type { Placement } from '../../types';
7
7
  interface PopoverContentProps {
8
+ /**
9
+ * A `testId` prop is provided for specified elements, which is a unique
10
+ * string that appears as a data attribute `data-testid` in the rendered code,
11
+ * serving as a hook for automated tests
12
+ */
13
+ testId?: string;
8
14
  placement: Placement;
9
15
  isVisible?: boolean;
10
16
  children: ReactNode;
@@ -14,5 +20,5 @@ interface PopoverContentProps {
14
20
  *
15
21
  * A `PopoverContent` is the element that is shown as a popover.
16
22
  */
17
- export declare const PopoverContent: ({ children, placement, isVisible }: PopoverContentProps) => JSX.Element;
23
+ export declare const PopoverContent: ({ children, placement, isVisible, testId }: PopoverContentProps) => JSX.Element;
18
24
  export {};
@@ -19,6 +19,10 @@ export interface SpotlightPrimaryActionProps {
19
19
  * The action to take when the button is clicked.
20
20
  */
21
21
  onClick?: PressableProps['onClick'];
22
+ /**
23
+ * An accessible label to read out in the event that the displayed text does not provide anough context.
24
+ */
25
+ 'aria-label'?: string;
22
26
  }
23
27
  /**
24
28
  * __Spotlight primary action__
@@ -19,6 +19,10 @@ export interface SpotlightSecondaryActionProps {
19
19
  * The action to take when the button is clicked.
20
20
  */
21
21
  onClick?: PressableProps['onClick'];
22
+ /**
23
+ * An accessible label to read out in the event that the displayed text does not provide anough context.
24
+ */
25
+ 'aria-label'?: string;
22
26
  }
23
27
  /**
24
28
  * __Spotlight secondary action__
@@ -7,6 +7,10 @@ import type { Placement } from '../types';
7
7
  interface SpotlightContextType {
8
8
  placement: Placement;
9
9
  setPlacement: Dispatch<SetStateAction<Placement>>;
10
+ heading: {
11
+ id: string;
12
+ setId: Dispatch<SetStateAction<string>>;
13
+ };
10
14
  }
11
15
  export declare const SpotlightContext: import("react").Context<SpotlightContextType>;
12
16
  export declare const SpotlightContextProvider: ({ children }: {
@@ -5,6 +5,12 @@
5
5
  import { type ReactNode } from 'react';
6
6
  import type { Placement } from '../../types';
7
7
  interface PopoverContentProps {
8
+ /**
9
+ * A `testId` prop is provided for specified elements, which is a unique
10
+ * string that appears as a data attribute `data-testid` in the rendered code,
11
+ * serving as a hook for automated tests
12
+ */
13
+ testId?: string;
8
14
  placement: Placement;
9
15
  isVisible?: boolean;
10
16
  children: ReactNode;
@@ -14,5 +20,5 @@ interface PopoverContentProps {
14
20
  *
15
21
  * A `PopoverContent` is the element that is shown as a popover.
16
22
  */
17
- export declare const PopoverContent: ({ children, placement, isVisible }: PopoverContentProps) => JSX.Element;
23
+ export declare const PopoverContent: ({ children, placement, isVisible, testId }: PopoverContentProps) => JSX.Element;
18
24
  export {};
@@ -19,6 +19,10 @@ export interface SpotlightPrimaryActionProps {
19
19
  * The action to take when the button is clicked.
20
20
  */
21
21
  onClick?: PressableProps['onClick'];
22
+ /**
23
+ * An accessible label to read out in the event that the displayed text does not provide anough context.
24
+ */
25
+ 'aria-label'?: string;
22
26
  }
23
27
  /**
24
28
  * __Spotlight primary action__
@@ -19,6 +19,10 @@ export interface SpotlightSecondaryActionProps {
19
19
  * The action to take when the button is clicked.
20
20
  */
21
21
  onClick?: PressableProps['onClick'];
22
+ /**
23
+ * An accessible label to read out in the event that the displayed text does not provide anough context.
24
+ */
25
+ 'aria-label'?: string;
22
26
  }
23
27
  /**
24
28
  * __Spotlight secondary action__
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/spotlight",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "A spotlight introduces users to various points of interest across Atlassian through focused messages or multi-step tours.",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,8 +32,9 @@
32
32
  "@atlaskit/icon": "^28.2.0",
33
33
  "@atlaskit/image": "^3.0.0",
34
34
  "@atlaskit/popper": "^7.1.0",
35
- "@atlaskit/primitives": "^14.14.0",
35
+ "@atlaskit/primitives": "^14.15.0",
36
36
  "@atlaskit/tokens": "^6.3.0",
37
+ "@atlaskit/visually-hidden": "^3.0.0",
37
38
  "@babel/runtime": "^7.0.0",
38
39
  "@compiled/react": "^0.18.3"
39
40
  },