@workday/canvas-kit-react 8.0.0-alpha.208-next.1 → 8.0.0-alpha.222-next.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/lib/theming/index.ts +1 -1
- package/common/lib/theming/styled.ts +6 -3
- package/common/lib/utils/elements.ts +4 -4
- package/common/lib/utils/index.ts +0 -1
- package/dist/commonjs/card/lib/Card.d.ts +1 -1
- package/dist/commonjs/card/lib/CardBody.d.ts +1 -1
- package/dist/commonjs/card/lib/CardBody.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/index.d.ts +1 -1
- package/dist/commonjs/common/lib/theming/index.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/styled.d.ts +2 -0
- package/dist/commonjs/common/lib/theming/styled.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/styled.js +1 -2
- package/dist/commonjs/common/lib/utils/elements.d.ts +1 -1
- package/dist/commonjs/common/lib/utils/elements.d.ts.map +1 -1
- package/dist/commonjs/common/lib/utils/elements.js +3 -3
- package/dist/commonjs/common/lib/utils/index.d.ts +0 -1
- package/dist/commonjs/common/lib/utils/index.d.ts.map +1 -1
- package/dist/commonjs/common/lib/utils/index.js +0 -1
- package/dist/commonjs/dialog/lib/Dialog.d.ts +1 -1
- package/dist/commonjs/icon/lib/SystemIcon.d.ts +1 -1
- package/dist/commonjs/icon/lib/SystemIcon.d.ts.map +1 -1
- package/dist/commonjs/index.d.ts +1 -0
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +1 -0
- package/dist/commonjs/layout/index.d.ts +8 -4
- package/dist/commonjs/layout/index.d.ts.map +1 -1
- package/dist/commonjs/layout/index.js +10 -2
- package/dist/commonjs/layout/lib/Box.d.ts +6 -4
- package/dist/commonjs/layout/lib/Box.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/Box.js +8 -9
- package/dist/commonjs/layout/lib/Flex.d.ts +5 -2
- package/dist/commonjs/layout/lib/Flex.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/Flex.js +5 -1
- package/dist/commonjs/layout/lib/Grid.d.ts +5 -6
- package/dist/commonjs/layout/lib/Grid.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/Grid.js +2 -2
- package/dist/commonjs/layout/lib/Stack.d.ts +4 -4
- package/dist/commonjs/layout/lib/utils/background.d.ts +44 -0
- package/dist/commonjs/layout/lib/utils/background.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/background.js +57 -0
- package/dist/commonjs/layout/lib/utils/border/color.d.ts +47 -0
- package/dist/commonjs/layout/lib/utils/border/color.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/border/color.js +42 -0
- package/dist/commonjs/layout/lib/utils/border/index.d.ts +26 -0
- package/dist/commonjs/layout/lib/utils/border/index.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/border/index.js +46 -0
- package/dist/commonjs/layout/lib/utils/border/lineStyle.d.ts +38 -0
- package/dist/commonjs/layout/lib/utils/border/lineStyle.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/border/lineStyle.js +52 -0
- package/dist/commonjs/layout/lib/utils/border/radius.d.ts +33 -0
- package/dist/commonjs/layout/lib/utils/border/radius.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/border/radius.js +32 -0
- package/dist/commonjs/layout/lib/utils/border/shorthand.d.ts +34 -0
- package/dist/commonjs/layout/lib/utils/border/shorthand.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/border/shorthand.js +42 -0
- package/dist/commonjs/layout/lib/utils/border/width.d.ts +34 -0
- package/dist/commonjs/layout/lib/utils/border/width.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/border/width.js +42 -0
- package/dist/commonjs/layout/lib/utils/buildStyleFns.d.ts +12 -0
- package/dist/commonjs/layout/lib/utils/buildStyleFns.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/buildStyleFns.js +90 -0
- package/dist/commonjs/layout/lib/utils/color.d.ts +23 -16
- package/dist/commonjs/layout/lib/utils/color.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/color.js +25 -49
- package/dist/commonjs/layout/lib/utils/depth.d.ts +17 -11
- package/dist/commonjs/layout/lib/utils/depth.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/depth.js +20 -20
- package/dist/commonjs/layout/lib/utils/flex.d.ts +31 -12
- package/dist/commonjs/layout/lib/utils/flex.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/flex.js +58 -25
- package/dist/commonjs/layout/lib/utils/flexItem.d.ts +18 -15
- package/dist/commonjs/layout/lib/utils/flexItem.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/flexItem.js +43 -26
- package/dist/commonjs/layout/lib/utils/grid.d.ts +40 -35
- package/dist/commonjs/layout/lib/utils/grid.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/grid.js +99 -72
- package/dist/commonjs/layout/lib/utils/gridItem.d.ts +17 -14
- package/dist/commonjs/layout/lib/utils/gridItem.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/gridItem.js +58 -30
- package/dist/commonjs/layout/lib/utils/layout.d.ts +47 -25
- package/dist/commonjs/layout/lib/utils/layout.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/layout.js +71 -33
- package/dist/commonjs/layout/lib/utils/other.d.ts +44 -2
- package/dist/commonjs/layout/lib/utils/other.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/other.js +101 -17
- package/dist/commonjs/layout/lib/utils/position.d.ts +37 -20
- package/dist/commonjs/layout/lib/utils/position.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/position.js +49 -66
- package/dist/commonjs/layout/lib/utils/space.d.ts +107 -51
- package/dist/commonjs/layout/lib/utils/space.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/space.js +98 -148
- package/dist/commonjs/layout/lib/utils/stack.d.ts +3 -6
- package/dist/commonjs/layout/lib/utils/stack.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/stack.js +13 -39
- package/dist/commonjs/layout/lib/utils/systemProps.d.ts +31 -0
- package/dist/commonjs/layout/lib/utils/systemProps.d.ts.map +1 -0
- package/dist/commonjs/layout/lib/utils/systemProps.js +2 -0
- package/dist/commonjs/layout/lib/utils/text.d.ts +33 -15
- package/dist/commonjs/layout/lib/utils/text.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/utils/text.js +74 -38
- package/dist/commonjs/modal/lib/Modal.d.ts +1 -1
- package/dist/commonjs/popup/lib/Popup.d.ts +1 -1
- package/dist/commonjs/popup/lib/PopupBody.d.ts +1 -1
- package/dist/commonjs/popup/lib/hooks/useReturnFocus.d.ts.map +1 -1
- package/dist/commonjs/popup/lib/hooks/useReturnFocus.js +72 -7
- package/dist/commonjs/tabs/lib/TabsItem.d.ts +1 -1
- package/dist/commonjs/testing/index.d.ts +5 -0
- package/dist/commonjs/testing/index.d.ts.map +1 -0
- package/dist/commonjs/testing/index.js +16 -0
- package/dist/commonjs/testing/lib/ComponentStatesTable.d.ts +26 -0
- package/dist/commonjs/testing/lib/ComponentStatesTable.d.ts.map +1 -0
- package/dist/commonjs/testing/lib/ComponentStatesTable.js +48 -0
- package/dist/commonjs/testing/lib/StaticStates.d.ts +7 -0
- package/dist/commonjs/testing/lib/StaticStates.d.ts.map +1 -0
- package/dist/commonjs/{common/lib/utils → testing/lib}/StaticStates.js +1 -1
- package/dist/commonjs/testing/lib/permutateProps.d.ts +5 -0
- package/dist/commonjs/testing/lib/permutateProps.d.ts.map +1 -0
- package/dist/commonjs/testing/lib/permutateProps.js +47 -0
- package/dist/commonjs/testing/lib/propTypes.d.ts +15 -0
- package/dist/commonjs/testing/lib/propTypes.d.ts.map +1 -0
- package/dist/commonjs/testing/lib/propTypes.js +2 -0
- package/dist/commonjs/tokens/lib/colors.types.d.ts +4 -6
- package/dist/commonjs/tokens/lib/colors.types.d.ts.map +1 -1
- package/dist/es6/card/lib/Card.d.ts +1 -1
- package/dist/es6/card/lib/CardBody.d.ts +1 -1
- package/dist/es6/card/lib/CardBody.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/index.d.ts +1 -1
- package/dist/es6/common/lib/theming/index.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/styled.d.ts +2 -0
- package/dist/es6/common/lib/theming/styled.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/styled.js +1 -2
- package/dist/es6/common/lib/utils/elements.d.ts +1 -1
- package/dist/es6/common/lib/utils/elements.d.ts.map +1 -1
- package/dist/es6/common/lib/utils/elements.js +3 -3
- package/dist/es6/common/lib/utils/index.d.ts +0 -1
- package/dist/es6/common/lib/utils/index.d.ts.map +1 -1
- package/dist/es6/common/lib/utils/index.js +0 -1
- package/dist/es6/dialog/lib/Dialog.d.ts +1 -1
- package/dist/es6/icon/lib/SystemIcon.d.ts +1 -1
- package/dist/es6/icon/lib/SystemIcon.d.ts.map +1 -1
- package/dist/es6/index.d.ts +1 -0
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +1 -0
- package/dist/es6/layout/index.d.ts +8 -4
- package/dist/es6/layout/index.d.ts.map +1 -1
- package/dist/es6/layout/index.js +7 -1
- package/dist/es6/layout/lib/Box.d.ts +6 -4
- package/dist/es6/layout/lib/Box.d.ts.map +1 -1
- package/dist/es6/layout/lib/Box.js +8 -9
- package/dist/es6/layout/lib/Flex.d.ts +5 -2
- package/dist/es6/layout/lib/Flex.d.ts.map +1 -1
- package/dist/es6/layout/lib/Flex.js +5 -1
- package/dist/es6/layout/lib/Grid.d.ts +5 -6
- package/dist/es6/layout/lib/Grid.d.ts.map +1 -1
- package/dist/es6/layout/lib/Grid.js +2 -2
- package/dist/es6/layout/lib/Stack.d.ts +4 -4
- package/dist/es6/layout/lib/utils/background.d.ts +44 -0
- package/dist/es6/layout/lib/utils/background.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/background.js +54 -0
- package/dist/es6/layout/lib/utils/border/color.d.ts +47 -0
- package/dist/es6/layout/lib/utils/border/color.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/border/color.js +39 -0
- package/dist/es6/layout/lib/utils/border/index.d.ts +26 -0
- package/dist/es6/layout/lib/utils/border/index.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/border/index.js +43 -0
- package/dist/es6/layout/lib/utils/border/lineStyle.d.ts +38 -0
- package/dist/es6/layout/lib/utils/border/lineStyle.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/border/lineStyle.js +49 -0
- package/dist/es6/layout/lib/utils/border/radius.d.ts +33 -0
- package/dist/es6/layout/lib/utils/border/radius.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/border/radius.js +29 -0
- package/dist/es6/layout/lib/utils/border/shorthand.d.ts +34 -0
- package/dist/es6/layout/lib/utils/border/shorthand.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/border/shorthand.js +39 -0
- package/dist/es6/layout/lib/utils/border/width.d.ts +34 -0
- package/dist/es6/layout/lib/utils/border/width.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/border/width.js +39 -0
- package/dist/es6/layout/lib/utils/buildStyleFns.d.ts +12 -0
- package/dist/es6/layout/lib/utils/buildStyleFns.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/buildStyleFns.js +85 -0
- package/dist/es6/layout/lib/utils/color.d.ts +23 -16
- package/dist/es6/layout/lib/utils/color.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/color.js +24 -47
- package/dist/es6/layout/lib/utils/depth.d.ts +17 -11
- package/dist/es6/layout/lib/utils/depth.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/depth.js +19 -18
- package/dist/es6/layout/lib/utils/flex.d.ts +31 -12
- package/dist/es6/layout/lib/utils/flex.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/flex.js +57 -23
- package/dist/es6/layout/lib/utils/flexItem.d.ts +18 -15
- package/dist/es6/layout/lib/utils/flexItem.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/flexItem.js +42 -24
- package/dist/es6/layout/lib/utils/grid.d.ts +40 -35
- package/dist/es6/layout/lib/utils/grid.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/grid.js +98 -70
- package/dist/es6/layout/lib/utils/gridItem.d.ts +17 -14
- package/dist/es6/layout/lib/utils/gridItem.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/gridItem.js +57 -28
- package/dist/es6/layout/lib/utils/layout.d.ts +47 -25
- package/dist/es6/layout/lib/utils/layout.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/layout.js +70 -31
- package/dist/es6/layout/lib/utils/other.d.ts +44 -2
- package/dist/es6/layout/lib/utils/other.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/other.js +100 -15
- package/dist/es6/layout/lib/utils/position.d.ts +37 -20
- package/dist/es6/layout/lib/utils/position.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/position.js +48 -64
- package/dist/es6/layout/lib/utils/space.d.ts +107 -51
- package/dist/es6/layout/lib/utils/space.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/space.js +97 -146
- package/dist/es6/layout/lib/utils/stack.d.ts +3 -6
- package/dist/es6/layout/lib/utils/stack.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/stack.js +13 -39
- package/dist/es6/layout/lib/utils/systemProps.d.ts +31 -0
- package/dist/es6/layout/lib/utils/systemProps.d.ts.map +1 -0
- package/dist/es6/layout/lib/utils/systemProps.js +1 -0
- package/dist/es6/layout/lib/utils/text.d.ts +33 -15
- package/dist/es6/layout/lib/utils/text.d.ts.map +1 -1
- package/dist/es6/layout/lib/utils/text.js +73 -36
- package/dist/es6/modal/lib/Modal.d.ts +1 -1
- package/dist/es6/popup/lib/Popup.d.ts +1 -1
- package/dist/es6/popup/lib/PopupBody.d.ts +1 -1
- package/dist/es6/popup/lib/hooks/useReturnFocus.d.ts.map +1 -1
- package/dist/es6/popup/lib/hooks/useReturnFocus.js +73 -8
- package/dist/es6/tabs/lib/TabsItem.d.ts +1 -1
- package/dist/es6/testing/index.d.ts +5 -0
- package/dist/es6/testing/index.d.ts.map +1 -0
- package/dist/es6/testing/index.js +4 -0
- package/dist/es6/testing/lib/ComponentStatesTable.d.ts +26 -0
- package/dist/es6/testing/lib/ComponentStatesTable.d.ts.map +1 -0
- package/dist/es6/testing/lib/ComponentStatesTable.js +41 -0
- package/dist/es6/testing/lib/StaticStates.d.ts +7 -0
- package/dist/es6/testing/lib/StaticStates.d.ts.map +1 -0
- package/dist/es6/{common/lib/utils → testing/lib}/StaticStates.js +1 -1
- package/dist/es6/testing/lib/permutateProps.d.ts +5 -0
- package/dist/es6/testing/lib/permutateProps.d.ts.map +1 -0
- package/dist/es6/testing/lib/permutateProps.js +43 -0
- package/dist/es6/testing/lib/propTypes.d.ts +15 -0
- package/dist/es6/testing/lib/propTypes.d.ts.map +1 -0
- package/dist/es6/testing/lib/propTypes.js +1 -0
- package/dist/es6/tokens/lib/colors.types.d.ts +4 -6
- package/dist/es6/tokens/lib/colors.types.d.ts.map +1 -1
- package/icon/lib/SystemIcon.tsx +1 -1
- package/index.ts +1 -0
- package/layout/index.ts +8 -4
- package/layout/lib/Box.tsx +10 -36
- package/layout/lib/Flex.tsx +5 -1
- package/layout/lib/Grid.tsx +3 -4
- package/layout/lib/utils/background.ts +83 -0
- package/layout/lib/utils/border/color.ts +85 -0
- package/layout/lib/utils/border/index.ts +49 -0
- package/layout/lib/utils/border/lineStyle.ts +87 -0
- package/layout/lib/utils/border/radius.ts +61 -0
- package/layout/lib/utils/border/shorthand.ts +73 -0
- package/layout/lib/utils/border/width.ts +73 -0
- package/layout/lib/utils/buildStyleFns.ts +117 -0
- package/layout/lib/utils/color.ts +40 -55
- package/layout/lib/utils/depth.ts +28 -24
- package/layout/lib/utils/flex.ts +83 -32
- package/layout/lib/utils/flexItem.ts +54 -36
- package/layout/lib/utils/grid.ts +131 -94
- package/layout/lib/utils/gridItem.ts +69 -41
- package/layout/lib/utils/layout.ts +109 -50
- package/layout/lib/utils/other.ts +142 -15
- package/layout/lib/utils/position.ts +79 -73
- package/layout/lib/utils/space.ts +202 -196
- package/layout/lib/utils/stack.ts +19 -45
- package/layout/lib/utils/systemProps.ts +46 -0
- package/layout/lib/utils/text.ts +99 -34
- package/package.json +3 -3
- package/popup/lib/hooks/useReturnFocus.tsx +83 -9
- package/testing/LICENSE +52 -0
- package/testing/README.md +6 -0
- package/testing/index.ts +4 -0
- package/testing/lib/ComponentStatesTable.tsx +80 -0
- package/{common/lib/utils → testing/lib}/StaticStates.tsx +5 -4
- package/testing/lib/permutateProps.ts +47 -0
- package/testing/lib/propTypes.ts +15 -0
- package/testing/package.json +6 -0
- package/tokens/lib/colors.types.ts +4 -7
- package/dist/commonjs/common/lib/utils/StaticStates.d.ts +0 -8
- package/dist/commonjs/common/lib/utils/StaticStates.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/utils/border.d.ts +0 -103
- package/dist/commonjs/layout/lib/utils/border.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/utils/border.js +0 -153
- package/dist/commonjs/layout/lib/utils/font.d.ts +0 -29
- package/dist/commonjs/layout/lib/utils/font.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/utils/font.js +0 -57
- package/dist/es6/common/lib/utils/StaticStates.d.ts +0 -8
- package/dist/es6/common/lib/utils/StaticStates.d.ts.map +0 -1
- package/dist/es6/layout/lib/utils/border.d.ts +0 -103
- package/dist/es6/layout/lib/utils/border.d.ts.map +0 -1
- package/dist/es6/layout/lib/utils/border.js +0 -149
- package/dist/es6/layout/lib/utils/font.d.ts +0 -29
- package/dist/es6/layout/lib/utils/font.d.ts.map +0 -1
- package/dist/es6/layout/lib/utils/font.js +0 -53
- package/layout/lib/utils/border.ts +0 -263
- package/layout/lib/utils/font.ts +0 -67
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"font.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/font.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACjC,OAAO,EAAO,oBAAoB,EAAC,MAAM,kCAAkC,CAAC;AAE5E,oBAAY,gBAAgB,GAAG,MAAM,oBAAoB,CAAC,cAAc,CAAC,CAAC;AAC1E,oBAAY,cAAc,GAAG,MAAM,oBAAoB,CAAC,WAAW,CAAC,CAAC;AACrE,oBAAY,gBAAgB,GAAG,MAAM,oBAAoB,CAAC,aAAa,CAAC,CAAC;AAGzE,0CAA0C;AAC1C,oBAAY,cAAc,GAAG;IAC3B,kCAAkC;IAClC,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,GAAG,gBAAgB,CAAC;IACpD,gCAAgC;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,GAAG,cAAc,CAAC;IAC9C,iCAAiC;IACjC,SAAS,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC;IAC/B,kCAAkC;IAClC,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,GAAG,gBAAgB,CAAC;CACrD,CAAC;AAyBF;;;;;;;;;;GAUG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,CAAC,MAYtD"}
|
|
@@ -1,53 +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 { type } from '@workday/canvas-kit-react/tokens';
|
|
13
|
-
var getFontFamily = function (value) { return ({
|
|
14
|
-
fontFamily: type.properties.fontFamilies[value] || value,
|
|
15
|
-
}); };
|
|
16
|
-
var getFontSize = function (value) { return ({
|
|
17
|
-
fontSize: type.properties.fontSizes[value] || value,
|
|
18
|
-
}); };
|
|
19
|
-
var getFontStyle = function (value) { return ({
|
|
20
|
-
fontStyle: value,
|
|
21
|
-
}); };
|
|
22
|
-
var getFontWeight = function (value) { return ({
|
|
23
|
-
fontWeight: type.properties.fontWeights[value] || value,
|
|
24
|
-
}); };
|
|
25
|
-
var fontProps = {
|
|
26
|
-
fontFamily: getFontFamily,
|
|
27
|
-
fontSize: getFontSize,
|
|
28
|
-
fontWeight: getFontWeight,
|
|
29
|
-
fontStyle: getFontStyle,
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* A style prop function that takes components props and returns font styles from canvas token values.
|
|
33
|
-
* If no `FontStyleProps` are found, it returns an empty object.
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* // You'll most likely use `font` with low-level, styled components
|
|
37
|
-
* const BoxExample = () => (
|
|
38
|
-
* <Box fontFamily="monospace" fontWeight="medium">Hello, fonts!</Box>
|
|
39
|
-
* );
|
|
40
|
-
*
|
|
41
|
-
*/
|
|
42
|
-
export function font(props) {
|
|
43
|
-
var styles = {};
|
|
44
|
-
for (var key in props) {
|
|
45
|
-
if (key in fontProps) {
|
|
46
|
-
var value = props[key];
|
|
47
|
-
var fontFn = fontProps[key];
|
|
48
|
-
var style = fontFn(value);
|
|
49
|
-
styles = __assign(__assign({}, styles), style);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return styles;
|
|
53
|
-
}
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
borderRadius as borderRadiusTokens,
|
|
3
|
-
CanvasBorderRadiusKeys,
|
|
4
|
-
colors as colorTokens,
|
|
5
|
-
CanvasColor,
|
|
6
|
-
} from '@workday/canvas-kit-react/tokens';
|
|
7
|
-
import {
|
|
8
|
-
ContentDirection,
|
|
9
|
-
PartialEmotionCanvasTheme,
|
|
10
|
-
useTheme,
|
|
11
|
-
} from '@workday/canvas-kit-react/common';
|
|
12
|
-
|
|
13
|
-
import {Property} from 'csstype';
|
|
14
|
-
|
|
15
|
-
/** style props to set the border properties */
|
|
16
|
-
export type BorderShorthandStyleProps = {
|
|
17
|
-
/** sets `border` property */
|
|
18
|
-
border?: string;
|
|
19
|
-
/** sets `border-top` property */
|
|
20
|
-
borderTop?: string;
|
|
21
|
-
/** sets `border-right` property (no bidirectional support) */
|
|
22
|
-
borderRight?: string;
|
|
23
|
-
/** sets `border-bottom` property */
|
|
24
|
-
borderBottom?: string;
|
|
25
|
-
/** sets `border-left` property (no bidirectional support) */
|
|
26
|
-
borderLeft?: string;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/** style props to set the border color properties */
|
|
30
|
-
export type BorderColorStyleProps = {
|
|
31
|
-
/** sets `border-color` property */
|
|
32
|
-
borderColor?: CanvasColor | (string & {});
|
|
33
|
-
/** sets `border-top-color` property */
|
|
34
|
-
borderTopColor?: CanvasColor | (string & {});
|
|
35
|
-
/** sets `border-right-color` property (no bidirectional support) */
|
|
36
|
-
borderRightColor?: CanvasColor | (string & {});
|
|
37
|
-
/** sets `border-bottom-color` property */
|
|
38
|
-
borderBottomColor?: CanvasColor | (string & {});
|
|
39
|
-
/** sets `border-left-color` property (no bidirectional support) */
|
|
40
|
-
borderLeftColor?: CanvasColor | (string & {});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/** style props to set the border radius properties */
|
|
44
|
-
export type BorderRadiusStyleProps = {
|
|
45
|
-
/** sets `border-radius` property */
|
|
46
|
-
borderRadius?: CanvasBorderRadiusKeys | number | (string & {});
|
|
47
|
-
/** sets `border-top-left-radius` property */
|
|
48
|
-
borderTopLeftRadius?: CanvasBorderRadiusKeys | number | (string & {});
|
|
49
|
-
/** sets `border-top-right-radius` property */
|
|
50
|
-
borderTopRightRadius?: CanvasBorderRadiusKeys | number | (string & {});
|
|
51
|
-
/** sets `border-bottom-left-radius` property */
|
|
52
|
-
borderBottomLeftRadius?: CanvasBorderRadiusKeys | number | (string & {});
|
|
53
|
-
/** sets `border-bottom-right-radius` property */
|
|
54
|
-
borderBottomRightRadius?: CanvasBorderRadiusKeys | number | (string & {});
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/** style props to set the border style properties */
|
|
58
|
-
export type BorderLineStyleProps = {
|
|
59
|
-
/** sets `border-style` property */
|
|
60
|
-
borderStyle?: Property.Border;
|
|
61
|
-
/** sets `border-top-style` property */
|
|
62
|
-
borderTopStyle?: Property.Border;
|
|
63
|
-
/** sets `border-right-style` property (no bidirectional support) */
|
|
64
|
-
borderRightStyle?: Property.Border;
|
|
65
|
-
/** sets `border-bottom-style` property */
|
|
66
|
-
borderBottomStyle?: Property.Border;
|
|
67
|
-
/** sets `border-left-style` property (no bidirectional support) */
|
|
68
|
-
borderLeftStyle?: Property.Border;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
/** style props to set the border width properties */
|
|
72
|
-
export type BorderWidthStyleProps = {
|
|
73
|
-
/** sets `border-width` property */
|
|
74
|
-
borderWidth?: string | number;
|
|
75
|
-
/** sets `border-top-width` property */
|
|
76
|
-
borderTopWidth?: string | number;
|
|
77
|
-
/** sets `border-right-width` property (no bidirectional support) */
|
|
78
|
-
borderRightWidth?: string | number;
|
|
79
|
-
/** sets `border-bottom-width` property */
|
|
80
|
-
borderBottomWidth?: string | number;
|
|
81
|
-
/** sets `border-left-width` property (no bidirectional support) */
|
|
82
|
-
borderLeftWidth?: string | number;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export type BorderLogicalStyleProps = {
|
|
86
|
-
/** sets `border-left` property (bidirectional support) */
|
|
87
|
-
borderInlineStart?: string;
|
|
88
|
-
/** sets `border-left-color` property (bidirectional support) */
|
|
89
|
-
borderInlineStartColor?: CanvasColor | (string & {});
|
|
90
|
-
/** sets `border-left-style` property (bidirectional support) */
|
|
91
|
-
borderInlineStartStyle?: Property.Border;
|
|
92
|
-
/** sets `border-left-width` property (bidirectional support) */
|
|
93
|
-
borderInlineStartWidth?: string | number;
|
|
94
|
-
/** sets `border-right` property (bidirectional support) */
|
|
95
|
-
borderInlineEnd?: string;
|
|
96
|
-
/** sets `border-right-color` property (bidirectional support) */
|
|
97
|
-
borderInlineEndColor?: CanvasColor | (string & {});
|
|
98
|
-
/** sets `border-right-style` property (bidirectional support) */
|
|
99
|
-
borderInlineEndStyle?: Property.Border;
|
|
100
|
-
/** sets `border-right-width` property (bidirectional support) */
|
|
101
|
-
borderInlineEndWidth?: string | number;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
/** a collection style props for border properties */
|
|
105
|
-
export type BorderStyleProps = BorderShorthandStyleProps &
|
|
106
|
-
BorderColorStyleProps &
|
|
107
|
-
BorderRadiusStyleProps &
|
|
108
|
-
BorderLineStyleProps &
|
|
109
|
-
BorderWidthStyleProps &
|
|
110
|
-
BorderLogicalStyleProps;
|
|
111
|
-
|
|
112
|
-
// border logical prop handlers
|
|
113
|
-
const borderInlineStart = (isRTL: boolean) => (isRTL ? 'borderRight' : 'borderLeft');
|
|
114
|
-
const borderInlineEnd = (isRTL: boolean) => (isRTL ? 'borderLeft' : 'borderRight');
|
|
115
|
-
const borderInlineStartColor = (isRTL: boolean) => (isRTL ? 'borderRightColor' : 'borderLeftColor');
|
|
116
|
-
const borderInlineEndColor = (isRTL: boolean) => (isRTL ? 'borderLeftColor' : 'borderRightColor');
|
|
117
|
-
const borderInlineStartStyle = (isRTL: boolean) => (isRTL ? 'borderRightStyle' : 'borderLeftStyle');
|
|
118
|
-
const borderInlineEndStyle = (isRTL: boolean) => (isRTL ? 'borderLeftStyle' : 'borderRightStyle');
|
|
119
|
-
const borderInlineStartWidth = (isRTL: boolean) => (isRTL ? 'borderRightWidth' : 'borderLeftWidth');
|
|
120
|
-
const borderInlineEndWidth = (isRTL: boolean) => (isRTL ? 'borderLeftWidth' : 'borderRightWidth');
|
|
121
|
-
|
|
122
|
-
const borderShorthandProps = {
|
|
123
|
-
border: 'border',
|
|
124
|
-
borderTop: 'borderTop',
|
|
125
|
-
borderRight: 'borderRight',
|
|
126
|
-
borderBottom: 'borderBottom',
|
|
127
|
-
borderLeft: 'borderLeft',
|
|
128
|
-
borderInlineStart,
|
|
129
|
-
borderInlineEnd,
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const borderColors = {
|
|
133
|
-
borderColor: 'borderColor',
|
|
134
|
-
borderTopColor: 'borderTopColor',
|
|
135
|
-
borderRightColor: 'borderRightColor',
|
|
136
|
-
borderBottomColor: 'borderBottomColor',
|
|
137
|
-
borderLeftColor: 'borderLeftColor',
|
|
138
|
-
borderInlineStartColor,
|
|
139
|
-
borderInlineEndColor,
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const borderRadii = {
|
|
143
|
-
borderRadius: 'borderRadius',
|
|
144
|
-
borderTopLeftRadius: 'borderTopLeftRadius',
|
|
145
|
-
borderTopRightRadius: 'borderTopRightRadius',
|
|
146
|
-
borderBottomLeftRadius: 'borderBottomLeftRadius',
|
|
147
|
-
borderBottomRightRadius: 'borderBottomRightRadius',
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const borderStyles = {
|
|
151
|
-
borderStyle: 'borderStyle',
|
|
152
|
-
borderTopStyle: 'borderTopStyle',
|
|
153
|
-
borderRightStyle: 'borderRightStyle',
|
|
154
|
-
borderBottomStyle: 'borderBottomStyle',
|
|
155
|
-
borderLeftStyle: 'borderLeftStyle',
|
|
156
|
-
borderInlineStartStyle,
|
|
157
|
-
borderInlineEndStyle,
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
const borderWidths = {
|
|
161
|
-
borderWidth: 'borderWidth',
|
|
162
|
-
borderTopWidth: 'borderTopWidth',
|
|
163
|
-
borderRightWidth: 'borderRightWidth',
|
|
164
|
-
borderBottomWidth: 'borderBottomWidth',
|
|
165
|
-
borderLeftWidth: 'borderLeftWidth',
|
|
166
|
-
borderInlineStartWidth,
|
|
167
|
-
borderInlineEndWidth,
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* A style prop function that takes components props and returns border styles. Some props, such as borderRadius and borderColor, are connected to our design tokens.
|
|
172
|
-
* If no `BorderStyleProps` are found, it returns an empty object.
|
|
173
|
-
*
|
|
174
|
-
* @example
|
|
175
|
-
* // You'll most likely use `border` with low-level, styled components
|
|
176
|
-
* const BoxExample = () => (
|
|
177
|
-
* <Box border={`solid 1px #333333 ${colors.blackPepper400}`}>Hello, border styles!</Box>
|
|
178
|
-
* );
|
|
179
|
-
*
|
|
180
|
-
*/
|
|
181
|
-
export function border<P extends BorderStyleProps & {theme?: PartialEmotionCanvasTheme}>(props: P) {
|
|
182
|
-
// border will always be used within the context of a component, but eslint doesn't know that
|
|
183
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
184
|
-
const {canvas} = useTheme(props.theme);
|
|
185
|
-
const isRTL = canvas.direction === ContentDirection.RTL;
|
|
186
|
-
const styles = {};
|
|
187
|
-
for (const key in props) {
|
|
188
|
-
if (props.hasOwnProperty(key)) {
|
|
189
|
-
if (key in borderShorthandProps) {
|
|
190
|
-
const value = props[key as keyof BorderShorthandStyleProps];
|
|
191
|
-
let attr: string;
|
|
192
|
-
if (key === 'borderInlineStart') {
|
|
193
|
-
attr = borderInlineStart(isRTL);
|
|
194
|
-
} else if (key === 'borderInlineEnd') {
|
|
195
|
-
attr = borderInlineEnd(isRTL);
|
|
196
|
-
} else {
|
|
197
|
-
attr = borderShorthandProps[key as keyof BorderShorthandStyleProps];
|
|
198
|
-
}
|
|
199
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
200
|
-
styles[attr] = value;
|
|
201
|
-
continue;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (key in borderColors) {
|
|
205
|
-
const propValue = props[key as keyof BorderColorStyleProps] as CanvasColor | string;
|
|
206
|
-
const value = colorTokens[propValue as CanvasColor] || propValue;
|
|
207
|
-
let attr: string;
|
|
208
|
-
if (key === 'borderInlineStartColor') {
|
|
209
|
-
attr = borderInlineStartColor(isRTL);
|
|
210
|
-
} else if (key === 'borderInlineEndColor') {
|
|
211
|
-
attr = borderInlineEndColor(isRTL);
|
|
212
|
-
} else {
|
|
213
|
-
attr = borderColors[key as keyof BorderColorStyleProps];
|
|
214
|
-
}
|
|
215
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
216
|
-
styles[attr] = value;
|
|
217
|
-
continue;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (key in borderRadii) {
|
|
221
|
-
const propValue = props[key as keyof BorderRadiusStyleProps] as
|
|
222
|
-
| CanvasBorderRadiusKeys
|
|
223
|
-
| number
|
|
224
|
-
| string;
|
|
225
|
-
const value = borderRadiusTokens[propValue as CanvasBorderRadiusKeys] || propValue;
|
|
226
|
-
const attr = borderRadii[key as keyof BorderRadiusStyleProps];
|
|
227
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
228
|
-
styles[attr] = value;
|
|
229
|
-
continue;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
if (key in borderStyles) {
|
|
233
|
-
const value = props[key as keyof BorderLineStyleProps];
|
|
234
|
-
let attr: string;
|
|
235
|
-
if (key === 'borderInlineStartStyle') {
|
|
236
|
-
attr = borderInlineStartStyle(isRTL);
|
|
237
|
-
} else if (key === 'borderInlineEndStyle') {
|
|
238
|
-
attr = borderInlineEndStyle(isRTL);
|
|
239
|
-
} else {
|
|
240
|
-
attr = borderStyles[key as keyof BorderLineStyleProps];
|
|
241
|
-
}
|
|
242
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
243
|
-
styles[attr] = value;
|
|
244
|
-
continue;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if (key in borderWidths) {
|
|
248
|
-
const value = props[key as keyof BorderWidthStyleProps];
|
|
249
|
-
let attr: string;
|
|
250
|
-
if (key === 'borderInlineStartWidth') {
|
|
251
|
-
attr = borderInlineStartWidth(isRTL);
|
|
252
|
-
} else if (key === 'borderInlineEndWidth') {
|
|
253
|
-
attr = borderInlineEndWidth(isRTL);
|
|
254
|
-
} else {
|
|
255
|
-
attr = borderWidths[key as keyof BorderWidthStyleProps];
|
|
256
|
-
}
|
|
257
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
258
|
-
styles[attr] = value;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
return styles;
|
|
263
|
-
}
|
package/layout/lib/utils/font.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import {Property} from 'csstype';
|
|
2
|
-
import {type, CanvasTypeProperties} from '@workday/canvas-kit-react/tokens';
|
|
3
|
-
|
|
4
|
-
export type FontFamilyTokens = keyof CanvasTypeProperties['fontFamilies'];
|
|
5
|
-
export type FontSizeTokens = keyof CanvasTypeProperties['fontSizes'];
|
|
6
|
-
export type FontWeightTokens = keyof CanvasTypeProperties['fontWeights'];
|
|
7
|
-
type FontValue = FontFamilyTokens & FontSizeTokens & FontWeightTokens;
|
|
8
|
-
|
|
9
|
-
/** style props to for color properties */
|
|
10
|
-
export type FontStyleProps = {
|
|
11
|
-
/** sets `font-family` property */
|
|
12
|
-
fontFamily?: Property.FontFamily | FontFamilyTokens;
|
|
13
|
-
/** sets `font-size` property */
|
|
14
|
-
fontSize?: Property.FontSize | FontSizeTokens;
|
|
15
|
-
/** sets `font-style` property */
|
|
16
|
-
fontStyle?: Property.FontStyle;
|
|
17
|
-
/** sets `font-weight` property */
|
|
18
|
-
fontWeight?: Property.FontWeight | FontWeightTokens;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const getFontFamily = (value: FontStyleProps['fontFamily']) => ({
|
|
22
|
-
fontFamily: type.properties.fontFamilies[value as FontFamilyTokens] || value,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const getFontSize = (value: FontStyleProps['fontSize']) => ({
|
|
26
|
-
fontSize: type.properties.fontSizes[value as FontSizeTokens] || value,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const getFontStyle = (value: FontStyleProps['fontStyle']) => ({
|
|
30
|
-
fontStyle: value,
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const getFontWeight = (value: FontStyleProps['fontWeight']) => ({
|
|
34
|
-
fontWeight: type.properties.fontWeights[value as FontWeightTokens] || value,
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const fontProps = {
|
|
38
|
-
fontFamily: getFontFamily,
|
|
39
|
-
fontSize: getFontSize,
|
|
40
|
-
fontWeight: getFontWeight,
|
|
41
|
-
fontStyle: getFontStyle,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* A style prop function that takes components props and returns font styles from canvas token values.
|
|
46
|
-
* If no `FontStyleProps` are found, it returns an empty object.
|
|
47
|
-
*
|
|
48
|
-
* @example
|
|
49
|
-
* // You'll most likely use `font` with low-level, styled components
|
|
50
|
-
* const BoxExample = () => (
|
|
51
|
-
* <Box fontFamily="monospace" fontWeight="medium">Hello, fonts!</Box>
|
|
52
|
-
* );
|
|
53
|
-
*
|
|
54
|
-
*/
|
|
55
|
-
export function font<P extends FontStyleProps>(props: P) {
|
|
56
|
-
let styles = {};
|
|
57
|
-
for (const key in props) {
|
|
58
|
-
if (key in fontProps) {
|
|
59
|
-
const value = props[key as keyof FontStyleProps] as FontValue;
|
|
60
|
-
const fontFn = fontProps[key as keyof FontStyleProps];
|
|
61
|
-
const style = fontFn(value);
|
|
62
|
-
styles = {...styles, ...style};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return styles;
|
|
67
|
-
}
|