@choice-ui/react 1.7.6 → 1.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/colors/dist/index.d.ts +878 -0
- package/dist/components/colors/scripts/build-worker.d.ts +1 -0
- package/dist/components/colors/src/check-color-contrast/check-color-contrast-boundary.d.ts +14 -0
- package/dist/components/colors/src/check-color-contrast/check-color-contrast-boundary.js +403 -0
- package/dist/components/colors/src/check-color-contrast/check-color-contrast-toolbar.d.ts +12 -0
- package/dist/components/colors/src/check-color-contrast/check-color-contrast-toolbar.js +285 -0
- package/dist/components/colors/src/check-color-contrast/index.d.ts +2 -0
- package/dist/components/colors/src/color-area/color-area.d.ts +24 -0
- package/dist/components/colors/src/color-area/color-area.js +228 -0
- package/dist/components/colors/src/color-area/index.d.ts +1 -0
- package/dist/components/colors/src/color-area/tv.d.ts +34 -0
- package/dist/components/colors/src/color-area/tv.js +22 -0
- package/dist/components/colors/src/color-channel-field/color-channel-field.d.ts +22 -0
- package/dist/components/colors/src/color-channel-field/color-channel-field.js +110 -0
- package/dist/components/colors/src/color-channel-field/color-channel-input.d.ts +20 -0
- package/dist/components/colors/src/color-channel-field/color-channel-input.js +261 -0
- package/dist/components/colors/src/color-channel-field/index.d.ts +1 -0
- package/dist/components/colors/src/color-channel-field/tv.d.ts +101 -0
- package/dist/components/colors/src/color-channel-field/tv.js +85 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradient-combined.d.ts +16 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradient-combined.js +54 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradient-control.d.ts +18 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradient-control.js +149 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradient-list.d.ts +20 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradient-list.js +111 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradient-slider.d.ts +18 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradient-slider.js +281 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradients-paint.d.ts +17 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradients-paint.js +162 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradients-toolbar.d.ts +10 -0
- package/dist/components/colors/src/color-gradients-paint/color-gradients-toolbar.js +62 -0
- package/dist/components/colors/src/color-gradients-paint/index.d.ts +3 -0
- package/dist/components/colors/src/color-image-paint/color-image-paint.d.ts +13 -0
- package/dist/components/colors/src/color-image-paint/color-image-paint.js +236 -0
- package/dist/components/colors/src/color-image-paint/color-image-toolbar.d.ts +9 -0
- package/dist/components/colors/src/color-image-paint/color-image-toolbar.js +52 -0
- package/dist/components/colors/src/color-image-paint/index.d.ts +1 -0
- package/dist/components/colors/src/color-image-paint/tv.d.ts +89 -0
- package/dist/components/colors/src/color-image-paint/tv.js +45 -0
- package/dist/components/colors/src/color-picker-content/color-picker-content.d.ts +18 -0
- package/dist/components/colors/src/color-picker-content/color-picker-content.js +58 -0
- package/dist/components/colors/src/color-picker-content/color-picker-custom-content.d.ts +16 -0
- package/dist/components/colors/src/color-picker-content/color-picker-custom-content.js +75 -0
- package/dist/components/colors/src/color-picker-content/index.d.ts +1 -0
- package/dist/components/colors/src/color-picker-content/paint-type-selector.d.ts +13 -0
- package/dist/components/colors/src/color-picker-content/paint-type-selector.js +50 -0
- package/dist/components/colors/src/color-picker-content/tv.d.ts +31 -0
- package/dist/components/colors/src/color-picker-content/tv.js +13 -0
- package/dist/components/colors/src/color-picker-popover/color-paints-type.d.ts +15 -0
- package/dist/components/colors/src/color-picker-popover/color-paints-type.js +56 -0
- package/dist/components/colors/src/color-picker-popover/color-picker-popover.d.ts +26 -0
- package/dist/components/colors/src/color-picker-popover/color-picker-popover.js +116 -0
- package/dist/components/colors/src/color-picker-popover/color-picker-tabs.d.ts +14 -0
- package/dist/components/colors/src/color-picker-popover/color-picker-tabs.js +47 -0
- package/dist/components/colors/src/color-picker-popover/color-picker-title.d.ts +14 -0
- package/dist/components/colors/src/color-picker-popover/color-picker-title.js +30 -0
- package/dist/components/colors/src/color-picker-popover/index.d.ts +3 -0
- package/dist/components/colors/src/color-picker-popover/tv.d.ts +37 -0
- package/dist/components/colors/src/color-slider/color-slider.d.ts +19 -0
- package/dist/components/colors/src/color-slider/color-slider.js +185 -0
- package/dist/components/colors/src/color-slider/index.d.ts +1 -0
- package/dist/components/colors/src/color-slider/tv.d.ts +31 -0
- package/dist/components/colors/src/color-slider/tv.js +21 -0
- package/dist/components/colors/src/color-solid-paint/color-native-picker.d.ts +8 -0
- package/dist/components/colors/src/color-solid-paint/color-native-picker.js +63 -0
- package/dist/components/colors/src/color-solid-paint/color-solid-paint.d.ts +25 -0
- package/dist/components/colors/src/color-solid-paint/color-solid-paint.js +295 -0
- package/dist/components/colors/src/color-solid-paint/index.d.ts +3 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-alpha-slider.d.ts +10 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-alpha-slider.js +20 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-area.d.ts +17 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-area.js +131 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-channel-field.d.ts +20 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-channel-field.js +147 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-hue-slider.d.ts +14 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-hue-slider.js +46 -0
- package/dist/components/colors/src/color-solid-paint/solid-paint-library-item.d.ts +8 -0
- package/dist/components/colors/src/color-solid-paint/tv.d.ts +79 -0
- package/dist/components/colors/src/color-solid-paint/tv.js +39 -0
- package/dist/components/colors/src/color-swatch/color-swatch.d.ts +15 -0
- package/dist/components/colors/src/color-swatch/color-swatch.js +111 -0
- package/dist/components/colors/src/color-swatch/index.d.ts +1 -0
- package/dist/components/colors/src/contents/color-space.d.ts +19 -0
- package/dist/components/colors/src/contents/color-space.js +16 -0
- package/dist/components/colors/src/contents/colors.d.ts +42 -0
- package/dist/components/colors/src/contents/colors.js +24 -0
- package/dist/components/colors/src/contents/index.d.ts +3 -0
- package/dist/components/colors/src/contents/translation.d.ts +100 -0
- package/dist/components/colors/src/contents/translation.js +94 -0
- package/dist/components/colors/src/context/colots-context.d.ts +24 -0
- package/dist/components/colors/src/context/colots-context.js +62 -0
- package/dist/components/colors/src/context/index.d.ts +1 -0
- package/dist/components/colors/src/fill-input/alpha-input.d.ts +12 -0
- package/dist/components/colors/src/fill-input/alpha-input.js +48 -0
- package/dist/components/colors/src/fill-input/color-input.d.ts +31 -0
- package/dist/components/colors/src/fill-input/color-input.js +115 -0
- package/dist/components/colors/src/fill-input/gradient-item.d.ts +25 -0
- package/dist/components/colors/src/fill-input/gradient-item.js +103 -0
- package/dist/components/colors/src/fill-input/image-item.d.ts +25 -0
- package/dist/components/colors/src/fill-input/image-item.js +89 -0
- package/dist/components/colors/src/fill-input/index.d.ts +5 -0
- package/dist/components/colors/src/fill-input/tv.d.ts +221 -0
- package/dist/components/colors/src/fill-input/tv.js +205 -0
- package/dist/components/colors/src/fill-input/variable-item.d.ts +22 -0
- package/dist/components/colors/src/fill-input/variable-item.js +105 -0
- package/dist/components/colors/src/hex-input/hex-input.d.ts +10 -0
- package/dist/components/colors/src/hex-input/hex-input.js +182 -0
- package/dist/components/colors/src/hex-input/index.d.ts +1 -0
- package/dist/components/colors/src/hex-input/tv.d.ts +1 -0
- package/dist/components/colors/src/hex-input/tv.js +12 -0
- package/dist/components/colors/src/hooks/index.d.ts +10 -0
- package/dist/components/colors/src/hooks/use-color-contrast-recommendation.d.ts +36 -0
- package/dist/components/colors/src/hooks/use-color-contrast-recommendation.js +502 -0
- package/dist/components/colors/src/hooks/use-color-parser.d.ts +10 -0
- package/dist/components/colors/src/hooks/use-color-parser.js +146 -0
- package/dist/components/colors/src/hooks/use-color-picker.d.ts +45 -0
- package/dist/components/colors/src/hooks/use-color-picker.js +117 -0
- package/dist/components/colors/src/hooks/use-color-profile.d.ts +2 -0
- package/dist/components/colors/src/hooks/use-color-profile.js +27 -0
- package/dist/components/colors/src/hooks/use-cursor.d.ts +1 -0
- package/dist/components/colors/src/hooks/use-cursor.js +25 -0
- package/dist/components/colors/src/hooks/use-features.d.ts +21 -0
- package/dist/components/colors/src/hooks/use-features.js +73 -0
- package/dist/components/colors/src/hooks/use-image-filter-style.d.ts +9 -0
- package/dist/components/colors/src/hooks/use-image-filter-style.js +25 -0
- package/dist/components/colors/src/hooks/use-image-processor.d.ts +10 -0
- package/dist/components/colors/src/hooks/use-image-processor.js +121 -0
- package/dist/components/colors/src/hooks/use-paint-state.d.ts +16 -0
- package/dist/components/colors/src/hooks/use-paint-state.js +37 -0
- package/dist/components/colors/src/hooks/use-rgb-color-handler.d.ts +21 -0
- package/dist/components/colors/src/hooks/use-rgb-color-handler.js +58 -0
- package/dist/components/colors/src/index.d.ts +38 -0
- package/dist/components/colors/src/libraries/components/virtualized-grid-row.d.ts +36 -0
- package/dist/components/colors/src/libraries/components/virtualized-grid-row.js +53 -0
- package/dist/components/colors/src/libraries/components/virtualized-header.d.ts +9 -0
- package/dist/components/colors/src/libraries/components/virtualized-header.js +30 -0
- package/dist/components/colors/src/libraries/hooks/index.d.ts +2 -0
- package/dist/components/colors/src/libraries/hooks/use-category-options.d.ts +11 -0
- package/dist/components/colors/src/libraries/hooks/use-category-options.js +27 -0
- package/dist/components/colors/src/libraries/hooks/use-palette-color.d.ts +19 -0
- package/dist/components/colors/src/libraries/hooks/use-palette-color.js +41 -0
- package/dist/components/colors/src/libraries/index.d.ts +8 -0
- package/dist/components/colors/src/libraries/libraries-content.d.ts +8 -0
- package/dist/components/colors/src/libraries/libraries-empty-content.d.ts +5 -0
- package/dist/components/colors/src/libraries/libraries-header.d.ts +18 -0
- package/dist/components/colors/src/libraries/libraries-header.js +111 -0
- package/dist/components/colors/src/libraries/libraries-search-empty-content.d.ts +1 -0
- package/dist/components/colors/src/libraries/libraries-search-input.d.ts +6 -0
- package/dist/components/colors/src/libraries/libraries.d.ts +42 -0
- package/dist/components/colors/src/libraries/libraries.js +461 -0
- package/dist/components/colors/src/libraries/library-color-swatch.d.ts +21 -0
- package/dist/components/colors/src/libraries/library-item/index.d.ts +4 -0
- package/dist/components/colors/src/libraries/library-item/library-item.d.ts +21 -0
- package/dist/components/colors/src/libraries/library-item/library-item.js +151 -0
- package/dist/components/colors/src/libraries/library-item/library-list-item.d.ts +6 -0
- package/dist/components/colors/src/libraries/library-item/style-items.d.ts +17 -0
- package/dist/components/colors/src/libraries/library-item/style-items.js +63 -0
- package/dist/components/colors/src/libraries/library-item/variable-items.d.ts +19 -0
- package/dist/components/colors/src/libraries/library-item/variable-items.js +47 -0
- package/dist/components/colors/src/libraries/tv.d.ts +198 -0
- package/dist/components/colors/src/libraries/tv.js +141 -0
- package/dist/components/colors/src/simple-color-picker/index.d.ts +1 -0
- package/dist/components/colors/src/simple-color-picker/simple-color-picker.d.ts +17 -0
- package/dist/components/colors/src/simple-color-picker/simple-color-picker.js +153 -0
- package/dist/components/colors/src/types/base.d.ts +5 -0
- package/dist/components/colors/src/types/colors.d.ts +139 -0
- package/dist/components/colors/src/types/effect.d.ts +18 -0
- package/dist/components/colors/src/types/fill.d.ts +15 -0
- package/dist/components/colors/src/types/fonts.d.ts +38 -0
- package/dist/components/colors/src/types/index.d.ts +7 -0
- package/dist/components/colors/src/types/libraries.d.ts +7 -0
- package/dist/components/colors/src/types/paint.d.ts +139 -0
- package/dist/components/colors/src/types/style.d.ts +51 -0
- package/dist/components/colors/src/types/testing-library.d.ts +0 -0
- package/dist/components/colors/src/types/util.d.ts +26 -0
- package/dist/components/colors/src/types/variable.d.ts +27 -0
- package/dist/components/colors/src/utils/background.d.ts +12 -0
- package/dist/components/colors/src/utils/background.js +216 -0
- package/dist/components/colors/src/utils/color-profile-storage.d.ts +29 -0
- package/dist/components/colors/src/utils/color.d.ts +20 -0
- package/dist/components/colors/src/utils/color.js +45 -0
- package/dist/components/colors/src/utils/colors-convert.d.ts +18 -0
- package/dist/components/colors/src/utils/colors-convert.js +138 -0
- package/dist/components/colors/src/utils/contrast-utils.d.ts +27 -0
- package/dist/components/colors/src/utils/contrast-utils.js +25 -0
- package/dist/components/colors/src/utils/cursor.d.ts +1 -0
- package/dist/components/colors/src/utils/index.d.ts +7 -0
- package/dist/components/colors/src/utils/math.d.ts +9 -0
- package/dist/components/colors/src/utils/position.d.ts +33 -0
- package/dist/components/colors/src/utils/position.js +60 -0
- package/dist/components/colors/src/utils/validate.d.ts +10 -0
- package/dist/components/colors/src/workers/boundary-calculator.worker.bundled.d.ts +2 -0
- package/dist/components/colors/src/workers/boundary-calculator.worker.bundled.js +36 -0
- package/dist/components/colors/src/workers/boundary-calculator.worker.d.ts +1 -0
- package/dist/components/colors/src/workers/index.d.ts +1 -0
- package/dist/components/colors/tsup.config.d.ts +2 -0
- package/dist/components/icon-button/src/icon-button.d.ts +1 -1
- package/dist/components/icon-button/src/tv.d.ts +9 -0
- package/dist/components/icon-button/src/tv.js +29 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/textarea/src/tv.d.ts +9 -3
- package/dist/components/textarea/src/tv.js +3 -1
- package/dist/components/toggle-button/dist/index.js +602 -0
- package/dist/index.js +69 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/index.js +119 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/Color.js +42 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/chroma.js +9 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/colors/colorbrewer.js +57 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/colors/w3cx11.js +159 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/average.js +82 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/bezier.js +68 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/blend.js +43 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/cubehelix.js +81 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/mix.js +20 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/random.js +13 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/generator/scale.js +325 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/_hsx.js +54 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hcg.js +10 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hsi.js +10 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hsl.js +10 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/hsv.js +10 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/index.js +4 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/lab.js +17 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/lch.js +11 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/lrgb.js +17 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/num.js +12 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/oklab.js +17 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/oklch.js +10 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/interpolator/rgb.js +16 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/cmyk/cmyk2rgb.js +20 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/cmyk/index.js +25 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/cmyk/rgb2cmyk.js +18 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/css2rgb.js +169 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/hsl2css.js +20 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/index.js +23 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/lab2css.js +19 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/lch2css.js +19 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/oklab2css.js +17 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/oklch2css.js +17 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/css/rgb2css.js +53 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/gl/index.js +21 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hcg/hcg2rgb.js +48 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hcg/index.js +25 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hcg/rgb2hcg.js +24 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hex/hex2rgb.js +37 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hex/index.js +23 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hex/rgb2hex.js +31 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsi/hsi2rgb.js +36 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsi/index.js +25 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsi/rgb2hsi.js +28 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsl/hsl2rgb.js +35 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsl/index.js +25 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsl/rgb2hsl.js +29 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsv/hsv2rgb.js +46 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsv/index.js +25 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/hsv/rgb2hsv.js +27 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/input.js +7 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/index.js +28 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/lab-constants.js +106 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/lab2rgb.js +59 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lab/rgb2lab.js +51 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/hcl2rgb.js +10 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/index.js +35 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/lab2lch.js +13 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/lch2lab.js +12 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/lch2rgb.js +14 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/lch/rgb2lch.js +13 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/named/index.js +26 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/num/index.js +23 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/num/num2rgb.js +13 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/num/rgb2num.js +9 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklab/index.js +25 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklab/oklab2rgb.js +31 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklab/rgb2oklab.js +30 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklch/index.js +25 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklch/oklch2rgb.js +14 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/oklch/rgb2oklch.js +13 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/rgb/index.js +34 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/temp/index.js +16 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/temp/rgb2temperature.js +25 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/io/temp/temperature2rgb.js +18 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/alpha.js +12 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/clipped.js +4 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/darken.js +14 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/get.js +12 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/luminance.js +38 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/mix.js +5 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/premultiply.js +11 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/saturate.js +13 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/set.js +42 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/ops/shade.js +9 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/analyze.js +161 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/clip_rgb.js +17 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/contrast.js +12 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/contrastAPCA.js +43 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/delta-e.js +48 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/distance.js +16 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/index.js +24 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/last.js +10 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/limit.js +7 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/multiply-matrices.js +29 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/scales.js +16 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/type.js +20 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/unpack.js +11 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/utils/valid.js +12 -0
- package/dist/node_modules/.pnpm/chroma-js@3.2.0/node_modules/chroma-js/src/version.js +4 -0
- package/dist/node_modules/.pnpm/fuse.js@7.1.0/node_modules/fuse.js/dist/fuse.js +1317 -0
- package/dist/styles/components.css +55 -0
- package/dist/tailwind.css +1 -0
- package/package.json +32 -20
- package/dist/components/virtual-select/dist/index.d.ts +0 -48
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "../../../button/dist/index.js";
|
|
3
|
+
import { Dropdown as Dropdown2 } from "../../../dropdown/dist/index.js";
|
|
4
|
+
import { IconButton } from "../../../icon-button/dist/index.js";
|
|
5
|
+
import { Popover } from "../../../popover/dist/index.js";
|
|
6
|
+
import { Tooltip } from "../../../tooltip/dist/index.js";
|
|
7
|
+
import { Check, InteractionNone, SystemPreferences } from "@choiceform/icons-react";
|
|
8
|
+
import { round } from "es-toolkit";
|
|
9
|
+
import { useState, useMemo } from "react";
|
|
10
|
+
import tinycolor from "tinycolor2";
|
|
11
|
+
import { getEffectiveElementType, calculateContrastRatio } from "../utils/contrast-utils.js";
|
|
12
|
+
import { getContrastThreshold } from "../utils/colors-convert.js";
|
|
13
|
+
import { tcx } from "../../../../shared/utils/tcx/tcx.js";
|
|
14
|
+
import { translation } from "../contents/translation.js";
|
|
15
|
+
import { ColorSwatch } from "../color-swatch/color-swatch.js";
|
|
16
|
+
const CheckColorContrastToolbar = (props) => {
|
|
17
|
+
const { className, checkColorContrast, onStandardHovered, applyRecommendedPoint, labels } = props;
|
|
18
|
+
const [showInfo, setShowInfo] = useState(false);
|
|
19
|
+
const colorInfo = useMemo(() => {
|
|
20
|
+
return {
|
|
21
|
+
bgColor: tinycolor(checkColorContrast == null ? void 0 : checkColorContrast.backgroundColor).toHex(),
|
|
22
|
+
fgColor: tinycolor(checkColorContrast == null ? void 0 : checkColorContrast.foregroundColor).toHex()
|
|
23
|
+
};
|
|
24
|
+
}, [checkColorContrast]);
|
|
25
|
+
const effectiveElementType = useMemo(
|
|
26
|
+
() => getEffectiveElementType(
|
|
27
|
+
checkColorContrast == null ? void 0 : checkColorContrast.category,
|
|
28
|
+
checkColorContrast == null ? void 0 : checkColorContrast.selectedElementType
|
|
29
|
+
),
|
|
30
|
+
[checkColorContrast == null ? void 0 : checkColorContrast.category, checkColorContrast == null ? void 0 : checkColorContrast.selectedElementType]
|
|
31
|
+
);
|
|
32
|
+
const { contrastRatio, meetsStandard } = useMemo(() => {
|
|
33
|
+
const ratio = calculateContrastRatio(
|
|
34
|
+
(checkColorContrast == null ? void 0 : checkColorContrast.backgroundColor) ?? { r: 255, g: 255, b: 255 },
|
|
35
|
+
(checkColorContrast == null ? void 0 : checkColorContrast.foregroundColor) ?? { r: 0, g: 0, b: 0 },
|
|
36
|
+
(checkColorContrast == null ? void 0 : checkColorContrast.foregroundAlpha) ?? 1
|
|
37
|
+
);
|
|
38
|
+
const threshold = getContrastThreshold(
|
|
39
|
+
checkColorContrast == null ? void 0 : checkColorContrast.level,
|
|
40
|
+
checkColorContrast == null ? void 0 : checkColorContrast.category,
|
|
41
|
+
effectiveElementType
|
|
42
|
+
);
|
|
43
|
+
const roundedRatio = round(ratio, 2);
|
|
44
|
+
return { contrastRatio: roundedRatio, meetsStandard: ratio >= threshold };
|
|
45
|
+
}, [
|
|
46
|
+
checkColorContrast == null ? void 0 : checkColorContrast.backgroundColor,
|
|
47
|
+
checkColorContrast == null ? void 0 : checkColorContrast.foregroundColor,
|
|
48
|
+
checkColorContrast == null ? void 0 : checkColorContrast.foregroundAlpha,
|
|
49
|
+
checkColorContrast == null ? void 0 : checkColorContrast.level,
|
|
50
|
+
checkColorContrast == null ? void 0 : checkColorContrast.category,
|
|
51
|
+
effectiveElementType
|
|
52
|
+
]);
|
|
53
|
+
const contrastInfo = (checkColorContrast == null ? void 0 : checkColorContrast.contrastInfo) !== void 0 ? checkColorContrast.contrastInfo : contrastRatio;
|
|
54
|
+
const getAADisplayText = () => {
|
|
55
|
+
if (effectiveElementType === "text") {
|
|
56
|
+
if ((checkColorContrast == null ? void 0 : checkColorContrast.category) === "large-text") {
|
|
57
|
+
return translation.colorContrast.level.AA.GRAPHICS;
|
|
58
|
+
} else {
|
|
59
|
+
return translation.colorContrast.level.AA.TEXT;
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
return translation.colorContrast.level.AA.GRAPHICS;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const getAAADisplayText = () => {
|
|
66
|
+
if (effectiveElementType === "text") {
|
|
67
|
+
if ((checkColorContrast == null ? void 0 : checkColorContrast.category) === "large-text") {
|
|
68
|
+
return translation.colorContrast.level.AAA.LARGE_TEXT;
|
|
69
|
+
} else {
|
|
70
|
+
return translation.colorContrast.level.AAA.TEXT;
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
return translation.colorContrast.level.AAA.GRAPHICS;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return /* @__PURE__ */ jsxs("div", { className: tcx("flex h-10 items-center gap-1 border-b px-2", className), children: [
|
|
77
|
+
/* @__PURE__ */ jsxs(
|
|
78
|
+
Popover,
|
|
79
|
+
{
|
|
80
|
+
open: showInfo,
|
|
81
|
+
onOpenChange: setShowInfo,
|
|
82
|
+
placement: "left-start",
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
|
85
|
+
Tooltip,
|
|
86
|
+
{
|
|
87
|
+
content: (labels == null ? void 0 : labels.viewColorValues) ?? translation.colorContrast.VIEW_COLOR_VALUES,
|
|
88
|
+
placement: "top",
|
|
89
|
+
children: /* @__PURE__ */ jsxs(
|
|
90
|
+
Button,
|
|
91
|
+
{
|
|
92
|
+
className: "px-1",
|
|
93
|
+
variant: "ghost",
|
|
94
|
+
active: showInfo,
|
|
95
|
+
onClick: () => setShowInfo(!showInfo),
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsx("div", { className: "border-default-boundary flex items-center justify-center rounded-full border", children: /* @__PURE__ */ jsx(
|
|
98
|
+
"svg",
|
|
99
|
+
{
|
|
100
|
+
width: "12",
|
|
101
|
+
height: "12",
|
|
102
|
+
viewBox: "0 0 12 12",
|
|
103
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
104
|
+
children: /* @__PURE__ */ jsxs("g", { children: [
|
|
105
|
+
/* @__PURE__ */ jsx(
|
|
106
|
+
"path",
|
|
107
|
+
{
|
|
108
|
+
d: "M6 12C9.31371 12 12 9.31371 12 6C12 2.68629 9.31371 0 6 0C2.68629 0 0 2.68629 0 6C0 9.31371 2.68629 12 6 12Z",
|
|
109
|
+
fill: `#${colorInfo.bgColor}`
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
"path",
|
|
114
|
+
{
|
|
115
|
+
d: "M6 10C7.06087 10 8.07828 9.57857 8.82843 8.82843C9.57857 8.07828 10 7.06087 10 6C10 4.93913 9.57857 3.92172 8.82843 3.17157C8.07828 2.42143 7.06087 2 6 2L6 6L6 10Z",
|
|
116
|
+
fill: `#${colorInfo.fgColor}`
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
] })
|
|
120
|
+
}
|
|
121
|
+
) }),
|
|
122
|
+
/* @__PURE__ */ jsx("span", { children: contrastInfo }),
|
|
123
|
+
/* @__PURE__ */ jsx("span", { className: "text-secondary-foreground", children: ": 1" })
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
) }),
|
|
129
|
+
/* @__PURE__ */ jsx(Popover.Content, { className: "flex flex-col gap-2 p-3", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-[1fr_auto] gap-3", children: [
|
|
130
|
+
/* @__PURE__ */ jsx("span", { className: "text-secondary-foreground", children: translation.colorContrast.BACKGROUND_COLOR }),
|
|
131
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
132
|
+
/* @__PURE__ */ jsx(
|
|
133
|
+
ColorSwatch,
|
|
134
|
+
{
|
|
135
|
+
color: checkColorContrast == null ? void 0 : checkColorContrast.backgroundColor,
|
|
136
|
+
className: "rounded-md",
|
|
137
|
+
size: 16
|
|
138
|
+
}
|
|
139
|
+
),
|
|
140
|
+
/* @__PURE__ */ jsx("span", { className: "uppercase", children: colorInfo.bgColor })
|
|
141
|
+
] }),
|
|
142
|
+
/* @__PURE__ */ jsx("span", { className: "text-secondary-foreground", children: translation.colorContrast.FOREGROUND_COLOR }),
|
|
143
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
144
|
+
/* @__PURE__ */ jsx(
|
|
145
|
+
ColorSwatch,
|
|
146
|
+
{
|
|
147
|
+
color: checkColorContrast == null ? void 0 : checkColorContrast.foregroundColor,
|
|
148
|
+
alpha: (checkColorContrast == null ? void 0 : checkColorContrast.foregroundAlpha) ?? 1,
|
|
149
|
+
className: "rounded-md",
|
|
150
|
+
size: 16
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ jsx("span", { className: "uppercase", children: colorInfo.fgColor })
|
|
154
|
+
] })
|
|
155
|
+
] }) })
|
|
156
|
+
]
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center justify-end gap-1", children: [
|
|
160
|
+
meetsStandard ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 border border-transparent px-1", children: [
|
|
161
|
+
/* @__PURE__ */ jsx(Check, {}),
|
|
162
|
+
/* @__PURE__ */ jsx("span", { className: "cursor-default", children: checkColorContrast == null ? void 0 : checkColorContrast.level })
|
|
163
|
+
] }) : /* @__PURE__ */ jsx(
|
|
164
|
+
Tooltip,
|
|
165
|
+
{
|
|
166
|
+
content: (labels == null ? void 0 : labels.notMeetStandard) ?? translation.colorContrast.NOT_MEET_STANDARD,
|
|
167
|
+
placement: "top",
|
|
168
|
+
children: /* @__PURE__ */ jsxs(
|
|
169
|
+
Button,
|
|
170
|
+
{
|
|
171
|
+
variant: "ghost",
|
|
172
|
+
className: "px-1",
|
|
173
|
+
onMouseEnter: () => onStandardHovered == null ? void 0 : onStandardHovered(true),
|
|
174
|
+
onMouseLeave: () => onStandardHovered == null ? void 0 : onStandardHovered(false),
|
|
175
|
+
onClick: applyRecommendedPoint,
|
|
176
|
+
children: [
|
|
177
|
+
/* @__PURE__ */ jsx(InteractionNone, {}),
|
|
178
|
+
/* @__PURE__ */ jsx("span", { children: checkColorContrast == null ? void 0 : checkColorContrast.level })
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
)
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
/* @__PURE__ */ jsxs(
|
|
185
|
+
Dropdown2,
|
|
186
|
+
{
|
|
187
|
+
disabledNested: true,
|
|
188
|
+
selection: true,
|
|
189
|
+
children: [
|
|
190
|
+
/* @__PURE__ */ jsx(Dropdown2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
191
|
+
IconButton,
|
|
192
|
+
{
|
|
193
|
+
tooltip: {
|
|
194
|
+
content: (labels == null ? void 0 : labels.contrastSettings) ?? translation.colorContrast.CONTRAST_SETTINGS,
|
|
195
|
+
placement: "top"
|
|
196
|
+
},
|
|
197
|
+
children: /* @__PURE__ */ jsx(SystemPreferences, {})
|
|
198
|
+
}
|
|
199
|
+
) }),
|
|
200
|
+
/* @__PURE__ */ jsxs(Dropdown2.Content, { children: [
|
|
201
|
+
/* @__PURE__ */ jsx(Dropdown2.Label, { children: translation.colorContrast.category.LABEL }),
|
|
202
|
+
/* @__PURE__ */ jsx(
|
|
203
|
+
Dropdown2.Item,
|
|
204
|
+
{
|
|
205
|
+
selected: (checkColorContrast == null ? void 0 : checkColorContrast.category) === "auto",
|
|
206
|
+
onMouseUp: () => {
|
|
207
|
+
var _a, _b;
|
|
208
|
+
(_a = checkColorContrast == null ? void 0 : checkColorContrast.handleCategoryChange) == null ? void 0 : _a.call(checkColorContrast, "auto");
|
|
209
|
+
if (((checkColorContrast == null ? void 0 : checkColorContrast.selectedElementType) ?? "graphics") === "graphics" && (checkColorContrast == null ? void 0 : checkColorContrast.level) === "AAA") {
|
|
210
|
+
(_b = checkColorContrast == null ? void 0 : checkColorContrast.handleLevelChange) == null ? void 0 : _b.call(checkColorContrast, "AA");
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
children: effectiveElementType === "text" ? translation.colorContrast.category.auto.TEXT : translation.colorContrast.category.auto.GRAPHICS
|
|
214
|
+
}
|
|
215
|
+
),
|
|
216
|
+
/* @__PURE__ */ jsx(
|
|
217
|
+
Dropdown2.Item,
|
|
218
|
+
{
|
|
219
|
+
selected: (checkColorContrast == null ? void 0 : checkColorContrast.category) === "large-text",
|
|
220
|
+
onMouseUp: () => {
|
|
221
|
+
var _a;
|
|
222
|
+
return (_a = checkColorContrast == null ? void 0 : checkColorContrast.handleCategoryChange) == null ? void 0 : _a.call(checkColorContrast, "large-text");
|
|
223
|
+
},
|
|
224
|
+
children: translation.colorContrast.category.LARGE_TEXT
|
|
225
|
+
}
|
|
226
|
+
),
|
|
227
|
+
/* @__PURE__ */ jsx(
|
|
228
|
+
Dropdown2.Item,
|
|
229
|
+
{
|
|
230
|
+
selected: (checkColorContrast == null ? void 0 : checkColorContrast.category) === "normal-text",
|
|
231
|
+
onMouseUp: () => {
|
|
232
|
+
var _a;
|
|
233
|
+
return (_a = checkColorContrast == null ? void 0 : checkColorContrast.handleCategoryChange) == null ? void 0 : _a.call(checkColorContrast, "normal-text");
|
|
234
|
+
},
|
|
235
|
+
children: translation.colorContrast.category.NORMAL_TEXT
|
|
236
|
+
}
|
|
237
|
+
),
|
|
238
|
+
/* @__PURE__ */ jsx(
|
|
239
|
+
Dropdown2.Item,
|
|
240
|
+
{
|
|
241
|
+
selected: (checkColorContrast == null ? void 0 : checkColorContrast.category) === "graphics",
|
|
242
|
+
onMouseUp: () => {
|
|
243
|
+
var _a, _b;
|
|
244
|
+
(_a = checkColorContrast == null ? void 0 : checkColorContrast.handleCategoryChange) == null ? void 0 : _a.call(checkColorContrast, "graphics");
|
|
245
|
+
if ((checkColorContrast == null ? void 0 : checkColorContrast.level) === "AAA") {
|
|
246
|
+
(_b = checkColorContrast == null ? void 0 : checkColorContrast.handleLevelChange) == null ? void 0 : _b.call(checkColorContrast, "AA");
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
children: translation.colorContrast.category.GRAPHICS
|
|
250
|
+
}
|
|
251
|
+
),
|
|
252
|
+
/* @__PURE__ */ jsx(Dropdown2.Label, { children: translation.colorContrast.level.LABEL }),
|
|
253
|
+
/* @__PURE__ */ jsx(
|
|
254
|
+
Dropdown2.Item,
|
|
255
|
+
{
|
|
256
|
+
selected: (checkColorContrast == null ? void 0 : checkColorContrast.level) === "AA",
|
|
257
|
+
onMouseUp: () => {
|
|
258
|
+
var _a;
|
|
259
|
+
return (_a = checkColorContrast == null ? void 0 : checkColorContrast.handleLevelChange) == null ? void 0 : _a.call(checkColorContrast, "AA");
|
|
260
|
+
},
|
|
261
|
+
children: getAADisplayText()
|
|
262
|
+
}
|
|
263
|
+
),
|
|
264
|
+
/* @__PURE__ */ jsx(
|
|
265
|
+
Dropdown2.Item,
|
|
266
|
+
{
|
|
267
|
+
disabled: effectiveElementType === "graphics",
|
|
268
|
+
selected: (checkColorContrast == null ? void 0 : checkColorContrast.level) === "AAA",
|
|
269
|
+
onMouseUp: () => {
|
|
270
|
+
var _a;
|
|
271
|
+
return (_a = checkColorContrast == null ? void 0 : checkColorContrast.handleLevelChange) == null ? void 0 : _a.call(checkColorContrast, "AAA");
|
|
272
|
+
},
|
|
273
|
+
children: getAAADisplayText()
|
|
274
|
+
}
|
|
275
|
+
)
|
|
276
|
+
] })
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
)
|
|
280
|
+
] })
|
|
281
|
+
] });
|
|
282
|
+
};
|
|
283
|
+
export {
|
|
284
|
+
CheckColorContrastToolbar
|
|
285
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PickerAreaType, RGB } from '../types';
|
|
2
|
+
interface Position {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
}
|
|
6
|
+
export interface ColorAreaProps {
|
|
7
|
+
areaSize?: {
|
|
8
|
+
height?: number;
|
|
9
|
+
width?: number;
|
|
10
|
+
};
|
|
11
|
+
children?: React.ReactNode;
|
|
12
|
+
className?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
hue?: number;
|
|
15
|
+
onChange?: (position: Position) => void;
|
|
16
|
+
onChangeEnd?: () => void;
|
|
17
|
+
onChangeStart?: () => void;
|
|
18
|
+
position: Position;
|
|
19
|
+
thumbColor?: RGB;
|
|
20
|
+
thumbSize?: number;
|
|
21
|
+
type: PickerAreaType;
|
|
22
|
+
}
|
|
23
|
+
export declare const ColorArea: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<ColorAreaProps & import('react').RefAttributes<HTMLDivElement>>>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clamp } from "es-toolkit";
|
|
3
|
+
import { memo, forwardRef, useRef, useMemo, useCallback, useEffect } from "react";
|
|
4
|
+
import tinycolor from "tinycolor2";
|
|
5
|
+
import { useEventCallback } from "usehooks-ts";
|
|
6
|
+
import { useColors } from "../context/colots-context.js";
|
|
7
|
+
import { ColorAreaTv } from "./tv.js";
|
|
8
|
+
import { getColorAreaBackground } from "../utils/background.js";
|
|
9
|
+
import { translation } from "../contents/translation.js";
|
|
10
|
+
import { tcx } from "../../../../shared/utils/tcx/tcx.js";
|
|
11
|
+
import { mergeRefs } from "../../../../shared/utils/merge-refs/merge-refs.js";
|
|
12
|
+
const KEYBOARD_STEPS = {
|
|
13
|
+
NORMAL: 0.01,
|
|
14
|
+
SHIFT: 0.1
|
|
15
|
+
};
|
|
16
|
+
const ColorArea = memo(
|
|
17
|
+
forwardRef(function ColorArea2(props, ref) {
|
|
18
|
+
const {
|
|
19
|
+
position,
|
|
20
|
+
onChange,
|
|
21
|
+
onChangeStart,
|
|
22
|
+
onChangeEnd,
|
|
23
|
+
type,
|
|
24
|
+
hue = 0,
|
|
25
|
+
thumbColor = { r: 0, g: 0, b: 0 },
|
|
26
|
+
disabled = false,
|
|
27
|
+
className,
|
|
28
|
+
areaSize = { width: 256, height: 192 },
|
|
29
|
+
thumbSize = 28,
|
|
30
|
+
children
|
|
31
|
+
} = props;
|
|
32
|
+
const { colorProfile } = useColors();
|
|
33
|
+
const areaRef = useRef(null);
|
|
34
|
+
const thumbRef = useRef(null);
|
|
35
|
+
const inputRef = useRef(null);
|
|
36
|
+
const isDragging = useRef(false);
|
|
37
|
+
const backgroundStyle = useMemo(
|
|
38
|
+
() => getColorAreaBackground(type, hue, colorProfile),
|
|
39
|
+
[type, hue, colorProfile]
|
|
40
|
+
);
|
|
41
|
+
const updatePosition = useEventCallback((clientX, clientY, isEnd) => {
|
|
42
|
+
var _a;
|
|
43
|
+
const rect = (_a = areaRef.current) == null ? void 0 : _a.getBoundingClientRect();
|
|
44
|
+
if (!rect) return;
|
|
45
|
+
const newPosition = {
|
|
46
|
+
x: clamp((clientX - rect.left) / rect.width, 0, 1),
|
|
47
|
+
y: clamp(1 - (clientY - rect.top) / rect.height, 0, 1)
|
|
48
|
+
};
|
|
49
|
+
if (isEnd) {
|
|
50
|
+
isDragging.current = false;
|
|
51
|
+
} else {
|
|
52
|
+
onChange == null ? void 0 : onChange(newPosition);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const setupPointerListeners = useCallback(
|
|
56
|
+
(thumb) => {
|
|
57
|
+
const handleMove = (e) => {
|
|
58
|
+
requestAnimationFrame(() => {
|
|
59
|
+
if (!isDragging.current) return;
|
|
60
|
+
e.preventDefault();
|
|
61
|
+
updatePosition(e.clientX, e.clientY);
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const handleUp = (e) => {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
if (thumb.hasPointerCapture(e.pointerId)) {
|
|
67
|
+
thumb.releasePointerCapture(e.pointerId);
|
|
68
|
+
}
|
|
69
|
+
updatePosition(e.clientX, e.clientY, true);
|
|
70
|
+
isDragging.current = false;
|
|
71
|
+
onChangeEnd == null ? void 0 : onChangeEnd();
|
|
72
|
+
window.removeEventListener("pointermove", handleMove);
|
|
73
|
+
window.removeEventListener("pointerup", handleUp);
|
|
74
|
+
window.removeEventListener("pointercancel", handleUp);
|
|
75
|
+
};
|
|
76
|
+
window.addEventListener("pointermove", handleMove);
|
|
77
|
+
window.addEventListener("pointerup", handleUp);
|
|
78
|
+
window.addEventListener("pointercancel", handleUp);
|
|
79
|
+
return () => {
|
|
80
|
+
window.removeEventListener("pointermove", handleMove);
|
|
81
|
+
window.removeEventListener("pointerup", handleUp);
|
|
82
|
+
window.removeEventListener("pointercancel", handleUp);
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
[onChangeEnd, updatePosition]
|
|
86
|
+
);
|
|
87
|
+
const handlePointerDown = useCallback(
|
|
88
|
+
(e) => {
|
|
89
|
+
var _a;
|
|
90
|
+
if (disabled) return;
|
|
91
|
+
e.preventDefault();
|
|
92
|
+
e.stopPropagation();
|
|
93
|
+
const thumb = thumbRef.current;
|
|
94
|
+
if (!thumb) return;
|
|
95
|
+
isDragging.current = true;
|
|
96
|
+
thumb.setPointerCapture(e.pointerId);
|
|
97
|
+
updatePosition(e.clientX, e.clientY);
|
|
98
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
99
|
+
setupPointerListeners(thumb);
|
|
100
|
+
},
|
|
101
|
+
[disabled, updatePosition, setupPointerListeners]
|
|
102
|
+
);
|
|
103
|
+
const handleAreaPointerDown = useCallback(
|
|
104
|
+
(e) => {
|
|
105
|
+
var _a;
|
|
106
|
+
if (disabled || e.target === thumbRef.current) return;
|
|
107
|
+
e.preventDefault();
|
|
108
|
+
const thumb = thumbRef.current;
|
|
109
|
+
if (!thumb) return;
|
|
110
|
+
onChangeStart == null ? void 0 : onChangeStart();
|
|
111
|
+
isDragging.current = true;
|
|
112
|
+
thumb.setPointerCapture(e.pointerId);
|
|
113
|
+
updatePosition(e.clientX, e.clientY);
|
|
114
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
115
|
+
setupPointerListeners(thumb);
|
|
116
|
+
},
|
|
117
|
+
[disabled, onChangeStart, updatePosition, setupPointerListeners]
|
|
118
|
+
);
|
|
119
|
+
const handleKeyDown = useEventCallback((e) => {
|
|
120
|
+
if (disabled) return;
|
|
121
|
+
const step = e.shiftKey ? KEYBOARD_STEPS.SHIFT : KEYBOARD_STEPS.NORMAL;
|
|
122
|
+
const { x, y } = position;
|
|
123
|
+
const keyboardActions = {
|
|
124
|
+
ArrowLeft: () => ({ x: x - step, y }),
|
|
125
|
+
ArrowRight: () => ({ x: x + step, y }),
|
|
126
|
+
ArrowUp: () => ({ x, y: y + step }),
|
|
127
|
+
ArrowDown: () => ({ x, y: y - step })
|
|
128
|
+
};
|
|
129
|
+
const action = keyboardActions[e.key];
|
|
130
|
+
if (!action) return;
|
|
131
|
+
e.preventDefault();
|
|
132
|
+
const newPosition = action();
|
|
133
|
+
const clampedPosition = {
|
|
134
|
+
x: clamp(newPosition.x, 0, 1),
|
|
135
|
+
y: clamp(newPosition.y, 0, 1)
|
|
136
|
+
};
|
|
137
|
+
if (clampedPosition.x !== x || clampedPosition.y !== y) {
|
|
138
|
+
onChange == null ? void 0 : onChange(clampedPosition);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
var _a;
|
|
143
|
+
if (disabled && document.activeElement === inputRef.current) {
|
|
144
|
+
(_a = inputRef.current) == null ? void 0 : _a.blur();
|
|
145
|
+
}
|
|
146
|
+
}, [disabled]);
|
|
147
|
+
const thumbStyle = useMemo(() => {
|
|
148
|
+
return {
|
|
149
|
+
width: thumbSize,
|
|
150
|
+
height: thumbSize,
|
|
151
|
+
transform: `
|
|
152
|
+
translate(
|
|
153
|
+
${position.x * ((areaSize == null ? void 0 : areaSize.width) ?? 0) - thumbSize / 2}px,
|
|
154
|
+
${(1 - position.y) * ((areaSize == null ? void 0 : areaSize.height) ?? 0) - thumbSize / 2}px)
|
|
155
|
+
`,
|
|
156
|
+
willChange: isDragging.current ? "transform" : "auto"
|
|
157
|
+
};
|
|
158
|
+
}, [position.x, position.y, areaSize, thumbSize]);
|
|
159
|
+
const gradientStyle = useMemo(
|
|
160
|
+
() => ({
|
|
161
|
+
forcedColorAdjust: "none",
|
|
162
|
+
width: areaSize.width,
|
|
163
|
+
height: areaSize.height,
|
|
164
|
+
...backgroundStyle
|
|
165
|
+
}),
|
|
166
|
+
[areaSize.width, areaSize.height, backgroundStyle]
|
|
167
|
+
);
|
|
168
|
+
const styles = ColorAreaTv({ disabled });
|
|
169
|
+
return /* @__PURE__ */ jsxs(
|
|
170
|
+
"div",
|
|
171
|
+
{
|
|
172
|
+
ref: mergeRefs(ref, areaRef),
|
|
173
|
+
onPointerDown: handleAreaPointerDown,
|
|
174
|
+
role: "presentation",
|
|
175
|
+
style: gradientStyle,
|
|
176
|
+
className: tcx(styles.root(), className),
|
|
177
|
+
children: [
|
|
178
|
+
/* @__PURE__ */ jsx(
|
|
179
|
+
"div",
|
|
180
|
+
{
|
|
181
|
+
ref: thumbRef,
|
|
182
|
+
onPointerDown: handlePointerDown,
|
|
183
|
+
className: styles.thumbWrapper(),
|
|
184
|
+
style: thumbStyle,
|
|
185
|
+
children: /* @__PURE__ */ jsx(
|
|
186
|
+
"div",
|
|
187
|
+
{
|
|
188
|
+
className: styles.thumb(),
|
|
189
|
+
style: {
|
|
190
|
+
width: thumbSize / 2,
|
|
191
|
+
height: thumbSize / 2,
|
|
192
|
+
backgroundColor: tinycolor({
|
|
193
|
+
r: thumbColor.r,
|
|
194
|
+
g: thumbColor.g,
|
|
195
|
+
b: thumbColor.b
|
|
196
|
+
}).toRgbString(),
|
|
197
|
+
boxShadow: `
|
|
198
|
+
inset 0 0 0 3px white,
|
|
199
|
+
inset 0 0 0 4px rgba(0,0,0,0.2),
|
|
200
|
+
0 0 0 1px rgba(0,0,0,0.2)
|
|
201
|
+
`
|
|
202
|
+
},
|
|
203
|
+
children: /* @__PURE__ */ jsx(
|
|
204
|
+
"input",
|
|
205
|
+
{
|
|
206
|
+
ref: inputRef,
|
|
207
|
+
type: "text",
|
|
208
|
+
onKeyDown: handleKeyDown,
|
|
209
|
+
className: styles.thumbInput(),
|
|
210
|
+
"aria-label": translation.area.ARIA_LABEL,
|
|
211
|
+
tabIndex: disabled ? -1 : 0,
|
|
212
|
+
readOnly: true
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
}
|
|
216
|
+
)
|
|
217
|
+
}
|
|
218
|
+
),
|
|
219
|
+
children
|
|
220
|
+
]
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
})
|
|
224
|
+
);
|
|
225
|
+
ColorArea.displayName = "ColorArea";
|
|
226
|
+
export {
|
|
227
|
+
ColorArea
|
|
228
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './color-area';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const ColorAreaTv: import('tailwind-variants').TVReturnType<{
|
|
2
|
+
disabled: {
|
|
3
|
+
true: {
|
|
4
|
+
root: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
}, {
|
|
8
|
+
root: string;
|
|
9
|
+
thumbWrapper: string;
|
|
10
|
+
thumb: string;
|
|
11
|
+
thumbInput: string;
|
|
12
|
+
}, undefined, {
|
|
13
|
+
disabled: {
|
|
14
|
+
true: {
|
|
15
|
+
root: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}, {
|
|
19
|
+
root: string;
|
|
20
|
+
thumbWrapper: string;
|
|
21
|
+
thumb: string;
|
|
22
|
+
thumbInput: string;
|
|
23
|
+
}, import('tailwind-variants').TVReturnType<{
|
|
24
|
+
disabled: {
|
|
25
|
+
true: {
|
|
26
|
+
root: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}, {
|
|
30
|
+
root: string;
|
|
31
|
+
thumbWrapper: string;
|
|
32
|
+
thumb: string;
|
|
33
|
+
thumbInput: string;
|
|
34
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { tcv } from "../../../../shared/utils/tcx/tcx.js";
|
|
2
|
+
const ColorAreaTv = tcv({
|
|
3
|
+
slots: {
|
|
4
|
+
root: "relative touch-none select-none",
|
|
5
|
+
thumbWrapper: "pointer-events-none relative z-2 box-border flex items-center justify-center",
|
|
6
|
+
thumb: "absolute origin-center rounded-full",
|
|
7
|
+
thumbInput: "absolute inset-0 cursor-default opacity-0"
|
|
8
|
+
},
|
|
9
|
+
variants: {
|
|
10
|
+
disabled: {
|
|
11
|
+
true: {
|
|
12
|
+
root: "saturate-0"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: {
|
|
17
|
+
disabled: false
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
export {
|
|
21
|
+
ColorAreaTv
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ChannelFieldFeature, ChannelFieldSpace, HSB, HSL, RGB } from '../types/colors';
|
|
2
|
+
import { ColorChannelLabels } from '../types/paint';
|
|
3
|
+
export interface ColorChannelFieldProps {
|
|
4
|
+
alpha?: number;
|
|
5
|
+
className?: string;
|
|
6
|
+
colorSpace?: ChannelFieldSpace;
|
|
7
|
+
defaultColorSpace?: ChannelFieldSpace;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
features?: ChannelFieldFeature;
|
|
10
|
+
hsb?: HSB;
|
|
11
|
+
hsl?: HSL;
|
|
12
|
+
labels?: ColorChannelLabels;
|
|
13
|
+
onAlphaChange?: (alpha: number) => void;
|
|
14
|
+
onAlphaChangeEnd?: () => void;
|
|
15
|
+
onAlphaChangeStart?: () => void;
|
|
16
|
+
onChangeColorSpace?: (colorSpace: ChannelFieldSpace) => void;
|
|
17
|
+
onHsbChange?: (hsb: HSB) => void;
|
|
18
|
+
onHslChange?: (hsl: HSL) => void;
|
|
19
|
+
onRgbChange?: (rgb: RGB) => void;
|
|
20
|
+
rgb?: RGB;
|
|
21
|
+
}
|
|
22
|
+
export declare const ColorChannelField: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<ColorChannelFieldProps & import('react').RefAttributes<HTMLDivElement>>>;
|