-
+
+
{!props.filter && }
);
diff --git a/components/lib/multiselect/MultiSelectItem.js b/components/lib/multiselect/MultiSelectItem.js
index 9339c8694b..1ee1abe6f2 100644
--- a/components/lib/multiselect/MultiSelectItem.js
+++ b/components/lib/multiselect/MultiSelectItem.js
@@ -4,17 +4,28 @@ import { Ripple } from '../ripple/Ripple';
import { IconUtils, ObjectUtils, classNames, mergeProps } from '../utils/Utils';
export const MultiSelectItem = React.memo((props) => {
+ const [focusedState, setFocusedState] = React.useState(false);
const { ptm, cx } = props;
const getPTOptions = (key) => {
return ptm(key, {
hostName: props.hostName,
context: {
- selected: props.selected
+ selected: props.selected,
+ disabled: props.disabled,
+ focused: focusedState
}
});
};
+ const onFocus = (event) => {
+ setFocusedState(true);
+ };
+
+ const onBlur = (event) => {
+ setFocusedState(false);
+ };
+
const onClick = (event) => {
if (props.onClick) {
props.onClick({
@@ -69,8 +80,10 @@ export const MultiSelectItem = React.memo((props) => {
className: classNames(props.className, props.option.className, cx('item', { itemProps: props })),
style: props.style,
onClick: onClick,
- tabIndex: tabIndex,
onKeyDown: onKeyDown,
+ onFocus: onFocus,
+ onBlur: onBlur,
+ tabIndex: tabIndex,
role: 'option',
'aria-selected': props.selected,
'data-p-highlight': props.selected,
diff --git a/components/lib/multiselect/multiselect.d.ts b/components/lib/multiselect/multiselect.d.ts
index 273b31037e..6280c61553 100644
--- a/components/lib/multiselect/multiselect.d.ts
+++ b/components/lib/multiselect/multiselect.d.ts
@@ -92,6 +92,10 @@ export interface MultiSelectPassThroughOptions {
* Uses to pass attributes to the header checkbox's DOM element.
*/
headerCheckbox?: CheckboxPassThroughOptions;
+ /**
+ * Uses to pass attributes to the header checkbox's container DOM element.
+ */
+ headerCheckboxContainer?: MultiSelectPassThroughType
>;
/**
* Uses to pass attributes to the header checkbox icon's DOM element.
*/
diff --git a/components/lib/passthrough/tailwind/index.js b/components/lib/passthrough/tailwind/index.js
index f8c4179374..8676c40446 100644
--- a/components/lib/passthrough/tailwind/index.js
+++ b/components/lib/passthrough/tailwind/index.js
@@ -396,6 +396,7 @@ const Tailwind = {
'dark:border dark:border-blue-900/40 dark:bg-gray-900 dark:text-white/80'
)
},
+ closeButton: 'flex items-center justify-center overflow-hidden absolute top-0 right-0 w-6 h-6',
content: 'p-5 items-center flex',
transition: TRANSITIONS.overlay
},
@@ -492,10 +493,10 @@ const Tailwind = {
},
arrow: ({ context }) => ({
className: classNames('absolute w-0 h-0 border-transparent border-solid', {
- '-m-t-1 border-y-[0.25rem] border-r-[0.25rem] border-l-0 border-r-gray-600': context.right,
- '-m-t-1 border-y-[0.25rem] border-l-[0.25rem] border-r-0 border-l-gray-600': context.left,
- '-m-l-1 border-x-[0.25rem] border-t-[0.25rem] border-b-0 border-t-gray-600': context.top,
- '-m-l-1 border-x-[0.25rem] border-b-[0.25rem] border-t-0 border-b-gray-600': context.bottom
+ '-mt-1 border-y-[0.25rem] border-r-[0.25rem] border-l-0 border-r-gray-600': context.right,
+ '-mt-1 border-y-[0.25rem] border-l-[0.25rem] border-r-0 border-l-gray-600': context.left,
+ '-ml-1 border-x-[0.25rem] border-t-[0.25rem] border-b-0 border-t-gray-600': context.top,
+ '-ml-1 border-x-[0.25rem] border-b-[0.25rem] border-t-0 border-b-gray-600': context.bottom
})
}),
text: {
@@ -697,6 +698,14 @@ const Tailwind = {
'mt-2 order-2': props.iconPos == 'bottom' && props.label != null
})
}),
+ loadingIcon: ({ props }) => ({
+ className: classNames('mx-0', {
+ 'mr-2': props.loading && props.iconPos == 'left' && props.label != null,
+ 'ml-2 order-1': props.loading && props.iconPos == 'right' && props.label != null,
+ 'mb-2': props.loading && props.iconPos == 'top' && props.label != null,
+ 'mt-2 order-2': props.loading && props.iconPos == 'bottom' && props.label != null
+ })
+ }),
badge: ({ props }) => ({
className: classNames({ 'ml-2 w-4 h-4 leading-none flex items-center justify-center': props.badge })
})
@@ -845,13 +854,12 @@ const Tailwind = {
sublist: {
className: classNames('block absolute left-full top-0', 'min-w-full z-10', 'py-3 bg-white dark:bg-gray-900 border-0 shadow-md')
},
- item: {
- className: classNames(
- 'cursor-pointer font-normal whitespace-nowrap',
- 'm-0 border-0 bg-transparent transition-shadow rounded-none',
- 'text-gray-700 dark:text-white/80 hover:text-gray-700 dark:hover:text-white/80 hover:bg-gray-200 dark:hover:bg-gray-800/80'
- )
- },
+ item: ({ state }) => ({
+ className: classNames('cursor-pointer font-normal whitespace-nowrap', 'm-0 border-0 bg-transparent transition-shadow rounded-none', {
+ 'text-gray-700 hover:text-gray-700 hover:bg-gray-200 dark:text-white/80 dark:hover:text-white/80 dark:hover:bg-gray-800/80': !state.selected,
+ 'bg-blue-50 text-blue-700 dark:bg-blue-300 dark:text-white/80': state.selected
+ })
+ }),
content: {
className: classNames('flex items-center overflow-hidden relative', 'py-3 px-5')
},
@@ -974,14 +982,14 @@ const Tailwind = {
transition: TRANSITIONS.overlay
},
togglebutton: {
- root: ({ props, context }) => ({
+ root: ({ props, state }) => ({
className: classNames(
'inline-flex cursor-pointer select-none items-center align-bottom text-center overflow-hidden relative',
'px-4 py-3 rounded-md text-base w-36',
'border transition duration-200 ease-in-out',
- // {
- // '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)]': state.focused
+ },
{
'bg-white dark:bg-gray-900 border-gray-300 dark:border-blue-900/40 text-gray-700 dark:text-white/80 hover:bg-gray-100 dark:hover:bg-gray-800/80 hover:border-gray-300 dark:hover:bg-gray-800/70 hover:text-gray-700 dark:hover:text-white/80':
!props.checked,
@@ -1254,14 +1262,14 @@ const Tailwind = {
'bg-blue-50 text-blue-700 dark:bg-blue-300 dark:text-white/80': !context.focused && context.selected
})
}),
- itemgroup: {
+ itemGroup: {
className: classNames('m-0 p-3 text-gray-800 bg-white font-bold', 'dark:bg-gray-900 dark:text-white/80', 'cursor-auto')
},
header: {
className: classNames('p-3 border-b border-gray-300 text-gray-700 bg-gray-100 mt-0 rounded-tl-lg rounded-tr-lg', 'dark:bg-gray-800 dark:text-white/80 dark:border-blue-900/40')
},
- filtercontainer: 'relative',
- filterinput: {
+ filterContainer: 'relative',
+ filterInput: {
root: {
className: classNames(
'pr-7 -mr-7',
@@ -1272,7 +1280,7 @@ const Tailwind = {
)
}
},
- filtericon: '-mt-2 absolute top-1/2'
+ filterIcon: '-mt-2 absolute top-1/2'
},
mention: {
root: 'relative',
@@ -1310,18 +1318,20 @@ const Tailwind = {
headerCheckboxContainer: {
className: classNames('inline-flex cursor-pointer select-none align-bottom relative', 'mr-2', 'w-6 h-6')
},
- headerCheckbox: ({ context }) => ({
- className: classNames(
- 'flex items-center justify-center',
- 'border-2 w-6 h-6 text-gray-600 dark:text-white/70 rounded-lg transition-colors duration-200',
- 'hover:border-blue-500 focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)]',
- {
- 'border-gray-300 dark:border-blue-900/40 bg-white dark:bg-gray-900': !context?.selected,
- 'border-blue-500 bg-blue-500': context?.selected
- }
- )
- }),
- headercheckboxicon: 'w-4 h-4 transition-all duration-200 text-white text-base',
+ headerCheckbox: {
+ root: ({ props }) => ({
+ className: classNames(
+ 'flex items-center justify-center',
+ 'border-2 w-6 h-6 text-gray-600 dark:text-white/70 rounded-lg transition-colors duration-200',
+ 'hover:border-blue-500 focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)]',
+ {
+ 'border-gray-300 dark:border-blue-900/40 bg-white dark:bg-gray-900': !props?.checked,
+ 'border-blue-500 bg-blue-500': props?.checked
+ }
+ )
+ })
+ },
+ headerCheckboxIcon: 'w-4 h-4 transition-all duration-200 text-white text-base',
closeButton: {
className: classNames(
'flex items-center justify-center overflow-hidden relative',
@@ -1357,22 +1367,24 @@ const Tailwind = {
}
)
}),
- checkboxicon: 'w-4 h-4 transition-all duration-200 text-white text-base',
- itemgroup: {
+ checkboxIcon: 'w-4 h-4 transition-all duration-200 text-white text-base',
+ itemGroup: {
className: classNames('m-0 p-3 text-gray-800 bg-white font-bold', 'dark:bg-gray-900 dark:text-white/80', 'cursor-auto')
},
- filtercontainer: 'relative',
- filterinput: {
- className: classNames(
- 'pr-7 -mr-7',
- 'w-full',
- 'font-sans text-base text-gray-700 bg-white py-3 px-3 border border-gray-300 transition duration-200 rounded-lg appearance-none',
- 'dark:bg-gray-900 dark:border-blue-900/40 dark:hover:border-blue-300 dark:text-white/80',
- 'hover:border-blue-500 focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)]'
- )
+ filterContainer: 'relative',
+ filterInput: {
+ root: {
+ className: classNames(
+ 'pr-7 -mr-7',
+ 'w-full',
+ 'font-sans text-base text-gray-700 bg-white py-3 px-3 border border-gray-300 transition duration-200 rounded-lg appearance-none',
+ 'dark:bg-gray-900 dark:border-blue-900/40 dark:hover:border-blue-300 dark:text-white/80',
+ 'hover:border-blue-500 focus:outline-none focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)]'
+ )
+ }
},
- filtericon: '-mt-2 absolute top-1/2',
- clearicon: 'text-gray-500 right-12 -mt-2 absolute top-1/2',
+ filterIcon: '-mt-2 absolute top-1/2',
+ clearIcon: 'text-gray-500 right-12 -mt-2 absolute top-1/2',
transition: TRANSITIONS.overlay
},
multistatecheckbox: {
@@ -1451,7 +1463,7 @@ const Tailwind = {
'focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] hover:border-blue-500 focus:outline-none dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)]'
)
},
- inputtoken: {
+ inputToken: {
className: classNames('py-0.375rem px-0', 'flex-1 inline-flex')
},
input: ({ props }) => ({
@@ -1486,7 +1498,7 @@ const Tailwind = {
'bg-blue-50 text-blue-700 dark:bg-blue-300 dark:text-white/80': !context.focused && context.selected
})
}),
- itemgroup: {
+ itemGroup: {
className: classNames('m-0 p-3 text-gray-800 bg-white font-bold', 'dark:bg-gray-900 dark:text-white/80', 'cursor-auto')
},
transition: TRANSITIONS.overlay
@@ -1506,7 +1518,7 @@ const Tailwind = {
)
},
- inputtoken: {
+ inputToken: {
className: classNames('py-1.5 px-0', 'flex flex-1 inline-flex')
},
input: {
@@ -3152,7 +3164,7 @@ const Tailwind = {
context.sorted ? 'bg-blue-50 text-blue-700' : 'bg-slate-50 text-slate-700', // Sort
context.sorted ? 'dark:text-white/80 dark:bg-blue-300' : 'dark:text-white/80 dark:bg-gray-900', // Dark Mode
{
- 'sticky z-[1]': props.frozen || props.frozen === '', // Frozen Columns
+ 'sticky z-[1]': props && (props.frozen || props.frozen === ''), // Frozen Columns
'border-x border-y': context?.showGridlines,
'overflow-hidden space-nowrap border-y relative bg-clip-padding': context.resizable // Resizable
}
@@ -3165,7 +3177,7 @@ const Tailwind = {
context?.size === 'small' ? 'p-2' : context?.size === 'large' ? 'p-5' : 'p-4', // Size
'dark:text-white/80 dark:border-blue-900/40', // Dark Mode
{
- 'sticky bg-inherit': props?.frozen || props?.frozen === '', // Frozen Columns
+ 'sticky bg-inherit': props && (props.frozen || props.frozen === ''), // Frozen Columns
'border-x border-y': context.showGridlines
}
)
diff --git a/components/lib/radiobutton/RadioButton.js b/components/lib/radiobutton/RadioButton.js
index 8b065e2ed2..db8b1c0da7 100644
--- a/components/lib/radiobutton/RadioButton.js
+++ b/components/lib/radiobutton/RadioButton.js
@@ -1,10 +1,10 @@
import * as React from 'react';
import { PrimeReactContext } from '../api/Api';
+import { useHandleStyle } from '../componentbase/ComponentBase';
import { useMountEffect } from '../hooks/Hooks';
import { Tooltip } from '../tooltip/Tooltip';
import { DomHandler, ObjectUtils, classNames, mergeProps } from '../utils/Utils';
import { RadioButtonBase } from './RadioButtonBase';
-import { useHandleStyle } from '../componentbase/ComponentBase';
export const RadioButton = React.memo(
React.forwardRef((inProps, ref) => {
@@ -38,36 +38,36 @@ export const RadioButton = React.memo(
const radioClicked = event.target instanceof HTMLDivElement;
const inputClicked = event.target === inputRef.current;
const isInputToggled = inputClicked && event.target.checked !== checked;
- const isRadioToggled = radioClicked && (DomHandler.isAttributeEquals(elementRef.current, 'data-p-checked', true) === checked ? !checked : false);
-
- if (isInputToggled || isRadioToggled) {
- const value = !checked;
- const eventData = {
- originalEvent: event,
+ const isRadioToggled = radioClicked && (DomHandler.hasClass(elementRef.current, 'p-radiobutton-checked') === checked ? !checked : false);
+ const value = !checked;
+
+ const eventData = {
+ originalEvent: event,
+ value: props.value,
+ checked: value,
+ stopPropagation: () => {
+ event.stopPropagation();
+ },
+ preventDefault: () => {
+ event.preventDefault();
+ },
+ target: {
+ type: 'radio',
+ name: props.name,
+ id: props.id,
value: props.value,
- checked: value,
- stopPropagation: () => {
- event.stopPropagation();
- },
- preventDefault: () => {
- event.preventDefault();
- },
- target: {
- type: 'radio',
- name: props.name,
- id: props.id,
- value: props.value,
- checked: value
- }
- };
-
- props.onClick && props.onClick(eventData);
-
- // do not continue if the user defined click wants to prevent
- if (event.defaultPrevented) {
- return;
+ checked: value
}
+ };
+ props.onClick && props.onClick(eventData);
+
+ // do not continue if the user defined click wants to prevent
+ if (event.defaultPrevented) {
+ return;
+ }
+
+ if (isInputToggled || isRadioToggled) {
props.onChange && props.onChange(eventData);
if (isRadioToggled) {
diff --git a/components/lib/sidebar/Sidebar.js b/components/lib/sidebar/Sidebar.js
index f0832785b9..a547a6d898 100644
--- a/components/lib/sidebar/Sidebar.js
+++ b/components/lib/sidebar/Sidebar.js
@@ -156,6 +156,7 @@ export const Sidebar = React.forwardRef((inProps, ref) => {
});
const createCloseIcon = () => {
+ const ariaLabel = props.ariaCloseLabel || localeOption('close');
const closeButtonProps = mergeProps(
{
type: 'button',
@@ -176,7 +177,6 @@ export const Sidebar = React.forwardRef((inProps, ref) => {
const icon = props.closeIcon || ;
const closeIcon = IconUtils.getJSXIcon(icon, { ...closeIconProps }, { props });
- const ariaLabel = props.ariaCloseLabel || localeOption('close');
if (props.showCloseIcon) {
return (
diff --git a/components/lib/togglebutton/ToggleButton.js b/components/lib/togglebutton/ToggleButton.js
index 9b48bc3b04..b1e18a2645 100644
--- a/components/lib/togglebutton/ToggleButton.js
+++ b/components/lib/togglebutton/ToggleButton.js
@@ -1,19 +1,23 @@
import * as React from 'react';
import { PrimeReactContext } from '../api/Api';
+import { useHandleStyle } from '../componentbase/ComponentBase';
import { useMountEffect } from '../hooks/Hooks';
import { Ripple } from '../ripple/Ripple';
import { Tooltip } from '../tooltip/Tooltip';
import { DomHandler, IconUtils, ObjectUtils, mergeProps } from '../utils/Utils';
import { ToggleButtonBase } from './ToggleButtonBase';
-import { useHandleStyle } from '../componentbase/ComponentBase';
export const ToggleButton = React.memo(
React.forwardRef((inProps, ref) => {
+ const [focusedState, setFocusedState] = React.useState(false);
const context = React.useContext(PrimeReactContext);
const props = ToggleButtonBase.getProps(inProps, context);
const elementRef = React.useRef(null);
const { ptm, cx, isUnstyled } = ToggleButtonBase.setMetaData({
- props
+ props,
+ state: {
+ focused: focusedState
+ }
});
useHandleStyle(ToggleButtonBase.css.styles, isUnstyled, { name: 'togglebutton' });
@@ -43,6 +47,16 @@ export const ToggleButton = React.memo(
}
};
+ const onFocus = (event) => {
+ setFocusedState(true);
+ props.onFocus && props.onFocus(event);
+ };
+
+ const onBlur = (event) => {
+ setFocusedState(false);
+ props.onBlur && props.onBlur(event);
+ };
+
const onKeyDown = (event) => {
if (event.keyCode === 32) {
toggle(event);
@@ -95,8 +109,8 @@ export const ToggleButton = React.memo(
className: cx('root', { hasIcon, hasLabel }),
style: props.style,
onClick: toggle,
- onFocus: props.onFocus,
- onBlur: props.onBlur,
+ onFocus: onFocus,
+ onBlur: onBlur,
onKeyDown: onKeyDown,
tabIndex: tabIndex,
role: 'button',
diff --git a/components/lib/treeselect/TreeSelect.js b/components/lib/treeselect/TreeSelect.js
index 23900bc2b5..b2f4b594d4 100644
--- a/components/lib/treeselect/TreeSelect.js
+++ b/components/lib/treeselect/TreeSelect.js
@@ -7,6 +7,7 @@ import { SearchIcon } from '../icons/search';
import { TimesIcon } from '../icons/times';
import { OverlayService } from '../overlayservice/OverlayService';
import { Ripple } from '../ripple/Ripple';
+import { Tooltip } from '../tooltip/Tooltip';
import { Tree } from '../tree/Tree';
import { DomHandler, IconUtils, ObjectUtils, ZIndexUtils, mergeProps } from '../utils/Utils';
import { TreeSelectBase } from './TreeSelectBase';
@@ -33,6 +34,7 @@ export const TreeSelect = React.memo(
const hasNoOptions = ObjectUtils.isEmpty(props.options);
const isSingleSelectionMode = props.selectionMode === 'single';
const isCheckboxSelectionMode = props.selectionMode === 'checkbox';
+ const hasTooltip = ObjectUtils.isNotEmpty(props.tooltip);
const metaData = {
props,
@@ -744,6 +746,7 @@ export const TreeSelect = React.memo(
>
{content}
+ {hasTooltip && }
);
})
diff --git a/components/lib/treeselect/treeselect.d.ts b/components/lib/treeselect/treeselect.d.ts
index 10a30ec2c4..fbb888d9ee 100644
--- a/components/lib/treeselect/treeselect.d.ts
+++ b/components/lib/treeselect/treeselect.d.ts
@@ -12,6 +12,8 @@ import { CSSTransitionProps as ReactCSSTransitionProps } from 'react-transition-
import { ComponentHooks } from '../componentbase/componentbase';
import { CSSTransitionProps } from '../csstransition';
import { PassThroughOptions } from '../passthrough';
+import { TooltipPassThroughOptions } from '../tooltip/tooltip';
+import { TooltipOptions } from '../tooltip/tooltipoptions';
import { TreeNodeTemplateOptions, TreePassThroughOptions, TreeTogglerTemplateOptions } from '../tree/tree';
import { TreeNode } from '../treenode';
import { FormEvent } from '../ts-helpers';
@@ -123,6 +125,11 @@ export interface TreeSelectPassThroughOptions {
* Used to control React Transition API.
*/
transition?: TreeSelectPassThroughTransitionType;
+ /**
+ * Uses to pass attributes to the Tooltip component.
+ * @see {@link TooltipPassThroughOptions}
+ */
+ tooltip?: TooltipPassThroughOptions;
}
/**
@@ -524,6 +531,14 @@ export interface TreeSelectProps extends Omit