@wonderflow/react-components 10.18.2 → 10.20.0

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 (204) hide show
  1. package/dist/components/accordion/accordion.test.d.ts +2 -0
  2. package/dist/components/accordion/accordion.test.d.ts.map +1 -0
  3. package/dist/components/accordion/accordion.test.js +35 -0
  4. package/dist/components/aspect-ratio/aspect-ratio.test.d.ts +2 -0
  5. package/dist/components/aspect-ratio/aspect-ratio.test.d.ts.map +1 -0
  6. package/dist/components/aspect-ratio/aspect-ratio.test.js +24 -0
  7. package/dist/components/autocomplete/autocomplete-option.d.ts.map +1 -1
  8. package/dist/components/autocomplete/autocomplete-option.js +1 -1
  9. package/dist/components/autocomplete/autocomplete.d.ts.map +1 -1
  10. package/dist/components/autocomplete/autocomplete.js +10 -5
  11. package/dist/components/autocomplete/autocomplete.test.d.ts +2 -0
  12. package/dist/components/autocomplete/autocomplete.test.d.ts.map +1 -0
  13. package/dist/components/autocomplete/autocomplete.test.js +42 -0
  14. package/dist/components/avatar/avatar.test.d.ts +2 -0
  15. package/dist/components/avatar/avatar.test.d.ts.map +1 -0
  16. package/dist/components/avatar/avatar.test.js +28 -0
  17. package/dist/components/button/button.d.ts.map +1 -1
  18. package/dist/components/button/button.js +1 -1
  19. package/dist/components/button/button.test.d.ts +2 -0
  20. package/dist/components/button/button.test.d.ts.map +1 -0
  21. package/dist/components/button/button.test.js +56 -0
  22. package/dist/components/card/card.test.d.ts +2 -0
  23. package/dist/components/card/card.test.d.ts.map +1 -0
  24. package/dist/components/card/card.test.js +41 -0
  25. package/dist/components/chip/chip.js +1 -1
  26. package/dist/components/chip/chip.test.d.ts +2 -0
  27. package/dist/components/chip/chip.test.d.ts.map +1 -0
  28. package/dist/components/chip/chip.test.js +29 -0
  29. package/dist/components/circular-progress/circular-progress.test.d.ts +2 -0
  30. package/dist/components/circular-progress/circular-progress.test.d.ts.map +1 -0
  31. package/dist/components/circular-progress/circular-progress.test.js +28 -0
  32. package/dist/components/clamp-text/clamp-text.d.ts.map +1 -1
  33. package/dist/components/clamp-text/clamp-text.js +1 -1
  34. package/dist/components/clamp-text/clamp-text.test.d.ts +2 -0
  35. package/dist/components/clamp-text/clamp-text.test.d.ts.map +1 -0
  36. package/dist/components/clamp-text/clamp-text.test.js +37 -0
  37. package/dist/components/container/container.test.d.ts +2 -0
  38. package/dist/components/container/container.test.d.ts.map +1 -0
  39. package/dist/components/container/container.test.js +28 -0
  40. package/dist/components/datetime/datetime.test.d.ts +2 -0
  41. package/dist/components/datetime/datetime.test.d.ts.map +1 -0
  42. package/dist/components/datetime/datetime.test.js +41 -0
  43. package/dist/components/disclosure/disclosure.d.ts.map +1 -1
  44. package/dist/components/disclosure/disclosure.js +1 -1
  45. package/dist/components/disclosure/disclosure.stories.d.ts +7 -7
  46. package/dist/components/disclosure/disclosure.stories.d.ts.map +1 -1
  47. package/dist/components/disclosure/disclosure.stories.js +7 -2
  48. package/dist/components/disclosure/disclosure.test.d.ts +2 -0
  49. package/dist/components/disclosure/disclosure.test.d.ts.map +1 -0
  50. package/dist/components/disclosure/disclosure.test.js +38 -0
  51. package/dist/components/elevator/elevator.test.d.ts +2 -0
  52. package/dist/components/elevator/elevator.test.d.ts.map +1 -0
  53. package/dist/components/elevator/elevator.test.js +25 -0
  54. package/dist/components/expander/expander.d.ts.map +1 -1
  55. package/dist/components/expander/expander.js +1 -1
  56. package/dist/components/expander/expander.test.d.ts +2 -0
  57. package/dist/components/expander/expander.test.d.ts.map +1 -0
  58. package/dist/components/expander/expander.test.js +32 -0
  59. package/dist/components/grid/grid.test.d.ts +2 -0
  60. package/dist/components/grid/grid.test.d.ts.map +1 -0
  61. package/dist/components/grid/grid.test.js +28 -0
  62. package/dist/components/info-state/info-state.test.d.ts +2 -0
  63. package/dist/components/info-state/info-state.test.d.ts.map +1 -0
  64. package/dist/components/info-state/info-state.test.js +33 -0
  65. package/dist/components/input-group/input-group.test.d.ts +2 -0
  66. package/dist/components/input-group/input-group.test.d.ts.map +1 -0
  67. package/dist/components/input-group/input-group.test.js +30 -0
  68. package/dist/components/linear-progress/linear-progress.test.d.ts +2 -0
  69. package/dist/components/linear-progress/linear-progress.test.d.ts.map +1 -0
  70. package/dist/components/linear-progress/linear-progress.test.js +32 -0
  71. package/dist/components/list/list.test.d.ts +2 -0
  72. package/dist/components/list/list.test.d.ts.map +1 -0
  73. package/dist/components/list/list.test.js +28 -0
  74. package/dist/components/masonry/masonry.test.d.ts +2 -0
  75. package/dist/components/masonry/masonry.test.d.ts.map +1 -0
  76. package/dist/components/masonry/masonry.test.js +28 -0
  77. package/dist/components/menu/menu-item/menu-item.d.ts +0 -2
  78. package/dist/components/menu/menu-item/menu-item.d.ts.map +1 -1
  79. package/dist/components/menu/menu-item/menu-item.js +1 -1
  80. package/dist/components/menu/menu-item/menu-item.module.css +1 -1
  81. package/dist/components/menu/menu.module.css +1 -1
  82. package/dist/components/menu/menu.stories.d.ts.map +1 -1
  83. package/dist/components/menu/menu.stories.js +2 -2
  84. package/dist/components/menu/menu.test.d.ts +2 -0
  85. package/dist/components/menu/menu.test.d.ts.map +1 -0
  86. package/dist/components/menu/menu.test.js +25 -0
  87. package/dist/components/overlay-container/overlay-container.stories.js +2 -2
  88. package/dist/components/pagination/pagination.js +1 -1
  89. package/dist/components/pagination/pagination.test.d.ts +2 -0
  90. package/dist/components/pagination/pagination.test.d.ts.map +1 -0
  91. package/dist/components/pagination/pagination.test.js +29 -0
  92. package/dist/components/popover/popover.d.ts.map +1 -1
  93. package/dist/components/popover/popover.js +6 -3
  94. package/dist/components/popover/popover.stories.d.ts.map +1 -1
  95. package/dist/components/popover/popover.stories.js +17 -4
  96. package/dist/components/popover/popover.test.d.ts +2 -0
  97. package/dist/components/popover/popover.test.d.ts.map +1 -0
  98. package/dist/components/popover/popover.test.js +41 -0
  99. package/dist/components/prose/prose.test.d.ts +2 -0
  100. package/dist/components/prose/prose.test.d.ts.map +1 -0
  101. package/dist/components/prose/prose.test.js +26 -0
  102. package/dist/components/select/select.test.d.ts +2 -0
  103. package/dist/components/select/select.test.d.ts.map +1 -0
  104. package/dist/components/select/select.test.js +28 -0
  105. package/dist/components/selection-controls/selection-controls.module.css +1 -1
  106. package/dist/components/selection-controls/selection-controls.test.d.ts +2 -0
  107. package/dist/components/selection-controls/selection-controls.test.d.ts.map +1 -0
  108. package/dist/components/selection-controls/selection-controls.test.js +30 -0
  109. package/dist/components/separator/separator.test.d.ts +2 -0
  110. package/dist/components/separator/separator.test.d.ts.map +1 -0
  111. package/dist/components/separator/separator.test.js +24 -0
  112. package/dist/components/skeleton/skeleton.test.d.ts +2 -0
  113. package/dist/components/skeleton/skeleton.test.d.ts.map +1 -0
  114. package/dist/components/skeleton/skeleton.test.js +28 -0
  115. package/dist/components/slider/slider.d.ts.map +1 -1
  116. package/dist/components/slider/slider.js +1 -1
  117. package/dist/components/slider/slider.test.d.ts +2 -0
  118. package/dist/components/slider/slider.test.d.ts.map +1 -0
  119. package/dist/components/slider/slider.test.js +30 -0
  120. package/dist/components/snackbar/snackbar.test.d.ts +2 -0
  121. package/dist/components/snackbar/snackbar.test.d.ts.map +1 -0
  122. package/dist/components/snackbar/snackbar.test.js +28 -0
  123. package/dist/components/spinner/spinner.test.d.ts +2 -0
  124. package/dist/components/spinner/spinner.test.d.ts.map +1 -0
  125. package/dist/components/spinner/spinner.test.js +28 -0
  126. package/dist/components/split-button/split-button.test.d.ts +2 -0
  127. package/dist/components/split-button/split-button.test.d.ts.map +1 -0
  128. package/dist/components/split-button/split-button.test.js +24 -0
  129. package/dist/components/stack/stack.test.d.ts +2 -0
  130. package/dist/components/stack/stack.test.d.ts.map +1 -0
  131. package/dist/components/stack/stack.test.js +28 -0
  132. package/dist/components/star-meter/star-meter.d.ts.map +1 -1
  133. package/dist/components/star-meter/star-meter.js +1 -4
  134. package/dist/components/star-meter/star-meter.test.d.ts +2 -0
  135. package/dist/components/star-meter/star-meter.test.d.ts.map +1 -0
  136. package/dist/components/star-meter/star-meter.test.js +36 -0
  137. package/dist/components/symbol/symbol.test.d.ts +2 -0
  138. package/dist/components/symbol/symbol.test.d.ts.map +1 -0
  139. package/dist/components/symbol/symbol.test.js +29 -0
  140. package/dist/components/tab/tab.d.ts.map +1 -1
  141. package/dist/components/tab/tab.js +1 -1
  142. package/dist/components/tab/tab.test.d.ts +2 -0
  143. package/dist/components/tab/tab.test.d.ts.map +1 -0
  144. package/dist/components/tab/tab.test.js +30 -0
  145. package/dist/components/table/table-cell/table-cell.test.d.ts +2 -0
  146. package/dist/components/table/table-cell/table-cell.test.d.ts.map +1 -0
  147. package/dist/components/table/table-cell/table-cell.test.js +28 -0
  148. package/dist/components/table/table-checkbox/table-checkbox.test.d.ts +2 -0
  149. package/dist/components/table/table-checkbox/table-checkbox.test.d.ts.map +1 -0
  150. package/dist/components/table/table-checkbox/table-checkbox.test.js +24 -0
  151. package/dist/components/table/table-controls/table-controls.test.d.ts +2 -0
  152. package/dist/components/table/table-controls/table-controls.test.d.ts.map +1 -0
  153. package/dist/components/table/table-controls/table-controls.test.js +35 -0
  154. package/dist/components/table/table-controls/toggle-columns.d.ts.map +1 -1
  155. package/dist/components/table/table-controls/toggle-columns.js +1 -1
  156. package/dist/components/table/table-header/table-header.test.d.ts +2 -0
  157. package/dist/components/table/table-header/table-header.test.d.ts.map +1 -0
  158. package/dist/components/table/table-header/table-header.test.js +24 -0
  159. package/dist/components/table/table-pagination/table-pagination.test.d.ts +2 -0
  160. package/dist/components/table/table-pagination/table-pagination.test.d.ts.map +1 -0
  161. package/dist/components/table/table-pagination/table-pagination.test.js +28 -0
  162. package/dist/components/table/table-row/table-row.test.d.ts +2 -0
  163. package/dist/components/table/table-row/table-row.test.d.ts.map +1 -0
  164. package/dist/components/table/table-row/table-row.test.js +24 -0
  165. package/dist/components/table/table.test.d.ts +2 -0
  166. package/dist/components/table/table.test.d.ts.map +1 -0
  167. package/dist/components/table/table.test.js +62 -0
  168. package/dist/components/text/text.test.d.ts +2 -0
  169. package/dist/components/text/text.test.d.ts.map +1 -0
  170. package/dist/components/text/text.test.js +24 -0
  171. package/dist/components/textfield/textfield.d.ts.map +1 -1
  172. package/dist/components/textfield/textfield.js +2 -2
  173. package/dist/components/textfield/textfield.test.d.ts +2 -0
  174. package/dist/components/textfield/textfield.test.d.ts.map +1 -0
  175. package/dist/components/textfield/textfield.test.js +37 -0
  176. package/dist/components/title/title.test.d.ts +2 -0
  177. package/dist/components/title/title.test.d.ts.map +1 -0
  178. package/dist/components/title/title.test.js +33 -0
  179. package/dist/components/toggle-button/toggle-button.d.ts.map +1 -1
  180. package/dist/components/toggle-button/toggle-button.js +1 -1
  181. package/dist/components/toggle-button/toggle-button.test.d.ts +2 -0
  182. package/dist/components/toggle-button/toggle-button.test.d.ts.map +1 -0
  183. package/dist/components/toggle-button/toggle-button.test.js +30 -0
  184. package/dist/components/tooltip/tooltip.d.ts.map +1 -1
  185. package/dist/components/tooltip/tooltip.js +7 -3
  186. package/dist/components/tooltip/tooltip.stories.d.ts +3 -1
  187. package/dist/components/tooltip/tooltip.stories.d.ts.map +1 -1
  188. package/dist/components/tooltip/tooltip.stories.js +33 -5
  189. package/dist/components/tooltip/tooltip.test.d.ts +2 -0
  190. package/dist/components/tooltip/tooltip.test.d.ts.map +1 -0
  191. package/dist/components/tooltip/tooltip.test.js +29 -0
  192. package/dist/hooks/index.d.ts +2 -0
  193. package/dist/hooks/index.d.ts.map +1 -0
  194. package/dist/hooks/index.js +16 -0
  195. package/dist/hooks/usePopupWrapper.d.ts +4 -0
  196. package/dist/hooks/usePopupWrapper.d.ts.map +1 -0
  197. package/dist/hooks/usePopupWrapper.js +42 -0
  198. package/dist/index.d.ts +1 -0
  199. package/dist/index.d.ts.map +1 -1
  200. package/dist/index.js +1 -0
  201. package/dist/providers/providers.test.d.ts +2 -0
  202. package/dist/providers/providers.test.d.ts.map +1 -0
  203. package/dist/providers/providers.test.js +34 -0
  204. package/package.json +17 -15
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2023 Wonderflow Design Team
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { render } from '@testing-library/react';
18
+ import { Text } from '../text';
19
+ import { Title } from './title';
20
+ describe('<Title>', () => {
21
+ test(' it should render properly', () => {
22
+ const { container } = render(_jsx(Title, { children: "Some title text" }));
23
+ expect(container).not.toBeNull();
24
+ });
25
+ test(' it should render properly with props', () => {
26
+ const { container } = render(_jsx(Title, { level: "display", anchor: true, children: "Some title text level 3" }));
27
+ expect(container).not.toBeNull();
28
+ });
29
+ test(' it should render properly with props', () => {
30
+ const { container } = render(_jsx(Title, { level: "display", anchor: true, children: _jsx(Text, { children: "Some text" }) }));
31
+ expect(container).not.toBeNull();
32
+ });
33
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"toggle-button.d.ts","sourceRoot":"","sources":["../../../src/components/toggle-button/toggle-button.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EACL,UAAU,EAAE,eAAe,EAAE,WAAW,EAEzC,MAAM,cAAc,CAAC;AAItB,aAAK,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,eAAe,GAAG,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC;AAEnG,oBAAY,iBAAiB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,QAAQ,GAAG,cAAc,CAAC;IACrF;;OAEG;IACH,WAAW,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IACrC;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IACtC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC,GAAG,CAAC,CAAA;AAEN,aAAK,uBAAuB,GAAG,WAAW,CAAC,mBAAmB,CAC9D,WAAW,CAAC,gBAAgB,CAAC,OAAO,UAAU,CAAC,EAC/C,iBAAiB,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAC,CACzD,CAAC;AAqBF,eAAO,MAAM,YAAY,yBAgFI,CAAC"}
1
+ {"version":3,"file":"toggle-button.d.ts","sourceRoot":"","sources":["../../../src/components/toggle-button/toggle-button.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EACL,UAAU,EAAE,eAAe,EAAE,WAAW,EAEzC,MAAM,cAAc,CAAC;AAItB,aAAK,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,eAAe,GAAG,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,KAAK,CAAC;AAEnG,oBAAY,iBAAiB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,QAAQ,GAAG,cAAc,CAAC;IACrF;;OAEG;IACH,WAAW,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IACrC;;OAEG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IACtC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC,GAAG,CAAC,CAAA;AAEN,aAAK,uBAAuB,GAAG,WAAW,CAAC,mBAAmB,CAC9D,WAAW,CAAC,gBAAgB,CAAC,OAAO,UAAU,CAAC,EAC/C,iBAAiB,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAC,CACzD,CAAC;AAqBF,eAAO,MAAM,YAAY,yBAiFI,CAAC"}
@@ -55,7 +55,7 @@ export const ToggleButton = forwardRef(({ className, restingIcon, pressedIcon, d
55
55
  };
56
56
  return (_jsx(Symbol, { source: icon, dimension: iconSize[dimension] }));
57
57
  }, []);
58
- return (_jsx(IconButton, { as: "button", ref: forwardedRef, dimension: dimension, "aria-pressed": isPressed, kind: kind, disabled: disabled, onClick: handleClick, "data-icon-button-squared": squared, className: clsx(styles.ToggleButton, className), ...otherProps, children: _jsx(LazyMotion, { features: domMax, strict: true, children: isPressed && pressedIcon
58
+ return (_jsx(IconButton, { as: "button", ref: forwardedRef, dimension: dimension, "aria-pressed": isPressed, kind: kind, disabled: disabled, onClick: handleClick, "data-icon-button-squared": squared, className: clsx(styles.ToggleButton, className), "data-testid": "ToggleButton", ...otherProps, children: _jsx(LazyMotion, { features: domMax, strict: true, children: isPressed && pressedIcon
59
59
  ? (_jsx(m.span, { variants: scaleAnimation, initial: isFirstRender && isPressed ? false : 'scaleOut', animate: "scaleIn", children: renderIcon(pressedIcon, dimension) }, "pressedIcon"))
60
60
  : restingIcon && (_jsx(m.span, { variants: scaleAnimation, initial: isFirstRender && !isPressed ? false : 'scaleOut', animate: "scaleIn", children: renderIcon(restingIcon, dimension) }, "restingIcon")) }) }));
61
61
  });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=toggle-button.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toggle-button.test.d.ts","sourceRoot":"","sources":["../../../src/components/toggle-button/toggle-button.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2023 Wonderflow Design Team
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { fireEvent, render } from '@testing-library/react';
18
+ import { ToggleButton } from './toggle-button';
19
+ describe('<ToggleButton>', () => {
20
+ test(' it should render properly', () => {
21
+ const { container, getByTestId } = render(_jsx(ToggleButton, { restingIcon: "bell" }));
22
+ const el = getByTestId('ToggleButton');
23
+ fireEvent.click(el);
24
+ expect(container).not.toBeNull();
25
+ });
26
+ test(' it should render properly with props', () => {
27
+ const { container } = render(_jsx(ToggleButton, { restingIcon: "bell", pressed: true }));
28
+ expect(container).not.toBeNull();
29
+ });
30
+ });
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEtF,OAAO,EACgE,SAAS,EAC/E,MAAM,OAAO,CAAC;AAQf,oBAAY,YAAY,GAAG;IACzB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,kBAAkB,CAAC;IAC/D;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,eAAe,CAAC,YAAY,CAkFjD,CAAC"}
1
+ {"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAEtF,OAAO,EACgE,SAAS,EAC/E,MAAM,OAAO,CAAC;AAUf,oBAAY,YAAY,GAAG;IACzB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC;IACnB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,kBAAkB,CAAC;IAC/D;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,eAAe,CAAC,YAAY,CAoFjD,CAAC"}
@@ -1,15 +1,19 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useFocusWithin, useKeyPress } from 'ahooks';
3
3
  import { Children, cloneElement, isValidElement, useRef, useState, } from 'react';
4
+ import { createPortal } from 'react-dom';
4
5
  import { usePopperTooltip } from 'react-popper-tooltip';
5
6
  import { useUIDSeed } from 'react-uid';
6
7
  import { Elevator } from '../..';
8
+ import { usePopUpWrapper } from '../../hooks';
7
9
  import * as styles from './tooltip.module.css';
8
10
  export const Tooltip = ({ children, trigger, placement = 'bottom-start', open, style, maxWidth = '40ch', fill = false, interactive = false, delay = 500, }) => {
9
- const seedID = useUIDSeed();
10
11
  const [isOpen, setIsOpen] = useState(false);
12
+ const seedID = useUIDSeed();
13
+ const id = seedID('tooltip-content');
11
14
  const tooltipContainerRef = useRef(null);
12
15
  useKeyPress('esc', () => setIsOpen(false));
16
+ const { wrapper } = usePopUpWrapper('tooltip-popup-root');
13
17
  const { getArrowProps, getTooltipProps, setTooltipRef, setTriggerRef,
14
18
  /* eslint-disable @typescript-eslint/naming-convention */
15
19
  visible, } = usePopperTooltip({
@@ -40,6 +44,6 @@ export const Tooltip = ({ children, trigger, placement = 'bottom-start', open, s
40
44
  return (_jsxs("div", { "data-tooltip-fill": fill, className: styles.Tooltip, ref: tooltipContainerRef, "data-tooltip-has-focus-within": isFocusWithin, style: { ...style }, children: [Children.map(trigger, child => isValidElement(child) && cloneElement(child, {
41
45
  ref: setTriggerRef,
42
46
  tabIndex: 0,
43
- 'aria-describedby': seedID('tooltip-content'),
44
- })), visible && (_jsx(Elevator, { resting: 1, children: _jsxs("div", { ref: setTooltipRef, role: "tooltip", id: seedID('tooltip-content'), "data-theme": "dark", ...getTooltipProps({ className: styles.Balloon, style: dynamycStyle }), children: [children, _jsx("div", { ...getArrowProps({ className: styles.Arrow }) })] }) }))] }));
47
+ 'aria-describedby': id,
48
+ })), visible && createPortal(_jsx(Elevator, { resting: 1, children: _jsxs("div", { ref: setTooltipRef, role: "tooltip", id: id, "data-theme": "dark", ...getTooltipProps({ className: styles.Balloon, style: dynamycStyle }), children: [children, _jsx("div", { ...getArrowProps({ className: styles.Arrow }) })] }) }), wrapper)] }));
45
49
  };
@@ -2,6 +2,8 @@ import { ComponentMeta, ComponentStory } from '@storybook/react';
2
2
  import { Tooltip } from './tooltip';
3
3
  declare const story: ComponentMeta<typeof Tooltip>;
4
4
  export default story;
5
- export declare const Default: ComponentStory<FCChildrenClass<import("./tooltip").TooltipProps>>;
5
+ export declare const Interactive: ComponentStory<FCChildrenClass<import("./tooltip").TooltipProps>>;
6
+ export declare const NonInteractive: ComponentStory<FCChildrenClass<import("./tooltip").TooltipProps>>;
7
+ export declare const Open: ComponentStory<FCChildrenClass<import("./tooltip").TooltipProps>>;
6
8
  export declare const WithButtons: ComponentStory<FCChildrenClass<import("./tooltip").TooltipProps>>;
7
9
  //# sourceMappingURL=tooltip.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.stories.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIjE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,OAAO,CAOxC,CAAC;AAEF,eAAe,KAAK,CAAC;AAmBrB,eAAO,MAAM,OAAO,mEAAoB,CAAC;AAKzC,eAAO,MAAM,WAAW,mEAAoB,CAAC"}
1
+ {"version":3,"file":"tooltip.stories.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIjE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,OAAO,CAiBxC,CAAC;AAEF,eAAe,KAAK,CAAC;AAoCrB,eAAO,MAAM,WAAW,mEAAoB,CAAC;AAK7C,eAAO,MAAM,cAAc,mEAAqB,CAAC;AAMjD,eAAO,MAAM,IAAI,mEAAoB,CAAC;AAMtC,eAAO,MAAM,WAAW,mEAAoB,CAAC"}
@@ -1,19 +1,47 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Button, Text } from '../..';
2
+ import { Button, Symbol, Text } from '../..';
3
3
  import { Tooltip } from './tooltip';
4
4
  const story = {
5
5
  title: 'Dialogs/Tooltip',
6
6
  component: Tooltip,
7
7
  args: {
8
- trigger: _jsx(Text, { as: "span", children: "HTML" }),
9
8
  interactive: true,
9
+ placement: 'auto',
10
+ delay: 500,
11
+ maxWidth: '40ch',
12
+ fill: false,
13
+ trigger: _jsx(Text, { as: "span", style: { margin: '1rem' }, children: "HTML" }),
14
+ },
15
+ argTypes: {
16
+ placement: {
17
+ options: ['auto', 'auto-start', 'auto-end', 'top', 'bottom', 'right', 'left', 'top-start', 'top-end', 'bottom-start', 'bottom-end', 'right-start', 'right-end', 'left-start', 'left-end'],
18
+ control: { type: 'select' },
19
+ },
10
20
  },
11
21
  };
12
22
  export default story;
13
- const Template = args => (_jsxs(_Fragment, { children: [_jsxs(Tooltip, { ...args, children: [_jsx("button", { type: "button", children: "test" }), "HTML stands for HyperText Markup LanguageHTML stands for HyperText Markup LanguageHTML stands for HyperText Markup LanguageHTML stands for HyperText Markup LanguageHTML stands for HyperText Markup Language", _jsx("button", { type: "button", children: "test" })] }), _jsxs(Tooltip, { ...args, children: [_jsx("button", { type: "button", children: "test" }), "HTML stands for HyperText Markup LanguageHTML stands for HyperText Markup LanguageHTML stands for HyperText Markup LanguageHTML stands for HyperText Markup LanguageHTML stands for HyperText Markup Language", _jsx("button", { type: "button", children: "test" })] })] }));
14
- export const Default = Template.bind({});
15
- Default.args = {
23
+ const Template = args => (_jsx(_Fragment, { children: _jsxs(Tooltip, { ...args, children: [_jsx("p", { children: "Lorem ipsum dolor sit, amet consectetur adipisicing elit. Totam, ullam. Totam veniam dignissimos ducimus illo ipsa tempora corrupti enim quidem, ad odit molestias deleniti in." }), _jsxs("div", { style: {
24
+ display: 'flex',
25
+ flexDirection: 'row',
26
+ justifyContent: 'flex-end',
27
+ alignItems: 'flex-end',
28
+ gap: '0.5rem',
29
+ marginTop: '0.5rem',
30
+ }, children: [_jsx("button", { type: "button", onClick: () => console.debug('Reset!'), children: "Reset" }), _jsx("button", { type: "button", onClick: () => console.debug('Confirm!'), children: "Confirm" })] })] }) }));
31
+ const Template2 = args => (_jsx(_Fragment, { children: _jsx(Tooltip, { ...args, children: _jsx("p", { children: "Lorem ipsum dolor sit, amet consectetur adipisicing elit. Totam, ullam. Totam veniam dignissimos ducimus illo ipsa tempora corrupti enim quidem, ad odit molestias deleniti in." }) }) }));
32
+ export const Interactive = Template.bind({});
33
+ Interactive.args = {
34
+ interactive: true,
35
+ };
36
+ export const NonInteractive = Template2.bind({});
37
+ NonInteractive.args = {
38
+ trigger: _jsx(Symbol, { source: "bell", "aria-hidden": "false", style: { marginLeft: '1rem' } }),
39
+ interactive: false,
40
+ };
41
+ export const Open = Template.bind({});
42
+ Open.args = {
16
43
  interactive: true,
44
+ open: true,
17
45
  };
18
46
  export const WithButtons = Template.bind({});
19
47
  WithButtons.args = {
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=tooltip.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.test.d.ts","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2023 Wonderflow Design Team
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { fireEvent, render } from '@testing-library/react';
18
+ import { Button } from '../button';
19
+ import { Tooltip } from './tooltip';
20
+ describe('<Tooltip>', () => {
21
+ test(' it should render properly', () => {
22
+ const { container, getByText } = render(_jsx(Tooltip, { trigger: _jsx(Button, { children: "Click Me" }), children: "Some content" }));
23
+ const el = getByText('Click Me');
24
+ fireEvent.focus(el);
25
+ fireEvent.blur(el);
26
+ fireEvent.keyPress(el, { code: 'esc', key: 'esc' });
27
+ expect(container).not.toBeNull();
28
+ });
29
+ });
@@ -0,0 +1,2 @@
1
+ export { usePopUpWrapper } from './usePopupWrapper';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Copyright 2022-2023 Wonderflow Design Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ export { usePopUpWrapper } from './usePopupWrapper';
@@ -0,0 +1,4 @@
1
+ export declare const usePopUpWrapper: (id: string) => {
2
+ wrapper: HTMLElement;
3
+ };
4
+ //# sourceMappingURL=usePopupWrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePopupWrapper.d.ts","sourceRoot":"","sources":["../../src/hooks/usePopupWrapper.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,eAAe,OAAQ,MAAM;;CAgCzC,CAAC"}
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Copyright 2023 Wonderflow Design Team
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { useCallback, useEffect, useState } from 'react';
17
+ export const usePopUpWrapper = (id) => {
18
+ const [wrapper, setWrapper] = useState(document.body);
19
+ const createWrapper = useCallback(() => {
20
+ let w = document.getElementById(id);
21
+ if (!w) {
22
+ w = document.createElement('div');
23
+ w.setAttribute('id', id);
24
+ w.style.position = 'relative';
25
+ w.style.zIndex = '999';
26
+ document.body.appendChild(w);
27
+ }
28
+ setWrapper(w);
29
+ }, [id]);
30
+ const removeWrapper = () => {
31
+ const w = document.getElementById(id);
32
+ if (w)
33
+ w.remove();
34
+ };
35
+ useEffect(() => {
36
+ createWrapper();
37
+ return () => removeWrapper();
38
+ },
39
+ // eslint-disable-next-line react-hooks/exhaustive-deps
40
+ []);
41
+ return { wrapper };
42
+ };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './components';
2
+ export * from './hooks';
2
3
  export * from './providers';
3
4
  export * from './types';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -14,5 +14,6 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  export * from './components';
17
+ export * from './hooks';
17
18
  export * from './providers';
18
19
  export * from './types';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=providers.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providers.test.d.ts","sourceRoot":"","sources":["../../src/providers/providers.test.tsx"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /*
3
+ * Copyright 2023 Wonderflow Design Team
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { render } from '@testing-library/react';
18
+ import { OverlayProvider } from './overlay';
19
+ import { ResponsiveProvider } from './responsive';
20
+ describe('<Providers>', () => {
21
+ test('OverlayProvider should render properly', () => {
22
+ const { container } = render(_jsx(OverlayProvider, { children: "Content" }));
23
+ expect(container).not.toBeNull();
24
+ });
25
+ test('OverlayProvider should render properly with props', () => {
26
+ const fn = jest.fn(() => ({}));
27
+ const { container } = render(_jsx(OverlayProvider, { titleId: "overlay", onClose: fn, children: "Content" }));
28
+ expect(container).not.toBeNull();
29
+ });
30
+ test('ResponsiveProvider should render properly with props', () => {
31
+ const { container } = render(_jsx(ResponsiveProvider, { children: "Content" }));
32
+ expect(container).not.toBeNull();
33
+ });
34
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wonderflow/react-components",
3
- "version": "10.18.2",
3
+ "version": "10.20.0",
4
4
  "description": "UI components from Wonderflow's Wanda design system",
5
5
  "author": "Wonderflow",
6
6
  "license": "Apache-2.0",
@@ -31,8 +31,9 @@
31
31
  "storybook": "start-storybook --quiet -p 6006",
32
32
  "build-storybook": "build-storybook",
33
33
  "deploy:storybook": "build-storybook && gh-pages -d storybook-static",
34
- "test:storybook": "test-storybook --coverage --verbose",
35
- "test": "test-storybook --url https://wonderflow-bv.github.io/wanda/",
34
+ "test:storybook": "test-storybook --coverage --verbose && npx nyc report --reporter=lcov -t coverage/storybook --report-dir coverage/storybook",
35
+ "test:report": "npx nyc report --reporter=lcov -t coverage/storybook --report-dir coverage/storybook",
36
+ "test:online": "test-storybook --url https://wonderflow-bv.github.io/wanda/",
36
37
  "clean": "rimraf dist core core.css",
37
38
  "watch:csstypes": "tcm -w -p '**/*.module.css' src",
38
39
  "build:csstypes": "tcm -p '**/*.module.css' src"
@@ -64,23 +65,24 @@
64
65
  "devDependencies": {
65
66
  "@babel/core": "7.19.3",
66
67
  "@babel/preset-typescript": "7.18.6",
67
- "@storybook/addon-a11y": "6.5.15",
68
- "@storybook/addon-actions": "6.5.12",
68
+ "@storybook/addon-a11y": "6.5.16",
69
+ "@storybook/addon-actions": "6.5.16",
69
70
  "@storybook/addon-coverage": "0.0.7",
70
- "@storybook/addon-essentials": "6.5.12",
71
- "@storybook/addon-links": "6.5.12",
71
+ "@storybook/addon-essentials": "6.5.16",
72
+ "@storybook/addon-links": "6.5.16",
72
73
  "@storybook/addon-postcss": "2.0.0",
73
- "@storybook/addons": "6.5.12",
74
- "@storybook/builder-webpack5": "6.5.12",
75
- "@storybook/manager-webpack5": "6.5.12",
76
- "@storybook/react": "6.5.12",
77
- "@storybook/test-runner": "0.9.2",
78
- "@storybook/theming": "6.5.12",
74
+ "@storybook/addons": "6.5.16",
75
+ "@storybook/builder-webpack5": "6.5.16",
76
+ "@storybook/manager-webpack5": "6.5.16",
77
+ "@storybook/react": "6.5.16",
78
+ "@storybook/test-runner": "0.9.4",
79
+ "@storybook/testing-react": "1.3.0",
80
+ "@storybook/theming": "6.5.16",
79
81
  "@types/react": "17.0.43",
80
82
  "@types/react-dom": "17.0.14",
81
83
  "@types/react-table": "7.7.12",
82
- "@wonderflow/config": "10.18.2",
83
- "@wonderflow/tokens": "10.18.2",
84
+ "@wonderflow/config": "10.20.0",
85
+ "@wonderflow/tokens": "10.20.0",
84
86
  "babel-loader": "8.2.5",
85
87
  "cpy-cli": "3.1.1",
86
88
  "postcss": "8.4.17",