@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,74 +1,58 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
1
|
+
import { buildStyleFns, buildStylePropFn } from './buildStyleFns';
|
|
2
|
+
export var positionStyleFnConfigs = [
|
|
3
|
+
{
|
|
4
|
+
name: 'position',
|
|
5
|
+
properties: ['position'],
|
|
6
|
+
system: 'none',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
name: 'zIndex',
|
|
10
|
+
properties: ['zIndex'],
|
|
11
|
+
system: 'none',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'top',
|
|
15
|
+
properties: ['top'],
|
|
16
|
+
system: 'none',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'right',
|
|
20
|
+
properties: ['right'],
|
|
21
|
+
system: 'none',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'bottom',
|
|
25
|
+
properties: ['bottom'],
|
|
26
|
+
system: 'none',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'left',
|
|
30
|
+
properties: ['left'],
|
|
31
|
+
system: 'none',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'insetInlineStart',
|
|
35
|
+
properties: ['insetInlineStart'],
|
|
36
|
+
system: 'none',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'insetInlineEnd',
|
|
40
|
+
properties: ['insetInlineEnd'],
|
|
41
|
+
system: 'none',
|
|
42
|
+
},
|
|
43
|
+
];
|
|
44
|
+
export var positionStyleFns = buildStyleFns(positionStyleFnConfigs);
|
|
37
45
|
/**
|
|
38
|
-
* A style prop function that takes
|
|
46
|
+
* A style prop function that takes component props and returns position styles.
|
|
39
47
|
* If no `PositionProps` are found, it returns an empty object.
|
|
40
48
|
*
|
|
41
49
|
* @example
|
|
42
|
-
*
|
|
50
|
+
* ```
|
|
43
51
|
* const BoxExample = () => (
|
|
44
52
|
* <Box position="absolute" top="50%">
|
|
45
53
|
* Hello, positions!
|
|
46
54
|
* </Box>
|
|
47
55
|
* );
|
|
48
|
-
*
|
|
56
|
+
* ```
|
|
49
57
|
*/
|
|
50
|
-
export
|
|
51
|
-
// position will always be used within the context of a component, but eslint doesn't know that
|
|
52
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
53
|
-
var canvas = useTheme(props.theme).canvas;
|
|
54
|
-
var styles = {};
|
|
55
|
-
for (var key in props) {
|
|
56
|
-
if (key in props) {
|
|
57
|
-
if (key in standardPositionProps) {
|
|
58
|
-
var value = props[key];
|
|
59
|
-
var attr = standardPositionProps[key];
|
|
60
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
61
|
-
styles[attr] = value;
|
|
62
|
-
continue;
|
|
63
|
-
}
|
|
64
|
-
if (key in logicalPositionProps) {
|
|
65
|
-
var value = props[key];
|
|
66
|
-
var styleFn = logicalPositionProps[key];
|
|
67
|
-
var isRTL = canvas.direction === ContentDirection.RTL;
|
|
68
|
-
var style = styleFn(value, isRTL);
|
|
69
|
-
styles = __assign(__assign({}, styles), style);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return styles;
|
|
74
|
-
}
|
|
58
|
+
export var position = buildStylePropFn(positionStyleFns);
|
|
@@ -1,64 +1,120 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import { StyleFnConfig } from './buildStyleFns';
|
|
2
|
+
import { SystemPropValues } from './systemProps';
|
|
3
|
+
/** style props to for CSS space properties */
|
|
4
|
+
export declare type SpaceStyleProps = {
|
|
5
|
+
/**
|
|
6
|
+
* - sets [CSS margin-inline-start property](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-inline-start)
|
|
7
|
+
* - bidirectional support
|
|
8
|
+
* - system tokens: `space`
|
|
9
|
+
* */
|
|
10
|
+
marginInlineStart?: SystemPropValues['space'];
|
|
11
|
+
/**
|
|
12
|
+
* - sets [CSS margin-inline-end property](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-inline-end)
|
|
13
|
+
* - bidirectional support
|
|
14
|
+
* - system tokens: `space`
|
|
15
|
+
* */
|
|
16
|
+
marginInlineEnd?: SystemPropValues['space'];
|
|
17
|
+
/**
|
|
18
|
+
* - sets [CSS padding-inline-start property](https://developer.mozilla.org/en-US/docs/Web/CSS/padding-inline-start)
|
|
19
|
+
* - bidirectional support
|
|
20
|
+
* - system tokens: `space`
|
|
21
|
+
* */
|
|
22
|
+
paddingInlineStart?: SystemPropValues['space'];
|
|
23
|
+
/**
|
|
24
|
+
* - sets [CSS padding-inline-end property](https://developer.mozilla.org/en-US/docs/Web/CSS/padding-inline-end)
|
|
25
|
+
* - bidirectional support
|
|
26
|
+
* - system tokens: `space`
|
|
27
|
+
* */
|
|
28
|
+
paddingInlineEnd?: SystemPropValues['space'];
|
|
29
|
+
/**
|
|
30
|
+
* - sets [CSS margin property](https://developer.mozilla.org/en-US/docs/Web/CSS/margin)
|
|
31
|
+
* - system tokens: `space`
|
|
32
|
+
* */
|
|
33
|
+
margin?: SystemPropValues['space'];
|
|
34
|
+
/**
|
|
35
|
+
* - 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)
|
|
36
|
+
* - system tokens: `space`
|
|
37
|
+
* */
|
|
38
|
+
marginX?: SystemPropValues['space'];
|
|
39
|
+
/**
|
|
40
|
+
* - 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)
|
|
41
|
+
* - system tokens: `space`
|
|
42
|
+
* */
|
|
43
|
+
marginY?: SystemPropValues['space'];
|
|
44
|
+
/**
|
|
45
|
+
* - sets [CSS margin-top property](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-top)
|
|
46
|
+
* - system tokens: `space`
|
|
47
|
+
* */
|
|
48
|
+
marginTop?: SystemPropValues['space'];
|
|
49
|
+
/**
|
|
50
|
+
* - sets [CSS margin-right property](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-right)
|
|
51
|
+
* - no bidirectional support
|
|
52
|
+
* - system tokens: `space`
|
|
53
|
+
* */
|
|
54
|
+
marginRight?: SystemPropValues['space'];
|
|
55
|
+
/**
|
|
56
|
+
* - sets [CSS margin-bottom property](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-bottom)
|
|
57
|
+
* - system tokens: `space`
|
|
58
|
+
* */
|
|
59
|
+
marginBottom?: SystemPropValues['space'];
|
|
60
|
+
/**
|
|
61
|
+
* - sets [CSS margin-left property](https://developer.mozilla.org/en-US/docs/Web/CSS/margin-left)
|
|
62
|
+
* - no bidirectional support
|
|
63
|
+
* - system tokens: `space`
|
|
64
|
+
* */
|
|
65
|
+
marginLeft?: SystemPropValues['space'];
|
|
66
|
+
/**
|
|
67
|
+
* - sets [CSS padding property](https://developer.mozilla.org/en-US/docs/Web/CSS/padding)
|
|
68
|
+
* - system tokens: `space`
|
|
69
|
+
* */
|
|
70
|
+
padding?: SystemPropValues['space'];
|
|
71
|
+
/**
|
|
72
|
+
* - 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)
|
|
73
|
+
* - system tokens: `space`
|
|
74
|
+
* */
|
|
75
|
+
paddingX?: SystemPropValues['space'];
|
|
76
|
+
/**
|
|
77
|
+
* - 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)
|
|
78
|
+
* - system tokens: `space`
|
|
79
|
+
* */
|
|
80
|
+
paddingY?: SystemPropValues['space'];
|
|
81
|
+
/**
|
|
82
|
+
* - sets [CSS padding-top property](https://developer.mozilla.org/en-US/docs/Web/CSS/padding-top)
|
|
83
|
+
* - system tokens: `space`
|
|
84
|
+
* */
|
|
85
|
+
paddingTop?: SystemPropValues['space'];
|
|
86
|
+
/**
|
|
87
|
+
* - sets [CSS padding-right property](https://developer.mozilla.org/en-US/docs/Web/CSS/padding-right)
|
|
88
|
+
* - no bidirectional support
|
|
89
|
+
* - system tokens: `space`
|
|
90
|
+
* */
|
|
91
|
+
paddingRight?: SystemPropValues['space'];
|
|
92
|
+
/**
|
|
93
|
+
* - sets [CSS padding-bottom](https://developer.mozilla.org/en-US/docs/Web/CSS/padding)
|
|
94
|
+
* - system tokens: `space`
|
|
95
|
+
* */
|
|
96
|
+
paddingBottom?: SystemPropValues['space'];
|
|
97
|
+
/**
|
|
98
|
+
* - sets [CSS padding-left property](https://developer.mozilla.org/en-US/docs/Web/CSS/padding-left)
|
|
99
|
+
* - no bidirectional support
|
|
100
|
+
* - system tokens: `space`
|
|
101
|
+
* */
|
|
102
|
+
paddingLeft?: SystemPropValues['space'];
|
|
14
103
|
};
|
|
15
|
-
|
|
16
|
-
export declare
|
|
17
|
-
/** sets margin property */
|
|
18
|
-
margin?: SpacePropValues;
|
|
19
|
-
/** sets margin-left and margin-right properties */
|
|
20
|
-
marginX?: SpacePropValues;
|
|
21
|
-
/** sets margin-top and margin-bottom properties */
|
|
22
|
-
marginY?: SpacePropValues;
|
|
23
|
-
/** sets margin-top property */
|
|
24
|
-
marginTop?: SpacePropValues;
|
|
25
|
-
/** sets margin-right property (no bidirectional support) */
|
|
26
|
-
marginRight?: SpacePropValues;
|
|
27
|
-
/** sets margin-bottom property */
|
|
28
|
-
marginBottom?: SpacePropValues;
|
|
29
|
-
/** sets margin-left property (no bidirectional support) */
|
|
30
|
-
marginLeft?: SpacePropValues;
|
|
31
|
-
/** sets padding property */
|
|
32
|
-
padding?: SpacePropValues;
|
|
33
|
-
/** sets padding-left and margin-right properties */
|
|
34
|
-
paddingX?: SpacePropValues;
|
|
35
|
-
/** sets padding-top and padding-bottom properties */
|
|
36
|
-
paddingY?: SpacePropValues;
|
|
37
|
-
/** sets padding-top property */
|
|
38
|
-
paddingTop?: SpacePropValues;
|
|
39
|
-
/** sets padding-right property (no bidirectional support) */
|
|
40
|
-
paddingRight?: SpacePropValues;
|
|
41
|
-
/** sets padding-bottom */
|
|
42
|
-
paddingBottom?: SpacePropValues;
|
|
43
|
-
/** sets padding-left property (no bidirectional support) */
|
|
44
|
-
paddingLeft?: SpacePropValues;
|
|
45
|
-
};
|
|
46
|
-
export declare type SpaceStyleProps = SpaceStandardProps & SpaceLogicalProps;
|
|
104
|
+
export declare const spaceStyleFnConfigs: StyleFnConfig[];
|
|
105
|
+
export declare const spaceStyleFns: import("./buildStyleFns").StyleFns;
|
|
47
106
|
/**
|
|
48
107
|
* A style prop function that takes component props and returns space styles.
|
|
49
108
|
* If no `SpaceStyleProps` are found, it returns an empty object.
|
|
50
109
|
*
|
|
51
110
|
* @example
|
|
52
|
-
*
|
|
111
|
+
* ```tsx
|
|
53
112
|
* const BoxExample = () => (
|
|
54
113
|
* <Box padding="xs" margin="m">
|
|
55
114
|
* Hello, space!
|
|
56
115
|
* </Box>
|
|
57
116
|
* );
|
|
58
|
-
*
|
|
117
|
+
* ```
|
|
59
118
|
*/
|
|
60
|
-
export declare
|
|
61
|
-
theme?: PartialEmotionCanvasTheme;
|
|
62
|
-
}>(props: P): {};
|
|
63
|
-
export {};
|
|
119
|
+
export declare const space: (props: SpaceStyleProps) => {};
|
|
64
120
|
//# sourceMappingURL=space.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/space.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/space.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAE/C,8CAA8C;AAC9C,oBAAY,eAAe,GAAG;IAC5B;;;;SAIK;IACL,iBAAiB,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC9C;;;;SAIK;IACL,eAAe,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC5C;;;;SAIK;IACL,kBAAkB,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC/C;;;;SAIK;IACL,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC7C;;;SAGK;IACL,MAAM,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACnC;;;SAGK;IACL,OAAO,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACpC;;;SAGK;IACL,OAAO,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACpC;;;SAGK;IACL,SAAS,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACtC;;;;SAIK;IACL,WAAW,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACxC;;;SAGK;IACL,YAAY,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACzC;;;;SAIK;IACL,UAAU,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACvC;;;SAGK;IACL,OAAO,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACpC;;;SAGK;IACL,QAAQ,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACrC;;;SAGK;IACL,QAAQ,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACrC;;;SAGK;IACL,UAAU,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACvC;;;;SAIK;IACL,YAAY,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACzC;;;SAGK;IACL,aAAa,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAC1C;;;;SAIK;IACL,WAAW,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;CACzC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,aAAa,EA2F9C,CAAC;AAEF,eAAO,MAAM,aAAa,oCAAqC,CAAC;AAChE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,KAAK,gCAAmD,CAAC"}
|
|
@@ -1,157 +1,108 @@
|
|
|
1
|
-
|
|
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
|
-
_a[attr] = spaceTokens[value] || value,
|
|
96
|
-
_a;
|
|
97
|
-
};
|
|
98
|
-
var logicalSpaceStyleProps = {
|
|
99
|
-
marginInlineStart: marginLeft,
|
|
100
|
-
marginInlineEnd: marginRight,
|
|
101
|
-
paddingInlineStart: paddingLeft,
|
|
102
|
-
paddingInlineEnd: paddingRight,
|
|
103
|
-
};
|
|
104
|
-
var standardSpaceStyleProps = {
|
|
105
|
-
margin: margin,
|
|
106
|
-
marginX: marginX,
|
|
107
|
-
marginY: marginY,
|
|
108
|
-
marginTop: marginTop,
|
|
109
|
-
marginRight: marginRight,
|
|
110
|
-
marginBottom: marginBottom,
|
|
111
|
-
marginLeft: marginLeft,
|
|
112
|
-
padding: padding,
|
|
113
|
-
paddingX: paddingX,
|
|
114
|
-
paddingY: paddingY,
|
|
115
|
-
paddingTop: paddingTop,
|
|
116
|
-
paddingRight: paddingRight,
|
|
117
|
-
paddingBottom: paddingBottom,
|
|
118
|
-
paddingLeft: paddingLeft,
|
|
119
|
-
};
|
|
1
|
+
import { buildStyleFns, buildStylePropFn } from './buildStyleFns';
|
|
2
|
+
export var spaceStyleFnConfigs = [
|
|
3
|
+
{
|
|
4
|
+
name: 'marginInlineStart',
|
|
5
|
+
properties: ['marginInlineStart'],
|
|
6
|
+
system: 'space',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
name: 'marginInlineEnd',
|
|
10
|
+
properties: ['marginInlineEnd'],
|
|
11
|
+
system: 'space',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'paddingInlineStart',
|
|
15
|
+
properties: ['paddingInlineStart'],
|
|
16
|
+
system: 'space',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'paddingInlineEnd',
|
|
20
|
+
properties: ['paddingInlineEnd'],
|
|
21
|
+
system: 'space',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'margin',
|
|
25
|
+
properties: ['margin'],
|
|
26
|
+
system: 'space',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'marginX',
|
|
30
|
+
properties: ['marginLeft', 'marginRight'],
|
|
31
|
+
system: 'space',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'marginY',
|
|
35
|
+
properties: ['marginTop', 'marginBottom'],
|
|
36
|
+
system: 'space',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'marginTop',
|
|
40
|
+
properties: ['marginTop'],
|
|
41
|
+
system: 'space',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'marginRight',
|
|
45
|
+
properties: ['marginRight'],
|
|
46
|
+
system: 'space',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'marginBottom',
|
|
50
|
+
properties: ['marginBottom'],
|
|
51
|
+
system: 'space',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'marginLeft',
|
|
55
|
+
properties: ['marginLeft'],
|
|
56
|
+
system: 'space',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'padding',
|
|
60
|
+
properties: ['padding'],
|
|
61
|
+
system: 'space',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'paddingX',
|
|
65
|
+
properties: ['paddingLeft', 'paddingRight'],
|
|
66
|
+
system: 'space',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'paddingY',
|
|
70
|
+
properties: ['paddingTop', 'paddingBottom'],
|
|
71
|
+
system: 'space',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'paddingTop',
|
|
75
|
+
properties: ['paddingTop'],
|
|
76
|
+
system: 'space',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'paddingRight',
|
|
80
|
+
properties: ['paddingRight'],
|
|
81
|
+
system: 'space',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'paddingBottom',
|
|
85
|
+
properties: ['paddingBottom'],
|
|
86
|
+
system: 'space',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'paddingLeft',
|
|
90
|
+
properties: ['paddingLeft'],
|
|
91
|
+
system: 'space',
|
|
92
|
+
},
|
|
93
|
+
];
|
|
94
|
+
export var spaceStyleFns = buildStyleFns(spaceStyleFnConfigs);
|
|
120
95
|
/**
|
|
121
96
|
* A style prop function that takes component props and returns space styles.
|
|
122
97
|
* If no `SpaceStyleProps` are found, it returns an empty object.
|
|
123
98
|
*
|
|
124
99
|
* @example
|
|
125
|
-
*
|
|
100
|
+
* ```tsx
|
|
126
101
|
* const BoxExample = () => (
|
|
127
102
|
* <Box padding="xs" margin="m">
|
|
128
103
|
* Hello, space!
|
|
129
104
|
* </Box>
|
|
130
105
|
* );
|
|
131
|
-
*
|
|
106
|
+
* ```
|
|
132
107
|
*/
|
|
133
|
-
export
|
|
134
|
-
// space will always be used within the context of a component, but eslint doesn't know that
|
|
135
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
136
|
-
var canvas = useTheme(props.theme).canvas;
|
|
137
|
-
var styles = {};
|
|
138
|
-
for (var key in props) {
|
|
139
|
-
if (props.hasOwnProperty(key)) {
|
|
140
|
-
if (key in standardSpaceStyleProps) {
|
|
141
|
-
var value = props[key];
|
|
142
|
-
var spaceFn = standardSpaceStyleProps[key];
|
|
143
|
-
var style = spaceFn(value);
|
|
144
|
-
styles = __assign(__assign({}, styles), style);
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
if (key in logicalSpaceStyleProps) {
|
|
148
|
-
var value = props[key];
|
|
149
|
-
var spaceFn = logicalSpaceStyleProps[key];
|
|
150
|
-
var isRTL = canvas.direction === ContentDirection.RTL;
|
|
151
|
-
var style = spaceFn(value, isRTL);
|
|
152
|
-
styles = __assign(__assign({}, styles), style);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return styles;
|
|
157
|
-
}
|
|
108
|
+
export var space = buildStylePropFn(spaceStyleFns);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CanvasSpaceKeys } from '@workday/canvas-kit-react/tokens';
|
|
1
|
+
import { SystemPropValues } from './systemProps';
|
|
3
2
|
export declare type StackDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
|
4
3
|
declare const selector = "& > *:not(style) ~ *:not(style)";
|
|
5
|
-
export declare type StackSpacing =
|
|
4
|
+
export declare type StackSpacing = SystemPropValues['space'];
|
|
6
5
|
export declare type StackStyleProps = {
|
|
7
6
|
/** sets space values between child elements (bidirectional support) */
|
|
8
7
|
spacing: StackSpacing;
|
|
@@ -17,9 +16,7 @@ export declare type StackStyleProps = {
|
|
|
17
16
|
* */
|
|
18
17
|
shouldWrapChildren?: boolean;
|
|
19
18
|
};
|
|
20
|
-
export declare function stack<P extends StackStyleProps
|
|
21
|
-
theme?: PartialEmotionCanvasTheme;
|
|
22
|
-
}>(props: P): {
|
|
19
|
+
export declare function stack<P extends StackStyleProps>(props: P): {
|
|
23
20
|
"& > *:not(style) ~ *:not(style)": {};
|
|
24
21
|
};
|
|
25
22
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/stack.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/stack.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAEvE,oBAAY,cAAc,GAAG,KAAK,GAAG,QAAQ,GAAG,aAAa,GAAG,gBAAgB,CAAC;AAEjF,QAAA,MAAM,QAAQ,oCAAoC,CAAC;AAEnD,oBAAY,YAAY,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAErD,oBAAY,eAAe,GAAG;IAC5B,uEAAuE;IACvE,OAAO,EAAE,YAAY,CAAC;IACtB;;;SAGK;IACL,aAAa,CAAC,EAAE,cAAc,CAAC;IAC/B;;;SAGK;IACL,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AAMF,wBAAgB,KAAK,CAAC,CAAC,SAAS,eAAe,EAAE,KAAK,EAAE,CAAC;;EAuBxD"}
|
|
@@ -1,49 +1,23 @@
|
|
|
1
|
-
import { ContentDirection, useTheme, } from '@workday/canvas-kit-react/common';
|
|
2
1
|
import { space as spaceTokens } from '@workday/canvas-kit-react/tokens';
|
|
3
2
|
var selector = '& > *:not(style) ~ *:not(style)';
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
}); };
|
|
7
|
-
var columnReverse = function (value) { return ({
|
|
8
|
-
marginBottom: spaceTokens[value] || value,
|
|
9
|
-
}); };
|
|
10
|
-
var row = function (value, isRTL) {
|
|
11
|
-
var _a;
|
|
12
|
-
if (isRTL === void 0) { isRTL = false; }
|
|
13
|
-
var attr = isRTL ? 'marginRight' : 'marginLeft';
|
|
14
|
-
return _a = {},
|
|
15
|
-
_a[attr] = spaceTokens[value] || value,
|
|
16
|
-
_a;
|
|
17
|
-
};
|
|
18
|
-
var rowReverse = function (value, isRTL) {
|
|
19
|
-
var _a;
|
|
20
|
-
if (isRTL === void 0) { isRTL = false; }
|
|
21
|
-
var attr = isRTL ? 'marginLeft' : 'marginRight';
|
|
22
|
-
return _a = {},
|
|
23
|
-
_a[attr] = spaceTokens[value] || value,
|
|
24
|
-
_a;
|
|
25
|
-
};
|
|
26
|
-
var stackDirectionProps = {
|
|
27
|
-
column: column,
|
|
28
|
-
'column-reverse': columnReverse,
|
|
29
|
-
row: row,
|
|
30
|
-
'row-reverse': rowReverse,
|
|
3
|
+
var getSpace = function (value) {
|
|
4
|
+
return spaceTokens[value] || value;
|
|
31
5
|
};
|
|
32
6
|
export function stack(props) {
|
|
33
7
|
var _a;
|
|
34
|
-
var styles = {};
|
|
35
8
|
var _b = props.flexDirection, flexDirection = _b === void 0 ? 'row' : _b, spacing = props.spacing;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
styles =
|
|
9
|
+
var styles = {};
|
|
10
|
+
if (flexDirection === 'column') {
|
|
11
|
+
styles = { marginTop: getSpace(spacing) };
|
|
12
|
+
}
|
|
13
|
+
if (flexDirection === 'column-reverse') {
|
|
14
|
+
styles = { marginBottom: getSpace(spacing) };
|
|
15
|
+
}
|
|
16
|
+
if (flexDirection === 'row') {
|
|
17
|
+
styles = { marginInlineStart: getSpace(spacing) };
|
|
39
18
|
}
|
|
40
|
-
if (flexDirection === 'row
|
|
41
|
-
|
|
42
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
43
|
-
var canvas = useTheme(props.theme).canvas;
|
|
44
|
-
var stackFn = stackDirectionProps[flexDirection];
|
|
45
|
-
var isRTL = canvas.direction === ContentDirection.RTL;
|
|
46
|
-
styles = stackFn(spacing, isRTL);
|
|
19
|
+
if (flexDirection === 'row-reverse') {
|
|
20
|
+
styles = { marginInlineEnd: getSpace(spacing) };
|
|
47
21
|
}
|
|
48
22
|
return _a = {},
|
|
49
23
|
_a[selector] = styles,
|