@workday/canvas-kit-react 5.2.6 → 5.2.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.
Files changed (27) 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/es6/pagination/lib/Pagination/GoTo/Label.d.ts +3 -0
  10. package/dist/es6/pagination/lib/Pagination/GoTo/Label.d.ts.map +1 -1
  11. package/dist/es6/pagination/lib/Pagination/types.d.ts +39 -0
  12. package/dist/es6/pagination/lib/Pagination/types.d.ts.map +1 -1
  13. package/dist/es6/pagination/lib/Pagination/usePaginationModel.d.ts +19 -0
  14. package/dist/es6/pagination/lib/Pagination/usePaginationModel.d.ts.map +1 -1
  15. package/dist/es6/tabs/lib/Tab.d.ts.map +1 -1
  16. package/dist/es6/tabs/lib/Tab.js +18 -24
  17. package/package.json +5 -5
  18. package/pagination/lib/Pagination/GoTo/Label.tsx +3 -0
  19. package/pagination/lib/Pagination/types.ts +44 -5
  20. package/pagination/lib/Pagination/usePaginationModel.ts +19 -0
  21. package/tabs/lib/Tab.tsx +53 -59
  22. package/ts3.5/dist/commonjs/pagination/lib/Pagination/GoTo/Label.d.ts +3 -0
  23. package/ts3.5/dist/commonjs/pagination/lib/Pagination/types.d.ts +39 -0
  24. package/ts3.5/dist/commonjs/pagination/lib/Pagination/usePaginationModel.d.ts +19 -0
  25. package/ts3.5/dist/es6/pagination/lib/Pagination/GoTo/Label.d.ts +3 -0
  26. package/ts3.5/dist/es6/pagination/lib/Pagination/types.d.ts +39 -0
  27. package/ts3.5/dist/es6/pagination/lib/Pagination/usePaginationModel.d.ts +19 -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;
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-react",
3
- "version": "5.2.6",
3
+ "version": "5.2.10",
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.2.6",
61
- "@workday/canvas-kit-popup-stack": "^5.2.6",
62
- "@workday/canvas-kit-preview-react": "^5.2.6",
60
+ "@workday/canvas-kit-labs-react": "^5.2.10",
61
+ "@workday/canvas-kit-popup-stack": "^5.2.10",
62
+ "@workday/canvas-kit-preview-react": "^5.2.10",
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": "995afb783905539646bfb52f824b1c018da9df57"
78
+ "gitHead": "418af7c145eaed430928c3abb407a211b4132131"
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,
@@ -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;
@@ -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;