@workday/canvas-kit-preview-react 15.0.0-alpha.0075-next.0 → 15.0.0-alpha.0076-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 (65) hide show
  1. package/dist/commonjs/index.d.ts +0 -1
  2. package/dist/commonjs/index.d.ts.map +1 -1
  3. package/dist/commonjs/index.js +0 -1
  4. package/dist/es6/index.d.ts +0 -1
  5. package/dist/es6/index.d.ts.map +1 -1
  6. package/dist/es6/index.js +0 -1
  7. package/index.ts +0 -1
  8. package/package.json +4 -4
  9. package/dist/commonjs/select/index.d.ts +0 -3
  10. package/dist/commonjs/select/index.d.ts.map +0 -1
  11. package/dist/commonjs/select/index.js +0 -17
  12. package/dist/commonjs/select/lib/Select.d.ts +0 -31
  13. package/dist/commonjs/select/lib/Select.d.ts.map +0 -1
  14. package/dist/commonjs/select/lib/Select.js +0 -486
  15. package/dist/commonjs/select/lib/SelectBase.d.ts +0 -165
  16. package/dist/commonjs/select/lib/SelectBase.d.ts.map +0 -1
  17. package/dist/commonjs/select/lib/SelectBase.js +0 -235
  18. package/dist/commonjs/select/lib/SelectMenu.d.ts +0 -45
  19. package/dist/commonjs/select/lib/SelectMenu.d.ts.map +0 -1
  20. package/dist/commonjs/select/lib/SelectMenu.js +0 -195
  21. package/dist/commonjs/select/lib/SelectOption.d.ts +0 -38
  22. package/dist/commonjs/select/lib/SelectOption.d.ts.map +0 -1
  23. package/dist/commonjs/select/lib/SelectOption.js +0 -73
  24. package/dist/commonjs/select/lib/scrolling.d.ts +0 -5
  25. package/dist/commonjs/select/lib/scrolling.d.ts.map +0 -1
  26. package/dist/commonjs/select/lib/scrolling.js +0 -36
  27. package/dist/commonjs/select/lib/types.d.ts +0 -37
  28. package/dist/commonjs/select/lib/types.d.ts.map +0 -1
  29. package/dist/commonjs/select/lib/types.js +0 -2
  30. package/dist/commonjs/select/lib/utils.d.ts +0 -10
  31. package/dist/commonjs/select/lib/utils.d.ts.map +0 -1
  32. package/dist/commonjs/select/lib/utils.js +0 -27
  33. package/dist/es6/select/index.d.ts +0 -3
  34. package/dist/es6/select/index.d.ts.map +0 -1
  35. package/dist/es6/select/index.js +0 -1
  36. package/dist/es6/select/lib/Select.d.ts +0 -31
  37. package/dist/es6/select/lib/Select.d.ts.map +0 -1
  38. package/dist/es6/select/lib/Select.js +0 -460
  39. package/dist/es6/select/lib/SelectBase.d.ts +0 -165
  40. package/dist/es6/select/lib/SelectBase.d.ts.map +0 -1
  41. package/dist/es6/select/lib/SelectBase.js +0 -208
  42. package/dist/es6/select/lib/SelectMenu.d.ts +0 -45
  43. package/dist/es6/select/lib/SelectMenu.d.ts.map +0 -1
  44. package/dist/es6/select/lib/SelectMenu.js +0 -191
  45. package/dist/es6/select/lib/SelectOption.d.ts +0 -38
  46. package/dist/es6/select/lib/SelectOption.d.ts.map +0 -1
  47. package/dist/es6/select/lib/SelectOption.js +0 -69
  48. package/dist/es6/select/lib/scrolling.d.ts +0 -5
  49. package/dist/es6/select/lib/scrolling.d.ts.map +0 -1
  50. package/dist/es6/select/lib/scrolling.js +0 -32
  51. package/dist/es6/select/lib/types.d.ts +0 -37
  52. package/dist/es6/select/lib/types.d.ts.map +0 -1
  53. package/dist/es6/select/lib/types.js +0 -1
  54. package/dist/es6/select/lib/utils.d.ts +0 -10
  55. package/dist/es6/select/lib/utils.d.ts.map +0 -1
  56. package/dist/es6/select/lib/utils.js +0 -22
  57. package/select/index.ts +0 -8
  58. package/select/lib/Select.tsx +0 -595
  59. package/select/lib/SelectBase.tsx +0 -493
  60. package/select/lib/SelectMenu.tsx +0 -304
  61. package/select/lib/SelectOption.tsx +0 -133
  62. package/select/lib/scrolling.ts +0 -42
  63. package/select/lib/types.ts +0 -37
  64. package/select/lib/utils.ts +0 -30
  65. package/select/package.json +0 -6
@@ -1,38 +0,0 @@
1
- import * as React from 'react';
2
- import { ErrorType, Themeable } from '@workday/canvas-kit-react/common';
3
- /**
4
- * @deprecated ⚠️ `SelectOptionProps` in Preview has been deprecated and will be removed in a future major version. Please use [`Select` in Main](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-select--docs) instead.
5
- */
6
- export interface SelectOptionProps extends Themeable, React.LiHTMLAttributes<HTMLLIElement> {
7
- /**
8
- * The type of error associated with the SelectOption (if applicable).
9
- */
10
- error?: ErrorType;
11
- /**
12
- * If true, set the SelectOption to the focused state.
13
- * @default false
14
- */
15
- focused?: boolean;
16
- /**
17
- * The HTML `id` of the SelectOption.
18
- */
19
- id?: string;
20
- /**
21
- * If true, set the SelectOption to the interactive state. Non-interactive SelectOptions should not give any visual cues that they are interactive (e.g., remove hover styling).
22
- * @default true
23
- */
24
- interactive?: boolean;
25
- /**
26
- * The ref to the list item that the styled component renders. Use this to imperatively manipulate the SelectOption (e.g., to scroll to it if it's out of view in the Select menu).
27
- */
28
- optionRef?: React.Ref<HTMLLIElement>;
29
- /**
30
- * The value of the SelectOption.
31
- */
32
- value?: string;
33
- }
34
- /**
35
- * @deprecated ⚠️ `SelectOption` in Preview has been deprecated and will be removed in a future major version. Please use [`Select` in Main](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-select--docs) instead.
36
- */
37
- export declare const SelectOption: ({ children, focused, interactive, optionRef, value, ...elemProps }: SelectOptionProps) => import("react/jsx-runtime").JSX.Element;
38
- //# sourceMappingURL=SelectOption.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SelectOption.d.ts","sourceRoot":"","sources":["../../../../select/lib/SelectOption.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAEL,SAAS,EACT,SAAS,EAGV,MAAM,kCAAkC,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,SAAS,EAAE,KAAK,CAAC,gBAAgB,CAAC,aAAa,CAAC;IACzF;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IACrC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAqED;;GAEG;AACH,eAAO,MAAM,YAAY,uEAOtB,iBAAiB,4CAanB,CAAC"}
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SelectOption = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const common_1 = require("@workday/canvas-kit-react/common");
6
- const tokens_1 = require("@workday/canvas-kit-react/tokens");
7
- const optionPadding = 6;
8
- const activeStyles = (theme) => {
9
- const activeBgColor = theme.canvas.palette.primary.main;
10
- return {
11
- backgroundColor: activeBgColor,
12
- color: (0, common_1.pickForegroundColor)(activeBgColor),
13
- };
14
- };
15
- const Option = (0, common_1.styled)('li')({
16
- ...tokens_1.type.levels.subtext.large,
17
- cursor: 'default',
18
- // Apply listStyle at the list item style to ensure it's styled properly
19
- // in Visual Testing States
20
- listStyle: 'none',
21
- // In case the content of the option is empty/undefined for some reason
22
- minHeight: tokens_1.type.levels.subtext.large.lineHeight,
23
- textAlign: 'left',
24
- }, ({ 'aria-disabled': disabled, focused, interactive, theme }) => {
25
- if (disabled) {
26
- // If the option is disabled, return disabled styles...
27
- return {
28
- color: tokens_1.colors.licorice100,
29
- };
30
- }
31
- else if (focused) {
32
- // ...else if the option is focused, return focused styles...
33
- return {
34
- ...activeStyles(theme),
35
- };
36
- }
37
- else {
38
- // ...else return hover and selected (via aria-selected) styles
39
- const selectedBgColor = theme.canvas.palette.primary.lightest;
40
- const selectedStyles = {
41
- '&[aria-selected="true"]': {
42
- backgroundColor: selectedBgColor,
43
- color: (0, common_1.pickForegroundColor)(selectedBgColor),
44
- },
45
- };
46
- // Only display interactive (hover/active) styles if the option is interactive
47
- const interactiveStyles = interactive
48
- ? {
49
- '&:hover': {
50
- backgroundColor: tokens_1.commonColors.hoverBackground,
51
- },
52
- '&:active, &:active[aria-selected="true"]': {
53
- ...activeStyles(theme),
54
- },
55
- }
56
- : {};
57
- return {
58
- // Place selected styles after interactive styles to have selected styles
59
- // override interactive styles (subject to CSS specificity rules)
60
- ...interactiveStyles,
61
- ...selectedStyles,
62
- };
63
- }
64
- }, ({ error }) => ({
65
- padding: `${optionPadding}px ${error === common_1.ErrorType.Caution ? optionPadding - 1 : optionPadding}px`,
66
- }));
67
- /**
68
- * @deprecated ⚠️ `SelectOption` in Preview has been deprecated and will be removed in a future major version. Please use [`Select` in Main](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-select--docs) instead.
69
- */
70
- const SelectOption = ({ children, focused = false, interactive = true, optionRef, value, ...elemProps }) => {
71
- return ((0, jsx_runtime_1.jsx)(Option, { "data-value": value, focused: focused, interactive: interactive, ref: optionRef, role: "option", ...elemProps, children: children }));
72
- };
73
- exports.SelectOption = SelectOption;
@@ -1,5 +0,0 @@
1
- /**
2
- * @deprecated ⚠️ `scrollIntoViewIfNeeded` in Preview has been deprecated and will be removed in a future major version. Please use [`Select` in Main](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-select--docs) instead.
3
- */
4
- export declare const scrollIntoViewIfNeeded: (elem: HTMLElement, centerIfNeeded?: boolean) => void;
5
- //# sourceMappingURL=scrolling.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scrolling.d.ts","sourceRoot":"","sources":["../../../../select/lib/scrolling.ts"],"names":[],"mappings":"AACA;;GAEG;AACH,eAAO,MAAM,sBAAsB,SAAU,WAAW,+BAA0B,IAqCjF,CAAC"}
@@ -1,36 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.scrollIntoViewIfNeeded = void 0;
4
- // Modified from https://gist.github.com/hsablonniere/2581101
5
- /**
6
- * @deprecated ⚠️ `scrollIntoViewIfNeeded` in Preview has been deprecated and will be removed in a future major version. Please use [`Select` in Main](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-select--docs) instead.
7
- */
8
- const scrollIntoViewIfNeeded = (elem, centerIfNeeded = true) => {
9
- const parent = elem.parentElement;
10
- if (elem && parent) {
11
- const parentComputedStyle = window.getComputedStyle(parent, null);
12
- const parentBorderTopWidth = parseInt(parentComputedStyle.getPropertyValue('border-top-width'), 10);
13
- // Check if elem is out of view at the top edge of the parent's viewport
14
- const overTop = elem.offsetTop < parent.scrollTop + parentBorderTopWidth;
15
- // Check if elem is out of view at the bottom edge of the parent's viewport
16
- const overBottom = elem.offsetTop + elem.offsetHeight >
17
- parent.scrollTop + parentBorderTopWidth + parent.clientHeight;
18
- if ((overTop || overBottom) && centerIfNeeded) {
19
- parent.scrollTop = Math.floor(elem.offsetTop - parent.clientHeight / 2 - parentBorderTopWidth + elem.clientHeight / 2);
20
- }
21
- if ((overTop || overBottom) && !centerIfNeeded) {
22
- if (overBottom) {
23
- // elem is out of view at the bottom edge of the parent's viewport;
24
- // scroll down just far enough for elem to be visible
25
- parent.scrollTop =
26
- elem.clientHeight - (parent.clientHeight + parentBorderTopWidth - elem.offsetTop);
27
- }
28
- else {
29
- // elem is out of view at the top edge of the parent's viewport;
30
- // scroll up just far enough for elem to be visible
31
- parent.scrollTop = elem.offsetTop - parentBorderTopWidth;
32
- }
33
- }
34
- }
35
- };
36
- exports.scrollIntoViewIfNeeded = scrollIntoViewIfNeeded;
@@ -1,37 +0,0 @@
1
- /**
2
- * The placement of the menu relative to its corresponding button. This type is a
3
- * subset of the PopperJS.Placement type limited to the `bottom` and `top` values.
4
- *
5
- * We need to use `top` and `bottom` instead of `top-start` and `bottom-start` for
6
- * placements because PopperJS incorrectly rounds the `start` and `end` modifiers:
7
- * https://github.com/popperjs/popper-core/blob/38914aae7a2e91715c6eb2b563517082a40cfa64/src/utils/computeOffsets.js#L68-L81
8
- * This rounding causes problems with browsers that allow subpixel values for elements
9
- * like Firefox and Edge.
10
- *
11
- * @deprecated ⚠️ `MenuPlacement` in Preview has been deprecated and will be removed in a future major version. Please use [`Select` in Main](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-select--docs) instead.
12
- */
13
- export type MenuPlacement = 'bottom' | 'top';
14
- /**
15
- * The visibility state of the menu.
16
- *
17
- * `closed`: The menu is completely closed (not present in the DOM).
18
- * `open`: The menu was previously `closed` and has just been instructed to open.
19
- * The menu has been added to the DOM, but it's not yet visible. This state is
20
- * necessary in order to apply an opacity of 0 to the menu before transitioning it
21
- * to an opacity of 1.0 in the opening state.
22
- * `opening`: The menu is in the process of opening.
23
- * `opened`: The menu is completely open.
24
- * `close`: The menu was previously `open` and has just been instructed to close.
25
- * `closing`: The menu is in the process of closing.
26
- *
27
- * Typically, a menu will transition through states in the following order:
28
- * `closed` > `open` > `opening` > `opened` > `close` > `closing` > `closed`
29
- *
30
- * However, it's possible for a user to open a menu while it's in the process of
31
- * closing in which case the menu can transition from `closing` > `opening` (and
32
- * vice-versa).
33
- *
34
- * @deprecated ⚠️ `MenuVisibility` in Preview has been deprecated and will be removed in a future major version. Please use [`Select` in Main](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-select--docs) instead.
35
- */
36
- export type MenuVisibility = 'closed' | 'open' | 'opening' | 'opened' | 'close' | 'closing';
37
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../select/lib/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,KAAK,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +0,0 @@
1
- import { NormalizedOption } from './SelectBase';
2
- /**
3
- * @deprecated ⚠️ `getIndexByValue` in Preview has been deprecated and will be removed in a future major version. Please use [`Select` in Main](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-select--basic) instead.
4
- */
5
- export declare const getIndexByValue: (options: NormalizedOption[], value: string | undefined) => number;
6
- /**
7
- * @deprecated ⚠️ `getCorrectedIndexByValue` in Preview has been deprecated and will be removed in a future major version. Please use [`Select` in Main](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-select--docs) instead.
8
- */
9
- export declare const getCorrectedIndexByValue: (options: NormalizedOption[], value: string | undefined) => number;
10
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../select/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C;;GAEG;AACH,eAAO,MAAM,eAAe,YAAa,gBAAgB,EAAE,SAAS,MAAM,GAAG,SAAS,KAAG,MAYxF,CAAC;AAGF;;GAEG;AACH,eAAO,MAAM,wBAAwB,YAC1B,gBAAgB,EAAE,SACpB,MAAM,GAAG,SAAS,KACxB,MAIF,CAAC"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCorrectedIndexByValue = exports.getIndexByValue = void 0;
4
- /**
5
- * @deprecated ⚠️ `getIndexByValue` in Preview has been deprecated and will be removed in a future major version. Please use [`Select` in Main](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-select--basic) instead.
6
- */
7
- const getIndexByValue = (options, value) => {
8
- if (!options || value === undefined) {
9
- return -1;
10
- }
11
- for (let i = 0; i < options.length; i++) {
12
- if (options[i].value === value) {
13
- return i;
14
- }
15
- }
16
- return -1;
17
- };
18
- exports.getIndexByValue = getIndexByValue;
19
- // If the value doesn't exist in the options, return index 0
20
- /**
21
- * @deprecated ⚠️ `getCorrectedIndexByValue` in Preview has been deprecated and will be removed in a future major version. Please use [`Select` in Main](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-select--docs) instead.
22
- */
23
- const getCorrectedIndexByValue = (options, value) => {
24
- const indexByValue = (0, exports.getIndexByValue)(options, value);
25
- return indexByValue === -1 ? 0 : indexByValue;
26
- };
27
- exports.getCorrectedIndexByValue = getCorrectedIndexByValue;
@@ -1,3 +0,0 @@
1
- export * from './lib/Select';
2
- export { Option, RenderableOption, RenderOptionFunction, RenderSelectedFunction, } from './lib/SelectBase';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../select/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAE7B,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC"}
@@ -1 +0,0 @@
1
- export * from './lib/Select';
@@ -1,31 +0,0 @@
1
- import { ErrorType } from '@workday/canvas-kit-react/common';
2
- import { CoreSelectBaseProps, Option } from './SelectBase';
3
- /**
4
- * @deprecated ⚠️ `SelectProps` in Preview has been deprecated and will be removed in a future major version. Please use [`Select` in Main](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-select--docs) instead.
5
- */
6
- export interface SelectProps extends CoreSelectBaseProps {
7
- /**
8
- * The options of the Select. `options` may be an array of objects, an array of strings,
9
- * or an array that contains both objects and strings.
10
- *
11
- * If `options` includes objects, each included object must adhere to the `Option` interface:
12
- *
13
- * * `data: object` (optional)
14
- * * `disabled: boolean` (optional)
15
- * * `id: string` (optional, a random `id` will be assigned to the object if one isn't provided)
16
- * * `label: string` (optional, analogous to the text content of an `<option>`)
17
- * * `value: string` (required, analogous to the `value` attribute of an `<option>`)
18
- *
19
- * If `label` is omitted, the `value` will be used to render the option.
20
- *
21
- * The `data` object is carried over to the `option` passed into the `renderOption` function where it may then be used to customize how each option is rendered.
22
- */
23
- options: (Option | string)[];
24
- }
25
- /**
26
- * @deprecated ⚠️ `Select` in Preview has been deprecated and will be removed in a future major version. Please use [`Select` in Main](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-select--docs) instead.
27
- */
28
- export declare const Select: import("@workday/canvas-kit-react/common").ElementComponent<"button", SelectProps> & {
29
- ErrorType: typeof ErrorType;
30
- };
31
- //# sourceMappingURL=Select.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../select/lib/Select.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EAKV,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAa,mBAAmB,EAAE,MAAM,EAAmB,MAAM,cAAc,CAAC;AAGvF;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,mBAAmB;IACtD;;;;;;;;;;;;;;;OAeG;IACH,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;CAC9B;AAoiBD;;GAEG;AACH,eAAO,MAAM,MAAM;;CAUjB,CAAC"}