@box/blueprint-web 10.5.0 → 11.0.0

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.
@@ -1631,6 +1631,20 @@
1631
1631
  .bp_text_area_module_textAreaContainer--71ba4 .bp_text_area_module_inlineError--71ba4{
1632
1632
  margin-block-start:var(--space-2);
1633
1633
  }
1634
+ .bp_labelable_module_required--23e9d{
1635
+ align-items:center;
1636
+ display:inline-flex;
1637
+ gap:var(--space-1);
1638
+ }
1639
+ .bp_labelable_module_required--23e9d::before{
1640
+ color:var(--icon-icon-required-on-light);
1641
+ content:"*";
1642
+ font-family:monospace;
1643
+ transform:scale(1.2);
1644
+ }
1645
+ .bp_labelable_module_required--23e9d::before *{
1646
+ fill:var(--icon-icon-required-on-light);
1647
+ }
1634
1648
 
1635
1649
  .bp_combobox_module_container--076fd{
1636
1650
  display:flex;
@@ -4605,23 +4619,24 @@ table.bp_inline_table_module_inlineTable--b023b tr:not(:last-child) td{
4605
4619
  width:100%;
4606
4620
  }
4607
4621
 
4608
- .bp_password_input_module_passwordInput--83618 input[type=password],.bp_password_input_module_passwordInput--83618 input[type=text]{
4622
+ .bp_password_input_module_passwordInput--c5ea1 input[type=password],.bp_password_input_module_passwordInput--c5ea1 input[type=text]{
4609
4623
  padding-inline-end:2.375rem;
4610
4624
  }
4611
- .bp_password_input_module_passwordInput--83618 .bp_password_input_module_iconButton--83618{
4625
+ .bp_password_input_module_passwordInput--c5ea1 .bp_password_input_module_iconButton--c5ea1{
4626
+ height:1.5rem;
4612
4627
  inset-inline-end:.5rem;
4628
+ width:1.5rem;
4613
4629
  }
4614
- .bp_password_input_module_passwordInput--83618 .bp_password_input_module_iconButton--83618:active,.bp_password_input_module_passwordInput--83618 .bp_password_input_module_iconButton--83618:hover{
4630
+ .bp_password_input_module_passwordInput--c5ea1 .bp_password_input_module_iconButton--c5ea1:active,.bp_password_input_module_passwordInput--c5ea1 .bp_password_input_module_iconButton--c5ea1:hover{
4615
4631
  background:none;
4616
4632
  }
4617
4633
 
4618
- .bp_base_text_input_module_textInputContainer--36482{
4634
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7{
4619
4635
  display:flex;
4620
4636
  flex-direction:column;
4621
4637
  font-weight:400;
4622
- position:relative;
4623
4638
  }
4624
- .bp_base_text_input_module_textInputContainer--36482,.bp_base_text_input_module_textInputContainer--36482 .bp_base_text_input_module_label--36482{
4639
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_label--3d7b7{
4625
4640
  font-family:Lato, -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
4626
4641
  font-size:.875rem;
4627
4642
  letter-spacing:.01875rem;
@@ -4629,17 +4644,22 @@ table.bp_inline_table_module_inlineTable--b023b tr:not(:last-child) td{
4629
4644
  text-decoration:none;
4630
4645
  text-transform:none;
4631
4646
  }
4632
- .bp_base_text_input_module_textInputContainer--36482 .bp_base_text_input_module_label--36482{
4647
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_label--3d7b7{
4633
4648
  color:#222;
4634
4649
  flex:0 0 fit-content;
4635
4650
  font-weight:700;
4636
4651
  width:-moz-fit-content;
4637
4652
  width:fit-content;
4638
4653
  }
4639
- .bp_base_text_input_module_textInputContainer--36482 .bp_base_text_input_module_label--36482:not(.bp_base_text_input_module_hidden--36482){
4654
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_label--3d7b7:not(.bp_base_text_input_module_hidden--3d7b7){
4640
4655
  margin-block-end:var(--space-2);
4641
4656
  }
4642
- .bp_base_text_input_module_textInputContainer--36482 .bp_base_text_input_module_textInput--36482,.bp_base_text_input_module_textInputContainer--36482 input[type=number].bp_base_text_input_module_textInput--36482,.bp_base_text_input_module_textInputContainer--36482 input[type=text].bp_base_text_input_module_textInput--36482{
4657
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7{
4658
+ display:flex;
4659
+ height:2.5rem;
4660
+ position:relative;
4661
+ }
4662
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_textInput--3d7b7,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=number].bp_base_text_input_module_textInput--3d7b7,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=text].bp_base_text_input_module_textInput--3d7b7{
4643
4663
  background:#fff;
4644
4664
  border:.0625rem solid #909090;
4645
4665
  border-radius:.375rem;
@@ -4649,62 +4669,83 @@ table.bp_inline_table_module_inlineTable--b023b tr:not(:last-child) td{
4649
4669
  font-family:Lato, -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
4650
4670
  font-size:.875rem;
4651
4671
  font-weight:400;
4652
- height:2.5rem;
4672
+ height:100%;
4653
4673
  letter-spacing:.01875rem;
4654
4674
  line-height:1.25rem;
4655
4675
  padding-block:0;
4656
4676
  padding-inline:.75rem;
4657
4677
  text-decoration:none;
4658
4678
  text-transform:none;
4659
- width:unset;
4679
+ width:100%;
4660
4680
  }
4661
- .bp_base_text_input_module_textInputContainer--36482 .bp_base_text_input_module_textInput--36482:hover,.bp_base_text_input_module_textInputContainer--36482 input[type=number].bp_base_text_input_module_textInput--36482:hover,.bp_base_text_input_module_textInputContainer--36482 input[type=text].bp_base_text_input_module_textInput--36482:hover{
4681
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_textInput--3d7b7:hover,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=number].bp_base_text_input_module_textInput--3d7b7:hover,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=text].bp_base_text_input_module_textInput--3d7b7:hover{
4662
4682
  box-shadow:var(--innershadow-1);
4663
4683
  }
4664
- .bp_base_text_input_module_textInputContainer--36482 .bp_base_text_input_module_textInput--36482::placeholder,.bp_base_text_input_module_textInputContainer--36482 input[type=number].bp_base_text_input_module_textInput--36482::placeholder,.bp_base_text_input_module_textInputContainer--36482 input[type=text].bp_base_text_input_module_textInput--36482::placeholder{
4684
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_textInput--3d7b7::placeholder,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=number].bp_base_text_input_module_textInput--3d7b7::placeholder,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=text].bp_base_text_input_module_textInput--3d7b7::placeholder{
4665
4685
  color:#6f6f6f;
4666
4686
  opacity:1;
4667
4687
  }
4668
- .bp_base_text_input_module_textInputContainer--36482 .bp_base_text_input_module_textInput--36482.bp_base_text_input_module_error--36482,.bp_base_text_input_module_textInputContainer--36482 input[type=number].bp_base_text_input_module_textInput--36482.bp_base_text_input_module_error--36482,.bp_base_text_input_module_textInputContainer--36482 input[type=text].bp_base_text_input_module_textInput--36482.bp_base_text_input_module_error--36482{
4688
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_textInput--3d7b7.bp_base_text_input_module_error--3d7b7,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=number].bp_base_text_input_module_textInput--3d7b7.bp_base_text_input_module_error--3d7b7,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=text].bp_base_text_input_module_textInput--3d7b7.bp_base_text_input_module_error--3d7b7{
4669
4689
  background:#fff;
4670
4690
  border:.125rem solid #ed3757;
4671
4691
  outline:0;
4672
4692
  padding-inline-start:.6875rem;
4673
4693
  }
4674
- .bp_base_text_input_module_textInputContainer--36482 .bp_base_text_input_module_textInput--36482:disabled,.bp_base_text_input_module_textInputContainer--36482 input[type=number].bp_base_text_input_module_textInput--36482:disabled,.bp_base_text_input_module_textInputContainer--36482 input[type=text].bp_base_text_input_module_textInput--36482:disabled{
4694
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_textInput--3d7b7.bp_base_text_input_module_readOnly--3d7b7,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=number].bp_base_text_input_module_textInput--3d7b7.bp_base_text_input_module_readOnly--3d7b7,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=text].bp_base_text_input_module_textInput--3d7b7.bp_base_text_input_module_readOnly--3d7b7{
4695
+ border-color:var(--border-collapsible-border);
4696
+ box-shadow:var(--innershadow-1);
4697
+ color:var(--text-text-on-light-secondary);
4698
+ }
4699
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_textInput--3d7b7.bp_base_text_input_module_readOnly--3d7b7:focus-visible,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=number].bp_base_text_input_module_textInput--3d7b7.bp_base_text_input_module_readOnly--3d7b7:focus-visible,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=text].bp_base_text_input_module_textInput--3d7b7.bp_base_text_input_module_readOnly--3d7b7:focus-visible{
4700
+ border:.125rem solid #2486fc;
4701
+ }
4702
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_textInput--3d7b7.bp_base_text_input_module_readOnly--3d7b7:hover,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=number].bp_base_text_input_module_textInput--3d7b7.bp_base_text_input_module_readOnly--3d7b7:hover,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=text].bp_base_text_input_module_textInput--3d7b7.bp_base_text_input_module_readOnly--3d7b7:hover{
4703
+ cursor:default;
4704
+ }
4705
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_textInput--3d7b7:disabled,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=number].bp_base_text_input_module_textInput--3d7b7:disabled,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=text].bp_base_text_input_module_textInput--3d7b7:disabled{
4675
4706
  background:var(--surface-input-surface);
4676
4707
  border-color:var(--border-input-border);
4677
4708
  box-shadow:var(--innershadow-1);
4678
4709
  color:var(--text-text-on-light);
4679
4710
  }
4680
- .bp_base_text_input_module_textInputContainer--36482 .bp_base_text_input_module_textInput--36482:disabled:hover,.bp_base_text_input_module_textInputContainer--36482 input[type=number].bp_base_text_input_module_textInput--36482:disabled:hover,.bp_base_text_input_module_textInputContainer--36482 input[type=text].bp_base_text_input_module_textInput--36482:disabled:hover{
4711
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_textInput--3d7b7:disabled:hover,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=number].bp_base_text_input_module_textInput--3d7b7:disabled:hover,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=text].bp_base_text_input_module_textInput--3d7b7:disabled:hover{
4681
4712
  border-color:var(--border-input-border);
4682
4713
  }
4683
- .bp_base_text_input_module_textInputContainer--36482 .bp_base_text_input_module_textInput--36482:focus-visible,.bp_base_text_input_module_textInputContainer--36482 input[type=number].bp_base_text_input_module_textInput--36482:focus-visible,.bp_base_text_input_module_textInputContainer--36482 input[type=text].bp_base_text_input_module_textInput--36482:focus-visible{
4714
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_textInput--3d7b7:focus-visible,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=number].bp_base_text_input_module_textInput--3d7b7:focus-visible,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=text].bp_base_text_input_module_textInput--3d7b7:focus-visible{
4684
4715
  background:#fff;
4685
4716
  border:.125rem solid #2486fc;
4686
4717
  outline:0;
4687
4718
  padding-inline-start:.6875rem;
4688
4719
  }
4689
- .bp_base_text_input_module_textInputContainer--36482 .bp_base_text_input_module_textInput--36482:focus-visible:has(+ :not(.bp_base_text_input_module_iconShared--36482)),.bp_base_text_input_module_textInputContainer--36482 input[type=number].bp_base_text_input_module_textInput--36482:focus-visible:has(+ :not(.bp_base_text_input_module_iconShared--36482)),.bp_base_text_input_module_textInputContainer--36482 input[type=text].bp_base_text_input_module_textInput--36482:focus-visible:has(+ :not(.bp_base_text_input_module_iconShared--36482)){
4690
- padding-inline:.6875rem;
4720
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_textInput--3d7b7:has(+ .bp_base_text_input_module_endIcon--3d7b7),.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=number].bp_base_text_input_module_textInput--3d7b7:has(+ .bp_base_text_input_module_endIcon--3d7b7),.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=text].bp_base_text_input_module_textInput--3d7b7:has(+ .bp_base_text_input_module_endIcon--3d7b7){
4721
+ padding-inline-end:calc(1.25rem + var(--end-icon-width));
4691
4722
  }
4692
- .bp_base_text_input_module_textInputContainer--36482 .bp_base_text_input_module_textInput--36482:not(:disabled):not(:focus-visible):not(.bp_base_text_input_module_error--36482):hover,.bp_base_text_input_module_textInputContainer--36482 input[type=number].bp_base_text_input_module_textInput--36482:not(:disabled):not(:focus-visible):not(.bp_base_text_input_module_error--36482):hover,.bp_base_text_input_module_textInputContainer--36482 input[type=text].bp_base_text_input_module_textInput--36482:not(:disabled):not(:focus-visible):not(.bp_base_text_input_module_error--36482):hover{
4723
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_textInput--3d7b7:not(:disabled):not(:focus-visible):not(.bp_base_text_input_module_error--3d7b7):hover,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=number].bp_base_text_input_module_textInput--3d7b7:not(:disabled):not(:focus-visible):not(.bp_base_text_input_module_error--3d7b7):hover,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 input[type=text].bp_base_text_input_module_textInput--3d7b7:not(:disabled):not(:focus-visible):not(.bp_base_text_input_module_error--3d7b7):hover{
4693
4724
  background:#fff;
4694
4725
  border:.0625rem solid #6f6f6f;
4695
4726
  }
4696
- .bp_base_text_input_module_textInputContainer--36482 .bp_base_text_input_module_iconShared--36482{
4697
- height:1.5rem;
4698
- inset-block-end:.375rem;
4699
- inset-inline-start:unset;
4727
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_startIcon--3d7b7{
4728
+ left:.8125rem;
4700
4729
  position:absolute;
4701
- width:1.5rem;
4730
+ top:50%;
4731
+ transform:translateY(-50%);
4702
4732
  }
4703
- .bp_base_text_input_module_textInputContainer--36482.bp_base_text_input_module_disabled--36482{
4733
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_startIcon--3d7b7 + input.bp_base_text_input_module_textInput--3d7b7{
4734
+ padding-inline-start:calc(1.25rem + var(--start-icon-width));
4735
+ }
4736
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_startIcon--3d7b7 + input.bp_base_text_input_module_textInput--3d7b7.bp_base_text_input_module_error--3d7b7,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_startIcon--3d7b7 + input.bp_base_text_input_module_textInput--3d7b7:focus-visible{
4737
+ padding-inline-start:calc(1.1875rem + var(--start-icon-width));
4738
+ }
4739
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_textInputContainer--3d7b7 .bp_base_text_input_module_endIcon--3d7b7{
4740
+ position:absolute;
4741
+ right:.8125rem;
4742
+ top:50%;
4743
+ transform:translateY(-50%);
4744
+ }
4745
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7.bp_base_text_input_module_disabled--3d7b7{
4704
4746
  opacity:60%;
4705
4747
  }
4706
-
4707
- .bp_base_text_input_module_inlineError--36482{
4748
+ .bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_inlineError--3d7b7,.bp_base_text_input_module_textInputContainerOuter--3d7b7 .bp_base_text_input_module_subtext--3d7b7{
4708
4749
  margin-block-start:var(--space-2);
4709
4750
  }
4710
4751
  .bp_chip_module_chip--26416{
@@ -6254,10 +6295,14 @@ div[data-radix-popper-content-wrapper]:has([role=menu]):has([data-state=open]):h
6254
6295
  color:var(--text-cta-link-pressed);
6255
6296
  }
6256
6297
 
6257
- .bp_text_input_module_textInput--c6e69.bp_text_input_module_textInput--c6e69.bp_text_input_module_textInput--c6e69 input:has(+ .bp_text_input_module_iconLoading--c6e69){
6298
+ .bp_text_input_module_textInput--2839a.bp_text_input_module_textInput--2839a.bp_text_input_module_textInput--2839a input:has(+ .bp_text_input_module_iconEnd--2839a){
6258
6299
  padding-inline-end:1.875rem;
6259
6300
  }
6260
6301
 
6302
+ .bp_text_input_module_loadingIndicatorReset--2839a div{
6303
+ position:static;
6304
+ }
6305
+
6261
6306
  .bp_text_toggle_button_module_textToggleButton--f8bea{
6262
6307
  background:var(--surface-toggle-surface);
6263
6308
  border:var(--border-1) solid var(--border-toggletext-border-off);
@@ -1,8 +1,8 @@
1
- export declare const PasswordInput: import("react").ForwardRefExoticComponent<(Omit<Omit<import("../text-input").TextInputProps, "type" | "icon" | "loading" | "loadingAriaLabel"> & {
1
+ export declare const PasswordInput: import("react").ForwardRefExoticComponent<(Omit<Omit<import("../text-input").TextInputProps, "type" | "loading" | "loadingAriaLabel" | "icon"> & {
2
2
  showPasswordAriaLabel: string;
3
3
  hidePasswordAriaLabel: string;
4
4
  autoComplete: "current-password" | "new-password";
5
- } & Required<Pick<import("./types").ControlledComponentProps, keyof import("./types").ControlledComponentProps>> & Omit<import("./types").ControlledComponentProps, keyof import("./types").ControlledComponentProps>, "ref"> | Omit<Omit<import("../text-input").TextInputProps, "type" | "icon" | "loading" | "loadingAriaLabel"> & {
5
+ } & Required<Pick<import("./types").ControlledComponentProps, keyof import("./types").ControlledComponentProps>> & Omit<import("./types").ControlledComponentProps, keyof import("./types").ControlledComponentProps>, "ref"> | Omit<Omit<import("../text-input").TextInputProps, "type" | "loading" | "loadingAriaLabel" | "icon"> & {
6
6
  showPasswordAriaLabel: string;
7
7
  hidePasswordAriaLabel: string;
8
8
  autoComplete: "current-password" | "new-password";
@@ -36,7 +36,7 @@ const PasswordInput = /*#__PURE__*/forwardRef((props, forwardedRef) => {
36
36
  ref: useForkRef(inputRef, forwardedRef),
37
37
  autoComplete: autocomplete,
38
38
  className: clsx(styles.passwordInput, props.className),
39
- icon: jsx(IconButton, {
39
+ endIcon: jsx(IconButton, {
40
40
  "aria-controls": inputId,
41
41
  "aria-label": iconButtonAriaLabel,
42
42
  className: styles.iconButton,
@@ -1,4 +1,4 @@
1
1
  import '../index.css';
2
- var styles = {"passwordInput":"bp_password_input_module_passwordInput--83618","iconButton":"bp_password_input_module_iconButton--83618"};
2
+ var styles = {"passwordInput":"bp_password_input_module_passwordInput--c5ea1","iconButton":"bp_password_input_module_iconButton--c5ea1"};
3
3
 
4
4
  export { styles as default };
@@ -1,10 +1,11 @@
1
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import clsx from 'clsx';
3
- import { forwardRef, useMemo, cloneElement } from 'react';
3
+ import { forwardRef, useState, useMemo, cloneElement } from 'react';
4
+ import { Text } from '../../text/text.js';
5
+ import { useLabelable } from '../../util-components/labelable/useLabelable.js';
4
6
  import { useUniqueId } from '../../utils/useUniqueId.js';
5
7
  import { InlineError } from '../inline-error/inline-error.js';
6
8
  import styles from './base-text-input.module.js';
7
- import { useLabelable } from '../../util-components/labelable/useLabelable.js';
8
9
 
9
10
  /**
10
11
  * This extends a default HTML &lt;input/&gt; and accepts the same props as well as some custom ones listed below.<br/>
@@ -20,53 +21,87 @@ const BaseTextInput = /*#__PURE__*/forwardRef((props, forwardedRef) => {
20
21
  disabled,
21
22
  invalid = false,
22
23
  hideLabel,
24
+ readOnly,
23
25
  error,
24
26
  required = false,
25
- icon,
27
+ endIcon,
28
+ startIcon,
29
+ subtext,
26
30
  id,
27
31
  ...rest
28
32
  } = props;
29
33
  const uniqueId = useUniqueId('input-');
30
34
  const inputId = id || uniqueId;
31
35
  const inlineErrorId = useUniqueId('inline-error-');
36
+ const subtextId = useUniqueId('subtext-');
32
37
  const hasError = !!error && !disabled;
33
38
  const shouldMarkError = (!!error || invalid) && !disabled;
34
39
  const ariaDescribedBy = clsx(rest['aria-describedby'], {
35
40
  [inlineErrorId]: hasError
36
41
  });
37
- const IconComponent = useMemo(() => icon && /*#__PURE__*/cloneElement(icon, {
38
- className: clsx(icon.props?.className, styles.iconShared)
39
- }), [icon]);
40
- const Label = useLabelable(label, inputId);
41
- return jsxs(Fragment, {
42
- children: [jsxs("div", {
43
- className: clsx([styles.textInputContainer], {
44
- [styles.disabled]: disabled,
45
- [styles.error]: shouldMarkError
46
- }, className),
47
- children: [jsx(Label, {
48
- className: clsx([styles.label], {
49
- [styles.hidden]: hideLabel
50
- }),
51
- hideLabel: hideLabel
52
- }), jsx("input", {
42
+ const [startIconWidth, setStartIconWidth] = useState(null);
43
+ const [endIconWidth, setEndIconWidth] = useState(null);
44
+ const StartIconComponent = useMemo(() => startIcon && /*#__PURE__*/cloneElement(startIcon, {
45
+ ref: node => {
46
+ if (node) {
47
+ setStartIconWidth(node.getBoundingClientRect().width);
48
+ }
49
+ },
50
+ className: clsx(startIcon.props?.className, styles.startIcon)
51
+ }), [startIcon]);
52
+ const EndIconComponent = useMemo(() => endIcon && /*#__PURE__*/cloneElement(endIcon, {
53
+ ref: node => {
54
+ if (node) {
55
+ setEndIconWidth(node.getBoundingClientRect().width);
56
+ }
57
+ },
58
+ className: clsx(endIcon.props?.className, styles.endIcon)
59
+ }), [endIcon]);
60
+ const hasSubtext = !error && !!subtext;
61
+ const Label = useLabelable(label, inputId, required);
62
+ return jsxs("div", {
63
+ className: clsx([styles.textInputContainerOuter], {
64
+ [styles.disabled]: disabled,
65
+ [styles.error]: shouldMarkError
66
+ }),
67
+ children: [jsx(Label, {
68
+ className: clsx([styles.label], {
69
+ [styles.hidden]: hideLabel
70
+ }),
71
+ hideLabel: hideLabel
72
+ }), jsxs("div", {
73
+ className: clsx([styles.textInputContainer], className),
74
+ style: {
75
+ '--end-icon-width': endIconWidth ? `${endIconWidth}px` : '0px',
76
+ '--start-icon-width': startIconWidth ? `${startIconWidth}px` : '0px'
77
+ },
78
+ children: [StartIconComponent, jsx("input", {
53
79
  ...rest,
54
80
  ref: forwardedRef,
55
81
  "aria-describedby": ariaDescribedBy,
56
82
  "aria-invalid": shouldMarkError,
57
83
  "aria-required": required,
58
84
  className: clsx([styles.textInput], {
59
- [styles.error]: shouldMarkError
85
+ [styles.error]: shouldMarkError,
86
+ [styles.readOnly]: readOnly
60
87
  }),
61
88
  disabled: disabled,
62
89
  id: inputId,
90
+ readOnly: readOnly,
63
91
  required: required,
64
92
  type: type
65
- }), IconComponent]
93
+ }), EndIconComponent]
66
94
  }), jsx(InlineError, {
67
95
  className: styles.inlineError,
68
96
  id: inlineErrorId,
69
97
  children: error
98
+ }), hasSubtext && jsx(Text, {
99
+ as: "p",
100
+ className: styles.subtext,
101
+ color: "textOnLightSecondary",
102
+ id: subtextId,
103
+ variant: "caption",
104
+ children: subtext
70
105
  })]
71
106
  });
72
107
  });
@@ -1,4 +1,4 @@
1
1
  import '../../index.css';
2
- var styles = {"textInputContainer":"bp_base_text_input_module_textInputContainer--36482","label":"bp_base_text_input_module_label--36482","hidden":"bp_base_text_input_module_hidden--36482","textInput":"bp_base_text_input_module_textInput--36482","error":"bp_base_text_input_module_error--36482","iconShared":"bp_base_text_input_module_iconShared--36482","disabled":"bp_base_text_input_module_disabled--36482","inlineError":"bp_base_text_input_module_inlineError--36482"};
2
+ var styles = {"textInputContainerOuter":"bp_base_text_input_module_textInputContainerOuter--3d7b7","label":"bp_base_text_input_module_label--3d7b7","hidden":"bp_base_text_input_module_hidden--3d7b7","textInputContainer":"bp_base_text_input_module_textInputContainer--3d7b7","textInput":"bp_base_text_input_module_textInput--3d7b7","error":"bp_base_text_input_module_error--3d7b7","readOnly":"bp_base_text_input_module_readOnly--3d7b7","endIcon":"bp_base_text_input_module_endIcon--3d7b7","startIcon":"bp_base_text_input_module_startIcon--3d7b7","disabled":"bp_base_text_input_module_disabled--3d7b7","inlineError":"bp_base_text_input_module_inlineError--3d7b7","subtext":"bp_base_text_input_module_subtext--3d7b7"};
3
3
 
4
4
  export { styles as default };
@@ -17,8 +17,13 @@ export type BaseTextInputProps = React.ComponentPropsWithRef<'input'> & Labelabl
17
17
  /** Content of error message */
18
18
  error?: React.ReactNode;
19
19
  /**
20
- * Custom icon to be rendered after input
20
+ * Custom icon to be rendered after the input
21
21
  * When loading is true and input is not disabled prop value will be ignored
22
22
  * */
23
- icon?: React.ReactElement;
23
+ endIcon?: React.ReactElement;
24
+ /**
25
+ * Custom icon to be rendered before the input
26
+ * */
27
+ startIcon?: React.ReactElement;
28
+ subtext?: string;
24
29
  };
@@ -1 +1,25 @@
1
- export declare const TextInput: import("react").ForwardRefExoticComponent<(Omit<Omit<import("../primitives/base-text-input").BaseTextInputProps, "icon"> & Required<Pick<import("./types").Loading, keyof import("./types").Loading>> & Omit<import("./types").Loading, keyof import("./types").Loading>, "ref"> | Omit<Omit<import("../primitives/base-text-input").BaseTextInputProps, "icon"> & Partial<Record<keyof import("./types").Loading, never>> & Omit<import("./types").Loading, keyof import("./types").Loading>, "ref">) & import("react").RefAttributes<HTMLInputElement>>;
1
+ export declare const TextInput: import("react").ForwardRefExoticComponent<(Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
2
+ ref?: ((instance: HTMLInputElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLInputElement> | null | undefined;
3
+ } & import("../..").Labelable & {
4
+ type?: "text" | "password";
5
+ hideLabel?: boolean;
6
+ invalid?: boolean;
7
+ disabled?: boolean;
8
+ required?: boolean;
9
+ error?: React.ReactNode;
10
+ endIcon?: React.ReactElement;
11
+ startIcon?: React.ReactElement;
12
+ subtext?: string;
13
+ } & Required<Pick<import("./types").Loading, keyof import("./types").Loading>> & Omit<import("./types").Loading, keyof import("./types").Loading>, "ref"> | Omit<Omit<import("react").DetailedHTMLProps<import("react").InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & {
14
+ ref?: ((instance: HTMLInputElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLInputElement> | null | undefined;
15
+ } & import("../..").Labelable & {
16
+ type?: "text" | "password";
17
+ hideLabel?: boolean;
18
+ invalid?: boolean;
19
+ disabled?: boolean;
20
+ required?: boolean;
21
+ error?: React.ReactNode;
22
+ endIcon?: React.ReactElement;
23
+ startIcon?: React.ReactElement;
24
+ subtext?: string;
25
+ } & Partial<Record<keyof import("./types").Loading, never>> & Omit<import("./types").Loading, keyof import("./types").Loading>, "ref">) & import("react").RefAttributes<HTMLInputElement>>;
@@ -1,13 +1,17 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { forwardRef, useRef, useCallback, useMemo } from 'react';
2
+ import { PencilCrossed } from '@box/blueprint-web-assets/icons/Fill';
3
3
  import clsx from 'clsx';
4
+ import { forwardRef, useRef, useCallback, useMemo, cloneElement } from 'react';
4
5
  import { LoadingIndicator } from '../loading-indicator/loading-indicator.js';
5
- import styles from './text-input.module.js';
6
6
  import { BaseTextInput } from '../primitives/base-text-input/base-text-input.js';
7
7
  import { useForkRef } from '../utils/useForkRef.js';
8
+ import styles from './text-input.module.js';
8
9
 
9
10
  const TextInput = /*#__PURE__*/forwardRef((props, forwardedRef) => {
10
11
  const {
12
+ readOnly,
13
+ startIcon,
14
+ endIcon,
11
15
  loading = false,
12
16
  loadingAriaLabel,
13
17
  ...rest
@@ -17,17 +21,47 @@ const TextInput = /*#__PURE__*/forwardRef((props, forwardedRef) => {
17
21
  inputRef.current?.focus();
18
22
  }, []);
19
23
  const isLoading = !props.disabled && loading && loadingAriaLabel;
20
- const icon = useMemo(() => isLoading && jsx(LoadingIndicator, {
21
- "aria-label": loadingAriaLabel,
22
- className: styles.iconLoading,
23
- onClick: focusInput
24
- }), [isLoading, loadingAriaLabel, focusInput]);
24
+ const endIconLocal = useMemo(() => {
25
+ if (isLoading) {
26
+ return jsx("div", {
27
+ className: styles.loadingIndicatorReset,
28
+ children: jsx(LoadingIndicator, {
29
+ "aria-label": loadingAriaLabel,
30
+ onClick: focusInput
31
+ })
32
+ });
33
+ }
34
+ if (endIcon) {
35
+ return /*#__PURE__*/cloneElement(endIcon, {
36
+ onClick: focusInput
37
+ });
38
+ }
39
+ if (readOnly) {
40
+ return jsx(PencilCrossed, {
41
+ onClick: focusInput,
42
+ role: "presentation"
43
+ });
44
+ }
45
+ return null;
46
+ }, [isLoading, endIcon, readOnly, loadingAriaLabel, focusInput]);
47
+ const startIconLocal = useMemo(() => {
48
+ if (startIcon) {
49
+ return /*#__PURE__*/cloneElement(startIcon, {
50
+ onClick: focusInput
51
+ });
52
+ }
53
+ return null;
54
+ }, [startIcon, focusInput]);
25
55
  return jsx(BaseTextInput, {
26
56
  ...rest,
27
57
  ref: useForkRef(inputRef, forwardedRef),
28
58
  className: clsx(styles.textInput, props.className),
29
- ...(icon ? {
30
- icon
59
+ readOnly: readOnly,
60
+ ...(endIconLocal ? {
61
+ endIcon: endIconLocal
62
+ } : {}),
63
+ ...(startIconLocal ? {
64
+ startIcon: startIconLocal
31
65
  } : {})
32
66
  });
33
67
  });
@@ -1,4 +1,4 @@
1
1
  import '../index.css';
2
- var styles = {"textInput":"bp_text_input_module_textInput--c6e69","iconLoading":"bp_text_input_module_iconLoading--c6e69"};
2
+ var styles = {"textInput":"bp_text_input_module_textInput--2839a","iconEnd":"bp_text_input_module_iconEnd--2839a","loadingIndicatorReset":"bp_text_input_module_loadingIndicatorReset--2839a"};
3
3
 
4
4
  export { styles as default };
@@ -1,9 +1,9 @@
1
1
  import { type RequireAllOrNone } from 'type-fest';
2
2
  import { type BaseTextInputProps } from '../primitives/base-text-input';
3
3
  export interface Loading {
4
- /** When true input is renedered with loading indicator. When this is true `loadingAriaLabel` must also be provided. */
4
+ /** When true input is rendered with loading indicator. When this is true `loadingAriaLabel` must also be provided. */
5
5
  loading?: boolean;
6
6
  /** The aria-label for the loading indicator. */
7
7
  loadingAriaLabel?: string;
8
8
  }
9
- export type TextInputProps = Omit<BaseTextInputProps, 'icon'> & RequireAllOrNone<Loading, keyof Loading>;
9
+ export type TextInputProps = BaseTextInputProps & RequireAllOrNone<Loading, keyof Loading>;
@@ -0,0 +1,4 @@
1
+ import '../../index.css';
2
+ var styles = {"required":"bp_labelable_module_required--23e9d"};
3
+
4
+ export { styles as default };
@@ -1,2 +1,2 @@
1
1
  import { type Labelable, type LabelProps } from './types';
2
- export declare const useLabelable: (label: Labelable["label"], inputId: string) => import("react").ForwardRefExoticComponent<Omit<Omit<LabelProps, "htmlFor">, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
2
+ export declare const useLabelable: (label: Labelable["label"], inputId: string, isRequired?: boolean) => import("react").ForwardRefExoticComponent<Omit<Omit<LabelProps, "htmlFor">, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
@@ -1,10 +1,12 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { useMemo, forwardRef } from 'react';
3
2
  import { Role } from '@ariakit/react';
3
+ import clsx from 'clsx';
4
+ import { useMemo, forwardRef } from 'react';
4
5
  import { useContextProps, LabelContext } from 'react-aria-components';
5
6
  import { VisuallyHidden } from '../../visually-hidden/visually-hidden.js';
7
+ import styles from './labelable.module.js';
6
8
 
7
- const useLabelable = (label, inputId) => {
9
+ const useLabelable = (label, inputId, isRequired = false) => {
8
10
  return useMemo(() => {
9
11
  const Label = /*#__PURE__*/forwardRef((props, ref) => {
10
12
  // If this component is rendered within LabelContext from RAC, we can have props like htmlFor, id, elementType.
@@ -17,7 +19,10 @@ const useLabelable = (label, inputId) => {
17
19
  const labelProps = {
18
20
  ...rest,
19
21
  htmlFor: inputId,
20
- ref
22
+ ref,
23
+ className: clsx(rest.className, {
24
+ [styles.required]: isRequired
25
+ })
21
26
  };
22
27
  if (!label) {
23
28
  return null;
@@ -63,7 +68,7 @@ const useLabelable = (label, inputId) => {
63
68
  });
64
69
  Label.displayName = 'Label';
65
70
  return Label;
66
- }, [label, inputId]);
71
+ }, [inputId, isRequired, label]);
67
72
  };
68
73
 
69
74
  export { useLabelable };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/blueprint-web",
3
- "version": "10.5.0",
3
+ "version": "11.0.0",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": {