Skip to content

Commit ffb4350

Browse files
abbeyhrttw15egan
andauthored
feat(react): deprecate light prop everywhere (#12297)
Co-authored-by: TJ Egan <tw15egan@gmail.com>
1 parent 6b854f3 commit ffb4350

32 files changed

+146
-246
lines changed

packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap

Lines changed: 14 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,7 @@ Map {
563563
"hideCopyButton": Object {
564564
"type": "bool",
565565
},
566-
"light": Object {
567-
"type": "bool",
568-
},
566+
"light": [Function],
569567
"maxCollapsedNumberOfRows": Object {
570568
"type": "number",
571569
},
@@ -977,7 +975,6 @@ Map {
977975
"disabled": false,
978976
"itemToElement": null,
979977
"itemToString": [Function],
980-
"light": false,
981978
"shouldFilterItem": [Function],
982979
"type": "default",
983980
},
@@ -1162,9 +1159,7 @@ Map {
11621159
"isRequired": true,
11631160
"type": "array",
11641161
},
1165-
"light": Object {
1166-
"type": "bool",
1167-
},
1162+
"light": [Function],
11681163
"onChange": Object {
11691164
"isRequired": true,
11701165
"type": "func",
@@ -1323,7 +1318,6 @@ Map {
13231318
"helperText": "",
13241319
"invalid": false,
13251320
"invalidText": "",
1326-
"light": false,
13271321
"onChange": [Function],
13281322
"onClick": [Function],
13291323
"size": "",
@@ -1371,9 +1365,7 @@ Map {
13711365
"isRequired": true,
13721366
"type": "node",
13731367
},
1374-
"light": Object {
1375-
"type": "bool",
1376-
},
1368+
"light": [Function],
13771369
"onChange": Object {
13781370
"type": "func",
13791371
},
@@ -2272,9 +2264,7 @@ Map {
22722264
"inline": Object {
22732265
"type": "bool",
22742266
},
2275-
"light": Object {
2276-
"type": "bool",
2277-
},
2267+
"light": [Function],
22782268
"locale": Object {
22792269
"args": Array [
22802270
Array [
@@ -2537,7 +2527,6 @@ Map {
25372527
"helperText": "",
25382528
"itemToElement": null,
25392529
"itemToString": [Function],
2540-
"light": false,
25412530
"titleText": "",
25422531
"type": "default",
25432532
},
@@ -2609,9 +2598,7 @@ Map {
26092598
"isRequired": true,
26102599
"type": "node",
26112600
},
2612-
"light": Object {
2613-
"type": "bool",
2614-
},
2601+
"light": [Function],
26152602
"onChange": Object {
26162603
"type": "func",
26172604
},
@@ -3063,7 +3050,6 @@ Map {
30633050
"filterItems": [Function],
30643051
"initialSelectedItems": Array [],
30653052
"itemToString": [Function],
3066-
"light": false,
30673053
"locale": "en",
30683054
"open": false,
30693055
"selectionFeedback": "top-after-reopen",
@@ -3238,9 +3224,7 @@ Map {
32383224
"isRequired": true,
32393225
"type": "array",
32403226
},
3241-
"light": Object {
3242-
"type": "bool",
3243-
},
3227+
"light": [Function],
32443228
"locale": Object {
32453229
"type": "string",
32463230
},
@@ -4291,7 +4275,6 @@ Map {
42914275
"filterItems": [Function],
42924276
"initialSelectedItems": Array [],
42934277
"itemToString": [Function],
4294-
"light": false,
42954278
"locale": "en",
42964279
"open": false,
42974280
"selectionFeedback": "top-after-reopen",
@@ -4466,9 +4449,7 @@ Map {
44664449
"isRequired": true,
44674450
"type": "array",
44684451
},
4469-
"light": Object {
4470-
"type": "bool",
4471-
},
4452+
"light": [Function],
44724453
"locale": Object {
44734454
"type": "string",
44744455
},
@@ -4534,7 +4515,6 @@ Map {
45344515
"disabled": false,
45354516
"initialSelectedItems": Array [],
45364517
"itemToString": [Function],
4537-
"light": false,
45384518
"locale": "en",
45394519
"open": false,
45404520
"selectedItems": null,
@@ -4719,9 +4699,7 @@ Map {
47194699
"isRequired": true,
47204700
"type": "node",
47214701
},
4722-
"light": Object {
4723-
"type": "bool",
4724-
},
4702+
"light": [Function],
47254703
"locale": Object {
47264704
"type": "string",
47274705
},
@@ -5284,9 +5262,7 @@ Map {
52845262
"isRequired": true,
52855263
"type": "node",
52865264
},
5287-
"light": Object {
5288-
"type": "bool",
5289-
},
5265+
"light": [Function],
52905266
"onChange": Object {
52915267
"type": "func",
52925268
},
@@ -7462,7 +7438,6 @@ Map {
74627438
"helperText": "",
74637439
"invalid": false,
74647440
"invalidText": "",
7465-
"light": false,
74667441
"maxCount": undefined,
74677442
"onChange": [Function],
74687443
"onClick": [Function],
@@ -7514,9 +7489,7 @@ Map {
75147489
"isRequired": true,
75157490
"type": "node",
75167491
},
7517-
"light": Object {
7518-
"type": "bool",
7519-
},
7492+
"light": [Function],
75207493
"maxCount": Object {
75217494
"type": "number",
75227495
},
@@ -7568,7 +7541,6 @@ Map {
75687541
"helperText": "",
75697542
"invalid": false,
75707543
"invalidText": "",
7571-
"light": false,
75727544
"onChange": [Function],
75737545
"onClick": [Function],
75747546
"size": "",
@@ -7616,9 +7588,7 @@ Map {
76167588
"isRequired": true,
76177589
"type": "node",
76187590
},
7619-
"light": Object {
7620-
"type": "bool",
7621-
},
7591+
"light": [Function],
76227592
"onChange": Object {
76237593
"type": "func",
76247594
},
@@ -7726,9 +7696,7 @@ Map {
77267696
"isRequired": true,
77277697
"type": "node",
77287698
},
7729-
"light": Object {
7730-
"type": "bool",
7731-
},
7699+
"light": [Function],
77327700
"onChange": Object {
77337701
"type": "func",
77347702
},
@@ -7852,9 +7820,7 @@ Map {
78527820
"isRequired": true,
78537821
"type": "node",
78547822
},
7855-
"light": Object {
7856-
"type": "bool",
7857-
},
7823+
"light": [Function],
78587824
"maxCount": Object {
78597825
"type": "number",
78607826
},
@@ -9377,9 +9343,7 @@ Map {
93779343
"isRequired": true,
93789344
"type": "node",
93799345
},
9380-
"light": Object {
9381-
"type": "bool",
9382-
},
9346+
"light": [Function],
93839347
"maxCount": Object {
93849348
"type": "number",
93859349
},

packages/react/src/components/CodeSnippet/CodeSnippet.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import Button from '../Button';
1515
import CopyButton from '../CopyButton';
1616
import getUniqueId from '../../tools/uniqueId';
1717
import copy from 'copy-to-clipboard';
18+
import deprecate from '../../prop-types/deprecate';
1819
import { usePrefix } from '../../internal/usePrefix';
1920

2021
const rowHeightInPixels = 16;
@@ -328,7 +329,12 @@ CodeSnippet.propTypes = {
328329
* Specify whether you are using the light variant of the Code Snippet,
329330
* typically used for inline snippet to display an alternate color
330331
*/
331-
light: PropTypes.bool,
332+
333+
light: deprecate(
334+
PropTypes.bool,
335+
'The `light` prop for `CodeSnippet` has ' +
336+
'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'
337+
),
332338

333339
/**
334340
* Specify the maximum number of rows to be shown when in collapsed view

packages/react/src/components/CodeSnippet/CodeSnippet.stories.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ export default {
1818
page: mdx,
1919
},
2020
},
21+
argTypes: {
22+
light: {
23+
table: {
24+
disable: true,
25+
},
26+
},
27+
},
2128
};
2229

2330
export const Inline = () => (

packages/react/src/components/ComboBox/ComboBox-test.e2e.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,6 @@ describe('ComboBox', () => {
8989
disabled
9090
/>
9191
</div>
92-
<div style={{ marginBottom: '2rem' }}>
93-
<ComboBox
94-
onChange={() => {}}
95-
id="carbon-combobox"
96-
items={items}
97-
itemToString={(item) => (item ? item.text : '')}
98-
placeholder="Filter..."
99-
titleText="Light combobox"
100-
helperText="Combobox helper text"
101-
light
102-
/>
103-
</div>
10492
<div style={{ marginBottom: '2rem' }}>
10593
<ComboBox
10694
onChange={() => {}}

packages/react/src/components/ComboBox/ComboBox.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { match, keys } from '../../internal/keyboard';
2121
import setupGetInstanceId from '../../tools/setupGetInstanceId';
2222
import mergeRefs from '../../tools/mergeRefs';
2323
import { useFeatureFlag } from '../FeatureFlags';
24+
import deprecate from '../../prop-types/deprecate';
2425
import { usePrefix } from '../../internal/usePrefix';
2526

2627
const defaultItemToString = (item) => {
@@ -485,7 +486,11 @@ ComboBox.propTypes = {
485486
/**
486487
* should use "light theme" (white background)?
487488
*/
488-
light: PropTypes.bool,
489+
light: deprecate(
490+
PropTypes.bool,
491+
'The `light` prop for `Combobox` has ' +
492+
'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'
493+
),
489494

490495
/**
491496
* `onChange` is a utility for this controlled component to communicate to a
@@ -575,7 +580,6 @@ ComboBox.defaultProps = {
575580
shouldFilterItem: defaultShouldFilterItem,
576581
type: 'default',
577582
ariaLabel: 'Choose an item',
578-
light: false,
579583
direction: 'bottom',
580584
};
581585

packages/react/src/components/ComboBox/ComboBox.stories.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ export default {
4646
options: ['sm', 'md', 'lg'],
4747
control: { type: 'select' },
4848
},
49+
light: {
50+
table: {
51+
disable: true,
52+
},
53+
},
4954
},
5055
parameters: {
5156
docs: {
@@ -173,11 +178,6 @@ Playground.argTypes = {
173178
disable: true,
174179
},
175180
},
176-
light: {
177-
table: {
178-
disable: true,
179-
},
180-
},
181181
onChange: {
182182
action: 'clicked',
183183
},

packages/react/src/components/DatePicker/DatePicker.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import DatePickerInput from '../DatePickerInput';
1414
import carbonFlatpickrAppendToPlugin from './plugins/appendToPlugin';
1515
import carbonFlatpickrFixEventsPlugin from './plugins/fixEventsPlugin';
1616
import carbonFlatpickrRangePlugin from './plugins/rangePlugin';
17+
import deprecate from '../../prop-types/deprecate';
1718
import { match, keys } from '../../internal/keyboard';
1819
import { usePrefix } from '../../internal/usePrefix';
1920
import { useSavedCallback } from '../../internal/useSavedCallback';
@@ -185,7 +186,7 @@ function DatePicker({
185186
disable,
186187
enable,
187188
inline,
188-
light = false,
189+
light,
189190
locale = 'en',
190191
maxDate,
191192
minDate,
@@ -529,8 +530,11 @@ DatePicker.propTypes = {
529530
/**
530531
* `true` to use the light version.
531532
*/
532-
light: PropTypes.bool,
533-
533+
light: deprecate(
534+
PropTypes.bool,
535+
'The `light` prop for `DatePicker` has ' +
536+
'been deprecated in favor of the new `Layer` component. It will be removed in the next major release.'
537+
),
534538
/**
535539
* The language locale used to format the days of the week, months, and numbers. The full list of supported locales can be found here https://github.com/flatpickr/flatpickr/tree/master/src/l10n
536540
*/

packages/react/src/components/DatePicker/DatePicker.stories.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ export default {
2424
page: mdx,
2525
},
2626
},
27+
argTypes: {
28+
light: {
29+
table: {
30+
disable: true,
31+
},
32+
},
33+
},
2734
};
2835

2936
export const Simple = () => (
@@ -244,11 +251,6 @@ Playground.argTypes = {
244251
disable: true,
245252
},
246253
},
247-
light: {
248-
table: {
249-
disable: true,
250-
},
251-
},
252254
locale: {
253255
table: {
254256
disable: true,

packages/react/src/components/Dropdown/Dropdown-test.e2e.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,6 @@ describe('Dropdown', () => {
5151
invalid
5252
invalidText="This is invalid text"
5353
/>
54-
<Dropdown style={style} items={items} label={label} light />
55-
<Dropdown
56-
style={style}
57-
items={items}
58-
label={label}
59-
light
60-
invalid
61-
invalidText="This is invalid text"
62-
/>
6354
<Dropdown style={style} items={items} label={label} type="inline" />
6455
<DropdownSkeleton style={style} size="sm" />
6556
<DropdownSkeleton style={style} size="md" />

0 commit comments

Comments
 (0)