@workday/canvas-kit-labs-react 6.8.9 → 6.9.0-next.5
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/combobox/README.md +1 -1
- package/combobox/lib/Combobox.tsx +12 -14
- package/common/README.md +10 -4
- package/common/index.ts +0 -8
- package/dist/commonjs/combobox/index.js +12 -4
- package/dist/commonjs/combobox/lib/AutocompleteList.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/AutocompleteList.js +19 -7
- package/dist/commonjs/combobox/lib/Combobox.d.ts +3 -4
- package/dist/commonjs/combobox/lib/Combobox.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/Combobox.js +31 -19
- package/dist/commonjs/combobox/lib/Status.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/Status.js +14 -2
- package/dist/commonjs/common/index.d.ts +0 -8
- package/dist/commonjs/common/index.d.ts.map +1 -1
- package/dist/commonjs/common/index.js +14 -7
- package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.d.ts.map +1 -1
- package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.js +3 -1
- package/dist/commonjs/common/lib/storybook-utils/permutateProps.d.ts.map +1 -1
- package/dist/commonjs/common/lib/storybook-utils/permutateProps.js +3 -1
- package/dist/commonjs/common/lib/theming/index.js +12 -5
- package/dist/commonjs/common/lib/theming/useThemeRTL.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/useThemeRTL.js +1 -0
- package/dist/commonjs/common/lib/theming/useThemedRing.d.ts +1 -1
- package/dist/commonjs/common/lib/theming/useThemedRing.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/useThemedRing.js +3 -1
- package/dist/commonjs/drawer/index.js +12 -4
- package/dist/commonjs/drawer/lib/Drawer.js +21 -8
- package/dist/commonjs/drawer/lib/DrawerHeader.js +22 -10
- package/dist/commonjs/index.d.ts +0 -2
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +14 -9
- package/dist/commonjs/search-form/index.js +12 -5
- package/dist/commonjs/search-form/lib/SearchForm.d.ts +3 -2
- package/dist/commonjs/search-form/lib/SearchForm.d.ts.map +1 -1
- package/dist/commonjs/search-form/lib/SearchForm.js +35 -28
- package/dist/commonjs/search-form/lib/themes.d.ts.map +1 -1
- package/dist/commonjs/search-form/lib/themes.js +1 -0
- package/dist/es6/combobox/lib/AutocompleteList.d.ts.map +1 -1
- package/dist/es6/combobox/lib/Combobox.d.ts +3 -4
- package/dist/es6/combobox/lib/Combobox.d.ts.map +1 -1
- package/dist/es6/combobox/lib/Combobox.js +6 -9
- package/dist/es6/combobox/lib/Status.d.ts.map +1 -1
- package/dist/es6/common/index.d.ts +0 -8
- package/dist/es6/common/index.d.ts.map +1 -1
- package/dist/es6/common/index.js +0 -1
- package/dist/es6/common/lib/storybook-utils/ComponentStatesTable.d.ts.map +1 -1
- package/dist/es6/common/lib/storybook-utils/permutateProps.d.ts.map +1 -1
- package/dist/es6/common/lib/storybook-utils/propTypes.js +1 -0
- package/dist/es6/common/lib/theming/useThemeRTL.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/useThemedRing.d.ts +1 -1
- package/dist/es6/common/lib/theming/useThemedRing.d.ts.map +1 -1
- package/dist/es6/drawer/lib/Drawer.js +1 -1
- package/dist/es6/drawer/lib/DrawerHeader.js +4 -4
- package/dist/es6/index.d.ts +0 -2
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +0 -2
- package/dist/es6/search-form/lib/SearchForm.d.ts +3 -2
- package/dist/es6/search-form/lib/SearchForm.d.ts.map +1 -1
- package/dist/es6/search-form/lib/SearchForm.js +16 -22
- package/dist/es6/search-form/lib/themes.d.ts.map +1 -1
- package/drawer/lib/DrawerHeader.tsx +3 -3
- package/index.ts +0 -2
- package/package.json +12 -22
- package/search-form/lib/SearchForm.tsx +21 -39
- package/search-form/lib/themes.ts +2 -1
- package/common/lib/Box.tsx +0 -87
- package/common/lib/utils/border.ts +0 -263
- package/common/lib/utils/color.ts +0 -62
- package/common/lib/utils/depth.ts +0 -37
- package/common/lib/utils/flexItem.ts +0 -56
- package/common/lib/utils/layout.ts +0 -77
- package/common/lib/utils/position.ts +0 -96
- package/common/lib/utils/space.ts +0 -207
- package/common/lib/utils/types.ts +0 -105
- package/dist/commonjs/common/lib/Box.d.ts +0 -30
- package/dist/commonjs/common/lib/Box.d.ts.map +0 -1
- package/dist/commonjs/common/lib/Box.js +0 -85
- package/dist/commonjs/common/lib/utils/border.d.ts +0 -103
- package/dist/commonjs/common/lib/utils/border.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/border.js +0 -152
- package/dist/commonjs/common/lib/utils/color.d.ts +0 -26
- package/dist/commonjs/common/lib/utils/color.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/color.js +0 -56
- package/dist/commonjs/common/lib/utils/depth.d.ts +0 -22
- package/dist/commonjs/common/lib/utils/depth.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/depth.js +0 -28
- package/dist/commonjs/common/lib/utils/flexItem.d.ts +0 -33
- package/dist/commonjs/common/lib/utils/flexItem.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/flexItem.js +0 -38
- package/dist/commonjs/common/lib/utils/layout.d.ts +0 -43
- package/dist/commonjs/common/lib/utils/layout.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/layout.js +0 -42
- package/dist/commonjs/common/lib/utils/position.d.ts +0 -41
- package/dist/commonjs/common/lib/utils/position.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/position.js +0 -77
- package/dist/commonjs/common/lib/utils/space.d.ts +0 -64
- package/dist/commonjs/common/lib/utils/space.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/space.js +0 -160
- package/dist/commonjs/common/lib/utils/types.d.ts +0 -14
- package/dist/commonjs/common/lib/utils/types.d.ts.map +0 -1
- package/dist/commonjs/common/lib/utils/types.js +0 -2
- package/dist/commonjs/header/index.d.ts +0 -9
- package/dist/commonjs/header/index.d.ts.map +0 -1
- package/dist/commonjs/header/index.js +0 -16
- package/dist/commonjs/header/lib/GlobalHeader.d.ts +0 -38
- package/dist/commonjs/header/lib/GlobalHeader.d.ts.map +0 -1
- package/dist/commonjs/header/lib/GlobalHeader.js +0 -74
- package/dist/commonjs/header/lib/Header.d.ts +0 -76
- package/dist/commonjs/header/lib/Header.d.ts.map +0 -1
- package/dist/commonjs/header/lib/Header.js +0 -321
- package/dist/commonjs/header/lib/parts/DubLogoTitle.d.ts +0 -30
- package/dist/commonjs/header/lib/parts/DubLogoTitle.d.ts.map +0 -1
- package/dist/commonjs/header/lib/parts/DubLogoTitle.js +0 -105
- package/dist/commonjs/header/lib/parts/WorkdayLogoTitle.d.ts +0 -31
- package/dist/commonjs/header/lib/parts/WorkdayLogoTitle.d.ts.map +0 -1
- package/dist/commonjs/header/lib/parts/WorkdayLogoTitle.js +0 -124
- package/dist/commonjs/header/lib/parts/index.d.ts +0 -3
- package/dist/commonjs/header/lib/parts/index.d.ts.map +0 -1
- package/dist/commonjs/header/lib/parts/index.js +0 -6
- package/dist/commonjs/header/lib/shared/themes.d.ts +0 -43
- package/dist/commonjs/header/lib/shared/themes.d.ts.map +0 -1
- package/dist/commonjs/header/lib/shared/themes.js +0 -62
- package/dist/commonjs/header/lib/shared/types.d.ts +0 -15
- package/dist/commonjs/header/lib/shared/types.d.ts.map +0 -1
- package/dist/commonjs/header/lib/shared/types.js +0 -19
- package/dist/commonjs/layout/index.d.ts +0 -5
- package/dist/commonjs/layout/index.d.ts.map +0 -1
- package/dist/commonjs/layout/index.js +0 -7
- package/dist/commonjs/layout/lib/Flex.d.ts +0 -26
- package/dist/commonjs/layout/lib/Flex.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/Flex.js +0 -70
- package/dist/commonjs/layout/lib/Stack.d.ts +0 -27
- package/dist/commonjs/layout/lib/Stack.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/Stack.js +0 -86
- package/dist/commonjs/layout/lib/utils/flex.d.ts +0 -36
- package/dist/commonjs/layout/lib/utils/flex.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/utils/flex.js +0 -37
- package/dist/commonjs/layout/lib/utils/getValidChildren.d.ts +0 -3
- package/dist/commonjs/layout/lib/utils/getValidChildren.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/utils/getValidChildren.js +0 -16
- package/dist/commonjs/layout/lib/utils/stack.d.ts +0 -26
- package/dist/commonjs/layout/lib/utils/stack.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/utils/stack.js +0 -54
- package/dist/commonjs/layout/lib/utils/types.d.ts +0 -8
- package/dist/commonjs/layout/lib/utils/types.d.ts.map +0 -1
- package/dist/commonjs/layout/lib/utils/types.js +0 -2
- package/dist/es6/common/lib/Box.d.ts +0 -30
- package/dist/es6/common/lib/Box.d.ts.map +0 -1
- package/dist/es6/common/lib/Box.js +0 -73
- package/dist/es6/common/lib/utils/border.d.ts +0 -103
- package/dist/es6/common/lib/utils/border.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/border.js +0 -149
- package/dist/es6/common/lib/utils/color.d.ts +0 -26
- package/dist/es6/common/lib/utils/color.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/color.js +0 -53
- package/dist/es6/common/lib/utils/depth.d.ts +0 -22
- package/dist/es6/common/lib/utils/depth.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/depth.js +0 -25
- package/dist/es6/common/lib/utils/flexItem.d.ts +0 -33
- package/dist/es6/common/lib/utils/flexItem.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/flexItem.js +0 -35
- package/dist/es6/common/lib/utils/layout.d.ts +0 -43
- package/dist/es6/common/lib/utils/layout.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/layout.js +0 -39
- package/dist/es6/common/lib/utils/position.d.ts +0 -41
- package/dist/es6/common/lib/utils/position.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/position.js +0 -74
- package/dist/es6/common/lib/utils/space.d.ts +0 -64
- package/dist/es6/common/lib/utils/space.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/space.js +0 -157
- package/dist/es6/common/lib/utils/types.d.ts +0 -14
- package/dist/es6/common/lib/utils/types.d.ts.map +0 -1
- package/dist/es6/common/lib/utils/types.js +0 -0
- package/dist/es6/header/index.d.ts +0 -9
- package/dist/es6/header/index.d.ts.map +0 -1
- package/dist/es6/header/index.js +0 -8
- package/dist/es6/header/lib/GlobalHeader.d.ts +0 -38
- package/dist/es6/header/lib/GlobalHeader.d.ts.map +0 -1
- package/dist/es6/header/lib/GlobalHeader.js +0 -62
- package/dist/es6/header/lib/Header.d.ts +0 -76
- package/dist/es6/header/lib/Header.d.ts.map +0 -1
- package/dist/es6/header/lib/Header.js +0 -309
- package/dist/es6/header/lib/parts/DubLogoTitle.d.ts +0 -30
- package/dist/es6/header/lib/parts/DubLogoTitle.d.ts.map +0 -1
- package/dist/es6/header/lib/parts/DubLogoTitle.js +0 -93
- package/dist/es6/header/lib/parts/WorkdayLogoTitle.d.ts +0 -31
- package/dist/es6/header/lib/parts/WorkdayLogoTitle.d.ts.map +0 -1
- package/dist/es6/header/lib/parts/WorkdayLogoTitle.js +0 -112
- package/dist/es6/header/lib/parts/index.d.ts +0 -3
- package/dist/es6/header/lib/parts/index.d.ts.map +0 -1
- package/dist/es6/header/lib/parts/index.js +0 -2
- package/dist/es6/header/lib/shared/themes.d.ts +0 -43
- package/dist/es6/header/lib/shared/themes.d.ts.map +0 -1
- package/dist/es6/header/lib/shared/themes.js +0 -57
- package/dist/es6/header/lib/shared/types.d.ts +0 -15
- package/dist/es6/header/lib/shared/types.d.ts.map +0 -1
- package/dist/es6/header/lib/shared/types.js +0 -17
- package/dist/es6/layout/index.d.ts +0 -5
- package/dist/es6/layout/index.d.ts.map +0 -1
- package/dist/es6/layout/index.js +0 -2
- package/dist/es6/layout/lib/Flex.d.ts +0 -26
- package/dist/es6/layout/lib/Flex.d.ts.map +0 -1
- package/dist/es6/layout/lib/Flex.js +0 -58
- package/dist/es6/layout/lib/Stack.d.ts +0 -27
- package/dist/es6/layout/lib/Stack.d.ts.map +0 -1
- package/dist/es6/layout/lib/Stack.js +0 -74
- package/dist/es6/layout/lib/utils/flex.d.ts +0 -36
- package/dist/es6/layout/lib/utils/flex.d.ts.map +0 -1
- package/dist/es6/layout/lib/utils/flex.js +0 -34
- package/dist/es6/layout/lib/utils/getValidChildren.d.ts +0 -3
- package/dist/es6/layout/lib/utils/getValidChildren.d.ts.map +0 -1
- package/dist/es6/layout/lib/utils/getValidChildren.js +0 -6
- package/dist/es6/layout/lib/utils/stack.d.ts +0 -26
- package/dist/es6/layout/lib/utils/stack.d.ts.map +0 -1
- package/dist/es6/layout/lib/utils/stack.js +0 -51
- package/dist/es6/layout/lib/utils/types.d.ts +0 -8
- package/dist/es6/layout/lib/utils/types.d.ts.map +0 -1
- package/dist/es6/layout/lib/utils/types.js +0 -0
- package/header/LICENSE +0 -51
- package/header/README.md +0 -359
- package/header/index.ts +0 -9
- package/header/lib/GlobalHeader.tsx +0 -73
- package/header/lib/Header.tsx +0 -429
- package/header/lib/parts/DubLogoTitle.tsx +0 -99
- package/header/lib/parts/WorkdayLogoTitle.tsx +0 -120
- package/header/lib/parts/index.ts +0 -2
- package/header/lib/shared/themes.tsx +0 -97
- package/header/lib/shared/types.tsx +0 -16
- package/header/package.json +0 -5
- package/layout/LICENSE +0 -52
- package/layout/README.md +0 -16
- package/layout/index.ts +0 -4
- package/layout/lib/Flex.tsx +0 -47
- package/layout/lib/Stack.tsx +0 -113
- package/layout/lib/utils/flex.ts +0 -65
- package/layout/lib/utils/getValidChildren.ts +0 -7
- package/layout/lib/utils/stack.ts +0 -78
- package/layout/lib/utils/types.ts +0 -45
- package/layout/package.json +0 -5
- package/ts3.5/dist/commonjs/combobox/index.d.ts +0 -5
- package/ts3.5/dist/commonjs/combobox/lib/AutocompleteList.d.ts +0 -32
- package/ts3.5/dist/commonjs/combobox/lib/Combobox.d.ts +0 -64
- package/ts3.5/dist/commonjs/combobox/lib/Status.d.ts +0 -11
- package/ts3.5/dist/commonjs/common/index.d.ts +0 -12
- package/ts3.5/dist/commonjs/common/lib/Box.d.ts +0 -30
- package/ts3.5/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.d.ts +0 -26
- package/ts3.5/dist/commonjs/common/lib/storybook-utils/permutateProps.d.ts +0 -5
- package/ts3.5/dist/commonjs/common/lib/storybook-utils/propTypes.d.ts +0 -15
- package/ts3.5/dist/commonjs/common/lib/theming/index.d.ts +0 -3
- package/ts3.5/dist/commonjs/common/lib/theming/useThemeRTL.d.ts +0 -36
- package/ts3.5/dist/commonjs/common/lib/theming/useThemedRing.d.ts +0 -11
- package/ts3.5/dist/commonjs/common/lib/utils/border.d.ts +0 -103
- package/ts3.5/dist/commonjs/common/lib/utils/color.d.ts +0 -26
- package/ts3.5/dist/commonjs/common/lib/utils/depth.d.ts +0 -22
- package/ts3.5/dist/commonjs/common/lib/utils/flexItem.d.ts +0 -33
- package/ts3.5/dist/commonjs/common/lib/utils/layout.d.ts +0 -43
- package/ts3.5/dist/commonjs/common/lib/utils/position.d.ts +0 -41
- package/ts3.5/dist/commonjs/common/lib/utils/space.d.ts +0 -64
- package/ts3.5/dist/commonjs/common/lib/utils/types.d.ts +0 -14
- package/ts3.5/dist/commonjs/drawer/index.d.ts +0 -6
- package/ts3.5/dist/commonjs/drawer/lib/Drawer.d.ts +0 -49
- package/ts3.5/dist/commonjs/drawer/lib/DrawerHeader.d.ts +0 -38
- package/ts3.5/dist/commonjs/header/index.d.ts +0 -9
- package/ts3.5/dist/commonjs/header/lib/GlobalHeader.d.ts +0 -38
- package/ts3.5/dist/commonjs/header/lib/Header.d.ts +0 -76
- package/ts3.5/dist/commonjs/header/lib/parts/DubLogoTitle.d.ts +0 -30
- package/ts3.5/dist/commonjs/header/lib/parts/WorkdayLogoTitle.d.ts +0 -31
- package/ts3.5/dist/commonjs/header/lib/parts/index.d.ts +0 -3
- package/ts3.5/dist/commonjs/header/lib/shared/themes.d.ts +0 -43
- package/ts3.5/dist/commonjs/header/lib/shared/types.d.ts +0 -15
- package/ts3.5/dist/commonjs/index.d.ts +0 -7
- package/ts3.5/dist/commonjs/layout/index.d.ts +0 -5
- package/ts3.5/dist/commonjs/layout/lib/Flex.d.ts +0 -26
- package/ts3.5/dist/commonjs/layout/lib/Stack.d.ts +0 -27
- package/ts3.5/dist/commonjs/layout/lib/utils/flex.d.ts +0 -36
- package/ts3.5/dist/commonjs/layout/lib/utils/getValidChildren.d.ts +0 -3
- package/ts3.5/dist/commonjs/layout/lib/utils/stack.d.ts +0 -26
- package/ts3.5/dist/commonjs/layout/lib/utils/types.d.ts +0 -8
- package/ts3.5/dist/commonjs/search-form/index.d.ts +0 -3
- package/ts3.5/dist/commonjs/search-form/lib/SearchForm.d.ts +0 -107
- package/ts3.5/dist/commonjs/search-form/lib/themes.d.ts +0 -21
- package/ts3.5/dist/es6/combobox/index.d.ts +0 -5
- package/ts3.5/dist/es6/combobox/lib/AutocompleteList.d.ts +0 -32
- package/ts3.5/dist/es6/combobox/lib/Combobox.d.ts +0 -64
- package/ts3.5/dist/es6/combobox/lib/Status.d.ts +0 -11
- package/ts3.5/dist/es6/common/index.d.ts +0 -12
- package/ts3.5/dist/es6/common/lib/Box.d.ts +0 -30
- package/ts3.5/dist/es6/common/lib/storybook-utils/ComponentStatesTable.d.ts +0 -26
- package/ts3.5/dist/es6/common/lib/storybook-utils/permutateProps.d.ts +0 -5
- package/ts3.5/dist/es6/common/lib/storybook-utils/propTypes.d.ts +0 -15
- package/ts3.5/dist/es6/common/lib/theming/index.d.ts +0 -3
- package/ts3.5/dist/es6/common/lib/theming/useThemeRTL.d.ts +0 -36
- package/ts3.5/dist/es6/common/lib/theming/useThemedRing.d.ts +0 -11
- package/ts3.5/dist/es6/common/lib/utils/border.d.ts +0 -103
- package/ts3.5/dist/es6/common/lib/utils/color.d.ts +0 -26
- package/ts3.5/dist/es6/common/lib/utils/depth.d.ts +0 -22
- package/ts3.5/dist/es6/common/lib/utils/flexItem.d.ts +0 -33
- package/ts3.5/dist/es6/common/lib/utils/layout.d.ts +0 -43
- package/ts3.5/dist/es6/common/lib/utils/position.d.ts +0 -41
- package/ts3.5/dist/es6/common/lib/utils/space.d.ts +0 -64
- package/ts3.5/dist/es6/common/lib/utils/types.d.ts +0 -14
- package/ts3.5/dist/es6/drawer/index.d.ts +0 -6
- package/ts3.5/dist/es6/drawer/lib/Drawer.d.ts +0 -49
- package/ts3.5/dist/es6/drawer/lib/DrawerHeader.d.ts +0 -38
- package/ts3.5/dist/es6/header/index.d.ts +0 -9
- package/ts3.5/dist/es6/header/lib/GlobalHeader.d.ts +0 -38
- package/ts3.5/dist/es6/header/lib/Header.d.ts +0 -76
- package/ts3.5/dist/es6/header/lib/parts/DubLogoTitle.d.ts +0 -30
- package/ts3.5/dist/es6/header/lib/parts/WorkdayLogoTitle.d.ts +0 -31
- package/ts3.5/dist/es6/header/lib/parts/index.d.ts +0 -3
- package/ts3.5/dist/es6/header/lib/shared/themes.d.ts +0 -43
- package/ts3.5/dist/es6/header/lib/shared/types.d.ts +0 -15
- package/ts3.5/dist/es6/index.d.ts +0 -7
- package/ts3.5/dist/es6/layout/index.d.ts +0 -5
- package/ts3.5/dist/es6/layout/lib/Flex.d.ts +0 -26
- package/ts3.5/dist/es6/layout/lib/Stack.d.ts +0 -27
- package/ts3.5/dist/es6/layout/lib/utils/flex.d.ts +0 -36
- package/ts3.5/dist/es6/layout/lib/utils/getValidChildren.d.ts +0 -3
- package/ts3.5/dist/es6/layout/lib/utils/stack.d.ts +0 -26
- package/ts3.5/dist/es6/layout/lib/utils/types.d.ts +0 -8
- package/ts3.5/dist/es6/search-form/index.d.ts +0 -3
- package/ts3.5/dist/es6/search-form/lib/SearchForm.d.ts +0 -107
- package/ts3.5/dist/es6/search-form/lib/themes.d.ts +0 -21
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import {colors as colorTokens, CanvasColor} from '@workday/canvas-kit-react/tokens';
|
|
2
|
-
|
|
3
|
-
export type ColorTokens = typeof colorTokens;
|
|
4
|
-
|
|
5
|
-
/** style props to for color properties */
|
|
6
|
-
export type ColorStyleProps = {
|
|
7
|
-
/** sets `background` property */
|
|
8
|
-
background?: CanvasColor | (string & {});
|
|
9
|
-
/** sets `background-color` property */
|
|
10
|
-
backgroundColor?: CanvasColor | (string & {});
|
|
11
|
-
/** sets `background-image` property */
|
|
12
|
-
backgroundImage?: string;
|
|
13
|
-
/** sets `color` property */
|
|
14
|
-
color?: CanvasColor | (string & {});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const getBackground = (value: CanvasColor | string) => ({
|
|
18
|
-
background: colorTokens[value] || value,
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const getBackgroundColor = (value: CanvasColor | string) => ({
|
|
22
|
-
backgroundColor: colorTokens[value] || value,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const getBackgroundImage = (value: string) => ({
|
|
26
|
-
backgroundImage: value,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
const getColor = (value: CanvasColor | string) => ({
|
|
30
|
-
color: colorTokens[value] || value,
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
const colorProps = {
|
|
34
|
-
background: getBackground,
|
|
35
|
-
backgroundColor: getBackgroundColor,
|
|
36
|
-
backgroundImage: getBackgroundImage,
|
|
37
|
-
color: getColor,
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* A style prop function that takes components props and returns color styles from canvas token values.
|
|
42
|
-
* If no `ColorStyleProps` are found, it returns an empty object.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* // You'll most likely use `color` with low-level, styled components
|
|
46
|
-
* const BoxExample = () => (
|
|
47
|
-
* <Box backgroundColor="blueberry500" color="frenchVanilla100">Hello, colors!</Box>
|
|
48
|
-
* );
|
|
49
|
-
*
|
|
50
|
-
*/
|
|
51
|
-
export function color<P extends ColorStyleProps>(props: P) {
|
|
52
|
-
let styles = {};
|
|
53
|
-
for (const key in props) {
|
|
54
|
-
if (key in colorProps) {
|
|
55
|
-
const value = props[key as keyof ColorStyleProps] as CanvasColor | string;
|
|
56
|
-
const colorFn = colorProps[key as keyof ColorStyleProps];
|
|
57
|
-
const style = colorFn(value);
|
|
58
|
-
styles = {...styles, ...style};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return styles;
|
|
62
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import {depth as depthTokens} from '@workday/canvas-kit-react/tokens';
|
|
2
|
-
|
|
3
|
-
export type DepthTokens = typeof depthTokens;
|
|
4
|
-
export type DepthTokenKeys = keyof DepthTokens;
|
|
5
|
-
export type DepthTokenValues = DepthTokens[keyof DepthTokens];
|
|
6
|
-
|
|
7
|
-
/** style props to for depth styles */
|
|
8
|
-
export type DepthStyleProps = {
|
|
9
|
-
/** sets depth styles (box-shadow & border) */
|
|
10
|
-
depth?: DepthTokenKeys;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const depthProps = {
|
|
14
|
-
depth: (token: DepthTokenKeys) => depthTokens[token],
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* A style prop function that takes components props and returns depth styles from canvas token values.
|
|
19
|
-
* If no `DepthStyleProps` are found, it returns an empty object.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* // You'll mostly likely use `depth` with low-level, styled components
|
|
23
|
-
* const BoxExample = () => (
|
|
24
|
-
* <Box depth={3}>Hello, box shadows!</Box>
|
|
25
|
-
* );
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
export function depth<P extends DepthStyleProps>(props: P): DepthTokenValues {
|
|
29
|
-
for (const key in props) {
|
|
30
|
-
if (key in depthProps) {
|
|
31
|
-
const token = props[key as keyof DepthStyleProps] as DepthTokenKeys;
|
|
32
|
-
const depthFn = depthProps[key as keyof DepthStyleProps];
|
|
33
|
-
return depthFn(token);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return {} as DepthTokenValues;
|
|
37
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {PropertyJustifySelf, PropertyAlignSelf, PropertyOrder} from './types';
|
|
2
|
-
|
|
3
|
-
/** style props to for flexbox item properties */
|
|
4
|
-
export type FlexItemStyleProps = {
|
|
5
|
-
/** sets `flex` property */
|
|
6
|
-
flex?: number | string;
|
|
7
|
-
/** sets `flex-grow` property */
|
|
8
|
-
flexGrow?: number | string;
|
|
9
|
-
/** sets `flex-shrink` property */
|
|
10
|
-
flexShrink?: number | string;
|
|
11
|
-
/** sets `flex-basis` property */
|
|
12
|
-
flexBasis?: number | string;
|
|
13
|
-
/** sets `justify-self` property */
|
|
14
|
-
justifySelf?: PropertyJustifySelf;
|
|
15
|
-
/** sets `align-self` property */
|
|
16
|
-
alignSelf?: PropertyAlignSelf;
|
|
17
|
-
/** sets `order` property */
|
|
18
|
-
order?: PropertyOrder;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/** style props to for flexbox item properties */
|
|
22
|
-
const flexItemProps = {
|
|
23
|
-
flex: 'flex',
|
|
24
|
-
flexGrow: 'flexGrow',
|
|
25
|
-
flexShrink: 'flexShrink',
|
|
26
|
-
flexBasis: 'flexBasis',
|
|
27
|
-
justifySelf: 'justifySelf',
|
|
28
|
-
alignSelf: 'alignSelf',
|
|
29
|
-
order: 'order',
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* A style prop function that takes component props and returns flexbox item styles.
|
|
34
|
-
* If no `FlexItemStyleProps` are found, it returns an empty object.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* // You'll most likely use `flexItem` with low-level, styled components
|
|
38
|
-
* const FlexItemExample = () => (
|
|
39
|
-
* <Box flex={1} flexBasis="auto" alignSelf={center}>
|
|
40
|
-
* Hello, flex item!
|
|
41
|
-
* </Box>
|
|
42
|
-
* );
|
|
43
|
-
*
|
|
44
|
-
*/
|
|
45
|
-
export function flexItem<P extends FlexItemStyleProps>(props: P) {
|
|
46
|
-
const styles = {};
|
|
47
|
-
for (const key in props) {
|
|
48
|
-
if (key in flexItemProps) {
|
|
49
|
-
const attr = flexItemProps[key as keyof FlexItemStyleProps];
|
|
50
|
-
const value = props[key];
|
|
51
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
52
|
-
styles[attr] = value;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return styles;
|
|
56
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PropertyDisplay,
|
|
3
|
-
PropertyListStyle,
|
|
4
|
-
PropertyOverflow,
|
|
5
|
-
PropertyOverflowX,
|
|
6
|
-
PropertyOverflowY,
|
|
7
|
-
PropertyVerticalAlign,
|
|
8
|
-
} from './types';
|
|
9
|
-
|
|
10
|
-
/** style props to for layout properties */
|
|
11
|
-
export type LayoutStyleProps = {
|
|
12
|
-
/** sets `display` property */
|
|
13
|
-
display?: PropertyDisplay;
|
|
14
|
-
/** sets `height` property */
|
|
15
|
-
height?: number | string;
|
|
16
|
-
/** sets `list-style property */
|
|
17
|
-
listStyle?: PropertyListStyle;
|
|
18
|
-
/** sets `max-height` property */
|
|
19
|
-
maxHeight?: number | string;
|
|
20
|
-
/** sets `max-width` property */
|
|
21
|
-
maxWidth?: number | string;
|
|
22
|
-
/** sets `min-height` property */
|
|
23
|
-
minHeight?: number | string;
|
|
24
|
-
/** sets `min-width` property */
|
|
25
|
-
minWidth?: number | string;
|
|
26
|
-
/** sets `overflow` property */
|
|
27
|
-
overflow?: PropertyOverflow;
|
|
28
|
-
/** sets `overflow-x` property */
|
|
29
|
-
overflowX?: PropertyOverflowX;
|
|
30
|
-
/** sets `overflow-y` property */
|
|
31
|
-
overflowY?: PropertyOverflowY;
|
|
32
|
-
/** sets `vertical-align` property */
|
|
33
|
-
verticalAlign?: PropertyVerticalAlign;
|
|
34
|
-
/** sets `width` property */
|
|
35
|
-
width?: number | string;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const layoutProps = {
|
|
39
|
-
display: 'display',
|
|
40
|
-
height: 'height',
|
|
41
|
-
listStyle: 'listStyle',
|
|
42
|
-
maxHeight: 'maxHeight',
|
|
43
|
-
maxWidth: 'maxWidth',
|
|
44
|
-
minHeight: 'minHeight',
|
|
45
|
-
minWidth: 'minWidth',
|
|
46
|
-
overflow: 'overflow',
|
|
47
|
-
overflowX: 'overflowX',
|
|
48
|
-
overflowY: 'overflowY',
|
|
49
|
-
verticalAlign: 'verticalAlign',
|
|
50
|
-
width: 'width',
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* A style prop function that takes components props and returns layout styles.
|
|
55
|
-
* If no `LayoutStyleProps` are found, it returns an empty object.
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* // You'll most likely use `layout` with low-level, styled components
|
|
59
|
-
* const BoxExample = () => (
|
|
60
|
-
* <Box display="inline-block" height="50%">
|
|
61
|
-
* Hello, positions!
|
|
62
|
-
* </Box>
|
|
63
|
-
* );
|
|
64
|
-
*
|
|
65
|
-
*/
|
|
66
|
-
export function layout<P extends LayoutStyleProps>(props: P) {
|
|
67
|
-
const styles = {};
|
|
68
|
-
for (const key in props) {
|
|
69
|
-
if (key in layoutProps) {
|
|
70
|
-
const attr = layoutProps[key as keyof LayoutStyleProps];
|
|
71
|
-
const value = props[key];
|
|
72
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
73
|
-
styles[attr] = value;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return styles;
|
|
77
|
-
}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ContentDirection,
|
|
3
|
-
PartialEmotionCanvasTheme,
|
|
4
|
-
useTheme,
|
|
5
|
-
} from '@workday/canvas-kit-react/common';
|
|
6
|
-
import {PropertyPosition, PropertyZIndex} from './types';
|
|
7
|
-
|
|
8
|
-
/** style props to for standard position properties */
|
|
9
|
-
export type PositionStandardProps = {
|
|
10
|
-
/** sets `position` property */
|
|
11
|
-
position?: PropertyPosition;
|
|
12
|
-
/** sets `zIndex` property */
|
|
13
|
-
zIndex?: PropertyZIndex;
|
|
14
|
-
/** sets `top` property */
|
|
15
|
-
top?: number | string;
|
|
16
|
-
/** sets `right` property (no bidirectional support) */
|
|
17
|
-
right?: number | string;
|
|
18
|
-
/** sets `bottom` property */
|
|
19
|
-
bottom?: number | string;
|
|
20
|
-
/** sets `left` property (no bidirectional support) */
|
|
21
|
-
left?: number | string;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export type PositionLogicalProps = {
|
|
25
|
-
/** sets `left` property (bidirectional support) */
|
|
26
|
-
insetInlineStart?: number | string;
|
|
27
|
-
/** sets `right` property (bidirectional support) */
|
|
28
|
-
insetInlineEnd?: number | string;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const getInsetInlineStartStyle = (value: number | string, isRTL = false) => {
|
|
32
|
-
const attr = isRTL ? 'right' : 'left';
|
|
33
|
-
return {[attr]: value};
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const getInsetInlineEndStyle = (value: number | string, isRTL = false) => {
|
|
37
|
-
const attr = isRTL ? 'left' : 'right';
|
|
38
|
-
return {[attr]: value};
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const standardPositionProps = {
|
|
42
|
-
position: 'position',
|
|
43
|
-
zIndex: 'zIndex',
|
|
44
|
-
top: 'top',
|
|
45
|
-
right: 'right',
|
|
46
|
-
bottom: 'bottom',
|
|
47
|
-
left: 'left',
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const logicalPositionProps = {
|
|
51
|
-
insetInlineStart: getInsetInlineStartStyle,
|
|
52
|
-
insetInlineEnd: getInsetInlineEndStyle,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
export type PositionStyleProps = PositionStandardProps & PositionLogicalProps;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* A style prop function that takes components props and returns position styles.
|
|
59
|
-
* If no `PositionProps` are found, it returns an empty object.
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
* // You'll most likely use `position` with low-level, styled components
|
|
63
|
-
* const BoxExample = () => (
|
|
64
|
-
* <Box position="absolute" top="50%">
|
|
65
|
-
* Hello, positions!
|
|
66
|
-
* </Box>
|
|
67
|
-
* );
|
|
68
|
-
*
|
|
69
|
-
*/
|
|
70
|
-
export function position<P extends PositionStyleProps & {theme?: PartialEmotionCanvasTheme}>(
|
|
71
|
-
props: P
|
|
72
|
-
) {
|
|
73
|
-
// position will always be used within the context of a component, but eslint doesn't know that
|
|
74
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
75
|
-
const {canvas} = useTheme(props.theme);
|
|
76
|
-
let styles = {};
|
|
77
|
-
for (const key in props) {
|
|
78
|
-
if (key in props) {
|
|
79
|
-
if (key in standardPositionProps) {
|
|
80
|
-
const value = props[key];
|
|
81
|
-
const attr = standardPositionProps[key as keyof PositionStandardProps];
|
|
82
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
83
|
-
styles[attr] = value;
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
86
|
-
if (key in logicalPositionProps) {
|
|
87
|
-
const value = props[key as keyof PositionLogicalProps] as string | number;
|
|
88
|
-
const styleFn = logicalPositionProps[key as keyof PositionLogicalProps];
|
|
89
|
-
const isRTL = canvas.direction === ContentDirection.RTL;
|
|
90
|
-
const style = styleFn(value, isRTL);
|
|
91
|
-
styles = {...styles, ...style};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return styles;
|
|
96
|
-
}
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ContentDirection,
|
|
3
|
-
PartialEmotionCanvasTheme,
|
|
4
|
-
useTheme,
|
|
5
|
-
} from '@workday/canvas-kit-react/common';
|
|
6
|
-
import {space as spaceTokens, CanvasSpace, CanvasSpaceKeys} from '@workday/canvas-kit-react/tokens';
|
|
7
|
-
|
|
8
|
-
type SpacePropValues = CanvasSpaceKeys | number | (string & {});
|
|
9
|
-
|
|
10
|
-
/** These props automatically adjust for bidirectionality (LTR & RTL) */
|
|
11
|
-
export type SpaceLogicalProps = {
|
|
12
|
-
/** sets margin-left property (bidirectional support) */
|
|
13
|
-
marginInlineStart?: SpacePropValues;
|
|
14
|
-
/** sets margin-right property (bidirectional support) */
|
|
15
|
-
marginInlineEnd?: SpacePropValues;
|
|
16
|
-
/** sets padding-left property (bidirectional support) */
|
|
17
|
-
paddingInlineStart?: SpacePropValues;
|
|
18
|
-
/** sets padding-right property (bidirectional support) */
|
|
19
|
-
paddingInlineEnd?: SpacePropValues;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/** These props do not adjust for bidirectionality (LTR & RTL) */
|
|
23
|
-
export type SpaceStandardProps = {
|
|
24
|
-
/** sets margin property */
|
|
25
|
-
margin?: SpacePropValues;
|
|
26
|
-
/** sets margin-left and margin-right properties */
|
|
27
|
-
marginX?: SpacePropValues;
|
|
28
|
-
/** sets margin-top and margin-bottom properties */
|
|
29
|
-
marginY?: SpacePropValues;
|
|
30
|
-
/** sets margin-top property */
|
|
31
|
-
marginTop?: SpacePropValues;
|
|
32
|
-
/** sets margin-right property (no bidirectional support) */
|
|
33
|
-
marginRight?: SpacePropValues;
|
|
34
|
-
/** sets margin-bottom property */
|
|
35
|
-
marginBottom?: SpacePropValues;
|
|
36
|
-
/** sets margin-left property (no bidirectional support) */
|
|
37
|
-
marginLeft?: SpacePropValues;
|
|
38
|
-
/** sets padding property */
|
|
39
|
-
padding?: SpacePropValues;
|
|
40
|
-
/** sets padding-left and margin-right properties */
|
|
41
|
-
paddingX?: SpacePropValues;
|
|
42
|
-
/** sets padding-top and padding-bottom properties */
|
|
43
|
-
paddingY?: SpacePropValues;
|
|
44
|
-
/** sets padding-top property */
|
|
45
|
-
paddingTop?: SpacePropValues;
|
|
46
|
-
/** sets padding-right property (no bidirectional support) */
|
|
47
|
-
paddingRight?: SpacePropValues;
|
|
48
|
-
/** sets padding-bottom */
|
|
49
|
-
paddingBottom?: SpacePropValues;
|
|
50
|
-
/** sets padding-left property (no bidirectional support) */
|
|
51
|
-
paddingLeft?: SpacePropValues;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export type SpaceStyleProps = SpaceStandardProps & SpaceLogicalProps;
|
|
55
|
-
|
|
56
|
-
const margin = (value: SpacePropValues) => {
|
|
57
|
-
return {margin: spaceTokens[value as keyof CanvasSpace] || value};
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const marginX = (value: SpacePropValues) => {
|
|
61
|
-
return {
|
|
62
|
-
marginLeft: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
63
|
-
marginRight: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const marginY = (value: SpacePropValues) => {
|
|
68
|
-
return {
|
|
69
|
-
marginTop: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
70
|
-
marginBottom: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const marginTop = (value: SpacePropValues) => {
|
|
75
|
-
return {
|
|
76
|
-
marginTop: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const marginRight = (value: SpacePropValues, isRTL = false) => {
|
|
81
|
-
const attr = isRTL ? 'marginLeft' : 'marginRight';
|
|
82
|
-
return {
|
|
83
|
-
[attr]: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
const marginBottom = (value: SpacePropValues) => {
|
|
88
|
-
return {
|
|
89
|
-
marginBottom: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
const marginLeft = (value: SpacePropValues, isRTL = false) => {
|
|
94
|
-
const attr = isRTL ? 'marginRight' : 'marginLeft';
|
|
95
|
-
return {
|
|
96
|
-
[attr]: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const padding = (value: SpacePropValues) => {
|
|
101
|
-
return {
|
|
102
|
-
padding: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const paddingX = (value: SpacePropValues) => {
|
|
107
|
-
return {
|
|
108
|
-
paddingLeft: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
109
|
-
paddingRight: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
110
|
-
};
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
const paddingY = (value: SpacePropValues) => {
|
|
114
|
-
return {
|
|
115
|
-
paddingTop: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
116
|
-
paddingBottom: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
const paddingTop = (value: SpacePropValues) => {
|
|
121
|
-
return {
|
|
122
|
-
paddingTop: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
123
|
-
};
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const paddingRight = (value: SpacePropValues, isRTL = false) => {
|
|
127
|
-
const attr = isRTL ? 'paddingLeft' : 'paddingRight';
|
|
128
|
-
return {
|
|
129
|
-
[attr]: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const paddingBottom = (value: SpacePropValues) => {
|
|
134
|
-
return {
|
|
135
|
-
paddingBottom: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
136
|
-
};
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
const paddingLeft = (value: SpacePropValues, isRTL = false) => {
|
|
140
|
-
const attr = isRTL ? 'paddingRight' : 'paddingLeft';
|
|
141
|
-
return {
|
|
142
|
-
[attr]: spaceTokens[value as CanvasSpaceKeys] || value,
|
|
143
|
-
};
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
const logicalSpaceStyleProps = {
|
|
147
|
-
marginInlineStart: marginLeft,
|
|
148
|
-
marginInlineEnd: marginRight,
|
|
149
|
-
paddingInlineStart: paddingLeft,
|
|
150
|
-
paddingInlineEnd: paddingRight,
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const standardSpaceStyleProps = {
|
|
154
|
-
margin,
|
|
155
|
-
marginX,
|
|
156
|
-
marginY,
|
|
157
|
-
marginTop,
|
|
158
|
-
marginRight,
|
|
159
|
-
marginBottom,
|
|
160
|
-
marginLeft,
|
|
161
|
-
padding,
|
|
162
|
-
paddingX,
|
|
163
|
-
paddingY,
|
|
164
|
-
paddingTop,
|
|
165
|
-
paddingRight,
|
|
166
|
-
paddingBottom,
|
|
167
|
-
paddingLeft,
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* A style prop function that takes component props and returns space styles.
|
|
172
|
-
* If no `SpaceStyleProps` are found, it returns an empty object.
|
|
173
|
-
*
|
|
174
|
-
* @example
|
|
175
|
-
* // You'll most likely use `space` with low-level, styled components
|
|
176
|
-
* const BoxExample = () => (
|
|
177
|
-
* <Box padding="xs" margin="m">
|
|
178
|
-
* Hello, space!
|
|
179
|
-
* </Box>
|
|
180
|
-
* );
|
|
181
|
-
*
|
|
182
|
-
*/
|
|
183
|
-
export function space<P extends SpaceStyleProps & {theme?: PartialEmotionCanvasTheme}>(props: P) {
|
|
184
|
-
// space will always be used within the context of a component, but eslint doesn't know that
|
|
185
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
186
|
-
const {canvas} = useTheme(props.theme);
|
|
187
|
-
let styles = {};
|
|
188
|
-
for (const key in props) {
|
|
189
|
-
if (props.hasOwnProperty(key)) {
|
|
190
|
-
if (key in standardSpaceStyleProps) {
|
|
191
|
-
const value = props[key as keyof SpaceStandardProps] as SpacePropValues;
|
|
192
|
-
const spaceFn = standardSpaceStyleProps[key as keyof SpaceStandardProps];
|
|
193
|
-
const style = spaceFn(value);
|
|
194
|
-
styles = {...styles, ...style};
|
|
195
|
-
continue;
|
|
196
|
-
}
|
|
197
|
-
if (key in logicalSpaceStyleProps) {
|
|
198
|
-
const value = props[key as keyof SpaceLogicalProps] as SpacePropValues;
|
|
199
|
-
const spaceFn = logicalSpaceStyleProps[key as keyof SpaceLogicalProps];
|
|
200
|
-
const isRTL = canvas.direction === ContentDirection.RTL;
|
|
201
|
-
const style = spaceFn(value, isRTL);
|
|
202
|
-
styles = {...styles, ...style};
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
return styles;
|
|
207
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Globals,
|
|
3
|
-
GlobalsNumber,
|
|
4
|
-
SelfPosition,
|
|
5
|
-
DisplayOutside,
|
|
6
|
-
DisplayInside,
|
|
7
|
-
DisplayInternal,
|
|
8
|
-
DisplayLegacy,
|
|
9
|
-
LineStyle,
|
|
10
|
-
} from 'csstype';
|
|
11
|
-
|
|
12
|
-
// We're temporarily creating these types from csstype
|
|
13
|
-
// to improve type completion until we move to csstype v3.
|
|
14
|
-
|
|
15
|
-
// Border
|
|
16
|
-
export type PropertyBorder = Globals | LineStyle | (string & {});
|
|
17
|
-
|
|
18
|
-
// Flex Item
|
|
19
|
-
export type PropertyJustifySelf =
|
|
20
|
-
| Globals
|
|
21
|
-
| SelfPosition
|
|
22
|
-
| 'auto'
|
|
23
|
-
| 'baseline'
|
|
24
|
-
| 'left'
|
|
25
|
-
| 'normal'
|
|
26
|
-
| 'right'
|
|
27
|
-
| 'stretch'
|
|
28
|
-
| (string & {});
|
|
29
|
-
|
|
30
|
-
export type PropertyAlignSelf =
|
|
31
|
-
| Globals
|
|
32
|
-
| SelfPosition
|
|
33
|
-
| 'auto'
|
|
34
|
-
| 'baseline'
|
|
35
|
-
| 'normal'
|
|
36
|
-
| 'stretch'
|
|
37
|
-
| (string & {});
|
|
38
|
-
|
|
39
|
-
export type PropertyOrder = GlobalsNumber;
|
|
40
|
-
|
|
41
|
-
// Layout
|
|
42
|
-
export type PropertyDisplay =
|
|
43
|
-
| Globals
|
|
44
|
-
| DisplayOutside
|
|
45
|
-
| DisplayInside
|
|
46
|
-
| DisplayInternal
|
|
47
|
-
| DisplayLegacy
|
|
48
|
-
| 'contents'
|
|
49
|
-
| 'list-item'
|
|
50
|
-
| 'none'
|
|
51
|
-
| (string & {});
|
|
52
|
-
|
|
53
|
-
export type PropertyListStyle = Globals | 'inside' | 'none' | 'outside' | (string & {});
|
|
54
|
-
|
|
55
|
-
export type PropertyOverflow =
|
|
56
|
-
| Globals
|
|
57
|
-
| '-moz-hidden-unscrollable'
|
|
58
|
-
| 'auto'
|
|
59
|
-
| 'clip'
|
|
60
|
-
| 'hidden'
|
|
61
|
-
| 'scroll'
|
|
62
|
-
| 'visible'
|
|
63
|
-
| (string & {});
|
|
64
|
-
|
|
65
|
-
export type PropertyOverflowX =
|
|
66
|
-
| Globals
|
|
67
|
-
| '-moz-hidden-unscrollable'
|
|
68
|
-
| 'auto'
|
|
69
|
-
| 'clip'
|
|
70
|
-
| 'hidden'
|
|
71
|
-
| 'scroll'
|
|
72
|
-
| 'visible';
|
|
73
|
-
|
|
74
|
-
export type PropertyOverflowY =
|
|
75
|
-
| Globals
|
|
76
|
-
| '-moz-hidden-unscrollable'
|
|
77
|
-
| 'auto'
|
|
78
|
-
| 'clip'
|
|
79
|
-
| 'hidden'
|
|
80
|
-
| 'scroll'
|
|
81
|
-
| 'visible';
|
|
82
|
-
|
|
83
|
-
export type PropertyVerticalAlign =
|
|
84
|
-
| Globals
|
|
85
|
-
| 'baseline'
|
|
86
|
-
| 'bottom'
|
|
87
|
-
| 'middle'
|
|
88
|
-
| 'sub'
|
|
89
|
-
| 'super'
|
|
90
|
-
| 'text-bottom'
|
|
91
|
-
| 'text-top'
|
|
92
|
-
| 'top'
|
|
93
|
-
| (string & {});
|
|
94
|
-
|
|
95
|
-
// Position
|
|
96
|
-
export type PropertyPosition =
|
|
97
|
-
| Globals
|
|
98
|
-
| '-webkit-sticky'
|
|
99
|
-
| 'absolute'
|
|
100
|
-
| 'fixed'
|
|
101
|
-
| 'relative'
|
|
102
|
-
| 'static'
|
|
103
|
-
| 'sticky';
|
|
104
|
-
|
|
105
|
-
export type PropertyZIndex = GlobalsNumber | 'auto';
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { BorderStyleProps } from './utils/border';
|
|
3
|
-
import { ColorStyleProps } from './utils/color';
|
|
4
|
-
import { DepthStyleProps } from './utils/depth';
|
|
5
|
-
import { FlexItemStyleProps } from './utils/flexItem';
|
|
6
|
-
import { LayoutStyleProps } from './utils/layout';
|
|
7
|
-
import { PositionStyleProps } from './utils/position';
|
|
8
|
-
import { SpaceStyleProps } from './utils/space';
|
|
9
|
-
export declare type BoxProps = BorderStyleProps & ColorStyleProps & DepthStyleProps & FlexItemStyleProps & LayoutStyleProps & PositionStyleProps & SpaceStyleProps & {
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* `Box` is a primitive component that provides a common, ergonomic API around Canvas design tokens.
|
|
14
|
-
* It is highly flexible, and its primary purpose is to build other components.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* import { Box, BoxProps } from '@workday/canvas-kit-labs-react/common';
|
|
18
|
-
*
|
|
19
|
-
* interface CardProps extends BoxProps {
|
|
20
|
-
* // card-specific props
|
|
21
|
-
* }
|
|
22
|
-
*
|
|
23
|
-
* // `Card`'s default values are set using `BoxProps`
|
|
24
|
-
* const Card = (props: CardProps) => (
|
|
25
|
-
* <Box depth={2} padding="m" borderRadius="l" {...props}>Hello, Card!</Box>
|
|
26
|
-
* );
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
export declare const Box: import("@workday/canvas-kit-react/common").ElementComponent<"div", import("./utils/border").BorderShorthandStyleProps & import("./utils/border").BorderColorStyleProps & import("./utils/border").BorderRadiusStyleProps & import("./utils/border").BorderLineStyleProps & import("./utils/border").BorderWidthStyleProps & import("./utils/border").BorderLogicalStyleProps & ColorStyleProps & DepthStyleProps & FlexItemStyleProps & LayoutStyleProps & import("./utils/position").PositionStandardProps & import("./utils/position").PositionLogicalProps & import("./utils/space").SpaceStandardProps & import("./utils/space").SpaceLogicalProps>;
|
|
30
|
-
//# sourceMappingURL=Box.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../../common/lib/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAAS,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAQ,eAAe,EAAC,MAAM,eAAe,CAAC;AACrD,OAAO,EAAQ,eAAe,EAAC,MAAM,eAAe,CAAC;AACrD,OAAO,EAAW,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAS,gBAAgB,EAAC,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAW,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAQ,eAAe,EAAC,MAAM,eAAe,CAAC;AAErD,oBAAY,QAAQ,GAAG,gBAAgB,GACrC,eAAe,GACf,eAAe,GACf,kBAAkB,GAClB,gBAAgB,GAChB,kBAAkB,GAClB,eAAe,GAAG;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,CAAC;AAmCJ;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,GAAG,ynBAYd,CAAC"}
|