@workday/canvas-kit-labs-react 8.0.8 → 8.1.0
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/dist/commonjs/search-form/lib/SearchForm.d.ts +6 -1
- package/dist/commonjs/search-form/lib/SearchForm.d.ts.map +1 -1
- package/dist/commonjs/search-form/lib/SearchForm.js +5 -5
- package/dist/es6/search-form/lib/SearchForm.d.ts +6 -1
- package/dist/es6/search-form/lib/SearchForm.d.ts.map +1 -1
- package/dist/es6/search-form/lib/SearchForm.js +5 -5
- package/package.json +3 -3
- package/search-form/lib/SearchForm.tsx +11 -5
|
@@ -78,6 +78,11 @@ export interface SearchFormProps extends GrowthBehavior, React.FormHTMLAttribute
|
|
|
78
78
|
* @default false
|
|
79
79
|
*/
|
|
80
80
|
allowEmptyStringSearch?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Sets the `id` for the label
|
|
83
|
+
* @default unique identifier
|
|
84
|
+
*/
|
|
85
|
+
labelId?: string;
|
|
81
86
|
}
|
|
82
87
|
export interface SearchFormState {
|
|
83
88
|
showForm: boolean;
|
|
@@ -88,7 +93,7 @@ export declare class SearchForm extends React.Component<SearchFormProps, SearchF
|
|
|
88
93
|
static Theme: typeof SearchTheme;
|
|
89
94
|
private inputRef;
|
|
90
95
|
private openRef;
|
|
91
|
-
private
|
|
96
|
+
private defaultLabelId;
|
|
92
97
|
state: Readonly<SearchFormState>;
|
|
93
98
|
private getTheme;
|
|
94
99
|
private getThemeColors;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchForm.d.ts","sourceRoot":"","sources":["../../../../search-form/lib/SearchForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAC,cAAc,EAA2B,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAAiB,mBAAmB,EAAC,MAAM,kCAAkC,CAAC;AAKrF,OAAO,EAAe,WAAW,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AAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACpB;AAmLD,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,cAAc,CAAsB;IAE5C,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC,CAI9B;IAEF,OAAO,CAAC,QAAQ,CAUd;IAEF,OAAO,CAAC,cAAc,CAMpB;IAEF,iBAAiB,QAAO,mBAAmB,CAAC,SAAS,CAAC,CAOpD;IAEF,YAAY,UAAW,MAAM,SAAS,CAAC,eAAe,CAAC,KAAG,IAAI,CAO5D;IAEF,mBAAmB,QAAO,IAAI,CAI5B;IAEF,oBAAoB,QAAO,IAAI,CAI7B;IAEF,kBAAkB,CAAC,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe;IAWzE,UAAU,QAAO,IAAI,CAInB;IAEF,SAAS,QAAO,IAAI,CAIlB;IAEF,WAAW,QAAO,IAAI,CAEpB;IAEF,UAAU,QAAO,IAAI,CAEnB;IAEF,uBAAuB,UAAW,MAAM,WAAW,CAAC,gBAAgB,CAAC,KAAG,IAAI,CAM1E;IAEF,MAAM;CAoGP"}
|
|
@@ -207,7 +207,7 @@ var SearchForm = /** @class */ (function (_super) {
|
|
|
207
207
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
208
208
|
_this.inputRef = React.createRef();
|
|
209
209
|
_this.openRef = React.createRef();
|
|
210
|
-
_this.
|
|
210
|
+
_this.defaultLabelId = common_1.generateUniqueId();
|
|
211
211
|
_this.state = {
|
|
212
212
|
showForm: false,
|
|
213
213
|
searchQuery: '',
|
|
@@ -296,13 +296,13 @@ var SearchForm = /** @class */ (function (_super) {
|
|
|
296
296
|
}
|
|
297
297
|
};
|
|
298
298
|
SearchForm.prototype.render = function () {
|
|
299
|
-
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.
|
|
300
|
-
return (React.createElement(StyledSearchForm, __assign({ role: "search", action: ".", rightAlign: rightAlign, grow: grow, "aria-labelledby":
|
|
299
|
+
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.labelId, labelId = _h === void 0 ? this.defaultLabelId : _h, _j = _a.showClearButton, showClearButton = _j === void 0 ? true : _j, _k = _a.height, height = _k === void 0 ? 40 : _k, grow = _a.grow, onSubmit = _a.onSubmit, isCollapsed = _a.isCollapsed, onInputChange = _a.onInputChange, autocompleteItems = _a.autocompleteItems, initialValue = _a.initialValue, searchTheme = _a.searchTheme, rightAlign = _a.rightAlign, _l = _a.allowEmptyStringSearch, allowEmptyStringSearch = _l === void 0 ? false : _l, elemProps = __rest(_a, ["clearButtonAriaLabel", "placeholder", "inputLabel", "submitAriaLabel", "openButtonAriaLabel", "closeButtonAriaLabel", "labelId", "showClearButton", "height", "grow", "onSubmit", "isCollapsed", "onInputChange", "autocompleteItems", "initialValue", "searchTheme", "rightAlign", "allowEmptyStringSearch"]);
|
|
300
|
+
return (React.createElement(StyledSearchForm, __assign({ role: "search", action: ".", rightAlign: rightAlign, grow: grow, "aria-labelledby": labelId, isCollapsed: isCollapsed, onSubmit: this.handleSubmit, showForm: this.state.showForm }, elemProps),
|
|
301
301
|
React.createElement(SearchContainer, { height: height },
|
|
302
302
|
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 }),
|
|
303
303
|
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) }),
|
|
304
|
-
React.createElement(SearchField, { grow: grow, id:
|
|
305
|
-
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:
|
|
304
|
+
React.createElement(SearchField, { grow: grow, id: labelId, inputId: "input-" + labelId, label: inputLabel, labelPosition: form_field_1.FormFieldLabelPosition.Hidden, useFieldset: false, isCollapsed: isCollapsed, showForm: this.state.showForm, height: height },
|
|
305
|
+
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: labelId },
|
|
306
306
|
React.createElement(SearchInput, { ref: this.inputRef, value: this.state.searchQuery, placeholder: placeholder, isCollapsed: isCollapsed, inputColors: this.getThemeColors(), height: height, name: "search", autoComplete: "off" }))),
|
|
307
307
|
React.createElement(CloseButton, { "aria-label": closeButtonAriaLabel, icon: canvas_system_icons_web_1.xIcon, isCollapsed: isCollapsed, showForm: this.state.showForm, onClick: this.closeCollapsedSearch, type: "button" }))));
|
|
308
308
|
};
|
|
@@ -78,6 +78,11 @@ export interface SearchFormProps extends GrowthBehavior, React.FormHTMLAttribute
|
|
|
78
78
|
* @default false
|
|
79
79
|
*/
|
|
80
80
|
allowEmptyStringSearch?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Sets the `id` for the label
|
|
83
|
+
* @default unique identifier
|
|
84
|
+
*/
|
|
85
|
+
labelId?: string;
|
|
81
86
|
}
|
|
82
87
|
export interface SearchFormState {
|
|
83
88
|
showForm: boolean;
|
|
@@ -88,7 +93,7 @@ export declare class SearchForm extends React.Component<SearchFormProps, SearchF
|
|
|
88
93
|
static Theme: typeof SearchTheme;
|
|
89
94
|
private inputRef;
|
|
90
95
|
private openRef;
|
|
91
|
-
private
|
|
96
|
+
private defaultLabelId;
|
|
92
97
|
state: Readonly<SearchFormState>;
|
|
93
98
|
private getTheme;
|
|
94
99
|
private getThemeColors;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchForm.d.ts","sourceRoot":"","sources":["../../../../search-form/lib/SearchForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAC,cAAc,EAA2B,MAAM,kCAAkC,CAAC;AAC1F,OAAO,EAAiB,mBAAmB,EAAC,MAAM,kCAAkC,CAAC;AAKrF,OAAO,EAAe,WAAW,EAAE,qBAAqB,EAAC,MAAM,UAAU,CAAC;AAG1E,MAAM,WAAW,eAAgB,SAAQ,cAAc,EAAE,KAAK,CAAC,kBAAkB,CAAC,eAAe,CAAC;IAChG;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAClD;;;OAGG;IACH,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,OAAO,CAAwC;IACvD,OAAO,CAAC,cAAc,CAAsB;IAE5C,KAAK,EAAE,QAAQ,CAAC,eAAe,CAAC,CAI9B;IAEF,OAAO,CAAC,QAAQ,CAUd;IAEF,OAAO,CAAC,cAAc,CAMpB;IAEF,iBAAiB,QAAO,mBAAmB,CAAC,SAAS,CAAC,CAOpD;IAEF,YAAY,UAAW,MAAM,SAAS,CAAC,eAAe,CAAC,KAAG,IAAI,CAO5D;IAEF,mBAAmB,QAAO,IAAI,CAI5B;IAEF,oBAAoB,QAAO,IAAI,CAI7B;IAEF,kBAAkB,CAAC,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe;IAWzE,UAAU,QAAO,IAAI,CAInB;IAEF,SAAS,QAAO,IAAI,CAIlB;IAEF,WAAW,QAAO,IAAI,CAEpB;IAEF,UAAU,QAAO,IAAI,CAEnB;IAEF,uBAAuB,UAAW,MAAM,WAAW,CAAC,gBAAgB,CAAC,KAAG,IAAI,CAM1E;IAEF,MAAM;CAoGP"}
|
|
@@ -182,7 +182,7 @@ var SearchForm = /** @class */ (function (_super) {
|
|
|
182
182
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
183
183
|
_this.inputRef = React.createRef();
|
|
184
184
|
_this.openRef = React.createRef();
|
|
185
|
-
_this.
|
|
185
|
+
_this.defaultLabelId = generateUniqueId();
|
|
186
186
|
_this.state = {
|
|
187
187
|
showForm: false,
|
|
188
188
|
searchQuery: '',
|
|
@@ -271,13 +271,13 @@ var SearchForm = /** @class */ (function (_super) {
|
|
|
271
271
|
}
|
|
272
272
|
};
|
|
273
273
|
SearchForm.prototype.render = function () {
|
|
274
|
-
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.
|
|
275
|
-
return (React.createElement(StyledSearchForm, __assign({ role: "search", action: ".", rightAlign: rightAlign, grow: grow, "aria-labelledby":
|
|
274
|
+
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.labelId, labelId = _h === void 0 ? this.defaultLabelId : _h, _j = _a.showClearButton, showClearButton = _j === void 0 ? true : _j, _k = _a.height, height = _k === void 0 ? 40 : _k, grow = _a.grow, onSubmit = _a.onSubmit, isCollapsed = _a.isCollapsed, onInputChange = _a.onInputChange, autocompleteItems = _a.autocompleteItems, initialValue = _a.initialValue, searchTheme = _a.searchTheme, rightAlign = _a.rightAlign, _l = _a.allowEmptyStringSearch, allowEmptyStringSearch = _l === void 0 ? false : _l, elemProps = __rest(_a, ["clearButtonAriaLabel", "placeholder", "inputLabel", "submitAriaLabel", "openButtonAriaLabel", "closeButtonAriaLabel", "labelId", "showClearButton", "height", "grow", "onSubmit", "isCollapsed", "onInputChange", "autocompleteItems", "initialValue", "searchTheme", "rightAlign", "allowEmptyStringSearch"]);
|
|
275
|
+
return (React.createElement(StyledSearchForm, __assign({ role: "search", action: ".", rightAlign: rightAlign, grow: grow, "aria-labelledby": labelId, isCollapsed: isCollapsed, onSubmit: this.handleSubmit, showForm: this.state.showForm }, elemProps),
|
|
276
276
|
React.createElement(SearchContainer, { height: height },
|
|
277
277
|
React.createElement(SearchIcon, { "aria-label": submitAriaLabel, icon: searchIcon, isCollapsed: isCollapsed, variant: this.getIconButtonType(), type: "submit", isHidden: !!isCollapsed && !this.state.showForm }),
|
|
278
278
|
React.createElement(SearchIcon, { "aria-label": openButtonAriaLabel, icon: searchIcon, isCollapsed: isCollapsed, variant: this.getIconButtonType(), onClick: this.openCollapsedSearch, ref: this.openRef, type: "button", isHidden: !isCollapsed || (!!isCollapsed && this.state.showForm) }),
|
|
279
|
-
React.createElement(SearchField, { grow: grow, id:
|
|
280
|
-
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:
|
|
279
|
+
React.createElement(SearchField, { grow: grow, id: labelId, inputId: "input-" + labelId, label: inputLabel, labelPosition: FormFieldLabelPosition.Hidden, useFieldset: false, isCollapsed: isCollapsed, showForm: this.state.showForm, height: height },
|
|
280
|
+
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: labelId },
|
|
281
281
|
React.createElement(SearchInput, { ref: this.inputRef, value: this.state.searchQuery, placeholder: placeholder, isCollapsed: isCollapsed, inputColors: this.getThemeColors(), height: height, name: "search", autoComplete: "off" }))),
|
|
282
282
|
React.createElement(CloseButton, { "aria-label": closeButtonAriaLabel, icon: xIcon, isCollapsed: isCollapsed, showForm: this.state.showForm, onClick: this.closeCollapsedSearch, type: "button" }))));
|
|
283
283
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-labs-react",
|
|
3
|
-
"version": "8.0
|
|
3
|
+
"version": "8.1.0",
|
|
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",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@emotion/react": "^11.7.1",
|
|
48
48
|
"@emotion/styled": "^11.6.0",
|
|
49
|
-
"@workday/canvas-kit-react": "^8.0
|
|
49
|
+
"@workday/canvas-kit-react": "^8.1.0",
|
|
50
50
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
51
51
|
"@workday/design-assets-types": "^0.2.8",
|
|
52
52
|
"chroma-js": "^2.1.0",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/lodash.flatten": "^4.4.6"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "8b1986e0351a52c52200f7ad8cb55161ed09a102"
|
|
60
60
|
}
|
|
@@ -86,6 +86,11 @@ export interface SearchFormProps extends GrowthBehavior, React.FormHTMLAttribute
|
|
|
86
86
|
* @default false
|
|
87
87
|
*/
|
|
88
88
|
allowEmptyStringSearch?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Sets the `id` for the label
|
|
91
|
+
* @default unique identifier
|
|
92
|
+
*/
|
|
93
|
+
labelId?: string;
|
|
89
94
|
}
|
|
90
95
|
|
|
91
96
|
export interface SearchFormState {
|
|
@@ -276,7 +281,7 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
276
281
|
|
|
277
282
|
private inputRef = React.createRef<HTMLInputElement>();
|
|
278
283
|
private openRef = React.createRef<HTMLButtonElement>();
|
|
279
|
-
private
|
|
284
|
+
private defaultLabelId = generateUniqueId();
|
|
280
285
|
|
|
281
286
|
state: Readonly<SearchFormState> = {
|
|
282
287
|
showForm: false,
|
|
@@ -381,6 +386,7 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
381
386
|
submitAriaLabel = 'Search',
|
|
382
387
|
openButtonAriaLabel = 'Open Search',
|
|
383
388
|
closeButtonAriaLabel = 'Cancel',
|
|
389
|
+
labelId = this.defaultLabelId,
|
|
384
390
|
showClearButton = true,
|
|
385
391
|
height = 40,
|
|
386
392
|
grow,
|
|
@@ -401,7 +407,7 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
401
407
|
action="."
|
|
402
408
|
rightAlign={rightAlign}
|
|
403
409
|
grow={grow}
|
|
404
|
-
aria-labelledby={
|
|
410
|
+
aria-labelledby={labelId}
|
|
405
411
|
isCollapsed={isCollapsed}
|
|
406
412
|
onSubmit={this.handleSubmit}
|
|
407
413
|
showForm={this.state.showForm}
|
|
@@ -428,8 +434,8 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
428
434
|
/>
|
|
429
435
|
<SearchField
|
|
430
436
|
grow={grow}
|
|
431
|
-
id={
|
|
432
|
-
inputId={`input-${
|
|
437
|
+
id={labelId}
|
|
438
|
+
inputId={`input-${labelId}`}
|
|
433
439
|
label={inputLabel}
|
|
434
440
|
labelPosition={FormFieldLabelPosition.Hidden}
|
|
435
441
|
useFieldset={false}
|
|
@@ -446,7 +452,7 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
446
452
|
onBlur={this.handleBlur}
|
|
447
453
|
showClearButton={!isCollapsed && showClearButton}
|
|
448
454
|
clearButtonAriaLabel={clearButtonAriaLabel}
|
|
449
|
-
labelId={
|
|
455
|
+
labelId={labelId}
|
|
450
456
|
>
|
|
451
457
|
<SearchInput
|
|
452
458
|
ref={this.inputRef}
|