@grafana/ui
Version:
Grafana Components Library
1 lines • 2.27 kB
Source Map (JSON)
{"version":3,"file":"SegmentSection.cjs","sources":["../../../../src/components/Segment/SegmentSection.tsx"],"sourcesContent":["import { css } from '@emotion/css';\nimport * as React from 'react';\n\nimport { type GrafanaTheme2 } from '@grafana/data';\n\nimport { useStyles2 } from '../../themes/ThemeContext';\nimport { InlineFieldRow } from '../Forms/InlineFieldRow';\nimport { InlineLabel } from '../Forms/InlineLabel';\n\n/**\n * Horizontal section for editor components.\n *\n * @alpha\n */\nexport const SegmentSection = ({\n label,\n htmlFor,\n children,\n fill,\n}: {\n // Name of the section\n label: string;\n // htmlFor for the label\n htmlFor?: string;\n // List of components in the section\n children: React.ReactNode;\n // Fill the space at the end\n fill?: boolean;\n}) => {\n const styles = useStyles2(getStyles);\n return (\n <>\n <InlineFieldRow>\n <InlineLabel htmlFor={htmlFor} width={12} className={styles.label}>\n {label}\n </InlineLabel>\n {children}\n {fill && (\n <div className={styles.fill}>\n <InlineLabel>{''}</InlineLabel>\n </div>\n )}\n </InlineFieldRow>\n </>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n label: css({\n color: theme.colors.primary.text,\n }),\n fill: css({\n flexGrow: 1,\n marginBottom: theme.spacing(0.5),\n }),\n});\n"],"names":["useStyles2","jsx","Fragment","InlineFieldRow","InlineLabel","css"],"mappings":";;;;;;;;;;;AAcO,MAAM,iBAAiB,CAAC;AAAA,EAC7B,KAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,KASM;AACJ,EAAA,MAAM,MAAA,GAASA,wBAAW,SAAS,CAAA;AACnC,EAAA,uBACEC,cAAA,CAAAC,mBAAA,EAAA,EACE,0CAACC,6BAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAAF,cAAA,CAACG,2BAAY,OAAA,EAAkB,KAAA,EAAO,IAAI,SAAA,EAAW,MAAA,CAAO,OACzD,QAAA,EAAA,KAAA,EACH,CAAA;AAAA,IACC,QAAA;AAAA,IACA,IAAA,mCACE,KAAA,EAAA,EAAI,SAAA,EAAW,OAAO,IAAA,EACrB,QAAA,kBAAAH,cAAA,CAACG,uBAAA,EAAA,EAAa,QAAA,EAAA,EAAA,EAAG,CAAA,EACnB;AAAA,GAAA,EAEJ,CAAA,EACF,CAAA;AAEJ;AAEA,MAAM,SAAA,GAAY,CAAC,KAAA,MAA0B;AAAA,EAC3C,OAAOC,OAAA,CAAI;AAAA,IACT,KAAA,EAAO,KAAA,CAAM,MAAA,CAAO,OAAA,CAAQ;AAAA,GAC7B,CAAA;AAAA,EACD,MAAMA,OAAA,CAAI;AAAA,IACR,QAAA,EAAU,CAAA;AAAA,IACV,YAAA,EAAc,KAAA,CAAM,OAAA,CAAQ,GAAG;AAAA,GAChC;AACH,CAAA,CAAA;;;;"}