Skip to content

Commit ab5b8e2

Browse files
committed
fix: adss unique-id polyfill to enable ember 4.4
1 parent cbc38bc commit ab5b8e2

File tree

15 files changed

+39
-49
lines changed

15 files changed

+39
-49
lines changed

packages/changeset-form/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"ember-cli-typescript": "4.2.1",
3939
"ember-composable-helpers": "^4.4.1",
4040
"ember-named-blocks-polyfill": "^0.2.3",
41-
"ember-svg-jar": "^2.3.4"
41+
"ember-svg-jar": "^2.3.4",
42+
"ember-unique-id-helper-polyfill": "^1.2.2"
4243
},
4344
"devDependencies": {
4445
"@ember/optional-features": "^2.0.0",

packages/core/addon/components/eui-dual-range/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Component from '@glimmer/component';
22
import { action } from '@ember/object';
33
import { tracked } from '@glimmer/tracking';
4-
import { uniqueId } from '../../helpers/unique-id';
4+
import { guidFor } from '@ember/object/internals';
55
import { isWithinRange } from '../../utils/number';
66

77
import { EuiRangeInputArgs } from '../eui-range-input/types';
@@ -87,7 +87,7 @@ export default class EuiDualRangeComponent extends Component<EuiDualRangeArgs> {
8787
@argOrDefault([]) levels!: EuiRangeLevel[];
8888

8989
//State
90-
@tracked id: string = this.args.id || uniqueId();
90+
@tracked id: string = this.args.id || guidFor({});
9191
@tracked hasFocus = false;
9292
@tracked rangeSliderRefAvailable = false;
9393
@tracked isPopoverOpen = false;

packages/core/addon/components/eui-icon/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
colorToClassMap,
77
typeToPathMap
88
} from '../../utils/css-mappings/eui-icon';
9-
import { uniqueId } from '../../helpers/unique-id';
9+
import { guidFor } from '@ember/object/internals';
1010
import { htmlSafe } from '@ember/template';
1111
import { getOwner } from '@ember/application';
1212

@@ -178,7 +178,7 @@ export default class EuiIcon extends Component<EuiIconArgs> {
178178
// The svg aria-labelledby attribute gets this titleId
179179
// The svg title element gets this titleId as an id
180180
if (!this.args['aria-label'] && !this.args['aria-labelledby'] && title) {
181-
titleId = uniqueId();
181+
titleId = guidFor({});
182182
}
183183
return titleId;
184184
}

packages/core/addon/components/eui-markdown-editor/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
defaultParsingPlugins,
1212
defaultProcessingPlugins
1313
} from '../../utils/markdown/plugins/markdown-default-plugins';
14-
import { uniqueId } from '../../helpers/unique-id';
14+
import { guidFor } from '@ember/object/internals';
1515
import unified from 'unified';
1616
import * as MarkdownTooltipPlugin from '../../utils/markdown/plugins/markdown-tooltip';
1717
import {
@@ -121,7 +121,7 @@ export default class EuiMarkdownEditorComponent extends Component<EuiMarkdownEdi
121121
declare processingPluginList: typeof defaultProcessingPlugins;
122122

123123
@tracked selectedNode: Node | null = null;
124-
@tracked editorId = this.args.editorId ?? uniqueId();
124+
@tracked editorId = this.args.editorId ?? guidFor({});
125125
@tracked viewMode = this.args.initialViewMode || MODE_EDITING;
126126
@tracked textareaRef: HTMLTextAreaElement | null = null;
127127
@tracked previewRef: HTMLDivElement | null = null;

packages/core/addon/components/eui-portal/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Component from '@glimmer/component';
22
import { tracked } from '@glimmer/tracking';
3-
import { uniqueId } from '../../helpers/unique-id';
3+
import { guidFor } from '@ember/object/internals';
44
import { keysOf } from '../common';
55

66
interface InsertPositionsMap {
@@ -32,7 +32,7 @@ export default class EuiPortal extends Component<EuiPortalArgs> {
3232
const { insert } = this.args;
3333

3434
this.portalNode = document.createElement('div');
35-
this.portalNode.id = `${uniqueId()}-portal`;
35+
this.portalNode.id = `${guidFor({})}-portal`;
3636

3737
if (insert == null) {
3838
// no insertion defined, append to body

packages/core/addon/components/eui-range/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Component from '@glimmer/component';
22
import { action } from '@ember/object';
33
import { tracked } from '@glimmer/tracking';
4-
import { uniqueId } from '../../helpers/unique-id';
4+
import { guidFor } from '@ember/object/internals';
55
import { isWithinRange } from '../../utils/number';
66
import { EuiRangeInputArgs } from '../eui-range-input/types';
77
import { EuiRangeLevel } from '../eui-range-levels';
@@ -81,7 +81,7 @@ export default class EuiRangeComponent extends Component<EuiRangeArgs> {
8181
preventPopoverClose = false;
8282

8383
//State
84-
@tracked id: string = this.args.id || uniqueId();
84+
@tracked id: string = this.args.id || guidFor({});
8585
@tracked isPopoverOpen = false;
8686
///
8787

packages/core/addon/components/eui-tool-tip/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import Component from '@glimmer/component';
22
import { action } from '@ember/object';
33
import { argOrDefaultDecorator as argOrDefault } from '../../helpers/arg-or-default';
4-
import { uniqueId } from '../../helpers/unique-id';
54
import { tracked, cached } from '@glimmer/tracking';
65
import { findPopoverPosition } from '../../utils/popover';
76
import { keys } from '../../utils/keys';
87
import { later, cancel, scheduleOnce, next } from '@ember/runloop';
8+
import { guidFor } from '@ember/object/internals';
99

1010
export type ToolTipPositions = 'top' | 'right' | 'bottom' | 'left';
1111

@@ -104,7 +104,7 @@ export default class EuiToolTip extends Component<EuiTooltipArgs> {
104104
@tracked calculatedPosition: ToolTipPositions = this.position;
105105
@tracked toolTipStyles: ToolTipStyles = DEFAULT_TOOLTIP_STYLES;
106106
@tracked arrowStyles: undefined | { left: string; top: string };
107-
@tracked id: string = this.args.id || uniqueId();
107+
@tracked id: string = this.args.id || guidFor({});
108108
@tracked _attachTo: undefined | HTMLElement | string | null = null;
109109

110110
private timeoutId?: ReturnType<typeof later>;

packages/core/addon/helpers/unique-id.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

packages/core/addon/modifiers/outside-click-detector.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Modifier from 'ember-modifier';
2-
import { uniqueId } from '../helpers/unique-id';
2+
import { guidFor } from '@ember/object/internals';
33
import { action } from '@ember/object';
44

55
interface OutsideClickDetectorModifierArgs {
@@ -46,7 +46,7 @@ export default class OutsideClickDetector extends Modifier<OutsideClickDetectorM
4646
}
4747

4848
didInstall(): void {
49-
this.id = uniqueId();
49+
this.id = guidFor({});
5050
document.addEventListener('mouseup', this.onClickOutside);
5151
document.addEventListener('touchend', this.onClickOutside);
5252
this.addElementEvents();

packages/core/app/helpers/unique-id.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)