@jigowatts/jigowatts-ui 2.1.2 → 2.2.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../../src/components/Button/index.tsx"],"sourcesContent":["import {\n createTheme,\n Button as MuiButton,\n ButtonProps as MuiButtonProps,\n PaletteColorOptions,\n ThemeProvider,\n} from \"@mui/material\";\n\ndeclare module \"@mui/material/styles\" {\n interface CustomPalette {\n thirdly: PaletteColorOptions;\n normal: PaletteColorOptions;\n negative: PaletteColorOptions;\n }\n interface Palette extends CustomPalette {}\n interface PaletteOptions extends CustomPalette {}\n}\n\ndeclare module \"@mui/material/Button\" {\n interface ButtonPropsColorOverrides {\n thirdly: true;\n normal: true;\n negative: true;\n }\n}\n\nconst { palette } = createTheme();\nconst { augmentColor } = palette;\nconst createColor = (mainColor: string, contrastText: string = \"#fff\") =>\n augmentColor({ color: { main: mainColor, contrastText: contrastText } });\nconst theme = createTheme({\n palette: {\n primary: createColor(\"#6672E8\"),\n secondary: createColor(\"#00AD79\"),\n thirdly: createColor(\"#1E2D50\"),\n normal: createColor(\"#808181\"),\n negative: createColor(\"#CA0000\"),\n },\n});\n\ntype ButtonProps = MuiButtonProps & {\n color?:\n | \"primary\"\n | \"secondary\"\n | \"thirdly\"\n | \"normal\"\n | \"negative\"\n | \"error\"\n | \"warning\";\n};\n\n/** MuiButtonを継承したプロジェクトのテーマカラーを適用したボタンです。\n * primary, secondary, thirdly , normal, negative\n */\nexport const Button = (props: ButtonProps) => {\n const { children, color = \"primary\", ...buttonProps } = props;\n\n return (\n <ThemeProvider theme={theme}>\n <MuiButton {...buttonProps} color={color}>\n {children}\n </MuiButton>\n </ThemeProvider>\n );\n};\n\nexport default Button;\n"],"names":["palette","createTheme","augmentColor","createColor","mainColor","contrastText","theme","Button","props","children","color","buttonProps","jsx","ThemeProvider","MuiButton"],"mappings":"4KA0BM,CAAE,QAAAA,CAAA,EAAYC,cAAA,EACd,CAAE,aAAAC,GAAiBF,EACnBG,EAAc,CAACC,EAAmBC,EAAuB,SAC7DH,EAAa,CAAE,MAAO,CAAE,KAAME,EAAW,aAAAC,CAAA,EAA8B,EACnEC,EAAQL,EAAAA,YAAY,CACxB,QAAS,CACP,QAASE,EAAY,SAAS,EAC9B,UAAWA,EAAY,SAAS,EAChC,QAASA,EAAY,SAAS,EAC9B,OAAQA,EAAY,SAAS,EAC7B,SAAUA,EAAY,SAAS,CAAA,CAEnC,CAAC,EAgBYI,EAAUC,GAAuB,CAC5C,KAAM,CAAE,SAAAC,EAAU,MAAAC,EAAQ,UAAW,GAAGC,GAAgBH,EAExD,OACEI,EAAAA,IAACC,EAAAA,eAAc,MAAAP,EACb,SAAAM,EAAAA,IAACE,UAAW,GAAGH,EAAa,MAAAD,EACzB,SAAAD,CAAA,CACH,CAAA,CACF,CAEJ"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../src/components/Button/index.tsx"],"sourcesContent":["import {\n createTheme,\n Button as MuiButton,\n ButtonProps as MuiButtonProps,\n PaletteColor,\n PaletteColorOptions,\n ThemeProvider,\n} from \"@mui/material\";\n\ndeclare module \"@mui/material/styles\" {\n interface Palette {\n thirdly: PaletteColor;\n normal: PaletteColor;\n negative: PaletteColor;\n }\n interface PaletteOptions {\n thirdly?: PaletteColorOptions;\n normal?: PaletteColorOptions;\n negative?: PaletteColorOptions;\n }\n}\n\ndeclare module \"@mui/material/Button\" {\n interface ButtonPropsColorOverrides {\n thirdly: true;\n normal: true;\n negative: true;\n }\n}\n\nconst { palette } = createTheme();\nconst { augmentColor } = palette;\nconst createColor = (mainColor: string, contrastText: string = \"#fff\") =>\n augmentColor({ color: { main: mainColor, contrastText: contrastText } });\nconst theme = createTheme({\n palette: {\n primary: createColor(\"#6672E8\"),\n secondary: createColor(\"#00AD79\"),\n thirdly: createColor(\"#1E2D50\"),\n normal: createColor(\"#808181\"),\n negative: createColor(\"#CA0000\"),\n },\n});\n\ntype ButtonProps = MuiButtonProps & {\n color?:\n | \"primary\"\n | \"secondary\"\n | \"thirdly\"\n | \"normal\"\n | \"negative\"\n | \"error\"\n | \"warning\";\n};\n\n/** MuiButtonを継承したプロジェクトのテーマカラーを適用したボタンです。\n * primary, secondary, thirdly , normal, negative\n */\nexport const Button = (props: ButtonProps) => {\n const { children, color = \"primary\", ...buttonProps } = props;\n\n return (\n <ThemeProvider theme={theme}>\n <MuiButton {...buttonProps} color={color}>\n {children}\n </MuiButton>\n </ThemeProvider>\n );\n};\n\nexport default Button;\n"],"names":["palette","createTheme","augmentColor","createColor","mainColor","contrastText","theme","Button","props","children","color","buttonProps","jsx","ThemeProvider","MuiButton"],"mappings":"4KA8BM,CAAE,QAAAA,CAAA,EAAYC,cAAA,EACd,CAAE,aAAAC,GAAiBF,EACnBG,EAAc,CAACC,EAAmBC,EAAuB,SAC7DH,EAAa,CAAE,MAAO,CAAE,KAAME,EAAW,aAAAC,CAAA,EAA8B,EACnEC,EAAQL,EAAAA,YAAY,CACxB,QAAS,CACP,QAASE,EAAY,SAAS,EAC9B,UAAWA,EAAY,SAAS,EAChC,QAASA,EAAY,SAAS,EAC9B,OAAQA,EAAY,SAAS,EAC7B,SAAUA,EAAY,SAAS,CAAA,CAEnC,CAAC,EAgBYI,EAAUC,GAAuB,CAC5C,KAAM,CAAE,SAAAC,EAAU,MAAAC,EAAQ,UAAW,GAAGC,GAAgBH,EAExD,OACEI,EAAAA,IAACC,EAAAA,eAAc,MAAAP,EACb,SAAAM,EAAAA,IAACE,UAAW,GAAGH,EAAa,MAAAD,EACzB,SAAAD,CAAA,CACH,CAAA,CACF,CAEJ"}
@@ -1,14 +1,15 @@
1
- import { ButtonProps as MuiButtonProps, PaletteColorOptions } from '@mui/material';
1
+ import { ButtonProps as MuiButtonProps, PaletteColor, PaletteColorOptions } from '@mui/material';
2
2
 
3
3
  declare module "@mui/material/styles" {
4
- interface CustomPalette {
5
- thirdly: PaletteColorOptions;
6
- normal: PaletteColorOptions;
7
- negative: PaletteColorOptions;
4
+ interface Palette {
5
+ thirdly: PaletteColor;
6
+ normal: PaletteColor;
7
+ negative: PaletteColor;
8
8
  }
9
- interface Palette extends CustomPalette {
10
- }
11
- interface PaletteOptions extends CustomPalette {
9
+ interface PaletteOptions {
10
+ thirdly?: PaletteColorOptions;
11
+ normal?: PaletteColorOptions;
12
+ negative?: PaletteColorOptions;
12
13
  }
13
14
  }
14
15
  declare module "@mui/material/Button" {
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../../../src/components/Button/index.tsx"],"sourcesContent":["import {\n createTheme,\n Button as MuiButton,\n ButtonProps as MuiButtonProps,\n PaletteColorOptions,\n ThemeProvider,\n} from \"@mui/material\";\n\ndeclare module \"@mui/material/styles\" {\n interface CustomPalette {\n thirdly: PaletteColorOptions;\n normal: PaletteColorOptions;\n negative: PaletteColorOptions;\n }\n interface Palette extends CustomPalette {}\n interface PaletteOptions extends CustomPalette {}\n}\n\ndeclare module \"@mui/material/Button\" {\n interface ButtonPropsColorOverrides {\n thirdly: true;\n normal: true;\n negative: true;\n }\n}\n\nconst { palette } = createTheme();\nconst { augmentColor } = palette;\nconst createColor = (mainColor: string, contrastText: string = \"#fff\") =>\n augmentColor({ color: { main: mainColor, contrastText: contrastText } });\nconst theme = createTheme({\n palette: {\n primary: createColor(\"#6672E8\"),\n secondary: createColor(\"#00AD79\"),\n thirdly: createColor(\"#1E2D50\"),\n normal: createColor(\"#808181\"),\n negative: createColor(\"#CA0000\"),\n },\n});\n\ntype ButtonProps = MuiButtonProps & {\n color?:\n | \"primary\"\n | \"secondary\"\n | \"thirdly\"\n | \"normal\"\n | \"negative\"\n | \"error\"\n | \"warning\";\n};\n\n/** MuiButtonを継承したプロジェクトのテーマカラーを適用したボタンです。\n * primary, secondary, thirdly , normal, negative\n */\nexport const Button = (props: ButtonProps) => {\n const { children, color = \"primary\", ...buttonProps } = props;\n\n return (\n <ThemeProvider theme={theme}>\n <MuiButton {...buttonProps} color={color}>\n {children}\n </MuiButton>\n </ThemeProvider>\n );\n};\n\nexport default Button;\n"],"names":["palette","createTheme","augmentColor","createColor","mainColor","contrastText","theme","Button","props","children","color","buttonProps","jsx","ThemeProvider","MuiButton"],"mappings":";;AA0BA,MAAM,EAAE,SAAAA,EAAA,IAAYC,EAAA,GACd,EAAE,cAAAC,MAAiBF,GACnBG,IAAc,CAACC,GAAmBC,IAAuB,WAC7DH,EAAa,EAAE,OAAO,EAAE,MAAME,GAAW,cAAAC,EAAA,GAA8B,GACnEC,IAAQL,EAAY;AAAA,EACxB,SAAS;AAAA,IACP,SAASE,EAAY,SAAS;AAAA,IAC9B,WAAWA,EAAY,SAAS;AAAA,IAChC,SAASA,EAAY,SAAS;AAAA,IAC9B,QAAQA,EAAY,SAAS;AAAA,IAC7B,UAAUA,EAAY,SAAS;AAAA,EAAA;AAEnC,CAAC,GAgBYI,IAAS,CAACC,MAAuB;AAC5C,QAAM,EAAE,UAAAC,GAAU,OAAAC,IAAQ,WAAW,GAAGC,MAAgBH;AAExD,SACE,gBAAAI,EAACC,KAAc,OAAAP,GACb,UAAA,gBAAAM,EAACE,KAAW,GAAGH,GAAa,OAAAD,GACzB,UAAAD,EAAA,CACH,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"index.es.js","sources":["../../../src/components/Button/index.tsx"],"sourcesContent":["import {\n createTheme,\n Button as MuiButton,\n ButtonProps as MuiButtonProps,\n PaletteColor,\n PaletteColorOptions,\n ThemeProvider,\n} from \"@mui/material\";\n\ndeclare module \"@mui/material/styles\" {\n interface Palette {\n thirdly: PaletteColor;\n normal: PaletteColor;\n negative: PaletteColor;\n }\n interface PaletteOptions {\n thirdly?: PaletteColorOptions;\n normal?: PaletteColorOptions;\n negative?: PaletteColorOptions;\n }\n}\n\ndeclare module \"@mui/material/Button\" {\n interface ButtonPropsColorOverrides {\n thirdly: true;\n normal: true;\n negative: true;\n }\n}\n\nconst { palette } = createTheme();\nconst { augmentColor } = palette;\nconst createColor = (mainColor: string, contrastText: string = \"#fff\") =>\n augmentColor({ color: { main: mainColor, contrastText: contrastText } });\nconst theme = createTheme({\n palette: {\n primary: createColor(\"#6672E8\"),\n secondary: createColor(\"#00AD79\"),\n thirdly: createColor(\"#1E2D50\"),\n normal: createColor(\"#808181\"),\n negative: createColor(\"#CA0000\"),\n },\n});\n\ntype ButtonProps = MuiButtonProps & {\n color?:\n | \"primary\"\n | \"secondary\"\n | \"thirdly\"\n | \"normal\"\n | \"negative\"\n | \"error\"\n | \"warning\";\n};\n\n/** MuiButtonを継承したプロジェクトのテーマカラーを適用したボタンです。\n * primary, secondary, thirdly , normal, negative\n */\nexport const Button = (props: ButtonProps) => {\n const { children, color = \"primary\", ...buttonProps } = props;\n\n return (\n <ThemeProvider theme={theme}>\n <MuiButton {...buttonProps} color={color}>\n {children}\n </MuiButton>\n </ThemeProvider>\n );\n};\n\nexport default Button;\n"],"names":["palette","createTheme","augmentColor","createColor","mainColor","contrastText","theme","Button","props","children","color","buttonProps","jsx","ThemeProvider","MuiButton"],"mappings":";;AA8BA,MAAM,EAAE,SAAAA,EAAA,IAAYC,EAAA,GACd,EAAE,cAAAC,MAAiBF,GACnBG,IAAc,CAACC,GAAmBC,IAAuB,WAC7DH,EAAa,EAAE,OAAO,EAAE,MAAME,GAAW,cAAAC,EAAA,GAA8B,GACnEC,IAAQL,EAAY;AAAA,EACxB,SAAS;AAAA,IACP,SAASE,EAAY,SAAS;AAAA,IAC9B,WAAWA,EAAY,SAAS;AAAA,IAChC,SAASA,EAAY,SAAS;AAAA,IAC9B,QAAQA,EAAY,SAAS;AAAA,IAC7B,UAAUA,EAAY,SAAS;AAAA,EAAA;AAEnC,CAAC,GAgBYI,IAAS,CAACC,MAAuB;AAC5C,QAAM,EAAE,UAAAC,GAAU,OAAAC,IAAQ,WAAW,GAAGC,MAAgBH;AAExD,SACE,gBAAAI,EAACC,KAAc,OAAAP,GACb,UAAA,gBAAAM,EAACE,KAAW,GAAGH,GAAa,OAAAD,GACzB,UAAAD,EAAA,CACH,EAAA,CACF;AAEJ;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),g=require("@mui/icons-material"),t=require("@mui/material"),F=require("react-hook-form"),C=m=>{const{control:x,type:l,textareaOption:r,name:v,autoComplete:h,placeholder:p,defaultValue:i,emptyValue:u,inputProps:e}=m,s=u===void 0&&i!==void 0?null:u;return n.jsx(F.Controller,{control:x,name:v,defaultValue:i,render:({field:o,fieldState:d})=>{var c;return n.jsxs(t.FormControl,{error:d.invalid,children:[n.jsx(t.TextField,{...o,type:l==="textarea"?void 0:l,multiline:l==="textarea",autoComplete:h,placeholder:p,value:o.value??"",onChange:a=>{o.onChange(a),a.target.value?o.onChange(a):o.onChange(s)},InputProps:{...e,rows:r?r.rows:void 0,minRows:r?r.minRows:void 0,maxRows:r?r.minRows:void 0,endAdornment:o.value&&!(e!=null&&e.readOnly)&&!(e!=null&&e.disabled)?n.jsx(t.InputAdornment,{position:"end",children:n.jsx(t.IconButton,{onClick:()=>o.onChange(s),edge:"end",children:n.jsx(g.Clear,{})})}):void 0},sx:{"& .MuiInput-underline:before":{borderColor:"#CCCCCC"},"& .MuiInputBase-root":{backgroundColor:"#FFFFFF"},"input:-webkit-autofill":{WebkitBoxShadow:"0 0 0 1000px white inset"}},fullWidth:!0}),n.jsx(t.FormHelperText,{children:(c=d.error)==null?void 0:c.message})]})}})};exports.InputController=C;exports.default=C;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),g=require("@mui/icons-material"),n=require("@mui/material"),j=require("react-hook-form"),m=C=>{const{control:x,type:l,textareaOption:r,name:v,autoComplete:p,placeholder:h,defaultValue:a,emptyValue:i,inputProps:e}=C,u=i===void 0&&a!==void 0?null:i;return o.jsx(j.Controller,{control:x,name:v,defaultValue:a,render:({field:t,fieldState:s})=>{var d;return o.jsxs(n.FormControl,{error:s.invalid,children:[o.jsx(n.TextField,{...t,type:l==="textarea"?void 0:l,multiline:l==="textarea",autoComplete:p,placeholder:h,value:t.value??"",onChange:F=>{const c=F.target.value;t.onChange(c||u)},InputProps:{...e,rows:r?r.rows:void 0,minRows:r?r.minRows:void 0,maxRows:r?r.minRows:void 0,endAdornment:t.value&&!(e!=null&&e.readOnly)&&!(e!=null&&e.disabled)?o.jsx(n.InputAdornment,{position:"end",children:o.jsx(n.IconButton,{onClick:()=>t.onChange(u),edge:"end",children:o.jsx(g.Clear,{})})}):void 0},sx:{"& .MuiInput-underline:before":{borderColor:"#CCCCCC"},"& .MuiInputBase-root":{backgroundColor:"#FFFFFF"},"input:-webkit-autofill":{WebkitBoxShadow:"0 0 0 1000px white inset"}},fullWidth:!0}),o.jsx(n.FormHelperText,{children:(d=s.error)==null?void 0:d.message})]})}})};exports.InputController=m;exports.default=m;
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../../src/components/InputController/index.tsx"],"sourcesContent":["import { Clear } from \"@mui/icons-material\";\nimport {\n FilledInputProps,\n FormControl,\n FormHelperText,\n IconButton,\n InputAdornment,\n InputProps,\n OutlinedInputProps,\n TextField,\n} from \"@mui/material\";\nimport {\n Controller,\n FieldPath,\n PathValue,\n type Control,\n type FieldValues,\n} from \"react-hook-form\";\n\ntype Type = \"search\" | \"text\" | \"number\" | \"email\" | \"tel\" | \"textarea\";\n\ntype MultilineOption = {\n rows?: number;\n minRows?: number;\n maxRows?: number;\n};\n\ntype Props<T extends FieldValues> = {\n control: Control<T>;\n type: Type;\n textareaOption?: MultilineOption;\n name: FieldPath<T>;\n defaultValue?: PathValue<T, FieldPath<T>>;\n emptyValue?: \"\" | null | undefined;\n autoComplete?: string;\n placeholder?: string;\n inputProps?:\n | Partial<FilledInputProps>\n | Partial<OutlinedInputProps>\n | Partial<InputProps>;\n};\n\nexport const InputController = <T extends FieldValues>(props: Props<T>) => {\n const {\n control,\n type,\n textareaOption,\n name,\n autoComplete,\n placeholder,\n defaultValue,\n emptyValue,\n inputProps,\n } = props;\n\n const convertedEmptyValue =\n emptyValue === undefined && defaultValue !== undefined ? null : emptyValue;\n\n return (\n <Controller\n control={control}\n name={name}\n defaultValue={defaultValue}\n render={({ field, fieldState }) => (\n <FormControl error={fieldState.invalid}>\n <TextField\n {...field}\n type={type === \"textarea\" ? undefined : type}\n multiline={type === \"textarea\"}\n autoComplete={autoComplete}\n placeholder={placeholder}\n value={field.value ?? \"\"}\n onChange={(e) => {\n field.onChange(e);\n e.target.value\n ? field.onChange(e)\n : field.onChange(convertedEmptyValue);\n }}\n InputProps={{\n ...inputProps,\n rows: textareaOption ? textareaOption.rows : undefined,\n minRows: textareaOption ? textareaOption.minRows : undefined,\n maxRows: textareaOption ? textareaOption.minRows : undefined,\n endAdornment:\n field.value &&\n !inputProps?.readOnly &&\n !inputProps?.disabled ? (\n <InputAdornment position=\"end\">\n <IconButton\n onClick={() => field.onChange(convertedEmptyValue)}\n edge=\"end\"\n >\n <Clear />\n </IconButton>\n </InputAdornment>\n ) : undefined,\n }}\n sx={{\n \"& .MuiInput-underline:before\": {\n borderColor: \"#CCCCCC\",\n },\n \"& .MuiInputBase-root\": {\n backgroundColor: \"#FFFFFF\",\n },\n \"input:-webkit-autofill\": {\n WebkitBoxShadow: \"0 0 0 1000px white inset\",\n },\n }}\n fullWidth={true}\n />\n <FormHelperText>{fieldState.error?.message}</FormHelperText>\n </FormControl>\n )}\n />\n );\n};\n\nexport default InputController;\n"],"names":["InputController","props","control","type","textareaOption","name","autoComplete","placeholder","defaultValue","emptyValue","inputProps","convertedEmptyValue","jsx","Controller","field","fieldState","jsxs","FormControl","TextField","e","InputAdornment","IconButton","Clear","FormHelperText","_a"],"mappings":"0OA0CaA,EAA0CC,GAAoB,CACzE,KAAM,CACJ,QAAAC,EACA,KAAAC,EACA,eAAAC,EACA,KAAAC,EACA,aAAAC,EACA,YAAAC,EACA,aAAAC,EACA,WAAAC,EACA,WAAAC,CAAA,EACET,EAEEU,EACJF,IAAe,QAAaD,IAAiB,OAAY,KAAOC,EAElE,OACEG,EAAAA,IAACC,EAAAA,WAAA,CACC,QAAAX,EACA,KAAAG,EACA,aAAAG,EACA,OAAQ,CAAC,CAAE,MAAAM,EAAO,WAAAC,YAChBC,OAAAA,EAAAA,KAACC,EAAAA,YAAA,CAAY,MAAOF,EAAW,QAC7B,SAAA,CAAAH,EAAAA,IAACM,EAAAA,UAAA,CACE,GAAGJ,EACJ,KAAMX,IAAS,WAAa,OAAYA,EACxC,UAAWA,IAAS,WACpB,aAAAG,EACA,YAAAC,EACA,MAAOO,EAAM,OAAS,GACtB,SAAWK,GAAM,CACfL,EAAM,SAASK,CAAC,EAChBA,EAAE,OAAO,MACLL,EAAM,SAASK,CAAC,EAChBL,EAAM,SAASH,CAAmB,CACxC,EACA,WAAY,CACV,GAAGD,EACH,KAAMN,EAAiBA,EAAe,KAAO,OAC7C,QAASA,EAAiBA,EAAe,QAAU,OACnD,QAASA,EAAiBA,EAAe,QAAU,OACnD,aACEU,EAAM,OACN,EAACJ,GAAA,MAAAA,EAAY,WACb,EAACA,GAAA,MAAAA,EAAY,UACXE,EAAAA,IAACQ,EAAAA,eAAA,CAAe,SAAS,MACvB,SAAAR,EAAAA,IAACS,EAAAA,WAAA,CACC,QAAS,IAAMP,EAAM,SAASH,CAAmB,EACjD,KAAK,MAEL,eAACW,EAAAA,MAAA,CAAA,CAAM,CAAA,CAAA,EAEX,EACE,MAAA,EAER,GAAI,CACF,+BAAgC,CAC9B,YAAa,SAAA,EAEf,uBAAwB,CACtB,gBAAiB,SAAA,EAEnB,yBAA0B,CACxB,gBAAiB,0BAAA,CACnB,EAEF,UAAW,EAAA,CAAA,EAEbV,EAAAA,IAACW,EAAAA,eAAA,CAAgB,UAAAC,EAAAT,EAAW,QAAX,YAAAS,EAAkB,OAAA,CAAQ,CAAA,CAAA,CAC7C,EAAA,CAAA,CAIR"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../src/components/InputController/index.tsx"],"sourcesContent":["import { Clear } from \"@mui/icons-material\";\nimport {\n FilledInputProps,\n FormControl,\n FormHelperText,\n IconButton,\n InputAdornment,\n InputProps,\n OutlinedInputProps,\n TextField,\n} from \"@mui/material\";\nimport {\n Controller,\n FieldPath,\n PathValue,\n type Control,\n type FieldValues,\n} from \"react-hook-form\";\n\ntype Type = \"search\" | \"text\" | \"number\" | \"email\" | \"tel\" | \"textarea\";\n\ntype MultilineOption = {\n rows?: number;\n minRows?: number;\n maxRows?: number;\n};\n\ntype Props<T extends FieldValues> = {\n control: Control<T>;\n type: Type;\n textareaOption?: MultilineOption;\n name: FieldPath<T>;\n defaultValue?: PathValue<T, FieldPath<T>>;\n emptyValue?: \"\" | null | undefined;\n autoComplete?: string;\n placeholder?: string;\n inputProps?:\n | Partial<FilledInputProps>\n | Partial<OutlinedInputProps>\n | Partial<InputProps>;\n};\n\nexport const InputController = <T extends FieldValues>(props: Props<T>) => {\n const {\n control,\n type,\n textareaOption,\n name,\n autoComplete,\n placeholder,\n defaultValue,\n emptyValue,\n inputProps,\n } = props;\n\n const convertedEmptyValue =\n emptyValue === undefined && defaultValue !== undefined ? null : emptyValue;\n\n return (\n <Controller\n control={control}\n name={name}\n defaultValue={defaultValue}\n render={({ field, fieldState }) => (\n <FormControl error={fieldState.invalid}>\n <TextField\n {...field}\n type={type === \"textarea\" ? undefined : type}\n multiline={type === \"textarea\"}\n autoComplete={autoComplete}\n placeholder={placeholder}\n value={field.value ?? \"\"}\n onChange={(e) => {\n const value = e.target.value;\n field.onChange(value ? value : convertedEmptyValue);\n }}\n InputProps={{\n ...inputProps,\n rows: textareaOption ? textareaOption.rows : undefined,\n minRows: textareaOption ? textareaOption.minRows : undefined,\n maxRows: textareaOption ? textareaOption.minRows : undefined,\n endAdornment:\n field.value &&\n !inputProps?.readOnly &&\n !inputProps?.disabled ? (\n <InputAdornment position=\"end\">\n <IconButton\n onClick={() => field.onChange(convertedEmptyValue)}\n edge=\"end\"\n >\n <Clear />\n </IconButton>\n </InputAdornment>\n ) : undefined,\n }}\n sx={{\n \"& .MuiInput-underline:before\": {\n borderColor: \"#CCCCCC\",\n },\n \"& .MuiInputBase-root\": {\n backgroundColor: \"#FFFFFF\",\n },\n \"input:-webkit-autofill\": {\n WebkitBoxShadow: \"0 0 0 1000px white inset\",\n },\n }}\n fullWidth={true}\n />\n <FormHelperText>{fieldState.error?.message}</FormHelperText>\n </FormControl>\n )}\n />\n );\n};\n\nexport default InputController;\n"],"names":["InputController","props","control","type","textareaOption","name","autoComplete","placeholder","defaultValue","emptyValue","inputProps","convertedEmptyValue","jsx","Controller","field","fieldState","jsxs","FormControl","TextField","e","value","InputAdornment","IconButton","Clear","FormHelperText","_a"],"mappings":"0OA0CaA,EAA0CC,GAAoB,CACzE,KAAM,CACJ,QAAAC,EACA,KAAAC,EACA,eAAAC,EACA,KAAAC,EACA,aAAAC,EACA,YAAAC,EACA,aAAAC,EACA,WAAAC,EACA,WAAAC,CAAA,EACET,EAEEU,EACJF,IAAe,QAAaD,IAAiB,OAAY,KAAOC,EAElE,OACEG,EAAAA,IAACC,EAAAA,WAAA,CACC,QAAAX,EACA,KAAAG,EACA,aAAAG,EACA,OAAQ,CAAC,CAAE,MAAAM,EAAO,WAAAC,YAChBC,OAAAA,EAAAA,KAACC,EAAAA,YAAA,CAAY,MAAOF,EAAW,QAC7B,SAAA,CAAAH,EAAAA,IAACM,EAAAA,UAAA,CACE,GAAGJ,EACJ,KAAMX,IAAS,WAAa,OAAYA,EACxC,UAAWA,IAAS,WACpB,aAAAG,EACA,YAAAC,EACA,MAAOO,EAAM,OAAS,GACtB,SAAWK,GAAM,CACf,MAAMC,EAAQD,EAAE,OAAO,MACvBL,EAAM,SAASM,GAAgBT,CAAmB,CACpD,EACA,WAAY,CACV,GAAGD,EACH,KAAMN,EAAiBA,EAAe,KAAO,OAC7C,QAASA,EAAiBA,EAAe,QAAU,OACnD,QAASA,EAAiBA,EAAe,QAAU,OACnD,aACEU,EAAM,OACN,EAACJ,GAAA,MAAAA,EAAY,WACb,EAACA,GAAA,MAAAA,EAAY,UACXE,EAAAA,IAACS,EAAAA,eAAA,CAAe,SAAS,MACvB,SAAAT,EAAAA,IAACU,EAAAA,WAAA,CACC,QAAS,IAAMR,EAAM,SAASH,CAAmB,EACjD,KAAK,MAEL,eAACY,EAAAA,MAAA,CAAA,CAAM,CAAA,CAAA,EAEX,EACE,MAAA,EAER,GAAI,CACF,+BAAgC,CAC9B,YAAa,SAAA,EAEf,uBAAwB,CACtB,gBAAiB,SAAA,EAEnB,yBAA0B,CACxB,gBAAiB,0BAAA,CACnB,EAEF,UAAW,EAAA,CAAA,EAEbX,EAAAA,IAACY,EAAAA,eAAA,CAAgB,UAAAC,EAAAV,EAAW,QAAX,YAAAU,EAAkB,OAAA,CAAQ,CAAA,CAAA,CAC7C,EAAA,CAAA,CAIR"}
@@ -1,51 +1,52 @@
1
- import { jsx as r, jsxs as v } from "react/jsx-runtime";
2
- import { Clear as x } from "@mui/icons-material";
3
- import { FormControl as g, TextField as w, InputAdornment as F, IconButton as b, FormHelperText as I } from "@mui/material";
4
- import { Controller as y } from "react-hook-form";
5
- const f = (C) => {
1
+ import { jsx as r, jsxs as h } from "react/jsx-runtime";
2
+ import { Clear as w } from "@mui/icons-material";
3
+ import { FormControl as F, TextField as g, InputAdornment as b, IconButton as I, FormHelperText as y } from "@mui/material";
4
+ import { Controller as f } from "react-hook-form";
5
+ const j = (s) => {
6
6
  const {
7
- control: s,
8
- type: t,
9
- textareaOption: n,
7
+ control: C,
8
+ type: n,
9
+ textareaOption: o,
10
10
  name: p,
11
11
  autoComplete: c,
12
- placeholder: h,
12
+ placeholder: v,
13
13
  defaultValue: l,
14
- emptyValue: i,
15
- inputProps: o
16
- } = C, d = i === void 0 && l !== void 0 ? null : i;
14
+ emptyValue: a,
15
+ inputProps: e
16
+ } = s, i = a === void 0 && l !== void 0 ? null : a;
17
17
  return /* @__PURE__ */ r(
18
- y,
18
+ f,
19
19
  {
20
- control: s,
20
+ control: C,
21
21
  name: p,
22
22
  defaultValue: l,
23
- render: ({ field: e, fieldState: u }) => {
24
- var m;
25
- return /* @__PURE__ */ v(g, { error: u.invalid, children: [
23
+ render: ({ field: t, fieldState: d }) => {
24
+ var u;
25
+ return /* @__PURE__ */ h(F, { error: d.invalid, children: [
26
26
  /* @__PURE__ */ r(
27
- w,
27
+ g,
28
28
  {
29
- ...e,
30
- type: t === "textarea" ? void 0 : t,
31
- multiline: t === "textarea",
29
+ ...t,
30
+ type: n === "textarea" ? void 0 : n,
31
+ multiline: n === "textarea",
32
32
  autoComplete: c,
33
- placeholder: h,
34
- value: e.value ?? "",
35
- onChange: (a) => {
36
- e.onChange(a), a.target.value ? e.onChange(a) : e.onChange(d);
33
+ placeholder: v,
34
+ value: t.value ?? "",
35
+ onChange: (x) => {
36
+ const m = x.target.value;
37
+ t.onChange(m || i);
37
38
  },
38
39
  InputProps: {
39
- ...o,
40
- rows: n ? n.rows : void 0,
41
- minRows: n ? n.minRows : void 0,
42
- maxRows: n ? n.minRows : void 0,
43
- endAdornment: e.value && !(o != null && o.readOnly) && !(o != null && o.disabled) ? /* @__PURE__ */ r(F, { position: "end", children: /* @__PURE__ */ r(
44
- b,
40
+ ...e,
41
+ rows: o ? o.rows : void 0,
42
+ minRows: o ? o.minRows : void 0,
43
+ maxRows: o ? o.minRows : void 0,
44
+ endAdornment: t.value && !(e != null && e.readOnly) && !(e != null && e.disabled) ? /* @__PURE__ */ r(b, { position: "end", children: /* @__PURE__ */ r(
45
+ I,
45
46
  {
46
- onClick: () => e.onChange(d),
47
+ onClick: () => t.onChange(i),
47
48
  edge: "end",
48
- children: /* @__PURE__ */ r(x, {})
49
+ children: /* @__PURE__ */ r(w, {})
49
50
  }
50
51
  ) }) : void 0
51
52
  },
@@ -63,14 +64,14 @@ const f = (C) => {
63
64
  fullWidth: !0
64
65
  }
65
66
  ),
66
- /* @__PURE__ */ r(I, { children: (m = u.error) == null ? void 0 : m.message })
67
+ /* @__PURE__ */ r(y, { children: (u = d.error) == null ? void 0 : u.message })
67
68
  ] });
68
69
  }
69
70
  }
70
71
  );
71
72
  };
72
73
  export {
73
- f as InputController,
74
- f as default
74
+ j as InputController,
75
+ j as default
75
76
  };
76
77
  //# sourceMappingURL=index.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../../../src/components/InputController/index.tsx"],"sourcesContent":["import { Clear } from \"@mui/icons-material\";\nimport {\n FilledInputProps,\n FormControl,\n FormHelperText,\n IconButton,\n InputAdornment,\n InputProps,\n OutlinedInputProps,\n TextField,\n} from \"@mui/material\";\nimport {\n Controller,\n FieldPath,\n PathValue,\n type Control,\n type FieldValues,\n} from \"react-hook-form\";\n\ntype Type = \"search\" | \"text\" | \"number\" | \"email\" | \"tel\" | \"textarea\";\n\ntype MultilineOption = {\n rows?: number;\n minRows?: number;\n maxRows?: number;\n};\n\ntype Props<T extends FieldValues> = {\n control: Control<T>;\n type: Type;\n textareaOption?: MultilineOption;\n name: FieldPath<T>;\n defaultValue?: PathValue<T, FieldPath<T>>;\n emptyValue?: \"\" | null | undefined;\n autoComplete?: string;\n placeholder?: string;\n inputProps?:\n | Partial<FilledInputProps>\n | Partial<OutlinedInputProps>\n | Partial<InputProps>;\n};\n\nexport const InputController = <T extends FieldValues>(props: Props<T>) => {\n const {\n control,\n type,\n textareaOption,\n name,\n autoComplete,\n placeholder,\n defaultValue,\n emptyValue,\n inputProps,\n } = props;\n\n const convertedEmptyValue =\n emptyValue === undefined && defaultValue !== undefined ? null : emptyValue;\n\n return (\n <Controller\n control={control}\n name={name}\n defaultValue={defaultValue}\n render={({ field, fieldState }) => (\n <FormControl error={fieldState.invalid}>\n <TextField\n {...field}\n type={type === \"textarea\" ? undefined : type}\n multiline={type === \"textarea\"}\n autoComplete={autoComplete}\n placeholder={placeholder}\n value={field.value ?? \"\"}\n onChange={(e) => {\n field.onChange(e);\n e.target.value\n ? field.onChange(e)\n : field.onChange(convertedEmptyValue);\n }}\n InputProps={{\n ...inputProps,\n rows: textareaOption ? textareaOption.rows : undefined,\n minRows: textareaOption ? textareaOption.minRows : undefined,\n maxRows: textareaOption ? textareaOption.minRows : undefined,\n endAdornment:\n field.value &&\n !inputProps?.readOnly &&\n !inputProps?.disabled ? (\n <InputAdornment position=\"end\">\n <IconButton\n onClick={() => field.onChange(convertedEmptyValue)}\n edge=\"end\"\n >\n <Clear />\n </IconButton>\n </InputAdornment>\n ) : undefined,\n }}\n sx={{\n \"& .MuiInput-underline:before\": {\n borderColor: \"#CCCCCC\",\n },\n \"& .MuiInputBase-root\": {\n backgroundColor: \"#FFFFFF\",\n },\n \"input:-webkit-autofill\": {\n WebkitBoxShadow: \"0 0 0 1000px white inset\",\n },\n }}\n fullWidth={true}\n />\n <FormHelperText>{fieldState.error?.message}</FormHelperText>\n </FormControl>\n )}\n />\n );\n};\n\nexport default InputController;\n"],"names":["InputController","props","control","type","textareaOption","name","autoComplete","placeholder","defaultValue","emptyValue","inputProps","convertedEmptyValue","jsx","Controller","field","fieldState","jsxs","FormControl","TextField","e","InputAdornment","IconButton","Clear","FormHelperText","_a"],"mappings":";;;;AA0CO,MAAMA,IAAkB,CAAwBC,MAAoB;AACzE,QAAM;AAAA,IACJ,SAAAC;AAAA,IACA,MAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,MAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,EAAA,IACET,GAEEU,IACJF,MAAe,UAAaD,MAAiB,SAAY,OAAOC;AAElE,SACE,gBAAAG;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAAX;AAAA,MACA,MAAAG;AAAA,MACA,cAAAG;AAAA,MACA,QAAQ,CAAC,EAAE,OAAAM,GAAO,YAAAC;;AAChB,+BAAAC,EAACC,GAAA,EAAY,OAAOF,EAAW,SAC7B,UAAA;AAAA,UAAA,gBAAAH;AAAA,YAACM;AAAA,YAAA;AAAA,cACE,GAAGJ;AAAA,cACJ,MAAMX,MAAS,aAAa,SAAYA;AAAA,cACxC,WAAWA,MAAS;AAAA,cACpB,cAAAG;AAAA,cACA,aAAAC;AAAA,cACA,OAAOO,EAAM,SAAS;AAAA,cACtB,UAAU,CAACK,MAAM;AACf,gBAAAL,EAAM,SAASK,CAAC,GAChBA,EAAE,OAAO,QACLL,EAAM,SAASK,CAAC,IAChBL,EAAM,SAASH,CAAmB;AAAA,cACxC;AAAA,cACA,YAAY;AAAA,gBACV,GAAGD;AAAA,gBACH,MAAMN,IAAiBA,EAAe,OAAO;AAAA,gBAC7C,SAASA,IAAiBA,EAAe,UAAU;AAAA,gBACnD,SAASA,IAAiBA,EAAe,UAAU;AAAA,gBACnD,cACEU,EAAM,SACN,EAACJ,KAAA,QAAAA,EAAY,aACb,EAACA,KAAA,QAAAA,EAAY,YACX,gBAAAE,EAACQ,GAAA,EAAe,UAAS,OACvB,UAAA,gBAAAR;AAAA,kBAACS;AAAA,kBAAA;AAAA,oBACC,SAAS,MAAMP,EAAM,SAASH,CAAmB;AAAA,oBACjD,MAAK;AAAA,oBAEL,4BAACW,GAAA,CAAA,CAAM;AAAA,kBAAA;AAAA,gBAAA,GAEX,IACE;AAAA,cAAA;AAAA,cAER,IAAI;AAAA,gBACF,gCAAgC;AAAA,kBAC9B,aAAa;AAAA,gBAAA;AAAA,gBAEf,wBAAwB;AAAA,kBACtB,iBAAiB;AAAA,gBAAA;AAAA,gBAEnB,0BAA0B;AAAA,kBACxB,iBAAiB;AAAA,gBAAA;AAAA,cACnB;AAAA,cAEF,WAAW;AAAA,YAAA;AAAA,UAAA;AAAA,UAEb,gBAAAV,EAACW,GAAA,EAAgB,WAAAC,IAAAT,EAAW,UAAX,gBAAAS,EAAkB,QAAA,CAAQ;AAAA,QAAA,EAAA,CAC7C;AAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
1
+ {"version":3,"file":"index.es.js","sources":["../../../src/components/InputController/index.tsx"],"sourcesContent":["import { Clear } from \"@mui/icons-material\";\nimport {\n FilledInputProps,\n FormControl,\n FormHelperText,\n IconButton,\n InputAdornment,\n InputProps,\n OutlinedInputProps,\n TextField,\n} from \"@mui/material\";\nimport {\n Controller,\n FieldPath,\n PathValue,\n type Control,\n type FieldValues,\n} from \"react-hook-form\";\n\ntype Type = \"search\" | \"text\" | \"number\" | \"email\" | \"tel\" | \"textarea\";\n\ntype MultilineOption = {\n rows?: number;\n minRows?: number;\n maxRows?: number;\n};\n\ntype Props<T extends FieldValues> = {\n control: Control<T>;\n type: Type;\n textareaOption?: MultilineOption;\n name: FieldPath<T>;\n defaultValue?: PathValue<T, FieldPath<T>>;\n emptyValue?: \"\" | null | undefined;\n autoComplete?: string;\n placeholder?: string;\n inputProps?:\n | Partial<FilledInputProps>\n | Partial<OutlinedInputProps>\n | Partial<InputProps>;\n};\n\nexport const InputController = <T extends FieldValues>(props: Props<T>) => {\n const {\n control,\n type,\n textareaOption,\n name,\n autoComplete,\n placeholder,\n defaultValue,\n emptyValue,\n inputProps,\n } = props;\n\n const convertedEmptyValue =\n emptyValue === undefined && defaultValue !== undefined ? null : emptyValue;\n\n return (\n <Controller\n control={control}\n name={name}\n defaultValue={defaultValue}\n render={({ field, fieldState }) => (\n <FormControl error={fieldState.invalid}>\n <TextField\n {...field}\n type={type === \"textarea\" ? undefined : type}\n multiline={type === \"textarea\"}\n autoComplete={autoComplete}\n placeholder={placeholder}\n value={field.value ?? \"\"}\n onChange={(e) => {\n const value = e.target.value;\n field.onChange(value ? value : convertedEmptyValue);\n }}\n InputProps={{\n ...inputProps,\n rows: textareaOption ? textareaOption.rows : undefined,\n minRows: textareaOption ? textareaOption.minRows : undefined,\n maxRows: textareaOption ? textareaOption.minRows : undefined,\n endAdornment:\n field.value &&\n !inputProps?.readOnly &&\n !inputProps?.disabled ? (\n <InputAdornment position=\"end\">\n <IconButton\n onClick={() => field.onChange(convertedEmptyValue)}\n edge=\"end\"\n >\n <Clear />\n </IconButton>\n </InputAdornment>\n ) : undefined,\n }}\n sx={{\n \"& .MuiInput-underline:before\": {\n borderColor: \"#CCCCCC\",\n },\n \"& .MuiInputBase-root\": {\n backgroundColor: \"#FFFFFF\",\n },\n \"input:-webkit-autofill\": {\n WebkitBoxShadow: \"0 0 0 1000px white inset\",\n },\n }}\n fullWidth={true}\n />\n <FormHelperText>{fieldState.error?.message}</FormHelperText>\n </FormControl>\n )}\n />\n );\n};\n\nexport default InputController;\n"],"names":["InputController","props","control","type","textareaOption","name","autoComplete","placeholder","defaultValue","emptyValue","inputProps","convertedEmptyValue","jsx","Controller","field","fieldState","jsxs","FormControl","TextField","e","value","InputAdornment","IconButton","Clear","FormHelperText","_a"],"mappings":";;;;AA0CO,MAAMA,IAAkB,CAAwBC,MAAoB;AACzE,QAAM;AAAA,IACJ,SAAAC;AAAA,IACA,MAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,MAAAC;AAAA,IACA,cAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,EAAA,IACET,GAEEU,IACJF,MAAe,UAAaD,MAAiB,SAAY,OAAOC;AAElE,SACE,gBAAAG;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAAX;AAAA,MACA,MAAAG;AAAA,MACA,cAAAG;AAAA,MACA,QAAQ,CAAC,EAAE,OAAAM,GAAO,YAAAC;;AAChB,+BAAAC,EAACC,GAAA,EAAY,OAAOF,EAAW,SAC7B,UAAA;AAAA,UAAA,gBAAAH;AAAA,YAACM;AAAA,YAAA;AAAA,cACE,GAAGJ;AAAA,cACJ,MAAMX,MAAS,aAAa,SAAYA;AAAA,cACxC,WAAWA,MAAS;AAAA,cACpB,cAAAG;AAAA,cACA,aAAAC;AAAA,cACA,OAAOO,EAAM,SAAS;AAAA,cACtB,UAAU,CAACK,MAAM;AACf,sBAAMC,IAAQD,EAAE,OAAO;AACvB,gBAAAL,EAAM,SAASM,KAAgBT,CAAmB;AAAA,cACpD;AAAA,cACA,YAAY;AAAA,gBACV,GAAGD;AAAA,gBACH,MAAMN,IAAiBA,EAAe,OAAO;AAAA,gBAC7C,SAASA,IAAiBA,EAAe,UAAU;AAAA,gBACnD,SAASA,IAAiBA,EAAe,UAAU;AAAA,gBACnD,cACEU,EAAM,SACN,EAACJ,KAAA,QAAAA,EAAY,aACb,EAACA,KAAA,QAAAA,EAAY,YACX,gBAAAE,EAACS,GAAA,EAAe,UAAS,OACvB,UAAA,gBAAAT;AAAA,kBAACU;AAAA,kBAAA;AAAA,oBACC,SAAS,MAAMR,EAAM,SAASH,CAAmB;AAAA,oBACjD,MAAK;AAAA,oBAEL,4BAACY,GAAA,CAAA,CAAM;AAAA,kBAAA;AAAA,gBAAA,GAEX,IACE;AAAA,cAAA;AAAA,cAER,IAAI;AAAA,gBACF,gCAAgC;AAAA,kBAC9B,aAAa;AAAA,gBAAA;AAAA,gBAEf,wBAAwB;AAAA,kBACtB,iBAAiB;AAAA,gBAAA;AAAA,gBAEnB,0BAA0B;AAAA,kBACxB,iBAAiB;AAAA,gBAAA;AAAA,cACnB;AAAA,cAEF,WAAW;AAAA,YAAA;AAAA,UAAA;AAAA,UAEb,gBAAAX,EAACY,GAAA,EAAgB,WAAAC,IAAAV,EAAW,UAAX,gBAAAU,EAAkB,QAAA,CAAQ;AAAA,QAAA,EAAA,CAC7C;AAAA;AAAA,IAAA;AAAA,EAAA;AAIR;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),l=require("@mui/material"),i=o=>{const{dialogTitle:a,dialogContent:t,dialogActions:r,open:s,onCloseDialog:n,...c}=o;return e.jsxs(l.Dialog,{...c,open:s,onClose:()=>n("cancel"),scroll:"paper","aria-labelledby":"scroll-dialog-title","aria-describedby":"scroll-dialog-description",children:[e.jsx(l.DialogTitle,{sx:{display:"flex",gap:"5px",alignItems:"center"},children:a}),e.jsx(l.DialogContent,{dividers:!0,children:e.jsx(l.DialogContentText,{tabIndex:-1,children:t})}),e.jsx(l.DialogActions,{sx:{gap:"10px"},children:r})]})};exports.ScrollableDialog=i;exports.default=i;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),l=require("@mui/material"),i=o=>{const{dialogTitle:a,dialogContent:r,dialogActions:t,open:s,onCloseDialog:n,...c}=o;return e.jsxs(l.Dialog,{...c,open:s,onClose:()=>n("cancel"),scroll:"paper","aria-labelledby":"scroll-dialog-title","aria-describedby":"scroll-dialog-description",children:[e.jsx(l.DialogTitle,{sx:{display:"flex",gap:"5px",alignItems:"center"},children:a}),e.jsx(l.DialogContent,{dividers:!0,children:e.jsx(l.Box,{component:"div",tabIndex:-1,children:r})}),e.jsx(l.DialogActions,{sx:{gap:"10px"},children:t})]})};exports.ScrollableDialog=i;exports.default=i;
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../../src/components/ScrollableDialog/index.tsx"],"sourcesContent":["import { ReactNode } from \"react\";\nimport {\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n DialogProps as MuiDialogProps,\n} from \"@mui/material\";\n\nexport type ConfirmDialogResult = \"confirm\" | \"cancel\";\n\ntype Props = {\n /** ダイアログのタイトル */\n dialogTitle: ReactNode;\n /** ダイアログの内容 */\n dialogContent: ReactNode;\n /** ダイアログの処理ボタン(複数可) */\n dialogActions: ReactNode;\n /** ダイアログの表示状態 */\n open: boolean;\n /** 閉じた時のhandler */\n onCloseDialog: (result: ConfirmDialogResult) => void;\n} & MuiDialogProps;\n\n/** MuiDialogを継承したコンテントのスクロール可能なDialogです。 */\nexport const ScrollableDialog = (props: Props) => {\n const {\n dialogTitle,\n dialogContent,\n dialogActions,\n open,\n onCloseDialog,\n ...dialogProps\n } = props;\n\n return (\n <Dialog\n {...dialogProps}\n open={open}\n onClose={() => onCloseDialog(\"cancel\")}\n scroll={\"paper\"}\n aria-labelledby=\"scroll-dialog-title\"\n aria-describedby=\"scroll-dialog-description\"\n >\n <DialogTitle\n sx={{\n display: \"flex\",\n gap: \"5px\",\n alignItems: \"center\",\n }}\n >\n {dialogTitle}\n </DialogTitle>\n <DialogContent dividers={true}>\n <DialogContentText tabIndex={-1}>{dialogContent}</DialogContentText>\n </DialogContent>\n <DialogActions sx={{ gap: \"10px\" }}>{dialogActions}</DialogActions>\n </Dialog>\n );\n};\n\nexport default ScrollableDialog;\n"],"names":["ScrollableDialog","props","dialogTitle","dialogContent","dialogActions","open","onCloseDialog","dialogProps","jsxs","Dialog","jsx","DialogTitle","DialogContent","DialogContentText","DialogActions"],"mappings":"4KA0BaA,EAAoBC,GAAiB,CAChD,KAAM,CACJ,YAAAC,EACA,cAAAC,EACA,cAAAC,EACA,KAAAC,EACA,cAAAC,EACA,GAAGC,CAAA,EACDN,EAEJ,OACEO,EAAAA,KAACC,EAAAA,OAAA,CACE,GAAGF,EACJ,KAAAF,EACA,QAAS,IAAMC,EAAc,QAAQ,EACrC,OAAQ,QACR,kBAAgB,sBAChB,mBAAiB,4BAEjB,SAAA,CAAAI,EAAAA,IAACC,EAAAA,YAAA,CACC,GAAI,CACF,QAAS,OACT,IAAK,MACL,WAAY,QAAA,EAGb,SAAAT,CAAA,CAAA,EAEHQ,EAAAA,IAACE,EAAAA,eAAc,SAAU,GACvB,eAACC,oBAAA,CAAkB,SAAU,GAAK,SAAAV,CAAA,CAAc,CAAA,CAClD,QACCW,EAAAA,cAAA,CAAc,GAAI,CAAE,IAAK,MAAA,EAAW,SAAAV,CAAA,CAAc,CAAA,CAAA,CAAA,CAGzD"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../../src/components/ScrollableDialog/index.tsx"],"sourcesContent":["import { ReactNode } from \"react\";\nimport {\n Box,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n DialogProps as MuiDialogProps,\n} from \"@mui/material\";\n\nexport type ConfirmDialogResult = \"confirm\" | \"cancel\";\n\ntype Props = {\n /** ダイアログのタイトル */\n dialogTitle: ReactNode;\n /** ダイアログの内容 */\n dialogContent: ReactNode;\n /** ダイアログの処理ボタン(複数可) */\n dialogActions: ReactNode;\n /** ダイアログの表示状態 */\n open: boolean;\n /** 閉じた時のhandler */\n onCloseDialog: (result: ConfirmDialogResult) => void;\n} & MuiDialogProps;\n\n/** MuiDialogを継承したコンテントのスクロール可能なDialogです。 */\nexport const ScrollableDialog = (props: Props) => {\n const {\n dialogTitle,\n dialogContent,\n dialogActions,\n open,\n onCloseDialog,\n ...dialogProps\n } = props;\n\n return (\n <Dialog\n {...dialogProps}\n open={open}\n onClose={() => onCloseDialog(\"cancel\")}\n scroll={\"paper\"}\n aria-labelledby=\"scroll-dialog-title\"\n aria-describedby=\"scroll-dialog-description\"\n >\n <DialogTitle\n sx={{\n display: \"flex\",\n gap: \"5px\",\n alignItems: \"center\",\n }}\n >\n {dialogTitle}\n </DialogTitle>\n <DialogContent dividers={true}>\n <Box component=\"div\" tabIndex={-1}>\n {dialogContent}\n </Box>\n </DialogContent>\n <DialogActions sx={{ gap: \"10px\" }}>{dialogActions}</DialogActions>\n </Dialog>\n );\n};\n\nexport default ScrollableDialog;\n"],"names":["ScrollableDialog","props","dialogTitle","dialogContent","dialogActions","open","onCloseDialog","dialogProps","jsxs","Dialog","jsx","DialogTitle","DialogContent","Box","DialogActions"],"mappings":"4KA0BaA,EAAoBC,GAAiB,CAChD,KAAM,CACJ,YAAAC,EACA,cAAAC,EACA,cAAAC,EACA,KAAAC,EACA,cAAAC,EACA,GAAGC,CAAA,EACDN,EAEJ,OACEO,EAAAA,KAACC,EAAAA,OAAA,CACE,GAAGF,EACJ,KAAAF,EACA,QAAS,IAAMC,EAAc,QAAQ,EACrC,OAAQ,QACR,kBAAgB,sBAChB,mBAAiB,4BAEjB,SAAA,CAAAI,EAAAA,IAACC,EAAAA,YAAA,CACC,GAAI,CACF,QAAS,OACT,IAAK,MACL,WAAY,QAAA,EAGb,SAAAT,CAAA,CAAA,EAEHQ,EAAAA,IAACE,EAAAA,cAAA,CAAc,SAAU,GACvB,SAAAF,EAAAA,IAACG,EAAAA,IAAA,CAAI,UAAU,MAAM,SAAU,GAC5B,SAAAV,CAAA,CACH,EACF,QACCW,EAAAA,cAAA,CAAc,GAAI,CAAE,IAAK,MAAA,EAAW,SAAAV,CAAA,CAAc,CAAA,CAAA,CAAA,CAGzD"}
@@ -1,20 +1,20 @@
1
- import { jsxs as s, jsx as l } from "react/jsx-runtime";
2
- import { Dialog as d, DialogTitle as c, DialogContent as g, DialogContentText as p, DialogActions as x } from "@mui/material";
3
- const h = (o) => {
1
+ import { jsxs as d, jsx as l } from "react/jsx-runtime";
2
+ import { Dialog as s, DialogTitle as c, DialogContent as g, Box as p, DialogActions as x } from "@mui/material";
3
+ const D = (o) => {
4
4
  const {
5
5
  dialogTitle: i,
6
6
  dialogContent: e,
7
7
  dialogActions: a,
8
8
  open: r,
9
- onCloseDialog: t,
10
- ...n
9
+ onCloseDialog: n,
10
+ ...t
11
11
  } = o;
12
- return /* @__PURE__ */ s(
13
- d,
12
+ return /* @__PURE__ */ d(
13
+ s,
14
14
  {
15
- ...n,
15
+ ...t,
16
16
  open: r,
17
- onClose: () => t("cancel"),
17
+ onClose: () => n("cancel"),
18
18
  scroll: "paper",
19
19
  "aria-labelledby": "scroll-dialog-title",
20
20
  "aria-describedby": "scroll-dialog-description",
@@ -30,14 +30,14 @@ const h = (o) => {
30
30
  children: i
31
31
  }
32
32
  ),
33
- /* @__PURE__ */ l(g, { dividers: !0, children: /* @__PURE__ */ l(p, { tabIndex: -1, children: e }) }),
33
+ /* @__PURE__ */ l(g, { dividers: !0, children: /* @__PURE__ */ l(p, { component: "div", tabIndex: -1, children: e }) }),
34
34
  /* @__PURE__ */ l(x, { sx: { gap: "10px" }, children: a })
35
35
  ]
36
36
  }
37
37
  );
38
38
  };
39
39
  export {
40
- h as ScrollableDialog,
41
- h as default
40
+ D as ScrollableDialog,
41
+ D as default
42
42
  };
43
43
  //# sourceMappingURL=index.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../../../src/components/ScrollableDialog/index.tsx"],"sourcesContent":["import { ReactNode } from \"react\";\nimport {\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentText,\n DialogTitle,\n DialogProps as MuiDialogProps,\n} from \"@mui/material\";\n\nexport type ConfirmDialogResult = \"confirm\" | \"cancel\";\n\ntype Props = {\n /** ダイアログのタイトル */\n dialogTitle: ReactNode;\n /** ダイアログの内容 */\n dialogContent: ReactNode;\n /** ダイアログの処理ボタン(複数可) */\n dialogActions: ReactNode;\n /** ダイアログの表示状態 */\n open: boolean;\n /** 閉じた時のhandler */\n onCloseDialog: (result: ConfirmDialogResult) => void;\n} & MuiDialogProps;\n\n/** MuiDialogを継承したコンテントのスクロール可能なDialogです。 */\nexport const ScrollableDialog = (props: Props) => {\n const {\n dialogTitle,\n dialogContent,\n dialogActions,\n open,\n onCloseDialog,\n ...dialogProps\n } = props;\n\n return (\n <Dialog\n {...dialogProps}\n open={open}\n onClose={() => onCloseDialog(\"cancel\")}\n scroll={\"paper\"}\n aria-labelledby=\"scroll-dialog-title\"\n aria-describedby=\"scroll-dialog-description\"\n >\n <DialogTitle\n sx={{\n display: \"flex\",\n gap: \"5px\",\n alignItems: \"center\",\n }}\n >\n {dialogTitle}\n </DialogTitle>\n <DialogContent dividers={true}>\n <DialogContentText tabIndex={-1}>{dialogContent}</DialogContentText>\n </DialogContent>\n <DialogActions sx={{ gap: \"10px\" }}>{dialogActions}</DialogActions>\n </Dialog>\n );\n};\n\nexport default ScrollableDialog;\n"],"names":["ScrollableDialog","props","dialogTitle","dialogContent","dialogActions","open","onCloseDialog","dialogProps","jsxs","Dialog","jsx","DialogTitle","DialogContent","DialogContentText","DialogActions"],"mappings":";;AA0BO,MAAMA,IAAmB,CAACC,MAAiB;AAChD,QAAM;AAAA,IACJ,aAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,MAAAC;AAAA,IACA,eAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDN;AAEJ,SACE,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MACE,GAAGF;AAAA,MACJ,MAAAF;AAAA,MACA,SAAS,MAAMC,EAAc,QAAQ;AAAA,MACrC,QAAQ;AAAA,MACR,mBAAgB;AAAA,MAChB,oBAAiB;AAAA,MAEjB,UAAA;AAAA,QAAA,gBAAAI;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,IAAI;AAAA,cACF,SAAS;AAAA,cACT,KAAK;AAAA,cACL,YAAY;AAAA,YAAA;AAAA,YAGb,UAAAT;AAAA,UAAA;AAAA,QAAA;AAAA,QAEH,gBAAAQ,EAACE,KAAc,UAAU,IACvB,4BAACC,GAAA,EAAkB,UAAU,IAAK,UAAAV,EAAA,CAAc,EAAA,CAClD;AAAA,0BACCW,GAAA,EAAc,IAAI,EAAE,KAAK,OAAA,GAAW,UAAAV,EAAA,CAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGzD;"}
1
+ {"version":3,"file":"index.es.js","sources":["../../../src/components/ScrollableDialog/index.tsx"],"sourcesContent":["import { ReactNode } from \"react\";\nimport {\n Box,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n DialogProps as MuiDialogProps,\n} from \"@mui/material\";\n\nexport type ConfirmDialogResult = \"confirm\" | \"cancel\";\n\ntype Props = {\n /** ダイアログのタイトル */\n dialogTitle: ReactNode;\n /** ダイアログの内容 */\n dialogContent: ReactNode;\n /** ダイアログの処理ボタン(複数可) */\n dialogActions: ReactNode;\n /** ダイアログの表示状態 */\n open: boolean;\n /** 閉じた時のhandler */\n onCloseDialog: (result: ConfirmDialogResult) => void;\n} & MuiDialogProps;\n\n/** MuiDialogを継承したコンテントのスクロール可能なDialogです。 */\nexport const ScrollableDialog = (props: Props) => {\n const {\n dialogTitle,\n dialogContent,\n dialogActions,\n open,\n onCloseDialog,\n ...dialogProps\n } = props;\n\n return (\n <Dialog\n {...dialogProps}\n open={open}\n onClose={() => onCloseDialog(\"cancel\")}\n scroll={\"paper\"}\n aria-labelledby=\"scroll-dialog-title\"\n aria-describedby=\"scroll-dialog-description\"\n >\n <DialogTitle\n sx={{\n display: \"flex\",\n gap: \"5px\",\n alignItems: \"center\",\n }}\n >\n {dialogTitle}\n </DialogTitle>\n <DialogContent dividers={true}>\n <Box component=\"div\" tabIndex={-1}>\n {dialogContent}\n </Box>\n </DialogContent>\n <DialogActions sx={{ gap: \"10px\" }}>{dialogActions}</DialogActions>\n </Dialog>\n );\n};\n\nexport default ScrollableDialog;\n"],"names":["ScrollableDialog","props","dialogTitle","dialogContent","dialogActions","open","onCloseDialog","dialogProps","jsxs","Dialog","jsx","DialogTitle","DialogContent","Box","DialogActions"],"mappings":";;AA0BO,MAAMA,IAAmB,CAACC,MAAiB;AAChD,QAAM;AAAA,IACJ,aAAAC;AAAA,IACA,eAAAC;AAAA,IACA,eAAAC;AAAA,IACA,MAAAC;AAAA,IACA,eAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACDN;AAEJ,SACE,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MACE,GAAGF;AAAA,MACJ,MAAAF;AAAA,MACA,SAAS,MAAMC,EAAc,QAAQ;AAAA,MACrC,QAAQ;AAAA,MACR,mBAAgB;AAAA,MAChB,oBAAiB;AAAA,MAEjB,UAAA;AAAA,QAAA,gBAAAI;AAAA,UAACC;AAAA,UAAA;AAAA,YACC,IAAI;AAAA,cACF,SAAS;AAAA,cACT,KAAK;AAAA,cACL,YAAY;AAAA,YAAA;AAAA,YAGb,UAAAT;AAAA,UAAA;AAAA,QAAA;AAAA,QAEH,gBAAAQ,EAACE,GAAA,EAAc,UAAU,IACvB,UAAA,gBAAAF,EAACG,GAAA,EAAI,WAAU,OAAM,UAAU,IAC5B,UAAAV,EAAA,CACH,GACF;AAAA,0BACCW,GAAA,EAAc,IAAI,EAAE,KAAK,OAAA,GAAW,UAAAV,EAAA,CAAc;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGzD;"}
@@ -1,2 +1,2 @@
1
- "use strict";const n=require("react/jsx-runtime"),e=require("../../react.esm-DGuy6Rn3.cjs"),x=require("./index.cjs.js");describe("SubMenu component",()=>{test("renders SubMenu component with given menu items and button element",()=>{const c=jest.fn(),o=jest.fn(),u=jest.fn(),s=[{icon:n.jsx("span",{children:"Icon 1"}),title:"Menu 1",onClick:c,closeWhenClick:!0},{icon:n.jsx("span",{children:"Icon 2"}),title:"Menu 2",onClick:o},{icon:n.jsx("span",{children:"Icon 3"}),title:"Menu 3",onClick:u,closeWhenClick:!1}],i=n.jsx("button",{children:"Menu Button"});e.render(n.jsx(x.SubMenu,{menuItems:s,buttonElement:i}));const t=e.screen.getByText("Menu Button");e.fireEvent.click(t);const l=e.screen.getByText("Menu 1");e.fireEvent.click(l),expect(c).toHaveBeenCalled(),setTimeout(()=>{expect(e.screen.queryByText("Menu 1")).toBeNull()},0),e.fireEvent.click(t);const r=e.screen.getByText("Menu 2");e.fireEvent.click(r),expect(o).toHaveBeenCalled(),setTimeout(()=>{expect(e.screen.queryByText("Menu 2")).toBeNull()},0),e.fireEvent.click(t);const m=e.screen.getByText("Menu 3");e.fireEvent.click(m),expect(u).toHaveBeenCalled(),setTimeout(()=>{expect(e.screen.queryByText("Menu 3")).not.toBeNull()},0)})});
1
+ "use strict";const n=require("react/jsx-runtime"),e=require("../../react.esm-DGuy6Rn3.cjs"),x=require("./index.cjs.js");describe("SubMenu component",()=>{test("renders SubMenu component with given menu items and button element",()=>{const c=jest.fn(),o=jest.fn(),s=jest.fn(),u=[{icon:n.jsx("span",{children:"Icon 1"}),title:"Menu 1",onClick:c,closeWhenClick:!0},{icon:n.jsx("span",{children:"Icon 2"}),title:"Menu 2",onClick:o},{icon:n.jsx("span",{children:"Icon 3"}),title:"Menu 3",onClick:s,closeWhenClick:!1}],i=n.jsx("span",{children:"Menu Button"});e.render(n.jsx(x.SubMenu,{menuItems:u,buttonElement:i}));const t=e.screen.getByText("Menu Button");e.fireEvent.click(t);const l=e.screen.getByText("Menu 1");e.fireEvent.click(l),expect(c).toHaveBeenCalled(),setTimeout(()=>{expect(e.screen.queryByText("Menu 1")).toBeNull()},0),e.fireEvent.click(t);const r=e.screen.getByText("Menu 2");e.fireEvent.click(r),expect(o).toHaveBeenCalled(),setTimeout(()=>{expect(e.screen.queryByText("Menu 2")).toBeNull()},0),e.fireEvent.click(t);const m=e.screen.getByText("Menu 3");e.fireEvent.click(m),expect(s).toHaveBeenCalled(),setTimeout(()=>{expect(e.screen.queryByText("Menu 3")).not.toBeNull()},0)})});
2
2
  //# sourceMappingURL=index.test.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.test.cjs.js","sources":["../../../src/components/SubMenu/index.test.tsx"],"sourcesContent":["import { fireEvent, render, screen } from \"@testing-library/react\";\n\nimport { SubMenu } from \".\";\n\ndescribe(\"SubMenu component\", () => {\n test(\"renders SubMenu component with given menu items and button element\", () => {\n const mockOnClickMenu1 = jest.fn();\n const mockOnClickMenu2 = jest.fn();\n const mockOnClickMenu3 = jest.fn();\n\n const menuItems = [\n {\n icon: <span>Icon 1</span>,\n title: \"Menu 1\",\n onClick: mockOnClickMenu1,\n closeWhenClick: true,\n },\n {\n icon: <span>Icon 2</span>,\n title: \"Menu 2\",\n onClick: mockOnClickMenu2,\n },\n {\n icon: <span>Icon 3</span>,\n title: \"Menu 3\",\n onClick: mockOnClickMenu3,\n closeWhenClick: false,\n },\n ];\n\n const buttonElement = <button>Menu Button</button>;\n\n render(<SubMenu menuItems={menuItems} buttonElement={buttonElement} />);\n\n // Menu 1のテスト menuクリック時消えていること\n const button = screen.getByText(\"Menu Button\");\n fireEvent.click(button);\n const menuItem1 = screen.getByText(\"Menu 1\");\n fireEvent.click(menuItem1);\n expect(mockOnClickMenu1).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 1\")).toBeNull();\n }, 0);\n\n // Menu 2のテスト menuクリック時消えていること\n fireEvent.click(button);\n const menuItem2 = screen.getByText(\"Menu 2\");\n fireEvent.click(menuItem2);\n expect(mockOnClickMenu2).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 2\")).toBeNull();\n }, 0);\n\n // Menu 3のテスト menuクリック時消えていないこと\n fireEvent.click(button);\n const menuItem3 = screen.getByText(\"Menu 3\");\n fireEvent.click(menuItem3);\n expect(mockOnClickMenu3).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 3\")).not.toBeNull();\n }, 0);\n });\n});\n"],"names":["mockOnClickMenu1","mockOnClickMenu2","mockOnClickMenu3","menuItems","jsx","buttonElement","render","SubMenu","button","screen","fireEvent","menuItem1","menuItem2","menuItem3"],"mappings":"wHAIA,SAAS,oBAAqB,IAAM,CAClC,KAAK,qEAAsE,IAAM,CAC/E,MAAMA,EAAmB,KAAK,GAAA,EACxBC,EAAmB,KAAK,GAAA,EACxBC,EAAmB,KAAK,GAAA,EAExBC,EAAY,CAChB,CACE,KAAMC,EAAAA,IAAC,OAAA,CAAK,SAAA,QAAA,CAAM,EAClB,MAAO,SACP,QAASJ,EACT,eAAgB,EAAA,EAElB,CACE,KAAMI,EAAAA,IAAC,OAAA,CAAK,SAAA,QAAA,CAAM,EAClB,MAAO,SACP,QAASH,CAAA,EAEX,CACE,KAAMG,EAAAA,IAAC,OAAA,CAAK,SAAA,QAAA,CAAM,EAClB,MAAO,SACP,QAASF,EACT,eAAgB,EAAA,CAClB,EAGIG,EAAgBD,EAAAA,IAAC,SAAA,CAAO,SAAA,aAAA,CAAW,EAEzCE,EAAAA,OAAOF,EAAAA,IAACG,EAAAA,QAAA,CAAQ,UAAAJ,EAAsB,cAAAE,CAAA,CAA8B,CAAE,EAGtE,MAAMG,EAASC,EAAAA,OAAO,UAAU,aAAa,EAC7CC,EAAAA,UAAU,MAAMF,CAAM,EACtB,MAAMG,EAAYF,EAAAA,OAAO,UAAU,QAAQ,EAC3CC,EAAAA,UAAU,MAAMC,CAAS,EACzB,OAAOX,CAAgB,EAAE,iBAAA,EACzB,WAAW,IAAM,CACf,OAAOS,EAAAA,OAAO,YAAY,QAAQ,CAAC,EAAE,SAAA,CACvC,EAAG,CAAC,EAGJC,EAAAA,UAAU,MAAMF,CAAM,EACtB,MAAMI,EAAYH,EAAAA,OAAO,UAAU,QAAQ,EAC3CC,EAAAA,UAAU,MAAME,CAAS,EACzB,OAAOX,CAAgB,EAAE,iBAAA,EACzB,WAAW,IAAM,CACf,OAAOQ,EAAAA,OAAO,YAAY,QAAQ,CAAC,EAAE,SAAA,CACvC,EAAG,CAAC,EAGJC,EAAAA,UAAU,MAAMF,CAAM,EACtB,MAAMK,EAAYJ,EAAAA,OAAO,UAAU,QAAQ,EAC3CC,EAAAA,UAAU,MAAMG,CAAS,EACzB,OAAOX,CAAgB,EAAE,iBAAA,EACzB,WAAW,IAAM,CACf,OAAOO,EAAAA,OAAO,YAAY,QAAQ,CAAC,EAAE,IAAI,SAAA,CAC3C,EAAG,CAAC,CACN,CAAC,CACH,CAAC"}
1
+ {"version":3,"file":"index.test.cjs.js","sources":["../../../src/components/SubMenu/index.test.tsx"],"sourcesContent":["import { fireEvent, render, screen } from \"@testing-library/react\";\n\nimport { SubMenu } from \".\";\n\ndescribe(\"SubMenu component\", () => {\n test(\"renders SubMenu component with given menu items and button element\", () => {\n const mockOnClickMenu1 = jest.fn();\n const mockOnClickMenu2 = jest.fn();\n const mockOnClickMenu3 = jest.fn();\n\n const menuItems = [\n {\n icon: <span>Icon 1</span>,\n title: \"Menu 1\",\n onClick: mockOnClickMenu1,\n closeWhenClick: true,\n },\n {\n icon: <span>Icon 2</span>,\n title: \"Menu 2\",\n onClick: mockOnClickMenu2,\n },\n {\n icon: <span>Icon 3</span>,\n title: \"Menu 3\",\n onClick: mockOnClickMenu3,\n closeWhenClick: false,\n },\n ];\n\n const buttonElement = <span>Menu Button</span>;\n\n render(<SubMenu menuItems={menuItems} buttonElement={buttonElement} />);\n\n // Menu 1のテスト menuクリック時消えていること\n const button = screen.getByText(\"Menu Button\");\n fireEvent.click(button);\n const menuItem1 = screen.getByText(\"Menu 1\");\n fireEvent.click(menuItem1);\n expect(mockOnClickMenu1).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 1\")).toBeNull();\n }, 0);\n\n // Menu 2のテスト menuクリック時消えていること\n fireEvent.click(button);\n const menuItem2 = screen.getByText(\"Menu 2\");\n fireEvent.click(menuItem2);\n expect(mockOnClickMenu2).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 2\")).toBeNull();\n }, 0);\n\n // Menu 3のテスト menuクリック時消えていないこと\n fireEvent.click(button);\n const menuItem3 = screen.getByText(\"Menu 3\");\n fireEvent.click(menuItem3);\n expect(mockOnClickMenu3).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 3\")).not.toBeNull();\n }, 0);\n });\n});\n"],"names":["mockOnClickMenu1","mockOnClickMenu2","mockOnClickMenu3","menuItems","jsx","buttonElement","render","SubMenu","button","screen","fireEvent","menuItem1","menuItem2","menuItem3"],"mappings":"wHAIA,SAAS,oBAAqB,IAAM,CAClC,KAAK,qEAAsE,IAAM,CAC/E,MAAMA,EAAmB,KAAK,GAAA,EACxBC,EAAmB,KAAK,GAAA,EACxBC,EAAmB,KAAK,GAAA,EAExBC,EAAY,CAChB,CACE,KAAMC,EAAAA,IAAC,OAAA,CAAK,SAAA,QAAA,CAAM,EAClB,MAAO,SACP,QAASJ,EACT,eAAgB,EAAA,EAElB,CACE,KAAMI,EAAAA,IAAC,OAAA,CAAK,SAAA,QAAA,CAAM,EAClB,MAAO,SACP,QAASH,CAAA,EAEX,CACE,KAAMG,EAAAA,IAAC,OAAA,CAAK,SAAA,QAAA,CAAM,EAClB,MAAO,SACP,QAASF,EACT,eAAgB,EAAA,CAClB,EAGIG,EAAgBD,EAAAA,IAAC,OAAA,CAAK,SAAA,aAAA,CAAW,EAEvCE,EAAAA,OAAOF,EAAAA,IAACG,EAAAA,QAAA,CAAQ,UAAAJ,EAAsB,cAAAE,CAAA,CAA8B,CAAE,EAGtE,MAAMG,EAASC,EAAAA,OAAO,UAAU,aAAa,EAC7CC,EAAAA,UAAU,MAAMF,CAAM,EACtB,MAAMG,EAAYF,EAAAA,OAAO,UAAU,QAAQ,EAC3CC,EAAAA,UAAU,MAAMC,CAAS,EACzB,OAAOX,CAAgB,EAAE,iBAAA,EACzB,WAAW,IAAM,CACf,OAAOS,EAAAA,OAAO,YAAY,QAAQ,CAAC,EAAE,SAAA,CACvC,EAAG,CAAC,EAGJC,EAAAA,UAAU,MAAMF,CAAM,EACtB,MAAMI,EAAYH,EAAAA,OAAO,UAAU,QAAQ,EAC3CC,EAAAA,UAAU,MAAME,CAAS,EACzB,OAAOX,CAAgB,EAAE,iBAAA,EACzB,WAAW,IAAM,CACf,OAAOQ,EAAAA,OAAO,YAAY,QAAQ,CAAC,EAAE,SAAA,CACvC,EAAG,CAAC,EAGJC,EAAAA,UAAU,MAAMF,CAAM,EACtB,MAAMK,EAAYJ,EAAAA,OAAO,UAAU,QAAQ,EAC3CC,EAAAA,UAAU,MAAMG,CAAS,EACzB,OAAOX,CAAgB,EAAE,iBAAA,EACzB,WAAW,IAAM,CACf,OAAOO,EAAAA,OAAO,YAAY,QAAQ,CAAC,EAAE,IAAI,SAAA,CAC3C,EAAG,CAAC,CACN,CAAC,CACH,CAAC"}
@@ -1,40 +1,40 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { r, s as e, f as t } from "../../react.esm-BBESb8eI.js";
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { r, s as e, f as n } from "../../react.esm-BBESb8eI.js";
3
3
  import { SubMenu as k } from "./index.es.js";
4
4
  describe("SubMenu component", () => {
5
5
  test("renders SubMenu component with given menu items and button element", () => {
6
6
  const o = jest.fn(), u = jest.fn(), l = jest.fn();
7
- r(/* @__PURE__ */ n(k, { menuItems: [
7
+ r(/* @__PURE__ */ t(k, { menuItems: [
8
8
  {
9
- icon: /* @__PURE__ */ n("span", { children: "Icon 1" }),
9
+ icon: /* @__PURE__ */ t("span", { children: "Icon 1" }),
10
10
  title: "Menu 1",
11
11
  onClick: o,
12
12
  closeWhenClick: !0
13
13
  },
14
14
  {
15
- icon: /* @__PURE__ */ n("span", { children: "Icon 2" }),
15
+ icon: /* @__PURE__ */ t("span", { children: "Icon 2" }),
16
16
  title: "Menu 2",
17
17
  onClick: u
18
18
  },
19
19
  {
20
- icon: /* @__PURE__ */ n("span", { children: "Icon 3" }),
20
+ icon: /* @__PURE__ */ t("span", { children: "Icon 3" }),
21
21
  title: "Menu 3",
22
22
  onClick: l,
23
23
  closeWhenClick: !1
24
24
  }
25
- ], buttonElement: /* @__PURE__ */ n("button", { children: "Menu Button" }) }));
25
+ ], buttonElement: /* @__PURE__ */ t("span", { children: "Menu Button" }) }));
26
26
  const c = e.getByText("Menu Button");
27
- t.click(c);
27
+ n.click(c);
28
28
  const i = e.getByText("Menu 1");
29
- t.click(i), expect(o).toHaveBeenCalled(), setTimeout(() => {
29
+ n.click(i), expect(o).toHaveBeenCalled(), setTimeout(() => {
30
30
  expect(e.queryByText("Menu 1")).toBeNull();
31
- }, 0), t.click(c);
31
+ }, 0), n.click(c);
32
32
  const s = e.getByText("Menu 2");
33
- t.click(s), expect(u).toHaveBeenCalled(), setTimeout(() => {
33
+ n.click(s), expect(u).toHaveBeenCalled(), setTimeout(() => {
34
34
  expect(e.queryByText("Menu 2")).toBeNull();
35
- }, 0), t.click(c);
35
+ }, 0), n.click(c);
36
36
  const m = e.getByText("Menu 3");
37
- t.click(m), expect(l).toHaveBeenCalled(), setTimeout(() => {
37
+ n.click(m), expect(l).toHaveBeenCalled(), setTimeout(() => {
38
38
  expect(e.queryByText("Menu 3")).not.toBeNull();
39
39
  }, 0);
40
40
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.test.es.js","sources":["../../../src/components/SubMenu/index.test.tsx"],"sourcesContent":["import { fireEvent, render, screen } from \"@testing-library/react\";\n\nimport { SubMenu } from \".\";\n\ndescribe(\"SubMenu component\", () => {\n test(\"renders SubMenu component with given menu items and button element\", () => {\n const mockOnClickMenu1 = jest.fn();\n const mockOnClickMenu2 = jest.fn();\n const mockOnClickMenu3 = jest.fn();\n\n const menuItems = [\n {\n icon: <span>Icon 1</span>,\n title: \"Menu 1\",\n onClick: mockOnClickMenu1,\n closeWhenClick: true,\n },\n {\n icon: <span>Icon 2</span>,\n title: \"Menu 2\",\n onClick: mockOnClickMenu2,\n },\n {\n icon: <span>Icon 3</span>,\n title: \"Menu 3\",\n onClick: mockOnClickMenu3,\n closeWhenClick: false,\n },\n ];\n\n const buttonElement = <button>Menu Button</button>;\n\n render(<SubMenu menuItems={menuItems} buttonElement={buttonElement} />);\n\n // Menu 1のテスト menuクリック時消えていること\n const button = screen.getByText(\"Menu Button\");\n fireEvent.click(button);\n const menuItem1 = screen.getByText(\"Menu 1\");\n fireEvent.click(menuItem1);\n expect(mockOnClickMenu1).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 1\")).toBeNull();\n }, 0);\n\n // Menu 2のテスト menuクリック時消えていること\n fireEvent.click(button);\n const menuItem2 = screen.getByText(\"Menu 2\");\n fireEvent.click(menuItem2);\n expect(mockOnClickMenu2).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 2\")).toBeNull();\n }, 0);\n\n // Menu 3のテスト menuクリック時消えていないこと\n fireEvent.click(button);\n const menuItem3 = screen.getByText(\"Menu 3\");\n fireEvent.click(menuItem3);\n expect(mockOnClickMenu3).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 3\")).not.toBeNull();\n }, 0);\n });\n});\n"],"names":["mockOnClickMenu1","mockOnClickMenu2","mockOnClickMenu3","render","jsx","SubMenu","button","screen","fireEvent","menuItem1","menuItem2","menuItem3"],"mappings":";;;AAIA,SAAS,qBAAqB,MAAM;AAClC,OAAK,sEAAsE,MAAM;AAC/E,UAAMA,IAAmB,KAAK,GAAA,GACxBC,IAAmB,KAAK,GAAA,GACxBC,IAAmB,KAAK,GAAA;AAwB9B,IAAAC,EAAO,gBAAAC,EAACC,GAAA,EAAQ,WAtBE;AAAA,MAChB;AAAA,QACE,MAAM,gBAAAD,EAAC,QAAA,EAAK,UAAA,SAAA,CAAM;AAAA,QAClB,OAAO;AAAA,QACP,SAASJ;AAAA,QACT,gBAAgB;AAAA,MAAA;AAAA,MAElB;AAAA,QACE,MAAM,gBAAAI,EAAC,QAAA,EAAK,UAAA,SAAA,CAAM;AAAA,QAClB,OAAO;AAAA,QACP,SAASH;AAAA,MAAA;AAAA,MAEX;AAAA,QACE,MAAM,gBAAAG,EAAC,QAAA,EAAK,UAAA,SAAA,CAAM;AAAA,QAClB,OAAO;AAAA,QACP,SAASF;AAAA,QACT,gBAAgB;AAAA,MAAA;AAAA,IAClB,GAKoC,eAFhB,gBAAAE,EAAC,UAAA,EAAO,UAAA,cAAA,CAAW,EAEH,CAA8B,CAAE;AAGtE,UAAME,IAASC,EAAO,UAAU,aAAa;AAC7C,IAAAC,EAAU,MAAMF,CAAM;AACtB,UAAMG,IAAYF,EAAO,UAAU,QAAQ;AAC3C,IAAAC,EAAU,MAAMC,CAAS,GACzB,OAAOT,CAAgB,EAAE,iBAAA,GACzB,WAAW,MAAM;AACf,aAAOO,EAAO,YAAY,QAAQ,CAAC,EAAE,SAAA;AAAA,IACvC,GAAG,CAAC,GAGJC,EAAU,MAAMF,CAAM;AACtB,UAAMI,IAAYH,EAAO,UAAU,QAAQ;AAC3C,IAAAC,EAAU,MAAME,CAAS,GACzB,OAAOT,CAAgB,EAAE,iBAAA,GACzB,WAAW,MAAM;AACf,aAAOM,EAAO,YAAY,QAAQ,CAAC,EAAE,SAAA;AAAA,IACvC,GAAG,CAAC,GAGJC,EAAU,MAAMF,CAAM;AACtB,UAAMK,IAAYJ,EAAO,UAAU,QAAQ;AAC3C,IAAAC,EAAU,MAAMG,CAAS,GACzB,OAAOT,CAAgB,EAAE,iBAAA,GACzB,WAAW,MAAM;AACf,aAAOK,EAAO,YAAY,QAAQ,CAAC,EAAE,IAAI,SAAA;AAAA,IAC3C,GAAG,CAAC;AAAA,EACN,CAAC;AACH,CAAC;"}
1
+ {"version":3,"file":"index.test.es.js","sources":["../../../src/components/SubMenu/index.test.tsx"],"sourcesContent":["import { fireEvent, render, screen } from \"@testing-library/react\";\n\nimport { SubMenu } from \".\";\n\ndescribe(\"SubMenu component\", () => {\n test(\"renders SubMenu component with given menu items and button element\", () => {\n const mockOnClickMenu1 = jest.fn();\n const mockOnClickMenu2 = jest.fn();\n const mockOnClickMenu3 = jest.fn();\n\n const menuItems = [\n {\n icon: <span>Icon 1</span>,\n title: \"Menu 1\",\n onClick: mockOnClickMenu1,\n closeWhenClick: true,\n },\n {\n icon: <span>Icon 2</span>,\n title: \"Menu 2\",\n onClick: mockOnClickMenu2,\n },\n {\n icon: <span>Icon 3</span>,\n title: \"Menu 3\",\n onClick: mockOnClickMenu3,\n closeWhenClick: false,\n },\n ];\n\n const buttonElement = <span>Menu Button</span>;\n\n render(<SubMenu menuItems={menuItems} buttonElement={buttonElement} />);\n\n // Menu 1のテスト menuクリック時消えていること\n const button = screen.getByText(\"Menu Button\");\n fireEvent.click(button);\n const menuItem1 = screen.getByText(\"Menu 1\");\n fireEvent.click(menuItem1);\n expect(mockOnClickMenu1).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 1\")).toBeNull();\n }, 0);\n\n // Menu 2のテスト menuクリック時消えていること\n fireEvent.click(button);\n const menuItem2 = screen.getByText(\"Menu 2\");\n fireEvent.click(menuItem2);\n expect(mockOnClickMenu2).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 2\")).toBeNull();\n }, 0);\n\n // Menu 3のテスト menuクリック時消えていないこと\n fireEvent.click(button);\n const menuItem3 = screen.getByText(\"Menu 3\");\n fireEvent.click(menuItem3);\n expect(mockOnClickMenu3).toHaveBeenCalled();\n setTimeout(() => {\n expect(screen.queryByText(\"Menu 3\")).not.toBeNull();\n }, 0);\n });\n});\n"],"names":["mockOnClickMenu1","mockOnClickMenu2","mockOnClickMenu3","render","jsx","SubMenu","button","screen","fireEvent","menuItem1","menuItem2","menuItem3"],"mappings":";;;AAIA,SAAS,qBAAqB,MAAM;AAClC,OAAK,sEAAsE,MAAM;AAC/E,UAAMA,IAAmB,KAAK,GAAA,GACxBC,IAAmB,KAAK,GAAA,GACxBC,IAAmB,KAAK,GAAA;AAwB9B,IAAAC,EAAO,gBAAAC,EAACC,GAAA,EAAQ,WAtBE;AAAA,MAChB;AAAA,QACE,MAAM,gBAAAD,EAAC,QAAA,EAAK,UAAA,SAAA,CAAM;AAAA,QAClB,OAAO;AAAA,QACP,SAASJ;AAAA,QACT,gBAAgB;AAAA,MAAA;AAAA,MAElB;AAAA,QACE,MAAM,gBAAAI,EAAC,QAAA,EAAK,UAAA,SAAA,CAAM;AAAA,QAClB,OAAO;AAAA,QACP,SAASH;AAAA,MAAA;AAAA,MAEX;AAAA,QACE,MAAM,gBAAAG,EAAC,QAAA,EAAK,UAAA,SAAA,CAAM;AAAA,QAClB,OAAO;AAAA,QACP,SAASF;AAAA,QACT,gBAAgB;AAAA,MAAA;AAAA,IAClB,GAKoC,eAFhB,gBAAAE,EAAC,QAAA,EAAK,UAAA,cAAA,CAAW,EAED,CAA8B,CAAE;AAGtE,UAAME,IAASC,EAAO,UAAU,aAAa;AAC7C,IAAAC,EAAU,MAAMF,CAAM;AACtB,UAAMG,IAAYF,EAAO,UAAU,QAAQ;AAC3C,IAAAC,EAAU,MAAMC,CAAS,GACzB,OAAOT,CAAgB,EAAE,iBAAA,GACzB,WAAW,MAAM;AACf,aAAOO,EAAO,YAAY,QAAQ,CAAC,EAAE,SAAA;AAAA,IACvC,GAAG,CAAC,GAGJC,EAAU,MAAMF,CAAM;AACtB,UAAMI,IAAYH,EAAO,UAAU,QAAQ;AAC3C,IAAAC,EAAU,MAAME,CAAS,GACzB,OAAOT,CAAgB,EAAE,iBAAA,GACzB,WAAW,MAAM;AACf,aAAOM,EAAO,YAAY,QAAQ,CAAC,EAAE,SAAA;AAAA,IACvC,GAAG,CAAC,GAGJC,EAAU,MAAMF,CAAM;AACtB,UAAMK,IAAYJ,EAAO,UAAU,QAAQ;AAC3C,IAAAC,EAAU,MAAMG,CAAS,GACzB,OAAOT,CAAgB,EAAE,iBAAA,GACzB,WAAW,MAAM;AACf,aAAOK,EAAO,YAAY,QAAQ,CAAC,EAAE,IAAI,SAAA;AAAA,IAC3C,GAAG,CAAC;AAAA,EACN,CAAC;AACH,CAAC;"}
@@ -2,11 +2,11 @@
2
2
  * @license QR Code generator library (TypeScript)
3
3
  * Copyright (c) Project Nayuki.
4
4
  * SPDX-License-Identifier: MIT
5
- */var O;(u=>{const l=class m{constructor(e,o,t,n){if(this.version=e,this.errorCorrectionLevel=o,this.modules=[],this.isFunction=[],e<m.MIN_VERSION||e>m.MAX_VERSION)throw new RangeError("Version value out of range");if(n<-1||n>7)throw new RangeError("Mask value out of range");this.size=e*4+17;let r=[];for(let s=0;s<this.size;s++)r.push(!1);for(let s=0;s<this.size;s++)this.modules.push(r.slice()),this.isFunction.push(r.slice());this.drawFunctionPatterns();const a=this.addEccAndInterleave(t);if(this.drawCodewords(a),n==-1){let s=1e9;for(let p=0;p<8;p++){this.applyMask(p),this.drawFormatBits(p);const h=this.getPenaltyScore();h<s&&(n=p,s=h),this.applyMask(p)}}g(0<=n&&n<=7),this.mask=n,this.applyMask(n),this.drawFormatBits(n),this.isFunction=[]}static encodeText(e,o){const t=u.QrSegment.makeSegments(e);return m.encodeSegments(t,o)}static encodeBinary(e,o){const t=u.QrSegment.makeBytes(e);return m.encodeSegments([t],o)}static encodeSegments(e,o,t=1,n=40,r=-1,a=!0){if(!(m.MIN_VERSION<=t&&t<=n&&n<=m.MAX_VERSION)||r<-1||r>7)throw new RangeError("Invalid value");let s,p;for(s=t;;s++){const f=m.getNumDataCodewords(s,o)*8,M=w.getTotalBits(e,s);if(M<=f){p=M;break}if(s>=n)throw new RangeError("Data too long")}for(const f of[m.Ecc.MEDIUM,m.Ecc.QUARTILE,m.Ecc.HIGH])a&&p<=m.getNumDataCodewords(s,f)*8&&(o=f);let h=[];for(const f of e){i(f.mode.modeBits,4,h),i(f.numChars,f.mode.numCharCountBits(s),h);for(const M of f.getData())h.push(M)}g(h.length==p);const x=m.getNumDataCodewords(s,o)*8;g(h.length<=x),i(0,Math.min(4,x-h.length),h),i(0,(8-h.length%8)%8,h),g(h.length%8==0);for(let f=236;h.length<x;f^=253)i(f,8,h);let v=[];for(;v.length*8<h.length;)v.push(0);return h.forEach((f,M)=>v[M>>>3]|=f<<7-(M&7)),new m(s,o,v,r)}getModule(e,o){return 0<=e&&e<this.size&&0<=o&&o<this.size&&this.modules[o][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let t=0;t<this.size;t++)this.setFunctionModule(6,t,t%2==0),this.setFunctionModule(t,6,t%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const e=this.getAlignmentPatternPositions(),o=e.length;for(let t=0;t<o;t++)for(let n=0;n<o;n++)t==0&&n==0||t==0&&n==o-1||t==o-1&&n==0||this.drawAlignmentPattern(e[t],e[n]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const o=this.errorCorrectionLevel.formatBits<<3|e;let t=o;for(let r=0;r<10;r++)t=t<<1^(t>>>9)*1335;const n=(o<<10|t)^21522;g(n>>>15==0);for(let r=0;r<=5;r++)this.setFunctionModule(8,r,c(n,r));this.setFunctionModule(8,7,c(n,6)),this.setFunctionModule(8,8,c(n,7)),this.setFunctionModule(7,8,c(n,8));for(let r=9;r<15;r++)this.setFunctionModule(14-r,8,c(n,r));for(let r=0;r<8;r++)this.setFunctionModule(this.size-1-r,8,c(n,r));for(let r=8;r<15;r++)this.setFunctionModule(8,this.size-15+r,c(n,r));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;const o=this.version<<12|e;g(o>>>18==0);for(let t=0;t<18;t++){const n=c(o,t),r=this.size-11+t%3,a=Math.floor(t/3);this.setFunctionModule(r,a,n),this.setFunctionModule(a,r,n)}}drawFinderPattern(e,o){for(let t=-4;t<=4;t++)for(let n=-4;n<=4;n++){const r=Math.max(Math.abs(n),Math.abs(t)),a=e+n,s=o+t;0<=a&&a<this.size&&0<=s&&s<this.size&&this.setFunctionModule(a,s,r!=2&&r!=4)}}drawAlignmentPattern(e,o){for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)this.setFunctionModule(e+n,o+t,Math.max(Math.abs(n),Math.abs(t))!=1)}setFunctionModule(e,o,t){this.modules[o][e]=t,this.isFunction[o][e]=!0}addEccAndInterleave(e){const o=this.version,t=this.errorCorrectionLevel;if(e.length!=m.getNumDataCodewords(o,t))throw new RangeError("Invalid argument");const n=m.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][o],r=m.ECC_CODEWORDS_PER_BLOCK[t.ordinal][o],a=Math.floor(m.getNumRawDataModules(o)/8),s=n-a%n,p=Math.floor(a/n);let h=[];const x=m.reedSolomonComputeDivisor(r);for(let f=0,M=0;f<n;f++){let P=e.slice(M,M+p-r+(f<s?0:1));M+=P.length;const _=m.reedSolomonComputeRemainder(P,x);f<s&&P.push(0),h.push(P.concat(_))}let v=[];for(let f=0;f<h[0].length;f++)h.forEach((M,P)=>{(f!=p-r||P>=s)&&v.push(M[f])});return g(v.length==a),v}drawCodewords(e){if(e.length!=Math.floor(m.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let o=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let n=0;n<this.size;n++)for(let r=0;r<2;r++){const a=t-r,p=(t+1&2)==0?this.size-1-n:n;!this.isFunction[p][a]&&o<e.length*8&&(this.modules[p][a]=c(e[o>>>3],7-(o&7)),o++)}}g(o==e.length*8)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let o=0;o<this.size;o++)for(let t=0;t<this.size;t++){let n;switch(e){case 0:n=(t+o)%2==0;break;case 1:n=o%2==0;break;case 2:n=t%3==0;break;case 3:n=(t+o)%3==0;break;case 4:n=(Math.floor(t/3)+Math.floor(o/2))%2==0;break;case 5:n=t*o%2+t*o%3==0;break;case 6:n=(t*o%2+t*o%3)%2==0;break;case 7:n=((t+o)%2+t*o%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[o][t]&&n&&(this.modules[o][t]=!this.modules[o][t])}}getPenaltyScore(){let e=0;for(let r=0;r<this.size;r++){let a=!1,s=0,p=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[r][h]==a?(s++,s==5?e+=m.PENALTY_N1:s>5&&e++):(this.finderPenaltyAddHistory(s,p),a||(e+=this.finderPenaltyCountPatterns(p)*m.PENALTY_N3),a=this.modules[r][h],s=1);e+=this.finderPenaltyTerminateAndCount(a,s,p)*m.PENALTY_N3}for(let r=0;r<this.size;r++){let a=!1,s=0,p=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][r]==a?(s++,s==5?e+=m.PENALTY_N1:s>5&&e++):(this.finderPenaltyAddHistory(s,p),a||(e+=this.finderPenaltyCountPatterns(p)*m.PENALTY_N3),a=this.modules[h][r],s=1);e+=this.finderPenaltyTerminateAndCount(a,s,p)*m.PENALTY_N3}for(let r=0;r<this.size-1;r++)for(let a=0;a<this.size-1;a++){const s=this.modules[r][a];s==this.modules[r][a+1]&&s==this.modules[r+1][a]&&s==this.modules[r+1][a+1]&&(e+=m.PENALTY_N2)}let o=0;for(const r of this.modules)o=r.reduce((a,s)=>a+(s?1:0),o);const t=this.size*this.size,n=Math.ceil(Math.abs(o*20-t*10)/t)-1;return g(0<=n&&n<=9),e+=n*m.PENALTY_N4,g(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{const e=Math.floor(this.version/7)+2,o=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2;let t=[6];for(let n=this.size-7;t.length<e;n-=o)t.splice(1,0,n);return t}}static getNumRawDataModules(e){if(e<m.MIN_VERSION||e>m.MAX_VERSION)throw new RangeError("Version number out of range");let o=(16*e+128)*e+64;if(e>=2){const t=Math.floor(e/7)+2;o-=(25*t-10)*t-55,e>=7&&(o-=36)}return g(208<=o&&o<=29648),o}static getNumDataCodewords(e,o){return Math.floor(m.getNumRawDataModules(e)/8)-m.ECC_CODEWORDS_PER_BLOCK[o.ordinal][e]*m.NUM_ERROR_CORRECTION_BLOCKS[o.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");let o=[];for(let n=0;n<e-1;n++)o.push(0);o.push(1);let t=1;for(let n=0;n<e;n++){for(let r=0;r<o.length;r++)o[r]=m.reedSolomonMultiply(o[r],t),r+1<o.length&&(o[r]^=o[r+1]);t=m.reedSolomonMultiply(t,2)}return o}static reedSolomonComputeRemainder(e,o){let t=o.map(n=>0);for(const n of e){const r=n^t.shift();t.push(0),o.forEach((a,s)=>t[s]^=m.reedSolomonMultiply(a,r))}return t}static reedSolomonMultiply(e,o){if(e>>>8||o>>>8)throw new RangeError("Byte out of range");let t=0;for(let n=7;n>=0;n--)t=t<<1^(t>>>7)*285,t^=(o>>>n&1)*e;return g(t>>>8==0),t}finderPenaltyCountPatterns(e){const o=e[1];g(o<=this.size*3);const t=o>0&&e[2]==o&&e[3]==o*3&&e[4]==o&&e[5]==o;return(t&&e[0]>=o*4&&e[6]>=o?1:0)+(t&&e[6]>=o*4&&e[0]>=o?1:0)}finderPenaltyTerminateAndCount(e,o,t){return e&&(this.finderPenaltyAddHistory(o,t),o=0),o+=this.size,this.finderPenaltyAddHistory(o,t),this.finderPenaltyCountPatterns(t)}finderPenaltyAddHistory(e,o){o[0]==0&&(e+=this.size),o.pop(),o.unshift(e)}};l.MIN_VERSION=1,l.MAX_VERSION=40,l.PENALTY_N1=3,l.PENALTY_N2=3,l.PENALTY_N3=40,l.PENALTY_N4=10,l.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],l.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],u.QrCode=l;function i(C,e,o){if(e<0||e>31||C>>>e)throw new RangeError("Value out of range");for(let t=e-1;t>=0;t--)o.push(C>>>t&1)}function c(C,e){return(C>>>e&1)!=0}function g(C){if(!C)throw new Error("Assertion error")}const d=class R{constructor(e,o,t){if(this.mode=e,this.numChars=o,this.bitData=t,o<0)throw new RangeError("Invalid argument");this.bitData=t.slice()}static makeBytes(e){let o=[];for(const t of e)i(t,8,o);return new R(R.Mode.BYTE,e.length,o)}static makeNumeric(e){if(!R.isNumeric(e))throw new RangeError("String contains non-numeric characters");let o=[];for(let t=0;t<e.length;){const n=Math.min(e.length-t,3);i(parseInt(e.substring(t,t+n),10),n*3+1,o),t+=n}return new R(R.Mode.NUMERIC,e.length,o)}static makeAlphanumeric(e){if(!R.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");let o=[],t;for(t=0;t+2<=e.length;t+=2){let n=R.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t))*45;n+=R.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t+1)),i(n,11,o)}return t<e.length&&i(R.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)),6,o),new R(R.Mode.ALPHANUMERIC,e.length,o)}static makeSegments(e){return e==""?[]:R.isNumeric(e)?[R.makeNumeric(e)]:R.isAlphanumeric(e)?[R.makeAlphanumeric(e)]:[R.makeBytes(R.toUtf8ByteArray(e))]}static makeEci(e){let o=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)i(e,8,o);else if(e<16384)i(2,2,o),i(e,14,o);else if(e<1e6)i(6,3,o),i(e,21,o);else throw new RangeError("ECI assignment value out of range");return new R(R.Mode.ECI,0,o)}static isNumeric(e){return R.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return R.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,o){let t=0;for(const n of e){const r=n.mode.numCharCountBits(o);if(n.numChars>=1<<r)return 1/0;t+=4+r+n.bitData.length}return t}static toUtf8ByteArray(e){e=encodeURI(e);let o=[];for(let t=0;t<e.length;t++)e.charAt(t)!="%"?o.push(e.charCodeAt(t)):(o.push(parseInt(e.substring(t+1,t+3),16)),t+=2);return o}};d.NUMERIC_REGEX=/^[0-9]*$/,d.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,d.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let w=d;u.QrSegment=d})(O||(O={}));(u=>{(l=>{const i=class{constructor(g,d){this.ordinal=g,this.formatBits=d}};i.LOW=new i(0,1),i.MEDIUM=new i(1,0),i.QUARTILE=new i(2,3),i.HIGH=new i(3,2),l.Ecc=i})(u.QrCode||(u.QrCode={}))})(O||(O={}));(u=>{(l=>{const i=class{constructor(g,d){this.modeBits=g,this.numBitsCharCount=d}numCharCountBits(g){return this.numBitsCharCount[Math.floor((g+7)/17)]}};i.NUMERIC=new i(1,[10,12,14]),i.ALPHANUMERIC=new i(2,[9,11,13]),i.BYTE=new i(4,[8,16,16]),i.KANJI=new i(8,[8,10,12]),i.ECI=new i(7,[0,0,0]),l.Mode=i})(u.QrSegment||(u.QrSegment={}))})(O||(O={}));var L=O;/**
5
+ */var O;(u=>{const l=class m{constructor(e,o,t,n){if(this.version=e,this.errorCorrectionLevel=o,this.modules=[],this.isFunction=[],e<m.MIN_VERSION||e>m.MAX_VERSION)throw new RangeError("Version value out of range");if(n<-1||n>7)throw new RangeError("Mask value out of range");this.size=e*4+17;let r=[];for(let s=0;s<this.size;s++)r.push(!1);for(let s=0;s<this.size;s++)this.modules.push(r.slice()),this.isFunction.push(r.slice());this.drawFunctionPatterns();const a=this.addEccAndInterleave(t);if(this.drawCodewords(a),n==-1){let s=1e9;for(let p=0;p<8;p++){this.applyMask(p),this.drawFormatBits(p);const h=this.getPenaltyScore();h<s&&(n=p,s=h),this.applyMask(p)}}g(0<=n&&n<=7),this.mask=n,this.applyMask(n),this.drawFormatBits(n),this.isFunction=[]}static encodeText(e,o){const t=u.QrSegment.makeSegments(e);return m.encodeSegments(t,o)}static encodeBinary(e,o){const t=u.QrSegment.makeBytes(e);return m.encodeSegments([t],o)}static encodeSegments(e,o,t=1,n=40,r=-1,a=!0){if(!(m.MIN_VERSION<=t&&t<=n&&n<=m.MAX_VERSION)||r<-1||r>7)throw new RangeError("Invalid value");let s,p;for(s=t;;s++){const f=m.getNumDataCodewords(s,o)*8,M=w.getTotalBits(e,s);if(M<=f){p=M;break}if(s>=n)throw new RangeError("Data too long")}for(const f of[m.Ecc.MEDIUM,m.Ecc.QUARTILE,m.Ecc.HIGH])a&&p<=m.getNumDataCodewords(s,f)*8&&(o=f);let h=[];for(const f of e){i(f.mode.modeBits,4,h),i(f.numChars,f.mode.numCharCountBits(s),h);for(const M of f.getData())h.push(M)}g(h.length==p);const x=m.getNumDataCodewords(s,o)*8;g(h.length<=x),i(0,Math.min(4,x-h.length),h),i(0,(8-h.length%8)%8,h),g(h.length%8==0);for(let f=236;h.length<x;f^=253)i(f,8,h);let v=[];for(;v.length*8<h.length;)v.push(0);return h.forEach((f,M)=>v[M>>>3]|=f<<7-(M&7)),new m(s,o,v,r)}getModule(e,o){return 0<=e&&e<this.size&&0<=o&&o<this.size&&this.modules[o][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let t=0;t<this.size;t++)this.setFunctionModule(6,t,t%2==0),this.setFunctionModule(t,6,t%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const e=this.getAlignmentPatternPositions(),o=e.length;for(let t=0;t<o;t++)for(let n=0;n<o;n++)t==0&&n==0||t==0&&n==o-1||t==o-1&&n==0||this.drawAlignmentPattern(e[t],e[n]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const o=this.errorCorrectionLevel.formatBits<<3|e;let t=o;for(let r=0;r<10;r++)t=t<<1^(t>>>9)*1335;const n=(o<<10|t)^21522;g(n>>>15==0);for(let r=0;r<=5;r++)this.setFunctionModule(8,r,c(n,r));this.setFunctionModule(8,7,c(n,6)),this.setFunctionModule(8,8,c(n,7)),this.setFunctionModule(7,8,c(n,8));for(let r=9;r<15;r++)this.setFunctionModule(14-r,8,c(n,r));for(let r=0;r<8;r++)this.setFunctionModule(this.size-1-r,8,c(n,r));for(let r=8;r<15;r++)this.setFunctionModule(8,this.size-15+r,c(n,r));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;const o=this.version<<12|e;g(o>>>18==0);for(let t=0;t<18;t++){const n=c(o,t),r=this.size-11+t%3,a=Math.floor(t/3);this.setFunctionModule(r,a,n),this.setFunctionModule(a,r,n)}}drawFinderPattern(e,o){for(let t=-4;t<=4;t++)for(let n=-4;n<=4;n++){const r=Math.max(Math.abs(n),Math.abs(t)),a=e+n,s=o+t;0<=a&&a<this.size&&0<=s&&s<this.size&&this.setFunctionModule(a,s,r!=2&&r!=4)}}drawAlignmentPattern(e,o){for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)this.setFunctionModule(e+n,o+t,Math.max(Math.abs(n),Math.abs(t))!=1)}setFunctionModule(e,o,t){this.modules[o][e]=t,this.isFunction[o][e]=!0}addEccAndInterleave(e){const o=this.version,t=this.errorCorrectionLevel;if(e.length!=m.getNumDataCodewords(o,t))throw new RangeError("Invalid argument");const n=m.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][o],r=m.ECC_CODEWORDS_PER_BLOCK[t.ordinal][o],a=Math.floor(m.getNumRawDataModules(o)/8),s=n-a%n,p=Math.floor(a/n);let h=[];const x=m.reedSolomonComputeDivisor(r);for(let f=0,M=0;f<n;f++){let P=e.slice(M,M+p-r+(f<s?0:1));M+=P.length;const _=m.reedSolomonComputeRemainder(P,x);f<s&&P.push(0),h.push(P.concat(_))}let v=[];for(let f=0;f<h[0].length;f++)h.forEach((M,P)=>{(f!=p-r||P>=s)&&v.push(M[f])});return g(v.length==a),v}drawCodewords(e){if(e.length!=Math.floor(m.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let o=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let n=0;n<this.size;n++)for(let r=0;r<2;r++){const a=t-r,p=(t+1&2)==0?this.size-1-n:n;!this.isFunction[p][a]&&o<e.length*8&&(this.modules[p][a]=c(e[o>>>3],7-(o&7)),o++)}}g(o==e.length*8)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let o=0;o<this.size;o++)for(let t=0;t<this.size;t++){let n;switch(e){case 0:n=(t+o)%2==0;break;case 1:n=o%2==0;break;case 2:n=t%3==0;break;case 3:n=(t+o)%3==0;break;case 4:n=(Math.floor(t/3)+Math.floor(o/2))%2==0;break;case 5:n=t*o%2+t*o%3==0;break;case 6:n=(t*o%2+t*o%3)%2==0;break;case 7:n=((t+o)%2+t*o%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[o][t]&&n&&(this.modules[o][t]=!this.modules[o][t])}}getPenaltyScore(){let e=0;for(let r=0;r<this.size;r++){let a=!1,s=0,p=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[r][h]==a?(s++,s==5?e+=m.PENALTY_N1:s>5&&e++):(this.finderPenaltyAddHistory(s,p),a||(e+=this.finderPenaltyCountPatterns(p)*m.PENALTY_N3),a=this.modules[r][h],s=1);e+=this.finderPenaltyTerminateAndCount(a,s,p)*m.PENALTY_N3}for(let r=0;r<this.size;r++){let a=!1,s=0,p=[0,0,0,0,0,0,0];for(let h=0;h<this.size;h++)this.modules[h][r]==a?(s++,s==5?e+=m.PENALTY_N1:s>5&&e++):(this.finderPenaltyAddHistory(s,p),a||(e+=this.finderPenaltyCountPatterns(p)*m.PENALTY_N3),a=this.modules[h][r],s=1);e+=this.finderPenaltyTerminateAndCount(a,s,p)*m.PENALTY_N3}for(let r=0;r<this.size-1;r++)for(let a=0;a<this.size-1;a++){const s=this.modules[r][a];s==this.modules[r][a+1]&&s==this.modules[r+1][a]&&s==this.modules[r+1][a+1]&&(e+=m.PENALTY_N2)}let o=0;for(const r of this.modules)o=r.reduce((a,s)=>a+(s?1:0),o);const t=this.size*this.size,n=Math.ceil(Math.abs(o*20-t*10)/t)-1;return g(0<=n&&n<=9),e+=n*m.PENALTY_N4,g(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{const e=Math.floor(this.version/7)+2,o=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2;let t=[6];for(let n=this.size-7;t.length<e;n-=o)t.splice(1,0,n);return t}}static getNumRawDataModules(e){if(e<m.MIN_VERSION||e>m.MAX_VERSION)throw new RangeError("Version number out of range");let o=(16*e+128)*e+64;if(e>=2){const t=Math.floor(e/7)+2;o-=(25*t-10)*t-55,e>=7&&(o-=36)}return g(208<=o&&o<=29648),o}static getNumDataCodewords(e,o){return Math.floor(m.getNumRawDataModules(e)/8)-m.ECC_CODEWORDS_PER_BLOCK[o.ordinal][e]*m.NUM_ERROR_CORRECTION_BLOCKS[o.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");let o=[];for(let n=0;n<e-1;n++)o.push(0);o.push(1);let t=1;for(let n=0;n<e;n++){for(let r=0;r<o.length;r++)o[r]=m.reedSolomonMultiply(o[r],t),r+1<o.length&&(o[r]^=o[r+1]);t=m.reedSolomonMultiply(t,2)}return o}static reedSolomonComputeRemainder(e,o){let t=o.map(n=>0);for(const n of e){const r=n^t.shift();t.push(0),o.forEach((a,s)=>t[s]^=m.reedSolomonMultiply(a,r))}return t}static reedSolomonMultiply(e,o){if(e>>>8||o>>>8)throw new RangeError("Byte out of range");let t=0;for(let n=7;n>=0;n--)t=t<<1^(t>>>7)*285,t^=(o>>>n&1)*e;return g(t>>>8==0),t}finderPenaltyCountPatterns(e){const o=e[1];g(o<=this.size*3);const t=o>0&&e[2]==o&&e[3]==o*3&&e[4]==o&&e[5]==o;return(t&&e[0]>=o*4&&e[6]>=o?1:0)+(t&&e[6]>=o*4&&e[0]>=o?1:0)}finderPenaltyTerminateAndCount(e,o,t){return e&&(this.finderPenaltyAddHistory(o,t),o=0),o+=this.size,this.finderPenaltyAddHistory(o,t),this.finderPenaltyCountPatterns(t)}finderPenaltyAddHistory(e,o){o[0]==0&&(e+=this.size),o.pop(),o.unshift(e)}};l.MIN_VERSION=1,l.MAX_VERSION=40,l.PENALTY_N1=3,l.PENALTY_N2=3,l.PENALTY_N3=40,l.PENALTY_N4=10,l.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],l.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],u.QrCode=l;function i(C,e,o){if(e<0||e>31||C>>>e)throw new RangeError("Value out of range");for(let t=e-1;t>=0;t--)o.push(C>>>t&1)}function c(C,e){return(C>>>e&1)!=0}function g(C){if(!C)throw new Error("Assertion error")}const d=class R{constructor(e,o,t){if(this.mode=e,this.numChars=o,this.bitData=t,o<0)throw new RangeError("Invalid argument");this.bitData=t.slice()}static makeBytes(e){let o=[];for(const t of e)i(t,8,o);return new R(R.Mode.BYTE,e.length,o)}static makeNumeric(e){if(!R.isNumeric(e))throw new RangeError("String contains non-numeric characters");let o=[];for(let t=0;t<e.length;){const n=Math.min(e.length-t,3);i(parseInt(e.substring(t,t+n),10),n*3+1,o),t+=n}return new R(R.Mode.NUMERIC,e.length,o)}static makeAlphanumeric(e){if(!R.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");let o=[],t;for(t=0;t+2<=e.length;t+=2){let n=R.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t))*45;n+=R.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t+1)),i(n,11,o)}return t<e.length&&i(R.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)),6,o),new R(R.Mode.ALPHANUMERIC,e.length,o)}static makeSegments(e){return e==""?[]:R.isNumeric(e)?[R.makeNumeric(e)]:R.isAlphanumeric(e)?[R.makeAlphanumeric(e)]:[R.makeBytes(R.toUtf8ByteArray(e))]}static makeEci(e){let o=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)i(e,8,o);else if(e<16384)i(2,2,o),i(e,14,o);else if(e<1e6)i(6,3,o),i(e,21,o);else throw new RangeError("ECI assignment value out of range");return new R(R.Mode.ECI,0,o)}static isNumeric(e){return R.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return R.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,o){let t=0;for(const n of e){const r=n.mode.numCharCountBits(o);if(n.numChars>=1<<r)return 1/0;t+=4+r+n.bitData.length}return t}static toUtf8ByteArray(e){e=encodeURI(e);let o=[];for(let t=0;t<e.length;t++)e.charAt(t)!="%"?o.push(e.charCodeAt(t)):(o.push(parseInt(e.substring(t+1,t+3),16)),t+=2);return o}};d.NUMERIC_REGEX=/^[0-9]*$/,d.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,d.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let w=d;u.QrSegment=d})(O||(O={}));(u=>{(l=>{const i=class{constructor(g,d){this.ordinal=g,this.formatBits=d}};i.LOW=new i(0,1),i.MEDIUM=new i(1,0),i.QUARTILE=new i(2,3),i.HIGH=new i(3,2),l.Ecc=i})(u.QrCode||(u.QrCode={}))})(O||(O={}));(u=>{(l=>{const i=class{constructor(g,d){this.modeBits=g,this.numBitsCharCount=d}numCharCountBits(g){return this.numBitsCharCount[Math.floor((g+7)/17)]}};i.NUMERIC=new i(1,[10,12,14]),i.ALPHANUMERIC=new i(2,[9,11,13]),i.BYTE=new i(4,[8,16,16]),i.KANJI=new i(8,[8,10,12]),i.ECI=new i(7,[0,0,0]),l.Mode=i})(u.QrSegment||(u.QrSegment={}))})(O||(O={}));var B=O;/**
6
6
  * @license qrcode.react
7
7
  * Copyright (c) Paul O'Shannessy
8
8
  * SPDX-License-Identifier: ISC
9
- */var Ee={L:L.QrCode.Ecc.LOW,M:L.QrCode.Ecc.MEDIUM,Q:L.QrCode.Ecc.QUARTILE,H:L.QrCode.Ecc.HIGH},J=128,ee="L",te="#FFFFFF",oe="#000000",ne=!1,re=1,Ce=4,ye=0,we=.1;function ie(u,l=0){const i=[];return u.forEach(function(c,g){let d=null;c.forEach(function(w,C){if(!w&&d!==null){i.push(`M${d+l} ${g+l}h${C-d}v1H${d+l}z`),d=null;return}if(C===c.length-1){if(!w)return;d===null?i.push(`M${C+l},${g+l} h1v1H${C+l}z`):i.push(`M${d+l},${g+l} h${C+1-d}v1H${d+l}z`);return}w&&d===null&&(d=C)})}),i.join("")}function se(u,l){return u.slice().map((i,c)=>c<l.y||c>=l.y+l.h?i:i.map((g,d)=>d<l.x||d>=l.x+l.w?g:!1))}function Me(u,l,i,c){if(c==null)return null;const g=u.length+i*2,d=Math.floor(l*we),w=g/l,C=(c.width||d)*w,e=(c.height||d)*w,o=c.x==null?u.length/2-C/2:c.x*w,t=c.y==null?u.length/2-e/2:c.y*w,n=c.opacity==null?1:c.opacity;let r=null;if(c.excavate){let s=Math.floor(o),p=Math.floor(t),h=Math.ceil(C+o-s),x=Math.ceil(e+t-p);r={x:s,y:p,w:h,h:x}}const a=c.crossOrigin;return{x:o,y:t,h:e,w:C,excavation:r,opacity:n,crossOrigin:a}}function be(u,l){return l!=null?Math.max(Math.floor(l),0):u?Ce:ye}function le({value:u,level:l,minVersion:i,includeMargin:c,marginSize:g,imageSettings:d,size:w,boostLevel:C}){let e=y.useMemo(()=>{const s=(Array.isArray(u)?u:[u]).reduce((p,h)=>(p.push(...L.QrSegment.makeSegments(h)),p),[]);return L.QrCode.encodeSegments(s,Ee[l],i,void 0,void 0,C)},[u,l,i,C]);const{cells:o,margin:t,numCells:n,calculatedImageSettings:r}=y.useMemo(()=>{let a=e.getModules();const s=be(c,g),p=a.length+s*2,h=Me(a,w,s,d);return{cells:a,margin:s,numCells:p,calculatedImageSettings:h}},[e,w,d,c,g]);return{qrcode:e,margin:t,cells:o,numCells:n,calculatedImageSettings:r}}var Re=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),ve=y.forwardRef(function(l,i){const c=l,{value:g,size:d=J,level:w=ee,bgColor:C=te,fgColor:e=oe,includeMargin:o=ne,minVersion:t=re,boostLevel:n,marginSize:r,imageSettings:a}=c,p=H(c,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:h}=p,x=H(p,["style"]),v=a==null?void 0:a.src,f=y.useRef(null),M=y.useRef(null),P=y.useCallback(A=>{f.current=A,typeof i=="function"?i(A):i&&(i.current=A)},[i]),[_,k]=y.useState(!1),{margin:N,cells:B,numCells:D,calculatedImageSettings:S}=le({value:g,level:w,minVersion:t,boostLevel:n,includeMargin:o,marginSize:r,imageSettings:a,size:d});y.useEffect(()=>{if(f.current!=null){const A=f.current,I=A.getContext("2d");if(!I)return;let $=B;const F=M.current,G=S!=null&&F!==null&&F.complete&&F.naturalHeight!==0&&F.naturalWidth!==0;G&&S.excavation!=null&&($=se(B,S.excavation));const V=window.devicePixelRatio||1;A.height=A.width=d*V;const Y=d/D*V;I.scale(Y,Y),I.fillStyle=C,I.fillRect(0,0,D,D),I.fillStyle=e,Re?I.fill(new Path2D(ie($,N))):B.forEach(function(ce,ue){ce.forEach(function(he,de){he&&I.fillRect(de+N,ue+N,1,1)})}),S&&(I.globalAlpha=S.opacity),G&&I.drawImage(F,S.x+N,S.y+N,S.w,S.h)}}),y.useEffect(()=>{k(!1)},[v]);const z=Q({height:d,width:d},h);let T=null;return v!=null&&(T=y.createElement("img",{src:v,key:v,style:{display:"none"},onLoad:()=>{k(!0)},ref:M,crossOrigin:S==null?void 0:S.crossOrigin})),y.createElement(y.Fragment,null,y.createElement("canvas",Q({style:z,height:d,width:d,ref:P,role:"img"},x)),T)});ve.displayName="QRCodeCanvas";var ae=y.forwardRef(function(l,i){const c=l,{value:g,size:d=J,level:w=ee,bgColor:C=te,fgColor:e=oe,includeMargin:o=ne,minVersion:t=re,boostLevel:n,title:r,marginSize:a,imageSettings:s}=c,p=H(c,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:h,cells:x,numCells:v,calculatedImageSettings:f}=le({value:g,level:w,minVersion:t,boostLevel:n,includeMargin:o,marginSize:a,imageSettings:s,size:d});let M=x,P=null;s!=null&&f!=null&&(f.excavation!=null&&(M=se(x,f.excavation)),P=y.createElement("image",{href:s.src,height:f.h,width:f.w,x:f.x+h,y:f.y+h,preserveAspectRatio:"none",opacity:f.opacity,crossOrigin:f.crossOrigin}));const _=ie(M,h);return y.createElement("svg",Q({height:d,width:d,viewBox:`0 0 ${v} ${v}`,ref:i,role:"img"},p),!!r&&y.createElement("title",null,r),y.createElement("path",{fill:C,d:`M0,0 h${v}v${v}H0z`,shapeRendering:"crispEdges"}),y.createElement("path",{fill:e,d:_,shapeRendering:"crispEdges"}),P)});ae.displayName="QRCodeSVG";const Ae={dialog_title:"2要素認証の設定",step1:"手順1",auth_app:"認証アプリ",step1_description:"を携帯電話で開き、QRコードをスキャンします (QRコードの下にあるシークレットキーを認証アプリに手動で入力してもかまいません)。",help_dialog_title:"認証アプリについて",help_dialog_description:`
9
+ */var Ee={L:B.QrCode.Ecc.LOW,M:B.QrCode.Ecc.MEDIUM,Q:B.QrCode.Ecc.QUARTILE,H:B.QrCode.Ecc.HIGH},J=128,ee="L",te="#FFFFFF",oe="#000000",ne=!1,re=1,Ce=4,ye=0,we=.1;function ie(u,l=0){const i=[];return u.forEach(function(c,g){let d=null;c.forEach(function(w,C){if(!w&&d!==null){i.push(`M${d+l} ${g+l}h${C-d}v1H${d+l}z`),d=null;return}if(C===c.length-1){if(!w)return;d===null?i.push(`M${C+l},${g+l} h1v1H${C+l}z`):i.push(`M${d+l},${g+l} h${C+1-d}v1H${d+l}z`);return}w&&d===null&&(d=C)})}),i.join("")}function se(u,l){return u.slice().map((i,c)=>c<l.y||c>=l.y+l.h?i:i.map((g,d)=>d<l.x||d>=l.x+l.w?g:!1))}function Me(u,l,i,c){if(c==null)return null;const g=u.length+i*2,d=Math.floor(l*we),w=g/l,C=(c.width||d)*w,e=(c.height||d)*w,o=c.x==null?u.length/2-C/2:c.x*w,t=c.y==null?u.length/2-e/2:c.y*w,n=c.opacity==null?1:c.opacity;let r=null;if(c.excavate){let s=Math.floor(o),p=Math.floor(t),h=Math.ceil(C+o-s),x=Math.ceil(e+t-p);r={x:s,y:p,w:h,h:x}}const a=c.crossOrigin;return{x:o,y:t,h:e,w:C,excavation:r,opacity:n,crossOrigin:a}}function be(u,l){return l!=null?Math.max(Math.floor(l),0):u?Ce:ye}function le({value:u,level:l,minVersion:i,includeMargin:c,marginSize:g,imageSettings:d,size:w,boostLevel:C}){let e=y.useMemo(()=>{const s=(Array.isArray(u)?u:[u]).reduce((p,h)=>(p.push(...B.QrSegment.makeSegments(h)),p),[]);return B.QrCode.encodeSegments(s,Ee[l],i,void 0,void 0,C)},[u,l,i,C]);const{cells:o,margin:t,numCells:n,calculatedImageSettings:r}=y.useMemo(()=>{let a=e.getModules();const s=be(c,g),p=a.length+s*2,h=Me(a,w,s,d);return{cells:a,margin:s,numCells:p,calculatedImageSettings:h}},[e,w,d,c,g]);return{qrcode:e,margin:t,cells:o,numCells:n,calculatedImageSettings:r}}var Re=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),ve=y.forwardRef(function(l,i){const c=l,{value:g,size:d=J,level:w=ee,bgColor:C=te,fgColor:e=oe,includeMargin:o=ne,minVersion:t=re,boostLevel:n,marginSize:r,imageSettings:a}=c,p=H(c,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:h}=p,x=H(p,["style"]),v=a==null?void 0:a.src,f=y.useRef(null),M=y.useRef(null),P=y.useCallback(A=>{f.current=A,typeof i=="function"?i(A):i&&(i.current=A)},[i]),[_,k]=y.useState(!1),{margin:N,cells:L,numCells:D,calculatedImageSettings:S}=le({value:g,level:w,minVersion:t,boostLevel:n,includeMargin:o,marginSize:r,imageSettings:a,size:d});y.useEffect(()=>{if(f.current!=null){const A=f.current,I=A.getContext("2d");if(!I)return;let $=L;const F=M.current,G=S!=null&&F!==null&&F.complete&&F.naturalHeight!==0&&F.naturalWidth!==0;G&&S.excavation!=null&&($=se(L,S.excavation));const V=window.devicePixelRatio||1;A.height=A.width=d*V;const Y=d/D*V;I.scale(Y,Y),I.fillStyle=C,I.fillRect(0,0,D,D),I.fillStyle=e,Re?I.fill(new Path2D(ie($,N))):L.forEach(function(ce,ue){ce.forEach(function(he,de){he&&I.fillRect(de+N,ue+N,1,1)})}),S&&(I.globalAlpha=S.opacity),G&&I.drawImage(F,S.x+N,S.y+N,S.w,S.h)}}),y.useEffect(()=>{k(!1)},[v]);const z=Q({height:d,width:d},h);let T=null;return v!=null&&(T=y.createElement("img",{src:v,key:v,style:{display:"none"},onLoad:()=>{k(!0)},ref:M,crossOrigin:S==null?void 0:S.crossOrigin})),y.createElement(y.Fragment,null,y.createElement("canvas",Q({style:z,height:d,width:d,ref:P,role:"img"},x)),T)});ve.displayName="QRCodeCanvas";var ae=y.forwardRef(function(l,i){const c=l,{value:g,size:d=J,level:w=ee,bgColor:C=te,fgColor:e=oe,includeMargin:o=ne,minVersion:t=re,boostLevel:n,title:r,marginSize:a,imageSettings:s}=c,p=H(c,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:h,cells:x,numCells:v,calculatedImageSettings:f}=le({value:g,level:w,minVersion:t,boostLevel:n,includeMargin:o,marginSize:a,imageSettings:s,size:d});let M=x,P=null;s!=null&&f!=null&&(f.excavation!=null&&(M=se(x,f.excavation)),P=y.createElement("image",{href:s.src,height:f.h,width:f.w,x:f.x+h,y:f.y+h,preserveAspectRatio:"none",opacity:f.opacity,crossOrigin:f.crossOrigin}));const _=ie(M,h);return y.createElement("svg",Q({height:d,width:d,viewBox:`0 0 ${v} ${v}`,ref:i,role:"img"},p),!!r&&y.createElement("title",null,r),y.createElement("path",{fill:C,d:`M0,0 h${v}v${v}H0z`,shapeRendering:"crispEdges"}),y.createElement("path",{fill:e,d:_,shapeRendering:"crispEdges"}),P)});ae.displayName="QRCodeSVG";const Ae={dialog_title:"2要素認証の設定",step1:"手順1",auth_app:"認証アプリ",step1_description:"を携帯電話で開き、QRコードをスキャンします (QRコードの下にあるシークレットキーを認証アプリに手動で入力してもかまいません)。",help_dialog_title:"認証アプリについて",help_dialog_description:`
10
10
  お使いの携帯電話を用いて追加の認証を行います。
11
11
  2段階の認証を行うことで、セキュリティを高めることができます。
12
12
 
@@ -15,5 +15,5 @@
15
15
 
16
16
  使えるアプリ: Google Authenticatorや Microsoft Authenticator、Authy 等
17
17
  アプリのインストール方法は、各アプリの公式サイトをご確認ください。`,step2:"手順2",step2_description:"認証アプリに表示されている6桁のコードを入力してください。(30秒ごとに更新されるため、最新のコードをご入力ください)。",skip_note:"※スキップした場合、後から設定より変更可能です。",close:"閉じる",skip:"スキップする",cancel:"戻る",submit:"送信",two_fa_complete:"2要素認証設定の完了",backup_code_info:"バックアップコードについて",backup_code_description:`携帯電話の紛失時や、機種変更時には以下のバックアップコードを使用することでログイン可能です。各コードは1度しか使用することはできませんが。万が一に備えて、これらのコードをすぐに使える安全な場所に保管しておいてください。
18
- (1度しか表示されません)`},xe=u=>{var z;const{open:l,qrUrl:i,secretKey:c,onCloseDialog:g,onSubmit:d,showSkipButton:w=!1,dictionary:C}=u,e={...Ae,...C},{control:o,handleSubmit:t,reset:n,setError:r,watch:a,formState:{errors:s}}=fe.useForm({defaultValues:{code:Array(6).fill("")},mode:"onSubmit"}),[p,h]=y.useState(!1),[x,v]=y.useState(""),[f,M]=y.useState(!1),[P,_]=y.useState(!1),k=T=>{r("root.server",{type:"serverError",message:T})};y.useEffect(()=>{l&&(n({code:Array(6).fill("")}),h(!1),M(!1))},[l,n]);const N=y.useCallback(async()=>{const T=a("code").join("");M(!0);try{const A=await d(T);A!==void 0&&A!==""&&(v(A),h(!0))}catch(A){n({code:Array(6).fill("")}),k(A instanceof Error?A.message:"予期せぬエラーが発生しました")}finally{M(!1)}},[d,n,a]),B=y.useCallback((T,A)=>{(w||f)&&A==="backdropClick"||g("cancel")},[w,f,g]),D=()=>{_(!0)},S=()=>{_(!1)};return E.jsxs(b.Dialog,{open:l,onClose:B,scroll:"paper","aria-labelledby":"scroll-dialog-title","aria-describedby":"scroll-dialog-description",children:[E.jsx(b.DialogTitle,{id:"scroll-dialog-title",children:e.dialog_title}),E.jsxs("form",{onSubmit:t(N),children:[E.jsx(b.DialogContent,{dividers:!0,children:p?E.jsxs(b.Box,{sx:{maxWidth:"400px",margin:"0 auto",textAlign:"center"},children:[E.jsx(W.CheckCircleOutline,{color:"success",sx:{fontSize:100}}),E.jsx(b.Typography,{variant:"h6",children:e.two_fa_complete}),E.jsx(b.Divider,{sx:{margin:"16px 0"}}),E.jsx(b.Typography,{variant:"h6",children:e.backup_code_info}),E.jsx(b.Typography,{variant:"body2",align:"left",sx:{marginTop:"8px",whiteSpace:"pre-line"},children:e.backup_code_description}),E.jsx(X.CopyableBox,{text:x})]}):E.jsxs(b.Box,{sx:{maxWidth:"400px",margin:"0 auto"},children:[E.jsx(b.Typography,{variant:"body1",align:"left",sx:{fontWeight:"bold"},children:e.step1}),E.jsxs(b.Typography,{"data-testid":"step1-description",variant:"body2",align:"left",sx:{marginTop:"8px"},children:[E.jsx(b.Link,{component:"button",variant:"body2",type:"button",onClick:D,children:e.auth_app}),E.jsx(b.IconButton,{"aria-label":"help",size:"small",type:"button",onClick:D,sx:{padding:0},children:E.jsx(W.HelpOutline,{fontSize:"inherit",color:"action"})}),e.step1_description]}),E.jsxs(b.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",margin:"16px 0",padding:"16px",border:"1px solid rgba(0, 0, 0, 0.12)",borderRadius:"8px",wordBreak:"break-word"},children:[E.jsx(ae,{value:i}),E.jsxs(b.Typography,{variant:"body2",sx:{marginTop:"16px"},children:[c,E.jsx(X.CopyIcon,{text:c})]})]}),E.jsx(b.Typography,{variant:"body1",align:"left",sx:{fontWeight:"bold"},children:e.step2}),E.jsx(b.Typography,{variant:"body2",align:"left",sx:{marginTop:"8px"},children:e.step2_description}),E.jsxs(b.Box,{sx:{padding:"16px 0"},children:[E.jsxs(b.Box,{mb:2,children:[E.jsx(ge.TwoFaInputController,{control:o,name:"code",defaultValue:Array(6).fill(""),onSubmit:t(N),errors:s}),((z=s.root)==null?void 0:z.server)&&E.jsx(b.Typography,{variant:"body2",color:"error",align:"center",marginTop:"5px",children:s.root.server.message})]}),w&&E.jsx(b.Typography,{variant:"caption",align:"center",display:"block",color:"textSecondary",sx:{marginTop:"10px"},children:e.skip_note})]})]})}),E.jsxs(b.DialogActions,{children:[E.jsx(U.Button,{type:"button",color:"normal",disabled:f,onClick:()=>g(p?"cancel":w?"skip":"cancel"),children:p?e.close:w?e.skip:e.cancel}),!p&&E.jsx(U.Button,{type:"submit",variant:"contained",color:"primary",sx:{marginLeft:"8px"},disabled:f,children:e.submit})]})]}),E.jsx(pe.ScrollableDialog,{open:P,onCloseDialog:S,dialogTitle:e.help_dialog_title,dialogContent:E.jsx(b.Typography,{variant:"body1",id:"help-dialog-description",sx:{whiteSpace:"pre-line"},children:e.help_dialog_description}),dialogActions:E.jsx(U.Button,{onClick:S,color:"primary",children:e.close})})]})};exports.TwoFaDialog=xe;
18
+ (1度しか表示されません)`},xe=u=>{var z;const{open:l,qrUrl:i,secretKey:c,onCloseDialog:g,onSubmit:d,showSkipButton:w=!1,dictionary:C}=u,e={...Ae,...C},{control:o,handleSubmit:t,reset:n,setError:r,watch:a,formState:{errors:s}}=fe.useForm({defaultValues:{code:Array(6).fill("")},mode:"onSubmit"}),[p,h]=y.useState(!1),[x,v]=y.useState(""),[f,M]=y.useState(!1),[P,_]=y.useState(!1),k=T=>{r("root.server",{type:"serverError",message:T})};y.useEffect(()=>{l&&(n({code:Array(6).fill("")}),h(!1),M(!1))},[l,n]);const N=y.useCallback(async()=>{const T=a("code").join("");M(!0);try{const A=await d(T);A!==void 0&&A!==""&&(v(A),h(!0))}catch(A){n({code:Array(6).fill("")}),k(A instanceof Error?A.message:"予期せぬエラーが発生しました")}finally{M(!1)}},[d,n,a]),L=y.useCallback((T,A)=>{(w||f)&&A==="backdropClick"||g("cancel")},[w,f,g]),D=()=>{_(!0)},S=()=>{_(!1)};return E.jsxs(b.Dialog,{open:l,onClose:L,scroll:"paper","aria-labelledby":"scroll-dialog-title","aria-describedby":"scroll-dialog-description",children:[E.jsx(b.DialogTitle,{id:"scroll-dialog-title",children:e.dialog_title}),E.jsxs("form",{onSubmit:t(N),children:[E.jsx(b.DialogContent,{dividers:!0,children:p?E.jsxs(b.Box,{sx:{maxWidth:"400px",margin:"0 auto",textAlign:"center"},children:[E.jsx(W.CheckCircleOutline,{color:"success",sx:{fontSize:100}}),E.jsx(b.Typography,{variant:"h6",children:e.two_fa_complete}),E.jsx(b.Divider,{sx:{margin:"16px 0"}}),E.jsx(b.Typography,{variant:"h6",children:e.backup_code_info}),E.jsx(b.Typography,{variant:"body2",align:"left",sx:{marginTop:"8px",whiteSpace:"pre-line"},children:e.backup_code_description}),E.jsx(X.CopyableBox,{text:x})]}):E.jsxs(b.Box,{sx:{maxWidth:"400px",margin:"0 auto"},children:[E.jsx(b.Typography,{variant:"body1",align:"left",sx:{fontWeight:"bold"},children:e.step1}),E.jsxs(b.Typography,{"data-testid":"step1-description",variant:"body2",align:"left",sx:{marginTop:"8px"},children:[E.jsx(b.Link,{component:"button",variant:"body2",type:"button",onClick:D,children:e.auth_app}),E.jsx(b.IconButton,{"aria-label":"help",size:"small",type:"button",onClick:D,sx:{padding:0},children:E.jsx(W.HelpOutline,{fontSize:"inherit",color:"action"})}),e.step1_description]}),E.jsxs(b.Box,{sx:{display:"flex",flexDirection:"column",alignItems:"center",margin:"16px 0",padding:"16px",border:"1px solid rgba(0, 0, 0, 0.12)",borderRadius:"8px",wordBreak:"break-word"},children:[E.jsx(ae,{value:i}),E.jsxs(b.Typography,{variant:"body2",sx:{marginTop:"16px"},children:[c,E.jsx(X.CopyIcon,{text:c})]})]}),E.jsx(b.Typography,{variant:"body1",align:"left",sx:{fontWeight:"bold"},children:e.step2}),E.jsx(b.Typography,{variant:"body2",align:"left",sx:{marginTop:"8px"},children:e.step2_description}),E.jsxs(b.Box,{sx:{padding:"16px 0"},children:[E.jsxs(b.Box,{mb:2,children:[E.jsx(ge.TwoFaInputController,{control:o,name:"code",defaultValue:Array(6).fill(""),onSubmit:t(N),errors:s}),((z=s.root)==null?void 0:z.server)&&E.jsx(b.Typography,{variant:"body2",color:"error",align:"center",marginTop:"5px",children:s.root.server.message})]}),w&&E.jsx(b.Typography,{variant:"caption",align:"center",display:"block",color:"textSecondary",sx:{marginTop:"10px"},children:e.skip_note})]})]})}),E.jsxs(b.DialogActions,{children:[E.jsx(U.Button,{type:"button",color:"normal",disabled:f,onClick:()=>g(p?"cancel":w?"skip":"cancel"),children:p?e.close:w?e.skip:e.cancel}),!p&&E.jsx(U.Button,{type:"submit",variant:"contained",color:"primary",sx:{marginLeft:"8px"},disabled:f,children:e.submit})]})]}),E.jsx(pe.ScrollableDialog,{open:P,onCloseDialog:S,dialogTitle:e.help_dialog_title,dialogContent:E.jsx(b.Box,{component:"div",id:"help-dialog-description",sx:{whiteSpace:"pre-line"},children:e.help_dialog_description}),dialogActions:E.jsx(U.Button,{onClick:S,color:"primary",children:e.close})})]})};exports.TwoFaDialog=xe;
19
19
  //# sourceMappingURL=index.cjs.js.map