feat(json-tree): expose searchInputProps for internal TextInput customization#21
Merged
Conversation
… search TextInput Adds the `searchInputProps` prop on JsonTree to fully customize the internal search bar via Mantine's native `classNames`, `styles`, `vars`, `variant`, `radius`, `size`, etc. — no specificity workarounds or `!important` required. The prop is spread before the controlled `value`/`onChange` (which remain owned by JsonTree) and before the Styles API `searchInput` selector, so consumers can override defaults but not break search. Closes #20
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the @gfazioli/mantine-json-tree JsonTree component API to allow consumers to customize the internal search TextInput by forwarding Mantine TextInput props, addressing styling limitations introduced with Mantine v9. It also updates tooling/dependencies (Yarn, Mantine, Storybook, etc.) and updates docs/demos/stories/tests to cover the new capability.
Changes:
- Add
searchInputProps?: TextInputPropstoJsonTreeand forward it to the internal search input. - Add tests + Storybook story + docs demo/section showcasing customized search input styling.
- Bump Yarn and several dependencies (including Mantine and Storybook) and update lockfile accordingly.
Reviewed changes
Copilot reviewed 9 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
package/src/JsonTree.tsx |
Adds searchInputProps to the component props and forwards it to the search TextInput. |
package/src/JsonTree.test.tsx |
Adds tests validating prop forwarding and that value/onChange remain controlled by JsonTree. |
package/src/JsonTree.story.tsx |
Adds a new story demonstrating custom search input styling via searchInputProps. |
docs/docs.mdx |
Documents how to customize the search input using searchInputProps. |
docs/demos/index.ts |
Exports the new searchInputStyling demo. |
docs/demos/JsonTree.demo.searchInputStyling.tsx |
Adds a new demo showing searchInputProps usage. |
package.json |
Updates Yarn version and dev dependencies (Mantine, Storybook, etc.). |
docs/package.json |
Updates docs-site Mantine deps and TypeScript version. |
.yarnrc.yml |
Points to Yarn 4.14.1 release file. |
yarn.lock |
Regenerates lockfile for updated toolchain/dependencies. |
- Type `searchInputProps` as `Omit<TextInputProps, 'value' | 'defaultValue' | 'onChange'>` to reflect the real contract: those are owned by JsonTree (use `searchQuery`/`onSearchChange` for controlled state).
- Merge consumer-provided `className`/`style` with the Styles API selector via `getStyles('searchInput', { className, style })` so both are preserved instead of overwritten.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
searchInputProps?: TextInputPropsonJsonTreeto forward props to the internal search<TextInput>.classNames,styles,vars,variant,radius,size, etc. — no specificity hacks or `!important` required.Also bumps yarn 4.13.0 → 4.14.1 and minor dep updates (Mantine 9.1.1, Storybook 10.3.6, oxlint, TypeScript) in a separate commit.
Closes #20
Test plan
Example
```tsx
<JsonTree
withSearch
searchInputProps={{
radius: 'xl',
variant: 'filled',
styles: {
input: { backgroundColor: 'var(--mantine-color-dark-7)' },
},
}}
/>
```