@workday/canvas-kit-react 7.0.0-alpha.0-next.1 → 7.0.0-alpha.0-next.3
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/banner/lib/Banner.tsx +1 -0
- package/banner/lib/BannerActionText.tsx +12 -9
- package/banner/lib/BannerIcon.tsx +11 -12
- package/button/lib/ToolbarDropdownButton.tsx +1 -2
- package/cookie-banner/lib/CookieBanner.tsx +1 -0
- package/dist/commonjs/banner/lib/Banner.d.ts.map +1 -1
- package/dist/commonjs/banner/lib/Banner.js +1 -0
- package/dist/commonjs/banner/lib/BannerActionText.d.ts.map +1 -1
- package/dist/commonjs/banner/lib/BannerActionText.js +11 -5
- package/dist/commonjs/banner/lib/BannerIcon.d.ts.map +1 -1
- package/dist/commonjs/banner/lib/BannerIcon.js +7 -7
- package/dist/commonjs/button/lib/ToolbarDropdownButton.d.ts.map +1 -1
- package/dist/commonjs/button/lib/ToolbarDropdownButton.js +7 -5
- 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/cookie-banner/lib/CookieBanner.d.ts.map +1 -1
- package/dist/commonjs/cookie-banner/lib/CookieBanner.js +1 -0
- package/dist/commonjs/dialog/lib/Dialog.d.ts +1 -1
- package/dist/commonjs/icon/lib/Svg.d.ts +0 -1
- package/dist/commonjs/icon/lib/Svg.d.ts.map +1 -1
- package/dist/commonjs/icon/lib/Svg.js +7 -14
- package/dist/commonjs/modal/lib/Modal.d.ts +1 -1
- package/dist/commonjs/pagination/lib/Pagination/AdditionalDetails.d.ts +2 -3
- package/dist/commonjs/pagination/lib/Pagination/AdditionalDetails.d.ts.map +1 -1
- package/dist/commonjs/pagination/lib/Pagination/AdditionalDetails.js +21 -7
- package/dist/commonjs/pagination/lib/Pagination/Controls.js +2 -2
- package/dist/commonjs/pagination/lib/Pagination/GoTo/Form.d.ts +2 -3
- package/dist/commonjs/pagination/lib/Pagination/GoTo/Form.d.ts.map +1 -1
- package/dist/commonjs/pagination/lib/Pagination/GoTo/Form.js +2 -2
- package/dist/commonjs/pagination/lib/Pagination/GoTo/Label.d.ts +1 -2
- package/dist/commonjs/pagination/lib/Pagination/GoTo/Label.d.ts.map +1 -1
- package/dist/commonjs/pagination/lib/Pagination/GoTo/Label.js +12 -4
- package/dist/commonjs/pagination/lib/Pagination/Nav.d.ts +1 -1
- package/dist/commonjs/pagination/lib/Pagination/Nav.d.ts.map +1 -1
- package/dist/commonjs/pagination/lib/Pagination/Nav.js +2 -2
- package/dist/commonjs/pagination/lib/Pagination/PageList.d.ts +4 -4
- package/dist/commonjs/pagination/lib/Pagination/PageList.d.ts.map +1 -1
- package/dist/commonjs/pagination/lib/Pagination/PageList.js +11 -7
- package/dist/commonjs/pagination/lib/Pagination/Pagination.d.ts +3 -3
- package/dist/commonjs/pagination/lib/Pagination/common/List.d.ts +6 -8
- package/dist/commonjs/pagination/lib/Pagination/common/List.d.ts.map +1 -1
- package/dist/commonjs/pagination/lib/Pagination/common/List.js +15 -12
- package/dist/commonjs/popup/lib/Popper.d.ts +5 -0
- package/dist/commonjs/popup/lib/Popper.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/Popper.js +9 -8
- package/dist/commonjs/popup/lib/Popup.d.ts +1 -1
- package/dist/commonjs/popup/lib/hooks/useInitialFocus.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/hooks/useInitialFocus.js +5 -3
- package/dist/commonjs/tabs/lib/TabsItem.d.ts +1 -1
- package/dist/commonjs/toast/lib/Toast.d.ts.map +1 -1
- package/dist/commonjs/toast/lib/Toast.js +16 -13
- package/dist/es6/banner/lib/Banner.d.ts.map +1 -1
- package/dist/es6/banner/lib/Banner.js +1 -0
- package/dist/es6/banner/lib/BannerActionText.d.ts.map +1 -1
- package/dist/es6/banner/lib/BannerActionText.js +5 -6
- package/dist/es6/banner/lib/BannerIcon.d.ts.map +1 -1
- package/dist/es6/banner/lib/BannerIcon.js +5 -8
- package/dist/es6/button/lib/ToolbarDropdownButton.d.ts.map +1 -1
- package/dist/es6/button/lib/ToolbarDropdownButton.js +4 -5
- 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/cookie-banner/lib/CookieBanner.d.ts.map +1 -1
- package/dist/es6/cookie-banner/lib/CookieBanner.js +1 -0
- package/dist/es6/dialog/lib/Dialog.d.ts +1 -1
- package/dist/es6/icon/lib/Svg.d.ts +0 -1
- package/dist/es6/icon/lib/Svg.d.ts.map +1 -1
- package/dist/es6/icon/lib/Svg.js +7 -14
- package/dist/es6/modal/lib/Modal.d.ts +1 -1
- package/dist/es6/pagination/lib/Pagination/AdditionalDetails.d.ts +2 -3
- package/dist/es6/pagination/lib/Pagination/AdditionalDetails.d.ts.map +1 -1
- package/dist/es6/pagination/lib/Pagination/AdditionalDetails.js +16 -9
- package/dist/es6/pagination/lib/Pagination/Controls.js +1 -1
- package/dist/es6/pagination/lib/Pagination/GoTo/Form.d.ts +2 -3
- package/dist/es6/pagination/lib/Pagination/GoTo/Form.d.ts.map +1 -1
- package/dist/es6/pagination/lib/Pagination/GoTo/Form.js +2 -2
- package/dist/es6/pagination/lib/Pagination/GoTo/Label.d.ts +1 -2
- package/dist/es6/pagination/lib/Pagination/GoTo/Label.d.ts.map +1 -1
- package/dist/es6/pagination/lib/Pagination/GoTo/Label.js +5 -4
- package/dist/es6/pagination/lib/Pagination/Nav.d.ts +1 -1
- package/dist/es6/pagination/lib/Pagination/Nav.d.ts.map +1 -1
- package/dist/es6/pagination/lib/Pagination/Nav.js +2 -2
- package/dist/es6/pagination/lib/Pagination/PageList.d.ts +4 -4
- package/dist/es6/pagination/lib/Pagination/PageList.d.ts.map +1 -1
- package/dist/es6/pagination/lib/Pagination/PageList.js +5 -8
- package/dist/es6/pagination/lib/Pagination/Pagination.d.ts +3 -3
- package/dist/es6/pagination/lib/Pagination/common/List.d.ts +6 -8
- package/dist/es6/pagination/lib/Pagination/common/List.d.ts.map +1 -1
- package/dist/es6/pagination/lib/Pagination/common/List.js +15 -12
- package/dist/es6/popup/lib/Popper.d.ts +5 -0
- package/dist/es6/popup/lib/Popper.d.ts.map +1 -1
- package/dist/es6/popup/lib/Popper.js +9 -8
- package/dist/es6/popup/lib/Popup.d.ts +1 -1
- package/dist/es6/popup/lib/hooks/useInitialFocus.d.ts.map +1 -1
- package/dist/es6/popup/lib/hooks/useInitialFocus.js +5 -3
- package/dist/es6/tabs/lib/TabsItem.d.ts +1 -1
- package/dist/es6/toast/lib/Toast.d.ts.map +1 -1
- package/dist/es6/toast/lib/Toast.js +9 -13
- package/icon/lib/Svg.tsx +13 -22
- package/package.json +5 -5
- package/pagination/lib/Pagination/AdditionalDetails.tsx +24 -18
- package/pagination/lib/Pagination/Controls.tsx +1 -1
- package/pagination/lib/Pagination/GoTo/Form.tsx +4 -5
- package/pagination/lib/Pagination/GoTo/Label.tsx +5 -6
- package/pagination/lib/Pagination/Nav.tsx +2 -2
- package/pagination/lib/Pagination/PageList.tsx +13 -11
- package/pagination/lib/Pagination/common/List.tsx +25 -23
- package/popup/lib/Popper.tsx +13 -5
- package/popup/lib/hooks/useInitialFocus.tsx +3 -1
- package/toast/lib/Toast.tsx +9 -15
- package/ts3.5/dist/commonjs/card/lib/Card.d.ts +1 -1
- package/ts3.5/dist/commonjs/card/lib/CardBody.d.ts +1 -1
- package/ts3.5/dist/commonjs/dialog/lib/Dialog.d.ts +1 -1
- package/ts3.5/dist/commonjs/icon/lib/Svg.d.ts +0 -1
- package/ts3.5/dist/commonjs/modal/lib/Modal.d.ts +1 -1
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/AdditionalDetails.d.ts +2 -3
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/GoTo/Form.d.ts +2 -3
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/GoTo/Label.d.ts +1 -2
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/Nav.d.ts +1 -1
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/PageList.d.ts +4 -4
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/Pagination.d.ts +3 -3
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/common/List.d.ts +6 -8
- package/ts3.5/dist/commonjs/popup/lib/Popper.d.ts +5 -0
- package/ts3.5/dist/commonjs/popup/lib/Popup.d.ts +1 -1
- package/ts3.5/dist/commonjs/tabs/lib/TabsItem.d.ts +1 -1
- package/ts3.5/dist/es6/card/lib/Card.d.ts +1 -1
- package/ts3.5/dist/es6/card/lib/CardBody.d.ts +1 -1
- package/ts3.5/dist/es6/dialog/lib/Dialog.d.ts +1 -1
- package/ts3.5/dist/es6/icon/lib/Svg.d.ts +0 -1
- package/ts3.5/dist/es6/modal/lib/Modal.d.ts +1 -1
- package/ts3.5/dist/es6/pagination/lib/Pagination/AdditionalDetails.d.ts +2 -3
- package/ts3.5/dist/es6/pagination/lib/Pagination/GoTo/Form.d.ts +2 -3
- package/ts3.5/dist/es6/pagination/lib/Pagination/GoTo/Label.d.ts +1 -2
- package/ts3.5/dist/es6/pagination/lib/Pagination/Nav.d.ts +1 -1
- package/ts3.5/dist/es6/pagination/lib/Pagination/PageList.d.ts +4 -4
- package/ts3.5/dist/es6/pagination/lib/Pagination/Pagination.d.ts +3 -3
- package/ts3.5/dist/es6/pagination/lib/Pagination/common/List.d.ts +6 -8
- package/ts3.5/dist/es6/popup/lib/Popper.d.ts +5 -0
- package/ts3.5/dist/es6/popup/lib/Popup.d.ts +1 -1
- package/ts3.5/dist/es6/tabs/lib/TabsItem.d.ts +1 -1
- package/dist/commonjs/pagination/lib/Pagination/common/Box.d.ts +0 -12
- package/dist/commonjs/pagination/lib/Pagination/common/Box.d.ts.map +0 -1
- package/dist/commonjs/pagination/lib/Pagination/common/Box.js +0 -70
- package/dist/commonjs/pagination/lib/Pagination/common/Flex.d.ts +0 -6
- package/dist/commonjs/pagination/lib/Pagination/common/Flex.d.ts.map +0 -1
- package/dist/commonjs/pagination/lib/Pagination/common/Flex.js +0 -32
- package/dist/commonjs/pagination/lib/Pagination/common/Stack.d.ts +0 -48
- package/dist/commonjs/pagination/lib/Pagination/common/Stack.d.ts.map +0 -1
- package/dist/commonjs/pagination/lib/Pagination/common/Stack.js +0 -87
- package/dist/commonjs/pagination/lib/Pagination/common/utils/flex.d.ts +0 -57
- package/dist/commonjs/pagination/lib/Pagination/common/utils/flex.d.ts.map +0 -1
- package/dist/commonjs/pagination/lib/Pagination/common/utils/flex.js +0 -23
- package/dist/commonjs/pagination/lib/Pagination/common/utils/layout.d.ts +0 -32
- package/dist/commonjs/pagination/lib/Pagination/common/utils/layout.d.ts.map +0 -1
- package/dist/commonjs/pagination/lib/Pagination/common/utils/layout.js +0 -15
- package/dist/commonjs/pagination/lib/Pagination/common/utils/safelySpreadProps.d.ts +0 -12
- package/dist/commonjs/pagination/lib/Pagination/common/utils/safelySpreadProps.d.ts.map +0 -1
- package/dist/commonjs/pagination/lib/Pagination/common/utils/safelySpreadProps.js +0 -37
- package/dist/commonjs/pagination/lib/Pagination/common/utils/space.d.ts +0 -127
- package/dist/commonjs/pagination/lib/Pagination/common/utils/space.d.ts.map +0 -1
- package/dist/commonjs/pagination/lib/Pagination/common/utils/space.js +0 -75
- package/dist/es6/pagination/lib/Pagination/common/Box.d.ts +0 -12
- package/dist/es6/pagination/lib/Pagination/common/Box.d.ts.map +0 -1
- package/dist/es6/pagination/lib/Pagination/common/Box.js +0 -58
- package/dist/es6/pagination/lib/Pagination/common/Flex.d.ts +0 -6
- package/dist/es6/pagination/lib/Pagination/common/Flex.d.ts.map +0 -1
- package/dist/es6/pagination/lib/Pagination/common/Flex.js +0 -27
- package/dist/es6/pagination/lib/Pagination/common/Stack.d.ts +0 -48
- package/dist/es6/pagination/lib/Pagination/common/Stack.d.ts.map +0 -1
- package/dist/es6/pagination/lib/Pagination/common/Stack.js +0 -78
- package/dist/es6/pagination/lib/Pagination/common/utils/flex.d.ts +0 -57
- package/dist/es6/pagination/lib/Pagination/common/utils/flex.d.ts.map +0 -1
- package/dist/es6/pagination/lib/Pagination/common/utils/flex.js +0 -21
- package/dist/es6/pagination/lib/Pagination/common/utils/layout.d.ts +0 -32
- package/dist/es6/pagination/lib/Pagination/common/utils/layout.d.ts.map +0 -1
- package/dist/es6/pagination/lib/Pagination/common/utils/layout.js +0 -13
- package/dist/es6/pagination/lib/Pagination/common/utils/safelySpreadProps.d.ts +0 -12
- package/dist/es6/pagination/lib/Pagination/common/utils/safelySpreadProps.d.ts.map +0 -1
- package/dist/es6/pagination/lib/Pagination/common/utils/safelySpreadProps.js +0 -34
- package/dist/es6/pagination/lib/Pagination/common/utils/space.d.ts +0 -127
- package/dist/es6/pagination/lib/Pagination/common/utils/space.d.ts.map +0 -1
- package/dist/es6/pagination/lib/Pagination/common/utils/space.js +0 -73
- package/pagination/lib/Pagination/common/Box.tsx +0 -44
- package/pagination/lib/Pagination/common/Flex.tsx +0 -23
- package/pagination/lib/Pagination/common/Stack.tsx +0 -98
- package/pagination/lib/Pagination/common/utils/flex.ts +0 -110
- package/pagination/lib/Pagination/common/utils/layout.ts +0 -40
- package/pagination/lib/Pagination/common/utils/safelySpreadProps.ts +0 -29
- package/pagination/lib/Pagination/common/utils/space.ts +0 -109
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/common/Box.d.ts +0 -12
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/common/Flex.d.ts +0 -6
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/common/Stack.d.ts +0 -48
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/common/utils/flex.d.ts +0 -57
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/common/utils/layout.d.ts +0 -32
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/common/utils/safelySpreadProps.d.ts +0 -12
- package/ts3.5/dist/commonjs/pagination/lib/Pagination/common/utils/space.d.ts +0 -127
- package/ts3.5/dist/es6/pagination/lib/Pagination/common/Box.d.ts +0 -12
- package/ts3.5/dist/es6/pagination/lib/Pagination/common/Flex.d.ts +0 -6
- package/ts3.5/dist/es6/pagination/lib/Pagination/common/Stack.d.ts +0 -48
- package/ts3.5/dist/es6/pagination/lib/Pagination/common/utils/flex.d.ts +0 -57
- package/ts3.5/dist/es6/pagination/lib/Pagination/common/utils/layout.d.ts +0 -32
- package/ts3.5/dist/es6/pagination/lib/Pagination/common/utils/safelySpreadProps.d.ts +0 -12
- package/ts3.5/dist/es6/pagination/lib/Pagination/common/utils/space.d.ts +0 -127
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
declare type Globals = '-moz-initial' | 'inherit' | 'initial' | 'revert' | 'unset';
|
|
2
|
-
declare type OverflowProperty = Globals | 'auto' | 'hidden' | 'scroll' | 'visible' | string;
|
|
3
|
-
declare type OverflowXProperty = '-moz-initial' | 'inherit' | 'initial' | 'revert' | 'unset' | 'auto' | 'hidden' | 'scroll' | 'visible';
|
|
4
|
-
declare type OverflowYProperty = OverflowXProperty;
|
|
5
|
-
export interface LayoutProps {
|
|
6
|
-
display?: string;
|
|
7
|
-
height?: number | string;
|
|
8
|
-
maxHeight?: number | string;
|
|
9
|
-
maxWidth?: number | string;
|
|
10
|
-
minHeight?: number | string;
|
|
11
|
-
minWidth?: number | string;
|
|
12
|
-
overflow?: OverflowProperty;
|
|
13
|
-
overflowX?: OverflowXProperty;
|
|
14
|
-
overflowY?: OverflowYProperty;
|
|
15
|
-
verticalAlign?: string;
|
|
16
|
-
width?: number | string;
|
|
17
|
-
}
|
|
18
|
-
export declare const layout: {
|
|
19
|
-
display: string;
|
|
20
|
-
height: string;
|
|
21
|
-
maxHeight: string;
|
|
22
|
-
maxWidth: string;
|
|
23
|
-
minHeight: string;
|
|
24
|
-
minWidth: string;
|
|
25
|
-
overflow: string;
|
|
26
|
-
overflowX: string;
|
|
27
|
-
overflowY: string;
|
|
28
|
-
verticalAlign: string;
|
|
29
|
-
width: string;
|
|
30
|
-
};
|
|
31
|
-
export {};
|
|
32
|
-
//# sourceMappingURL=layout.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../../../../../../../pagination/lib/Pagination/common/utils/layout.ts"],"names":[],"mappings":"AAAA,aAAK,OAAO,GAAG,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAC3E,aAAK,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAC;AACpF,aAAK,iBAAiB,GAClB,cAAc,GACd,SAAS,GACT,SAAS,GACT,QAAQ,GACR,OAAO,GACP,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,SAAS,CAAC;AACd,aAAK,iBAAiB,GAAG,iBAAiB,CAAC;AAC3C,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,SAAS,CAAC,EAAE,iBAAiB,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,MAAM;;;;;;;;;;;;CAYlB,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export var layout = {
|
|
2
|
-
display: 'display',
|
|
3
|
-
height: 'height',
|
|
4
|
-
maxHeight: 'maxHeight',
|
|
5
|
-
maxWidth: 'maxWidth',
|
|
6
|
-
minHeight: 'minHeight',
|
|
7
|
-
minWidth: 'minWidth',
|
|
8
|
-
overflow: 'overflow',
|
|
9
|
-
overflowX: 'overflowX',
|
|
10
|
-
overflowY: 'overflowY',
|
|
11
|
-
verticalAlign: 'verticalAlign',
|
|
12
|
-
width: 'width',
|
|
13
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Removes style props from props to prevent them from being applied to the HTML element.
|
|
3
|
-
* Returns an object of props that is stripped of all style props.
|
|
4
|
-
* @example
|
|
5
|
-
* const Box = (props) => {
|
|
6
|
-
* const safeProps = safelySpreadProps(props);
|
|
7
|
-
* return <div {...safeProps} />
|
|
8
|
-
* }
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
export declare function safelySpreadProps<T extends object>(props: T): T;
|
|
12
|
-
//# sourceMappingURL=safelySpreadProps.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"safelySpreadProps.d.ts","sourceRoot":"","sources":["../../../../../../../pagination/lib/Pagination/common/utils/safelySpreadProps.ts"],"names":[],"mappings":"AAUA;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,CAAC,KAQ3D"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
import { flex } from './flex';
|
|
13
|
-
import { layout } from './layout';
|
|
14
|
-
import { space } from './space';
|
|
15
|
-
var styleProps = __assign(__assign(__assign({}, flex), layout), space);
|
|
16
|
-
/**
|
|
17
|
-
* Removes style props from props to prevent them from being applied to the HTML element.
|
|
18
|
-
* Returns an object of props that is stripped of all style props.
|
|
19
|
-
* @example
|
|
20
|
-
* const Box = (props) => {
|
|
21
|
-
* const safeProps = safelySpreadProps(props);
|
|
22
|
-
* return <div {...safeProps} />
|
|
23
|
-
* }
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
|
-
export function safelySpreadProps(props) {
|
|
27
|
-
var safeProps = {};
|
|
28
|
-
for (var key in props) {
|
|
29
|
-
if (!(key in styleProps)) {
|
|
30
|
-
safeProps[key] = props[key];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return safeProps;
|
|
34
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { space as canvasSpace } from '@workday/canvas-kit-react/tokens';
|
|
2
|
-
export declare type Spacing = keyof typeof canvasSpace;
|
|
3
|
-
export interface SpaceProps {
|
|
4
|
-
margin?: Spacing;
|
|
5
|
-
m?: Spacing;
|
|
6
|
-
marginX?: Spacing;
|
|
7
|
-
mx?: Spacing;
|
|
8
|
-
marginY?: Spacing;
|
|
9
|
-
my?: Spacing;
|
|
10
|
-
marginT?: Spacing;
|
|
11
|
-
mt?: Spacing;
|
|
12
|
-
marginR?: Spacing;
|
|
13
|
-
mr?: Spacing;
|
|
14
|
-
marginB?: Spacing;
|
|
15
|
-
mb?: Spacing;
|
|
16
|
-
marginL?: Spacing;
|
|
17
|
-
ml?: Spacing;
|
|
18
|
-
padding?: Spacing;
|
|
19
|
-
p?: Spacing;
|
|
20
|
-
paddingX?: Spacing;
|
|
21
|
-
px?: Spacing;
|
|
22
|
-
paddingY?: Spacing;
|
|
23
|
-
py?: Spacing;
|
|
24
|
-
paddingT?: Spacing;
|
|
25
|
-
pt?: Spacing;
|
|
26
|
-
paddingR?: Spacing;
|
|
27
|
-
pr?: Spacing;
|
|
28
|
-
paddingB?: Spacing;
|
|
29
|
-
pb?: Spacing;
|
|
30
|
-
paddingL?: Spacing;
|
|
31
|
-
pl?: Spacing;
|
|
32
|
-
}
|
|
33
|
-
export declare const space: {
|
|
34
|
-
margin: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
35
|
-
margin: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
36
|
-
};
|
|
37
|
-
m: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
38
|
-
margin: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
39
|
-
};
|
|
40
|
-
marginX: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
41
|
-
marginLeft: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
42
|
-
marginRight: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
43
|
-
};
|
|
44
|
-
mx: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
45
|
-
marginLeft: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
46
|
-
marginRight: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
47
|
-
};
|
|
48
|
-
marginY: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
49
|
-
marginBottom: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
50
|
-
marginTop: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
51
|
-
};
|
|
52
|
-
my: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
53
|
-
marginBottom: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
54
|
-
marginTop: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
55
|
-
};
|
|
56
|
-
marginT: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
57
|
-
marginTop: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
58
|
-
};
|
|
59
|
-
mt: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
60
|
-
marginTop: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
61
|
-
};
|
|
62
|
-
marginR: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
63
|
-
marginRight: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
64
|
-
};
|
|
65
|
-
mr: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
66
|
-
marginRight: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
67
|
-
};
|
|
68
|
-
marginB: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
69
|
-
marginBottom: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
70
|
-
};
|
|
71
|
-
mb: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
72
|
-
marginBottom: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
73
|
-
};
|
|
74
|
-
marginL: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
75
|
-
marginLeft: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
76
|
-
};
|
|
77
|
-
ml: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
78
|
-
marginLeft: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
79
|
-
};
|
|
80
|
-
padding: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
81
|
-
padding: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
82
|
-
};
|
|
83
|
-
p: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
84
|
-
padding: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
85
|
-
};
|
|
86
|
-
paddingX: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
87
|
-
paddingLeft: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
88
|
-
paddingRight: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
89
|
-
};
|
|
90
|
-
px: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
91
|
-
paddingLeft: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
92
|
-
paddingRight: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
93
|
-
};
|
|
94
|
-
paddingY: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
95
|
-
paddingBottom: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
96
|
-
paddingTop: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
97
|
-
};
|
|
98
|
-
py: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
99
|
-
paddingBottom: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
100
|
-
paddingTop: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
101
|
-
};
|
|
102
|
-
paddingT: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
103
|
-
paddingTop: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
104
|
-
};
|
|
105
|
-
pt: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
106
|
-
paddingTop: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
107
|
-
};
|
|
108
|
-
paddingR: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
109
|
-
paddingRight: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
110
|
-
};
|
|
111
|
-
pr: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
112
|
-
paddingRight: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
113
|
-
};
|
|
114
|
-
paddingB: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
115
|
-
paddingBottom: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
116
|
-
};
|
|
117
|
-
pb: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
118
|
-
paddingBottom: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
119
|
-
};
|
|
120
|
-
paddingL: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
121
|
-
paddingLeft: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
122
|
-
};
|
|
123
|
-
pl: (value: "s" | "zero" | "m" | "l" | "xl" | "xxxs" | "xxs" | "xs" | "xxl" | "xxxl") => {
|
|
124
|
-
paddingLeft: "0px" | "4px" | "8px" | "12px" | "16px" | "24px" | "32px" | "40px" | "64px" | "80px";
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
//# sourceMappingURL=space.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../../../../../../pagination/lib/Pagination/common/utils/space.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,IAAI,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAEtE,oBAAY,OAAO,GAAG,MAAM,OAAO,WAAW,CAAC;AAE/C,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,CAAC,CAAC,EAAE,OAAO,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,CAAC,CAAC,EAAE,OAAO,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,OAAO,CAAC;CACd;AA8CD,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BjB,CAAC"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { space as canvasSpace } from '@workday/canvas-kit-react/tokens';
|
|
2
|
-
var margin = function (value) { return ({ margin: canvasSpace[value] || value }); };
|
|
3
|
-
var marginX = function (value) { return ({
|
|
4
|
-
marginLeft: canvasSpace[value],
|
|
5
|
-
marginRight: canvasSpace[value],
|
|
6
|
-
}); };
|
|
7
|
-
var marginY = function (value) { return ({
|
|
8
|
-
marginBottom: canvasSpace[value],
|
|
9
|
-
marginTop: canvasSpace[value],
|
|
10
|
-
}); };
|
|
11
|
-
var marginT = function (value) { return ({
|
|
12
|
-
marginTop: canvasSpace[value],
|
|
13
|
-
}); };
|
|
14
|
-
var marginR = function (value) { return ({
|
|
15
|
-
marginRight: canvasSpace[value],
|
|
16
|
-
}); };
|
|
17
|
-
var marginB = function (value) { return ({
|
|
18
|
-
marginBottom: canvasSpace[value],
|
|
19
|
-
}); };
|
|
20
|
-
var marginL = function (value) { return ({
|
|
21
|
-
marginLeft: canvasSpace[value],
|
|
22
|
-
}); };
|
|
23
|
-
var padding = function (value) { return ({ padding: canvasSpace[value] }); }; // || value });
|
|
24
|
-
var paddingX = function (value) { return ({
|
|
25
|
-
paddingLeft: canvasSpace[value],
|
|
26
|
-
paddingRight: canvasSpace[value],
|
|
27
|
-
}); };
|
|
28
|
-
var paddingY = function (value) { return ({
|
|
29
|
-
paddingBottom: canvasSpace[value],
|
|
30
|
-
paddingTop: canvasSpace[value],
|
|
31
|
-
}); };
|
|
32
|
-
var paddingT = function (value) { return ({
|
|
33
|
-
paddingTop: canvasSpace[value],
|
|
34
|
-
}); };
|
|
35
|
-
var paddingR = function (value) { return ({
|
|
36
|
-
paddingRight: canvasSpace[value],
|
|
37
|
-
}); };
|
|
38
|
-
var paddingB = function (value) { return ({
|
|
39
|
-
paddingBottom: canvasSpace[value],
|
|
40
|
-
}); };
|
|
41
|
-
var paddingL = function (value) { return ({
|
|
42
|
-
paddingLeft: canvasSpace[value],
|
|
43
|
-
}); };
|
|
44
|
-
export var space = {
|
|
45
|
-
margin: margin,
|
|
46
|
-
m: margin,
|
|
47
|
-
marginX: marginX,
|
|
48
|
-
mx: marginX,
|
|
49
|
-
marginY: marginY,
|
|
50
|
-
my: marginY,
|
|
51
|
-
marginT: marginT,
|
|
52
|
-
mt: marginT,
|
|
53
|
-
marginR: marginR,
|
|
54
|
-
mr: marginR,
|
|
55
|
-
marginB: marginB,
|
|
56
|
-
mb: marginB,
|
|
57
|
-
marginL: marginL,
|
|
58
|
-
ml: marginL,
|
|
59
|
-
padding: padding,
|
|
60
|
-
p: padding,
|
|
61
|
-
paddingX: paddingX,
|
|
62
|
-
px: paddingX,
|
|
63
|
-
paddingY: paddingY,
|
|
64
|
-
py: paddingY,
|
|
65
|
-
paddingT: paddingT,
|
|
66
|
-
pt: paddingT,
|
|
67
|
-
paddingR: paddingR,
|
|
68
|
-
pr: paddingR,
|
|
69
|
-
paddingB: paddingB,
|
|
70
|
-
pb: paddingB,
|
|
71
|
-
paddingL: paddingL,
|
|
72
|
-
pl: paddingL,
|
|
73
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import {jsx, css} from '@emotion/core';
|
|
4
|
-
import styled from '@emotion/styled';
|
|
5
|
-
|
|
6
|
-
import {space, SpaceProps} from './utils/space';
|
|
7
|
-
import {layout, LayoutProps} from './utils/layout';
|
|
8
|
-
import {safelySpreadProps} from './utils/safelySpreadProps';
|
|
9
|
-
|
|
10
|
-
const getBoxStyles = (props: BoxProps) => {
|
|
11
|
-
let styleProps = {};
|
|
12
|
-
for (const key in props) {
|
|
13
|
-
if (key in props) {
|
|
14
|
-
if (key in space) {
|
|
15
|
-
const value = props[key as keyof BoxProps];
|
|
16
|
-
const styleFn = space[key as keyof SpaceProps];
|
|
17
|
-
const styles = styleFn(value);
|
|
18
|
-
styleProps = {...styleProps, ...styles};
|
|
19
|
-
}
|
|
20
|
-
if (key in layout) {
|
|
21
|
-
const attr = layout[key as keyof LayoutProps];
|
|
22
|
-
styleProps = {...styleProps, [attr]: props[key as keyof BoxProps]};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return styleProps;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
type As = keyof JSX.IntrinsicElements;
|
|
30
|
-
|
|
31
|
-
export interface BoxProps extends SpaceProps, LayoutProps, React.HTMLAttributes<HTMLElement> {
|
|
32
|
-
as?: As;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export const StyledBox = styled('div')<BoxProps>({
|
|
36
|
-
boxSizing: 'border-box',
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export const Box = React.forwardRef<any, BoxProps>(({as = 'div', ...props}, ref) => {
|
|
40
|
-
// TODO: Memoize style props with React.useMemo
|
|
41
|
-
const boxStyles = getBoxStyles(props);
|
|
42
|
-
const safeProps = safelySpreadProps(props);
|
|
43
|
-
return <StyledBox ref={ref} as={as} css={css(boxStyles)} {...safeProps} />;
|
|
44
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import styled from '@emotion/styled';
|
|
2
|
-
|
|
3
|
-
import {flex, FlexProps as BaseFlexProps} from './utils/flex';
|
|
4
|
-
|
|
5
|
-
import {Box, BoxProps} from './Box';
|
|
6
|
-
|
|
7
|
-
export type FlexProps = BaseFlexProps & BoxProps;
|
|
8
|
-
|
|
9
|
-
const getFlexStyles = (props: FlexProps) => {
|
|
10
|
-
let flexProps = {};
|
|
11
|
-
|
|
12
|
-
for (const key in props) {
|
|
13
|
-
if (key in flex) {
|
|
14
|
-
const attr = flex[key as keyof BaseFlexProps];
|
|
15
|
-
flexProps = {...flexProps, [attr]: props[key as keyof FlexProps]};
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return flexProps;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const Flex = styled(Box)({display: 'flex'}, getFlexStyles);
|
|
22
|
-
|
|
23
|
-
Flex.displayName = 'Flex';
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
/** @jsx jsx */
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import {jsx, css} from '@emotion/core';
|
|
4
|
-
import {space as sp} from '@workday/canvas-kit-react/tokens';
|
|
5
|
-
|
|
6
|
-
import {Flex, FlexProps} from './Flex';
|
|
7
|
-
import {Spacing} from './utils/space';
|
|
8
|
-
import {getValidChildren} from './utils/getValidChildren';
|
|
9
|
-
import {useRTL} from './utils/useRTL';
|
|
10
|
-
|
|
11
|
-
type StackDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse';
|
|
12
|
-
|
|
13
|
-
export interface StackProps extends FlexProps {
|
|
14
|
-
children?: React.ReactNode;
|
|
15
|
-
direction: StackDirection;
|
|
16
|
-
flexDirection?: StackDirection;
|
|
17
|
-
spacing: Spacing;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const selector = '& > *:not(style) ~ *:not(style)';
|
|
21
|
-
|
|
22
|
-
type Options = {
|
|
23
|
-
spacing: Spacing;
|
|
24
|
-
direction: StackDirection;
|
|
25
|
-
shouldUseRTL: boolean;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
function getDirectionStyles(options: Options) {
|
|
29
|
-
const directionStyles = {
|
|
30
|
-
column: {marginTop: sp[options.spacing]},
|
|
31
|
-
'column-reverse': {marginBottom: sp[options.spacing]},
|
|
32
|
-
'row-reverse': options.shouldUseRTL
|
|
33
|
-
? {marginLeft: sp[options.spacing]}
|
|
34
|
-
: {marginRight: sp[options.spacing]},
|
|
35
|
-
row: options.shouldUseRTL
|
|
36
|
-
? {marginRight: sp[options.spacing]}
|
|
37
|
-
: {marginLeft: sp[options.spacing]},
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return directionStyles[options.direction];
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function getStackStyles(options: Options) {
|
|
44
|
-
const {direction} = options;
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
flexDirection: direction,
|
|
48
|
-
[selector]: getDirectionStyles(options),
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export const useStack = ({direction, shouldUseRTL, spacing}: Options) => {
|
|
53
|
-
return React.useMemo(() => getStackStyles({direction, shouldUseRTL, spacing}), [
|
|
54
|
-
direction,
|
|
55
|
-
spacing,
|
|
56
|
-
shouldUseRTL,
|
|
57
|
-
]);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const Stack = React.forwardRef(
|
|
61
|
-
({children, direction, spacing, ...elemProps}: StackProps, ref) => {
|
|
62
|
-
const validChildren = getValidChildren(children);
|
|
63
|
-
const {shouldUseRTL} = useRTL();
|
|
64
|
-
const stackStyles = useStack({direction, spacing, shouldUseRTL});
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<Flex css={css(stackStyles)} ref={ref} {...elemProps}>
|
|
68
|
-
{validChildren}
|
|
69
|
-
</Flex>
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
Stack.displayName = 'Stack';
|
|
75
|
-
|
|
76
|
-
export interface HStackProps extends Omit<StackProps, 'direction'> {
|
|
77
|
-
direction?: 'row' | 'row-reverse';
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export const HStack = React.forwardRef(
|
|
81
|
-
({direction = 'row', spacing, ...elemProps}: HStackProps, ref) => {
|
|
82
|
-
return <Stack ref={ref} direction={direction} spacing={spacing} {...elemProps} />;
|
|
83
|
-
}
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
HStack.displayName = 'HStack';
|
|
87
|
-
|
|
88
|
-
export interface VStackProps extends Omit<StackProps, 'direction'> {
|
|
89
|
-
direction?: 'column' | 'column-reverse';
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export const VStack = React.forwardRef(
|
|
93
|
-
({direction = 'column', spacing, ...elemProps}: VStackProps, ref) => {
|
|
94
|
-
return <Stack ref={ref} direction={direction} spacing={spacing} {...elemProps} />;
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
VStack.displayName = 'VStack';
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
// TODO: Consider using CSSType instead
|
|
2
|
-
type Globals = '-moz-initial' | 'inherit' | 'initial' | 'revert' | 'unset';
|
|
3
|
-
type GlobalsNumber = number | '-moz-initial' | 'inherit' | 'initial' | 'revert' | 'unset';
|
|
4
|
-
type SelfPosition =
|
|
5
|
-
| 'center'
|
|
6
|
-
| 'end'
|
|
7
|
-
| 'flex-end'
|
|
8
|
-
| 'flex-start'
|
|
9
|
-
| 'self-end'
|
|
10
|
-
| 'self-start'
|
|
11
|
-
| 'start';
|
|
12
|
-
type ContentDistribution = 'space-around' | 'space-between' | 'space-evenly' | 'stretch';
|
|
13
|
-
type ContentPosition = 'center' | 'end' | 'flex-end' | 'flex-start' | 'start';
|
|
14
|
-
type AlignItemsProperty = Globals | SelfPosition | 'baseline' | 'normal' | 'stretch';
|
|
15
|
-
type AlignContentProperty = Globals | ContentDistribution | ContentPosition | 'baseline' | 'normal';
|
|
16
|
-
type JustifyItemsProperty =
|
|
17
|
-
| Globals
|
|
18
|
-
| SelfPosition
|
|
19
|
-
| 'baseline'
|
|
20
|
-
| 'left'
|
|
21
|
-
| 'legacy'
|
|
22
|
-
| 'normal'
|
|
23
|
-
| 'right'
|
|
24
|
-
| 'stretch';
|
|
25
|
-
type JustifyContentProperty =
|
|
26
|
-
| Globals
|
|
27
|
-
| ContentDistribution
|
|
28
|
-
| ContentPosition
|
|
29
|
-
| 'left'
|
|
30
|
-
| 'normal'
|
|
31
|
-
| 'right';
|
|
32
|
-
type FlexWrapProperty =
|
|
33
|
-
| '-moz-initial'
|
|
34
|
-
| 'inherit'
|
|
35
|
-
| 'initial'
|
|
36
|
-
| 'revert'
|
|
37
|
-
| 'unset'
|
|
38
|
-
| 'nowrap'
|
|
39
|
-
| 'wrap'
|
|
40
|
-
| 'wrap-reverse';
|
|
41
|
-
|
|
42
|
-
type FlexDirectionProperty =
|
|
43
|
-
| '-moz-initial'
|
|
44
|
-
| 'inherit'
|
|
45
|
-
| 'initial'
|
|
46
|
-
| 'revert'
|
|
47
|
-
| 'unset'
|
|
48
|
-
| 'column'
|
|
49
|
-
| 'column-reverse'
|
|
50
|
-
| 'row'
|
|
51
|
-
| 'row-reverse';
|
|
52
|
-
type JustifySelfProperty =
|
|
53
|
-
| Globals
|
|
54
|
-
| SelfPosition
|
|
55
|
-
| 'auto'
|
|
56
|
-
| 'baseline'
|
|
57
|
-
| 'left'
|
|
58
|
-
| 'normal'
|
|
59
|
-
| 'right'
|
|
60
|
-
| 'stretch'
|
|
61
|
-
| 'auto'
|
|
62
|
-
| 'baseline'
|
|
63
|
-
| 'left'
|
|
64
|
-
| 'normal'
|
|
65
|
-
| 'right'
|
|
66
|
-
| 'stretch';
|
|
67
|
-
type AlignSelfProperty = Globals | SelfPosition | 'auto' | 'baseline' | 'normal' | 'stretch';
|
|
68
|
-
export interface FlexProps {
|
|
69
|
-
alignItems?: AlignItemsProperty;
|
|
70
|
-
alignContent?: AlignContentProperty;
|
|
71
|
-
display?: 'flex' | 'inline-flex';
|
|
72
|
-
justifyItems?: JustifyItemsProperty;
|
|
73
|
-
justifyContent?: JustifyContentProperty;
|
|
74
|
-
flexWrap?: FlexWrapProperty;
|
|
75
|
-
wrap?: FlexWrapProperty; // a helpful alias for flexWrap
|
|
76
|
-
flexDirection?: FlexDirectionProperty;
|
|
77
|
-
direction?: FlexDirectionProperty; // a helpful alias for flexDirection
|
|
78
|
-
flex?: number | string;
|
|
79
|
-
flexGrow?: number | string;
|
|
80
|
-
grow?: number | string; // a helpful alias for flexGrow
|
|
81
|
-
flexShrink?: number | string;
|
|
82
|
-
shrink?: number | string; // a helpful alias for flexShrink
|
|
83
|
-
flexBasis?: number | string;
|
|
84
|
-
basis?: number | string; // a helpful alias for flexBasis
|
|
85
|
-
justifySelf?: JustifySelfProperty;
|
|
86
|
-
alignSelf?: AlignSelfProperty;
|
|
87
|
-
order?: GlobalsNumber;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export const flex = {
|
|
91
|
-
alignItems: 'alignItems',
|
|
92
|
-
alignContent: 'alignContent',
|
|
93
|
-
display: 'display',
|
|
94
|
-
justifyItems: 'justifyItems',
|
|
95
|
-
justifyContent: 'justifyContent',
|
|
96
|
-
flexWrap: 'flexWrap',
|
|
97
|
-
wrap: 'flexWrap',
|
|
98
|
-
flexDirection: 'flexDirection',
|
|
99
|
-
direction: 'flexDirection',
|
|
100
|
-
flex: 'flex',
|
|
101
|
-
flexGrow: 'flexGrow',
|
|
102
|
-
grow: 'flexGrow',
|
|
103
|
-
flexShrink: 'flexShrink',
|
|
104
|
-
shrink: 'flexShrink',
|
|
105
|
-
flexBasis: 'flexBasis',
|
|
106
|
-
basis: 'basis',
|
|
107
|
-
justifySelf: 'justifySelf',
|
|
108
|
-
alignSelf: 'alignSelf',
|
|
109
|
-
order: 'order',
|
|
110
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
type Globals = '-moz-initial' | 'inherit' | 'initial' | 'revert' | 'unset';
|
|
2
|
-
type OverflowProperty = Globals | 'auto' | 'hidden' | 'scroll' | 'visible' | string;
|
|
3
|
-
type OverflowXProperty =
|
|
4
|
-
| '-moz-initial'
|
|
5
|
-
| 'inherit'
|
|
6
|
-
| 'initial'
|
|
7
|
-
| 'revert'
|
|
8
|
-
| 'unset'
|
|
9
|
-
| 'auto'
|
|
10
|
-
| 'hidden'
|
|
11
|
-
| 'scroll'
|
|
12
|
-
| 'visible';
|
|
13
|
-
type OverflowYProperty = OverflowXProperty;
|
|
14
|
-
export interface LayoutProps {
|
|
15
|
-
display?: string;
|
|
16
|
-
height?: number | string;
|
|
17
|
-
maxHeight?: number | string;
|
|
18
|
-
maxWidth?: number | string;
|
|
19
|
-
minHeight?: number | string;
|
|
20
|
-
minWidth?: number | string;
|
|
21
|
-
overflow?: OverflowProperty;
|
|
22
|
-
overflowX?: OverflowXProperty;
|
|
23
|
-
overflowY?: OverflowYProperty;
|
|
24
|
-
verticalAlign?: string;
|
|
25
|
-
width?: number | string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const layout = {
|
|
29
|
-
display: 'display',
|
|
30
|
-
height: 'height',
|
|
31
|
-
maxHeight: 'maxHeight',
|
|
32
|
-
maxWidth: 'maxWidth',
|
|
33
|
-
minHeight: 'minHeight',
|
|
34
|
-
minWidth: 'minWidth',
|
|
35
|
-
overflow: 'overflow',
|
|
36
|
-
overflowX: 'overflowX',
|
|
37
|
-
overflowY: 'overflowY',
|
|
38
|
-
verticalAlign: 'verticalAlign',
|
|
39
|
-
width: 'width',
|
|
40
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import {flex} from './flex';
|
|
2
|
-
import {layout} from './layout';
|
|
3
|
-
import {space} from './space';
|
|
4
|
-
|
|
5
|
-
const styleProps = {
|
|
6
|
-
...flex,
|
|
7
|
-
...layout,
|
|
8
|
-
...space,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Removes style props from props to prevent them from being applied to the HTML element.
|
|
13
|
-
* Returns an object of props that is stripped of all style props.
|
|
14
|
-
* @example
|
|
15
|
-
* const Box = (props) => {
|
|
16
|
-
* const safeProps = safelySpreadProps(props);
|
|
17
|
-
* return <div {...safeProps} />
|
|
18
|
-
* }
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
export function safelySpreadProps<T extends object>(props: T) {
|
|
22
|
-
const safeProps = {} as T;
|
|
23
|
-
for (const key in props) {
|
|
24
|
-
if (!(key in styleProps)) {
|
|
25
|
-
safeProps[key as keyof T] = props[key as keyof T];
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return safeProps;
|
|
29
|
-
}
|