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

[@mantine/core] Tree: Add optional initialCheckedState property #6697

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

fredgig
Copy link
Contributor

@fredgig fredgig commented Aug 19, 2024

Motivation: This PR aims to add an optional initialCheckedState prop to useTree, akin to initialExpandedState and initialSelectedState, which addresses #6641.

  • Adds initialCheckedState property to useTree hook;
  • Adds default property to checkedState hook;
  • Renames internal getInitialState function to getInitialExpandedState;
  • Adds internal getInitialCheckedState function: This takes the current tree checkedState and ensures only leaf nodes are present, which allows users to input parent nodes in the initialCheckedState property as it outputs their leaf nodes;
  • Adds setCheckedState instruction and dependency to initialize callback to update checkedState with behaviour indicated in previous point.

@fredgig fredgig requested a review from rtivital August 19, 2024 18:31
@rtivital rtivital merged commit f24ad86 into mantinedev:master Aug 26, 2024
1 check passed
@rtivital
Copy link
Member

Thanks!

davydkov referenced this pull request in likec4/likec4 Sep 12, 2024
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@mantine/core](https://mantine.dev/)
([source](https://redirect.github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/core))
| [`^7.12.0` ->
`^7.12.2`](https://renovatebot.com/diffs/npm/@mantine%2fcore/7.12.0/7.12.2)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@mantine%2fcore/7.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@mantine%2fcore/7.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@mantine%2fcore/7.12.0/7.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@mantine%2fcore/7.12.0/7.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [@mantine/hooks](https://mantine.dev)
([source](https://redirect.github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/hooks))
| [`^7.12.0` ->
`^7.12.2`](https://renovatebot.com/diffs/npm/@mantine%2fhooks/7.12.0/7.12.2)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@mantine%2fhooks/7.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@mantine%2fhooks/7.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@mantine%2fhooks/7.12.0/7.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@mantine%2fhooks/7.12.0/7.12.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>mantinedev/mantine (@&#8203;mantine/core)</summary>

###
[`v7.12.2`](https://redirect.github.com/mantinedev/mantine/releases/tag/7.12.2)

[Compare
Source](https://redirect.github.com/mantinedev/mantine/compare/7.12.1...7.12.2)

##### What's Changed

- `[@mantine/hooks]` use-idle: Fix idle countdown not starting if the
user did non interact with the page
([#&#8203;6683](https://redirect.github.com/mantinedev/mantine/issues/6683))
- `[@mantine/core]` ScrollArea: Fix `onBottomReached` prop not being
available in `ScrollArea.Autosize` component
- `[@mantine/core]` Remove `children` from Checkbox, Radio and Switch
types to avoid accidental errors
- `[@mantine/core]` TypographyStylesProvider: Fix incorrect table styles
in dark color scheme
- `[@mantine/form]` Fix error thrown for nullable values dirty status
check
([#&#8203;6672](https://redirect.github.com/mantinedev/mantine/issues/6672))
- `[@mantine/core]` Badge: Fix unexpected change to block layout, fix
incorrect alignment when fixed width is set
([#&#8203;6698](https://redirect.github.com/mantinedev/mantine/issues/6698),
[#&#8203;6680](https://redirect.github.com/mantinedev/mantine/issues/6680))
- `[@mantine/core]` ScrollArea: Fix pointer-events being left as `none`
after interaction with scrollbar
([#&#8203;6681](https://redirect.github.com/mantinedev/mantine/issues/6681))
- `[@mantine/core]` Tabs: Fix `keepMounted` prop being added as
attribute to `Tabs.Panel` DOM element
([#&#8203;6711](https://redirect.github.com/mantinedev/mantine/issues/6711))
- `[@mantine/core]` Tree: Add `initialCheckedState` support
([#&#8203;6697](https://redirect.github.com/mantinedev/mantine/issues/6697))
- `[@mantine/spotlight]` Fix `SpotlightRoot` component not being
exported
([#&#8203;6710](https://redirect.github.com/mantinedev/mantine/issues/6710))
- `[@mantine/dropzone]` Add `7z` and `rar` mime types exports
([#&#8203;6702](https://redirect.github.com/mantinedev/mantine/issues/6702))
- `[@mantine/dates]` DatePickerInput: Fix incorrect hovered date logic
when the component receives value update with partial selected date
range
([#&#8203;6718](https://redirect.github.com/mantinedev/mantine/issues/6718))
- `[@mantine/dates]` Fix `valueFormatter` prop being added to
DateTimePicker types
- `[@mantine/core]` Badge: Fix right/left sections height affecting the
alignment of the label
- `[@mantine/core]` Menu: Fix accessibility warning in devtools when the
Menu is opened
([#&#8203;6644](https://redirect.github.com/mantinedev/mantine/issues/6644))

##### New Contributors

- [@&#8203;timesince](https://redirect.github.com/timesince) made their
first contribution in
[https://github.com/mantinedev/mantine/pull/6654](https://redirect.github.com/mantinedev/mantine/pull/6654)
- [@&#8203;tokyojack](https://redirect.github.com/tokyojack) made their
first contribution in
[https://github.com/mantinedev/mantine/pull/6718](https://redirect.github.com/mantinedev/mantine/pull/6718)
- [@&#8203;Streusel](https://redirect.github.com/Streusel) made their
first contribution in
[https://github.com/mantinedev/mantine/pull/6702](https://redirect.github.com/mantinedev/mantine/pull/6702)
- [@&#8203;fredgig](https://redirect.github.com/fredgig) made their
first contribution in
[https://github.com/mantinedev/mantine/pull/6697](https://redirect.github.com/mantinedev/mantine/pull/6697)
- [@&#8203;chimericdream](https://redirect.github.com/chimericdream)
made their first contribution in
[https://github.com/mantinedev/mantine/pull/6683](https://redirect.github.com/mantinedev/mantine/pull/6683)
- [@&#8203;Aybrea](https://redirect.github.com/Aybrea) made their first
contribution in
[https://github.com/mantinedev/mantine/pull/6724](https://redirect.github.com/mantinedev/mantine/pull/6724)

**Full Changelog**:
mantinedev/mantine@7.12.1...7.12.2

###
[`v7.12.1`](https://redirect.github.com/mantinedev/mantine/releases/tag/7.12.1)

[Compare
Source](https://redirect.github.com/mantinedev/mantine/compare/7.12.0...7.12.1)

##### What's Changed

- `[@mantine/dates]` DateInput: Fix default date being set to the
current date when `minDate` is set to the future
([#&#8203;6646](https://redirect.github.com/mantinedev/mantine/issues/6646))
-   `[@mantine/core]` ScrollArea: Fix incorrect thumb::before styles
- `[@mantine/core]` Fix incorrect active styles of buttons used inside
disabled fieldset
- `[@mantine/form]` Fix `form.watch` callbacks not being fired when
`form.initialize` is called
([#&#8203;6639](https://redirect.github.com/mantinedev/mantine/issues/6639))
- `[@mantine/core]` Switch: Fix Switch shrinking when large label or
description is used
([#&#8203;6531](https://redirect.github.com/mantinedev/mantine/issues/6531))
- `[@mantine/core]` Combobox: Fix `Combobox.Search` overflow when
`ScrollArea` is used in the dropdown
([#&#8203;6562](https://redirect.github.com/mantinedev/mantine/issues/6562))
- `[@mantine/core]` Accordion: Add missing `withProps` function
([#&#8203;6564](https://redirect.github.com/mantinedev/mantine/issues/6564))
- `[@mantine/core]` Pill: Fix remove icon overflowing pill container if
its background color was changed with Styles API
([#&#8203;6565](https://redirect.github.com/mantinedev/mantine/issues/6565))
- `[@mantine/core]` PinInput: Allow passing props to individual input
elements depending on index with `getInputProps`
([#&#8203;6588](https://redirect.github.com/mantinedev/mantine/issues/6588))
- `[@mantine/charts]`: Fix LineChart Legend and Tooltip to support
nested names
([#&#8203;6536](https://redirect.github.com/mantinedev/mantine/issues/6536))
- `[@mantine/core]` Tooltip: Add missing `Tooltip.Group.extend` function
([#&#8203;6576](https://redirect.github.com/mantinedev/mantine/issues/6576))
- `[@mantine/spotlight]` Fix `limit` prop not working correctly with
actions groups
([#&#8203;6632](https://redirect.github.com/mantinedev/mantine/issues/6632))
- `[@mantine/core]` Badge: Fix text overflow not being handled correctly
([#&#8203;6629](https://redirect.github.com/mantinedev/mantine/issues/6629))
- `[@mantine/core]` SegmentedControl: Add `data-disabled` attribute to
the root element to simplify styling with Styles API
([#&#8203;6625](https://redirect.github.com/mantinedev/mantine/issues/6625))
- `[@mantine/core]` SegmentedControl: Fix initial position of indicator
being broken when the component is used inside other element that has
transitions on mount
([#&#8203;6622](https://redirect.github.com/mantinedev/mantine/issues/6622))
- `[@mantine/core]` TagsInput: Fix `onKeyDown` prop not working
([#&#8203;6569](https://redirect.github.com/mantinedev/mantine/issues/6569))
- `[@mantine/charts]` PieChart: Fix `valueFormatter` not working on
outside labels
([#&#8203;6616](https://redirect.github.com/mantinedev/mantine/issues/6616))
- `[@mantine/core]` Popover: Fix `apply` function of `size` middleware
not being handled correctly
([#&#8203;6598](https://redirect.github.com/mantinedev/mantine/issues/6598))
- `[@mantine/core]` Chip: Fix incorrect checked padding for `size="xl"`
([#&#8203;6586](https://redirect.github.com/mantinedev/mantine/issues/6586))
- `[@mantine/dates]` TimeInput: Fix incorrect focus styles of am/pm
input
([#&#8203;6579](https://redirect.github.com/mantinedev/mantine/issues/6579))
- `[@mantine/hook]` use-os: Fix incorrect iPadOS detection
([#&#8203;6535](https://redirect.github.com/mantinedev/mantine/issues/6535))
- `[@mantine/core]` DatePickerInput: Fix incorrect `aria-label` being
set on the input element
([#&#8203;6530](https://redirect.github.com/mantinedev/mantine/issues/6530))
- `[@mantine/core]` Menu: Fix incorrect Escape key handling inside Modal
([#&#8203;6580](https://redirect.github.com/mantinedev/mantine/issues/6580))

##### New Contributors

- [@&#8203;vorant94](https://redirect.github.com/vorant94) made their
first contribution in
[https://github.com/mantinedev/mantine/pull/6530](https://redirect.github.com/mantinedev/mantine/pull/6530)
- [@&#8203;hajimism](https://redirect.github.com/hajimism) made their
first contribution in
[https://github.com/mantinedev/mantine/pull/6539](https://redirect.github.com/mantinedev/mantine/pull/6539)
- [@&#8203;ziimakc](https://redirect.github.com/ziimakc) made their
first contribution in
[https://github.com/mantinedev/mantine/pull/6561](https://redirect.github.com/mantinedev/mantine/pull/6561)
- [@&#8203;th3fallen](https://redirect.github.com/th3fallen) made their
first contribution in
[https://github.com/mantinedev/mantine/pull/6579](https://redirect.github.com/mantinedev/mantine/pull/6579)
- [@&#8203;david-szabo97](https://redirect.github.com/david-szabo97)
made their first contribution in
[https://github.com/mantinedev/mantine/pull/6586](https://redirect.github.com/mantinedev/mantine/pull/6586)
- [@&#8203;bastiankistner](https://redirect.github.com/bastiankistner)
made their first contribution in
[https://github.com/mantinedev/mantine/pull/6607](https://redirect.github.com/mantinedev/mantine/pull/6607)
- [@&#8203;inx-fldu](https://redirect.github.com/inx-fldu) made their
first contribution in
[https://github.com/mantinedev/mantine/pull/6569](https://redirect.github.com/mantinedev/mantine/pull/6569)
- [@&#8203;michaelperros](https://redirect.github.com/michaelperros)
made their first contribution in
[https://github.com/mantinedev/mantine/pull/6622](https://redirect.github.com/mantinedev/mantine/pull/6622)
- [@&#8203;risen228](https://redirect.github.com/risen228) made their
first contribution in
[https://github.com/mantinedev/mantine/pull/6625](https://redirect.github.com/mantinedev/mantine/pull/6625)
- [@&#8203;ddoemonn](https://redirect.github.com/ddoemonn) made their
first contribution in
[https://github.com/mantinedev/mantine/pull/6629](https://redirect.github.com/mantinedev/mantine/pull/6629)
- [@&#8203;yorkeJohn](https://redirect.github.com/yorkeJohn) made their
first contribution in
[https://github.com/mantinedev/mantine/pull/6632](https://redirect.github.com/mantinedev/mantine/pull/6632)
- [@&#8203;raulfpl](https://redirect.github.com/raulfpl) made their
first contribution in
[https://github.com/mantinedev/mantine/pull/6639](https://redirect.github.com/mantinedev/mantine/pull/6639)
- [@&#8203;uriFrischman](https://redirect.github.com/uriFrischman) made
their first contribution in
[https://github.com/mantinedev/mantine/pull/6645](https://redirect.github.com/mantinedev/mantine/pull/6645)

**Full Changelog**:
mantinedev/mantine@7.12.0...7.12.1

</details>

---

### 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.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/likec4/likec4).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC43NC4xIiwidXBkYXRlZEluVmVyIjoiMzguNzQuMSIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiZGVwZW5kZW5jaWVzIl19-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

2 participants