From 710c5f3db00fca956dec3de4e4ef8b7a53ccc7c3 Mon Sep 17 00:00:00 2001 From: melloware Date: Tue, 9 Jan 2024 13:23:19 -0500 Subject: [PATCH] Fix #5461: Passthrough case insensitve props --- components/lib/componentbase/ComponentBase.js | 12 ++++++------ components/lib/confirmdialog/confirmdialog.d.ts | 9 +++++++-- components/lib/passthrough/tailwind/index.js | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/components/lib/componentbase/ComponentBase.js b/components/lib/componentbase/ComponentBase.js index 8960da8bcd..c6b937fb28 100644 --- a/components/lib/componentbase/ComponentBase.js +++ b/components/lib/componentbase/ComponentBase.js @@ -497,13 +497,13 @@ export const ComponentBase = { obj = obj.pt; } + const originalkey = ObjectUtils.toFlatCase(key); const hostName = params.hostName && ObjectUtils.toFlatCase(params.hostName); const componentName = hostName || (params.props && params.props.__TYPE && ObjectUtils.toFlatCase(params.props.__TYPE)) || ''; - const isNestedParam = /./g.test(key) && !!params[key.split('.')[0]]; - const isTransition = key === 'transition' || (/./g.test(key) && !!(key.split('.')[1] === 'transition')); - + const isNestedParam = /./g.test(originalkey) && !!params[originalkey.split('.')[0]]; + const isTransition = fkey === 'transition' || (/./g.test(originalkey) && !!(originalkey.split('.')[1] === 'transition')); const datasetPrefix = 'data-pc-'; - const fkey = isNestedParam ? ObjectUtils.toFlatCase(key.split('.')[1]) : ObjectUtils.toFlatCase(key); + const fkey = isNestedParam ? ObjectUtils.toFlatCase(originalkey.split('.')[1]) : originalkey; const getHostInstance = (params) => { return params?.props ? (params.hostName ? (params.props.__TYPE === params.hostName ? params.props : getHostInstance(params.parent)) : params.parent) : undefined; @@ -523,8 +523,8 @@ export const ComponentBase = { return ObjectUtils.isString(value) ? { className: value } : value; }; - const globalPT = searchInDefaultPT ? (isNestedParam ? _useGlobalPT(getPTClassValue, key, params) : _useDefaultPT(getPTClassValue, key, params)) : undefined; - const self = isNestedParam ? undefined : _usePT(_getPT(obj, componentName), getPTClassValue, key, params, componentName); + const globalPT = searchInDefaultPT ? (isNestedParam ? _useGlobalPT(getPTClassValue, originalkey, params) : _useDefaultPT(getPTClassValue, originalkey, params)) : undefined; + const self = isNestedParam ? undefined : _usePT(_getPT(obj, componentName), getPTClassValue, originalkey, params, componentName); const datasetProps = !isTransition && { ...(fkey === 'root' && { [`${datasetPrefix}name`]: params.props && params.props.__parentMetadata ? ObjectUtils.toFlatCase(params.props.__TYPE) : componentName }), diff --git a/components/lib/confirmdialog/confirmdialog.d.ts b/components/lib/confirmdialog/confirmdialog.d.ts index 6bcc869966..a10e6ef8f6 100644 --- a/components/lib/confirmdialog/confirmdialog.d.ts +++ b/components/lib/confirmdialog/confirmdialog.d.ts @@ -14,12 +14,13 @@ import { DialogProps } from '../dialog'; import { PassThroughOptions } from '../passthrough'; import { IconType, PassThroughType } from '../utils'; -export declare type ConfirmDialogPassThroughType = PassThroughType; +export declare type ConfirmDialogPassThroughType = PassThroughType; +export declare type ConfirmDialogPassThroughTransitionType = ReactCSSTransitionProps | ((options: ConfirmDialogPassThroughMethodOptions) => ReactCSSTransitionProps) | undefined; /** * Custom passthrough(pt) option method. */ -export interface ConfirmDialogThroughMethodOptions { +export interface ConfirmDialogPassThroughMethodOptions { props: ConfirmDialogProps; state: ConfirmDialogState; } @@ -84,6 +85,10 @@ export interface ConfirmDialogPassThroughOptions { * @see {@link ComponentHooks} */ hooks?: ComponentHooks; + /** + * Used to control React Transition API. + */ + transition?: ConfirmDialogPassThroughTransitionType; } /** diff --git a/components/lib/passthrough/tailwind/index.js b/components/lib/passthrough/tailwind/index.js index 5741c85b8f..5b5d8b9ddb 100644 --- a/components/lib/passthrough/tailwind/index.js +++ b/components/lib/passthrough/tailwind/index.js @@ -886,7 +886,7 @@ const Tailwind = { 'cursor-default': props.readOnly }, { - 'outline-none outline-offset-0 shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)]': context.focused + 'outline-none outline-offset-0 shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)]': context.active } ) }),