@perses-dev/dashboards 0.52.0 → 0.53.0-beta.0

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.
Files changed (74) hide show
  1. package/dist/cjs/components/DashboardStickyToolbar/DashboardStickyToolbar.js +0 -2
  2. package/dist/cjs/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +5 -20
  3. package/dist/cjs/components/GridLayout/GridItemContent.js +6 -64
  4. package/dist/cjs/components/LeaveDialog/LeaveDialog.js +10 -1
  5. package/dist/cjs/components/PanelDrawer/PanelEditorForm.js +186 -183
  6. package/dist/cjs/components/PanelDrawer/PanelPreview.js +3 -0
  7. package/dist/cjs/components/PanelGroupDialog/PanelGroupDialog.js +6 -21
  8. package/dist/cjs/components/QueryViewerDialog/QueryViewerDialog.js +121 -0
  9. package/dist/cjs/components/QueryViewerDialog/index.js +30 -0
  10. package/dist/cjs/components/Variables/ListVariableListBox.js +201 -0
  11. package/dist/cjs/components/Variables/Variable.js +130 -72
  12. package/dist/cjs/components/Variables/index.js +1 -0
  13. package/dist/cjs/components/index.js +2 -1
  14. package/dist/cjs/context/PanelEditorProvider/PanelEditorProvider.js +49 -0
  15. package/dist/cjs/context/PanelEditorProvider/index.js +23 -0
  16. package/dist/cjs/context/index.js +1 -0
  17. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.d.ts.map +1 -1
  18. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js +0 -2
  19. package/dist/components/DashboardStickyToolbar/DashboardStickyToolbar.js.map +1 -1
  20. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.d.ts.map +1 -1
  21. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js +5 -15
  22. package/dist/components/DeletePanelGroupDialog/DeletePanelGroupDialog.js.map +1 -1
  23. package/dist/components/GridLayout/GridItemContent.d.ts.map +1 -1
  24. package/dist/components/GridLayout/GridItemContent.js +8 -66
  25. package/dist/components/GridLayout/GridItemContent.js.map +1 -1
  26. package/dist/components/LeaveDialog/LeaveDialog.d.ts +2 -1
  27. package/dist/components/LeaveDialog/LeaveDialog.d.ts.map +1 -1
  28. package/dist/components/LeaveDialog/LeaveDialog.js +10 -1
  29. package/dist/components/LeaveDialog/LeaveDialog.js.map +1 -1
  30. package/dist/components/PanelDrawer/PanelEditorForm.d.ts.map +1 -1
  31. package/dist/components/PanelDrawer/PanelEditorForm.js +186 -183
  32. package/dist/components/PanelDrawer/PanelEditorForm.js.map +1 -1
  33. package/dist/components/PanelDrawer/PanelPreview.d.ts.map +1 -1
  34. package/dist/components/PanelDrawer/PanelPreview.js +4 -1
  35. package/dist/components/PanelDrawer/PanelPreview.js.map +1 -1
  36. package/dist/components/PanelGroupDialog/PanelGroupDialog.d.ts.map +1 -1
  37. package/dist/components/PanelGroupDialog/PanelGroupDialog.js +5 -15
  38. package/dist/components/PanelGroupDialog/PanelGroupDialog.js.map +1 -1
  39. package/dist/components/QueryViewerDialog/QueryViewerDialog.d.ts +9 -0
  40. package/dist/components/QueryViewerDialog/QueryViewerDialog.d.ts.map +1 -0
  41. package/dist/components/QueryViewerDialog/QueryViewerDialog.js +72 -0
  42. package/dist/components/QueryViewerDialog/QueryViewerDialog.js.map +1 -0
  43. package/dist/components/QueryViewerDialog/index.d.ts +2 -0
  44. package/dist/components/QueryViewerDialog/index.d.ts.map +1 -0
  45. package/dist/components/QueryViewerDialog/index.js +15 -0
  46. package/dist/components/QueryViewerDialog/index.js.map +1 -0
  47. package/dist/components/Variables/ListVariableListBox.d.ts +16 -0
  48. package/dist/components/Variables/ListVariableListBox.d.ts.map +1 -0
  49. package/dist/components/Variables/ListVariableListBox.js +141 -0
  50. package/dist/components/Variables/ListVariableListBox.js.map +1 -0
  51. package/dist/components/Variables/Variable.d.ts.map +1 -1
  52. package/dist/components/Variables/Variable.js +134 -76
  53. package/dist/components/Variables/Variable.js.map +1 -1
  54. package/dist/components/Variables/index.d.ts +1 -0
  55. package/dist/components/Variables/index.d.ts.map +1 -1
  56. package/dist/components/Variables/index.js +1 -0
  57. package/dist/components/Variables/index.js.map +1 -1
  58. package/dist/components/index.d.ts +2 -1
  59. package/dist/components/index.d.ts.map +1 -1
  60. package/dist/components/index.js +2 -1
  61. package/dist/components/index.js.map +1 -1
  62. package/dist/context/PanelEditorProvider/PanelEditorProvider.d.ts +13 -0
  63. package/dist/context/PanelEditorProvider/PanelEditorProvider.d.ts.map +1 -0
  64. package/dist/context/PanelEditorProvider/PanelEditorProvider.js +33 -0
  65. package/dist/context/PanelEditorProvider/PanelEditorProvider.js.map +1 -0
  66. package/dist/context/PanelEditorProvider/index.d.ts +3 -0
  67. package/dist/context/PanelEditorProvider/index.d.ts.map +1 -0
  68. package/dist/context/PanelEditorProvider/index.js +16 -0
  69. package/dist/context/PanelEditorProvider/index.js.map +1 -0
  70. package/dist/context/index.d.ts +1 -0
  71. package/dist/context/index.d.ts.map +1 -1
  72. package/dist/context/index.js +1 -0
  73. package/dist/context/index.js.map +1 -1
  74. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Variables/Variable.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useEffect, useMemo, useState } from 'react';\nimport { LinearProgress, TextField, Autocomplete, Popper, PopperProps } from '@mui/material';\nimport {\n DEFAULT_ALL_VALUE,\n ListVariableDefinition,\n ListVariableSpec,\n TextVariableDefinition,\n VariableName,\n VariableValue,\n} from '@perses-dev/core';\nimport { useListVariablePluginValues, VariableOption, VariableState } from '@perses-dev/plugin-system';\nimport { UseQueryResult } from '@tanstack/react-query';\nimport { useVariableDefinitionAndState, useVariableDefinitionActions } from '../../context';\nimport { MAX_VARIABLE_WIDTH, MIN_VARIABLE_WIDTH } from '../../constants';\n\ntype VariableProps = {\n name: VariableName;\n source?: string;\n};\n\nfunction variableOptionToVariableValue(options: VariableOption | VariableOption[] | null): VariableValue {\n if (options === null) {\n return null;\n }\n if (Array.isArray(options)) {\n return options.map((v) => {\n return v.value;\n });\n }\n return options.value;\n}\n\nexport function Variable({ name, source }: VariableProps): ReactElement {\n const ctx = useVariableDefinitionAndState(name, source);\n const kind = ctx.definition?.kind;\n switch (kind) {\n case 'TextVariable':\n return <TextVariable name={name} source={source} />;\n case 'ListVariable':\n return <ListVariable name={name} source={source} />;\n }\n\n return <div>Unsupported Variable Kind: ${kind}</div>;\n}\n\nexport function useListVariableState(\n spec: ListVariableSpec | undefined,\n state: VariableState | undefined,\n variablesOptionsQuery: Partial<UseQueryResult<VariableOption[]>>\n): {\n // Value, Loading, Options are modified only when we want to save the changes made\n value: VariableValue | undefined;\n loading: boolean;\n options: VariableOption[] | undefined;\n // selectedOptions is/are the option(s) selected in the view\n selectedOptions: VariableOption | VariableOption[];\n // viewOptions are the options used in the view only (= options + All if allowed)\n viewOptions: VariableOption[];\n} {\n const allowMultiple = spec?.allowMultiple === true;\n const allowAllValue = spec?.allowAllValue === true;\n const sort = spec?.sort;\n const loading = useMemo(() => variablesOptionsQuery.isFetching ?? false, [variablesOptionsQuery.isFetching]);\n const options = useMemo(() => variablesOptionsQuery.data ?? [], [variablesOptionsQuery.data]);\n\n let value = state?.value;\n\n // Make sure value is an array if allowMultiple is true\n if (allowMultiple && !Array.isArray(value)) {\n value = typeof value === 'string' ? [value] : [];\n }\n\n // Sort the provided list of options according to the method defined\n const sortedOptions = useMemo((): VariableOption[] => {\n const opts = options ? [...options] : [];\n\n if (!sort || sort === 'none') return opts;\n\n switch (sort) {\n case 'alphabetical-asc':\n return opts.sort((a, b) => (a.label > b.label ? 1 : -1));\n case 'alphabetical-desc':\n return opts.sort((a, b) => (a.label > b.label ? -1 : 1));\n case 'numerical-asc':\n return opts.sort((a, b) => (parseInt(a.label) > parseInt(b.label) ? 1 : -1));\n case 'numerical-desc':\n return opts.sort((a, b) => (parseInt(a.label) < parseInt(b.label) ? 1 : -1));\n case 'alphabetical-ci-asc':\n return opts.sort((a, b) => (a.label.toLowerCase() > b.label.toLowerCase() ? 1 : -1));\n case 'alphabetical-ci-desc':\n return opts.sort((a, b) => (a.label.toLowerCase() > b.label.toLowerCase() ? -1 : 1));\n default:\n return opts;\n }\n }, [options, sort]);\n\n const viewOptions = useMemo(() => {\n let computedOptions = sortedOptions;\n\n // Add the all value if it's allowed\n if (allowAllValue) {\n computedOptions = [{ value: DEFAULT_ALL_VALUE, label: 'All' }, ...computedOptions];\n }\n return computedOptions;\n }, [allowAllValue, sortedOptions]);\n\n const valueIsInOptions = useMemo(\n () =>\n Boolean(\n viewOptions.find((v) => {\n if (allowMultiple) {\n return (value as string[]).includes(v.value);\n }\n return value === v.value;\n })\n ),\n [viewOptions, value, allowMultiple]\n );\n\n value = useMemo(() => {\n const firstOptionValue = viewOptions?.[allowAllValue ? 1 : 0]?.value;\n\n // If there is no value but there are options, or the value is not in options, we set the value to the first option.\n if (firstOptionValue) {\n if (!valueIsInOptions || !value || value.length === 0) {\n return allowMultiple ? [firstOptionValue] : firstOptionValue;\n }\n }\n\n return value;\n }, [viewOptions, value, valueIsInOptions, allowMultiple, allowAllValue]);\n\n const selectedOptions = useMemo(() => {\n // In the case Autocomplete.multiple equals false, Autocomplete.value expects a single object, not\n // an array, hence this conditional\n if (Array.isArray(value)) {\n return viewOptions.filter((o) => {\n return value?.includes(o.value);\n });\n } else {\n return (\n viewOptions.find((o) => {\n return value === o.value;\n }) ?? { value: '', label: '' }\n );\n }\n }, [value, viewOptions]);\n\n return { value, loading, options, selectedOptions, viewOptions };\n}\n\nconst StyledPopper = (props: PopperProps): ReactElement => (\n <Popper {...props} sx={{ minWidth: 'fit-content' }} placement=\"bottom-start\" />\n);\n\nconst LETTER_HSIZE = 8; // approximation\nconst ARROW_OFFSET = 40; // right offset for list variables (= take into account the dropdown toggle size)\nconst getWidthPx = (inputValue: string, kind: 'list' | 'text'): number => {\n const width = (inputValue.length + 1) * LETTER_HSIZE + (kind === 'list' ? ARROW_OFFSET : 0);\n if (width < MIN_VARIABLE_WIDTH) {\n return MIN_VARIABLE_WIDTH;\n } else if (width > MAX_VARIABLE_WIDTH) {\n return MAX_VARIABLE_WIDTH;\n } else {\n return width;\n }\n};\n\nfunction ListVariable({ name, source }: VariableProps): ReactElement {\n const ctx = useVariableDefinitionAndState(name, source);\n const definition = ctx.definition as ListVariableDefinition;\n const variablesOptionsQuery = useListVariablePluginValues(definition);\n const { setVariableValue, setVariableLoading, setVariableOptions } = useVariableDefinitionActions();\n const { selectedOptions, value, loading, options, viewOptions } = useListVariableState(\n definition?.spec,\n ctx.state,\n variablesOptionsQuery\n );\n const [inputWidth, setInputWidth] = useState(MIN_VARIABLE_WIDTH);\n // Used for multiple value variables, it will not clear variable input when selecting an option\n const [inputValue, setInputValue] = useState('');\n\n const title = definition?.spec.display?.name ?? name;\n const allowMultiple = definition?.spec.allowMultiple === true;\n const allowAllValue = definition?.spec.allowAllValue === true;\n\n // Update value when changed\n useEffect(() => {\n if (value) {\n setVariableValue(name, value, source);\n }\n }, [setVariableValue, name, value, source]);\n\n // Update loading when changed\n useEffect(() => {\n setVariableLoading(name, loading, source);\n }, [setVariableLoading, name, loading, source]);\n\n // Update options when changed\n useEffect(() => {\n if (options) {\n setVariableOptions(name, options, source);\n }\n }, [setVariableOptions, name, options, source]);\n\n return (\n <>\n <Autocomplete\n disablePortal\n disableCloseOnSelect={allowMultiple}\n multiple={allowMultiple}\n fullWidth\n limitTags={3}\n size=\"small\"\n disableClearable\n slots={{ popper: StyledPopper }}\n renderInput={(params) => {\n return allowMultiple ? (\n <TextField {...params} label={title} onChange={(e) => setInputValue(e.target.value)} />\n ) : (\n <TextField {...params} label={title} style={{ width: `${inputWidth}px` }} />\n );\n }}\n sx={{\n '& .MuiInputBase-root': {\n minHeight: '38px',\n },\n '& .MuiAutocomplete-tag': {\n margin: '1px 2px', // Default margin of 2px (Y axis) make min height of the autocomplete 40px\n },\n }}\n value={selectedOptions}\n onChange={(_, value) => {\n if ((value === null || (Array.isArray(value) && value.length === 0)) && allowAllValue) {\n setVariableValue(name, DEFAULT_ALL_VALUE, source);\n } else {\n setVariableValue(name, variableOptionToVariableValue(value), source);\n }\n }}\n inputValue={allowMultiple ? inputValue : undefined}\n onInputChange={(_, newInputValue) => {\n if (!allowMultiple) {\n setInputWidth(getWidthPx(newInputValue, 'list'));\n }\n }}\n onBlur={() => {\n if (allowMultiple) {\n setInputValue('');\n }\n }}\n options={viewOptions}\n />\n {loading && <LinearProgress />}\n </>\n );\n}\n\nfunction TextVariable({ name, source }: VariableProps): ReactElement {\n const ctx = useVariableDefinitionAndState(name, source);\n const state = ctx.state;\n const definition = ctx.definition as TextVariableDefinition;\n const [tempValue, setTempValue] = useState(state?.value ?? '');\n const [inputWidth, setInputWidth] = useState(getWidthPx(tempValue as string, 'text'));\n const { setVariableValue } = useVariableDefinitionActions();\n\n useEffect(() => {\n setTempValue(state?.value ?? '');\n }, [state?.value]);\n\n return (\n <TextField\n title={tempValue as string}\n value={tempValue}\n onChange={(e) => {\n setTempValue(e.target.value);\n setInputWidth(getWidthPx(e.target.value, 'text'));\n }}\n onBlur={() => setVariableValue(name, tempValue, source)}\n placeholder={name}\n label={definition?.spec.display?.name ?? name}\n slotProps={{\n input: {\n readOnly: definition?.spec.constant ?? false,\n },\n }}\n sx={{\n width: `${inputWidth}px`,\n '& .MuiInputBase-root': {\n minHeight: '38px',\n },\n '& .MuiInputBase-input': {\n textOverflow: 'ellipsis',\n },\n }}\n />\n );\n}\n"],"names":["useEffect","useMemo","useState","LinearProgress","TextField","Autocomplete","Popper","DEFAULT_ALL_VALUE","useListVariablePluginValues","useVariableDefinitionAndState","useVariableDefinitionActions","MAX_VARIABLE_WIDTH","MIN_VARIABLE_WIDTH","variableOptionToVariableValue","options","Array","isArray","map","v","value","Variable","name","source","ctx","kind","definition","TextVariable","ListVariable","div","useListVariableState","spec","state","variablesOptionsQuery","allowMultiple","allowAllValue","sort","loading","isFetching","data","sortedOptions","opts","a","b","label","parseInt","toLowerCase","viewOptions","computedOptions","valueIsInOptions","Boolean","find","includes","firstOptionValue","length","selectedOptions","filter","o","StyledPopper","props","sx","minWidth","placement","LETTER_HSIZE","ARROW_OFFSET","getWidthPx","inputValue","width","setVariableValue","setVariableLoading","setVariableOptions","inputWidth","setInputWidth","setInputValue","title","display","disablePortal","disableCloseOnSelect","multiple","fullWidth","limitTags","size","disableClearable","slots","popper","renderInput","params","onChange","e","target","style","minHeight","margin","_","undefined","onInputChange","newInputValue","onBlur","tempValue","setTempValue","placeholder","slotProps","input","readOnly","constant","textOverflow"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AACnE,SAASC,cAAc,EAAEC,SAAS,EAAEC,YAAY,EAAEC,MAAM,QAAqB,gBAAgB;AAC7F,SACEC,iBAAiB,QAMZ,mBAAmB;AAC1B,SAASC,2BAA2B,QAAuC,4BAA4B;AAEvG,SAASC,6BAA6B,EAAEC,4BAA4B,QAAQ,gBAAgB;AAC5F,SAASC,kBAAkB,EAAEC,kBAAkB,QAAQ,kBAAkB;AAOzE,SAASC,8BAA8BC,OAAiD;IACtF,IAAIA,YAAY,MAAM;QACpB,OAAO;IACT;IACA,IAAIC,MAAMC,OAAO,CAACF,UAAU;QAC1B,OAAOA,QAAQG,GAAG,CAAC,CAACC;YAClB,OAAOA,EAAEC,KAAK;QAChB;IACF;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EAAEC,MAAM,CAACrE,KAAK,EAAE;QAC3C;QACA6E,QAAQ,IAAM7B,iBAAiB9C,MAAM4E,WAAW3E;QAChD6E,aAAa9E;QACbsB,OAAOlB,YAAYK,KAAK4C,SAASrD,QAAQA;QACzC+E,WAAW;YACTC,OAAO;gBACLC,UAAU7E,YAAYK,KAAKyE,YAAY;YACzC;QACF;QACA5C,IAAI;YACFO,OAAO,GAAGI,WAAW,EAAE,CAAC;YACxB,wBAAwB;gBACtBoB,WAAW;YACb;YACA,yBAAyB;gBACvBc,cAAc;YAChB;QACF;;AAGN"}
1
+ {"version":3,"sources":["../../../src/components/Variables/Variable.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useCallback, useEffect, useMemo, useState } from 'react';\nimport { TextField, Popper, PopperProps, Checkbox, Autocomplete, createFilterOptions } from '@mui/material';\nimport {\n DEFAULT_ALL_VALUE,\n ListVariableDefinition,\n ListVariableSpec,\n TextVariableDefinition,\n VariableName,\n VariableValue,\n} from '@perses-dev/core';\nimport {\n SORT_METHODS,\n SortMethodName,\n useListVariablePluginValues,\n VariableOption,\n VariableState,\n} from '@perses-dev/plugin-system';\nimport { UseQueryResult } from '@tanstack/react-query';\nimport { useVariableDefinitionAndState, useVariableDefinitionActions } from '../../context';\nimport { MAX_VARIABLE_WIDTH, MIN_VARIABLE_WIDTH } from '../../constants';\nimport { ListVariableListBoxProvider, ListVariableListBox } from './ListVariableListBox';\n\ntype VariableProps = {\n name: VariableName;\n source?: string;\n};\n\nfunction variableOptionToVariableValue(options: VariableOption | VariableOption[] | null): VariableValue {\n if (options === null) {\n return null;\n }\n if (Array.isArray(options)) {\n return options.map((v) => {\n return v.value;\n });\n }\n return options.value;\n}\n\nexport function Variable({ name, source }: VariableProps): ReactElement {\n const ctx = useVariableDefinitionAndState(name, source);\n const kind = ctx.definition?.kind;\n switch (kind) {\n case 'TextVariable':\n return <TextVariable name={name} source={source} />;\n case 'ListVariable':\n return <ListVariable name={name} source={source} />;\n }\n\n return <div>Unsupported Variable Kind: ${kind}</div>;\n}\n\nexport function useListVariableState(\n spec: ListVariableSpec | undefined,\n state: VariableState | undefined,\n variablesOptionsQuery: Partial<UseQueryResult<VariableOption[]>>\n): {\n // Value, Loading, Options are modified only when we want to save the changes made\n value: VariableValue | undefined;\n loading: boolean;\n options: VariableOption[] | undefined;\n // selectedOptions is/are the option(s) selected in the view\n selectedOptions: VariableOption | VariableOption[];\n // viewOptions are the options used in the view only (= options + All if allowed)\n viewOptions: VariableOption[];\n} {\n const allowMultiple = spec?.allowMultiple === true;\n const allowAllValue = spec?.allowAllValue === true;\n const sort = spec?.sort;\n const loading = useMemo(() => variablesOptionsQuery.isFetching ?? false, [variablesOptionsQuery.isFetching]);\n const options = useMemo(() => variablesOptionsQuery.data ?? [], [variablesOptionsQuery.data]);\n\n let value = state?.value;\n\n // Make sure value is an array if allowMultiple is true\n if (allowMultiple && !Array.isArray(value)) {\n value = typeof value === 'string' ? [value] : [];\n }\n\n // Sort the provided list of options according to the method defined\n const sortedOptions = useMemo((): VariableOption[] => {\n const opts = options ? [...options] : [];\n\n if (!sort || sort === 'none') return opts;\n const sortMethod = SORT_METHODS[sort as SortMethodName];\n return !sortMethod ? opts : sortMethod.sort(opts);\n }, [options, sort]);\n\n const viewOptions = useMemo(() => {\n let computedOptions = sortedOptions;\n\n // Add the all value if it's allowed\n if (allowAllValue) {\n computedOptions = [{ value: DEFAULT_ALL_VALUE, label: 'All' }, ...computedOptions];\n }\n return computedOptions;\n }, [allowAllValue, sortedOptions]);\n\n const valueIsInOptions = useMemo(\n () =>\n Boolean(\n viewOptions.find((v) => {\n if (allowMultiple) {\n return (value as string[]).includes(v.value);\n }\n return value === v.value;\n })\n ),\n [viewOptions, value, allowMultiple]\n );\n\n value = useMemo(() => {\n const firstOptionValue = viewOptions?.[allowAllValue ? 1 : 0]?.value;\n\n // If there is no value but there are options, or the value is not in options, we set the value to the first option.\n if (firstOptionValue) {\n if (!valueIsInOptions || !value || value.length === 0) {\n return allowMultiple ? [firstOptionValue] : firstOptionValue;\n }\n }\n\n return value;\n }, [viewOptions, value, valueIsInOptions, allowMultiple, allowAllValue]);\n\n const selectedOptions = useMemo(() => {\n // In the case Autocomplete.multiple equals false, Autocomplete.value expects a single object, not\n // an array, hence this conditional\n if (Array.isArray(value)) {\n return viewOptions.filter((o) => {\n return value?.includes(o.value);\n });\n } else {\n return (\n viewOptions.find((o) => {\n return value === o.value;\n }) ?? { value: '', label: '' }\n );\n }\n }, [value, viewOptions]);\n\n return { value, loading, options, selectedOptions, viewOptions };\n}\n\nconst StyledPopper = (props: PopperProps): ReactElement => (\n <Popper {...props} sx={{ minWidth: 'fit-content' }} placement=\"bottom-start\" />\n);\n\nconst LETTER_HSIZE = 8; // approximation\nconst ARROW_OFFSET = 40; // right offset for list variables (= take into account the dropdown toggle size)\nconst getWidthPx = (inputValue: string, kind: 'list' | 'text'): number => {\n const width = (inputValue.length + 1) * LETTER_HSIZE + (kind === 'list' ? ARROW_OFFSET : 0);\n if (width < MIN_VARIABLE_WIDTH) {\n return MIN_VARIABLE_WIDTH;\n } else if (width > MAX_VARIABLE_WIDTH) {\n return MAX_VARIABLE_WIDTH;\n } else {\n return width;\n }\n};\n\nfunction ListVariable({ name, source }: VariableProps): ReactElement {\n const ctx = useVariableDefinitionAndState(name, source);\n const definition = ctx.definition as ListVariableDefinition;\n const variablesOptionsQuery = useListVariablePluginValues(definition);\n const { setVariableValue, setVariableLoading, setVariableOptions } = useVariableDefinitionActions();\n const { selectedOptions, value, loading, options, viewOptions } = useListVariableState(\n definition?.spec,\n ctx.state,\n variablesOptionsQuery\n );\n const [inputWidth, setInputWidth] = useState(MIN_VARIABLE_WIDTH);\n // Used for multiple value variables, it will not clear variable input when selecting an option\n const [inputValue, setInputValue] = useState('');\n\n const title = definition?.spec.display?.name ?? name;\n const allowMultiple = definition?.spec.allowMultiple === true;\n const allowAllValue = definition?.spec.allowAllValue === true;\n\n const filterOptions = createFilterOptions<VariableOption>({});\n\n const filteredOptions = useMemo(\n () => filterOptions(viewOptions, { inputValue, getOptionLabel: (o) => o.label }),\n [inputValue, viewOptions, filterOptions]\n );\n\n // Update value when changed\n useEffect(() => {\n if (value) {\n setVariableValue(name, value, source);\n }\n }, [setVariableValue, name, value, source]);\n\n // Update loading when changed\n useEffect(() => {\n setVariableLoading(name, loading, source);\n }, [setVariableLoading, name, loading, source]);\n\n // Update options when changed\n useEffect(() => {\n if (options) {\n setVariableOptions(name, options, source);\n }\n }, [setVariableOptions, name, options, source]);\n\n const handleGlobalSelect = useCallback(\n (options: VariableOption[]): void => {\n setVariableValue(name, variableOptionToVariableValue(options), source);\n },\n [name, setVariableValue, source]\n );\n\n const listBoxProviderValue = useMemo(\n () => ({\n options: viewOptions,\n selectedOptions: selectedOptions as VariableOption[], // Only used when allowMultiple is true => selectedOptions is always an array\n filteredOptions: filteredOptions,\n allowAllValue,\n onChange: handleGlobalSelect,\n }),\n [allowAllValue, filteredOptions, handleGlobalSelect, selectedOptions, viewOptions]\n );\n\n const autocompleteComponent = useMemo(() => {\n return (\n <Autocomplete\n disablePortal\n loading={loading}\n disableCloseOnSelect={allowMultiple}\n multiple={allowMultiple}\n fullWidth\n limitTags={3}\n size=\"small\"\n disableClearable\n slotProps={{ listbox: { component: allowMultiple ? ListVariableListBox : undefined } }}\n slots={{ popper: StyledPopper }}\n sx={{\n '& .MuiInputBase-root': {\n minHeight: '38px',\n },\n '& .MuiAutocomplete-tag': {\n margin: '1px 2px', // Default margin of 2px (Y axis) make min height of the autocomplete 40px\n },\n }}\n filterOptions={filterOptions}\n options={viewOptions}\n value={selectedOptions}\n onChange={(_, value) => {\n if ((value === null || (Array.isArray(value) && value.length === 0)) && allowAllValue) {\n setVariableValue(name, DEFAULT_ALL_VALUE, source);\n } else {\n setVariableValue(name, variableOptionToVariableValue(value as VariableOption), source);\n }\n }}\n inputValue={allowMultiple ? inputValue : undefined}\n onInputChange={(_, newInputValue) => {\n if (!allowMultiple) {\n setInputWidth(getWidthPx(newInputValue, 'list'));\n }\n }}\n onBlur={() => {\n if (allowMultiple) {\n setInputValue('');\n }\n }}\n renderInput={(params) => {\n return allowMultiple ? (\n <TextField {...params} label={title} onChange={(e) => setInputValue(e.target.value)} />\n ) : (\n <TextField {...params} label={title} style={{ width: `${inputWidth}px` }} />\n );\n }}\n renderOption={(props, option, { selected }) => {\n const { key, ...optionProps } = props;\n return (\n <li key={key} {...optionProps} style={{ padding: 0 }}>\n <Checkbox style={{ marginRight: 8 }} checked={selected} />\n {option.label}\n </li>\n );\n }}\n />\n );\n }, [\n allowAllValue,\n allowMultiple,\n filterOptions,\n inputValue,\n inputWidth,\n loading,\n name,\n selectedOptions,\n setVariableValue,\n source,\n title,\n viewOptions,\n ]);\n\n if (allowMultiple) {\n return (\n <ListVariableListBoxProvider value={listBoxProviderValue}>{autocompleteComponent}</ListVariableListBoxProvider>\n );\n }\n\n return autocompleteComponent;\n}\n\nfunction TextVariable({ name, source }: VariableProps): ReactElement {\n const ctx = useVariableDefinitionAndState(name, source);\n const state = ctx.state;\n const definition = ctx.definition as TextVariableDefinition;\n const [tempValue, setTempValue] = useState(state?.value ?? '');\n const [inputWidth, setInputWidth] = useState(getWidthPx(tempValue as string, 'text'));\n const { setVariableValue } = useVariableDefinitionActions();\n\n useEffect(() => {\n setTempValue(state?.value ?? '');\n }, [state?.value]);\n\n return (\n <TextField\n title={tempValue as string}\n value={tempValue}\n onChange={(e) => {\n setTempValue(e.target.value);\n setInputWidth(getWidthPx(e.target.value, 'text'));\n }}\n onBlur={() => setVariableValue(name, tempValue, source)}\n placeholder={name}\n label={definition?.spec.display?.name ?? name}\n slotProps={{\n input: {\n readOnly: definition?.spec.constant ?? false,\n },\n }}\n sx={{\n width: `${inputWidth}px`,\n '& .MuiInputBase-root': {\n minHeight: '38px',\n },\n '& .MuiInputBase-input': {\n textOverflow: 'ellipsis',\n },\n }}\n />\n );\n}\n"],"names":["useCallback","useEffect","useMemo","useState","TextField","Popper","Checkbox","Autocomplete","createFilterOptions","DEFAULT_ALL_VALUE","SORT_METHODS","useListVariablePluginValues","useVariableDefinitionAndState","useVariableDefinitionActions","MAX_VARIABLE_WIDTH","MIN_VARIABLE_WIDTH","ListVariableListBoxProvider","ListVariableListBox","variableOptionToVariableValue","options","Array","isArray","map","v","value","Variable","name","source","ctx","kind","definition","TextVariable","ListVariable","div","useListVariableState","spec","state","variablesOptionsQuery","allowMultiple","allowAllValue","sort","loading","isFetching","data","sortedOptions","opts","sortMethod","viewOptions","computedOptions","label","valueIsInOptions","Boolean","find","includes","firstOptionValue","length","selectedOptions","filter","o","StyledPopper","props","sx","minWidth","placement","LETTER_HSIZE","ARROW_OFFSET","getWidthPx","inputValue","width","setVariableValue","setVariableLoading","setVariableOptions","inputWidth","setInputWidth","setInputValue","title","display","filterOptions","filteredOptions","getOptionLabel","handleGlobalSelect","listBoxProviderValue","onChange","autocompleteComponent","disablePortal","disableCloseOnSelect","multiple","fullWidth","limitTags","size","disableClearable","slotProps","listbox","component","undefined","slots","popper","minHeight","margin","_","onInputChange","newInputValue","onBlur","renderInput","params","e","target","style","renderOption","option","selected","key","optionProps","li","padding","marginRight","checked","tempValue","setTempValue","placeholder","input","readOnly","constant","textOverflow"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAAuBA,WAAW,EAAEC,SAAS,EAAEC,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YACA,yBAAyB;gBACvB0B,cAAc;YAChB;QACF;;AAGN"}
@@ -1,5 +1,6 @@
1
1
  export * from './BuiltinVariableAccordions';
2
2
  export * from './EditVariablesButton';
3
+ export * from './ListVariableListBox';
3
4
  export * from './Variable';
4
5
  export * from './VariableEditor';
5
6
  export * from './VariableList';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Variables/index.tsx"],"names":[],"mappings":"AAaA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Variables/index.tsx"],"names":[],"mappings":"AAaA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
@@ -12,6 +12,7 @@
12
12
  // limitations under the License.
13
13
  export * from './BuiltinVariableAccordions';
14
14
  export * from './EditVariablesButton';
15
+ export * from './ListVariableListBox';
15
16
  export * from './Variable';
16
17
  export * from './VariableEditor';
17
18
  export * from './VariableList';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/Variables/index.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './BuiltinVariableAccordions';\nexport * from './EditVariablesButton';\nexport * from './Variable';\nexport * from './VariableEditor';\nexport * from './VariableList';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,8BAA8B;AAC5C,cAAc,wBAAwB;AACtC,cAAc,aAAa;AAC3B,cAAc,mBAAmB;AACjC,cAAc,iBAAiB"}
1
+ {"version":3,"sources":["../../../src/components/Variables/index.tsx"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './BuiltinVariableAccordions';\nexport * from './EditVariablesButton';\nexport * from './ListVariableListBox';\nexport * from './Variable';\nexport * from './VariableEditor';\nexport * from './VariableList';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,8BAA8B;AAC5C,cAAc,wBAAwB;AACtC,cAAc,wBAAwB;AACtC,cAAc,aAAa;AAC3B,cAAc,mBAAmB;AACjC,cAAc,iBAAiB"}
@@ -8,8 +8,8 @@ export * from './DeletePanelDialog';
8
8
  export * from './DeletePanelGroupDialog';
9
9
  export * from './DiscardChangesConfirmationDialog';
10
10
  export * from './DownloadButton';
11
- export * from './EditJsonButton';
12
11
  export * from './EditJsonDialog';
12
+ export * from './EditJsonButton';
13
13
  export * from './EmptyDashboard';
14
14
  export * from './GridLayout';
15
15
  export * from './LeaveDialog';
@@ -17,6 +17,7 @@ export * from './Panel';
17
17
  export * from './PanelDrawer';
18
18
  export * from './PanelGroupDialog';
19
19
  export * from './QuerySummaryTable';
20
+ export * from './QueryViewerDialog';
20
21
  export * from './SaveChangesConfirmationDialog';
21
22
  export * from './SaveDashboardButton';
22
23
  export * from './Variables';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iCAAiC,CAAC;AAChD,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC"}
@@ -20,8 +20,8 @@ export * from './DeletePanelDialog';
20
20
  export * from './DeletePanelGroupDialog';
21
21
  export * from './DiscardChangesConfirmationDialog';
22
22
  export * from './DownloadButton';
23
- export * from './EditJsonButton';
24
23
  export * from './EditJsonDialog';
24
+ export * from './EditJsonButton';
25
25
  export * from './EmptyDashboard';
26
26
  export * from './GridLayout';
27
27
  export * from './LeaveDialog';
@@ -29,6 +29,7 @@ export * from './Panel';
29
29
  export * from './PanelDrawer';
30
30
  export * from './PanelGroupDialog';
31
31
  export * from './QuerySummaryTable';
32
+ export * from './QueryViewerDialog';
32
33
  export * from './SaveChangesConfirmationDialog';
33
34
  export * from './SaveDashboardButton';
34
35
  export * from './Variables';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './AddGroupButton';\nexport * from './AddPanelButton';\nexport * from './Dashboard';\nexport * from './DashboardToolbar';\nexport * from './DashboardStickyToolbar';\nexport * from './Datasources';\nexport * from './DeletePanelDialog';\nexport * from './DeletePanelGroupDialog';\nexport * from './DiscardChangesConfirmationDialog';\nexport * from './DownloadButton';\nexport * from './EditJsonButton';\nexport * from './EditJsonDialog';\nexport * from './EmptyDashboard';\nexport * from './GridLayout';\nexport * from './LeaveDialog';\nexport * from './Panel';\nexport * from './PanelDrawer';\nexport * from './PanelGroupDialog';\nexport * from './QuerySummaryTable';\nexport * from './SaveChangesConfirmationDialog';\nexport * from './SaveDashboardButton';\nexport * from './Variables';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,cAAc;AAC5B,cAAc,qBAAqB;AACnC,cAAc,2BAA2B;AACzC,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,2BAA2B;AACzC,cAAc,qCAAqC;AACnD,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,UAAU;AACxB,cAAc,gBAAgB;AAC9B,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cAAc,kCAAkC;AAChD,cAAc,wBAAwB;AACtC,cAAc,cAAc"}
1
+ {"version":3,"sources":["../../src/components/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './AddGroupButton';\nexport * from './AddPanelButton';\nexport * from './Dashboard';\nexport * from './DashboardToolbar';\nexport * from './DashboardStickyToolbar';\nexport * from './Datasources';\nexport * from './DeletePanelDialog';\nexport * from './DeletePanelGroupDialog';\nexport * from './DiscardChangesConfirmationDialog';\nexport * from './DownloadButton';\nexport * from './EditJsonDialog';\nexport * from './EditJsonButton';\nexport * from './EmptyDashboard';\nexport * from './GridLayout';\nexport * from './LeaveDialog';\nexport * from './Panel';\nexport * from './PanelDrawer';\nexport * from './PanelGroupDialog';\nexport * from './QuerySummaryTable';\nexport * from './QueryViewerDialog';\nexport * from './SaveChangesConfirmationDialog';\nexport * from './SaveDashboardButton';\nexport * from './Variables';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,cAAc;AAC5B,cAAc,qBAAqB;AACnC,cAAc,2BAA2B;AACzC,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,2BAA2B;AACzC,cAAc,qCAAqC;AACnD,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,UAAU;AACxB,cAAc,gBAAgB;AAC9B,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,kCAAkC;AAChD,cAAc,wBAAwB;AACtC,cAAc,cAAc"}
@@ -0,0 +1,13 @@
1
+ import { ReactElement } from 'react';
2
+ export interface PanelEditor {
3
+ preview: {
4
+ previewPanelWidth?: number;
5
+ setPreviewPanelWidth?: (width: number) => void;
6
+ };
7
+ }
8
+ export interface PanelEditorProviderProps {
9
+ children: React.ReactNode;
10
+ }
11
+ export declare const PanelEditorContext: import("react").Context<PanelEditor | undefined>;
12
+ export declare const PanelEditorProvider: ({ children }: PanelEditorProviderProps) => ReactElement;
13
+ //# sourceMappingURL=PanelEditorProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PanelEditorProvider.d.ts","sourceRoot":"","sources":["../../../src/context/PanelEditorProvider/PanelEditorProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAiB,YAAY,EAAqB,MAAM,OAAO,CAAC;AAEvE,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE;QACP,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;KAChD,CAAC;CACH;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,eAAO,MAAM,kBAAkB,kDAAoD,CAAC;AAEpF,eAAO,MAAM,mBAAmB,iBAAkB,wBAAwB,KAAG,YAc5E,CAAC"}
@@ -0,0 +1,33 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { createContext, useMemo, useState } from 'react';
15
+ export const PanelEditorContext = /*#__PURE__*/ createContext(undefined);
16
+ export const PanelEditorProvider = ({ children })=>{
17
+ const [previewPanelWidth, setPreviewPanelWidth] = useState(undefined);
18
+ const ctx = useMemo(()=>({
19
+ preview: {
20
+ previewPanelWidth,
21
+ setPreviewPanelWidth
22
+ }
23
+ }), [
24
+ previewPanelWidth,
25
+ setPreviewPanelWidth
26
+ ]);
27
+ return /*#__PURE__*/ _jsx(PanelEditorContext.Provider, {
28
+ value: ctx,
29
+ children: children
30
+ });
31
+ };
32
+
33
+ //# sourceMappingURL=PanelEditorProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/context/PanelEditorProvider/PanelEditorProvider.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { createContext, ReactElement, useMemo, useState } from 'react';\n\nexport interface PanelEditor {\n preview: {\n previewPanelWidth?: number;\n setPreviewPanelWidth?: (width: number) => void;\n };\n}\n\nexport interface PanelEditorProviderProps {\n children: React.ReactNode;\n}\n\nexport const PanelEditorContext = createContext<PanelEditor | undefined>(undefined);\n\nexport const PanelEditorProvider = ({ children }: PanelEditorProviderProps): ReactElement => {\n const [previewPanelWidth, setPreviewPanelWidth] = useState<number | undefined>(undefined);\n\n const ctx = useMemo(\n (): PanelEditor => ({\n preview: {\n previewPanelWidth,\n setPreviewPanelWidth,\n },\n }),\n [previewPanelWidth, setPreviewPanelWidth]\n );\n\n return <PanelEditorContext.Provider value={ctx}>{children}</PanelEditorContext.Provider>;\n};\n"],"names":["createContext","useMemo","useState","PanelEditorContext","undefined","PanelEditorProvider","children","previewPanelWidth","setPreviewPanelWidth","ctx","preview","Provider","value"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,aAAa,EAAgBC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAavE,OAAO,MAAMC,mCAAqBH,cAAuCI,WAAW;AAEpF,OAAO,MAAMC,sBAAsB,CAAC,EAAEC,QAAQ,EAA4B;IACxE,MAAM,CAACC,mBAAmBC,qBAAqB,GAAGN,SAA6BE;IAE/E,MAAMK,MAAMR,QACV,IAAoB,CAAA;YAClBS,SAAS;gBACPH;gBACAC;YACF;QACF,CAAA,GACA;QAACD;QAAmBC;KAAqB;IAG3C,qBAAO,KAACL,mBAAmBQ,QAAQ;QAACC,OAAOH;kBAAMH;;AACnD,EAAE"}
@@ -0,0 +1,3 @@
1
+ import { PanelEditorContext } from './PanelEditorProvider';
2
+ export { PanelEditorContext };
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/context/PanelEditorProvider/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1,16 @@
1
+ // Copyright 2025 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { PanelEditorContext } from './PanelEditorProvider';
14
+ export { PanelEditorContext };
15
+
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/context/PanelEditorProvider/index.ts"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { PanelEditorContext } from './PanelEditorProvider';\n\nexport { PanelEditorContext };\n"],"names":["PanelEditorContext"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,kBAAkB,QAAQ,wBAAwB;AAE3D,SAASA,kBAAkB,GAAG"}
@@ -2,4 +2,5 @@ export * from './DashboardProvider';
2
2
  export * from './DatasourceStoreProvider';
3
3
  export * from './VariableProvider';
4
4
  export * from './useDashboard';
5
+ export * from './PanelEditorProvider';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/context/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC"}
@@ -14,5 +14,6 @@ export * from './DashboardProvider';
14
14
  export * from './DatasourceStoreProvider';
15
15
  export * from './VariableProvider';
16
16
  export * from './useDashboard';
17
+ export * from './PanelEditorProvider';
17
18
 
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/context/index.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DashboardProvider';\nexport * from './DatasourceStoreProvider';\nexport * from './VariableProvider';\nexport * from './useDashboard';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,sBAAsB;AACpC,cAAc,4BAA4B;AAC1C,cAAc,qBAAqB;AACnC,cAAc,iBAAiB"}
1
+ {"version":3,"sources":["../../src/context/index.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './DashboardProvider';\nexport * from './DatasourceStoreProvider';\nexport * from './VariableProvider';\nexport * from './useDashboard';\nexport * from './PanelEditorProvider';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,sBAAsB;AACpC,cAAc,4BAA4B;AAC1C,cAAc,qBAAqB;AACnC,cAAc,iBAAiB;AAC/B,cAAc,wBAAwB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/dashboards",
3
- "version": "0.52.0",
3
+ "version": "0.53.0-beta.0",
4
4
  "description": "The dashboards feature in Perses",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",
@@ -29,9 +29,9 @@
29
29
  "lint:fix": "eslint --fix src --ext .ts,.tsx"
30
30
  },
31
31
  "dependencies": {
32
- "@perses-dev/components": "0.52.0",
33
- "@perses-dev/core": "0.52.0",
34
- "@perses-dev/plugin-system": "0.52.0",
32
+ "@perses-dev/components": "0.53.0-beta.0",
33
+ "@perses-dev/core": "0.53.0-beta.0",
34
+ "@perses-dev/plugin-system": "0.53.0-beta.0",
35
35
  "@types/react-grid-layout": "^1.3.2",
36
36
  "date-fns": "^4.1.0",
37
37
  "immer": "^10.1.1",
@@ -46,7 +46,7 @@
46
46
  "zustand": "^4.3.3"
47
47
  },
48
48
  "devDependencies": {
49
- "@perses-dev/internal-utils": "0.52.0",
49
+ "@perses-dev/internal-utils": "0.53.0-beta.0",
50
50
  "history": "^5.3.0",
51
51
  "intersection-observer": "^0.12.2"
52
52
  },