@workday/canvas-kit-labs-react 7.0.0-alpha.140-next.6 → 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.
- package/combobox/README.md +4 -4
- package/combobox/lib/AutocompleteList.tsx +4 -5
- package/combobox/lib/Combobox.tsx +10 -14
- package/common/index.ts +0 -2
- package/common/lib/theming/useThemeRTL.ts +11 -13
- package/dist/commonjs/combobox/lib/AutocompleteList.d.ts +2 -3
- package/dist/commonjs/combobox/lib/AutocompleteList.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/Combobox.d.ts +3 -4
- package/dist/commonjs/combobox/lib/Combobox.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/Combobox.js +1 -5
- package/dist/commonjs/common/index.d.ts +0 -2
- package/dist/commonjs/common/index.d.ts.map +1 -1
- package/dist/commonjs/common/index.js +0 -5
- package/dist/commonjs/common/lib/theming/useThemeRTL.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/useThemeRTL.js +6 -8
- package/dist/commonjs/drawer/index.d.ts +1 -1
- package/dist/commonjs/drawer/index.d.ts.map +1 -1
- package/dist/commonjs/drawer/index.js +2 -2
- package/dist/commonjs/drawer/lib/Drawer.d.ts +39 -14
- package/dist/commonjs/drawer/lib/Drawer.d.ts.map +1 -1
- package/dist/commonjs/drawer/lib/Drawer.js +39 -21
- package/dist/commonjs/drawer/lib/DrawerHeader.d.ts +24 -7
- package/dist/commonjs/drawer/lib/DrawerHeader.d.ts.map +1 -1
- package/dist/commonjs/drawer/lib/DrawerHeader.js +22 -15
- package/dist/commonjs/expandable/index.d.ts +3 -0
- package/dist/commonjs/expandable/index.d.ts.map +1 -0
- package/dist/commonjs/expandable/index.js +14 -0
- package/dist/commonjs/expandable/lib/Expandable.d.ts +75 -0
- package/dist/commonjs/expandable/lib/Expandable.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/Expandable.js +50 -0
- package/dist/commonjs/expandable/lib/ExpandableAvatar.d.ts +7 -0
- package/dist/commonjs/expandable/lib/ExpandableAvatar.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/ExpandableAvatar.js +46 -0
- package/dist/commonjs/expandable/lib/ExpandableContent.d.ts +19 -0
- package/dist/commonjs/expandable/lib/ExpandableContent.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/ExpandableContent.js +41 -0
- package/dist/commonjs/expandable/lib/ExpandableIcon.d.ts +29 -0
- package/dist/commonjs/expandable/lib/ExpandableIcon.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/ExpandableIcon.js +62 -0
- package/dist/commonjs/expandable/lib/ExpandableTarget.d.ts +28 -0
- package/dist/commonjs/expandable/lib/ExpandableTarget.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/ExpandableTarget.js +48 -0
- package/dist/commonjs/expandable/lib/ExpandableTitle.d.ts +9 -0
- package/dist/commonjs/expandable/lib/ExpandableTitle.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/ExpandableTitle.js +39 -0
- package/dist/commonjs/expandable/lib/hooks/index.d.ts +4 -0
- package/dist/commonjs/expandable/lib/hooks/index.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/hooks/index.js +15 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableContent.d.ts +20 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableContent.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableContent.js +12 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.d.ts +15 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.js +11 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.d.ts +17 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.js +20 -0
- package/dist/commonjs/expandable/lib/useExpandableModel.d.ts +50 -0
- package/dist/commonjs/expandable/lib/useExpandableModel.d.ts.map +1 -0
- package/dist/commonjs/expandable/lib/useExpandableModel.js +24 -0
- package/dist/commonjs/index.d.ts +2 -0
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +2 -0
- package/dist/commonjs/search-form/lib/SearchForm.d.ts +1 -2
- package/dist/commonjs/search-form/lib/SearchForm.d.ts.map +1 -1
- package/dist/commonjs/search-form/lib/SearchForm.js +2 -4
- package/dist/commonjs/toast/index.d.ts +3 -0
- package/dist/commonjs/toast/index.d.ts.map +1 -0
- package/dist/commonjs/toast/index.js +14 -0
- package/dist/commonjs/toast/lib/Toast.d.ts +27 -0
- package/dist/commonjs/toast/lib/Toast.d.ts.map +1 -0
- package/dist/commonjs/toast/lib/Toast.js +78 -0
- package/dist/commonjs/toast/lib/ToastBody.d.ts +6 -0
- package/dist/commonjs/toast/lib/ToastBody.d.ts.map +1 -0
- package/dist/commonjs/toast/lib/ToastBody.js +40 -0
- package/dist/commonjs/toast/lib/ToastCloseIcon.d.ts +6 -0
- package/dist/commonjs/toast/lib/ToastCloseIcon.d.ts.map +1 -0
- package/dist/commonjs/toast/lib/ToastCloseIcon.js +43 -0
- package/dist/commonjs/toast/lib/ToastIcon.d.ts +5 -0
- package/dist/commonjs/toast/lib/ToastIcon.d.ts.map +1 -0
- package/dist/commonjs/toast/lib/ToastIcon.js +26 -0
- package/dist/commonjs/toast/lib/ToastLink.d.ts +9 -0
- package/dist/commonjs/toast/lib/ToastLink.d.ts.map +1 -0
- package/dist/commonjs/toast/lib/ToastLink.js +42 -0
- package/dist/commonjs/toast/lib/ToastMessage.d.ts +11 -0
- package/dist/commonjs/toast/lib/ToastMessage.d.ts.map +1 -0
- package/dist/commonjs/toast/lib/ToastMessage.js +41 -0
- package/dist/commonjs/toast/lib/hooks/useToastModel.d.ts +65 -0
- package/dist/commonjs/toast/lib/hooks/useToastModel.d.ts.map +1 -0
- package/dist/commonjs/toast/lib/hooks/useToastModel.js +35 -0
- package/dist/es6/combobox/lib/AutocompleteList.d.ts +2 -3
- package/dist/es6/combobox/lib/AutocompleteList.d.ts.map +1 -1
- package/dist/es6/combobox/lib/Combobox.d.ts +3 -4
- package/dist/es6/combobox/lib/Combobox.d.ts.map +1 -1
- package/dist/es6/combobox/lib/Combobox.js +1 -5
- package/dist/es6/common/index.d.ts +0 -2
- package/dist/es6/common/index.d.ts.map +1 -1
- package/dist/es6/common/index.js +0 -2
- package/dist/es6/common/lib/theming/useThemeRTL.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/useThemeRTL.js +7 -9
- package/dist/es6/drawer/index.d.ts +1 -1
- package/dist/es6/drawer/index.d.ts.map +1 -1
- package/dist/es6/drawer/index.js +1 -1
- package/dist/es6/drawer/lib/Drawer.d.ts +39 -14
- package/dist/es6/drawer/lib/Drawer.d.ts.map +1 -1
- package/dist/es6/drawer/lib/Drawer.js +38 -20
- package/dist/es6/drawer/lib/DrawerHeader.d.ts +24 -7
- package/dist/es6/drawer/lib/DrawerHeader.d.ts.map +1 -1
- package/dist/es6/drawer/lib/DrawerHeader.js +22 -15
- package/dist/es6/expandable/index.d.ts +3 -0
- package/dist/es6/expandable/index.d.ts.map +1 -0
- package/dist/es6/expandable/index.js +2 -0
- package/dist/es6/expandable/lib/Expandable.d.ts +75 -0
- package/dist/es6/expandable/lib/Expandable.d.ts.map +1 -0
- package/dist/es6/expandable/lib/Expandable.js +44 -0
- package/dist/es6/expandable/lib/ExpandableAvatar.d.ts +7 -0
- package/dist/es6/expandable/lib/ExpandableAvatar.d.ts.map +1 -0
- package/dist/es6/expandable/lib/ExpandableAvatar.js +40 -0
- package/dist/es6/expandable/lib/ExpandableContent.d.ts +19 -0
- package/dist/es6/expandable/lib/ExpandableContent.d.ts.map +1 -0
- package/dist/es6/expandable/lib/ExpandableContent.js +35 -0
- package/dist/es6/expandable/lib/ExpandableIcon.d.ts +29 -0
- package/dist/es6/expandable/lib/ExpandableIcon.d.ts.map +1 -0
- package/dist/es6/expandable/lib/ExpandableIcon.js +56 -0
- package/dist/es6/expandable/lib/ExpandableTarget.d.ts +28 -0
- package/dist/es6/expandable/lib/ExpandableTarget.d.ts.map +1 -0
- package/dist/es6/expandable/lib/ExpandableTarget.js +42 -0
- package/dist/es6/expandable/lib/ExpandableTitle.d.ts +9 -0
- package/dist/es6/expandable/lib/ExpandableTitle.d.ts.map +1 -0
- package/dist/es6/expandable/lib/ExpandableTitle.js +33 -0
- package/dist/es6/expandable/lib/hooks/index.d.ts +4 -0
- package/dist/es6/expandable/lib/hooks/index.d.ts.map +1 -0
- package/dist/es6/expandable/lib/hooks/index.js +3 -0
- package/dist/es6/expandable/lib/hooks/useExpandableContent.d.ts +20 -0
- package/dist/es6/expandable/lib/hooks/useExpandableContent.d.ts.map +1 -0
- package/dist/es6/expandable/lib/hooks/useExpandableContent.js +9 -0
- package/dist/es6/expandable/lib/hooks/useExpandableIcon.d.ts +15 -0
- package/dist/es6/expandable/lib/hooks/useExpandableIcon.d.ts.map +1 -0
- package/dist/es6/expandable/lib/hooks/useExpandableIcon.js +8 -0
- package/dist/es6/expandable/lib/hooks/useExpandableTarget.d.ts +17 -0
- package/dist/es6/expandable/lib/hooks/useExpandableTarget.d.ts.map +1 -0
- package/dist/es6/expandable/lib/hooks/useExpandableTarget.js +17 -0
- package/dist/es6/expandable/lib/useExpandableModel.d.ts +50 -0
- package/dist/es6/expandable/lib/useExpandableModel.d.ts.map +1 -0
- package/dist/es6/expandable/lib/useExpandableModel.js +21 -0
- package/dist/es6/index.d.ts +2 -0
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +2 -0
- package/dist/es6/search-form/lib/SearchForm.d.ts +1 -2
- package/dist/es6/search-form/lib/SearchForm.d.ts.map +1 -1
- package/dist/es6/search-form/lib/SearchForm.js +2 -4
- package/dist/es6/toast/index.d.ts +3 -0
- package/dist/es6/toast/index.d.ts.map +1 -0
- package/dist/es6/toast/index.js +2 -0
- package/dist/es6/toast/lib/Toast.d.ts +27 -0
- package/dist/es6/toast/lib/Toast.d.ts.map +1 -0
- package/dist/es6/toast/lib/Toast.js +72 -0
- package/dist/es6/toast/lib/ToastBody.d.ts +6 -0
- package/dist/es6/toast/lib/ToastBody.d.ts.map +1 -0
- package/dist/es6/toast/lib/ToastBody.js +34 -0
- package/dist/es6/toast/lib/ToastCloseIcon.d.ts +6 -0
- package/dist/es6/toast/lib/ToastCloseIcon.d.ts.map +1 -0
- package/dist/es6/toast/lib/ToastCloseIcon.js +37 -0
- package/dist/es6/toast/lib/ToastIcon.d.ts +5 -0
- package/dist/es6/toast/lib/ToastIcon.d.ts.map +1 -0
- package/dist/es6/toast/lib/ToastIcon.js +20 -0
- package/dist/es6/toast/lib/ToastLink.d.ts +9 -0
- package/dist/es6/toast/lib/ToastLink.d.ts.map +1 -0
- package/dist/es6/toast/lib/ToastLink.js +36 -0
- package/dist/es6/toast/lib/ToastMessage.d.ts +11 -0
- package/dist/es6/toast/lib/ToastMessage.d.ts.map +1 -0
- package/dist/es6/toast/lib/ToastMessage.js +35 -0
- package/dist/es6/toast/lib/hooks/useToastModel.d.ts +65 -0
- package/dist/es6/toast/lib/hooks/useToastModel.d.ts.map +1 -0
- package/dist/es6/toast/lib/hooks/useToastModel.js +32 -0
- package/drawer/index.ts +1 -1
- package/drawer/lib/Drawer.tsx +61 -24
- package/drawer/lib/DrawerHeader.tsx +54 -26
- package/expandable/LICENSE +52 -0
- package/expandable/README.md +11 -0
- package/expandable/index.ts +2 -0
- package/expandable/lib/Expandable.tsx +34 -0
- package/expandable/lib/ExpandableAvatar.tsx +26 -0
- package/expandable/lib/ExpandableContent.tsx +32 -0
- package/expandable/lib/ExpandableIcon.tsx +74 -0
- package/expandable/lib/ExpandableTarget.tsx +67 -0
- package/expandable/lib/ExpandableTitle.tsx +34 -0
- package/expandable/lib/hooks/index.ts +3 -0
- package/expandable/lib/hooks/useExpandableContent.ts +9 -0
- package/expandable/lib/hooks/useExpandableIcon.ts +8 -0
- package/expandable/lib/hooks/useExpandableTarget.ts +16 -0
- package/expandable/lib/useExpandableModel.tsx +17 -0
- package/expandable/package.json +6 -0
- package/index.ts +2 -0
- package/package.json +4 -4
- package/search-form/lib/SearchForm.tsx +2 -6
- package/toast/LICENSE +52 -0
- package/toast/README.md +5 -0
- package/toast/index.ts +2 -0
- package/toast/lib/Toast.tsx +63 -0
- package/toast/lib/ToastBody.tsx +34 -0
- package/toast/lib/ToastCloseIcon.tsx +18 -0
- package/toast/lib/ToastIcon.tsx +24 -0
- package/toast/lib/ToastLink.tsx +27 -0
- package/toast/lib/ToastMessage.tsx +21 -0
- package/toast/lib/hooks/useToastModel.tsx +27 -0
- package/toast/package.json +6 -0
- package/common/lib/storybook-utils/ComponentStatesTable.tsx +0 -80
- package/common/lib/storybook-utils/permutateProps.ts +0 -47
- package/common/lib/storybook-utils/propTypes.ts +0 -15
- package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.d.ts +0 -26
- package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.d.ts.map +0 -1
- package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.js +0 -48
- package/dist/commonjs/common/lib/storybook-utils/permutateProps.d.ts +0 -5
- package/dist/commonjs/common/lib/storybook-utils/permutateProps.d.ts.map +0 -1
- package/dist/commonjs/common/lib/storybook-utils/permutateProps.js +0 -47
- package/dist/commonjs/common/lib/storybook-utils/propTypes.d.ts +0 -15
- package/dist/commonjs/common/lib/storybook-utils/propTypes.d.ts.map +0 -1
- package/dist/commonjs/common/lib/storybook-utils/propTypes.js +0 -2
- package/dist/es6/common/lib/storybook-utils/ComponentStatesTable.d.ts +0 -26
- package/dist/es6/common/lib/storybook-utils/ComponentStatesTable.d.ts.map +0 -1
- package/dist/es6/common/lib/storybook-utils/ComponentStatesTable.js +0 -41
- package/dist/es6/common/lib/storybook-utils/permutateProps.d.ts +0 -5
- package/dist/es6/common/lib/storybook-utils/permutateProps.d.ts.map +0 -1
- package/dist/es6/common/lib/storybook-utils/permutateProps.js +0 -43
- package/dist/es6/common/lib/storybook-utils/propTypes.d.ts +0 -15
- package/dist/es6/common/lib/storybook-utils/propTypes.d.ts.map +0 -1
- 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,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 {};
|