@chotot/clad-ui 2.0.0-next.4 → 2.1.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 (200) hide show
  1. package/README.md +7 -9
  2. package/dist/components/Announcer/Announcer.stories.d.ts.map +1 -1
  3. package/dist/components/Announcer/Announcer.stories.js +1 -26
  4. package/dist/components/Badge/Badge.d.ts +1 -1
  5. package/dist/components/Badge/Badge.d.ts.map +1 -1
  6. package/dist/components/Badge/Badge.js +34 -24
  7. package/dist/components/Badge/Badge.stories.d.ts.map +1 -1
  8. package/dist/components/Badge/Badge.stories.js +61 -54
  9. package/dist/components/Badge/Badge.styles.d.ts +1 -0
  10. package/dist/components/Badge/Badge.styles.d.ts.map +1 -1
  11. package/dist/components/Badge/Badge.styles.js +17 -8
  12. package/dist/components/Breadcrumbs/BreadcrumbItem.d.ts +6 -0
  13. package/dist/components/Breadcrumbs/BreadcrumbItem.d.ts.map +1 -0
  14. package/dist/components/Breadcrumbs/BreadcrumbItem.js +11 -0
  15. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts.map +1 -1
  16. package/dist/components/Breadcrumbs/Breadcrumbs.js +7 -25
  17. package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +0 -11
  18. package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts.map +1 -1
  19. package/dist/components/Breadcrumbs/Breadcrumbs.stories.js +47 -96
  20. package/dist/components/Button/Button.d.ts +8 -17
  21. package/dist/components/Button/Button.d.ts.map +1 -1
  22. package/dist/components/Button/Button.js +5 -3
  23. package/dist/components/Button/Button.stories.d.ts +78 -4
  24. package/dist/components/Button/Button.stories.d.ts.map +1 -1
  25. package/dist/components/Button/Button.stories.js +105 -11
  26. package/dist/components/Button/Button.styles.d.ts.map +1 -1
  27. package/dist/components/Button/Button.styles.js +30 -11
  28. package/dist/components/Button/GhostButton.d.ts +6 -26
  29. package/dist/components/Button/GhostButton.d.ts.map +1 -1
  30. package/dist/components/Button/GhostButton.js +4 -4
  31. package/dist/components/Button/GhostButton.stories.d.ts +80 -2
  32. package/dist/components/Button/GhostButton.stories.d.ts.map +1 -1
  33. package/dist/components/Button/GhostButton.stories.js +80 -7
  34. package/dist/components/Button/GhostButton.styles.d.ts.map +1 -1
  35. package/dist/components/Button/GhostButton.styles.js +17 -1
  36. package/dist/components/Button/IconButton.d.ts +1 -2
  37. package/dist/components/Button/IconButton.d.ts.map +1 -1
  38. package/dist/components/Button/IconButton.js +2 -7
  39. package/dist/components/Button/IconButton.stories.d.ts +75 -3
  40. package/dist/components/Button/IconButton.stories.d.ts.map +1 -1
  41. package/dist/components/Button/IconButton.stories.js +74 -7
  42. package/dist/components/Button/constant.d.ts +10 -0
  43. package/dist/components/Button/constant.d.ts.map +1 -0
  44. package/dist/components/Button/constant.js +21 -0
  45. package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -10
  46. package/dist/components/Checkbox/Checkbox.stories.d.ts.map +1 -1
  47. package/dist/components/Checkbox/Checkbox.stories.js +1 -34
  48. package/dist/components/Chip/Chip.stories.js +1 -1
  49. package/dist/components/CurrencyInput/CurrencyInput.stories.js +1 -1
  50. package/dist/components/DatePicker/DatePicker.d.ts +4 -0
  51. package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
  52. package/dist/components/DatePicker/DatePicker.js +4 -1
  53. package/dist/components/DatePicker/DatePicker.stories.d.ts +1 -0
  54. package/dist/components/DatePicker/DatePicker.stories.d.ts.map +1 -1
  55. package/dist/components/Dropdown/Dropdown.d.ts.map +1 -1
  56. package/dist/components/Dropdown/Dropdown.js +5 -0
  57. package/dist/components/Dropdown/Dropdown.styles.d.ts.map +1 -1
  58. package/dist/components/Dropdown/Dropdown.styles.js +27 -3
  59. package/dist/components/Input/Input.d.ts +1 -1
  60. package/dist/components/Input/Input.d.ts.map +1 -1
  61. package/dist/components/Input/Input.js +17 -15
  62. package/dist/components/Input/Input.stories.js +1 -1
  63. package/dist/components/Pagination/PageItem.d.ts +6 -11
  64. package/dist/components/Pagination/PageItem.d.ts.map +1 -1
  65. package/dist/components/Pagination/PageItem.js +11 -5
  66. package/dist/components/Pagination/Pagination.stories.d.ts +0 -3
  67. package/dist/components/Pagination/Pagination.stories.d.ts.map +1 -1
  68. package/dist/components/Pagination/Pagination.stories.js +5 -15
  69. package/dist/components/Popover/Popover.stories.d.ts.map +1 -1
  70. package/dist/components/Popover/Popover.stories.js +1 -0
  71. package/dist/components/RadioButton/RadioButton.stories.d.ts +0 -10
  72. package/dist/components/RadioButton/RadioButton.stories.d.ts.map +1 -1
  73. package/dist/components/RadioButton/RadioButton.stories.js +1 -38
  74. package/dist/components/RowItem/RowItem.d.ts.map +1 -1
  75. package/dist/components/RowItem/RowItem.js +3 -6
  76. package/dist/components/RowItem/RowItem.stories.d.ts.map +1 -1
  77. package/dist/components/RowItem/RowItem.stories.js +1 -2
  78. package/dist/components/Slider/Slider.stories.js +1 -1
  79. package/dist/components/Snack/Snack.stories.js +1 -1
  80. package/dist/components/Tabs/Tab.d.ts +7 -14
  81. package/dist/components/Tabs/Tab.d.ts.map +1 -1
  82. package/dist/components/Tabs/Tab.js +6 -9
  83. package/dist/components/Tabs/Tabs.stories.d.ts +3 -3
  84. package/dist/components/Tabs/Tabs.stories.d.ts.map +1 -1
  85. package/dist/components/Tabs/Tabs.stories.js +32 -10
  86. package/dist/components/Tabs/Tabs.styles.js +1 -1
  87. package/dist/components/TextArea/TextArea.d.ts +1 -1
  88. package/dist/components/TextArea/TextArea.stories.js +1 -1
  89. package/dist/components/TextLabel/TextLabel.stories.js +1 -1
  90. package/dist/components/ToggleSwitch/ToggleSwitch.stories.js +1 -1
  91. package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
  92. package/dist/components/Tooltip/Tooltip.js +2 -1
  93. package/dist/components/Tooltip/Tooltip.stories.d.ts.map +1 -1
  94. package/dist/components/Tooltip/Tooltip.stories.js +1 -30
  95. package/dist/components/index.d.ts +2 -0
  96. package/dist/components/index.d.ts.map +1 -1
  97. package/dist/components/index.js +1 -0
  98. package/dist/index.d.ts +4 -0
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +4 -0
  101. package/dist/patterns/Drawer/Drawer.d.ts +1 -0
  102. package/dist/patterns/Drawer/Drawer.d.ts.map +1 -1
  103. package/dist/patterns/Drawer/Drawer.js +7 -16
  104. package/dist/patterns/Drawer/Drawer.stories.d.ts +6 -0
  105. package/dist/patterns/Drawer/Drawer.stories.d.ts.map +1 -1
  106. package/dist/patterns/Drawer/Drawer.stories.js +23 -24
  107. package/dist/patterns/Drawer/Drawer.styles.d.ts +1 -2
  108. package/dist/patterns/Drawer/Drawer.styles.d.ts.map +1 -1
  109. package/dist/patterns/Drawer/Drawer.styles.js +1 -6
  110. package/dist/patterns/EmptyState/EmptyState.d.ts +1 -1
  111. package/dist/patterns/EmptyState/EmptyState.d.ts.map +1 -1
  112. package/dist/patterns/EmptyState/EmptyState.js +52 -47
  113. package/dist/patterns/EmptyState/EmptyState.stories.d.ts +11 -1
  114. package/dist/patterns/EmptyState/EmptyState.stories.d.ts.map +1 -1
  115. package/dist/patterns/EmptyState/EmptyState.stories.js +51 -12
  116. package/dist/patterns/EmptyState/EmptyState.styles.d.ts +3 -15
  117. package/dist/patterns/EmptyState/EmptyState.styles.d.ts.map +1 -1
  118. package/dist/patterns/EmptyState/EmptyState.styles.js +23 -40
  119. package/dist/patterns/InputGroup/InputGroup.d.ts +1 -1
  120. package/dist/patterns/InputGroup/InputGroup.styles.d.ts.map +1 -1
  121. package/dist/patterns/InputGroup/InputGroup.styles.js +3 -2
  122. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts +1 -1
  123. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.d.ts.map +1 -1
  124. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.js +4 -0
  125. package/dist/patterns/MultiSearchDropdown/MultiSearchDropdown.stories.js +1 -1
  126. package/dist/patterns/Popup/Popup.d.ts +1 -0
  127. package/dist/patterns/Popup/Popup.d.ts.map +1 -1
  128. package/dist/patterns/Popup/Popup.js +6 -15
  129. package/dist/patterns/Popup/Popup.stories.d.ts +6 -0
  130. package/dist/patterns/Popup/Popup.stories.d.ts.map +1 -1
  131. package/dist/patterns/Popup/Popup.stories.js +29 -30
  132. package/dist/patterns/Popup/Popup.styles.d.ts +1 -2
  133. package/dist/patterns/Popup/Popup.styles.d.ts.map +1 -1
  134. package/dist/patterns/Popup/Popup.styles.js +1 -6
  135. package/dist/patterns/RangeInput/RangeInput.d.ts +30 -0
  136. package/dist/patterns/RangeInput/RangeInput.d.ts.map +1 -0
  137. package/dist/patterns/RangeInput/RangeInput.js +27 -0
  138. package/dist/patterns/RangeInput/RangeInput.stories.d.ts +68 -0
  139. package/dist/patterns/RangeInput/RangeInput.stories.d.ts.map +1 -0
  140. package/dist/patterns/RangeInput/RangeInput.stories.js +121 -0
  141. package/dist/patterns/RangeInput/RangeInput.styles.d.ts +5 -0
  142. package/dist/patterns/RangeInput/RangeInput.styles.d.ts.map +1 -0
  143. package/dist/patterns/RangeInput/RangeInput.styles.js +32 -0
  144. package/dist/patterns/SearchInput/SearchInput.d.ts +1 -1
  145. package/dist/patterns/SearchInput/SearchInput.d.ts.map +1 -1
  146. package/dist/patterns/SearchInput/SearchInput.js +7 -8
  147. package/dist/patterns/SearchInput/SearchInput.stories.d.ts.map +1 -1
  148. package/dist/patterns/SearchInput/SearchInput.stories.js +1 -3
  149. package/dist/patterns/Searchbar/Searchbar.d.ts +28 -0
  150. package/dist/patterns/Searchbar/Searchbar.d.ts.map +1 -0
  151. package/dist/patterns/Searchbar/Searchbar.js +37 -0
  152. package/dist/patterns/Searchbar/Searchbar.stories.d.ts +70 -0
  153. package/dist/patterns/Searchbar/Searchbar.stories.d.ts.map +1 -0
  154. package/dist/patterns/Searchbar/Searchbar.stories.js +80 -0
  155. package/dist/patterns/Searchbar/Searchbar.styles.d.ts +3 -0
  156. package/dist/patterns/Searchbar/Searchbar.styles.d.ts.map +1 -0
  157. package/dist/patterns/Searchbar/Searchbar.styles.js +48 -0
  158. package/dist/patterns/TagCloud/TagCloud.d.ts +1 -1
  159. package/dist/patterns/TagCloud/TagCloud.stories.d.ts.map +1 -1
  160. package/dist/patterns/TagCloud/TagCloud.stories.js +1 -5
  161. package/dist/patterns/index.d.ts +4 -0
  162. package/dist/patterns/index.d.ts.map +1 -1
  163. package/dist/patterns/index.js +2 -0
  164. package/dist/storybook/ColorFoundationList.js +2 -2
  165. package/dist/theme/chotot.d.ts +57 -52
  166. package/dist/theme/chotot.d.ts.map +1 -1
  167. package/dist/theme/chotot.js +18 -13
  168. package/dist/theme/ct-job.d.ts +56 -51
  169. package/dist/theme/ct-job.d.ts.map +1 -1
  170. package/dist/theme/ct-pty.d.ts +56 -51
  171. package/dist/theme/ct-pty.d.ts.map +1 -1
  172. package/dist/theme/ct-veh.d.ts +57 -52
  173. package/dist/theme/ct-veh.d.ts.map +1 -1
  174. package/dist/theme/ct-veh.js +1 -1
  175. package/dist/theme/mudah.js +1 -1
  176. package/dist/typography/HeaderAnnotation.d.ts +19 -0
  177. package/dist/typography/HeaderAnnotation.d.ts.map +1 -0
  178. package/dist/typography/HeaderAnnotation.js +15 -0
  179. package/dist/typography/index.d.ts +2 -0
  180. package/dist/typography/index.d.ts.map +1 -1
  181. package/dist/typography/index.js +1 -0
  182. package/dist/utils/index.d.ts +1 -0
  183. package/dist/utils/index.js +1 -0
  184. package/dist/utils/scrollLock/index.d.ts +7 -0
  185. package/dist/utils/scrollLock/index.d.ts.map +1 -0
  186. package/dist/utils/scrollLock/index.js +7 -0
  187. package/dist/utils/scrollLock/scrollLock.styles.d.ts +6 -0
  188. package/dist/utils/scrollLock/scrollLock.styles.d.ts.map +1 -0
  189. package/dist/utils/scrollLock/scrollLock.styles.js +9 -0
  190. package/dist/utils/scrollLock/useBodyScrollLock.d.ts +10 -0
  191. package/dist/utils/scrollLock/useBodyScrollLock.d.ts.map +1 -0
  192. package/dist/utils/scrollLock/useBodyScrollLock.js +41 -0
  193. package/dist/utils/sx.d.ts +8 -8
  194. package/dist/utils/types.d.ts +23 -0
  195. package/dist/utils/types.d.ts.map +1 -0
  196. package/dist/utils/types.js +5 -0
  197. package/package.json +4 -3
  198. package/dist/storybook/GuideImage.d.ts +0 -9
  199. package/dist/storybook/GuideImage.d.ts.map +0 -1
  200. package/dist/storybook/GuideImage.js +0 -40
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../patterns/Drawer/Drawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAe,EAAE,KAAK,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAgC1E,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IAC9C;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC/C;;OAEG;IACH,oBAAoB,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAClE;;OAEG;IACH,sBAAsB,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACpE;;OAEG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAChE;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AAEH,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CA4NjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../patterns/Drawer/Drawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAe,EAAE,KAAK,WAAW,EAAE,MAAM,gCAAgC,CAAC;AA+B1E,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IAC9C;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;OAEG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC/C;;OAEG;IACH,oBAAoB,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAClE;;OAEG;IACH,sBAAsB,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACpE;;OAEG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAChE;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC;IAC3B;;OAEG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;;;;;GAUG;AAEH,QAAA,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAuNjC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,10 +1,10 @@
1
1
  'use client';
2
2
  import * as React from 'react';
3
- import { cx, noop } from '../../utils';
3
+ import { cx, noop, useBodyScrollLock } from '../../utils';
4
4
  import useScrollTop from '../../utils/scrollTop';
5
5
  import createUniversalPortal from '../../utils/createUniversalPortal';
6
6
  import Button from '../../components/Button/Button';
7
- import { Modal, StyledPopup, CloseButton, OptionButton, ChildrenWrapper, StyledHeader, StyledButtonGroup, buttonClass, showChildrenOverflowClass, Backdrop, HeaderTopBar, ChildrenContent, noSpacingClass, preventBodyScrollClass, } from './Drawer.styles';
7
+ import { Modal, StyledPopup, CloseButton, OptionButton, ChildrenWrapper, StyledHeader, StyledButtonGroup, buttonClass, showChildrenOverflowClass, Backdrop, HeaderTopBar, ChildrenContent, noSpacingClass, } from './Drawer.styles';
8
8
  import Close from '../../icons/Close';
9
9
  const BTN_GROUP_POSITION = {
10
10
  left: {
@@ -28,12 +28,14 @@ const BTN_GROUP_POSITION = {
28
28
  *
29
29
  * `✅ Stable`
30
30
  */
31
- const Drawer = ({ className = '', title = '', children, primaryBtnLabel, secondaryBtnLabel, primaryColor = 'primary', optionalBtnLabel, onOptionalBtnClick, btnRowPosition = 'justify', open = false, onClose = noop, onPrimaryButtonClick = noop, onSecondaryButtonClick = null, childrenOverflowVisible = false, isEmptyDrawer = false, haveClose = true, closeIcon = <Close />, contentClassName = '', }) => {
31
+ const Drawer = ({ className = '', title = '', children, primaryBtnLabel, secondaryBtnLabel, primaryColor = 'primary', optionalBtnLabel, onOptionalBtnClick, btnRowPosition = 'justify', open = false, onClose = noop, onPrimaryButtonClick = noop, onSecondaryButtonClick = null, childrenOverflowVisible = false, isEmptyDrawer = false, haveClose = true, closeIcon = <Close />, contentClassName = '', needBypassScrollLock = false, }) => {
32
32
  const { useEffect, useRef, useState } = React;
33
33
  const childrenWrapperClasses = cx((typeof children === 'string' || typeof children === 'number') && 'is-single-string', (!primaryBtnLabel || (typeof primaryBtnLabel === 'string' && !primaryBtnLabel.trim())) &&
34
34
  'no-button', childrenOverflowVisible && showChildrenOverflowClass, contentClassName);
35
35
  const [scrollTop, scrollProps] = useScrollTop();
36
36
  const wrapperProps = { ...scrollProps };
37
+ // Use the new scroll lock hook with reference counting
38
+ useBodyScrollLock(open && !needBypassScrollLock);
37
39
  const [showShadowBtm, setShowShadowBtm] = useState(false);
38
40
  const childrenContentRef = useRef(null);
39
41
  const childrenWrapperRef = useRef(null);
@@ -81,17 +83,6 @@ const Drawer = ({ className = '', title = '', children, primaryBtnLabel, seconda
81
83
  // By default: Hide it in most cases
82
84
  return false;
83
85
  };
84
- useEffect(() => {
85
- if (open) {
86
- document.body.classList.add(preventBodyScrollClass);
87
- }
88
- else {
89
- document.body.classList.remove(preventBodyScrollClass);
90
- }
91
- return () => {
92
- document.body.classList.remove(preventBodyScrollClass);
93
- };
94
- }, [open]);
95
86
  useEffect(() => {
96
87
  const show = isShowShadowBottom();
97
88
  setShowShadowBtm(show);
@@ -135,12 +126,12 @@ const Drawer = ({ className = '', title = '', children, primaryBtnLabel, seconda
135
126
  {/* ------------------------------------ */}
136
127
  {/* FOOTER */}
137
128
  {!!primaryBtnLabel && (<StyledButtonGroup {...btnGroupProps} data-clad="Drawer">
138
- {!!secondaryBtnLabel && (<Button variant="outline" color="tertiary" extraClasses={cx(
129
+ {!!secondaryBtnLabel && (<Button variant="outline" color="tertiary" size="large" extraClasses={cx(
139
130
  // Keep button width maintain on column direction
140
131
  btnRowPosition === 'justify' && buttonClass)} onClick={onSecondaryButtonClick ? onSecondaryButtonClick : onClose}>
141
132
  {secondaryBtnLabel}
142
133
  </Button>)}
143
- <Button color={primaryColor} extraClasses={cx(
134
+ <Button color={primaryColor} size="large" extraClasses={cx(
144
135
  // Keep button width maintain on column direction
145
136
  btnRowPosition === 'justify' && buttonClass)} onClick={onPrimaryButtonClick}>
146
137
  {primaryBtnLabel}
@@ -20,6 +20,12 @@ declare const DrawerStories: {
20
20
  className: {
21
21
  control: null;
22
22
  };
23
+ needBypassScrollLock: {
24
+ control: null;
25
+ table: {
26
+ disable: boolean;
27
+ };
28
+ };
23
29
  };
24
30
  args: {
25
31
  title: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.stories.d.ts","sourceRoot":"","sources":["../../../patterns/Drawer/Drawer.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAezD,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuClB,CAAC;AAEF,eAAe,aAAa,CAAC;AAM7B,eAAO,MAAM,QAAQ;;CAgBpB,CAAC;AA8DF,eAAO,MAAM,YAAY;;;;;;;;;;CA+CxB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;CAiJ9B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;CAkG3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;CAuG3B,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;CA6CvB,CAAC;AAGF,eAAO,MAAM,gBAAgB;;;;;;;;;;CA+C5B,CAAC"}
1
+ {"version":3,"file":"Drawer.stories.d.ts","sourceRoot":"","sources":["../../../patterns/Drawer/Drawer.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoC,MAAM,OAAO,CAAC;AASzD,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2ClB,CAAC;AAEF,eAAe,aAAa,CAAC;AAM7B,eAAO,MAAM,QAAQ;;CAgBpB,CAAC;AA8DF,eAAO,MAAM,YAAY;;;;;;;;;;CAiDxB,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;CAmJ9B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;CAqG3B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;CA0G3B,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;CA8CvB,CAAC;AAGF,eAAO,MAAM,gBAAgB;;;;;;;;;;CAgD5B,CAAC"}
@@ -2,16 +2,11 @@
2
2
  import React, { useState, useLayoutEffect } from 'react';
3
3
  import { styled } from '@linaria/react';
4
4
  import { css } from '@linaria/core';
5
- import { guideImageClass } from '../../storybook/GuideImage';
6
5
  import Button from '../../components/Button/Button';
7
6
  import Drawer from './Drawer';
8
- import { preventBodyScrollClass } from './Drawer.styles';
9
7
  import Box from '../../components/Box/Box';
10
8
  import MoreVertical from '../../icons/MoreVertical';
11
9
  import { inlineCreatePortal, releaseCreatePortal } from '../../utils/_inlineCreatePortal';
12
- const releaseCreatePortalWithBodyClass = () => {
13
- releaseCreatePortal(preventBodyScrollClass);
14
- };
15
10
  const DrawerStories = {
16
11
  title: 'Patterns/Drawer',
17
12
  component: Drawer,
@@ -21,14 +16,13 @@ const DrawerStories = {
21
16
  description: {
22
17
  component: ` Drawer are sheets to provide information or to collect information inputs. In most cases, Drawers are anchored to the bottom of the screen in Mobile & App view, and centered in desktop view.
23
18
 
24
- \`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/file/sPjl33KoaW0bKVZOmm66iQ/CHOTOT-Design-System?node-id=17176%3A52673&t=kAUFUd513UAFnEne-4) \`🌟 Legacy Popup Successor \`
19
+ \`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/design/DfQM6G9p8PSNEoOzNGRjWD/v3.0-CHOTOT-Design-System---Processing?node-id=44-8801&t=hz8QJLqNrGvTVY8R-4) \`🌟 Legacy Popup Successor \`
25
20
 
26
21
  ## How to use
27
22
  * Show promotion, label explanation, information or What’s new.
28
23
  * Request confirmation when user perform important or destructive actions.
29
24
  * Congrats user after completing a userflow or achieve a milestone.
30
25
 
31
- <img className="${guideImageClass}" src="./drawer-how.png" />
32
26
  `,
33
27
  },
34
28
  },
@@ -41,6 +35,11 @@ const DrawerStories = {
41
35
  },
42
36
  open: {},
43
37
  className: { control: null },
38
+ // Hide internal prop from Storybook controls and documentation
39
+ needBypassScrollLock: {
40
+ control: null,
41
+ table: { disable: true },
42
+ },
44
43
  },
45
44
  args: {
46
45
  title: 'Drawer title',
@@ -127,19 +126,19 @@ export const WithChildren = {
127
126
  render: () => {
128
127
  inlineCreatePortal();
129
128
  useLayoutEffect(() => {
130
- releaseCreatePortalWithBodyClass();
129
+ releaseCreatePortal();
131
130
  }, []);
132
131
  return (<>
133
132
  <p>Dialog has string as children.</p>
134
133
  <Box width="full" className={popupInlineClass}>
135
- <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Drawer title" primaryBtnLabel="Button">
134
+ <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Drawer title" primaryBtnLabel="Button" needBypassScrollLock>
136
135
  Drawer&apos;s children in this case is a string. By default children have no padding,
137
136
  margin for UI customization
138
137
  </Drawer>
139
138
  </Box>
140
139
  <p className={mt24}>Drawer has React component as children.</p>
141
140
  <Box width="full" className={popupInlineClass}>
142
- <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Drawer title" primaryBtnLabel="Button">
141
+ <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Drawer title" primaryBtnLabel="Button" needBypassScrollLock>
143
142
  <Placeholder>Drawer&apos;s children in this case is a React component.</Placeholder>
144
143
  </Drawer>
145
144
  </Box>
@@ -161,7 +160,7 @@ export const CustomizeWithImage = {
161
160
  return (<>
162
161
  <p>Limit Children Height</p>
163
162
  <Box width="full" height="vH" className={`${popupInlineClass} ${ip100vhClass}`}>
164
- <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} primaryBtnLabel="One Primary">
163
+ <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} primaryBtnLabel="One Primary" needBypassScrollLock>
165
164
  <ChildrenLimitHeigthWrapper>
166
165
  <img src="https://cdn.chotot.com/admincentre/960_579.jpg" alt="img"/>
167
166
  <ChildrenTextWrapper>
@@ -219,7 +218,7 @@ export const CustomizeWithImage = {
219
218
  </Box>
220
219
  <p className={mt24}>No Limit Children Height</p>
221
220
  <Box width="full" height="vH" className={`${popupInlineClass} ${ip100vhClass}`}>
222
- <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} primaryBtnLabel="One Primary">
221
+ <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} primaryBtnLabel="One Primary" needBypassScrollLock>
223
222
  <ChildrenWrapper>
224
223
  <img src="https://cdn.chotot.com/admincentre/960_579.jpg" alt="img"/>
225
224
  <ChildrenTextWrapper>
@@ -290,12 +289,12 @@ export const CustomizeHeader = {
290
289
  render: () => {
291
290
  inlineCreatePortal();
292
291
  useLayoutEffect(() => {
293
- releaseCreatePortalWithBodyClass();
292
+ releaseCreatePortal();
294
293
  }, []);
295
294
  return (<>
296
295
  <p>Optional Button Label Text</p>
297
296
  <Box width="full" className={popupInlineClass}>
298
- <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="With Optional Button Text" primaryBtnLabel="Primary" secondaryBtnLabel="Click to Dismiss" optionalBtnLabel="Button Link">
297
+ <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="With Optional Button Text" primaryBtnLabel="Primary" secondaryBtnLabel="Click to Dismiss" optionalBtnLabel="Button Link" needBypassScrollLock>
299
298
  <ChildrenWrapper>
300
299
  <ChildrenTextWrapper>
301
300
  <h5>Section 1</h5>
@@ -313,7 +312,7 @@ export const CustomizeHeader = {
313
312
  </Box>
314
313
  <p className={mt24}>Optional Button Label Icon</p>
315
314
  <Box width="full" className={popupInlineClass}>
316
- <Drawer open onClose={() => alert('Close clicked')} title="With Optional Button Icon" onPrimaryButtonClick={onMainBtnClick} primaryBtnLabel="Primary" optionalBtnLabel={<MoreVertical />}>
315
+ <Drawer open onClose={() => alert('Close clicked')} title="With Optional Button Icon" onPrimaryButtonClick={onMainBtnClick} primaryBtnLabel="Primary" optionalBtnLabel={<MoreVertical />} needBypassScrollLock>
317
316
  <ChildrenWrapper>
318
317
  <ChildrenTextWrapper>
319
318
  <h5>Section 1</h5>
@@ -331,7 +330,7 @@ export const CustomizeHeader = {
331
330
  </Box>
332
331
  <p className={mt24}>No Close button example</p>
333
332
  <Box width="full" className={popupInlineClass}>
334
- <Drawer open haveClose={false} onClose={() => alert('Close clicked')} title="With Optional Button Icon" onPrimaryButtonClick={onMainBtnClick} primaryBtnLabel="Primary">
333
+ <Drawer open haveClose={false} onClose={() => alert('Close clicked')} title="With Optional Button Icon" onPrimaryButtonClick={onMainBtnClick} primaryBtnLabel="Primary" needBypassScrollLock>
335
334
  <ChildrenWrapper>
336
335
  <ChildrenTextWrapper>
337
336
  <h5>Section 1</h5>
@@ -362,12 +361,12 @@ export const ButtonsPosition = {
362
361
  render: () => {
363
362
  inlineCreatePortal();
364
363
  useLayoutEffect(() => {
365
- releaseCreatePortalWithBodyClass();
364
+ releaseCreatePortal();
366
365
  }, []);
367
366
  return (<>
368
367
  <p>Buttons on the Left</p>
369
368
  <Box width="full" className={popupInlineClass}>
370
- <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Buttons on the Left" primaryBtnLabel="Primary" secondaryBtnLabel="Click to Dismiss" btnRowPosition="left">
369
+ <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Buttons on the Left" primaryBtnLabel="Primary" secondaryBtnLabel="Click to Dismiss" btnRowPosition="left" needBypassScrollLock>
371
370
  <ChildrenWrapper>
372
371
  <ChildrenTextWrapper>
373
372
  <h5>Section 1</h5>
@@ -385,7 +384,7 @@ export const ButtonsPosition = {
385
384
  </Box>
386
385
  <p className={mt24}>Buttons Jutify</p>
387
386
  <Box width="full" className={popupInlineClass}>
388
- <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Buttons Jutify" primaryBtnLabel="Primary" secondaryBtnLabel="Click to Dismiss" btnRowPosition="justify">
387
+ <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Buttons Jutify" primaryBtnLabel="Primary" secondaryBtnLabel="Click to Dismiss" btnRowPosition="justify" needBypassScrollLock>
389
388
  <ChildrenWrapper>
390
389
  <ChildrenTextWrapper>
391
390
  <h5>Section 1</h5>
@@ -403,7 +402,7 @@ export const ButtonsPosition = {
403
402
  </Box>
404
403
  <p className={mt24}>Button on the Right</p>
405
404
  <Box width="full" className={popupInlineClass}>
406
- <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Buttons on the Right" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" btnRowPosition="right">
405
+ <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Buttons on the Right" primaryBtnLabel="Primary" secondaryBtnLabel="Secondary" btnRowPosition="right" needBypassScrollLock>
407
406
  <ChildrenWrapper>
408
407
  <ChildrenTextWrapper>
409
408
  <h5>Section 1</h5>
@@ -443,14 +442,14 @@ export const EmptyDrawer = {
443
442
  console.log('raf timeout release');
444
443
  // this is magic to release the inline portal
445
444
  // properly and avoid scroll lock
446
- releaseCreatePortalWithBodyClass();
445
+ releaseCreatePortal();
447
446
  });
448
447
  });
449
448
  }, []);
450
449
  return (<>
451
450
  <p>Empty Drawer No Styling</p>
452
451
  <Box width="full" className={popupInlineClass}>
453
- <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} isEmptyDrawer>
452
+ <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} isEmptyDrawer needBypassScrollLock>
454
453
  Amet minim mollit non deserunt ullamco est sit aliqua dolor do amet sint Amet minim
455
454
  mollit non deserunt ullamco est sit aliqua dolor do amet sint Amet minim mollit non
456
455
  deserunt ullamco est sit aliqua dolor do amet sint Amet minim mollit non deserunt
@@ -477,7 +476,7 @@ export const ContentClassName = {
477
476
  useLayoutEffect(() => {
478
477
  requestAnimationFrame(() => {
479
478
  requestAnimationFrame(() => {
480
- releaseCreatePortalWithBodyClass();
479
+ releaseCreatePortal();
481
480
  });
482
481
  });
483
482
  }, []);
@@ -485,7 +484,7 @@ export const ContentClassName = {
485
484
  padding: 0;
486
485
  `;
487
486
  return (<Box width="full" className={popupInlineClass}>
488
- <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Content class name demo" primaryBtnLabel="Primary" secondaryBtnLabel="Click to Dismiss" btnRowPosition="justify" contentClassName={contentClassName}>
487
+ <Drawer open onClose={() => alert('Close clicked')} onPrimaryButtonClick={onMainBtnClick} title="Content class name demo" primaryBtnLabel="Primary" secondaryBtnLabel="Click to Dismiss" btnRowPosition="justify" contentClassName={contentClassName} needBypassScrollLock>
489
488
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec purus nec nunc lacinia
490
489
  maximus. Donec vel luctus nisi. In hac habitasse platea dictumst. Nulla facilisi. Nullam
491
490
  nec purus nec nunc lacinia maximus. Donec vel luctus nisi. In hac habitasse platea dictumst.
@@ -18,7 +18,6 @@ declare const StyledButtonGroup: import("@linaria/react").StyledMeta & import("r
18
18
  as?: import("react").ElementType;
19
19
  }>;
20
20
  declare const buttonClass: import("@linaria/core").LinariaClassName;
21
- declare const preventBodyScrollClass: import("@linaria/core").LinariaClassName;
22
21
  declare const CloseButton: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & Record<never, unknown> & {
23
22
  as?: import("react").ElementType;
24
23
  }>;
@@ -36,5 +35,5 @@ declare const HeaderTopBar: import("@linaria/react").StyledMeta & import("react"
36
35
  as?: import("react").ElementType;
37
36
  }>;
38
37
  declare const noSpacingClass: import("@linaria/core").LinariaClassName;
39
- export { Modal, StyledPopup, CloseButton, OptionButton, StyledHeader, ChildrenWrapper, ChildrenContent, StyledButtonGroup, Backdrop, buttonClass, showChildrenOverflowClass, HeaderTopBar, noSpacingClass, preventBodyScrollClass, };
38
+ export { Modal, StyledPopup, CloseButton, OptionButton, StyledHeader, ChildrenWrapper, ChildrenContent, StyledButtonGroup, Backdrop, buttonClass, showChildrenOverflowClass, HeaderTopBar, noSpacingClass, };
40
39
  //# sourceMappingURL=Drawer.styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Drawer.styles.d.ts","sourceRoot":"","sources":["../../../patterns/Drawer/Drawer.styles.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,KAAK;;EAeV,CAAC;AAEF,QAAA,MAAM,QAAQ;;EAQb,CAAC;AAEF,QAAA,MAAM,WAAW;;EA4DhB,CAAC;AAEF,QAAA,MAAM,YAAY;;EAYjB,CAAC;AAEF,QAAA,MAAM,iBAAiB;cAA0B;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE;;;EAkB1E,CAAC;AAEF,QAAA,MAAM,WAAW,0CAGhB,CAAC;AAGF,QAAA,MAAM,sBAAsB,0CAG3B,CAAC;AAEF,QAAA,MAAM,WAAW;;EA0ChB,CAAC;AAEF,QAAA,MAAM,YAAY;;EA2CjB,CAAC;AAEF,QAAA,MAAM,eAAe;;EAiCpB,CAAC;AAEF,QAAA,MAAM,eAAe;;EAiCpB,CAAC;AAGF,QAAA,MAAM,yBAAyB,0CAE9B,CAAC;AAEF,QAAA,MAAM,YAAY;;EAcjB,CAAC;AAEF,QAAA,MAAM,cAAc,0CAEnB,CAAC;AAEF,OAAO,EACL,KAAK,EACL,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,yBAAyB,EACzB,YAAY,EACZ,cAAc,EACd,sBAAsB,GACvB,CAAC"}
1
+ {"version":3,"file":"Drawer.styles.d.ts","sourceRoot":"","sources":["../../../patterns/Drawer/Drawer.styles.ts"],"names":[],"mappings":"AAmBA,QAAA,MAAM,KAAK;;EAeV,CAAC;AAEF,QAAA,MAAM,QAAQ;;EAQb,CAAC;AAEF,QAAA,MAAM,WAAW;;EA4DhB,CAAC;AAEF,QAAA,MAAM,YAAY;;EAYjB,CAAC;AAEF,QAAA,MAAM,iBAAiB;cAA0B;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE;;;EAkB1E,CAAC;AAEF,QAAA,MAAM,WAAW,0CAGhB,CAAC;AAEF,QAAA,MAAM,WAAW;;EA0ChB,CAAC;AAEF,QAAA,MAAM,YAAY;;EA2CjB,CAAC;AAEF,QAAA,MAAM,eAAe;;EAiCpB,CAAC;AAEF,QAAA,MAAM,eAAe;;EAiCpB,CAAC;AAGF,QAAA,MAAM,yBAAyB,0CAE9B,CAAC;AAEF,QAAA,MAAM,YAAY;;EAcjB,CAAC;AAEF,QAAA,MAAM,cAAc,0CAEnB,CAAC;AAEF,OAAO,EACL,KAAK,EACL,WAAW,EACX,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,yBAAyB,EACzB,YAAY,EACZ,cAAc,GACf,CAAC"}
@@ -124,11 +124,6 @@ const buttonClass = css `
124
124
  justify-content: center;
125
125
  width: ${sizes.full};
126
126
  `;
127
- // We need to use !important to override the body scroll
128
- const preventBodyScrollClass = css `
129
- /* stylelint-disable declaration-no-important */
130
- overflow: hidden !important;
131
- `;
132
127
  const CloseButton = styled.button `
133
128
  position: absolute;
134
129
  top: ${space.md};
@@ -306,4 +301,4 @@ const HeaderTopBar = styled.div `
306
301
  const noSpacingClass = css `
307
302
  margin: 0;
308
303
  `;
309
- export { Modal, StyledPopup, CloseButton, OptionButton, StyledHeader, ChildrenWrapper, ChildrenContent, StyledButtonGroup, Backdrop, buttonClass, showChildrenOverflowClass, HeaderTopBar, noSpacingClass, preventBodyScrollClass, };
304
+ export { Modal, StyledPopup, CloseButton, OptionButton, StyledHeader, ChildrenWrapper, ChildrenContent, StyledButtonGroup, Backdrop, buttonClass, showChildrenOverflowClass, HeaderTopBar, noSpacingClass, };
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- export type EmptyStateType = 'connectionError' | 'emptyAd' | 'noFilterResult' | 'noNetwork' | 'noResult' | 'notFound' | 'other' | 'underMaintenance';
2
+ export type EmptyStateType = 'maintenance' | 'keywordNoResult' | 'filterNoResult' | 'noAvailable' | 'grantAccess' | 'notFound' | 'disconnection' | 'other';
3
3
  export interface EmptyStateProps {
4
4
  /**
5
5
  * Type of Empty State
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyState.d.ts","sourceRoot":"","sources":["../../../patterns/EmptyState/EmptyState.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA0D/B,MAAM,MAAM,cAAc,GACtB,iBAAiB,GACjB,SAAS,GACT,gBAAgB,GAChB,WAAW,GACX,UAAU,GACV,UAAU,GACV,OAAO,GACP,kBAAkB,CAAC;AAEvB,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,EAAE,cAAc,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC3D;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AACD;;;;GAIG;AAEH,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA2BzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"EmptyState.d.ts","sourceRoot":"","sources":["../../../patterns/EmptyState/EmptyState.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAW/B,MAAM,MAAM,cAAc,GACtB,aAAa,GACb,iBAAiB,GACjB,gBAAgB,GAChB,aAAa,GACb,aAAa,GACb,UAAU,GACV,eAAe,GACf,OAAO,CAAC;AA+DZ,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,EAAE,cAAc,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC3D;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AACD;;;;GAIG;AAEH,QAAA,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAgCzC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,52 +1,54 @@
1
1
  'use client';
2
2
  import * as React from 'react';
3
- import { StyledEmptyState, StyledSVGWrapper, StyledButtonWrapper, StyledEmptyHeaderText, StyledEmptyBodyText, } from './EmptyState.styles';
3
+ import { emptyStateClass, emptyStateContentClass, emptyStateContentTextClass, } from './EmptyState.styles';
4
4
  import Button from '../../components/Button/Button';
5
5
  import noop from '../../utils/noop';
6
+ const BASE_IMAGE_URL = 'https://storage.googleapis.com/static-chotot-com/storage/empty_state/png';
6
7
  const EMPTY = {
7
8
  notFound: {
8
- title: 'Đã có lỗi xảy ra!',
9
- description: 'Rất tiếc, trang bạn đang tìm không tồn tại. Vui lòng kiểm tra lại đường dẫn.',
10
- buttonLabel: 'Về trang chủ',
11
- svg: 'https://static.chotot.com/storage/empty_state/svg/not-found-v2.svg',
9
+ title: 'Trang không tồn tại',
10
+ description: 'Có khi nào bạn nhầm đường dẫn không?',
11
+ buttonLabel: 'Trở về trang chủ',
12
+ img: `${BASE_IMAGE_URL}/404.png`,
12
13
  },
13
- noResult: {
14
- title: 'Không tìm thấy kết quả nào',
15
- description: `Hãy chắc chắn rằng tất cả các từ đều đúng chính tả.
16
- Hãy thử những từ khóa khác hoặc những từ khóa chung hơn.`,
17
- buttonLabel: 'Xoá từ khoá',
18
- svg: 'https://static.chotot.com/storage/empty_state/svg/no-result-v2.svg',
14
+ maintenance: {
15
+ title: 'Tạm nghỉ để bảo trì',
16
+ description: 'Chút nữa ghé lại nha bạn ơi. \nXin hứa trải nghiệm sẽ mượt hơn nhiều!',
17
+ buttonLabel: 'Trở về trang chủ',
18
+ img: `${BASE_IMAGE_URL}/maintenance.png`,
19
19
  },
20
- noFilterResult: {
21
- title: 'Không có kết quả cho bộ lọc',
22
- description: 'Hãy kiểm tra bộ lọc của bạn hoặc xoá và thử lại.',
23
- buttonLabel: 'Xoá bộ lọc',
24
- svg: 'https://static.chotot.com/storage/empty_state/svg/no-result-v2.svg',
20
+ keywordNoResult: {
21
+ title: 'Hic! Chưa tìm thấy kết quả nào',
22
+ description: 'Thử đổi từ khóa, viết đúng chính tả, những deal ngon ‘“sốt xình xịch” sẽ hiện ra nhanh thôi!',
23
+ buttonLabel: 'Thay đổi từ khóa',
24
+ img: `${BASE_IMAGE_URL}/keyword-no-result.png`,
25
25
  },
26
- noNetwork: {
27
- title: 'Có lỗi mạng',
28
- description: 'Hãy kiểm tra lại internet/ wifi của bạn.',
29
- buttonLabel: 'Thử lại',
30
- svg: 'https://static.chotot.com/storage/empty_state/svg/no-network-v2.svg',
26
+ filterNoResult: {
27
+ title: 'Không có kết quả cho bộ lọc đã chọn',
28
+ description: 'Không tìm thấy tin đăng cho những gì bạn đã lọc. Hãy thay đổi tiêu chí Lọc hoặc Bỏ lọc.',
29
+ buttonLabel: 'Thay đổi bộ lọc',
30
+ img: `${BASE_IMAGE_URL}/filter-no-result.png`,
31
31
  },
32
- emptyAd: {
32
+ noAvailable: {
33
33
  title: 'Tin đăng không còn tồn tại',
34
- description: `Tin đăng này đã hết hạn hoặc đã ẩn/ đã bán.
35
- Hãy thử những tin đăng khác, bạn nhé.`,
36
- buttonLabel: 'Về trang chủ',
37
- svg: 'https://static.chotot.com/storage/empty_state/svg/empty-ad-v2.svg',
34
+ description: 'Một là hết hạn, hai là bị ẩn, ba là đã bán. Xem tiếp các tin khác để không bỏ lỡ deal xịn nha!',
35
+ buttonLabel: 'Trở về trang chủ',
36
+ img: `${BASE_IMAGE_URL}/no-available.png`,
38
37
  },
39
- connectionError: {
40
- title: 'Không thể kết nối đến máy chủ',
41
- description: 'Rất tiếc, đã có lỗi xảy ra. Xin hãy thử tải lại trang.',
42
- buttonLabel: 'Thử lại',
43
- svg: 'https://static.chotot.com/storage/empty_state/svg/connection-error-v2.svg',
38
+ grantAccess: {
39
+ title: 'Xin quyền truy cập nha!',
40
+ description: (<p>
41
+ Cần quyền truy cập Ảnh để sử dụng tính năng đăng tin. Truy cập vào <strong>Cài đặt</strong>{' '}
42
+ {'>'} <strong>Ứng dụng</strong> {'>'} Chợ Tốt Bật <strong>“Ảnh”</strong>
43
+ </p>),
44
+ buttonLabel: 'Cho phép',
45
+ img: `${BASE_IMAGE_URL}/grant-access.png`,
44
46
  },
45
- underMaintenance: {
46
- title: 'Rất tiếc, trang này đang được bảo trì',
47
- description: 'Chúng tôi đang cố gắng nâng cấp để trải nghiệm của bạn được tốt hơn.',
48
- buttonLabel: 'Về trang chủ',
49
- svg: 'https://static.chotot.com/storage/empty_state/svg/under-maintenance-v2.svg',
47
+ disconnection: {
48
+ title: 'Tạm mất kết nối :(',
49
+ description: 'Nhưng không sao! Deal ngon giá tốt vẫn ở đây & được cập nhật liên tục! Nhanh tay kiểm tra lại wifi/4G để không lỡ deal hot nha!',
50
+ buttonLabel: 'Thử lại trang',
51
+ img: `${BASE_IMAGE_URL}/disconnection.png`,
50
52
  },
51
53
  };
52
54
  /**
@@ -56,21 +58,24 @@ Hãy thử những tin đăng khác, bạn nhé.`,
56
58
  */
57
59
  const EmptyState = ({ type, title = null, coverImage = null, description = null, buttonLabel = null, onButtonClick = noop, }) => {
58
60
  var _a, _b, _c, _d;
59
- const svgUrl = coverImage !== null && coverImage !== void 0 ? coverImage : (_a = EMPTY === null || EMPTY === void 0 ? void 0 : EMPTY[type]) === null || _a === void 0 ? void 0 : _a.svg;
61
+ const imgUrl = coverImage !== null && coverImage !== void 0 ? coverImage : (_a = EMPTY === null || EMPTY === void 0 ? void 0 : EMPTY[type]) === null || _a === void 0 ? void 0 : _a.img;
60
62
  const headerText = title !== null && title !== void 0 ? title : (_b = EMPTY === null || EMPTY === void 0 ? void 0 : EMPTY[type]) === null || _b === void 0 ? void 0 : _b.title;
61
63
  const descriptionText = description !== null && description !== void 0 ? description : (_c = EMPTY === null || EMPTY === void 0 ? void 0 : EMPTY[type]) === null || _c === void 0 ? void 0 : _c.description;
62
64
  const buttonLabelText = buttonLabel !== null && buttonLabel !== void 0 ? buttonLabel : (_d = EMPTY === null || EMPTY === void 0 ? void 0 : EMPTY[type]) === null || _d === void 0 ? void 0 : _d.buttonLabel;
63
- return (<StyledEmptyState data-clad="Empty State">
64
- <StyledSVGWrapper>
65
- <img src={svgUrl} alt={headerText} width={400} height={260}/>
66
- </StyledSVGWrapper>
67
- <StyledEmptyHeaderText>{headerText}</StyledEmptyHeaderText>
68
- <StyledEmptyBodyText>{descriptionText}</StyledEmptyBodyText>
69
- <StyledButtonWrapper>
70
- <Button size="medium" color="primary" onClick={onButtonClick} stretch>
65
+ const descriptionHtml = typeof descriptionText === 'string' ? <p>{descriptionText}</p> : descriptionText;
66
+ return (<div className={emptyStateClass} data-clad="Empty State">
67
+ <img src={imgUrl} alt={headerText} width={200} height={200}/>
68
+
69
+ <div className={emptyStateContentClass}>
70
+ <div className={emptyStateContentTextClass}>
71
+ <h3>{headerText}</h3>
72
+
73
+ {descriptionHtml}
74
+ </div>
75
+ <Button size="large" color="primary" onClick={onButtonClick}>
71
76
  {buttonLabelText}
72
77
  </Button>
73
- </StyledButtonWrapper>
74
- </StyledEmptyState>);
78
+ </div>
79
+ </div>);
75
80
  };
76
81
  export default EmptyState;
@@ -28,7 +28,17 @@ export declare const OverrideStyle: {
28
28
  };
29
29
  };
30
30
  };
31
- export declare const OthersType: {
31
+ export declare const AllTypes: {
32
+ render: () => JSX.Element;
33
+ parameters: {
34
+ docs: {
35
+ description: {
36
+ story: string;
37
+ };
38
+ };
39
+ };
40
+ };
41
+ export declare const OtherType: {
32
42
  render: () => JSX.Element;
33
43
  parameters: {
34
44
  docs: {
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyState.stories.d.ts","sourceRoot":"","sources":["../../../patterns/EmptyState/EmptyState.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;CAoCtB,CAAC;AAEF,eAAe,iBAAiB,CAAC;AAEjC,eAAO,MAAM,QAAQ;;CAQpB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;CAuBzB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;CAyBtB,CAAC"}
1
+ {"version":3,"file":"EmptyState.stories.d.ts","sourceRoot":"","sources":["../../../patterns/EmptyState/EmptyState.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;CAoCtB,CAAC;AAEF,eAAe,iBAAiB,CAAC;AAEjC,eAAO,MAAM,QAAQ;;CAQpB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;CAuBzB,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;;CAyCpB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;;;;;CAyBrB,CAAC"}
@@ -11,25 +11,25 @@ const emptyStateStories = {
11
11
  description: {
12
12
  component: `EmptyState for showing Empty UI
13
13
 
14
- \`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/file/sPjl33KoaW0bKVZOmm66iQ/CHOTOT-Design-System?node-id=17194%3A24340&t=ghK8jXiG8TSug7sl-4)
14
+ \`✅ Stable\` [\`🎨 Figma Specs\`](https://www.figma.com/design/DfQM6G9p8PSNEoOzNGRjWD/v3.0-CHOTOT-Design-System---Processing?node-id=14424-23223&t=hz8QJLqNrGvTVY8R-4)
15
15
 
16
16
  ## How to use
17
- EmptyState is a component for showing empty UI base on type of empty with an interactive button
17
+ EmptyState is a component for showing empty UI based on type of empty with an interactive button
18
18
 
19
19
  This component is mobile supported
20
20
 
21
- It's also come with others type for dynamic usage customization. See below example
21
+ It also comes with an 'other' type for dynamic usage customization. See below examples
22
22
 
23
23
  There are 7 main types of Empty State and 1 custom type:
24
24
 
25
25
  - \`notFound\`: For empty page by error 404/ wrong url
26
- - \`noResult\`: For empty search result
27
- - \`noFilterResult\`: For empty filter result
28
- - \`noNetwork\`: For user have no internet/ connection to page
29
- - \`emptyAd\`: For ad which no-longer available
30
- - \`connectionError\`: For error belong to server connection
31
- - \`underMaintenance\`: For page which under maintenance
32
- - \`others\`: Customizable type
26
+ - \`maintenance\`: For page which is under maintenance
27
+ - \`keywordNoResult\`: For empty search result
28
+ - \`filterNoResult\`: For empty filter result
29
+ - \`noAvailable\`: For ads which are no longer available
30
+ - \`grantAccess\`: For requesting user permissions
31
+ - \`disconnection\`: For network connection errors
32
+ - \`other\`: Customizable type
33
33
 
34
34
  `,
35
35
  },
@@ -67,7 +67,46 @@ export const OverrideStyle = {
67
67
  },
68
68
  },
69
69
  };
70
- export const OthersType = {
70
+ export const AllTypes = {
71
+ render: () => (<Grid gutter="md">
72
+ <Col span={[12, 6, 4]}>
73
+ <h4>Not Found</h4>
74
+ <EmptyState type="notFound"/>
75
+ </Col>
76
+ <Col span={[12, 6, 4]}>
77
+ <h4>Maintenance</h4>
78
+ <EmptyState type="maintenance"/>
79
+ </Col>
80
+ <Col span={[12, 6, 4]}>
81
+ <h4>Keyword No Result</h4>
82
+ <EmptyState type="keywordNoResult"/>
83
+ </Col>
84
+ <Col span={[12, 6, 4]}>
85
+ <h4>Filter No Result</h4>
86
+ <EmptyState type="filterNoResult"/>
87
+ </Col>
88
+ <Col span={[12, 6, 4]}>
89
+ <h4>No Available</h4>
90
+ <EmptyState type="noAvailable"/>
91
+ </Col>
92
+ <Col span={[12, 6, 4]}>
93
+ <h4>Grant Access</h4>
94
+ <EmptyState type="grantAccess"/>
95
+ </Col>
96
+ <Col span={[12, 6, 4]}>
97
+ <h4>Disconnection</h4>
98
+ <EmptyState type="disconnection"/>
99
+ </Col>
100
+ </Grid>),
101
+ parameters: {
102
+ docs: {
103
+ description: {
104
+ story: 'This shows all available EmptyState types with their default content',
105
+ },
106
+ },
107
+ },
108
+ };
109
+ export const OtherType = {
71
110
  render: () => {
72
111
  const props = {
73
112
  title: 'Test Custom Type Title',
@@ -84,7 +123,7 @@ export const OthersType = {
84
123
  parameters: {
85
124
  docs: {
86
125
  description: {
87
- story: 'This show how to use customization feature with others type',
126
+ story: 'This shows how to use customization feature with the other type',
88
127
  },
89
128
  },
90
129
  },
@@ -1,16 +1,4 @@
1
- export declare const StyledEmptyState: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
2
- as?: import("react").ElementType;
3
- }>;
4
- export declare const StyledEmptyHeaderText: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLHeadingElement> & import("react").HTMLAttributes<HTMLHeadingElement> & Record<never, unknown> & {
5
- as?: import("react").ElementType;
6
- }>;
7
- export declare const StyledEmptyBodyText: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLParagraphElement> & import("react").HTMLAttributes<HTMLParagraphElement> & Record<never, unknown> & {
8
- as?: import("react").ElementType;
9
- }>;
10
- export declare const StyledSVGWrapper: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
11
- as?: import("react").ElementType;
12
- }>;
13
- export declare const StyledButtonWrapper: import("@linaria/react").StyledMeta & import("react").FunctionComponent<import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & Record<never, unknown> & {
14
- as?: import("react").ElementType;
15
- }>;
1
+ export declare const emptyStateClass: import("@linaria/core").LinariaClassName;
2
+ export declare const emptyStateContentClass: import("@linaria/core").LinariaClassName;
3
+ export declare const emptyStateContentTextClass: import("@linaria/core").LinariaClassName;
16
4
  //# sourceMappingURL=EmptyState.styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmptyState.styles.d.ts","sourceRoot":"","sources":["../../../patterns/EmptyState/EmptyState.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;EAS5B,CAAC;AAEF,eAAO,MAAM,qBAAqB;;EAKjC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;EAY/B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;EAwB5B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;EAE/B,CAAC"}
1
+ {"version":3,"file":"EmptyState.styles.d.ts","sourceRoot":"","sources":["../../../patterns/EmptyState/EmptyState.styles.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe,0CAa3B,CAAC;AAEF,eAAO,MAAM,sBAAsB,0CAMlC,CAAC;AAEF,eAAO,MAAM,0BAA0B,0CAkBtC,CAAC"}