From e70cd1dcea86844abc26370962e7ec899d96e885 Mon Sep 17 00:00:00 2001 From: Benjamin Arias Date: Tue, 6 Dec 2022 10:37:09 +0100 Subject: [PATCH] Remplace le colorpicker actuel par une version accessible (#2409) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Ajoute ColorPicker + cache la barre d'opacité * fix: Essai fix stopPropagation * chore: Retire code inutile * chore: Ajoute lien vers l'issue --- site/package.json | 1 + site/source/design-system/global-style.ts | 13 +++++++++++++ site/source/pages/Dev/IntegrationTest.tsx | 8 ++++++-- site/source/pages/integration/Iframe.tsx | 12 ++++++++++-- yarn.lock | 21 +++++++++++++++++++++ 5 files changed, 51 insertions(+), 4 deletions(-) diff --git a/site/package.json b/site/package.json index b61579525..4039d3fdc 100644 --- a/site/package.json +++ b/site/package.json @@ -48,6 +48,7 @@ "build:storybook": "NODE_OPTIONS=--openssl-legacy-provider build-storybook" }, "dependencies": { + "@atomik-color/component": "^1.0.16", "@axe-core/react": "^4.5.2", "@internationalized/number": "^3.1.1", "@react-aria/accordion": "^3.0.0-alpha.13", diff --git a/site/source/design-system/global-style.ts b/site/source/design-system/global-style.ts index 56855f650..6cd56a838 100644 --- a/site/source/design-system/global-style.ts +++ b/site/source/design-system/global-style.ts @@ -203,4 +203,17 @@ figure { font-size: 0.9rem; } } + +// Cache le slider opacité du ColorPicker +#color-rectangle1 + div { + &:first-child { + align-items: center; + } + & div[aria-label='Hue slider'] { + margin-bottom: 0!important; + } + & div[aria-label='Alpha slider'] { + display: none; + } +} ` diff --git a/site/source/pages/Dev/IntegrationTest.tsx b/site/source/pages/Dev/IntegrationTest.tsx index 2b623e181..23502ba88 100644 --- a/site/source/pages/Dev/IntegrationTest.tsx +++ b/site/source/pages/Dev/IntegrationTest.tsx @@ -1,5 +1,6 @@ +import ColorPicker from '@atomik-color/component' +import { str2Color } from '@atomik-color/core' import { useEffect, useMemo, useRef, useState } from 'react' -import { HexColorPicker } from 'react-colorful' import { Button } from '@/design-system/buttons' import { H2 } from '@/design-system/typography/heading' @@ -44,7 +45,10 @@ export default function IntegrationTest() {

Quelle couleur ?

- + setColor(`#${hex}`)} + />