From 509f772edc8d4b540392db1c993374ad39c6e368 Mon Sep 17 00:00:00 2001 From: melloware Date: Fri, 29 Dec 2023 16:55:27 -0500 Subject: [PATCH] Fix #5652: Ripple set deprecated static when context is changed --- components/doc/confirmpopup/headlessdoc.js | 27 +++++++++++++++---- components/doc/dropdown/editabledoc.js | 1 - components/lib/api/PrimeReact.js | 3 +++ components/lib/api/PrimeReactContext.js | 22 +++++++++++++++ .../lib/confirmdialog/confirmdialog.d.ts | 2 -- components/lib/dialog/dialog.d.ts | 1 - components/lib/panel/Panel.js | 1 - components/lib/toast/toast.d.ts | 1 - 8 files changed, 47 insertions(+), 11 deletions(-) diff --git a/components/doc/confirmpopup/headlessdoc.js b/components/doc/confirmpopup/headlessdoc.js index 1547100258..7cc73487b6 100644 --- a/components/doc/confirmpopup/headlessdoc.js +++ b/components/doc/confirmpopup/headlessdoc.js @@ -20,7 +20,7 @@ export function HeadlessDoc(props) { confirmPopup({ group: 'headless', target: event.currentTarget, - message: 'Are you sure you want to proceed?', + message: 'Are you sure you want to proceed?', icon: 'pi pi-exclamation-triangle', defaultFocus: 'accept', accept, @@ -204,15 +204,32 @@ export default function HeadlessDemo() { + content={({ message, acceptBtnRef, rejectBtnRef, hide }) => (
{message}
- - + +
- } + )} />
diff --git a/components/doc/dropdown/editabledoc.js b/components/doc/dropdown/editabledoc.js index 18379d7c63..901771ced8 100644 --- a/components/doc/dropdown/editabledoc.js +++ b/components/doc/dropdown/editabledoc.js @@ -13,7 +13,6 @@ export function EditableDoc(props) { { name: 'Paris', code: 'PRS' } ]; - const code = { basic: ` setSelectedCity(e.value)} options={cities} optionLabel="name" diff --git a/components/lib/api/PrimeReact.js b/components/lib/api/PrimeReact.js index 72f3758c41..7e2a9f8eac 100644 --- a/components/lib/api/PrimeReact.js +++ b/components/lib/api/PrimeReact.js @@ -1,5 +1,8 @@ import { FilterMatchMode } from './FilterMatchMode'; +/** + * @deprecated please use PrimeReactContext + */ export default class PrimeReact { static ripple = false; diff --git a/components/lib/api/PrimeReactContext.js b/components/lib/api/PrimeReactContext.js index f04439bc28..35eb21722b 100644 --- a/components/lib/api/PrimeReactContext.js +++ b/components/lib/api/PrimeReactContext.js @@ -1,5 +1,6 @@ import React, { useState } from 'react'; import { FilterMatchMode } from './FilterMatchMode'; +import PrimeReact from './PrimeReact'; export const PrimeReactContext = React.createContext(); @@ -58,6 +59,27 @@ export const PrimeReactProvider = (props) => { linkElement.parentNode?.insertBefore(cloneLinkElement, linkElement.nextSibling); }; + /** + * @deprecated + */ + React.useEffect(() => { + PrimeReact.ripple = ripple; + }, [ripple]); + + /** + * @deprecated + */ + React.useEffect(() => { + PrimeReact.inputStyle = inputStyle; + }, [inputStyle]); + + /** + * @deprecated + */ + React.useEffect(() => { + PrimeReact.locale = locale; + }, [locale]); + const value = { changeTheme, ripple, diff --git a/components/lib/confirmdialog/confirmdialog.d.ts b/components/lib/confirmdialog/confirmdialog.d.ts index 13100008f6..dc816566f8 100644 --- a/components/lib/confirmdialog/confirmdialog.d.ts +++ b/components/lib/confirmdialog/confirmdialog.d.ts @@ -157,7 +157,6 @@ interface ConfirmDialogOptions { [key: string]: any; } - /** * Defines valid properties in ConfirmDialog component. In addition to these, all properties of {@link dialog} can be used in this component. * @group Properties @@ -256,7 +255,6 @@ export interface ConfirmDialogProps extends Omit { return null; }; - const createFooter = () => { const footer = ObjectUtils.getJSXElement(props.footer, props); diff --git a/components/lib/toast/toast.d.ts b/components/lib/toast/toast.d.ts index 5dcb3e01f4..4b7568065a 100644 --- a/components/lib/toast/toast.d.ts +++ b/components/lib/toast/toast.d.ts @@ -244,7 +244,6 @@ interface ContentProps { message: ContentPropsMessage; } - /** * Defines valid properties in Toast component. In addition to these, all properties of HTMLDivElement can be used in this component. * @group Properties