@choice-ui/react 1.7.5 → 1.7.7
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/comments/dist/index.d.ts +3 -0
- package/dist/components/comments/src/comment-input/comment-input.d.ts +3 -0
- package/dist/components/comments/src/comment-input/comment-input.js +8 -2
- package/dist/components/comments/src/comment-input/components/comment-input-footer.d.ts +3 -0
- package/dist/components/comments/src/comment-input/components/comment-input-footer.js +10 -9
- package/dist/components/comments/src/comment-input/components/comment-input-renderers.js +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/modal/dist/index.js +1 -2
- package/dist/components/modal/src/tv.js +1 -2
- package/dist/components/numeric-input/dist/index.js +3 -4
- package/dist/components/numeric-input/src/tv.js +3 -4
- package/dist/components/otp-input/src/tv.js +1 -2
- package/dist/components/panel/src/tv.js +15 -16
- package/dist/components/skeleton/src/tv.js +1 -2
- package/dist/components/text-field/dist/index.js +1 -2
- package/dist/components/text-field/src/tv.js +1 -2
- 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 +226 -0
- package/dist/tailwind.css +1 -0
- package/package.json +32 -20
- package/dist/components/modal/src/styles/style.module.css +0 -4
- package/dist/components/modal/src/styles/style.module.css.js +0 -8
- package/dist/components/numeric-input/src/styles/style.module.css +0 -45
- package/dist/components/numeric-input/src/styles/style.module.css.js +0 -12
- package/dist/components/otp-input/src/styles/style.module.css +0 -15
- package/dist/components/otp-input/src/styles/style.module.css.js +0 -8
- package/dist/components/panel/src/styles/style.module.css +0 -103
- package/dist/components/panel/src/styles/style.module.css.js +0 -23
- package/dist/components/skeleton/src/styles/style.module.css +0 -18
- package/dist/components/skeleton/src/styles/style.module.css.js +0 -8
- package/dist/components/text-field/src/styles/style.module.css +0 -31
- package/dist/components/text-field/src/styles/style.module.css.js +0 -8
- package/dist/components/virtual-select/dist/index.d.ts +0 -48
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useState, useMemo, useRef } from "react";
|
|
3
|
+
import { useEventCallback } from "usehooks-ts";
|
|
4
|
+
import { ColorGradientCombined } from "./color-gradient-combined.js";
|
|
5
|
+
import { ColorGradientsToolbar } from "./color-gradients-toolbar.js";
|
|
6
|
+
import { ColorPickerPopover } from "../color-picker-popover/color-picker-popover.js";
|
|
7
|
+
import { ColorSolidPaint } from "../color-solid-paint/color-solid-paint.js";
|
|
8
|
+
import { translation } from "../contents/translation.js";
|
|
9
|
+
const ColorGradientsPaint = forwardRef(
|
|
10
|
+
function ColorGradientsPaint2(props, ref) {
|
|
11
|
+
const {
|
|
12
|
+
className,
|
|
13
|
+
gradient,
|
|
14
|
+
onGradientChange,
|
|
15
|
+
features = {
|
|
16
|
+
containerWidth: 240
|
|
17
|
+
},
|
|
18
|
+
labels,
|
|
19
|
+
colorSpace,
|
|
20
|
+
onColorSpaceChange,
|
|
21
|
+
onChangeStart,
|
|
22
|
+
onChangeEnd,
|
|
23
|
+
solidPaintLabels
|
|
24
|
+
} = props;
|
|
25
|
+
const [selectedStopId, setSelectedStopId] = useState(() => {
|
|
26
|
+
var _a;
|
|
27
|
+
return ((_a = gradient.gradientStops[0]) == null ? void 0 : _a.id) ?? "";
|
|
28
|
+
});
|
|
29
|
+
const [colorPaneOpen, setColorPaneOpen] = useState(null);
|
|
30
|
+
const gradientStops = gradient.gradientStops;
|
|
31
|
+
const [selectedStopColor, selectedStopAlpha] = useMemo(() => {
|
|
32
|
+
const selectedStop = gradientStops.find((stop) => stop.id === selectedStopId);
|
|
33
|
+
return [selectedStop == null ? void 0 : selectedStop.color, selectedStop == null ? void 0 : selectedStop.alpha];
|
|
34
|
+
}, [selectedStopId, gradientStops]);
|
|
35
|
+
const controlRef = useRef(null);
|
|
36
|
+
const handleTypeChange = useEventCallback((value) => {
|
|
37
|
+
onGradientChange == null ? void 0 : onGradientChange({
|
|
38
|
+
...gradient,
|
|
39
|
+
type: value
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
const handleRotate = useEventCallback(() => {
|
|
43
|
+
const transform = gradient.gradientTransform;
|
|
44
|
+
const newTransform = transform.map((row) => row.map((value) => (value + 90) % 360));
|
|
45
|
+
onGradientChange == null ? void 0 : onGradientChange({
|
|
46
|
+
...gradient,
|
|
47
|
+
gradientTransform: newTransform
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
const handleFlipStops = useEventCallback(() => {
|
|
51
|
+
const sortedStops = [...gradient.gradientStops].sort((a, b) => a.position - b.position);
|
|
52
|
+
const flippedStops = sortedStops.map((stop) => ({
|
|
53
|
+
...stop,
|
|
54
|
+
position: 1 - stop.position
|
|
55
|
+
})).reverse();
|
|
56
|
+
onGradientChange == null ? void 0 : onGradientChange({
|
|
57
|
+
...gradient,
|
|
58
|
+
gradientStops: flippedStops
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
const handleStopsChange = useEventCallback((newStops) => {
|
|
62
|
+
onGradientChange == null ? void 0 : onGradientChange({
|
|
63
|
+
...gradient,
|
|
64
|
+
gradientStops: [...newStops]
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
const handleSelectedStopIdChange = useEventCallback((id) => {
|
|
68
|
+
setSelectedStopId(id);
|
|
69
|
+
});
|
|
70
|
+
const handleOpenStopColorPicker = useEventCallback((stop) => {
|
|
71
|
+
setSelectedStopId(stop.id);
|
|
72
|
+
setColorPaneOpen(stop.id);
|
|
73
|
+
});
|
|
74
|
+
const handleSelectStopColorChange = useEventCallback((color) => {
|
|
75
|
+
const newStops = gradientStops.map(
|
|
76
|
+
(stop) => stop.id === selectedStopId ? { ...stop, color } : stop
|
|
77
|
+
);
|
|
78
|
+
handleStopsChange(newStops);
|
|
79
|
+
});
|
|
80
|
+
const handleSelectStopAlphaChange = useEventCallback((alpha) => {
|
|
81
|
+
const newStops = gradientStops.map(
|
|
82
|
+
(stop) => stop.id === selectedStopId ? { ...stop, alpha } : stop
|
|
83
|
+
);
|
|
84
|
+
handleStopsChange(newStops);
|
|
85
|
+
});
|
|
86
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
87
|
+
/* @__PURE__ */ jsxs(
|
|
88
|
+
"div",
|
|
89
|
+
{
|
|
90
|
+
ref: controlRef,
|
|
91
|
+
className,
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsx(
|
|
94
|
+
ColorGradientsToolbar,
|
|
95
|
+
{
|
|
96
|
+
type: gradient.type,
|
|
97
|
+
onTypeChange: handleTypeChange,
|
|
98
|
+
onRotate: handleRotate,
|
|
99
|
+
onFlipStops: handleFlipStops,
|
|
100
|
+
labels
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
/* @__PURE__ */ jsx(
|
|
104
|
+
ColorGradientCombined,
|
|
105
|
+
{
|
|
106
|
+
active: (stopId) => colorPaneOpen === stopId,
|
|
107
|
+
stops: gradient.gradientStops,
|
|
108
|
+
selectedStopId,
|
|
109
|
+
onStopsChange: handleStopsChange,
|
|
110
|
+
onSelectedStopIdChange: handleSelectedStopIdChange,
|
|
111
|
+
onStopColorPickerOpen: handleOpenStopColorPicker,
|
|
112
|
+
containerWidth: (features == null ? void 0 : features.containerWidth) ?? 240,
|
|
113
|
+
onChangeStart,
|
|
114
|
+
onChangeEnd,
|
|
115
|
+
labels
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
/* @__PURE__ */ jsx(
|
|
122
|
+
ColorPickerPopover,
|
|
123
|
+
{
|
|
124
|
+
autoUpdate: true,
|
|
125
|
+
triggerRef: controlRef,
|
|
126
|
+
placement: "left-start",
|
|
127
|
+
open: colorPaneOpen !== null,
|
|
128
|
+
onOpenChange: (open) => {
|
|
129
|
+
if (!open) {
|
|
130
|
+
setColorPaneOpen(null);
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
labels: {
|
|
134
|
+
custom: (solidPaintLabels == null ? void 0 : solidPaintLabels.custom) ?? translation.colorPicker.TITLE
|
|
135
|
+
},
|
|
136
|
+
solidPaint: /* @__PURE__ */ jsx(
|
|
137
|
+
ColorSolidPaint,
|
|
138
|
+
{
|
|
139
|
+
onChangeStart,
|
|
140
|
+
onChangeEnd,
|
|
141
|
+
colorSpace,
|
|
142
|
+
onColorSpaceChange,
|
|
143
|
+
color: selectedStopColor,
|
|
144
|
+
onColorChange: handleSelectStopColorChange,
|
|
145
|
+
alpha: selectedStopAlpha,
|
|
146
|
+
onAlphaChange: handleSelectStopAlphaChange,
|
|
147
|
+
labels: solidPaintLabels
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
features: {
|
|
151
|
+
paintsType: false,
|
|
152
|
+
pickerType: true
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
] });
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
ColorGradientsPaint.displayName = "ColorGradientsPaint";
|
|
160
|
+
export {
|
|
161
|
+
ColorGradientsPaint
|
|
162
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GradientPaint, GradientToolbarLabels } from '../types/paint';
|
|
2
|
+
interface ColorGradientsToolbarProps {
|
|
3
|
+
labels?: GradientToolbarLabels;
|
|
4
|
+
onFlipStops: () => void;
|
|
5
|
+
onRotate: () => void;
|
|
6
|
+
onTypeChange: (value: string) => void;
|
|
7
|
+
type: GradientPaint["type"];
|
|
8
|
+
}
|
|
9
|
+
export declare const ColorGradientsToolbar: (props: ColorGradientsToolbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { IconButton } from "../../../icon-button/dist/index.js";
|
|
3
|
+
import { Select as Select2 } from "../../../select/dist/index.js";
|
|
4
|
+
import { Rotate90Right, SwapHorizontalSmall } from "@choiceform/icons-react";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
import { translation } from "../contents/translation.js";
|
|
7
|
+
const ColorGradientsToolbar = function ColorGradientsToolbar2(props) {
|
|
8
|
+
var _a;
|
|
9
|
+
const { type, onTypeChange, onRotate, onFlipStops, labels } = props;
|
|
10
|
+
const GRADIENTS_TYPES = useMemo(() => {
|
|
11
|
+
return [
|
|
12
|
+
{ value: "GRADIENT_LINEAR", label: (labels == null ? void 0 : labels.linear) ?? translation.gradients.LINEAR },
|
|
13
|
+
{ value: "GRADIENT_RADIAL", label: (labels == null ? void 0 : labels.radial) ?? translation.gradients.RADIAL },
|
|
14
|
+
{ value: "GRADIENT_ANGULAR", label: (labels == null ? void 0 : labels.conic) ?? translation.gradients.CONIC }
|
|
15
|
+
];
|
|
16
|
+
}, [labels == null ? void 0 : labels.conic, labels == null ? void 0 : labels.linear, labels == null ? void 0 : labels.radial]);
|
|
17
|
+
return /* @__PURE__ */ jsxs("div", { className: "grid h-12 grid-cols-2 items-center gap-2 pr-2 pl-4", children: [
|
|
18
|
+
/* @__PURE__ */ jsxs(
|
|
19
|
+
Select2,
|
|
20
|
+
{
|
|
21
|
+
value: type,
|
|
22
|
+
onChange: onTypeChange,
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsx(Select2.Trigger, { children: /* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: (_a = GRADIENTS_TYPES.find((option) => option.value === type)) == null ? void 0 : _a.label }) }),
|
|
25
|
+
/* @__PURE__ */ jsx(Select2.Content, { className: "min-w-28", children: GRADIENTS_TYPES.map((option) => /* @__PURE__ */ jsx(
|
|
26
|
+
Select2.Item,
|
|
27
|
+
{
|
|
28
|
+
value: option.value,
|
|
29
|
+
children: option.label
|
|
30
|
+
},
|
|
31
|
+
option.value
|
|
32
|
+
)) })
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-1 items-center justify-end", children: [
|
|
37
|
+
/* @__PURE__ */ jsx(
|
|
38
|
+
IconButton,
|
|
39
|
+
{
|
|
40
|
+
tooltip: {
|
|
41
|
+
content: (labels == null ? void 0 : labels.rotateGradient) ?? translation.gradients.ROTATE_GRADIENT
|
|
42
|
+
},
|
|
43
|
+
onClick: onRotate,
|
|
44
|
+
children: /* @__PURE__ */ jsx(Rotate90Right, {})
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
/* @__PURE__ */ jsx(
|
|
48
|
+
IconButton,
|
|
49
|
+
{
|
|
50
|
+
tooltip: {
|
|
51
|
+
content: (labels == null ? void 0 : labels.flipGradient) ?? translation.gradients.FLIP_GRADIENT
|
|
52
|
+
},
|
|
53
|
+
onClick: onFlipStops,
|
|
54
|
+
children: /* @__PURE__ */ jsx(SwapHorizontalSmall, {})
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
] })
|
|
58
|
+
] });
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
ColorGradientsToolbar
|
|
62
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ImagePaint, ImagePaintFeature } from '../types';
|
|
3
|
+
export interface ColorImagePaintProps {
|
|
4
|
+
className?: string;
|
|
5
|
+
features?: ImagePaintFeature;
|
|
6
|
+
image?: ImagePaint;
|
|
7
|
+
imageSrc?: string;
|
|
8
|
+
onChooseImage?: () => void;
|
|
9
|
+
onImageChange?: (image: ImagePaint) => void;
|
|
10
|
+
onImageChangeEnd?: () => void;
|
|
11
|
+
onImageChangeStart?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const ColorImagePaint: React.NamedExoticComponent<ColorImagePaintProps>;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "../../../button/dist/index.js";
|
|
3
|
+
import { Range } from "../../../range/dist/index.js";
|
|
4
|
+
import React__default, { memo, useState, useRef, useMemo, useEffect, useCallback } from "react";
|
|
5
|
+
import { useEventCallback } from "usehooks-ts";
|
|
6
|
+
import { ColorImageToolbar } from "./color-image-toolbar.js";
|
|
7
|
+
import { ColorImagePaintTv } from "./tv.js";
|
|
8
|
+
import { useImageProcessor } from "../hooks/use-image-processor.js";
|
|
9
|
+
import { useImageFilterStyle } from "../hooks/use-image-filter-style.js";
|
|
10
|
+
import { getColorSwatchBackground } from "../utils/background.js";
|
|
11
|
+
import { useMergedValue } from "../../../../shared/hooks/use-merged-value/use-merged-value.js";
|
|
12
|
+
const createDefaultSizes = (baseUrl = null) => ({
|
|
13
|
+
thumb: baseUrl || "",
|
|
14
|
+
small: baseUrl || "",
|
|
15
|
+
regular: baseUrl || "",
|
|
16
|
+
raw: baseUrl || "",
|
|
17
|
+
sourceSize: {
|
|
18
|
+
width: 0,
|
|
19
|
+
height: 0
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const createImageChangeObject = (baseImage, overrides) => {
|
|
23
|
+
return {
|
|
24
|
+
type: "IMAGE",
|
|
25
|
+
scaleMode: (baseImage == null ? void 0 : baseImage.scaleMode) ?? "FILL",
|
|
26
|
+
imageHash: (baseImage == null ? void 0 : baseImage.imageHash) ?? null,
|
|
27
|
+
imageSizes: (baseImage == null ? void 0 : baseImage.imageSizes) ?? createDefaultSizes(baseImage == null ? void 0 : baseImage.imageHash),
|
|
28
|
+
imageTransform: baseImage == null ? void 0 : baseImage.imageTransform,
|
|
29
|
+
scalingFactor: baseImage == null ? void 0 : baseImage.scalingFactor,
|
|
30
|
+
rotation: (baseImage == null ? void 0 : baseImage.rotation) ?? 0,
|
|
31
|
+
visible: (baseImage == null ? void 0 : baseImage.visible) ?? true,
|
|
32
|
+
opacity: (baseImage == null ? void 0 : baseImage.opacity) ?? 1,
|
|
33
|
+
filters: baseImage == null ? void 0 : baseImage.filters,
|
|
34
|
+
...overrides
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const ColorImagePaint = memo(function ColorImagePaint2(props) {
|
|
38
|
+
var _a, _b, _c, _d;
|
|
39
|
+
const {
|
|
40
|
+
image,
|
|
41
|
+
imageSrc: initialImageSrc,
|
|
42
|
+
onImageChange,
|
|
43
|
+
onChooseImage,
|
|
44
|
+
className,
|
|
45
|
+
features: userFeatures = {},
|
|
46
|
+
onImageChangeEnd,
|
|
47
|
+
onImageChangeStart
|
|
48
|
+
} = props;
|
|
49
|
+
const [imageSrc, setImageSrc] = useState(
|
|
50
|
+
((_a = image == null ? void 0 : image.imageSizes) == null ? void 0 : _a.small) ?? initialImageSrc ?? void 0
|
|
51
|
+
);
|
|
52
|
+
const [isUploading, setIsUploading] = useState(false);
|
|
53
|
+
const fileInputRef = useRef(null);
|
|
54
|
+
const features = useMemo(
|
|
55
|
+
() => ({
|
|
56
|
+
containerWidth: 240,
|
|
57
|
+
labels: {
|
|
58
|
+
exposure: "Exposure",
|
|
59
|
+
contrast: "Contrast",
|
|
60
|
+
saturation: "Saturation",
|
|
61
|
+
temperature: "Temperature",
|
|
62
|
+
tint: "Tint",
|
|
63
|
+
upload: "Upload from computer",
|
|
64
|
+
fill: "Fill",
|
|
65
|
+
fit: "Fit",
|
|
66
|
+
crop: "Crop",
|
|
67
|
+
tile: "Tile",
|
|
68
|
+
rotate: "Rotate 90°",
|
|
69
|
+
processing: "Processing..."
|
|
70
|
+
},
|
|
71
|
+
...userFeatures
|
|
72
|
+
}),
|
|
73
|
+
[userFeatures]
|
|
74
|
+
);
|
|
75
|
+
const containerWidth = (features == null ? void 0 : features.containerWidth) ?? 240;
|
|
76
|
+
const styles = ColorImagePaintTv({ hasImage: !!imageSrc });
|
|
77
|
+
const checkerboard = useMemo(
|
|
78
|
+
() => getColorSwatchBackground((containerWidth - 32) / 15, 1),
|
|
79
|
+
[containerWidth]
|
|
80
|
+
);
|
|
81
|
+
const { processImage, isProcessing } = useImageProcessor();
|
|
82
|
+
const isLoading = isUploading || isProcessing;
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
var _a2;
|
|
85
|
+
if ((_a2 = image == null ? void 0 : image.imageSizes) == null ? void 0 : _a2.small) {
|
|
86
|
+
setImageSrc(image.imageSizes.small);
|
|
87
|
+
}
|
|
88
|
+
}, [(_b = image == null ? void 0 : image.imageSizes) == null ? void 0 : _b.small]);
|
|
89
|
+
const [filters, setFilters] = useMergedValue({
|
|
90
|
+
defaultValue: {
|
|
91
|
+
exposure: 0,
|
|
92
|
+
contrast: 0,
|
|
93
|
+
saturation: 0,
|
|
94
|
+
temperature: 0,
|
|
95
|
+
tint: 0
|
|
96
|
+
},
|
|
97
|
+
value: image == null ? void 0 : image.filters,
|
|
98
|
+
onChange: (filters2) => {
|
|
99
|
+
if (onImageChange) {
|
|
100
|
+
onImageChange(createImageChangeObject(image, { filters: filters2 }));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
const handleFileChange = useEventCallback((event) => {
|
|
105
|
+
var _a2;
|
|
106
|
+
if (onChooseImage) return;
|
|
107
|
+
const file = (_a2 = event.target.files) == null ? void 0 : _a2[0];
|
|
108
|
+
if (!file || !onImageChange) return;
|
|
109
|
+
setIsUploading(true);
|
|
110
|
+
processImage(file).then((urls) => {
|
|
111
|
+
setImageSrc(urls.small);
|
|
112
|
+
onImageChange(
|
|
113
|
+
createImageChangeObject(image, {
|
|
114
|
+
imageHash: urls.small,
|
|
115
|
+
imageSizes: urls
|
|
116
|
+
})
|
|
117
|
+
);
|
|
118
|
+
}).catch((error) => {
|
|
119
|
+
console.error("图片处理失败", error);
|
|
120
|
+
}).finally(() => {
|
|
121
|
+
setIsUploading(false);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
const handleUploadClick = useEventCallback(() => {
|
|
125
|
+
var _a2;
|
|
126
|
+
if (onChooseImage) {
|
|
127
|
+
onChooseImage();
|
|
128
|
+
} else {
|
|
129
|
+
(_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
const handleScaleModeChange = useCallback(
|
|
133
|
+
(scaleMode) => {
|
|
134
|
+
console.log("scale mode change", scaleMode);
|
|
135
|
+
if (onImageChange) {
|
|
136
|
+
onImageChange(createImageChangeObject(image, { scaleMode }));
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
[image, onImageChange]
|
|
140
|
+
);
|
|
141
|
+
const handleRotate = useCallback(() => {
|
|
142
|
+
if (onImageChange) {
|
|
143
|
+
const currentRotation = (image == null ? void 0 : image.rotation) ?? 0;
|
|
144
|
+
onImageChange(
|
|
145
|
+
createImageChangeObject(image, {
|
|
146
|
+
rotation: currentRotation + 90
|
|
147
|
+
})
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
}, [image, onImageChange]);
|
|
151
|
+
const imageStyle = useImageFilterStyle(filters);
|
|
152
|
+
return /* @__PURE__ */ jsxs(
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
className: styles.root({ className }),
|
|
156
|
+
style: { width: containerWidth },
|
|
157
|
+
children: [
|
|
158
|
+
/* @__PURE__ */ jsx(
|
|
159
|
+
ColorImageToolbar,
|
|
160
|
+
{
|
|
161
|
+
features,
|
|
162
|
+
scaleMode: image == null ? void 0 : image.scaleMode,
|
|
163
|
+
onScaleModeChange: handleScaleModeChange,
|
|
164
|
+
onRotate: handleRotate
|
|
165
|
+
}
|
|
166
|
+
),
|
|
167
|
+
/* @__PURE__ */ jsxs(
|
|
168
|
+
"div",
|
|
169
|
+
{
|
|
170
|
+
className: styles.container(),
|
|
171
|
+
style: { background: checkerboard },
|
|
172
|
+
children: [
|
|
173
|
+
imageSrc && /* @__PURE__ */ jsx("div", { className: styles.imgContainer(), children: /* @__PURE__ */ jsx(
|
|
174
|
+
"img",
|
|
175
|
+
{
|
|
176
|
+
className: styles.image(),
|
|
177
|
+
src: imageSrc,
|
|
178
|
+
alt: "Uploaded image",
|
|
179
|
+
style: imageStyle
|
|
180
|
+
}
|
|
181
|
+
) }),
|
|
182
|
+
/* @__PURE__ */ jsxs("div", { className: styles.buttonContainer(), children: [
|
|
183
|
+
/* @__PURE__ */ jsx(
|
|
184
|
+
Button,
|
|
185
|
+
{
|
|
186
|
+
className: styles.button(),
|
|
187
|
+
onClick: handleUploadClick,
|
|
188
|
+
disabled: isLoading,
|
|
189
|
+
children: isLoading ? (_c = features == null ? void 0 : features.labels) == null ? void 0 : _c.processing : (_d = features == null ? void 0 : features.labels) == null ? void 0 : _d.upload
|
|
190
|
+
}
|
|
191
|
+
),
|
|
192
|
+
/* @__PURE__ */ jsx(
|
|
193
|
+
"input",
|
|
194
|
+
{
|
|
195
|
+
ref: fileInputRef,
|
|
196
|
+
type: "file",
|
|
197
|
+
accept: "image/*",
|
|
198
|
+
onChange: handleFileChange,
|
|
199
|
+
className: "hidden",
|
|
200
|
+
disabled: isLoading
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
] })
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
),
|
|
207
|
+
/* @__PURE__ */ jsx("div", { className: styles.adjustContainer(), children: ["exposure", "contrast", "saturation", "temperature", "tint"].map((filterName) => {
|
|
208
|
+
var _a2;
|
|
209
|
+
return /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
|
|
210
|
+
/* @__PURE__ */ jsx("span", { className: styles.adjustLabel(), children: (_a2 = features == null ? void 0 : features.labels) == null ? void 0 : _a2[filterName] }),
|
|
211
|
+
/* @__PURE__ */ jsx(
|
|
212
|
+
Range,
|
|
213
|
+
{
|
|
214
|
+
min: -100,
|
|
215
|
+
max: 100,
|
|
216
|
+
defaultValue: 0,
|
|
217
|
+
trackSize: { width: 128 },
|
|
218
|
+
value: filters[filterName],
|
|
219
|
+
onChange: (value) => setFilters({
|
|
220
|
+
...filters,
|
|
221
|
+
[filterName]: value
|
|
222
|
+
}),
|
|
223
|
+
onChangeEnd: onImageChangeEnd,
|
|
224
|
+
onChangeStart: onImageChangeStart,
|
|
225
|
+
disabled: isLoading || !imageSrc
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
] }, filterName);
|
|
229
|
+
}) })
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
);
|
|
233
|
+
});
|
|
234
|
+
export {
|
|
235
|
+
ColorImagePaint
|
|
236
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ImagePaintFeature, ImageScaleMode } from '../types';
|
|
2
|
+
interface ColorImageToolbarProps {
|
|
3
|
+
features?: ImagePaintFeature;
|
|
4
|
+
onRotate?: () => void;
|
|
5
|
+
onScaleModeChange?: (scaleMode: ImageScaleMode) => void;
|
|
6
|
+
scaleMode?: ImageScaleMode;
|
|
7
|
+
}
|
|
8
|
+
export declare const ColorImageToolbar: import('react').NamedExoticComponent<ColorImageToolbarProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { IconButton } from "../../../icon-button/dist/index.js";
|
|
3
|
+
import { Select as Select2 } from "../../../select/dist/index.js";
|
|
4
|
+
import { Rotate90Right } from "@choiceform/icons-react";
|
|
5
|
+
import { memo } from "react";
|
|
6
|
+
import { ColorImageToolbarTv } from "./tv.js";
|
|
7
|
+
import { useMergedValue } from "../../../../shared/hooks/use-merged-value/use-merged-value.js";
|
|
8
|
+
const ColorImageToolbar = memo(function ColorImageToolbar2(props) {
|
|
9
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10
|
+
const { features, scaleMode, onScaleModeChange, onRotate } = props;
|
|
11
|
+
const styles = ColorImageToolbarTv();
|
|
12
|
+
const [internalScaleMode, setInternalScaleMode] = useMergedValue({
|
|
13
|
+
defaultValue: "FILL",
|
|
14
|
+
value: scaleMode,
|
|
15
|
+
onChange: (value) => {
|
|
16
|
+
onScaleModeChange == null ? void 0 : onScaleModeChange(value);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return /* @__PURE__ */ jsxs("div", { className: styles.root(), children: [
|
|
20
|
+
/* @__PURE__ */ jsxs(
|
|
21
|
+
Select2,
|
|
22
|
+
{
|
|
23
|
+
value: internalScaleMode,
|
|
24
|
+
onChange: (value) => {
|
|
25
|
+
setInternalScaleMode(value);
|
|
26
|
+
},
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ jsx(Select2.Trigger, { children: /* @__PURE__ */ jsx(Select2.Value, { children: (_a = features == null ? void 0 : features.labels) == null ? void 0 : _a[internalScaleMode.toLowerCase()] }) }),
|
|
29
|
+
/* @__PURE__ */ jsxs(Select2.Content, { children: [
|
|
30
|
+
/* @__PURE__ */ jsx(Select2.Item, { value: "FILL", children: (_b = features == null ? void 0 : features.labels) == null ? void 0 : _b.fill }),
|
|
31
|
+
/* @__PURE__ */ jsx(Select2.Item, { value: "FIT", children: (_c = features == null ? void 0 : features.labels) == null ? void 0 : _c.fit }),
|
|
32
|
+
/* @__PURE__ */ jsx(Select2.Item, { value: "CROP", children: (_d = features == null ? void 0 : features.labels) == null ? void 0 : _d.crop }),
|
|
33
|
+
/* @__PURE__ */ jsx(Select2.Item, { value: "TILE", children: (_e = features == null ? void 0 : features.labels) == null ? void 0 : _e.tile })
|
|
34
|
+
] })
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
/* @__PURE__ */ jsx("div", { className: styles.right(), children: /* @__PURE__ */ jsx(
|
|
39
|
+
IconButton,
|
|
40
|
+
{
|
|
41
|
+
tooltip: {
|
|
42
|
+
content: (_f = features == null ? void 0 : features.labels) == null ? void 0 : _f.rotate
|
|
43
|
+
},
|
|
44
|
+
onClick: onRotate,
|
|
45
|
+
children: /* @__PURE__ */ jsx(Rotate90Right, {})
|
|
46
|
+
}
|
|
47
|
+
) })
|
|
48
|
+
] });
|
|
49
|
+
});
|
|
50
|
+
export {
|
|
51
|
+
ColorImageToolbar
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './color-image-paint';
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
export declare const ColorImagePaintTv: import('tailwind-variants').TVReturnType<{
|
|
2
|
+
hasImage: {
|
|
3
|
+
true: {
|
|
4
|
+
container: string;
|
|
5
|
+
buttonContainer: string[];
|
|
6
|
+
};
|
|
7
|
+
false: {
|
|
8
|
+
container: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
}, {
|
|
12
|
+
root: string;
|
|
13
|
+
container: string[];
|
|
14
|
+
buttonContainer: string;
|
|
15
|
+
button: string;
|
|
16
|
+
imgContainer: string;
|
|
17
|
+
image: string;
|
|
18
|
+
adjustContainer: string;
|
|
19
|
+
adjustLabel: string;
|
|
20
|
+
}, undefined, {
|
|
21
|
+
hasImage: {
|
|
22
|
+
true: {
|
|
23
|
+
container: string;
|
|
24
|
+
buttonContainer: string[];
|
|
25
|
+
};
|
|
26
|
+
false: {
|
|
27
|
+
container: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
}, {
|
|
31
|
+
root: string;
|
|
32
|
+
container: string[];
|
|
33
|
+
buttonContainer: string;
|
|
34
|
+
button: string;
|
|
35
|
+
imgContainer: string;
|
|
36
|
+
image: string;
|
|
37
|
+
adjustContainer: string;
|
|
38
|
+
adjustLabel: string;
|
|
39
|
+
}, import('tailwind-variants').TVReturnType<{
|
|
40
|
+
hasImage: {
|
|
41
|
+
true: {
|
|
42
|
+
container: string;
|
|
43
|
+
buttonContainer: string[];
|
|
44
|
+
};
|
|
45
|
+
false: {
|
|
46
|
+
container: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
}, {
|
|
50
|
+
root: string;
|
|
51
|
+
container: string[];
|
|
52
|
+
buttonContainer: string;
|
|
53
|
+
button: string;
|
|
54
|
+
imgContainer: string;
|
|
55
|
+
image: string;
|
|
56
|
+
adjustContainer: string;
|
|
57
|
+
adjustLabel: string;
|
|
58
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
59
|
+
export declare const ColorImageToolbarTv: import('tailwind-variants').TVReturnType<{
|
|
60
|
+
[key: string]: {
|
|
61
|
+
[key: string]: import('tailwind-merge').ClassNameValue | {
|
|
62
|
+
right?: import('tailwind-merge').ClassNameValue;
|
|
63
|
+
root?: import('tailwind-merge').ClassNameValue;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
} | {
|
|
67
|
+
[x: string]: {
|
|
68
|
+
[x: string]: import('tailwind-merge').ClassNameValue | {
|
|
69
|
+
right?: import('tailwind-merge').ClassNameValue;
|
|
70
|
+
root?: import('tailwind-merge').ClassNameValue;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
} | {}, {
|
|
74
|
+
root: string;
|
|
75
|
+
right: string;
|
|
76
|
+
}, undefined, {
|
|
77
|
+
[key: string]: {
|
|
78
|
+
[key: string]: import('tailwind-merge').ClassNameValue | {
|
|
79
|
+
right?: import('tailwind-merge').ClassNameValue;
|
|
80
|
+
root?: import('tailwind-merge').ClassNameValue;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
} | {}, {
|
|
84
|
+
root: string;
|
|
85
|
+
right: string;
|
|
86
|
+
}, import('tailwind-variants').TVReturnType<unknown, {
|
|
87
|
+
root: string;
|
|
88
|
+
right: string;
|
|
89
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { tcv } from "../../../../shared/utils/tcx/tcx.js";
|
|
2
|
+
const ColorImagePaintTv = tcv({
|
|
3
|
+
slots: {
|
|
4
|
+
root: "flex flex-col pb-4",
|
|
5
|
+
container: [
|
|
6
|
+
"group/image-container mx-4",
|
|
7
|
+
"relative grid aspect-square place-content-center overflow-hidden rounded-md",
|
|
8
|
+
"before:absolute before:inset-0 before:z-1 before:border",
|
|
9
|
+
"before:pointer-events-none before:rounded-md before:content-['']"
|
|
10
|
+
],
|
|
11
|
+
buttonContainer: "absolute inset-0 grid place-content-center bg-black/40",
|
|
12
|
+
button: "relative",
|
|
13
|
+
imgContainer: "absolute inset-0 grid place-content-center overflow-hidden",
|
|
14
|
+
image: "aspect-square h-full w-full object-contain",
|
|
15
|
+
adjustContainer: "mx-4 mt-4 grid grid-cols-[1fr_auto] gap-x-2 gap-y-4",
|
|
16
|
+
adjustLabel: "text-secondary-foreground truncate"
|
|
17
|
+
},
|
|
18
|
+
variants: {
|
|
19
|
+
hasImage: {
|
|
20
|
+
true: {
|
|
21
|
+
container: "before:border-black/10 hover:before:border-transparent",
|
|
22
|
+
buttonContainer: [
|
|
23
|
+
"opacity-0 transition-opacity duration-300",
|
|
24
|
+
"group-hover/image-container:opacity-100"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
false: {
|
|
28
|
+
container: "before:border-transparent"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
defaultVariants: {
|
|
33
|
+
hasImage: false
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
const ColorImageToolbarTv = tcv({
|
|
37
|
+
slots: {
|
|
38
|
+
root: "grid h-12 grid-cols-2 items-center gap-2 pr-2 pl-4",
|
|
39
|
+
right: "flex flex-1 items-center justify-end"
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
export {
|
|
43
|
+
ColorImagePaintTv,
|
|
44
|
+
ColorImageToolbarTv
|
|
45
|
+
};
|