@jigowatts/jigowatts-ui 1.2.1 → 2.0.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.
- package/dist/assets/index8.css +1 -1
- package/dist/components/Button/index.cjs.js.map +1 -1
- package/dist/components/Button/index.es.js.map +1 -1
- package/dist/components/Button/index.test.cjs.js +1 -1
- package/dist/components/Button/index.test.cjs.js.map +1 -1
- package/dist/components/Button/index.test.es.js +1 -1
- package/dist/components/Button/index.test.es.js.map +1 -1
- package/dist/components/Card/index.cjs.js.map +1 -1
- package/dist/components/Card/index.es.js.map +1 -1
- package/dist/components/Card/index.test.cjs.js +1 -1
- package/dist/components/Card/index.test.cjs.js.map +1 -1
- package/dist/components/Card/index.test.es.js +1 -1
- package/dist/components/Card/index.test.es.js.map +1 -1
- package/dist/components/CardWithTitle/index.cjs.js +1 -1
- package/dist/components/CardWithTitle/index.cjs.js.map +1 -1
- package/dist/components/CardWithTitle/index.d.ts +6 -0
- package/dist/components/CardWithTitle/index.es.js +20 -13
- package/dist/components/CardWithTitle/index.es.js.map +1 -1
- package/dist/components/CardWithTitle/index.test.cjs.js +1 -1
- package/dist/components/CardWithTitle/index.test.cjs.js.map +1 -1
- package/dist/components/CardWithTitle/index.test.es.js +2 -2
- package/dist/components/CardWithTitle/index.test.es.js.map +1 -1
- package/dist/components/CustomLink/index.cjs.js.map +1 -1
- package/dist/components/CustomLink/index.es.js.map +1 -1
- package/dist/components/CustomLink/index.test.cjs.js +1 -1
- package/dist/components/CustomLink/index.test.cjs.js.map +1 -1
- package/dist/components/CustomLink/index.test.es.js +2 -2
- package/dist/components/CustomLink/index.test.es.js.map +1 -1
- package/dist/components/DataTable/index.cjs.js.map +1 -1
- package/dist/components/DataTable/index.es.js.map +1 -1
- package/dist/components/DataTable/index.test.cjs.js +1 -1
- package/dist/components/DataTable/index.test.cjs.js.map +1 -1
- package/dist/components/DataTable/index.test.es.js +3 -3
- package/dist/components/DataTable/index.test.es.js.map +1 -1
- package/dist/components/DatePickerController/index.cjs.js.map +1 -1
- package/dist/components/DatePickerController/index.d.ts +1 -0
- package/dist/components/DatePickerController/index.es.js.map +1 -1
- package/dist/components/DatePickerController/index.test.cjs.js +1 -1
- package/dist/components/DatePickerController/index.test.cjs.js.map +1 -1
- package/dist/components/DatePickerController/index.test.es.js +1 -1
- package/dist/components/DatePickerController/index.test.es.js.map +1 -1
- package/dist/components/ErrorMessage/index.cjs.js.map +1 -1
- package/dist/components/ErrorMessage/index.es.js.map +1 -1
- package/dist/components/ErrorMessage/index.test.cjs.js +1 -1
- package/dist/components/ErrorMessage/index.test.cjs.js.map +1 -1
- package/dist/components/ErrorMessage/index.test.es.js +2 -2
- package/dist/components/ErrorMessage/index.test.es.js.map +1 -1
- package/dist/components/EvseStateLabel/index.cjs.js.map +1 -1
- package/dist/components/EvseStateLabel/index.es.js.map +1 -1
- package/dist/components/FlexButtons/index.cjs.js.map +1 -1
- package/dist/components/FlexButtons/index.es.js.map +1 -1
- package/dist/components/FlexButtons/index.test.cjs.js +1 -1
- package/dist/components/FlexButtons/index.test.cjs.js.map +1 -1
- package/dist/components/FlexButtons/index.test.es.js +2 -2
- package/dist/components/FlexButtons/index.test.es.js.map +1 -1
- package/dist/components/Form/index.cjs.js.map +1 -1
- package/dist/components/Form/index.es.js.map +1 -1
- package/dist/components/Form/index.test.cjs.js +1 -1
- package/dist/components/Form/index.test.cjs.js.map +1 -1
- package/dist/components/Form/index.test.es.js +2 -2
- package/dist/components/Form/index.test.es.js.map +1 -1
- package/dist/components/FormItem/index.cjs.js.map +1 -1
- package/dist/components/FormItem/index.es.js.map +1 -1
- package/dist/components/FormItem/index.test.cjs.js +1 -1
- package/dist/components/FormItem/index.test.cjs.js.map +1 -1
- package/dist/components/FormItem/index.test.es.js +2 -2
- package/dist/components/FormItem/index.test.es.js.map +1 -1
- package/dist/components/FormTitle/index.cjs.js.map +1 -1
- package/dist/components/FormTitle/index.es.js.map +1 -1
- package/dist/components/FormTitle/index.test.cjs.js +1 -1
- package/dist/components/FormTitle/index.test.cjs.js.map +1 -1
- package/dist/components/FormTitle/index.test.es.js +2 -2
- package/dist/components/FormTitle/index.test.es.js.map +1 -1
- package/dist/components/HStack/index.cjs.js.map +1 -1
- package/dist/components/HStack/index.es.js.map +1 -1
- package/dist/components/HStack/index.test.cjs.js +1 -1
- package/dist/components/HStack/index.test.cjs.js.map +1 -1
- package/dist/components/HStack/index.test.es.js +2 -2
- package/dist/components/HStack/index.test.es.js.map +1 -1
- package/dist/components/HtmlRenderer/index.cjs.js +1 -1
- package/dist/components/HtmlRenderer/index.es.js +1 -1
- package/dist/components/HtmlRenderer/index.test.cjs.js +1 -1
- package/dist/components/HtmlRenderer/index.test.cjs.js.map +1 -1
- package/dist/components/HtmlRenderer/index.test.es.js +2 -2
- package/dist/components/HtmlRenderer/index.test.es.js.map +1 -1
- package/dist/components/Input/index.cjs.js.map +1 -1
- package/dist/components/Input/index.es.js.map +1 -1
- package/dist/components/Input/index.test.cjs.js +1 -1
- package/dist/components/Input/index.test.cjs.js.map +1 -1
- package/dist/components/Input/index.test.es.js +1 -1
- package/dist/components/Input/index.test.es.js.map +1 -1
- package/dist/components/InputController/index.cjs.js.map +1 -1
- package/dist/components/InputController/index.es.js.map +1 -1
- package/dist/components/InputController/index.test.cjs.js +1 -1
- package/dist/components/InputController/index.test.cjs.js.map +1 -1
- package/dist/components/InputController/index.test.es.js +1 -1
- package/dist/components/InputController/index.test.es.js.map +1 -1
- package/dist/components/InputGroup/index.cjs.js.map +1 -1
- package/dist/components/InputGroup/index.es.js.map +1 -1
- package/dist/components/InputGroup/index.test.cjs.js +1 -1
- package/dist/components/InputGroup/index.test.cjs.js.map +1 -1
- package/dist/components/InputGroup/index.test.es.js +2 -2
- package/dist/components/InputGroup/index.test.es.js.map +1 -1
- package/dist/components/Label/index.cjs.js.map +1 -1
- package/dist/components/Label/index.es.js.map +1 -1
- package/dist/components/Label/index.test.cjs.js +1 -1
- package/dist/components/Label/index.test.cjs.js.map +1 -1
- package/dist/components/Label/index.test.es.js +2 -2
- package/dist/components/Label/index.test.es.js.map +1 -1
- package/dist/components/LabeledContent/index.cjs.js.map +1 -1
- package/dist/components/LabeledContent/index.es.js.map +1 -1
- package/dist/components/LabeledContent/index.test.cjs.js +1 -1
- package/dist/components/LabeledContent/index.test.cjs.js.map +1 -1
- package/dist/components/LabeledContent/index.test.es.js +1 -1
- package/dist/components/LabeledContent/index.test.es.js.map +1 -1
- package/dist/components/LoadingOverlay/index.cjs.js.map +1 -1
- package/dist/components/LoadingOverlay/index.es.js.map +1 -1
- package/dist/components/LoadingOverlay/index.test.cjs.js +1 -1
- package/dist/components/LoadingOverlay/index.test.cjs.js.map +1 -1
- package/dist/components/LoadingOverlay/index.test.es.js +2 -2
- package/dist/components/LoadingOverlay/index.test.es.js.map +1 -1
- package/dist/components/Map/index.cjs.js +2 -2
- package/dist/components/Map/index.cjs.js.map +1 -1
- package/dist/components/Map/index.es.js +709 -716
- package/dist/components/Map/index.es.js.map +1 -1
- package/dist/components/MaxWidthContainer/index.cjs.js.map +1 -1
- package/dist/components/MaxWidthContainer/index.es.js.map +1 -1
- package/dist/components/MaxWidthContainer/index.test.cjs.js +1 -1
- package/dist/components/MaxWidthContainer/index.test.cjs.js.map +1 -1
- package/dist/components/MaxWidthContainer/index.test.es.js +2 -2
- package/dist/components/MaxWidthContainer/index.test.es.js.map +1 -1
- package/dist/components/NumericFieldController/index.cjs.js.map +1 -1
- package/dist/components/NumericFieldController/index.d.ts +1 -0
- package/dist/components/NumericFieldController/index.es.js.map +1 -1
- package/dist/components/NumericFieldController/index.test.cjs.js +1 -1
- package/dist/components/NumericFieldController/index.test.cjs.js.map +1 -1
- package/dist/components/NumericFieldController/index.test.es.js +1 -1
- package/dist/components/NumericFieldController/index.test.es.js.map +1 -1
- package/dist/components/OfflineLabel/index.cjs.js.map +1 -1
- package/dist/components/OfflineLabel/index.es.js.map +1 -1
- package/dist/components/PageSizeSelector/index.cjs.js.map +1 -1
- package/dist/components/PageSizeSelector/index.es.js.map +1 -1
- package/dist/components/Pagination/index.cjs.js +2 -2
- package/dist/components/Pagination/index.cjs.js.map +1 -1
- package/dist/components/Pagination/index.es.js +17 -17
- package/dist/components/Pagination/index.es.js.map +1 -1
- package/dist/components/Pagination/index.test.cjs.js +1 -1
- package/dist/components/Pagination/index.test.cjs.js.map +1 -1
- package/dist/components/Pagination/index.test.es.js +1 -1
- package/dist/components/Pagination/index.test.es.js.map +1 -1
- package/dist/components/PasswordInputController/index.cjs.js.map +1 -1
- package/dist/components/PasswordInputController/index.es.js.map +1 -1
- package/dist/components/PasswordInputController/index.test.cjs.js +1 -1
- package/dist/components/PasswordInputController/index.test.cjs.js.map +1 -1
- package/dist/components/PasswordInputController/index.test.es.js +1 -1
- package/dist/components/PasswordInputController/index.test.es.js.map +1 -1
- package/dist/components/RadioButton/index.test.cjs.js +1 -1
- package/dist/components/RadioButton/index.test.cjs.js.map +1 -1
- package/dist/components/RadioButton/index.test.es.js +2 -2
- package/dist/components/RadioButton/index.test.es.js.map +1 -1
- package/dist/components/RadioGroupController/index.cjs.js.map +1 -1
- package/dist/components/RadioGroupController/index.es.js.map +1 -1
- package/dist/components/RadioGroupController/index.test.cjs.js +1 -1
- package/dist/components/RadioGroupController/index.test.cjs.js.map +1 -1
- package/dist/components/RadioGroupController/index.test.es.js +1 -1
- package/dist/components/RadioGroupController/index.test.es.js.map +1 -1
- package/dist/components/RangeDatePicker/index.cjs.js.map +1 -1
- package/dist/components/RangeDatePicker/index.es.js.map +1 -1
- package/dist/components/RangeDatePickerController/index.cjs.js.map +1 -1
- package/dist/components/RangeDatePickerController/index.es.js.map +1 -1
- package/dist/components/RangeDatePickerController/index.test.cjs.js +1 -1
- package/dist/components/RangeDatePickerController/index.test.cjs.js.map +1 -1
- package/dist/components/RangeDatePickerController/index.test.es.js +1 -1
- package/dist/components/RangeDatePickerController/index.test.es.js.map +1 -1
- package/dist/components/ReportCard/index.cjs.js.map +1 -1
- package/dist/components/ReportCard/index.es.js.map +1 -1
- package/dist/components/ReportCard/index.test.cjs.js +1 -1
- package/dist/components/ReportCard/index.test.cjs.js.map +1 -1
- package/dist/components/ReportCard/index.test.es.js +1 -1
- package/dist/components/ReportCard/index.test.es.js.map +1 -1
- package/dist/components/ReportChart/index.cjs.js +1 -1
- package/dist/components/ReportChart/index.cjs.js.map +1 -1
- package/dist/components/ReportChart/index.es.js +26 -33
- package/dist/components/ReportChart/index.es.js.map +1 -1
- package/dist/components/ReportChartMulti/index.cjs.js.map +1 -1
- package/dist/components/ReportChartMulti/index.es.js.map +1 -1
- package/dist/components/ReportChartMulti/index.test.cjs.js +1 -1
- package/dist/components/ReportChartMulti/index.test.cjs.js.map +1 -1
- package/dist/components/ReportChartMulti/index.test.es.js +1 -1
- package/dist/components/ReportChartMulti/index.test.es.js.map +1 -1
- package/dist/components/ScrollableDialog/index.cjs.js.map +1 -1
- package/dist/components/ScrollableDialog/index.es.js.map +1 -1
- package/dist/components/ScrollableDialog/index.test.cjs.js +1 -1
- package/dist/components/ScrollableDialog/index.test.cjs.js.map +1 -1
- package/dist/components/ScrollableDialog/index.test.es.js +1 -1
- package/dist/components/ScrollableDialog/index.test.es.js.map +1 -1
- package/dist/components/SearchForm/index.cjs.js.map +1 -1
- package/dist/components/SearchForm/index.es.js.map +1 -1
- package/dist/components/SelectBox/index.test.cjs.js +1 -1
- package/dist/components/SelectBox/index.test.cjs.js.map +1 -1
- package/dist/components/SelectBox/index.test.es.js +1 -1
- package/dist/components/SelectBox/index.test.es.js.map +1 -1
- package/dist/components/SelectBoxController/index.cjs.js.map +1 -1
- package/dist/components/SelectBoxController/index.es.js.map +1 -1
- package/dist/components/SelectBoxController/index.test.cjs.js +1 -1
- package/dist/components/SelectBoxController/index.test.cjs.js.map +1 -1
- package/dist/components/SelectBoxController/index.test.es.js +1 -1
- package/dist/components/SelectBoxController/index.test.es.js.map +1 -1
- package/dist/components/SideMenu/index.cjs.js.map +1 -1
- package/dist/components/SideMenu/index.es.js.map +1 -1
- package/dist/components/SideMenu/index.test.cjs.js +1 -1
- package/dist/components/SideMenu/index.test.cjs.js.map +1 -1
- package/dist/components/SideMenu/index.test.es.js +3 -3
- package/dist/components/SideMenu/index.test.es.js.map +1 -1
- package/dist/components/SpinnerButton/index.cjs.js.map +1 -1
- package/dist/components/SpinnerButton/index.es.js.map +1 -1
- package/dist/components/SpinnerButton/index.test.cjs.js +1 -1
- package/dist/components/SpinnerButton/index.test.cjs.js.map +1 -1
- package/dist/components/SpinnerButton/index.test.es.js +2 -2
- package/dist/components/SpinnerButton/index.test.es.js.map +1 -1
- package/dist/components/SubMenu/index.cjs.js.map +1 -1
- package/dist/components/SubMenu/index.es.js.map +1 -1
- package/dist/components/SubMenu/index.test.cjs.js +1 -1
- package/dist/components/SubMenu/index.test.cjs.js.map +1 -1
- package/dist/components/SubMenu/index.test.es.js +1 -1
- package/dist/components/SubMenu/index.test.es.js.map +1 -1
- package/dist/components/Tabs/index.cjs.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +1 -1
- package/dist/components/Tabs/index.es.js.map +1 -1
- package/dist/components/Tabs/index.test.cjs.js +1 -1
- package/dist/components/Tabs/index.test.cjs.js.map +1 -1
- package/dist/components/Tabs/index.test.es.js +2 -2
- package/dist/components/Tabs/index.test.es.js.map +1 -1
- package/dist/components/Textarea/index.cjs.js.map +1 -1
- package/dist/components/Textarea/index.es.js.map +1 -1
- package/dist/components/Textarea/index.test.cjs.js +1 -1
- package/dist/components/Textarea/index.test.cjs.js.map +1 -1
- package/dist/components/Textarea/index.test.es.js +2 -2
- package/dist/components/Textarea/index.test.es.js.map +1 -1
- package/dist/components/Title/index.cjs.js +1 -1
- package/dist/components/Title/index.cjs.js.map +1 -1
- package/dist/components/Title/index.d.ts +2 -0
- package/dist/components/Title/index.es.js +9 -9
- package/dist/components/Title/index.es.js.map +1 -1
- package/dist/components/Title/index.test.cjs.js +1 -1
- package/dist/components/Title/index.test.cjs.js.map +1 -1
- package/dist/components/Title/index.test.es.js +2 -2
- package/dist/components/Title/index.test.es.js.map +1 -1
- package/dist/components/ToggleButton/index.cjs.js.map +1 -1
- package/dist/components/ToggleButton/index.es.js.map +1 -1
- package/dist/components/ToggleButton/index.test.cjs.js +1 -1
- package/dist/components/ToggleButton/index.test.cjs.js.map +1 -1
- package/dist/components/ToggleButton/index.test.es.js +1 -1
- package/dist/components/ToggleButton/index.test.es.js.map +1 -1
- package/dist/components/VStack/index.cjs.js.map +1 -1
- package/dist/components/VStack/index.es.js.map +1 -1
- package/dist/components/VStack/index.test.cjs.js +1 -1
- package/dist/components/VStack/index.test.cjs.js.map +1 -1
- package/dist/components/VStack/index.test.es.js +2 -2
- package/dist/components/VStack/index.test.es.js.map +1 -1
- package/dist/{index-D5b3AasF.js → index--uHewOkd.js} +2 -2
- package/dist/{index-D5b3AasF.js.map → index--uHewOkd.js.map} +1 -1
- package/dist/index-9p9q0wxE.cjs +39 -0
- package/dist/index-9p9q0wxE.cjs.map +1 -0
- package/dist/index-B663CLQ0.cjs.map +1 -1
- package/dist/{index-C50NsnJO.cjs → index-Bbj4TMfJ.cjs} +2 -2
- package/dist/{index-C50NsnJO.cjs.map → index-Bbj4TMfJ.cjs.map} +1 -1
- package/dist/{index-ZP4xL6Dt.js → index-Bt_ypxrX.js} +7373 -6726
- package/dist/index-Bt_ypxrX.js.map +1 -0
- package/dist/index-C9Dbd7MM.cjs +4 -0
- package/dist/index-C9Dbd7MM.cjs.map +1 -0
- package/dist/index-CCbJ_2yU.cjs.map +1 -1
- package/dist/index-CSiE_l9r.js.map +1 -1
- package/dist/index-CaEC29Xt.cjs +96 -0
- package/dist/index-CaEC29Xt.cjs.map +1 -0
- package/dist/{index-DCSLk6pp.js → index-Cj9ZvtM1.js} +1890 -2721
- package/dist/index-Cj9ZvtM1.js.map +1 -0
- package/dist/index-pr0ncuNy.js.map +1 -1
- package/dist/{index-BqN32Ptm.js → index-zix1zlkq.js} +628 -602
- package/dist/index-zix1zlkq.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/{react.esm-CiMn0Rnx.cjs → react.esm-BcRJ42eI.cjs} +31 -31
- package/dist/react.esm-BcRJ42eI.cjs.map +1 -0
- package/dist/{react.esm-2FJSSo-S.js → react.esm-DVhZgPrH.js} +629 -608
- package/dist/react.esm-DVhZgPrH.js.map +1 -0
- package/package.json +21 -18
- package/dist/browser-BCVsA9bD.cjs +0 -2
- package/dist/browser-BCVsA9bD.cjs.map +0 -1
- package/dist/browser-BYxLWVDg.js +0 -654
- package/dist/browser-BYxLWVDg.js.map +0 -1
- package/dist/index-BHsZ5xlA.cjs +0 -96
- package/dist/index-BHsZ5xlA.cjs.map +0 -1
- package/dist/index-BoNIpBs7.cjs +0 -4
- package/dist/index-BoNIpBs7.cjs.map +0 -1
- package/dist/index-BpMSrIOq.cjs +0 -43
- package/dist/index-BpMSrIOq.cjs.map +0 -1
- package/dist/index-BqN32Ptm.js.map +0 -1
- package/dist/index-DCSLk6pp.js.map +0 -1
- package/dist/index-ZP4xL6Dt.js.map +0 -1
- package/dist/react.esm-2FJSSo-S.js.map +0 -1
- package/dist/react.esm-CiMn0Rnx.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.cjs.js","sources":["../../../src/components/RadioGroupController/index.test.tsx"],"sourcesContent":["import { render, renderHook, screen } from \"@testing-library/react\";\nimport { useForm } from \"react-hook-form\";\n\nimport { RadioGroupController } from \".\";\n\ndescribe(\"RadioGroupController component\", () => {\n it(\"renders radio buttons with options and correct default value\", () => {\n const { result } = renderHook(() => useForm());\n const { control } = result.current;\n\n const testName = \"TestRadio\";\n const options = [\n { label: \"Option 1\", value: \"option1\" },\n { label: \"Option 2\", value: \"option2\" },\n { label: \"Option 3\", value: \"option3\" },\n ];\n const defaultValue = \"option2\"; // Example of default value\n\n render(\n <RadioGroupController\n control={control}\n name={testName}\n options={options}\n defaultValue={defaultValue}\n />,\n );\n\n // Check if the radio group renders with correct default value\n const option = options.find((opt) => opt.value === defaultValue);\n if (option) {\n // Check if the default value's label is displayed\n const displayedValue = screen.getByText(option.label);\n expect(displayedValue).toBeInTheDocument();\n }\n });\n\n it(\"renders without default value\", () => {\n const { result } = renderHook(() => useForm());\n const { control } = result.current;\n\n const testName = \"TestRadio\";\n const options = [\n { label: \"Option 1\", value: \"option1\" },\n { label: \"Option 2\", value: \"option2\" },\n { label: \"Option 3\", value: \"option3\" },\n ];\n\n render(\n <RadioGroupController\n control={control}\n name={testName}\n options={options}\n />,\n );\n\n // Check if the radio group renders without any selected value\n options.forEach((option) => {\n const radioOption = screen.getByLabelText(option.label);\n expect(radioOption).not.toBeChecked();\n });\n });\n});\n"],"names":["result","renderHook","useForm","control","testName","options","defaultValue","render","jsx","RadioGroupController","option","opt","displayedValue","screen","radioOption"],"mappings":"qJAKA,SAAS,iCAAkC,IAAM,CAC/C,GAAG,+DAAgE,IAAM,CACvE,KAAM,CAAE,OAAAA,
|
|
1
|
+
{"version":3,"file":"index.test.cjs.js","sources":["../../../src/components/RadioGroupController/index.test.tsx"],"sourcesContent":["import { render, renderHook, screen } from \"@testing-library/react\";\nimport { useForm } from \"react-hook-form\";\n\nimport { RadioGroupController } from \".\";\n\ndescribe(\"RadioGroupController component\", () => {\n it(\"renders radio buttons with options and correct default value\", () => {\n const { result } = renderHook(() => useForm());\n const { control } = result.current;\n\n const testName = \"TestRadio\";\n const options = [\n { label: \"Option 1\", value: \"option1\" },\n { label: \"Option 2\", value: \"option2\" },\n { label: \"Option 3\", value: \"option3\" },\n ];\n const defaultValue = \"option2\"; // Example of default value\n\n render(\n <RadioGroupController\n control={control}\n name={testName}\n options={options}\n defaultValue={defaultValue}\n />,\n );\n\n // Check if the radio group renders with correct default value\n const option = options.find((opt) => opt.value === defaultValue);\n if (option) {\n // Check if the default value's label is displayed\n const displayedValue = screen.getByText(option.label);\n expect(displayedValue).toBeInTheDocument();\n }\n });\n\n it(\"renders without default value\", () => {\n const { result } = renderHook(() => useForm());\n const { control } = result.current;\n\n const testName = \"TestRadio\";\n const options = [\n { label: \"Option 1\", value: \"option1\" },\n { label: \"Option 2\", value: \"option2\" },\n { label: \"Option 3\", value: \"option3\" },\n ];\n\n render(\n <RadioGroupController\n control={control}\n name={testName}\n options={options}\n />,\n );\n\n // Check if the radio group renders without any selected value\n options.forEach((option) => {\n const radioOption = screen.getByLabelText(option.label);\n expect(radioOption).not.toBeChecked();\n });\n });\n});\n"],"names":["result","renderHook","useForm","control","testName","options","defaultValue","render","jsx","RadioGroupController","option","opt","displayedValue","screen","radioOption"],"mappings":"qJAKA,SAAS,iCAAkC,IAAM,CAC/C,GAAG,+DAAgE,IAAM,CACvE,KAAM,CAAE,OAAAA,CAAA,EAAWC,aAAW,IAAMC,EAAAA,SAAS,EACvC,CAAE,QAAAC,GAAYH,EAAO,QAErBI,EAAW,YACXC,EAAU,CACd,CAAE,MAAO,WAAY,MAAO,SAAA,EAC5B,CAAE,MAAO,WAAY,MAAO,SAAA,EAC5B,CAAE,MAAO,WAAY,MAAO,SAAA,CAAU,EAElCC,EAAe,UAErBC,EAAAA,OACEC,EAAAA,IAACC,EAAAA,qBAAA,CACC,QAAAN,EACA,KAAMC,EACN,QAAAC,EACA,aAAAC,CAAA,CAAA,CACF,EAIF,MAAMI,EAASL,EAAQ,KAAMM,GAAQA,EAAI,QAAUL,CAAY,EAC/D,GAAII,EAAQ,CAEV,MAAME,EAAiBC,EAAAA,OAAO,UAAUH,EAAO,KAAK,EACpD,OAAOE,CAAc,EAAE,kBAAA,CACzB,CACF,CAAC,EAED,GAAG,gCAAiC,IAAM,CACxC,KAAM,CAAE,OAAAZ,CAAA,EAAWC,aAAW,IAAMC,EAAAA,SAAS,EACvC,CAAE,QAAAC,GAAYH,EAAO,QAErBI,EAAW,YACXC,EAAU,CACd,CAAE,MAAO,WAAY,MAAO,SAAA,EAC5B,CAAE,MAAO,WAAY,MAAO,SAAA,EAC5B,CAAE,MAAO,WAAY,MAAO,SAAA,CAAU,EAGxCE,EAAAA,OACEC,EAAAA,IAACC,EAAAA,qBAAA,CACC,QAAAN,EACA,KAAMC,EACN,QAAAC,CAAA,CAAA,CACF,EAIFA,EAAQ,QAASK,GAAW,CAC1B,MAAMI,EAAcD,EAAAA,OAAO,eAAeH,EAAO,KAAK,EACtD,OAAOI,CAAW,EAAE,IAAI,YAAA,CAC1B,CAAC,CACH,CAAC,CACH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import { a as s, r as p, s as c } from "../../react.esm-
|
|
2
|
+
import { a as s, r as p, s as c } from "../../react.esm-DVhZgPrH.js";
|
|
3
3
|
import { useForm as u } from "react-hook-form";
|
|
4
4
|
import { RadioGroupController as d } from "./index.es.js";
|
|
5
5
|
describe("RadioGroupController component", () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.es.js","sources":["../../../src/components/RadioGroupController/index.test.tsx"],"sourcesContent":["import { render, renderHook, screen } from \"@testing-library/react\";\nimport { useForm } from \"react-hook-form\";\n\nimport { RadioGroupController } from \".\";\n\ndescribe(\"RadioGroupController component\", () => {\n it(\"renders radio buttons with options and correct default value\", () => {\n const { result } = renderHook(() => useForm());\n const { control } = result.current;\n\n const testName = \"TestRadio\";\n const options = [\n { label: \"Option 1\", value: \"option1\" },\n { label: \"Option 2\", value: \"option2\" },\n { label: \"Option 3\", value: \"option3\" },\n ];\n const defaultValue = \"option2\"; // Example of default value\n\n render(\n <RadioGroupController\n control={control}\n name={testName}\n options={options}\n defaultValue={defaultValue}\n />,\n );\n\n // Check if the radio group renders with correct default value\n const option = options.find((opt) => opt.value === defaultValue);\n if (option) {\n // Check if the default value's label is displayed\n const displayedValue = screen.getByText(option.label);\n expect(displayedValue).toBeInTheDocument();\n }\n });\n\n it(\"renders without default value\", () => {\n const { result } = renderHook(() => useForm());\n const { control } = result.current;\n\n const testName = \"TestRadio\";\n const options = [\n { label: \"Option 1\", value: \"option1\" },\n { label: \"Option 2\", value: \"option2\" },\n { label: \"Option 3\", value: \"option3\" },\n ];\n\n render(\n <RadioGroupController\n control={control}\n name={testName}\n options={options}\n />,\n );\n\n // Check if the radio group renders without any selected value\n options.forEach((option) => {\n const radioOption = screen.getByLabelText(option.label);\n expect(radioOption).not.toBeChecked();\n });\n });\n});\n"],"names":["result","renderHook","useForm","control","testName","options","defaultValue","render","jsx","RadioGroupController","option","opt","displayedValue","screen","radioOption"],"mappings":";;;;AAKA,SAAS,kCAAkC,MAAM;AAC/C,KAAG,gEAAgE,MAAM;AACvE,UAAM,EAAE,QAAAA,
|
|
1
|
+
{"version":3,"file":"index.test.es.js","sources":["../../../src/components/RadioGroupController/index.test.tsx"],"sourcesContent":["import { render, renderHook, screen } from \"@testing-library/react\";\nimport { useForm } from \"react-hook-form\";\n\nimport { RadioGroupController } from \".\";\n\ndescribe(\"RadioGroupController component\", () => {\n it(\"renders radio buttons with options and correct default value\", () => {\n const { result } = renderHook(() => useForm());\n const { control } = result.current;\n\n const testName = \"TestRadio\";\n const options = [\n { label: \"Option 1\", value: \"option1\" },\n { label: \"Option 2\", value: \"option2\" },\n { label: \"Option 3\", value: \"option3\" },\n ];\n const defaultValue = \"option2\"; // Example of default value\n\n render(\n <RadioGroupController\n control={control}\n name={testName}\n options={options}\n defaultValue={defaultValue}\n />,\n );\n\n // Check if the radio group renders with correct default value\n const option = options.find((opt) => opt.value === defaultValue);\n if (option) {\n // Check if the default value's label is displayed\n const displayedValue = screen.getByText(option.label);\n expect(displayedValue).toBeInTheDocument();\n }\n });\n\n it(\"renders without default value\", () => {\n const { result } = renderHook(() => useForm());\n const { control } = result.current;\n\n const testName = \"TestRadio\";\n const options = [\n { label: \"Option 1\", value: \"option1\" },\n { label: \"Option 2\", value: \"option2\" },\n { label: \"Option 3\", value: \"option3\" },\n ];\n\n render(\n <RadioGroupController\n control={control}\n name={testName}\n options={options}\n />,\n );\n\n // Check if the radio group renders without any selected value\n options.forEach((option) => {\n const radioOption = screen.getByLabelText(option.label);\n expect(radioOption).not.toBeChecked();\n });\n });\n});\n"],"names":["result","renderHook","useForm","control","testName","options","defaultValue","render","jsx","RadioGroupController","option","opt","displayedValue","screen","radioOption"],"mappings":";;;;AAKA,SAAS,kCAAkC,MAAM;AAC/C,KAAG,gEAAgE,MAAM;AACvE,UAAM,EAAE,QAAAA,EAAA,IAAWC,EAAW,MAAMC,GAAS,GACvC,EAAE,SAAAC,MAAYH,EAAO,SAErBI,IAAW,aACXC,IAAU;AAAA,MACd,EAAE,OAAO,YAAY,OAAO,UAAA;AAAA,MAC5B,EAAE,OAAO,YAAY,OAAO,UAAA;AAAA,MAC5B,EAAE,OAAO,YAAY,OAAO,UAAA;AAAA,IAAU,GAElCC,IAAe;AAErB,IAAAC;AAAA,MACE,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,SAAAN;AAAA,UACA,MAAMC;AAAA,UACN,SAAAC;AAAA,UACA,cAAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAIF,UAAMI,IAASL,EAAQ,KAAK,CAACM,MAAQA,EAAI,UAAUL,CAAY;AAC/D,QAAII,GAAQ;AAEV,YAAME,IAAiBC,EAAO,UAAUH,EAAO,KAAK;AACpD,aAAOE,CAAc,EAAE,kBAAA;AAAA,IACzB;AAAA,EACF,CAAC,GAED,GAAG,iCAAiC,MAAM;AACxC,UAAM,EAAE,QAAAZ,EAAA,IAAWC,EAAW,MAAMC,GAAS,GACvC,EAAE,SAAAC,MAAYH,EAAO,SAErBI,IAAW,aACXC,IAAU;AAAA,MACd,EAAE,OAAO,YAAY,OAAO,UAAA;AAAA,MAC5B,EAAE,OAAO,YAAY,OAAO,UAAA;AAAA,MAC5B,EAAE,OAAO,YAAY,OAAO,UAAA;AAAA,IAAU;AAGxC,IAAAE;AAAA,MACE,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,SAAAN;AAAA,UACA,MAAMC;AAAA,UACN,SAAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,GAIFA,EAAQ,QAAQ,CAACK,MAAW;AAC1B,YAAMI,IAAcD,EAAO,eAAeH,EAAO,KAAK;AACtD,aAAOI,CAAW,EAAE,IAAI,YAAA;AAAA,IAC1B,CAAC;AAAA,EACH,CAAC;AACH,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../../src/components/RangeDatePicker/index.tsx"],"sourcesContent":["import { type Dispatch, type SetStateAction } from \"react\";\nimport { DatePicker, LocalizationProvider } from \"@mui/x-date-pickers\";\nimport { AdapterDateFns } from \"@mui/x-date-pickers/AdapterDateFns\";\nimport ja from \"date-fns/locale/ja\";\n\nimport styles from \"./index.module.scss\";\n\nexport type RangeDatePickerInfo = {\n id: string;\n name: string;\n valueState: Date | null;\n setValue: Dispatch<SetStateAction<Date | null>>;\n};\ntype Props = {\n fromDateInfo: RangeDatePickerInfo;\n toDateInfo: RangeDatePickerInfo;\n};\n\nexport const RangeDatePicker = (props: Props) => {\n const { fromDateInfo, toDateInfo } = props;\n\n return (\n <LocalizationProvider dateAdapter={AdapterDateFns} adapterLocale={ja}>\n <div className={styles.rangeContainer}>\n <DatePicker\n maxDate={new Date()}\n value={fromDateInfo.valueState}\n onChange={(newValue) => fromDateInfo.setValue(newValue)}\n />\n ~\n <DatePicker\n maxDate={new Date()}\n value={toDateInfo.valueState}\n onChange={(newValue) => toDateInfo.setValue(newValue)}\n />\n </div>\n </LocalizationProvider>\n );\n};\n\nexport default RangeDatePicker;\n"],"names":["RangeDatePicker","props","fromDateInfo","toDateInfo","jsx","LocalizationProvider","AdapterDateFns","ja","jsxs","styles","DatePicker","newValue"],"mappings":"mTAkBaA,EAAmBC,GAAiB,
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../src/components/RangeDatePicker/index.tsx"],"sourcesContent":["import { type Dispatch, type SetStateAction } from \"react\";\nimport { DatePicker, LocalizationProvider } from \"@mui/x-date-pickers\";\nimport { AdapterDateFns } from \"@mui/x-date-pickers/AdapterDateFns\";\nimport ja from \"date-fns/locale/ja\";\n\nimport styles from \"./index.module.scss\";\n\nexport type RangeDatePickerInfo = {\n id: string;\n name: string;\n valueState: Date | null;\n setValue: Dispatch<SetStateAction<Date | null>>;\n};\ntype Props = {\n fromDateInfo: RangeDatePickerInfo;\n toDateInfo: RangeDatePickerInfo;\n};\n\nexport const RangeDatePicker = (props: Props) => {\n const { fromDateInfo, toDateInfo } = props;\n\n return (\n <LocalizationProvider dateAdapter={AdapterDateFns} adapterLocale={ja}>\n <div className={styles.rangeContainer}>\n <DatePicker\n maxDate={new Date()}\n value={fromDateInfo.valueState}\n onChange={(newValue) => fromDateInfo.setValue(newValue)}\n />\n ~\n <DatePicker\n maxDate={new Date()}\n value={toDateInfo.valueState}\n onChange={(newValue) => toDateInfo.setValue(newValue)}\n />\n </div>\n </LocalizationProvider>\n );\n};\n\nexport default RangeDatePicker;\n"],"names":["RangeDatePicker","props","fromDateInfo","toDateInfo","jsx","LocalizationProvider","AdapterDateFns","ja","jsxs","styles","DatePicker","newValue"],"mappings":"mTAkBaA,EAAmBC,GAAiB,CAC/C,KAAM,CAAE,aAAAC,EAAc,WAAAC,CAAA,EAAeF,EAErC,OACEG,EAAAA,IAACC,EAAAA,qBAAA,CAAqB,YAAaC,EAAAA,eAAgB,cAAeC,EAChE,SAAAC,EAAAA,KAAC,MAAA,CAAI,UAAWC,EAAO,eACrB,SAAA,CAAAL,EAAAA,IAACM,EAAAA,WAAA,CACC,YAAa,KACb,MAAOR,EAAa,WACpB,SAAWS,GAAaT,EAAa,SAASS,CAAQ,CAAA,CAAA,EACtD,IAEFP,EAAAA,IAACM,EAAAA,WAAA,CACC,YAAa,KACb,MAAOP,EAAW,WAClB,SAAWQ,GAAaR,EAAW,SAASQ,CAAQ,CAAA,CAAA,CACtD,CAAA,CACF,CAAA,CACF,CAEJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../../../src/components/RangeDatePicker/index.tsx"],"sourcesContent":["import { type Dispatch, type SetStateAction } from \"react\";\nimport { DatePicker, LocalizationProvider } from \"@mui/x-date-pickers\";\nimport { AdapterDateFns } from \"@mui/x-date-pickers/AdapterDateFns\";\nimport ja from \"date-fns/locale/ja\";\n\nimport styles from \"./index.module.scss\";\n\nexport type RangeDatePickerInfo = {\n id: string;\n name: string;\n valueState: Date | null;\n setValue: Dispatch<SetStateAction<Date | null>>;\n};\ntype Props = {\n fromDateInfo: RangeDatePickerInfo;\n toDateInfo: RangeDatePickerInfo;\n};\n\nexport const RangeDatePicker = (props: Props) => {\n const { fromDateInfo, toDateInfo } = props;\n\n return (\n <LocalizationProvider dateAdapter={AdapterDateFns} adapterLocale={ja}>\n <div className={styles.rangeContainer}>\n <DatePicker\n maxDate={new Date()}\n value={fromDateInfo.valueState}\n onChange={(newValue) => fromDateInfo.setValue(newValue)}\n />\n ~\n <DatePicker\n maxDate={new Date()}\n value={toDateInfo.valueState}\n onChange={(newValue) => toDateInfo.setValue(newValue)}\n />\n </div>\n </LocalizationProvider>\n );\n};\n\nexport default RangeDatePicker;\n"],"names":["RangeDatePicker","props","fromDateInfo","toDateInfo","jsx","LocalizationProvider","AdapterDateFns","ja","jsxs","styles","DatePicker","newValue"],"mappings":";;;;;;GAkBaA,IAAkB,CAACC,MAAiB;
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../src/components/RangeDatePicker/index.tsx"],"sourcesContent":["import { type Dispatch, type SetStateAction } from \"react\";\nimport { DatePicker, LocalizationProvider } from \"@mui/x-date-pickers\";\nimport { AdapterDateFns } from \"@mui/x-date-pickers/AdapterDateFns\";\nimport ja from \"date-fns/locale/ja\";\n\nimport styles from \"./index.module.scss\";\n\nexport type RangeDatePickerInfo = {\n id: string;\n name: string;\n valueState: Date | null;\n setValue: Dispatch<SetStateAction<Date | null>>;\n};\ntype Props = {\n fromDateInfo: RangeDatePickerInfo;\n toDateInfo: RangeDatePickerInfo;\n};\n\nexport const RangeDatePicker = (props: Props) => {\n const { fromDateInfo, toDateInfo } = props;\n\n return (\n <LocalizationProvider dateAdapter={AdapterDateFns} adapterLocale={ja}>\n <div className={styles.rangeContainer}>\n <DatePicker\n maxDate={new Date()}\n value={fromDateInfo.valueState}\n onChange={(newValue) => fromDateInfo.setValue(newValue)}\n />\n ~\n <DatePicker\n maxDate={new Date()}\n value={toDateInfo.valueState}\n onChange={(newValue) => toDateInfo.setValue(newValue)}\n />\n </div>\n </LocalizationProvider>\n );\n};\n\nexport default RangeDatePicker;\n"],"names":["RangeDatePicker","props","fromDateInfo","toDateInfo","jsx","LocalizationProvider","AdapterDateFns","ja","jsxs","styles","DatePicker","newValue"],"mappings":";;;;;;GAkBaA,IAAkB,CAACC,MAAiB;AAC/C,QAAM,EAAE,cAAAC,GAAc,YAAAC,EAAA,IAAeF;AAErC,SACE,gBAAAG,EAACC,GAAA,EAAqB,aAAaC,GAAgB,eAAeC,GAChE,UAAA,gBAAAC,EAAC,OAAA,EAAI,WAAWC,EAAO,gBACrB,UAAA;AAAA,IAAA,gBAAAL;AAAA,MAACM;AAAA,MAAA;AAAA,QACC,6BAAa,KAAA;AAAA,QACb,OAAOR,EAAa;AAAA,QACpB,UAAU,CAACS,MAAaT,EAAa,SAASS,CAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,IACtD;AAAA,IAEF,gBAAAP;AAAA,MAACM;AAAA,MAAA;AAAA,QACC,6BAAa,KAAA;AAAA,QACb,OAAOP,EAAW;AAAA,QAClB,UAAU,CAACQ,MAAaR,EAAW,SAASQ,CAAQ;AAAA,MAAA;AAAA,IAAA;AAAA,EACtD,EAAA,CACF,EAAA,CACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../../src/components/RangeDatePickerController/index.tsx"],"sourcesContent":["import { Grid } from \"@mui/material\";\nimport {\n DateTimePicker,\n PickersActionBarAction,\n type DateOrTimeView,\n} from \"@mui/x-date-pickers\";\nimport { AdapterDateFns } from \"@mui/x-date-pickers/AdapterDateFns\";\nimport { jaJP } from \"@mui/x-date-pickers/locales\";\nimport { LocalizationProvider } from \"@mui/x-date-pickers/LocalizationProvider\";\nimport { parse, set } from \"date-fns\";\nimport ja from \"date-fns/locale/ja\";\nimport {\n Controller,\n type Control,\n type FieldValues,\n type UseFormSetValue,\n} from \"react-hook-form\";\n\nimport { DATETIME_FORMAT } from \"@/constants/datetime\";\n\nexport type PickerInfo = {\n name: string;\n defaultValue?: string | undefined | null;\n};\n\ntype Props = {\n control: Control;\n fromDateInfo: PickerInfo;\n toDateInfo: PickerInfo;\n dateFormat: string;\n setValue: UseFormSetValue<FieldValues>;\n};\n\nconst pickerStyles = {\n \".MuiButtonBase-root\": {\n padding: 0.5,\n paddingLeft: 0,\n },\n \"& input::placeholder\": {\n fontSize: \"x-small\",\n },\n};\n\nconst pickerActions: PickersActionBarAction[] = [\"clear\", \"accept\"];\n\n/**\n * Date,DateTimeをを選択できるコンポーネント\n * dateFormatに合わせてpickerViewを生成します。\n * @param props\n * @returns\n */\nexport const RangeDatePickerController = (props: Props) => {\n const { control, fromDateInfo, toDateInfo, dateFormat, setValue } = props;\n\n /**\n * 受信した値を適切な日付またはnullに変換します。\n * @param value ユーザーによる値、呼び出し側からセットされた値\n * @param pickerInfo 紐づくpickerの情報\n * @returns\n */\n const convertValue = (\n value: string | Date | null,\n pickerInfo: PickerInfo,\n ): Date | null => {\n const newValue = value\n ? value instanceof Date\n ? value\n : typeof value === \"string\"\n ? parse(value, dateFormat, new Date())\n : null\n : null;\n // NOTE:呼び出し側からはstringがセットされる可能性が高いため、変換後controlに紐付けvalueも置き換えます。\n if (typeof value === \"string\") {\n setValue(pickerInfo.name, newValue);\n }\n return newValue;\n };\n\n const handleOnchange = (value: Date | null, pickerInfo: PickerInfo) => {\n setValue(pickerInfo.name, value ?? pickerInfo.defaultValue, {\n shouldDirty: true,\n });\n };\n\n const views: DateOrTimeView[] = (() => {\n const v: DateOrTimeView[] = [];\n\n if (dateFormat.includes(\"yyyy\")) {\n v.push(\"year\");\n }\n if (dateFormat.includes(\"MM\")) {\n v.push(\"month\");\n }\n if (dateFormat.includes(\"dd\")) {\n v.push(\"day\");\n }\n if (dateFormat.includes(\"HH\")) {\n v.push(\"hours\");\n }\n if (dateFormat.includes(\"mm\")) {\n v.push(\"minutes\");\n }\n if (dateFormat.includes(\"ss\")) {\n v.push(\"seconds\");\n }\n return v;\n })();\n\n return (\n <LocalizationProvider\n dateAdapter={AdapterDateFns}\n adapterLocale={ja}\n localeText={\n jaJP.components.MuiLocalizationProvider.defaultProps.localeText\n }\n >\n <Grid container alignItems=\"center\" rowSpacing={1} columnSpacing={1}>\n <Grid item xs={11.4} sm={5.7} md={11.4} xl={5.7}>\n <Controller\n control={control}\n name={fromDateInfo.name}\n defaultValue={fromDateInfo.defaultValue}\n render={({ field, fieldState }) => (\n <DateTimePicker\n {...field}\n format={dateFormat}\n views={views}\n sx={pickerStyles}\n value={convertValue(field.value, fromDateInfo)}\n onChange={(newDate) => {\n handleOnchange(newDate, fromDateInfo);\n }}\n slotProps={{\n textField: {\n error: !!fieldState.error,\n helperText: fieldState.error?.message,\n fullWidth: true,\n },\n // NOTE: clearボタンが文字を隠していまうのでとりあえずcalendar内のもので代用\n // field: {\n // clearable: true,\n // },\n actionBar: { actions: pickerActions },\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={0.6} sm={0.6} md={0.6} lg={0.6} textAlign=\"center\">\n ~\n </Grid>\n {/* <Grid item xs={1} sm={0} lg={0}>\n <></>\n </Grid> */}\n <Grid item xs={11.4} sm={5.7} md={11.4} xl={5.7}>\n <Controller\n control={control}\n name={toDateInfo.name}\n defaultValue={toDateInfo.defaultValue}\n render={({ field, fieldState }) => (\n <DateTimePicker\n {...field}\n format={dateFormat}\n views={views}\n sx={pickerStyles}\n value={convertValue(field.value, toDateInfo)}\n onChange={(newDate) => {\n // NOTE: 値がない状態からh日付をを入力した場合に限りto入力部だけデフォルトで23:59:59が入るようにします。\n if (\n dateFormat === DATETIME_FORMAT &&\n newDate !== null &&\n !field.value\n ) {\n newDate = set(newDate, {\n hours: 23,\n minutes: 59,\n seconds: 59,\n });\n }\n handleOnchange(newDate, toDateInfo);\n }}\n slotProps={{\n textField: {\n error: !!fieldState.error,\n helperText: fieldState.error?.message,\n fullWidth: true,\n },\n // NOTE: clearボタンが文字を隠していまうのでとりあえずcalendar内のもので代用\n // field: {\n // clearable: true,\n // },\n actionBar: { actions: pickerActions },\n }}\n />\n )}\n />\n </Grid>\n </Grid>\n </LocalizationProvider>\n );\n};\n\nexport default RangeDatePickerController
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../src/components/RangeDatePickerController/index.tsx"],"sourcesContent":["import { Grid } from \"@mui/material\";\nimport {\n DateTimePicker,\n PickersActionBarAction,\n type DateOrTimeView,\n} from \"@mui/x-date-pickers\";\nimport { AdapterDateFns } from \"@mui/x-date-pickers/AdapterDateFns\";\nimport { jaJP } from \"@mui/x-date-pickers/locales\";\nimport { LocalizationProvider } from \"@mui/x-date-pickers/LocalizationProvider\";\nimport { parse, set } from \"date-fns\";\nimport ja from \"date-fns/locale/ja\";\nimport {\n Controller,\n type Control,\n type FieldValues,\n type UseFormSetValue,\n} from \"react-hook-form\";\n\nimport { DATETIME_FORMAT } from \"@/constants/datetime\";\n\nexport type PickerInfo = {\n name: string;\n defaultValue?: string | undefined | null;\n};\n\ntype Props = {\n control: Control;\n fromDateInfo: PickerInfo;\n toDateInfo: PickerInfo;\n dateFormat: string;\n setValue: UseFormSetValue<FieldValues>;\n};\n\nconst pickerStyles = {\n \".MuiButtonBase-root\": {\n padding: 0.5,\n paddingLeft: 0,\n },\n \"& input::placeholder\": {\n fontSize: \"x-small\",\n },\n};\n\nconst pickerActions: PickersActionBarAction[] = [\"clear\", \"accept\"];\n\n/**\n * Date,DateTimeをを選択できるコンポーネント\n * dateFormatに合わせてpickerViewを生成します。\n * @param props\n * @returns\n */\nexport const RangeDatePickerController = (props: Props) => {\n const { control, fromDateInfo, toDateInfo, dateFormat, setValue } = props;\n\n /**\n * 受信した値を適切な日付またはnullに変換します。\n * @param value ユーザーによる値、呼び出し側からセットされた値\n * @param pickerInfo 紐づくpickerの情報\n * @returns\n */\n const convertValue = (\n value: string | Date | null,\n pickerInfo: PickerInfo,\n ): Date | null => {\n const newValue = value\n ? value instanceof Date\n ? value\n : typeof value === \"string\"\n ? parse(value, dateFormat, new Date())\n : null\n : null;\n // NOTE:呼び出し側からはstringがセットされる可能性が高いため、変換後controlに紐付けvalueも置き換えます。\n if (typeof value === \"string\") {\n setValue(pickerInfo.name, newValue);\n }\n return newValue;\n };\n\n const handleOnchange = (value: Date | null, pickerInfo: PickerInfo) => {\n setValue(pickerInfo.name, value ?? pickerInfo.defaultValue, {\n shouldDirty: true,\n });\n };\n\n const views: DateOrTimeView[] = (() => {\n const v: DateOrTimeView[] = [];\n\n if (dateFormat.includes(\"yyyy\")) {\n v.push(\"year\");\n }\n if (dateFormat.includes(\"MM\")) {\n v.push(\"month\");\n }\n if (dateFormat.includes(\"dd\")) {\n v.push(\"day\");\n }\n if (dateFormat.includes(\"HH\")) {\n v.push(\"hours\");\n }\n if (dateFormat.includes(\"mm\")) {\n v.push(\"minutes\");\n }\n if (dateFormat.includes(\"ss\")) {\n v.push(\"seconds\");\n }\n return v;\n })();\n\n return (\n <LocalizationProvider\n dateAdapter={AdapterDateFns}\n adapterLocale={ja}\n localeText={\n jaJP.components.MuiLocalizationProvider.defaultProps.localeText\n }\n >\n <Grid container alignItems=\"center\" rowSpacing={1} columnSpacing={1}>\n <Grid item xs={11.4} sm={5.7} md={11.4} xl={5.7}>\n <Controller\n control={control}\n name={fromDateInfo.name}\n defaultValue={fromDateInfo.defaultValue}\n render={({ field, fieldState }) => (\n <DateTimePicker\n {...field}\n format={dateFormat}\n views={views}\n sx={pickerStyles}\n value={convertValue(field.value, fromDateInfo)}\n onChange={(newDate) => {\n handleOnchange(newDate, fromDateInfo);\n }}\n slotProps={{\n textField: {\n error: !!fieldState.error,\n helperText: fieldState.error?.message,\n fullWidth: true,\n },\n // NOTE: clearボタンが文字を隠していまうのでとりあえずcalendar内のもので代用\n // field: {\n // clearable: true,\n // },\n actionBar: { actions: pickerActions },\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={0.6} sm={0.6} md={0.6} lg={0.6} textAlign=\"center\">\n ~\n </Grid>\n {/* <Grid item xs={1} sm={0} lg={0}>\n <></>\n </Grid> */}\n <Grid item xs={11.4} sm={5.7} md={11.4} xl={5.7}>\n <Controller\n control={control}\n name={toDateInfo.name}\n defaultValue={toDateInfo.defaultValue}\n render={({ field, fieldState }) => (\n <DateTimePicker\n {...field}\n format={dateFormat}\n views={views}\n sx={pickerStyles}\n value={convertValue(field.value, toDateInfo)}\n onChange={(newDate) => {\n // NOTE: 値がない状態からh日付をを入力した場合に限りto入力部だけデフォルトで23:59:59が入るようにします。\n if (\n dateFormat === DATETIME_FORMAT &&\n newDate !== null &&\n !field.value\n ) {\n newDate = set(newDate, {\n hours: 23,\n minutes: 59,\n seconds: 59,\n });\n }\n handleOnchange(newDate, toDateInfo);\n }}\n slotProps={{\n textField: {\n error: !!fieldState.error,\n helperText: fieldState.error?.message,\n fullWidth: true,\n },\n // NOTE: clearボタンが文字を隠していまうのでとりあえずcalendar内のもので代用\n // field: {\n // clearable: true,\n // },\n actionBar: { actions: pickerActions },\n }}\n />\n )}\n />\n </Grid>\n </Grid>\n </LocalizationProvider>\n );\n};\n\nexport default RangeDatePickerController;\n"],"names":["pickerStyles","pickerActions","RangeDatePickerController","props","control","fromDateInfo","toDateInfo","dateFormat","setValue","convertValue","value","pickerInfo","newValue","parse","handleOnchange","views","v","jsx","LocalizationProvider","AdapterDateFns","ja","jaJP","jsxs","Grid","Controller","field","fieldState","DateTimePicker","newDate","_a","DATETIME_FORMAT","set"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../../../src/components/RangeDatePickerController/index.tsx"],"sourcesContent":["import { Grid } from \"@mui/material\";\nimport {\n DateTimePicker,\n PickersActionBarAction,\n type DateOrTimeView,\n} from \"@mui/x-date-pickers\";\nimport { AdapterDateFns } from \"@mui/x-date-pickers/AdapterDateFns\";\nimport { jaJP } from \"@mui/x-date-pickers/locales\";\nimport { LocalizationProvider } from \"@mui/x-date-pickers/LocalizationProvider\";\nimport { parse, set } from \"date-fns\";\nimport ja from \"date-fns/locale/ja\";\nimport {\n Controller,\n type Control,\n type FieldValues,\n type UseFormSetValue,\n} from \"react-hook-form\";\n\nimport { DATETIME_FORMAT } from \"@/constants/datetime\";\n\nexport type PickerInfo = {\n name: string;\n defaultValue?: string | undefined | null;\n};\n\ntype Props = {\n control: Control;\n fromDateInfo: PickerInfo;\n toDateInfo: PickerInfo;\n dateFormat: string;\n setValue: UseFormSetValue<FieldValues>;\n};\n\nconst pickerStyles = {\n \".MuiButtonBase-root\": {\n padding: 0.5,\n paddingLeft: 0,\n },\n \"& input::placeholder\": {\n fontSize: \"x-small\",\n },\n};\n\nconst pickerActions: PickersActionBarAction[] = [\"clear\", \"accept\"];\n\n/**\n * Date,DateTimeをを選択できるコンポーネント\n * dateFormatに合わせてpickerViewを生成します。\n * @param props\n * @returns\n */\nexport const RangeDatePickerController = (props: Props) => {\n const { control, fromDateInfo, toDateInfo, dateFormat, setValue } = props;\n\n /**\n * 受信した値を適切な日付またはnullに変換します。\n * @param value ユーザーによる値、呼び出し側からセットされた値\n * @param pickerInfo 紐づくpickerの情報\n * @returns\n */\n const convertValue = (\n value: string | Date | null,\n pickerInfo: PickerInfo,\n ): Date | null => {\n const newValue = value\n ? value instanceof Date\n ? value\n : typeof value === \"string\"\n ? parse(value, dateFormat, new Date())\n : null\n : null;\n // NOTE:呼び出し側からはstringがセットされる可能性が高いため、変換後controlに紐付けvalueも置き換えます。\n if (typeof value === \"string\") {\n setValue(pickerInfo.name, newValue);\n }\n return newValue;\n };\n\n const handleOnchange = (value: Date | null, pickerInfo: PickerInfo) => {\n setValue(pickerInfo.name, value ?? pickerInfo.defaultValue, {\n shouldDirty: true,\n });\n };\n\n const views: DateOrTimeView[] = (() => {\n const v: DateOrTimeView[] = [];\n\n if (dateFormat.includes(\"yyyy\")) {\n v.push(\"year\");\n }\n if (dateFormat.includes(\"MM\")) {\n v.push(\"month\");\n }\n if (dateFormat.includes(\"dd\")) {\n v.push(\"day\");\n }\n if (dateFormat.includes(\"HH\")) {\n v.push(\"hours\");\n }\n if (dateFormat.includes(\"mm\")) {\n v.push(\"minutes\");\n }\n if (dateFormat.includes(\"ss\")) {\n v.push(\"seconds\");\n }\n return v;\n })();\n\n return (\n <LocalizationProvider\n dateAdapter={AdapterDateFns}\n adapterLocale={ja}\n localeText={\n jaJP.components.MuiLocalizationProvider.defaultProps.localeText\n }\n >\n <Grid container alignItems=\"center\" rowSpacing={1} columnSpacing={1}>\n <Grid item xs={11.4} sm={5.7} md={11.4} xl={5.7}>\n <Controller\n control={control}\n name={fromDateInfo.name}\n defaultValue={fromDateInfo.defaultValue}\n render={({ field, fieldState }) => (\n <DateTimePicker\n {...field}\n format={dateFormat}\n views={views}\n sx={pickerStyles}\n value={convertValue(field.value, fromDateInfo)}\n onChange={(newDate) => {\n handleOnchange(newDate, fromDateInfo);\n }}\n slotProps={{\n textField: {\n error: !!fieldState.error,\n helperText: fieldState.error?.message,\n fullWidth: true,\n },\n // NOTE: clearボタンが文字を隠していまうのでとりあえずcalendar内のもので代用\n // field: {\n // clearable: true,\n // },\n actionBar: { actions: pickerActions },\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={0.6} sm={0.6} md={0.6} lg={0.6} textAlign=\"center\">\n ~\n </Grid>\n {/* <Grid item xs={1} sm={0} lg={0}>\n <></>\n </Grid> */}\n <Grid item xs={11.4} sm={5.7} md={11.4} xl={5.7}>\n <Controller\n control={control}\n name={toDateInfo.name}\n defaultValue={toDateInfo.defaultValue}\n render={({ field, fieldState }) => (\n <DateTimePicker\n {...field}\n format={dateFormat}\n views={views}\n sx={pickerStyles}\n value={convertValue(field.value, toDateInfo)}\n onChange={(newDate) => {\n // NOTE: 値がない状態からh日付をを入力した場合に限りto入力部だけデフォルトで23:59:59が入るようにします。\n if (\n dateFormat === DATETIME_FORMAT &&\n newDate !== null &&\n !field.value\n ) {\n newDate = set(newDate, {\n hours: 23,\n minutes: 59,\n seconds: 59,\n });\n }\n handleOnchange(newDate, toDateInfo);\n }}\n slotProps={{\n textField: {\n error: !!fieldState.error,\n helperText: fieldState.error?.message,\n fullWidth: true,\n },\n // NOTE: clearボタンが文字を隠していまうのでとりあえずcalendar内のもので代用\n // field: {\n // clearable: true,\n // },\n actionBar: { actions: pickerActions },\n }}\n />\n )}\n />\n </Grid>\n </Grid>\n </LocalizationProvider>\n );\n};\n\nexport default RangeDatePickerController
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../src/components/RangeDatePickerController/index.tsx"],"sourcesContent":["import { Grid } from \"@mui/material\";\nimport {\n DateTimePicker,\n PickersActionBarAction,\n type DateOrTimeView,\n} from \"@mui/x-date-pickers\";\nimport { AdapterDateFns } from \"@mui/x-date-pickers/AdapterDateFns\";\nimport { jaJP } from \"@mui/x-date-pickers/locales\";\nimport { LocalizationProvider } from \"@mui/x-date-pickers/LocalizationProvider\";\nimport { parse, set } from \"date-fns\";\nimport ja from \"date-fns/locale/ja\";\nimport {\n Controller,\n type Control,\n type FieldValues,\n type UseFormSetValue,\n} from \"react-hook-form\";\n\nimport { DATETIME_FORMAT } from \"@/constants/datetime\";\n\nexport type PickerInfo = {\n name: string;\n defaultValue?: string | undefined | null;\n};\n\ntype Props = {\n control: Control;\n fromDateInfo: PickerInfo;\n toDateInfo: PickerInfo;\n dateFormat: string;\n setValue: UseFormSetValue<FieldValues>;\n};\n\nconst pickerStyles = {\n \".MuiButtonBase-root\": {\n padding: 0.5,\n paddingLeft: 0,\n },\n \"& input::placeholder\": {\n fontSize: \"x-small\",\n },\n};\n\nconst pickerActions: PickersActionBarAction[] = [\"clear\", \"accept\"];\n\n/**\n * Date,DateTimeをを選択できるコンポーネント\n * dateFormatに合わせてpickerViewを生成します。\n * @param props\n * @returns\n */\nexport const RangeDatePickerController = (props: Props) => {\n const { control, fromDateInfo, toDateInfo, dateFormat, setValue } = props;\n\n /**\n * 受信した値を適切な日付またはnullに変換します。\n * @param value ユーザーによる値、呼び出し側からセットされた値\n * @param pickerInfo 紐づくpickerの情報\n * @returns\n */\n const convertValue = (\n value: string | Date | null,\n pickerInfo: PickerInfo,\n ): Date | null => {\n const newValue = value\n ? value instanceof Date\n ? value\n : typeof value === \"string\"\n ? parse(value, dateFormat, new Date())\n : null\n : null;\n // NOTE:呼び出し側からはstringがセットされる可能性が高いため、変換後controlに紐付けvalueも置き換えます。\n if (typeof value === \"string\") {\n setValue(pickerInfo.name, newValue);\n }\n return newValue;\n };\n\n const handleOnchange = (value: Date | null, pickerInfo: PickerInfo) => {\n setValue(pickerInfo.name, value ?? pickerInfo.defaultValue, {\n shouldDirty: true,\n });\n };\n\n const views: DateOrTimeView[] = (() => {\n const v: DateOrTimeView[] = [];\n\n if (dateFormat.includes(\"yyyy\")) {\n v.push(\"year\");\n }\n if (dateFormat.includes(\"MM\")) {\n v.push(\"month\");\n }\n if (dateFormat.includes(\"dd\")) {\n v.push(\"day\");\n }\n if (dateFormat.includes(\"HH\")) {\n v.push(\"hours\");\n }\n if (dateFormat.includes(\"mm\")) {\n v.push(\"minutes\");\n }\n if (dateFormat.includes(\"ss\")) {\n v.push(\"seconds\");\n }\n return v;\n })();\n\n return (\n <LocalizationProvider\n dateAdapter={AdapterDateFns}\n adapterLocale={ja}\n localeText={\n jaJP.components.MuiLocalizationProvider.defaultProps.localeText\n }\n >\n <Grid container alignItems=\"center\" rowSpacing={1} columnSpacing={1}>\n <Grid item xs={11.4} sm={5.7} md={11.4} xl={5.7}>\n <Controller\n control={control}\n name={fromDateInfo.name}\n defaultValue={fromDateInfo.defaultValue}\n render={({ field, fieldState }) => (\n <DateTimePicker\n {...field}\n format={dateFormat}\n views={views}\n sx={pickerStyles}\n value={convertValue(field.value, fromDateInfo)}\n onChange={(newDate) => {\n handleOnchange(newDate, fromDateInfo);\n }}\n slotProps={{\n textField: {\n error: !!fieldState.error,\n helperText: fieldState.error?.message,\n fullWidth: true,\n },\n // NOTE: clearボタンが文字を隠していまうのでとりあえずcalendar内のもので代用\n // field: {\n // clearable: true,\n // },\n actionBar: { actions: pickerActions },\n }}\n />\n )}\n />\n </Grid>\n <Grid item xs={0.6} sm={0.6} md={0.6} lg={0.6} textAlign=\"center\">\n ~\n </Grid>\n {/* <Grid item xs={1} sm={0} lg={0}>\n <></>\n </Grid> */}\n <Grid item xs={11.4} sm={5.7} md={11.4} xl={5.7}>\n <Controller\n control={control}\n name={toDateInfo.name}\n defaultValue={toDateInfo.defaultValue}\n render={({ field, fieldState }) => (\n <DateTimePicker\n {...field}\n format={dateFormat}\n views={views}\n sx={pickerStyles}\n value={convertValue(field.value, toDateInfo)}\n onChange={(newDate) => {\n // NOTE: 値がない状態からh日付をを入力した場合に限りto入力部だけデフォルトで23:59:59が入るようにします。\n if (\n dateFormat === DATETIME_FORMAT &&\n newDate !== null &&\n !field.value\n ) {\n newDate = set(newDate, {\n hours: 23,\n minutes: 59,\n seconds: 59,\n });\n }\n handleOnchange(newDate, toDateInfo);\n }}\n slotProps={{\n textField: {\n error: !!fieldState.error,\n helperText: fieldState.error?.message,\n fullWidth: true,\n },\n // NOTE: clearボタンが文字を隠していまうのでとりあえずcalendar内のもので代用\n // field: {\n // clearable: true,\n // },\n actionBar: { actions: pickerActions },\n }}\n />\n )}\n />\n </Grid>\n </Grid>\n </LocalizationProvider>\n );\n};\n\nexport default RangeDatePickerController;\n"],"names":["pickerStyles","pickerActions","RangeDatePickerController","props","control","fromDateInfo","toDateInfo","dateFormat","setValue","convertValue","value","pickerInfo","newValue","parse","handleOnchange","views","v","jsx","LocalizationProvider","AdapterDateFns","ja","jaJP","jsxs","Grid","Controller","field","fieldState","DateTimePicker","newDate","_a","DATETIME_FORMAT","set"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const o=require("react/jsx-runtime"),e=require("../../react.esm-
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),e=require("../../react.esm-BcRJ42eI.cjs"),n=require("react-hook-form"),c=require("./index.cjs.js");describe("RangeDatePickerController component",()=>{it("renders date pickers with correct default values (date-only format)",async()=>{const{result:t}=e.renderHook(()=>n.useForm()),{control:a,setValue:r}=t.current;e.render(o.jsx(c.RangeDatePickerController,{control:a,fromDateInfo:{name:"fromDate",defaultValue:"2024-03-01"},toDateInfo:{name:"toDate",defaultValue:"2024-03-15"},dateFormat:"yyyy-MM-dd",setValue:r}));const s=await e.screen.findByDisplayValue("2024-03-01"),u=await e.screen.findByDisplayValue("2024-03-15");expect(s).toBeInTheDocument(),expect(u).toBeInTheDocument()}),it("renders date pickers with correct default values (datetime format)",async()=>{const{result:t}=e.renderHook(()=>n.useForm()),{control:a,setValue:r}=t.current;e.render(o.jsx(c.RangeDatePickerController,{control:a,fromDateInfo:{name:"fromDate",defaultValue:"2024/03/01 00:00:00"},toDateInfo:{name:"toDate",defaultValue:"2024/03/15 23:59:59"},dateFormat:"yyyy/MM/dd HH:mm:ss",setValue:r})),expect(await e.screen.findByDisplayValue("2024/03/01 00:00:00")).toBeInTheDocument(),expect(await e.screen.findByDisplayValue("2024/03/15 23:59:59")).toBeInTheDocument()})});
|
|
2
2
|
//# sourceMappingURL=index.test.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.cjs.js","sources":["../../../src/components/RangeDatePickerController/index.test.tsx"],"sourcesContent":["import { render, renderHook, screen } from \"@testing-library/react\";\nimport { useForm } from \"react-hook-form\";\n\nimport { RangeDatePickerController } from \".\";\n\ndescribe(\"RangeDatePickerController component\", () => {\n it(\"renders date pickers with correct default values (date-only format)\", async () => {\n const { result } = renderHook(() => useForm());\n const { control, setValue } = result.current;\n\n render(\n <RangeDatePickerController\n control={control}\n fromDateInfo={{ name: \"fromDate\", defaultValue: \"2024-03-01\" }}\n toDateInfo={{ name: \"toDate\", defaultValue: \"2024-03-15\" }}\n dateFormat=\"yyyy-MM-dd\"\n setValue={setValue}\n />,\n );\n\n const fromDateInput = await screen.findByDisplayValue(\"2024-03-01\");\n const toDateInput = await screen.findByDisplayValue(\"2024-03-15\");\n\n expect(fromDateInput).toBeInTheDocument();\n expect(toDateInput).toBeInTheDocument();\n });\n\n it(\"renders date pickers with correct default values (datetime format)\", async () => {\n const { result } = renderHook(() => useForm());\n const { control, setValue } = result.current;\n\n render(\n <RangeDatePickerController\n control={control}\n fromDateInfo={{\n name: \"fromDate\",\n defaultValue: \"2024/03/01 00:00:00\",\n }}\n toDateInfo={{\n name: \"toDate\",\n defaultValue: \"2024/03/15 23:59:59\",\n }}\n dateFormat=\"yyyy/MM/dd HH:mm:ss\"\n setValue={setValue}\n />,\n );\n\n expect(\n await screen.findByDisplayValue(\"2024/03/01 00:00:00\"),\n ).toBeInTheDocument();\n expect(\n await screen.findByDisplayValue(\"2024/03/15 23:59:59\"),\n ).toBeInTheDocument();\n });\n});\n"],"names":["result","renderHook","useForm","control","setValue","render","jsx","RangeDatePickerController","fromDateInput","screen","toDateInput"],"mappings":"qJAKA,SAAS,sCAAuC,IAAM,CACpD,GAAG,sEAAuE,SAAY,CACpF,KAAM,CAAE,OAAAA,
|
|
1
|
+
{"version":3,"file":"index.test.cjs.js","sources":["../../../src/components/RangeDatePickerController/index.test.tsx"],"sourcesContent":["import { render, renderHook, screen } from \"@testing-library/react\";\nimport { useForm } from \"react-hook-form\";\n\nimport { RangeDatePickerController } from \".\";\n\ndescribe(\"RangeDatePickerController component\", () => {\n it(\"renders date pickers with correct default values (date-only format)\", async () => {\n const { result } = renderHook(() => useForm());\n const { control, setValue } = result.current;\n\n render(\n <RangeDatePickerController\n control={control}\n fromDateInfo={{ name: \"fromDate\", defaultValue: \"2024-03-01\" }}\n toDateInfo={{ name: \"toDate\", defaultValue: \"2024-03-15\" }}\n dateFormat=\"yyyy-MM-dd\"\n setValue={setValue}\n />,\n );\n\n const fromDateInput = await screen.findByDisplayValue(\"2024-03-01\");\n const toDateInput = await screen.findByDisplayValue(\"2024-03-15\");\n\n expect(fromDateInput).toBeInTheDocument();\n expect(toDateInput).toBeInTheDocument();\n });\n\n it(\"renders date pickers with correct default values (datetime format)\", async () => {\n const { result } = renderHook(() => useForm());\n const { control, setValue } = result.current;\n\n render(\n <RangeDatePickerController\n control={control}\n fromDateInfo={{\n name: \"fromDate\",\n defaultValue: \"2024/03/01 00:00:00\",\n }}\n toDateInfo={{\n name: \"toDate\",\n defaultValue: \"2024/03/15 23:59:59\",\n }}\n dateFormat=\"yyyy/MM/dd HH:mm:ss\"\n setValue={setValue}\n />,\n );\n\n expect(\n await screen.findByDisplayValue(\"2024/03/01 00:00:00\"),\n ).toBeInTheDocument();\n expect(\n await screen.findByDisplayValue(\"2024/03/15 23:59:59\"),\n ).toBeInTheDocument();\n });\n});\n"],"names":["result","renderHook","useForm","control","setValue","render","jsx","RangeDatePickerController","fromDateInput","screen","toDateInput"],"mappings":"qJAKA,SAAS,sCAAuC,IAAM,CACpD,GAAG,sEAAuE,SAAY,CACpF,KAAM,CAAE,OAAAA,CAAA,EAAWC,aAAW,IAAMC,EAAAA,SAAS,EACvC,CAAE,QAAAC,EAAS,SAAAC,CAAA,EAAaJ,EAAO,QAErCK,EAAAA,OACEC,EAAAA,IAACC,EAAAA,0BAAA,CACC,QAAAJ,EACA,aAAc,CAAE,KAAM,WAAY,aAAc,YAAA,EAChD,WAAY,CAAE,KAAM,SAAU,aAAc,YAAA,EAC5C,WAAW,aACX,SAAAC,CAAA,CAAA,CACF,EAGF,MAAMI,EAAgB,MAAMC,SAAO,mBAAmB,YAAY,EAC5DC,EAAc,MAAMD,SAAO,mBAAmB,YAAY,EAEhE,OAAOD,CAAa,EAAE,kBAAA,EACtB,OAAOE,CAAW,EAAE,kBAAA,CACtB,CAAC,EAED,GAAG,qEAAsE,SAAY,CACnF,KAAM,CAAE,OAAAV,CAAA,EAAWC,aAAW,IAAMC,EAAAA,SAAS,EACvC,CAAE,QAAAC,EAAS,SAAAC,CAAA,EAAaJ,EAAO,QAErCK,EAAAA,OACEC,EAAAA,IAACC,EAAAA,0BAAA,CACC,QAAAJ,EACA,aAAc,CACZ,KAAM,WACN,aAAc,qBAAA,EAEhB,WAAY,CACV,KAAM,SACN,aAAc,qBAAA,EAEhB,WAAW,sBACX,SAAAC,CAAA,CAAA,CACF,EAGF,OACE,MAAMK,EAAAA,OAAO,mBAAmB,qBAAqB,CAAA,EACrD,kBAAA,EACF,OACE,MAAMA,EAAAA,OAAO,mBAAmB,qBAAqB,CAAA,EACrD,kBAAA,CACJ,CAAC,CACH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { a as n, r as s, s as e } from "../../react.esm-
|
|
2
|
+
import { a as n, r as s, s as e } from "../../react.esm-DVhZgPrH.js";
|
|
3
3
|
import { useForm as c } from "react-hook-form";
|
|
4
4
|
import { RangeDatePickerController as l } from "./index.es.js";
|
|
5
5
|
describe("RangeDatePickerController component", () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.es.js","sources":["../../../src/components/RangeDatePickerController/index.test.tsx"],"sourcesContent":["import { render, renderHook, screen } from \"@testing-library/react\";\nimport { useForm } from \"react-hook-form\";\n\nimport { RangeDatePickerController } from \".\";\n\ndescribe(\"RangeDatePickerController component\", () => {\n it(\"renders date pickers with correct default values (date-only format)\", async () => {\n const { result } = renderHook(() => useForm());\n const { control, setValue } = result.current;\n\n render(\n <RangeDatePickerController\n control={control}\n fromDateInfo={{ name: \"fromDate\", defaultValue: \"2024-03-01\" }}\n toDateInfo={{ name: \"toDate\", defaultValue: \"2024-03-15\" }}\n dateFormat=\"yyyy-MM-dd\"\n setValue={setValue}\n />,\n );\n\n const fromDateInput = await screen.findByDisplayValue(\"2024-03-01\");\n const toDateInput = await screen.findByDisplayValue(\"2024-03-15\");\n\n expect(fromDateInput).toBeInTheDocument();\n expect(toDateInput).toBeInTheDocument();\n });\n\n it(\"renders date pickers with correct default values (datetime format)\", async () => {\n const { result } = renderHook(() => useForm());\n const { control, setValue } = result.current;\n\n render(\n <RangeDatePickerController\n control={control}\n fromDateInfo={{\n name: \"fromDate\",\n defaultValue: \"2024/03/01 00:00:00\",\n }}\n toDateInfo={{\n name: \"toDate\",\n defaultValue: \"2024/03/15 23:59:59\",\n }}\n dateFormat=\"yyyy/MM/dd HH:mm:ss\"\n setValue={setValue}\n />,\n );\n\n expect(\n await screen.findByDisplayValue(\"2024/03/01 00:00:00\"),\n ).toBeInTheDocument();\n expect(\n await screen.findByDisplayValue(\"2024/03/15 23:59:59\"),\n ).toBeInTheDocument();\n });\n});\n"],"names":["result","renderHook","useForm","control","setValue","render","jsx","RangeDatePickerController","fromDateInput","screen","toDateInput"],"mappings":";;;;AAKA,SAAS,uCAAuC,MAAM;AACpD,KAAG,uEAAuE,YAAY;AACpF,UAAM,EAAE,QAAAA,
|
|
1
|
+
{"version":3,"file":"index.test.es.js","sources":["../../../src/components/RangeDatePickerController/index.test.tsx"],"sourcesContent":["import { render, renderHook, screen } from \"@testing-library/react\";\nimport { useForm } from \"react-hook-form\";\n\nimport { RangeDatePickerController } from \".\";\n\ndescribe(\"RangeDatePickerController component\", () => {\n it(\"renders date pickers with correct default values (date-only format)\", async () => {\n const { result } = renderHook(() => useForm());\n const { control, setValue } = result.current;\n\n render(\n <RangeDatePickerController\n control={control}\n fromDateInfo={{ name: \"fromDate\", defaultValue: \"2024-03-01\" }}\n toDateInfo={{ name: \"toDate\", defaultValue: \"2024-03-15\" }}\n dateFormat=\"yyyy-MM-dd\"\n setValue={setValue}\n />,\n );\n\n const fromDateInput = await screen.findByDisplayValue(\"2024-03-01\");\n const toDateInput = await screen.findByDisplayValue(\"2024-03-15\");\n\n expect(fromDateInput).toBeInTheDocument();\n expect(toDateInput).toBeInTheDocument();\n });\n\n it(\"renders date pickers with correct default values (datetime format)\", async () => {\n const { result } = renderHook(() => useForm());\n const { control, setValue } = result.current;\n\n render(\n <RangeDatePickerController\n control={control}\n fromDateInfo={{\n name: \"fromDate\",\n defaultValue: \"2024/03/01 00:00:00\",\n }}\n toDateInfo={{\n name: \"toDate\",\n defaultValue: \"2024/03/15 23:59:59\",\n }}\n dateFormat=\"yyyy/MM/dd HH:mm:ss\"\n setValue={setValue}\n />,\n );\n\n expect(\n await screen.findByDisplayValue(\"2024/03/01 00:00:00\"),\n ).toBeInTheDocument();\n expect(\n await screen.findByDisplayValue(\"2024/03/15 23:59:59\"),\n ).toBeInTheDocument();\n });\n});\n"],"names":["result","renderHook","useForm","control","setValue","render","jsx","RangeDatePickerController","fromDateInput","screen","toDateInput"],"mappings":";;;;AAKA,SAAS,uCAAuC,MAAM;AACpD,KAAG,uEAAuE,YAAY;AACpF,UAAM,EAAE,QAAAA,EAAA,IAAWC,EAAW,MAAMC,GAAS,GACvC,EAAE,SAAAC,GAAS,UAAAC,EAAA,IAAaJ,EAAO;AAErC,IAAAK;AAAA,MACE,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,SAAAJ;AAAA,UACA,cAAc,EAAE,MAAM,YAAY,cAAc,aAAA;AAAA,UAChD,YAAY,EAAE,MAAM,UAAU,cAAc,aAAA;AAAA,UAC5C,YAAW;AAAA,UACX,UAAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAGF,UAAMI,IAAgB,MAAMC,EAAO,mBAAmB,YAAY,GAC5DC,IAAc,MAAMD,EAAO,mBAAmB,YAAY;AAEhE,WAAOD,CAAa,EAAE,kBAAA,GACtB,OAAOE,CAAW,EAAE,kBAAA;AAAA,EACtB,CAAC,GAED,GAAG,sEAAsE,YAAY;AACnF,UAAM,EAAE,QAAAV,EAAA,IAAWC,EAAW,MAAMC,GAAS,GACvC,EAAE,SAAAC,GAAS,UAAAC,EAAA,IAAaJ,EAAO;AAErC,IAAAK;AAAA,MACE,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,SAAAJ;AAAA,UACA,cAAc;AAAA,YACZ,MAAM;AAAA,YACN,cAAc;AAAA,UAAA;AAAA,UAEhB,YAAY;AAAA,YACV,MAAM;AAAA,YACN,cAAc;AAAA,UAAA;AAAA,UAEhB,YAAW;AAAA,UACX,UAAAC;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,GAGF;AAAA,MACE,MAAMK,EAAO,mBAAmB,qBAAqB;AAAA,IAAA,EACrD,kBAAA,GACF;AAAA,MACE,MAAMA,EAAO,mBAAmB,qBAAqB;AAAA,IAAA,EACrD,kBAAA;AAAA,EACJ,CAAC;AACH,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../../src/components/ReportCard/index.tsx"],"sourcesContent":["import { ReactNode } from \"react\";\nimport { Box, Card, Grid } from \"@mui/material\";\n\nimport styles from \"./index.module.scss\";\n\ntype Props = {\n value: string | ReactNode;\n label: string | ReactNode;\n labelPosition?: \"top\" | \"bottom\";\n};\n\n/**\n * ダッシュボード用のレポート表示(値の直接表示)用のカードです。\n * 項目名と値のみを表示します。\n * labelPositionで項目名の表示位置を指定できます。\n */\nexport const ReportCard = (props: Props) => {\n const { value, label, labelPosition = \"bottom\" } = props;\n return (\n <Card className={styles.reportCard}>\n <Box className={styles.reportBox}>\n <Grid>\n {labelPosition === \"bottom\" && (\n <>\n <div className={styles.reportValue}>{value}</div>\n <div className={styles.reportLabel}>{label}</div>\n </>\n )}\n {labelPosition === \"top\" && (\n <>\n <div className={styles.reportLabel}>{label}</div>\n <div className={styles.reportValue}>{value}</div>\n </>\n )}\n </Grid>\n </Box>\n </Card>\n );\n};\n\nexport default ReportCard;\n"],"names":["ReportCard","props","value","label","labelPosition","jsx","Card","styles","Box","jsxs","Grid","Fragment"],"mappings":"wUAgBaA,EAAcC,GAAiB,CAC1C,KAAM,CAAE,MAAAC,EAAO,MAAAC,EAAO,cAAAC,EAAgB,
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../src/components/ReportCard/index.tsx"],"sourcesContent":["import { ReactNode } from \"react\";\nimport { Box, Card, Grid } from \"@mui/material\";\n\nimport styles from \"./index.module.scss\";\n\ntype Props = {\n value: string | ReactNode;\n label: string | ReactNode;\n labelPosition?: \"top\" | \"bottom\";\n};\n\n/**\n * ダッシュボード用のレポート表示(値の直接表示)用のカードです。\n * 項目名と値のみを表示します。\n * labelPositionで項目名の表示位置を指定できます。\n */\nexport const ReportCard = (props: Props) => {\n const { value, label, labelPosition = \"bottom\" } = props;\n return (\n <Card className={styles.reportCard}>\n <Box className={styles.reportBox}>\n <Grid>\n {labelPosition === \"bottom\" && (\n <>\n <div className={styles.reportValue}>{value}</div>\n <div className={styles.reportLabel}>{label}</div>\n </>\n )}\n {labelPosition === \"top\" && (\n <>\n <div className={styles.reportLabel}>{label}</div>\n <div className={styles.reportValue}>{value}</div>\n </>\n )}\n </Grid>\n </Box>\n </Card>\n );\n};\n\nexport default ReportCard;\n"],"names":["ReportCard","props","value","label","labelPosition","jsx","Card","styles","Box","jsxs","Grid","Fragment"],"mappings":"wUAgBaA,EAAcC,GAAiB,CAC1C,KAAM,CAAE,MAAAC,EAAO,MAAAC,EAAO,cAAAC,EAAgB,UAAaH,EACnD,OACEI,EAAAA,IAACC,EAAAA,KAAA,CAAK,UAAWC,EAAO,WACtB,SAAAF,EAAAA,IAACG,EAAAA,IAAA,CAAI,UAAWD,EAAO,UACrB,SAAAE,OAACC,EAAAA,KAAA,CACE,SAAA,CAAAN,IAAkB,UACjBK,EAAAA,KAAAE,EAAAA,SAAA,CACE,SAAA,CAAAN,EAAAA,IAAC,MAAA,CAAI,UAAWE,EAAO,YAAc,SAAAL,EAAM,EAC3CG,EAAAA,IAAC,MAAA,CAAI,UAAWE,EAAO,YAAc,SAAAJ,CAAA,CAAM,CAAA,EAC7C,EAEDC,IAAkB,OACjBK,EAAAA,KAAAE,EAAAA,SAAA,CACE,SAAA,CAAAN,EAAAA,IAAC,MAAA,CAAI,UAAWE,EAAO,YAAc,SAAAJ,EAAM,EAC3CE,EAAAA,IAAC,MAAA,CAAI,UAAWE,EAAO,YAAc,SAAAL,CAAA,CAAM,CAAA,CAAA,CAC7C,CAAA,CAAA,CAEJ,EACF,EACF,CAEJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../../../src/components/ReportCard/index.tsx"],"sourcesContent":["import { ReactNode } from \"react\";\nimport { Box, Card, Grid } from \"@mui/material\";\n\nimport styles from \"./index.module.scss\";\n\ntype Props = {\n value: string | ReactNode;\n label: string | ReactNode;\n labelPosition?: \"top\" | \"bottom\";\n};\n\n/**\n * ダッシュボード用のレポート表示(値の直接表示)用のカードです。\n * 項目名と値のみを表示します。\n * labelPositionで項目名の表示位置を指定できます。\n */\nexport const ReportCard = (props: Props) => {\n const { value, label, labelPosition = \"bottom\" } = props;\n return (\n <Card className={styles.reportCard}>\n <Box className={styles.reportBox}>\n <Grid>\n {labelPosition === \"bottom\" && (\n <>\n <div className={styles.reportValue}>{value}</div>\n <div className={styles.reportLabel}>{label}</div>\n </>\n )}\n {labelPosition === \"top\" && (\n <>\n <div className={styles.reportLabel}>{label}</div>\n <div className={styles.reportValue}>{value}</div>\n </>\n )}\n </Grid>\n </Box>\n </Card>\n );\n};\n\nexport default ReportCard;\n"],"names":["ReportCard","props","value","label","labelPosition","jsx","Card","styles","Box","jsxs","Grid","Fragment"],"mappings":";;;;;;;GAgBaA,IAAa,CAACC,MAAiB;AAC1C,QAAM,EAAE,OAAAC,GAAO,OAAAC,GAAO,eAAAC,IAAgB,
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../src/components/ReportCard/index.tsx"],"sourcesContent":["import { ReactNode } from \"react\";\nimport { Box, Card, Grid } from \"@mui/material\";\n\nimport styles from \"./index.module.scss\";\n\ntype Props = {\n value: string | ReactNode;\n label: string | ReactNode;\n labelPosition?: \"top\" | \"bottom\";\n};\n\n/**\n * ダッシュボード用のレポート表示(値の直接表示)用のカードです。\n * 項目名と値のみを表示します。\n * labelPositionで項目名の表示位置を指定できます。\n */\nexport const ReportCard = (props: Props) => {\n const { value, label, labelPosition = \"bottom\" } = props;\n return (\n <Card className={styles.reportCard}>\n <Box className={styles.reportBox}>\n <Grid>\n {labelPosition === \"bottom\" && (\n <>\n <div className={styles.reportValue}>{value}</div>\n <div className={styles.reportLabel}>{label}</div>\n </>\n )}\n {labelPosition === \"top\" && (\n <>\n <div className={styles.reportLabel}>{label}</div>\n <div className={styles.reportValue}>{value}</div>\n </>\n )}\n </Grid>\n </Box>\n </Card>\n );\n};\n\nexport default ReportCard;\n"],"names":["ReportCard","props","value","label","labelPosition","jsx","Card","styles","Box","jsxs","Grid","Fragment"],"mappings":";;;;;;;GAgBaA,IAAa,CAACC,MAAiB;AAC1C,QAAM,EAAE,OAAAC,GAAO,OAAAC,GAAO,eAAAC,IAAgB,aAAaH;AACnD,SACE,gBAAAI,EAACC,GAAA,EAAK,WAAWC,EAAO,YACtB,UAAA,gBAAAF,EAACG,GAAA,EAAI,WAAWD,EAAO,WACrB,UAAA,gBAAAE,EAACC,GAAA,EACE,UAAA;AAAA,IAAAN,MAAkB,YACjB,gBAAAK,EAAAE,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAN,EAAC,OAAA,EAAI,WAAWE,EAAO,aAAc,UAAAL,GAAM;AAAA,MAC3C,gBAAAG,EAAC,OAAA,EAAI,WAAWE,EAAO,aAAc,UAAAJ,EAAA,CAAM;AAAA,IAAA,GAC7C;AAAA,IAEDC,MAAkB,SACjB,gBAAAK,EAAAE,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAN,EAAC,OAAA,EAAI,WAAWE,EAAO,aAAc,UAAAJ,GAAM;AAAA,MAC3C,gBAAAE,EAAC,OAAA,EAAI,WAAWE,EAAO,aAAc,UAAAL,EAAA,CAAM;AAAA,IAAA,EAAA,CAC7C;AAAA,EAAA,EAAA,CAEJ,GACF,GACF;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const o=require("react/jsx-runtime"),s=require("@mui/material"),t=require("../../react.esm-
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),s=require("@mui/material"),t=require("../../react.esm-BcRJ42eI.cjs"),a=require("./index.cjs.js");describe("ReportCard component",()=>{it("renders ReportCard component with given label string and value string",async()=>{t.render(o.jsx(a.ReportCard,{value:"値",label:"ラベル"}));const r=t.screen.getByText("値");expect(r).toBeInTheDocument();const e=t.screen.getByText("ラベル");expect(e).toBeInTheDocument()}),it("renders ReportCard component with given label element and value element",async()=>{t.render(o.jsx(a.ReportCard,{value:o.jsx(s.Typography,{children:"値"}),label:o.jsx(s.Typography,{children:"ラベル"})}));const r=t.screen.getByText("値");expect(r).toBeInTheDocument();const e=t.screen.getByText("ラベル");expect(e).toBeInTheDocument()}),it("renders with label at the bottom by default",async()=>{var n;const{container:r}=t.render(o.jsx(a.ReportCard,{value:"値",label:"ラベル"})),e=(n=r.querySelector(".MuiGrid-root"))==null?void 0:n.children;expect(e==null?void 0:e[0]).toHaveClass("reportValue"),expect(e==null?void 0:e[1]).toHaveClass("reportLabel")}),it("renders with label at the top when labelPosition is set to top",async()=>{var n;const{container:r}=t.render(o.jsx(a.ReportCard,{value:"値",label:"ラベル",labelPosition:"top"})),e=(n=r.querySelector(".MuiGrid-root"))==null?void 0:n.children;expect(e==null?void 0:e[0]).toHaveClass("reportLabel"),expect(e==null?void 0:e[1]).toHaveClass("reportValue")})});
|
|
2
2
|
//# sourceMappingURL=index.test.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.cjs.js","sources":["../../../src/components/ReportCard/index.test.tsx"],"sourcesContent":["import { Typography } from \"@mui/material\";\nimport { render, screen } from \"@testing-library/react\";\n\nimport { ReportCard } from \".\";\n\ndescribe(\"ReportCard component\", () => {\n it(\"renders ReportCard component with given label string and value string\", async () => {\n render(<ReportCard value=\"値\" label=\"ラベル\" />);\n\n const valueElement = screen.getByText(\"値\");\n expect(valueElement).toBeInTheDocument();\n\n const labelElement = screen.getByText(\"ラベル\");\n expect(labelElement).toBeInTheDocument();\n });\n\n it(\"renders ReportCard component with given label element and value element\", async () => {\n render(\n <ReportCard\n value={<Typography>値</Typography>}\n label={<Typography>ラベル</Typography>}\n />,\n );\n\n const valueElement = screen.getByText(\"値\");\n expect(valueElement).toBeInTheDocument();\n\n const labelElement = screen.getByText(\"ラベル\");\n expect(labelElement).toBeInTheDocument();\n });\n\n it(\"renders with label at the bottom by default\", async () => {\n const { container } = render(<ReportCard value=\"値\" label=\"ラベル\" />);\n const children = container.querySelector(\".MuiGrid-root\")?.children;\n expect(children?.[0]).toHaveClass(\"reportValue\");\n expect(children?.[1]).toHaveClass(\"reportLabel\");\n });\n\n it(\"renders with label at the top when labelPosition is set to top\", async () => {\n const { container } = render(\n <ReportCard value=\"値\" label=\"ラベル\" labelPosition=\"top\" />,\n );\n const children = container.querySelector(\".MuiGrid-root\")?.children;\n expect(children?.[0]).toHaveClass(\"reportLabel\");\n expect(children?.[1]).toHaveClass(\"reportValue\");\n });\n});\n"],"names":["render","ReportCard","valueElement","screen","labelElement","jsx","Typography","container","children","_a"],"mappings":"mJAKA,SAAS,uBAAwB,IAAM,CACrC,GAAG,wEAAyE,SAAY,CACtFA,eAAQC,EAAAA,
|
|
1
|
+
{"version":3,"file":"index.test.cjs.js","sources":["../../../src/components/ReportCard/index.test.tsx"],"sourcesContent":["import { Typography } from \"@mui/material\";\nimport { render, screen } from \"@testing-library/react\";\n\nimport { ReportCard } from \".\";\n\ndescribe(\"ReportCard component\", () => {\n it(\"renders ReportCard component with given label string and value string\", async () => {\n render(<ReportCard value=\"値\" label=\"ラベル\" />);\n\n const valueElement = screen.getByText(\"値\");\n expect(valueElement).toBeInTheDocument();\n\n const labelElement = screen.getByText(\"ラベル\");\n expect(labelElement).toBeInTheDocument();\n });\n\n it(\"renders ReportCard component with given label element and value element\", async () => {\n render(\n <ReportCard\n value={<Typography>値</Typography>}\n label={<Typography>ラベル</Typography>}\n />,\n );\n\n const valueElement = screen.getByText(\"値\");\n expect(valueElement).toBeInTheDocument();\n\n const labelElement = screen.getByText(\"ラベル\");\n expect(labelElement).toBeInTheDocument();\n });\n\n it(\"renders with label at the bottom by default\", async () => {\n const { container } = render(<ReportCard value=\"値\" label=\"ラベル\" />);\n const children = container.querySelector(\".MuiGrid-root\")?.children;\n expect(children?.[0]).toHaveClass(\"reportValue\");\n expect(children?.[1]).toHaveClass(\"reportLabel\");\n });\n\n it(\"renders with label at the top when labelPosition is set to top\", async () => {\n const { container } = render(\n <ReportCard value=\"値\" label=\"ラベル\" labelPosition=\"top\" />,\n );\n const children = container.querySelector(\".MuiGrid-root\")?.children;\n expect(children?.[0]).toHaveClass(\"reportLabel\");\n expect(children?.[1]).toHaveClass(\"reportValue\");\n });\n});\n"],"names":["render","ReportCard","valueElement","screen","labelElement","jsx","Typography","container","children","_a"],"mappings":"mJAKA,SAAS,uBAAwB,IAAM,CACrC,GAAG,wEAAyE,SAAY,CACtFA,eAAQC,EAAAA,WAAA,CAAW,MAAM,IAAI,MAAM,MAAM,CAAE,EAE3C,MAAMC,EAAeC,EAAAA,OAAO,UAAU,GAAG,EACzC,OAAOD,CAAY,EAAE,kBAAA,EAErB,MAAME,EAAeD,EAAAA,OAAO,UAAU,KAAK,EAC3C,OAAOC,CAAY,EAAE,kBAAA,CACvB,CAAC,EAED,GAAG,0EAA2E,SAAY,CACxFJ,EAAAA,OACEK,EAAAA,IAACJ,EAAAA,WAAA,CACC,MAAOI,EAAAA,IAACC,EAAAA,WAAA,CAAW,SAAA,GAAA,CAAC,EACpB,MAAOD,EAAAA,IAACC,EAAAA,WAAA,CAAW,SAAA,KAAA,CAAG,CAAA,CAAA,CACxB,EAGF,MAAMJ,EAAeC,EAAAA,OAAO,UAAU,GAAG,EACzC,OAAOD,CAAY,EAAE,kBAAA,EAErB,MAAME,EAAeD,EAAAA,OAAO,UAAU,KAAK,EAC3C,OAAOC,CAAY,EAAE,kBAAA,CACvB,CAAC,EAED,GAAG,8CAA+C,SAAY,OAC5D,KAAM,CAAE,UAAAG,CAAA,EAAcP,EAAAA,OAAOK,MAACJ,EAAAA,YAAW,MAAM,IAAI,MAAM,KAAA,CAAM,CAAE,EAC3DO,GAAWC,EAAAF,EAAU,cAAc,eAAe,IAAvC,YAAAE,EAA0C,SAC3D,OAAOD,GAAA,YAAAA,EAAW,EAAE,EAAE,YAAY,aAAa,EAC/C,OAAOA,GAAA,YAAAA,EAAW,EAAE,EAAE,YAAY,aAAa,CACjD,CAAC,EAED,GAAG,iEAAkE,SAAY,OAC/E,KAAM,CAAE,UAAAD,GAAcP,EAAAA,aACnBC,EAAAA,WAAA,CAAW,MAAM,IAAI,MAAM,MAAM,cAAc,KAAA,CAAM,CAAA,EAElDO,GAAWC,EAAAF,EAAU,cAAc,eAAe,IAAvC,YAAAE,EAA0C,SAC3D,OAAOD,GAAA,YAAAA,EAAW,EAAE,EAAE,YAAY,aAAa,EAC/C,OAAOA,GAAA,YAAAA,EAAW,EAAE,EAAE,YAAY,aAAa,CACjD,CAAC,CACH,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { Typography as s } from "@mui/material";
|
|
3
|
-
import { r as n, s as r } from "../../react.esm-
|
|
3
|
+
import { r as n, s as r } from "../../react.esm-DVhZgPrH.js";
|
|
4
4
|
import { ReportCard as l } from "./index.es.js";
|
|
5
5
|
describe("ReportCard component", () => {
|
|
6
6
|
it("renders ReportCard component with given label string and value string", async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.es.js","sources":["../../../src/components/ReportCard/index.test.tsx"],"sourcesContent":["import { Typography } from \"@mui/material\";\nimport { render, screen } from \"@testing-library/react\";\n\nimport { ReportCard } from \".\";\n\ndescribe(\"ReportCard component\", () => {\n it(\"renders ReportCard component with given label string and value string\", async () => {\n render(<ReportCard value=\"値\" label=\"ラベル\" />);\n\n const valueElement = screen.getByText(\"値\");\n expect(valueElement).toBeInTheDocument();\n\n const labelElement = screen.getByText(\"ラベル\");\n expect(labelElement).toBeInTheDocument();\n });\n\n it(\"renders ReportCard component with given label element and value element\", async () => {\n render(\n <ReportCard\n value={<Typography>値</Typography>}\n label={<Typography>ラベル</Typography>}\n />,\n );\n\n const valueElement = screen.getByText(\"値\");\n expect(valueElement).toBeInTheDocument();\n\n const labelElement = screen.getByText(\"ラベル\");\n expect(labelElement).toBeInTheDocument();\n });\n\n it(\"renders with label at the bottom by default\", async () => {\n const { container } = render(<ReportCard value=\"値\" label=\"ラベル\" />);\n const children = container.querySelector(\".MuiGrid-root\")?.children;\n expect(children?.[0]).toHaveClass(\"reportValue\");\n expect(children?.[1]).toHaveClass(\"reportLabel\");\n });\n\n it(\"renders with label at the top when labelPosition is set to top\", async () => {\n const { container } = render(\n <ReportCard value=\"値\" label=\"ラベル\" labelPosition=\"top\" />,\n );\n const children = container.querySelector(\".MuiGrid-root\")?.children;\n expect(children?.[0]).toHaveClass(\"reportLabel\");\n expect(children?.[1]).toHaveClass(\"reportValue\");\n });\n});\n"],"names":["render","ReportCard","valueElement","screen","labelElement","jsx","Typography","container","children","_a"],"mappings":";;;;AAKA,SAAS,wBAAwB,MAAM;AACrC,KAAG,yEAAyE,YAAY;AACtF,IAAAA,oBAAQC,
|
|
1
|
+
{"version":3,"file":"index.test.es.js","sources":["../../../src/components/ReportCard/index.test.tsx"],"sourcesContent":["import { Typography } from \"@mui/material\";\nimport { render, screen } from \"@testing-library/react\";\n\nimport { ReportCard } from \".\";\n\ndescribe(\"ReportCard component\", () => {\n it(\"renders ReportCard component with given label string and value string\", async () => {\n render(<ReportCard value=\"値\" label=\"ラベル\" />);\n\n const valueElement = screen.getByText(\"値\");\n expect(valueElement).toBeInTheDocument();\n\n const labelElement = screen.getByText(\"ラベル\");\n expect(labelElement).toBeInTheDocument();\n });\n\n it(\"renders ReportCard component with given label element and value element\", async () => {\n render(\n <ReportCard\n value={<Typography>値</Typography>}\n label={<Typography>ラベル</Typography>}\n />,\n );\n\n const valueElement = screen.getByText(\"値\");\n expect(valueElement).toBeInTheDocument();\n\n const labelElement = screen.getByText(\"ラベル\");\n expect(labelElement).toBeInTheDocument();\n });\n\n it(\"renders with label at the bottom by default\", async () => {\n const { container } = render(<ReportCard value=\"値\" label=\"ラベル\" />);\n const children = container.querySelector(\".MuiGrid-root\")?.children;\n expect(children?.[0]).toHaveClass(\"reportValue\");\n expect(children?.[1]).toHaveClass(\"reportLabel\");\n });\n\n it(\"renders with label at the top when labelPosition is set to top\", async () => {\n const { container } = render(\n <ReportCard value=\"値\" label=\"ラベル\" labelPosition=\"top\" />,\n );\n const children = container.querySelector(\".MuiGrid-root\")?.children;\n expect(children?.[0]).toHaveClass(\"reportLabel\");\n expect(children?.[1]).toHaveClass(\"reportValue\");\n });\n});\n"],"names":["render","ReportCard","valueElement","screen","labelElement","jsx","Typography","container","children","_a"],"mappings":";;;;AAKA,SAAS,wBAAwB,MAAM;AACrC,KAAG,yEAAyE,YAAY;AACtF,IAAAA,oBAAQC,GAAA,EAAW,OAAM,KAAI,OAAM,OAAM,CAAE;AAE3C,UAAMC,IAAeC,EAAO,UAAU,GAAG;AACzC,WAAOD,CAAY,EAAE,kBAAA;AAErB,UAAME,IAAeD,EAAO,UAAU,KAAK;AAC3C,WAAOC,CAAY,EAAE,kBAAA;AAAA,EACvB,CAAC,GAED,GAAG,2EAA2E,YAAY;AACxF,IAAAJ;AAAA,MACE,gBAAAK;AAAA,QAACJ;AAAA,QAAA;AAAA,UACC,OAAO,gBAAAI,EAACC,GAAA,EAAW,UAAA,IAAA,CAAC;AAAA,UACpB,OAAO,gBAAAD,EAACC,GAAA,EAAW,UAAA,MAAA,CAAG;AAAA,QAAA;AAAA,MAAA;AAAA,IACxB;AAGF,UAAMJ,IAAeC,EAAO,UAAU,GAAG;AACzC,WAAOD,CAAY,EAAE,kBAAA;AAErB,UAAME,IAAeD,EAAO,UAAU,KAAK;AAC3C,WAAOC,CAAY,EAAE,kBAAA;AAAA,EACvB,CAAC,GAED,GAAG,+CAA+C,YAAY;;AAC5D,UAAM,EAAE,WAAAG,EAAA,IAAcP,EAAO,gBAAAK,EAACJ,KAAW,OAAM,KAAI,OAAM,MAAA,CAAM,CAAE,GAC3DO,KAAWC,IAAAF,EAAU,cAAc,eAAe,MAAvC,gBAAAE,EAA0C;AAC3D,WAAOD,KAAA,gBAAAA,EAAW,EAAE,EAAE,YAAY,aAAa,GAC/C,OAAOA,KAAA,gBAAAA,EAAW,EAAE,EAAE,YAAY,aAAa;AAAA,EACjD,CAAC,GAED,GAAG,kEAAkE,YAAY;;AAC/E,UAAM,EAAE,WAAAD,MAAcP;AAAA,wBACnBC,GAAA,EAAW,OAAM,KAAI,OAAM,OAAM,eAAc,MAAA,CAAM;AAAA,IAAA,GAElDO,KAAWC,IAAAF,EAAU,cAAc,eAAe,MAAvC,gBAAAE,EAA0C;AAC3D,WAAOD,KAAA,gBAAAA,EAAW,EAAE,EAAE,YAAY,aAAa,GAC/C,OAAOA,KAAA,gBAAAA,EAAW,EAAE,EAAE,YAAY,aAAa;AAAA,EACjD,CAAC;AACH,CAAC;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('../../assets/index8.css');const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require('../../assets/index8.css');const a=require("react/jsx-runtime"),j=require("react"),v=require("@mui/material"),e=require("chart.js"),_=require("react-chartjs-2"),C="_chart_15x7v_1",L="_reportBox_15x7v_7",R="_nodata_15x7v_11",o={chart:C,reportBox:L,nodata:R};e.Chart.register(e.CategoryScale,e.LinearScale,e.PointElement,e.LineElement,e.Title,e.Tooltip,e.Legend);const d=u=>{const{dataList:s,xLabel:p="",yLabel:h="",labelKey:l,valueKey:i,borderColor:c="#ff6384",chartMargin:r={top:0,right:20,bottom:20,left:10},tooltipFormatter:f=(t,n)=>[String(t),String(n)],isLoading:x}=u,b=j.useRef(null),g={responsive:!0,aspectRatio:2,maintainAspectRatio:!1,animation:{delay:200},transitions:{resize:{animations:{x:{from:0},y:{from:0}}},show:{animations:{x:{from:0},y:{from:0}}}},layout:{padding:{left:r.left,right:r.right,top:r.top,bottom:r.bottom}},plugins:{legend:{display:!1,position:"top"},title:{display:!1},tooltip:{callbacks:{label:t=>{const n=t.dataset.label||"";return f(t.parsed.y,n).reverse().join("")}}}},scales:{x:{title:{display:!0,text:p}},y:{beginAtZero:!0,title:{display:!0,text:h}}}},y={labels:s.map(t=>{if(typeof t=="object"&&t!==null&&l in t)return t[l];throw new Error("Invalid data structure")}),datasets:[{label:"",data:s.map(t=>{if(typeof t=="object"&&t!==null&&i in t)return t[i];throw new Error("Invalid data structure")}),borderColor:c,backgroundColor:c,tension:.4}]},m=()=>x?a.jsx("div",{className:o.nodata,children:"loading..."}):s.length===0?a.jsx("div",{className:o.nodata,children:"NO DATA"}):a.jsx(_.Line,{ref:b,options:g,data:y});return a.jsx(v.Box,{className:o.reportBox,children:a.jsx("div",{className:o.chart,children:a.jsx(m,{})})})};exports.ReportChart=d;exports.default=d;
|
|
2
2
|
//# sourceMappingURL=index.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../../../src/components/ReportChart/index.tsx"],"sourcesContent":["import { useRef } from \"react\";\nimport { Box } from \"@mui/material\";\nimport {\n CategoryScale,\n Chart as ChartJS,\n Tooltip as ChartJSTooltip,\n Legend,\n LinearScale,\n LineElement,\n PointElement,\n Title,\n TooltipItem,\n} from \"chart.js\";\nimport { Line as LineChartJS } from \"react-chartjs-2\";\n\nimport styles from \"./index.module.scss\";\n\ntype Props = {\n dataList: unknown[];\n xLabel: string;\n yLabel: string;\n labelKey: string;\n valueKey: string;\n borderColor: string;\n chartMargin?: ChartMargin;\n tooltipFormatter?: CustomToolTipFormatter;\n isLoading?: boolean;\n};\n\ntype ChartMargin = {\n top: number;\n right: number;\n bottom: number;\n left: number;\n};\n\ntype CustomToolTipFormatter = (value: unknown, label: string) => string[];\n\nChartJS.register(\n CategoryScale,\n LinearScale,\n PointElement,\n LineElement,\n Title,\n ChartJSTooltip,\n Legend,\n);\n\nexport const ReportChart = (props: Props) => {\n const {\n dataList,\n xLabel = \"\",\n yLabel = \"\",\n labelKey,\n valueKey,\n borderColor = \"#ff6384\",\n chartMargin = { top: 0, right: 20, bottom: 20, left: 10 },\n tooltipFormatter = (value: unknown, label: string) => [\n String(value),\n String(label),\n ],\n isLoading,\n } = props;\n\n const chartRef = useRef(null);\n\n const options = {\n responsive: true,\n aspectRatio: 2,\n maintainAspectRatio: false,\n animation: {\n delay: 200,\n },\n transitions: {\n resize: {\n animations: {\n x: {\n from: 0,\n },\n y: {\n from: 0,\n },\n },\n },\n show: {\n animations: {\n x: {\n from: 0,\n },\n y: {\n from: 0,\n },\n },\n },\n },\n layout: {\n padding: {\n left: chartMargin.left,\n right: chartMargin.right,\n top: chartMargin.top,\n bottom: chartMargin.bottom,\n },\n },\n plugins: {\n legend: {\n display: false,\n position: \"top\" as const,\n },\n title: {\n display: false,\n },\n tooltip: {\n callbacks: {\n label: (context: TooltipItem<\"line\">) => {\n const label = context.dataset.label || \"\";\n const ar = tooltipFormatter(context.parsed.y, label);\n const str = ar.reverse().join(\"\");\n return str;\n },\n },\n },\n },\n scales: {\n x: {\n title: {\n display: true,\n text: xLabel,\n // font: {\n // family: \"\", // フォントファミリーを指定\n // size: 30, // フォントサイズを指定\n // },\n },\n // ticks: {\n // font: {\n // family: \"Arial\", // フォントファミリーを指定\n // size: 25, // フォントサイズを指定\n // },\n // },\n },\n y: {\n beginAtZero: true,\n title: {\n display: true,\n text: yLabel,\n // font: {\n // family: \"\", // フォントファミリーを指定\n // size: 30, // フォントサイズを指定\n // },\n },\n // ticks: {\n // font: {\n // family: \"Arial\", // フォントファミリーを指定\n // size: styles.y.fontsize, // フォントサイズを指定\n // },\n // },\n },\n },\n };\n\n const chartJsData = {\n labels: dataList.map((item) => {\n if (typeof item === \"object\" && item !== null && labelKey in item) {\n return (item as { [key: string]: unknown })[labelKey];\n }\n throw new Error(\"Invalid data structure\");\n }),\n datasets: [\n {\n label: \"\",\n data: dataList.map((item) => {\n if (typeof item === \"object\" && item !== null && valueKey in item) {\n return (item as { [key: string]: unknown })[valueKey];\n }\n throw new Error(\"Invalid data structure\");\n }),\n borderColor: borderColor,\n backgroundColor: borderColor,\n tension: 0.4,\n },\n
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../../../src/components/ReportChart/index.tsx"],"sourcesContent":["import { useRef } from \"react\";\nimport { Box } from \"@mui/material\";\nimport {\n CategoryScale,\n Chart as ChartJS,\n Tooltip as ChartJSTooltip,\n Legend,\n LinearScale,\n LineElement,\n PointElement,\n Title,\n TooltipItem,\n} from \"chart.js\";\nimport { Line as LineChartJS } from \"react-chartjs-2\";\n\nimport styles from \"./index.module.scss\";\n\ntype Props = {\n dataList: unknown[];\n xLabel: string;\n yLabel: string;\n labelKey: string;\n valueKey: string;\n borderColor: string;\n chartMargin?: ChartMargin;\n tooltipFormatter?: CustomToolTipFormatter;\n isLoading?: boolean;\n};\n\ntype ChartMargin = {\n top: number;\n right: number;\n bottom: number;\n left: number;\n};\n\ntype CustomToolTipFormatter = (value: unknown, label: string) => string[];\n\nChartJS.register(\n CategoryScale,\n LinearScale,\n PointElement,\n LineElement,\n Title,\n ChartJSTooltip,\n Legend,\n);\n\nexport const ReportChart = (props: Props) => {\n const {\n dataList,\n xLabel = \"\",\n yLabel = \"\",\n labelKey,\n valueKey,\n borderColor = \"#ff6384\",\n chartMargin = { top: 0, right: 20, bottom: 20, left: 10 },\n tooltipFormatter = (value: unknown, label: string) => [\n String(value),\n String(label),\n ],\n isLoading,\n } = props;\n\n const chartRef = useRef(null);\n\n const options = {\n responsive: true,\n aspectRatio: 2,\n maintainAspectRatio: false,\n animation: {\n delay: 200,\n },\n transitions: {\n resize: {\n animations: {\n x: {\n from: 0,\n },\n y: {\n from: 0,\n },\n },\n },\n show: {\n animations: {\n x: {\n from: 0,\n },\n y: {\n from: 0,\n },\n },\n },\n },\n layout: {\n padding: {\n left: chartMargin.left,\n right: chartMargin.right,\n top: chartMargin.top,\n bottom: chartMargin.bottom,\n },\n },\n plugins: {\n legend: {\n display: false,\n position: \"top\" as const,\n },\n title: {\n display: false,\n },\n tooltip: {\n callbacks: {\n label: (context: TooltipItem<\"line\">) => {\n const label = context.dataset.label || \"\";\n const ar = tooltipFormatter(context.parsed.y, label);\n const str = ar.reverse().join(\"\");\n return str;\n },\n },\n },\n },\n scales: {\n x: {\n title: {\n display: true,\n text: xLabel,\n // font: {\n // family: \"\", // フォントファミリーを指定\n // size: 30, // フォントサイズを指定\n // },\n },\n // ticks: {\n // font: {\n // family: \"Arial\", // フォントファミリーを指定\n // size: 25, // フォントサイズを指定\n // },\n // },\n },\n y: {\n beginAtZero: true,\n title: {\n display: true,\n text: yLabel,\n // font: {\n // family: \"\", // フォントファミリーを指定\n // size: 30, // フォントサイズを指定\n // },\n },\n // ticks: {\n // font: {\n // family: \"Arial\", // フォントファミリーを指定\n // size: styles.y.fontsize, // フォントサイズを指定\n // },\n // },\n },\n },\n };\n\n const chartJsData = {\n labels: dataList.map((item) => {\n if (typeof item === \"object\" && item !== null && labelKey in item) {\n return (item as { [key: string]: unknown })[labelKey];\n }\n throw new Error(\"Invalid data structure\");\n }),\n datasets: [\n {\n label: \"\",\n data: dataList.map((item) => {\n if (typeof item === \"object\" && item !== null && valueKey in item) {\n return (item as { [key: string]: unknown })[valueKey];\n }\n throw new Error(\"Invalid data structure\");\n }),\n borderColor: borderColor,\n backgroundColor: borderColor,\n tension: 0.4,\n },\n ],\n };\n\n const ChartData = () => {\n if (isLoading) {\n return <div className={styles.nodata}>loading...</div>;\n } else if (dataList.length === 0) {\n return <div className={styles.nodata}>NO DATA</div>;\n } else {\n return (\n <LineChartJS ref={chartRef} options={options} data={chartJsData} />\n );\n }\n };\n\n return (\n <Box className={styles.reportBox}>\n <div className={styles.chart}>\n <ChartData />\n </div>\n </Box>\n );\n};\n\nexport default ReportChart;\n"],"names":["ChartJS","CategoryScale","LinearScale","PointElement","LineElement","Title","ChartJSTooltip","Legend","ReportChart","props","dataList","xLabel","yLabel","labelKey","valueKey","borderColor","chartMargin","tooltipFormatter","value","label","isLoading","chartRef","useRef","options","context","chartJsData","item","ChartData","jsx","styles","LineChartJS","Box"],"mappings":"kVAsCAA,EAAAA,MAAQ,SACNC,EAAAA,cACAC,EAAAA,YACAC,EAAAA,aACAC,EAAAA,YACAC,EAAAA,MACAC,EAAAA,QACAC,EAAAA,MACF,EAEO,MAAMC,EAAeC,GAAiB,CAC3C,KAAM,CACJ,SAAAC,EACA,OAAAC,EAAS,GACT,OAAAC,EAAS,GACT,SAAAC,EACA,SAAAC,EACA,YAAAC,EAAc,UACd,YAAAC,EAAc,CAAE,IAAK,EAAG,MAAO,GAAI,OAAQ,GAAI,KAAM,EAAA,EACrD,iBAAAC,EAAmB,CAACC,EAAgBC,IAAkB,CACpD,OAAOD,CAAK,EACZ,OAAOC,CAAK,CAAA,EAEd,UAAAC,CAAA,EACEX,EAEEY,EAAWC,EAAAA,OAAO,IAAI,EAEtBC,EAAU,CACd,WAAY,GACZ,YAAa,EACb,oBAAqB,GACrB,UAAW,CACT,MAAO,GAAA,EAET,YAAa,CACX,OAAQ,CACN,WAAY,CACV,EAAG,CACD,KAAM,CAAA,EAER,EAAG,CACD,KAAM,CAAA,CACR,CACF,EAEF,KAAM,CACJ,WAAY,CACV,EAAG,CACD,KAAM,CAAA,EAER,EAAG,CACD,KAAM,CAAA,CACR,CACF,CACF,EAEF,OAAQ,CACN,QAAS,CACP,KAAMP,EAAY,KAClB,MAAOA,EAAY,MACnB,IAAKA,EAAY,IACjB,OAAQA,EAAY,MAAA,CACtB,EAEF,QAAS,CACP,OAAQ,CACN,QAAS,GACT,SAAU,KAAA,EAEZ,MAAO,CACL,QAAS,EAAA,EAEX,QAAS,CACP,UAAW,CACT,MAAQQ,GAAiC,CACvC,MAAML,EAAQK,EAAQ,QAAQ,OAAS,GAGvC,OAFWP,EAAiBO,EAAQ,OAAO,EAAGL,CAAK,EACpC,QAAA,EAAU,KAAK,EAAE,CAElC,CAAA,CACF,CACF,EAEF,OAAQ,CACN,EAAG,CACD,MAAO,CACL,QAAS,GACT,KAAMR,CAAA,CAKR,EAQF,EAAG,CACD,YAAa,GACb,MAAO,CACL,QAAS,GACT,KAAMC,CAAA,CAKR,CAOF,CACF,EAGIa,EAAc,CAClB,OAAQf,EAAS,IAAKgB,GAAS,CAC7B,GAAI,OAAOA,GAAS,UAAYA,IAAS,MAAQb,KAAYa,EAC3D,OAAQA,EAAoCb,CAAQ,EAEtD,MAAM,IAAI,MAAM,wBAAwB,CAC1C,CAAC,EACD,SAAU,CACR,CACE,MAAO,GACP,KAAMH,EAAS,IAAKgB,GAAS,CAC3B,GAAI,OAAOA,GAAS,UAAYA,IAAS,MAAQZ,KAAYY,EAC3D,OAAQA,EAAoCZ,CAAQ,EAEtD,MAAM,IAAI,MAAM,wBAAwB,CAC1C,CAAC,EACD,YAAAC,EACA,gBAAiBA,EACjB,QAAS,EAAA,CACX,CACF,EAGIY,EAAY,IACZP,EACKQ,EAAAA,IAAC,MAAA,CAAI,UAAWC,EAAO,OAAQ,SAAA,aAAU,EACvCnB,EAAS,SAAW,EACtBkB,EAAAA,IAAC,MAAA,CAAI,UAAWC,EAAO,OAAQ,SAAA,UAAO,QAG1CC,EAAAA,KAAA,CAAY,IAAKT,EAAU,QAAAE,EAAkB,KAAME,EAAa,EAKvE,OACEG,EAAAA,IAACG,EAAAA,IAAA,CAAI,UAAWF,EAAO,UACrB,SAAAD,EAAAA,IAAC,MAAA,CAAI,UAAWC,EAAO,MACrB,SAAAD,EAAAA,IAACD,EAAA,CAAA,CAAU,EACb,EACF,CAEJ"}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as y } from "react";
|
|
3
3
|
import { Box as x } from "@mui/material";
|
|
4
|
-
import { Chart as
|
|
4
|
+
import { Chart as v, CategoryScale as _, LinearScale as L, PointElement as C, LineElement as w, Title as B, Tooltip as N, Legend as R } from "chart.js";
|
|
5
5
|
import { Line as j } from "react-chartjs-2";
|
|
6
|
-
import '../../assets/index8.css';const
|
|
7
|
-
chart:
|
|
8
|
-
reportBox:
|
|
9
|
-
nodata:
|
|
6
|
+
import '../../assets/index8.css';const A = "_chart_15x7v_1", E = "_reportBox_15x7v_7", S = "_nodata_15x7v_11", e = {
|
|
7
|
+
chart: A,
|
|
8
|
+
reportBox: E,
|
|
9
|
+
nodata: S
|
|
10
10
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
C,
|
|
11
|
+
v.register(
|
|
12
|
+
_,
|
|
14
13
|
L,
|
|
14
|
+
C,
|
|
15
15
|
w,
|
|
16
16
|
B,
|
|
17
17
|
N,
|
|
18
18
|
R
|
|
19
19
|
);
|
|
20
|
-
const
|
|
20
|
+
const J = (c) => {
|
|
21
21
|
const {
|
|
22
|
-
dataList:
|
|
23
|
-
xLabel:
|
|
22
|
+
dataList: o,
|
|
23
|
+
xLabel: d = "",
|
|
24
24
|
yLabel: p = "",
|
|
25
25
|
labelKey: l,
|
|
26
26
|
valueKey: s,
|
|
27
27
|
borderColor: i = "#ff6384",
|
|
28
|
-
chartMargin:
|
|
28
|
+
chartMargin: r = { top: 0, right: 20, bottom: 20, left: 10 },
|
|
29
29
|
tooltipFormatter: f = (t, n) => [
|
|
30
30
|
String(t),
|
|
31
31
|
String(n)
|
|
32
32
|
],
|
|
33
|
-
isLoading:
|
|
34
|
-
} =
|
|
33
|
+
isLoading: m
|
|
34
|
+
} = c, u = y(null), h = {
|
|
35
35
|
responsive: !0,
|
|
36
36
|
aspectRatio: 2,
|
|
37
37
|
maintainAspectRatio: !1,
|
|
@@ -62,10 +62,10 @@ const F = (d) => {
|
|
|
62
62
|
},
|
|
63
63
|
layout: {
|
|
64
64
|
padding: {
|
|
65
|
-
left:
|
|
66
|
-
right:
|
|
67
|
-
top:
|
|
68
|
-
bottom:
|
|
65
|
+
left: r.left,
|
|
66
|
+
right: r.right,
|
|
67
|
+
top: r.top,
|
|
68
|
+
bottom: r.bottom
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
plugins: {
|
|
@@ -89,7 +89,7 @@ const F = (d) => {
|
|
|
89
89
|
x: {
|
|
90
90
|
title: {
|
|
91
91
|
display: !0,
|
|
92
|
-
text:
|
|
92
|
+
text: d
|
|
93
93
|
// font: {
|
|
94
94
|
// family: "", // フォントファミリーを指定
|
|
95
95
|
// size: 30, // フォントサイズを指定
|
|
@@ -121,7 +121,7 @@ const F = (d) => {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
}, b = {
|
|
124
|
-
labels:
|
|
124
|
+
labels: o.map((t) => {
|
|
125
125
|
if (typeof t == "object" && t !== null && l in t)
|
|
126
126
|
return t[l];
|
|
127
127
|
throw new Error("Invalid data structure");
|
|
@@ -129,7 +129,7 @@ const F = (d) => {
|
|
|
129
129
|
datasets: [
|
|
130
130
|
{
|
|
131
131
|
label: "",
|
|
132
|
-
data:
|
|
132
|
+
data: o.map((t) => {
|
|
133
133
|
if (typeof t == "object" && t !== null && s in t)
|
|
134
134
|
return t[s];
|
|
135
135
|
throw new Error("Invalid data structure");
|
|
@@ -137,20 +137,13 @@ const F = (d) => {
|
|
|
137
137
|
borderColor: i,
|
|
138
138
|
backgroundColor: i,
|
|
139
139
|
tension: 0.4
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
label: "",
|
|
143
|
-
data: a.map(() => [70, 70, 70, 70, 70, 70, 70]),
|
|
144
|
-
borderColor: "red",
|
|
145
|
-
backgroundColor: "red",
|
|
146
|
-
tension: 0.4
|
|
147
140
|
}
|
|
148
141
|
]
|
|
149
|
-
}, g = () =>
|
|
150
|
-
return /* @__PURE__ */
|
|
142
|
+
}, g = () => m ? /* @__PURE__ */ a("div", { className: e.nodata, children: "loading..." }) : o.length === 0 ? /* @__PURE__ */ a("div", { className: e.nodata, children: "NO DATA" }) : /* @__PURE__ */ a(j, { ref: u, options: h, data: b });
|
|
143
|
+
return /* @__PURE__ */ a(x, { className: e.reportBox, children: /* @__PURE__ */ a("div", { className: e.chart, children: /* @__PURE__ */ a(g, {}) }) });
|
|
151
144
|
};
|
|
152
145
|
export {
|
|
153
|
-
|
|
154
|
-
|
|
146
|
+
J as ReportChart,
|
|
147
|
+
J as default
|
|
155
148
|
};
|
|
156
149
|
//# sourceMappingURL=index.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es.js","sources":["../../../src/components/ReportChart/index.tsx"],"sourcesContent":["import { useRef } from \"react\";\nimport { Box } from \"@mui/material\";\nimport {\n CategoryScale,\n Chart as ChartJS,\n Tooltip as ChartJSTooltip,\n Legend,\n LinearScale,\n LineElement,\n PointElement,\n Title,\n TooltipItem,\n} from \"chart.js\";\nimport { Line as LineChartJS } from \"react-chartjs-2\";\n\nimport styles from \"./index.module.scss\";\n\ntype Props = {\n dataList: unknown[];\n xLabel: string;\n yLabel: string;\n labelKey: string;\n valueKey: string;\n borderColor: string;\n chartMargin?: ChartMargin;\n tooltipFormatter?: CustomToolTipFormatter;\n isLoading?: boolean;\n};\n\ntype ChartMargin = {\n top: number;\n right: number;\n bottom: number;\n left: number;\n};\n\ntype CustomToolTipFormatter = (value: unknown, label: string) => string[];\n\nChartJS.register(\n CategoryScale,\n LinearScale,\n PointElement,\n LineElement,\n Title,\n ChartJSTooltip,\n Legend,\n);\n\nexport const ReportChart = (props: Props) => {\n const {\n dataList,\n xLabel = \"\",\n yLabel = \"\",\n labelKey,\n valueKey,\n borderColor = \"#ff6384\",\n chartMargin = { top: 0, right: 20, bottom: 20, left: 10 },\n tooltipFormatter = (value: unknown, label: string) => [\n String(value),\n String(label),\n ],\n isLoading,\n } = props;\n\n const chartRef = useRef(null);\n\n const options = {\n responsive: true,\n aspectRatio: 2,\n maintainAspectRatio: false,\n animation: {\n delay: 200,\n },\n transitions: {\n resize: {\n animations: {\n x: {\n from: 0,\n },\n y: {\n from: 0,\n },\n },\n },\n show: {\n animations: {\n x: {\n from: 0,\n },\n y: {\n from: 0,\n },\n },\n },\n },\n layout: {\n padding: {\n left: chartMargin.left,\n right: chartMargin.right,\n top: chartMargin.top,\n bottom: chartMargin.bottom,\n },\n },\n plugins: {\n legend: {\n display: false,\n position: \"top\" as const,\n },\n title: {\n display: false,\n },\n tooltip: {\n callbacks: {\n label: (context: TooltipItem<\"line\">) => {\n const label = context.dataset.label || \"\";\n const ar = tooltipFormatter(context.parsed.y, label);\n const str = ar.reverse().join(\"\");\n return str;\n },\n },\n },\n },\n scales: {\n x: {\n title: {\n display: true,\n text: xLabel,\n // font: {\n // family: \"\", // フォントファミリーを指定\n // size: 30, // フォントサイズを指定\n // },\n },\n // ticks: {\n // font: {\n // family: \"Arial\", // フォントファミリーを指定\n // size: 25, // フォントサイズを指定\n // },\n // },\n },\n y: {\n beginAtZero: true,\n title: {\n display: true,\n text: yLabel,\n // font: {\n // family: \"\", // フォントファミリーを指定\n // size: 30, // フォントサイズを指定\n // },\n },\n // ticks: {\n // font: {\n // family: \"Arial\", // フォントファミリーを指定\n // size: styles.y.fontsize, // フォントサイズを指定\n // },\n // },\n },\n },\n };\n\n const chartJsData = {\n labels: dataList.map((item) => {\n if (typeof item === \"object\" && item !== null && labelKey in item) {\n return (item as { [key: string]: unknown })[labelKey];\n }\n throw new Error(\"Invalid data structure\");\n }),\n datasets: [\n {\n label: \"\",\n data: dataList.map((item) => {\n if (typeof item === \"object\" && item !== null && valueKey in item) {\n return (item as { [key: string]: unknown })[valueKey];\n }\n throw new Error(\"Invalid data structure\");\n }),\n borderColor: borderColor,\n backgroundColor: borderColor,\n tension: 0.4,\n },\n
|
|
1
|
+
{"version":3,"file":"index.es.js","sources":["../../../src/components/ReportChart/index.tsx"],"sourcesContent":["import { useRef } from \"react\";\nimport { Box } from \"@mui/material\";\nimport {\n CategoryScale,\n Chart as ChartJS,\n Tooltip as ChartJSTooltip,\n Legend,\n LinearScale,\n LineElement,\n PointElement,\n Title,\n TooltipItem,\n} from \"chart.js\";\nimport { Line as LineChartJS } from \"react-chartjs-2\";\n\nimport styles from \"./index.module.scss\";\n\ntype Props = {\n dataList: unknown[];\n xLabel: string;\n yLabel: string;\n labelKey: string;\n valueKey: string;\n borderColor: string;\n chartMargin?: ChartMargin;\n tooltipFormatter?: CustomToolTipFormatter;\n isLoading?: boolean;\n};\n\ntype ChartMargin = {\n top: number;\n right: number;\n bottom: number;\n left: number;\n};\n\ntype CustomToolTipFormatter = (value: unknown, label: string) => string[];\n\nChartJS.register(\n CategoryScale,\n LinearScale,\n PointElement,\n LineElement,\n Title,\n ChartJSTooltip,\n Legend,\n);\n\nexport const ReportChart = (props: Props) => {\n const {\n dataList,\n xLabel = \"\",\n yLabel = \"\",\n labelKey,\n valueKey,\n borderColor = \"#ff6384\",\n chartMargin = { top: 0, right: 20, bottom: 20, left: 10 },\n tooltipFormatter = (value: unknown, label: string) => [\n String(value),\n String(label),\n ],\n isLoading,\n } = props;\n\n const chartRef = useRef(null);\n\n const options = {\n responsive: true,\n aspectRatio: 2,\n maintainAspectRatio: false,\n animation: {\n delay: 200,\n },\n transitions: {\n resize: {\n animations: {\n x: {\n from: 0,\n },\n y: {\n from: 0,\n },\n },\n },\n show: {\n animations: {\n x: {\n from: 0,\n },\n y: {\n from: 0,\n },\n },\n },\n },\n layout: {\n padding: {\n left: chartMargin.left,\n right: chartMargin.right,\n top: chartMargin.top,\n bottom: chartMargin.bottom,\n },\n },\n plugins: {\n legend: {\n display: false,\n position: \"top\" as const,\n },\n title: {\n display: false,\n },\n tooltip: {\n callbacks: {\n label: (context: TooltipItem<\"line\">) => {\n const label = context.dataset.label || \"\";\n const ar = tooltipFormatter(context.parsed.y, label);\n const str = ar.reverse().join(\"\");\n return str;\n },\n },\n },\n },\n scales: {\n x: {\n title: {\n display: true,\n text: xLabel,\n // font: {\n // family: \"\", // フォントファミリーを指定\n // size: 30, // フォントサイズを指定\n // },\n },\n // ticks: {\n // font: {\n // family: \"Arial\", // フォントファミリーを指定\n // size: 25, // フォントサイズを指定\n // },\n // },\n },\n y: {\n beginAtZero: true,\n title: {\n display: true,\n text: yLabel,\n // font: {\n // family: \"\", // フォントファミリーを指定\n // size: 30, // フォントサイズを指定\n // },\n },\n // ticks: {\n // font: {\n // family: \"Arial\", // フォントファミリーを指定\n // size: styles.y.fontsize, // フォントサイズを指定\n // },\n // },\n },\n },\n };\n\n const chartJsData = {\n labels: dataList.map((item) => {\n if (typeof item === \"object\" && item !== null && labelKey in item) {\n return (item as { [key: string]: unknown })[labelKey];\n }\n throw new Error(\"Invalid data structure\");\n }),\n datasets: [\n {\n label: \"\",\n data: dataList.map((item) => {\n if (typeof item === \"object\" && item !== null && valueKey in item) {\n return (item as { [key: string]: unknown })[valueKey];\n }\n throw new Error(\"Invalid data structure\");\n }),\n borderColor: borderColor,\n backgroundColor: borderColor,\n tension: 0.4,\n },\n ],\n };\n\n const ChartData = () => {\n if (isLoading) {\n return <div className={styles.nodata}>loading...</div>;\n } else if (dataList.length === 0) {\n return <div className={styles.nodata}>NO DATA</div>;\n } else {\n return (\n <LineChartJS ref={chartRef} options={options} data={chartJsData} />\n );\n }\n };\n\n return (\n <Box className={styles.reportBox}>\n <div className={styles.chart}>\n <ChartData />\n </div>\n </Box>\n );\n};\n\nexport default ReportChart;\n"],"names":["ChartJS","CategoryScale","LinearScale","PointElement","LineElement","Title","ChartJSTooltip","Legend","ReportChart","props","dataList","xLabel","yLabel","labelKey","valueKey","borderColor","chartMargin","tooltipFormatter","value","label","isLoading","chartRef","useRef","options","context","chartJsData","item","ChartData","jsx","styles","LineChartJS","Box"],"mappings":"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"}
|