fui-material 2.8.14 → 2.8.16

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.
@@ -1795,21 +1795,52 @@ const FArrowIcon = React.forwardRef(({
1795
1795
  );
1796
1796
  });
1797
1797
  FArrowIcon.displayName = "FArrowIcon";
1798
- const overlay$1 = "_overlay_avyqh_1";
1799
- const entering$1 = "_entering_avyqh_15";
1800
- const exiting$1 = "_exiting_avyqh_19";
1801
- const viewport = "_viewport_avyqh_24";
1802
- const image = "_image_avyqh_33";
1803
- const zoomed = "_zoomed_avyqh_44";
1804
- const close$1 = "_close_avyqh_52";
1805
- const arrow = "_arrow_avyqh_53";
1806
- const left = "_left_avyqh_95";
1807
- const right = "_right_avyqh_99";
1808
- const indicators = "_indicators_avyqh_103";
1809
- const dot = "_dot_avyqh_112";
1810
- const active$4 = "_active_avyqh_121";
1811
- const spinner = "_spinner_avyqh_126";
1812
- const error$2 = "_error_avyqh_136";
1798
+ const FDownloadIcon = React.forwardRef(({
1799
+ color = "primary",
1800
+ size = 30,
1801
+ st,
1802
+ id,
1803
+ className,
1804
+ handleClick,
1805
+ ["data-testid"]: dataTestId,
1806
+ ...props
1807
+ }, ref) => {
1808
+ return /* @__PURE__ */ jsxs(
1809
+ "svg",
1810
+ {
1811
+ ref,
1812
+ style: st,
1813
+ id,
1814
+ width: size,
1815
+ onClick: handleClick,
1816
+ className: `f-icon ${handleClick ? " clicking-icon" : ""} ${color} ${className || ""}`,
1817
+ viewBox: "0 0 16 16",
1818
+ "data-testid": dataTestId,
1819
+ ...props,
1820
+ children: [
1821
+ /* @__PURE__ */ jsx("path", { d: "M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z" }),
1822
+ /* @__PURE__ */ jsx("path", { d: "M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z" })
1823
+ ]
1824
+ }
1825
+ );
1826
+ });
1827
+ FDownloadIcon.displayName = "FDownloadIcon";
1828
+ const overlay$1 = "_overlay_19vq5_1";
1829
+ const entering$1 = "_entering_19vq5_15";
1830
+ const exiting$1 = "_exiting_19vq5_19";
1831
+ const viewport = "_viewport_19vq5_24";
1832
+ const image = "_image_19vq5_33";
1833
+ const zoomed = "_zoomed_19vq5_44";
1834
+ const close$1 = "_close_19vq5_52";
1835
+ const download$1 = "_download_19vq5_53";
1836
+ const arrow = "_arrow_19vq5_54";
1837
+ const left = "_left_19vq5_107";
1838
+ const right = "_right_19vq5_111";
1839
+ const indicators = "_indicators_19vq5_115";
1840
+ const dot = "_dot_19vq5_124";
1841
+ const active$4 = "_active_19vq5_133";
1842
+ const spinner = "_spinner_19vq5_138";
1843
+ const error$2 = "_error_19vq5_148";
1813
1844
  const styles$o = {
1814
1845
  overlay: overlay$1,
1815
1846
  entering: entering$1,
@@ -1818,6 +1849,7 @@ const styles$o = {
1818
1849
  image,
1819
1850
  zoomed,
1820
1851
  close: close$1,
1852
+ download: download$1,
1821
1853
  arrow,
1822
1854
  left,
1823
1855
  right,
@@ -1854,7 +1886,7 @@ const FOpenImgFull = ({
1854
1886
  } else if (isMounted) {
1855
1887
  setIsClosing(true);
1856
1888
  }
1857
- }, [openAndClose]);
1889
+ }, [isMounted, openAndClose]);
1858
1890
  useEffect(() => {
1859
1891
  if (!isClosing) return;
1860
1892
  const timer = window.setTimeout(() => {
@@ -1905,6 +1937,7 @@ const FOpenImgFull = ({
1905
1937
  },
1906
1938
  children: [
1907
1939
  handleClose && /* @__PURE__ */ jsx("button", { type: "button", className: styles$o.close, onClick: handleClose, "aria-label": "Закрыть просмотр изображений", children: /* @__PURE__ */ jsx(FCloseIcon, { color: "light", size: 24 }) }),
1940
+ /* @__PURE__ */ jsx("a", { className: styles$o.download, href: imageUrl, download: true, "aria-label": "Скачать изображение", title: "Скачать изображение", children: /* @__PURE__ */ jsx(FDownloadIcon, { color: "light", size: 20 }) }),
1908
1941
  selectedImg > 0 && /* @__PURE__ */ jsx("button", { type: "button", className: `${styles$o.arrow} ${styles$o.left}`, onClick: () => changeImage(-1), "aria-label": "Предыдущее изображение", children: /* @__PURE__ */ jsx(FArrowIcon, { direction: "left", color: "light", size: 28 }) }),
1909
1942
  /* @__PURE__ */ jsxs("div", { className: styles$o.viewport, children: [
1910
1943
  isLoading && !hasError && /* @__PURE__ */ jsx("span", { className: styles$o.spinner, "aria-label": "Загрузка изображения" }),
@@ -1985,23 +2018,36 @@ const FOpenImgFull = ({
1985
2018
  document.body
1986
2019
  );
1987
2020
  };
1988
- const preview$1 = "_preview_1mpqt_1";
2021
+ const preview$1 = "_preview_b55p5_1";
2022
+ const imageButton = "_imageButton_b55p5_7";
2023
+ const download = "_download_b55p5_27";
1989
2024
  const styles$n = {
1990
- preview: preview$1
2025
+ preview: preview$1,
2026
+ imageButton,
2027
+ download
1991
2028
  };
1992
2029
  const FImagePreview = ({ src, alt = "", id, className, st }) => {
1993
2030
  const [isOpen, setIsOpen] = useState(false);
1994
2031
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1995
- /* @__PURE__ */ jsx(
1996
- "button",
2032
+ /* @__PURE__ */ jsxs(
2033
+ "div",
1997
2034
  {
1998
2035
  id,
1999
- type: "button",
2000
2036
  className: `${styles$n.preview} ${className || ""}`,
2001
2037
  style: st,
2002
- onClick: () => setIsOpen(true),
2003
- "aria-label": alt ? `Открыть изображение: ${alt}` : "Открыть изображение в полном размере",
2004
- children: /* @__PURE__ */ jsx("img", { src, alt })
2038
+ children: [
2039
+ /* @__PURE__ */ jsx(
2040
+ "button",
2041
+ {
2042
+ type: "button",
2043
+ className: styles$n.imageButton,
2044
+ onClick: () => setIsOpen(true),
2045
+ "aria-label": alt ? `Открыть изображение: ${alt}` : "Открыть изображение в полном размере",
2046
+ children: /* @__PURE__ */ jsx("img", { src, alt })
2047
+ }
2048
+ ),
2049
+ /* @__PURE__ */ jsx("a", { className: styles$n.download, href: src, download: true, "aria-label": "Скачать изображение", title: "Скачать изображение", children: /* @__PURE__ */ jsx(FDownloadIcon, { color: "light", size: 18 }) })
2050
+ ]
2005
2051
  }
2006
2052
  ),
2007
2053
  /* @__PURE__ */ jsx(
@@ -4783,36 +4829,6 @@ const FUploadIcon = React.forwardRef(({
4783
4829
  );
4784
4830
  });
4785
4831
  FUploadIcon.displayName = "FUploadIcon";
4786
- const FDownloadIcon = React.forwardRef(({
4787
- color = "primary",
4788
- size = 30,
4789
- st,
4790
- id,
4791
- className,
4792
- handleClick,
4793
- ["data-testid"]: dataTestId,
4794
- ...props
4795
- }, ref) => {
4796
- return /* @__PURE__ */ jsxs(
4797
- "svg",
4798
- {
4799
- ref,
4800
- style: st,
4801
- id,
4802
- width: size,
4803
- onClick: handleClick,
4804
- className: `f-icon ${handleClick ? " clicking-icon" : ""} ${color} ${className || ""}`,
4805
- viewBox: "0 0 16 16",
4806
- "data-testid": dataTestId,
4807
- ...props,
4808
- children: [
4809
- /* @__PURE__ */ jsx("path", { d: "M.5 9.9a.5.5 0 0 1 .5.5v2.5a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-2.5a.5.5 0 0 1 1 0v2.5a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2.5a.5.5 0 0 1 .5-.5z" }),
4810
- /* @__PURE__ */ jsx("path", { d: "M7.646 11.854a.5.5 0 0 0 .708 0l3-3a.5.5 0 0 0-.708-.708L8.5 10.293V1.5a.5.5 0 0 0-1 0v8.793L5.354 8.146a.5.5 0 1 0-.708.708l3 3z" })
4811
- ]
4812
- }
4813
- );
4814
- });
4815
- FDownloadIcon.displayName = "FDownloadIcon";
4816
4832
  const FCopyAddIcon = React.forwardRef(({
4817
4833
  color = "primary",
4818
4834
  size = 30,
@@ -9038,7 +9054,9 @@ const ERROR_FIELDS = [
9038
9054
  "detail",
9039
9055
  "traceId",
9040
9056
  "requestId",
9041
- "timestamp"
9057
+ "timestamp",
9058
+ "exception",
9059
+ "path"
9042
9060
  ];
9043
9061
  function isScalar(value) {
9044
9062
  return typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value);
@@ -9058,7 +9076,7 @@ function normalizeRequestErrorResponse(data) {
9058
9076
  for (const field of ERROR_FIELDS) {
9059
9077
  const value = data[field];
9060
9078
  if (!isScalar(value)) continue;
9061
- const text = String(value);
9079
+ const text = field === "path" ? normalizeErrorPath(String(value)) : String(value);
9062
9080
  result[field] = text.slice(
9063
9081
  0,
9064
9082
  field === "message" || field === "detail" ? LONG_ERROR_FIELD_LIMIT : SHORT_ERROR_FIELD_LIMIT
@@ -9082,6 +9100,53 @@ function getErrorResponseData(error2) {
9082
9100
  function getRequestErrorResponse(error2) {
9083
9101
  return normalizeRequestErrorResponse(getErrorResponseData(error2));
9084
9102
  }
9103
+ function normalizeErrorPath(value) {
9104
+ return new URL(value, "http://observer.invalid").pathname.replace(
9105
+ /\/(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=\/|$)/gi,
9106
+ "/<id>"
9107
+ );
9108
+ }
9109
+ const SENSITIVE_BODY_FIELD = /password|passwd|pwd|token|auth|cookie|secret|session|csrf|email|e-mail|phone|mobile|telephone|address|passport|snils|inn|kpp|account|card|birth|fio|name|surname|patronymic|executor|waterUser|org|contract|docNum|basis|notes|comment|description|text|content|file|scan|парол|токен|куки|почт|телефон|адрес|паспорт|снилс|инн|фио|фамили|отчеств|^имя$/i;
9110
+ function scrubRequestText(value, limit) {
9111
+ return value.replace(/https?:\/\/[^\s"'<>]+/gi, (url) => normalizeErrorPath(url)).replace(/\?[^\s"'<>)]*/g, "?").replace(/#[^\s"'<>)]*/g, "#").slice(0, limit);
9112
+ }
9113
+ function getRequestErrorBody(observer, method, outcome, error2, requestData) {
9114
+ try {
9115
+ if (!(observer == null ? void 0 : observer.captureErrorRequestBody) || outcome !== "failure" || !["POST", "PATCH"].includes(method.trim().toUpperCase())) return void 0;
9116
+ const candidate = error2 && typeof error2 === "object" ? error2 : void 0;
9117
+ let input = candidate && "requestBody" in candidate ? candidate.requestBody : (candidate == null ? void 0 : candidate.config) ? candidate.config.data : requestData;
9118
+ if (input === void 0) return void 0;
9119
+ if (typeof input === "string") {
9120
+ if (input === "[truncated]" || input === "[omitted]") return input;
9121
+ if (input.length > 65536) return "[truncated]";
9122
+ input = JSON.parse(input);
9123
+ if (typeof input === "string") return void 0;
9124
+ }
9125
+ if (input !== null && typeof input === "object" && !Array.isArray(input) && Object.getPrototypeOf(input) !== Object.prototype && Object.getPrototypeOf(input) !== null) return void 0;
9126
+ const visited = /* @__PURE__ */ new WeakSet();
9127
+ let remaining = 200;
9128
+ const sanitize = (value, depth) => {
9129
+ if (--remaining < 0 || depth > 6) return "[truncated]";
9130
+ if (value === null || typeof value === "boolean") return value;
9131
+ if (typeof value === "number") return Number.isFinite(value) ? value : "[omitted]";
9132
+ if (typeof value === "string") return scrubRequestText(value, 512);
9133
+ if (!value || typeof value !== "object") return "[omitted]";
9134
+ if (!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return "[omitted]";
9135
+ if (visited.has(value)) return "[circular]";
9136
+ visited.add(value);
9137
+ const result2 = Array.isArray(value) ? value.slice(0, 50).map((item) => sanitize(item, depth + 1)) : Object.fromEntries(Object.keys(value).slice(0, 50).map((key) => [
9138
+ scrubRequestText(key, 128),
9139
+ SENSITIVE_BODY_FIELD.test(key) ? "[redacted]" : sanitize(value[key], depth + 1)
9140
+ ]));
9141
+ visited.delete(value);
9142
+ return result2;
9143
+ };
9144
+ const result = sanitize(input, 0);
9145
+ return new TextEncoder().encode(JSON.stringify(result)).byteLength <= 8192 ? result : "[truncated]";
9146
+ } catch {
9147
+ return void 0;
9148
+ }
9149
+ }
9085
9150
  const getRequestNow = () => {
9086
9151
  if (typeof performance !== "undefined" && typeof performance.now === "function") {
9087
9152
  return performance.now();
@@ -9141,7 +9206,7 @@ function notifyRequestObserver(observer, observation) {
9141
9206
  } catch {
9142
9207
  }
9143
9208
  }
9144
- async function observeRequest(observer, requestFn, method, url) {
9209
+ async function observeRequest(observer, requestFn, method, url, requestData) {
9145
9210
  if (!observer) {
9146
9211
  return requestFn();
9147
9212
  }
@@ -9163,6 +9228,7 @@ async function observeRequest(observer, requestFn, method, url) {
9163
9228
  const durationMs = calcDurationMs(startTime);
9164
9229
  const { outcome, errorCategory, status } = classifyRequestError(error2);
9165
9230
  const errorResponse = outcome === "failure" ? getRequestErrorResponse(error2) : void 0;
9231
+ const errorRequestBody = getRequestErrorBody(observer, normalizedMethod, outcome, error2, requestData);
9166
9232
  notifyRequestObserver(observer, {
9167
9233
  method: normalizedMethod,
9168
9234
  url,
@@ -9170,7 +9236,8 @@ async function observeRequest(observer, requestFn, method, url) {
9170
9236
  durationMs,
9171
9237
  outcome,
9172
9238
  errorCategory,
9173
- ...errorResponse ? { errorResponse } : {}
9239
+ ...errorResponse ? { errorResponse } : {},
9240
+ ...errorRequestBody !== void 0 ? { errorRequestBody } : {}
9174
9241
  });
9175
9242
  throw error2;
9176
9243
  }
@@ -9196,7 +9263,8 @@ const FLibraryProvider = ({
9196
9263
  effectiveObserver,
9197
9264
  () => config.apiService.request(url, reqConfig),
9198
9265
  (reqConfig == null ? void 0 : reqConfig.method) ?? "GET",
9199
- url
9266
+ url,
9267
+ reqConfig == null ? void 0 : reqConfig.data
9200
9268
  );
9201
9269
  }
9202
9270
  }
@@ -9264,6 +9332,7 @@ const useFApi = ({
9264
9332
  if (effectiveObserver) {
9265
9333
  const { outcome, errorCategory, status } = classifyRequestError(error22);
9266
9334
  const errorResponse = outcome === "failure" ? getRequestErrorResponse(error22) : void 0;
9335
+ const errorRequestBody = getRequestErrorBody(effectiveObserver, method, outcome, error22, config.data);
9267
9336
  notifyRequestObserver(effectiveObserver, {
9268
9337
  method,
9269
9338
  url,
@@ -9271,7 +9340,8 @@ const useFApi = ({
9271
9340
  durationMs: calcDurationMs(startTime),
9272
9341
  outcome,
9273
9342
  errorCategory,
9274
- ...errorResponse ? { errorResponse } : {}
9343
+ ...errorResponse ? { errorResponse } : {},
9344
+ ...errorRequestBody !== void 0 ? { errorRequestBody } : {}
9275
9345
  });
9276
9346
  }
9277
9347
  const err = error22;