@grafana/scenes 5.22.3--canary.955.11685084435.0 → 5.23.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +12 -0
- package/dist/esm/components/VizPanel/VizPanel.js +4 -0
- package/dist/esm/components/VizPanel/VizPanel.js.map +1 -1
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js +55 -25
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/AdHocFiltersCombobox.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +282 -355
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/MultiValuePill.js +0 -114
- package/dist/esm/variables/adhoc/AdHocFiltersCombobox/MultiValuePill.js.map +0 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@grafana/scenes",
|
3
|
-
"version": "5.
|
3
|
+
"version": "5.23.0",
|
4
4
|
"description": "Grafana framework for building dynamic dashboards",
|
5
5
|
"author": "Grafana Labs",
|
6
6
|
"license": "AGPL-3.0-only",
|
@@ -115,5 +115,5 @@
|
|
115
115
|
"prettier --write"
|
116
116
|
]
|
117
117
|
},
|
118
|
-
"gitHead": "
|
118
|
+
"gitHead": "85a8382c24a0329555988a56b7ecf65bc6e61c80"
|
119
119
|
}
|
@@ -1,114 +0,0 @@
|
|
1
|
-
import { cx, css } from '@emotion/css';
|
2
|
-
import { useStyles2, Button, Icon } from '@grafana/ui';
|
3
|
-
import React, { useCallback } from 'react';
|
4
|
-
|
5
|
-
var __defProp = Object.defineProperty;
|
6
|
-
var __defProps = Object.defineProperties;
|
7
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
8
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
10
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
11
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
12
|
-
var __spreadValues = (a, b) => {
|
13
|
-
for (var prop in b || (b = {}))
|
14
|
-
if (__hasOwnProp.call(b, prop))
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
16
|
-
if (__getOwnPropSymbols)
|
17
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
18
|
-
if (__propIsEnum.call(b, prop))
|
19
|
-
__defNormalProp(a, prop, b[prop]);
|
20
|
-
}
|
21
|
-
return a;
|
22
|
-
};
|
23
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
24
|
-
const MultiValuePill = ({
|
25
|
-
item,
|
26
|
-
handleRemoveMultiValue,
|
27
|
-
index,
|
28
|
-
handleEditMultiValuePill
|
29
|
-
}) => {
|
30
|
-
var _a, _b;
|
31
|
-
const styles = useStyles2(getStyles);
|
32
|
-
const editMultiValuePill = useCallback(
|
33
|
-
(e) => {
|
34
|
-
e.stopPropagation();
|
35
|
-
e.preventDefault();
|
36
|
-
handleEditMultiValuePill(item);
|
37
|
-
},
|
38
|
-
[handleEditMultiValuePill, item]
|
39
|
-
);
|
40
|
-
const editMultiValuePillWithKeyboard = useCallback(
|
41
|
-
(e) => {
|
42
|
-
if (e.key === "Enter") {
|
43
|
-
editMultiValuePill(e);
|
44
|
-
}
|
45
|
-
},
|
46
|
-
[editMultiValuePill]
|
47
|
-
);
|
48
|
-
const removePillHandler = useCallback(
|
49
|
-
(e) => {
|
50
|
-
e.stopPropagation();
|
51
|
-
e.preventDefault();
|
52
|
-
handleRemoveMultiValue(item);
|
53
|
-
},
|
54
|
-
[handleRemoveMultiValue, item]
|
55
|
-
);
|
56
|
-
const removePillHandlerWithKeyboard = useCallback(
|
57
|
-
(e) => {
|
58
|
-
if (e.key === "Enter") {
|
59
|
-
removePillHandler(e);
|
60
|
-
}
|
61
|
-
},
|
62
|
-
[removePillHandler]
|
63
|
-
);
|
64
|
-
return /* @__PURE__ */ React.createElement("div", {
|
65
|
-
className: cx(styles.basePill, styles.valuePill),
|
66
|
-
onClick: editMultiValuePill,
|
67
|
-
onKeyDown: editMultiValuePillWithKeyboard,
|
68
|
-
tabIndex: 0,
|
69
|
-
id: `${item.value}-${index}`
|
70
|
-
}, (_a = item.label) != null ? _a : item.value, /* @__PURE__ */ React.createElement(Button, {
|
71
|
-
onClick: removePillHandler,
|
72
|
-
onKeyDownCapture: removePillHandlerWithKeyboard,
|
73
|
-
fill: "text",
|
74
|
-
size: "sm",
|
75
|
-
variant: "secondary",
|
76
|
-
className: styles.removeButton,
|
77
|
-
tooltip: `Remove filter value - ${(_b = item.label) != null ? _b : item.value}`
|
78
|
-
}, /* @__PURE__ */ React.createElement(Icon, {
|
79
|
-
name: "times",
|
80
|
-
size: "md",
|
81
|
-
id: `${item.value}-${index}-close-icon`
|
82
|
-
})));
|
83
|
-
};
|
84
|
-
const getStyles = (theme) => ({
|
85
|
-
basePill: css(__spreadProps(__spreadValues({
|
86
|
-
display: "flex",
|
87
|
-
alignItems: "center",
|
88
|
-
background: theme.colors.action.disabledBackground,
|
89
|
-
border: `1px solid ${theme.colors.border.weak}`,
|
90
|
-
padding: theme.spacing(0.125, 1, 0.125, 1),
|
91
|
-
color: theme.colors.text.primary,
|
92
|
-
overflow: "hidden",
|
93
|
-
whiteSpace: "nowrap",
|
94
|
-
minHeight: theme.spacing(2.75)
|
95
|
-
}, theme.typography.bodySmall), {
|
96
|
-
cursor: "pointer"
|
97
|
-
})),
|
98
|
-
valuePill: css({
|
99
|
-
background: theme.colors.action.selected,
|
100
|
-
padding: theme.spacing(0.125, 0, 0.125, 1)
|
101
|
-
}),
|
102
|
-
removeButton: css({
|
103
|
-
marginInline: theme.spacing(0.5),
|
104
|
-
height: "100%",
|
105
|
-
padding: 0,
|
106
|
-
cursor: "pointer",
|
107
|
-
"&:hover": {
|
108
|
-
color: theme.colors.text.primary
|
109
|
-
}
|
110
|
-
})
|
111
|
-
});
|
112
|
-
|
113
|
-
export { MultiValuePill };
|
114
|
-
//# sourceMappingURL=MultiValuePill.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"MultiValuePill.js","sources":["../../../../../src/variables/adhoc/AdHocFiltersCombobox/MultiValuePill.tsx"],"sourcesContent":["import { cx, css } from '@emotion/css';\nimport { SelectableValue, GrafanaTheme2 } from '@grafana/data';\nimport { useStyles2, Button, Icon } from '@grafana/ui';\nimport React, { useCallback } from 'react';\n\ninterface MultiValuePillProps {\n item: SelectableValue<string>;\n handleRemoveMultiValue: (item: SelectableValue<string>) => void;\n index: number;\n handleEditMultiValuePill: (value: SelectableValue<string>) => void;\n}\nexport const MultiValuePill = ({\n item,\n handleRemoveMultiValue,\n index,\n handleEditMultiValuePill,\n}: MultiValuePillProps) => {\n const styles = useStyles2(getStyles);\n\n const editMultiValuePill = useCallback(\n (e: React.SyntheticEvent) => {\n e.stopPropagation();\n e.preventDefault();\n handleEditMultiValuePill(item);\n },\n [handleEditMultiValuePill, item]\n );\n\n const editMultiValuePillWithKeyboard = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Enter') {\n editMultiValuePill(e);\n }\n },\n [editMultiValuePill]\n );\n\n const removePillHandler = useCallback(\n (e: React.SyntheticEvent) => {\n e.stopPropagation();\n e.preventDefault();\n handleRemoveMultiValue(item);\n },\n [handleRemoveMultiValue, item]\n );\n\n const removePillHandlerWithKeyboard = useCallback(\n (e: React.KeyboardEvent) => {\n if (e.key === 'Enter') {\n removePillHandler(e);\n }\n },\n [removePillHandler]\n );\n\n return (\n <div\n className={cx(styles.basePill, styles.valuePill)}\n onClick={editMultiValuePill}\n onKeyDown={editMultiValuePillWithKeyboard}\n tabIndex={0}\n id={`${item.value}-${index}`}\n >\n {item.label ?? item.value}\n <Button\n onClick={removePillHandler}\n onKeyDownCapture={removePillHandlerWithKeyboard}\n fill=\"text\"\n size=\"sm\"\n variant=\"secondary\"\n className={styles.removeButton}\n tooltip={`Remove filter value - ${item.label ?? item.value}`}\n >\n <Icon name=\"times\" size=\"md\" id={`${item.value}-${index}-close-icon`} />\n </Button>\n </div>\n );\n};\n\nconst getStyles = (theme: GrafanaTheme2) => ({\n basePill: css({\n display: 'flex',\n alignItems: 'center',\n background: theme.colors.action.disabledBackground,\n border: `1px solid ${theme.colors.border.weak}`,\n padding: theme.spacing(0.125, 1, 0.125, 1),\n color: theme.colors.text.primary,\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n minHeight: theme.spacing(2.75),\n ...theme.typography.bodySmall,\n cursor: 'pointer',\n }),\n valuePill: css({\n background: theme.colors.action.selected,\n padding: theme.spacing(0.125, 0, 0.125, 1),\n }),\n removeButton: css({\n marginInline: theme.spacing(0.5),\n height: '100%',\n padding: 0,\n cursor: 'pointer',\n '&:hover': {\n color: theme.colors.text.primary,\n },\n }),\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAWO,MAAM,iBAAiB,CAAC;AAAA,EAC7B,IAAA;AAAA,EACA,sBAAA;AAAA,EACA,KAAA;AAAA,EACA,wBAAA;AACF,CAA2B,KAAA;AAhB3B,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAiBE,EAAM,MAAA,MAAA,GAAS,WAAW,SAAS,CAAA,CAAA;AAEnC,EAAA,MAAM,kBAAqB,GAAA,WAAA;AAAA,IACzB,CAAC,CAA4B,KAAA;AAC3B,MAAA,CAAA,CAAE,eAAgB,EAAA,CAAA;AAClB,MAAA,CAAA,CAAE,cAAe,EAAA,CAAA;AACjB,MAAA,wBAAA,CAAyB,IAAI,CAAA,CAAA;AAAA,KAC/B;AAAA,IACA,CAAC,0BAA0B,IAAI,CAAA;AAAA,GACjC,CAAA;AAEA,EAAA,MAAM,8BAAiC,GAAA,WAAA;AAAA,IACrC,CAAC,CAA2B,KAAA;AAC1B,MAAI,IAAA,CAAA,CAAE,QAAQ,OAAS,EAAA;AACrB,QAAA,kBAAA,CAAmB,CAAC,CAAA,CAAA;AAAA,OACtB;AAAA,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