@workday/canvas-kit-react 8.0.0-alpha.145-next.1 → 8.0.0-alpha.150-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 (44) hide show
  1. package/checkbox/index.ts +0 -1
  2. package/color-picker/index.ts +0 -1
  3. package/dist/commonjs/checkbox/index.d.ts.map +1 -1
  4. package/dist/commonjs/color-picker/index.d.ts.map +1 -1
  5. package/dist/commonjs/form-field/index.d.ts.map +1 -1
  6. package/dist/commonjs/layout/index.d.ts +2 -0
  7. package/dist/commonjs/layout/index.d.ts.map +1 -1
  8. package/dist/commonjs/layout/index.js +1 -0
  9. package/dist/commonjs/layout/lib/Grid.d.ts +52 -0
  10. package/dist/commonjs/layout/lib/Grid.d.ts.map +1 -0
  11. package/dist/commonjs/layout/lib/Grid.js +117 -0
  12. package/dist/commonjs/layout/lib/Stack.js +4 -4
  13. package/dist/commonjs/layout/lib/utils/grid.d.ts +58 -0
  14. package/dist/commonjs/layout/lib/utils/grid.d.ts.map +1 -0
  15. package/dist/commonjs/layout/lib/utils/grid.js +49 -0
  16. package/dist/commonjs/layout/lib/utils/gridItem.d.ts +39 -0
  17. package/dist/commonjs/layout/lib/utils/gridItem.d.ts.map +1 -0
  18. package/dist/commonjs/layout/lib/utils/gridItem.js +43 -0
  19. package/dist/commonjs/text-input/index.d.ts.map +1 -1
  20. package/dist/es6/checkbox/index.d.ts.map +1 -1
  21. package/dist/es6/color-picker/index.d.ts.map +1 -1
  22. package/dist/es6/form-field/index.d.ts.map +1 -1
  23. package/dist/es6/layout/index.d.ts +2 -0
  24. package/dist/es6/layout/index.d.ts.map +1 -1
  25. package/dist/es6/layout/index.js +1 -0
  26. package/dist/es6/layout/lib/Grid.d.ts +52 -0
  27. package/dist/es6/layout/lib/Grid.d.ts.map +1 -0
  28. package/dist/es6/layout/lib/Grid.js +92 -0
  29. package/dist/es6/layout/lib/Stack.js +4 -4
  30. package/dist/es6/layout/lib/utils/grid.d.ts +58 -0
  31. package/dist/es6/layout/lib/utils/grid.d.ts.map +1 -0
  32. package/dist/es6/layout/lib/utils/grid.js +45 -0
  33. package/dist/es6/layout/lib/utils/gridItem.d.ts +39 -0
  34. package/dist/es6/layout/lib/utils/gridItem.d.ts.map +1 -0
  35. package/dist/es6/layout/lib/utils/gridItem.js +39 -0
  36. package/dist/es6/text-input/index.d.ts.map +1 -1
  37. package/form-field/index.ts +0 -1
  38. package/layout/index.ts +2 -0
  39. package/layout/lib/Grid.tsx +88 -0
  40. package/layout/lib/Stack.tsx +4 -4
  41. package/layout/lib/utils/grid.ts +93 -0
  42. package/layout/lib/utils/gridItem.ts +68 -0
  43. package/package.json +5 -5
  44. package/text-input/index.ts +0 -1
package/checkbox/index.ts CHANGED
@@ -1,2 +1 @@
1
-
2
1
  export * from './lib/Checkbox';
@@ -1,4 +1,3 @@
1
-
2
1
  export * from './lib/ColorInput';
3
2
  export * from './lib/ColorPreview';
4
3
  export * from './lib/parts/ColorSwatch';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../checkbox/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../checkbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../color-picker/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../color-picker/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../form-field/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../form-field/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
@@ -10,7 +10,9 @@ export * from './lib/utils/layout';
10
10
  export * from './lib/utils/position';
11
11
  export { SpaceStyleProps } from './lib/utils/space';
12
12
  export * from './lib/Flex';
13
+ export * from './lib/Grid';
13
14
  export * from './lib/Stack';
14
15
  export type { FlexStyleProps } from './lib/utils/flex';
16
+ export type { GridStyleProps } from './lib/utils/grid';
15
17
  export type { StackSpacing, StackDirection, StackStyleProps } from './lib/utils/stack';
16
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAC,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAC,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -22,4 +22,5 @@ __exportStar(require("./lib/utils/flexItem"), exports);
22
22
  __exportStar(require("./lib/utils/layout"), exports);
23
23
  __exportStar(require("./lib/utils/position"), exports);
24
24
  __exportStar(require("./lib/Flex"), exports);
25
+ __exportStar(require("./lib/Grid"), exports);
25
26
  __exportStar(require("./lib/Stack"), exports);
@@ -0,0 +1,52 @@
1
+ import { BoxProps } from './Box';
2
+ import { GridStyleProps } from './utils/grid';
3
+ import { GridItemStyleProps } from './utils/gridItem';
4
+ export declare type GridProps = BoxProps & GridStyleProps;
5
+ export declare type GridItemProps = BoxProps & GridItemStyleProps;
6
+ /**
7
+ * `Grid` is a two-dimensional layout system for the web. It lets you lay content out in rows and columns.
8
+ * It is highly flexible, and can be used on its own or to build other components.
9
+ *
10
+ * @example
11
+ * ```
12
+ * import { Grid } from '@workday/canvas-kit-react/layout';
13
+ * `Grid` is built on top of `Box` and has access to all `BoxProps`.
14
+ *
15
+ * interface CardProps extends GridProps {
16
+ * // card-specific props
17
+ * }
18
+ *
19
+ * // `Card`'s default values are set using `GridProps`
20
+ * const Card = (props: CardProps) => (
21
+ * <Grid gridAutoFlow="row" alignItems="start" depth={1} space="m" {...props}>
22
+ * <h1>Hello, Card!</h1>
23
+ * <p>This card uses grid to set its layout.</p>
24
+ * </Grid>
25
+ * );
26
+ *```
27
+ */
28
+ export declare const Grid: import("../../common").ElementComponent<"div", import("..").BorderShorthandStyleProps & import("..").BorderColorStyleProps & import("..").BorderRadiusStyleProps & import("..").BorderLineStyleProps & import("..").BorderWidthStyleProps & import("..").BorderLogicalStyleProps & import("..").ColorStyleProps & import("..").DepthStyleProps & import("..").FlexItemStyleProps & import("..").LayoutStyleProps & import("./utils/other").OtherStyleProps & import("..").PositionStandardProps & import("..").PositionLogicalProps & import("./utils/space").SpaceStandardProps & import("./utils/space").SpaceLogicalProps & GridStyleProps> & {
29
+ /**
30
+ * `<Grid.Item />` is the child specific sub-component to `<Grid/>`. `<Grid.Item />` gets child specific props, whereas `<Grid./>` gets parent container props.
31
+ *
32
+ * @example
33
+ * ```
34
+ * import { Grid } from '@workday/canvas-kit-react/layout';
35
+ * `Grid` is built on top of `Box` so `<Grid.Item />` gets all `BoxProps` as well.
36
+ *
37
+ * interface CardProps extends GridItemStyleProps {
38
+ * // card-specific props
39
+ * }
40
+ *
41
+ * // `Card`'s default values are set using `GridItemStyleProps`
42
+ * const Card = (props: CardProps) => (
43
+ * <Grid.Item gridRowStart="1" gridArea="Card" {...props}>
44
+ * <h1>Hello, Card!</h1>
45
+ * <p>This card uses grid child specific props to set its layout.</p>
46
+ * </Grid.Item>
47
+ * );
48
+ *```
49
+ */
50
+ Item: import("../../common").ElementComponent<"div", import("..").BorderShorthandStyleProps & import("..").BorderColorStyleProps & import("..").BorderRadiusStyleProps & import("..").BorderLineStyleProps & import("..").BorderWidthStyleProps & import("..").BorderLogicalStyleProps & import("..").ColorStyleProps & import("..").DepthStyleProps & import("..").FlexItemStyleProps & import("..").LayoutStyleProps & import("./utils/other").OtherStyleProps & import("..").PositionStandardProps & import("..").PositionLogicalProps & import("./utils/space").SpaceStandardProps & import("./utils/space").SpaceLogicalProps & GridItemStyleProps>;
51
+ };
52
+ //# sourceMappingURL=Grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../../../layout/lib/Grid.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAM,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAO,cAAc,EAAC,MAAM,cAAc,CAAC;AAClD,OAAO,EAAW,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAE9D,oBAAY,SAAS,GAAG,QAAQ,GAAG,cAAc,CAAC;AAClD,oBAAY,aAAa,GAAG,QAAQ,GAAG,kBAAkB,CAAC;AAsB1D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,IAAI;IAUb;;;;;;;;;;;;;;;;;;;;OAoBG;;CAIL,CAAC"}
@@ -0,0 +1,117 @@
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
32
+ var __rest = (this && this.__rest) || function (s, e) {
33
+ var t = {};
34
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
35
+ t[p] = s[p];
36
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
37
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
38
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
39
+ t[p[i]] = s[p[i]];
40
+ }
41
+ return t;
42
+ };
43
+ var __importDefault = (this && this.__importDefault) || function (mod) {
44
+ return (mod && mod.__esModule) ? mod : { "default": mod };
45
+ };
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.Grid = void 0;
48
+ var React = __importStar(require("react"));
49
+ var styled_1 = __importDefault(require("@emotion/styled"));
50
+ var common_1 = require("@workday/canvas-kit-react/common");
51
+ var Box_1 = require("./Box");
52
+ var grid_1 = require("./utils/grid");
53
+ var gridItem_1 = require("./utils/gridItem");
54
+ var StyledGrid = styled_1.default(Box_1.Box)({
55
+ display: 'grid',
56
+ }, grid_1.grid);
57
+ var StyledGridItem = styled_1.default(Box_1.Box)(gridItem_1.gridItem);
58
+ var GridItem = common_1.createComponent('div')({
59
+ displayName: 'Grid.Item',
60
+ Component: function (_a, ref, Element) {
61
+ var children = _a.children, elemProps = __rest(_a, ["children"]);
62
+ return (React.createElement(StyledGridItem, __assign({ as: Element, ref: ref }, elemProps), children));
63
+ },
64
+ });
65
+ /**
66
+ * `Grid` is a two-dimensional layout system for the web. It lets you lay content out in rows and columns.
67
+ * It is highly flexible, and can be used on its own or to build other components.
68
+ *
69
+ * @example
70
+ * ```
71
+ * import { Grid } from '@workday/canvas-kit-react/layout';
72
+ * `Grid` is built on top of `Box` and has access to all `BoxProps`.
73
+ *
74
+ * interface CardProps extends GridProps {
75
+ * // card-specific props
76
+ * }
77
+ *
78
+ * // `Card`'s default values are set using `GridProps`
79
+ * const Card = (props: CardProps) => (
80
+ * <Grid gridAutoFlow="row" alignItems="start" depth={1} space="m" {...props}>
81
+ * <h1>Hello, Card!</h1>
82
+ * <p>This card uses grid to set its layout.</p>
83
+ * </Grid>
84
+ * );
85
+ *```
86
+ */
87
+ exports.Grid = common_1.createComponent('div')({
88
+ displayName: 'Grid',
89
+ Component: function (_a, ref, Element) {
90
+ var children = _a.children, elemProps = __rest(_a, ["children"]);
91
+ return (React.createElement(StyledGrid, __assign({ as: Element, ref: ref }, elemProps), children));
92
+ },
93
+ subComponents: {
94
+ /**
95
+ * `<Grid.Item />` is the child specific sub-component to `<Grid/>`. `<Grid.Item />` gets child specific props, whereas `<Grid./>` gets parent container props.
96
+ *
97
+ * @example
98
+ * ```
99
+ * import { Grid } from '@workday/canvas-kit-react/layout';
100
+ * `Grid` is built on top of `Box` so `<Grid.Item />` gets all `BoxProps` as well.
101
+ *
102
+ * interface CardProps extends GridItemStyleProps {
103
+ * // card-specific props
104
+ * }
105
+ *
106
+ * // `Card`'s default values are set using `GridItemStyleProps`
107
+ * const Card = (props: CardProps) => (
108
+ * <Grid.Item gridRowStart="1" gridArea="Card" {...props}>
109
+ * <h1>Hello, Card!</h1>
110
+ * <p>This card uses grid child specific props to set its layout.</p>
111
+ * </Grid.Item>
112
+ * );
113
+ *```
114
+ */
115
+ Item: GridItem,
116
+ },
117
+ });
@@ -80,8 +80,8 @@ exports.Stack = common_1.createComponent('div')({
80
80
  exports.HStack = common_1.createComponent('div')({
81
81
  displayName: 'HStack',
82
82
  Component: function (_a, ref, Element) {
83
- var children = _a.children, elemProps = __rest(_a, ["children"]);
84
- return (React.createElement(exports.Stack, __assign({ as: Element, ref: ref, flexDirection: "row" }, elemProps), children));
83
+ var children = _a.children, _b = _a.flexDirection, flexDirection = _b === void 0 ? 'row' : _b, elemProps = __rest(_a, ["children", "flexDirection"]);
84
+ return (React.createElement(exports.Stack, __assign({ as: Element, ref: ref, flexDirection: flexDirection }, elemProps), children));
85
85
  },
86
86
  subComponents: {
87
87
  Item: StackItem,
@@ -90,8 +90,8 @@ exports.HStack = common_1.createComponent('div')({
90
90
  exports.VStack = common_1.createComponent('div')({
91
91
  displayName: 'VStack',
92
92
  Component: function (_a, ref, Element) {
93
- var children = _a.children, elemProps = __rest(_a, ["children"]);
94
- return (React.createElement(exports.Stack, __assign({ as: Element, ref: ref, flexDirection: "column" }, elemProps), children));
93
+ var children = _a.children, _b = _a.flexDirection, flexDirection = _b === void 0 ? 'column' : _b, elemProps = __rest(_a, ["children", "flexDirection"]);
94
+ return (React.createElement(exports.Stack, __assign({ as: Element, ref: ref, flexDirection: flexDirection }, elemProps), children));
95
95
  },
96
96
  subComponents: {
97
97
  Item: StackItem,
@@ -0,0 +1,58 @@
1
+ import { Property } from 'csstype';
2
+ /** style props to for grid container properties */
3
+ export declare type GridStyleProps = {
4
+ /** sets `align-items` property */
5
+ alignItems?: Property.AlignItems;
6
+ /** sets `align-content` property */
7
+ alignContent?: Property.AlignContent;
8
+ /**
9
+ * sets `display` property
10
+ * @default 'grid'
11
+ * */
12
+ display?: 'grid' | 'inline-grid';
13
+ /** sets `justify-items` property */
14
+ justifyItems?: Property.JustifyItems;
15
+ /** sets `justify-content` property */
16
+ justifyContent?: Property.JustifyContent;
17
+ /** sets `grid-template` property */
18
+ gridTemplate?: Property.GridTemplate;
19
+ /** sets `grid-template-area` property */
20
+ gridTemplateAreas?: Property.GridTemplateAreas;
21
+ /** sets `grid-template-columns` property */
22
+ gridTemplateColumns?: Property.GridTemplateColumns;
23
+ /** sets `grid-template-rows` property */
24
+ gridTemplateRows?: Property.GridTemplateRows;
25
+ /** sets `gap` property */
26
+ gridGap?: Property.GridGap;
27
+ /** sets `column-gap` property */
28
+ gridColumnGap?: Property.GridColumnGap;
29
+ /** sets `row-gap` property */
30
+ gridRowGap?: Property.GridRowGap;
31
+ /** sets `place-items` property */
32
+ gridPlaceItems?: Property.PlaceItems;
33
+ /** sets `grid-auto-columns` property */
34
+ gridAutoColumns?: Property.GridAutoColumns;
35
+ /** sets `grid-auto-rows` property */
36
+ gridAutoRows?: Property.GridAutoRows;
37
+ /** sets `grid-area` property */
38
+ gridArea?: Property.GridArea;
39
+ /** sets `grid-auto-flow` property */
40
+ gridAutoFlow?: Property.GridAutoFlow;
41
+ /** sets `grid` property */
42
+ grid?: Property.Grid;
43
+ };
44
+ /**
45
+ * A style prop function that takes component props and returns grid styles.
46
+ * If no `GridStyleProps` are found, it returns an empty object.
47
+ *
48
+ * @example
49
+ * // You'll most likely use `grid` with low-level, styled components
50
+ * const GridExample = () => (
51
+ * <Grid gridAutoFlow="row" justifyContent="center" alignItems="center">
52
+ * Hello, Grid!
53
+ * </Grid>
54
+ * );
55
+ *
56
+ */
57
+ export declare function grid<P extends GridStyleProps>(props: P): {};
58
+ //# sourceMappingURL=grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEjC,mDAAmD;AACnD,oBAAY,cAAc,GAAG;IAC3B,kCAAkC;IAClC,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACjC,oCAAoC;IACpC,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC;;;SAGK;IACL,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IACjC,oCAAoC;IACpC,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC,sCAAsC;IACtC,cAAc,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC;IAGzC,oCAAoC;IACpC,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC,yCAAyC;IACzC,iBAAiB,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC;IAC/C,4CAA4C;IAC5C,mBAAmB,CAAC,EAAE,QAAQ,CAAC,mBAAmB,CAAC;IACnD,yCAAyC;IACzC,gBAAgB,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC;IAC7C,0BAA0B;IAC1B,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC;IAC3B,iCAAiC;IACjC,aAAa,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC;IACvC,8BAA8B;IAC9B,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACjC,kCAAkC;IAClC,cAAc,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACrC,wCAAwC;IACxC,eAAe,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC;IAC3C,qCAAqC;IACrC,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC,gCAAgC;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAC7B,qCAAqC;IACrC,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC,2BAA2B;IAC3B,IAAI,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC;CACtB,CAAC;AAuBF;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,CAAC,MAWtD"}
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.grid = void 0;
4
+ var gridProps = {
5
+ alignContent: 'alignContent',
6
+ alignItems: 'alignItems',
7
+ display: 'display',
8
+ justifyContent: 'justifyContent',
9
+ justifyItems: 'justifyItems',
10
+ gridTemplateAreas: 'gridTemplateAreas',
11
+ gridTemplate: 'gridTemplate',
12
+ gridTemplateColumns: 'gridTemplateColumns',
13
+ gridTemplateRows: 'gridTemplateRows',
14
+ gridGap: 'gridGap',
15
+ gridColumnGap: 'gridColumnGap',
16
+ gridRowGap: 'gridRowGap',
17
+ gridPlaceItems: 'gridPlaceItems',
18
+ gridAutoColumns: 'gridAutoColumns',
19
+ gridAutoRows: 'gridAutoRows',
20
+ gridAutoFlow: 'gridAutoFlow',
21
+ gridArea: 'gridArea',
22
+ grid: 'grid',
23
+ };
24
+ /**
25
+ * A style prop function that takes component props and returns grid styles.
26
+ * If no `GridStyleProps` are found, it returns an empty object.
27
+ *
28
+ * @example
29
+ * // You'll most likely use `grid` with low-level, styled components
30
+ * const GridExample = () => (
31
+ * <Grid gridAutoFlow="row" justifyContent="center" alignItems="center">
32
+ * Hello, Grid!
33
+ * </Grid>
34
+ * );
35
+ *
36
+ */
37
+ function grid(props) {
38
+ var styles = {};
39
+ for (var key in props) {
40
+ if (key in gridProps) {
41
+ var attr = gridProps[key];
42
+ var value = props[key];
43
+ // @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
44
+ styles[attr] = value;
45
+ }
46
+ }
47
+ return styles;
48
+ }
49
+ exports.grid = grid;
@@ -0,0 +1,39 @@
1
+ import { Property } from 'csstype';
2
+ /** style props to for grid item properties */
3
+ export declare type GridItemStyleProps = {
4
+ /** sets `grid-column-start` property */
5
+ gridColumnStart?: Property.GridColumnStart;
6
+ /** sets `grid-column-end` property */
7
+ gridColumnEnd?: Property.GridColumnEnd;
8
+ /** sets `grid-row-start` property */
9
+ gridRowStart?: Property.GridRowStart;
10
+ /** sets `grid-row-end` property */
11
+ gridRowEnd?: Property.GridRowEnd;
12
+ /** sets `grid-column` property */
13
+ gridColumn?: Property.GridColumn;
14
+ /** sets `grid-row` property */
15
+ gridRow?: Property.GridRow;
16
+ /** sets `grid-area` property */
17
+ gridArea?: Property.GridArea;
18
+ /** sets `justify-self` property */
19
+ justifySelf?: Property.JustifySelf;
20
+ /** sets `align-self` property */
21
+ alignSelf?: Property.AlignSelf;
22
+ /** sets `place-self` property */
23
+ placeSelf?: Property.PlaceSelf;
24
+ };
25
+ /**
26
+ * A style prop function that takes component props and returns grid styles.
27
+ * If no `GridItemStyleProps` are found, it returns an empty object.
28
+ *
29
+ * @example
30
+ * // You'll most likely use `grid item` with low-level, styled components
31
+ * const GridItemExample = () => (
32
+ * <Grid.Item gridRowStart="1" justifySelf="center" gridArea="Card">
33
+ * Hello, Grid Item!
34
+ * </Grid.Item>
35
+ * );
36
+ *
37
+ */
38
+ export declare function gridItem<P extends GridItemStyleProps>(props: P): {};
39
+ //# sourceMappingURL=gridItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gridItem.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/gridItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEjC,8CAA8C;AAC9C,oBAAY,kBAAkB,GAAG;IAE/B,wCAAwC;IACxC,eAAe,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC;IAC3C,sCAAsC;IACtC,aAAa,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC;IACvC,qCAAqC;IACrC,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC,mCAAmC;IACnC,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACjC,kCAAkC;IAClC,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACjC,+BAA+B;IAC/B,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC;IAC3B,gCAAgC;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAC7B,mCAAmC;IACnC,WAAW,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC;IACnC,iCAAiC;IACjC,SAAS,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC;IAC/B,iCAAiC;IACjC,SAAS,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC;CAChC,CAAC;AAiBF;;;;;;;;;;;;GAYG;AAEH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,kBAAkB,EAAE,KAAK,EAAE,CAAC,MAW9D"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.gridItem = void 0;
4
+ /** style props to for grid item properties */
5
+ var gridItemProps = {
6
+ //Child Props
7
+ gridColumnStart: 'gridColumnStart',
8
+ gridColumnEnd: 'gridColumnEnd',
9
+ gridRowStart: 'gridRowStart',
10
+ gridRowEnd: 'gridRowEnd',
11
+ gridColumn: 'gridColumn',
12
+ gridRow: 'gridRow',
13
+ gridArea: 'gridArea',
14
+ justifySelf: 'justifySelf',
15
+ alignSelf: 'alignSelf',
16
+ placeSelf: 'placeSelf',
17
+ };
18
+ /**
19
+ * A style prop function that takes component props and returns grid styles.
20
+ * If no `GridItemStyleProps` are found, it returns an empty object.
21
+ *
22
+ * @example
23
+ * // You'll most likely use `grid item` with low-level, styled components
24
+ * const GridItemExample = () => (
25
+ * <Grid.Item gridRowStart="1" justifySelf="center" gridArea="Card">
26
+ * Hello, Grid Item!
27
+ * </Grid.Item>
28
+ * );
29
+ *
30
+ */
31
+ function gridItem(props) {
32
+ var styles = {};
33
+ for (var key in props) {
34
+ if (key in gridItemProps) {
35
+ var attr = gridItemProps[key];
36
+ var value = props[key];
37
+ // @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
38
+ styles[attr] = value;
39
+ }
40
+ }
41
+ return styles;
42
+ }
43
+ exports.gridItem = gridItem;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../text-input/index.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../text-input/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../checkbox/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../checkbox/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../color-picker/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../color-picker/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../form-field/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../form-field/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC"}
@@ -10,7 +10,9 @@ export * from './lib/utils/layout';
10
10
  export * from './lib/utils/position';
11
11
  export { SpaceStyleProps } from './lib/utils/space';
12
12
  export * from './lib/Flex';
13
+ export * from './lib/Grid';
13
14
  export * from './lib/Stack';
14
15
  export type { FlexStyleProps } from './lib/utils/flex';
16
+ export type { GridStyleProps } from './lib/utils/grid';
15
17
  export type { StackSpacing, StackDirection, StackStyleProps } from './lib/utils/stack';
16
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAC,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../layout/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAC,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -8,4 +8,5 @@ export * from './lib/utils/flexItem';
8
8
  export * from './lib/utils/layout';
9
9
  export * from './lib/utils/position';
10
10
  export * from './lib/Flex';
11
+ export * from './lib/Grid';
11
12
  export * from './lib/Stack';
@@ -0,0 +1,52 @@
1
+ import { BoxProps } from './Box';
2
+ import { GridStyleProps } from './utils/grid';
3
+ import { GridItemStyleProps } from './utils/gridItem';
4
+ export declare type GridProps = BoxProps & GridStyleProps;
5
+ export declare type GridItemProps = BoxProps & GridItemStyleProps;
6
+ /**
7
+ * `Grid` is a two-dimensional layout system for the web. It lets you lay content out in rows and columns.
8
+ * It is highly flexible, and can be used on its own or to build other components.
9
+ *
10
+ * @example
11
+ * ```
12
+ * import { Grid } from '@workday/canvas-kit-react/layout';
13
+ * `Grid` is built on top of `Box` and has access to all `BoxProps`.
14
+ *
15
+ * interface CardProps extends GridProps {
16
+ * // card-specific props
17
+ * }
18
+ *
19
+ * // `Card`'s default values are set using `GridProps`
20
+ * const Card = (props: CardProps) => (
21
+ * <Grid gridAutoFlow="row" alignItems="start" depth={1} space="m" {...props}>
22
+ * <h1>Hello, Card!</h1>
23
+ * <p>This card uses grid to set its layout.</p>
24
+ * </Grid>
25
+ * );
26
+ *```
27
+ */
28
+ export declare const Grid: import("../../common").ElementComponent<"div", import("..").BorderShorthandStyleProps & import("..").BorderColorStyleProps & import("..").BorderRadiusStyleProps & import("..").BorderLineStyleProps & import("..").BorderWidthStyleProps & import("..").BorderLogicalStyleProps & import("..").ColorStyleProps & import("..").DepthStyleProps & import("..").FlexItemStyleProps & import("..").LayoutStyleProps & import("./utils/other").OtherStyleProps & import("..").PositionStandardProps & import("..").PositionLogicalProps & import("./utils/space").SpaceStandardProps & import("./utils/space").SpaceLogicalProps & GridStyleProps> & {
29
+ /**
30
+ * `<Grid.Item />` is the child specific sub-component to `<Grid/>`. `<Grid.Item />` gets child specific props, whereas `<Grid./>` gets parent container props.
31
+ *
32
+ * @example
33
+ * ```
34
+ * import { Grid } from '@workday/canvas-kit-react/layout';
35
+ * `Grid` is built on top of `Box` so `<Grid.Item />` gets all `BoxProps` as well.
36
+ *
37
+ * interface CardProps extends GridItemStyleProps {
38
+ * // card-specific props
39
+ * }
40
+ *
41
+ * // `Card`'s default values are set using `GridItemStyleProps`
42
+ * const Card = (props: CardProps) => (
43
+ * <Grid.Item gridRowStart="1" gridArea="Card" {...props}>
44
+ * <h1>Hello, Card!</h1>
45
+ * <p>This card uses grid child specific props to set its layout.</p>
46
+ * </Grid.Item>
47
+ * );
48
+ *```
49
+ */
50
+ Item: import("../../common").ElementComponent<"div", import("..").BorderShorthandStyleProps & import("..").BorderColorStyleProps & import("..").BorderRadiusStyleProps & import("..").BorderLineStyleProps & import("..").BorderWidthStyleProps & import("..").BorderLogicalStyleProps & import("..").ColorStyleProps & import("..").DepthStyleProps & import("..").FlexItemStyleProps & import("..").LayoutStyleProps & import("./utils/other").OtherStyleProps & import("..").PositionStandardProps & import("..").PositionLogicalProps & import("./utils/space").SpaceStandardProps & import("./utils/space").SpaceLogicalProps & GridItemStyleProps>;
51
+ };
52
+ //# sourceMappingURL=Grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../../../layout/lib/Grid.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAM,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEpC,OAAO,EAAO,cAAc,EAAC,MAAM,cAAc,CAAC;AAClD,OAAO,EAAW,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAE9D,oBAAY,SAAS,GAAG,QAAQ,GAAG,cAAc,CAAC;AAClD,oBAAY,aAAa,GAAG,QAAQ,GAAG,kBAAkB,CAAC;AAsB1D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,IAAI;IAUb;;;;;;;;;;;;;;;;;;;;OAoBG;;CAIL,CAAC"}
@@ -0,0 +1,92 @@
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
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import * as React from 'react';
24
+ import styled from '@emotion/styled';
25
+ import { createComponent } from '@workday/canvas-kit-react/common';
26
+ import { Box } from './Box';
27
+ import { grid } from './utils/grid';
28
+ import { gridItem } from './utils/gridItem';
29
+ var StyledGrid = styled(Box)({
30
+ display: 'grid',
31
+ }, grid);
32
+ var StyledGridItem = styled(Box)(gridItem);
33
+ var GridItem = createComponent('div')({
34
+ displayName: 'Grid.Item',
35
+ Component: function (_a, ref, Element) {
36
+ var children = _a.children, elemProps = __rest(_a, ["children"]);
37
+ return (React.createElement(StyledGridItem, __assign({ as: Element, ref: ref }, elemProps), children));
38
+ },
39
+ });
40
+ /**
41
+ * `Grid` is a two-dimensional layout system for the web. It lets you lay content out in rows and columns.
42
+ * It is highly flexible, and can be used on its own or to build other components.
43
+ *
44
+ * @example
45
+ * ```
46
+ * import { Grid } from '@workday/canvas-kit-react/layout';
47
+ * `Grid` is built on top of `Box` and has access to all `BoxProps`.
48
+ *
49
+ * interface CardProps extends GridProps {
50
+ * // card-specific props
51
+ * }
52
+ *
53
+ * // `Card`'s default values are set using `GridProps`
54
+ * const Card = (props: CardProps) => (
55
+ * <Grid gridAutoFlow="row" alignItems="start" depth={1} space="m" {...props}>
56
+ * <h1>Hello, Card!</h1>
57
+ * <p>This card uses grid to set its layout.</p>
58
+ * </Grid>
59
+ * );
60
+ *```
61
+ */
62
+ export var Grid = createComponent('div')({
63
+ displayName: 'Grid',
64
+ Component: function (_a, ref, Element) {
65
+ var children = _a.children, elemProps = __rest(_a, ["children"]);
66
+ return (React.createElement(StyledGrid, __assign({ as: Element, ref: ref }, elemProps), children));
67
+ },
68
+ subComponents: {
69
+ /**
70
+ * `<Grid.Item />` is the child specific sub-component to `<Grid/>`. `<Grid.Item />` gets child specific props, whereas `<Grid./>` gets parent container props.
71
+ *
72
+ * @example
73
+ * ```
74
+ * import { Grid } from '@workday/canvas-kit-react/layout';
75
+ * `Grid` is built on top of `Box` so `<Grid.Item />` gets all `BoxProps` as well.
76
+ *
77
+ * interface CardProps extends GridItemStyleProps {
78
+ * // card-specific props
79
+ * }
80
+ *
81
+ * // `Card`'s default values are set using `GridItemStyleProps`
82
+ * const Card = (props: CardProps) => (
83
+ * <Grid.Item gridRowStart="1" gridArea="Card" {...props}>
84
+ * <h1>Hello, Card!</h1>
85
+ * <p>This card uses grid child specific props to set its layout.</p>
86
+ * </Grid.Item>
87
+ * );
88
+ *```
89
+ */
90
+ Item: GridItem,
91
+ },
92
+ });
@@ -55,8 +55,8 @@ export var Stack = createComponent('div')({
55
55
  export var HStack = createComponent('div')({
56
56
  displayName: 'HStack',
57
57
  Component: function (_a, ref, Element) {
58
- var children = _a.children, elemProps = __rest(_a, ["children"]);
59
- return (React.createElement(Stack, __assign({ as: Element, ref: ref, flexDirection: "row" }, elemProps), children));
58
+ var children = _a.children, _b = _a.flexDirection, flexDirection = _b === void 0 ? 'row' : _b, elemProps = __rest(_a, ["children", "flexDirection"]);
59
+ return (React.createElement(Stack, __assign({ as: Element, ref: ref, flexDirection: flexDirection }, elemProps), children));
60
60
  },
61
61
  subComponents: {
62
62
  Item: StackItem,
@@ -65,8 +65,8 @@ export var HStack = createComponent('div')({
65
65
  export var VStack = createComponent('div')({
66
66
  displayName: 'VStack',
67
67
  Component: function (_a, ref, Element) {
68
- var children = _a.children, elemProps = __rest(_a, ["children"]);
69
- return (React.createElement(Stack, __assign({ as: Element, ref: ref, flexDirection: "column" }, elemProps), children));
68
+ var children = _a.children, _b = _a.flexDirection, flexDirection = _b === void 0 ? 'column' : _b, elemProps = __rest(_a, ["children", "flexDirection"]);
69
+ return (React.createElement(Stack, __assign({ as: Element, ref: ref, flexDirection: flexDirection }, elemProps), children));
70
70
  },
71
71
  subComponents: {
72
72
  Item: StackItem,
@@ -0,0 +1,58 @@
1
+ import { Property } from 'csstype';
2
+ /** style props to for grid container properties */
3
+ export declare type GridStyleProps = {
4
+ /** sets `align-items` property */
5
+ alignItems?: Property.AlignItems;
6
+ /** sets `align-content` property */
7
+ alignContent?: Property.AlignContent;
8
+ /**
9
+ * sets `display` property
10
+ * @default 'grid'
11
+ * */
12
+ display?: 'grid' | 'inline-grid';
13
+ /** sets `justify-items` property */
14
+ justifyItems?: Property.JustifyItems;
15
+ /** sets `justify-content` property */
16
+ justifyContent?: Property.JustifyContent;
17
+ /** sets `grid-template` property */
18
+ gridTemplate?: Property.GridTemplate;
19
+ /** sets `grid-template-area` property */
20
+ gridTemplateAreas?: Property.GridTemplateAreas;
21
+ /** sets `grid-template-columns` property */
22
+ gridTemplateColumns?: Property.GridTemplateColumns;
23
+ /** sets `grid-template-rows` property */
24
+ gridTemplateRows?: Property.GridTemplateRows;
25
+ /** sets `gap` property */
26
+ gridGap?: Property.GridGap;
27
+ /** sets `column-gap` property */
28
+ gridColumnGap?: Property.GridColumnGap;
29
+ /** sets `row-gap` property */
30
+ gridRowGap?: Property.GridRowGap;
31
+ /** sets `place-items` property */
32
+ gridPlaceItems?: Property.PlaceItems;
33
+ /** sets `grid-auto-columns` property */
34
+ gridAutoColumns?: Property.GridAutoColumns;
35
+ /** sets `grid-auto-rows` property */
36
+ gridAutoRows?: Property.GridAutoRows;
37
+ /** sets `grid-area` property */
38
+ gridArea?: Property.GridArea;
39
+ /** sets `grid-auto-flow` property */
40
+ gridAutoFlow?: Property.GridAutoFlow;
41
+ /** sets `grid` property */
42
+ grid?: Property.Grid;
43
+ };
44
+ /**
45
+ * A style prop function that takes component props and returns grid styles.
46
+ * If no `GridStyleProps` are found, it returns an empty object.
47
+ *
48
+ * @example
49
+ * // You'll most likely use `grid` with low-level, styled components
50
+ * const GridExample = () => (
51
+ * <Grid gridAutoFlow="row" justifyContent="center" alignItems="center">
52
+ * Hello, Grid!
53
+ * </Grid>
54
+ * );
55
+ *
56
+ */
57
+ export declare function grid<P extends GridStyleProps>(props: P): {};
58
+ //# sourceMappingURL=grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEjC,mDAAmD;AACnD,oBAAY,cAAc,GAAG;IAC3B,kCAAkC;IAClC,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACjC,oCAAoC;IACpC,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC;;;SAGK;IACL,OAAO,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;IACjC,oCAAoC;IACpC,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC,sCAAsC;IACtC,cAAc,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC;IAGzC,oCAAoC;IACpC,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC,yCAAyC;IACzC,iBAAiB,CAAC,EAAE,QAAQ,CAAC,iBAAiB,CAAC;IAC/C,4CAA4C;IAC5C,mBAAmB,CAAC,EAAE,QAAQ,CAAC,mBAAmB,CAAC;IACnD,yCAAyC;IACzC,gBAAgB,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC;IAC7C,0BAA0B;IAC1B,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC;IAC3B,iCAAiC;IACjC,aAAa,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC;IACvC,8BAA8B;IAC9B,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACjC,kCAAkC;IAClC,cAAc,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACrC,wCAAwC;IACxC,eAAe,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC;IAC3C,qCAAqC;IACrC,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC,gCAAgC;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAC7B,qCAAqC;IACrC,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC,2BAA2B;IAC3B,IAAI,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC;CACtB,CAAC;AAuBF;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,CAAC,MAWtD"}
@@ -0,0 +1,45 @@
1
+ var gridProps = {
2
+ alignContent: 'alignContent',
3
+ alignItems: 'alignItems',
4
+ display: 'display',
5
+ justifyContent: 'justifyContent',
6
+ justifyItems: 'justifyItems',
7
+ gridTemplateAreas: 'gridTemplateAreas',
8
+ gridTemplate: 'gridTemplate',
9
+ gridTemplateColumns: 'gridTemplateColumns',
10
+ gridTemplateRows: 'gridTemplateRows',
11
+ gridGap: 'gridGap',
12
+ gridColumnGap: 'gridColumnGap',
13
+ gridRowGap: 'gridRowGap',
14
+ gridPlaceItems: 'gridPlaceItems',
15
+ gridAutoColumns: 'gridAutoColumns',
16
+ gridAutoRows: 'gridAutoRows',
17
+ gridAutoFlow: 'gridAutoFlow',
18
+ gridArea: 'gridArea',
19
+ grid: 'grid',
20
+ };
21
+ /**
22
+ * A style prop function that takes component props and returns grid styles.
23
+ * If no `GridStyleProps` are found, it returns an empty object.
24
+ *
25
+ * @example
26
+ * // You'll most likely use `grid` with low-level, styled components
27
+ * const GridExample = () => (
28
+ * <Grid gridAutoFlow="row" justifyContent="center" alignItems="center">
29
+ * Hello, Grid!
30
+ * </Grid>
31
+ * );
32
+ *
33
+ */
34
+ export function grid(props) {
35
+ var styles = {};
36
+ for (var key in props) {
37
+ if (key in gridProps) {
38
+ var attr = gridProps[key];
39
+ var value = props[key];
40
+ // @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
41
+ styles[attr] = value;
42
+ }
43
+ }
44
+ return styles;
45
+ }
@@ -0,0 +1,39 @@
1
+ import { Property } from 'csstype';
2
+ /** style props to for grid item properties */
3
+ export declare type GridItemStyleProps = {
4
+ /** sets `grid-column-start` property */
5
+ gridColumnStart?: Property.GridColumnStart;
6
+ /** sets `grid-column-end` property */
7
+ gridColumnEnd?: Property.GridColumnEnd;
8
+ /** sets `grid-row-start` property */
9
+ gridRowStart?: Property.GridRowStart;
10
+ /** sets `grid-row-end` property */
11
+ gridRowEnd?: Property.GridRowEnd;
12
+ /** sets `grid-column` property */
13
+ gridColumn?: Property.GridColumn;
14
+ /** sets `grid-row` property */
15
+ gridRow?: Property.GridRow;
16
+ /** sets `grid-area` property */
17
+ gridArea?: Property.GridArea;
18
+ /** sets `justify-self` property */
19
+ justifySelf?: Property.JustifySelf;
20
+ /** sets `align-self` property */
21
+ alignSelf?: Property.AlignSelf;
22
+ /** sets `place-self` property */
23
+ placeSelf?: Property.PlaceSelf;
24
+ };
25
+ /**
26
+ * A style prop function that takes component props and returns grid styles.
27
+ * If no `GridItemStyleProps` are found, it returns an empty object.
28
+ *
29
+ * @example
30
+ * // You'll most likely use `grid item` with low-level, styled components
31
+ * const GridItemExample = () => (
32
+ * <Grid.Item gridRowStart="1" justifySelf="center" gridArea="Card">
33
+ * Hello, Grid Item!
34
+ * </Grid.Item>
35
+ * );
36
+ *
37
+ */
38
+ export declare function gridItem<P extends GridItemStyleProps>(props: P): {};
39
+ //# sourceMappingURL=gridItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gridItem.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/gridItem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEjC,8CAA8C;AAC9C,oBAAY,kBAAkB,GAAG;IAE/B,wCAAwC;IACxC,eAAe,CAAC,EAAE,QAAQ,CAAC,eAAe,CAAC;IAC3C,sCAAsC;IACtC,aAAa,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC;IACvC,qCAAqC;IACrC,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC,mCAAmC;IACnC,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACjC,kCAAkC;IAClC,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACjC,+BAA+B;IAC/B,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC;IAC3B,gCAAgC;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAC7B,mCAAmC;IACnC,WAAW,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC;IACnC,iCAAiC;IACjC,SAAS,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC;IAC/B,iCAAiC;IACjC,SAAS,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC;CAChC,CAAC;AAiBF;;;;;;;;;;;;GAYG;AAEH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,kBAAkB,EAAE,KAAK,EAAE,CAAC,MAW9D"}
@@ -0,0 +1,39 @@
1
+ /** style props to for grid item properties */
2
+ var gridItemProps = {
3
+ //Child Props
4
+ gridColumnStart: 'gridColumnStart',
5
+ gridColumnEnd: 'gridColumnEnd',
6
+ gridRowStart: 'gridRowStart',
7
+ gridRowEnd: 'gridRowEnd',
8
+ gridColumn: 'gridColumn',
9
+ gridRow: 'gridRow',
10
+ gridArea: 'gridArea',
11
+ justifySelf: 'justifySelf',
12
+ alignSelf: 'alignSelf',
13
+ placeSelf: 'placeSelf',
14
+ };
15
+ /**
16
+ * A style prop function that takes component props and returns grid styles.
17
+ * If no `GridItemStyleProps` are found, it returns an empty object.
18
+ *
19
+ * @example
20
+ * // You'll most likely use `grid item` with low-level, styled components
21
+ * const GridItemExample = () => (
22
+ * <Grid.Item gridRowStart="1" justifySelf="center" gridArea="Card">
23
+ * Hello, Grid Item!
24
+ * </Grid.Item>
25
+ * );
26
+ *
27
+ */
28
+ export function gridItem(props) {
29
+ var styles = {};
30
+ for (var key in props) {
31
+ if (key in gridItemProps) {
32
+ var attr = gridItemProps[key];
33
+ var value = props[key];
34
+ // @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
35
+ styles[attr] = value;
36
+ }
37
+ }
38
+ return styles;
39
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../text-input/index.ts"],"names":[],"mappings":"AACA,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../text-input/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC"}
@@ -1,4 +1,3 @@
1
-
2
1
  export * from './lib/types';
3
2
  export * from './lib/FormField';
4
3
  export * from './lib/Hint';
package/layout/index.ts CHANGED
@@ -11,6 +11,8 @@ export * from './lib/utils/layout';
11
11
  export * from './lib/utils/position';
12
12
  export {SpaceStyleProps} from './lib/utils/space';
13
13
  export * from './lib/Flex';
14
+ export * from './lib/Grid';
14
15
  export * from './lib/Stack';
15
16
  export type { FlexStyleProps } from './lib/utils/flex';
17
+ export type { GridStyleProps } from './lib/utils/grid';
16
18
  export type { StackSpacing, StackDirection, StackStyleProps } from './lib/utils/stack';
@@ -0,0 +1,88 @@
1
+ import * as React from 'react';
2
+ import styled from '@emotion/styled';
3
+ import {createComponent, StyledType} from '@workday/canvas-kit-react/common';
4
+ import {Box, BoxProps} from './Box';
5
+
6
+ import {grid, GridStyleProps} from './utils/grid';
7
+ import {gridItem, GridItemStyleProps} from './utils/gridItem';
8
+
9
+ export type GridProps = BoxProps & GridStyleProps;
10
+ export type GridItemProps = BoxProps & GridItemStyleProps;
11
+
12
+ const StyledGrid = styled(Box)<StyledType & GridProps>(
13
+ {
14
+ display: 'grid',
15
+ },
16
+ grid
17
+ );
18
+
19
+ const StyledGridItem = styled(Box)<StyledType & GridItemProps>(gridItem);
20
+
21
+ const GridItem = createComponent('div')({
22
+ displayName: 'Grid.Item',
23
+ Component: ({children, ...elemProps}: GridItemProps, ref, Element) => {
24
+ return (
25
+ <StyledGridItem as={Element} ref={ref} {...elemProps}>
26
+ {children}
27
+ </StyledGridItem>
28
+ );
29
+ },
30
+ });
31
+
32
+ /**
33
+ * `Grid` is a two-dimensional layout system for the web. It lets you lay content out in rows and columns.
34
+ * It is highly flexible, and can be used on its own or to build other components.
35
+ *
36
+ * @example
37
+ * ```
38
+ * import { Grid } from '@workday/canvas-kit-react/layout';
39
+ * `Grid` is built on top of `Box` and has access to all `BoxProps`.
40
+ *
41
+ * interface CardProps extends GridProps {
42
+ * // card-specific props
43
+ * }
44
+ *
45
+ * // `Card`'s default values are set using `GridProps`
46
+ * const Card = (props: CardProps) => (
47
+ * <Grid gridAutoFlow="row" alignItems="start" depth={1} space="m" {...props}>
48
+ * <h1>Hello, Card!</h1>
49
+ * <p>This card uses grid to set its layout.</p>
50
+ * </Grid>
51
+ * );
52
+ *```
53
+ */
54
+ export const Grid = createComponent('div')({
55
+ displayName: 'Grid',
56
+ Component: ({children, ...elemProps}: GridProps, ref, Element) => {
57
+ return (
58
+ <StyledGrid as={Element} ref={ref} {...elemProps}>
59
+ {children}
60
+ </StyledGrid>
61
+ );
62
+ },
63
+ subComponents: {
64
+ /**
65
+ * `<Grid.Item />` is the child specific sub-component to `<Grid/>`. `<Grid.Item />` gets child specific props, whereas `<Grid./>` gets parent container props.
66
+ *
67
+ * @example
68
+ * ```
69
+ * import { Grid } from '@workday/canvas-kit-react/layout';
70
+ * `Grid` is built on top of `Box` so `<Grid.Item />` gets all `BoxProps` as well.
71
+ *
72
+ * interface CardProps extends GridItemStyleProps {
73
+ * // card-specific props
74
+ * }
75
+ *
76
+ * // `Card`'s default values are set using `GridItemStyleProps`
77
+ * const Card = (props: CardProps) => (
78
+ * <Grid.Item gridRowStart="1" gridArea="Card" {...props}>
79
+ * <h1>Hello, Card!</h1>
80
+ * <p>This card uses grid child specific props to set its layout.</p>
81
+ * </Grid.Item>
82
+ * );
83
+ *```
84
+ */
85
+
86
+ Item: GridItem,
87
+ },
88
+ });
@@ -62,9 +62,9 @@ export interface HStackProps extends StackProps {
62
62
 
63
63
  export const HStack = createComponent('div')({
64
64
  displayName: 'HStack',
65
- Component: ({children, ...elemProps}: HStackProps, ref, Element) => {
65
+ Component: ({children, flexDirection = 'row', ...elemProps}: HStackProps, ref, Element) => {
66
66
  return (
67
- <Stack as={Element} ref={ref} flexDirection="row" {...elemProps}>
67
+ <Stack as={Element} ref={ref} flexDirection={flexDirection} {...elemProps}>
68
68
  {children}
69
69
  </Stack>
70
70
  );
@@ -84,9 +84,9 @@ export interface VStackProps extends StackProps {
84
84
 
85
85
  export const VStack = createComponent('div')({
86
86
  displayName: 'VStack',
87
- Component: ({children, ...elemProps}: VStackProps, ref, Element) => {
87
+ Component: ({children, flexDirection = 'column', ...elemProps}: VStackProps, ref, Element) => {
88
88
  return (
89
- <Stack as={Element} ref={ref} flexDirection="column" {...elemProps}>
89
+ <Stack as={Element} ref={ref} flexDirection={flexDirection} {...elemProps}>
90
90
  {children}
91
91
  </Stack>
92
92
  );
@@ -0,0 +1,93 @@
1
+ import {Property} from 'csstype';
2
+
3
+ /** style props to for grid container properties */
4
+ export type GridStyleProps = {
5
+ /** sets `align-items` property */
6
+ alignItems?: Property.AlignItems;
7
+ /** sets `align-content` property */
8
+ alignContent?: Property.AlignContent;
9
+ /**
10
+ * sets `display` property
11
+ * @default 'grid'
12
+ * */
13
+ display?: 'grid' | 'inline-grid';
14
+ /** sets `justify-items` property */
15
+ justifyItems?: Property.JustifyItems;
16
+ /** sets `justify-content` property */
17
+ justifyContent?: Property.JustifyContent;
18
+
19
+ // Container Types
20
+ /** sets `grid-template` property */
21
+ gridTemplate?: Property.GridTemplate;
22
+ /** sets `grid-template-area` property */
23
+ gridTemplateAreas?: Property.GridTemplateAreas;
24
+ /** sets `grid-template-columns` property */
25
+ gridTemplateColumns?: Property.GridTemplateColumns;
26
+ /** sets `grid-template-rows` property */
27
+ gridTemplateRows?: Property.GridTemplateRows;
28
+ /** sets `gap` property */
29
+ gridGap?: Property.GridGap;
30
+ /** sets `column-gap` property */
31
+ gridColumnGap?: Property.GridColumnGap;
32
+ /** sets `row-gap` property */
33
+ gridRowGap?: Property.GridRowGap;
34
+ /** sets `place-items` property */
35
+ gridPlaceItems?: Property.PlaceItems;
36
+ /** sets `grid-auto-columns` property */
37
+ gridAutoColumns?: Property.GridAutoColumns;
38
+ /** sets `grid-auto-rows` property */
39
+ gridAutoRows?: Property.GridAutoRows;
40
+ /** sets `grid-area` property */
41
+ gridArea?: Property.GridArea;
42
+ /** sets `grid-auto-flow` property */
43
+ gridAutoFlow?: Property.GridAutoFlow;
44
+ /** sets `grid` property */
45
+ grid?: Property.Grid;
46
+ };
47
+
48
+ const gridProps = {
49
+ alignContent: 'alignContent',
50
+ alignItems: 'alignItems',
51
+ display: 'display',
52
+ justifyContent: 'justifyContent',
53
+ justifyItems: 'justifyItems',
54
+ gridTemplateAreas: 'gridTemplateAreas',
55
+ gridTemplate: 'gridTemplate',
56
+ gridTemplateColumns: 'gridTemplateColumns',
57
+ gridTemplateRows: 'gridTemplateRows',
58
+ gridGap: 'gridGap',
59
+ gridColumnGap: 'gridColumnGap',
60
+ gridRowGap: 'gridRowGap',
61
+ gridPlaceItems: 'gridPlaceItems',
62
+ gridAutoColumns: 'gridAutoColumns',
63
+ gridAutoRows: 'gridAutoRows',
64
+ gridAutoFlow: 'gridAutoFlow',
65
+ gridArea: 'gridArea',
66
+ grid: 'grid',
67
+ };
68
+
69
+ /**
70
+ * A style prop function that takes component props and returns grid styles.
71
+ * If no `GridStyleProps` are found, it returns an empty object.
72
+ *
73
+ * @example
74
+ * // You'll most likely use `grid` with low-level, styled components
75
+ * const GridExample = () => (
76
+ * <Grid gridAutoFlow="row" justifyContent="center" alignItems="center">
77
+ * Hello, Grid!
78
+ * </Grid>
79
+ * );
80
+ *
81
+ */
82
+ export function grid<P extends GridStyleProps>(props: P) {
83
+ const styles = {};
84
+ for (const key in props) {
85
+ if (key in gridProps) {
86
+ const attr = gridProps[key as keyof GridStyleProps];
87
+ const value = props[key];
88
+ // @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
89
+ styles[attr] = value;
90
+ }
91
+ }
92
+ return styles;
93
+ }
@@ -0,0 +1,68 @@
1
+ import {Property} from 'csstype';
2
+
3
+ /** style props to for grid item properties */
4
+ export type GridItemStyleProps = {
5
+ // Child Types
6
+ /** sets `grid-column-start` property */
7
+ gridColumnStart?: Property.GridColumnStart;
8
+ /** sets `grid-column-end` property */
9
+ gridColumnEnd?: Property.GridColumnEnd;
10
+ /** sets `grid-row-start` property */
11
+ gridRowStart?: Property.GridRowStart;
12
+ /** sets `grid-row-end` property */
13
+ gridRowEnd?: Property.GridRowEnd;
14
+ /** sets `grid-column` property */
15
+ gridColumn?: Property.GridColumn;
16
+ /** sets `grid-row` property */
17
+ gridRow?: Property.GridRow;
18
+ /** sets `grid-area` property */
19
+ gridArea?: Property.GridArea;
20
+ /** sets `justify-self` property */
21
+ justifySelf?: Property.JustifySelf;
22
+ /** sets `align-self` property */
23
+ alignSelf?: Property.AlignSelf;
24
+ /** sets `place-self` property */
25
+ placeSelf?: Property.PlaceSelf;
26
+ };
27
+
28
+ /** style props to for grid item properties */
29
+ const gridItemProps = {
30
+ //Child Props
31
+ gridColumnStart: 'gridColumnStart',
32
+ gridColumnEnd: 'gridColumnEnd',
33
+ gridRowStart: 'gridRowStart',
34
+ gridRowEnd: 'gridRowEnd',
35
+ gridColumn: 'gridColumn',
36
+ gridRow: 'gridRow',
37
+ gridArea: 'gridArea',
38
+ justifySelf: 'justifySelf',
39
+ alignSelf: 'alignSelf',
40
+ placeSelf: 'placeSelf',
41
+ };
42
+
43
+ /**
44
+ * A style prop function that takes component props and returns grid styles.
45
+ * If no `GridItemStyleProps` are found, it returns an empty object.
46
+ *
47
+ * @example
48
+ * // You'll most likely use `grid item` with low-level, styled components
49
+ * const GridItemExample = () => (
50
+ * <Grid.Item gridRowStart="1" justifySelf="center" gridArea="Card">
51
+ * Hello, Grid Item!
52
+ * </Grid.Item>
53
+ * );
54
+ *
55
+ */
56
+
57
+ export function gridItem<P extends GridItemStyleProps>(props: P) {
58
+ const styles = {};
59
+ for (const key in props) {
60
+ if (key in gridItemProps) {
61
+ const attr = gridItemProps[key as keyof GridItemStyleProps];
62
+ const value = props[key];
63
+ // @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
64
+ styles[attr] = value;
65
+ }
66
+ }
67
+ return styles;
68
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-react",
3
- "version": "8.0.0-alpha.145-next.1+6fb6abb4",
3
+ "version": "8.0.0-alpha.150-next.2+b0c3f340",
4
4
  "description": "The parent module that contains all Workday Canvas Kit React components",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -49,9 +49,9 @@
49
49
  "@emotion/styled": "^11.6.0",
50
50
  "@popperjs/core": "^2.5.4",
51
51
  "@workday/canvas-colors-web": "^2.0.0",
52
- "@workday/canvas-kit-labs-react": "^8.0.0-alpha.145-next.1+6fb6abb4",
53
- "@workday/canvas-kit-popup-stack": "^8.0.0-alpha.145-next.1+6fb6abb4",
54
- "@workday/canvas-kit-preview-react": "^8.0.0-alpha.145-next.1+6fb6abb4",
52
+ "@workday/canvas-kit-labs-react": "^8.0.0-alpha.150-next.2+b0c3f340",
53
+ "@workday/canvas-kit-popup-stack": "^8.0.0-alpha.150-next.2+b0c3f340",
54
+ "@workday/canvas-kit-preview-react": "^8.0.0-alpha.150-next.2+b0c3f340",
55
55
  "@workday/canvas-system-icons-web": "^3.0.0",
56
56
  "@workday/design-assets-types": "^0.2.8",
57
57
  "chroma-js": "^2.1.0",
@@ -70,5 +70,5 @@
70
70
  "@workday/canvas-accent-icons-web": "^3.0.0",
71
71
  "@workday/canvas-applet-icons-web": "^2.0.0"
72
72
  },
73
- "gitHead": "6fb6abb422ed1d9b9441caff94f3465e903213b3"
73
+ "gitHead": "b0c3f340ec8e06d39bed5d992b23a1b36892106f"
74
74
  }
@@ -1,3 +1,2 @@
1
-
2
1
  export * from './lib/InputIconContainer';
3
2
  export * from './lib/TextInput';