UNPKG

@grafana/ui

Version:
1 lines 2.27 kB
{"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":";;;;;;;;AAcO,MAAM,wBAAA,GAA2B,CAAC,KAAA,KAAyC;AAChF,EAAA,MAAM,EAAE,KAAA,EAAO,YAAA,EAAc,KAAA,EAAO,GAAG,kBAAiB,GAAI,KAAA;AAC5D,EAAA,MAAM,UAAA,GAAa,CAAA,CAAE,qDAAA,EAAuD,kBAAkB,CAAA;AAC9F,EAAA,MAAM,gBAAgB,YAAA,GAClB;AAAA,IACE,KAAA,EAAO;AAAA,MACL,IAAA,EAAM,QAAA;AAAA,MACN,YAAA,GAAe;AACb,QAAA,uBACE,GAAA,CAAC,WAAA,EAAA,EAAY,UAAA,EAAY,EAAA,EAAI,OAAO,UAAA,EAClC,QAAA,kBAAA,GAAA,CAAC,YAAA,EAAA,EAAa,KAAA,EAAO,UAAU,CAAA,EAAG,KAAA,EAAO,UAAA,EAAY,QAAA,EAAU,cAAc,CAAA,EAC/E,CAAA;AAAA,MAEJ;AAAA;AACF,GACF,GACA,KAAA,CAAA;AACJ,EAAA,2BAAQ,kBAAA,EAAA,EAAoB,GAAG,kBAAkB,KAAA,EAAO,KAAA,IAAS,WAAW,aAAA,EAA8B,CAAA;AAC5G;AAGO,MAAM,iCAAA,GAAoC,WAAW,wBAAwB;;;;"}