@workday/canvas-kit-react 7.0.7 → 7.1.0-next.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/collection/lib/useOverflowListModel.tsx +11 -2
- package/common/lib/utils/index.ts +1 -0
- package/common/lib/utils/useModalityType.ts +65 -0
- package/dist/commonjs/action-bar/lib/ActionBar.d.ts +1 -0
- package/dist/commonjs/action-bar/lib/ActionBar.d.ts.map +1 -1
- package/dist/commonjs/action-bar/lib/useActionBarModel.d.ts +2 -0
- package/dist/commonjs/action-bar/lib/useActionBarModel.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useOverflowListModel.d.ts +10 -0
- package/dist/commonjs/collection/lib/useOverflowListModel.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/useOverflowListModel.js +10 -4
- package/dist/commonjs/common/lib/utils/index.d.ts +1 -0
- package/dist/commonjs/common/lib/utils/index.d.ts.map +1 -1
- package/dist/commonjs/common/lib/utils/index.js +1 -0
- package/dist/commonjs/common/lib/utils/useModalityType.d.ts +17 -0
- package/dist/commonjs/common/lib/utils/useModalityType.d.ts.map +1 -0
- package/dist/commonjs/common/lib/utils/useModalityType.js +63 -0
- package/dist/commonjs/tabs/lib/Tabs.d.ts +1 -0
- package/dist/commonjs/tabs/lib/Tabs.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsItem.js +4 -3
- package/dist/commonjs/tabs/lib/TabsList.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/TabsList.js +17 -2
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts +55 -159
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/useTabsModel.js +2 -0
- package/dist/es6/action-bar/lib/ActionBar.d.ts +1 -0
- package/dist/es6/action-bar/lib/ActionBar.d.ts.map +1 -1
- package/dist/es6/action-bar/lib/useActionBarModel.d.ts +2 -0
- package/dist/es6/action-bar/lib/useActionBarModel.d.ts.map +1 -1
- package/dist/es6/collection/lib/useOverflowListModel.d.ts +10 -0
- package/dist/es6/collection/lib/useOverflowListModel.d.ts.map +1 -1
- package/dist/es6/collection/lib/useOverflowListModel.js +10 -4
- package/dist/es6/common/lib/utils/index.d.ts +1 -0
- package/dist/es6/common/lib/utils/index.d.ts.map +1 -1
- package/dist/es6/common/lib/utils/index.js +1 -0
- package/dist/es6/common/lib/utils/useModalityType.d.ts +17 -0
- package/dist/es6/common/lib/utils/useModalityType.d.ts.map +1 -0
- package/dist/es6/common/lib/utils/useModalityType.js +56 -0
- package/dist/es6/tabs/lib/Tabs.d.ts +1 -0
- package/dist/es6/tabs/lib/Tabs.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsItem.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsItem.js +5 -4
- package/dist/es6/tabs/lib/TabsList.d.ts.map +1 -1
- package/dist/es6/tabs/lib/TabsList.js +18 -3
- package/dist/es6/tabs/lib/useTabsModel.d.ts +55 -159
- package/dist/es6/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/es6/tabs/lib/useTabsModel.js +3 -1
- package/package.json +5 -5
- package/tabs/lib/TabsItem.tsx +4 -3
- package/tabs/lib/TabsList.tsx +23 -4
- package/tabs/lib/useTabsModel.tsx +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useActionBarModel.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/useActionBarModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,eAAO,MAAM,iBAAiB;IAG1B;;;OAGG;;IAEH;;;;OAIG
|
|
1
|
+
{"version":3,"file":"useActionBarModel.d.ts","sourceRoot":"","sources":["../../../../action-bar/lib/useActionBarModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,eAAO,MAAM,iBAAiB;IAG1B;;;O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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IATH;;;OAGG;;IAEH;;;;OAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwEL,CAAC"}
|
|
@@ -3,6 +3,11 @@ export declare function getHiddenIds(containerWidth: number, overflowTargetWidth
|
|
|
3
3
|
export declare const useOverflowListModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
4
4
|
initialHiddenIds: string[];
|
|
5
5
|
containerWidth: number;
|
|
6
|
+
/**
|
|
7
|
+
* Determines if overflow should actually occur. For example, touch devices are better at
|
|
8
|
+
* side-scrolling than mouse devices. In these cases, it makes sense to disable overflowing.
|
|
9
|
+
* @default true
|
|
10
|
+
*/ shouldCalculateOverflow: boolean;
|
|
6
11
|
initialSelectedIds: import("./useSelectionListModel").SelectedIds;
|
|
7
12
|
initialUnselectedIds: string[];
|
|
8
13
|
selection: import("./useSelectionListModel").SelectionManager;
|
|
@@ -1298,6 +1303,11 @@ export declare const useOverflowListModel: (<TT_Special_Generic>(config?: (Parti
|
|
|
1298
1303
|
}) & import("../../common").ModelExtras<{
|
|
1299
1304
|
initialHiddenIds: string[];
|
|
1300
1305
|
containerWidth: number;
|
|
1306
|
+
/**
|
|
1307
|
+
* Determines if overflow should actually occur. For example, touch devices are better at
|
|
1308
|
+
* side-scrolling than mouse devices. In these cases, it makes sense to disable overflowing.
|
|
1309
|
+
* @default true
|
|
1310
|
+
*/ shouldCalculateOverflow: boolean;
|
|
1301
1311
|
initialSelectedIds: import("./useSelectionListModel").SelectedIds;
|
|
1302
1312
|
initialUnselectedIds: string[];
|
|
1303
1313
|
selection: import("./useSelectionListModel").SelectionManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOverflowListModel.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useOverflowListModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,wBAAgB,YAAY,CAC1B,cAAc,EAAE,MAAM,EACtB,mBAAmB,EAAE,MAAM,EAC3B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACtC,WAAW,EAAE,MAAM,EAAE,GAAG,KAAK,GAC5B,MAAM,EAAE,CAwCV;AAED,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"useOverflowListModel.d.ts","sourceRoot":"","sources":["../../../../collection/lib/useOverflowListModel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,wBAAgB,YAAY,CAC1B,cAAc,EAAE,MAAM,EACtB,mBAAmB,EAAE,MAAM,EAC3B,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACtC,WAAW,EAAE,MAAM,EAAE,GAAG,KAAK,GAC5B,MAAM,EAAE,CAwCV;AAED,eAAO,MAAM,oBAAoB;;;IAK7B;;;;OAIG;;;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qCAaX;YAAC,KAAK,EAAE,MAAM,CAAA;SAAC;2BAIzB;YAAC,EAAE,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAC;8BAiBxB;YAAC,EAAE,EAAE,MAAM,CAAA;SAAC;2BAiBf;YAAC,EAAE,EAAE,MAAM,CAAA;SAAC;8BAGT;YAAC,EAAE,EAAE,MAAM,CAAA;SAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMpC,CAAC"}
|
|
@@ -51,10 +51,16 @@ export function getHiddenIds(containerWidth, overflowTargetWidth, itemWidthCache
|
|
|
51
51
|
return hiddenIds;
|
|
52
52
|
}
|
|
53
53
|
export var useOverflowListModel = createModelHook({
|
|
54
|
-
defaultConfig: __assign(__assign({}, useSelectionListModel.defaultConfig), { initialHiddenIds: [], containerWidth: 0
|
|
54
|
+
defaultConfig: __assign(__assign({}, useSelectionListModel.defaultConfig), { initialHiddenIds: [], containerWidth: 0,
|
|
55
|
+
/**
|
|
56
|
+
* Determines if overflow should actually occur. For example, touch devices are better at
|
|
57
|
+
* side-scrolling than mouse devices. In these cases, it makes sense to disable overflowing.
|
|
58
|
+
* @default true
|
|
59
|
+
*/ shouldCalculateOverflow: true }),
|
|
55
60
|
requiredConfig: useSelectionListModel.requiredConfig,
|
|
56
61
|
contextOverride: useSelectionListModel.Context,
|
|
57
62
|
})(function (config) {
|
|
63
|
+
var shouldCalculateOverflow = config.shouldCalculateOverflow === undefined ? true : config.shouldCalculateOverflow;
|
|
58
64
|
var _a = React.useState(config.initialHiddenIds), hiddenIds = _a[0], setHiddenIds = _a[1];
|
|
59
65
|
var _b = React.useState({}), itemWidthCache = _b[0], setItemWidthCache = _b[1];
|
|
60
66
|
var _c = React.useState(0), containerWidth = _c[0], setContainerWidth = _c[1];
|
|
@@ -62,12 +68,12 @@ export var useOverflowListModel = createModelHook({
|
|
|
62
68
|
var itemWidthCacheRef = React.useRef(itemWidthCache);
|
|
63
69
|
var _d = React.useState(0), overflowTargetWidth = _d[0], setOverflowTargetWidth = _d[1];
|
|
64
70
|
var overflowTargetWidthRef = React.useRef(0);
|
|
71
|
+
var internalHiddenIds = shouldCalculateOverflow ? hiddenIds : [];
|
|
65
72
|
// Cursors skip over disabled ids, but know nothing of hidden ids. We'll go ahead and disable
|
|
66
73
|
// hidden ids as well
|
|
67
|
-
var nonInteractiveIds = (config.nonInteractiveIds || []).concat(
|
|
74
|
+
var nonInteractiveIds = (config.nonInteractiveIds || []).concat(internalHiddenIds);
|
|
68
75
|
var model = useSelectionListModel(__assign(__assign({}, config), { nonInteractiveIds: nonInteractiveIds }));
|
|
69
|
-
var state = __assign(__assign({}, model.state), { hiddenIds:
|
|
70
|
-
itemWidthCache: itemWidthCache,
|
|
76
|
+
var state = __assign(__assign({}, model.state), { hiddenIds: internalHiddenIds, itemWidthCache: itemWidthCache,
|
|
71
77
|
containerWidth: containerWidth,
|
|
72
78
|
overflowTargetWidth: overflowTargetWidth });
|
|
73
79
|
var events = __assign(__assign({}, model.events), { select: function (data) {
|
|
@@ -12,6 +12,7 @@ export * from './models';
|
|
|
12
12
|
export * from './elements';
|
|
13
13
|
export * from './useConstant';
|
|
14
14
|
export * from './useIsFullscreen';
|
|
15
|
+
export * from './useModalityType';
|
|
15
16
|
export * from './useWindowSize';
|
|
16
17
|
export * from './useResizeObserver';
|
|
17
18
|
export * from './StaticStates';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC"}
|
|
@@ -12,6 +12,7 @@ export * from './models';
|
|
|
12
12
|
export * from './elements';
|
|
13
13
|
export * from './useConstant';
|
|
14
14
|
export * from './useIsFullscreen';
|
|
15
|
+
export * from './useModalityType';
|
|
15
16
|
export * from './useWindowSize';
|
|
16
17
|
export * from './useResizeObserver';
|
|
17
18
|
export * from './StaticStates';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare type Modality = 'mouse' | 'touch' | 'pen';
|
|
2
|
+
/**
|
|
3
|
+
* Uses heuristics to determine if the user is on a touch device, uses a pen, or a mouse. This hook
|
|
4
|
+
* is useful if you have styles or behaviors that depend on the user's interaction type. For
|
|
5
|
+
* example, touch users can scroll horizontally easier than mouse users, so horizontal overflow
|
|
6
|
+
* might be more desired than overflow menus on touch devices. For devices that support multiple
|
|
7
|
+
* input types, the last used input type is saved. For these devices, consider the possibility this
|
|
8
|
+
* value could change after your component is rendered, so make sure you component rerenders
|
|
9
|
+
* properly in this case.
|
|
10
|
+
*
|
|
11
|
+
* Uses `PointerEvent.pointerType` to determine last used input.
|
|
12
|
+
*
|
|
13
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType
|
|
14
|
+
*/
|
|
15
|
+
export declare const useModalityType: () => Modality;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=useModalityType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useModalityType.d.ts","sourceRoot":"","sources":["../../../../../common/lib/utils/useModalityType.ts"],"names":[],"mappings":"AAEA,aAAK,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,CAAC;AA+B1C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,QAAO,QAkBlC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
// Use this shared global value to reduce calls to localStorage which is a synchronous API to a
|
|
3
|
+
// drive which could be slow (spinning disks could be hundreds of ms). We read only once this way.
|
|
4
|
+
// The following initialization is very difficult to test via automation. Don't mess with it unless
|
|
5
|
+
// you plan to manually test.
|
|
6
|
+
//
|
|
7
|
+
// 1. Initialize modality to localStorage
|
|
8
|
+
// a. if localStorage isn't primed, use clientWidth of the browsers
|
|
9
|
+
// b. if < 768, default to 'touch'
|
|
10
|
+
// c. else default to 'mouse'
|
|
11
|
+
var localStorageValue = 'mouse'; //((typeof localStorage !== 'undefined'
|
|
12
|
+
// ? localStorage.getItem('modality')
|
|
13
|
+
// : '') ||
|
|
14
|
+
// (typeof document !== 'undefined'
|
|
15
|
+
// ? document.documentElement.clientWidth < 768
|
|
16
|
+
// ? 'touch'
|
|
17
|
+
// : ''
|
|
18
|
+
// : '') ||
|
|
19
|
+
// 'mouse') as Modality;
|
|
20
|
+
// Update the `localStorageValue`, but conditionally update localStorage only if the value has
|
|
21
|
+
// changed. This prevents too many calls to `localStorage` which can be costly on spinning disk
|
|
22
|
+
// drives
|
|
23
|
+
var updateLocalStorage = function (value) {
|
|
24
|
+
// if (localStorageValue !== value) {
|
|
25
|
+
// localStorage.setItem('modality', value);
|
|
26
|
+
// }
|
|
27
|
+
// localStorageValue = value;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Uses heuristics to determine if the user is on a touch device, uses a pen, or a mouse. This hook
|
|
31
|
+
* is useful if you have styles or behaviors that depend on the user's interaction type. For
|
|
32
|
+
* example, touch users can scroll horizontally easier than mouse users, so horizontal overflow
|
|
33
|
+
* might be more desired than overflow menus on touch devices. For devices that support multiple
|
|
34
|
+
* input types, the last used input type is saved. For these devices, consider the possibility this
|
|
35
|
+
* value could change after your component is rendered, so make sure you component rerenders
|
|
36
|
+
* properly in this case.
|
|
37
|
+
*
|
|
38
|
+
* Uses `PointerEvent.pointerType` to determine last used input.
|
|
39
|
+
*
|
|
40
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType
|
|
41
|
+
*/
|
|
42
|
+
export var useModalityType = function () {
|
|
43
|
+
var _a = React.useState(localStorageValue), modality = _a[0], setModality = _a[1];
|
|
44
|
+
React.useEffect(function () {
|
|
45
|
+
var handlePointerDown = function (event) {
|
|
46
|
+
var value = event.pointerType;
|
|
47
|
+
setModality(value);
|
|
48
|
+
updateLocalStorage(value);
|
|
49
|
+
};
|
|
50
|
+
document.addEventListener('pointerdown', handlePointerDown);
|
|
51
|
+
return function () {
|
|
52
|
+
document.removeEventListener('pointerdown', handlePointerDown);
|
|
53
|
+
};
|
|
54
|
+
}, []);
|
|
55
|
+
return modality;
|
|
56
|
+
};
|
|
@@ -31,6 +31,7 @@ export declare const Tabs: import("../../common").ComponentM<TabsProps & Partial
|
|
|
31
31
|
}>;
|
|
32
32
|
initialHiddenIds: string[];
|
|
33
33
|
containerWidth: number;
|
|
34
|
+
shouldCalculateOverflow: boolean;
|
|
34
35
|
initialSelectedIds: import("../../collection/lib/useSelectionListModel").SelectedIds;
|
|
35
36
|
initialUnselectedIds: string[];
|
|
36
37
|
selection: import("../../collection/lib/useSelectionListModel").SelectionManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabsItem.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/TabsItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAIL,UAAU,EAGV,YAAY,
|
|
1
|
+
{"version":3,"file":"TabsItem.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/TabsItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAIL,UAAU,EAGV,YAAY,EAKb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,GAAG,EAAE,UAAU,EAAC,MAAM,kCAAkC,CAAC;AAYjE,MAAM,WAAW,aACf,SAAQ,YAAY,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC,EACrC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IACtC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;;;OAaG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,aAAa;;;;wDAwFzB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoBvB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiBnB,CAAC"}
|
|
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import * as React from 'react';
|
|
24
24
|
import { colors, space, type, borderRadius, iconColors } from '@workday/canvas-kit-react/tokens';
|
|
25
|
-
import { focusRing, hideMouseFocus, styled, createElemPropsHook, composeHooks, ellipsisStyles, EllipsisText, createSubcomponent, } from '@workday/canvas-kit-react/common';
|
|
25
|
+
import { focusRing, hideMouseFocus, styled, createElemPropsHook, composeHooks, ellipsisStyles, EllipsisText, createSubcomponent, useModalityType, } from '@workday/canvas-kit-react/common';
|
|
26
26
|
import { Box } from '@workday/canvas-kit-react/layout';
|
|
27
27
|
import { OverflowTooltip } from '@workday/canvas-kit-react/tooltip';
|
|
28
28
|
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
@@ -32,7 +32,7 @@ export var StyledTabItem = styled(Box.as('button'))(function (_a) {
|
|
|
32
32
|
var theme = _a.theme, spacing = _a.spacing;
|
|
33
33
|
return (__assign(__assign(__assign(__assign({}, type.levels.subtext.large), { '& > *:not(style) ~ *:not(style)': {
|
|
34
34
|
marginLeft: spacing || space.xxs,
|
|
35
|
-
}, fontWeight: type.properties.fontWeights.medium, border: 'none', backgroundColor: 'transparent', flex: '0 0 auto', alignItems: 'center',
|
|
35
|
+
}, fontWeight: type.properties.fontWeights.medium, border: 'none', backgroundColor: 'transparent', flex: '0 0 auto', alignItems: 'center', padding: space.xs + " " + space.s, height: 52, boxSizing: 'border-box', cursor: 'pointer', color: colors.licorice300, position: 'relative', borderRadius: borderRadius.m + " " + borderRadius.m + " 0px 0px", transition: 'background 150ms ease, color 150ms ease' }), hideMouseFocus), { '.wd-icon-background ~ .wd-icon-accent, .wd-icon-background ~ .wd-icon-accent2': {
|
|
36
36
|
fill: iconColors.active,
|
|
37
37
|
}, '&:hover, &:focus': {
|
|
38
38
|
backgroundColor: colors.soap200,
|
|
@@ -109,8 +109,9 @@ export var TabsItem = createSubcomponent('button')({
|
|
|
109
109
|
Icon: SystemIcon,
|
|
110
110
|
Text: EllipsisText,
|
|
111
111
|
},
|
|
112
|
-
})(function (_a, Element
|
|
112
|
+
})(function (_a, Element) {
|
|
113
113
|
var children = _a.children, elemProps = __rest(_a, ["children"]);
|
|
114
|
+
var modality = useModalityType();
|
|
114
115
|
return (React.createElement(OverflowTooltip, null,
|
|
115
|
-
React.createElement(StyledTabItem, __assign({ as: Element }, elemProps), children)));
|
|
116
|
+
React.createElement(StyledTabItem, __assign({ as: Element, maxWidth: modality === 'touch' ? undefined : 280 }, elemProps), children)));
|
|
116
117
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabsList.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/TabsList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAIL,YAAY,
|
|
1
|
+
{"version":3,"file":"TabsList.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/TabsList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAIL,YAAY,EAIb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,KAAK,EAAC,MAAM,kCAAkC,CAAC;AAUvD,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO,CAAE,SAAQ,OAAO,CAAC,YAAY,CAAC,OAAO,KAAK,EAAE,KAAK,CAAC,CAAC;IAC3F;;;;;;;;OAQG;IACH,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IAC3D,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAClC;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAOvB,CAAC;AAgBF,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBnB,CAAC"}
|
|
@@ -22,20 +22,35 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import * as React from 'react';
|
|
24
24
|
import { commonColors } from '@workday/canvas-kit-react/tokens';
|
|
25
|
-
import { composeHooks, createSubcomponent, createElemPropsHook, } from '@workday/canvas-kit-react/common';
|
|
25
|
+
import { composeHooks, createSubcomponent, createElemPropsHook, useModalityType, styled, } from '@workday/canvas-kit-react/common';
|
|
26
26
|
import { Stack } from '@workday/canvas-kit-react/layout';
|
|
27
27
|
import { useOverflowListMeasure, useListRenderItems, useListResetCursorOnBlur, } from '@workday/canvas-kit-react/collection';
|
|
28
28
|
import { useTabsModel } from './useTabsModel';
|
|
29
29
|
export var useTabsList = composeHooks(createElemPropsHook(useTabsModel)(function () {
|
|
30
|
-
|
|
30
|
+
var modality = useModalityType();
|
|
31
|
+
return { role: 'tablist', overflowX: modality === 'touch' ? 'auto' : undefined };
|
|
31
32
|
}), useOverflowListMeasure, useListResetCursorOnBlur);
|
|
33
|
+
var StyledStack = styled(Stack)({
|
|
34
|
+
'::after': {
|
|
35
|
+
content: '""',
|
|
36
|
+
position: 'sticky',
|
|
37
|
+
height: 52,
|
|
38
|
+
minWidth: 30,
|
|
39
|
+
background: "linear-gradient(to right,rgba(255,255,255,0),white);",
|
|
40
|
+
zIndex: 1,
|
|
41
|
+
right: 0,
|
|
42
|
+
top: 0,
|
|
43
|
+
pointerEvents: 'none',
|
|
44
|
+
},
|
|
45
|
+
});
|
|
32
46
|
export var TabsList = createSubcomponent('div')({
|
|
33
47
|
displayName: 'Tabs.List',
|
|
34
48
|
modelHook: useTabsModel,
|
|
35
49
|
elemPropsHook: useTabsList,
|
|
36
50
|
})(function (_a, Element, model) {
|
|
37
51
|
var children = _a.children, overflowButton = _a.overflowButton, elemProps = __rest(_a, ["children", "overflowButton"]);
|
|
38
|
-
|
|
52
|
+
var modality = useModalityType();
|
|
53
|
+
return (React.createElement(StyledStack, __assign({ as: Element, position: "relative", borderBottom: "1px solid " + commonColors.divider, paddingX: modality === 'touch' ? 'zero' : 'm', spacing: "xxxs" }, elemProps),
|
|
39
54
|
useListRenderItems(model, children),
|
|
40
55
|
overflowButton));
|
|
41
56
|
});
|