@perses-dev/components 0.46.0-rc1 → 0.47.0-rc0

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 (136) hide show
  1. package/dist/AlignSelector/AlignSelector.d.ts +8 -0
  2. package/dist/AlignSelector/AlignSelector.d.ts.map +1 -0
  3. package/dist/AlignSelector/AlignSelector.js +45 -0
  4. package/dist/AlignSelector/AlignSelector.js.map +1 -0
  5. package/dist/AlignSelector/index.d.ts +2 -0
  6. package/dist/AlignSelector/index.d.ts.map +1 -0
  7. package/dist/AlignSelector/index.js +15 -0
  8. package/dist/AlignSelector/index.js.map +1 -0
  9. package/dist/ColorPicker/OptionsColorPicker.d.ts +7 -0
  10. package/dist/ColorPicker/OptionsColorPicker.d.ts.map +1 -0
  11. package/dist/{ThresholdsEditor/ThresholdColorPicker.js → ColorPicker/OptionsColorPicker.js} +5 -5
  12. package/dist/ColorPicker/OptionsColorPicker.js.map +1 -0
  13. package/dist/ColorPicker/index.d.ts +1 -0
  14. package/dist/ColorPicker/index.d.ts.map +1 -1
  15. package/dist/ColorPicker/index.js +1 -0
  16. package/dist/ColorPicker/index.js.map +1 -1
  17. package/dist/DensitySelector/DensitySelector.d.ts +7 -0
  18. package/dist/DensitySelector/DensitySelector.d.ts.map +1 -0
  19. package/dist/DensitySelector/DensitySelector.js +46 -0
  20. package/dist/DensitySelector/DensitySelector.js.map +1 -0
  21. package/dist/DensitySelector/index.d.ts +2 -0
  22. package/dist/DensitySelector/index.d.ts.map +1 -0
  23. package/dist/DensitySelector/index.js +15 -0
  24. package/dist/DensitySelector/index.js.map +1 -0
  25. package/dist/Dialog/Dialog.d.ts +2 -7
  26. package/dist/Dialog/Dialog.d.ts.map +1 -1
  27. package/dist/Dialog/Dialog.js +7 -2
  28. package/dist/Dialog/Dialog.js.map +1 -1
  29. package/dist/LinksEditor/LinksEditor.d.ts +6 -1
  30. package/dist/LinksEditor/LinksEditor.d.ts.map +1 -1
  31. package/dist/LinksEditor/LinksEditor.js +15 -8
  32. package/dist/LinksEditor/LinksEditor.js.map +1 -1
  33. package/dist/Overlay/Overlay.d.ts +15 -0
  34. package/dist/Overlay/Overlay.d.ts.map +1 -0
  35. package/dist/Overlay/Overlay.js +52 -0
  36. package/dist/Overlay/Overlay.js.map +1 -0
  37. package/dist/Overlay/index.d.ts +2 -0
  38. package/dist/Overlay/index.d.ts.map +1 -0
  39. package/dist/Overlay/index.js +15 -0
  40. package/dist/Overlay/index.js.map +1 -0
  41. package/dist/SortSelector/SortSelectorButtons.d.ts +8 -0
  42. package/dist/SortSelector/SortSelectorButtons.d.ts.map +1 -0
  43. package/dist/SortSelector/SortSelectorButtons.js +45 -0
  44. package/dist/SortSelector/SortSelectorButtons.js.map +1 -0
  45. package/dist/SortSelector/index.d.ts +1 -0
  46. package/dist/SortSelector/index.d.ts.map +1 -1
  47. package/dist/SortSelector/index.js +2 -1
  48. package/dist/SortSelector/index.js.map +1 -1
  49. package/dist/Table/InnerTable.d.ts.map +1 -1
  50. package/dist/Table/InnerTable.js +2 -1
  51. package/dist/Table/InnerTable.js.map +1 -1
  52. package/dist/Table/TableCell.d.ts +1 -1
  53. package/dist/Table/TableCell.d.ts.map +1 -1
  54. package/dist/Table/TableCell.js +3 -1
  55. package/dist/Table/TableCell.js.map +1 -1
  56. package/dist/Table/TableHeaderCell.d.ts +1 -1
  57. package/dist/Table/TableHeaderCell.d.ts.map +1 -1
  58. package/dist/Table/TableHeaderCell.js.map +1 -1
  59. package/dist/Table/model/table-model.d.ts +1 -1
  60. package/dist/Table/model/table-model.d.ts.map +1 -1
  61. package/dist/Table/model/table-model.js +25 -20
  62. package/dist/Table/model/table-model.js.map +1 -1
  63. package/dist/ThresholdsEditor/ThresholdInput.js +2 -2
  64. package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
  65. package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
  66. package/dist/ThresholdsEditor/ThresholdsEditor.js +2 -2
  67. package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
  68. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +18 -0
  69. package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -0
  70. package/dist/{DateTimeRangePicker/AbsoluteTimePicker.js → TimeRangeSelector/DateTimeRangePicker.js} +45 -28
  71. package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -0
  72. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +35 -0
  73. package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -0
  74. package/dist/TimeRangeSelector/TimeRangeSelector.js +119 -0
  75. package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -0
  76. package/dist/{DateTimeRangePicker → TimeRangeSelector}/index.d.ts +1 -2
  77. package/dist/TimeRangeSelector/index.d.ts.map +1 -0
  78. package/dist/{DateTimeRangePicker → TimeRangeSelector}/index.js +2 -3
  79. package/dist/TimeRangeSelector/index.js.map +1 -0
  80. package/dist/TimeRangeSelector/utils.d.ts +25 -0
  81. package/dist/TimeRangeSelector/utils.d.ts.map +1 -0
  82. package/dist/{DateTimeRangePicker → TimeRangeSelector}/utils.js +23 -2
  83. package/dist/TimeRangeSelector/utils.js.map +1 -0
  84. package/dist/cjs/AlignSelector/AlignSelector.js +53 -0
  85. package/dist/cjs/AlignSelector/index.js +30 -0
  86. package/dist/cjs/{ThresholdsEditor/ThresholdColorPicker.js → ColorPicker/OptionsColorPicker.js} +6 -6
  87. package/dist/cjs/ColorPicker/index.js +1 -0
  88. package/dist/cjs/DensitySelector/DensitySelector.js +54 -0
  89. package/dist/cjs/DensitySelector/index.js +30 -0
  90. package/dist/cjs/Dialog/Dialog.js +7 -2
  91. package/dist/cjs/LinksEditor/LinksEditor.js +15 -8
  92. package/dist/cjs/Overlay/Overlay.js +71 -0
  93. package/dist/cjs/Overlay/index.js +30 -0
  94. package/dist/cjs/SortSelector/SortSelectorButtons.js +53 -0
  95. package/dist/cjs/SortSelector/index.js +2 -1
  96. package/dist/cjs/Table/InnerTable.js +2 -1
  97. package/dist/cjs/Table/TableCell.js +3 -1
  98. package/dist/cjs/Table/model/table-model.js +25 -20
  99. package/dist/cjs/ThresholdsEditor/ThresholdInput.js +2 -2
  100. package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +2 -2
  101. package/dist/cjs/{DateTimeRangePicker/AbsoluteTimePicker.js → TimeRangeSelector/DateTimeRangePicker.js} +39 -30
  102. package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +127 -0
  103. package/dist/cjs/{DateTimeRangePicker → TimeRangeSelector}/index.js +2 -3
  104. package/dist/cjs/{DateTimeRangePicker → TimeRangeSelector}/utils.js +24 -1
  105. package/dist/cjs/index.js +4 -1
  106. package/dist/cjs/model/timeOption.js +19 -1
  107. package/dist/index.d.ts +4 -1
  108. package/dist/index.d.ts.map +1 -1
  109. package/dist/index.js +4 -1
  110. package/dist/index.js.map +1 -1
  111. package/dist/model/timeOption.d.ts +2 -1
  112. package/dist/model/timeOption.d.ts.map +1 -1
  113. package/dist/model/timeOption.js +13 -2
  114. package/dist/model/timeOption.js.map +1 -1
  115. package/package.json +7 -6
  116. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +0 -9
  117. package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +0 -1
  118. package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +0 -1
  119. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +0 -11
  120. package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +0 -1
  121. package/dist/DateTimeRangePicker/DateTimeRangePicker.js +0 -80
  122. package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +0 -1
  123. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts +0 -13
  124. package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +0 -1
  125. package/dist/DateTimeRangePicker/TimeRangeSelector.js +0 -67
  126. package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +0 -1
  127. package/dist/DateTimeRangePicker/index.d.ts.map +0 -1
  128. package/dist/DateTimeRangePicker/index.js.map +0 -1
  129. package/dist/DateTimeRangePicker/utils.d.ts +0 -7
  130. package/dist/DateTimeRangePicker/utils.d.ts.map +0 -1
  131. package/dist/DateTimeRangePicker/utils.js.map +0 -1
  132. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts +0 -3
  133. package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts.map +0 -1
  134. package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +0 -1
  135. package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +0 -88
  136. package/dist/cjs/DateTimeRangePicker/TimeRangeSelector.js +0 -80
@@ -0,0 +1,8 @@
1
+ import { ButtonGroupProps } from '@mui/material';
2
+ export type AlignOption = 'left' | 'center' | 'right';
3
+ export interface AlignSelectorProps extends Omit<ButtonGroupProps, 'onChange'> {
4
+ onChange: (align: AlignOption) => void;
5
+ value?: AlignOption;
6
+ }
7
+ export declare function AlignSelector({ onChange, value, ...props }: AlignSelectorProps): import("react/jsx-runtime").JSX.Element;
8
+ //# sourceMappingURL=AlignSelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlignSelector.d.ts","sourceRoot":"","sources":["../../src/AlignSelector/AlignSelector.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAuB,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtE,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,gBAAgB,EAAE,UAAU,CAAC;IAC5E,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAAE,QAAQ,EAAE,KAAc,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,2CA0BvF"}
@@ -0,0 +1,45 @@
1
+ // Copyright 2024 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, jsxs as _jsxs } from "react/jsx-runtime";
14
+ import { Button, ButtonGroup } from '@mui/material';
15
+ export function AlignSelector({ onChange, value = 'left', ...props }) {
16
+ const handleSortChange = (option)=>{
17
+ onChange(option);
18
+ };
19
+ return /*#__PURE__*/ _jsxs(ButtonGroup, {
20
+ "aria-label": "Alignement",
21
+ sx: {
22
+ margin: 1
23
+ },
24
+ ...props,
25
+ children: [
26
+ /*#__PURE__*/ _jsx(Button, {
27
+ onClick: ()=>handleSortChange('left'),
28
+ variant: value === 'left' ? 'contained' : 'outlined',
29
+ children: "Left"
30
+ }, "left"),
31
+ /*#__PURE__*/ _jsx(Button, {
32
+ onClick: ()=>handleSortChange('center'),
33
+ variant: value === 'center' ? 'contained' : 'outlined',
34
+ children: "Center"
35
+ }, "center"),
36
+ /*#__PURE__*/ _jsx(Button, {
37
+ onClick: ()=>handleSortChange('right'),
38
+ variant: value === 'right' ? 'contained' : 'outlined',
39
+ children: "Right"
40
+ }, "right")
41
+ ]
42
+ });
43
+ }
44
+
45
+ //# sourceMappingURL=AlignSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/AlignSelector/AlignSelector.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 { Button, ButtonGroup, ButtonGroupProps } from '@mui/material';\n\nexport type AlignOption = 'left' | 'center' | 'right';\n\nexport interface AlignSelectorProps extends Omit<ButtonGroupProps, 'onChange'> {\n onChange: (align: AlignOption) => void;\n value?: AlignOption;\n}\n\nexport function AlignSelector({ onChange, value = 'left', ...props }: AlignSelectorProps) {\n const handleSortChange = (option: AlignOption) => {\n onChange(option);\n };\n\n return (\n <ButtonGroup aria-label=\"Alignement\" sx={{ margin: 1 }} {...props}>\n <Button key=\"left\" onClick={() => handleSortChange('left')} variant={value === 'left' ? 'contained' : 'outlined'}>\n Left\n </Button>\n <Button\n key=\"center\"\n onClick={() => handleSortChange('center')}\n variant={value === 'center' ? 'contained' : 'outlined'}\n >\n Center\n </Button>\n <Button\n key=\"right\"\n onClick={() => handleSortChange('right')}\n variant={value === 'right' ? 'contained' : 'outlined'}\n >\n Right\n </Button>\n </ButtonGroup>\n );\n}\n"],"names":["Button","ButtonGroup","AlignSelector","onChange","value","props","handleSortChange","option","aria-label","sx","margin","onClick","variant"],"mappings":"AAAA,oCAAoC;AACpC,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,EAAEC,WAAW,QAA0B,gBAAgB;AAStE,OAAO,SAASC,cAAc,EAAEC,QAAQ,EAAEC,QAAQ,MAAM,EAAE,GAAGC,OAA2B;IACtF,MAAMC,mBAAmB,CAACC;QACxBJ,SAASI;IACX;IAEA,qBACE,MAACN;QAAYO,cAAW;QAAaC,IAAI;YAAEC,QAAQ;QAAE;QAAI,GAAGL,KAAK;;0BAC/D,KAACL;gBAAkBW,SAAS,IAAML,iBAAiB;gBAASM,SAASR,UAAU,SAAS,cAAc;0BAAY;eAAtG;0BAGZ,KAACJ;gBAECW,SAAS,IAAML,iBAAiB;gBAChCM,SAASR,UAAU,WAAW,cAAc;0BAC7C;eAHK;0BAMN,KAACJ;gBAECW,SAAS,IAAML,iBAAiB;gBAChCM,SAASR,UAAU,UAAU,cAAc;0BAC5C;eAHK;;;AAQZ"}
@@ -0,0 +1,2 @@
1
+ export * from './AlignSelector';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/AlignSelector/index.ts"],"names":[],"mappings":"AAaA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright 2024 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
+ export * from './AlignSelector';
14
+
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/AlignSelector/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 './AlignSelector';\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,kBAAkB"}
@@ -0,0 +1,7 @@
1
+ export interface OptionsColorPickerProps {
2
+ label: string;
3
+ color: string;
4
+ onColorChange: (color: string) => void;
5
+ }
6
+ export declare function OptionsColorPicker({ color, onColorChange, label }: OptionsColorPickerProps): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=OptionsColorPicker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OptionsColorPicker.d.ts","sourceRoot":"","sources":["../../src/ColorPicker/OptionsColorPicker.tsx"],"names":[],"mappings":"AAmBA,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACxC;AAED,wBAAgB,kBAAkB,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,EAAE,uBAAuB,2CA8C1F"}
@@ -15,8 +15,8 @@ import React from 'react';
15
15
  import { styled, IconButton, Popover } from '@mui/material';
16
16
  import CircleIcon from 'mdi-material-ui/Circle';
17
17
  import { useChartsTheme } from '../context/ChartsProvider';
18
- import { ColorPicker } from '../ColorPicker';
19
- export function ThresholdColorPicker({ color, onColorChange, label }) {
18
+ import { ColorPicker } from './ColorPicker';
19
+ export function OptionsColorPicker({ color, onColorChange, label }) {
20
20
  const [anchorEl, setAnchorEl] = React.useState(null);
21
21
  const isOpen = Boolean(anchorEl);
22
22
  const openColorPicker = (event)=>{
@@ -30,14 +30,14 @@ export function ThresholdColorPicker({ color, onColorChange, label }) {
30
30
  children: [
31
31
  /*#__PURE__*/ _jsx(ColorIconButton, {
32
32
  size: "small",
33
- "aria-label": `change threshold ${label} color`,
33
+ "aria-label": `change ${label} color`,
34
34
  isSelected: isOpen,
35
35
  iconColor: color,
36
36
  onClick: openColorPicker,
37
37
  children: /*#__PURE__*/ _jsx(CircleIcon, {})
38
38
  }),
39
39
  /*#__PURE__*/ _jsx(Popover, {
40
- "data-testid": "threshold color picker",
40
+ "data-testid": "options color picker",
41
41
  open: isOpen,
42
42
  anchorEl: anchorEl,
43
43
  onClose: closeColorPicker,
@@ -73,4 +73,4 @@ const ColorIconButton = styled(IconButton, {
73
73
  color: iconColor
74
74
  }));
75
75
 
76
- //# sourceMappingURL=ThresholdColorPicker.js.map
76
+ //# sourceMappingURL=OptionsColorPicker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/ColorPicker/OptionsColorPicker.tsx"],"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\nimport React from 'react';\nimport { styled, IconButton, Popover } from '@mui/material';\nimport CircleIcon from 'mdi-material-ui/Circle';\nimport { useChartsTheme } from '../context/ChartsProvider';\nimport { ColorPicker } from './ColorPicker';\n\nexport interface OptionsColorPickerProps {\n label: string;\n color: string;\n onColorChange: (color: string) => void;\n}\n\nexport function OptionsColorPicker({ color, onColorChange, label }: OptionsColorPickerProps) {\n const [anchorEl, setAnchorEl] = React.useState<HTMLButtonElement | null>(null);\n const isOpen = Boolean(anchorEl);\n\n const openColorPicker = (event: React.MouseEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n };\n\n const closeColorPicker = () => {\n setAnchorEl(null);\n };\n\n const {\n thresholds: { defaultColor, palette },\n } = useChartsTheme();\n\n return (\n <>\n <ColorIconButton\n size=\"small\"\n aria-label={`change ${label} color`}\n isSelected={isOpen}\n iconColor={color}\n onClick={openColorPicker}\n >\n <CircleIcon />\n </ColorIconButton>\n <Popover\n data-testid=\"options color picker\"\n open={isOpen}\n anchorEl={anchorEl}\n onClose={closeColorPicker}\n PaperProps={{ sx: { padding: (theme) => theme.spacing(2) } }}\n anchorOrigin={{\n vertical: 'top',\n horizontal: 'left',\n }}\n transformOrigin={{\n vertical: 'top',\n horizontal: 'right',\n }}\n >\n <ColorPicker color={color} onChange={onColorChange} palette={[defaultColor, ...palette]} />\n </Popover>\n </>\n );\n}\n\nconst ColorIconButton = styled(IconButton, {\n shouldForwardProp: (props) => props !== 'isSelected' && props !== 'iconColor',\n})<{\n iconColor?: string;\n isSelected?: boolean;\n}>(({ iconColor, isSelected }) => ({\n backgroundColor: isSelected && iconColor ? `${iconColor}3F` : 'undefined', // 3F represents 25% opacity\n color: iconColor,\n}));\n"],"names":["React","styled","IconButton","Popover","CircleIcon","useChartsTheme","ColorPicker","OptionsColorPicker","color","onColorChange","label","anchorEl","setAnchorEl","useState","isOpen","Boolean","openColorPicker","event","currentTarget","closeColorPicker","thresholds","defaultColor","palette","ColorIconButton","size","aria-label","isSelected","iconColor","onClick","data-testid","open","onClose","PaperProps","sx","padding","theme","spacing","anchorOrigin","vertical","horizontal","transformOrigin","onChange","shouldForwardProp","props","backgroundColor"],"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,OAAOA,WAAW,QAAQ;AAC1B,SAASC,MAAM,EAAEC,UAAU,EAAEC,OAAO,QAAQ,gBAAgB;AAC5D,OAAOC,gBAAgB,yBAAyB;AAChD,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,SAASC,WAAW,QAAQ,gBAAgB;AAQ5C,OAAO,SAASC,mBAAmB,EAAEC,KAAK,EAAEC,aAAa,EAAEC,KAAK,EAA2B;IACzF,MAAM,CAACC,UAAUC,YAAY,GAAGZ,MAAMa,QAAQ,CAA2B;IACzE,MAAMC,SAASC,QAAQJ;IAEvB,MAAMK,kBAAkB,CAACC;QACvBL,YAAYK,MAAMC,aAAa;IACjC;IAEA,MAAMC,mBAAmB;QACvBP,YAAY;IACd;IAEA,MAAM,EACJQ,YAAY,EAAEC,YAAY,EAAEC,OAAO,EAAE,EACtC,GAAGjB;IAEJ,qBACE;;0BACE,KAACkB;gBACCC,MAAK;gBACLC,cAAY,CAAC,OAAO,EAAEf,MAAM,MAAM,CAAC;gBACnCgB,YAAYZ;gBACZa,WAAWnB;gBACXoB,SAASZ;0BAET,cAAA,KAACZ;;0BAEH,KAACD;gBACC0B,eAAY;gBACZC,MAAMhB;gBACNH,UAAUA;gBACVoB,SAASZ;gBACTa,YAAY;oBAAEC,IAAI;wBAAEC,SAAS,CAACC,QAAUA,MAAMC,OAAO,CAAC;oBAAG;gBAAE;gBAC3DC,cAAc;oBACZC,UAAU;oBACVC,YAAY;gBACd;gBACAC,iBAAiB;oBACfF,UAAU;oBACVC,YAAY;gBACd;0BAEA,cAAA,KAACjC;oBAAYE,OAAOA;oBAAOiC,UAAUhC;oBAAea,SAAS;wBAACD;2BAAiBC;qBAAQ;;;;;AAI/F;AAEA,MAAMC,kBAAkBtB,OAAOC,YAAY;IACzCwC,mBAAmB,CAACC,QAAUA,UAAU,gBAAgBA,UAAU;AACpE,GAGG,CAAC,EAAEhB,SAAS,EAAED,UAAU,EAAE,GAAM,CAAA;QACjCkB,iBAAiBlB,cAAcC,YAAY,CAAC,EAAEA,UAAU,EAAE,CAAC,GAAG;QAC9DnB,OAAOmB;IACT,CAAA"}
@@ -1,2 +1,3 @@
1
1
  export * from './ColorPicker';
2
+ export * from './OptionsColorPicker';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ColorPicker/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ColorPicker/index.ts"],"names":[],"mappings":"AAaA,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC"}
@@ -11,5 +11,6 @@
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
13
  export * from './ColorPicker';
14
+ export * from './OptionsColorPicker';
14
15
 
15
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ColorPicker/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 './ColorPicker';\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,gBAAgB"}
1
+ {"version":3,"sources":["../../src/ColorPicker/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 './ColorPicker';\nexport * from './OptionsColorPicker';\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,gBAAgB;AAC9B,cAAc,uBAAuB"}
@@ -0,0 +1,7 @@
1
+ export type DensityOption = 'compact' | 'standard' | 'comfortable';
2
+ export interface DensitySelectorProps {
3
+ onChange: (density: DensityOption) => void;
4
+ value?: DensityOption;
5
+ }
6
+ export declare function DensitySelector({ onChange, value }: DensitySelectorProps): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=DensitySelector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DensitySelector.d.ts","sourceRoot":"","sources":["../../src/DensitySelector/DensitySelector.tsx"],"names":[],"mappings":"AAsBA,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,aAAa,CAAC;AAEnE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IAC3C,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,wBAAgB,eAAe,CAAC,EAAE,QAAQ,EAAE,KAAkB,EAAE,EAAE,oBAAoB,2CAmBrF"}
@@ -0,0 +1,46 @@
1
+ // Copyright 2024 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 { OptionsEditorControl } from '../OptionsEditorLayout';
15
+ import { SettingsAutocomplete } from '../SettingsAutocomplete';
16
+ const DENSITY_OPTIONS = [
17
+ {
18
+ id: 'compact',
19
+ label: 'Compact'
20
+ },
21
+ {
22
+ id: 'standard',
23
+ label: 'Standard'
24
+ },
25
+ {
26
+ id: 'comfortable',
27
+ label: 'Comfortable'
28
+ }
29
+ ];
30
+ export function DensitySelector({ onChange, value = 'standard' }) {
31
+ const handleSortChange = (_, { id })=>{
32
+ onChange(id);
33
+ };
34
+ return /*#__PURE__*/ _jsx(OptionsEditorControl, {
35
+ label: "Density",
36
+ control: /*#__PURE__*/ _jsx(SettingsAutocomplete, {
37
+ value: DENSITY_OPTIONS.find((o)=>o.id === value),
38
+ options: DENSITY_OPTIONS,
39
+ getOptionLabel: (o)=>o.label,
40
+ onChange: handleSortChange,
41
+ disableClearable: true
42
+ })
43
+ });
44
+ }
45
+
46
+ //# sourceMappingURL=DensitySelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/DensitySelector/DensitySelector.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 { OptionsEditorControl } from '../OptionsEditorLayout';\nimport { SettingsAutocomplete } from '../SettingsAutocomplete';\n\nconst DENSITY_OPTIONS: Array<{ id: DensityOption; label: string }> = [\n { id: 'compact', label: 'Compact' },\n { id: 'standard', label: 'Standard' },\n { id: 'comfortable', label: 'Comfortable' },\n];\n\nexport type DensityOption = 'compact' | 'standard' | 'comfortable';\n\nexport interface DensitySelectorProps {\n onChange: (density: DensityOption) => void;\n value?: DensityOption;\n}\n\nexport function DensitySelector({ onChange, value = 'standard' }: DensitySelectorProps) {\n const handleSortChange = (_: unknown, { id }: { id: DensityOption }) => {\n onChange(id);\n };\n\n return (\n <OptionsEditorControl\n label=\"Density\"\n control={\n <SettingsAutocomplete\n value={DENSITY_OPTIONS.find((o) => o.id === value)}\n options={DENSITY_OPTIONS}\n getOptionLabel={(o) => o.label}\n onChange={handleSortChange}\n disableClearable\n />\n }\n />\n );\n}\n"],"names":["OptionsEditorControl","SettingsAutocomplete","DENSITY_OPTIONS","id","label","DensitySelector","onChange","value","handleSortChange","_","control","find","o","options","getOptionLabel","disableClearable"],"mappings":"AAAA,oCAAoC;AACpC,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,oBAAoB,QAAQ,yBAAyB;AAC9D,SAASC,oBAAoB,QAAQ,0BAA0B;AAE/D,MAAMC,kBAA+D;IACnE;QAAEC,IAAI;QAAWC,OAAO;IAAU;IAClC;QAAED,IAAI;QAAYC,OAAO;IAAW;IACpC;QAAED,IAAI;QAAeC,OAAO;IAAc;CAC3C;AASD,OAAO,SAASC,gBAAgB,EAAEC,QAAQ,EAAEC,QAAQ,UAAU,EAAwB;IACpF,MAAMC,mBAAmB,CAACC,GAAY,EAAEN,EAAE,EAAyB;QACjEG,SAASH;IACX;IAEA,qBACE,KAACH;QACCI,OAAM;QACNM,uBACE,KAACT;YACCM,OAAOL,gBAAgBS,IAAI,CAAC,CAACC,IAAMA,EAAET,EAAE,KAAKI;YAC5CM,SAASX;YACTY,gBAAgB,CAACF,IAAMA,EAAER,KAAK;YAC9BE,UAAUE;YACVO,gBAAgB;;;AAK1B"}
@@ -0,0 +1,2 @@
1
+ export * from './DensitySelector';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DensitySelector/index.ts"],"names":[],"mappings":"AAaA,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Copyright 2024 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
+ export * from './DensitySelector';
14
+
15
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/DensitySelector/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 './DensitySelector';\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,oBAAoB"}
@@ -7,17 +7,12 @@ export interface DialogHeaderProps extends DialogTitleProps {
7
7
  onClose?: (e: React.MouseEvent<HTMLElement>) => void;
8
8
  }
9
9
  export type DialogButtonProps = Omit<ButtonProps, 'variant' | 'color' | 'type'>;
10
- export interface DialogContentProps extends MuiDialogContentProps {
11
- /**
12
- * @default 500
13
- */
14
- width?: number;
15
- }
10
+ export type DialogContentProps = MuiDialogContentProps;
16
11
  export declare const Dialog: {
17
12
  ({ children, ...props }: DialogProps): import("react/jsx-runtime").JSX.Element;
18
13
  Header: ({ children, onClose, ...props }: DialogHeaderProps) => import("react/jsx-runtime").JSX.Element;
19
14
  Form: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<Theme>, React.DetailedHTMLProps<React.FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, {}>;
20
- Content: ({ children, width, sx, ...props }: DialogContentProps) => import("react/jsx-runtime").JSX.Element;
15
+ Content: ({ children, sx, ...props }: DialogContentProps) => import("react/jsx-runtime").JSX.Element;
21
16
  PrimaryButton: ({ children, ...props }: DialogButtonProps) => import("react/jsx-runtime").JSX.Element;
22
17
  SecondaryButton: ({ children, ...props }: DialogButtonProps) => import("react/jsx-runtime").JSX.Element;
23
18
  Actions: typeof DialogActions;
@@ -1 +1 @@
1
- {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,WAAW,EAEX,aAAa,EAEb,kBAAkB,IAAI,qBAAqB,EAC3C,WAAW,EAEX,gBAAgB,EAGhB,KAAK,EACN,MAAM,eAAe,CAAC;AAIvB,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACtD;AAED,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;AAEhF,MAAM,WAAW,kBAAmB,SAAQ,qBAAqB;IAC/D;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAqDD,eAAO,MAAM,MAAM;6BAA4B,WAAW;8CAnDT,iBAAiB;;iDAaR,kBAAkB;4CAM7B,iBAAiB;8CAMf,iBAAiB;;CA0ByC,CAAC"}
1
+ {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/Dialog/Dialog.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,WAAW,EAEX,aAAa,EAEb,kBAAkB,IAAI,qBAAqB,EAC3C,WAAW,EAEX,gBAAgB,EAGhB,KAAK,EACN,MAAM,eAAe,CAAC;AAIvB,MAAM,WAAW,iBAAkB,SAAQ,gBAAgB;IACzD;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,IAAI,CAAC;CACtD;AAED,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC,CAAC;AAEhF,MAAM,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAuDvD,eAAO,MAAM,MAAM;6BAA4B,WAAW;8CArDT,iBAAiB;;0CAerB,kBAAkB;4CAMhB,iBAAiB;8CAMf,iBAAiB;;CA0ByC,CAAC"}
@@ -19,6 +19,10 @@ const Header = ({ children, onClose, ...props })=>{
19
19
  return /*#__PURE__*/ _jsxs(_Fragment, {
20
20
  children: [
21
21
  /*#__PURE__*/ _jsx(DialogTitle, {
22
+ style: {
23
+ textOverflow: 'ellipsis',
24
+ overflow: 'hidden'
25
+ },
22
26
  ...props,
23
27
  children: children
24
28
  }),
@@ -31,11 +35,12 @@ const Header = ({ children, onClose, ...props })=>{
31
35
  ]
32
36
  });
33
37
  };
34
- const Content = ({ children, width = 500, sx, ...props })=>/*#__PURE__*/ _jsx(DialogContent, {
38
+ const Content = ({ children, sx, ...props })=>/*#__PURE__*/ _jsx(DialogContent, {
35
39
  dividers: true,
36
40
  ...props,
37
41
  sx: combineSx({
38
- width: `${width}px`
42
+ minWidth: `500px`,
43
+ textWrap: 'balance'
39
44
  }, sx),
40
45
  children: children
41
46
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Dialog/Dialog.tsx"],"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\nimport React from 'react';\nimport {\n Button,\n ButtonProps,\n Dialog as MuiDialog,\n DialogActions,\n DialogContent,\n DialogContentProps as MuiDialogContentProps,\n DialogProps,\n DialogTitle,\n DialogTitleProps,\n IconButton,\n styled,\n Theme,\n} from '@mui/material';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { combineSx } from '../utils';\n\nexport interface DialogHeaderProps extends DialogTitleProps {\n /**\n * Callback fired when close button is clicked. If undefined, close button will not appear in header.\n */\n onClose?: (e: React.MouseEvent<HTMLElement>) => void;\n}\n\nexport type DialogButtonProps = Omit<ButtonProps, 'variant' | 'color' | 'type'>;\n\nexport interface DialogContentProps extends MuiDialogContentProps {\n /**\n * @default 500\n */\n width?: number;\n}\n\nconst Header = ({ children, onClose, ...props }: DialogHeaderProps) => {\n return (\n <>\n <DialogTitle {...props}>{children}</DialogTitle>\n {onClose && (\n <IconButton aria-label=\"Close\" onClick={onClose} sx={dialogCloseIconButtonStyle}>\n <CloseIcon />\n </IconButton>\n )}\n </>\n );\n};\n\nconst Content = ({ children, width = 500, sx, ...props }: DialogContentProps) => (\n <DialogContent dividers {...props} sx={combineSx({ width: `${width}px` }, sx)}>\n {children}\n </DialogContent>\n);\n\nconst PrimaryButton = ({ children, ...props }: DialogButtonProps) => (\n <Button variant=\"contained\" type=\"submit\" {...props}>\n {children}\n </Button>\n);\n\nconst SecondaryButton = ({ children, ...props }: DialogButtonProps) => (\n <Button variant=\"outlined\" color=\"secondary\" {...props}>\n {children}\n </Button>\n);\n\n/*\n * Material-ui has a prop \"scroll=paper\" that is specifically for dialog header and actions to be sticky and body to scroll,\n * but that doesn't work when dialog content is wrapped in form.\n * https://github.com/mui-org/material-ui/issues/13253\n * This component adds style to get expected behavior & should be used whenever we have a Form inside a Dialog\n */\nconst Form = styled('form')({\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n});\n\n/**\n * Render the CSS of the dialog's close button, according to the given material theme.\n * @param theme material theme\n */\nconst dialogCloseIconButtonStyle = (theme: Theme) => {\n return { position: 'absolute', top: theme.spacing(0.5), right: theme.spacing(0.5) };\n};\n\nexport const Dialog = ({ children, ...props }: DialogProps) => <MuiDialog {...props}>{children}</MuiDialog>;\n\nDialog.Header = Header;\nDialog.Form = Form;\nDialog.Content = Content;\nDialog.PrimaryButton = PrimaryButton;\nDialog.SecondaryButton = SecondaryButton;\nDialog.Actions = DialogActions;\n"],"names":["React","Button","Dialog","MuiDialog","DialogActions","DialogContent","DialogTitle","IconButton","styled","CloseIcon","combineSx","Header","children","onClose","props","aria-label","onClick","sx","dialogCloseIconButtonStyle","Content","width","dividers","PrimaryButton","variant","type","SecondaryButton","color","Form","overflowY","display","flexDirection","theme","position","top","spacing","right","Actions"],"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,OAAOA,WAAW,QAAQ;AAC1B,SACEC,MAAM,EAENC,UAAUC,SAAS,EACnBC,aAAa,EACbC,aAAa,EAGbC,WAAW,EAEXC,UAAU,EACVC,MAAM,QAED,gBAAgB;AACvB,OAAOC,eAAe,wBAAwB;AAC9C,SA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B,OAAOuB,eAAe,GAAGA;AACzBvB,OAAOkC,OAAO,GAAGhC"}
1
+ {"version":3,"sources":["../../src/Dialog/Dialog.tsx"],"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\nimport React from 'react';\nimport {\n Button,\n ButtonProps,\n Dialog as MuiDialog,\n DialogActions,\n DialogContent,\n DialogContentProps as MuiDialogContentProps,\n DialogProps,\n DialogTitle,\n DialogTitleProps,\n IconButton,\n styled,\n Theme,\n} from '@mui/material';\nimport CloseIcon from 'mdi-material-ui/Close';\nimport { combineSx } from '../utils';\n\nexport interface DialogHeaderProps extends DialogTitleProps {\n /**\n * Callback fired when close button is clicked. If undefined, close button will not appear in header.\n */\n onClose?: (e: React.MouseEvent<HTMLElement>) => void;\n}\n\nexport type DialogButtonProps = Omit<ButtonProps, 'variant' | 'color' | 'type'>;\n\nexport type DialogContentProps = MuiDialogContentProps;\n\nconst Header = ({ children, onClose, ...props }: DialogHeaderProps) => {\n return (\n <>\n <DialogTitle style={{ textOverflow: 'ellipsis', overflow: 'hidden' }} {...props}>\n {children}\n </DialogTitle>\n {onClose && (\n <IconButton aria-label=\"Close\" onClick={onClose} sx={dialogCloseIconButtonStyle}>\n <CloseIcon />\n </IconButton>\n )}\n </>\n );\n};\n\nconst Content = ({ children, sx, ...props }: DialogContentProps) => (\n <DialogContent dividers {...props} sx={combineSx({ minWidth: `500px`, textWrap: 'balance' }, sx)}>\n {children}\n </DialogContent>\n);\n\nconst PrimaryButton = ({ children, ...props }: DialogButtonProps) => (\n <Button variant=\"contained\" type=\"submit\" {...props}>\n {children}\n </Button>\n);\n\nconst SecondaryButton = ({ children, ...props }: DialogButtonProps) => (\n <Button variant=\"outlined\" color=\"secondary\" {...props}>\n {children}\n </Button>\n);\n\n/*\n * Material-ui has a prop \"scroll=paper\" that is specifically for dialog header and actions to be sticky and body to scroll,\n * but that doesn't work when dialog content is wrapped in form.\n * https://github.com/mui-org/material-ui/issues/13253\n * This component adds style to get expected behavior & should be used whenever we have a Form inside a Dialog\n */\nconst Form = styled('form')({\n overflowY: 'auto',\n display: 'flex',\n flexDirection: 'column',\n});\n\n/**\n * Render the CSS of the dialog's close button, according to the given material theme.\n * @param theme material theme\n */\nconst dialogCloseIconButtonStyle = (theme: Theme) => {\n return { position: 'absolute', top: theme.spacing(0.5), right: theme.spacing(0.5) };\n};\n\nexport const Dialog = ({ children, ...props }: DialogProps) => <MuiDialog {...props}>{children}</MuiDialog>;\n\nDialog.Header = Header;\nDialog.Form = Form;\nDialog.Content = Content;\nDialog.PrimaryButton = PrimaryButton;\nDialog.SecondaryButton = SecondaryButton;\nDialog.Actions = DialogActions;\n"],"names":["React","Button","Dialog","MuiDialog","DialogActions","DialogContent","DialogTitle","IconButton","styled","CloseIcon","combineSx","Header","children","onClose","props","style","textOverflow","overflow","aria-label","onClick","sx","dialogCloseIconButtonStyle","Content","dividers","minWidth","textWrap","PrimaryButton","variant","type","SecondaryButton","color","Form","overflowY","display","flexDirection","theme","position","top","spacing","right","Actions"],"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,OAAOA,WAAW,QAAQ;AAC1B,SACEC,MAAM,EAENC,UAAUC,SAAS,EACnBC,aAAa,EACbC,aAAa,EAGbC,WAAW,EAEXC,UAAU,EACVC,MAAM,QAED,gBAAgB;AACvB,OAAOC,eAAe,wBAAwB;AAC9C,SAASC,S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AOwB,aAAa,GAAGA;AACvBxB,OAAO2B,eAAe,GAAGA;AACzB3B,OAAOsC,OAAO,GAAGpC"}
@@ -1,3 +1,8 @@
1
1
  import { HTMLAttributes } from 'react';
2
- export declare function LinksEditor({ ...props }: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
2
+ import { Control } from 'react-hook-form';
3
+ import { PanelEditorValues } from '@perses-dev/core';
4
+ export interface LinksEditorProps extends HTMLAttributes<HTMLDivElement> {
5
+ control: Control<PanelEditorValues>;
6
+ }
7
+ export declare function LinksEditor({ control, ...props }: LinksEditorProps): import("react/jsx-runtime").JSX.Element;
3
8
  //# sourceMappingURL=LinksEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LinksEditor.d.ts","sourceRoot":"","sources":["../../src/LinksEditor/LinksEditor.tsx"],"names":[],"mappings":"AAaA,OAAc,EAAY,cAAc,EAAE,MAAM,OAAO,CAAC;AAMxD,wBAAgB,WAAW,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,CAAC,cAAc,CAAC,2CA6BvE"}
1
+ {"version":3,"file":"LinksEditor.d.ts","sourceRoot":"","sources":["../../src/LinksEditor/LinksEditor.tsx"],"names":[],"mappings":"AAaA,OAAc,EAAY,cAAc,EAAE,MAAM,OAAO,CAAC;AAExD,OAAO,EAA6B,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAGrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,gBAAiB,SAAQ,cAAc,CAAC,cAAc,CAAC;IACtE,OAAO,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;CACrC;AAED,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,2CA8BlE"}
@@ -16,9 +16,10 @@ import { Checkbox, Divider, FormControlLabel, IconButton, Stack, TextField, Typo
16
16
  import { Controller, useFieldArray } from 'react-hook-form';
17
17
  import PlusIcon from 'mdi-material-ui/Plus';
18
18
  import MinusIcon from 'mdi-material-ui/Minus';
19
- export function LinksEditor({ ...props }) {
19
+ export function LinksEditor({ control, ...props }) {
20
20
  const { fields, append, remove } = useFieldArray({
21
- name: 'links'
21
+ control: control,
22
+ name: 'panelDefinition.spec.links'
22
23
  });
23
24
  return /*#__PURE__*/ _jsxs(Stack, {
24
25
  ...props,
@@ -32,6 +33,7 @@ export function LinksEditor({ ...props }) {
32
33
  alignItems: "center",
33
34
  children: [
34
35
  /*#__PURE__*/ _jsx(LinkControl, {
36
+ control: control,
35
37
  index: index
36
38
  }),
37
39
  /*#__PURE__*/ _jsx(IconButton, {
@@ -65,7 +67,7 @@ export function LinksEditor({ ...props }) {
65
67
  ]
66
68
  });
67
69
  }
68
- function LinkControl({ index }) {
70
+ function LinkControl({ control, index }) {
69
71
  return /*#__PURE__*/ _jsxs(Stack, {
70
72
  gap: 2,
71
73
  flexGrow: 1,
@@ -75,7 +77,8 @@ function LinkControl({ index }) {
75
77
  gap: 2,
76
78
  children: [
77
79
  /*#__PURE__*/ _jsx(Controller, {
78
- name: `links.${index}.url`,
80
+ control: control,
81
+ name: `panelDefinition.spec.links.${index}.url`,
79
82
  render: ({ field, fieldState })=>{
80
83
  var _fieldState_error;
81
84
  return /*#__PURE__*/ _jsx(TextField, {
@@ -92,7 +95,8 @@ function LinkControl({ index }) {
92
95
  }
93
96
  }),
94
97
  /*#__PURE__*/ _jsx(Controller, {
95
- name: `links.${index}.name`,
98
+ control: control,
99
+ name: `panelDefinition.spec.links.${index}.name`,
96
100
  render: ({ field, fieldState })=>{
97
101
  var _fieldState_error;
98
102
  return /*#__PURE__*/ _jsx(TextField, {
@@ -109,7 +113,8 @@ function LinkControl({ index }) {
109
113
  }
110
114
  }),
111
115
  /*#__PURE__*/ _jsx(Controller, {
112
- name: `links.${index}.tooltip`,
116
+ control: control,
117
+ name: `panelDefinition.spec.links.${index}.tooltip`,
113
118
  render: ({ field, fieldState })=>{
114
119
  var _fieldState_error;
115
120
  return /*#__PURE__*/ _jsx(TextField, {
@@ -133,7 +138,8 @@ function LinkControl({ index }) {
133
138
  alignItems: "center",
134
139
  children: [
135
140
  /*#__PURE__*/ _jsx(Controller, {
136
- name: `links.${index}.renderVariables`,
141
+ control: control,
142
+ name: `panelDefinition.spec.links.${index}.renderVariables`,
137
143
  render: ({ field })=>/*#__PURE__*/ _jsx(FormControlLabel, {
138
144
  label: "Render Variables",
139
145
  control: /*#__PURE__*/ _jsx(Checkbox, {
@@ -144,7 +150,8 @@ function LinkControl({ index }) {
144
150
  })
145
151
  }),
146
152
  /*#__PURE__*/ _jsx(Controller, {
147
- name: `links.${index}.targetBlank`,
153
+ control: control,
154
+ name: `panelDefinition.spec.links.${index}.targetBlank`,
148
155
  render: ({ field })=>/*#__PURE__*/ _jsx(FormControlLabel, {
149
156
  label: "Open in new tab",
150
157
  control: /*#__PURE__*/ _jsx(Checkbox, {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/LinksEditor/LinksEditor.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 React, { Fragment, HTMLAttributes } from 'react';\nimport { Checkbox, Divider, FormControlLabel, IconButton, Stack, TextField, Typography } from '@mui/material';\nimport { Controller, useFieldArray } from 'react-hook-form';\nimport PlusIcon from 'mdi-material-ui/Plus';\nimport MinusIcon from 'mdi-material-ui/Minus';\n\nexport function LinksEditor({ ...props }: HTMLAttributes<HTMLDivElement>) {\n const { fields, append, remove } = useFieldArray({\n name: 'links',\n });\n\n return (\n <Stack {...props} gap={3}>\n {fields && fields.length > 0 ? (\n fields.map((field, index) => (\n <Fragment key={field.id}>\n <Stack direction=\"row\" gap={1} alignItems=\"center\">\n <LinkControl index={index} />\n <IconButton style={{ width: 'fit-content', height: 'fit-content' }} onClick={() => remove(index)}>\n <MinusIcon />\n </IconButton>\n </Stack>\n <Divider />\n </Fragment>\n ))\n ) : (\n <Typography variant=\"subtitle1\" mb={2} fontStyle=\"italic\">\n No links defined\n </Typography>\n )}\n <IconButton style={{ width: 'fit-content', height: 'fit-content' }} onClick={() => append({ url: '' })}>\n <PlusIcon />\n </IconButton>\n </Stack>\n );\n}\n\nfunction LinkControl({ index }: { index: number }) {\n return (\n <Stack gap={2} flexGrow={1}>\n <Stack direction=\"row\" gap={2}>\n <Controller\n name={`links.${index}.url`}\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n required\n fullWidth\n label=\"URL\"\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n <Controller\n name={`links.${index}.name`}\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Name\"\n defaultValue=\"\"\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n <Controller\n name={`links.${index}.tooltip`}\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Tooltip\"\n defaultValue=\"\"\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n </Stack>\n <Stack gap={2} direction=\"row\" alignItems=\"center\">\n <Controller\n name={`links.${index}.renderVariables`}\n render={({ field }) => (\n <FormControlLabel\n label=\"Render Variables\"\n control={<Checkbox {...field} checked={field.value} onChange={(e) => field.onChange(e.target.checked)} />}\n />\n )}\n />\n <Controller\n name={`links.${index}.targetBlank`}\n render={({ field }) => (\n <FormControlLabel\n label=\"Open in new tab\"\n control={<Checkbox {...field} checked={field.value} onChange={(e) => field.onChange(e.target.checked)} />}\n />\n )}\n />\n </Stack>\n </Stack>\n );\n}\n"],"names":["React","Fragment","Checkbox","Divider","FormControlLabel","IconButton","Stack","TextField","Typography","Controller","useFieldArray","PlusIcon","MinusIcon","LinksEditor","props","fields","append","remove","name","gap","length","map","field","index","direction","alignItems","LinkControl","style","width","height","onClick","id","variant","mb","fontStyle","url","flexGrow","render","fieldState","required","fullWidth","label","error","helperText","message","onChange","event","defaultValue","control","checked","value","e","target"],"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,OAAOA,SAASC,QAAQ,QAAwB,QAAQ;AACxD,SAASC,QAAQ,EAAEC,OAAO,EAAEC,gBAAgB,EAAEC,UAAU,EAAEC,KAAK,EAAEC,SAAS,EAAEC,UAAU,QAAQ,gBAAgB;AAC9G,SAASC,UAAU,EAAEC,aAAa,QAAQ,kBAAkB;AAC5D,OAAOC,cAAc,uBAAuB;AAC5C,OAAOC,eAAe,wBAAwB;AAE9C,OAAO,SAASC,YAAY,EAAE,GAAGC,OAAuC;IACtE,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAE,GAAGP,cAAc;QAC/CQ,MAAM;IACR;IAEA,qBACE,MAACZ;QAAO,GAAGQ,KAAK;QAAEK,KAAK;;YACpBJ,UAAUA,OAAOK,MAAM,GAAG,IACzBL,OAAOM,GAAG,CAAC,CAACC,OAAOC,sBACjB,MAACtB;;sCACC,MAACK;4BAAMkB,WAAU;4BAAML,KAAK;4BAAGM,YAAW;;8CACxC,KAACC;oCAAYH,OAAOA;;8CACpB,KAAClB;oCAAWsB,OAAO;wCAAEC,OAAO;wCAAeC,QAAQ;oCAAc;oCAAGC,SAAS,IAAMb,OAAOM;8CACxF,cAAA,KAACX;;;;sCAGL,KAACT;;m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C,EAAEf,KAAK,EAAEgB,UAAU,EAAE;gCAOdA;iDANd,KAAC/B;gCACE,GAAGe,KAAK;gCACTkB,SAAS;gCACTC,OAAM;gCACNM,cAAa;gCACbL,OAAO,CAAC,CAACJ,WAAWI,KAAK;gCACzBC,UAAU,GAAEL,oBAAAA,WAAWI,KAAK,cAAhBJ,wCAAAA,kBAAkBM,OAAO;gCACrCC,UAAU,CAACC;oCACTxB,MAAMuB,QAAQ,CAACC;gCACjB;;;;;;0BAKR,MAACxC;gBAAMa,KAAK;gBAAGK,WAAU;gBAAMC,YAAW;;kCACxC,KAAChB;wBACCS,MAAM,CAAC,MAAM,EAAEK,MAAM,gBAAgB,CAAC;wBACtCc,QAAQ,CAAC,EAAEf,KAAK,EAAE,iBAChB,KAAClB;gCACCqC,OAAM;gCACNO,uBAAS,KAAC9C;oCAAU,GAAGoB,KAAK;oCAAE2B,SAAS3B,MAAM4B,KAAK;oCAAEL,UAAU,CAACM,IAAM7B,MAAMuB,QAAQ,CAACM,EAAEC,MAAM,CAACH,OAAO;;;;kCAI1G,KAACxC;wBACCS,MAAM,CAAC,MAAM,EAAEK,MAAM,YAAY,CAAC;wBAClCc,QAAQ,CAAC,EAAEf,KAAK,EAAE,iBAChB,KAAClB;gCACCqC,OAAM;gCACNO,uBAAS,KAAC9C;oCAAU,GAAGoB,KAAK;oCAAE2B,SAAS3B,MAAM4B,KAAK;oCAAEL,UAAU,CAACM,IAAM7B,MAAMuB,QAAQ,CAACM,EAAEC,MAAM,CAACH,OAAO;;;;;;;;AAOlH"}
1
+ {"version":3,"sources":["../../src/LinksEditor/LinksEditor.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 React, { Fragment, HTMLAttributes } from 'react';\nimport { Checkbox, Divider, FormControlLabel, IconButton, Stack, TextField, Typography } from '@mui/material';\nimport { Controller, useFieldArray, Control } from 'react-hook-form';\nimport PlusIcon from 'mdi-material-ui/Plus';\nimport MinusIcon from 'mdi-material-ui/Minus';\nimport { PanelEditorValues } from '@perses-dev/core';\n\nexport interface LinksEditorProps extends HTMLAttributes<HTMLDivElement> {\n control: Control<PanelEditorValues>;\n}\n\nexport function LinksEditor({ control, ...props }: LinksEditorProps) {\n const { fields, append, remove } = useFieldArray({\n control: control,\n name: 'panelDefinition.spec.links',\n });\n\n return (\n <Stack {...props} gap={3}>\n {fields && fields.length > 0 ? (\n fields.map((field, index) => (\n <Fragment key={field.id}>\n <Stack direction=\"row\" gap={1} alignItems=\"center\">\n <LinkControl control={control} index={index} />\n <IconButton style={{ width: 'fit-content', height: 'fit-content' }} onClick={() => remove(index)}>\n <MinusIcon />\n </IconButton>\n </Stack>\n <Divider />\n </Fragment>\n ))\n ) : (\n <Typography variant=\"subtitle1\" mb={2} fontStyle=\"italic\">\n No links defined\n </Typography>\n )}\n <IconButton style={{ width: 'fit-content', height: 'fit-content' }} onClick={() => append({ url: '' })}>\n <PlusIcon />\n </IconButton>\n </Stack>\n );\n}\n\nfunction LinkControl({ control, index }: { control: Control<PanelEditorValues>; index: number }) {\n return (\n <Stack gap={2} flexGrow={1}>\n <Stack direction=\"row\" gap={2}>\n <Controller\n control={control}\n name={`panelDefinition.spec.links.${index}.url`}\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n required\n fullWidth\n label=\"URL\"\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n <Controller\n control={control}\n name={`panelDefinition.spec.links.${index}.name`}\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Name\"\n defaultValue=\"\"\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n <Controller\n control={control}\n name={`panelDefinition.spec.links.${index}.tooltip`}\n render={({ field, fieldState }) => (\n <TextField\n {...field}\n fullWidth\n label=\"Tooltip\"\n defaultValue=\"\"\n error={!!fieldState.error}\n helperText={fieldState.error?.message}\n onChange={(event) => {\n field.onChange(event);\n }}\n />\n )}\n />\n </Stack>\n <Stack gap={2} direction=\"row\" alignItems=\"center\">\n <Controller\n control={control}\n name={`panelDefinition.spec.links.${index}.renderVariables`}\n render={({ field }) => (\n <FormControlLabel\n label=\"Render Variables\"\n control={<Checkbox {...field} checked={field.value} onChange={(e) => field.onChange(e.target.checked)} />}\n />\n )}\n />\n <Controller\n control={control}\n name={`panelDefinition.spec.links.${index}.targetBlank`}\n render={({ field }) => (\n <FormControlLabel\n label=\"Open in new tab\"\n control={<Checkbox {...field} checked={field.value} onChange={(e) => field.onChange(e.target.checked)} />}\n />\n )}\n />\n </Stack>\n </Stack>\n );\n}\n"],"names":["React","Fragment","Checkbox","Divider","FormControlLabel","IconButton","Stack","TextField","Typography","Controller","useFieldArray","PlusIcon","MinusIcon","LinksEditor","control","props","fields","append","remove","name","gap","length","map","field","index","direction","alignItems","LinkControl","style","width","height","onClick","id","variant","mb","fontStyle","url","flexGrow","render","fieldState","required","fullWidth","label","error","helperText","message","onChange","event","defaultValue","checked","value","e","target"],"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,OAAOA,SAASC,QAAQ,QAAwB,QAAQ;AACxD,SAASC,QAAQ,EAAEC,OAAO,EAAEC,gBAAgB,EAAEC,UAAU,EAAEC,KAAK,EAAEC,SAAS,EAAEC,UAAU,QAAQ,gBAAgB;A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Z;oCAAU,GAAGqB,KAAK;oCAAE0B,SAAS1B,MAAM2B,KAAK;oCAAEJ,UAAU,CAACK,IAAM5B,MAAMuB,QAAQ,CAACK,EAAEC,MAAM,CAACH,OAAO;;;;kCAI1G,KAACxC;wBACCK,SAASA;wBACTK,MAAM,CAAC,2BAA2B,EAAEK,MAAM,YAAY,CAAC;wBACvDc,QAAQ,CAAC,EAAEf,KAAK,EAAE,iBAChB,KAACnB;gCACCsC,OAAM;gCACN5B,uBAAS,KAACZ;oCAAU,GAAGqB,KAAK;oCAAE0B,SAAS1B,MAAM2B,KAAK;oCAAEJ,UAAU,CAACK,IAAM5B,MAAMuB,QAAQ,CAACK,EAAEC,MAAM,CAACH,OAAO;;;;;;;;AAOlH"}
@@ -0,0 +1,15 @@
1
+ import { SkeletonOwnProps } from '@mui/material';
2
+ interface TextOverlayProps {
3
+ message: string;
4
+ }
5
+ export declare function TextOverlay(props: TextOverlayProps): import("react/jsx-runtime").JSX.Element;
6
+ interface NoDataOverlayProps {
7
+ resource: string;
8
+ }
9
+ export declare function NoDataOverlay(props: NoDataOverlayProps): import("react/jsx-runtime").JSX.Element;
10
+ interface LoadingOverlayProps {
11
+ variant?: SkeletonOwnProps['variant'];
12
+ }
13
+ export declare function LoadingOverlay(props: LoadingOverlayProps): import("react/jsx-runtime").JSX.Element;
14
+ export {};
15
+ //# sourceMappingURL=Overlay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Overlay.d.ts","sourceRoot":"","sources":["../../src/Overlay/Overlay.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAY,gBAAgB,EAAqB,MAAM,eAAe,CAAC;AAE9E,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,2CAQlD;AAED,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,2CAItD;AAED,UAAU,mBAAmB;IAC3B,OAAO,CAAC,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;CACvC;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,2CAQxD"}
@@ -0,0 +1,52 @@
1
+ // Copyright 2024 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 { Skeleton, Stack, Typography } from '@mui/material';
15
+ export function TextOverlay(props) {
16
+ const { message } = props;
17
+ return /*#__PURE__*/ _jsx(Stack, {
18
+ sx: {
19
+ height: '100%',
20
+ alignItems: 'center',
21
+ justifyContent: 'center'
22
+ },
23
+ children: /*#__PURE__*/ _jsx(Typography, {
24
+ children: message
25
+ })
26
+ });
27
+ }
28
+ export function NoDataOverlay(props) {
29
+ const { resource } = props;
30
+ return /*#__PURE__*/ _jsx(TextOverlay, {
31
+ message: `No ${resource}`
32
+ });
33
+ }
34
+ export function LoadingOverlay(props) {
35
+ const { variant = 'rounded' } = props;
36
+ return /*#__PURE__*/ _jsx(Stack, {
37
+ sx: {
38
+ height: '100%',
39
+ alignItems: 'center',
40
+ justifyContent: 'center',
41
+ padding: '0 10px'
42
+ },
43
+ children: /*#__PURE__*/ _jsx(Skeleton, {
44
+ variant: variant,
45
+ width: "100%",
46
+ height: "30%",
47
+ "aria-label": "Loading..."
48
+ })
49
+ });
50
+ }
51
+
52
+ //# sourceMappingURL=Overlay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Overlay/Overlay.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 { Skeleton, SkeletonOwnProps, Stack, Typography } from '@mui/material';\n\ninterface TextOverlayProps {\n message: string;\n}\n\nexport function TextOverlay(props: TextOverlayProps) {\n const { message } = props;\n\n return (\n <Stack sx={{ height: '100%', alignItems: 'center', justifyContent: 'center' }}>\n <Typography>{message}</Typography>\n </Stack>\n );\n}\n\ninterface NoDataOverlayProps {\n resource: string;\n}\n\nexport function NoDataOverlay(props: NoDataOverlayProps) {\n const { resource } = props;\n\n return <TextOverlay message={`No ${resource}`} />;\n}\n\ninterface LoadingOverlayProps {\n variant?: SkeletonOwnProps['variant'];\n}\n\nexport function LoadingOverlay(props: LoadingOverlayProps) {\n const { variant = 'rounded' } = props;\n\n return (\n <Stack sx={{ height: '100%', alignItems: 'center', justifyContent: 'center', padding: '0 10px' }}>\n <Skeleton variant={variant} width=\"100%\" height=\"30%\" aria-label=\"Loading...\" />\n </Stack>\n );\n}\n"],"names":["Skeleton","Stack","Typography","TextOverlay","props","message","sx","height","alignItems","justifyContent","NoDataOverlay","resource","LoadingOverlay","variant","padding","width","aria-label"],"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,QAAQ,EAAoBC,KAAK,EAAEC,UAAU,QAAQ,gBAAgB;AAM9E,OAAO,SAASC,YAAYC,KAAuB;IACjD,MAAM,EAAEC,OAAO,EAAE,GAAGD;IAEpB,qBACE,KAACH;QAAMK,IAAI;YAAEC,QAAQ;YAAQC,YAAY;YAAUC,gBAAgB;QAAS;kBAC1E,cAAA,KAACP;sBAAYG;;;AAGnB;AAMA,OAAO,SAASK,cAAcN,KAAyB;IACrD,MAAM,EAAEO,QAAQ,EAAE,GAAGP;IAErB,qBAAO,KAACD;QAAYE,SAAS,CAAC,GAAG,EAAEM,SAAS,CAAC;;AAC/C;AAMA,OAAO,SAASC,eAAeR,KAA0B;IACvD,MAAM,EAAES,UAAU,SAAS,EAAE,GAAGT;IAEhC,qBACE,KAACH;QAAMK,IAAI;YAAEC,QAAQ;YAAQC,YAAY;YAAUC,gBAAgB;YAAUK,SAAS;QAAS;kBAC7F,cAAA,KAACd;YAASa,SAASA;YAASE,OAAM;YAAOR,QAAO;YAAMS,cAAW;;;AAGvE"}
@@ -0,0 +1,2 @@
1
+ export * from './Overlay';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Overlay/index.ts"],"names":[],"mappings":"AAaA,cAAc,WAAW,CAAC"}