@superrb/react-addons 3.0.0-23 → 3.0.0-24
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/components/accordion.d.ts +4 -5
- package/components/accordion.d.ts.map +1 -1
- package/components/accordion.js +4 -5
- package/components/back-to-top.d.ts +1 -2
- package/components/back-to-top.d.ts.map +1 -1
- package/components/back-to-top.js +2 -3
- package/components/button.d.ts.map +1 -1
- package/components/button.js +3 -3
- package/components/context-wrapper.d.ts +1 -2
- package/components/context-wrapper.d.ts.map +1 -1
- package/components/context-wrapper.js +3 -2
- package/components/cookie-banner.d.ts +2 -3
- package/components/cookie-banner.d.ts.map +1 -1
- package/components/cookie-banner.js +2 -3
- package/components/form/error-message.d.ts +1 -2
- package/components/form/error-message.d.ts.map +1 -1
- package/components/form/error-message.js +2 -3
- package/components/form/field.d.ts +2 -2
- package/components/form/field.d.ts.map +1 -1
- package/components/form/field.js +2 -3
- package/components/form/submit-button.d.ts +2 -3
- package/components/form/submit-button.d.ts.map +1 -1
- package/components/form/submit-button.js +2 -3
- package/components/form/success-message.d.ts +1 -2
- package/components/form/success-message.d.ts.map +1 -1
- package/components/form/success-message.js +3 -2
- package/components/form.d.ts.map +1 -1
- package/components/form.js +17 -15
- package/components/menu-toggle.d.ts +2 -2
- package/components/menu-toggle.d.ts.map +1 -1
- package/components/menu-toggle.js +2 -3
- package/components/modal.d.ts +2 -2
- package/components/modal.d.ts.map +1 -1
- package/components/modal.js +2 -3
- package/components/skip-to.d.ts +1 -2
- package/components/skip-to.d.ts.map +1 -1
- package/components/skip-to.js +2 -3
- package/components/slideshow-buttons.d.ts +2 -3
- package/components/slideshow-buttons.d.ts.map +1 -1
- package/components/slideshow-buttons.js +2 -3
- package/components/slideshow-pagination.d.ts +2 -3
- package/components/slideshow-pagination.d.ts.map +1 -1
- package/components/slideshow-pagination.js +3 -2
- package/context/modal-context-provider.d.ts +1 -1
- package/context/modal-context-provider.d.ts.map +1 -1
- package/context/modal-context-provider.js +2 -2
- package/context/nav-context-provider.d.ts +1 -1
- package/context/nav-context-provider.d.ts.map +1 -1
- package/context/nav-context-provider.js +2 -2
- package/hooks/use-async.d.ts +3 -2
- package/hooks/use-async.d.ts.map +1 -1
- package/hooks/use-async.js +3 -4
- package/hooks/use-draggable-scroll.d.ts +3 -3
- package/hooks/use-draggable-scroll.d.ts.map +1 -1
- package/hooks/use-draggable-scroll.js +2 -3
- package/hooks/use-event-listener.d.ts +2 -2
- package/hooks/use-event-listener.d.ts.map +1 -1
- package/hooks/use-event-listener.js +3 -10
- package/hooks/use-hide-on-scroll.d.ts +1 -2
- package/hooks/use-hide-on-scroll.d.ts.map +1 -1
- package/hooks/use-hide-on-scroll.js +2 -3
- package/hooks/use-id.d.ts +1 -2
- package/hooks/use-id.d.ts.map +1 -1
- package/hooks/use-id.js +2 -3
- package/hooks/use-is-in-viewport.d.ts +1 -2
- package/hooks/use-is-in-viewport.d.ts.map +1 -1
- package/hooks/use-is-in-viewport.js +2 -3
- package/hooks/use-is-mobile.d.ts +1 -2
- package/hooks/use-is-mobile.d.ts.map +1 -1
- package/hooks/use-is-mobile.js +2 -3
- package/hooks/use-is-overflowing.d.ts +1 -2
- package/hooks/use-is-overflowing.d.ts.map +1 -1
- package/hooks/use-is-overflowing.js +5 -4
- package/hooks/use-lock-body-scroll.d.ts +1 -2
- package/hooks/use-lock-body-scroll.d.ts.map +1 -1
- package/hooks/use-lock-body-scroll.js +1 -2
- package/hooks/use-modal.d.ts +1 -2
- package/hooks/use-modal.d.ts.map +1 -1
- package/hooks/use-modal.js +2 -3
- package/hooks/use-motion-allowed.d.ts +1 -2
- package/hooks/use-motion-allowed.d.ts.map +1 -1
- package/hooks/use-motion-allowed.js +2 -3
- package/hooks/use-parallax.d.ts +1 -2
- package/hooks/use-parallax.d.ts.map +1 -1
- package/hooks/use-parallax.js +2 -3
- package/hooks/use-slideshow.d.ts +5 -6
- package/hooks/use-slideshow.d.ts.map +1 -1
- package/hooks/use-slideshow.js +11 -12
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/utils/animate.d.ts +1 -2
- package/utils/animate.d.ts.map +1 -1
- package/utils/animate.js +24 -23
- package/utils/extend-class.d.ts +1 -2
- package/utils/extend-class.d.ts.map +1 -1
- package/utils/extend-class.js +8 -7
- package/utils/get-y-pos.d.ts +1 -2
- package/utils/get-y-pos.d.ts.map +1 -1
- package/utils/get-y-pos.js +2 -3
- package/utils/get.d.ts +2 -2
- package/utils/get.d.ts.map +1 -1
- package/utils/get.js +1 -2
- package/utils/is-external-link.d.ts +1 -2
- package/utils/is-external-link.d.ts.map +1 -1
- package/utils/is-external-link.js +2 -3
- package/utils/scroll-to-hash.d.ts +1 -2
- package/utils/scroll-to-hash.d.ts.map +1 -1
- package/utils/scroll-to-hash.js +2 -3
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
export declare
|
|
2
|
+
export declare function AccordionItem({ title, expanded, children, }: PropsWithChildren<{
|
|
3
3
|
title: string;
|
|
4
4
|
expanded?: boolean;
|
|
5
|
-
}>)
|
|
6
|
-
export declare
|
|
5
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function Accordion({ multiple, children, }: PropsWithChildren<{
|
|
7
7
|
multiple?: boolean;
|
|
8
|
-
}>)
|
|
9
|
-
export default Accordion;
|
|
8
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
10
9
|
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../src/components/accordion.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,iBAAiB,EAMlB,MAAM,OAAO,CAAA;AAcd,
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../src/components/accordion.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,iBAAiB,EAMlB,MAAM,OAAO,CAAA;AAcd,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,QAAgB,EAChB,QAAQ,GACT,EAAE,iBAAiB,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,2CA4D1D;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAgB,EAChB,QAAQ,GACT,EAAE,iBAAiB,CAAC;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,2CAwB3C"}
|
package/components/accordion.js
CHANGED
|
@@ -6,7 +6,7 @@ const AccordionContext = createContext({
|
|
|
6
6
|
expandedItems: [],
|
|
7
7
|
setExpandedItems: () => { },
|
|
8
8
|
});
|
|
9
|
-
export
|
|
9
|
+
export function AccordionItem({ title, expanded = false, children, }) {
|
|
10
10
|
const { multiple, expandedItems, setExpandedItems } = useContext(AccordionContext);
|
|
11
11
|
const id = useId();
|
|
12
12
|
useEffect(() => {
|
|
@@ -32,8 +32,8 @@ export const AccordionItem = ({ title, expanded = false, children, }) => {
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
return (_jsxs(_Fragment, { children: [_jsxs("button", { "aria-selected": expandedItems.includes(id), "aria-controls": `${id}-panel`, className: "accordion__trigger", onClick: toggle, role: "tab", "aria-label": title, id: `${id}-trigger`, children: [_jsx("span", { className: "screenreader-text", children: expandedItems ? 'Close' : 'Expand' }), title] }), _jsx("div", { className: "accordion__content", role: "tabpanel", "aria-labelledby": `${id}-trigger`, id: `${id}-panel`, children: children })] }));
|
|
35
|
-
}
|
|
36
|
-
export
|
|
35
|
+
}
|
|
36
|
+
export function Accordion({ multiple = false, children, }) {
|
|
37
37
|
const [expandedItemsStorage, setExpandedItemsStorage] = useState([]);
|
|
38
38
|
const setExpandedItems = (newState) => {
|
|
39
39
|
setExpandedItemsStorage((items) => [...new Set(newState(items))]);
|
|
@@ -46,5 +46,4 @@ export const Accordion = ({ multiple = false, children, }) => {
|
|
|
46
46
|
expandedItems: expandedItemsStorage,
|
|
47
47
|
setExpandedItems,
|
|
48
48
|
}, children: _jsx("div", { className: "accordion", role: "tablist", "aria-multiselectable": multiple, children: children }) }));
|
|
49
|
-
}
|
|
50
|
-
export default Accordion;
|
|
49
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"back-to-top.d.ts","sourceRoot":"","sources":["../src/components/back-to-top.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"back-to-top.d.ts","sourceRoot":"","sources":["../src/components/back-to-top.tsx"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,SAAS,4CAMhC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
export default function BackToTop() {
|
|
3
3
|
return (_jsx("div", { className: "back-to-top", id: "back-to-top", children: _jsx("a", { href: "#top", children: "Back to Top" }) }));
|
|
4
|
-
}
|
|
5
|
-
export default BackToTop;
|
|
4
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../src/components/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EAEpB,cAAc,EACd,iBAAiB,EAEjB,iBAAiB,EAGlB,MAAM,OAAO,CAAA;AAGd,KAAK,KAAK,GAAG,CACT,iBAAiB,CAAC,cAAc,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,CAAC,GACxE,oBAAoB,CAAC,iBAAiB,CAAC,GACvC,oBAAoB,CAAC,iBAAiB,CAAC,CAC1C,GAAG;IACF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;;
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../src/components/button.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EAEpB,cAAc,EACd,iBAAiB,EAEjB,iBAAiB,EAGlB,MAAM,OAAO,CAAA;AAGd,KAAK,KAAK,GAAG,CACT,iBAAiB,CAAC,cAAc,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,CAAC,GACxE,oBAAoB,CAAC,iBAAiB,CAAC,GACvC,oBAAoB,CAAC,iBAAiB,CAAC,CAC1C,GAAG;IACF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;;AA8DD,wBAAuC;AACvC,YAAY,EAAE,KAAK,IAAI,WAAW,EAAE,CAAA"}
|
package/components/button.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, memo, } from 'react';
|
|
3
3
|
import { extendClass } from '../utils';
|
|
4
|
-
|
|
4
|
+
function Button({ children, label, label_a11y, onClick, className = '', href, ...props }, ref) {
|
|
5
5
|
className = `button ${className}`;
|
|
6
6
|
const renderedChildren = (_jsxs(_Fragment, { children: [label_a11y && _jsx("span", { className: "screenreader-text", children: label_a11y }), label && (_jsx("span", { className: `${extendClass(className, 'label')}`, "aria-hidden": label_a11y !== undefined, "data-text": label, children: label })), children] }));
|
|
7
7
|
const linkProps = {
|
|
@@ -22,5 +22,5 @@ const Button = forwardRef(({ children, label, label_a11y, onClick, className = '
|
|
|
22
22
|
ref,
|
|
23
23
|
};
|
|
24
24
|
return _jsx("button", { ...buttonProps, children: renderedChildren });
|
|
25
|
-
}
|
|
26
|
-
export default memo(Button);
|
|
25
|
+
}
|
|
26
|
+
export default memo(forwardRef(Button));
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
|
|
3
|
-
export default ContextWrapper;
|
|
2
|
+
export default function ContextWrapper({ children }: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
|
|
4
3
|
//# sourceMappingURL=context-wrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-wrapper.d.ts","sourceRoot":"","sources":["../src/components/context-wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAGzC,
|
|
1
|
+
{"version":3,"file":"context-wrapper.d.ts","sourceRoot":"","sources":["../src/components/context-wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAGzC,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,CAAC,EAAE,CAAC,2CAQzE"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { GoogleReCaptchaProvider } from 'react-google-recaptcha-v3';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
export default function ContextWrapper({ children }) {
|
|
4
|
+
return (_jsx(GoogleReCaptchaProvider, { reCaptchaKey: process.env.NEXT_PUBLIC_RECAPTCHA_KEY, children: children }));
|
|
5
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
|
|
2
|
+
export default function CookieBanner({ allowCustomisation, allowReject, title, text, formText, policyLink, policyLabel, acceptLabel, acceptAllLabel, rejectLabel, customiseLabel, tracking, necessary, renderAcceptButton, renderCustomiseButton, renderRejectButton, renderSubmitButton, }: {
|
|
3
3
|
allowCustomisation?: boolean;
|
|
4
4
|
allowReject?: boolean;
|
|
5
5
|
title?: string;
|
|
@@ -21,6 +21,5 @@ declare const CookieBanner: ({ allowCustomisation, allowReject, title, text, for
|
|
|
21
21
|
renderCustomiseButton?: (props: {}) => ReactNode;
|
|
22
22
|
renderRejectButton?: (props: {}) => ReactNode;
|
|
23
23
|
renderSubmitButton?: () => ReactNode;
|
|
24
|
-
})
|
|
25
|
-
export default CookieBanner;
|
|
24
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
26
25
|
//# sourceMappingURL=cookie-banner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie-banner.d.ts","sourceRoot":"","sources":["../src/components/cookie-banner.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAA;AA6BtD,
|
|
1
|
+
{"version":3,"file":"cookie-banner.d.ts","sourceRoot":"","sources":["../src/components/cookie-banner.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAuB,MAAM,OAAO,CAAA;AA6BtD,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,kBAAyB,EACzB,WAAmB,EACnB,KAAqB,EACrB,IAAmB,EACnB,QAA4B,EAC5B,UAA+B,EAC/B,WAAiC,EACjC,WAAiC,EACjC,cAAuC,EACvC,WAAiC,EACjC,cAAuC,EACvC,QAA2B,EAC3B,SAA6B,EAC7B,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,GACnB,EAAE;IACD,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACpC,SAAS,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;IACrC,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,SAAS,CAAA;IAC7C,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,SAAS,CAAA;IAChD,kBAAkB,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,SAAS,CAAA;IAC7C,kBAAkB,CAAC,EAAE,MAAM,SAAS,CAAA;CACrC,2CA4JA"}
|
|
@@ -25,7 +25,7 @@ const content = {
|
|
|
25
25
|
description: 'These cookies are necessary for the website to function and cannot be switched off.',
|
|
26
26
|
},
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
export default function CookieBanner({ allowCustomisation = true, allowReject = false, title = content.title, text = content.text, formText = content.form_text, policyLink = content.policyLink, policyLabel = content.policyLabel, acceptLabel = content.acceptLabel, acceptAllLabel = content.acceptAllLabel, rejectLabel = content.rejectLabel, customiseLabel = content.customiseLabel, tracking = content.tracking, necessary = content.necessary, renderAcceptButton, renderCustomiseButton, renderRejectButton, renderSubmitButton, }) {
|
|
29
29
|
const { cookiesAccepted, setCookiesAccepted, trackingCookiesAccepted, setTrackingCookiesAccepted, popupOpen, closePopup, } = useCookieStore();
|
|
30
30
|
const [animate, setAnimate] = useState(false);
|
|
31
31
|
const [formOpen, setFormOpen] = useState(false);
|
|
@@ -73,5 +73,4 @@ const CookieBanner = ({ allowCustomisation = true, allowReject = false, title =
|
|
|
73
73
|
setReady(true);
|
|
74
74
|
}, []);
|
|
75
75
|
return (_jsx(_Fragment, { children: ready && ((!rejected && !cookiesAccepted) || popupOpen) ? (_jsx("div", { className: `cookie-banner ${animate ? ' cookie-banner--hide' : ''} `, children: _jsx("div", { className: "cookie-banner__container container", children: _jsxs("div", { className: "cookie-banner__inner", children: [allowCustomisation && (_jsxs("div", { className: "cookie-banner__form", "aria-hidden": !formOpen, children: [formText && (_jsx("p", { className: "cookie-banner__form-text", children: formText })), _jsx(Form, { useRecaptcha: false, className: "cookie-banner__form", schema: schema, onSubmit: submit, renderSubmit: () => renderSubmitButton ? (renderSubmitButton()) : (_jsx(SubmitButton, { label: acceptLabel })), renderSuccessMessage: false })] })), _jsxs("div", { className: "cookie-banner__main", children: [_jsxs("div", { className: "cookie-banner__message", "aria-hidden": formOpen, children: [title && _jsx("h2", { className: "cookie-banner__title", children: title }), text && (_jsxs("p", { className: "cookie-banner__text", children: [text, " ", _jsx("a", { href: policyLink, children: policyLabel })] }))] }), _jsxs("div", { className: "cookie-banner__buttons", children: [allowCustomisation && !formOpen && (_jsx(_Fragment, { children: renderCustomiseButton ? (renderCustomiseButton({ onClick: openForm })) : (_jsx(Button, { onClick: openForm, className: "cookie-banner__customise", label: customiseLabel })) })), allowReject && !formOpen && (_jsx(_Fragment, { children: renderRejectButton ? (renderRejectButton({ onClick: reject })) : (_jsx(Button, { onClick: reject, className: "cookie-banner__reject", label: rejectLabel })) })), !formOpen && (_jsx(_Fragment, { children: renderAcceptButton ? (renderAcceptButton({ onClick: acceptAll })) : (_jsx(Button, { onClick: acceptAll, className: "cookie-banner__accept", label: trueAcceptLabel })) }))] })] })] }) }) })) : ('') }));
|
|
76
|
-
}
|
|
77
|
-
export default CookieBanner;
|
|
76
|
+
}
|
|
@@ -4,6 +4,5 @@ export interface ErrorMessageProps {
|
|
|
4
4
|
error?: FieldError | Merge<FieldError, FieldErrorsImpl<any>>;
|
|
5
5
|
fieldSchema?: AnySchema;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
export default ErrorMessage;
|
|
7
|
+
export default function ErrorMessage({ error }: ErrorMessageProps): import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
//# sourceMappingURL=error-message.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-message.d.ts","sourceRoot":"","sources":["../../src/components/form/error-message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAE/B,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,UAAU,GAAG,KAAK,CAAC,UAAU,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC,CAAA;IAC5D,WAAW,CAAC,EAAE,SAAS,CAAA;CACxB;AAED,
|
|
1
|
+
{"version":3,"file":"error-message.d.ts","sourceRoot":"","sources":["../../src/components/form/error-message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAE/B,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,UAAU,GAAG,KAAK,CAAC,UAAU,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC,CAAA;IAC5D,WAAW,CAAC,EAAE,SAAS,CAAA;CACxB;AAED,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE,iBAAiB,2CAQhE"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
export default function ErrorMessage({ error }) {
|
|
3
3
|
const GENERIC_ERROR = 'Sorry, an error occurred';
|
|
4
4
|
return (_jsx("span", { className: "form__error", children: error?.message || GENERIC_ERROR }));
|
|
5
|
-
}
|
|
6
|
-
export default ErrorMessage;
|
|
5
|
+
}
|
|
@@ -7,6 +7,6 @@ interface Props {
|
|
|
7
7
|
id?: string;
|
|
8
8
|
onInput?: FormEventHandler<HTMLElement>;
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
export
|
|
10
|
+
export default function FormField({ register, schema, id, onInput }: Props): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
12
|
//# sourceMappingURL=field.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/components/form/field.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAa,gBAAgB,EAAuB,MAAM,OAAO,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAEvD,UAAU,KAAK;IACb,QAAQ,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAA;IACvC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,CAAA;IACtB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAA;CACxC;AAED,
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../src/components/form/field.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAa,gBAAgB,EAAuB,MAAM,OAAO,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAEvD,UAAU,KAAK;IACb,QAAQ,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAA;IACvC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,CAAA;IACtB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAA;CACxC;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,2CA0EzE"}
|
package/components/form/field.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from 'react';
|
|
4
|
-
|
|
4
|
+
export default function FormField({ register, schema, id, onInput }) {
|
|
5
5
|
const [touched, setTouched] = useState(false);
|
|
6
6
|
const [rendered, setRendered] = useState(false);
|
|
7
7
|
const fieldProps = {
|
|
@@ -31,5 +31,4 @@ const FormField = ({ register, schema, id, onInput }) => {
|
|
|
31
31
|
return (_jsxs("select", { className: "form__control form__control--select", ...fieldProps, children: [schema?.spec?.meta?.placeholder ? (_jsx("option", { value: "", children: schema?.spec?.meta?.placeholder }, 'placeholder')) : null, schema?.spec?.meta?.options?.map((value, index) => (_jsx("option", { value: value, children: value }, value)))] }));
|
|
32
32
|
}
|
|
33
33
|
return (_jsx(_Fragment, { children: schema?.spec?.meta?.textarea === true ? (_jsx("textarea", { className: "form__control", ...fieldProps })) : schema?.type === 'boolean' ? (_jsx("input", { type: "checkbox", className: "form__control form__control--checkbox", checked: !rendered ? schema?.spec?.default : null, ...fieldProps })) : schema?.spec?.meta?.hidden === true ? (_jsx("input", { type: "hidden", className: "form__control form__control--hidden", ...fieldProps })) : schema?.type === 'mixed' ? (_jsx("input", { className: "form__control form__control--mixed", type: "file", ...fieldProps })) : (_jsx("input", { className: "form__control", ...fieldProps })) }));
|
|
34
|
-
}
|
|
35
|
-
export default FormField;
|
|
34
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export default function SubmitButton({ label }: {
|
|
2
2
|
label?: string;
|
|
3
|
-
})
|
|
4
|
-
export default SubmitButton;
|
|
3
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
4
|
//# sourceMappingURL=submit-button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit-button.d.ts","sourceRoot":"","sources":["../../src/components/form/submit-button.tsx"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"submit-button.d.ts","sourceRoot":"","sources":["../../src/components/form/submit-button.tsx"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,KAAK,EAAE,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,2CAIjE"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from '../../components';
|
|
3
|
-
|
|
3
|
+
export default function SubmitButton({ label }) {
|
|
4
4
|
return (_jsx(Button, { label: label || 'Submit', className: "form__submit", type: "submit" }));
|
|
5
|
-
}
|
|
6
|
-
export default SubmitButton;
|
|
5
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"success-message.d.ts","sourceRoot":"","sources":["../../src/components/form/success-message.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"success-message.d.ts","sourceRoot":"","sources":["../../src/components/form/success-message.tsx"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,cAAc,4CASrC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export default function SuccessMessage() {
|
|
3
|
+
return (_jsxs("div", { className: "success-message", children: [_jsx("h2", { className: "success-message__title", children: "Thanks for your message" }), _jsx("p", { className: "success-message__text", children: "We'll get back to you as soon as possible." })] }));
|
|
4
|
+
}
|
package/components/form.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../src/components/form.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,SAAS,EAQV,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAExD,OAAO,EAAE,UAAU,EAAW,MAAM,iBAAiB,CAAA;AAErD,OAAiB,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAa5C,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,YAAY,CAAC,GAAG,CAAC;IACpD,MAAM,EAAE,CAAC,CAAA;IACT,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG,CAAC,CAAA;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE;SAAG,CAAC,IAAI,CAAC,IAAI,MAAM,GAAG,GAAG;KAAE,CAAA;IACzC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAA;IACvC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,oBAAoB,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,GAAG,KAAK,CAAA;IAClE,kBAAkB,CAAC,EAAE,CACnB,KAAK,CAAC,EAAE,UAAU,EAClB,WAAW,CAAC,EAAE,SAAS,KACpB,SAAS,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,SAAS,CAAA;IAC9B,SAAS,CAAC,EAAE;SAAG,CAAC,IAAI,CAAC,IAAI,MAAM,GAAG,aAAa;KAAE,CAAA;IACjD,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;;
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../src/components/form.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,SAAS,EAQV,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAExD,OAAO,EAAE,UAAU,EAAW,MAAM,iBAAiB,CAAA;AAErD,OAAiB,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAa5C,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,YAAY,CAAC,GAAG,CAAC;IACpD,MAAM,EAAE,CAAC,CAAA;IACT,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,GAAG,CAAC,CAAA;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE;SAAG,CAAC,IAAI,CAAC,IAAI,MAAM,GAAG,GAAG;KAAE,CAAA;IACzC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAA;IACvC,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,oBAAoB,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,GAAG,KAAK,CAAA;IAClE,kBAAkB,CAAC,EAAE,CACnB,KAAK,CAAC,EAAE,UAAU,EAClB,WAAW,CAAC,EAAE,SAAS,KACpB,SAAS,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,SAAS,CAAA;IAC9B,SAAS,CAAC,EAAE;SAAG,CAAC,IAAI,CAAC,IAAI,MAAM,GAAG,aAAa;KAAE,CAAA;IACjD,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;;AA+QD,wBAA+B"}
|
package/components/form.js
CHANGED
|
@@ -11,19 +11,21 @@ import FormField from './form/field';
|
|
|
11
11
|
import SubmitButton from './form/submit-button';
|
|
12
12
|
import messages from './form/messages.json';
|
|
13
13
|
import { GoogleReCaptchaProvider, useGoogleReCaptcha, } from 'react-google-recaptcha-v3';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
14
|
+
function toBase64(file) {
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
const reader = new FileReader();
|
|
17
|
+
reader.onloadend = () => {
|
|
18
|
+
// Use a regex to remove data url part
|
|
19
|
+
const base64String = reader.result
|
|
20
|
+
?.toString()
|
|
21
|
+
.replace('data:', '')
|
|
22
|
+
.replace(/^.+,/, '');
|
|
23
|
+
resolve(base64String);
|
|
24
|
+
};
|
|
25
|
+
reader.readAsDataURL(file);
|
|
26
|
+
reader.onerror = reject;
|
|
27
|
+
});
|
|
28
|
+
}
|
|
27
29
|
const FormInner = forwardRef(function FormInner({ schema, name, action, className, initialData, onSubmit, method, onStatusChange = () => { }, renderSuccessMessage = (data) => _jsx(SuccessMessage, {}), renderErrorMessage = (error, fieldSchema) => (_jsx(ErrorMessage, { error: error, fieldSchema: fieldSchema })), renderSubmit = () => _jsx(SubmitButton, {}), renderers = {}, useRecaptcha = true, ...props }, ref) {
|
|
28
30
|
const [data, setData] = useState({});
|
|
29
31
|
const fieldRefs = useRef({});
|
|
@@ -113,7 +115,7 @@ const FormInner = forwardRef(function FormInner({ schema, name, action, classNam
|
|
|
113
115
|
renderErrorMessage(errors[fieldName], field)] }))] }) })) }, key));
|
|
114
116
|
}), renderSubmit(), useRecaptcha && (_jsxs("p", { className: "form__recaptcha-message", children: ["This site is protected by reCAPTCHA and the Google", ' ', _jsx("a", { href: "https://policies.google.com/privacy", target: "_blank", rel: "noopener", children: "Privacy Policy" }), ' ', "and", ' ', _jsx("a", { href: "https://policies.google.com/terms", target: "_blank", rel: "noopener", children: "Terms of Service" }), ' ', "apply."] }))] })) }));
|
|
115
117
|
});
|
|
116
|
-
|
|
118
|
+
function Form(props, ref) {
|
|
117
119
|
if (props.useRecaptcha === false) {
|
|
118
120
|
return _jsx(FormInner, { ...props, ref: ref });
|
|
119
121
|
}
|
|
@@ -122,5 +124,5 @@ const Form = (props, ref) => {
|
|
|
122
124
|
throw new Error('Env var NEXT_PUBLIC_RECAPTCHA_KEY is not set');
|
|
123
125
|
}
|
|
124
126
|
return (_jsx(GoogleReCaptchaProvider, { reCaptchaKey: process.env.NEXT_PUBLIC_RECAPTCHA_KEY, children: _jsx(FormInner, { ...props, ref: ref }) }));
|
|
125
|
-
}
|
|
127
|
+
}
|
|
126
128
|
export default forwardRef(Form);
|
|
@@ -6,6 +6,6 @@ interface Props extends PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement
|
|
|
6
6
|
closeLabel?: string;
|
|
7
7
|
renderIcon?: (navOpen: boolean) => ReactNode;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
export
|
|
9
|
+
export default function MenuToggle({ 'aria-controls': ariaControls, className, label, closeLabel, renderIcon, ...props }: Props): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
11
|
//# sourceMappingURL=menu-toggle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-toggle.d.ts","sourceRoot":"","sources":["../src/components/menu-toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,SAAS,EAEV,MAAM,OAAO,CAAA;AAKd,UAAU,KACR,SAAQ,iBAAiB,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAClE,eAAe,EAAE,MAAM,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,CAAA;CAC7C;AAED,
|
|
1
|
+
{"version":3,"file":"menu-toggle.d.ts","sourceRoot":"","sources":["../src/components/menu-toggle.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,SAAS,EAEV,MAAM,OAAO,CAAA;AAKd,UAAU,KACR,SAAQ,iBAAiB,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;IAClE,eAAe,EAAE,MAAM,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,SAAS,CAAA;CAC7C;AAED,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,eAAe,EAAE,YAAY,EAC7B,SAAc,EACd,KAAkB,EAClB,UAAwB,EACxB,UAA+C,EAC/C,GAAG,KAAK,EACT,EAAE,KAAK,2CA6BP"}
|
|
@@ -4,7 +4,7 @@ import { useCallback, } from 'react';
|
|
|
4
4
|
import { Button } from '../components';
|
|
5
5
|
import { extendClass } from '../utils';
|
|
6
6
|
import useNavStore from '../store/nav';
|
|
7
|
-
|
|
7
|
+
export default function MenuToggle({ 'aria-controls': ariaControls, className = '', label = 'Open Nav', closeLabel = 'Close Nav', renderIcon = (navOpen) => (navOpen ? '×' : '☰'), ...props }) {
|
|
8
8
|
const { navOpen, toggleNav } = useNavStore();
|
|
9
9
|
const handleClick = useCallback(() => {
|
|
10
10
|
if (document &&
|
|
@@ -16,5 +16,4 @@ const MenuToggle = ({ 'aria-controls': ariaControls, className = '', label = 'Op
|
|
|
16
16
|
toggleNav();
|
|
17
17
|
}, [toggleNav]);
|
|
18
18
|
return (_jsx(Button, { className: `menu-toggle ${className}`, onClick: handleClick, "aria-expanded": navOpen, "aria-controls": ariaControls, label_a11y: navOpen ? closeLabel : label, ...props, children: _jsx("span", { className: `menu-toggle__icon ${extendClass(className, 'icon')}`, children: renderIcon(navOpen) }) }));
|
|
19
|
-
}
|
|
20
|
-
export default MenuToggle;
|
|
19
|
+
}
|
package/components/modal.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ interface Props {
|
|
|
5
5
|
openAfter?: number;
|
|
6
6
|
dismissable?: boolean;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
export
|
|
8
|
+
export default function Modal({ name, className, openAfter, dismissable, children, }: PropsWithChildren<Props>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
10
|
//# sourceMappingURL=modal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../src/components/modal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,iBAAiB,EAKlB,MAAM,OAAO,CAAA;AAId,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../src/components/modal.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,iBAAiB,EAKlB,MAAM,OAAO,CAAA;AAId,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC5B,IAAI,EACJ,SAAS,EACT,SAAS,EACT,WAAmB,EACnB,QAAQ,GACT,EAAE,iBAAiB,CAAC,KAAK,CAAC,2CAyC1B"}
|
package/components/modal.js
CHANGED
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useState, useEffect, useRef, useCallback, } from 'react';
|
|
4
4
|
import { local } from '../storage';
|
|
5
5
|
import { useLockBodyScroll, useModal } from '../hooks';
|
|
6
|
-
|
|
6
|
+
export default function Modal({ name, className, openAfter, dismissable = false, children, }) {
|
|
7
7
|
const [dismissed, setDismissed] = useState(false);
|
|
8
8
|
const openTimer = useRef();
|
|
9
9
|
const { isOpen, openModal, closeModal } = useModal(name);
|
|
@@ -29,5 +29,4 @@ const Modal = ({ name, className, openAfter, dismissable = false, children, }) =
|
|
|
29
29
|
}
|
|
30
30
|
}, [dismissable, name, closeModal]);
|
|
31
31
|
return (_jsxs("aside", { id: name, className: `modal ${className}`, "aria-hidden": !isOpen, children: [_jsxs("button", { className: 'modal__close', onClick: close, children: [_jsx("span", { className: "screenreader-text", children: "Close Modal" }), "\u00D7"] }), _jsx("div", { className: 'modal__inner', children: children })] }));
|
|
32
|
-
}
|
|
33
|
-
export default Modal;
|
|
32
|
+
}
|
package/components/skip-to.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skip-to.d.ts","sourceRoot":"","sources":["../src/components/skip-to.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"skip-to.d.ts","sourceRoot":"","sources":["../src/components/skip-to.tsx"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,MAAM,4CAO7B"}
|
package/components/skip-to.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
|
|
2
|
+
export default function SkipTo() {
|
|
3
3
|
return (_jsxs("div", { className: "skip-to", id: "skip-to", children: [_jsx("a", { href: "#content", children: "Skip to Content" }), _jsx("a", { href: "#nav", children: "Skip to Navigation" })] }));
|
|
4
|
-
}
|
|
5
|
-
export default SkipTo;
|
|
4
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { ButtonProps } from './button';
|
|
3
3
|
import { Slideshow } from '@/hooks/use-slideshow';
|
|
4
|
-
|
|
4
|
+
export default function SlideshowButtons({ slideshow: { currentSlide, goTo, slideshowRef, atStart, atEnd }, ButtonComponent, }: {
|
|
5
5
|
slideshow: Slideshow;
|
|
6
6
|
ButtonComponent?: FC<ButtonProps>;
|
|
7
|
-
})
|
|
8
|
-
export default SlideshowButtons;
|
|
7
|
+
}): JSX.Element;
|
|
9
8
|
//# sourceMappingURL=slideshow-buttons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slideshow-buttons.d.ts","sourceRoot":"","sources":["../src/components/slideshow-buttons.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC1B,OAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,
|
|
1
|
+
{"version":3,"file":"slideshow-buttons.d.ts","sourceRoot":"","sources":["../src/components/slideshow-buttons.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAA;AAC1B,OAAe,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EACvC,SAAS,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,EAC/D,eAAwB,GACzB,EAAE;IACD,SAAS,EAAE,SAAS,CAAA;IACpB,eAAe,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAA;CAClC,GAAG,GAAG,CAAC,OAAO,CAqBd"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import Button from './button';
|
|
3
|
-
|
|
3
|
+
export default function SlideshowButtons({ slideshow: { currentSlide, goTo, slideshowRef, atStart, atEnd }, ButtonComponent = Button, }) {
|
|
4
4
|
return (_jsxs("nav", { className: "slideshow-buttons", children: [_jsx(ButtonComponent, { label: "Previous slide", onClick: () => goTo(currentSlide - 1), disabled: atStart, "aria-controls": slideshowRef.current?.getAttribute('id') }), _jsx(ButtonComponent, { label: "Next slide", onClick: () => goTo(currentSlide + 1), disabled: atEnd, "aria-controls": slideshowRef.current?.getAttribute('id') })] }));
|
|
5
|
-
}
|
|
6
|
-
export default SlideshowButtons;
|
|
5
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Slideshow } from '@/hooks/use-slideshow';
|
|
2
|
-
|
|
2
|
+
export default function SlideshowPagination({ slideshow: { currentSlide, slideCount, goTo }, }: {
|
|
3
3
|
slideshow: Slideshow;
|
|
4
|
-
})
|
|
5
|
-
export default SlideshowPagination;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
//# sourceMappingURL=slideshow-pagination.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slideshow-pagination.d.ts","sourceRoot":"","sources":["../src/components/slideshow-pagination.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,
|
|
1
|
+
{"version":3,"file":"slideshow-pagination.d.ts","sourceRoot":"","sources":["../src/components/slideshow-pagination.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,SAAS,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,GAC9C,EAAE;IACD,SAAS,EAAE,SAAS,CAAA;CACrB,2CAeA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export default function SlideshowPagination({ slideshow: { currentSlide, slideCount, goTo }, }) {
|
|
3
|
+
return (_jsx("nav", { className: "slideshow-pagination", children: Array.from({ length: slideCount }, (_, i) => (_jsx("button", { className: "slideshow-pagination__button", "aria-current": currentSlide === i ? 'true' : 'false', onClick: () => goTo(i), children: _jsxs("span", { children: ["Slide ", i + 1] }) }, i))) }));
|
|
4
|
+
}
|
|
@@ -8,6 +8,6 @@ export declare const ModalContext: import("react").Context<{
|
|
|
8
8
|
interface OpenState {
|
|
9
9
|
[key: string]: boolean;
|
|
10
10
|
}
|
|
11
|
-
export declare
|
|
11
|
+
export declare function ModalContextProvider({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
export default ModalContextProvider;
|
|
13
13
|
//# sourceMappingURL=modal-context-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal-context-provider.d.ts","sourceRoot":"","sources":["../src/context/modal-context-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,iBAAiB,EAAY,MAAM,OAAO,CAAA;AAElE,eAAO,MAAM,YAAY;eACN,SAAS;mBACX,MAAM,KAAc,OAAO;sBACxB,MAAM;uBACL,MAAM;EACzB,CAAA;AAEF,UAAU,SAAS;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,
|
|
1
|
+
{"version":3,"file":"modal-context-provider.d.ts","sourceRoot":"","sources":["../src/context/modal-context-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,iBAAiB,EAAY,MAAM,OAAO,CAAA;AAElE,eAAO,MAAM,YAAY;eACN,SAAS;mBACX,MAAM,KAAc,OAAO;sBACxB,MAAM;uBACL,MAAM;EACzB,CAAA;AAEF,UAAU,SAAS;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAED,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CA8BnE;AAED,eAAe,oBAAoB,CAAA"}
|
|
@@ -7,7 +7,7 @@ export const ModalContext = createContext({
|
|
|
7
7
|
openModal: (name) => { },
|
|
8
8
|
closeModal: (name) => { },
|
|
9
9
|
});
|
|
10
|
-
export
|
|
10
|
+
export function ModalContextProvider({ children }) {
|
|
11
11
|
const [openState, setOpenState] = useState({});
|
|
12
12
|
const isOpen = (name) => {
|
|
13
13
|
return openState[name] || false;
|
|
@@ -27,5 +27,5 @@ export const ModalContextProvider = ({ children }) => {
|
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
29
|
return (_jsx(ModalContext.Provider, { value: { openState, isOpen, openModal, closeModal }, children: children }));
|
|
30
|
-
}
|
|
30
|
+
}
|
|
31
31
|
export default ModalContextProvider;
|
|
@@ -5,6 +5,6 @@ export declare const NavContext: import("react").Context<{
|
|
|
5
5
|
openNav: () => void;
|
|
6
6
|
closeNav: () => void;
|
|
7
7
|
}>;
|
|
8
|
-
export declare
|
|
8
|
+
export declare function NavContextProvider({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export default NavContextProvider;
|
|
10
10
|
//# sourceMappingURL=nav-context-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nav-context-provider.d.ts","sourceRoot":"","sources":["../src/context/nav-context-provider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,iBAAiB,EAAyB,MAAM,OAAO,CAAA;AAE/E,eAAO,MAAM,UAAU;;;;;EAKrB,CAAA;AAEF,
|
|
1
|
+
{"version":3,"file":"nav-context-provider.d.ts","sourceRoot":"","sources":["../src/context/nav-context-provider.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAiB,iBAAiB,EAAyB,MAAM,OAAO,CAAA;AAE/E,eAAO,MAAM,UAAU;;;;;EAKrB,CAAA;AAEF,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CAsBjE;AAED,eAAe,kBAAkB,CAAA"}
|
|
@@ -8,7 +8,7 @@ export const NavContext = createContext({
|
|
|
8
8
|
openNav: () => { },
|
|
9
9
|
closeNav: () => { },
|
|
10
10
|
});
|
|
11
|
-
export
|
|
11
|
+
export function NavContextProvider({ children }) {
|
|
12
12
|
const [navOpen, setNavOpen] = useState(false);
|
|
13
13
|
useLockBodyScroll(navOpen);
|
|
14
14
|
const toggleNav = useCallback(() => {
|
|
@@ -22,5 +22,5 @@ export const NavContextProvider = ({ children }) => {
|
|
|
22
22
|
document.activeElement?.blur();
|
|
23
23
|
}, [setNavOpen]);
|
|
24
24
|
return (_jsx(NavContext.Provider, { value: { navOpen, toggleNav, openNav, closeNav }, children: children }));
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
export default NavContextProvider;
|
package/hooks/use-async.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ interface ReturnType<T, E = string> {
|
|
|
5
5
|
value: T | null;
|
|
6
6
|
error: E | null;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
export default function useAsync<T, E = string>(asyncFunction: (...args: any[]) => Promise<T>, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
9
|
+
immediate?: boolean, dependencies?: any[]): ReturnType<T, E>;
|
|
10
|
+
export {};
|
|
10
11
|
//# sourceMappingURL=use-async.d.ts.map
|
package/hooks/use-async.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-async.d.ts","sourceRoot":"","sources":["../src/hooks/use-async.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAE7D,UAAU,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM;IAChC,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,CAAC,GAAG,IAAI,CAAA;IACf,KAAK,EAAE,CAAC,GAAG,IAAI,CAAA;CAChB;AAGD,
|
|
1
|
+
{"version":3,"file":"use-async.d.ts","sourceRoot":"","sources":["../src/hooks/use-async.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAE7D,UAAU,UAAU,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM;IAChC,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,CAAC,GAAG,IAAI,CAAA;IACf,KAAK,EAAE,CAAC,GAAG,IAAI,CAAA;CAChB;AAGD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,MAAM,EAC5C,aAAa,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,EAAE,yDAAyD;AACxG,SAAS,UAAQ,EACjB,YAAY,GAAE,GAAG,EAAO,GACvB,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CA2ClB"}
|
package/hooks/use-async.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
// Hook
|
|
3
|
-
|
|
4
|
-
immediate = false, dependencies = [])
|
|
3
|
+
export default function useAsync(asyncFunction, // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
4
|
+
immediate = false, dependencies = []) {
|
|
5
5
|
const [status, setStatus] = useState('idle');
|
|
6
6
|
const [value, setValue] = useState(null);
|
|
7
7
|
const [error, setError] = useState(null);
|
|
@@ -37,5 +37,4 @@ immediate = false, dependencies = []) => {
|
|
|
37
37
|
}
|
|
38
38
|
}, [execute, immediate]);
|
|
39
39
|
return { execute, status, value, error };
|
|
40
|
-
}
|
|
41
|
-
export default useAsync;
|
|
40
|
+
}
|
|
@@ -2,10 +2,10 @@ import { MouseEventHandler, MutableRefObject } from 'react';
|
|
|
2
2
|
interface Events {
|
|
3
3
|
onMouseDown: MouseEventHandler<HTMLElement>;
|
|
4
4
|
}
|
|
5
|
-
|
|
5
|
+
export default function useDraggableScroll(ref: MutableRefObject<HTMLElement>, { className, ...opts }: {
|
|
6
6
|
className: string;
|
|
7
|
-
})
|
|
7
|
+
}): {
|
|
8
8
|
events: Events;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export {};
|
|
11
11
|
//# sourceMappingURL=use-draggable-scroll.d.ts.map
|