@workday/canvas-kit-labs-react 5.3.17 → 5.4.0-next.1
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/lib/AutocompleteList.tsx +2 -3
- package/combobox/lib/Combobox.tsx +10 -4
- package/common/README.md +32 -0
- package/common/lib/Box.tsx +21 -4
- package/common/lib/theming/index.ts +1 -0
- package/common/lib/theming/useThemedRing.ts +82 -0
- package/dist/commonjs/combobox/lib/AutocompleteList.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/AutocompleteList.js +1 -2
- package/dist/commonjs/combobox/lib/Combobox.d.ts.map +1 -1
- package/dist/commonjs/combobox/lib/Combobox.js +3 -3
- package/dist/commonjs/common/lib/Box.d.ts.map +1 -1
- package/dist/commonjs/common/lib/Box.js +10 -2
- package/dist/commonjs/common/lib/theming/index.d.ts +1 -0
- package/dist/commonjs/common/lib/theming/index.d.ts.map +1 -1
- package/dist/commonjs/common/lib/theming/index.js +1 -0
- package/dist/commonjs/common/lib/theming/useThemedRing.d.ts +11 -0
- package/dist/commonjs/common/lib/theming/useThemedRing.d.ts.map +1 -0
- package/dist/commonjs/common/lib/theming/useThemedRing.js +65 -0
- package/dist/commonjs/header/index.d.ts +5 -5
- package/dist/commonjs/header/index.d.ts.map +1 -1
- package/dist/commonjs/header/index.js +2 -2
- package/dist/commonjs/header/lib/GlobalHeader.d.ts +11 -2
- package/dist/commonjs/header/lib/GlobalHeader.d.ts.map +1 -1
- package/dist/commonjs/header/lib/GlobalHeader.js +19 -8
- package/dist/commonjs/header/lib/Header.d.ts +17 -8
- package/dist/commonjs/header/lib/Header.d.ts.map +1 -1
- package/dist/commonjs/header/lib/Header.js +27 -14
- package/dist/commonjs/header/lib/parts/DubLogoTitle.d.ts +13 -4
- package/dist/commonjs/header/lib/parts/DubLogoTitle.d.ts.map +1 -1
- package/dist/commonjs/header/lib/parts/DubLogoTitle.js +22 -11
- package/dist/commonjs/header/lib/parts/WorkdayLogoTitle.d.ts +14 -5
- package/dist/commonjs/header/lib/parts/WorkdayLogoTitle.d.ts.map +1 -1
- package/dist/commonjs/header/lib/parts/WorkdayLogoTitle.js +25 -12
- package/dist/commonjs/header/lib/parts/index.d.ts +2 -3
- package/dist/commonjs/header/lib/parts/index.d.ts.map +1 -1
- package/dist/commonjs/header/lib/parts/index.js +2 -4
- package/dist/commonjs/header/lib/shared/themes.d.ts +28 -19
- package/dist/commonjs/header/lib/shared/themes.d.ts.map +1 -1
- package/dist/commonjs/header/lib/shared/themes.js +13 -36
- package/dist/commonjs/header/lib/shared/types.d.ts +3 -8
- package/dist/commonjs/header/lib/shared/types.d.ts.map +1 -1
- package/dist/commonjs/header/lib/shared/types.js +17 -23
- package/dist/commonjs/index.d.ts +1 -0
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +1 -0
- package/dist/commonjs/layout/lib/Stack.d.ts.map +1 -1
- package/dist/commonjs/layout/lib/Stack.js +1 -1
- package/dist/commonjs/layout/lib/utils/getValidChildren.d.ts +1 -1
- package/dist/commonjs/layout/lib/utils/getValidChildren.d.ts.map +1 -1
- package/dist/commonjs/search-form/index.d.ts +3 -0
- package/dist/commonjs/search-form/index.d.ts.map +1 -0
- package/dist/commonjs/search-form/index.js +7 -0
- package/dist/commonjs/{header/lib/parts/SearchBar.d.ts → search-form/lib/SearchForm.d.ts} +27 -23
- package/dist/commonjs/search-form/lib/SearchForm.d.ts.map +1 -0
- package/dist/commonjs/{header/lib/parts/SearchBar.js → search-form/lib/SearchForm.js} +17 -19
- package/dist/commonjs/search-form/lib/themes.d.ts +21 -0
- package/dist/commonjs/search-form/lib/themes.d.ts.map +1 -0
- package/dist/commonjs/search-form/lib/themes.js +41 -0
- package/dist/es6/combobox/lib/AutocompleteList.d.ts.map +1 -1
- package/dist/es6/combobox/lib/AutocompleteList.js +2 -3
- package/dist/es6/combobox/lib/Combobox.d.ts.map +1 -1
- package/dist/es6/combobox/lib/Combobox.js +4 -4
- package/dist/es6/common/lib/Box.d.ts.map +1 -1
- package/dist/es6/common/lib/Box.js +11 -3
- package/dist/es6/common/lib/theming/index.d.ts +1 -0
- package/dist/es6/common/lib/theming/index.d.ts.map +1 -1
- package/dist/es6/common/lib/theming/index.js +1 -0
- package/dist/es6/common/lib/theming/useThemedRing.d.ts +11 -0
- package/dist/es6/common/lib/theming/useThemedRing.d.ts.map +1 -0
- package/dist/es6/common/lib/theming/useThemedRing.js +59 -0
- package/dist/es6/header/index.d.ts +5 -5
- package/dist/es6/header/index.d.ts.map +1 -1
- package/dist/es6/header/index.js +5 -5
- package/dist/es6/header/lib/GlobalHeader.d.ts +11 -2
- package/dist/es6/header/lib/GlobalHeader.d.ts.map +1 -1
- package/dist/es6/header/lib/GlobalHeader.js +22 -11
- package/dist/es6/header/lib/Header.d.ts +17 -8
- package/dist/es6/header/lib/Header.d.ts.map +1 -1
- package/dist/es6/header/lib/Header.js +30 -17
- package/dist/es6/header/lib/parts/DubLogoTitle.d.ts +13 -4
- package/dist/es6/header/lib/parts/DubLogoTitle.d.ts.map +1 -1
- package/dist/es6/header/lib/parts/DubLogoTitle.js +23 -12
- package/dist/es6/header/lib/parts/WorkdayLogoTitle.d.ts +14 -5
- package/dist/es6/header/lib/parts/WorkdayLogoTitle.d.ts.map +1 -1
- package/dist/es6/header/lib/parts/WorkdayLogoTitle.js +26 -13
- package/dist/es6/header/lib/parts/index.d.ts +2 -3
- package/dist/es6/header/lib/parts/index.d.ts.map +1 -1
- package/dist/es6/header/lib/parts/index.js +2 -3
- package/dist/es6/header/lib/shared/themes.d.ts +28 -19
- package/dist/es6/header/lib/shared/themes.d.ts.map +1 -1
- package/dist/es6/header/lib/shared/themes.js +14 -37
- package/dist/es6/header/lib/shared/types.d.ts +3 -8
- package/dist/es6/header/lib/shared/types.d.ts.map +1 -1
- package/dist/es6/header/lib/shared/types.js +17 -23
- package/dist/es6/index.d.ts +1 -0
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +1 -0
- package/dist/es6/layout/lib/Stack.d.ts.map +1 -1
- package/dist/es6/layout/lib/Stack.js +1 -1
- package/dist/es6/layout/lib/utils/getValidChildren.d.ts +1 -1
- package/dist/es6/layout/lib/utils/getValidChildren.d.ts.map +1 -1
- package/dist/es6/search-form/index.d.ts +3 -0
- package/dist/es6/search-form/index.d.ts.map +1 -0
- package/dist/es6/search-form/index.js +2 -0
- package/{ts3.5/dist/commonjs/header/lib/parts/SearchBar.d.ts → dist/es6/search-form/lib/SearchForm.d.ts} +107 -103
- package/dist/es6/search-form/lib/SearchForm.d.ts.map +1 -0
- package/dist/es6/{header/lib/parts/SearchBar.js → search-form/lib/SearchForm.js} +16 -18
- package/dist/es6/search-form/lib/themes.d.ts +21 -0
- package/dist/es6/search-form/lib/themes.d.ts.map +1 -0
- package/dist/es6/search-form/lib/themes.js +39 -0
- package/header/README.md +37 -181
- package/header/index.ts +5 -5
- package/header/lib/GlobalHeader.tsx +26 -9
- package/header/lib/Header.tsx +58 -26
- package/header/lib/parts/DubLogoTitle.tsx +26 -9
- package/header/lib/parts/WorkdayLogoTitle.tsx +40 -11
- package/header/lib/parts/index.ts +2 -3
- package/header/lib/shared/themes.tsx +32 -56
- package/header/lib/shared/types.tsx +3 -9
- package/index.ts +1 -0
- package/layout/lib/Stack.tsx +3 -1
- package/package.json +5 -7
- package/search-form/LICENSE +52 -0
- package/search-form/README.md +6 -0
- package/search-form/index.ts +2 -0
- package/{header/lib/parts/SearchBar.tsx → search-form/lib/SearchForm.tsx} +40 -35
- package/search-form/lib/themes.ts +54 -0
- package/search-form/package.json +5 -0
- package/ts3.5/dist/commonjs/common/lib/theming/index.d.ts +1 -0
- package/ts3.5/dist/commonjs/common/lib/theming/useThemedRing.d.ts +11 -0
- package/ts3.5/dist/commonjs/header/index.d.ts +5 -5
- package/ts3.5/dist/commonjs/header/lib/GlobalHeader.d.ts +11 -2
- package/ts3.5/dist/commonjs/header/lib/Header.d.ts +17 -8
- package/ts3.5/dist/commonjs/header/lib/parts/DubLogoTitle.d.ts +13 -4
- package/ts3.5/dist/commonjs/header/lib/parts/WorkdayLogoTitle.d.ts +14 -5
- package/ts3.5/dist/commonjs/header/lib/parts/index.d.ts +2 -3
- package/ts3.5/dist/commonjs/header/lib/shared/themes.d.ts +28 -19
- package/ts3.5/dist/commonjs/header/lib/shared/types.d.ts +3 -8
- package/ts3.5/dist/commonjs/index.d.ts +1 -0
- package/ts3.5/dist/commonjs/layout/lib/utils/getValidChildren.d.ts +1 -1
- package/ts3.5/dist/commonjs/search-form/index.d.ts +3 -0
- package/ts3.5/dist/{es6/header/lib/parts/SearchBar.d.ts → commonjs/search-form/lib/SearchForm.d.ts} +27 -23
- package/ts3.5/dist/commonjs/search-form/lib/themes.d.ts +21 -0
- package/ts3.5/dist/es6/common/lib/theming/index.d.ts +1 -0
- package/ts3.5/dist/es6/common/lib/theming/useThemedRing.d.ts +11 -0
- package/ts3.5/dist/es6/header/index.d.ts +5 -5
- package/ts3.5/dist/es6/header/lib/GlobalHeader.d.ts +11 -2
- package/ts3.5/dist/es6/header/lib/Header.d.ts +17 -8
- package/ts3.5/dist/es6/header/lib/parts/DubLogoTitle.d.ts +13 -4
- package/ts3.5/dist/es6/header/lib/parts/WorkdayLogoTitle.d.ts +14 -5
- package/ts3.5/dist/es6/header/lib/parts/index.d.ts +2 -3
- package/ts3.5/dist/es6/header/lib/shared/themes.d.ts +28 -19
- package/ts3.5/dist/es6/header/lib/shared/types.d.ts +3 -8
- package/ts3.5/dist/es6/index.d.ts +1 -0
- package/ts3.5/dist/es6/layout/lib/utils/getValidChildren.d.ts +1 -1
- package/ts3.5/dist/es6/search-form/index.d.ts +3 -0
- package/{dist/es6/header/lib/parts/SearchBar.d.ts → ts3.5/dist/es6/search-form/lib/SearchForm.d.ts} +107 -103
- package/ts3.5/dist/es6/search-form/lib/themes.d.ts +21 -0
- package/dist/commonjs/header/lib/parts/SearchBar.d.ts.map +0 -1
- package/dist/es6/header/lib/parts/SearchBar.d.ts.map +0 -1
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React, {Fragment, useState} from 'react';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
3
|
import {space} from '@workday/canvas-kit-react/tokens';
|
|
4
|
-
import {accessibleHide} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {accessibleHide, generateUniqueId} from '@workday/canvas-kit-react/common';
|
|
5
5
|
import {MenuItemProps} from '@workday/canvas-kit-preview-react/menu';
|
|
6
6
|
import {ComboBoxMenuItemGroup, getOptionId, listBoxIdPart, getTextFromElement} from './Combobox';
|
|
7
|
-
import uuid from 'uuid/v4';
|
|
8
7
|
|
|
9
8
|
const Autocomplete = styled('ul')({
|
|
10
9
|
margin: 0,
|
|
@@ -55,7 +54,7 @@ const AutocompleteList = ({
|
|
|
55
54
|
labelId,
|
|
56
55
|
showGroupText,
|
|
57
56
|
}: AutocompleteListProps) => {
|
|
58
|
-
const [randomComponentId] = useState(
|
|
57
|
+
const [randomComponentId] = useState(generateUniqueId); // https://codesandbox.io/s/p2ndq
|
|
59
58
|
|
|
60
59
|
const componentId = comboboxId || randomComponentId;
|
|
61
60
|
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import React, {useEffect, useLayoutEffect, useRef, useState, useCallback} from 'react';
|
|
2
2
|
import {CSSObject, jsx, keyframes} from '@emotion/core';
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
GrowthBehavior,
|
|
5
|
+
useForkRef,
|
|
6
|
+
styled,
|
|
7
|
+
useIsRTL,
|
|
8
|
+
useUniqueId,
|
|
9
|
+
} from '@workday/canvas-kit-react/common';
|
|
4
10
|
import {space, commonColors, borderRadius} from '@workday/canvas-kit-react/tokens';
|
|
5
11
|
import {MenuItemProps} from '@workday/canvas-kit-preview-react/menu';
|
|
6
12
|
import {Card} from '@workday/canvas-kit-react/card';
|
|
7
13
|
import {IconButton, IconButtonProps} from '@workday/canvas-kit-react/button';
|
|
8
14
|
import {xSmallIcon} from '@workday/canvas-system-icons-web';
|
|
9
15
|
import {TextInputProps} from '@workday/canvas-kit-react/text-input';
|
|
10
|
-
import uuid from 'uuid/v4';
|
|
11
16
|
import flatten from 'lodash.flatten';
|
|
12
17
|
import AutocompleteList from './AutocompleteList';
|
|
13
18
|
import Status from './Status';
|
|
@@ -106,6 +111,7 @@ const MenuContainer = styled(Card)({
|
|
|
106
111
|
minWidth: 0,
|
|
107
112
|
animation: `${fadeInKeyframes} 200ms ease-out`,
|
|
108
113
|
maxHeight: 200,
|
|
114
|
+
overflow: 'hidden',
|
|
109
115
|
});
|
|
110
116
|
|
|
111
117
|
const ResetButton = styled(IconButton)<{shouldShow: boolean}>(
|
|
@@ -200,8 +206,8 @@ const Combobox = ({
|
|
|
200
206
|
|
|
201
207
|
const comboboxRef: React.RefObject<HTMLDivElement> = useRef(null);
|
|
202
208
|
|
|
203
|
-
const
|
|
204
|
-
const
|
|
209
|
+
const randomComponentId = useUniqueId();
|
|
210
|
+
const randomLabelId = useUniqueId();
|
|
205
211
|
|
|
206
212
|
const componentId = id || randomComponentId;
|
|
207
213
|
const formLabelId = labelId || randomLabelId;
|
package/common/README.md
CHANGED
|
@@ -64,3 +64,35 @@ export const HelloWorld = ({backgroundImagePath}) => {
|
|
|
64
64
|
);
|
|
65
65
|
};
|
|
66
66
|
```
|
|
67
|
+
|
|
68
|
+
## useThemedRing
|
|
69
|
+
|
|
70
|
+
This is a way to automatically add themed colors to your inputs. This is helpful when showing alerts to users. It supports `error`, `alert`, and `success` states. It will try and use the corresponding `main` colors from your `CanvasThemePalette` unless they do not meet accessibility contrast, in which case the outer ring will use the `darkest` color. This hook will also show a `focusOutline` ring when the input is focused.
|
|
71
|
+
Note: You should not rely on these colors alone to differentiate alerts, but use them in combination with icons or hint text.
|
|
72
|
+
|
|
73
|
+
### Usage
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
/** @jsx jsx */
|
|
77
|
+
import {jsx} from '@emotion/core';
|
|
78
|
+
import React from 'react';
|
|
79
|
+
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
80
|
+
import {useThemedRing} from '@workday/canvas-kit-labs-react/common';
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
export const MyInput = ({handleChange}) => {
|
|
84
|
+
const [value, setValue] = React.useState('invalid@email');
|
|
85
|
+
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
86
|
+
setValue(event.target.value);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const alertStyles = useThemedRing('alert');
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<TextInput>
|
|
93
|
+
<TextInput.Label>Email</TextInput.Label>
|
|
94
|
+
<TextInput.Field css={alertStyles} onChange={handleChange} value={value} />
|
|
95
|
+
<TextInput.Hint>Please enter a valid email.</TextInput.Hint>
|
|
96
|
+
</TextInput>
|
|
97
|
+
);
|
|
98
|
+
}
|
package/common/lib/Box.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import styled from '@emotion/styled';
|
|
3
3
|
import isPropValid from '@emotion/is-prop-valid';
|
|
4
|
-
import {createComponent, StyledType} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {createComponent, StyledType, useConstant} from '@workday/canvas-kit-react/common';
|
|
5
5
|
|
|
6
6
|
// style props
|
|
7
7
|
import {border, BorderStyleProps} from './utils/border';
|
|
@@ -28,7 +28,8 @@ const shouldForwardProp = (prop: string) => {
|
|
|
28
28
|
return isPropValid(prop) && !omittedProps.includes(prop);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
// Meant to be used with elements. The `shouldForwardProps` will remove all style props
|
|
32
|
+
const StyledBoxElement = styled('div', {shouldForwardProp})<StyledType & BoxProps>(
|
|
32
33
|
{
|
|
33
34
|
boxSizing: 'border-box',
|
|
34
35
|
},
|
|
@@ -41,6 +42,19 @@ const StyledBox = styled('div', {shouldForwardProp})<StyledType & BoxProps>(
|
|
|
41
42
|
space
|
|
42
43
|
);
|
|
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
|
+
);
|
|
44
58
|
/**
|
|
45
59
|
* `Box` is a primitive component that provides a common, ergonomic API around Canvas design tokens.
|
|
46
60
|
* It is highly flexible, and its primary purpose is to build other components.
|
|
@@ -61,10 +75,13 @@ const StyledBox = styled('div', {shouldForwardProp})<StyledType & BoxProps>(
|
|
|
61
75
|
export const Box = createComponent('div')({
|
|
62
76
|
displayName: 'Box',
|
|
63
77
|
Component: ({children, ...elemProps}: BoxProps, ref, Element) => {
|
|
78
|
+
const BoxComponent = useConstant(() =>
|
|
79
|
+
typeof Element === 'string' ? StyledBoxElement : StyledBoxComponent
|
|
80
|
+
);
|
|
64
81
|
return (
|
|
65
|
-
<
|
|
82
|
+
<BoxComponent as={Element} ref={ref} {...elemProps}>
|
|
66
83
|
{children}
|
|
67
|
-
</
|
|
84
|
+
</BoxComponent>
|
|
68
85
|
);
|
|
69
86
|
},
|
|
70
87
|
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import {useThemeRTL} from './useThemeRTL';
|
|
2
|
+
import {CanvasThemePalette, EmotionCanvasTheme} from '@workday/canvas-kit-react/common';
|
|
3
|
+
import {colors, CSSProperties, inputColors, statusColors} from '@workday/canvas-kit-react/tokens';
|
|
4
|
+
import chroma from 'chroma-js';
|
|
5
|
+
|
|
6
|
+
type paletteSelection = Exclude<keyof EmotionCanvasTheme['canvas']['palette'], 'common'>;
|
|
7
|
+
interface ContrastColors {
|
|
8
|
+
outer?: string;
|
|
9
|
+
inner?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const isAccessible = (foreground: string, background: string = colors.frenchVanilla100) => {
|
|
13
|
+
return chroma.contrast(foreground, background) >= 3;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const getPaletteColorsFromTheme = (
|
|
17
|
+
palette: CanvasThemePalette,
|
|
18
|
+
fallbackColors?: ContrastColors
|
|
19
|
+
): ContrastColors => {
|
|
20
|
+
return {
|
|
21
|
+
outer: isAccessible(palette.main)
|
|
22
|
+
? palette.main
|
|
23
|
+
: isAccessible(palette.darkest)
|
|
24
|
+
? palette.darkest
|
|
25
|
+
: fallbackColors?.outer,
|
|
26
|
+
inner: fallbackColors?.inner ? fallbackColors.inner : palette.main,
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export function getPaletteColors(
|
|
31
|
+
type: paletteSelection,
|
|
32
|
+
theme: EmotionCanvasTheme
|
|
33
|
+
): ContrastColors {
|
|
34
|
+
const palette = theme.canvas.palette[type];
|
|
35
|
+
|
|
36
|
+
switch (type) {
|
|
37
|
+
case 'error': {
|
|
38
|
+
return getPaletteColorsFromTheme(palette, {outer: inputColors.error.border});
|
|
39
|
+
}
|
|
40
|
+
case 'alert': {
|
|
41
|
+
return getPaletteColorsFromTheme(palette, {outer: colors.cantaloupe600});
|
|
42
|
+
}
|
|
43
|
+
case 'success': {
|
|
44
|
+
return getPaletteColorsFromTheme(palette, {
|
|
45
|
+
outer: colors.greenApple600,
|
|
46
|
+
// The theme default for success.main is set to the darkest GreenApple
|
|
47
|
+
// For our default ring, we need to override it so the inner ring is a bit lighter
|
|
48
|
+
inner: palette.main === colors.greenApple600 ? statusColors.success : palette.main,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
default: {
|
|
52
|
+
return getPaletteColorsFromTheme(palette);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const useThemedRing = (type: paletteSelection): CSSProperties => {
|
|
58
|
+
const {themeRTL, theme} = useThemeRTL();
|
|
59
|
+
|
|
60
|
+
const paletteColors = getPaletteColors(type, theme);
|
|
61
|
+
if (!(paletteColors?.outer || paletteColors?.inner)) {
|
|
62
|
+
return {};
|
|
63
|
+
}
|
|
64
|
+
const errorBoxShadow = `inset 0 0 0 ${paletteColors.outer === paletteColors.inner ? 1 : 2}px ${
|
|
65
|
+
paletteColors.inner
|
|
66
|
+
}`;
|
|
67
|
+
|
|
68
|
+
return themeRTL({
|
|
69
|
+
borderColor: paletteColors.outer,
|
|
70
|
+
transition: '100ms box-shadow',
|
|
71
|
+
boxShadow: errorBoxShadow,
|
|
72
|
+
'&:hover, &:disabled': {
|
|
73
|
+
borderColor: paletteColors.outer,
|
|
74
|
+
},
|
|
75
|
+
'&:focus:not([disabled])': {
|
|
76
|
+
borderColor: paletteColors.outer,
|
|
77
|
+
boxShadow: `${errorBoxShadow},
|
|
78
|
+
0 0 0 2px ${colors.frenchVanilla100},
|
|
79
|
+
0 0 0 4px ${theme ? theme.canvas.palette.common.focusOutline : inputColors.focusBorder}`,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutocompleteList.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/AutocompleteList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAIhD,OAAO,EAAC,aAAa,EAAC,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAC,qBAAqB,EAAiD,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"AutocompleteList.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/AutocompleteList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAIhD,OAAO,EAAC,aAAa,EAAC,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAC,qBAAqB,EAAiD,MAAM,YAAY,CAAC;AAYjG,UAAU,qBAAqB;IAC7B;;OAEG;IACH,iBAAiB,EAAE,KAAK,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE,GAAG,qBAAqB,EAAE,CAAC;IACjF;;OAEG;IACH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;OAEG;IACH,uBAAuB,EAAE,CACvB,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC,EAC3C,aAAa,EAAE,aAAa,KACzB,IAAI,CAAC;IACV;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,QAAA,MAAM,gBAAgB,mJAwFrB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -33,7 +33,6 @@ var styled_1 = __importDefault(require("@emotion/styled"));
|
|
|
33
33
|
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
34
34
|
var common_1 = require("@workday/canvas-kit-react/common");
|
|
35
35
|
var Combobox_1 = require("./Combobox");
|
|
36
|
-
var v4_1 = __importDefault(require("uuid/v4"));
|
|
37
36
|
var Autocomplete = styled_1.default('ul')({
|
|
38
37
|
margin: 0,
|
|
39
38
|
maxHeight: 200,
|
|
@@ -44,7 +43,7 @@ var Autocomplete = styled_1.default('ul')({
|
|
|
44
43
|
var AccessibleHide = styled_1.default('span')(common_1.accessibleHide);
|
|
45
44
|
var AutocompleteList = function (_a) {
|
|
46
45
|
var autocompleteItems = _a.autocompleteItems, comboboxId = _a.comboboxId, selectedIndex = _a.selectedIndex, handleAutocompleteClick = _a.handleAutocompleteClick, labelId = _a.labelId, showGroupText = _a.showGroupText;
|
|
47
|
-
var randomComponentId = react_1.useState(
|
|
46
|
+
var randomComponentId = react_1.useState(common_1.generateUniqueId)[0]; // https://codesandbox.io/s/p2ndq
|
|
48
47
|
var componentId = comboboxId || randomComponentId;
|
|
49
48
|
var listBoxProps = {
|
|
50
49
|
role: 'listbox',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/Combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkE,MAAM,OAAO,CAAC;AAEvF,OAAO,
|
|
1
|
+
{"version":3,"file":"Combobox.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/Combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkE,MAAM,OAAO,CAAC;AAEvF,OAAO,EACL,cAAc,EAKf,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAC,aAAa,EAAC,MAAM,wCAAwC,CAAC;AAErE,OAAO,EAAa,eAAe,EAAC,MAAM,kCAAkC,CAAC;AAE7E,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC;AAKpE,MAAM,WAAW,qBAAqB;IAEpC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IAE1C,KAAK,EAAE,KAAK,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACtF;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;IAC7C;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;IAChD;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,iBAAiB,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE,GAAG,qBAAqB,EAAE,CAAC;IAClF;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC5D;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CAC/C;AA8DD,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,eAAO,MAAM,WAAW,qEACc,CAAC;AAEvC,eAAO,MAAM,kBAAkB,wCAc9B,CAAC;AAYF,QAAA,MAAM,QAAQ,qNAuUb,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -39,7 +39,6 @@ var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
|
39
39
|
var card_1 = require("@workday/canvas-kit-react/card");
|
|
40
40
|
var button_1 = require("@workday/canvas-kit-react/button");
|
|
41
41
|
var canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
|
|
42
|
-
var v4_1 = __importDefault(require("uuid/v4"));
|
|
43
42
|
var lodash_flatten_1 = __importDefault(require("lodash.flatten"));
|
|
44
43
|
var AutocompleteList_1 = __importDefault(require("./AutocompleteList"));
|
|
45
44
|
var Status_1 = __importDefault(require("./Status"));
|
|
@@ -77,6 +76,7 @@ var MenuContainer = common_1.styled(card_1.Card)({
|
|
|
77
76
|
minWidth: 0,
|
|
78
77
|
animation: fadeInKeyframes + " 200ms ease-out",
|
|
79
78
|
maxHeight: 200,
|
|
79
|
+
overflow: 'hidden',
|
|
80
80
|
});
|
|
81
81
|
var ResetButton = common_1.styled(button_1.IconButton)({
|
|
82
82
|
width: tokens_1.space.l,
|
|
@@ -145,8 +145,8 @@ var Combobox = function (_a) {
|
|
|
145
145
|
// to satisfy TS.
|
|
146
146
|
var elementRef = common_1.useForkRef(children.ref, inputRef);
|
|
147
147
|
var comboboxRef = react_1.useRef(null);
|
|
148
|
-
var randomComponentId =
|
|
149
|
-
var randomLabelId =
|
|
148
|
+
var randomComponentId = common_1.useUniqueId();
|
|
149
|
+
var randomLabelId = common_1.useUniqueId();
|
|
150
150
|
var componentId = id || randomComponentId;
|
|
151
151
|
var formLabelId = labelId || randomLabelId;
|
|
152
152
|
var _l = react_1.useState(false), showGroupText = _l[0], setShowGroupText = _l[1];
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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"}
|
|
@@ -48,7 +48,12 @@ var omittedProps = ['display', 'color', 'height', 'overflow', 'width', 'border',
|
|
|
48
48
|
var shouldForwardProp = function (prop) {
|
|
49
49
|
return is_prop_valid_1.default(prop) && !omittedProps.includes(prop);
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
// Meant to be used with elements. The `shouldForwardProps` will remove all style props
|
|
52
|
+
var StyledBoxElement = styled_1.default('div', { shouldForwardProp: shouldForwardProp })({
|
|
53
|
+
boxSizing: 'border-box',
|
|
54
|
+
}, border_1.border, color_1.color, depth_1.depth, flexItem_1.flexItem, layout_1.layout, position_1.position, space_1.space);
|
|
55
|
+
// Meant to be used with components. There is no `shouldForwardProps` - all props will be forwarded to the component
|
|
56
|
+
var StyledBoxComponent = styled_1.default('div')({
|
|
52
57
|
boxSizing: 'border-box',
|
|
53
58
|
}, border_1.border, color_1.color, depth_1.depth, flexItem_1.flexItem, layout_1.layout, position_1.position, space_1.space);
|
|
54
59
|
/**
|
|
@@ -72,6 +77,9 @@ exports.Box = common_1.createComponent('div')({
|
|
|
72
77
|
displayName: 'Box',
|
|
73
78
|
Component: function (_a, ref, Element) {
|
|
74
79
|
var children = _a.children, elemProps = __rest(_a, ["children"]);
|
|
75
|
-
|
|
80
|
+
var BoxComponent = common_1.useConstant(function () {
|
|
81
|
+
return typeof Element === 'string' ? StyledBoxElement : StyledBoxComponent;
|
|
82
|
+
});
|
|
83
|
+
return (React.createElement(BoxComponent, __assign({ as: Element, ref: ref }, elemProps), children));
|
|
76
84
|
},
|
|
77
85
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EmotionCanvasTheme } from '@workday/canvas-kit-react/common';
|
|
2
|
+
import { CSSProperties } from '@workday/canvas-kit-react/tokens';
|
|
3
|
+
declare type paletteSelection = Exclude<keyof EmotionCanvasTheme['canvas']['palette'], 'common'>;
|
|
4
|
+
interface ContrastColors {
|
|
5
|
+
outer?: string;
|
|
6
|
+
inner?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function getPaletteColors(type: paletteSelection, theme: EmotionCanvasTheme): ContrastColors;
|
|
9
|
+
export declare const useThemedRing: (type: "alert" | "error" | "primary" | "success" | "neutral") => CSSProperties;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=useThemedRing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useThemedRing.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/useThemedRing.ts"],"names":[],"mappings":"AACA,OAAO,EAAqB,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAS,aAAa,EAA4B,MAAM,kCAAkC,CAAC;AAGlG,aAAK,gBAAgB,GAAG,OAAO,CAAC,MAAM,kBAAkB,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,CAAC;AACzF,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAoBD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE,kBAAkB,GACxB,cAAc,CAsBhB;AAED,eAAO,MAAM,aAAa,gFAyBzB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var useThemeRTL_1 = require("./useThemeRTL");
|
|
7
|
+
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
8
|
+
var chroma_js_1 = __importDefault(require("chroma-js"));
|
|
9
|
+
var isAccessible = function (foreground, background) {
|
|
10
|
+
if (background === void 0) { background = tokens_1.colors.frenchVanilla100; }
|
|
11
|
+
return chroma_js_1.default.contrast(foreground, background) >= 3;
|
|
12
|
+
};
|
|
13
|
+
var getPaletteColorsFromTheme = function (palette, fallbackColors) {
|
|
14
|
+
return {
|
|
15
|
+
outer: isAccessible(palette.main)
|
|
16
|
+
? palette.main
|
|
17
|
+
: isAccessible(palette.darkest)
|
|
18
|
+
? palette.darkest
|
|
19
|
+
: fallbackColors === null || fallbackColors === void 0 ? void 0 : fallbackColors.outer,
|
|
20
|
+
inner: (fallbackColors === null || fallbackColors === void 0 ? void 0 : fallbackColors.inner) ? fallbackColors.inner : palette.main,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
function getPaletteColors(type, theme) {
|
|
24
|
+
var palette = theme.canvas.palette[type];
|
|
25
|
+
switch (type) {
|
|
26
|
+
case 'error': {
|
|
27
|
+
return getPaletteColorsFromTheme(palette, { outer: tokens_1.inputColors.error.border });
|
|
28
|
+
}
|
|
29
|
+
case 'alert': {
|
|
30
|
+
return getPaletteColorsFromTheme(palette, { outer: tokens_1.colors.cantaloupe600 });
|
|
31
|
+
}
|
|
32
|
+
case 'success': {
|
|
33
|
+
return getPaletteColorsFromTheme(palette, {
|
|
34
|
+
outer: tokens_1.colors.greenApple600,
|
|
35
|
+
// The theme default for success.main is set to the darkest GreenApple
|
|
36
|
+
// For our default ring, we need to override it so the inner ring is a bit lighter
|
|
37
|
+
inner: palette.main === tokens_1.colors.greenApple600 ? tokens_1.statusColors.success : palette.main,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
default: {
|
|
41
|
+
return getPaletteColorsFromTheme(palette);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.getPaletteColors = getPaletteColors;
|
|
46
|
+
exports.useThemedRing = function (type) {
|
|
47
|
+
var _a = useThemeRTL_1.useThemeRTL(), themeRTL = _a.themeRTL, theme = _a.theme;
|
|
48
|
+
var paletteColors = getPaletteColors(type, theme);
|
|
49
|
+
if (!((paletteColors === null || paletteColors === void 0 ? void 0 : paletteColors.outer) || (paletteColors === null || paletteColors === void 0 ? void 0 : paletteColors.inner))) {
|
|
50
|
+
return {};
|
|
51
|
+
}
|
|
52
|
+
var errorBoxShadow = "inset 0 0 0 " + (paletteColors.outer === paletteColors.inner ? 1 : 2) + "px " + paletteColors.inner;
|
|
53
|
+
return themeRTL({
|
|
54
|
+
borderColor: paletteColors.outer,
|
|
55
|
+
transition: '100ms box-shadow',
|
|
56
|
+
boxShadow: errorBoxShadow,
|
|
57
|
+
'&:hover, &:disabled': {
|
|
58
|
+
borderColor: paletteColors.outer,
|
|
59
|
+
},
|
|
60
|
+
'&:focus:not([disabled])': {
|
|
61
|
+
borderColor: paletteColors.outer,
|
|
62
|
+
boxShadow: errorBoxShadow + ",\n 0 0 0 2px " + tokens_1.colors.frenchVanilla100 + ",\n 0 0 0 4px " + (theme ? theme.canvas.palette.common.focusOutline : tokens_1.inputColors.focusBorder),
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
export default
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
1
|
+
import DeprecatedHeader from './lib/Header';
|
|
2
|
+
import DeprecatedGlobalHeader from './lib/GlobalHeader';
|
|
3
|
+
export default DeprecatedHeader;
|
|
4
|
+
export { DeprecatedHeader };
|
|
5
|
+
export { DeprecatedGlobalHeader };
|
|
6
6
|
export * from './lib/parts';
|
|
7
7
|
export * from './lib/shared/themes';
|
|
8
8
|
export * from './lib/shared/types';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../header/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../header/index.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,cAAc,CAAC;AAC5C,OAAO,sBAAsB,MAAM,oBAAoB,CAAC;AAExD,eAAe,gBAAgB,CAAC;AAChC,OAAO,EAAC,gBAAgB,EAAC,CAAC;AAC1B,OAAO,EAAC,sBAAsB,EAAC,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
|
@@ -7,9 +7,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
var Header_1 = __importDefault(require("./lib/Header"));
|
|
10
|
-
exports.
|
|
10
|
+
exports.DeprecatedHeader = Header_1.default;
|
|
11
11
|
var GlobalHeader_1 = __importDefault(require("./lib/GlobalHeader"));
|
|
12
|
-
exports.
|
|
12
|
+
exports.DeprecatedGlobalHeader = GlobalHeader_1.default;
|
|
13
13
|
exports.default = Header_1.default;
|
|
14
14
|
__export(require("./lib/parts"));
|
|
15
15
|
__export(require("./lib/shared/themes"));
|
|
@@ -19,11 +19,20 @@ export interface GlobalHeaderProps {
|
|
|
19
19
|
*/
|
|
20
20
|
isCollapsed?: boolean;
|
|
21
21
|
/**
|
|
22
|
-
* The React element to render in the left slot of the GlobalHeader. This is typically a
|
|
22
|
+
* The React element to render in the left slot of the GlobalHeader. This is typically a SearchForm component.
|
|
23
23
|
*/
|
|
24
24
|
leftSlot?: React.ReactElement;
|
|
25
25
|
}
|
|
26
|
-
|
|
26
|
+
/**
|
|
27
|
+
* ### Deprecated Global Header
|
|
28
|
+
*
|
|
29
|
+
* As of Canvas Kit v6, this component is being soft-deprecated.
|
|
30
|
+
* It will be hard-deprecated (completely removed) in v7. Please see the
|
|
31
|
+
* [migration guide](https://workday.github.io/canvas-kit/?path=/story/welcome-migration-guides-v6-0--page)
|
|
32
|
+
* for more information.
|
|
33
|
+
*/
|
|
34
|
+
export default class DeprecatedGlobalHeader extends React.Component<GlobalHeaderProps> {
|
|
35
|
+
componentDidMount(): void;
|
|
27
36
|
render(): JSX.Element;
|
|
28
37
|
}
|
|
29
38
|
//# sourceMappingURL=GlobalHeader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalHeader.d.ts","sourceRoot":"","sources":["../../../../header/lib/GlobalHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC5C;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;CAC/B;AAED,MAAM,CAAC,OAAO,OAAO,
|
|
1
|
+
{"version":3,"file":"GlobalHeader.d.ts","sourceRoot":"","sources":["../../../../header/lib/GlobalHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC5C;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAuB,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC;IACpF,iBAAiB;IASV,MAAM;CAwBd"}
|
|
@@ -49,15 +49,26 @@ var React = __importStar(require("react"));
|
|
|
49
49
|
var Header_1 = __importDefault(require("./Header"));
|
|
50
50
|
var types_1 = require("./shared/types");
|
|
51
51
|
var parts_1 = require("./parts");
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
/**
|
|
53
|
+
* ### Deprecated Global Header
|
|
54
|
+
*
|
|
55
|
+
* As of Canvas Kit v6, this component is being soft-deprecated.
|
|
56
|
+
* It will be hard-deprecated (completely removed) in v7. Please see the
|
|
57
|
+
* [migration guide](https://workday.github.io/canvas-kit/?path=/story/welcome-migration-guides-v6-0--page)
|
|
58
|
+
* for more information.
|
|
59
|
+
*/
|
|
60
|
+
var DeprecatedGlobalHeader = /** @class */ (function (_super) {
|
|
61
|
+
__extends(DeprecatedGlobalHeader, _super);
|
|
62
|
+
function DeprecatedGlobalHeader() {
|
|
55
63
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
56
64
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return (React.createElement(Header_1.default, __assign({ brand: brand, menuToggle: menuToggle, leftSlot: leftSlot, onMenuClick: onMenuClick, variant: types_1.HeaderVariant.Global, isCollapsed: isCollapsed }, elemProps), children));
|
|
65
|
+
DeprecatedGlobalHeader.prototype.componentDidMount = function () {
|
|
66
|
+
console.warn("GlobalHeader is being deprecated and will be removed in Canvas Kit V7.\n\n For more information, please see the V6 migration guide:\n\n https://workday.github.io/canvas-kit/?path=/story/welcome-migration-guides-v6-0--page\n ");
|
|
60
67
|
};
|
|
61
|
-
|
|
68
|
+
DeprecatedGlobalHeader.prototype.render = function () {
|
|
69
|
+
var _a = this.props, _b = _a.brand, brand = _b === void 0 ? React.createElement(parts_1.DeprecatedDubLogoTitle, null) : _b, menuToggle = _a.menuToggle, onMenuClick = _a.onMenuClick, isCollapsed = _a.isCollapsed, leftSlot = _a.leftSlot, children = _a.children, elemProps = __rest(_a, ["brand", "menuToggle", "onMenuClick", "isCollapsed", "leftSlot", "children"]);
|
|
70
|
+
return (React.createElement(Header_1.default, __assign({ brand: brand, menuToggle: menuToggle, leftSlot: leftSlot, onMenuClick: onMenuClick, variant: types_1.DeprecatedHeaderVariant.Global, isCollapsed: isCollapsed }, elemProps), children));
|
|
71
|
+
};
|
|
72
|
+
return DeprecatedGlobalHeader;
|
|
62
73
|
}(React.Component));
|
|
63
|
-
exports.default =
|
|
74
|
+
exports.default = DeprecatedGlobalHeader;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { DeprecatedHeaderTheme, DeprecatedHeaderVariant } from './shared/types';
|
|
3
3
|
export interface HeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
/**
|
|
5
5
|
* The custom menu toggle node of the Header. This React node replaces the default menu toggle.
|
|
@@ -7,14 +7,14 @@ export interface HeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
menuToggle?: React.ReactNode;
|
|
8
8
|
/**
|
|
9
9
|
* The theme of the Header. Accepts `White`, `Blue`, or `Transparent`.
|
|
10
|
-
* @default
|
|
10
|
+
* @default DeprecatedHeaderTheme.White
|
|
11
11
|
*/
|
|
12
|
-
themeColor?:
|
|
12
|
+
themeColor?: DeprecatedHeaderTheme;
|
|
13
13
|
/**
|
|
14
14
|
* The variant of the Header. Accepts `Dub` (small) or `Full` (large).
|
|
15
|
-
* @default
|
|
15
|
+
* @default DeprecatedHeaderVariant.Dub
|
|
16
16
|
*/
|
|
17
|
-
variant?:
|
|
17
|
+
variant?: DeprecatedHeaderVariant;
|
|
18
18
|
/**
|
|
19
19
|
* The text of the Header title. Not used if `brand` is provided.
|
|
20
20
|
*/
|
|
@@ -37,7 +37,7 @@ export interface HeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
37
37
|
*/
|
|
38
38
|
onMenuClick?: (e: React.MouseEvent) => void;
|
|
39
39
|
/**
|
|
40
|
-
* The React element to render in the left slot of the Header. This is typically a
|
|
40
|
+
* The React element to render in the left slot of the Header. This is typically a SearchForm component.
|
|
41
41
|
*/
|
|
42
42
|
leftSlot?: React.ReactElement;
|
|
43
43
|
/**
|
|
@@ -46,9 +46,18 @@ export interface HeaderProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
46
46
|
*/
|
|
47
47
|
isCollapsed?: boolean;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* ### Deprecated Header
|
|
51
|
+
*
|
|
52
|
+
* As of Canvas Kit v6, this component is being soft-deprecated.
|
|
53
|
+
* It will be hard-deprecated (completely removed) in v7. Please see the
|
|
54
|
+
* [migration guide](https://workday.github.io/canvas-kit/?path=/story/welcome-migration-guides-v6-0--page)
|
|
55
|
+
* for more information.
|
|
56
|
+
*/
|
|
49
57
|
export default class Header extends React.Component<HeaderProps, {}> {
|
|
50
|
-
static Theme: typeof
|
|
51
|
-
static Variant: typeof
|
|
58
|
+
static Theme: typeof DeprecatedHeaderTheme;
|
|
59
|
+
static Variant: typeof DeprecatedHeaderVariant;
|
|
60
|
+
componentDidMount(): void;
|
|
52
61
|
/**
|
|
53
62
|
* Helper that recursively maps ReactNodes to their theme-based equivalent.
|
|
54
63
|
* Any children that are included in a Header may need to undergo transformation
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../header/lib/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,
|
|
1
|
+
{"version":3,"file":"Header.d.ts","sourceRoot":"","sources":["../../../../header/lib/Header.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAEL,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,gBAAgB,CAAC;AAMxB,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IACvE;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B;;;OAGG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAC;IACnC;;;OAGG;IACH,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAClC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;IAC5C;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC;IAC9B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA4ND;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,KAAK,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC;IAClE,MAAM,CAAC,KAAK,+BAAyB;IACrC,MAAM,CAAC,OAAO,iCAA2B;IAEzC,iBAAiB;IASjB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,cAAc;IAwDtB,MAAM;CA0DP"}
|