@workday/canvas-kit-labs-react 8.0.0-alpha.253-next.22 → 8.0.0-alpha.428-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 (203) hide show
  1. package/common/lib/theming/index.ts +0 -1
  2. package/common/lib/theming/useThemeRTL.ts +3 -0
  3. package/dist/commonjs/combobox/lib/AutocompleteList.js +31 -52
  4. package/dist/commonjs/combobox/lib/Combobox.js +105 -133
  5. package/dist/commonjs/combobox/lib/Status.js +9 -10
  6. package/dist/commonjs/common/lib/theming/index.d.ts +0 -1
  7. package/dist/commonjs/common/lib/theming/index.d.ts.map +1 -1
  8. package/dist/commonjs/common/lib/theming/index.js +0 -1
  9. package/dist/commonjs/common/lib/theming/useThemeRTL.d.ts +3 -0
  10. package/dist/commonjs/common/lib/theming/useThemeRTL.d.ts.map +1 -1
  11. package/dist/commonjs/common/lib/theming/useThemeRTL.js +19 -42
  12. package/dist/commonjs/expandable/lib/Expandable.d.ts +45 -12
  13. package/dist/commonjs/expandable/lib/Expandable.d.ts.map +1 -1
  14. package/dist/commonjs/expandable/lib/Expandable.js +46 -37
  15. package/dist/commonjs/expandable/lib/ExpandableAvatar.js +7 -30
  16. package/dist/commonjs/expandable/lib/ExpandableContent.d.ts +4 -2
  17. package/dist/commonjs/expandable/lib/ExpandableContent.d.ts.map +1 -1
  18. package/dist/commonjs/expandable/lib/ExpandableContent.js +8 -31
  19. package/dist/commonjs/expandable/lib/ExpandableIcon.d.ts +1 -1
  20. package/dist/commonjs/expandable/lib/ExpandableIcon.d.ts.map +1 -1
  21. package/dist/commonjs/expandable/lib/ExpandableIcon.js +20 -51
  22. package/dist/commonjs/expandable/lib/ExpandableTarget.d.ts +7 -2
  23. package/dist/commonjs/expandable/lib/ExpandableTarget.d.ts.map +1 -1
  24. package/dist/commonjs/expandable/lib/ExpandableTarget.js +18 -34
  25. package/dist/commonjs/expandable/lib/ExpandableTitle.d.ts +3 -1
  26. package/dist/commonjs/expandable/lib/ExpandableTitle.d.ts.map +1 -1
  27. package/dist/commonjs/expandable/lib/ExpandableTitle.js +6 -29
  28. package/dist/commonjs/expandable/lib/hooks/index.d.ts +1 -0
  29. package/dist/commonjs/expandable/lib/hooks/index.d.ts.map +1 -1
  30. package/dist/commonjs/expandable/lib/hooks/index.js +1 -0
  31. package/dist/commonjs/expandable/lib/hooks/useExpandableContent.d.ts +4 -6
  32. package/dist/commonjs/expandable/lib/hooks/useExpandableContent.d.ts.map +1 -1
  33. package/dist/commonjs/expandable/lib/hooks/useExpandableContent.js +3 -4
  34. package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.d.ts +4 -6
  35. package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.d.ts.map +1 -1
  36. package/dist/commonjs/expandable/lib/hooks/useExpandableIcon.js +3 -4
  37. package/dist/{es6/expandable/lib → commonjs/expandable/lib/hooks}/useExpandableModel.d.ts +10 -7
  38. package/dist/commonjs/expandable/lib/hooks/useExpandableModel.d.ts.map +1 -0
  39. package/dist/commonjs/expandable/lib/hooks/useExpandableModel.js +22 -0
  40. package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.d.ts +4 -6
  41. package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.d.ts.map +1 -1
  42. package/dist/commonjs/expandable/lib/hooks/useExpandableTarget.js +4 -5
  43. package/dist/commonjs/index.d.ts +0 -3
  44. package/dist/commonjs/index.d.ts.map +1 -1
  45. package/dist/commonjs/index.js +0 -3
  46. package/dist/commonjs/search-form/lib/SearchForm.d.ts +6 -1
  47. package/dist/commonjs/search-form/lib/SearchForm.d.ts.map +1 -1
  48. package/dist/commonjs/search-form/lib/SearchForm.js +117 -142
  49. package/dist/commonjs/search-form/lib/themes.js +7 -8
  50. package/dist/es6/combobox/lib/AutocompleteList.js +26 -47
  51. package/dist/es6/combobox/lib/Combobox.js +95 -123
  52. package/dist/es6/combobox/lib/Status.js +6 -7
  53. package/dist/es6/common/lib/theming/index.d.ts +0 -1
  54. package/dist/es6/common/lib/theming/index.d.ts.map +1 -1
  55. package/dist/es6/common/lib/theming/index.js +0 -1
  56. package/dist/es6/common/lib/theming/useThemeRTL.d.ts +3 -0
  57. package/dist/es6/common/lib/theming/useThemeRTL.d.ts.map +1 -1
  58. package/dist/es6/common/lib/theming/useThemeRTL.js +16 -39
  59. package/dist/es6/expandable/lib/Expandable.d.ts +45 -12
  60. package/dist/es6/expandable/lib/Expandable.d.ts.map +1 -1
  61. package/dist/es6/expandable/lib/Expandable.js +40 -31
  62. package/dist/es6/expandable/lib/ExpandableAvatar.js +4 -27
  63. package/dist/es6/expandable/lib/ExpandableContent.d.ts +4 -2
  64. package/dist/es6/expandable/lib/ExpandableContent.d.ts.map +1 -1
  65. package/dist/es6/expandable/lib/ExpandableContent.js +5 -28
  66. package/dist/es6/expandable/lib/ExpandableIcon.d.ts +1 -1
  67. package/dist/es6/expandable/lib/ExpandableIcon.d.ts.map +1 -1
  68. package/dist/es6/expandable/lib/ExpandableIcon.js +15 -46
  69. package/dist/es6/expandable/lib/ExpandableTarget.d.ts +7 -2
  70. package/dist/es6/expandable/lib/ExpandableTarget.d.ts.map +1 -1
  71. package/dist/es6/expandable/lib/ExpandableTarget.js +15 -31
  72. package/dist/es6/expandable/lib/ExpandableTitle.d.ts +3 -1
  73. package/dist/es6/expandable/lib/ExpandableTitle.d.ts.map +1 -1
  74. package/dist/es6/expandable/lib/ExpandableTitle.js +3 -26
  75. package/dist/es6/expandable/lib/hooks/index.d.ts +1 -0
  76. package/dist/es6/expandable/lib/hooks/index.d.ts.map +1 -1
  77. package/dist/es6/expandable/lib/hooks/index.js +1 -0
  78. package/dist/es6/expandable/lib/hooks/useExpandableContent.d.ts +4 -6
  79. package/dist/es6/expandable/lib/hooks/useExpandableContent.d.ts.map +1 -1
  80. package/dist/es6/expandable/lib/hooks/useExpandableContent.js +2 -3
  81. package/dist/es6/expandable/lib/hooks/useExpandableIcon.d.ts +4 -6
  82. package/dist/es6/expandable/lib/hooks/useExpandableIcon.d.ts.map +1 -1
  83. package/dist/es6/expandable/lib/hooks/useExpandableIcon.js +2 -3
  84. package/dist/{commonjs/expandable/lib → es6/expandable/lib/hooks}/useExpandableModel.d.ts +10 -7
  85. package/dist/es6/expandable/lib/hooks/useExpandableModel.d.ts.map +1 -0
  86. package/dist/es6/expandable/lib/hooks/useExpandableModel.js +19 -0
  87. package/dist/es6/expandable/lib/hooks/useExpandableTarget.d.ts +4 -6
  88. package/dist/es6/expandable/lib/hooks/useExpandableTarget.d.ts.map +1 -1
  89. package/dist/es6/expandable/lib/hooks/useExpandableTarget.js +3 -4
  90. package/dist/es6/index.d.ts +0 -3
  91. package/dist/es6/index.d.ts.map +1 -1
  92. package/dist/es6/index.js +0 -3
  93. package/dist/es6/search-form/lib/SearchForm.d.ts +6 -1
  94. package/dist/es6/search-form/lib/SearchForm.d.ts.map +1 -1
  95. package/dist/es6/search-form/lib/SearchForm.js +107 -133
  96. package/dist/es6/search-form/lib/themes.js +5 -6
  97. package/expandable/lib/Expandable.tsx +38 -4
  98. package/expandable/lib/ExpandableContent.tsx +4 -4
  99. package/expandable/lib/ExpandableIcon.tsx +2 -1
  100. package/expandable/lib/ExpandableTarget.tsx +3 -3
  101. package/expandable/lib/ExpandableTitle.tsx +6 -8
  102. package/expandable/lib/hooks/index.ts +1 -0
  103. package/expandable/lib/hooks/useExpandableContent.ts +1 -1
  104. package/expandable/lib/hooks/useExpandableIcon.ts +1 -1
  105. package/expandable/lib/{useExpandableModel.tsx → hooks/useExpandableModel.tsx} +3 -0
  106. package/expandable/lib/hooks/useExpandableTarget.ts +1 -1
  107. package/index.ts +0 -3
  108. package/package.json +4 -4
  109. package/search-form/lib/SearchForm.tsx +11 -5
  110. package/common/lib/theming/useThemedRing.ts +0 -82
  111. package/dist/commonjs/common/lib/theming/useThemedRing.d.ts +0 -11
  112. package/dist/commonjs/common/lib/theming/useThemedRing.d.ts.map +0 -1
  113. package/dist/commonjs/common/lib/theming/useThemedRing.js +0 -67
  114. package/dist/commonjs/drawer/index.d.ts +0 -3
  115. package/dist/commonjs/drawer/index.d.ts.map +0 -1
  116. package/dist/commonjs/drawer/index.js +0 -16
  117. package/dist/commonjs/drawer/lib/Drawer.d.ts +0 -74
  118. package/dist/commonjs/drawer/lib/Drawer.d.ts.map +0 -1
  119. package/dist/commonjs/drawer/lib/Drawer.js +0 -142
  120. package/dist/commonjs/drawer/lib/DrawerHeader.d.ts +0 -55
  121. package/dist/commonjs/drawer/lib/DrawerHeader.d.ts.map +0 -1
  122. package/dist/commonjs/drawer/lib/DrawerHeader.js +0 -113
  123. package/dist/commonjs/expandable/lib/useExpandableModel.d.ts.map +0 -1
  124. package/dist/commonjs/expandable/lib/useExpandableModel.js +0 -24
  125. package/dist/commonjs/toast/index.d.ts +0 -3
  126. package/dist/commonjs/toast/index.d.ts.map +0 -1
  127. package/dist/commonjs/toast/index.js +0 -14
  128. package/dist/commonjs/toast/lib/Toast.d.ts +0 -27
  129. package/dist/commonjs/toast/lib/Toast.d.ts.map +0 -1
  130. package/dist/commonjs/toast/lib/Toast.js +0 -78
  131. package/dist/commonjs/toast/lib/ToastBody.d.ts +0 -6
  132. package/dist/commonjs/toast/lib/ToastBody.d.ts.map +0 -1
  133. package/dist/commonjs/toast/lib/ToastBody.js +0 -40
  134. package/dist/commonjs/toast/lib/ToastCloseIcon.d.ts +0 -6
  135. package/dist/commonjs/toast/lib/ToastCloseIcon.d.ts.map +0 -1
  136. package/dist/commonjs/toast/lib/ToastCloseIcon.js +0 -43
  137. package/dist/commonjs/toast/lib/ToastIcon.d.ts +0 -5
  138. package/dist/commonjs/toast/lib/ToastIcon.d.ts.map +0 -1
  139. package/dist/commonjs/toast/lib/ToastIcon.js +0 -26
  140. package/dist/commonjs/toast/lib/ToastLink.d.ts +0 -9
  141. package/dist/commonjs/toast/lib/ToastLink.d.ts.map +0 -1
  142. package/dist/commonjs/toast/lib/ToastLink.js +0 -42
  143. package/dist/commonjs/toast/lib/ToastMessage.d.ts +0 -11
  144. package/dist/commonjs/toast/lib/ToastMessage.d.ts.map +0 -1
  145. package/dist/commonjs/toast/lib/ToastMessage.js +0 -41
  146. package/dist/commonjs/toast/lib/hooks/useToastModel.d.ts +0 -65
  147. package/dist/commonjs/toast/lib/hooks/useToastModel.d.ts.map +0 -1
  148. package/dist/commonjs/toast/lib/hooks/useToastModel.js +0 -35
  149. package/dist/es6/common/lib/theming/useThemedRing.d.ts +0 -11
  150. package/dist/es6/common/lib/theming/useThemedRing.d.ts.map +0 -1
  151. package/dist/es6/common/lib/theming/useThemedRing.js +0 -59
  152. package/dist/es6/drawer/index.d.ts +0 -3
  153. package/dist/es6/drawer/index.d.ts.map +0 -1
  154. package/dist/es6/drawer/index.js +0 -2
  155. package/dist/es6/drawer/lib/Drawer.d.ts +0 -74
  156. package/dist/es6/drawer/lib/Drawer.d.ts.map +0 -1
  157. package/dist/es6/drawer/lib/Drawer.js +0 -117
  158. package/dist/es6/drawer/lib/DrawerHeader.d.ts +0 -55
  159. package/dist/es6/drawer/lib/DrawerHeader.d.ts.map +0 -1
  160. package/dist/es6/drawer/lib/DrawerHeader.js +0 -88
  161. package/dist/es6/expandable/lib/useExpandableModel.d.ts.map +0 -1
  162. package/dist/es6/expandable/lib/useExpandableModel.js +0 -21
  163. package/dist/es6/toast/index.d.ts +0 -3
  164. package/dist/es6/toast/index.d.ts.map +0 -1
  165. package/dist/es6/toast/index.js +0 -2
  166. package/dist/es6/toast/lib/Toast.d.ts +0 -27
  167. package/dist/es6/toast/lib/Toast.d.ts.map +0 -1
  168. package/dist/es6/toast/lib/Toast.js +0 -72
  169. package/dist/es6/toast/lib/ToastBody.d.ts +0 -6
  170. package/dist/es6/toast/lib/ToastBody.d.ts.map +0 -1
  171. package/dist/es6/toast/lib/ToastBody.js +0 -34
  172. package/dist/es6/toast/lib/ToastCloseIcon.d.ts +0 -6
  173. package/dist/es6/toast/lib/ToastCloseIcon.d.ts.map +0 -1
  174. package/dist/es6/toast/lib/ToastCloseIcon.js +0 -37
  175. package/dist/es6/toast/lib/ToastIcon.d.ts +0 -5
  176. package/dist/es6/toast/lib/ToastIcon.d.ts.map +0 -1
  177. package/dist/es6/toast/lib/ToastIcon.js +0 -20
  178. package/dist/es6/toast/lib/ToastLink.d.ts +0 -9
  179. package/dist/es6/toast/lib/ToastLink.d.ts.map +0 -1
  180. package/dist/es6/toast/lib/ToastLink.js +0 -36
  181. package/dist/es6/toast/lib/ToastMessage.d.ts +0 -11
  182. package/dist/es6/toast/lib/ToastMessage.d.ts.map +0 -1
  183. package/dist/es6/toast/lib/ToastMessage.js +0 -35
  184. package/dist/es6/toast/lib/hooks/useToastModel.d.ts +0 -65
  185. package/dist/es6/toast/lib/hooks/useToastModel.d.ts.map +0 -1
  186. package/dist/es6/toast/lib/hooks/useToastModel.js +0 -32
  187. package/drawer/LICENSE +0 -51
  188. package/drawer/README.md +0 -35
  189. package/drawer/index.ts +0 -2
  190. package/drawer/lib/Drawer.tsx +0 -156
  191. package/drawer/lib/DrawerHeader.tsx +0 -133
  192. package/drawer/package.json +0 -6
  193. package/toast/LICENSE +0 -52
  194. package/toast/README.md +0 -5
  195. package/toast/index.ts +0 -2
  196. package/toast/lib/Toast.tsx +0 -63
  197. package/toast/lib/ToastBody.tsx +0 -34
  198. package/toast/lib/ToastCloseIcon.tsx +0 -18
  199. package/toast/lib/ToastIcon.tsx +0 -24
  200. package/toast/lib/ToastLink.tsx +0 -27
  201. package/toast/lib/ToastMessage.tsx +0 -21
  202. package/toast/lib/hooks/useToastModel.tsx +0 -27
  203. package/toast/package.json +0 -6
@@ -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
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,34 +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
- });
129
- });
130
- var SearchCombobox = common_1.styled(combobox_1.Combobox)({
131
- width: "100%",
88
+ }, ({ height }) => ({
89
+ minHeight: height,
90
+ }));
91
+ const SearchCombobox = common_1.styled(combobox_1.Combobox)({
92
+ width: `100%`,
132
93
  });
133
- var SearchIcon = common_1.styled(button_1.TertiaryButton)(function (_a) {
134
- var isCollapsed = _a.isCollapsed, isHidden = _a.isHidden;
94
+ const SearchIcon = common_1.styled(button_1.TertiaryButton)(({ isCollapsed, isHidden }) => {
135
95
  return {
136
- position: "absolute",
137
- 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}`,
138
98
  top: 0,
139
99
  bottom: 0,
140
100
  left: 0,
@@ -143,19 +103,25 @@ var SearchIcon = common_1.styled(button_1.TertiaryButton)(function (_a) {
143
103
  display: isHidden ? 'none' : 'flex',
144
104
  };
145
105
  });
146
- var CloseButton = common_1.styled(button_1.TertiaryButton)(function (_a) {
147
- var isCollapsed = _a.isCollapsed, showForm = _a.showForm;
148
- var collapseStyles = isCollapsed && showForm
106
+ const CloseButton = common_1.styled(button_1.TertiaryButton)(({ isCollapsed, showForm }) => {
107
+ const collapseStyles = isCollapsed && showForm
149
108
  ? {
150
109
  display: 'inline-block',
151
110
  }
152
111
  : {
153
112
  display: 'none',
154
113
  };
155
- 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
+ };
156
123
  });
157
- var SearchField = common_1.styled(form_field_1.FormField)(function (_a) {
158
- 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 }) => {
159
125
  return {
160
126
  display: (isCollapsed && showForm) || !isCollapsed ? 'inline-block' : 'none',
161
127
  width: '100%',
@@ -167,16 +133,15 @@ var SearchField = common_1.styled(form_field_1.FormField)(function (_a) {
167
133
  },
168
134
  };
169
135
  });
170
- var SearchInput = common_1.styled(text_input_1.TextInput)(function (_a) {
171
- var isCollapsed = _a.isCollapsed, inputColors = _a.inputColors, grow = _a.grow, height = _a.height;
172
- var collapseStyles = isCollapsed
136
+ const SearchInput = common_1.styled(text_input_1.TextInput)(({ isCollapsed, inputColors, grow, height }) => {
137
+ const collapseStyles = isCollapsed
173
138
  ? {
174
139
  fontSize: '20px',
175
140
  paddingLeft: tokens_1.spaceNumbers.xl + tokens_1.spaceNumbers.s,
176
141
  paddingRight: tokens_1.spaceNumbers.xl + tokens_1.spaceNumbers.s,
177
142
  maxWidth: 'none',
178
143
  minWidth: 0,
179
- backgroundColor: "rgba(0, 0, 0, 0)",
144
+ backgroundColor: `rgba(0, 0, 0, 0)`,
180
145
  height: height,
181
146
  }
182
147
  : {
@@ -187,11 +152,22 @@ var SearchInput = common_1.styled(text_input_1.TextInput)(function (_a) {
187
152
  backgroundColor: inputColors.background,
188
153
  height: height,
189
154
  };
190
- return __assign({ fontSize: '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': {
191
165
  display: 'none',
192
- }, '&::placeholder': {
166
+ },
167
+ '&::placeholder': {
193
168
  color: inputColors.placeholderColor,
194
- }, '&:not([disabled])': {
169
+ },
170
+ '&:not([disabled])': {
195
171
  '&:focus, &:active': {
196
172
  outline: 'none',
197
173
  boxShadow: inputColors.boxShadow,
@@ -199,93 +175,93 @@ var SearchInput = common_1.styled(text_input_1.TextInput)(function (_a) {
199
175
  '&:hover': {
200
176
  backgroundColor: inputColors.backgroundHover,
201
177
  },
202
- } }, collapseStyles);
178
+ },
179
+ ...collapseStyles,
180
+ };
203
181
  });
204
- var SearchForm = /** @class */ (function (_super) {
205
- __extends(SearchForm, _super);
206
- function SearchForm() {
207
- var _this = _super !== null && _super.apply(this, arguments) || this;
208
- _this.inputRef = React.createRef();
209
- _this.openRef = React.createRef();
210
- _this.labelId = common_1.generateUniqueId();
211
- _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 = {
212
189
  showForm: false,
213
190
  searchQuery: '',
214
191
  isFocused: false,
215
192
  };
216
- _this.getTheme = function () {
217
- var theme;
218
- if (typeof _this.props.searchTheme === 'number') {
219
- 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];
220
197
  }
221
- else if (_this.props.searchTheme) {
222
- theme = _this.props.searchTheme;
198
+ else if (this.props.searchTheme) {
199
+ theme = this.props.searchTheme;
223
200
  }
224
201
  else {
225
202
  theme = themes_1.searchThemes[themes_1.SearchTheme.Light];
226
203
  }
227
204
  return theme;
228
205
  };
229
- _this.getThemeColors = function () {
230
- var theme = _this.props.isCollapsed && _this.state.showForm
206
+ this.getThemeColors = () => {
207
+ const theme = this.props.isCollapsed && this.state.showForm
231
208
  ? themes_1.searchThemes[themes_1.SearchTheme.Transparent]
232
- : _this.getTheme();
233
- return getInputColors(theme, _this.state.isFocused);
209
+ : this.getTheme();
210
+ return getInputColors(theme, this.state.isFocused);
234
211
  };
235
- _this.getIconButtonType = function () {
236
- var background = _this.getThemeColors().background || "#fff";
237
- 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) {
238
215
  background = formCollapsedBackground;
239
216
  }
240
- var isDarkBackground = chroma_js_1.default(background).get('lab.l') < 70;
217
+ const isDarkBackground = chroma_js_1.default(background).get('lab.l') < 70;
241
218
  return isDarkBackground ? 'inverse' : undefined;
242
219
  };
243
- _this.handleSubmit = function (event) {
220
+ this.handleSubmit = (event) => {
244
221
  event.preventDefault();
245
- if (_this.props.allowEmptyStringSearch || _this.state.searchQuery.trim()) {
246
- _this.props.onSubmit(event);
222
+ if (this.props.allowEmptyStringSearch || this.state.searchQuery.trim()) {
223
+ this.props.onSubmit(event);
247
224
  }
248
225
  else {
249
- _this.focusInput();
226
+ this.focusInput();
250
227
  }
251
228
  };
252
- _this.openCollapsedSearch = function () {
253
- if (_this.props.isCollapsed && !_this.state.showForm) {
254
- _this.setState({ showForm: true });
229
+ this.openCollapsedSearch = () => {
230
+ if (this.props.isCollapsed && !this.state.showForm) {
231
+ this.setState({ showForm: true });
255
232
  }
256
233
  };
257
- _this.closeCollapsedSearch = function () {
258
- if (_this.props.isCollapsed && _this.state.showForm) {
259
- _this.setState({ showForm: false });
234
+ this.closeCollapsedSearch = () => {
235
+ if (this.props.isCollapsed && this.state.showForm) {
236
+ this.setState({ showForm: false });
260
237
  }
261
238
  };
262
- _this.focusInput = function () {
263
- if (_this.inputRef.current) {
264
- _this.inputRef.current.focus();
239
+ this.focusInput = () => {
240
+ if (this.inputRef.current) {
241
+ this.inputRef.current.focus();
265
242
  }
266
243
  };
267
- _this.focusOpen = function () {
268
- if (_this.openRef.current) {
269
- _this.openRef.current.focus();
244
+ this.focusOpen = () => {
245
+ if (this.openRef.current) {
246
+ this.openRef.current.focus();
270
247
  }
271
248
  };
272
- _this.handleFocus = function () {
273
- _this.setState({ isFocused: true });
249
+ this.handleFocus = () => {
250
+ this.setState({ isFocused: true });
274
251
  };
275
- _this.handleBlur = function () {
276
- _this.setState({ isFocused: false });
252
+ this.handleBlur = () => {
253
+ this.setState({ isFocused: false });
277
254
  };
278
- _this.handleSearchInputChange = function (event) {
255
+ this.handleSearchInputChange = (event) => {
279
256
  event.preventDefault();
280
- _this.setState({ searchQuery: event.target.value });
281
- if (_this.props.onInputChange) {
282
- _this.props.onInputChange(event);
257
+ this.setState({ searchQuery: event.target.value });
258
+ if (this.props.onInputChange) {
259
+ this.props.onInputChange(event);
283
260
  }
284
261
  };
285
- return _this;
286
262
  }
287
- SearchForm.prototype.componentDidUpdate = function (prevProps, prevState) {
288
- var showFormToggled = this.state.showForm !== prevState.showForm;
263
+ componentDidUpdate(prevProps, prevState) {
264
+ const showFormToggled = this.state.showForm !== prevState.showForm;
289
265
  if (showFormToggled) {
290
266
  if (this.state.showForm) {
291
267
  this.focusInput();
@@ -294,19 +270,18 @@ var SearchForm = /** @class */ (function (_super) {
294
270
  this.focusOpen();
295
271
  }
296
272
  }
297
- };
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.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"]);
300
- 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),
301
277
  React.createElement(SearchContainer, { height: height },
302
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 }),
303
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) }),
304
- 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 },
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: 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 },
306
282
  React.createElement(SearchInput, { ref: this.inputRef, value: this.state.searchQuery, placeholder: placeholder, isCollapsed: isCollapsed, inputColors: this.getThemeColors(), height: height, name: "search", autoComplete: "off" }))),
307
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" }))));
308
- };
309
- SearchForm.Theme = themes_1.SearchTheme;
310
- return SearchForm;
311
- }(React.Component));
284
+ }
285
+ }
312
286
  exports.SearchForm = SearchForm;
287
+ SearchForm.Theme = themes_1.SearchTheme;
@@ -1,17 +1,16 @@
1
1
  "use strict";
2
- var _a;
3
2
  Object.defineProperty(exports, "__esModule", { value: true });
4
3
  exports.searchThemes = exports.SearchTheme = void 0;
5
- var common_1 = require("@workday/canvas-kit-react/common");
6
- var tokens_1 = require("@workday/canvas-kit-react/tokens");
4
+ const common_1 = require("@workday/canvas-kit-react/common");
5
+ const tokens_1 = require("@workday/canvas-kit-react/tokens");
7
6
  var SearchTheme;
8
7
  (function (SearchTheme) {
9
8
  SearchTheme[SearchTheme["Light"] = 0] = "Light";
10
9
  SearchTheme[SearchTheme["Dark"] = 1] = "Dark";
11
10
  SearchTheme[SearchTheme["Transparent"] = 2] = "Transparent";
12
11
  })(SearchTheme = exports.SearchTheme || (exports.SearchTheme = {}));
13
- exports.searchThemes = (_a = {},
14
- _a[SearchTheme.Transparent] = {
12
+ exports.searchThemes = {
13
+ [SearchTheme.Transparent]: {
15
14
  background: 'rgba(0, 0, 0, 0)',
16
15
  backgroundFocus: 'rgba(0, 0, 0, 0)',
17
16
  color: tokens_1.colors.blackPepper300,
@@ -21,7 +20,7 @@ exports.searchThemes = (_a = {},
21
20
  boxShadow: 'none',
22
21
  boxShadowFocus: 'none',
23
22
  },
24
- _a[SearchTheme.Light] = {
23
+ [SearchTheme.Light]: {
25
24
  background: tokens_1.colors.soap200,
26
25
  backgroundFocus: tokens_1.colors.soap200,
27
26
  backgroundHover: tokens_1.colors.soap300,
@@ -30,7 +29,7 @@ exports.searchThemes = (_a = {},
30
29
  boxShadow: 'none',
31
30
  boxShadowFocus: common_1.focusRing().boxShadow,
32
31
  },
33
- _a[SearchTheme.Dark] = {
32
+ [SearchTheme.Dark]: {
34
33
  background: 'rgba(0, 0, 0, 0.2)',
35
34
  backgroundFocus: tokens_1.colors.frenchVanilla100,
36
35
  color: tokens_1.colors.frenchVanilla100,
@@ -39,4 +38,4 @@ exports.searchThemes = (_a = {},
39
38
  placeholderColorFocus: tokens_1.colors.licorice300,
40
39
  boxShadow: 'none',
41
40
  },
42
- _a);
41
+ };
@@ -1,58 +1,40 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __spreadArrays = (this && this.__spreadArrays) || function () {
13
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
14
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
15
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
16
- r[k] = a[j];
17
- return r;
18
- };
19
1
  import React, { Fragment, useState } from 'react';
20
2
  import styled from '@emotion/styled';
21
3
  import { space } from '@workday/canvas-kit-react/tokens';
22
4
  import { accessibleHide, generateUniqueId } from '@workday/canvas-kit-react/common';
23
5
  import { getOptionId, listBoxIdPart, getTextFromElement } from './Combobox';
24
- var Autocomplete = styled('ul')({
6
+ const Autocomplete = styled('ul')({
25
7
  margin: 0,
26
8
  maxHeight: 200,
27
9
  boxSizing: 'border-box',
28
10
  overflowY: 'auto',
29
- padding: space.xxs + " 0",
11
+ padding: `${space.xxs} 0`,
30
12
  });
31
- var AccessibleHide = styled('span')(accessibleHide);
32
- export var AutocompleteList = function (_a) {
33
- var autocompleteItems = _a.autocompleteItems, comboboxId = _a.comboboxId, selectedIndex = _a.selectedIndex, handleAutocompleteClick = _a.handleAutocompleteClick, labelId = _a.labelId, showGroupText = _a.showGroupText;
34
- var randomComponentId = useState(generateUniqueId)[0]; // https://codesandbox.io/s/p2ndq
35
- var componentId = comboboxId || randomComponentId;
36
- var listBoxProps = {
13
+ const AccessibleHide = styled('span')(accessibleHide);
14
+ export const AutocompleteList = ({ autocompleteItems, comboboxId, selectedIndex, handleAutocompleteClick, labelId, showGroupText, }) => {
15
+ const [randomComponentId] = useState(generateUniqueId); // https://codesandbox.io/s/p2ndq
16
+ const componentId = comboboxId || randomComponentId;
17
+ const listBoxProps = {
37
18
  role: 'listbox',
38
- id: componentId + "-" + listBoxIdPart,
19
+ id: `${componentId}-${listBoxIdPart}`,
39
20
  'aria-labelledby': labelId,
40
21
  };
41
- var createListItem = function (listboxItem, itemIndex, groupMessage) {
42
- var children = __spreadArrays([
43
- React.createElement(AccessibleHide, { key: "group-message-" + itemIndex }, groupMessage)
44
- ], React.Children.toArray(listboxItem.props.children));
22
+ const createListItem = (listboxItem, itemIndex, groupMessage) => {
23
+ const children = [
24
+ React.createElement(AccessibleHide, { key: `group-message-${itemIndex}` }, groupMessage),
25
+ ...React.Children.toArray(listboxItem.props.children),
26
+ ];
45
27
  return (React.createElement(Fragment, { key: itemIndex }, React.cloneElement(listboxItem, {
46
28
  children: children,
47
29
  id: getOptionId(componentId, itemIndex),
48
30
  role: 'option',
49
31
  isFocused: selectedIndex === itemIndex,
50
32
  'aria-selected': selectedIndex === itemIndex ? true : undefined,
51
- onMouseDown: function (event) {
33
+ onMouseDown: (event) => {
52
34
  // prevent focus from shifting away from the the combobox
53
35
  event.preventDefault();
54
36
  },
55
- onClick: function (event) {
37
+ onClick: (event) => {
56
38
  event.preventDefault();
57
39
  handleAutocompleteClick(event, listboxItem.props);
58
40
  },
@@ -62,29 +44,26 @@ export var AutocompleteList = function (_a) {
62
44
  return null;
63
45
  }
64
46
  else if (autocompleteItems[0].hasOwnProperty('header')) {
65
- var itemIndex_1 = 0;
66
- return (React.createElement(Autocomplete, __assign({}, listBoxProps), autocompleteItems.map(function (_a, groupIndex) {
67
- var header = _a.header, items = _a.items;
68
- var groupLabel = "itemGroup-" + componentId + "-" + groupIndex;
47
+ let itemIndex = 0;
48
+ return (React.createElement(Autocomplete, Object.assign({}, listBoxProps), autocompleteItems.map(({ header, items }, groupIndex) => {
49
+ const groupLabel = `itemGroup-${componentId}-${groupIndex}`;
69
50
  return (React.createElement(Fragment, { key: groupLabel },
70
51
  React.cloneElement(header, {
71
52
  role: 'presentation',
72
- style: { pointerEvents: "none" },
53
+ style: { pointerEvents: `none` },
73
54
  }),
74
- items.map(function (listboxItem) {
75
- var headerName = getTextFromElement(header);
76
- var groupMessage = showGroupText
77
- ? "Entering group " + headerName + ", with " + items.length + " options."
55
+ items.map((listboxItem) => {
56
+ const headerName = getTextFromElement(header);
57
+ const groupMessage = showGroupText
58
+ ? `Entering group ${headerName}, with ${items.length} options.`
78
59
  : undefined;
79
- var item = createListItem(listboxItem, itemIndex_1, groupMessage);
80
- itemIndex_1++;
60
+ const item = createListItem(listboxItem, itemIndex, groupMessage);
61
+ itemIndex++;
81
62
  return item;
82
63
  })));
83
64
  })));
84
65
  }
85
66
  else {
86
- return (React.createElement(Autocomplete, __assign({}, listBoxProps), autocompleteItems.map(function (listboxItem, index) {
87
- return createListItem(listboxItem, index);
88
- })));
67
+ return (React.createElement(Autocomplete, Object.assign({}, listBoxProps), autocompleteItems.map((listboxItem, index) => createListItem(listboxItem, index))));
89
68
  }
90
69
  };