@cruk/cruk-react-components 7.1.5 → 7.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.css +150 -401
- package/lib/src/components/AddressLookup/index.js +1 -1
- package/lib/src/components/AddressLookup/index.js.map +1 -1
- package/lib/src/components/Avatar/index.js +1 -1
- package/lib/src/components/Badge/index.js +1 -1
- package/lib/src/components/Box/index.js +1 -1
- package/lib/src/components/Carousel/index.js +1 -1
- package/lib/src/components/Carousel/index.js.map +1 -1
- package/lib/src/components/Checkbox/index.js +1 -1
- package/lib/src/components/Collapse/index.js +1 -1
- package/lib/src/components/DateField/index.js +1 -1
- package/lib/src/components/DateField/index.js.map +1 -1
- package/lib/src/components/ErrorText/index.js +1 -1
- package/lib/src/components/Footer/index.js +1 -1
- package/lib/src/components/Header/index.js +1 -1
- package/lib/src/components/Header/index.js.map +1 -1
- package/lib/src/components/Heading/index.js +1 -1
- package/lib/src/components/IconFa/index.js +1 -1
- package/lib/src/components/InfoBox/index.js +1 -1
- package/lib/src/components/LabelWrapper/index.js +1 -1
- package/lib/src/components/LegendWrapper/index.js +1 -1
- package/lib/src/components/Link/index.js +1 -1
- package/lib/src/components/Loader/index.js +1 -1
- package/lib/src/components/Modal/TestModalWithContent.d.ts +1 -3
- package/lib/src/components/Modal/TestModalWithOpenButton.d.ts +3 -0
- package/lib/src/components/Modal/index.d.ts +13 -12
- package/lib/src/components/Modal/index.js +1 -1
- package/lib/src/components/Modal/index.js.map +1 -1
- package/lib/src/components/Pagination/index.js +1 -1
- package/lib/src/components/PopOver/index.d.ts +4 -8
- package/lib/src/components/PopOver/index.js +1 -1
- package/lib/src/components/PopOver/index.js.map +1 -1
- package/lib/src/components/ProgressBar/index.js +1 -1
- package/lib/src/components/RadioConsent/index.js +1 -1
- package/lib/src/components/Select/index.js +1 -1
- package/lib/src/components/Step/index.js +1 -1
- package/lib/src/components/Text/index.js +1 -1
- package/lib/src/components/TextAreaField/index.js +1 -1
- package/lib/src/components/TextField/index.js +1 -1
- package/lib/src/components/Totaliser/index.js +1 -1
- package/lib/src/components/UserBlock/index.js +1 -1
- package/lib/src/hooks/useKey.js +1 -1
- package/lib/src/hooks/useLayoutEffectBrowser.js +1 -1
- package/lib/src/hooks/useScrollPosition.js +1 -1
- package/lib/src/hooks/useScrollPosition.js.map +1 -1
- package/lib/src/types.d.ts +1 -1
- package/lib/src/types.js.map +1 -1
- package/lib/src/utils/debounce.js +1 -1
- package/package.json +5 -16
- package/lib/index.css.map +0 -1
- package/lib/node_modules/@babel/runtime/helpers/esm/defineProperty.js +0 -2
- package/lib/node_modules/@babel/runtime/helpers/esm/defineProperty.js.map +0 -1
- package/lib/node_modules/@babel/runtime/helpers/esm/extends.js +0 -2
- package/lib/node_modules/@babel/runtime/helpers/esm/extends.js.map +0 -1
- package/lib/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +0 -2
- package/lib/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js.map +0 -1
- package/lib/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +0 -2
- package/lib/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js.map +0 -1
- package/lib/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +0 -2
- package/lib/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js.map +0 -1
- package/lib/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +0 -2
- package/lib/node_modules/@babel/runtime/helpers/esm/toPrimitive.js.map +0 -1
- package/lib/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +0 -2
- package/lib/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js.map +0 -1
- package/lib/node_modules/@babel/runtime/helpers/esm/typeof.js +0 -2
- package/lib/node_modules/@babel/runtime/helpers/esm/typeof.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/commands.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/commands.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/constants.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/constants.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/focusInside.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/focusInside.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/focusIsHidden.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/focusIsHidden.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/focusSolver.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/focusSolver.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/focusables.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/focusables.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/moveFocusInside.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/moveFocusInside.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/return-focus.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/return-focus.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/sibling.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/sibling.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/solver.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/solver.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/DOMutils.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/utils/DOMutils.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/all-affected.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/utils/all-affected.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/array.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/utils/array.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/auto-focus.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/utils/auto-focus.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/correctFocus.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/utils/correctFocus.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/firstFocus.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/utils/firstFocus.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/getActiveElement.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/utils/getActiveElement.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/is.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/utils/is.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/parenting.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/utils/parenting.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/safe.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/utils/safe.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/tabOrder.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/utils/tabOrder.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/tabUtils.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/utils/tabUtils.js.map +0 -1
- package/lib/node_modules/focus-lock/dist/es2015/utils/tabbables.js +0 -2
- package/lib/node_modules/focus-lock/dist/es2015/utils/tabbables.js.map +0 -1
- package/lib/node_modules/react-clientside-effect/lib/index.es.js +0 -2
- package/lib/node_modules/react-clientside-effect/lib/index.es.js.map +0 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/Combination.js +0 -2
- package/lib/node_modules/react-focus-lock/dist/es2015/Combination.js.map +0 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/FocusGuard.js +0 -2
- package/lib/node_modules/react-focus-lock/dist/es2015/FocusGuard.js.map +0 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/Lock.js +0 -2
- package/lib/node_modules/react-focus-lock/dist/es2015/Lock.js.map +0 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/Trap.js +0 -2
- package/lib/node_modules/react-focus-lock/dist/es2015/Trap.js.map +0 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/index.js +0 -2
- package/lib/node_modules/react-focus-lock/dist/es2015/index.js.map +0 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/medium.js +0 -2
- package/lib/node_modules/react-focus-lock/dist/es2015/medium.js.map +0 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/scope.js +0 -2
- package/lib/node_modules/react-focus-lock/dist/es2015/scope.js.map +0 -1
- package/lib/node_modules/react-focus-lock/dist/es2015/util.js +0 -2
- package/lib/node_modules/react-focus-lock/dist/es2015/util.js.map +0 -1
- package/lib/node_modules/react-intersection-observer/dist/index.js +0 -2
- package/lib/node_modules/react-intersection-observer/dist/index.js.map +0 -1
- package/lib/node_modules/use-callback-ref/dist/es2015/assignRef.js +0 -2
- package/lib/node_modules/use-callback-ref/dist/es2015/assignRef.js.map +0 -1
- package/lib/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +0 -2
- package/lib/node_modules/use-callback-ref/dist/es2015/useMergeRef.js.map +0 -1
- package/lib/node_modules/use-callback-ref/dist/es2015/useRef.js +0 -2
- package/lib/node_modules/use-callback-ref/dist/es2015/useRef.js.map +0 -1
- package/lib/node_modules/use-sidecar/dist/es2015/medium.js +0 -2
- package/lib/node_modules/use-sidecar/dist/es2015/medium.js.map +0 -1
- package/lib/src/components/Carousel/Dots.d.ts +0 -9
- package/lib/src/components/Carousel/Dots.js +0 -2
- package/lib/src/components/Carousel/Dots.js.map +0 -1
- package/lib/src/components/Modal/TestModalWithState.d.ts +0 -4
- package/lib/src/hooks/useEffectBrowser.d.ts +0 -3
- package/lib/src/hooks/useEffectBrowser.js +0 -2
- package/lib/src/hooks/useEffectBrowser.js.map +0 -1
package/lib/index.css
CHANGED
|
@@ -77,6 +77,7 @@
|
|
|
77
77
|
|
|
78
78
|
@media (prefers-reduced-motion: reduce) {
|
|
79
79
|
*,
|
|
80
|
+
*::backdrop,
|
|
80
81
|
*:after,
|
|
81
82
|
*:before {
|
|
82
83
|
animation-play-state: paused !important;
|
|
@@ -2783,87 +2784,72 @@ button {
|
|
|
2783
2784
|
}
|
|
2784
2785
|
}
|
|
2785
2786
|
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2787
|
+
.component-modal {
|
|
2788
|
+
box-sizing: border-box;
|
|
2789
|
+
overflow-x: hidden;
|
|
2790
|
+
overflow-y: auto;
|
|
2791
|
+
position: fixed;
|
|
2792
|
+
top: 0;
|
|
2793
|
+
left: 0;
|
|
2794
|
+
width: 100%;
|
|
2795
|
+
background-color: var(--clr-background-light, #fff);
|
|
2796
|
+
min-height: 10rem;
|
|
2797
|
+
width: 90%;
|
|
2798
|
+
max-width: 500px;
|
|
2799
|
+
margin: var(--spacing-xs) auto auto auto;
|
|
2800
|
+
margin-bottom: var(--spacing-xxl);
|
|
2801
|
+
padding: var(--spacing-xs);
|
|
2802
|
+
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
|
|
2803
|
+
border: none;
|
|
2804
|
+
opacity: 0;
|
|
2805
|
+
scale: 0;
|
|
2791
2806
|
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2807
|
+
&::backdrop {
|
|
2808
|
+
position: fixed;
|
|
2809
|
+
inset: 0;
|
|
2810
|
+
margin: 0;
|
|
2811
|
+
padding: 0;
|
|
2812
|
+
backdrop-filter: 0.3s;
|
|
2813
|
+
z-index: 100;
|
|
2814
|
+
background-color: hsl(0 0 0 / 0.5);
|
|
2815
|
+
display: none;
|
|
2795
2816
|
}
|
|
2796
|
-
}
|
|
2797
2817
|
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2818
|
+
&[data-is-animated="true"],
|
|
2819
|
+
&[data-is-animated="true"]::backdrop {
|
|
2820
|
+
transition-behavior: allow-discrete;
|
|
2821
|
+
transition-property: all;
|
|
2822
|
+
transition-duration: 0.3s;
|
|
2823
|
+
transition-timing-function: ease-in-out;
|
|
2804
2824
|
}
|
|
2805
|
-
}
|
|
2806
2825
|
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
overflow-x: hidden;
|
|
2812
|
-
overflow-y: auto;
|
|
2813
|
-
position: fixed;
|
|
2814
|
-
top: 0;
|
|
2815
|
-
left: 0;
|
|
2816
|
-
width: 100%;
|
|
2817
|
-
z-index: 9999;
|
|
2818
|
-
}
|
|
2826
|
+
&[open] {
|
|
2827
|
+
display: block;
|
|
2828
|
+
opacity: 1;
|
|
2829
|
+
scale: 1;
|
|
2819
2830
|
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
transform-origin: top center;
|
|
2833
|
-
animation: none;
|
|
2834
|
-
|
|
2835
|
-
&[data-is-animated="true"] {
|
|
2836
|
-
animation: grow 0.2s ease-in-out;
|
|
2831
|
+
@starting-style {
|
|
2832
|
+
opacity: 0;
|
|
2833
|
+
scale: 0;
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
&::backdrop {
|
|
2837
|
+
display: block;
|
|
2838
|
+
background-color: hsl(0 0 0 / 0.5);
|
|
2839
|
+
|
|
2840
|
+
@starting-style {
|
|
2841
|
+
background-color: hsl(0 0 0 / 0);
|
|
2842
|
+
}
|
|
2837
2843
|
}
|
|
2838
2844
|
}
|
|
2839
2845
|
|
|
2840
2846
|
.close-button {
|
|
2841
2847
|
float: right;
|
|
2842
|
-
margin-
|
|
2848
|
+
margin-top: calc(var(--spacing-xs, 1rem) * -1);
|
|
2849
|
+
margin-right: calc(var(--spacing-xs, 0.5rem) * -1);
|
|
2843
2850
|
font-size: 1.2rem;
|
|
2844
2851
|
padding: 0;
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
.background {
|
|
2848
|
-
position: fixed;
|
|
2849
|
-
background: var(--clr-modal-backdrop, #000);
|
|
2850
|
-
bottom: 0;
|
|
2851
|
-
left: 0;
|
|
2852
|
-
opacity: 0.5;
|
|
2853
|
-
right: 0;
|
|
2854
|
-
top: 0;
|
|
2855
|
-
transition:
|
|
2856
|
-
opacity 0.3s,
|
|
2857
|
-
bottom 0s 0.3s;
|
|
2858
|
-
z-index: 100;
|
|
2859
|
-
animation-direction: normal;
|
|
2860
|
-
animation-timing-function: ease-in-out;
|
|
2861
|
-
animation-duration: 0.3s;
|
|
2862
|
-
animation-name: none;
|
|
2863
|
-
|
|
2864
|
-
&[data-is-animated="true"] {
|
|
2865
|
-
animation-name: fade;
|
|
2866
|
-
}
|
|
2852
|
+
outline-offset: -0.5rem;
|
|
2867
2853
|
}
|
|
2868
2854
|
}
|
|
2869
2855
|
|
|
@@ -2975,365 +2961,130 @@ button {
|
|
|
2975
2961
|
}
|
|
2976
2962
|
|
|
2977
2963
|
.component-popover {
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
display: var(--_display, inline-block);
|
|
2982
|
-
position: relative;
|
|
2983
|
-
|
|
2984
|
-
--_modal-margin-top: 0;
|
|
2985
|
-
--_modal-margin-bottom: 10px;
|
|
2986
|
-
--_modal-position-top: auto;
|
|
2987
|
-
--_modal-position-bottom: 100%;
|
|
2988
|
-
--_modal-position-left: 0;
|
|
2989
|
-
--_modal-position-right: auto;
|
|
2990
|
-
|
|
2991
|
-
--_triangle-top: 100%;
|
|
2992
|
-
--_triangle-bottom: auto;
|
|
2993
|
-
--_triangle-left: var(--spacing-s, 1.5rem);
|
|
2994
|
-
--_triangle-right: auto;
|
|
2995
|
-
|
|
2996
|
-
--_triangle-shadow-border-color: rgba(0, 0, 0, 0.25) transparent transparent;
|
|
2997
|
-
--_triangle-shadow-margin: -1px 0 0 0;
|
|
2998
|
-
|
|
2999
|
-
--_triangle-border-color: var(--clr-popover-background, #fff) transparent
|
|
3000
|
-
transparent;
|
|
3001
|
-
|
|
3002
|
-
@media (min-width: 992px) {
|
|
3003
|
-
--_modal-margin-top: 0;
|
|
3004
|
-
--_modal-margin-left: 0;
|
|
3005
|
-
--_modal-margin-right: 0;
|
|
3006
|
-
|
|
3007
|
-
--_triangle-top: 100%;
|
|
3008
|
-
--_triangle-bottom: auto;
|
|
3009
|
-
--_triangle-left: var(--spacing-s, 1.5rem);
|
|
3010
|
-
--_triangle-right: auto;
|
|
3011
|
-
|
|
3012
|
-
--_triangle-shadow-border-color: rgba(0, 0, 0, 0.25) transparent transparent;
|
|
3013
|
-
--_triangle-shadow-margin: -1px 0 0 0;
|
|
3014
|
-
--_triangle-border-color: var(--clr-popover-background, #fff) transparent
|
|
3015
|
-
transparent;
|
|
3016
|
-
}
|
|
3017
|
-
|
|
3018
|
-
&[data-full="true"] {
|
|
3019
|
-
--_display: block;
|
|
3020
|
-
}
|
|
3021
|
-
|
|
3022
|
-
&[data-position="top"] {
|
|
3023
|
-
--_position: "top";
|
|
3024
|
-
--_modal-margin-top: 0;
|
|
3025
|
-
--_modal-margin-bottom: 10px;
|
|
3026
|
-
--_modal-position-top: auto;
|
|
3027
|
-
--_modal-position-bottom: 100%;
|
|
3028
|
-
--_modal-position-left: 0;
|
|
3029
|
-
--_modal-position-right: auto;
|
|
3030
|
-
|
|
3031
|
-
--_triangle-top: 100%;
|
|
3032
|
-
--_triangle-bottom: auto;
|
|
3033
|
-
--_triangle-left: var(--spacing-s, 1.5rem);
|
|
3034
|
-
--_triangle-right: auto;
|
|
3035
|
-
|
|
3036
|
-
--_triangle-shadow-border-color: rgba(0, 0, 0, 0.25) transparent transparent;
|
|
3037
|
-
--_triangle-shadow-margin: -1px 0 0 0;
|
|
3038
|
-
|
|
3039
|
-
--_triangle-border-color: var(--clr-popover-background, #fff) transparent
|
|
3040
|
-
transparent;
|
|
2964
|
+
[popovertarget] {
|
|
2965
|
+
--anchor-name: --popovertarget;
|
|
2966
|
+
position: relative;
|
|
3041
2967
|
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
--
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
--_triangle-shadow-border-color: rgba(0, 0, 0, 0.25) transparent
|
|
3057
|
-
transparent;
|
|
3058
|
-
--_triangle-shadow-margin: -1px 0 0 0;
|
|
3059
|
-
--_triangle-border-color: var(--clr-popover-background, #fff) transparent
|
|
3060
|
-
transparent;
|
|
2968
|
+
/* Tether arrow */
|
|
2969
|
+
&::before {
|
|
2970
|
+
content: "";
|
|
2971
|
+
position: absolute;
|
|
2972
|
+
box-sizing: border-box;
|
|
2973
|
+
width: 1rem;
|
|
2974
|
+
height: 1rem;
|
|
2975
|
+
rotate: 45deg;
|
|
2976
|
+
transform-origin: center center center;
|
|
2977
|
+
background-color: var(--clr-popover-background, #fff);
|
|
2978
|
+
border: 1px solid var(--clr-cruk-grey-300, #c6c6c6);
|
|
2979
|
+
display: none;
|
|
2980
|
+
opacity: 0;
|
|
3061
2981
|
}
|
|
3062
2982
|
}
|
|
3063
|
-
&[data-position="left"] {
|
|
3064
|
-
--_position: "left";
|
|
3065
|
-
|
|
3066
|
-
--_modal-margin-top: 10px;
|
|
3067
|
-
--_modal-margin-bottom: 0;
|
|
3068
|
-
--_modal-margin-left: 0;
|
|
3069
|
-
--_modal-margin-right: 0;
|
|
3070
|
-
--_modal-position-top: 100%;
|
|
3071
|
-
--_modal-position-bottom: auto;
|
|
3072
|
-
--_modal-position-left: auto;
|
|
3073
|
-
--_modal-position-right: auto;
|
|
3074
|
-
|
|
3075
|
-
--_triangle-top: auto;
|
|
3076
|
-
--_triangle-bottom: 100%;
|
|
3077
|
-
--_triangle-left: var(--spacing-s, 1.5rem);
|
|
3078
|
-
--_triangle-right: auto;
|
|
3079
|
-
|
|
3080
|
-
--_triangle-shadow-border-color: transparent transparent rgba(0, 0, 0, 0.25);
|
|
3081
|
-
--_triangle-shadow-margin: 0 0 -1px 0;
|
|
3082
|
-
|
|
3083
|
-
--_triangle-border-color: transparent transparent
|
|
3084
|
-
var(--clr-popover-background, #fff);
|
|
3085
2983
|
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
2984
|
+
[popover] {
|
|
2985
|
+
--position-anchor: --popovertarget;
|
|
2986
|
+
position: absolute;
|
|
2987
|
+
inset: auto;
|
|
3090
2988
|
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
2989
|
+
max-width: none;
|
|
2990
|
+
min-width: auto;
|
|
2991
|
+
overflow: visible;
|
|
3094
2992
|
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
2993
|
+
justify-content: center;
|
|
2994
|
+
word-wrap: break-word;
|
|
2995
|
+
font-size: var(--font-size-s, 0.875rem);
|
|
2996
|
+
background-color: var(--clr-popover-background, #fff);
|
|
3099
2997
|
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
--_triangle-shadow-margin: 0 0 0 -1px;
|
|
2998
|
+
border: 1px solid var(--clr-cruk-grey-300, #c6c6c6);
|
|
2999
|
+
box-shadow: 0 1px 10px rgba(0, 0, 0, 0.2);
|
|
3103
3000
|
|
|
3104
|
-
|
|
3105
|
-
var(--clr-popover-background, #fff);
|
|
3106
|
-
}
|
|
3001
|
+
opacity: 0;
|
|
3107
3002
|
}
|
|
3108
|
-
&[data-position="right"] {
|
|
3109
|
-
--_position: "right";
|
|
3110
|
-
|
|
3111
|
-
--_modal-margin-top: 10px;
|
|
3112
|
-
--_modal-margin-bottom: 0;
|
|
3113
|
-
--_modal-position-top: 100%;
|
|
3114
|
-
--_modal-position-bottom: auto;
|
|
3115
|
-
--_modal-position-left: auto;
|
|
3116
|
-
--_modal-position-right: 0;
|
|
3117
|
-
|
|
3118
|
-
--_triangle-top: auto;
|
|
3119
|
-
--_triangle-bottom: 100%;
|
|
3120
|
-
--_triangle-left: auto;
|
|
3121
|
-
--_triangle-right: var(--spacing-s, 1.5rem);
|
|
3122
|
-
|
|
3123
|
-
--_triangle-shadow-border-color: transparent transparent rgba(0, 0, 0, 0.25);
|
|
3124
|
-
--_triangle-shadow-margin: 0 0 -1px 0;
|
|
3125
|
-
|
|
3126
|
-
--_triangle-border-color: transparent transparent
|
|
3127
|
-
var(--clr-popover-background, #fff);
|
|
3128
|
-
|
|
3129
|
-
@media (min-width: 992px) {
|
|
3130
|
-
--_modal-margin-top: 0;
|
|
3131
|
-
--_modal-margin-left: 10px;
|
|
3132
|
-
--_modal-margin-right: 0;
|
|
3133
|
-
|
|
3134
|
-
--_modal-position-top: 0;
|
|
3135
|
-
--_modal-position-left: 100%;
|
|
3136
|
-
--_modal-position-right: auto;
|
|
3137
|
-
|
|
3138
|
-
--_triangle-top: var(--spacing-s, 1.5rem);
|
|
3139
|
-
--_triangle-bottom: auto;
|
|
3140
|
-
--_triangle-left: -20px;
|
|
3141
|
-
--_triangle-right: auto;
|
|
3142
|
-
|
|
3143
|
-
--_triangle-shadow-border-color: transparent rgba(0, 0, 0, 0.25)
|
|
3144
|
-
transparent transparent;
|
|
3145
|
-
--_triangle-shadow-margin: 0 0 0 1px;
|
|
3146
3003
|
|
|
3147
|
-
|
|
3148
|
-
|
|
3004
|
+
&[data-is-animated="true"] {
|
|
3005
|
+
[popover],
|
|
3006
|
+
[popovertarget]::before {
|
|
3007
|
+
/* allows display none to block with animation*/
|
|
3008
|
+
transition-behavior: allow-discrete;
|
|
3009
|
+
transition-property: all;
|
|
3010
|
+
transition-duration: 0.2s;
|
|
3011
|
+
transition-timing-function: ease-in-out;
|
|
3149
3012
|
}
|
|
3150
3013
|
}
|
|
3151
|
-
&[data-position="bottom"] {
|
|
3152
|
-
--_position: "bottom";
|
|
3153
|
-
|
|
3154
|
-
--_modal-margin-top: 10px;
|
|
3155
|
-
--_modal-margin-bottom: 0;
|
|
3156
|
-
--_modal-position-top: 100%;
|
|
3157
|
-
--_modal-position-bottom: auto;
|
|
3158
|
-
--_modal-position-left: auto;
|
|
3159
|
-
--_modal-position-right: auto;
|
|
3160
|
-
|
|
3161
|
-
--_triangle-top: auto;
|
|
3162
|
-
--_triangle-bottom: 100%;
|
|
3163
|
-
--_triangle-left: var(--spacing-s, 1.5rem);
|
|
3164
|
-
--_triangle-right: auto;
|
|
3165
|
-
|
|
3166
|
-
--_triangle-shadow-border-color: transparent transparent rgba(0, 0, 0, 0.25);
|
|
3167
|
-
--_triangle-shadow-margin: 0 0 -1px 0;
|
|
3168
|
-
|
|
3169
|
-
--_triangle-border-color: transparent transparent
|
|
3170
|
-
var(--clr-popover-background, #fff);
|
|
3171
3014
|
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
--_modal-position-left: auto;
|
|
3179
|
-
--_modal-position-right: auto;
|
|
3180
|
-
|
|
3181
|
-
--_triangle-top: auto;
|
|
3182
|
-
--_triangle-bottom: 100%;
|
|
3183
|
-
--_triangle-left: var(--spacing-s, 1.5rem);
|
|
3184
|
-
--_triangle-right: auto;
|
|
3185
|
-
|
|
3186
|
-
--_triangle-shadow-border-color: transparent transparent
|
|
3187
|
-
rgba(0, 0, 0, 0.25);
|
|
3188
|
-
--_triangle-shadow-margin: 0 0 -1px 0;
|
|
3015
|
+
/* Animate popover */
|
|
3016
|
+
/* Animate tether arrow attached to button */
|
|
3017
|
+
[popover]:popover-open,
|
|
3018
|
+
[popovertarget]:has(+ :popover-open)::before {
|
|
3019
|
+
display: block;
|
|
3020
|
+
opacity: 1;
|
|
3189
3021
|
|
|
3190
|
-
|
|
3191
|
-
|
|
3022
|
+
@starting-style {
|
|
3023
|
+
opacity: 0;
|
|
3192
3024
|
}
|
|
3193
3025
|
}
|
|
3194
|
-
&[data-position="topLeft"] {
|
|
3195
|
-
--_position: "topLeft";
|
|
3196
|
-
|
|
3197
|
-
--_modal-margin-top: 0;
|
|
3198
|
-
--_modal-margin-bottom: 10px;
|
|
3199
|
-
--_modal-position-top: auto;
|
|
3200
|
-
--_modal-position-bottom: 100%;
|
|
3201
|
-
--_modal-position-left: auto;
|
|
3202
|
-
--_modal-position-right: 0;
|
|
3203
|
-
|
|
3204
|
-
--_triangle-top: 100%;
|
|
3205
|
-
--_triangle-bottom: auto;
|
|
3206
|
-
--_triangle-left: auto;
|
|
3207
|
-
--_triangle-right: var(--spacing-s, 1.5rem);
|
|
3208
|
-
|
|
3209
|
-
--_triangle-shadow-border-color: rgba(0, 0, 0, 0.25) transparent transparent;
|
|
3210
|
-
--_triangle-shadow-margin: -1px 0 0 0;
|
|
3211
|
-
|
|
3212
|
-
--_triangle-border-color: var(--clr-popover-background, #fff) transparent
|
|
3213
|
-
transparent;
|
|
3214
|
-
|
|
3215
|
-
@media (min-width: 992px) {
|
|
3216
|
-
--_modal-margin-top: 0;
|
|
3217
|
-
--_modal-margin-left: 0;
|
|
3218
|
-
--_modal-margin-right: 0;
|
|
3219
|
-
|
|
3220
|
-
--_modal-position-top: auto;
|
|
3221
|
-
--_modal-position-left: auto;
|
|
3222
|
-
--_modal-position-right: 0;
|
|
3223
|
-
|
|
3224
|
-
--_triangle-top: 100%;
|
|
3225
|
-
--_triangle-bottom: auto;
|
|
3226
|
-
--_triangle-left: var(--spacing-s, 1.5rem);
|
|
3227
|
-
--_triangle-right: var(--spacing-s, 1.5rem);
|
|
3228
3026
|
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3027
|
+
/* Positioning variants*/
|
|
3028
|
+
&[data-position="top"],
|
|
3029
|
+
&:not([data-position]) {
|
|
3030
|
+
[popover] {
|
|
3031
|
+
position-area: top;
|
|
3032
|
+
position-try-fallbacks: --bottom;
|
|
3033
|
+
}
|
|
3034
|
+
[popovertarget]::before {
|
|
3035
|
+
top: -0.5rem;
|
|
3036
|
+
left: calc(50% - 0.5rem);
|
|
3235
3037
|
}
|
|
3236
3038
|
}
|
|
3237
3039
|
|
|
3238
|
-
&[data-position="
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
--_modal-position-right: 0;
|
|
3247
|
-
|
|
3248
|
-
--_triangle-top: auto;
|
|
3249
|
-
--_triangle-bottom: 100%;
|
|
3250
|
-
--_triangle-left: auto;
|
|
3251
|
-
--_triangle-right: var(--spacing-s, 1.5rem);
|
|
3252
|
-
|
|
3253
|
-
--_triangle-shadow-border-color: transparent transparent rgba(0, 0, 0, 0.25);
|
|
3254
|
-
--_triangle-shadow-margin: 0 0 -1px 0;
|
|
3255
|
-
|
|
3256
|
-
--_triangle-border-color: transparent transparent
|
|
3257
|
-
var(--clr-popover-background, #fff);
|
|
3258
|
-
|
|
3259
|
-
@media (min-width: 992px) {
|
|
3260
|
-
--_modal-margin-top: 10px;
|
|
3261
|
-
--_modal-margin-left: 0;
|
|
3262
|
-
--_modal-margin-right: 0;
|
|
3263
|
-
|
|
3264
|
-
--_modal-position-top: 100%;
|
|
3265
|
-
--_modal-position-left: auto;
|
|
3266
|
-
--_modal-position-right: 0;
|
|
3267
|
-
|
|
3268
|
-
--_triangle-top: auto;
|
|
3269
|
-
--_triangle-bottom: 100%;
|
|
3270
|
-
--_triangle-left: auto;
|
|
3271
|
-
--_triangle-right: var(--spacing-s, 1.5rem);
|
|
3272
|
-
|
|
3273
|
-
--_triangle-shadow-border-color: transparent transparent
|
|
3274
|
-
rgba(0, 0, 0, 0.25);
|
|
3275
|
-
--_triangle-shadow-margin: 0 0 -1px 0;
|
|
3276
|
-
|
|
3277
|
-
--_triangle-border-color: transparent transparent
|
|
3278
|
-
var(--clr-popover-background, #fff);
|
|
3040
|
+
&[data-position="bottom"] {
|
|
3041
|
+
[popover] {
|
|
3042
|
+
position-area: bottom;
|
|
3043
|
+
position-try-fallbacks: --top;
|
|
3044
|
+
}
|
|
3045
|
+
[popovertarget]::before {
|
|
3046
|
+
bottom: -0.5rem;
|
|
3047
|
+
left: calc(50% - 0.5rem);
|
|
3279
3048
|
}
|
|
3280
3049
|
}
|
|
3281
3050
|
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
word-wrap: break-word;
|
|
3287
|
-
z-index: 9999;
|
|
3288
|
-
/* allow inline override */
|
|
3289
|
-
max-width: none;
|
|
3290
|
-
/* allow inline override */
|
|
3291
|
-
min-width: auto;
|
|
3292
|
-
font-size: var(--font-size-s, 0.875rem);
|
|
3293
|
-
background-color: var(--clr-popover-background, #fff);
|
|
3294
|
-
background-clip: padding-box;
|
|
3295
|
-
border: 1px solid rgba(0, 0, 0, 0.25);
|
|
3296
|
-
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
|
|
3297
|
-
|
|
3298
|
-
margin-top: var(--_modal-margin-top, 0);
|
|
3299
|
-
margin-bottom: var(--_modal-margin-bottom, 10px);
|
|
3300
|
-
margin-left: var(--_modal-margin-left, 0);
|
|
3301
|
-
margin-right: var(--_modal-margin-right, 0);
|
|
3302
|
-
|
|
3303
|
-
top: var(--_modal-position-top, auto);
|
|
3304
|
-
bottom: var(--_modal-position-bottom, 100%);
|
|
3305
|
-
left: var(--_modal-position-left, 0);
|
|
3306
|
-
right: var(--_modal-position-right, auto);
|
|
3307
|
-
|
|
3308
|
-
&:after,
|
|
3309
|
-
&:before {
|
|
3310
|
-
content: "";
|
|
3311
|
-
border-style: solid;
|
|
3312
|
-
border-width: 10px;
|
|
3313
|
-
width: 0;
|
|
3314
|
-
height: 0;
|
|
3315
|
-
position: absolute;
|
|
3316
|
-
top: var(--_triangle-top, 100%);
|
|
3317
|
-
bottom: var(--_triangle-bottom, auto);
|
|
3318
|
-
left: var(--_triangle-left, var(--spacing-s, 1.5rem));
|
|
3319
|
-
right: var(--_triangle-right, auto);
|
|
3051
|
+
&[data-position="left"] {
|
|
3052
|
+
[popover] {
|
|
3053
|
+
position-area: left;
|
|
3054
|
+
position-try-fallbacks: --right, --top, --bottom;
|
|
3320
3055
|
}
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
--_triangle-shadow-border-color,
|
|
3325
|
-
rgba(0, 0, 0, 0.25) transparent transparent
|
|
3326
|
-
);
|
|
3056
|
+
[popovertarget]::before {
|
|
3057
|
+
left: -0.5rem;
|
|
3058
|
+
top: calc(50% - 0.5rem);
|
|
3327
3059
|
}
|
|
3060
|
+
}
|
|
3328
3061
|
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3062
|
+
&[data-position="right"] {
|
|
3063
|
+
[popover] {
|
|
3064
|
+
position-area: right;
|
|
3065
|
+
position-try-fallbacks: --left, --top, --bottom;
|
|
3066
|
+
}
|
|
3067
|
+
[popovertarget]::before {
|
|
3068
|
+
right: -0.5rem;
|
|
3069
|
+
top: calc(50% - 0.5rem);
|
|
3335
3070
|
}
|
|
3336
3071
|
}
|
|
3072
|
+
|
|
3073
|
+
/* anchor name only works within this wrapping class */
|
|
3074
|
+
anchor-scope: --popovertarget;
|
|
3075
|
+
}
|
|
3076
|
+
|
|
3077
|
+
@position-try --bottom {
|
|
3078
|
+
position-area: bottom;
|
|
3079
|
+
}
|
|
3080
|
+
@position-try --top {
|
|
3081
|
+
position-area: top;
|
|
3082
|
+
}
|
|
3083
|
+
@position-try --left {
|
|
3084
|
+
position-area: left;
|
|
3085
|
+
}
|
|
3086
|
+
@position-try --right {
|
|
3087
|
+
position-area: right;
|
|
3337
3088
|
}
|
|
3338
3089
|
|
|
3339
3090
|
/* type CircleKeyCircleFillKeyFramesProps = {
|
|
@@ -4245,5 +3996,3 @@ button {
|
|
|
4245
3996
|
word-break: break-word;
|
|
4246
3997
|
}
|
|
4247
3998
|
}
|
|
4248
|
-
|
|
4249
|
-
/*# sourceMappingURL=index.css.map */
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as e,__assign as n}from"../../../node_modules/tslib/tslib.es6.js";import t,{useState as r,useRef as o,useCallback as s,useEffect as a}from"react";import{faChevronRight as i}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{useKey as l}from"../../hooks/useKey.js";import{debounce as c}from"../../utils/debounce.js";import{removeCommasFromObjectStringValues as d}from"../../utils/Helper.js";import{Text as u}from"../Text/index.js";import{TextField as m}from"../TextField/index.js";import{IconFa as f}from"../IconFa/index.js";var p=function(p){var h=p.apiKey,g=p.countries,v=p.errorMessage,y=p.hasError,w=p.isValid,E=p.isValidVisible,b=p.isInvalidVisible,x=p.label,I=p.hintText,j=p.ref,T=p.onAddressError,V=void 0===T?function(e){console.log(e)}:T,k=p.onAddressSelected,A=p.onChange,C=p.onBlur,K=e(p,["apiKey","countries","errorMessage","hasError","isValid","isValidVisible","isInvalidVisible","label","hintText","ref","onAddressError","onAddressSelected","onChange","onBlur"]),D=r([]),F=D[0],S=D[1],M=r(-1),_=M[0],B=M[1],H=o(null),L=function(){B(-1),S([])},N=s(c(500,function(e){O(e)}),[]),O=function(e,n){if(void 0===n&&(n=""),0===e.length)return S([]);var t="".concat("https://api.addressy.com/Capture/Interactive/Find/v1.1/json3.ws","?Key=").concat(h,"&Text=").concat(e,"&Container=").concat(n);return void 0!==g&&(t="".concat(t,"&Countries=").concat(g.join(","))),fetch(t).then(function(e){if(!e.ok)throw new Error("Something went wrong please try again");return e.json()}).then(function(e){var n;if((null===(n=null==e?void 0:e.Items)||void 0===n?void 0:n.length)>0&&e.Items[0].Error)throw new Error("Something went wrong please try again");return S(e.Items||[]),null}).catch(function(e){return V(e)}),null},U=function(e){fetch("".concat("https://api.addressy.com/Capture/Interactive/Retrieve/v1/json3.ws","?Key=").concat(h,"&Id=").concat(e)).then(function(e){if(!e.ok)throw new Error("Something went wrong please try again");return e.json()}).then(function(e){var n=e.Items[0],t=d(n);return k(t),L(),null}).catch(function(e){return V(e)})},q=function(e){return"Address"===e.Type?U(e.Id):(O(e.Text,e.Id),null)},R=function(e){H.current&&e.target instanceof HTMLElement&&!H.current.contains(e.target)&&L()};return a(function(){return document.addEventListener("mousedown",R),function(){document.removeEventListener("mousedown",R)}}),l(function(){L()},{detectKeys:["Escape","Tab"]},[]),t.createElement(t.Fragment,null,t.createElement(m,n({"aria-activedescendant":F.length?"addressOptions-".concat(_):"","aria-owns":"found_addresses","aria-autocomplete":"both","aria-expanded":F.length?"true":"false",autoComplete:"off",hasError:y||!!v,errorMessage:v,hintText:null!=I?I:"Start typing your address or postcode",isValid:w,isValidVisible:E,isInvalidVisible:b,label:null!=x?x:"Home address",ref:j,required:!0,role:"combobox",type:"search"},K,{onKeyDown:function(e){"Enter"===e.key&&F[_]?(e.preventDefault(),"Address"===F[_].Type&&U(F[_].Id),O(F[_].Text,F[_].Id),B(-1)):"ArrowUp"===e.key?(e.preventDefault(),_<=-1&&B(F.length-1),B(_-1)):"ArrowDown"===e.key?(e.preventDefault(),_+1>=F.length&&B(0),B(_+1)):B(-1)},onChange:function(e){N(e.target.value),A&&A(e)},onBlur:function(e){var n=!!F.length;C&&!n&&C(e)}})),!!F.length&&t.createElement(t.Fragment,null,t.createElement("div",{className:"screen-reader-only",role:"status","aria-live":"assertive"},!!F.length&&"We have found ".concat(F.length," result").concat(1!==F.length?"s":""," matching your search. Use up and down arrow keys to navigate")),t.createElement("div",{className:"address-lookup-list-wrapper",ref:H},t.createElement("ul",{"aria-label":"found addresses",id:"found_addresses",role:"listbox"},F.map(function(e,n){return t.createElement("li",{tabIndex:0,id:"addressOptions-".concat(n),key:e.Id,onClick:function(){q(e)},onKeyDown:function(n){"Enter"===n.key&&q(e)},role:"option","data-hj-suppress":!0},t.createElement(u,{as:"span","data-hj-suppress":!0},e.Text," ",e.Description),"Address"!==e.Type&&t.createElement(t.Fragment,null,t.createElement("div",{className:"screen-reader-only"},"press enter for these addresses"),t.createElement(f,{faIcon:i})))})))))};export{p as AddressLookup
|
|
1
|
+
import{__rest as e,__assign as n}from"../../../node_modules/tslib/tslib.es6.js";import t,{useState as r,useRef as o,useCallback as s,useEffect as a}from"react";import{faChevronRight as i}from"../../../node_modules/@fortawesome/free-solid-svg-icons/index.js";import{useKey as l}from"../../hooks/useKey.js";import{debounce as c}from"../../utils/debounce.js";import{removeCommasFromObjectStringValues as d}from"../../utils/Helper.js";import{Text as u}from"../Text/index.js";import{TextField as m}from"../TextField/index.js";import{IconFa as f}from"../IconFa/index.js";var p=function(p){var h=p.apiKey,g=p.countries,v=p.errorMessage,y=p.hasError,w=p.isValid,E=p.isValidVisible,b=p.isInvalidVisible,x=p.label,I=p.hintText,j=p.ref,T=p.onAddressError,V=void 0===T?function(e){console.log(e)}:T,k=p.onAddressSelected,A=p.onChange,C=p.onBlur,K=e(p,["apiKey","countries","errorMessage","hasError","isValid","isValidVisible","isInvalidVisible","label","hintText","ref","onAddressError","onAddressSelected","onChange","onBlur"]),D=r([]),F=D[0],S=D[1],M=r(-1),_=M[0],B=M[1],H=o(null),L=function(){B(-1),S([])},N=s(c(500,function(e){O(e)}),[]),O=function(e,n){if(void 0===n&&(n=""),0===e.length)return S([]);var t="".concat("https://api.addressy.com/Capture/Interactive/Find/v1.1/json3.ws","?Key=").concat(h,"&Text=").concat(e,"&Container=").concat(n);return void 0!==g&&(t="".concat(t,"&Countries=").concat(g.join(","))),fetch(t).then(function(e){if(!e.ok)throw new Error("Something went wrong please try again");return e.json()}).then(function(e){var n;if((null===(n=null==e?void 0:e.Items)||void 0===n?void 0:n.length)>0&&e.Items[0].Error)throw new Error("Something went wrong please try again");return S(e.Items||[]),null}).catch(function(e){return V(e)}),null},U=function(e){fetch("".concat("https://api.addressy.com/Capture/Interactive/Retrieve/v1/json3.ws","?Key=").concat(h,"&Id=").concat(e)).then(function(e){if(!e.ok)throw new Error("Something went wrong please try again");return e.json()}).then(function(e){var n=e.Items[0],t=d(n);return k(t),L(),null}).catch(function(e){return V(e)})},q=function(e){return"Address"===e.Type?U(e.Id):(O(e.Text,e.Id),null)},R=function(e){H.current&&e.target instanceof HTMLElement&&!H.current.contains(e.target)&&L()};return a(function(){return document.addEventListener("mousedown",R),function(){document.removeEventListener("mousedown",R)}}),l(function(){L()},{detectKeys:["Escape","Tab"]},[]),t.createElement(t.Fragment,null,t.createElement(m,n({"aria-activedescendant":F.length?"addressOptions-".concat(_):"","aria-owns":"found_addresses","aria-autocomplete":"both","aria-expanded":F.length?"true":"false",autoComplete:"off",hasError:y||!!v,errorMessage:v,hintText:null!=I?I:"Start typing your address or postcode",isValid:w,isValidVisible:E,isInvalidVisible:b,label:null!=x?x:"Home address",ref:j,required:!0,role:"combobox",type:"search"},K,{onKeyDown:function(e){"Enter"===e.key&&F[_]?(e.preventDefault(),"Address"===F[_].Type&&U(F[_].Id),O(F[_].Text,F[_].Id),B(-1)):"ArrowUp"===e.key?(e.preventDefault(),_<=-1&&B(F.length-1),B(_-1)):"ArrowDown"===e.key?(e.preventDefault(),_+1>=F.length&&B(0),B(_+1)):B(-1)},onChange:function(e){N(e.target.value),A&&A(e)},onBlur:function(e){var n=!!F.length;C&&!n&&C(e)}})),!!F.length&&t.createElement(t.Fragment,null,t.createElement("div",{className:"screen-reader-only",role:"status","aria-live":"assertive"},!!F.length&&"We have found ".concat(F.length," result").concat(1!==F.length?"s":""," matching your search. Use up and down arrow keys to navigate")),t.createElement("div",{className:"address-lookup-list-wrapper",ref:H},t.createElement("ul",{"aria-label":"found addresses",id:"found_addresses",role:"listbox"},F.map(function(e,n){return t.createElement("li",{tabIndex:0,id:"addressOptions-".concat(n),key:e.Id,onClick:function(){q(e)},onKeyDown:function(n){"Enter"===n.key&&q(e)},role:"option","data-hj-suppress":!0},t.createElement(u,{as:"span","data-hj-suppress":!0},e.Text," ",e.Description),"Address"!==e.Type&&t.createElement(t.Fragment,null,t.createElement("div",{className:"screen-reader-only"},"press enter for these addresses"),t.createElement(f,{faIcon:i})))})))))};export{p as AddressLookup};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|