@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,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,CAAC;AAG1E,MAAM,WAAW,eAAgB,SAAQ,cAAc,EAAE,KAAK,CAAC,kBAAkB,CAAC,eAAe,CAAC;IAChG;;OAEG;IACH,QAAQ,EAAE,KAAK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,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,38 +1,3 @@
1
- var __extends = (this && this.__extends) || (function () {
2
- var extendStatics = function (d, b) {
3
- extendStatics = Object.setPrototypeOf ||
4
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
6
- return extendStatics(d, b);
7
- };
8
- return function (d, b) {
9
- extendStatics(d, b);
10
- function __() { this.constructor = d; }
11
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
- };
13
- })();
14
- var __assign = (this && this.__assign) || function () {
15
- __assign = Object.assign || function(t) {
16
- for (var s, i = 1, n = arguments.length; i < n; i++) {
17
- s = arguments[i];
18
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
19
- t[p] = s[p];
20
- }
21
- return t;
22
- };
23
- return __assign.apply(this, arguments);
24
- };
25
- var __rest = (this && this.__rest) || function (s, e) {
26
- var t = {};
27
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
- t[p] = s[p];
29
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
- t[p[i]] = s[p[i]];
33
- }
34
- return t;
35
- };
36
1
  import * as React from 'react';
37
2
  import { colors, space, spaceNumbers } from '@workday/canvas-kit-react/tokens';
38
3
  import { styled, generateUniqueId } from '@workday/canvas-kit-react/common';
@@ -54,19 +19,18 @@ function getInputColors(theme, isFocused) {
54
19
  boxShadow: isFocused && theme.boxShadowFocus ? theme.boxShadowFocus : theme.boxShadow,
55
20
  };
56
21
  }
57
- var formCollapsedBackground = colors.frenchVanilla100;
58
- var maxWidth = 480;
59
- var minWidth = 120;
60
- var StyledSearchForm = styled('form')({
22
+ const formCollapsedBackground = colors.frenchVanilla100;
23
+ const maxWidth = 480;
24
+ const minWidth = 120;
25
+ const StyledSearchForm = styled('form')({
61
26
  position: 'relative',
62
- flex: "1 1 auto",
27
+ flexGrow: 1,
63
28
  display: 'flex',
64
29
  alignItems: 'center',
65
30
  marginLeft: space.m,
66
31
  minWidth: minWidth,
67
- }, function (_a) {
68
- var isCollapsed = _a.isCollapsed, showForm = _a.showForm, rightAlign = _a.rightAlign, grow = _a.grow;
69
- var collapseStyles = isCollapsed
32
+ }, ({ isCollapsed, showForm, rightAlign, grow }) => {
33
+ const collapseStyles = isCollapsed
70
34
  ? {
71
35
  top: 0,
72
36
  right: 0,
@@ -82,35 +46,30 @@ var StyledSearchForm = styled('form')({
82
46
  zIndex: 1,
83
47
  }
84
48
  : {};
85
- var rightAlignStyles = rightAlign
49
+ const rightAlignStyles = rightAlign
86
50
  ? {
87
51
  textAlign: 'right',
88
52
  maxWidth: grow ? '100%' : maxWidth,
89
53
  }
90
54
  : {};
91
- return __assign(__assign({}, rightAlignStyles), collapseStyles);
55
+ return { ...rightAlignStyles, ...collapseStyles };
92
56
  });
93
- var SearchContainer = styled('div')({
94
- position: "relative",
57
+ const SearchContainer = styled('div')({
58
+ position: `relative`,
95
59
  display: 'flex',
96
60
  alignItems: 'center',
97
- width: "100%",
61
+ width: `100%`,
98
62
  textAlign: 'left',
99
- }, function (_a) {
100
- var height = _a.height;
101
- return ({
102
- minHeight: height,
103
- height: height,
104
- });
63
+ }, ({ height }) => ({
64
+ minHeight: height,
65
+ }));
66
+ const SearchCombobox = styled(Combobox)({
67
+ width: `100%`,
105
68
  });
106
- var SearchCombobox = styled(Combobox)({
107
- width: "100%",
108
- });
109
- var SearchIcon = styled(TertiaryButton)(function (_a) {
110
- var isCollapsed = _a.isCollapsed, isHidden = _a.isHidden;
69
+ const SearchIcon = styled(TertiaryButton)(({ isCollapsed, isHidden }) => {
111
70
  return {
112
- position: "absolute",
113
- margin: isCollapsed ? "auto " + space.xxs : "auto " + space.xxxs,
71
+ position: `absolute`,
72
+ margin: isCollapsed ? `auto ${space.xxs}` : `auto ${space.xxxs}`,
114
73
  top: 0,
115
74
  bottom: 0,
116
75
  left: 0,
@@ -119,19 +78,25 @@ var SearchIcon = styled(TertiaryButton)(function (_a) {
119
78
  display: isHidden ? 'none' : 'flex',
120
79
  };
121
80
  });
122
- var CloseButton = styled(TertiaryButton)(function (_a) {
123
- var isCollapsed = _a.isCollapsed, showForm = _a.showForm;
124
- var collapseStyles = isCollapsed && showForm
81
+ const CloseButton = styled(TertiaryButton)(({ isCollapsed, showForm }) => {
82
+ const collapseStyles = isCollapsed && showForm
125
83
  ? {
126
84
  display: 'inline-block',
127
85
  }
128
86
  : {
129
87
  display: 'none',
130
88
  };
131
- return __assign({ position: "absolute", top: 0, bottom: 0, right: 0, margin: "auto " + space.xxs, zIndex: 3 }, collapseStyles);
89
+ return {
90
+ position: `absolute`,
91
+ top: 0,
92
+ bottom: 0,
93
+ right: 0,
94
+ margin: `auto ${space.xxs}`,
95
+ zIndex: 3,
96
+ ...collapseStyles,
97
+ };
132
98
  });
133
- var SearchField = styled(FormField)(function (_a) {
134
- var isCollapsed = _a.isCollapsed, showForm = _a.showForm, grow = _a.grow, height = _a.height;
99
+ const SearchField = styled(FormField)(({ isCollapsed, showForm, grow, height }) => {
135
100
  return {
136
101
  display: (isCollapsed && showForm) || !isCollapsed ? 'inline-block' : 'none',
137
102
  width: '100%',
@@ -143,17 +108,15 @@ var SearchField = styled(FormField)(function (_a) {
143
108
  },
144
109
  };
145
110
  });
146
- var SearchInput = styled(TextInput)(function (_a) {
147
- var isCollapsed = _a.isCollapsed, inputColors = _a.inputColors, grow = _a.grow, height = _a.height;
148
- var collapseStyles = isCollapsed
111
+ const SearchInput = styled(TextInput)(({ isCollapsed, inputColors, grow, height }) => {
112
+ const collapseStyles = isCollapsed
149
113
  ? {
150
114
  fontSize: '20px',
151
- lineHeight: '20px',
152
115
  paddingLeft: spaceNumbers.xl + spaceNumbers.s,
153
116
  paddingRight: spaceNumbers.xl + spaceNumbers.s,
154
117
  maxWidth: 'none',
155
118
  minWidth: 0,
156
- backgroundColor: "rgba(0, 0, 0, 0)",
119
+ backgroundColor: `rgba(0, 0, 0, 0)`,
157
120
  height: height,
158
121
  }
159
122
  : {
@@ -164,11 +127,22 @@ var SearchInput = styled(TextInput)(function (_a) {
164
127
  backgroundColor: inputColors.background,
165
128
  height: height,
166
129
  };
167
- 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': {
130
+ return {
131
+ fontSize: '14px',
132
+ boxShadow: inputColors.boxShadow,
133
+ color: inputColors.color,
134
+ border: 'none',
135
+ WebkitAppearance: 'none',
136
+ transition: 'background-color 120ms, color 120ms, box-shadow 200ms, border-color 200ms',
137
+ zIndex: 2,
138
+ width: '100%',
139
+ '&::-webkit-search-cancel-button': {
168
140
  display: 'none',
169
- }, '&::placeholder': {
141
+ },
142
+ '&::placeholder': {
170
143
  color: inputColors.placeholderColor,
171
- }, '&:not([disabled])': {
144
+ },
145
+ '&:not([disabled])': {
172
146
  '&:focus, &:active': {
173
147
  outline: 'none',
174
148
  boxShadow: inputColors.boxShadow,
@@ -176,93 +150,93 @@ var SearchInput = styled(TextInput)(function (_a) {
176
150
  '&:hover': {
177
151
  backgroundColor: inputColors.backgroundHover,
178
152
  },
179
- } }, collapseStyles);
153
+ },
154
+ ...collapseStyles,
155
+ };
180
156
  });
181
- var SearchForm = /** @class */ (function (_super) {
182
- __extends(SearchForm, _super);
183
- function SearchForm() {
184
- var _this = _super !== null && _super.apply(this, arguments) || this;
185
- _this.inputRef = React.createRef();
186
- _this.openRef = React.createRef();
187
- _this.labelId = generateUniqueId();
188
- _this.state = {
157
+ export class SearchForm extends React.Component {
158
+ constructor() {
159
+ super(...arguments);
160
+ this.inputRef = React.createRef();
161
+ this.openRef = React.createRef();
162
+ this.defaultLabelId = generateUniqueId();
163
+ this.state = {
189
164
  showForm: false,
190
165
  searchQuery: '',
191
166
  isFocused: false,
192
167
  };
193
- _this.getTheme = function () {
194
- var theme;
195
- if (typeof _this.props.searchTheme === 'number') {
196
- theme = searchThemes[_this.props.searchTheme];
168
+ this.getTheme = () => {
169
+ let theme;
170
+ if (typeof this.props.searchTheme === 'number') {
171
+ theme = searchThemes[this.props.searchTheme];
197
172
  }
198
- else if (_this.props.searchTheme) {
199
- theme = _this.props.searchTheme;
173
+ else if (this.props.searchTheme) {
174
+ theme = this.props.searchTheme;
200
175
  }
201
176
  else {
202
177
  theme = searchThemes[SearchTheme.Light];
203
178
  }
204
179
  return theme;
205
180
  };
206
- _this.getThemeColors = function () {
207
- var theme = _this.props.isCollapsed && _this.state.showForm
181
+ this.getThemeColors = () => {
182
+ const theme = this.props.isCollapsed && this.state.showForm
208
183
  ? searchThemes[SearchTheme.Transparent]
209
- : _this.getTheme();
210
- return getInputColors(theme, _this.state.isFocused);
184
+ : this.getTheme();
185
+ return getInputColors(theme, this.state.isFocused);
211
186
  };
212
- _this.getIconButtonType = function () {
213
- var background = _this.getThemeColors().background || "#fff";
214
- if (_this.props.isCollapsed && _this.state.showForm) {
187
+ this.getIconButtonType = () => {
188
+ let background = this.getThemeColors().background || `#fff`;
189
+ if (this.props.isCollapsed && this.state.showForm) {
215
190
  background = formCollapsedBackground;
216
191
  }
217
- var isDarkBackground = chroma(background).get('lab.l') < 70;
192
+ const isDarkBackground = chroma(background).get('lab.l') < 70;
218
193
  return isDarkBackground ? 'inverse' : undefined;
219
194
  };
220
- _this.handleSubmit = function (event) {
195
+ this.handleSubmit = (event) => {
221
196
  event.preventDefault();
222
- if (_this.props.allowEmptyStringSearch || _this.state.searchQuery.trim()) {
223
- _this.props.onSubmit(event);
197
+ if (this.props.allowEmptyStringSearch || this.state.searchQuery.trim()) {
198
+ this.props.onSubmit(event);
224
199
  }
225
200
  else {
226
- _this.focusInput();
201
+ this.focusInput();
227
202
  }
228
203
  };
229
- _this.openCollapsedSearch = function () {
230
- if (_this.props.isCollapsed && !_this.state.showForm) {
231
- _this.setState({ showForm: true });
204
+ this.openCollapsedSearch = () => {
205
+ if (this.props.isCollapsed && !this.state.showForm) {
206
+ this.setState({ showForm: true });
232
207
  }
233
208
  };
234
- _this.closeCollapsedSearch = function () {
235
- if (_this.props.isCollapsed && _this.state.showForm) {
236
- _this.setState({ showForm: false });
209
+ this.closeCollapsedSearch = () => {
210
+ if (this.props.isCollapsed && this.state.showForm) {
211
+ this.setState({ showForm: false });
237
212
  }
238
213
  };
239
- _this.focusInput = function () {
240
- if (_this.inputRef.current) {
241
- _this.inputRef.current.focus();
214
+ this.focusInput = () => {
215
+ if (this.inputRef.current) {
216
+ this.inputRef.current.focus();
242
217
  }
243
218
  };
244
- _this.focusOpen = function () {
245
- if (_this.openRef.current) {
246
- _this.openRef.current.focus();
219
+ this.focusOpen = () => {
220
+ if (this.openRef.current) {
221
+ this.openRef.current.focus();
247
222
  }
248
223
  };
249
- _this.handleFocus = function () {
250
- _this.setState({ isFocused: true });
224
+ this.handleFocus = () => {
225
+ this.setState({ isFocused: true });
251
226
  };
252
- _this.handleBlur = function () {
253
- _this.setState({ isFocused: false });
227
+ this.handleBlur = () => {
228
+ this.setState({ isFocused: false });
254
229
  };
255
- _this.handleSearchInputChange = function (event) {
230
+ this.handleSearchInputChange = (event) => {
256
231
  event.preventDefault();
257
- _this.setState({ searchQuery: event.target.value });
258
- if (_this.props.onInputChange) {
259
- _this.props.onInputChange(event);
232
+ this.setState({ searchQuery: event.target.value });
233
+ if (this.props.onInputChange) {
234
+ this.props.onInputChange(event);
260
235
  }
261
236
  };
262
- return _this;
263
237
  }
264
- SearchForm.prototype.componentDidUpdate = function (prevProps, prevState) {
265
- var showFormToggled = this.state.showForm !== prevState.showForm;
238
+ componentDidUpdate(prevProps, prevState) {
239
+ const showFormToggled = this.state.showForm !== prevState.showForm;
266
240
  if (showFormToggled) {
267
241
  if (this.state.showForm) {
268
242
  this.focusInput();
@@ -271,19 +245,17 @@ var SearchForm = /** @class */ (function (_super) {
271
245
  this.focusOpen();
272
246
  }
273
247
  }
274
- };
275
- SearchForm.prototype.render = function () {
276
- var _a = this.props, _b = _a.clearButtonAriaLabel, clearButtonAriaLabel = _b === void 0 ? 'Reset Search Form' : _b, _c = _a.placeholder, placeholder = _c === void 0 ? 'Search' : _c, _d = _a.inputLabel, inputLabel = _d === void 0 ? 'Search' : _d, _e = _a.submitAriaLabel, submitAriaLabel = _e === void 0 ? 'Search' : _e, _f = _a.openButtonAriaLabel, openButtonAriaLabel = _f === void 0 ? 'Open Search' : _f, _g = _a.closeButtonAriaLabel, closeButtonAriaLabel = _g === void 0 ? 'Cancel' : _g, _h = _a.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"]);
277
- 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),
248
+ }
249
+ render() {
250
+ 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;
251
+ 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),
278
252
  React.createElement(SearchContainer, { height: height },
279
253
  React.createElement(SearchIcon, { "aria-label": submitAriaLabel, icon: searchIcon, isCollapsed: isCollapsed, variant: this.getIconButtonType(), type: "submit", isHidden: !!isCollapsed && !this.state.showForm }),
280
254
  React.createElement(SearchIcon, { "aria-label": openButtonAriaLabel, icon: searchIcon, isCollapsed: isCollapsed, variant: this.getIconButtonType(), onClick: this.openCollapsedSearch, ref: this.openRef, type: "button", isHidden: !isCollapsed || (!!isCollapsed && this.state.showForm) }),
281
- React.createElement(SearchField, { grow: grow, id: this.labelId, inputId: "input-" + this.labelId, label: inputLabel, labelPosition: FormFieldLabelPosition.Hidden, useFieldset: false, isCollapsed: isCollapsed, showForm: this.state.showForm, height: height },
282
- React.createElement(SearchCombobox, { initialValue: initialValue, clearButtonVariant: this.getIconButtonType(), autocompleteItems: autocompleteItems, onChange: this.handleSearchInputChange, onFocus: this.handleFocus, onBlur: this.handleBlur, showClearButton: !isCollapsed && showClearButton, clearButtonAriaLabel: clearButtonAriaLabel, labelId: this.labelId },
255
+ React.createElement(SearchField, { grow: grow, id: labelId, inputId: `input-${labelId}`, label: inputLabel, labelPosition: FormFieldLabelPosition.Hidden, useFieldset: false, isCollapsed: isCollapsed, showForm: this.state.showForm, height: height },
256
+ React.createElement(SearchCombobox, { initialValue: initialValue, clearButtonVariant: this.getIconButtonType(), autocompleteItems: autocompleteItems, onChange: this.handleSearchInputChange, onFocus: this.handleFocus, onBlur: this.handleBlur, showClearButton: !isCollapsed && showClearButton, clearButtonAriaLabel: clearButtonAriaLabel, labelId: labelId },
283
257
  React.createElement(SearchInput, { ref: this.inputRef, value: this.state.searchQuery, placeholder: placeholder, isCollapsed: isCollapsed, inputColors: this.getThemeColors(), height: height, name: "search", autoComplete: "off" }))),
284
258
  React.createElement(CloseButton, { "aria-label": closeButtonAriaLabel, icon: xIcon, isCollapsed: isCollapsed, showForm: this.state.showForm, onClick: this.closeCollapsedSearch, type: "button" }))));
285
- };
286
- SearchForm.Theme = SearchTheme;
287
- return SearchForm;
288
- }(React.Component));
289
- export { SearchForm };
259
+ }
260
+ }
261
+ SearchForm.Theme = SearchTheme;
@@ -1,4 +1,3 @@
1
- var _a;
2
1
  import { focusRing } from '@workday/canvas-kit-react/common';
3
2
  import { colors } from '@workday/canvas-kit-react/tokens';
4
3
  export var SearchTheme;
@@ -7,8 +6,8 @@ export var SearchTheme;
7
6
  SearchTheme[SearchTheme["Dark"] = 1] = "Dark";
8
7
  SearchTheme[SearchTheme["Transparent"] = 2] = "Transparent";
9
8
  })(SearchTheme || (SearchTheme = {}));
10
- export var searchThemes = (_a = {},
11
- _a[SearchTheme.Transparent] = {
9
+ export const searchThemes = {
10
+ [SearchTheme.Transparent]: {
12
11
  background: 'rgba(0, 0, 0, 0)',
13
12
  backgroundFocus: 'rgba(0, 0, 0, 0)',
14
13
  color: colors.blackPepper300,
@@ -18,7 +17,7 @@ export var searchThemes = (_a = {},
18
17
  boxShadow: 'none',
19
18
  boxShadowFocus: 'none',
20
19
  },
21
- _a[SearchTheme.Light] = {
20
+ [SearchTheme.Light]: {
22
21
  background: colors.soap200,
23
22
  backgroundFocus: colors.soap200,
24
23
  backgroundHover: colors.soap300,
@@ -27,7 +26,7 @@ export var searchThemes = (_a = {},
27
26
  boxShadow: 'none',
28
27
  boxShadowFocus: focusRing().boxShadow,
29
28
  },
30
- _a[SearchTheme.Dark] = {
29
+ [SearchTheme.Dark]: {
31
30
  background: 'rgba(0, 0, 0, 0.2)',
32
31
  backgroundFocus: colors.frenchVanilla100,
33
32
  color: colors.frenchVanilla100,
@@ -36,4 +35,4 @@ export var searchThemes = (_a = {},
36
35
  placeholderColorFocus: colors.licorice300,
37
36
  boxShadow: 'none',
38
37
  },
39
- _a);
38
+ };
@@ -43,7 +43,8 @@ While redistributing the Work or Derivative Works thereof, You may choose to off
43
43
 
44
44
  END OF TERMS AND CONDITIONS
45
45
 
46
- ©2020. Workday, Inc. All rights reserved. Workday and the Workday logo are registered trademarks of Workday, Inc. All other brand and product names are trademarks or registered trademarks of their respective holders.
46
+ ©2021 Workday, Inc. All rights reserved. Workday and the Workday logo are registered trademarks of Workday, Inc. All other brand and product names are trademarks or registered trademarks of their respective holders.
47
+
47
48
 
48
49
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
49
50
  http://www.apache.org/licenses/LICENSE-2.0
@@ -0,0 +1,11 @@
1
+ # Canvas Kit Expandable Container
2
+
3
+ <a href="https://github.com/Workday/canvas-kit/tree/master/modules/labs-react/README.md">
4
+ <img src="https://img.shields.io/badge/LABS-alpha-orange" alt="LABS: Alpha" />
5
+ </a> This component is work in progress and currently in prerelease.
6
+
7
+ ## Usage
8
+
9
+ View the
10
+ [documentation for Expandable](https://workday.github.io/canvas-kit/?path=/docs/labs-expandable-react--avatar)
11
+ on Storybook.
@@ -0,0 +1,2 @@
1
+ export * from './lib/Expandable';
2
+ export * from './lib/hooks';
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+
3
+ import {createContainer, ExtractProps} from '@workday/canvas-kit-react/common';
4
+ import {Flex} from '@workday/canvas-kit-react/layout';
5
+
6
+ import {ExpandableContent} from './ExpandableContent';
7
+ import {ExpandableTarget} from './ExpandableTarget';
8
+ import {ExpandableIcon} from './ExpandableIcon';
9
+ import {ExpandableTitle} from './ExpandableTitle';
10
+ import {ExpandableAvatar} from './ExpandableAvatar';
11
+ import {useExpandableModel} from './hooks/useExpandableModel';
12
+
13
+ export interface ExpandableProps extends ExtractProps<typeof Flex, never> {
14
+ /**
15
+ * The children of the `Expandable` container. This should contain `Expandable.Target` and
16
+ * `Expandable.Container`
17
+ */
18
+ children?: React.ReactNode;
19
+ }
20
+
21
+ /**
22
+ * `Expandable` wraps an `Expandable.Target` and an `Expandable.Content`. By default, it provides a
23
+ * `DisclosureModel` for its subcomponents. Alternatively, a model may be passed in using the
24
+ * hoisted model pattern.
25
+ */
26
+ export const Expandable = createContainer('div')({
27
+ displayName: 'Expandable',
28
+ modelHook: useExpandableModel,
29
+ subComponents: {
30
+ /**
31
+ * `Expandable.Target` creates a heading and a button. The heading is a semantic heading to
32
+ * describe the associated content. The button provides users the ability to toggle the
33
+ * associated content.
34
+ *
35
+ * As according to the [W3 disclosure
36
+ * specification](https://www.w3.org/TR/wai-aria-practices-1.1/#disclosure), the button has
37
+ * `aria-expanded` and `aria-controls` attributes set by default
38
+ *
39
+ * This component should hold an `Expandable.Icon`, an optional `Expandable.Avatar`, and an
40
+ * `Expandable.Title`.
41
+ */
42
+ Target: ExpandableTarget,
43
+ /**
44
+ * `Expandable.Title` styles the target text that describes the content.
45
+ */
46
+ Title: ExpandableTitle,
47
+ /**
48
+ * `Expandable.Icon` creates an icon to visually indicate the state of the content. It takes an
49
+ * `iconPosition` prop to determine which chevron icon to use.
50
+ */
51
+ Icon: ExpandableIcon,
52
+ /**
53
+ * `Expandable.Avatar` is an optional component that creates an `Avatar` to display a decorative
54
+ * image.
55
+ */
56
+ Avatar: ExpandableAvatar,
57
+ /**
58
+ * `Expandable.Content` holds the content that will be conditionally expanded and collapsed. It
59
+ * has an `id` to ensure the `Expandable.Target` properly set it to the `aria-controls`
60
+ * attribute.
61
+ */
62
+ Content: ExpandableContent,
63
+ },
64
+ })<ExpandableProps>(({children, ...elementProps}, Element) => (
65
+ <Flex as={Element} flexDirection={'column'} padding={'xxs'} {...elementProps}>
66
+ {children}
67
+ </Flex>
68
+ ));
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+
3
+ import {createComponent, ExtractProps, styled, StyledType} from '@workday/canvas-kit-react/common';
4
+ import {Avatar} from '@workday/canvas-kit-react/avatar';
5
+ import {space} from '@workday/canvas-kit-react/tokens';
6
+
7
+ export interface ExpandableAvatarProps
8
+ extends Omit<
9
+ ExtractProps<typeof Avatar, never>,
10
+ keyof React.ButtonHTMLAttributes<HTMLButtonElement>
11
+ > {}
12
+
13
+ const StyledAvatar = styled(Avatar)<StyledType>({
14
+ marginRight: space.xxs,
15
+ flexShrink: 0,
16
+ });
17
+
18
+ // When the component is created, it needs to be a button element to match AvatarProps.
19
+ // Once Avatar becomes a `createComponent` we can default the element type to a `div`
20
+ // and the types should be properly extracted
21
+ export const ExpandableAvatar = createComponent('button')({
22
+ displayName: 'Expandable.Avatar',
23
+ Component: ({altText, ...elemProps}: ExpandableAvatarProps, ref) => {
24
+ return <StyledAvatar altText={undefined} as="div" ref={ref} size={32} {...elemProps} />;
25
+ },
26
+ });
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+
3
+ import {space} from '@workday/canvas-kit-react/tokens';
4
+ import {createSubcomponent, ExtractProps} from '@workday/canvas-kit-react/common';
5
+ import {Box} from '@workday/canvas-kit-react/layout';
6
+
7
+ import {useExpandableContent} from './hooks/useExpandableContent';
8
+ import {useExpandableModel} from './hooks/useExpandableModel';
9
+
10
+ export interface ExpandableContentProps extends ExtractProps<typeof Box, never> {
11
+ /**
12
+ * The children of the `Expandable.Content` whose visibility is controlled by the associated
13
+ * `Expandable.Target`
14
+ */
15
+ children?: React.ReactNode;
16
+ }
17
+
18
+ export const ExpandableContent = createSubcomponent('div')({
19
+ modelHook: useExpandableModel,
20
+ elemPropsHook: useExpandableContent,
21
+ })<ExpandableContentProps>(({children, ...elementProps}, Element) => {
22
+ return (
23
+ <Box
24
+ as={Element}
25
+ background="none"
26
+ padding={`${space.s} ${space.xxs} ${space.xxs}`}
27
+ {...elementProps}
28
+ >
29
+ {children}
30
+ </Box>
31
+ );
32
+ });