@ember-eui/core 16.0.1 → 16.0.3
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/declarations/-private/associate-form-row-label.d.ts +9 -0
- package/declarations/-private/associate-form-row-label.d.ts.map +1 -0
- package/declarations/-private/vis-colors.d.ts +8 -0
- package/declarations/-private/vis-colors.d.ts.map +1 -0
- package/declarations/components/eui-aspect-ratio.d.ts +5 -0
- package/declarations/components/eui-aspect-ratio.d.ts.map +1 -1
- package/declarations/components/eui-avatar.d.ts +6 -0
- package/declarations/components/eui-avatar.d.ts.map +1 -1
- package/declarations/components/eui-basic-table.d.ts.map +1 -1
- package/declarations/components/eui-color-picker.d.ts +3 -0
- package/declarations/components/eui-color-picker.d.ts.map +1 -1
- package/declarations/components/eui-color-stops/thumb.d.ts +3 -1
- package/declarations/components/eui-color-stops/thumb.d.ts.map +1 -1
- package/declarations/components/eui-combo-box/trigger/input.d.ts +9 -0
- package/declarations/components/eui-combo-box/trigger/input.d.ts.map +1 -1
- package/declarations/components/eui-combo-box/trigger.d.ts +13 -0
- package/declarations/components/eui-combo-box/trigger.d.ts.map +1 -1
- package/declarations/components/eui-combo-box.d.ts +26 -0
- package/declarations/components/eui-combo-box.d.ts.map +1 -1
- package/declarations/components/eui-data-grid/body.d.ts +2 -0
- package/declarations/components/eui-data-grid/body.d.ts.map +1 -1
- package/declarations/components/eui-data-grid.d.ts.map +1 -1
- package/declarations/components/eui-dual-range.d.ts +2 -0
- package/declarations/components/eui-dual-range.d.ts.map +1 -1
- package/declarations/components/eui-focus-trap.d.ts +1 -0
- package/declarations/components/eui-focus-trap.d.ts.map +1 -1
- package/declarations/components/eui-global-toast-list.d.ts +8 -1
- package/declarations/components/eui-global-toast-list.d.ts.map +1 -1
- package/declarations/components/eui-markdown-editor-drop-zone.d.ts.map +1 -1
- package/declarations/components/eui-markdown-editor.d.ts.map +1 -1
- package/declarations/components/eui-markdown-format.d.ts +2 -0
- package/declarations/components/eui-markdown-format.d.ts.map +1 -1
- package/declarations/components/eui-overlay-mask.d.ts +5 -2
- package/declarations/components/eui-overlay-mask.d.ts.map +1 -1
- package/declarations/components/eui-popover.d.ts +5 -1
- package/declarations/components/eui-popover.d.ts.map +1 -1
- package/declarations/components/eui-range.d.ts +3 -0
- package/declarations/components/eui-range.d.ts.map +1 -1
- package/declarations/components/eui-saturation.d.ts +3 -1
- package/declarations/components/eui-saturation.d.ts.map +1 -1
- package/declarations/components/eui-search-bar/field-value-selection-filter.d.ts.map +1 -1
- package/declarations/components/eui-text-color.d.ts +6 -0
- package/declarations/components/eui-text-color.d.ts.map +1 -1
- package/declarations/components/eui-text.d.ts.map +1 -1
- package/declarations/components/eui-token.d.ts +11 -0
- package/declarations/components/eui-token.d.ts.map +1 -1
- package/declarations/components/eui-tool-tip.d.ts +1 -2
- package/declarations/components/eui-tool-tip.d.ts.map +1 -1
- package/declarations/modifiers/outside-click-detector.d.ts +3 -0
- package/declarations/modifiers/outside-click-detector.d.ts.map +1 -1
- package/declarations/modifiers/resize-observer.d.ts +3 -0
- package/declarations/modifiers/resize-observer.d.ts.map +1 -1
- package/declarations/services/eui-config.d.ts +5 -0
- package/declarations/services/eui-config.d.ts.map +1 -1
- package/declarations/utils/common.d.ts +42 -0
- package/declarations/utils/common.d.ts.map +1 -0
- package/declarations/utils/css-mappings/eui-avatar.d.ts +1 -1
- package/declarations/utils/css-mappings/eui-text.d.ts +1 -0
- package/declarations/utils/css-mappings/eui-text.d.ts.map +1 -1
- package/declarations/utils/eui/combo-box.d.ts +1 -1
- package/declarations/utils/eui/combo-box.d.ts.map +1 -1
- package/declarations/utils/eui/content-blocks.d.ts +14 -0
- package/declarations/utils/eui/content-blocks.d.ts.map +1 -0
- package/declarations/utils/eui/flyout-manager/reducer.d.ts.map +1 -1
- package/declarations/utils/eui/styles.d.ts +5 -0
- package/declarations/utils/eui/styles.d.ts.map +1 -1
- package/declarations/utils/retain-document-listener.d.ts +8 -0
- package/declarations/utils/retain-document-listener.d.ts.map +1 -0
- package/declarations/utils/token-map.d.ts +11 -0
- package/declarations/utils/token-map.d.ts.map +1 -0
- package/declarations/utils/transition.d.ts +1 -1
- package/declarations/utils/transition.d.ts.map +1 -1
- package/dist/components/eui-aspect-ratio.js +20 -5
- package/dist/components/eui-aspect-ratio.js.map +1 -1
- package/dist/components/eui-avatar.js +16 -4
- package/dist/components/eui-avatar.js.map +1 -1
- package/dist/components/eui-basic-table.js +4 -2
- package/dist/components/eui-basic-table.js.map +1 -1
- package/dist/components/eui-color-picker.js +8 -2
- package/dist/components/eui-color-picker.js.map +1 -1
- package/dist/components/eui-color-stops/thumb.js +17 -5
- package/dist/components/eui-color-stops/thumb.js.map +1 -1
- package/dist/components/eui-combo-box/trigger/input.js +23 -2
- package/dist/components/eui-combo-box/trigger/input.js.map +1 -1
- package/dist/components/eui-combo-box/trigger.js +32 -2
- package/dist/components/eui-combo-box/trigger.js.map +1 -1
- package/dist/components/eui-combo-box.js +40 -5
- package/dist/components/eui-combo-box.js.map +1 -1
- package/dist/components/eui-data-grid/body.js +21 -1
- package/dist/components/eui-data-grid/body.js.map +1 -1
- package/dist/components/eui-data-grid.js +6 -4
- package/dist/components/eui-data-grid.js.map +1 -1
- package/dist/components/eui-dual-range.js +5 -2
- package/dist/components/eui-dual-range.js.map +1 -1
- package/dist/components/eui-focus-trap.js +4 -1
- package/dist/components/eui-focus-trap.js.map +1 -1
- package/dist/components/eui-global-toast-list.js +33 -5
- package/dist/components/eui-global-toast-list.js.map +1 -1
- package/dist/components/eui-markdown-editor-drop-zone.js +2 -0
- package/dist/components/eui-markdown-editor-drop-zone.js.map +1 -1
- package/dist/components/eui-markdown-editor.js +3 -1
- package/dist/components/eui-markdown-editor.js.map +1 -1
- package/dist/components/eui-markdown-format.js +9 -3
- package/dist/components/eui-markdown-format.js.map +1 -1
- package/dist/components/eui-overlay-mask.js +2 -0
- package/dist/components/eui-overlay-mask.js.map +1 -1
- package/dist/components/eui-popover.js +22 -2
- package/dist/components/eui-popover.js.map +1 -1
- package/dist/components/eui-range.js +10 -3
- package/dist/components/eui-range.js.map +1 -1
- package/dist/components/eui-saturation.js +16 -4
- package/dist/components/eui-saturation.js.map +1 -1
- package/dist/components/eui-search-bar/field-value-selection-filter.js +8 -3
- package/dist/components/eui-search-bar/field-value-selection-filter.js.map +1 -1
- package/dist/components/eui-text-color.js +20 -6
- package/dist/components/eui-text-color.js.map +1 -1
- package/dist/components/eui-text.js +6 -3
- package/dist/components/eui-text.js.map +1 -1
- package/dist/components/eui-token.js +31 -17
- package/dist/components/eui-token.js.map +1 -1
- package/dist/components/eui-tool-tip.js +9 -17
- package/dist/components/eui-tool-tip.js.map +1 -1
- package/dist/icons-DCTZo11a.js.map +1 -1
- package/dist/modifiers/outside-click-detector.js +12 -2
- package/dist/modifiers/outside-click-detector.js.map +1 -1
- package/dist/modifiers/resize-observer.js +19 -4
- package/dist/modifiers/resize-observer.js.map +1 -1
- package/dist/services/eui-config.js.map +1 -1
- package/dist/utils/eui/combo-box.js +6 -2
- package/dist/utils/eui/combo-box.js.map +1 -1
- package/dist/utils/eui/flyout-manager/reducer.js +7 -1
- package/dist/utils/eui/flyout-manager/reducer.js.map +1 -1
- package/dist/utils/eui/styles.js +5 -0
- package/dist/utils/eui/styles.js.map +1 -1
- package/dist/utils/retain-document-listener.js +30 -0
- package/dist/utils/retain-document-listener.js.map +1 -0
- package/dist/utils/transition.js +8 -3
- package/dist/utils/transition.js.map +1 -1
- package/package.json +2 -2
- package/declarations/modifiers/open-collapsible-nav.d.ts +0 -9
- package/declarations/modifiers/open-collapsible-nav.d.ts.map +0 -1
|
@@ -31,10 +31,20 @@ class OutsideClickDetector extends Modifier {
|
|
|
31
31
|
n(this.prototype, "onClickOutside", [action]);
|
|
32
32
|
}
|
|
33
33
|
modify(element, positional, named) {
|
|
34
|
-
|
|
34
|
+
// Later updates only refresh the args, which the listeners read when they
|
|
35
|
+
// fire. Setting up again (and registering another destructor) on every
|
|
36
|
+
// update was wasted work.
|
|
37
|
+
const isNewElement = this.element !== element;
|
|
38
|
+
if (isNewElement && this.element) this._teardown();
|
|
35
39
|
this.named = named;
|
|
36
40
|
this.positional = positional;
|
|
37
|
-
|
|
41
|
+
if (isNewElement) {
|
|
42
|
+
this.element = element;
|
|
43
|
+
this._setup();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
constructor(owner, args) {
|
|
47
|
+
super(owner, args);
|
|
38
48
|
registerDestructor(this, () => this._teardown());
|
|
39
49
|
}
|
|
40
50
|
_setup() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outside-click-detector.js","sources":["../../src/modifiers/outside-click-detector.ts"],"sourcesContent":["import { registerDestructor } from '@ember/destroyable';\nimport { action } from '@ember/object';\nimport { guidFor } from '@ember/object/internals';\n\nimport Modifier from 'ember-modifier';\n\ninterface Named {\n onOutsideClick: (event: Event) => void;\n isDisabled?: boolean;\n onMouseDown?: (event: MouseEvent | TouchEvent) => void;\n onMouseUp?: (event: MouseEvent | TouchEvent) => void;\n onTouchStart?: (event: MouseEvent | TouchEvent) => void;\n onTouchEnd?: (event: MouseEvent | TouchEvent) => void;\n}\n\ntype Positional = [];\n\ninterface OutsideClickDetectorModifierArgs {\n Element: Element;\n Args: {\n Positional: Positional;\n Named: Named;\n };\n}\n\nexport interface EuiEvent extends Event {\n euiGeneratedBy: string[];\n}\n\nexport default class OutsideClickDetector extends Modifier<OutsideClickDetectorModifierArgs> {\n id!: string;\n capturedDownIds: string[] = [];\n\n element: HTMLElement | null = null;\n named: Named | null = null;\n positional: Positional | null = null;\n\n @action\n onClickOutside(e: Event): void {\n const { isDisabled, onOutsideClick } = this.named!;\n\n if (isDisabled) {\n this.capturedDownIds = [];\n\n return;\n }\n\n const event = e as unknown as EuiEvent;\n\n if (\n (event.euiGeneratedBy && event.euiGeneratedBy.includes(this.id)) ||\n this.capturedDownIds.includes(this.id)\n ) {\n this.capturedDownIds = [];\n\n return;\n }\n\n this.capturedDownIds = [];\n\n return onOutsideClick(event);\n }\n\n modify(element: HTMLElement, positional: Positional, named: Named): void {\n this.element
|
|
1
|
+
{"version":3,"file":"outside-click-detector.js","sources":["../../src/modifiers/outside-click-detector.ts"],"sourcesContent":["import { registerDestructor } from '@ember/destroyable';\nimport { action } from '@ember/object';\nimport { guidFor } from '@ember/object/internals';\n\nimport Modifier from 'ember-modifier';\n\nimport type Owner from '@ember/owner';\nimport type { ArgsFor } from 'ember-modifier';\n\ninterface Named {\n onOutsideClick: (event: Event) => void;\n isDisabled?: boolean;\n onMouseDown?: (event: MouseEvent | TouchEvent) => void;\n onMouseUp?: (event: MouseEvent | TouchEvent) => void;\n onTouchStart?: (event: MouseEvent | TouchEvent) => void;\n onTouchEnd?: (event: MouseEvent | TouchEvent) => void;\n}\n\ntype Positional = [];\n\ninterface OutsideClickDetectorModifierArgs {\n Element: Element;\n Args: {\n Positional: Positional;\n Named: Named;\n };\n}\n\nexport interface EuiEvent extends Event {\n euiGeneratedBy: string[];\n}\n\nexport default class OutsideClickDetector extends Modifier<OutsideClickDetectorModifierArgs> {\n id!: string;\n capturedDownIds: string[] = [];\n\n element: HTMLElement | null = null;\n named: Named | null = null;\n positional: Positional | null = null;\n\n @action\n onClickOutside(e: Event): void {\n const { isDisabled, onOutsideClick } = this.named!;\n\n if (isDisabled) {\n this.capturedDownIds = [];\n\n return;\n }\n\n const event = e as unknown as EuiEvent;\n\n if (\n (event.euiGeneratedBy && event.euiGeneratedBy.includes(this.id)) ||\n this.capturedDownIds.includes(this.id)\n ) {\n this.capturedDownIds = [];\n\n return;\n }\n\n this.capturedDownIds = [];\n\n return onOutsideClick(event);\n }\n\n modify(element: HTMLElement, positional: Positional, named: Named): void {\n // Later updates only refresh the args, which the listeners read when they\n // fire. Setting up again (and registering another destructor) on every\n // update was wasted work.\n const isNewElement = this.element !== element;\n\n if (isNewElement && this.element) this._teardown();\n\n this.named = named;\n this.positional = positional;\n\n if (isNewElement) {\n this.element = element;\n this._setup();\n }\n }\n\n constructor(owner: Owner, args: ArgsFor<OutsideClickDetectorModifierArgs>) {\n super(owner, args);\n registerDestructor(this, () => this._teardown());\n }\n\n _setup(): void {\n this.id = guidFor({});\n document.addEventListener('mouseup', this.onClickOutside);\n document.addEventListener('touchend', this.onClickOutside);\n this.addElementEvents();\n }\n\n _teardown(): void {\n document.removeEventListener('mouseup', this.onClickOutside);\n document.removeEventListener('touchend', this.onClickOutside);\n this.removeElementEvents();\n this.element = null;\n this.named = null;\n this.positional = null;\n }\n\n addElementEvents(): void {\n if (this.element) {\n this.element.addEventListener('mousedown', this.onChildMouseDown);\n this.element.addEventListener('touchstart', this.onChildMouseDown);\n this.element.addEventListener('mouseup', this.onChildMouseUp);\n this.element.addEventListener('touchend', this.onChildMouseUp);\n }\n }\n\n removeElementEvents(): void {\n if (this.element) {\n this.element.removeEventListener('mousedown', this.onChildMouseDown);\n this.element.removeEventListener('touchstart', this.onChildMouseDown);\n this.element.removeEventListener('mouseup', this.onChildMouseUp);\n this.element.removeEventListener('touchend', this.onChildMouseUp);\n }\n }\n\n @action\n onChildClick(\n event: MouseEvent | TouchEvent,\n cb: (event: MouseEvent | TouchEvent) => void\n ): void {\n // to support nested click detectors, build an array\n // of detector ids that have been encountered;\n\n if (event.hasOwnProperty('euiGeneratedBy')) {\n (event as unknown as EuiEvent).euiGeneratedBy.push(this.id);\n } else {\n (event as unknown as EuiEvent).euiGeneratedBy = [this.id];\n }\n\n if (cb) cb(event);\n }\n\n @action\n onChildMouseDown(event: MouseEvent | TouchEvent): any {\n this.onChildClick(event, (e) => {\n const nativeEvent = e as unknown as EuiEvent;\n\n this.capturedDownIds = nativeEvent.euiGeneratedBy;\n this.named?.onMouseDown?.(e);\n this.named?.onTouchStart?.(e);\n });\n }\n\n @action\n onChildMouseUp(event: TouchEvent | MouseEvent): any {\n this.onChildClick(event, (e) => {\n this.named?.onMouseUp?.(e);\n this.named?.onTouchEnd?.(e);\n });\n }\n}\n"],"names":["OutsideClickDetector","Modifier","id","capturedDownIds","element","named","positional","onClickOutside","e","isDisabled","onOutsideClick","event","euiGeneratedBy","includes","n","prototype","action","modify","isNewElement","_teardown","_setup","constructor","owner","args","registerDestructor","guidFor","document","addEventListener","addElementEvents","removeEventListener","removeElementEvents","onChildMouseDown","onChildMouseUp","onChildClick","cb","hasOwnProperty","push","nativeEvent","onMouseDown","onTouchStart","onMouseUp","onTouchEnd"],"mappings":";;;;;;AAgCe,MAAMA,oBAAoB,SAASC,QAAQ,CAAmC;EAC3FC,EAAE;AACFC,EAAAA,eAAe,GAAa,EAAE;AAE9BC,EAAAA,OAAO,GAAuB,IAAI;AAClCC,EAAAA,KAAK,GAAiB,IAAI;AAC1BC,EAAAA,UAAU,GAAsB,IAAI;EAGpCC,cAAcA,CAACC,CAAQ,EAAQ;IAC7B,MAAM;MAAEC,UAAU;AAAEC,MAAAA;KAAgB,GAAG,IAAI,CAACL,KAAM;AAElD,IAAA,IAAII,UAAU,EAAE;MACd,IAAI,CAACN,eAAe,GAAG,EAAE;AAEzB,MAAA;AACF,IAAA;IAEA,MAAMQ,KAAK,GAAGH,CAAwB;IAEtC,IACGG,KAAK,CAACC,cAAc,IAAID,KAAK,CAACC,cAAc,CAACC,QAAQ,CAAC,IAAI,CAACX,EAAE,CAAC,IAC/D,IAAI,CAACC,eAAe,CAACU,QAAQ,CAAC,IAAI,CAACX,EAAE,CAAC,EACtC;MACA,IAAI,CAACC,eAAe,GAAG,EAAE;AAEzB,MAAA;AACF,IAAA;IAEA,IAAI,CAACA,eAAe,GAAG,EAAE;IAEzB,OAAOO,cAAc,CAACC,KAAK,CAAC;AAC9B,EAAA;AAAC,EAAA;IAAAG,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,gBAAA,EAAA,CAxBAC,MAAM,CAAA,CAAA;AAAA;AA0BPC,EAAAA,MAAMA,CAACb,OAAoB,EAAEE,UAAsB,EAAED,KAAY,EAAQ;AACvE;AACA;AACA;AACA,IAAA,MAAMa,YAAY,GAAG,IAAI,C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A,CAACpB,KAA8B,EAAO;AACpD,IAAA,IAAI,CAACsB,YAAY,CAACtB,KAAK,EAAGH,CAAC,IAAK;MAC9B,MAAM6B,WAAW,GAAG7B,CAAwB;AAE5C,MAAA,IAAI,CAACL,eAAe,GAAGkC,WAAW,CAACzB,cAAc;AACjD,MAAA,IAAI,CAACP,KAAK,EAAEiC,WAAW,GAAG9B,CAAC,CAAC;AAC5B,MAAA,IAAI,CAACH,KAAK,EAAEkC,YAAY,GAAG/B,CAAC,CAAC;AAC/B,IAAA,CAAC,CAAC;AACJ,EAAA;AAAC,EAAA;IAAAM,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,kBAAA,EAAA,CATAC,MAAM,CAAA,CAAA;AAAA;EAYPgB,cAAcA,CAACrB,KAA8B,EAAO;AAClD,IAAA,IAAI,CAACsB,YAAY,CAACtB,KAAK,EAAGH,CAAC,IAAK;AAC9B,MAAA,IAAI,CAACH,KAAK,EAAEmC,SAAS,GAAGhC,CAAC,CAAC;AAC1B,MAAA,IAAI,CAACH,KAAK,EAAEoC,UAAU,GAAGjC,CAAC,CAAC;AAC7B,IAAA,CAAC,CAAC;AACJ,EAAA;AAAC,EAAA;IAAAM,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,gBAAA,EAAA,CANAC,MAAM,CAAA,CAAA;AAAA;AAOT;;"}
|
|
@@ -3,6 +3,7 @@ import { action } from '@ember/object';
|
|
|
3
3
|
import Modifier from 'ember-modifier';
|
|
4
4
|
import { n } from 'decorator-transforms/runtime-esm';
|
|
5
5
|
|
|
6
|
+
// IE11 and Safari don't support the `ResizeObserver` API at the time of writing
|
|
6
7
|
const hasResizeObserver = typeof window !== 'undefined' && typeof window.ResizeObserver !== 'undefined';
|
|
7
8
|
const mutationObserverOptions = {
|
|
8
9
|
// [MutationObserverInit](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserverInit)
|
|
@@ -43,6 +44,11 @@ class ResizeObserver extends Modifier {
|
|
|
43
44
|
element = null;
|
|
44
45
|
named = null;
|
|
45
46
|
positional = null;
|
|
47
|
+
constructor(owner, args) {
|
|
48
|
+
super(owner, args);
|
|
49
|
+
// Registered once: `modify` runs again on every arg update.
|
|
50
|
+
registerDestructor(this, () => this._teardown());
|
|
51
|
+
}
|
|
46
52
|
setSize({
|
|
47
53
|
width,
|
|
48
54
|
height
|
|
@@ -53,6 +59,8 @@ class ResizeObserver extends Modifier {
|
|
|
53
59
|
if (doesWidthMatter && width !== this.width || doesHeightMatter && height !== this.height) {
|
|
54
60
|
this.width = width;
|
|
55
61
|
this.height = height;
|
|
62
|
+
// `named` is ember-modifier's live args proxy, so this always calls the
|
|
63
|
+
// latest `onResize`.
|
|
56
64
|
this.named?.onResize({
|
|
57
65
|
width,
|
|
58
66
|
height
|
|
@@ -63,11 +71,18 @@ class ResizeObserver extends Modifier {
|
|
|
63
71
|
n(this.prototype, "setSize", [action]);
|
|
64
72
|
}
|
|
65
73
|
modify(element, positional = [], named) {
|
|
66
|
-
this.element = element;
|
|
67
74
|
this.named = named;
|
|
68
75
|
this.positional = positional;
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
|
|
77
|
+
// One observer per element: an arg update only refreshes `named` and
|
|
78
|
+
// `positional` (the observer reads them when it fires). Re-creating the
|
|
79
|
+
// observer here used to orphan the previous one on every update.
|
|
80
|
+
if (this.element !== element) {
|
|
81
|
+
this.observer?.disconnect();
|
|
82
|
+
this.observer = null;
|
|
83
|
+
this.element = element;
|
|
84
|
+
this._setup();
|
|
85
|
+
}
|
|
71
86
|
}
|
|
72
87
|
_setup() {
|
|
73
88
|
const {
|
|
@@ -83,7 +98,7 @@ class ResizeObserver extends Modifier {
|
|
|
83
98
|
height: boundingRect.height
|
|
84
99
|
});
|
|
85
100
|
this.observer = makeResizeObserver(element, () => {
|
|
86
|
-
if (
|
|
101
|
+
if (this.element !== element) {
|
|
87
102
|
return;
|
|
88
103
|
}
|
|
89
104
|
const boundingRect = element.getBoundingClientRect();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resize-observer.js","sources":["../../src/modifiers/resize-observer.ts"],"sourcesContent":["import { registerDestructor } from '@ember/destroyable';\nimport { action } from '@ember/object';\n\nimport Modifier from 'ember-modifier';\n\n// IE11 and Safari don't support the `ResizeObserver` API at the time of writing\nconst hasResizeObserver =\n typeof window !== 'undefined' &&\n typeof (window as any).ResizeObserver !== 'undefined';\n\nexport interface Observer {\n disconnect: () => void;\n observe: (element: Element, options?: { [key: string]: any }) => void;\n}\n\nconst mutationObserverOptions = {\n // [MutationObserverInit](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserverInit)\n attributes: true, // Account for style changes from `className` or `style`\n characterData: true, // Account for text content size differences\n childList: true, // Account for adding/removing child nodes\n subtree: true // Account for deep child nodes\n};\n\ninterface ResizeObserverSignature {\n Element: Element;\n Args: {\n Positional: ['width' | 'height'] | [];\n Named: {\n onResize: (dimensions: { height: number; width: number }) => void;\n };\n };\n}\n\nconst makeCompatibleObserver = (node: Element, callback: () => void) => {\n const observer = new MutationObserver(callback);\n \n observer.observe(node, mutationObserverOptions);\n\n window.addEventListener('resize', callback);\n\n const _disconnect = observer.disconnect.bind(observer);\n\n observer.disconnect = () => {\n _disconnect();\n window.removeEventListener('resize', callback);\n };\n\n return observer;\n};\n\nconst makeResizeObserver = (node: Element, callback: () => void) => {\n let observer: Observer | undefined;\n\n if (hasResizeObserver) {\n observer = new (window as any).ResizeObserver(callback);\n observer!.observe(node);\n } else {\n observer = makeCompatibleObserver(node, callback);\n requestAnimationFrame(callback); // Mimic ResizeObserver behavior of triggering a resize event on init\n }\n\n return observer;\n};\n\nexport default class ResizeObserver extends Modifier<ResizeObserverSignature> {\n height: number = 0;\n width: number = 0;\n observer: Observer | null = null;\n\n element: Element | null = null;\n named: ResizeObserverSignature['Args']['Named'] | null = null;\n positional: ResizeObserverSignature['Args']['Positional'] | null = null;\n\n @action\n setSize({ width, height }: { width: number; height: number }) {\n const [dimension] = this.positional || [];\n\n const doesWidthMatter = dimension !== 'height';\n const doesHeightMatter = dimension !== 'width';\n\n if (\n (doesWidthMatter && width !== this.width) ||\n (doesHeightMatter && height !== this.height)\n ) {\n this.width = width;\n this.height = height;\n this.named?.onResize({ width, height });\n }\n }\n\n modify(\n element: Element,\n positional: ResizeObserverSignature['Args']['Positional'] = [],\n named: ResizeObserverSignature['Args']['Named']\n ) {\n this.
|
|
1
|
+
{"version":3,"file":"resize-observer.js","sources":["../../src/modifiers/resize-observer.ts"],"sourcesContent":["import { registerDestructor } from '@ember/destroyable';\nimport { action } from '@ember/object';\n\nimport Modifier from 'ember-modifier';\n\nimport type Owner from '@ember/owner';\nimport type { ArgsFor } from 'ember-modifier';\n\n// IE11 and Safari don't support the `ResizeObserver` API at the time of writing\nconst hasResizeObserver =\n typeof window !== 'undefined' &&\n typeof (window as any).ResizeObserver !== 'undefined';\n\nexport interface Observer {\n disconnect: () => void;\n observe: (element: Element, options?: { [key: string]: any }) => void;\n}\n\nconst mutationObserverOptions = {\n // [MutationObserverInit](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserverInit)\n attributes: true, // Account for style changes from `className` or `style`\n characterData: true, // Account for text content size differences\n childList: true, // Account for adding/removing child nodes\n subtree: true // Account for deep child nodes\n};\n\ninterface ResizeObserverSignature {\n Element: Element;\n Args: {\n Positional: ['width' | 'height'] | [];\n Named: {\n onResize: (dimensions: { height: number; width: number }) => void;\n };\n };\n}\n\nconst makeCompatibleObserver = (node: Element, callback: () => void) => {\n const observer = new MutationObserver(callback);\n \n observer.observe(node, mutationObserverOptions);\n\n window.addEventListener('resize', callback);\n\n const _disconnect = observer.disconnect.bind(observer);\n\n observer.disconnect = () => {\n _disconnect();\n window.removeEventListener('resize', callback);\n };\n\n return observer;\n};\n\nconst makeResizeObserver = (node: Element, callback: () => void) => {\n let observer: Observer | undefined;\n\n if (hasResizeObserver) {\n observer = new (window as any).ResizeObserver(callback);\n observer!.observe(node);\n } else {\n observer = makeCompatibleObserver(node, callback);\n requestAnimationFrame(callback); // Mimic ResizeObserver behavior of triggering a resize event on init\n }\n\n return observer;\n};\n\nexport default class ResizeObserver extends Modifier<ResizeObserverSignature> {\n height: number = 0;\n width: number = 0;\n observer: Observer | null = null;\n\n element: Element | null = null;\n named: ResizeObserverSignature['Args']['Named'] | null = null;\n positional: ResizeObserverSignature['Args']['Positional'] | null = null;\n\n constructor(owner: Owner, args: ArgsFor<ResizeObserverSignature>) {\n super(owner, args);\n // Registered once: `modify` runs again on every arg update.\n registerDestructor(this, () => this._teardown());\n }\n\n @action\n setSize({ width, height }: { width: number; height: number }) {\n const [dimension] = this.positional || [];\n\n const doesWidthMatter = dimension !== 'height';\n const doesHeightMatter = dimension !== 'width';\n\n if (\n (doesWidthMatter && width !== this.width) ||\n (doesHeightMatter && height !== this.height)\n ) {\n this.width = width;\n this.height = height;\n // `named` is ember-modifier's live args proxy, so this always calls the\n // latest `onResize`.\n this.named?.onResize({ width, height });\n }\n }\n\n modify(\n element: Element,\n positional: ResizeObserverSignature['Args']['Positional'] = [],\n named: ResizeObserverSignature['Args']['Named']\n ) {\n this.named = named;\n this.positional = positional;\n\n // One observer per element: an arg update only refreshes `named` and\n // `positional` (the observer reads them when it fires). Re-creating the\n // observer here used to orphan the previous one on every update.\n if (this.element !== element) {\n this.observer?.disconnect();\n this.observer = null;\n this.element = element;\n this._setup();\n }\n }\n\n _setup() {\n const { setSize, element } = this;\n\n if (element != null) {\n // ResizeObserver's first call to the observation callback is scheduled in the future\n // so find the element's initial dimensions now\n const boundingRect = element.getBoundingClientRect();\n\n setSize({\n width: boundingRect.width,\n height: boundingRect.height\n });\n\n this.observer = makeResizeObserver(element, () => {\n if (this.element !== element) {\n return;\n }\n\n const boundingRect = element.getBoundingClientRect();\n\n setSize({\n width: boundingRect.width,\n height: boundingRect.height\n });\n })!;\n } else {\n setSize({\n width: 0,\n height: 0\n });\n }\n }\n\n _teardown() {\n this.observer?.disconnect();\n this.observer = null;\n this.element = null;\n this.named = null;\n this.positional = null;\n }\n}\n"],"names":["hasResizeObserver","window","ResizeObserver","mutationObserverOptions","attributes","characterData","childList","subtree","makeCompatibleObserver","node","callback","observer","MutationObserver","observe","addEventListener","_disconnect","disconnect","bind","removeEventListener","makeResizeObserver","requestAnimationFrame","Modifier","height","width","element","named","positional","constructor","owner","args","registerDestructor","_teardown","setSize","dimension","doesWidthMatter","doesHeightMatter","onResize","n","prototype","action","modify","_setup","boundingRect","getBoundingClientRect"],"mappings":";;;;;AAQA;AACA,MAAMA,iBAAiB,GACrB,OAAOC,MAAM,KAAK,WAAW,IAC7B,OAAQA,MAAM,CAASC,cAAc,KAAK,WAAW;AAOvD,MAAMC,uBAAuB,GAAG;AAC9B;AACAC,EAAAA,UAAU,EAAE,IAAI;AAAE;AAClBC,EAAAA,aAAa,EAAE,IAAI;AAAE;AACrBC,EAAAA,SAAS,EAAE,IAAI;AAAE;EACjBC,OAAO,EAAE,IAAI;AACf,CAAC;AAYD,MAAMC,sBAAsB,GAAGA,CAACC,IAAa,EAAEC,QAAoB,KAAK;AACtE,EAAA,MAAMC,QAAQ,GAAG,IAAIC,gBAAgB,CAACF,QAAQ,CAAC;AAE/CC,EAAAA,QAAQ,CAACE,OAAO,CAACJ,IAAI,EAAEN,uBAAuB,CAAC;AAE/CF,EAAAA,MAAM,CAACa,gBAAgB,CAAC,QAAQ,EAAEJ,QAAQ,CAAC;EAE3C,MAAMK,WAAW,GAAGJ,QAAQ,CAACK,UAAU,CAACC,IAAI,CAACN,QAAQ,CAAC;EAEtDA,QAAQ,CAACK,UAAU,GAAG,MAAM;AAC1BD,IAAAA,WAAW,EAAE;AACbd,IAAAA,MAAM,CAACiB,mBAAmB,CAAC,QAAQ,EAAER,QAAQ,CAAC;EAChD,CAAC;AAED,EAAA,OAAOC,QAAQ;AACjB,CAAC;AAED,MAAMQ,kBAAkB,GAAGA,CAACV,IAAa,EAAEC,QAAoB,KAAK;AAClE,EAAA,IAAIC,QAA8B;AAElC,EAAA,IAAIX,iBAAiB,EAAE;AACrB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B;AACvB,SAAC,CAAC;AACJ,MAAA,CAAC,CAAE;AACL,IAAA,CAAC,MAAM;AACLU,MAAAA,OAAO,CAAC;AACNT,QAAAA,KAAK,EAAE,CAAC;AACRD,QAAAA,MAAM,EAAE;AACV,OAAC,CAAC;AACJ,IAAA;AACF,EAAA;AAEAS,EAAAA,SAASA,GAAG;AACV,IAAA,IAAI,CAACpB,QAAQ,EAAEK,UAAU,EAAE;IAC3B,IAAI,CAACL,QAAQ,GAAG,IAAI;IACpB,IAAI,CAACa,OAAO,GAAG,IAAI;IACnB,IAAI,CAACC,KAAK,GAAG,IAAI;IACjB,IAAI,CAACC,UAAU,GAAG,IAAI;AACxB,EAAA;AACF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eui-config.js","sources":["../../src/services/eui-config.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport Service from '@ember/service';\n\nimport { merge } from 'lodash-es';\n\nimport type { EuiButtonIconSignature } from '../components/eui-button-icon';\nimport type { ComponentLike } from '@glint/template';\n\n/**\n * Defaults for components' props, like upstream `EuiProvider`'s\n * `componentDefaults` (app-wide here). Args passed to a component win.\n */\nexport interface EuiComponentDefaults {\n /**\n * Page size settings inherited by `EuiTablePagination` and every table\n * and grid built on it (`EuiBasicTable`, `EuiInMemoryTable`,\n * `EuiDataGrid`).\n */\n EuiTablePagination?: {\n itemsPerPage?: number;\n itemsPerPageOptions?: number[];\n showPerPageOptions?: boolean;\n };\n}\n\nexport interface EuiConfig {\n /**\n * Extra icons usable by name, e.g. `<EuiIcon @type=\"myLogo\" />` or\n * `<EuiButton @iconType=\"myLogo\">`. Values are components rendering an\n * `<svg>` with `...attributes`, for example svgs imported with\n * @svg-jar/plugin: `import MyLogo from './my-logo.svg';`\n */\n 'euiIcon.icons'?: Record<\n string,\n ComponentLike<{ Element: SVGSVGElement; Blocks: { default: [] } }>\n >;\n /** @deprecated no longer has any effect, see `euiIcon.icons` */\n 'euiIcon.useSvg'?: boolean;\n /** @deprecated no longer has any effect, see `euiIcon.icons` */\n euiIconUseSvg?: boolean;\n 'euiButtonIcon.size'?: EuiButtonIconSignature['Args']['iconSize'];\n euiComboBoxOptionsHeight?: number;\n /**\n * Upstream `EuiProvider componentDefaults`, e.g.\n * `{ EuiTablePagination: { itemsPerPage: 25, itemsPerPageOptions: [25, 50, 100] } }`.\n * Set it with `setConfig` or a single `updateConfig` call: `updateConfig`\n * merges arrays by index into earlier values.\n */\n componentDefaults?: EuiComponentDefaults;\n}\n\nconst DEFAULT_CONFIG: EuiConfig = {\n 'euiIcon.useSvg': true,\n euiIconUseSvg: true,\n euiComboBoxOptionsHeight: 29\n};\n\nexport default class EuiConfigService extends Service {\n @tracked private _config: EuiConfig = DEFAULT_CONFIG;\n\n getConfig<T extends keyof EuiConfig>(key: T): EuiConfig[T] | undefined {\n return this._config[key];\n }\n\n updateConfig(config: Partial<EuiConfig>) {\n this._config = merge<Partial<EuiConfig>, EuiConfig, Partial<EuiConfig>>(\n {},\n this._config,\n config\n );\n }\n\n setConfig(config: EuiConfig) {\n this._config = config;\n }\n}\n"],"names":["DEFAULT_CONFIG","euiIconUseSvg","euiComboBoxOptionsHeight","EuiConfigService","Service","g","prototype","tracked","i","getConfig","key","_config","updateConfig","config","merge","setConfig"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"eui-config.js","sources":["../../src/services/eui-config.ts"],"sourcesContent":["import { tracked } from '@glimmer/tracking';\nimport Service from '@ember/service';\n\nimport { merge } from 'lodash-es';\n\nimport type { EuiButtonIconSignature } from '../components/eui-button-icon';\nimport type { ComponentLike } from '@glint/template';\n\n/**\n * Defaults for components' props, like upstream `EuiProvider`'s\n * `componentDefaults` (app-wide here). Args passed to a component win.\n */\nexport interface EuiComponentDefaults {\n /**\n * Page size settings inherited by `EuiTablePagination` and every table\n * and grid built on it (`EuiBasicTable`, `EuiInMemoryTable`,\n * `EuiDataGrid`).\n */\n EuiTablePagination?: {\n itemsPerPage?: number;\n itemsPerPageOptions?: number[];\n showPerPageOptions?: boolean;\n };\n}\n\nexport interface EuiConfig {\n /**\n * Extra icons usable by name, e.g. `<EuiIcon @type=\"myLogo\" />` or\n * `<EuiButton @iconType=\"myLogo\">`. Values are components rendering an\n * `<svg>` with `...attributes`, for example svgs imported with\n * @svg-jar/plugin: `import MyLogo from './my-logo.svg';`\n */\n 'euiIcon.icons'?: Record<\n string,\n ComponentLike<{ Element: SVGSVGElement; Blocks: { default: [] } }>\n >;\n /** @deprecated no longer has any effect, see `euiIcon.icons` */\n 'euiIcon.useSvg'?: boolean;\n /** @deprecated no longer has any effect, see `euiIcon.icons` */\n euiIconUseSvg?: boolean;\n 'euiButtonIcon.size'?: EuiButtonIconSignature['Args']['iconSize'];\n euiComboBoxOptionsHeight?: number;\n /**\n * Default of `EuiComboBox`'s `@ignoreAccents`: match options ignoring\n * accents (\"medico\" finds \"Médico\"). Upstream: `false`.\n */\n 'euiComboBox.ignoreAccents'?: boolean;\n /**\n * Upstream `EuiProvider componentDefaults`, e.g.\n * `{ EuiTablePagination: { itemsPerPage: 25, itemsPerPageOptions: [25, 50, 100] } }`.\n * Set it with `setConfig` or a single `updateConfig` call: `updateConfig`\n * merges arrays by index into earlier values.\n */\n componentDefaults?: EuiComponentDefaults;\n}\n\nconst DEFAULT_CONFIG: EuiConfig = {\n 'euiIcon.useSvg': true,\n euiIconUseSvg: true,\n euiComboBoxOptionsHeight: 29\n};\n\nexport default class EuiConfigService extends Service {\n @tracked private _config: EuiConfig = DEFAULT_CONFIG;\n\n getConfig<T extends keyof EuiConfig>(key: T): EuiConfig[T] | undefined {\n return this._config[key];\n }\n\n updateConfig(config: Partial<EuiConfig>) {\n this._config = merge<Partial<EuiConfig>, EuiConfig, Partial<EuiConfig>>(\n {},\n this._config,\n config\n );\n }\n\n setConfig(config: EuiConfig) {\n this._config = config;\n }\n}\n"],"names":["DEFAULT_CONFIG","euiIconUseSvg","euiComboBoxOptionsHeight","EuiConfigService","Service","g","prototype","tracked","i","getConfig","key","_config","updateConfig","config","merge","setConfig"],"mappings":";;;;;AAwDA,MAAMA,cAAyB,GAAG;AAChC,EAAA,gBAAgB,EAAE,IAAI;AACtBC,EAAAA,aAAa,EAAE,IAAI;AACnBC,EAAAA,wBAAwB,EAAE;AAC5B,CAAC;AAEc,MAAMC,gBAAgB,SAASC,OAAO,CAAC;AAAA,EAAA;IAAAC,CAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,SAAA,EAAA,CACnDC,OAAO,CAAA,EAAA,YAAA;AAAA,MAAA,OAA8BP,cAAc;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,QAAA,IAAAQ,CAAA,CAAA,IAAA,EAAA,SAAA,CAAA,EAAA,MAAA;EAEpDC,SAASA,CAA4BC,GAAM,EAA4B;AACrE,IAAA,OAAO,IAAI,CAACC,OAAO,CAACD,GAAG,CAAC;AAC1B,EAAA;EAEAE,YAAYA,CAACC,MAA0B,EAAE;AACvC,IAAA,IAAI,CAACF,OAAO,GAAGG,KAAK,CAClB,EAAE,EACF,IAAI,CAACH,OAAO,EACZE,MACF,CAAC;AACH,EAAA;EAEAE,SAASA,CAACF,MAAiB,EAAE;IAC3B,IAAI,CAACF,OAAO,GAAGE,MAAM;AACvB,EAAA;AACF;;"}
|
|
@@ -67,16 +67,20 @@ function flattenOptionGroups(options) {
|
|
|
67
67
|
* Upstream `createPartialStringEqualityOptionMatcher`: options whose label
|
|
68
68
|
* (trimmed) includes the normalized search text.
|
|
69
69
|
*/
|
|
70
|
-
function createPartialStringEqualityOptionMatcher(searchField) {
|
|
70
|
+
function createPartialStringEqualityOptionMatcher(searchField, ignoreAccents = false) {
|
|
71
|
+
const fold = ignoreAccents ? removeAccents : text => text;
|
|
71
72
|
return ({
|
|
72
73
|
option,
|
|
73
74
|
isCaseSensitive,
|
|
74
75
|
normalizedSearchValue
|
|
75
76
|
}) => {
|
|
76
77
|
if (!normalizedSearchValue) return true;
|
|
77
|
-
return transformForCaseSensitivity(comboBoxOptionLabel(option, searchField).trim(), isCaseSensitive).includes(normalizedSearchValue);
|
|
78
|
+
return fold(transformForCaseSensitivity(comboBoxOptionLabel(option, searchField).trim(), isCaseSensitive)).includes(fold(normalizedSearchValue));
|
|
78
79
|
};
|
|
79
80
|
}
|
|
81
|
+
|
|
82
|
+
/** "Médico" -> "Medico": accents (any combining mark) off. */
|
|
83
|
+
const removeAccents = text => text.normalize('NFD').replace(/\p{M}/gu, '');
|
|
80
84
|
const keyOf = option => option && typeof option === 'object' ? option.key : undefined;
|
|
81
85
|
|
|
82
86
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combo-box.js","sources":["../../../src/utils/eui/combo-box.ts"],"sourcesContent":["/**\n * Combo box helpers. The group label style port it needs is shared with\n * EuiSelectableList (`utils/eui/selectable.ts`).\n */\nimport type { CSSObject } from '@emotion/css/create-instance';\n\n/**\n * Ember has no React global reset: box sizing for the combo box's own\n * elements (upstream `*` reset) and the list's `button`-free rows.\n */\nexport const comboBoxBoxReset: CSSObject = {\n boxSizing: 'border-box',\n '& :where(*, *::before, *::after)': { boxSizing: 'border-box' }\n};\n\n/** The text of an option: strings as they are, else `label` (or `@searchField`). */\nexport function comboBoxOptionLabel(option: unknown, searchField?: string): string {\n if (typeof option === 'string') return option;\n if (typeof option === 'number') return String(option);\n if (option && typeof option === 'object') {\n const record = option as Record<string, unknown>;\n const value = record[searchField ?? 'label'] ?? record['label'];\n\n if (typeof value === 'string' || typeof value === 'number') {\n return String(value);\n }\n }\n\n return '';\n}\n\n/*\n * Matching helpers below are ported from @elastic/eui 123.1.0\n * `components/combo_box/matching_options.ts` and `combo_box/utils.tsx`.\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under\n * one or more contributor license agreements. Licensed under the Elastic\n * License 2.0 or the Server Side Public License, v 1; see vendor/eui-latest.\n */\n\n/** Upstream `SortMatchesBy`. */\nexport type EuiComboBoxSortMatchesBy = 'none' | 'startsWith';\n\n/** Upstream `transformForCaseSensitivity`. */\nexport const transformForCaseSensitivity = (\n text: string,\n isCaseSensitive?: boolean\n): string => (isCaseSensitive ? text : text.toLowerCase());\n\n/**\n * A group: upstream's `{ label, options }` or ember-power-select's\n * `{ groupName, options }`.\n */\nexport const isComboBoxGroup = (\n option: unknown\n): option is { options: unknown[]; groupName?: string; label?: string } =>\n Boolean(\n option &&\n typeof option === 'object' &&\n Array.isArray((option as { options?: unknown }).options)\n );\n\n/** The title of a group (`groupName`, else upstream's `label`). */\nexport const comboBoxGroupLabel = (group: {\n groupName?: string;\n label?: string;\n}): string => String(group.groupName ?? group.label ?? '');\n\n/** Upstream `flattenOptionGroups`: the options of groups, in one list. */\nexport function flattenOptionGroups(options: readonly unknown[]): unknown[] {\n return options.reduce<unknown[]>((all, option) => {\n if (isComboBoxGroup(option)) return all.concat(option.options);\n all.push(option);\n\n return all;\n }, []);\n}\n\n/** Upstream `EuiComboBoxOptionMatcherArgs`. */\nexport interface EuiComboBoxOptionMatcherArgs {\n /** The option being matched. */\n option: any;\n /** The search text, as typed. */\n searchValue: string;\n /** The search text trimmed, and lower case unless case-sensitive. */\n normalizedSearchValue: string;\n /** Whether matching is case-sensitive. */\n isCaseSensitive: boolean;\n}\n\n/** Upstream `EuiComboBoxOptionMatcher`: `true` when the option matches. */\nexport type EuiComboBoxOptionMatcher = (\n args: EuiComboBoxOptionMatcherArgs\n) => boolean;\n\n/**\n * Upstream `createPartialStringEqualityOptionMatcher`: options whose label\n * (trimmed) includes the normalized search text.\n */\nexport function createPartialStringEqualityOptionMatcher(\n searchField?: string\n): EuiComboBoxOptionMatcher {\n return ({ option, isCaseSensitive, normalizedSearchValue }) => {\n if (!normalizedSearchValue) return true;\n\n return transformForCaseSensitivity(\n comboBoxOptionLabel(option, searchField).trim(),\n isCaseSensitive\n ).includes(normalizedSearchValue);\n };\n}\n\nconst keyOf = (option: unknown): unknown =>\n option && typeof option === 'object'\n ? (option as { key?: unknown }).key\n : undefined;\n\n/**\n * Upstream's \"already selected\" test of `getMatchingOptions`: a selected\n * option has the same label (case per `isCaseSensitive`) and, when the\n * option has a `key`, the same key. The same object always is.\n */\nexport function isComboBoxOptionSelected(\n option: unknown,\n selectedOptions: readonly unknown[],\n searchField?: string,\n isCaseSensitive?: boolean\n): boolean {\n if (!selectedOptions.length) return false;\n if (selectedOptions.includes(option)) return true;\n\n const label = comboBoxOptionLabel(option, searchField);\n\n if (!label) return false;\n\n const normalized = transformForCaseSensitivity(label, isCaseSensitive);\n const key = keyOf(option);\n\n return selectedOptions.some(\n (selected) =>\n transformForCaseSensitivity(\n comboBoxOptionLabel(selected, searchField),\n isCaseSensitive\n ) === normalized &&\n (key === undefined || keyOf(selected) === key)\n );\n}\n\n/**\n * Upstream single selection check mark: the selected option has the same\n * label and key (or is the same object).\n */\nexport function isComboBoxOptionChecked(\n option: unknown,\n selectedOptions: readonly unknown[] | undefined,\n searchField?: string\n): boolean {\n const selected = selectedOptions?.[0];\n\n if (selected === undefined) return false;\n if (selected === option) return true;\n\n const label = comboBoxOptionLabel(option, searchField);\n\n return (\n Boolean(label) &&\n comboBoxOptionLabel(selected, searchField) === label &&\n keyOf(selected) === keyOf(option)\n );\n}\n\ninterface GetMatchingOptions {\n options: readonly unknown[];\n selectedOptions: readonly unknown[];\n searchValue: string;\n optionMatcher: EuiComboBoxOptionMatcher;\n searchField?: string;\n isCaseSensitive?: boolean;\n isPreFiltered?: boolean;\n showPrevSelected?: boolean;\n sortMatchesBy?: EuiComboBoxSortMatchesBy;\n}\n\n/** A group title in the flat list of matches (upstream `isGroupLabelOption`). */\nexport interface ComboBoxGroupLabel {\n isGroupLabelOption: true;\n group: { options: unknown[]; groupName?: string; label?: string };\n}\n\nexport const isComboBoxGroupLabel = (\n entry: unknown\n): entry is ComboBoxGroupLabel =>\n Boolean(\n entry &&\n typeof entry === 'object' &&\n (entry as ComboBoxGroupLabel).isGroupLabelOption === true &&\n 'group' in entry\n );\n\n/**\n * Upstream `getMatchingOptions`, as a flat list with group titles: the\n * options (not yet selected, unless `showPrevSelected`) matching the search\n * text, groups with matches preceded by their title, and with\n * `sortMatchesBy: 'startsWith'` the entries (titles included) whose label\n * starts with the search text first.\n */\nexport function getMatchingEntries({\n options,\n selectedOptions,\n searchValue,\n optionMatcher,\n searchField,\n isCaseSensitive = false,\n isPreFiltered = false,\n showPrevSelected = false,\n sortMatchesBy = 'none'\n}: GetMatchingOptions): unknown[] {\n const normalizedSearchValue = transformForCaseSensitivity(\n searchValue.trim(),\n isCaseSensitive\n );\n let entries: unknown[] = [];\n\n const collect = (accumulator: unknown[], option: unknown) => {\n // only options not selected yet, unless requested\n if (\n !showPrevSelected &&\n isComboBoxOptionSelected(\n option,\n selectedOptions,\n searchField,\n isCaseSensitive\n )\n ) {\n return;\n }\n\n if (\n isPreFiltered ||\n !normalizedSearchValue ||\n optionMatcher({\n option,\n searchValue,\n normalizedSearchValue,\n isCaseSensitive\n })\n ) {\n accumulator.push(option);\n }\n };\n\n options.forEach((option) => {\n if (isComboBoxGroup(option)) {\n const matches: unknown[] = [];\n\n option.options.forEach((child) => collect(matches, child));\n\n if (matches.length > 0) {\n entries.push({ isGroupLabelOption: true, group: option });\n // concat over spreading, for large groups (upstream)\n entries = entries.concat(matches);\n }\n } else {\n collect(entries, option);\n }\n });\n\n if (sortMatchesBy === 'startsWith') {\n const startWith: unknown[] = [];\n const others: unknown[] = [];\n\n entries.forEach((entry) => {\n const label = isComboBoxGroupLabel(entry)\n ? comboBoxGroupLabel(entry.group)\n : comboBoxOptionLabel(entry, searchField);\n\n (transformForCaseSensitivity(label, isCaseSensitive).startsWith(\n normalizedSearchValue\n )\n ? startWith\n : others\n ).push(entry);\n });\n\n return [...startWith, ...others];\n }\n\n return entries;\n}\n\n/**\n * The flat list of matches as ember-power-select options: every option\n * after a group title belongs to that group (as rendered upstream), the\n * others are top level. Groups are copies with the matching options (and a\n * `groupName`), the options themselves are never copied.\n */\nexport function entriesToPowerSelectOptions(entries: readonly unknown[]) {\n const result: unknown[] = [];\n let current: { options: unknown[]; groupName?: string } | undefined;\n\n entries.forEach((entry) => {\n if (isComboBoxGroupLabel(entry)) {\n current = {\n ...entry.group,\n groupName: comboBoxGroupLabel(entry.group),\n options: []\n };\n result.push(current);\n } else if (current) {\n current.options.push(entry);\n } else {\n result.push(entry);\n }\n });\n\n return result;\n}\n\n/**\n * Groups and their options in one list (group objects included), the rows\n * of EuiComboBox's list and upstream's `matchingOptions` order.\n */\nexport function flattenComboBoxRows(options: readonly unknown[]): unknown[] {\n const rows: unknown[] = [];\n\n options.forEach((option) => {\n if (isComboBoxGroup(option) && 'groupName' in option) {\n rows.push(option);\n option.options.forEach((child) => rows.push(child));\n } else {\n rows.push(option);\n }\n });\n\n return rows;\n}\n\n/** An option that can be highlighted or chosen (not a group, not disabled). */\nexport const isSelectableRow = (row: unknown, group?: unknown): boolean =>\n !(isComboBoxGroup(row) && 'groupName' in (row as object)) &&\n !(\n row &&\n typeof row === 'object' &&\n (row as { disabled?: boolean }).disabled === true\n ) &&\n !(\n group &&\n typeof group === 'object' &&\n (group as { disabled?: boolean }).disabled === true\n );\n\n/**\n * Upstream `findNextSelectableOptionIndex`: from `startIndex`, the first\n * selectable row in `direction`, wrapping around; `-1` when none.\n */\nexport function findNextSelectableIndex(\n rows: readonly unknown[],\n selectable: (index: number) => boolean,\n startIndex: number,\n direction: 1 | -1 = 1\n): number {\n if (!rows.length) return -1;\n\n let index = startIndex;\n\n for (let count = 0; count < rows.length; count++) {\n if (selectable(index)) return index;\n\n index = (index + direction + rows.length) % rows.length;\n }\n\n return -1;\n}\n\n/**\n * Upstream `getSelectedOptionForSearchValue`: the selected option whose\n * label equals the text.\n */\nexport function selectedOptionForSearchValue(\n selectedOptions: readonly unknown[],\n searchValue: string,\n searchField: string | undefined,\n isCaseSensitive?: boolean\n): unknown {\n const search = transformForCaseSensitivity(searchValue, isCaseSensitive);\n\n return selectedOptions.find(\n (option) =>\n transformForCaseSensitivity(\n comboBoxOptionLabel(option, searchField),\n isCaseSensitive\n ) === search\n );\n}\n\n/**\n * Upstream `EuiComboBoxOptionAppendPrepend` spacing: margin between an\n * option's `prepend` / `append` and its text, with block icons so they\n * align with the text.\n */\nexport function comboBoxAppendPrependStyles(\n margin: string\n): { prepend: CSSObject; append: CSSObject } {\n const centerIcons = { '.euiIcon': { display: 'block' } };\n\n return {\n prepend: { marginInlineEnd: margin, ...centerIcons },\n append: { marginInlineStart: margin, ...centerIcons }\n };\n}\n\n/**\n * Option `prepend` / `append` and EuiComboBox's `@prepend` / `@append`:\n * text, or a component (rendered with the option as `@option`).\n */\nexport const isTextNode = (value: unknown): boolean =>\n typeof value === 'string' ||\n typeof value === 'number' ||\n // htmlSafe strings render as HTML, like text\n (Boolean(value) &&\n typeof value === 'object' &&\n typeof (value as { toHTML?: unknown }).toHTML === 'function');\n"],"names":["comboBoxBoxReset","boxSizing","comboBoxOptionLabel","option","searchField","String","record","value","transformForCaseSensitivity","text","isCaseSensitive","toLowerCase","isComboBoxGroup","Boolean","Array","isArray","options","comboBoxGroupLabel","group","groupName","label","flattenOptionGroups","reduce","all","concat","push","createPartialStringEqualityOptionMatcher","normalizedSearchValue","trim","includes","keyOf","key","undefined","isComboBoxOptionSelected","selectedOptions","length","normalized","some","selected","isComboBoxOptionChecked","isComboBoxGroupLabel","entry","isGroupLabelOption","getMatchingEntries","searchValue","optionMatcher","isPreFiltered","showPrevSelected","sortMatchesBy","entries","collect","accumulator","forEach","matches","child","startWith","others","startsWith","entriesToPowerSelectOptions","result","current","flattenComboBoxRows","rows","isSelectableRow","row","disabled","findNextSelectableIndex","selectable","startIndex","direction","index","count","selectedOptionForSearchValue","search","find","comboBoxAppendPrependStyles","margin","centerIcons","display","prepend","marginInlineEnd","append","marginInlineStart","isTextNode","toHTML"],"mappings":"AAAA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACO,MAAMA,gBAA2B,GAAG;AACzCC,EAAAA,SAAS,EAAE,YAAY;AACvB,EAAA,kCAAkC,EAAE;AAAEA,IAAAA,SAAS,E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;AACzD,EAAA;AAEA,EAAA,OAAO,EAAE;AACX;;AAEA;AACA;AACA;AACA;AACO,SAASqC,4BAA4BA,CAC1CtC,eAAmC,EACnCU,WAAmB,EACnBxC,WAA+B,EAC/BM,eAAyB,EAChB;AACT,EAAA,MAAM+D,MAAM,GAAGjE,2BAA2B,CAACoC,WAAW,EAAElC,eAAe,CAAC;AAExE,EAAA,OAAOwB,eAAe,CAACwC,IAAI,CACxBvE,MAAM,IACLK,2BAA2B,CACzBN,mBAAmB,CAACC,MAAM,EAAEC,WAAW,CAAC,EACxCM,eACF,CAAC,KAAK+D,MACV,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASE,2BAA2BA,CACzCC,MAAc,EAC6B;AAC3C,EAAA,MAAMC,WAAW,GAAG;AAAE,IAAA,UAAU,EAAE;AAAEC,MAAAA,OAAO,EAAE;AAAQ;GAAG;EAExD,OAAO;AACLC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,eAAe,EAAEJ,MAAM;MAAE,GAAGC;KAAa;AACpDI,IAAAA,MAAM,EAAE;AAAEC,MAAAA,iBAAiB,EAAEN,MAAM;MAAE,GAAGC;AAAY;GACrD;AACH;;AAEA;AACA;AACA;AACA;AACO,MAAMM,UAAU,GAAI5E,KAAc,IACvC,OAAOA,KAAK,KAAK,QAAQ,IACzB,OAAOA,KAAK,KAAK,QAAQ;AACzB;AACCM,OAAO,CAACN,KAAK,CAAC,IACb,OAAOA,KAAK,KAAK,QAAQ,IACzB,OAAQA,KAAK,CAA0B6E,MAAM,KAAK;;"}
|
|
1
|
+
{"version":3,"file":"combo-box.js","sources":["../../../src/utils/eui/combo-box.ts"],"sourcesContent":["/**\n * Combo box helpers. The group label style port it needs is shared with\n * EuiSelectableList (`utils/eui/selectable.ts`).\n */\nimport type { CSSObject } from '@emotion/css/create-instance';\n\n/**\n * Ember has no React global reset: box sizing for the combo box's own\n * elements (upstream `*` reset) and the list's `button`-free rows.\n */\nexport const comboBoxBoxReset: CSSObject = {\n boxSizing: 'border-box',\n '& :where(*, *::before, *::after)': { boxSizing: 'border-box' }\n};\n\n/** The text of an option: strings as they are, else `label` (or `@searchField`). */\nexport function comboBoxOptionLabel(option: unknown, searchField?: string): string {\n if (typeof option === 'string') return option;\n if (typeof option === 'number') return String(option);\n if (option && typeof option === 'object') {\n const record = option as Record<string, unknown>;\n const value = record[searchField ?? 'label'] ?? record['label'];\n\n if (typeof value === 'string' || typeof value === 'number') {\n return String(value);\n }\n }\n\n return '';\n}\n\n/*\n * Matching helpers below are ported from @elastic/eui 123.1.0\n * `components/combo_box/matching_options.ts` and `combo_box/utils.tsx`.\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under\n * one or more contributor license agreements. Licensed under the Elastic\n * License 2.0 or the Server Side Public License, v 1; see vendor/eui-latest.\n */\n\n/** Upstream `SortMatchesBy`. */\nexport type EuiComboBoxSortMatchesBy = 'none' | 'startsWith';\n\n/** Upstream `transformForCaseSensitivity`. */\nexport const transformForCaseSensitivity = (\n text: string,\n isCaseSensitive?: boolean\n): string => (isCaseSensitive ? text : text.toLowerCase());\n\n/**\n * A group: upstream's `{ label, options }` or ember-power-select's\n * `{ groupName, options }`.\n */\nexport const isComboBoxGroup = (\n option: unknown\n): option is { options: unknown[]; groupName?: string; label?: string } =>\n Boolean(\n option &&\n typeof option === 'object' &&\n Array.isArray((option as { options?: unknown }).options)\n );\n\n/** The title of a group (`groupName`, else upstream's `label`). */\nexport const comboBoxGroupLabel = (group: {\n groupName?: string;\n label?: string;\n}): string => String(group.groupName ?? group.label ?? '');\n\n/** Upstream `flattenOptionGroups`: the options of groups, in one list. */\nexport function flattenOptionGroups(options: readonly unknown[]): unknown[] {\n return options.reduce<unknown[]>((all, option) => {\n if (isComboBoxGroup(option)) return all.concat(option.options);\n all.push(option);\n\n return all;\n }, []);\n}\n\n/** Upstream `EuiComboBoxOptionMatcherArgs`. */\nexport interface EuiComboBoxOptionMatcherArgs {\n /** The option being matched. */\n option: any;\n /** The search text, as typed. */\n searchValue: string;\n /** The search text trimmed, and lower case unless case-sensitive. */\n normalizedSearchValue: string;\n /** Whether matching is case-sensitive. */\n isCaseSensitive: boolean;\n}\n\n/** Upstream `EuiComboBoxOptionMatcher`: `true` when the option matches. */\nexport type EuiComboBoxOptionMatcher = (\n args: EuiComboBoxOptionMatcherArgs\n) => boolean;\n\n/**\n * Upstream `createPartialStringEqualityOptionMatcher`: options whose label\n * (trimmed) includes the normalized search text.\n */\nexport function createPartialStringEqualityOptionMatcher(\n searchField?: string,\n ignoreAccents = false\n): EuiComboBoxOptionMatcher {\n const fold = ignoreAccents ? removeAccents : (text: string) => text;\n\n return ({ option, isCaseSensitive, normalizedSearchValue }) => {\n if (!normalizedSearchValue) return true;\n\n return fold(\n transformForCaseSensitivity(\n comboBoxOptionLabel(option, searchField).trim(),\n isCaseSensitive\n )\n ).includes(fold(normalizedSearchValue));\n };\n}\n\n/** \"Médico\" -> \"Medico\": accents (any combining mark) off. */\nconst removeAccents = (text: string): string =>\n text.normalize('NFD').replace(/\\p{M}/gu, '');\n\nconst keyOf = (option: unknown): unknown =>\n option && typeof option === 'object'\n ? (option as { key?: unknown }).key\n : undefined;\n\n/**\n * Upstream's \"already selected\" test of `getMatchingOptions`: a selected\n * option has the same label (case per `isCaseSensitive`) and, when the\n * option has a `key`, the same key. The same object always is.\n */\nexport function isComboBoxOptionSelected(\n option: unknown,\n selectedOptions: readonly unknown[],\n searchField?: string,\n isCaseSensitive?: boolean\n): boolean {\n if (!selectedOptions.length) return false;\n if (selectedOptions.includes(option)) return true;\n\n const label = comboBoxOptionLabel(option, searchField);\n\n if (!label) return false;\n\n const normalized = transformForCaseSensitivity(label, isCaseSensitive);\n const key = keyOf(option);\n\n return selectedOptions.some(\n (selected) =>\n transformForCaseSensitivity(\n comboBoxOptionLabel(selected, searchField),\n isCaseSensitive\n ) === normalized &&\n (key === undefined || keyOf(selected) === key)\n );\n}\n\n/**\n * Upstream single selection check mark: the selected option has the same\n * label and key (or is the same object).\n */\nexport function isComboBoxOptionChecked(\n option: unknown,\n selectedOptions: readonly unknown[] | undefined,\n searchField?: string\n): boolean {\n const selected = selectedOptions?.[0];\n\n if (selected === undefined) return false;\n if (selected === option) return true;\n\n const label = comboBoxOptionLabel(option, searchField);\n\n return (\n Boolean(label) &&\n comboBoxOptionLabel(selected, searchField) === label &&\n keyOf(selected) === keyOf(option)\n );\n}\n\ninterface GetMatchingOptions {\n options: readonly unknown[];\n selectedOptions: readonly unknown[];\n searchValue: string;\n optionMatcher: EuiComboBoxOptionMatcher;\n searchField?: string;\n isCaseSensitive?: boolean;\n isPreFiltered?: boolean;\n showPrevSelected?: boolean;\n sortMatchesBy?: EuiComboBoxSortMatchesBy;\n}\n\n/** A group title in the flat list of matches (upstream `isGroupLabelOption`). */\nexport interface ComboBoxGroupLabel {\n isGroupLabelOption: true;\n group: { options: unknown[]; groupName?: string; label?: string };\n}\n\nexport const isComboBoxGroupLabel = (\n entry: unknown\n): entry is ComboBoxGroupLabel =>\n Boolean(\n entry &&\n typeof entry === 'object' &&\n (entry as ComboBoxGroupLabel).isGroupLabelOption === true &&\n 'group' in entry\n );\n\n/**\n * Upstream `getMatchingOptions`, as a flat list with group titles: the\n * options (not yet selected, unless `showPrevSelected`) matching the search\n * text, groups with matches preceded by their title, and with\n * `sortMatchesBy: 'startsWith'` the entries (titles included) whose label\n * starts with the search text first.\n */\nexport function getMatchingEntries({\n options,\n selectedOptions,\n searchValue,\n optionMatcher,\n searchField,\n isCaseSensitive = false,\n isPreFiltered = false,\n showPrevSelected = false,\n sortMatchesBy = 'none'\n}: GetMatchingOptions): unknown[] {\n const normalizedSearchValue = transformForCaseSensitivity(\n searchValue.trim(),\n isCaseSensitive\n );\n let entries: unknown[] = [];\n\n const collect = (accumulator: unknown[], option: unknown) => {\n // only options not selected yet, unless requested\n if (\n !showPrevSelected &&\n isComboBoxOptionSelected(\n option,\n selectedOptions,\n searchField,\n isCaseSensitive\n )\n ) {\n return;\n }\n\n if (\n isPreFiltered ||\n !normalizedSearchValue ||\n optionMatcher({\n option,\n searchValue,\n normalizedSearchValue,\n isCaseSensitive\n })\n ) {\n accumulator.push(option);\n }\n };\n\n options.forEach((option) => {\n if (isComboBoxGroup(option)) {\n const matches: unknown[] = [];\n\n option.options.forEach((child) => collect(matches, child));\n\n if (matches.length > 0) {\n entries.push({ isGroupLabelOption: true, group: option });\n // concat over spreading, for large groups (upstream)\n entries = entries.concat(matches);\n }\n } else {\n collect(entries, option);\n }\n });\n\n if (sortMatchesBy === 'startsWith') {\n const startWith: unknown[] = [];\n const others: unknown[] = [];\n\n entries.forEach((entry) => {\n const label = isComboBoxGroupLabel(entry)\n ? comboBoxGroupLabel(entry.group)\n : comboBoxOptionLabel(entry, searchField);\n\n (transformForCaseSensitivity(label, isCaseSensitive).startsWith(\n normalizedSearchValue\n )\n ? startWith\n : others\n ).push(entry);\n });\n\n return [...startWith, ...others];\n }\n\n return entries;\n}\n\n/**\n * The flat list of matches as ember-power-select options: every option\n * after a group title belongs to that group (as rendered upstream), the\n * others are top level. Groups are copies with the matching options (and a\n * `groupName`), the options themselves are never copied.\n */\nexport function entriesToPowerSelectOptions(entries: readonly unknown[]) {\n const result: unknown[] = [];\n let current: { options: unknown[]; groupName?: string } | undefined;\n\n entries.forEach((entry) => {\n if (isComboBoxGroupLabel(entry)) {\n current = {\n ...entry.group,\n groupName: comboBoxGroupLabel(entry.group),\n options: []\n };\n result.push(current);\n } else if (current) {\n current.options.push(entry);\n } else {\n result.push(entry);\n }\n });\n\n return result;\n}\n\n/**\n * Groups and their options in one list (group objects included), the rows\n * of EuiComboBox's list and upstream's `matchingOptions` order.\n */\nexport function flattenComboBoxRows(options: readonly unknown[]): unknown[] {\n const rows: unknown[] = [];\n\n options.forEach((option) => {\n if (isComboBoxGroup(option) && 'groupName' in option) {\n rows.push(option);\n option.options.forEach((child) => rows.push(child));\n } else {\n rows.push(option);\n }\n });\n\n return rows;\n}\n\n/** An option that can be highlighted or chosen (not a group, not disabled). */\nexport const isSelectableRow = (row: unknown, group?: unknown): boolean =>\n !(isComboBoxGroup(row) && 'groupName' in (row as object)) &&\n !(\n row &&\n typeof row === 'object' &&\n (row as { disabled?: boolean }).disabled === true\n ) &&\n !(\n group &&\n typeof group === 'object' &&\n (group as { disabled?: boolean }).disabled === true\n );\n\n/**\n * Upstream `findNextSelectableOptionIndex`: from `startIndex`, the first\n * selectable row in `direction`, wrapping around; `-1` when none.\n */\nexport function findNextSelectableIndex(\n rows: readonly unknown[],\n selectable: (index: number) => boolean,\n startIndex: number,\n direction: 1 | -1 = 1\n): number {\n if (!rows.length) return -1;\n\n let index = startIndex;\n\n for (let count = 0; count < rows.length; count++) {\n if (selectable(index)) return index;\n\n index = (index + direction + rows.length) % rows.length;\n }\n\n return -1;\n}\n\n/**\n * Upstream `getSelectedOptionForSearchValue`: the selected option whose\n * label equals the text.\n */\nexport function selectedOptionForSearchValue(\n selectedOptions: readonly unknown[],\n searchValue: string,\n searchField: string | undefined,\n isCaseSensitive?: boolean\n): unknown {\n const search = transformForCaseSensitivity(searchValue, isCaseSensitive);\n\n return selectedOptions.find(\n (option) =>\n transformForCaseSensitivity(\n comboBoxOptionLabel(option, searchField),\n isCaseSensitive\n ) === search\n );\n}\n\n/**\n * Upstream `EuiComboBoxOptionAppendPrepend` spacing: margin between an\n * option's `prepend` / `append` and its text, with block icons so they\n * align with the text.\n */\nexport function comboBoxAppendPrependStyles(\n margin: string\n): { prepend: CSSObject; append: CSSObject } {\n const centerIcons = { '.euiIcon': { display: 'block' } };\n\n return {\n prepend: { marginInlineEnd: margin, ...centerIcons },\n append: { marginInlineStart: margin, ...centerIcons }\n };\n}\n\n/**\n * Option `prepend` / `append` and EuiComboBox's `@prepend` / `@append`:\n * text, or a component (rendered with the option as `@option`).\n */\nexport const isTextNode = (value: unknown): boolean =>\n typeof value === 'string' ||\n typeof value === 'number' ||\n // htmlSafe strings render as HTML, like text\n (Boolean(value) &&\n typeof value === 'object' &&\n typeof (value as { toHTML?: unknown }).toHTML === 'function');\n"],"names":["comboBoxBoxReset","boxSizing","comboBoxOptionLabel","option","searchField","String","record","value","transformForCaseSensitivity","text","isCaseSensitive","toLowerCase","isComboBoxGroup","Boolean","Array","isArray","options","comboBoxGroupLabel","group","groupName","label","flattenOptionGroups","reduce","all","concat","push","createPartialStringEqualityOptionMatcher","ignoreAccents","fold","removeAccents","normalizedSearchValue","trim","includes","normalize","replace","keyOf","key","undefined","isComboBoxOptionSelected","selectedOptions","length","normalized","some","selected","isComboBoxOptionChecked","isComboBoxGroupLabel","entry","isGroupLabelOption","getMatchingEntries","searchValue","optionMatcher","isPreFiltered","showPrevSelected","sortMatchesBy","entries","collect","accumulator","forEach","matches","child","startWith","others","startsWith","entriesToPowerSelectOptions","result","current","flattenComboBoxRows","rows","isSelectableRow","row","disabled","findNextSelectableIndex","selectable","startIndex","direction","index","count","selectedOptionForSearchValue","search","find","comboBoxAppendPrependStyles","margin","centerIcons","display","prepend","marginInlineEnd","append","marginInlineStart","isTextNode","toHTML"],"mappings":"AAAA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACO,MAAMA,gBAA2B,GAAG;AACzCC,EAAAA,SAAS,EAAE,YAAY;AACvB,EAAA,kCAAkC,EAAE;AAAEA,IAAAA,SAAS,EAAE;AAAa;AAChE;;AAEA;AACO,SAASC,mBAAmBA,CAACC,MAAe,EAAEC,WAAoB,EAAU;AACjF,EAAA,IAAI,OAAOD,MAAM,KAAK,QAAQ,EAAE,OAAOA,MAAM;EAC7C,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE,OAAOE,MAAM,CAACF,MAAM,CAAC;AACrD,EAAA,IAAIA,MAAM,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAE;IACxC,MAAMG,MAAM,GAAGH,MAAiC;AAChD,IAAA,MAAMI,KAAK,GAAGD,MAAM,CAACF,WAAW,IAAI,OAAO,CAAC,IAAIE,MAAM,CAAC,OAAO,CAAC;IAE/D,IAAI,OAAOC,KAA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,MAAM,GAAGtE,2BAA2B,CAACyC,WAAW,EAAEvC,eAAe,CAAC;AAExE,EAAA,OAAO6B,eAAe,CAACwC,IAAI,CACxB5E,MAAM,IACLK,2BAA2B,CACzBN,mBAAmB,CAACC,MAAM,EAAEC,WAAW,CAAC,EACxCM,eACF,CAAC,KAAKoE,MACV,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASE,2BAA2BA,CACzCC,MAAc,EAC6B;AAC3C,EAAA,MAAMC,WAAW,GAAG;AAAE,IAAA,UAAU,EAAE;AAAEC,MAAAA,OAAO,EAAE;AAAQ;GAAG;EAExD,OAAO;AACLC,IAAAA,OAAO,EAAE;AAAEC,MAAAA,eAAe,EAAEJ,MAAM;MAAE,GAAGC;KAAa;AACpDI,IAAAA,MAAM,EAAE;AAAEC,MAAAA,iBAAiB,EAAEN,MAAM;MAAE,GAAGC;AAAY;GACrD;AACH;;AAEA;AACA;AACA;AACA;AACO,MAAMM,UAAU,GAAIjF,KAAc,IACvC,OAAOA,KAAK,KAAK,QAAQ,IACzB,OAAOA,KAAK,KAAK,QAAQ;AACzB;AACCM,OAAO,CAACN,KAAK,CAAC,IACb,OAAOA,KAAK,KAAK,QAAQ,IACzB,OAAQA,KAAK,CAA0BkF,MAAM,KAAK;;"}
|
|
@@ -410,10 +410,16 @@ function flyoutManagerReducer(state = initialState, action) {
|
|
|
410
410
|
const hasRemainingInCurrentGroup = sessionsWithoutCurrent.some(s => s.historyKey === currentSession.historyKey);
|
|
411
411
|
const newSessions = hasRemainingInCurrentGroup ? moveHistoryGroupToTop(sessionsWithoutCurrent, currentSession.historyKey) : sessionsWithoutCurrent;
|
|
412
412
|
const newFlyouts = state.flyouts.filter(f => !flyoutsToRemove.has(f.flyoutId));
|
|
413
|
+
|
|
414
|
+
// Ember EUI: reset the z-index counter like ACTION_CLOSE does once
|
|
415
|
+
// nothing is left. Upstream 123.1.0 skips it here, so each Back that
|
|
416
|
+
// closes the last session raised every later flyout's z-index.
|
|
417
|
+
const currentZIndex = newSessions.length === 0 && state.unmanagedFlyouts.length === 0 ? 0 : state.currentZIndex;
|
|
413
418
|
return {
|
|
414
419
|
...state,
|
|
415
420
|
sessions: newSessions,
|
|
416
|
-
flyouts: newFlyouts
|
|
421
|
+
flyouts: newFlyouts,
|
|
422
|
+
currentZIndex
|
|
417
423
|
};
|
|
418
424
|
}
|
|
419
425
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducer.js","sources":["../../../../src/utils/eui/flyout-manager/reducer.ts"],"sourcesContent":["/*\n * Ported from @elastic/eui 123.1.0 `components/flyout/manager/reducer.ts`.\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under\n * one or more contributor license agreements. Licensed under the Elastic\n * License 2.0 or the Server Side Public License, v 1; see vendor/eui-latest.\n */\nimport {\n ACTION_ADD,\n ACTION_CLOSE,\n ACTION_CLOSE_ALL,\n ACTION_SET_ACTIVE,\n ACTION_SET_LAYOUT_MODE,\n ACTION_SET_WIDTH,\n ACTION_SET_PAGINATION,\n ACTION_SET_ACTIVITY_STAGE,\n ACTION_GO_BACK,\n ACTION_GO_TO_FLYOUT,\n ACTION_SET_PUSH_PADDING,\n ACTION_ADD_UNMANAGED_FLYOUT,\n ACTION_CLOSE_UNMANAGED_FLYOUT,\n ACTION_SET_CONTAINER_ELEMENT,\n ACTION_SET_REFERENCE_WIDTH,\n} from './actions.ts';\nimport {\n LAYOUT_MODE_SIDE_BY_SIDE,\n LEVEL_MAIN,\n LEVEL_CHILD,\n STAGE_OPENING,\n} from './const.ts';\n\nimport type { Action } from './actions.ts';\nimport type {\n EuiFlyoutManagerState,\n FlyoutSession,\n EuiManagedFlyoutState\n} from './types.ts';\n\n/**\n * Default flyout manager state used to initialize the reducer.\n */\nexport const initialState: EuiFlyoutManagerState = {\n sessions: [],\n flyouts: [],\n layoutMode: LAYOUT_MODE_SIDE_BY_SIDE,\n pushPadding: { left: 0, right: 0 },\n currentZIndex: 0,\n unmanagedFlyouts: [],\n};\n\nconst addSessionFlyoutsToRemove = (\n session: FlyoutSession,\n flyoutsToRemove: Set<string>\n) => {\n flyoutsToRemove.add(session.mainFlyoutId);\n if (session.childFlyoutId) {\n flyoutsToRemove.add(session.childFlyoutId);\n }\n (session.childHistory ?? []).forEach((e) => flyoutsToRemove.add(e.flyoutId));\n};\n\nconst moveHistoryGroupToTop = (\n sessions: FlyoutSession[],\n historyKey: symbol\n): FlyoutSession[] => {\n const groupSessions: FlyoutSession[] = [];\n const otherSessions: FlyoutSession[] = [];\n\n sessions.forEach((session) => {\n if (session.historyKey === historyKey) {\n groupSessions.push(session);\n } else {\n otherSessions.push(session);\n }\n });\n\n return [...otherSessions, ...groupSessions];\n};\n\n/**\n * Reducer handling all flyout manager actions and state transitions.\n */\nexport function flyoutManagerReducer(\n state: EuiFlyoutManagerState = initialState,\n action: Action\n): EuiFlyoutManagerState {\n switch (action.type) {\n case ACTION_ADD_UNMANAGED_FLYOUT: {\n if (state.unmanagedFlyouts.includes(action.flyoutId)) {\n return state;\n }\n\n return {\n ...state,\n // Increment by 2 for each new unmanaged flyout.\n // Unmanaged flyouts render on z-index of `n`, and their overlay mask\n // on `n - 1`.\n currentZIndex: state.currentZIndex + 2,\n unmanagedFlyouts: [...state.unmanagedFlyouts, action.flyoutId],\n };\n }\n\n case ACTION_CLOSE_UNMANAGED_FLYOUT: {\n const newUnmanagedFlyouts = state.unmanagedFlyouts.filter(\n (flyoutId) => flyoutId !== action.flyoutId\n );\n\n let newCurrentZIndex = state.currentZIndex;\n if (state.sessions.length === 0 && newUnmanagedFlyouts.length === 0) {\n newCurrentZIndex = 0;\n }\n\n return {\n ...state,\n unmanagedFlyouts: newUnmanagedFlyouts,\n currentZIndex: newCurrentZIndex,\n };\n }\n\n // Register a flyout.\n // - Ignore duplicates by `flyoutId`.\n // - For a `main` flyout, start a new session { main, child: null }.\n // - For a `child` flyout, attach it to the most recent session; if no\n // session exists, do nothing (invalid child without a parent).\n case ACTION_ADD: {\n const { flyoutId, title, level, size, historyKey, iconType, minWidth } =\n action;\n\n const isDuplicate = state.flyouts.some((f) => f.flyoutId === flyoutId);\n const isIdempotentChild =\n level === LEVEL_CHILD &&\n state.sessions.length > 0 &&\n state.sessions[state.sessions.length - 1]!.childFlyoutId === flyoutId;\n\n // Ignore duplicate registrations (except idempotent child re-registration after goBack)\n if (isDuplicate && !isIdempotentChild) {\n return state;\n }\n\n const newFlyoutState: EuiManagedFlyoutState = {\n level,\n flyoutId,\n size,\n minWidth,\n activityStage: STAGE_OPENING,\n };\n const newFlyouts: EuiManagedFlyoutState[] = isIdempotentChild\n ? state.flyouts\n : [...state.flyouts, newFlyoutState];\n\n if (level === LEVEL_MAIN) {\n const newSession: FlyoutSession = {\n mainFlyoutId: flyoutId,\n title: title,\n iconType,\n childFlyoutId: null,\n childHistory: [],\n zIndex: state.currentZIndex,\n historyKey: historyKey ?? Symbol(),\n };\n\n return {\n ...state,\n sessions: [...state.sessions, newSession],\n flyouts: newFlyouts,\n // Increment by 3 for each new flyout session.\n // Managed flyouts render main flyouts on z-index of `n`,\n // child flyouts on `n - 1` and the overlay mask on `n - 2`.\n currentZIndex: state.currentZIndex + 3,\n };\n }\n\n if (state.sessions.length === 0) {\n return state;\n }\n\n const updatedSessions = [...state.sessions];\n const currentSessionIndex = updatedSessions.length - 1;\n const currentSession = updatedSessions[currentSessionIndex]!;\n const childHistory = currentSession.childHistory ?? [];\n\n // Idempotent re-registration (e.g. after goBack): flyout already in flyouts and session already points to it\n if (state.flyouts.some((f) => f.flyoutId === flyoutId)) {\n if (currentSession.childFlyoutId === flyoutId) {\n updatedSessions[currentSessionIndex] = {\n ...currentSession,\n childTitle: title,\n childIconType: iconType,\n childHistory,\n };\n return { ...state, sessions: updatedSessions };\n }\n return state; // duplicate registration for a different child, ignore\n }\n\n // Session already has a child: push current child to history, then set new child (do not remove previous from flyouts)\n if (currentSession.childFlyoutId) {\n const historyEntry = {\n flyoutId: currentSession.childFlyoutId,\n title: currentSession.childTitle ?? '',\n iconType: currentSession.childIconType,\n };\n updatedSessions[currentSessionIndex] = {\n ...currentSession,\n childHistory: [...childHistory, historyEntry],\n childFlyoutId: flyoutId,\n childTitle: title,\n childIconType: iconType,\n };\n return { ...state, sessions: updatedSessions, flyouts: newFlyouts };\n }\n\n // First child in session\n updatedSessions[currentSessionIndex] = {\n ...currentSession,\n childFlyoutId: flyoutId,\n childTitle: title,\n childIconType: iconType,\n childHistory,\n };\n\n return { ...state, sessions: updatedSessions, flyouts: newFlyouts };\n }\n\n // Unregister a flyout and update sessions accordingly.\n // - When closing a `main` flyout, drop its entire session and all associated flyouts.\n // - When closing a `child` flyout, find the session that owns it (childFlyoutId or\n // childHistory) and clear that session's child state so navigation back stays consistent.\n case ACTION_CLOSE: {\n const removedFlyout = state.flyouts.find(\n (f) => f.flyoutId === action.flyoutId\n );\n\n if (!removedFlyout) {\n return state;\n }\n\n if (removedFlyout.level === LEVEL_MAIN) {\n // Find the session that contains this main flyout\n const sessionToRemove = state.sessions.find(\n (session) => session.mainFlyoutId === action.flyoutId\n );\n\n if (sessionToRemove) {\n // Remove all flyouts associated with this session (main + current child + child history)\n const flyoutsToRemove = new Set([action.flyoutId]);\n if (sessionToRemove.childFlyoutId) {\n flyoutsToRemove.add(sessionToRemove.childFlyoutId);\n }\n (sessionToRemove.childHistory ?? []).forEach((entry) =>\n flyoutsToRemove.add(entry.flyoutId)\n );\n\n const newFlyouts = state.flyouts.filter(\n (f) => !flyoutsToRemove.has(f.flyoutId)\n );\n\n const newSessions = state.sessions.filter(\n (session) => session.mainFlyoutId !== action.flyoutId\n );\n\n let newCurrentZIndex = state.currentZIndex;\n if (newSessions.length === 0 && state.unmanagedFlyouts.length === 0) {\n // Reset to initial value if no flyouts remain open to avoid\n // the value going too high during the lifecycle of the app\n newCurrentZIndex = 0;\n }\n\n return {\n ...state,\n sessions: newSessions,\n flyouts: newFlyouts,\n currentZIndex: newCurrentZIndex,\n };\n }\n }\n\n // Handle child flyout closing: find the session that owns this child and\n // clear that session's child state (so we stay consistent when navigating back).\n if (state.sessions.length === 0) {\n return {\n ...state,\n flyouts: state.flyouts.filter((f) => f.flyoutId !== action.flyoutId),\n };\n }\n\n const owningSessionIndex = state.sessions.findIndex(\n (session) =>\n session.childFlyoutId === action.flyoutId ||\n (session.childHistory ?? []).some(\n (entry) => entry.flyoutId === action.flyoutId\n )\n );\n\n if (owningSessionIndex === -1) {\n // Closed flyout not in any session's child state; just remove the one flyout\n return {\n ...state,\n flyouts: state.flyouts.filter((f) => f.flyoutId !== action.flyoutId),\n };\n }\n\n const owningSession = state.sessions[owningSessionIndex]!;\n const childIds = new Set(\n [\n owningSession.childFlyoutId,\n ...(owningSession.childHistory ?? []).map((e) => e.flyoutId),\n ].filter(Boolean) as string[]\n );\n\n const newFlyouts = state.flyouts.filter((f) => !childIds.has(f.flyoutId));\n const updatedSessions = [...state.sessions];\n updatedSessions[owningSessionIndex] = {\n ...owningSession,\n childFlyoutId: null,\n childTitle: undefined,\n childIconType: undefined,\n childHistory: [],\n };\n\n return { ...state, sessions: updatedSessions, flyouts: newFlyouts };\n }\n\n // Unregister all flyouts (within the current history group only).\n case ACTION_CLOSE_ALL: {\n if (state.sessions.length === 0) {\n return state;\n }\n\n const currentSessionIndex = state.sessions.length - 1;\n const currentSession = state.sessions[currentSessionIndex]!;\n const currentKey = currentSession.historyKey;\n\n // Remove all sessions that have the current historyKey (entire group)\n const newSessions = state.sessions.filter(\n (s) => s.historyKey !== currentKey\n );\n const flyoutsToRemove = new Set<string>();\n state.sessions.forEach((session) => {\n if (session.historyKey === currentKey) {\n addSessionFlyoutsToRemove(session, flyoutsToRemove);\n }\n });\n\n const newFlyouts = state.flyouts.filter(\n (f) => !flyoutsToRemove.has(f.flyoutId)\n );\n\n let newCurrentZIndex = state.currentZIndex;\n if (newSessions.length === 0 && state.unmanagedFlyouts.length === 0) {\n newCurrentZIndex = 0;\n }\n\n return {\n ...state,\n sessions: newSessions,\n flyouts: newFlyouts,\n currentZIndex: newCurrentZIndex,\n };\n }\n\n // Mark the provided flyout ID as the active child for the latest session.\n case ACTION_SET_ACTIVE: {\n // No-op when no session exists.\n if (state.sessions.length === 0) {\n return state;\n }\n\n const updatedSessions = [...state.sessions];\n const currentSessionIndex = updatedSessions.length - 1;\n\n updatedSessions[currentSessionIndex] = {\n ...updatedSessions[currentSessionIndex]!,\n childFlyoutId: action.flyoutId,\n };\n\n return { ...state, sessions: updatedSessions };\n }\n\n // Persist a flyout's measured width (px). Used for responsive layout\n // calculations, e.g., deciding stacked vs side-by-side.\n case ACTION_SET_WIDTH: {\n const { flyoutId, width } = action;\n const updatedFlyouts = state.flyouts.map((flyout) =>\n flyout.flyoutId === flyoutId ? { ...flyout, width } : flyout\n );\n return { ...state, flyouts: updatedFlyouts };\n }\n\n // Update a flyout's menu pagination. No-op if unchanged or missing.\n case ACTION_SET_PAGINATION: {\n const { flyoutId, pagination } = action;\n const target = state.flyouts.find((f) => f.flyoutId === flyoutId);\n if (!target) {\n return state;\n }\n if (target.pagination === pagination) {\n return state;\n }\n const updatedFlyouts = state.flyouts.map((flyout) =>\n flyout.flyoutId === flyoutId ? { ...flyout, pagination } : flyout\n );\n return { ...state, flyouts: updatedFlyouts };\n }\n\n // Switch global layout mode for managed flyouts.\n case ACTION_SET_LAYOUT_MODE: {\n return { ...state, layoutMode: action.layoutMode };\n }\n\n // Update a flyout's activity stage in state\n case ACTION_SET_ACTIVITY_STAGE: {\n const { flyoutId } = action;\n const updatedFlyouts = state.flyouts.map((flyout) =>\n flyout.flyoutId === flyoutId\n ? { ...flyout, activityStage: action.activityStage }\n : flyout\n );\n return { ...state, flyouts: updatedFlyouts };\n }\n\n // Go back: pop child history when any, else pop current session (only within same historyKey).\n case ACTION_GO_BACK: {\n if (state.sessions.length === 0) {\n return state;\n }\n\n const currentSessionIndex = state.sessions.length - 1;\n const currentSession = state.sessions[currentSessionIndex]!;\n const childHistory = currentSession.childHistory ?? [];\n\n if (childHistory.length > 0) {\n // Pop one child: set current child to the last entry in history, remove the current child flyout\n const popped = childHistory[childHistory.length - 1]!;\n const newChildHistory = childHistory.slice(0, -1);\n const updatedSessions = [...state.sessions];\n updatedSessions[currentSessionIndex] = {\n ...currentSession,\n childHistory: newChildHistory,\n childFlyoutId: popped.flyoutId,\n childTitle: popped.title,\n childIconType: popped.iconType,\n };\n const newFlyouts = state.flyouts.filter(\n (f) => f.flyoutId !== currentSession.childFlyoutId\n );\n return { ...state, sessions: updatedSessions, flyouts: newFlyouts };\n }\n\n // No child history: pop current session (main + all its children)\n const flyoutsToRemove = new Set<string>();\n addSessionFlyoutsToRemove(currentSession, flyoutsToRemove);\n\n const sessionsWithoutCurrent = state.sessions.slice(\n 0,\n currentSessionIndex\n );\n const hasRemainingInCurrentGroup = sessionsWithoutCurrent.some(\n (s) => s.historyKey === currentSession.historyKey\n );\n const newSessions = hasRemainingInCurrentGroup\n ? moveHistoryGroupToTop(\n sessionsWithoutCurrent,\n currentSession.historyKey\n )\n : sessionsWithoutCurrent;\n\n const newFlyouts = state.flyouts.filter(\n (f) => !flyoutsToRemove.has(f.flyoutId)\n );\n\n return { ...state, sessions: newSessions, flyouts: newFlyouts };\n }\n\n // Navigate to a specific flyout (by main session or by child in current session's history)\n case ACTION_GO_TO_FLYOUT: {\n const { flyoutId, level } = action;\n const currentSessionIndex = state.sessions.length - 1;\n\n if (level === LEVEL_CHILD && state.sessions.length > 0) {\n const currentSession = state.sessions[currentSessionIndex]!;\n const childHistory = currentSession.childHistory ?? [];\n const targetIndex = childHistory.findIndex(\n (entry) => entry.flyoutId === flyoutId\n );\n\n if (targetIndex === -1) {\n return state; // Target child not in history\n }\n\n const targetEntry = childHistory[targetIndex]!;\n const newChildHistory = childHistory.slice(0, targetIndex);\n\n const flyoutsToRemove = new Set<string>();\n if (currentSession.childFlyoutId) {\n flyoutsToRemove.add(currentSession.childFlyoutId);\n }\n childHistory.slice(targetIndex + 1).forEach((e) => {\n flyoutsToRemove.add(e.flyoutId);\n });\n\n const newFlyouts = state.flyouts.filter(\n (f) => !flyoutsToRemove.has(f.flyoutId)\n );\n\n const updatedSessions = [...state.sessions];\n updatedSessions[currentSessionIndex] = {\n ...currentSession,\n childHistory: newChildHistory,\n childFlyoutId: targetEntry.flyoutId,\n childTitle: targetEntry.title,\n childIconType: targetEntry.iconType,\n };\n\n return { ...state, sessions: updatedSessions, flyouts: newFlyouts };\n }\n\n // Navigate by main flyout: remove all sessions after the target\n const targetSessionIndex = state.sessions.findIndex(\n (session) => session.mainFlyoutId === flyoutId\n );\n\n if (targetSessionIndex === -1) {\n return state; // Target flyout not found\n }\n\n const currentSession = state.sessions[currentSessionIndex]!;\n const targetSession = state.sessions[targetSessionIndex]!;\n\n // Group-local navigation: keep other history groups, remove only newer sessions in target's group,\n // then bring that group to the top.\n if (targetSession.historyKey === currentSession.historyKey) {\n const flyoutsToRemove = new Set<string>();\n const sessionsAfterTargetInGroup = state.sessions.filter(\n (session, index) =>\n index > targetSessionIndex &&\n session.historyKey === targetSession.historyKey\n );\n\n sessionsAfterTargetInGroup.forEach((session) => {\n addSessionFlyoutsToRemove(session, flyoutsToRemove);\n });\n\n const sessionsWithoutRemoved = state.sessions.filter(\n (session) =>\n !sessionsAfterTargetInGroup.some(\n (removed) => removed.mainFlyoutId === session.mainFlyoutId\n )\n );\n const reorderedSessions = moveHistoryGroupToTop(\n sessionsWithoutRemoved,\n targetSession.historyKey\n );\n const newFlyouts = state.flyouts.filter(\n (f) => !flyoutsToRemove.has(f.flyoutId)\n );\n\n return { ...state, sessions: reorderedSessions, flyouts: newFlyouts };\n }\n\n const sessionsToClose = state.sessions.slice(targetSessionIndex + 1);\n const flyoutsToRemove = new Set<string>();\n sessionsToClose.forEach((session) => {\n addSessionFlyoutsToRemove(session, flyoutsToRemove);\n });\n\n const newFlyouts = state.flyouts.filter(\n (f) => !flyoutsToRemove.has(f.flyoutId)\n );\n const newSessions = state.sessions.slice(0, targetSessionIndex + 1);\n\n return { ...state, sessions: newSessions, flyouts: newFlyouts };\n }\n\n // Set push padding offset for a specific side\n case ACTION_SET_PUSH_PADDING: {\n const { side, width } = action;\n return {\n ...state,\n pushPadding: {\n ...(state.pushPadding ?? { left: 0, right: 0 }),\n [side]: width,\n },\n };\n }\n\n // Store the container element for container-relative layout calculations.\n case ACTION_SET_CONTAINER_ELEMENT: {\n if (state.containerElement === action.element) {\n return state; // No-op if same element\n }\n return { ...state, containerElement: action.element };\n }\n\n case ACTION_SET_REFERENCE_WIDTH: {\n if (state.referenceWidth === action.width) {\n return state;\n }\n return { ...state, referenceWidth: action.width };\n }\n\n default:\n return state;\n }\n}\n"],"names":["initialState","sessions","flyouts","layoutMode","LAYOUT_MODE_SIDE_BY_SIDE","pushPadding","left","right","currentZIndex","unmanagedFlyouts","addSessionFlyoutsToRemove","session","flyoutsToRemove","add","mainFlyoutId","childFlyoutId","childHistory","forEach","e","flyoutId","moveHistoryGroupToTop","historyKey","groupSessions","otherSessions","push","flyoutManagerReducer","state","action","type","ACTION_ADD_UNMANAGED_FLYOUT","includes","ACTION_CLOSE_UNMANAGED_FLYOUT","newUnmanagedFlyouts","filter","newCurrentZIndex","length","ACTION_ADD","title","level","size","iconType","minWidth","isDuplicate","some","f","isIdempotentChild","LEVEL_CHILD","newFlyoutState","activityStage","STAGE_OPENING","newFlyouts","LEVEL_MAIN","newSession","zIndex","Symbol","updatedSessions","currentSessionIndex","currentSession","childTitle","childIconType","historyEntry","ACTION_CLOSE","removedFlyout","find","sessionToRemove","Set","entry","has","newSessions","owningSessionIndex","findIndex","owningSession","childIds","map","Boolean","undefined","ACTION_CLOSE_ALL","currentKey","s","ACTION_SET_ACTIVE","ACTION_SET_WIDTH","width","updatedFlyouts","flyout","ACTION_SET_PAGINATION","pagination","target","ACTION_SET_LAYOUT_MODE","ACTION_SET_ACTIVITY_STAGE","ACTION_GO_BACK","popped","newChildHistory","slice","sessionsWithoutCurrent","hasRemainingInCurrentGroup","ACTION_GO_TO_FLYOUT","targetIndex","targetEntry","targetSessionIndex","targetSession","sessionsAfterTargetInGroup","index","sessionsWithoutRemoved","removed","reorderedSessions","sessionsToClose","ACTION_SET_PUSH_PADDING","side","ACTION_SET_CONTAINER_ELEMENT","containerElement","element","ACTION_SET_REFERENCE_WIDTH","referenceWidth"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AAgCA;AACA;AACA;AACO,MAAMA,YAAmC,GAAG;AACjDC,EAAAA,QAAQ,EAAE,EAAE;AACZC,EAAAA,OAAO,EAAE,EAAE;AACXC,EAAAA,UAAU,EAAEC,wBAAwB;AACpCC,EAAAA,WAAW,EAAE;AAAEC,IAAAA,IAAI,EAAE,CAAC;AAAEC,IAAAA,KAAK,EAAE;GAAG;AAClCC,EAAAA,aAAa,EAAE,CAAC;AAChBC,EAAAA,gBAAgB,EAAE;AACpB;AAEA,MAAMC,yBAAyB,GAAGA,CAChCC,OAAsB,EACtBC,eAA4B,KACzB;AACHA,EAAAA,eAAe,CAACC,GAAG,CAACF,OAAO,CAACG,YAAY,CAAC;EACzC,IAAIH,OAAO,CAACI,aAAa,EAAE;AACzBH,IAAAA,eAAe,CAACC,GAAG,CAACF,OAAO,CAACI,aAAa,CAAC;AAC5C,EAAA;AACA,EAAA,CAACJ,OAAO,CAACK,YAAY,IAAI,EAAE,EAAEC,OAAO,CAAEC,CAAC,IAAKN,eAAe,CAACC,GAAG,CAACK,CAAC,CAACC,QAAQ,CAAC,CAAC;AAC9E,CAAC;AAED,MAAMC,qBAAqB,GAAGA,CAC5BnB,QAAyB,EACzBoB,UAAkB,KACE;EACpB,MAAMC,aAA8B,GAAG,EAAE;EACzC,MAAMC,aAA8B,GAAG,EAAE;AAEzCtB,EAAAA,QAAQ,CAACgB,OAAO,CAAEN,OAAO,IAAK;AAC5B,IAAA,IAAIA,OAAO,CAACU,UAAU,KAAKA,UAAU,EAAE;AACrCC,MAAAA,aAAa,CAACE,IAAI,CAACb,OAAO,CAAC;AAC7B,IAAA,CAAC,MAAM;AACLY,MAAAA,aAAa,CAACC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S;AACvD,MAAA;AAEA,IAAA,KAAKC,0BAA0B;AAAE,MAAA;AAC/B,QAAA,IAAIrF,KAAK,CAACsF,cAAc,KAAKrF,MAAM,CAACsD,KAAK,EAAE;AACzC,UAAA,OAAOvD,KAAK;AACd,QAAA;QACA,OAAO;AAAE,UAAA,GAAGA,KAAK;UAAEsF,cAAc,EAAErF,MAAM,CAACsD;SAAO;AACnD,MAAA;AAEA,IAAA;AACE,MAAA,OAAOvD,KAAK;AAChB;AACF;;"}
|
|
1
|
+
{"version":3,"file":"reducer.js","sources":["../../../../src/utils/eui/flyout-manager/reducer.ts"],"sourcesContent":["/*\n * Ported from @elastic/eui 123.1.0 `components/flyout/manager/reducer.ts`.\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under\n * one or more contributor license agreements. Licensed under the Elastic\n * License 2.0 or the Server Side Public License, v 1; see vendor/eui-latest.\n */\nimport {\n ACTION_ADD,\n ACTION_CLOSE,\n ACTION_CLOSE_ALL,\n ACTION_SET_ACTIVE,\n ACTION_SET_LAYOUT_MODE,\n ACTION_SET_WIDTH,\n ACTION_SET_PAGINATION,\n ACTION_SET_ACTIVITY_STAGE,\n ACTION_GO_BACK,\n ACTION_GO_TO_FLYOUT,\n ACTION_SET_PUSH_PADDING,\n ACTION_ADD_UNMANAGED_FLYOUT,\n ACTION_CLOSE_UNMANAGED_FLYOUT,\n ACTION_SET_CONTAINER_ELEMENT,\n ACTION_SET_REFERENCE_WIDTH,\n} from './actions.ts';\nimport {\n LAYOUT_MODE_SIDE_BY_SIDE,\n LEVEL_MAIN,\n LEVEL_CHILD,\n STAGE_OPENING,\n} from './const.ts';\n\nimport type { Action } from './actions.ts';\nimport type {\n EuiFlyoutManagerState,\n FlyoutSession,\n EuiManagedFlyoutState\n} from './types.ts';\n\n/**\n * Default flyout manager state used to initialize the reducer.\n */\nexport const initialState: EuiFlyoutManagerState = {\n sessions: [],\n flyouts: [],\n layoutMode: LAYOUT_MODE_SIDE_BY_SIDE,\n pushPadding: { left: 0, right: 0 },\n currentZIndex: 0,\n unmanagedFlyouts: [],\n};\n\nconst addSessionFlyoutsToRemove = (\n session: FlyoutSession,\n flyoutsToRemove: Set<string>\n) => {\n flyoutsToRemove.add(session.mainFlyoutId);\n if (session.childFlyoutId) {\n flyoutsToRemove.add(session.childFlyoutId);\n }\n (session.childHistory ?? []).forEach((e) => flyoutsToRemove.add(e.flyoutId));\n};\n\nconst moveHistoryGroupToTop = (\n sessions: FlyoutSession[],\n historyKey: symbol\n): FlyoutSession[] => {\n const groupSessions: FlyoutSession[] = [];\n const otherSessions: FlyoutSession[] = [];\n\n sessions.forEach((session) => {\n if (session.historyKey === historyKey) {\n groupSessions.push(session);\n } else {\n otherSessions.push(session);\n }\n });\n\n return [...otherSessions, ...groupSessions];\n};\n\n/**\n * Reducer handling all flyout manager actions and state transitions.\n */\nexport function flyoutManagerReducer(\n state: EuiFlyoutManagerState = initialState,\n action: Action\n): EuiFlyoutManagerState {\n switch (action.type) {\n case ACTION_ADD_UNMANAGED_FLYOUT: {\n if (state.unmanagedFlyouts.includes(action.flyoutId)) {\n return state;\n }\n\n return {\n ...state,\n // Increment by 2 for each new unmanaged flyout.\n // Unmanaged flyouts render on z-index of `n`, and their overlay mask\n // on `n - 1`.\n currentZIndex: state.currentZIndex + 2,\n unmanagedFlyouts: [...state.unmanagedFlyouts, action.flyoutId],\n };\n }\n\n case ACTION_CLOSE_UNMANAGED_FLYOUT: {\n const newUnmanagedFlyouts = state.unmanagedFlyouts.filter(\n (flyoutId) => flyoutId !== action.flyoutId\n );\n\n let newCurrentZIndex = state.currentZIndex;\n if (state.sessions.length === 0 && newUnmanagedFlyouts.length === 0) {\n newCurrentZIndex = 0;\n }\n\n return {\n ...state,\n unmanagedFlyouts: newUnmanagedFlyouts,\n currentZIndex: newCurrentZIndex,\n };\n }\n\n // Register a flyout.\n // - Ignore duplicates by `flyoutId`.\n // - For a `main` flyout, start a new session { main, child: null }.\n // - For a `child` flyout, attach it to the most recent session; if no\n // session exists, do nothing (invalid child without a parent).\n case ACTION_ADD: {\n const { flyoutId, title, level, size, historyKey, iconType, minWidth } =\n action;\n\n const isDuplicate = state.flyouts.some((f) => f.flyoutId === flyoutId);\n const isIdempotentChild =\n level === LEVEL_CHILD &&\n state.sessions.length > 0 &&\n state.sessions[state.sessions.length - 1]!.childFlyoutId === flyoutId;\n\n // Ignore duplicate registrations (except idempotent child re-registration after goBack)\n if (isDuplicate && !isIdempotentChild) {\n return state;\n }\n\n const newFlyoutState: EuiManagedFlyoutState = {\n level,\n flyoutId,\n size,\n minWidth,\n activityStage: STAGE_OPENING,\n };\n const newFlyouts: EuiManagedFlyoutState[] = isIdempotentChild\n ? state.flyouts\n : [...state.flyouts, newFlyoutState];\n\n if (level === LEVEL_MAIN) {\n const newSession: FlyoutSession = {\n mainFlyoutId: flyoutId,\n title: title,\n iconType,\n childFlyoutId: null,\n childHistory: [],\n zIndex: state.currentZIndex,\n historyKey: historyKey ?? Symbol(),\n };\n\n return {\n ...state,\n sessions: [...state.sessions, newSession],\n flyouts: newFlyouts,\n // Increment by 3 for each new flyout session.\n // Managed flyouts render main flyouts on z-index of `n`,\n // child flyouts on `n - 1` and the overlay mask on `n - 2`.\n currentZIndex: state.currentZIndex + 3,\n };\n }\n\n if (state.sessions.length === 0) {\n return state;\n }\n\n const updatedSessions = [...state.sessions];\n const currentSessionIndex = updatedSessions.length - 1;\n const currentSession = updatedSessions[currentSessionIndex]!;\n const childHistory = currentSession.childHistory ?? [];\n\n // Idempotent re-registration (e.g. after goBack): flyout already in flyouts and session already points to it\n if (state.flyouts.some((f) => f.flyoutId === flyoutId)) {\n if (currentSession.childFlyoutId === flyoutId) {\n updatedSessions[currentSessionIndex] = {\n ...currentSession,\n childTitle: title,\n childIconType: iconType,\n childHistory,\n };\n return { ...state, sessions: updatedSessions };\n }\n return state; // duplicate registration for a different child, ignore\n }\n\n // Session already has a child: push current child to history, then set new child (do not remove previous from flyouts)\n if (currentSession.childFlyoutId) {\n const historyEntry = {\n flyoutId: currentSession.childFlyoutId,\n title: currentSession.childTitle ?? '',\n iconType: currentSession.childIconType,\n };\n updatedSessions[currentSessionIndex] = {\n ...currentSession,\n childHistory: [...childHistory, historyEntry],\n childFlyoutId: flyoutId,\n childTitle: title,\n childIconType: iconType,\n };\n return { ...state, sessions: updatedSessions, flyouts: newFlyouts };\n }\n\n // First child in session\n updatedSessions[currentSessionIndex] = {\n ...currentSession,\n childFlyoutId: flyoutId,\n childTitle: title,\n childIconType: iconType,\n childHistory,\n };\n\n return { ...state, sessions: updatedSessions, flyouts: newFlyouts };\n }\n\n // Unregister a flyout and update sessions accordingly.\n // - When closing a `main` flyout, drop its entire session and all associated flyouts.\n // - When closing a `child` flyout, find the session that owns it (childFlyoutId or\n // childHistory) and clear that session's child state so navigation back stays consistent.\n case ACTION_CLOSE: {\n const removedFlyout = state.flyouts.find(\n (f) => f.flyoutId === action.flyoutId\n );\n\n if (!removedFlyout) {\n return state;\n }\n\n if (removedFlyout.level === LEVEL_MAIN) {\n // Find the session that contains this main flyout\n const sessionToRemove = state.sessions.find(\n (session) => session.mainFlyoutId === action.flyoutId\n );\n\n if (sessionToRemove) {\n // Remove all flyouts associated with this session (main + current child + child history)\n const flyoutsToRemove = new Set([action.flyoutId]);\n if (sessionToRemove.childFlyoutId) {\n flyoutsToRemove.add(sessionToRemove.childFlyoutId);\n }\n (sessionToRemove.childHistory ?? []).forEach((entry) =>\n flyoutsToRemove.add(entry.flyoutId)\n );\n\n const newFlyouts = state.flyouts.filter(\n (f) => !flyoutsToRemove.has(f.flyoutId)\n );\n\n const newSessions = state.sessions.filter(\n (session) => session.mainFlyoutId !== action.flyoutId\n );\n\n let newCurrentZIndex = state.currentZIndex;\n if (newSessions.length === 0 && state.unmanagedFlyouts.length === 0) {\n // Reset to initial value if no flyouts remain open to avoid\n // the value going too high during the lifecycle of the app\n newCurrentZIndex = 0;\n }\n\n return {\n ...state,\n sessions: newSessions,\n flyouts: newFlyouts,\n currentZIndex: newCurrentZIndex,\n };\n }\n }\n\n // Handle child flyout closing: find the session that owns this child and\n // clear that session's child state (so we stay consistent when navigating back).\n if (state.sessions.length === 0) {\n return {\n ...state,\n flyouts: state.flyouts.filter((f) => f.flyoutId !== action.flyoutId),\n };\n }\n\n const owningSessionIndex = state.sessions.findIndex(\n (session) =>\n session.childFlyoutId === action.flyoutId ||\n (session.childHistory ?? []).some(\n (entry) => entry.flyoutId === action.flyoutId\n )\n );\n\n if (owningSessionIndex === -1) {\n // Closed flyout not in any session's child state; just remove the one flyout\n return {\n ...state,\n flyouts: state.flyouts.filter((f) => f.flyoutId !== action.flyoutId),\n };\n }\n\n const owningSession = state.sessions[owningSessionIndex]!;\n const childIds = new Set(\n [\n owningSession.childFlyoutId,\n ...(owningSession.childHistory ?? []).map((e) => e.flyoutId),\n ].filter(Boolean) as string[]\n );\n\n const newFlyouts = state.flyouts.filter((f) => !childIds.has(f.flyoutId));\n const updatedSessions = [...state.sessions];\n updatedSessions[owningSessionIndex] = {\n ...owningSession,\n childFlyoutId: null,\n childTitle: undefined,\n childIconType: undefined,\n childHistory: [],\n };\n\n return { ...state, sessions: updatedSessions, flyouts: newFlyouts };\n }\n\n // Unregister all flyouts (within the current history group only).\n case ACTION_CLOSE_ALL: {\n if (state.sessions.length === 0) {\n return state;\n }\n\n const currentSessionIndex = state.sessions.length - 1;\n const currentSession = state.sessions[currentSessionIndex]!;\n const currentKey = currentSession.historyKey;\n\n // Remove all sessions that have the current historyKey (entire group)\n const newSessions = state.sessions.filter(\n (s) => s.historyKey !== currentKey\n );\n const flyoutsToRemove = new Set<string>();\n state.sessions.forEach((session) => {\n if (session.historyKey === currentKey) {\n addSessionFlyoutsToRemove(session, flyoutsToRemove);\n }\n });\n\n const newFlyouts = state.flyouts.filter(\n (f) => !flyoutsToRemove.has(f.flyoutId)\n );\n\n let newCurrentZIndex = state.currentZIndex;\n if (newSessions.length === 0 && state.unmanagedFlyouts.length === 0) {\n newCurrentZIndex = 0;\n }\n\n return {\n ...state,\n sessions: newSessions,\n flyouts: newFlyouts,\n currentZIndex: newCurrentZIndex,\n };\n }\n\n // Mark the provided flyout ID as the active child for the latest session.\n case ACTION_SET_ACTIVE: {\n // No-op when no session exists.\n if (state.sessions.length === 0) {\n return state;\n }\n\n const updatedSessions = [...state.sessions];\n const currentSessionIndex = updatedSessions.length - 1;\n\n updatedSessions[currentSessionIndex] = {\n ...updatedSessions[currentSessionIndex]!,\n childFlyoutId: action.flyoutId,\n };\n\n return { ...state, sessions: updatedSessions };\n }\n\n // Persist a flyout's measured width (px). Used for responsive layout\n // calculations, e.g., deciding stacked vs side-by-side.\n case ACTION_SET_WIDTH: {\n const { flyoutId, width } = action;\n const updatedFlyouts = state.flyouts.map((flyout) =>\n flyout.flyoutId === flyoutId ? { ...flyout, width } : flyout\n );\n return { ...state, flyouts: updatedFlyouts };\n }\n\n // Update a flyout's menu pagination. No-op if unchanged or missing.\n case ACTION_SET_PAGINATION: {\n const { flyoutId, pagination } = action;\n const target = state.flyouts.find((f) => f.flyoutId === flyoutId);\n if (!target) {\n return state;\n }\n if (target.pagination === pagination) {\n return state;\n }\n const updatedFlyouts = state.flyouts.map((flyout) =>\n flyout.flyoutId === flyoutId ? { ...flyout, pagination } : flyout\n );\n return { ...state, flyouts: updatedFlyouts };\n }\n\n // Switch global layout mode for managed flyouts.\n case ACTION_SET_LAYOUT_MODE: {\n return { ...state, layoutMode: action.layoutMode };\n }\n\n // Update a flyout's activity stage in state\n case ACTION_SET_ACTIVITY_STAGE: {\n const { flyoutId } = action;\n const updatedFlyouts = state.flyouts.map((flyout) =>\n flyout.flyoutId === flyoutId\n ? { ...flyout, activityStage: action.activityStage }\n : flyout\n );\n return { ...state, flyouts: updatedFlyouts };\n }\n\n // Go back: pop child history when any, else pop current session (only within same historyKey).\n case ACTION_GO_BACK: {\n if (state.sessions.length === 0) {\n return state;\n }\n\n const currentSessionIndex = state.sessions.length - 1;\n const currentSession = state.sessions[currentSessionIndex]!;\n const childHistory = currentSession.childHistory ?? [];\n\n if (childHistory.length > 0) {\n // Pop one child: set current child to the last entry in history, remove the current child flyout\n const popped = childHistory[childHistory.length - 1]!;\n const newChildHistory = childHistory.slice(0, -1);\n const updatedSessions = [...state.sessions];\n updatedSessions[currentSessionIndex] = {\n ...currentSession,\n childHistory: newChildHistory,\n childFlyoutId: popped.flyoutId,\n childTitle: popped.title,\n childIconType: popped.iconType,\n };\n const newFlyouts = state.flyouts.filter(\n (f) => f.flyoutId !== currentSession.childFlyoutId\n );\n return { ...state, sessions: updatedSessions, flyouts: newFlyouts };\n }\n\n // No child history: pop current session (main + all its children)\n const flyoutsToRemove = new Set<string>();\n addSessionFlyoutsToRemove(currentSession, flyoutsToRemove);\n\n const sessionsWithoutCurrent = state.sessions.slice(\n 0,\n currentSessionIndex\n );\n const hasRemainingInCurrentGroup = sessionsWithoutCurrent.some(\n (s) => s.historyKey === currentSession.historyKey\n );\n const newSessions = hasRemainingInCurrentGroup\n ? moveHistoryGroupToTop(\n sessionsWithoutCurrent,\n currentSession.historyKey\n )\n : sessionsWithoutCurrent;\n\n const newFlyouts = state.flyouts.filter(\n (f) => !flyoutsToRemove.has(f.flyoutId)\n );\n\n // Ember EUI: reset the z-index counter like ACTION_CLOSE does once\n // nothing is left. Upstream 123.1.0 skips it here, so each Back that\n // closes the last session raised every later flyout's z-index.\n const currentZIndex =\n newSessions.length === 0 && state.unmanagedFlyouts.length === 0\n ? 0\n : state.currentZIndex;\n\n return {\n ...state,\n sessions: newSessions,\n flyouts: newFlyouts,\n currentZIndex,\n };\n }\n\n // Navigate to a specific flyout (by main session or by child in current session's history)\n case ACTION_GO_TO_FLYOUT: {\n const { flyoutId, level } = action;\n const currentSessionIndex = state.sessions.length - 1;\n\n if (level === LEVEL_CHILD && state.sessions.length > 0) {\n const currentSession = state.sessions[currentSessionIndex]!;\n const childHistory = currentSession.childHistory ?? [];\n const targetIndex = childHistory.findIndex(\n (entry) => entry.flyoutId === flyoutId\n );\n\n if (targetIndex === -1) {\n return state; // Target child not in history\n }\n\n const targetEntry = childHistory[targetIndex]!;\n const newChildHistory = childHistory.slice(0, targetIndex);\n\n const flyoutsToRemove = new Set<string>();\n if (currentSession.childFlyoutId) {\n flyoutsToRemove.add(currentSession.childFlyoutId);\n }\n childHistory.slice(targetIndex + 1).forEach((e) => {\n flyoutsToRemove.add(e.flyoutId);\n });\n\n const newFlyouts = state.flyouts.filter(\n (f) => !flyoutsToRemove.has(f.flyoutId)\n );\n\n const updatedSessions = [...state.sessions];\n updatedSessions[currentSessionIndex] = {\n ...currentSession,\n childHistory: newChildHistory,\n childFlyoutId: targetEntry.flyoutId,\n childTitle: targetEntry.title,\n childIconType: targetEntry.iconType,\n };\n\n return { ...state, sessions: updatedSessions, flyouts: newFlyouts };\n }\n\n // Navigate by main flyout: remove all sessions after the target\n const targetSessionIndex = state.sessions.findIndex(\n (session) => session.mainFlyoutId === flyoutId\n );\n\n if (targetSessionIndex === -1) {\n return state; // Target flyout not found\n }\n\n const currentSession = state.sessions[currentSessionIndex]!;\n const targetSession = state.sessions[targetSessionIndex]!;\n\n // Group-local navigation: keep other history groups, remove only newer sessions in target's group,\n // then bring that group to the top.\n if (targetSession.historyKey === currentSession.historyKey) {\n const flyoutsToRemove = new Set<string>();\n const sessionsAfterTargetInGroup = state.sessions.filter(\n (session, index) =>\n index > targetSessionIndex &&\n session.historyKey === targetSession.historyKey\n );\n\n sessionsAfterTargetInGroup.forEach((session) => {\n addSessionFlyoutsToRemove(session, flyoutsToRemove);\n });\n\n const sessionsWithoutRemoved = state.sessions.filter(\n (session) =>\n !sessionsAfterTargetInGroup.some(\n (removed) => removed.mainFlyoutId === session.mainFlyoutId\n )\n );\n const reorderedSessions = moveHistoryGroupToTop(\n sessionsWithoutRemoved,\n targetSession.historyKey\n );\n const newFlyouts = state.flyouts.filter(\n (f) => !flyoutsToRemove.has(f.flyoutId)\n );\n\n return { ...state, sessions: reorderedSessions, flyouts: newFlyouts };\n }\n\n const sessionsToClose = state.sessions.slice(targetSessionIndex + 1);\n const flyoutsToRemove = new Set<string>();\n sessionsToClose.forEach((session) => {\n addSessionFlyoutsToRemove(session, flyoutsToRemove);\n });\n\n const newFlyouts = state.flyouts.filter(\n (f) => !flyoutsToRemove.has(f.flyoutId)\n );\n const newSessions = state.sessions.slice(0, targetSessionIndex + 1);\n\n return { ...state, sessions: newSessions, flyouts: newFlyouts };\n }\n\n // Set push padding offset for a specific side\n case ACTION_SET_PUSH_PADDING: {\n const { side, width } = action;\n return {\n ...state,\n pushPadding: {\n ...(state.pushPadding ?? { left: 0, right: 0 }),\n [side]: width,\n },\n };\n }\n\n // Store the container element for container-relative layout calculations.\n case ACTION_SET_CONTAINER_ELEMENT: {\n if (state.containerElement === action.element) {\n return state; // No-op if same element\n }\n return { ...state, containerElement: action.element };\n }\n\n case ACTION_SET_REFERENCE_WIDTH: {\n if (state.referenceWidth === action.width) {\n return state;\n }\n return { ...state, referenceWidth: action.width };\n }\n\n default:\n return state;\n }\n}\n"],"names":["initialState","sessions","flyouts","layoutMode","LAYOUT_MODE_SIDE_BY_SIDE","pushPadding","left","right","currentZIndex","unmanagedFlyouts","addSessionFlyoutsToRemove","session","flyoutsToRemove","add","mainFlyoutId","childFlyoutId","childHistory","forEach","e","flyoutId","moveHistoryGroupToTop","historyKey","groupSessions","otherSessions","push","flyoutManagerReducer","state","action","type","ACTION_ADD_UNMANAGED_FLYOUT","includes","ACTION_CLOSE_UNMANAGED_FLYOUT","newUnmanagedFlyouts","filter","newCurrentZIndex","length","ACTION_ADD","title","level","size","iconType","minWidth","isDuplicate","some","f","isIdempotentChild","LEVEL_CHILD","newFlyoutState","activityStage","STAGE_OPENING","newFlyouts","LEVEL_MAIN","newSession","zIndex","Symbol","updatedSessions","currentSessionIndex","currentSession","childTitle","childIconType","historyEntry","ACTION_CLOSE","removedFlyout","find","sessionToRemove","Set","entry","has","newSessions","owningSessionIndex","findIndex","owningSession","childIds","map","Boolean","undefined","ACTION_CLOSE_ALL","currentKey","s","ACTION_SET_ACTIVE","ACTION_SET_WIDTH","width","updatedFlyouts","flyout","ACTION_SET_PAGINATION","pagination","target","ACTION_SET_LAYOUT_MODE","ACTION_SET_ACTIVITY_STAGE","ACTION_GO_BACK","popped","newChildHistory","slice","sessionsWithoutCurrent","hasRemainingInCurrentGroup","ACTION_GO_TO_FLYOUT","targetIndex","targetEntry","targetSessionIndex","targetSession","sessionsAfterTargetInGroup","index","sessionsWithoutRemoved","removed","reorderedSessions","sessionsToClose","ACTION_SET_PUSH_PADDING","side","ACTION_SET_CONTAINER_ELEMENT","containerElement","element","ACTION_SET_REFERENCE_WIDTH","referenceWidth"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AAgCA;AACA;AACA;AACO,MAAMA,YAAmC,GAAG;AACjDC,EAAAA,QAAQ,EAAE,EAAE;AACZC,EAAAA,OAAO,EAAE,EAAE;AACXC,EAAAA,UAAU,EAAEC,wBAAwB;AACpCC,EAAAA,WAAW,EAAE;AAAEC,IAAAA,IAAI,EAAE,CAAC;AAAEC,IAAAA,KAAK,EAAE;GAAG;AAClCC,EAAAA,aAAa,EAAE,CAAC;AAChBC,EAAAA,gBAAgB,EAAE;AACpB;AAEA,MAAMC,yBAAyB,GAAGA,CAChCC,OAAsB,EACtBC,eAA4B,KACzB;AACHA,EAAAA,eAAe,CAACC,GAAG,CAACF,OAAO,CAACG,YAAY,CAAC;EACzC,IAAIH,OAAO,CAACI,aAAa,EAAE;AACzBH,IAAAA,eAAe,CAACC,GAAG,CAACF,OAAO,CAACI,aAAa,CAAC;AAC5C,EAAA;AACA,EAAA,CAACJ,OAAO,CAACK,YAAY,IAAI,EAAE,EAAEC,OAAO,CAAEC,CAAC,IAAKN,eAAe,CAACC,GAAG,CAACK,CAAC,CAACC,QAAQ,CAAC,CAAC;AAC9E,CAAC;AAED,MAAMC,qBAAqB,GAAGA,CAC5BnB,QAAyB,EACzBoB,UAAkB,KACE;EACpB,MAAMC,aAA8B,GAAG,EAAE;EACzC,MAAM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AA,WAAW,EAAE;YACX,IAAIqB,KAAK,CAACrB,WAAW,IAAI;AAAEC,cAAAA,IAAI,EAAE,CAAC;AAAEC,cAAAA,KAAK,EAAE;AAAE,aAAC,CAAC;AAC/C,YAAA,CAACoG,IAAI,GAAG1B;AACV;SACD;AACH,MAAA;;AAEA;AACA,IAAA,KAAK2B,4BAA4B;AAAE,MAAA;AACjC,QAAA,IAAIlF,KAAK,CAACmF,gBAAgB,KAAKlF,MAAM,CAACmF,OAAO,EAAE;UAC7C,OAAOpF,KAAK,CAAC;AACf,QAAA;QACA,OAAO;AAAE,UAAA,GAAGA,KAAK;UAAEmF,gBAAgB,EAAElF,MAAM,CAACmF;SAAS;AACvD,MAAA;AAEA,IAAA,KAAKC,0BAA0B;AAAE,MAAA;AAC/B,QAAA,IAAIrF,KAAK,CAACsF,cAAc,KAAKrF,MAAM,CAACsD,KAAK,EAAE;AACzC,UAAA,OAAOvD,KAAK;AACd,QAAA;QACA,OAAO;AAAE,UAAA,GAAGA,KAAK;UAAEsF,cAAc,EAAErF,MAAM,CAACsD;SAAO;AACnD,MAAA;AAEA,IAAA;AACE,MAAA,OAAOvD,KAAK;AAChB;AACF;;"}
|
package/dist/utils/eui/styles.js
CHANGED
|
@@ -33,6 +33,11 @@ function memoizedStyles(theme, factory) {
|
|
|
33
33
|
* interpolation (object, string, serialized styles), a theme function, or
|
|
34
34
|
* an array of those. Use it to style a migrated child instead of adding a
|
|
35
35
|
* second class, whose precedence would depend on rule insertion order.
|
|
36
|
+
*
|
|
37
|
+
* Keep values static: each distinct value adds rules that are never removed
|
|
38
|
+
* (Emotion is append-only, as upstream). Put values that change often
|
|
39
|
+
* (data- or animation-driven positions and sizes, per-item colors) in
|
|
40
|
+
* `style` instead.
|
|
36
41
|
*/
|
|
37
42
|
|
|
38
43
|
function hasFunction(style) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sources":["../../../src/utils/eui/styles.ts"],"sourcesContent":["import type { CSSInterpolation } from '@emotion/css/create-instance';\nimport type { EuiThemeContext } from '../emotion/context.ts';\nimport type { EuiBorealisContext } from './theme.ts';\n\ntype Factory = (theme: EuiBorealisContext) => unknown;\n\n/**\n * Factory output per resolved theme. `context.upstream` is `@cached`, so a\n * theme change yields a new object (and a fresh cache) while every consumer\n * of an unchanged theme shares one result. Mirrors upstream's\n * `useEuiMemoizedStyles`.\n */\nconst memo = new WeakMap<EuiBorealisContext, WeakMap<Factory, unknown>>();\n\n/** Factories receive the real computed upstream theme, without React hooks. */\nexport function useEuiBorealisStyles<T>(\n context: EuiThemeContext,\n factory: (theme: EuiBorealisContext) => T\n): T {\n return memoizedStyles(context.upstream, factory);\n}\n\n/** Same memoization for callers that already hold a resolved theme. */\nexport function memoizedStyles<T>(\n theme: EuiBorealisContext,\n factory: (theme: EuiBorealisContext) => T\n): T {\n let byFactory = memo.get(theme);\n if (!byFactory) memo.set(theme, (byFactory = new WeakMap()));\n if (!byFactory.has(factory)) byFactory.set(factory, factory(theme));\n return byFactory.get(factory) as T;\n}\n\n/**\n * A theme function: the counterpart of upstream's `css` prop callback,\n * `({ euiTheme, colorMode, highContrastMode }) => styles`. It receives the\n * nearest provider's resolved theme; its result is memoized per resolved\n * theme and function identity, so define it once (module scope or a\n * stable class field), not inline in a getter that re-runs.\n */\nexport type EuiCssFunction = (theme: EuiBorealisContext) => EuiCss;\n\n/**\n * Extra styles a caller composes into a migrated component's own class,\n * last — the Ember counterpart of upstream's `css` prop. An Emotion\n * interpolation (object, string, serialized styles), a theme function, or\n * an array of those. Use it to style a migrated child instead of adding a\n * second class, whose precedence would depend on rule insertion order.\n */\nexport type EuiCss =\n | CSSInterpolation\n | EuiCssFunction\n | readonly EuiCss[];\n\nfunction hasFunction(style: unknown): boolean {\n if (typeof style === 'function') return true;\n return Array.isArray(style) && style.some(hasFunction);\n}\n\nfunction resolveCss(\n theme: EuiBorealisContext,\n style: EuiCss\n): CSSInterpolation {\n if (typeof style === 'function')\n return resolveCss(theme, memoizedStyles(theme, style));\n if (Array.isArray(style) && style.some(hasFunction))\n return (style as readonly EuiCss[]).map((s) => resolveCss(theme, s));\n return style as CSSInterpolation;\n}\n\n/**\n * Resolve theme functions in `@css`-style values against a context's\n * theme. Only reads `context.upstream` (a tracked dependency) when a\n * function is present.\n */\nexport function resolveEuiCss(\n context: EuiThemeContext,\n style: EuiCss\n): CSSInterpolation {\n return hasFunction(style) ? resolveCss(context.upstream, style) : (style as CSSInterpolation);\n}\n\n/**\n * Compose serialized upstream styles into a class in the provider-owned\n * cache. Theme functions anywhere in `styles` (e.g. a caller's `@css`) are\n * resolved here against the context's theme, so every component that\n * composes `@css` through `euiClass` supports them.\n */\nexport function euiClass(context: EuiThemeContext, ...styles: EuiCss[]): string {\n return context.cache.css(resolveEuiCss(context, styles));\n}\n"],"names":["memo","WeakMap","useEuiBorealisStyles","context","factory","memoizedStyles","upstream","theme","byFactory","get","set","has","hasFunction","style","Array","isArray","some","resolveCss","map","s","resolveEuiCss","euiClass","styles","cache","css"],"mappings":"AAMA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,IAAI,GAAG,IAAIC,OAAO,EAAiD;;AAEzE;AACO,SAASC,oBAAoBA,CAClCC,OAAwB,EACxBC,OAAyC,EACtC;AACH,EAAA,OAAOC,cAAc,CAACF,OAAO,CAACG,QAAQ,EAAEF,OAAO,CAAC;AAClD;;AAEA;AACO,SAASC,cAAcA,CAC5BE,KAAyB,EACzBH,OAAyC,EACtC;AACH,EAAA,IAAII,SAAS,GAAGR,IAAI,CAACS,GAAG,CAACF,KAAK,CAAC;AAC/B,EAAA,IAAI,CAACC,SAAS,EAAER,IAAI,CAACU,GAAG,CAACH,KAAK,EAAGC,SAAS,GAAG,IAAIP,OAAO,EAAG,CAAC;AAC5D,EAAA,IAAI,CAACO,SAAS,CAACG,GAAG,CAACP,OAAO,CAAC,EAAEI,SAAS,CAACE,GAAG,CAACN,OAAO,EAAEA,OAAO,CAACG,KAAK,CAAC,CAAC;AACnE,EAAA,OAAOC,SAAS,CAACC,GAAG,CAACL,OAAO,CAAC;AAC/B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,SAASQ,WAAWA,CAACC,KAAc,EAAW;AAC5C,EAAA,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE,OAAO,IAAI;AAC5C,EAAA,OAAOC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,IAAIA,KAAK,CAACG,IAAI,CAACJ,WAAW,CAAC;AACxD;AAEA,SAASK,UAAUA,CACjBV,KAAyB,EACzBM,KAAa,EACK;AAClB,EAAA,IAAI,OAAOA,KAAK,KAAK,UAAU,EAC7B,OAAOI,UAAU,CAACV,KAAK,EAAEF,cAAc,CAACE,KAAK,EAAEM,KAAK,CAAC,CAAC;EACxD,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,IAAIA,KAAK,CAACG,IAAI,CAACJ,WAAW,CAAC,EACjD,OAAQC,KAAK,CAAuBK,GAAG,CAAEC,CAAC,IAAKF,UAAU,CAACV,KAAK,EAAEY,CAAC,CAAC,CAAC;AACtE,EAAA,OAAON,KAAK;AACd;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASO,aAAaA,CAC3BjB,OAAwB,EACxBU,KAAa,EACK;AAClB,EAAA,OAAOD,WAAW,CAACC,KAAK,CAAC,GAAGI,UAAU,CAACd,OAAO,CAACG,QAAQ,EAAEO,KAAK,CAAC,GAAIA,KAA0B;AAC/F;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASQ,QAAQA,CAAClB,OAAwB,EAAE,GAAGmB,MAAgB,EAAU;AAC9E,EAAA,OAAOnB,OAAO,CAACoB,KAAK,CAACC,GAAG,CAACJ,aAAa,CAACjB,OAAO,EAAEmB,MAAM,CAAC,CAAC;AAC1D;;"}
|
|
1
|
+
{"version":3,"file":"styles.js","sources":["../../../src/utils/eui/styles.ts"],"sourcesContent":["import type { CSSInterpolation } from '@emotion/css/create-instance';\nimport type { EuiThemeContext } from '../emotion/context.ts';\nimport type { EuiBorealisContext } from './theme.ts';\n\ntype Factory = (theme: EuiBorealisContext) => unknown;\n\n/**\n * Factory output per resolved theme. `context.upstream` is `@cached`, so a\n * theme change yields a new object (and a fresh cache) while every consumer\n * of an unchanged theme shares one result. Mirrors upstream's\n * `useEuiMemoizedStyles`.\n */\nconst memo = new WeakMap<EuiBorealisContext, WeakMap<Factory, unknown>>();\n\n/** Factories receive the real computed upstream theme, without React hooks. */\nexport function useEuiBorealisStyles<T>(\n context: EuiThemeContext,\n factory: (theme: EuiBorealisContext) => T\n): T {\n return memoizedStyles(context.upstream, factory);\n}\n\n/** Same memoization for callers that already hold a resolved theme. */\nexport function memoizedStyles<T>(\n theme: EuiBorealisContext,\n factory: (theme: EuiBorealisContext) => T\n): T {\n let byFactory = memo.get(theme);\n if (!byFactory) memo.set(theme, (byFactory = new WeakMap()));\n if (!byFactory.has(factory)) byFactory.set(factory, factory(theme));\n return byFactory.get(factory) as T;\n}\n\n/**\n * A theme function: the counterpart of upstream's `css` prop callback,\n * `({ euiTheme, colorMode, highContrastMode }) => styles`. It receives the\n * nearest provider's resolved theme; its result is memoized per resolved\n * theme and function identity, so define it once (module scope or a\n * stable class field), not inline in a getter that re-runs.\n */\nexport type EuiCssFunction = (theme: EuiBorealisContext) => EuiCss;\n\n/**\n * Extra styles a caller composes into a migrated component's own class,\n * last — the Ember counterpart of upstream's `css` prop. An Emotion\n * interpolation (object, string, serialized styles), a theme function, or\n * an array of those. Use it to style a migrated child instead of adding a\n * second class, whose precedence would depend on rule insertion order.\n *\n * Keep values static: each distinct value adds rules that are never removed\n * (Emotion is append-only, as upstream). Put values that change often\n * (data- or animation-driven positions and sizes, per-item colors) in\n * `style` instead.\n */\nexport type EuiCss =\n | CSSInterpolation\n | EuiCssFunction\n | readonly EuiCss[];\n\nfunction hasFunction(style: unknown): boolean {\n if (typeof style === 'function') return true;\n return Array.isArray(style) && style.some(hasFunction);\n}\n\nfunction resolveCss(\n theme: EuiBorealisContext,\n style: EuiCss\n): CSSInterpolation {\n if (typeof style === 'function')\n return resolveCss(theme, memoizedStyles(theme, style));\n if (Array.isArray(style) && style.some(hasFunction))\n return (style as readonly EuiCss[]).map((s) => resolveCss(theme, s));\n return style as CSSInterpolation;\n}\n\n/**\n * Resolve theme functions in `@css`-style values against a context's\n * theme. Only reads `context.upstream` (a tracked dependency) when a\n * function is present.\n */\nexport function resolveEuiCss(\n context: EuiThemeContext,\n style: EuiCss\n): CSSInterpolation {\n return hasFunction(style) ? resolveCss(context.upstream, style) : (style as CSSInterpolation);\n}\n\n/**\n * Compose serialized upstream styles into a class in the provider-owned\n * cache. Theme functions anywhere in `styles` (e.g. a caller's `@css`) are\n * resolved here against the context's theme, so every component that\n * composes `@css` through `euiClass` supports them.\n */\nexport function euiClass(context: EuiThemeContext, ...styles: EuiCss[]): string {\n return context.cache.css(resolveEuiCss(context, styles));\n}\n"],"names":["memo","WeakMap","useEuiBorealisStyles","context","factory","memoizedStyles","upstream","theme","byFactory","get","set","has","hasFunction","style","Array","isArray","some","resolveCss","map","s","resolveEuiCss","euiClass","styles","cache","css"],"mappings":"AAMA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,IAAI,GAAG,IAAIC,OAAO,EAAiD;;AAEzE;AACO,SAASC,oBAAoBA,CAClCC,OAAwB,EACxBC,OAAyC,EACtC;AACH,EAAA,OAAOC,cAAc,CAACF,OAAO,CAACG,QAAQ,EAAEF,OAAO,CAAC;AAClD;;AAEA;AACO,SAASC,cAAcA,CAC5BE,KAAyB,EACzBH,OAAyC,EACtC;AACH,EAAA,IAAII,SAAS,GAAGR,IAAI,CAACS,GAAG,CAACF,KAAK,CAAC;AAC/B,EAAA,IAAI,CAACC,SAAS,EAAER,IAAI,CAACU,GAAG,CAACH,KAAK,EAAGC,SAAS,GAAG,IAAIP,OAAO,EAAG,CAAC;AAC5D,EAAA,IAAI,CAACO,SAAS,CAACG,GAAG,CAACP,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