@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,19 @@
|
|
|
1
|
+
import { DialogProps as MuiDialogProps } from '@mui/material';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
export type ConfirmDialogResult = "confirm" | "cancel";
|
|
5
|
+
type Props = {
|
|
6
|
+
/** ダイアログのタイトル */
|
|
7
|
+
dialogTitle: ReactNode;
|
|
8
|
+
/** ダイアログの内容 */
|
|
9
|
+
dialogContent: ReactNode;
|
|
10
|
+
/** ダイアログの処理ボタン(複数可) */
|
|
11
|
+
dialogActions: ReactNode;
|
|
12
|
+
/** ダイアログの表示状態 */
|
|
13
|
+
open: boolean;
|
|
14
|
+
/** 閉じた時のhandler */
|
|
15
|
+
onCloseDialog: (result: ConfirmDialogResult) => void;
|
|
16
|
+
} & MuiDialogProps;
|
|
17
|
+
/** MuiDialogを継承したコンテントのスクロール可能なDialogです。 */
|
|
18
|
+
export declare const ScrollableDialog: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export default ScrollableDialog;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsxs as s, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as d, DialogTitle as c, DialogContent as g, DialogContentText as p, DialogActions as x } from "@mui/material";
|
|
3
|
+
const h = (o) => {
|
|
4
|
+
const {
|
|
5
|
+
dialogTitle: i,
|
|
6
|
+
dialogContent: e,
|
|
7
|
+
dialogActions: a,
|
|
8
|
+
open: r,
|
|
9
|
+
onCloseDialog: t,
|
|
10
|
+
...n
|
|
11
|
+
} = o;
|
|
12
|
+
return /* @__PURE__ */ s(
|
|
13
|
+
d,
|
|
14
|
+
{
|
|
15
|
+
...n,
|
|
16
|
+
open: r,
|
|
17
|
+
onClose: () => t("cancel"),
|
|
18
|
+
scroll: "paper",
|
|
19
|
+
"aria-labelledby": "scroll-dialog-title",
|
|
20
|
+
"aria-describedby": "scroll-dialog-description",
|
|
21
|
+
children: [
|
|
22
|
+
/* @__PURE__ */ l(
|
|
23
|
+
c,
|
|
24
|
+
{
|
|
25
|
+
sx: {
|
|
26
|
+
display: "flex",
|
|
27
|
+
gap: "5px",
|
|
28
|
+
alignItems: "center"
|
|
29
|
+
},
|
|
30
|
+
children: i
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ l(g, { dividers: !0, children: /* @__PURE__ */ l(p, { tabIndex: -1, children: e }) }),
|
|
34
|
+
/* @__PURE__ */ l(x, { sx: { gap: "10px" }, children: a })
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
export {
|
|
40
|
+
h as ScrollableDialog,
|
|
41
|
+
h as default
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as e, jsxs as r, Fragment as d } from "react/jsx-runtime";
|
|
2
|
+
import { useState as g } from "react";
|
|
3
|
+
import { a as c, s as n, f as a } from "../../react.esm-C8amP77L.js";
|
|
4
|
+
import { ScrollableDialog as s } from "./index.js";
|
|
5
|
+
describe("ScrollableDialog", () => {
|
|
6
|
+
it("renders correctly", () => {
|
|
7
|
+
const t = "Test Title", o = "Test Content", i = /* @__PURE__ */ e("button", { children: "Test Action" }), { getByText: l } = c(
|
|
8
|
+
/* @__PURE__ */ e(
|
|
9
|
+
s,
|
|
10
|
+
{
|
|
11
|
+
dialogTitle: t,
|
|
12
|
+
dialogContent: o,
|
|
13
|
+
dialogActions: i,
|
|
14
|
+
open: !0,
|
|
15
|
+
onCloseDialog: () => {
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
);
|
|
20
|
+
expect(l(t)).toBeInTheDocument(), expect(l(o)).toBeInTheDocument(), expect(l("Test Action")).toBeInTheDocument();
|
|
21
|
+
}), it('calls onClose with "cancel" when the dialog is closed', () => {
|
|
22
|
+
const t = jest.fn();
|
|
23
|
+
c(
|
|
24
|
+
/* @__PURE__ */ e(
|
|
25
|
+
s,
|
|
26
|
+
{
|
|
27
|
+
open: !0,
|
|
28
|
+
dialogTitle: "Test Dialog",
|
|
29
|
+
dialogContent: "This is a test dialog.",
|
|
30
|
+
dialogActions: /* @__PURE__ */ e("button", { onClick: () => t("cancel"), children: "Cancel" }),
|
|
31
|
+
onCloseDialog: t
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
);
|
|
35
|
+
const o = n.getByRole("button", { name: /cancel/i });
|
|
36
|
+
a.click(o), expect(t).toHaveBeenCalledWith("cancel");
|
|
37
|
+
}), it("displays the dialog when the open button is clicked", () => {
|
|
38
|
+
c(/* @__PURE__ */ e(() => {
|
|
39
|
+
const [o, i] = g(!1);
|
|
40
|
+
return /* @__PURE__ */ r(d, { children: [
|
|
41
|
+
/* @__PURE__ */ e("button", { onClick: () => i(!0), children: "Open!" }),
|
|
42
|
+
/* @__PURE__ */ e(
|
|
43
|
+
s,
|
|
44
|
+
{
|
|
45
|
+
open: o,
|
|
46
|
+
dialogTitle: "Test Dialog",
|
|
47
|
+
dialogContent: "This is a test dialog.",
|
|
48
|
+
dialogActions: /* @__PURE__ */ e("button", { onClick: () => {
|
|
49
|
+
}, children: "Close" }),
|
|
50
|
+
onCloseDialog: () => {
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
] });
|
|
55
|
+
}, {})), expect(
|
|
56
|
+
n.queryByText("This is a test dialog.")
|
|
57
|
+
).not.toBeInTheDocument(), a.click(n.getByText("Open!")), expect(n.getByText("This is a test dialog.")).toBeInTheDocument();
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FieldValues, useForm } from 'react-hook-form';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
headerTitle?: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
defaultExpanded?: boolean;
|
|
8
|
+
handleSubmit: ReturnType<typeof useForm>["handleSubmit"];
|
|
9
|
+
onSubmitSearch: (data: FieldValues) => void;
|
|
10
|
+
onClickClear?: () => void;
|
|
11
|
+
};
|
|
12
|
+
export declare const SearchForm: ({ headerTitle, children, defaultExpanded, handleSubmit, onSubmitSearch, onClickClear, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default SearchForm;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import p, { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { A as f, a as v, d as x, b } from "../../AccordionSummary-B4zooGpd.js";
|
|
3
|
+
import { i as B } from "../../styled-CWju4EfZ.js";
|
|
4
|
+
import { r as S } from "../../createSvgIcon-Dj8zNxRS.js";
|
|
5
|
+
import { Button as a } from "@mui/material";
|
|
6
|
+
import { FlexButtons as C } from "../FlexButtons/index.js";
|
|
7
|
+
import '../../assets/index21.css';var o = {}, I = B;
|
|
8
|
+
Object.defineProperty(o, "__esModule", {
|
|
9
|
+
value: !0
|
|
10
|
+
});
|
|
11
|
+
var s = o.default = void 0, F = I(S()), g = p;
|
|
12
|
+
s = o.default = (0, F.default)(/* @__PURE__ */ (0, g.jsx)("path", {
|
|
13
|
+
d: "M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"
|
|
14
|
+
}), "Search");
|
|
15
|
+
const j = "_container_89suu_1", N = "_header_89suu_6", k = "_mainContent_89suu_19", q = "_searchForm_89suu_27", w = "_inputItems_89suu_33", y = "_clearButton_89suu_39", A = "_submitButton_89suu_48", t = {
|
|
16
|
+
container: j,
|
|
17
|
+
header: N,
|
|
18
|
+
mainContent: k,
|
|
19
|
+
searchForm: q,
|
|
20
|
+
inputItems: w,
|
|
21
|
+
clearButton: y,
|
|
22
|
+
submitButton: A
|
|
23
|
+
}, L = ({
|
|
24
|
+
headerTitle: c,
|
|
25
|
+
children: i,
|
|
26
|
+
defaultExpanded: u,
|
|
27
|
+
handleSubmit: l,
|
|
28
|
+
onSubmitSearch: m,
|
|
29
|
+
onClickClear: n
|
|
30
|
+
}) => {
|
|
31
|
+
const d = () => {
|
|
32
|
+
n && n();
|
|
33
|
+
}, _ = l((h) => {
|
|
34
|
+
m(h);
|
|
35
|
+
});
|
|
36
|
+
return /* @__PURE__ */ r(f, { defaultExpanded: u, className: t.container, children: [
|
|
37
|
+
/* @__PURE__ */ e(
|
|
38
|
+
v,
|
|
39
|
+
{
|
|
40
|
+
className: t.header,
|
|
41
|
+
"aria-controls": "panel-content",
|
|
42
|
+
expandIcon: /* @__PURE__ */ e(x, {}),
|
|
43
|
+
children: c || "絞り込み"
|
|
44
|
+
}
|
|
45
|
+
),
|
|
46
|
+
/* @__PURE__ */ e(b, { className: t.mainContent, children: /* @__PURE__ */ r("form", { className: t.searchForm, onSubmit: _, children: [
|
|
47
|
+
/* @__PURE__ */ e("div", { className: t.inputItems, children: i }),
|
|
48
|
+
/* @__PURE__ */ r(C, { position: "flex-end", children: [
|
|
49
|
+
/* @__PURE__ */ e(
|
|
50
|
+
a,
|
|
51
|
+
{
|
|
52
|
+
onClick: d,
|
|
53
|
+
variant: "outlined",
|
|
54
|
+
sx: {
|
|
55
|
+
p: 1,
|
|
56
|
+
background: "white",
|
|
57
|
+
color: "#6672e8",
|
|
58
|
+
borderBlockColor: "#6672e8",
|
|
59
|
+
width: "128px"
|
|
60
|
+
},
|
|
61
|
+
children: "クリア"
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ e(
|
|
65
|
+
a,
|
|
66
|
+
{
|
|
67
|
+
type: "submit",
|
|
68
|
+
variant: "contained",
|
|
69
|
+
startIcon: /* @__PURE__ */ e(s, {}),
|
|
70
|
+
sx: {
|
|
71
|
+
background: "#6672e8",
|
|
72
|
+
color: "white",
|
|
73
|
+
":hover": { background: "#6672e8" },
|
|
74
|
+
width: "128px"
|
|
75
|
+
},
|
|
76
|
+
children: "検索"
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
] })
|
|
80
|
+
] }) })
|
|
81
|
+
] });
|
|
82
|
+
};
|
|
83
|
+
export {
|
|
84
|
+
L as SearchForm,
|
|
85
|
+
L as default
|
|
86
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { UseFormRegisterReturn } from 'react-hook-form';
|
|
2
|
+
|
|
3
|
+
export type SelectBoxValue = {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string | number;
|
|
6
|
+
};
|
|
7
|
+
type Props = {
|
|
8
|
+
id?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
values: SelectBoxValue[];
|
|
11
|
+
register?: UseFormRegisterReturn;
|
|
12
|
+
errorMessage?: string;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
defaultValue?: SelectBoxValue["value"];
|
|
15
|
+
onChange?: (selectedOption: SelectBoxValue) => void;
|
|
16
|
+
};
|
|
17
|
+
export declare const SelectBox: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export default SelectBox;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { a as n, s as t } from "../../react.esm-C8amP77L.js";
|
|
3
|
+
import { s as p, S as c } from "../../index-CQDJfJT1.js";
|
|
4
|
+
describe("SelectBox component", () => {
|
|
5
|
+
const o = [
|
|
6
|
+
{ label: "Option 1", value: "option1" },
|
|
7
|
+
{ label: "Option 2", value: "option2" }
|
|
8
|
+
], a = "test-selectbox", i = "test-name";
|
|
9
|
+
it("renders the select box with correct options", () => {
|
|
10
|
+
n(/* @__PURE__ */ s(c, { id: a, name: i, values: o }));
|
|
11
|
+
const e = t.getByRole("combobox");
|
|
12
|
+
expect(e).toHaveAttribute("id", a), expect(e).toHaveAttribute("name", i), o.forEach(({ label: r, value: x }) => {
|
|
13
|
+
const l = t.getByText(r);
|
|
14
|
+
expect(l).toBeInTheDocument(), expect(l).toHaveAttribute("value", x);
|
|
15
|
+
});
|
|
16
|
+
}), it("shows error message when provided", () => {
|
|
17
|
+
const e = "Error message";
|
|
18
|
+
n(/* @__PURE__ */ s(c, { values: o, errorMessage: e }));
|
|
19
|
+
const r = t.getByText(e);
|
|
20
|
+
expect(r).toBeInTheDocument();
|
|
21
|
+
}), it("does not show error message when not provided", () => {
|
|
22
|
+
n(/* @__PURE__ */ s(c, { values: o }));
|
|
23
|
+
const e = t.queryByText(/Error message/i);
|
|
24
|
+
expect(e).not.toBeInTheDocument();
|
|
25
|
+
}), it("applies the error class to select box when errorMessage is provided", () => {
|
|
26
|
+
n(/* @__PURE__ */ s(c, { values: o, errorMessage: "Error message" }));
|
|
27
|
+
const r = t.getByRole("combobox");
|
|
28
|
+
expect(r).toHaveClass(p.error);
|
|
29
|
+
}), it("does not apply the error class to select box when errorMessage is not provided", () => {
|
|
30
|
+
n(/* @__PURE__ */ s(c, { values: o }));
|
|
31
|
+
const e = t.getByRole("combobox");
|
|
32
|
+
expect(e).not.toHaveClass(p.error);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Control } from 'react-hook-form';
|
|
2
|
+
import { SelectChangeEvent } from '@mui/material/Select/SelectInput';
|
|
3
|
+
|
|
4
|
+
export type SelectBoxOption = {
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly value: string | number;
|
|
7
|
+
};
|
|
8
|
+
type Props = {
|
|
9
|
+
control: Control;
|
|
10
|
+
name: string;
|
|
11
|
+
options: SelectBoxOption[];
|
|
12
|
+
defaultValue?: SelectBoxOption["value"][] | (SelectBoxOption["value"] | null);
|
|
13
|
+
emptyValue?: [] | null | undefined;
|
|
14
|
+
isMulti: boolean;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
onChange?: (event: SelectChangeEvent<unknown>, child: React.ReactNode) => void;
|
|
17
|
+
onClear?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
18
|
+
};
|
|
19
|
+
export declare const SelectBoxController: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export default SelectBoxController;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx as l, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { FormControl as I, Select as V, IconButton as j, MenuItem as v, FormHelperText as A } from "@mui/material";
|
|
3
|
+
import { C as B } from "../../index.esm-ChwJSgnF.js";
|
|
4
|
+
import { C as _ } from "../../index-kvi6aotO.js";
|
|
5
|
+
import '../../assets/index2.css';const F = "_placeholder_egyvt_6", S = {
|
|
6
|
+
placeholder: F
|
|
7
|
+
}, N = (h) => {
|
|
8
|
+
const {
|
|
9
|
+
control: y,
|
|
10
|
+
name: x,
|
|
11
|
+
options: t,
|
|
12
|
+
defaultValue: C,
|
|
13
|
+
isMulti: o,
|
|
14
|
+
placeholder: b,
|
|
15
|
+
emptyValue: f,
|
|
16
|
+
onChange: a,
|
|
17
|
+
onClear: i
|
|
18
|
+
} = h, s = (r) => Array.isArray(r) && r.length || !o && r;
|
|
19
|
+
return /* @__PURE__ */ l(
|
|
20
|
+
B,
|
|
21
|
+
{
|
|
22
|
+
control: y,
|
|
23
|
+
name: x,
|
|
24
|
+
defaultValue: C,
|
|
25
|
+
render: ({ field: r, fieldState: c }) => {
|
|
26
|
+
var u;
|
|
27
|
+
return /* @__PURE__ */ d(I, { error: c.invalid, children: [
|
|
28
|
+
/* @__PURE__ */ l(
|
|
29
|
+
V,
|
|
30
|
+
{
|
|
31
|
+
...r,
|
|
32
|
+
onChange: (e, n) => {
|
|
33
|
+
r.onChange(e, n), a == null || a(e, n);
|
|
34
|
+
},
|
|
35
|
+
multiple: o,
|
|
36
|
+
size: "small",
|
|
37
|
+
value: r.value ?? null,
|
|
38
|
+
displayEmpty: !0,
|
|
39
|
+
renderValue: (e) => {
|
|
40
|
+
var n;
|
|
41
|
+
if (o) {
|
|
42
|
+
if (e != null && e.length)
|
|
43
|
+
return e.map(
|
|
44
|
+
(g) => {
|
|
45
|
+
var p;
|
|
46
|
+
return (p = t.find((M) => M.value === g)) == null ? void 0 : p.label;
|
|
47
|
+
}
|
|
48
|
+
).join(", ");
|
|
49
|
+
} else if (e)
|
|
50
|
+
return (n = t.find((m) => m.value === e)) == null ? void 0 : n.label;
|
|
51
|
+
return /* @__PURE__ */ l("span", { className: S.placeholder, children: b });
|
|
52
|
+
},
|
|
53
|
+
endAdornment: /* @__PURE__ */ l(
|
|
54
|
+
j,
|
|
55
|
+
{
|
|
56
|
+
sx: {
|
|
57
|
+
visibility: s(r.value) ? "visible" : "hidden"
|
|
58
|
+
},
|
|
59
|
+
onClick: (e) => {
|
|
60
|
+
r.onChange(o ? [] : f), i == null || i(e);
|
|
61
|
+
},
|
|
62
|
+
children: /* @__PURE__ */ l(_, {})
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
sx: {
|
|
66
|
+
"& .MuiSelect-iconOutlined": {
|
|
67
|
+
display: s(r.value) ? "none" : ""
|
|
68
|
+
},
|
|
69
|
+
"&.Mui-focused .MuiIconButton-root": { color: "primary.main" }
|
|
70
|
+
},
|
|
71
|
+
children: t.map((e) => /* @__PURE__ */ d(v, { value: e.value, children: [
|
|
72
|
+
" ",
|
|
73
|
+
e.label,
|
|
74
|
+
" "
|
|
75
|
+
] }, e.value))
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ l(A, { children: (u = c.error) == null ? void 0 : u.message })
|
|
79
|
+
] });
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
};
|
|
84
|
+
export {
|
|
85
|
+
N as SelectBoxController,
|
|
86
|
+
N as default
|
|
87
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { r as p, a as u, s as d } from "../../react.esm-C8amP77L.js";
|
|
3
|
+
import { u as m } from "../../index.esm-ChwJSgnF.js";
|
|
4
|
+
import { SelectBoxController as f } from "./index.js";
|
|
5
|
+
describe("SelectBoxController component", () => {
|
|
6
|
+
it("renders select box with options and correct default value", () => {
|
|
7
|
+
const { result: n } = p(() => m()), { control: l } = n.current, s = "TestSelect", o = "Select an option", e = [
|
|
8
|
+
{ label: "Option 1", value: "option1" },
|
|
9
|
+
{ label: "Option 2", value: "option2" },
|
|
10
|
+
{ label: "Option 3", value: "option3" }
|
|
11
|
+
], i = ["option2"];
|
|
12
|
+
u(
|
|
13
|
+
/* @__PURE__ */ r(
|
|
14
|
+
f,
|
|
15
|
+
{
|
|
16
|
+
control: l,
|
|
17
|
+
name: s,
|
|
18
|
+
options: e,
|
|
19
|
+
defaultValue: i,
|
|
20
|
+
isMulti: !0,
|
|
21
|
+
placeholder: o
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
), i.forEach((t) => {
|
|
25
|
+
const c = e.find((b) => b.value === t);
|
|
26
|
+
c && expect(d.getByText(c.label)).toBeInTheDocument();
|
|
27
|
+
});
|
|
28
|
+
}), it("renders select box with options and correct default value for single select", () => {
|
|
29
|
+
const { result: n } = p(() => m()), { control: l } = n.current, s = "TestSelect", o = [
|
|
30
|
+
{ label: "Option 1", value: "option1" },
|
|
31
|
+
{ label: "Option 2", value: "option2" },
|
|
32
|
+
{ label: "Option 3", value: "option3" }
|
|
33
|
+
], e = "option2";
|
|
34
|
+
u(
|
|
35
|
+
/* @__PURE__ */ r(
|
|
36
|
+
f,
|
|
37
|
+
{
|
|
38
|
+
control: l,
|
|
39
|
+
name: s,
|
|
40
|
+
options: o,
|
|
41
|
+
defaultValue: e,
|
|
42
|
+
isMulti: !1
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
const a = o.find((t) => t.value === e);
|
|
47
|
+
if (a) {
|
|
48
|
+
const t = d.getByText(a.label);
|
|
49
|
+
expect(t).toBeInTheDocument();
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type MenuItemType = {
|
|
4
|
+
/** 操作メニューのアイコン */
|
|
5
|
+
icon: React.ReactNode;
|
|
6
|
+
/** 操作メニュー名 */
|
|
7
|
+
title: string;
|
|
8
|
+
/** ショートカットキー */
|
|
9
|
+
shortcut?: string;
|
|
10
|
+
/** メニュー下の区切り線有無 */
|
|
11
|
+
separatorLine?: boolean;
|
|
12
|
+
/** クリックした時の動作 */
|
|
13
|
+
onClick?: (event: React.MouseEvent<HTMLLIElement, MouseEvent>) => void;
|
|
14
|
+
/** クリックした時に閉じるか否か。指定がない場合はクリック時メニューが自動的に閉じます*/
|
|
15
|
+
closeWhenClick?: boolean;
|
|
16
|
+
};
|
|
17
|
+
type Props = {
|
|
18
|
+
menuItems: MenuItemType[];
|
|
19
|
+
buttonElement: ReactNode;
|
|
20
|
+
};
|
|
21
|
+
export declare const SubMenu: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export default SubMenu;
|