@box/blueprint-web 13.10.1 → 13.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib-esm/index.css +61 -42
- package/dist/lib-esm/select/select-context.d.ts +3 -1
- package/dist/lib-esm/select/select-context.js +6 -3
- package/dist/lib-esm/select/select.js +17 -3
- package/dist/lib-esm/select/select.module.js +1 -1
- package/dist/lib-esm/select/types.d.ts +6 -0
- package/package.json +3 -3
package/dist/lib-esm/index.css
CHANGED
|
@@ -4491,7 +4491,7 @@
|
|
|
4491
4491
|
.bp_combobox_group_module_comboboxHasFocus--bb178.bp_combobox_group_module_errorSelect--bb178.bp_combobox_group_module_trailing--bb178{
|
|
4492
4492
|
--blueprint-select-border-error-left-width:none;
|
|
4493
4493
|
}
|
|
4494
|
-
.bp_select_module_container--
|
|
4494
|
+
.bp_select_module_container--1b637[data-modern=false]{
|
|
4495
4495
|
--select-gap:var(--space-2);
|
|
4496
4496
|
--select-label-color:var(--text-text-on-light);
|
|
4497
4497
|
--select-trigger-btn-gap:var(--space-2);
|
|
@@ -4528,7 +4528,7 @@
|
|
|
4528
4528
|
text-decoration:var(--body-default-text-decoration);
|
|
4529
4529
|
text-transform:var(--body-default-text-case);
|
|
4530
4530
|
}
|
|
4531
|
-
.bp_select_module_container--
|
|
4531
|
+
.bp_select_module_container--1b637[data-modern=false] .bp_select_module_label--1b637{
|
|
4532
4532
|
font-family:var(--body-default-bold-font-family);
|
|
4533
4533
|
font-size:var(--body-default-bold-font-size);
|
|
4534
4534
|
font-weight:var(--body-default-bold-font-weight);
|
|
@@ -4537,7 +4537,7 @@
|
|
|
4537
4537
|
text-decoration:var(--body-default-bold-text-decoration);
|
|
4538
4538
|
text-transform:var(--body-default-bold-text-case);
|
|
4539
4539
|
}
|
|
4540
|
-
.bp_select_module_container--
|
|
4540
|
+
.bp_select_module_container--1b637[data-modern=false] .bp_select_module_triggerBtn--1b637{
|
|
4541
4541
|
font-family:var(--body-default-font-family);
|
|
4542
4542
|
font-size:var(--body-default-font-size);
|
|
4543
4543
|
font-weight:var(--body-default-font-weight);
|
|
@@ -4547,7 +4547,7 @@
|
|
|
4547
4547
|
text-transform:var(--body-default-text-case);
|
|
4548
4548
|
}
|
|
4549
4549
|
|
|
4550
|
-
.bp_select_module_container--
|
|
4550
|
+
.bp_select_module_container--1b637[data-modern=true]{
|
|
4551
4551
|
--select-gap:var(--bp-space-020);
|
|
4552
4552
|
--select-label-color:var(--bp-text-text-on-light);
|
|
4553
4553
|
--select-trigger-btn-gap:var(--bp-space-020);
|
|
@@ -4578,17 +4578,17 @@
|
|
|
4578
4578
|
--select-trigger-left-element-size:var(--bp-size-060);
|
|
4579
4579
|
font-weight:var(--bp-font-weight-regular);
|
|
4580
4580
|
}
|
|
4581
|
-
.bp_select_module_container--
|
|
4581
|
+
.bp_select_module_container--1b637[data-modern=true],.bp_select_module_container--1b637[data-modern=true] .bp_select_module_label--1b637{
|
|
4582
4582
|
font-family:var(--bp-font-font-family), -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
|
|
4583
4583
|
font-size:var(--bp-font-size-05);
|
|
4584
4584
|
font-style:normal;
|
|
4585
4585
|
letter-spacing:var(--bp-font-letter-spacing-01);
|
|
4586
4586
|
line-height:var(--bp-font-line-height-04);
|
|
4587
4587
|
}
|
|
4588
|
-
.bp_select_module_container--
|
|
4588
|
+
.bp_select_module_container--1b637[data-modern=true] .bp_select_module_label--1b637{
|
|
4589
4589
|
font-weight:var(--bp-font-weight-bold);
|
|
4590
4590
|
}
|
|
4591
|
-
.bp_select_module_container--
|
|
4591
|
+
.bp_select_module_container--1b637[data-modern=true] .bp_select_module_triggerBtn--1b637{
|
|
4592
4592
|
font-family:var(--bp-font-font-family), -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
|
|
4593
4593
|
font-size:var(--bp-font-size-05);
|
|
4594
4594
|
font-style:normal;
|
|
@@ -4597,20 +4597,26 @@
|
|
|
4597
4597
|
line-height:var(--bp-font-line-height-04);
|
|
4598
4598
|
}
|
|
4599
4599
|
|
|
4600
|
-
.
|
|
4600
|
+
.bp_select_module_ellipsis--1b637{
|
|
4601
|
+
overflow:hidden;
|
|
4602
|
+
text-overflow:ellipsis;
|
|
4603
|
+
white-space:nowrap;
|
|
4604
|
+
}
|
|
4605
|
+
|
|
4606
|
+
.bp_select_module_container--1b637{
|
|
4601
4607
|
display:flex;
|
|
4602
4608
|
flex-direction:column;
|
|
4603
4609
|
gap:var(--select-gap);
|
|
4604
4610
|
}
|
|
4605
|
-
.bp_select_module_container--
|
|
4611
|
+
.bp_select_module_container--1b637.bp_select_module_disabled--1b637{
|
|
4606
4612
|
opacity:60%;
|
|
4607
4613
|
}
|
|
4608
|
-
.bp_select_module_container--
|
|
4614
|
+
.bp_select_module_container--1b637 .bp_select_module_label--1b637{
|
|
4609
4615
|
color:var(--select-label-color);
|
|
4610
4616
|
flex:0 0 fit-content;
|
|
4611
4617
|
overflow-wrap:break-word;
|
|
4612
4618
|
}
|
|
4613
|
-
.bp_select_module_container--
|
|
4619
|
+
.bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637{
|
|
4614
4620
|
align-items:center;
|
|
4615
4621
|
background-color:var(--select-trigger-btn-bg-color);
|
|
4616
4622
|
border-bottom:var(--select-trigger-btn-border-bottom);
|
|
@@ -4631,7 +4637,7 @@
|
|
|
4631
4637
|
text-align:start;
|
|
4632
4638
|
width:100%;
|
|
4633
4639
|
}
|
|
4634
|
-
.bp_select_module_container--
|
|
4640
|
+
.bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637 .bp_select_module_triggerValue--1b637{
|
|
4635
4641
|
align-items:center;
|
|
4636
4642
|
display:flex;
|
|
4637
4643
|
gap:var(--select-trigger-btn-gap);
|
|
@@ -4640,7 +4646,7 @@
|
|
|
4640
4646
|
text-overflow:ellipsis;
|
|
4641
4647
|
white-space:nowrap;
|
|
4642
4648
|
}
|
|
4643
|
-
.bp_select_module_container--
|
|
4649
|
+
.bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637 .bp_select_module_triggerLeftElement--1b637{
|
|
4644
4650
|
align-items:center;
|
|
4645
4651
|
display:flex;
|
|
4646
4652
|
flex-shrink:0;
|
|
@@ -4648,58 +4654,58 @@
|
|
|
4648
4654
|
justify-content:center;
|
|
4649
4655
|
width:var(--select-trigger-left-element-size);
|
|
4650
4656
|
}
|
|
4651
|
-
.bp_select_module_container--
|
|
4657
|
+
.bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637 span{
|
|
4652
4658
|
overflow:hidden;
|
|
4653
4659
|
text-overflow:ellipsis;
|
|
4654
4660
|
white-space:nowrap;
|
|
4655
4661
|
}
|
|
4656
|
-
.bp_select_module_container--
|
|
4662
|
+
.bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637:disabled{
|
|
4657
4663
|
cursor:default;
|
|
4658
4664
|
}
|
|
4659
|
-
.bp_select_module_container--
|
|
4665
|
+
.bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637.bp_select_module_readonly--1b637:not(:disabled){
|
|
4660
4666
|
background-color:var(--gray-02);
|
|
4661
4667
|
box-shadow:none;
|
|
4662
4668
|
color:var(--text-text-on-light-secondary);
|
|
4663
4669
|
cursor:default;
|
|
4664
4670
|
}
|
|
4665
|
-
.bp_select_module_container--
|
|
4671
|
+
.bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637:not(.bp_select_module_readonly--1b637, :disabled).bp_select_module_error--1b637, .bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637:not(.bp_select_module_readonly--1b637, :disabled)[aria-invalid=true]{
|
|
4666
4672
|
background-color:var(--select-trigger-btn-error-bg-color);
|
|
4667
4673
|
border-bottom:var(--select-trigger-btn-error-border-bottom);
|
|
4668
4674
|
border-left:var(--select-trigger-btn-error-border-left);
|
|
4669
4675
|
border-right:var(--select-trigger-btn-error-border-right);
|
|
4670
4676
|
border-top:var(--select-trigger-btn-error-border-top);
|
|
4671
4677
|
}
|
|
4672
|
-
.bp_select_module_container--
|
|
4678
|
+
.bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637:not(.bp_select_module_readonly--1b637):focus,.bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637:not(.bp_select_module_readonly--1b637, :disabled).bp_select_module_error--1b637:focus,.bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637:not(.bp_select_module_readonly--1b637, :disabled)[aria-invalid=true]:focus{
|
|
4673
4679
|
background-color:var(--select-trigger-btn-focus-bg-color);
|
|
4674
4680
|
border:var(--select-trigger-btn-focus-border);
|
|
4675
4681
|
}
|
|
4676
|
-
.bp_select_module_container--
|
|
4682
|
+
.bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637:not(.bp_select_module_readonly--1b637, :disabled, :focus, .bp_select_module_error--1b637, [aria-invalid=true]):hover{
|
|
4677
4683
|
background-color:var(--select-trigger-btn-hover-bg-color);
|
|
4678
4684
|
border-color:var(--select-trigger-btn-hover-border-color);
|
|
4679
4685
|
}
|
|
4680
|
-
.bp_select_module_container--
|
|
4686
|
+
.bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637 .bp_select_module_iconWrapper--1b637{
|
|
4681
4687
|
flex-shrink:0;
|
|
4682
4688
|
-webkit-user-select:none;
|
|
4683
4689
|
user-select:none;
|
|
4684
4690
|
}
|
|
4685
|
-
.bp_select_module_container--
|
|
4691
|
+
.bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637 .bp_select_module_iconCaret--1b637{
|
|
4686
4692
|
display:block;
|
|
4687
4693
|
height:var(--select-trigger-btn-caret-height);
|
|
4688
4694
|
width:var(--select-trigger-btn-caret-width);
|
|
4689
4695
|
}
|
|
4690
|
-
.bp_select_module_container--
|
|
4696
|
+
.bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637 .bp_select_module_iconCaret--1b637 path{
|
|
4691
4697
|
fill:var(--select-trigger-btn-caret-color);
|
|
4692
4698
|
}
|
|
4693
|
-
.bp_select_module_container--
|
|
4699
|
+
.bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637 .bp_select_module_iconPencilCrossed--1b637{
|
|
4694
4700
|
display:block;
|
|
4695
4701
|
height:var(--select-trigger-btn-pencil-height);
|
|
4696
4702
|
width:var(--select-trigger-btn-pencil-width);
|
|
4697
4703
|
}
|
|
4698
|
-
.bp_select_module_container--
|
|
4704
|
+
.bp_select_module_container--1b637 .bp_select_module_triggerBtn--1b637[data-state=open] .bp_select_module_icon--1b637{
|
|
4699
4705
|
transform:rotate(180deg);
|
|
4700
4706
|
}
|
|
4701
4707
|
|
|
4702
|
-
.bp_select_module_content--
|
|
4708
|
+
.bp_select_module_content--1b637[data-modern=false]{
|
|
4703
4709
|
--select-content-bg-color:var(--surface-menu-surface);
|
|
4704
4710
|
--select-content-backdrop-filter:none;
|
|
4705
4711
|
--select-content-border:var(--border-1) solid var(--border-card-border);
|
|
@@ -4733,7 +4739,7 @@
|
|
|
4733
4739
|
text-transform:var(--body-default-text-case);
|
|
4734
4740
|
}
|
|
4735
4741
|
|
|
4736
|
-
.bp_select_module_content--
|
|
4742
|
+
.bp_select_module_content--1b637[data-modern=true]{
|
|
4737
4743
|
--select-content-bg-color:var(--bp-surface-menu-surface-dropdown);
|
|
4738
4744
|
--select-content-backdrop-filter:blur(16px);
|
|
4739
4745
|
--select-content-border:var(--bp-border-01) solid var(--bp-border-card-border);
|
|
@@ -4766,7 +4772,7 @@
|
|
|
4766
4772
|
line-height:var(--bp-font-line-height-04);
|
|
4767
4773
|
}
|
|
4768
4774
|
|
|
4769
|
-
.bp_select_module_content--
|
|
4775
|
+
.bp_select_module_content--1b637{
|
|
4770
4776
|
backdrop-filter:var(--select-content-backdrop-filter);
|
|
4771
4777
|
background-color:var(--select-content-bg-color);
|
|
4772
4778
|
border:var(--select-content-border);
|
|
@@ -4778,11 +4784,11 @@
|
|
|
4778
4784
|
overflow:auto;
|
|
4779
4785
|
z-index:380;
|
|
4780
4786
|
}
|
|
4781
|
-
.bp_select_module_content--
|
|
4787
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637{
|
|
4782
4788
|
padding-block:var(--select-content-viewport-padding-block);
|
|
4783
4789
|
padding-inline:var(--select-content-viewport-padding-inline);
|
|
4784
4790
|
}
|
|
4785
|
-
.bp_select_module_content--
|
|
4791
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637 .bp_select_module_option--1b637{
|
|
4786
4792
|
align-items:center;
|
|
4787
4793
|
border:var(--select-content-viewport-option-border);
|
|
4788
4794
|
border-radius:var(--select-content-viewport-option-border-radius);
|
|
@@ -4798,18 +4804,18 @@
|
|
|
4798
4804
|
-webkit-user-select:none;
|
|
4799
4805
|
user-select:none;
|
|
4800
4806
|
}
|
|
4801
|
-
.bp_select_module_content--
|
|
4807
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637 .bp_select_module_option--1b637[data-disabled]{
|
|
4802
4808
|
opacity:60%;
|
|
4803
4809
|
pointer-events:none;
|
|
4804
4810
|
}
|
|
4805
|
-
.bp_select_module_content--
|
|
4811
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637 .bp_select_module_option--1b637:focus-visible{
|
|
4806
4812
|
background-color:var(--select-content-viewport-option-focus-bg-color);
|
|
4807
4813
|
border:var(--select-content-viewport-option-focus-border);
|
|
4808
4814
|
}
|
|
4809
|
-
.bp_select_module_content--
|
|
4815
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637 .bp_select_module_option--1b637:hover{
|
|
4810
4816
|
background-color:var(--select-content-viewport-option-hover-bg-color);
|
|
4811
4817
|
}
|
|
4812
|
-
.bp_select_module_content--
|
|
4818
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637 .bp_select_module_option--1b637 .bp_select_module_textWrapper--1b637{
|
|
4813
4819
|
align-items:center;
|
|
4814
4820
|
display:flex;
|
|
4815
4821
|
flex:1;
|
|
@@ -4818,14 +4824,23 @@
|
|
|
4818
4824
|
min-width:0;
|
|
4819
4825
|
overflow:hidden;
|
|
4820
4826
|
}
|
|
4821
|
-
.bp_select_module_content--
|
|
4827
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637 .bp_select_module_option--1b637 .bp_select_module_textWrapper--1b637 span:first-child{
|
|
4822
4828
|
overflow:hidden;
|
|
4823
4829
|
overflow-wrap:break-word;
|
|
4824
4830
|
}
|
|
4825
|
-
.bp_select_module_content--
|
|
4831
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637 .bp_select_module_option--1b637 .bp_select_module_textWrapper--1b637.bp_select_module_ellipsis--1b637 span:first-child{
|
|
4832
|
+
overflow-wrap:normal;
|
|
4833
|
+
text-overflow:ellipsis;
|
|
4834
|
+
white-space:nowrap;
|
|
4835
|
+
width:100%;
|
|
4836
|
+
}
|
|
4837
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637 .bp_select_module_option--1b637 .bp_select_module_secondaryText--1b637{
|
|
4826
4838
|
color:var(--select-content-viewport-option-secondary-text-color);
|
|
4827
4839
|
}
|
|
4828
|
-
.bp_select_module_content--
|
|
4840
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637 .bp_select_module_option--1b637 .bp_select_module_secondaryText--1b637.bp_select_module_ellipsis--1b637{
|
|
4841
|
+
width:100%;
|
|
4842
|
+
}
|
|
4843
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637 .bp_select_module_option--1b637 .bp_select_module_leftElement--1b637{
|
|
4829
4844
|
align-items:center;
|
|
4830
4845
|
display:flex;
|
|
4831
4846
|
flex-shrink:0;
|
|
@@ -4833,14 +4848,14 @@
|
|
|
4833
4848
|
justify-content:center;
|
|
4834
4849
|
width:var(--select-content-viewport-option-left-element-size);
|
|
4835
4850
|
}
|
|
4836
|
-
.bp_select_module_content--
|
|
4851
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637 .bp_select_module_option--1b637.bp_select_module_hasLeftElement--1b637{
|
|
4837
4852
|
padding-inline:var(--select-content-viewport-option-padding-inline-reversed);
|
|
4838
4853
|
}
|
|
4839
|
-
.bp_select_module_content--
|
|
4854
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637 .bp_select_module_option--1b637.bp_select_module_hasLeftElement--1b637 .bp_select_module_textWrapper--1b637{
|
|
4840
4855
|
align-items:flex-start;
|
|
4841
4856
|
flex-direction:column;
|
|
4842
4857
|
}
|
|
4843
|
-
.bp_select_module_content--
|
|
4858
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637 .bp_select_module_option--1b637 .bp_select_module_indicator--1b637{
|
|
4844
4859
|
align-items:center;
|
|
4845
4860
|
display:flex;
|
|
4846
4861
|
height:100%;
|
|
@@ -4849,19 +4864,23 @@
|
|
|
4849
4864
|
position:absolute;
|
|
4850
4865
|
top:0;
|
|
4851
4866
|
}
|
|
4852
|
-
.bp_select_module_content--
|
|
4867
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637 .bp_select_module_option--1b637 .bp_select_module_indicator--1b637 path{
|
|
4853
4868
|
fill:var(--select-content-viewport-option-indicator-color);
|
|
4854
4869
|
}
|
|
4855
|
-
.bp_select_module_content--
|
|
4870
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637 .bp_select_module_option--1b637 .bp_select_module_indicatorRight--1b637{
|
|
4856
4871
|
left:auto;
|
|
4857
4872
|
right:var(--select-content-viewport-option-indicator-right);
|
|
4858
4873
|
}
|
|
4859
|
-
.bp_select_module_content--
|
|
4874
|
+
.bp_select_module_content--1b637 .bp_select_module_viewport--1b637 .bp_select_module_separator--1b637{
|
|
4860
4875
|
background-color:var(--select-content-viewport-option-separator-bg-color);
|
|
4861
4876
|
flex-shrink:0;
|
|
4862
4877
|
height:var(--select-content-viewport-option-separator-height);
|
|
4863
4878
|
margin-block:var(--select-content-viewport-option-separator-margin-block);
|
|
4864
4879
|
}
|
|
4880
|
+
.bp_select_module_content--1b637 .bp_select_module_withTruncatedText--1b637{
|
|
4881
|
+
table-layout:fixed;
|
|
4882
|
+
width:100%;
|
|
4883
|
+
}
|
|
4865
4884
|
|
|
4866
4885
|
.bp_content_card_module_card--3b28b[data-modern=false],.bp_content_card_module_ghostCard--3b28b[data-modern=false]{
|
|
4867
4886
|
--content-card-body-display:block;
|
|
@@ -3,10 +3,12 @@ interface SelectContextValue {
|
|
|
3
3
|
registerLeftElement: (value: string, element: ReactNode) => void;
|
|
4
4
|
unregisterLeftElement: (value: string) => void;
|
|
5
5
|
getLeftElement: (value: string) => ReactNode;
|
|
6
|
+
truncateText: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare const useSelectContext: () => SelectContextValue;
|
|
8
9
|
interface SelectProviderProps {
|
|
10
|
+
truncateText: boolean;
|
|
9
11
|
children: ReactNode;
|
|
10
12
|
}
|
|
11
|
-
export declare const SelectProvider: ({ children }: SelectProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const SelectProvider: ({ truncateText, children }: SelectProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
14
|
export {};
|
|
@@ -9,7 +9,8 @@ const defaultContextValue = {
|
|
|
9
9
|
unregisterLeftElement: () => {
|
|
10
10
|
/* noop */
|
|
11
11
|
},
|
|
12
|
-
getLeftElement: () => null
|
|
12
|
+
getLeftElement: () => null,
|
|
13
|
+
truncateText: false
|
|
13
14
|
};
|
|
14
15
|
const SelectContext = /*#__PURE__*/createContext(null);
|
|
15
16
|
const useSelectContext = () => {
|
|
@@ -21,6 +22,7 @@ const useSelectContext = () => {
|
|
|
21
22
|
return context;
|
|
22
23
|
};
|
|
23
24
|
const SelectProvider = ({
|
|
25
|
+
truncateText,
|
|
24
26
|
children
|
|
25
27
|
}) => {
|
|
26
28
|
const [leftElements, setLeftElements] = useState(new Map());
|
|
@@ -44,8 +46,9 @@ const SelectProvider = ({
|
|
|
44
46
|
const value = useMemo(() => ({
|
|
45
47
|
registerLeftElement,
|
|
46
48
|
unregisterLeftElement,
|
|
47
|
-
getLeftElement
|
|
48
|
-
|
|
49
|
+
getLeftElement,
|
|
50
|
+
truncateText
|
|
51
|
+
}), [registerLeftElement, unregisterLeftElement, getLeftElement, truncateText]);
|
|
49
52
|
return jsx(SelectContext.Provider, {
|
|
50
53
|
value: value,
|
|
51
54
|
children: children
|
|
@@ -38,6 +38,7 @@ const Root = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
38
38
|
subText,
|
|
39
39
|
required,
|
|
40
40
|
id,
|
|
41
|
+
truncateText = false,
|
|
41
42
|
// RadixSelectTrigger props
|
|
42
43
|
...triggerProps
|
|
43
44
|
} = props;
|
|
@@ -108,6 +109,7 @@ const Root = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
108
109
|
className: styles.label,
|
|
109
110
|
hideLabel: hideLabel
|
|
110
111
|
}), jsx(SelectProvider, {
|
|
112
|
+
truncateText: truncateText,
|
|
111
113
|
children: jsxs(SelectPrimitive.Root, {
|
|
112
114
|
...selectProps,
|
|
113
115
|
children: [jsx(Trigger, {
|
|
@@ -192,6 +194,9 @@ const Content = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
192
194
|
const {
|
|
193
195
|
enableModernizedComponents
|
|
194
196
|
} = useBlueprintModernization();
|
|
197
|
+
const {
|
|
198
|
+
truncateText
|
|
199
|
+
} = useSelectContext();
|
|
195
200
|
return jsx(SelectPrimitive.Portal, {
|
|
196
201
|
container: container,
|
|
197
202
|
children: jsx(SelectPrimitive.Content, {
|
|
@@ -207,6 +212,10 @@ const Content = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
207
212
|
asChild: true,
|
|
208
213
|
className: styles.viewport,
|
|
209
214
|
children: jsx(ScrollArea.Viewport, {
|
|
215
|
+
asChild: truncateText,
|
|
216
|
+
className: clsx({
|
|
217
|
+
[styles.withTruncatedText]: truncateText
|
|
218
|
+
}),
|
|
210
219
|
children: children
|
|
211
220
|
})
|
|
212
221
|
})
|
|
@@ -224,7 +233,8 @@ const Option = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
224
233
|
} = props;
|
|
225
234
|
const {
|
|
226
235
|
registerLeftElement,
|
|
227
|
-
unregisterLeftElement
|
|
236
|
+
unregisterLeftElement,
|
|
237
|
+
truncateText
|
|
228
238
|
} = useSelectContext();
|
|
229
239
|
const onPointerLeave = useCallback(event => event.preventDefault(), []);
|
|
230
240
|
const onPointerMove = useCallback(event => event.preventDefault(), []);
|
|
@@ -252,11 +262,15 @@ const Option = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
252
262
|
className: styles.leftElement,
|
|
253
263
|
children: leftElement
|
|
254
264
|
}), jsxs("span", {
|
|
255
|
-
className: styles.textWrapper,
|
|
265
|
+
className: clsx(styles.textWrapper, {
|
|
266
|
+
[styles.ellipsis]: truncateText
|
|
267
|
+
}),
|
|
256
268
|
children: [jsx(SelectPrimitive.ItemText, {
|
|
257
269
|
children: text
|
|
258
270
|
}), !!secondaryText && jsx("span", {
|
|
259
|
-
className: styles.secondaryText,
|
|
271
|
+
className: clsx(styles.secondaryText, {
|
|
272
|
+
[styles.ellipsis]: truncateText
|
|
273
|
+
}),
|
|
260
274
|
children: secondaryText
|
|
261
275
|
})]
|
|
262
276
|
}), !itemProps.disabled && jsx(SelectPrimitive.ItemIndicator, {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../index.css';
|
|
2
|
-
var styles = {"container":"bp_select_module_container--
|
|
2
|
+
var styles = {"container":"bp_select_module_container--1b637","label":"bp_select_module_label--1b637","triggerBtn":"bp_select_module_triggerBtn--1b637","ellipsis":"bp_select_module_ellipsis--1b637","disabled":"bp_select_module_disabled--1b637","triggerValue":"bp_select_module_triggerValue--1b637","triggerLeftElement":"bp_select_module_triggerLeftElement--1b637","readonly":"bp_select_module_readonly--1b637","error":"bp_select_module_error--1b637","iconWrapper":"bp_select_module_iconWrapper--1b637","iconCaret":"bp_select_module_iconCaret--1b637","iconPencilCrossed":"bp_select_module_iconPencilCrossed--1b637","content":"bp_select_module_content--1b637","viewport":"bp_select_module_viewport--1b637","option":"bp_select_module_option--1b637","textWrapper":"bp_select_module_textWrapper--1b637","secondaryText":"bp_select_module_secondaryText--1b637","leftElement":"bp_select_module_leftElement--1b637","hasLeftElement":"bp_select_module_hasLeftElement--1b637","indicator":"bp_select_module_indicator--1b637","indicatorRight":"bp_select_module_indicatorRight--1b637","separator":"bp_select_module_separator--1b637","withTruncatedText":"bp_select_module_withTruncatedText--1b637"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -74,6 +74,12 @@ export interface ExtraProps extends Labelable {
|
|
|
74
74
|
* Only displayed when no value is selected.
|
|
75
75
|
*/
|
|
76
76
|
placeholderLeftElement?: React.ReactNode;
|
|
77
|
+
/**
|
|
78
|
+
* When `true`, the text will be truncated if it exceeds the dropdown width.
|
|
79
|
+
*
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
82
|
+
truncateText?: boolean;
|
|
77
83
|
}
|
|
78
84
|
type SelectState = {
|
|
79
85
|
disabled?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.11.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"publishConfig": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@ariakit/react": "0.4.15",
|
|
49
49
|
"@ariakit/react-core": "0.4.15",
|
|
50
|
-
"@box/blueprint-web-assets": "^4.
|
|
50
|
+
"@box/blueprint-web-assets": "^4.111.1",
|
|
51
51
|
"@internationalized/date": "^3.7.0",
|
|
52
52
|
"@radix-ui/react-accordion": "1.1.2",
|
|
53
53
|
"@radix-ui/react-checkbox": "1.0.4",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"type-fest": "^3.2.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@box/storybook-utils": "^0.
|
|
80
|
+
"@box/storybook-utils": "^0.17.1",
|
|
81
81
|
"@figma/code-connect": "1.3.12",
|
|
82
82
|
"@types/react": "^18.0.0",
|
|
83
83
|
"@types/react-dom": "^18.0.0",
|