fui-material 2.7.6 → 2.7.8

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.
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import React, { forwardRef, useRef, useState, useEffect, useMemo, useCallback, useLayoutEffect, Fragment as Fragment$1, isValidElement, cloneElement, useDeferredValue, createContext, useContext } from "react";
2
+ import React, { forwardRef, useRef, useState, useEffect, useMemo, useCallback, useLayoutEffect, Fragment as Fragment$1, isValidElement, cloneElement, Children, useDeferredValue, createContext, useContext } from "react";
3
3
  import ReactDOM, { createPortal } from "react-dom";
4
4
  import JSZip from "jszip";
5
5
  import initializeModule from "allorion-exporting-html-to-docx";
@@ -1620,12 +1620,12 @@ const FOpenImgFull = ({
1620
1620
  }
1621
1621
  );
1622
1622
  };
1623
- const card$1 = "_card_1pttw_1";
1623
+ const card$2 = "_card_1pttw_1";
1624
1624
  const warning$3 = "_warning_1pttw_16";
1625
1625
  const info$1 = "_info_1pttw_24";
1626
1626
  const alert = "_alert_1pttw_32";
1627
1627
  const styles$j = {
1628
- card: card$1,
1628
+ card: card$2,
1629
1629
  warning: warning$3,
1630
1630
  info: info$1,
1631
1631
  alert,
@@ -3088,13 +3088,13 @@ const FSkeleton = ({ children, enable, width, height }) => {
3088
3088
  }, [enable]);
3089
3089
  return /* @__PURE__ */ jsx("div", { ref: elementRef, className: styles$a["skeleton-block"], children });
3090
3090
  };
3091
- const active = "_active_bpwow_120";
3091
+ const active = "_active_lv3xi_122";
3092
3092
  const styles$9 = {
3093
- "wave-nav-wrapper": "_wave-nav-wrapper_bpwow_5",
3094
- "wave-nav-grid-item": "_wave-nav-grid-item_bpwow_17",
3095
- "wave-nav-bar": "_wave-nav-bar_bpwow_27",
3096
- "wave-nav-list": "_wave-nav-list_bpwow_48",
3097
- "wave-nav-item": "_wave-nav-item_bpwow_75",
3093
+ "wave-nav-wrapper": "_wave-nav-wrapper_lv3xi_5",
3094
+ "wave-nav-grid-item": "_wave-nav-grid-item_lv3xi_17",
3095
+ "wave-nav-bar": "_wave-nav-bar_lv3xi_27",
3096
+ "wave-nav-list": "_wave-nav-list_lv3xi_48",
3097
+ "wave-nav-item": "_wave-nav-item_lv3xi_75",
3098
3098
  active
3099
3099
  };
3100
3100
  const FNavigateBar = ({
@@ -3125,12 +3125,26 @@ const FNavigateBarItem = ({
3125
3125
  }
3126
3126
  );
3127
3127
  };
3128
- const disabled = "_disabled_w47ps_49";
3128
+ const reportsPageContainer = "_reportsPageContainer_1pif5_3";
3129
+ const searchBar = "_searchBar_1pif5_11";
3130
+ const reportsGrid = "_reportsGrid_1pif5_47";
3131
+ const card$1 = "_card_1pif5_55";
3132
+ const cardHeader = "_cardHeader_1pif5_94";
3133
+ const countBadge = "_countBadge_1pif5_111";
3134
+ const linksList = "_linksList_1pif5_121";
3135
+ const linkItem = "_linkItem_1pif5_128";
3136
+ const badge = "_badge_1pif5_169";
3137
+ const disabled = "_disabled_1pif5_194";
3129
3138
  const styles$8 = {
3130
- "sections-routes": "_sections-routes_w47ps_2",
3131
- "sections-routes_card": "_sections-routes_card_w47ps_9",
3132
- "sections-routes_card__title": "_sections-routes_card__title_w47ps_25",
3133
- "sections-routes_card__links": "_sections-routes_card__links_w47ps_31",
3139
+ reportsPageContainer,
3140
+ searchBar,
3141
+ reportsGrid,
3142
+ card: card$1,
3143
+ cardHeader,
3144
+ countBadge,
3145
+ linksList,
3146
+ linkItem,
3147
+ badge,
3134
3148
  disabled
3135
3149
  };
3136
3150
  const FMenuBlockLinks = ({
@@ -3138,18 +3152,40 @@ const FMenuBlockLinks = ({
3138
3152
  className,
3139
3153
  st,
3140
3154
  id,
3141
- columns = 3
3155
+ columns,
3156
+ withSearch = false
3142
3157
  }) => {
3143
- const style = st !== void 0 ? { ...st, columns } : { columns };
3144
- return /* @__PURE__ */ jsx(
3145
- "div",
3146
- {
3147
- className: `${styles$8["sections-routes"]} ${className ?? ""}`.trim(),
3148
- style,
3149
- id,
3150
- children
3158
+ const [searchValue, setSearchValue] = useState("");
3159
+ const layoutStyle = {
3160
+ ...columns ? { "--cols": columns } : {},
3161
+ ...st
3162
+ };
3163
+ const enhancedChildren = Children.map(children, (child) => {
3164
+ if (isValidElement(child)) {
3165
+ return cloneElement(child, {
3166
+ searchTerm: searchValue
3167
+ });
3151
3168
  }
3152
- );
3169
+ return child;
3170
+ });
3171
+ return /* @__PURE__ */ jsxs("div", { className: `${styles$8.reportsPageContainer} ${className ?? ""}`.trim(), id, children: [
3172
+ withSearch && /* @__PURE__ */ jsx("div", { className: styles$8.searchBar, children: /* @__PURE__ */ jsx(
3173
+ "input",
3174
+ {
3175
+ type: "text",
3176
+ placeholder: "Быстрый поиск отчета",
3177
+ value: searchValue,
3178
+ onChange: (e) => setSearchValue(e.target.value)
3179
+ }
3180
+ ) }),
3181
+ /* @__PURE__ */ jsx("div", { className: styles$8.reportsGrid, style: layoutStyle, children: enhancedChildren })
3182
+ ] });
3183
+ };
3184
+ const getElementText = (node) => {
3185
+ if (typeof node === "string" || typeof node === "number") return String(node);
3186
+ if (Array.isArray(node)) return node.map(getElementText).join("");
3187
+ if (React.isValidElement(node) && node.props) return getElementText(node.props.children);
3188
+ return "";
3153
3189
  };
3154
3190
  const FMenuLinks = ({
3155
3191
  children,
@@ -3157,33 +3193,51 @@ const FMenuLinks = ({
3157
3193
  st,
3158
3194
  id,
3159
3195
  disabled: disabled2 = [],
3160
- title: title2
3196
+ badges = [],
3197
+ title: title2,
3198
+ searchTerm = ""
3161
3199
  }) => {
3162
- const enhancedChildren = React.Children.map(children, (child, index) => {
3200
+ const originalArray = React.Children.toArray(children);
3201
+ const filteredChildren = originalArray.filter((child) => {
3202
+ if (!searchTerm) return true;
3203
+ const text = getElementText(child).toLowerCase();
3204
+ const originalIndex = originalArray.indexOf(child);
3205
+ const badge2 = badges[originalIndex] || (React.isValidElement(child) ? child.props["data-badge"] : "");
3206
+ const searchString = badge2 ? `${badge2} ${text}`.toLowerCase() : text;
3207
+ return searchString.includes(searchTerm.toLowerCase());
3208
+ });
3209
+ if (filteredChildren.length === 0) return null;
3210
+ const enhancedChildren = filteredChildren.map((child) => {
3163
3211
  if (!React.isValidElement(child)) return child;
3164
- const isDisabled = disabled2.includes(index);
3212
+ const originalIndex = originalArray.indexOf(child);
3213
+ const isDisabled = disabled2.includes(originalIndex);
3214
+ const badgeText = badges[originalIndex] || child.props["data-badge"];
3165
3215
  const childClass = [
3166
3216
  child.props.className,
3167
- styles$8.link,
3168
- isDisabled && styles$8.disabled
3217
+ styles$8.linkItem,
3218
+ isDisabled ? styles$8.disabled : ""
3169
3219
  ].filter(Boolean).join(" ");
3220
+ const innerContent = badgeText ? /* @__PURE__ */ jsxs(Fragment, { children: [
3221
+ /* @__PURE__ */ jsx("span", { className: styles$8.badge, children: badgeText }),
3222
+ child.props.children
3223
+ ] }) : child.props.children;
3170
3224
  return React.cloneElement(child, {
3171
3225
  className: childClass,
3172
- ...isDisabled && { onClick: (e) => e.preventDefault() }
3226
+ children: innerContent,
3227
+ ...isDisabled && {
3228
+ onClick: (e) => e.preventDefault(),
3229
+ tabIndex: -1,
3230
+ "aria-disabled": true
3231
+ }
3173
3232
  });
3174
3233
  });
3175
- return /* @__PURE__ */ jsxs(
3176
- "div",
3177
- {
3178
- className: `${styles$8["sections-routes_card"]} ${className ?? ""}`.trim(),
3179
- style: st,
3180
- id,
3181
- children: [
3182
- title2 && /* @__PURE__ */ jsx("div", { className: styles$8["sections-routes_card__title"], children: title2 }),
3183
- /* @__PURE__ */ jsx("div", { className: styles$8["sections-routes_card__links"], children: enhancedChildren })
3184
- ]
3185
- }
3186
- );
3234
+ return /* @__PURE__ */ jsxs("div", { className: `${styles$8.card} ${className ?? ""}`.trim(), style: st, id, children: [
3235
+ title2 && /* @__PURE__ */ jsxs("div", { className: styles$8.cardHeader, children: [
3236
+ /* @__PURE__ */ jsx("h3", { children: title2 }),
3237
+ /* @__PURE__ */ jsx("span", { className: styles$8.countBadge, children: filteredChildren.length })
3238
+ ] }),
3239
+ /* @__PURE__ */ jsx("div", { className: styles$8.linksList, children: enhancedChildren })
3240
+ ] });
3187
3241
  };
3188
3242
  const styles$7 = {
3189
3243
  "f-tooltip": "_f-tooltip_xpnbo_1",