@workday/canvas-kit-react 7.1.4 → 7.2.0-next.2

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 (30) hide show
  1. package/collection/index.ts +2 -0
  2. package/collection/lib/useBaseListModel.tsx +1 -1
  3. package/collection/lib/useCursorListModel.tsx +88 -20
  4. package/collection/lib/useGridModel.ts +34 -0
  5. package/collection/lib/useListItemRovingFocus.tsx +6 -4
  6. package/dist/commonjs/collection/index.d.ts +2 -0
  7. package/dist/commonjs/collection/index.d.ts.map +1 -1
  8. package/dist/commonjs/collection/index.js +5 -1
  9. package/dist/commonjs/collection/lib/useBaseListModel.js +1 -1
  10. package/dist/commonjs/collection/lib/useCursorListModel.d.ts +64 -101
  11. package/dist/commonjs/collection/lib/useCursorListModel.d.ts.map +1 -1
  12. package/dist/commonjs/collection/lib/useCursorListModel.js +64 -23
  13. package/dist/commonjs/collection/lib/useGridModel.d.ts +955 -0
  14. package/dist/commonjs/collection/lib/useGridModel.d.ts.map +1 -0
  15. package/dist/commonjs/collection/lib/useGridModel.js +52 -0
  16. package/dist/commonjs/collection/lib/useListItemRovingFocus.d.ts.map +1 -1
  17. package/dist/commonjs/collection/lib/useListItemRovingFocus.js +6 -4
  18. package/dist/es6/collection/index.d.ts +2 -0
  19. package/dist/es6/collection/index.d.ts.map +1 -1
  20. package/dist/es6/collection/index.js +2 -0
  21. package/dist/es6/collection/lib/useBaseListModel.js +1 -1
  22. package/dist/es6/collection/lib/useCursorListModel.d.ts +64 -101
  23. package/dist/es6/collection/lib/useCursorListModel.d.ts.map +1 -1
  24. package/dist/es6/collection/lib/useCursorListModel.js +64 -23
  25. package/dist/es6/collection/lib/useGridModel.d.ts +955 -0
  26. package/dist/es6/collection/lib/useGridModel.d.ts.map +1 -0
  27. package/dist/es6/collection/lib/useGridModel.js +49 -0
  28. package/dist/es6/collection/lib/useListItemRovingFocus.d.ts.map +1 -1
  29. package/dist/es6/collection/lib/useListItemR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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASL,CAAC"}
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.useGridModel = void 0;
26
+ var common_1 = require("@workday/canvas-kit-react/common");
27
+ var useCursorListModel_1 = require("./useCursorListModel");
28
+ var useListModel_1 = require("./useListModel");
29
+ var _a = useListModel_1.useListModel.defaultConfig, columnCount = _a.columnCount, orientation = _a.orientation, defaultConfig = __rest(_a, ["columnCount", "orientation"]);
30
+ exports.useGridModel = common_1.createModelHook({
31
+ defaultConfig: __assign(__assign({}, defaultConfig), {
32
+ /**
33
+ * Controls the state changes when the user sends navigation events to the model. For example,
34
+ * when the user hits the "right" arrow, a behavior hook will determine directionality
35
+ * (left-to-right or right-to-left) and call the correct navigation method. In our example, a
36
+ * left-to-right language would send a `getNext`. The navigation manager may return the next
37
+ * item in the list. Different managers can be created for slightly different use cases. The
38
+ * default navigation manager will stop when the end of a row/column is detected. For example,
39
+ * `getNext` will return the same item the cursor was previously on if the cursor is on the last
40
+ * item of a row.
41
+ */
42
+ navigation: useCursorListModel_1.navigationManager }),
43
+ requiredConfig: __assign({
44
+ /**
45
+ * The number of columns represented in a grid
46
+ */
47
+ columnCount: 1 }, useListModel_1.useListModel.requiredConfig),
48
+ contextOverride: useListModel_1.useListModel.Context,
49
+ })(function (config) {
50
+ var list = useListModel_1.useListModel(config);
51
+ return list;
52
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"useListItemRovingFocus.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListItemRovingFocus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;CAqBpB,CAAC;AA+BX;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAqCZ,mBAAmB;;;;;;;;;OA6CzC,CAAC"}
1
+ {"version":3,"file":"useListItemRovingFocus.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useListItemRovingFocus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;CAqBpB,CAAC;AA+BX;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAqCZ,mBAAmB;;;;;;;;;OA+CzC,CAAC"}
@@ -100,10 +100,12 @@ exports.useListItemRovingFocus = common_1.createElemPropsHook(useCursorListModel
100
100
  if (event.ctrlKey) {
101
101
  for (var key in ctrlKeyMap) {
102
102
  if (hasOwnKey(ctrlKeyMap, key)) {
103
- keyDownRef.current = true;
104
- (_a = events[ctrlKeyMap[key]]) === null || _a === void 0 ? void 0 : _a.call(events);
105
- event.preventDefault();
106
- return;
103
+ if (event.key === key) {
104
+ keyDownRef.current = true;
105
+ (_a = events[ctrlKeyMap[key]]) === null || _a === void 0 ? void 0 : _a.call(events);
106
+ event.preventDefault();
107
+ return;
108
+ }
107
109
  }
108
110
  }
109
111
  }
@@ -9,6 +9,8 @@ export * from './lib/useListResetCursorOnBlur';
9
9
  export * from './lib/useListItemRovingFocus';
10
10
  export * from './lib/useListItemSelect';
11
11
  export * from './lib/useListModel';
12
+ export * from './lib/useGridModel';
12
13
  export { ListBox } from './lib/ListBox';
13
14
  export { singleSelectionManager, multiSelectionManager, isSelected, } from './lib/useSelectionListModel';
15
+ export { wrappingNavigationManager, navigationManager } from './lib/useCursorListModel';
14
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../collection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAC1D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,UAAU,GACX,MAAM,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../collection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,IAAI,EAAC,MAAM,wBAAwB,CAAC;AAC1D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAC,OAAO,EAAC,MAAM,eAAe,CAAC;AACtC,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,UAAU,GACX,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAC,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,0BAA0B,CAAC"}
@@ -9,5 +9,7 @@ export * from './lib/useListResetCursorOnBlur';
9
9
  export * from './lib/useListItemRovingFocus';
10
10
  export * from './lib/useListItemSelect';
11
11
  export * from './lib/useListModel';
12
+ export * from './lib/useGridModel';
12
13
  export { ListBox } from './lib/ListBox';
13
14
  export { singleSelectionManager, multiSelectionManager, isSelected, } from './lib/useSelectionListModel';
15
+ export { wrappingNavigationManager, navigationManager } from './lib/useCursorListModel';
@@ -134,7 +134,7 @@ export var useBaseListModel = createModelHook({
134
134
  return items.concat({
135
135
  id: getId(data.item),
136
136
  value: data.item,
137
- index: items.length - 1,
137
+ index: items.length,
138
138
  textValue: data.textValue,
139
139
  });
140
140
  });