@jigowatts/jigowatts-ui 0.0.1-12
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/README.md +50 -0
- package/dist/AccordionSummary-B4zooGpd.js +831 -0
- package/dist/ButtonBase-pxtIu13Q.js +866 -0
- package/dist/DateTimePicker-DJSOr5wM.js +4653 -0
- package/dist/ListContext-DOVwHqy-.js +180 -0
- package/dist/MenuItem-yBaT3_db.js +470 -0
- package/dist/Paper-COvYqxZa.js +522 -0
- package/dist/Tabs-D3lJRumZ.js +1085 -0
- package/dist/_commonjsHelpers-CT_km90n.js +30 -0
- package/dist/assets/index.css +1 -0
- package/dist/assets/index10.css +1 -0
- package/dist/assets/index11.css +1 -0
- package/dist/assets/index12.css +1 -0
- package/dist/assets/index13.css +1 -0
- package/dist/assets/index14.css +1 -0
- package/dist/assets/index15.css +1 -0
- package/dist/assets/index16.css +1 -0
- package/dist/assets/index17.css +1 -0
- package/dist/assets/index18.css +1 -0
- package/dist/assets/index19.css +1 -0
- package/dist/assets/index2.css +1 -0
- package/dist/assets/index20.css +1 -0
- package/dist/assets/index21.css +1 -0
- package/dist/assets/index22.css +1 -0
- package/dist/assets/index23.css +1 -0
- package/dist/assets/index24.css +1 -0
- package/dist/assets/index25.css +1 -0
- package/dist/assets/index26.css +1 -0
- package/dist/assets/index27.css +1 -0
- package/dist/assets/index3.css +1 -0
- package/dist/assets/index4.css +1 -0
- package/dist/assets/index5.css +1 -0
- package/dist/assets/index6.css +1 -0
- package/dist/assets/index7.css +1 -0
- package/dist/assets/index8.css +1 -0
- package/dist/assets/index9.css +1 -0
- package/dist/browser-DxfwT6rn.js +656 -0
- package/dist/components/Button/index.d.ts +28 -0
- package/dist/components/Button/index.js +18 -0
- package/dist/components/Button/index.test.d.ts +1 -0
- package/dist/components/Button/index.test.js +23 -0
- package/dist/components/Card/index.d.ts +16 -0
- package/dist/components/Card/index.js +37 -0
- package/dist/components/Card/index.test.d.ts +1 -0
- package/dist/components/Card/index.test.js +35 -0
- package/dist/components/CustomLink/index.d.ts +11 -0
- package/dist/components/CustomLink/index.js +1670 -0
- package/dist/components/CustomLink/index.test.d.ts +1 -0
- package/dist/components/CustomLink/index.test.js +40 -0
- package/dist/components/DataTable/index.d.ts +28 -0
- package/dist/components/DataTable/index.js +137 -0
- package/dist/components/DataTable/index.test.d.ts +1 -0
- package/dist/components/DataTable/index.test.js +3010 -0
- package/dist/components/DatePickerController/index.d.ts +16 -0
- package/dist/components/DatePickerController/index.js +83 -0
- package/dist/components/DatePickerController/index.test.d.ts +1 -0
- package/dist/components/DatePickerController/index.test.js +24 -0
- package/dist/components/ErrorMessage/index.d.ts +5 -0
- package/dist/components/ErrorMessage/index.js +11 -0
- package/dist/components/ErrorMessage/index.test.d.ts +1 -0
- package/dist/components/ErrorMessage/index.test.js +17 -0
- package/dist/components/EvseStateLabel/index.d.ts +5 -0
- package/dist/components/EvseStateLabel/index.js +36 -0
- package/dist/components/FlexButtons/index.d.ts +9 -0
- package/dist/components/FlexButtons/index.js +13 -0
- package/dist/components/Form/index.d.ts +8 -0
- package/dist/components/Form/index.js +11 -0
- package/dist/components/Form/index.test.d.ts +1 -0
- package/dist/components/Form/index.test.js +25 -0
- package/dist/components/FormItem/index.d.ts +9 -0
- package/dist/components/FormItem/index.js +19 -0
- package/dist/components/FormItem/index.test.d.ts +1 -0
- package/dist/components/FormItem/index.test.js +15 -0
- package/dist/components/FormTitle/index.d.ts +5 -0
- package/dist/components/FormTitle/index.js +11 -0
- package/dist/components/FormTitle/index.test.d.ts +1 -0
- package/dist/components/FormTitle/index.test.js +15 -0
- package/dist/components/Input/index.d.ts +15 -0
- package/dist/components/Input/index.js +39 -0
- package/dist/components/Input/index.test.d.ts +1 -0
- package/dist/components/Input/index.test.js +39 -0
- package/dist/components/InputController/index.d.ts +20 -0
- package/dist/components/InputController/index.js +81 -0
- package/dist/components/InputController/index.test.d.ts +1 -0
- package/dist/components/InputController/index.test.js +56 -0
- package/dist/components/InputGroup/index.d.ts +7 -0
- package/dist/components/InputGroup/index.js +11 -0
- package/dist/components/InputGroup/index.test.d.ts +1 -0
- package/dist/components/InputGroup/index.test.js +15 -0
- package/dist/components/Label/index.d.ts +7 -0
- package/dist/components/Label/index.js +14 -0
- package/dist/components/Label/index.test.d.ts +1 -0
- package/dist/components/Label/index.test.js +25 -0
- package/dist/components/LabeledContent/index.d.ts +15 -0
- package/dist/components/LabeledContent/index.js +28 -0
- package/dist/components/LabeledContent/index.test.d.ts +1 -0
- package/dist/components/LabeledContent/index.test.js +19 -0
- package/dist/components/LoadingOverlay/index.d.ts +2 -0
- package/dist/components/LoadingOverlay/index.js +134 -0
- package/dist/components/LoadingOverlay/index.test.d.ts +1 -0
- package/dist/components/LoadingOverlay/index.test.js +12 -0
- package/dist/components/Map/index.d.ts +8 -0
- package/dist/components/Map/index.js +6575 -0
- package/dist/components/MaxWidthContainer/index.d.ts +13 -0
- package/dist/components/MaxWidthContainer/index.js +15 -0
- package/dist/components/MaxWidthContainer/index.test.d.ts +1 -0
- package/dist/components/MaxWidthContainer/index.test.js +24 -0
- package/dist/components/NumericFieldController/index.d.ts +53 -0
- package/dist/components/NumericFieldController/index.js +620 -0
- package/dist/components/NumericFieldController/index.test.d.ts +1 -0
- package/dist/components/NumericFieldController/index.test.js +24 -0
- package/dist/components/OfflineLabel/index.d.ts +5 -0
- package/dist/components/OfflineLabel/index.js +34 -0
- package/dist/components/PageSizeSelector/index.d.ts +15 -0
- package/dist/components/PageSizeSelector/index.js +43 -0
- package/dist/components/Pagination/index.d.ts +9 -0
- package/dist/components/Pagination/index.js +7 -0
- package/dist/components/Pagination/index.test.d.ts +1 -0
- package/dist/components/Pagination/index.test.js +34 -0
- package/dist/components/PasswordInputController/index.d.ts +17 -0
- package/dist/components/PasswordInputController/index.js +78 -0
- package/dist/components/PasswordInputController/index.test.d.ts +1 -0
- package/dist/components/PasswordInputController/index.test.js +37 -0
- package/dist/components/RadioButton/index.d.ts +13 -0
- package/dist/components/RadioButton/index.js +7 -0
- package/dist/components/RadioButton/index.test.d.ts +1 -0
- package/dist/components/RadioButton/index.test.js +38 -0
- package/dist/components/RadioGroupController/index.d.ts +15 -0
- package/dist/components/RadioGroupController/index.js +48 -0
- package/dist/components/RadioGroupController/index.test.d.ts +1 -0
- package/dist/components/RadioGroupController/index.test.js +48 -0
- package/dist/components/RangeDatePicker/index.d.ts +14 -0
- package/dist/components/RangeDatePicker/index.js +1594 -0
- package/dist/components/RangeDatePickerController/index.d.ts +21 -0
- package/dist/components/RangeDatePickerController/index.js +123 -0
- package/dist/components/RangeDatePickerController/index.test.d.ts +1 -0
- package/dist/components/RangeDatePickerController/index.test.js +24 -0
- package/dist/components/ReportCard/index.d.ts +12 -0
- package/dist/components/ReportCard/index.js +18 -0
- package/dist/components/ReportCard/index.test.d.ts +1 -0
- package/dist/components/ReportCard/index.test.js +27 -0
- package/dist/components/ReportChart/index.d.ts +22 -0
- package/dist/components/ReportChart/index.js +23101 -0
- package/dist/components/ScrollableDialog/index.d.ts +19 -0
- package/dist/components/ScrollableDialog/index.js +42 -0
- package/dist/components/ScrollableDialog/index.test.d.ts +1 -0
- package/dist/components/ScrollableDialog/index.test.js +59 -0
- package/dist/components/SearchForm/index.d.ts +13 -0
- package/dist/components/SearchForm/index.js +86 -0
- package/dist/components/SelectBox/index.d.ts +18 -0
- package/dist/components/SelectBox/index.js +7 -0
- package/dist/components/SelectBox/index.test.d.ts +1 -0
- package/dist/components/SelectBox/index.test.js +34 -0
- package/dist/components/SelectBoxController/index.d.ts +20 -0
- package/dist/components/SelectBoxController/index.js +87 -0
- package/dist/components/SelectBoxController/index.test.d.ts +1 -0
- package/dist/components/SelectBoxController/index.test.js +52 -0
- package/dist/components/SubMenu/index.d.ts +22 -0
- package/dist/components/SubMenu/index.js +278 -0
- package/dist/components/SubMenu/index.test.d.ts +1 -0
- package/dist/components/SubMenu/index.test.js +41 -0
- package/dist/components/Tabs/index.d.ts +21 -0
- package/dist/components/Tabs/index.js +100 -0
- package/dist/components/Tabs/index.test.d.ts +1 -0
- package/dist/components/Tabs/index.test.js +24 -0
- package/dist/components/Textarea/index.d.ts +18 -0
- package/dist/components/Textarea/index.js +34 -0
- package/dist/components/Textarea/index.test.d.ts +1 -0
- package/dist/components/Textarea/index.test.js +25 -0
- package/dist/components/ToggleButton/index.d.ts +16 -0
- package/dist/components/ToggleButton/index.js +39 -0
- package/dist/components/ToggleButton/index.test.d.ts +1 -0
- package/dist/components/ToggleButton/index.test.js +49 -0
- package/dist/constants/datetime.d.ts +2 -0
- package/dist/constants/datetime.js +5 -0
- package/dist/createSvgIcon-B53UOwxg.js +183 -0
- package/dist/createSvgIcon-Dj8zNxRS.js +72 -0
- package/dist/index-BLPOOjNr.js +184 -0
- package/dist/index-BOjtnFU5.js +34 -0
- package/dist/index-Bs3JCwgu.js +689 -0
- package/dist/index-CICI7n5Y.js +19688 -0
- package/dist/index-CQDJfJT1.js +50 -0
- package/dist/index-C_i0-R5C.js +393 -0
- package/dist/index-DWRHnq8_.js +42 -0
- package/dist/index-Di2gTfPF.js +25175 -0
- package/dist/index-VF82hRp0.js +2522 -0
- package/dist/index-kvi6aotO.js +39 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.esm-ChwJSgnF.js +1052 -0
- package/dist/index.js +77 -0
- package/dist/isEqual-BBhdD79C.js +667 -0
- package/dist/mergeSlotProps-J197zKan.js +63 -0
- package/dist/react.esm-C8amP77L.js +11182 -0
- package/dist/styled-CWju4EfZ.js +2702 -0
- package/dist/unsupportedProp-DZaWZqWQ.js +30 -0
- package/dist/useControlled-BQCJRJNJ.js +64 -0
- package/dist/useIsFocusVisible-BxB-Hdhb.js +124 -0
- package/dist/useSlotProps-Bh7akxXV.js +33 -0
- package/package.json +360 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SelectBoxValue } from '../SelectBox';
|
|
2
|
+
|
|
3
|
+
type PageSelectorValue = SelectBoxValue & {
|
|
4
|
+
value: number;
|
|
5
|
+
};
|
|
6
|
+
type Props = {
|
|
7
|
+
startRecordNum: number;
|
|
8
|
+
endRecordNum: number;
|
|
9
|
+
totalCount: number;
|
|
10
|
+
values?: PageSelectorValue[];
|
|
11
|
+
defaultValue?: PageSelectorValue["value"];
|
|
12
|
+
onChangePageSize?: (pageSize: number) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare const PageSizeSelector: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default PageSizeSelector;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as a, jsxs as r } from "react/jsx-runtime";
|
|
2
|
+
import { S as g } from "../../index-CQDJfJT1.js";
|
|
3
|
+
import '../../assets/index17.css';const S = "_pageSelectorWrapper_1rspl_1", f = "_pageSelectorContainer_1rspl_5", t = {
|
|
4
|
+
pageSelectorWrapper: S,
|
|
5
|
+
pageSelectorContainer: f
|
|
6
|
+
}, C = (o) => {
|
|
7
|
+
const {
|
|
8
|
+
startRecordNum: n,
|
|
9
|
+
endRecordNum: s,
|
|
10
|
+
totalCount: c,
|
|
11
|
+
values: p,
|
|
12
|
+
defaultValue: u,
|
|
13
|
+
onChangePageSize: l
|
|
14
|
+
} = o, i = p || [
|
|
15
|
+
{ label: "10件", value: 10 },
|
|
16
|
+
{ label: "50件", value: 50 },
|
|
17
|
+
{ label: "100件", value: 100 }
|
|
18
|
+
], d = (e) => {
|
|
19
|
+
l && l(e);
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ a("div", { className: t.pageSelectorWrapper, children: /* @__PURE__ */ r("div", { className: t.pageSelectorContainer, children: [
|
|
22
|
+
/* @__PURE__ */ a("p", { children: "表示件数" }),
|
|
23
|
+
/* @__PURE__ */ a(
|
|
24
|
+
g,
|
|
25
|
+
{
|
|
26
|
+
values: i,
|
|
27
|
+
defaultValue: u,
|
|
28
|
+
onChange: (e) => d(e.value)
|
|
29
|
+
}
|
|
30
|
+
),
|
|
31
|
+
/* @__PURE__ */ r("p", { children: [
|
|
32
|
+
n,
|
|
33
|
+
"-",
|
|
34
|
+
s,
|
|
35
|
+
" of ",
|
|
36
|
+
c
|
|
37
|
+
] })
|
|
38
|
+
] }) });
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
C as PageSizeSelector,
|
|
42
|
+
C as default
|
|
43
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
type Color = "default" | "white";
|
|
2
|
+
type Props = {
|
|
3
|
+
pageCount: number;
|
|
4
|
+
activePage: number;
|
|
5
|
+
onChangePage: (page: number) => void;
|
|
6
|
+
color?: Color;
|
|
7
|
+
};
|
|
8
|
+
export declare const Pagination: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default Pagination;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { a as n, s as a } from "../../react.esm-C8amP77L.js";
|
|
3
|
+
import { P as s } from "../../index-C_i0-R5C.js";
|
|
4
|
+
describe("Pagination component", () => {
|
|
5
|
+
const e = jest.fn();
|
|
6
|
+
window.scrollTo = jest.fn(), it("renders the pagination with the correct number of pages (pageCount <= 4)", () => {
|
|
7
|
+
n(
|
|
8
|
+
/* @__PURE__ */ o(
|
|
9
|
+
s,
|
|
10
|
+
{
|
|
11
|
+
pageCount: 4,
|
|
12
|
+
activePage: 0,
|
|
13
|
+
onChangePage: e
|
|
14
|
+
}
|
|
15
|
+
)
|
|
16
|
+
);
|
|
17
|
+
const i = a.getAllByRole("listitem");
|
|
18
|
+
expect(i).toHaveLength(6);
|
|
19
|
+
}), it("renders the pagination with the correct number of pages (pageCount > 4)", () => {
|
|
20
|
+
n(
|
|
21
|
+
/* @__PURE__ */ o(
|
|
22
|
+
s,
|
|
23
|
+
{
|
|
24
|
+
pageCount: 10,
|
|
25
|
+
activePage: 0,
|
|
26
|
+
onChangePage: e
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
);
|
|
30
|
+
const t = a.getAllByRole("listitem");
|
|
31
|
+
expect(t).toHaveLength(6);
|
|
32
|
+
}), it("should be accessible", async () => {
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FieldPath, PathValue, Control, FieldValues } from 'react-hook-form';
|
|
2
|
+
import { FilledInputProps, InputProps, OutlinedInputProps } from '@mui/material';
|
|
3
|
+
|
|
4
|
+
type MultilineOption = {
|
|
5
|
+
rows: number;
|
|
6
|
+
};
|
|
7
|
+
type Props<T extends FieldValues> = {
|
|
8
|
+
control: Control<T>;
|
|
9
|
+
textareaOption?: MultilineOption;
|
|
10
|
+
name: FieldPath<T>;
|
|
11
|
+
defaultValue: PathValue<T, FieldPath<T>>;
|
|
12
|
+
autoComplete?: string;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
inputProps?: Partial<FilledInputProps> | Partial<OutlinedInputProps> | Partial<InputProps>;
|
|
15
|
+
};
|
|
16
|
+
export declare const PasswordInputController: <T extends FieldValues>(props: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default PasswordInputController;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import s, { jsx as e, jsxs as _ } from "react/jsx-runtime";
|
|
2
|
+
import { useState as F } from "react";
|
|
3
|
+
import { i as n } from "../../styled-CWju4EfZ.js";
|
|
4
|
+
import { r as u } from "../../createSvgIcon-Dj8zNxRS.js";
|
|
5
|
+
import { FormControl as I, TextField as M, InputAdornment as g, IconButton as j, FormHelperText as y } from "@mui/material";
|
|
6
|
+
import { C as P } from "../../index.esm-ChwJSgnF.js";
|
|
7
|
+
var o = {}, S = n;
|
|
8
|
+
Object.defineProperty(o, "__esModule", {
|
|
9
|
+
value: !0
|
|
10
|
+
});
|
|
11
|
+
var d = o.default = void 0, $ = S(u()), k = s;
|
|
12
|
+
d = o.default = (0, $.default)(/* @__PURE__ */ (0, k.jsx)("path", {
|
|
13
|
+
d: "M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5M12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5m0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"
|
|
14
|
+
}), "Visibility");
|
|
15
|
+
var i = {}, q = n;
|
|
16
|
+
Object.defineProperty(i, "__esModule", {
|
|
17
|
+
value: !0
|
|
18
|
+
});
|
|
19
|
+
var p = i.default = void 0, R = q(u()), V = s;
|
|
20
|
+
p = i.default = (0, R.default)(/* @__PURE__ */ (0, V.jsx)("path", {
|
|
21
|
+
d: "M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7M2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2m4.31-.78 3.15 3.15.02-.16c0-1.66-1.34-3-3-3z"
|
|
22
|
+
}), "VisibilityOff");
|
|
23
|
+
const E = (c) => {
|
|
24
|
+
const { control: f, name: m, autoComplete: v, placeholder: C, defaultValue: x, inputProps: b } = c, [r, h] = F(!1), w = () => {
|
|
25
|
+
h(!r);
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ e(
|
|
28
|
+
P,
|
|
29
|
+
{
|
|
30
|
+
control: f,
|
|
31
|
+
name: m,
|
|
32
|
+
defaultValue: x,
|
|
33
|
+
render: ({ field: t, fieldState: a }) => {
|
|
34
|
+
var l;
|
|
35
|
+
return /* @__PURE__ */ _(I, { error: a.invalid, children: [
|
|
36
|
+
/* @__PURE__ */ e(
|
|
37
|
+
M,
|
|
38
|
+
{
|
|
39
|
+
...t,
|
|
40
|
+
type: r ? "text" : "password",
|
|
41
|
+
autoComplete: v,
|
|
42
|
+
placeholder: C,
|
|
43
|
+
value: t.value ?? "",
|
|
44
|
+
InputProps: {
|
|
45
|
+
...b,
|
|
46
|
+
endAdornment: t.value ? /* @__PURE__ */ e(g, { position: "end", children: /* @__PURE__ */ e(
|
|
47
|
+
j,
|
|
48
|
+
{
|
|
49
|
+
"aria-label": "toggle password visibility",
|
|
50
|
+
onClick: w,
|
|
51
|
+
edge: "end",
|
|
52
|
+
children: r ? /* @__PURE__ */ e(p, {}) : /* @__PURE__ */ e(d, {})
|
|
53
|
+
}
|
|
54
|
+
) }) : void 0
|
|
55
|
+
},
|
|
56
|
+
sx: {
|
|
57
|
+
"& .MuiInput-underline:before": {
|
|
58
|
+
borderColor: "#CCCCCC"
|
|
59
|
+
},
|
|
60
|
+
"& .MuiInputBase-root": {
|
|
61
|
+
backgroundColor: "#FFFFFF"
|
|
62
|
+
},
|
|
63
|
+
"input:-webkit-autofill": {
|
|
64
|
+
WebkitBoxShadow: "0 0 0 1000px white inset"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
/* @__PURE__ */ e(y, { children: (l = a.error) == null ? void 0 : l.message })
|
|
70
|
+
] });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
export {
|
|
76
|
+
E as PasswordInputController,
|
|
77
|
+
E as default
|
|
78
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { r as n, a, s as l, f as i } from "../../react.esm-C8amP77L.js";
|
|
3
|
+
import { u as c } from "../../index.esm-ChwJSgnF.js";
|
|
4
|
+
import { PasswordInputController as u } from "./index.js";
|
|
5
|
+
describe("PasswordInputController component", () => {
|
|
6
|
+
it("renders a password input with the correct name, autoComplete, placeholder, and default value", () => {
|
|
7
|
+
const r = n(() => c().control).result.current, o = "TestPassword", t = "Password";
|
|
8
|
+
a(
|
|
9
|
+
/* @__PURE__ */ s(
|
|
10
|
+
u,
|
|
11
|
+
{
|
|
12
|
+
control: r,
|
|
13
|
+
name: o,
|
|
14
|
+
placeholder: t,
|
|
15
|
+
defaultValue: ""
|
|
16
|
+
}
|
|
17
|
+
)
|
|
18
|
+
);
|
|
19
|
+
const e = l.getByPlaceholderText(t);
|
|
20
|
+
expect(e).toBeInTheDocument(), expect(e).toHaveAttribute("type", "password"), expect(e).toHaveAttribute("name", o), expect(e).toHaveAttribute("placeholder", t);
|
|
21
|
+
}), it("sets value to default value if input is empty", () => {
|
|
22
|
+
const r = n(() => c().control).result.current, o = "TestPassword", t = "Password";
|
|
23
|
+
a(
|
|
24
|
+
/* @__PURE__ */ s(
|
|
25
|
+
u,
|
|
26
|
+
{
|
|
27
|
+
control: r,
|
|
28
|
+
name: o,
|
|
29
|
+
placeholder: t,
|
|
30
|
+
defaultValue: "DefaultPassword"
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
const e = l.getByPlaceholderText(t);
|
|
35
|
+
expect(e).toBeInTheDocument(), i.change(e, { target: { value: "" } });
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UseFormRegisterReturn } from 'react-hook-form';
|
|
2
|
+
|
|
3
|
+
type Value = {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
};
|
|
7
|
+
type Props = {
|
|
8
|
+
values: Value[];
|
|
9
|
+
register?: UseFormRegisterReturn;
|
|
10
|
+
errorMessage?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const RadioButton: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default RadioButton;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { a as s, s as n } from "../../react.esm-C8amP77L.js";
|
|
3
|
+
import { j as c } from "../../index-Di2gTfPF.js";
|
|
4
|
+
import { s as l, R as a } from "../../index-BOjtnFU5.js";
|
|
5
|
+
describe("RadioButton component", () => {
|
|
6
|
+
const o = [
|
|
7
|
+
{ label: "Option 1", value: "option1" },
|
|
8
|
+
{ label: "Option 2", value: "option2" }
|
|
9
|
+
];
|
|
10
|
+
it("renders the radio buttons with correct labels and values", () => {
|
|
11
|
+
s(/* @__PURE__ */ r(a, { values: o })), o.forEach(({ label: e, value: t }) => {
|
|
12
|
+
const i = n.getByLabelText(e);
|
|
13
|
+
expect(i).toBeInTheDocument(), expect(i).toHaveAttribute("value", t);
|
|
14
|
+
});
|
|
15
|
+
}), it("shows error message when provided", () => {
|
|
16
|
+
const e = "Error message";
|
|
17
|
+
s(/* @__PURE__ */ r(a, { values: o, errorMessage: e }));
|
|
18
|
+
const t = n.getByText(e);
|
|
19
|
+
expect(t).toBeInTheDocument();
|
|
20
|
+
}), it("does not show error message when not provided", () => {
|
|
21
|
+
s(/* @__PURE__ */ r(a, { values: o }));
|
|
22
|
+
const e = n.queryByText(/Error message/i);
|
|
23
|
+
expect(e).not.toBeInTheDocument();
|
|
24
|
+
}), it("applies the error class to inputs when errorMessage is provided", () => {
|
|
25
|
+
s(/* @__PURE__ */ r(a, { values: o, errorMessage: "Error message" })), o.forEach(({ label: t }) => {
|
|
26
|
+
const i = n.getByLabelText(t);
|
|
27
|
+
expect(i).toHaveClass(l.error);
|
|
28
|
+
});
|
|
29
|
+
}), it("does not apply the error class to inputs when errorMessage is not provided", () => {
|
|
30
|
+
s(/* @__PURE__ */ r(a, { values: o })), o.forEach(({ label: e }) => {
|
|
31
|
+
const t = n.getByLabelText(e);
|
|
32
|
+
expect(t).not.toHaveClass(l.error);
|
|
33
|
+
});
|
|
34
|
+
}), it("should be accessible", async () => {
|
|
35
|
+
const { container: e } = s(/* @__PURE__ */ r(a, { values: o })), t = await c.axe(e);
|
|
36
|
+
expect.extend(c.toHaveNoViolations), expect(t).toHaveNoViolations();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FieldPath, FieldValues, PathValue, Control } from 'react-hook-form';
|
|
2
|
+
|
|
3
|
+
export type Option = {
|
|
4
|
+
readonly label: string;
|
|
5
|
+
readonly value: string | number;
|
|
6
|
+
};
|
|
7
|
+
type Props<T extends FieldValues> = {
|
|
8
|
+
control: Control<T>;
|
|
9
|
+
name: FieldPath<T>;
|
|
10
|
+
options: Option[];
|
|
11
|
+
required?: boolean;
|
|
12
|
+
defaultValue?: PathValue<T, FieldPath<T>>;
|
|
13
|
+
};
|
|
14
|
+
export declare const RadioGroupController: <T extends FieldValues>(props: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default RadioGroupController;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as o, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { FormControl as p, RadioGroup as c, FormControlLabel as v, Radio as b, FormHelperText as C } from "@mui/material";
|
|
3
|
+
import { C as x } from "../../index.esm-ChwJSgnF.js";
|
|
4
|
+
const f = (n) => {
|
|
5
|
+
const { control: t, name: i, options: s, required: u, defaultValue: d } = n;
|
|
6
|
+
return /* @__PURE__ */ o(
|
|
7
|
+
x,
|
|
8
|
+
{
|
|
9
|
+
control: t,
|
|
10
|
+
name: i,
|
|
11
|
+
defaultValue: d,
|
|
12
|
+
render: ({ field: r, fieldState: e }) => {
|
|
13
|
+
var a;
|
|
14
|
+
return /* @__PURE__ */ m(p, { error: e.invalid, children: [
|
|
15
|
+
/* @__PURE__ */ o(
|
|
16
|
+
c,
|
|
17
|
+
{
|
|
18
|
+
...r,
|
|
19
|
+
"aria-labelledby": "controlled-radio-buttons-group",
|
|
20
|
+
value: r.value === void 0 ? null : r.value,
|
|
21
|
+
children: s.map((l) => /* @__PURE__ */ o(
|
|
22
|
+
v,
|
|
23
|
+
{
|
|
24
|
+
value: l.value,
|
|
25
|
+
control: /* @__PURE__ */ o(b, { size: "small" }),
|
|
26
|
+
label: l.label,
|
|
27
|
+
required: u,
|
|
28
|
+
sx: {
|
|
29
|
+
// NOTE: requiredと連動したアスタリスクを非表示にします。label側で反映しているため。
|
|
30
|
+
"& .MuiFormControlLabel-asterisk": {
|
|
31
|
+
display: "none"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
l.value
|
|
36
|
+
))
|
|
37
|
+
}
|
|
38
|
+
),
|
|
39
|
+
/* @__PURE__ */ o(C, { children: (a = e.error) == null ? void 0 : a.message })
|
|
40
|
+
] });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
export {
|
|
46
|
+
f as RadioGroupController,
|
|
47
|
+
f as default
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { r as s, a as p, s as c } from "../../react.esm-C8amP77L.js";
|
|
3
|
+
import { u } from "../../index.esm-ChwJSgnF.js";
|
|
4
|
+
import { RadioGroupController as d } from "./index.js";
|
|
5
|
+
describe("RadioGroupController component", () => {
|
|
6
|
+
it("renders radio buttons with options and correct default value", () => {
|
|
7
|
+
const { result: n } = s(() => u()), { control: a } = n.current, l = "TestRadio", o = [
|
|
8
|
+
{ label: "Option 1", value: "option1" },
|
|
9
|
+
{ label: "Option 2", value: "option2" },
|
|
10
|
+
{ label: "Option 3", value: "option3" }
|
|
11
|
+
], t = "option2";
|
|
12
|
+
p(
|
|
13
|
+
/* @__PURE__ */ i(
|
|
14
|
+
d,
|
|
15
|
+
{
|
|
16
|
+
control: a,
|
|
17
|
+
name: l,
|
|
18
|
+
options: o,
|
|
19
|
+
defaultValue: t
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
const e = o.find((r) => r.value === t);
|
|
24
|
+
if (e) {
|
|
25
|
+
const r = c.getByText(e.label);
|
|
26
|
+
expect(r).toBeInTheDocument();
|
|
27
|
+
}
|
|
28
|
+
}), it("renders without default value", () => {
|
|
29
|
+
const { result: n } = s(() => u()), { control: a } = n.current, l = "TestRadio", o = [
|
|
30
|
+
{ label: "Option 1", value: "option1" },
|
|
31
|
+
{ label: "Option 2", value: "option2" },
|
|
32
|
+
{ label: "Option 3", value: "option3" }
|
|
33
|
+
];
|
|
34
|
+
p(
|
|
35
|
+
/* @__PURE__ */ i(
|
|
36
|
+
d,
|
|
37
|
+
{
|
|
38
|
+
control: a,
|
|
39
|
+
name: l,
|
|
40
|
+
options: o
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
), o.forEach((t) => {
|
|
44
|
+
const e = c.getByLabelText(t.label);
|
|
45
|
+
expect(e).not.toBeChecked();
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
+
|
|
3
|
+
export type RangeDatePickerInfo = {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
valueState: Date | null;
|
|
7
|
+
setValue: Dispatch<SetStateAction<Date | null>>;
|
|
8
|
+
};
|
|
9
|
+
type Props = {
|
|
10
|
+
fromDateInfo: RangeDatePickerInfo;
|
|
11
|
+
toDateInfo: RangeDatePickerInfo;
|
|
12
|
+
};
|
|
13
|
+
export declare const RangeDatePicker: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default RangeDatePicker;
|