@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,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,48 +1,84 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.text = void 0;
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
3
|
+
exports.text = exports.textStyleFns = exports.textStyleFnConfigs = void 0;
|
|
4
|
+
var buildStyleFns_1 = require("./buildStyleFns");
|
|
5
|
+
exports.textStyleFnConfigs = [
|
|
6
|
+
{
|
|
7
|
+
name: 'fontFamily',
|
|
8
|
+
properties: ['fontFamily'],
|
|
9
|
+
system: 'font',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: 'fontSize',
|
|
13
|
+
properties: ['fontSize'],
|
|
14
|
+
system: 'fontSize',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: 'fontStyle',
|
|
18
|
+
properties: ['fontStyle'],
|
|
19
|
+
system: 'none',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'fontWeight',
|
|
23
|
+
properties: ['fontWeight'],
|
|
24
|
+
system: 'fontWeight',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'lineHeight',
|
|
28
|
+
properties: ['lineHeight'],
|
|
29
|
+
system: 'none',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'letterSpacing',
|
|
33
|
+
properties: ['letterSpacing'],
|
|
34
|
+
system: 'none',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'textAlign',
|
|
38
|
+
properties: ['textAlign'],
|
|
39
|
+
system: 'none',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: 'textDecoration',
|
|
43
|
+
properties: ['textDecoration'],
|
|
44
|
+
system: 'none',
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'textOverflow',
|
|
48
|
+
properties: ['textOverflow'],
|
|
49
|
+
system: 'none',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'textTransform',
|
|
53
|
+
properties: ['textTransform'],
|
|
54
|
+
system: 'none',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'textShadow',
|
|
58
|
+
properties: ['textShadow'],
|
|
59
|
+
system: 'none',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'whiteSpace',
|
|
63
|
+
properties: ['whiteSpace'],
|
|
64
|
+
system: 'none',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: 'wordBreak',
|
|
68
|
+
properties: ['wordBreak'],
|
|
69
|
+
system: 'none',
|
|
70
|
+
},
|
|
25
71
|
];
|
|
72
|
+
exports.textStyleFns = buildStyleFns_1.buildStyleFns(exports.textStyleFnConfigs);
|
|
26
73
|
/**
|
|
27
|
-
* A style prop function that takes
|
|
74
|
+
* A style prop function that takes component props and returns font and text styles.
|
|
28
75
|
* If no `TextStyleProps` are found, it returns an empty object.
|
|
29
76
|
*
|
|
30
77
|
* @example
|
|
31
|
-
*
|
|
78
|
+
* ```
|
|
32
79
|
* const BoxExample = () => (
|
|
33
|
-
* <Box textAlign="center">Hello, alignment!</Box>
|
|
80
|
+
* <Box textAlign="center" fontWeight="medium">Hello, alignment!</Box>
|
|
34
81
|
* );
|
|
35
|
-
*
|
|
82
|
+
* ```
|
|
36
83
|
*/
|
|
37
|
-
|
|
38
|
-
var _a;
|
|
39
|
-
var styles = {};
|
|
40
|
-
for (var key in props) {
|
|
41
|
-
if (textProps.includes(key)) {
|
|
42
|
-
var value = props[key];
|
|
43
|
-
styles = __assign(__assign({}, styles), (_a = {}, _a[key] = value, _a));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return styles;
|
|
47
|
-
}
|
|
48
|
-
exports.text = text;
|
|
84
|
+
exports.text = buildStyleFns_1.buildStylePropFn(exports.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;AAiC1B;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;OAgGzB,CAAC"}
|
|
@@ -7,6 +7,29 @@ exports.useReturnFocus = void 0;
|
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
8
|
var common_1 = require("@workday/canvas-kit-react/common");
|
|
9
9
|
var usePopupModel_1 = require("./usePopupModel");
|
|
10
|
+
var canvas_kit_popup_stack_1 = require("@workday/canvas-kit-popup-stack");
|
|
11
|
+
function getScrollParent(element) {
|
|
12
|
+
if (element === document.body || !element.parentElement) {
|
|
13
|
+
return element;
|
|
14
|
+
}
|
|
15
|
+
var styles = getComputedStyle(element);
|
|
16
|
+
if (styles.overflowY === 'scroll' || styles.overflowY === 'auto') {
|
|
17
|
+
return element;
|
|
18
|
+
}
|
|
19
|
+
return getScrollParent(element.parentElement);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Get a focusable element in an element's tree
|
|
23
|
+
*/
|
|
24
|
+
function getFocusableElement(element) {
|
|
25
|
+
if (element === null || element === document.body || !element.parentElement) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
else if (common_1.isFocusable(element)) {
|
|
29
|
+
return element;
|
|
30
|
+
}
|
|
31
|
+
return getFocusableElement(element.parentElement);
|
|
32
|
+
}
|
|
10
33
|
/**
|
|
11
34
|
* Returns focus to the target element when the popup is hidden. This works well with
|
|
12
35
|
* `useInitialFocus`. This should be used with `useFocusRedirect` or `useFocusTrap` for a complete
|
|
@@ -16,6 +39,7 @@ var usePopupModel_1 = require("./usePopupModel");
|
|
|
16
39
|
*/
|
|
17
40
|
exports.useReturnFocus = common_1.createElemPropsHook(usePopupModel_1.usePopupModel)(function (model) {
|
|
18
41
|
var visible = model.state.visibility !== 'hidden';
|
|
42
|
+
var elementRef = react_1.default.useRef(null);
|
|
19
43
|
// This boolean tracks keyboard-driven focus changes. This is required for `useFocusRedirect` as
|
|
20
44
|
// focus redirection needs synchronous focus management and everything else needs asynchronous
|
|
21
45
|
// focus management.
|
|
@@ -26,20 +50,60 @@ exports.useReturnFocus = common_1.createElemPropsHook(usePopupModel_1.usePopupMo
|
|
|
26
50
|
requiresFocusChangeRef.current = true;
|
|
27
51
|
}
|
|
28
52
|
}, []);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
53
|
+
// track mousedown events to determine if the mouse target is a focusable element. If it is, we
|
|
54
|
+
// should not return focus
|
|
55
|
+
var onMouseDown = react_1.default.useCallback(function (event) {
|
|
56
|
+
if (model.state.stackRef.current && event.target instanceof HTMLElement) {
|
|
57
|
+
if (!canvas_kit_popup_stack_1.PopupStack.contains(model.state.stackRef.current, event.target)) {
|
|
58
|
+
elementRef.current = event.target;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}, [model.state.stackRef]);
|
|
62
|
+
// We use `useLayoutEffect` because the callback will be called _before_ the browser changes
|
|
63
|
+
// focus. This allows the browser to change focus as normal. For example, if the popup closes
|
|
64
|
+
// because the user hits the tab key when focused on the last focusable element,
|
|
65
|
+
// `useFocusRedirect` will cause the popup to close before the browser is finished processing the
|
|
66
|
+
// `keydown`. The browser's default action of a keydown of a tab key is to advance focus to the
|
|
67
|
+
// next focusable element. This means that the `useFocusRedirect` will change focus back to the
|
|
68
|
+
// target, then the tab key is processed by the browser to focus on the next item after the target
|
|
69
|
+
// without us having to use a focus manager to guess what the next focusable element is.
|
|
70
|
+
//
|
|
71
|
+
// But because we're using `useLayoutEffect` instead of `useEffect`, we cannot use
|
|
72
|
+
// `document.activeElement` (because the focus hasn't changed yet because the browser hasn't
|
|
73
|
+
// triggered a default action yet) to determine if a user clicked on something that can accept
|
|
74
|
+
// focus itself. If we don't short-circuit return focus, the user will intend to click on an
|
|
75
|
+
// `input` element only to get focus changed back. This is annoying to users and unintuitive. Instead,
|
|
76
|
+
// we'll use `mousedown` and `mouseup` to determine if we're closing because of a mouse click.
|
|
32
77
|
react_1.default.useLayoutEffect(function () {
|
|
33
78
|
if (!visible) {
|
|
34
79
|
return;
|
|
35
80
|
}
|
|
36
81
|
// capture the element here. The refs will be null by the time the cleanup function is called
|
|
37
|
-
var element = (model.state.returnFocusRef || model.state.targetRef)
|
|
82
|
+
var element = (model.state.returnFocusRef || model.state.targetRef)
|
|
83
|
+
.current;
|
|
84
|
+
document.addEventListener('mousedown', onMouseDown, true);
|
|
38
85
|
document.addEventListener('keydown', onKeyDown, true);
|
|
39
|
-
document.addEventListener('keyup', onKeyUp, true);
|
|
40
86
|
return function () {
|
|
87
|
+
document.removeEventListener('mousedown', onMouseDown, true);
|
|
41
88
|
document.removeEventListener('keydown', onKeyDown, true);
|
|
42
|
-
|
|
89
|
+
if (!element) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
var scrollParent = getScrollParent(element);
|
|
93
|
+
var scrollParentRect = scrollParent.getBoundingClientRect();
|
|
94
|
+
var elementRect = element.getBoundingClientRect();
|
|
95
|
+
// Don't change focus if user focused on a different element like a `input` or the target
|
|
96
|
+
// element isn't on at least halfway rendered on the screen.
|
|
97
|
+
if ((elementRef.current && getFocusableElement(elementRef.current)) || // did the user click on a focusable element?
|
|
98
|
+
elementRect.top + elementRect.height / 2 < scrollParentRect.top || // is the top half of the target element visible?
|
|
99
|
+
elementRect.bottom - elementRect.height / 2 > scrollParentRect.bottom || // is the bottom half of the target element visible?
|
|
100
|
+
elementRect.left + elementRect.width / 2 < scrollParentRect.left || // is the left half of the target element visible?
|
|
101
|
+
elementRect.right - elementRect.width / 2 > scrollParentRect.right // is the right half of the target element visible?
|
|
102
|
+
) {
|
|
103
|
+
// reset the focus element and bail early
|
|
104
|
+
elementRef.current = null;
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
43
107
|
if (requiresFocusChangeRef.current) {
|
|
44
108
|
// We need to change focus _before_ the browser process the default action of picking a new
|
|
45
109
|
// focus target. Doing this immediately prevents the `focus` event from firing on `element`,
|
|
@@ -53,7 +117,8 @@ exports.useReturnFocus = common_1.createElemPropsHook(usePopupModel_1.usePopupMo
|
|
|
53
117
|
common_1.changeFocus(element);
|
|
54
118
|
});
|
|
55
119
|
}
|
|
120
|
+
elementRef.current = null;
|
|
56
121
|
};
|
|
57
|
-
}, [model.state.returnFocusRef, model.state.targetRef, visible,
|
|
122
|
+
}, [model.state.returnFocusRef, model.state.targetRef, visible, onMouseDown, onKeyDown]);
|
|
58
123
|
return {};
|
|
59
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" | "translate" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "draggable" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "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" | "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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../testing/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./lib/ComponentStatesTable"), exports);
|
|
14
|
+
__exportStar(require("./lib/StaticStates"), exports);
|
|
15
|
+
__exportStar(require("./lib/permutateProps"), exports);
|
|
16
|
+
__exportStar(require("./lib/propTypes"), exports);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PropCombination, Props } from './propTypes';
|
|
3
|
+
/**
|
|
4
|
+
* A helper to generate a table of all possible states for component visual testing.
|
|
5
|
+
*/
|
|
6
|
+
export interface ComponentStatesTableProps {
|
|
7
|
+
/**
|
|
8
|
+
* The props that will be passed to the component when it is rendered and the corresponding
|
|
9
|
+
* row label for that permutation. It is encouraged to use the result of permutateProps()
|
|
10
|
+
* rather than passing in a list so we don't miss any combinations.
|
|
11
|
+
*/
|
|
12
|
+
rowProps: PropCombination[];
|
|
13
|
+
/**
|
|
14
|
+
* The props that will be passed to the component when it is rendered and the corresponding
|
|
15
|
+
* column label for that permutation. It is encouraged to use the result of permutateProps()
|
|
16
|
+
* rather than passing in a list so we don't miss any combinations.
|
|
17
|
+
*/
|
|
18
|
+
columnProps: PropCombination[];
|
|
19
|
+
/**
|
|
20
|
+
* The render function called to render the component in each cell of the table. This gives you
|
|
21
|
+
* the ability to add extra styling or markup (a blue background for an inverse variant, for example).
|
|
22
|
+
*/
|
|
23
|
+
children(props: Props): React.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export declare const ComponentStatesTable: ({ rowProps, columnProps, children, }: ComponentStatesTableProps) => JSX.Element;
|
|
26
|
+
//# sourceMappingURL=ComponentStatesTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComponentStatesTable.d.ts","sourceRoot":"","sources":["../../../../testing/lib/ComponentStatesTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,eAAe,EAAE,KAAK,EAAC,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,QAAQ,EAAE,eAAe,EAAE,CAAC;IAC5B;;;;OAIG;IACH,WAAW,EAAE,eAAe,EAAE,CAAC;IAC/B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC;CACzC;AAgBD,eAAO,MAAM,oBAAoB,yCAI9B,yBAAyB,gBAkC3B,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ComponentStatesTable = void 0;
|
|
18
|
+
var react_1 = __importDefault(require("react"));
|
|
19
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
20
|
+
var Table = common_1.styled('table')({
|
|
21
|
+
width: '100%',
|
|
22
|
+
thead: {
|
|
23
|
+
textAlign: 'left',
|
|
24
|
+
paddingBottom: 16,
|
|
25
|
+
},
|
|
26
|
+
'td, th': {
|
|
27
|
+
minWidth: 100,
|
|
28
|
+
paddingBottom: 16,
|
|
29
|
+
paddingRight: 16,
|
|
30
|
+
textAlign: 'left',
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
var ComponentStatesTable = function (_a) {
|
|
34
|
+
var rowProps = _a.rowProps, columnProps = _a.columnProps, children = _a.children;
|
|
35
|
+
return (react_1.default.createElement(Table, null,
|
|
36
|
+
react_1.default.createElement("thead", null,
|
|
37
|
+
react_1.default.createElement("tr", null,
|
|
38
|
+
react_1.default.createElement("th", null, "Variants"),
|
|
39
|
+
columnProps.map(function (col) { return (react_1.default.createElement("th", { key: "component-table-heading-" + col.label.toLowerCase().replace(' ', ',') }, col.label)); }))),
|
|
40
|
+
react_1.default.createElement("tbody", null, rowProps.map(function (row) {
|
|
41
|
+
return (react_1.default.createElement("tr", { key: row.label.toLowerCase().replace(' ', '-') },
|
|
42
|
+
react_1.default.createElement("td", null, row.label),
|
|
43
|
+
columnProps.map(function (col) {
|
|
44
|
+
return (react_1.default.createElement("td", { key: col.label.toLowerCase().replace(' ', '-') }, children(__assign(__assign({}, row.props), col.props))));
|
|
45
|
+
})));
|
|
46
|
+
}))));
|
|
47
|
+
};
|
|
48
|
+
exports.ComponentStatesTable = ComponentStatesTable;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { PartialEmotionCanvasTheme, StyleRewriteFn } from '@workday/canvas-kit-react/common';
|
|
3
|
+
export declare const convertToStaticStates: StyleRewriteFn;
|
|
4
|
+
export declare const StaticStates: React.FC<React.PropsWithChildren<{
|
|
5
|
+
theme?: PartialEmotionCanvasTheme;
|
|
6
|
+
} & React.HTMLAttributes<HTMLElement>>>;
|
|
7
|
+
//# sourceMappingURL=StaticStates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StaticStates.d.ts","sourceRoot":"","sources":["../../../../testing/lib/StaticStates.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAIL,yBAAyB,EACzB,cAAc,EACf,MAAM,kCAAkC,CAAC;AAG1C,eAAO,MAAM,qBAAqB,EAAE,cAoBnC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,CACzD;IAAC,KAAK,CAAC,EAAE,yBAAyB,CAAA;CAAC,GAAG,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,CACxE,CASA,CAAC"}
|
|
@@ -67,7 +67,7 @@ exports.convertToStaticStates = convertToStaticStates;
|
|
|
67
67
|
var StaticStates = function (_a) {
|
|
68
68
|
var children = _a.children, theme = _a.theme, elemProps = __rest(_a, ["children", "theme"]);
|
|
69
69
|
var localTheme = common_1.useTheme(theme);
|
|
70
|
-
localTheme.
|
|
70
|
+
localTheme._styleRewriteFn = exports.convertToStaticStates;
|
|
71
71
|
return (React.createElement(common_1.CanvasProvider, __assign({ theme: localTheme }, elemProps), children));
|
|
72
72
|
};
|
|
73
73
|
exports.StaticStates = StaticStates;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PropCombination, PropDeclaration, Props, PropsDeclaration } from './propTypes';
|
|
2
|
+
export declare const permutateProps: (allProps: PropsDeclaration, filter?: ((props: Props) => boolean) | undefined, remainingProps?: string[], values?: {
|
|
3
|
+
[key: string]: PropDeclaration;
|
|
4
|
+
}) => PropCombination[];
|
|
5
|
+
//# sourceMappingURL=permutateProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permutateProps.d.ts","sourceRoot":"","sources":["../../../../testing/lib/permutateProps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAEtF,eAAO,MAAM,cAAc,aACf,gBAAgB,oBACT,KAAK,KAAK,OAAO,gCAClB,MAAM,EAAE;;MAEvB,eAAe,EAuCjB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.permutateProps = void 0;
|
|
15
|
+
var permutateProps = function (allProps, filter, remainingProps, values) {
|
|
16
|
+
if (remainingProps === void 0) { remainingProps = Object.keys(allProps); }
|
|
17
|
+
if (values === void 0) { values = {}; }
|
|
18
|
+
// When there are no more props to combine with, return result
|
|
19
|
+
var prop = remainingProps[0];
|
|
20
|
+
if (!prop) {
|
|
21
|
+
var props_1 = {};
|
|
22
|
+
Object.keys(values).forEach(function (prop) {
|
|
23
|
+
var _a;
|
|
24
|
+
props_1[prop] = (_a = values === null || values === void 0 ? void 0 : values[prop]) === null || _a === void 0 ? void 0 : _a.value;
|
|
25
|
+
});
|
|
26
|
+
if (filter && !filter(props_1)) {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
var label = Object.keys(values)
|
|
30
|
+
.map(function (prop) { var _a; return (_a = values === null || values === void 0 ? void 0 : values[prop]) === null || _a === void 0 ? void 0 : _a.label; })
|
|
31
|
+
.join(' ');
|
|
32
|
+
return [
|
|
33
|
+
{
|
|
34
|
+
label: label,
|
|
35
|
+
props: props_1,
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
var possiblePropValues = allProps[prop];
|
|
40
|
+
var permutations = possiblePropValues === null || possiblePropValues === void 0 ? void 0 : possiblePropValues.map(function (value) {
|
|
41
|
+
var newValues = __assign({}, values); // Required so we don't overwrite previous references
|
|
42
|
+
newValues[prop] = value;
|
|
43
|
+
return exports.permutateProps(allProps, filter, remainingProps.slice(1, remainingProps.length), newValues);
|
|
44
|
+
});
|
|
45
|
+
return permutations.flat();
|
|
46
|
+
};
|
|
47
|
+
exports.permutateProps = permutateProps;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare type PropDeclaration = {
|
|
2
|
+
value: any;
|
|
3
|
+
label: string;
|
|
4
|
+
};
|
|
5
|
+
export declare type PropsDeclaration = {
|
|
6
|
+
[key: string]: PropDeclaration[];
|
|
7
|
+
};
|
|
8
|
+
export declare type Props = {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
export declare type PropCombination = {
|
|
12
|
+
label: string;
|
|
13
|
+
props: Props;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=propTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propTypes.d.ts","sourceRoot":"","sources":["../../../../testing/lib/propTypes.ts"],"names":[],"mappings":"AAAA,oBAAY,eAAe,GAAG;IAC5B,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,oBAAY,gBAAgB,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,EAAE,CAAA;CAAC,CAAC;AAElE,oBAAY,KAAK,GAAG;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAEF,oBAAY,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;CACd,CAAC"}
|