@workday/canvas-kit-react 11.0.0-alpha.718-next.0 → 11.0.0-alpha.726-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.
- package/collection/lib/useCursorListModel.tsx +1 -1
- package/common/lib/CanvasProvider.tsx +2 -2
- package/common/lib/theming/useThemedRing.ts +1 -1
- package/dist/commonjs/collection/lib/useCursorListModel.js +1 -1
- package/dist/commonjs/common/lib/CanvasProvider.d.ts.map +1 -1
- package/dist/commonjs/common/lib/CanvasProvider.js +2 -2
- package/dist/commonjs/common/lib/theming/useThemedRing.d.ts +1 -1
- package/dist/commonjs/common/lib/theming/useThemedRing.js +1 -1
- package/dist/commonjs/layout/lib/utils/mergeStyles.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/mergeStyles.js +3 -8
- package/dist/commonjs/select/lib/hooks/useSelectInput.d.ts.map +1 -1
- package/dist/commonjs/select/lib/hooks/useSelectInput.js +30 -1
- package/dist/commonjs/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/commonjs/tabs/lib/useTabsModel.js +2 -4
- package/dist/es6/collection/lib/useCursorListModel.js +1 -1
- package/dist/es6/common/lib/CanvasProvider.d.ts.map +1 -1
- package/dist/es6/common/lib/CanvasProvider.js +2 -2
- package/dist/es6/common/lib/theming/useThemedRing.d.ts +1 -1
- package/dist/es6/common/lib/theming/useThemedRing.js +1 -1
- package/dist/es6/layout/lib/utils/mergeStyles.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/mergeStyles.js +3 -8
- package/dist/es6/select/lib/hooks/useSelectInput.d.ts.map +1 -1
- package/dist/es6/select/lib/hooks/useSelectInput.js +30 -1
- package/dist/es6/tabs/lib/useTabsModel.d.ts.map +1 -1
- package/dist/es6/tabs/lib/useTabsModel.js +2 -4
- package/layout/lib/utils/mergeStyles.ts +3 -11
- package/package.json +4 -5
- package/select/lib/hooks/useSelectInput.ts +33 -1
- package/tabs/lib/useTabsModel.tsx +3 -4
- package/action-bar/LICENSE +0 -51
- package/action-bar/README.md +0 -6
- package/avatar/LICENSE +0 -51
- package/avatar/README.md +0 -111
- package/badge/LICENSE +0 -51
- package/badge/README.md +0 -127
- package/banner/LICENSE +0 -51
- package/banner/README.md +0 -7
- package/breadcrumbs/LICENSE +0 -52
- package/breadcrumbs/README.md +0 -9
- package/button/LICENSE +0 -51
- package/button/README.md +0 -272
- package/card/LICENSE +0 -51
- package/card/README.md +0 -7
- package/checkbox/LICENSE +0 -51
- package/checkbox/README.md +0 -7
- package/collection/LICENSE +0 -52
- package/collection/README.md +0 -32
- package/color-picker/LICENSE +0 -51
- package/color-picker/README.md +0 -13
- package/combobox/LICENSE +0 -52
- package/combobox/README.md +0 -7
- package/common/LICENSE +0 -51
- package/common/README.md +0 -467
- package/dialog/LICENSE +0 -52
- package/dialog/README.md +0 -10
- package/form-field/LICENSE +0 -51
- package/form-field/README.md +0 -5
- package/icon/LICENSE +0 -51
- package/icon/README.md +0 -428
- package/layout/LICENSE +0 -52
- package/layout/README.md +0 -151
- package/loading-dots/LICENSE +0 -51
- package/loading-dots/README.md +0 -7
- package/menu/LICENSE +0 -52
- package/menu/README.md +0 -32
- package/modal/README.md +0 -12
- package/pagination/LICENSE +0 -51
- package/pagination/README.md +0 -7
- package/popup/LICENSE +0 -51
- package/popup/README.md +0 -12
- package/radio/LICENSE +0 -51
- package/radio/README.md +0 -7
- package/segmented-control/LICENSE +0 -51
- package/segmented-control/README.md +0 -56
- package/select/README.md +0 -12
- package/side-panel/README.md +0 -174
- package/skeleton/README.md +0 -7
- package/status-indicator/LICENSE +0 -51
- package/status-indicator/README.md +0 -7
- package/switch/README.md +0 -7
- package/table/LICENSE +0 -51
- package/table/README.md +0 -7
- package/tabs/LICENSE +0 -51
- package/tabs/README.md +0 -7
- package/testing/LICENSE +0 -52
- package/testing/README.md +0 -6
- package/text/LICENSE +0 -52
- package/text/README.md +0 -5
- package/text-area/LICENSE +0 -51
- package/text-area/README.md +0 -7
- package/text-input/LICENSE +0 -51
- package/text-input/README.md +0 -7
- package/toast/LICENSE +0 -52
- package/toast/README.md +0 -5
- package/tokens/LICENSE +0 -51
- package/tokens/README.md +0 -427
- package/tooltip/LICENSE +0 -51
- package/tooltip/README.md +0 -77
package/color-picker/README.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# Canvas Kit Color Picker
|
|
2
|
-
|
|
3
|
-
The Color Picker module includes two components: Color Input and Color Preview.
|
|
4
|
-
|
|
5
|
-
View the
|
|
6
|
-
[documentation for Color Input](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-color-picker-color-input-react--basic)
|
|
7
|
-
on Storybook.
|
|
8
|
-
|
|
9
|
-
View the
|
|
10
|
-
[documentation for Color Preview](https://workday.github.io/canvas-kit/?path=/docs/components-inputs-color-picker-color-preview-react--basic)
|
|
11
|
-
on Storybook.
|
|
12
|
-
|
|
13
|
-
[> Workday Design Reference](https://design.workday.com/components/inputs/color-input)
|
package/combobox/LICENSE
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
Apache License, Version 2.0 Apache License Version 2.0, January 2004
|
|
2
|
-
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
9
|
-
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
10
|
-
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
11
|
-
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
12
|
-
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
13
|
-
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
14
|
-
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
15
|
-
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
16
|
-
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
17
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
18
|
-
|
|
19
|
-
2. Grant of Copyright License.
|
|
20
|
-
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
21
|
-
|
|
22
|
-
3. Grant of Patent License.
|
|
23
|
-
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
24
|
-
|
|
25
|
-
4. Redistribution.
|
|
26
|
-
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
27
|
-
You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
28
|
-
|
|
29
|
-
5. Submission of Contributions.
|
|
30
|
-
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
31
|
-
|
|
32
|
-
6. Trademarks.
|
|
33
|
-
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
34
|
-
|
|
35
|
-
7. Disclaimer of Warranty.
|
|
36
|
-
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
37
|
-
|
|
38
|
-
8. Limitation of Liability.
|
|
39
|
-
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
40
|
-
|
|
41
|
-
9. Accepting Warranty or Additional Liability.
|
|
42
|
-
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
43
|
-
|
|
44
|
-
END OF TERMS AND CONDITIONS
|
|
45
|
-
|
|
46
|
-
©2021 Workday, Inc. All rights reserved. Workday and the Workday logo are registered trademarks of Workday, Inc. All other brand and product names are trademarks or registered trademarks of their respective holders.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
|
|
50
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
51
|
-
|
|
52
|
-
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
package/combobox/README.md
DELETED
package/common/LICENSE
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
Apache License, Version 2.0 Apache License Version 2.0, January 2004
|
|
2
|
-
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
9
|
-
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
10
|
-
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
11
|
-
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
12
|
-
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
13
|
-
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
14
|
-
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
15
|
-
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
16
|
-
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
17
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
18
|
-
|
|
19
|
-
2. Grant of Copyright License.
|
|
20
|
-
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
21
|
-
|
|
22
|
-
3. Grant of Patent License.
|
|
23
|
-
Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
24
|
-
|
|
25
|
-
4. Redistribution.
|
|
26
|
-
You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
27
|
-
You must give any other recipients of the Work or Derivative Works a copy of this License; and You must cause any modified files to carry prominent notices stating that You changed the files; and You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
28
|
-
|
|
29
|
-
5. Submission of Contributions.
|
|
30
|
-
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
31
|
-
|
|
32
|
-
6. Trademarks.
|
|
33
|
-
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
34
|
-
|
|
35
|
-
7. Disclaimer of Warranty.
|
|
36
|
-
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
37
|
-
|
|
38
|
-
8. Limitation of Liability.
|
|
39
|
-
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
40
|
-
|
|
41
|
-
9. Accepting Warranty or Additional Liability.
|
|
42
|
-
While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
43
|
-
|
|
44
|
-
END OF TERMS AND CONDITIONS
|
|
45
|
-
|
|
46
|
-
©2020. Workday, Inc. All rights reserved. Workday and the Workday logo are registered trademarks of Workday, Inc. All other brand and product names are trademarks or registered trademarks of their respective holders.
|
|
47
|
-
|
|
48
|
-
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
|
|
49
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
50
|
-
|
|
51
|
-
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
package/common/README.md
DELETED
|
@@ -1,467 +0,0 @@
|
|
|
1
|
-
# Canvas Kit Common
|
|
2
|
-
|
|
3
|
-
A module of common utilities that are either agnostic of our components, or shared across them.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
yarn add @workday/canvas-kit-react
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Includes:
|
|
12
|
-
|
|
13
|
-
- [Canvas Kit Common](#canvas-kit-common)
|
|
14
|
-
- [Installation](#installation)
|
|
15
|
-
- [CanvasProvider](#canvasprovider)
|
|
16
|
-
- [Storybook Decorator](#storybook-decorator)
|
|
17
|
-
- [Input Provider](#input-provider)
|
|
18
|
-
- [Definitions](#definitions)
|
|
19
|
-
- [Usage](#usage)
|
|
20
|
-
- [Static Properties](#static-properties)
|
|
21
|
-
- [`InputTypes`](#inputtypes)
|
|
22
|
-
- [Component Props](#component-props)
|
|
23
|
-
- [Required](#required)
|
|
24
|
-
- [Optional](#optional)
|
|
25
|
-
- [`provideIntent: boolean`](#provideintent-boolean)
|
|
26
|
-
- [`container: HTMLElement | React.RefObject<HTMLElement>`](#container-htmlelement--reactrefobjecthtmlelement)
|
|
27
|
-
- [Storybook Decorator](#storybook-decorator-1)
|
|
28
|
-
- [Theming](#theming)
|
|
29
|
-
- [Bidirectionality](#bidirectionality)
|
|
30
|
-
- [Component Functions](#component-functions)
|
|
31
|
-
- [`createComponent`](#createcomponent)
|
|
32
|
-
- [`ExtractProps`](#extractprops)
|
|
33
|
-
- [Common Hooks](#common-hooks)
|
|
34
|
-
- [useUniqueId](#useuniqueid)
|
|
35
|
-
- [Utility Functions](#utility-functions)
|
|
36
|
-
- [generateUniqueId](#generateuniqueid)
|
|
37
|
-
- [setUniqueSeed](#setuniqueseed)
|
|
38
|
-
- [resetUniqueIdCount](#resetuniqueidcount)
|
|
39
|
-
|
|
40
|
-
## CanvasProvider
|
|
41
|
-
|
|
42
|
-
This is a higher order (wrapping) component intended for theming, RTL and
|
|
43
|
-
[InputProvider](#inputprovider)This is the way most consumers should use the provider. This provider
|
|
44
|
-
is required for our theming capabilities, so you can find more information in the
|
|
45
|
-
[theming documentation](./lib/theming/README.md).
|
|
46
|
-
|
|
47
|
-
**We strongly encourage you to use this in your application to wrap all Canvas components.**
|
|
48
|
-
|
|
49
|
-
```tsx
|
|
50
|
-
import * as React from 'react';
|
|
51
|
-
import {CanvasProvider} from '@workday/canvas-kit-react/common';
|
|
52
|
-
|
|
53
|
-
<CanvasProvider>{/* All your components containing any Canvas components */}</CanvasProvider>;
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
#### Storybook Decorator
|
|
57
|
-
|
|
58
|
-
We provide a [storybook decorator](../../utils/storybook/CanvasProviderDecorator.tsx) to wrap your
|
|
59
|
-
stories in a `CanvasProvider` (including `InputProvider`) automatically.
|
|
60
|
-
|
|
61
|
-
Add this decorator to your `/.storybook/preview.js` configuration file to apply to all stories:
|
|
62
|
-
|
|
63
|
-
```js
|
|
64
|
-
import {CanvasProviderDecorator} from '../utils/storybook';
|
|
65
|
-
|
|
66
|
-
export const decorators = [CanvasProviderDecorator];
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
Or, add it to stories individually:
|
|
70
|
-
|
|
71
|
-
```js
|
|
72
|
-
import {CanvasProviderDecorator} from '../../../../utils/storybook';
|
|
73
|
-
|
|
74
|
-
export default {
|
|
75
|
-
title: 'MyComponent',
|
|
76
|
-
component: MyComponent,
|
|
77
|
-
decorators: [CanvasProviderDecorator],
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// OR
|
|
81
|
-
|
|
82
|
-
MyStory.decorators = [CanvasProviderDecorator];
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
---
|
|
86
|
-
|
|
87
|
-
### Input Provider
|
|
88
|
-
|
|
89
|
-
This is a higher order (wrapping) component for providing css-referencable data attributes for the
|
|
90
|
-
users current input. Focus outlines are required for accessibility, but they can be unnecessary
|
|
91
|
-
visual noise when using a mouse. This allows us to hide focus outlines (as desired) while the user
|
|
92
|
-
is interacting with components using a mouse, touch, etc. and show them when keyboard navigation
|
|
93
|
-
begins. This logic is heavily influenced by [what-input](https://github.com/ten1seven/what-input).
|
|
94
|
-
You can use it to style your own components as well using the examples below.
|
|
95
|
-
|
|
96
|
-
Preferably you would use the `CanvasProvider` as `InputProvider` functionality is included within
|
|
97
|
-
it. However, if you want `InputProvider` functionality on it's own, you can use this.
|
|
98
|
-
|
|
99
|
-
#### Definitions
|
|
100
|
-
|
|
101
|
-
**Input**: The current input method from the user.
|
|
102
|
-
|
|
103
|
-
- Equal to one of [`InputTypes`](#inputtypes)
|
|
104
|
-
- Triggered by the following events:
|
|
105
|
-
- `keydown`
|
|
106
|
-
- `keyup`
|
|
107
|
-
- `mousedown`
|
|
108
|
-
- `MSPointerDown`
|
|
109
|
-
- `pointerdown`
|
|
110
|
-
- `touchstart`
|
|
111
|
-
|
|
112
|
-
**Intent**: The potential next input method from the user. Mouse, pointer and mouse wheel events
|
|
113
|
-
only demonstrate potential, but not actual, interaction and are treated separately. Note: if input
|
|
114
|
-
type updates from the events above, the intent type will also be updated to the same value.
|
|
115
|
-
|
|
116
|
-
- Equal to one of [`InputTypes`](#inputtypes)
|
|
117
|
-
- Triggered by the following events:
|
|
118
|
-
- `mousemove`
|
|
119
|
-
- `MSPointerMove`
|
|
120
|
-
- `pointermove`
|
|
121
|
-
- `wheel`
|
|
122
|
-
- `mousewheel`
|
|
123
|
-
- `DOMMouseScroll`
|
|
124
|
-
|
|
125
|
-
#### Usage
|
|
126
|
-
|
|
127
|
-
As an external consumer, you should reference the following example.
|
|
128
|
-
|
|
129
|
-
If you are contributing a component, you must add the necessary styling (see below) and use the
|
|
130
|
-
[`InputProviderDecorator`](#storybook-decorator) in your stories. _DO NOT_ use an `InputProvider`
|
|
131
|
-
directly within any Canvas Kit components.
|
|
132
|
-
|
|
133
|
-
```tsx
|
|
134
|
-
import * as React from 'react';
|
|
135
|
-
import {InputProvider} from '@workday/canvas-kit-react';
|
|
136
|
-
|
|
137
|
-
<div>
|
|
138
|
-
<InputProvider />
|
|
139
|
-
{/* All your components containing any Canvas components */}
|
|
140
|
-
<div>;
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
This will result in these data attributes being added to the body element (by default)
|
|
144
|
-
|
|
145
|
-
```html
|
|
146
|
-
<body data-whatinput="mouse" data-whatinput="mouse">
|
|
147
|
-
<!-- All your components' HTML -->
|
|
148
|
-
</body>
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
Now in any component within this wrapper, you can use these data attributes to customize the focus
|
|
152
|
-
handling.
|
|
153
|
-
|
|
154
|
-
**React/Emotion:**
|
|
155
|
-
|
|
156
|
-
```js
|
|
157
|
-
[`[data-whatinput='mouse'] &:focus,
|
|
158
|
-
[data-whatinput='touch'] &:focus,
|
|
159
|
-
[data-whatinput='pointer'] &:focus`]: {
|
|
160
|
-
outline: 'none',
|
|
161
|
-
border: 'none',
|
|
162
|
-
},
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
**SCSS:**
|
|
166
|
-
|
|
167
|
-
```scss
|
|
168
|
-
[data-whatinput='mouse'],
|
|
169
|
-
[data-whatinput='touch'],
|
|
170
|
-
[data-whatinput='pointer'] {
|
|
171
|
-
.my-component:focus {
|
|
172
|
-
outline: none;
|
|
173
|
-
border: none;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
We provide a [helper](../../common/react/lib/styles/hideMouseFocus.ts) to hide the focus outlines on
|
|
179
|
-
mouse input. Simply spread it in your styles (i.e. `...hideMouseFocus`).
|
|
180
|
-
|
|
181
|
-
**Note:** It is best practice to show focus outlines by default and specifically hide them in the
|
|
182
|
-
cases you would like (i.e. mouse/touch/pointer input).
|
|
183
|
-
|
|
184
|
-
**Note:** Multiple InputProviders in the same tree are not supported. Any nested `InputProvider`
|
|
185
|
-
will remove itself from the DOM (rendering only its children) and not attach any event listeners.
|
|
186
|
-
|
|
187
|
-
#### Static Properties
|
|
188
|
-
|
|
189
|
-
##### `InputTypes`
|
|
190
|
-
|
|
191
|
-
| Theme |
|
|
192
|
-
| ---------- |
|
|
193
|
-
| `Keyboard` |
|
|
194
|
-
| `Mouse` |
|
|
195
|
-
| `Pointer` |
|
|
196
|
-
| `Touch` |
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
#### Component Props
|
|
201
|
-
|
|
202
|
-
##### Required
|
|
203
|
-
|
|
204
|
-
> None
|
|
205
|
-
|
|
206
|
-
##### Optional
|
|
207
|
-
|
|
208
|
-
###### `provideIntent: boolean`
|
|
209
|
-
|
|
210
|
-
> Whether you would like the attribute `data-whatintent` rendered (see definition of intent above).
|
|
211
|
-
> Note: detecting intent will add scroll and mouse positioning listeners which could affect
|
|
212
|
-
> performance.
|
|
213
|
-
|
|
214
|
-
###### `container: HTMLElement | React.RefObject<HTMLElement>`
|
|
215
|
-
|
|
216
|
-
> The containing element in which the InputProvider attaches its data attributes. This property
|
|
217
|
-
> should be set to an element that is an ancestor of all your Canvas components.
|
|
218
|
-
|
|
219
|
-
Default: `document.body`
|
|
220
|
-
|
|
221
|
-
#### Storybook Decorator
|
|
222
|
-
|
|
223
|
-
We provide a [storybook decorator](../../utils/storybook/CanvasProviderDecorator.tsx) to wrap your
|
|
224
|
-
stories in an `InputProvider` automatically.
|
|
225
|
-
|
|
226
|
-
Add this decorator to your `/.storybook/preview.js` configuration file to apply to all stories:
|
|
227
|
-
|
|
228
|
-
```js
|
|
229
|
-
import {InputProviderDecorator} from '../utils/storybook';
|
|
230
|
-
|
|
231
|
-
export const decorators = [InputProviderDecorator];
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
Or, add it to stories individually:
|
|
235
|
-
|
|
236
|
-
```js
|
|
237
|
-
import {InputProviderDecorator} from '../../../../utils/storybook';
|
|
238
|
-
|
|
239
|
-
export default {
|
|
240
|
-
title: 'MyComponent',
|
|
241
|
-
component: MyComponent,
|
|
242
|
-
decorators: [InputProviderDecorator],
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
// OR
|
|
246
|
-
|
|
247
|
-
MyStory.decorators = [InputProviderDecorator];
|
|
248
|
-
```
|
|
249
|
-
|
|
250
|
-
---
|
|
251
|
-
|
|
252
|
-
## Theming
|
|
253
|
-
|
|
254
|
-
Theming documentation has its own README. You can find it [here](./lib/theming/README.md).
|
|
255
|
-
|
|
256
|
-
---
|
|
257
|
-
|
|
258
|
-
## Bidirectionality
|
|
259
|
-
|
|
260
|
-
Bidirectionality is provided by Theming. You can find Theming documentation
|
|
261
|
-
[here](./lib/theming/README.md#bidirectionality).
|
|
262
|
-
|
|
263
|
-
## Component Functions
|
|
264
|
-
|
|
265
|
-
### `createComponent`
|
|
266
|
-
|
|
267
|
-
`createComponent` is a convenience function that makes it easier to create components that
|
|
268
|
-
[forward refs](https://reactjs.org/docs/forwarding-refs.html) and take an `as` prop. The `as` prop
|
|
269
|
-
allows you to change the default element rendered by the component.
|
|
270
|
-
|
|
271
|
-
```tsx
|
|
272
|
-
interface MyComponentProps {
|
|
273
|
-
prop1: string;
|
|
274
|
-
prop2: number;
|
|
275
|
-
children: React.ReactNode;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
export const MyComponent = createComponent('div')({
|
|
279
|
-
displayName: 'MyComponent', // the component's name in the React dev tools
|
|
280
|
-
Component: (({ prop1, prop2, children, ...elemProps }: MyComponentProps), ref, as) => {
|
|
281
|
-
return <Box as={as} {...elemProps}>{children}</Box>
|
|
282
|
-
})
|
|
283
|
-
})
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
Using a component created via `createComponent`:
|
|
287
|
-
|
|
288
|
-
```tsx
|
|
289
|
-
<MyComponent ref={ref} as="aside">
|
|
290
|
-
Content
|
|
291
|
-
</MyComponent>
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
`MyComponent` is returning a type that looks like `ElementComponent<'div', MyComponentProps>`. The
|
|
295
|
-
`'div'` tells you what the default element is of the element component.
|
|
296
|
-
|
|
297
|
-
Notice that `MyComponentProps` does not extend `React.HTMLAttributes<HTMLDivElement>`. The `as` prop
|
|
298
|
-
changes the interface of the component to match that of the `aside` element which is a
|
|
299
|
-
`React.HTMLAttributes<HTMLElement>`. For this reason, the interface cannot be known statically ahead
|
|
300
|
-
of time. Components using `createComponent` are starting to not export the prop interface. For this
|
|
301
|
-
reason, [ExtractProps](#extractprops) was created.
|
|
302
|
-
|
|
303
|
-
The first parameter of `createComponent` might not be defined. If this is the case, the type
|
|
304
|
-
returned is a `Component` instead of `ElementComponent`. `Component`s do not have any HTML
|
|
305
|
-
attributes associated with them. This usually means the component doesn't return a real element.
|
|
306
|
-
This is used for compound components that do not require an element for accessibility reasons and
|
|
307
|
-
only provide a common model for the subcomponents.
|
|
308
|
-
|
|
309
|
-
### `ExtractProps`
|
|
310
|
-
|
|
311
|
-
v5 introduces components that could take an `as` prop, which means the underlying element that is
|
|
312
|
-
rendered can change. Component props that use the `as` prop no longer extend an HTML attribute
|
|
313
|
-
interface because the interface is determined by the value of the `as` prop.
|
|
314
|
-
|
|
315
|
-
`ExtractProps` can be used in place of importing a prop interface directly. If you wish to extend a
|
|
316
|
-
Canvas Kit component by extending it's props, use `ExtractProps`.
|
|
317
|
-
|
|
318
|
-
```tsx
|
|
319
|
-
interface MyNewComponentProps extends ExtractProps<typeof MyComponent> {
|
|
320
|
-
foo: string;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
const MyNewComponent = ({foo, ...props}: MyNewComponentProps) => {
|
|
324
|
-
return <MyComponent {...props}>My Content</MyComponent>;
|
|
325
|
-
};
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
`ExtractProps` will return an type that includes the props of the component passed to it as well as
|
|
329
|
-
any HTML attributes associated with the component. `ExtractProps` takes an optional second argument.
|
|
330
|
-
If the second argument is omitted, like in the example above, the HTML attributes will be extracted
|
|
331
|
-
from the first argument of `createComponent`, which is the default element. In the case of
|
|
332
|
-
`MyComponent`, that would be `'div'`. You can tell by hovering over the `MyComponent` which will
|
|
333
|
-
show the type as `ElementComponent<'div', MyComponentProps>`.
|
|
334
|
-
|
|
335
|
-
The second argument should be used if you plan to change the base element of the component using the
|
|
336
|
-
`as` prop. This is required because Typescript has no way of knowing what the props will be outside
|
|
337
|
-
an `as` declaration. Here's an example of the `MyNewComponent` that renders `MyComponent` as an
|
|
338
|
-
`aside`.
|
|
339
|
-
|
|
340
|
-
```tsx
|
|
341
|
-
interface MyNewComponentProps extends ExtractProps<typeof MyComponent, 'aside'> {
|
|
342
|
-
foo: string;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
const MyNewComponent = ({foo, ...props}: MyNewComponentProps) => {
|
|
346
|
-
return (
|
|
347
|
-
<MyComponent as="aside" {...props}>
|
|
348
|
-
My Content
|
|
349
|
-
</MyComponent>
|
|
350
|
-
);
|
|
351
|
-
};
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
Note the `aside` used in both the props interface as well as the `as` in the JSX. This is useful if
|
|
355
|
-
your component uses props that come from the HTML attribute interface of a component, like `onClick`
|
|
356
|
-
that isn't explicitly declared in the original component prop interface like `MyComponentProps`. In
|
|
357
|
-
this example, `onClick` doesn't exist on `MyComponent`, but since `MyComponent` is an
|
|
358
|
-
`ElementComponent`, the `onClick` will be forwarded to the underlying `div` element.
|
|
359
|
-
|
|
360
|
-
If we inspect the `MyNewComponentProps` type, it will return the following:
|
|
361
|
-
|
|
362
|
-
```tsx
|
|
363
|
-
MyComponentProps & React.HTMLAttributes<HTMLElement>;
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
Inside Canvas Kit components, we use `ExtractProps` when we need to extend from the interfaces of
|
|
367
|
-
other components, but since our components are also dynamic based on the `as` props, we cannot
|
|
368
|
-
declare our HTML attribute interface yet. `ExtractProps` can take `never` as the second parameter
|
|
369
|
-
for this case, which means to only take the declared props of a component and not include the HTML
|
|
370
|
-
attributes.
|
|
371
|
-
|
|
372
|
-
```tsx
|
|
373
|
-
interface MyNewComponentProps extends ExtractProps<typeof MyComponent, never> {
|
|
374
|
-
foo: string;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
const MyNewComponent = createComponent('aside')(
|
|
378
|
-
displayName: 'MyNewComponent',
|
|
379
|
-
Component: (({foo, ...props}: MyNewComponentProps, ref, as) => {
|
|
380
|
-
return (
|
|
381
|
-
<MyComponent ref={ref} as={as} {...props}>
|
|
382
|
-
My Content
|
|
383
|
-
</MyComponent>
|
|
384
|
-
);
|
|
385
|
-
};
|
|
386
|
-
});
|
|
387
|
-
```
|
|
388
|
-
|
|
389
|
-
If the component is a `Component` and not an `ElementComponent`, only the prop interface will ever
|
|
390
|
-
be returned since there is not HTML attribute interface associated with `Component`.
|
|
391
|
-
|
|
392
|
-
## Common Hooks
|
|
393
|
-
|
|
394
|
-
### useUniqueId
|
|
395
|
-
|
|
396
|
-
A hook to generate a unique identifier for an element – most commonly used for accessibility. The
|
|
397
|
-
hook will generate a unique id the first render and always return the same id every render. This
|
|
398
|
-
uses [generateUniqueId](#generateuniqueid) internally. You should use `useUniqueId` when you need to
|
|
399
|
-
create a unique ID within a component's render loop. Otherwise, you should opt for
|
|
400
|
-
`generateUniqueId`.
|
|
401
|
-
|
|
402
|
-
```tsx
|
|
403
|
-
const MyComponent = () => {
|
|
404
|
-
const id = useUniqueId();
|
|
405
|
-
|
|
406
|
-
return <div id={id}>Hello!</div>;
|
|
407
|
-
};
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
If you wish to support user-defined ids, `useUniqueId` allows an optional id to override. This
|
|
411
|
-
provides a safe and easy way of handling id overrides without conditional hooks.
|
|
412
|
-
|
|
413
|
-
```tsx
|
|
414
|
-
const MyComponent = ({id}) => {
|
|
415
|
-
const localId = useUniqueId(id);
|
|
416
|
-
|
|
417
|
-
return <div id={localId}>Hello!</div>;
|
|
418
|
-
};
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
## Utility Functions
|
|
422
|
-
|
|
423
|
-
### generateUniqueId
|
|
424
|
-
|
|
425
|
-
Generates a unique and HTML5 compliant identifier every time it is called. Internally it uses a 4
|
|
426
|
-
character random seed starting with a letter. This seed is unique to each instance of this package
|
|
427
|
-
meaning different versions of Canvas Kit on the page will have a different seed. Each call will use
|
|
428
|
-
a Base 36 string (10 numbers + 26 letters) based on an incremented number. The incremented number
|
|
429
|
-
always starts at 0 and can be reset for testing purposes using
|
|
430
|
-
[resetUniqueIdCount](#resetuniqueidcount). [setUniqueSeed](#setuniqueseed) can also be used for
|
|
431
|
-
testing or server side rendering to get the same results during hydration.
|
|
432
|
-
|
|
433
|
-
```ts
|
|
434
|
-
const id1 = generateUniqueId(); // vi1e0
|
|
435
|
-
const id2 = generateUniqueId(); // vi1e1
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
### setUniqueSeed
|
|
439
|
-
|
|
440
|
-
Update the seed used by the id generator. This is useful for snapshot tests to help stabilize ids
|
|
441
|
-
generated each run. This could also be used for server-side hydration - if you choose the same seed
|
|
442
|
-
for server and set that on the client before components are rendered, the ids generated will be the
|
|
443
|
-
same.
|
|
444
|
-
|
|
445
|
-
For snapshot testing, this will help stabilize snapshot tests. Use in conjunction with
|
|
446
|
-
[resetUniqueIdCount](#resetuniqueidcount).
|
|
447
|
-
|
|
448
|
-
```ts
|
|
449
|
-
// set in a script tag from the server
|
|
450
|
-
setUniqueSeed(window.__ID_SEED); // set in a script tag from the server
|
|
451
|
-
|
|
452
|
-
// jest setup
|
|
453
|
-
before(() => {
|
|
454
|
-
setUniqueSeed('a');
|
|
455
|
-
});
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
### resetUniqueIdCount
|
|
459
|
-
|
|
460
|
-
This should only be called for tests in `beforeEach` for snapshot tests. Use in conjunction with
|
|
461
|
-
[setUniqueSeed](#setuniqueseed).
|
|
462
|
-
|
|
463
|
-
```ts
|
|
464
|
-
beforeEach(() => {
|
|
465
|
-
resetUniqueIdCount();
|
|
466
|
-
});
|
|
467
|
-
```
|