@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,16 @@
|
|
|
1
|
+
import { FieldPath, UseControllerProps, FieldValues, UseFormSetValue } from 'react-hook-form';
|
|
2
|
+
|
|
3
|
+
type Props<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = UseControllerProps<TFieldValues, TName> & {
|
|
4
|
+
setValue: UseFormSetValue<TFieldValues>;
|
|
5
|
+
dateFormat: string;
|
|
6
|
+
maxDateTime?: Date;
|
|
7
|
+
minDateTime?: Date;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Date,DateTimeをを選択できるコンポーネント
|
|
11
|
+
* dateFormatに合わせてpickerViewを生成します。
|
|
12
|
+
* @param props
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
declare const DatePickerController: <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>(props: Props<TFieldValues, TName>) => JSX.Element;
|
|
16
|
+
export default DatePickerController;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { L as h, A as g, j as y, p as x } from "../../index-CICI7n5Y.js";
|
|
3
|
+
import { C as D } from "../../index.esm-ChwJSgnF.js";
|
|
4
|
+
import { j as C, D as P } from "../../DateTimePicker-DJSOr5wM.js";
|
|
5
|
+
import '../../assets/index19.css';const T = "_rangeContainer_17n2w_1", j = {
|
|
6
|
+
rangeContainer: T
|
|
7
|
+
}, L = {
|
|
8
|
+
".MuiButtonBase-root": {
|
|
9
|
+
padding: 0.5,
|
|
10
|
+
paddingLeft: 0
|
|
11
|
+
},
|
|
12
|
+
"& input::placeholder": {
|
|
13
|
+
fontSize: "x-small"
|
|
14
|
+
}
|
|
15
|
+
}, v = (l) => {
|
|
16
|
+
const {
|
|
17
|
+
defaultValue: o,
|
|
18
|
+
maxDateTime: c,
|
|
19
|
+
minDateTime: d,
|
|
20
|
+
setValue: s,
|
|
21
|
+
dateFormat: t,
|
|
22
|
+
...r
|
|
23
|
+
} = l, u = (e) => {
|
|
24
|
+
const n = e ? e instanceof Date ? e : typeof e == "string" ? x(e, t, /* @__PURE__ */ new Date()) : null : null;
|
|
25
|
+
return typeof e == "string" && s(r.name, n), n;
|
|
26
|
+
}, p = (e) => {
|
|
27
|
+
s(r.name, e ?? o, {
|
|
28
|
+
shouldDirty: !0
|
|
29
|
+
});
|
|
30
|
+
}, m = (() => {
|
|
31
|
+
const e = [];
|
|
32
|
+
return t.includes("yyyy") && e.push("year"), t.includes("MM") && e.push("month"), t.includes("dd") && e.push("day"), t.includes("HH") && e.push("hours"), t.includes("mm") && e.push("minutes"), t.includes("ss") && e.push("seconds"), e;
|
|
33
|
+
})();
|
|
34
|
+
return /* @__PURE__ */ a(
|
|
35
|
+
h,
|
|
36
|
+
{
|
|
37
|
+
dateAdapter: g,
|
|
38
|
+
adapterLocale: y,
|
|
39
|
+
localeText: C.components.MuiLocalizationProvider.defaultProps.localeText,
|
|
40
|
+
children: /* @__PURE__ */ a("div", { className: j.rangeContainer, children: /* @__PURE__ */ a(
|
|
41
|
+
D,
|
|
42
|
+
{
|
|
43
|
+
control: r.control,
|
|
44
|
+
name: r.name,
|
|
45
|
+
defaultValue: o,
|
|
46
|
+
render: ({ field: e, fieldState: n }) => {
|
|
47
|
+
var i;
|
|
48
|
+
return /* @__PURE__ */ a(
|
|
49
|
+
P,
|
|
50
|
+
{
|
|
51
|
+
...e,
|
|
52
|
+
format: t,
|
|
53
|
+
views: m,
|
|
54
|
+
sx: L,
|
|
55
|
+
value: u(e.value),
|
|
56
|
+
onChange: (f) => {
|
|
57
|
+
p(f);
|
|
58
|
+
},
|
|
59
|
+
slotProps: {
|
|
60
|
+
textField: {
|
|
61
|
+
error: !!n.error,
|
|
62
|
+
helperText: (i = n.error) == null ? void 0 : i.message,
|
|
63
|
+
fullWidth: !0
|
|
64
|
+
},
|
|
65
|
+
// NOTE: clearボタンが文字を隠していまうのでとりあえずcalendar内のもので代用
|
|
66
|
+
// field: {
|
|
67
|
+
// clearable: true,
|
|
68
|
+
// },
|
|
69
|
+
actionBar: { actions: ["clear", "accept"] }
|
|
70
|
+
},
|
|
71
|
+
maxDateTime: c,
|
|
72
|
+
minDateTime: d
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
) })
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
v as default
|
|
83
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { r as a, a as n, s } from "../../react.esm-C8amP77L.js";
|
|
3
|
+
import { u as c } from "../../index.esm-ChwJSgnF.js";
|
|
4
|
+
import m from "./index.js";
|
|
5
|
+
describe("RangeDatePickerController component", () => {
|
|
6
|
+
it("renders date pickers with correct default values", () => {
|
|
7
|
+
const { result: e } = a(() => c()), r = e.current.control;
|
|
8
|
+
n(
|
|
9
|
+
/* @__PURE__ */ o(
|
|
10
|
+
m,
|
|
11
|
+
{
|
|
12
|
+
control: r,
|
|
13
|
+
name: "fromDate",
|
|
14
|
+
defaultValue: "2024-03-01",
|
|
15
|
+
dateFormat: "yyyy-MM-dd",
|
|
16
|
+
setValue: () => {
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
);
|
|
21
|
+
const t = s.getByDisplayValue("2024-03-01");
|
|
22
|
+
expect(t).toBeInTheDocument();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import '../../assets/index6.css';const o = "_errorMessage_1x344_1", a = {
|
|
3
|
+
errorMessage: o
|
|
4
|
+
}, c = (r) => {
|
|
5
|
+
const { errorMessage: e } = r;
|
|
6
|
+
return /* @__PURE__ */ s("p", { className: a.errorMessage, children: e });
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
c as ErrorMessage,
|
|
10
|
+
c as default
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { a as o, s as c } from "../../react.esm-C8amP77L.js";
|
|
3
|
+
import { j as t } from "../../index-Di2gTfPF.js";
|
|
4
|
+
import { ErrorMessage as a } from "./index.js";
|
|
5
|
+
describe("ErrorMessage component", () => {
|
|
6
|
+
const r = "Test error message";
|
|
7
|
+
it("renders the error message", () => {
|
|
8
|
+
o(/* @__PURE__ */ s(a, { errorMessage: r }));
|
|
9
|
+
const e = c.getByText(r);
|
|
10
|
+
expect(e).toBeInTheDocument(), expect(e).toHaveClass("errorMessage");
|
|
11
|
+
}), it("should be accessible", async () => {
|
|
12
|
+
const { container: e } = o(
|
|
13
|
+
/* @__PURE__ */ s(a, { errorMessage: r })
|
|
14
|
+
), n = await t.axe(e);
|
|
15
|
+
expect.extend(t.toHaveNoViolations), expect(n).toHaveNoViolations();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { c as o } from "../../index-DWRHnq8_.js";
|
|
3
|
+
import '../../assets/index7.css';const c = "_evseStateLabel_10v1n_1", r = {
|
|
4
|
+
evseStateLabel: c
|
|
5
|
+
}, v = (s) => {
|
|
6
|
+
const { evseState: t } = s;
|
|
7
|
+
console.log(t);
|
|
8
|
+
let e, a;
|
|
9
|
+
switch (t) {
|
|
10
|
+
case 0:
|
|
11
|
+
e = "未接続", a = "#0056FD";
|
|
12
|
+
break;
|
|
13
|
+
case 1:
|
|
14
|
+
e = "接続中", a = "#24A3FF";
|
|
15
|
+
break;
|
|
16
|
+
case 2:
|
|
17
|
+
case 3:
|
|
18
|
+
e = "充電中", a = "#00B127";
|
|
19
|
+
break;
|
|
20
|
+
default:
|
|
21
|
+
e = "エラー", a = "#FF3E24";
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
return /* @__PURE__ */ l(
|
|
25
|
+
"div",
|
|
26
|
+
{
|
|
27
|
+
className: o(r.evseStateLabel),
|
|
28
|
+
style: { backgroundColor: a },
|
|
29
|
+
children: e
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
export {
|
|
34
|
+
v as EvseStateLabel,
|
|
35
|
+
v as default
|
|
36
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type Position = "flex-start" | "flex-end";
|
|
4
|
+
type Props = {
|
|
5
|
+
position: Position;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export declare const FlexButtons: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default FlexButtons;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import '../../assets/index8.css';const u = "_buttons_10vqq_1", c = {
|
|
3
|
+
buttons: u
|
|
4
|
+
}, l = (t) => {
|
|
5
|
+
const { position: s, children: n } = t, o = {
|
|
6
|
+
justifyContent: s
|
|
7
|
+
};
|
|
8
|
+
return /* @__PURE__ */ e("div", { className: c.buttons, style: o, children: n });
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
l as FlexButtons,
|
|
12
|
+
l as default
|
|
13
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import '../../assets/index9.css';const t = "_form_1fwny_1", f = {
|
|
3
|
+
form: t
|
|
4
|
+
}, c = (o) => {
|
|
5
|
+
const { onSubmit: r, children: m } = o;
|
|
6
|
+
return /* @__PURE__ */ s("form", { onSubmit: r, className: f.form, children: m });
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
c as Form,
|
|
10
|
+
c as default
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { a as i, s as c, f as l } from "../../react.esm-C8amP77L.js";
|
|
3
|
+
import { j as r } from "../../index-Di2gTfPF.js";
|
|
4
|
+
import { Form as s } from "./index.js";
|
|
5
|
+
describe("Form component", () => {
|
|
6
|
+
const o = "Test content", n = jest.fn((e) => e.preventDefault());
|
|
7
|
+
it("renders the children", () => {
|
|
8
|
+
i(
|
|
9
|
+
/* @__PURE__ */ t(s, { onSubmit: n, children: /* @__PURE__ */ t("div", { children: o }) })
|
|
10
|
+
);
|
|
11
|
+
const e = c.getByText(o);
|
|
12
|
+
expect(e).toBeInTheDocument();
|
|
13
|
+
}), it("calls the onSubmit handler when the form is submitted", () => {
|
|
14
|
+
i(
|
|
15
|
+
/* @__PURE__ */ t(s, { onSubmit: n, children: /* @__PURE__ */ t("button", { type: "submit", children: "Submit" }) })
|
|
16
|
+
);
|
|
17
|
+
const e = c.getByText("Submit");
|
|
18
|
+
l.click(e), expect(n).toHaveBeenCalledTimes(1);
|
|
19
|
+
}), it("should be accessible", async () => {
|
|
20
|
+
const { container: e } = i(
|
|
21
|
+
/* @__PURE__ */ t(s, { onSubmit: n, children: /* @__PURE__ */ t("div", { children: o }) })
|
|
22
|
+
), a = await r.axe(e);
|
|
23
|
+
expect.extend(r.toHaveNoViolations), expect(a).toHaveNoViolations();
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { c as i } from "../../index-DWRHnq8_.js";
|
|
3
|
+
import '../../assets/index10.css';const e = "_formItem_oyo9s_1", c = "_gridFirst_oyo9s_25", s = {
|
|
4
|
+
formItem: e,
|
|
5
|
+
gridFirst: c
|
|
6
|
+
}, d = (o) => {
|
|
7
|
+
const { position: r, children: t } = o;
|
|
8
|
+
return /* @__PURE__ */ m(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
className: i(s.formItem, { [s.gridFirst]: r }),
|
|
12
|
+
children: t
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
d as FormItem,
|
|
18
|
+
d as default
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { a as n, s as i } from "../../react.esm-C8amP77L.js";
|
|
3
|
+
import { j as s } from "../../index-Di2gTfPF.js";
|
|
4
|
+
import { FormItem as r } from "./index.js";
|
|
5
|
+
describe("FormItem component", () => {
|
|
6
|
+
const e = "Test content";
|
|
7
|
+
it("renders the children", () => {
|
|
8
|
+
n(/* @__PURE__ */ o(r, { children: e }));
|
|
9
|
+
const t = i.getByText(e);
|
|
10
|
+
expect(t).toBeInTheDocument();
|
|
11
|
+
}), it("should be accessible", async () => {
|
|
12
|
+
const { container: t } = n(/* @__PURE__ */ o(r, { children: e })), c = await s.axe(t);
|
|
13
|
+
expect.extend(s.toHaveNoViolations), expect(c).toHaveNoViolations();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import '../../assets/index11.css';const r = "_formTitle_qum4o_1", l = {
|
|
3
|
+
formTitle: r
|
|
4
|
+
}, i = (t) => {
|
|
5
|
+
const { title: o } = t;
|
|
6
|
+
return /* @__PURE__ */ e("div", { className: l.formTitle, children: o });
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
i as FormTitle,
|
|
10
|
+
i as default
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { a as s, s as c } from "../../react.esm-C8amP77L.js";
|
|
3
|
+
import { j as i } from "../../index-Di2gTfPF.js";
|
|
4
|
+
import { FormTitle as r } from "./index.js";
|
|
5
|
+
describe("FormTitle component", () => {
|
|
6
|
+
const e = "Test Title";
|
|
7
|
+
it("renders the title", () => {
|
|
8
|
+
s(/* @__PURE__ */ o(r, { title: e }));
|
|
9
|
+
const t = c.getByText(e);
|
|
10
|
+
expect(t).toBeInTheDocument();
|
|
11
|
+
}), it("should be accessible", async () => {
|
|
12
|
+
const { container: t } = s(/* @__PURE__ */ o(r, { title: e })), n = await i.axe(t);
|
|
13
|
+
expect.extend(i.toHaveNoViolations), expect(n).toHaveNoViolations();
|
|
14
|
+
});
|
|
15
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { UseFormRegisterReturn } from 'react-hook-form';
|
|
2
|
+
|
|
3
|
+
type Type = "text" | "number" | "password" | "email" | "tel";
|
|
4
|
+
type Props = {
|
|
5
|
+
type: Type;
|
|
6
|
+
id?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
autoComplete?: string;
|
|
9
|
+
register?: UseFormRegisterReturn;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
maxLength?: number;
|
|
12
|
+
errorMessage?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const Input: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default Input;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsxs as u, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { c as m } from "../../index-DWRHnq8_.js";
|
|
3
|
+
import '../../assets/index12.css';const _ = "_inputContainer_1gij2_1", g = "_input_1gij2_1", d = "_error_1gij2_22", j = "_errorMessage_1gij2_26", r = {
|
|
4
|
+
inputContainer: _,
|
|
5
|
+
input: g,
|
|
6
|
+
error: d,
|
|
7
|
+
errorMessage: j
|
|
8
|
+
}, h = (t) => {
|
|
9
|
+
const {
|
|
10
|
+
type: n,
|
|
11
|
+
id: o,
|
|
12
|
+
name: a,
|
|
13
|
+
autoComplete: i,
|
|
14
|
+
register: p,
|
|
15
|
+
placeholder: c,
|
|
16
|
+
maxLength: l,
|
|
17
|
+
errorMessage: e
|
|
18
|
+
} = t;
|
|
19
|
+
return /* @__PURE__ */ u("div", { className: r.inputContainer, children: [
|
|
20
|
+
/* @__PURE__ */ s(
|
|
21
|
+
"input",
|
|
22
|
+
{
|
|
23
|
+
type: n,
|
|
24
|
+
id: o,
|
|
25
|
+
name: a,
|
|
26
|
+
autoComplete: i,
|
|
27
|
+
...p,
|
|
28
|
+
className: m(r.input, { [r.error]: e }),
|
|
29
|
+
placeholder: c,
|
|
30
|
+
maxLength: l
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
e && /* @__PURE__ */ s("small", { className: r.errorMessage, children: e })
|
|
34
|
+
] });
|
|
35
|
+
};
|
|
36
|
+
export {
|
|
37
|
+
h as Input,
|
|
38
|
+
h as default
|
|
39
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { a as s, s as c } from "../../react.esm-C8amP77L.js";
|
|
3
|
+
import { Input as i } from "./index.js";
|
|
4
|
+
describe("Input component", () => {
|
|
5
|
+
it("renders an input with the correct type, id, name, autoComplete, placeholder, and maxLength", () => {
|
|
6
|
+
const t = "text", o = "test-id", r = "test-name", n = "off", a = "Test placeholder";
|
|
7
|
+
s(
|
|
8
|
+
/* @__PURE__ */ p(
|
|
9
|
+
i,
|
|
10
|
+
{
|
|
11
|
+
type: t,
|
|
12
|
+
id: o,
|
|
13
|
+
name: r,
|
|
14
|
+
autoComplete: n,
|
|
15
|
+
placeholder: a,
|
|
16
|
+
maxLength: 10
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
);
|
|
20
|
+
const e = c.getByPlaceholderText(a);
|
|
21
|
+
expect(e).toBeInTheDocument(), expect(e).toHaveAttribute("type", t), expect(e).toHaveAttribute("id", o), expect(e).toHaveAttribute("name", r), expect(e).toHaveAttribute("autoComplete", n), expect(e).toHaveAttribute("placeholder", a), expect(e).toHaveAttribute("maxLength", "10");
|
|
22
|
+
}), it("renders an input with an error message if provided", () => {
|
|
23
|
+
const t = "Test error message", o = "Test placeholder";
|
|
24
|
+
s(
|
|
25
|
+
/* @__PURE__ */ p(
|
|
26
|
+
i,
|
|
27
|
+
{
|
|
28
|
+
type: "text",
|
|
29
|
+
placeholder: o,
|
|
30
|
+
errorMessage: t
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
const r = c.getByPlaceholderText(o);
|
|
35
|
+
expect(r).toHaveClass("error");
|
|
36
|
+
const n = c.getByText(t);
|
|
37
|
+
expect(n).toBeInTheDocument();
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FieldPath, PathValue, Control, FieldValues } from 'react-hook-form';
|
|
2
|
+
import { FilledInputProps, InputProps, OutlinedInputProps } from '@mui/material';
|
|
3
|
+
|
|
4
|
+
type Type = "search" | "text" | "number" | "email" | "tel" | "textarea";
|
|
5
|
+
type MultilineOption = {
|
|
6
|
+
rows: number;
|
|
7
|
+
};
|
|
8
|
+
type Props<T extends FieldValues> = {
|
|
9
|
+
control: Control<T>;
|
|
10
|
+
type: Type;
|
|
11
|
+
textareaOption?: MultilineOption;
|
|
12
|
+
name: FieldPath<T>;
|
|
13
|
+
defaultValue?: PathValue<T, FieldPath<T>>;
|
|
14
|
+
emptyValue?: "" | null | undefined;
|
|
15
|
+
autoComplete?: string;
|
|
16
|
+
placeholder?: string;
|
|
17
|
+
inputProps?: Partial<FilledInputProps> | Partial<OutlinedInputProps> | Partial<InputProps>;
|
|
18
|
+
};
|
|
19
|
+
export declare const InputController: <T extends FieldValues>(props: Props<T>) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export default InputController;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import g, { jsx as o, jsxs as f } from "react/jsx-runtime";
|
|
2
|
+
import { i as F } from "../../styled-CWju4EfZ.js";
|
|
3
|
+
import { r as I } from "../../createSvgIcon-Dj8zNxRS.js";
|
|
4
|
+
import { FormControl as b, TextField as y, InputAdornment as _, IconButton as j, FormHelperText as w } from "@mui/material";
|
|
5
|
+
import { C as k } from "../../index.esm-ChwJSgnF.js";
|
|
6
|
+
var l = {}, q = F;
|
|
7
|
+
Object.defineProperty(l, "__esModule", {
|
|
8
|
+
value: !0
|
|
9
|
+
});
|
|
10
|
+
var s = l.default = void 0, M = q(I()), B = g;
|
|
11
|
+
s = l.default = (0, M.default)(/* @__PURE__ */ (0, B.jsx)("path", {
|
|
12
|
+
d: "M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"
|
|
13
|
+
}), "Clear");
|
|
14
|
+
const S = (p) => {
|
|
15
|
+
const {
|
|
16
|
+
control: v,
|
|
17
|
+
type: t,
|
|
18
|
+
textareaOption: n,
|
|
19
|
+
name: c,
|
|
20
|
+
autoComplete: h,
|
|
21
|
+
placeholder: x,
|
|
22
|
+
defaultValue: u,
|
|
23
|
+
emptyValue: i,
|
|
24
|
+
inputProps: e
|
|
25
|
+
} = p, d = i === void 0 && u !== void 0 ? null : i;
|
|
26
|
+
return /* @__PURE__ */ o(
|
|
27
|
+
k,
|
|
28
|
+
{
|
|
29
|
+
control: v,
|
|
30
|
+
name: c,
|
|
31
|
+
defaultValue: u,
|
|
32
|
+
render: ({ field: r, fieldState: C }) => {
|
|
33
|
+
var m;
|
|
34
|
+
return /* @__PURE__ */ f(b, { error: C.invalid, children: [
|
|
35
|
+
/* @__PURE__ */ o(
|
|
36
|
+
y,
|
|
37
|
+
{
|
|
38
|
+
...r,
|
|
39
|
+
type: t === "textarea" ? void 0 : t,
|
|
40
|
+
multiline: t === "textarea",
|
|
41
|
+
rows: (n == null ? void 0 : n.rows) ?? 1,
|
|
42
|
+
autoComplete: h,
|
|
43
|
+
placeholder: x,
|
|
44
|
+
value: r.value ?? "",
|
|
45
|
+
onChange: (a) => {
|
|
46
|
+
r.onChange(a), a.target.value ? r.onChange(a) : r.onChange(d);
|
|
47
|
+
},
|
|
48
|
+
InputProps: {
|
|
49
|
+
...e,
|
|
50
|
+
endAdornment: r.value && !(e != null && e.readOnly) && !(e != null && e.disabled) ? /* @__PURE__ */ o(_, { position: "end", children: /* @__PURE__ */ o(
|
|
51
|
+
j,
|
|
52
|
+
{
|
|
53
|
+
onClick: () => r.onChange(d),
|
|
54
|
+
edge: "end",
|
|
55
|
+
children: /* @__PURE__ */ o(s, {})
|
|
56
|
+
}
|
|
57
|
+
) }) : void 0
|
|
58
|
+
},
|
|
59
|
+
sx: {
|
|
60
|
+
"& .MuiInput-underline:before": {
|
|
61
|
+
borderColor: "#CCCCCC"
|
|
62
|
+
},
|
|
63
|
+
"& .MuiInputBase-root": {
|
|
64
|
+
backgroundColor: "#FFFFFF"
|
|
65
|
+
},
|
|
66
|
+
"input:-webkit-autofill": {
|
|
67
|
+
WebkitBoxShadow: "0 0 0 1000px white inset"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
),
|
|
72
|
+
/* @__PURE__ */ o(w, { children: (m = C.error) == null ? void 0 : m.message })
|
|
73
|
+
] });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
export {
|
|
79
|
+
S as InputController,
|
|
80
|
+
S as default
|
|
81
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { r as l, a, s, f as i } from "../../react.esm-C8amP77L.js";
|
|
3
|
+
import { u } from "../../index.esm-ChwJSgnF.js";
|
|
4
|
+
import { InputController as m } from "./index.js";
|
|
5
|
+
describe("InputController component", () => {
|
|
6
|
+
it("renders an input with the correct type, id, name, autoComplete, placeholder, and maxLength", () => {
|
|
7
|
+
const n = l(() => u().control).result.current, r = "TestName", e = "TestPlaceholder";
|
|
8
|
+
a(
|
|
9
|
+
/* @__PURE__ */ c(
|
|
10
|
+
m,
|
|
11
|
+
{
|
|
12
|
+
control: n,
|
|
13
|
+
type: "text",
|
|
14
|
+
name: r,
|
|
15
|
+
placeholder: e,
|
|
16
|
+
defaultValue: void 0
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
);
|
|
20
|
+
const t = s.getByPlaceholderText(e);
|
|
21
|
+
expect(t).toBeInTheDocument(), expect(t).toHaveAttribute("type", "text"), expect(t).toHaveAttribute("name", r), expect(t).toHaveAttribute("placeholder", e);
|
|
22
|
+
}), it("renders a multiline textarea with the correct rows", () => {
|
|
23
|
+
const n = l(() => u().control).result.current, r = "TestName", e = "TestPlaceholder", t = 4;
|
|
24
|
+
a(
|
|
25
|
+
/* @__PURE__ */ c(
|
|
26
|
+
m,
|
|
27
|
+
{
|
|
28
|
+
control: n,
|
|
29
|
+
type: "textarea",
|
|
30
|
+
name: r,
|
|
31
|
+
placeholder: e,
|
|
32
|
+
defaultValue: void 0,
|
|
33
|
+
textareaOption: { rows: t }
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
);
|
|
37
|
+
const o = s.getByPlaceholderText(e);
|
|
38
|
+
expect(o).toBeInTheDocument(), expect(o.tagName).toBe("TEXTAREA"), expect(o).toHaveAttribute("rows", t.toString());
|
|
39
|
+
}), it("sets value to default value if input is empty", () => {
|
|
40
|
+
const n = l(() => u().control).result.current, r = "TestName", e = "TestPlaceholder";
|
|
41
|
+
a(
|
|
42
|
+
/* @__PURE__ */ c(
|
|
43
|
+
m,
|
|
44
|
+
{
|
|
45
|
+
control: n,
|
|
46
|
+
type: "text",
|
|
47
|
+
name: r,
|
|
48
|
+
placeholder: e,
|
|
49
|
+
defaultValue: "Default Value"
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
const o = s.getByPlaceholderText(e);
|
|
54
|
+
expect(o).toBeInTheDocument(), i.change(o, { target: { value: "" } });
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import '../../assets/index13.css';const u = "_inputGroup_yg0op_1", n = {
|
|
3
|
+
inputGroup: u
|
|
4
|
+
}, s = (t) => {
|
|
5
|
+
const { children: o } = t;
|
|
6
|
+
return /* @__PURE__ */ p("div", { className: n.inputGroup, children: o });
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
s as InputGroup,
|
|
10
|
+
s as default
|
|
11
|
+
};
|