@workday/canvas-kit-labs-react 6.9.0-next.0 → 6.9.0-next.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/combobox/README.md +1 -1
- package/combobox/lib/Combobox.tsx +13 -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 +32 -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 +7 -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
|
@@ -2,7 +2,7 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
2
2
|
var extendStatics = function (d, b) {
|
|
3
3
|
extendStatics = Object.setPrototypeOf ||
|
|
4
4
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
6
|
return extendStatics(d, b);
|
|
7
7
|
};
|
|
8
8
|
return function (d, b) {
|
|
@@ -36,7 +36,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
36
36
|
import * as React from 'react';
|
|
37
37
|
import { colors, space, spaceNumbers } from '@workday/canvas-kit-react/tokens';
|
|
38
38
|
import { styled, generateUniqueId } from '@workday/canvas-kit-react/common';
|
|
39
|
-
import {
|
|
39
|
+
import { TertiaryButton } from '@workday/canvas-kit-react/button';
|
|
40
40
|
import { searchIcon, xIcon } from '@workday/canvas-system-icons-web';
|
|
41
41
|
import { FormField, FormFieldLabelPosition } from '@workday/canvas-kit-react/form-field';
|
|
42
42
|
import { Combobox } from '@workday/canvas-kit-labs-react/combobox';
|
|
@@ -106,26 +106,20 @@ var SearchContainer = styled('div')({
|
|
|
106
106
|
var SearchCombobox = styled(Combobox)({
|
|
107
107
|
width: "100%",
|
|
108
108
|
});
|
|
109
|
-
var SearchIcon = styled(
|
|
109
|
+
var SearchIcon = styled(TertiaryButton)(function (_a) {
|
|
110
110
|
var isCollapsed = _a.isCollapsed, isHidden = _a.isHidden;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
minWidth: size,
|
|
122
|
-
width: size,
|
|
123
|
-
minHeight: size,
|
|
124
|
-
height: size,
|
|
125
|
-
};
|
|
126
|
-
return __assign({ position: "absolute", margin: isCollapsed ? "auto " + space.xxs : "auto " + space.xxxs, top: 0, bottom: 0, left: 0, padding: 0, zIndex: 3, display: isHidden ? 'none' : 'flex' }, collapseStyles);
|
|
111
|
+
return {
|
|
112
|
+
position: "absolute",
|
|
113
|
+
margin: isCollapsed ? "auto " + space.xxs : "auto " + space.xxxs,
|
|
114
|
+
top: 0,
|
|
115
|
+
bottom: 0,
|
|
116
|
+
left: 0,
|
|
117
|
+
padding: 0,
|
|
118
|
+
zIndex: 3,
|
|
119
|
+
display: isHidden ? 'none' : 'flex',
|
|
120
|
+
};
|
|
127
121
|
});
|
|
128
|
-
var CloseButton = styled(
|
|
122
|
+
var CloseButton = styled(TertiaryButton)(function (_a) {
|
|
129
123
|
var isCollapsed = _a.isCollapsed, showForm = _a.showForm;
|
|
130
124
|
var collapseStyles = isCollapsed && showForm
|
|
131
125
|
? {
|
|
@@ -221,7 +215,7 @@ var SearchForm = /** @class */ (function (_super) {
|
|
|
221
215
|
background = formCollapsedBackground;
|
|
222
216
|
}
|
|
223
217
|
var isDarkBackground = chroma(background).get('lab.l') < 70;
|
|
224
|
-
return isDarkBackground ? 'inverse' :
|
|
218
|
+
return isDarkBackground ? 'inverse' : undefined;
|
|
225
219
|
};
|
|
226
220
|
_this.handleSubmit = function (event) {
|
|
227
221
|
event.preventDefault();
|
|
@@ -287,7 +281,7 @@ var SearchForm = /** @class */ (function (_super) {
|
|
|
287
281
|
React.createElement(SearchField, { grow: grow, id: this.labelId, inputId: "input-" + this.labelId, label: inputLabel, labelPosition: FormFieldLabelPosition.Hidden, useFieldset: false, isCollapsed: isCollapsed, showForm: this.state.showForm, height: height },
|
|
288
282
|
React.createElement(SearchCombobox, { initialValue: initialValue, clearButtonVariant: this.getIconButtonType(), autocompleteItems: autocompleteItems, onChange: this.handleSearchInputChange, onFocus: this.handleFocus, onBlur: this.handleBlur, showClearButton: !isCollapsed && showClearButton, clearButtonAriaLabel: clearButtonAriaLabel, labelId: this.labelId },
|
|
289
283
|
React.createElement(SearchInput, { ref: this.inputRef, value: this.state.searchQuery, placeholder: placeholder, isCollapsed: isCollapsed, inputColors: this.getThemeColors(), height: height, name: "search", autoComplete: "off" }))),
|
|
290
|
-
React.createElement(CloseButton, { "aria-label": closeButtonAriaLabel, icon: xIcon, isCollapsed: isCollapsed,
|
|
284
|
+
React.createElement(CloseButton, { "aria-label": closeButtonAriaLabel, icon: xIcon, isCollapsed: isCollapsed, showForm: this.state.showForm, onClick: this.closeCollapsedSearch, type: "button" }))));
|
|
291
285
|
};
|
|
292
286
|
SearchForm.Theme = SearchTheme;
|
|
293
287
|
return SearchForm;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../../../search-form/lib/themes.ts"],"names":[],"mappings":"AAGA,oBAAY,WAAW;IACrB,KAAK,IAAA;IACL,IAAI,IAAA;IACJ,WAAW,IAAA;CACZ;
|
|
1
|
+
{"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../../../search-form/lib/themes.ts"],"names":[],"mappings":"AAGA,oBAAY,WAAW;IACrB,KAAK,IAAA;IACL,IAAI,IAAA;IACJ,WAAW,IAAA;CACZ;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC9B,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,YAAY;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAAC;CACtC;AAED,eAAO,MAAM,YAAY,EAAE,YA6B1B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
3
|
import {colors, space, type, CanvasColor, typeColors} from '@workday/canvas-kit-react/tokens';
|
|
4
|
-
import {
|
|
4
|
+
import {TertiaryButton} from '@workday/canvas-kit-react/button';
|
|
5
5
|
import {xIcon} from '@workday/canvas-system-icons-web';
|
|
6
6
|
|
|
7
7
|
export interface DrawerHeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -69,7 +69,7 @@ const HeaderTitle = styled('h4')<Pick<DrawerHeaderProps, 'inverse'>>(
|
|
|
69
69
|
})
|
|
70
70
|
);
|
|
71
71
|
|
|
72
|
-
const CloseButton = styled(
|
|
72
|
+
const CloseButton = styled(TertiaryButton)({
|
|
73
73
|
margin: '-8px', // for inverse and plain button, we always want this margin
|
|
74
74
|
});
|
|
75
75
|
|
|
@@ -93,7 +93,7 @@ export default class DrawerHeader extends React.Component<DrawerHeaderProps, {}>
|
|
|
93
93
|
</HeaderTitle>
|
|
94
94
|
{onClose && closeIconAriaLabel && (
|
|
95
95
|
<CloseButton
|
|
96
|
-
variant={inverse ? 'inverse' :
|
|
96
|
+
variant={inverse ? 'inverse' : undefined}
|
|
97
97
|
onClick={onClose}
|
|
98
98
|
aria-label={closeIconAriaLabel}
|
|
99
99
|
icon={xIcon}
|
package/index.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-labs-react",
|
|
3
|
-
"version": "6.9.0-next.
|
|
3
|
+
"version": "6.9.0-next.4+8ddbb273",
|
|
4
4
|
"description": "Canvas Kit Labs is an incubator for new and experimental components. Since we have a rather rigorous process for getting components in at a production level, it can be valuable to make them available earlier while we continuously iterate on the API/functionality. The Labs modules allow us to do that as needed.",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,32 +10,24 @@
|
|
|
10
10
|
"types": "dist/es6/index.d.ts",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "
|
|
13
|
+
"url": "https://github.com/workday/canvas-kit.git",
|
|
14
|
+
"directory": "modules/labs-react"
|
|
14
15
|
},
|
|
15
16
|
"files": [
|
|
16
17
|
"*/package.json",
|
|
17
18
|
"*/lib/*",
|
|
18
19
|
"*/index.ts",
|
|
19
20
|
"dist/",
|
|
20
|
-
"index.ts"
|
|
21
|
-
"ts3.5/**/*"
|
|
21
|
+
"index.ts"
|
|
22
22
|
],
|
|
23
|
-
"typesVersions": {
|
|
24
|
-
"<=3.5": {
|
|
25
|
-
"*": [
|
|
26
|
-
"ts3.5/*"
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
23
|
"scripts": {
|
|
31
24
|
"watch": "yarn build:es6 -w",
|
|
32
25
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
33
|
-
"clean": "rimraf dist && rimraf
|
|
26
|
+
"clean": "rimraf dist && rimraf .build-info && mkdirp dist",
|
|
34
27
|
"build:cjs": "tsc -p tsconfig.cjs.json",
|
|
35
28
|
"build:es6": "tsc -p tsconfig.es6.json",
|
|
36
29
|
"build:rebuild": "npm-run-all clean build",
|
|
37
|
-
"build
|
|
38
|
-
"build": "npm-run-all --parallel build:cjs build:es6 --sequential build:downlevel-dts",
|
|
30
|
+
"build": "npm-run-all --parallel build:cjs build:es6",
|
|
39
31
|
"prepack": "node ../../utils/publish.js pre labs-react",
|
|
40
32
|
"postpack": "node ../../utils/publish.js post labs-react",
|
|
41
33
|
"depcheck": "node ../../utils/check-dependencies-exist.js",
|
|
@@ -52,19 +44,17 @@
|
|
|
52
44
|
"react": "^16.8 || ^17.0"
|
|
53
45
|
},
|
|
54
46
|
"dependencies": {
|
|
55
|
-
"@emotion/
|
|
56
|
-
"@emotion/
|
|
57
|
-
"@
|
|
58
|
-
"@workday/canvas-kit-
|
|
59
|
-
"@workday/canvas-
|
|
60
|
-
"@workday/canvas-system-icons-web": "1.0.41",
|
|
47
|
+
"@emotion/react": "^11.7.1",
|
|
48
|
+
"@emotion/styled": "^11.6.0",
|
|
49
|
+
"@workday/canvas-kit-preview-react": "^6.9.0-next.4+8ddbb273",
|
|
50
|
+
"@workday/canvas-kit-react": "^6.9.0-next.4+8ddbb273",
|
|
51
|
+
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
61
52
|
"chroma-js": "^2.1.0",
|
|
62
|
-
"csstype": "^2.6.17",
|
|
63
53
|
"lodash.flatten": "^4.4.0",
|
|
64
54
|
"rtl-css-js": "^1.14.1"
|
|
65
55
|
},
|
|
66
56
|
"devDependencies": {
|
|
67
57
|
"@types/lodash.flatten": "^4.4.6"
|
|
68
58
|
},
|
|
69
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "8ddbb27356d06d06508938ae073ce2006b6dc4fd"
|
|
70
60
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {CSSObject} from '@emotion/
|
|
2
|
+
import {CSSObject} from '@emotion/styled';
|
|
3
3
|
import {colors, space, spaceNumbers} from '@workday/canvas-kit-react/tokens';
|
|
4
4
|
import {GrowthBehavior, styled, generateUniqueId} from '@workday/canvas-kit-react/common';
|
|
5
|
-
import {
|
|
5
|
+
import {TertiaryButton, TertiaryButtonProps} from '@workday/canvas-kit-react/button';
|
|
6
6
|
import {searchIcon, xIcon} from '@workday/canvas-system-icons-web';
|
|
7
7
|
import {FormField, FormFieldLabelPosition} from '@workday/canvas-kit-react/form-field';
|
|
8
8
|
import {Combobox} from '@workday/canvas-kit-labs-react/combobox';
|
|
9
9
|
import {TextInput} from '@workday/canvas-kit-react/text-input';
|
|
10
10
|
import {MenuItemProps} from '@workday/canvas-kit-preview-react/menu';
|
|
11
|
-
import {
|
|
11
|
+
import {searchThemes, SearchTheme, SearchThemeAttributes} from './themes';
|
|
12
12
|
import chroma from 'chroma-js';
|
|
13
13
|
|
|
14
14
|
export interface SearchFormProps extends GrowthBehavior, React.FormHTMLAttributes<HTMLFormElement> {
|
|
@@ -169,39 +169,22 @@ const SearchCombobox = styled(Combobox)({
|
|
|
169
169
|
width: `100%`,
|
|
170
170
|
});
|
|
171
171
|
|
|
172
|
-
const SearchIcon = styled(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
minHeight: size,
|
|
187
|
-
height: size,
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
return {
|
|
191
|
-
position: `absolute`,
|
|
192
|
-
margin: isCollapsed ? `auto ${space.xxs}` : `auto ${space.xxxs}`,
|
|
193
|
-
top: 0,
|
|
194
|
-
bottom: 0,
|
|
195
|
-
left: 0,
|
|
196
|
-
padding: 0,
|
|
197
|
-
zIndex: 3,
|
|
198
|
-
display: isHidden ? 'none' : 'flex',
|
|
199
|
-
...collapseStyles,
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
);
|
|
172
|
+
const SearchIcon = styled(TertiaryButton)<
|
|
173
|
+
Pick<SearchFormProps, 'isCollapsed'> & {isHidden: boolean}
|
|
174
|
+
>(({isCollapsed, isHidden}) => {
|
|
175
|
+
return {
|
|
176
|
+
position: `absolute`,
|
|
177
|
+
margin: isCollapsed ? `auto ${space.xxs}` : `auto ${space.xxxs}`,
|
|
178
|
+
top: 0,
|
|
179
|
+
bottom: 0,
|
|
180
|
+
left: 0,
|
|
181
|
+
padding: 0,
|
|
182
|
+
zIndex: 3,
|
|
183
|
+
display: isHidden ? 'none' : 'flex',
|
|
184
|
+
};
|
|
185
|
+
});
|
|
203
186
|
|
|
204
|
-
const CloseButton = styled(
|
|
187
|
+
const CloseButton = styled(TertiaryButton)<
|
|
205
188
|
Pick<SearchFormProps, 'isCollapsed'> & Pick<SearchFormState, 'showForm'>
|
|
206
189
|
>(({isCollapsed, showForm}) => {
|
|
207
190
|
const collapseStyles: CSSObject =
|
|
@@ -325,13 +308,13 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
325
308
|
return getInputColors(theme, this.state.isFocused);
|
|
326
309
|
};
|
|
327
310
|
|
|
328
|
-
getIconButtonType = ():
|
|
311
|
+
getIconButtonType = (): TertiaryButtonProps['variant'] => {
|
|
329
312
|
let background = this.getThemeColors().background || `#fff`;
|
|
330
313
|
if (this.props.isCollapsed && this.state.showForm) {
|
|
331
314
|
background = formCollapsedBackground;
|
|
332
315
|
}
|
|
333
|
-
const isDarkBackground = chroma(background).get('lab.l') < 70;
|
|
334
|
-
return isDarkBackground ? 'inverse' :
|
|
316
|
+
const isDarkBackground = chroma(background as string).get('lab.l') < 70;
|
|
317
|
+
return isDarkBackground ? 'inverse' : undefined;
|
|
335
318
|
};
|
|
336
319
|
|
|
337
320
|
handleSubmit = (event: React.FormEvent<HTMLFormElement>): void => {
|
|
@@ -485,7 +468,6 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
485
468
|
aria-label={closeButtonAriaLabel}
|
|
486
469
|
icon={xIcon}
|
|
487
470
|
isCollapsed={isCollapsed}
|
|
488
|
-
variant="plain"
|
|
489
471
|
showForm={this.state.showForm}
|
|
490
472
|
onClick={this.closeCollapsedSearch}
|
|
491
473
|
type="button"
|
|
@@ -6,6 +6,7 @@ export enum SearchTheme {
|
|
|
6
6
|
Dark,
|
|
7
7
|
Transparent,
|
|
8
8
|
}
|
|
9
|
+
|
|
9
10
|
export interface SearchThemeAttributes {
|
|
10
11
|
background?: string;
|
|
11
12
|
backgroundFocus?: string;
|
|
@@ -40,7 +41,7 @@ export const searchThemes: SearchThemes = {
|
|
|
40
41
|
color: colors.blackPepper300,
|
|
41
42
|
placeholderColor: colors.licorice300,
|
|
42
43
|
boxShadow: 'none',
|
|
43
|
-
boxShadowFocus: focusRing().boxShadow,
|
|
44
|
+
boxShadowFocus: focusRing().boxShadow as SearchThemeAttributes['boxShadowFocus'],
|
|
44
45
|
},
|
|
45
46
|
[SearchTheme.Dark]: {
|
|
46
47
|
background: 'rgba(0, 0, 0, 0.2)',
|
package/common/lib/Box.tsx
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import styled from '@emotion/styled';
|
|
3
|
-
import isPropValid from '@emotion/is-prop-valid';
|
|
4
|
-
import {createComponent, StyledType, useConstant} from '@workday/canvas-kit-react/common';
|
|
5
|
-
|
|
6
|
-
// style props
|
|
7
|
-
import {border, BorderStyleProps} from './utils/border';
|
|
8
|
-
import {color, ColorStyleProps} from './utils/color';
|
|
9
|
-
import {depth, DepthStyleProps} from './utils/depth';
|
|
10
|
-
import {flexItem, FlexItemStyleProps} from './utils/flexItem';
|
|
11
|
-
import {layout, LayoutStyleProps} from './utils/layout';
|
|
12
|
-
import {position, PositionStyleProps} from './utils/position';
|
|
13
|
-
import {space, SpaceStyleProps} from './utils/space';
|
|
14
|
-
|
|
15
|
-
export type BoxProps = BorderStyleProps &
|
|
16
|
-
ColorStyleProps &
|
|
17
|
-
DepthStyleProps &
|
|
18
|
-
FlexItemStyleProps &
|
|
19
|
-
LayoutStyleProps &
|
|
20
|
-
PositionStyleProps &
|
|
21
|
-
SpaceStyleProps & {
|
|
22
|
-
children?: React.ReactNode;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const omittedProps = ['display', 'color', 'height', 'overflow', 'width', 'border', 'background'];
|
|
26
|
-
|
|
27
|
-
const shouldForwardProp = (prop: string) => {
|
|
28
|
-
return isPropValid(prop) && !omittedProps.includes(prop);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
// Meant to be used with elements. The `shouldForwardProps` will remove all style props
|
|
32
|
-
const StyledBoxElement = styled('div', {shouldForwardProp})<StyledType & BoxProps>(
|
|
33
|
-
{
|
|
34
|
-
boxSizing: 'border-box',
|
|
35
|
-
},
|
|
36
|
-
border,
|
|
37
|
-
color,
|
|
38
|
-
depth,
|
|
39
|
-
flexItem,
|
|
40
|
-
layout,
|
|
41
|
-
position,
|
|
42
|
-
space
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
// Meant to be used with components. There is no `shouldForwardProps` - all props will be forwarded to the component
|
|
46
|
-
const StyledBoxComponent = styled('div')<StyledType & BoxProps>(
|
|
47
|
-
{
|
|
48
|
-
boxSizing: 'border-box',
|
|
49
|
-
},
|
|
50
|
-
border,
|
|
51
|
-
color,
|
|
52
|
-
depth,
|
|
53
|
-
flexItem,
|
|
54
|
-
layout,
|
|
55
|
-
position,
|
|
56
|
-
space
|
|
57
|
-
);
|
|
58
|
-
/**
|
|
59
|
-
* `Box` is a primitive component that provides a common, ergonomic API around Canvas design tokens.
|
|
60
|
-
* It is highly flexible, and its primary purpose is to build other components.
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* import { Box, BoxProps } from '@workday/canvas-kit-labs-react/common';
|
|
64
|
-
*
|
|
65
|
-
* interface CardProps extends BoxProps {
|
|
66
|
-
* // card-specific props
|
|
67
|
-
* }
|
|
68
|
-
*
|
|
69
|
-
* // `Card`'s default values are set using `BoxProps`
|
|
70
|
-
* const Card = (props: CardProps) => (
|
|
71
|
-
* <Box depth={2} padding="m" borderRadius="l" {...props}>Hello, Card!</Box>
|
|
72
|
-
* );
|
|
73
|
-
*
|
|
74
|
-
*/
|
|
75
|
-
export const Box = createComponent('div')({
|
|
76
|
-
displayName: 'Box',
|
|
77
|
-
Component: ({children, ...elemProps}: BoxProps, ref, Element) => {
|
|
78
|
-
const BoxComponent = useConstant(() =>
|
|
79
|
-
typeof Element === 'string' ? StyledBoxElement : StyledBoxComponent
|
|
80
|
-
);
|
|
81
|
-
return (
|
|
82
|
-
<BoxComponent as={Element} ref={ref} {...elemProps}>
|
|
83
|
-
{children}
|
|
84
|
-
</BoxComponent>
|
|
85
|
-
);
|
|
86
|
-
},
|
|
87
|
-
});
|
|
@@ -1,263 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
borderRadius as borderRadiusTokens,
|
|
3
|
-
CanvasBorderRadiusKeys,
|
|
4
|
-
colors as colorTokens,
|
|
5
|
-
CanvasColor,
|
|
6
|
-
} from '@workday/canvas-kit-react/tokens';
|
|
7
|
-
import {
|
|
8
|
-
ContentDirection,
|
|
9
|
-
PartialEmotionCanvasTheme,
|
|
10
|
-
useTheme,
|
|
11
|
-
} from '@workday/canvas-kit-react/common';
|
|
12
|
-
|
|
13
|
-
import {PropertyBorder} from './types';
|
|
14
|
-
|
|
15
|
-
/** style props to set the border properties */
|
|
16
|
-
export type BorderShorthandStyleProps = {
|
|
17
|
-
/** sets `border` property */
|
|
18
|
-
border?: string;
|
|
19
|
-
/** sets `border-top` property */
|
|
20
|
-
borderTop?: string;
|
|
21
|
-
/** sets `border-right` property (no bidirectional support) */
|
|
22
|
-
borderRight?: string;
|
|
23
|
-
/** sets `border-bottom` property */
|
|
24
|
-
borderBottom?: string;
|
|
25
|
-
/** sets `border-left` property (no bidirectional support) */
|
|
26
|
-
borderLeft?: string;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
/** style props to set the border color properties */
|
|
30
|
-
export type BorderColorStyleProps = {
|
|
31
|
-
/** sets `border-color` property */
|
|
32
|
-
borderColor?: CanvasColor | (string & {});
|
|
33
|
-
/** sets `border-top-color` property */
|
|
34
|
-
borderTopColor?: CanvasColor | (string & {});
|
|
35
|
-
/** sets `border-right-color` property (no bidirectional support) */
|
|
36
|
-
borderRightColor?: CanvasColor | (string & {});
|
|
37
|
-
/** sets `border-bottom-color` property */
|
|
38
|
-
borderBottomColor?: CanvasColor | (string & {});
|
|
39
|
-
/** sets `border-left-color` property (no bidirectional support) */
|
|
40
|
-
borderLeftColor?: CanvasColor | (string & {});
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/** style props to set the border radius properties */
|
|
44
|
-
export type BorderRadiusStyleProps = {
|
|
45
|
-
/** sets `border-radius` property */
|
|
46
|
-
borderRadius?: CanvasBorderRadiusKeys | number | (string & {});
|
|
47
|
-
/** sets `border-top-left-radius` property */
|
|
48
|
-
borderTopLeftRadius?: CanvasBorderRadiusKeys | number | (string & {});
|
|
49
|
-
/** sets `border-top-right-radius` property */
|
|
50
|
-
borderTopRightRadius?: CanvasBorderRadiusKeys | number | (string & {});
|
|
51
|
-
/** sets `border-bottom-left-radius` property */
|
|
52
|
-
borderBottomLeftRadius?: CanvasBorderRadiusKeys | number | (string & {});
|
|
53
|
-
/** sets `border-bottom-right-radius` property */
|
|
54
|
-
borderBottomRightRadius?: CanvasBorderRadiusKeys | number | (string & {});
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/** style props to set the border style properties */
|
|
58
|
-
export type BorderLineStyleProps = {
|
|
59
|
-
/** sets `border-style` property */
|
|
60
|
-
borderStyle?: PropertyBorder;
|
|
61
|
-
/** sets `border-top-style` property */
|
|
62
|
-
borderTopStyle?: PropertyBorder;
|
|
63
|
-
/** sets `border-right-style` property (no bidirectional support) */
|
|
64
|
-
borderRightStyle?: PropertyBorder;
|
|
65
|
-
/** sets `border-bottom-style` property */
|
|
66
|
-
borderBottomStyle?: PropertyBorder;
|
|
67
|
-
/** sets `border-left-style` property (no bidirectional support) */
|
|
68
|
-
borderLeftStyle?: PropertyBorder;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
/** style props to set the border width properties */
|
|
72
|
-
export type BorderWidthStyleProps = {
|
|
73
|
-
/** sets `border-width` property */
|
|
74
|
-
borderWidth?: string | number;
|
|
75
|
-
/** sets `border-top-width` property */
|
|
76
|
-
borderTopWidth?: string | number;
|
|
77
|
-
/** sets `border-right-width` property (no bidirectional support) */
|
|
78
|
-
borderRightWidth?: string | number;
|
|
79
|
-
/** sets `border-bottom-width` property */
|
|
80
|
-
borderBottomWidth?: string | number;
|
|
81
|
-
/** sets `border-left-width` property (no bidirectional support) */
|
|
82
|
-
borderLeftWidth?: string | number;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export type BorderLogicalStyleProps = {
|
|
86
|
-
/** sets `border-left` property (bidirectional support) */
|
|
87
|
-
borderInlineStart?: string;
|
|
88
|
-
/** sets `border-left-color` property (bidirectional support) */
|
|
89
|
-
borderInlineStartColor?: CanvasColor | (string & {});
|
|
90
|
-
/** sets `border-left-style` property (bidirectional support) */
|
|
91
|
-
borderInlineStartStyle?: PropertyBorder;
|
|
92
|
-
/** sets `border-left-width` property (bidirectional support) */
|
|
93
|
-
borderInlineStartWidth?: string | number;
|
|
94
|
-
/** sets `border-right` property (bidirectional support) */
|
|
95
|
-
borderInlineEnd?: string;
|
|
96
|
-
/** sets `border-right-color` property (bidirectional support) */
|
|
97
|
-
borderInlineEndColor?: CanvasColor | (string & {});
|
|
98
|
-
/** sets `border-right-style` property (bidirectional support) */
|
|
99
|
-
borderInlineEndStyle?: PropertyBorder;
|
|
100
|
-
/** sets `border-right-width` property (bidirectional support) */
|
|
101
|
-
borderInlineEndWidth?: string | number;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
/** a collection style props for border properties */
|
|
105
|
-
export type BorderStyleProps = BorderShorthandStyleProps &
|
|
106
|
-
BorderColorStyleProps &
|
|
107
|
-
BorderRadiusStyleProps &
|
|
108
|
-
BorderLineStyleProps &
|
|
109
|
-
BorderWidthStyleProps &
|
|
110
|
-
BorderLogicalStyleProps;
|
|
111
|
-
|
|
112
|
-
// border logical prop handlers
|
|
113
|
-
const borderInlineStart = (isRTL: boolean) => (isRTL ? 'borderRight' : 'borderLeft');
|
|
114
|
-
const borderInlineEnd = (isRTL: boolean) => (isRTL ? 'borderLeft' : 'borderRight');
|
|
115
|
-
const borderInlineStartColor = (isRTL: boolean) => (isRTL ? 'borderRightColor' : 'borderLeftColor');
|
|
116
|
-
const borderInlineEndColor = (isRTL: boolean) => (isRTL ? 'borderLeftColor' : 'borderRightColor');
|
|
117
|
-
const borderInlineStartStyle = (isRTL: boolean) => (isRTL ? 'borderRightStyle' : 'borderLeftStyle');
|
|
118
|
-
const borderInlineEndStyle = (isRTL: boolean) => (isRTL ? 'borderLeftStyle' : 'borderRightStyle');
|
|
119
|
-
const borderInlineStartWidth = (isRTL: boolean) => (isRTL ? 'borderRightWidth' : 'borderLeftWidth');
|
|
120
|
-
const borderInlineEndWidth = (isRTL: boolean) => (isRTL ? 'borderLeftWidth' : 'borderRightWidth');
|
|
121
|
-
|
|
122
|
-
const borderShorthandProps = {
|
|
123
|
-
border: 'border',
|
|
124
|
-
borderTop: 'borderTop',
|
|
125
|
-
borderRight: 'borderRight',
|
|
126
|
-
borderBottom: 'borderBottom',
|
|
127
|
-
borderLeft: 'borderLeft',
|
|
128
|
-
borderInlineStart,
|
|
129
|
-
borderInlineEnd,
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
const borderColors = {
|
|
133
|
-
borderColor: 'borderColor',
|
|
134
|
-
borderTopColor: 'borderTopColor',
|
|
135
|
-
borderRightColor: 'borderRightColor',
|
|
136
|
-
borderBottomColor: 'borderBottomColor',
|
|
137
|
-
borderLeftColor: 'borderLeftColor',
|
|
138
|
-
borderInlineStartColor,
|
|
139
|
-
borderInlineEndColor,
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const borderRadii = {
|
|
143
|
-
borderRadius: 'borderRadius',
|
|
144
|
-
borderTopLeftRadius: 'borderTopLeftRadius',
|
|
145
|
-
borderTopRightRadius: 'borderTopRightRadius',
|
|
146
|
-
borderBottomLeftRadius: 'borderBottomLeftRadius',
|
|
147
|
-
borderBottomRightRadius: 'borderBottomRightRadius',
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const borderStyles = {
|
|
151
|
-
borderStyle: 'borderStyle',
|
|
152
|
-
borderTopStyle: 'borderTopStyle',
|
|
153
|
-
borderRightStyle: 'borderRightStyle',
|
|
154
|
-
borderBottomStyle: 'borderBottomStyle',
|
|
155
|
-
borderLeftStyle: 'borderLeftStyle',
|
|
156
|
-
borderInlineStartStyle,
|
|
157
|
-
borderInlineEndStyle,
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
const borderWidths = {
|
|
161
|
-
borderWidth: 'borderWidth',
|
|
162
|
-
borderTopWidth: 'borderTopWidth',
|
|
163
|
-
borderRightWidth: 'borderRightWidth',
|
|
164
|
-
borderBottomWidth: 'borderBottomWidth',
|
|
165
|
-
borderLeftWidth: 'borderLeftWidth',
|
|
166
|
-
borderInlineStartWidth,
|
|
167
|
-
borderInlineEndWidth,
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* A style prop function that takes components props and returns border styles. Some props, such as borderRadius and borderColor, are connected to our design tokens.
|
|
172
|
-
* If no `BorderStyleProps` are found, it returns an empty object.
|
|
173
|
-
*
|
|
174
|
-
* @example
|
|
175
|
-
* // You'll most likely use `border` with low-level, styled components
|
|
176
|
-
* const BoxExample = () => (
|
|
177
|
-
* <Box border={`solid 1px #333333 ${colors.blackPepper400}`}>Hello, border styles!</Box>
|
|
178
|
-
* );
|
|
179
|
-
*
|
|
180
|
-
*/
|
|
181
|
-
export function border<P extends BorderStyleProps & {theme?: PartialEmotionCanvasTheme}>(props: P) {
|
|
182
|
-
// border will always be used within the context of a component, but eslint doesn't know that
|
|
183
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
184
|
-
const {canvas} = useTheme(props.theme);
|
|
185
|
-
const isRTL = canvas.direction === ContentDirection.RTL;
|
|
186
|
-
const styles = {};
|
|
187
|
-
for (const key in props) {
|
|
188
|
-
if (props.hasOwnProperty(key)) {
|
|
189
|
-
if (key in borderShorthandProps) {
|
|
190
|
-
const value = props[key as keyof BorderShorthandStyleProps];
|
|
191
|
-
let attr: string;
|
|
192
|
-
if (key === 'borderInlineStart') {
|
|
193
|
-
attr = borderInlineStart(isRTL);
|
|
194
|
-
} else if (key === 'borderInlineEnd') {
|
|
195
|
-
attr = borderInlineEnd(isRTL);
|
|
196
|
-
} else {
|
|
197
|
-
attr = borderShorthandProps[key as keyof BorderShorthandStyleProps];
|
|
198
|
-
}
|
|
199
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
200
|
-
styles[attr] = value;
|
|
201
|
-
continue;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (key in borderColors) {
|
|
205
|
-
const propValue = props[key as keyof BorderColorStyleProps] as CanvasColor | string;
|
|
206
|
-
const value = colorTokens[propValue as CanvasColor] || propValue;
|
|
207
|
-
let attr: string;
|
|
208
|
-
if (key === 'borderInlineStartColor') {
|
|
209
|
-
attr = borderInlineStartColor(isRTL);
|
|
210
|
-
} else if (key === 'borderInlineEndColor') {
|
|
211
|
-
attr = borderInlineEndColor(isRTL);
|
|
212
|
-
} else {
|
|
213
|
-
attr = borderColors[key as keyof BorderColorStyleProps];
|
|
214
|
-
}
|
|
215
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
216
|
-
styles[attr] = value;
|
|
217
|
-
continue;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (key in borderRadii) {
|
|
221
|
-
const propValue = props[key as keyof BorderRadiusStyleProps] as
|
|
222
|
-
| CanvasBorderRadiusKeys
|
|
223
|
-
| number
|
|
224
|
-
| string;
|
|
225
|
-
const value = borderRadiusTokens[propValue as CanvasBorderRadiusKeys] || propValue;
|
|
226
|
-
const attr = borderRadii[key as keyof BorderRadiusStyleProps];
|
|
227
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
228
|
-
styles[attr] = value;
|
|
229
|
-
continue;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
if (key in borderStyles) {
|
|
233
|
-
const value = props[key as keyof BorderLineStyleProps];
|
|
234
|
-
let attr: string;
|
|
235
|
-
if (key === 'borderInlineStartStyle') {
|
|
236
|
-
attr = borderInlineStartStyle(isRTL);
|
|
237
|
-
} else if (key === 'borderInlineEndStyle') {
|
|
238
|
-
attr = borderInlineEndStyle(isRTL);
|
|
239
|
-
} else {
|
|
240
|
-
attr = borderStyles[key as keyof BorderLineStyleProps];
|
|
241
|
-
}
|
|
242
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
243
|
-
styles[attr] = value;
|
|
244
|
-
continue;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
if (key in borderWidths) {
|
|
248
|
-
const value = props[key as keyof BorderWidthStyleProps];
|
|
249
|
-
let attr: string;
|
|
250
|
-
if (key === 'borderInlineStartWidth') {
|
|
251
|
-
attr = borderInlineStartWidth(isRTL);
|
|
252
|
-
} else if (key === 'borderInlineEndWidth') {
|
|
253
|
-
attr = borderInlineEndWidth(isRTL);
|
|
254
|
-
} else {
|
|
255
|
-
attr = borderWidths[key as keyof BorderWidthStyleProps];
|
|
256
|
-
}
|
|
257
|
-
// @ts-ignore TS doesn't like adding a potentially unknown key to an object, but because we own this object, it's fine.
|
|
258
|
-
styles[attr] = value;
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
return styles;
|
|
263
|
-
}
|