@box/blueprint-web 15.1.1 → 15.3.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/blueprint-configuration-context/consts.d.ts +1 -1
- package/dist/lib-esm/blueprint-configuration-context/consts.js +1 -1
- package/dist/lib-esm/index.css +90 -47
- package/dist/lib-esm/password-input/password-input.js +9 -1
- package/dist/lib-esm/primitives/base-text-input/base-text-input.js +2 -0
- package/dist/lib-esm/primitives/base-text-input/base-text-input.module.js +1 -1
- package/dist/lib-esm/primitives/inline-error/inline-error.js +60 -22
- package/dist/lib-esm/primitives/inline-error/inline-error.module.js +1 -1
- package/dist/lib-esm/primitives/inline-error/utils/use-inline-error-presence.d.ts +13 -0
- package/dist/lib-esm/primitives/inline-error/utils/use-inline-error-presence.js +54 -0
- package/dist/lib-esm/text-input/text-input.js +9 -1
- package/package.json +3 -3
|
@@ -38,7 +38,7 @@ export declare const BLUEPRINT_CONFIGURATION_SPLITS: {
|
|
|
38
38
|
*/
|
|
39
39
|
export declare const ANIMATED_COMPONENTS_BY_PHASE: {
|
|
40
40
|
readonly phase1: readonly ["Button", "IconButton", "DropdownMenu", "Tooltip", "Popover", "SplitButton", "CardTooltip", "NavigationMenu", "Modal", "TextButton", "ContextMenu"];
|
|
41
|
-
readonly phase2: readonly ["DropdownTrigger", "Switch", "Checkbox", "TextInput", "Select", "Datepicker", "TextArea", "Combobox", "PasswordInput", "ComboboxGroup"];
|
|
41
|
+
readonly phase2: readonly ["DropdownTrigger", "Switch", "Checkbox", "TextInput", "Select", "Datepicker", "TextArea", "Combobox", "PasswordInput", "ComboboxGroup", "InlineError"];
|
|
42
42
|
readonly phase3: readonly [];
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
@@ -40,7 +40,7 @@ const BLUEPRINT_CONFIGURATION_SPLITS = deepFreeze({
|
|
|
40
40
|
*/
|
|
41
41
|
const ANIMATED_COMPONENTS_BY_PHASE = deepFreeze({
|
|
42
42
|
phase1: ['Button', 'IconButton', 'DropdownMenu', 'Tooltip', 'Popover', 'SplitButton', 'CardTooltip', 'NavigationMenu', 'Modal', 'TextButton', 'ContextMenu'],
|
|
43
|
-
phase2: ['DropdownTrigger', 'Switch', 'Checkbox', 'TextInput', 'Select', 'Datepicker', 'TextArea', 'Combobox', 'PasswordInput', 'ComboboxGroup'],
|
|
43
|
+
phase2: ['DropdownTrigger', 'Switch', 'Checkbox', 'TextInput', 'Select', 'Datepicker', 'TextArea', 'Combobox', 'PasswordInput', 'ComboboxGroup', 'InlineError'],
|
|
44
44
|
phase3: []
|
|
45
45
|
});
|
|
46
46
|
/**
|
package/dist/lib-esm/index.css
CHANGED
|
@@ -4546,7 +4546,7 @@
|
|
|
4546
4546
|
.bp_input_chip_module_container--8ac7b .bp_input_chip_module_avatar--8ac7b.bp_input_chip_module_modern--8ac7b *{
|
|
4547
4547
|
border-radius:unset;
|
|
4548
4548
|
}
|
|
4549
|
-
.bp_inline_error_module_inlineError--
|
|
4549
|
+
.bp_inline_error_module_inlineError--e70b6[data-modern=false]{
|
|
4550
4550
|
--inline-error-gap:var(--size-1);
|
|
4551
4551
|
--inline-error-height:var(--size-4);
|
|
4552
4552
|
--inline-error-text-color:var(--text-text-error-on-light);
|
|
@@ -4559,10 +4559,11 @@
|
|
|
4559
4559
|
text-transform:var(--body-default-bold-text-case);
|
|
4560
4560
|
}
|
|
4561
4561
|
|
|
4562
|
-
.bp_inline_error_module_inlineError--
|
|
4562
|
+
.bp_inline_error_module_inlineError--e70b6[data-modern=true]{
|
|
4563
4563
|
--inline-error-gap:var(--bp-space-010);
|
|
4564
4564
|
--inline-error-height:var(--bp-size-040);
|
|
4565
4565
|
--inline-error-text-color:var(--bp-text-text-error-on-light);
|
|
4566
|
+
--inline-error-slide-offset:calc(var(--bp-font-size-02, 0.625rem)*-1);
|
|
4566
4567
|
font-family:var(--bp-font-font-family), -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
|
|
4567
4568
|
font-size:var(--bp-font-size-05);
|
|
4568
4569
|
font-style:normal;
|
|
@@ -4571,21 +4572,54 @@
|
|
|
4571
4572
|
line-height:var(--bp-font-line-height-04);
|
|
4572
4573
|
}
|
|
4573
4574
|
|
|
4574
|
-
.bp_inline_error_module_inlineError--
|
|
4575
|
+
.bp_inline_error_module_inlineError--e70b6.bp_inline_error_module_inlineError--e70b6{
|
|
4575
4576
|
align-items:center;
|
|
4576
4577
|
color:var(--inline-error-text-color);
|
|
4577
4578
|
display:flex;
|
|
4578
4579
|
gap:var(--inline-error-gap);
|
|
4579
4580
|
line-height:var(--inline-error-height);
|
|
4580
4581
|
}
|
|
4581
|
-
.bp_inline_error_module_inlineError--
|
|
4582
|
+
.bp_inline_error_module_inlineError--e70b6.bp_inline_error_module_inlineError--e70b6.bp_inline_error_module_empty--e70b6{
|
|
4582
4583
|
display:none;
|
|
4583
4584
|
}
|
|
4584
|
-
.bp_inline_error_module_inlineError--
|
|
4585
|
+
.bp_inline_error_module_inlineError--e70b6.bp_inline_error_module_inlineError--e70b6 .bp_inline_error_module_errorIcon--e70b6{
|
|
4585
4586
|
align-self:flex-start;
|
|
4586
4587
|
flex-grow:0;
|
|
4587
4588
|
flex-shrink:0;
|
|
4588
4589
|
}
|
|
4590
|
+
|
|
4591
|
+
.bp_inline_error_module_inlineError--e70b6.bp_inline_error_module_inlineError--e70b6.bp_inline_error_module_animated--e70b6[data-state=open]{
|
|
4592
|
+
animation-duration:var(--bp-duration-short);
|
|
4593
|
+
animation-fill-mode:both;
|
|
4594
|
+
animation-name:bp_inline_error_module_bpInlineErrorSlideEnter--e70b6;
|
|
4595
|
+
animation-timing-function:var(--bp-curve-small-on);
|
|
4596
|
+
}
|
|
4597
|
+
|
|
4598
|
+
.bp_inline_error_module_inlineError--e70b6.bp_inline_error_module_inlineError--e70b6.bp_inline_error_module_animated--e70b6[data-state=closed]{
|
|
4599
|
+
animation-duration:var(--bp-duration-short);
|
|
4600
|
+
animation-fill-mode:forwards;
|
|
4601
|
+
animation-name:bp_inline_error_module_bpInlineErrorFadeExit--e70b6;
|
|
4602
|
+
animation-timing-function:var(--bp-curve-small-off);
|
|
4603
|
+
}
|
|
4604
|
+
|
|
4605
|
+
@keyframes bp_inline_error_module_bpInlineErrorSlideEnter--e70b6{
|
|
4606
|
+
from{
|
|
4607
|
+
opacity:var(--bp-opacity-hidden);
|
|
4608
|
+
transform:translateY(var(--inline-error-slide-offset));
|
|
4609
|
+
}
|
|
4610
|
+
to{
|
|
4611
|
+
opacity:var(--bp-opacity-visible);
|
|
4612
|
+
transform:translateY(0);
|
|
4613
|
+
}
|
|
4614
|
+
}
|
|
4615
|
+
@keyframes bp_inline_error_module_bpInlineErrorFadeExit--e70b6{
|
|
4616
|
+
from{
|
|
4617
|
+
opacity:var(--bp-opacity-visible);
|
|
4618
|
+
}
|
|
4619
|
+
to{
|
|
4620
|
+
opacity:var(--bp-opacity-hidden);
|
|
4621
|
+
}
|
|
4622
|
+
}
|
|
4589
4623
|
.bp_labelable_module_required--25dbc{
|
|
4590
4624
|
align-items:center;
|
|
4591
4625
|
display:inline-flex;
|
|
@@ -9620,19 +9654,7 @@ table.bp_inline_table_module_inlineTable--fc22e[data-modern=true] td:last-child,
|
|
|
9620
9654
|
.bp_page_section_module_pageSectionDivider--c939b{
|
|
9621
9655
|
width:100%;
|
|
9622
9656
|
}
|
|
9623
|
-
|
|
9624
|
-
.bp_password_input_module_passwordInput--b74ce input[type=password],.bp_password_input_module_passwordInput--b74ce input[type=text]{
|
|
9625
|
-
padding-inline-end:2.375rem;
|
|
9626
|
-
}
|
|
9627
|
-
.bp_password_input_module_passwordInput--b74ce .bp_password_input_module_iconButton--b74ce{
|
|
9628
|
-
height:var(--size-6);
|
|
9629
|
-
inset-inline-end:.5rem;
|
|
9630
|
-
width:var(--size-6);
|
|
9631
|
-
}
|
|
9632
|
-
.bp_password_input_module_passwordInput--b74ce .bp_password_input_module_iconButton--b74ce:active,.bp_password_input_module_passwordInput--b74ce .bp_password_input_module_iconButton--b74ce:hover{
|
|
9633
|
-
background:none;
|
|
9634
|
-
}
|
|
9635
|
-
.bp_base_text_input_module_textInputContainerOuter--8494e[data-modern=false]{
|
|
9657
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=false]{
|
|
9636
9658
|
--text-input-border-width:var(--border-1);
|
|
9637
9659
|
--text-input-border-width-focused:var(--border-2);
|
|
9638
9660
|
--text-input-border-width-error:var(--border-2);
|
|
@@ -9671,7 +9693,7 @@ table.bp_inline_table_module_inlineTable--fc22e[data-modern=true] td:last-child,
|
|
|
9671
9693
|
text-decoration:var(--body-default-text-decoration);
|
|
9672
9694
|
text-transform:var(--body-default-text-case);
|
|
9673
9695
|
}
|
|
9674
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9696
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=false] .bp_base_text_input_module_label--403b3{
|
|
9675
9697
|
font-family:var(--body-default-bold-font-family);
|
|
9676
9698
|
font-size:var(--body-default-bold-font-size);
|
|
9677
9699
|
font-weight:var(--body-default-bold-font-weight);
|
|
@@ -9680,7 +9702,7 @@ table.bp_inline_table_module_inlineTable--fc22e[data-modern=true] td:last-child,
|
|
|
9680
9702
|
text-decoration:var(--body-default-bold-text-decoration);
|
|
9681
9703
|
text-transform:var(--body-default-bold-text-case);
|
|
9682
9704
|
}
|
|
9683
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9705
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=false] .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3,.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=false] .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3,.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=false] .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3{
|
|
9684
9706
|
font-family:var(--body-default-font-family);
|
|
9685
9707
|
font-size:var(--body-default-font-size);
|
|
9686
9708
|
font-weight:var(--body-default-font-weight);
|
|
@@ -9690,7 +9712,7 @@ table.bp_inline_table_module_inlineTable--fc22e[data-modern=true] td:last-child,
|
|
|
9690
9712
|
text-transform:var(--body-default-text-case);
|
|
9691
9713
|
}
|
|
9692
9714
|
|
|
9693
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9715
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true]{
|
|
9694
9716
|
--text-input-border-width:var(--bp-border-01);
|
|
9695
9717
|
--text-input-border-width-focused:var(--bp-border-02);
|
|
9696
9718
|
--text-input-border-width-error:var(--bp-border-02);
|
|
@@ -9724,17 +9746,17 @@ table.bp_inline_table_module_inlineTable--fc22e[data-modern=true] td:last-child,
|
|
|
9724
9746
|
--text-input-hover-border-color:var(--bp-border-input-border-hover);
|
|
9725
9747
|
font-weight:var(--bp-font-weight-regular);
|
|
9726
9748
|
}
|
|
9727
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9749
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true],.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true] .bp_base_text_input_module_label--403b3{
|
|
9728
9750
|
font-family:var(--bp-font-font-family), -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
|
|
9729
9751
|
font-size:var(--bp-font-size-05);
|
|
9730
9752
|
font-style:normal;
|
|
9731
9753
|
letter-spacing:var(--bp-font-letter-spacing-01);
|
|
9732
9754
|
line-height:var(--bp-font-line-height-04);
|
|
9733
9755
|
}
|
|
9734
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9756
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true] .bp_base_text_input_module_label--403b3{
|
|
9735
9757
|
font-weight:var(--bp-font-weight-bold);
|
|
9736
9758
|
}
|
|
9737
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9759
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true] .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3,.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true] .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3,.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true] .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3{
|
|
9738
9760
|
font-family:var(--bp-font-font-family), -apple-system, BlinkMacSystemFont, "San Francisco", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
|
|
9739
9761
|
font-size:var(--bp-font-size-05);
|
|
9740
9762
|
font-style:normal;
|
|
@@ -9743,25 +9765,25 @@ table.bp_inline_table_module_inlineTable--fc22e[data-modern=true] td:last-child,
|
|
|
9743
9765
|
line-height:var(--bp-font-line-height-04);
|
|
9744
9766
|
}
|
|
9745
9767
|
|
|
9746
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9768
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3{
|
|
9747
9769
|
--disabled-opacity:var(--text-input-disabled-opacity-api, 60%);
|
|
9748
9770
|
display:flex;
|
|
9749
9771
|
flex-direction:column;
|
|
9750
9772
|
}
|
|
9751
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9773
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_label--403b3{
|
|
9752
9774
|
color:var(--text-input-label-color);
|
|
9753
9775
|
flex:0 0 fit-content;
|
|
9754
9776
|
width:fit-content;
|
|
9755
9777
|
}
|
|
9756
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9778
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_label--403b3:not(.bp_base_text_input_module_hidden--403b3){
|
|
9757
9779
|
margin-block-end:var(--text-input-row-gap);
|
|
9758
9780
|
}
|
|
9759
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9781
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3{
|
|
9760
9782
|
display:flex;
|
|
9761
9783
|
height:var(--size-10);
|
|
9762
9784
|
position:relative;
|
|
9763
9785
|
}
|
|
9764
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9786
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3{
|
|
9765
9787
|
background:var(--text-input-background);
|
|
9766
9788
|
border:var(--text-input-border-width) solid var(--text-input-border-color);
|
|
9767
9789
|
border-radius:var(--text-input-border-radius);
|
|
@@ -9773,84 +9795,105 @@ table.bp_inline_table_module_inlineTable--fc22e[data-modern=true] td:last-child,
|
|
|
9773
9795
|
padding-inline:var(--text-input-padding-inline);
|
|
9774
9796
|
width:100%;
|
|
9775
9797
|
}
|
|
9776
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9798
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3:hover,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3:hover,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3:hover{
|
|
9777
9799
|
box-shadow:var(--text-input-box-shadow);
|
|
9778
9800
|
}
|
|
9779
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9801
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3::placeholder,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3::placeholder,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3::placeholder{
|
|
9780
9802
|
color:var(--text-input-placeholder-color);
|
|
9781
9803
|
opacity:1;
|
|
9782
9804
|
}
|
|
9783
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9805
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3.bp_base_text_input_module_error--403b3,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3.bp_base_text_input_module_error--403b3,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3.bp_base_text_input_module_error--403b3{
|
|
9784
9806
|
background:var(--text-input-error-background);
|
|
9785
9807
|
border:var(--text-input-border-width-error) solid var(--text-input-error-border-color);
|
|
9786
9808
|
outline:0;
|
|
9787
9809
|
padding-inline-start:var(--text-input-padding-inline-error);
|
|
9788
9810
|
}
|
|
9789
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9811
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3.bp_base_text_input_module_readOnly--403b3,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3.bp_base_text_input_module_readOnly--403b3,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3.bp_base_text_input_module_readOnly--403b3{
|
|
9790
9812
|
background-color:var(--text-input-read-only-background);
|
|
9791
9813
|
border-color:var(--text-input-read-only-border-color);
|
|
9792
9814
|
box-shadow:var(--text-input-box-shadow);
|
|
9793
9815
|
color:var(--text-input-read-only-color);
|
|
9794
9816
|
cursor:default;
|
|
9795
9817
|
}
|
|
9796
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9818
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3.bp_base_text_input_module_readOnly--403b3:focus-visible,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3.bp_base_text_input_module_readOnly--403b3:focus-visible,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3.bp_base_text_input_module_readOnly--403b3:focus-visible{
|
|
9797
9819
|
border:var(--text-input-border-width-focused) solid var(--text-input-border-color-focus);
|
|
9798
9820
|
}
|
|
9799
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9821
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3:disabled,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3:disabled,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3:disabled{
|
|
9800
9822
|
background:var(--text-input-disabled-background);
|
|
9801
9823
|
border-color:var(--text-input-disabled-border-color);
|
|
9802
9824
|
box-shadow:var(--text-input-box-shadow);
|
|
9803
9825
|
color:var(--text-input-disabled-color);
|
|
9804
9826
|
}
|
|
9805
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9827
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3:disabled:hover,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3:disabled:hover,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3:disabled:hover{
|
|
9806
9828
|
border-color:var(--text-input-border-color);
|
|
9807
9829
|
}
|
|
9808
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9830
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3:focus-visible,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3:focus-visible,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3:focus-visible{
|
|
9809
9831
|
background:var(--text-input-focused-background);
|
|
9810
9832
|
border:var(--text-input-border-width-focused) solid var(--text-input-focused-border-color);
|
|
9811
9833
|
outline:0;
|
|
9812
9834
|
padding-inline-start:var(--text-input-padding-inline-focused);
|
|
9813
9835
|
}
|
|
9814
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9836
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3:has(+ .bp_base_text_input_module_endIcon--403b3),.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3:has(+ .bp_base_text_input_module_endIcon--403b3),.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3:has(+ .bp_base_text_input_module_endIcon--403b3){
|
|
9815
9837
|
padding-inline-end:calc(var(--text-input-padding-inline) + var(--end-icon-width) + var(--text-input-icon-padding));
|
|
9816
9838
|
}
|
|
9817
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9839
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3:not(:disabled, :focus-visible, .bp_base_text_input_module_error--403b3):hover, .bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3:not(:disabled, :focus-visible, .bp_base_text_input_module_error--403b3):hover, .bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3:not(:disabled, :focus-visible, .bp_base_text_input_module_error--403b3):hover{
|
|
9818
9840
|
background:var(--text-input-hover-background);
|
|
9819
9841
|
border:var(--border-1) solid var(--text-input-hover-border-color);
|
|
9820
9842
|
}
|
|
9821
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9843
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_startIcon--403b3{
|
|
9822
9844
|
left:calc(var(--text-input-padding-inline) + var(--text-input-border-width));
|
|
9823
9845
|
position:absolute;
|
|
9824
9846
|
top:50%;
|
|
9825
9847
|
transform:translateY(-50%);
|
|
9826
9848
|
}
|
|
9827
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9849
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_startIcon--403b3 + input.bp_base_text_input_module_textInput--403b3{
|
|
9828
9850
|
--text-input-start-icon-space:calc(var(--text-input-icon-padding) + var(--start-icon-width));
|
|
9829
9851
|
padding-inline-start:calc(var(--text-input-padding-inline) + var(--text-input-start-icon-space));
|
|
9830
9852
|
}
|
|
9831
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9853
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_startIcon--403b3 + input.bp_base_text_input_module_textInput--403b3:focus-visible{
|
|
9832
9854
|
padding-inline-start:calc(var(--text-input-padding-inline-focused) + var(--text-input-start-icon-space));
|
|
9833
9855
|
}
|
|
9834
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9856
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_startIcon--403b3 + input.bp_base_text_input_module_textInput--403b3.bp_base_text_input_module_error--403b3{
|
|
9835
9857
|
padding-inline-start:calc(var(--text-input-padding-inline-error) + var(--text-input-start-icon-space));
|
|
9836
9858
|
}
|
|
9837
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9859
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_endIcon--403b3{
|
|
9838
9860
|
position:absolute;
|
|
9839
9861
|
right:calc(var(--text-input-padding-inline) + var(--text-input-border-width));
|
|
9840
9862
|
top:50%;
|
|
9841
9863
|
transform:translateY(-50%);
|
|
9842
9864
|
}
|
|
9843
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9865
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_inlineErrorIcon--403b3{
|
|
9844
9866
|
height:var(--text-input-inline-error-icon-height);
|
|
9845
9867
|
width:var(--text-input-inline-error-icon-width);
|
|
9846
9868
|
}
|
|
9847
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9869
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3.bp_base_text_input_module_disabled--403b3{
|
|
9848
9870
|
opacity:var(--disabled-opacity);
|
|
9849
9871
|
}
|
|
9850
|
-
.bp_base_text_input_module_textInputContainerOuter--
|
|
9872
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_inlineError--403b3,.bp_base_text_input_module_textInputContainerOuter--403b3 .bp_base_text_input_module_subtext--403b3{
|
|
9851
9873
|
margin-block-start:var(--text-input-inline-error-subtext-block-margin);
|
|
9852
9874
|
}
|
|
9853
9875
|
|
|
9876
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true][data-bp-animated=true] .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3,.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true][data-bp-animated=true] .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3,.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true][data-bp-animated=true] .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3{
|
|
9877
|
+
transition-duration:var(--bp-duration-short);
|
|
9878
|
+
transition-property:border-color, background-color;
|
|
9879
|
+
transition-timing-function:var(--bp-curve-small-off);
|
|
9880
|
+
}
|
|
9881
|
+
.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true][data-bp-animated=true] .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3:not(:disabled).bp_base_text_input_module_error--403b3,.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true][data-bp-animated=true] .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3:not(:disabled):focus-visible,.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true][data-bp-animated=true] .bp_base_text_input_module_textInputContainer--403b3 .bp_base_text_input_module_textInput--403b3:not(:disabled):hover,.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true][data-bp-animated=true] .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3:not(:disabled).bp_base_text_input_module_error--403b3,.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true][data-bp-animated=true] .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3:not(:disabled):focus-visible,.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true][data-bp-animated=true] .bp_base_text_input_module_textInputContainer--403b3 input[type=number].bp_base_text_input_module_textInput--403b3:not(:disabled):hover,.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true][data-bp-animated=true] .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3:not(:disabled).bp_base_text_input_module_error--403b3,.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true][data-bp-animated=true] .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3:not(:disabled):focus-visible,.bp_base_text_input_module_textInputContainerOuter--403b3[data-modern=true][data-bp-animated=true] .bp_base_text_input_module_textInputContainer--403b3 input[type=text].bp_base_text_input_module_textInput--403b3:not(:disabled):hover{
|
|
9882
|
+
transition-timing-function:var(--bp-curve-small-on);
|
|
9883
|
+
}
|
|
9884
|
+
|
|
9885
|
+
.bp_password_input_module_passwordInput--b74ce input[type=password],.bp_password_input_module_passwordInput--b74ce input[type=text]{
|
|
9886
|
+
padding-inline-end:2.375rem;
|
|
9887
|
+
}
|
|
9888
|
+
.bp_password_input_module_passwordInput--b74ce .bp_password_input_module_iconButton--b74ce{
|
|
9889
|
+
height:var(--size-6);
|
|
9890
|
+
inset-inline-end:.5rem;
|
|
9891
|
+
width:var(--size-6);
|
|
9892
|
+
}
|
|
9893
|
+
.bp_password_input_module_passwordInput--b74ce .bp_password_input_module_iconButton--b74ce:active,.bp_password_input_module_passwordInput--b74ce .bp_password_input_module_iconButton--b74ce:hover{
|
|
9894
|
+
background:none;
|
|
9895
|
+
}
|
|
9896
|
+
|
|
9854
9897
|
.bp_progress_bar_module_reactAriaProgressBar--43526{
|
|
9855
9898
|
display:grid;
|
|
9856
9899
|
grid-template-areas:"label value" "bar bar";
|
|
@@ -2,11 +2,14 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { Hidden, Visible } from '@box/blueprint-web-assets/icons/Line';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { forwardRef, useRef, useState, useCallback } from 'react';
|
|
5
|
+
import '../blueprint-configuration-context/blueprint-configuration-context.js';
|
|
6
|
+
import '../blueprint-configuration-context/consts.js';
|
|
7
|
+
import { useBlueprintConfiguration } from '../blueprint-configuration-context/useBlueprintConfiguration.js';
|
|
8
|
+
import { BaseTextInput } from '../primitives/base-text-input/base-text-input.js';
|
|
5
9
|
import { IconButton } from '../primitives/icon-button/icon-button.js';
|
|
6
10
|
import { useForkRef } from '../utils/useForkRef.js';
|
|
7
11
|
import { useUniqueId } from '../utils/useUniqueId.js';
|
|
8
12
|
import styles from './password-input.module.js';
|
|
9
|
-
import { BaseTextInput } from '../primitives/base-text-input/base-text-input.js';
|
|
10
13
|
|
|
11
14
|
const PasswordInput = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
12
15
|
const {
|
|
@@ -31,9 +34,14 @@ const PasswordInput = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
31
34
|
}, [isControlled, onPasswordVisibleChange, passwordVisibleFinal]);
|
|
32
35
|
const inputType = passwordVisibleFinal ? 'text' : 'password';
|
|
33
36
|
const iconButtonAriaLabel = passwordVisibleFinal ? hidePasswordAriaLabel : showPasswordAriaLabel;
|
|
37
|
+
const {
|
|
38
|
+
componentsWithAnimationEnabled
|
|
39
|
+
} = useBlueprintConfiguration();
|
|
40
|
+
const isAnimationEnabled = componentsWithAnimationEnabled.includes('PasswordInput');
|
|
34
41
|
return jsx(BaseTextInput, {
|
|
35
42
|
...rest,
|
|
36
43
|
ref: useForkRef(inputRef, forwardedRef),
|
|
44
|
+
"data-bp-animated": isAnimationEnabled ? 'true' : 'false',
|
|
37
45
|
autoComplete: autocomplete,
|
|
38
46
|
className: clsx(styles.passwordInput, props.className),
|
|
39
47
|
endIcon: jsx(IconButton, {
|
|
@@ -41,6 +41,7 @@ const BaseTextInput = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
41
41
|
startIcon,
|
|
42
42
|
subtext,
|
|
43
43
|
id,
|
|
44
|
+
'data-bp-animated': animatedDataAttribute,
|
|
44
45
|
...rest
|
|
45
46
|
} = props;
|
|
46
47
|
const uniqueId = useUniqueId('input-');
|
|
@@ -79,6 +80,7 @@ const BaseTextInput = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
79
80
|
[styles.disabled]: disabled,
|
|
80
81
|
[styles.error]: shouldMarkError
|
|
81
82
|
}, className),
|
|
83
|
+
"data-bp-animated": animatedDataAttribute ?? 'false',
|
|
82
84
|
"data-modern": enableModernizedComponents ? 'true' : 'false',
|
|
83
85
|
children: [jsx(Label, {
|
|
84
86
|
className: clsx([styles.label], {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../../index.css';
|
|
2
|
-
var styles = {"textInputContainerOuter":"bp_base_text_input_module_textInputContainerOuter--
|
|
2
|
+
var styles = {"textInputContainerOuter":"bp_base_text_input_module_textInputContainerOuter--403b3","label":"bp_base_text_input_module_label--403b3","textInputContainer":"bp_base_text_input_module_textInputContainer--403b3","textInput":"bp_base_text_input_module_textInput--403b3","hidden":"bp_base_text_input_module_hidden--403b3","error":"bp_base_text_input_module_error--403b3","readOnly":"bp_base_text_input_module_readOnly--403b3","endIcon":"bp_base_text_input_module_endIcon--403b3","startIcon":"bp_base_text_input_module_startIcon--403b3","inlineErrorIcon":"bp_base_text_input_module_inlineErrorIcon--403b3","disabled":"bp_base_text_input_module_disabled--403b3","inlineError":"bp_base_text_input_module_inlineError--403b3","subtext":"bp_base_text_input_module_subtext--403b3"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -3,44 +3,82 @@ import { AlertBadge } from '@box/blueprint-web-assets/icons/Fill';
|
|
|
3
3
|
import { AlertCircle } from '@box/blueprint-web-assets/icons/Medium';
|
|
4
4
|
import { Size4, IconIconErrorOnLight, bpSize050 } from '@box/blueprint-web-assets/tokens/tokens';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
-
import { forwardRef } from 'react';
|
|
6
|
+
import { forwardRef, useCallback } from 'react';
|
|
7
|
+
import '../../blueprint-configuration-context/blueprint-configuration-context.js';
|
|
8
|
+
import '../../blueprint-configuration-context/consts.js';
|
|
9
|
+
import { useBlueprintConfiguration } from '../../blueprint-configuration-context/useBlueprintConfiguration.js';
|
|
7
10
|
import { useBlueprintModernization } from '../../blueprint-modernization-context/useBlueprintModernization.js';
|
|
11
|
+
import { useInlineErrorPresence } from './utils/use-inline-error-presence.js';
|
|
8
12
|
import styles from './inline-error.module.js';
|
|
9
13
|
|
|
14
|
+
const renderErrorContent = (content, enableModernizedComponents, errorIconClassName) => content && (!enableModernizedComponents ? jsxs(Fragment, {
|
|
15
|
+
children: [jsx(AlertBadge, {
|
|
16
|
+
className: errorIconClassName,
|
|
17
|
+
color: IconIconErrorOnLight,
|
|
18
|
+
height: Size4,
|
|
19
|
+
role: "presentation",
|
|
20
|
+
width: Size4
|
|
21
|
+
}), content]
|
|
22
|
+
}) : jsxs(Fragment, {
|
|
23
|
+
children: [jsx(AlertCircle, {
|
|
24
|
+
className: errorIconClassName,
|
|
25
|
+
color: IconIconErrorOnLight,
|
|
26
|
+
height: bpSize050,
|
|
27
|
+
role: "presentation",
|
|
28
|
+
width: bpSize050
|
|
29
|
+
}), content]
|
|
30
|
+
}));
|
|
10
31
|
/** Renders an inline error message and icon, used to show error state in form elements. */
|
|
11
32
|
const InlineError = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
12
33
|
const {
|
|
13
34
|
children,
|
|
14
35
|
className,
|
|
36
|
+
onAnimationEnd: onAnimationEndProp,
|
|
15
37
|
...rest
|
|
16
38
|
} = props;
|
|
17
39
|
const {
|
|
18
40
|
enableModernizedComponents
|
|
19
41
|
} = useBlueprintModernization();
|
|
42
|
+
const {
|
|
43
|
+
componentsWithAnimationEnabled
|
|
44
|
+
} = useBlueprintConfiguration();
|
|
45
|
+
const isAnimationEnabled = componentsWithAnimationEnabled.includes('InlineError');
|
|
46
|
+
const useModernizedAnimation = isAnimationEnabled && enableModernizedComponents;
|
|
47
|
+
const presence = useInlineErrorPresence(children, useModernizedAnimation);
|
|
48
|
+
const {
|
|
49
|
+
onAnimationEnd: onPresenceAnimationEnd
|
|
50
|
+
} = presence;
|
|
51
|
+
const handleAnimationEnd = useCallback(event => {
|
|
52
|
+
onPresenceAnimationEnd(event);
|
|
53
|
+
onAnimationEndProp?.(event);
|
|
54
|
+
}, [onPresenceAnimationEnd, onAnimationEndProp]);
|
|
55
|
+
/** Legacy path: identical DOM/CSS to pre-animation InlineError (no mount/unmount, `.empty` + `display: none`). */
|
|
56
|
+
if (!useModernizedAnimation) {
|
|
57
|
+
return jsx("span", {
|
|
58
|
+
...rest,
|
|
59
|
+
ref: forwardedRef,
|
|
60
|
+
className: clsx([className, styles.inlineError, {
|
|
61
|
+
[styles.empty]: !children
|
|
62
|
+
}]),
|
|
63
|
+
"data-modern": enableModernizedComponents ? 'true' : 'false',
|
|
64
|
+
onAnimationEnd: onAnimationEndProp,
|
|
65
|
+
children: renderErrorContent(children, enableModernizedComponents, styles.errorIcon)
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/** `return null` when there is no error (and we are not in the exit phase): no visible slot for the
|
|
69
|
+
message — layout matches legacy (legacy hides the same slot via `.empty` + `display: none`). */
|
|
70
|
+
if (!presence.isMounted) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
20
73
|
return jsx("span", {
|
|
21
74
|
...rest,
|
|
22
75
|
ref: forwardedRef,
|
|
23
|
-
className: clsx([className, styles.inlineError,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"data-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
className: styles.errorIcon,
|
|
30
|
-
color: IconIconErrorOnLight,
|
|
31
|
-
height: Size4,
|
|
32
|
-
role: "presentation",
|
|
33
|
-
width: Size4
|
|
34
|
-
}), children]
|
|
35
|
-
}) : jsxs(Fragment, {
|
|
36
|
-
children: [jsx(AlertCircle, {
|
|
37
|
-
className: styles.errorIcon,
|
|
38
|
-
color: IconIconErrorOnLight,
|
|
39
|
-
height: bpSize050,
|
|
40
|
-
role: "presentation",
|
|
41
|
-
width: bpSize050
|
|
42
|
-
}), children]
|
|
43
|
-
}))
|
|
76
|
+
className: clsx([className, styles.inlineError, styles.animated]),
|
|
77
|
+
"data-bp-animated": "true",
|
|
78
|
+
"data-modern": "true",
|
|
79
|
+
"data-state": presence.presenceState,
|
|
80
|
+
onAnimationEnd: handleAnimationEnd,
|
|
81
|
+
children: renderErrorContent(presence.content, enableModernizedComponents, styles.errorIcon)
|
|
44
82
|
});
|
|
45
83
|
});
|
|
46
84
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import '../../index.css';
|
|
2
|
-
var styles = {"inlineError":"bp_inline_error_module_inlineError--
|
|
2
|
+
var styles = {"inlineError":"bp_inline_error_module_inlineError--e70b6","empty":"bp_inline_error_module_empty--e70b6","errorIcon":"bp_inline_error_module_errorIcon--e70b6","animated":"bp_inline_error_module_animated--e70b6"};
|
|
3
3
|
|
|
4
4
|
export { styles as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type AnimationEvent } from 'react';
|
|
2
|
+
type PresenceState = 'open' | 'closed';
|
|
3
|
+
/**
|
|
4
|
+
* Exit-animation presence for `InlineError`. Pattern inspired by Radix UI `usePresence`:
|
|
5
|
+
* keep the node mounted while exit CSS runs, then unmount on `animationend`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useInlineErrorPresence(children: React.ReactNode, isAnimationEnabled: boolean): {
|
|
8
|
+
content: string | number | boolean | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | import("react").ReactPortal | null | undefined;
|
|
9
|
+
isMounted: boolean;
|
|
10
|
+
presenceState: PresenceState | undefined;
|
|
11
|
+
onAnimationEnd: (e: AnimationEvent<HTMLSpanElement>) => void;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import noop from 'lodash/noop';
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
3
|
+
import { useEnhancedEffect } from '../../../utils/useEnhancedEffect.js';
|
|
4
|
+
|
|
5
|
+
const animationEndNoop = noop;
|
|
6
|
+
/**
|
|
7
|
+
* Exit-animation presence for `InlineError`. Pattern inspired by Radix UI `usePresence`:
|
|
8
|
+
* keep the node mounted while exit CSS runs, then unmount on `animationend`.
|
|
9
|
+
*/
|
|
10
|
+
function useInlineErrorPresence(children, isAnimationEnabled) {
|
|
11
|
+
const hasContent = Boolean(children);
|
|
12
|
+
const [renderedChildren, setRenderedChildren] = useState(children);
|
|
13
|
+
const [presenceState, setPresenceState] = useState(() => isAnimationEnabled && hasContent ? 'open' : undefined);
|
|
14
|
+
const isMounted = isAnimationEnabled && (presenceState === 'open' || presenceState === 'closed');
|
|
15
|
+
const unmountAfterExit = useCallback(() => {
|
|
16
|
+
setPresenceState(undefined);
|
|
17
|
+
setRenderedChildren(undefined);
|
|
18
|
+
}, []);
|
|
19
|
+
const onAnimationEnd = useCallback(e => {
|
|
20
|
+
if (e.target !== e.currentTarget || presenceState !== 'closed') {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
unmountAfterExit();
|
|
24
|
+
}, [presenceState, unmountAfterExit]);
|
|
25
|
+
useEnhancedEffect(() => {
|
|
26
|
+
if (!isAnimationEnabled) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (hasContent) {
|
|
30
|
+
setRenderedChildren(children);
|
|
31
|
+
setPresenceState('open');
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
setPresenceState(current => current === 'open' ? 'closed' : current);
|
|
35
|
+
}, [children, isAnimationEnabled, hasContent]);
|
|
36
|
+
// When `isAnimationEnabled` is false (legacy path), return a no-op result: no mount/unmount, no exit animation.
|
|
37
|
+
// `inline-error.tsx` ignores `presence` and renders the legacy `<span>` + `.empty` instead.
|
|
38
|
+
if (!isAnimationEnabled) {
|
|
39
|
+
return {
|
|
40
|
+
content: children,
|
|
41
|
+
isMounted: false,
|
|
42
|
+
presenceState: undefined,
|
|
43
|
+
onAnimationEnd: animationEndNoop
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
content: renderedChildren,
|
|
48
|
+
isMounted,
|
|
49
|
+
presenceState,
|
|
50
|
+
onAnimationEnd
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { useInlineErrorPresence };
|
|
@@ -3,11 +3,14 @@ import { PencilCrossed as PencilCrossed$1 } from '@box/blueprint-web-assets/icon
|
|
|
3
3
|
import { PencilCrossed } from '@box/blueprint-web-assets/icons/Medium';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import { forwardRef, useRef, useCallback, useMemo, cloneElement } from 'react';
|
|
6
|
+
import '../blueprint-configuration-context/blueprint-configuration-context.js';
|
|
7
|
+
import '../blueprint-configuration-context/consts.js';
|
|
8
|
+
import { useBlueprintConfiguration } from '../blueprint-configuration-context/useBlueprintConfiguration.js';
|
|
9
|
+
import { useBlueprintModernization } from '../blueprint-modernization-context/useBlueprintModernization.js';
|
|
6
10
|
import { LoadingIndicator } from '../loading-indicator/loading-indicator.js';
|
|
7
11
|
import { BaseTextInput } from '../primitives/base-text-input/base-text-input.js';
|
|
8
12
|
import { useForkRef } from '../utils/useForkRef.js';
|
|
9
13
|
import styles from './text-input.module.js';
|
|
10
|
-
import { useBlueprintModernization } from '../blueprint-modernization-context/useBlueprintModernization.js';
|
|
11
14
|
|
|
12
15
|
const TextInput = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
13
16
|
const {
|
|
@@ -21,6 +24,10 @@ const TextInput = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
21
24
|
const {
|
|
22
25
|
enableModernizedComponents
|
|
23
26
|
} = useBlueprintModernization();
|
|
27
|
+
const {
|
|
28
|
+
componentsWithAnimationEnabled
|
|
29
|
+
} = useBlueprintConfiguration();
|
|
30
|
+
const isAnimationEnabled = componentsWithAnimationEnabled.includes('TextInput');
|
|
24
31
|
const inputRef = useRef(null);
|
|
25
32
|
const focusInput = useCallback(() => {
|
|
26
33
|
inputRef.current?.focus();
|
|
@@ -61,6 +68,7 @@ const TextInput = /*#__PURE__*/forwardRef((props, forwardedRef) => {
|
|
|
61
68
|
return jsx(BaseTextInput, {
|
|
62
69
|
...rest,
|
|
63
70
|
ref: useForkRef(inputRef, forwardedRef),
|
|
71
|
+
"data-bp-animated": isAnimationEnabled ? 'true' : 'false',
|
|
64
72
|
className: clsx(styles.textInput, props.className),
|
|
65
73
|
readOnly: readOnly,
|
|
66
74
|
...(endIconLocal ? {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@box/blueprint-web",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.3.0",
|
|
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.21",
|
|
49
49
|
"@ariakit/react-core": "0.4.21",
|
|
50
|
-
"@box/blueprint-web-assets": "^4.121.
|
|
50
|
+
"@box/blueprint-web-assets": "^4.121.6",
|
|
51
51
|
"@internationalized/date": "^3.12.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.20.
|
|
80
|
+
"@box/storybook-utils": "^0.20.6",
|
|
81
81
|
"@figma/code-connect": "1.4.4",
|
|
82
82
|
"@types/react": "^18.0.0",
|
|
83
83
|
"@types/react-dom": "^18.0.0",
|