@box/blueprint-web 19.2.0 → 19.2.2

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.
@@ -4486,7 +4486,7 @@
4486
4486
  font-family:monospace;
4487
4487
  transform:scale(1.2);
4488
4488
  }
4489
- .bp_text_area_autosize_module_textArea--7ee36{
4489
+ .bp_text_area_autosize_module_textArea--eeec2{
4490
4490
  --text-area-inner-shadow:var(--innershadow-1);
4491
4491
  --text-area-text-color:var(--bp-text-text-on-light);
4492
4492
  --text-area-background-color:var(--bp-surface-input-surface);
@@ -4506,7 +4506,7 @@
4506
4506
  letter-spacing:var(--bp-font-letter-spacing-01);
4507
4507
  line-height:var(--bp-font-line-height-04);
4508
4508
  }
4509
- :where(body.is-inter-font) .bp_text_area_autosize_module_textArea--7ee36{
4509
+ :where(body.is-inter-font) .bp_text_area_autosize_module_textArea--eeec2{
4510
4510
  font-family:"Inter Variable", -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
4511
4511
  font-size:.875rem;
4512
4512
  font-style:normal;
@@ -4517,7 +4517,7 @@
4517
4517
  text-transform:none;
4518
4518
  }
4519
4519
 
4520
- .bp_text_area_autosize_module_textArea--7ee36{
4520
+ .bp_text_area_autosize_module_textArea--eeec2{
4521
4521
  background:var(--text-area-background-color);
4522
4522
  border:none;
4523
4523
  box-shadow:var(--text-area-inner-shadow);
@@ -4528,47 +4528,47 @@
4528
4528
  resize:none;
4529
4529
  width:100%;
4530
4530
  }
4531
- .bp_text_area_autosize_module_textArea--7ee36.bp_text_area_autosize_module_withEndIcon--7ee36{
4531
+ .bp_text_area_autosize_module_textArea--eeec2.bp_text_area_autosize_module_withEndIcon--eeec2{
4532
4532
  padding-inline-end:calc(var(--text-area-padding-inline) + var(--end-icon-width) + var(--text-area-icon-padding));
4533
4533
  }
4534
- .bp_text_area_autosize_module_textArea--7ee36::placeholder{
4534
+ .bp_text_area_autosize_module_textArea--eeec2::placeholder{
4535
4535
  color:var(--text-area-placeholder-color);
4536
4536
  opacity:1;
4537
4537
  }
4538
- .bp_text_area_autosize_module_textArea--7ee36.bp_text_area_autosize_module_error--7ee36{
4538
+ .bp_text_area_autosize_module_textArea--eeec2.bp_text_area_autosize_module_error--eeec2{
4539
4539
  background:var(--text-area-error-background-color);
4540
4540
  outline:0;
4541
4541
  }
4542
- .bp_text_area_autosize_module_textArea--7ee36:focus{
4542
+ .bp_text_area_autosize_module_textArea--eeec2:focus{
4543
4543
  border:none;
4544
4544
  }
4545
- .bp_text_area_autosize_module_textArea--7ee36:hover{
4545
+ .bp_text_area_autosize_module_textArea--eeec2:hover{
4546
4546
  box-shadow:var(--text-area-inner-shadow);
4547
4547
  }
4548
- .bp_text_area_autosize_module_textArea--7ee36:focus-visible{
4548
+ .bp_text_area_autosize_module_textArea--eeec2:focus-visible{
4549
4549
  background:var(--text-area-error-background-focus);
4550
4550
  outline:0;
4551
4551
  }
4552
- .bp_text_area_autosize_module_textArea--7ee36:disabled{
4552
+ .bp_text_area_autosize_module_textArea--eeec2:disabled{
4553
4553
  background:var(--text-area-background-color);
4554
4554
  border:none;
4555
4555
  box-shadow:var(--text-area-inner-shadow);
4556
4556
  color:var(--text-area-text-color);
4557
4557
  }
4558
- .bp_text_area_autosize_module_textArea--7ee36.bp_text_area_autosize_module_readOnly--7ee36{
4558
+ .bp_text_area_autosize_module_textArea--eeec2.bp_text_area_autosize_module_readOnly--eeec2{
4559
4559
  background-color:var(--text-area-read-only-background-color);
4560
4560
  color:var(--text-area-read-only-color);
4561
4561
  cursor:default;
4562
4562
  }
4563
- .bp_text_area_autosize_module_textArea--7ee36:not(:disabled, :focus-visible, .bp_text_area_autosize_module_error--7ee36):hover{
4563
+ .bp_text_area_autosize_module_textArea--eeec2:not(:disabled, :focus-visible, .bp_text_area_autosize_module_error--eeec2):hover{
4564
4564
  background:var(--text-area-error-background-hover);
4565
4565
  }
4566
4566
 
4567
- .bp_text_area_autosize_module_loadingIndicatorReset--7ee36 div{
4567
+ .bp_text_area_autosize_module_loadingIndicatorReset--eeec2 div{
4568
4568
  position:static;
4569
4569
  }
4570
4570
 
4571
- .bp_text_area_autosize_module_border--7ee36{
4571
+ .bp_text_area_autosize_module_border--eeec2{
4572
4572
  --text-area-radius:var(--bp-radius-06);
4573
4573
  --text-area-border-width:var(--bp-border-01);
4574
4574
  --text-area-shadow-color:var(--bp-border-input-border);
@@ -4586,27 +4586,30 @@
4586
4586
  position:relative;
4587
4587
  transform:translateZ(0);
4588
4588
  }
4589
- .bp_text_area_autosize_module_border--7ee36.bp_text_area_autosize_module_readOnly--7ee36{
4589
+ .bp_text_area_autosize_module_border--eeec2.bp_text_area_autosize_module_readOnly--eeec2{
4590
4590
  box-shadow:0 0 0 var(--text-area-border-width) var(--text-area-border-color-read-only);
4591
4591
  cursor:default;
4592
4592
  }
4593
- .bp_text_area_autosize_module_border--7ee36:focus-within{
4593
+ .bp_text_area_autosize_module_border--eeec2:focus-within{
4594
4594
  box-shadow:0 0 0 var(--text-area-border-width-focus) var(--text-area-border-color-focus);
4595
4595
  }
4596
- .bp_text_area_autosize_module_border--7ee36:hover:not(:focus-within, .bp_text_area_autosize_module_hasError--7ee36, .bp_text_area_autosize_module_disabled--7ee36){
4596
+ .bp_text_area_autosize_module_border--eeec2:hover:not(:focus-within, .bp_text_area_autosize_module_hasError--eeec2, .bp_text_area_autosize_module_disabled--eeec2){
4597
4597
  box-shadow:0 0 0 var(--text-area-border-width) var(--text-area-border-color-hover);
4598
4598
  }
4599
- .bp_text_area_autosize_module_border--7ee36.bp_text_area_autosize_module_hasError--7ee36{
4599
+ .bp_text_area_autosize_module_border--eeec2.bp_text_area_autosize_module_hasError--eeec2:not(:focus-within){
4600
4600
  box-shadow:0 0 0 var(--text-area-border-width-error) var(--text-area-border-color-error);
4601
4601
  }
4602
- .bp_text_area_autosize_module_border--7ee36 .bp_text_area_autosize_module_endIconWrap--7ee36{
4602
+ .bp_text_area_autosize_module_border--eeec2.bp_text_area_autosize_module_hasError--eeec2:focus-within{
4603
+ box-shadow:0 0 0 var(--text-area-border-width-focus) var(--text-area-border-color-focus);
4604
+ }
4605
+ .bp_text_area_autosize_module_border--eeec2 .bp_text_area_autosize_module_endIconWrap--eeec2{
4603
4606
  height:var(--bp-space-100);
4604
4607
  pointer-events:none;
4605
4608
  position:absolute;
4606
4609
  right:0;
4607
4610
  top:0;
4608
4611
  }
4609
- .bp_text_area_autosize_module_border--7ee36 .bp_text_area_autosize_module_endIconWrap--7ee36 .bp_text_area_autosize_module_endIcon--7ee36{
4612
+ .bp_text_area_autosize_module_border--eeec2 .bp_text_area_autosize_module_endIconWrap--eeec2 .bp_text_area_autosize_module_endIcon--eeec2{
4610
4613
  pointer-events:auto;
4611
4614
  position:absolute;
4612
4615
  right:calc(var(--text-area-padding-inline) + var(--text-area-border-width));
@@ -4614,20 +4617,20 @@
4614
4617
  transform:translateY(-50%);
4615
4618
  }
4616
4619
 
4617
- .bp_text_area_autosize_module_border--7ee36[data-bp-animated=true]{
4620
+ .bp_text_area_autosize_module_border--eeec2[data-bp-animated=true]{
4618
4621
  transition-duration:var(--bp-duration-short);
4619
4622
  transition-property:box-shadow;
4620
4623
  transition-timing-function:var(--bp-curve-small-off);
4621
4624
  }
4622
- .bp_text_area_autosize_module_border--7ee36[data-bp-animated=true].bp_text_area_autosize_module_hasError--7ee36,.bp_text_area_autosize_module_border--7ee36[data-bp-animated=true]:focus-within,.bp_text_area_autosize_module_border--7ee36[data-bp-animated=true]:hover:not(:focus-within, .bp_text_area_autosize_module_hasError--7ee36, .bp_text_area_autosize_module_disabled--7ee36){
4625
+ .bp_text_area_autosize_module_border--eeec2[data-bp-animated=true].bp_text_area_autosize_module_hasError--eeec2,.bp_text_area_autosize_module_border--eeec2[data-bp-animated=true]:focus-within,.bp_text_area_autosize_module_border--eeec2[data-bp-animated=true]:hover:not(:focus-within, .bp_text_area_autosize_module_hasError--eeec2, .bp_text_area_autosize_module_disabled--eeec2){
4623
4626
  transition-timing-function:var(--bp-curve-small-on);
4624
4627
  }
4625
- .bp_text_area_autosize_module_border--7ee36[data-bp-animated=true] .bp_text_area_autosize_module_textArea--7ee36{
4628
+ .bp_text_area_autosize_module_border--eeec2[data-bp-animated=true] .bp_text_area_autosize_module_textArea--eeec2{
4626
4629
  transition-duration:var(--bp-duration-short);
4627
4630
  transition-property:background-color;
4628
4631
  transition-timing-function:var(--bp-curve-small-off);
4629
4632
  }
4630
- .bp_text_area_autosize_module_border--7ee36[data-bp-animated=true] .bp_text_area_autosize_module_textArea--7ee36:not(:disabled).bp_text_area_autosize_module_error--7ee36,.bp_text_area_autosize_module_border--7ee36[data-bp-animated=true] .bp_text_area_autosize_module_textArea--7ee36:not(:disabled):focus-visible,.bp_text_area_autosize_module_border--7ee36[data-bp-animated=true] .bp_text_area_autosize_module_textArea--7ee36:not(:disabled):hover{
4633
+ .bp_text_area_autosize_module_border--eeec2[data-bp-animated=true] .bp_text_area_autosize_module_textArea--eeec2:not(:disabled).bp_text_area_autosize_module_error--eeec2,.bp_text_area_autosize_module_border--eeec2[data-bp-animated=true] .bp_text_area_autosize_module_textArea--eeec2:not(:disabled):focus-visible,.bp_text_area_autosize_module_border--eeec2[data-bp-animated=true] .bp_text_area_autosize_module_textArea--eeec2:not(:disabled):hover{
4631
4634
  transition-timing-function:var(--bp-curve-small-on);
4632
4635
  }
4633
4636
  .bp_text_area_module_textAreaContainer--a5e4e{
@@ -4486,7 +4486,7 @@
4486
4486
  font-family:monospace;
4487
4487
  transform:scale(1.2);
4488
4488
  }
4489
- .bp_text_area_autosize_module_textArea--7ee36{
4489
+ .bp_text_area_autosize_module_textArea--eeec2{
4490
4490
  --text-area-inner-shadow:var(--innershadow-1);
4491
4491
  --text-area-text-color:var(--bp-text-text-on-light);
4492
4492
  --text-area-background-color:var(--bp-surface-input-surface);
@@ -4506,7 +4506,7 @@
4506
4506
  letter-spacing:var(--bp-font-letter-spacing-01);
4507
4507
  line-height:var(--bp-font-line-height-04);
4508
4508
  }
4509
- :where(body.is-inter-font) .bp_text_area_autosize_module_textArea--7ee36{
4509
+ :where(body.is-inter-font) .bp_text_area_autosize_module_textArea--eeec2{
4510
4510
  font-family:"Inter Variable", -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
4511
4511
  font-size:.875rem;
4512
4512
  font-style:normal;
@@ -4517,7 +4517,7 @@
4517
4517
  text-transform:none;
4518
4518
  }
4519
4519
 
4520
- .bp_text_area_autosize_module_textArea--7ee36{
4520
+ .bp_text_area_autosize_module_textArea--eeec2{
4521
4521
  background:var(--text-area-background-color);
4522
4522
  border:none;
4523
4523
  box-shadow:var(--text-area-inner-shadow);
@@ -4528,47 +4528,47 @@
4528
4528
  resize:none;
4529
4529
  width:100%;
4530
4530
  }
4531
- .bp_text_area_autosize_module_textArea--7ee36.bp_text_area_autosize_module_withEndIcon--7ee36{
4531
+ .bp_text_area_autosize_module_textArea--eeec2.bp_text_area_autosize_module_withEndIcon--eeec2{
4532
4532
  padding-inline-end:calc(var(--text-area-padding-inline) + var(--end-icon-width) + var(--text-area-icon-padding));
4533
4533
  }
4534
- .bp_text_area_autosize_module_textArea--7ee36::placeholder{
4534
+ .bp_text_area_autosize_module_textArea--eeec2::placeholder{
4535
4535
  color:var(--text-area-placeholder-color);
4536
4536
  opacity:1;
4537
4537
  }
4538
- .bp_text_area_autosize_module_textArea--7ee36.bp_text_area_autosize_module_error--7ee36{
4538
+ .bp_text_area_autosize_module_textArea--eeec2.bp_text_area_autosize_module_error--eeec2{
4539
4539
  background:var(--text-area-error-background-color);
4540
4540
  outline:0;
4541
4541
  }
4542
- .bp_text_area_autosize_module_textArea--7ee36:focus{
4542
+ .bp_text_area_autosize_module_textArea--eeec2:focus{
4543
4543
  border:none;
4544
4544
  }
4545
- .bp_text_area_autosize_module_textArea--7ee36:hover{
4545
+ .bp_text_area_autosize_module_textArea--eeec2:hover{
4546
4546
  box-shadow:var(--text-area-inner-shadow);
4547
4547
  }
4548
- .bp_text_area_autosize_module_textArea--7ee36:focus-visible{
4548
+ .bp_text_area_autosize_module_textArea--eeec2:focus-visible{
4549
4549
  background:var(--text-area-error-background-focus);
4550
4550
  outline:0;
4551
4551
  }
4552
- .bp_text_area_autosize_module_textArea--7ee36:disabled{
4552
+ .bp_text_area_autosize_module_textArea--eeec2:disabled{
4553
4553
  background:var(--text-area-background-color);
4554
4554
  border:none;
4555
4555
  box-shadow:var(--text-area-inner-shadow);
4556
4556
  color:var(--text-area-text-color);
4557
4557
  }
4558
- .bp_text_area_autosize_module_textArea--7ee36.bp_text_area_autosize_module_readOnly--7ee36{
4558
+ .bp_text_area_autosize_module_textArea--eeec2.bp_text_area_autosize_module_readOnly--eeec2{
4559
4559
  background-color:var(--text-area-read-only-background-color);
4560
4560
  color:var(--text-area-read-only-color);
4561
4561
  cursor:default;
4562
4562
  }
4563
- .bp_text_area_autosize_module_textArea--7ee36:not(:disabled, :focus-visible, .bp_text_area_autosize_module_error--7ee36):hover{
4563
+ .bp_text_area_autosize_module_textArea--eeec2:not(:disabled, :focus-visible, .bp_text_area_autosize_module_error--eeec2):hover{
4564
4564
  background:var(--text-area-error-background-hover);
4565
4565
  }
4566
4566
 
4567
- .bp_text_area_autosize_module_loadingIndicatorReset--7ee36 div{
4567
+ .bp_text_area_autosize_module_loadingIndicatorReset--eeec2 div{
4568
4568
  position:static;
4569
4569
  }
4570
4570
 
4571
- .bp_text_area_autosize_module_border--7ee36{
4571
+ .bp_text_area_autosize_module_border--eeec2{
4572
4572
  --text-area-radius:var(--bp-radius-06);
4573
4573
  --text-area-border-width:var(--bp-border-01);
4574
4574
  --text-area-shadow-color:var(--bp-border-input-border);
@@ -4586,27 +4586,30 @@
4586
4586
  position:relative;
4587
4587
  transform:translateZ(0);
4588
4588
  }
4589
- .bp_text_area_autosize_module_border--7ee36.bp_text_area_autosize_module_readOnly--7ee36{
4589
+ .bp_text_area_autosize_module_border--eeec2.bp_text_area_autosize_module_readOnly--eeec2{
4590
4590
  box-shadow:0 0 0 var(--text-area-border-width) var(--text-area-border-color-read-only);
4591
4591
  cursor:default;
4592
4592
  }
4593
- .bp_text_area_autosize_module_border--7ee36:focus-within{
4593
+ .bp_text_area_autosize_module_border--eeec2:focus-within{
4594
4594
  box-shadow:0 0 0 var(--text-area-border-width-focus) var(--text-area-border-color-focus);
4595
4595
  }
4596
- .bp_text_area_autosize_module_border--7ee36:hover:not(:focus-within, .bp_text_area_autosize_module_hasError--7ee36, .bp_text_area_autosize_module_disabled--7ee36){
4596
+ .bp_text_area_autosize_module_border--eeec2:hover:not(:focus-within, .bp_text_area_autosize_module_hasError--eeec2, .bp_text_area_autosize_module_disabled--eeec2){
4597
4597
  box-shadow:0 0 0 var(--text-area-border-width) var(--text-area-border-color-hover);
4598
4598
  }
4599
- .bp_text_area_autosize_module_border--7ee36.bp_text_area_autosize_module_hasError--7ee36{
4599
+ .bp_text_area_autosize_module_border--eeec2.bp_text_area_autosize_module_hasError--eeec2:not(:focus-within){
4600
4600
  box-shadow:0 0 0 var(--text-area-border-width-error) var(--text-area-border-color-error);
4601
4601
  }
4602
- .bp_text_area_autosize_module_border--7ee36 .bp_text_area_autosize_module_endIconWrap--7ee36{
4602
+ .bp_text_area_autosize_module_border--eeec2.bp_text_area_autosize_module_hasError--eeec2:focus-within{
4603
+ box-shadow:0 0 0 var(--text-area-border-width-focus) var(--text-area-border-color-focus);
4604
+ }
4605
+ .bp_text_area_autosize_module_border--eeec2 .bp_text_area_autosize_module_endIconWrap--eeec2{
4603
4606
  height:var(--bp-space-100);
4604
4607
  pointer-events:none;
4605
4608
  position:absolute;
4606
4609
  right:0;
4607
4610
  top:0;
4608
4611
  }
4609
- .bp_text_area_autosize_module_border--7ee36 .bp_text_area_autosize_module_endIconWrap--7ee36 .bp_text_area_autosize_module_endIcon--7ee36{
4612
+ .bp_text_area_autosize_module_border--eeec2 .bp_text_area_autosize_module_endIconWrap--eeec2 .bp_text_area_autosize_module_endIcon--eeec2{
4610
4613
  pointer-events:auto;
4611
4614
  position:absolute;
4612
4615
  right:calc(var(--text-area-padding-inline) + var(--text-area-border-width));
@@ -4614,20 +4617,20 @@
4614
4617
  transform:translateY(-50%);
4615
4618
  }
4616
4619
 
4617
- .bp_text_area_autosize_module_border--7ee36[data-bp-animated=true]{
4620
+ .bp_text_area_autosize_module_border--eeec2[data-bp-animated=true]{
4618
4621
  transition-duration:var(--bp-duration-short);
4619
4622
  transition-property:box-shadow;
4620
4623
  transition-timing-function:var(--bp-curve-small-off);
4621
4624
  }
4622
- .bp_text_area_autosize_module_border--7ee36[data-bp-animated=true].bp_text_area_autosize_module_hasError--7ee36,.bp_text_area_autosize_module_border--7ee36[data-bp-animated=true]:focus-within,.bp_text_area_autosize_module_border--7ee36[data-bp-animated=true]:hover:not(:focus-within, .bp_text_area_autosize_module_hasError--7ee36, .bp_text_area_autosize_module_disabled--7ee36){
4625
+ .bp_text_area_autosize_module_border--eeec2[data-bp-animated=true].bp_text_area_autosize_module_hasError--eeec2,.bp_text_area_autosize_module_border--eeec2[data-bp-animated=true]:focus-within,.bp_text_area_autosize_module_border--eeec2[data-bp-animated=true]:hover:not(:focus-within, .bp_text_area_autosize_module_hasError--eeec2, .bp_text_area_autosize_module_disabled--eeec2){
4623
4626
  transition-timing-function:var(--bp-curve-small-on);
4624
4627
  }
4625
- .bp_text_area_autosize_module_border--7ee36[data-bp-animated=true] .bp_text_area_autosize_module_textArea--7ee36{
4628
+ .bp_text_area_autosize_module_border--eeec2[data-bp-animated=true] .bp_text_area_autosize_module_textArea--eeec2{
4626
4629
  transition-duration:var(--bp-duration-short);
4627
4630
  transition-property:background-color;
4628
4631
  transition-timing-function:var(--bp-curve-small-off);
4629
4632
  }
4630
- .bp_text_area_autosize_module_border--7ee36[data-bp-animated=true] .bp_text_area_autosize_module_textArea--7ee36:not(:disabled).bp_text_area_autosize_module_error--7ee36,.bp_text_area_autosize_module_border--7ee36[data-bp-animated=true] .bp_text_area_autosize_module_textArea--7ee36:not(:disabled):focus-visible,.bp_text_area_autosize_module_border--7ee36[data-bp-animated=true] .bp_text_area_autosize_module_textArea--7ee36:not(:disabled):hover{
4633
+ .bp_text_area_autosize_module_border--eeec2[data-bp-animated=true] .bp_text_area_autosize_module_textArea--eeec2:not(:disabled).bp_text_area_autosize_module_error--eeec2,.bp_text_area_autosize_module_border--eeec2[data-bp-animated=true] .bp_text_area_autosize_module_textArea--eeec2:not(:disabled):focus-visible,.bp_text_area_autosize_module_border--eeec2[data-bp-animated=true] .bp_text_area_autosize_module_textArea--eeec2:not(:disabled):hover{
4631
4634
  transition-timing-function:var(--bp-curve-small-on);
4632
4635
  }
4633
4636
  .bp_text_area_module_textAreaContainer--a5e4e{
@@ -3,11 +3,14 @@ interface SelectContextValue {
3
3
  registerLeftElement: (value: string, element: ReactNode) => void;
4
4
  unregisterLeftElement: (value: string) => void;
5
5
  getLeftElement: (value: string) => ReactNode;
6
+ subscribeToLeftElements: (listener: () => void) => () => void;
6
7
  truncateText: boolean;
7
8
  isAnimationEnabled: boolean;
8
9
  isExiting: boolean;
9
10
  hasExitStyles: boolean;
10
11
  completeExit: () => void;
12
+ canOpen: boolean;
13
+ selectedValue?: string;
11
14
  }
12
15
  export declare const useSelectContext: () => SelectContextValue;
13
16
  interface SelectProviderProps {
@@ -16,7 +19,9 @@ interface SelectProviderProps {
16
19
  isExiting: boolean;
17
20
  hasExitStyles: boolean;
18
21
  completeExit: () => void;
22
+ canOpen: boolean;
23
+ selectedValue?: string;
19
24
  children: ReactNode;
20
25
  }
21
- export declare const SelectProvider: ({ truncateText, isAnimationEnabled, isExiting, hasExitStyles, completeExit, children, }: SelectProviderProps) => import("react/jsx-runtime").JSX.Element;
26
+ export declare const SelectProvider: ({ truncateText, isAnimationEnabled, isExiting, hasExitStyles, completeExit, canOpen, selectedValue, children, }: SelectProviderProps) => import("react/jsx-runtime").JSX.Element;
22
27
  export {};
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { useState, useCallback, useMemo, useContext, createContext } from 'react';
2
+ import { useState, useMemo, useContext, createContext } from 'react';
3
3
  import { throwOnDev } from '../utils/throwOnDev.js';
4
4
 
5
5
  const defaultContextValue = {
@@ -10,13 +10,17 @@ const defaultContextValue = {
10
10
  /* noop */
11
11
  },
12
12
  getLeftElement: () => null,
13
+ subscribeToLeftElements: () => () => {
14
+ /* noop */
15
+ },
13
16
  truncateText: false,
14
17
  isAnimationEnabled: false,
15
18
  isExiting: false,
16
19
  hasExitStyles: false,
17
20
  completeExit: () => {
18
21
  /* noop */
19
- }
22
+ },
23
+ canOpen: true
20
24
  };
21
25
  const SelectContext = /*#__PURE__*/createContext(null);
22
26
  const useSelectContext = () => {
@@ -27,42 +31,50 @@ const useSelectContext = () => {
27
31
  }
28
32
  return context;
29
33
  };
34
+ // Kept outside React state so that registering an option's left element does not re-render every option.
35
+ const createLeftElementStore = () => {
36
+ const elements = new Map();
37
+ const listeners = new Set();
38
+ const notify = () => listeners.forEach(listener => listener());
39
+ return {
40
+ registerLeftElement: (value, element) => {
41
+ elements.set(value, element);
42
+ notify();
43
+ },
44
+ unregisterLeftElement: value => {
45
+ elements.delete(value);
46
+ notify();
47
+ },
48
+ getLeftElement: value => elements.get(value),
49
+ subscribeToLeftElements: listener => {
50
+ listeners.add(listener);
51
+ return () => {
52
+ listeners.delete(listener);
53
+ };
54
+ }
55
+ };
56
+ };
30
57
  const SelectProvider = ({
31
58
  truncateText,
32
59
  isAnimationEnabled,
33
60
  isExiting,
34
61
  hasExitStyles,
35
62
  completeExit,
63
+ canOpen,
64
+ selectedValue,
36
65
  children
37
66
  }) => {
38
- const [leftElements, setLeftElements] = useState(new Map());
39
- const registerLeftElement = useCallback((value, element) => {
40
- setLeftElements(prev => {
41
- const next = new Map(prev);
42
- next.set(value, element);
43
- return next;
44
- });
45
- }, []);
46
- const unregisterLeftElement = useCallback(value => {
47
- setLeftElements(prev => {
48
- const next = new Map(prev);
49
- next.delete(value);
50
- return next;
51
- });
52
- }, []);
53
- const getLeftElement = useCallback(value => {
54
- return leftElements.get(value);
55
- }, [leftElements]);
67
+ const [leftElementStore] = useState(createLeftElementStore);
56
68
  const value = useMemo(() => ({
57
- registerLeftElement,
58
- unregisterLeftElement,
59
- getLeftElement,
69
+ ...leftElementStore,
60
70
  truncateText,
61
71
  isAnimationEnabled,
62
72
  isExiting,
63
73
  hasExitStyles,
64
- completeExit
65
- }), [registerLeftElement, unregisterLeftElement, getLeftElement, truncateText, isAnimationEnabled, isExiting, hasExitStyles, completeExit]);
74
+ completeExit,
75
+ canOpen,
76
+ selectedValue
77
+ }), [leftElementStore, truncateText, isAnimationEnabled, isExiting, hasExitStyles, completeExit, canOpen, selectedValue]);
66
78
  return jsx(SelectContext.Provider, {
67
79
  value: value,
68
80
  children: children
@@ -3,7 +3,7 @@ import { PencilCrossed, ChevronDown, Checkmark } from '@box/blueprint-web-assets
3
3
  import { bpSize030, bpIconIconOnLight } from '@box/blueprint-web-assets/tokens/tokens';
4
4
  import * as SelectPrimitive from '@radix-ui/react-select';
5
5
  import clsx from 'clsx';
6
- import { forwardRef, useEffect, useCallback, useLayoutEffect } from 'react';
6
+ import { forwardRef, useEffect, useCallback, useLayoutEffect, useSyncExternalStore } from 'react';
7
7
  import '../blueprint-configuration-context/blueprint-configuration-context.js';
8
8
  import '../blueprint-configuration-context/consts.js';
9
9
  import { useBlueprintConfiguration } from '../blueprint-configuration-context/useBlueprintConfiguration.js';
@@ -128,10 +128,12 @@ const Root = /*#__PURE__*/forwardRef((props, forwardedRef) => {
128
128
  className: styles.label,
129
129
  hideLabel: hideLabel
130
130
  }), jsx(SelectProvider, {
131
+ canOpen: !disabled && !readonly,
131
132
  completeExit: completeExit,
132
133
  hasExitStyles: hasExitStyles,
133
134
  isAnimationEnabled: isAnimationEnabled,
134
135
  isExiting: isExiting,
136
+ selectedValue: value,
135
137
  truncateText: truncateText,
136
138
  children: jsxs(SelectPrimitive.Root, {
137
139
  ...selectProps,
@@ -174,10 +176,12 @@ const Trigger = /*#__PURE__*/forwardRef((props, forwardedRef) => {
174
176
  } = props;
175
177
  const {
176
178
  getLeftElement,
179
+ subscribeToLeftElements,
177
180
  hasExitStyles,
178
181
  isAnimationEnabled
179
182
  } = useSelectContext();
180
- const selectedLeftElement = value ? getLeftElement(value) : null;
183
+ const getSelectedLeftElement = useCallback(() => value ? getLeftElement(value) : null, [getLeftElement, value]);
184
+ const selectedLeftElement = useSyncExternalStore(subscribeToLeftElements, getSelectedLeftElement, getSelectedLeftElement);
181
185
  const shouldShowPlaceholderLeftElement = !value && placeholderLeftElement;
182
186
  return jsxs(SelectPrimitive.Trigger, {
183
187
  ...triggerProps,
@@ -267,7 +271,9 @@ const Option = /*#__PURE__*/forwardRef((props, forwardedRef) => {
267
271
  const {
268
272
  registerLeftElement,
269
273
  unregisterLeftElement,
270
- truncateText
274
+ truncateText,
275
+ canOpen,
276
+ selectedValue
271
277
  } = useSelectContext();
272
278
  const onPointerLeave = useCallback(event => event.preventDefault(), []);
273
279
  const onPointerMove = useCallback(event => event.preventDefault(), []);
@@ -283,6 +289,10 @@ const Option = /*#__PURE__*/forwardRef((props, forwardedRef) => {
283
289
  }
284
290
  return undefined;
285
291
  }, [itemProps.value, leftElement, registerLeftElement, unregisterLeftElement]);
292
+ // A closed Select still renders every option off-screen. One that can't open needs only the selected option.
293
+ if (!canOpen && itemProps.value !== selectedValue) {
294
+ return null;
295
+ }
286
296
  return jsxs(SelectPrimitive.Item, {
287
297
  ...itemProps,
288
298
  ref: forwardedRef,
@@ -1,4 +1,4 @@
1
1
  import '../../index.css';
2
- var styles = {"textArea":"bp_text_area_autosize_module_textArea--7ee36","withEndIcon":"bp_text_area_autosize_module_withEndIcon--7ee36","error":"bp_text_area_autosize_module_error--7ee36","readOnly":"bp_text_area_autosize_module_readOnly--7ee36","loadingIndicatorReset":"bp_text_area_autosize_module_loadingIndicatorReset--7ee36","border":"bp_text_area_autosize_module_border--7ee36","hasError":"bp_text_area_autosize_module_hasError--7ee36","disabled":"bp_text_area_autosize_module_disabled--7ee36","endIconWrap":"bp_text_area_autosize_module_endIconWrap--7ee36","endIcon":"bp_text_area_autosize_module_endIcon--7ee36"};
2
+ var styles = {"textArea":"bp_text_area_autosize_module_textArea--eeec2","withEndIcon":"bp_text_area_autosize_module_withEndIcon--eeec2","error":"bp_text_area_autosize_module_error--eeec2","readOnly":"bp_text_area_autosize_module_readOnly--eeec2","loadingIndicatorReset":"bp_text_area_autosize_module_loadingIndicatorReset--eeec2","border":"bp_text_area_autosize_module_border--eeec2","hasError":"bp_text_area_autosize_module_hasError--eeec2","disabled":"bp_text_area_autosize_module_disabled--eeec2","endIconWrap":"bp_text_area_autosize_module_endIconWrap--eeec2","endIcon":"bp_text_area_autosize_module_endIcon--eeec2"};
3
3
 
4
4
  export { styles as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@box/blueprint-web",
3
- "version": "19.2.0",
3
+ "version": "19.2.2",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": {
@@ -54,7 +54,7 @@
54
54
  "dependencies": {
55
55
  "@ariakit/react": "0.4.21",
56
56
  "@ariakit/react-core": "0.4.21",
57
- "@box/blueprint-web-assets": "^5.15.6",
57
+ "@box/blueprint-web-assets": "^5.15.8",
58
58
  "@internationalized/date": "^3.12.4",
59
59
  "@radix-ui/react-accordion": "1.1.2",
60
60
  "@radix-ui/react-checkbox": "1.0.4",
@@ -81,7 +81,7 @@
81
81
  "devDependencies": {
82
82
  "@box/box-test-client": "^3.2.7",
83
83
  "@box/playwright-utils": "^3.10.0",
84
- "@box/storybook-utils": "^1.4.40",
84
+ "@box/storybook-utils": "^1.4.42",
85
85
  "@figma/code-connect": "1.4.4",
86
86
  "@playwright/test": "1.46.1",
87
87
  "@types/js-yaml": "^4.0.9",