@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,20 +1,147 @@
|
|
|
1
|
+
import {Property} from 'csstype';
|
|
2
|
+
|
|
3
|
+
import {buildStyleFns, buildStylePropFn, StyleFnConfig} from './buildStyleFns';
|
|
4
|
+
|
|
5
|
+
/** style props to for other CSS properties */
|
|
1
6
|
export type OtherStyleProps = {
|
|
2
|
-
animation
|
|
7
|
+
/** sets [CSS animation property](https://developer.mozilla.org/en-US/docs/Web/CSS/animation) */
|
|
8
|
+
animation?: Property.Animation;
|
|
9
|
+
/** sets [CSS appearance property](https://developer.mozilla.org/en-US/docs/Web/CSS/appearance) */
|
|
10
|
+
appearance?: Property.Appearance;
|
|
11
|
+
/** sets [CSS box-sizing property](https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing) */
|
|
12
|
+
boxSizing?: Property.BoxSizing;
|
|
13
|
+
/** sets [CSS content property](https://developer.mozilla.org/en-US/docs/Web/CSS/content) */
|
|
14
|
+
content?: Property.Content;
|
|
15
|
+
/** sets [CSS cursor property](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor) */
|
|
16
|
+
cursor?: Property.Cursor;
|
|
17
|
+
/** sets [CSS fill property](https://developer.mozilla.org/en-US/docs/Web/CSS/fill) */
|
|
18
|
+
fill?: Property.Fill;
|
|
19
|
+
/** sets [CSS float property](https://developer.mozilla.org/en-US/docs/Web/CSS/float) */
|
|
20
|
+
float?: Property.Float;
|
|
21
|
+
/** sets [CSS object-fit property](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) */
|
|
22
|
+
objectFit?: Property.ObjectFit;
|
|
23
|
+
/** sets [CSS object-position property](https://developer.mozilla.org/en-US/docs/Web/CSS/object-position) */
|
|
24
|
+
objectPosition?: Property.ObjectPosition;
|
|
25
|
+
/** sets [CSS outline property](https://developer.mozilla.org/en-US/docs/Web/CSS/outline) */
|
|
26
|
+
outline?: Property.Outline;
|
|
27
|
+
/** sets [CSS outline-offset property](https://developer.mozilla.org/en-US/docs/Web/CSS/outline-offset) */
|
|
28
|
+
outlineOffset?: Property.OutlineOffset;
|
|
29
|
+
/** sets [CSS overflow-wrap property](https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-wrap) */
|
|
30
|
+
overflowWrap?: Property.OverflowWrap;
|
|
31
|
+
/** sets [CSS pointer-events property](https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events) */
|
|
32
|
+
pointerEvents?: Property.PointerEvents;
|
|
33
|
+
/** sets [CSS resize property](https://developer.mozilla.org/en-US/docs/Web/CSS/resize) */
|
|
34
|
+
resize?: Property.Resize;
|
|
35
|
+
/** sets [CSS stroke property](https://developer.mozilla.org/en-US/docs/Web/CSS/stroke) */
|
|
36
|
+
stroke?: Property.Stroke;
|
|
37
|
+
/** sets [CSS transform property](https://developer.mozilla.org/en-US/docs/Web/CSS/transform) */
|
|
38
|
+
transform?: Property.Transform;
|
|
39
|
+
/** sets [CSS transition property](https://developer.mozilla.org/en-US/docs/Web/CSS/transition) */
|
|
40
|
+
transition?: Property.Transition;
|
|
41
|
+
/** sets [CSS user-select property](https://developer.mozilla.org/en-US/docs/Web/CSS/user-select) */
|
|
42
|
+
userSelect?: Property.UserSelect;
|
|
43
|
+
/** sets [CSS visibility property](https://developer.mozilla.org/en-US/docs/Web/CSS/visibility) */
|
|
44
|
+
visibility?: Property.Visibility;
|
|
3
45
|
};
|
|
4
46
|
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
47
|
+
export const otherStyleFnConfigs: StyleFnConfig[] = [
|
|
48
|
+
{
|
|
49
|
+
name: 'animation',
|
|
50
|
+
properties: ['animation'],
|
|
51
|
+
system: 'none',
|
|
8
52
|
},
|
|
9
|
-
|
|
53
|
+
{
|
|
54
|
+
name: 'appearance',
|
|
55
|
+
properties: ['appearance'],
|
|
56
|
+
system: 'none',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'boxSizing',
|
|
60
|
+
properties: ['boxSizing'],
|
|
61
|
+
system: 'none',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'content',
|
|
65
|
+
properties: ['content'],
|
|
66
|
+
system: 'none',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'cursor',
|
|
70
|
+
properties: ['cursor'],
|
|
71
|
+
system: 'none',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'fill',
|
|
75
|
+
properties: ['fill'],
|
|
76
|
+
system: 'none',
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'float',
|
|
80
|
+
properties: ['float'],
|
|
81
|
+
system: 'none',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'objectFit',
|
|
85
|
+
properties: ['objectFit'],
|
|
86
|
+
system: 'none',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'objectPosition',
|
|
90
|
+
properties: ['objectPosition'],
|
|
91
|
+
system: 'none',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'outline',
|
|
95
|
+
properties: ['outline'],
|
|
96
|
+
system: 'none',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'outlineOffset',
|
|
100
|
+
properties: ['outlineOffset'],
|
|
101
|
+
system: 'none',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: 'overflowWrap',
|
|
105
|
+
properties: ['overflowWrap'],
|
|
106
|
+
system: 'none',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'pointerEvents',
|
|
110
|
+
properties: ['pointerEvents'],
|
|
111
|
+
system: 'none',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: 'resize',
|
|
115
|
+
properties: ['resize'],
|
|
116
|
+
system: 'none',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'stroke',
|
|
120
|
+
properties: ['stroke'],
|
|
121
|
+
system: 'none',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: 'transform',
|
|
125
|
+
properties: ['transform'],
|
|
126
|
+
system: 'none',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'transition',
|
|
130
|
+
properties: ['transition'],
|
|
131
|
+
system: 'none',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: 'userSelect',
|
|
135
|
+
properties: ['userSelect'],
|
|
136
|
+
system: 'none',
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
name: 'visibility',
|
|
140
|
+
properties: ['visibility'],
|
|
141
|
+
system: 'none',
|
|
142
|
+
},
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
export const otherStyleFns = buildStyleFns(otherStyleFnConfigs);
|
|
10
146
|
|
|
11
|
-
export
|
|
12
|
-
for (const key in props) {
|
|
13
|
-
if (key in otherProps) {
|
|
14
|
-
const value = props[key as keyof OtherStyleProps] as keyof OtherStyleProps;
|
|
15
|
-
const styleFn = otherProps[key as keyof OtherStyleProps];
|
|
16
|
-
return styleFn(value);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return {};
|
|
20
|
-
}
|
|
147
|
+
export const other = buildStylePropFn<OtherStyleProps>(otherStyleFns);
|
|
@@ -1,96 +1,102 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ContentDirection,
|
|
3
|
-
PartialEmotionCanvasTheme,
|
|
4
|
-
useTheme,
|
|
5
|
-
} from '@workday/canvas-kit-react/common';
|
|
6
1
|
import {Property} from 'csstype';
|
|
7
2
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
import {buildStyleFns, buildStylePropFn, StyleFnConfig} from './buildStyleFns';
|
|
4
|
+
|
|
5
|
+
/** style props to for CSS position properties */
|
|
6
|
+
export type PositionStyleProps = {
|
|
7
|
+
/**
|
|
8
|
+
* - sets [CSS position property](https://developer.mozilla.org/en-US/docs/Web/CSS/position)
|
|
9
|
+
* */
|
|
11
10
|
position?: Property.Position;
|
|
12
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* - sets [CSS z-index property](https://developer.mozilla.org/en-US/docs/Web/CSS/z-index)
|
|
13
|
+
* */
|
|
13
14
|
zIndex?: Property.ZIndex;
|
|
14
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* - sets [CSS top property](https://developer.mozilla.org/en-US/docs/Web/CSS/top)
|
|
17
|
+
* */
|
|
15
18
|
top?: number | string;
|
|
16
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* - sets [CSS right property](https://developer.mozilla.org/en-US/docs/Web/CSS/right)
|
|
21
|
+
* - no bidirectional support
|
|
22
|
+
* */
|
|
17
23
|
right?: number | string;
|
|
18
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* - sets [CSS bottom property](https://developer.mozilla.org/en-US/docs/Web/CSS/bottom)
|
|
26
|
+
* */
|
|
19
27
|
bottom?: number | string;
|
|
20
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* - sets [CSS left property](https://developer.mozilla.org/en-US/docs/Web/CSS/left)
|
|
30
|
+
* - no bidirectional support
|
|
31
|
+
* */
|
|
21
32
|
left?: number | string;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
/**
|
|
34
|
+
* - sets [CSS inset-inline-start property](https://developer.mozilla.org/en-US/docs/Web/CSS/inset-inline-start)
|
|
35
|
+
* - bidirectional support
|
|
36
|
+
* */
|
|
26
37
|
insetInlineStart?: number | string;
|
|
27
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* - sets [CSS inset-inline-end property](https://developer.mozilla.org/en-US/docs/Web/CSS/inset-inline-end)
|
|
40
|
+
* - bidirectional support
|
|
41
|
+
* */
|
|
28
42
|
insetInlineEnd?: number | string;
|
|
29
43
|
};
|
|
30
44
|
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
export const positionStyleFnConfigs: StyleFnConfig[] = [
|
|
46
|
+
{
|
|
47
|
+
name: 'position',
|
|
48
|
+
properties: ['position'],
|
|
49
|
+
system: 'none',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'zIndex',
|
|
53
|
+
properties: ['zIndex'],
|
|
54
|
+
system: 'none',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'top',
|
|
58
|
+
properties: ['top'],
|
|
59
|
+
system: 'none',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'right',
|
|
63
|
+
properties: ['right'],
|
|
64
|
+
system: 'none',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'bottom',
|
|
68
|
+
properties: ['bottom'],
|
|
69
|
+
system: 'none',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: 'left',
|
|
73
|
+
properties: ['left'],
|
|
74
|
+
system: 'none',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'insetInlineStart',
|
|
78
|
+
properties: ['insetInlineStart'],
|
|
79
|
+
system: 'none',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'insetInlineEnd',
|
|
83
|
+
properties: ['insetInlineEnd'],
|
|
84
|
+
system: 'none',
|
|
85
|
+
},
|
|
86
|
+
];
|
|
56
87
|
|
|
88
|
+
export const positionStyleFns = buildStyleFns(positionStyleFnConfigs);
|
|
57
89
|
/**
|
|
58
|
-
* A style prop function that takes
|
|
90
|
+
* A style prop function that takes component props and returns position styles.
|
|
59
91
|
* If no `PositionProps` are found, it returns an empty object.
|
|
60
92
|
*
|
|
61
93
|
* @example
|
|
62
|
-
*
|
|
94
|
+
* ```
|
|
63
95
|
* const BoxExample = () => (
|
|
64
96
|
* <Box position="absolute" top="50%">
|
|
65
97
|
* Hello, positions!
|
|
66
98
|
* </Box>
|
|
67
99
|
* );
|
|
68
|
-
*
|
|
100
|
+
* ```
|
|
69
101
|
*/
|
|
70
|
-
export
|
|
71
|
-
props: P
|
|
72
|
-
) {
|
|
73
|
-
// position will always be used within the context of a component, but eslint doesn't know that
|
|
74
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
75
|
-
const {canvas} = useTheme(props.theme);
|
|
76
|
-
let styles = {};
|
|
77
|
-
for (const key in props) {
|
|
78
|
-
if (key in props) {
|
|
79
|
-
if (key in standardPositionProps) {
|
|
80
|
-
const value = props[key];
|
|
81
|
-
const attr = standardPositionProps[key as keyof PositionStandardProps];
|
|
82
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
83
|
-
styles[attr] = value;
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
if (key in logicalPositionProps) {
|
|
87
|
-
const value = props[key as keyof PositionLogicalProps] as string | number;
|
|
88
|
-
const styleFn = logicalPositionProps[key as keyof PositionLogicalProps];
|
|
89
|
-
const isRTL = canvas.direction === ContentDirection.RTL;
|
|
90
|
-
const style = styleFn(value, isRTL);
|
|
91
|
-
styles = {...styles, ...style};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return styles;
|
|
96
|
-
}
|
|
102
|
+
export const position = buildStylePropFn<PositionStyleProps>(positionStyleFns);
|