| 1 |
import { useSSRSafeId } from '../useSSRSafeId'; |
| 2 |
const ouiaPrefix = 'OUIA-Generated-'; |
| 3 |
/** |
| 4 |
* Provides SSR/Strict-Mode-safe IDs for class components via render props. |
| 5 |
* Uses useSSRSafeId() (React.useId) for both component ID and OUIA ID, |
| 6 |
* ensuring consistent values between server and client rendering. |
| 7 |
*/ |
| 8 |
export const SSRSafeIds = ({ prefix, ouiaComponentType, children }) => { |
| 9 |
var _a; |
| 10 |
const id = useSSRSafeId(prefix); |
| 11 |
const ouiaId = useSSRSafeId(ouiaComponentType ? `${ouiaPrefix}${ouiaComponentType}-` : 'pf-unused-'); |
| 12 |
return (_a = children(id, ouiaComponentType ? ouiaId : undefined)) !== null && _a !== void 0 ? _a : null; |
| 13 |
}; |
| 14 |
SSRSafeIds.displayName = 'SSRSafeIds'; |
| 15 |
//# sourceMappingURL=SSRSafeIds.js.map |