@patternfly/react-core 4.243.0 → 4.243.1

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 CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [4.243.1](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@4.243.0...@patternfly/react-core@4.243.1) (2022-09-29)
7
+
8
+ **Note:** Version bump only for package @patternfly/react-core
9
+
10
+
11
+
12
+
13
+
6
14
  # [4.243.0](https://github.com/patternfly/patternfly-react/compare/@patternfly/react-core@4.242.8...@patternfly/react-core@4.243.0) (2022-09-29)
7
15
 
8
16
 
@@ -1296,41 +1296,6 @@ textarea.pf-c-form-control {
1296
1296
  display: none !important;
1297
1297
  }
1298
1298
  }
1299
- .pf-c-back-to-top {
1300
- --pf-c-back-to-top--Right: var(--pf-global--spacer--2xl);
1301
- --pf-c-back-to-top--Bottom: var(--pf-global--spacer--lg);
1302
- --pf-c-back-to-top--md--Bottom: var(--pf-global--spacer--2xl);
1303
- --pf-c-back-to-top--c-button--FontSize: var(--pf-global--FontSize--xs);
1304
- --pf-c-back-to-top--c-button--BorderRadius: var(--pf-global--BorderRadius--lg);
1305
- --pf-c-back-to-top--c-button--PaddingTop: var(--pf-global--spacer--xs);
1306
- --pf-c-back-to-top--c-button--PaddingRight: var(--pf-global--spacer--sm);
1307
- --pf-c-back-to-top--c-button--PaddingBottom: var(--pf-global--spacer--xs);
1308
- --pf-c-back-to-top--c-button--PaddingLeft: var(--pf-global--spacer--sm);
1309
- --pf-c-back-to-top--c-button--BoxShadow: var(--pf-global--BoxShadow--lg-bottom);
1310
- position: absolute;
1311
- right: var(--pf-c-back-to-top--Right);
1312
- bottom: var(--pf-c-back-to-top--Bottom);
1313
- }
1314
-
1315
- @media (min-width: 768px) {
1316
- .pf-c-back-to-top {
1317
- --pf-c-back-to-top--Bottom: var(--pf-c-back-to-top--md--Bottom);
1318
- }
1319
- }
1320
- .pf-c-back-to-top.pf-m-hidden {
1321
- display: none;
1322
- }
1323
-
1324
- .pf-c-back-to-top .pf-c-button {
1325
- --pf-c-button--FontSize: var(--pf-c-back-to-top--c-button--FontSize);
1326
- --pf-c-button--BorderRadius: var(--pf-c-back-to-top--c-button--BorderRadius);
1327
- --pf-c-button--PaddingTop: var(--pf-c-back-to-top--c-button--PaddingTop);
1328
- --pf-c-button--PaddingRight: var(--pf-c-back-to-top--c-button--PaddingRight);
1329
- --pf-c-button--PaddingBottom: var(--pf-c-back-to-top--c-button--PaddingBottom);
1330
- --pf-c-button--PaddingLeft: var(--pf-c-back-to-top--c-button--PaddingLeft);
1331
- box-shadow: var(--pf-c-back-to-top--c-button--BoxShadow);
1332
- }
1333
-
1334
1299
  .pf-c-avatar {
1335
1300
  --pf-c-avatar--BorderColor: transparent;
1336
1301
  --pf-c-avatar--BorderWidth: 0;
@@ -1585,6 +1550,41 @@ textarea.pf-c-form-control {
1585
1550
  --pf-c-avatar--Height: var(--pf-c-avatar--m-xl--Height-on-2xl, var(--pf-c-avatar--m-xl--Height-on-xl, var(--pf-c-avatar--m-xl--Height-on-lg, var(--pf-c-avatar--m-xl--Height-on-md, var(--pf-c-avatar--m-xl--Height-on-sm, var(--pf-c-avatar--m-xl--Height))))));
1586
1551
  }
1587
1552
  }
1553
+ .pf-c-back-to-top {
1554
+ --pf-c-back-to-top--Right: var(--pf-global--spacer--2xl);
1555
+ --pf-c-back-to-top--Bottom: var(--pf-global--spacer--lg);
1556
+ --pf-c-back-to-top--md--Bottom: var(--pf-global--spacer--2xl);
1557
+ --pf-c-back-to-top--c-button--FontSize: var(--pf-global--FontSize--xs);
1558
+ --pf-c-back-to-top--c-button--BorderRadius: var(--pf-global--BorderRadius--lg);
1559
+ --pf-c-back-to-top--c-button--PaddingTop: var(--pf-global--spacer--xs);
1560
+ --pf-c-back-to-top--c-button--PaddingRight: var(--pf-global--spacer--sm);
1561
+ --pf-c-back-to-top--c-button--PaddingBottom: var(--pf-global--spacer--xs);
1562
+ --pf-c-back-to-top--c-button--PaddingLeft: var(--pf-global--spacer--sm);
1563
+ --pf-c-back-to-top--c-button--BoxShadow: var(--pf-global--BoxShadow--lg-bottom);
1564
+ position: absolute;
1565
+ right: var(--pf-c-back-to-top--Right);
1566
+ bottom: var(--pf-c-back-to-top--Bottom);
1567
+ }
1568
+
1569
+ @media (min-width: 768px) {
1570
+ .pf-c-back-to-top {
1571
+ --pf-c-back-to-top--Bottom: var(--pf-c-back-to-top--md--Bottom);
1572
+ }
1573
+ }
1574
+ .pf-c-back-to-top.pf-m-hidden {
1575
+ display: none;
1576
+ }
1577
+
1578
+ .pf-c-back-to-top .pf-c-button {
1579
+ --pf-c-button--FontSize: var(--pf-c-back-to-top--c-button--FontSize);
1580
+ --pf-c-button--BorderRadius: var(--pf-c-back-to-top--c-button--BorderRadius);
1581
+ --pf-c-button--PaddingTop: var(--pf-c-back-to-top--c-button--PaddingTop);
1582
+ --pf-c-button--PaddingRight: var(--pf-c-back-to-top--c-button--PaddingRight);
1583
+ --pf-c-button--PaddingBottom: var(--pf-c-back-to-top--c-button--PaddingBottom);
1584
+ --pf-c-button--PaddingLeft: var(--pf-c-back-to-top--c-button--PaddingLeft);
1585
+ box-shadow: var(--pf-c-back-to-top--c-button--BoxShadow);
1586
+ }
1587
+
1588
1588
  .pf-c-background-image {
1589
1589
  --pf-c-background-image--BackgroundColor: var(--pf-global--BackgroundColor--dark-100);
1590
1590
  --pf-c-background-image--BackgroundImage: url("../../assets/images/pfbg_576.jpg");
@@ -19332,166 +19332,6 @@ svg.pf-c-spinner.pf-m-xl {
19332
19332
  transform: rotate(720deg);
19333
19333
  }
19334
19334
  }
19335
- .pf-c-switch {
19336
- --pf-c-switch--FontSize: var(--pf-global--FontSize--md);
19337
- --pf-c-switch__label--PaddingLeft: var(--pf-global--spacer--md);
19338
- --pf-c-switch--ColumnGap: var(--pf-c-switch__label--PaddingLeft);
19339
- --pf-c-switch__toggle-icon--FontSize: calc(var(--pf-c-switch--FontSize) * .625);
19340
- --pf-c-switch__toggle-icon--Color: var(--pf-global--Color--light-100);
19341
- --pf-c-switch__toggle-icon--Left: calc(var(--pf-c-switch--FontSize) * .4);
19342
- --pf-c-switch__toggle-icon--Offset: 0.125rem;
19343
- --pf-c-switch--LineHeight: var(--pf-global--LineHeight--md);
19344
- --pf-c-switch--Height: auto;
19345
- --pf-c-switch__input--checked__toggle--BackgroundColor: var(--pf-global--primary-color--100);
19346
- --pf-c-switch__input--checked__toggle--before--TranslateX: calc(100% + var(--pf-c-switch__toggle-icon--Offset));
19347
- --pf-c-switch__input--checked__label--Color: var(--pf-global--Color--dark-100);
19348
- --pf-c-switch__input--not-checked__label--Color: var(--pf-global--disabled-color--100);
19349
- --pf-c-switch__input--disabled__label--Color: var(--pf-global--disabled-color--100);
19350
- --pf-c-switch__input--disabled__toggle--BackgroundColor: var(--pf-global--disabled-color--200);
19351
- --pf-c-switch__input--disabled__toggle--before--BackgroundColor: var(--pf-global--palette--black-150);
19352
- --pf-c-switch__input--focus__toggle--OutlineWidth: var(--pf-global--BorderWidth--md);
19353
- --pf-c-switch__input--focus__toggle--OutlineOffset: var(--pf-global--spacer--sm);
19354
- --pf-c-switch__input--focus__toggle--OutlineColor: var(--pf-global--primary-color--100);
19355
- --pf-c-switch__toggle--Height: calc(var(--pf-c-switch--FontSize) * var(--pf-c-switch--LineHeight));
19356
- --pf-c-switch__toggle--BackgroundColor: var(--pf-global--palette--black-500);
19357
- --pf-c-switch__toggle--BorderRadius: var(--pf-c-switch__toggle--Height);
19358
- --pf-c-switch__toggle--before--Width: calc(var(--pf-c-switch--FontSize) - var(--pf-c-switch__toggle-icon--Offset));
19359
- --pf-c-switch__toggle--before--Height: var(--pf-c-switch__toggle--before--Width);
19360
- --pf-c-switch__toggle--before--Top: calc((var(--pf-c-switch__toggle--Height) - var(--pf-c-switch__toggle--before--Height)) / 2);
19361
- --pf-c-switch__toggle--before--Left: var(--pf-c-switch__toggle--before--Top);
19362
- --pf-c-switch__toggle--before--BackgroundColor: var(--pf-global--BackgroundColor--100);
19363
- --pf-c-switch__toggle--before--BorderRadius: var(--pf-global--BorderRadius--lg);
19364
- --pf-c-switch__toggle--before--BoxShadow: var(--pf-global--BoxShadow--md);
19365
- --pf-c-switch__toggle--before--Transition: transform .25s ease 0s;
19366
- --pf-c-switch__toggle--Width: calc(var(--pf-c-switch__toggle--Height) + var(--pf-c-switch__toggle-icon--Offset) + var(--pf-c-switch__toggle--before--Width));
19367
- --pf-c-switch__label--Color: var(--pf-global--Color--dark-100);
19368
- position: relative;
19369
- display: inline-grid;
19370
- grid-template-columns: auto;
19371
- grid-auto-columns: 1fr;
19372
- column-gap: var(--pf-c-switch--ColumnGap);
19373
- height: var(--pf-c-switch--Height);
19374
- font-size: var(--pf-c-switch--FontSize);
19375
- line-height: var(--pf-c-switch--LineHeight);
19376
- vertical-align: middle;
19377
- cursor: pointer;
19378
- }
19379
-
19380
- .pf-c-switch.pf-m-reverse .pf-c-switch__label,
19381
- .pf-c-switch.pf-m-reverse .pf-c-switch__toggle {
19382
- grid-row: 1;
19383
- }
19384
-
19385
- .pf-c-switch.pf-m-reverse .pf-c-switch__label {
19386
- grid-column: 1;
19387
- }
19388
-
19389
- .pf-c-switch__input {
19390
- position: absolute;
19391
- cursor: pointer;
19392
- opacity: 0;
19393
- }
19394
-
19395
- .pf-c-switch__input:focus ~ .pf-c-switch__toggle {
19396
- outline: var(--pf-c-switch__input--focus__toggle--OutlineWidth) solid var(--pf-c-switch__input--focus__toggle--OutlineColor);
19397
- outline-offset: var(--pf-c-switch__input--focus__toggle--OutlineOffset);
19398
- }
19399
-
19400
- .pf-c-switch__input:checked ~ .pf-c-switch__label {
19401
- color: var(--pf-c-switch__input--checked__label--Color);
19402
- }
19403
-
19404
- .pf-c-switch__input:checked ~ .pf-c-switch__toggle {
19405
- background-color: var(--pf-c-switch__input--checked__toggle--BackgroundColor);
19406
- }
19407
-
19408
- .pf-c-switch__input:checked ~ .pf-c-switch__toggle::before {
19409
- transform: translateX(var(--pf-c-switch__input--checked__toggle--before--TranslateX));
19410
- }
19411
-
19412
- .pf-c-switch__input:checked ~ .pf-m-off {
19413
- display: none;
19414
- }
19415
-
19416
- .pf-c-switch__input:not(:checked) ~ .pf-c-switch__label {
19417
- color: var(--pf-c-switch__input--not-checked__label--Color);
19418
- }
19419
-
19420
- .pf-c-switch__input:not(:checked) ~ .pf-c-switch__toggle .pf-c-switch__toggle-icon {
19421
- display: none;
19422
- visibility: hidden;
19423
- }
19424
-
19425
- .pf-c-switch__input:not(:checked) ~ .pf-m-on {
19426
- display: none;
19427
- }
19428
-
19429
- .pf-c-switch__input:disabled {
19430
- cursor: not-allowed;
19431
- }
19432
-
19433
- .pf-c-switch__input:disabled ~ .pf-c-switch__label {
19434
- color: var(--pf-c-switch__input--disabled__label--Color);
19435
- cursor: not-allowed;
19436
- }
19437
-
19438
- .pf-c-switch__input:disabled ~ .pf-c-switch__toggle {
19439
- cursor: not-allowed;
19440
- background-color: var(--pf-c-switch__input--disabled__toggle--BackgroundColor);
19441
- }
19442
-
19443
- .pf-c-switch__input:disabled ~ .pf-c-switch__toggle::before {
19444
- background-color: var(--pf-c-switch__input--disabled__toggle--before--BackgroundColor);
19445
- }
19446
-
19447
- .pf-c-switch__toggle {
19448
- position: relative;
19449
- display: inline-block;
19450
- width: var(--pf-c-switch__toggle--Width);
19451
- height: var(--pf-c-switch__toggle--Height);
19452
- background-color: var(--pf-c-switch__toggle--BackgroundColor);
19453
- border-radius: var(--pf-c-switch__toggle--BorderRadius);
19454
- }
19455
-
19456
- .pf-c-switch__toggle::before {
19457
- position: absolute;
19458
- top: var(--pf-c-switch__toggle--before--Top);
19459
- left: var(--pf-c-switch__toggle--before--Left);
19460
- display: block;
19461
- width: var(--pf-c-switch__toggle--before--Width);
19462
- height: var(--pf-c-switch__toggle--before--Height);
19463
- content: "";
19464
- background-color: var(--pf-c-switch__toggle--before--BackgroundColor);
19465
- border-radius: var(--pf-c-switch__toggle--before--BorderRadius);
19466
- box-shadow: var(--pf-c-switch__toggle--before--BoxShadow);
19467
- transition: var(--pf-c-switch__toggle--before--Transition);
19468
- }
19469
-
19470
- .pf-c-switch__toggle-icon {
19471
- position: absolute;
19472
- top: 0;
19473
- bottom: 0;
19474
- left: var(--pf-c-switch__toggle-icon--Left);
19475
- display: flex;
19476
- align-items: center;
19477
- font-size: var(--pf-c-switch__toggle-icon--FontSize);
19478
- color: var(--pf-c-switch__toggle-icon--Color);
19479
- }
19480
-
19481
- .pf-c-switch__label {
19482
- display: inline-block;
19483
- grid-column: 2;
19484
- color: var(--pf-c-switch__label--Color);
19485
- vertical-align: top;
19486
- }
19487
-
19488
- :where(.pf-theme-dark) .pf-c-switch {
19489
- --pf-c-switch__toggle-icon--Color: var(--pf-global--BackgroundColor--100);
19490
- --pf-c-switch__input--not-checked__label--Color: var(--pf-global--Color--100);
19491
- --pf-c-switch__input--disabled__toggle--before--BackgroundColor: var(--pf-global--disabled-color--100);
19492
- --pf-c-switch__toggle--before--BoxShadow: none;
19493
- }
19494
-
19495
19335
  .pf-c-tabs {
19496
19336
  --pf-c-tabs--inset: 0;
19497
19337
  --pf-c-tabs--Width: auto;
@@ -20501,6 +20341,166 @@ svg.pf-c-spinner.pf-m-xl {
20501
20341
  --pf-c-tab-content__body--PaddingLeft: var(--pf-c-tab-content__body--m-padding--PaddingLeft);
20502
20342
  }
20503
20343
 
20344
+ .pf-c-switch {
20345
+ --pf-c-switch--FontSize: var(--pf-global--FontSize--md);
20346
+ --pf-c-switch__label--PaddingLeft: var(--pf-global--spacer--md);
20347
+ --pf-c-switch--ColumnGap: var(--pf-c-switch__label--PaddingLeft);
20348
+ --pf-c-switch__toggle-icon--FontSize: calc(var(--pf-c-switch--FontSize) * .625);
20349
+ --pf-c-switch__toggle-icon--Color: var(--pf-global--Color--light-100);
20350
+ --pf-c-switch__toggle-icon--Left: calc(var(--pf-c-switch--FontSize) * .4);
20351
+ --pf-c-switch__toggle-icon--Offset: 0.125rem;
20352
+ --pf-c-switch--LineHeight: var(--pf-global--LineHeight--md);
20353
+ --pf-c-switch--Height: auto;
20354
+ --pf-c-switch__input--checked__toggle--BackgroundColor: var(--pf-global--primary-color--100);
20355
+ --pf-c-switch__input--checked__toggle--before--TranslateX: calc(100% + var(--pf-c-switch__toggle-icon--Offset));
20356
+ --pf-c-switch__input--checked__label--Color: var(--pf-global--Color--dark-100);
20357
+ --pf-c-switch__input--not-checked__label--Color: var(--pf-global--disabled-color--100);
20358
+ --pf-c-switch__input--disabled__label--Color: var(--pf-global--disabled-color--100);
20359
+ --pf-c-switch__input--disabled__toggle--BackgroundColor: var(--pf-global--disabled-color--200);
20360
+ --pf-c-switch__input--disabled__toggle--before--BackgroundColor: var(--pf-global--palette--black-150);
20361
+ --pf-c-switch__input--focus__toggle--OutlineWidth: var(--pf-global--BorderWidth--md);
20362
+ --pf-c-switch__input--focus__toggle--OutlineOffset: var(--pf-global--spacer--sm);
20363
+ --pf-c-switch__input--focus__toggle--OutlineColor: var(--pf-global--primary-color--100);
20364
+ --pf-c-switch__toggle--Height: calc(var(--pf-c-switch--FontSize) * var(--pf-c-switch--LineHeight));
20365
+ --pf-c-switch__toggle--BackgroundColor: var(--pf-global--palette--black-500);
20366
+ --pf-c-switch__toggle--BorderRadius: var(--pf-c-switch__toggle--Height);
20367
+ --pf-c-switch__toggle--before--Width: calc(var(--pf-c-switch--FontSize) - var(--pf-c-switch__toggle-icon--Offset));
20368
+ --pf-c-switch__toggle--before--Height: var(--pf-c-switch__toggle--before--Width);
20369
+ --pf-c-switch__toggle--before--Top: calc((var(--pf-c-switch__toggle--Height) - var(--pf-c-switch__toggle--before--Height)) / 2);
20370
+ --pf-c-switch__toggle--before--Left: var(--pf-c-switch__toggle--before--Top);
20371
+ --pf-c-switch__toggle--before--BackgroundColor: var(--pf-global--BackgroundColor--100);
20372
+ --pf-c-switch__toggle--before--BorderRadius: var(--pf-global--BorderRadius--lg);
20373
+ --pf-c-switch__toggle--before--BoxShadow: var(--pf-global--BoxShadow--md);
20374
+ --pf-c-switch__toggle--before--Transition: transform .25s ease 0s;
20375
+ --pf-c-switch__toggle--Width: calc(var(--pf-c-switch__toggle--Height) + var(--pf-c-switch__toggle-icon--Offset) + var(--pf-c-switch__toggle--before--Width));
20376
+ --pf-c-switch__label--Color: var(--pf-global--Color--dark-100);
20377
+ position: relative;
20378
+ display: inline-grid;
20379
+ grid-template-columns: auto;
20380
+ grid-auto-columns: 1fr;
20381
+ column-gap: var(--pf-c-switch--ColumnGap);
20382
+ height: var(--pf-c-switch--Height);
20383
+ font-size: var(--pf-c-switch--FontSize);
20384
+ line-height: var(--pf-c-switch--LineHeight);
20385
+ vertical-align: middle;
20386
+ cursor: pointer;
20387
+ }
20388
+
20389
+ .pf-c-switch.pf-m-reverse .pf-c-switch__label,
20390
+ .pf-c-switch.pf-m-reverse .pf-c-switch__toggle {
20391
+ grid-row: 1;
20392
+ }
20393
+
20394
+ .pf-c-switch.pf-m-reverse .pf-c-switch__label {
20395
+ grid-column: 1;
20396
+ }
20397
+
20398
+ .pf-c-switch__input {
20399
+ position: absolute;
20400
+ cursor: pointer;
20401
+ opacity: 0;
20402
+ }
20403
+
20404
+ .pf-c-switch__input:focus ~ .pf-c-switch__toggle {
20405
+ outline: var(--pf-c-switch__input--focus__toggle--OutlineWidth) solid var(--pf-c-switch__input--focus__toggle--OutlineColor);
20406
+ outline-offset: var(--pf-c-switch__input--focus__toggle--OutlineOffset);
20407
+ }
20408
+
20409
+ .pf-c-switch__input:checked ~ .pf-c-switch__label {
20410
+ color: var(--pf-c-switch__input--checked__label--Color);
20411
+ }
20412
+
20413
+ .pf-c-switch__input:checked ~ .pf-c-switch__toggle {
20414
+ background-color: var(--pf-c-switch__input--checked__toggle--BackgroundColor);
20415
+ }
20416
+
20417
+ .pf-c-switch__input:checked ~ .pf-c-switch__toggle::before {
20418
+ transform: translateX(var(--pf-c-switch__input--checked__toggle--before--TranslateX));
20419
+ }
20420
+
20421
+ .pf-c-switch__input:checked ~ .pf-m-off {
20422
+ display: none;
20423
+ }
20424
+
20425
+ .pf-c-switch__input:not(:checked) ~ .pf-c-switch__label {
20426
+ color: var(--pf-c-switch__input--not-checked__label--Color);
20427
+ }
20428
+
20429
+ .pf-c-switch__input:not(:checked) ~ .pf-c-switch__toggle .pf-c-switch__toggle-icon {
20430
+ display: none;
20431
+ visibility: hidden;
20432
+ }
20433
+
20434
+ .pf-c-switch__input:not(:checked) ~ .pf-m-on {
20435
+ display: none;
20436
+ }
20437
+
20438
+ .pf-c-switch__input:disabled {
20439
+ cursor: not-allowed;
20440
+ }
20441
+
20442
+ .pf-c-switch__input:disabled ~ .pf-c-switch__label {
20443
+ color: var(--pf-c-switch__input--disabled__label--Color);
20444
+ cursor: not-allowed;
20445
+ }
20446
+
20447
+ .pf-c-switch__input:disabled ~ .pf-c-switch__toggle {
20448
+ cursor: not-allowed;
20449
+ background-color: var(--pf-c-switch__input--disabled__toggle--BackgroundColor);
20450
+ }
20451
+
20452
+ .pf-c-switch__input:disabled ~ .pf-c-switch__toggle::before {
20453
+ background-color: var(--pf-c-switch__input--disabled__toggle--before--BackgroundColor);
20454
+ }
20455
+
20456
+ .pf-c-switch__toggle {
20457
+ position: relative;
20458
+ display: inline-block;
20459
+ width: var(--pf-c-switch__toggle--Width);
20460
+ height: var(--pf-c-switch__toggle--Height);
20461
+ background-color: var(--pf-c-switch__toggle--BackgroundColor);
20462
+ border-radius: var(--pf-c-switch__toggle--BorderRadius);
20463
+ }
20464
+
20465
+ .pf-c-switch__toggle::before {
20466
+ position: absolute;
20467
+ top: var(--pf-c-switch__toggle--before--Top);
20468
+ left: var(--pf-c-switch__toggle--before--Left);
20469
+ display: block;
20470
+ width: var(--pf-c-switch__toggle--before--Width);
20471
+ height: var(--pf-c-switch__toggle--before--Height);
20472
+ content: "";
20473
+ background-color: var(--pf-c-switch__toggle--before--BackgroundColor);
20474
+ border-radius: var(--pf-c-switch__toggle--before--BorderRadius);
20475
+ box-shadow: var(--pf-c-switch__toggle--before--BoxShadow);
20476
+ transition: var(--pf-c-switch__toggle--before--Transition);
20477
+ }
20478
+
20479
+ .pf-c-switch__toggle-icon {
20480
+ position: absolute;
20481
+ top: 0;
20482
+ bottom: 0;
20483
+ left: var(--pf-c-switch__toggle-icon--Left);
20484
+ display: flex;
20485
+ align-items: center;
20486
+ font-size: var(--pf-c-switch__toggle-icon--FontSize);
20487
+ color: var(--pf-c-switch__toggle-icon--Color);
20488
+ }
20489
+
20490
+ .pf-c-switch__label {
20491
+ display: inline-block;
20492
+ grid-column: 2;
20493
+ color: var(--pf-c-switch__label--Color);
20494
+ vertical-align: top;
20495
+ }
20496
+
20497
+ :where(.pf-theme-dark) .pf-c-switch {
20498
+ --pf-c-switch__toggle-icon--Color: var(--pf-global--BackgroundColor--100);
20499
+ --pf-c-switch__input--not-checked__label--Color: var(--pf-global--Color--100);
20500
+ --pf-c-switch__input--disabled__toggle--before--BackgroundColor: var(--pf-global--disabled-color--100);
20501
+ --pf-c-switch__toggle--before--BoxShadow: none;
20502
+ }
20503
+
20504
20504
  .pf-c-content {
20505
20505
  --pf-c-content--MarginBottom: var(--pf-global--spacer--md);
20506
20506
  --pf-c-content--LineHeight: var(--pf-global--LineHeight--md);
@@ -27499,18 +27499,6 @@ label.pf-c-tree-view__node-text {
27499
27499
  grid-gap: var(--pf-l-grid--m-gutter--GridGap);
27500
27500
  }
27501
27501
 
27502
- .pf-l-level {
27503
- --pf-l-level--m-gutter--MarginRight: var(--pf-global--gutter);
27504
- display: flex;
27505
- flex-wrap: wrap;
27506
- align-items: center;
27507
- justify-content: space-between;
27508
- }
27509
-
27510
- .pf-l-level.pf-m-gutter > *:not(:last-child) {
27511
- margin-right: var(--pf-l-level--m-gutter--MarginRight);
27512
- }
27513
-
27514
27502
  .pf-l-split {
27515
27503
  --pf-l-split--m-gutter--MarginRight: var(--pf-global--gutter);
27516
27504
  display: flex;
@@ -27530,6 +27518,18 @@ label.pf-c-tree-view__node-text {
27530
27518
  margin-right: var(--pf-l-split--m-gutter--MarginRight);
27531
27519
  }
27532
27520
 
27521
+ .pf-l-level {
27522
+ --pf-l-level--m-gutter--MarginRight: var(--pf-global--gutter);
27523
+ display: flex;
27524
+ flex-wrap: wrap;
27525
+ align-items: center;
27526
+ justify-content: space-between;
27527
+ }
27528
+
27529
+ .pf-l-level.pf-m-gutter > *:not(:last-child) {
27530
+ margin-right: var(--pf-l-level--m-gutter--MarginRight);
27531
+ }
27532
+
27533
27533
  .pf-l-stack {
27534
27534
  --pf-l-stack--m-gutter--MarginBottom: var(--pf-global--gutter);
27535
27535
  display: flex;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patternfly/react-core",
3
- "version": "4.243.0",
3
+ "version": "4.243.1",
4
4
  "description": "This library provides a set of common React components for use with the PatternFly reference implementation.",
5
5
  "main": "dist/js/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -70,5 +70,5 @@
70
70
  "react": "^16.8 || ^17 || ^18",
71
71
  "react-dom": "^16.8 || ^17 || ^18"
72
72
  },
73
- "gitHead": "51b287699eb4b522491b3ade19a8d16b68b5b4da"
73
+ "gitHead": "eb89462c9bbd1414e2da9f3b77601f965ba03bf2"
74
74
  }
@@ -9,479 +9,40 @@ propComponents: ['NumberInput']
9
9
 
10
10
  ### Default
11
11
 
12
- ```js
13
- import React from 'react';
14
- import { NumberInput } from '@patternfly/react-core';
15
-
16
- class BasicNumberInput extends React.Component {
17
- constructor(props) {
18
- super(props);
19
- this.state = {
20
- value: 90
21
- };
22
-
23
- this.onMinus = () => {
24
- this.setState({
25
- value: this.state.value - 1
26
- });
27
- };
28
-
29
- this.onChange = event => {
30
- this.setState({
31
- value: Number(event.target.value)
32
- });
33
- };
34
-
35
- this.onPlus = () => {
36
- this.setState({
37
- value: this.state.value + 1
38
- });
39
- };
40
- }
41
-
42
- render() {
43
- const { value } = this.state;
44
- return (
45
- <NumberInput
46
- value={value}
47
- onMinus={this.onMinus}
48
- onChange={this.onChange}
49
- onPlus={this.onPlus}
50
- inputName="input"
51
- inputAriaLabel="number input"
52
- minusBtnAriaLabel="minus"
53
- plusBtnAriaLabel="plus"
54
- />
55
- );
56
- }
57
- }
12
+ ```ts file="./NumberInputDefault.tsx"
58
13
  ```
59
14
 
60
15
  ### With unit
61
16
 
62
- ```js
63
- import React from 'react';
64
- import { NumberInput } from '@patternfly/react-core';
65
-
66
- class UnitNumberInput extends React.Component {
67
- constructor(props) {
68
- super(props);
69
- this.state = {
70
- value1: 90,
71
- value2: (1.0).toFixed(2)
72
- };
73
-
74
- this.onMinus1 = () => {
75
- this.setState({
76
- value1: this.state.value1 - 1
77
- });
78
- };
79
-
80
- this.onChange1 = event => {
81
- this.setState({
82
- value1: Number(event.target.value)
83
- });
84
- };
85
-
86
- this.onPlus1 = () => {
87
- this.setState({
88
- value1: this.state.value1 + 1
89
- });
90
- };
91
-
92
- this.onMinus2 = () => {
93
- this.setState({
94
- value2: (Number(this.state.value2) - 0.01).toFixed(2)
95
- });
96
- };
97
-
98
- this.onChange2 = event => {
99
- this.setState({
100
- value2: event.target.value
101
- });
102
- };
103
-
104
- this.onPlus2 = () => {
105
- this.setState({
106
- value2: (Number(this.state.value2) + 0.01).toFixed(2)
107
- });
108
- };
109
- }
110
-
111
- render() {
112
- const { value1, value2 } = this.state;
113
- return (
114
- <React.Fragment>
115
- <NumberInput
116
- value={value1}
117
- onMinus={this.onMinus1}
118
- onChange={this.onChange1}
119
- onPlus={this.onPlus1}
120
- inputName="input 1"
121
- inputAriaLabel="number input 1"
122
- minusBtnAriaLabel="minus 1"
123
- plusBtnAriaLabel="plus 1"
124
- unit="%"
125
- />
126
- <br />
127
- <br />
128
- <NumberInput
129
- value={value2}
130
- onMinus={this.onMinus2}
131
- onChange={this.onChange2}
132
- onPlus={this.onPlus2}
133
- inputName="input 2"
134
- inputAriaLabel="number input 2"
135
- minusBtnAriaLabel="minus 0.01"
136
- plusBtnAriaLabel="plus 0.01"
137
- unit="$"
138
- unitPosition="before"
139
- />
140
- </React.Fragment>
141
- );
142
- }
143
- }
17
+ ```ts file="./NumberInputUnit.tsx"
144
18
  ```
145
19
 
146
20
  ### With unit and thresholds
147
21
 
148
- ```js
149
- import React from 'react';
150
- import { NumberInput } from '@patternfly/react-core';
151
-
152
- class UnitThresholdNumberInput extends React.Component {
153
- constructor(props) {
154
- super(props);
155
- this.state = {
156
- value: 0
157
- };
158
- this.minValue = 0;
159
- this.maxValue = 10;
160
-
161
- this.normalizeBetween = (value, min, max) => {
162
- if (min !== undefined && max !== undefined) {
163
- return Math.max(Math.min(value, max), min);
164
- } else if (value <= min) {
165
- return min;
166
- } else if (value >= max) {
167
- return max;
168
- }
169
- return value;
170
- };
171
-
172
- this.onMinus = () => {
173
- this.setState({
174
- value: this.normalizeBetween(this.state.value - 1, this.minValue, this.maxValue)
175
- });
176
- };
177
-
178
- this.onChange = event => {
179
- const newValue = isNaN(event.target.value) ? 0 : Number(event.target.value);
180
- this.setState({
181
- value: newValue > this.maxValue ? this.maxValue : newValue < this.minValue ? this.minValue : newValue
182
- });
183
- };
184
-
185
- this.onPlus = () => {
186
- this.setState({
187
- value: this.normalizeBetween(this.state.value + 1, this.minValue, this.maxValue)
188
- });
189
- };
190
- }
191
-
192
- render() {
193
- const { value } = this.state;
194
-
195
- return (
196
- <React.Fragment>
197
- With a minimum value of 0 and maximum value of 10
198
- <br />
199
- <NumberInput
200
- value={value}
201
- min={this.minValue}
202
- max={this.maxValue}
203
- onMinus={this.onMinus}
204
- onChange={this.onChange}
205
- onPlus={this.onPlus}
206
- inputName="input"
207
- inputAriaLabel="number input"
208
- minusBtnAriaLabel="minus"
209
- plusBtnAriaLabel="plus"
210
- unit="%"
211
- />
212
- </React.Fragment>
213
- );
214
- }
215
- }
22
+ ```ts file="./NumberInputUnitThreshold.tsx"
216
23
  ```
217
24
 
218
25
  ### Disabled
219
26
 
220
- ```js
221
- import React from 'react';
222
- import { NumberInput } from '@patternfly/react-core';
223
-
224
- class DisabledNumberInput extends React.Component {
225
- constructor(props) {
226
- super(props);
227
- this.state = {
228
- value: 100
229
- };
230
-
231
- this.onMinus = () => {
232
- this.setState({
233
- value: this.state.value - 1
234
- });
235
- };
236
-
237
- this.onChange = event => {
238
- this.setState({
239
- value: Number(event.target.value)
240
- });
241
- };
242
-
243
- this.onPlus = () => {
244
- this.setState({
245
- value: this.state.value + 1
246
- });
247
- };
248
- }
249
-
250
- render() {
251
- const { value } = this.state;
252
- const minValue = 0;
253
- const maxValue = 100;
254
-
255
- return (
256
- <NumberInput
257
- value={value}
258
- min={minValue}
259
- max={maxValue}
260
- onMinus={this.onMinus}
261
- onChange={this.onChange}
262
- onPlus={this.onPlus}
263
- inputName="input"
264
- inputAriaLabel="number input"
265
- minusBtnAriaLabel="minus"
266
- plusBtnAriaLabel="plus"
267
- unit="%"
268
- isDisabled
269
- />
270
- );
271
- }
272
- }
273
-
27
+ ```ts file="./NumberInputDisabled.tsx"
274
28
  ```
29
+
275
30
  ### With status
276
31
 
277
- ```ts file="./WithStatus.tsx"
32
+ ```ts file="./NumberInputWithStatus.tsx"
278
33
  ```
279
34
 
280
35
  ### Varying sizes
281
36
 
282
- ```js
283
- import React from 'react';
284
- import { NumberInput } from '@patternfly/react-core';
285
-
286
- class NumberInputSizes extends React.Component {
287
- constructor(props) {
288
- super(props);
289
- this.state = {
290
- input1Value: 1,
291
- input2Value: 1234567890,
292
- input3Value: 5,
293
- input4Value: 12345
294
- };
295
-
296
- this.onChange = event => {
297
- this.setState({
298
- [`${event.target.name}Value`]: Number(event.target.value)
299
- });
300
- };
301
-
302
- this.onMinus = (e, inputName) => {
303
- this.setState({
304
- [`${inputName}Value`]: this.state[`${inputName}Value`] - 1
305
- });
306
- };
307
-
308
- this.onPlus = (e, inputName) => {
309
- this.setState({
310
- [`${inputName}Value`]: this.state[`${inputName}Value`] + 1
311
- });
312
- };
313
- }
314
-
315
- render() {
316
- const { input1Value, input2Value, input3Value, input4Value } = this.state;
317
-
318
- return (
319
- <React.Fragment>
320
- <NumberInput
321
- value={input1Value}
322
- onMinus={this.onMinus}
323
- onChange={this.onChange}
324
- onPlus={this.onPlus}
325
- inputName="input1"
326
- inputAriaLabel="number input 1"
327
- minusBtnAriaLabel="input 2 minus"
328
- plusBtnAriaLabel="input 2 plus"
329
- widthChars={1}
330
- />
331
- <br />
332
- <br />
333
- <NumberInput
334
- value={input2Value}
335
- onMinus={this.onMinus}
336
- onChange={this.onChange}
337
- onPlus={this.onPlus}
338
- inputName="input2"
339
- inputAriaLabel="number input 2"
340
- minusBtnAriaLabel="input 2 minus"
341
- plusBtnAriaLabel="input 2 plus"
342
- widthChars={10}
343
- />
344
- <br />
345
- <br />
346
- <NumberInput
347
- value={input3Value}
348
- onMinus={this.onMinus}
349
- onChange={this.onChange}
350
- onPlus={this.onPlus}
351
- inputName="input3"
352
- inputAriaLabel="number input 3"
353
- minusBtnAriaLabel="input 3 minus"
354
- plusBtnAriaLabel="input 3 plus"
355
- widthChars={5}
356
- />
357
- <br />
358
- <br />
359
- <NumberInput
360
- value={input4Value}
361
- onMinus={this.onMinus}
362
- onChange={this.onChange}
363
- onPlus={this.onPlus}
364
- inputName="input4"
365
- inputAriaLabel="number input 4"
366
- minusBtnAriaLabel="input 4 minus"
367
- plusBtnAriaLabel="input 4 plus"
368
- widthChars={5}
369
- />
370
- </React.Fragment>
371
- );
372
- }
373
- }
37
+ ```ts file="./NumberInputVaryingSizes.tsx"
374
38
  ```
375
39
 
376
40
  ### Custom increment/decrement
377
41
 
378
- ```js
379
- import React from 'react';
380
- import { NumberInput } from '@patternfly/react-core';
381
-
382
- class CustomStepNumberInput extends React.Component {
383
- constructor(props) {
384
- super(props);
385
- this.state = {
386
- value: 90,
387
- step: 3
388
- };
389
-
390
- this.stepper = step => () => {
391
- this.setState(prev => ({ ...prev, value: prev.value + step }));
392
- };
393
-
394
- this.onChange = event => {
395
- this.setState({
396
- value: Number(event.target.value)
397
- });
398
- };
399
- }
400
-
401
- render() {
402
- const { value } = this.state;
403
- return (
404
- <NumberInput
405
- value={value}
406
- onMinus={this.stepper(-3)}
407
- onChange={this.onChange}
408
- onPlus={this.stepper(3)}
409
- inputName="input"
410
- inputAriaLabel="number input"
411
- minusBtnAriaLabel="minus"
412
- plusBtnAriaLabel="plus"
413
- />
414
- );
415
- }
416
- }
42
+ ```ts file="./NumberInputCustomStep.tsx"
417
43
  ```
418
44
 
419
45
  ### Custom increment/decrement and thresholds
420
46
 
421
- ```js
422
- import React from 'react';
423
- import { NumberInput } from '@patternfly/react-core';
424
-
425
- class CustomStepNumberInput extends React.Component {
426
- constructor(props) {
427
- super(props);
428
- this.state = {
429
- value: 90,
430
- step: 3
431
- };
432
- this.minValue = 90;
433
- this.maxValue = 100;
434
-
435
- this.normalizeBetween = (value, min, max) => {
436
- if (min !== undefined && max !== undefined) {
437
- return Math.max(Math.min(value, max), min);
438
- } else if (value <= min) {
439
- return min;
440
- } else if (value >= max) {
441
- return max;
442
- }
443
- return value;
444
- };
445
-
446
- this.stepper = step => () => {
447
- this.setState(prev => ({
448
- ...prev,
449
- value: this.normalizeBetween(prev.value + step, this.minValue, this.maxValue)
450
- }));
451
- };
452
-
453
- this.onChange = event => {
454
- const newValue = isNaN(event.target.value) ? 0 : Number(event.target.value);
455
- this.setState({
456
- value: newValue
457
- });
458
- };
459
-
460
- this.onBlur = event => {
461
- const newValue = isNaN(event.target.value) ? 0 : Number(event.target.value);
462
- this.setState({
463
- value: newValue > this.maxValue ? this.maxValue : newValue < this.minValue ? this.minValue : newValue
464
- });
465
- };
466
- }
467
-
468
- render() {
469
- const { value } = this.state;
470
- return (
471
- <NumberInput
472
- value={value}
473
- min={this.minValue}
474
- max={this.maxValue}
475
- onMinus={this.stepper(-3)}
476
- onChange={this.onChange}
477
- onBlur={this.onBlur}
478
- onPlus={this.stepper(3)}
479
- inputName="input"
480
- inputAriaLabel="number input"
481
- minusBtnAriaLabel="minus"
482
- plusBtnAriaLabel="plus"
483
- />
484
- );
485
- }
486
- }
47
+ ```ts file="./NumberInputCustomStepAndThreshold.tsx"
487
48
  ```
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { NumberInput } from '@patternfly/react-core';
3
+
4
+ export const NumberInputCustomStep: React.FunctionComponent = () => {
5
+ const [value, setValue] = React.useState(90);
6
+ const step = 3;
7
+
8
+ const stepper = (stepValue: number) => {
9
+ setValue(value + stepValue);
10
+ };
11
+
12
+ const onChange = (event: React.FormEvent<HTMLInputElement>) => {
13
+ const target = event.target as HTMLInputElement;
14
+ setValue(Number(target.value));
15
+ };
16
+
17
+ return (
18
+ <NumberInput
19
+ value={value}
20
+ onMinus={() => stepper(-step)}
21
+ onChange={onChange}
22
+ onPlus={() => stepper(step)}
23
+ inputName="input"
24
+ inputAriaLabel="number input"
25
+ minusBtnAriaLabel="minus"
26
+ plusBtnAriaLabel="plus"
27
+ />
28
+ );
29
+ };
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import { NumberInput } from '@patternfly/react-core';
3
+
4
+ export const NumberInputCustomStepAndThreshold: React.FunctionComponent = () => {
5
+ const [value, setValue] = React.useState(90);
6
+ const minValue = 90;
7
+ const maxValue = 100;
8
+ const step = 3;
9
+
10
+ const normalizeBetween = (value, min, max) => {
11
+ if (min !== undefined && max !== undefined) {
12
+ return Math.max(Math.min(value, max), min);
13
+ } else if (value <= min) {
14
+ return min;
15
+ } else if (value >= max) {
16
+ return max;
17
+ }
18
+ return value;
19
+ };
20
+
21
+ const stepper = (stepValue: number) => {
22
+ setValue(value + stepValue);
23
+ };
24
+
25
+ const onChange = (event: React.FormEvent<HTMLInputElement>) => {
26
+ const target = event.target as HTMLInputElement;
27
+ const newValue = normalizeBetween(isNaN(+target.value) ? 0 : Number(target.value), minValue, maxValue);
28
+ setValue(newValue);
29
+ };
30
+
31
+ const onBlur = (event: React.FormEvent<HTMLInputElement>) => {
32
+ const target = event.target as HTMLInputElement;
33
+ const newValue = normalizeBetween(isNaN(+target.value) ? 0 : Number(target.value), minValue, maxValue);
34
+ setValue(newValue);
35
+ };
36
+
37
+ return (
38
+ <NumberInput
39
+ value={value}
40
+ min={minValue}
41
+ max={maxValue}
42
+ onMinus={() => stepper(-step)}
43
+ onChange={onChange}
44
+ onBlur={onBlur}
45
+ onPlus={() => stepper(step)}
46
+ inputName="input"
47
+ inputAriaLabel="number input"
48
+ minusBtnAriaLabel="minus"
49
+ plusBtnAriaLabel="plus"
50
+ />
51
+ );
52
+ };
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { NumberInput } from '@patternfly/react-core';
3
+
4
+ export const NumberInputDefault: React.FunctionComponent = () => {
5
+ const [value, setValue] = React.useState(90);
6
+
7
+ const onMinus = () => {
8
+ const newValue = value - 1;
9
+ setValue(newValue);
10
+ };
11
+
12
+ const onChange = (event: React.FormEvent<HTMLInputElement>) => {
13
+ const target = event.target as HTMLInputElement;
14
+ setValue(Number(target.value));
15
+ };
16
+
17
+ const onPlus = () => {
18
+ const newValue = value + 1;
19
+ setValue(newValue);
20
+ };
21
+
22
+ return (
23
+ <NumberInput
24
+ value={value}
25
+ onMinus={onMinus}
26
+ onChange={onChange}
27
+ onPlus={onPlus}
28
+ inputName="input"
29
+ inputAriaLabel="number input"
30
+ minusBtnAriaLabel="minus"
31
+ plusBtnAriaLabel="plus"
32
+ />
33
+ );
34
+ };
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { NumberInput } from '@patternfly/react-core';
3
+
4
+ export const NumberInputDisabled: React.FunctionComponent = () => {
5
+ const [value, setValue] = React.useState(100);
6
+ const minValue = 0;
7
+ const maxValue = 100;
8
+
9
+ const onMinus = () => {
10
+ const newValue = value - 1;
11
+ setValue(newValue);
12
+ };
13
+
14
+ const onChange = (event: React.FormEvent<HTMLInputElement>) => {
15
+ const target = event.target as HTMLInputElement;
16
+ setValue(Number(target.value));
17
+ };
18
+
19
+ const onPlus = () => {
20
+ const newValue = value + 1;
21
+ setValue(newValue);
22
+ };
23
+
24
+ return (
25
+ <NumberInput
26
+ value={value}
27
+ min={minValue}
28
+ max={maxValue}
29
+ onMinus={onMinus}
30
+ onChange={onChange}
31
+ onPlus={onPlus}
32
+ inputName="input"
33
+ inputAriaLabel="number input"
34
+ minusBtnAriaLabel="minus"
35
+ plusBtnAriaLabel="plus"
36
+ unit="%"
37
+ isDisabled
38
+ />
39
+ );
40
+ };
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import { NumberInput } from '@patternfly/react-core';
3
+
4
+ export const NumberInputUnit: React.FunctionComponent = () => {
5
+ const [value1, setValue1] = React.useState(90);
6
+ const [value2, setValue2] = React.useState(Number((1.0).toFixed(2)));
7
+
8
+ const onMinus1 = () => setValue1(value1 - 1);
9
+ const onChange1 = (event: React.FormEvent<HTMLInputElement>) => {
10
+ const target = event.target as HTMLInputElement;
11
+ setValue1(Number(target.value));
12
+ };
13
+ const onPlus1 = () => setValue1(value1 + 1);
14
+
15
+ const onMinus2 = () => {
16
+ const newValue = Number((value2 - 0.01).toFixed(2));
17
+ setValue2(newValue);
18
+ };
19
+ const onChange2 = (event: React.FormEvent<HTMLInputElement>) => {
20
+ const target = event.target as HTMLInputElement;
21
+ setValue2(Number(target.value));
22
+ };
23
+ const onPlus2 = () => {
24
+ const newValue = Number((value2 + 0.01).toFixed(2));
25
+ setValue2(newValue);
26
+ };
27
+
28
+ return (
29
+ <React.Fragment>
30
+ <NumberInput
31
+ value={value1}
32
+ onMinus={onMinus1}
33
+ onChange={onChange1}
34
+ onPlus={onPlus1}
35
+ inputName="input 1"
36
+ inputAriaLabel="number input 1"
37
+ minusBtnAriaLabel="minus 1"
38
+ plusBtnAriaLabel="plus 1"
39
+ unit="%"
40
+ />
41
+ <br />
42
+ <br />
43
+ <NumberInput
44
+ value={value2}
45
+ onMinus={onMinus2}
46
+ onChange={onChange2}
47
+ onPlus={onPlus2}
48
+ inputName="input 2"
49
+ inputAriaLabel="number input 2"
50
+ minusBtnAriaLabel="minus 0.01"
51
+ plusBtnAriaLabel="plus 0.01"
52
+ unit="$"
53
+ unitPosition="before"
54
+ />
55
+ </React.Fragment>
56
+ );
57
+ };
@@ -0,0 +1,55 @@
1
+ import React from 'react';
2
+ import { NumberInput } from '@patternfly/react-core';
3
+
4
+ export const NumberInputUnitThreshold: React.FunctionComponent = () => {
5
+ const [value, setValue] = React.useState(0);
6
+ const minValue = 0;
7
+ const maxValue = 10;
8
+
9
+ const normalizeBetween = (value, min, max) => {
10
+ if (min !== undefined && max !== undefined) {
11
+ return Math.max(Math.min(value, max), min);
12
+ } else if (value <= min) {
13
+ return min;
14
+ } else if (value >= max) {
15
+ return max;
16
+ }
17
+ return value;
18
+ };
19
+
20
+ const onMinus = () => {
21
+ const newValue = normalizeBetween(value - 1, minValue, maxValue);
22
+ setValue(newValue);
23
+ };
24
+
25
+ const onChange = (event: React.FormEvent<HTMLInputElement>) => {
26
+ const target = event.target as HTMLInputElement;
27
+ const newValue = normalizeBetween(isNaN(+target.value) ? 0 : Number(target.value), minValue, maxValue);
28
+ setValue(newValue);
29
+ };
30
+
31
+ const onPlus = () => {
32
+ const newValue = normalizeBetween(value + 1, minValue, maxValue);
33
+ setValue(newValue);
34
+ };
35
+
36
+ return (
37
+ <React.Fragment>
38
+ With a minimum value of 0 and maximum value of 10
39
+ <br />
40
+ <NumberInput
41
+ value={value}
42
+ min={minValue}
43
+ max={maxValue}
44
+ onMinus={onMinus}
45
+ onChange={onChange}
46
+ onPlus={onPlus}
47
+ inputName="input"
48
+ inputAriaLabel="number input"
49
+ minusBtnAriaLabel="minus"
50
+ plusBtnAriaLabel="plus"
51
+ unit="%"
52
+ />
53
+ </React.Fragment>
54
+ );
55
+ };
@@ -0,0 +1,80 @@
1
+ import React from 'react';
2
+ import { NumberInput } from '@patternfly/react-core';
3
+
4
+ export const NumberInputVaryingSizes: React.FunctionComponent = () => {
5
+ const [input1Value, setInput1Value] = React.useState(1);
6
+ const [input2Value, setInput2Value] = React.useState(1234567890);
7
+ const [input3Value, setInput3Value] = React.useState(5);
8
+ const [input4Value, setInput4Value] = React.useState(12345);
9
+
10
+ const onChange = (
11
+ event: React.FormEvent<HTMLInputElement>,
12
+ updateFunction: React.Dispatch<React.SetStateAction<number>>
13
+ ) => {
14
+ const target = event.target as HTMLInputElement;
15
+ updateFunction(Number(target.value));
16
+ };
17
+
18
+ const onMinus = (value, updateFunction: React.Dispatch<React.SetStateAction<number>>) => {
19
+ updateFunction(value - 1);
20
+ };
21
+
22
+ const onPlus = (value, updateFunction: React.Dispatch<React.SetStateAction<number>>) => {
23
+ updateFunction(value + 1);
24
+ };
25
+
26
+ return (
27
+ <React.Fragment>
28
+ <NumberInput
29
+ value={input1Value}
30
+ onMinus={() => onMinus(input1Value, setInput1Value)}
31
+ onChange={event => onChange(event, setInput1Value)}
32
+ onPlus={() => onPlus(input1Value, setInput1Value)}
33
+ inputName="input1"
34
+ inputAriaLabel="number input 1"
35
+ minusBtnAriaLabel="input 2 minus"
36
+ plusBtnAriaLabel="input 2 plus"
37
+ widthChars={1}
38
+ />
39
+ <br />
40
+ <br />
41
+ <NumberInput
42
+ value={input2Value}
43
+ onMinus={() => onMinus(input2Value, setInput2Value)}
44
+ onChange={event => onChange(event, setInput2Value)}
45
+ onPlus={() => onPlus(input2Value, setInput2Value)}
46
+ inputName="input2"
47
+ inputAriaLabel="number input 2"
48
+ minusBtnAriaLabel="input 2 minus"
49
+ plusBtnAriaLabel="input 2 plus"
50
+ widthChars={10}
51
+ />
52
+ <br />
53
+ <br />
54
+ <NumberInput
55
+ value={input3Value}
56
+ onMinus={() => onMinus(input3Value, setInput3Value)}
57
+ onChange={event => onChange(event, setInput3Value)}
58
+ onPlus={() => onPlus(input3Value, setInput3Value)}
59
+ inputName="input3"
60
+ inputAriaLabel="number input 3"
61
+ minusBtnAriaLabel="input 3 minus"
62
+ plusBtnAriaLabel="input 3 plus"
63
+ widthChars={5}
64
+ />
65
+ <br />
66
+ <br />
67
+ <NumberInput
68
+ value={input4Value}
69
+ onMinus={() => onMinus(input4Value, setInput4Value)}
70
+ onChange={event => onChange(event, setInput4Value)}
71
+ onPlus={() => onPlus(input4Value, setInput4Value)}
72
+ inputName="input4"
73
+ inputAriaLabel="number input 4"
74
+ minusBtnAriaLabel="input 4 minus"
75
+ plusBtnAriaLabel="input 4 plus"
76
+ widthChars={5}
77
+ />
78
+ </React.Fragment>
79
+ );
80
+ };
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { NumberInput, ValidatedOptions } from '@patternfly/react-core';
3
3
 
4
- export const WithStatus: React.FunctionComponent = () => {
4
+ export const NumberInputWithStatus: React.FunctionComponent = () => {
5
5
  const max = 10;
6
6
  const min = 0;
7
7
 
@@ -20,8 +20,9 @@ export const WithStatus: React.FunctionComponent = () => {
20
20
  validate(newVal);
21
21
  };
22
22
 
23
- const onChange = event => {
24
- const newVal = isNaN(event.target.value) ? 5 : Number(event.target.value);
23
+ const onChange = (event: React.FormEvent<HTMLInputElement>) => {
24
+ const target = event.target as HTMLInputElement;
25
+ const newVal = isNaN(+target.value) ? 5 : Number(target.value);
25
26
  setValue(newVal);
26
27
  validate(newVal);
27
28
  };