@allxsmith/bestax-bulma 5.2.1 → 5.3.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.
- package/dist/bestax.css +1 -1
- package/dist/bestax.css.map +1 -1
- package/dist/extras.css +1 -1
- package/dist/extras.css.map +1 -1
- package/dist/index.cjs.js +94 -0
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +94 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/types/components/Reveal.d.ts +16 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/versions/bestax-no-dark-mode.css +1 -1
- package/dist/versions/bestax-no-dark-mode.css.map +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css +1 -1
- package/dist/versions/bestax-no-helpers-prefixed.css.map +1 -1
- package/dist/versions/bestax-no-helpers.css +1 -1
- package/dist/versions/bestax-no-helpers.css.map +1 -1
- package/dist/versions/bestax-prefixed.css +1 -1
- package/dist/versions/bestax-prefixed.css.map +1 -1
- package/package.json +1 -1
- package/src/scss/components/_index.scss +1 -0
- package/src/scss/components/_reveal.scss +94 -0
package/dist/index.esm.js
CHANGED
|
@@ -2522,6 +2522,99 @@ const Carousel = forwardRef(({ value: controlledValue, autoplay = false, interva
|
|
|
2522
2522
|
});
|
|
2523
2523
|
Carousel.displayName = 'Carousel';
|
|
2524
2524
|
|
|
2525
|
+
function usePrefersReducedMotion() {
|
|
2526
|
+
const [prefersReducedMotion, setPrefersReducedMotion] = useState(false);
|
|
2527
|
+
useEffect(() => {
|
|
2528
|
+
if (typeof window === 'undefined' || !window.matchMedia)
|
|
2529
|
+
return undefined;
|
|
2530
|
+
const mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
2531
|
+
setPrefersReducedMotion(mediaQuery.matches);
|
|
2532
|
+
const handleChange = (event) => {
|
|
2533
|
+
setPrefersReducedMotion(event.matches);
|
|
2534
|
+
};
|
|
2535
|
+
mediaQuery.addEventListener('change', handleChange);
|
|
2536
|
+
return () => mediaQuery.removeEventListener('change', handleChange);
|
|
2537
|
+
}, []);
|
|
2538
|
+
return prefersReducedMotion;
|
|
2539
|
+
}
|
|
2540
|
+
const Reveal = ({ animation = 'fade-up', delay = 0, duration = 600, threshold = 0.15, once = true, as: Component = 'div', cascade = false, cascadeInterval = 80, className, style, children, ...props }) => {
|
|
2541
|
+
const { bulmaHelperClasses, rest } = useBulmaClasses(props);
|
|
2542
|
+
const classPrefix = useClassPrefix();
|
|
2543
|
+
const prefersReducedMotion = usePrefersReducedMotion();
|
|
2544
|
+
const [node, setNode] = useState(null);
|
|
2545
|
+
const [isMounted, setIsMounted] = useState(false);
|
|
2546
|
+
const [isRevealed, setIsRevealed] = useState(false);
|
|
2547
|
+
const observerThreshold = Number.isFinite(threshold)
|
|
2548
|
+
? Math.min(Math.max(threshold, 0), 1)
|
|
2549
|
+
: 0.15;
|
|
2550
|
+
useEffect(() => {
|
|
2551
|
+
setIsMounted(true);
|
|
2552
|
+
}, []);
|
|
2553
|
+
useEffect(() => {
|
|
2554
|
+
if (prefersReducedMotion) {
|
|
2555
|
+
setIsRevealed(true);
|
|
2556
|
+
return undefined;
|
|
2557
|
+
}
|
|
2558
|
+
if (typeof IntersectionObserver === 'undefined') {
|
|
2559
|
+
setIsRevealed(true);
|
|
2560
|
+
return undefined;
|
|
2561
|
+
}
|
|
2562
|
+
if (!node)
|
|
2563
|
+
return undefined;
|
|
2564
|
+
const observer = new IntersectionObserver(([entry]) => {
|
|
2565
|
+
if (entry.isIntersecting) {
|
|
2566
|
+
setIsRevealed(true);
|
|
2567
|
+
if (once)
|
|
2568
|
+
observer.unobserve(node);
|
|
2569
|
+
}
|
|
2570
|
+
else if (!once) {
|
|
2571
|
+
setIsRevealed(false);
|
|
2572
|
+
}
|
|
2573
|
+
}, { threshold: observerThreshold });
|
|
2574
|
+
observer.observe(node);
|
|
2575
|
+
return () => observer.disconnect();
|
|
2576
|
+
}, [node, prefersReducedMotion, once, observerThreshold]);
|
|
2577
|
+
const isAnimated = isMounted && !prefersReducedMotion;
|
|
2578
|
+
const revealed = !isAnimated || isRevealed;
|
|
2579
|
+
const itemAnimationClasses = prefixedClassNames(classPrefix, {
|
|
2580
|
+
[`reveal-${animation}`]: isAnimated,
|
|
2581
|
+
'is-revealed': revealed,
|
|
2582
|
+
});
|
|
2583
|
+
const combinedClasses = classNames(usePrefixedClassNames('reveal', { 'is-cascade': cascade }), !cascade && itemAnimationClasses, bulmaHelperClasses, className);
|
|
2584
|
+
const wrapperStyle = cascade
|
|
2585
|
+
? { ...style }
|
|
2586
|
+
: {
|
|
2587
|
+
...style,
|
|
2588
|
+
transitionDelay: `${delay}ms`,
|
|
2589
|
+
transitionDuration: `${duration}ms`,
|
|
2590
|
+
};
|
|
2591
|
+
const content = cascade
|
|
2592
|
+
? Children.toArray(children).map((child, index) => {
|
|
2593
|
+
const itemStyle = {
|
|
2594
|
+
transitionDelay: `${delay + index * cascadeInterval}ms`,
|
|
2595
|
+
transitionDuration: `${duration}ms`,
|
|
2596
|
+
};
|
|
2597
|
+
if (isValidElement(child)) {
|
|
2598
|
+
return cloneElement(child, {
|
|
2599
|
+
key: child.key,
|
|
2600
|
+
className: classNames(itemAnimationClasses, child.props.className),
|
|
2601
|
+
style: { ...itemStyle, ...child.props.style },
|
|
2602
|
+
});
|
|
2603
|
+
}
|
|
2604
|
+
return (jsx("span", { className: itemAnimationClasses, style: itemStyle, children: child }, index));
|
|
2605
|
+
})
|
|
2606
|
+
: children;
|
|
2607
|
+
if (typeof Component === 'string') {
|
|
2608
|
+
return React.createElement(Component, {
|
|
2609
|
+
...rest,
|
|
2610
|
+
ref: setNode,
|
|
2611
|
+
className: combinedClasses,
|
|
2612
|
+
style: wrapperStyle,
|
|
2613
|
+
}, content);
|
|
2614
|
+
}
|
|
2615
|
+
return (jsx("div", { ref: setNode, className: combinedClasses, style: wrapperStyle, children: jsx(Component, { ...rest, children: content }) }));
|
|
2616
|
+
};
|
|
2617
|
+
|
|
2525
2618
|
const Block = ({ className, textColor, bgColor, children, ...props }) => {
|
|
2526
2619
|
const { bulmaHelperClasses, rest } = useBulmaClasses({
|
|
2527
2620
|
color: textColor,
|
|
@@ -8111,5 +8204,5 @@ const Section = ({ size, className, children, color, bgColor, textColor, ...prop
|
|
|
8111
8204
|
return (jsx("section", { className: sectionClasses, ...rest, children: children }));
|
|
8112
8205
|
};
|
|
8113
8206
|
|
|
8114
|
-
export { Autocomplete, Block, Box, Breadcrumb, Button, Buttons, CardWithSubComponents as Card, Carousel, CarouselItem, Cell, Checkbox, Checkboxes, Code, Collapse, Column, Columns, ConfigProvider, Container, Content, Control, DateInput, DateInputBase, DateTimeInput, DateTimeInputBase, Delete, Dialog, DialogContainer, Divider, Dropdown, DropdownDivider, DropdownItem, Emphasis, Field, FieldBody, FieldLabel, Figure, File, Footer, Grid, Hero, HeroBody, HeroFoot, HeroHead, Icon, IconText, Image, Input, InputBase, Level, LevelItem, LevelLeft, LevelRight, Link, LinkButton, ListItem, Loading, Media, MediaContent, MediaLeft, MediaRight, Menu, MenuItem, MenuLabel, MenuList, MessageWithSubComponents as Message, Modal, Navbar, NavbarBrand, NavbarBurger, NavbarDivider, NavbarDropdown, NavbarDropdownMenu, NavbarEnd, NavbarItem, NavbarLink, NavbarMenu, NavbarStart, Notification, NotificationContainer, Numberinput, OrderedList, Pagination, PaginationEllipsis, PaginationLink, PaginationList, PaginationNext, PaginationPrevious, Panel, PanelBlock, PanelButtonBlock, PanelCheckboxBlock, PanelHeading, PanelIcon, PanelInputBlock, PanelTabs, Paragraph, Pre, Progress, Radio, Radios, Rate, Section, Select, SelectBase, Sidebar, Skeleton, Slider, Span, Step, Steps, Strong, SubTitle, Switch, Tab, TabContentItem, TabItem, TabList, Table, Tabs, TabsContent, Tag, Taginput, Tags, Tbody, Td, TextArea, TextAreaBase, Tfoot, Th, Thead, Theme, TimeInput, TimeInputBase, Title, Toast, ToastContainer, Tooltip, Tr, UnorderedList, __test_exports__, checkboxColors, checkboxSizes, classNames, createPrefixedClassNames, dialog, isBrowser$1 as isBrowser, notification, prefixedClassNames, radioColors, radioSizes, switchColors, switchSizes, toast, useBulmaClasses, useClassPrefix, useColorClasses, useConfig, useFlexboxClasses, useIconLibrary, useInsideControl, useInsideField, useOtherClasses, usePrefixedClass, usePrefixedClassNames, useSpacingClasses, useTypographyClasses, useVisibilityClasses, validAlignContents, validAlignItems, validAlignSelfs, validAlignments$1 as validAlignments, validColorShades, validColors, validDisplays, validFlexDirections, validFlexGrowShrink, validFlexWraps, validFontFamilies, validJustifyContents, validSizes$1 as validSizes, validTableColors, validTextSizes, validTextTransforms, validTextWeights, validViewports, validVisibilities };
|
|
8207
|
+
export { Autocomplete, Block, Box, Breadcrumb, Button, Buttons, CardWithSubComponents as Card, Carousel, CarouselItem, Cell, Checkbox, Checkboxes, Code, Collapse, Column, Columns, ConfigProvider, Container, Content, Control, DateInput, DateInputBase, DateTimeInput, DateTimeInputBase, Delete, Dialog, DialogContainer, Divider, Dropdown, DropdownDivider, DropdownItem, Emphasis, Field, FieldBody, FieldLabel, Figure, File, Footer, Grid, Hero, HeroBody, HeroFoot, HeroHead, Icon, IconText, Image, Input, InputBase, Level, LevelItem, LevelLeft, LevelRight, Link, LinkButton, ListItem, Loading, Media, MediaContent, MediaLeft, MediaRight, Menu, MenuItem, MenuLabel, MenuList, MessageWithSubComponents as Message, Modal, Navbar, NavbarBrand, NavbarBurger, NavbarDivider, NavbarDropdown, NavbarDropdownMenu, NavbarEnd, NavbarItem, NavbarLink, NavbarMenu, NavbarStart, Notification, NotificationContainer, Numberinput, OrderedList, Pagination, PaginationEllipsis, PaginationLink, PaginationList, PaginationNext, PaginationPrevious, Panel, PanelBlock, PanelButtonBlock, PanelCheckboxBlock, PanelHeading, PanelIcon, PanelInputBlock, PanelTabs, Paragraph, Pre, Progress, Radio, Radios, Rate, Reveal, Section, Select, SelectBase, Sidebar, Skeleton, Slider, Span, Step, Steps, Strong, SubTitle, Switch, Tab, TabContentItem, TabItem, TabList, Table, Tabs, TabsContent, Tag, Taginput, Tags, Tbody, Td, TextArea, TextAreaBase, Tfoot, Th, Thead, Theme, TimeInput, TimeInputBase, Title, Toast, ToastContainer, Tooltip, Tr, UnorderedList, __test_exports__, checkboxColors, checkboxSizes, classNames, createPrefixedClassNames, dialog, isBrowser$1 as isBrowser, notification, prefixedClassNames, radioColors, radioSizes, switchColors, switchSizes, toast, useBulmaClasses, useClassPrefix, useColorClasses, useConfig, useFlexboxClasses, useIconLibrary, useInsideControl, useInsideField, useOtherClasses, usePrefixedClass, usePrefixedClassNames, useSpacingClasses, useTypographyClasses, useVisibilityClasses, validAlignContents, validAlignItems, validAlignSelfs, validAlignments$1 as validAlignments, validColorShades, validColors, validDisplays, validFlexDirections, validFlexGrowShrink, validFlexWraps, validFontFamilies, validJustifyContents, validSizes$1 as validSizes, validTableColors, validTextSizes, validTextTransforms, validTextWeights, validViewports, validVisibilities };
|
|
8115
8208
|
//# sourceMappingURL=index.esm.js.map
|