@arcblock/ux 2.6.8 → 2.7.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 (164) hide show
  1. package/babel.config.es.js +12 -0
  2. package/es/ActionButton/index.js +99 -0
  3. package/es/ActivityIndicator/index.js +180 -0
  4. package/es/Address/compact-text.js +105 -0
  5. package/es/Address/did-address.js +211 -0
  6. package/es/Address/index.js +23 -0
  7. package/es/Address/responsive-did-address.js +88 -0
  8. package/es/Alert/index.js +134 -0
  9. package/es/AnimationWaiter/default-animation.json +1 -0
  10. package/es/AnimationWaiter/index.js +239 -0
  11. package/es/Async/index.js +38 -0
  12. package/es/Avatar/did-motif.js +64 -0
  13. package/es/Avatar/etherscan-blockies.js +83 -0
  14. package/es/Avatar/index.js +176 -0
  15. package/es/Badge/index.js +98 -0
  16. package/es/Blocklet/blocklet.js +298 -0
  17. package/es/Blocklet/index.js +4 -0
  18. package/es/Blocklet/utils.js +52 -0
  19. package/es/BlockletNFT/index.js +412 -0
  20. package/es/Button/index.js +8 -0
  21. package/es/Button/wrap.js +140 -0
  22. package/es/ButtonGroup/index.js +6 -0
  23. package/es/CardSelector/index.js +131 -0
  24. package/es/Center/index.js +41 -0
  25. package/es/ClickToCopy/copy-button.js +72 -0
  26. package/es/ClickToCopy/hook.js +39 -0
  27. package/es/ClickToCopy/index.js +93 -0
  28. package/es/CodeBlock/LightBox.js +85 -0
  29. package/es/CodeBlock/index.js +226 -0
  30. package/es/Colors/index.js +2 -0
  31. package/es/Colors/themes/default.js +78 -0
  32. package/es/ContactForm/index.js +230 -0
  33. package/es/CookieConsent/index.js +113 -0
  34. package/es/CountDown/index.js +178 -0
  35. package/es/DID/index.js +105 -0
  36. package/es/Datatable/CustomToolbar.js +396 -0
  37. package/es/Datatable/DatatableContext.js +34 -0
  38. package/es/Datatable/TableSearch.js +165 -0
  39. package/es/Datatable/index.js +627 -0
  40. package/es/Datatable/utils.js +132 -0
  41. package/es/Dialog/confirm.js +90 -0
  42. package/es/Dialog/dialog.js +192 -0
  43. package/es/Dialog/index.js +3 -0
  44. package/es/DidLogo/index.js +31 -0
  45. package/es/DriftBot/index.js +70 -0
  46. package/es/Earth/countries.json +8057 -0
  47. package/es/Earth/index.js +521 -0
  48. package/es/Earth/util.js +51 -0
  49. package/es/Empty/index.js +64 -0
  50. package/es/ErrorBoundary/fallback.js +73 -0
  51. package/es/ErrorBoundary/index.js +1 -0
  52. package/es/Footer/index.js +172 -0
  53. package/es/Header/auto-hidden.js +35 -0
  54. package/es/Header/header.js +211 -0
  55. package/es/Header/index.js +2 -0
  56. package/es/Header/responsive-header.js +111 -0
  57. package/es/Icon/image.js +65 -0
  58. package/es/Icon/index.js +84 -0
  59. package/es/Img/index.js +217 -0
  60. package/es/InfoRow/index.js +87 -0
  61. package/es/Layout/dashboard/external-link.js +58 -0
  62. package/es/Layout/dashboard/full-page.js +53 -0
  63. package/es/Layout/dashboard/index.js +275 -0
  64. package/es/Layout/dashboard/sidebar.js +209 -0
  65. package/es/Layout/dashboard-legacy/header.js +174 -0
  66. package/es/Layout/dashboard-legacy/index.js +149 -0
  67. package/es/Layout/dashboard-legacy/sidebar.js +129 -0
  68. package/es/Layout/index.js +335 -0
  69. package/es/Locale/browser-lang.js +52 -0
  70. package/es/Locale/context.js +114 -0
  71. package/es/Locale/languages.js +60 -0
  72. package/es/Locale/selector.js +180 -0
  73. package/es/Locale/util.js +13 -0
  74. package/es/Logo/images/logo-dark-text.svg +3 -0
  75. package/es/Logo/images/logo-dark-top.svg +6 -0
  76. package/es/Logo/images/logo-light-text.svg +3 -0
  77. package/es/Logo/images/logo-light-top.svg +6 -0
  78. package/es/Logo/index.js +136 -0
  79. package/es/Metric/index.js +132 -0
  80. package/es/NFTDisplay/README.md +59 -0
  81. package/es/NFTDisplay/aspect-ratio-container.js +39 -0
  82. package/es/NFTDisplay/broken.js +18 -0
  83. package/es/NFTDisplay/demo/data/asset-state-display-url.json +7 -0
  84. package/es/NFTDisplay/demo/data/asset-state-gzipped-svg-1-1.json +10 -0
  85. package/es/NFTDisplay/demo/data/asset-state-gzipped-svg-374-130.json +10 -0
  86. package/es/NFTDisplay/demo/data/asset-state-gzipped-svg-with-foreign-object.json +20 -0
  87. package/es/NFTDisplay/demo/data/asset-state-svg.json +29 -0
  88. package/es/NFTDisplay/demo/data/asset-state-url.json +10 -0
  89. package/es/NFTDisplay/index.js +323 -0
  90. package/es/NFTDisplay/loading.js +18 -0
  91. package/es/NFTDisplay/svg-embedder/img.js +45 -0
  92. package/es/NFTDisplay/svg-embedder/inline-svg.js +39 -0
  93. package/es/NavMenu/index.js +2 -0
  94. package/es/NavMenu/nav-menu.js +286 -0
  95. package/es/NavMenu/style.js +176 -0
  96. package/es/PageScroller/index.js +286 -0
  97. package/es/PageScroller/story/FifthComponent.js +9 -0
  98. package/es/PageScroller/story/FirstComponent.js +9 -0
  99. package/es/PageScroller/story/FourthComponent.js +12 -0
  100. package/es/PageScroller/story/FullPage.js +47 -0
  101. package/es/PageScroller/story/PageContain.js +59 -0
  102. package/es/PageScroller/story/SecondComponent.js +9 -0
  103. package/es/PageScroller/story/ThirdComponent.js +9 -0
  104. package/es/PageScroller/story/index.css +115 -0
  105. package/es/PageScroller/usePrevValue.js +9 -0
  106. package/es/PricingTable/PricingPlan.js +124 -0
  107. package/es/PricingTable/index.js +53 -0
  108. package/es/QRCode/index.js +72 -0
  109. package/es/RelativeTime/index.js +98 -0
  110. package/es/Result/common.js +140 -0
  111. package/es/Result/demo/fixtures/result-image-404.svg +1 -0
  112. package/es/Result/index.js +33 -0
  113. package/es/Result/result.js +59 -0
  114. package/es/Result/translations.js +54 -0
  115. package/es/Screenshot/BaseScreenshot/index.js +91 -0
  116. package/es/Screenshot/BaseScreenshot/shells/Macbook.js +51 -0
  117. package/es/Screenshot/BaseScreenshot/shells/Phone.js +36 -0
  118. package/es/Screenshot/demo/images/bg-00.jpg +0 -0
  119. package/es/Screenshot/demo/images/bg-01.jpg +0 -0
  120. package/es/Screenshot/demo/images/bg-02.jpg +0 -0
  121. package/es/Screenshot/demo/images/bg-03.jpg +0 -0
  122. package/es/Screenshot/demo/images/bg-04.jpg +0 -0
  123. package/es/Screenshot/demo/images/bg-05.jpg +0 -0
  124. package/es/Screenshot/demo/images/bg-06.jpg +0 -0
  125. package/es/Screenshot/demo/images/bg-07.jpg +0 -0
  126. package/es/Screenshot/demo/images/bg-08.jpg +0 -0
  127. package/es/Screenshot/demo/images/bg-09.jpg +0 -0
  128. package/es/Screenshot/devices.css +1366 -0
  129. package/es/Screenshot/index.js +299 -0
  130. package/es/SessionManager/federated-login-detecter.js +166 -0
  131. package/es/SessionManager/index.js +468 -0
  132. package/es/SessionManager/user-popper.js +132 -0
  133. package/es/Sparkline/index.js +193 -0
  134. package/es/Spinner/index.js +28 -0
  135. package/es/SplitButton/index.js +144 -0
  136. package/es/Switch/index.js +96 -0
  137. package/es/Tabs/index.js +48 -0
  138. package/es/Tag/index.js +108 -0
  139. package/es/TextCollapse/index.js +92 -0
  140. package/es/Theme/index.js +16 -0
  141. package/es/Theme/theme-provider.js +39 -0
  142. package/es/Theme/theme.js +133 -0
  143. package/es/Toast/index.js +95 -0
  144. package/es/Util/deprecate.js +28 -0
  145. package/es/Util/index.js +298 -0
  146. package/es/Util/wallet.js +32 -0
  147. package/es/Video/index.js +89 -0
  148. package/es/Wallet/Action.js +119 -0
  149. package/es/Wallet/Download.js +331 -0
  150. package/es/Wallet/Open.js +45 -0
  151. package/es/Wallet/images/abtwallet.png +0 -0
  152. package/es/Wallet/images/android_download.svg +23 -0
  153. package/es/Wallet/images/app-store.svg +20 -0
  154. package/es/Wallet/images/google-play.svg +70 -0
  155. package/es/WebWalletSWKeeper/index.js +115 -0
  156. package/es/WechatPrompt/images/android.png +0 -0
  157. package/es/WechatPrompt/images/ios.png +0 -0
  158. package/es/WechatPrompt/index.js +88 -0
  159. package/es/index.js +38 -0
  160. package/es/withTheme/index.js +69 -0
  161. package/es/withTracker/README.md +34 -0
  162. package/es/withTracker/error_boundary.js +34 -0
  163. package/es/withTracker/index.js +56 -0
  164. package/package.json +272 -5
@@ -0,0 +1,286 @@
1
+ /* eslint-disable jsx-a11y/no-noninteractive-tabindex */
2
+ import { Children, cloneElement, useCallback, useEffect, useRef, useState } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import isEqual from 'lodash/isEqual';
5
+ import isNil from 'lodash/isNil';
6
+ import isNull from 'lodash/isNull';
7
+ import usePrevious from './usePrevValue';
8
+ import { withDeprecated } from '../Util/deprecate';
9
+ import { jsx as _jsx } from "react/jsx-runtime";
10
+ const Events = {
11
+ TOUCHMOVE: 'touchmove',
12
+ KEYDOWN: 'keydown'
13
+ };
14
+ const DEFAULT_ANIMATION_TIMER = 500;
15
+ const DEFAULT_ANIMATION = 'ease-in-out';
16
+ const DEFAULT_CONTAINER_HEIGHT = '100vh';
17
+ const DEFAULT_CONTAINER_WIDTH = '100vw';
18
+ const DEFAULT_COMPONENT_INDEX = 0;
19
+ const DEFAULT_COMPONENTS_TO_RENDER_LENGTH = 0;
20
+ const ANIMATION_TIMER_BUFFER = 100;
21
+ const KEY_UP = 38;
22
+ const KEY_DOWN = 40;
23
+ const DISABLED_CLASS_NAME = 'rps-scroll--disabled';
24
+ let previousTouchMove = null;
25
+ let isScrolling = false;
26
+ let isMounted = false;
27
+ let isBodyScrollEnabled = true;
28
+ let isTransitionAfterComponentsToRenderChanged = false;
29
+ const containers = [];
30
+ function PageScroller({
31
+ animationTimer,
32
+ blockScrollDown,
33
+ blockScrollUp,
34
+ children,
35
+ height,
36
+ width,
37
+ customPageNumber,
38
+ onScrollUnavailable,
39
+ onChange,
40
+ renderAllPagesOnFirstRender,
41
+ transitionTimingFunction
42
+ }) {
43
+ const [componentIndex, setComponentIndex] = useState(DEFAULT_COMPONENT_INDEX);
44
+ const [componentsToRenderLength, setComponentsToRenderLength] = useState(DEFAULT_COMPONENTS_TO_RENDER_LENGTH);
45
+ const prevComponentIndex = usePrevious(componentIndex);
46
+ const pageContainer = useRef(null);
47
+ const addNextComponent = useCallback(componentsToRenderOnMountLength => {
48
+ let tempComponentsToRenderLength = 0;
49
+ if (!isNil(componentsToRenderOnMountLength)) {
50
+ tempComponentsToRenderLength = componentsToRenderOnMountLength;
51
+ }
52
+ tempComponentsToRenderLength = Math.max(tempComponentsToRenderLength, componentsToRenderLength);
53
+ if (tempComponentsToRenderLength <= componentIndex + 1) {
54
+ if (!isNil(children[componentIndex + 1])) {
55
+ tempComponentsToRenderLength++;
56
+ }
57
+ }
58
+ setComponentsToRenderLength(tempComponentsToRenderLength);
59
+ }, [children, componentIndex, componentsToRenderLength]);
60
+ const checkRenderOnMount = useCallback(() => {
61
+ if (renderAllPagesOnFirstRender) {
62
+ setComponentsToRenderLength(Children.count(children));
63
+ } else if (!isNil(children[DEFAULT_COMPONENT_INDEX + 1])) {
64
+ addNextComponent(DEFAULT_COMPONENTS_TO_RENDER_LENGTH + 1);
65
+ }
66
+ }, [addNextComponent, children, renderAllPagesOnFirstRender]);
67
+ const disableScroll = useCallback(() => {
68
+ if (isBodyScrollEnabled) {
69
+ isBodyScrollEnabled = false;
70
+ window.scrollTo({
71
+ left: 0,
72
+ top: 0,
73
+ behavior: 'smooth'
74
+ });
75
+ document.body.classList.add(DISABLED_CLASS_NAME);
76
+ document.documentElement.classList.add(DISABLED_CLASS_NAME);
77
+ }
78
+ }, []);
79
+ const enableDocumentScroll = useCallback(() => {
80
+ if (!isBodyScrollEnabled) {
81
+ isBodyScrollEnabled = true;
82
+ document.body.classList.remove(DISABLED_CLASS_NAME);
83
+ document.documentElement.classList.remove(DISABLED_CLASS_NAME);
84
+ }
85
+ }, []);
86
+ const setRenderComponents = useCallback(() => {
87
+ const newComponentsToRender = [];
88
+ let i = 0;
89
+ while (i < componentsToRenderLength && !isNil(children[i])) {
90
+ containers[i] = true;
91
+ newComponentsToRender.push( /*#__PURE__*/_jsx("div", {
92
+ style: {
93
+ height: '100%',
94
+ width: '100%'
95
+ },
96
+ children: /*#__PURE__*/cloneElement(children[i], {
97
+ ...children[i].props
98
+ })
99
+ }, i));
100
+ i++;
101
+ }
102
+ return newComponentsToRender;
103
+ }, [children, componentsToRenderLength]);
104
+ const scrollWindowDown = useCallback(() => {
105
+ if (!isScrolling && !blockScrollDown) {
106
+ if (!isNil(containers[componentIndex + 1])) {
107
+ disableScroll();
108
+ isScrolling = true;
109
+ pageContainer.current.style.transform = `translate3d(0, ${(componentIndex + 1) * -100}%, 0)`; // prettier-ignore
110
+
111
+ setTimeout(() => {
112
+ if (isMounted) {
113
+ setComponentIndex(prevState => prevState + 1);
114
+ }
115
+ }, animationTimer + ANIMATION_TIMER_BUFFER);
116
+ } else {
117
+ enableDocumentScroll();
118
+ if (onScrollUnavailable) {
119
+ onScrollUnavailable();
120
+ }
121
+ }
122
+ }
123
+ }, [animationTimer, blockScrollDown, componentIndex, disableScroll, enableDocumentScroll, onScrollUnavailable]);
124
+ const scrollWindowUp = useCallback(() => {
125
+ if (!isScrolling && !blockScrollUp) {
126
+ if (!isNil(containers[componentIndex - 1])) {
127
+ disableScroll();
128
+ isScrolling = true;
129
+ pageContainer.current.style.transform = `translate3d(0, ${(componentIndex - 1) * -100}%, 0)`; // prettier-ignore
130
+
131
+ setTimeout(() => {
132
+ if (isMounted) {
133
+ setComponentIndex(prevState => prevState - 1);
134
+ }
135
+ }, animationTimer + ANIMATION_TIMER_BUFFER);
136
+ } else {
137
+ enableDocumentScroll();
138
+ if (onScrollUnavailable) {
139
+ onScrollUnavailable();
140
+ }
141
+ }
142
+ }
143
+ }, [animationTimer, blockScrollUp, componentIndex, disableScroll, enableDocumentScroll, onScrollUnavailable]);
144
+ const touchMove = useCallback(event => {
145
+ if (!isNull(previousTouchMove)) {
146
+ if (event.touches[0].clientY > previousTouchMove) {
147
+ scrollWindowUp();
148
+ } else {
149
+ scrollWindowDown();
150
+ }
151
+ } else {
152
+ previousTouchMove = event.touches[0].clientY;
153
+ }
154
+ }, [scrollWindowDown, scrollWindowUp]);
155
+ const wheelScroll = useCallback(event => {
156
+ if (event.deltaY < 0) {
157
+ scrollWindowUp();
158
+ } else {
159
+ scrollWindowDown();
160
+ }
161
+ }, [scrollWindowDown, scrollWindowUp]);
162
+ const keyPress = useCallback(event => {
163
+ if (isEqual(event.keyCode, KEY_UP)) {
164
+ scrollWindowUp();
165
+ }
166
+ if (isEqual(event.keyCode, KEY_DOWN)) {
167
+ scrollWindowDown();
168
+ }
169
+ }, [scrollWindowDown, scrollWindowUp]);
170
+ useEffect(() => {
171
+ pageContainer.current.addEventListener(Events.TOUCHMOVE, touchMove);
172
+ pageContainer.current.addEventListener(Events.KEYDOWN, keyPress);
173
+ return () => {
174
+ if (pageContainer.current?.removeEventListener) {
175
+ pageContainer.current.removeEventListener(Events.TOUCHMOVE, touchMove);
176
+ // eslint-disable-next-line react-hooks/exhaustive-deps
177
+ pageContainer.current.removeEventListener(Events.KEYDOWN, keyPress);
178
+ }
179
+ };
180
+ }, [touchMove, keyPress]);
181
+ useEffect(() => {
182
+ isMounted = true;
183
+ checkRenderOnMount();
184
+ return () => {
185
+ isMounted = false;
186
+ };
187
+ // eslint-disable-next-line react-hooks/exhaustive-deps
188
+ }, []);
189
+ useEffect(() => {
190
+ isScrolling = false;
191
+ previousTouchMove = null;
192
+ if (componentIndex > prevComponentIndex) {
193
+ addNextComponent();
194
+ }
195
+ }, [addNextComponent, componentIndex, prevComponentIndex]);
196
+ useEffect(() => {
197
+ if (onChange) {
198
+ onChange(componentIndex);
199
+ }
200
+ }, [onChange, componentIndex]);
201
+ useEffect(() => {
202
+ if (!isNil(customPageNumber) && !isEqual(customPageNumber, componentIndex)) {
203
+ let newComponentsToRenderLength = componentsToRenderLength;
204
+ if (!isEqual(componentIndex, customPageNumber)) {
205
+ if (!isNil(containers[customPageNumber]) && !isScrolling) {
206
+ isScrolling = true;
207
+ pageContainer.current.style.transform = `translate3d(0, ${customPageNumber * -100}%, 0)`;
208
+ if (isNil(containers[customPageNumber]) && !isNil(children[customPageNumber])) {
209
+ newComponentsToRenderLength++;
210
+ }
211
+ setTimeout(() => {
212
+ setComponentIndex(customPageNumber);
213
+ setComponentsToRenderLength(newComponentsToRenderLength);
214
+ }, animationTimer + ANIMATION_TIMER_BUFFER);
215
+ } else if (!isScrolling && !isNil(children[customPageNumber])) {
216
+ for (let i = componentsToRenderLength; i <= customPageNumber; i++) {
217
+ newComponentsToRenderLength++;
218
+ }
219
+ if (!isNil(children[customPageNumber])) {
220
+ newComponentsToRenderLength++;
221
+ }
222
+ isScrolling = true;
223
+ isTransitionAfterComponentsToRenderChanged = true;
224
+ setComponentsToRenderLength(newComponentsToRenderLength);
225
+ }
226
+ }
227
+ }
228
+ // eslint-disable-next-line react-hooks/exhaustive-deps
229
+ }, [customPageNumber]);
230
+ useEffect(() => {
231
+ if (isTransitionAfterComponentsToRenderChanged) {
232
+ isTransitionAfterComponentsToRenderChanged = false;
233
+ pageContainer.current.style.transform = `translate3d(0, ${customPageNumber * -100}%, 0)`;
234
+ setTimeout(() => {
235
+ setComponentIndex(customPageNumber);
236
+ }, animationTimer + ANIMATION_TIMER_BUFFER);
237
+ }
238
+ }, [animationTimer, componentsToRenderLength, customPageNumber]);
239
+ return /*#__PURE__*/_jsx("div", {
240
+ style: {
241
+ height,
242
+ width,
243
+ overflow: 'hidden'
244
+ },
245
+ children: /*#__PURE__*/_jsx("div", {
246
+ ref: pageContainer,
247
+ onWheel: wheelScroll,
248
+ style: {
249
+ height: '100%',
250
+ width: '100%',
251
+ transition: `transform ${animationTimer}ms ${transitionTimingFunction}`,
252
+ outline: 'none'
253
+ },
254
+ tabIndex: 0,
255
+ children: setRenderComponents()
256
+ })
257
+ });
258
+ }
259
+ PageScroller.propTypes = {
260
+ animationTimer: PropTypes.number,
261
+ blockScrollDown: PropTypes.bool,
262
+ blockScrollUp: PropTypes.bool,
263
+ children: PropTypes.any.isRequired,
264
+ height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
265
+ width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
266
+ customPageNumber: PropTypes.number,
267
+ onScrollUnavailable: PropTypes.func,
268
+ onChange: PropTypes.func,
269
+ renderAllPagesOnFirstRender: PropTypes.bool,
270
+ transitionTimingFunction: PropTypes.string
271
+ };
272
+ PageScroller.defaultProps = {
273
+ animationTimer: DEFAULT_ANIMATION_TIMER,
274
+ transitionTimingFunction: DEFAULT_ANIMATION,
275
+ height: DEFAULT_CONTAINER_HEIGHT,
276
+ width: DEFAULT_CONTAINER_WIDTH,
277
+ onChange: undefined,
278
+ onScrollUnavailable: undefined,
279
+ blockScrollUp: false,
280
+ blockScrollDown: false,
281
+ renderAllPagesOnFirstRender: false,
282
+ customPageNumber: undefined
283
+ };
284
+ export default withDeprecated(PageScroller, {
285
+ name: 'PageScroller'
286
+ });
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export default function FifthComponent() {
3
+ return /*#__PURE__*/_jsx("div", {
4
+ className: "component fifth-component",
5
+ children: /*#__PURE__*/_jsx("h2", {
6
+ children: "Fifth Component"
7
+ })
8
+ });
9
+ }
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export default function FirstComponent() {
3
+ return /*#__PURE__*/_jsx("div", {
4
+ className: "component first-component",
5
+ children: /*#__PURE__*/_jsx("h2", {
6
+ children: "First Component"
7
+ })
8
+ });
9
+ }
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export default function FourthComponent() {
3
+ return /*#__PURE__*/_jsx("div", {
4
+ className: "component fourth-component",
5
+ children: /*#__PURE__*/_jsx("h2", {
6
+ style: {
7
+ margin: 'auto'
8
+ },
9
+ children: "Fourth Component"
10
+ })
11
+ });
12
+ }
@@ -0,0 +1,47 @@
1
+ /* eslint-disable jsx-a11y/control-has-associated-label */
2
+ import { useState } from 'react';
3
+ import Button from '../../Button';
4
+ import PageScroller from '..';
5
+ import FirstComponent from './FirstComponent';
6
+ import SecondComponent from './SecondComponent';
7
+ import ThirdComponent from './ThirdComponent';
8
+ import FourthComponent from './FourthComponent';
9
+ import FifthComponent from './FifthComponent';
10
+ import './index.css';
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ export default function FullPage() {
14
+ const [current, setCurrent] = useState(0);
15
+ const pageNumbers = [];
16
+ for (let i = 0; i < 5; i++) {
17
+ pageNumbers.push( /*#__PURE__*/_jsx(Button, {
18
+ variant: i === current ? 'contained' : 'outlined',
19
+ size: "small",
20
+ onClick: () => setCurrent(i),
21
+ color: i === current ? 'primary' : 'secondary',
22
+ children: i + 1
23
+ }, i));
24
+ }
25
+ const progress = current / (5 - 1) * 100;
26
+ return /*#__PURE__*/_jsxs("div", {
27
+ className: "demo-page-full",
28
+ children: [/*#__PURE__*/_jsxs(PageScroller, {
29
+ onChange: i => setCurrent(i),
30
+ customPageNumber: current,
31
+ children: [/*#__PURE__*/_jsx(FirstComponent, {}), /*#__PURE__*/_jsx(SecondComponent, {}), /*#__PURE__*/_jsx(ThirdComponent, {}), /*#__PURE__*/_jsx(FourthComponent, {}), /*#__PURE__*/_jsx(FifthComponent, {})]
32
+ }), /*#__PURE__*/_jsx("div", {
33
+ className: "progress",
34
+ role: "progressbar",
35
+ "aria-valuemin": "0",
36
+ "aria-valuemax": "100",
37
+ "aria-valuenow": progress,
38
+ "aria-valuetext": `Page Scroller Progress: ${progress}`,
39
+ style: {
40
+ width: `${progress}%`
41
+ }
42
+ }), /*#__PURE__*/_jsx("div", {
43
+ className: "pagination-additional-class",
44
+ children: pageNumbers
45
+ })]
46
+ });
47
+ }
@@ -0,0 +1,59 @@
1
+ /* eslint-disable jsx-a11y/control-has-associated-label */
2
+ import { useState } from 'react';
3
+ import Button from '../../Button';
4
+ import PageScroller from '..';
5
+ import FirstComponent from './FirstComponent';
6
+ import SecondComponent from './SecondComponent';
7
+ import ThirdComponent from './ThirdComponent';
8
+ import FourthComponent from './FourthComponent';
9
+ import FifthComponent from './FifthComponent';
10
+ import './index.css';
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ export default function FullPage() {
14
+ const [current, setCurrent] = useState(0);
15
+ const pageNumbers = [];
16
+ for (let i = 0; i < 5; i++) {
17
+ pageNumbers.push( /*#__PURE__*/_jsx(Button, {
18
+ variant: i === current ? 'contained' : 'outlined',
19
+ size: "small",
20
+ onClick: () => setCurrent(i),
21
+ color: i === current ? 'primary' : 'secondary',
22
+ children: i + 1
23
+ }, i));
24
+ }
25
+ const progress = current / (5 - 1) * 100;
26
+ return /*#__PURE__*/_jsxs("div", {
27
+ className: "demo-page-contain",
28
+ children: [/*#__PURE__*/_jsx("h3", {
29
+ className: "demo-page-contain__hint",
30
+ children: "You need to focus or hover page scroller to make scroll, keys or touch work"
31
+ }), /*#__PURE__*/_jsxs("div", {
32
+ style: {
33
+ width: 360,
34
+ height: 640,
35
+ position: 'relative'
36
+ },
37
+ children: [/*#__PURE__*/_jsxs(PageScroller, {
38
+ onChange: i => setCurrent(i),
39
+ width: 360,
40
+ height: 640,
41
+ customPageNumber: current,
42
+ children: [/*#__PURE__*/_jsx(FirstComponent, {}), /*#__PURE__*/_jsx(SecondComponent, {}), /*#__PURE__*/_jsx(ThirdComponent, {}), /*#__PURE__*/_jsx(FourthComponent, {}), /*#__PURE__*/_jsx(FifthComponent, {})]
43
+ }), /*#__PURE__*/_jsx("div", {
44
+ className: "progress",
45
+ role: "progressbar",
46
+ "aria-valuemin": "0",
47
+ "aria-valuemax": "100",
48
+ "aria-valuenow": progress,
49
+ "aria-valuetext": `Page Scroller Progress: ${progress}`,
50
+ style: {
51
+ width: `${progress}%`
52
+ }
53
+ })]
54
+ }), /*#__PURE__*/_jsx("div", {
55
+ className: "pagination-additional-class",
56
+ children: pageNumbers
57
+ })]
58
+ });
59
+ }
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export default function SecondComponent() {
3
+ return /*#__PURE__*/_jsx("div", {
4
+ className: "component second-component",
5
+ children: /*#__PURE__*/_jsx("h2", {
6
+ children: "Second Component"
7
+ })
8
+ });
9
+ }
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ export default function ThirdComponent() {
3
+ return /*#__PURE__*/_jsx("div", {
4
+ className: "component third-component",
5
+ children: /*#__PURE__*/_jsx("h2", {
6
+ children: "Third Component"
7
+ })
8
+ });
9
+ }
@@ -0,0 +1,115 @@
1
+ html,
2
+ body {
3
+ margin: 0;
4
+ height: 100%;
5
+ width: 100%;
6
+ overflow: hidden;
7
+ }
8
+
9
+ .links {
10
+ display: flex;
11
+ flex-direction: column;
12
+ margin-left: 50px;
13
+ }
14
+
15
+ .links .link {
16
+ margin-top: 20px;
17
+ }
18
+
19
+ .component {
20
+ height: 100%;
21
+ width: 100%;
22
+ display: flex;
23
+ }
24
+
25
+ .component.first-component {
26
+ background-color: gray;
27
+ position: relative;
28
+ }
29
+
30
+ .first-component--inside-scroller {
31
+ position: absolute;
32
+ right: 20px;
33
+ top: 100px;
34
+ }
35
+
36
+ .component.second-component {
37
+ background-color: red;
38
+ }
39
+
40
+ .component.third-component {
41
+ background-color: blue;
42
+ }
43
+
44
+ .component.fourth-component {
45
+ background-color: yellow;
46
+ }
47
+
48
+ .component.fifth-component {
49
+ background-color: purple;
50
+ }
51
+
52
+ h2 {
53
+ margin: auto;
54
+ text-align: center;
55
+ }
56
+
57
+ .pagination-additional-class {
58
+ margin: 0;
59
+ position: fixed;
60
+ top: 20px;
61
+ display: flex;
62
+ justify-content: center;
63
+ width: 100%;
64
+ }
65
+
66
+ .pagination-additional-class > li:not(:last-of-type) > a,
67
+ .pagination-additional-class > li:not(:last-of-type) > span {
68
+ margin-right: 50px;
69
+ }
70
+
71
+ .demo-page-contain {
72
+ display: flex;
73
+ justify-content: center;
74
+ align-items: center;
75
+ height: 100vh;
76
+ flex-direction: column;
77
+ }
78
+
79
+ .demo-page-contain__hint {
80
+ margin-bottom: 20px;
81
+ }
82
+
83
+ @media (max-width: 768px) {
84
+ .pagination-additional-class > li:not(:last-of-type) > a,
85
+ .pagination-additional-class > li:not(:last-of-type) > span {
86
+ margin-right: 5px;
87
+ }
88
+ }
89
+
90
+ .demo-page-full {
91
+ position: relative;
92
+ }
93
+ .progress {
94
+ position: absolute;
95
+ left: 0;
96
+ bottom: 0;
97
+ width: 0;
98
+ overflow: hidden;
99
+ transition: all 0.2s linear;
100
+ }
101
+ .progress,
102
+ .progress:before {
103
+ height: 6px;
104
+ }
105
+ .progress:before {
106
+ display: block;
107
+ width: 100%;
108
+ background-color: #4e6af6;
109
+ content: '';
110
+ transform-origin: 0 100%;
111
+ transform: skewX(45deg);
112
+ }
113
+ .progress[style*='100%']:before {
114
+ transform: none;
115
+ }
@@ -0,0 +1,9 @@
1
+ // eslint-disable-next-line no-unused-vars
2
+ import { useEffect, useRef } from 'react';
3
+ export default function usePrevious(value) {
4
+ const ref = useRef({});
5
+ useEffect(() => {
6
+ ref.current = value;
7
+ }, [value]);
8
+ return ref.current;
9
+ }
@@ -0,0 +1,124 @@
1
+ import PropTypes from 'prop-types';
2
+ import Card from '@mui/material/Card';
3
+ import Button from '@mui/material/Button';
4
+ import CardContent from '@mui/material/CardContent';
5
+ import Typography from '@mui/material/Typography';
6
+ import { styled } from '../Theme';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { jsxs as _jsxs } from "react/jsx-runtime";
9
+ function PricingPlan({
10
+ plan
11
+ }) {
12
+ return /*#__PURE__*/_jsxs(PlanCard, {
13
+ $shadow: true,
14
+ children: [/*#__PURE__*/_jsx("div", {
15
+ className: "card-header",
16
+ children: /*#__PURE__*/_jsx("div", {
17
+ className: "title",
18
+ children: plan.name
19
+ })
20
+ }), /*#__PURE__*/_jsxs(CardContent, {
21
+ className: "card-content",
22
+ children: [/*#__PURE__*/_jsxs("div", {
23
+ className: "plan-content",
24
+ children: [/*#__PURE__*/_jsx("div", {
25
+ className: "plan-pricing",
26
+ children: /*#__PURE__*/_jsx(Typography, {
27
+ component: "h2",
28
+ variant: "h5",
29
+ className: "price-number",
30
+ children: plan.price
31
+ })
32
+ }), /*#__PURE__*/_jsx("div", {
33
+ className: "plan-services",
34
+ children: plan.featureList.map(line => /*#__PURE__*/_jsx(Typography, {
35
+ component: "p",
36
+ variant: "body1",
37
+ align: "center",
38
+ children: line
39
+ }, line))
40
+ })]
41
+ }), /*#__PURE__*/_jsx("div", {
42
+ className: "plan-actions",
43
+ children: plan.showButton && /*#__PURE__*/_jsx(Button, {
44
+ fullWidth: true,
45
+ variant: "outlined",
46
+ color: "primary",
47
+ component: "a",
48
+ href: plan.buttonLink,
49
+ children: plan.buttonText
50
+ })
51
+ })]
52
+ })]
53
+ });
54
+ }
55
+ export default PricingPlan;
56
+ PricingPlan.propTypes = {
57
+ plan: PropTypes.object.isRequired
58
+ };
59
+ const PlanCard = styled(Card)`
60
+ height: 500px;
61
+ display: flex;
62
+ flex-direction: column;
63
+ @media (max-width: 320px) {
64
+ margin-top: 20px;
65
+ }
66
+
67
+ && {
68
+ ${props => props.$shadow ? '' : 'box-shadow: 0px 0px 1px 0px rgba(0, 0, 0, 0.1)'}
69
+ }
70
+
71
+ .card-header {
72
+ height: 80px;
73
+ background-color: #f1fbfb;
74
+ display: flex;
75
+ flex-flow: column;
76
+ align-items: center;
77
+ justify-content: center;
78
+ .title {
79
+ font-size: 18px;
80
+ font-weight: 600;
81
+ text-align: center;
82
+ color: #404040;
83
+ margin: 0;
84
+ }
85
+ }
86
+
87
+ .card-content {
88
+ display: flex;
89
+ flex-direction: column;
90
+ justify-content: space-between;
91
+ align-items: center;
92
+ flex-grow: 1;
93
+ }
94
+
95
+ .plan-content {
96
+ display: flex;
97
+ flex-direction: column;
98
+ flex-grow: 1;
99
+
100
+ .plan-pricing {
101
+ display: flex;
102
+ justify-content: center;
103
+ align-items: baseline;
104
+ margin-bottom: 12px;
105
+ color: #4e6af6;
106
+ text-align: center;
107
+ }
108
+
109
+ .price-number {
110
+ font-size: 30px;
111
+ font-weight: 600;
112
+ color: #4e6af6;
113
+ }
114
+
115
+ .plan-services strong {
116
+ color: #4e6af6;
117
+ font-weight: 500;
118
+ }
119
+ }
120
+
121
+ .plan-actions {
122
+ width: 100%;
123
+ }
124
+ `;