@cruk/cruk-react-components 0.1.7 → 1.0.3
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 +44 -1
- package/README.md +8 -1
- 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/README.md.js +1 -1
- package/lib/cjs/src/components/Avatar/README.md.js.map +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/README.md.js +1 -1
- package/lib/cjs/src/components/Button/README.md.js.map +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/README.md.js +1 -1
- package/lib/cjs/src/components/Checkbox/README.md.js.map +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/README.md.js +1 -1
- package/lib/cjs/src/components/PopOver/README.md.js.map +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/README.md.js +1 -1
- package/lib/cjs/src/components/Radio/README.md.js.map +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/README.md.js +2 -0
- package/lib/cjs/src/components/RadioConsent/README.md.js.map +1 -0
- package/lib/cjs/src/components/{RadioGroup → RadioConsent}/index.js +0 -0
- package/lib/cjs/src/components/{RadioGroup → RadioConsent}/index.js.map +0 -0
- package/lib/cjs/src/components/RadioConsent/styles.js +2 -0
- package/lib/cjs/src/components/{RadioGroup → RadioConsent}/styles.js.map +0 -0
- 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/README.md.js +1 -1
- package/lib/cjs/src/components/TextAreaField/README.md.js.map +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/README.md.js +1 -1
- package/lib/cjs/src/components/TextField/README.md.js.map +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/README.md.js +1 -1
- package/lib/cjs/src/components/Totaliser/README.md.js.map +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/components/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/AddressLookup.stories.d.ts +2 -2
- package/lib/components/AddressLookup/index.d.ts +3 -3
- package/lib/components/Avatar/Avatar.stories.d.ts +2 -2
- package/lib/components/Avatar/index.d.ts +3 -3
- package/lib/components/Avatar/styles.d.ts +3 -1
- package/lib/components/Badge/Badge.stories.d.ts +2 -2
- package/lib/components/Badge/index.d.ts +2 -2
- package/lib/components/Badge/styles.d.ts +2 -2
- package/lib/components/Box/Box.stories.d.ts +2 -2
- package/lib/components/Box/index.d.ts +3 -3
- package/lib/components/Box/styles.d.ts +5 -2
- package/lib/components/Button/Button.stories.d.ts +2 -2
- package/lib/components/Button/index.d.ts +5 -3
- package/lib/components/Button/styles.d.ts +3 -3
- package/lib/components/Checkbox/Checkbox.stories.d.ts +2 -2
- package/lib/components/Checkbox/index.d.ts +1 -1
- package/lib/components/Checkbox/styles.d.ts +2 -0
- package/lib/components/Collapse/Collapse.stories.d.ts +2 -2
- package/lib/components/Collapse/index.d.ts +2 -2
- package/lib/components/Collapse/styles.d.ts +3 -3
- package/lib/components/DateField/DateField.stories.d.ts +2 -2
- package/lib/components/DateField/index.d.ts +2 -2
- package/lib/components/ErrorText/ErrorText.stories.d.ts +2 -2
- 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/Footer/Footer.stories.d.ts +2 -2
- package/lib/components/Footer/index.d.ts +1 -1
- package/lib/components/Header/Header.stories.d.ts +2 -2
- package/lib/components/Header/index.d.ts +2 -2
- package/lib/components/Heading/Heading.stories.d.ts +2 -2
- package/lib/components/Heading/index.d.ts +4 -4
- package/lib/components/Heading/styles.d.ts +2 -2
- package/lib/components/Icon/Icon.stories.d.ts +2 -2
- package/lib/components/Icon/index.d.ts +2 -2
- package/lib/components/Icon/styles.d.ts +1 -0
- package/lib/components/LabelWrapper/index.d.ts +1 -1
- package/lib/components/LabelWrapper/styles.d.ts +1 -1
- package/lib/components/LegendWrapper/LegendWrapper.stories.d.ts +2 -2
- package/lib/components/LegendWrapper/index.d.ts +1 -1
- package/lib/components/LegendWrapper/styles.d.ts +3 -3
- package/lib/components/Link/Link.stories.d.ts +2 -2
- package/lib/components/Link/index.d.ts +4 -4
- package/lib/components/Link/styles.d.ts +7 -7
- package/lib/components/Loader/Loader.stories.d.ts +1 -1
- package/lib/components/Loader/index.d.ts +2 -2
- package/lib/components/Modal/Modal.stories.d.ts +2 -2
- package/lib/components/Modal/index.d.ts +3 -3
- package/lib/components/Pagination/Pagination.stories.d.ts +2 -2
- package/lib/components/Pagination/index.d.ts +4 -4
- package/lib/components/PopOver/Popover.stories.d.ts +2 -2
- package/lib/components/PopOver/index.d.ts +2 -2
- package/lib/components/PopOver/styles.d.ts +1 -1
- package/lib/components/ProgressBar/ProgressBar.stories.d.ts +2 -2
- package/lib/components/ProgressBar/index.d.ts +1 -1
- package/lib/components/ProgressBar/styles.d.ts +2 -2
- package/lib/components/Radio/Radio.stories.d.ts +2 -2
- package/lib/components/Radio/index.d.ts +1 -1
- package/lib/components/Radio/styles.d.ts +10 -3
- package/lib/components/RadioConsent/Radio.stories.d.ts +6 -0
- package/lib/components/RadioConsent/index.d.ts +24 -0
- package/lib/components/{RadioGroup → RadioConsent}/styles.d.ts +7 -4
- package/lib/components/{RadioGroup → RadioConsent}/test.cypress.d.ts +0 -0
- package/lib/components/Select/Selelct.stories.d.ts +2 -2
- package/lib/components/Select/index.d.ts +4 -1
- package/lib/components/Select/styles.d.ts +4 -3
- package/lib/components/Spacing/index.d.ts +1 -1
- package/lib/components/Step/Step.stories.d.ts +2 -2
- package/lib/components/Step/index.d.ts +1 -1
- package/lib/components/Text/Text.stories.d.ts +2 -2
- package/lib/components/Text/index.d.ts +4 -4
- package/lib/components/Text/styles.d.ts +5 -5
- package/lib/components/TextAreaField/TextAreaField.stories.d.ts +2 -2
- package/lib/components/TextAreaField/index.d.ts +3 -3
- package/lib/components/TextAreaField/styles.d.ts +5 -4
- package/lib/components/TextField/TextField.stories.d.ts +2 -2
- package/lib/components/TextField/index.d.ts +1 -1
- package/lib/components/TextField/styles.d.ts +1 -1
- package/lib/components/Totaliser/Totaliser.stories.d.ts +2 -2
- package/lib/components/Totaliser/index.d.ts +1 -1
- package/lib/components/Totaliser/styles.d.ts +4 -7
- package/lib/components/UserBlock/UserBlock.stories.d.ts +2 -2
- package/lib/components/UserBlock/index.d.ts +2 -2
- package/lib/components/index.d.ts +2 -2
- 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/README.md.js +1 -1
- package/lib/es/src/components/Avatar/README.md.js.map +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/README.md.js +1 -1
- package/lib/es/src/components/Button/README.md.js.map +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/README.md.js +1 -1
- package/lib/es/src/components/Checkbox/README.md.js.map +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/README.md.js +1 -1
- package/lib/es/src/components/PopOver/README.md.js.map +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/README.md.js +1 -1
- package/lib/es/src/components/Radio/README.md.js.map +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/README.md.js +2 -0
- package/lib/es/src/components/RadioConsent/README.md.js.map +1 -0
- package/lib/es/src/components/{RadioGroup → RadioConsent}/index.js +0 -0
- package/lib/es/src/components/{RadioGroup → RadioConsent}/index.js.map +0 -0
- package/lib/es/src/components/RadioConsent/styles.js +2 -0
- package/lib/es/src/components/{RadioGroup → RadioConsent}/styles.js.map +0 -0
- 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/README.md.js +1 -1
- package/lib/es/src/components/TextAreaField/README.md.js.map +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/README.md.js +1 -1
- package/lib/es/src/components/TextField/README.md.js.map +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/README.md.js +1 -1
- package/lib/es/src/components/Totaliser/README.md.js.map +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/components/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 +11 -13
- package/package.json +39 -25
- package/lib/cjs/src/components/RadioGroup/README.md.js +0 -2
- package/lib/cjs/src/components/RadioGroup/README.md.js.map +0 -1
- package/lib/cjs/src/components/RadioGroup/styles.js +0 -2
- package/lib/components/RadioGroup/Radio.stories.d.ts +0 -6
- package/lib/components/RadioGroup/index.d.ts +0 -24
- package/lib/es/src/components/RadioGroup/README.md.js +0 -2
- package/lib/es/src/components/RadioGroup/README.md.js.map +0 -1
- package/lib/es/src/components/RadioGroup/styles.js +0 -2
- 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,5 +1,5 @@
|
|
|
1
|
-
import { Story, Meta } from
|
|
2
|
-
import { PopOverProps } from
|
|
1
|
+
import { Story, Meta } from "@storybook/react";
|
|
2
|
+
import { PopOverProps } from ".";
|
|
3
3
|
declare const _default: Meta<PopOverProps>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const PopOverDefault: Story<PopOverProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FC, ReactNode } from
|
|
2
|
-
import { PopOverPositionType } from
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { PopOverPositionType } from "../../types";
|
|
3
3
|
export declare type PopOverProps = {
|
|
4
4
|
/** used for aria-label of modal */
|
|
5
5
|
modalLabel: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Story, Meta } from
|
|
2
|
-
import { ProgressBarProps } from
|
|
1
|
+
import { Story, Meta } from "@storybook/react";
|
|
2
|
+
import { ProgressBarProps } from ".";
|
|
3
3
|
declare const _default: Meta<ProgressBarProps>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const ProgressBarDefault: Story<ProgressBarProps>;
|
|
@@ -4,11 +4,11 @@ declare type LineProgressBarProps = {
|
|
|
4
4
|
percentage: number;
|
|
5
5
|
barColor?: string;
|
|
6
6
|
};
|
|
7
|
-
export declare const LineProgressBar: import("styled-components").StyledComponent<"div", any, LineProgressBarProps, never>;
|
|
8
|
-
export declare const ScreenReaderOnly: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
9
7
|
declare type CircularColorFillProps = {
|
|
10
8
|
barColor?: string;
|
|
11
9
|
};
|
|
10
|
+
export declare const LineProgressBar: import("styled-components").StyledComponent<"div", any, LineProgressBarProps, never>;
|
|
11
|
+
export declare const ScreenReaderOnly: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
12
12
|
export declare const CircularColorFill: import("styled-components").StyledComponent<"span", any, CircularColorFillProps, never>;
|
|
13
13
|
export declare const CircularLeft: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
14
14
|
export declare const CircularRight: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Story, Meta } from
|
|
2
|
-
import { RadioProps } from
|
|
1
|
+
import { Story, Meta } from "@storybook/react";
|
|
2
|
+
import { RadioProps } from ".";
|
|
3
3
|
declare const _default: Meta<RadioProps>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const RadioDefault: Story<RadioProps>;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
+
import { ThemeType } from "../../types";
|
|
2
|
+
declare type ThemeProp = {
|
|
3
|
+
theme: ThemeType;
|
|
4
|
+
};
|
|
1
5
|
export declare const CheckWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
6
|
export declare const Check: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
3
|
-
declare type
|
|
7
|
+
declare type CheckedProp = {
|
|
4
8
|
checked: boolean;
|
|
9
|
+
};
|
|
10
|
+
declare type DisabledProp = {
|
|
5
11
|
disabled: boolean;
|
|
6
|
-
hasError: boolean;
|
|
7
12
|
};
|
|
8
|
-
export declare const StyledLabel: import("styled-components").StyledComponent<"label", any,
|
|
13
|
+
export declare const StyledLabel: import("styled-components").StyledComponent<"label", any, {
|
|
14
|
+
hasError: boolean;
|
|
15
|
+
} & ThemeProp & CheckedProp & DisabledProp, never>;
|
|
9
16
|
export declare const VerticalAlign: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
10
17
|
export declare const SelectedBorder: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
18
|
export declare const StyledInput: import("styled-components").StyledComponent<"input", any, {}, never>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Story, Meta } from "@storybook/react";
|
|
2
|
+
import { RadioConsentProps } from ".";
|
|
3
|
+
declare const _default: Meta<RadioConsentProps>;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const RadioDefault: Story<RadioConsentProps>;
|
|
6
|
+
export declare const SU2CRadio: Story<RadioConsentProps>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React, { FunctionComponent } from "react";
|
|
2
|
+
export declare type RadioConsentProps = {
|
|
3
|
+
/** because each radio has its own label this is the consent group label text */
|
|
4
|
+
legend: string;
|
|
5
|
+
/** array of option for radio constent group where option is the option name and value is the option value */
|
|
6
|
+
attributes: Array<{
|
|
7
|
+
value: string;
|
|
8
|
+
option: string;
|
|
9
|
+
}>;
|
|
10
|
+
/** on change handler callback passed change event */
|
|
11
|
+
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
12
|
+
/** set the value of selected option */
|
|
13
|
+
selectedValue?: string;
|
|
14
|
+
/** name of field this is what groups all the options together */
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* RadioConsent is a component for showing a bunch of yes/no radios predominantly used for notification selections where a unselected state is usefull for analytics.
|
|
20
|
+
*
|
|
21
|
+
* This is always a controlled component that will only change state with the selectedValue prop
|
|
22
|
+
*/
|
|
23
|
+
declare const RadioConsent: FunctionComponent<RadioConsentProps>;
|
|
24
|
+
export default RadioConsent;
|
|
@@ -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 {};
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Story, Meta } from
|
|
2
|
-
import { SelectProps } from
|
|
1
|
+
import { Story, Meta } from "@storybook/react";
|
|
2
|
+
import { SelectProps } from ".";
|
|
3
3
|
declare const _default: Meta<SelectProps>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const SelectWithLabel: Story<SelectProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FunctionComponent, ReactNode, SelectHTMLAttributes, Ref } from
|
|
1
|
+
import { FunctionComponent, ReactNode, SelectHTMLAttributes, Ref } from "react";
|
|
2
2
|
export declare type SelectProps = SelectHTMLAttributes<HTMLSelectElement> & {
|
|
3
3
|
/** error message text */
|
|
4
4
|
errorMessage?: string;
|
|
@@ -8,11 +8,14 @@ export declare type SelectProps = SelectHTMLAttributes<HTMLSelectElement> & {
|
|
|
8
8
|
label: string;
|
|
9
9
|
/** hind text or custom component */
|
|
10
10
|
hintText?: ReactNode;
|
|
11
|
+
/** flag to stop (required) appearing in label, useful for compound form components like DateInput */
|
|
12
|
+
hideRequiredInLabel?: boolean;
|
|
11
13
|
/** react DOM reference of object used scrolling to it with errors etc */
|
|
12
14
|
ref?: Ref<HTMLSelectElement>;
|
|
13
15
|
};
|
|
14
16
|
/**
|
|
15
17
|
* Select components are used for collecting user provided information from a list of options.
|
|
18
|
+
*
|
|
16
19
|
*/
|
|
17
20
|
declare const Select: FunctionComponent<SelectProps>;
|
|
18
21
|
export default Select;
|
|
@@ -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,5 +1,5 @@
|
|
|
1
|
-
import { Story, Meta } from
|
|
2
|
-
import { StepProps } from
|
|
1
|
+
import { Story, Meta } from "@storybook/react";
|
|
2
|
+
import { StepProps } from ".";
|
|
3
3
|
declare const _default: Meta<StepProps>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const StepsDefault: Story<StepProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Story, Meta } from
|
|
2
|
-
import { TextProps } from
|
|
1
|
+
import { Story, Meta } from "@storybook/react";
|
|
2
|
+
import { TextProps } from ".";
|
|
3
3
|
declare const _default: Meta<TextProps>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const TextDefault: Story;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FunctionComponent, HTMLAttributes, Ref } from
|
|
2
|
-
import { SpacingProps } from
|
|
3
|
-
import { WordBreakType, FontSizeType, ColorKeyType } from
|
|
1
|
+
import { FunctionComponent, HTMLAttributes, Ref } from "react";
|
|
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
|
*/
|
|
@@ -8,7 +8,7 @@ export declare type TextProps = SpacingProps & HTMLAttributes<HTMLElement> & {
|
|
|
8
8
|
/** text colour */
|
|
9
9
|
textColor?: ColorKeyType | string;
|
|
10
10
|
/** text horizontal alignment */
|
|
11
|
-
textAlign?:
|
|
11
|
+
textAlign?: "left" | "right" | "center" | "justify";
|
|
12
12
|
/** font size FontSizeType t-shirt sizes */
|
|
13
13
|
textSize?: FontSizeType;
|
|
14
14
|
/** font weight theme.typography{fontWeightHeavy/fontWeightMedium/fontWeightLight/fontWeightVLight} is better than a random number */
|
|
@@ -1,8 +1,8 @@
|
|
|
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?:
|
|
5
|
-
textAlign?:
|
|
4
|
+
textColor?: ColorKeyType;
|
|
5
|
+
textAlign?: "left" | "right" | "center" | "justify";
|
|
6
6
|
textSize?: FontSizeType;
|
|
7
7
|
textWeight?: number;
|
|
8
8
|
as?: any;
|
|
@@ -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;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Story, Meta } from
|
|
2
|
-
import { TextAreaFieldProps } from
|
|
1
|
+
import { Story, Meta } from "@storybook/react";
|
|
2
|
+
import { TextAreaFieldProps } from ".";
|
|
3
3
|
declare const _default: Meta<TextAreaFieldProps>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const TextAreaFieldDefault: Story<TextAreaFieldProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FunctionComponent, ReactNode, TextareaHTMLAttributes, Ref } from
|
|
1
|
+
import { FunctionComponent, ReactNode, TextareaHTMLAttributes, Ref } from "react";
|
|
2
2
|
export declare type TextAreaFieldProps = TextareaHTMLAttributes<HTMLTextAreaElement> & {
|
|
3
3
|
/** error message text */
|
|
4
4
|
errorMessage?: string;
|
|
@@ -9,8 +9,8 @@ export declare type TextAreaFieldProps = TextareaHTMLAttributes<HTMLTextAreaElem
|
|
|
9
9
|
/** label text */
|
|
10
10
|
label: string;
|
|
11
11
|
/** resize behaviour using the resize button on the bottom right of the component */
|
|
12
|
-
resize?:
|
|
13
|
-
/** number of visible lines of text before scroll is required this affect the height of the input field*/
|
|
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 */
|
|
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
|
-
resize:
|
|
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,5 +1,5 @@
|
|
|
1
|
-
import { Story, Meta } from
|
|
2
|
-
import { TextFieldProps } from
|
|
1
|
+
import { Story, Meta } from "@storybook/react";
|
|
2
|
+
import { TextFieldProps } from ".";
|
|
3
3
|
declare const _default: Meta<TextFieldProps>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const TextFieldDefault: Story<TextFieldProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FunctionComponent, InputHTMLAttributes, ReactNode, Ref } from
|
|
1
|
+
import { FunctionComponent, InputHTMLAttributes, ReactNode, Ref } from "react";
|
|
2
2
|
export declare type TextFieldProps = InputHTMLAttributes<HTMLInputElement> & {
|
|
3
3
|
/** error message text */
|
|
4
4
|
errorMessage?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Story, Meta } from
|
|
2
|
-
import { TotaliserProps } from
|
|
1
|
+
import { Story, Meta } from "@storybook/react";
|
|
2
|
+
import { TotaliserProps } from ".";
|
|
3
3
|
declare const _default: Meta<TotaliserProps>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const TotaliserWithTarget: Story<TotaliserProps>;
|
|
@@ -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,5 +1,5 @@
|
|
|
1
|
-
import { Story, Meta } from
|
|
2
|
-
import { UserBlockProps } from
|
|
1
|
+
import { Story, Meta } from "@storybook/react";
|
|
2
|
+
import { UserBlockProps } from ".";
|
|
3
3
|
declare const _default: Meta<UserBlockProps>;
|
|
4
4
|
export default _default;
|
|
5
5
|
export declare const UserBlockDefault: Story;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC, ReactNode, HTMLAttributes } from
|
|
1
|
+
import { FC, ReactNode, HTMLAttributes } from "react";
|
|
2
2
|
export declare type UserBlockProps = HTMLAttributes<HTMLElement> & {
|
|
3
3
|
/** name component or text */
|
|
4
4
|
name?: ReactNode;
|
|
@@ -9,7 +9,7 @@ export declare type UserBlockProps = HTMLAttributes<HTMLElement> & {
|
|
|
9
9
|
/** extra content component appears underneath name */
|
|
10
10
|
extra?: ReactNode;
|
|
11
11
|
/** size of avatar component */
|
|
12
|
-
size?:
|
|
12
|
+
size?: "s" | "m" | "l" | "xl";
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
15
|
* Display an avatar with title and subtitle
|
|
@@ -23,7 +23,7 @@ export { default as Pagination } from "./Pagination";
|
|
|
23
23
|
export { default as PopOver } from "./PopOver";
|
|
24
24
|
export { default as ProgressBar } from "./ProgressBar";
|
|
25
25
|
export { default as Radio } from "./Radio";
|
|
26
|
-
export { default as
|
|
26
|
+
export { default as RadioConsent } from "./RadioConsent";
|
|
27
27
|
export { default as Select } from "./Select";
|
|
28
28
|
export { default as Step } from "./Step";
|
|
29
29
|
export { default as Text } from "./Text";
|
|
@@ -54,7 +54,7 @@ export { default as PaginationReadme } from "./Pagination/README.md";
|
|
|
54
54
|
export { default as PopOverReadme } from "./PopOver/README.md";
|
|
55
55
|
export { default as ProgressBarReadme } from "./ProgressBar/README.md";
|
|
56
56
|
export { default as RadioReadme } from "./Radio/README.md";
|
|
57
|
-
export { default as
|
|
57
|
+
export { default as RadioConsentReadme } from "./RadioConsent/README.md";
|
|
58
58
|
export { default as SelectReadme } from "./Select/README.md";
|
|
59
59
|
export { default as StepReadme } from "./Step/README.md";
|
|
60
60
|
export { default as TextReadme } from "./Text/README.md";
|
|
@@ -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":"ufAOA,IAAIA,EAAa,GACbC,EAAyBC,EAAMC,YAAW,SAAqBC,EAAOC,GACxE,IAAIC,EAEAC,EAAkBL,EAAMM,WACxBC,EAAeF,EAAgB,GAC/BG,EAAcH,EAAgB,GAE9BI,EAAWT,EAAMU,SACjBC,EAAWX,EAAMU,QAAO,GACxBE,EAAyBZ,EAAMU,OAAO,MACtCG,EAAWX,EAAMW,SACjBC,EAAWZ,EAAMY,SACjBC,EAAgBb,EAAMa,cACtBC,EAAkBd,EAAMc,gBACxBC,EAAaf,EAAMe,WACnBC,EAAYhB,EAAMgB,UAClBC,EAAqBjB,EAAMiB,mBAC3BC,EAAQlB,EAAMkB,MACdC,EAAYnB,EAAMmB,UAClBC,EAAYpB,EAAMoB,UAClBC,EAAgBrB,EAAMsB,OACtBA,OAA2B,IAAlBD,EAA2BzB,EAAayB,EACjDE,EAAYvB,EAAMwB,GAClBC,OAA0B,IAAdF,EAAuB,MAAQA,EAC3CG,EAAmB1B,EAAM2B,UACzBC,OAAsC,IAArBF,EAA8B,GAAKA,EACpDG,EAAU7B,EAAM8B,QAChBC,EAAoB/B,EAAMgC,YAC1BC,EAAuBjC,EAAMkC,aAC7BC,EAAyBnC,EAAMoC,eAG/BC,EADmBvC,EAAMM,SAAS,IACZ,GAGtB8B,EAAepC,EAAMwC,aAAY,WACnC5B,EAAuB6B,QAAU7B,EAAuB6B,SAAWC,UAAYA,SAASC,cAEpFlC,EAASgC,SAAWN,GACtBA,EAAqB1B,EAASgC,SAGhC9B,EAAS8B,SAAU,IAClB,CAACN,IACAG,EAAiBtC,EAAMwC,aAAY,WACrC7B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TvE,SAAUF,EACVO,SAAUA,EACVE,gBAAiBA,EACjBC,WAAYA,EACZC,UAAWA,EACXI,UAAWA,EACXE,OAAQA,EACRY,aAAcA,EACdE,eAAgBA,EAChBJ,YAAaA,IACElC,EAAM0E,cAAc/C,EAAWwC,EAAS,CACvDc,IAAKT,GACJ3C,EAAW,CACZR,UAAWA,EACXmC,OAAQA,EACRJ,QAASA,IACPvC,GAAW0D,GAAiCvE,EAAM0E,cAAc,MAAO,CACzE,oBAAoB,EACpBG,SAAU/D,GAAY,EAAI,EAC1BgE,MAAOC,QAGXhF,EAAUmF,UAAqC,eAAzBtB,QAAQC,IAAIC,SAA4B,CAC5DjD,SAAUsE,EACVrE,SAAUsE,EACVlD,YAAamD,EAAU,CAACD,EAAME,IAC9BvE,cAAeqE,EACfjE,mBAAoBiE,EACpBlE,UAAWkE,EACXpE,gBAAiBoE,EACjBnE,WAAYmE,EACZhE,MAAOmE,EACPlE,UAAWkE,EACXjE,UAAWkE,EACXhE,OAAQiE,EAAQC,GAChBhE,GAAI2D,EAAU,CAACE,EAAQC,EAAMF,IAC7BzD,UAAWyD,EACXlD,aAAcoD,EACdlD,eAAgBkD,EAChBxD,QAAS0D,EAAIC,YACX,GACJ5F,EAAU6F,aAAe,CACvB/E,cAAUmC,EACVlC,UAAU,EACVoB,aAAa,EACbnB,eAAe,EACfG,WAAW,EACXF,iBAAiB,EACjBC,YAAY,EACZE,wBAAoB6B,EACpB5B,WAAO4B,EACP3B,eAAW2B,EACX1B,eAAW0B,EACXxB,YAAQwB,EACRtB,GAAI,MACJG,UAAW,GACXO,kBAAcY,EACdV,oBAAgBU,GAElB,MAAejD"}
|
|
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":"yhBAQA,IAAIA,EAAa,GACbC,EAAyBC,EAAMC,YAAW,SAAqBC,EAAOC,GACxE,IAAIC,EAEAC,EAAkBL,EAAMM,WACxBC,EAAeF,EAAgB,GAC/BG,EAAcH,EAAgB,GAE9BI,EAAWT,EAAMU,SACjBC,EAAWX,EAAMU,QAAO,GACxBE,EAAyBZ,EAAMU,OAAO,MACtCG,EAAWX,EAAMW,SACjBC,EAAWZ,EAAMY,SACjBC,EAAgBb,EAAMa,cACtBC,EAAkBd,EAAMc,gBACxBC,EAAaf,EAAMe,WACnBC,EAAYhB,EAAMgB,UAClBC,EAAqBjB,EAAMiB,mBAC3BC,EAAQlB,EAAMkB,MACdC,EAAYnB,EAAMmB,UAClBC,EAAYpB,EAAMoB,UAClBC,EAAgBrB,EAAMsB,OACtBA,OAA2B,IAAlBD,EAA2BzB,EAAayB,EACjDE,EAAYvB,EAAMwB,GAClBC,OAA0B,IAAdF,EAAuB,MAAQA,EAC3CG,EAAmB1B,EAAM2B,UACzBC,OAAsC,IAArBF,EAA8B,GAAKA,EACpDG,EAAU7B,EAAM8B,QAChBC,EAAoB/B,EAAMgC,YAC1BC,EAAuBjC,EAAMkC,aAC7BC,EAAyBnC,EAAMoC,eAG/BC,EADmBvC,EAAMM,SAAS,IACZ,GAGtB8B,EAAepC,EAAMwC,aAAY,WACnC5B,EAAuB6B,QAAU7B,EAAuB6B,SAAWC,UAAYA,SAASC,cAEpFlC,EAASgC,SAAWN,GACtBA,EAAqB1B,EAASgC,SAGhC9B,EAAS8B,SAAU,IAClB,C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-
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":"kgBAOA,IAIIA,EAAc,WAChB,OAJOC,UAAYA,SAASC,gBAAkBD,SAASE,MAI/BC,KAGtBC,EAAiB,KACjBC,EAAkB,KAClBC,EAAsB,KACtBC,GAAwB,EAExBC,EAAmB,WACrB,OAAO,GAkBT,SAASC,EAAUC,EAAYC,EAAKC,EAAMC,GACxC,IAAIC,EAAY,KACZC,EAAIL,EAER,EAAG,CACD,IAAIM,EAAOH,EAASE,GAEpB,GAAIC,EAAKC,MACHD,EAAKE,KAAKC,QAAQC,iBACpBN,EAAYE,OAET,CAAA,IAAIA,EAAKK,SAQd,MAPA,GAAIN,IAAML,EAER,OAGFI,EAAY,aAINC,GAAKH,KAAUD,GAErBG,IACFA,EAAUI,KAAKI,SAAW,GAI9B,IAAIC,EAAa,SAAoBC,GACnC,OAAOA,GAAO,YAAaA,EAAMA,EAAIC,QAAUD,GAa7CE,EAAe,WACjB,IA/CqDC,EA+CjDC,GAAS,EAEb,GAAIxB,EAAgB,CAClB,IAAIyB,EAAkBzB,EAClB0B,EAAWD,EAAgBC,SAC3BC,EAAkBF,EAAgBE,gBAClCC,EAAYH,EAAgBG,UAC5BC,EAASJ,EAAgBI,OACzBC,EAAaL,EAAgBK,WAC7BC,EAAcL,GAAYxB,GAAuBA,EAAoB8B,gBACrEnC,EAAgBD,UAAYA,SAASC,cAEzC,GAAIkC,EAAa,CACf,IAAIE,EAAc,CAACF,GAAaG,OAAOL,EAAOM,IAAIhB,GAAYiB,OAAOC,UAuBrE,GArBKxC,IAzEY,SAA0BA,GAC/C,OAAQG,EAAesC,WAAalC,GAAkBP,GAwE5B0C,CAAiB1C,KACjC8B,IAAmCG,EAxBpCO,QAAQlC,GAIgB,cAA1BA,KAoBsDR,MAAkBM,GAAmB2B,MACtFG,GAAiBS,EAAYP,KAhEYV,EAgEwB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SAAU6C,GAEhC,OADeA,EAAMC,eAKzB,SAAmCC,GACjC,IAAIC,EAAOD,EAAME,OAAO,GAAG,GAEvBD,IAASpF,IArBbJ,SAAS0F,iBAAiB,UAAWhC,GAAQ,GAC7C1D,SAAS0F,iBAAiB,WAAY5B,GACtC6B,OAAOD,iBAAiB,OAAQrB,IAuBhC,IAAIuB,EAAWxF,EACXyF,EAAWD,GAAYJ,GAAQA,EAAKM,KAAOF,EAASE,GACxD1F,EAAiBoF,EAEbI,IAAaC,IACfD,EAASG,iBAEJR,EAAM/C,QAAO,SAAUwD,GAE1B,OADSA,EAAMF,KACDF,EAASE,MACtBrC,QAEDmC,EAASK,aAAaT,IAItBA,GACFnF,EAAkB,KAEbwF,GAAYD,EAAS9D,WAAa0D,EAAK1D,UAC1C0D,EAAKU,eAGPxE,IACAqC,EAAYrC,KA3Cd1B,SAASmG,oBAAoB,UAAWzC,GAAQ,GAChD1D,SAASmG,oBAAoB,WAAYrC,GACzC6B,OAAOQ,oBAAoB,OAAQ9B,GA4CjChE,EAAkB,QAaP8E,EA1FI,WACjB,OAAO"}
|
|
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":"kgBAOA,IAIIA,EAAc,WAChB,OAJOC,UAAYA,SAASC,gBAAkBD,SAASE,MAI/BC,KAGtBC,EAAiB,KACjBC,EAAkB,KAClBC,EAAsB,KACtBC,GAAwB,EAExBC,EAAmB,WACrB,OAAO,GAkBT,SAASC,EAAUC,EAAYC,EAAKC,EAAMC,GACxC,IAAIC,EAAY,KACZC,EAAIL,EAER,EAAG,CACD,IAAIM,EAAOH,EAASE,GAEpB,GAAIC,EAAKC,MACHD,EAAKE,KAAKC,QAAQC,iBACpBN,EAAYE,OAET,CAAA,IAAIA,EAAKK,SAQd,MAPA,GAAIN,IAAML,EAER,OAGFI,EAAY,aAINC,GAAKH,KAAUD,GAErBG,IACFA,EAAUI,KAAKI,SAAW,GAI9B,IAAIC,EAAa,SAAoBC,GACnC,OAAOA,GAAO,YAAaA,EAAMA,EAAIC,QAAUD,GAa7CE,EAAe,WACjB,IA/CqDC,EA+CjDC,GAAS,EAEb,GAAIxB,EAAgB,CAClB,IAAIyB,EAAkBzB,EAClB0B,EAAWD,EAAgBC,SAC3BC,EAAkBF,EAAgBE,gBAClCC,EAAYH,EAAgBG,UAC5BC,EAASJ,EAAgBI,OACzBC,EAAaL,EAAgBK,WAC7BC,EAAcL,GAAYxB,GAAuBA,EAAoB8B,gBACrEnC,EAAgBD,UAAYA,SAASC,cAEzC,GAAIkC,EAAa,CACf,IAAIE,EAAc,CAACF,GAAaG,OAAOL,EAAOM,IAAIhB,GAAYiB,OAAOC,UAuBrE,GArBKxC,IAzEY,SAA0BA,GAC/C,OAAQG,EAAesC,WAAalC,GAAkBP,GAwE5B0C,C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