MCPcopy
hub / github.com/adobe/react-spectrum / classNames

Function classNames

packages/@adobe/react-spectrum/src/utils/classNames.ts:28–61  ·  view source on GitHub ↗
(
  cssModule: {[key: string]: string},
  ...values: Array<string | Object | undefined>
)

Source from the content-addressed store, hash-verified

26}
27
28export function classNames(
29 cssModule: {[key: string]: string},
30 ...values: Array<string | Object | undefined>
31): string {
32 let classes: Array<{} | undefined> = [];
33 for (let value of values) {
34 if (typeof value === 'object' && value) {
35 let mapped = {};
36 for (let key in value) {
37 if (cssModule[key]) {
38 mapped[cssModule[key]] = value[key];
39 }
40
41 if (shouldKeepSpectrumClassNames || !cssModule[key]) {
42 mapped[key] = value[key];
43 }
44 }
45
46 classes.push(mapped);
47 } else if (typeof value === 'string') {
48 if (cssModule[value]) {
49 classes.push(cssModule[value]);
50 }
51
52 if (shouldKeepSpectrumClassNames || !cssModule[value]) {
53 classes.push(value);
54 }
55 } else {
56 classes.push(value);
57 }
58 }
59
60 return _clsx(...classes);
61}

Callers 15

ButtonFunction · 0.90
TableFunction · 0.90
ResizableTableRowGroupFunction · 0.90
ResizableTableHeaderRowFunction · 0.90
ButtonFunction · 0.90
ResizerFunction · 0.90
ResizableTableRowFunction · 0.90
ResizableTableCellFunction · 0.90
TableFunction · 0.90
ResizerFunction · 0.90
StoryThumbFunction · 0.90

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected