thearyadev / top500-aggregator

A suite of tools and a web service to collect and provide data on the Overwatch 2 Top 500 leaderboards.
https://t500-aggregator.aryankothari.dev/
Do What The F*ck You Want To Public License
6 stars 2 forks source link

[Snyk] Upgrade @mantine/hooks from 7.8.1 to 7.9.1 #210

Closed thearyadev closed 4 months ago

thearyadev commented 5 months ago

This PR was automatically created by Snyk using the credentials of a real user.


![snyk-top-banner](https://github.com/andygongea/OWASP-Benchmark/assets/818805/c518c423-16fe-447e-b67f-ad5a49b5d123)

Snyk has created this PR to upgrade @mantine/hooks from 7.8.1 to 7.9.1.

:information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.
- The recommended version is **2 versions** ahead of your current version. - The recommended version was released on **a month ago**.
Release notes
Package name: @mantine/hooks
  • 7.9.1 - 2024-05-08

    What's Changed

    • [@ mantine/core] Fix theme.scale being ignored in Input, Paper and Table border styles
    • [@ mantine/core] Fix virtualColor function requring use client in Next.js
    • [@ mantine/core] FloatingIndicator: Fix incorrect resize observer logic (#6129)
    • [@ mantine/core] NumberInput: Fix incorrect allowNegative handling with up/down arrows (#6170)
    • [@ mantine/core] Fix error={true} prop set on Checkbox, Radio and Switch rendering unxpected error element with margin
    • [@ mantine/core] SegmentedControl: Fix theme.primaryColor not being respected in the focus ring styles
    • [@ mantine/core] CloseButton: Fix incorrect specificity of some selectors
    • [@ mantine/core] Fix incorrect aria-label handling in Select, Autocomplete, MultiSelect and TagsInputs components (#6123)
    • [@ mantine/core] Modal: Prevent onClose from being called when modal is not opened (#6156)
    • [@ mantine/core] PasswordInput: Fix duplicated password visibility icon in Edge browser (#6126)
    • [@ mantine/hooks] use-hash: Fix hash value not being updated correctly (#6145)
    • [@ mantine/emotion] Fix incorrect transform logic that was causing extra hooks to render (#6159)

    New Contributors

    Full Changelog: 7.9.0...7.9.1

  • 7.9.0 - 2024-05-02

    View changelog with demos on mantine.dev website

    @ mantine/emotion package

    New @ mantine/emotion package is now available to simplify migration
    from 6.x to 7.x. It includes createStyles function and additional
    functionality for sx and styles props for all components similar to what was available
    in @ mantine/core package in v6.

    If you still haven't migrated to 7.x because of the change in styling approach, you can now
    have a smoother transition by using @ mantine/emotion package. To learn more about the package,
    visit the documentation page and updated 6.x to 7.x migration guide.

    <div class="highlight highlight-source-tsx notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import { rem } from '@ mantine/core'; import { createStyles } from '@ mantine/emotion';

    const useStyles = createStyles((theme, _, u) => ({ wrapper: { maxWidth: rem(400), width: '100%', height: rem(180), display: 'flex', alignItems: 'center', justifyContent: 'center', marginLeft: 'auto', marginRight: 'auto', borderRadius: theme.radius.sm,

    // Use light and dark selectors to change styles based on color scheme
    [u.light]: {
      backgroundColor: theme.colors.gray[1],
    },
    
    [u.dark]: {
      backgroundColor: theme.colors.dark[5],
    },
    
    // Reference theme.breakpoints in smallerThan and largerThan functions
    [u.smallerThan('sm')]: {
      // Child reference in nested selectors via ref
      [`&amp; .${u.ref('child')}`]: {
        fontSize: theme.fontSizes.xs,
      },
    },

    },

    child: { // Assign selector to a ref to reference it in other styles ref: u.ref('child'), padding: theme.spacing.md, borderRadius: theme.radius.sm, boxShadow: theme.shadows.md,

    [u.light]: {
      backgroundColor: theme.white,
      color: theme.black,
    },
    
    [u.dark]: {
      backgroundColor: theme.colors.dark[8],
      color: theme.white,
    },

    }, }));

    function Demo() { const { classes } = useStyles();

    return ( <div className={classes.wrapper}> <div className={classes.child}>createStyles demo</div> </div> ); }">

    import { rem } from '@ mantine/core';
    import { createStyles } from '@ mantine/emotion';

    const useStyles = createStyles((theme, _, u) => ({ wrapper: { maxWidth: rem(400), width: '100%', height: rem(180), display: 'flex', alignItems: 'center', justifyContent: 'center', marginLeft: 'auto', marginRight: 'auto', borderRadius: theme.radius.sm,

    <span class="pl-c">// Use light and dark selectors to change styles based on color scheme</span>
    <span class="pl-kos">[</span><span class="pl-s1">u</span><span class="pl-kos">.</span><span class="pl-c1">light</span><span class="pl-kos">]</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">backgroundColor</span>: <span class="pl-s1">theme</span><span class="pl-kos">.</span><span class="pl-c1">colors</span><span class="pl-kos">.</span><span class="pl-c1">gray</span><span class="pl-kos">[</span><span class="pl-c1">1</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    
    <span class="pl-kos">[</span><span class="pl-s1">u</span><span class="pl-kos">.</span><span class="pl-c1">dark</span><span class="pl-kos">]</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">backgroundColor</span>: <span class="pl-s1">theme</span><span class="pl-kos">.</span><span class="pl-c1">colors</span><span class="pl-kos">.</span><span class="pl-c1">dark</span><span class="pl-kos">[</span><span class="pl-c1">5</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    
    <span class="pl-c">// Reference theme.breakpoints in smallerThan and largerThan functions</span>
    <span class="pl-kos">[</span><span class="pl-s1">u</span><span class="pl-kos">.</span><span class="pl-en">smallerThan</span><span class="pl-kos">(</span><span class="pl-s">'sm'</span><span class="pl-kos">)</span><span class="pl-kos">]</span>: <span class="pl-kos">{</span>
      <span class="pl-c">// Child reference in nested selectors via ref</span>
      <span class="pl-kos">[</span><span class="pl-s">`&amp; .<span class="pl-s1"><span class="pl-kos">${</span><span class="pl-s1">u</span><span class="pl-kos">.</span><span class="pl-en">ref</span><span class="pl-kos">(</span><span class="pl-s">'child'</span><span class="pl-kos">)</span><span class="pl-kos">}</span></span>`</span><span class="pl-kos">]</span>: <span class="pl-kos">{</span>
        <span class="pl-c1">fontSize</span>: <span class="pl-s1">theme</span><span class="pl-kos">.</span><span class="pl-c1">fontSizes</span><span class="pl-kos">.</span><span class="pl-c1">xs</span><span class="pl-kos">,</span>
      <span class="pl-kos">}</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>

    },

    child: { // Assign selector to a ref to reference it in other styles ref: u.ref('child'), padding: theme.spacing.md, borderRadius: theme.radius.sm, boxShadow: theme.shadows.md,

    <span class="pl-kos">[</span><span class="pl-s1">u</span><span class="pl-kos">.</span><span class="pl-c1">light</span><span class="pl-kos">]</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">backgroundColor</span>: <span class="pl-s1">theme</span><span class="pl-kos">.</span><span class="pl-c1">white</span><span class="pl-kos">,</span>
      <span class="pl-c1">color</span>: <span class="pl-s1">theme</span><span class="pl-kos">.</span><span class="pl-c1">black</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>
    
    <span class="pl-kos">[</span><span class="pl-s1">u</span><span class="pl-kos">.</span><span class="pl-c1">dark</span><span class="pl-kos">]</span>: <span class="pl-kos">{</span>
      <span class="pl-c1">backgroundColor</span>: <span class="pl-s1">theme</span><span class="pl-kos">.</span><span class="pl-c1">colors</span><span class="pl-kos">.</span><span class="pl-c1">dark</span><span class="pl-kos">[</span><span class="pl-c1">8</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
      <span class="pl-c1">color</span>: <span class="pl-s1">theme</span><span class="pl-kos">.</span><span class="pl-c1">white</span><span class="pl-kos">,</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span>

    }, }));

    function Demo() { const { classes } = useStyles();

    return ( <div className={classes.wrapper}> <div className={classes.child}>createStyles demo</div> </div> ); }

React 18.3 support

All @ mantine/* components and hooks have been updated to support React 18.3. It is
recommended to update your application as well to prepare for the upcoming React 19 release.

use-field hook

New use-field hook is now available in @ mantine/form package.
It can be used as a simpler alternative to use-form hook to manage state of a single input without the need to create a form.
The hook supports most of use-form hook features: validation with function, touched and
dirty state, error message, validation on change/blur and more.

<div class="highlight highlight-source-tsx notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import { TextInput } from '@ mantine/core'; import { isEmail, useField } from '@ mantine/form';

function Demo() { const field = useField({ initialValue: '', validateOnChange: true, validate: isEmail('Invalid email'), });

return <TextInput {...field.getInputProps()} label="Email" placeholder="Enter your email" />; }">

import { TextInput } from '@ mantine/core';
import { isEmail, useField } from '@ mantine/form';

function Demo() { const field = useField({ initialValue: '', validateOnChange: true, validate: isEmail('Invalid email'), });

return <TextInput {...field.getInputProps()} label="Email" placeholder="Enter your email" />; }

use-field hook also supports async validation:

<div class="highlight highlight-source-tsx notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import { Button, Loader, TextInput } from '@ mantine/core'; import { useField } from '@ mantine/form';

function validateAsync(value: string): Promise<string | null> { return new Promise((resolve) => { window.setTimeout(() => { resolve(value === 'mantine' ? null : 'Value must be "mantine"'); }, 800); }); }

function Demo() { const field = useField({ initialValue: '', validate: validateAsync, });

return ( <> <TextInput {...field.getInputProps()} label="Enter 'mantine'" placeholder="Enter 'mantine'" rightSection={field.isValidating ? <Loader size={18} /> : null} mb="md" /> <Button onClick={field.validate}>Validate async</Button> </> ); }">

import { Button, Loader, TextInput } from '@ mantine/core';
import { useField } from '@ mantine/form';

function validateAsync(value: string): Promise<string | null> { return new Promise((resolve) => { window.setTimeout(() => { resolve(value === 'mantine' ? null : 'Value must be "mantine"'); }, 800); }); }

function Demo() { const field = useField({ initialValue: '', validate: validateAsync, });

return ( <> <TextInput {...field.getInputProps()} label="Enter 'mantine'" placeholder="Enter 'mantine'" rightSection={field.isValidating ? <Loader size={18} /> : null} mb="md" /> <Button onClick={field.validate}>Validate async</Button> </> ); }

Custom PostCSS mixins

You can now define custom mixins that are not included in mantine-postcss-preset by specifying them
in the mixins option. To learn about mixins syntax, follow postcss-mixins documentation.
Note that this feature is available in postcss-preset-mantine starting from version 1.15.0.

Example of adding clearfix and circle mixins:

module.exports = {
plugins: {
'postcss-preset-mantine': {
autoRem: true,
mixins: {
clearfix: {
'&::after': {
content: '""',
display: 'table',
clear: 'both',
},
},
circle: (_mixin, size) => ({
borderRadius: '50%',
width: size,
height: size,
}),
},
},
// ... Other plugins
},
};

Then you can use these mixins in your styles:

.demo {
@ mixin clearfix;
@ mixin circle 100px;
}

use-matches hook

New use-matches hook exported from @ mantine/core is an alternative to use-media-query
if you need to match multiple media queries and values. It accepts an object with media queries as keys and
values at given breakpoint as values.

Note that use-matches hook uses the same logic as use-media-query under the hood,
it is not recommended to be used as a primary source of responsive styles, especially if you have ssr in your application.

In the following example:

<div class="highlight highlight-source-tsx notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import { Box, useMatches } from '@ mantine/core';

function Demo() { const color = useMatches({ base: 'blue.9', sm: 'orange.9', lg: 'red.9', });

return ( <Box bg={color} c="white" p="xl"> Box with color that changes based on screen size </Box> ); }">

import { Box, useMatches } from '@ mantine/core';

function Demo() { const color = useMatches({ base: 'blue.9', sm: 'orange.9', lg: 'red.9', });

return ( <Box bg={color} c="white" p="xl"> Box with color that changes based on screen size </Box> ); }

BarChart value label

BarChart now supports withBarValueLabel prop that allows
displaying value label on top of each bar:

<div class="highlight highlight-source-tsx notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import { BarChart } from '@ mantine/charts'; import { data } from './data';

function Demo() { return ( <BarChart h={300} data={data} dataKey="month" valueFormatter={(value) => new Intl.NumberFormat('en-US').format(value)} withBarValueLabel series={[ { name: 'Smartphones', color: 'violet.6' }, { name: 'Laptops', color: 'blue.6' }, { name: 'Tablets', color: 'teal.6' }, ]} /> ); }">

import { BarChart } from '@ mantine/charts';
import { data } from './data';

function Demo() { return ( <BarChart h={300} data={data} dataKey="month" valueFormatter={(value) => new Intl.NumberFormat('en-US').format(value)} withBarValueLabel series={[ { name: 'Smartphones', color: 'violet.6' }, { name: 'Laptops', color: 'blue.6' }, { name: 'Tablets', color: 'teal.6' }, ]} /> ); }

Documentation updates

Other changes

  </li>
  <li>
    <b>7.8.1</b> - <a href="https://github.com/mantinedev/mantine/releases/tag/7.8.1">2024-04-23</a></br><h2>Notes</h2>

Note that if you've already started using uncontrolled form mode introduced in 7.8.0, you need to include form.key() as described in the documentation.

What's Changed

New Contributors

Full Changelog: 7.8.0...7.8.1

  </li>
</ul>
from <a href="https://github.com/mantinedev/mantine/releases">@mantine/hooks GitHub release notes</a>


[!IMPORTANT]


Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.

For more information:

vercel[bot] commented 5 months ago

The latest updates on your projects. Learn more about Vercel for Git ā†—ļøŽ

Name Status Preview Comments Updated (UTC)
top500-aggregator āŒ Failed (Inspect) Jun 7, 2024 8:11am