@vibe/core 3.53.0-alpha-528cd.0 → 3.53.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 (192) hide show
  1. package/dist/components/Accordion/index.d.ts +2 -2
  2. package/dist/components/AlertBanner/index.d.ts +4 -4
  3. package/dist/components/AttentionBox/index.d.ts +2 -2
  4. package/dist/components/Avatar/index.d.ts +1 -1
  5. package/dist/components/AvatarGroup/index.d.ts +1 -1
  6. package/dist/components/Badge/index.d.ts +1 -1
  7. package/dist/components/Box/index.d.ts +1 -1
  8. package/dist/components/BreadcrumbsBar/index.d.ts +4 -4
  9. package/dist/components/Button/index.d.ts +1 -1
  10. package/dist/components/ButtonGroup/index.d.ts +1 -1
  11. package/dist/components/Checkbox/index.d.ts +1 -1
  12. package/dist/components/Chips/index.d.ts +1 -1
  13. package/dist/components/Clickable/index.d.ts +1 -1
  14. package/dist/components/ColorPicker/index.d.ts +2 -2
  15. package/dist/components/Combobox/index.d.ts +1 -1
  16. package/dist/components/Counter/index.d.ts +1 -1
  17. package/dist/components/DatePicker/index.d.ts +1 -1
  18. package/dist/components/Dialog/Dialog.d.ts +4 -0
  19. package/dist/components/Dialog/index.d.ts +1 -1
  20. package/dist/components/DialogContentContainer/index.d.ts +1 -1
  21. package/dist/components/Divider/index.d.ts +1 -1
  22. package/dist/components/EditableHeading/index.d.ts +1 -1
  23. package/dist/components/EditableText/index.d.ts +1 -1
  24. package/dist/components/ExpandCollapse/index.d.ts +1 -1
  25. package/dist/components/FieldLabel/FieldLabel.d.ts +4 -0
  26. package/dist/components/Flex/index.d.ts +1 -1
  27. package/dist/components/FormattedNumber/index.d.ts +1 -1
  28. package/dist/components/Heading/index.d.ts +1 -1
  29. package/dist/components/HiddenText/index.d.ts +1 -1
  30. package/dist/components/Icon/index.d.ts +2 -2
  31. package/dist/components/IconButton/index.d.ts +1 -1
  32. package/dist/components/Label/index.d.ts +1 -1
  33. package/dist/components/LayerProvider/index.d.ts +1 -1
  34. package/dist/components/LegacyModal/index.d.ts +5 -5
  35. package/dist/components/Link/index.d.ts +1 -1
  36. package/dist/components/List/index.d.ts +1 -1
  37. package/dist/components/ListItem/index.d.ts +1 -1
  38. package/dist/components/ListItemAvatar/index.d.ts +1 -1
  39. package/dist/components/ListItemIcon/index.d.ts +1 -1
  40. package/dist/components/ListTitle/index.d.ts +1 -1
  41. package/dist/components/Loader/index.d.ts +1 -1
  42. package/dist/components/Menu/index.d.ts +6 -6
  43. package/dist/components/MenuButton/index.d.ts +1 -1
  44. package/dist/components/Modal/Modal/index.d.ts +1 -1
  45. package/dist/components/Modal/ModalContent/index.d.ts +1 -1
  46. package/dist/components/Modal/ModalHeader/index.d.ts +1 -1
  47. package/dist/components/Modal/ModalMedia/index.d.ts +1 -1
  48. package/dist/components/Modal/footers/index.d.ts +2 -2
  49. package/dist/components/Modal/layouts/index.d.ts +3 -3
  50. package/dist/components/MultiStepIndicator/index.d.ts +1 -1
  51. package/dist/components/ProgressBars/index.d.ts +1 -1
  52. package/dist/components/RadioButton/index.d.ts +1 -1
  53. package/dist/components/Refable/Refable.d.ts +4 -0
  54. package/dist/components/Skeleton/index.d.ts +1 -1
  55. package/dist/components/Slider/index.d.ts +1 -1
  56. package/dist/components/SplitButton/index.d.ts +2 -2
  57. package/dist/components/Steps/index.d.ts +1 -1
  58. package/dist/components/Table/index.d.ts +7 -7
  59. package/dist/components/Tabs/index.d.ts +5 -5
  60. package/dist/components/Text/index.d.ts +1 -1
  61. package/dist/components/TextField/index.d.ts +1 -1
  62. package/dist/components/TextWithHighlight/index.d.ts +1 -1
  63. package/dist/components/ThemeProvider/index.d.ts +1 -1
  64. package/dist/components/Tipseen/index.d.ts +5 -5
  65. package/dist/components/Toast/Toast.d.ts +2 -2
  66. package/dist/components/Toast/index.d.ts +3 -3
  67. package/dist/components/Toggle/index.d.ts +1 -1
  68. package/dist/components/Tooltip/index.d.ts +1 -1
  69. package/dist/components/VirtualizedGrid/index.d.ts +1 -1
  70. package/dist/components/VirtualizedList/VirtualizedList.types.d.ts +1 -1
  71. package/dist/components/VirtualizedList/index.d.ts +1 -1
  72. package/dist/metadata.json +147 -115
  73. package/dist/mocked_classnames/components/Accordion/index.d.ts +2 -2
  74. package/dist/mocked_classnames/components/AlertBanner/index.d.ts +4 -4
  75. package/dist/mocked_classnames/components/AttentionBox/index.d.ts +2 -2
  76. package/dist/mocked_classnames/components/Avatar/index.d.ts +1 -1
  77. package/dist/mocked_classnames/components/AvatarGroup/index.d.ts +1 -1
  78. package/dist/mocked_classnames/components/Badge/index.d.ts +1 -1
  79. package/dist/mocked_classnames/components/Box/index.d.ts +1 -1
  80. package/dist/mocked_classnames/components/BreadcrumbsBar/index.d.ts +4 -4
  81. package/dist/mocked_classnames/components/Button/index.d.ts +1 -1
  82. package/dist/mocked_classnames/components/ButtonGroup/index.d.ts +1 -1
  83. package/dist/mocked_classnames/components/Checkbox/index.d.ts +1 -1
  84. package/dist/mocked_classnames/components/Chips/index.d.ts +1 -1
  85. package/dist/mocked_classnames/components/Clickable/index.d.ts +1 -1
  86. package/dist/mocked_classnames/components/ColorPicker/index.d.ts +2 -2
  87. package/dist/mocked_classnames/components/Combobox/index.d.ts +1 -1
  88. package/dist/mocked_classnames/components/Counter/index.d.ts +1 -1
  89. package/dist/mocked_classnames/components/DatePicker/index.d.ts +1 -1
  90. package/dist/mocked_classnames/components/Dialog/Dialog.d.ts +4 -0
  91. package/dist/mocked_classnames/components/Dialog/index.d.ts +1 -1
  92. package/dist/mocked_classnames/components/DialogContentContainer/index.d.ts +1 -1
  93. package/dist/mocked_classnames/components/Divider/index.d.ts +1 -1
  94. package/dist/mocked_classnames/components/EditableHeading/index.d.ts +1 -1
  95. package/dist/mocked_classnames/components/EditableText/index.d.ts +1 -1
  96. package/dist/mocked_classnames/components/ExpandCollapse/index.d.ts +1 -1
  97. package/dist/mocked_classnames/components/FieldLabel/FieldLabel.d.ts +4 -0
  98. package/dist/mocked_classnames/components/Flex/index.d.ts +1 -1
  99. package/dist/mocked_classnames/components/FormattedNumber/index.d.ts +1 -1
  100. package/dist/mocked_classnames/components/Heading/index.d.ts +1 -1
  101. package/dist/mocked_classnames/components/HiddenText/index.d.ts +1 -1
  102. package/dist/mocked_classnames/components/Icon/index.d.ts +2 -2
  103. package/dist/mocked_classnames/components/IconButton/index.d.ts +1 -1
  104. package/dist/mocked_classnames/components/Label/index.d.ts +1 -1
  105. package/dist/mocked_classnames/components/LayerProvider/index.d.ts +1 -1
  106. package/dist/mocked_classnames/components/LegacyModal/index.d.ts +5 -5
  107. package/dist/mocked_classnames/components/Link/index.d.ts +1 -1
  108. package/dist/mocked_classnames/components/List/index.d.ts +1 -1
  109. package/dist/mocked_classnames/components/ListItem/index.d.ts +1 -1
  110. package/dist/mocked_classnames/components/ListItemAvatar/index.d.ts +1 -1
  111. package/dist/mocked_classnames/components/ListItemIcon/index.d.ts +1 -1
  112. package/dist/mocked_classnames/components/ListTitle/index.d.ts +1 -1
  113. package/dist/mocked_classnames/components/Loader/index.d.ts +1 -1
  114. package/dist/mocked_classnames/components/Menu/index.d.ts +6 -6
  115. package/dist/mocked_classnames/components/MenuButton/index.d.ts +1 -1
  116. package/dist/mocked_classnames/components/Modal/Modal/index.d.ts +1 -1
  117. package/dist/mocked_classnames/components/Modal/ModalContent/index.d.ts +1 -1
  118. package/dist/mocked_classnames/components/Modal/ModalHeader/index.d.ts +1 -1
  119. package/dist/mocked_classnames/components/Modal/ModalMedia/index.d.ts +1 -1
  120. package/dist/mocked_classnames/components/Modal/footers/index.d.ts +2 -2
  121. package/dist/mocked_classnames/components/Modal/layouts/index.d.ts +3 -3
  122. package/dist/mocked_classnames/components/MultiStepIndicator/index.d.ts +1 -1
  123. package/dist/mocked_classnames/components/ProgressBars/index.d.ts +1 -1
  124. package/dist/mocked_classnames/components/RadioButton/index.d.ts +1 -1
  125. package/dist/mocked_classnames/components/Refable/Refable.d.ts +4 -0
  126. package/dist/mocked_classnames/components/Skeleton/index.d.ts +1 -1
  127. package/dist/mocked_classnames/components/Slider/index.d.ts +1 -1
  128. package/dist/mocked_classnames/components/SplitButton/index.d.ts +2 -2
  129. package/dist/mocked_classnames/components/Steps/index.d.ts +1 -1
  130. package/dist/mocked_classnames/components/Table/index.d.ts +7 -7
  131. package/dist/mocked_classnames/components/Tabs/index.d.ts +5 -5
  132. package/dist/mocked_classnames/components/Text/index.d.ts +1 -1
  133. package/dist/mocked_classnames/components/TextField/index.d.ts +1 -1
  134. package/dist/mocked_classnames/components/TextWithHighlight/index.d.ts +1 -1
  135. package/dist/mocked_classnames/components/ThemeProvider/index.d.ts +1 -1
  136. package/dist/mocked_classnames/components/Tipseen/index.d.ts +5 -5
  137. package/dist/mocked_classnames/components/Toast/Toast.d.ts +2 -2
  138. package/dist/mocked_classnames/components/Toast/index.d.ts +3 -3
  139. package/dist/mocked_classnames/components/Toggle/index.d.ts +1 -1
  140. package/dist/mocked_classnames/components/Tooltip/index.d.ts +1 -1
  141. package/dist/mocked_classnames/components/VirtualizedGrid/index.d.ts +1 -1
  142. package/dist/mocked_classnames/components/VirtualizedList/VirtualizedList.types.d.ts +1 -1
  143. package/dist/mocked_classnames/components/VirtualizedList/index.d.ts +1 -1
  144. package/dist/mocked_classnames/src/components/AlertBanner/AlertBannerButton/AlertBannerButton.js +1 -1
  145. package/dist/mocked_classnames/src/components/AlertBanner/AlertBannerButton/AlertBannerButton.js.map +1 -1
  146. package/dist/mocked_classnames/src/components/Button/Button.js +1 -1
  147. package/dist/mocked_classnames/src/components/Button/Button.js.map +1 -1
  148. package/dist/mocked_classnames/src/components/Counter/Counter.js +1 -1
  149. package/dist/mocked_classnames/src/components/Counter/Counter.js.map +1 -1
  150. package/dist/mocked_classnames/src/components/Dialog/Dialog.js +1 -1
  151. package/dist/mocked_classnames/src/components/Dialog/Dialog.js.map +1 -1
  152. package/dist/mocked_classnames/src/components/Dialog/DialogContent/DialogContent.js +1 -1
  153. package/dist/mocked_classnames/src/components/Dialog/DialogContent/DialogContent.js.map +1 -1
  154. package/dist/mocked_classnames/src/components/FieldLabel/FieldLabel.js +1 -1
  155. package/dist/mocked_classnames/src/components/FieldLabel/FieldLabel.js.map +1 -1
  156. package/dist/mocked_classnames/src/components/Refable/Refable.js +1 -1
  157. package/dist/mocked_classnames/src/components/Refable/Refable.js.map +1 -1
  158. package/dist/mocked_classnames/src/components/SplitButton/SplitButton.js +1 -1
  159. package/dist/mocked_classnames/src/components/SplitButton/SplitButton.js.map +1 -1
  160. package/dist/mocked_classnames/src/components/Toast/Toast.js +1 -1
  161. package/dist/mocked_classnames/src/components/Toast/Toast.js.map +1 -1
  162. package/dist/mocked_classnames/src/components/Toast/ToastButton/ToastButton.js +1 -1
  163. package/dist/mocked_classnames/src/components/Toast/ToastButton/ToastButton.js.map +1 -1
  164. package/dist/mocked_classnames/src/tests/interactionsTests.js +1 -1
  165. package/dist/mocked_classnames/src/tests/interactionsTests.js.map +1 -1
  166. package/dist/mocked_classnames/tests/interactions-utils.d.ts +1 -1
  167. package/dist/mocked_classnames/types/index.d.ts +2 -2
  168. package/dist/src/components/AlertBanner/AlertBannerButton/AlertBannerButton.js +1 -1
  169. package/dist/src/components/AlertBanner/AlertBannerButton/AlertBannerButton.js.map +1 -1
  170. package/dist/src/components/Button/Button.js +1 -1
  171. package/dist/src/components/Button/Button.js.map +1 -1
  172. package/dist/src/components/Counter/Counter.js +1 -1
  173. package/dist/src/components/Counter/Counter.js.map +1 -1
  174. package/dist/src/components/Dialog/Dialog.js +1 -1
  175. package/dist/src/components/Dialog/Dialog.js.map +1 -1
  176. package/dist/src/components/Dialog/DialogContent/DialogContent.js +1 -1
  177. package/dist/src/components/Dialog/DialogContent/DialogContent.js.map +1 -1
  178. package/dist/src/components/FieldLabel/FieldLabel.js +1 -1
  179. package/dist/src/components/FieldLabel/FieldLabel.js.map +1 -1
  180. package/dist/src/components/Refable/Refable.js +1 -1
  181. package/dist/src/components/Refable/Refable.js.map +1 -1
  182. package/dist/src/components/SplitButton/SplitButton.js +1 -1
  183. package/dist/src/components/SplitButton/SplitButton.js.map +1 -1
  184. package/dist/src/components/Toast/Toast.js +1 -1
  185. package/dist/src/components/Toast/Toast.js.map +1 -1
  186. package/dist/src/components/Toast/ToastButton/ToastButton.js +1 -1
  187. package/dist/src/components/Toast/ToastButton/ToastButton.js.map +1 -1
  188. package/dist/src/tests/interactionsTests.js +1 -1
  189. package/dist/src/tests/interactionsTests.js.map +1 -1
  190. package/dist/tests/interactions-utils.d.ts +1 -1
  191. package/dist/types/index.d.ts +2 -2
  192. package/package.json +34 -28
@@ -1,2 +1,2 @@
1
- import{defineProperty as t}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{__rest as e}from"../../../_virtual/_tslib.js";import{camelCase as o}from"lodash-es";import{getTestId as i,ComponentDefaultTestId as n}from"../../tests/testIds.js";import r from"classnames";import s,{useRef as a,useMemo as l,useCallback as c,useEffect as m}from"react";import{CSSTransition as u}from"react-transition-group";import p from"../Text/Text.js";import d from"../Loader/Loader.js";import f from"../Flex/Flex.js";import v from"./ToastLink/ToastLink.js";import T from"./ToastButton/ToastButton.js";import{ToastType as j,ToastActionType as y}from"./ToastConstants.js";import{getIcon as h}from"./ToastHelpers.js";import{NOOP as g}from"../../utils/function-utils.js";import{getStyle as x}from"../../helpers/typesciptCssModulesHelper.js";import{withStaticPropsWithoutForwardRef as E}from"../../types/withStaticProps.js";import"../../utils/colors-vars-map.js";import N from"./Toast.module.scss.js";import C from"../IconButton/IconButton.js";import b from"../../hooks/usePrevious/index.js";import k from"../../../icons/dist/react/CloseSmall.js";var B=E((function(j){var y=j.open,E=void 0!==y&&y,B=j.loading,L=void 0!==B&&B,O=j.autoHideDuration,A=void 0===O?null:O,w=j.type,S=void 0===w?"normal":w,_=j.icon,H=j.hideIcon,I=void 0!==H&&H,P=j.action,z=j.actions,F=j.children,D=j.closeable,M=void 0===D||D,R=j.onClose,U=void 0===R?g:R,q=j.className,G=j.id,J=j.closeButtonAriaLabel,K=void 0===J?"Close":J,Q=j["data-testid"],V=a(null),W=a(null),X=b(null==z?void 0:z.length),Y=l((function(){return z?z.filter((function(t){return"link"===t.type})).map((function(t){var o=e(t,["type"]);return s.createElement(v,Object.assign({key:o.href,className:N.actionLink},o))})):null}),[z]),Z=l((function(){return void 0!==X&&(null==z?void 0:z.length)!==X}),[z,X]),$=l((function(){return z?z.filter((function(t){return"button"===t.type})).map((function(o,i){var n=o.content,a=e(o,["type","content"]);return s.createElement(T,Object.assign({key:"alert-button-".concat(i),className:r(N.actionButton,t({},N.withTransition,Z))},a),n)})):null}),[z,Z]),tt=l((function(){return r(N.toast,x(N,o("type-"+S)),q)}),[S,q]),et=c((function(){U&&U()}),[U]),ot=a(void 0),it=c((function(t){U&&null!=t&&(clearTimeout(ot.current),ot.current=setTimeout((function(){et()}),t))}),[et,U]);m((function(){return E&&A>0&&it(A),function(){clearTimeout(ot.current)}}),[E,A,it]);var nt=!I&&h(S,_),rt=c((function(t){var e=t.style.width;t.style.width="auto";var o=getComputedStyle(t).width;t.style.width=e,t.style.width=o}),[]);return m((function(){V.current&&rt(V.current)}),[F,rt]),s.createElement(u,{in:E,nodeRef:W,classNames:{enterActive:N.enterActive,exitActive:N.exitActive},timeout:400,unmountOnExit:!0},s.createElement(p,{ref:W,id:G,"data-testid":Q||i(n.TOAST,G),type:"text2",element:"div",color:"fixedLight",className:tt,role:"alert","aria-live":"polite"},nt&&s.createElement("div",{className:r(N.icon)},nt),s.createElement(f,{align:"center",gap:"large",className:N.content},s.createElement(f,{gap:"medium","data-testid":i(n.TOAST_CONTENT),className:N.textContent},s.createElement("span",null,F),Y),($||P)&&($||P),L&&s.createElement(d,{size:"xs"})),M&&s.createElement(C,{className:r(N.closeButton),onClick:et,size:"small",kind:"tertiary",color:"fixed-light",ariaLabel:K,"data-testid":i(n.TOAST_CLOSE_BUTTON),icon:k,hideTooltip:!0})))}),{types:j,actionTypes:y});export{B as default};
1
+ import{defineProperty as t}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{__rest as e}from"../../../_virtual/_tslib.js";import{camelCase as o}from"lodash-es";import{getTestId as r,ComponentDefaultTestId as i}from"../../tests/testIds.js";import n from"classnames";import s,{useRef as a,useMemo as l,useCallback as c,useEffect as m}from"react";import{CSSTransition as u}from"react-transition-group";import p from"../Text/Text.js";import d from"../Loader/Loader.js";import f from"../Flex/Flex.js";import v from"./ToastLink/ToastLink.js";import T from"./ToastButton/ToastButton.js";import{ToastType as j,ToastActionType as y}from"./ToastConstants.js";import{getIcon as h}from"./ToastHelpers.js";import{NOOP as g}from"../../utils/function-utils.js";import{getStyle as x}from"../../helpers/typesciptCssModulesHelper.js";import{withStaticPropsWithoutForwardRef as E}from"../../types/withStaticProps.js";import"../../utils/colors-vars-map.js";import N from"./Toast.module.scss.js";import C from"../IconButton/IconButton.js";import b from"../../hooks/usePrevious/index.js";import k from"../../../icons/dist/react/CloseSmall.js";var B=E((function(j){var y=j.open,E=void 0!==y&&y,B=j.loading,L=void 0!==B&&B,O=j.autoHideDuration,A=void 0===O?null:O,w=j.type,S=void 0===w?"normal":w,_=j.icon,H=j.hideIcon,I=void 0!==H&&H,P=j.action,z=j.actions,F=j.children,D=j.closeable,M=void 0===D||D,U=j.onClose,q=void 0===U?g:U,G=j.className,J=j.id,K=j.closeButtonAriaLabel,Q=void 0===K?"Close":K,R=j["data-testid"],V=a(null),W=b(null==z?void 0:z.length),X=l((function(){return z?z.filter((function(t){return"link"===t.type})).map((function(t){var o=e(t,["type"]);return s.createElement(v,Object.assign({key:o.href,className:N.actionLink},o))})):null}),[z]),Y=l((function(){return void 0!==W&&(null==z?void 0:z.length)!==W}),[z,W]),Z=l((function(){return z?z.filter((function(t){return"button"===t.type})).map((function(o,r){var i=o.content,a=e(o,["type","content"]);return s.createElement(T,Object.assign({key:"alert-button-".concat(r),className:n(N.actionButton,t({},N.withTransition,Y))},a),i)})):null}),[z,Y]),$=l((function(){return n(N.toast,x(N,o("type-"+S)),G)}),[S,G]),tt=c((function(){q&&q()}),[q]),et=a(),ot=c((function(t){q&&null!=t&&(clearTimeout(et.current),et.current=setTimeout((function(){tt()}),t))}),[tt,q]);m((function(){return E&&A>0&&ot(A),function(){clearTimeout(et.current)}}),[E,A,ot]);var rt=!I&&h(S,_),it=c((function(t){var e=t.style.width;t.style.width="auto";var o=getComputedStyle(t).width;t.style.width=e,t.style.width=o}),[]);return m((function(){V.current&&it(V.current)}),[F,it]),s.createElement(u,{in:E,classNames:{enterActive:N.enterActive,exitActive:N.exitActive},timeout:400,unmountOnExit:!0},s.createElement(p,{id:J,"data-testid":R||r(i.TOAST,J),type:"text2",element:"div",color:"fixedLight",className:$,role:"alert","aria-live":"polite",ref:V},rt&&s.createElement("div",{className:n(N.icon)},rt),s.createElement(f,{align:"center",gap:"large",className:N.content},s.createElement(f,{gap:"medium","data-testid":r(i.TOAST_CONTENT),className:N.textContent},s.createElement("span",null,F),X),(Z||P)&&(Z||P),L&&s.createElement(d,{size:"xs"})),M&&s.createElement(C,{className:n(N.closeButton),onClick:tt,size:"small",kind:"tertiary",color:"fixed-light",ariaLabel:Q,"data-testid":r(i.TOAST_CLOSE_BUTTON),icon:k,hideTooltip:!0})))}),{types:j,actionTypes:y});export{B as default};
2
2
  //# sourceMappingURL=Toast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Toast.js","sources":["../../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import { camelCase } from \"lodash-es\";\nimport { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport cx from \"classnames\";\nimport React, { ReactElement, useCallback, useEffect, useMemo, useRef, type JSX } from \"react\";\nimport { CSSTransition } from \"react-transition-group\";\nimport { IconSubComponentProps } from \"../Icon/Icon\";\nimport Text from \"../Text/Text\";\nimport Loader from \"../Loader/Loader\";\nimport Flex from \"../Flex/Flex\";\nimport { CloseSmall } from \"@vibe/icons\";\nimport ToastLink from \"./ToastLink/ToastLink\";\nimport ToastButton from \"./ToastButton/ToastButton\";\nimport { ToastActionType as ToastActionTypeEnum, ToastType as ToastTypeEnum } from \"./ToastConstants\";\nimport { ToastType, ToastAction } from \"./Toast.types\";\nimport { getIcon } from \"./ToastHelpers\";\nimport { NOOP } from \"../../utils/function-utils\";\nimport { getStyle } from \"../../helpers/typesciptCssModulesHelper\";\nimport { VibeComponentProps, withStaticPropsWithoutForwardRef } from \"../../types\";\nimport styles from \"./Toast.module.scss\";\nimport IconButton from \"../IconButton/IconButton\";\nimport usePrevious from \"../../hooks/usePrevious\";\n\nexport interface ToastProps extends VibeComponentProps {\n /**\n * The actions available in the toast.\n */\n actions?: ToastAction[];\n /**\n * If true, the toast is open (visible).\n */\n open?: boolean;\n /**\n * If true, displays a loading indicator inside the toast.\n */\n loading?: boolean;\n /**\n * The type of toast.\n */\n type?: ToastType;\n /**\n * The icon displayed in the toast.\n */\n icon?: string | React.FC<IconSubComponentProps> | null;\n /**\n * If true, hides the toast icon.\n */\n hideIcon?: boolean;\n /**\n * The action element displayed in the toast.\n */\n action?: JSX.Element;\n /**\n * If false, hides the close button.\n */\n closeable?: boolean;\n /**\n * Callback fired when the toast is closed.\n */\n onClose?: () => void;\n /**\n * The number of milliseconds before the toast automatically closes.\n * (0 or null disables auto-close behavior).\n */\n autoHideDuration?: number;\n /**\n * The content displayed inside the toast.\n */\n children?: ReactElement<any> | ReactElement<any>[] | string;\n /**\n * The aria-label for the close button.\n */\n closeButtonAriaLabel?: string;\n}\n\nconst Toast = ({\n open = false,\n loading = false,\n autoHideDuration = null,\n type = \"normal\",\n icon,\n hideIcon = false,\n action: deprecatedAction,\n actions,\n children,\n closeable = true,\n onClose = NOOP,\n className,\n id,\n closeButtonAriaLabel = \"Close\",\n \"data-testid\": dataTestId\n}: ToastProps) => {\n const ref = useRef(null);\n const nodeRef = useRef<HTMLDivElement>(null);\n const prevActions = usePrevious(actions?.length);\n const toastLinks = useMemo(() => {\n return actions\n ? actions\n .filter(action => action.type === \"link\")\n .map(({ type: _type, ...otherProps }) => (\n <ToastLink key={otherProps.href} className={styles.actionLink} {...otherProps} />\n ))\n : null;\n }, [actions]);\n\n const shouldShowButtonTransition = useMemo(() => {\n return prevActions !== undefined && actions?.length !== prevActions;\n }, [actions, prevActions]);\n\n const toastButtons: JSX.Element[] | null = useMemo(() => {\n return actions\n ? actions\n .filter(action => action.type === \"button\")\n .map(({ type: _type, content, ...otherProps }, index) => (\n <ToastButton\n key={`alert-button-${index}`}\n className={cx(styles.actionButton, { [styles.withTransition]: shouldShowButtonTransition })}\n {...otherProps}\n >\n {content}\n </ToastButton>\n ))\n : null;\n }, [actions, shouldShowButtonTransition]);\n\n const classNames = useMemo(\n () => cx(styles.toast, getStyle(styles, camelCase(\"type-\" + type)), className),\n [type, className]\n );\n\n const handleClose = useCallback(() => {\n if (onClose) {\n onClose();\n }\n }, [onClose]);\n\n /* Timer */\n const timerAutoHide = useRef<NodeJS.Timeout>(undefined);\n const setAutoHideTimer = useCallback(\n (duration: number) => {\n if (!onClose || duration == null) {\n return;\n }\n\n clearTimeout(timerAutoHide.current);\n timerAutoHide.current = setTimeout(() => {\n handleClose();\n }, duration);\n },\n [handleClose, onClose]\n );\n\n useEffect(() => {\n if (open && autoHideDuration > 0) {\n setAutoHideTimer(autoHideDuration);\n }\n\n return () => {\n clearTimeout(timerAutoHide.current);\n };\n }, [open, autoHideDuration, setAutoHideTimer]);\n\n const iconElement = !hideIcon && getIcon(type, icon);\n\n // https://n12v.com/css-transition-to-from-auto/\n const recalculateElementWidth = useCallback((element: HTMLElement) => {\n const prevWidth = element.style.width;\n element.style.width = \"auto\";\n const endWidth = getComputedStyle(element).width;\n element.style.width = prevWidth;\n element.offsetWidth; // force repaint\n element.style.width = endWidth;\n }, []);\n\n useEffect(() => {\n if (ref.current) {\n recalculateElementWidth(ref.current);\n }\n }, [children, recalculateElementWidth]);\n\n return (\n <CSSTransition\n in={open}\n nodeRef={nodeRef}\n classNames={{ enterActive: styles.enterActive, exitActive: styles.exitActive }}\n timeout={400}\n unmountOnExit\n >\n <Text\n ref={nodeRef}\n id={id}\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.TOAST, id)}\n type=\"text2\"\n element=\"div\"\n color=\"fixedLight\"\n className={classNames}\n role=\"alert\"\n aria-live=\"polite\"\n >\n {iconElement && <div className={cx(styles.icon)}>{iconElement}</div>}\n <Flex align=\"center\" gap=\"large\" className={styles.content}>\n <Flex\n gap=\"medium\"\n data-testid={getTestId(ComponentDefaultTestId.TOAST_CONTENT)}\n className={styles.textContent}\n >\n <span>{children}</span>\n {toastLinks}\n </Flex>\n {(toastButtons || deprecatedAction) && (toastButtons || deprecatedAction)}\n {loading && <Loader size=\"xs\" />}\n </Flex>\n {closeable && (\n <IconButton\n className={cx(styles.closeButton)}\n onClick={handleClose}\n size=\"small\"\n kind=\"tertiary\"\n color=\"fixed-light\"\n ariaLabel={closeButtonAriaLabel}\n data-testid={getTestId(ComponentDefaultTestId.TOAST_CLOSE_BUTTON)}\n icon={CloseSmall}\n hideTooltip\n />\n )}\n </Text>\n </CSSTransition>\n );\n};\n\ninterface ToastStaticProps {\n types: typeof ToastTypeEnum;\n actionTypes: typeof ToastActionTypeEnum;\n}\n\nexport default withStaticPropsWithoutForwardRef<ToastProps, ToastStaticProps>(Toast, {\n types: ToastTypeEnum,\n actionTypes: ToastActionTypeEnum\n});\n"],"names":["withStaticPropsWithoutForwardRef","_ref","_ref$open","open","_ref$loading","loading","_ref$autoHideDuration","autoHideDuration","_ref$type","type","icon","_ref$hideIcon","hideIcon","deprecatedAction","action","actions","children","_ref$closeable","closeable","_ref$onClose","onClose","NOOP","className","id","_ref$closeButtonAriaL","closeButtonAriaLabel","dataTestId","ref","useRef","nodeRef","prevActions","usePrevious","length","toastLinks","useMemo","filter","map","_a","otherProps","__rest","React","createElement","ToastLink","key","href","styles","actionLink","shouldShowButtonTransition","undefined","toastButtons","index","content","ToastButton","Object","assign","concat","cx","actionButton","_defineProperty","withTransition","classNames","toast","getStyle","camelCase","handleClose","useCallback","timerAutoHide","setAutoHideTimer","duration","clearTimeout","current","setTimeout","useEffect","iconElement","getIcon","recalculateElementWidth","element","prevWidth","style","width","endWidth","getComputedStyle","CSSTransition","in","enterActive","exitActive","timeout","unmountOnExit","Text","getTestId","ComponentDefaultTestId","TOAST","color","role","Flex","align","gap","TOAST_CONTENT","textContent","Loader","size","IconButton","closeButton","onClick","kind","ariaLabel","TOAST_CLOSE_BUTTON","CloseSmall","hideTooltip","types","ToastTypeEnum","actionTypes","ToastActionTypeEnum"],"mappings":"4mCA0EA,IAgKeA,EAAAA,GAhKD,SAAHC,GAgBM,IAAAC,EAAAD,EAffE,KAAAA,OAAO,IAAHD,GAAQA,EAAAE,EAAAH,EACZI,QAAAA,OAAU,IAAHD,GAAQA,EAAAE,EAAAL,EACfM,iBAAAA,OAAmB,IAAHD,EAAG,KAAIA,EAAAE,EAAAP,EACvBQ,KAAAA,OAAO,IAAHD,EAAG,SAAQA,EACfE,EAAIT,EAAJS,KAAIC,EAAAV,EACJW,SAAAA,OAAW,IAAHD,GAAQA,EACRE,EAAgBZ,EAAxBa,OACAC,EAAOd,EAAPc,QACAC,EAAQf,EAARe,SAAQC,EAAAhB,EACRiB,UAAAA,OAAY,IAAHD,GAAOA,EAAAE,EAAAlB,EAChBmB,QAAAA,OAAUC,IAAHF,EAAGE,EAAIF,EACdG,EAASrB,EAATqB,UACAC,EAAEtB,EAAFsB,GAAEC,EAAAvB,EACFwB,qBAAAA,OAAuB,IAAHD,EAAG,QAAOA,EACfE,EAAUzB,EAAzB,eAEM0B,EAAMC,EAAO,MACbC,EAAUD,EAAuB,MACjCE,EAAcC,EAAYhB,aAAO,EAAPA,EAASiB,QACnCC,EAAaC,GAAQ,WACzB,OAAOnB,EACHA,EACGoB,QAAO,SAAArB,GAAM,MAAoB,SAAhBA,EAAOL,IAAe,IACvC2B,KAAI,SAACC,GAAkBC,IAAAA,EAAUC,EAAAF,EAA5B,UAAmC,OACvCG,EAACC,cAAAC,iBAAUC,IAAKL,EAAWM,KAAMtB,UAAWuB,EAAOC,YAAgBR,G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D,EAAQE,MAAMC,MAAQC,CACvB,GAAE,IAQH,OANAR,GAAU,WACJ7C,EAAI2C,SACNK,GAAwBhD,EAAI2C,QAEhC,GAAG,CAACtD,EAAU2D,KAGZnC,EAAAC,cAACyC,EAAa,CACZC,GAAIhF,EACJ0B,QAASA,EACT+B,WAAY,CAAEwB,YAAavC,EAAOuC,YAAaC,WAAYxC,EAAOwC,YAClEC,QAAS,IACTC,eAAa,GAEb/C,EAAAC,cAAC+C,EACC,CAAA7D,IAAKE,EACLN,GAAIA,EACS,cAAAG,GAAc+D,EAAUC,EAAuBC,MAAOpE,GACnEd,KAAK,QACLmE,QAAQ,MACRgB,MAAM,aACNtE,UAAWsC,GACXiC,KAAK,oBACK,UAETpB,IAAejC,EAAAC,cAAA,MAAA,CAAKnB,UAAWkC,EAAGX,EAAOnC,OAAQ+D,IAClDjC,EAAAC,cAACqD,EAAI,CAACC,MAAM,SAASC,IAAI,QAAQ1E,UAAWuB,EAAOM,SACjDX,EAAAC,cAACqD,EACC,CAAAE,IAAI,uBACSP,EAAUC,EAAuBO,eAC9C3E,UAAWuB,EAAOqD,aAElB1D,EAAAC,cAAA,OAAA,KAAOzB,GACNiB,IAEDgB,GAAgBpC,KAAsBoC,GAAgBpC,GACvDR,GAAWmC,gBAAC2D,EAAM,CAACC,KAAK,QAE1BlF,GACCsB,EAACC,cAAA4D,GACC/E,UAAWkC,EAAGX,EAAOyD,aACrBC,QAASvC,GACToC,KAAK,QACLI,KAAK,WACLZ,MAAM,cACNa,UAAWhF,EACE,cAAAgE,EAAUC,EAAuBgB,oBAC9ChG,KAAMiG,EACNC,kBAMZ,GAOqF,CACnFC,MAAOC,EACPC,YAAaC"}
1
+ {"version":3,"file":"Toast.js","sources":["../../../../src/components/Toast/Toast.tsx"],"sourcesContent":["import { camelCase } from \"lodash-es\";\nimport { ComponentDefaultTestId, getTestId } from \"../../tests/test-ids-utils\";\nimport cx from \"classnames\";\nimport React, { ReactElement, useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { CSSTransition } from \"react-transition-group\";\nimport { IconSubComponentProps } from \"../Icon/Icon\";\nimport Text from \"../Text/Text\";\nimport Loader from \"../Loader/Loader\";\nimport Flex from \"../Flex/Flex\";\nimport { CloseSmall } from \"@vibe/icons\";\nimport ToastLink from \"./ToastLink/ToastLink\";\nimport ToastButton from \"./ToastButton/ToastButton\";\nimport { ToastActionType as ToastActionTypeEnum, ToastType as ToastTypeEnum } from \"./ToastConstants\";\nimport { ToastType, ToastAction } from \"./Toast.types\";\nimport { getIcon } from \"./ToastHelpers\";\nimport { NOOP } from \"../../utils/function-utils\";\nimport { getStyle } from \"../../helpers/typesciptCssModulesHelper\";\nimport { VibeComponentProps, withStaticPropsWithoutForwardRef } from \"../../types\";\nimport styles from \"./Toast.module.scss\";\nimport IconButton from \"../IconButton/IconButton\";\nimport usePrevious from \"../../hooks/usePrevious\";\n\nexport interface ToastProps extends VibeComponentProps {\n /**\n * The actions available in the toast.\n */\n actions?: ToastAction[];\n /**\n * If true, the toast is open (visible).\n */\n open?: boolean;\n /**\n * If true, displays a loading indicator inside the toast.\n */\n loading?: boolean;\n /**\n * The type of toast.\n */\n type?: ToastType;\n /**\n * The icon displayed in the toast.\n */\n icon?: string | React.FC<IconSubComponentProps> | null;\n /**\n * If true, hides the toast icon.\n */\n hideIcon?: boolean;\n /**\n * The action element displayed in the toast.\n */\n action?: JSX.Element;\n /**\n * If false, hides the close button.\n */\n closeable?: boolean;\n /**\n * Callback fired when the toast is closed.\n */\n onClose?: () => void;\n /**\n * The number of milliseconds before the toast automatically closes.\n * (0 or null disables auto-close behavior).\n */\n autoHideDuration?: number;\n /**\n * The content displayed inside the toast.\n */\n children?: ReactElement | ReactElement[] | string;\n /**\n * The aria-label for the close button.\n */\n closeButtonAriaLabel?: string;\n}\n\nconst Toast = ({\n open = false,\n loading = false,\n autoHideDuration = null,\n type = \"normal\",\n icon,\n hideIcon = false,\n action: deprecatedAction,\n actions,\n children,\n closeable = true,\n onClose = NOOP,\n className,\n id,\n closeButtonAriaLabel = \"Close\",\n \"data-testid\": dataTestId\n}: ToastProps) => {\n const ref = useRef(null);\n const prevActions = usePrevious(actions?.length);\n const toastLinks = useMemo(() => {\n return actions\n ? actions\n .filter(action => action.type === \"link\")\n .map(({ type: _type, ...otherProps }) => (\n <ToastLink key={otherProps.href} className={styles.actionLink} {...otherProps} />\n ))\n : null;\n }, [actions]);\n\n const shouldShowButtonTransition = useMemo(() => {\n return prevActions !== undefined && actions?.length !== prevActions;\n }, [actions, prevActions]);\n\n const toastButtons: JSX.Element[] | null = useMemo(() => {\n return actions\n ? actions\n .filter(action => action.type === \"button\")\n .map(({ type: _type, content, ...otherProps }, index) => (\n <ToastButton\n key={`alert-button-${index}`}\n className={cx(styles.actionButton, { [styles.withTransition]: shouldShowButtonTransition })}\n {...otherProps}\n >\n {content}\n </ToastButton>\n ))\n : null;\n }, [actions, shouldShowButtonTransition]);\n\n const classNames = useMemo(\n () => cx(styles.toast, getStyle(styles, camelCase(\"type-\" + type)), className),\n [type, className]\n );\n\n const handleClose = useCallback(() => {\n if (onClose) {\n onClose();\n }\n }, [onClose]);\n\n /* Timer */\n const timerAutoHide = useRef<NodeJS.Timeout>();\n const setAutoHideTimer = useCallback(\n (duration: number) => {\n if (!onClose || duration == null) {\n return;\n }\n\n clearTimeout(timerAutoHide.current);\n timerAutoHide.current = setTimeout(() => {\n handleClose();\n }, duration);\n },\n [handleClose, onClose]\n );\n\n useEffect(() => {\n if (open && autoHideDuration > 0) {\n setAutoHideTimer(autoHideDuration);\n }\n\n return () => {\n clearTimeout(timerAutoHide.current);\n };\n }, [open, autoHideDuration, setAutoHideTimer]);\n\n const iconElement = !hideIcon && getIcon(type, icon);\n\n // https://n12v.com/css-transition-to-from-auto/\n const recalculateElementWidth = useCallback((element: HTMLElement) => {\n const prevWidth = element.style.width;\n element.style.width = \"auto\";\n const endWidth = getComputedStyle(element).width;\n element.style.width = prevWidth;\n element.offsetWidth; // force repaint\n element.style.width = endWidth;\n }, []);\n\n useEffect(() => {\n if (ref.current) {\n recalculateElementWidth(ref.current);\n }\n }, [children, recalculateElementWidth]);\n\n return (\n <CSSTransition\n in={open}\n classNames={{ enterActive: styles.enterActive, exitActive: styles.exitActive }}\n timeout={400}\n unmountOnExit\n >\n <Text\n id={id}\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.TOAST, id)}\n type=\"text2\"\n element=\"div\"\n color=\"fixedLight\"\n className={classNames}\n role=\"alert\"\n aria-live=\"polite\"\n ref={ref}\n >\n {iconElement && <div className={cx(styles.icon)}>{iconElement}</div>}\n <Flex align=\"center\" gap=\"large\" className={styles.content}>\n <Flex\n gap=\"medium\"\n data-testid={getTestId(ComponentDefaultTestId.TOAST_CONTENT)}\n className={styles.textContent}\n >\n <span>{children}</span>\n {toastLinks}\n </Flex>\n {(toastButtons || deprecatedAction) && (toastButtons || deprecatedAction)}\n {loading && <Loader size=\"xs\" />}\n </Flex>\n {closeable && (\n <IconButton\n className={cx(styles.closeButton)}\n onClick={handleClose}\n size=\"small\"\n kind=\"tertiary\"\n color=\"fixed-light\"\n ariaLabel={closeButtonAriaLabel}\n data-testid={getTestId(ComponentDefaultTestId.TOAST_CLOSE_BUTTON)}\n icon={CloseSmall}\n hideTooltip\n />\n )}\n </Text>\n </CSSTransition>\n );\n};\n\ninterface ToastStaticProps {\n types: typeof ToastTypeEnum;\n actionTypes: typeof ToastActionTypeEnum;\n}\n\nexport default withStaticPropsWithoutForwardRef<ToastProps, ToastStaticProps>(Toast, {\n types: ToastTypeEnum,\n actionTypes: ToastActionTypeEnum\n});\n"],"names":["withStaticPropsWithoutForwardRef","_ref","_ref$open","open","_ref$loading","loading","_ref$autoHideDuration","autoHideDuration","_ref$type","type","icon","_ref$hideIcon","hideIcon","deprecatedAction","action","actions","children","_ref$closeable","closeable","_ref$onClose","onClose","NOOP","className","id","_ref$closeButtonAriaL","closeButtonAriaLabel","dataTestId","ref","useRef","prevActions","usePrevious","length","toastLinks","useMemo","filter","map","_a","otherProps","__rest","React","createElement","ToastLink","key","href","styles","actionLink","shouldShowButtonTransition","undefined","toastButtons","index","content","ToastButton","Object","assign","concat","cx","actionButton","_defineProperty","withTransition","classNames","toast","getStyle","camelCase","handleClose","useCallback","timerAutoHide","setAutoHideTimer","duration","clearTimeout","current","setTimeout","useEffect","iconElement","getIcon","recalculateElementWidth","element","prevWidth","style","width","endWidth","getComputedStyle","CSSTransition","in","enterActive","exitActive","timeout","unmountOnExit","Text","getTestId","ComponentDefaultTestId","TOAST","color","role","Flex","align","gap","TOAST_CONTENT","textContent","Loader","size","IconButton","closeButton","onClick","kind","ariaLabel","TOAST_CLOSE_BUTTON","CloseSmall","hideTooltip","types","ToastTypeEnum","actionTypes","ToastActionTypeEnum"],"mappings":"4mCA0EA,IA8JeA,EAAAA,GA9JD,SAAHC,GAgBM,IAAAC,EAAAD,EAffE,KAAAA,OAAO,IAAHD,GAAQA,EAAAE,EAAAH,EACZI,QAAAA,OAAU,IAAHD,GAAQA,EAAAE,EAAAL,EACfM,iBAAAA,OAAmB,IAAHD,EAAG,KAAIA,EAAAE,EAAAP,EACvBQ,KAAAA,OAAO,IAAHD,EAAG,SAAQA,EACfE,EAAIT,EAAJS,KAAIC,EAAAV,EACJW,SAAAA,OAAW,IAAHD,GAAQA,EACRE,EAAgBZ,EAAxBa,OACAC,EAAOd,EAAPc,QACAC,EAAQf,EAARe,SAAQC,EAAAhB,EACRiB,UAAAA,OAAY,IAAHD,GAAOA,EAAAE,EAAAlB,EAChBmB,QAAAA,OAAUC,IAAHF,EAAGE,EAAIF,EACdG,EAASrB,EAATqB,UACAC,EAAEtB,EAAFsB,GAAEC,EAAAvB,EACFwB,qBAAAA,OAAuB,IAAHD,EAAG,QAAOA,EACfE,EAAUzB,EAAzB,eAEM0B,EAAMC,EAAO,MACbC,EAAcC,EAAYf,aAAO,EAAPA,EAASgB,QACnCC,EAAaC,GAAQ,WACzB,OAAOlB,EACHA,EACGmB,QAAO,SAAApB,GAAM,MAAoB,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_virtual/_tslib.js";import s from"../../Button/Button.js";import a from"react";import{ComponentDefaultTestId as e}from"../../../tests/constants.js";import{getTestId as r}from"../../../tests/testIds.js";var i=function(i){var o=i.className,m=i.id,d=i["data-testid"],n=t(i,["className","id","data-testid"]);return a.createElement(s,Object.assign({},n,{id:m,kind:"secondary",marginLeft:!1,"data-testid":d||r(e.TOAST_BUTTON,m),className:o,size:"small",color:"fixed-light"}))};export{i as default};
1
+ import{__rest as t}from"../../../../_virtual/_tslib.js";import s from"../../Button/Button.js";import a from"react";import{ComponentDefaultTestId as e}from"../../../tests/constants.js";import{getTestId as i}from"../../../tests/testIds.js";var r=function(r){var o=r.className,m=r.id,d=r["data-testid"],n=t(r,["className","id","data-testid"]),c=Object.assign(Object.assign(Object.assign({},s.defaultProps),{kind:"secondary",marginLeft:!1}),n);return a.createElement(s,Object.assign({},c,{id:m,"data-testid":d||i(e.TOAST_BUTTON,m),className:o,size:"small",color:"fixed-light"}))};export{r as default};
2
2
  //# sourceMappingURL=ToastButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ToastButton.js","sources":["../../../../../src/components/Toast/ToastButton/ToastButton.tsx"],"sourcesContent":["import Button, { ButtonProps } from \"../../Button/Button\";\nimport React, { FC } from \"react\";\nimport { ComponentDefaultTestId } from \"../../../tests/constants\";\nimport { getTestId } from \"../../../tests/test-ids-utils\";\n\nexport type ToastButtonProps = ButtonProps;\n\nconst ToastButton: FC<ToastButtonProps> = ({\n className,\n id,\n \"data-testid\": dataTestId,\n ...buttonProps\n}: ToastButtonProps) => {\n return (\n <Button\n {...buttonProps}\n id={id}\n kind=\"secondary\"\n marginLeft={false}\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.TOAST_BUTTON, id)}\n className={className}\n size=\"small\"\n color=\"fixed-light\"\n />\n );\n};\n\nexport default ToastButton;\n"],"names":["ToastButton","_a","className","id","dataTestId","buttonProps","__rest","React","createElement","Button","kind","marginLeft","getTestId","ComponentDefaultTestId","TOAST_BUTTON","size","color"],"mappings":"8OAOA,IAAMA,EAAoC,SAACC,GAAA,IACzCC,EAEyBD,EAFzBC,UACAC,EACyBF,EADzBE,GACeC,EAAUH,EAAzB,eACGI,EAJsCC,EAAAL,EAAA,CAAA,YAAA,KAAA,gBAMzC,OACEM,EAACC,cAAAC,mBACKJ,EAAW,CACfF,GAAIA,EACJO,KAAK,YACLC,YAAY,EAAK,cACJP,GAAcQ,EAAUC,EAAuBC,aAAcX,GAC1ED,UAAWA,EACXa,KAAK,QACLC,MAAM,gBAGZ"}
1
+ {"version":3,"file":"ToastButton.js","sources":["../../../../../src/components/Toast/ToastButton/ToastButton.tsx"],"sourcesContent":["import Button, { ButtonProps } from \"../../Button/Button\";\nimport React, { FC } from \"react\";\nimport { ComponentDefaultTestId } from \"../../../tests/constants\";\nimport { getTestId } from \"../../../tests/test-ids-utils\";\nimport { ButtonType } from \"../../Button\";\n\nexport type ToastButtonProps = ButtonProps;\n\nconst ToastButton: FC<ToastButtonProps> = ({\n className,\n id,\n \"data-testid\": dataTestId,\n ...buttonProps\n}: ToastButtonProps) => {\n const overrideButtonProps = {\n ...Button.defaultProps,\n kind: \"secondary\" as ButtonType,\n marginLeft: false,\n ...buttonProps\n };\n\n return (\n <Button\n {...overrideButtonProps}\n id={id}\n data-testid={dataTestId || getTestId(ComponentDefaultTestId.TOAST_BUTTON, id)}\n className={className}\n size=\"small\"\n color=\"fixed-light\"\n />\n );\n};\n\nexport default ToastButton;\n"],"names":["ToastButton","_a","className","id","dataTestId","buttonProps","__rest","overrideButtonProps","Object","assign","Button","defaultProps","kind","marginLeft","React","createElement","getTestId","ComponentDefaultTestId","TOAST_BUTTON","size","color"],"mappings":"8OAQA,IAAMA,EAAoC,SAACC,GAAA,IACzCC,EAEyBD,EAFzBC,UACAC,EACyBF,EADzBE,GACeC,EAAUH,EAAzB,eACGI,EAJsCC,EAAAL,EAAA,CAAA,YAAA,KAAA,gBAMnCM,EACDC,OAAAC,OAAAD,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAAAC,EAAOC,eACVC,KAAM,YACNC,YAAY,IACTR,GAGL,OACES,EAAAC,cAACL,EAAMF,OAAAC,OAAA,CAAA,EACDF,EACJ,CAAAJ,GAAIA,gBACSC,GAAcY,EAAUC,EAAuBC,aAAcf,GAC1ED,UAAWA,EACXiB,KAAK,QACLC,MAAM,gBAGZ"}
@@ -1,2 +1,2 @@
1
- import{regeneratorRuntime as e,createForOfIteratorHelper as t}from"../../_virtual/_rollupPluginBabelHelpers.js";import{__awaiter as n}from"../../_virtual/_tslib.js";import{userEvent as r,within as o,fireEvent as a}from"@storybook/test";import{waitFor as i}from"@testing-library/react";import{NavigationCommand as c}from"./constants.js";import{expect as u}from"@storybook/jest";var s=function(t){return function(r){var o=r.canvasElement,a=r.args;return n(void 0,void 0,void 0,e().mark((function n(){var r;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=p(o),e.abrupt("return",t(r,a));case 2:case"end":return e.stop()}}),n)})))}},v=function(t){return n(void 0,void 0,void 0,e().mark((function n(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.clear(t);case 1:case"end":return e.stop()}}),n)})))};function f(e){u(" ➡️ ".concat(e)).toBeDefined()}function l(e){var t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}var d=function(e){var t=e.toElm,n=e.toCoords,r=e.delta,o=e.from;return n?Object.assign(Object.assign({},o),n):t?l(t):r?{x:o.x+r.x,y:o.y+r.y}:{x:o.x+10,y:o.y+0}};function p(e){if(e instanceof HTMLElement){var t=o(e);if(t instanceof Error)throw t;return t}if(e.getByRole)return e}var x=c,m=function(r){var o=r.beforeEach,a=void 0===o?null:o,i=r.beforeAll,c=void 0===i?null:i,u=r.skip,v=void 0!==u&&u,l=r.tests,d=r.afterEach,p=void 0===d?null:d,x=r.afterAll,m=void 0===x?null:x;return function(r){var o=r.canvasElement,i=r.args;return n(void 0,void 0,void 0,e().mark((function n(){var r,u,d,x;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!v){e.next=2;break}return e.abrupt("return");case 2:if(!c){e.next=6;break}return f("Before all:"),e.next=6,s(c)({canvasElement:o,args:i});case 6:r=t(l),e.prev=7,r.s();case 9:if((u=r.n()).done){e.next=25;break}if(x=(d=u.value).name,!a){e.next=16;break}return f("Before: ".concat(x)),e.next=16,s(a)({canvasElement:o,args:i});case 16:return f("Running : ".concat(x)),e.next=19,s(d)({canvasElement:o,args:i});case 19:if(!p){e.next=23;break}return f("After: ".concat(x)),e.next=23,s(p)({canvasElement:o,args:i});case 23:e.next=9;break;case 25:e.next=30;break;case 27:e.prev=27,e.t0=e.catch(7),r.e(e.t0);case 30:return e.prev=30,r.f(),e.finish(30);case 33:if(!m){e.next=37;break}return f("After all:"),e.next=37,s(m)({canvasElement:o,args:i});case 37:case"end":return e.stop()}}),n,null,[[7,27,30,33]])})))}},g=function(e,t){return p(e).getByTestId(t)},y=function(e,t){return p(e).getAllByTestId(t)},b=function(e,t){return p(e).getByPlaceholderText(t)},h=function(e,t){return p(e).getAllByPlaceholderText(t)},k=function(e){return document.getElementsByClassName(e)},w=function(e){return document.getElementsByClassName(e)[0]},B=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return p(e).getByRole(t,n)},E=function(e,t){return p(e).getAllByRole(t)},T=function(e,t){return p(e).getByLabelText(t)},A=function(e,t){return p(e).getAllByLabelText(t)},C=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return p(e).getByText(t,n)},R=function(e,t){return p(e).getAllByText(t)},j=function(e){return r.click(e)},H=function(e){return r.hover(e)},P=function(t,o){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:250;return n(void 0,void 0,void 0,e().mark((function n(){var i,c;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r.type(t,o,{delay:50}),e.next=3,i;case 3:return c=e.sent,e.next=6,L(a);case 6:return e.abrupt("return",c);case 7:case"end":return e.stop()}}),n)})))},O=function(e){u(document.activeElement).toHaveTextContent(RegExp("^".concat(e,"$")))},_=function(e){u(document.activeElement).toHaveTextContent(e)},I=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c.TAB,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return n(void 0,void 0,void 0,e().mark((function n(){var a,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t===c.TAB?r.tab():r.keyboard(t),e.next=3,a;case 3:return i=e.sent,e.next=6,L(o);case 6:return e.abrupt("return",i);case 7:case"end":return e.stop()}}),n)})))};function L(e){return new Promise((function(t){if(!e)return t(void 0);setTimeout(t,e)}))}var M=function(t){return new Promise((function(r){var o;i((function(){return n(void 0,void 0,void 0,e().mark((function n(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t();case 2:u(o=e.sent).toBeVisible();case 4:case"end":return e.stop()}}),n)})))})).then((function(){r(o)}))}))},N=function(t,o){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{delay:70};return n(void 0,void 0,void 0,e().mark((function n(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=t.repeat(o),e.next=3,r.keyboard(t,a);case 3:case"end":return e.stop()}}),n)})))};function D(t,o){var i=o.delta,c=void 0===i?void 0:i,u=o.toCoords,s=void 0===u?void 0:u,v=o.toElm,f=void 0===v?void 0:v,p=o.steps,x=void 0===p?20:p,m=o.duration,g=void 0===m?100:m;return n(this,void 0,void 0,e().mark((function n(){var o,i,u,v,p;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=l(t),i=d({toElm:f,toCoords:s,delta:c,from:o}),u={x:(i.x-o.x)/x,y:(i.y-o.y)/x},v={clientX:o.x,clientY:o.y},r.hover(t),a.pointerEnter(t,v),a.pointerOver(t,v),a.pointerMove(t,v),a.pointerDown(t,v),p=0;case 10:if(x<=p){e.next=19;break}return v.clientX+=u.x,v.clientY+=u.y,e.next=15,L(g/x);case 15:a.pointerMove(t,v);case 16:p++,e.next=10;break;case 19:a.pointerUp(t,v);case 20:case"end":return e.stop()}}),n)})))}export{x as NavigationCommand,v as clearText,j as clickElement,L as delay,D as drag,O as expectActiveElementToHaveExactText,_ as expectActiveElementToHavePartialText,A as getAllByLabelText,h as getAllByPlaceholderText,E as getAllByRole,y as getAllByTestId,R as getAllByText,k as getByClassName,T as getByLabelText,b as getByPlaceholderText,B as getByRole,g as getByTestId,C as getByText,w as getFirstByClassName,H as hoverElement,m as interactionSuite,I as pressNavigationKey,s as testFunctionWrapper,N as typeMultipleTimes,P as typeText,M as waitForElementVisible};
1
+ import{regeneratorRuntime as e,createForOfIteratorHelper as t}from"../../_virtual/_rollupPluginBabelHelpers.js";import{__awaiter as n}from"../../_virtual/_tslib.js";import{userEvent as r,within as o,fireEvent as a}from"@storybook/testing-library";import{waitFor as i}from"@testing-library/react";import{NavigationCommand as c}from"./constants.js";import{expect as u}from"@storybook/jest";var s=function(t){return function(r){var o=r.canvasElement,a=r.args;return n(void 0,void 0,void 0,e().mark((function n(){var r;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=p(o),e.abrupt("return",t(r,a));case 2:case"end":return e.stop()}}),n)})))}},v=function(t){return n(void 0,void 0,void 0,e().mark((function n(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r.clear(t);case 1:case"end":return e.stop()}}),n)})))};function f(e){u(" ➡️ ".concat(e)).toBeDefined()}function l(e){var t=e.getBoundingClientRect();return{x:t.left+t.width/2,y:t.top+t.height/2}}var d=function(e){var t=e.toElm,n=e.toCoords,r=e.delta,o=e.from;return n?Object.assign(Object.assign({},o),n):t?l(t):r?{x:o.x+r.x,y:o.y+r.y}:{x:o.x+10,y:o.y+0}};function p(e){if(e instanceof HTMLElement){var t=o(e);if(t instanceof Error)throw t;return t}if(e.getByRole)return e}var x=c,m=function(r){var o=r.beforeEach,a=void 0===o?null:o,i=r.beforeAll,c=void 0===i?null:i,u=r.skip,v=void 0!==u&&u,l=r.tests,d=r.afterEach,p=void 0===d?null:d,x=r.afterAll,m=void 0===x?null:x;return function(r){var o=r.canvasElement,i=r.args;return n(void 0,void 0,void 0,e().mark((function n(){var r,u,d,x;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!v){e.next=2;break}return e.abrupt("return");case 2:if(!c){e.next=6;break}return f("Before all:"),e.next=6,s(c)({canvasElement:o,args:i});case 6:r=t(l),e.prev=7,r.s();case 9:if((u=r.n()).done){e.next=25;break}if(x=(d=u.value).name,!a){e.next=16;break}return f("Before: ".concat(x)),e.next=16,s(a)({canvasElement:o,args:i});case 16:return f("Running : ".concat(x)),e.next=19,s(d)({canvasElement:o,args:i});case 19:if(!p){e.next=23;break}return f("After: ".concat(x)),e.next=23,s(p)({canvasElement:o,args:i});case 23:e.next=9;break;case 25:e.next=30;break;case 27:e.prev=27,e.t0=e.catch(7),r.e(e.t0);case 30:return e.prev=30,r.f(),e.finish(30);case 33:if(!m){e.next=37;break}return f("After all:"),e.next=37,s(m)({canvasElement:o,args:i});case 37:case"end":return e.stop()}}),n,null,[[7,27,30,33]])})))}},g=function(e,t){return p(e).getByTestId(t)},y=function(e,t){return p(e).getAllByTestId(t)},b=function(e,t){return p(e).getByPlaceholderText(t)},h=function(e,t){return p(e).getAllByPlaceholderText(t)},k=function(e){return document.getElementsByClassName(e)},w=function(e){return document.getElementsByClassName(e)[0]},B=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return p(e).getByRole(t,n)},E=function(e,t){return p(e).getAllByRole(t)},T=function(e,t){return p(e).getByLabelText(t)},A=function(e,t){return p(e).getAllByLabelText(t)},C=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return p(e).getByText(t,n)},R=function(e,t){return p(e).getAllByText(t)},j=function(e){return r.click(e)},H=function(e){return r.hover(e)},P=function(t,o){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:250;return n(void 0,void 0,void 0,e().mark((function n(){var i,c;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=r.type(t,o,{delay:50}),e.next=3,i;case 3:return c=e.sent,e.next=6,L(a);case 6:return e.abrupt("return",c);case 7:case"end":return e.stop()}}),n)})))},O=function(e){u(document.activeElement).toHaveTextContent(RegExp("^".concat(e,"$")))},_=function(e){u(document.activeElement).toHaveTextContent(e)},I=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c.TAB,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return n(void 0,void 0,void 0,e().mark((function n(){var a,i;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=t===c.TAB?r.tab():r.keyboard(t),e.next=3,a;case 3:return i=e.sent,e.next=6,L(o);case 6:return e.abrupt("return",i);case 7:case"end":return e.stop()}}),n)})))};function L(e){return new Promise((function(t){if(!e)return t(void 0);setTimeout(t,e)}))}var M=function(t){return new Promise((function(r){var o;i((function(){return n(void 0,void 0,void 0,e().mark((function n(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t();case 2:u(o=e.sent).toBeVisible();case 4:case"end":return e.stop()}}),n)})))})).then((function(){r(o)}))}))},N=function(t,o){var a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{delay:70};return n(void 0,void 0,void 0,e().mark((function n(){return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=t.repeat(o),e.next=3,r.keyboard(t,a);case 3:case"end":return e.stop()}}),n)})))};function D(t,o){var i=o.delta,c=void 0===i?void 0:i,u=o.toCoords,s=void 0===u?void 0:u,v=o.toElm,f=void 0===v?void 0:v,p=o.steps,x=void 0===p?20:p,m=o.duration,g=void 0===m?100:m;return n(this,void 0,void 0,e().mark((function n(){var o,i,u,v,p;return e().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:o=l(t),i=d({toElm:f,toCoords:s,delta:c,from:o}),u={x:(i.x-o.x)/x,y:(i.y-o.y)/x},v={clientX:o.x,clientY:o.y},r.hover(t),a.pointerEnter(t,v),a.pointerOver(t,v),a.pointerMove(t,v),a.pointerDown(t,v),p=0;case 10:if(x<=p){e.next=19;break}return v.clientX+=u.x,v.clientY+=u.y,e.next=15,L(g/x);case 15:a.pointerMove(t,v);case 16:p++,e.next=10;break;case 19:a.pointerUp(t,v);case 20:case"end":return e.stop()}}),n)})))}export{x as NavigationCommand,v as clearText,j as clickElement,L as delay,D as drag,O as expectActiveElementToHaveExactText,_ as expectActiveElementToHavePartialText,A as getAllByLabelText,h as getAllByPlaceholderText,E as getAllByRole,y as getAllByTestId,R as getAllByText,k as getByClassName,T as getByLabelText,b as getByPlaceholderText,B as getByRole,g as getByTestId,C as getByText,w as getFirstByClassName,H as hoverElement,m as interactionSuite,I as pressNavigationKey,s as testFunctionWrapper,N as typeMultipleTimes,P as typeText,M as waitForElementVisible};
2
2
  //# sourceMappingURL=interactionsTests.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interactionsTests.js","sources":["../../../src/tests/interactions-utils.ts"],"sourcesContent":["import { fireEvent, queries, userEvent, within } from \"@storybook/test\";\nimport { BoundFunctions, Screen, SelectorMatcherOptions, waitFor } from \"@testing-library/react\";\nimport { NavigationCommand as NavigationCommandType } from \"./constants\";\nimport { expect } from \"@storybook/jest\";\n\nexport type Canvas = HTMLElement | BoundFunctions<typeof queries>;\nexport type TestFunction = (canvas: Canvas, args: Record<string, any>) => unknown;\nexport type Coordinates = { x: number; y: number };\n\n// Internal functions\nexport const testFunctionWrapper = (testFunc: TestFunction) => {\n return async ({ canvasElement, args }: { canvasElement: Screen; args: Record<string, any> }) => {\n // Starts querying the component from its root element\n const canvas = getWithin(canvasElement);\n return testFunc(canvas, args);\n };\n};\n\nexport const clearText = async (element: HTMLElement) => {\n userEvent.clear(element);\n};\n\nfunction logFunctionStart(name: string) {\n expect(` ➡️ ${name}`).toBeDefined();\n}\n\nfunction getElementClientCenter(element: HTMLElement) {\n const { left, top, width, height } = element.getBoundingClientRect();\n return {\n x: left + width / 2,\n y: top + height / 2\n };\n}\n\nconst getCoords = ({\n toElm,\n toCoords,\n delta,\n from\n}: {\n toElm: HTMLElement;\n toCoords: Coordinates;\n delta: Coordinates;\n from: Coordinates;\n}) => {\n if (toCoords) {\n return { ...from, ...toCoords };\n }\n if (toElm) {\n return getElementClientCenter(toElm);\n }\n if (delta) {\n return {\n x: from.x + delta.x,\n y: from.y + delta.y\n };\n }\n return {\n x: from.x + 10,\n y: from.y + 0\n };\n};\n\nfunction getWithin(canvasOrValidTestElement: HTMLElement | BoundFunctions<typeof queries>) {\n if (canvasOrValidTestElement instanceof HTMLElement) {\n const result = within(canvasOrValidTestElement);\n if (result instanceof Error) {\n throw result;\n }\n return result;\n } else if (canvasOrValidTestElement.getByRole) return canvasOrValidTestElement;\n}\n\n// External constants\nexport const NavigationCommand = NavigationCommandType;\n\n// External functions\nexport const interactionSuite =\n ({\n beforeEach = null,\n beforeAll = null,\n skip = false,\n tests,\n afterEach = null,\n afterAll = null\n }: {\n beforeEach?: TestFunction;\n beforeAll?: TestFunction;\n skip?: boolean;\n tests: Array<TestFunction>;\n afterAll?: TestFunction;\n afterEach?: TestFunction;\n }): (({ canvasElement, args }: { canvasElement: Screen; args: Record<string, any> }) => Promise<void>) =>\n async ({ canvasElement, args }) => {\n if (skip) return;\n\n if (beforeAll) {\n logFunctionStart(\"Before all:\");\n await testFunctionWrapper(beforeAll)({ canvasElement, args });\n }\n\n for (const test of tests) {\n const fnName = test.name;\n if (beforeEach) {\n logFunctionStart(`Before: ${fnName}`);\n await testFunctionWrapper(beforeEach)({ canvasElement, args });\n }\n\n logFunctionStart(`Running : ${fnName}`);\n await testFunctionWrapper(test)({ canvasElement, args });\n\n if (afterEach) {\n logFunctionStart(`After: ${fnName}`);\n await testFunctionWrapper(afterEach)({ canvasElement, args });\n }\n }\n\n if (afterAll) {\n logFunctionStart(\"After all:\");\n await testFunctionWrapper(afterAll)({ canvasElement, args });\n }\n };\n\nexport const getByTestId = (rootElement: HTMLElement | BoundFunctions<typeof queries>, dataTestId: string) => {\n return getWithin(rootElement).getByTestId(dataTestId);\n};\n\nexport const getAllByTestId = (rootElement: HTMLElement | BoundFunctions<typeof queries>, dataTestId: string) => {\n return getWithin(rootElement).getAllByTestId(dataTestId);\n};\n\nexport const getByPlaceholderText = (rootElement: HTMLElement | BoundFunctions<typeof queries>, text: string) => {\n return getWithin(rootElement).getByPlaceholderText(text);\n};\n\nexport const getAllByPlaceholderText = (rootElement: HTMLElement | BoundFunctions<typeof queries>, text: string) => {\n return getWithin(rootElement).getAllByPlaceholderText(text);\n};\n\nexport const getByClassName = (className: string) => {\n return document.getElementsByClassName(className);\n};\n\nexport const getFirstByClassName = (className: string) => {\n return document.getElementsByClassName(className)[0];\n};\n\nexport const getByRole = (rootElement: HTMLElement | BoundFunctions<typeof queries>, role: string, options = {}) => {\n return getWithin(rootElement).getByRole(role, options);\n};\n\nexport const getAllByRole = (rootElement: HTMLElement | BoundFunctions<typeof queries>, role: string) => {\n return getWithin(rootElement).getAllByRole(role);\n};\n\nexport const getByLabelText = (rootElement: HTMLElement | BoundFunctions<typeof queries>, text: string) => {\n return getWithin(rootElement).getByLabelText(text);\n};\n\nexport const getAllByLabelText = (rootElement: HTMLElement, text: string) => {\n return getWithin(rootElement).getAllByLabelText(text);\n};\n\nexport const getByText = (\n rootElement: HTMLElement | BoundFunctions<typeof queries>,\n text: string,\n options: SelectorMatcherOptions = {}\n) => {\n return getWithin(rootElement).getByText(text, options);\n};\n\nexport const getAllByText = (rootElement: HTMLElement | BoundFunctions<typeof queries>, text: string) => {\n return getWithin(rootElement).getAllByText(text);\n};\n\nexport const clickElement = (element: HTMLElement) => {\n return userEvent.click(element);\n};\n\nexport const hoverElement = (element: HTMLElement) => {\n return userEvent.hover(element);\n};\n\nexport const typeText = async (element: HTMLElement, text: string, waitForDebounceMs = 250) => {\n const promise = userEvent.type(element, text, {\n delay: 50\n });\n const result = await promise;\n await delay(waitForDebounceMs);\n return result;\n};\n\nexport const expectActiveElementToHaveExactText = (text: string) => {\n expect(document.activeElement).toHaveTextContent(new RegExp(`^${text}$`));\n};\n\nexport const expectActiveElementToHavePartialText = (text: string) => {\n expect(document.activeElement).toHaveTextContent(text);\n};\n\nexport const pressNavigationKey = async (command = NavigationCommandType.TAB, waitForDebounceMs = 0): Promise<any> => {\n const promise = command === NavigationCommandType.TAB ? userEvent.tab() : userEvent.keyboard(command);\n const result = await promise;\n await delay(waitForDebounceMs);\n return result;\n};\n\nexport function delay(timeout: number) {\n return new Promise((resolve: (value: unknown) => void) => {\n if (!timeout) return resolve(undefined);\n setTimeout(resolve, timeout);\n });\n}\n\nexport const waitForElementVisible = (getterFunc: () => HTMLElement) => {\n return new Promise(resolve => {\n let element: HTMLElement;\n waitFor(async () => {\n element = await getterFunc();\n expect(element).toBeVisible();\n }).then(() => {\n resolve(element);\n });\n });\n};\n\nexport const typeMultipleTimes = async (text: string, count: number, options = { delay: 70 }) => {\n text = text.repeat(count);\n await userEvent.keyboard(text, options);\n};\n\nexport async function drag(\n element: HTMLElement,\n {\n delta = undefined,\n toCoords = undefined,\n toElm = undefined,\n steps = 20,\n duration = 100\n }: { delta: Coordinates; toCoords: Coordinates; toElm: HTMLElement; steps: number; duration: number }\n) {\n const from = getElementClientCenter(element);\n const to = getCoords({ toElm, toCoords, delta, from });\n const step = {\n x: (to.x - from.x) / steps,\n y: (to.y - from.y) / steps\n };\n const current = {\n clientX: from.x,\n clientY: from.y\n };\n userEvent.hover(element);\n fireEvent.pointerEnter(element, current);\n fireEvent.pointerOver(element, current);\n fireEvent.pointerMove(element, current);\n fireEvent.pointerDown(element, current);\n for (let i = 0; i < steps; i++) {\n current.clientX += step.x;\n current.clientY += step.y;\n await delay(duration / steps);\n fireEvent.pointerMove(element, current);\n }\n fireEvent.pointerUp(element, current);\n}\n"],"names":["testFunctionWrapper","testFunc","_ref","canvasElement","args","__awaiter","_regeneratorRuntime","mark","_callee","canvas","wrap","_context","prev","next","getWithin","abrupt","stop","clearText","element","_callee2","_context2","userEvent","clear","logFunctionStart","name","expect","concat","toBeDefined","getElementClientCenter","_element$getBoundingC","getBoundingClientRect","x","left","width","y","top","height","getCoords","_ref2","toElm","toCoords","delta","from","Object","assign","canvasOrValidTestElement","HTMLElement","result","within","Error","getByRole","NavigationCommand","NavigationCommandType","interactionSuite","_ref3","_ref3$beforeEach","beforeEach","_ref3$beforeAll","beforeAll","_ref3$skip","skip","tests","_ref3$afterEach","afterEach","_ref3$afterAll","afterAll","_ref4","_callee3","_iterator","_step","test","fnName","_context3","_createForOfIteratorHelper","s","n","done","value","t0","e","f","finish","getByTestId","rootElement","dataTestId","getAllByTestId","getByPlaceholderText","text","getAllByPlaceholderText","getByClassName","className","document","getElementsByClassName","getFirstByClassName","role","options","arguments","length","undefined","getAllByRole","getByLabelText","getAllByLabelText","getByText","getAllByText","clickElement","click","hoverElement","hover","typeText","waitForDebounceMs","_callee4","promise","_context4","type","delay","sent","expectActiveElementToHaveExactText","activeElement","toHaveTextContent","RegExp","expectActiveElementToHavePartialText","pressNavigationKey","command","TAB","_callee5","_context5","tab","keyboard","timeout","Promise","resolve","setTimeout","waitForElementVisible","getterFunc","waitFor","_callee6","_context6","toBeVisible","then","typeMultipleTimes","count","_callee7","_context7","repeat","drag","_ref5","_ref5$delta","_ref5$toCoords","_ref5$toElm","_ref5$steps","steps","_ref5$duration","duration","to","step","current","clientX","clientY","fireEvent","pointerEnter","pointerOver","pointerMove","pointerDown","i","_context8","pointerUp","_callee8"],"mappings":"6XAUaA,EAAsB,SAACC,GAClC,OAAO,SAAAC,GAAA,IAASC,EAAaD,EAAbC,cAAeC,EAAIF,EAAJE,KAAI,OAA4DC,OAAA,OAAA,OAAA,EAAAC,IAAAC,MAAA,SAAAC,IAAA,IAAAC,EAAA,OAAAH,IAAAI,MAAA,SAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAEtD,OAAjCJ,EAASK,EAAUX,GAAcQ,EAAAI,OAAA,SAChCd,EAASQ,EAAQL,IAAK,KAAA,EAAA,IAAA,MAAA,OAAA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Y/I,EAASyI,GAC/BG,EAAUI,YAAYhJ,EAASyI,GACtBQ,EAAI,EAAC,KAAA,GAAA,GAAMb,GAAJa,EAAS,CAAAC,EAAAvJ,KAAA,GAAA,KAAA,CAGvB,OAFA8I,EAAQC,SAAWF,EAAK3H,EACxB4H,EAAQE,SAAWH,EAAKxH,EAAEkI,EAAAvJ,KAAA,GACpBqG,EAAMsC,EAAWF,GAAM,KAAA,GAC7BQ,EAAUG,YAAY/I,EAASyI,GAAS,KAAA,GAJfQ,IAAGC,EAAAvJ,KAAA,GAAA,MAAA,KAAA,GAM9BiJ,EAAUO,UAAUnJ,EAASyI,GAAS,KAAA,GAAA,IAAA,MAAA,OAAAS,EAAApJ,OAAA,GAAAsJ,EACvC,IAAA"}
1
+ {"version":3,"file":"interactionsTests.js","sources":["../../../src/tests/interactions-utils.ts"],"sourcesContent":["import { fireEvent, queries, userEvent, within } from \"@storybook/testing-library\";\nimport { BoundFunctions, Screen, SelectorMatcherOptions, waitFor } from \"@testing-library/react\";\nimport { NavigationCommand as NavigationCommandType } from \"./constants\";\nimport { expect } from \"@storybook/jest\";\n\nexport type Canvas = HTMLElement | BoundFunctions<typeof queries>;\nexport type TestFunction = (canvas: Canvas, args: Record<string, any>) => unknown;\nexport type Coordinates = { x: number; y: number };\n\n// Internal functions\nexport const testFunctionWrapper = (testFunc: TestFunction) => {\n return async ({ canvasElement, args }: { canvasElement: Screen; args: Record<string, any> }) => {\n // Starts querying the component from its root element\n const canvas = getWithin(canvasElement);\n return testFunc(canvas, args);\n };\n};\n\nexport const clearText = async (element: HTMLElement) => {\n userEvent.clear(element);\n};\n\nfunction logFunctionStart(name: string) {\n expect(` ➡️ ${name}`).toBeDefined();\n}\n\nfunction getElementClientCenter(element: HTMLElement) {\n const { left, top, width, height } = element.getBoundingClientRect();\n return {\n x: left + width / 2,\n y: top + height / 2\n };\n}\n\nconst getCoords = ({\n toElm,\n toCoords,\n delta,\n from\n}: {\n toElm: HTMLElement;\n toCoords: Coordinates;\n delta: Coordinates;\n from: Coordinates;\n}) => {\n if (toCoords) {\n return { ...from, ...toCoords };\n }\n if (toElm) {\n return getElementClientCenter(toElm);\n }\n if (delta) {\n return {\n x: from.x + delta.x,\n y: from.y + delta.y\n };\n }\n return {\n x: from.x + 10,\n y: from.y + 0\n };\n};\n\nfunction getWithin(canvasOrValidTestElement: HTMLElement | BoundFunctions<typeof queries>) {\n if (canvasOrValidTestElement instanceof HTMLElement) {\n const result = within(canvasOrValidTestElement);\n if (result instanceof Error) {\n throw result;\n }\n return result;\n } else if (canvasOrValidTestElement.getByRole) return canvasOrValidTestElement;\n}\n\n// External constants\nexport const NavigationCommand = NavigationCommandType;\n\n// External functions\nexport const interactionSuite =\n ({\n beforeEach = null,\n beforeAll = null,\n skip = false,\n tests,\n afterEach = null,\n afterAll = null\n }: {\n beforeEach?: TestFunction;\n beforeAll?: TestFunction;\n skip?: boolean;\n tests: Array<TestFunction>;\n afterAll?: TestFunction;\n afterEach?: TestFunction;\n }): (({ canvasElement, args }: { canvasElement: Screen; args: Record<string, any> }) => Promise<void>) =>\n async ({ canvasElement, args }) => {\n if (skip) return;\n\n if (beforeAll) {\n logFunctionStart(\"Before all:\");\n await testFunctionWrapper(beforeAll)({ canvasElement, args });\n }\n\n for (const test of tests) {\n const fnName = test.name;\n if (beforeEach) {\n logFunctionStart(`Before: ${fnName}`);\n await testFunctionWrapper(beforeEach)({ canvasElement, args });\n }\n\n logFunctionStart(`Running : ${fnName}`);\n await testFunctionWrapper(test)({ canvasElement, args });\n\n if (afterEach) {\n logFunctionStart(`After: ${fnName}`);\n await testFunctionWrapper(afterEach)({ canvasElement, args });\n }\n }\n\n if (afterAll) {\n logFunctionStart(\"After all:\");\n await testFunctionWrapper(afterAll)({ canvasElement, args });\n }\n };\n\nexport const getByTestId = (rootElement: HTMLElement | BoundFunctions<typeof queries>, dataTestId: string) => {\n return getWithin(rootElement).getByTestId(dataTestId);\n};\n\nexport const getAllByTestId = (rootElement: HTMLElement | BoundFunctions<typeof queries>, dataTestId: string) => {\n return getWithin(rootElement).getAllByTestId(dataTestId);\n};\n\nexport const getByPlaceholderText = (rootElement: HTMLElement | BoundFunctions<typeof queries>, text: string) => {\n return getWithin(rootElement).getByPlaceholderText(text);\n};\n\nexport const getAllByPlaceholderText = (rootElement: HTMLElement | BoundFunctions<typeof queries>, text: string) => {\n return getWithin(rootElement).getAllByPlaceholderText(text);\n};\n\nexport const getByClassName = (className: string) => {\n return document.getElementsByClassName(className);\n};\n\nexport const getFirstByClassName = (className: string) => {\n return document.getElementsByClassName(className)[0];\n};\n\nexport const getByRole = (rootElement: HTMLElement | BoundFunctions<typeof queries>, role: string, options = {}) => {\n return getWithin(rootElement).getByRole(role, options);\n};\n\nexport const getAllByRole = (rootElement: HTMLElement | BoundFunctions<typeof queries>, role: string) => {\n return getWithin(rootElement).getAllByRole(role);\n};\n\nexport const getByLabelText = (rootElement: HTMLElement | BoundFunctions<typeof queries>, text: string) => {\n return getWithin(rootElement).getByLabelText(text);\n};\n\nexport const getAllByLabelText = (rootElement: HTMLElement, text: string) => {\n return getWithin(rootElement).getAllByLabelText(text);\n};\n\nexport const getByText = (\n rootElement: HTMLElement | BoundFunctions<typeof queries>,\n text: string,\n options: SelectorMatcherOptions = {}\n) => {\n return getWithin(rootElement).getByText(text, options);\n};\n\nexport const getAllByText = (rootElement: HTMLElement | BoundFunctions<typeof queries>, text: string) => {\n return getWithin(rootElement).getAllByText(text);\n};\n\nexport const clickElement = (element: HTMLElement) => {\n return userEvent.click(element);\n};\n\nexport const hoverElement = (element: HTMLElement) => {\n return userEvent.hover(element);\n};\n\nexport const typeText = async (element: HTMLElement, text: string, waitForDebounceMs = 250) => {\n const promise = userEvent.type(element, text, {\n delay: 50\n });\n const result = await promise;\n await delay(waitForDebounceMs);\n return result;\n};\n\nexport const expectActiveElementToHaveExactText = (text: string) => {\n expect(document.activeElement).toHaveTextContent(new RegExp(`^${text}$`));\n};\n\nexport const expectActiveElementToHavePartialText = (text: string) => {\n expect(document.activeElement).toHaveTextContent(text);\n};\n\nexport const pressNavigationKey = async (command = NavigationCommandType.TAB, waitForDebounceMs = 0): Promise<any> => {\n const promise = command === NavigationCommandType.TAB ? userEvent.tab() : userEvent.keyboard(command);\n const result = await promise;\n await delay(waitForDebounceMs);\n return result;\n};\n\nexport function delay(timeout: number) {\n return new Promise((resolve: (value: unknown) => void) => {\n if (!timeout) return resolve(undefined);\n setTimeout(resolve, timeout);\n });\n}\n\nexport const waitForElementVisible = (getterFunc: () => HTMLElement) => {\n return new Promise(resolve => {\n let element: HTMLElement;\n waitFor(async () => {\n element = await getterFunc();\n expect(element).toBeVisible();\n }).then(() => {\n resolve(element);\n });\n });\n};\n\nexport const typeMultipleTimes = async (text: string, count: number, options = { delay: 70 }) => {\n text = text.repeat(count);\n await userEvent.keyboard(text, options);\n};\n\nexport async function drag(\n element: HTMLElement,\n {\n delta = undefined,\n toCoords = undefined,\n toElm = undefined,\n steps = 20,\n duration = 100\n }: { delta: Coordinates; toCoords: Coordinates; toElm: HTMLElement; steps: number; duration: number }\n) {\n const from = getElementClientCenter(element);\n const to = getCoords({ toElm, toCoords, delta, from });\n const step = {\n x: (to.x - from.x) / steps,\n y: (to.y - from.y) / steps\n };\n const current = {\n clientX: from.x,\n clientY: from.y\n };\n userEvent.hover(element);\n fireEvent.pointerEnter(element, current);\n fireEvent.pointerOver(element, current);\n fireEvent.pointerMove(element, current);\n fireEvent.pointerDown(element, current);\n for (let i = 0; i < steps; i++) {\n current.clientX += step.x;\n current.clientY += step.y;\n await delay(duration / steps);\n fireEvent.pointerMove(element, current);\n }\n fireEvent.pointerUp(element, current);\n}\n"],"names":["testFunctionWrapper","testFunc","_ref","canvasElement","args","__awaiter","_regeneratorRuntime","mark","_callee","canvas","wrap","_context","prev","next","getWithin","abrupt","stop","clearText","element","_callee2","_context2","userEvent","clear","logFunctionStart","name","expect","concat","toBeDefined","getElementClientCenter","_element$getBoundingC","getBoundingClientRect","x","left","width","y","top","height","getCoords","_ref2","toElm","toCoords","delta","from","Object","assign","canvasOrValidTestElement","HTMLElement","result","within","Error","getByRole","NavigationCommand","NavigationCommandType","interactionSuite","_ref3","_ref3$beforeEach","beforeEach","_ref3$beforeAll","beforeAll","_ref3$skip","skip","tests","_ref3$afterEach","afterEach","_ref3$afterAll","afterAll","_ref4","_callee3","_iterator","_step","test","fnName","_context3","_createForOfIteratorHelper","s","n","done","value","t0","e","f","finish","getByTestId","rootElement","dataTestId","getAllByTestId","getByPlaceholderText","text","getAllByPlaceholderText","getByClassName","className","document","getElementsByClassName","getFirstByClassName","role","options","arguments","length","undefined","getAllByRole","getByLabelText","getAllByLabelText","getByText","getAllByText","clickElement","click","hoverElement","hover","typeText","waitForDebounceMs","_callee4","promise","_context4","type","delay","sent","expectActiveElementToHaveExactText","activeElement","toHaveTextContent","RegExp","expectActiveElementToHavePartialText","pressNavigationKey","command","TAB","_callee5","_context5","tab","keyboard","timeout","Promise","resolve","setTimeout","waitForElementVisible","getterFunc","waitFor","_callee6","_context6","toBeVisible","then","typeMultipleTimes","count","_callee7","_context7","repeat","drag","_ref5","_ref5$delta","_ref5$toCoords","_ref5$toElm","_ref5$steps","steps","_ref5$duration","duration","to","step","current","clientX","clientY","fireEvent","pointerEnter","pointerOver","pointerMove","pointerDown","i","_context8","pointerUp","_callee8"],"mappings":"wYAUaA,EAAsB,SAACC,GAClC,OAAO,SAAAC,GAAA,IAASC,EAAaD,EAAbC,cAAeC,EAAIF,EAAJE,KAAI,OAA4DC,OAAA,OAAA,OAAA,EAAAC,IAAAC,MAAA,SAAAC,IAAA,IAAAC,EAAA,OAAAH,IAAAI,MAAA,SAAAC,GAAA,cAAAA,EAAAC,KAAAD,EAAAE,MAAA,KAAA,EAEtD,OAAjCJ,EAASK,EAAUX,GAAcQ,EAAAI,OAAA,SAChCd,EAASQ,EAAQL,IAAK,KAAA,EAAA,IAAA,MAAA,OAAAO,EAAAK,OAAA,GAAAR,EAC9B,IAAA,CACH,EAEaS,EAAY,SAAO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EAAC,KAAA,GAAA,GAAMb,GAAJa,EAAS,CAAAC,EAAAvJ,KAAA,GAAA,KAAA,CAGvB,OAFA8I,EAAQC,SAAWF,EAAK3H,EACxB4H,EAAQE,SAAWH,EAAKxH,EAAEkI,EAAAvJ,KAAA,GACpBqG,EAAMsC,EAAWF,GAAM,KAAA,GAC7BQ,EAAUG,YAAY/I,EAASyI,GAAS,KAAA,GAJfQ,IAAGC,EAAAvJ,KAAA,GAAA,MAAA,KAAA,GAM9BiJ,EAAUO,UAAUnJ,EAASyI,GAAS,KAAA,GAAA,IAAA,MAAA,OAAAS,EAAApJ,OAAA,GAAAsJ,EACvC,IAAA"}
@@ -1,4 +1,4 @@
1
- import { queries } from "@storybook/test";
1
+ import { queries } from "@storybook/testing-library";
2
2
  import { BoundFunctions, Screen, SelectorMatcherOptions } from "@testing-library/react";
3
3
  import { NavigationCommand as NavigationCommandType } from "./constants";
4
4
  export type Canvas = HTMLElement | BoundFunctions<typeof queries>;
@@ -1,7 +1,7 @@
1
1
  export * from "./events";
2
2
  export * from "./SubIcon";
3
- export type { default as VibeComponent } from "./VibeComponent";
4
- export type { default as VibeComponentProps } from "./VibeComponentProps";
3
+ export { default as VibeComponent } from "./VibeComponent";
4
+ export { default as VibeComponentProps } from "./VibeComponentProps";
5
5
  export * from "./withStaticProps";
6
6
  export * from "./ArrayLastElement";
7
7
  export * from "./SplitString";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe/core",
3
- "version": "3.53.0-alpha-528cd.0",
3
+ "version": "3.53.0",
4
4
  "description": "Official monday.com UI resources for application development in React.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -88,7 +88,7 @@
88
88
  },
89
89
  "dependencies": {
90
90
  "@popperjs/core": "2.11.6",
91
- "@vibe/icons": "1.8.1-alpha-528cd.0",
91
+ "@vibe/icons": "1.8.0",
92
92
  "a11y-dialog": "^7.5.2",
93
93
  "body-scroll-lock": "^4.0.0-beta.0",
94
94
  "browserslist-config-monday": "1.0.6",
@@ -126,35 +126,38 @@
126
126
  "@babel/preset-typescript": "^7.23.3",
127
127
  "@babel/standalone": "^7.24.4",
128
128
  "@babel/types": "^7.24.0",
129
- "@chromatic-com/storybook": "^3.2.4",
129
+ "@chromatic-com/storybook": "^1.4.0",
130
130
  "@hot-loader/react-dom": "^16.13.0",
131
+ "@mdx-js/loader": "^2.0.0-rc.2",
132
+ "@mdx-js/mdx": "^2.0.0-rc.2",
131
133
  "@rollup/plugin-babel": "^6.0.2",
132
134
  "@rollup/plugin-commonjs": "^23.0.2",
133
135
  "@rollup/plugin-node-resolve": "^15.0.1",
134
136
  "@rollup/plugin-typescript": "^9.0.2",
135
- "@storybook/addon-a11y": "^8.6.14",
136
- "@storybook/addon-actions": "^8.6.14",
137
- "@storybook/addon-controls": "^8.6.14",
138
- "@storybook/addon-docs": "^8.6.14",
139
- "@storybook/addon-essentials": "^8.6.14",
140
- "@storybook/addon-interactions": "^8.6.14",
141
- "@storybook/addon-links": "^8.6.14",
142
- "@storybook/addon-storysource": "^8.6.14",
143
- "@storybook/addon-themes": "^8.6.14",
144
- "@storybook/addon-toolbars": "^8.6.14",
145
- "@storybook/blocks": "^8.6.14",
146
- "@storybook/blocks7": "npm:@storybook/blocks@^7.6.17",
147
- "@storybook/builder-vite": "^8.6.14",
137
+ "@size-limit/esbuild": "^11.0.1",
138
+ "@size-limit/preset-big-lib": "^11.0.1",
139
+ "@storybook/addon-a11y": "^7.5.3",
140
+ "@storybook/addon-actions": "^7.5.3",
141
+ "@storybook/addon-controls": "^7.5.3",
142
+ "@storybook/addon-docs": "^7.5.3",
143
+ "@storybook/addon-essentials": "^7.5.3",
144
+ "@storybook/addon-interactions": "^7.5.3",
145
+ "@storybook/addon-links": "^7.5.3",
146
+ "@storybook/addon-storysource": "^7.5.3",
147
+ "@storybook/addon-styling-webpack": "^0.0.5",
148
+ "@storybook/addon-themes": "^7.5.3",
149
+ "@storybook/addon-toolbars": "^7.5.3",
150
+ "@storybook/addons": "^7.5.3",
151
+ "@storybook/blocks": "^7.5.3",
148
152
  "@storybook/jest": "^0.2.3",
149
- "@storybook/manager-api": "^8.6.14",
153
+ "@storybook/manager-api": "^7.5.3",
150
154
  "@storybook/preset-scss": "^1.0.3",
151
- "@storybook/react": "^8.6.14",
152
- "@storybook/react-vite": "^8.6.14",
153
- "@storybook/source-loader": "^8.6.14",
155
+ "@storybook/react": "^7.5.3",
156
+ "@storybook/react-webpack5": "^7.5.3",
157
+ "@storybook/source-loader": "^7.5.3",
154
158
  "@storybook/storybook-deployer": "^2.8.16",
155
- "@storybook/test": "^8.6.14",
156
159
  "@storybook/testing-library": "^0.2.2",
157
- "@storybook/theming": "^8.6.14",
160
+ "@storybook/theming": "^7.5.3",
158
161
  "@testing-library/jest-dom": "^6.4.6",
159
162
  "@testing-library/react": "^12.1.2",
160
163
  "@testing-library/react-hooks": "^7.0.2",
@@ -193,6 +196,7 @@
193
196
  "boxt": "^1.1.1",
194
197
  "chalk": "^4.1.2",
195
198
  "chromatic": "^11.5.4",
199
+ "css-loader": "^6.5.1",
196
200
  "csstype": "^3.1.0",
197
201
  "ejs": "^3.1.9",
198
202
  "eslint": "^8.23.0",
@@ -207,7 +211,7 @@
207
211
  "eslint-plugin-prettier": "^4.0.0",
208
212
  "eslint-plugin-react": "^7.28.0",
209
213
  "eslint-plugin-react-hooks": "^4.3.0",
210
- "eslint-plugin-storybook": "^0.11.2",
214
+ "eslint-plugin-storybook": "^0.6.15",
211
215
  "eslint-plugin-vitest": "^0.4.1",
212
216
  "execa": "^5.1.1",
213
217
  "identity-obj-proxy": "^3.0.0",
@@ -230,7 +234,7 @@
230
234
  "react-resizable": "^3.0.4",
231
235
  "react-syntax-highlighter": "^15.5.0",
232
236
  "react-test-renderer": "^16.14.0",
233
- "remark-gfm": "^4.0.0",
237
+ "remark-gfm": "^3.0.1",
234
238
  "resolve-url-loader": "^5.0.0",
235
239
  "rollup": "^2.79.1",
236
240
  "rollup-plugin-copy": "^3.5.0",
@@ -239,10 +243,12 @@
239
243
  "rollup-plugin-terser": "^7.0.2",
240
244
  "rollup-plugin-typescript2": "^0.34.1",
241
245
  "sass": "^1.51.0",
246
+ "sass-loader": "^12.4.0",
242
247
  "size-limit": "^11.0.1",
243
248
  "snapshot-diff": "^0.9.0",
244
- "storybook": "^8.6.14",
245
- "storybook-addon-playground": "^1.9.2",
249
+ "storybook": "^7.5.3",
250
+ "storybook-addon-playground": "^1.9.0",
251
+ "style-loader": "^3.3.1",
246
252
  "stylelint": "^14.2.0",
247
253
  "stylelint-config-recommended": "^7.0.0",
248
254
  "stylelint-config-recommended-scss": "^6.0.0",
@@ -254,7 +260,7 @@
254
260
  "tsx": "^4.20.3",
255
261
  "typescript": "^4.7.3",
256
262
  "typescript-plugin-css-modules": "^4.2.1",
257
- "vibe-storybook-components": "1.1.0-alpha-528cd.0",
263
+ "vibe-storybook-components": "0.22.0",
258
264
  "vite": "^5.3.1",
259
265
  "vitest": "^1.6.0"
260
266
  },
@@ -282,5 +288,5 @@
282
288
  "gzip": true
283
289
  }
284
290
  ],
285
- "gitHead": "d089305b1bd2836df4e9ff969ca6272deedc2e1a"
291
+ "gitHead": "74fae8a904038bc40f8a495db18fa1dc0e4f88e1"
286
292
  }