plataforma-fundacao-componentes 2.21.6 → 2.21.7
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/dist/components/carouselTouchFrendly/CarouselTouchFrendly.d.ts +1 -0
- package/dist/hooks/useControlledTimer/useControlledTimer.d.ts +6 -0
- package/dist/hooks/useControlledTimer/useControlledTimer.stories.d.ts +8 -0
- package/dist/index.css +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +99 -9
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +99 -10
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import './CarouselTouchFrendly.scss';
|
|
|
3
3
|
interface CarouselTouchFrendlyProps {
|
|
4
4
|
className?: string;
|
|
5
5
|
slides?: React.ReactNode[];
|
|
6
|
+
timeout?: number;
|
|
6
7
|
}
|
|
7
8
|
declare function CarouselTouchFrendly(props: CarouselTouchFrendlyProps): JSX.Element;
|
|
8
9
|
declare const _default: React.MemoExoticComponent<typeof CarouselTouchFrendly>;
|
package/dist/index.css
CHANGED
|
@@ -2769,12 +2769,14 @@ h5 {
|
|
|
2769
2769
|
margin: 0;
|
|
2770
2770
|
width: 100%;
|
|
2771
2771
|
height: 20vw;
|
|
2772
|
+
max-height: 320px;
|
|
2772
2773
|
border-radius: 8px; }
|
|
2773
2774
|
.component-banner.clickable {
|
|
2774
2775
|
cursor: pointer; }
|
|
2775
2776
|
@media screen and (max-width: 767.98px) {
|
|
2776
2777
|
.component-banner {
|
|
2777
2778
|
height: 80vw !important;
|
|
2779
|
+
max-height: 80vw;
|
|
2778
2780
|
flex-direction: column; }
|
|
2779
2781
|
.component-banner .component-banner-side {
|
|
2780
2782
|
width: 100% !important; }
|
package/dist/index.d.ts
CHANGED
|
@@ -81,6 +81,7 @@ import VideoModal from './components/videoModal/VideoModal';
|
|
|
81
81
|
import VideoPlayer from './components/videoPlayer/VideoPlayer';
|
|
82
82
|
import useCallbackedState from './hooks/useCallbackedState/useCallbackedState';
|
|
83
83
|
import useCarouselBehaviour from './hooks/useCarouselBehaviour/useCarouselBehaviour';
|
|
84
|
+
import useControlledTimer from './hooks/useControlledTimer/useControlledTimer';
|
|
84
85
|
import useDraggableContainer from './hooks/useDraggableContainer/useDraggableContainer';
|
|
85
86
|
import useDropOpened from './hooks/useDropOpened/useDropOpened';
|
|
86
87
|
import useModalManager from './hooks/useModalManager/useModalManager';
|
|
@@ -103,4 +104,4 @@ export * from './libraries/RadioButtonTheme';
|
|
|
103
104
|
export * from './libraries/SicrediLogoThemes';
|
|
104
105
|
export * from './libraries/Toast';
|
|
105
106
|
export * from './libraries/Tooltips';
|
|
106
|
-
export { Accordion, AdvancedSemiHeader, AssembleiaItem, AssembleiaPauta, Aconteceu, AnimatedLink, Banner, BannerAssembleia, BannerPesquisaCpfCnpj, BigBlockButton, BlocoDeNotas, BreadCrumb, Button, ButtonFileUpload, BlocoMinhasAssembleias, BottomNavigation, Card, Carousel, CarouselPersona, CarouselTouchFrendly, Checkbox, Col, Collapse, Container, DatePicker, Doughnut, DoughnutSquare, DropdownItem, DropdownMenu, EditableVideoItem, ElementPaginator, Etapas, Etiqueta, FileLoader, FileUpload, FooterSicredi, FullHeightContainer, Header, HeaderSeparator, HeaderSearchField, IconButton, IconButtonWithLabel, Information, Input, InputArea, ItemDropdownDownload, InformativoAssembleiasComImagem, InformativoAssembleiasComVideo, Menu, MenuItem, Modal, ModalManager, ModulosTitle, MoneyByMonth, MoneyMonthLineChart, NotaEdit, Notification, PageSubTitle, PageTitle, Paginator, PreviaVideo, ProgressBar, RadioButton, Row, SearchBlocoDeNotas, Select, Switch, Table, TypedTable, TableFileNameAndAction, TableActions, TableWithOverflow, TextEditor, LeftCheckboxWithLabel, ActionsColumn, Toast, ToastManager, Tooltip, TooltipManager, TopLoader, VideoItem, VideoPlayer, VideoModal, useCallbackedState, useCarouselBehaviour, useDraggableContainer, useDropOpened, useModalManager, useProgressiveCount, useTimeElapsed, useToastManager, useValidatedState };
|
|
107
|
+
export { Accordion, AdvancedSemiHeader, AssembleiaItem, AssembleiaPauta, Aconteceu, AnimatedLink, Banner, BannerAssembleia, BannerPesquisaCpfCnpj, BigBlockButton, BlocoDeNotas, BreadCrumb, Button, ButtonFileUpload, BlocoMinhasAssembleias, BottomNavigation, Card, Carousel, CarouselPersona, CarouselTouchFrendly, Checkbox, Col, Collapse, Container, DatePicker, Doughnut, DoughnutSquare, DropdownItem, DropdownMenu, EditableVideoItem, ElementPaginator, Etapas, Etiqueta, FileLoader, FileUpload, FooterSicredi, FullHeightContainer, Header, HeaderSeparator, HeaderSearchField, IconButton, IconButtonWithLabel, Information, Input, InputArea, ItemDropdownDownload, InformativoAssembleiasComImagem, InformativoAssembleiasComVideo, Menu, MenuItem, Modal, ModalManager, ModulosTitle, MoneyByMonth, MoneyMonthLineChart, NotaEdit, Notification, PageSubTitle, PageTitle, Paginator, PreviaVideo, ProgressBar, RadioButton, Row, SearchBlocoDeNotas, Select, Switch, Table, TypedTable, TableFileNameAndAction, TableActions, TableWithOverflow, TextEditor, LeftCheckboxWithLabel, ActionsColumn, Toast, ToastManager, Tooltip, TooltipManager, TopLoader, VideoItem, VideoPlayer, VideoModal, useCallbackedState, useCarouselBehaviour, useControlledTimer, useDraggableContainer, useDropOpened, useModalManager, useProgressiveCount, useTimeElapsed, useToastManager, useValidatedState };
|
package/dist/index.js
CHANGED
|
@@ -2270,6 +2270,72 @@ function CarouselPersona(props) {
|
|
|
2270
2270
|
|
|
2271
2271
|
var CarouselPersona$1 = React.memo(CarouselPersona);
|
|
2272
2272
|
|
|
2273
|
+
function useControlledTimer(props) {
|
|
2274
|
+
var timeoutRef = React.useRef(undefined);
|
|
2275
|
+
var timeLeft = React.useRef(0);
|
|
2276
|
+
var endDate = React.useRef(0);
|
|
2277
|
+
var repeat = React.useCallback(function (timeout) {
|
|
2278
|
+
if (timeout === void 0) {
|
|
2279
|
+
timeout = props.timeout;
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
endDate.current = new Date().getTime() + timeout;
|
|
2283
|
+
timeoutRef.current = setTimeout(function () {
|
|
2284
|
+
props.callbackTrigger();
|
|
2285
|
+
repeat(props.timeout);
|
|
2286
|
+
}, timeout);
|
|
2287
|
+
}, [props]);
|
|
2288
|
+
var dispatchAction = React.useCallback(function (action) {
|
|
2289
|
+
switch (action) {
|
|
2290
|
+
case 'play':
|
|
2291
|
+
if (timeoutRef.current) {
|
|
2292
|
+
throw new Error('Timer já está em andamento');
|
|
2293
|
+
}
|
|
2294
|
+
|
|
2295
|
+
repeat(timeLeft.current > 200 ? timeLeft.current : props.timeout);
|
|
2296
|
+
timeLeft.current = 0;
|
|
2297
|
+
break;
|
|
2298
|
+
|
|
2299
|
+
case 'pause':
|
|
2300
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
2301
|
+
timeoutRef.current = undefined;
|
|
2302
|
+
var now = new Date().getTime();
|
|
2303
|
+
|
|
2304
|
+
if (endDate.current && endDate.current > now) {
|
|
2305
|
+
timeLeft.current = endDate.current - now;
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
break;
|
|
2309
|
+
|
|
2310
|
+
case 'restart':
|
|
2311
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
2312
|
+
timeoutRef.current = undefined;
|
|
2313
|
+
endDate.current = 0;
|
|
2314
|
+
repeat(props.timeout);
|
|
2315
|
+
break;
|
|
2316
|
+
|
|
2317
|
+
default:
|
|
2318
|
+
case 'stop':
|
|
2319
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
2320
|
+
timeoutRef.current = undefined;
|
|
2321
|
+
endDate.current = 0;
|
|
2322
|
+
}
|
|
2323
|
+
}, [props.timeout, repeat]);
|
|
2324
|
+
React.useLayoutEffect(function () {
|
|
2325
|
+
if (props.timeout) {
|
|
2326
|
+
dispatchAction('play');
|
|
2327
|
+
}
|
|
2328
|
+
|
|
2329
|
+
return function () {
|
|
2330
|
+
if (timeoutRef.current) {
|
|
2331
|
+
clearTimeout(timeoutRef.current);
|
|
2332
|
+
timeoutRef.current = undefined;
|
|
2333
|
+
}
|
|
2334
|
+
};
|
|
2335
|
+
}, []);
|
|
2336
|
+
return dispatchAction;
|
|
2337
|
+
}
|
|
2338
|
+
|
|
2273
2339
|
var rootClassName$I = 'component-carousel-touch-frendly';
|
|
2274
2340
|
|
|
2275
2341
|
function CarouselTouchFrendly(props) {
|
|
@@ -2282,6 +2348,9 @@ function CarouselTouchFrendly(props) {
|
|
|
2282
2348
|
atual = _useState2[0],
|
|
2283
2349
|
setAtual = _useState2[1];
|
|
2284
2350
|
|
|
2351
|
+
var atualRef = React.useRef(atual);
|
|
2352
|
+
atualRef.current = atual;
|
|
2353
|
+
|
|
2285
2354
|
var _useCarouselBehaviour = useCarouselBehaviour({
|
|
2286
2355
|
atual: atual,
|
|
2287
2356
|
setAtual: setAtual,
|
|
@@ -2295,14 +2364,27 @@ function CarouselTouchFrendly(props) {
|
|
|
2295
2364
|
CarouselBehaviour = _useCarouselBehaviour[0],
|
|
2296
2365
|
handleChange = _useCarouselBehaviour[1];
|
|
2297
2366
|
|
|
2367
|
+
var dispatchActionsToTimer = useControlledTimer({
|
|
2368
|
+
timeout: props.timeout ? props.timeout : 0,
|
|
2369
|
+
callbackTrigger: function callbackTrigger() {
|
|
2370
|
+
handleChange(atualRef.current < props.slides.length - 1 ? atualRef.current + 1 : 0, false);
|
|
2371
|
+
}
|
|
2372
|
+
});
|
|
2298
2373
|
return React__default.createElement("div", {
|
|
2299
2374
|
id: id,
|
|
2300
2375
|
className: getMergedClassNames([rootClassName$I, props.className])
|
|
2301
2376
|
}, React__default.createElement("div", {
|
|
2302
|
-
className: rootClassName$I + "-outside-content"
|
|
2377
|
+
className: rootClassName$I + "-outside-content",
|
|
2378
|
+
onMouseEnter: function onMouseEnter() {
|
|
2379
|
+
dispatchActionsToTimer('pause');
|
|
2380
|
+
},
|
|
2381
|
+
onMouseLeave: function onMouseLeave() {
|
|
2382
|
+
dispatchActionsToTimer('play');
|
|
2383
|
+
}
|
|
2303
2384
|
}, props.slides.length > 1 && React__default.createElement("div", {
|
|
2304
2385
|
className: rootClassName$I + "-control prev",
|
|
2305
2386
|
onClick: function onClick() {
|
|
2387
|
+
dispatchActionsToTimer('stop');
|
|
2306
2388
|
handleChange(atual > 0 ? atual - 1 : props.slides.length - 1, false);
|
|
2307
2389
|
}
|
|
2308
2390
|
}, React__default.createElement("div", {
|
|
@@ -2312,6 +2394,7 @@ function CarouselTouchFrendly(props) {
|
|
|
2312
2394
|
})), props.slides.length > 1 && React__default.createElement("div", {
|
|
2313
2395
|
className: rootClassName$I + "-control next",
|
|
2314
2396
|
onClick: function onClick() {
|
|
2397
|
+
dispatchActionsToTimer('stop');
|
|
2315
2398
|
handleChange(atual < props.slides.length - 1 ? atual + 1 : 0, false);
|
|
2316
2399
|
}
|
|
2317
2400
|
}, React__default.createElement("div", {
|
|
@@ -2324,6 +2407,7 @@ function CarouselTouchFrendly(props) {
|
|
|
2324
2407
|
return React__default.createElement("div", {
|
|
2325
2408
|
key: index,
|
|
2326
2409
|
onClick: function onClick() {
|
|
2410
|
+
dispatchActionsToTimer('restart');
|
|
2327
2411
|
handleChange(index, false);
|
|
2328
2412
|
},
|
|
2329
2413
|
className: getMergedClassNames([rootClassName$I + "-ball", index === atual ? 'atual' : ''])
|
|
@@ -11412,23 +11496,27 @@ function useToastManager(props) {
|
|
|
11412
11496
|
arrayOfToast = _useState[0],
|
|
11413
11497
|
setArrayOfToast = _useState[1];
|
|
11414
11498
|
|
|
11499
|
+
var toastsRef = React.useRef(arrayOfToast);
|
|
11500
|
+
toastsRef.current = arrayOfToast;
|
|
11415
11501
|
var verticalPosition = (props === null || props === void 0 ? void 0 : props.verticalPosition) || 'top';
|
|
11416
11502
|
var horizontalPosition = (props === null || props === void 0 ? void 0 : props.horizontalPosition) || 'right';
|
|
11417
11503
|
var max = (props === null || props === void 0 ? void 0 : props.max) || undefined;
|
|
11418
11504
|
var reverse = (props === null || props === void 0 ? void 0 : props.reverse) || false;
|
|
11419
11505
|
var animateSize = (props === null || props === void 0 ? void 0 : props.animateSize) || false;
|
|
11420
|
-
|
|
11421
|
-
|
|
11506
|
+
|
|
11507
|
+
var closeById = function closeById(id) {
|
|
11508
|
+
var arr = toastsRef.current.filter(function (a) {
|
|
11422
11509
|
return a.id !== id;
|
|
11423
11510
|
});
|
|
11424
11511
|
setArrayOfToast(arr);
|
|
11425
|
-
}
|
|
11426
|
-
|
|
11512
|
+
};
|
|
11513
|
+
|
|
11514
|
+
var showToast = function showToast(toast) {
|
|
11427
11515
|
var id = "toaster-" + count$1;
|
|
11428
|
-
var arr =
|
|
11516
|
+
var arr = toastsRef.current.slice();
|
|
11429
11517
|
var obj = {};
|
|
11430
11518
|
|
|
11431
|
-
if (toast.prevent &&
|
|
11519
|
+
if (toast.prevent && arr.some(function (t) {
|
|
11432
11520
|
return t.label === toast.label;
|
|
11433
11521
|
})) {
|
|
11434
11522
|
return;
|
|
@@ -11438,12 +11526,13 @@ function useToastManager(props) {
|
|
|
11438
11526
|
id: id
|
|
11439
11527
|
}, toast);
|
|
11440
11528
|
|
|
11441
|
-
if (!max ||
|
|
11529
|
+
if (!max || arr.length < max) {
|
|
11442
11530
|
arr.push(obj);
|
|
11443
11531
|
setArrayOfToast(arr);
|
|
11444
11532
|
count$1++;
|
|
11445
11533
|
}
|
|
11446
|
-
}
|
|
11534
|
+
};
|
|
11535
|
+
|
|
11447
11536
|
var clearToast = React.useCallback(function () {
|
|
11448
11537
|
setArrayOfToast([]);
|
|
11449
11538
|
}, []);
|
|
@@ -11856,6 +11945,7 @@ exports.VideoPlayer = VideoPlayer;
|
|
|
11856
11945
|
exports.getStatusClassName = getStatusClassName;
|
|
11857
11946
|
exports.useCallbackedState = useCallbackedState;
|
|
11858
11947
|
exports.useCarouselBehaviour = useCarouselBehaviour;
|
|
11948
|
+
exports.useControlledTimer = useControlledTimer;
|
|
11859
11949
|
exports.useDraggableContainer = useDraggableContainer;
|
|
11860
11950
|
exports.useDropOpened = useDropOpened;
|
|
11861
11951
|
exports.useModalManager = useModalManager;
|