@patternfly/react-core 4.192.1 → 4.192.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/dist/esm/components/DatePicker/DatePicker.d.ts +2 -0
- package/dist/esm/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/esm/components/DatePicker/DatePicker.js +7 -3
- package/dist/esm/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/esm/components/Select/Select.d.ts.map +1 -1
- package/dist/esm/components/Select/Select.js +2 -2
- package/dist/esm/components/Select/Select.js.map +1 -1
- package/dist/esm/components/Select/SelectOption.d.ts +2 -0
- package/dist/esm/components/Select/SelectOption.d.ts.map +1 -1
- package/dist/esm/components/Select/SelectOption.js +70 -48
- package/dist/esm/components/Select/SelectOption.js.map +1 -1
- package/dist/js/components/DatePicker/DatePicker.d.ts +2 -0
- package/dist/js/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/js/components/DatePicker/DatePicker.js +7 -3
- package/dist/js/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/js/components/Select/Select.d.ts.map +1 -1
- package/dist/js/components/Select/Select.js +2 -2
- package/dist/js/components/Select/Select.js.map +1 -1
- package/dist/js/components/Select/SelectOption.d.ts +2 -0
- package/dist/js/components/Select/SelectOption.d.ts.map +1 -1
- package/dist/js/components/Select/SelectOption.js +70 -48
- package/dist/js/components/Select/SelectOption.js.map +1 -1
- package/dist/umd/react-core.js +79 -53
- package/dist/umd/react-core.min.js +1 -1
- package/index.d.ts +4 -0
- package/package.json +5 -5
- package/src/components/BackToTop/examples/BackToTop.css +3 -3
- package/src/components/BackToTop/examples/BackToTop.md +1 -6
- package/src/components/BackToTop/examples/BackToTopBasic.tsx +4 -0
- package/src/components/Backdrop/examples/Backdrop.md +3 -12
- package/src/components/Backdrop/examples/BackdropBasic.tsx +4 -0
- package/src/components/Backdrop/examples/BackdropSpinner.tsx +10 -0
- package/src/components/BackgroundImage/examples/BackgroundImage.md +2 -21
- package/src/components/BackgroundImage/examples/BackgroundImageBasic.tsx +15 -0
- package/src/components/Badge/examples/Badge.md +3 -24
- package/src/components/Badge/examples/BadgeRead.tsx +19 -0
- package/src/components/Badge/examples/BadgeUnread.tsx +8 -0
- package/src/components/Banner/examples/Banner.md +1 -14
- package/src/components/Banner/examples/BannerBasic.tsx +16 -0
- package/src/components/Brand/examples/Brand.md +3 -5
- package/src/components/Brand/examples/BrandBasic.tsx +5 -0
- package/src/components/Breadcrumb/examples/Breadcrumb.md +4 -105
- package/src/components/Breadcrumb/examples/BreadcrumbBasic.tsx +13 -0
- package/src/components/Breadcrumb/examples/BreadcrumbDropdown.tsx +53 -0
- package/src/components/Breadcrumb/examples/BreadcrumbWithHeading.tsx +12 -0
- package/src/components/Breadcrumb/examples/BreadcrumbWithoutHomeLink.tsx +15 -0
- package/src/components/Button/examples/ButtonAriaDisabled.tsx +33 -37
- package/src/components/Button/examples/ButtonCallToAction.tsx +8 -6
- package/src/components/Button/examples/ButtonDisabled.tsx +33 -37
- package/src/components/Button/examples/ButtonInlineSpanLink.tsx +2 -2
- package/src/components/Button/examples/ButtonLinks.tsx +6 -6
- package/src/components/Button/examples/ButtonProgress.tsx +8 -5
- package/src/components/Button/examples/ButtonSmall.tsx +9 -7
- package/src/components/Button/examples/ButtonTypes.tsx +4 -6
- package/src/components/Button/examples/ButtonVariations.tsx +31 -36
- package/src/components/DatePicker/DatePicker.tsx +10 -2
- package/src/components/DatePicker/examples/DatePicker.md +4 -1
- package/src/components/JumpLinks/examples/JumpLinks.md +0 -1
- package/src/components/Select/Select.tsx +2 -1
- package/src/components/Select/SelectOption.tsx +188 -133
- package/src/demos/JumpLinks.md +0 -1
|
@@ -69,6 +69,8 @@ export interface SelectOptionProps extends Omit<React.HTMLProps<HTMLElement>, 't
|
|
|
69
69
|
setViewMoreNextIndex?: () => void;
|
|
70
70
|
/** @hide Flag indicating this is the last option when there is a footer */
|
|
71
71
|
isLastOptionBeforeFooter?: (index: number) => boolean;
|
|
72
|
+
/** @hide Flag indicating that the the option loading variant is in a grouped select */
|
|
73
|
+
isGrouped?: boolean;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
export class SelectOption extends React.Component<SelectOptionProps> {
|
|
@@ -182,6 +184,7 @@ export class SelectOption extends React.Component<SelectOptionProps> {
|
|
|
182
184
|
setViewMoreNextIndex,
|
|
183
185
|
// eslint-disable-next-line no-console
|
|
184
186
|
isLastOptionBeforeFooter,
|
|
187
|
+
isGrouped = false,
|
|
185
188
|
...props
|
|
186
189
|
} = this.props;
|
|
187
190
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
@@ -228,166 +231,218 @@ export class SelectOption extends React.Component<SelectOptionProps> {
|
|
|
228
231
|
onClick(event);
|
|
229
232
|
};
|
|
230
233
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
{description && (
|
|
281
|
-
<React.Fragment>
|
|
282
|
-
<span className={css(styles.selectMenuItemMain)}>
|
|
283
|
-
{itemDisplay}
|
|
284
|
-
{isSelected && (
|
|
285
|
-
<span className={css(styles.selectMenuItemIcon)}>
|
|
286
|
-
<CheckIcon aria-hidden />
|
|
287
|
-
</span>
|
|
288
|
-
)}
|
|
289
|
-
</span>
|
|
290
|
-
<span className={css(styles.selectMenuItemDescription)}>{description}</span>
|
|
291
|
-
</React.Fragment>
|
|
292
|
-
)}
|
|
293
|
-
{!description && (
|
|
294
|
-
<React.Fragment>
|
|
295
|
-
{itemDisplay}
|
|
296
|
-
{isSelected && (
|
|
297
|
-
<span className={css(styles.selectMenuItemIcon)}>
|
|
298
|
-
<CheckIcon aria-hidden />
|
|
299
|
-
</span>
|
|
300
|
-
)}
|
|
301
|
-
</React.Fragment>
|
|
302
|
-
)}
|
|
303
|
-
</Component>
|
|
304
|
-
{isFavorite !== null && id && favoriteButton(onFavorite)}
|
|
305
|
-
</>
|
|
306
|
-
)}
|
|
307
|
-
</li>
|
|
234
|
+
const renderOption = (
|
|
235
|
+
onSelect: (
|
|
236
|
+
event: React.MouseEvent<any, MouseEvent> | React.ChangeEvent<HTMLInputElement>,
|
|
237
|
+
value: string | SelectOptionObject,
|
|
238
|
+
isPlaceholder?: boolean
|
|
239
|
+
) => void,
|
|
240
|
+
onClose: () => void,
|
|
241
|
+
variant: string,
|
|
242
|
+
inputIdPrefix: string,
|
|
243
|
+
onFavorite: (itemId: string, isFavorite: boolean) => void
|
|
244
|
+
) => {
|
|
245
|
+
if (variant !== SelectVariant.checkbox && isLoading && isGrouped) {
|
|
246
|
+
return (
|
|
247
|
+
<div
|
|
248
|
+
role="presentation"
|
|
249
|
+
className={css(styles.selectListItem, isLoading && styles.modifiers.loading, className)}
|
|
250
|
+
>
|
|
251
|
+
{children}
|
|
252
|
+
</div>
|
|
253
|
+
);
|
|
254
|
+
} else if (variant !== SelectVariant.checkbox && isLoad && isGrouped) {
|
|
255
|
+
return (
|
|
256
|
+
<div>
|
|
257
|
+
<button
|
|
258
|
+
{...props}
|
|
259
|
+
role="presentation"
|
|
260
|
+
className={css(styles.selectMenuItem, styles.modifiers.load, className)}
|
|
261
|
+
onClick={(event: any) => {
|
|
262
|
+
onViewMoreClick(event);
|
|
263
|
+
event.stopPropagation();
|
|
264
|
+
}}
|
|
265
|
+
ref={this.ref}
|
|
266
|
+
type="button"
|
|
267
|
+
>
|
|
268
|
+
{children || value.toString()}
|
|
269
|
+
</button>
|
|
270
|
+
</div>
|
|
271
|
+
);
|
|
272
|
+
} else if (variant !== SelectVariant.checkbox) {
|
|
273
|
+
return (
|
|
274
|
+
<li
|
|
275
|
+
id={generatedId}
|
|
276
|
+
role="presentation"
|
|
277
|
+
className={css(
|
|
278
|
+
isLoading && styles.selectListItem,
|
|
279
|
+
!isLoad && !isLoading && styles.selectMenuWrapper,
|
|
280
|
+
isFavorite && styles.modifiers.favorite,
|
|
281
|
+
isFocused && styles.modifiers.focus,
|
|
282
|
+
isLoading && styles.modifiers.loading
|
|
308
283
|
)}
|
|
309
|
-
{
|
|
284
|
+
ref={this.liRef}
|
|
285
|
+
>
|
|
286
|
+
{isLoading && children}
|
|
287
|
+
{isLoad && !isGrouped && (
|
|
310
288
|
<button
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
styles.modifiers.load,
|
|
314
|
-
isFocused && styles.modifiers.focus,
|
|
315
|
-
className
|
|
316
|
-
)}
|
|
317
|
-
onKeyDown={(event: React.KeyboardEvent) => {
|
|
318
|
-
this.onKeyDown(event, 0, undefined, true);
|
|
319
|
-
}}
|
|
289
|
+
{...props}
|
|
290
|
+
className={css(styles.selectMenuItem, styles.modifiers.load, className)}
|
|
320
291
|
onClick={(event: any) => {
|
|
321
292
|
onViewMoreClick(event);
|
|
322
293
|
event.stopPropagation();
|
|
323
294
|
}}
|
|
324
295
|
ref={this.ref}
|
|
296
|
+
type="button"
|
|
325
297
|
>
|
|
326
|
-
{
|
|
298
|
+
{itemDisplay}
|
|
327
299
|
</button>
|
|
328
300
|
)}
|
|
329
|
-
{
|
|
330
|
-
|
|
331
|
-
{children}
|
|
332
|
-
</div>
|
|
333
|
-
)}
|
|
334
|
-
{variant === SelectVariant.checkbox && !isNoResultsOption && !isLoading && !isLoad && (
|
|
335
|
-
<label
|
|
336
|
-
{...props}
|
|
337
|
-
className={css(
|
|
338
|
-
checkStyles.check,
|
|
339
|
-
styles.selectMenuItem,
|
|
340
|
-
isDisabled && styles.modifiers.disabled,
|
|
341
|
-
description && styles.modifiers.description,
|
|
342
|
-
className
|
|
343
|
-
)}
|
|
344
|
-
onKeyDown={(event: React.KeyboardEvent) => {
|
|
345
|
-
this.onKeyDown(event, 0, undefined, true);
|
|
346
|
-
}}
|
|
347
|
-
>
|
|
348
|
-
<input
|
|
349
|
-
id={inputId || `${inputIdPrefix}-${value.toString()}`}
|
|
350
|
-
className={css(checkStyles.checkInput)}
|
|
351
|
-
type="checkbox"
|
|
352
|
-
onChange={event => {
|
|
353
|
-
if (!isDisabled) {
|
|
354
|
-
onClick(event);
|
|
355
|
-
onSelect(event, value);
|
|
356
|
-
}
|
|
357
|
-
}}
|
|
358
|
-
ref={this.ref}
|
|
359
|
-
checked={isChecked || false}
|
|
360
|
-
disabled={isDisabled}
|
|
361
|
-
/>
|
|
362
|
-
<span className={css(checkStyles.checkLabel, isDisabled && styles.modifiers.disabled)}>
|
|
363
|
-
{itemDisplay}
|
|
364
|
-
</span>
|
|
365
|
-
{description && <div className={css(checkStyles.checkDescription)}>{description}</div>}
|
|
366
|
-
</label>
|
|
367
|
-
)}
|
|
368
|
-
{variant === SelectVariant.checkbox && isNoResultsOption && !isLoading && !isLoad && (
|
|
369
|
-
<div>
|
|
301
|
+
{!isLoading && !isLoad && (
|
|
302
|
+
<>
|
|
370
303
|
<Component
|
|
371
304
|
{...props}
|
|
372
305
|
className={css(
|
|
373
306
|
styles.selectMenuItem,
|
|
307
|
+
isLoad && styles.modifiers.load,
|
|
374
308
|
isSelected && styles.modifiers.selected,
|
|
375
309
|
isDisabled && styles.modifiers.disabled,
|
|
310
|
+
description && styles.modifiers.description,
|
|
311
|
+
isFavorite !== null && styles.modifiers.link,
|
|
376
312
|
className
|
|
377
313
|
)}
|
|
314
|
+
onClick={(event: any) => {
|
|
315
|
+
if (!isDisabled) {
|
|
316
|
+
onClick(event);
|
|
317
|
+
onSelect(event, value, isPlaceholder);
|
|
318
|
+
onClose();
|
|
319
|
+
}
|
|
320
|
+
}}
|
|
378
321
|
role="option"
|
|
379
322
|
aria-selected={isSelected || null}
|
|
380
323
|
ref={this.ref}
|
|
381
324
|
onKeyDown={(event: React.KeyboardEvent) => {
|
|
382
|
-
this.onKeyDown(event, 0
|
|
325
|
+
this.onKeyDown(event, 0);
|
|
383
326
|
}}
|
|
384
327
|
type="button"
|
|
385
328
|
>
|
|
386
|
-
{
|
|
329
|
+
{description && (
|
|
330
|
+
<React.Fragment>
|
|
331
|
+
<span className={css(styles.selectMenuItemMain)}>
|
|
332
|
+
{itemDisplay}
|
|
333
|
+
{isSelected && (
|
|
334
|
+
<span className={css(styles.selectMenuItemIcon)}>
|
|
335
|
+
<CheckIcon aria-hidden />
|
|
336
|
+
</span>
|
|
337
|
+
)}
|
|
338
|
+
</span>
|
|
339
|
+
<span className={css(styles.selectMenuItemDescription)}>{description}</span>
|
|
340
|
+
</React.Fragment>
|
|
341
|
+
)}
|
|
342
|
+
{!description && (
|
|
343
|
+
<React.Fragment>
|
|
344
|
+
{itemDisplay}
|
|
345
|
+
{isSelected && (
|
|
346
|
+
<span className={css(styles.selectMenuItemIcon)}>
|
|
347
|
+
<CheckIcon aria-hidden />
|
|
348
|
+
</span>
|
|
349
|
+
)}
|
|
350
|
+
</React.Fragment>
|
|
351
|
+
)}
|
|
387
352
|
</Component>
|
|
388
|
-
|
|
353
|
+
{isFavorite !== null && id && favoriteButton(onFavorite)}
|
|
354
|
+
</>
|
|
355
|
+
)}
|
|
356
|
+
</li>
|
|
357
|
+
);
|
|
358
|
+
} else if (variant === SelectVariant.checkbox && isLoad) {
|
|
359
|
+
return (
|
|
360
|
+
<button
|
|
361
|
+
className={css(
|
|
362
|
+
styles.selectMenuItem,
|
|
363
|
+
styles.modifiers.load,
|
|
364
|
+
isFocused && styles.modifiers.focus,
|
|
365
|
+
className
|
|
366
|
+
)}
|
|
367
|
+
onKeyDown={(event: React.KeyboardEvent) => {
|
|
368
|
+
this.onKeyDown(event, 0, undefined, true);
|
|
369
|
+
}}
|
|
370
|
+
onClick={(event: any) => {
|
|
371
|
+
onViewMoreClick(event);
|
|
372
|
+
event.stopPropagation();
|
|
373
|
+
}}
|
|
374
|
+
ref={this.ref}
|
|
375
|
+
>
|
|
376
|
+
{children || (value && value.toString && value.toString())}
|
|
377
|
+
</button>
|
|
378
|
+
);
|
|
379
|
+
} else if (variant === SelectVariant.checkbox && isLoading) {
|
|
380
|
+
return (
|
|
381
|
+
<div className={css(styles.selectListItem, isLoading && styles.modifiers.loading, className)}>{children}</div>
|
|
382
|
+
);
|
|
383
|
+
} else if (variant === SelectVariant.checkbox && !isNoResultsOption && !isLoading && !isLoad) {
|
|
384
|
+
return (
|
|
385
|
+
<label
|
|
386
|
+
{...props}
|
|
387
|
+
className={css(
|
|
388
|
+
checkStyles.check,
|
|
389
|
+
styles.selectMenuItem,
|
|
390
|
+
isDisabled && styles.modifiers.disabled,
|
|
391
|
+
description && styles.modifiers.description,
|
|
392
|
+
className
|
|
389
393
|
)}
|
|
390
|
-
|
|
394
|
+
onKeyDown={(event: React.KeyboardEvent) => {
|
|
395
|
+
this.onKeyDown(event, 0, undefined, true);
|
|
396
|
+
}}
|
|
397
|
+
>
|
|
398
|
+
<input
|
|
399
|
+
id={inputId || `${inputIdPrefix}-${value.toString()}`}
|
|
400
|
+
className={css(checkStyles.checkInput)}
|
|
401
|
+
type="checkbox"
|
|
402
|
+
onChange={event => {
|
|
403
|
+
if (!isDisabled) {
|
|
404
|
+
onClick(event);
|
|
405
|
+
onSelect(event, value);
|
|
406
|
+
}
|
|
407
|
+
}}
|
|
408
|
+
ref={this.ref}
|
|
409
|
+
checked={isChecked || false}
|
|
410
|
+
disabled={isDisabled}
|
|
411
|
+
/>
|
|
412
|
+
<span className={css(checkStyles.checkLabel, isDisabled && styles.modifiers.disabled)}>{itemDisplay}</span>
|
|
413
|
+
{description && <div className={css(checkStyles.checkDescription)}>{description}</div>}
|
|
414
|
+
</label>
|
|
415
|
+
);
|
|
416
|
+
} else if (variant === SelectVariant.checkbox && isNoResultsOption && !isLoading && !isLoad) {
|
|
417
|
+
return (
|
|
418
|
+
<div>
|
|
419
|
+
<Component
|
|
420
|
+
{...props}
|
|
421
|
+
className={css(
|
|
422
|
+
styles.selectMenuItem,
|
|
423
|
+
isSelected && styles.modifiers.selected,
|
|
424
|
+
isDisabled && styles.modifiers.disabled,
|
|
425
|
+
className
|
|
426
|
+
)}
|
|
427
|
+
role="option"
|
|
428
|
+
aria-selected={isSelected || null}
|
|
429
|
+
ref={this.ref}
|
|
430
|
+
onKeyDown={(event: React.KeyboardEvent) => {
|
|
431
|
+
this.onKeyDown(event, 0, undefined, true);
|
|
432
|
+
}}
|
|
433
|
+
type="button"
|
|
434
|
+
>
|
|
435
|
+
{itemDisplay}
|
|
436
|
+
</Component>
|
|
437
|
+
</div>
|
|
438
|
+
);
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
return (
|
|
443
|
+
<SelectConsumer>
|
|
444
|
+
{({ onSelect, onClose, variant, inputIdPrefix, onFavorite }) => (
|
|
445
|
+
<React.Fragment>{renderOption(onSelect, onClose, variant, inputIdPrefix, onFavorite)}</React.Fragment>
|
|
391
446
|
)}
|
|
392
447
|
</SelectConsumer>
|
|
393
448
|
);
|