@workday/canvas-kit-labs-react 7.0.0-alpha.0-next.6 → 7.0.0-alpha.0-next.7
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/common/index.ts +0 -8
- package/dist/commonjs/common/index.d.ts +0 -8
- package/dist/commonjs/common/index.d.ts.map +1 -1
- package/dist/commonjs/common/index.js +0 -1
- package/dist/commonjs/index.d.ts +0 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +0 -1
- package/dist/es6/common/index.d.ts +0 -8
- package/dist/es6/common/index.d.ts.map +1 -1
- package/dist/es6/common/index.js +0 -1
- package/dist/es6/index.d.ts +0 -1
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +0 -1
- package/index.ts +0 -1
- package/package.json +4 -6
- package/ts3.5/dist/commonjs/common/index.d.ts +0 -8
- package/ts3.5/dist/commonjs/index.d.ts +0 -1
- package/ts3.5/dist/es6/common/index.d.ts +0 -8
- package/ts3.5/dist/es6/index.d.ts +0 -1
- package/common/lib/Box.tsx +0 -92
- package/common/lib/utils/border.ts +0 -263
- package/common/lib/utils/color.ts +0 -62
- package/common/lib/utils/depth.ts +0 -37
- package/common/lib/utils/flexItem.ts +0 -56
- package/common/lib/utils/layout.ts +0 -77
- package/common/lib/utils/other.ts +0 -20
- package/common/lib/utils/position.ts +0 -96
- package/common/lib/utils/space.ts +0 -207
- package/common/lib/utils/types.ts +0 -105
- package/dist/commonjs/common/lib/Box.d.ts +0 -31
- package/dist/commonjs/common/lib/Box.d.ts.map +0 -1
- package/dist/commonjs/common/lib/Box.js +0 -99
- package/dist/commonjs/common/lib/utils/border.d.ts +0 -103
- package/dist/commonjs/common/lib/utils/border.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/border.js +0 -153
- package/dist/commonjs/common/lib/utils/color.d.ts +0 -26
- package/dist/commonjs/common/lib/utils/color.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/color.js +0 -57
- package/dist/commonjs/common/lib/utils/depth.d.ts +0 -22
- package/dist/commonjs/common/lib/utils/depth.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/depth.js +0 -29
- package/dist/commonjs/common/lib/utils/flexItem.d.ts +0 -33
- package/dist/commonjs/common/lib/utils/flexItem.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/flexItem.js +0 -39
- package/dist/commonjs/common/lib/utils/layout.d.ts +0 -43
- package/dist/commonjs/common/lib/utils/layout.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/layout.js +0 -43
- package/dist/commonjs/common/lib/utils/other.d.ts +0 -5
- package/dist/commonjs/common/lib/utils/other.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/other.js +0 -19
- package/dist/commonjs/common/lib/utils/position.d.ts +0 -41
- package/dist/commonjs/common/lib/utils/position.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/position.js +0 -78
- package/dist/commonjs/common/lib/utils/space.d.ts +0 -64
- package/dist/commonjs/common/lib/utils/space.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/space.js +0 -161
- package/dist/commonjs/common/lib/utils/types.d.ts +0 -14
- package/dist/commonjs/common/lib/utils/types.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/types.js +0 -2
- package/dist/commonjs/layout/index.d.ts +0 -5
- package/dist/commonjs/layout/index.d.ts.map +0 -1
- package/dist/commonjs/layout/index.js +0 -14
- package/dist/commonjs/layout/lib/Flex.d.ts +0 -26
- package/dist/commonjs/layout/lib/Flex.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/Flex.js +0 -83
- package/dist/commonjs/layout/lib/Stack.d.ts +0 -27
- package/dist/commonjs/layout/lib/Stack.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/Stack.js +0 -99
- package/dist/commonjs/layout/lib/utils/flex.d.ts +0 -36
- package/dist/commonjs/layout/lib/utils/flex.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/utils/flex.js +0 -38
- package/dist/commonjs/layout/lib/utils/getValidChildren.d.ts +0 -3
- package/dist/commonjs/layout/lib/utils/getValidChildren.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/utils/getValidChildren.js +0 -29
- package/dist/commonjs/layout/lib/utils/stack.d.ts +0 -26
- package/dist/commonjs/layout/lib/utils/stack.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/utils/stack.js +0 -55
- package/dist/commonjs/layout/lib/utils/types.d.ts +0 -8
- package/dist/commonjs/layout/lib/utils/types.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/utils/types.js +0 -2
- package/dist/es6/common/lib/Box.d.ts +0 -31
- package/dist/es6/common/lib/Box.d.ts.map +0 -1
- package/dist/es6/common/lib/Box.js +0 -74
- package/dist/es6/common/lib/utils/border.d.ts +0 -103
- package/dist/es6/common/lib/utils/border.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/border.js +0 -149
- package/dist/es6/common/lib/utils/color.d.ts +0 -26
- package/dist/es6/common/lib/utils/color.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/color.js +0 -53
- package/dist/es6/common/lib/utils/depth.d.ts +0 -22
- package/dist/es6/common/lib/utils/depth.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/depth.js +0 -25
- package/dist/es6/common/lib/utils/flexItem.d.ts +0 -33
- package/dist/es6/common/lib/utils/flexItem.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/flexItem.js +0 -35
- package/dist/es6/common/lib/utils/layout.d.ts +0 -43
- package/dist/es6/common/lib/utils/layout.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/layout.js +0 -39
- package/dist/es6/common/lib/utils/other.d.ts +0 -5
- package/dist/es6/common/lib/utils/other.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/other.js +0 -15
- package/dist/es6/common/lib/utils/position.d.ts +0 -41
- package/dist/es6/common/lib/utils/position.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/position.js +0 -74
- package/dist/es6/common/lib/utils/space.d.ts +0 -64
- package/dist/es6/common/lib/utils/space.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/space.js +0 -157
- package/dist/es6/common/lib/utils/types.d.ts +0 -14
- package/dist/es6/common/lib/utils/types.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/types.js +0 -1
- package/dist/es6/layout/index.d.ts +0 -5
- package/dist/es6/layout/index.d.ts.map +0 -1
- package/dist/es6/layout/index.js +0 -2
- package/dist/es6/layout/lib/Flex.d.ts +0 -26
- package/dist/es6/layout/lib/Flex.d.ts.map +0 -1
- package/dist/es6/layout/lib/Flex.js +0 -58
- package/dist/es6/layout/lib/Stack.d.ts +0 -27
- package/dist/es6/layout/lib/Stack.d.ts.map +0 -1
- package/dist/es6/layout/lib/Stack.js +0 -74
- package/dist/es6/layout/lib/utils/flex.d.ts +0 -36
- package/dist/es6/layout/lib/utils/flex.d.ts.map +0 -1
- package/dist/es6/layout/lib/utils/flex.js +0 -34
- package/dist/es6/layout/lib/utils/getValidChildren.d.ts +0 -3
- package/dist/es6/layout/lib/utils/getValidChildren.d.ts.map +0 -1
- package/dist/es6/layout/lib/utils/getValidChildren.js +0 -6
- package/dist/es6/layout/lib/utils/stack.d.ts +0 -26
- package/dist/es6/layout/lib/utils/stack.d.ts.map +0 -1
- package/dist/es6/layout/lib/utils/stack.js +0 -51
- package/dist/es6/layout/lib/utils/types.d.ts +0 -8
- package/dist/es6/layout/lib/utils/types.d.ts.map +0 -1
- package/dist/es6/layout/lib/utils/types.js +0 -1
- package/layout/LICENSE +0 -52
- package/layout/README.md +0 -16
- package/layout/index.ts +0 -4
- package/layout/lib/Flex.tsx +0 -47
- package/layout/lib/Stack.tsx +0 -95
- package/layout/lib/utils/flex.ts +0 -65
- package/layout/lib/utils/getValidChildren.ts +0 -7
- package/layout/lib/utils/stack.ts +0 -78
- package/layout/lib/utils/types.ts +0 -45
- package/layout/package.json +0 -5
- package/ts3.5/dist/commonjs/common/lib/Box.d.ts +0 -31
- package/ts3.5/dist/commonjs/common/lib/utils/border.d.ts +0 -103
- package/ts3.5/dist/commonjs/common/lib/utils/color.d.ts +0 -26
- package/ts3.5/dist/commonjs/common/lib/utils/depth.d.ts +0 -22
- package/ts3.5/dist/commonjs/common/lib/utils/flexItem.d.ts +0 -33
- package/ts3.5/dist/commonjs/common/lib/utils/layout.d.ts +0 -43
- package/ts3.5/dist/commonjs/common/lib/utils/other.d.ts +0 -5
- package/ts3.5/dist/commonjs/common/lib/utils/position.d.ts +0 -41
- package/ts3.5/dist/commonjs/common/lib/utils/space.d.ts +0 -64
- package/ts3.5/dist/commonjs/common/lib/utils/types.d.ts +0 -14
- package/ts3.5/dist/commonjs/layout/index.d.ts +0 -5
- package/ts3.5/dist/commonjs/layout/lib/Flex.d.ts +0 -26
- package/ts3.5/dist/commonjs/layout/lib/Stack.d.ts +0 -27
- package/ts3.5/dist/commonjs/layout/lib/utils/flex.d.ts +0 -36
- package/ts3.5/dist/commonjs/layout/lib/utils/getValidChildren.d.ts +0 -3
- package/ts3.5/dist/commonjs/layout/lib/utils/stack.d.ts +0 -26
- package/ts3.5/dist/commonjs/layout/lib/utils/types.d.ts +0 -8
- package/ts3.5/dist/es6/common/lib/Box.d.ts +0 -31
- package/ts3.5/dist/es6/common/lib/utils/border.d.ts +0 -103
- package/ts3.5/dist/es6/common/lib/utils/color.d.ts +0 -26
- package/ts3.5/dist/es6/common/lib/utils/depth.d.ts +0 -22
- package/ts3.5/dist/es6/common/lib/utils/flexItem.d.ts +0 -33
- package/ts3.5/dist/es6/common/lib/utils/layout.d.ts +0 -43
- package/ts3.5/dist/es6/common/lib/utils/other.d.ts +0 -5
- package/ts3.5/dist/es6/common/lib/utils/position.d.ts +0 -41
- package/ts3.5/dist/es6/common/lib/utils/space.d.ts +0 -64
- package/ts3.5/dist/es6/common/lib/utils/types.d.ts +0 -14
- package/ts3.5/dist/es6/layout/index.d.ts +0 -5
- package/ts3.5/dist/es6/layout/lib/Flex.d.ts +0 -26
- package/ts3.5/dist/es6/layout/lib/Stack.d.ts +0 -27
- package/ts3.5/dist/es6/layout/lib/utils/flex.d.ts +0 -36
- package/ts3.5/dist/es6/layout/lib/utils/getValidChildren.d.ts +0 -3
- package/ts3.5/dist/es6/layout/lib/utils/stack.d.ts +0 -26
- package/ts3.5/dist/es6/layout/lib/utils/types.d.ts +0 -8
package/common/index.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
export * from './lib/Box';
|
|
2
1
|
export * from './lib/theming';
|
|
3
|
-
export {BorderStyleProps} from './lib/utils/border';
|
|
4
|
-
export {ColorStyleProps} from './lib/utils/color';
|
|
5
|
-
export {DepthStyleProps} from './lib/utils/depth';
|
|
6
|
-
export {FlexItemStyleProps} from './lib/utils/flexItem';
|
|
7
|
-
export {LayoutStyleProps} from './lib/utils/layout';
|
|
8
|
-
export {PositionStyleProps} from './lib/utils/position';
|
|
9
|
-
export {SpaceStyleProps} from './lib/utils/space';
|
|
10
2
|
export {ComponentStatesTable} from './lib/storybook-utils/ComponentStatesTable';
|
|
11
3
|
export {permutateProps} from './lib/storybook-utils/permutateProps';
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
export * from './lib/Box';
|
|
2
1
|
export * from './lib/theming';
|
|
3
|
-
export { BorderStyleProps } from './lib/utils/border';
|
|
4
|
-
export { ColorStyleProps } from './lib/utils/color';
|
|
5
|
-
export { DepthStyleProps } from './lib/utils/depth';
|
|
6
|
-
export { FlexItemStyleProps } from './lib/utils/flexItem';
|
|
7
|
-
export { LayoutStyleProps } from './lib/utils/layout';
|
|
8
|
-
export { PositionStyleProps } from './lib/utils/position';
|
|
9
|
-
export { SpaceStyleProps } from './lib/utils/space';
|
|
10
2
|
export { ComponentStatesTable } from './lib/storybook-utils/ComponentStatesTable';
|
|
11
3
|
export { permutateProps } from './lib/storybook-utils/permutateProps';
|
|
12
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../common/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../common/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAC,oBAAoB,EAAC,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC"}
|
|
@@ -11,7 +11,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
exports.permutateProps = exports.ComponentStatesTable = void 0;
|
|
14
|
-
__exportStar(require("./lib/Box"), exports);
|
|
15
14
|
__exportStar(require("./lib/theming"), exports);
|
|
16
15
|
var ComponentStatesTable_1 = require("./lib/storybook-utils/ComponentStatesTable");
|
|
17
16
|
Object.defineProperty(exports, "ComponentStatesTable", { enumerable: true, get: function () { return ComponentStatesTable_1.ComponentStatesTable; } });
|
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC"}
|
package/dist/commonjs/index.js
CHANGED
|
@@ -13,5 +13,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
__exportStar(require("./combobox"), exports);
|
|
14
14
|
__exportStar(require("./common"), exports);
|
|
15
15
|
__exportStar(require("./drawer"), exports);
|
|
16
|
-
__exportStar(require("./layout"), exports);
|
|
17
16
|
__exportStar(require("./search-form"), exports);
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
export * from './lib/Box';
|
|
2
1
|
export * from './lib/theming';
|
|
3
|
-
export { BorderStyleProps } from './lib/utils/border';
|
|
4
|
-
export { ColorStyleProps } from './lib/utils/color';
|
|
5
|
-
export { DepthStyleProps } from './lib/utils/depth';
|
|
6
|
-
export { FlexItemStyleProps } from './lib/utils/flexItem';
|
|
7
|
-
export { LayoutStyleProps } from './lib/utils/layout';
|
|
8
|
-
export { PositionStyleProps } from './lib/utils/position';
|
|
9
|
-
export { SpaceStyleProps } from './lib/utils/space';
|
|
10
2
|
export { ComponentStatesTable } from './lib/storybook-utils/ComponentStatesTable';
|
|
11
3
|
export { permutateProps } from './lib/storybook-utils/permutateProps';
|
|
12
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../common/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../common/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAC,oBAAoB,EAAC,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC"}
|
package/dist/es6/common/index.js
CHANGED
package/dist/es6/index.d.ts
CHANGED
package/dist/es6/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC"}
|
package/dist/es6/index.js
CHANGED
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-labs-react",
|
|
3
|
-
"version": "7.0.0-alpha.0-next.
|
|
3
|
+
"version": "7.0.0-alpha.0-next.7+23568685",
|
|
4
4
|
"description": "Canvas Kit Labs is an incubator for new and experimental components. Since we have a rather rigorous process for getting components in at a production level, it can be valuable to make them available earlier while we continuously iterate on the API/functionality. The Labs modules allow us to do that as needed.",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -52,19 +52,17 @@
|
|
|
52
52
|
"react": "^16.8 || ^17.0"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@emotion/is-prop-valid": "^1.1.1",
|
|
56
55
|
"@emotion/react": "^11.7.1",
|
|
57
56
|
"@emotion/styled": "^11.6.0",
|
|
58
|
-
"@workday/canvas-kit-preview-react": "^7.0.0-alpha.0-next.
|
|
59
|
-
"@workday/canvas-kit-react": "^7.0.0-alpha.0-next.
|
|
57
|
+
"@workday/canvas-kit-preview-react": "^7.0.0-alpha.0-next.7+23568685",
|
|
58
|
+
"@workday/canvas-kit-react": "^7.0.0-alpha.0-next.7+23568685",
|
|
60
59
|
"@workday/canvas-system-icons-web": "1.0.41",
|
|
61
60
|
"chroma-js": "^2.1.0",
|
|
62
|
-
"csstype": "^2.6.17",
|
|
63
61
|
"lodash.flatten": "^4.4.0",
|
|
64
62
|
"rtl-css-js": "^1.14.1"
|
|
65
63
|
},
|
|
66
64
|
"devDependencies": {
|
|
67
65
|
"@types/lodash.flatten": "^4.4.6"
|
|
68
66
|
},
|
|
69
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "23568685fec785046d37cb320289d8ab9e74e283"
|
|
70
68
|
}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
export * from './lib/Box';
|
|
2
1
|
export * from './lib/theming';
|
|
3
|
-
export { BorderStyleProps } from './lib/utils/border';
|
|
4
|
-
export { ColorStyleProps } from './lib/utils/color';
|
|
5
|
-
export { DepthStyleProps } from './lib/utils/depth';
|
|
6
|
-
export { FlexItemStyleProps } from './lib/utils/flexItem';
|
|
7
|
-
export { LayoutStyleProps } from './lib/utils/layout';
|
|
8
|
-
export { PositionStyleProps } from './lib/utils/position';
|
|
9
|
-
export { SpaceStyleProps } from './lib/utils/space';
|
|
10
2
|
export { ComponentStatesTable } from './lib/storybook-utils/ComponentStatesTable';
|
|
11
3
|
export { permutateProps } from './lib/storybook-utils/permutateProps';
|
|
12
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
export * from './lib/Box';
|
|
2
1
|
export * from './lib/theming';
|
|
3
|
-
export { BorderStyleProps } from './lib/utils/border';
|
|
4
|
-
export { ColorStyleProps } from './lib/utils/color';
|
|
5
|
-
export { DepthStyleProps } from './lib/utils/depth';
|
|
6
|
-
export { FlexItemStyleProps } from './lib/utils/flexItem';
|
|
7
|
-
export { LayoutStyleProps } from './lib/utils/layout';
|
|
8
|
-
export { PositionStyleProps } from './lib/utils/position';
|
|
9
|
-
export { SpaceStyleProps } from './lib/utils/space';
|
|
10
2
|
export { ComponentStatesTable } from './lib/storybook-utils/ComponentStatesTable';
|
|
11
3
|
export { permutateProps } from './lib/storybook-utils/permutateProps';
|
|
12
4
|
//# sourceMappingURL=index.d.ts.map
|
package/common/lib/Box.tsx
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import styled from '@emotion/styled';
|
|
3
|
-
import isPropValid from '@emotion/is-prop-valid';
|
|
4
|
-
import {createComponent, StyledType, useConstant} from '@workday/canvas-kit-react/common';
|
|
5
|
-
|
|
6
|
-
// style props
|
|
7
|
-
import {border, BorderStyleProps} from './utils/border';
|
|
8
|
-
import {color, ColorStyleProps} from './utils/color';
|
|
9
|
-
import {depth, DepthStyleProps} from './utils/depth';
|
|
10
|
-
import {flexItem, FlexItemStyleProps} from './utils/flexItem';
|
|
11
|
-
import {layout, LayoutStyleProps} from './utils/layout';
|
|
12
|
-
import {other, OtherStyleProps} from './utils/other';
|
|
13
|
-
import {position, PositionStyleProps} from './utils/position';
|
|
14
|
-
import {space, SpaceStyleProps} from './utils/space';
|
|
15
|
-
|
|
16
|
-
export type BoxProps = BorderStyleProps &
|
|
17
|
-
ColorStyleProps &
|
|
18
|
-
DepthStyleProps &
|
|
19
|
-
FlexItemStyleProps &
|
|
20
|
-
LayoutStyleProps &
|
|
21
|
-
OtherStyleProps &
|
|
22
|
-
PositionStyleProps &
|
|
23
|
-
SpaceStyleProps & {
|
|
24
|
-
children?: React.ReactNode;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
const omittedProps = ['display', 'color', 'height', 'overflow', 'width', 'border', 'background'];
|
|
28
|
-
|
|
29
|
-
const shouldForwardProp = (prop: string) => {
|
|
30
|
-
return isPropValid(prop) && !omittedProps.includes(prop);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// Meant to be used with elements. The `shouldForwardProps` will remove all style props
|
|
34
|
-
const StyledBoxElement = styled('div', {shouldForwardProp})<StyledType & BoxProps>(
|
|
35
|
-
{
|
|
36
|
-
boxSizing: 'border-box',
|
|
37
|
-
},
|
|
38
|
-
border,
|
|
39
|
-
color,
|
|
40
|
-
depth,
|
|
41
|
-
flexItem,
|
|
42
|
-
layout,
|
|
43
|
-
position,
|
|
44
|
-
space
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
// Meant to be used with components. There is no `shouldForwardProps` - all props will be forwarded to the component
|
|
48
|
-
const StyledBoxComponent = styled('div')<StyledType & BoxProps>(
|
|
49
|
-
{
|
|
50
|
-
boxSizing: 'border-box',
|
|
51
|
-
},
|
|
52
|
-
border,
|
|
53
|
-
color,
|
|
54
|
-
depth,
|
|
55
|
-
flexItem,
|
|
56
|
-
layout,
|
|
57
|
-
other,
|
|
58
|
-
position,
|
|
59
|
-
space
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* `Box` is a primitive component that provides a common, ergonomic API around Canvas design tokens.
|
|
64
|
-
* It is highly flexible, and its primary purpose is to build other components.
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* import { Box, BoxProps } from '@workday/canvas-kit-labs-react/common';
|
|
68
|
-
*
|
|
69
|
-
* interface CardProps extends BoxProps {
|
|
70
|
-
* // card-specific props
|
|
71
|
-
* }
|
|
72
|
-
*
|
|
73
|
-
* // `Card`'s default values are set using `BoxProps`
|
|
74
|
-
* const Card = (props: CardProps) => (
|
|
75
|
-
* <Box depth={2} padding="m" borderRadius="l" {...props}>Hello, Card!</Box>
|
|
76
|
-
* );
|
|
77
|
-
*
|
|
78
|
-
*/
|
|
79
|
-
export const Box = createComponent('div')({
|
|
80
|
-
displayName: 'Box',
|
|
81
|
-
Component: ({children, ...elemProps}: BoxProps, ref, Element) => {
|
|
82
|
-
const BoxComponent = useConstant(() =>
|
|
83
|
-
typeof Element === 'string' ? StyledBoxElement : StyledBoxComponent
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<BoxComponent as={Element} ref={ref} {...elemProps}>
|
|
88
|
-
{children}
|
|
89
|
-
</BoxComponent>
|
|
90
|
-
);
|
|
91
|
-
},
|
|
92
|
-
});
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
borderRadius as borderRadiusTokens,
|
|
3
|
-
CanvasBorderRadiusKeys,
|
|
4
|
-
colors as colorTokens,
|
|
5
|
-
CanvasColor,
|
|
6
|
-
} from '@workday/canvas-kit-react/tokens';
|
|
7
|
-
import {
|
|
8
|
-
ContentDirection,
|
|
9
|
-
PartialEmotionCanvasTheme,
|
|
10
|
-
useTheme,
|
|
11
|
-
} from '@workday/canvas-kit-react/common';
|
|
12
|
-
|
|
13
|
-
import {PropertyBorder} from './types';
|
|
14
|
-
|
|
15
|
-
/** style props to set the border properties */
|
|
16
|
-
export type BorderShorthandStyleProps = {
|
|
17
|
-
/** sets `border` property */
|
|
18
|
-
border?: string;
|
|
19
|
-
/** sets `border-top` property */
|
|
20
|
-
borderTop?: string;
|
|
21
|
-
/** sets `border-right` property (no bidirectional support) */
|
|
22
|
-
borderRight?: string;
|
|
23
|
-
/** sets `border-bottom` property */
|
|
24
|
-
borderBottom?: string;
|
|
25
|
-
/** sets `border-left` property (no bidirectional support) */
|
|
26
|
-
borderLeft?: string;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/** style props to set the border color properties */
|
|
30
|
-
export type BorderColorStyleProps = {
|
|
31
|
-
/** sets `border-color` property */
|
|
32
|
-
borderColor?: CanvasColor | (string & {});
|
|
33
|
-
/** sets `border-top-color` property */
|
|
34
|
-
borderTopColor?: CanvasColor | (string & {});
|
|
35
|
-
/** sets `border-right-color` property (no bidirectional support) */
|
|
36
|
-
borderRightColor?: CanvasColor | (string & {});
|
|
37
|
-
/** sets `border-bottom-color` property */
|
|
38
|
-
borderBottomColor?: CanvasColor | (string & {});
|
|
39
|
-
/** sets `border-left-color` property (no bidirectional support) */
|
|
40
|
-
borderLeftColor?: CanvasColor | (string & {});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/** style props to set the border radius properties */
|
|
44
|
-
export type BorderRadiusStyleProps = {
|
|
45
|
-
/** sets `border-radius` property */
|
|
46
|
-
borderRadius?: CanvasBorderRadiusKeys | number | (string & {});
|
|
47
|
-
/** sets `border-top-left-radius` property */
|
|
48
|
-
borderTopLeftRadius?: CanvasBorderRadiusKeys | number | (string & {});
|
|
49
|
-
/** sets `border-top-right-radius` property */
|
|
50
|
-
borderTopRightRadius?: CanvasBorderRadiusKeys | number | (string & {});
|
|
51
|
-
/** sets `border-bottom-left-radius` property */
|
|
52
|
-
borderBottomLeftRadius?: CanvasBorderRadiusKeys | number | (string & {});
|
|
53
|
-
/** sets `border-bottom-right-radius` property */
|
|
54
|
-
borderBottomRightRadius?: CanvasBorderRadiusKeys | number | (string & {});
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/** style props to set the border style properties */
|
|
58
|
-
export type BorderLineStyleProps = {
|
|
59
|
-
/** sets `border-style` property */
|
|
60
|
-
borderStyle?: PropertyBorder;
|
|
61
|
-
/** sets `border-top-style` property */
|
|
62
|
-
borderTopStyle?: PropertyBorder;
|
|
63
|
-
/** sets `border-right-style` property (no bidirectional support) */
|
|
64
|
-
borderRightStyle?: PropertyBorder;
|
|
65
|
-
/** sets `border-bottom-style` property */
|
|
66
|
-
borderBottomStyle?: PropertyBorder;
|
|
67
|
-
/** sets `border-left-style` property (no bidirectional support) */
|
|
68
|
-
borderLeftStyle?: PropertyBorder;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
/** style props to set the border width properties */
|
|
72
|
-
export type BorderWidthStyleProps = {
|
|
73
|
-
/** sets `border-width` property */
|
|
74
|
-
borderWidth?: string | number;
|
|
75
|
-
/** sets `border-top-width` property */
|
|
76
|
-
borderTopWidth?: string | number;
|
|
77
|
-
/** sets `border-right-width` property (no bidirectional support) */
|
|
78
|
-
borderRightWidth?: string | number;
|
|
79
|
-
/** sets `border-bottom-width` property */
|
|
80
|
-
borderBottomWidth?: string | number;
|
|
81
|
-
/** sets `border-left-width` property (no bidirectional support) */
|
|
82
|
-
borderLeftWidth?: string | number;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export type BorderLogicalStyleProps = {
|
|
86
|
-
/** sets `border-left` property (bidirectional support) */
|
|
87
|
-
borderInlineStart?: string;
|
|
88
|
-
/** sets `border-left-color` property (bidirectional support) */
|
|
89
|
-
borderInlineStartColor?: CanvasColor | (string & {});
|
|
90
|
-
/** sets `border-left-style` property (bidirectional support) */
|
|
91
|
-
borderInlineStartStyle?: PropertyBorder;
|
|
92
|
-
/** sets `border-left-width` property (bidirectional support) */
|
|
93
|
-
borderInlineStartWidth?: string | number;
|
|
94
|
-
/** sets `border-right` property (bidirectional support) */
|
|
95
|
-
borderInlineEnd?: string;
|
|
96
|
-
/** sets `border-right-color` property (bidirectional support) */
|
|
97
|
-
borderInlineEndColor?: CanvasColor | (string & {});
|
|
98
|
-
/** sets `border-right-style` property (bidirectional support) */
|
|
99
|
-
borderInlineEndStyle?: PropertyBorder;
|
|
100
|
-
/** sets `border-right-width` property (bidirectional support) */
|
|
101
|
-
borderInlineEndWidth?: string | number;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
/** a collection style props for border properties */
|
|
105
|
-
export type BorderStyleProps = BorderShorthandStyleProps &
|
|
106
|
-
BorderColorStyleProps &
|
|
107
|
-
BorderRadiusStyleProps &
|
|
108
|
-
BorderLineStyleProps &
|
|
109
|
-
BorderWidthStyleProps &
|
|
110
|
-
BorderLogicalStyleProps;
|
|
111
|
-
|
|
112
|
-
// border logical prop handlers
|
|
113
|
-
const borderInlineStart = (isRTL: boolean) => (isRTL ? 'borderRight' : 'borderLeft');
|
|
114
|
-
const borderInlineEnd = (isRTL: boolean) => (isRTL ? 'borderLeft' : 'borderRight');
|
|
115
|
-
const borderInlineStartColor = (isRTL: boolean) => (isRTL ? 'borderRightColor' : 'borderLeftColor');
|
|
116
|
-
const borderInlineEndColor = (isRTL: boolean) => (isRTL ? 'borderLeftColor' : 'borderRightColor');
|
|
117
|
-
const borderInlineStartStyle = (isRTL: boolean) => (isRTL ? 'borderRightStyle' : 'borderLeftStyle');
|
|
118
|
-
const borderInlineEndStyle = (isRTL: boolean) => (isRTL ? 'borderLeftStyle' : 'borderRightStyle');
|
|
119
|
-
const borderInlineStartWidth = (isRTL: boolean) => (isRTL ? 'borderRightWidth' : 'borderLeftWidth');
|
|
120
|
-
const borderInlineEndWidth = (isRTL: boolean) => (isRTL ? 'borderLeftWidth' : 'borderRightWidth');
|
|
121
|
-
|
|
122
|
-
const borderShorthandProps = {
|
|
123
|
-
border: 'border',
|
|
124
|
-
borderTop: 'borderTop',
|
|
125
|
-
borderRight: 'borderRight',
|
|
126
|
-
borderBottom: 'borderBottom',
|
|
127
|
-
borderLeft: 'borderLeft',
|
|
128
|
-
borderInlineStart,
|
|
129
|
-
borderInlineEnd,
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const borderColors = {
|
|
133
|
-
borderColor: 'borderColor',
|
|
134
|
-
borderTopColor: 'borderTopColor',
|
|
135
|
-
borderRightColor: 'borderRightColor',
|
|
136
|
-
borderBottomColor: 'borderBottomColor',
|
|
137
|
-
borderLeftColor: 'borderLeftColor',
|
|
138
|
-
borderInlineStartColor,
|
|
139
|
-
borderInlineEndColor,
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const borderRadii = {
|
|
143
|
-
borderRadius: 'borderRadius',
|
|
144
|
-
borderTopLeftRadius: 'borderTopLeftRadius',
|
|
145
|
-
borderTopRightRadius: 'borderTopRightRadius',
|
|
146
|
-
borderBottomLeftRadius: 'borderBottomLeftRadius',
|
|
147
|
-
borderBottomRightRadius: 'borderBottomRightRadius',
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const borderStyles = {
|
|
151
|
-
borderStyle: 'borderStyle',
|
|
152
|
-
borderTopStyle: 'borderTopStyle',
|
|
153
|
-
borderRightStyle: 'borderRightStyle',
|
|
154
|
-
borderBottomStyle: 'borderBottomStyle',
|
|
155
|
-
borderLeftStyle: 'borderLeftStyle',
|
|
156
|
-
borderInlineStartStyle,
|
|
157
|
-
borderInlineEndStyle,
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
const borderWidths = {
|
|
161
|
-
borderWidth: 'borderWidth',
|
|
162
|
-
borderTopWidth: 'borderTopWidth',
|
|
163
|
-
borderRightWidth: 'borderRightWidth',
|
|
164
|
-
borderBottomWidth: 'borderBottomWidth',
|
|
165
|
-
borderLeftWidth: 'borderLeftWidth',
|
|
166
|
-
borderInlineStartWidth,
|
|
167
|
-
borderInlineEndWidth,
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* A style prop function that takes components props and returns border styles. Some props, such as borderRadius and borderColor, are connected to our design tokens.
|
|
172
|
-
* If no `BorderStyleProps` are found, it returns an empty object.
|
|
173
|
-
*
|
|
174
|
-
* @example
|
|
175
|
-
* // You'll most likely use `border` with low-level, styled components
|
|
176
|
-
* const BoxExample = () => (
|
|
177
|
-
* <Box border={`solid 1px #333333 ${colors.blackPepper400}`}>Hello, border styles!</Box>
|
|
178
|
-
* );
|
|
179
|
-
*
|
|
180
|
-
*/
|
|
181
|
-
export function border<P extends BorderStyleProps & {theme?: PartialEmotionCanvasTheme}>(props: P) {
|
|
182
|
-
// border will always be used within the context of a component, but eslint doesn't know that
|
|
183
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
184
|
-
const {canvas} = useTheme(props.theme);
|
|
185
|
-
const isRTL = canvas.direction === ContentDirection.RTL;
|
|
186
|
-
const styles = {};
|
|
187
|
-
for (const key in props) {
|
|
188
|
-
if (props.hasOwnProperty(key)) {
|
|
189
|
-
if (key in borderShorthandProps) {
|
|
190
|
-
const value = props[key as keyof BorderShorthandStyleProps];
|
|
191
|
-
let attr: string;
|
|
192
|
-
if (key === 'borderInlineStart') {
|
|
193
|
-
attr = borderInlineStart(isRTL);
|
|
194
|
-
} else if (key === 'borderInlineEnd') {
|
|
195
|
-
attr = borderInlineEnd(isRTL);
|
|
196
|
-
} else {
|
|
197
|
-
attr = borderShorthandProps[key as keyof BorderShorthandStyleProps];
|
|
198
|
-
}
|
|
199
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
200
|
-
styles[attr] = value;
|
|
201
|
-
continue;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (key in borderColors) {
|
|
205
|
-
const propValue = props[key as keyof BorderColorStyleProps] as CanvasColor | string;
|
|
206
|
-
const value = colorTokens[propValue as CanvasColor] || propValue;
|
|
207
|
-
let attr: string;
|
|
208
|
-
if (key === 'borderInlineStartColor') {
|
|
209
|
-
attr = borderInlineStartColor(isRTL);
|
|
210
|
-
} else if (key === 'borderInlineEndColor') {
|
|
211
|
-
attr = borderInlineEndColor(isRTL);
|
|
212
|
-
} else {
|
|
213
|
-
attr = borderColors[key as keyof BorderColorStyleProps];
|
|
214
|
-
}
|
|
215
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
216
|
-
styles[attr] = value;
|
|
217
|
-
continue;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (key in borderRadii) {
|
|
221
|
-
const propValue = props[key as keyof BorderRadiusStyleProps] as
|
|
222
|
-
| CanvasBorderRadiusKeys
|
|
223
|
-
| number
|
|
224
|
-
| string;
|
|
225
|
-
const value = borderRadiusTokens[propValue as CanvasBorderRadiusKeys] || propValue;
|
|
226
|
-
const attr = borderRadii[key as keyof BorderRadiusStyleProps];
|
|
227
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
228
|
-
styles[attr] = value;
|
|
229
|
-
continue;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
if (key in borderStyles) {
|
|
233
|
-
const value = props[key as keyof BorderLineStyleProps];
|
|
234
|
-
let attr: string;
|
|
235
|
-
if (key === 'borderInlineStartStyle') {
|
|
236
|
-
attr = borderInlineStartStyle(isRTL);
|
|
237
|
-
} else if (key === 'borderInlineEndStyle') {
|
|
238
|
-
attr = borderInlineEndStyle(isRTL);
|
|
239
|
-
} else {
|
|
240
|
-
attr = borderStyles[key as keyof BorderLineStyleProps];
|
|
241
|
-
}
|
|
242
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
243
|
-
styles[attr] = value;
|
|
244
|
-
continue;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if (key in borderWidths) {
|
|
248
|
-
const value = props[key as keyof BorderWidthStyleProps];
|
|
249
|
-
let attr: string;
|
|
250
|
-
if (key === 'borderInlineStartWidth') {
|
|
251
|
-
attr = borderInlineStartWidth(isRTL);
|
|
252
|
-
} else if (key === 'borderInlineEndWidth') {
|
|
253
|
-
attr = borderInlineEndWidth(isRTL);
|
|
254
|
-
} else {
|
|
255
|
-
attr = borderWidths[key as keyof BorderWidthStyleProps];
|
|
256
|
-
}
|
|
257
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
258
|
-
styles[attr] = value;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
return styles;
|
|
263
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import {colors as colorTokens, CanvasColor} from '@workday/canvas-kit-react/tokens';
|
|
2
|
-
|
|
3
|
-
export type ColorTokens = typeof colorTokens;
|
|
4
|
-
|
|
5
|
-
/** style props to for color properties */
|
|
6
|
-
export type ColorStyleProps = {
|
|
7
|
-
/** sets `background` property */
|
|
8
|
-
background?: CanvasColor | (string & {});
|
|
9
|
-
/** sets `background-color` property */
|
|
10
|
-
backgroundColor?: CanvasColor | (string & {});
|
|
11
|
-
/** sets `background-image` property */
|
|
12
|
-
backgroundImage?: string;
|
|
13
|
-
/** sets `color` property */
|
|
14
|
-
color?: CanvasColor | (string & {});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const getBackground = (value: CanvasColor | string) => ({
|
|
18
|
-
background: colorTokens[value] || value,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const getBackgroundColor = (value: CanvasColor | string) => ({
|
|
22
|
-
backgroundColor: colorTokens[value] || value,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const getBackgroundImage = (value: string) => ({
|
|
26
|
-
backgroundImage: value,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const getColor = (value: CanvasColor | string) => ({
|
|
30
|
-
color: colorTokens[value] || value,
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const colorProps = {
|
|
34
|
-
background: getBackground,
|
|
35
|
-
backgroundColor: getBackgroundColor,
|
|
36
|
-
backgroundImage: getBackgroundImage,
|
|
37
|
-
color: getColor,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* A style prop function that takes components props and returns color styles from canvas token values.
|
|
42
|
-
* If no `ColorStyleProps` are found, it returns an empty object.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* // You'll most likely use `color` with low-level, styled components
|
|
46
|
-
* const BoxExample = () => (
|
|
47
|
-
* <Box backgroundColor="blueberry500" color="frenchVanilla100">Hello, colors!</Box>
|
|
48
|
-
* );
|
|
49
|
-
*
|
|
50
|
-
*/
|
|
51
|
-
export function color<P extends ColorStyleProps>(props: P) {
|
|
52
|
-
let styles = {};
|
|
53
|
-
for (const key in props) {
|
|
54
|
-
if (key in colorProps) {
|
|
55
|
-
const value = props[key as keyof ColorStyleProps] as CanvasColor | string;
|
|
56
|
-
const colorFn = colorProps[key as keyof ColorStyleProps];
|
|
57
|
-
const style = colorFn(value);
|
|
58
|
-
styles = {...styles, ...style};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return styles;
|
|
62
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import {depth as depthTokens} from '@workday/canvas-kit-react/tokens';
|
|
2
|
-
|
|
3
|
-
export type DepthTokens = typeof depthTokens;
|
|
4
|
-
export type DepthTokenKeys = keyof DepthTokens;
|
|
5
|
-
export type DepthTokenValues = DepthTokens[keyof DepthTokens];
|
|
6
|
-
|
|
7
|
-
/** style props to for depth styles */
|
|
8
|
-
export type DepthStyleProps = {
|
|
9
|
-
/** sets depth styles (box-shadow & border) */
|
|
10
|
-
depth?: DepthTokenKeys;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const depthProps = {
|
|
14
|
-
depth: (token: DepthTokenKeys) => depthTokens[token],
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* A style prop function that takes components props and returns depth styles from canvas token values.
|
|
19
|
-
* If no `DepthStyleProps` are found, it returns an empty object.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* // You'll mostly likely use `depth` with low-level, styled components
|
|
23
|
-
* const BoxExample = () => (
|
|
24
|
-
* <Box depth={3}>Hello, box shadows!</Box>
|
|
25
|
-
* );
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
export function depth<P extends DepthStyleProps>(props: P): DepthTokenValues {
|
|
29
|
-
for (const key in props) {
|
|
30
|
-
if (key in depthProps) {
|
|
31
|
-
const token = props[key as keyof DepthStyleProps] as DepthTokenKeys;
|
|
32
|
-
const depthFn = depthProps[key as keyof DepthStyleProps];
|
|
33
|
-
return depthFn(token);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return {} as DepthTokenValues;
|
|
37
|
-
}
|