@workday/canvas-kit-react 8.0.0-alpha.208-next.1 → 8.0.0-alpha.216-next.4
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/utils/elements.ts +4 -4
- 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/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/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/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 -1
- package/dist/commonjs/tabs/lib/TabsItem.d.ts +1 -1
- 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/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/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/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 -2
- package/dist/es6/tabs/lib/TabsItem.d.ts +1 -1
- 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/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 +82 -3
- package/tokens/lib/colors.types.ts +4 -7
- 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/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
|
@@ -1,207 +1,213 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
|
|
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
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
1
|
+
import {buildStyleFns, buildStylePropFn, StyleFnConfig} from './buildStyleFns';
|
|
2
|
+
import {SystemPropValues} from './systemProps';
|
|
3
|
+
|
|
4
|
+
/** style props to for CSS space properties */
|
|
5
|
+
export type SpaceStyleProps = {
|
|
6
|
+
/**
|
|
7
|
+
* - sets [CSS margin-inline-start property](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-inline-start)
|
|
8
|
+
* - bidirectional support
|
|
9
|
+
* - system tokens: `space`
|
|
10
|
+
* */
|
|
11
|
+
marginInlineStart?: SystemPropValues['space'];
|
|
12
|
+
/**
|
|
13
|
+
* - sets [CSS margin-inline-end property](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-inline-end)
|
|
14
|
+
* - bidirectional support
|
|
15
|
+
* - system tokens: `space`
|
|
16
|
+
* */
|
|
17
|
+
marginInlineEnd?: SystemPropValues['space'];
|
|
18
|
+
/**
|
|
19
|
+
* - sets [CSS padding-inline-start property](https://developer.mozilla.org/en-US/docs/Web/CSS/padding-inline-start)
|
|
20
|
+
* - bidirectional support
|
|
21
|
+
* - system tokens: `space`
|
|
22
|
+
* */
|
|
23
|
+
paddingInlineStart?: SystemPropValues['space'];
|
|
24
|
+
/**
|
|
25
|
+
* - sets [CSS padding-inline-end property](https://developer.mozilla.org/en-US/docs/Web/CSS/padding-inline-end)
|
|
26
|
+
* - bidirectional support
|
|
27
|
+
* - system tokens: `space`
|
|
28
|
+
* */
|
|
29
|
+
paddingInlineEnd?: SystemPropValues['space'];
|
|
30
|
+
/**
|
|
31
|
+
* - sets [CSS margin property](https://developer.mozilla.org/en-US/docs/Web/CSS/margin)
|
|
32
|
+
* - system tokens: `space`
|
|
33
|
+
* */
|
|
34
|
+
margin?: SystemPropValues['space'];
|
|
35
|
+
/**
|
|
36
|
+
* - sets [CSS margin-left](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-left) and [margin-right properties](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-right)
|
|
37
|
+
* - system tokens: `space`
|
|
38
|
+
* */
|
|
39
|
+
marginX?: SystemPropValues['space'];
|
|
40
|
+
/**
|
|
41
|
+
* - sets [CSS margin-top](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-top) and [margin-bottom properties](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-bottom)
|
|
42
|
+
* - system tokens: `space`
|
|
43
|
+
* */
|
|
44
|
+
marginY?: SystemPropValues['space'];
|
|
45
|
+
/**
|
|
46
|
+
* - sets [CSS margin-top property](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-top)
|
|
47
|
+
* - system tokens: `space`
|
|
48
|
+
* */
|
|
49
|
+
marginTop?: SystemPropValues['space'];
|
|
50
|
+
/**
|
|
51
|
+
* - sets [CSS margin-right property](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-right)
|
|
52
|
+
* - no bidirectional support
|
|
53
|
+
* - system tokens: `space`
|
|
54
|
+
* */
|
|
55
|
+
marginRight?: SystemPropValues['space'];
|
|
56
|
+
/**
|
|
57
|
+
* - sets [CSS margin-bottom property](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-bottom)
|
|
58
|
+
* - system tokens: `space`
|
|
59
|
+
* */
|
|
60
|
+
marginBottom?: SystemPropValues['space'];
|
|
61
|
+
/**
|
|
62
|
+
* - sets [CSS margin-left property](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-left)
|
|
63
|
+
* - no bidirectional support
|
|
64
|
+
* - system tokens: `space`
|
|
65
|
+
* */
|
|
66
|
+
marginLeft?: SystemPropValues['space'];
|
|
67
|
+
/**
|
|
68
|
+
* - sets [CSS padding property](https://developer.mozilla.org/en-US/docs/Web/CSS/padding)
|
|
69
|
+
* - system tokens: `space`
|
|
70
|
+
* */
|
|
71
|
+
padding?: SystemPropValues['space'];
|
|
72
|
+
/**
|
|
73
|
+
* - sets [CSS padding-left]((https://developer.mozilla.org/en-US/docs/Web/CSS/padding-left) and [padding-right properties](https://developer.mozilla.org/en-US/docs/Web/CSS/padding-right)
|
|
74
|
+
* - system tokens: `space`
|
|
75
|
+
* */
|
|
76
|
+
paddingX?: SystemPropValues['space'];
|
|
77
|
+
/**
|
|
78
|
+
* - sets [CSS padding-top](https://developer.mozilla.org/en-US/docs/Web/CSS/padding-top) and [padding-bottom properties](https://developer.mozilla.org/en-US/docs/Web/CSS/padding-bottom)
|
|
79
|
+
* - system tokens: `space`
|
|
80
|
+
* */
|
|
81
|
+
paddingY?: SystemPropValues['space'];
|
|
82
|
+
/**
|
|
83
|
+
* - sets [CSS padding-top property](https://developer.mozilla.org/en-US/docs/Web/CSS/padding-top)
|
|
84
|
+
* - system tokens: `space`
|
|
85
|
+
* */
|
|
86
|
+
paddingTop?: SystemPropValues['space'];
|
|
87
|
+
/**
|
|
88
|
+
* - sets [CSS padding-right property](https://developer.mozilla.org/en-US/docs/Web/CSS/padding-right)
|
|
89
|
+
* - no bidirectional support
|
|
90
|
+
* - system tokens: `space`
|
|
91
|
+
* */
|
|
92
|
+
paddingRight?: SystemPropValues['space'];
|
|
93
|
+
/**
|
|
94
|
+
* - sets [CSS padding-bottom](https://developer.mozilla.org/en-US/docs/Web/CSS/padding)
|
|
95
|
+
* - system tokens: `space`
|
|
96
|
+
* */
|
|
97
|
+
paddingBottom?: SystemPropValues['space'];
|
|
98
|
+
/**
|
|
99
|
+
* - sets [CSS padding-left property](https://developer.mozilla.org/en-US/docs/Web/CSS/padding-left)
|
|
100
|
+
* - no bidirectional support
|
|
101
|
+
* - system tokens: `space`
|
|
102
|
+
* */
|
|
103
|
+
paddingLeft?: SystemPropValues['space'];
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const spaceStyleFnConfigs: StyleFnConfig[] = [
|
|
107
|
+
{
|
|
108
|
+
name: 'marginInlineStart',
|
|
109
|
+
properties: ['marginInlineStart'],
|
|
110
|
+
system: 'space',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'marginInlineEnd',
|
|
114
|
+
properties: ['marginInlineEnd'],
|
|
115
|
+
system: 'space',
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: 'paddingInlineStart',
|
|
119
|
+
properties: ['paddingInlineStart'],
|
|
120
|
+
system: 'space',
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
name: 'paddingInlineEnd',
|
|
124
|
+
properties: ['paddingInlineEnd'],
|
|
125
|
+
system: 'space',
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: 'margin',
|
|
129
|
+
properties: ['margin'],
|
|
130
|
+
system: 'space',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'marginX',
|
|
134
|
+
properties: ['marginLeft', 'marginRight'],
|
|
135
|
+
system: 'space',
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'marginY',
|
|
139
|
+
properties: ['marginTop', 'marginBottom'],
|
|
140
|
+
system: 'space',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: 'marginTop',
|
|
144
|
+
properties: ['marginTop'],
|
|
145
|
+
system: 'space',
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'marginRight',
|
|
149
|
+
properties: ['marginRight'],
|
|
150
|
+
system: 'space',
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: 'marginBottom',
|
|
154
|
+
properties: ['marginBottom'],
|
|
155
|
+
system: 'space',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: 'marginLeft',
|
|
159
|
+
properties: ['marginLeft'],
|
|
160
|
+
system: 'space',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'padding',
|
|
164
|
+
properties: ['padding'],
|
|
165
|
+
system: 'space',
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: 'paddingX',
|
|
169
|
+
properties: ['paddingLeft', 'paddingRight'],
|
|
170
|
+
system: 'space',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: 'paddingY',
|
|
174
|
+
properties: ['paddingTop', 'paddingBottom'],
|
|
175
|
+
system: 'space',
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: 'paddingTop',
|
|
179
|
+
properties: ['paddingTop'],
|
|
180
|
+
system: 'space',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: 'paddingRight',
|
|
184
|
+
properties: ['paddingRight'],
|
|
185
|
+
system: 'space',
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: 'paddingBottom',
|
|
189
|
+
properties: ['paddingBottom'],
|
|
190
|
+
system: 'space',
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: 'paddingLeft',
|
|
194
|
+
properties: ['paddingLeft'],
|
|
195
|
+
system: 'space',
|
|
196
|
+
},
|
|
197
|
+
];
|
|
198
|
+
|
|
199
|
+
export const spaceStyleFns = buildStyleFns(spaceStyleFnConfigs);
|
|
170
200
|
/**
|
|
171
201
|
* A style prop function that takes component props and returns space styles.
|
|
172
202
|
* If no `SpaceStyleProps` are found, it returns an empty object.
|
|
173
203
|
*
|
|
174
204
|
* @example
|
|
175
|
-
*
|
|
205
|
+
* ```tsx
|
|
176
206
|
* const BoxExample = () => (
|
|
177
207
|
* <Box padding="xs" margin="m">
|
|
178
208
|
* Hello, space!
|
|
179
209
|
* </Box>
|
|
180
210
|
* );
|
|
181
|
-
*
|
|
211
|
+
* ```
|
|
182
212
|
*/
|
|
183
|
-
export
|
|
184
|
-
// space will always be used within the context of a component, but eslint doesn't know that
|
|
185
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
186
|
-
const {canvas} = useTheme(props.theme);
|
|
187
|
-
let styles = {};
|
|
188
|
-
for (const key in props) {
|
|
189
|
-
if (props.hasOwnProperty(key)) {
|
|
190
|
-
if (key in standardSpaceStyleProps) {
|
|
191
|
-
const value = props[key as keyof SpaceStandardProps] as SpacePropValues;
|
|
192
|
-
const spaceFn = standardSpaceStyleProps[key as keyof SpaceStandardProps];
|
|
193
|
-
const style = spaceFn(value);
|
|
194
|
-
styles = {...styles, ...style};
|
|
195
|
-
continue;
|
|
196
|
-
}
|
|
197
|
-
if (key in logicalSpaceStyleProps) {
|
|
198
|
-
const value = props[key as keyof SpaceLogicalProps] as SpacePropValues;
|
|
199
|
-
const spaceFn = logicalSpaceStyleProps[key as keyof SpaceLogicalProps];
|
|
200
|
-
const isRTL = canvas.direction === ContentDirection.RTL;
|
|
201
|
-
const style = spaceFn(value, isRTL);
|
|
202
|
-
styles = {...styles, ...style};
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return styles;
|
|
207
|
-
}
|
|
213
|
+
export const space = buildStylePropFn<SpaceStyleProps>(spaceStyleFns);
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
PartialEmotionCanvasTheme,
|
|
4
|
-
useTheme,
|
|
5
|
-
} from '@workday/canvas-kit-react/common';
|
|
6
|
-
import {space as spaceTokens, CanvasSpaceKeys} from '@workday/canvas-kit-react/tokens';
|
|
1
|
+
import {space as spaceTokens} from '@workday/canvas-kit-react/tokens';
|
|
2
|
+
import {CanvasSystemPropValues, SystemPropValues} from './systemProps';
|
|
7
3
|
|
|
8
4
|
export type StackDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
|
9
5
|
|
|
10
6
|
const selector = '& > *:not(style) ~ *:not(style)';
|
|
11
7
|
|
|
12
|
-
export type StackSpacing =
|
|
8
|
+
export type StackSpacing = SystemPropValues['space'];
|
|
13
9
|
|
|
14
10
|
export type StackStyleProps = {
|
|
15
11
|
/** sets space values between child elements (bidirectional support) */
|
|
@@ -26,50 +22,28 @@ export type StackStyleProps = {
|
|
|
26
22
|
shouldWrapChildren?: boolean;
|
|
27
23
|
};
|
|
28
24
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const columnReverse = (value: StackSpacing) => ({
|
|
34
|
-
marginBottom: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const row = (value: StackSpacing, isRTL = false) => {
|
|
38
|
-
const attr = isRTL ? 'marginRight' : 'marginLeft';
|
|
39
|
-
return {
|
|
40
|
-
[attr]: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
41
|
-
};
|
|
25
|
+
const getSpace = (value: SystemPropValues['space']) => {
|
|
26
|
+
return spaceTokens[value as CanvasSystemPropValues['space']] || value;
|
|
42
27
|
};
|
|
43
28
|
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
[attr]: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
48
|
-
};
|
|
49
|
-
};
|
|
29
|
+
export function stack<P extends StackStyleProps>(props: P) {
|
|
30
|
+
const {flexDirection = 'row', spacing} = props;
|
|
31
|
+
let styles = {};
|
|
50
32
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
row,
|
|
55
|
-
'row-reverse': rowReverse,
|
|
56
|
-
};
|
|
33
|
+
if (flexDirection === 'column') {
|
|
34
|
+
styles = {marginTop: getSpace(spacing)};
|
|
35
|
+
}
|
|
57
36
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
styles =
|
|
37
|
+
if (flexDirection === 'column-reverse') {
|
|
38
|
+
styles = {marginBottom: getSpace(spacing)};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (flexDirection === 'row') {
|
|
42
|
+
styles = {marginInlineStart: getSpace(spacing)};
|
|
64
43
|
}
|
|
65
44
|
|
|
66
|
-
if (flexDirection === 'row
|
|
67
|
-
|
|
68
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
69
|
-
const {canvas} = useTheme(props.theme);
|
|
70
|
-
const stackFn = stackDirectionProps[flexDirection];
|
|
71
|
-
const isRTL = canvas.direction === ContentDirection.RTL;
|
|
72
|
-
styles = stackFn(spacing, isRTL);
|
|
45
|
+
if (flexDirection === 'row-reverse') {
|
|
46
|
+
styles = {marginInlineEnd: getSpace(spacing)};
|
|
73
47
|
}
|
|
74
48
|
|
|
75
49
|
return {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CanvasBorderRadiusKeys,
|
|
3
|
+
CanvasColor,
|
|
4
|
+
CanvasDepth,
|
|
5
|
+
CanvasSpaceKeys,
|
|
6
|
+
CanvasTypeProperties,
|
|
7
|
+
} from '@workday/canvas-kit-react/tokens';
|
|
8
|
+
|
|
9
|
+
export type SystemPropNames =
|
|
10
|
+
| 'color'
|
|
11
|
+
| 'depth'
|
|
12
|
+
| 'font'
|
|
13
|
+
| 'fontSize'
|
|
14
|
+
| 'fontWeight'
|
|
15
|
+
| 'shape'
|
|
16
|
+
| 'space';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Canvas System Prop Values
|
|
20
|
+
* ---
|
|
21
|
+
* These system prop values are restricted to Canvas token values.
|
|
22
|
+
*/
|
|
23
|
+
export type CanvasSystemPropValues = {
|
|
24
|
+
color: CanvasColor;
|
|
25
|
+
depth: keyof CanvasDepth;
|
|
26
|
+
font: keyof CanvasTypeProperties['fontFamilies'];
|
|
27
|
+
fontSize: keyof CanvasTypeProperties['fontSizes'];
|
|
28
|
+
fontWeight: keyof CanvasTypeProperties['fontWeights'];
|
|
29
|
+
shape: CanvasBorderRadiusKeys;
|
|
30
|
+
space: CanvasSpaceKeys;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* System Prop Values
|
|
35
|
+
* ---
|
|
36
|
+
* These system prop values include Canvas System Prop Values and generic values.
|
|
37
|
+
*/
|
|
38
|
+
export type SystemPropValues = {
|
|
39
|
+
color: CanvasSystemPropValues['color'] | (string & {});
|
|
40
|
+
depth: CanvasSystemPropValues['depth'];
|
|
41
|
+
font: CanvasSystemPropValues['font'] | (string & {});
|
|
42
|
+
fontSize: CanvasSystemPropValues['fontSize'] | (string & {});
|
|
43
|
+
fontWeight: CanvasSystemPropValues['fontWeight'] | (string & {});
|
|
44
|
+
shape: CanvasSystemPropValues['shape'] | number | (string & {});
|
|
45
|
+
space: CanvasSystemPropValues['space'] | number | (string & {});
|
|
46
|
+
};
|