Skip to content

Commit 2aba142

Browse files
authored
fix(chrome): provide missing useId container dependency for Sheet component (#1981)
1 parent 2c2c590 commit 2aba142

File tree

4 files changed

+113
-4
lines changed

4 files changed

+113
-4
lines changed

package-lock.json

Lines changed: 108 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/chrome/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"sideEffects": false,
2222
"types": "dist/typings/index.d.ts",
2323
"dependencies": {
24+
"@zendeskgarden/container-utilities": "^2.0.0",
2425
"@zendeskgarden/react-buttons": "^9.2.0",
2526
"dom-helpers": "^5.2.1",
2627
"polished": "^4.3.1",

packages/chrome/src/elements/sheet/Sheet.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import React, { useRef, useMemo, useState } from 'react';
99
import PropTypes from 'prop-types';
10-
import { useUIDSeed } from 'react-uid';
10+
import { useId } from '@zendeskgarden/container-utilities';
1111
import { mergeRefs } from 'react-merge-refs';
1212

1313
import { ISheetProps, PLACEMENT } from '../../types';
@@ -29,10 +29,8 @@ const SheetComponent = React.forwardRef<HTMLElement, ISheetProps>(
2929
ref
3030
) => {
3131
const sheetRef = useRef<HTMLElement>(null);
32-
33-
const seed = useUIDSeed();
3432
const [isCloseButtonPresent, setIsCloseButtonPresent] = useState<boolean>(false);
35-
const idPrefix = useMemo<string>(() => id || seed(`sheet_${PACKAGE_VERSION}`), [id, seed]);
33+
const idPrefix = useId(id);
3634
const titleId = `${idPrefix}--title`;
3735
const descriptionId = `${idPrefix}--description`;
3836

packages/chrome/src/types/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ export interface INavItemTextProps extends HTMLAttributes<HTMLSpanElement> {
8585
}
8686

8787
export interface ISheetProps extends HTMLAttributes<HTMLElement> {
88+
/** Identifies the sheet */
89+
id?: string;
8890
/** Opens the sheet */
8991
isOpen?: boolean;
9092
/** Determines whether animation for opening and closing the sheet is used */

0 commit comments

Comments
 (0)