@allxsmith/bestax-bulma 5.2.0 → 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/index.esm.js CHANGED
@@ -1155,6 +1155,18 @@ Pagination.Ellipsis = PaginationEllipsis;
1155
1155
  Pagination.Previous = PaginationPrevious;
1156
1156
  Pagination.Next = PaginationNext;
1157
1157
 
1158
+ function stripRedundantLibraryPrefix(name, library) {
1159
+ if (!name) {
1160
+ return name;
1161
+ }
1162
+ if (library === 'fa' && name.startsWith('fa-')) {
1163
+ return name.substring(3);
1164
+ }
1165
+ if (library === 'mdi' && name.startsWith('mdi-')) {
1166
+ return name.substring(4);
1167
+ }
1168
+ return name;
1169
+ }
1158
1170
  function getIconClasses(library, name, variant, features) {
1159
1171
  let baseClass;
1160
1172
  let iconClass;
@@ -1228,6 +1240,7 @@ const Icon = ({ className, textColor, bgColor, name, library, variant, features,
1228
1240
  }
1229
1241
  const defaultLibrary = useIconLibrary();
1230
1242
  const finalLibrary = library || defaultLibrary || 'fa';
1243
+ finalName = stripRedundantLibraryPrefix(finalName, finalLibrary);
1231
1244
  const { bulmaHelperClasses, rest } = useBulmaClasses({
1232
1245
  color: textColor,
1233
1246
  backgroundColor: bgColor,
@@ -2509,6 +2522,99 @@ const Carousel = forwardRef(({ value: controlledValue, autoplay = false, interva
2509
2522
  });
2510
2523
  Carousel.displayName = 'Carousel';
2511
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
+
2512
2618
  const Block = ({ className, textColor, bgColor, children, ...props }) => {
2513
2619
  const { bulmaHelperClasses, rest } = useBulmaClasses({
2514
2620
  color: textColor,
@@ -8098,5 +8204,5 @@ const Section = ({ size, className, children, color, bgColor, textColor, ...prop
8098
8204
  return (jsx("section", { className: sectionClasses, ...rest, children: children }));
8099
8205
  };
8100
8206
 
8101
- 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 };
8102
8208
  //# sourceMappingURL=index.esm.js.map