@workday/canvas-kit-labs-react 7.4.2 → 7.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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;AAsLD,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"}
|
|
@@ -209,7 +209,7 @@ var SearchForm = /** @class */ (function (_super) {
|
|
|
209
209
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
210
210
|
_this.inputRef = React.createRef();
|
|
211
211
|
_this.openRef = React.createRef();
|
|
212
|
-
_this.
|
|
212
|
+
_this.defaultLabelId = common_1.generateUniqueId();
|
|
213
213
|
_this.state = {
|
|
214
214
|
showForm: false,
|
|
215
215
|
searchQuery: '',
|
|
@@ -298,13 +298,13 @@ var SearchForm = /** @class */ (function (_super) {
|
|
|
298
298
|
}
|
|
299
299
|
};
|
|
300
300
|
SearchForm.prototype.render = function () {
|
|
301
|
-
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.
|
|
302
|
-
return (React.createElement(StyledSearchForm, __assign({ role: "search", action: ".", rightAlign: rightAlign, grow: grow, "aria-labelledby":
|
|
301
|
+
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"]);
|
|
302
|
+
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),
|
|
303
303
|
React.createElement(SearchContainer, { height: height },
|
|
304
304
|
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 }),
|
|
305
305
|
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) }),
|
|
306
|
-
React.createElement(SearchField, { grow: grow, id:
|
|
307
|
-
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:
|
|
306
|
+
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 },
|
|
307
|
+
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 },
|
|
308
308
|
React.createElement(SearchInput, { ref: this.inputRef, value: this.state.searchQuery, placeholder: placeholder, isCollapsed: isCollapsed, inputColors: this.getThemeColors(), height: height, name: "search", autoComplete: "off" }))),
|
|
309
309
|
React.createElement(CloseButton, { "aria-label": closeButtonAriaLabel, icon: canvas_system_icons_web_1.xIcon, isCollapsed: isCollapsed, showForm: this.state.showForm, onClick: this.closeCollapsedSearch, type: "button" }))));
|
|
310
310
|
};
|
|
@@ -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"}
|
|
@@ -184,7 +184,7 @@ var SearchForm = /** @class */ (function (_super) {
|
|
|
184
184
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
185
185
|
_this.inputRef = React.createRef();
|
|
186
186
|
_this.openRef = React.createRef();
|
|
187
|
-
_this.
|
|
187
|
+
_this.defaultLabelId = generateUniqueId();
|
|
188
188
|
_this.state = {
|
|
189
189
|
showForm: false,
|
|
190
190
|
searchQuery: '',
|
|
@@ -273,13 +273,13 @@ var SearchForm = /** @class */ (function (_super) {
|
|
|
273
273
|
}
|
|
274
274
|
};
|
|
275
275
|
SearchForm.prototype.render = function () {
|
|
276
|
-
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.
|
|
277
|
-
return (React.createElement(StyledSearchForm, __assign({ role: "search", action: ".", rightAlign: rightAlign, grow: grow, "aria-labelledby":
|
|
276
|
+
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"]);
|
|
277
|
+
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),
|
|
278
278
|
React.createElement(SearchContainer, { height: height },
|
|
279
279
|
React.createElement(SearchIcon, { "aria-label": submitAriaLabel, icon: searchIcon, isCollapsed: isCollapsed, variant: this.getIconButtonType(), type: "submit", isHidden: !!isCollapsed && !this.state.showForm }),
|
|
280
280
|
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) }),
|
|
281
|
-
React.createElement(SearchField, { grow: grow, id:
|
|
282
|
-
React.createElement(SearchCombobox, { initialValue: initialValue, clearButtonVariant: this.getIconButtonType(), autocompleteItems: autocompleteItems, onChange: this.handleSearchInputChange, onFocus: this.handleFocus, onBlur: this.handleBlur, showClearButton: !isCollapsed && showClearButton, clearButtonAriaLabel: clearButtonAriaLabel, labelId:
|
|
281
|
+
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 },
|
|
282
|
+
React.createElement(SearchCombobox, { initialValue: initialValue, clearButtonVariant: this.getIconButtonType(), autocompleteItems: autocompleteItems, onChange: this.handleSearchInputChange, onFocus: this.handleFocus, onBlur: this.handleBlur, showClearButton: !isCollapsed && showClearButton, clearButtonAriaLabel: clearButtonAriaLabel, labelId: labelId },
|
|
283
283
|
React.createElement(SearchInput, { ref: this.inputRef, value: this.state.searchQuery, placeholder: placeholder, isCollapsed: isCollapsed, inputColors: this.getThemeColors(), height: height, name: "search", autoComplete: "off" }))),
|
|
284
284
|
React.createElement(CloseButton, { "aria-label": closeButtonAriaLabel, icon: xIcon, isCollapsed: isCollapsed, showForm: this.state.showForm, onClick: this.closeCollapsedSearch, type: "button" }))));
|
|
285
285
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-labs-react",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.4",
|
|
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": "^7.4.
|
|
49
|
+
"@workday/canvas-kit-react": "^7.4.4",
|
|
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": "3d58ef340945d8cf1c289f0b72e1f40de87d544e"
|
|
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 {
|
|
@@ -279,7 +284,7 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
279
284
|
|
|
280
285
|
private inputRef = React.createRef<HTMLInputElement>();
|
|
281
286
|
private openRef = React.createRef<HTMLButtonElement>();
|
|
282
|
-
private
|
|
287
|
+
private defaultLabelId = generateUniqueId();
|
|
283
288
|
|
|
284
289
|
state: Readonly<SearchFormState> = {
|
|
285
290
|
showForm: false,
|
|
@@ -384,6 +389,7 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
384
389
|
submitAriaLabel = 'Search',
|
|
385
390
|
openButtonAriaLabel = 'Open Search',
|
|
386
391
|
closeButtonAriaLabel = 'Cancel',
|
|
392
|
+
labelId = this.defaultLabelId,
|
|
387
393
|
showClearButton = true,
|
|
388
394
|
height = 40,
|
|
389
395
|
grow,
|
|
@@ -404,7 +410,7 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
404
410
|
action="."
|
|
405
411
|
rightAlign={rightAlign}
|
|
406
412
|
grow={grow}
|
|
407
|
-
aria-labelledby={
|
|
413
|
+
aria-labelledby={labelId}
|
|
408
414
|
isCollapsed={isCollapsed}
|
|
409
415
|
onSubmit={this.handleSubmit}
|
|
410
416
|
showForm={this.state.showForm}
|
|
@@ -431,8 +437,8 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
431
437
|
/>
|
|
432
438
|
<SearchField
|
|
433
439
|
grow={grow}
|
|
434
|
-
id={
|
|
435
|
-
inputId={`input-${
|
|
440
|
+
id={labelId}
|
|
441
|
+
inputId={`input-${labelId}`}
|
|
436
442
|
label={inputLabel}
|
|
437
443
|
labelPosition={FormFieldLabelPosition.Hidden}
|
|
438
444
|
useFieldset={false}
|
|
@@ -449,7 +455,7 @@ export class SearchForm extends React.Component<SearchFormProps, SearchFormState
|
|
|
449
455
|
onBlur={this.handleBlur}
|
|
450
456
|
showClearButton={!isCollapsed && showClearButton}
|
|
451
457
|
clearButtonAriaLabel={clearButtonAriaLabel}
|
|
452
|
-
labelId={
|
|
458
|
+
labelId={labelId}
|
|
453
459
|
>
|
|
454
460
|
<SearchInput
|
|
455
461
|
ref={this.inputRef}
|