@perses-dev/components 0.46.0 → 0.47.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.
- package/dist/AlignSelector/AlignSelector.d.ts +8 -0
- package/dist/AlignSelector/AlignSelector.d.ts.map +1 -0
- package/dist/AlignSelector/AlignSelector.js +45 -0
- package/dist/AlignSelector/AlignSelector.js.map +1 -0
- package/dist/AlignSelector/index.d.ts +2 -0
- package/dist/AlignSelector/index.d.ts.map +1 -0
- package/dist/AlignSelector/index.js +15 -0
- package/dist/AlignSelector/index.js.map +1 -0
- package/dist/ColorPicker/OptionsColorPicker.d.ts +7 -0
- package/dist/ColorPicker/OptionsColorPicker.d.ts.map +1 -0
- package/dist/{ThresholdsEditor/ThresholdColorPicker.js → ColorPicker/OptionsColorPicker.js} +5 -5
- package/dist/ColorPicker/OptionsColorPicker.js.map +1 -0
- package/dist/ColorPicker/index.d.ts +1 -0
- package/dist/ColorPicker/index.d.ts.map +1 -1
- package/dist/ColorPicker/index.js +1 -0
- package/dist/ColorPicker/index.js.map +1 -1
- package/dist/DensitySelector/DensitySelector.d.ts +7 -0
- package/dist/DensitySelector/DensitySelector.d.ts.map +1 -0
- package/dist/DensitySelector/DensitySelector.js +46 -0
- package/dist/DensitySelector/DensitySelector.js.map +1 -0
- package/dist/DensitySelector/index.d.ts +2 -0
- package/dist/DensitySelector/index.d.ts.map +1 -0
- package/dist/DensitySelector/index.js +15 -0
- package/dist/DensitySelector/index.js.map +1 -0
- package/dist/Dialog/Dialog.d.ts +2 -7
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +7 -2
- package/dist/Dialog/Dialog.js.map +1 -1
- package/dist/LinksEditor/LinksEditor.d.ts +6 -1
- package/dist/LinksEditor/LinksEditor.d.ts.map +1 -1
- package/dist/LinksEditor/LinksEditor.js +15 -8
- package/dist/LinksEditor/LinksEditor.js.map +1 -1
- package/dist/Overlay/Overlay.d.ts +15 -0
- package/dist/Overlay/Overlay.d.ts.map +1 -0
- package/dist/Overlay/Overlay.js +52 -0
- package/dist/Overlay/Overlay.js.map +1 -0
- package/dist/Overlay/index.d.ts +2 -0
- package/dist/Overlay/index.d.ts.map +1 -0
- package/dist/Overlay/index.js +15 -0
- package/dist/Overlay/index.js.map +1 -0
- package/dist/SortSelector/SortSelectorButtons.d.ts +8 -0
- package/dist/SortSelector/SortSelectorButtons.d.ts.map +1 -0
- package/dist/SortSelector/SortSelectorButtons.js +45 -0
- package/dist/SortSelector/SortSelectorButtons.js.map +1 -0
- package/dist/SortSelector/index.d.ts +1 -0
- package/dist/SortSelector/index.d.ts.map +1 -1
- package/dist/SortSelector/index.js +2 -1
- package/dist/SortSelector/index.js.map +1 -1
- package/dist/Table/InnerTable.d.ts.map +1 -1
- package/dist/Table/InnerTable.js +2 -1
- package/dist/Table/InnerTable.js.map +1 -1
- package/dist/Table/TableCell.d.ts +1 -1
- package/dist/Table/TableCell.d.ts.map +1 -1
- package/dist/Table/TableCell.js +3 -1
- package/dist/Table/TableCell.js.map +1 -1
- package/dist/Table/TableHeaderCell.d.ts +1 -1
- package/dist/Table/TableHeaderCell.d.ts.map +1 -1
- package/dist/Table/TableHeaderCell.js.map +1 -1
- package/dist/Table/model/table-model.d.ts +1 -1
- package/dist/Table/model/table-model.d.ts.map +1 -1
- package/dist/Table/model/table-model.js +25 -20
- package/dist/Table/model/table-model.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdInput.js +2 -2
- package/dist/ThresholdsEditor/ThresholdInput.js.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.d.ts.map +1 -1
- package/dist/ThresholdsEditor/ThresholdsEditor.js +2 -2
- package/dist/ThresholdsEditor/ThresholdsEditor.js.map +1 -1
- package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts +18 -0
- package/dist/TimeRangeSelector/DateTimeRangePicker.d.ts.map +1 -0
- package/dist/{DateTimeRangePicker/AbsoluteTimePicker.js → TimeRangeSelector/DateTimeRangePicker.js} +45 -28
- package/dist/TimeRangeSelector/DateTimeRangePicker.js.map +1 -0
- package/dist/TimeRangeSelector/TimeRangeSelector.d.ts +35 -0
- package/dist/TimeRangeSelector/TimeRangeSelector.d.ts.map +1 -0
- package/dist/TimeRangeSelector/TimeRangeSelector.js +119 -0
- package/dist/TimeRangeSelector/TimeRangeSelector.js.map +1 -0
- package/dist/{DateTimeRangePicker → TimeRangeSelector}/index.d.ts +1 -2
- package/dist/TimeRangeSelector/index.d.ts.map +1 -0
- package/dist/{DateTimeRangePicker → TimeRangeSelector}/index.js +2 -3
- package/dist/TimeRangeSelector/index.js.map +1 -0
- package/dist/TimeRangeSelector/utils.d.ts +25 -0
- package/dist/TimeRangeSelector/utils.d.ts.map +1 -0
- package/dist/{DateTimeRangePicker → TimeRangeSelector}/utils.js +23 -2
- package/dist/TimeRangeSelector/utils.js.map +1 -0
- package/dist/cjs/AlignSelector/AlignSelector.js +53 -0
- package/dist/cjs/AlignSelector/index.js +30 -0
- package/dist/cjs/{ThresholdsEditor/ThresholdColorPicker.js → ColorPicker/OptionsColorPicker.js} +6 -6
- package/dist/cjs/ColorPicker/index.js +1 -0
- package/dist/cjs/DensitySelector/DensitySelector.js +54 -0
- package/dist/cjs/DensitySelector/index.js +30 -0
- package/dist/cjs/Dialog/Dialog.js +7 -2
- package/dist/cjs/LinksEditor/LinksEditor.js +15 -8
- package/dist/cjs/Overlay/Overlay.js +71 -0
- package/dist/cjs/Overlay/index.js +30 -0
- package/dist/cjs/SortSelector/SortSelectorButtons.js +53 -0
- package/dist/cjs/SortSelector/index.js +2 -1
- package/dist/cjs/Table/InnerTable.js +2 -1
- package/dist/cjs/Table/TableCell.js +3 -1
- package/dist/cjs/Table/model/table-model.js +25 -20
- package/dist/cjs/ThresholdsEditor/ThresholdInput.js +2 -2
- package/dist/cjs/ThresholdsEditor/ThresholdsEditor.js +2 -2
- package/dist/cjs/{DateTimeRangePicker/AbsoluteTimePicker.js → TimeRangeSelector/DateTimeRangePicker.js} +39 -30
- package/dist/cjs/TimeRangeSelector/TimeRangeSelector.js +127 -0
- package/dist/cjs/{DateTimeRangePicker → TimeRangeSelector}/index.js +2 -3
- package/dist/cjs/{DateTimeRangePicker → TimeRangeSelector}/utils.js +24 -1
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/model/timeOption.js +19 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/model/timeOption.d.ts +2 -1
- package/dist/model/timeOption.d.ts.map +1 -1
- package/dist/model/timeOption.js +13 -2
- package/dist/model/timeOption.js.map +1 -1
- package/package.json +7 -6
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts +0 -9
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.d.ts.map +0 -1
- package/dist/DateTimeRangePicker/AbsoluteTimePicker.js.map +0 -1
- package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts +0 -11
- package/dist/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +0 -1
- package/dist/DateTimeRangePicker/DateTimeRangePicker.js +0 -80
- package/dist/DateTimeRangePicker/DateTimeRangePicker.js.map +0 -1
- package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts +0 -13
- package/dist/DateTimeRangePicker/TimeRangeSelector.d.ts.map +0 -1
- package/dist/DateTimeRangePicker/TimeRangeSelector.js +0 -67
- package/dist/DateTimeRangePicker/TimeRangeSelector.js.map +0 -1
- package/dist/DateTimeRangePicker/index.d.ts.map +0 -1
- package/dist/DateTimeRangePicker/index.js.map +0 -1
- package/dist/DateTimeRangePicker/utils.d.ts +0 -7
- package/dist/DateTimeRangePicker/utils.d.ts.map +0 -1
- package/dist/DateTimeRangePicker/utils.js.map +0 -1
- package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts +0 -3
- package/dist/ThresholdsEditor/ThresholdColorPicker.d.ts.map +0 -1
- package/dist/ThresholdsEditor/ThresholdColorPicker.js.map +0 -1
- package/dist/cjs/DateTimeRangePicker/DateTimeRangePicker.js +0 -88
- 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 @@
|
|
|
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 '
|
|
19
|
-
export function
|
|
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
|
|
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": "
|
|
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=
|
|
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","backgroundCol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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 +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"}
|
|
@@ -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 @@
|
|
|
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"}
|
package/dist/Dialog/Dialog.d.ts
CHANGED
|
@@ -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
|
|
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,
|
|
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,
|
|
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"}
|
package/dist/Dialog/Dialog.js
CHANGED
|
@@ -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,
|
|
38
|
+
const Content = ({ children, sx, ...props })=>/*#__PURE__*/ _jsx(DialogContent, {
|
|
35
39
|
dividers: true,
|
|
36
40
|
...props,
|
|
37
41
|
sx: combineSx({
|
|
38
|
-
|
|
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
|
|
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;A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AAO;QAAEC,UAAU;QAAYC,KAAKF,MAAMG,OAAO,CAAC;QAAMC,OAAOJ,MAAMG,OAAO,CAAC;IAAK;AACpF;AAEA,OAAO,MAAMpC,SAAS,CAAC,EAAEU,QAAQ,EAAE,GAAGE,OAAoB,iBAAK,KAACX;QAAW,GAAGW,KAAK;kBAAGF;OAAsB;AAE5GV,OAAOS,MAAM,GAAGA;AAChBT,OAAO6B,IAAI,GAAGA;AACd7B,OAAOoB,OAAO,GAAGA;AACjBpB,OAAOwB,aAAa,GAAGA;AACvBxB,OAAO2B,eAAe,GAAGA;AACzB3B,OAAOsC,OAAO,GAAGpC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'react';
|
|
2
|
-
|
|
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;
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 }:
|
|
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;AAC9G,SAASC,UAAU,EAAEC,aAAa,QAAiB,kBAAkB;AACrE,OAAOC,cAAc,uBAAuB;AAC5C,OAAOC,eAAe,wBAAwB;AAO9C,OAAO,SAASC,YAAY,EAAEC,OAAO,EAAE,GAAGC,OAAyB;IACjE,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAE,GAAGR,cAAc;QAC/CI,SAASA;QACTK,MAAM;IACR;IAEA,qBACE,MAACb;QAAO,GAAGS,KAAK;QAAEK,KAAK;;YACpBJ,UAAUA,OAAOK,MAAM,GAAG,IACzBL,OAAOM,GAAG,CA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,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 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Overlay/index.ts"],"names":[],"mappings":"AAaA,cAAc,WAAW,CAAC"}
|