fui-material 2.7.5 → 2.7.7

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,11 +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_1tib7_71";
3091
+ const active = "_active_lv3xi_122";
3092
3092
  const styles$9 = {
3093
- "f-nav-bar": "_f-nav-bar_1tib7_1",
3094
- "f-nav-bar__menu": "_f-nav-bar__menu_1tib7_8",
3095
- "f-nav-bar__menu-route": "_f-nav-bar__menu-route_1tib7_31",
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",
3096
3098
  active
3097
3099
  };
3098
3100
  const FNavigateBar = ({
@@ -3101,31 +3103,48 @@ const FNavigateBar = ({
3101
3103
  id,
3102
3104
  className
3103
3105
  }) => {
3104
- return /* @__PURE__ */ jsx(FGrid, { obj: "container", id, className, children: /* @__PURE__ */ jsx(FGridRow, { children: /* @__PURE__ */ jsx(FGrid, { obj: "item", sm: 12, children: /* @__PURE__ */ jsx("nav", { style: st, className: styles$9["f-nav-bar"], children: /* @__PURE__ */ jsx("ul", { className: styles$9["f-nav-bar__menu"], children }) }) }) }) });
3106
+ return /* @__PURE__ */ jsx(FGrid, { obj: "container", id, className: `${styles$9["wave-nav-wrapper"]} ${className || ""}`, children: /* @__PURE__ */ jsx(FGridRow, { children: /* @__PURE__ */ jsx(FGrid, { obj: "item", sm: 12, className: styles$9["wave-nav-grid-item"], children: /* @__PURE__ */ jsx("nav", { style: st, className: styles$9["wave-nav-bar"], children: /* @__PURE__ */ jsx("ul", { className: styles$9["wave-nav-list"], children }) }) }) }) });
3105
3107
  };
3106
3108
  const FNavigateBarItem = ({
3107
3109
  st,
3110
+ style,
3108
3111
  children,
3109
3112
  id,
3110
3113
  className,
3111
- activeClass
3114
+ activeClass,
3115
+ ...rest
3112
3116
  }) => {
3113
3117
  return /* @__PURE__ */ jsx(
3114
3118
  "li",
3115
3119
  {
3116
3120
  id,
3117
- style: st,
3118
- className: `${styles$9["f-nav-bar__menu-route"]} ${activeClass ? styles$9.active : ""} ${className || ""}`,
3121
+ style: st || style,
3122
+ className: `${styles$9["wave-nav-item"]} ${activeClass ? styles$9.active : ""} ${className || ""}`,
3123
+ ...rest,
3119
3124
  children
3120
3125
  }
3121
3126
  );
3122
3127
  };
3123
- const disabled = "_disabled_w47ps_49";
3128
+ const reportsPageContainer = "_reportsPageContainer_9rgyr_3";
3129
+ const searchBar = "_searchBar_9rgyr_11";
3130
+ const reportsGrid = "_reportsGrid_9rgyr_45";
3131
+ const card$1 = "_card_9rgyr_53";
3132
+ const cardHeader = "_cardHeader_9rgyr_70";
3133
+ const countBadge = "_countBadge_9rgyr_87";
3134
+ const linksList = "_linksList_9rgyr_97";
3135
+ const linkItem = "_linkItem_9rgyr_104";
3136
+ const badge = "_badge_9rgyr_145";
3137
+ const disabled = "_disabled_9rgyr_170";
3124
3138
  const styles$8 = {
3125
- "sections-routes": "_sections-routes_w47ps_2",
3126
- "sections-routes_card": "_sections-routes_card_w47ps_9",
3127
- "sections-routes_card__title": "_sections-routes_card__title_w47ps_25",
3128
- "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,
3129
3148
  disabled
3130
3149
  };
3131
3150
  const FMenuBlockLinks = ({
@@ -3133,18 +3152,37 @@ const FMenuBlockLinks = ({
3133
3152
  className,
3134
3153
  st,
3135
3154
  id,
3136
- columns = 3
3155
+ columns,
3156
+ withSearch = false
3137
3157
  }) => {
3138
- const style = st !== void 0 ? { ...st, columns } : { columns };
3139
- return /* @__PURE__ */ jsx(
3140
- "div",
3141
- {
3142
- className: `${styles$8["sections-routes"]} ${className ?? ""}`.trim(),
3143
- style,
3144
- id,
3145
- children
3158
+ const [searchValue, setSearchValue] = useState("");
3159
+ const gridStyle = columns ? { gridTemplateColumns: `repeat(${columns}, 1fr)`, ...st } : st;
3160
+ const enhancedChildren = Children.map(children, (child) => {
3161
+ if (isValidElement(child)) {
3162
+ return cloneElement(child, {
3163
+ searchTerm: searchValue
3164
+ });
3146
3165
  }
3147
- );
3166
+ return child;
3167
+ });
3168
+ return /* @__PURE__ */ jsxs("div", { className: `${styles$8.reportsPageContainer} ${className ?? ""}`.trim(), id, children: [
3169
+ withSearch && /* @__PURE__ */ jsx("div", { className: styles$8.searchBar, children: /* @__PURE__ */ jsx(
3170
+ "input",
3171
+ {
3172
+ type: "text",
3173
+ placeholder: "Быстрый поиск",
3174
+ value: searchValue,
3175
+ onChange: (e) => setSearchValue(e.target.value)
3176
+ }
3177
+ ) }),
3178
+ /* @__PURE__ */ jsx("div", { className: styles$8.reportsGrid, style: gridStyle, children: enhancedChildren })
3179
+ ] });
3180
+ };
3181
+ const getElementText = (node) => {
3182
+ if (typeof node === "string" || typeof node === "number") return String(node);
3183
+ if (Array.isArray(node)) return node.map(getElementText).join("");
3184
+ if (React.isValidElement(node) && node.props) return getElementText(node.props.children);
3185
+ return "";
3148
3186
  };
3149
3187
  const FMenuLinks = ({
3150
3188
  children,
@@ -3152,33 +3190,51 @@ const FMenuLinks = ({
3152
3190
  st,
3153
3191
  id,
3154
3192
  disabled: disabled2 = [],
3155
- title: title2
3193
+ badges = [],
3194
+ title: title2,
3195
+ searchTerm = ""
3156
3196
  }) => {
3157
- const enhancedChildren = React.Children.map(children, (child, index) => {
3197
+ const originalArray = React.Children.toArray(children);
3198
+ const filteredChildren = originalArray.filter((child) => {
3199
+ if (!searchTerm) return true;
3200
+ const text = getElementText(child).toLowerCase();
3201
+ const originalIndex = originalArray.indexOf(child);
3202
+ const badge2 = badges[originalIndex] || (React.isValidElement(child) ? child.props["data-badge"] : "");
3203
+ const searchString = badge2 ? `${badge2} ${text}`.toLowerCase() : text;
3204
+ return searchString.includes(searchTerm.toLowerCase());
3205
+ });
3206
+ if (filteredChildren.length === 0) return null;
3207
+ const enhancedChildren = filteredChildren.map((child) => {
3158
3208
  if (!React.isValidElement(child)) return child;
3159
- const isDisabled = disabled2.includes(index);
3209
+ const originalIndex = originalArray.indexOf(child);
3210
+ const isDisabled = disabled2.includes(originalIndex);
3211
+ const badgeText = badges[originalIndex] || child.props["data-badge"];
3160
3212
  const childClass = [
3161
3213
  child.props.className,
3162
- styles$8.link,
3163
- isDisabled && styles$8.disabled
3214
+ styles$8.linkItem,
3215
+ isDisabled ? styles$8.disabled : ""
3164
3216
  ].filter(Boolean).join(" ");
3217
+ const innerContent = badgeText ? /* @__PURE__ */ jsxs(Fragment, { children: [
3218
+ /* @__PURE__ */ jsx("span", { className: styles$8.badge, children: badgeText }),
3219
+ child.props.children
3220
+ ] }) : child.props.children;
3165
3221
  return React.cloneElement(child, {
3166
3222
  className: childClass,
3167
- ...isDisabled && { onClick: (e) => e.preventDefault() }
3223
+ children: innerContent,
3224
+ ...isDisabled && {
3225
+ onClick: (e) => e.preventDefault(),
3226
+ tabIndex: -1,
3227
+ "aria-disabled": true
3228
+ }
3168
3229
  });
3169
3230
  });
3170
- return /* @__PURE__ */ jsxs(
3171
- "div",
3172
- {
3173
- className: `${styles$8["sections-routes_card"]} ${className ?? ""}`.trim(),
3174
- style: st,
3175
- id,
3176
- children: [
3177
- title2 && /* @__PURE__ */ jsx("div", { className: styles$8["sections-routes_card__title"], children: title2 }),
3178
- /* @__PURE__ */ jsx("div", { className: styles$8["sections-routes_card__links"], children: enhancedChildren })
3179
- ]
3180
- }
3181
- );
3231
+ return /* @__PURE__ */ jsxs("div", { className: `${styles$8.card} ${className ?? ""}`.trim(), style: st, id, children: [
3232
+ title2 && /* @__PURE__ */ jsxs("div", { className: styles$8.cardHeader, children: [
3233
+ /* @__PURE__ */ jsx("h3", { children: title2 }),
3234
+ /* @__PURE__ */ jsx("span", { className: styles$8.countBadge, children: filteredChildren.length })
3235
+ ] }),
3236
+ /* @__PURE__ */ jsx("div", { className: styles$8.linksList, children: enhancedChildren })
3237
+ ] });
3182
3238
  };
3183
3239
  const styles$7 = {
3184
3240
  "f-tooltip": "_f-tooltip_xpnbo_1",