funda-ui 1.0.272
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.
- package/BackToTop/index.css +34 -0
- package/BackToTop/index.d.ts +11 -0
- package/BackToTop/index.js +458 -0
- package/CascadingSelect/index.css +159 -0
- package/CascadingSelect/index.d.ts +56 -0
- package/CascadingSelect/index.js +958 -0
- package/CascadingSelectE2E/index.css +159 -0
- package/CascadingSelectE2E/index.d.ts +60 -0
- package/CascadingSelectE2E/index.js +1126 -0
- package/Checkbox/index.d.ts +30 -0
- package/Checkbox/index.js +226 -0
- package/ColorPicker/index.css +38 -0
- package/ColorPicker/index.d.ts +27 -0
- package/ColorPicker/index.js +246 -0
- package/DigitalClock/index.d.ts +7 -0
- package/DigitalClock/index.js +208 -0
- package/DropdownMenu/index.css +127 -0
- package/DropdownMenu/index.d.ts +37 -0
- package/DropdownMenu/index.js +237 -0
- package/DynamicFields/index.d.ts +26 -0
- package/DynamicFields/index.js +412 -0
- package/File/index.d.ts +36 -0
- package/File/index.js +473 -0
- package/Input/index.d.ts +42 -0
- package/Input/index.js +286 -0
- package/LiveSearch/index.d.ts +37 -0
- package/LiveSearch/index.js +1195 -0
- package/ModalDialog/index.d.ts +60 -0
- package/ModalDialog/index.js +725 -0
- package/ModeSwitch/index.d.ts +17 -0
- package/ModeSwitch/index.js +202 -0
- package/MultiFuncSelect/index.css +178 -0
- package/MultiFuncSelect/index.d.ts +67 -0
- package/MultiFuncSelect/index.js +1826 -0
- package/MultilevelDropdownMenu/index.css +35 -0
- package/MultilevelDropdownMenu/index.d.ts +25 -0
- package/MultilevelDropdownMenu/index.js +464 -0
- package/Pagination/index.d.ts +49 -0
- package/Pagination/index.js +341 -0
- package/README.md +108 -0
- package/Radio/index.d.ts +31 -0
- package/Radio/index.js +246 -0
- package/RangeSlider/index.css +149 -0
- package/RangeSlider/index.d.ts +21 -0
- package/RangeSlider/index.js +730 -0
- package/ScrollReveal/index.css +23 -0
- package/ScrollReveal/index.d.ts +21 -0
- package/ScrollReveal/index.js +216 -0
- package/Scrollbar/index.css +168 -0
- package/Scrollbar/index.d.ts +15 -0
- package/Scrollbar/index.js +605 -0
- package/SearchBar/index.d.ts +32 -0
- package/SearchBar/index.js +246 -0
- package/Select/index.d.ts +34 -0
- package/Select/index.js +331 -0
- package/ShowMoreLess/index.css +23 -0
- package/ShowMoreLess/index.d.ts +30 -0
- package/ShowMoreLess/index.js +202 -0
- package/Switch/index.d.ts +29 -0
- package/Switch/index.js +211 -0
- package/Table/index.css +533 -0
- package/Table/index.d.ts +25 -0
- package/Table/index.js +2113 -0
- package/Tabs/index.d.ts +3 -0
- package/Tabs/index.js +323 -0
- package/TagInput/index.css +90 -0
- package/TagInput/index.d.ts +28 -0
- package/TagInput/index.js +370 -0
- package/Textarea/index.d.ts +30 -0
- package/Textarea/index.js +242 -0
- package/Toast/index.css +95 -0
- package/Toast/index.d.ts +35 -0
- package/Toast/index.js +340 -0
- package/Tooltip/index.css +240 -0
- package/Tooltip/index.d.ts +19 -0
- package/Tooltip/index.js +200 -0
- package/Tree/index.css +225 -0
- package/Tree/index.d.ts +37 -0
- package/Tree/index.js +1406 -0
- package/all.d.ts +33 -0
- package/all.js +35 -0
- package/lib/cjs/BackToTop/index.d.ts +11 -0
- package/lib/cjs/BackToTop/index.js +458 -0
- package/lib/cjs/CascadingSelect/index.d.ts +56 -0
- package/lib/cjs/CascadingSelect/index.js +958 -0
- package/lib/cjs/CascadingSelectE2E/index.d.ts +60 -0
- package/lib/cjs/CascadingSelectE2E/index.js +1126 -0
- package/lib/cjs/Checkbox/index.d.ts +30 -0
- package/lib/cjs/Checkbox/index.js +226 -0
- package/lib/cjs/ColorPicker/index.d.ts +27 -0
- package/lib/cjs/ColorPicker/index.js +246 -0
- package/lib/cjs/DigitalClock/index.d.ts +7 -0
- package/lib/cjs/DigitalClock/index.js +208 -0
- package/lib/cjs/DropdownMenu/index.d.ts +37 -0
- package/lib/cjs/DropdownMenu/index.js +237 -0
- package/lib/cjs/DynamicFields/index.d.ts +26 -0
- package/lib/cjs/DynamicFields/index.js +412 -0
- package/lib/cjs/File/index.d.ts +36 -0
- package/lib/cjs/File/index.js +473 -0
- package/lib/cjs/Input/index.d.ts +42 -0
- package/lib/cjs/Input/index.js +286 -0
- package/lib/cjs/LiveSearch/index.d.ts +37 -0
- package/lib/cjs/LiveSearch/index.js +1195 -0
- package/lib/cjs/ModalDialog/index.d.ts +60 -0
- package/lib/cjs/ModalDialog/index.js +725 -0
- package/lib/cjs/ModeSwitch/index.d.ts +17 -0
- package/lib/cjs/ModeSwitch/index.js +202 -0
- package/lib/cjs/MultiFuncSelect/index.d.ts +67 -0
- package/lib/cjs/MultiFuncSelect/index.js +1826 -0
- package/lib/cjs/MultilevelDropdownMenu/index.d.ts +25 -0
- package/lib/cjs/MultilevelDropdownMenu/index.js +464 -0
- package/lib/cjs/Pagination/index.d.ts +49 -0
- package/lib/cjs/Pagination/index.js +341 -0
- package/lib/cjs/Radio/index.d.ts +31 -0
- package/lib/cjs/Radio/index.js +246 -0
- package/lib/cjs/RangeSlider/index.d.ts +21 -0
- package/lib/cjs/RangeSlider/index.js +730 -0
- package/lib/cjs/ScrollReveal/index.d.ts +21 -0
- package/lib/cjs/ScrollReveal/index.js +216 -0
- package/lib/cjs/Scrollbar/index.d.ts +15 -0
- package/lib/cjs/Scrollbar/index.js +605 -0
- package/lib/cjs/SearchBar/index.d.ts +32 -0
- package/lib/cjs/SearchBar/index.js +246 -0
- package/lib/cjs/Select/index.d.ts +34 -0
- package/lib/cjs/Select/index.js +331 -0
- package/lib/cjs/ShowMoreLess/index.d.ts +30 -0
- package/lib/cjs/ShowMoreLess/index.js +202 -0
- package/lib/cjs/Switch/index.d.ts +29 -0
- package/lib/cjs/Switch/index.js +211 -0
- package/lib/cjs/Table/index.d.ts +25 -0
- package/lib/cjs/Table/index.js +2113 -0
- package/lib/cjs/Tabs/index.d.ts +3 -0
- package/lib/cjs/Tabs/index.js +323 -0
- package/lib/cjs/TagInput/index.d.ts +28 -0
- package/lib/cjs/TagInput/index.js +370 -0
- package/lib/cjs/Textarea/index.d.ts +30 -0
- package/lib/cjs/Textarea/index.js +242 -0
- package/lib/cjs/Toast/index.d.ts +35 -0
- package/lib/cjs/Toast/index.js +340 -0
- package/lib/cjs/Tooltip/index.d.ts +19 -0
- package/lib/cjs/Tooltip/index.js +200 -0
- package/lib/cjs/Tree/index.d.ts +37 -0
- package/lib/cjs/Tree/index.js +1406 -0
- package/lib/cjs/index.d.ts +33 -0
- package/lib/cjs/index.js +35 -0
- package/lib/css/BackToTop/index.css +34 -0
- package/lib/css/CascadingSelect/index.css +159 -0
- package/lib/css/CascadingSelectE2E/index.css +159 -0
- package/lib/css/ColorPicker/index.css +38 -0
- package/lib/css/DropdownMenu/index.css +127 -0
- package/lib/css/MultiFuncSelect/index.css +178 -0
- package/lib/css/MultilevelDropdownMenu/index.css +35 -0
- package/lib/css/RangeSlider/index.css +149 -0
- package/lib/css/ScrollReveal/index.css +23 -0
- package/lib/css/Scrollbar/index.css +168 -0
- package/lib/css/ShowMoreLess/index.css +23 -0
- package/lib/css/Table/index.css +533 -0
- package/lib/css/TagInput/index.css +90 -0
- package/lib/css/Toast/index.css +95 -0
- package/lib/css/Tooltip/index.css +240 -0
- package/lib/css/Tree/index.css +225 -0
- package/lib/esm/BackToTop/index.scss +47 -0
- package/lib/esm/BackToTop/index.tsx +182 -0
- package/lib/esm/BackToTop/utils/easing.js +200 -0
- package/lib/esm/BackToTop/utils/performance.js +52 -0
- package/lib/esm/CascadingSelect/Group.tsx +39 -0
- package/lib/esm/CascadingSelect/index.scss +214 -0
- package/lib/esm/CascadingSelect/index.tsx +922 -0
- package/lib/esm/CascadingSelect/utils/performance.js +52 -0
- package/lib/esm/CascadingSelectE2E/Group.tsx +39 -0
- package/lib/esm/CascadingSelectE2E/index.scss +214 -0
- package/lib/esm/CascadingSelectE2E/index.tsx +1091 -0
- package/lib/esm/CascadingSelectE2E/utils/performance.js +52 -0
- package/lib/esm/Checkbox/index.tsx +160 -0
- package/lib/esm/ColorPicker/index.scss +48 -0
- package/lib/esm/ColorPicker/index.tsx +187 -0
- package/lib/esm/DigitalClock/index.tsx +72 -0
- package/lib/esm/DigitalClock/utils/useInterval.js +43 -0
- package/lib/esm/DropdownMenu/Option.tsx +27 -0
- package/lib/esm/DropdownMenu/index.scss +180 -0
- package/lib/esm/DropdownMenu/index.tsx +148 -0
- package/lib/esm/DynamicFields/index.tsx +386 -0
- package/lib/esm/File/index.tsx +302 -0
- package/lib/esm/Input/index.tsx +233 -0
- package/lib/esm/LiveSearch/index.tsx +582 -0
- package/lib/esm/LiveSearch/utils/performance.js +52 -0
- package/lib/esm/LiveSearch/utils/useThrottle.js +36 -0
- package/lib/esm/ModalDialog/index.tsx +479 -0
- package/lib/esm/ModalDialog/plugins/BSL/bodyScrollLock.es6.js +262 -0
- package/lib/esm/ModalDialog/plugins/BSL/index.ts +2 -0
- package/lib/esm/ModeSwitch/index.tsx +82 -0
- package/lib/esm/MultiFuncSelect/index.scss +269 -0
- package/lib/esm/MultiFuncSelect/index.tsx +1597 -0
- package/lib/esm/MultiFuncSelect/utils/performance.js +52 -0
- package/lib/esm/MultiFuncSelect/utils/tree.js +103 -0
- package/lib/esm/MultiFuncSelect/utils/useThrottle.js +36 -0
- package/lib/esm/MultilevelDropdownMenu/MenuList.tsx +230 -0
- package/lib/esm/MultilevelDropdownMenu/index.scss +75 -0
- package/lib/esm/MultilevelDropdownMenu/index.tsx +71 -0
- package/lib/esm/MultilevelDropdownMenu/utils/dom.js +81 -0
- package/lib/esm/Pagination/index.tsx +230 -0
- package/lib/esm/Pagination/pagination-navigators.tsx +60 -0
- package/lib/esm/Radio/index.tsx +201 -0
- package/lib/esm/RangeSlider/index.scss +184 -0
- package/lib/esm/RangeSlider/index.tsx +223 -0
- package/lib/esm/ScrollReveal/index.scss +27 -0
- package/lib/esm/ScrollReveal/index.tsx +146 -0
- package/lib/esm/Scrollbar/index.scss +217 -0
- package/lib/esm/Scrollbar/index.tsx +497 -0
- package/lib/esm/Scrollbar/utils/performance.js +52 -0
- package/lib/esm/SearchBar/index.tsx +181 -0
- package/lib/esm/Select/index.tsx +276 -0
- package/lib/esm/ShowMoreLess/index.scss +27 -0
- package/lib/esm/ShowMoreLess/index.tsx +144 -0
- package/lib/esm/Switch/index.tsx +143 -0
- package/lib/esm/Table/TableColgroup.tsx +29 -0
- package/lib/esm/Table/TableField.tsx +40 -0
- package/lib/esm/Table/TableFieldRow.tsx +212 -0
- package/lib/esm/Table/TableHeaders.tsx +146 -0
- package/lib/esm/Table/TableRow.tsx +127 -0
- package/lib/esm/Table/TableSummaries.tsx +36 -0
- package/lib/esm/Table/index.scss +364 -0
- package/lib/esm/Table/index.tsx +576 -0
- package/lib/esm/Table/table-utils.ts +65 -0
- package/lib/esm/Table/utils/dom.js +81 -0
- package/lib/esm/Table/utils/performance.js +52 -0
- package/lib/esm/Tabs/TabList.tsx +42 -0
- package/lib/esm/Tabs/TabPanel.tsx +34 -0
- package/lib/esm/Tabs/Tabs.tsx +232 -0
- package/lib/esm/Tabs/index.tsx +3 -0
- package/lib/esm/TagInput/index.scss +125 -0
- package/lib/esm/TagInput/index.tsx +314 -0
- package/lib/esm/Textarea/index.tsx +178 -0
- package/lib/esm/Toast/Item.tsx +75 -0
- package/lib/esm/Toast/index.scss +120 -0
- package/lib/esm/Toast/index.tsx +249 -0
- package/lib/esm/Tooltip/index.scss +327 -0
- package/lib/esm/Tooltip/index.tsx +142 -0
- package/lib/esm/Tree/TreeList.tsx +503 -0
- package/lib/esm/Tree/index.scss +375 -0
- package/lib/esm/Tree/index.tsx +301 -0
- package/lib/esm/Tree/init-height.tsx +27 -0
- package/lib/esm/Tree/utils/convert-tree.js +29 -0
- package/lib/esm/Tree/utils/dom.js +81 -0
- package/lib/esm/index.js +31 -0
- package/package.json +40 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/* ======================================================
|
|
2
|
+
<!-- Tooltip -->
|
|
3
|
+
/* ====================================================== */
|
|
4
|
+
/*
|
|
5
|
+
* 1. Base Styles
|
|
6
|
+
* 2. Position Modifiers - Top
|
|
7
|
+
* 3. Position Modifiers - Top Left
|
|
8
|
+
* 4. Position Modifiers - Top Right
|
|
9
|
+
* 5. Position Modifiers - Bottom
|
|
10
|
+
* 6. Position Modifiers - Bottom Left
|
|
11
|
+
* 7. Position Modifiers - Bottom Right
|
|
12
|
+
* 8. Position Modifiers - Left
|
|
13
|
+
* 9. Position Modifiers - Right
|
|
14
|
+
* 10. Size
|
|
15
|
+
*/
|
|
16
|
+
.tooltip__wrapper {
|
|
17
|
+
--tooltip-box-shadow: 0 5px 15px 0 rgba(0,0,0,.07), 0 15px 35px 0 rgba(50,50,93,.1);
|
|
18
|
+
--tooltip-content-bg: rgba(17, 17, 17, 0.9);
|
|
19
|
+
--tooltip-content-color: #fff;
|
|
20
|
+
--tooltip-content-font-size: 0.75em;
|
|
21
|
+
--tooltip-content-padding-x: 1em;
|
|
22
|
+
--tooltip-content-padding-y: .5em;
|
|
23
|
+
--tooltip-content-line-height: 1.5;
|
|
24
|
+
--tooltip-arrow-bg-top: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%280%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
|
|
25
|
+
--tooltip-arrow-bg-bottom: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2236px%22%20height%3D%2212px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28180%2018%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
|
|
26
|
+
--tooltip-arrow-bg-left: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%28-90%2018%2018%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
|
|
27
|
+
--tooltip-arrow-bg-right: url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%2212px%22%20height%3D%2236px%22%3E%3Cpath%20fill%3D%22rgba%2817,%2017,%2017,%200.9%29%22%20transform%3D%22rotate%2890%206%206%29%22%20d%3D%22M2.658,0.000%20C-13.615,0.000%2050.938,0.000%2034.662,0.000%20C28.662,0.000%2023.035,12.002%2018.660,12.002%20C14.285,12.002%208.594,0.000%202.658,0.000%20Z%22/%3E%3C/svg%3E") no-repeat;
|
|
28
|
+
--tooltip-arrow-width: 18px;
|
|
29
|
+
--tooltip-arrow-height: 6px;
|
|
30
|
+
position: relative;
|
|
31
|
+
display: inline-block;
|
|
32
|
+
/*
|
|
33
|
+
---------------------------
|
|
34
|
+
1. Base Styles
|
|
35
|
+
---------------------------
|
|
36
|
+
*/
|
|
37
|
+
/*
|
|
38
|
+
---------------------------
|
|
39
|
+
2. Position Modifiers - Top
|
|
40
|
+
---------------------------
|
|
41
|
+
*/
|
|
42
|
+
/*
|
|
43
|
+
---------------------------
|
|
44
|
+
3. Position Modifiers - Top Left
|
|
45
|
+
---------------------------
|
|
46
|
+
*/
|
|
47
|
+
/*
|
|
48
|
+
---------------------------
|
|
49
|
+
4. Position Modifiers - Top Right
|
|
50
|
+
---------------------------
|
|
51
|
+
*/
|
|
52
|
+
/*
|
|
53
|
+
---------------------------
|
|
54
|
+
5. Position Modifiers - Bottom
|
|
55
|
+
---------------------------
|
|
56
|
+
*/
|
|
57
|
+
/*
|
|
58
|
+
---------------------------
|
|
59
|
+
6. Position Modifiers - Bottom Left
|
|
60
|
+
---------------------------
|
|
61
|
+
*/
|
|
62
|
+
/*
|
|
63
|
+
---------------------------
|
|
64
|
+
7. Position Modifiers - Bottom Right
|
|
65
|
+
---------------------------
|
|
66
|
+
*/
|
|
67
|
+
/*
|
|
68
|
+
---------------------------
|
|
69
|
+
8. Position Modifiers - Left
|
|
70
|
+
---------------------------
|
|
71
|
+
*/
|
|
72
|
+
/*
|
|
73
|
+
---------------------------
|
|
74
|
+
9. Position Modifiers - Right
|
|
75
|
+
---------------------------
|
|
76
|
+
*/
|
|
77
|
+
/*
|
|
78
|
+
---------------------------
|
|
79
|
+
10. Size
|
|
80
|
+
---------------------------
|
|
81
|
+
*/
|
|
82
|
+
}
|
|
83
|
+
.tooltip__wrapper::before {
|
|
84
|
+
background-size: 100% auto !important;
|
|
85
|
+
content: "";
|
|
86
|
+
}
|
|
87
|
+
.tooltip__wrapper.active::before,
|
|
88
|
+
.tooltip__wrapper.active .tooltip__content {
|
|
89
|
+
opacity: 1;
|
|
90
|
+
pointer-events: auto;
|
|
91
|
+
}
|
|
92
|
+
.tooltip__wrapper:focus::before,
|
|
93
|
+
.tooltip__wrapper:focus .tooltip__content {
|
|
94
|
+
opacity: 1;
|
|
95
|
+
pointer-events: auto;
|
|
96
|
+
}
|
|
97
|
+
.tooltip__wrapper::before,
|
|
98
|
+
.tooltip__wrapper .tooltip__content {
|
|
99
|
+
backface-visibility: hidden;
|
|
100
|
+
will-change: transform;
|
|
101
|
+
opacity: 0;
|
|
102
|
+
pointer-events: none;
|
|
103
|
+
position: absolute;
|
|
104
|
+
box-sizing: border-box;
|
|
105
|
+
z-index: 10;
|
|
106
|
+
transform-origin: top;
|
|
107
|
+
box-shadow: var(--tooltip-box-shadow);
|
|
108
|
+
transition: 0.1s ease-in-out;
|
|
109
|
+
}
|
|
110
|
+
.tooltip__wrapper .tooltip__content {
|
|
111
|
+
background: var(--tooltip-content-bg);
|
|
112
|
+
border-radius: 4px;
|
|
113
|
+
color: var(--tooltip-content-color);
|
|
114
|
+
content: attr(aria-label);
|
|
115
|
+
font-size: var(--tooltip-content-font-size);
|
|
116
|
+
font-weight: normal;
|
|
117
|
+
text-transform: none;
|
|
118
|
+
padding: var(--tooltip-content-padding-y) var(--tooltip-content-padding-x);
|
|
119
|
+
white-space: nowrap;
|
|
120
|
+
box-sizing: content-box;
|
|
121
|
+
line-height: var(--tooltip-content-line-height);
|
|
122
|
+
}
|
|
123
|
+
.tooltip__wrapper .tooltip__content img {
|
|
124
|
+
height: auto !important;
|
|
125
|
+
margin: 0.5rem 0;
|
|
126
|
+
}
|
|
127
|
+
.tooltip__wrapper[data-microtip-position|=top]::before {
|
|
128
|
+
background: var(--tooltip-arrow-bg-top);
|
|
129
|
+
height: var(--tooltip-arrow-height);
|
|
130
|
+
width: var(--tooltip-arrow-width);
|
|
131
|
+
}
|
|
132
|
+
.tooltip__wrapper[data-microtip-position|=top] .tooltip__content {
|
|
133
|
+
margin-bottom: var(--tooltip-arrow-height);
|
|
134
|
+
}
|
|
135
|
+
.tooltip__wrapper[data-microtip-position|=top]::before {
|
|
136
|
+
bottom: calc(100% + var(--tooltip-arrow-height));
|
|
137
|
+
left: calc(50% - var(--tooltip-arrow-width) / 2);
|
|
138
|
+
}
|
|
139
|
+
.tooltip__wrapper[data-microtip-position|=top] .tooltip__content {
|
|
140
|
+
bottom: calc(100% + var(--tooltip-arrow-height));
|
|
141
|
+
left: 50%;
|
|
142
|
+
transform: translateX(-50%);
|
|
143
|
+
}
|
|
144
|
+
.tooltip__wrapper[data-microtip-position=top-left] .tooltip__content {
|
|
145
|
+
bottom: calc(100% + var(--tooltip-arrow-height));
|
|
146
|
+
left: 50%;
|
|
147
|
+
transform: translateX(calc(-100% + var(--tooltip-arrow-width)));
|
|
148
|
+
}
|
|
149
|
+
.tooltip__wrapper[data-microtip-position=top-right] .tooltip__content {
|
|
150
|
+
bottom: calc(100% + var(--tooltip-arrow-height));
|
|
151
|
+
left: 50%;
|
|
152
|
+
transform: translateX(calc(0% - var(--tooltip-arrow-width)));
|
|
153
|
+
}
|
|
154
|
+
.tooltip__wrapper[data-microtip-position|=bottom]::before {
|
|
155
|
+
background: var(--tooltip-arrow-bg-bottom);
|
|
156
|
+
height: var(--tooltip-arrow-height);
|
|
157
|
+
width: var(--tooltip-arrow-width);
|
|
158
|
+
margin-top: 5px;
|
|
159
|
+
margin-bottom: 0;
|
|
160
|
+
}
|
|
161
|
+
.tooltip__wrapper[data-microtip-position|=bottom] .tooltip__content {
|
|
162
|
+
margin-top: var(--tooltip-arrow-height);
|
|
163
|
+
}
|
|
164
|
+
.tooltip__wrapper[data-microtip-position|=bottom]::before {
|
|
165
|
+
bottom: auto;
|
|
166
|
+
top: calc(100% + 1px);
|
|
167
|
+
left: calc(50% - var(--tooltip-arrow-width) / 2);
|
|
168
|
+
}
|
|
169
|
+
.tooltip__wrapper[data-microtip-position|=bottom] .tooltip__content {
|
|
170
|
+
bottom: auto;
|
|
171
|
+
top: calc(100% + var(--tooltip-arrow-height));
|
|
172
|
+
left: 50%;
|
|
173
|
+
transform: translateX(-50%);
|
|
174
|
+
}
|
|
175
|
+
.tooltip__wrapper[data-microtip-position=bottom-left] .tooltip__content {
|
|
176
|
+
bottom: auto;
|
|
177
|
+
top: calc(100% + var(--tooltip-arrow-height));
|
|
178
|
+
left: 50%;
|
|
179
|
+
transform: translateX(calc(-100% + var(--tooltip-arrow-width)));
|
|
180
|
+
}
|
|
181
|
+
.tooltip__wrapper[data-microtip-position=bottom-right] .tooltip__content {
|
|
182
|
+
bottom: auto;
|
|
183
|
+
top: calc(100% + var(--tooltip-arrow-height));
|
|
184
|
+
left: 50%;
|
|
185
|
+
transform: translateX(calc(0% - var(--tooltip-arrow-width)));
|
|
186
|
+
}
|
|
187
|
+
.tooltip__wrapper[data-microtip-position=left]::before,
|
|
188
|
+
.tooltip__wrapper[data-microtip-position=left] .tooltip__content {
|
|
189
|
+
bottom: auto;
|
|
190
|
+
left: auto;
|
|
191
|
+
right: 100%;
|
|
192
|
+
top: 50%;
|
|
193
|
+
transform: translateY(-50%);
|
|
194
|
+
}
|
|
195
|
+
.tooltip__wrapper[data-microtip-position=left]::before {
|
|
196
|
+
background: var(--tooltip-arrow-bg-left);
|
|
197
|
+
height: var(--tooltip-arrow-width);
|
|
198
|
+
width: var(--tooltip-arrow-height);
|
|
199
|
+
margin-right: 5px;
|
|
200
|
+
margin-bottom: 0;
|
|
201
|
+
}
|
|
202
|
+
.tooltip__wrapper[data-microtip-position=left] .tooltip__content {
|
|
203
|
+
margin-right: 10px;
|
|
204
|
+
}
|
|
205
|
+
.tooltip__wrapper[data-microtip-position=right]::before,
|
|
206
|
+
.tooltip__wrapper[data-microtip-position=right] .tooltip__content {
|
|
207
|
+
bottom: auto;
|
|
208
|
+
left: 100%;
|
|
209
|
+
top: 50%;
|
|
210
|
+
transform: translateY(-50%);
|
|
211
|
+
}
|
|
212
|
+
.tooltip__wrapper[data-microtip-position=right]::before {
|
|
213
|
+
background: var(--tooltip-arrow-bg-right);
|
|
214
|
+
height: var(--tooltip-arrow-width);
|
|
215
|
+
width: var(--tooltip-arrow-height);
|
|
216
|
+
margin-bottom: 0;
|
|
217
|
+
margin-left: 5px;
|
|
218
|
+
}
|
|
219
|
+
.tooltip__wrapper[data-microtip-position=right] .tooltip__content {
|
|
220
|
+
margin-left: 10px;
|
|
221
|
+
}
|
|
222
|
+
.tooltip__wrapper[data-microtip-size=auto].tooltip__content {
|
|
223
|
+
white-space: nowrap;
|
|
224
|
+
width: auto;
|
|
225
|
+
max-width: 530px;
|
|
226
|
+
overflow: hidden;
|
|
227
|
+
text-overflow: ellipsis;
|
|
228
|
+
}
|
|
229
|
+
.tooltip__wrapper[data-microtip-size=small].tooltip__content {
|
|
230
|
+
white-space: initial;
|
|
231
|
+
width: 80px;
|
|
232
|
+
}
|
|
233
|
+
.tooltip__wrapper[data-microtip-size=medium].tooltip__content {
|
|
234
|
+
white-space: initial;
|
|
235
|
+
width: 150px;
|
|
236
|
+
}
|
|
237
|
+
.tooltip__wrapper[data-microtip-size=large].tooltip__content {
|
|
238
|
+
white-space: initial;
|
|
239
|
+
width: 260px;
|
|
240
|
+
}
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/* ======================================================
|
|
2
|
+
<!-- Tree -->
|
|
3
|
+
/* ====================================================== */
|
|
4
|
+
.tree-diagram-default {
|
|
5
|
+
--tree-padding-x: 1rem;
|
|
6
|
+
--tree-padding-y: 0.5rem;
|
|
7
|
+
--tree-font-line-height: 1.5;
|
|
8
|
+
--tree-dis-top: 1rem;
|
|
9
|
+
--tree-font-size: 0.875rem;
|
|
10
|
+
--tree-ident: var(--tree-font-size);
|
|
11
|
+
--tree-dis-start: -var(--tree-ident);
|
|
12
|
+
--tree-border-color: #ddd;
|
|
13
|
+
--tree-font-bg: #f6f6f6;
|
|
14
|
+
--tree-font-active-bg: #f0f8ff;
|
|
15
|
+
--tree-checkbox-indeterminate-color: #bbbbbb;
|
|
16
|
+
--tree-link-min-width: 150px;
|
|
17
|
+
position: relative;
|
|
18
|
+
display: flex;
|
|
19
|
+
flex-wrap: wrap;
|
|
20
|
+
align-items: center;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
padding: 0.5rem 0;
|
|
23
|
+
outline: none; /* When using "tabindex" please set */
|
|
24
|
+
/*------ line ------*/
|
|
25
|
+
/*------ has checkbox ------*/
|
|
26
|
+
/*------ hide arrow ------*/
|
|
27
|
+
}
|
|
28
|
+
.tree-diagram-default ul, .tree-diagram-default li {
|
|
29
|
+
list-style: none;
|
|
30
|
+
}
|
|
31
|
+
.tree-diagram-default .tree-diagram-default-nav {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
padding-left: 0;
|
|
35
|
+
margin-bottom: 0;
|
|
36
|
+
list-style: none;
|
|
37
|
+
/* Default height for sub items */
|
|
38
|
+
}
|
|
39
|
+
.tree-diagram-default .tree-diagram-default-nav .nav-link {
|
|
40
|
+
position: relative;
|
|
41
|
+
display: block;
|
|
42
|
+
min-width: var(--tree-link-min-width);
|
|
43
|
+
padding: var(--tree-padding-y) var(--tree-padding-x);
|
|
44
|
+
font-size: var(--tree-font-size);
|
|
45
|
+
font-weight: 400;
|
|
46
|
+
color: inherit;
|
|
47
|
+
text-decoration: none;
|
|
48
|
+
transition: 0.1s ease-in-out;
|
|
49
|
+
padding-left: calc(var(--tree-padding-x) * 2);
|
|
50
|
+
z-index: 1;
|
|
51
|
+
}
|
|
52
|
+
.tree-diagram-default .tree-diagram-default-nav .nav-link > span {
|
|
53
|
+
transition: 0.1s ease-in-out;
|
|
54
|
+
display: inline-block;
|
|
55
|
+
border-radius: 2px;
|
|
56
|
+
}
|
|
57
|
+
.tree-diagram-default .tree-diagram-default-nav .nav-link > span var.loading-icon {
|
|
58
|
+
position: absolute;
|
|
59
|
+
margin-left: 0.2em;
|
|
60
|
+
}
|
|
61
|
+
.tree-diagram-default .tree-diagram-default-nav .nav-link:hover span {
|
|
62
|
+
background-color: var(--tree-font-bg);
|
|
63
|
+
}
|
|
64
|
+
.tree-diagram-default .tree-diagram-default-nav .nav-link.selected span {
|
|
65
|
+
background-color: var(--tree-font-active-bg);
|
|
66
|
+
}
|
|
67
|
+
.tree-diagram-default .tree-diagram-default-nav .nav-link.loading > span var.loading-icon {
|
|
68
|
+
display: inline-block;
|
|
69
|
+
}
|
|
70
|
+
.tree-diagram-default .tree-diagram-default-nav var.loading-icon {
|
|
71
|
+
display: none;
|
|
72
|
+
}
|
|
73
|
+
.tree-diagram-default .tree-diagram-default-nav var.loading-icon svg {
|
|
74
|
+
animation: tree-diagram-ring 1.2s linear infinite;
|
|
75
|
+
}
|
|
76
|
+
.tree-diagram-default .tree-diagram-default-nav .checkbox-trigger {
|
|
77
|
+
display: none;
|
|
78
|
+
position: absolute;
|
|
79
|
+
left: calc(var(--tree-padding-x) + 1.5em);
|
|
80
|
+
top: calc(var(--tree-dis-top) - 8px);
|
|
81
|
+
z-index: 2;
|
|
82
|
+
}
|
|
83
|
+
.tree-diagram-default .tree-diagram-default-nav .checkbox-trigger > div {
|
|
84
|
+
display: inline-block;
|
|
85
|
+
}
|
|
86
|
+
.tree-diagram-default .tree-diagram-default-nav .checkbox-trigger > div .form-check {
|
|
87
|
+
min-height: auto;
|
|
88
|
+
margin-bottom: 0;
|
|
89
|
+
}
|
|
90
|
+
.tree-diagram-default .tree-diagram-default-nav .checkbox-trigger > div .form-check [type=checkbox]:indeterminate {
|
|
91
|
+
background-color: var(--tree-checkbox-indeterminate-color);
|
|
92
|
+
border-color: var(--tree-checkbox-indeterminate-color);
|
|
93
|
+
}
|
|
94
|
+
.tree-diagram-default .tree-diagram-default-nav .arrow {
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
transition: 0.1s ease-in-out;
|
|
97
|
+
display: inline-block;
|
|
98
|
+
text-align: center;
|
|
99
|
+
position: absolute;
|
|
100
|
+
left: calc(var(--tree-padding-x) + 0.2em);
|
|
101
|
+
top: calc(var(--tree-dis-top) - 5px);
|
|
102
|
+
transform: translateY(-50%) rotate(0deg);
|
|
103
|
+
z-index: 2;
|
|
104
|
+
width: 10px;
|
|
105
|
+
height: 10px;
|
|
106
|
+
transform-origin: 50% 125%;
|
|
107
|
+
}
|
|
108
|
+
.tree-diagram-default .tree-diagram-default-nav .arrow > var > svg {
|
|
109
|
+
transition: 0.1s ease-in-out;
|
|
110
|
+
}
|
|
111
|
+
.tree-diagram-default .tree-diagram-default-nav .arrow var.default-icon > span:last-child {
|
|
112
|
+
display: none;
|
|
113
|
+
}
|
|
114
|
+
.tree-diagram-default .tree-diagram-default-nav .arrow.loading var.default-icon {
|
|
115
|
+
display: none;
|
|
116
|
+
}
|
|
117
|
+
.tree-diagram-default .tree-diagram-default-nav .arrow.loading var.loading-icon {
|
|
118
|
+
display: inline-block;
|
|
119
|
+
}
|
|
120
|
+
.tree-diagram-default .tree-diagram-default-nav .arrow:hover {
|
|
121
|
+
opacity: 0.5;
|
|
122
|
+
}
|
|
123
|
+
.tree-diagram-default .tree-diagram-default-nav .arrow:hover > var > svg {
|
|
124
|
+
transform: scale(1.4);
|
|
125
|
+
}
|
|
126
|
+
.tree-diagram-default .tree-diagram-default-nav li {
|
|
127
|
+
position: relative;
|
|
128
|
+
padding-left: 0.2em;
|
|
129
|
+
}
|
|
130
|
+
.tree-diagram-default .tree-diagram-default-nav li i {
|
|
131
|
+
font-style: normal;
|
|
132
|
+
}
|
|
133
|
+
.tree-diagram-default .tree-diagram-default-nav li.active > .arrow:not(.custom-icons) {
|
|
134
|
+
transform: translateY(-50%) rotate(90deg);
|
|
135
|
+
}
|
|
136
|
+
.tree-diagram-default .tree-diagram-default-nav li.active > .arrow.custom-icons var.default-icon > span:first-child {
|
|
137
|
+
display: none;
|
|
138
|
+
}
|
|
139
|
+
.tree-diagram-default .tree-diagram-default-nav li.active > .arrow.custom-icons var.default-icon > span:last-child {
|
|
140
|
+
display: block;
|
|
141
|
+
}
|
|
142
|
+
.tree-diagram-default .tree-diagram-default-nav > li ul {
|
|
143
|
+
transition: max-height 0.25s ease;
|
|
144
|
+
overflow: hidden;
|
|
145
|
+
position: relative;
|
|
146
|
+
}
|
|
147
|
+
.tree-diagram-default .tree-diagram-default-nav > li:not(.active) ul {
|
|
148
|
+
max-height: 0;
|
|
149
|
+
}
|
|
150
|
+
.tree-diagram-default .tree-diagram-default-nav > li ul ul {
|
|
151
|
+
margin-top: auto;
|
|
152
|
+
}
|
|
153
|
+
.tree-diagram-default.show-line .tree-diagram-default-nav li::before, .tree-diagram-default.show-line .tree-diagram-default-nav li::after {
|
|
154
|
+
content: "";
|
|
155
|
+
position: absolute;
|
|
156
|
+
top: calc(0px - var(--tree-dis-top));
|
|
157
|
+
left: var(--tree-dis-start);
|
|
158
|
+
border-left-width: 1px;
|
|
159
|
+
border-left-style: solid;
|
|
160
|
+
border-left-color: var(--tree-border-color);
|
|
161
|
+
border-bottom-width: 1px;
|
|
162
|
+
border-bottom-style: solid;
|
|
163
|
+
border-bottom-color: var(--tree-border-color);
|
|
164
|
+
width: var(--tree-ident);
|
|
165
|
+
pointer-events: none;
|
|
166
|
+
}
|
|
167
|
+
.tree-diagram-default.show-line .tree-diagram-default-nav li::before {
|
|
168
|
+
height: calc(var(--tree-font-size) * var(--tree-font-line-height) + var(--tree-padding-y) + var(--tree-padding-y));
|
|
169
|
+
}
|
|
170
|
+
.tree-diagram-default.show-line .tree-diagram-default-nav li::after {
|
|
171
|
+
height: 100%;
|
|
172
|
+
border-bottom-width: 0;
|
|
173
|
+
}
|
|
174
|
+
.tree-diagram-default.show-line .tree-diagram-default-nav li:last-child::after {
|
|
175
|
+
display: none;
|
|
176
|
+
}
|
|
177
|
+
.tree-diagram-default.show-line .tree-diagram-default-nav > li:first-child::before {
|
|
178
|
+
border-left-width: 0;
|
|
179
|
+
}
|
|
180
|
+
.tree-diagram-default.show-line .tree-diagram-default-nav > li:first-child::after {
|
|
181
|
+
top: calc(var(--tree-font-size) * var(--tree-font-line-height));
|
|
182
|
+
}
|
|
183
|
+
.tree-diagram-default.show-line.line--dotted .tree-diagram-default-nav li::before, .tree-diagram-default.show-line.line--dotted .tree-diagram-default-nav li::after {
|
|
184
|
+
border-left-style: dotted;
|
|
185
|
+
border-bottom-style: dotted;
|
|
186
|
+
}
|
|
187
|
+
.tree-diagram-default.show-line.line--dashed .tree-diagram-default-nav li::before, .tree-diagram-default.show-line.line--dashed .tree-diagram-default-nav li::after {
|
|
188
|
+
border-left-style: dashed;
|
|
189
|
+
border-bottom-style: dashed;
|
|
190
|
+
}
|
|
191
|
+
.tree-diagram-default.show-line.line--double .tree-diagram-default-nav li::before, .tree-diagram-default.show-line.line--double .tree-diagram-default-nav li::after {
|
|
192
|
+
border-left-style: double;
|
|
193
|
+
border-bottom-style: double;
|
|
194
|
+
}
|
|
195
|
+
.tree-diagram-default.show-line.line--solid .tree-diagram-default-nav li::before, .tree-diagram-default.show-line.line--solid .tree-diagram-default-nav li::after {
|
|
196
|
+
border-left-style: solid;
|
|
197
|
+
border-bottom-style: solid;
|
|
198
|
+
}
|
|
199
|
+
.tree-diagram-default.has-checkbox .checkbox-trigger {
|
|
200
|
+
display: inline-block;
|
|
201
|
+
}
|
|
202
|
+
.tree-diagram-default.has-checkbox .tree-diagram-default-nav .nav-link {
|
|
203
|
+
padding-left: calc(var(--tree-padding-x) + 2.7em);
|
|
204
|
+
}
|
|
205
|
+
.tree-diagram-default.hide-arrow .arrow {
|
|
206
|
+
display: none;
|
|
207
|
+
}
|
|
208
|
+
.tree-diagram-default.hide-arrow .tree-diagram-default-nav .nav-link {
|
|
209
|
+
padding-left: var(--tree-padding-x);
|
|
210
|
+
}
|
|
211
|
+
.tree-diagram-default.hide-arrow.has-checkbox .tree-diagram-default-nav .checkbox-trigger {
|
|
212
|
+
left: calc(var(--tree-padding-x) + 0.5em);
|
|
213
|
+
}
|
|
214
|
+
.tree-diagram-default.hide-arrow.has-checkbox .tree-diagram-default-nav .nav-link {
|
|
215
|
+
padding-left: calc(var(--tree-padding-x) + 1.5em);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
@keyframes tree-diagram-ring {
|
|
219
|
+
0% {
|
|
220
|
+
transform: rotate(0deg);
|
|
221
|
+
}
|
|
222
|
+
100% {
|
|
223
|
+
transform: rotate(360deg);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* ======================================================
|
|
2
|
+
<!-- Back to Top -->
|
|
3
|
+
/* ====================================================== */
|
|
4
|
+
|
|
5
|
+
.back-to-top {
|
|
6
|
+
button {
|
|
7
|
+
transform: scale(0);
|
|
8
|
+
position: fixed;
|
|
9
|
+
bottom: 12px;
|
|
10
|
+
right: 12px;
|
|
11
|
+
width: 50px;
|
|
12
|
+
height: 50px;
|
|
13
|
+
z-index: 99;
|
|
14
|
+
text-align: center;
|
|
15
|
+
transition: .1s ease-in-out;
|
|
16
|
+
|
|
17
|
+
display: block;
|
|
18
|
+
outline: none;
|
|
19
|
+
border: none;
|
|
20
|
+
background-color: transparent;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
|
|
23
|
+
svg {
|
|
24
|
+
transition: .1s ease-in-out;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
&:hover {
|
|
28
|
+
svg {
|
|
29
|
+
opacity: .7;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&.active {
|
|
34
|
+
transform: scale(1);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:active,
|
|
38
|
+
&:focus {
|
|
39
|
+
outline: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
i {
|
|
43
|
+
font-size: 1.5rem;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
import { throttle } from './utils/performance';
|
|
4
|
+
import {
|
|
5
|
+
easeLinear,
|
|
6
|
+
easeInQuad,
|
|
7
|
+
easeOutQuad,
|
|
8
|
+
easeInOutQuad
|
|
9
|
+
} from './utils/easing';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
// Adapt the easing parameters of TweenMax
|
|
13
|
+
enum EasingList {
|
|
14
|
+
linear = 'linear',
|
|
15
|
+
easeIn = 'ease-in',
|
|
16
|
+
easeOut = 'ease-out',
|
|
17
|
+
easeInOut = 'ease-in-out'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
type BackToTopProps = {
|
|
22
|
+
/** Speed of scrolling up. Amount of time measured in milliseconds. */
|
|
23
|
+
speed?: number;
|
|
24
|
+
/** Types of easing animation */
|
|
25
|
+
easing: string;
|
|
26
|
+
/** Button Icon */
|
|
27
|
+
btnIcon?: React.ReactNode;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
const BackToTop = (props: BackToTopProps) => {
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
btnIcon,
|
|
36
|
+
} = props;
|
|
37
|
+
|
|
38
|
+
const easeType: string = EasingList[props.easing as never];
|
|
39
|
+
const speed: number = props.speed ? props.speed : 500;
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
const btnRef = useRef<any>(null);
|
|
43
|
+
const [isAtRange, setIsAtRange] = useState<boolean>(false);
|
|
44
|
+
const windowScrollUpdate = throttle(handleScrollEvent, 5);
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
function handleScrollEvent() {
|
|
48
|
+
const scrollTop = window.pageYOffset;
|
|
49
|
+
|
|
50
|
+
if (scrollTop < window.innerHeight / 2) {
|
|
51
|
+
setIsAtRange(false);
|
|
52
|
+
} else {
|
|
53
|
+
setIsAtRange(true);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
function moveToTop() {
|
|
59
|
+
|
|
60
|
+
const duration = speed;
|
|
61
|
+
|
|
62
|
+
const scrollToTarget = function (target: HTMLElement) {
|
|
63
|
+
|
|
64
|
+
const top = target.getBoundingClientRect().top;
|
|
65
|
+
const startPos = window.pageYOffset;
|
|
66
|
+
const diff = top;
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
const start = new Date().getTime();
|
|
70
|
+
const from = 0;
|
|
71
|
+
const to = 100;
|
|
72
|
+
let requestId: any;
|
|
73
|
+
|
|
74
|
+
const loop = function () {
|
|
75
|
+
|
|
76
|
+
//easing
|
|
77
|
+
const time = new Date().getTime() - start;
|
|
78
|
+
let val;
|
|
79
|
+
|
|
80
|
+
switch (easeType) {
|
|
81
|
+
case "linear":
|
|
82
|
+
val = easeLinear(time, from, to - from, duration);
|
|
83
|
+
break;
|
|
84
|
+
case "ease-in":
|
|
85
|
+
val = easeInQuad(time, from, to - from, duration);
|
|
86
|
+
break;
|
|
87
|
+
case "ease-out":
|
|
88
|
+
val = easeOutQuad(time, from, to - from, duration);
|
|
89
|
+
break;
|
|
90
|
+
case "ease-in-out":
|
|
91
|
+
val = easeInOutQuad(time, from, to - from, duration);
|
|
92
|
+
break;
|
|
93
|
+
|
|
94
|
+
default:
|
|
95
|
+
val = easeLinear(time, from, to - from, duration);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Elapsed time in miliseconds
|
|
99
|
+
const percent = val / 100;
|
|
100
|
+
|
|
101
|
+
window.scrollTo(0, startPos + diff * percent);
|
|
102
|
+
|
|
103
|
+
if (time < duration) {
|
|
104
|
+
// Continue moving
|
|
105
|
+
requestId = window.requestAnimationFrame(loop);
|
|
106
|
+
} else {
|
|
107
|
+
window.cancelAnimationFrame(requestId);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
requestId = window.requestAnimationFrame(loop);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
scrollToTarget(document.body);
|
|
114
|
+
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
function handleClick(e: any) {
|
|
119
|
+
e.preventDefault();
|
|
120
|
+
moveToTop();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
//Hide other pages button of back-to-top
|
|
128
|
+
btnRef.current?.classList.remove('active');
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
// Add function to the element that should be used as the scrollable area.
|
|
132
|
+
window.removeEventListener('scroll', windowScrollUpdate);
|
|
133
|
+
window.removeEventListener('touchmove', windowScrollUpdate);
|
|
134
|
+
window.addEventListener('scroll', windowScrollUpdate);
|
|
135
|
+
window.addEventListener('touchmove', windowScrollUpdate);
|
|
136
|
+
windowScrollUpdate();
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
//
|
|
140
|
+
btnRef.current?.removeEventListener('click', handleClick);
|
|
141
|
+
btnRef.current?.addEventListener('click', handleClick);
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
return () => {
|
|
145
|
+
btnRef.current?.removeEventListener('click', handleClick);
|
|
146
|
+
window.removeEventListener('scroll', windowScrollUpdate);
|
|
147
|
+
window.removeEventListener('touchmove', windowScrollUpdate);
|
|
148
|
+
|
|
149
|
+
//Hide other pages button of back-to-top
|
|
150
|
+
btnRef.current?.classList.remove('active');
|
|
151
|
+
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
}, []);
|
|
156
|
+
|
|
157
|
+
return (
|
|
158
|
+
<>
|
|
159
|
+
<div className="back-to-top" ref={btnRef}>
|
|
160
|
+
<button type="button" className={isAtRange ? 'active' : ''}>
|
|
161
|
+
{btnIcon || <>
|
|
162
|
+
<svg width="40px" fill="#000000" viewBox="0 0 96.522 96.522">
|
|
163
|
+
<g>
|
|
164
|
+
<path d="M74.692,65.181l-9.044-7.321c1.319-5.557,1.988-11.532,1.988-17.761c0-19.963-14.052-38.367-18.719-39.988
|
|
165
|
+
c-0.426-0.147-0.887-0.147-1.313,0c-4.667,1.621-18.719,20.025-18.719,39.988c0,6.229,0.669,12.205,1.99,17.761l-9.045,7.321
|
|
166
|
+
c-0.541,0.438-0.815,1.127-0.724,1.817l3.69,27.787c0.104,0.787,0.663,1.438,1.425,1.658c0.765,0.22,1.582-0.029,2.092-0.638
|
|
167
|
+
l14.413-17.225c3.543,2.163,7.527,2.163,11.07,0l14.411,17.225c0.387,0.461,0.951,0.717,1.534,0.717
|
|
168
|
+
c0.186,0,0.373-0.026,0.558-0.079c0.762-0.221,1.32-0.871,1.425-1.658l3.69-27.787C75.507,66.309,75.233,65.619,74.692,65.181z
|
|
169
|
+
M48.262,39.619c-4.418,0-8-3.582-8-8s3.582-8,8-8s8,3.582,8,8S52.68,39.619,48.262,39.619z"/>
|
|
170
|
+
</g>
|
|
171
|
+
</svg>
|
|
172
|
+
</>}
|
|
173
|
+
</button>
|
|
174
|
+
</div>
|
|
175
|
+
|
|
176
|
+
</>
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
export default BackToTop;
|