@transferwise/components 46.110.0 → 46.111.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.
Files changed (135) hide show
  1. package/build/common/panel/Panel.js +1 -0
  2. package/build/common/panel/Panel.js.map +1 -1
  3. package/build/common/panel/Panel.mjs +1 -0
  4. package/build/common/panel/Panel.mjs.map +1 -1
  5. package/build/common/responsivePanel/ResponsivePanel.js +6 -1
  6. package/build/common/responsivePanel/ResponsivePanel.js.map +1 -1
  7. package/build/common/responsivePanel/ResponsivePanel.mjs +6 -1
  8. package/build/common/responsivePanel/ResponsivePanel.mjs.map +1 -1
  9. package/build/dateInput/DateInput.js +46 -24
  10. package/build/dateInput/DateInput.js.map +1 -1
  11. package/build/dateInput/DateInput.mjs +48 -26
  12. package/build/dateInput/DateInput.mjs.map +1 -1
  13. package/build/dateLookup/DateLookup.js +5 -2
  14. package/build/dateLookup/DateLookup.js.map +1 -1
  15. package/build/dateLookup/DateLookup.mjs +5 -2
  16. package/build/dateLookup/DateLookup.mjs.map +1 -1
  17. package/build/dateLookup/dateTrigger/DateTrigger.js +2 -0
  18. package/build/dateLookup/dateTrigger/DateTrigger.js.map +1 -1
  19. package/build/dateLookup/dateTrigger/DateTrigger.mjs +2 -0
  20. package/build/dateLookup/dateTrigger/DateTrigger.mjs.map +1 -1
  21. package/build/field/Field.js +7 -2
  22. package/build/field/Field.js.map +1 -1
  23. package/build/field/Field.mjs +13 -8
  24. package/build/field/Field.mjs.map +1 -1
  25. package/build/inputs/InputGroup.js +1 -1
  26. package/build/inputs/InputGroup.js.map +1 -1
  27. package/build/inputs/InputGroup.mjs +2 -2
  28. package/build/inputs/InputGroup.mjs.map +1 -1
  29. package/build/inputs/SelectInput.js +19 -5
  30. package/build/inputs/SelectInput.js.map +1 -1
  31. package/build/inputs/SelectInput.mjs +19 -5
  32. package/build/inputs/SelectInput.mjs.map +1 -1
  33. package/build/inputs/contexts.js +8 -4
  34. package/build/inputs/contexts.js.map +1 -1
  35. package/build/inputs/contexts.mjs +7 -4
  36. package/build/inputs/contexts.mjs.map +1 -1
  37. package/build/label/Label.js +14 -8
  38. package/build/label/Label.js.map +1 -1
  39. package/build/label/Label.mjs +14 -8
  40. package/build/label/Label.mjs.map +1 -1
  41. package/build/listItem/ListItem.js.map +1 -1
  42. package/build/listItem/ListItem.mjs.map +1 -1
  43. package/build/listItem/Prompt/ListItemPrompt.js +1 -1
  44. package/build/listItem/Prompt/ListItemPrompt.js.map +1 -1
  45. package/build/listItem/Prompt/ListItemPrompt.mjs +1 -1
  46. package/build/listItem/Prompt/ListItemPrompt.mjs.map +1 -1
  47. package/build/main.css +163 -153
  48. package/build/moneyInput/MoneyInput.js +6 -5
  49. package/build/moneyInput/MoneyInput.js.map +1 -1
  50. package/build/moneyInput/MoneyInput.mjs +6 -5
  51. package/build/moneyInput/MoneyInput.mjs.map +1 -1
  52. package/build/phoneNumberInput/PhoneNumberInput.js +25 -3
  53. package/build/phoneNumberInput/PhoneNumberInput.js.map +1 -1
  54. package/build/phoneNumberInput/PhoneNumberInput.mjs +27 -5
  55. package/build/phoneNumberInput/PhoneNumberInput.mjs.map +1 -1
  56. package/build/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.js +23 -23
  57. package/build/prompt/InlinePrompt/InlinePrompt.js.map +1 -0
  58. package/build/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.mjs +23 -23
  59. package/build/prompt/InlinePrompt/InlinePrompt.mjs.map +1 -0
  60. package/build/styles/inputs/Input.css +5 -0
  61. package/build/styles/inputs/TextArea.css +5 -0
  62. package/build/styles/listItem/ListItem.css +5 -153
  63. package/build/styles/listItem/Prompt/ListItemPrompt.css +0 -153
  64. package/build/styles/main.css +163 -153
  65. package/build/types/common/panel/Panel.d.ts +2 -0
  66. package/build/types/common/panel/Panel.d.ts.map +1 -1
  67. package/build/types/common/responsivePanel/ResponsivePanel.d.ts +1 -0
  68. package/build/types/common/responsivePanel/ResponsivePanel.d.ts.map +1 -1
  69. package/build/types/dateInput/DateInput.d.ts +2 -2
  70. package/build/types/dateInput/DateInput.d.ts.map +1 -1
  71. package/build/types/dateLookup/DateLookup.d.ts.map +1 -1
  72. package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts +1 -0
  73. package/build/types/dateLookup/dateTrigger/DateTrigger.d.ts.map +1 -1
  74. package/build/types/field/Field.d.ts.map +1 -1
  75. package/build/types/inputs/InputGroup.d.ts.map +1 -1
  76. package/build/types/inputs/SelectInput.d.ts +9 -1
  77. package/build/types/inputs/SelectInput.d.ts.map +1 -1
  78. package/build/types/inputs/contexts.d.ts +6 -1
  79. package/build/types/inputs/contexts.d.ts.map +1 -1
  80. package/build/types/label/Label.d.ts +5 -15
  81. package/build/types/label/Label.d.ts.map +1 -1
  82. package/build/types/listItem/ListItem.d.ts.map +1 -1
  83. package/build/types/listItem/Prompt/ListItemPrompt.d.ts +1 -1
  84. package/build/types/listItem/Prompt/ListItemPrompt.d.ts.map +1 -1
  85. package/build/types/moneyInput/MoneyInput.d.ts.map +1 -1
  86. package/build/types/phoneNumberInput/PhoneNumberInput.d.ts.map +1 -1
  87. package/build/types/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.d.ts +1 -1
  88. package/build/types/prompt/InlinePrompt/InlinePrompt.d.ts.map +1 -0
  89. package/build/types/prompt/InlinePrompt/index.d.ts.map +1 -0
  90. package/build/types/prompt/index.d.ts +3 -0
  91. package/build/types/prompt/index.d.ts.map +1 -0
  92. package/package.json +5 -5
  93. package/src/DisabledComponents.story.tsx +156 -0
  94. package/src/common/panel/Panel.tsx +2 -0
  95. package/src/common/responsivePanel/ResponsivePanel.tsx +7 -1
  96. package/src/dateInput/DateInput.spec.tsx +45 -7
  97. package/src/dateInput/DateInput.story.tsx +2 -0
  98. package/src/dateInput/DateInput.tsx +65 -30
  99. package/src/dateLookup/DateLookup.spec.tsx +16 -0
  100. package/src/dateLookup/DateLookup.tsx +6 -3
  101. package/src/dateLookup/dateTrigger/DateTrigger.tsx +3 -0
  102. package/src/field/Field.tsx +6 -5
  103. package/src/inputs/Input.css +5 -0
  104. package/src/inputs/InputGroup.tsx +3 -4
  105. package/src/inputs/SelectInput.story.tsx +30 -10
  106. package/src/inputs/SelectInput.tsx +36 -6
  107. package/src/inputs/TextArea.css +5 -0
  108. package/src/inputs/_common.less +5 -0
  109. package/src/inputs/contexts.tsx +12 -3
  110. package/src/label/Label.tsx +26 -20
  111. package/src/listItem/ListItem.css +5 -153
  112. package/src/listItem/ListItem.less +5 -0
  113. package/src/listItem/ListItem.tsx +2 -1
  114. package/src/listItem/Prompt/ListItemPrompt.css +0 -153
  115. package/src/listItem/Prompt/ListItemPrompt.less +0 -2
  116. package/src/listItem/Prompt/ListItemPrompt.tsx +1 -1
  117. package/src/main.css +163 -153
  118. package/src/main.less +1 -0
  119. package/src/moneyInput/MoneyInput.spec.tsx +16 -1
  120. package/src/moneyInput/MoneyInput.tsx +7 -6
  121. package/src/neptune-css/NeptuneCSS.story.tsx +142 -0
  122. package/src/phoneNumberInput/PhoneNumberInput.spec.tsx +32 -0
  123. package/src/phoneNumberInput/PhoneNumberInput.tsx +32 -11
  124. package/src/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.spec.tsx +2 -2
  125. package/src/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.tsx +4 -4
  126. package/src/prompt/index.ts +6 -0
  127. package/build/listItem/Prompt/InlinePrompt/InlinePrompt.js.map +0 -1
  128. package/build/listItem/Prompt/InlinePrompt/InlinePrompt.mjs.map +0 -1
  129. package/build/types/listItem/Prompt/InlinePrompt/InlinePrompt.d.ts.map +0 -1
  130. package/build/types/listItem/Prompt/InlinePrompt/index.d.ts.map +0 -1
  131. /package/build/styles/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.css +0 -0
  132. /package/build/types/{listItem/Prompt → prompt}/InlinePrompt/index.d.ts +0 -0
  133. /package/src/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.css +0 -0
  134. /package/src/{listItem/Prompt → prompt}/InlinePrompt/InlinePrompt.less +0 -0
  135. /package/src/{listItem/Prompt → prompt}/InlinePrompt/index.ts +0 -0
package/src/main.css CHANGED
@@ -433,6 +433,159 @@
433
433
  .np-theme-personal .tw-avatar--outlined:not(.disabled):not(:disabled):hover {
434
434
  border-color: var(--color-interactive-primary-hover);
435
435
  }
436
+ .wds-inline-prompt {
437
+ display: inline-flex;
438
+ text-align: left;
439
+ padding-top: calc(8px / 2);
440
+ padding-top: calc(var(--padding-x-small) / 2);
441
+ padding-bottom: calc(8px / 2);
442
+ padding-bottom: calc(var(--padding-x-small) / 2);
443
+ padding-left: calc(8px - 1px);
444
+ padding-left: calc(var(--padding-x-small) - 1px);
445
+ padding-right: 8px;
446
+ padding-right: var(--padding-x-small);
447
+ border-radius: 10px;
448
+ border-radius: var(--radius-small);
449
+ word-break: break-word;
450
+ word-wrap: break-word;
451
+ }
452
+ .wds-inline-prompt:has(a),
453
+ .wds-inline-prompt:has(button) {
454
+ position: relative;
455
+ z-index: 1;
456
+ }
457
+ .wds-inline-prompt--muted {
458
+ opacity: 0.93;
459
+ filter: grayscale(1);
460
+ }
461
+ .wds-inline-prompt a,
462
+ .wds-inline-prompt button {
463
+ text-underline-offset: calc(4px / 2);
464
+ text-underline-offset: calc(var(--size-4) / 2);
465
+ }
466
+ .wds-inline-prompt a:first-of-type:before,
467
+ .wds-inline-prompt button:first-of-type:before {
468
+ content: '';
469
+ position: absolute;
470
+ inset: 0;
471
+ }
472
+ .wds-inline-prompt__media-wrapper {
473
+ padding-right: calc(12px / 2);
474
+ padding-right: calc(var(--size-12) / 2);
475
+ padding-top: calc(4px - 1px);
476
+ padding-top: calc(var(--size-4) - 1px);
477
+ padding-bottom: calc(4px - 1px);
478
+ padding-bottom: calc(var(--size-4) - 1px);
479
+ }
480
+ .wds-inline-prompt__media-wrapper .tw-icon-tags,
481
+ .wds-inline-prompt__media-wrapper .tw-icon-confetti {
482
+ color: var(--color-sentiment-positive-primary);
483
+ }
484
+ .wds-inline-prompt--negative {
485
+ background-color: var(--color-sentiment-negative-secondary);
486
+ color: var(--color-sentiment-negative-primary);
487
+ }
488
+ .wds-inline-prompt--negative a,
489
+ .wds-inline-prompt--negative button {
490
+ color: var(--color-sentiment-negative-primary);
491
+ }
492
+ .wds-inline-prompt--negative a:hover,
493
+ .wds-inline-prompt--negative button:hover {
494
+ color: var(--color-sentiment-negative-primary-hover);
495
+ }
496
+ .wds-inline-prompt--negative a:active,
497
+ .wds-inline-prompt--negative button:active {
498
+ color: var(--color-sentiment-negative-primary-active);
499
+ }
500
+ .wds-inline-prompt.wds-inline-prompt--negative:has(a, button):hover {
501
+ background-color: var(--color-sentiment-negative-secondary-hover);
502
+ }
503
+ .wds-inline-prompt.wds-inline-prompt--negative:has(a, button):active {
504
+ background-color: var(--color-sentiment-negative-secondary-active);
505
+ }
506
+ .wds-inline-prompt--positive {
507
+ background-color: var(--color-sentiment-positive-secondary);
508
+ color: var(--color-sentiment-positive-primary);
509
+ }
510
+ .wds-inline-prompt--positive a,
511
+ .wds-inline-prompt--positive button {
512
+ color: var(--color-sentiment-positive-primary);
513
+ }
514
+ .wds-inline-prompt--positive a:hover,
515
+ .wds-inline-prompt--positive button:hover {
516
+ color: var(--color-sentiment-positive-primary-hover);
517
+ }
518
+ .wds-inline-prompt--positive a:active,
519
+ .wds-inline-prompt--positive button:active {
520
+ color: var(--color-sentiment-positive-primary-active);
521
+ }
522
+ .wds-inline-prompt.wds-inline-prompt--positive:has(a, button):hover {
523
+ background-color: var(--color-sentiment-positive-secondary-hover);
524
+ }
525
+ .wds-inline-prompt.wds-inline-prompt--positive:has(a, button):active {
526
+ background-color: var(--color-sentiment-positive-secondary-active);
527
+ }
528
+ .wds-inline-prompt--proposition {
529
+ background-color: var(--color-sentiment-positive-secondary);
530
+ color: var(--color-sentiment-positive-primary);
531
+ }
532
+ .wds-inline-prompt--proposition a,
533
+ .wds-inline-prompt--proposition button {
534
+ color: var(--color-sentiment-positive-primary);
535
+ }
536
+ .wds-inline-prompt--proposition a:hover,
537
+ .wds-inline-prompt--proposition button:hover {
538
+ color: var(--color-sentiment-positive-primary-hover);
539
+ }
540
+ .wds-inline-prompt--proposition a:active,
541
+ .wds-inline-prompt--proposition button:active {
542
+ color: var(--color-sentiment-positive-primary-active);
543
+ }
544
+ .wds-inline-prompt.wds-inline-prompt--proposition:has(a, button):hover {
545
+ background-color: var(--color-sentiment-positive-secondary-hover);
546
+ }
547
+ .wds-inline-prompt.wds-inline-prompt--proposition:has(a, button):active {
548
+ background-color: var(--color-sentiment-positive-secondary-active);
549
+ }
550
+ .wds-inline-prompt--neutral {
551
+ background-color: rgba(134,167,189,0.10196);
552
+ background-color: var(--color-background-neutral);
553
+ color: #37517e;
554
+ color: var(--color-content-primary);
555
+ }
556
+ .wds-inline-prompt--neutral a,
557
+ .wds-inline-prompt--neutral button {
558
+ color: #37517e;
559
+ color: var(--color-content-primary);
560
+ }
561
+ .wds-inline-prompt.wds-inline-prompt--neutral:has(a, button):hover {
562
+ background-color: var(--color-background-neutral-hover);
563
+ }
564
+ .wds-inline-prompt.wds-inline-prompt--neutral:has(a, button):active {
565
+ background-color: var(--color-background-neutral-active);
566
+ }
567
+ .wds-inline-prompt--warning {
568
+ background-color: var(--color-sentiment-warning-secondary);
569
+ color: var(--color-sentiment-warning-content);
570
+ }
571
+ .wds-inline-prompt--warning a,
572
+ .wds-inline-prompt--warning button {
573
+ color: var(--color-sentiment-warning-content);
574
+ }
575
+ .wds-inline-prompt--warning a:hover,
576
+ .wds-inline-prompt--warning button:hover {
577
+ color: var(--color-sentiment-warning-content-hover);
578
+ }
579
+ .wds-inline-prompt--warning a:active,
580
+ .wds-inline-prompt--warning button:active {
581
+ color: var(--color-sentiment-warning-content-active);
582
+ }
583
+ .wds-inline-prompt.wds-inline-prompt--warning:has(a, button):hover {
584
+ background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 92%, var(--color-sentiment-warning-primary));
585
+ }
586
+ .wds-inline-prompt.wds-inline-prompt--warning:has(a, button):active {
587
+ background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 84%, var(--color-sentiment-warning-primary));
588
+ }
436
589
  .np-notification-dot {
437
590
  --np-notification-dot-size: 14px;
438
591
  position: relative;
@@ -2507,6 +2660,11 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
2507
2660
  transition-duration: 300ms;
2508
2661
  /* TODO: Remove these overrides once `.form-control` isn’t used anymore */
2509
2662
  }
2663
+ .disabled .np-form-control,
2664
+ :disabled .np-form-control {
2665
+ opacity: 1;
2666
+ opacity: initial;
2667
+ }
2510
2668
  .np-form-control:focus-visible {
2511
2669
  outline: none;
2512
2670
  }
@@ -3026,159 +3184,6 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
3026
3184
  margin-top: var(--size-4);
3027
3185
  }
3028
3186
  }
3029
- .wds-inline-prompt {
3030
- display: inline-flex;
3031
- text-align: left;
3032
- padding-top: calc(8px / 2);
3033
- padding-top: calc(var(--padding-x-small) / 2);
3034
- padding-bottom: calc(8px / 2);
3035
- padding-bottom: calc(var(--padding-x-small) / 2);
3036
- padding-left: calc(8px - 1px);
3037
- padding-left: calc(var(--padding-x-small) - 1px);
3038
- padding-right: 8px;
3039
- padding-right: var(--padding-x-small);
3040
- border-radius: 10px;
3041
- border-radius: var(--radius-small);
3042
- word-break: break-word;
3043
- word-wrap: break-word;
3044
- }
3045
- .wds-inline-prompt:has(a),
3046
- .wds-inline-prompt:has(button) {
3047
- position: relative;
3048
- z-index: 1;
3049
- }
3050
- .wds-inline-prompt--muted {
3051
- opacity: 0.93;
3052
- filter: grayscale(1);
3053
- }
3054
- .wds-inline-prompt a,
3055
- .wds-inline-prompt button {
3056
- text-underline-offset: calc(4px / 2);
3057
- text-underline-offset: calc(var(--size-4) / 2);
3058
- }
3059
- .wds-inline-prompt a:first-of-type:before,
3060
- .wds-inline-prompt button:first-of-type:before {
3061
- content: '';
3062
- position: absolute;
3063
- inset: 0;
3064
- }
3065
- .wds-inline-prompt__media-wrapper {
3066
- padding-right: calc(12px / 2);
3067
- padding-right: calc(var(--size-12) / 2);
3068
- padding-top: calc(4px - 1px);
3069
- padding-top: calc(var(--size-4) - 1px);
3070
- padding-bottom: calc(4px - 1px);
3071
- padding-bottom: calc(var(--size-4) - 1px);
3072
- }
3073
- .wds-inline-prompt__media-wrapper .tw-icon-tags,
3074
- .wds-inline-prompt__media-wrapper .tw-icon-confetti {
3075
- color: var(--color-sentiment-positive-primary);
3076
- }
3077
- .wds-inline-prompt--negative {
3078
- background-color: var(--color-sentiment-negative-secondary);
3079
- color: var(--color-sentiment-negative-primary);
3080
- }
3081
- .wds-inline-prompt--negative a,
3082
- .wds-inline-prompt--negative button {
3083
- color: var(--color-sentiment-negative-primary);
3084
- }
3085
- .wds-inline-prompt--negative a:hover,
3086
- .wds-inline-prompt--negative button:hover {
3087
- color: var(--color-sentiment-negative-primary-hover);
3088
- }
3089
- .wds-inline-prompt--negative a:active,
3090
- .wds-inline-prompt--negative button:active {
3091
- color: var(--color-sentiment-negative-primary-active);
3092
- }
3093
- .wds-inline-prompt.wds-inline-prompt--negative:has(a, button):hover {
3094
- background-color: var(--color-sentiment-negative-secondary-hover);
3095
- }
3096
- .wds-inline-prompt.wds-inline-prompt--negative:has(a, button):active {
3097
- background-color: var(--color-sentiment-negative-secondary-active);
3098
- }
3099
- .wds-inline-prompt--positive {
3100
- background-color: var(--color-sentiment-positive-secondary);
3101
- color: var(--color-sentiment-positive-primary);
3102
- }
3103
- .wds-inline-prompt--positive a,
3104
- .wds-inline-prompt--positive button {
3105
- color: var(--color-sentiment-positive-primary);
3106
- }
3107
- .wds-inline-prompt--positive a:hover,
3108
- .wds-inline-prompt--positive button:hover {
3109
- color: var(--color-sentiment-positive-primary-hover);
3110
- }
3111
- .wds-inline-prompt--positive a:active,
3112
- .wds-inline-prompt--positive button:active {
3113
- color: var(--color-sentiment-positive-primary-active);
3114
- }
3115
- .wds-inline-prompt.wds-inline-prompt--positive:has(a, button):hover {
3116
- background-color: var(--color-sentiment-positive-secondary-hover);
3117
- }
3118
- .wds-inline-prompt.wds-inline-prompt--positive:has(a, button):active {
3119
- background-color: var(--color-sentiment-positive-secondary-active);
3120
- }
3121
- .wds-inline-prompt--proposition {
3122
- background-color: var(--color-sentiment-positive-secondary);
3123
- color: var(--color-sentiment-positive-primary);
3124
- }
3125
- .wds-inline-prompt--proposition a,
3126
- .wds-inline-prompt--proposition button {
3127
- color: var(--color-sentiment-positive-primary);
3128
- }
3129
- .wds-inline-prompt--proposition a:hover,
3130
- .wds-inline-prompt--proposition button:hover {
3131
- color: var(--color-sentiment-positive-primary-hover);
3132
- }
3133
- .wds-inline-prompt--proposition a:active,
3134
- .wds-inline-prompt--proposition button:active {
3135
- color: var(--color-sentiment-positive-primary-active);
3136
- }
3137
- .wds-inline-prompt.wds-inline-prompt--proposition:has(a, button):hover {
3138
- background-color: var(--color-sentiment-positive-secondary-hover);
3139
- }
3140
- .wds-inline-prompt.wds-inline-prompt--proposition:has(a, button):active {
3141
- background-color: var(--color-sentiment-positive-secondary-active);
3142
- }
3143
- .wds-inline-prompt--neutral {
3144
- background-color: rgba(134,167,189,0.10196);
3145
- background-color: var(--color-background-neutral);
3146
- color: #37517e;
3147
- color: var(--color-content-primary);
3148
- }
3149
- .wds-inline-prompt--neutral a,
3150
- .wds-inline-prompt--neutral button {
3151
- color: #37517e;
3152
- color: var(--color-content-primary);
3153
- }
3154
- .wds-inline-prompt.wds-inline-prompt--neutral:has(a, button):hover {
3155
- background-color: var(--color-background-neutral-hover);
3156
- }
3157
- .wds-inline-prompt.wds-inline-prompt--neutral:has(a, button):active {
3158
- background-color: var(--color-background-neutral-active);
3159
- }
3160
- .wds-inline-prompt--warning {
3161
- background-color: var(--color-sentiment-warning-secondary);
3162
- color: var(--color-sentiment-warning-content);
3163
- }
3164
- .wds-inline-prompt--warning a,
3165
- .wds-inline-prompt--warning button {
3166
- color: var(--color-sentiment-warning-content);
3167
- }
3168
- .wds-inline-prompt--warning a:hover,
3169
- .wds-inline-prompt--warning button:hover {
3170
- color: var(--color-sentiment-warning-content-hover);
3171
- }
3172
- .wds-inline-prompt--warning a:active,
3173
- .wds-inline-prompt--warning button:active {
3174
- color: var(--color-sentiment-warning-content-active);
3175
- }
3176
- .wds-inline-prompt.wds-inline-prompt--warning:has(a, button):hover {
3177
- background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 92%, var(--color-sentiment-warning-primary));
3178
- }
3179
- .wds-inline-prompt.wds-inline-prompt--warning:has(a, button):active {
3180
- background-color: color-mix(in srgb, var(--color-sentiment-warning-secondary) 84%, var(--color-sentiment-warning-primary));
3181
- }
3182
3187
  .wds-list-item-prompt {
3183
3188
  grid-area: prompt;
3184
3189
  justify-self: start;
@@ -3220,6 +3225,11 @@ html:not([dir="rtl"]) .np-flow-navigation--sm .np-flow-navigation__stepper {
3220
3225
  text-underline-offset: calc(4px / 2);
3221
3226
  text-underline-offset: calc(var(--size-4) / 2);
3222
3227
  }
3228
+ .wds-list-item a .wds-list-item-subtitle,
3229
+ .wds-list-item a .wds-list-item-subtitle-value {
3230
+ color: #5d7079;
3231
+ color: var(--color-content-secondary);
3232
+ }
3223
3233
  .wds-list-item-interactive .wds-list-item-control:focus-visible,
3224
3234
  .wds-list-item-interactive .np-checkbox-button:has(input[type="checkbox"]:focus-visible) .tw-checkbox-button {
3225
3235
  outline: none;
package/src/main.less CHANGED
@@ -4,6 +4,7 @@
4
4
  @import "./actionOption/ActionOption.less";
5
5
  @import "./alert/Alert.less";
6
6
  @import "./avatar/Avatar.less";
7
+ @import "./prompt/InlinePrompt/InlinePrompt.less";
7
8
  @import "./avatarView/AvatarView.less";
8
9
  @import "./avatarLayout/AvatarLayout.less";
9
10
  @import "./iconButton/IconButton.less";
@@ -406,7 +406,7 @@ describe('Money Input', () => {
406
406
  </>,
407
407
  );
408
408
 
409
- expect(screen.getAllByLabelText('Prioritized label')[0]).toHaveClass('input-group');
409
+ expect(screen.getAllByLabelText('Prioritized label')[0]).toHaveClass('np-form-control');
410
410
  });
411
411
 
412
412
  it('supports `Field` for labeling', () => {
@@ -415,9 +415,24 @@ describe('Money Input', () => {
415
415
  <MoneyInput {...initialProps} />
416
416
  </Field>,
417
417
  );
418
+
418
419
  expect(screen.getAllByRole('group')[0]).toHaveAccessibleName(/^Recipient gets/);
419
420
  });
420
421
 
422
+ it('focuses money input when `Field` label is clicked', async () => {
423
+ const label = 'Recipient gets';
424
+
425
+ render(
426
+ <Field label={label}>
427
+ <MoneyInput {...initialProps} />
428
+ </Field>,
429
+ );
430
+
431
+ const input = screen.getByRole('textbox');
432
+ await userEvent.click(screen.getByLabelText(label));
433
+ expect(input).toHaveFocus();
434
+ });
435
+
421
436
  describe('ids', () => {
422
437
  it('renders Select component with generated id when id is not provided', () => {
423
438
  customRender();
@@ -313,10 +313,10 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
313
313
  const selectedCurrencyElementId = `${inputAttributes?.id ?? amountInputId}SelectedCurrency`;
314
314
 
315
315
  return (
316
- <div
317
- role="group"
318
- {...inputAttributes}
319
- aria-labelledby={ariaLabelledBy}
316
+ <fieldset
317
+ aria-invalid={inputAttributes?.['aria-invalid']}
318
+ aria-describedby={inputAttributes?.['aria-describedby']}
319
+ aria-labelledby={inputAttributes?.id ?? amountInputId}
320
320
  className={clsx(
321
321
  this.style('tw-money-input'),
322
322
  this.style('input-group'),
@@ -324,7 +324,8 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
324
324
  )}
325
325
  >
326
326
  <Input
327
- id={amountInputId}
327
+ id={inputAttributes?.id ?? amountInputId}
328
+ aria-labelledby={ariaLabelledBy}
328
329
  value={this.state.formattedAmount}
329
330
  inputMode="decimal"
330
331
  disabled={disabled}
@@ -430,7 +431,7 @@ class MoneyInput extends Component<MoneyInputPropsWithInputAttributes, MoneyInpu
430
431
  />
431
432
  </div>
432
433
  )}
433
- </div>
434
+ </fieldset>
434
435
  );
435
436
  }
436
437
  }
@@ -0,0 +1,142 @@
1
+ import React, { ReactNode } from 'react';
2
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
3
+ import clsx from 'clsx';
4
+ import AvatarView from '../avatarView';
5
+ import Tooltip from '../tooltip';
6
+ import IconButton from '../iconButton';
7
+ import Body from '../body';
8
+
9
+ const meta: Meta = {
10
+ title: 'NeptuneCSS',
11
+ component: () => <div>NeptuneCSS Example</div>,
12
+ };
13
+
14
+ export default meta;
15
+
16
+ type Story = StoryObj;
17
+
18
+ export const Colors: Story = {
19
+ render: () => {
20
+ return (
21
+ <Body>
22
+ {colorTokens.map((token) => (
23
+ <ColorToken key={token} token={token} className="m-b-2" />
24
+ ))}
25
+ </Body>
26
+ );
27
+ },
28
+ };
29
+
30
+ const colorTokens = [
31
+ '--color-content-primary',
32
+ '--color-bright-yellow',
33
+ '--color-bright-orange',
34
+ '--color-dark-purple',
35
+ '--color-dark-gold',
36
+ '--color-bright-blue',
37
+ '--color-dark-charcoal',
38
+ '--color-white',
39
+ '--color-black',
40
+ '--color-bright-green',
41
+ '--color-forest-green',
42
+ '--color-bright-pink',
43
+ '--color-dark-maroon',
44
+ '--color-content-primary',
45
+ '--color-content-secondary',
46
+ '--color-content-tertiary',
47
+ '--color-content-link',
48
+ '--color-content-link-hover',
49
+ '--color-content-link-active',
50
+ '--color-interactive-control',
51
+ '--color-interactive-control-hover',
52
+ '--color-interactive-control-active',
53
+ '--color-interactive-primary',
54
+ '--color-interactive-primary-hover',
55
+ '--color-interactive-primary-active',
56
+ '--color-interactive-secondary',
57
+ '--color-interactive-secondary-hover',
58
+ '--color-interactive-secondary-active',
59
+ '--color-interactive-accent',
60
+ '--color-interactive-accent-hover',
61
+ '--color-interactive-accent-active',
62
+ '--color-interactive-contrast',
63
+ '--color-interactive-contrast-hover',
64
+ '--color-interactive-contrast-active',
65
+ '--color-interactive-neutral',
66
+ '--color-interactive-neutral-hover',
67
+ '--color-interactive-neutral-active',
68
+ '--color-border-neutral',
69
+ '--color-border-overlay',
70
+ '--color-background-screen',
71
+ '--color-background-screen-hover',
72
+ '--color-background-screen-active',
73
+ '--color-background-elevated',
74
+ '--color-background-neutral',
75
+ '--color-background-neutral-hover',
76
+ '--color-background-neutral-active',
77
+ '--color-background-overlay',
78
+ '--color-background-surface',
79
+ '--color-sentiment-negative',
80
+ '--color-sentiment-negative-hover',
81
+ '--color-sentiment-negative-active',
82
+ '--color-sentiment-negative-primary',
83
+ '--color-sentiment-negative-primary-hover',
84
+ '--color-sentiment-negative-primary-active',
85
+ '--color-sentiment-negative-secondary',
86
+ '--color-sentiment-negative-secondary-hover',
87
+ '--color-sentiment-negative-secondary-active',
88
+ '--color-sentiment-positive',
89
+ '--color-sentiment-positive-hover',
90
+ '--color-sentiment-positive-active',
91
+ '--color-sentiment-positive-primary',
92
+ '--color-sentiment-positive-primary-hover',
93
+ '--color-sentiment-positive-primary-active',
94
+ '--color-sentiment-positive-secondary',
95
+ '--color-sentiment-positive-secondary-hover',
96
+ '--color-sentiment-positive-secondary-active',
97
+ '--color-sentiment-warning',
98
+ '--color-sentiment-warning-hover',
99
+ '--color-sentiment-warning-active',
100
+ '--color-sentiment-warning-primary',
101
+ '--color-sentiment-warning-primary-hover',
102
+ '--color-sentiment-warning-primary-active',
103
+ '--color-sentiment-warning-secondary',
104
+ '--color-sentiment-warning-secondary-hover',
105
+ '--color-sentiment-warning-secondary-active',
106
+ '--color-sentiment-warning-content',
107
+ '--color-sentiment-warning-content-hover',
108
+ '--color-sentiment-warning-content-active',
109
+ '--color-contrast',
110
+ '--color-light',
111
+ '--color-dark',
112
+ '--color-contrast-overlay',
113
+ '--color-contrast-theme',
114
+ ];
115
+
116
+ function ColorToken(props: { token: string; className?: string }) {
117
+ const color = `var(${props.token})`;
118
+ const [tooltipLabel, setTooltipLabel] = React.useState<ReactNode>('Copy Token Name');
119
+ return (
120
+ <div className={clsx('d-flex', 'align-items-center', props.className)}>
121
+ <IconButton
122
+ aria-label="Copy color"
123
+ size={72}
124
+ className="m-r-2"
125
+ onClick={async () => {
126
+ await navigator.clipboard.writeText(color);
127
+ setTooltipLabel('Copied!');
128
+ }}
129
+ >
130
+ <Tooltip label={<Body type="body-large-bold">{tooltipLabel}</Body>} position="top">
131
+ <AvatarView
132
+ size={72}
133
+ style={{ backgroundColor: color, border: 'solid 1px var(--color-border-neutral)' }}
134
+ >
135
+ {null}
136
+ </AvatarView>
137
+ </Tooltip>
138
+ </IconButton>
139
+ <code className="m-l-2">{props.token}</code>
140
+ </div>
141
+ );
142
+ }
@@ -314,4 +314,36 @@ describe('PhoneNumberInput', () => {
314
314
  );
315
315
  expect(screen.getAllByRole('group')[0]).toHaveAccessibleName(/^Phone number/);
316
316
  });
317
+
318
+ it('focuses country code input when `Field` label is clicked', async () => {
319
+ const label = 'Phone number';
320
+
321
+ render(
322
+ <Field label={label}>
323
+ <PhoneNumberInput initialValue="+12345678" onChange={() => {}} />
324
+ </Field>,
325
+ );
326
+
327
+ await userEvent.click(screen.getByText(label, { selector: 'label:not(.sr-only)' })); // Have to use `getByText` due to the way `Field` handles group labelling
328
+ const countryCodeFilterInput = screen.getByRole('combobox');
329
+ expect(countryCodeFilterInput).toHaveFocus();
330
+ });
331
+
332
+ it('focuses number input when `Field` label is clicked and country code is disabled', async () => {
333
+ const label = 'Phone number';
334
+
335
+ render(
336
+ <Field label={label}>
337
+ <PhoneNumberInput
338
+ initialValue="+12345678"
339
+ selectProps={{ disabled: true }}
340
+ onChange={() => {}}
341
+ />
342
+ </Field>,
343
+ );
344
+
345
+ const phoneNumberInput = screen.getByRole('textbox');
346
+ await userEvent.click(screen.getByText(label, { selector: 'label:not(.sr-only)' })); // Have to use `getByText` due to the way `Field` handles group labelling
347
+ expect(phoneNumberInput).toHaveFocus();
348
+ });
317
349
  });
@@ -1,8 +1,8 @@
1
- import { useState, useEffect, useMemo } from 'react';
1
+ import { useState, useEffect, useMemo, useRef } from 'react';
2
2
  import { useIntl } from 'react-intl';
3
3
 
4
4
  import { Size, SizeLarge, SizeMedium, SizeSmall } from '../common';
5
- import { useInputAttributes } from '../inputs/contexts';
5
+ import { useFieldLabelRef, useInputAttributes } from '../inputs/contexts';
6
6
  import { SelectInput, SelectInputOptionContent, SelectInputProps } from '../inputs/SelectInput';
7
7
  import messages from './PhoneNumberInput.messages';
8
8
  import countries from './data/countries';
@@ -58,7 +58,10 @@ const PhoneNumberInput = ({
58
58
  selectProps = defaultSelectProps,
59
59
  disabledCountries = defaultDisabledCountries,
60
60
  }: PhoneNumberInputProps) => {
61
+ const countryCodeSelectRef = useRef<HTMLButtonElement>(null);
62
+ const phoneNumberInputRef = useRef<HTMLInputElement>(null);
61
63
  const inputAttributes = useInputAttributes({ nonLabelable: true });
64
+ const fieldLabelRef = useFieldLabelRef();
62
65
  const ariaLabelledBy = ariaLabelledByProp ?? inputAttributes['aria-labelledby'];
63
66
 
64
67
  const { locale, formatMessage } = useIntl();
@@ -71,6 +74,7 @@ const PhoneNumberInput = ({
71
74
  return `${backup}-${random}`;
72
75
  };
73
76
 
77
+ // Link the first non-disabled input to the the Field label, if present
74
78
  const ids = {
75
79
  countryCode: {
76
80
  label: createId(id, 'country-code-label'),
@@ -162,18 +166,34 @@ const PhoneNumberInput = ({
162
166
  setBroadcastedValue(internalValue);
163
167
  }, [onChange, broadcastedValue, internalValue]);
164
168
 
169
+ useEffect(() => {
170
+ const labelRef = fieldLabelRef?.current;
171
+
172
+ if (labelRef) {
173
+ const handleLabelClick = () => {
174
+ if (!selectProps.disabled) {
175
+ countryCodeSelectRef.current?.click();
176
+ } else {
177
+ phoneNumberInputRef.current?.focus();
178
+ }
179
+ };
180
+
181
+ labelRef.addEventListener('click', handleLabelClick);
182
+
183
+ return () => {
184
+ labelRef?.removeEventListener('click', handleLabelClick);
185
+ };
186
+ }
187
+ }, [fieldLabelRef, selectProps.disabled]);
188
+
165
189
  return (
166
- <div
167
- role="group"
168
- {...inputAttributes}
169
- aria-labelledby={ariaLabelledBy}
170
- className="tw-telephone"
171
- >
172
- <label className="sr-only" id={ids.countryCode.label}>
190
+ <fieldset {...inputAttributes} aria-labelledby={ariaLabelledBy} className="tw-telephone">
191
+ <label className="sr-only" id={ids.countryCode.label} htmlFor={ids.countryCode.select}>
173
192
  {formatMessage(messages.countryCodeLabel)}
174
193
  </label>
175
194
  <div className="tw-telephone__country-select">
176
195
  <SelectInput
196
+ triggerRef={countryCodeSelectRef}
177
197
  placeholder={formatMessage(messages.selectInputPlaceholder)}
178
198
  items={[...countriesByPrefix].map(([prefix, countries]) => ({
179
199
  type: 'option',
@@ -225,8 +245,9 @@ const PhoneNumberInput = ({
225
245
  {formatMessage(messages.phoneNumberLabel)}
226
246
  </label>
227
247
  <div className="tw-telephone__number-input">
228
- <div className={`input-group input-group-${size}`}>
248
+ <div className={`input-group input-group-${size} ${disabled ? 'disabled' : ''}`}>
229
249
  <Input
250
+ ref={phoneNumberInputRef}
230
251
  id={ids.phoneNumber.input}
231
252
  autoComplete="tel-national"
232
253
  name="phoneNumber"
@@ -243,7 +264,7 @@ const PhoneNumberInput = ({
243
264
  />
244
265
  </div>
245
266
  </div>
246
- </div>
267
+ </fieldset>
247
268
  );
248
269
  };
249
270