[Snyk] Upgrade @mantine/core from 7.9.1 to 7.10.1 #221
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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/core from 7.9.1 to 7.10.1.
ℹ️ 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 3 versions ahead of your current version.
The recommended version was released on 23 days ago.
Release notes
Package name: @mantine/core
What's Changed
[@ mantine/charts]
BarChart: Add waterfall type (#6231)[@ mantine/form]
Fixform.setFieldError
called insideform.onSubmit
not working correctly in some cases (#6101)[@ mantine/core]
SegmentedControl: Fix false error reported by React 18.3+ for incorrect key prop usage[@ mantine/hooks]
use-fetch: Fix incorrect error handling (#6278)[@ mantine/core]
Fixbd
style prop not being applied in some components (#6282)[@ mantine/core]
NumberInput: Fix incorrect leading zeros handling (#6232)[@ mantine/core]
NumberInput: Fix incorrect logic while editing decimal values (#6232)[@ mantine/core]
ScrollArea: Fix scrollbar flickering on reveal with hover and scroll types (#6218)[@ mantine/hooks]
Update use-throttled-* hooks to emit updates on trailing edges (#6257)[@ mantine/core]
Input: AddinputSize
prop to setsize
html attribute on the input elementNew Contributors
Full Changelog: 7.10.0...7.10.1
View changelog with demos on mantine.dev website
Tree component
New Tree component:
import { Group, RenderTreeNodePayload, Tree } from '@ mantine/core';
import { CssIcon, NpmIcon, TypeScriptCircleIcon } from '@ mantinex/dev-icons';
import { data, dataCode } from './data';
import classes from './Demo.module.css';
interface FileIconProps {
name: string;
isFolder: boolean;
expanded: boolean;
}
function FileIcon({ name, isFolder, expanded }: FileIconProps) {
if (name.endsWith('package.json')) {
return <NpmIcon size={14} />;
}
if (name.endsWith('.ts') || name.endsWith('.tsx') || name.endsWith('tsconfig.json')) {
return <TypeScriptCircleIcon size={14} />;
}
if (name.endsWith('.css')) {
return <CssIcon size={14} />;
}
if (isFolder) {
return expanded ? (
<IconFolderOpen color="var(--mantine-color-yellow-9)" size={14} stroke={2.5} />
) : (
<IconFolder color="var(--mantine-color-yellow-9)" size={14} stroke={2.5} />
);
}
return null;
}
function Leaf({ node, expanded, hasChildren, elementProps }: RenderTreeNodePayload) {
return (
<Group gap={5} {...elementProps}>
<FileIcon name={node.value} isFolder={hasChildren} expanded={expanded} />
<span>{node.label}</span>
</Group>
);
}
function Demo() {
return (
<Tree
classNames={classes}
selectOnClick
clearSelectionOnOutsideClick
data={data}
renderNode={(payload) => <Leaf {...payload} />}
/>
);
}
form.getInputNode
New
form.getInputNode(path)
handler returns input DOM node for the given field path.Form example, it can be used to focus input on form submit if there is an error:
import { isEmail, isNotEmpty, useForm } from '@ mantine/form';
function Demo() {
const form = useForm({
mode: 'uncontrolled',
initialValues: {
name: '',
email: '',
},
});
return (
<form
onSubmit={form.onSubmit(
(values) => console.log(values),
(errors) => {
const firstErrorPath = Object.keys(errors)[0];
form.getInputNode(firstErrorPath)?.focus();
}
)}
>
<TextInput
withAsterisk
label="Your name"
placeholder="Your name"
key={form.key('name')}
{...form.getInputProps('name')}
/>
);
}
Container queries in SimpleGrid
You can now use container queries
in SimpleGrid component. With container queries, grid columns and spacing
will be adjusted based on the container width, not the viewport width.
Example of using container queries. To see how the grid changes, resize the root element
of the demo with the resize handle located at the bottom right corner of the demo:
function Demo() {
return (
// Wrapper div is added for demonstration purposes only,
// it is not required in real projects
<div style={{ resize: 'horizontal', overflow: 'hidden', maxWidth: '100%' }}>
<SimpleGrid
type="container"
cols={{ base: 1, '300px': 2, '500px': 5 }}
spacing={{ base: 10, '300px': 'xl' }}
>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
</SimpleGrid>
</div>
);
}
Checkbox and Radio indicators
New Checkbox.Indicator and Radio.Indicator
components look exactly the same as
Checkbox
andRadio
components, but they do nothave any semantic meaning, they are just visual representations of checkbox and radio states.
Checkbox.Indicator
component:function Demo() {
return (
<Group>
<Checkbox.Indicator />
<Checkbox.Indicator checked />
<Checkbox.Indicator indeterminate />
<Checkbox.Indicator disabled />
<Checkbox.Indicator disabled checked />
<Checkbox.Indicator disabled indeterminate />
</Group>
);
}
Radio.Indicator
component:function Demo() {
return (
<Group>
<Radio.Indicator />
<Radio.Indicator checked />
<Radio.Indicator disabled />
<Radio.Indicator disabled checked />
</Group>
);
}
Checkbox and Radio cards
New Checkbox.Card and Radio.Card
components can be used as replacements for
Checkbox
andRadio
to build custom cards/buttons/etc.that work as checkboxes and radios. Components are accessible by default and support the same
keyboard interactions as
input[type="checkbox"]
andinput[type="radio"]
.Checkbox.Card
component:import { Checkbox, Group, Text } from '@ mantine/core';
import classes from './Demo.module.css';
function Demo() {
const [checked, setChecked] = useState(false);
return (
<Checkbox.Card
className={classes.root}
radius="md"
checked={checked}
onClick={() => setChecked((c) => !c)}
>
<Group wrap="nowrap" align="flex-start">
<Checkbox.Indicator />
<div>
<Text className={classes.label}>@ mantine/core</Text>
<Text className={classes.description}>
Core components library: inputs, buttons, overlays, etc.
</Text>
</div>
</Group>
</Checkbox.Card>
);
}
Checkbox.Card
component withCheckbox.Group
:import { Checkbox, Group, Stack, Text } from '@ mantine/core';
import classes from './Demo.module.css';
const data = [
{
name: '@ mantine/core',
description: 'Core components library: inputs, buttons, overlays, etc.',
},
{ name: '@ mantine/hooks', description: 'Collection of reusable hooks for React applications.' },
{ name: '@ mantine/notifications', description: 'Notifications system' },
];
function Demo() {
const [value, setValue] = useState<string[]>([]);
const cards = data.map((item) => (
<Checkbox.Card className={classes.root} radius="md" value={item.name} key={item.name}>
<Group wrap="nowrap" align="flex-start">
<Checkbox.Indicator />
<div>
<Text className={classes.label}>{item.name}</Text>
<Text className={classes.description}>{item.description}</Text>
</div>
</Group>
</Checkbox.Card>
));
return (
<>
<Checkbox.Group
value={value}
onChange={setValue}
label="Pick packages to install"
description="Choose all packages that you will need in your application"
>
<Stack pt="md" gap="xs">
{cards}
</Stack>
</Checkbox.Group>
);
}
Radio.Card
component:import { Group, Radio, Text } from '@ mantine/core';
import classes from './Demo.module.css';
function Demo() {
const [checked, setChecked] = useState(false);
return (
<Radio.Card
className={classes.root}
radius="md"
checked={checked}
onClick={() => setChecked((c) => !c)}
>
<Group wrap="nowrap" align="flex-start">
<Radio.Indicator />
<div>
<Text className={classes.label}>@ mantine/core</Text>
<Text className={classes.description}>
Core components library: inputs, buttons, overlays, etc.
</Text>
</div>
</Group>
</Radio.Card>
);
}
Radio.Card
component withRadio.Group
:import { Group, Radio, Stack, Text } from '@ mantine/core';
import classes from './Demo.module.css';
const data = [
{
name: '@ mantine/core',
description: 'Core components library: inputs, buttons, overlays, etc.',
},
{ name: '@ mantine/hooks', description: 'Collection of reusable hooks for React applications.' },
{ name: '@ mantine/notifications', description: 'Notifications system' },
];
function Demo() {
const [value, setValue] = useState<string | null>(null);
const cards = data.map((item) => (
<Radio.Card className={classes.root} radius=<sp...