GithubHelp home page GithubHelp logo

mikbry / mui-color Goto Github PK

View Code? Open in Web Editor NEW
33.0 6.0 23.0 684 KB

Preview of Material-UI-color picker port to Mui v5

License: MIT License

JavaScript 99.91% HTML 0.09%
colorpicker react-color mui react

mui-color's Issues

Gives error of @material-ui/core error with new material-ui library in ColorPicker.js

Describe the bug
Gives error of @material-ui/core error with new material-ui library

To Reproduce
Steps to reproduce the behavior:

  1. Just use the newest version of Material UI
  2. It will produce an error and can be fixed by changing the material-ui/core/TextField imports to @mui/material/TextField
  3. You need to change the import in ColorPicker.js

Expected behavior
Error during debugging

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version 106.0.5249.103

wrong declaration name module in index.d.ts

Hello, thank you for this project and the migration to mui v5.

I use TypeScript and I have the following errors:

File '/home/.../node_modules/mui-color/index.d.ts' is not a module.

In file mui-color/src/types/index.d.ts

Solution :
// change this
declare module 'material-ui-color'
// to this
declare module 'mui-color'

thank you

Support for React 18

Is your feature request related to a problem? Please describe.
Support for React 18

Describe the solution you'd like
Support for React 18

There is a display problem at @mui/[email protected]

Versions

  • mui-color: 2.0.0-beta.2
  • @mui/material: 5.6.0
  • react: 18.0.0
  • @emotion/react: 11.9.0
  • @emotion/styled: 11.8.1
  • Edge Browser: 100.0.1185.29

Screenshots

image

But when I click anywhere on the UI it looks normal:

image

Codes

import React, { useState } from 'react'
import { colors } from '@mui/material'

export const colorMap: Record<string, string> = { }
for (const name in colors) if (name !== 'grey' && name !== 'blueGrey' && name !== 'common') colorMap[name] = colors[name][400]

const Comp = () => {
      const [color, setColor] = useState('#ffffff')
      return <ColorPicker
        deferred
        disableAlpha
        hideTextfield
        value={color}
        palette={colorMap}
        onChange={(color: any) => setColor('#' + color.hex)}
      />
}

I tried to delete all the above attributes, but I still couldn't solve it.

Other information

I noticed that nearly 30 style nodes are created each time picker is opened and closed, and will not be deleted.

image

image

Property 'hex' does not exist on type 'ColorValue'.

Version

typescript: 4.1.2
mui-color: 2.0.0-beta.2
@mui/material: 5.0.4
react: 17.0.2
@emotion/react: 11.5.0
@emotion/styled: 11.3.0

Issue

When trying to access to the hex value of a ColorValue inside of ColorPicker onChange event handler, typescript throw Property 'hex' does not exist on type 'ColorValue'.
Same issue for all the properties of ColorValue object.

Screenshot

Capture d’écran 2022-04-14 à 10 16 19

Workaround

<ColorPicker
    onChange={(e) => {
        const color = e as ColorObject;
        console.log(color.hex);
    }}
/>

Should the onChange handler argument type be ColorObject instead of ColorValue ?

A way to close ColorPicker upon selecting color

Hi!

It would be great to have a flag closeOnSelect or similar in ColorPicker so that when the flag is set - the picker popup would close upon selecting a color. Current behavior is annoying - user has to select a color and then click elsewhere to close the pop up.

Thanks!

Tooltip is not working

Hi!
Thats how I use component now
<ColorPicker key={el.id} id={el.id} tooltip: "check" value={accordionColor} hideTextfield onChange={(event) => setAccordionColor(event)} />

But the problem is that tooltip is not showing up

How to use it?

Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.