math-main-components 0.0.190 → 0.0.193
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/Popover/index.d.ts +6 -0
 - package/dist/components/useDimensions.d.ts +4 -0
 - package/dist/components/useOrientation.d.ts +3 -0
 - package/dist/components/useScroll.d.ts +4 -0
 - package/dist/hooks/useDimensions.d.ts +4 -0
 - package/dist/hooks/useOrientation.d.ts +3 -0
 - package/dist/hooks/useScroll.d.ts +4 -0
 - package/dist/index.cjs.js +54 -0
 - package/dist/index.d.ts +3 -0
 - package/dist/index.esm.js +52 -1
 - package/package.json +1 -1
 
    
        package/dist/index.cjs.js
    CHANGED
    
    | 
         @@ -10398,6 +10398,57 @@ function UsageCard({ title, subtitle, ratio = 0, loading }) { 
     | 
|
| 
       10398 
10398 
     | 
    
         
             
                            ], lineWidth: 15, totalValue: 1 }))));
         
     | 
| 
       10399 
10399 
     | 
    
         
             
            }
         
     | 
| 
       10400 
10400 
     | 
    
         | 
| 
      
 10401 
     | 
    
         
            +
            function useDimensions() {
         
     | 
| 
      
 10402 
     | 
    
         
            +
                // Initialize state with undefined width/height so server and client renders match
         
     | 
| 
      
 10403 
     | 
    
         
            +
                // Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/
         
     | 
| 
      
 10404 
     | 
    
         
            +
                const [windowSize, setWindowSize] = React.useState({
         
     | 
| 
      
 10405 
     | 
    
         
            +
                    width: 0,
         
     | 
| 
      
 10406 
     | 
    
         
            +
                    height: 0,
         
     | 
| 
      
 10407 
     | 
    
         
            +
                });
         
     | 
| 
      
 10408 
     | 
    
         
            +
                React.useEffect(() => {
         
     | 
| 
      
 10409 
     | 
    
         
            +
                    // only execute all the code below in client side
         
     | 
| 
      
 10410 
     | 
    
         
            +
                    // Handler to call on window resize
         
     | 
| 
      
 10411 
     | 
    
         
            +
                    function handleResize() {
         
     | 
| 
      
 10412 
     | 
    
         
            +
                        // Set window width/height to state
         
     | 
| 
      
 10413 
     | 
    
         
            +
                        setWindowSize({
         
     | 
| 
      
 10414 
     | 
    
         
            +
                            width: window.innerWidth,
         
     | 
| 
      
 10415 
     | 
    
         
            +
                            height: window.innerHeight,
         
     | 
| 
      
 10416 
     | 
    
         
            +
                        });
         
     | 
| 
      
 10417 
     | 
    
         
            +
                    }
         
     | 
| 
      
 10418 
     | 
    
         
            +
                    // Add event listener
         
     | 
| 
      
 10419 
     | 
    
         
            +
                    window.addEventListener("resize", handleResize);
         
     | 
| 
      
 10420 
     | 
    
         
            +
                    // Call handler right away so state gets updated with initial window size
         
     | 
| 
      
 10421 
     | 
    
         
            +
                    handleResize();
         
     | 
| 
      
 10422 
     | 
    
         
            +
                    // Remove event listener on cleanup
         
     | 
| 
      
 10423 
     | 
    
         
            +
                    return () => window.removeEventListener("resize", handleResize);
         
     | 
| 
      
 10424 
     | 
    
         
            +
                }, []); // Empty array ensures that effect is only run on mount
         
     | 
| 
      
 10425 
     | 
    
         
            +
                return windowSize;
         
     | 
| 
      
 10426 
     | 
    
         
            +
            }
         
     | 
| 
      
 10427 
     | 
    
         
            +
             
     | 
| 
      
 10428 
     | 
    
         
            +
            function useOrientation() {
         
     | 
| 
      
 10429 
     | 
    
         
            +
                const size = useDimensions();
         
     | 
| 
      
 10430 
     | 
    
         
            +
                return (size.width > size.height) ? "landscape" : "portrait";
         
     | 
| 
      
 10431 
     | 
    
         
            +
            }
         
     | 
| 
      
 10432 
     | 
    
         
            +
             
     | 
| 
      
 10433 
     | 
    
         
            +
            function useScroll() {
         
     | 
| 
      
 10434 
     | 
    
         
            +
                const [scroll, setScroll] = React.useState({
         
     | 
| 
      
 10435 
     | 
    
         
            +
                    xScroll: 0,
         
     | 
| 
      
 10436 
     | 
    
         
            +
                    yScroll: 0,
         
     | 
| 
      
 10437 
     | 
    
         
            +
                });
         
     | 
| 
      
 10438 
     | 
    
         
            +
                const onScroll = React.useCallback(() => {
         
     | 
| 
      
 10439 
     | 
    
         
            +
                    const { scrollY, scrollX } = window;
         
     | 
| 
      
 10440 
     | 
    
         
            +
                    setScroll({
         
     | 
| 
      
 10441 
     | 
    
         
            +
                        yScroll: scrollY,
         
     | 
| 
      
 10442 
     | 
    
         
            +
                        xScroll: scrollX,
         
     | 
| 
      
 10443 
     | 
    
         
            +
                    });
         
     | 
| 
      
 10444 
     | 
    
         
            +
                }, []);
         
     | 
| 
      
 10445 
     | 
    
         
            +
                React.useEffect(() => {
         
     | 
| 
      
 10446 
     | 
    
         
            +
                    window.addEventListener("scroll", onScroll, { passive: true });
         
     | 
| 
      
 10447 
     | 
    
         
            +
                    return () => window.removeEventListener("scroll", onScroll);
         
     | 
| 
      
 10448 
     | 
    
         
            +
                }, [onScroll]);
         
     | 
| 
      
 10449 
     | 
    
         
            +
                return scroll;
         
     | 
| 
      
 10450 
     | 
    
         
            +
            }
         
     | 
| 
      
 10451 
     | 
    
         
            +
             
     | 
| 
       10401 
10452 
     | 
    
         
             
            exports.Accordeon = Accordeon;
         
     | 
| 
       10402 
10453 
     | 
    
         
             
            exports.AuthButton = AuthButton;
         
     | 
| 
       10403 
10454 
     | 
    
         
             
            exports.Button = Button;
         
     | 
| 
         @@ -10436,3 +10487,6 @@ exports.Table = Table; 
     | 
|
| 
       10436 
10487 
     | 
    
         
             
            exports.Tabs = Tabs;
         
     | 
| 
       10437 
10488 
     | 
    
         
             
            exports.TextWithIcon = TextWithIcon;
         
     | 
| 
       10438 
10489 
     | 
    
         
             
            exports.UsageCard = UsageCard;
         
     | 
| 
      
 10490 
     | 
    
         
            +
            exports.useDimensions = useDimensions;
         
     | 
| 
      
 10491 
     | 
    
         
            +
            exports.useOrientation = useOrientation;
         
     | 
| 
      
 10492 
     | 
    
         
            +
            exports.useScroll = useScroll;
         
     | 
    
        package/dist/index.d.ts
    CHANGED
    
    | 
         @@ -32,6 +32,9 @@ export * from './components/Table'; 
     | 
|
| 
       32 
32 
     | 
    
         
             
            export * from './components/Tabs';
         
     | 
| 
       33 
33 
     | 
    
         
             
            export * from './components/TextWithIcon';
         
     | 
| 
       34 
34 
     | 
    
         
             
            export * from './components/UsageCard';
         
     | 
| 
      
 35 
     | 
    
         
            +
            export * from './hooks/useDimensions';
         
     | 
| 
      
 36 
     | 
    
         
            +
            export * from './hooks/useOrientation';
         
     | 
| 
      
 37 
     | 
    
         
            +
            export * from './hooks/useScroll';
         
     | 
| 
       35 
38 
     | 
    
         
             
            export * from './types/marketing/About';
         
     | 
| 
       36 
39 
     | 
    
         
             
            export * from './types/marketing/BenefitForIndividual';
         
     | 
| 
       37 
40 
     | 
    
         
             
            export * from './types/marketing/BenefitForSchool';
         
     | 
    
        package/dist/index.esm.js
    CHANGED
    
    | 
         @@ -10372,4 +10372,55 @@ function UsageCard({ title, subtitle, ratio = 0, loading }) { 
     | 
|
| 
       10372 
10372 
     | 
    
         
             
                            ], lineWidth: 15, totalValue: 1 }))));
         
     | 
| 
       10373 
10373 
     | 
    
         
             
            }
         
     | 
| 
       10374 
10374 
     | 
    
         | 
| 
       10375 
     | 
    
         
            -
             
     | 
| 
      
 10375 
     | 
    
         
            +
            function useDimensions() {
         
     | 
| 
      
 10376 
     | 
    
         
            +
                // Initialize state with undefined width/height so server and client renders match
         
     | 
| 
      
 10377 
     | 
    
         
            +
                // Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/
         
     | 
| 
      
 10378 
     | 
    
         
            +
                const [windowSize, setWindowSize] = useState({
         
     | 
| 
      
 10379 
     | 
    
         
            +
                    width: 0,
         
     | 
| 
      
 10380 
     | 
    
         
            +
                    height: 0,
         
     | 
| 
      
 10381 
     | 
    
         
            +
                });
         
     | 
| 
      
 10382 
     | 
    
         
            +
                useEffect(() => {
         
     | 
| 
      
 10383 
     | 
    
         
            +
                    // only execute all the code below in client side
         
     | 
| 
      
 10384 
     | 
    
         
            +
                    // Handler to call on window resize
         
     | 
| 
      
 10385 
     | 
    
         
            +
                    function handleResize() {
         
     | 
| 
      
 10386 
     | 
    
         
            +
                        // Set window width/height to state
         
     | 
| 
      
 10387 
     | 
    
         
            +
                        setWindowSize({
         
     | 
| 
      
 10388 
     | 
    
         
            +
                            width: window.innerWidth,
         
     | 
| 
      
 10389 
     | 
    
         
            +
                            height: window.innerHeight,
         
     | 
| 
      
 10390 
     | 
    
         
            +
                        });
         
     | 
| 
      
 10391 
     | 
    
         
            +
                    }
         
     | 
| 
      
 10392 
     | 
    
         
            +
                    // Add event listener
         
     | 
| 
      
 10393 
     | 
    
         
            +
                    window.addEventListener("resize", handleResize);
         
     | 
| 
      
 10394 
     | 
    
         
            +
                    // Call handler right away so state gets updated with initial window size
         
     | 
| 
      
 10395 
     | 
    
         
            +
                    handleResize();
         
     | 
| 
      
 10396 
     | 
    
         
            +
                    // Remove event listener on cleanup
         
     | 
| 
      
 10397 
     | 
    
         
            +
                    return () => window.removeEventListener("resize", handleResize);
         
     | 
| 
      
 10398 
     | 
    
         
            +
                }, []); // Empty array ensures that effect is only run on mount
         
     | 
| 
      
 10399 
     | 
    
         
            +
                return windowSize;
         
     | 
| 
      
 10400 
     | 
    
         
            +
            }
         
     | 
| 
      
 10401 
     | 
    
         
            +
             
     | 
| 
      
 10402 
     | 
    
         
            +
            function useOrientation() {
         
     | 
| 
      
 10403 
     | 
    
         
            +
                const size = useDimensions();
         
     | 
| 
      
 10404 
     | 
    
         
            +
                return (size.width > size.height) ? "landscape" : "portrait";
         
     | 
| 
      
 10405 
     | 
    
         
            +
            }
         
     | 
| 
      
 10406 
     | 
    
         
            +
             
     | 
| 
      
 10407 
     | 
    
         
            +
            function useScroll() {
         
     | 
| 
      
 10408 
     | 
    
         
            +
                const [scroll, setScroll] = useState({
         
     | 
| 
      
 10409 
     | 
    
         
            +
                    xScroll: 0,
         
     | 
| 
      
 10410 
     | 
    
         
            +
                    yScroll: 0,
         
     | 
| 
      
 10411 
     | 
    
         
            +
                });
         
     | 
| 
      
 10412 
     | 
    
         
            +
                const onScroll = useCallback(() => {
         
     | 
| 
      
 10413 
     | 
    
         
            +
                    const { scrollY, scrollX } = window;
         
     | 
| 
      
 10414 
     | 
    
         
            +
                    setScroll({
         
     | 
| 
      
 10415 
     | 
    
         
            +
                        yScroll: scrollY,
         
     | 
| 
      
 10416 
     | 
    
         
            +
                        xScroll: scrollX,
         
     | 
| 
      
 10417 
     | 
    
         
            +
                    });
         
     | 
| 
      
 10418 
     | 
    
         
            +
                }, []);
         
     | 
| 
      
 10419 
     | 
    
         
            +
                useEffect(() => {
         
     | 
| 
      
 10420 
     | 
    
         
            +
                    window.addEventListener("scroll", onScroll, { passive: true });
         
     | 
| 
      
 10421 
     | 
    
         
            +
                    return () => window.removeEventListener("scroll", onScroll);
         
     | 
| 
      
 10422 
     | 
    
         
            +
                }, [onScroll]);
         
     | 
| 
      
 10423 
     | 
    
         
            +
                return scroll;
         
     | 
| 
      
 10424 
     | 
    
         
            +
            }
         
     | 
| 
      
 10425 
     | 
    
         
            +
             
     | 
| 
      
 10426 
     | 
    
         
            +
            export { Accordeon, AuthButton, Button, CardButton, Checkbox, ChooseRole, ChooseRoleItem, CopyCode, Dialog, EmptyCard, FormButton, FormText, ForwardButton, Gap, InputArea, InputMail, InputNames, InputNumber, InputPassword, InputPin, InputText, OptionField, OptionFieldHorizontal, ProgressBar, RadioButtons, RadioOption, RedirectButton, SearchChip, SearchChips, Searchbar, Slider, SliderCard, StepBack, SvgIcon, Table, Tabs, TextWithIcon, UsageCard, useDimensions, useOrientation, useScroll };
         
     |