@workday/canvas-kit-react 8.6.0-383-next.0 → 8.6.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupCard.d.ts","sourceRoot":"","sources":["../../../../popup/lib/PopupCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAC,IAAI,EAAC,MAAM,gCAAgC,CAAC;AAEpD,OAAO,EAKL,YAAY,EAGb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAO,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAKtE,oBAAY,eAAe,GAAG,YAAY,CAAC,OAAO,IAAI,EAAE,KAAK,CAAC,GAAG,cAAc,CAAC;AAChF,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;
|
|
1
|
+
{"version":3,"file":"PopupCard.d.ts","sourceRoot":"","sources":["../../../../popup/lib/PopupCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAC,IAAI,EAAC,MAAM,gCAAgC,CAAC;AAEpD,OAAO,EAKL,YAAY,EAGb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAO,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAKtE,oBAAY,eAAe,GAAG,YAAY,CAAC,OAAO,IAAI,EAAE,KAAK,CAAC,GAAG,cAAc,CAAC;AAChF,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAuED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;EA6BpB,CAAC"}
|
|
@@ -82,6 +82,33 @@ var StyledPopupCard = common_1.styled(card_1.Card)(function (_a) {
|
|
|
82
82
|
},
|
|
83
83
|
_b;
|
|
84
84
|
});
|
|
85
|
+
function getSpace(value) {
|
|
86
|
+
if (value && value in tokens_1.space) {
|
|
87
|
+
return tokens_1.space[value];
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
return value;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function getMaxHeight(margin) {
|
|
94
|
+
// set the default margin offset to space.xl
|
|
95
|
+
var marginOffset = tokens_1.space.xl;
|
|
96
|
+
if (margin) {
|
|
97
|
+
// parse the margin prop
|
|
98
|
+
if (typeof margin === 'string') {
|
|
99
|
+
var marginValues = margin.split(' ');
|
|
100
|
+
var marginTop = getSpace(marginValues[0]);
|
|
101
|
+
// If provided, use the specific margin-bottom in the shorthand, otherwise use the margin-top value
|
|
102
|
+
var marginBottom = getSpace(marginValues[2]) || marginTop;
|
|
103
|
+
marginOffset = "(" + marginTop + " + " + marginBottom + ")";
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
// if margin is a number, double it to get the offset
|
|
107
|
+
marginOffset = margin * 2 + "px";
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return "calc(100vh - " + marginOffset + ")";
|
|
111
|
+
}
|
|
85
112
|
exports.PopupCard = common_1.createSubcomponent('div')({
|
|
86
113
|
displayName: 'Popup.Card',
|
|
87
114
|
modelHook: hooks_1.usePopupModel,
|
|
@@ -93,6 +120,6 @@ exports.PopupCard = common_1.createSubcomponent('div')({
|
|
|
93
120
|
}, [model.state.placement]);
|
|
94
121
|
// As is a Flex that will render an element of `Element`
|
|
95
122
|
var As = common_1.useConstant(function () { return layout_1.Flex.as(Element); });
|
|
96
|
-
return (React.createElement(StyledPopupCard, __assign({ as: As, transformOrigin: transformOrigin, position: "relative", depth: 5, maxWidth: "calc(100vw - " + tokens_1.space.l + ")", flexDirection: "column", minHeight: 0, padding: "m", maxHeight:
|
|
123
|
+
return (React.createElement(StyledPopupCard, __assign({ as: As, transformOrigin: transformOrigin, position: "relative", depth: 5, maxWidth: "calc(100vw - " + tokens_1.space.l + ")", flexDirection: "column", minHeight: 0, padding: "m", maxHeight: getMaxHeight(elemProps.margin), overflowY: "auto" }, tokens_1.type.levels.subtext.large, elemProps), children));
|
|
97
124
|
});
|
|
98
125
|
var templateObject_1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupCard.d.ts","sourceRoot":"","sources":["../../../../popup/lib/PopupCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAC,IAAI,EAAC,MAAM,gCAAgC,CAAC;AAEpD,OAAO,EAKL,YAAY,EAGb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAO,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAKtE,oBAAY,eAAe,GAAG,YAAY,CAAC,OAAO,IAAI,EAAE,KAAK,CAAC,GAAG,cAAc,CAAC;AAChF,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;
|
|
1
|
+
{"version":3,"file":"PopupCard.d.ts","sourceRoot":"","sources":["../../../../popup/lib/PopupCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAC,IAAI,EAAC,MAAM,gCAAgC,CAAC;AAEpD,OAAO,EAKL,YAAY,EAGb,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAO,cAAc,EAAC,MAAM,kCAAkC,CAAC;AAKtE,oBAAY,eAAe,GAAG,YAAY,CAAC,OAAO,IAAI,EAAE,KAAK,CAAC,GAAG,cAAc,CAAC;AAChF,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAuED,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;EA6BpB,CAAC"}
|
|
@@ -60,6 +60,33 @@ var StyledPopupCard = styled(Card)(function (_a) {
|
|
|
60
60
|
},
|
|
61
61
|
_b;
|
|
62
62
|
});
|
|
63
|
+
function getSpace(value) {
|
|
64
|
+
if (value && value in space) {
|
|
65
|
+
return space[value];
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function getMaxHeight(margin) {
|
|
72
|
+
// set the default margin offset to space.xl
|
|
73
|
+
var marginOffset = space.xl;
|
|
74
|
+
if (margin) {
|
|
75
|
+
// parse the margin prop
|
|
76
|
+
if (typeof margin === 'string') {
|
|
77
|
+
var marginValues = margin.split(' ');
|
|
78
|
+
var marginTop = getSpace(marginValues[0]);
|
|
79
|
+
// If provided, use the specific margin-bottom in the shorthand, otherwise use the margin-top value
|
|
80
|
+
var marginBottom = getSpace(marginValues[2]) || marginTop;
|
|
81
|
+
marginOffset = "(" + marginTop + " + " + marginBottom + ")";
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// if margin is a number, double it to get the offset
|
|
85
|
+
marginOffset = margin * 2 + "px";
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return "calc(100vh - " + marginOffset + ")";
|
|
89
|
+
}
|
|
63
90
|
export var PopupCard = createSubcomponent('div')({
|
|
64
91
|
displayName: 'Popup.Card',
|
|
65
92
|
modelHook: usePopupModel,
|
|
@@ -71,6 +98,6 @@ export var PopupCard = createSubcomponent('div')({
|
|
|
71
98
|
}, [model.state.placement]);
|
|
72
99
|
// As is a Flex that will render an element of `Element`
|
|
73
100
|
var As = useConstant(function () { return Flex.as(Element); });
|
|
74
|
-
return (React.createElement(StyledPopupCard, __assign({ as: As, transformOrigin: transformOrigin, position: "relative", depth: 5, maxWidth: "calc(100vw - " + space.l + ")", flexDirection: "column", minHeight: 0, padding: "m", maxHeight:
|
|
101
|
+
return (React.createElement(StyledPopupCard, __assign({ as: As, transformOrigin: transformOrigin, position: "relative", depth: 5, maxWidth: "calc(100vw - " + space.l + ")", flexDirection: "column", minHeight: 0, padding: "m", maxHeight: getMaxHeight(elemProps.margin), overflowY: "auto" }, type.levels.subtext.large, elemProps), children));
|
|
75
102
|
});
|
|
76
103
|
var templateObject_1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-react",
|
|
3
|
-
"version": "8.6.0
|
|
3
|
+
"version": "8.6.0",
|
|
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,7 +49,7 @@
|
|
|
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": "^8.6.0
|
|
52
|
+
"@workday/canvas-kit-popup-stack": "^8.6.0",
|
|
53
53
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
54
54
|
"@workday/design-assets-types": "^0.2.8",
|
|
55
55
|
"chroma-js": "^2.1.0",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"@workday/canvas-accent-icons-web": "^3.0.0",
|
|
68
68
|
"@workday/canvas-applet-icons-web": "^2.0.0"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "63db571e6d052f6c8d4a3ae6b39d16c3d7d6720f"
|
|
71
71
|
}
|
package/popup/lib/PopupCard.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import {keyframes} from '@emotion/react';
|
|
3
3
|
|
|
4
4
|
import {Card} from '@workday/canvas-kit-react/card';
|
|
5
|
-
import {space, type
|
|
5
|
+
import {space, type} from '@workday/canvas-kit-react/tokens';
|
|
6
6
|
import {
|
|
7
7
|
styled,
|
|
8
8
|
TransformOrigin,
|
|
@@ -62,6 +62,35 @@ const StyledPopupCard = styled(Card)<
|
|
|
62
62
|
};
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
+
function getSpace(value?: string | number) {
|
|
66
|
+
if (value && value in space) {
|
|
67
|
+
return space[value as keyof typeof space];
|
|
68
|
+
} else {
|
|
69
|
+
return value;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function getMaxHeight(margin?: string | number) {
|
|
74
|
+
// set the default margin offset to space.xl
|
|
75
|
+
let marginOffset: string | number = space.xl;
|
|
76
|
+
|
|
77
|
+
if (margin) {
|
|
78
|
+
// parse the margin prop
|
|
79
|
+
if (typeof margin === 'string') {
|
|
80
|
+
const marginValues = margin.split(' ');
|
|
81
|
+
const marginTop = getSpace(marginValues[0]);
|
|
82
|
+
// If provided, use the specific margin-bottom in the shorthand, otherwise use the margin-top value
|
|
83
|
+
const marginBottom = getSpace(marginValues[2]) || marginTop;
|
|
84
|
+
|
|
85
|
+
marginOffset = `(${marginTop} + ${marginBottom})`;
|
|
86
|
+
} else {
|
|
87
|
+
// if margin is a number, double it to get the offset
|
|
88
|
+
marginOffset = `${margin * 2}px`;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return `calc(100vh - ${marginOffset})`;
|
|
92
|
+
}
|
|
93
|
+
|
|
65
94
|
export const PopupCard = createSubcomponent('div')({
|
|
66
95
|
displayName: 'Popup.Card',
|
|
67
96
|
modelHook: usePopupModel,
|
|
@@ -73,7 +102,6 @@ export const PopupCard = createSubcomponent('div')({
|
|
|
73
102
|
|
|
74
103
|
// As is a Flex that will render an element of `Element`
|
|
75
104
|
const As = useConstant(() => Flex.as(Element));
|
|
76
|
-
|
|
77
105
|
return (
|
|
78
106
|
<StyledPopupCard
|
|
79
107
|
as={As}
|
|
@@ -84,9 +112,7 @@ export const PopupCard = createSubcomponent('div')({
|
|
|
84
112
|
flexDirection="column"
|
|
85
113
|
minHeight={0}
|
|
86
114
|
padding="m"
|
|
87
|
-
maxHeight={
|
|
88
|
-
elemProps.margin ? space[elemProps.margin as CanvasSpaceKeys] || elemProps.margin : space.xl
|
|
89
|
-
} * 2)`}
|
|
115
|
+
maxHeight={getMaxHeight(elemProps.margin)}
|
|
90
116
|
overflowY="auto"
|
|
91
117
|
{...type.levels.subtext.large}
|
|
92
118
|
{...elemProps}
|