@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.
- package/dist/lib-esm/index.css +74 -29
- package/dist/lib-esm/password-input/password-input.d.ts +2 -2
- package/dist/lib-esm/password-input/password-input.js +1 -1
- package/dist/lib-esm/password-input/password-input.module.js +1 -1
- package/dist/lib-esm/primitives/base-text-input/base-text-input.js +57 -22
- package/dist/lib-esm/primitives/base-text-input/base-text-input.module.js +1 -1
- package/dist/lib-esm/primitives/base-text-input/types.d.ts +7 -2
- package/dist/lib-esm/text-input/text-input.d.ts +25 -1
- package/dist/lib-esm/text-input/text-input.js +43 -9
- package/dist/lib-esm/text-input/text-input.module.js +1 -1
- package/dist/lib-esm/text-input/types.d.ts +2 -2
- package/dist/lib-esm/util-components/labelable/labelable.module.js +4 -0
- package/dist/lib-esm/util-components/labelable/useLabelable.d.ts +1 -1
- package/dist/lib-esm/util-components/labelable/useLabelable.js +9 -4
- package/package.json +1 -1
package/dist/lib-esm/index.css
CHANGED
|
@@ -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--
|
|
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--
|
|
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--
|
|
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
|
-
.
|
|
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
|
-
.
|
|
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
|
-
.
|
|
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
|
-
.
|
|
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
|
-
.
|
|
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:
|
|
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:
|
|
4679
|
+
width:100%;
|
|
4660
4680
|
}
|
|
4661
|
-
.bp_base_text_input_module_textInputContainer--
|
|
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--
|
|
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--
|
|
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--
|
|
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--
|
|
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--
|
|
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--
|
|
4690
|
-
padding-inline
|
|
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--
|
|
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--
|
|
4697
|
-
|
|
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
|
-
|
|
4730
|
+
top:50%;
|
|
4731
|
+
transform:translateY(-50%);
|
|
4702
4732
|
}
|
|
4703
|
-
.bp_base_text_input_module_textInputContainer--
|
|
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--
|
|
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" | "
|
|
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" | "
|
|
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
|
-
|
|
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--
|
|
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,
|
|
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 <input/> 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
|
-
|
|
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
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
}),
|
|
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 = {"
|
|
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
|
-
|
|
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("
|
|
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 {
|
|
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
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
30
|
-
|
|
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--
|
|
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
|
|
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 =
|
|
9
|
+
export type TextInputProps = BaseTextInputProps & RequireAllOrNone<Loading, keyof Loading>;
|
|
@@ -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
|
-
}, [
|
|
71
|
+
}, [inputId, isRequired, label]);
|
|
67
72
|
};
|
|
68
73
|
|
|
69
74
|
export { useLabelable };
|