@workday/canvas-kit-react 10.3.48 → 10.3.49
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/ListBox.tsx +39 -18
- package/dist/commonjs/collection/lib/ListBox.d.ts +19 -1
- package/dist/commonjs/collection/lib/ListBox.d.ts.map +1 -1
- package/dist/commonjs/collection/lib/ListBox.js +2 -2
- package/dist/es6/collection/lib/ListBox.d.ts +19 -1
- package/dist/es6/collection/lib/ListBox.d.ts.map +1 -1
- package/dist/es6/collection/lib/ListBox.js +2 -2
- package/package.json +4 -4
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
createSubcomponent,
|
|
6
6
|
ExtractProps,
|
|
7
7
|
} from '@workday/canvas-kit-react/common';
|
|
8
|
-
import {Box, Flex} from '@workday/canvas-kit-react/layout';
|
|
8
|
+
import {Box, Flex, FlexProps} from '@workday/canvas-kit-react/layout';
|
|
9
9
|
|
|
10
10
|
import {useListModel} from './useListModel';
|
|
11
11
|
import {useListRenderItems} from './useListRenderItem';
|
|
@@ -13,6 +13,24 @@ import {useListItemRegister} from './useListItemRegister';
|
|
|
13
13
|
|
|
14
14
|
export interface ListBoxProps<T = any> extends Omit<ExtractProps<typeof Flex, never>, 'children'> {
|
|
15
15
|
children?: React.ReactNode | ((item: T, index: number) => React.ReactNode);
|
|
16
|
+
/**
|
|
17
|
+
* Set the margin top of the list box. You must use this prop and not style any other way. The
|
|
18
|
+
* `Menu` uses virtualization and needs margins to be set on the correct element. This ensure
|
|
19
|
+
* proper rendering. If a `marginTop` is not provided, the value falls back to `marginY`.
|
|
20
|
+
*/
|
|
21
|
+
marginTop?: FlexProps['marginTop'];
|
|
22
|
+
/**
|
|
23
|
+
* Set the margin bottom of the list box. You must use this prop and not style any other way. The
|
|
24
|
+
* `Menu` uses virtualization and needs margins to be set on the correct element. This ensure
|
|
25
|
+
* proper rendering. If a `marginBottom` is not provided, the value falls back to `marginY`.
|
|
26
|
+
*/
|
|
27
|
+
marginBottom?: FlexProps['marginBottom'];
|
|
28
|
+
/**
|
|
29
|
+
* Set the margin top and bottom of the list box. You must use this prop and not style any other way. The
|
|
30
|
+
* `Menu` uses virtualization and needs margins to be set on the correct element. This ensure
|
|
31
|
+
* proper rendering.
|
|
32
|
+
*/
|
|
33
|
+
marginY?: FlexProps['marginY'];
|
|
16
34
|
}
|
|
17
35
|
|
|
18
36
|
export const ListBoxItem = createSubcomponent('li')({
|
|
@@ -65,21 +83,24 @@ export const ListBox = createContainer('ul')({
|
|
|
65
83
|
*/
|
|
66
84
|
Item: ListBoxItem,
|
|
67
85
|
},
|
|
68
|
-
})<ListBoxProps>(
|
|
69
|
-
|
|
70
|
-
|
|
86
|
+
})<ListBoxProps>(
|
|
87
|
+
({height, maxHeight, marginTop, marginBottom, marginY, ...elemProps}, Element, model) => {
|
|
88
|
+
// We're moving `marginY` to the container to not interfere with the virtualization size. We set
|
|
89
|
+
// the `marginY` on the Flex to `0` to avoid inaccurate scrollbars
|
|
71
90
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
{
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
91
|
+
// TODO figure out what style props should go to which `Box`
|
|
92
|
+
return (
|
|
93
|
+
<Box
|
|
94
|
+
ref={model.state.containerRef}
|
|
95
|
+
marginTop={marginTop ?? marginY}
|
|
96
|
+
marginBottom={marginBottom ?? marginY}
|
|
97
|
+
maxHeight={maxHeight}
|
|
98
|
+
overflowY={model.state.orientation === 'vertical' ? 'auto' : undefined}
|
|
99
|
+
>
|
|
100
|
+
<Flex as={Element} flexDirection="column" {...elemProps} marginY={0}>
|
|
101
|
+
{useListRenderItems(model, elemProps.children)}
|
|
102
|
+
</Flex>
|
|
103
|
+
</Box>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
);
|
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
-
import { Flex } from '@workday/canvas-kit-react/layout';
|
|
3
|
+
import { Flex, FlexProps } from '@workday/canvas-kit-react/layout';
|
|
4
4
|
export interface ListBoxProps<T = any> extends Omit<ExtractProps<typeof Flex, never>, 'children'> {
|
|
5
5
|
children?: React.ReactNode | ((item: T, index: number) => React.ReactNode);
|
|
6
|
+
/**
|
|
7
|
+
* Set the margin top of the list box. You must use this prop and not style any other way. The
|
|
8
|
+
* `Menu` uses virtualization and needs margins to be set on the correct element. This ensure
|
|
9
|
+
* proper rendering. If a `marginTop` is not provided, the value falls back to `marginY`.
|
|
10
|
+
*/
|
|
11
|
+
marginTop?: FlexProps['marginTop'];
|
|
12
|
+
/**
|
|
13
|
+
* Set the margin bottom of the list box. You must use this prop and not style any other way. The
|
|
14
|
+
* `Menu` uses virtualization and needs margins to be set on the correct element. This ensure
|
|
15
|
+
* proper rendering. If a `marginBottom` is not provided, the value falls back to `marginY`.
|
|
16
|
+
*/
|
|
17
|
+
marginBottom?: FlexProps['marginBottom'];
|
|
18
|
+
/**
|
|
19
|
+
* Set the margin top and bottom of the list box. You must use this prop and not style any other way. The
|
|
20
|
+
* `Menu` uses virtualization and needs margins to be set on the correct element. This ensure
|
|
21
|
+
* proper rendering.
|
|
22
|
+
*/
|
|
23
|
+
marginY?: FlexProps['marginY'];
|
|
6
24
|
}
|
|
7
25
|
export declare const ListBoxItem: import("@workday/canvas-kit-react/common").ElementComponentM<"li", Omit<import("@workday/canvas-kit-react/layout").BoxProps, "display"> & import("@workday/canvas-kit-react/layout").FlexStyleProps, {
|
|
8
26
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListBox.d.ts","sourceRoot":"","sources":["../../../../collection/lib/ListBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B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
|
61
|
-
})(({ height, maxHeight, marginY, ...elemProps }, Element, model) => {
|
|
61
|
+
})(({ height, maxHeight, marginTop, marginBottom, marginY, ...elemProps }, Element, model) => {
|
|
62
62
|
// We're moving `marginY` to the container to not interfere with the virtualization size. We set
|
|
63
63
|
// the `marginY` on the Flex to `0` to avoid inaccurate scrollbars
|
|
64
64
|
// TODO figure out what style props should go to which `Box`
|
|
65
|
-
return (react_1.default.createElement(layout_1.Box, { ref: model.state.containerRef, marginY: marginY, maxHeight: maxHeight, overflowY: model.state.orientation === 'vertical' ? 'auto' : undefined },
|
|
65
|
+
return (react_1.default.createElement(layout_1.Box, { ref: model.state.containerRef, marginTop: marginTop !== null && marginTop !== void 0 ? marginTop : marginY, marginBottom: marginBottom !== null && marginBottom !== void 0 ? marginBottom : marginY, maxHeight: maxHeight, overflowY: model.state.orientation === 'vertical' ? 'auto' : undefined },
|
|
66
66
|
react_1.default.createElement(layout_1.Flex, Object.assign({ as: Element, flexDirection: "column" }, elemProps, { marginY: 0 }), useListRenderItem_1.useListRenderItems(model, elemProps.children))));
|
|
67
67
|
});
|
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ExtractProps } from '@workday/canvas-kit-react/common';
|
|
3
|
-
import { Flex } from '@workday/canvas-kit-react/layout';
|
|
3
|
+
import { Flex, FlexProps } from '@workday/canvas-kit-react/layout';
|
|
4
4
|
export interface ListBoxProps<T = any> extends Omit<ExtractProps<typeof Flex, never>, 'children'> {
|
|
5
5
|
children?: React.ReactNode | ((item: T, index: number) => React.ReactNode);
|
|
6
|
+
/**
|
|
7
|
+
* Set the margin top of the list box. You must use this prop and not style any other way. The
|
|
8
|
+
* `Menu` uses virtualization and needs margins to be set on the correct element. This ensure
|
|
9
|
+
* proper rendering. If a `marginTop` is not provided, the value falls back to `marginY`.
|
|
10
|
+
*/
|
|
11
|
+
marginTop?: FlexProps['marginTop'];
|
|
12
|
+
/**
|
|
13
|
+
* Set the margin bottom of the list box. You must use this prop and not style any other way. The
|
|
14
|
+
* `Menu` uses virtualization and needs margins to be set on the correct element. This ensure
|
|
15
|
+
* proper rendering. If a `marginBottom` is not provided, the value falls back to `marginY`.
|
|
16
|
+
*/
|
|
17
|
+
marginBottom?: FlexProps['marginBottom'];
|
|
18
|
+
/**
|
|
19
|
+
* Set the margin top and bottom of the list box. You must use this prop and not style any other way. The
|
|
20
|
+
* `Menu` uses virtualization and needs margins to be set on the correct element. This ensure
|
|
21
|
+
* proper rendering.
|
|
22
|
+
*/
|
|
23
|
+
marginY?: FlexProps['marginY'];
|
|
6
24
|
}
|
|
7
25
|
export declare const ListBoxItem: import("@workday/canvas-kit-react/common").ElementComponentM<"li", Omit<import("@workday/canvas-kit-react/layout").BoxProps, "display"> & import("@workday/canvas-kit-react/layout").FlexStyleProps, {
|
|
8
26
|
state: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListBox.d.ts","sourceRoot":"","sources":["../../../../collection/lib/ListBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIL,YAAY,EACb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAM,IAAI,EAAC,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"ListBox.d.ts","sourceRoot":"","sources":["../../../../collection/lib/ListBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIL,YAAY,EACb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAM,IAAI,EAAE,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAMtE,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,GAAG,CAAE,SAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,IAAI,EAAE,KAAK,CAAC,EAAE,UAAU,CAAC;IAC/F,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAKhB;;;;;;;;OAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuBN,CAAC"}
|
|
@@ -52,10 +52,10 @@ export const ListBox = createContainer('ul')({
|
|
|
52
52
|
*/
|
|
53
53
|
Item: ListBoxItem,
|
|
54
54
|
},
|
|
55
|
-
})(({ height, maxHeight, marginY, ...elemProps }, Element, model) => {
|
|
55
|
+
})(({ height, maxHeight, marginTop, marginBottom, marginY, ...elemProps }, Element, model) => {
|
|
56
56
|
// We're moving `marginY` to the container to not interfere with the virtualization size. We set
|
|
57
57
|
// the `marginY` on the Flex to `0` to avoid inaccurate scrollbars
|
|
58
58
|
// TODO figure out what style props should go to which `Box`
|
|
59
|
-
return (React.createElement(Box, { ref: model.state.containerRef, marginY: marginY, maxHeight: maxHeight, overflowY: model.state.orientation === 'vertical' ? 'auto' : undefined },
|
|
59
|
+
return (React.createElement(Box, { ref: model.state.containerRef, marginTop: marginTop !== null && marginTop !== void 0 ? marginTop : marginY, marginBottom: marginBottom !== null && marginBottom !== void 0 ? marginBottom : marginY, maxHeight: maxHeight, overflowY: model.state.orientation === 'vertical' ? 'auto' : undefined },
|
|
60
60
|
React.createElement(Flex, Object.assign({ as: Element, flexDirection: "column" }, elemProps, { marginY: 0 }), useListRenderItems(model, elemProps.children))));
|
|
61
61
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-react",
|
|
3
|
-
"version": "10.3.
|
|
3
|
+
"version": "10.3.49",
|
|
4
4
|
"description": "The parent module that contains all Workday Canvas Kit React components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"@emotion/styled": "^11.6.0",
|
|
50
50
|
"@popperjs/core": "^2.5.4",
|
|
51
51
|
"@workday/canvas-colors-web": "^2.0.0",
|
|
52
|
-
"@workday/canvas-kit-popup-stack": "^10.3.
|
|
53
|
-
"@workday/canvas-kit-styling": "^10.3.
|
|
52
|
+
"@workday/canvas-kit-popup-stack": "^10.3.49",
|
|
53
|
+
"@workday/canvas-kit-styling": "^10.3.49",
|
|
54
54
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
55
55
|
"@workday/canvas-tokens-web": "^1.0.0",
|
|
56
56
|
"@workday/design-assets-types": "^0.2.8",
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"@workday/canvas-accent-icons-web": "^3.0.0",
|
|
69
69
|
"@workday/canvas-applet-icons-web": "^2.0.0"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "ffada361c9cc009488b6860940c7415dfbacba94"
|
|
72
72
|
}
|