@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,24 +1,23 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { GrowthBehavior } from '@workday/canvas-kit-react/common';
|
|
3
3
|
import { MenuItemProps } from '@workday/canvas-kit-preview-react/menu';
|
|
4
|
-
import { SearchThemeAttributes } from '
|
|
5
|
-
|
|
6
|
-
export interface SearchBarProps extends GrowthBehavior, React.FormHTMLAttributes<HTMLFormElement> {
|
|
4
|
+
import { SearchThemeAttributes, SearchTheme } from './themes';
|
|
5
|
+
export interface SearchFormProps extends GrowthBehavior, React.FormHTMLAttributes<HTMLFormElement> {
|
|
7
6
|
/**
|
|
8
|
-
* The function called when the
|
|
7
|
+
* The function called when the SearchForm form is submitted. The current input value is passed to the callback function.
|
|
9
8
|
*/
|
|
10
9
|
onSubmit: React.FormEventHandler<HTMLFormElement>;
|
|
11
10
|
/**
|
|
12
|
-
* If true, collapse the
|
|
11
|
+
* If true, collapse the SearchForm text input into a toggle icon. Useful for responsive layouts.
|
|
13
12
|
* @default false
|
|
14
13
|
*/
|
|
15
14
|
isCollapsed?: boolean;
|
|
16
15
|
/**
|
|
17
|
-
* The function called when the
|
|
16
|
+
* The function called when the SearchForm text input changes.
|
|
18
17
|
*/
|
|
19
18
|
onInputChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
20
19
|
/**
|
|
21
|
-
* The autocomplete items of the
|
|
20
|
+
* The autocomplete items of the SearchForm. This array of menu items is shown under the search bar.
|
|
22
21
|
*/
|
|
23
22
|
autocompleteItems?: React.ReactElement<MenuItemProps>[];
|
|
24
23
|
/**
|
|
@@ -26,73 +25,78 @@ export interface SearchBarProps extends GrowthBehavior, React.FormHTMLAttributes
|
|
|
26
25
|
*/
|
|
27
26
|
searchTheme?: SearchTheme | SearchThemeAttributes;
|
|
28
27
|
/**
|
|
29
|
-
* The placeholder text of the
|
|
28
|
+
* The placeholder text of the SearchForm text input.
|
|
30
29
|
* @default Search
|
|
31
30
|
*/
|
|
32
31
|
placeholder?: string;
|
|
33
32
|
/**
|
|
34
|
-
* The initial value of the
|
|
33
|
+
* The initial value of the SearchForm text input.
|
|
35
34
|
*/
|
|
36
35
|
initialValue?: string;
|
|
37
36
|
/**
|
|
38
|
-
* If true, right-align the
|
|
37
|
+
* If true, right-align the SearchForm. If false, the text input should grow to left-align the SearchForm.
|
|
39
38
|
* @default false
|
|
40
39
|
*/
|
|
41
40
|
rightAlign?: boolean;
|
|
42
41
|
/**
|
|
43
|
-
* The screenreader label text for the
|
|
42
|
+
* The screenreader label text for the SearchForm text input.
|
|
44
43
|
* @default Search
|
|
45
44
|
*/
|
|
46
45
|
inputLabel?: string;
|
|
47
46
|
/**
|
|
48
|
-
* The screenreader label text for the
|
|
47
|
+
* The screenreader label text for the SearchForm submit button.
|
|
49
48
|
* @default Search
|
|
50
49
|
*/
|
|
51
50
|
submitAriaLabel?: string;
|
|
52
51
|
/**
|
|
53
|
-
* The screenreader label text for the
|
|
52
|
+
* The screenreader label text for the SearchForm clear button.
|
|
54
53
|
* @default Reset Search Form
|
|
55
54
|
*/
|
|
56
55
|
clearButtonAriaLabel?: string;
|
|
57
56
|
/**
|
|
58
|
-
* The screenreader label text for the button to open the collapsed
|
|
57
|
+
* The screenreader label text for the button to open the collapsed SearchForm.
|
|
59
58
|
* @default Open Search
|
|
60
59
|
*/
|
|
61
60
|
openButtonAriaLabel?: string;
|
|
62
61
|
/**
|
|
63
|
-
* The screenreader label text for the button to close the open
|
|
62
|
+
* The screenreader label text for the button to close the open SearchForm.
|
|
64
63
|
* @default Cancel
|
|
65
64
|
*/
|
|
66
65
|
closeButtonAriaLabel?: string;
|
|
67
66
|
/**
|
|
68
|
-
* If true, render the
|
|
67
|
+
* If true, render the SearchForm with a button to clear the text input.
|
|
69
68
|
* @default true
|
|
70
69
|
*/
|
|
71
70
|
showClearButton?: boolean;
|
|
72
71
|
/**
|
|
73
|
-
* Height of the Search
|
|
74
|
-
* @default
|
|
72
|
+
* Height of the Search Form in pixels
|
|
73
|
+
* @default 40
|
|
75
74
|
*/
|
|
76
75
|
height?: number;
|
|
76
|
+
/**
|
|
77
|
+
* If true, allow onSubmit being called when input value is empty.
|
|
78
|
+
* @default false
|
|
79
|
+
*/
|
|
80
|
+
allowEmptyStringSearch?: boolean;
|
|
77
81
|
}
|
|
78
|
-
export interface
|
|
82
|
+
export interface SearchFormState {
|
|
79
83
|
showForm: boolean;
|
|
80
84
|
searchQuery: string;
|
|
81
85
|
isFocused: boolean;
|
|
82
86
|
}
|
|
83
|
-
export declare class
|
|
87
|
+
export declare class SearchForm extends React.Component<SearchFormProps, SearchFormState> {
|
|
84
88
|
static Theme: typeof SearchTheme;
|
|
85
89
|
private inputRef;
|
|
86
90
|
private openRef;
|
|
87
91
|
private labelId;
|
|
88
|
-
state: Readonly<
|
|
92
|
+
state: Readonly<SearchFormState>;
|
|
89
93
|
private getTheme;
|
|
90
94
|
private getThemeColors;
|
|
91
95
|
getIconButtonType: () => "circle" | "square" | "inverse" | "squareFilled" | "plain" | "circleFilled" | "inverseFilled" | undefined;
|
|
92
96
|
handleSubmit: (event: React.FormEvent<HTMLFormElement>) => void;
|
|
93
97
|
openCollapsedSearch: () => void;
|
|
94
98
|
closeCollapsedSearch: () => void;
|
|
95
|
-
componentDidUpdate(prevProps:
|
|
99
|
+
componentDidUpdate(prevProps: SearchFormProps, prevState: SearchFormState): void;
|
|
96
100
|
focusInput: () => void;
|
|
97
101
|
focusOpen: () => void;
|
|
98
102
|
handleFocus: () => void;
|
|
@@ -100,4 +104,4 @@ export declare class SearchBar extends React.Component<SearchBarProps, SearchBar
|
|
|
100
104
|
handleSearchInputChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
101
105
|
render(): JSX.Element;
|
|
102
106
|
}
|
|
103
|
-
//# sourceMappingURL=
|
|
107
|
+
//# sourceMappingURL=SearchForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchForm.d.ts","sourceRoot":"","sources":["../../../../search-form/lib/SearchForm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ClC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACpB;AAuMD,qBAAa,UAAW,SAAQ,KAAK,CAAC,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAC/E,MAAM,CAAC,KAAK,qBAAe;IAE3B,OAAO,CAAC,QAAQ,CAAuC;IACvD,OAAO,CAAC,OAAO,CAAwC;IACvD,OAAO,CAAC,OAAO,CAAsB;IAErC,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC,CAI9B;IAEF,OAAO,CAAC,QAAQ,CAUd;IAEF,OAAO,CAAC,cAAc,CAMpB;IAEF,iBAAiB,kHAOf;IAEF,YAAY,oDAOV;IAEF,mBAAmB,aAIjB;IAEF,oBAAoB,aAIlB;IAEF,kBAAkB,CAAC,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe;IAWzE,UAAU,aAIR;IAEF,SAAS,aAIP;IAEF,WAAW,aAET;IAEF,UAAU,aAER;IAEF,uBAAuB,uDAMrB;IAEF,MAAM;CAoGP"}
|
|
@@ -53,10 +53,8 @@ var canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
|
|
|
53
53
|
var form_field_1 = require("@workday/canvas-kit-react/form-field");
|
|
54
54
|
var combobox_1 = require("@workday/canvas-kit-labs-react/combobox");
|
|
55
55
|
var text_input_1 = require("@workday/canvas-kit-react/text-input");
|
|
56
|
-
var themes_1 = require("
|
|
57
|
-
var types_1 = require("../shared/types");
|
|
56
|
+
var themes_1 = require("./themes");
|
|
58
57
|
var chroma_js_1 = __importDefault(require("chroma-js"));
|
|
59
|
-
var v4_1 = __importDefault(require("uuid/v4"));
|
|
60
58
|
function getInputColors(theme, isFocused) {
|
|
61
59
|
return {
|
|
62
60
|
background: isFocused && theme.backgroundFocus ? theme.backgroundFocus : theme.background,
|
|
@@ -71,7 +69,7 @@ function getInputColors(theme, isFocused) {
|
|
|
71
69
|
var formCollapsedBackground = tokens_1.colors.frenchVanilla100;
|
|
72
70
|
var maxWidth = 480;
|
|
73
71
|
var minWidth = 120;
|
|
74
|
-
var
|
|
72
|
+
var StyledSearchForm = common_1.styled('form')({
|
|
75
73
|
position: 'relative',
|
|
76
74
|
flex: "1 1 auto",
|
|
77
75
|
display: 'flex',
|
|
@@ -198,13 +196,13 @@ var SearchInput = common_1.styled(text_input_1.TextInput)(function (_a) {
|
|
|
198
196
|
},
|
|
199
197
|
} }, collapseStyles);
|
|
200
198
|
});
|
|
201
|
-
var
|
|
202
|
-
__extends(
|
|
203
|
-
function
|
|
199
|
+
var SearchForm = /** @class */ (function (_super) {
|
|
200
|
+
__extends(SearchForm, _super);
|
|
201
|
+
function SearchForm() {
|
|
204
202
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
205
203
|
_this.inputRef = React.createRef();
|
|
206
204
|
_this.openRef = React.createRef();
|
|
207
|
-
_this.labelId =
|
|
205
|
+
_this.labelId = common_1.generateUniqueId();
|
|
208
206
|
_this.state = {
|
|
209
207
|
showForm: false,
|
|
210
208
|
searchQuery: '',
|
|
@@ -219,13 +217,13 @@ var SearchBar = /** @class */ (function (_super) {
|
|
|
219
217
|
theme = _this.props.searchTheme;
|
|
220
218
|
}
|
|
221
219
|
else {
|
|
222
|
-
theme = themes_1.searchThemes[
|
|
220
|
+
theme = themes_1.searchThemes[themes_1.SearchTheme.Light];
|
|
223
221
|
}
|
|
224
222
|
return theme;
|
|
225
223
|
};
|
|
226
224
|
_this.getThemeColors = function () {
|
|
227
225
|
var theme = _this.props.isCollapsed && _this.state.showForm
|
|
228
|
-
? themes_1.searchThemes[
|
|
226
|
+
? themes_1.searchThemes[themes_1.SearchTheme.Transparent]
|
|
229
227
|
: _this.getTheme();
|
|
230
228
|
return getInputColors(theme, _this.state.isFocused);
|
|
231
229
|
};
|
|
@@ -239,7 +237,7 @@ var SearchBar = /** @class */ (function (_super) {
|
|
|
239
237
|
};
|
|
240
238
|
_this.handleSubmit = function (event) {
|
|
241
239
|
event.preventDefault();
|
|
242
|
-
if (_this.state.searchQuery.trim()) {
|
|
240
|
+
if (_this.props.allowEmptyStringSearch || _this.state.searchQuery.trim()) {
|
|
243
241
|
_this.props.onSubmit(event);
|
|
244
242
|
}
|
|
245
243
|
else {
|
|
@@ -281,7 +279,7 @@ var SearchBar = /** @class */ (function (_super) {
|
|
|
281
279
|
};
|
|
282
280
|
return _this;
|
|
283
281
|
}
|
|
284
|
-
|
|
282
|
+
SearchForm.prototype.componentDidUpdate = function (prevProps, prevState) {
|
|
285
283
|
var showFormToggled = this.state.showForm !== prevState.showForm;
|
|
286
284
|
if (showFormToggled) {
|
|
287
285
|
if (this.state.showForm) {
|
|
@@ -292,18 +290,18 @@ var SearchBar = /** @class */ (function (_super) {
|
|
|
292
290
|
}
|
|
293
291
|
}
|
|
294
292
|
};
|
|
295
|
-
|
|
296
|
-
var _a = this.props, _b = _a.clearButtonAriaLabel, clearButtonAriaLabel = _b === void 0 ? 'Reset Search Form' : _b, _c = _a.placeholder, placeholder = _c === void 0 ? 'Search' : _c, _d = _a.inputLabel, inputLabel = _d === void 0 ? 'Search' : _d, _e = _a.submitAriaLabel, submitAriaLabel = _e === void 0 ? 'Search' : _e, _f = _a.openButtonAriaLabel, openButtonAriaLabel = _f === void 0 ? 'Open Search' : _f, _g = _a.closeButtonAriaLabel, closeButtonAriaLabel = _g === void 0 ? 'Cancel' : _g, _h = _a.showClearButton, showClearButton = _h === void 0 ? true : _h, _j = _a.height, height = _j === void 0 ? 40 : _j, grow = _a.grow, onSubmit = _a.onSubmit, isCollapsed = _a.isCollapsed, onInputChange = _a.onInputChange, autocompleteItems = _a.autocompleteItems, initialValue = _a.initialValue, searchTheme = _a.searchTheme, rightAlign = _a.rightAlign, elemProps = __rest(_a, ["clearButtonAriaLabel", "placeholder", "inputLabel", "submitAriaLabel", "openButtonAriaLabel", "closeButtonAriaLabel", "showClearButton", "height", "grow", "onSubmit", "isCollapsed", "onInputChange", "autocompleteItems", "initialValue", "searchTheme", "rightAlign"]);
|
|
297
|
-
return (React.createElement(
|
|
293
|
+
SearchForm.prototype.render = function () {
|
|
294
|
+
var _a = this.props, _b = _a.clearButtonAriaLabel, clearButtonAriaLabel = _b === void 0 ? 'Reset Search Form' : _b, _c = _a.placeholder, placeholder = _c === void 0 ? 'Search' : _c, _d = _a.inputLabel, inputLabel = _d === void 0 ? 'Search' : _d, _e = _a.submitAriaLabel, submitAriaLabel = _e === void 0 ? 'Search' : _e, _f = _a.openButtonAriaLabel, openButtonAriaLabel = _f === void 0 ? 'Open Search' : _f, _g = _a.closeButtonAriaLabel, closeButtonAriaLabel = _g === void 0 ? 'Cancel' : _g, _h = _a.showClearButton, showClearButton = _h === void 0 ? true : _h, _j = _a.height, height = _j === void 0 ? 40 : _j, grow = _a.grow, onSubmit = _a.onSubmit, isCollapsed = _a.isCollapsed, onInputChange = _a.onInputChange, autocompleteItems = _a.autocompleteItems, initialValue = _a.initialValue, searchTheme = _a.searchTheme, rightAlign = _a.rightAlign, _k = _a.allowEmptyStringSearch, allowEmptyStringSearch = _k === void 0 ? false : _k, elemProps = __rest(_a, ["clearButtonAriaLabel", "placeholder", "inputLabel", "submitAriaLabel", "openButtonAriaLabel", "closeButtonAriaLabel", "showClearButton", "height", "grow", "onSubmit", "isCollapsed", "onInputChange", "autocompleteItems", "initialValue", "searchTheme", "rightAlign", "allowEmptyStringSearch"]);
|
|
295
|
+
return (React.createElement(StyledSearchForm, __assign({ role: "search", action: ".", rightAlign: rightAlign, grow: grow, "aria-labelledby": this.labelId, isCollapsed: isCollapsed, onSubmit: this.handleSubmit, showForm: this.state.showForm }, elemProps),
|
|
298
296
|
React.createElement(SearchContainer, { height: height },
|
|
299
297
|
React.createElement(SearchIcon, { "aria-label": submitAriaLabel, icon: canvas_system_icons_web_1.searchIcon, isCollapsed: isCollapsed, variant: this.getIconButtonType(), type: "submit", isHidden: !!isCollapsed && !this.state.showForm }),
|
|
300
298
|
React.createElement(SearchIcon, { "aria-label": openButtonAriaLabel, icon: canvas_system_icons_web_1.searchIcon, isCollapsed: isCollapsed, variant: this.getIconButtonType(), onClick: this.openCollapsedSearch, ref: this.openRef, type: "button", isHidden: !isCollapsed || (!!isCollapsed && this.state.showForm) }),
|
|
301
299
|
React.createElement(SearchField, { grow: grow, id: this.labelId, inputId: "input-" + this.labelId, label: inputLabel, labelPosition: form_field_1.FormFieldLabelPosition.Hidden, useFieldset: false, isCollapsed: isCollapsed, showForm: this.state.showForm, height: height },
|
|
302
300
|
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 },
|
|
303
|
-
React.createElement(SearchInput, { ref: this.inputRef, value: this.state.searchQuery, placeholder: placeholder, isCollapsed: isCollapsed, inputColors: this.getThemeColors(), height: height, name: "search" }))),
|
|
301
|
+
React.createElement(SearchInput, { ref: this.inputRef, value: this.state.searchQuery, placeholder: placeholder, isCollapsed: isCollapsed, inputColors: this.getThemeColors(), height: height, name: "search", autoComplete: "off" }))),
|
|
304
302
|
React.createElement(CloseButton, { "aria-label": closeButtonAriaLabel, icon: canvas_system_icons_web_1.xIcon, isCollapsed: isCollapsed, variant: "plain", showForm: this.state.showForm, onClick: this.closeCollapsedSearch, type: "button" }))));
|
|
305
303
|
};
|
|
306
|
-
|
|
307
|
-
return
|
|
304
|
+
SearchForm.Theme = themes_1.SearchTheme;
|
|
305
|
+
return SearchForm;
|
|
308
306
|
}(React.Component));
|
|
309
|
-
exports.
|
|
307
|
+
exports.SearchForm = SearchForm;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare enum SearchTheme {
|
|
2
|
+
Light = 0,
|
|
3
|
+
Dark = 1,
|
|
4
|
+
Transparent = 2
|
|
5
|
+
}
|
|
6
|
+
export interface SearchThemeAttributes {
|
|
7
|
+
background?: string;
|
|
8
|
+
backgroundFocus?: string;
|
|
9
|
+
backgroundHover?: string;
|
|
10
|
+
color?: string;
|
|
11
|
+
colorFocus?: string;
|
|
12
|
+
placeholderColor?: string;
|
|
13
|
+
placeholderColorFocus?: string;
|
|
14
|
+
boxShadow?: string | string[];
|
|
15
|
+
boxShadowFocus?: string | string[];
|
|
16
|
+
}
|
|
17
|
+
export interface SearchThemes {
|
|
18
|
+
[key: string]: SearchThemeAttributes;
|
|
19
|
+
}
|
|
20
|
+
export declare const searchThemes: SearchThemes;
|
|
21
|
+
//# sourceMappingURL=themes.d.ts.map
|
|
@@ -0,0 +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;AACD,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"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
5
|
+
var tokens_1 = require("@workday/canvas-kit-react/tokens");
|
|
6
|
+
var SearchTheme;
|
|
7
|
+
(function (SearchTheme) {
|
|
8
|
+
SearchTheme[SearchTheme["Light"] = 0] = "Light";
|
|
9
|
+
SearchTheme[SearchTheme["Dark"] = 1] = "Dark";
|
|
10
|
+
SearchTheme[SearchTheme["Transparent"] = 2] = "Transparent";
|
|
11
|
+
})(SearchTheme = exports.SearchTheme || (exports.SearchTheme = {}));
|
|
12
|
+
exports.searchThemes = (_a = {},
|
|
13
|
+
_a[SearchTheme.Transparent] = {
|
|
14
|
+
background: 'rgba(0, 0, 0, 0)',
|
|
15
|
+
backgroundFocus: 'rgba(0, 0, 0, 0)',
|
|
16
|
+
color: tokens_1.colors.blackPepper300,
|
|
17
|
+
colorFocus: tokens_1.colors.blackPepper300,
|
|
18
|
+
placeholderColor: tokens_1.colors.licorice300,
|
|
19
|
+
placeholderColorFocus: tokens_1.colors.licorice300,
|
|
20
|
+
boxShadow: 'none',
|
|
21
|
+
boxShadowFocus: 'none',
|
|
22
|
+
},
|
|
23
|
+
_a[SearchTheme.Light] = {
|
|
24
|
+
background: tokens_1.colors.soap200,
|
|
25
|
+
backgroundFocus: tokens_1.colors.soap200,
|
|
26
|
+
backgroundHover: tokens_1.colors.soap300,
|
|
27
|
+
color: tokens_1.colors.blackPepper300,
|
|
28
|
+
placeholderColor: tokens_1.colors.licorice300,
|
|
29
|
+
boxShadow: 'none',
|
|
30
|
+
boxShadowFocus: common_1.focusRing().boxShadow,
|
|
31
|
+
},
|
|
32
|
+
_a[SearchTheme.Dark] = {
|
|
33
|
+
background: 'rgba(0, 0, 0, 0.2)',
|
|
34
|
+
backgroundFocus: tokens_1.colors.frenchVanilla100,
|
|
35
|
+
color: tokens_1.colors.frenchVanilla100,
|
|
36
|
+
colorFocus: tokens_1.colors.blackPepper300,
|
|
37
|
+
placeholderColor: tokens_1.colors.frenchVanilla100,
|
|
38
|
+
placeholderColorFocus: tokens_1.colors.licorice300,
|
|
39
|
+
boxShadow: 'none',
|
|
40
|
+
},
|
|
41
|
+
_a);
|
|
@@ -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"}
|
|
@@ -19,9 +19,8 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
|
19
19
|
import React, { Fragment, useState } from 'react';
|
|
20
20
|
import styled from '@emotion/styled';
|
|
21
21
|
import { space } from '@workday/canvas-kit-react/tokens';
|
|
22
|
-
import { accessibleHide } from '@workday/canvas-kit-react/common';
|
|
22
|
+
import { accessibleHide, generateUniqueId } from '@workday/canvas-kit-react/common';
|
|
23
23
|
import { getOptionId, listBoxIdPart, getTextFromElement } from './Combobox';
|
|
24
|
-
import uuid from 'uuid/v4';
|
|
25
24
|
var Autocomplete = styled('ul')({
|
|
26
25
|
margin: 0,
|
|
27
26
|
maxHeight: 200,
|
|
@@ -32,7 +31,7 @@ var Autocomplete = styled('ul')({
|
|
|
32
31
|
var AccessibleHide = styled('span')(accessibleHide);
|
|
33
32
|
var AutocompleteList = function (_a) {
|
|
34
33
|
var autocompleteItems = _a.autocompleteItems, comboboxId = _a.comboboxId, selectedIndex = _a.selectedIndex, handleAutocompleteClick = _a.handleAutocompleteClick, labelId = _a.labelId, showGroupText = _a.showGroupText;
|
|
35
|
-
var randomComponentId = useState(
|
|
34
|
+
var randomComponentId = useState(generateUniqueId)[0]; // https://codesandbox.io/s/p2ndq
|
|
36
35
|
var componentId = comboboxId || randomComponentId;
|
|
37
36
|
var listBoxProps = {
|
|
38
37
|
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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(s, e) {
|
|
|
22
22
|
};
|
|
23
23
|
import React, { useEffect, useLayoutEffect, useRef, useState, useCallback } from 'react';
|
|
24
24
|
import { jsx, keyframes } from '@emotion/core';
|
|
25
|
-
import { useForkRef, styled, useIsRTL } from '@workday/canvas-kit-react/common';
|
|
25
|
+
import { useForkRef, styled, useIsRTL, useUniqueId, } from '@workday/canvas-kit-react/common';
|
|
26
26
|
import { space, commonColors, borderRadius } from '@workday/canvas-kit-react/tokens';
|
|
27
27
|
import { Card } from '@workday/canvas-kit-react/card';
|
|
28
28
|
import { IconButton } from '@workday/canvas-kit-react/button';
|
|
29
29
|
import { xSmallIcon } from '@workday/canvas-system-icons-web';
|
|
30
|
-
import uuid from 'uuid/v4';
|
|
31
30
|
import flatten from 'lodash.flatten';
|
|
32
31
|
import AutocompleteList from './AutocompleteList';
|
|
33
32
|
import Status from './Status';
|
|
@@ -65,6 +64,7 @@ var MenuContainer = styled(Card)({
|
|
|
65
64
|
minWidth: 0,
|
|
66
65
|
animation: fadeInKeyframes + " 200ms ease-out",
|
|
67
66
|
maxHeight: 200,
|
|
67
|
+
overflow: 'hidden',
|
|
68
68
|
});
|
|
69
69
|
var ResetButton = styled(IconButton)({
|
|
70
70
|
width: space.l,
|
|
@@ -133,8 +133,8 @@ var Combobox = function (_a) {
|
|
|
133
133
|
// to satisfy TS.
|
|
134
134
|
var elementRef = useForkRef(children.ref, inputRef);
|
|
135
135
|
var comboboxRef = useRef(null);
|
|
136
|
-
var randomComponentId =
|
|
137
|
-
var randomLabelId =
|
|
136
|
+
var randomComponentId = useUniqueId();
|
|
137
|
+
var randomLabelId = useUniqueId();
|
|
138
138
|
var componentId = id || randomComponentId;
|
|
139
139
|
var formLabelId = labelId || randomLabelId;
|
|
140
140
|
var _l = 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":"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AAS,CAAC;CAC5B,CAAC;AAmCJ;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,GAAG,ynBAYd,CAAC"}
|
|
@@ -23,7 +23,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import * as React from 'react';
|
|
24
24
|
import styled from '@emotion/styled';
|
|
25
25
|
import isPropValid from '@emotion/is-prop-valid';
|
|
26
|
-
import { createComponent } from '@workday/canvas-kit-react/common';
|
|
26
|
+
import { createComponent, useConstant } from '@workday/canvas-kit-react/common';
|
|
27
27
|
// style props
|
|
28
28
|
import { border } from './utils/border';
|
|
29
29
|
import { color } from './utils/color';
|
|
@@ -36,7 +36,12 @@ var omittedProps = ['display', 'color', 'height', 'overflow', 'width', 'border',
|
|
|
36
36
|
var shouldForwardProp = function (prop) {
|
|
37
37
|
return isPropValid(prop) && !omittedProps.includes(prop);
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
// Meant to be used with elements. The `shouldForwardProps` will remove all style props
|
|
40
|
+
var StyledBoxElement = styled('div', { shouldForwardProp: shouldForwardProp })({
|
|
41
|
+
boxSizing: 'border-box',
|
|
42
|
+
}, border, color, depth, flexItem, layout, position, space);
|
|
43
|
+
// Meant to be used with components. There is no `shouldForwardProps` - all props will be forwarded to the component
|
|
44
|
+
var StyledBoxComponent = styled('div')({
|
|
40
45
|
boxSizing: 'border-box',
|
|
41
46
|
}, border, color, depth, flexItem, layout, position, space);
|
|
42
47
|
/**
|
|
@@ -60,6 +65,9 @@ export var Box = createComponent('div')({
|
|
|
60
65
|
displayName: 'Box',
|
|
61
66
|
Component: function (_a, ref, Element) {
|
|
62
67
|
var children = _a.children, elemProps = __rest(_a, ["children"]);
|
|
63
|
-
|
|
68
|
+
var BoxComponent = useConstant(function () {
|
|
69
|
+
return typeof Element === 'string' ? StyledBoxElement : StyledBoxComponent;
|
|
70
|
+
});
|
|
71
|
+
return (React.createElement(BoxComponent, __assign({ as: Element, ref: ref }, elemProps), children));
|
|
64
72
|
},
|
|
65
73
|
});
|
|
@@ -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,59 @@
|
|
|
1
|
+
import { useThemeRTL } from './useThemeRTL';
|
|
2
|
+
import { colors, inputColors, statusColors } from '@workday/canvas-kit-react/tokens';
|
|
3
|
+
import chroma from 'chroma-js';
|
|
4
|
+
var isAccessible = function (foreground, background) {
|
|
5
|
+
if (background === void 0) { background = colors.frenchVanilla100; }
|
|
6
|
+
return chroma.contrast(foreground, background) >= 3;
|
|
7
|
+
};
|
|
8
|
+
var getPaletteColorsFromTheme = function (palette, fallbackColors) {
|
|
9
|
+
return {
|
|
10
|
+
outer: isAccessible(palette.main)
|
|
11
|
+
? palette.main
|
|
12
|
+
: isAccessible(palette.darkest)
|
|
13
|
+
? palette.darkest
|
|
14
|
+
: fallbackColors === null || fallbackColors === void 0 ? void 0 : fallbackColors.outer,
|
|
15
|
+
inner: (fallbackColors === null || fallbackColors === void 0 ? void 0 : fallbackColors.inner) ? fallbackColors.inner : palette.main,
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export function getPaletteColors(type, theme) {
|
|
19
|
+
var palette = theme.canvas.palette[type];
|
|
20
|
+
switch (type) {
|
|
21
|
+
case 'error': {
|
|
22
|
+
return getPaletteColorsFromTheme(palette, { outer: inputColors.error.border });
|
|
23
|
+
}
|
|
24
|
+
case 'alert': {
|
|
25
|
+
return getPaletteColorsFromTheme(palette, { outer: colors.cantaloupe600 });
|
|
26
|
+
}
|
|
27
|
+
case 'success': {
|
|
28
|
+
return getPaletteColorsFromTheme(palette, {
|
|
29
|
+
outer: colors.greenApple600,
|
|
30
|
+
// The theme default for success.main is set to the darkest GreenApple
|
|
31
|
+
// For our default ring, we need to override it so the inner ring is a bit lighter
|
|
32
|
+
inner: palette.main === colors.greenApple600 ? statusColors.success : palette.main,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
default: {
|
|
36
|
+
return getPaletteColorsFromTheme(palette);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export var useThemedRing = function (type) {
|
|
41
|
+
var _a = useThemeRTL(), themeRTL = _a.themeRTL, theme = _a.theme;
|
|
42
|
+
var paletteColors = getPaletteColors(type, theme);
|
|
43
|
+
if (!((paletteColors === null || paletteColors === void 0 ? void 0 : paletteColors.outer) || (paletteColors === null || paletteColors === void 0 ? void 0 : paletteColors.inner))) {
|
|
44
|
+
return {};
|
|
45
|
+
}
|
|
46
|
+
var errorBoxShadow = "inset 0 0 0 " + (paletteColors.outer === paletteColors.inner ? 1 : 2) + "px " + paletteColors.inner;
|
|
47
|
+
return themeRTL({
|
|
48
|
+
borderColor: paletteColors.outer,
|
|
49
|
+
transition: '100ms box-shadow',
|
|
50
|
+
boxShadow: errorBoxShadow,
|
|
51
|
+
'&:hover, &:disabled': {
|
|
52
|
+
borderColor: paletteColors.outer,
|
|
53
|
+
},
|
|
54
|
+
'&:focus:not([disabled])': {
|
|
55
|
+
borderColor: paletteColors.outer,
|
|
56
|
+
boxShadow: errorBoxShadow + ",\n 0 0 0 2px " + colors.frenchVanilla100 + ",\n 0 0 0 4px " + (theme ? theme.canvas.palette.common.focusOutline : inputColors.focusBorder),
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
};
|
|
@@ -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"}
|
package/dist/es6/header/index.js
CHANGED
|
@@ -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';
|
|
@@ -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"}
|