Skip to content
This repository has been archived by the owner on Mar 12, 2023. It is now read-only.

Update mantine monorepo to v5 (major) #46

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Dec 6, 2022

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@mantine/core (source) 4.2.12 -> 5.9.4 age adoption passing confidence
@mantine/hooks (source) 4.2.12 -> 5.9.4 age adoption passing confidence
@mantine/modals (source) 4.2.12 -> 5.9.4 age adoption passing confidence
@mantine/next (source) 4.2.12 -> 5.9.4 age adoption passing confidence
@mantine/notifications (source) 4.2.12 -> 5.9.4 age adoption passing confidence

Release Notes

mantinedev/mantine

v5.9.4

Compare Source

What's Changed
  • [@mantine/core] Switch: Fix incorrect alignment (#​3082)
  • [@mantine/dates] Fix DateRangePicker and DatePicker components not supporting readOnly prop (#​3089)
  • [@mantine/hooks] use-click-outside: Fix incorrect typescript definition for strict mode (#​3119)
  • [@mantine/core] Input: Fix incorrect Input.Error role, connect Input.Description and Input.Error to the input element with aria-describedby (#​3146)
  • [@mantine/tiptap] Fix control styles API working incorrectly for Link and Color control (#​3148)
  • [@mantine/modals] Increase default zIndex to allow usage with Modal component (#​3154)
  • [@mantine/hooks] use-click-outside: Fix incorrect outside clicks detection when click target is html element (#​3143)

Full Changelog: mantinedev/mantine@5.9.3...5.9.4

v5.9.3

Compare Source

What's Changed
  • [@mantine/core] TypographyStylesProvider: Fix incorrect <code /> styles
  • [@mantine/styles] Allow createStyle to go to the original definition (#​3108)
  • [@mantine/core] Menu: Change hovered item background-color to make it consistent with other components (#​3109)
  • [@mantine/tiptap] Fix incorrect RichTextEditor ref type (#​3142)
  • [@mantine/form] Fix typing issue with nested interfaces in passed type (#​3157)
New Contributors

Full Changelog: mantinedev/mantine@5.9.2...5.9.3

v5.9.2

Compare Source

What's Changed
  • [@mantine/form] Fix incorrect values type in validation rules (#​3110)
  • [@mantine/core] ScrollArea: Fix flickering
  • [@mantine/core] AppShell: Fix zIndex prop not being applied to Navbar and Header components
  • [@mantine/dropzone] Fix getFilesFromEvent error when files are droppped (#​3115)
  • [@mantine/core] Collapse: Rollback axis prop as it breaks regular Collapse usage

Full Changelog: mantinedev/mantine@5.9.1...5.9.2

v5.9.1

Compare Source

What's Changed
  • [@mantine/styles] Add access to theme in defaultProps (#​2950)
  • [@mantine/hooks] use-hotkeys: Add option to specify tags that should be ignored (#​3045)
  • [@mantine/form] Fix incorrect dirty state of the fields calculation after one of list actions was called (#​3025)
  • [@mantine/core] Select: Fix limit prop not working when current value matches one of the items from data (#​3070)
  • [@mantine/form] Fix incorrect form.isValid behavior when nested field has error (#​3080)
  • [@mantine/hooks] use-hash: Fix unexpected rerendering with hash without # (#​3097)
  • [@mantine/core] Add arrowPosition prop to Tooltip and Popover components to configure how the arrow is position relative to the target element (#​3100)
  • [@mantine/form] Fix implicit any type in validation rules for strict TS mode (#​3101)
  • [@mantine/core] TypographyStylesProvider: Add borderLeft to blockquote to make component look the same way as Blockquote component (#​3103)
  • [@mantine/core] Table: Fix incorrect styles applied to td/th elements with borders and colspan/rowspan (#​3106)
  • [@mantine/spotlight] Fix theme.defaultRadius not being respected
  • [@mantine/core] Select: Fix theme.defaultRadius not being respected by default item component
  • [@mantine/core] Radio: Automatically generate name if it was not provided via prop
  • [@mantine/dropzone] Add the getFilesFromEvent and validator props (#​3053)
  • [@mantine/hooks] use-media-query: Fix given initialValue not being used (#​3085)
New Contributors

Full Changelog: mantinedev/mantine@5.9.0...5.9.1

v5.9.0

Compare Source

View changelog with demos on mantine.dev website

use-eye-dropper hook

New use-eye-dropper hook provides an interface to work with EyeDropper API.
It allows to pick color from any pixel on the screen. Currently, the API is supported in Chromium based desktop browsers.

import { useState } from 'react';
import { ActionIcon, Group, ColorSwatch, Text } from '@&#8203;mantine/core';
import { IconColorPicker } from '@&#8203;tabler/icons';
import { useEyeDropper } from '@&#8203;mantine/hooks';

function Demo() {
  const [color, setColor] = useState('');
  const [error, setError] = useState(null);
  const { supported, open } = useEyeDropper();

  const pickColor = async () => {
    try {
      const { sRGBHex } = await open();
      setColor(sRGBHex);
    } catch (e) {
      setError(e);
    }
  };

  if (!supported) {
    return <Text ta="center">EyeDropper API is not supported in your browser</Text>;
  }

  return (
    <Group>
      <ActionIcon variant="default" onClick={pickColor}>
        <IconColorPicker size={16} stroke={1.5} />
      </ActionIcon>
      {color ? (
        <Group spacing="xs">
          <ColorSwatch color={color} />
          <Text>Picked color: {color}</Text>
        </Group>
      ) : (
        <Text>Click the button to pick color</Text>
      )}
      {error && <Text color="red">Error: {error?.message}</Text>}
    </Group>
  );
}

ColorInput eye dropper

ColorInput component now supports withEyeDropper prop to display eye dropper icon in the right section.
This feature depends on EyeDropper API,
the eye dropper will not be rendered if the API is not supported.

import { ColorInput } from '@&#8203;mantine/core';

function Demo() {
  return (
    <ColorInput
      withEyeDropper
      placeholder="With eye dropper"
      label="Pick any color from the page"
    />
  );
}

AppShell alt layout

AppShell component now supports placing Navbar and Aside components on top of Header and Footer with layout="alt" prop.

Responsive Grid gutter

Grid component now supports gutterXs, gutterSm, gutterMd, gutterLg, gutterXl props:

import { Grid } from '@&#8203;mantine/core';

function Demo() {
  return (
    <Grid gutter={5} gutterXs="md" gutterMd="xl" gutterXl={50}>
      <Grid.Col span={4}>1</Grid.Col>
      <Grid.Col span={4}>2</Grid.Col>
      <Grid.Col span={4}>3</Grid.Col>
    </Grid>
  );
}

Static components default props

All static components now support default props on MantineProvider.
The following example demonstrates how to add default props to Menu.Item, Tabs.List and
RichTextEditor.Toolbar components:

import { MantineProvider, Button } from '@&#8203;mantine/core';

function Demo() {
  return (
    <MantineProvider
      theme={{
        components: {
          MenuItem: {
            defaultProps: { color: 'red' },
          },

          TabsList: {
            defaultProps: {
              position: 'right',
            },
          },

          RichTextEditorToolbar: {
            defaultProps: {
              sticky: true,
              stickyOffset: 60,
            },
          },
        },
      }}
    >
      <App />
    </MantineProvider>
  );
}

Input.Placeholder component

Input.Placeholder component can be used to add placeholder to Input and InputBase components that are based on button element
or do not support placeholder property natively:

import { Input } from '@&#8203;mantine/core';

function Demo() {
  return (
    <Input component="button">
      <Input.Placeholder>Placeholder content</Input.Placeholder>
    </Input>
  );
}

Other changes

  • RangeSlider component now supports maxRange prop
  • Stepper component now supports any CSS color value in color prop
  • use-hotkeys hook now allows to configure whether default behavior should be prevented
  • Input and other components based on it now support any valid CSS size value in rightSectionWidth and iconWidth props

New Contributors

Full Changelog: mantinedev/mantine@5.8.4...5.9.0

v5.8.4

Compare Source

What's Changed

  • [@mantine/tiptap] Fix emotion warning produced by placeholder styles :first-child selector usage
  • [@mantine/hooks] use-move: Fix content on the page being selected when cursor moves over the target element (#​3069)
  • [@mantine/core] Drawer: Add missing Styles API selector for body (#​3056)
  • [@mantine/carousel] Carousel: fixed carousel indicator not changing when slidesToScroll value is changed (#​3058)
  • [@mantine/core] Stepper: Fix last item being cut off when used inside flex container (#​3062)
  • [@mantine/core] Fix incorrect arrow position for *-end and *-start positions in Tooltip, Popover, HoverCard and Menu components (#​3065)
  • [@mantine/tiptap] Add ref forwarding (#​3068)

Full Changelog: mantinedev/mantine@5.8.3...5.8.4

v5.8.3

Compare Source

What's Changed

  • [@mantine/dropzone] Add onDropAny prop to capture both accepted and rejected files (#​3010)
  • [@mantine/tiptap] Fix incorrect content border-radius
  • [@mantine/tiptap] Fix placeholder extension not working as expected
  • [@mantine/core] Drawer: Add missing aria-describedby and aria-labelledby attributes to the root element (#​3027)
  • [@mantine/core] NumberInput: Fix value not being formatted correctly when precision changes (#​3011)

New Contributors

Full Changelog: mantinedev/mantine@5.8.2...5.8.3

v5.8.2

What's Changed
  • [@mantine/tiptap] Fix incorrect hr control label
  • [@mantine/tiptap] Fix incorrect editor prop type
  • [@mantine/tiptap] Fix typo in strikethrough label (#​3004)
  • [@mantine/prism] Fix colorScheme prop not being passed to Prism from Prism.Panel component
  • [@mantine/core] Pagination: Fix incorrect handling of negative and zero total
  • [@mantine/hooks] use-pagination: Fix incorrect handling of decimal values passed as total (#​2979)
  • [@mantine/core] NumberInput: Fix readOnly prop not working correctly (#​2956)
  • [@mantine/hooks] Allow usage of use-click-outside and use-focus-trap hooks with shadow DOM
New Contributors

Full Changelog: mantinedev/mantine@5.8.0...5.8.2

v5.8.0

Compare Source

View changelog with demos on mantine.dev website

Tiptap rich text editor

New @​mantine/tiptap package is a replacement
for @​mantine/rte package. RichTextEditor
component is now based on Tiptap, it supports all of
Tiptap extensions and provides flexible components API.

import { RichTextEditor, Link } from '@&#8203;mantine/tiptap';
import { useEditor } from '@&#8203;tiptap/react';
import Highlight from '@&#8203;tiptap/extension-highlight';
import StarterKit from '@&#8203;tiptap/starter-kit';
import Underline from '@&#8203;tiptap/extension-underline';
import TextAlign from '@&#8203;tiptap/extension-text-align';
import Superscript from '@&#8203;tiptap/extension-superscript';
import SubScript from '@&#8203;tiptap/extension-subscript';

const content =
  '<h2 style="text-align: center;">Welcome to Mantine rich text editor</h2><p><code>RichTextEditor</code> component focuses on usability and is designed to be as simple as possible to bring a familiar editing experience to regular users. <code>RichTextEditor</code> is based on <a href="https://tiptap.dev/" rel="noopener noreferrer" target="_blank">Tiptap.dev</a> and supports all of its features:</p><ul><li>General text formatting: <strong>bold</strong>, <em>italic</em>, <u>underline</u>, <s>strike-through</s> </li><li>Headings (h1-h6)</li><li>Sub and super scripts (<sup>&lt;sup /&gt;</sup> and <sub>&lt;sub /&gt;</sub> tags)</li><li>Ordered and bullet lists</li><li>Text align&nbsp;</li><li>And all <a href="https://tiptap.dev/extensions" target="_blank" rel="noopener noreferrer">other extensions</a></li></ul>';

function Demo() {
  const editor = useEditor({
    extensions: [
      StarterKit,
      Underline,
      Link,
      Superscript,
      SubScript,
      Highlight,
      TextAlign.configure({ types: ['heading', 'paragraph'] }),
    ],
    content,
  });

  return (
    <RichTextEditor editor={editor}>
      <RichTextEditor.Toolbar sticky stickyOffset={60}>
        <RichTextEditor.ControlsGroup>
          <RichTextEditor.Bold />
          <RichTextEditor.Italic />
          <RichTextEditor.Underline />
          <RichTextEditor.Strikethrough />
          <RichTextEditor.ClearFormatting />
          <RichTextEditor.Highlight />
          <RichTextEditor.Code />
        </RichTextEditor.ControlsGroup>

        <RichTextEditor.ControlsGroup>
          <RichTextEditor.H1 />
          <RichTextEditor.H2 />
          <RichTextEditor.H3 />
          <RichTextEditor.H4 />
        </RichTextEditor.ControlsGroup>

        <RichTextEditor.ControlsGroup>
          <RichTextEditor.Blockquote />
          <RichTextEditor.Hr />
          <RichTextEditor.BulletList />
          <RichTextEditor.OrderedList />
          <RichTextEditor.Subscript />
          <RichTextEditor.Superscript />
        </RichTextEditor.ControlsGroup>

        <RichTextEditor.ControlsGroup>
          <RichTextEditor.Link />
          <RichTextEditor.Unlink />
        </RichTextEditor.ControlsGroup>

        <RichTextEditor.ControlsGroup>
          <RichTextEditor.AlignLeft />
          <RichTextEditor.AlignCenter />
          <RichTextEditor.AlignJustify />
          <RichTextEditor.AlignRight />
        </RichTextEditor.ControlsGroup>
      </RichTextEditor.Toolbar>

      <RichTextEditor.Content />
    </RichTextEditor>
  );
}

@​mantine/rte package deprecation

Quill based RichTextEditor is now deprecated.
@mantine/rte package will no longer receive any updates, support for it
will be discontinued when 6.0.0 version is released. We recommend to switch
to Tiptap based editor as soon as possible.

Other changes

New Contributors

Full Changelog: mantinedev/mantine@5.7.2...5.8.0

v5.7.2

Compare Source

What's Changed

  • [@mantine/core] RangeSlider: Fix incorrect minRange handling for negative values (#​2897)
  • [@mantine/core] Slider: Fix unexpected step behavior when min is set to odd number (#​2855)
  • [@mantine/core] Prevent focus shifting from the input when clear button is pressed in Select and MultiSelect components
  • [@mantine/core] TypographyStylesProvider: Add mark styles
  • [@mantine/core] Image: Do not show placeholder when image is loading to avoid issues with ssr and rapidly changing src prop
  • [@mantine/core] Slider: Fix incorrect marks styles when inverted prop is set (#​2894)
  • [@mantine/core] Fix incorrect label alignment in Checkbox, Radio and Switch components when label is a ReactNode (#​2881)
  • [@mantine/core] Modal: Fix incorrect click outside behavior (#​2896)
  • [@mantine/core] Radio: Fix size prop not being respected when used within Radio.Group (#​2913)

New Contributors

Full Changelog: mantinedev/mantine@5.7.1...5.7.2

v5.7.1

Compare Source

What's Changed

  • [@mantine/hooks] use-window-event: Fix event listener not being updated when event type or function changes
  • [@mantine/spotlight] Allow overriding autoComplete prop with searchInputProps
  • [@mantine/core] Menu: Allow overriding Menu.Item button type
  • [@mantine/hooks] use-scroll-into-view: Fix parameters changes being ignored (#​2866)
  • [@mantine/hooks] use-local-storage: Fix incorrect value returned if defaultValue is not specified (#​2872)
  • [@mantine/styles] Add missing right style prop (#​2887)
  • [@mantine/form] Add missing TransformValues type to createFormContext (#​2893)

New Contributors

Full Changelog: mantinedev/mantine@5.7.0...5.7.1

v5.7.0

Compare Source

View changelog with demos on mantine.dev website

Style props

All Mantine components now support responsive style props:

import { Box } from '@&#8203;mantine/core';

function Demo() {
  return (
    <Box
      w={{ base: 200, sm: 400, lg: 500 }}
      py={{ base: 'xs', sm: 'md', lg: 'xl' }}
      bg="blue.7"
      c="#fff"
      ta="center"
      mx="auto"
    >
      Box with responsive style props
    </Box>
  );
}

Flex component

Flex component is an alternative to Group and Stack components.
It supports new responsive style props:

import { Flex, Button } from '@&#8203;mantine/core';

function Demo() {
  return (
    <Flex
      direction={{ base: 'column', sm: 'row' }}
      gap={{ base: 'sm', sm: 'lg' }}
      justify={{ sm: 'center' }}
    >
      <Button>Button 1</Button>
      <Button>Button 2</Button>
      <Button>Button 3</Button>
    </Flex>
  );
}

Focus ring styles on theme

You can now customize focus ring styles for all components in MantineProvider:

function Demo() {
  return (
    <MantineProvider
      inherit
      theme={{
        focusRingStyles: {
          // reset styles are applied to <button /> and <a /> elements
          // in &:focus:not(:focus-visible) selector to mimic
          // default browser behavior for native <button /> and <a /> elements
          resetStyles: () => ({ outline: 'none' }),

          // styles applied to all elements expect inputs based on Input component
          // styled are added with &:focus selector
          styles: (theme) => ({ outline: `2px solid ${theme.colors.orange[5]}` }),

          // focus styles applied to components that are based on Input
          // styled are added with &:focus selector
          inputStyles: (theme) => ({ outline: `2px solid ${theme.colors.orange[5]}` }),
        },
      }}
    >
      <Group grow>
        <Button>Move focus with tab</Button>
        <TextInput placeholder="Focus input to see styles override" />
      </Group>
    </MantineProvider>
  );
}

Responsive Header and Footer height

Header and Footer components now support responsive height:

import { Header } from '@&#8203;mantine/core';

function Demo() {
  return <Header height={{ base: 50, sm: 60, lg: 70 }} />;
}

Other changes

  • Collapse component now supports axis prop, it is now possible to animate width
  • Button component now supports loaderPosition="center"
  • Carousel now supports onSlideChange prop
  • MantineProvider now includes theme.primaryColor validation – it will throw an error if primary color was set to an invalid value
  • use-form onSubmit can now be called without form event
  • Carousel now supports withKeyboardEvents prop that allows to disable keyboard events handling

New Contributors

Full Changelog: mantinedev/mantine@5.6.4...5.7.0

v5.6.4

Compare Source

What's Changed

  • [@mantine/core] Slider: Fix incorrect min/max values handling (#​2839)
  • [@mantine/core] ScrollArea: Fix incorrect ref usage in demos

New Contributors

Full Changelog: mantinedev/mantine@5.6.3...5.6.4

v5.6.3

Compare Source

What's Changed

  • [@mantine/core] Fix incorrect focus ring styles in Chip, SegmentedControl and ColorPicker components (box-shadow was replaced with outline)
  • [@mantine/core] Drawer: Fix transitionDuration not being respected for exit transition (#​2820)
  • [@mantine/core] Pagination: Fix theme.fontFamily not being respected (#​2796)
  • [@mantine/form] Fix required transform value type in UseFormInput (#​2816)
  • [@mantine/styles] Set color-scheme style in html element (#​2808)
  • [@mantine/core] Add data-checked attribute to Checkbox, Radio and Switch when components are used within groups
  • [@mantine/styles] Fix incorrect styles params type in strict ts mode

New Contributors

Full Changelog: mantinedev/mantine@5.6.2...5.6.3

v5.6.2

Compare Source

What's Changed
  • [@mantine/core] Modal: Fix modal not being centered because of scrollbars offset
  • [@mantine/core] MultiSelect: Fix poor selected values contrast with light color scheme and filled input variant
  • [@mantine/dropzone] Fix Dropzone.FullScreen opened when the user selects and drags text on the page
  • [@mantine/core] NativeSelect: Fix incorrect defaultValue handing in controlled components
  • [@mantine/rte] Fix theme.defaultRadius not being respected by some controls (#​2781)
  • [@mantine/styles] Improve useComponentDefaultProps types (#​2065)
  • [@mantine/core] Add arrowRadius support to Tooltip and Popover (#​2779)
New Contributors

Full Changelog: mantinedev/mantine@5.6.1...5.6.2

v5.6.1

Compare Source

What's Changed

  • [@mantine/core] Popover: Set default width to max-content to reduce position shift in some cases (#​2500)
  • [@mantine/core] Popover: Add position fallback to reduce postion shift (#​2500)
  • [@mantine/core] Slider: Fix incorrect min/max boundaries handling when step is larger than the difference between current value and min/max (#​2656)
  • [@mantine/hooks] use-idle: Improve types for events (#​2704)
  • [@mantine/hooks] use-focus-trap: Fix incorrect aria-hidden handling (#​2735)
  • [@mantine/core] Popover: Fix infinite loop when component is used with Preact (#​2752)
  • [@mantine/core] Tooltip: Add nested tooltips support (#​2768)
  • [@mantine/core] TransferList: Add transferIcon, transferAllIcon props, controlled search and tuple syntax for seachPlaceholder and nothingFound props (#​2769)
  • [@mantine/dropzone] Update react-dropzone to 14.2.3 to fix OS detection issue (#​2746)
  • [@mantine/form] Fix incorrect required second argument in UseFormReturnType (#​2758)
  • [@mantine/core] Rating: Fix count and fractions parameters to accept integers only (#​2763)
  • [@mantine/core] Rating: Fix broken react 17 compatibility

New Contributors

Full Changelog: mantinedev/mantine@5.6.0...5.6.1

v5.6.0

Compare Source

View changelog with demos on mantine.dev website

Rating component

New Rating component:

import { Rating } from '@&#8203;mantine/core';

function Demo() {
  return <Rating defaultValue={2} />
}

Progress sections props

Progress and RingProgress
components now support adding props to sections:

import { useState } from 'react';
import { Progress, Text } from '@&#8203;mantine/core';

function Demo() {
  const [hovered, setHovered] = useState(-1);
  const reset = () => setHovered(-1);
  return (
    <>
      <Progress
        onMouseLeave={() => setHovered(-1)}
        size="xl"
        sections={[
          { value: 40, color: 'cyan', onMouseEnter: () => setHovered(0), onMouseLeave: reset },
          { value: 20, color: 'blue', onMouseEnter: () => setHovered(1), onMouseLeave: reset },
          { value: 15, color: 'indigo', onMouseEnter: () => setHovered(2), onMouseLeave: reset },
        ]}
      />
      <Text>Hovered section: {hovered === -1 ? 'none' : hovered}</Text>
    </>
  );
}

use-favicon hook

New use-favicon hook:

import { useState } from 'react';
import { useFavicon } from '@&#8203;mantine/hooks';
import { Group, Button } from '@&#8203;mantine/core';

function Demo() {
  const [favicon, setFavicon] = useState('https://mantine.dev/favicon.svg');
  const setTwitterFavicon = () => setFavicon('https://twitter.com/favicon.ico');
  const setMantineFavicon = () => setFavicon('https://mantine.dev/favicon.svg');

  useFavicon(favicon);

  return (
    <Group position="center">
      <Button onClick={setTwitterFavicon}>Twitter favicon</Button>
      <Button onClick={setMantineFavicon}>Mantine favicon</Button>
    </Group>
  );
}

Form index reference in validateInputOnBlur and validateInputOnChange

You can now use FORM_INDEX in use-form to validate nested array fields with validateInputOnBlur and validateInputOnChange settings:

import { useForm, FORM_INDEX } from '@&#8203;mantine/form';
import { NumberInput, TextInput, Button } from '@&#8203;mantine/core';

function Demo() {
  const form = useForm({
    validateInputOnChange: [
      'email',
      'name',
      // use FORM_INDEX to reference fields indices
      `jobs.${FORM_INDEX}.title`,
    ],
    initialValues: { name: '', email: '', age: 0, jobs: [{ title: '' }, { title: '' }] },

    // functions will be used to validate values at corresponding key
    validate: {
      name: (value) => (value.length < 2 ? 'Name must have at least 2 letters' : null),
      email: (value) => (/^\S+@&#8203;\S+$/.test(value) ? null : 'Invalid email'),
      age: (value) => (value < 18 ? 'You must be at least 18 to register' : null),
      jobs: {
        title: (value) => (value.length < 2 ? 'Job must have at least 2 letters' : null),
      },
    },
  });

  return (
    <form style={{ maxWidth: 320, margin: 'auto' }} onSubmit={form.onSubmit(console.log)}>
      <TextInput label="Name" placeholder="Name" {...form.getInputProps('name')} />
      <TextInput mt="sm" label="Email" placeholder="Email" {...form.getInputProps('email')} />
      <NumberInput
        mt="sm"
        label="Age"
        placeholder="Age"
        min={0}
        max={99}
        {...form.getInputProps('age')}
      />
      <TextInput
        mt="sm"
        label="Job 1"
        placeholder="Job 1"
        {...form.getInputProps('jobs.0.title')}
      />
      <TextInput
        mt="sm"
        label="Job 2"
        placeholder="Job 2"
        {...form.getInputProps('jobs.1.title')}
      />
      <Button type="submit" mt="sm">
        Submit
      </Button>
    </form>
  );
}

use-form transformValues

use-form now supports transformValues options, it transforms values before they get submitted in onSubmit handler.
For example, it can be used to merge several fields into one or to convert types:

import { useState } from 'react';
import { useForm } from '@&#8203;mantine/form';
import { TextInput, Button, Box, Code } from '@&#8203;mantine/core';

function Demo() {
  const [submittedValues, setSubmittedValues] = useState('');

  const form = useForm({
    initialValues: {
      firstName: 'Jane',
      lastName: 'Doe',
      age: '33',
    },

    transformValues: (values) => ({
      fullName: `${values.firstName} ${values.lastName}`,
      age: Number(values.age) || 0,
    }),
  });

  return (
    <Box sx={{ maxWidth: 400 }} mx="auto">
      <form
        onSubmit={form.onSubmit((values) => setSubmittedValues(JSON.stringify(values, null, 2)))}
      >
        <TextInput
          label="First name"
          placeholder="First name"
          {...form.getInputProps('firstName')}
        />
        <TextInput
          label="Last name"
          placeholder="Last name"
          mt="md"
          {...form.getInputProps('lastName')}
        />
        <TextInput
          type="number"
          label="Age"
          placeholder="Age"
          mt="md"
          {...form.getInputProps('age')}
        />
        <Button type="submit" mt="md">
          Submit
        </Button>
      </form>

      {submittedValues && <Code block>{submittedValues}</Code>}
    </Box>
  );
}

Other changes

New Contributors

Full Changelog: mantinedev/mantine@5.5.6...5.6.0

v5.5.6

Compare Source

What's Changed

  • [@mantine/core] Tooltip: Add position fallback to reduce position shift (#​2500)
  • [@mantine/dates] Remove obsolette props from Calendar and DatePicker components (#​2648, #​2714)
  • [@mantine/core] Image: Fix incorrect placeholder size calculation when width/height is not set (#​2675)
  • [@mantine/core] Popover: Fix issue when dropdown could be scrolled pass its target (#​2694)
  • [@mantine/core] Menu: Fix incorrect logic for controlled opened state (#​2701)
  • [@mantine/core] PasswordInput: Fix inputContainer and iconWidth props not working

New Contributors

Full Changelog: mantinedev/mantine@5.5.5...5.5.6

v5.5.5

Compare Source

What's Changed
  • [@mantine/core] NumberInput: Fix removeTrailingZeros prop not working for initial value (#​2638)
  • [@mantine/core] Modal: Fix issue when it was impossible to interact with scrollbars behind overlay (#​2669)
  • [@mantine/styles] Fix incorrect params handling in DefaultProps type in strict mode
  • [@mantine/core] Select: Fix component scrolling page when it is focused without any data or nothing found message (#​2628)
  • [@mantine/core] Fix Avatar and ThemeIcon components not respecting theme.defaultGradient (#​2649)
  • [@mantine/dates] Calendar: Fix error in console when up/down error is pressed and next/previous date is disabled
  • [@mantine/core] Menu: Close menu when target changes (#​2646)
  • [@mantine/hooks] use-focus-return: Add preventScroll: true to avoid scrolling to element when dropdown/modal is closed outside of current viewport
New Contributors

Full Changelog: mantinedev/mantine@5.5.4...5.5.5

v5.5.4

Compare Source

What was changed

  • [@mantine/core] ColorInput: Prevent dropdown from opening if withPicker={false} and there are no swatches
  • [@mantine/core] List: Fix styles params not being inherited by List.Item (#​2495)
  • [@mantine/core] Grid: Fix incorrect responsive offsets handling (#​2556)
  • [@mantine/core] Popover: Add option to configure focus returning logic with returnFocus prop
  • [@mantine/core] Popover: Fix onKeydownCapture prop overriding Escape key handler

Full Changelog: mantinedev/mantine@5.5.2...5.5.4

v5.5.2

Compare Source

What's Changed
  • [@mantine/core] List: Fix incorrect list items styles (#​2624)
  • [@mantine/core] NumberInput: Fix incorrect removeTrailingZeros default prop value (#​2621)
  • [@mantine/core] ScrollArea: Fix incorrect thumb hover area (#​2610)
  • [@mantine/hooks] use-focus-trap: Fix incorrect focus trapping logic when setRef is called with null (#​2623)
  • [@mantine/core] Fix incorrect cursor type on Checkbox, Radio and Switch when cursorType is set on theme
  • [@mantine/core] Remove unexpected styles from Checkbox, Radio and Switch components

Full Changelog: mantinedev/mantine@5.5.1...5.5.2

v5.5.1

Compare Source

What's Changed
  • [@mantine/core] Fix incorrect selectors used to style Radio, Checkbox and Switch components
  • [@mantine/core] Input: Fix size not being applied when set from error props and descriptionProps (#​2603)
  • [@mantine/core] Fix incorrect loading state styles in Button and ActionIcon components (#​2618)
  • [@mantine/core] Fix scrollbar appearing in Select, MultiSelect and Autocomplete dropdown when withNormalizeCSS and withGlobalStyles are not set on MantineProvider
  • [@mantine/core] Revert Collapse axis prop to avoid issues with regular Collapse
  • [@mantine/core] Fix missing font styles in Select, MultiSelect and Autocomplete dropdown when withGlobalStyles is not set on MantineProvider
  • [@mantine/core] MultiSelect: fix dropdown flicker and onDropdownClose/onDropdownOpen handlers being called when dropdown isn't visible (#​2602)
  • [@mantine/core] Select: Fix incorrect dropdown opened state when input is clicked (#​2605)
  • [@mantine/core] List: Fix incorrect indentation for nested list items (#​2606)
  • [@mantine/core] SegmentedControl: Fix error with hook call order (#​2608)
New Contributors

Full Changelog: mantinedev/mantine@5.5.0...5.5.1

v5.5.0

Compare Source

View changelog with demos on mantine.dev website

Global styles on theme

You can now add global styles with theme.globalStyles,
this way, you will be able to share these styles between different environments (for example, Next.js application and Storybook):

import { MantineProvider } from '@&#8203;mantine/core';

function Demo() {
  return (
    <MantineProvider
      theme={{
        globalStyles: (theme) => ({
          '*, *::before, *::after': {
            boxSizing: 'border-box',
          },

          body: {
            ...theme.fn.fontStyles(),
            backgroundColor: theme.colorScheme === 'dark' ? theme.colors.dark[7] : theme.white,
            color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.black,
            lineHeight: theme.lineHeight,
          },

          '.your-class': {
            backgroundColor: 'red',
          },

          '#your-id > [data-active]': {
            backgroundColor: 'pink',
          },
        }),
      }}
    >
      <App />
    </MantineProvider>
  );
}

form.setValues partial

form.setValues can now be used to set multiple values at once, payload will be shallow merged with current values state:

import { useForm } from '@&#8203;mantine/form';

const form = useForm({ initialValues: { name: '', email: '', age: 0 } });

form.setValues({ name: 'John', age: 21 });
form.values; // -> { name: 'John', email: '', age: 21 }

Documentation updates

Other changes

  • Checkbox indeterminate state now has separate styles for checked and unchecked states
  • Modal component now supports size="auto"
  • Checkbox, Radio and Switch
    components now support error, description and labelPosition props
  • Tooltip and Popover components now can be used with inline elements
  • Slider and RangeSlider components now support inverted prop
  • Collapse component now supports axis prop
  • Table component now supports withBorder and withColumnBorders props
  • NumberInput component now supports removeTrailingZeros prop
  • Popover and Menu components now support disabled prop
  • nprogress now supports new completeNavigationProgress handler

New Contributors


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about these updates again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot force-pushed the renovate/major-mantine-monorepo branch from 8cd2342 to 143ebc7 Compare December 10, 2022 08:37
@renovate renovate bot force-pushed the renovate/major-mantine-monorepo branch from 143ebc7 to 440437c Compare December 12, 2022 11:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

0 participants