@workday/canvas-kit-react 8.0.0-alpha.208-next.1 → 8.0.0-alpha.222-next.6
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/lib/theming/index.ts +1 -1
- package/common/lib/theming/styled.ts +6 -3
- package/common/lib/utils/elements.ts +4 -4
- package/common/lib/utils/index.ts +0 -1
- package/dist/commonjs/card/lib/Card.d.ts +1 -1
- package/dist/commonjs/card/lib/CardBody.d.ts +1 -1
- package/dist/commonjs/card/lib/CardBody.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/index.d.ts +1 -1
- package/dist/commonjs/common/lib/theming/index.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/styled.d.ts +2 -0
- package/dist/commonjs/common/lib/theming/styled.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/styled.js +1 -2
- package/dist/commonjs/common/lib/utils/elements.d.ts +1 -1
- package/dist/commonjs/common/lib/utils/elements.d.ts.map +1 -1
- package/dist/commonjs/common/lib/utils/elements.js +3 -3
- package/dist/commonjs/common/lib/utils/index.d.ts +0 -1
- package/dist/commonjs/common/lib/utils/index.d.ts.map +1 -1
- package/dist/commonjs/common/lib/utils/index.js +0 -1
- package/dist/commonjs/dialog/lib/Dialog.d.ts +1 -1
- package/dist/commonjs/icon/lib/SystemIcon.d.ts +1 -1
- package/dist/commonjs/icon/lib/SystemIcon.d.ts.map +1 -1
- package/dist/commonjs/index.d.ts +1 -0
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +1 -0
- package/dist/commonjs/layout/index.d.ts +8 -4
- package/dist/commonjs/layout/index.d.ts.map +1 -1
- package/dist/commonjs/layout/index.js +10 -2
- package/dist/commonjs/layout/lib/Box.d.ts +6 -4
- package/dist/commonjs/layout/lib/Box.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/Box.js +8 -9
- package/dist/commonjs/layout/lib/Flex.d.ts +5 -2
- package/dist/commonjs/layout/lib/Flex.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/Flex.js +5 -1
- package/dist/commonjs/layout/lib/Grid.d.ts +5 -6
- package/dist/commonjs/layout/lib/Grid.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/Grid.js +2 -2
- package/dist/commonjs/layout/lib/Stack.d.ts +4 -4
- package/dist/commonjs/layout/lib/utils/background.d.ts +44 -0
- package/dist/commonjs/layout/lib/utils/background.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/background.js +57 -0
- package/dist/commonjs/layout/lib/utils/border/color.d.ts +47 -0
- package/dist/commonjs/layout/lib/utils/border/color.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/border/color.js +42 -0
- package/dist/commonjs/layout/lib/utils/border/index.d.ts +26 -0
- package/dist/commonjs/layout/lib/utils/border/index.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/border/index.js +46 -0
- package/dist/commonjs/layout/lib/utils/border/lineStyle.d.ts +38 -0
- package/dist/commonjs/layout/lib/utils/border/lineStyle.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/border/lineStyle.js +52 -0
- package/dist/commonjs/layout/lib/utils/border/radius.d.ts +33 -0
- package/dist/commonjs/layout/lib/utils/border/radius.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/border/radius.js +32 -0
- package/dist/commonjs/layout/lib/utils/border/shorthand.d.ts +34 -0
- package/dist/commonjs/layout/lib/utils/border/shorthand.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/border/shorthand.js +42 -0
- package/dist/commonjs/layout/lib/utils/border/width.d.ts +34 -0
- package/dist/commonjs/layout/lib/utils/border/width.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/border/width.js +42 -0
- package/dist/commonjs/layout/lib/utils/buildStyleFns.d.ts +12 -0
- package/dist/commonjs/layout/lib/utils/buildStyleFns.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/buildStyleFns.js +90 -0
- package/dist/commonjs/layout/lib/utils/color.d.ts +23 -16
- package/dist/commonjs/layout/lib/utils/color.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/color.js +25 -49
- package/dist/commonjs/layout/lib/utils/depth.d.ts +17 -11
- package/dist/commonjs/layout/lib/utils/depth.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/depth.js +20 -20
- package/dist/commonjs/layout/lib/utils/flex.d.ts +31 -12
- package/dist/commonjs/layout/lib/utils/flex.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/flex.js +58 -25
- package/dist/commonjs/layout/lib/utils/flexItem.d.ts +18 -15
- package/dist/commonjs/layout/lib/utils/flexItem.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/flexItem.js +43 -26
- package/dist/commonjs/layout/lib/utils/grid.d.ts +40 -35
- package/dist/commonjs/layout/lib/utils/grid.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/grid.js +99 -72
- package/dist/commonjs/layout/lib/utils/gridItem.d.ts +17 -14
- package/dist/commonjs/layout/lib/utils/gridItem.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/gridItem.js +58 -30
- package/dist/commonjs/layout/lib/utils/layout.d.ts +47 -25
- package/dist/commonjs/layout/lib/utils/layout.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/layout.js +71 -33
- package/dist/commonjs/layout/lib/utils/other.d.ts +44 -2
- package/dist/commonjs/layout/lib/utils/other.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/other.js +101 -17
- package/dist/commonjs/layout/lib/utils/position.d.ts +37 -20
- package/dist/commonjs/layout/lib/utils/position.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/position.js +49 -66
- package/dist/commonjs/layout/lib/utils/space.d.ts +107 -51
- package/dist/commonjs/layout/lib/utils/space.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/space.js +98 -148
- package/dist/commonjs/layout/lib/utils/stack.d.ts +3 -6
- package/dist/commonjs/layout/lib/utils/stack.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/stack.js +13 -39
- package/dist/commonjs/layout/lib/utils/systemProps.d.ts +31 -0
- package/dist/commonjs/layout/lib/utils/systemProps.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/systemProps.js +2 -0
- package/dist/commonjs/layout/lib/utils/text.d.ts +33 -15
- package/dist/commonjs/layout/lib/utils/text.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/text.js +74 -38
- package/dist/commonjs/modal/lib/Modal.d.ts +1 -1
- package/dist/commonjs/popup/lib/Popup.d.ts +1 -1
- package/dist/commonjs/popup/lib/PopupBody.d.ts +1 -1
- package/dist/commonjs/popup/lib/hooks/useReturnFocus.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/hooks/useReturnFocus.js +72 -7
- package/dist/commonjs/tabs/lib/TabsItem.d.ts +1 -1
- package/dist/commonjs/testing/index.d.ts +5 -0
- package/dist/commonjs/testing/index.d.ts.map +1 -0
- package/dist/commonjs/testing/index.js +16 -0
- package/dist/commonjs/testing/lib/ComponentStatesTable.d.ts +26 -0
- package/dist/commonjs/testing/lib/ComponentStatesTable.d.ts.map +1 -0
- package/dist/commonjs/testing/lib/ComponentStatesTable.js +48 -0
- package/dist/commonjs/testing/lib/StaticStates.d.ts +7 -0
- package/dist/commonjs/testing/lib/StaticStates.d.ts.map +1 -0
- package/dist/commonjs/{common/lib/utils → testing/lib}/StaticStates.js +1 -1
- package/dist/commonjs/testing/lib/permutateProps.d.ts +5 -0
- package/dist/commonjs/testing/lib/permutateProps.d.ts.map +1 -0
- package/dist/commonjs/testing/lib/permutateProps.js +47 -0
- package/dist/commonjs/testing/lib/propTypes.d.ts +15 -0
- package/dist/commonjs/testing/lib/propTypes.d.ts.map +1 -0
- package/dist/commonjs/testing/lib/propTypes.js +2 -0
- package/dist/commonjs/tokens/lib/colors.types.d.ts +4 -6
- package/dist/commonjs/tokens/lib/colors.types.d.ts.map +1 -1
- package/dist/es6/card/lib/Card.d.ts +1 -1
- package/dist/es6/card/lib/CardBody.d.ts +1 -1
- package/dist/es6/card/lib/CardBody.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/index.d.ts +1 -1
- package/dist/es6/common/lib/theming/index.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/styled.d.ts +2 -0
- package/dist/es6/common/lib/theming/styled.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/styled.js +1 -2
- package/dist/es6/common/lib/utils/elements.d.ts +1 -1
- package/dist/es6/common/lib/utils/elements.d.ts.map +1 -1
- package/dist/es6/common/lib/utils/elements.js +3 -3
- package/dist/es6/common/lib/utils/index.d.ts +0 -1
- package/dist/es6/common/lib/utils/index.d.ts.map +1 -1
- package/dist/es6/common/lib/utils/index.js +0 -1
- package/dist/es6/dialog/lib/Dialog.d.ts +1 -1
- package/dist/es6/icon/lib/SystemIcon.d.ts +1 -1
- package/dist/es6/icon/lib/SystemIcon.d.ts.map +1 -1
- package/dist/es6/index.d.ts +1 -0
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +1 -0
- package/dist/es6/layout/index.d.ts +8 -4
- package/dist/es6/layout/index.d.ts.map +1 -1
- package/dist/es6/layout/index.js +7 -1
- package/dist/es6/layout/lib/Box.d.ts +6 -4
- package/dist/es6/layout/lib/Box.d.ts.map +1 -1
- package/dist/es6/layout/lib/Box.js +8 -9
- package/dist/es6/layout/lib/Flex.d.ts +5 -2
- package/dist/es6/layout/lib/Flex.d.ts.map +1 -1
- package/dist/es6/layout/lib/Flex.js +5 -1
- package/dist/es6/layout/lib/Grid.d.ts +5 -6
- package/dist/es6/layout/lib/Grid.d.ts.map +1 -1
- package/dist/es6/layout/lib/Grid.js +2 -2
- package/dist/es6/layout/lib/Stack.d.ts +4 -4
- package/dist/es6/layout/lib/utils/background.d.ts +44 -0
- package/dist/es6/layout/lib/utils/background.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/background.js +54 -0
- package/dist/es6/layout/lib/utils/border/color.d.ts +47 -0
- package/dist/es6/layout/lib/utils/border/color.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/border/color.js +39 -0
- package/dist/es6/layout/lib/utils/border/index.d.ts +26 -0
- package/dist/es6/layout/lib/utils/border/index.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/border/index.js +43 -0
- package/dist/es6/layout/lib/utils/border/lineStyle.d.ts +38 -0
- package/dist/es6/layout/lib/utils/border/lineStyle.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/border/lineStyle.js +49 -0
- package/dist/es6/layout/lib/utils/border/radius.d.ts +33 -0
- package/dist/es6/layout/lib/utils/border/radius.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/border/radius.js +29 -0
- package/dist/es6/layout/lib/utils/border/shorthand.d.ts +34 -0
- package/dist/es6/layout/lib/utils/border/shorthand.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/border/shorthand.js +39 -0
- package/dist/es6/layout/lib/utils/border/width.d.ts +34 -0
- package/dist/es6/layout/lib/utils/border/width.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/border/width.js +39 -0
- package/dist/es6/layout/lib/utils/buildStyleFns.d.ts +12 -0
- package/dist/es6/layout/lib/utils/buildStyleFns.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/buildStyleFns.js +85 -0
- package/dist/es6/layout/lib/utils/color.d.ts +23 -16
- package/dist/es6/layout/lib/utils/color.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/color.js +24 -47
- package/dist/es6/layout/lib/utils/depth.d.ts +17 -11
- package/dist/es6/layout/lib/utils/depth.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/depth.js +19 -18
- package/dist/es6/layout/lib/utils/flex.d.ts +31 -12
- package/dist/es6/layout/lib/utils/flex.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/flex.js +57 -23
- package/dist/es6/layout/lib/utils/flexItem.d.ts +18 -15
- package/dist/es6/layout/lib/utils/flexItem.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/flexItem.js +42 -24
- package/dist/es6/layout/lib/utils/grid.d.ts +40 -35
- package/dist/es6/layout/lib/utils/grid.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/grid.js +98 -70
- package/dist/es6/layout/lib/utils/gridItem.d.ts +17 -14
- package/dist/es6/layout/lib/utils/gridItem.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/gridItem.js +57 -28
- package/dist/es6/layout/lib/utils/layout.d.ts +47 -25
- package/dist/es6/layout/lib/utils/layout.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/layout.js +70 -31
- package/dist/es6/layout/lib/utils/other.d.ts +44 -2
- package/dist/es6/layout/lib/utils/other.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/other.js +100 -15
- package/dist/es6/layout/lib/utils/position.d.ts +37 -20
- package/dist/es6/layout/lib/utils/position.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/position.js +48 -64
- package/dist/es6/layout/lib/utils/space.d.ts +107 -51
- package/dist/es6/layout/lib/utils/space.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/space.js +97 -146
- package/dist/es6/layout/lib/utils/stack.d.ts +3 -6
- package/dist/es6/layout/lib/utils/stack.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/stack.js +13 -39
- package/dist/es6/layout/lib/utils/systemProps.d.ts +31 -0
- package/dist/es6/layout/lib/utils/systemProps.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/systemProps.js +1 -0
- package/dist/es6/layout/lib/utils/text.d.ts +33 -15
- package/dist/es6/layout/lib/utils/text.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/text.js +73 -36
- package/dist/es6/modal/lib/Modal.d.ts +1 -1
- package/dist/es6/popup/lib/Popup.d.ts +1 -1
- package/dist/es6/popup/lib/PopupBody.d.ts +1 -1
- package/dist/es6/popup/lib/hooks/useReturnFocus.d.ts.map +1 -1
- package/dist/es6/popup/lib/hooks/useReturnFocus.js +73 -8
- package/dist/es6/tabs/lib/TabsItem.d.ts +1 -1
- package/dist/es6/testing/index.d.ts +5 -0
- package/dist/es6/testing/index.d.ts.map +1 -0
- package/dist/es6/testing/index.js +4 -0
- package/dist/es6/testing/lib/ComponentStatesTable.d.ts +26 -0
- package/dist/es6/testing/lib/ComponentStatesTable.d.ts.map +1 -0
- package/dist/es6/testing/lib/ComponentStatesTable.js +41 -0
- package/dist/es6/testing/lib/StaticStates.d.ts +7 -0
- package/dist/es6/testing/lib/StaticStates.d.ts.map +1 -0
- package/dist/es6/{common/lib/utils → testing/lib}/StaticStates.js +1 -1
- package/dist/es6/testing/lib/permutateProps.d.ts +5 -0
- package/dist/es6/testing/lib/permutateProps.d.ts.map +1 -0
- package/dist/es6/testing/lib/permutateProps.js +43 -0
- package/dist/es6/testing/lib/propTypes.d.ts +15 -0
- package/dist/es6/testing/lib/propTypes.d.ts.map +1 -0
- package/dist/es6/testing/lib/propTypes.js +1 -0
- package/dist/es6/tokens/lib/colors.types.d.ts +4 -6
- package/dist/es6/tokens/lib/colors.types.d.ts.map +1 -1
- package/icon/lib/SystemIcon.tsx +1 -1
- package/index.ts +1 -0
- package/layout/index.ts +8 -4
- package/layout/lib/Box.tsx +10 -36
- package/layout/lib/Flex.tsx +5 -1
- package/layout/lib/Grid.tsx +3 -4
- package/layout/lib/utils/background.ts +83 -0
- package/layout/lib/utils/border/color.ts +85 -0
- package/layout/lib/utils/border/index.ts +49 -0
- package/layout/lib/utils/border/lineStyle.ts +87 -0
- package/layout/lib/utils/border/radius.ts +61 -0
- package/layout/lib/utils/border/shorthand.ts +73 -0
- package/layout/lib/utils/border/width.ts +73 -0
- package/layout/lib/utils/buildStyleFns.ts +117 -0
- package/layout/lib/utils/color.ts +40 -55
- package/layout/lib/utils/depth.ts +28 -24
- package/layout/lib/utils/flex.ts +83 -32
- package/layout/lib/utils/flexItem.ts +54 -36
- package/layout/lib/utils/grid.ts +131 -94
- package/layout/lib/utils/gridItem.ts +69 -41
- package/layout/lib/utils/layout.ts +109 -50
- package/layout/lib/utils/other.ts +142 -15
- package/layout/lib/utils/position.ts +79 -73
- package/layout/lib/utils/space.ts +202 -196
- package/layout/lib/utils/stack.ts +19 -45
- package/layout/lib/utils/systemProps.ts +46 -0
- package/layout/lib/utils/text.ts +99 -34
- package/package.json +3 -3
- package/popup/lib/hooks/useReturnFocus.tsx +83 -9
- package/testing/LICENSE +52 -0
- package/testing/README.md +6 -0
- package/testing/index.ts +4 -0
- package/testing/lib/ComponentStatesTable.tsx +80 -0
- package/{common/lib/utils → testing/lib}/StaticStates.tsx +5 -4
- package/testing/lib/permutateProps.ts +47 -0
- package/testing/lib/propTypes.ts +15 -0
- package/testing/package.json +6 -0
- package/tokens/lib/colors.types.ts +4 -7
- package/dist/commonjs/common/lib/utils/StaticStates.d.ts +0 -8
- package/dist/commonjs/common/lib/utils/StaticStates.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/utils/border.d.ts +0 -103
- package/dist/commonjs/layout/lib/utils/border.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/utils/border.js +0 -153
- package/dist/commonjs/layout/lib/utils/font.d.ts +0 -29
- package/dist/commonjs/layout/lib/utils/font.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/utils/font.js +0 -57
- package/dist/es6/common/lib/utils/StaticStates.d.ts +0 -8
- package/dist/es6/common/lib/utils/StaticStates.d.ts.map +0 -1
- package/dist/es6/layout/lib/utils/border.d.ts +0 -103
- package/dist/es6/layout/lib/utils/border.d.ts.map +0 -1
- package/dist/es6/layout/lib/utils/border.js +0 -149
- package/dist/es6/layout/lib/utils/font.d.ts +0 -29
- package/dist/es6/layout/lib/utils/font.d.ts.map +0 -1
- package/dist/es6/layout/lib/utils/font.js +0 -53
- package/layout/lib/utils/border.ts +0 -263
- package/layout/lib/utils/font.ts +0 -67
package/layout/lib/utils/grid.ts
CHANGED
|
@@ -1,129 +1,166 @@
|
|
|
1
1
|
import {Property} from 'csstype';
|
|
2
|
-
import {space as spaceTokens, CanvasSpace, CanvasSpaceKeys} from '@workday/canvas-kit-react/tokens';
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
import {buildStyleFns, buildStylePropFn, StyleFnConfig} from './buildStyleFns';
|
|
4
|
+
import {SystemPropValues} from './systemProps';
|
|
5
5
|
|
|
6
|
-
/** style props to for grid container properties */
|
|
6
|
+
/** style props to for CSS grid container properties */
|
|
7
7
|
export type GridStyleProps = {
|
|
8
|
-
/** sets
|
|
8
|
+
/** sets [CSS align-items property](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items) */
|
|
9
9
|
alignItems?: Property.AlignItems;
|
|
10
|
-
/** sets
|
|
10
|
+
/** sets [CSS align-content property](https://developer.mozilla.org/en-US/docs/Web/CSS/align-content) */
|
|
11
11
|
alignContent?: Property.AlignContent;
|
|
12
12
|
/**
|
|
13
|
-
* sets
|
|
14
|
-
* @default 'grid'
|
|
13
|
+
* - sets [CSS display property](https://developer.mozilla.org/en-US/docs/Web/CSS/display)
|
|
14
|
+
* - @default 'grid'
|
|
15
15
|
* */
|
|
16
16
|
display?: 'grid' | 'inline-grid';
|
|
17
|
-
/** sets
|
|
17
|
+
/** sets [CSS justify-items property](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-items) */
|
|
18
18
|
justifyItems?: Property.JustifyItems;
|
|
19
|
-
/** sets
|
|
19
|
+
/** sets [CSS justify-content property](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content) */
|
|
20
20
|
justifyContent?: Property.JustifyContent;
|
|
21
|
-
|
|
22
|
-
// Container Types
|
|
23
|
-
/** sets `grid-template` property */
|
|
21
|
+
/** sets [CSS grid-template property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template) */
|
|
24
22
|
gridTemplate?: Property.GridTemplate;
|
|
25
|
-
/** sets
|
|
23
|
+
/** sets [CSS grid-template-areas property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-areas) */
|
|
26
24
|
gridTemplateAreas?: Property.GridTemplateAreas;
|
|
27
|
-
/** sets
|
|
25
|
+
/** sets [CSS grid-template-columns property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-columns) */
|
|
28
26
|
gridTemplateColumns?: Property.GridTemplateColumns;
|
|
29
|
-
/** sets
|
|
27
|
+
/** sets [CSS grid-template-rows property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-template-rows) */
|
|
30
28
|
gridTemplateRows?: Property.GridTemplateRows;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
/**
|
|
30
|
+
* - sets [CSS column-gap property](https://developer.mozilla.org/en-US/docs/Web/CSS/column-gap)
|
|
31
|
+
* - system tokens: `space`
|
|
32
|
+
* */
|
|
33
|
+
gridColumnGap?: Property.GridColumnGap | SystemPropValues['space'];
|
|
34
|
+
/**
|
|
35
|
+
* - sets [CSS row-gap property](https://developer.mozilla.org/en-US/docs/Web/CSS/row-gap)
|
|
36
|
+
* - system tokens: `space`
|
|
37
|
+
* */
|
|
38
|
+
gridRowGap?: Property.GridRowGap | SystemPropValues['space'];
|
|
39
|
+
/**
|
|
40
|
+
* - sets [CSS grid-gap property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-gap)
|
|
41
|
+
* - system tokens: `space`
|
|
42
|
+
* */
|
|
43
|
+
gridGap?: Property.GridGap | SystemPropValues['space'];
|
|
44
|
+
/** sets [CSS place-items property](https://developer.mozilla.org/en-US/docs/Web/CSS/place-items) */
|
|
38
45
|
gridPlaceItems?: Property.PlaceItems;
|
|
39
|
-
/** sets
|
|
46
|
+
/** sets [CSS grid-auto-columns property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-columns) */
|
|
40
47
|
gridAutoColumns?: Property.GridAutoColumns;
|
|
41
|
-
/** sets
|
|
48
|
+
/** sets [CSS grid-auto-rows property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-rows) */
|
|
42
49
|
gridAutoRows?: Property.GridAutoRows;
|
|
43
|
-
/** sets
|
|
50
|
+
/** sets [CSS grid-area property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-area) */
|
|
44
51
|
gridArea?: Property.GridArea;
|
|
45
|
-
/** sets
|
|
52
|
+
/** sets [CSS grid-auto-flow property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-auto-flow) */
|
|
46
53
|
gridAutoFlow?: Property.GridAutoFlow;
|
|
47
|
-
/** sets
|
|
54
|
+
/** sets [CSS grid property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid) */
|
|
48
55
|
grid?: Property.Grid;
|
|
49
56
|
};
|
|
50
57
|
|
|
51
|
-
export
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
58
|
+
export const gridStyleFnConfigs: StyleFnConfig[] = [
|
|
59
|
+
{
|
|
60
|
+
name: 'gridGap',
|
|
61
|
+
properties: ['gridGap'],
|
|
62
|
+
system: 'space',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'gridRowGap',
|
|
66
|
+
properties: ['gridRowGap'],
|
|
67
|
+
system: 'space',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'gridColumnGap',
|
|
71
|
+
properties: ['gridColumnGap'],
|
|
72
|
+
system: 'space',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'alignContent',
|
|
76
|
+
properties: ['alignContent'],
|
|
77
|
+
system: 'none',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'alignItems',
|
|
81
|
+
properties: ['alignItems'],
|
|
82
|
+
system: 'none',
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: 'display',
|
|
86
|
+
properties: ['display'],
|
|
87
|
+
system: 'none',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'justifyContent',
|
|
91
|
+
properties: ['justifyContent'],
|
|
92
|
+
system: 'none',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
name: 'justifyItems',
|
|
96
|
+
properties: ['justifyItems'],
|
|
97
|
+
system: 'none',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
name: 'gridTemplateAreas',
|
|
101
|
+
properties: ['gridTemplateAreas'],
|
|
102
|
+
system: 'none',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'gridTemplate',
|
|
106
|
+
properties: ['gridTemplate'],
|
|
107
|
+
system: 'none',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
name: 'gridTemplateColumns',
|
|
111
|
+
properties: ['gridTemplateColumns'],
|
|
112
|
+
system: 'none',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: 'gridTemplateRows',
|
|
116
|
+
properties: ['gridTemplateRows'],
|
|
117
|
+
system: 'none',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: 'gridPlaceItems',
|
|
121
|
+
properties: ['gridPlaceItems'],
|
|
122
|
+
system: 'none',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: 'gridAutoColumns',
|
|
126
|
+
properties: ['gridAutoColumns'],
|
|
127
|
+
system: 'none',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: 'gridAutoRows',
|
|
131
|
+
properties: ['gridAutoRows'],
|
|
132
|
+
system: 'none',
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: 'gridAutoFlow',
|
|
136
|
+
properties: ['gridAutoFlow'],
|
|
137
|
+
system: 'none',
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: 'gridArea',
|
|
141
|
+
properties: ['gridArea'],
|
|
142
|
+
system: 'none',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: 'grid',
|
|
146
|
+
properties: ['grid'],
|
|
147
|
+
system: 'none',
|
|
148
|
+
},
|
|
149
|
+
];
|
|
94
150
|
|
|
151
|
+
export const gridStyleFns = buildStyleFns(gridStyleFnConfigs);
|
|
95
152
|
/**
|
|
96
153
|
* A style prop function that takes component props and returns grid styles.
|
|
97
154
|
* If no `GridStyleProps` are found, it returns an empty object.
|
|
98
|
-
* Space tokens are available for
|
|
99
|
-
* Values: `zero: 0px`, `xxxs: 4px`, `xxs: 8px`, `xs: 12px`, `s: 16px`, `m: 24px`, `l: 32px`, `xl: 40px`, `xxl: 64px`, `xxxl: 80px`.
|
|
155
|
+
* Space tokens are available for gridGap, gridRowGap, gridColumnGap props.
|
|
100
156
|
*
|
|
101
157
|
* @example
|
|
102
|
-
*
|
|
158
|
+
* ```tsx
|
|
103
159
|
* const GridExample = () => (
|
|
104
160
|
* <Grid gridAutoFlow="row" justifyContent="center" alignItems="center">
|
|
105
161
|
* Hello, Grid!
|
|
106
162
|
* </Grid>
|
|
107
163
|
* );
|
|
108
|
-
*
|
|
164
|
+
* ```
|
|
109
165
|
*/
|
|
110
|
-
export
|
|
111
|
-
let styles = {};
|
|
112
|
-
for (const key in props) {
|
|
113
|
-
if (props.hasOwnProperty(key)) {
|
|
114
|
-
if (key in gridProps) {
|
|
115
|
-
const attr = gridProps[key as keyof GridStyleProps];
|
|
116
|
-
const value = props[key];
|
|
117
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
118
|
-
styles[attr] = value;
|
|
119
|
-
}
|
|
120
|
-
if (key in gridSpaceStyleProps) {
|
|
121
|
-
const value = props[key as keyof gridSpaceProps] as GridSpacePropsValues;
|
|
122
|
-
const spaceFn = gridSpaceStyleProps[key as keyof gridSpaceProps];
|
|
123
|
-
const style = spaceFn(value);
|
|
124
|
-
styles = {...styles, ...style};
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return styles;
|
|
129
|
-
}
|
|
166
|
+
export const grid = buildStylePropFn<GridStyleProps>(gridStyleFns);
|
|
@@ -1,68 +1,96 @@
|
|
|
1
1
|
import {Property} from 'csstype';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import {buildStyleFns, buildStylePropFn, StyleFnConfig} from './buildStyleFns';
|
|
4
|
+
|
|
5
|
+
/** style props to for CSS grid item properties */
|
|
4
6
|
export type GridItemStyleProps = {
|
|
5
|
-
|
|
6
|
-
/** sets `grid-column-start` property */
|
|
7
|
+
/** sets [CSS grid-column-start property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column-start) */
|
|
7
8
|
gridColumnStart?: Property.GridColumnStart;
|
|
8
|
-
/** sets
|
|
9
|
+
/** sets [CSS grid-column-end property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column-end) */
|
|
9
10
|
gridColumnEnd?: Property.GridColumnEnd;
|
|
10
|
-
/** sets
|
|
11
|
+
/** sets [CSS grid-row-start property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row-start) */
|
|
11
12
|
gridRowStart?: Property.GridRowStart;
|
|
12
|
-
/** sets
|
|
13
|
+
/** sets [CSS grid-row-end property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row-end) */
|
|
13
14
|
gridRowEnd?: Property.GridRowEnd;
|
|
14
|
-
/** sets
|
|
15
|
+
/** sets [CSS grid-column property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-column) */
|
|
15
16
|
gridColumn?: Property.GridColumn;
|
|
16
|
-
/** sets
|
|
17
|
+
/** sets [CSS grid-row property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-row) */
|
|
17
18
|
gridRow?: Property.GridRow;
|
|
18
|
-
/** sets
|
|
19
|
+
/** sets [CSS grid-area property](https://developer.mozilla.org/en-US/docs/Web/CSS/grid-area) */
|
|
19
20
|
gridArea?: Property.GridArea;
|
|
20
|
-
/** sets
|
|
21
|
+
/** sets [CSS justify-self property](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-self) */
|
|
21
22
|
justifySelf?: Property.JustifySelf;
|
|
22
|
-
/** sets
|
|
23
|
+
/** sets [CSS align-self property](https://developer.mozilla.org/en-US/docs/Web/CSS/align-self) */
|
|
23
24
|
alignSelf?: Property.AlignSelf;
|
|
24
|
-
/** sets
|
|
25
|
+
/** sets [CSS place-self property](https://developer.mozilla.org/en-US/docs/Web/CSS/place-self) */
|
|
25
26
|
placeSelf?: Property.PlaceSelf;
|
|
26
27
|
};
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
export const gridItemStyleFnConfigs: StyleFnConfig[] = [
|
|
30
|
+
{
|
|
31
|
+
name: 'gridColumnStart',
|
|
32
|
+
properties: ['gridColumnStart'],
|
|
33
|
+
system: 'none',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'gridColumnEnd',
|
|
37
|
+
properties: ['gridColumnEnd'],
|
|
38
|
+
system: 'none',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'gridRowStart',
|
|
42
|
+
properties: ['gridRowStart'],
|
|
43
|
+
system: 'none',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'gridRowEnd',
|
|
47
|
+
properties: ['gridRowEnd'],
|
|
48
|
+
system: 'none',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'gridColumn',
|
|
52
|
+
properties: ['gridColumn'],
|
|
53
|
+
system: 'none',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'gridRow',
|
|
57
|
+
properties: ['gridRow'],
|
|
58
|
+
system: 'none',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'gridArea',
|
|
62
|
+
properties: ['gridArea'],
|
|
63
|
+
system: 'none',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'justifySelf',
|
|
67
|
+
properties: ['justifySelf'],
|
|
68
|
+
system: 'none',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'alignSelf',
|
|
72
|
+
properties: ['alignSelf'],
|
|
73
|
+
system: 'none',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'placeSelf',
|
|
77
|
+
properties: ['placeSelf'],
|
|
78
|
+
system: 'none',
|
|
79
|
+
},
|
|
80
|
+
];
|
|
42
81
|
|
|
82
|
+
export const gridItemStyleFns = buildStyleFns(gridItemStyleFnConfigs);
|
|
43
83
|
/**
|
|
44
84
|
* A style prop function that takes component props and returns grid styles.
|
|
45
85
|
* If no `GridItemStyleProps` are found, it returns an empty object.
|
|
46
86
|
*
|
|
47
87
|
* @example
|
|
48
|
-
*
|
|
88
|
+
* ```tsx
|
|
49
89
|
* const GridItemExample = () => (
|
|
50
90
|
* <Grid.Item gridRowStart="1" justifySelf="center" gridArea="Card">
|
|
51
91
|
* Hello, Grid Item!
|
|
52
92
|
* </Grid.Item>
|
|
53
93
|
* );
|
|
54
|
-
*
|
|
94
|
+
* ```
|
|
55
95
|
*/
|
|
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
|
-
}
|
|
96
|
+
export const gridItem = buildStylePropFn<GridItemStyleProps>(gridItemStyleFns);
|
|
@@ -1,70 +1,129 @@
|
|
|
1
1
|
import {Property} from 'csstype';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import {buildStyleFns, buildStylePropFn, StyleFnConfig} from './buildStyleFns';
|
|
4
|
+
import {SystemPropValues} from './systemProps';
|
|
5
|
+
|
|
6
|
+
/** style props to for CSS layout properties */
|
|
4
7
|
export type LayoutStyleProps = {
|
|
5
|
-
/** sets
|
|
8
|
+
/** sets [CSS display property](https://developer.mozilla.org/en-US/docs/Web/CSS/displaydisplay) */
|
|
6
9
|
display?: Property.Display;
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
/**
|
|
11
|
+
* - sets [CSS height property](https://developer.mozilla.org/en-US/docs/Web/CSS/height)
|
|
12
|
+
* - system tokens: `space`
|
|
13
|
+
* */
|
|
14
|
+
height?: SystemPropValues['space'];
|
|
15
|
+
/** sets [CSS list-style property](https://developer.mozilla.org/en-US/docs/Web/CSS/list-style) */
|
|
10
16
|
listStyle?: Property.ListStyle;
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
/**
|
|
18
|
+
* - sets [CSS max-height property](https://developer.mozilla.org/en-US/docs/Web/CSS/max-height)
|
|
19
|
+
* - system tokens: `space`
|
|
20
|
+
* */
|
|
21
|
+
maxHeight?: SystemPropValues['space'];
|
|
22
|
+
/**
|
|
23
|
+
* - sets [CSS max-width property](https://developer.mozilla.org/en-US/docs/Web/CSS/max-width)
|
|
24
|
+
* - system tokens: `space`
|
|
25
|
+
* */
|
|
26
|
+
maxWidth?: SystemPropValues['space'];
|
|
27
|
+
/**
|
|
28
|
+
* - sets [CSS min-height property](https://developer.mozilla.org/en-US/docs/Web/CSS/min-height)
|
|
29
|
+
* - system tokens: `space`
|
|
30
|
+
* */
|
|
31
|
+
minHeight?: SystemPropValues['space'];
|
|
32
|
+
/**
|
|
33
|
+
* - sets [CSS min-width property](https://developer.mozilla.org/en-US/docs/Web/CSS/min-width)
|
|
34
|
+
* - system tokens: `space`
|
|
35
|
+
* */
|
|
36
|
+
minWidth?: SystemPropValues['space'];
|
|
37
|
+
/** sets [CSS overflow property](https://developer.mozilla.org/en-US/docs/Web/CSS/overflow) */
|
|
20
38
|
overflow?: Property.Overflow;
|
|
21
|
-
/** sets
|
|
39
|
+
/** sets [CSS overflow-x property](https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x) */
|
|
22
40
|
overflowX?: Property.OverflowX;
|
|
23
|
-
/** sets
|
|
41
|
+
/** sets [CSS overflow-y property](https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-y) */
|
|
24
42
|
overflowY?: Property.OverflowY;
|
|
25
|
-
/** sets
|
|
43
|
+
/** sets [CSS vertical-align property](https://developer.mozilla.org/en-US/docs/Web/CSS/vertical-align) */
|
|
26
44
|
verticalAlign?: Property.VerticalAlign;
|
|
27
|
-
/**
|
|
28
|
-
|
|
45
|
+
/**
|
|
46
|
+
* - sets [CSS width property](https://developer.mozilla.org/en-US/docs/Web/CSS/width)
|
|
47
|
+
* - system tokens: `space`
|
|
48
|
+
* */
|
|
49
|
+
width?: SystemPropValues['space'];
|
|
29
50
|
};
|
|
30
51
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
52
|
+
export const layoutStyleFnConfigs: StyleFnConfig[] = [
|
|
53
|
+
{
|
|
54
|
+
name: 'display',
|
|
55
|
+
properties: ['display'],
|
|
56
|
+
system: 'none',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'height',
|
|
60
|
+
properties: ['height'],
|
|
61
|
+
system: 'space',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'listStyle',
|
|
65
|
+
properties: ['listStyle'],
|
|
66
|
+
system: 'none',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'maxHeight',
|
|
70
|
+
properties: ['maxHeight'],
|
|
71
|
+
system: 'space',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'maxWidth',
|
|
75
|
+
properties: ['maxWidth'],
|
|
76
|
+
system: 'space',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'minHeight',
|
|
80
|
+
properties: ['minHeight'],
|
|
81
|
+
system: 'space',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'minWidth',
|
|
85
|
+
properties: ['minWidth'],
|
|
86
|
+
system: 'space',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'overflow',
|
|
90
|
+
properties: ['overflow'],
|
|
91
|
+
system: 'none',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'overflowX',
|
|
95
|
+
properties: ['overflowX'],
|
|
96
|
+
system: 'none',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'overflowY',
|
|
100
|
+
properties: ['overflowY'],
|
|
101
|
+
system: 'none',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'verticalAlign',
|
|
105
|
+
properties: ['verticalAlign'],
|
|
106
|
+
system: 'none',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'width',
|
|
110
|
+
properties: ['width'],
|
|
111
|
+
system: 'space',
|
|
112
|
+
},
|
|
113
|
+
];
|
|
45
114
|
|
|
115
|
+
export const layoutStyleFns = buildStyleFns(layoutStyleFnConfigs);
|
|
46
116
|
/**
|
|
47
|
-
* A style prop function that takes
|
|
117
|
+
* A style prop function that takes component props and returns layout styles.
|
|
48
118
|
* If no `LayoutStyleProps` are found, it returns an empty object.
|
|
49
119
|
*
|
|
50
120
|
* @example
|
|
51
|
-
*
|
|
52
|
-
* const
|
|
121
|
+
* ```tsx
|
|
122
|
+
* const LayoutExample = () => (
|
|
53
123
|
* <Box display="inline-block" height="50%">
|
|
54
|
-
* Hello,
|
|
124
|
+
* Hello, layout!
|
|
55
125
|
* </Box>
|
|
56
126
|
* );
|
|
57
|
-
*
|
|
127
|
+
* ```
|
|
58
128
|
*/
|
|
59
|
-
export
|
|
60
|
-
const styles = {};
|
|
61
|
-
for (const key in props) {
|
|
62
|
-
if (key in layoutProps) {
|
|
63
|
-
const attr = layoutProps[key as keyof LayoutStyleProps];
|
|
64
|
-
const value = props[key];
|
|
65
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
66
|
-
styles[attr] = value;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return styles;
|
|
70
|
-
}
|
|
129
|
+
export const layout = buildStylePropFn<LayoutStyleProps>(layoutStyleFns);
|