@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
@@ -1,25 +1,3 @@
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 __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
1
  import React, { useEffect, useLayoutEffect, useRef, useState, useCallback } from 'react';
24
2
  import { jsx, keyframes } from '@emotion/react';
25
3
  import { useForkRef, styled, useIsRTL, useUniqueId, } from '@workday/canvas-kit-react/common';
@@ -28,22 +6,19 @@ import { Card } from '@workday/canvas-kit-react/card';
28
6
  import { TertiaryButton } from '@workday/canvas-kit-react/button';
29
7
  import { xSmallIcon } from '@workday/canvas-system-icons-web';
30
8
  import flatten from 'lodash.flatten';
31
- import AutocompleteList from './AutocompleteList';
32
- import Status from './Status';
33
- var Container = styled('div')({
9
+ import { AutocompleteList } from './AutocompleteList';
10
+ import { Status } from './Status';
11
+ const Container = styled('div')({
34
12
  display: 'inline-block',
35
- }, function (_a) {
36
- var grow = _a.grow;
37
- return ({
38
- width: grow ? '100%' : 'auto',
39
- });
40
- });
41
- var InputContainer = styled('div')({
42
- display: "flex",
43
- alignItems: "center",
13
+ }, ({ grow }) => ({
14
+ width: grow ? '100%' : 'auto',
15
+ }));
16
+ const InputContainer = styled('div')({
17
+ display: `flex`,
18
+ alignItems: `center`,
44
19
  position: 'relative',
45
20
  });
46
- var fadeInKeyframes = keyframes({
21
+ const fadeInKeyframes = keyframes({
47
22
  '0%': {
48
23
  opacity: 0,
49
24
  },
@@ -51,46 +26,41 @@ var fadeInKeyframes = keyframes({
51
26
  opacity: 1,
52
27
  },
53
28
  });
54
- var MenuContainer = styled(Card)({
29
+ const MenuContainer = styled(Card)({
55
30
  position: 'absolute',
56
31
  zIndex: 1,
57
32
  left: 0,
58
33
  top: '100%',
59
34
  borderRadius: borderRadius.m,
60
35
  background: commonColors.background,
61
- border: "none",
62
- marginTop: "-" + borderRadius.m,
36
+ border: `none`,
37
+ marginTop: `-${borderRadius.m}`,
63
38
  width: '100%',
64
39
  minWidth: 0,
65
- animation: fadeInKeyframes + " 200ms ease-out",
40
+ animation: `${fadeInKeyframes} 200ms ease-out`,
66
41
  maxHeight: 200,
67
42
  overflow: 'hidden',
68
43
  });
69
- var ResetButton = styled(TertiaryButton)({
44
+ const ResetButton = styled(TertiaryButton)({
70
45
  position: 'absolute',
71
- margin: "auto " + space.xxxs,
46
+ margin: `auto ${space.xxxs}`,
72
47
  top: 0,
73
48
  bottom: 0,
74
49
  right: 0,
75
50
  padding: 0,
76
51
  zIndex: 2,
77
52
  transition: 'opacity 120ms',
78
- }, function (_a) {
79
- var shouldShow = _a.shouldShow;
80
- return ({
81
- visibility: shouldShow ? 'visible' : 'hidden',
82
- opacity: shouldShow ? 1 : 0,
83
- });
84
- });
85
- export var listBoxIdPart = "listbox";
86
- var optionIdPart = "option";
87
- export var getOptionId = function (baseId, index) {
88
- return baseId + "-" + optionIdPart + "-" + index;
89
- };
90
- export var getTextFromElement = function (children) {
91
- var text = '';
92
- React.Children.map(children, function (child) {
93
- if (child == null || typeof child === 'boolean' || child === {}) {
53
+ }, ({ shouldShow }) => ({
54
+ visibility: shouldShow ? 'visible' : 'hidden',
55
+ opacity: shouldShow ? 1 : 0,
56
+ }));
57
+ export const listBoxIdPart = `listbox`;
58
+ const optionIdPart = `option`;
59
+ export const getOptionId = (baseId, index) => `${baseId}-${optionIdPart}-${index}`;
60
+ export const getTextFromElement = (children) => {
61
+ let text = '';
62
+ React.Children.map(children, child => {
63
+ if (child == null || typeof child === 'boolean') {
94
64
  text += '';
95
65
  }
96
66
  else if (typeof child === 'string' || typeof child === 'number') {
@@ -105,89 +75,88 @@ export var getTextFromElement = function (children) {
105
75
  });
106
76
  return text;
107
77
  };
108
- var buildStatusString = function (listCount) {
109
- return "There " + (listCount === 1 ? 'is' : 'are') + " " + listCount + " suggestion" + (listCount === 1 ? '' : 's') + ".";
78
+ const buildStatusString = (listCount) => {
79
+ return `There ${listCount === 1 ? 'is' : 'are'} ${listCount} suggestion${listCount === 1 ? '' : 's'}.`;
110
80
  };
111
- var isValidSingleChild = function (child) {
81
+ const isValidSingleChild = (child) => {
112
82
  return React.isValidElement(child) && React.Children.only(child);
113
83
  };
114
- var Combobox = function (_a) {
115
- var autocompleteItems = _a.autocompleteItems, children = _a.children, grow = _a.grow, initialValue = _a.initialValue, onChange = _a.onChange, onFocus = _a.onFocus, onBlur = _a.onBlur, showClearButton = _a.showClearButton, _b = _a.clearButtonVariant, clearButtonVariant = _b === void 0 ? undefined : _b, _c = _a.clearButtonAriaLabel, clearButtonAriaLabel = _c === void 0 ? "Reset Search Input" : _c, labelId = _a.labelId, _d = _a.getStatusText, getStatusText = _d === void 0 ? buildStatusString : _d, id = _a.id, elemProps = __rest(_a, ["autocompleteItems", "children", "grow", "initialValue", "onChange", "onFocus", "onBlur", "showClearButton", "clearButtonVariant", "clearButtonAriaLabel", "labelId", "getStatusText", "id"]);
116
- var _e = useState(false), isOpened = _e[0], setIsOpened = _e[1];
117
- var _f = useState(''), value = _f[0], _setValue = _f[1]; // Don't call _setValue directly instead call setInputValue to make sure onChange fires correctly
118
- var _g = useState(false), showingAutocomplete = _g[0], setShowingAutocomplete = _g[1];
119
- var _h = useState(null), selectedAutocompleteIndex = _h[0], setSelectedAutocompleteIndex = _h[1];
120
- var _j = useState([]), interactiveAutocompleteItems = _j[0], setInteractiveAutocompleteItems = _j[1];
121
- var _k = useState(''), announcementText = _k[0], setAnnouncementText = _k[1];
84
+ export const Combobox = ({ autocompleteItems, children, grow, initialValue, onChange, onFocus, onBlur, showClearButton, clearButtonVariant = undefined, clearButtonAriaLabel = `Reset Search Input`, labelId, getStatusText = buildStatusString, id, ...elemProps }) => {
85
+ const [isOpened, setIsOpened] = useState(false);
86
+ const [value, _setValue] = useState(''); // Don't call _setValue directly instead call setInputValue to make sure onChange fires correctly
87
+ const [showingAutocomplete, setShowingAutocomplete] = useState(false);
88
+ const [selectedAutocompleteIndex, setSelectedAutocompleteIndex] = useState(null);
89
+ const [interactiveAutocompleteItems, setInteractiveAutocompleteItems] = useState([]);
90
+ const [announcementText, setAnnouncementText] = useState('');
122
91
  // Create a ref to the soon-to-be-created TextInput clone for internal use.
123
92
  // Use useForkRef to combine it with the ref already assigned to the original
124
93
  // TextInput (if it exists) to create a single callback ref which can be
125
94
  // forwarded to the TextInput clone.
126
- var inputRef = useRef(null);
95
+ const inputRef = useRef(null);
127
96
  // We need access to the original TextInput's ref _property_ (not prop) so we
128
97
  // can combine it with the internal inputRef using useForkRef. ref isn't
129
98
  // listed in the ReactElement interface, but it's there, so we cast children
130
99
  // to satisfy TS.
131
- var elementRef = useForkRef(children.ref, inputRef);
132
- var comboboxRef = useRef(null);
133
- var randomComponentId = useUniqueId();
134
- var randomLabelId = useUniqueId();
135
- var componentId = id || randomComponentId;
136
- var formLabelId = labelId || randomLabelId;
137
- var _l = useState(false), showGroupText = _l[0], setShowGroupText = _l[1];
100
+ const elementRef = useForkRef(children.ref, inputRef);
101
+ const comboboxRef = useRef(null);
102
+ const randomComponentId = useUniqueId();
103
+ const randomLabelId = useUniqueId();
104
+ const componentId = id || randomComponentId;
105
+ const formLabelId = labelId || randomLabelId;
106
+ const [showGroupText, setShowGroupText] = useState(false);
138
107
  // We're using LayoutEffect here because of an issue with the Synthetic event system and typing a key
139
108
  // after the listbox has been closed. Somehow the key is ignored unless we use `useLayoutEffect`
140
- useLayoutEffect(function () {
141
- var shouldShow = interactiveAutocompleteItems.length > 0 && isOpened;
109
+ useLayoutEffect(() => {
110
+ const shouldShow = interactiveAutocompleteItems.length > 0 && isOpened;
142
111
  setShowingAutocomplete(shouldShow);
143
112
  if (shouldShow) {
144
113
  setAnnouncementText(getStatusText(interactiveAutocompleteItems.length));
145
114
  }
146
115
  }, [getStatusText, interactiveAutocompleteItems, isOpened]);
147
116
  // Used to set the position of the reset button and the padding direction inside the input container
148
- var isRTL = useIsRTL();
149
- var setInputValue = useCallback(function (newValue) {
117
+ const isRTL = useIsRTL();
118
+ const setInputValue = useCallback((newValue) => {
150
119
  _setValue(newValue);
151
- var inputDomElement = inputRef.current;
120
+ const inputDomElement = inputRef.current;
152
121
  // Changing value prop programmatically doesn't fire an Synthetic event or trigger native onChange.
153
122
  // We can not just update .value= in setState because React library overrides input value setter
154
123
  // but we can call the function directly on the input as context.
155
124
  // This will cause onChange events to fire no matter how value is updated.
156
125
  if (inputDomElement) {
157
- var nativeInputValue = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(inputDomElement), 'value');
126
+ const nativeInputValue = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(inputDomElement), 'value');
158
127
  if (nativeInputValue && nativeInputValue.set) {
159
128
  nativeInputValue.set.call(inputDomElement, newValue);
160
129
  }
161
- var event_1;
130
+ let event;
162
131
  if (typeof Event === 'function') {
163
132
  // modern browsers
164
- event_1 = new Event('input', { bubbles: true });
133
+ event = new Event('input', { bubbles: true });
165
134
  }
166
135
  else {
167
136
  // IE 11
168
- event_1 = document.createEvent('Event');
169
- event_1.initEvent('input', true, true);
137
+ event = document.createEvent('Event');
138
+ event.initEvent('input', true, true);
170
139
  }
171
- inputDomElement.dispatchEvent(event_1);
140
+ inputDomElement.dispatchEvent(event);
172
141
  }
173
142
  }, [inputRef]);
174
- useEffect(function () {
143
+ useEffect(() => {
175
144
  if (initialValue !== null && initialValue !== undefined) {
176
145
  setInputValue(initialValue);
177
146
  }
178
147
  }, [initialValue, setInputValue]);
179
- useEffect(function () {
180
- var getInteractiveAutocompleteItems = function () {
148
+ useEffect(() => {
149
+ const getInteractiveAutocompleteItems = () => {
181
150
  if (autocompleteItems &&
182
151
  autocompleteItems.length &&
183
152
  autocompleteItems[0].hasOwnProperty('header')) {
184
- return flatten(autocompleteItems.map(function (group) { return group.items; }));
153
+ return flatten(autocompleteItems.map(group => group.items));
185
154
  }
186
155
  return autocompleteItems || [];
187
156
  };
188
157
  setInteractiveAutocompleteItems(getInteractiveAutocompleteItems());
189
158
  }, [autocompleteItems]);
190
- var handleAutocompleteClick = function (event, menuItemProps) {
159
+ const handleAutocompleteClick = (event, menuItemProps) => {
191
160
  if (menuItemProps.isDisabled) {
192
161
  return;
193
162
  }
@@ -198,29 +167,25 @@ var Combobox = function (_a) {
198
167
  menuItemProps.onClick(event);
199
168
  }
200
169
  };
201
- var focusInput = function () {
170
+ const focusInput = () => {
202
171
  if (inputRef.current) {
203
172
  inputRef.current.focus();
204
173
  }
205
174
  };
206
- var handleClick = function (event) {
175
+ const handleClick = (event) => {
207
176
  if (!showingAutocomplete) {
208
177
  setShowingAutocomplete(true);
209
178
  }
210
179
  };
211
- var handleFocus = function (event) {
180
+ const handleFocus = (event) => {
212
181
  setIsOpened(true);
213
182
  if (onFocus) {
214
183
  onFocus(event);
215
184
  }
216
185
  };
217
- var handleBlur = function (event) {
186
+ const handleBlur = (event) => {
218
187
  if (comboboxRef.current) {
219
- var target = event.relatedTarget;
220
- if (target === null) {
221
- // IE11 swaps related and active target before it fires the blur event
222
- target = document.activeElement;
223
- }
188
+ const target = event.relatedTarget;
224
189
  if (target && comboboxRef.current.contains(target)) {
225
190
  return;
226
191
  }
@@ -230,45 +195,45 @@ var Combobox = function (_a) {
230
195
  onBlur(event);
231
196
  }
232
197
  };
233
- var resetSearchInput = function () {
198
+ const resetSearchInput = () => {
234
199
  setInputValue('');
235
200
  focusInput();
236
201
  };
237
- var getGroupIndex = function (itemIndex) {
202
+ const getGroupIndex = (itemIndex) => {
238
203
  if (itemIndex != null &&
239
204
  autocompleteItems &&
240
205
  autocompleteItems.length &&
241
206
  autocompleteItems[0].hasOwnProperty('header')) {
242
- var count_1 = 0;
243
- return autocompleteItems.findIndex(function (groups) {
244
- count_1 += groups.items.length;
245
- return count_1 > itemIndex;
207
+ let count = 0;
208
+ return autocompleteItems.findIndex(groups => {
209
+ count += groups.items.length;
210
+ return count > itemIndex;
246
211
  });
247
212
  }
248
213
  else {
249
214
  return -1;
250
215
  }
251
216
  };
252
- var handleKeyboardShortcuts = function (event) {
217
+ const handleKeyboardShortcuts = (event) => {
253
218
  if (event.ctrlKey || event.altKey || event.metaKey || !interactiveAutocompleteItems.length) {
254
219
  return;
255
220
  }
256
- var autoCompleteItemCount = interactiveAutocompleteItems.length;
257
- var firstItem = 0;
258
- var lastItem = autoCompleteItemCount - 1;
259
- var nextIndex = null;
221
+ const autoCompleteItemCount = interactiveAutocompleteItems.length;
222
+ const firstItem = 0;
223
+ const lastItem = autoCompleteItemCount - 1;
224
+ let nextIndex = null;
260
225
  setIsOpened(true);
261
226
  switch (event.key) {
262
227
  case 'ArrowUp':
263
228
  case 'Up': // IE/Edge specific value
264
- var upIndex = selectedAutocompleteIndex !== null ? selectedAutocompleteIndex - 1 : lastItem;
229
+ const upIndex = selectedAutocompleteIndex !== null ? selectedAutocompleteIndex - 1 : lastItem;
265
230
  nextIndex = upIndex < 0 ? lastItem : upIndex;
266
231
  event.stopPropagation();
267
232
  event.preventDefault();
268
233
  break;
269
234
  case 'ArrowDown':
270
235
  case 'Down': // IE/Edge specific value
271
- var downIndex = selectedAutocompleteIndex !== null ? selectedAutocompleteIndex + 1 : firstItem;
236
+ const downIndex = selectedAutocompleteIndex !== null ? selectedAutocompleteIndex + 1 : firstItem;
272
237
  nextIndex = downIndex >= autoCompleteItemCount ? firstItem : downIndex;
273
238
  event.stopPropagation();
274
239
  event.preventDefault();
@@ -279,7 +244,7 @@ var Combobox = function (_a) {
279
244
  break;
280
245
  case 'Enter':
281
246
  if (selectedAutocompleteIndex != null) {
282
- var item = interactiveAutocompleteItems[selectedAutocompleteIndex];
247
+ const item = interactiveAutocompleteItems[selectedAutocompleteIndex];
283
248
  handleAutocompleteClick(event, item.props);
284
249
  if (item.props.isDisabled) {
285
250
  nextIndex = selectedAutocompleteIndex;
@@ -290,25 +255,27 @@ var Combobox = function (_a) {
290
255
  break;
291
256
  default:
292
257
  }
293
- var lastGroupIndex = getGroupIndex(selectedAutocompleteIndex);
294
- var nextGroupIndex = getGroupIndex(nextIndex);
258
+ const lastGroupIndex = getGroupIndex(selectedAutocompleteIndex);
259
+ const nextGroupIndex = getGroupIndex(nextIndex);
295
260
  setShowGroupText(lastGroupIndex !== nextGroupIndex);
296
261
  setSelectedAutocompleteIndex(nextIndex);
297
262
  };
298
- var handleSearchInputChange = function (event) {
263
+ const handleSearchInputChange = (event) => {
299
264
  if (onChange) {
300
265
  onChange(event);
301
266
  }
302
267
  _setValue(event.target.value); // Calling set value directly only for on change event
303
268
  };
304
- var renderChildren = function (inputElement) {
305
- var _a;
306
- var cssOverride = { zIndex: 2 };
269
+ const renderChildren = (inputElement) => {
270
+ let cssOverride = { ':focus': { zIndex: 2 } };
307
271
  if (showClearButton) {
308
- var paddingDirection = isRTL ? 'paddingLeft' : 'paddingRight';
309
- cssOverride = __assign(__assign({}, cssOverride), (_a = {}, _a[paddingDirection] = space.xl, _a));
272
+ const paddingDirection = isRTL ? 'paddingLeft' : 'paddingRight';
273
+ cssOverride = {
274
+ ...cssOverride,
275
+ [paddingDirection]: space.xl,
276
+ };
310
277
  }
311
- var newTextInputProps = {
278
+ const newTextInputProps = {
312
279
  type: 'text',
313
280
  id: componentId,
314
281
  grow: grow,
@@ -325,16 +292,17 @@ var Combobox = function (_a) {
325
292
  onBlur: handleBlur,
326
293
  css: cssOverride,
327
294
  role: 'combobox',
328
- 'aria-owns': showingAutocomplete ? componentId + "-" + listBoxIdPart : undefined,
295
+ 'aria-owns': showingAutocomplete ? `${componentId}-${listBoxIdPart}` : undefined,
329
296
  'aria-haspopup': true,
330
297
  'aria-expanded': showingAutocomplete,
331
298
  };
332
- var cloneElement = function (element, props) {
333
- return jsx(element.type, __assign(__assign({}, element.props), props));
334
- };
335
- return cloneElement(inputElement, __assign(__assign({}, inputElement.props), newTextInputProps));
299
+ const cloneElement = (element, props) => jsx(element.type, {
300
+ ...element.props,
301
+ ...props,
302
+ });
303
+ return cloneElement(inputElement, { ...inputElement.props, ...newTextInputProps });
336
304
  };
337
- return (React.createElement(Container, __assign({ grow: grow }, elemProps),
305
+ return (React.createElement(Container, Object.assign({ grow: grow }, elemProps),
338
306
  React.createElement(InputContainer, { ref: comboboxRef },
339
307
  isValidSingleChild(children) && React.Children.map(children, renderChildren),
340
308
  showClearButton && (React.createElement(ResetButton, { shouldShow: !!value, "aria-label": clearButtonAriaLabel, icon: xSmallIcon, variant: clearButtonVariant, onClick: resetSearchInput, onBlur: handleBlur, size: "small", type: "button" })),
@@ -343,4 +311,3 @@ var Combobox = function (_a) {
343
311
  React.createElement(AutocompleteList, { comboboxId: componentId, autocompleteItems: autocompleteItems, selectedIndex: selectedAutocompleteIndex, handleAutocompleteClick: handleAutocompleteClick, labelId: formLabelId, showGroupText: showGroupText }))))),
344
312
  React.createElement(Status, { announcementText: announcementText })));
345
313
  };
346
- export default Combobox;
@@ -6,6 +6,5 @@ export interface StatusProps {
6
6
  expireMilliseconds?: number;
7
7
  announcementText?: string;
8
8
  }
9
- declare const Status: ({ ariaLive, role, ariaRelevant, expireMilliseconds, announcementText, ariaAtomic, }: StatusProps) => JSX.Element;
10
- export default Status;
9
+ export declare const Status: ({ ariaLive, role, ariaRelevant, expireMilliseconds, announcementText, ariaAtomic, }: StatusProps) => JSX.Element;
11
10
  //# sourceMappingURL=Status.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Status.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/Status.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAC;IAC1C,IAAI,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,CAAC;IACxE,YAAY,CAAC,EAAE,WAAW,GAAG,gBAAgB,GAAG,KAAK,GAAG,UAAU,GAAG,MAAM,CAAC;IAC5E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAID,QAAA,MAAM,MAAM,wFAOT,WAAW,gBAuBb,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Status.d.ts","sourceRoot":"","sources":["../../../../combobox/lib/Status.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,KAAK,CAAC;IAC1C,IAAI,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,aAAa,GAAG,SAAS,GAAG,OAAO,CAAC;IACxE,YAAY,CAAC,EAAE,WAAW,GAAG,gBAAgB,GAAG,KAAK,GAAG,UAAU,GAAG,MAAM,CAAC;IAC5E,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAID,eAAO,MAAM,MAAM,wFAOhB,WAAW,gBAuBb,CAAC"}
@@ -1,20 +1,18 @@
1
1
  import React, { useState, useEffect } from 'react';
2
2
  import styled from '@emotion/styled';
3
3
  import { accessibleHide } from '@workday/canvas-kit-react/common';
4
- var Container = styled('div')(accessibleHide);
5
- var Status = function (_a) {
6
- var _b = _a.ariaLive, ariaLive = _b === void 0 ? 'polite' : _b, _c = _a.role, role = _c === void 0 ? 'status' : _c, _d = _a.ariaRelevant, ariaRelevant = _d === void 0 ? 'additions' : _d, _e = _a.expireMilliseconds, expireMilliseconds = _e === void 0 ? 500 : _e, _f = _a.announcementText, announcementText = _f === void 0 ? '' : _f, ariaAtomic = _a.ariaAtomic;
7
- var _g = useState(announcementText), displayText = _g[0], setDisplayText = _g[1];
8
- useEffect(function () {
4
+ const Container = styled('div')(accessibleHide);
5
+ export const Status = ({ ariaLive = 'polite', role = 'status', ariaRelevant = 'additions', expireMilliseconds = 500, announcementText = '', ariaAtomic, }) => {
6
+ const [displayText, setDisplayText] = useState(announcementText);
7
+ useEffect(() => {
9
8
  if (!announcementText) {
10
9
  return;
11
10
  }
12
11
  setDisplayText(announcementText);
13
- var clearText = setTimeout(function () { return setDisplayText(''); }, expireMilliseconds);
14
- return function () {
12
+ const clearText = setTimeout(() => setDisplayText(''), expireMilliseconds);
13
+ return () => {
15
14
  clearTimeout(clearText);
16
15
  };
17
16
  }, [announcementText, expireMilliseconds]);
18
17
  return (React.createElement(Container, { "aria-live": ariaLive, role: role, "aria-relevant": ariaRelevant, "aria-atomic": ariaAtomic }, displayText));
19
18
  };
20
- export default Status;
@@ -1,4 +1,2 @@
1
1
  export * from './lib/theming';
2
- export { ComponentStatesTable } from './lib/storybook-utils/ComponentStatesTable';
3
- export { permutateProps } from './lib/storybook-utils/permutateProps';
4
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../common/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAC,oBAAoB,EAAC,MAAM,4CAA4C,CAAC;AAChF,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../common/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
@@ -1,3 +1 @@
1
1
  export * from './lib/theming';
2
- export { ComponentStatesTable } from './lib/storybook-utils/ComponentStatesTable';
3
- export { permutateProps } from './lib/storybook-utils/permutateProps';
@@ -1,3 +1,2 @@
1
1
  export * from './useThemeRTL';
2
- export * from './useThemedRing';
3
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
@@ -1,2 +1 @@
1
1
  export * from './useThemeRTL';
2
- export * from './useThemedRing';
@@ -1,6 +1,9 @@
1
1
  import { CSSProperties } from '@workday/canvas-kit-react/tokens';
2
2
  export declare type ComponentStyles = Record<string, CSSProperties>;
3
3
  /**
4
+ * @deprecated Now that IE11 is no longer supported, we encourage consumers to use [CSS logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties)
5
+ *
6
+ *
4
7
  * A helpful hook for supporting bidirectional styles.
5
8
  * * Read below for more detail or [view the docs](https://github.com/Workday/canvas-kit/blob/master/modules/labs-react/common/README.md#useThemeRTL).
6
9
  *
@@ -1 +1 @@
1
- {"version":3,"file":"useThemeRTL.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/useThemeRTL.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,aAAa,EAAC,MAAM,kCAAkC,CAAC;AAI/D,oBAAY,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAW5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,WAAW;6BAMD,aAAa,EAAE;;EAYxC"}
1
+ {"version":3,"file":"useThemeRTL.d.ts","sourceRoot":"","sources":["../../../../../common/lib/theming/useThemeRTL.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,kCAAkC,CAAC;AAI/D,oBAAY,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAc5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,WAAW;6BAMD,aAAa,EAAE;;EAYxC"}
@@ -1,36 +1,16 @@
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
- import { convertToStaticStates, useIsRTL, useTheme, } from '@workday/canvas-kit-react/common';
1
+ import { useIsRTL, useTheme } from '@workday/canvas-kit-react/common';
20
2
  import { useMemo } from 'react';
21
3
  import rtlCSSJS from 'rtl-css-js';
22
- var getDirectionalStyles = function (isRTL) {
23
- var styles = [];
24
- for (var _i = 1; _i < arguments.length; _i++) {
25
- styles[_i - 1] = arguments[_i];
26
- }
4
+ const getDirectionalStyles = (isRTL, ...styles) => {
27
5
  return isRTL ? rtlCSSJS(styles) : styles;
28
6
  };
29
- var getConvertedStyles = function (shouldConvert, styles) {
30
- var _a;
31
- return shouldConvert ? (_a = convertToStaticStates(styles)) !== null && _a !== void 0 ? _a : styles : styles;
7
+ const getConvertedStyles = (styles, convertFunc) => {
8
+ return convertFunc ? convertFunc(styles) : styles;
32
9
  };
33
10
  /**
11
+ * @deprecated Now that IE11 is no longer supported, we encourage consumers to use [CSS logical properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Logical_Properties)
12
+ *
13
+ *
34
14
  * A helpful hook for supporting bidirectional styles.
35
15
  * * Read below for more detail or [view the docs](https://github.com/Workday/canvas-kit/blob/master/modules/labs-react/common/README.md#useThemeRTL).
36
16
  *
@@ -60,23 +40,18 @@ var getConvertedStyles = function (shouldConvert, styles) {
60
40
  * }
61
41
  */
62
42
  export function useThemeRTL() {
63
- var _a;
64
- var theme = useTheme();
65
- var direction = useIsRTL(theme);
66
- var shouldConvert = (_a = theme.canvas._staticStates) !== null && _a !== void 0 ? _a : false;
67
- var themeRTL = useMemo(function () {
68
- return function () {
69
- var cssObject = [];
70
- for (var _i = 0; _i < arguments.length; _i++) {
71
- cssObject[_i] = arguments[_i];
72
- }
73
- var styles = getDirectionalStyles.apply(void 0, __spreadArrays([direction], cssObject));
74
- return styles.reduce(function (first, second) {
75
- var convertedFirst = shouldConvert ? getConvertedStyles(shouldConvert, first) : first;
76
- var convertedSecond = shouldConvert ? getConvertedStyles(shouldConvert, second) : second;
77
- return __assign(__assign({}, convertedFirst), convertedSecond);
43
+ const theme = useTheme();
44
+ const direction = useIsRTL(theme);
45
+ const convertFunc = theme.canvas._styleRewriteFn;
46
+ const themeRTL = useMemo(() => {
47
+ return (...cssObject) => {
48
+ const styles = getDirectionalStyles(direction, ...cssObject);
49
+ return styles.reduce((first, second) => {
50
+ const convertedFirst = getConvertedStyles(first, convertFunc);
51
+ const convertedSecond = getConvertedStyles(second, convertFunc);
52
+ return { ...convertedFirst, ...convertedSecond };
78
53
  }, {});
79
54
  };
80
- }, [direction, shouldConvert]);
81
- return { themeRTL: themeRTL, theme: theme };
55
+ }, [direction, convertFunc]);
56
+ return { themeRTL, theme };
82
57
  }
@@ -0,0 +1,3 @@
1
+ export * from './lib/Expandable';
2
+ export * from './lib/hooks';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../expandable/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './lib/Expandable';
2
+ export * from './lib/hooks';