@enact/spotlight 4.5.0-rc.2 → 4.5.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
@@ -2,6 +2,10 @@
2
2
 
3
3
  The following is a curated list of changes in the Enact spotlight module, newest changes on the top.
4
4
 
5
+ ## [4.5.0] - 2022-07-19
6
+
7
+ No significant changes.
8
+
5
9
  ## [4.5.0-rc.2] - 2022-07-06
6
10
 
7
11
  ### Fixed
@@ -14,9 +14,11 @@ holding 5 way keys.
14
14
  */
15
15
  continue5WayHold?: boolean;
16
16
  /**
17
- * The selector for the default spottable element within the container.
18
- */
19
- defaultElement?: string;
17
+ * The selector for the default spottable element within the container.
18
+ When an array of selectors is provided, the first selector that successfully matches a
19
+ node is used.
20
+ */
21
+ defaultElement?: string | string[];
20
22
  /**
21
23
  * Directs which element receives focus when gaining focus from another container. If
22
24
  `'default-element'` , the default focused item will be selected. If `'last-focused'` , the
@@ -32,6 +34,16 @@ element will receive focus. If `null` , the default 5-way behavior will be appl
32
34
  * Whether the container will preserve the specified `spotlightId` when it unmounts.
33
35
  */
34
36
  preserveId?: boolean;
37
+ /**
38
+ * Restricts or prioritizes navigation when focus attempts to leave the container. It
39
+ can be either 'none', 'self-first', or 'self-only'. Specifying 'self-first' indicates that
40
+ elements within the container will have a higher likelihood to be chosen as the next
41
+ navigable element. Specifying 'self-only' indicates that elements in other containers
42
+ cannot be navigated to by using 5-way navigation - however, elements in other containers
43
+ can still receive focus by calling `Spotlight.focus(elem)` explicitly. Specifying 'none'
44
+ indicates there should be no restrictions when 5-way navigating the container.
45
+ */
46
+ restrict?: string;
35
47
  }
36
48
  export interface SpotlightContainerDecoratorProps {
37
49
  /**
@@ -39,14 +51,20 @@ export interface SpotlightContainerDecoratorProps {
39
51
  */
40
52
  spotlightDisabled?: boolean;
41
53
  /**
42
- * Used to identify this component within the Spotlight system.
43
- *
44
- * If the value is `null` , an id will be generated.
45
- */
54
+ * Used to identify this component within the Spotlight system.
55
+ *
56
+ * If the value is `null` , an id will be generated.
57
+ To keep the container information for restoring focus, it is required to specify
58
+ a unique identifier.
59
+ */
46
60
  spotlightId?: string;
47
61
  /**
48
- * Whether or not the container is in muted mode.
49
- */
62
+ * Whether or not the container is in muted mode.
63
+ *
64
+ * In muted mode, `:focus` CSS styles will not be applied to the
65
+ Spottable controls giving them the appearance of not having focus
66
+ while they still have focus.
67
+ */
50
68
  spotlightMuted?: boolean;
51
69
  /**
52
70
  * Restricts or prioritizes navigation when focus attempts to leave the container. It
@@ -106,8 +106,10 @@ var defaultConfig = {
106
106
 
107
107
  /**
108
108
  * The selector for the default spottable element within the container.
109
+ * When an array of selectors is provided, the first selector that successfully matches a
110
+ * node is used.
109
111
  *
110
- * @type {String}
112
+ * @type {String|String[]}
111
113
  * @default '.spottable-default'
112
114
  * @memberof spotlight/SpotlightContainerDecorator.SpotlightContainerDecorator.defaultConfig
113
115
  * @public
@@ -144,7 +146,23 @@ var defaultConfig = {
144
146
  * @memberof spotlight/SpotlightContainerDecorator.SpotlightContainerDecorator.defaultConfig
145
147
  * @public
146
148
  */
147
- preserveId: false
149
+ preserveId: false,
150
+
151
+ /**
152
+ * Restricts or prioritizes navigation when focus attempts to leave the container. It
153
+ * can be either 'none', 'self-first', or 'self-only'. Specifying 'self-first' indicates that
154
+ * elements within the container will have a higher likelihood to be chosen as the next
155
+ * navigable element. Specifying 'self-only' indicates that elements in other containers
156
+ * cannot be navigated to by using 5-way navigation - however, elements in other containers
157
+ * can still receive focus by calling `Spotlight.focus(elem)` explicitly. Specifying 'none'
158
+ * indicates there should be no restrictions when 5-way navigating the container.
159
+ *
160
+ * @type {String}
161
+ * @default 'self-first'
162
+ * @memberof spotlight/SpotlightContainerDecorator.SpotlightContainerDecorator.defaultConfig
163
+ * @public
164
+ */
165
+ restrict: _propTypes["default"].oneOf(['none', 'self-first', 'self-only'])
148
166
  };
149
167
  /**
150
168
  * Constructs a higher-order component that allows Spotlight focus to be passed to its own
@@ -232,6 +250,8 @@ var SpotlightContainerDecorator = (0, _hoc["default"])(defaultConfig, function (
232
250
  * Used to identify this component within the Spotlight system.
233
251
  *
234
252
  * If the value is `null`, an id will be generated.
253
+ * To keep the container information for restoring focus, it is required to specify
254
+ * a unique identifier.
235
255
  *
236
256
  * @type {String}
237
257
  * @public
@@ -241,6 +261,10 @@ var SpotlightContainerDecorator = (0, _hoc["default"])(defaultConfig, function (
241
261
  /**
242
262
  * Whether or not the container is in muted mode.
243
263
  *
264
+ * In muted mode, `:focus` CSS styles will not be applied to the
265
+ * Spottable controls giving them the appearance of not having focus
266
+ * while they still have focus.
267
+ *
244
268
  * @type {Boolean}
245
269
  * @default false
246
270
  * @public
@@ -257,6 +281,7 @@ var SpotlightContainerDecorator = (0, _hoc["default"])(defaultConfig, function (
257
281
  * indicates there should be no restrictions when 5-way navigating the container.
258
282
  *
259
283
  * @type {String}
284
+ * @default 'self-first'
260
285
  * @public
261
286
  */
262
287
  spotlightRestrict: _propTypes["default"].oneOf(['none', 'self-first', 'self-only'])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enact/spotlight",
3
- "version": "4.5.0-rc.2",
3
+ "version": "4.5.0",
4
4
  "description": "A focus management library",
5
5
  "main": "src/spotlight.js",
6
6
  "scripts": {
@@ -18,7 +18,7 @@
18
18
  }
19
19
  },
20
20
  "dependencies": {
21
- "@enact/core": "^4.5.0-rc.2",
21
+ "@enact/core": "^4.5.0",
22
22
  "classnames": "^2.3.1",
23
23
  "prop-types": "^15.8.1",
24
24
  "ramda": "^0.28.0",