@grafana/ui
Version:
Grafana Components Library
1 lines • 2.27 kB
Source Map (JSON)
{"version":3,"file":"SeriesColorPickerPopover.mjs","sources":["../../../../src/components/ColorPicker/SeriesColorPickerPopover.tsx"],"sourcesContent":["import { t } from '@grafana/i18n';\n\nimport { withTheme2 } from '../../themes/ThemeContext';\nimport { InlineField } from '../Forms/InlineField';\nimport { InlineSwitch } from '../Switch/Switch';\nimport { PopoverContentProps } from '../Tooltip/types';\n\nimport { ColorPickerPopover, ColorPickerProps } from './ColorPickerPopover';\n\nexport interface SeriesColorPickerPopoverProps extends ColorPickerProps, PopoverContentProps {\n yaxis?: number;\n onToggleAxis?: () => void;\n}\n\nexport const SeriesColorPickerPopover = (props: SeriesColorPickerPopoverProps) => {\n const { yaxis, onToggleAxis, color, ...colorPickerProps } = props;\n const yAxisLabel = t('grafana-ui.series-color-picker-popover.y-axis-usage', 'Use right y-axis');\n const customPickers = onToggleAxis\n ? {\n yaxis: {\n name: 'Y-Axis',\n tabComponent() {\n return (\n <InlineField labelWidth={20} label={yAxisLabel}>\n <InlineSwitch value={yaxis === 2} label={yAxisLabel} onChange={onToggleAxis} />\n </InlineField>\n );\n },\n },\n }\n : undefined;\n return <ColorPickerPopover {...colorPickerProps} color={color || '#000000'} customPickers={customPickers} />;\n};\n\n// This component is to enable SeriesColorPickerPopover usage via series-color-picker-popover directive\nexport const SeriesColorPickerPopoverWithTheme = withTheme2(SeriesColorPickerPopover);\n"],"names":[],"mappings":";;;;;;;AAca,MAAA,wBAAA,GAA2B,CAAC,KAAyC,KAAA;AAChF,EAAA,MAAM,EAAE,KAAO,EAAA,YAAA,EAAc,KAAO,EAAA,GAAG,kBAAqB,GAAA,KAAA;AAC5D,EAAM,MAAA,UAAA,GAAa,CAAE,CAAA,qDAAA,EAAuD,kBAAkB,CAAA;AAC9F,EAAA,MAAM,gBAAgB,YAClB,GAAA;AAAA,IACE,KAAO,EAAA;AAAA,MACL,IAAM,EAAA,QAAA;AAAA,MACN,YAAe,GAAA;AACb,QAAA,uBACG,GAAA,CAAA,WAAA,EAAA,EAAY,UAAY,EAAA,EAAA,EAAI,OAAO,UAClC,EAAA,QAAA,kBAAA,GAAA,CAAC,YAAa,EAAA,EAAA,KAAA,EAAO,UAAU,CAAG,EAAA,KAAA,EAAO,UAAY,EAAA,QAAA,EAAU,cAAc,CAC/E,EAAA,CAAA;AAAA;AAEJ;AACF,GAEF,GAAA,KAAA,CAAA;AACJ,EAAA,2BAAQ,kBAAoB,EAAA,EAAA,GAAG,kBAAkB,KAAO,EAAA,KAAA,IAAS,WAAW,aAA8B,EAAA,CAAA;AAC5G;AAGa,MAAA,iCAAA,GAAoC,WAAW,wBAAwB;;;;"}