@nodeblocks/frontend-reset-password-block 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/context.d.ts CHANGED
@@ -10,6 +10,7 @@ export type ResetPasswordContextValue<T extends ResetPasswordFormData = any> = {
10
10
  showPassword: boolean;
11
11
  onShowPasswordClick: (show: boolean) => void;
12
12
  };
13
+ export declare const keys: readonly ["resetPasswordTitle", "description", "gotoSigninMessage", "view", "onSendRequest", "onResetPassword", "showPassword", "onShowPasswordClick"];
13
14
  export declare const ResetPasswordProvider: <T extends ResetPasswordFormData>({ children, ...value }: ResetPasswordContextValue<T> & {
14
15
  children: ReactNode;
15
16
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAc,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,MAAM,yBAAyB,CAInC,CAAC,SAAS,qBAAqB,GAAG,GAAG,IACnC;IACF,kBAAkB,EAAE,SAAS,CAAC;IAC9B,WAAW,EAAE,SAAS,CAAC;IACvB,iBAAiB,EAAE,SAAS,CAAC;IAC7B,IAAI,EAAE,SAAS,GAAG,kBAAkB,CAAC;IACrC,aAAa,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IACjC,eAAe,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IACnC,YAAY,EAAE,OAAO,CAAC;IACtB,mBAAmB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C,CAAC;AAIF,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,qBAAqB,EAAE,wBAGpE,yBAAyB,CAAC,CAAC,CAAC,GAAG;IAChC,QAAQ,EAAE,SAAS,CAAC;CACrB,4CAEA,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,qBAAqB,mCAOtE,CAAC"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAc,MAAM,OAAO,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,MAAM,MAAM,yBAAyB,CAInC,CAAC,SAAS,qBAAqB,GAAG,GAAG,IACnC;IACF,kBAAkB,EAAE,SAAS,CAAC;IAC9B,WAAW,EAAE,SAAS,CAAC;IACvB,iBAAiB,EAAE,SAAS,CAAC;IAC7B,IAAI,EAAE,SAAS,GAAG,kBAAkB,CAAC;IACrC,aAAa,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IACjC,eAAe,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IACnC,YAAY,EAAE,OAAO,CAAC;IACtB,mBAAmB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C,CAAC;AAEF,eAAO,MAAM,IAAI,wJASyB,CAAC;AAW3C,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,qBAAqB,EAAE,wBAGpE,yBAAyB,CAAC,CAAC,CAAC,GAAG;IAChC,QAAQ,EAAE,SAAS,CAAC;CACrB,4CAEA,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,CAAC,SAAS,qBAAqB,mCAOtE,CAAC"}
package/dist/index.cjs.js CHANGED
@@ -1,226 +1 @@
1
-
2
-
3
- if (typeof global === 'undefined') {
4
- var global = window;
5
- }
6
-
7
- 'use strict';
8
-
9
- var jsxRuntime = require('react/jsx-runtime');
10
- var iconsMaterial = require('@mui/icons-material');
11
- var material = require('@mui/material');
12
- var react = require('react');
13
-
14
- const ResetPasswordContext = react.createContext(undefined);
15
- const ResetPasswordProvider = ({ children, ...value }) => {
16
- return jsxRuntime.jsx(ResetPasswordContext.Provider, { value: value, children: children });
17
- };
18
- const useResetPasswordContext = () => {
19
- const context = react.useContext(ResetPasswordContext);
20
- if (!context) {
21
- throw new Error('useResetPasswordContext must be used within a ResetPasswordProvider');
22
- }
23
- return context;
24
- };
25
-
26
- /**
27
- * Creates a strongly typed `defaultBlocks` object, allowing for types to propagate into block override objects.
28
- *
29
- * @param components - A map of default block keys to component functions.
30
- *
31
- * @example
32
- * const defaultBlocks = createDefaultBlocks({
33
- * title: Title,
34
- * description: Description,
35
- * form: Form,
36
- * });
37
- */
38
- function createDefaultBlocks(components) {
39
- return Object.fromEntries(Object.entries(components).map(([key, Component]) => [key, react.createElement(Component, { key })]));
40
- }
41
- /**
42
- * A component for rendering {@link BlocksOverride|`BlocksOverride`} results.
43
- * Exposes the evaluated `blocks` and `blockOrder` as arguments to the `children` function.
44
- *
45
- * @param props
46
- * @param props.blocksOverride - The {@link BlocksOverride|`BlocksOverride`} (i.e. `children` of outer component).
47
- * @param props.defaultBlocks - The default blocks of outer component.
48
- * @param props.children - A function returning the JSX to render.
49
- *
50
- * @example
51
- * <BlocksOverrideComponent
52
- * defaultBlocks={defaultFormBlocks}
53
- * blocksOverride={children}
54
- * >
55
- * {({ blocks, blockOrder }) =>
56
- * blockOrder.map((key) => (
57
- * <Fragment key={String(key)}>{blocks[key]}</Fragment>
58
- * ))
59
- * }
60
- * </BlocksOverrideComponent>
61
- */
62
- function BlocksOverrideComponent({ blocksOverride, defaultBlocks, defaultBlockOrder, children, }) {
63
- if (blocksOverride === undefined) {
64
- return children({
65
- // TODO: Remove this assertion
66
- blocks: defaultBlocks,
67
- blockOrder: defaultBlockOrder,
68
- });
69
- }
70
- if (typeof blocksOverride === 'function') {
71
- const { blocks, blockOrder } = blocksOverride({
72
- defaultBlocks,
73
- defaultBlockOrder,
74
- });
75
- return children({ blocks, blockOrder });
76
- }
77
- return blocksOverride;
78
- }
79
- function deepMerge(obj1, obj2) {
80
- const result = { ...obj1 };
81
- for (const key in obj2) {
82
- if (obj2.hasOwnProperty(key)) {
83
- const val1 = result[key];
84
- const val2 = obj2[key];
85
- if (Array.isArray(val1) || Array.isArray(val2)) {
86
- // If either is an array, replace entirely with obj2's value
87
- result[key] = val2;
88
- }
89
- else if (typeof val1 === 'object' && val1 !== null && typeof val2 === 'object' && val2 !== null) {
90
- result[key] = deepMerge(val1, val2);
91
- }
92
- else {
93
- result[key] = val2;
94
- }
95
- }
96
- }
97
- return result;
98
- }
99
- /**
100
- * Utility function to join class names together, ignoring undefined or nil values.
101
- * @param classes - The class names to join.
102
- * @returns The joined class names.
103
- */
104
- function classNames(...classes) {
105
- return classes.flat().filter(Boolean).join(' ');
106
- }
107
-
108
- const ResetPassword = ({ resetPasswordTitle, description, gotoSigninMessage, view = 'request', onSendRequest, onResetPassword, className, children, sx, ...props }) => {
109
- const [showPassword, setShowPassword] = react.useState(false);
110
- return (jsxRuntime.jsx(ResetPasswordProvider, { resetPasswordTitle,
111
- description,
112
- gotoSigninMessage,
113
- view,
114
- onSendRequest,
115
- onResetPassword,
116
- showPassword: props.showPassword ?? showPassword,
117
- onShowPasswordClick: props.onShowPasswordClick ?? setShowPassword, children: jsxRuntime.jsx(material.Stack, { className: classNames('nbb-reset-password', className), spacing: 4, sx: [
118
- {
119
- background: (theme) => theme.palette.background.paper,
120
- borderRadius: 3,
121
- py: 6,
122
- px: 5,
123
- minWidth: { lg: 496 },
124
- width: 'fit-content',
125
- margin: 'auto',
126
- },
127
- ...(Array.isArray(sx) ? sx : [sx]),
128
- ], ...props, children: jsxRuntime.jsx(BlocksOverrideComponent, { defaultBlocks: defaultBlocks, defaultBlockOrder: Object.keys(defaultBlocks), blocksOverride: children, children: ({ blocks: { ...blocks }, blockOrder }) => blockOrder
129
- .filter((key) => key in blocks)
130
- .map((key) => jsxRuntime.jsx(react.Fragment, { children: blocks[key] }, String(key))) }) }) }));
131
- };
132
- ResetPassword.Title = ({ sx, children, className, ...props }) => {
133
- const { resetPasswordTitle = 'Reset Password' } = deepMerge(useResetPasswordContext(), props);
134
- return (jsxRuntime.jsx(material.Typography, { variant: "h4", component: "h1", sx: [
135
- {
136
- textAlign: 'center',
137
- },
138
- ...(Array.isArray(sx) ? sx : [sx]),
139
- ], className: classNames('nbb-reset-password-title', className), ...props, children: children || resetPasswordTitle }));
140
- };
141
- ResetPassword.Description = ({ sx, children, className, ...props }) => {
142
- const { description = 'Please enter your email address you registered' } = deepMerge(useResetPasswordContext(), props);
143
- return (jsxRuntime.jsx(material.Typography, { variant: "body2", sx: [
144
- {
145
- textAlign: 'center',
146
- },
147
- ...(Array.isArray(sx) ? sx : [sx]),
148
- ], className: classNames('nbb-reset-password-description', className), ...props, children: children || description }));
149
- };
150
- const Form = ({ children, className, ...props }) => {
151
- const { onSendRequest, onResetPassword, view } = deepMerge(useResetPasswordContext(), props);
152
- const onSubmitHandler = (e) => {
153
- if (e) {
154
- e.preventDefault && e.preventDefault();
155
- e.stopPropagation && e.stopPropagation();
156
- }
157
- if (!(e.target instanceof HTMLFormElement)) {
158
- return;
159
- }
160
- const formData = new FormData(e.target);
161
- const data = Object.fromEntries(formData);
162
- if (view === 'request') {
163
- if (!onSendRequest) {
164
- return;
165
- }
166
- onSendRequest(data);
167
- }
168
- if (view === 'confirm_password') {
169
- if (!onResetPassword) {
170
- return;
171
- }
172
- onResetPassword(data);
173
- }
174
- };
175
- return (jsxRuntime.jsx(material.Stack, { component: "form", onSubmit: onSubmitHandler, className: classNames('nbb-reset-password-form', className), spacing: 4, ...props, children: children || (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Form.EmailField, {}), jsxRuntime.jsx(Form.PasswordField, {}), jsxRuntime.jsx(Form.ConfirmPasswordField, {}), jsxRuntime.jsx(Form.ResetPasswordButton, {})] })) }));
176
- };
177
- ResetPassword.Form = Form;
178
- const EmailField = ({ className, ...props }) => {
179
- const { view } = useResetPasswordContext();
180
- return view === 'request' ? (jsxRuntime.jsx(material.TextField, { fullWidth: true, name: "email", label: "Email", placeholder: "Please enter your email", className: classNames('nbb-reset-password-email-field', className), ...props })) : null;
181
- };
182
- Form.EmailField = EmailField;
183
- const PasswordField = ({ className, ...props }) => {
184
- const { view, showPassword, onShowPasswordClick } = deepMerge(useResetPasswordContext(), props);
185
- return view === 'confirm_password' ? (jsxRuntime.jsx(material.TextField, { fullWidth: true, name: "password", label: "Password", type: showPassword ? 'text' : 'password', placeholder: "Please enter your new password", className: classNames('nbb-reset-password-password-field', className), slotProps: showPassword !== undefined && onShowPasswordClick !== undefined
186
- ? {
187
- input: {
188
- endAdornment: (jsxRuntime.jsx(material.InputAdornment, { position: "end", children: jsxRuntime.jsx(material.IconButton, { "aria-label": "toggle password visibility", onClick: () => onShowPasswordClick(!showPassword), edge: "end", children: showPassword ? jsxRuntime.jsx(iconsMaterial.VisibilityOff, {}) : jsxRuntime.jsx(iconsMaterial.Visibility, {}) }) })),
189
- },
190
- }
191
- : {}, ...props })) : null;
192
- };
193
- Form.PasswordField = PasswordField;
194
- const ConfirmPasswordField = ({ className, ...props }) => {
195
- const { view, showPassword, onShowPasswordClick } = deepMerge(useResetPasswordContext(), props);
196
- return view === 'confirm_password' ? (jsxRuntime.jsx(material.TextField, { fullWidth: true, name: "confirmPassword", label: "Confirm Password", type: showPassword ? 'text' : 'password', placeholder: "Please confirm your password", className: classNames('nbb-reset-password-confirm-password-field', className), slotProps: showPassword !== undefined && onShowPasswordClick !== undefined
197
- ? {
198
- input: {
199
- endAdornment: (jsxRuntime.jsx(material.InputAdornment, { position: "end", children: jsxRuntime.jsx(material.IconButton, { "aria-label": "toggle password visibility", onClick: () => onShowPasswordClick(!showPassword), edge: "end", children: showPassword ? jsxRuntime.jsx(iconsMaterial.VisibilityOff, {}) : jsxRuntime.jsx(iconsMaterial.Visibility, {}) }) })),
200
- },
201
- }
202
- : {}, ...props })) : null;
203
- };
204
- Form.ConfirmPasswordField = ConfirmPasswordField;
205
- const ResetPasswordButton = ({ children, className, ...props }) => {
206
- return (jsxRuntime.jsx(material.Button, { variant: "contained", fullWidth: true, type: "submit", className: classNames('nbb-reset-password-reset-password-button', className), ...props, children: children || 'Reset Password' }));
207
- };
208
- Form.ResetPasswordButton = ResetPasswordButton;
209
- ResetPassword.Goto = ({ children, className, sx, ...props }) => {
210
- const { gotoSigninMessage } = deepMerge(useResetPasswordContext(), props);
211
- return (jsxRuntime.jsx(material.Typography, { variant: "body2", className: classNames('nbb-reset-password-goto', className), sx: [
212
- {
213
- textAlign: 'center',
214
- },
215
- ...(Array.isArray(sx) ? sx : [sx]),
216
- ], ...props, children: children || gotoSigninMessage || (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(material.Link, { href: "/auth/login", children: "Back to Sign In" }) })) }));
217
- };
218
- const defaultBlocks = createDefaultBlocks({
219
- title: ResetPassword.Title,
220
- description: ResetPassword.Description,
221
- form: ResetPassword.Form,
222
- goto: ResetPassword.Goto,
223
- });
224
-
225
- exports.ResetPassword = ResetPassword;
226
- //# sourceMappingURL=index.cjs.js.map
1
+ "use strict";var e=require("react/jsx-runtime"),s=require("@mui/icons-material"),r=require("@mui/material"),t=require("react");const o=["resetPasswordTitle","description","gotoSigninMessage","view","onSendRequest","onResetPassword","showPassword","onShowPasswordClick"],n=t.createContext(void 0),i=({children:s,...r})=>e.jsx(n.Provider,{value:r,children:s}),a=()=>{const e=t.useContext(n);if(!e)throw new Error("useResetPasswordContext must be used within a ResetPasswordProvider");return e};function l({blocksOverride:e,defaultBlocks:s,defaultBlockOrder:r,children:t}){if(void 0===e)return t({blocks:s,blockOrder:r});if("function"==typeof e){const{blocks:o,blockOrder:n}=e({defaultBlocks:s,defaultBlockOrder:r});return t({blocks:o,blockOrder:n})}return e}function d(e,s){const r={...e};for(const e in s)Object.prototype.hasOwnProperty.call(s,e)&&(r[e]=s[e]);return r}function c(...e){return e.flat().filter(Boolean).join(" ")}function u(e,...s){const r={...e};for(const e of s)delete r[e];return r}const w=({view:s="request",resetPasswordTitle:n="Reset Password",description:a="Please enter your email address you registered",gotoSigninMessage:d=e.jsx(r.Link,{href:"/auth/login",children:"Back to Sign In"}),showPassword:w,onShowPasswordClick:p,className:f,children:b,sx:h,...x})=>{const[g,P]=t.useState(!1);return e.jsx(i,{view:s,resetPasswordTitle:n,description:a,gotoSigninMessage:d,showPassword:w??g,onShowPasswordClick:p??P,...x,children:e.jsx(r.Stack,{className:c("nbb-reset-password",f),spacing:4,sx:[{background:e=>e.palette.background.paper,borderRadius:3,py:6,px:5,minWidth:{lg:496},width:"fit-content",margin:"auto"},...Array.isArray(h)?h:[h]],...u(x,...o),children:e.jsx(l,{defaultBlocks:m,defaultBlockOrder:Object.keys(m),blocksOverride:b,children:({blocks:{...s},blockOrder:r})=>r.filter(e=>e in s).map(r=>e.jsx(t.Fragment,{children:s[r]},String(r)))})})})};w.Title=({sx:s,children:t,className:n,...i})=>{const l=a(),{resetPasswordTitle:w}=d(l,i);return e.jsx(r.Typography,{variant:"h4",component:"h1",sx:[{textAlign:"center"},...Array.isArray(s)?s:[s]],className:c("nbb-reset-password-title",n),...u(i,...o),children:t||w})},w.Description=({sx:s,children:t,className:n,...i})=>{const l=a(),{description:w}=d(l,i);return e.jsx(r.Typography,{variant:"body2",sx:[{textAlign:"center"},...Array.isArray(s)?s:[s]],className:c("nbb-reset-password-description",n),...u(i,...o),children:t||w})};const p=({children:s,className:t,...n})=>{const i=a(),{onSendRequest:l,onResetPassword:w,view:m}=d(i,n);return e.jsx(r.Stack,{component:"form",onSubmit:e=>{if(e&&(e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation()),!(e.target instanceof HTMLFormElement))return;const s=new FormData(e.target),r=Object.fromEntries(s);if("request"===m){if(!l)return;l(r)}if("confirm_password"===m){if(!w)return;w(r)}},className:c("nbb-reset-password-form",t),spacing:4,...u(n,...o),children:s||e.jsxs(e.Fragment,{children:[e.jsx(p.EmailField,{}),e.jsx(p.PasswordField,{}),e.jsx(p.ConfirmPasswordField,{}),e.jsx(p.ResetPasswordButton,{})]})})};w.Form=p,p.EmailField=({className:s,...t})=>{const n=a(),{view:i}=d(n,t);return"request"===i?e.jsx(r.TextField,{fullWidth:!0,name:"email",label:"Email",placeholder:"Please enter your email",className:c("nbb-reset-password-email-field",s),...u(t,...o)}):null},p.PasswordField=({className:t,...n})=>{const i=a(),{view:l,showPassword:w,onShowPasswordClick:p}=d(i,n);return"confirm_password"===l?e.jsx(r.TextField,{fullWidth:!0,name:"password",label:"Password",type:w?"text":"password",placeholder:"Please enter your new password",className:c("nbb-reset-password-password-field",t),slotProps:void 0!==w&&void 0!==p?{input:{endAdornment:e.jsx(r.InputAdornment,{position:"end",children:e.jsx(r.IconButton,{"aria-label":"toggle password visibility",onClick:()=>p(!w),edge:"end",children:w?e.jsx(s.VisibilityOff,{}):e.jsx(s.Visibility,{})})})}}:{},...u(n,...o)}):null},p.ConfirmPasswordField=({className:t,...n})=>{const i=a(),{view:l,showPassword:w,onShowPasswordClick:p}=d(i,n);return"confirm_password"===l?e.jsx(r.TextField,{fullWidth:!0,name:"confirmPassword",label:"Confirm Password",type:w?"text":"password",placeholder:"Please confirm your password",className:c("nbb-reset-password-confirm-password-field",t),slotProps:void 0!==w&&void 0!==p?{input:{endAdornment:e.jsx(r.InputAdornment,{position:"end",children:e.jsx(r.IconButton,{"aria-label":"toggle password visibility",onClick:()=>p(!w),edge:"end",children:w?e.jsx(s.VisibilityOff,{}):e.jsx(s.Visibility,{})})})}}:{},...u(n,...o)}):null},p.ResetPasswordButton=({children:s,className:t,...o})=>e.jsx(r.Button,{variant:"contained",fullWidth:!0,type:"submit",className:c("nbb-reset-password-reset-password-button",t),...o,children:s||"Reset Password"});const m=(f={title:w.Title,description:w.Description,form:w.Form,goto:w.Goto=({children:s,className:t,sx:n,...i})=>{const l=a(),{gotoSigninMessage:w}=d(l,i);return e.jsx(r.Typography,{variant:"body2",className:c("nbb-reset-password-goto",t),sx:[{textAlign:"center"},...Array.isArray(n)?n:[n]],...u(i,...o),children:s||w})}},Object.fromEntries(Object.entries(f).map(([e,s])=>[e,t.createElement(s,{key:e})])));var f;exports.ResetPassword=w;
package/dist/index.esm.js CHANGED
@@ -1,224 +1 @@
1
-
2
-
3
- if (typeof global === 'undefined') {
4
- var global = window;
5
- }
6
-
7
- import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
- import { VisibilityOff, Visibility } from '@mui/icons-material';
9
- import { TextField, Stack, InputAdornment, IconButton, Button, Typography, Link } from '@mui/material';
10
- import { createContext, useContext, createElement, useState, Fragment as Fragment$1 } from 'react';
11
-
12
- const ResetPasswordContext = createContext(undefined);
13
- const ResetPasswordProvider = ({ children, ...value }) => {
14
- return jsx(ResetPasswordContext.Provider, { value: value, children: children });
15
- };
16
- const useResetPasswordContext = () => {
17
- const context = useContext(ResetPasswordContext);
18
- if (!context) {
19
- throw new Error('useResetPasswordContext must be used within a ResetPasswordProvider');
20
- }
21
- return context;
22
- };
23
-
24
- /**
25
- * Creates a strongly typed `defaultBlocks` object, allowing for types to propagate into block override objects.
26
- *
27
- * @param components - A map of default block keys to component functions.
28
- *
29
- * @example
30
- * const defaultBlocks = createDefaultBlocks({
31
- * title: Title,
32
- * description: Description,
33
- * form: Form,
34
- * });
35
- */
36
- function createDefaultBlocks(components) {
37
- return Object.fromEntries(Object.entries(components).map(([key, Component]) => [key, createElement(Component, { key })]));
38
- }
39
- /**
40
- * A component for rendering {@link BlocksOverride|`BlocksOverride`} results.
41
- * Exposes the evaluated `blocks` and `blockOrder` as arguments to the `children` function.
42
- *
43
- * @param props
44
- * @param props.blocksOverride - The {@link BlocksOverride|`BlocksOverride`} (i.e. `children` of outer component).
45
- * @param props.defaultBlocks - The default blocks of outer component.
46
- * @param props.children - A function returning the JSX to render.
47
- *
48
- * @example
49
- * <BlocksOverrideComponent
50
- * defaultBlocks={defaultFormBlocks}
51
- * blocksOverride={children}
52
- * >
53
- * {({ blocks, blockOrder }) =>
54
- * blockOrder.map((key) => (
55
- * <Fragment key={String(key)}>{blocks[key]}</Fragment>
56
- * ))
57
- * }
58
- * </BlocksOverrideComponent>
59
- */
60
- function BlocksOverrideComponent({ blocksOverride, defaultBlocks, defaultBlockOrder, children, }) {
61
- if (blocksOverride === undefined) {
62
- return children({
63
- // TODO: Remove this assertion
64
- blocks: defaultBlocks,
65
- blockOrder: defaultBlockOrder,
66
- });
67
- }
68
- if (typeof blocksOverride === 'function') {
69
- const { blocks, blockOrder } = blocksOverride({
70
- defaultBlocks,
71
- defaultBlockOrder,
72
- });
73
- return children({ blocks, blockOrder });
74
- }
75
- return blocksOverride;
76
- }
77
- function deepMerge(obj1, obj2) {
78
- const result = { ...obj1 };
79
- for (const key in obj2) {
80
- if (obj2.hasOwnProperty(key)) {
81
- const val1 = result[key];
82
- const val2 = obj2[key];
83
- if (Array.isArray(val1) || Array.isArray(val2)) {
84
- // If either is an array, replace entirely with obj2's value
85
- result[key] = val2;
86
- }
87
- else if (typeof val1 === 'object' && val1 !== null && typeof val2 === 'object' && val2 !== null) {
88
- result[key] = deepMerge(val1, val2);
89
- }
90
- else {
91
- result[key] = val2;
92
- }
93
- }
94
- }
95
- return result;
96
- }
97
- /**
98
- * Utility function to join class names together, ignoring undefined or nil values.
99
- * @param classes - The class names to join.
100
- * @returns The joined class names.
101
- */
102
- function classNames(...classes) {
103
- return classes.flat().filter(Boolean).join(' ');
104
- }
105
-
106
- const ResetPassword = ({ resetPasswordTitle, description, gotoSigninMessage, view = 'request', onSendRequest, onResetPassword, className, children, sx, ...props }) => {
107
- const [showPassword, setShowPassword] = useState(false);
108
- return (jsx(ResetPasswordProvider, { resetPasswordTitle,
109
- description,
110
- gotoSigninMessage,
111
- view,
112
- onSendRequest,
113
- onResetPassword,
114
- showPassword: props.showPassword ?? showPassword,
115
- onShowPasswordClick: props.onShowPasswordClick ?? setShowPassword, children: jsx(Stack, { className: classNames('nbb-reset-password', className), spacing: 4, sx: [
116
- {
117
- background: (theme) => theme.palette.background.paper,
118
- borderRadius: 3,
119
- py: 6,
120
- px: 5,
121
- minWidth: { lg: 496 },
122
- width: 'fit-content',
123
- margin: 'auto',
124
- },
125
- ...(Array.isArray(sx) ? sx : [sx]),
126
- ], ...props, children: jsx(BlocksOverrideComponent, { defaultBlocks: defaultBlocks, defaultBlockOrder: Object.keys(defaultBlocks), blocksOverride: children, children: ({ blocks: { ...blocks }, blockOrder }) => blockOrder
127
- .filter((key) => key in blocks)
128
- .map((key) => jsx(Fragment$1, { children: blocks[key] }, String(key))) }) }) }));
129
- };
130
- ResetPassword.Title = ({ sx, children, className, ...props }) => {
131
- const { resetPasswordTitle = 'Reset Password' } = deepMerge(useResetPasswordContext(), props);
132
- return (jsx(Typography, { variant: "h4", component: "h1", sx: [
133
- {
134
- textAlign: 'center',
135
- },
136
- ...(Array.isArray(sx) ? sx : [sx]),
137
- ], className: classNames('nbb-reset-password-title', className), ...props, children: children || resetPasswordTitle }));
138
- };
139
- ResetPassword.Description = ({ sx, children, className, ...props }) => {
140
- const { description = 'Please enter your email address you registered' } = deepMerge(useResetPasswordContext(), props);
141
- return (jsx(Typography, { variant: "body2", sx: [
142
- {
143
- textAlign: 'center',
144
- },
145
- ...(Array.isArray(sx) ? sx : [sx]),
146
- ], className: classNames('nbb-reset-password-description', className), ...props, children: children || description }));
147
- };
148
- const Form = ({ children, className, ...props }) => {
149
- const { onSendRequest, onResetPassword, view } = deepMerge(useResetPasswordContext(), props);
150
- const onSubmitHandler = (e) => {
151
- if (e) {
152
- e.preventDefault && e.preventDefault();
153
- e.stopPropagation && e.stopPropagation();
154
- }
155
- if (!(e.target instanceof HTMLFormElement)) {
156
- return;
157
- }
158
- const formData = new FormData(e.target);
159
- const data = Object.fromEntries(formData);
160
- if (view === 'request') {
161
- if (!onSendRequest) {
162
- return;
163
- }
164
- onSendRequest(data);
165
- }
166
- if (view === 'confirm_password') {
167
- if (!onResetPassword) {
168
- return;
169
- }
170
- onResetPassword(data);
171
- }
172
- };
173
- return (jsx(Stack, { component: "form", onSubmit: onSubmitHandler, className: classNames('nbb-reset-password-form', className), spacing: 4, ...props, children: children || (jsxs(Fragment, { children: [jsx(Form.EmailField, {}), jsx(Form.PasswordField, {}), jsx(Form.ConfirmPasswordField, {}), jsx(Form.ResetPasswordButton, {})] })) }));
174
- };
175
- ResetPassword.Form = Form;
176
- const EmailField = ({ className, ...props }) => {
177
- const { view } = useResetPasswordContext();
178
- return view === 'request' ? (jsx(TextField, { fullWidth: true, name: "email", label: "Email", placeholder: "Please enter your email", className: classNames('nbb-reset-password-email-field', className), ...props })) : null;
179
- };
180
- Form.EmailField = EmailField;
181
- const PasswordField = ({ className, ...props }) => {
182
- const { view, showPassword, onShowPasswordClick } = deepMerge(useResetPasswordContext(), props);
183
- return view === 'confirm_password' ? (jsx(TextField, { fullWidth: true, name: "password", label: "Password", type: showPassword ? 'text' : 'password', placeholder: "Please enter your new password", className: classNames('nbb-reset-password-password-field', className), slotProps: showPassword !== undefined && onShowPasswordClick !== undefined
184
- ? {
185
- input: {
186
- endAdornment: (jsx(InputAdornment, { position: "end", children: jsx(IconButton, { "aria-label": "toggle password visibility", onClick: () => onShowPasswordClick(!showPassword), edge: "end", children: showPassword ? jsx(VisibilityOff, {}) : jsx(Visibility, {}) }) })),
187
- },
188
- }
189
- : {}, ...props })) : null;
190
- };
191
- Form.PasswordField = PasswordField;
192
- const ConfirmPasswordField = ({ className, ...props }) => {
193
- const { view, showPassword, onShowPasswordClick } = deepMerge(useResetPasswordContext(), props);
194
- return view === 'confirm_password' ? (jsx(TextField, { fullWidth: true, name: "confirmPassword", label: "Confirm Password", type: showPassword ? 'text' : 'password', placeholder: "Please confirm your password", className: classNames('nbb-reset-password-confirm-password-field', className), slotProps: showPassword !== undefined && onShowPasswordClick !== undefined
195
- ? {
196
- input: {
197
- endAdornment: (jsx(InputAdornment, { position: "end", children: jsx(IconButton, { "aria-label": "toggle password visibility", onClick: () => onShowPasswordClick(!showPassword), edge: "end", children: showPassword ? jsx(VisibilityOff, {}) : jsx(Visibility, {}) }) })),
198
- },
199
- }
200
- : {}, ...props })) : null;
201
- };
202
- Form.ConfirmPasswordField = ConfirmPasswordField;
203
- const ResetPasswordButton = ({ children, className, ...props }) => {
204
- return (jsx(Button, { variant: "contained", fullWidth: true, type: "submit", className: classNames('nbb-reset-password-reset-password-button', className), ...props, children: children || 'Reset Password' }));
205
- };
206
- Form.ResetPasswordButton = ResetPasswordButton;
207
- ResetPassword.Goto = ({ children, className, sx, ...props }) => {
208
- const { gotoSigninMessage } = deepMerge(useResetPasswordContext(), props);
209
- return (jsx(Typography, { variant: "body2", className: classNames('nbb-reset-password-goto', className), sx: [
210
- {
211
- textAlign: 'center',
212
- },
213
- ...(Array.isArray(sx) ? sx : [sx]),
214
- ], ...props, children: children || gotoSigninMessage || (jsx(Fragment, { children: jsx(Link, { href: "/auth/login", children: "Back to Sign In" }) })) }));
215
- };
216
- const defaultBlocks = createDefaultBlocks({
217
- title: ResetPassword.Title,
218
- description: ResetPassword.Description,
219
- form: ResetPassword.Form,
220
- goto: ResetPassword.Goto,
221
- });
222
-
223
- export { ResetPassword };
224
- //# sourceMappingURL=index.esm.js.map
1
+ import{jsx as e,jsxs as r,Fragment as s}from"react/jsx-runtime";import{VisibilityOff as o,Visibility as t}from"@mui/icons-material";import{TextField as n,Stack as i,InputAdornment as a,IconButton as l,Button as d,Link as c,Typography as w}from"@mui/material";import{createContext as m,useContext as p,createElement as u,useState as f,Fragment as h}from"react";const b=["resetPasswordTitle","description","gotoSigninMessage","view","onSendRequest","onResetPassword","showPassword","onShowPasswordClick"],P=m(void 0),g=({children:r,...s})=>e(P.Provider,{value:s,children:r}),k=()=>{const e=p(P);if(!e)throw new Error("useResetPasswordContext must be used within a ResetPasswordProvider");return e};function v({blocksOverride:e,defaultBlocks:r,defaultBlockOrder:s,children:o}){if(void 0===e)return o({blocks:r,blockOrder:s});if("function"==typeof e){const{blocks:t,blockOrder:n}=e({defaultBlocks:r,defaultBlockOrder:s});return o({blocks:t,blockOrder:n})}return e}function y(e,r){const s={...e};for(const e in r)Object.prototype.hasOwnProperty.call(r,e)&&(s[e]=r[e]);return s}function N(...e){return e.flat().filter(Boolean).join(" ")}function x(e,...r){const s={...e};for(const e of r)delete s[e];return s}const O=({view:r="request",resetPasswordTitle:s="Reset Password",description:o="Please enter your email address you registered",gotoSigninMessage:t=e(c,{href:"/auth/login",children:"Back to Sign In"}),showPassword:n,onShowPasswordClick:a,className:l,children:d,sx:w,...m})=>{const[p,u]=f(!1);return e(g,{view:r,resetPasswordTitle:s,description:o,gotoSigninMessage:t,showPassword:n??p,onShowPasswordClick:a??u,...m,children:e(i,{className:N("nbb-reset-password",l),spacing:4,sx:[{background:e=>e.palette.background.paper,borderRadius:3,py:6,px:5,minWidth:{lg:496},width:"fit-content",margin:"auto"},...Array.isArray(w)?w:[w]],...x(m,...b),children:e(v,{defaultBlocks:A,defaultBlockOrder:Object.keys(A),blocksOverride:d,children:({blocks:{...r},blockOrder:s})=>s.filter(e=>e in r).map(s=>e(h,{children:r[s]},String(s)))})})})};O.Title=({sx:r,children:s,className:o,...t})=>{const n=k(),{resetPasswordTitle:i}=y(n,t);return e(w,{variant:"h4",component:"h1",sx:[{textAlign:"center"},...Array.isArray(r)?r:[r]],className:N("nbb-reset-password-title",o),...x(t,...b),children:s||i})},O.Description=({sx:r,children:s,className:o,...t})=>{const n=k(),{description:i}=y(n,t);return e(w,{variant:"body2",sx:[{textAlign:"center"},...Array.isArray(r)?r:[r]],className:N("nbb-reset-password-description",o),...x(t,...b),children:s||i})};const S=({children:o,className:t,...n})=>{const a=k(),{onSendRequest:l,onResetPassword:d,view:c}=y(a,n);return e(i,{component:"form",onSubmit:e=>{if(e&&(e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation()),!(e.target instanceof HTMLFormElement))return;const r=new FormData(e.target),s=Object.fromEntries(r);if("request"===c){if(!l)return;l(s)}if("confirm_password"===c){if(!d)return;d(s)}},className:N("nbb-reset-password-form",t),spacing:4,...x(n,...b),children:o||r(s,{children:[e(S.EmailField,{}),e(S.PasswordField,{}),e(S.ConfirmPasswordField,{}),e(S.ResetPasswordButton,{})]})})};O.Form=S,S.EmailField=({className:r,...s})=>{const o=k(),{view:t}=y(o,s);return"request"===t?e(n,{fullWidth:!0,name:"email",label:"Email",placeholder:"Please enter your email",className:N("nbb-reset-password-email-field",r),...x(s,...b)}):null},S.PasswordField=({className:r,...s})=>{const i=k(),{view:d,showPassword:c,onShowPasswordClick:w}=y(i,s);return"confirm_password"===d?e(n,{fullWidth:!0,name:"password",label:"Password",type:c?"text":"password",placeholder:"Please enter your new password",className:N("nbb-reset-password-password-field",r),slotProps:void 0!==c&&void 0!==w?{input:{endAdornment:e(a,{position:"end",children:e(l,{"aria-label":"toggle password visibility",onClick:()=>w(!c),edge:"end",children:e(c?o:t,{})})})}}:{},...x(s,...b)}):null},S.ConfirmPasswordField=({className:r,...s})=>{const i=k(),{view:d,showPassword:c,onShowPasswordClick:w}=y(i,s);return"confirm_password"===d?e(n,{fullWidth:!0,name:"confirmPassword",label:"Confirm Password",type:c?"text":"password",placeholder:"Please confirm your password",className:N("nbb-reset-password-confirm-password-field",r),slotProps:void 0!==c&&void 0!==w?{input:{endAdornment:e(a,{position:"end",children:e(l,{"aria-label":"toggle password visibility",onClick:()=>w(!c),edge:"end",children:e(c?o:t,{})})})}}:{},...x(s,...b)}):null},S.ResetPasswordButton=({children:r,className:s,...o})=>e(d,{variant:"contained",fullWidth:!0,type:"submit",className:N("nbb-reset-password-reset-password-button",s),...o,children:r||"Reset Password"});const A=(C={title:O.Title,description:O.Description,form:O.Form,goto:O.Goto=({children:r,className:s,sx:o,...t})=>{const n=k(),{gotoSigninMessage:i}=y(n,t);return e(w,{variant:"body2",className:N("nbb-reset-password-goto",s),sx:[{textAlign:"center"},...Array.isArray(o)?o:[o]],...x(t,...b),children:r||i})}},Object.fromEntries(Object.entries(C).map(([e,r])=>[e,u(r,{key:e})])));var C;export{O as ResetPassword};
package/dist/lib.d.ts CHANGED
@@ -72,10 +72,12 @@ export declare function BlocksOverrideComponent<DefaultBlocks extends Record<str
72
72
  blockOrder: readonly (keyof DefaultBlocks | keyof CustomBlocks)[];
73
73
  }) => ReactNode;
74
74
  }): ReactNode;
75
- type MergeTypes<Object1, Object2> = {
76
- [K in keyof Object1 | keyof Object2]: K extends keyof Object1 ? Object1[K] : K extends keyof Object2 ? Object2[K] : never;
75
+ type MergeKeepingRequired<A, B> = Omit<A, keyof B> & {
76
+ [K in keyof A & keyof B]-?: undefined extends B[K] ? A[K] : B[K];
77
+ } & {
78
+ [K in Exclude<keyof B, keyof A>]: B[K];
77
79
  };
78
- export declare function deepMerge<A extends Record<string, any>, B extends Record<string, any>>(obj1: A, obj2: B): MergeTypes<B, A>;
80
+ export declare function merge<A extends Record<PropertyKey, any>, B extends Record<PropertyKey, any>>(a: A, b: B): MergeKeepingRequired<A, B>;
79
81
  type ClassName = string | ClassName[] | undefined | null;
80
82
  /**
81
83
  * Utility function to join class names together, ignoring undefined or nil values.
@@ -83,5 +85,19 @@ type ClassName = string | ClassName[] | undefined | null;
83
85
  * @returns The joined class names.
84
86
  */
85
87
  export declare function classNames(...classes: ClassName[]): string;
88
+ /**
89
+ * Omits the given string keys from `source`.
90
+ *
91
+ * Usage:
92
+ * omit(obj, "a", "b")
93
+ */
94
+ export declare function omit<T extends object, const Keys extends readonly string[]>(source: T, ...keys: Keys): Omit<T, Extract<Keys[number], keyof T>>;
95
+ /**
96
+ * Picks the given keys out of `source` into a new object.
97
+ *
98
+ * Usage:
99
+ * pick(obj, "a", "b")
100
+ */
101
+ export declare function pick<T extends object, K extends PropertyKey>(source: T, ...keys: K[]): Pick<T, Extract<K, keyof T>>;
86
102
  export {};
87
103
  //# sourceMappingURL=lib.d.ts.map
package/dist/lib.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiB,iBAAiB,EAAE,YAAY,EAAE,SAAS,EAAE,MAA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AC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACjE,GAAG;KAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,CAAC;AAE/C,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,EAC1F,CAAC,EAAE,CAAC,EACJ,CAAC,EAAE,CAAC,GACH,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,CAQ5B;AAED,KAAK,SAAS,GAAG,MAAM,GAAG,SAAS,EAAE,GAAG,SAAS,GAAG,IAAI,CAAC;AAEzD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,OAAO,EAAE,SAAS,EAAE,GAAG,MAAM,CAE1D;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,CAAC,IAAI,SAAS,SAAS,MAAM,EAAE,EACzE,MAAM,EAAE,CAAC,EACT,GAAG,IAAI,EAAE,IAAI,GACZ,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAQzC;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,WAAW,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAWnH"}
@@ -9,53 +9,39 @@ export type ResetPasswordFormData = {
9
9
  confirmPassword?: string;
10
10
  };
11
11
  declare const ResetPassword: {
12
- <T extends ResetPasswordFormData, CustomBlocks extends Record<string, ReactNode> = {}>({ resetPasswordTitle, description, gotoSigninMessage, view, onSendRequest, onResetPassword, className, children, sx, ...props }: Omit<StackProps, "children" | "onSubmit"> & {
13
- resetPasswordTitle?: ReactNode;
14
- description?: ReactNode;
15
- gotoSigninMessage?: ReactNode;
16
- view: "request" | "confirm_password";
17
- onSendRequest: (data: T) => void;
18
- onResetPassword: (data: T) => void;
12
+ <T extends ResetPasswordFormData, CustomBlocks extends Record<string, ReactNode> = {}>({ view, resetPasswordTitle, description, gotoSigninMessage, showPassword: showPasswordProp, onShowPasswordClick: onShowPasswordClickProp, className, children, sx, ...props }: Omit<StackProps, "children" | "onSubmit"> & Required<Pick<ResetPasswordContextValue<T>, "view" | "onSendRequest" | "onResetPassword">> & Partial<Pick<ResetPasswordContextValue<T>, "resetPasswordTitle" | "description" | "gotoSigninMessage" | "showPassword" | "onShowPasswordClick">> & {
19
13
  children?: BlocksOverride<typeof defaultBlocks, CustomBlocks>;
20
- showPassword?: boolean;
21
- onShowPasswordClick?: (show: boolean) => void;
22
14
  }): import("react/jsx-runtime").JSX.Element;
23
- Title({ sx, children, className, ...props }: Partial<TypographyProps>): import("react/jsx-runtime").JSX.Element;
24
- Description({ sx, children, className, ...props }: Partial<TypographyProps>): import("react/jsx-runtime").JSX.Element;
15
+ Title({ sx, children, className, ...props }: Partial<TypographyProps & Pick<ResetPasswordContextValue, "resetPasswordTitle">>): import("react/jsx-runtime").JSX.Element;
16
+ Description({ sx, children, className, ...props }: Partial<TypographyProps & Pick<ResetPasswordContextValue, "description">>): import("react/jsx-runtime").JSX.Element;
25
17
  Form: {
26
- <T extends ResetPasswordFormData>({ children, className, ...props }: Partial<StackProps<"form"> & {
27
- view?: "request" | "confirm_password";
28
- onSendRequest?: (data: T) => void;
29
- onResetPassword?: (data: T) => void;
30
- }>): import("react/jsx-runtime").JSX.Element;
31
- EmailField: ({ className, ...props }: Partial<TextFieldProps>) => import("react/jsx-runtime").JSX.Element | null;
32
- PasswordField: ({ className, ...props }: Partial<TextFieldProps & Pick<ResetPasswordContextValue, "showPassword" | "onShowPasswordClick">>) => import("react/jsx-runtime").JSX.Element | null;
33
- ConfirmPasswordField: ({ className, ...props }: Partial<TextFieldProps & Pick<ResetPasswordContextValue, "showPassword" | "onShowPasswordClick">>) => import("react/jsx-runtime").JSX.Element | null;
18
+ <T extends ResetPasswordFormData>({ children, className, ...props }: Partial<StackProps<"form"> & Pick<ResetPasswordContextValue<T>, "view" | "onSendRequest" | "onResetPassword">>): import("react/jsx-runtime").JSX.Element;
19
+ EmailField: ({ className, ...props }: Partial<TextFieldProps & Pick<ResetPasswordContextValue, "view">>) => import("react/jsx-runtime").JSX.Element | null;
20
+ PasswordField: ({ className, ...props }: Partial<TextFieldProps & Pick<ResetPasswordContextValue, "view" | "showPassword" | "onShowPasswordClick">>) => import("react/jsx-runtime").JSX.Element | null;
21
+ ConfirmPasswordField: ({ className, ...props }: Partial<TextFieldProps & Pick<ResetPasswordContextValue, "view" | "showPassword" | "onShowPasswordClick">>) => import("react/jsx-runtime").JSX.Element | null;
34
22
  ResetPasswordButton: ({ children, className, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
35
23
  };
36
- Goto({ children, className, sx, ...props }: Partial<TypographyProps>): import("react/jsx-runtime").JSX.Element;
24
+ Goto({ children, className, sx, ...props }: Partial<TypographyProps & Pick<ResetPasswordContextValue, "gotoSigninMessage">>): import("react/jsx-runtime").JSX.Element;
37
25
  };
38
26
  declare const defaultBlocks: {
39
- title: import("react").ReactElement<Partial<TypographyProps>, ({ sx, children, className, ...props }: Partial<TypographyProps>) => import("react/jsx-runtime").JSX.Element>;
40
- description: import("react").ReactElement<Partial<TypographyProps>, ({ sx, children, className, ...props }: Partial<TypographyProps>) => import("react/jsx-runtime").JSX.Element>;
27
+ title: import("react").ReactElement<Partial<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "color" | "left" | "right" | "children" | "className" | "classes" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "zIndex" | "position" | "top" | "bottom" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "sx" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variant" | "variantMapping"> & {
28
+ component?: React.ElementType;
29
+ } & Pick<ResetPasswordContextValue, "resetPasswordTitle">>, ({ sx, children, className, ...props }: Partial<TypographyProps & Pick<ResetPasswordContextValue, "resetPasswordTitle">>) => import("react/jsx-runtime").JSX.Element>;
30
+ description: import("react").ReactElement<Partial<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "color" | "left" | "right" | "children" | "className" | "classes" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "zIndex" | "position" | "top" | "bottom" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "sx" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variant" | "variantMapping"> & {
31
+ component?: React.ElementType;
32
+ } & Pick<ResetPasswordContextValue, "description">>, ({ sx, children, className, ...props }: Partial<TypographyProps & Pick<ResetPasswordContextValue, "description">>) => import("react/jsx-runtime").JSX.Element>;
41
33
  form: import("react").ReactElement<Partial<import("@mui/material").StackOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").FormHTMLAttributes<HTMLFormElement>, HTMLFormElement>, keyof import("@mui/material/OverridableComponent").CommonProps | keyof import("@mui/material").StackOwnProps> & {
42
34
  component?: React.ElementType;
43
- } & {
44
- view?: "request" | "confirm_password";
45
- onSendRequest?: ((data: ResetPasswordFormData) => void) | undefined;
46
- onResetPassword?: ((data: ResetPasswordFormData) => void) | undefined;
47
- }>, {
48
- <T extends ResetPasswordFormData>({ children, className, ...props }: Partial<StackProps<"form"> & {
49
- view?: "request" | "confirm_password";
50
- onSendRequest?: (data: T) => void;
51
- onResetPassword?: (data: T) => void;
52
- }>): import("react/jsx-runtime").JSX.Element;
53
- EmailField: ({ className, ...props }: Partial<TextFieldProps>) => import("react/jsx-runtime").JSX.Element | null;
54
- PasswordField: ({ className, ...props }: Partial<TextFieldProps & Pick<ResetPasswordContextValue, "showPassword" | "onShowPasswordClick">>) => import("react/jsx-runtime").JSX.Element | null;
55
- ConfirmPasswordField: ({ className, ...props }: Partial<TextFieldProps & Pick<ResetPasswordContextValue, "showPassword" | "onShowPasswordClick">>) => import("react/jsx-runtime").JSX.Element | null;
35
+ } & Pick<ResetPasswordContextValue<ResetPasswordFormData>, "view" | "onSendRequest" | "onResetPassword">>, {
36
+ <T extends ResetPasswordFormData>({ children, className, ...props }: Partial<StackProps<"form"> & Pick<ResetPasswordContextValue<T>, "view" | "onSendRequest" | "onResetPassword">>): import("react/jsx-runtime").JSX.Element;
37
+ EmailField: ({ className, ...props }: Partial<TextFieldProps & Pick<ResetPasswordContextValue, "view">>) => import("react/jsx-runtime").JSX.Element | null;
38
+ PasswordField: ({ className, ...props }: Partial<TextFieldProps & Pick<ResetPasswordContextValue, "view" | "showPassword" | "onShowPasswordClick">>) => import("react/jsx-runtime").JSX.Element | null;
39
+ ConfirmPasswordField: ({ className, ...props }: Partial<TextFieldProps & Pick<ResetPasswordContextValue, "view" | "showPassword" | "onShowPasswordClick">>) => import("react/jsx-runtime").JSX.Element | null;
56
40
  ResetPasswordButton: ({ children, className, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
57
41
  }>;
58
- goto: import("react").ReactElement<Partial<TypographyProps>, ({ children, className, sx, ...props }: Partial<TypographyProps>) => import("react/jsx-runtime").JSX.Element>;
42
+ goto: import("react").ReactElement<Partial<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "color" | "left" | "right" | "children" | "className" | "classes" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "zIndex" | "position" | "top" | "bottom" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "sx" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variant" | "variantMapping"> & {
43
+ component?: React.ElementType;
44
+ } & Pick<ResetPasswordContextValue, "gotoSigninMessage">>, ({ children, className, sx, ...props }: Partial<TypographyProps & Pick<ResetPasswordContextValue, "gotoSigninMessage">>) => import("react/jsx-runtime").JSX.Element>;
59
45
  };
60
46
  export default ResetPassword;
61
47
  //# sourceMappingURL=reset-password.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reset-password.d.ts","sourceRoot":"","sources":["../src/reset-password.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,WAAW,EAKX,UAAU,EAEV,cAAc,EAEd,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAuB,SAAS,EAAY,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAkD,MAAM,WAAW,CAAC;AACtG,OAAO,EAAE,cAAc,EAAuE,MAAM,OAAO,CAAC;AAE5G,MAAM,MAAM,qBAAqB,GAC7B;IACE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GACD;IACE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEN,QAAA,MAAM,aAAa;KAAI,CAAC,SAAS,qBAAqB,EAAE,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,wIAWnG,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC,GAAG;QAC7C,kBAAkB,CAAC,EAAE,SAAS,CAAC;QAC/B,WAAW,CAAC,EAAE,SAAS,CAAC;QACxB,iBAAiB,CAAC,EAAE,SAAS,CAAC;QAC9B,IAAI,EAAE,SAAS,GAAG,kBAAkB,CAAC;QACrC,aAAa,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;QACjC,eAAe,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;QACnC,QAAQ,CAAC,EAAE,cAAc,CAAC,OAAO,aAAa,EAAE,YAAY,CAAC,CAAC;QAC9D,YAAY,CAA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CAAC,cAAc,GAAG,IAAI,CAAC,yBAAyB,EAAE,MAAM,GAAG,cAAc,GAAG,qBAAqB,CAAC,CAAC;iEAsC7C,WAAW;;;;uGAqBxE,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,yBAAyB,EAAE,mBAAmB,CAAC,CAAC;CA0BhF,CAAC;AAEH,eAAe,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,17 +1,24 @@
1
1
  {
2
2
  "name": "@nodeblocks/frontend-reset-password-block",
3
- "version": "0.2.0",
4
- "main": "dist/index.cjs.js",
5
- "module": "dist/index.esm.js",
6
- "browser": "dist/index.iife.js",
7
- "types": "dist/index.d.ts",
3
+ "version": "0.2.2",
4
+ "main": "./dist/index.cjs.js",
5
+ "module": "./dist/index.esm.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.esm.js",
11
+ "require": "./dist/index.cjs.js",
12
+ "default": "./dist/index.esm.js"
13
+ }
14
+ },
8
15
  "files": [
9
- "dist/",
10
- "dist/index.css"
16
+ "dist/"
11
17
  ],
12
18
  "scripts": {
13
- "build": "rollup -c",
14
- "watch": "rm -rf dist && cross-env NODE_ENV=development rollup -c --watch"
19
+ "build": "npm run typecheck && rollup -c",
20
+ "watch": "rm -rf dist && cross-env NODE_ENV=development rollup -c --watch",
21
+ "typecheck": "tsc --noEmit"
15
22
  },
16
23
  "peerDependencies": {
17
24
  "@emotion/react": "^11.14.0",
@@ -25,12 +32,12 @@
25
32
  "@rollup/plugin-commonjs": "^28.0.6",
26
33
  "@rollup/plugin-json": "^6.1.0",
27
34
  "@rollup/plugin-node-resolve": "^15.3.0",
35
+ "@rollup/plugin-terser": "^0.4.4",
28
36
  "@rollup/plugin-typescript": "^12.1.1",
29
37
  "@types/react": "19.2.7",
30
38
  "@types/react-dom": "19.2.3",
31
- "rollup": "^4.28.0",
39
+ "rollup": "^4.55.1",
32
40
  "rollup-plugin-peer-deps-external": "^2.2.4",
33
- "rollup-plugin-polyfill-node": "^0.13.0",
34
41
  "rollup-plugin-postcss": "^4.0.2",
35
42
  "rollup-plugin-serve": "^1.1.1",
36
43
  "tslib": "^2.8.1",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/context.tsx","../src/lib.ts","../src/reset-password.tsx"],"sourcesContent":["import { createContext, ReactNode, useContext } from 'react';\nimport { ResetPasswordFormData } from './reset-password';\n\nexport type ResetPasswordContextValue<\n // NOTE: It's impossible to know the form data type right now,\n // since it isn't known at the moment of creating the context.\n // However, we need to provide a type now for inference to work later.\n T extends ResetPasswordFormData = any\n> = {\n resetPasswordTitle: ReactNode;\n description: ReactNode;\n gotoSigninMessage: ReactNode;\n view: 'request' | 'confirm_password';\n onSendRequest: (data: T) => void;\n onResetPassword: (data: T) => void;\n showPassword: boolean;\n onShowPasswordClick: (show: boolean) => void;\n};\n\nconst ResetPasswordContext = createContext<ResetPasswordContextValue | undefined>(undefined);\n\nexport const ResetPasswordProvider = <T extends ResetPasswordFormData>({\n children,\n ...value\n}: ResetPasswordContextValue<T> & {\n children: ReactNode;\n}) => {\n return <ResetPasswordContext.Provider value={value}>{children}</ResetPasswordContext.Provider>;\n};\n\nexport const useResetPasswordContext = <T extends ResetPasswordFormData>() => {\n const context = useContext<ResetPasswordContextValue<T> | undefined>(ResetPasswordContext);\n\n if (!context) {\n throw new Error('useResetPasswordContext must be used within a ResetPasswordProvider');\n }\n return context;\n};\n","import { ComponentProps, createElement, FunctionComponent, ReactElement, ReactNode } from 'react';\n\n/**\n * The function to be passed into a block component as `children` to selectively override default blocks, or just a `ReactNode`.\n *\n * @example\n * <Block>\n * {({ defaultBlocks: { header, ...defaultBlocks }, defaultBlockOrder }) => ({\n * blocks: {\n * ...defaultBlocks,\n * header: {\n * ...header,\n * props: {\n * ...header.props,\n * label: \"Custom Label\"\n * }\n * },\n * subheader: <CustomComponent />\n * },\n * blockOrder: [\"header\", \"subheader\", \"body\", \"footer\"]\n * })}\n * </Block>\n */\nexport type BlocksOverride<DefaultBlocks, CustomBlocks> =\n | (({\n defaultBlocks,\n defaultBlockOrder,\n }: {\n defaultBlocks: DefaultBlocks;\n defaultBlockOrder: readonly (keyof DefaultBlocks)[];\n }) => {\n blocks: Partial<DefaultBlocks> & CustomBlocks;\n // NOTE: This specific combination allows proper autocomplete.\n blockOrder: readonly (keyof DefaultBlocks)[] | readonly (keyof CustomBlocks)[];\n })\n | ReactNode;\n\n/**\n * Creates a strongly typed `defaultBlocks` object, allowing for types to propagate into block override objects.\n *\n * @param components - A map of default block keys to component functions.\n *\n * @example\n * const defaultBlocks = createDefaultBlocks({\n * title: Title,\n * description: Description,\n * form: Form,\n * });\n */\nexport function createDefaultBlocks<T extends Record<string, FunctionComponent<any>>>(\n components: T\n): {\n [K in keyof T]: ReactElement<ComponentProps<T[K]>, T[K]>;\n} {\n return Object.fromEntries(\n Object.entries(components).map(([key, Component]) => [key, createElement(Component, { key })])\n ) as {\n [K in keyof T]: ReactElement<ComponentProps<T[K]>, T[K]>;\n };\n}\n\n/**\n * A component for rendering {@link BlocksOverride|`BlocksOverride`} results.\n * Exposes the evaluated `blocks` and `blockOrder` as arguments to the `children` function.\n *\n * @param props\n * @param props.blocksOverride - The {@link BlocksOverride|`BlocksOverride`} (i.e. `children` of outer component).\n * @param props.defaultBlocks - The default blocks of outer component.\n * @param props.children - A function returning the JSX to render.\n *\n * @example\n * <BlocksOverrideComponent\n * defaultBlocks={defaultFormBlocks}\n * blocksOverride={children}\n * >\n * {({ blocks, blockOrder }) =>\n * blockOrder.map((key) => (\n * <Fragment key={String(key)}>{blocks[key]}</Fragment>\n * ))\n * }\n * </BlocksOverrideComponent>\n */\nexport function BlocksOverrideComponent<\n DefaultBlocks extends Record<string, ReactNode>,\n CustomBlocks extends Record<string, ReactNode>,\n>({\n blocksOverride,\n defaultBlocks,\n defaultBlockOrder,\n children,\n}: {\n blocksOverride: BlocksOverride<DefaultBlocks, CustomBlocks>;\n defaultBlocks: DefaultBlocks;\n defaultBlockOrder: (keyof DefaultBlocks)[];\n children: ({\n blocks,\n blockOrder,\n }: {\n // TODO: Possibly find an alternative to Partial<CustomBlocks>\n blocks: Partial<DefaultBlocks> & Partial<CustomBlocks>;\n blockOrder: readonly (keyof DefaultBlocks | keyof CustomBlocks)[];\n }) => ReactNode;\n}) {\n if (blocksOverride === undefined) {\n return children({\n // TODO: Remove this assertion\n blocks: defaultBlocks as DefaultBlocks & Partial<CustomBlocks>,\n blockOrder: defaultBlockOrder,\n });\n }\n\n if (typeof blocksOverride === 'function') {\n const { blocks, blockOrder } = blocksOverride({\n defaultBlocks,\n defaultBlockOrder,\n });\n\n return children({ blocks, blockOrder });\n }\n\n return blocksOverride;\n}\n\ntype MergeTypes<Object1, Object2> = {\n [K in keyof Object1 | keyof Object2]: K extends keyof Object1\n ? Object1[K]\n : K extends keyof Object2\n ? Object2[K]\n : never;\n};\n\nexport function deepMerge<A extends Record<string, any>, B extends Record<string, any>>(obj1: A, obj2: B) {\n const result: Record<string, any> = { ...obj1 };\n\n for (const key in obj2) {\n if (obj2.hasOwnProperty(key)) {\n const val1 = result[key];\n const val2 = obj2[key];\n\n if (Array.isArray(val1) || Array.isArray(val2)) {\n // If either is an array, replace entirely with obj2's value\n result[key] = val2;\n } else if (typeof val1 === 'object' && val1 !== null && typeof val2 === 'object' && val2 !== null) {\n result[key] = deepMerge(val1, val2);\n } else {\n result[key] = val2;\n }\n }\n }\n\n return result as MergeTypes<B, A>;\n}\n\ntype ClassName = string | ClassName[] | undefined | null;\n\n/**\n * Utility function to join class names together, ignoring undefined or nil values.\n * @param classes - The class names to join.\n * @returns The joined class names.\n */\nexport function classNames(...classes: ClassName[]): string {\n return classes.flat().filter(Boolean).join(' ');\n}\n","import { Visibility, VisibilityOff } from '@mui/icons-material';\nimport {\n Button,\n ButtonProps,\n IconButton,\n InputAdornment,\n Link,\n Stack,\n StackProps,\n TextField,\n TextFieldProps,\n Typography,\n TypographyProps,\n} from '@mui/material';\nimport { FormEvent, Fragment, ReactNode, useState } from 'react';\nimport { ResetPasswordContextValue, ResetPasswordProvider, useResetPasswordContext } from './context';\nimport { BlocksOverride, BlocksOverrideComponent, classNames, createDefaultBlocks, deepMerge } from './lib';\n\nexport type ResetPasswordFormData =\n | {\n email?: string;\n }\n | {\n password?: string;\n confirmPassword?: string;\n };\n\nconst ResetPassword = <T extends ResetPasswordFormData, CustomBlocks extends Record<string, ReactNode> = {}>({\n resetPasswordTitle,\n description,\n gotoSigninMessage,\n view = 'request',\n onSendRequest,\n onResetPassword,\n className,\n children,\n sx,\n ...props\n}: Omit<StackProps, 'children' | 'onSubmit'> & {\n resetPasswordTitle?: ReactNode;\n description?: ReactNode;\n gotoSigninMessage?: ReactNode;\n view: 'request' | 'confirm_password';\n onSendRequest: (data: T) => void;\n onResetPassword: (data: T) => void;\n children?: BlocksOverride<typeof defaultBlocks, CustomBlocks>;\n showPassword?: boolean;\n onShowPasswordClick?: (show: boolean) => void;\n}) => {\n const [showPassword, setShowPassword] = useState(false);\n\n return (\n <ResetPasswordProvider\n {...{\n resetPasswordTitle,\n description,\n gotoSigninMessage,\n view,\n onSendRequest,\n onResetPassword,\n showPassword: props.showPassword ?? showPassword,\n onShowPasswordClick: props.onShowPasswordClick ?? setShowPassword,\n }}\n >\n <Stack\n className={classNames('nbb-reset-password', className)}\n spacing={4}\n sx={[\n {\n background: (theme) => theme.palette.background.paper,\n borderRadius: 3,\n py: 6,\n px: 5,\n minWidth: { lg: 496 },\n width: 'fit-content',\n margin: 'auto',\n },\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n {...props}\n >\n <BlocksOverrideComponent\n defaultBlocks={defaultBlocks}\n defaultBlockOrder={Object.keys(defaultBlocks) as (keyof typeof defaultBlocks)[]}\n blocksOverride={children}\n >\n {({ blocks: { ...blocks }, blockOrder }) =>\n blockOrder\n .filter((key) => key in blocks)\n .map<ReactNode>((key) => <Fragment key={String(key)}>{blocks[key]}</Fragment>)\n }\n </BlocksOverrideComponent>\n </Stack>\n </ResetPasswordProvider>\n );\n};\n\nResetPassword.Title = ({ sx, children, className, ...props }: Partial<TypographyProps>) => {\n const { resetPasswordTitle = 'Reset Password' } = deepMerge(useResetPasswordContext(), props);\n\n return (\n <Typography\n variant=\"h4\"\n component=\"h1\"\n sx={[\n {\n textAlign: 'center',\n },\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n className={classNames('nbb-reset-password-title', className)}\n {...props}\n >\n {children || resetPasswordTitle}\n </Typography>\n );\n};\n\nResetPassword.Description = ({ sx, children, className, ...props }: Partial<TypographyProps>) => {\n const { description = 'Please enter your email address you registered' } = deepMerge(\n useResetPasswordContext(),\n props\n );\n\n return (\n <Typography\n variant=\"body2\"\n sx={[\n {\n textAlign: 'center',\n },\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n className={classNames('nbb-reset-password-description', className)}\n {...props}\n >\n {children || description}\n </Typography>\n );\n};\n\nconst Form = <T extends ResetPasswordFormData>({\n children,\n className,\n ...props\n}: Partial<\n StackProps<'form'> & {\n view?: 'request' | 'confirm_password';\n onSendRequest?: (data: T) => void;\n onResetPassword?: (data: T) => void;\n }\n>) => {\n const { onSendRequest, onResetPassword, view } = deepMerge(useResetPasswordContext(), props);\n\n const onSubmitHandler = (e: FormEvent) => {\n if (e) {\n e.preventDefault && e.preventDefault();\n e.stopPropagation && e.stopPropagation();\n }\n\n if (!(e.target instanceof HTMLFormElement)) {\n return;\n }\n\n const formData = new FormData(e.target);\n const data = Object.fromEntries(formData) as T;\n\n if (view === 'request') {\n if (!onSendRequest) {\n return;\n }\n onSendRequest(data);\n }\n\n if (view === 'confirm_password') {\n if (!onResetPassword) {\n return;\n }\n\n onResetPassword(data);\n }\n };\n\n return (\n <Stack\n component=\"form\"\n onSubmit={onSubmitHandler}\n className={classNames('nbb-reset-password-form', className)}\n spacing={4}\n {...props}\n >\n {children || (\n <>\n <Form.EmailField />\n <Form.PasswordField />\n <Form.ConfirmPasswordField />\n <Form.ResetPasswordButton />\n </>\n )}\n </Stack>\n );\n};\n\nResetPassword.Form = Form;\n\nconst EmailField = ({ className, ...props }: Partial<TextFieldProps>) => {\n const { view } = useResetPasswordContext();\n\n return view === 'request' ? (\n <TextField\n fullWidth\n name=\"email\"\n label=\"Email\"\n placeholder=\"Please enter your email\"\n className={classNames('nbb-reset-password-email-field', className)}\n {...props}\n />\n ) : null;\n};\n\nForm.EmailField = EmailField;\n\nconst PasswordField = ({\n className,\n ...props\n}: Partial<TextFieldProps & Pick<ResetPasswordContextValue, 'showPassword' | 'onShowPasswordClick'>>) => {\n const { view, showPassword, onShowPasswordClick } = deepMerge(useResetPasswordContext(), props);\n\n return view === 'confirm_password' ? (\n <TextField\n fullWidth\n name=\"password\"\n label=\"Password\"\n type={showPassword ? 'text' : 'password'}\n placeholder=\"Please enter your new password\"\n className={classNames('nbb-reset-password-password-field', className)}\n slotProps={\n showPassword !== undefined && onShowPasswordClick !== undefined\n ? {\n input: {\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton\n aria-label=\"toggle password visibility\"\n onClick={() => onShowPasswordClick(!showPassword)}\n edge=\"end\"\n >\n {showPassword ? <VisibilityOff /> : <Visibility />}\n </IconButton>\n </InputAdornment>\n ),\n },\n }\n : {}\n }\n {...props}\n />\n ) : null;\n};\n\nForm.PasswordField = PasswordField;\n\nconst ConfirmPasswordField = ({\n className,\n ...props\n}: Partial<TextFieldProps & Pick<ResetPasswordContextValue, 'showPassword' | 'onShowPasswordClick'>>) => {\n const { view, showPassword, onShowPasswordClick } = deepMerge(useResetPasswordContext(), props);\n\n return view === 'confirm_password' ? (\n <TextField\n fullWidth\n name=\"confirmPassword\"\n label=\"Confirm Password\"\n type={showPassword ? 'text' : 'password'}\n placeholder=\"Please confirm your password\"\n className={classNames('nbb-reset-password-confirm-password-field', className)}\n slotProps={\n showPassword !== undefined && onShowPasswordClick !== undefined\n ? {\n input: {\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton\n aria-label=\"toggle password visibility\"\n onClick={() => onShowPasswordClick(!showPassword)}\n edge=\"end\"\n >\n {showPassword ? <VisibilityOff /> : <Visibility />}\n </IconButton>\n </InputAdornment>\n ),\n },\n }\n : {}\n }\n {...props}\n />\n ) : null;\n};\n\nForm.ConfirmPasswordField = ConfirmPasswordField;\n\nconst ResetPasswordButton = ({ children, className, ...props }: ButtonProps) => {\n return (\n <Button\n variant=\"contained\"\n fullWidth\n type=\"submit\"\n className={classNames('nbb-reset-password-reset-password-button', className)}\n {...props}\n >\n {children || 'Reset Password'}\n </Button>\n );\n};\n\nForm.ResetPasswordButton = ResetPasswordButton;\n\nResetPassword.Goto = ({ children, className, sx, ...props }: Partial<TypographyProps>) => {\n const { gotoSigninMessage } = deepMerge(useResetPasswordContext(), props);\n\n return (\n <Typography\n variant=\"body2\"\n className={classNames('nbb-reset-password-goto', className)}\n sx={[\n {\n textAlign: 'center',\n },\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n {...props}\n >\n {children || gotoSigninMessage || (\n <>\n <Link href=\"/auth/login\">Back to Sign In</Link>\n </>\n )}\n </Typography>\n );\n};\n\nconst defaultBlocks = createDefaultBlocks({\n title: ResetPassword.Title,\n description: ResetPassword.Description,\n form: ResetPassword.Form,\n goto: ResetPassword.Goto,\n});\n\nexport default ResetPassword;\n"],"names":["createContext","_jsx","useContext","createElement","useState","Stack","Fragment","Typography","_jsxs","_Fragment","TextField","InputAdornment","IconButton","VisibilityOff","Visibility","Button","Link"],"mappings":";;;;;;;;;;;;;AAmBA,MAAM,oBAAoB,GAAGA,mBAAa,CAAwC,SAAS,CAAC;AAErF,MAAM,qBAAqB,GAAG,CAAkC,EACrE,QAAQ,EACR,GAAG,KAAK,EAGT,KAAI;IACH,OAAOC,cAAA,CAAC,oBAAoB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,KAAK,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAiC;AAChG,CAAC;AAEM,MAAM,uBAAuB,GAAG,MAAsC;AA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B,CAAA,CAAC;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/context.tsx","../src/lib.ts","../src/reset-password.tsx"],"sourcesContent":["import { createContext, ReactNode, useContext } from 'react';\nimport { ResetPasswordFormData } from './reset-password';\n\nexport type ResetPasswordContextValue<\n // NOTE: It's impossible to know the form data type right now,\n // since it isn't known at the moment of creating the context.\n // However, we need to provide a type now for inference to work later.\n T extends ResetPasswordFormData = any\n> = {\n resetPasswordTitle: ReactNode;\n description: ReactNode;\n gotoSigninMessage: ReactNode;\n view: 'request' | 'confirm_password';\n onSendRequest: (data: T) => void;\n onResetPassword: (data: T) => void;\n showPassword: boolean;\n onShowPasswordClick: (show: boolean) => void;\n};\n\nconst ResetPasswordContext = createContext<ResetPasswordContextValue | undefined>(undefined);\n\nexport const ResetPasswordProvider = <T extends ResetPasswordFormData>({\n children,\n ...value\n}: ResetPasswordContextValue<T> & {\n children: ReactNode;\n}) => {\n return <ResetPasswordContext.Provider value={value}>{children}</ResetPasswordContext.Provider>;\n};\n\nexport const useResetPasswordContext = <T extends ResetPasswordFormData>() => {\n const context = useContext<ResetPasswordContextValue<T> | undefined>(ResetPasswordContext);\n\n if (!context) {\n throw new Error('useResetPasswordContext must be used within a ResetPasswordProvider');\n }\n return context;\n};\n","import { ComponentProps, createElement, FunctionComponent, ReactElement, ReactNode } from 'react';\n\n/**\n * The function to be passed into a block component as `children` to selectively override default blocks, or just a `ReactNode`.\n *\n * @example\n * <Block>\n * {({ defaultBlocks: { header, ...defaultBlocks }, defaultBlockOrder }) => ({\n * blocks: {\n * ...defaultBlocks,\n * header: {\n * ...header,\n * props: {\n * ...header.props,\n * label: \"Custom Label\"\n * }\n * },\n * subheader: <CustomComponent />\n * },\n * blockOrder: [\"header\", \"subheader\", \"body\", \"footer\"]\n * })}\n * </Block>\n */\nexport type BlocksOverride<DefaultBlocks, CustomBlocks> =\n | (({\n defaultBlocks,\n defaultBlockOrder,\n }: {\n defaultBlocks: DefaultBlocks;\n defaultBlockOrder: readonly (keyof DefaultBlocks)[];\n }) => {\n blocks: Partial<DefaultBlocks> & CustomBlocks;\n // NOTE: This specific combination allows proper autocomplete.\n blockOrder: readonly (keyof DefaultBlocks)[] | readonly (keyof CustomBlocks)[];\n })\n | ReactNode;\n\n/**\n * Creates a strongly typed `defaultBlocks` object, allowing for types to propagate into block override objects.\n *\n * @param components - A map of default block keys to component functions.\n *\n * @example\n * const defaultBlocks = createDefaultBlocks({\n * title: Title,\n * description: Description,\n * form: Form,\n * });\n */\nexport function createDefaultBlocks<T extends Record<string, FunctionComponent<any>>>(\n components: T\n): {\n [K in keyof T]: ReactElement<ComponentProps<T[K]>, T[K]>;\n} {\n return Object.fromEntries(\n Object.entries(components).map(([key, Component]) => [key, createElement(Component, { key })])\n ) as {\n [K in keyof T]: ReactElement<ComponentProps<T[K]>, T[K]>;\n };\n}\n\n/**\n * A component for rendering {@link BlocksOverride|`BlocksOverride`} results.\n * Exposes the evaluated `blocks` and `blockOrder` as arguments to the `children` function.\n *\n * @param props\n * @param props.blocksOverride - The {@link BlocksOverride|`BlocksOverride`} (i.e. `children` of outer component).\n * @param props.defaultBlocks - The default blocks of outer component.\n * @param props.children - A function returning the JSX to render.\n *\n * @example\n * <BlocksOverrideComponent\n * defaultBlocks={defaultFormBlocks}\n * blocksOverride={children}\n * >\n * {({ blocks, blockOrder }) =>\n * blockOrder.map((key) => (\n * <Fragment key={String(key)}>{blocks[key]}</Fragment>\n * ))\n * }\n * </BlocksOverrideComponent>\n */\nexport function BlocksOverrideComponent<\n DefaultBlocks extends Record<string, ReactNode>,\n CustomBlocks extends Record<string, ReactNode>,\n>({\n blocksOverride,\n defaultBlocks,\n defaultBlockOrder,\n children,\n}: {\n blocksOverride: BlocksOverride<DefaultBlocks, CustomBlocks>;\n defaultBlocks: DefaultBlocks;\n defaultBlockOrder: (keyof DefaultBlocks)[];\n children: ({\n blocks,\n blockOrder,\n }: {\n // TODO: Possibly find an alternative to Partial<CustomBlocks>\n blocks: Partial<DefaultBlocks> & Partial<CustomBlocks>;\n blockOrder: readonly (keyof DefaultBlocks | keyof CustomBlocks)[];\n }) => ReactNode;\n}) {\n if (blocksOverride === undefined) {\n return children({\n // TODO: Remove this assertion\n blocks: defaultBlocks as DefaultBlocks & Partial<CustomBlocks>,\n blockOrder: defaultBlockOrder,\n });\n }\n\n if (typeof blocksOverride === 'function') {\n const { blocks, blockOrder } = blocksOverride({\n defaultBlocks,\n defaultBlockOrder,\n });\n\n return children({ blocks, blockOrder });\n }\n\n return blocksOverride;\n}\n\ntype MergeTypes<Object1, Object2> = {\n [K in keyof Object1 | keyof Object2]: K extends keyof Object1\n ? Object1[K]\n : K extends keyof Object2\n ? Object2[K]\n : never;\n};\n\nexport function deepMerge<A extends Record<string, any>, B extends Record<string, any>>(obj1: A, obj2: B) {\n const result: Record<string, any> = { ...obj1 };\n\n for (const key in obj2) {\n if (obj2.hasOwnProperty(key)) {\n const val1 = result[key];\n const val2 = obj2[key];\n\n if (Array.isArray(val1) || Array.isArray(val2)) {\n // If either is an array, replace entirely with obj2's value\n result[key] = val2;\n } else if (typeof val1 === 'object' && val1 !== null && typeof val2 === 'object' && val2 !== null) {\n result[key] = deepMerge(val1, val2);\n } else {\n result[key] = val2;\n }\n }\n }\n\n return result as MergeTypes<B, A>;\n}\n\ntype ClassName = string | ClassName[] | undefined | null;\n\n/**\n * Utility function to join class names together, ignoring undefined or nil values.\n * @param classes - The class names to join.\n * @returns The joined class names.\n */\nexport function classNames(...classes: ClassName[]): string {\n return classes.flat().filter(Boolean).join(' ');\n}\n","import { Visibility, VisibilityOff } from '@mui/icons-material';\nimport {\n Button,\n ButtonProps,\n IconButton,\n InputAdornment,\n Link,\n Stack,\n StackProps,\n TextField,\n TextFieldProps,\n Typography,\n TypographyProps,\n} from '@mui/material';\nimport { FormEvent, Fragment, ReactNode, useState } from 'react';\nimport { ResetPasswordContextValue, ResetPasswordProvider, useResetPasswordContext } from './context';\nimport { BlocksOverride, BlocksOverrideComponent, classNames, createDefaultBlocks, deepMerge } from './lib';\n\nexport type ResetPasswordFormData =\n | {\n email?: string;\n }\n | {\n password?: string;\n confirmPassword?: string;\n };\n\nconst ResetPassword = <T extends ResetPasswordFormData, CustomBlocks extends Record<string, ReactNode> = {}>({\n resetPasswordTitle,\n description,\n gotoSigninMessage,\n view = 'request',\n onSendRequest,\n onResetPassword,\n className,\n children,\n sx,\n ...props\n}: Omit<StackProps, 'children' | 'onSubmit'> & {\n resetPasswordTitle?: ReactNode;\n description?: ReactNode;\n gotoSigninMessage?: ReactNode;\n view: 'request' | 'confirm_password';\n onSendRequest: (data: T) => void;\n onResetPassword: (data: T) => void;\n children?: BlocksOverride<typeof defaultBlocks, CustomBlocks>;\n showPassword?: boolean;\n onShowPasswordClick?: (show: boolean) => void;\n}) => {\n const [showPassword, setShowPassword] = useState(false);\n\n return (\n <ResetPasswordProvider\n {...{\n resetPasswordTitle,\n description,\n gotoSigninMessage,\n view,\n onSendRequest,\n onResetPassword,\n showPassword: props.showPassword ?? showPassword,\n onShowPasswordClick: props.onShowPasswordClick ?? setShowPassword,\n }}\n >\n <Stack\n className={classNames('nbb-reset-password', className)}\n spacing={4}\n sx={[\n {\n background: (theme) => theme.palette.background.paper,\n borderRadius: 3,\n py: 6,\n px: 5,\n minWidth: { lg: 496 },\n width: 'fit-content',\n margin: 'auto',\n },\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n {...props}\n >\n <BlocksOverrideComponent\n defaultBlocks={defaultBlocks}\n defaultBlockOrder={Object.keys(defaultBlocks) as (keyof typeof defaultBlocks)[]}\n blocksOverride={children}\n >\n {({ blocks: { ...blocks }, blockOrder }) =>\n blockOrder\n .filter((key) => key in blocks)\n .map<ReactNode>((key) => <Fragment key={String(key)}>{blocks[key]}</Fragment>)\n }\n </BlocksOverrideComponent>\n </Stack>\n </ResetPasswordProvider>\n );\n};\n\nResetPassword.Title = ({ sx, children, className, ...props }: Partial<TypographyProps>) => {\n const { resetPasswordTitle = 'Reset Password' } = deepMerge(useResetPasswordContext(), props);\n\n return (\n <Typography\n variant=\"h4\"\n component=\"h1\"\n sx={[\n {\n textAlign: 'center',\n },\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n className={classNames('nbb-reset-password-title', className)}\n {...props}\n >\n {children || resetPasswordTitle}\n </Typography>\n );\n};\n\nResetPassword.Description = ({ sx, children, className, ...props }: Partial<TypographyProps>) => {\n const { description = 'Please enter your email address you registered' } = deepMerge(\n useResetPasswordContext(),\n props\n );\n\n return (\n <Typography\n variant=\"body2\"\n sx={[\n {\n textAlign: 'center',\n },\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n className={classNames('nbb-reset-password-description', className)}\n {...props}\n >\n {children || description}\n </Typography>\n );\n};\n\nconst Form = <T extends ResetPasswordFormData>({\n children,\n className,\n ...props\n}: Partial<\n StackProps<'form'> & {\n view?: 'request' | 'confirm_password';\n onSendRequest?: (data: T) => void;\n onResetPassword?: (data: T) => void;\n }\n>) => {\n const { onSendRequest, onResetPassword, view } = deepMerge(useResetPasswordContext(), props);\n\n const onSubmitHandler = (e: FormEvent) => {\n if (e) {\n e.preventDefault && e.preventDefault();\n e.stopPropagation && e.stopPropagation();\n }\n\n if (!(e.target instanceof HTMLFormElement)) {\n return;\n }\n\n const formData = new FormData(e.target);\n const data = Object.fromEntries(formData) as T;\n\n if (view === 'request') {\n if (!onSendRequest) {\n return;\n }\n onSendRequest(data);\n }\n\n if (view === 'confirm_password') {\n if (!onResetPassword) {\n return;\n }\n\n onResetPassword(data);\n }\n };\n\n return (\n <Stack\n component=\"form\"\n onSubmit={onSubmitHandler}\n className={classNames('nbb-reset-password-form', className)}\n spacing={4}\n {...props}\n >\n {children || (\n <>\n <Form.EmailField />\n <Form.PasswordField />\n <Form.ConfirmPasswordField />\n <Form.ResetPasswordButton />\n </>\n )}\n </Stack>\n );\n};\n\nResetPassword.Form = Form;\n\nconst EmailField = ({ className, ...props }: Partial<TextFieldProps>) => {\n const { view } = useResetPasswordContext();\n\n return view === 'request' ? (\n <TextField\n fullWidth\n name=\"email\"\n label=\"Email\"\n placeholder=\"Please enter your email\"\n className={classNames('nbb-reset-password-email-field', className)}\n {...props}\n />\n ) : null;\n};\n\nForm.EmailField = EmailField;\n\nconst PasswordField = ({\n className,\n ...props\n}: Partial<TextFieldProps & Pick<ResetPasswordContextValue, 'showPassword' | 'onShowPasswordClick'>>) => {\n const { view, showPassword, onShowPasswordClick } = deepMerge(useResetPasswordContext(), props);\n\n return view === 'confirm_password' ? (\n <TextField\n fullWidth\n name=\"password\"\n label=\"Password\"\n type={showPassword ? 'text' : 'password'}\n placeholder=\"Please enter your new password\"\n className={classNames('nbb-reset-password-password-field', className)}\n slotProps={\n showPassword !== undefined && onShowPasswordClick !== undefined\n ? {\n input: {\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton\n aria-label=\"toggle password visibility\"\n onClick={() => onShowPasswordClick(!showPassword)}\n edge=\"end\"\n >\n {showPassword ? <VisibilityOff /> : <Visibility />}\n </IconButton>\n </InputAdornment>\n ),\n },\n }\n : {}\n }\n {...props}\n />\n ) : null;\n};\n\nForm.PasswordField = PasswordField;\n\nconst ConfirmPasswordField = ({\n className,\n ...props\n}: Partial<TextFieldProps & Pick<ResetPasswordContextValue, 'showPassword' | 'onShowPasswordClick'>>) => {\n const { view, showPassword, onShowPasswordClick } = deepMerge(useResetPasswordContext(), props);\n\n return view === 'confirm_password' ? (\n <TextField\n fullWidth\n name=\"confirmPassword\"\n label=\"Confirm Password\"\n type={showPassword ? 'text' : 'password'}\n placeholder=\"Please confirm your password\"\n className={classNames('nbb-reset-password-confirm-password-field', className)}\n slotProps={\n showPassword !== undefined && onShowPasswordClick !== undefined\n ? {\n input: {\n endAdornment: (\n <InputAdornment position=\"end\">\n <IconButton\n aria-label=\"toggle password visibility\"\n onClick={() => onShowPasswordClick(!showPassword)}\n edge=\"end\"\n >\n {showPassword ? <VisibilityOff /> : <Visibility />}\n </IconButton>\n </InputAdornment>\n ),\n },\n }\n : {}\n }\n {...props}\n />\n ) : null;\n};\n\nForm.ConfirmPasswordField = ConfirmPasswordField;\n\nconst ResetPasswordButton = ({ children, className, ...props }: ButtonProps) => {\n return (\n <Button\n variant=\"contained\"\n fullWidth\n type=\"submit\"\n className={classNames('nbb-reset-password-reset-password-button', className)}\n {...props}\n >\n {children || 'Reset Password'}\n </Button>\n );\n};\n\nForm.ResetPasswordButton = ResetPasswordButton;\n\nResetPassword.Goto = ({ children, className, sx, ...props }: Partial<TypographyProps>) => {\n const { gotoSigninMessage } = deepMerge(useResetPasswordContext(), props);\n\n return (\n <Typography\n variant=\"body2\"\n className={classNames('nbb-reset-password-goto', className)}\n sx={[\n {\n textAlign: 'center',\n },\n ...(Array.isArray(sx) ? sx : [sx]),\n ]}\n {...props}\n >\n {children || gotoSigninMessage || (\n <>\n <Link href=\"/auth/login\">Back to Sign In</Link>\n </>\n )}\n </Typography>\n );\n};\n\nconst defaultBlocks = createDefaultBlocks({\n title: ResetPassword.Title,\n description: ResetPassword.Description,\n form: ResetPassword.Form,\n goto: ResetPassword.Goto,\n});\n\nexport default ResetPassword;\n"],"names":["_jsx","Fragment","_jsxs","_Fragment"],"mappings":";;;;;;;;;;;AAmBA,MAAM,oBAAoB,GAAG,aAAa,CAAwC,SAAS,CAAC;AAErF,MAAM,qBAAqB,GAAG,CAAkC,EACrE,QAAQ,EACR,GAAG,KAAK,EAGT,KAAI;IACH,OAAOA,GAAA,CAAC,oBAAoB,CAAC,QAAQ,EAAA,EAAC,KAAK,EAAE,KAAK,EAAA,QAAA,EAAG,QAAQ,EAAA,CAAiC;AAChG,CAAC;AAEM,MAAM,uBAAuB,GAAG,MAAsC;AAC3E,IAAA,MAAM,OAAO,GAAG,UAAU,CAA2C,oBAAoB,CAAC;IAE1F,IAAI,CAAC,OAAO,EAAE;AACZ,QAAA,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC;IACxF;AACA,IAAA,OAAO,OAAO;AAChB,CAAC;;ACAD;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