@workday/canvas-kit-labs-react 7.0.0-alpha.129-next.3 → 7.0.0-alpha.256-next.2

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 (228) hide show
  1. package/combobox/README.md +4 -4
  2. package/combobox/lib/AutocompleteList.tsx +4 -5
  3. package/combobox/lib/Combobox.tsx +10 -14
  4. package/common/index.ts +0 -2
  5. package/common/lib/theming/useThemeRTL.ts +11 -13
  6. package/dist/commonjs/combobox/lib/AutocompleteList.d.ts +2 -3
  7. package/dist/commonjs/combobox/lib/AutocompleteList.d.ts.map +1 -1
  8. package/dist/commonjs/combobox/lib/Combobox.d.ts +3 -4
  9. package/dist/commonjs/combobox/lib/Combobox.d.ts.map +1 -1
  10. package/dist/commonjs/combobox/lib/Combobox.js +1 -5
  11. package/dist/commonjs/common/index.d.ts +0 -2
  12. package/dist/commonjs/common/index.d.ts.map +1 -1
  13. package/dist/commonjs/common/index.js +0 -5
  14. package/dist/commonjs/common/lib/theming/useThemeRTL.d.ts.map +1 -1
  15. package/dist/commonjs/common/lib/theming/useThemeRTL.js +6 -8
  16. package/dist/commonjs/drawer/index.d.ts +1 -1
  17. package/dist/commonjs/drawer/index.d.ts.map +1 -1
  18. package/dist/commonjs/drawer/index.js +2 -2
  19. package/dist/commonjs/drawer/lib/Drawer.d.ts +39 -14
  20. package/dist/commonjs/drawer/lib/Drawer.d.ts.map +1 -1
  21. package/dist/commonjs/drawer/lib/Drawer.js +39 -21
  22. package/dist/commonjs/drawer/lib/DrawerHeader.d.ts +24 -7
  23. package/dist/commonjs/drawer/lib/DrawerHeader.d.ts.map +1 -1
  24. package/dist/commonjs/drawer/lib/DrawerHeader.js +22 -15
  25. package/dist/commonjs/expandable/index.d.ts +3 -0
  26. package/dist/commonjs/expandable/index.d.ts.map +1 -0
  27. package/dist/commonjs/expandable/index.js +14 -0
  28. package/dist/commonjs/expandable/lib/Expandable.d.ts +75 -0
  29. package/dist/commonjs/expandable/lib/Expandable.d.ts.map +1 -0
  30. package/dist/commonjs/expandable/lib/Expandable.js +50 -0
  31. package/dist/commonjs/expandable/lib/ExpandableAvatar.d.ts +7 -0
  32. package/dist/commonjs/expandable/lib/ExpandableAvatar.d.ts.map +1 -0
  33. package/dist/commonjs/expandable/lib/ExpandableAvatar.js +46 -0
  34. package/dist/commonjs/expandable/lib/ExpandableContent.d.ts +19 -0
  35. package/dist/commonjs/expandable/lib/ExpandableContent.d.ts.map +1 -0
  36. package/dist/commonjs/expandable/lib/ExpandableContent.js +41 -0
  37. package/dist/commonjs/expandable/lib/ExpandableIcon.d.ts +29 -0
  38. package/dist/commonjs/expandable/lib/ExpandableIcon.d.ts.map +1 -0
  39. package/dist/commonjs/expandable/lib/ExpandableIcon.js +62 -0
  40. package/dist/commonjs/expandable/lib/ExpandableTarget.d.ts +28 -0
  41. package/dist/commonjs/expandable/lib/ExpandableTarget.d.ts.map +1 -0
  42. package/dist/commonjs/expandable/lib/ExpandableTarget.js +48 -0
  43. package/dist/commonjs/expandable/lib/ExpandableTitle.d.ts +9 -0
  44. package/dist/commonjs/expandable/lib/ExpandableTitle.d.ts.map +1 -0
  45. package/dist/commonjs/expandable/lib/ExpandableTitle.js +39 -0
  46. package/dist/commonjs/expandable/lib/hooks/index.d.ts +4 -0
  47. package/dist/commonjs/expandable/lib/hooks/index.d.ts.map +1 -0
  48. package/dist/commonjs/expandable/lib/hooks/index.js +15 -0
  49. package/dist/commonjs/expandable/lib/hooks/useExpandableContent.d.ts +20 -0
  50. package/dist/commonjs/expandable/lib/hooks/useExpandableContent.d.ts.map +1 -0
  51. package/dist/commonjs/expandable/lib/hooks/useExpandableContent.js +12 -0
  52. package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.d.ts +15 -0
  53. package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.d.ts.map +1 -0
  54. package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.js +11 -0
  55. package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.d.ts +17 -0
  56. package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.d.ts.map +1 -0
  57. package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.js +20 -0
  58. package/dist/commonjs/expandable/lib/useExpandableModel.d.ts +50 -0
  59. package/dist/commonjs/expandable/lib/useExpandableModel.d.ts.map +1 -0
  60. package/dist/commonjs/expandable/lib/useExpandableModel.js +24 -0
  61. package/dist/commonjs/index.d.ts +2 -0
  62. package/dist/commonjs/index.d.ts.map +1 -1
  63. package/dist/commonjs/index.js +2 -0
  64. package/dist/commonjs/search-form/lib/SearchForm.d.ts +1 -2
  65. package/dist/commonjs/search-form/lib/SearchForm.d.ts.map +1 -1
  66. package/dist/commonjs/search-form/lib/SearchForm.js +2 -4
  67. package/dist/commonjs/toast/index.d.ts +3 -0
  68. package/dist/commonjs/toast/index.d.ts.map +1 -0
  69. package/dist/commonjs/toast/index.js +14 -0
  70. package/dist/commonjs/toast/lib/Toast.d.ts +27 -0
  71. package/dist/commonjs/toast/lib/Toast.d.ts.map +1 -0
  72. package/dist/commonjs/toast/lib/Toast.js +78 -0
  73. package/dist/commonjs/toast/lib/ToastBody.d.ts +6 -0
  74. package/dist/commonjs/toast/lib/ToastBody.d.ts.map +1 -0
  75. package/dist/commonjs/toast/lib/ToastBody.js +40 -0
  76. package/dist/commonjs/toast/lib/ToastCloseIcon.d.ts +6 -0
  77. package/dist/commonjs/toast/lib/ToastCloseIcon.d.ts.map +1 -0
  78. package/dist/commonjs/toast/lib/ToastCloseIcon.js +43 -0
  79. package/dist/commonjs/toast/lib/ToastIcon.d.ts +5 -0
  80. package/dist/commonjs/toast/lib/ToastIcon.d.ts.map +1 -0
  81. package/dist/commonjs/toast/lib/ToastIcon.js +26 -0
  82. package/dist/commonjs/toast/lib/ToastLink.d.ts +9 -0
  83. package/dist/commonjs/toast/lib/ToastLink.d.ts.map +1 -0
  84. package/dist/commonjs/toast/lib/ToastLink.js +42 -0
  85. package/dist/commonjs/toast/lib/ToastMessage.d.ts +11 -0
  86. package/dist/commonjs/toast/lib/ToastMessage.d.ts.map +1 -0
  87. package/dist/commonjs/toast/lib/ToastMessage.js +41 -0
  88. package/dist/commonjs/toast/lib/hooks/useToastModel.d.ts +65 -0
  89. package/dist/commonjs/toast/lib/hooks/useToastModel.d.ts.map +1 -0
  90. package/dist/commonjs/toast/lib/hooks/useToastModel.js +35 -0
  91. package/dist/es6/combobox/lib/AutocompleteList.d.ts +2 -3
  92. package/dist/es6/combobox/lib/AutocompleteList.d.ts.map +1 -1
  93. package/dist/es6/combobox/lib/Combobox.d.ts +3 -4
  94. package/dist/es6/combobox/lib/Combobox.d.ts.map +1 -1
  95. package/dist/es6/combobox/lib/Combobox.js +1 -5
  96. package/dist/es6/common/index.d.ts +0 -2
  97. package/dist/es6/common/index.d.ts.map +1 -1
  98. package/dist/es6/common/index.js +0 -2
  99. package/dist/es6/common/lib/theming/useThemeRTL.d.ts.map +1 -1
  100. package/dist/es6/common/lib/theming/useThemeRTL.js +7 -9
  101. package/dist/es6/drawer/index.d.ts +1 -1
  102. package/dist/es6/drawer/index.d.ts.map +1 -1
  103. package/dist/es6/drawer/index.js +1 -1
  104. package/dist/es6/drawer/lib/Drawer.d.ts +39 -14
  105. package/dist/es6/drawer/lib/Drawer.d.ts.map +1 -1
  106. package/dist/es6/drawer/lib/Drawer.js +38 -20
  107. package/dist/es6/drawer/lib/DrawerHeader.d.ts +24 -7
  108. package/dist/es6/drawer/lib/DrawerHeader.d.ts.map +1 -1
  109. package/dist/es6/drawer/lib/DrawerHeader.js +22 -15
  110. package/dist/es6/expandable/index.d.ts +3 -0
  111. package/dist/es6/expandable/index.d.ts.map +1 -0
  112. package/dist/es6/expandable/index.js +2 -0
  113. package/dist/es6/expandable/lib/Expandable.d.ts +75 -0
  114. package/dist/es6/expandable/lib/Expandable.d.ts.map +1 -0
  115. package/dist/es6/expandable/lib/Expandable.js +44 -0
  116. package/dist/es6/expandable/lib/ExpandableAvatar.d.ts +7 -0
  117. package/dist/es6/expandable/lib/ExpandableAvatar.d.ts.map +1 -0
  118. package/dist/es6/expandable/lib/ExpandableAvatar.js +40 -0
  119. package/dist/es6/expandable/lib/ExpandableContent.d.ts +19 -0
  120. package/dist/es6/expandable/lib/ExpandableContent.d.ts.map +1 -0
  121. package/dist/es6/expandable/lib/ExpandableContent.js +35 -0
  122. package/dist/es6/expandable/lib/ExpandableIcon.d.ts +29 -0
  123. package/dist/es6/expandable/lib/ExpandableIcon.d.ts.map +1 -0
  124. package/dist/es6/expandable/lib/ExpandableIcon.js +56 -0
  125. package/dist/es6/expandable/lib/ExpandableTarget.d.ts +28 -0
  126. package/dist/es6/expandable/lib/ExpandableTarget.d.ts.map +1 -0
  127. package/dist/es6/expandable/lib/ExpandableTarget.js +42 -0
  128. package/dist/es6/expandable/lib/ExpandableTitle.d.ts +9 -0
  129. package/dist/es6/expandable/lib/ExpandableTitle.d.ts.map +1 -0
  130. package/dist/es6/expandable/lib/ExpandableTitle.js +33 -0
  131. package/dist/es6/expandable/lib/hooks/index.d.ts +4 -0
  132. package/dist/es6/expandable/lib/hooks/index.d.ts.map +1 -0
  133. package/dist/es6/expandable/lib/hooks/index.js +3 -0
  134. package/dist/es6/expandable/lib/hooks/useExpandableContent.d.ts +20 -0
  135. package/dist/es6/expandable/lib/hooks/useExpandableContent.d.ts.map +1 -0
  136. package/dist/es6/expandable/lib/hooks/useExpandableContent.js +9 -0
  137. package/dist/es6/expandable/lib/hooks/useExpandableIcon.d.ts +15 -0
  138. package/dist/es6/expandable/lib/hooks/useExpandableIcon.d.ts.map +1 -0
  139. package/dist/es6/expandable/lib/hooks/useExpandableIcon.js +8 -0
  140. package/dist/es6/expandable/lib/hooks/useExpandableTarget.d.ts +17 -0
  141. package/dist/es6/expandable/lib/hooks/useExpandableTarget.d.ts.map +1 -0
  142. package/dist/es6/expandable/lib/hooks/useExpandableTarget.js +17 -0
  143. package/dist/es6/expandable/lib/useExpandableModel.d.ts +50 -0
  144. package/dist/es6/expandable/lib/useExpandableModel.d.ts.map +1 -0
  145. package/dist/es6/expandable/lib/useExpandableModel.js +21 -0
  146. package/dist/es6/index.d.ts +2 -0
  147. package/dist/es6/index.d.ts.map +1 -1
  148. package/dist/es6/index.js +2 -0
  149. package/dist/es6/search-form/lib/SearchForm.d.ts +1 -2
  150. package/dist/es6/search-form/lib/SearchForm.d.ts.map +1 -1
  151. package/dist/es6/search-form/lib/SearchForm.js +2 -4
  152. package/dist/es6/toast/index.d.ts +3 -0
  153. package/dist/es6/toast/index.d.ts.map +1 -0
  154. package/dist/es6/toast/index.js +2 -0
  155. package/dist/es6/toast/lib/Toast.d.ts +27 -0
  156. package/dist/es6/toast/lib/Toast.d.ts.map +1 -0
  157. package/dist/es6/toast/lib/Toast.js +72 -0
  158. package/dist/es6/toast/lib/ToastBody.d.ts +6 -0
  159. package/dist/es6/toast/lib/ToastBody.d.ts.map +1 -0
  160. package/dist/es6/toast/lib/ToastBody.js +34 -0
  161. package/dist/es6/toast/lib/ToastCloseIcon.d.ts +6 -0
  162. package/dist/es6/toast/lib/ToastCloseIcon.d.ts.map +1 -0
  163. package/dist/es6/toast/lib/ToastCloseIcon.js +37 -0
  164. package/dist/es6/toast/lib/ToastIcon.d.ts +5 -0
  165. package/dist/es6/toast/lib/ToastIcon.d.ts.map +1 -0
  166. package/dist/es6/toast/lib/ToastIcon.js +20 -0
  167. package/dist/es6/toast/lib/ToastLink.d.ts +9 -0
  168. package/dist/es6/toast/lib/ToastLink.d.ts.map +1 -0
  169. package/dist/es6/toast/lib/ToastLink.js +36 -0
  170. package/dist/es6/toast/lib/ToastMessage.d.ts +11 -0
  171. package/dist/es6/toast/lib/ToastMessage.d.ts.map +1 -0
  172. package/dist/es6/toast/lib/ToastMessage.js +35 -0
  173. package/dist/es6/toast/lib/hooks/useToastModel.d.ts +65 -0
  174. package/dist/es6/toast/lib/hooks/useToastModel.d.ts.map +1 -0
  175. package/dist/es6/toast/lib/hooks/useToastModel.js +32 -0
  176. package/drawer/index.ts +1 -1
  177. package/drawer/lib/Drawer.tsx +61 -24
  178. package/drawer/lib/DrawerHeader.tsx +54 -26
  179. package/expandable/LICENSE +52 -0
  180. package/expandable/README.md +11 -0
  181. package/expandable/index.ts +2 -0
  182. package/expandable/lib/Expandable.tsx +34 -0
  183. package/expandable/lib/ExpandableAvatar.tsx +26 -0
  184. package/expandable/lib/ExpandableContent.tsx +32 -0
  185. package/expandable/lib/ExpandableIcon.tsx +74 -0
  186. package/expandable/lib/ExpandableTarget.tsx +67 -0
  187. package/expandable/lib/ExpandableTitle.tsx +34 -0
  188. package/expandable/lib/hooks/index.ts +3 -0
  189. package/expandable/lib/hooks/useExpandableContent.ts +9 -0
  190. package/expandable/lib/hooks/useExpandableIcon.ts +8 -0
  191. package/expandable/lib/hooks/useExpandableTarget.ts +16 -0
  192. package/expandable/lib/useExpandableModel.tsx +17 -0
  193. package/expandable/package.json +6 -0
  194. package/index.ts +2 -0
  195. package/package.json +4 -4
  196. package/search-form/lib/SearchForm.tsx +2 -6
  197. package/toast/LICENSE +52 -0
  198. package/toast/README.md +5 -0
  199. package/toast/index.ts +2 -0
  200. package/toast/lib/Toast.tsx +63 -0
  201. package/toast/lib/ToastBody.tsx +34 -0
  202. package/toast/lib/ToastCloseIcon.tsx +18 -0
  203. package/toast/lib/ToastIcon.tsx +24 -0
  204. package/toast/lib/ToastLink.tsx +27 -0
  205. package/toast/lib/ToastMessage.tsx +21 -0
  206. package/toast/lib/hooks/useToastModel.tsx +27 -0
  207. package/toast/package.json +6 -0
  208. package/common/lib/storybook-utils/ComponentStatesTable.tsx +0 -80
  209. package/common/lib/storybook-utils/permutateProps.ts +0 -47
  210. package/common/lib/storybook-utils/propTypes.ts +0 -15
  211. package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.d.ts +0 -26
  212. package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.d.ts.map +0 -1
  213. package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.js +0 -48
  214. package/dist/commonjs/common/lib/storybook-utils/permutateProps.d.ts +0 -5
  215. package/dist/commonjs/common/lib/storybook-utils/permutateProps.d.ts.map +0 -1
  216. package/dist/commonjs/common/lib/storybook-utils/permutateProps.js +0 -47
  217. package/dist/commonjs/common/lib/storybook-utils/propTypes.d.ts +0 -15
  218. package/dist/commonjs/common/lib/storybook-utils/propTypes.d.ts.map +0 -1
  219. package/dist/commonjs/common/lib/storybook-utils/propTypes.js +0 -2
  220. package/dist/es6/common/lib/storybook-utils/ComponentStatesTable.d.ts +0 -26
  221. package/dist/es6/common/lib/storybook-utils/ComponentStatesTable.d.ts.map +0 -1
  222. package/dist/es6/common/lib/storybook-utils/ComponentStatesTable.js +0 -41
  223. package/dist/es6/common/lib/storybook-utils/permutateProps.d.ts +0 -5
  224. package/dist/es6/common/lib/storybook-utils/permutateProps.d.ts.map +0 -1
  225. package/dist/es6/common/lib/storybook-utils/permutateProps.js +0 -43
  226. package/dist/es6/common/lib/storybook-utils/propTypes.d.ts +0 -15
  227. package/dist/es6/common/lib/storybook-utils/propTypes.d.ts.map +0 -1
  228. package/dist/es6/common/lib/storybook-utils/propTypes.js +0 -1
@@ -1,47 +0,0 @@
1
- import {PropCombination, PropDeclaration, Props, PropsDeclaration} from './propTypes';
2
-
3
- export const permutateProps = (
4
- allProps: PropsDeclaration,
5
- filter?: (props: Props) => boolean,
6
- remainingProps: string[] = Object.keys(allProps),
7
- values: {[key: string]: PropDeclaration} = {}
8
- ): PropCombination[] => {
9
- // When there are no more props to combine with, return result
10
- const prop = remainingProps[0];
11
- if (!prop) {
12
- const props: Props = {};
13
- Object.keys(values).forEach(prop => {
14
- props[prop] = values?.[prop]?.value;
15
- });
16
-
17
- if (filter && !filter(props)) {
18
- return [];
19
- }
20
-
21
- const label = Object.keys(values)
22
- .map(prop => values?.[prop]?.label)
23
- .join(' ');
24
-
25
- return [
26
- {
27
- label,
28
- props,
29
- },
30
- ];
31
- }
32
- const possiblePropValues = allProps[prop];
33
-
34
- const permutations = possiblePropValues?.map((value: PropDeclaration) => {
35
- const newValues = {...values}; // Required so we don't overwrite previous references
36
- newValues[prop] = value;
37
-
38
- return permutateProps(
39
- allProps,
40
- filter,
41
- remainingProps!.slice(1, remainingProps!.length),
42
- newValues
43
- );
44
- });
45
-
46
- return (permutations as any).flat();
47
- };
@@ -1,15 +0,0 @@
1
- export type PropDeclaration = {
2
- value: any;
3
- label: string;
4
- };
5
-
6
- export type PropsDeclaration = {[key: string]: PropDeclaration[]};
7
-
8
- export type Props = {
9
- [key: string]: any;
10
- };
11
-
12
- export type PropCombination = {
13
- label: string;
14
- props: Props;
15
- };
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import { PropCombination, Props } from './propTypes';
3
- /**
4
- * A helper to generate a table of all possible states for component visual testing.
5
- */
6
- export interface ComponentStatesTableProps {
7
- /**
8
- * The props that will be passed to the component when it is rendered and the corresponding
9
- * row label for that permutation. It is encouraged to use the result of permutateProps()
10
- * rather than passing in a list so we don't miss any combinations.
11
- */
12
- rowProps: PropCombination[];
13
- /**
14
- * The props that will be passed to the component when it is rendered and the corresponding
15
- * column label for that permutation. It is encouraged to use the result of permutateProps()
16
- * rather than passing in a list so we don't miss any combinations.
17
- */
18
- columnProps: PropCombination[];
19
- /**
20
- * The render function called to render the component in each cell of the table. This gives you
21
- * the ability to add extra styling or markup (a blue background for an inverse variant, for example).
22
- */
23
- children(props: Props): React.ReactNode;
24
- }
25
- export declare const ComponentStatesTable: ({ rowProps, columnProps, children, }: ComponentStatesTableProps) => JSX.Element;
26
- //# sourceMappingURL=ComponentStatesTable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComponentStatesTable.d.ts","sourceRoot":"","sources":["../../../../../common/lib/storybook-utils/ComponentStatesTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,eAAe,EAAE,KAAK,EAAC,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B;;;;OAIG;IACH,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC;CACzC;AAgBD,eAAO,MAAM,oBAAoB,yCAI9B,yBAAyB,gBAkC3B,CAAC"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __importDefault = (this && this.__importDefault) || function (mod) {
14
- return (mod && mod.__esModule) ? mod : { "default": mod };
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.ComponentStatesTable = void 0;
18
- var react_1 = __importDefault(require("react"));
19
- var common_1 = require("@workday/canvas-kit-react/common");
20
- var Table = common_1.styled('table')({
21
- width: '100%',
22
- thead: {
23
- textAlign: 'left',
24
- paddingBottom: 16,
25
- },
26
- 'td, th': {
27
- minWidth: 100,
28
- paddingBottom: 16,
29
- paddingRight: 16,
30
- textAlign: 'left',
31
- },
32
- });
33
- var ComponentStatesTable = function (_a) {
34
- var rowProps = _a.rowProps, columnProps = _a.columnProps, children = _a.children;
35
- return (react_1.default.createElement(Table, null,
36
- react_1.default.createElement("thead", null,
37
- react_1.default.createElement("tr", null,
38
- react_1.default.createElement("th", null, "Variants"),
39
- columnProps.map(function (col) { return (react_1.default.createElement("th", { key: "component-table-heading-" + col.label.toLowerCase().replace(' ', ',') }, col.label)); }))),
40
- react_1.default.createElement("tbody", null, rowProps.map(function (row) {
41
- return (react_1.default.createElement("tr", { key: row.label.toLowerCase().replace(' ', '-') },
42
- react_1.default.createElement("td", null, row.label),
43
- columnProps.map(function (col) {
44
- return (react_1.default.createElement("td", { key: col.label.toLowerCase().replace(' ', '-') }, children(__assign(__assign({}, row.props), col.props))));
45
- })));
46
- }))));
47
- };
48
- exports.ComponentStatesTable = ComponentStatesTable;
@@ -1,5 +0,0 @@
1
- import { PropCombination, PropDeclaration, Props, PropsDeclaration } from './propTypes';
2
- export declare const permutateProps: (allProps: PropsDeclaration, filter?: ((props: Props) => boolean) | undefined, remainingProps?: string[], values?: {
3
- [key: string]: PropDeclaration;
4
- }) => PropCombination[];
5
- //# sourceMappingURL=permutateProps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"permutateProps.d.ts","sourceRoot":"","sources":["../../../../../common/lib/storybook-utils/permutateProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAEtF,eAAO,MAAM,cAAc,aACf,gBAAgB,oBACT,KAAK,KAAK,OAAO,gCAClB,MAAM,EAAE;;MAEvB,eAAe,EAuCjB,CAAC"}
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- Object.defineProperty(exports, "__esModule", { value: true });
14
- exports.permutateProps = void 0;
15
- var permutateProps = function (allProps, filter, remainingProps, values) {
16
- if (remainingProps === void 0) { remainingProps = Object.keys(allProps); }
17
- if (values === void 0) { values = {}; }
18
- // When there are no more props to combine with, return result
19
- var prop = remainingProps[0];
20
- if (!prop) {
21
- var props_1 = {};
22
- Object.keys(values).forEach(function (prop) {
23
- var _a;
24
- props_1[prop] = (_a = values === null || values === void 0 ? void 0 : values[prop]) === null || _a === void 0 ? void 0 : _a.value;
25
- });
26
- if (filter && !filter(props_1)) {
27
- return [];
28
- }
29
- var label = Object.keys(values)
30
- .map(function (prop) { var _a; return (_a = values === null || values === void 0 ? void 0 : values[prop]) === null || _a === void 0 ? void 0 : _a.label; })
31
- .join(' ');
32
- return [
33
- {
34
- label: label,
35
- props: props_1,
36
- },
37
- ];
38
- }
39
- var possiblePropValues = allProps[prop];
40
- var permutations = possiblePropValues === null || possiblePropValues === void 0 ? void 0 : possiblePropValues.map(function (value) {
41
- var newValues = __assign({}, values); // Required so we don't overwrite previous references
42
- newValues[prop] = value;
43
- return exports.permutateProps(allProps, filter, remainingProps.slice(1, remainingProps.length), newValues);
44
- });
45
- return permutations.flat();
46
- };
47
- exports.permutateProps = permutateProps;
@@ -1,15 +0,0 @@
1
- export declare type PropDeclaration = {
2
- value: any;
3
- label: string;
4
- };
5
- export declare type PropsDeclaration = {
6
- [key: string]: PropDeclaration[];
7
- };
8
- export declare type Props = {
9
- [key: string]: any;
10
- };
11
- export declare type PropCombination = {
12
- label: string;
13
- props: Props;
14
- };
15
- //# sourceMappingURL=propTypes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"propTypes.d.ts","sourceRoot":"","sources":["../../../../../common/lib/storybook-utils/propTypes.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe,GAAG;IAC5B,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,CAAA;CAAC,CAAC;AAElE,oBAAY,KAAK,GAAG;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAEF,oBAAY,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;CACd,CAAC"}
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,26 +0,0 @@
1
- import React from 'react';
2
- import { PropCombination, Props } from './propTypes';
3
- /**
4
- * A helper to generate a table of all possible states for component visual testing.
5
- */
6
- export interface ComponentStatesTableProps {
7
- /**
8
- * The props that will be passed to the component when it is rendered and the corresponding
9
- * row label for that permutation. It is encouraged to use the result of permutateProps()
10
- * rather than passing in a list so we don't miss any combinations.
11
- */
12
- rowProps: PropCombination[];
13
- /**
14
- * The props that will be passed to the component when it is rendered and the corresponding
15
- * column label for that permutation. It is encouraged to use the result of permutateProps()
16
- * rather than passing in a list so we don't miss any combinations.
17
- */
18
- columnProps: PropCombination[];
19
- /**
20
- * The render function called to render the component in each cell of the table. This gives you
21
- * the ability to add extra styling or markup (a blue background for an inverse variant, for example).
22
- */
23
- children(props: Props): React.ReactNode;
24
- }
25
- export declare const ComponentStatesTable: ({ rowProps, columnProps, children, }: ComponentStatesTableProps) => JSX.Element;
26
- //# sourceMappingURL=ComponentStatesTable.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ComponentStatesTable.d.ts","sourceRoot":"","sources":["../../../../../common/lib/storybook-utils/ComponentStatesTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,eAAe,EAAE,KAAK,EAAC,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B;;;;OAIG;IACH,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC;CACzC;AAgBD,eAAO,MAAM,oBAAoB,yCAI9B,yBAAyB,gBAkC3B,CAAC"}
@@ -1,41 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import React from 'react';
13
- import { styled } from '@workday/canvas-kit-react/common';
14
- var Table = styled('table')({
15
- width: '100%',
16
- thead: {
17
- textAlign: 'left',
18
- paddingBottom: 16,
19
- },
20
- 'td, th': {
21
- minWidth: 100,
22
- paddingBottom: 16,
23
- paddingRight: 16,
24
- textAlign: 'left',
25
- },
26
- });
27
- export var ComponentStatesTable = function (_a) {
28
- var rowProps = _a.rowProps, columnProps = _a.columnProps, children = _a.children;
29
- return (React.createElement(Table, null,
30
- React.createElement("thead", null,
31
- React.createElement("tr", null,
32
- React.createElement("th", null, "Variants"),
33
- columnProps.map(function (col) { return (React.createElement("th", { key: "component-table-heading-" + col.label.toLowerCase().replace(' ', ',') }, col.label)); }))),
34
- React.createElement("tbody", null, rowProps.map(function (row) {
35
- return (React.createElement("tr", { key: row.label.toLowerCase().replace(' ', '-') },
36
- React.createElement("td", null, row.label),
37
- columnProps.map(function (col) {
38
- return (React.createElement("td", { key: col.label.toLowerCase().replace(' ', '-') }, children(__assign(__assign({}, row.props), col.props))));
39
- })));
40
- }))));
41
- };
@@ -1,5 +0,0 @@
1
- import { PropCombination, PropDeclaration, Props, PropsDeclaration } from './propTypes';
2
- export declare const permutateProps: (allProps: PropsDeclaration, filter?: ((props: Props) => boolean) | undefined, remainingProps?: string[], values?: {
3
- [key: string]: PropDeclaration;
4
- }) => PropCombination[];
5
- //# sourceMappingURL=permutateProps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"permutateProps.d.ts","sourceRoot":"","sources":["../../../../../common/lib/storybook-utils/permutateProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAEtF,eAAO,MAAM,cAAc,aACf,gBAAgB,oBACT,KAAK,KAAK,OAAO,gCAClB,MAAM,EAAE;;MAEvB,eAAe,EAuCjB,CAAC"}
@@ -1,43 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- export var permutateProps = function (allProps, filter, remainingProps, values) {
13
- if (remainingProps === void 0) { remainingProps = Object.keys(allProps); }
14
- if (values === void 0) { values = {}; }
15
- // When there are no more props to combine with, return result
16
- var prop = remainingProps[0];
17
- if (!prop) {
18
- var props_1 = {};
19
- Object.keys(values).forEach(function (prop) {
20
- var _a;
21
- props_1[prop] = (_a = values === null || values === void 0 ? void 0 : values[prop]) === null || _a === void 0 ? void 0 : _a.value;
22
- });
23
- if (filter && !filter(props_1)) {
24
- return [];
25
- }
26
- var label = Object.keys(values)
27
- .map(function (prop) { var _a; return (_a = values === null || values === void 0 ? void 0 : values[prop]) === null || _a === void 0 ? void 0 : _a.label; })
28
- .join(' ');
29
- return [
30
- {
31
- label: label,
32
- props: props_1,
33
- },
34
- ];
35
- }
36
- var possiblePropValues = allProps[prop];
37
- var permutations = possiblePropValues === null || possiblePropValues === void 0 ? void 0 : possiblePropValues.map(function (value) {
38
- var newValues = __assign({}, values); // Required so we don't overwrite previous references
39
- newValues[prop] = value;
40
- return permutateProps(allProps, filter, remainingProps.slice(1, remainingProps.length), newValues);
41
- });
42
- return permutations.flat();
43
- };
@@ -1,15 +0,0 @@
1
- export declare type PropDeclaration = {
2
- value: any;
3
- label: string;
4
- };
5
- export declare type PropsDeclaration = {
6
- [key: string]: PropDeclaration[];
7
- };
8
- export declare type Props = {
9
- [key: string]: any;
10
- };
11
- export declare type PropCombination = {
12
- label: string;
13
- props: Props;
14
- };
15
- //# sourceMappingURL=propTypes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"propTypes.d.ts","sourceRoot":"","sources":["../../../../../common/lib/storybook-utils/propTypes.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe,GAAG;IAC5B,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,CAAA;CAAC,CAAC;AAElE,oBAAY,KAAK,GAAG;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAEF,oBAAY,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;CACd,CAAC"}
@@ -1 +0,0 @@
1
- export {};