{"version":3,"file":"color-palette-panel.cjs","names":["useSetting","useViewportMatch","VStack","PaletteEdit","__","ColorVariations"],"sources":["../src/color-palette-panel.tsx"],"sourcesContent":["import type { Color } from '@wordpress/global-styles-engine';\nimport { useViewportMatch } from '@wordpress/compose';\nimport {\n\t__experimentalPaletteEdit as PaletteEdit,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSetting } from './hooks';\nimport ColorVariations from './variations/variations-color';\n\nconst mobilePopoverProps = { placement: 'bottom-start' as const, offset: 8 };\n\ninterface ColorPalettePanelProps {\n\tname?: string;\n}\n\nexport default function ColorPalettePanel( { name }: ColorPalettePanelProps ) {\n\tconst [ themeColors, setThemeColors ] = useSetting< Color[] >(\n\t\t'color.palette.theme',\n\t\tname\n\t);\n\tconst [ baseThemeColors ] = useSetting< Color[] >(\n\t\t'color.palette.theme',\n\t\tname,\n\t\t'base'\n\t);\n\tconst [ defaultColors, setDefaultColors ] = useSetting< Color[] >(\n\t\t'color.palette.default',\n\t\tname\n\t);\n\tconst [ baseDefaultColors ] = useSetting< Color[] >(\n\t\t'color.palette.default',\n\t\tname,\n\t\t'base'\n\t);\n\tconst [ customColors, setCustomColors ] = useSetting< Color[] >(\n\t\t'color.palette.custom',\n\t\tname\n\t);\n\n\tconst [ defaultPaletteEnabled ] = useSetting< boolean >(\n\t\t'color.defaultPalette',\n\t\tname\n\t);\n\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst popoverProps = isMobileViewport ? mobilePopoverProps : undefined;\n\n\treturn (\n\t\t<VStack className=\"global-styles-ui-color-palette-panel\" spacing={ 8 }>\n\t\t\t{ !! themeColors?.length && (\n\t\t\t\t<PaletteEdit\n\t\t\t\t\tcanReset={ themeColors !== baseThemeColors }\n\t\t\t\t\tcanOnlyChangeValues\n\t\t\t\t\tcolors={ themeColors }\n\t\t\t\t\tonChange={ setThemeColors }\n\t\t\t\t\tpaletteLabel={ __( 'Theme' ) }\n\t\t\t\t\tpaletteLabelHeadingLevel={ 3 }\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! defaultColors &&\n\t\t\t\t!! defaultColors.length &&\n\t\t\t\t!! defaultPaletteEnabled && (\n\t\t\t\t\t<PaletteEdit\n\t\t\t\t\t\tcanReset={ defaultColors !== baseDefaultColors }\n\t\t\t\t\t\tcanOnlyChangeValues\n\t\t\t\t\t\tcolors={ defaultColors }\n\t\t\t\t\t\tonChange={ setDefaultColors }\n\t\t\t\t\t\tpaletteLabel={ __( 'Default' ) }\n\t\t\t\t\t\tpaletteLabelHeadingLevel={ 3 }\n\t\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t<PaletteEdit\n\t\t\t\tcolors={ customColors }\n\t\t\t\tonChange={ setCustomColors }\n\t\t\t\tpaletteLabel={ __( 'Custom' ) }\n\t\t\t\tpaletteLabelHeadingLevel={ 3 }\n\t\t\t\tslugPrefix=\"custom-\"\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t/>\n\t\t\t<ColorVariations title={ __( 'Palettes' ) } />\n\t\t</VStack>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,qBAAqB;CAAE,WAAW;CAAyB,QAAQ;AAAE;AAM3E,SAAwB,kBAAmB,EAAE,QAAiC;CAC7E,MAAM,CAAE,aAAa,mBAAA,GAAmBA,WAAAA,WAAAA,CACvC,uBACA,IACD;CACA,MAAM,CAAE,oBAAA,GAAoBA,WAAAA,WAAAA,CAC3B,uBACA,MACA,MACD;CACA,MAAM,CAAE,eAAe,qBAAA,GAAqBA,WAAAA,WAAAA,CAC3C,yBACA,IACD;CACA,MAAM,CAAE,sBAAA,GAAsBA,WAAAA,WAAAA,CAC7B,yBACA,MACA,MACD;CACA,MAAM,CAAE,cAAc,oBAAA,GAAoBA,WAAAA,WAAAA,CACzC,wBAC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