@grafana/scenes 5.4.0 → 5.4.1--canary.830.9976271928.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -61,8 +61,8 @@ const LazyLoader = React.forwardRef(
61
61
  LazyLoader.observer.observe(wrapperEl);
62
62
  }
63
63
  return () => {
64
- delete LazyLoader.callbacks[id];
65
64
  wrapperEl && LazyLoader.observer.unobserve(wrapperEl);
65
+ delete LazyLoader.callbacks[id];
66
66
  if (Object.keys(LazyLoader.callbacks).length === 0) {
67
67
  LazyLoader.observer.disconnect();
68
68
  }
@@ -91,7 +91,9 @@ LazyLoader.addCallback = (id, c) => LazyLoader.callbacks[id] = c;
91
91
  LazyLoader.observer = new IntersectionObserver(
92
92
  (entries) => {
93
93
  for (const entry of entries) {
94
- LazyLoader.callbacks[entry.target.id](entry);
94
+ if (typeof LazyLoader.callbacks[entry.target.id] === "function") {
95
+ LazyLoader.callbacks[entry.target.id](entry);
96
+ }
95
97
  }
96
98
  },
97
99
  { rootMargin: "100px" }
@@ -1 +1 @@
1
- {"version":3,"file":"LazyLoader.js","sources":["../../../../src/components/layout/LazyLoader.tsx"],"sourcesContent":["import React, { ForwardRefExoticComponent, useImperativeHandle, useRef, useState } from 'react';\nimport { useEffectOnce } from 'react-use';\n\nimport { uniqueId } from 'lodash';\nimport { css } from '@emotion/css';\nimport { useStyles2 } from '@grafana/ui';\n\nexport function useUniqueId(): string {\n const idRefLazy = useRef<string | undefined>(undefined);\n idRefLazy.current ??= uniqueId();\n return idRefLazy.current;\n}\n\nexport interface Props extends Omit<React.HTMLProps<HTMLDivElement>, 'onChange' | 'children'> {\n children: React.ReactNode | (({ isInView }: { isInView: boolean }) => React.ReactNode);\n key: string;\n onLoad?: () => void;\n onChange?: (isInView: boolean) => void;\n}\n\nexport interface LazyLoaderType extends ForwardRefExoticComponent<Props> {\n addCallback: (id: string, c: (e: IntersectionObserverEntry) => void) => void;\n callbacks: Record<string, (e: IntersectionObserverEntry) => void>;\n observer: IntersectionObserver;\n}\n\nexport const LazyLoader: LazyLoaderType = React.forwardRef<HTMLDivElement, Props>(\n ({ children, onLoad, onChange, className, ...rest }, ref) => {\n const id = useUniqueId();\n const { hideEmpty } = useStyles2(getStyles);\n const [loaded, setLoaded] = useState(false);\n const [isInView, setIsInView] = useState(false);\n const innerRef = useRef<HTMLDivElement>(null);\n\n useImperativeHandle(ref, () => innerRef.current!);\n\n useEffectOnce(() => {\n LazyLoader.addCallback(id, (entry) => {\n if (!loaded && entry.isIntersecting) {\n setLoaded(true);\n onLoad?.();\n }\n\n setIsInView(entry.isIntersecting);\n onChange?.(entry.isIntersecting);\n });\n\n const wrapperEl = innerRef.current;\n\n if (wrapperEl) {\n LazyLoader.observer.observe(wrapperEl);\n }\n\n return () => {\n delete LazyLoader.callbacks[id];\n wrapperEl && LazyLoader.observer.unobserve(wrapperEl);\n if (Object.keys(LazyLoader.callbacks).length === 0) {\n LazyLoader.observer.disconnect();\n }\n };\n });\n\n // If the element was loaded, we add the `hideEmpty` class to potentially\n // hide the LazyLoader if it does not have any children. This is the case\n // when children have the `isHidden` property set. \n // We always include the `className` class, as this is coming from the \n // caller of the `LazyLoader` component.\n const classes = `${loaded ? hideEmpty : ''} ${className}`;\n return (\n <div id={id} ref={innerRef} className={classes} {...rest}>\n {loaded && (typeof children === 'function' ? children({ isInView }) : children)}\n </div>\n );\n }\n) as LazyLoaderType;\n\nfunction getStyles() {\n return {\n hideEmpty: css({\n '&:empty': {\n display: 'none',\n },\n }),\n };\n}\n\nLazyLoader.displayName = 'LazyLoader';\nLazyLoader.callbacks = {} as Record<string, (e: IntersectionObserverEntry) => void>;\nLazyLoader.addCallback = (id: string, c: (e: IntersectionObserverEntry) => void) => (LazyLoader.callbacks[id] = c);\nLazyLoader.observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n LazyLoader.callbacks[entry.target.id](entry);\n }\n },\n { rootMargin: '100px' }\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,SAAS,WAAsB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S,EAAA,MAAA;AAAA,OACX;AAAA,KACD,CAAA;AAAA,GACH,CAAA;AACF,CAAA;AAEA,UAAA,CAAW,WAAc,GAAA,YAAA,CAAA;AACzB,UAAA,CAAW,YAAY,EAAC,CAAA;AACxB,UAAA,CAAW,cAAc,CAAC,EAAA,EAAY,CAA+C,KAAA,UAAA,CAAW,UAAU,EAAM,CAAA,GAAA,CAAA,CAAA;AAChH,UAAA,CAAW,WAAW,IAAI,oBAAA;AAAA,EACxB,CAAC,OAAY,KAAA;AACX,IAAA,KAAA,MAAW,SAAS,OAAS,EAAA;AAC3B,MAAA,UAAA,CAAW,SAAU,CAAA,KAAA,CAAM,MAAO,CAAA,EAAA,CAAA,CAAI,KAAK,CAAA,CAAA;AAAA,KAC7C;AAAA,GACF;AAAA,EACA,EAAE,YAAY,OAAQ,EAAA;AACxB,CAAA;;;;"}
1
+ {"version":3,"file":"LazyLoader.js","sources":["../../../../src/components/layout/LazyLoader.tsx"],"sourcesContent":["import React, { ForwardRefExoticComponent, useImperativeHandle, useRef, useState } from 'react';\nimport { useEffectOnce } from 'react-use';\n\nimport { uniqueId } from 'lodash';\nimport { css } from '@emotion/css';\nimport { useStyles2 } from '@grafana/ui';\n\nexport function useUniqueId(): string {\n const idRefLazy = useRef<string | undefined>(undefined);\n idRefLazy.current ??= uniqueId();\n return idRefLazy.current;\n}\n\nexport interface Props extends Omit<React.HTMLProps<HTMLDivElement>, 'onChange' | 'children'> {\n children: React.ReactNode | (({ isInView }: { isInView: boolean }) => React.ReactNode);\n key: string;\n onLoad?: () => void;\n onChange?: (isInView: boolean) => void;\n}\n\nexport interface LazyLoaderType extends ForwardRefExoticComponent<Props> {\n addCallback: (id: string, c: (e: IntersectionObserverEntry) => void) => void;\n callbacks: Record<string, (e: IntersectionObserverEntry) => void>;\n observer: IntersectionObserver;\n}\n\nexport const LazyLoader: LazyLoaderType = React.forwardRef<HTMLDivElement, Props>(\n ({ children, onLoad, onChange, className, ...rest }, ref) => {\n const id = useUniqueId();\n const { hideEmpty } = useStyles2(getStyles);\n const [loaded, setLoaded] = useState(false);\n const [isInView, setIsInView] = useState(false);\n const innerRef = useRef<HTMLDivElement>(null);\n\n useImperativeHandle(ref, () => innerRef.current!);\n\n useEffectOnce(() => {\n LazyLoader.addCallback(id, (entry) => {\n if (!loaded && entry.isIntersecting) {\n setLoaded(true);\n onLoad?.();\n }\n\n setIsInView(entry.isIntersecting);\n onChange?.(entry.isIntersecting);\n });\n\n const wrapperEl = innerRef.current;\n\n if (wrapperEl) {\n LazyLoader.observer.observe(wrapperEl);\n }\n\n return () => {\n wrapperEl && LazyLoader.observer.unobserve(wrapperEl);\n delete LazyLoader.callbacks[id];\n if (Object.keys(LazyLoader.callbacks).length === 0) {\n LazyLoader.observer.disconnect();\n }\n };\n });\n\n // If the element was loaded, we add the `hideEmpty` class to potentially\n // hide the LazyLoader if it does not have any children. This is the case\n // when children have the `isHidden` property set.\n // We always include the `className` class, as this is coming from the\n // caller of the `LazyLoader` component.\n const classes = `${loaded ? hideEmpty : ''} ${className}`;\n return (\n <div id={id} ref={innerRef} className={classes} {...rest}>\n {loaded && (typeof children === 'function' ? children({ isInView }) : children)}\n </div>\n );\n }\n) as LazyLoaderType;\n\nfunction getStyles() {\n return {\n hideEmpty: css({\n '&:empty': {\n display: 'none',\n },\n }),\n };\n}\n\nLazyLoader.displayName = 'LazyLoader';\nLazyLoader.callbacks = {} as Record<string, (e: IntersectionObserverEntry) => void>;\nLazyLoader.addCallback = (id: string, c: (e: IntersectionObserverEntry) => void) => (LazyLoader.callbacks[id] = c);\nLazyLoader.observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n if (typeof LazyLoader.callbacks[entry.target.id] === 'function') {\n LazyLoader.callbacks[entry.target.id](entry);\n }\n }\n },\n { rootMargin: '100px' }\n);\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,SAAS,WAAsB,GAAA;AAPtC,EAAA,IAAA,EAAA,CAAA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AAA;AAAA,GACH,CAAA;AACF,CAAA;AAEA,UAAA,CAAW,WAAc,GAAA,YAAA,CAAA;AACzB,UAAA,CAAW,YAAY,EAAC,CAAA;AACxB,UAAA,CAAW,cAAc,CAAC,EAAA,EAAY,CAA+C,KAAA,UAAA,CAAW,UAAU,EAAM,CAAA,GAAA,CAAA,CAAA;AAChH,UAAA,CAAW,WAAW,IAAI,oBAAA;AAAA,EACxB,CAAC,OAAY,KAAA;AACX,IAAA,KAAA,MAAW,SAAS,OAAS,EAAA;AAC3B,MAAA,IAAI,OAAO,UAAW,CAAA,SAAA,CAAU,KAAM,CAAA,MAAA,CAAO,QAAQ,UAAY,EAAA;AAC/D,QAAA,UAAA,CAAW,SAAU,CAAA,KAAA,CAAM,MAAO,CAAA,EAAA,CAAA,CAAI,KAAK,CAAA,CAAA;AAAA,OAC7C;AAAA,KACF;AAAA,GACF;AAAA,EACA,EAAE,YAAY,OAAQ,EAAA;AACxB,CAAA;;;;"}
@@ -0,0 +1,442 @@
1
+ import React, { forwardRef, useState, useRef, useImperativeHandle, useCallback, useEffect } from 'react';
2
+ import { useId, useFloating, autoUpdate, flip, size, useRole, useDismiss, useListNavigation, useInteractions, FloatingPortal, FloatingFocusManager } from '@floating-ui/react';
3
+ import { useTheme2, getSelectStyles, useStyles2, IconButton } from '@grafana/ui';
4
+ import { cx, css } from '@emotion/css';
5
+ import { flushSync } from 'react-dom';
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __defProps = Object.defineProperties;
9
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
10
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
13
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
14
+ var __spreadValues = (a, b) => {
15
+ for (var prop in b || (b = {}))
16
+ if (__hasOwnProp.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ if (__getOwnPropSymbols)
19
+ for (var prop of __getOwnPropSymbols(b)) {
20
+ if (__propIsEnum.call(b, prop))
21
+ __defNormalProp(a, prop, b[prop]);
22
+ }
23
+ return a;
24
+ };
25
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
26
+ var __objRest = (source, exclude) => {
27
+ var target = {};
28
+ for (var prop in source)
29
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
30
+ target[prop] = source[prop];
31
+ if (source != null && __getOwnPropSymbols)
32
+ for (var prop of __getOwnPropSymbols(source)) {
33
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
34
+ target[prop] = source[prop];
35
+ }
36
+ return target;
37
+ };
38
+ const Item = forwardRef(
39
+ (_a, ref) => {
40
+ var _b = _a, { children, active } = _b, rest = __objRest(_b, ["children", "active"]);
41
+ const theme = useTheme2();
42
+ const selectStyles = getSelectStyles(theme);
43
+ const id = useId();
44
+ return /* @__PURE__ */ React.createElement("div", __spreadValues({
45
+ ref,
46
+ role: "option",
47
+ id,
48
+ "aria-selected": active,
49
+ className: cx(selectStyles.option, active && selectStyles.optionFocused)
50
+ }, rest), /* @__PURE__ */ React.createElement("div", {
51
+ className: selectStyles.optionBody,
52
+ "data-testid": `data-testid ad hoc filter option value ${children}`
53
+ }, /* @__PURE__ */ React.createElement("span", null, children)));
54
+ }
55
+ );
56
+ const AdHocCombobox = forwardRef(function AdHocCombobox2({ filter, model, wip, handleChangeViewMode }, parentRef) {
57
+ var _a;
58
+ const [open, setOpen] = useState(false);
59
+ const [options, setOptions] = useState([]);
60
+ const [inputValue, setInputValue] = useState("");
61
+ const [activeIndex, setActiveIndex] = useState(null);
62
+ const [inputType, setInputType] = useState(!wip ? "value" : "key");
63
+ const styles = useStyles2(getStyles2);
64
+ const listRef = useRef([]);
65
+ const { _wip } = model.useState();
66
+ const filterToUse = filter || _wip;
67
+ const operatorIdentifier = `${(_a = filterToUse == null ? void 0 : filterToUse.key) != null ? _a : ""}-operator`;
68
+ const { refs, floatingStyles, context } = useFloating({
69
+ whileElementsMounted: autoUpdate,
70
+ open,
71
+ onOpenChange: (nextOpen, _, reason) => {
72
+ setOpen(nextOpen);
73
+ if (["outside-press", "escape-key"].includes(reason || "")) {
74
+ handleChangeViewMode == null ? void 0 : handleChangeViewMode();
75
+ }
76
+ },
77
+ middleware: [
78
+ flip({ padding: 10 }),
79
+ size({
80
+ apply({ rects, availableHeight, elements }) {
81
+ Object.assign(elements.floating.style, {
82
+ width: `${rects.reference.width}px`,
83
+ maxHeight: `${availableHeight > 256 ? 256 : availableHeight}px`
84
+ });
85
+ },
86
+ padding: 10
87
+ })
88
+ ]
89
+ });
90
+ const role = useRole(context, { role: "listbox" });
91
+ const dismiss = useDismiss(context, {
92
+ outsidePress: (event) => {
93
+ return !event.currentTarget.classList.contains(
94
+ operatorIdentifier
95
+ );
96
+ }
97
+ });
98
+ const listNav = useListNavigation(context, {
99
+ listRef,
100
+ activeIndex,
101
+ onNavigate: setActiveIndex,
102
+ virtual: true,
103
+ loop: true
104
+ });
105
+ const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([role, dismiss, listNav]);
106
+ useImperativeHandle(parentRef, () => () => {
107
+ var _a2;
108
+ return (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
109
+ }, [refs.domReference]);
110
+ function onChange(event) {
111
+ var _a2, _b;
112
+ if (inputType === "key") {
113
+ const lastChar = event.target.value.slice(-1);
114
+ if (["=", "!", "<", ">"].includes(lastChar)) {
115
+ const key = event.target.value.slice(0, -1);
116
+ const optionIndex = options.findIndex((option) => option.value === key);
117
+ if (optionIndex >= 0) {
118
+ model._updateFilter(filterToUse, inputType, options[optionIndex]);
119
+ setInputValue(lastChar);
120
+ }
121
+ flushSync(() => {
122
+ setInputType("operator");
123
+ });
124
+ (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
125
+ return;
126
+ }
127
+ }
128
+ if (inputType === "operator") {
129
+ const lastChar = event.target.value.slice(-1);
130
+ if (/\w/.test(lastChar)) {
131
+ const operator = event.target.value.slice(0, -1);
132
+ if (!/\w/.test(operator)) {
133
+ const optionIndex = options.findIndex((option) => option.value === operator);
134
+ if (optionIndex >= 0) {
135
+ model._updateFilter(filterToUse, inputType, options[optionIndex]);
136
+ setInputValue(lastChar);
137
+ }
138
+ flushSync(() => {
139
+ setInputType("value");
140
+ });
141
+ (_b = refs.domReference.current) == null ? void 0 : _b.focus();
142
+ return;
143
+ }
144
+ }
145
+ }
146
+ const value = event.target.value;
147
+ setInputValue(value);
148
+ setActiveIndex(0);
149
+ }
150
+ const items = options.filter(
151
+ (item) => {
152
+ var _a2, _b;
153
+ return (_b = (_a2 = item.label) != null ? _a2 : item.value) == null ? void 0 : _b.toLocaleLowerCase().startsWith(inputValue.toLowerCase());
154
+ }
155
+ );
156
+ const flushInputType = useCallback((inputType2) => {
157
+ flushSync(() => {
158
+ setInputType(inputType2);
159
+ });
160
+ }, []);
161
+ useEffect(() => {
162
+ if (wip && !_wip) {
163
+ model._addWip();
164
+ }
165
+ }, [_wip]);
166
+ useEffect(() => {
167
+ if (!wip && refs.domReference.current) {
168
+ setInputType("value");
169
+ setInputValue("");
170
+ refs.domReference.current.focus();
171
+ }
172
+ }, []);
173
+ const handleFetchOptions = useCallback(async () => {
174
+ let options2 = [];
175
+ if (inputType === "key") {
176
+ options2 = await model._getKeys(null);
177
+ } else if (inputType === "operator") {
178
+ options2 = model._getOperators();
179
+ } else if (inputType === "value") {
180
+ options2 = await model._getValuesFor(filterToUse);
181
+ }
182
+ setOptions(options2);
183
+ }, [filterToUse, inputType, model]);
184
+ const handleBackspaceInput = useCallback(
185
+ (event) => {
186
+ if (event.key === "Backspace" && !inputValue && inputType === "key") {
187
+ model._removeLastFilter();
188
+ setOpen(false);
189
+ }
190
+ },
191
+ [inputValue]
192
+ );
193
+ const handleShiftTabInput = useCallback((event) => {
194
+ if (event.key === "Tab" && !event.shiftKey) {
195
+ handleChangeViewMode == null ? void 0 : handleChangeViewMode();
196
+ }
197
+ }, []);
198
+ const handleEnterInput = useCallback(
199
+ (event) => {
200
+ var _a2;
201
+ if (event.key === "Enter" && activeIndex != null && items[activeIndex]) {
202
+ model._updateFilter(filterToUse, inputType, items[activeIndex]);
203
+ setInputValue("");
204
+ if (inputType === "key") {
205
+ flushInputType("operator");
206
+ } else if (inputType === "operator") {
207
+ flushInputType("value");
208
+ } else if (inputType === "value") {
209
+ flushInputType("key");
210
+ handleChangeViewMode == null ? void 0 : handleChangeViewMode();
211
+ }
212
+ (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
213
+ }
214
+ },
215
+ [activeIndex, filterToUse, inputType, items, model]
216
+ );
217
+ useEffect(() => {
218
+ if (open) {
219
+ handleFetchOptions();
220
+ }
221
+ }, [open, inputType]);
222
+ return /* @__PURE__ */ React.createElement("div", {
223
+ className: styles.comboboxWrapper
224
+ }, filterToUse ? /* @__PURE__ */ React.createElement("div", {
225
+ className: styles.pillWrapper
226
+ }, (filterToUse == null ? void 0 : filterToUse.key) ? /* @__PURE__ */ React.createElement("div", {
227
+ className: cx(styles.basePill, styles.keyPill)
228
+ }, filterToUse.key) : null, (filterToUse == null ? void 0 : filterToUse.key) && (filterToUse == null ? void 0 : filterToUse.operator) && inputType !== "operator" ? /* @__PURE__ */ React.createElement("div", {
229
+ className: cx(styles.basePill, operatorIdentifier),
230
+ role: "button",
231
+ "aria-label": "Edit filter operator",
232
+ tabIndex: 0,
233
+ onClick: (event) => {
234
+ var _a2;
235
+ event.stopPropagation();
236
+ flushInputType("operator");
237
+ (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
238
+ },
239
+ onKeyDown: (e) => {
240
+ var _a2;
241
+ if (e.key === "Enter") {
242
+ flushInputType("operator");
243
+ (_a2 = refs.domReference.current) == null ? void 0 : _a2.focus();
244
+ }
245
+ }
246
+ }, filterToUse.operator) : null, (filterToUse == null ? void 0 : filterToUse.key) && (filterToUse == null ? void 0 : filterToUse.operator) && (filterToUse == null ? void 0 : filterToUse.value) && !["operator", "value"].includes(inputType) ? /* @__PURE__ */ React.createElement("div", {
247
+ className: cx(styles.basePill, styles.valuePill)
248
+ }, filterToUse.value) : null) : null, /* @__PURE__ */ React.createElement("input", __spreadProps(__spreadValues({}, getReferenceProps({
249
+ ref: refs.setReference,
250
+ onChange,
251
+ value: inputValue,
252
+ placeholder: !wip ? inputType === "operator" ? `${filterToUse[inputType]} ${filterToUse.value || ""}` : filterToUse[inputType] : "Filter by label values",
253
+ "aria-autocomplete": "list",
254
+ onKeyDown(event) {
255
+ handleBackspaceInput(event);
256
+ handleShiftTabInput(event);
257
+ handleEnterInput(event);
258
+ }
259
+ })), {
260
+ className: styles.inputStyle,
261
+ onClick: (event) => {
262
+ event.stopPropagation();
263
+ setOpen(true);
264
+ },
265
+ onFocus: () => {
266
+ setActiveIndex(0);
267
+ setOpen(true);
268
+ }
269
+ })), /* @__PURE__ */ React.createElement(FloatingPortal, null, open && /* @__PURE__ */ React.createElement(FloatingFocusManager, {
270
+ context,
271
+ initialFocus: -1,
272
+ visuallyHiddenDismiss: true
273
+ }, /* @__PURE__ */ React.createElement("div", __spreadProps(__spreadValues({}, getFloatingProps({
274
+ ref: refs.setFloating,
275
+ style: __spreadProps(__spreadValues({}, floatingStyles), {
276
+ overflowY: "auto"
277
+ })
278
+ })), {
279
+ className: styles.dropdownWrapper
280
+ }), items.map((item, index) => {
281
+ var _a2;
282
+ return /* @__PURE__ */ React.createElement(Item, __spreadProps(__spreadValues({}, getItemProps({
283
+ key: item.value,
284
+ ref(node) {
285
+ listRef.current[index] = node;
286
+ },
287
+ onClick() {
288
+ var _a3;
289
+ model._updateFilter(filterToUse, inputType, item);
290
+ setInputValue("");
291
+ if (inputType === "key") {
292
+ flushInputType("operator");
293
+ } else if (inputType === "operator") {
294
+ flushInputType("value");
295
+ } else if (inputType === "value") {
296
+ flushInputType("key");
297
+ handleChangeViewMode == null ? void 0 : handleChangeViewMode();
298
+ }
299
+ (_a3 = refs.domReference.current) == null ? void 0 : _a3.focus();
300
+ }
301
+ })), {
302
+ active: activeIndex === index
303
+ }), (_a2 = item.label) != null ? _a2 : item.value);
304
+ })))));
305
+ });
306
+ const getStyles2 = (theme) => ({
307
+ comboboxWrapper: css({
308
+ display: "flex",
309
+ flexWrap: "nowrap"
310
+ }),
311
+ pillWrapper: css({
312
+ display: "flex",
313
+ alignItems: "center",
314
+ whiteSpace: "nowrap"
315
+ }),
316
+ basePill: css(__spreadProps(__spreadValues({
317
+ display: "flex",
318
+ alignItems: "center",
319
+ background: theme.colors.action.disabledBackground,
320
+ border: `1px solid ${theme.colors.border.weak}`,
321
+ padding: theme.spacing(0.125, 1, 0.125, 1),
322
+ color: theme.colors.text.primary,
323
+ overflow: "hidden",
324
+ whiteSpace: "nowrap",
325
+ minHeight: "22px"
326
+ }, theme.typography.bodySmall), {
327
+ cursor: "pointer"
328
+ })),
329
+ keyPill: css({
330
+ fontWeight: theme.typography.fontWeightBold,
331
+ cursor: "default"
332
+ }),
333
+ valuePill: css({
334
+ background: theme.colors.action.selected
335
+ }),
336
+ dropdownWrapper: css({
337
+ backgroundColor: theme.colors.background.primary,
338
+ color: theme.colors.text.primary,
339
+ boxShadow: theme.shadows.z2
340
+ }),
341
+ inputStyle: css({
342
+ paddingBlock: 0,
343
+ "&:focus": {
344
+ outline: "none"
345
+ }
346
+ })
347
+ });
348
+ function AdHocFilterEditSwitch({ filter, model }) {
349
+ const styles = useStyles2(getStyles3);
350
+ const [viewMode, setViewMode] = useState(true);
351
+ const handleChangeViewMode = useCallback((event) => {
352
+ event == null ? void 0 : event.stopPropagation();
353
+ flushSync(() => {
354
+ setViewMode((mode) => !mode);
355
+ });
356
+ }, []);
357
+ if (viewMode) {
358
+ return /* @__PURE__ */ React.createElement("div", {
359
+ className: styles.combinedFilterPill,
360
+ onClick: handleChangeViewMode,
361
+ onKeyDown: (e) => {
362
+ if (e.key === "Enter") {
363
+ handleChangeViewMode();
364
+ }
365
+ },
366
+ role: "button",
367
+ "aria-label": "Edit filter",
368
+ tabIndex: 0
369
+ }, /* @__PURE__ */ React.createElement("span", null, filter.key, " ", filter.operator, " ", filter.value), /* @__PURE__ */ React.createElement(IconButton, {
370
+ onClick: (e) => {
371
+ e.stopPropagation();
372
+ model._removeFilter(filter);
373
+ },
374
+ onKeyDownCapture: (e) => {
375
+ if (e.key === "Enter") {
376
+ e.preventDefault();
377
+ e.stopPropagation();
378
+ model._removeFilter(filter);
379
+ }
380
+ },
381
+ name: "times",
382
+ size: "md",
383
+ className: styles.removeButton,
384
+ tooltip: "Remove filter"
385
+ }));
386
+ }
387
+ return /* @__PURE__ */ React.createElement(AdHocCombobox, {
388
+ filter,
389
+ model,
390
+ handleChangeViewMode
391
+ });
392
+ }
393
+ const getStyles3 = (theme) => ({
394
+ wrapper: css({
395
+ display: "flex",
396
+ flexWrap: "wrap",
397
+ alignItems: "center",
398
+ columnGap: theme.spacing(1),
399
+ rowGap: theme.spacing(1),
400
+ minHeight: theme.spacing(4),
401
+ backgroundColor: theme.components.input.background,
402
+ border: `1px solid ${theme.colors.border.strong}`,
403
+ borderRadius: theme.shape.radius.default,
404
+ paddingInline: theme.spacing(1),
405
+ "&:focus-within": {
406
+ outline: "2px dotted transparent",
407
+ outlineOffset: "2px",
408
+ boxShadow: `0 0 0 2px ${theme.colors.background.canvas}, 0 0 0px 4px ${theme.colors.primary.main}`,
409
+ transitionTimingFunction: `cubic-bezier(0.19, 1, 0.22, 1)`,
410
+ transitionDuration: "0.2s",
411
+ transitionProperty: "outline, outline-offset, box-shadow"
412
+ }
413
+ }),
414
+ combinedFilterPill: css(__spreadProps(__spreadValues({
415
+ display: "flex",
416
+ alignItems: "center",
417
+ background: theme.colors.action.selected,
418
+ borderRadius: theme.shape.radius.default,
419
+ border: `1px solid ${theme.colors.border.weak}`,
420
+ padding: theme.spacing(0.125, 0, 0.125, 1),
421
+ color: theme.colors.text.primary,
422
+ overflow: "hidden",
423
+ whiteSpace: "nowrap",
424
+ minHeight: "22px"
425
+ }, theme.typography.bodySmall), {
426
+ fontWeight: theme.typography.fontWeightBold,
427
+ cursor: "pointer",
428
+ "&:hover": {
429
+ background: theme.colors.emphasize(theme.colors.background.secondary)
430
+ }
431
+ })),
432
+ removeButton: css({
433
+ marginInline: theme.spacing(0.5),
434
+ cursor: "pointer",
435
+ "&:hover": {
436
+ color: theme.colors.text.primary
437
+ }
438
+ })
439
+ });
440
+
441
+ export { AdHocCombobox, AdHocFilterEditSwitch };
442
+ //# sourceMappingURL=AdHocCombobox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdHocCombobox.js","sources":["../../../../src/variables/adhoc/AdHocCombobox.tsx"],"sourcesContent":["import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useRef, useState } from 'react';\nimport {\n autoUpdate,\n size,\n flip,\n useId,\n useDismiss,\n useFloating,\n useInteractions,\n useListNavigation,\n useRole,\n FloatingFocusManager,\n FloatingPortal,\n} from '@floating-ui/react';\nimport { IconButton, getSelectStyles, useStyles2, useTheme2 } from '@grafana/ui';\nimport { GrafanaTheme2, SelectableValue } from '@grafana/data';\nimport { css, cx } from '@emotion/css';\nimport { AdHocFilterWithLabels, AdHocFiltersVariable } from './AdHocFiltersVariable';\nimport { flushSync } from 'react-dom';\n\ninterface ItemProps {\n children: React.ReactNode;\n active: boolean;\n}\n\n// eslint-disable-next-line react/display-name\nconst Item = forwardRef<HTMLDivElement, ItemProps & React.HTMLProps<HTMLDivElement>>(\n ({ children, active, ...rest }, ref) => {\n const theme = useTheme2();\n const selectStyles = getSelectStyles(theme);\n const id = useId();\n return (\n <div\n ref={ref}\n role=\"option\"\n id={id}\n aria-selected={active}\n className={cx(selectStyles.option, active && selectStyles.optionFocused)}\n {...rest}\n >\n <div className={selectStyles.optionBody} data-testid={`data-testid ad hoc filter option value ${children}`}>\n <span>{children}</span>\n </div>\n </div>\n );\n }\n);\n\ninterface AdHocComboboxProps {\n filter?: AdHocFilterWithLabels;\n wip?: boolean;\n model: AdHocFiltersVariable;\n handleChangeViewMode?: () => void;\n}\n\ntype AdHocInputType = 'key' | 'operator' | 'value';\n\nexport const AdHocCombobox = forwardRef(function AdHocCombobox(\n { filter, model, wip, handleChangeViewMode }: AdHocComboboxProps,\n parentRef\n) {\n const [open, setOpen] = useState(false);\n // const [optionsLoading, setOptionsLoading] = useState<boolean>(false);\n const [options, setOptions] = useState<Array<SelectableValue<string>>>([]);\n const [inputValue, setInputValue] = useState('');\n const [activeIndex, setActiveIndex] = useState<number | null>(null);\n const [inputType, setInputType] = useState<AdHocInputType>(!wip ? 'value' : 'key');\n const styles = useStyles2(getStyles2);\n\n const listRef = useRef<Array<HTMLElement | null>>([]);\n const { _wip } = model.useState();\n\n const filterToUse = filter || _wip;\n\n const operatorIdentifier = `${filterToUse?.key ?? ''}-operator`;\n\n const { refs, floatingStyles, context } = useFloating<HTMLInputElement>({\n whileElementsMounted: autoUpdate,\n open,\n onOpenChange: (nextOpen, _, reason) => {\n setOpen(nextOpen);\n // change from filter edit mode to filter view mode when clicked\n // outside input or dropdown\n if (['outside-press', 'escape-key'].includes(reason || '')) {\n handleChangeViewMode?.();\n }\n },\n middleware: [\n flip({ padding: 10 }),\n size({\n apply({ rects, availableHeight, elements }) {\n Object.assign(elements.floating.style, {\n width: `${rects.reference.width}px`,\n // limit the maxHeight of dropdown\n maxHeight: `${availableHeight > 256 ? 256 : availableHeight}px`,\n });\n },\n padding: 10,\n }),\n ],\n });\n\n const role = useRole(context, { role: 'listbox' });\n const dismiss = useDismiss(context, {\n // if outside click lands on operator pill, then ignore outside click\n outsidePress: (event) => {\n return !(event as unknown as React.MouseEvent<HTMLElement, MouseEvent>).currentTarget.classList.contains(\n operatorIdentifier\n );\n },\n });\n const listNav = useListNavigation(context, {\n listRef,\n activeIndex,\n onNavigate: setActiveIndex,\n virtual: true,\n loop: true,\n });\n\n const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([role, dismiss, listNav]);\n\n // pass ability to focus on input element back to parent\n useImperativeHandle(parentRef, () => () => refs.domReference.current?.focus(), [refs.domReference]);\n\n function onChange(event: React.ChangeEvent<HTMLInputElement>) {\n // part of POC for seamless filter parser\n if (inputType === 'key') {\n const lastChar = event.target.value.slice(-1);\n if (['=', '!', '<', '>'].includes(lastChar)) {\n const key = event.target.value.slice(0, -1);\n const optionIndex = options.findIndex((option) => option.value === key);\n if (optionIndex >= 0) {\n model._updateFilter(filterToUse!, inputType, options[optionIndex]);\n setInputValue(lastChar);\n }\n flushSync(() => {\n setInputType('operator');\n });\n refs.domReference.current?.focus();\n return;\n }\n }\n if (inputType === 'operator') {\n const lastChar = event.target.value.slice(-1);\n if (/\\w/.test(lastChar)) {\n const operator = event.target.value.slice(0, -1);\n if (!/\\w/.test(operator)) {\n const optionIndex = options.findIndex((option) => option.value === operator);\n if (optionIndex >= 0) {\n model._updateFilter(filterToUse!, inputType, options[optionIndex]);\n setInputValue(lastChar);\n }\n flushSync(() => {\n setInputType('value');\n });\n refs.domReference.current?.focus();\n return;\n }\n }\n }\n\n const value = event.target.value;\n setInputValue(value);\n setActiveIndex(0);\n }\n\n const items = options.filter((item) =>\n (item.label ?? item.value)?.toLocaleLowerCase().startsWith(inputValue.toLowerCase())\n );\n\n const flushInputType = useCallback((inputType: AdHocInputType) => {\n flushSync(() => {\n setInputType(inputType);\n });\n }, []);\n\n // when combobox is in wip mode then check and add _wip if its missing\n // needed on first render and when _wip is reset on filter value commit\n useEffect(() => {\n if (wip && !_wip) {\n model._addWip();\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [_wip]);\n\n // when not in wip mode this is the point of switching from view to edit mode\n // and in this case we default to 'value' input type and focus input\n useEffect(() => {\n if (!wip && refs.domReference.current) {\n setInputType('value');\n setInputValue('');\n\n refs.domReference.current.focus();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleFetchOptions = useCallback(async () => {\n let options: Array<SelectableValue<string>> = [];\n // TODO: missing async placeholder while options load\n if (inputType === 'key') {\n options = await model._getKeys(null);\n } else if (inputType === 'operator') {\n options = model._getOperators();\n } else if (inputType === 'value') {\n options = await model._getValuesFor(filterToUse!);\n }\n setOptions(options);\n }, [filterToUse, inputType, model]);\n\n const handleBackspaceInput = useCallback(\n (event: React.KeyboardEvent) => {\n if (event.key === 'Backspace' && !inputValue && inputType === 'key') {\n model._removeLastFilter();\n setOpen(false);\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [inputValue]\n );\n\n const handleShiftTabInput = useCallback((event: React.KeyboardEvent) => {\n // change filter to view mode when navigating away with Tab key\n // this is needed because useDismiss only reacts to mousedown\n if (event.key === 'Tab' && !event.shiftKey) {\n handleChangeViewMode?.();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n const handleEnterInput = useCallback(\n (event: React.KeyboardEvent) => {\n if (event.key === 'Enter' && activeIndex != null && items[activeIndex]) {\n model._updateFilter(filterToUse!, inputType, items[activeIndex]);\n setInputValue('');\n\n if (inputType === 'key') {\n flushInputType('operator');\n } else if (inputType === 'operator') {\n flushInputType('value');\n } else if (inputType === 'value') {\n flushInputType('key');\n\n handleChangeViewMode?.();\n }\n\n refs.domReference.current?.focus();\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [activeIndex, filterToUse, inputType, items, model]\n );\n\n useEffect(() => {\n if (open) {\n handleFetchOptions();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open, inputType]);\n\n return (\n <div className={styles.comboboxWrapper}>\n {filterToUse ? (\n <div className={styles.pillWrapper}>\n {filterToUse?.key ? <div className={cx(styles.basePill, styles.keyPill)}>{filterToUse.key}</div> : null}\n {filterToUse?.key && filterToUse?.operator && inputType !== 'operator' ? (\n <div\n className={cx(styles.basePill, operatorIdentifier)}\n role=\"button\"\n aria-label=\"Edit filter operator\"\n tabIndex={0}\n onClick={(event) => {\n event.stopPropagation();\n flushInputType('operator');\n\n refs.domReference.current?.focus();\n }}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n flushInputType('operator');\n\n refs.domReference.current?.focus();\n }\n }}\n >\n {filterToUse.operator}\n </div>\n ) : null}\n {filterToUse?.key &&\n filterToUse?.operator &&\n filterToUse?.value &&\n !['operator', 'value'].includes(inputType) ? (\n <div className={cx(styles.basePill, styles.valuePill)}>{filterToUse.value}</div>\n ) : null}\n </div>\n ) : null}\n\n <input\n {...getReferenceProps({\n ref: refs.setReference,\n onChange,\n value: inputValue,\n // dynamic placeholder to display operator and/or value in filter edit mode\n placeholder: !wip\n ? inputType === 'operator'\n ? `${filterToUse![inputType]} ${filterToUse!.value || ''}`\n : filterToUse![inputType]\n : 'Filter by label values',\n 'aria-autocomplete': 'list',\n onKeyDown(event) {\n handleBackspaceInput(event);\n handleShiftTabInput(event);\n handleEnterInput(event);\n },\n })}\n className={styles.inputStyle}\n onClick={(event) => {\n event.stopPropagation();\n setOpen(true);\n }}\n onFocus={() => {\n setActiveIndex(0);\n setOpen(true);\n }}\n />\n <FloatingPortal>\n {open && (\n <FloatingFocusManager context={context} initialFocus={-1} visuallyHiddenDismiss>\n <div\n {...getFloatingProps({\n ref: refs.setFloating,\n style: {\n ...floatingStyles,\n overflowY: 'auto',\n },\n })}\n className={styles.dropdownWrapper}\n >\n {items.map((item, index) => (\n // eslint-disable-next-line react/jsx-key\n <Item\n {...getItemProps({\n key: item.value!,\n ref(node) {\n listRef.current[index] = node;\n },\n onClick() {\n model._updateFilter(filterToUse!, inputType, item);\n setInputValue('');\n\n if (inputType === 'key') {\n flushInputType('operator');\n } else if (inputType === 'operator') {\n flushInputType('value');\n } else if (inputType === 'value') {\n flushInputType('key');\n handleChangeViewMode?.();\n }\n\n refs.domReference.current?.focus();\n },\n })}\n active={activeIndex === index}\n >\n {item.label ?? item.value}\n </Item>\n ))}\n </div>\n </FloatingFocusManager>\n )}\n </FloatingPortal>\n </div>\n );\n});\n\nconst getStyles2 = (theme: GrafanaTheme2) => ({\n comboboxWrapper: css({\n display: 'flex',\n flexWrap: 'nowrap',\n }),\n pillWrapper: css({\n display: 'flex',\n alignItems: 'center',\n whiteSpace: 'nowrap',\n }),\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: '22px',\n ...theme.typography.bodySmall,\n cursor: 'pointer',\n }),\n keyPill: css({\n fontWeight: theme.typography.fontWeightBold,\n cursor: 'default',\n }),\n valuePill: css({\n background: theme.colors.action.selected,\n }),\n dropdownWrapper: css({\n backgroundColor: theme.colors.background.primary,\n color: theme.colors.text.primary,\n boxShadow: theme.shadows.z2,\n }),\n inputStyle: css({\n paddingBlock: 0,\n '&:focus': {\n outline: 'none',\n },\n }),\n});\n\ninterface AdHocFilterEditSwitchProps {\n filter: AdHocFilterWithLabels;\n model: AdHocFiltersVariable;\n}\n\nexport function AdHocFilterEditSwitch({ filter, model }: AdHocFilterEditSwitchProps) {\n const styles = useStyles2(getStyles3);\n const [viewMode, setViewMode] = useState(true);\n\n const handleChangeViewMode = useCallback((event?: React.MouseEvent) => {\n event?.stopPropagation();\n flushSync(() => {\n setViewMode((mode) => !mode);\n });\n }, []);\n\n if (viewMode) {\n return (\n <div\n className={styles.combinedFilterPill}\n onClick={handleChangeViewMode}\n onKeyDown={(e) => {\n if (e.key === 'Enter') {\n handleChangeViewMode();\n }\n }}\n role=\"button\"\n aria-label=\"Edit filter\"\n tabIndex={0}\n >\n <span>\n {filter.key} {filter.operator} {filter.value}\n </span>\n <IconButton\n onClick={(e) => {\n e.stopPropagation();\n model._removeFilter(filter);\n }}\n onKeyDownCapture={(e) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n model._removeFilter(filter);\n }\n }}\n name=\"times\"\n size=\"md\"\n className={styles.removeButton}\n tooltip=\"Remove filter\"\n />\n </div>\n );\n }\n\n return <AdHocCombobox filter={filter} model={model} handleChangeViewMode={handleChangeViewMode} />;\n}\n\nconst getStyles3 = (theme: GrafanaTheme2) => ({\n wrapper: css({\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center',\n columnGap: theme.spacing(1),\n rowGap: theme.spacing(1),\n minHeight: theme.spacing(4),\n backgroundColor: theme.components.input.background,\n border: `1px solid ${theme.colors.border.strong}`,\n borderRadius: theme.shape.radius.default,\n paddingInline: theme.spacing(1),\n\n '&:focus-within': {\n outline: '2px dotted transparent',\n outlineOffset: '2px',\n boxShadow: `0 0 0 2px ${theme.colors.background.canvas}, 0 0 0px 4px ${theme.colors.primary.main}`,\n transitionTimingFunction: `cubic-bezier(0.19, 1, 0.22, 1)`,\n transitionDuration: '0.2s',\n transitionProperty: 'outline, outline-offset, box-shadow',\n },\n }),\n combinedFilterPill: css({\n display: 'flex',\n alignItems: 'center',\n background: theme.colors.action.selected,\n borderRadius: theme.shape.radius.default,\n border: `1px solid ${theme.colors.border.weak}`,\n padding: theme.spacing(0.125, 0, 0.125, 1),\n color: theme.colors.text.primary,\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n minHeight: '22px',\n ...theme.typography.bodySmall,\n fontWeight: theme.typography.fontWeightBold,\n cursor: 'pointer',\n\n '&:hover': {\n background: theme.colors.emphasize(theme.colors.background.secondary),\n },\n }),\n removeButton: css({\n marginInline: theme.spacing(0.5),\n cursor: 'pointer',\n '&:hover': {\n color: theme.colors.text.primary,\n },\n }),\n});\n"],"names":["AdHocCombobox","_a","inputType","options"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,IAAO,GAAA,UAAA;AAAA,EACX,CAAC,IAA+B,GAAQ,KAAA;AAAvC,IAAA,IAAA,EAAA,GAAA,EAAA,EAAE,YAAU,MA3Bf,EAAA,GA2BG,IAAuB,IAAvB,GAAA,SAAA,CAAA,EAAA,EAAuB,CAArB,UAAU,EAAA,QAAA,C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,GAAI,CAAA;AAAA,IAChB,YAAA,EAAc,KAAM,CAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,IAC/B,MAAQ,EAAA,SAAA;AAAA,IACR,SAAW,EAAA;AAAA,MACT,KAAA,EAAO,KAAM,CAAA,MAAA,CAAO,IAAK,CAAA,OAAA;AAAA,KAC3B;AAAA,GACD,CAAA;AACH,CAAA,CAAA;;;;"}
@@ -25,10 +25,7 @@ function AdHocFilterRenderer({ filter, model }) {
25
25
  const [valueHasCustomValue, setValueHasCustomValue] = useState(false);
26
26
  const keyValue = keyLabelToOption(filter.key, filter.keyLabel);
27
27
  const valueValue = keyLabelToOption(filter.value, filter.valueLabel);
28
- const optionSearcher = useMemo(
29
- () => getAdhocOptionSearcher(values),
30
- [values]
31
- );
28
+ const optionSearcher = useMemo(() => getAdhocOptionSearcher(values), [values]);
32
29
  const onValueInputChange = (value, { action }) => {
33
30
  if (action === "input-change") {
34
31
  setValueInputValue(value);