Skip to content

Commit a7e8c69

Browse files
chore: rename classNameBuilder functions in "views" and remove classNameBuilder aliases with "use" prefix (#4505)
* chore: replace deprecated classNameBuilder functions (replace prefix 'use' with 'get') in views/Advertisement * chore: replace deprecated classNameBuilder functions (replace prefix 'use' with 'get') in views/Card * chore: replace deprecated classNameBuilder functions (replace prefix 'use' with 'get') in views/Comment * chore: replace deprecated classNameBuilder functions (replace prefix 'use' with 'get') in views/Feed * chore: replace deprecated classNameBuilder functions (replace prefix 'use' with 'get') in views/Item * chore: replace deprecated classNameBuilder functions (replace prefix 'use' with 'get') in views/Statistic * chore: remove deprecaetd unused classNameBuilders
1 parent 74cbda4 commit a7e8c69

18 files changed

+56
-98
lines changed

src/lib/classNameBuilders.js

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ import { numberToWord } from './numberToWord'
2121
*/
2222
export const getKeyOnly = (val, key) => val && key
2323

24-
/**
25-
* @deprecated
26-
*/
27-
export const useKeyOnly = getKeyOnly
28-
2924
/**
3025
* Props that require both a key and value to create a className.
3126
* @param {*} val A props value
@@ -37,11 +32,6 @@ export const useKeyOnly = getKeyOnly
3732
*/
3833
export const getValueAndKey = (val, key) => val && val !== true && `${val} ${key}`
3934

40-
/**
41-
* @deprecated
42-
*/
43-
export const useValueAndKey = getValueAndKey
44-
4535
/**
4636
* Props whose key will be used in className, or value and key.
4737
* @param {*} val A props value
@@ -57,11 +47,6 @@ export const useValueAndKey = getValueAndKey
5747
*/
5848
export const getKeyOrValueAndKey = (val, key) => val && (val === true ? key : `${val} ${key}`)
5949

60-
/**
61-
* @deprecated
62-
*/
63-
export const useKeyOrValueAndKey = getKeyOrValueAndKey
64-
6550
//
6651
// Prop to className exceptions
6752
//
@@ -89,11 +74,6 @@ export const getMultipleProp = (val, key) => {
8974
.join(' ')
9075
}
9176

92-
/**
93-
* @deprecated
94-
*/
95-
export const useMultipleProp = getMultipleProp
96-
9777
/**
9878
* The "textAlign" prop follows the useValueAndKey except when the value is "justified'.
9979
* In this case, only the class "justified" is used, ignoring the "aligned" class.
@@ -110,11 +90,6 @@ export const useMultipleProp = getMultipleProp
11090
export const getTextAlignProp = (val) =>
11191
val === 'justified' ? 'justified' : getValueAndKey(val, 'aligned')
11292

113-
/**
114-
* @deprecated
115-
*/
116-
export const useTextAlignProp = getTextAlignProp
117-
11893
/**
11994
* The "verticalAlign" prop follows the useValueAndKey.
12095
*
@@ -126,11 +101,6 @@ export const useTextAlignProp = getTextAlignProp
126101
*/
127102
export const getVerticalAlignProp = (val) => getValueAndKey(val, 'aligned')
128103

129-
/**
130-
* @deprecated
131-
*/
132-
export const useVerticalAlignProp = getVerticalAlignProp
133-
134104
/**
135105
* Create "X", "X wide" and "equal width" classNames.
136106
* "X" is a numberToWord value and "wide" is configurable.
@@ -162,8 +132,3 @@ export const getWidthProp = (val, widthClass = '', canEqual = false) => {
162132
}
163133
return numberToWord(val)
164134
}
165-
166-
/**
167-
* @deprecated
168-
*/
169-
export const useWidthProp = getWidthProp

src/lib/index.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,12 @@ export ModernAutoControlledComponent from './ModernAutoControlledComponent'
44
export * as childrenUtils from './childrenUtils'
55

66
export {
7-
useKeyOnly,
87
getKeyOnly,
9-
useKeyOrValueAndKey,
108
getKeyOrValueAndKey,
11-
useValueAndKey,
129
getValueAndKey,
13-
useMultipleProp,
1410
getMultipleProp,
15-
useTextAlignProp,
1611
getTextAlignProp,
17-
useVerticalAlignProp,
1812
getVerticalAlignProp,
19-
useWidthProp,
2013
getWidthProp,
2114
} from './classNameBuilders'
2215

src/views/Advertisement/Advertisement.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
customPropTypes,
88
getComponentType,
99
getUnhandledProps,
10-
useKeyOnly,
10+
getKeyOnly,
1111
} from '../../lib'
1212

1313
/**
@@ -19,8 +19,8 @@ const Advertisement = React.forwardRef(function (props, ref) {
1919
const classes = cx(
2020
'ui',
2121
unit,
22-
useKeyOnly(centered, 'centered'),
23-
useKeyOnly(test, 'test'),
22+
getKeyOnly(centered, 'centered'),
23+
getKeyOnly(test, 'test'),
2424
'ad',
2525
className,
2626
)

src/views/Card/Card.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
getComponentType,
1010
getUnhandledProps,
1111
SUI,
12-
useKeyOnly,
12+
getKeyOnly,
1313
useEventCallback,
1414
} from '../../lib'
1515
import Image from '../../elements/Image'
@@ -44,10 +44,10 @@ const Card = React.forwardRef(function (props, ref) {
4444
const classes = cx(
4545
'ui',
4646
color,
47-
useKeyOnly(centered, 'centered'),
48-
useKeyOnly(fluid, 'fluid'),
49-
useKeyOnly(link, 'link'),
50-
useKeyOnly(raised, 'raised'),
47+
getKeyOnly(centered, 'centered'),
48+
getKeyOnly(fluid, 'fluid'),
49+
getKeyOnly(link, 'link'),
50+
getKeyOnly(raised, 'raised'),
5151
'card',
5252
className,
5353
)

src/views/Card/CardContent.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import {
1010
getComponentType,
1111
getUnhandledProps,
1212
SUI,
13-
useKeyOnly,
14-
useTextAlignProp,
13+
getKeyOnly,
14+
getTextAlignProp,
1515
} from '../../lib'
1616
import CardDescription from './CardDescription'
1717
import CardHeader from './CardHeader'
@@ -23,7 +23,7 @@ import CardMeta from './CardMeta'
2323
const CardContent = React.forwardRef(function (props, ref) {
2424
const { children, className, content, description, extra, header, meta, textAlign } = props
2525

26-
const classes = cx(useKeyOnly(extra, 'extra'), useTextAlignProp(textAlign), 'content', className)
26+
const classes = cx(getKeyOnly(extra, 'extra'), getTextAlignProp(textAlign), 'content', className)
2727
const rest = getUnhandledProps(CardContent, props)
2828
const ElementType = getComponentType(props)
2929

src/views/Card/CardDescription.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import {
99
getComponentType,
1010
getUnhandledProps,
1111
SUI,
12-
useTextAlignProp,
12+
getTextAlignProp,
1313
} from '../../lib'
1414

1515
/**
1616
* A card can contain a description with one or more paragraphs.
1717
*/
1818
const CardDescription = React.forwardRef(function (props, ref) {
1919
const { children, className, content, textAlign } = props
20-
const classes = cx(useTextAlignProp(textAlign), 'description', className)
20+
const classes = cx(getTextAlignProp(textAlign), 'description', className)
2121
const rest = getUnhandledProps(CardDescription, props)
2222
const ElementType = getComponentType(props)
2323

src/views/Card/CardGroup.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import {
99
getComponentType,
1010
getUnhandledProps,
1111
SUI,
12-
useKeyOnly,
13-
useTextAlignProp,
14-
useWidthProp,
12+
getKeyOnly,
13+
getTextAlignProp,
14+
getWidthProp,
1515
} from '../../lib'
1616
import Card from './Card'
1717

@@ -33,11 +33,11 @@ const CardGroup = React.forwardRef(function (props, ref) {
3333

3434
const classes = cx(
3535
'ui',
36-
useKeyOnly(centered, 'centered'),
37-
useKeyOnly(doubling, 'doubling'),
38-
useKeyOnly(stackable, 'stackable'),
39-
useTextAlignProp(textAlign),
40-
useWidthProp(itemsPerRow),
36+
getKeyOnly(centered, 'centered'),
37+
getKeyOnly(doubling, 'doubling'),
38+
getKeyOnly(stackable, 'stackable'),
39+
getTextAlignProp(textAlign),
40+
getWidthProp(itemsPerRow),
4141
'cards',
4242
className,
4343
)

src/views/Card/CardHeader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import {
99
getComponentType,
1010
getUnhandledProps,
1111
SUI,
12-
useTextAlignProp,
12+
getTextAlignProp,
1313
} from '../../lib'
1414

1515
/**
1616
* A card can contain a header.
1717
*/
1818
const CardHeader = React.forwardRef(function (props, ref) {
1919
const { children, className, content, textAlign } = props
20-
const classes = cx(useTextAlignProp(textAlign), 'header', className)
20+
const classes = cx(getTextAlignProp(textAlign), 'header', className)
2121
const rest = getUnhandledProps(CardHeader, props)
2222
const ElementType = getComponentType(props)
2323

src/views/Card/CardMeta.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import {
99
getComponentType,
1010
getUnhandledProps,
1111
SUI,
12-
useTextAlignProp,
12+
getTextAlignProp,
1313
} from '../../lib'
1414

1515
/**
1616
* A card can contain content metadata.
1717
*/
1818
const CardMeta = React.forwardRef(function (props, ref) {
1919
const { children, className, content, textAlign } = props
20-
const classes = cx(useTextAlignProp(textAlign), 'meta', className)
20+
const classes = cx(getTextAlignProp(textAlign), 'meta', className)
2121
const rest = getUnhandledProps(CardMeta, props)
2222
const ElementType = getComponentType(props)
2323

src/views/Comment/Comment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
customPropTypes,
88
getComponentType,
99
getUnhandledProps,
10-
useKeyOnly,
10+
getKeyOnly,
1111
} from '../../lib'
1212
import CommentAction from './CommentAction'
1313
import CommentActions from './CommentActions'
@@ -24,7 +24,7 @@ import CommentText from './CommentText'
2424
const Comment = React.forwardRef(function (props, ref) {
2525
const { className, children, collapsed, content } = props
2626

27-
const classes = cx(useKeyOnly(collapsed, 'collapsed'), 'comment', className)
27+
const classes = cx(getKeyOnly(collapsed, 'collapsed'), 'comment', className)
2828
const rest = getUnhandledProps(Comment, props)
2929
const ElementType = getComponentType(props)
3030

src/views/Comment/CommentAction.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
customPropTypes,
88
getComponentType,
99
getUnhandledProps,
10-
useKeyOnly,
10+
getKeyOnly,
1111
} from '../../lib'
1212

1313
/**
@@ -16,7 +16,7 @@ import {
1616
const CommentAction = React.forwardRef(function (props, ref) {
1717
const { active, className, children, content } = props
1818

19-
const classes = cx(useKeyOnly(active, 'active'), className)
19+
const classes = cx(getKeyOnly(active, 'active'), className)
2020
const rest = getUnhandledProps(CommentAction, props)
2121
const ElementType = getComponentType(props, { defaultAs: 'a' })
2222

src/views/Comment/CommentGroup.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
getComponentType,
1010
getUnhandledProps,
1111
SUI,
12-
useKeyOnly,
12+
getKeyOnly,
1313
} from '../../lib'
1414

1515
/**
@@ -21,9 +21,9 @@ const CommentGroup = React.forwardRef(function (props, ref) {
2121
const classes = cx(
2222
'ui',
2323
size,
24-
useKeyOnly(collapsed, 'collapsed'),
25-
useKeyOnly(minimal, 'minimal'),
26-
useKeyOnly(threaded, 'threaded'),
24+
getKeyOnly(collapsed, 'collapsed'),
25+
getKeyOnly(minimal, 'minimal'),
26+
getKeyOnly(threaded, 'threaded'),
2727
'comments',
2828
className,
2929
)

src/views/Feed/FeedExtra.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
customPropTypes,
1010
getComponentType,
1111
getUnhandledProps,
12-
useKeyOnly,
12+
getKeyOnly,
1313
} from '../../lib'
1414

1515
/**
@@ -19,8 +19,8 @@ const FeedExtra = React.forwardRef(function (props, ref) {
1919
const { children, className, content, images, text } = props
2020

2121
const classes = cx(
22-
useKeyOnly(images, 'images'),
23-
useKeyOnly(content || text, 'text'),
22+
getKeyOnly(images, 'images'),
23+
getKeyOnly(content || text, 'text'),
2424
'extra',
2525
className,
2626
)

src/views/Item/ItemContent.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
getComponentType,
99
getUnhandledProps,
1010
SUI,
11-
useVerticalAlignProp,
11+
getVerticalAlignProp,
1212
} from '../../lib'
1313
import ItemHeader from './ItemHeader'
1414
import ItemDescription from './ItemDescription'
@@ -21,7 +21,7 @@ import ItemMeta from './ItemMeta'
2121
const ItemContent = React.forwardRef(function (props, ref) {
2222
const { children, className, content, description, extra, header, meta, verticalAlign } = props
2323

24-
const classes = cx(useVerticalAlignProp(verticalAlign), 'content', className)
24+
const classes = cx(getVerticalAlignProp(verticalAlign), 'content', className)
2525
const rest = getUnhandledProps(ItemContent, props)
2626
const ElementType = getComponentType(props)
2727

src/views/Item/ItemGroup.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import {
88
customPropTypes,
99
getComponentType,
1010
getUnhandledProps,
11-
useKeyOnly,
12-
useKeyOrValueAndKey,
11+
getKeyOnly,
12+
getKeyOrValueAndKey,
1313
} from '../../lib'
1414
import Item from './Item'
1515

@@ -21,10 +21,10 @@ const ItemGroup = React.forwardRef(function (props, ref) {
2121

2222
const classes = cx(
2323
'ui',
24-
useKeyOnly(divided, 'divided'),
25-
useKeyOnly(link, 'link'),
26-
useKeyOnly(unstackable, 'unstackable'),
27-
useKeyOrValueAndKey(relaxed, 'relaxed'),
24+
getKeyOnly(divided, 'divided'),
25+
getKeyOnly(link, 'link'),
26+
getKeyOnly(unstackable, 'unstackable'),
27+
getKeyOrValueAndKey(relaxed, 'relaxed'),
2828
'items',
2929
className,
3030
)

src/views/Statistic/Statistic.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ import {
1010
getComponentType,
1111
getUnhandledProps,
1212
SUI,
13-
useKeyOnly,
14-
useValueAndKey,
13+
getKeyOnly,
14+
getValueAndKey,
1515
} from '../../lib'
1616
import StatisticGroup from './StatisticGroup'
1717
import StatisticLabel from './StatisticLabel'
@@ -39,9 +39,9 @@ const Statistic = React.forwardRef(function (props, ref) {
3939
'ui',
4040
color,
4141
size,
42-
useValueAndKey(floated, 'floated'),
43-
useKeyOnly(horizontal, 'horizontal'),
44-
useKeyOnly(inverted, 'inverted'),
42+
getValueAndKey(floated, 'floated'),
43+
getKeyOnly(horizontal, 'horizontal'),
44+
getKeyOnly(inverted, 'inverted'),
4545
'statistic',
4646
className,
4747
)

0 commit comments

Comments
 (0)