@workday/canvas-kit-react 7.0.0-alpha.79-next.7 → 7.0.0-alpha.82-next.10
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/button/lib/BaseButton.tsx +2 -2
- package/button/lib/SecondaryButton.tsx +2 -3
- package/dist/commonjs/button/lib/BaseButton.js +2 -2
- package/dist/commonjs/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/SecondaryButton.js +2 -3
- package/dist/commonjs/popup/lib/Popper.d.ts +1 -9
- package/dist/commonjs/popup/lib/Popper.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/Popper.js +2 -2
- package/dist/commonjs/toast/lib/Toast.d.ts.map +1 -1
- package/dist/commonjs/toast/lib/Toast.js +2 -1
- package/dist/es6/button/lib/BaseButton.js +2 -2
- package/dist/es6/button/lib/SecondaryButton.d.ts.map +1 -1
- package/dist/es6/button/lib/SecondaryButton.js +2 -3
- package/dist/es6/popup/lib/Popper.d.ts +1 -9
- package/dist/es6/popup/lib/Popper.d.ts.map +1 -1
- package/dist/es6/popup/lib/Popper.js +2 -2
- package/dist/es6/toast/lib/Toast.d.ts.map +1 -1
- package/dist/es6/toast/lib/Toast.js +3 -2
- package/package.json +5 -5
- package/popup/lib/Popper.tsx +2 -11
- package/toast/lib/Toast.tsx +4 -3
- package/ts3.5/dist/commonjs/popup/lib/Popper.d.ts +1 -9
- package/ts3.5/dist/es6/popup/lib/Popper.d.ts +1 -9
|
@@ -267,8 +267,8 @@ export const getPaddingStyles = (
|
|
|
267
267
|
case 'small':
|
|
268
268
|
return icon
|
|
269
269
|
? iconPosition === 'start'
|
|
270
|
-
? `0
|
|
271
|
-
: `0 ${space.
|
|
270
|
+
? `0 ${space.s} 0 ${space.xs}`
|
|
271
|
+
: `0 ${space.xs} 0 ${space.s}`
|
|
272
272
|
: `0 ${space.s}`;
|
|
273
273
|
|
|
274
274
|
case 'extraSmall':
|
|
@@ -162,12 +162,11 @@ export const getSecondaryButtonColors = (
|
|
|
162
162
|
focus: {
|
|
163
163
|
background: colors.frenchVanilla100,
|
|
164
164
|
icon: colors.blackPepper500,
|
|
165
|
-
border: colors.blackPepper400,
|
|
166
165
|
label: colors.blackPepper500,
|
|
167
166
|
focusRing: focusRing(
|
|
168
167
|
{
|
|
169
|
-
separation:
|
|
170
|
-
innerColor:
|
|
168
|
+
separation: 2,
|
|
169
|
+
innerColor: 'currentColor',
|
|
171
170
|
outerColor: colors.frenchVanilla100,
|
|
172
171
|
},
|
|
173
172
|
theme
|
|
@@ -167,8 +167,8 @@ var getPaddingStyles = function (children, size, icon, iconPosition) {
|
|
|
167
167
|
case 'small':
|
|
168
168
|
return icon
|
|
169
169
|
? iconPosition === 'start'
|
|
170
|
-
? "0
|
|
171
|
-
: "0 " + tokens_1.space.
|
|
170
|
+
? "0 " + tokens_1.space.s + " 0 " + tokens_1.space.xs
|
|
171
|
+
: "0 " + tokens_1.space.xs + " 0 " + tokens_1.space.s
|
|
172
172
|
: "0 " + tokens_1.space.s;
|
|
173
173
|
case 'extraSmall':
|
|
174
174
|
return icon
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecondaryButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/SecondaryButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EACL,cAAc,EAEd,SAAS,EACT,kBAAkB,EAGnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAC,YAAY,EAAE,WAAW,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AAGjE,MAAM,WAAW,oBAAqB,SAAQ,SAAS,EAAE,cAAc;IACrE;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;;OAIG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,eAAe,yEA+C1B,CAAC;AAEH,eAAO,MAAM,wBAAwB,YAC1B,SAAS,GAAG,SAAS,SACvB,kBAAkB,KACxB,
|
|
1
|
+
{"version":3,"file":"SecondaryButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/SecondaryButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EACL,cAAc,EAEd,SAAS,EACT,kBAAkB,EAGnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAC,YAAY,EAAE,WAAW,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AAGjE,MAAM,WAAW,oBAAqB,SAAQ,SAAS,EAAE,cAAc;IACrE;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;;OAIG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,eAAe,yEA+C1B,CAAC;AAEH,eAAO,MAAM,wBAAwB,YAC1B,SAAS,GAAG,SAAS,SACvB,kBAAkB,KACxB,YAoFF,CAAC"}
|
|
@@ -117,11 +117,10 @@ var getSecondaryButtonColors = function (variant, theme) {
|
|
|
117
117
|
focus: {
|
|
118
118
|
background: tokens_1.colors.frenchVanilla100,
|
|
119
119
|
icon: tokens_1.colors.blackPepper500,
|
|
120
|
-
border: tokens_1.colors.blackPepper400,
|
|
121
120
|
label: tokens_1.colors.blackPepper500,
|
|
122
121
|
focusRing: common_1.focusRing({
|
|
123
|
-
separation:
|
|
124
|
-
innerColor:
|
|
122
|
+
separation: 2,
|
|
123
|
+
innerColor: 'currentColor',
|
|
125
124
|
outerColor: tokens_1.colors.frenchVanilla100,
|
|
126
125
|
}, theme),
|
|
127
126
|
},
|
|
@@ -18,14 +18,6 @@ export interface PopperProps {
|
|
|
18
18
|
children: ((props: {
|
|
19
19
|
placement: Placement;
|
|
20
20
|
}) => React.ReactNode) | React.ReactNode;
|
|
21
|
-
/**
|
|
22
|
-
* The element that contains the portal children when `portal` is true. It is best to not define
|
|
23
|
-
* this unless you know what you're doing. Popper works with a PopupStack and in order for
|
|
24
|
-
* z-indexes to work correctly, all Popups on your page should live on the same root element
|
|
25
|
-
* otherwise you risk running into rendering issues:
|
|
26
|
-
* https://philipwalton.com/articles/what-no-one-told-you-about-z-index/
|
|
27
|
-
*/
|
|
28
|
-
containerElement?: Element | null;
|
|
29
21
|
/**
|
|
30
22
|
* When provided, this optional callback will be used to determine positioning for the Popper element
|
|
31
23
|
* instead of calling `getBoundingClientRect` on the `anchorElement` prop. Use this when you need
|
|
@@ -58,7 +50,7 @@ export interface PopperProps {
|
|
|
58
50
|
*/
|
|
59
51
|
popperOptions?: Partial<PopperOptions>;
|
|
60
52
|
/**
|
|
61
|
-
* If
|
|
53
|
+
* If false, render the Popper within the
|
|
62
54
|
* DOM hierarchy of its parent. A non-portal Popper will constrained by the parent container
|
|
63
55
|
* overflows. If you set this to `false`, you may experience issues where you content gets cut off
|
|
64
56
|
* by scrollbars or `overflow: hidden`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popper.d.ts","sourceRoot":"","sources":["../../../../popup/lib/Popper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,oBAAY,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;AAC3C,oBAAY,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC;AAK7C,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC;IAC1D;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE;QAAC,SAAS,EAAE,SAAS,CAAA;KAAC,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IACjF;;;;;;OAMG;IACH,
|
|
1
|
+
{"version":3,"file":"Popper.d.ts","sourceRoot":"","sources":["../../../../popup/lib/Popper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,oBAAY,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;AAC3C,oBAAY,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC;AAK7C,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC;IAC1D;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE;QAAC,SAAS,EAAE,SAAS,CAAA;KAAC,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IACjF;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,OAAO,CAAC;IACpC;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IACnD;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACvC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;CAClD;AAED,eAAO,MAAM,MAAM,oFAQlB,CAAC"}
|
|
@@ -77,7 +77,7 @@ var defaultPopperOptions = {};
|
|
|
77
77
|
// Popper bails early if `open` is false and React hooks cannot be called conditionally,
|
|
78
78
|
// so we're breaking out the open version into another component.
|
|
79
79
|
var OpenPopper = React.forwardRef(function (_a, ref) {
|
|
80
|
-
var anchorElement = _a.anchorElement, getAnchorClientRect = _a.getAnchorClientRect, _b = _a.popperOptions, popperOptions = _b === void 0 ? defaultPopperOptions : _b, _c = _a.placement, popperPlacement = _c === void 0 ? 'bottom' : _c, onPlacementChange = _a.onPlacementChange, children = _a.children, portal = _a.portal,
|
|
80
|
+
var anchorElement = _a.anchorElement, getAnchorClientRect = _a.getAnchorClientRect, _b = _a.popperOptions, popperOptions = _b === void 0 ? defaultPopperOptions : _b, _c = _a.placement, popperPlacement = _c === void 0 ? 'bottom' : _c, onPlacementChange = _a.onPlacementChange, children = _a.children, portal = _a.portal, popperInstanceRef = _a.popperInstanceRef;
|
|
81
81
|
var firstRender = React.useRef(true);
|
|
82
82
|
var _d = common_1.useLocalRef(popperInstanceRef), localRef = _d.localRef, elementRef = _d.elementRef;
|
|
83
83
|
var _e = React.useState(popperPlacement), placement = _e[0], setPlacement = _e[1];
|
|
@@ -128,7 +128,7 @@ var OpenPopper = React.forwardRef(function (_a, ref) {
|
|
|
128
128
|
if (!portal) {
|
|
129
129
|
return contents;
|
|
130
130
|
}
|
|
131
|
-
return ReactDOM.createPortal(contents,
|
|
131
|
+
return ReactDOM.createPortal(contents, stackRef.current);
|
|
132
132
|
});
|
|
133
133
|
// Typescript threw an error about non-callable signatures. Using typeof as a 'function' returns
|
|
134
134
|
// a type of `Function` which isn't descriptive enough for Typescript. We don't do any detection
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../../toast/lib/Toast.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAC,MAAM,iCAAiC,CAAC;AACtD,OAAO,EAAsB,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAGlF,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAkB,YAAY,EAAqB,MAAM,kCAAkC,CAAC;AAGnG,MAAM,WAAW,UAAW,SAAQ,YAAY,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;IACxE;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IACjC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAkCD,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../../toast/lib/Toast.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAC,MAAM,iCAAiC,CAAC;AACtD,OAAO,EAAsB,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAGlF,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAkB,YAAY,EAAqB,MAAM,kCAAkC,CAAC;AAGnG,MAAM,WAAW,UAAW,SAAQ,YAAY,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;IACxE;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IACjC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAkCD,eAAO,MAAM,KAAK,4DA+ChB,CAAC"}
|
|
@@ -73,7 +73,8 @@ exports.Toast = common_1.createComponent('div')({
|
|
|
73
73
|
_c = _a.iconColor, // needed for TS2742 - https://github.com/microsoft/TypeScript/issues/29808
|
|
74
74
|
iconColor = _c === void 0 ? tokens_1.colors.greenApple400 : _c, onClose = _a.onClose, onActionClick = _a.onActionClick, actionText = _a.actionText, children = _a.children, elemProps = __rest(_a, ["icon", "iconColor", "onClose", "onActionClick", "actionText", "children"]);
|
|
75
75
|
var isInteractive = onClose || onActionClick;
|
|
76
|
-
|
|
76
|
+
var isError = iconColor === tokens_1.colors.cinnamon500 && icon === canvas_system_icons_web_1.exclamationCircleIcon;
|
|
77
|
+
return (React.createElement(popup_1.Popup.Card, __assign({ ref: ref, as: Element, width: toastWidth, padding: "s", depth: 5, role: isInteractive ? 'dialog' : isError ? 'alert' : 'status', "aria-live": isInteractive ? 'off' : isError ? 'assertive' : 'polite', "aria-atomic": !isInteractive }, elemProps),
|
|
77
78
|
onClose && React.createElement(popup_1.Popup.CloseIcon, { "aria-label": "Close", onClick: onClose, size: "small" }),
|
|
78
79
|
React.createElement(popup_1.Popup.Body, null,
|
|
79
80
|
React.createElement(ToastContentContainer, { onClose: onClose },
|
|
@@ -144,8 +144,8 @@ export var getPaddingStyles = function (children, size, icon, iconPosition) {
|
|
|
144
144
|
case 'small':
|
|
145
145
|
return icon
|
|
146
146
|
? iconPosition === 'start'
|
|
147
|
-
? "0
|
|
148
|
-
: "0 " + space.
|
|
147
|
+
? "0 " + space.s + " 0 " + space.xs
|
|
148
|
+
: "0 " + space.xs + " 0 " + space.s
|
|
149
149
|
: "0 " + space.s;
|
|
150
150
|
case 'extraSmall':
|
|
151
151
|
return icon
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecondaryButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/SecondaryButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EACL,cAAc,EAEd,SAAS,EACT,kBAAkB,EAGnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAC,YAAY,EAAE,WAAW,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AAGjE,MAAM,WAAW,oBAAqB,SAAQ,SAAS,EAAE,cAAc;IACrE;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;;OAIG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,eAAe,yEA+C1B,CAAC;AAEH,eAAO,MAAM,wBAAwB,YAC1B,SAAS,GAAG,SAAS,SACvB,kBAAkB,KACxB,
|
|
1
|
+
{"version":3,"file":"SecondaryButton.d.ts","sourceRoot":"","sources":["../../../../button/lib/SecondaryButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EACL,cAAc,EAEd,SAAS,EACT,kBAAkB,EAGnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAC,YAAY,EAAE,WAAW,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AAGjE,MAAM,WAAW,oBAAqB,SAAQ,SAAS,EAAE,cAAc;IACrE;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;;OAIG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,eAAO,MAAM,eAAe,yEA+C1B,CAAC;AAEH,eAAO,MAAM,wBAAwB,YAC1B,SAAS,GAAG,SAAS,SACvB,kBAAkB,KACxB,YAoFF,CAAC"}
|
|
@@ -95,11 +95,10 @@ export var getSecondaryButtonColors = function (variant, theme) {
|
|
|
95
95
|
focus: {
|
|
96
96
|
background: colors.frenchVanilla100,
|
|
97
97
|
icon: colors.blackPepper500,
|
|
98
|
-
border: colors.blackPepper400,
|
|
99
98
|
label: colors.blackPepper500,
|
|
100
99
|
focusRing: focusRing({
|
|
101
|
-
separation:
|
|
102
|
-
innerColor:
|
|
100
|
+
separation: 2,
|
|
101
|
+
innerColor: 'currentColor',
|
|
103
102
|
outerColor: colors.frenchVanilla100,
|
|
104
103
|
}, theme),
|
|
105
104
|
},
|
|
@@ -18,14 +18,6 @@ export interface PopperProps {
|
|
|
18
18
|
children: ((props: {
|
|
19
19
|
placement: Placement;
|
|
20
20
|
}) => React.ReactNode) | React.ReactNode;
|
|
21
|
-
/**
|
|
22
|
-
* The element that contains the portal children when `portal` is true. It is best to not define
|
|
23
|
-
* this unless you know what you're doing. Popper works with a PopupStack and in order for
|
|
24
|
-
* z-indexes to work correctly, all Popups on your page should live on the same root element
|
|
25
|
-
* otherwise you risk running into rendering issues:
|
|
26
|
-
* https://philipwalton.com/articles/what-no-one-told-you-about-z-index/
|
|
27
|
-
*/
|
|
28
|
-
containerElement?: Element | null;
|
|
29
21
|
/**
|
|
30
22
|
* When provided, this optional callback will be used to determine positioning for the Popper element
|
|
31
23
|
* instead of calling `getBoundingClientRect` on the `anchorElement` prop. Use this when you need
|
|
@@ -58,7 +50,7 @@ export interface PopperProps {
|
|
|
58
50
|
*/
|
|
59
51
|
popperOptions?: Partial<PopperOptions>;
|
|
60
52
|
/**
|
|
61
|
-
* If
|
|
53
|
+
* If false, render the Popper within the
|
|
62
54
|
* DOM hierarchy of its parent. A non-portal Popper will constrained by the parent container
|
|
63
55
|
* overflows. If you set this to `false`, you may experience issues where you content gets cut off
|
|
64
56
|
* by scrollbars or `overflow: hidden`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popper.d.ts","sourceRoot":"","sources":["../../../../popup/lib/Popper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,oBAAY,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;AAC3C,oBAAY,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC;AAK7C,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC;IAC1D;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE;QAAC,SAAS,EAAE,SAAS,CAAA;KAAC,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IACjF;;;;;;OAMG;IACH,
|
|
1
|
+
{"version":3,"file":"Popper.d.ts","sourceRoot":"","sources":["../../../../popup/lib/Popper.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAE3C,oBAAY,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;AAC3C,oBAAY,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC;AAK7C,MAAM,WAAW,WAAW;IAC1B;;;;OAIG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC;IAC1D;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE;QAAC,SAAS,EAAE,SAAS,CAAA;KAAC,KAAK,KAAK,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC;IACjF;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,OAAO,CAAC;IACpC;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;IACnD;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACvC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;CAClD;AAED,eAAO,MAAM,MAAM,oFAQlB,CAAC"}
|
|
@@ -55,7 +55,7 @@ var defaultPopperOptions = {};
|
|
|
55
55
|
// Popper bails early if `open` is false and React hooks cannot be called conditionally,
|
|
56
56
|
// so we're breaking out the open version into another component.
|
|
57
57
|
var OpenPopper = React.forwardRef(function (_a, ref) {
|
|
58
|
-
var anchorElement = _a.anchorElement, getAnchorClientRect = _a.getAnchorClientRect, _b = _a.popperOptions, popperOptions = _b === void 0 ? defaultPopperOptions : _b, _c = _a.placement, popperPlacement = _c === void 0 ? 'bottom' : _c, onPlacementChange = _a.onPlacementChange, children = _a.children, portal = _a.portal,
|
|
58
|
+
var anchorElement = _a.anchorElement, getAnchorClientRect = _a.getAnchorClientRect, _b = _a.popperOptions, popperOptions = _b === void 0 ? defaultPopperOptions : _b, _c = _a.placement, popperPlacement = _c === void 0 ? 'bottom' : _c, onPlacementChange = _a.onPlacementChange, children = _a.children, portal = _a.portal, popperInstanceRef = _a.popperInstanceRef;
|
|
59
59
|
var firstRender = React.useRef(true);
|
|
60
60
|
var _d = useLocalRef(popperInstanceRef), localRef = _d.localRef, elementRef = _d.elementRef;
|
|
61
61
|
var _e = React.useState(popperPlacement), placement = _e[0], setPlacement = _e[1];
|
|
@@ -106,7 +106,7 @@ var OpenPopper = React.forwardRef(function (_a, ref) {
|
|
|
106
106
|
if (!portal) {
|
|
107
107
|
return contents;
|
|
108
108
|
}
|
|
109
|
-
return ReactDOM.createPortal(contents,
|
|
109
|
+
return ReactDOM.createPortal(contents, stackRef.current);
|
|
110
110
|
});
|
|
111
111
|
// Typescript threw an error about non-callable signatures. Using typeof as a 'function' returns
|
|
112
112
|
// a type of `Function` which isn't descriptive enough for Typescript. We don't do any detection
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../../toast/lib/Toast.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAC,MAAM,iCAAiC,CAAC;AACtD,OAAO,EAAsB,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAGlF,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAkB,YAAY,EAAqB,MAAM,kCAAkC,CAAC;AAGnG,MAAM,WAAW,UAAW,SAAQ,YAAY,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;IACxE;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IACjC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAkCD,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../../toast/lib/Toast.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAC,MAAM,iCAAiC,CAAC;AACtD,OAAO,EAAsB,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAGlF,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAkB,YAAY,EAAqB,MAAM,kCAAkC,CAAC;AAGnG,MAAM,WAAW,UAAW,SAAQ,YAAY,CAAC,OAAO,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;IACxE;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC;IACjC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAkCD,eAAO,MAAM,KAAK,4DA+ChB,CAAC"}
|
|
@@ -24,7 +24,7 @@ import * as React from 'react';
|
|
|
24
24
|
import { Popup } from '@workday/canvas-kit-react/popup';
|
|
25
25
|
import { space, colors, type } from '@workday/canvas-kit-react/tokens';
|
|
26
26
|
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
27
|
-
import { checkIcon } from '@workday/canvas-system-icons-web';
|
|
27
|
+
import { checkIcon, exclamationCircleIcon } from '@workday/canvas-system-icons-web';
|
|
28
28
|
import { createComponent, styled } from '@workday/canvas-kit-react/common';
|
|
29
29
|
import { Hyperlink } from '@workday/canvas-kit-react/button';
|
|
30
30
|
var toastWidth = 360;
|
|
@@ -51,7 +51,8 @@ export var Toast = createComponent('div')({
|
|
|
51
51
|
_c = _a.iconColor, // needed for TS2742 - https://github.com/microsoft/TypeScript/issues/29808
|
|
52
52
|
iconColor = _c === void 0 ? colors.greenApple400 : _c, onClose = _a.onClose, onActionClick = _a.onActionClick, actionText = _a.actionText, children = _a.children, elemProps = __rest(_a, ["icon", "iconColor", "onClose", "onActionClick", "actionText", "children"]);
|
|
53
53
|
var isInteractive = onClose || onActionClick;
|
|
54
|
-
|
|
54
|
+
var isError = iconColor === colors.cinnamon500 && icon === exclamationCircleIcon;
|
|
55
|
+
return (React.createElement(Popup.Card, __assign({ ref: ref, as: Element, width: toastWidth, padding: "s", depth: 5, role: isInteractive ? 'dialog' : isError ? 'alert' : 'status', "aria-live": isInteractive ? 'off' : isError ? 'assertive' : 'polite', "aria-atomic": !isInteractive }, elemProps),
|
|
55
56
|
onClose && React.createElement(Popup.CloseIcon, { "aria-label": "Close", onClick: onClose, size: "small" }),
|
|
56
57
|
React.createElement(Popup.Body, null,
|
|
57
58
|
React.createElement(ToastContentContainer, { onClose: onClose },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-react",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.82-next.10+ea197cab",
|
|
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",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"@emotion/styled": "^11.6.0",
|
|
58
58
|
"@popperjs/core": "^2.5.4",
|
|
59
59
|
"@workday/canvas-colors-web": "^2.0.0",
|
|
60
|
-
"@workday/canvas-kit-labs-react": "^7.0.0-alpha.
|
|
61
|
-
"@workday/canvas-kit-popup-stack": "^7.0.0-alpha.
|
|
62
|
-
"@workday/canvas-kit-preview-react": "^7.0.0-alpha.
|
|
60
|
+
"@workday/canvas-kit-labs-react": "^7.0.0-alpha.82-next.10+ea197cab",
|
|
61
|
+
"@workday/canvas-kit-popup-stack": "^7.0.0-alpha.82-next.10+ea197cab",
|
|
62
|
+
"@workday/canvas-kit-preview-react": "^7.0.0-alpha.82-next.10+ea197cab",
|
|
63
63
|
"@workday/canvas-system-icons-web": "1.0.41",
|
|
64
64
|
"@workday/design-assets-types": "^0.2.4",
|
|
65
65
|
"chroma-js": "^2.1.0",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"@workday/canvas-accent-icons-web": "^1.0.0",
|
|
78
78
|
"@workday/canvas-applet-icons-web": "^0.17.50"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "ea197cab142c9ff0e0c40de332f915fbcf869bfe"
|
|
81
81
|
}
|
package/popup/lib/Popper.tsx
CHANGED
|
@@ -22,14 +22,6 @@ export interface PopperProps {
|
|
|
22
22
|
* `anchorElement`.
|
|
23
23
|
*/
|
|
24
24
|
children: ((props: {placement: Placement}) => React.ReactNode) | React.ReactNode;
|
|
25
|
-
/**
|
|
26
|
-
* The element that contains the portal children when `portal` is true. It is best to not define
|
|
27
|
-
* this unless you know what you're doing. Popper works with a PopupStack and in order for
|
|
28
|
-
* z-indexes to work correctly, all Popups on your page should live on the same root element
|
|
29
|
-
* otherwise you risk running into rendering issues:
|
|
30
|
-
* https://philipwalton.com/articles/what-no-one-told-you-about-z-index/
|
|
31
|
-
*/
|
|
32
|
-
containerElement?: Element | null;
|
|
33
25
|
/**
|
|
34
26
|
* When provided, this optional callback will be used to determine positioning for the Popper element
|
|
35
27
|
* instead of calling `getBoundingClientRect` on the `anchorElement` prop. Use this when you need
|
|
@@ -62,7 +54,7 @@ export interface PopperProps {
|
|
|
62
54
|
*/
|
|
63
55
|
popperOptions?: Partial<PopperOptions>;
|
|
64
56
|
/**
|
|
65
|
-
* If
|
|
57
|
+
* If false, render the Popper within the
|
|
66
58
|
* DOM hierarchy of its parent. A non-portal Popper will constrained by the parent container
|
|
67
59
|
* overflows. If you set this to `false`, you may experience issues where you content gets cut off
|
|
68
60
|
* by scrollbars or `overflow: hidden`
|
|
@@ -113,7 +105,6 @@ const OpenPopper = React.forwardRef<HTMLDivElement, PopperProps>(
|
|
|
113
105
|
onPlacementChange,
|
|
114
106
|
children,
|
|
115
107
|
portal,
|
|
116
|
-
containerElement,
|
|
117
108
|
popperInstanceRef,
|
|
118
109
|
}: PopperProps,
|
|
119
110
|
ref
|
|
@@ -185,7 +176,7 @@ const OpenPopper = React.forwardRef<HTMLDivElement, PopperProps>(
|
|
|
185
176
|
return contents;
|
|
186
177
|
}
|
|
187
178
|
|
|
188
|
-
return ReactDOM.createPortal(contents,
|
|
179
|
+
return ReactDOM.createPortal(contents, stackRef.current!);
|
|
189
180
|
}
|
|
190
181
|
);
|
|
191
182
|
|
package/toast/lib/Toast.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import {Popup} from '@workday/canvas-kit-react/popup';
|
|
4
4
|
import {space, colors, type, CanvasColor} from '@workday/canvas-kit-react/tokens';
|
|
5
5
|
import {SystemIcon} from '@workday/canvas-kit-react/icon';
|
|
6
|
-
import {checkIcon} from '@workday/canvas-system-icons-web';
|
|
6
|
+
import {checkIcon, exclamationCircleIcon} from '@workday/canvas-system-icons-web';
|
|
7
7
|
import {CanvasSystemIcon} from '@workday/design-assets-types';
|
|
8
8
|
import {createComponent, ExtractProps, styled, StyledType} from '@workday/canvas-kit-react/common';
|
|
9
9
|
import {Hyperlink} from '@workday/canvas-kit-react/button';
|
|
@@ -85,6 +85,7 @@ export const Toast = createComponent('div')({
|
|
|
85
85
|
Element
|
|
86
86
|
) => {
|
|
87
87
|
const isInteractive = onClose || onActionClick;
|
|
88
|
+
const isError = iconColor === colors.cinnamon500 && icon === exclamationCircleIcon;
|
|
88
89
|
|
|
89
90
|
return (
|
|
90
91
|
<Popup.Card
|
|
@@ -93,8 +94,8 @@ export const Toast = createComponent('div')({
|
|
|
93
94
|
width={toastWidth}
|
|
94
95
|
padding="s"
|
|
95
96
|
depth={5}
|
|
96
|
-
role={isInteractive ? 'dialog' : 'status'}
|
|
97
|
-
aria-live={isInteractive ? 'off' : 'polite'}
|
|
97
|
+
role={isInteractive ? 'dialog' : isError ? 'alert' : 'status'}
|
|
98
|
+
aria-live={isInteractive ? 'off' : isError ? 'assertive' : 'polite'}
|
|
98
99
|
aria-atomic={!isInteractive}
|
|
99
100
|
{...elemProps}
|
|
100
101
|
>
|
|
@@ -18,14 +18,6 @@ export interface PopperProps {
|
|
|
18
18
|
children: ((props: {
|
|
19
19
|
placement: Placement;
|
|
20
20
|
}) => React.ReactNode) | React.ReactNode;
|
|
21
|
-
/**
|
|
22
|
-
* The element that contains the portal children when `portal` is true. It is best to not define
|
|
23
|
-
* this unless you know what you're doing. Popper works with a PopupStack and in order for
|
|
24
|
-
* z-indexes to work correctly, all Popups on your page should live on the same root element
|
|
25
|
-
* otherwise you risk running into rendering issues:
|
|
26
|
-
* https://philipwalton.com/articles/what-no-one-told-you-about-z-index/
|
|
27
|
-
*/
|
|
28
|
-
containerElement?: Element | null;
|
|
29
21
|
/**
|
|
30
22
|
* When provided, this optional callback will be used to determine positioning for the Popper element
|
|
31
23
|
* instead of calling `getBoundingClientRect` on the `anchorElement` prop. Use this when you need
|
|
@@ -58,7 +50,7 @@ export interface PopperProps {
|
|
|
58
50
|
*/
|
|
59
51
|
popperOptions?: Partial<PopperOptions>;
|
|
60
52
|
/**
|
|
61
|
-
* If
|
|
53
|
+
* If false, render the Popper within the
|
|
62
54
|
* DOM hierarchy of its parent. A non-portal Popper will constrained by the parent container
|
|
63
55
|
* overflows. If you set this to `false`, you may experience issues where you content gets cut off
|
|
64
56
|
* by scrollbars or `overflow: hidden`
|
|
@@ -18,14 +18,6 @@ export interface PopperProps {
|
|
|
18
18
|
children: ((props: {
|
|
19
19
|
placement: Placement;
|
|
20
20
|
}) => React.ReactNode) | React.ReactNode;
|
|
21
|
-
/**
|
|
22
|
-
* The element that contains the portal children when `portal` is true. It is best to not define
|
|
23
|
-
* this unless you know what you're doing. Popper works with a PopupStack and in order for
|
|
24
|
-
* z-indexes to work correctly, all Popups on your page should live on the same root element
|
|
25
|
-
* otherwise you risk running into rendering issues:
|
|
26
|
-
* https://philipwalton.com/articles/what-no-one-told-you-about-z-index/
|
|
27
|
-
*/
|
|
28
|
-
containerElement?: Element | null;
|
|
29
21
|
/**
|
|
30
22
|
* When provided, this optional callback will be used to determine positioning for the Popper element
|
|
31
23
|
* instead of calling `getBoundingClientRect` on the `anchorElement` prop. Use this when you need
|
|
@@ -58,7 +50,7 @@ export interface PopperProps {
|
|
|
58
50
|
*/
|
|
59
51
|
popperOptions?: Partial<PopperOptions>;
|
|
60
52
|
/**
|
|
61
|
-
* If
|
|
53
|
+
* If false, render the Popper within the
|
|
62
54
|
* DOM hierarchy of its parent. A non-portal Popper will constrained by the parent container
|
|
63
55
|
* overflows. If you set this to `false`, you may experience issues where you content gets cut off
|
|
64
56
|
* by scrollbars or `overflow: hidden`
|