@workday/canvas-kit-labs-react 7.1.4 → 7.2.0-427-next.2

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.
Files changed (207) hide show
  1. package/combobox/README.md +4 -4
  2. package/combobox/index.ts +0 -4
  3. package/combobox/lib/AutocompleteList.tsx +5 -8
  4. package/combobox/lib/Combobox.tsx +14 -20
  5. package/combobox/lib/Status.tsx +1 -3
  6. package/combobox/package.json +2 -1
  7. package/common/index.ts +0 -2
  8. package/common/lib/theming/index.ts +0 -1
  9. package/common/lib/theming/useThemeRTL.ts +14 -13
  10. package/common/package.json +2 -1
  11. package/dist/commonjs/combobox/index.d.ts +0 -3
  12. package/dist/commonjs/combobox/index.d.ts.map +1 -1
  13. package/dist/commonjs/combobox/index.js +0 -7
  14. package/dist/commonjs/combobox/lib/AutocompleteList.d.ts +4 -5
  15. package/dist/commonjs/combobox/lib/AutocompleteList.d.ts.map +1 -1
  16. package/dist/commonjs/combobox/lib/AutocompleteList.js +33 -53
  17. package/dist/commonjs/combobox/lib/Combobox.d.ts +4 -6
  18. package/dist/commonjs/combobox/lib/Combobox.d.ts.map +1 -1
  19. package/dist/commonjs/combobox/lib/Combobox.js +110 -142
  20. package/dist/commonjs/combobox/lib/Status.d.ts +1 -2
  21. package/dist/commonjs/combobox/lib/Status.d.ts.map +1 -1
  22. package/dist/commonjs/combobox/lib/Status.js +11 -11
  23. package/dist/commonjs/common/index.d.ts +0 -2
  24. package/dist/commonjs/common/index.d.ts.map +1 -1
  25. package/dist/commonjs/common/index.js +0 -5
  26. package/dist/commonjs/common/lib/theming/index.d.ts +0 -1
  27. package/dist/commonjs/common/lib/theming/index.d.ts.map +1 -1
  28. package/dist/commonjs/common/lib/theming/index.js +0 -1
  29. package/dist/commonjs/common/lib/theming/useThemeRTL.d.ts +3 -0
  30. package/dist/commonjs/common/lib/theming/useThemeRTL.d.ts.map +1 -1
  31. package/dist/commonjs/common/lib/theming/useThemeRTL.js +21 -46
  32. package/dist/commonjs/expandable/index.d.ts +3 -0
  33. package/dist/commonjs/expandable/index.d.ts.map +1 -0
  34. package/dist/commonjs/{drawer → expandable}/index.js +2 -10
  35. package/dist/commonjs/expandable/lib/Expandable.d.ts +108 -0
  36. package/dist/commonjs/expandable/lib/Expandable.d.ts.map +1 -0
  37. package/dist/commonjs/expandable/lib/Expandable.js +59 -0
  38. package/dist/commonjs/expandable/lib/ExpandableAvatar.d.ts +7 -0
  39. package/dist/commonjs/expandable/lib/ExpandableAvatar.d.ts.map +1 -0
  40. package/dist/commonjs/expandable/lib/ExpandableAvatar.js +23 -0
  41. package/dist/commonjs/expandable/lib/ExpandableContent.d.ts +21 -0
  42. package/dist/commonjs/expandable/lib/ExpandableContent.d.ts.map +1 -0
  43. package/dist/commonjs/expandable/lib/ExpandableContent.js +18 -0
  44. package/dist/commonjs/expandable/lib/ExpandableIcon.d.ts +29 -0
  45. package/dist/commonjs/expandable/lib/ExpandableIcon.d.ts.map +1 -0
  46. package/dist/commonjs/expandable/lib/ExpandableIcon.js +31 -0
  47. package/dist/commonjs/expandable/lib/ExpandableTarget.d.ts +33 -0
  48. package/dist/commonjs/expandable/lib/ExpandableTarget.d.ts.map +1 -0
  49. package/dist/commonjs/expandable/lib/ExpandableTarget.js +32 -0
  50. package/dist/commonjs/expandable/lib/ExpandableTitle.d.ts +11 -0
  51. package/dist/commonjs/expandable/lib/ExpandableTitle.d.ts.map +1 -0
  52. package/dist/commonjs/expandable/lib/ExpandableTitle.js +16 -0
  53. package/dist/commonjs/expandable/lib/hooks/index.d.ts +5 -0
  54. package/dist/commonjs/expandable/lib/hooks/index.d.ts.map +1 -0
  55. package/dist/commonjs/expandable/lib/hooks/index.js +16 -0
  56. package/dist/commonjs/expandable/lib/hooks/useExpandableContent.d.ts +18 -0
  57. package/dist/commonjs/expandable/lib/hooks/useExpandableContent.d.ts.map +1 -0
  58. package/dist/commonjs/expandable/lib/hooks/useExpandableContent.js +11 -0
  59. package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.d.ts +13 -0
  60. package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.d.ts.map +1 -0
  61. package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.js +10 -0
  62. package/dist/commonjs/expandable/lib/hooks/useExpandableModel.d.ts +53 -0
  63. package/dist/commonjs/expandable/lib/hooks/useExpandableModel.d.ts.map +1 -0
  64. package/dist/commonjs/expandable/lib/hooks/useExpandableModel.js +22 -0
  65. package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.d.ts +15 -0
  66. package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.d.ts.map +1 -0
  67. package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.js +19 -0
  68. package/dist/commonjs/index.d.ts +1 -2
  69. package/dist/commonjs/index.d.ts.map +1 -1
  70. package/dist/commonjs/index.js +1 -2
  71. package/dist/commonjs/search-form/lib/SearchForm.d.ts +7 -3
  72. package/dist/commonjs/search-form/lib/SearchForm.d.ts.map +1 -1
  73. package/dist/commonjs/search-form/lib/SearchForm.js +118 -145
  74. package/dist/commonjs/search-form/lib/themes.js +7 -8
  75. package/dist/es6/combobox/index.d.ts +0 -3
  76. package/dist/es6/combobox/index.d.ts.map +1 -1
  77. package/dist/es6/combobox/index.js +0 -3
  78. package/dist/es6/combobox/lib/AutocompleteList.d.ts +4 -5
  79. package/dist/es6/combobox/lib/AutocompleteList.d.ts.map +1 -1
  80. package/dist/es6/combobox/lib/AutocompleteList.js +26 -48
  81. package/dist/es6/combobox/lib/Combobox.d.ts +4 -6
  82. package/dist/es6/combobox/lib/Combobox.d.ts.map +1 -1
  83. package/dist/es6/combobox/lib/Combobox.js +98 -131
  84. package/dist/es6/combobox/lib/Status.d.ts +1 -2
  85. package/dist/es6/combobox/lib/Status.d.ts.map +1 -1
  86. package/dist/es6/combobox/lib/Status.js +6 -8
  87. package/dist/es6/common/index.d.ts +0 -2
  88. package/dist/es6/common/index.d.ts.map +1 -1
  89. package/dist/es6/common/index.js +0 -2
  90. package/dist/es6/common/lib/theming/index.d.ts +0 -1
  91. package/dist/es6/common/lib/theming/index.d.ts.map +1 -1
  92. package/dist/es6/common/lib/theming/index.js +0 -1
  93. package/dist/es6/common/lib/theming/useThemeRTL.d.ts +3 -0
  94. package/dist/es6/common/lib/theming/useThemeRTL.d.ts.map +1 -1
  95. package/dist/es6/common/lib/theming/useThemeRTL.js +19 -44
  96. package/dist/es6/expandable/index.d.ts +3 -0
  97. package/dist/es6/expandable/index.d.ts.map +1 -0
  98. package/dist/es6/expandable/index.js +2 -0
  99. package/dist/es6/expandable/lib/Expandable.d.ts +108 -0
  100. package/dist/es6/expandable/lib/Expandable.d.ts.map +1 -0
  101. package/dist/es6/expandable/lib/Expandable.js +53 -0
  102. package/dist/es6/expandable/lib/ExpandableAvatar.d.ts +7 -0
  103. package/dist/es6/expandable/lib/ExpandableAvatar.d.ts.map +1 -0
  104. package/dist/es6/expandable/lib/ExpandableAvatar.js +17 -0
  105. package/dist/es6/expandable/lib/ExpandableContent.d.ts +21 -0
  106. package/dist/es6/expandable/lib/ExpandableContent.d.ts.map +1 -0
  107. package/dist/es6/expandable/lib/ExpandableContent.js +12 -0
  108. package/dist/es6/expandable/lib/ExpandableIcon.d.ts +29 -0
  109. package/dist/es6/expandable/lib/ExpandableIcon.d.ts.map +1 -0
  110. package/dist/es6/expandable/lib/ExpandableIcon.js +25 -0
  111. package/dist/es6/expandable/lib/ExpandableTarget.d.ts +33 -0
  112. package/dist/es6/expandable/lib/ExpandableTarget.d.ts.map +1 -0
  113. package/dist/es6/expandable/lib/ExpandableTarget.js +26 -0
  114. package/dist/es6/expandable/lib/ExpandableTitle.d.ts +11 -0
  115. package/dist/es6/expandable/lib/ExpandableTitle.d.ts.map +1 -0
  116. package/dist/es6/expandable/lib/ExpandableTitle.js +10 -0
  117. package/dist/es6/expandable/lib/hooks/index.d.ts +5 -0
  118. package/dist/es6/expandable/lib/hooks/index.d.ts.map +1 -0
  119. package/dist/es6/expandable/lib/hooks/index.js +4 -0
  120. package/dist/es6/expandable/lib/hooks/useExpandableContent.d.ts +18 -0
  121. package/dist/es6/expandable/lib/hooks/useExpandableContent.d.ts.map +1 -0
  122. package/dist/es6/expandable/lib/hooks/useExpandableContent.js +8 -0
  123. package/dist/es6/expandable/lib/hooks/useExpandableIcon.d.ts +13 -0
  124. package/dist/es6/expandable/lib/hooks/useExpandableIcon.d.ts.map +1 -0
  125. package/dist/es6/expandable/lib/hooks/useExpandableIcon.js +7 -0
  126. package/dist/es6/expandable/lib/hooks/useExpandableModel.d.ts +53 -0
  127. package/dist/es6/expandable/lib/hooks/useExpandableModel.d.ts.map +1 -0
  128. package/dist/es6/expandable/lib/hooks/useExpandableModel.js +19 -0
  129. package/dist/es6/expandable/lib/hooks/useExpandableTarget.d.ts +15 -0
  130. package/dist/es6/expandable/lib/hooks/useExpandableTarget.d.ts.map +1 -0
  131. package/dist/es6/expandable/lib/hooks/useExpandableTarget.js +16 -0
  132. package/dist/es6/index.d.ts +1 -2
  133. package/dist/es6/index.d.ts.map +1 -1
  134. package/dist/es6/index.js +1 -2
  135. package/dist/es6/search-form/lib/SearchForm.d.ts +7 -3
  136. package/dist/es6/search-form/lib/SearchForm.d.ts.map +1 -1
  137. package/dist/es6/search-form/lib/SearchForm.js +108 -136
  138. package/dist/es6/search-form/lib/themes.js +5 -6
  139. package/{drawer → expandable}/LICENSE +2 -1
  140. package/expandable/README.md +11 -0
  141. package/expandable/index.ts +2 -0
  142. package/expandable/lib/Expandable.tsx +68 -0
  143. package/expandable/lib/ExpandableAvatar.tsx +26 -0
  144. package/expandable/lib/ExpandableContent.tsx +32 -0
  145. package/expandable/lib/ExpandableIcon.tsx +75 -0
  146. package/expandable/lib/ExpandableTarget.tsx +67 -0
  147. package/expandable/lib/ExpandableTitle.tsx +32 -0
  148. package/expandable/lib/hooks/index.ts +4 -0
  149. package/expandable/lib/hooks/useExpandableContent.ts +9 -0
  150. package/expandable/lib/hooks/useExpandableIcon.ts +8 -0
  151. package/expandable/lib/hooks/useExpandableModel.tsx +20 -0
  152. package/expandable/lib/hooks/useExpandableTarget.ts +16 -0
  153. package/expandable/package.json +6 -0
  154. package/index.ts +1 -2
  155. package/package.json +5 -5
  156. package/search-form/lib/SearchForm.tsx +13 -11
  157. package/search-form/package.json +2 -1
  158. package/common/lib/storybook-utils/ComponentStatesTable.tsx +0 -80
  159. package/common/lib/storybook-utils/permutateProps.ts +0 -47
  160. package/common/lib/storybook-utils/propTypes.ts +0 -15
  161. package/common/lib/theming/useThemedRing.ts +0 -82
  162. package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.d.ts +0 -26
  163. package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.d.ts.map +0 -1
  164. package/dist/commonjs/common/lib/storybook-utils/ComponentStatesTable.js +0 -48
  165. package/dist/commonjs/common/lib/storybook-utils/permutateProps.d.ts +0 -5
  166. package/dist/commonjs/common/lib/storybook-utils/permutateProps.d.ts.map +0 -1
  167. package/dist/commonjs/common/lib/storybook-utils/permutateProps.js +0 -47
  168. package/dist/commonjs/common/lib/storybook-utils/propTypes.d.ts +0 -15
  169. package/dist/commonjs/common/lib/storybook-utils/propTypes.d.ts.map +0 -1
  170. package/dist/commonjs/common/lib/storybook-utils/propTypes.js +0 -2
  171. package/dist/commonjs/common/lib/theming/useThemedRing.d.ts +0 -11
  172. package/dist/commonjs/common/lib/theming/useThemedRing.d.ts.map +0 -1
  173. package/dist/commonjs/common/lib/theming/useThemedRing.js +0 -67
  174. package/dist/commonjs/drawer/index.d.ts +0 -6
  175. package/dist/commonjs/drawer/index.d.ts.map +0 -1
  176. package/dist/commonjs/drawer/lib/Drawer.d.ts +0 -49
  177. package/dist/commonjs/drawer/lib/Drawer.d.ts.map +0 -1
  178. package/dist/commonjs/drawer/lib/Drawer.js +0 -124
  179. package/dist/commonjs/drawer/lib/DrawerHeader.d.ts +0 -38
  180. package/dist/commonjs/drawer/lib/DrawerHeader.d.ts.map +0 -1
  181. package/dist/commonjs/drawer/lib/DrawerHeader.js +0 -105
  182. package/dist/es6/common/lib/storybook-utils/ComponentStatesTable.d.ts +0 -26
  183. package/dist/es6/common/lib/storybook-utils/ComponentStatesTable.d.ts.map +0 -1
  184. package/dist/es6/common/lib/storybook-utils/ComponentStatesTable.js +0 -41
  185. package/dist/es6/common/lib/storybook-utils/permutateProps.d.ts +0 -5
  186. package/dist/es6/common/lib/storybook-utils/permutateProps.d.ts.map +0 -1
  187. package/dist/es6/common/lib/storybook-utils/permutateProps.js +0 -43
  188. package/dist/es6/common/lib/storybook-utils/propTypes.d.ts +0 -15
  189. package/dist/es6/common/lib/storybook-utils/propTypes.d.ts.map +0 -1
  190. package/dist/es6/common/lib/storybook-utils/propTypes.js +0 -1
  191. package/dist/es6/common/lib/theming/useThemedRing.d.ts +0 -11
  192. package/dist/es6/common/lib/theming/useThemedRing.d.ts.map +0 -1
  193. package/dist/es6/common/lib/theming/useThemedRing.js +0 -59
  194. package/dist/es6/drawer/index.d.ts +0 -6
  195. package/dist/es6/drawer/index.d.ts.map +0 -1
  196. package/dist/es6/drawer/index.js +0 -5
  197. package/dist/es6/drawer/lib/Drawer.d.ts +0 -49
  198. package/dist/es6/drawer/lib/Drawer.d.ts.map +0 -1
  199. package/dist/es6/drawer/lib/Drawer.js +0 -99
  200. package/dist/es6/drawer/lib/DrawerHeader.d.ts +0 -38
  201. package/dist/es6/drawer/lib/DrawerHeader.d.ts.map +0 -1
  202. package/dist/es6/drawer/lib/DrawerHeader.js +0 -81
  203. package/drawer/README.md +0 -35
  204. package/drawer/index.ts +0 -5
  205. package/drawer/lib/Drawer.tsx +0 -119
  206. package/drawer/lib/DrawerHeader.tsx +0 -105
  207. package/drawer/package.json +0 -5
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useExpandableIcon = void 0;
4
+ const common_1 = require("@workday/canvas-kit-react/common");
5
+ const useExpandableModel_1 = require("./useExpandableModel");
6
+ exports.useExpandableIcon = common_1.createElemPropsHook(useExpandableModel_1.useExpandableModel)(({ state }) => {
7
+ return {
8
+ visible: state.visibility !== 'hidden',
9
+ };
10
+ });
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The `ExpandableModel` extends the `DisclosureModel`
3
+ */
4
+ export declare const useExpandableModel: (<TT_Special_Generic>(config?: (Partial<{
5
+ id: string;
6
+ initialVisibility: import("@workday/canvas-kit-react/disclosure").Visibility;
7
+ }> & {
8
+ onShow?: ((data: Event | import("react").SyntheticEvent<Element, Event> | undefined, prevState: {
9
+ id: string;
10
+ visibility: "hidden" | "visible";
11
+ }) => void) | undefined;
12
+ onHide?: ((data: Event | import("react").SyntheticEvent<Element, Event> | undefined, prevState: {
13
+ id: string;
14
+ visibility: "hidden" | "visible";
15
+ }) => void) | undefined;
16
+ } & {
17
+ shouldShow?: ((data: Event | import("react").SyntheticEvent<Element, Event> | undefined, state: {
18
+ id: string;
19
+ visibility: "hidden" | "visible";
20
+ }) => boolean) | undefined;
21
+ shouldHide?: ((data: Event | import("react").SyntheticEvent<Element, Event> | undefined, state: {
22
+ id: string;
23
+ visibility: "hidden" | "visible";
24
+ }) => boolean) | undefined;
25
+ }) | undefined) => {
26
+ state: {
27
+ id: string;
28
+ visibility: "hidden" | "visible";
29
+ };
30
+ events: {
31
+ show(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
32
+ hide(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
33
+ };
34
+ }) & import("@workday/canvas-kit-react/common").ModelExtras<{
35
+ id: string;
36
+ initialVisibility: import("@workday/canvas-kit-react/disclosure").Visibility;
37
+ }, {}, {
38
+ id: string;
39
+ visibility: "hidden" | "visible";
40
+ }, {
41
+ show(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
42
+ hide(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
43
+ }, {
44
+ state: {
45
+ id: string;
46
+ visibility: "hidden" | "visible";
47
+ };
48
+ events: {
49
+ show(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
50
+ hide(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
51
+ };
52
+ }>;
53
+ //# sourceMappingURL=useExpandableModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useExpandableModel.d.ts","sourceRoot":"","sources":["../../../../../expandable/lib/hooks/useExpandableModel.tsx"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa7B,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useExpandableModel = void 0;
4
+ const common_1 = require("@workday/canvas-kit-react/common");
5
+ const disclosure_1 = require("@workday/canvas-kit-react/disclosure");
6
+ /**
7
+ * The `ExpandableModel` extends the `DisclosureModel`
8
+ */
9
+ exports.useExpandableModel = common_1.createModelHook({
10
+ defaultConfig: {
11
+ ...disclosure_1.useDisclosureModel.defaultConfig,
12
+ },
13
+ })(config => {
14
+ const disclosure = disclosure_1.useDisclosureModel(config);
15
+ const state = {
16
+ ...disclosure.state,
17
+ };
18
+ const events = {
19
+ ...disclosure.events,
20
+ };
21
+ return { state, events };
22
+ });
@@ -0,0 +1,15 @@
1
+ export declare const useExpandableTarget: import("@workday/canvas-kit-react/common").BehaviorHook<{
2
+ state: {
3
+ id: string;
4
+ visibility: "hidden" | "visible";
5
+ };
6
+ events: {
7
+ show(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
8
+ hide(event?: Event | import("react").SyntheticEvent<Element, Event> | undefined): void;
9
+ };
10
+ }, {
11
+ 'aria-controls': string;
12
+ 'aria-expanded': boolean;
13
+ onClick: (event: React.MouseEvent) => void;
14
+ }>;
15
+ //# sourceMappingURL=useExpandableTarget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useExpandableTarget.d.ts","sourceRoot":"","sources":["../../../../../expandable/lib/hooks/useExpandableTarget.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;qBAIX,gBAAgB;EAQnC,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useExpandableTarget = void 0;
4
+ const common_1 = require("@workday/canvas-kit-react/common");
5
+ const useExpandableModel_1 = require("./useExpandableModel");
6
+ exports.useExpandableTarget = common_1.createElemPropsHook(useExpandableModel_1.useExpandableModel)(({ state, events }) => {
7
+ return {
8
+ 'aria-controls': state.id,
9
+ 'aria-expanded': state.visibility !== 'hidden',
10
+ onClick: (event) => {
11
+ if (state.visibility !== 'hidden') {
12
+ events.hide(event);
13
+ }
14
+ else {
15
+ events.show(event);
16
+ }
17
+ },
18
+ };
19
+ });
@@ -1,5 +1,4 @@
1
1
  export * from './combobox';
2
- export * from './common';
3
- export * from './drawer';
2
+ export * from './expandable';
4
3
  export * from './search-form';
5
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
@@ -11,6 +11,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
13
  __exportStar(require("./combobox"), exports);
14
- __exportStar(require("./common"), exports);
15
- __exportStar(require("./drawer"), exports);
14
+ __exportStar(require("./expandable"), exports);
16
15
  __exportStar(require("./search-form"), exports);
@@ -1,7 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { GrowthBehavior } from '@workday/canvas-kit-react/common';
3
3
  import { TertiaryButtonProps } from '@workday/canvas-kit-react/button';
4
- import { MenuItemProps } from '@workday/canvas-kit-preview-react/menu';
5
4
  import { SearchTheme, SearchThemeAttributes } from './themes';
6
5
  export interface SearchFormProps extends GrowthBehavior, React.FormHTMLAttributes<HTMLFormElement> {
7
6
  /**
@@ -20,7 +19,7 @@ export interface SearchFormProps extends GrowthBehavior, React.FormHTMLAttribute
20
19
  /**
21
20
  * The autocomplete items of the SearchForm. This array of menu items is shown under the search bar.
22
21
  */
23
- autocompleteItems?: React.ReactElement<MenuItemProps>[];
22
+ autocompleteItems?: React.ReactElement<any>[];
24
23
  /**
25
24
  * The theme of the header the search input is being rendered in.
26
25
  */
@@ -79,6 +78,11 @@ export interface SearchFormProps extends GrowthBehavior, React.FormHTMLAttribute
79
78
  * @default false
80
79
  */
81
80
  allowEmptyStringSearch?: boolean;
81
+ /**
82
+ * Sets the `id` for the label
83
+ * @default unique identifier
84
+ */
85
+ labelId?: string;
82
86
  }
83
87
  export interface SearchFormState {
84
88
  showForm: boolean;
@@ -89,7 +93,7 @@ export declare class SearchForm extends React.Component<SearchFormProps, SearchF
89
93
  static Theme: typeof SearchTheme;
90
94
  private inputRef;
91
95
  private openRef;
92
- private labelId;
96
+ private defaultLabelId;
93
97
  state: Readonly<SearchFormState>;
94
98
  private getTheme;
95
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,EAAC,aAAa,EAAC,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAe,WAAW,EAAE,qBAAqB,EAAC,MAAM,UAAU,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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"}
@@ -1,28 +1,4 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- extendStatics(d, b);
11
- function __() { this.constructor = d; }
12
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
- };
14
- })();
15
- var __assign = (this && this.__assign) || function () {
16
- __assign = Object.assign || function(t) {
17
- for (var s, i = 1, n = arguments.length; i < n; i++) {
18
- s = arguments[i];
19
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
- t[p] = s[p];
21
- }
22
- return t;
23
- };
24
- return __assign.apply(this, arguments);
25
- };
26
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
27
3
  if (k2 === undefined) k2 = k;
28
4
  Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
@@ -42,32 +18,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
42
18
  __setModuleDefault(result, mod);
43
19
  return result;
44
20
  };
45
- var __rest = (this && this.__rest) || function (s, e) {
46
- var t = {};
47
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
48
- t[p] = s[p];
49
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
50
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
51
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
52
- t[p[i]] = s[p[i]];
53
- }
54
- return t;
55
- };
56
21
  var __importDefault = (this && this.__importDefault) || function (mod) {
57
22
  return (mod && mod.__esModule) ? mod : { "default": mod };
58
23
  };
59
24
  Object.defineProperty(exports, "__esModule", { value: true });
60
25
  exports.SearchForm = void 0;
61
- var React = __importStar(require("react"));
62
- var tokens_1 = require("@workday/canvas-kit-react/tokens");
63
- var common_1 = require("@workday/canvas-kit-react/common");
64
- var button_1 = require("@workday/canvas-kit-react/button");
65
- var canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
66
- var form_field_1 = require("@workday/canvas-kit-react/form-field");
67
- var combobox_1 = require("@workday/canvas-kit-labs-react/combobox");
68
- var text_input_1 = require("@workday/canvas-kit-react/text-input");
69
- var themes_1 = require("./themes");
70
- var chroma_js_1 = __importDefault(require("chroma-js"));
26
+ const React = __importStar(require("react"));
27
+ const tokens_1 = require("@workday/canvas-kit-react/tokens");
28
+ const common_1 = require("@workday/canvas-kit-react/common");
29
+ const button_1 = require("@workday/canvas-kit-react/button");
30
+ const canvas_system_icons_web_1 = require("@workday/canvas-system-icons-web");
31
+ const form_field_1 = require("@workday/canvas-kit-react/form-field");
32
+ const combobox_1 = require("@workday/canvas-kit-labs-react/combobox");
33
+ const text_input_1 = require("@workday/canvas-kit-react/text-input");
34
+ const themes_1 = require("./themes");
35
+ const chroma_js_1 = __importDefault(require("chroma-js"));
71
36
  function getInputColors(theme, isFocused) {
72
37
  return {
73
38
  background: isFocused && theme.backgroundFocus ? theme.backgroundFocus : theme.background,
@@ -79,19 +44,18 @@ function getInputColors(theme, isFocused) {
79
44
  boxShadow: isFocused && theme.boxShadowFocus ? theme.boxShadowFocus : theme.boxShadow,
80
45
  };
81
46
  }
82
- var formCollapsedBackground = tokens_1.colors.frenchVanilla100;
83
- var maxWidth = 480;
84
- var minWidth = 120;
85
- var StyledSearchForm = common_1.styled('form')({
47
+ const formCollapsedBackground = tokens_1.colors.frenchVanilla100;
48
+ const maxWidth = 480;
49
+ const minWidth = 120;
50
+ const StyledSearchForm = common_1.styled('form')({
86
51
  position: 'relative',
87
- flex: "1 1 auto",
52
+ flexGrow: 1,
88
53
  display: 'flex',
89
54
  alignItems: 'center',
90
55
  marginLeft: tokens_1.space.m,
91
56
  minWidth: minWidth,
92
- }, function (_a) {
93
- var isCollapsed = _a.isCollapsed, showForm = _a.showForm, rightAlign = _a.rightAlign, grow = _a.grow;
94
- var collapseStyles = isCollapsed
57
+ }, ({ isCollapsed, showForm, rightAlign, grow }) => {
58
+ const collapseStyles = isCollapsed
95
59
  ? {
96
60
  top: 0,
97
61
  right: 0,
@@ -107,35 +71,30 @@ var StyledSearchForm = common_1.styled('form')({
107
71
  zIndex: 1,
108
72
  }
109
73
  : {};
110
- var rightAlignStyles = rightAlign
74
+ const rightAlignStyles = rightAlign
111
75
  ? {
112
76
  textAlign: 'right',
113
77
  maxWidth: grow ? '100%' : maxWidth,
114
78
  }
115
79
  : {};
116
- return __assign(__assign({}, rightAlignStyles), collapseStyles);
80
+ return { ...rightAlignStyles, ...collapseStyles };
117
81
  });
118
- var SearchContainer = common_1.styled('div')({
119
- position: "relative",
82
+ const SearchContainer = common_1.styled('div')({
83
+ position: `relative`,
120
84
  display: 'flex',
121
85
  alignItems: 'center',
122
- width: "100%",
86
+ width: `100%`,
123
87
  textAlign: 'left',
124
- }, function (_a) {
125
- var height = _a.height;
126
- return ({
127
- minHeight: height,
128
- height: height,
129
- });
130
- });
131
- var SearchCombobox = common_1.styled(combobox_1.Combobox)({
132
- width: "100%",
88
+ }, ({ height }) => ({
89
+ minHeight: height,
90
+ }));
91
+ const SearchCombobox = common_1.styled(combobox_1.Combobox)({
92
+ width: `100%`,
133
93
  });
134
- var SearchIcon = common_1.styled(button_1.TertiaryButton)(function (_a) {
135
- var isCollapsed = _a.isCollapsed, isHidden = _a.isHidden;
94
+ const SearchIcon = common_1.styled(button_1.TertiaryButton)(({ isCollapsed, isHidden }) => {
136
95
  return {
137
- position: "absolute",
138
- margin: isCollapsed ? "auto " + tokens_1.space.xxs : "auto " + tokens_1.space.xxxs,
96
+ position: `absolute`,
97
+ margin: isCollapsed ? `auto ${tokens_1.space.xxs}` : `auto ${tokens_1.space.xxxs}`,
139
98
  top: 0,
140
99
  bottom: 0,
141
100
  left: 0,
@@ -144,19 +103,25 @@ var SearchIcon = common_1.styled(button_1.TertiaryButton)(function (_a) {
144
103
  display: isHidden ? 'none' : 'flex',
145
104
  };
146
105
  });
147
- var CloseButton = common_1.styled(button_1.TertiaryButton)(function (_a) {
148
- var isCollapsed = _a.isCollapsed, showForm = _a.showForm;
149
- var collapseStyles = isCollapsed && showForm
106
+ const CloseButton = common_1.styled(button_1.TertiaryButton)(({ isCollapsed, showForm }) => {
107
+ const collapseStyles = isCollapsed && showForm
150
108
  ? {
151
109
  display: 'inline-block',
152
110
  }
153
111
  : {
154
112
  display: 'none',
155
113
  };
156
- return __assign({ position: "absolute", top: 0, bottom: 0, right: 0, margin: "auto " + tokens_1.space.xxs, zIndex: 3 }, collapseStyles);
114
+ return {
115
+ position: `absolute`,
116
+ top: 0,
117
+ bottom: 0,
118
+ right: 0,
119
+ margin: `auto ${tokens_1.space.xxs}`,
120
+ zIndex: 3,
121
+ ...collapseStyles,
122
+ };
157
123
  });
158
- var SearchField = common_1.styled(form_field_1.FormField)(function (_a) {
159
- var isCollapsed = _a.isCollapsed, showForm = _a.showForm, grow = _a.grow, height = _a.height;
124
+ const SearchField = common_1.styled(form_field_1.FormField)(({ isCollapsed, showForm, grow, height }) => {
160
125
  return {
161
126
  display: (isCollapsed && showForm) || !isCollapsed ? 'inline-block' : 'none',
162
127
  width: '100%',
@@ -168,17 +133,15 @@ var SearchField = common_1.styled(form_field_1.FormField)(function (_a) {
168
133
  },
169
134
  };
170
135
  });
171
- var SearchInput = common_1.styled(text_input_1.TextInput)(function (_a) {
172
- var isCollapsed = _a.isCollapsed, inputColors = _a.inputColors, grow = _a.grow, height = _a.height;
173
- var collapseStyles = isCollapsed
136
+ const SearchInput = common_1.styled(text_input_1.TextInput)(({ isCollapsed, inputColors, grow, height }) => {
137
+ const collapseStyles = isCollapsed
174
138
  ? {
175
139
  fontSize: '20px',
176
- lineHeight: '20px',
177
140
  paddingLeft: tokens_1.spaceNumbers.xl + tokens_1.spaceNumbers.s,
178
141
  paddingRight: tokens_1.spaceNumbers.xl + tokens_1.spaceNumbers.s,
179
142
  maxWidth: 'none',
180
143
  minWidth: 0,
181
- backgroundColor: "rgba(0, 0, 0, 0)",
144
+ backgroundColor: `rgba(0, 0, 0, 0)`,
182
145
  height: height,
183
146
  }
184
147
  : {
@@ -189,11 +152,22 @@ var SearchInput = common_1.styled(text_input_1.TextInput)(function (_a) {
189
152
  backgroundColor: inputColors.background,
190
153
  height: height,
191
154
  };
192
- return __assign({ fontSize: '14px', lineHeight: '14px', boxShadow: inputColors.boxShadow, color: inputColors.color, border: 'none', WebkitAppearance: 'none', transition: 'background-color 120ms, color 120ms, box-shadow 200ms, border-color 200ms', zIndex: 2, width: '100%', '&::-webkit-search-cancel-button': {
155
+ return {
156
+ fontSize: '14px',
157
+ boxShadow: inputColors.boxShadow,
158
+ color: inputColors.color,
159
+ border: 'none',
160
+ WebkitAppearance: 'none',
161
+ transition: 'background-color 120ms, color 120ms, box-shadow 200ms, border-color 200ms',
162
+ zIndex: 2,
163
+ width: '100%',
164
+ '&::-webkit-search-cancel-button': {
193
165
  display: 'none',
194
- }, '&::placeholder': {
166
+ },
167
+ '&::placeholder': {
195
168
  color: inputColors.placeholderColor,
196
- }, '&:not([disabled])': {
169
+ },
170
+ '&:not([disabled])': {
197
171
  '&:focus, &:active': {
198
172
  outline: 'none',
199
173
  boxShadow: inputColors.boxShadow,
@@ -201,93 +175,93 @@ var SearchInput = common_1.styled(text_input_1.TextInput)(function (_a) {
201
175
  '&:hover': {
202
176
  backgroundColor: inputColors.backgroundHover,
203
177
  },
204
- } }, collapseStyles);
178
+ },
179
+ ...collapseStyles,
180
+ };
205
181
  });
206
- var SearchForm = /** @class */ (function (_super) {
207
- __extends(SearchForm, _super);
208
- function SearchForm() {
209
- var _this = _super !== null && _super.apply(this, arguments) || this;
210
- _this.inputRef = React.createRef();
211
- _this.openRef = React.createRef();
212
- _this.labelId = common_1.generateUniqueId();
213
- _this.state = {
182
+ class SearchForm extends React.Component {
183
+ constructor() {
184
+ super(...arguments);
185
+ this.inputRef = React.createRef();
186
+ this.openRef = React.createRef();
187
+ this.defaultLabelId = common_1.generateUniqueId();
188
+ this.state = {
214
189
  showForm: false,
215
190
  searchQuery: '',
216
191
  isFocused: false,
217
192
  };
218
- _this.getTheme = function () {
219
- var theme;
220
- if (typeof _this.props.searchTheme === 'number') {
221
- theme = themes_1.searchThemes[_this.props.searchTheme];
193
+ this.getTheme = () => {
194
+ let theme;
195
+ if (typeof this.props.searchTheme === 'number') {
196
+ theme = themes_1.searchThemes[this.props.searchTheme];
222
197
  }
223
- else if (_this.props.searchTheme) {
224
- theme = _this.props.searchTheme;
198
+ else if (this.props.searchTheme) {
199
+ theme = this.props.searchTheme;
225
200
  }
226
201
  else {
227
202
  theme = themes_1.searchThemes[themes_1.SearchTheme.Light];
228
203
  }
229
204
  return theme;
230
205
  };
231
- _this.getThemeColors = function () {
232
- var theme = _this.props.isCollapsed && _this.state.showForm
206
+ this.getThemeColors = () => {
207
+ const theme = this.props.isCollapsed && this.state.showForm
233
208
  ? themes_1.searchThemes[themes_1.SearchTheme.Transparent]
234
- : _this.getTheme();
235
- return getInputColors(theme, _this.state.isFocused);
209
+ : this.getTheme();
210
+ return getInputColors(theme, this.state.isFocused);
236
211
  };
237
- _this.getIconButtonType = function () {
238
- var background = _this.getThemeColors().background || "#fff";
239
- if (_this.props.isCollapsed && _this.state.showForm) {
212
+ this.getIconButtonType = () => {
213
+ let background = this.getThemeColors().background || `#fff`;
214
+ if (this.props.isCollapsed && this.state.showForm) {
240
215
  background = formCollapsedBackground;
241
216
  }
242
- var isDarkBackground = chroma_js_1.default(background).get('lab.l') < 70;
217
+ const isDarkBackground = chroma_js_1.default(background).get('lab.l') < 70;
243
218
  return isDarkBackground ? 'inverse' : undefined;
244
219
  };
245
- _this.handleSubmit = function (event) {
220
+ this.handleSubmit = (event) => {
246
221
  event.preventDefault();
247
- if (_this.props.allowEmptyStringSearch || _this.state.searchQuery.trim()) {
248
- _this.props.onSubmit(event);
222
+ if (this.props.allowEmptyStringSearch || this.state.searchQuery.trim()) {
223
+ this.props.onSubmit(event);
249
224
  }
250
225
  else {
251
- _this.focusInput();
226
+ this.focusInput();
252
227
  }
253
228
  };
254
- _this.openCollapsedSearch = function () {
255
- if (_this.props.isCollapsed && !_this.state.showForm) {
256
- _this.setState({ showForm: true });
229
+ this.openCollapsedSearch = () => {
230
+ if (this.props.isCollapsed && !this.state.showForm) {
231
+ this.setState({ showForm: true });
257
232
  }
258
233
  };
259
- _this.closeCollapsedSearch = function () {
260
- if (_this.props.isCollapsed && _this.state.showForm) {
261
- _this.setState({ showForm: false });
234
+ this.closeCollapsedSearch = () => {
235
+ if (this.props.isCollapsed && this.state.showForm) {
236
+ this.setState({ showForm: false });
262
237
  }
263
238
  };
264
- _this.focusInput = function () {
265
- if (_this.inputRef.current) {
266
- _this.inputRef.current.focus();
239
+ this.focusInput = () => {
240
+ if (this.inputRef.current) {
241
+ this.inputRef.current.focus();
267
242
  }
268
243
  };
269
- _this.focusOpen = function () {
270
- if (_this.openRef.current) {
271
- _this.openRef.current.focus();
244
+ this.focusOpen = () => {
245
+ if (this.openRef.current) {
246
+ this.openRef.current.focus();
272
247
  }
273
248
  };
274
- _this.handleFocus = function () {
275
- _this.setState({ isFocused: true });
249
+ this.handleFocus = () => {
250
+ this.setState({ isFocused: true });
276
251
  };
277
- _this.handleBlur = function () {
278
- _this.setState({ isFocused: false });
252
+ this.handleBlur = () => {
253
+ this.setState({ isFocused: false });
279
254
  };
280
- _this.handleSearchInputChange = function (event) {
255
+ this.handleSearchInputChange = (event) => {
281
256
  event.preventDefault();
282
- _this.setState({ searchQuery: event.target.value });
283
- if (_this.props.onInputChange) {
284
- _this.props.onInputChange(event);
257
+ this.setState({ searchQuery: event.target.value });
258
+ if (this.props.onInputChange) {
259
+ this.props.onInputChange(event);
285
260
  }
286
261
  };
287
- return _this;
288
262
  }
289
- SearchForm.prototype.componentDidUpdate = function (prevProps, prevState) {
290
- var showFormToggled = this.state.showForm !== prevState.showForm;
263
+ componentDidUpdate(prevProps, prevState) {
264
+ const showFormToggled = this.state.showForm !== prevState.showForm;
291
265
  if (showFormToggled) {
292
266
  if (this.state.showForm) {
293
267
  this.focusInput();
@@ -296,19 +270,18 @@ var SearchForm = /** @class */ (function (_super) {
296
270
  this.focusOpen();
297
271
  }
298
272
  }
299
- };
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.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"]);
302
- 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),
273
+ }
274
+ render() {
275
+ const { clearButtonAriaLabel = 'Reset Search Form', placeholder = 'Search', inputLabel = 'Search', submitAriaLabel = 'Search', openButtonAriaLabel = 'Open Search', closeButtonAriaLabel = 'Cancel', labelId = this.defaultLabelId, showClearButton = true, height = 40, grow, onSubmit, isCollapsed, onInputChange, autocompleteItems, initialValue, searchTheme, rightAlign, allowEmptyStringSearch = false, ...elemProps } = this.props;
276
+ return (React.createElement(StyledSearchForm, Object.assign({ role: "search", action: ".", rightAlign: rightAlign, grow: grow, "aria-labelledby": labelId, isCollapsed: isCollapsed, onSubmit: this.handleSubmit, showForm: this.state.showForm }, elemProps),
303
277
  React.createElement(SearchContainer, { height: height },
304
278
  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
279
  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: this.labelId, inputId: "input-" + this.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: this.labelId },
280
+ 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 },
281
+ 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
282
  React.createElement(SearchInput, { ref: this.inputRef, value: this.state.searchQuery, placeholder: placeholder, isCollapsed: isCollapsed, inputColors: this.getThemeColors(), height: height, name: "search", autoComplete: "off" }))),
309
283
  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
- };
311
- SearchForm.Theme = themes_1.SearchTheme;
312
- return SearchForm;
313
- }(React.Component));
284
+ }
285
+ }
314
286
  exports.SearchForm = SearchForm;
287
+ SearchForm.Theme = themes_1.SearchTheme;