@banch0u/core-project-test-repository 1.9.2 → 1.9.3

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.
@@ -638,4 +638,37 @@ export var DeleteIconQ = function DeleteIconQ() {
638
638
  strokeWidth: "1.5",
639
639
  strokeLinecap: "round"
640
640
  }));
641
+ };
642
+ export var ThreeDotsIcon = function ThreeDotsIcon() {
643
+ return /*#__PURE__*/React.createElement("svg", {
644
+ width: "24",
645
+ height: "24",
646
+ viewBox: "0 0 24 24",
647
+ fill: "none",
648
+ xmlns: "http://www.w3.org/2000/svg"
649
+ }, /*#__PURE__*/React.createElement("path", {
650
+ d: "M9 22H15C20 22 22 20 22 15V9C22 4 20 2 15 2H9C4 2 2 4 2 9V15C2 20 4 22 9 22Z",
651
+ stroke: "#016DAF",
652
+ strokeWidth: "1.5",
653
+ strokeLinecap: "round",
654
+ strokeLinejoin: "round"
655
+ }), /*#__PURE__*/React.createElement("path", {
656
+ d: "M15.9965 12H16.0054",
657
+ stroke: "#016DAF",
658
+ strokeWidth: "2",
659
+ strokeLinecap: "round",
660
+ strokeLinejoin: "round"
661
+ }), /*#__PURE__*/React.createElement("path", {
662
+ d: "M11.9955 12H12.0045",
663
+ stroke: "#016DAF",
664
+ strokeWidth: "2",
665
+ strokeLinecap: "round",
666
+ strokeLinejoin: "round"
667
+ }), /*#__PURE__*/React.createElement("path", {
668
+ d: "M7.99451 12H8.00349",
669
+ stroke: "#016DAF",
670
+ strokeWidth: "2",
671
+ strokeLinecap: "round",
672
+ strokeLinejoin: "round"
673
+ }));
641
674
  };
@@ -0,0 +1,129 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
4
+ import React, { forwardRef, useImperativeHandle, useState } from "react";
5
+ import { Modal, Spin, Row, Col } from "antd";
6
+ import api from "../../utils/axios";
7
+ import style from "./index.module.scss";
8
+ var ImagePreviewModal = /*#__PURE__*/forwardRef(function (_, ref) {
9
+ var _useState = useState(false),
10
+ _useState2 = _slicedToArray(_useState, 2),
11
+ visible = _useState2[0],
12
+ setVisible = _useState2[1];
13
+ var _useState3 = useState([]),
14
+ _useState4 = _slicedToArray(_useState3, 2),
15
+ images = _useState4[0],
16
+ setImages = _useState4[1];
17
+ var _useState5 = useState(false),
18
+ _useState6 = _slicedToArray(_useState5, 2),
19
+ loading = _useState6[0],
20
+ setLoading = _useState6[1];
21
+ var fetchImages = /*#__PURE__*/function () {
22
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(urls) {
23
+ var base64List;
24
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
25
+ while (1) switch (_context2.prev = _context2.next) {
26
+ case 0:
27
+ _context2.prev = 0;
28
+ setLoading(true);
29
+ _context2.next = 4;
30
+ return Promise.all(urls.map(/*#__PURE__*/function () {
31
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(url) {
32
+ var res;
33
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
34
+ while (1) switch (_context.prev = _context.next) {
35
+ case 0:
36
+ _context.prev = 0;
37
+ _context.next = 3;
38
+ return api.get(url, {
39
+ responseType: "text"
40
+ });
41
+ case 3:
42
+ res = _context.sent;
43
+ return _context.abrupt("return", res.data);
44
+ case 7:
45
+ _context.prev = 7;
46
+ _context.t0 = _context["catch"](0);
47
+ console.error("Failed to load image:", url);
48
+ return _context.abrupt("return", null);
49
+ case 11:
50
+ case "end":
51
+ return _context.stop();
52
+ }
53
+ }, _callee, null, [[0, 7]]);
54
+ }));
55
+ return function (_x2) {
56
+ return _ref2.apply(this, arguments);
57
+ };
58
+ }()));
59
+ case 4:
60
+ base64List = _context2.sent;
61
+ setImages(base64List.filter(Boolean));
62
+ _context2.next = 11;
63
+ break;
64
+ case 8:
65
+ _context2.prev = 8;
66
+ _context2.t0 = _context2["catch"](0);
67
+ console.error("Image load failed", _context2.t0);
68
+ case 11:
69
+ _context2.prev = 11;
70
+ setLoading(false);
71
+ return _context2.finish(11);
72
+ case 14:
73
+ case "end":
74
+ return _context2.stop();
75
+ }
76
+ }, _callee2, null, [[0, 8, 11, 14]]);
77
+ }));
78
+ return function fetchImages(_x) {
79
+ return _ref.apply(this, arguments);
80
+ };
81
+ }();
82
+ useImperativeHandle(ref, function () {
83
+ return {
84
+ open: function open() {
85
+ var imageUrls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
86
+ fetchImages(imageUrls);
87
+ setVisible(true);
88
+ },
89
+ close: function close() {
90
+ setVisible(false);
91
+ setImages([]);
92
+ }
93
+ };
94
+ });
95
+ return /*#__PURE__*/React.createElement(Modal, {
96
+ open: visible,
97
+ onCancel: function onCancel() {
98
+ return setVisible(false);
99
+ },
100
+ footer: null,
101
+ title: "\u015E\u0259kil \xF6nizl\u0259m\u0259si",
102
+ width: 900,
103
+ className: style.modal
104
+ }, loading ? /*#__PURE__*/React.createElement(Spin, null) : /*#__PURE__*/React.createElement(Row, {
105
+ gutter: [16, 16]
106
+ }, images.map(function (img, idx) {
107
+ return /*#__PURE__*/React.createElement(Col, {
108
+ span: 12,
109
+ key: idx
110
+ }, /*#__PURE__*/React.createElement("div", {
111
+ style: {
112
+ padding: 10,
113
+ display: "flex",
114
+ flexDirection: "column"
115
+ }
116
+ }, /*#__PURE__*/React.createElement("img", {
117
+ src: img,
118
+ alt: "Preview ".concat(idx),
119
+ style: {
120
+ width: "100%",
121
+ maxHeight: "400px",
122
+ objectFit: "contain",
123
+ borderRadius: 8,
124
+ boxShadow: "0 0 6px rgba(0,0,0,0.2)"
125
+ }
126
+ })));
127
+ })));
128
+ });
129
+ export default ImagePreviewModal;
@@ -0,0 +1,27 @@
1
+ // .imageContainer {
2
+ // display: flex;
3
+ // flex-direction: column;
4
+ // justify-content: center;
5
+ // align-items: center;
6
+ // gap: 16px;
7
+ // justify-content: center;
8
+ // flex-wrap: wrap;
9
+ // img {
10
+ // height: 300px;
11
+ // width: auto;
12
+ // border: 1px solid grey;
13
+ // border-radius: 8px;
14
+ // }
15
+ // }
16
+
17
+ // .image {
18
+ // max-width: 250px;
19
+ // max-height: 250px;
20
+ // border-radius: 8px;
21
+ // object-fit: contain;
22
+ // }
23
+
24
+ // .modal {
25
+ // padding: 20px !important;
26
+ // background: #fff !important;
27
+ // }
@@ -33,14 +33,6 @@ var Select = function Select(_ref) {
33
33
  return style.select;
34
34
  }
35
35
  };
36
- var normalizeAz = function normalizeAz(str) {
37
- return str.replace(/I/g, "i").toLocaleLowerCase("az").normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/ç/g, "c").replace(/ş/g, "s").replace(/ğ/g, "g").replace(/ü/g, "u").replace(/ö/g, "o").replace(/ə/g, "e");
38
- };
39
- var filterOption = function filterOption(input, option) {
40
- var label = option === null || option === void 0 ? void 0 : option.title;
41
- if (!label || typeof label !== "string") return false;
42
- return normalizeAz(label).includes(normalizeAz(input));
43
- };
44
36
  var commonProps = {
45
37
  className: getClassName(),
46
38
  style: {
@@ -49,13 +41,19 @@ var Select = function Select(_ref) {
49
41
  showSearch: true,
50
42
  allowClear: allowClear,
51
43
  placeholder: placeholder,
52
- optionFilterProp: "title",
53
- filterOption: filterOption,
44
+ optionFilterProp: "children",
54
45
  onChange: onChange,
55
46
  disabled: disabled,
56
47
  value: value,
57
48
  defaultValue: defaultValue
58
49
  };
50
+ var normalizeAz = function normalizeAz(str) {
51
+ return str.replace(/I/g, "i").toLocaleLowerCase("az").normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/ç/g, "c").replace(/ş/g, "s").replace(/ğ/g, "g").replace(/ü/g, "u").replace(/ö/g, "o").replace(/ə/g, "e");
52
+ };
53
+ var filterOption = function filterOption(input, option) {
54
+ if (!(option !== null && option !== void 0 && option.children) || typeof option.children !== "string") return false;
55
+ return normalizeAz(option.children).includes(normalizeAz(input));
56
+ };
59
57
  if (mode === "multiple") {
60
58
  return /*#__PURE__*/React.createElement(AntdSelect, _extends({}, commonProps, {
61
59
  mode: "multiple",
@@ -64,6 +62,7 @@ var Select = function Select(_ref) {
64
62
  }
65
63
  if (mode === "divider") {
66
64
  return /*#__PURE__*/React.createElement(AntdSelect, _extends({}, commonProps, {
65
+ filterOption: filterOption,
67
66
  dropdownRender: function dropdownRender(menu) {
68
67
  return /*#__PURE__*/React.createElement("div", null, menu, /*#__PURE__*/React.createElement(Divider, {
69
68
  style: {
@@ -77,6 +76,8 @@ var Select = function Select(_ref) {
77
76
  }
78
77
  }), children);
79
78
  }
80
- return /*#__PURE__*/React.createElement(AntdSelect, commonProps, children);
79
+ return /*#__PURE__*/React.createElement(AntdSelect, _extends({}, commonProps, {
80
+ filterOption: filterOption
81
+ }), children);
81
82
  };
82
83
  export default Select;
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ export { default as Select } from "./components/Select";
15
15
  export { default as Input } from "./components/Input";
16
16
  export { default as api } from "./utils/axios";
17
17
  export { default as NotFound } from "./pages/NotFound";
18
+ export { default as ImagePreviewModal } from "./components/ImagePreviewModal";
18
19
  export { questionnairesRoutes } from "./routes/QuestionnaireRoutes";
19
20
  export { CoreProvider } from "./store/coreProvider";
20
21
  import LoginPage from "./pages/Login";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@banch0u/core-project-test-repository",
3
- "version": "1.9.2",
3
+ "version": "1.9.3",
4
4
  "description": "Shared core features for all projects",
5
5
  "main": "dist/index.js",
6
6
  "files": [