Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): update mantine monorepo to v7.15.1 - autoclosed #170

Closed
wants to merge 1 commit into from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Nov 12, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
@mantine/core (source) 7.14.3 -> 7.15.1 age adoption passing confidence
@mantine/dates (source) 7.14.3 -> 7.15.1 age adoption passing confidence
@mantine/form (source) 7.14.3 -> 7.15.1 age adoption passing confidence
@mantine/hooks (source) 7.14.3 -> 7.15.1 age adoption passing confidence
@mantine/notifications (source) 7.14.3 -> 7.15.1 age adoption passing confidence

Release Notes

mantinedev/mantine (@​mantine/core)

v7.15.1

Compare Source

What's Changed
  • [@mantine/dates] Improve focus behavior of DatePickerInput, DateInput and other components
  • [@mantine/form] Add touchTrigger option support
  • [@mantine/hooks] Add option to specify prefix in randonId function
  • [@mantine/core] Fix withProps function requiring all component props instead of partial
  • [@mantine/core] Add useModalStackContext and useDrawerStackContext hooks exports
  • [@mantine/core] ActionIcon: Add input-* autocomplete for size prop
  • [@mantine/core] AppShell: Fix incorrect default offsetScrollbars value for layout="alt"
  • [@mantine/core] Fix virtualColor function not working in server components (#​7184)
  • [@mantine/core] Checkbox: Fix incorrect Checkbox.Card behavior inside Checkbox.Group (#​7187)
  • [@mantine/core] Checkbox: Fix incorrect Checkbox.Card behavior inside Checkbox.Group (#​7187)
  • [@mantine/core] Slider: Add option to pass attributes down to thumb with thumbProps (#​7214)
  • [@mantine/core] Switch: Add data-checked attribute to the input (#​7228)
  • [@mantine/dates] Fix hasNextLevel prop type leak to DatePicker component (#​7229)
  • [@mantine/dates] Fix timezone not being applied to the formatted value (#​7162)
  • [@mantine/modals] Fix modalId being passed to the DOM node as attribute (#​7189)
  • [@mantine/core] TypographyStylesProvider: Fix incorrect paragraphs inside lists styles (#​7226)
  • [@mantine/core] Slider: Fix icon used as thumb child not being visible with the dark color scheme (#​7231, #​7232)
  • [@mantine/tiptap] Fix missing border in custom controls (#​7239)
New Contributors

Full Changelog: mantinedev/mantine@7.15.0...7.15.1

v7.15.0: 💋

Compare Source

View changelog with demos on mantine.dev website

Support Mantine development

You can now sponsor Mantine development with OpenCollective.
All funds will be used to improve Mantine and create new features and components.

use-radial-move hook

New use-radial-move hook can be used to create custom radial sliders:

import { useState } from 'react';
import { Box } from '@​mantine/core';
import { useRadialMove } from '@​mantine/hooks';
import classes from './Demo.module.css';

function Demo() {
  const [value, setValue] = useState(115);
  const { ref } = useRadialMove(setValue);

  return (
    <Box className={classes.root} ref={ref} style={{ '--angle': `${value}deg` }}>
      <div className={classes.value}>{value}°</div>
      <div className={classes.thumb} />
    </Box>
  );
}
BarChart color based on value

BarChart component now supports getBarColor prop to assign color based on value.
getBarColor function is called with two arguments: value and series object. It should return a color
string (theme color reference or any valid CSS color value).

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

function Demo() {
  return (
    <BarChart
      h={300}
      data={data}
      dataKey="month"
      getBarColor={(value) => (value > 700 ? 'teal.8' : 'red.8')}
      series={[{ name: 'Laptops', color: 'gray.6' }]}
    />
  );
}
Button.GroupSection and ActionIcon.GroupSection

ActionIcon.GroupSection and Button.GroupSection are new components that
can be used in ActionIcon.Group/Button.Group to create sections that are
not ActionIcon/Button components:

import { IconChevronDown, IconChevronUp } from '@&#8203;tabler/icons-react';
import { ActionIcon } from '@&#8203;mantine/core';
import { useCounter } from '@&#8203;mantine/hooks';

function Demo() {
  const [value, { increment, decrement }] = useCounter(135, { min: 0 });

  return (
    <ActionIcon.Group>
      <ActionIcon variant="default" size="lg" radius="md" onClick={decrement}>
        <IconChevronDown color="var(--mantine-color-red-text)" />
      </ActionIcon>
      <ActionIcon.GroupSection variant="default" size="lg" bg="var(--mantine-color-body)" miw={60}>
        {value}
      </ActionIcon.GroupSection>
      <ActionIcon variant="default" size="lg" radius="md" onClick={increment}>
        <IconChevronUp color="var(--mantine-color-teal-text)" />
      </ActionIcon>
    </ActionIcon.Group>
  );
}
Table vertical variant

Table component now support variant="vertical":

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

export function Demo() {
  return (
    <Table variant="vertical" layout="fixed" withTableBorder>
      <Table.Tbody>
        <Table.Tr>
          <Table.Th w={160}>Epic name</Table.Th>
          <Table.Td>7.x migration</Table.Td>
        </Table.Tr>

        <Table.Tr>
          <Table.Th>Status</Table.Th>
          <Table.Td>Open</Table.Td>
        </Table.Tr>

        <Table.Tr>
          <Table.Th>Total issues</Table.Th>
          <Table.Td>135</Table.Td>
        </Table.Tr>

        <Table.Tr>
          <Table.Th>Total story points</Table.Th>
          <Table.Td>874</Table.Td>
        </Table.Tr>

        <Table.Tr>
          <Table.Th>Last updated at</Table.Th>
          <Table.Td>September 26, 2024 17:41:26</Table.Td>
        </Table.Tr>
      </Table.Tbody>
    </Table>
  );
}
Table tabular numbers

Table component now supports tabularNums prop to render numbers in tabular style. It sets
font-variant-numeric: tabular-nums which makes numbers to have equal width.
This is useful when you have columns with numbers and you want them to be aligned:

import { NumberFormatter, Table } from '@&#8203;mantine/core';

const data = [
  { product: 'Apples', unitsSold: 2214411234 },
  { product: 'Oranges', unitsSold: 9983812411 },
  { product: 'Bananas', unitsSold: 1234567890 },
  { product: 'Pineapples', unitsSold: 9948810000 },
  { product: 'Pears', unitsSold: 9933771111 },
];

function Demo() {
  const rows = data.map((item) => (
    <Table.Tr key={item.product}>
      <Table.Td>{item.product}</Table.Td>
      <Table.Td>
        <NumberFormatter value={item.unitsSold} thousandSeparator />
      </Table.Td>
    </Table.Tr>
  ));

  return (
    <Table tabularNums>
      <Table.Thead>
        <Table.Tr>
          <Table.Th>Product</Table.Th>
          <Table.Th>Units sold</Table.Th>
        </Table.Tr>
      </Table.Thead>
      <Table.Tbody>{rows}</Table.Tbody>
    </Table>
  );
}
Update function in modals manager

Modals manager now supports modals.updateModal and modals.updateContextModal
function to update modal after it was opened:

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

function Demo() {
  return (
    <Button
      onClick={() => {
        const modalId = modals.open({
          title: 'Initial Modal Title',
          children: <Text>This text will update in 2 seconds.</Text>,
        });

        setTimeout(() => {
          modals.updateModal({
            modalId,
            title: 'Updated Modal Title',
            children: (
              <Text size="sm" c="dimmed">
                This is the updated content of the modal.
              </Text>
            ),
          });
        }, 2000);
      }}
    >
      Open updating modal
    </Button>
  );
}
useForm submitting state

use-form hook now supports form.submitting field
and form.setSubmitting function to track form submission state.

form.submitting field will be set to true if function passed to
form.onSubmit returns a promise. After the promise is resolved or rejected,
form.submitting will be set to false:

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

const asyncSubmit = (values: any) =>
  new Promise((resolve) => setTimeout(() => resolve(values), 3000));

function Demo() {
  const form = useForm({
    mode: 'uncontrolled',
    initialValues: { name: 'John' },
  });

  const [completed, setCompleted] = useState(false);

  const handleSubmit = async (values: typeof form.values) => {
    await asyncSubmit(values);
    setCompleted(true);
  };

  if (completed) {
    return (
      <Stack>
        <Text>Form submitted!</Text>
        <Button onClick={() => setCompleted(false)}>Reset to initial state</Button>
      </Stack>
    );
  }

  return (
    <form onSubmit={form.onSubmit(handleSubmit)}>
      <TextInput
        withAsterisk
        label="Name"
        placeholder="Your name"
        key={form.key('name')}
        disabled={form.submitting}
        {...form.getInputProps('name')}
      />

      <Group justify="flex-end" mt="md">
        <Button type="submit" loading={form.submitting}>
          Submit
        </Button>
      </Group>
    </form>
  );
}

You can also manually set form.submitting to true or false:

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

const form = useForm({ mode: 'uncontrolled' });
form.submitting; // -> false

form.setSubmitting(true);
form.submitting; // -> true

form.setSubmitting(false);
form.submitting; // -> false
useForm onSubmitPreventDefault option

use-form hook now supports onSubmitPreventDefault option.
This option is useful if you want to integrate useForm hook with server actions.
By default, event.preventDefault() is called on the form onSubmit handler.
If you want to change this behavior, you can pass onSubmitPreventDefault option
to useForm hook. It can have the following values:

  • always (default) - always call event.preventDefault()
  • never - never call event.preventDefault()
  • validation-failed - call event.preventDefault() only if validation failed
import { useForm } from '@&#8203;mantine/form';

const form = useForm({
  mode: 'uncontrolled',
  onSubmitPreventDefault: 'never',
});
Subtle RichTextEditor variant

RichTextEditor component now supports subtle variant:

import Highlight from '@&#8203;tiptap/extension-highlight';
import Underline from '@&#8203;tiptap/extension-underline';
import { useEditor } from '@&#8203;tiptap/react';
import StarterKit from '@&#8203;tiptap/starter-kit';
import { RichTextEditor } from '@&#8203;mantine/tiptap';

const content = '<p>Subtle rich text editor variant</p>';

function Demo() {
  const editor = useEditor({
    extensions: [StarterKit, Underline, Highlight],
    content,
  });

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

      <RichTextEditor.Content />
    </RichTextEditor>
  );
}
onExitTransitionEnd and onEnterTransitionEnd

Modal and Drawer components now support onExitTransitionEnd and onEnterTransitionEnd props,
which can be used to run code after exit/enter transition is finished. For example, this is useful when you want to clear
data after modal is closed:

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

function Demo() {
  const [firstOpened, firstHandlers] = useDisclosure(false);
  const [secondOpened, secondHandlers] = useDisclosure(false);
  const [modalData, setModalData] = useState({
    title: '',
    message: '',
  });

  return (
    <>
      <Modal
        opened={firstOpened}
        onClose={() => {
          firstHandlers.close();
          setModalData({ title: '', message: '' });
        }}
        title={modalData.title}
      >
        {modalData.message}
      </Modal>
      <Modal
        opened={secondOpened}
        onClose={secondHandlers.close}
        onExitTransitionEnd={() => setModalData({ title: '', message: '' })}
        title={modalData.title}
      >
        {modalData.message}
      </Modal>

      <Group>
        <Button
          onClick={() => {
            firstHandlers.open();
            setModalData({ title: 'Edit your profile', message: 'Imagine a form here' });
          }}
        >
          Clear data in onClose
        </Button>

        <Button
          onClick={() => {
            secondHandlers.open();
            setModalData({ title: 'Edit your profile', message: 'Imagine a form here' });
          }}
        >
          Clear data in onExitTransitionEnd
        </Button>
      </Group>
    </>
  );
}
Week numbers in DatePicker

DatePicker and other components based on Calendar component now support withWeekNumbers prop to display week numbers:

import { DatePicker } from '@&#8203;mantine/dates';

function Demo() {
  return <DatePicker withWeekNumbers />;
}
New demo: BarChart with overlay
import { BarChart } from '@&#8203;mantine/charts';
import { data } from './data';
import classes from './Demo.module.css';

function Demo() {
  const bigBarWidth = useMediaQuery('(min-width: 48em)') ? 42 : 26;
  const ratio = 0.5;
  const smallBarWidth = bigBarWidth * ratio;
  const barGap = (bigBarWidth + smallBarWidth) / -2;

  return (
    <BarChart
      h={300}
      data={overlayData}
      dataKey="index"
      barChartProps={{ barGap }}
      barProps={(data) => ({ barSize: data.name === 'you' ? bigBarWidth : smallBarWidth })}
      classNames={classes}
      series={[
        { name: 'you', color: 'var(--you-bar-color)' },
        { name: 'average', color: 'var(--average-bar-color)' },
      ]}
    />
  );
}
Variants types augmentation

Custom variants types augmentation guide was added to the documentation.

Example of adding custom variant type to Button component:

import { ButtonVariant, MantineSize } from '@&#8203;mantine/core';

type ExtendedButtonVariant = ButtonVariant | 'contrast' | 'radial-gradient';

declare module '@&#8203;mantine/core' {
  export interface ButtonProps {
    variant?: ExtendedButtonVariant;
  }
}
Help Center updates

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 was generated by Mend Renovate. View the repository job log.

Copy link

changeset-bot bot commented Nov 12, 2024

⚠️ No Changeset found

Latest commit: 2ecfbd3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 22.48%. Comparing base (d1deb84) to head (7b7523e).
Report is 44 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #170   +/-   ##
=======================================
  Coverage   22.48%   22.48%           
=======================================
  Files         107      107           
  Lines        2370     2370           
  Branches       86       87    +1     
=======================================
  Hits          533      533           
+ Misses       1793     1777   -16     
- Partials       44       60   +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@renovate renovate bot force-pushed the renovate/mantine-monorepo branch from e694c9a to 8d1249a Compare November 13, 2024 10:19
@renovate renovate bot changed the title fix(deps): update mantine monorepo to v7.14.0 fix(deps): update mantine monorepo to v7.14.1 Nov 16, 2024
@renovate renovate bot changed the title fix(deps): update mantine monorepo to v7.14.1 fix(deps): update mantine monorepo to v7.14.2 Nov 24, 2024
@renovate renovate bot changed the title fix(deps): update mantine monorepo to v7.14.2 fix(deps): update mantine monorepo to v7.14.3 Nov 28, 2024
@renovate renovate bot changed the title fix(deps): update mantine monorepo to v7.14.3 fix(deps): update mantine monorepo to v7.14.3 - autoclosed Dec 3, 2024
@renovate renovate bot closed this Dec 3, 2024
@renovate renovate bot deleted the renovate/mantine-monorepo branch December 3, 2024 13:40
@renovate renovate bot changed the title fix(deps): update mantine monorepo to v7.14.3 - autoclosed fix(deps): update mantine monorepo to v7.14.3 Dec 10, 2024
@renovate renovate bot reopened this Dec 10, 2024
@renovate renovate bot force-pushed the renovate/mantine-monorepo branch from 5cce13d to 8d1249a Compare December 10, 2024 11:08
@renovate renovate bot changed the title fix(deps): update mantine monorepo to v7.14.3 fix(deps): update mantine monorepo to v7.15.0 Dec 10, 2024
@renovate renovate bot force-pushed the renovate/mantine-monorepo branch from 8d1249a to 7b7523e Compare December 10, 2024 12:39
@renovate renovate bot changed the title fix(deps): update mantine monorepo to v7.15.0 fix(deps): update mantine monorepo to v7.15.0 - autoclosed Dec 10, 2024
@renovate renovate bot closed this Dec 10, 2024
@renovate renovate bot changed the title fix(deps): update mantine monorepo to v7.15.0 - autoclosed fix(deps): update mantine monorepo to v7.15.0 Dec 15, 2024
@renovate renovate bot reopened this Dec 15, 2024
@renovate renovate bot changed the title fix(deps): update mantine monorepo to v7.15.0 fix(deps): update mantine monorepo to v7.15.1 Dec 15, 2024
@renovate renovate bot force-pushed the renovate/mantine-monorepo branch 4 times, most recently from f5a669b to b2daa9c Compare December 17, 2024 10:38
@renovate renovate bot force-pushed the renovate/mantine-monorepo branch from b2daa9c to 2ecfbd3 Compare December 18, 2024 13:07
@renovate renovate bot changed the title fix(deps): update mantine monorepo to v7.15.1 fix(deps): update mantine monorepo to v7.15.1 - autoclosed Dec 23, 2024
@renovate renovate bot closed this Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants