@workday/canvas-kit-react 11.0.0-alpha.664-next.0 → 11.0.0-alpha.667-next.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.
Files changed (39) hide show
  1. package/dist/commonjs/badge/lib/CountBadge.js +3 -3
  2. package/dist/commonjs/button/lib/BaseButton.js +17 -17
  3. package/dist/commonjs/button/lib/DeleteButton.js +1 -1
  4. package/dist/commonjs/button/lib/PrimaryButton.js +2 -2
  5. package/dist/commonjs/button/lib/SecondaryButton.js +2 -2
  6. package/dist/commonjs/button/lib/TertiaryButton.js +15 -15
  7. package/dist/commonjs/card/lib/Card.js +1 -1
  8. package/dist/commonjs/card/lib/CardHeading.js +1 -1
  9. package/dist/commonjs/common/lib/AccessibleHide.js +1 -1
  10. package/dist/commonjs/common/lib/CanvasProvider.js +1 -1
  11. package/dist/commonjs/loading-dots/lib/LoadingDots.d.ts +2 -2
  12. package/dist/commonjs/loading-dots/lib/LoadingDots.d.ts.map +1 -1
  13. package/dist/commonjs/loading-dots/lib/LoadingDots.js +19 -42
  14. package/dist/commonjs/popup/lib/hooks/useCloseOnOutsideClick.d.ts.map +1 -1
  15. package/dist/commonjs/popup/lib/hooks/useCloseOnOutsideClick.js +2 -0
  16. package/dist/commonjs/select/lib/Select.js +1 -1
  17. package/dist/commonjs/text/lib/LabelText.js +18 -18
  18. package/dist/commonjs/text/lib/Text.js +15 -15
  19. package/dist/es6/badge/lib/CountBadge.js +3 -3
  20. package/dist/es6/button/lib/BaseButton.js +17 -17
  21. package/dist/es6/button/lib/DeleteButton.js +1 -1
  22. package/dist/es6/button/lib/PrimaryButton.js +2 -2
  23. package/dist/es6/button/lib/SecondaryButton.js +2 -2
  24. package/dist/es6/button/lib/TertiaryButton.js +15 -15
  25. package/dist/es6/card/lib/Card.js +1 -1
  26. package/dist/es6/card/lib/CardHeading.js +1 -1
  27. package/dist/es6/common/lib/AccessibleHide.js +1 -1
  28. package/dist/es6/common/lib/CanvasProvider.js +1 -1
  29. package/dist/es6/loading-dots/lib/LoadingDots.d.ts +2 -2
  30. package/dist/es6/loading-dots/lib/LoadingDots.d.ts.map +1 -1
  31. package/dist/es6/loading-dots/lib/LoadingDots.js +20 -42
  32. package/dist/es6/popup/lib/hooks/useCloseOnOutsideClick.d.ts.map +1 -1
  33. package/dist/es6/popup/lib/hooks/useCloseOnOutsideClick.js +2 -0
  34. package/dist/es6/select/lib/Select.js +1 -1
  35. package/dist/es6/text/lib/LabelText.js +18 -18
  36. package/dist/es6/text/lib/Text.js +15 -15
  37. package/loading-dots/lib/LoadingDots.tsx +55 -54
  38. package/package.json +4 -4
  39. package/popup/lib/hooks/useCloseOnOutsideClick.ts +2 -0
@@ -1,73 +1,74 @@
1
1
  import * as React from 'react';
2
- import {keyframes} from '@emotion/react';
3
- import {canvas, borderRadius} from '@workday/canvas-kit-react/tokens';
4
- import {styled} from '@workday/canvas-kit-react/common';
2
+ import {base, system} from '@workday/canvas-tokens-web';
3
+ import {createComponent} from '@workday/canvas-kit-react/common';
4
+ import {createStyles, handleCsProp, keyframes, CSProps} from '@workday/canvas-kit-styling';
5
+
6
+ /**
7
+ * Duration of the sparkle dots loading (in ms).
8
+ */
9
+ const ANIMATION_DURATION_MS = '1400';
5
10
 
6
11
  /**
7
12
  * Keyframe for the dots loading animation.
8
13
  */
9
- const keyframesLoading = keyframes`
10
- 0%,
11
- 80%,
12
- 100% {
13
- transform: scale(0);
14
- }
15
- 40% {
16
- transform: scale(1);
17
- }`;
14
+ const keyframesLoading = keyframes({
15
+ '0%, 80%, 100%': {
16
+ transform: 'scale(0)',
17
+ },
18
+ '40%': {
19
+ transform: 'scale(1)',
20
+ },
21
+ });
18
22
 
19
- type LoadingDotProps = {
20
- /**
21
- * The animation delay of the LoadingDots (in ms).
22
- */
23
- animationDelay: number;
24
- };
23
+ const loadingDotStyles = createStyles({
24
+ backgroundColor: base.soap400,
25
+ width: system.space.x4,
26
+ height: system.space.x4,
27
+ fontSize: system.space.zero,
28
+ borderRadius: system.shape.round,
29
+ transform: 'scale(0)',
30
+ display: 'inline-block',
31
+ animationName: keyframesLoading,
32
+ animationDuration: `${ANIMATION_DURATION_MS}ms`,
33
+ animationIterationCount: 'infinite',
34
+ animationTimingFunction: 'ease-in-out',
35
+ animationFillMode: 'both',
36
+ '&:nth-child(1)': {
37
+ animationDelay: '0ms',
38
+ },
39
+ '&:nth-child(2)': {
40
+ animationDelay: `calc(${ANIMATION_DURATION_MS}ms * (4/35))`, // 160
41
+ },
42
+ '&:nth-child(3)': {
43
+ animationDelay: `calc(${ANIMATION_DURATION_MS}ms * (8/35))`, // 320
44
+ },
45
+ });
25
46
 
26
47
  /**
27
48
  * The actual loading dot div.
28
49
  */
29
- const LoadingAnimationDot = styled('div')<LoadingDotProps>(
30
- {
31
- backgroundColor: canvas.colors.soap400,
32
- width: canvas.space.s,
33
- height: canvas.space.s,
34
- fontSize: '0px',
35
- borderRadius: borderRadius.circle,
36
- transform: 'scale(0)',
37
- display: 'inline-block',
38
- marginRight: canvas.space.xxs,
39
- animationName: keyframesLoading,
40
- animationDuration: '1400ms',
41
- animationIterationCount: 'infinite',
42
- animationTimingFunction: 'ease-in-out',
43
- animationFillMode: 'both',
44
- '&:last-child': {
45
- marginRight: 0,
46
- },
47
- },
48
- ({animationDelay}) => ({
49
- animationDelay: animationDelay + 'ms',
50
- })
51
- );
50
+ const LoadingAnimationDot = () => <div className={`${loadingDotStyles}`}></div>;
52
51
 
53
52
  /**
54
53
  * A simple container for the loading dots.
55
54
  */
56
- const Container = styled('div')({
57
- display: 'inline-block',
55
+ const containerStyles = createStyles({
56
+ display: 'inline-flex',
57
+ gap: system.space.x2,
58
58
  });
59
59
 
60
60
  /**
61
61
  * A simple component that displays three horizontal dots, to be used when some data is loading.
62
62
  */
63
- export function LoadingDots(props: React.HTMLAttributes<HTMLDivElement>) {
64
- const {...elemProps} = props;
65
-
66
- return (
67
- <Container {...elemProps}>
68
- <LoadingAnimationDot animationDelay={0} />
69
- <LoadingAnimationDot animationDelay={160} />
70
- <LoadingAnimationDot animationDelay={320} />
71
- </Container>
72
- );
73
- }
63
+ export const LoadingDots = createComponent('div')({
64
+ displayName: 'LoadingDots',
65
+ Component: (elemProps: CSProps, ref, Element) => {
66
+ return (
67
+ <Element ref={ref} {...handleCsProp(elemProps, containerStyles)}>
68
+ <LoadingAnimationDot />
69
+ <LoadingAnimationDot />
70
+ <LoadingAnimationDot />
71
+ </Element>
72
+ );
73
+ },
74
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-react",
3
- "version": "11.0.0-alpha.664-next.0",
3
+ "version": "11.0.0-alpha.667-next.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",
@@ -50,8 +50,8 @@
50
50
  "@emotion/styled": "^11.6.0",
51
51
  "@popperjs/core": "^2.5.4",
52
52
  "@workday/canvas-colors-web": "^2.0.0",
53
- "@workday/canvas-kit-popup-stack": "^11.0.0-alpha.664-next.0",
54
- "@workday/canvas-kit-styling": "^10.3.0",
53
+ "@workday/canvas-kit-popup-stack": "^11.0.0-alpha.667-next.0",
54
+ "@workday/canvas-kit-styling": "^10.3.1",
55
55
  "@workday/canvas-system-icons-web": "^3.0.0",
56
56
  "@workday/canvas-tokens-web": "^1.0.2",
57
57
  "@workday/design-assets-types": "^0.2.8",
@@ -69,5 +69,5 @@
69
69
  "@workday/canvas-accent-icons-web": "^3.0.0",
70
70
  "@workday/canvas-applet-icons-web": "^2.0.0"
71
71
  },
72
- "gitHead": "518377818f85c915b6199f66d73fd7e5e38ce7fa"
72
+ "gitHead": "345331557dba888d9b12c56470a5e015162a6a0e"
73
73
  }
@@ -27,6 +27,8 @@ export const useCloseOnOutsideClick = createElemPropsHook(usePopupModel)(model =
27
27
  if (
28
28
  elements.length &&
29
29
  elements[elements.length - 1] === model.state.stackRef.current &&
30
+ // Only consider event targets that are currently in the DOM as valid
31
+ document.contains(event.target as HTMLElement) &&
30
32
  // Use `PopupStack.contains` instead of `ref.current.contains` so that the application can
31
33
  // decide if clicking the target should toggle the popup rather than it toggling implicitly
32
34
  // because the target is outside `ref.current`