@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
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { CanvasBorderRadiusKeys, CanvasColor, CanvasDepth, CanvasSpaceKeys, CanvasTypeProperties } from '@workday/canvas-kit-react/tokens';
|
|
2
|
+
export declare type SystemPropNames = 'color' | 'depth' | 'font' | 'fontSize' | 'fontWeight' | 'shape' | 'space';
|
|
3
|
+
/**
|
|
4
|
+
* Canvas System Prop Values
|
|
5
|
+
* ---
|
|
6
|
+
* These system prop values are restricted to Canvas token values.
|
|
7
|
+
*/
|
|
8
|
+
export declare type CanvasSystemPropValues = {
|
|
9
|
+
color: CanvasColor;
|
|
10
|
+
depth: keyof CanvasDepth;
|
|
11
|
+
font: keyof CanvasTypeProperties['fontFamilies'];
|
|
12
|
+
fontSize: keyof CanvasTypeProperties['fontSizes'];
|
|
13
|
+
fontWeight: keyof CanvasTypeProperties['fontWeights'];
|
|
14
|
+
shape: CanvasBorderRadiusKeys;
|
|
15
|
+
space: CanvasSpaceKeys;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* System Prop Values
|
|
19
|
+
* ---
|
|
20
|
+
* These system prop values include Canvas System Prop Values and generic values.
|
|
21
|
+
*/
|
|
22
|
+
export declare type SystemPropValues = {
|
|
23
|
+
color: CanvasSystemPropValues['color'] | (string & {});
|
|
24
|
+
depth: CanvasSystemPropValues['depth'];
|
|
25
|
+
font: CanvasSystemPropValues['font'] | (string & {});
|
|
26
|
+
fontSize: CanvasSystemPropValues['fontSize'] | (string & {});
|
|
27
|
+
fontWeight: CanvasSystemPropValues['fontWeight'] | (string & {});
|
|
28
|
+
shape: CanvasSystemPropValues['shape'] | number | (string & {});
|
|
29
|
+
space: CanvasSystemPropValues['space'] | number | (string & {});
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=systemProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemProps.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/systemProps.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,WAAW,EACX,WAAW,EACX,eAAe,EACf,oBAAoB,EACrB,MAAM,kCAAkC,CAAC;AAE1C,oBAAY,eAAe,GACvB,OAAO,GACP,OAAO,GACP,MAAM,GACN,UAAU,GACV,YAAY,GACZ,OAAO,GACP,OAAO,CAAC;AAEZ;;;;GAIG;AACH,oBAAY,sBAAsB,GAAG;IACnC,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,MAAM,WAAW,CAAC;IACzB,IAAI,EAAE,MAAM,oBAAoB,CAAC,cAAc,CAAC,CAAC;IACjD,QAAQ,EAAE,MAAM,oBAAoB,CAAC,WAAW,CAAC,CAAC;IAClD,UAAU,EAAE,MAAM,oBAAoB,CAAC,aAAa,CAAC,CAAC;IACtD,KAAK,EAAE,sBAAsB,CAAC;IAC9B,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AACH,oBAAY,gBAAgB,GAAG;IAC7B,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACvD,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC,CAAC;IACvC,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACrD,QAAQ,EAAE,sBAAsB,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAC7D,UAAU,EAAE,sBAAsB,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACjE,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAChE,KAAK,EAAE,sBAAsB,CAAC,OAAO,CAAC,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;CACjE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,35 +1,53 @@
|
|
|
1
1
|
import { Property } from 'csstype';
|
|
2
|
-
|
|
2
|
+
import { StyleFnConfig } from './buildStyleFns';
|
|
3
|
+
import { SystemPropValues } from './systemProps';
|
|
4
|
+
/** style props to for CSS font and text properties */
|
|
3
5
|
export declare type TextStyleProps = {
|
|
4
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* - sets [CSS font-family property](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family)
|
|
8
|
+
* - system tokens: `font` */
|
|
9
|
+
fontFamily?: Property.FontFamily | SystemPropValues['font'];
|
|
10
|
+
/**
|
|
11
|
+
* - sets [CSS font-size property](https://developer.mozilla.org/en-US/docs/Web/CSS/font-size)
|
|
12
|
+
* - system tokens: `fontSize` */
|
|
13
|
+
fontSize?: Property.FontSize | SystemPropValues['fontSize'];
|
|
14
|
+
/** sets [CSS font-style property](https://developer.mozilla.org/en-US/docs/Web/CSS/font-style) */
|
|
15
|
+
fontStyle?: Property.FontStyle;
|
|
16
|
+
/**
|
|
17
|
+
* - sets [CSS font-weight property](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight)
|
|
18
|
+
* - system tokens: `fontWeight` */
|
|
19
|
+
fontWeight?: Property.FontWeight | SystemPropValues['fontWeight'];
|
|
20
|
+
/** sets [CSS line-height property](https://developer.mozilla.org/en-US/docs/Web/CSS/line-height) */
|
|
5
21
|
lineHeight?: Property.LineHeight;
|
|
6
|
-
/** sets
|
|
22
|
+
/** sets [CSS letter-spacing property](https://developer.mozilla.org/en-US/docs/Web/CSS/letter-spacing) */
|
|
7
23
|
letterSpacing?: Property.LetterSpacing;
|
|
8
|
-
/** sets
|
|
24
|
+
/** sets [CSS text-align property](https://developer.mozilla.org/en-US/docs/Web/CSS/text-align) */
|
|
9
25
|
textAlign?: Property.TextAlign;
|
|
10
|
-
/** sets
|
|
26
|
+
/** sets [CSS text-decoration property](https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration) */
|
|
11
27
|
textDecoration?: Property.TextDecoration;
|
|
12
|
-
/** sets
|
|
28
|
+
/** sets [CSS text-overflow property](https://developer.mozilla.org/en-US/docs/Web/CSS/text-overflow) */
|
|
13
29
|
textOverflow?: Property.TextOverflow;
|
|
14
|
-
/** sets
|
|
30
|
+
/** sets [CSS text-transform property](https://developer.mozilla.org/en-US/docs/Web/CSS/text-transform) */
|
|
15
31
|
textTransform?: Property.TextTransform;
|
|
16
|
-
/** sets
|
|
32
|
+
/** sets [CSS text-shadow property](https://developer.mozilla.org/en-US/docs/Web/CSS/text-shadow) */
|
|
17
33
|
textShadow?: Property.TextShadow;
|
|
18
|
-
/** sets
|
|
34
|
+
/** sets [CSS white-space property](https://developer.mozilla.org/en-US/docs/Web/CSS/white-space) */
|
|
19
35
|
whiteSpace?: Property.WhiteSpace;
|
|
20
|
-
/** sets
|
|
36
|
+
/** sets [CSS word-break property](https://developer.mozilla.org/en-US/docs/Web/CSS/word-break) */
|
|
21
37
|
wordBreak?: Property.WordBreak;
|
|
22
38
|
};
|
|
39
|
+
export declare const textStyleFnConfigs: StyleFnConfig[];
|
|
40
|
+
export declare const textStyleFns: import("./buildStyleFns").StyleFns;
|
|
23
41
|
/**
|
|
24
|
-
* A style prop function that takes
|
|
42
|
+
* A style prop function that takes component props and returns font and text styles.
|
|
25
43
|
* If no `TextStyleProps` are found, it returns an empty object.
|
|
26
44
|
*
|
|
27
45
|
* @example
|
|
28
|
-
*
|
|
46
|
+
* ```
|
|
29
47
|
* const BoxExample = () => (
|
|
30
|
-
* <Box textAlign="center">Hello, alignment!</Box>
|
|
48
|
+
* <Box textAlign="center" fontWeight="medium">Hello, alignment!</Box>
|
|
31
49
|
* );
|
|
32
|
-
*
|
|
50
|
+
* ```
|
|
33
51
|
*/
|
|
34
|
-
export declare
|
|
52
|
+
export declare const text: (props: TextStyleProps) => {};
|
|
35
53
|
//# sourceMappingURL=text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEjC,
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../../layout/lib/utils/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAEjC,OAAO,EAAkC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC/E,OAAO,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAE/C,sDAAsD;AACtD,oBAAY,cAAc,GAAG;IAC3B;;iCAE6B;IAC7B,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC5D;;qCAEiC;IACjC,QAAQ,CAAC,EAAE,QAAQ,CAAC,QAAQ,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAC5D,kGAAkG;IAClG,SAAS,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC;IAC/B;;uCAEmC;IACnC,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAClE,oGAAoG;IACpG,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACjC,0GAA0G;IAC1G,aAAa,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC;IACvC,kGAAkG;IAClG,SAAS,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC;IAC/B,4GAA4G;IAC5G,cAAc,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC;IACzC,wGAAwG;IACxG,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC;IACrC,0GAA0G;IAC1G,aAAa,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC;IACvC,oGAAoG;IACpG,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACjC,oGAAoG;IACpG,UAAU,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;IACjC,kGAAkG;IAClG,SAAS,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC;CAChC,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,aAAa,EAkE7C,CAAC;AAEF,eAAO,MAAM,YAAY,oCAAoC,CAAC;AAC9D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,IAAI,+BAAiD,CAAC"}
|
|
@@ -1,44 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { buildStyleFns, buildStylePropFn } from './buildStyleFns';
|
|
2
|
+
export var textStyleFnConfigs = [
|
|
3
|
+
{
|
|
4
|
+
name: 'fontFamily',
|
|
5
|
+
properties: ['fontFamily'],
|
|
6
|
+
system: 'font',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
name: 'fontSize',
|
|
10
|
+
properties: ['fontSize'],
|
|
11
|
+
system: 'fontSize',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: 'fontStyle',
|
|
15
|
+
properties: ['fontStyle'],
|
|
16
|
+
system: 'none',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'fontWeight',
|
|
20
|
+
properties: ['fontWeight'],
|
|
21
|
+
system: 'fontWeight',
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: 'lineHeight',
|
|
25
|
+
properties: ['lineHeight'],
|
|
26
|
+
system: 'none',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'letterSpacing',
|
|
30
|
+
properties: ['letterSpacing'],
|
|
31
|
+
system: 'none',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'textAlign',
|
|
35
|
+
properties: ['textAlign'],
|
|
36
|
+
system: 'none',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'textDecoration',
|
|
40
|
+
properties: ['textDecoration'],
|
|
41
|
+
system: 'none',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'textOverflow',
|
|
45
|
+
properties: ['textOverflow'],
|
|
46
|
+
system: 'none',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'textTransform',
|
|
50
|
+
properties: ['textTransform'],
|
|
51
|
+
system: 'none',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'textShadow',
|
|
55
|
+
properties: ['textShadow'],
|
|
56
|
+
system: 'none',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'whiteSpace',
|
|
60
|
+
properties: ['whiteSpace'],
|
|
61
|
+
system: 'none',
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'wordBreak',
|
|
65
|
+
properties: ['wordBreak'],
|
|
66
|
+
system: 'none',
|
|
67
|
+
},
|
|
22
68
|
];
|
|
69
|
+
export var textStyleFns = buildStyleFns(textStyleFnConfigs);
|
|
23
70
|
/**
|
|
24
|
-
* A style prop function that takes
|
|
71
|
+
* A style prop function that takes component props and returns font and text styles.
|
|
25
72
|
* If no `TextStyleProps` are found, it returns an empty object.
|
|
26
73
|
*
|
|
27
74
|
* @example
|
|
28
|
-
*
|
|
75
|
+
* ```
|
|
29
76
|
* const BoxExample = () => (
|
|
30
|
-
* <Box textAlign="center">Hello, alignment!</Box>
|
|
77
|
+
* <Box textAlign="center" fontWeight="medium">Hello, alignment!</Box>
|
|
31
78
|
* );
|
|
32
|
-
*
|
|
79
|
+
* ```
|
|
33
80
|
*/
|
|
34
|
-
export
|
|
35
|
-
var _a;
|
|
36
|
-
var styles = {};
|
|
37
|
-
for (var key in props) {
|
|
38
|
-
if (textProps.includes(key)) {
|
|
39
|
-
var value = props[key];
|
|
40
|
-
styles = __assign(__assign({}, styles), (_a = {}, _a[key] = value, _a));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return styles;
|
|
44
|
-
}
|
|
81
|
+
export var text = buildStylePropFn(textStyleFns);
|
|
@@ -99,7 +99,7 @@ export declare const Modal: import("../../common").ComponentM<import("../../dial
|
|
|
99
99
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
100
100
|
};
|
|
101
101
|
}> & {
|
|
102
|
-
Body: import("../../common").ElementComponentM<"div", import("../..").
|
|
102
|
+
Body: import("../../common").ElementComponentM<"div", import("../..").BackgroundStyleProps & import("../../layout/lib/utils/border/color").BorderColorStyleProps & import("../../layout/lib/utils/border/lineStyle").BorderLineStyleProps & import("../../layout/lib/utils/border/radius").BorderRadiusStyleProps & import("../../layout/lib/utils/border/shorthand").BorderShorthandStyleProps & import("../../layout/lib/utils/border/width").BorderWidthStyleProps & import("../..").ColorStyleProps & import("../..").DepthStyleProps & import("../..").FlexItemStyleProps & import("../..").GridItemStyleProps & import("../..").LayoutStyleProps & import("../..").OtherStyleProps & import("../..").PositionStyleProps & import("../..").SpaceStyleProps & import("../..").TextStyleProps & React.HTMLAttributes<HTMLDivElement>, {
|
|
103
103
|
state: {
|
|
104
104
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
105
105
|
targetRef: React.RefObject<HTMLButtonElement>;
|
|
@@ -106,7 +106,7 @@ export declare const Popup: import("../../common").ComponentM<PopupProps & Parti
|
|
|
106
106
|
hide(event?: Event | React.SyntheticEvent<Element, Event> | undefined): void;
|
|
107
107
|
};
|
|
108
108
|
}>;
|
|
109
|
-
Body: import("../../common").ElementComponentM<"div", import("../..").
|
|
109
|
+
Body: import("../../common").ElementComponentM<"div", import("../..").BackgroundStyleProps & import("../../layout/lib/utils/border/color").BorderColorStyleProps & import("../../layout/lib/utils/border/lineStyle").BorderLineStyleProps & import("../../layout/lib/utils/border/radius").BorderRadiusStyleProps & import("../../layout/lib/utils/border/shorthand").BorderShorthandStyleProps & import("../../layout/lib/utils/border/width").BorderWidthStyleProps & import("../..").ColorStyleProps & import("../..").DepthStyleProps & import("../..").FlexItemStyleProps & import("../..").GridItemStyleProps & import("../..").LayoutStyleProps & import("../..").OtherStyleProps & import("../..").PositionStyleProps & import("../..").SpaceStyleProps & import("../..").TextStyleProps & React.HTMLAttributes<HTMLDivElement>, {
|
|
110
110
|
state: {
|
|
111
111
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
112
112
|
targetRef: React.RefObject<HTMLButtonElement>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
export declare const PopupBody: import("../../common").ElementComponentM<"div", import("../..").
|
|
2
|
+
export declare const PopupBody: import("../../common").ElementComponentM<"div", import("../..").BackgroundStyleProps & import("../../layout/lib/utils/border/color").BorderColorStyleProps & import("../../layout/lib/utils/border/lineStyle").BorderLineStyleProps & import("../../layout/lib/utils/border/radius").BorderRadiusStyleProps & import("../../layout/lib/utils/border/shorthand").BorderShorthandStyleProps & import("../../layout/lib/utils/border/width").BorderWidthStyleProps & import("../..").ColorStyleProps & import("../..").DepthStyleProps & import("../..").FlexItemStyleProps & import("../..").GridItemStyleProps & import("../..").LayoutStyleProps & import("../..").OtherStyleProps & import("../..").PositionStyleProps & import("../..").SpaceStyleProps & import("../..").TextStyleProps & React.HTMLAttributes<HTMLDivElement>, {
|
|
3
3
|
state: {
|
|
4
4
|
stackRef: React.RefObject<HTMLDivElement>;
|
|
5
5
|
targetRef: React.RefObject<HTMLButtonElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReturnFocus.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/useReturnFocus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useReturnFocus.d.ts","sourceRoot":"","sources":["../../../../../popup/lib/hooks/useReturnFocus.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgC1B;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;OAsGzB,CAAC"}
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { changeFocus, createElemPropsHook } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { changeFocus, createElemPropsHook, isFocusable } from '@workday/canvas-kit-react/common';
|
|
3
3
|
import { usePopupModel } from './usePopupModel';
|
|
4
|
+
function getScrollParent(element) {
|
|
5
|
+
if (element === document.body || !element.parentElement) {
|
|
6
|
+
return element;
|
|
7
|
+
}
|
|
8
|
+
var styles = getComputedStyle(element);
|
|
9
|
+
if (styles.overflowY === 'scroll' || styles.overflowY === 'auto') {
|
|
10
|
+
return element;
|
|
11
|
+
}
|
|
12
|
+
return getScrollParent(element.parentElement);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get a focusable element in an element's tree
|
|
16
|
+
*/
|
|
17
|
+
function getFocusableElement(element) {
|
|
18
|
+
if (element === null || element === document.body || !element.parentElement) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
else if (isFocusable(element)) {
|
|
22
|
+
return element;
|
|
23
|
+
}
|
|
24
|
+
return getFocusableElement(element.parentElement);
|
|
25
|
+
}
|
|
4
26
|
/**
|
|
5
27
|
* Returns focus to the target element when the popup is hidden. This works well with
|
|
6
28
|
* `useInitialFocus`. This should be used with `useFocusRedirect` or `useFocusTrap` for a complete
|
|
@@ -10,6 +32,7 @@ import { usePopupModel } from './usePopupModel';
|
|
|
10
32
|
*/
|
|
11
33
|
export var useReturnFocus = createElemPropsHook(usePopupModel)(function (model) {
|
|
12
34
|
var visible = model.state.visibility !== 'hidden';
|
|
35
|
+
var elementRef = React.useRef(null);
|
|
13
36
|
// This boolean tracks keyboard-driven focus changes. This is required for `useFocusRedirect` as
|
|
14
37
|
// focus redirection needs synchronous focus management and everything else needs asynchronous
|
|
15
38
|
// focus management.
|
|
@@ -23,17 +46,56 @@ export var useReturnFocus = createElemPropsHook(usePopupModel)(function (model)
|
|
|
23
46
|
var onKeyUp = React.useCallback(function (event) {
|
|
24
47
|
requiresFocusChangeRef.current = false;
|
|
25
48
|
}, []);
|
|
49
|
+
// track mousedown events to determine if the mouse target is a focusable element. If it is, we
|
|
50
|
+
// should not return focus
|
|
51
|
+
var onMouseDown = React.useCallback(function (event) {
|
|
52
|
+
elementRef.current = event.target;
|
|
53
|
+
}, []);
|
|
54
|
+
var onMouseUp = React.useCallback(function () {
|
|
55
|
+
elementRef.current = null;
|
|
56
|
+
}, []);
|
|
57
|
+
// We use `useLayoutEffect` because the callback will be called _before_ the browser changes
|
|
58
|
+
// focus. This allows the browser to change focus as normal. For example, if the popup closes
|
|
59
|
+
// because the user hits the tab key when focused on the last focusable element,
|
|
60
|
+
// `useFocusRedirect` will cause the popup to close before the browser is finished processing the
|
|
61
|
+
// `keydown`. The browser's default action of a keydown of a tab key is to advance focus to the
|
|
62
|
+
// next focusable element. This means that the `useFocusRedirect` will change focus back to the
|
|
63
|
+
// target, then the tab key is processed by the browser to focus on the next item after the target
|
|
64
|
+
// without us having to use a focus manager to guess what the next focusable element is.
|
|
65
|
+
//
|
|
66
|
+
// But because we're using `useLayoutEffect` instead of `useEffect`, we cannot use
|
|
67
|
+
// `document.activeElement` (because the focus hasn't changed yet because the browser hasn't
|
|
68
|
+
// triggered a default action yet) to determine if a user clicked on something that can accept
|
|
69
|
+
// focus itself. If we don't short-circuit return focus, the user will intend to click on an
|
|
70
|
+
// `input` element only to get focus changed back. This is annoying to users and unintuitive. Instead,
|
|
71
|
+
// we'll use `mousedown` and `mouseup` to determine if we're closing because of a mouse click.
|
|
26
72
|
React.useLayoutEffect(function () {
|
|
27
73
|
if (!visible) {
|
|
28
74
|
return;
|
|
29
75
|
}
|
|
30
76
|
// capture the element here. The refs will be null by the time the cleanup function is called
|
|
31
77
|
var element = (model.state.returnFocusRef || model.state.targetRef).current;
|
|
78
|
+
document.addEventListener('mousedown', onMouseDown, true);
|
|
79
|
+
document.addEventListener('mouseup', onMouseUp, true);
|
|
32
80
|
document.addEventListener('keydown', onKeyDown, true);
|
|
33
81
|
document.addEventListener('keyup', onKeyUp, true);
|
|
34
82
|
return function () {
|
|
83
|
+
document.removeEventListener('mousedown', onMouseDown, true);
|
|
84
|
+
document.removeEventListener('mouseup', onMouseUp, true);
|
|
35
85
|
document.removeEventListener('keydown', onKeyDown, true);
|
|
36
86
|
document.removeEventListener('keyup', onKeyUp, true);
|
|
87
|
+
var scrollParent = getScrollParent(element);
|
|
88
|
+
var scrollParentRect = scrollParent.getBoundingClientRect();
|
|
89
|
+
var elementRect = element.getBoundingClientRect();
|
|
90
|
+
// Don't change focus if user focused on a different element like a `input` or the target
|
|
91
|
+
// element isn't on at least halfway rendered on the screen.
|
|
92
|
+
if ((elementRef.current && getFocusableElement(elementRef.current)) ||
|
|
93
|
+
elementRect.top + elementRect.height / 2 < scrollParentRect.top ||
|
|
94
|
+
elementRect.bottom - elementRect.height / 2 > scrollParentRect.bottom ||
|
|
95
|
+
elementRect.left + elementRect.width / 2 < scrollParentRect.left ||
|
|
96
|
+
elementRect.right - elementRect.width / 2 > scrollParentRect.right) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
37
99
|
if (requiresFocusChangeRef.current) {
|
|
38
100
|
// We need to change focus _before_ the browser process the default action of picking a new
|
|
39
101
|
// focus target. Doing this immediately prevents the `focus` event from firing on `element`,
|
|
@@ -47,7 +109,16 @@ export var useReturnFocus = createElemPropsHook(usePopupModel)(function (model)
|
|
|
47
109
|
changeFocus(element);
|
|
48
110
|
});
|
|
49
111
|
}
|
|
112
|
+
elementRef.current = null;
|
|
50
113
|
};
|
|
51
|
-
}, [
|
|
114
|
+
}, [
|
|
115
|
+
model.state.returnFocusRef,
|
|
116
|
+
model.state.targetRef,
|
|
117
|
+
visible,
|
|
118
|
+
onMouseDown,
|
|
119
|
+
onMouseUp,
|
|
120
|
+
onKeyDown,
|
|
121
|
+
onKeyUp,
|
|
122
|
+
]);
|
|
52
123
|
return {};
|
|
53
124
|
});
|
|
@@ -53,7 +53,7 @@ export interface TabsItemProps extends ExtractProps<typeof Box, never>, Partial<
|
|
|
53
53
|
*/
|
|
54
54
|
tabIndex?: number;
|
|
55
55
|
}
|
|
56
|
-
export declare const StyledTabItem: import("@emotion/styled").StyledComponent<import("../../layout").
|
|
56
|
+
export declare const StyledTabItem: import("@emotion/styled").StyledComponent<import("../../layout").BackgroundStyleProps & import("../../layout/lib/utils/border/color").BorderColorStyleProps & import("../../layout/lib/utils/border/lineStyle").BorderLineStyleProps & import("../../layout/lib/utils/border/radius").BorderRadiusStyleProps & import("../../layout/lib/utils/border/shorthand").BorderShorthandStyleProps & import("../../layout/lib/utils/border/width").BorderWidthStyleProps & import("../../layout").ColorStyleProps & import("../../layout").DepthStyleProps & import("../../layout").FlexItemStyleProps & import("../../layout").GridItemStyleProps & import("../../layout").LayoutStyleProps & import("../../layout").OtherStyleProps & import("../../layout").PositionStyleProps & import("../../layout").SpaceStyleProps & import("../../layout").TextStyleProps & Pick<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "name" | "style" | "ref" | "form" | "slot" | "title" | "dir" | "value" | "children" | "hidden" | "disabled" | "type" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget"> & {
|
|
57
57
|
ref?: ((instance: HTMLButtonElement | null) => void) | React.RefObject<HTMLButtonElement> | null | undefined;
|
|
58
58
|
} & {
|
|
59
59
|
theme?: import("@emotion/react").Theme | undefined;
|
|
@@ -25,11 +25,9 @@ export declare enum BrandingColor {
|
|
|
25
25
|
Licorice = "licorice",
|
|
26
26
|
BlackPepper = "blackPepper"
|
|
27
27
|
}
|
|
28
|
-
declare type
|
|
29
|
-
[K in keyof T
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
} ? U : never;
|
|
33
|
-
export declare type CanvasColor = KnownKeys<typeof colors>;
|
|
28
|
+
declare type RemoveIndex<T> = {
|
|
29
|
+
[K in keyof T as string extends K ? never : number extends K ? never : K]: T[K];
|
|
30
|
+
};
|
|
31
|
+
export declare type CanvasColor = keyof RemoveIndex<typeof colors>;
|
|
34
32
|
export {};
|
|
35
33
|
//# sourceMappingURL=colors.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.types.d.ts","sourceRoot":"","sources":["../../../../tokens/lib/colors.types.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,4BAA4B,CAAC;AAEhD,oBAAY,aAAa;IACvB,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,IAAI,SAAS;IACb,aAAa,kBAAkB;IAC/B,UAAU,eAAe;IACzB,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,WAAW,gBAAgB;IAC3B,UAAU,eAAe;IACzB,QAAQ,aAAa;IACrB,kBAAkB,uBAAuB;IACzC,UAAU,eAAe;IACzB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;CAC5B;
|
|
1
|
+
{"version":3,"file":"colors.types.d.ts","sourceRoot":"","sources":["../../../../tokens/lib/colors.types.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,4BAA4B,CAAC;AAEhD,oBAAY,aAAa;IACvB,QAAQ,aAAa;IACrB,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,IAAI,SAAS;IACb,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,KAAK,UAAU;IACf,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,IAAI,SAAS;IACb,aAAa,kBAAkB;IAC/B,UAAU,eAAe;IACzB,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,WAAW,gBAAgB;IAC3B,UAAU,eAAe;IACzB,QAAQ,aAAa;IACrB,kBAAkB,uBAAuB;IACzC,UAAU,eAAe;IACzB,QAAQ,aAAa;IACrB,WAAW,gBAAgB;CAC5B;AAED,aAAK,WAAW,CAAC,CAAC,IAAI;KAClB,CAAC,IAAI,MAAM,CAAC,IAAI,MAAM,SAAS,CAAC,GAAG,KAAK,GAAG,MAAM,SAAS,CAAC,GAAG,KAAK,GAAG,CAAC,GAAK,CAAC,CAAC,CAAC,CAAC;CACnF,CAAC;AAEF,oBAAY,WAAW,GAAG,MAAM,WAAW,CAAC,OAAO,MAAM,CAAC,CAAC"}
|
package/icon/lib/SystemIcon.tsx
CHANGED
|
@@ -46,7 +46,7 @@ export interface SystemIconStyles {
|
|
|
46
46
|
|
|
47
47
|
export interface SystemIconProps
|
|
48
48
|
extends SystemIconStyles,
|
|
49
|
-
Omit<IconProps, 'src' | 'color' | 'type' | 'background'> {
|
|
49
|
+
Omit<IconProps, 'src' | 'color' | 'fill' | 'type' | 'background'> {
|
|
50
50
|
/**
|
|
51
51
|
* The icon to display from `@workday/canvas-system-icons-web`.
|
|
52
52
|
*/
|
package/layout/index.ts
CHANGED
|
@@ -3,19 +3,23 @@ import {DeprecatedColumn} from './lib/Column';
|
|
|
3
3
|
|
|
4
4
|
export { DeprecatedLayout, DeprecatedColumn};
|
|
5
5
|
export * from './lib/Box';
|
|
6
|
+
export * from './lib/utils/background';
|
|
6
7
|
export * from './lib/utils/border';
|
|
7
8
|
export * from './lib/utils/color';
|
|
8
|
-
export {DepthStyleProps} from './lib/utils/depth';
|
|
9
|
+
export {DepthStyleProps, depthStyleFnConfigs} from './lib/utils/depth';
|
|
10
|
+
export * from './lib/utils/flex';
|
|
9
11
|
export * from './lib/utils/flexItem';
|
|
10
|
-
export * from './lib/utils/
|
|
12
|
+
export * from './lib/utils/grid';
|
|
13
|
+
export * from './lib/utils/gridItem';
|
|
11
14
|
export * from './lib/utils/layout';
|
|
15
|
+
export * from './lib/utils/other';
|
|
12
16
|
export * from './lib/utils/position';
|
|
13
|
-
export {SpaceStyleProps} from './lib/utils/space';
|
|
17
|
+
export {SpaceStyleProps, spaceStyleFnConfigs} from './lib/utils/space';
|
|
14
18
|
export * from './lib/utils/text';
|
|
15
19
|
export * from './lib/Flex';
|
|
16
20
|
export * from './lib/Grid';
|
|
17
21
|
export * from './lib/Stack';
|
|
18
22
|
export type { FlexStyleProps } from './lib/utils/flex';
|
|
19
23
|
export type { GridStyleProps } from './lib/utils/grid';
|
|
20
|
-
export type { GridItemStyleProps } from './lib/utils/gridItem';
|
|
24
|
+
export type { GridItemStyleProps, gridItemStyleFnConfigs } from './lib/utils/gridItem';
|
|
21
25
|
export type { StackSpacing, StackDirection, StackStyleProps } from './lib/utils/stack';
|
package/layout/lib/Box.tsx
CHANGED
|
@@ -4,24 +4,24 @@ import isPropValid from '@emotion/is-prop-valid';
|
|
|
4
4
|
import {createComponent, StyledType, useConstant} from '@workday/canvas-kit-react/common';
|
|
5
5
|
|
|
6
6
|
// style props
|
|
7
|
+
import {background, BackgroundStyleProps} from './utils/background';
|
|
7
8
|
import {border, BorderStyleProps} from './utils/border';
|
|
8
9
|
import {color, ColorStyleProps} from './utils/color';
|
|
9
10
|
import {depth, DepthStyleProps} from './utils/depth';
|
|
10
11
|
import {flexItem, FlexItemStyleProps} from './utils/flexItem';
|
|
11
12
|
import {gridItem, GridItemStyleProps} from './utils/gridItem';
|
|
12
|
-
import {font, FontStyleProps} from './utils/font';
|
|
13
13
|
import {layout, LayoutStyleProps} from './utils/layout';
|
|
14
14
|
import {other, OtherStyleProps} from './utils/other';
|
|
15
15
|
import {position, PositionStyleProps} from './utils/position';
|
|
16
16
|
import {space, SpaceStyleProps} from './utils/space';
|
|
17
17
|
import {text, TextStyleProps} from './utils/text';
|
|
18
18
|
|
|
19
|
-
export type BoxProps =
|
|
19
|
+
export type BoxProps = BackgroundStyleProps &
|
|
20
|
+
BorderStyleProps &
|
|
20
21
|
ColorStyleProps &
|
|
21
22
|
DepthStyleProps &
|
|
22
23
|
FlexItemStyleProps &
|
|
23
24
|
GridItemStyleProps &
|
|
24
|
-
FontStyleProps &
|
|
25
25
|
LayoutStyleProps &
|
|
26
26
|
OtherStyleProps &
|
|
27
27
|
PositionStyleProps &
|
|
@@ -60,6 +60,7 @@ const shouldForwardProp = (prop: string) => {
|
|
|
60
60
|
* A function that allows us to call Box styles on an element and reduce the amount of elements in the React Dom tree.
|
|
61
61
|
* Instead of using the `as` in a styled function, you can just call this instead to pass those props to the styled element
|
|
62
62
|
* @example
|
|
63
|
+
* ```
|
|
63
64
|
* import { boxStyleFn } from '@workday/canvas-kit-react/layout';
|
|
64
65
|
* const StyledHeader = styled('h1')(
|
|
65
66
|
* boxStyleFn,
|
|
@@ -68,22 +69,24 @@ const shouldForwardProp = (prop: string) => {
|
|
|
68
69
|
* }
|
|
69
70
|
* )
|
|
70
71
|
*
|
|
71
|
-
*
|
|
72
|
+
* ...
|
|
72
73
|
*
|
|
73
74
|
* <StyledHeader color='red'>Hello World</StyledHeader>
|
|
75
|
+
* ```
|
|
74
76
|
*/
|
|
75
77
|
export const boxStyleFn = <P extends BoxProps>(props: P) => {
|
|
76
78
|
return [
|
|
77
79
|
{
|
|
78
80
|
boxSizing: 'border-box',
|
|
79
81
|
},
|
|
82
|
+
background,
|
|
80
83
|
border,
|
|
81
84
|
color,
|
|
82
85
|
depth,
|
|
83
86
|
flexItem,
|
|
84
87
|
gridItem,
|
|
85
|
-
font,
|
|
86
88
|
layout,
|
|
89
|
+
other,
|
|
87
90
|
position,
|
|
88
91
|
space,
|
|
89
92
|
text,
|
|
@@ -100,39 +103,10 @@ export const boxStyleFn = <P extends BoxProps>(props: P) => {
|
|
|
100
103
|
};
|
|
101
104
|
|
|
102
105
|
// Meant to be used with elements. The `shouldForwardProps` will remove all style props
|
|
103
|
-
const StyledBoxElement = styled('div', {shouldForwardProp})<StyledType & BoxProps>(
|
|
104
|
-
{
|
|
105
|
-
boxSizing: 'border-box',
|
|
106
|
-
},
|
|
107
|
-
border,
|
|
108
|
-
color,
|
|
109
|
-
depth,
|
|
110
|
-
flexItem,
|
|
111
|
-
gridItem,
|
|
112
|
-
font,
|
|
113
|
-
layout,
|
|
114
|
-
position,
|
|
115
|
-
space,
|
|
116
|
-
text
|
|
117
|
-
);
|
|
106
|
+
const StyledBoxElement = styled('div', {shouldForwardProp})<StyledType & BoxProps>(boxStyleFn);
|
|
118
107
|
|
|
119
108
|
// Meant to be used with components. There is no `shouldForwardProps` - all props will be forwarded to the component
|
|
120
|
-
const StyledBoxComponent = styled('div')<StyledType & BoxProps>(
|
|
121
|
-
{
|
|
122
|
-
boxSizing: 'border-box',
|
|
123
|
-
},
|
|
124
|
-
border,
|
|
125
|
-
color,
|
|
126
|
-
depth,
|
|
127
|
-
flexItem,
|
|
128
|
-
gridItem,
|
|
129
|
-
font,
|
|
130
|
-
layout,
|
|
131
|
-
other,
|
|
132
|
-
position,
|
|
133
|
-
space,
|
|
134
|
-
text
|
|
135
|
-
);
|
|
109
|
+
const StyledBoxComponent = styled('div')<StyledType & BoxProps>(boxStyleFn);
|
|
136
110
|
|
|
137
111
|
/**
|
|
138
112
|
* `Box` is a primitive component that provides a common, ergonomic API around Canvas design tokens.
|
package/layout/lib/Flex.tsx
CHANGED
|
@@ -20,6 +20,7 @@ const StyledFlex = styled(Box)<StyledType & FlexProps>(
|
|
|
20
20
|
* `Flex` is built on top of `Box` and has access to all `BoxProps`.
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
|
+
* ```tsx
|
|
23
24
|
* import { Flex, FlexProps } from '@workday/canvas-kit-react/layout';
|
|
24
25
|
*
|
|
25
26
|
* interface CardProps extends FlexProps {
|
|
@@ -33,7 +34,7 @@ const StyledFlex = styled(Box)<StyledType & FlexProps>(
|
|
|
33
34
|
* <p>This card uses flexbox to set its layout.</p>
|
|
34
35
|
* </Flex>
|
|
35
36
|
* );
|
|
36
|
-
*
|
|
37
|
+
* ```
|
|
37
38
|
*/
|
|
38
39
|
export const Flex = createComponent('div')({
|
|
39
40
|
displayName: 'Flex',
|
|
@@ -44,4 +45,7 @@ export const Flex = createComponent('div')({
|
|
|
44
45
|
</StyledFlex>
|
|
45
46
|
);
|
|
46
47
|
},
|
|
48
|
+
subComponents: {
|
|
49
|
+
Item: Box,
|
|
50
|
+
},
|
|
47
51
|
});
|