Skip to content

Commit

Permalink
#6329 - classnames not being set in unstyled mode
Browse files Browse the repository at this point in the history
  • Loading branch information
gucal committed Apr 9, 2024
1 parent 36f1358 commit 6ac1fb6
Show file tree
Hide file tree
Showing 30 changed files with 86 additions and 124 deletions.
4 changes: 2 additions & 2 deletions components/lib/cascadeselect/CascadeSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ChevronDownIcon } from '../icons/chevrondown';
import { SpinnerIcon } from '../icons/spinner';
import { OverlayService } from '../overlayservice/OverlayService';
import { Portal } from '../portal/Portal';
import { DomHandler, IconUtils, ObjectUtils, UniqueComponentId, ZIndexUtils } from '../utils/Utils';
import { DomHandler, IconUtils, ObjectUtils, UniqueComponentId, ZIndexUtils, classNames } from '../utils/Utils';
import { CascadeSelectBase } from './CascadeSelectBase';
import { CascadeSelectSub } from './CascadeSelectSub';

Expand Down Expand Up @@ -471,7 +471,7 @@ export const CascadeSelect = React.memo(
{
id: props.id,
ref: elementRef,
className: cx('root', { focusedState, overlayVisibleState, context }),
className: classNames(props.className, cx('root', { focusedState, overlayVisibleState, context })),
style: props.style,
onClick: (e) => onClick(e)
},
Expand Down
20 changes: 8 additions & 12 deletions components/lib/cascadeselect/CascadeSelectBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,14 @@ import { classNames } from '../utils/Utils';

const classes = {
root: ({ props, focusedState, overlayVisibleState, context }) =>
classNames(
'p-cascadeselect p-component p-inputwrapper',
{
'p-disabled': props.disabled,
'p-invalid': props.invalid,
'p-variant-filled': props.variant ? props.variant === 'filled' : context && context.inputStyle === 'filled',
'p-focus': focusedState,
'p-inputwrapper-filled': props.value,
'p-inputwrapper-focus': focusedState || overlayVisibleState
},
props.className
),
classNames('p-cascadeselect p-component p-inputwrapper', {
'p-disabled': props.disabled,
'p-invalid': props.invalid,
'p-variant-filled': props.variant ? props.variant === 'filled' : context && context.inputStyle === 'filled',
'p-focus': focusedState,
'p-inputwrapper-filled': props.value,
'p-inputwrapper-focus': focusedState || overlayVisibleState
}),
label: ({ props, label }) =>
classNames('p-cascadeselect-label ', {
'p-placeholder': label === props.placeholder,
Expand Down
3 changes: 2 additions & 1 deletion components/lib/chart/Chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import { PrimeReactContext } from '../api/Api';
import { useHandleStyle } from '../componentbase/ComponentBase';
import { useMergeProps, useUnmountEffect } from '../hooks/Hooks';
import { classNames } from '../utils/Utils';
import { ChartBase } from './ChartBase';

// GitHub #3059 wrapper if loaded by script tag
Expand Down Expand Up @@ -96,7 +97,7 @@ const PrimeReactChart = React.memo(
id: props.id,
ref: elementRef,
style: sx('root'),
className: cx('root')
className: classNames(props.className, cx('root'))
},
ChartBase.getOtherProps(props),
ptm('root')
Expand Down
3 changes: 1 addition & 2 deletions components/lib/chart/ChartBase.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ComponentBase } from '../componentbase/ComponentBase';
import { classNames } from '../utils/Utils';

export const ChartBase = ComponentBase.extend({
defaultProps: {
Expand All @@ -17,7 +16,7 @@ export const ChartBase = ComponentBase.extend({
},
css: {
classes: {
root: ({ props }) => classNames('p-chart', props.className)
root: 'p-chart'
},
inlineStyles: {
root: ({ props }) =>
Expand Down
4 changes: 2 additions & 2 deletions components/lib/colorpicker/ColorPicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useHandleStyle } from '../componentbase/ComponentBase';
import { useEventListener, useMergeProps, useMountEffect, useOverlayListener, useUnmountEffect, useUpdateEffect } from '../hooks/Hooks';
import { OverlayService } from '../overlayservice/OverlayService';
import { Tooltip } from '../tooltip/Tooltip';
import { DomHandler, ObjectUtils, ZIndexUtils } from '../utils/Utils';
import { DomHandler, ObjectUtils, ZIndexUtils, classNames } from '../utils/Utils';
import { ColorPickerBase } from './ColorPickerBase';
import { ColorPickerPanel } from './ColorPickerPanel';

Expand Down Expand Up @@ -650,7 +650,7 @@ export const ColorPicker = React.memo(
id: props.id,
ref: elementRef,
style: props.style,
className: cx('root')
className: classNames(props.className, cx('root'))
},
ColorPickerBase.getOtherProps(props),
ptm('root')
Expand Down
10 changes: 3 additions & 7 deletions components/lib/colorpicker/ColorPickerBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ import { classNames } from '../utils/Utils';

const classes = {
root: ({ props }) =>
classNames(
'p-colorpicker p-component',
{
'p-colorpicker-overlay': !props.inline
},
props.className
),
classNames('p-colorpicker p-component', {
'p-colorpicker-overlay': !props.inline
}),
input: ({ props }) =>
classNames('p-colorpicker-preview p-inputtext', props.inputClassName, {
'p-disabled': props.disabled
Expand Down
2 changes: 1 addition & 1 deletion components/lib/fileupload/FileUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ export const FileUpload = React.memo(
const rootProps = mergeProps(
{
id: props.id,
className: cx('root'),
className: classNames(props.className, cx('root')),
style: props.style
},
FileUploadBase.getOtherProps(props),
Expand Down
5 changes: 3 additions & 2 deletions components/lib/iconfield/IconField.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useContext, useRef } from 'react';
import { useMergeProps } from '../hooks/Hooks';
import { PrimeReactContext } from '../api/Api';
import { useMergeProps } from '../hooks/Hooks';
import { classNames } from '../utils/Utils';
import { IconFieldBase } from './IconFieldBase';

export const IconField = React.memo(
Expand All @@ -20,7 +21,7 @@ export const IconField = React.memo(

const rootProps = mergeProps(
{
className: cx('root', { iconPosition: props.iconPosition })
className: classNames(props.className, cx('root', { iconPosition: props.iconPosition }))
},
IconFieldBase.getOtherProps(props),
ptm('root')
Expand Down
2 changes: 1 addition & 1 deletion components/lib/image/Image.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ export const Image = React.memo(
const rootProps = mergeProps(
{
ref: elementRef,
className: cx('root')
className: classNames(props.className, cx('root'))
},
ImageBase.getOtherProps(props),
ptm('root')
Expand Down
2 changes: 1 addition & 1 deletion components/lib/image/ImageBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const classes = {
preview: 'p-image-preview',
icon: 'p-image-preview-icon',
root: ({ props }) =>
classNames('p-image p-component', props.className, {
classNames('p-image p-component', {
'p-image-preview-container': props.preview
}),
transition: 'p-image-preview'
Expand Down
4 changes: 2 additions & 2 deletions components/lib/inputtextarea/InputTextarea.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useHandleStyle } from '../componentbase/ComponentBase';
import { useMergeProps } from '../hooks/Hooks';
import { KeyFilter } from '../keyfilter/KeyFilter';
import { Tooltip } from '../tooltip/Tooltip';
import { DomHandler, ObjectUtils } from '../utils/Utils';
import { DomHandler, ObjectUtils, classNames } from '../utils/Utils';
import { InputTextareaBase } from './InputTextareaBase';

export const InputTextarea = React.memo(
Expand Down Expand Up @@ -127,7 +127,7 @@ export const InputTextarea = React.memo(
const rootProps = mergeProps(
{
ref: elementRef,
className: cx('root', { context, isFilled }),
className: classNames(props.className, cx('root', { context, isFilled })),
onFocus: onFocus,
onBlur: onBlur,
onKeyUp: onKeyUp,
Expand Down
18 changes: 7 additions & 11 deletions components/lib/inputtextarea/InputTextareaBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,13 @@ import { classNames } from '../utils/Utils';

const classes = {
root: ({ props, context, isFilled }) =>
classNames(
'p-inputtextarea p-inputtext p-component',
{
'p-disabled': props.disabled,
'p-filled': isFilled,
'p-inputtextarea-resizable': props.autoResize,
'p-invalid': props.invalid,
'p-variant-filled': props.variant ? props.variant === 'filled' : context && context.inputStyle === 'filled'
},
props.className
)
classNames('p-inputtextarea p-inputtext p-component', {
'p-disabled': props.disabled,
'p-filled': isFilled,
'p-inputtextarea-resizable': props.autoResize,
'p-invalid': props.invalid,
'p-variant-filled': props.variant ? props.variant === 'filled' : context && context.inputStyle === 'filled'
})
};

const styles = `
Expand Down
3 changes: 2 additions & 1 deletion components/lib/knob/Knob.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import { PrimeReactContext } from '../api/Api';
import { useHandleStyle } from '../componentbase/ComponentBase';
import { useEventListener, useMergeProps } from '../hooks/Hooks';
import { classNames } from '../utils/Utils';
import { KnobBase } from './KnobBase';

const radius = 40;
Expand Down Expand Up @@ -243,7 +244,7 @@ export const Knob = React.memo(
{
ref: elementRef,
id: props.id,
className: cx('root'),
className: classNames(props.className, cx('root')),
style: props.style
},
ptm('root')
Expand Down
10 changes: 3 additions & 7 deletions components/lib/knob/KnobBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,9 @@ export const KnobBase = ComponentBase.extend({
value: 'p-knob-value',
label: 'p-knob-text',
root: ({ props }) =>
classNames(
'p-knob p-component',
{
'p-disabled': props.disabled
},
props.className
)
classNames('p-knob p-component', {
'p-disabled': props.disabled
})
},
styles: `
@keyframes dash-frame {
Expand Down
4 changes: 2 additions & 2 deletions components/lib/mention/Mention.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { InputTextarea } from '../inputtextarea/InputTextarea';
import { OverlayService } from '../overlayservice/OverlayService';
import { Portal } from '../portal/Portal';
import { Ripple } from '../ripple/Ripple';
import { DomHandler, ObjectUtils, ZIndexUtils } from '../utils/Utils';
import { DomHandler, ObjectUtils, ZIndexUtils, classNames } from '../utils/Utils';
import { MentionBase } from './MentionBase';

export const Mention = React.memo(
Expand Down Expand Up @@ -550,7 +550,7 @@ export const Mention = React.memo(
{
ref: elementRef,
id: props.id,
className: cx('root', { focusedState, isFilled }),
className: classNames(props.className, cx('root', { focusedState, isFilled })),
style: props.style
},
MentionBase.getOtherProps(props),
Expand Down
12 changes: 4 additions & 8 deletions components/lib/mention/MentionBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@ const classes = {
panel: ({ props }) => classNames('p-mention-panel p-component', props.panelClassName),
input: ({ props }) => classNames('p-mention-input', props.inputClassName),
root: ({ props, isFilled, focusedState }) =>
classNames(
'p-mention p-component p-inputwrapper',
{
'p-inputwrapper-filled': isFilled,
'p-inputwrapper-focus': focusedState
},
props.className
),
classNames('p-mention p-component p-inputwrapper', {
'p-inputwrapper-filled': isFilled,
'p-inputwrapper-focus': focusedState
}),
transition: 'p-connected-overlay'
};

Expand Down
2 changes: 1 addition & 1 deletion components/lib/password/Password.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ export const Password = React.memo(
{
ref: elementRef,
id: props.id,
className: cx('root', { isFilled, focusedState }),
className: classNames(props.className, cx('root', { isFilled, focusedState })),
style: props.style
},
ptm('root')
Expand Down
14 changes: 5 additions & 9 deletions components/lib/password/PasswordBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@ import { classNames } from '../utils/Utils';

const classes = {
root: ({ props, isFilled, focusedState }) =>
classNames(
'p-password p-component p-inputwrapper',
{
'p-inputwrapper-filled': isFilled,
'p-inputwrapper-focus': focusedState,
'p-input-icon-right': props.toggleMask
},
props.className
),
classNames('p-password p-component p-inputwrapper', {
'p-inputwrapper-filled': isFilled,
'p-inputwrapper-focus': focusedState,
'p-input-icon-right': props.toggleMask
}),
input: ({ props }) => classNames('p-password-input', props.inputClassName),
panel: ({ props, context }) =>
classNames('p-password-panel p-component', props.panelClassName, {
Expand Down
4 changes: 2 additions & 2 deletions components/lib/rating/Rating.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BanIcon } from '../icons/ban';
import { StarIcon } from '../icons/star';
import { StarFillIcon } from '../icons/starfill';
import { Tooltip } from '../tooltip/Tooltip';
import { IconUtils, ObjectUtils } from '../utils/Utils';
import { IconUtils, ObjectUtils, classNames } from '../utils/Utils';
import { RatingBase } from './RatingBase';

export const Rating = React.memo(
Expand Down Expand Up @@ -198,7 +198,7 @@ export const Rating = React.memo(
{
ref: elementRef,
id: props.id,
className: cx('root'),
className: classNames(props.className, cx('root')),
style: props.style
},
RatingBase.getOtherProps(props),
Expand Down
12 changes: 4 additions & 8 deletions components/lib/rating/RatingBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ const classes = {
cancelIcon: 'p-rating-icon p-rating-cancel',
cancelItem: 'p-rating-item p-rating-cancel-item',
root: ({ props }) =>
classNames(
'p-rating',
{
'p-disabled': props.disabled,
'p-readonly': props.readOnly
},
props.className
)
classNames('p-rating', {
'p-disabled': props.disabled,
'p-readonly': props.readOnly
})
};

const styles = `
Expand Down
4 changes: 2 additions & 2 deletions components/lib/selectbutton/SelectButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PrimeReactContext } from '../api/Api';
import { useHandleStyle } from '../componentbase/ComponentBase';
import { useMergeProps } from '../hooks/Hooks';
import { Tooltip } from '../tooltip/Tooltip';
import { DomHandler, ObjectUtils } from '../utils/Utils';
import { DomHandler, ObjectUtils, classNames } from '../utils/Utils';
import { SelectButtonBase } from './SelectButtonBase';
import { SelectButtonItem } from './SelectButtonItem';

Expand Down Expand Up @@ -140,7 +140,7 @@ export const SelectButton = React.memo(
{
ref: elementRef,
id: props.id,
className: cx('root'),
className: classNames(props.className, cx('root')),
style: props.style,
role: 'group'
},
Expand Down
2 changes: 1 addition & 1 deletion components/lib/selectbutton/SelectButtonBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ComponentBase } from '../componentbase/ComponentBase';
import { classNames } from '../utils/Utils';

const classes = {
root: ({ props }) => classNames('p-selectbutton p-button-group p-component', props.className, { 'p-invalid': props.invalid }),
root: ({ props }) => classNames('p-selectbutton p-button-group p-component', { 'p-invalid': props.invalid }),
button: ({ itemProps: props, focusedState }) =>
classNames('p-button p-component', {
'p-highlight': props.selected,
Expand Down
4 changes: 2 additions & 2 deletions components/lib/slidemenu/SlideMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ESC_KEY_HANDLING_PRIORITIES, useDisplayOrder, useGlobalOnEscapeKey, use
import { ChevronLeftIcon } from '../icons/chevronleft';
import { OverlayService } from '../overlayservice/OverlayService';
import { Portal } from '../portal/Portal';
import { DomHandler, IconUtils, UniqueComponentId, ZIndexUtils } from '../utils/Utils';
import { DomHandler, IconUtils, UniqueComponentId, ZIndexUtils, classNames } from '../utils/Utils';
import { SlideMenuBase } from './SlideMenuBase';
import { SlideMenuSub } from './SlideMenuSub';

Expand Down Expand Up @@ -175,7 +175,7 @@ export const SlideMenu = React.memo(
{
ref: menuRef,
id: props.id,
className: cx('root'),
className: classNames(props.className, cx('root')),
style: props.style,
onClick: (e) => onPanelClick(e)
},
Expand Down
10 changes: 3 additions & 7 deletions components/lib/slidemenu/SlideMenuBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ const classes = {
'p-slidemenu-separator': levelState > 0
}),
root: ({ props }) =>
classNames(
'p-slidemenu p-component',
{
'p-slidemenu-overlay': props.popup
},
props.className
),
classNames('p-slidemenu p-component', {
'p-slidemenu-overlay': props.popup
}),
wrapper: 'p-slidemenu-wrapper',
content: 'p-slidemenu-content',
separator: 'p-slidemenu-separator',
Expand Down
Loading

0 comments on commit 6ac1fb6

Please sign in to comment.