@cruk/cruk-react-components 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -2
- package/lib/cjs/node_modules/react-focus-lock/dist/es2015/Lock.js +1 -1
- package/lib/cjs/node_modules/react-focus-lock/dist/es2015/Lock.js.map +1 -1
- package/lib/cjs/node_modules/react-focus-lock/dist/es2015/Trap.js +1 -1
- package/lib/cjs/node_modules/react-focus-lock/dist/es2015/Trap.js.map +1 -1
- package/lib/cjs/src/components/AddressLookup/index.js +1 -1
- package/lib/cjs/src/components/Avatar/index.js +1 -1
- package/lib/cjs/src/components/Avatar/styles.js +1 -1
- package/lib/cjs/src/components/Badge/styles.js +1 -1
- package/lib/cjs/src/components/Box/styles.js +1 -1
- package/lib/cjs/src/components/Button/index.js +1 -1
- package/lib/cjs/src/components/Button/styles.js +1 -1
- package/lib/cjs/src/components/Checkbox/index.js +1 -1
- package/lib/cjs/src/components/Checkbox/styles.js +1 -1
- package/lib/cjs/src/components/Collapse/index.js +1 -1
- package/lib/cjs/src/components/Collapse/styles.js +1 -1
- package/lib/cjs/src/components/Divider.js +1 -1
- package/lib/cjs/src/components/ErrorText/index.js +1 -1
- package/lib/cjs/src/components/ErrorText/styles.js +1 -1
- package/lib/cjs/src/components/Flex.js +1 -1
- package/lib/cjs/src/components/Footer/index.js +1 -1
- package/lib/cjs/src/components/GlobalStyle.js +1 -1
- package/lib/cjs/src/components/Header/index.js +1 -1
- package/lib/cjs/src/components/Header/styles.js +1 -1
- package/lib/cjs/src/components/Heading/styles.js +1 -1
- package/lib/cjs/src/components/Icon/index.js +1 -1
- package/lib/cjs/src/components/Icon/styles.js +1 -1
- package/lib/cjs/src/components/Link/styles.js +1 -1
- package/lib/cjs/src/components/Modal/index.js +1 -1
- package/lib/cjs/src/components/Modal/styles.js +1 -1
- package/lib/cjs/src/components/Pagination/index.js +1 -1
- package/lib/cjs/src/components/Pagination/styles.js +1 -1
- package/lib/cjs/src/components/PopOver/index.js +1 -1
- package/lib/cjs/src/components/PopOver/styles.js +1 -1
- package/lib/cjs/src/components/ProgressBar/index.js +1 -1
- package/lib/cjs/src/components/ProgressBar/styles.js +1 -1
- package/lib/cjs/src/components/Radio/index.js +1 -1
- package/lib/cjs/src/components/Radio/styles.js +1 -1
- package/lib/cjs/src/components/RadioConsent/styles.js +1 -1
- package/lib/cjs/src/components/Select/index.js +1 -1
- package/lib/cjs/src/components/Select/styles.js +1 -1
- package/lib/cjs/src/components/Spacing/index.js +1 -1
- package/lib/cjs/src/components/Step/index.js +1 -1
- package/lib/cjs/src/components/Step/styles.js +1 -1
- package/lib/cjs/src/components/Text/styles.js +1 -1
- package/lib/cjs/src/components/TextAreaField/index.js +1 -1
- package/lib/cjs/src/components/TextAreaField/styles.js +1 -1
- package/lib/cjs/src/components/TextField/index.js +1 -1
- package/lib/cjs/src/components/TextField/styles.js +1 -1
- package/lib/cjs/src/components/Totaliser/index.js +1 -1
- package/lib/cjs/src/components/Totaliser/styles.js +1 -1
- package/lib/cjs/src/components/UserBlock/index.js +1 -1
- package/lib/cjs/src/hooks/useLayoutEffectBrowser.js +1 -1
- package/lib/cjs/src/hooks/useScrollPosition.js +1 -1
- package/lib/cjs/src/themes/cruk.js +1 -1
- package/lib/cjs/src/themes/su2c.js +1 -1
- package/lib/cjs/src/utils/Helper.js +1 -1
- package/lib/components/AddressLookup/index.d.ts +2 -2
- package/lib/components/Avatar/styles.d.ts +3 -1
- package/lib/components/Badge/index.d.ts +1 -1
- package/lib/components/Badge/styles.d.ts +2 -2
- package/lib/components/Box/index.d.ts +2 -2
- package/lib/components/Box/styles.d.ts +5 -2
- package/lib/components/Button/Button.stories.d.ts +1 -1
- package/lib/components/Button/index.d.ts +1 -1
- package/lib/components/Button/styles.d.ts +2 -2
- package/lib/components/Checkbox/styles.d.ts +2 -0
- package/lib/components/Collapse/index.d.ts +1 -1
- package/lib/components/Collapse/styles.d.ts +3 -3
- package/lib/components/DateField/index.d.ts +1 -1
- package/lib/components/ErrorText/index.d.ts +4 -4
- package/lib/components/ErrorText/styles.d.ts +2 -1
- package/lib/components/Flex.d.ts +2 -4
- package/lib/components/Header/index.d.ts +1 -1
- package/lib/components/Heading/index.d.ts +2 -2
- package/lib/components/Heading/styles.d.ts +2 -2
- package/lib/components/Icon/styles.d.ts +1 -0
- package/lib/components/LabelWrapper/styles.d.ts +1 -1
- package/lib/components/LegendWrapper/styles.d.ts +3 -3
- package/lib/components/Link/index.d.ts +2 -2
- package/lib/components/Link/styles.d.ts +6 -6
- package/lib/components/Loader/index.d.ts +1 -1
- package/lib/components/Modal/index.d.ts +2 -2
- package/lib/components/Pagination/index.d.ts +3 -3
- package/lib/components/PopOver/index.d.ts +1 -1
- package/lib/components/PopOver/styles.d.ts +1 -1
- package/lib/components/ProgressBar/styles.d.ts +2 -2
- package/lib/components/Radio/styles.d.ts +10 -3
- package/lib/components/RadioConsent/styles.d.ts +7 -4
- package/lib/components/Select/styles.d.ts +4 -3
- package/lib/components/Spacing/index.d.ts +1 -1
- package/lib/components/Text/index.d.ts +2 -2
- package/lib/components/Text/styles.d.ts +4 -4
- package/lib/components/TextAreaField/index.d.ts +1 -1
- package/lib/components/TextAreaField/styles.d.ts +4 -3
- package/lib/components/TextField/styles.d.ts +1 -1
- package/lib/components/Totaliser/styles.d.ts +4 -7
- package/lib/es/node_modules/react-focus-lock/dist/es2015/Lock.js +1 -1
- package/lib/es/node_modules/react-focus-lock/dist/es2015/Lock.js.map +1 -1
- package/lib/es/node_modules/react-focus-lock/dist/es2015/Trap.js +1 -1
- package/lib/es/node_modules/react-focus-lock/dist/es2015/Trap.js.map +1 -1
- package/lib/es/src/components/AddressLookup/index.js +1 -1
- package/lib/es/src/components/Avatar/index.js +1 -1
- package/lib/es/src/components/Avatar/styles.js +1 -1
- package/lib/es/src/components/Badge/styles.js +1 -1
- package/lib/es/src/components/Box/styles.js +1 -1
- package/lib/es/src/components/Button/index.js +1 -1
- package/lib/es/src/components/Button/styles.js +1 -1
- package/lib/es/src/components/Checkbox/index.js +1 -1
- package/lib/es/src/components/Checkbox/styles.js +1 -1
- package/lib/es/src/components/Collapse/index.js +1 -1
- package/lib/es/src/components/Collapse/styles.js +1 -1
- package/lib/es/src/components/Divider.js +1 -1
- package/lib/es/src/components/ErrorText/index.js +1 -1
- package/lib/es/src/components/ErrorText/styles.js +1 -1
- package/lib/es/src/components/Flex.js +1 -1
- package/lib/es/src/components/Footer/index.js +1 -1
- package/lib/es/src/components/GlobalStyle.js +1 -1
- package/lib/es/src/components/Header/index.js +1 -1
- package/lib/es/src/components/Header/styles.js +1 -1
- package/lib/es/src/components/Heading/styles.js +1 -1
- package/lib/es/src/components/Icon/index.js +1 -1
- package/lib/es/src/components/Icon/styles.js +1 -1
- package/lib/es/src/components/Link/styles.js +1 -1
- package/lib/es/src/components/Modal/index.js +1 -1
- package/lib/es/src/components/Modal/styles.js +1 -1
- package/lib/es/src/components/Pagination/index.js +1 -1
- package/lib/es/src/components/Pagination/styles.js +1 -1
- package/lib/es/src/components/PopOver/index.js +1 -1
- package/lib/es/src/components/PopOver/styles.js +1 -1
- package/lib/es/src/components/ProgressBar/index.js +1 -1
- package/lib/es/src/components/ProgressBar/styles.js +1 -1
- package/lib/es/src/components/Radio/index.js +1 -1
- package/lib/es/src/components/Radio/styles.js +1 -1
- package/lib/es/src/components/RadioConsent/styles.js +1 -1
- package/lib/es/src/components/Select/index.js +1 -1
- package/lib/es/src/components/Select/styles.js +1 -1
- package/lib/es/src/components/Spacing/index.js +1 -1
- package/lib/es/src/components/Step/index.js +1 -1
- package/lib/es/src/components/Step/styles.js +1 -1
- package/lib/es/src/components/Text/styles.js +1 -1
- package/lib/es/src/components/TextAreaField/index.js +1 -1
- package/lib/es/src/components/TextAreaField/styles.js +1 -1
- package/lib/es/src/components/TextField/index.js +1 -1
- package/lib/es/src/components/TextField/styles.js +1 -1
- package/lib/es/src/components/Totaliser/index.js +1 -1
- package/lib/es/src/components/Totaliser/styles.js +1 -1
- package/lib/es/src/components/UserBlock/index.js +1 -1
- package/lib/es/src/hooks/useLayoutEffectBrowser.js +1 -1
- package/lib/es/src/hooks/useScrollPosition.js +1 -1
- package/lib/es/src/themes/cruk.js +1 -1
- package/lib/es/src/themes/su2c.js +1 -1
- package/lib/es/src/utils/Helper.js +1 -1
- package/lib/hooks/useKey.d.ts +2 -2
- package/lib/hooks/useLayoutEffectBrowser.d.ts +2 -1
- package/lib/hooks/useScrollPosition.d.ts +12 -1
- package/lib/types.d.ts +6 -2
- package/package.json +34 -20
- package/lib/stories/Button.d.ts +0 -28
- package/lib/stories/Header.d.ts +0 -9
- package/lib/stories/Header.stories.d.ts +0 -6
- package/lib/stories/Page.d.ts +0 -9
- package/lib/stories/Page.stories.d.ts +0 -6
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ThemeType } from "
|
|
3
|
-
|
|
4
|
-
numberOfAttributes: number;
|
|
2
|
+
import { ThemeType } from "../../types";
|
|
3
|
+
declare type ThemeProp = {
|
|
5
4
|
theme: ThemeType;
|
|
6
|
-
}
|
|
5
|
+
};
|
|
6
|
+
export declare const StyledRadio: import("styled-components").StyledComponent<import("react").FC<import("../Radio").RadioProps>, any, {
|
|
7
|
+
numberOfAttributes: number;
|
|
8
|
+
} & ThemeProp, never>;
|
|
7
9
|
export declare const StyledLegend: import("styled-components").StyledComponent<"legend", any, {}, never>;
|
|
8
10
|
export declare const StyledFieldSet: import("styled-components").StyledComponent<"fieldset", any, {}, never>;
|
|
11
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { ThemeType } from "
|
|
1
|
+
import { ThemeType } from "../../types";
|
|
2
2
|
declare type StyledSelectProps = {
|
|
3
3
|
hasError: boolean;
|
|
4
4
|
errorMessage?: string;
|
|
5
5
|
theme: ThemeType;
|
|
6
6
|
};
|
|
7
|
-
|
|
8
|
-
export
|
|
7
|
+
declare const StyledSelect: import("styled-components").StyledComponent<"select", any, StyledSelectProps, never>;
|
|
8
|
+
export default StyledSelect;
|
|
9
|
+
export { StyledSelect };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FunctionComponent, HTMLAttributes, Ref } from "react";
|
|
2
|
-
import { SpacingProps } from "
|
|
3
|
-
import { WordBreakType, FontSizeType, ColorKeyType } from "
|
|
2
|
+
import { SpacingProps } from "../Spacing";
|
|
3
|
+
import { WordBreakType, FontSizeType, ColorKeyType } from "../../types";
|
|
4
4
|
/**
|
|
5
5
|
* Text is to be used as the main paragraph component (or span using as="span"). Using the Text component is preferred to simply adding text to a div and styling that div, this will guarantee we are always using the correct font and default text colour.
|
|
6
6
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SpacingProps } from "
|
|
2
|
-
import { WordBreakType, FontSizeType, ThemeType } from "
|
|
1
|
+
import { SpacingProps } from "../Spacing";
|
|
2
|
+
import { WordBreakType, FontSizeType, ThemeType, ColorKeyType } from "../../types";
|
|
3
3
|
export declare type TextStyledProps = SpacingProps & {
|
|
4
|
-
textColor?:
|
|
4
|
+
textColor?: ColorKeyType;
|
|
5
5
|
textAlign?: "left" | "right" | "center" | "justify";
|
|
6
6
|
textSize?: FontSizeType;
|
|
7
7
|
textWeight?: number;
|
|
@@ -10,7 +10,7 @@ export declare type TextStyledProps = SpacingProps & {
|
|
|
10
10
|
theme: ThemeType;
|
|
11
11
|
};
|
|
12
12
|
export declare const TextStyled: import("styled-components").StyledComponent<"p", any, SpacingProps & {
|
|
13
|
-
textColor?:
|
|
13
|
+
textColor?: keyof import("../../types").ColorsType | undefined;
|
|
14
14
|
textAlign?: "left" | "right" | "center" | "justify" | undefined;
|
|
15
15
|
textSize?: FontSizeType | undefined;
|
|
16
16
|
textWeight?: number | undefined;
|
|
@@ -10,7 +10,7 @@ export declare type TextAreaFieldProps = TextareaHTMLAttributes<HTMLTextAreaElem
|
|
|
10
10
|
label: string;
|
|
11
11
|
/** resize behaviour using the resize button on the bottom right of the component */
|
|
12
12
|
resize?: "both" | "vertical" | "horizontal" | "none";
|
|
13
|
-
/** number of visible lines of text before scroll is required this affect the height of the input field*/
|
|
13
|
+
/** number of visible lines of text before scroll is required this affect the height of the input field */
|
|
14
14
|
lineCount?: number;
|
|
15
15
|
/** react reference to the DOM element sometime used to scroll to or set focus after an error */
|
|
16
16
|
ref?: Ref<HTMLTextAreaElement>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { ThemeType } from "
|
|
1
|
+
import { ThemeType } from "../../types";
|
|
2
2
|
declare type StyledTextareaProps = {
|
|
3
3
|
hasError: boolean;
|
|
4
4
|
resize: "both" | "vertical" | "horizontal" | "none";
|
|
5
5
|
lineCount: number;
|
|
6
6
|
theme: ThemeType;
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
export
|
|
8
|
+
declare const StyledTextArea: import("styled-components").StyledComponent<"textarea", any, StyledTextareaProps, never>;
|
|
9
|
+
export default StyledTextArea;
|
|
10
|
+
export { StyledTextArea };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ThemeType } from "src/types";
|
|
3
2
|
export declare const BubbleWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
4
|
-
export declare const ProgressBarWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
3
|
+
export declare const ProgressBarWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
4
|
+
isCompact?: boolean | undefined;
|
|
5
|
+
}, never>;
|
|
5
6
|
export declare const Total: import("styled-components").StyledComponent<"p", any, {}, never>;
|
|
6
7
|
export declare const BubbleText: import("styled-components").StyledComponent<"p", any, {}, never>;
|
|
7
8
|
export declare const GiftAid: import("styled-components").StyledComponent<"p", any, {}, never>;
|
|
@@ -11,9 +12,5 @@ declare type TotaliserWrapperProps = {
|
|
|
11
12
|
};
|
|
12
13
|
export declare const TotaliserWrapper: import("styled-components").StyledComponent<"div", any, TotaliserWrapperProps, never>;
|
|
13
14
|
export declare const CompactWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
14
|
-
declare
|
|
15
|
-
theme: ThemeType;
|
|
16
|
-
isCompact: boolean;
|
|
17
|
-
};
|
|
18
|
-
export declare const StyledProgressBar: import("styled-components").StyledComponent<import("react").FC<import("src/components/ProgressBar").ProgressBarProps>, any, StyledProgressBarProps, never>;
|
|
15
|
+
export declare const StyledProgressBar: import("styled-components").StyledComponent<import("react").FC<import("../ProgressBar").ProgressBarProps>, any, {}, never>;
|
|
19
16
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"../../../@babel/runtime/helpers/esm/extends.js";import*as o from"react";import{node as
|
|
1
|
+
import e from"../../../@babel/runtime/helpers/esm/extends.js";import*as o from"react";import{useEffect as t}from"react";import{node as r,bool as s,oneOfType as a,object as n,string as c,func as u,arrayOf as i,any as d}from"prop-types";import{FOCUS_DISABLED as l,FOCUS_GROUP as f}from"../../../focus-lock/dist/es2015/constants.js";import{hiddenGuard as m}from"./FocusGuard.js";import{mediumFocus as v,mediumBlur as p,mediumSidecar as F}from"./medium.js";import{useMergeRefs as b}from"../../../use-callback-ref/dist/es2015/useMergeRef.js";var k=[],h=o.forwardRef((function(r,s){var a,n=o.useState(),c=n[0],u=n[1],i=o.useRef(),d=o.useRef(!1),h=o.useRef(null),E=r.children,g=r.disabled,w=r.noFocusGuards,y=r.persistentFocus,x=r.crossFrame,C=r.autoFocus,N=r.allowTextSelection,R=r.group,j=r.className,D=r.whiteList,L=r.shards,S=void 0===L?k:L,P=r.as,T=void 0===P?"div":P,A=r.lockProps,G=void 0===A?{}:A,I=r.sideCar,M=r.returnFocus,B=r.onActivation,O=r.onDeactivation,V=o.useState({})[0],_=o.useCallback((function(){h.current=h.current||document&&document.activeElement,i.current&&B&&B(i.current),d.current=!0}),[B]),q=o.useCallback((function(){d.current=!1,O&&O(i.current)}),[O]);t((function(){g||(h.current=null)}),[]);var z=o.useCallback((function(e){var o=h.current;if(o&&o.focus){var t="function"==typeof M?M(o):M;if(Boolean(t)){var r="object"==typeof t?t:void 0;h.current=null,e?Promise.resolve().then((function(){return o.focus(r)})):o.focus(r)}}}),[M]),H=o.useCallback((function(e){d.current&&v.useMedium(e)}),[]),J=p.useMedium,K=o.useCallback((function(e){i.current!==e&&(i.current=e,u(e))}),[]);"production"!==process.env.NODE_ENV&&(void 0!==N&&console.warn("React-Focus-Lock: allowTextSelection is deprecated and enabled by default"),o.useEffect((function(){i.current||console.error("FocusLock: could not obtain ref to internal node")}),[]));var Q=e(((a={})[l]=g&&"disabled",a[f]=R,a),G),U=!0!==w,W=U&&"tail"!==w,X=b([s,K]);return o.createElement(o.Fragment,null,U&&[o.createElement("div",{key:"guard-first","data-focus-guard":!0,tabIndex:g?-1:0,style:m}),o.createElement("div",{key:"guard-nearest","data-focus-guard":!0,tabIndex:g?-1:1,style:m})],!g&&o.createElement(I,{id:V,sideCar:F,observed:c,disabled:g,persistentFocus:y,crossFrame:x,autoFocus:C,whiteList:D,shards:S,onActivation:_,onDeactivation:q,returnFocus:z}),o.createElement(T,e({ref:X},Q,{className:j,onBlur:J,onFocus:H}),E),W&&o.createElement("div",{"data-focus-guard":!0,tabIndex:g?-1:0,style:m}))}));h.propTypes="production"!==process.env.NODE_ENV?{children:r,disabled:s,returnFocus:a([s,n]),noFocusGuards:s,allowTextSelection:s,autoFocus:s,persistentFocus:s,crossFrame:s,group:c,className:c,whiteList:u,shards:i(d),as:a([c,u,n]),lockProps:n,onActivation:u,onDeactivation:u,sideCar:d.isRequired}:{},h.defaultProps={children:void 0,disabled:!1,returnFocus:!1,noFocusGuards:!1,autoFocus:!0,persistentFocus:!1,crossFrame:!0,allowTextSelection:void 0,group:void 0,className:void 0,whiteList:void 0,shards:void 0,as:"div",lockProps:{},onActivation:void 0,onDeactivation:void 0};var E=h;export{E as default};
|
|
2
2
|
//# sourceMappingURL=Lock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Lock.js","sources":["../../../../../../node_modules/react-focus-lock/dist/es2015/Lock.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { node, bool, string, any, arrayOf, oneOfType, object, func } from 'prop-types';\nimport * as constants from 'focus-lock/constants';\nimport { useMergeRefs } from 'use-callback-ref';\nimport { hiddenGuard } from './FocusGuard';\nimport { mediumFocus, mediumBlur, mediumSidecar } from './medium';\nvar emptyArray = [];\nvar FocusLock = /*#__PURE__*/React.forwardRef(function FocusLockUI(props, parentRef) {\n var _extends2;\n\n var _React$useState = React.useState(),\n realObserved = _React$useState[0],\n setObserved = _React$useState[1];\n\n var observed = React.useRef();\n var isActive = React.useRef(false);\n var originalFocusedElement = React.useRef(null);\n var children = props.children,\n disabled = props.disabled,\n noFocusGuards = props.noFocusGuards,\n persistentFocus = props.persistentFocus,\n crossFrame = props.crossFrame,\n autoFocus = props.autoFocus,\n allowTextSelection = props.allowTextSelection,\n group = props.group,\n className = props.className,\n whiteList = props.whiteList,\n _props$shards = props.shards,\n shards = _props$shards === void 0 ? emptyArray : _props$shards,\n _props$as = props.as,\n Container = _props$as === void 0 ? 'div' : _props$as,\n _props$lockProps = props.lockProps,\n containerProps = _props$lockProps === void 0 ? {} : _props$lockProps,\n SideCar = props.sideCar,\n shouldReturnFocus = props.returnFocus,\n onActivationCallback = props.onActivation,\n onDeactivationCallback = props.onDeactivation;\n\n var _React$useState2 = React.useState({}),\n id = _React$useState2[0]; // SIDE EFFECT CALLBACKS\n\n\n var onActivation = React.useCallback(function () {\n originalFocusedElement.current = originalFocusedElement.current || document && document.activeElement;\n\n if (observed.current && onActivationCallback) {\n onActivationCallback(observed.current);\n }\n\n isActive.current = true;\n }, [onActivationCallback]);\n var onDeactivation = React.useCallback(function () {\n isActive.current = false;\n\n if (onDeactivationCallback) {\n onDeactivationCallback(observed.current);\n }\n }, [onDeactivationCallback]);\n var returnFocus = React.useCallback(function (allowDefer) {\n var current = originalFocusedElement.current;\n\n if (Boolean(shouldReturnFocus) && current && current.focus) {\n var focusOptions = typeof shouldReturnFocus === 'object' ? shouldReturnFocus : undefined;\n originalFocusedElement.current = null;\n\n if (allowDefer) {\n // React might return focus after update\n // it's safer to defer the action\n Promise.resolve().then(function () {\n return current.focus(focusOptions);\n });\n } else {\n current.focus(focusOptions);\n }\n }\n }, [shouldReturnFocus]); // MEDIUM CALLBACKS\n\n var onFocus = React.useCallback(function (event) {\n if (isActive.current) {\n mediumFocus.useMedium(event);\n }\n }, []);\n var onBlur = mediumBlur.useMedium; // REF PROPAGATION\n // not using real refs due to race conditions\n\n var setObserveNode = React.useCallback(function (newObserved) {\n if (observed.current !== newObserved) {\n observed.current = newObserved;\n setObserved(newObserved);\n }\n }, []);\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof allowTextSelection !== 'undefined') {\n // eslint-disable-next-line no-console\n console.warn('React-Focus-Lock: allowTextSelection is deprecated and enabled by default');\n }\n\n React.useEffect(function () {\n if (!observed.current) {\n // eslint-disable-next-line no-console\n console.error('FocusLock: could not obtain ref to internal node');\n }\n }, []);\n }\n\n var lockProps = _extends((_extends2 = {}, _extends2[constants.FOCUS_DISABLED] = disabled && 'disabled', _extends2[constants.FOCUS_GROUP] = group, _extends2), containerProps);\n\n var hasLeadingGuards = noFocusGuards !== true;\n var hasTailingGuards = hasLeadingGuards && noFocusGuards !== 'tail';\n var mergedRef = useMergeRefs([parentRef, setObserveNode]);\n return /*#__PURE__*/React.createElement(React.Fragment, null, hasLeadingGuards && [/*#__PURE__*/React.createElement(\"div\", {\n key: \"guard-first\",\n \"data-focus-guard\": true,\n tabIndex: disabled ? -1 : 0,\n style: hiddenGuard\n }),\n /*#__PURE__*/\n // nearest focus guard\n React.createElement(\"div\", {\n key: \"guard-nearest\",\n \"data-focus-guard\": true,\n tabIndex: disabled ? -1 : 1,\n style: hiddenGuard\n }) // first tabbed element guard\n ], !disabled && /*#__PURE__*/React.createElement(SideCar, {\n id: id,\n sideCar: mediumSidecar,\n observed: realObserved,\n disabled: disabled,\n persistentFocus: persistentFocus,\n crossFrame: crossFrame,\n autoFocus: autoFocus,\n whiteList: whiteList,\n shards: shards,\n onActivation: onActivation,\n onDeactivation: onDeactivation,\n returnFocus: returnFocus\n }), /*#__PURE__*/React.createElement(Container, _extends({\n ref: mergedRef\n }, lockProps, {\n className: className,\n onBlur: onBlur,\n onFocus: onFocus\n }), children), hasTailingGuards && /*#__PURE__*/React.createElement(\"div\", {\n \"data-focus-guard\": true,\n tabIndex: disabled ? -1 : 0,\n style: hiddenGuard\n }));\n});\nFocusLock.propTypes = process.env.NODE_ENV !== \"production\" ? {\n children: node,\n disabled: bool,\n returnFocus: oneOfType([bool, object]),\n noFocusGuards: bool,\n allowTextSelection: bool,\n autoFocus: bool,\n persistentFocus: bool,\n crossFrame: bool,\n group: string,\n className: string,\n whiteList: func,\n shards: arrayOf(any),\n as: oneOfType([string, func, object]),\n lockProps: object,\n onActivation: func,\n onDeactivation: func,\n sideCar: any.isRequired\n} : {};\nFocusLock.defaultProps = {\n children: undefined,\n disabled: false,\n returnFocus: false,\n noFocusGuards: false,\n autoFocus: true,\n persistentFocus: false,\n crossFrame: true,\n allowTextSelection: undefined,\n group: undefined,\n className: undefined,\n whiteList: undefined,\n shards: undefined,\n as: 'div',\n lockProps: {},\n onActivation: undefined,\n onDeactivation: undefined\n};\nexport default FocusLock;"],"names":["emptyArray","FocusLock","React","forwardRef","props","parentRef","_extends2","_React$useState","useState","realObserved","setObserved","observed","useRef","isActive","originalFocusedElement","children","disabled","noFocusGuards","persistentFocus","crossFrame","autoFocus","allowTextSelection","group","className","whiteList","_props$shards","shards","_props$as","as","Container","_props$lockProps","lockProps","containerProps","SideCar","sideCar","shouldReturnFocus","returnFocus","onActivationCallback","onActivation","onDeactivationCallback","onDeactivation","id","useCallback","current","document","activeElement","allowDefer","Boolean","focus","focusOptions","undefined","Promise","resolve","then","onFocus","event","mediumFocus","useMedium","onBlur","mediumBlur","setObserveNode","newObserved","process","env","NODE_ENV","console","warn","useEffect","error","_extends","constants.FOCUS_DISABLED","constants.FOCUS_GROUP","hasLeadingGuards","hasTailingGuards","mergedRef","useMergeRefs","createElement","Fragment","key","tabIndex","style","hiddenGuard","mediumSidecar","ref","propTypes","node","bool","oneOfType","object","string","func","arrayOf","any","isRequired","defaultProps"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Lock.js","sources":["../../../../../../node_modules/react-focus-lock/dist/es2015/Lock.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { node, bool, string, any, arrayOf, oneOfType, object, func } from 'prop-types';\nimport * as constants from 'focus-lock/constants';\nimport { useMergeRefs } from 'use-callback-ref';\nimport { hiddenGuard } from './FocusGuard';\nimport { mediumFocus, mediumBlur, mediumSidecar } from './medium';\nimport { useEffect } from \"react\";\nvar emptyArray = [];\nvar FocusLock = /*#__PURE__*/React.forwardRef(function FocusLockUI(props, parentRef) {\n var _extends2;\n\n var _React$useState = React.useState(),\n realObserved = _React$useState[0],\n setObserved = _React$useState[1];\n\n var observed = React.useRef();\n var isActive = React.useRef(false);\n var originalFocusedElement = React.useRef(null);\n var children = props.children,\n disabled = props.disabled,\n noFocusGuards = props.noFocusGuards,\n persistentFocus = props.persistentFocus,\n crossFrame = props.crossFrame,\n autoFocus = props.autoFocus,\n allowTextSelection = props.allowTextSelection,\n group = props.group,\n className = props.className,\n whiteList = props.whiteList,\n _props$shards = props.shards,\n shards = _props$shards === void 0 ? emptyArray : _props$shards,\n _props$as = props.as,\n Container = _props$as === void 0 ? 'div' : _props$as,\n _props$lockProps = props.lockProps,\n containerProps = _props$lockProps === void 0 ? {} : _props$lockProps,\n SideCar = props.sideCar,\n shouldReturnFocus = props.returnFocus,\n onActivationCallback = props.onActivation,\n onDeactivationCallback = props.onDeactivation;\n\n var _React$useState2 = React.useState({}),\n id = _React$useState2[0]; // SIDE EFFECT CALLBACKS\n\n\n var onActivation = React.useCallback(function () {\n originalFocusedElement.current = originalFocusedElement.current || document && document.activeElement;\n\n if (observed.current && onActivationCallback) {\n onActivationCallback(observed.current);\n }\n\n isActive.current = true;\n }, [onActivationCallback]);\n var onDeactivation = React.useCallback(function () {\n isActive.current = false;\n\n if (onDeactivationCallback) {\n onDeactivationCallback(observed.current);\n }\n }, [onDeactivationCallback]);\n useEffect(function () {\n if (!disabled) {\n // cleanup return focus on trap deactivation\n // sideEffect/returnFocus should happen by this time\n originalFocusedElement.current = null;\n }\n }, []);\n var returnFocus = React.useCallback(function (allowDefer) {\n var returnFocusTo = originalFocusedElement.current;\n\n if (returnFocusTo && returnFocusTo.focus) {\n var howToReturnFocus = typeof shouldReturnFocus === 'function' ? shouldReturnFocus(returnFocusTo) : shouldReturnFocus;\n\n if (Boolean(howToReturnFocus)) {\n var focusOptions = typeof howToReturnFocus === 'object' ? howToReturnFocus : undefined;\n originalFocusedElement.current = null;\n\n if (allowDefer) {\n // React might return focus after update\n // it's safer to defer the action\n Promise.resolve().then(function () {\n return returnFocusTo.focus(focusOptions);\n });\n } else {\n returnFocusTo.focus(focusOptions);\n }\n }\n }\n }, [shouldReturnFocus]); // MEDIUM CALLBACKS\n\n var onFocus = React.useCallback(function (event) {\n if (isActive.current) {\n mediumFocus.useMedium(event);\n }\n }, []);\n var onBlur = mediumBlur.useMedium; // REF PROPAGATION\n // not using real refs due to race conditions\n\n var setObserveNode = React.useCallback(function (newObserved) {\n if (observed.current !== newObserved) {\n observed.current = newObserved;\n setObserved(newObserved);\n }\n }, []);\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof allowTextSelection !== 'undefined') {\n // eslint-disable-next-line no-console\n console.warn('React-Focus-Lock: allowTextSelection is deprecated and enabled by default');\n }\n\n React.useEffect(function () {\n if (!observed.current) {\n // eslint-disable-next-line no-console\n console.error('FocusLock: could not obtain ref to internal node');\n }\n }, []);\n }\n\n var lockProps = _extends((_extends2 = {}, _extends2[constants.FOCUS_DISABLED] = disabled && 'disabled', _extends2[constants.FOCUS_GROUP] = group, _extends2), containerProps);\n\n var hasLeadingGuards = noFocusGuards !== true;\n var hasTailingGuards = hasLeadingGuards && noFocusGuards !== 'tail';\n var mergedRef = useMergeRefs([parentRef, setObserveNode]);\n return /*#__PURE__*/React.createElement(React.Fragment, null, hasLeadingGuards && [/*#__PURE__*/React.createElement(\"div\", {\n key: \"guard-first\",\n \"data-focus-guard\": true,\n tabIndex: disabled ? -1 : 0,\n style: hiddenGuard\n }),\n /*#__PURE__*/\n // nearest focus guard\n React.createElement(\"div\", {\n key: \"guard-nearest\",\n \"data-focus-guard\": true,\n tabIndex: disabled ? -1 : 1,\n style: hiddenGuard\n }) // first tabbed element guard\n ], !disabled && /*#__PURE__*/React.createElement(SideCar, {\n id: id,\n sideCar: mediumSidecar,\n observed: realObserved,\n disabled: disabled,\n persistentFocus: persistentFocus,\n crossFrame: crossFrame,\n autoFocus: autoFocus,\n whiteList: whiteList,\n shards: shards,\n onActivation: onActivation,\n onDeactivation: onDeactivation,\n returnFocus: returnFocus\n }), /*#__PURE__*/React.createElement(Container, _extends({\n ref: mergedRef\n }, lockProps, {\n className: className,\n onBlur: onBlur,\n onFocus: onFocus\n }), children), hasTailingGuards && /*#__PURE__*/React.createElement(\"div\", {\n \"data-focus-guard\": true,\n tabIndex: disabled ? -1 : 0,\n style: hiddenGuard\n }));\n});\nFocusLock.propTypes = process.env.NODE_ENV !== \"production\" ? {\n children: node,\n disabled: bool,\n returnFocus: oneOfType([bool, object]),\n noFocusGuards: bool,\n allowTextSelection: bool,\n autoFocus: bool,\n persistentFocus: bool,\n crossFrame: bool,\n group: string,\n className: string,\n whiteList: func,\n shards: arrayOf(any),\n as: oneOfType([string, func, object]),\n lockProps: object,\n onActivation: func,\n onDeactivation: func,\n sideCar: any.isRequired\n} : {};\nFocusLock.defaultProps = {\n children: undefined,\n disabled: false,\n returnFocus: false,\n noFocusGuards: false,\n autoFocus: true,\n persistentFocus: false,\n crossFrame: true,\n allowTextSelection: undefined,\n group: undefined,\n className: undefined,\n whiteList: undefined,\n shards: undefined,\n as: 'div',\n lockProps: {},\n onActivation: undefined,\n onDeactivation: undefined\n};\nexport default FocusLock;"],"names":["emptyArray","FocusLock","React","forwardRef","props","parentRef","_extends2","_React$useState","useState","realObserved","setObserved","observed","useRef","isActive","originalFocusedElement","children","disabled","noFocusGuards","persistentFocus","crossFrame","autoFocus","allowTextSelection","group","className","whiteList","_props$shards","shards","_props$as","as","Container","_props$lockProps","lockProps","containerProps","SideCar","sideCar","shouldReturnFocus","returnFocus","onActivationCallback","onActivation","onDeactivationCallback","onDeactivation","id","useCallback","current","document","activeElement","useEffect","allowDefer","returnFocusTo","focus","howToReturnFocus","Boolean","focusOptions","undefined","Promise","resolve","then","onFocus","event","mediumFocus","useMedium","onBlur","mediumBlur","setObserveNode","newObserved","process","env","NODE_ENV","console","warn","error","_extends","constants.FOCUS_DISABLED","constants.FOCUS_GROUP","hasLeadingGuards","hasTailingGuards","mergedRef","useMergeRefs","createElement","Fragment","key","tabIndex","style","hiddenGuard","mediumSidecar","ref","propTypes","node","bool","oneOfType","object","string","func","arrayOf","any","isRequired","defaultProps"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import"react";import e from"prop-types";import n from"../../../react-clientside-effect/lib/index.es.js";import t from"../../../focus-lock/dist/es2015/index.js";import{deferAction as o}from"./util.js";import{mediumFocus as r,mediumBlur as u,mediumEffect as i}from"./medium.js";import{focusInside as c}from"../../../focus-lock/dist/es2015/focusInside.js";import{focusIsHidden as s}from"../../../focus-lock/dist/es2015/focusIsHidden.js";import{getFocusabledIn as d}from"../../../focus-lock/dist/es2015/focusables.js";var a=function(){return document&&document.activeElement===document.body||s()},f=null,m=null,l=null,v=!1,p=function(){return!0};function b(e,n,t,o){var r=null,u=e;do{var i=o[u];if(i.guard)i.node.dataset.focusAutoGuard&&(r=i);else{if(!i.lockItem)break;if(u!==e)return;r=null}}while((u+=t)!==n);r&&(r.node.tabIndex=0)}var E=function(e){return e&&"current"in e?e.current:e},g=function(){var e,n=!1;if(f){var o=f,r=o.observed,u=o.persistentFocus,i=o.autoFocus,s=o.shards,g=o.crossFrame,h=r||l&&l.portaledElement,j=document&&document.activeElement;if(h){var w=[h].concat(s.map(E).filter(Boolean));if(j&&!function(e){return(f.whiteList||p)(e)}(j)||(u||(g?Boolean(v):"meanwhile"===v)||!a()||!m&&i)&&(!h||c(w)||(e=j,l&&l.portaledElement===e)||(document&&!m&&j&&!i?(j.blur&&j.blur(),document.body.focus()):(n=t(w,m),l={})),v=!1,m=document&&document.activeElement),document){var I=document&&document.activeElement,L=d(w),k=L.map((function(e){return e.node})).indexOf(I);k>-1&&(L.filter((function(e){var n=e.guard,t=e.node;return n&&t.dataset.focusAutoGuard})).forEach((function(e){return e.node.removeAttribute("tabIndex")})),b(k,L.length,1,L),b(k,-1,-1,L))}}}return n},h=function(e){g()&&e&&(e.stopPropagation(),e.preventDefault())},j=function(){return o(g)};"production"===process.env.NODE_ENV||e.node.isRequired;var w=function(){v="just",setTimeout((function(){v="meanwhile"}),0)};r.assignSyncMedium((function(e){var n=e.target,t=e.currentTarget;t.contains(n)||(l={observerNode:t,portaledElement:n})})),u.assignMedium(j),i.assignMedium((function(e){return e({moveFocusInside:t,focusInside:c})}));var I=n((function(e){return e.filter((function(e){return!e.disabled}))}),(function(e){var n=e.slice(-1)[0];n&&!f&&(document.addEventListener("focusin",h
|
|
1
|
+
import"react";import e from"prop-types";import n from"../../../react-clientside-effect/lib/index.es.js";import t from"../../../focus-lock/dist/es2015/index.js";import{deferAction as o}from"./util.js";import{mediumFocus as r,mediumBlur as u,mediumEffect as i}from"./medium.js";import{focusInside as c}from"../../../focus-lock/dist/es2015/focusInside.js";import{focusIsHidden as s}from"../../../focus-lock/dist/es2015/focusIsHidden.js";import{getFocusabledIn as d}from"../../../focus-lock/dist/es2015/focusables.js";var a=function(){return document&&document.activeElement===document.body||s()},f=null,m=null,l=null,v=!1,p=function(){return!0};function b(e,n,t,o){var r=null,u=e;do{var i=o[u];if(i.guard)i.node.dataset.focusAutoGuard&&(r=i);else{if(!i.lockItem)break;if(u!==e)return;r=null}}while((u+=t)!==n);r&&(r.node.tabIndex=0)}var E=function(e){return e&&"current"in e?e.current:e},g=function(){var e,n=!1;if(f){var o=f,r=o.observed,u=o.persistentFocus,i=o.autoFocus,s=o.shards,g=o.crossFrame,h=r||l&&l.portaledElement,j=document&&document.activeElement;if(h){var w=[h].concat(s.map(E).filter(Boolean));if(j&&!function(e){return(f.whiteList||p)(e)}(j)||(u||(g?Boolean(v):"meanwhile"===v)||!a()||!m&&i)&&(!h||c(w)||(e=j,l&&l.portaledElement===e)||(document&&!m&&j&&!i?(j.blur&&j.blur(),document.body.focus()):(n=t(w,m),l={})),v=!1,m=document&&document.activeElement),document){var I=document&&document.activeElement,L=d(w),k=L.map((function(e){return e.node})).indexOf(I);k>-1&&(L.filter((function(e){var n=e.guard,t=e.node;return n&&t.dataset.focusAutoGuard})).forEach((function(e){return e.node.removeAttribute("tabIndex")})),b(k,L.length,1,L),b(k,-1,-1,L))}}}return n},h=function(e){g()&&e&&(e.stopPropagation(),e.preventDefault())},j=function(){return o(g)};"production"===process.env.NODE_ENV||e.node.isRequired;var w=function(){v="just",setTimeout((function(){v="meanwhile"}),0)};r.assignSyncMedium((function(e){var n=e.target,t=e.currentTarget;t.contains(n)||(l={observerNode:t,portaledElement:n})})),u.assignMedium(j),i.assignMedium((function(e){return e({moveFocusInside:t,focusInside:c})}));var I=n((function(e){return e.filter((function(e){return!e.disabled}))}),(function(e){var n=e.slice(-1)[0];n&&!f&&(document.addEventListener("focusin",h),document.addEventListener("focusout",j),window.addEventListener("blur",w));var t=f,r=t&&n&&n.id===t.id;f=n,t&&!r&&(t.onDeactivation(),e.filter((function(e){return e.id===t.id})).length||t.returnFocus(!n)),n?(m=null,r&&t.observed===n.observed||n.onActivation(),g(),o(g)):(document.removeEventListener("focusin",h),document.removeEventListener("focusout",j),window.removeEventListener("blur",w),m=null)}))((function(){return null}));export{I as default};
|
|
2
2
|
//# sourceMappingURL=Trap.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Trap.js","sources":["../../../../../../node_modules/react-focus-lock/dist/es2015/Trap.js"],"sourcesContent":["import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport withSideEffect from 'react-clientside-effect';\nimport moveFocusInside, { focusInside, focusIsHidden, getFocusabledIn } from 'focus-lock';\nimport { deferAction } from './util';\nimport { mediumFocus, mediumBlur, mediumEffect } from './medium';\n\nvar focusOnBody = function focusOnBody() {\n return document && document.activeElement === document.body;\n};\n\nvar isFreeFocus = function isFreeFocus() {\n return focusOnBody() || focusIsHidden();\n};\n\nvar lastActiveTrap = null;\nvar lastActiveFocus = null;\nvar lastPortaledElement = null;\nvar focusWasOutsideWindow = false;\n\nvar defaultWhitelist = function defaultWhitelist() {\n return true;\n};\n\nvar focusWhitelisted = function focusWhitelisted(activeElement) {\n return (lastActiveTrap.whiteList || defaultWhitelist)(activeElement);\n};\n\nvar recordPortal = function recordPortal(observerNode, portaledElement) {\n lastPortaledElement = {\n observerNode: observerNode,\n portaledElement: portaledElement\n };\n};\n\nvar focusIsPortaledPair = function focusIsPortaledPair(element) {\n return lastPortaledElement && lastPortaledElement.portaledElement === element;\n};\n\nfunction autoGuard(startIndex, end, step, allNodes) {\n var lastGuard = null;\n var i = startIndex;\n\n do {\n var item = allNodes[i];\n\n if (item.guard) {\n if (item.node.dataset.focusAutoGuard) {\n lastGuard = item;\n }\n } else if (item.lockItem) {\n if (i !== startIndex) {\n // we will tab to the next element\n return;\n }\n\n lastGuard = null;\n } else {\n break;\n }\n } while ((i += step) !== end);\n\n if (lastGuard) {\n lastGuard.node.tabIndex = 0;\n }\n}\n\nvar extractRef = function extractRef(ref) {\n return ref && 'current' in ref ? ref.current : ref;\n};\n\nvar focusWasOutside = function focusWasOutside(crossFrameOption) {\n if (crossFrameOption) {\n // with cross frame return true for any value\n return Boolean(focusWasOutsideWindow);\n } // in other case return only of focus went a while aho\n\n\n return focusWasOutsideWindow === 'meanwhile';\n};\n\nvar activateTrap = function activateTrap() {\n var result = false;\n\n if (lastActiveTrap) {\n var _lastActiveTrap = lastActiveTrap,\n observed = _lastActiveTrap.observed,\n persistentFocus = _lastActiveTrap.persistentFocus,\n autoFocus = _lastActiveTrap.autoFocus,\n shards = _lastActiveTrap.shards,\n crossFrame = _lastActiveTrap.crossFrame;\n var workingNode = observed || lastPortaledElement && lastPortaledElement.portaledElement;\n var activeElement = document && document.activeElement;\n\n if (workingNode) {\n var workingArea = [workingNode].concat(shards.map(extractRef).filter(Boolean));\n\n if (!activeElement || focusWhitelisted(activeElement)) {\n if (persistentFocus || focusWasOutside(crossFrame) || !isFreeFocus() || !lastActiveFocus && autoFocus) {\n if (workingNode && !(focusInside(workingArea) || focusIsPortaledPair(activeElement, workingNode))) {\n if (document && !lastActiveFocus && activeElement && !autoFocus) {\n // Check if blur() exists, which is missing on certain elements on IE\n if (activeElement.blur) {\n activeElement.blur();\n }\n\n document.body.focus();\n } else {\n result = moveFocusInside(workingArea, lastActiveFocus);\n lastPortaledElement = {};\n }\n }\n\n focusWasOutsideWindow = false;\n lastActiveFocus = document && document.activeElement;\n }\n }\n\n if (document) {\n var newActiveElement = document && document.activeElement;\n var allNodes = getFocusabledIn(workingArea);\n var focusedIndex = allNodes.map(function (_ref) {\n var node = _ref.node;\n return node;\n }).indexOf(newActiveElement);\n\n if (focusedIndex > -1) {\n // remove old focus\n allNodes.filter(function (_ref2) {\n var guard = _ref2.guard,\n node = _ref2.node;\n return guard && node.dataset.focusAutoGuard;\n }).forEach(function (_ref3) {\n var node = _ref3.node;\n return node.removeAttribute('tabIndex');\n });\n autoGuard(focusedIndex, allNodes.length, +1, allNodes);\n autoGuard(focusedIndex, -1, -1, allNodes);\n }\n }\n }\n }\n\n return result;\n};\n\nvar onTrap = function onTrap(event) {\n if (activateTrap() && event) {\n // prevent scroll jump\n event.stopPropagation();\n event.preventDefault();\n }\n};\n\nvar onBlur = function onBlur() {\n return deferAction(activateTrap);\n};\n\nvar onFocus = function onFocus(event) {\n // detect portal\n var source = event.target;\n var currentNode = event.currentTarget;\n\n if (!currentNode.contains(source)) {\n recordPortal(currentNode, source);\n }\n};\n\nvar FocusWatcher = function FocusWatcher() {\n return null;\n};\n\nvar FocusTrap = function FocusTrap(_ref4) {\n var children = _ref4.children;\n return /*#__PURE__*/React.createElement(\"div\", {\n onBlur: onBlur,\n onFocus: onFocus\n }, children);\n};\n\nFocusTrap.propTypes = process.env.NODE_ENV !== \"production\" ? {\n children: PropTypes.node.isRequired\n} : {};\n\nvar onWindowBlur = function onWindowBlur() {\n focusWasOutsideWindow = 'just'; // using setTimeout to set this variable after React/sidecar reaction\n\n setTimeout(function () {\n focusWasOutsideWindow = 'meanwhile';\n }, 0);\n};\n\nvar attachHandler = function attachHandler() {\n document.addEventListener('focusin', onTrap, true);\n document.addEventListener('focusout', onBlur);\n window.addEventListener('blur', onWindowBlur);\n};\n\nvar detachHandler = function detachHandler() {\n document.removeEventListener('focusin', onTrap, true);\n document.removeEventListener('focusout', onBlur);\n window.removeEventListener('blur', onWindowBlur);\n};\n\nfunction reducePropsToState(propsList) {\n return propsList.filter(function (_ref5) {\n var disabled = _ref5.disabled;\n return !disabled;\n });\n}\n\nfunction handleStateChangeOnClient(traps) {\n var trap = traps.slice(-1)[0];\n\n if (trap && !lastActiveTrap) {\n attachHandler();\n }\n\n var lastTrap = lastActiveTrap;\n var sameTrap = lastTrap && trap && trap.id === lastTrap.id;\n lastActiveTrap = trap;\n\n if (lastTrap && !sameTrap) {\n lastTrap.onDeactivation(); // return focus only of last trap was removed\n\n if (!traps.filter(function (_ref6) {\n var id = _ref6.id;\n return id === lastTrap.id;\n }).length) {\n // allow defer is no other trap is awaiting restore\n lastTrap.returnFocus(!trap);\n }\n }\n\n if (trap) {\n lastActiveFocus = null;\n\n if (!sameTrap || lastTrap.observed !== trap.observed) {\n trap.onActivation();\n }\n\n activateTrap(true);\n deferAction(activateTrap);\n } else {\n detachHandler();\n lastActiveFocus = null;\n }\n} // bind medium\n\n\nmediumFocus.assignSyncMedium(onFocus);\nmediumBlur.assignMedium(onBlur);\nmediumEffect.assignMedium(function (cb) {\n return cb({\n moveFocusInside: moveFocusInside,\n focusInside: focusInside\n });\n});\nexport default withSideEffect(reducePropsToState, handleStateChangeOnClient)(FocusWatcher);"],"names":["isFreeFocus","document","activeElement","body","focusIsHidden","lastActiveTrap","lastActiveFocus","lastPortaledElement","focusWasOutsideWindow","defaultWhitelist","autoGuard","startIndex","end","step","allNodes","lastGuard","i","item","guard","node","dataset","focusAutoGuard","lockItem","tabIndex","extractRef","ref","current","activateTrap","element","result","_lastActiveTrap","observed","persistentFocus","autoFocus","shards","crossFrame","workingNode","portaledElement","workingArea","concat","map","filter","Boolean","whiteList","focusWhitelisted","focusInside","blur","focus","moveFocusInside","newActiveElement","getFocusabledIn","focusedIndex","_ref","indexOf","_ref2","forEach","_ref3","removeAttribute","length","onTrap","event","stopPropagation","preventDefault","onBlur","deferAction","process","env","NODE_ENV","PropTypes","isRequired","onWindowBlur","setTimeout","mediumFocus","assignSyncMedium","source","target","currentNode","currentTarget","contains","observerNode","mediumBlur","assignMedium","mediumEffect","cb","withSideEffect","propsList","_ref5","disabled","traps","trap","slice","addEventListener","window","lastTrap","sameTrap","id","onDeactivation","_ref6","returnFocus","onActivation","removeEventListener"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Trap.js","sources":["../../../../../../node_modules/react-focus-lock/dist/es2015/Trap.js"],"sourcesContent":["import * as React from 'react';\nimport PropTypes from 'prop-types';\nimport withSideEffect from 'react-clientside-effect';\nimport moveFocusInside, { focusInside, focusIsHidden, getFocusabledIn } from 'focus-lock';\nimport { deferAction } from './util';\nimport { mediumFocus, mediumBlur, mediumEffect } from './medium';\n\nvar focusOnBody = function focusOnBody() {\n return document && document.activeElement === document.body;\n};\n\nvar isFreeFocus = function isFreeFocus() {\n return focusOnBody() || focusIsHidden();\n};\n\nvar lastActiveTrap = null;\nvar lastActiveFocus = null;\nvar lastPortaledElement = null;\nvar focusWasOutsideWindow = false;\n\nvar defaultWhitelist = function defaultWhitelist() {\n return true;\n};\n\nvar focusWhitelisted = function focusWhitelisted(activeElement) {\n return (lastActiveTrap.whiteList || defaultWhitelist)(activeElement);\n};\n\nvar recordPortal = function recordPortal(observerNode, portaledElement) {\n lastPortaledElement = {\n observerNode: observerNode,\n portaledElement: portaledElement\n };\n};\n\nvar focusIsPortaledPair = function focusIsPortaledPair(element) {\n return lastPortaledElement && lastPortaledElement.portaledElement === element;\n};\n\nfunction autoGuard(startIndex, end, step, allNodes) {\n var lastGuard = null;\n var i = startIndex;\n\n do {\n var item = allNodes[i];\n\n if (item.guard) {\n if (item.node.dataset.focusAutoGuard) {\n lastGuard = item;\n }\n } else if (item.lockItem) {\n if (i !== startIndex) {\n // we will tab to the next element\n return;\n }\n\n lastGuard = null;\n } else {\n break;\n }\n } while ((i += step) !== end);\n\n if (lastGuard) {\n lastGuard.node.tabIndex = 0;\n }\n}\n\nvar extractRef = function extractRef(ref) {\n return ref && 'current' in ref ? ref.current : ref;\n};\n\nvar focusWasOutside = function focusWasOutside(crossFrameOption) {\n if (crossFrameOption) {\n // with cross frame return true for any value\n return Boolean(focusWasOutsideWindow);\n } // in other case return only of focus went a while aho\n\n\n return focusWasOutsideWindow === 'meanwhile';\n};\n\nvar activateTrap = function activateTrap() {\n var result = false;\n\n if (lastActiveTrap) {\n var _lastActiveTrap = lastActiveTrap,\n observed = _lastActiveTrap.observed,\n persistentFocus = _lastActiveTrap.persistentFocus,\n autoFocus = _lastActiveTrap.autoFocus,\n shards = _lastActiveTrap.shards,\n crossFrame = _lastActiveTrap.crossFrame;\n var workingNode = observed || lastPortaledElement && lastPortaledElement.portaledElement;\n var activeElement = document && document.activeElement;\n\n if (workingNode) {\n var workingArea = [workingNode].concat(shards.map(extractRef).filter(Boolean));\n\n if (!activeElement || focusWhitelisted(activeElement)) {\n if (persistentFocus || focusWasOutside(crossFrame) || !isFreeFocus() || !lastActiveFocus && autoFocus) {\n if (workingNode && !(focusInside(workingArea) || focusIsPortaledPair(activeElement, workingNode))) {\n if (document && !lastActiveFocus && activeElement && !autoFocus) {\n // Check if blur() exists, which is missing on certain elements on IE\n if (activeElement.blur) {\n activeElement.blur();\n }\n\n document.body.focus();\n } else {\n result = moveFocusInside(workingArea, lastActiveFocus);\n lastPortaledElement = {};\n }\n }\n\n focusWasOutsideWindow = false;\n lastActiveFocus = document && document.activeElement;\n }\n }\n\n if (document) {\n var newActiveElement = document && document.activeElement;\n var allNodes = getFocusabledIn(workingArea);\n var focusedIndex = allNodes.map(function (_ref) {\n var node = _ref.node;\n return node;\n }).indexOf(newActiveElement);\n\n if (focusedIndex > -1) {\n // remove old focus\n allNodes.filter(function (_ref2) {\n var guard = _ref2.guard,\n node = _ref2.node;\n return guard && node.dataset.focusAutoGuard;\n }).forEach(function (_ref3) {\n var node = _ref3.node;\n return node.removeAttribute('tabIndex');\n });\n autoGuard(focusedIndex, allNodes.length, +1, allNodes);\n autoGuard(focusedIndex, -1, -1, allNodes);\n }\n }\n }\n }\n\n return result;\n};\n\nvar onTrap = function onTrap(event) {\n if (activateTrap() && event) {\n // prevent scroll jump\n event.stopPropagation();\n event.preventDefault();\n }\n};\n\nvar onBlur = function onBlur() {\n return deferAction(activateTrap);\n};\n\nvar onFocus = function onFocus(event) {\n // detect portal\n var source = event.target;\n var currentNode = event.currentTarget;\n\n if (!currentNode.contains(source)) {\n recordPortal(currentNode, source);\n }\n};\n\nvar FocusWatcher = function FocusWatcher() {\n return null;\n};\n\nvar FocusTrap = function FocusTrap(_ref4) {\n var children = _ref4.children;\n return /*#__PURE__*/React.createElement(\"div\", {\n onBlur: onBlur,\n onFocus: onFocus\n }, children);\n};\n\nFocusTrap.propTypes = process.env.NODE_ENV !== \"production\" ? {\n children: PropTypes.node.isRequired\n} : {};\n\nvar onWindowBlur = function onWindowBlur() {\n focusWasOutsideWindow = 'just'; // using setTimeout to set this variable after React/sidecar reaction\n\n setTimeout(function () {\n focusWasOutsideWindow = 'meanwhile';\n }, 0);\n};\n\nvar attachHandler = function attachHandler() {\n document.addEventListener('focusin', onTrap);\n document.addEventListener('focusout', onBlur);\n window.addEventListener('blur', onWindowBlur);\n};\n\nvar detachHandler = function detachHandler() {\n document.removeEventListener('focusin', onTrap);\n document.removeEventListener('focusout', onBlur);\n window.removeEventListener('blur', onWindowBlur);\n};\n\nfunction reducePropsToState(propsList) {\n return propsList.filter(function (_ref5) {\n var disabled = _ref5.disabled;\n return !disabled;\n });\n}\n\nfunction handleStateChangeOnClient(traps) {\n var trap = traps.slice(-1)[0];\n\n if (trap && !lastActiveTrap) {\n attachHandler();\n }\n\n var lastTrap = lastActiveTrap;\n var sameTrap = lastTrap && trap && trap.id === lastTrap.id;\n lastActiveTrap = trap;\n\n if (lastTrap && !sameTrap) {\n lastTrap.onDeactivation(); // return focus only of last trap was removed\n\n if (!traps.filter(function (_ref6) {\n var id = _ref6.id;\n return id === lastTrap.id;\n }).length) {\n // allow defer is no other trap is awaiting restore\n lastTrap.returnFocus(!trap);\n }\n }\n\n if (trap) {\n lastActiveFocus = null;\n\n if (!sameTrap || lastTrap.observed !== trap.observed) {\n trap.onActivation();\n }\n\n activateTrap(true);\n deferAction(activateTrap);\n } else {\n detachHandler();\n lastActiveFocus = null;\n }\n} // bind medium\n\n\nmediumFocus.assignSyncMedium(onFocus);\nmediumBlur.assignMedium(onBlur);\nmediumEffect.assignMedium(function (cb) {\n return cb({\n moveFocusInside: moveFocusInside,\n focusInside: focusInside\n });\n});\nexport default withSideEffect(reducePropsToState, handleStateChangeOnClient)(FocusWatcher);"],"names":["isFreeFocus","document","activeElement","body","focusIsHidden","lastActiveTrap","lastActiveFocus","lastPortaledElement","focusWasOutsideWindow","defaultWhitelist","autoGuard","startIndex","end","step","allNodes","lastGuard","i","item","guard","node","dataset","focusAutoGuard","lockItem","tabIndex","extractRef","ref","current","activateTrap","element","result","_lastActiveTrap","observed","persistentFocus","autoFocus","shards","crossFrame","workingNode","portaledElement","workingArea","concat","map","filter","Boolean","whiteList","focusWhitelisted","focusInside","blur","focus","moveFocusInside","newActiveElement","getFocusabledIn","focusedIndex","_ref","indexOf","_ref2","forEach","_ref3","removeAttribute","length","onTrap","event","stopPropagation","preventDefault","onBlur","deferAction","process","env","NODE_ENV","PropTypes","isRequired","onWindowBlur","setTimeout","mediumFocus","assignSyncMedium","source","target","currentNode","currentTarget","contains","observerNode","mediumBlur","assignMedium","mediumEffect","cb","withSideEffect","propsList","_ref5","disabled","traps","trap","slice","addEventListener","window","lastTrap","sameTrap","id","onDeactivation","_ref6","returnFocus","onActivation","removeEventListener"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as e,__assign as t}from"../../../node_modules/tslib/tslib.es6.js";import n,{forwardRef as r,useState as o,useRef as s,useCallback as
|
|
1
|
+
import{__rest as e,__assign as t}from"../../../node_modules/tslib/tslib.es6.js";import n,{forwardRef as r,useState as o,useRef as s,useCallback as a,useEffect as i}from"react";import{useTheme as c}from"styled-components";import{useKey as l}from"../../hooks/useKey.js";import d from"../../utils/debounce.js";import{Text as u}from"../Text/index.js";import m from"../TextField/index.js";import f from"../Icon/index.js";import p from"../../themes/cruk.js";import{ScreenReaderOnly as h,ListWrapper as g,List as v,ListItem as y}from"./styles.js";var E=r((function(r,E){var w=r.apiKey,b=r.countries,I=r.errorMessage,j=r.hasError,x=r.isValid,T=r.isValidVisible,V=r.isInvalidVisible,k=r.label,A=r.onAddressError,C=void 0===A?function(e){}:A,K=r.onAddressSelected,D=r.onChange,S=r.onBlur,F=e(r,["apiKey","countries","errorMessage","hasError","isValid","isValidVisible","isInvalidVisible","label","onAddressError","onAddressSelected","onChange","onBlur"]),M=o([]),B=M[0],L=M[1],_=o(-1),H=_[0],O=_[1],R=s(null),U=c(),q=t(t({},p),U),W=function(){O(-1),L([])},z=a(d(500,(function(e){return G(e)})),[]),G=function(e,t){if(void 0===t&&(t=""),0===e.length)return L([]);var n="".concat("https://api.addressy.com/Capture/Interactive/Find/v1.1/json3.ws","?Key=").concat(w,"&Text=").concat(e,"&Container=").concat(t);return void 0!==b&&(n="".concat(n,"&Countries=").concat(b.join(","))),fetch(n).then((function(e){if(!e.ok)throw new Error("Something went wrong please try again");return e.json()})).then((function(e){if(e.Items[0].Error)throw new Error("Something went wrong please try again");return L(e.Items||[]),null})).catch((function(e){return C(e)})),null},J=function(e){fetch("".concat("https://api.addressy.com/Capture/Interactive/Retrieve/v1/json3.ws","?Key=").concat(w,"&Id=").concat(e)).then((function(e){if(!e.ok)throw new Error("Something went wrong please try again");return e.json()})).then((function(e){return W(),K(e.Items[0]),null})).catch((function(e){return C(e)}))},N=function(e){return"Address"===e.Type?J(e.Id):(G(e.Text,e.Id),null)},P=function(e){R.current&&e.target instanceof HTMLElement&&!R.current.contains(e.target)&&W()};return i((function(){return document.addEventListener("mousedown",P),function(){document.removeEventListener("mousedown",P)}})),l((function(){W()}),{detectKeys:["Escape","Tab"]},[]),n.createElement(n.Fragment,null,n.createElement(m,t({"aria-activedescendant":B.length?"addressOptions-".concat(H):"","aria-owns":"found_addresses","aria-autocomplete":"both","aria-expanded":B.length?"true":"false",autoComplete:"off",hasError:j||!!I,errorMessage:I,hintText:"Start typing your address or postcode",isValid:x,isValidVisible:T,isInvalidVisible:V,label:null!=k?k:"Home address",ref:E,required:!0,role:"combobox",type:"search"},F,{onKeyDown:function(e){"Enter"===e.key&&B[H]?(e.preventDefault(),"Address"===B[H].Type&&J(B[H].Id),G(B[H].Text,B[H].Id),O(-1)):"ArrowUp"===e.key?(e.preventDefault(),H<=-1&&O(B.length-1),O(H-1)):"ArrowDown"===e.key?(e.preventDefault(),H+1>=B.length&&O(0),O(H+1)):O(-1)},onChange:function(e){z(e.target.value),D&&D(e)},onBlur:function(e){var t=!!B.length;S&&!t&&S(e)}})),!!B.length&&n.createElement(n.Fragment,null,n.createElement(h,{role:"status","aria-live":"assertive"},!!B.length&&"We have found ".concat(B.length," result").concat(1!==B.length?"s":""," matching your search. Use up and down arrow keys to navigate")),n.createElement(g,{ref:R},n.createElement(v,{"aria-label":"found addresses",id:"found_addresses",role:"listbox",theme:q},B.map((function(e,t){return n.createElement(y,{tabIndex:0,id:"addressOptions-".concat(t),isActive:t===H,key:e.Id,onClick:function(){N(e)},onKeyDown:function(t){"Enter"===t.key&&N(e)},role:"option","data-hj-suppress":!0,theme:q},n.createElement(u,{as:"span","data-hj-suppress":!0},e.Text," ",e.Description),"Address"!==e.Type&&n.createElement(n.Fragment,null,n.createElement(h,null,"press enter for these addresses"),n.createElement(f,{name:"chevronRight"})))}))))))}));export{E as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as t,__assign as r}from"../../../node_modules/tslib/tslib.es6.js";import a from"react";import{useTheme as e}from"styled-components";import o from"../../themes/cruk.js";import{StyledAvatar as
|
|
1
|
+
import{__rest as t,__assign as r}from"../../../node_modules/tslib/tslib.es6.js";import a from"react";import{useTheme as e}from"styled-components";import o from"../../themes/cruk.js";import{StyledAvatar as n}from"./styles.js";var m=function(m){var i=m.url,s=m.name,p=m.size,c=void 0===p?"m":p,l=m.alt,u=void 0===l?"":l,f=t(m,["url","name","size","alt"]),v=e(),d=r(r({},o),v);return a.createElement(n,r({},f,{size:d.avatar[c||"m"],src:function(){if(i)return i;var t=s&&"string"==typeof s&&"Anonymous"!==s&&/[a-z]/i.exec(s[0].trim())?"icon-avatar-".concat(s[0].trim().toUpperCase(),".png"):"icon-avatar-Anonymous.png";return d.avatar.path+t}(),alt:u}))};export{m as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as
|
|
1
|
+
import{__makeTemplateObject as t}from"../../../node_modules/tslib/tslib.es6.js";import e from"styled-components";var n,r=e.img(n||(n=t(["\n border-radius: 50%;\n height: ",";\n object-fit: cover;\n width: ",";\n"],["\n border-radius: 50%;\n height: ",";\n object-fit: cover;\n width: ",";\n"])),(function(t){return t.size}),(function(t){return t.size}));export{r as StyledAvatar,r as default};
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import r,{css as e}from"styled-components";var i,
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import r,{css as e}from"styled-components";var o,i,t=r.span(i||(i=n(["\n border-width: 1px;\n border-style: solid;\n background-color: ",";\n color: ",";\n border-color: ",";\n text-align: center;\n border-radius: 1.5rem;\n font-size: ",";\n line-height: 1rem;\n padding: ",";\n display: inline-block;\n min-width: ",";\n\n ","\n"],["\n border-width: 1px;\n border-style: solid;\n background-color: ",";\n color: ",";\n border-color: ",";\n text-align: center;\n border-radius: 1.5rem;\n font-size: ",";\n line-height: 1rem;\n padding: ",";\n display: inline-block;\n min-width: ",";\n\n ","\n"])),(function(n){var r=n.theme.colors,e=n.backgroundColor;return e&&void 0!==r[e]?r[e]:e||r.primary}),(function(n){var r=n.theme.colors,e=n.textColor;return e&&void 0!==r[e]?r[e]:e||r.textOnPrimary}),(function(n){var r=n.theme.colors,e=n.borderColor,o=n.backgroundColor;return e&&void 0!==r[e]?r[e]:e||(o&&void 0!==r[o]?r[o]:o||r.primary)}),(function(n){return n.theme.fontSizes.m}),(function(n){return n.theme.spacing.xxs}),(function(n){var r=n.size,e=n.theme,o=e.spacing,i=e.spacing.xs;return"calc(".concat(o[r]," + ").concat(i,")")}),(function(r){return!r.isText&&e(o||(o=n(["\n padding: 0;\n border-radius: 50%;\n display: block;\n height: ",";\n width: ",";\n line-height: ",";\n svg {\n height: ",";\n }\n "],["\n padding: 0;\n border-radius: 50%;\n display: block;\n height: ",";\n width: ",";\n line-height: ",";\n svg {\n height: ",";\n }\n "])),(function(n){var r=n.size,e=n.theme,o=e.spacing,i=e.spacing.xs;return"calc(".concat(o[r]," + ").concat(i,")")}),(function(n){var r=n.size,e=n.theme,o=e.spacing,i=e.spacing.xs;return"calc(".concat(o[r]," + ").concat(i,")")}),(function(n){var r=n.size,e=n.theme,o=e.spacing,i=e.spacing.xs;return"calc(".concat(o[r]," + ").concat(i,")")}),(function(n){var r=n.size;return n.theme.spacing[r]}))}));export{t as StyledBadge,t as default};
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o,{css as r}from"styled-components";import{Spacing as t}from"../Spacing/index.js";var c,i=o.div(
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o,{css as r}from"styled-components";import{Spacing as t}from"../Spacing/index.js";var c,i,a=o.div(i||(i=n(["\n background-color: ",";\n padding: ",";\n margin: 0 0 "," 0;\n\n &:last-child {\n margin-bottom: 0;\n }\n\n background-color: ",";\n\n ","\n ","\n"],["\n background-color: ",";\n padding: ",";\n margin: 0 0 "," 0;\n\n &:last-child {\n margin-bottom: 0;\n }\n\n background-color: ",";\n\n ","\n ","\n"])),(function(n){return n.theme.colors.backgroundLight}),(function(n){var o=n.theme;return n.backgroundColor?o.spacing.s:0}),(function(n){return n.theme.spacing.m}),(function(n){var o=n.theme.colors,r=n.backgroundColor;return r&&void 0!==o[r]?o[r]:r||"transparent"}),(function(o){return o.css&&r(c||(c=n(["\n ","\n "],["\n ","\n "])),o.css)}),(function(n){return t(n,n.theme)}));export{a as StyledBox,a as default};
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import r,{forwardRef as t}from"react";import{useTheme as n}from"styled-components";import o from"../../themes/cruk.js";import i from"../Icon/index.js";import{StyledButton as a,Spacer as m}from"./styles.js";var l=t((function(t,l){var p=n(),s=e(e({},o),p),c=t.appearance,d=void 0===c?"primary":c,f=t.isIconButton,u=void 0!==f&&f,h=r.Children.toArray(t.children),y
|
|
1
|
+
import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import r,{forwardRef as t}from"react";import{useTheme as n}from"styled-components";import o from"../../themes/cruk.js";import i from"../Icon/index.js";import{StyledButton as a,Spacer as m}from"./styles.js";var l=t((function(t,l){var p=n(),s=e(e({},o),p),c=t.appearance,d=void 0===c?"primary":c,f=t.isIconButton,u=void 0!==f&&f,h=r.Children.toArray(t.children),y="string"==typeof h[0],v=h[0],j=!(!u&&(1===h.length&&!y&&(null==v?void 0:v.type))!==i);return r.createElement(a,e({as:t.href?"a":"button"},t,{appearance:d,isIconButton:j,theme:s,ref:l}),t.children&&h.length?r.Children.map(t.children,(function(e,t){return r.createElement(m,{theme:s,key:t},e)})):null)}));l.defaultProps={appearance:"primary",full:!1,size:"m"};export{l as Button,l as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o,{css as r}from"styled-components";var t,e,c,i,
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import o,{css as r}from"styled-components";var t,e,c,a,i,l,d,u,s=o.span(t||(t=n(["\n margin-left: ",";\n &:first-of-type {\n margin-left: 0;\n }\n"],["\n margin-left: ",";\n &:first-of-type {\n margin-left: 0;\n }\n"])),(function(n){return n.theme.spacing.xxs})),b=o.button(u||(u=n(["\n box-sizing: border-box;\n min-height: ",";\n display: inline-block;\n vertical-align: middle;\n padding: ",";\n width: ",";\n min-width: ",";\n\n border-radius: ",";\n border-style: solid;\n border-width: ",";\n\n transition: color 0.2s ease, background-color 0.2s ease,\n border-color 0.2s ease;\n\n cursor: pointer;\n font-size: ",";\n font-family: ",";\n font-weight: ",";\n text-align: center;\n text-transform: ",";\n text-decoration: ",";\n\n ","\n\n ","\n\n ","\n \n ","\n\n ","\n\n ","\n"],["\n box-sizing: border-box;\n min-height: ",";\n display: inline-block;\n vertical-align: middle;\n padding: ",";\n width: ",";\n min-width: ",";\n\n border-radius: ",";\n border-style: solid;\n border-width: ",";\n\n transition: color 0.2s ease, background-color 0.2s ease,\n border-color 0.2s ease;\n\n cursor: pointer;\n font-size: ",";\n font-family: ",";\n font-weight: ",";\n text-align: center;\n text-transform: ",";\n text-decoration: ",";\n\n ","\n\n ","\n\n ","\n \n ","\n\n ","\n\n ","\n"])),"3rem",(function(n){var o=n.theme;return n.isIconButton?"0":"calc( (".concat("3rem"," - ( ").concat(o.button.buttonBorderThickness," * 2) - ").concat(o.typography.lineHeight," ) / 2) ").concat(o.spacing.m)}),(function(n){return n.isIconButton?"".concat("3rem"):"auto"}),(function(n){return n.isIconButton?"".concat("3rem"):"auto"}),(function(n){return n.theme.button.borderRadius}),(function(n){return n.theme.button.buttonBorderThickness}),(function(n){return n.theme.fontSizes.m}),(function(n){return n.theme.typography.fontFamilyHeadings}),(function(n){return n.theme.typography.fontWeightMedium}),(function(n){return n.theme.button.textTransform}),(function(n){return n.theme.button.textDecoration}),(function(o){return"primary"===o.appearance&&r(e||(e=n(["\n background-color: ",";\n border-color: ",";\n color: "," !important;\n :focus,\n :hover {\n background-color: ",";\n border-color: ",";\n color: "," !important;\n }\n :disabled {\n cursor: not-allowed;\n background-color: ",";\n color: "," !important;\n border-color: ",";\n }\n "],["\n background-color: ",";\n border-color: ",";\n color: "," !important;\n :focus,\n :hover {\n background-color: ",";\n border-color: ",";\n color: "," !important;\n }\n :disabled {\n cursor: not-allowed;\n background-color: ",";\n color: "," !important;\n border-color: ",";\n }\n "])),o.theme.colors.buttonPrimaryBackground,o.theme.colors.buttonPrimaryBorder,o.theme.colors.buttonPrimaryText,o.theme.colors.buttonPrimaryBackgroundHover,o.theme.colors.buttonPrimaryBorderHover,o.theme.colors.buttonPrimaryTextHover,o.theme.colors.buttonPrimaryDisabledBackground,o.theme.colors.buttonPrimaryDisabledText,o.theme.colors.buttonPrimaryDisabledBorder)}),(function(o){return"secondary"===o.appearance&&r(c||(c=n(["\n background-color: ",";\n border-color: ",";\n color: "," !important;\n :focus,\n :hover {\n background-color: ",";\n border-color: ",";\n color: "," !important;\n }\n :disabled {\n cursor: not-allowed;\n background-color: ",";\n color: "," !important;\n border-color: ",";\n }\n "],["\n background-color: ",";\n border-color: ",";\n color: "," !important;\n :focus,\n :hover {\n background-color: ",";\n border-color: ",";\n color: "," !important;\n }\n :disabled {\n cursor: not-allowed;\n background-color: ",";\n color: "," !important;\n border-color: ",";\n }\n "])),o.theme.colors.buttonSecondaryBackground,o.theme.colors.buttonSecondaryBorder,o.theme.colors.buttonSecondaryText,o.theme.colors.buttonSecondaryBackgroundHover,o.theme.colors.buttonSecondaryBorderHover,o.theme.colors.buttonSecondaryTextHover,o.theme.colors.buttonSecondaryDisabledBackground,o.theme.colors.buttonSecondaryDisabledText,o.theme.colors.buttonSecondaryDisabledBorder)}),(function(o){return"tertiary"===o.appearance&&r(a||(a=n(["\n display: inline-block;\n padding: 0;\n border: 0px;\n background-color: rgba(255, 255, 255, 0);\n transition: color 0.2s ease;\n color: ",";\n :focus,\n :hover {\n color: ",";\n }\n :disabled {\n cursor: not-allowed;\n background-color: transparent;\n color: "," !important;\n border-color: transparent;\n }\n "],["\n display: inline-block;\n padding: 0;\n border: 0px;\n background-color: rgba(255, 255, 255, 0);\n transition: color 0.2s ease;\n color: ",";\n :focus,\n :hover {\n color: ",";\n }\n :disabled {\n cursor: not-allowed;\n background-color: transparent;\n color: "," !important;\n border-color: transparent;\n }\n "])),o.theme.colors.buttonTertiaryText,o.theme.colors.buttonTertiaryTextHover,o.theme.colors.buttonTertiaryDisabledText)}),(function(o){return"l"===o.size&&r(i||(i=n(["\n min-height: ",";\n border-radius: ",";\n padding: ",";\n min-width: ",";\n height: ",";\n "],["\n min-height: ",";\n border-radius: ",";\n padding: ",";\n min-width: ",";\n height: ",";\n "])),"4rem",(function(n){return n.theme.button.borderRadiusLarge}),(function(n){var o=n.theme;return n.isIconButton?"0":"calc( (".concat("4rem"," - ( ").concat(o.button.buttonBorderThickness," * 2) - ").concat(o.typography.lineHeight," ) / 2) ").concat(o.spacing.m)}),(function(n){return n.isIconButton?"".concat("4rem"):"auto"}),(function(n){return n.isIconButton?"".concat("4rem"):"auto"}))}),(function(o){return o.full&&r(l||(l=n(["\n width: 100%;\n "],["\n width: 100%;\n "])))}),(function(o){return o.css&&r(d||(d=n(["\n ","\n "],["\n ","\n "])),o.css)}));export{s as Spacer,b as StyledButton};
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e,__rest as r}from"../../../node_modules/tslib/tslib.es6.js";import t,{forwardRef as o}from"react";import{useTheme as l,ThemeProvider as
|
|
1
|
+
import{__assign as e,__rest as r}from"../../../node_modules/tslib/tslib.es6.js";import t,{forwardRef as o}from"react";import{useTheme as l,ThemeProvider as a}from"styled-components";import s from"../../themes/cruk.js";import i from"../ErrorText/index.js";import{StyledLabel as c,StyledInput as m,SelectedBorder as n,CheckWrapper as d,Check as u,CheckGlyph as E}from"./styles.js";var f=o((function(o,f){var h=l(),p=e(e({},s),h),b=o.children,x=r(o,["children"]);return t.createElement(a,{theme:p},t.createElement(c,{hasError:o.hasError||!!o.errorMessage||!1,checked:o.checked||o.defaultChecked||!1,disabled:o.disabled||!1},t.createElement(m,e({},x,{type:"checkbox",ref:f,"aria-describedby":o.id&&o.errorMessage?"".concat(o.id,"-error"):void 0})),t.createElement(n,null),b||o.value,p.utilities.useDefaultFromControls?null:t.createElement(d,null,t.createElement(u,null,t.createElement(E,{viewBox:"0 0 17.8 17.8"},t.createElement("path",{d:"M0 11.314l1.52-1.52 4.95 4.95 9.794-9.794 1.52 1.52L6.482 17.774l-.01-.01-.01.01z"}))))),!!o.errorMessage&&t.createElement(i,{marginTop:"xxs",id:o.id?"".concat(o.id,"-error"):void 0},o.errorMessage))}));export{f as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import t,{css as o}from"styled-components";var e,i,r,s,l,a,d,u
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import t,{css as o}from"styled-components";var e,i,r,s,l,a,c,d,p,u=t.div(e||(e=n(["\n display: inline-block;\n height: ",";\n width: ",";\n position: absolute;\n top: calc(50% - ("," / 2));\n left: ",";\n"],["\n display: inline-block;\n height: ",";\n width: ",";\n position: absolute;\n top: calc(50% - ("," / 2));\n left: ",";\n"])),"1.5rem","1.5rem","1.5rem",(function(n){return n.theme.spacing.xs})),h=t.span(i||(i=n(["\n display: block;\n position: relative;\n border: 1px solid ",";\n height: ",";\n width: ",";\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition: border 0.25s ease;\n overflow: hidden;\n"],["\n display: block;\n position: relative;\n border: 1px solid ",";\n height: ",";\n width: ",";\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 5;\n transition: border 0.25s ease;\n overflow: hidden;\n"])),(function(n){return n.theme.colors.selectionBorder}),"1.5rem","1.5rem"),m=t.svg(r||(r=n(["\n height: ",";\n width: ",";\n transition: transform 0.25s ease;\n transform: rotateY(90deg);\n transform-origin: center;\n /* asset is little wonky */\n margin-top: -0.125rem;\n margin-left: 0.125rem;\n\n path {\n fill: ",";\n }\n"],["\n height: ",";\n width: ",";\n transition: transform 0.25s ease;\n transform: rotateY(90deg);\n transform-origin: center;\n /* asset is little wonky */\n margin-top: -0.125rem;\n margin-left: 0.125rem;\n\n path {\n fill: ",";\n }\n"])),"1.125rem","1.125rem",(function(n){return n.theme.colors.primary})),f=t.label(l||(l=n(["\n background-color: ",";\n position: relative;\n border-width: ",";\n border-style: solid;\n border-color: ",";\n cursor: pointer;\n display: block;\n font-weight: ",";\n color: ",";\n padding: ",";\n &:focus ~ "," "," {\n outline: 2px solid #7aacfe; /* for non-webkit browsers */\n outline: 5px auto -webkit-focus-ring-color;\n }\n\n ","\n"],["\n background-color: ",";\n position: relative;\n border-width: ",";\n border-style: solid;\n border-color: ",";\n cursor: pointer;\n display: block;\n font-weight: ",";\n color: ",";\n padding: ",";\n &:focus ~ "," "," {\n outline: 2px solid #7aacfe; /* for non-webkit browsers */\n outline: 5px auto -webkit-focus-ring-color;\n }\n\n ","\n"])),(function(n){return n.theme.colors.backgroundLight}),(function(n){return n.theme.utilities.inputBorderWidth}),(function(n){var t=n.hasError,o=n.theme,e=n.checked;return t?o.colors.textError:e&&!o.utilities.useDefaultFocusRect?o.colors.primary:o.colors.inputBorder}),(function(n){var t=n.theme;return n.checked||!t.utilities.useDefaultFocusRect?t.typography.fontWeightHeavy:t.typography.fontWeightMedium}),(function(n){var t=n.theme;return n.disabled?t.colors.disabled:t.colors.textDark}),(function(n){var t=n.theme;return"calc( (".concat("3em"," - ( ").concat(t.utilities.inputBorderWidth," * 2) - ").concat(t.typography.lineHeight," ) / 2) ").concat(t.spacing.m," calc( (").concat("3em"," - ( ").concat(t.utilities.inputBorderWidth," * 2) - ").concat(t.typography.lineHeight," ) / 2) ").concat(t.spacing.xl)}),u,h,(function(t){return t.theme.utilities.useDefaultFromControls?null:o(s||(s=n(["\n min-height: 2rem;\n &:hover "," "," {\n border: solid 1px\n ",";\n }\n "],["\n min-height: 2rem;\n &:hover "," "," {\n border: solid 1px\n ",";\n }\n "])),u,h,(function(n){return n.theme.colors.primary}))})),g=t.div(a||(a=n(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"]))),b=t.input(p||(p=n(["\n margin-right: 5px !important;\n\n ","\n"],["\n margin-right: 5px !important;\n\n ","\n"])),(function(t){var e=t.theme;return e.utilities.useDefaultFromControls?o(c||(c=n(["\n position: absolute;\n display: inline-block;\n transform: translate(-50%, -50%);\n top: 50%;\n margin: 0;\n padding: 0;\n left: ",";\n "],["\n position: absolute;\n display: inline-block;\n transform: translate(-50%, -50%);\n top: 50%;\n margin: 0;\n padding: 0;\n left: ",";\n "])),(function(n){return n.theme.spacing.s})):o(d||(d=n(["\n /* This hides the original input */\n position: absolute;\n left: ",";\n opacity: 0;\n\n &:focus ~ "," {\n outline: none !important;\n box-shadow: inset 0 0 0 2px ",";\n box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;\n }\n\n &:checked ~ "," "," "," {\n transform: rotateY(0deg);\n }\n "],["\n /* This hides the original input */\n position: absolute;\n left: ",";\n opacity: 0;\n\n &:focus ~ "," {\n outline: none !important;\n box-shadow: inset 0 0 0 2px ",";\n box-shadow: inset 0 0 0 2px -webkit-focus-ring-color;\n }\n\n &:checked ~ "," "," "," {\n transform: rotateY(0deg);\n }\n "])),(function(n){return n.theme.spacing.xxs}),g,e.colors.inputBorder,u,h,m)}));export{h as Check,m as CheckGlyph,u as CheckWrapper,g as SelectedBorder,b as StyledInput,f as StyledLabel};
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t,{useState as
|
|
1
|
+
import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t,{useState as n,useRef as r,useEffect as a}from"react";import{useTheme as o}from"styled-components";import i from"../../themes/cruk.js";import{CustomHeader as l,DefaultHeader as c,FlippingIcon as d,CollapseContent as u,transitionDurationSeconds as m}from"./styles.js";var h=function(h){var s=h.id,p=h.headerTitleText,f=h.headerTitleTextColor,x=h.headerTitleTextSize,y=h.headerTitleTextFontFamily,T=h.headerComponent,b=h.startOpen,v=h.onOpenChange,k=h.children,C=n(b||!1),E=C[0],g=C[1],F=n(b?"initial":"0"),S=F[0],j=F[1],z=r(null),D=r(null),H=o(),O=e(e({},i),H),w=function(){var e=z.current;(null==D?void 0:D.current)&&clearTimeout(null==D?void 0:D.current);var t=!E;g(t),null!==e&&j("".concat(e.scrollHeight,"px")),!1===t?setTimeout((function(){return j("0")}),10):D.current=setTimeout((function(){return j("initial")}),1e3*m),void 0!==v&&v(t)};return a((function(){g(b||!1),j(b?"initial":"0")}),[b]),t.createElement("div",null,T?t.createElement(l,{theme:O,"aria-controls":"".concat(s,"-header"),"aria-expanded":E,id:"".concat(s,"-header"),onClick:w,"aria-disabled":!1,"aria-label":p,onKeyDown:function(e){"Enter"!==e.key&&" "!==e.key&&"Spacebar"!==e.key||(e.preventDefault(),w())},role:"button",tabIndex:0},T):t.createElement(c,{"aria-controls":"".concat(s,"-header"),"aria-expanded":E,id:"".concat(s,"-header"),onClick:w,theme:O,appearance:"tertiary",type:"button",textColor:f,textSize:x,textFontFamily:y},p,t.createElement(d,{name:"chevronRight",open:E})),t.createElement(u,{theme:O,id:"".concat(s,"-content"),ref:z,role:"region","aria-hidden":!E,"aria-labelledby":"".concat(s,"-header"),contentHeight:S,openStatus:E},k))};export{h as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import t from"styled-components";import{Button as o}from"../Button/index.js";import e from"../Icon/index.js";var i,r,a,s,l=.5,f=t(e)(i||(i=n(["\n transform: ",";\n transition-duration: ","s;\n"],["\n transform: ",";\n transition-duration: ","s;\n"])),(function(n){return n.open?"rotate(90deg) translateX(0.1em) scaleX(-1) ":"rotate(90deg)"}),.5),m=t(o)(r||(r=n(["\n display: flex;\n color: ",";\n font-size: ",";\n font-family: ",";\n font-weight: normal;\n margin-bottom: 0;\n height: initial;\n text-decoration: none;\n text-align: left;\n :hover,\n :focus {\n color: ",";\n }\n"],["\n display: flex;\n color: ",";\n font-size: ",";\n font-family: ",";\n font-weight: normal;\n margin-bottom: 0;\n height: initial;\n text-decoration: none;\n text-align: left;\n :hover,\n :focus {\n color: ",";\n }\n"])),(function(n){var t=n.theme.colors,o=n.textColor;return o&&void 0!==t[o]?t[o]:o||t.secondary}),(function(n){var t=n.theme,o=t.fontSizes,e=t.fontSizes.m,i=n.textSize;return i?o[i]:e}),(function(n){var t=n.theme
|
|
1
|
+
import{__makeTemplateObject as n}from"../../../node_modules/tslib/tslib.es6.js";import t from"styled-components";import{Button as o}from"../Button/index.js";import e from"../Icon/index.js";var i,r,a,s,l=.5,f=t(e)(i||(i=n(["\n transform: ",";\n transition-duration: ","s;\n"],["\n transform: ",";\n transition-duration: ","s;\n"])),(function(n){return n.open?"rotate(90deg) translateX(0.1em) scaleX(-1) ":"rotate(90deg)"}),.5),m=t(o)(r||(r=n(["\n display: flex;\n color: ",";\n font-size: ",";\n font-family: ",";\n font-weight: normal;\n margin-bottom: 0;\n height: initial;\n text-decoration: none;\n text-align: left;\n :hover,\n :focus {\n color: ",";\n }\n"],["\n display: flex;\n color: ",";\n font-size: ",";\n font-family: ",";\n font-weight: normal;\n margin-bottom: 0;\n height: initial;\n text-decoration: none;\n text-align: left;\n :hover,\n :focus {\n color: ",";\n }\n"])),(function(n){var t=n.theme.colors,o=n.textColor;return o&&void 0!==t[o]?t[o]:o||t.secondary}),(function(n){var t=n.theme,o=t.fontSizes,e=t.fontSizes.m,i=n.textSize;return i?o[i]:e}),(function(n){var t=n.theme;return n.textFontFamily||t.typography.fontFamilyBase}),(function(n){var t=n.theme.colors,o=n.textColor;return o&&void 0!==t[o]?t[o]:o||t.secondary})),c=t.div(a||(a=n(["\n margin: 0;\n transition: ","s ease;\n height: ",";\n visibility: ",";\n overflow: hidden;\n & > p {\n margin-top: 0;\n }\n"],["\n margin: 0;\n transition: ","s ease;\n height: ",";\n visibility: ",";\n overflow: hidden;\n & > p {\n margin-top: 0;\n }\n"])),.5,(function(n){return n.contentHeight}),(function(n){return n.openStatus?"visible":"hidden"})),d=t.div(s||(s=n(["\n cursor: pointer;\n"],["\n cursor: pointer;\n"])));export{c as CollapseContent,d as CustomHeader,m as DefaultHeader,f as FlippingIcon,l as transitionDurationSeconds};
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from"../../node_modules/tslib/tslib.es6.js";import e from"react";import t from"styled-components";var i,o=t.div(i||(i=n(['\n align-items: center;\n display: flex;\n flex-basis: 100%;\n padding-bottom: 10px;\n padding-top: 10px;\n text-align: center;\n width: 100%;\n :before,\n :after {\n background-color: #333;\n content: "";\n display: inline-block;\n flex-grow: 1;\n height: 1px;\n }\n'],['\n align-items: center;\n display: flex;\n flex-basis: 100%;\n padding-bottom: 10px;\n padding-top: 10px;\n text-align: center;\n width: 100%;\n :before,\n :after {\n background-color: #333;\n content: "";\n display: inline-block;\n flex-grow: 1;\n height: 1px;\n }\n']))),l=function(n){return e.createElement(o,null,
|
|
1
|
+
import{__makeTemplateObject as n}from"../../node_modules/tslib/tslib.es6.js";import e from"react";import t from"styled-components";var i,o=t.div(i||(i=n(['\n align-items: center;\n display: flex;\n flex-basis: 100%;\n padding-bottom: 10px;\n padding-top: 10px;\n text-align: center;\n width: 100%;\n :before,\n :after {\n background-color: #333;\n content: "";\n display: inline-block;\n flex-grow: 1;\n height: 1px;\n }\n'],['\n align-items: center;\n display: flex;\n flex-basis: 100%;\n padding-bottom: 10px;\n padding-top: 10px;\n text-align: center;\n width: 100%;\n :before,\n :after {\n background-color: #333;\n content: "";\n display: inline-block;\n flex-grow: 1;\n height: 1px;\n }\n']))),l=function(n){var t=n.children;return e.createElement(o,null,t)};export{l as Divider,l as default};
|
|
2
2
|
//# sourceMappingURL=Divider.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as r,__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t from"react";import{useTheme as o}from"styled-components";import
|
|
1
|
+
import{__rest as r,__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t from"react";import{useTheme as o}from"styled-components";import s from"../../themes/cruk.js";import{StyledErrorText as m}from"./styles.js";var a=function(a){var i=a.children,l=a.as,n=void 0===l?"span":l,d=r(a,["children","as"]),f=o(),p=e(e({},s),f);return t.createElement(m,e({forwardedAs:n},d,{theme:p,role:"alert"}),i)};export{a as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as o}from"../../../node_modules/tslib/tslib.es6.js";import n from"styled-components";import{Text as t}from"../Text/index.js";var e,r=n(t)(e||(e=o(["\n display: inline-block;\n color: ",";\n font-weight: ",";\n"],["\n display: inline-block;\n color: ",";\n font-weight: ",";\n"])),(function(o){return o.theme.colors.textError}),(function(o){return o.theme.typography.fontWeightHeavy}));export{r as StyledErrorText};
|
|
1
|
+
import{__makeTemplateObject as o}from"../../../node_modules/tslib/tslib.es6.js";import n from"styled-components";import{Text as t}from"../Text/index.js";var e,r=n(t)(e||(e=o(["\n display: inline-block;\n color: ",";\n font-weight: ",";\n"],["\n display: inline-block;\n color: ",";\n font-weight: ",";\n"])),(function(o){return o.theme.colors.textError}),(function(o){return o.theme.typography.fontWeightHeavy}));export{r as StyledErrorText,r as default};
|
|
2
2
|
//# sourceMappingURL=styles.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n}from"../../node_modules/tslib/tslib.es6.js";import i
|
|
1
|
+
import{__makeTemplateObject as n}from"../../node_modules/tslib/tslib.es6.js";import i from"styled-components";import{Spacing as e}from"./Spacing/index.js";var t,o=i.div(t||(t=n(["\n display: block;\n @media (min-width: ",") {\n display: flex;\n }\n ","\n"],["\n display: block;\n @media (min-width: ",") {\n display: flex;\n }\n ","\n"])),(function(n){return n.theme.breakpoint.tablet}),(function(n){return e(n,n.theme)}));export{o as default};
|
|
2
2
|
//# sourceMappingURL=Flex.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t from"react";import{useTheme as
|
|
1
|
+
import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t from"react";import{useTheme as l,ThemeProvider as n}from"styled-components";import r from"../../themes/cruk.js";import{Text as o}from"../Text/index.js";import{StyledFooter as a,FooterContentWrapper as m,FooterSectionLogo as s,StyledRegulatorLogo as i,FooterSectionLinks as c,StyledNav as E,StyledUL as f,StyledLI as u,FooterSection as p,FooterSectionAddress as d,StyledAddress as x}from"./styles.js";var g=function(g){var S=g.children,y=g.middleSection,h=t.Children.toArray(S),z=l(),C=e(e({},r),z);return t.createElement(n,{theme:C},t.createElement(a,null,t.createElement(m,null,t.createElement(s,null,t.createElement(i,{alt:C.siteConfig.footerLogoAlt||"",src:C.siteConfig.footerLogoSrc||""})),t.createElement(c,null,t.createElement(E,{"aria-label":"footer links"},t.createElement(f,null,h.length?h.map((function(e,l){return t.createElement(u,{key:l},e)})):null))),t.createElement(p,null,y?"string"==typeof y?t.createElement(o,{textSize:"s"},y):t.createElement(t.Fragment,null,y):t.createElement(o,{textSize:"s"},C.siteConfig.footerCopyText)),t.createElement(d,null,t.createElement(x,null,t.createElement(o,{as:"span",textSize:"s"},"2 Redman Place"),t.createElement(o,{as:"span",textSize:"s"},"London"),t.createElement(o,{as:"span",textSize:"s"},"E20 1JQ"))))))};export{g as Footer,g as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__makeTemplateObject as n,__assign as o}from"../../node_modules/tslib/tslib.es6.js";import{createGlobalStyle as t,withTheme as e}from"styled-components";import r from"../themes/cruk.js";var i=t(a||(a=n(["\n ","\n *, *:after, *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n \n @media (prefers-reduced-motion: reduce) {\n *, *:after, *:before {\n animation-play-state: paused !important;\n animation-direction: reverse !important;\n transition: none !important;\n scroll-behavior: auto !important;\n }\n }\n\n table, td, th {\n border-spacing: 0;\n border: 1px solid #ccc;\n padding: 10px;\n }\n .no-focus-outline a:focus,\n .no-focus-outline button:focus {\n outline: none;\n }\n img {\n width: 100%;\n height: auto;\n }\n section {\n width: 100%;\n }\n button {\n font-size: 1em;\n }\n"],["\n ","\n *, *:after, *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n \n @media (prefers-reduced-motion: reduce) {\n *, *:after, *:before {\n animation-play-state: paused !important;\n animation-direction: reverse !important;\n transition: none !important;\n scroll-behavior: auto !important;\n }\n }\n\n table, td, th {\n border-spacing: 0;\n border: 1px solid #ccc;\n padding: 10px;\n }\n .no-focus-outline a:focus,\n .no-focus-outline button:focus {\n outline: none;\n }\n img {\n width: 100%;\n height: auto;\n }\n section {\n width: 100%;\n }\n button {\n font-size: 1em;\n }\n"])),(function(n){var t=o(o({},r),n.theme);return"\n "
|
|
1
|
+
import{__makeTemplateObject as n,__assign as o}from"../../node_modules/tslib/tslib.es6.js";import{createGlobalStyle as t,withTheme as e}from"styled-components";import r from"../themes/cruk.js";var i=t(a||(a=n(["\n ","\n *, *:after, *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n \n @media (prefers-reduced-motion: reduce) {\n *, *:after, *:before {\n animation-play-state: paused !important;\n animation-direction: reverse !important;\n transition: none !important;\n scroll-behavior: auto !important;\n }\n }\n\n table, td, th {\n border-spacing: 0;\n border: 1px solid #ccc;\n padding: 10px;\n }\n .no-focus-outline a:focus,\n .no-focus-outline button:focus {\n outline: none;\n }\n img {\n width: 100%;\n height: auto;\n }\n section {\n width: 100%;\n }\n button {\n font-size: 1em;\n }\n"],["\n ","\n *, *:after, *:before {\n -webkit-box-sizing: border-box;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n }\n \n @media (prefers-reduced-motion: reduce) {\n *, *:after, *:before {\n animation-play-state: paused !important;\n animation-direction: reverse !important;\n transition: none !important;\n scroll-behavior: auto !important;\n }\n }\n\n table, td, th {\n border-spacing: 0;\n border: 1px solid #ccc;\n padding: 10px;\n }\n .no-focus-outline a:focus,\n .no-focus-outline button:focus {\n outline: none;\n }\n img {\n width: 100%;\n height: auto;\n }\n section {\n width: 100%;\n }\n button {\n font-size: 1em;\n }\n"])),(function(n){var t,e=o(o({},r),n.theme);return"\n ".concat((t=e.typography.customFonts,t.map((function(n){return"\n @font-face {\n font-family: ".concat(n.family,';\n src: url("').concat(n.url,".woff2\") format('woff2'),\n url(\"").concat(n.url,".woff\") format('woff');\n font-weight: normal;\n font-style: normal;\n font-display: fallback;\n }\n ")})).join("")),"\n html {\n font-size: ").concat(e.typography.fontSizeBase,";\n font-family: ").concat(e.typography.fontFamilyBase,";\n line-height: ").concat(e.typography.lineHeight,";\n }\n body {\n background-color: ").concat(e.colors.backgroundMid,";\n color: ").concat(e.colors.textDark,";\n margin: 0;\n padding: 0;\n overflow-x: hidden;\n }\n ")}));i.defaultProps={theme:r};var a,c=e(i);export{c as default};
|
|
2
2
|
//# sourceMappingURL=GlobalStyle.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t,{useState as l}from"react";import{useTheme as o,ThemeProvider as i}from"styled-components";import
|
|
1
|
+
import{__assign as e}from"../../../node_modules/tslib/tslib.es6.js";import t,{useState as l}from"react";import{useTheme as o,ThemeProvider as i}from"styled-components";import n from"../../hooks/useScrollPosition.js";import r from"../../themes/cruk.js";import{StyledHeader as m,HeaderStickyPlaceHolder as s,HeaderStickyContainer as a,SkipToMain as c,HeaderMainContent as u,StyledLink as f,LogoWrapper as d,Logo as g,Tagline as S}from"./styles.js";var k=function(k){var p=k.isSticky,y=k.siteSlogan,E=k.logoAltText,h=k.logoImageSrc,j=k.logoLinkTitle,v=k.logoLinkUrl,C=k.fullWidth,b=k.children,w=l(!1),x=w[0],A=w[1],L="undefined"!=typeof window,P=o(),T=e(e({},r),P);return n((function(e){var t=e.currPos,l=!!L&&t.y>66;l!==x&&A(l)}),[x],null,!0,100),t.createElement(i,{theme:T},t.createElement(m,null,t.createElement(s,null,t.createElement(a,{"data-cy":"header-sticky-container",isSmall:x,isSticky:p},t.createElement(c,{className:"skip-main",href:"#main"},"Skip to main content"),t.createElement(u,{fullWidth:C},t.createElement(f,{href:null!=v?v:T.siteConfig.logoUrl,title:null!=j?j:"Home"},t.createElement(d,{isSmall:x,isSticky:p},t.createElement(g,{src:null!=h?h:T.siteConfig.logoSrc,alt:null!=E?E:T.siteConfig.logoAlt}))),y?t.createElement(S,{isSmall:x,isSticky:p},y):null,b)))))};export{k as Header,k as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|