@workday/canvas-kit-react 5.3.0-next.3 → 5.3.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.
Files changed (36) hide show
  1. package/dist/commonjs/pagination/lib/Pagination/GoTo/Label.d.ts +3 -0
  2. package/dist/commonjs/pagination/lib/Pagination/GoTo/Label.d.ts.map +1 -1
  3. package/dist/commonjs/pagination/lib/Pagination/types.d.ts +39 -0
  4. package/dist/commonjs/pagination/lib/Pagination/types.d.ts.map +1 -1
  5. package/dist/commonjs/pagination/lib/Pagination/usePaginationModel.d.ts +19 -0
  6. package/dist/commonjs/pagination/lib/Pagination/usePaginationModel.d.ts.map +1 -1
  7. package/dist/commonjs/tabs/lib/Tab.d.ts.map +1 -1
  8. package/dist/commonjs/tabs/lib/Tab.js +18 -24
  9. package/dist/commonjs/tooltip/lib/OverflowTooltip.d.ts +10 -0
  10. package/dist/commonjs/tooltip/lib/OverflowTooltip.d.ts.map +1 -1
  11. package/dist/commonjs/tooltip/lib/OverflowTooltip.js +8 -6
  12. package/dist/es6/pagination/lib/Pagination/GoTo/Label.d.ts +3 -0
  13. package/dist/es6/pagination/lib/Pagination/GoTo/Label.d.ts.map +1 -1
  14. package/dist/es6/pagination/lib/Pagination/types.d.ts +39 -0
  15. package/dist/es6/pagination/lib/Pagination/types.d.ts.map +1 -1
  16. package/dist/es6/pagination/lib/Pagination/usePaginationModel.d.ts +19 -0
  17. package/dist/es6/pagination/lib/Pagination/usePaginationModel.d.ts.map +1 -1
  18. package/dist/es6/tabs/lib/Tab.d.ts.map +1 -1
  19. package/dist/es6/tabs/lib/Tab.js +18 -24
  20. package/dist/es6/tooltip/lib/OverflowTooltip.d.ts +10 -0
  21. package/dist/es6/tooltip/lib/OverflowTooltip.d.ts.map +1 -1
  22. package/dist/es6/tooltip/lib/OverflowTooltip.js +5 -3
  23. package/package.json +5 -5
  24. package/pagination/lib/Pagination/GoTo/Label.tsx +3 -0
  25. package/pagination/lib/Pagination/types.ts +44 -5
  26. package/pagination/lib/Pagination/usePaginationModel.ts +19 -0
  27. package/tabs/lib/Tab.tsx +53 -59
  28. package/tooltip/lib/OverflowTooltip.tsx +5 -3
  29. package/ts3.5/dist/commonjs/pagination/lib/Pagination/GoTo/Label.d.ts +3 -0
  30. package/ts3.5/dist/commonjs/pagination/lib/Pagination/types.d.ts +39 -0
  31. package/ts3.5/dist/commonjs/pagination/lib/Pagination/usePaginationModel.d.ts +19 -0
  32. package/ts3.5/dist/commonjs/tooltip/lib/OverflowTooltip.d.ts +10 -0
  33. package/ts3.5/dist/es6/pagination/lib/Pagination/GoTo/Label.d.ts +3 -0
  34. package/ts3.5/dist/es6/pagination/lib/Pagination/types.d.ts +39 -0
  35. package/ts3.5/dist/es6/pagination/lib/Pagination/usePaginationModel.d.ts +19 -0
  36. package/ts3.5/dist/es6/tooltip/lib/OverflowTooltip.d.ts +10 -0
@@ -3,6 +3,9 @@ import * as React from 'react';
3
3
  import { PaginationModel } from '../types';
4
4
  export interface GoToLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
5
5
  model: PaginationModel;
6
+ /**
7
+ * Accepts child elements or a render prop.
8
+ */
6
9
  children?: (model: PaginationModel) => React.ReactNode | React.ReactNode;
7
10
  }
8
11
  export declare const GoToLabel: ({ css: cssProp, model, children, ...elemProps }: GoToLabelProps) => JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../../../../pagination/lib/Pagination/GoTo/Label.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAEzC,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;IACjF,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;CAC1E;AAQD,eAAO,MAAM,SAAS,kFAMrB,CAAC"}
1
+ {"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../../../../pagination/lib/Pagination/GoTo/Label.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAEzC,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;IACjF,KAAK,EAAE,eAAe,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;CAC1E;AAQD,eAAO,MAAM,SAAS,kFAMrB,CAAC"}
@@ -1,16 +1,55 @@
1
1
  export interface PaginationState {
2
+ /**
3
+ * The page number for the current page
4
+ */
2
5
  currentPage: number;
6
+ /**
7
+ * The page number for the first page
8
+ */
3
9
  firstPage: number;
10
+ /**
11
+ * The page number for the last page (it can also be used as a total page
12
+ * count)
13
+ */
4
14
  lastPage: number;
15
+ /**
16
+ * An array of page numbers included in the pagination range
17
+ */
5
18
  range: number[];
19
+ /**
20
+ * The size of the pagination range
21
+ */
6
22
  rangeSize: number;
7
23
  }
8
24
  export interface PaginationEvents {
25
+ /**
26
+ * Sets the current page to a given page number (no safeguards)
27
+ */
9
28
  setCurrentPage: (page: number) => void;
29
+ /**
30
+ * Sets the current page to the first page
31
+ */
10
32
  first: () => void;
33
+ /**
34
+ * Sets the current page to the last page
35
+ */
11
36
  last: () => void;
37
+ /**
38
+ * Increments the current page by 1
39
+ */
12
40
  next: () => void;
41
+ /**
42
+ * Decrements the current page by 1
43
+ */
13
44
  previous: () => void;
45
+ /**
46
+ * Sets the current page to a given page number (with safeguards). `goTo`
47
+ * is very similar to `setCurrentPage`, but it has some built-in safeguards.
48
+ * If the page number provided is below the first page (e.g: `0`),
49
+ * `currentPage` will be set to the `firstPage`. Similarly, if the number
50
+ * provided is larger than the `lastPage`, it will set `currentPage` to the
51
+ * `lastPage`.
52
+ */
14
53
  goTo: (page: number) => void;
15
54
  }
16
55
  export interface PaginationModel {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../pagination/lib/Pagination/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,eAAe,CAAC;IACvB,MAAM,EAAE,gBAAgB,CAAC;CAC1B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../pagination/lib/Pagination/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC;;OAEG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;;;;;;OAOG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,eAAe,CAAC;IACvB,MAAM,EAAE,gBAAgB,CAAC;CAC1B"}
@@ -1,9 +1,28 @@
1
1
  import { PaginationModel } from './types';
2
2
  export declare type UsePaginationModelConfig = {
3
+ /**
4
+ * The page number for the last page (it can also be used as a total page
5
+ * count)
6
+ */
3
7
  lastPage: number;
8
+ /**
9
+ * The page number for the first page
10
+ * @default 1
11
+ */
4
12
  firstPage?: number;
13
+ /**
14
+ * The initial current page
15
+ * @default 1
16
+ */
5
17
  initialCurrentPage?: number;
18
+ /**
19
+ * The function called when the page changes
20
+ */
6
21
  onPageChange?: (pageNumber: number) => void;
22
+ /**
23
+ * The size of the pagination range
24
+ * @default 5
25
+ */
7
26
  rangeSize?: number;
8
27
  };
9
28
  export declare const usePaginationModel: ({ firstPage, initialCurrentPage, lastPage, rangeSize, onPageChange, }: UsePaginationModelConfig) => PaginationModel;
@@ -1 +1 @@
1
- {"version":3,"file":"usePaginationModel.d.ts","sourceRoot":"","sources":["../../../../../pagination/lib/Pagination/usePaginationModel.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAExC,oBAAY,wBAAwB,GAAG;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,kBAAkB,sHAsE9B,CAAC"}
1
+ {"version":3,"file":"usePaginationModel.d.ts","sourceRoot":"","sources":["../../../../../pagination/lib/Pagination/usePaginationModel.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAExC,oBAAY,wBAAwB,GAAG;IACrC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,kBAAkB,sHAsE9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/Tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAIzC,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;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;AAmGD,eAAO,MAAM,GAAG,6DAad,CAAC"}
1
+ {"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/Tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAIzC,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;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;AA6FD,eAAO,MAAM,GAAG,6DAad,CAAC"}
@@ -46,31 +46,25 @@ var StyledButton = common_1.styled('button')(__assign(__assign(__assign(__assign
46
46
  cursor: 'auto',
47
47
  backgroundColor: "transparent",
48
48
  },
49
- } }), function (_a) {
50
- var isSelected = _a.isSelected;
51
- if (isSelected) {
52
- return {
49
+ }, '&[aria-selected=true]': {
50
+ color: tokens_1.colors.blueberry400,
51
+ cursor: 'default',
52
+ '&:after': {
53
+ position: 'absolute',
54
+ height: tokens_1.space.xxxs,
55
+ borderRadius: tokens_1.borderRadius.m + " " + tokens_1.borderRadius.m + " 0px 0px",
56
+ backgroundColor: tokens_1.colors.blueberry400,
57
+ bottom: 0,
58
+ content: "''",
59
+ left: 0,
60
+ marginTop: '-2px',
61
+ width: '100%',
62
+ },
63
+ '&:hover, &:focus': {
64
+ backgroundColor: "transparent",
53
65
  color: tokens_1.colors.blueberry400,
54
- cursor: 'default',
55
- '&:after': {
56
- position: 'absolute',
57
- height: tokens_1.space.xxxs,
58
- borderRadius: tokens_1.borderRadius.m + " " + tokens_1.borderRadius.m + " 0px 0px",
59
- backgroundColor: tokens_1.colors.blueberry400,
60
- bottom: 0,
61
- content: "''",
62
- left: 0,
63
- marginTop: '-2px',
64
- width: '100%',
65
- },
66
- '&:hover, &:focus': {
67
- backgroundColor: "transparent",
68
- color: tokens_1.colors.blueberry400,
69
- },
70
- };
71
- }
72
- return {};
73
- });
66
+ },
67
+ } }));
74
68
  var useTab = function (model, elemProps, ref) {
75
69
  if (elemProps === void 0) { elemProps = {}; }
76
70
  var _a = common_1.useLocalRef(ref), localRef = _a.localRef, elementRef = _a.elementRef;
@@ -1,5 +1,15 @@
1
1
  import * as React from 'react';
2
2
  import { Placement } from '@workday/canvas-kit-react/popup';
3
+ /**
4
+ * Look for an element within the tree for an overflow element (auto, scroll, clip, or hidden).
5
+ * This could be the passed element, or a descendant. If no element is found, `null` is returned.
6
+ */
7
+ export declare const findOverflowElement: (element: Element) => Element | null;
8
+ /**
9
+ * Look for an element within the tree for a `text-overflow` CSS property of `ellipsis`.
10
+ * This could be the passed element, or a descendant. If no element is found, `null` is returned.
11
+ */
12
+ export declare const findEllipsisElement: (element: Element) => Element | null;
3
13
  export interface OverflowTooltipProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
4
14
  /**
5
15
  * The target (anchor element) for the Tooltip.
@@ -1 +1 @@
1
- {"version":3,"file":"OverflowTooltip.d.ts","sourceRoot":"","sources":["../../../../tooltip/lib/OverflowTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAA4B,SAAS,EAAS,MAAM,iCAAiC,CAAC;AA+D7F,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAC/F;;;;;;;OAOG;IACH,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAClC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAiBD,eAAO,MAAM,eAAe,8EA4C3B,CAAC"}
1
+ {"version":3,"file":"OverflowTooltip.d.ts","sourceRoot":"","sources":["../../../../tooltip/lib/OverflowTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAA4B,SAAS,EAAS,MAAM,iCAAiC,CAAC;AAM7F;;;GAGG;AACH,eAAO,MAAM,mBAAmB,sCAoB/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,sCAe/B,CAAC;AAcF,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAC/F;;;;;;;OAOG;IACH,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAClC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAiBD,eAAO,MAAM,eAAe,8EA4C3B,CAAC"}
@@ -38,7 +38,7 @@ var useTooltip_1 = require("./useTooltip");
38
38
  * Look for an element within the tree for an overflow element (auto, scroll, clip, or hidden).
39
39
  * This could be the passed element, or a descendant. If no element is found, `null` is returned.
40
40
  */
41
- var findOverflowElement = function (element) {
41
+ exports.findOverflowElement = function (element) {
42
42
  var style = getComputedStyle(element);
43
43
  if (style.overflow === 'auto' ||
44
44
  style.overflow === 'scroll' ||
@@ -49,7 +49,7 @@ var findOverflowElement = function (element) {
49
49
  else if (element.children) {
50
50
  // `children` is not defined for SVGElement in IE11
51
51
  for (var i = 0; i < element.children.length; i++) {
52
- var overflowElement = findOverflowElement(element.children[i]);
52
+ var overflowElement = exports.findOverflowElement(element.children[i]);
53
53
  if (overflowElement) {
54
54
  return overflowElement;
55
55
  }
@@ -62,23 +62,25 @@ var findOverflowElement = function (element) {
62
62
  * Look for an element within the tree for a `text-overflow` CSS property of `ellipsis`.
63
63
  * This could be the passed element, or a descendant. If no element is found, `null` is returned.
64
64
  */
65
- var findEllipsisElement = function (element) {
65
+ exports.findEllipsisElement = function (element) {
66
66
  var style = getComputedStyle(element);
67
67
  if (style.textOverflow === 'ellipsis' || Number(style.webkitLineClamp) > 0) {
68
68
  return element;
69
69
  }
70
- else {
70
+ else if (element.children) {
71
+ // `children` is not defined for SVGElement in IE11
71
72
  for (var i = 0; i < element.children.length; i++) {
72
- var overflowElement = findEllipsisElement(element.children[i]);
73
+ var overflowElement = exports.findEllipsisElement(element.children[i]);
73
74
  if (overflowElement) {
74
75
  return overflowElement;
75
76
  }
76
77
  }
77
78
  return null;
78
79
  }
80
+ return null;
79
81
  };
80
82
  var isOverflowed = function (element) {
81
- var overflowElement = findEllipsisElement(element) || findOverflowElement(element);
83
+ var overflowElement = exports.findEllipsisElement(element) || exports.findOverflowElement(element);
82
84
  if (overflowElement) {
83
85
  return (overflowElement.scrollWidth > overflowElement.clientWidth ||
84
86
  overflowElement.scrollHeight > overflowElement.clientHeight);
@@ -3,6 +3,9 @@ import * as React from 'react';
3
3
  import { PaginationModel } from '../types';
4
4
  export interface GoToLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
5
5
  model: PaginationModel;
6
+ /**
7
+ * Accepts child elements or a render prop.
8
+ */
6
9
  children?: (model: PaginationModel) => React.ReactNode | React.ReactNode;
7
10
  }
8
11
  export declare const GoToLabel: ({ css: cssProp, model, children, ...elemProps }: GoToLabelProps) => JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../../../../pagination/lib/Pagination/GoTo/Label.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAEzC,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;IACjF,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;CAC1E;AAQD,eAAO,MAAM,SAAS,kFAMrB,CAAC"}
1
+ {"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../../../../pagination/lib/Pagination/GoTo/Label.tsx"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAC,eAAe,EAAC,MAAM,UAAU,CAAC;AAEzC,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;IACjF,KAAK,EAAE,eAAe,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,KAAK,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;CAC1E;AAQD,eAAO,MAAM,SAAS,kFAMrB,CAAC"}
@@ -1,16 +1,55 @@
1
1
  export interface PaginationState {
2
+ /**
3
+ * The page number for the current page
4
+ */
2
5
  currentPage: number;
6
+ /**
7
+ * The page number for the first page
8
+ */
3
9
  firstPage: number;
10
+ /**
11
+ * The page number for the last page (it can also be used as a total page
12
+ * count)
13
+ */
4
14
  lastPage: number;
15
+ /**
16
+ * An array of page numbers included in the pagination range
17
+ */
5
18
  range: number[];
19
+ /**
20
+ * The size of the pagination range
21
+ */
6
22
  rangeSize: number;
7
23
  }
8
24
  export interface PaginationEvents {
25
+ /**
26
+ * Sets the current page to a given page number (no safeguards)
27
+ */
9
28
  setCurrentPage: (page: number) => void;
29
+ /**
30
+ * Sets the current page to the first page
31
+ */
10
32
  first: () => void;
33
+ /**
34
+ * Sets the current page to the last page
35
+ */
11
36
  last: () => void;
37
+ /**
38
+ * Increments the current page by 1
39
+ */
12
40
  next: () => void;
41
+ /**
42
+ * Decrements the current page by 1
43
+ */
13
44
  previous: () => void;
45
+ /**
46
+ * Sets the current page to a given page number (with safeguards). `goTo`
47
+ * is very similar to `setCurrentPage`, but it has some built-in safeguards.
48
+ * If the page number provided is below the first page (e.g: `0`),
49
+ * `currentPage` will be set to the `firstPage`. Similarly, if the number
50
+ * provided is larger than the `lastPage`, it will set `currentPage` to the
51
+ * `lastPage`.
52
+ */
14
53
  goTo: (page: number) => void;
15
54
  }
16
55
  export interface PaginationModel {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../pagination/lib/Pagination/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,eAAe,CAAC;IACvB,MAAM,EAAE,gBAAgB,CAAC;CAC1B"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../pagination/lib/Pagination/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC;;OAEG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB;;OAEG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB;;;;;;;OAOG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,eAAe,CAAC;IACvB,MAAM,EAAE,gBAAgB,CAAC;CAC1B"}
@@ -1,9 +1,28 @@
1
1
  import { PaginationModel } from './types';
2
2
  export declare type UsePaginationModelConfig = {
3
+ /**
4
+ * The page number for the last page (it can also be used as a total page
5
+ * count)
6
+ */
3
7
  lastPage: number;
8
+ /**
9
+ * The page number for the first page
10
+ * @default 1
11
+ */
4
12
  firstPage?: number;
13
+ /**
14
+ * The initial current page
15
+ * @default 1
16
+ */
5
17
  initialCurrentPage?: number;
18
+ /**
19
+ * The function called when the page changes
20
+ */
6
21
  onPageChange?: (pageNumber: number) => void;
22
+ /**
23
+ * The size of the pagination range
24
+ * @default 5
25
+ */
7
26
  rangeSize?: number;
8
27
  };
9
28
  export declare const usePaginationModel: ({ firstPage, initialCurrentPage, lastPage, rangeSize, onPageChange, }: UsePaginationModelConfig) => PaginationModel;
@@ -1 +1 @@
1
- {"version":3,"file":"usePaginationModel.d.ts","sourceRoot":"","sources":["../../../../../pagination/lib/Pagination/usePaginationModel.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAExC,oBAAY,wBAAwB,GAAG;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,kBAAkB,sHAsE9B,CAAC"}
1
+ {"version":3,"file":"usePaginationModel.d.ts","sourceRoot":"","sources":["../../../../../pagination/lib/Pagination/usePaginationModel.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAExC,oBAAY,wBAAwB,GAAG;IACrC;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;OAEG;IACH,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,kBAAkB,sHAsE9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/Tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAIzC,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;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;AAmGD,eAAO,MAAM,GAAG,6DAad,CAAC"}
1
+ {"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../../../../tabs/lib/Tab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAe/B,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAIzC,MAAM,WAAW,QAAQ;IACvB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;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;AA6FD,eAAO,MAAM,GAAG,6DAad,CAAC"}
@@ -37,31 +37,25 @@ var StyledButton = styled('button')(__assign(__assign(__assign(__assign({}, type
37
37
  cursor: 'auto',
38
38
  backgroundColor: "transparent",
39
39
  },
40
- } }), function (_a) {
41
- var isSelected = _a.isSelected;
42
- if (isSelected) {
43
- return {
40
+ }, '&[aria-selected=true]': {
41
+ color: colors.blueberry400,
42
+ cursor: 'default',
43
+ '&:after': {
44
+ position: 'absolute',
45
+ height: space.xxxs,
46
+ borderRadius: borderRadius.m + " " + borderRadius.m + " 0px 0px",
47
+ backgroundColor: colors.blueberry400,
48
+ bottom: 0,
49
+ content: "''",
50
+ left: 0,
51
+ marginTop: '-2px',
52
+ width: '100%',
53
+ },
54
+ '&:hover, &:focus': {
55
+ backgroundColor: "transparent",
44
56
  color: colors.blueberry400,
45
- cursor: 'default',
46
- '&:after': {
47
- position: 'absolute',
48
- height: space.xxxs,
49
- borderRadius: borderRadius.m + " " + borderRadius.m + " 0px 0px",
50
- backgroundColor: colors.blueberry400,
51
- bottom: 0,
52
- content: "''",
53
- left: 0,
54
- marginTop: '-2px',
55
- width: '100%',
56
- },
57
- '&:hover, &:focus': {
58
- backgroundColor: "transparent",
59
- color: colors.blueberry400,
60
- },
61
- };
62
- }
63
- return {};
64
- });
57
+ },
58
+ } }));
65
59
  var useTab = function (model, elemProps, ref) {
66
60
  if (elemProps === void 0) { elemProps = {}; }
67
61
  var _a = useLocalRef(ref), localRef = _a.localRef, elementRef = _a.elementRef;
@@ -1,5 +1,15 @@
1
1
  import * as React from 'react';
2
2
  import { Placement } from '@workday/canvas-kit-react/popup';
3
+ /**
4
+ * Look for an element within the tree for an overflow element (auto, scroll, clip, or hidden).
5
+ * This could be the passed element, or a descendant. If no element is found, `null` is returned.
6
+ */
7
+ export declare const findOverflowElement: (element: Element) => Element | null;
8
+ /**
9
+ * Look for an element within the tree for a `text-overflow` CSS property of `ellipsis`.
10
+ * This could be the passed element, or a descendant. If no element is found, `null` is returned.
11
+ */
12
+ export declare const findEllipsisElement: (element: Element) => Element | null;
3
13
  export interface OverflowTooltipProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
4
14
  /**
5
15
  * The target (anchor element) for the Tooltip.
@@ -1 +1 @@
1
- {"version":3,"file":"OverflowTooltip.d.ts","sourceRoot":"","sources":["../../../../tooltip/lib/OverflowTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAA4B,SAAS,EAAS,MAAM,iCAAiC,CAAC;AA+D7F,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAC/F;;;;;;;OAOG;IACH,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAClC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAiBD,eAAO,MAAM,eAAe,8EA4C3B,CAAC"}
1
+ {"version":3,"file":"OverflowTooltip.d.ts","sourceRoot":"","sources":["../../../../tooltip/lib/OverflowTooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAA4B,SAAS,EAAS,MAAM,iCAAiC,CAAC;AAM7F;;;GAGG;AACH,eAAO,MAAM,mBAAmB,sCAoB/B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,sCAe/B,CAAC;AAcF,MAAM,WAAW,oBAAqB,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAC/F;;;;;;;OAOG;IACH,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAClC;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAiBD,eAAO,MAAM,eAAe,8EA4C3B,CAAC"}
@@ -29,7 +29,7 @@ import { useTooltip } from './useTooltip';
29
29
  * Look for an element within the tree for an overflow element (auto, scroll, clip, or hidden).
30
30
  * This could be the passed element, or a descendant. If no element is found, `null` is returned.
31
31
  */
32
- var findOverflowElement = function (element) {
32
+ export var findOverflowElement = function (element) {
33
33
  var style = getComputedStyle(element);
34
34
  if (style.overflow === 'auto' ||
35
35
  style.overflow === 'scroll' ||
@@ -53,12 +53,13 @@ var findOverflowElement = function (element) {
53
53
  * Look for an element within the tree for a `text-overflow` CSS property of `ellipsis`.
54
54
  * This could be the passed element, or a descendant. If no element is found, `null` is returned.
55
55
  */
56
- var findEllipsisElement = function (element) {
56
+ export var findEllipsisElement = function (element) {
57
57
  var style = getComputedStyle(element);
58
58
  if (style.textOverflow === 'ellipsis' || Number(style.webkitLineClamp) > 0) {
59
59
  return element;
60
60
  }
61
- else {
61
+ else if (element.children) {
62
+ // `children` is not defined for SVGElement in IE11
62
63
  for (var i = 0; i < element.children.length; i++) {
63
64
  var overflowElement = findEllipsisElement(element.children[i]);
64
65
  if (overflowElement) {
@@ -67,6 +68,7 @@ var findEllipsisElement = function (element) {
67
68
  }
68
69
  return null;
69
70
  }
71
+ return null;
70
72
  };
71
73
  var isOverflowed = function (element) {
72
74
  var overflowElement = findEllipsisElement(element) || findOverflowElement(element);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-react",
3
- "version": "5.3.0-next.3+6f698ff2",
3
+ "version": "5.3.1",
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
  "@popperjs/core": "^2.5.4",
58
58
  "@workday/canvas-colors-web": "^2.0.0",
59
59
  "@workday/canvas-depth-web": "^0.16.4",
60
- "@workday/canvas-kit-labs-react": "^5.3.0-next.3+6f698ff2",
61
- "@workday/canvas-kit-popup-stack": "^5.3.0-next.3+6f698ff2",
62
- "@workday/canvas-kit-preview-react": "^5.3.0-next.3+6f698ff2",
60
+ "@workday/canvas-kit-labs-react": "^5.3.1",
61
+ "@workday/canvas-kit-popup-stack": "^5.3.1",
62
+ "@workday/canvas-kit-preview-react": "^5.3.1",
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",
@@ -75,5 +75,5 @@
75
75
  "@workday/canvas-accent-icons-web": "^1.0.0",
76
76
  "@workday/canvas-applet-icons-web": "^0.17.50"
77
77
  },
78
- "gitHead": "6f698ff217cb6ab7bf9aecd86e326eb60a85edbc"
78
+ "gitHead": "b60f3e21f949f6f514e63f3b5550e270220a22ae"
79
79
  }
@@ -7,6 +7,9 @@ import {PaginationModel} from '../types';
7
7
 
8
8
  export interface GoToLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
9
9
  model: PaginationModel;
10
+ /**
11
+ * Accepts child elements or a render prop.
12
+ */
10
13
  children?: (model: PaginationModel) => React.ReactNode | React.ReactNode;
11
14
  }
12
15
 
@@ -1,17 +1,56 @@
1
1
  export interface PaginationState {
2
- currentPage: number; // current page
3
- firstPage: number; // first page
4
- lastPage: number; // last page
5
- range: number[]; // array of page numbers
6
- rangeSize: number; // size of the range
2
+ /**
3
+ * The page number for the current page
4
+ */
5
+ currentPage: number;
6
+ /**
7
+ * The page number for the first page
8
+ */
9
+ firstPage: number;
10
+ /**
11
+ * The page number for the last page (it can also be used as a total page
12
+ * count)
13
+ */
14
+ lastPage: number;
15
+ /**
16
+ * An array of page numbers included in the pagination range
17
+ */
18
+ range: number[];
19
+ /**
20
+ * The size of the pagination range
21
+ */
22
+ rangeSize: number;
7
23
  }
8
24
 
9
25
  export interface PaginationEvents {
26
+ /**
27
+ * Sets the current page to a given page number (no safeguards)
28
+ */
10
29
  setCurrentPage: (page: number) => void;
30
+ /**
31
+ * Sets the current page to the first page
32
+ */
11
33
  first: () => void;
34
+ /**
35
+ * Sets the current page to the last page
36
+ */
12
37
  last: () => void;
38
+ /**
39
+ * Increments the current page by 1
40
+ */
13
41
  next: () => void;
42
+ /**
43
+ * Decrements the current page by 1
44
+ */
14
45
  previous: () => void;
46
+ /**
47
+ * Sets the current page to a given page number (with safeguards). `goTo`
48
+ * is very similar to `setCurrentPage`, but it has some built-in safeguards.
49
+ * If the page number provided is below the first page (e.g: `0`),
50
+ * `currentPage` will be set to the `firstPage`. Similarly, if the number
51
+ * provided is larger than the `lastPage`, it will set `currentPage` to the
52
+ * `lastPage`.
53
+ */
15
54
  goTo: (page: number) => void;
16
55
  }
17
56
 
@@ -5,10 +5,29 @@ import {getRangeMax, getRangeMin} from './common/utils/helpers';
5
5
  import {PaginationModel} from './types';
6
6
 
7
7
  export type UsePaginationModelConfig = {
8
+ /**
9
+ * The page number for the last page (it can also be used as a total page
10
+ * count)
11
+ */
8
12
  lastPage: number;
13
+ /**
14
+ * The page number for the first page
15
+ * @default 1
16
+ */
9
17
  firstPage?: number;
18
+ /**
19
+ * The initial current page
20
+ * @default 1
21
+ */
10
22
  initialCurrentPage?: number;
23
+ /**
24
+ * The function called when the page changes
25
+ */
11
26
  onPageChange?: (pageNumber: number) => void;
27
+ /**
28
+ * The size of the pagination range
29
+ * @default 5
30
+ */
12
31
  rangeSize?: number;
13
32
  };
14
33
 
package/tabs/lib/Tab.tsx CHANGED
@@ -63,72 +63,66 @@ export interface TabProps {
63
63
  tabIndex?: number;
64
64
  }
65
65
 
66
- const StyledButton = styled('button')<{isSelected: boolean} & StyledType>(
67
- {
68
- ...type.levels.subtext.large,
69
- fontWeight: type.properties.fontWeights.medium,
70
- border: 'none',
71
- backgroundColor: 'transparent',
72
- flex: '0 0 auto',
73
- maxWidth: '280px',
74
- padding: space.s,
75
- boxSizing: 'border-box',
76
- cursor: 'pointer',
77
- color: colors.licorice300,
78
- position: 'relative',
79
- marginLeft: `${space.xxxs}`,
80
- borderRadius: `${borderRadius.m} ${borderRadius.m} 0px 0px`,
81
- transition: 'background 150ms ease, color 150ms ease',
82
-
83
- '&:first-of-type': {
84
- marginLeft: 0,
85
- },
66
+ const StyledButton = styled('button')<{isSelected: boolean} & StyledType>({
67
+ ...type.levels.subtext.large,
68
+ fontWeight: type.properties.fontWeights.medium,
69
+ border: 'none',
70
+ backgroundColor: 'transparent',
71
+ flex: '0 0 auto',
72
+ maxWidth: '280px',
73
+ padding: space.s,
74
+ boxSizing: 'border-box',
75
+ cursor: 'pointer',
76
+ color: colors.licorice300,
77
+ position: 'relative',
78
+ marginLeft: `${space.xxxs}`,
79
+ borderRadius: `${borderRadius.m} ${borderRadius.m} 0px 0px`,
80
+ transition: 'background 150ms ease, color 150ms ease',
81
+
82
+ '&:first-of-type': {
83
+ marginLeft: 0,
84
+ },
86
85
 
87
- ...hideMouseFocus,
86
+ ...hideMouseFocus,
88
87
 
89
- '&:hover, &:focus': {
90
- backgroundColor: colors.soap200,
91
- color: colors.blackPepper400,
92
- },
88
+ '&:hover, &:focus': {
89
+ backgroundColor: colors.soap200,
90
+ color: colors.blackPepper400,
91
+ },
93
92
 
94
- '&:focus': {
95
- outline: `none`,
96
- ...focusRing({inset: 'outer', width: 0, separation: 2}),
93
+ '&:focus': {
94
+ outline: `none`,
95
+ ...focusRing({inset: 'outer', width: 0, separation: 2}),
96
+ },
97
+
98
+ '&:disabled': {
99
+ color: colors.licorice100,
100
+ '&:hover': {
101
+ cursor: 'auto',
102
+ backgroundColor: `transparent`,
97
103
  },
104
+ },
98
105
 
99
- '&:disabled': {
100
- color: colors.licorice100,
101
- '&:hover': {
102
- cursor: 'auto',
103
- backgroundColor: `transparent`,
104
- },
106
+ '&[aria-selected=true]': {
107
+ color: colors.blueberry400,
108
+ cursor: 'default',
109
+ '&:after': {
110
+ position: 'absolute',
111
+ height: space.xxxs,
112
+ borderRadius: `${borderRadius.m} ${borderRadius.m} 0px 0px`,
113
+ backgroundColor: colors.blueberry400,
114
+ bottom: 0,
115
+ content: `''`,
116
+ left: 0,
117
+ marginTop: '-2px',
118
+ width: '100%',
119
+ },
120
+ '&:hover, &:focus': {
121
+ backgroundColor: `transparent`,
122
+ color: colors.blueberry400,
105
123
  },
106
124
  },
107
- ({isSelected}) => {
108
- if (isSelected) {
109
- return {
110
- color: colors.blueberry400,
111
- cursor: 'default',
112
- '&:after': {
113
- position: 'absolute',
114
- height: space.xxxs,
115
- borderRadius: `${borderRadius.m} ${borderRadius.m} 0px 0px`,
116
- backgroundColor: colors.blueberry400,
117
- bottom: 0,
118
- content: `''`,
119
- left: 0,
120
- marginTop: '-2px',
121
- width: '100%',
122
- },
123
- '&:hover, &:focus': {
124
- backgroundColor: `transparent`,
125
- color: colors.blueberry400,
126
- },
127
- };
128
- }
129
- return {};
130
- }
131
- );
125
+ });
132
126
 
133
127
  const useTab = (
134
128
  model: TabsModel,
@@ -10,7 +10,7 @@ import {useTooltip} from './useTooltip';
10
10
  * Look for an element within the tree for an overflow element (auto, scroll, clip, or hidden).
11
11
  * This could be the passed element, or a descendant. If no element is found, `null` is returned.
12
12
  */
13
- const findOverflowElement = (element: Element): Element | null => {
13
+ export const findOverflowElement = (element: Element): Element | null => {
14
14
  const style = getComputedStyle(element);
15
15
  if (
16
16
  style.overflow === 'auto' ||
@@ -36,11 +36,12 @@ const findOverflowElement = (element: Element): Element | null => {
36
36
  * Look for an element within the tree for a `text-overflow` CSS property of `ellipsis`.
37
37
  * This could be the passed element, or a descendant. If no element is found, `null` is returned.
38
38
  */
39
- const findEllipsisElement = (element: Element): Element | null => {
39
+ export const findEllipsisElement = (element: Element): Element | null => {
40
40
  const style = getComputedStyle(element);
41
41
  if (style.textOverflow === 'ellipsis' || Number(style.webkitLineClamp) > 0) {
42
42
  return element;
43
- } else {
43
+ } else if (element.children) {
44
+ // `children` is not defined for SVGElement in IE11
44
45
  for (let i = 0; i < element.children.length; i++) {
45
46
  const overflowElement = findEllipsisElement(element.children[i]);
46
47
  if (overflowElement) {
@@ -49,6 +50,7 @@ const findEllipsisElement = (element: Element): Element | null => {
49
50
  }
50
51
  return null;
51
52
  }
53
+ return null;
52
54
  };
53
55
 
54
56
  const isOverflowed = (element: Element) => {
@@ -3,6 +3,9 @@ import * as React from 'react';
3
3
  import { PaginationModel } from '../types';
4
4
  export interface GoToLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
5
5
  model: PaginationModel;
6
+ /**
7
+ * Accepts child elements or a render prop.
8
+ */
6
9
  children?: (model: PaginationModel) => React.ReactNode | React.ReactNode;
7
10
  }
8
11
  export declare const GoToLabel: ({ css: cssProp, model, children, ...elemProps }: GoToLabelProps) => JSX.Element;
@@ -1,16 +1,55 @@
1
1
  export interface PaginationState {
2
+ /**
3
+ * The page number for the current page
4
+ */
2
5
  currentPage: number;
6
+ /**
7
+ * The page number for the first page
8
+ */
3
9
  firstPage: number;
10
+ /**
11
+ * The page number for the last page (it can also be used as a total page
12
+ * count)
13
+ */
4
14
  lastPage: number;
15
+ /**
16
+ * An array of page numbers included in the pagination range
17
+ */
5
18
  range: number[];
19
+ /**
20
+ * The size of the pagination range
21
+ */
6
22
  rangeSize: number;
7
23
  }
8
24
  export interface PaginationEvents {
25
+ /**
26
+ * Sets the current page to a given page number (no safeguards)
27
+ */
9
28
  setCurrentPage: (page: number) => void;
29
+ /**
30
+ * Sets the current page to the first page
31
+ */
10
32
  first: () => void;
33
+ /**
34
+ * Sets the current page to the last page
35
+ */
11
36
  last: () => void;
37
+ /**
38
+ * Increments the current page by 1
39
+ */
12
40
  next: () => void;
41
+ /**
42
+ * Decrements the current page by 1
43
+ */
13
44
  previous: () => void;
45
+ /**
46
+ * Sets the current page to a given page number (with safeguards). `goTo`
47
+ * is very similar to `setCurrentPage`, but it has some built-in safeguards.
48
+ * If the page number provided is below the first page (e.g: `0`),
49
+ * `currentPage` will be set to the `firstPage`. Similarly, if the number
50
+ * provided is larger than the `lastPage`, it will set `currentPage` to the
51
+ * `lastPage`.
52
+ */
14
53
  goTo: (page: number) => void;
15
54
  }
16
55
  export interface PaginationModel {
@@ -1,9 +1,28 @@
1
1
  import { PaginationModel } from './types';
2
2
  export declare type UsePaginationModelConfig = {
3
+ /**
4
+ * The page number for the last page (it can also be used as a total page
5
+ * count)
6
+ */
3
7
  lastPage: number;
8
+ /**
9
+ * The page number for the first page
10
+ * @default 1
11
+ */
4
12
  firstPage?: number;
13
+ /**
14
+ * The initial current page
15
+ * @default 1
16
+ */
5
17
  initialCurrentPage?: number;
18
+ /**
19
+ * The function called when the page changes
20
+ */
6
21
  onPageChange?: (pageNumber: number) => void;
22
+ /**
23
+ * The size of the pagination range
24
+ * @default 5
25
+ */
7
26
  rangeSize?: number;
8
27
  };
9
28
  export declare const usePaginationModel: ({ firstPage, initialCurrentPage, lastPage, rangeSize, onPageChange, }: UsePaginationModelConfig) => PaginationModel;
@@ -1,5 +1,15 @@
1
1
  import * as React from 'react';
2
2
  import { Placement } from '@workday/canvas-kit-react/popup';
3
+ /**
4
+ * Look for an element within the tree for an overflow element (auto, scroll, clip, or hidden).
5
+ * This could be the passed element, or a descendant. If no element is found, `null` is returned.
6
+ */
7
+ export declare const findOverflowElement: (element: Element) => Element | null;
8
+ /**
9
+ * Look for an element within the tree for a `text-overflow` CSS property of `ellipsis`.
10
+ * This could be the passed element, or a descendant. If no element is found, `null` is returned.
11
+ */
12
+ export declare const findEllipsisElement: (element: Element) => Element | null;
3
13
  export interface OverflowTooltipProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
4
14
  /**
5
15
  * The target (anchor element) for the Tooltip.
@@ -3,6 +3,9 @@ import * as React from 'react';
3
3
  import { PaginationModel } from '../types';
4
4
  export interface GoToLabelProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
5
5
  model: PaginationModel;
6
+ /**
7
+ * Accepts child elements or a render prop.
8
+ */
6
9
  children?: (model: PaginationModel) => React.ReactNode | React.ReactNode;
7
10
  }
8
11
  export declare const GoToLabel: ({ css: cssProp, model, children, ...elemProps }: GoToLabelProps) => JSX.Element;
@@ -1,16 +1,55 @@
1
1
  export interface PaginationState {
2
+ /**
3
+ * The page number for the current page
4
+ */
2
5
  currentPage: number;
6
+ /**
7
+ * The page number for the first page
8
+ */
3
9
  firstPage: number;
10
+ /**
11
+ * The page number for the last page (it can also be used as a total page
12
+ * count)
13
+ */
4
14
  lastPage: number;
15
+ /**
16
+ * An array of page numbers included in the pagination range
17
+ */
5
18
  range: number[];
19
+ /**
20
+ * The size of the pagination range
21
+ */
6
22
  rangeSize: number;
7
23
  }
8
24
  export interface PaginationEvents {
25
+ /**
26
+ * Sets the current page to a given page number (no safeguards)
27
+ */
9
28
  setCurrentPage: (page: number) => void;
29
+ /**
30
+ * Sets the current page to the first page
31
+ */
10
32
  first: () => void;
33
+ /**
34
+ * Sets the current page to the last page
35
+ */
11
36
  last: () => void;
37
+ /**
38
+ * Increments the current page by 1
39
+ */
12
40
  next: () => void;
41
+ /**
42
+ * Decrements the current page by 1
43
+ */
13
44
  previous: () => void;
45
+ /**
46
+ * Sets the current page to a given page number (with safeguards). `goTo`
47
+ * is very similar to `setCurrentPage`, but it has some built-in safeguards.
48
+ * If the page number provided is below the first page (e.g: `0`),
49
+ * `currentPage` will be set to the `firstPage`. Similarly, if the number
50
+ * provided is larger than the `lastPage`, it will set `currentPage` to the
51
+ * `lastPage`.
52
+ */
14
53
  goTo: (page: number) => void;
15
54
  }
16
55
  export interface PaginationModel {
@@ -1,9 +1,28 @@
1
1
  import { PaginationModel } from './types';
2
2
  export declare type UsePaginationModelConfig = {
3
+ /**
4
+ * The page number for the last page (it can also be used as a total page
5
+ * count)
6
+ */
3
7
  lastPage: number;
8
+ /**
9
+ * The page number for the first page
10
+ * @default 1
11
+ */
4
12
  firstPage?: number;
13
+ /**
14
+ * The initial current page
15
+ * @default 1
16
+ */
5
17
  initialCurrentPage?: number;
18
+ /**
19
+ * The function called when the page changes
20
+ */
6
21
  onPageChange?: (pageNumber: number) => void;
22
+ /**
23
+ * The size of the pagination range
24
+ * @default 5
25
+ */
7
26
  rangeSize?: number;
8
27
  };
9
28
  export declare const usePaginationModel: ({ firstPage, initialCurrentPage, lastPage, rangeSize, onPageChange, }: UsePaginationModelConfig) => PaginationModel;
@@ -1,5 +1,15 @@
1
1
  import * as React from 'react';
2
2
  import { Placement } from '@workday/canvas-kit-react/popup';
3
+ /**
4
+ * Look for an element within the tree for an overflow element (auto, scroll, clip, or hidden).
5
+ * This could be the passed element, or a descendant. If no element is found, `null` is returned.
6
+ */
7
+ export declare const findOverflowElement: (element: Element) => Element | null;
8
+ /**
9
+ * Look for an element within the tree for a `text-overflow` CSS property of `ellipsis`.
10
+ * This could be the passed element, or a descendant. If no element is found, `null` is returned.
11
+ */
12
+ export declare const findEllipsisElement: (element: Element) => Element | null;
3
13
  export interface OverflowTooltipProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
4
14
  /**
5
15
  * The target (anchor element) for the Tooltip.