@apia/components 4.0.28 → 4.0.30

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/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { jsx, Fragment, jsxs } from '@apia/theme/jsx-runtime';
2
2
  import * as React from 'react';
3
- import React__default, { createContext, useContext, useEffect, useMemo, useState, useCallback, useRef, forwardRef, Fragment as Fragment$1, useDeferredValue, lazy, Suspense, useTransition, Children, memo, isValidElement, cloneElement } from 'react';
3
+ import React__default, { createContext, useContext, useEffect, useMemo, useState, useCallback, useRef, forwardRef, Fragment as Fragment$1, useDeferredValue, lazy, Suspense, useTransition, Children, memo, isValidElement, cloneElement, createRef } from 'react';
4
4
  import parse, { domToReact, Element } from 'html-react-parser';
5
5
  import { Spinner as Spinner$1, Box as Box$1 } from 'theme-ui';
6
6
  import { uniqueId as uniqueId$3, debounce, cloneDeep, isFunction } from 'lodash-es';
7
- import { Box, getVariant, useBreakpointIndex, Close, responsive, spacing, Heading, Link, Button, Spinner, createElement, Select, Input, Flex, IconButton as IconButton$1, Image, injectStyles, Progress, Label, Paragraph, Container, Form, focusOutline, makeStyledComponent, useThemeUI, Grid, Textarea } from '@apia/theme';
7
+ import { Box, getVariant, useBreakpointIndex, Close, responsive, spacing, Heading, Link, Button, Spinner, createElement, Select, Input, Flex, IconButton as IconButton$1, Image, injectStyles, Progress, Label as Label$1, Paragraph, Container, Form, focusOutline, makeStyledComponent, useThemeUI, Grid, Textarea } from '@apia/theme';
8
8
  import { BarLoader } from 'react-spinners';
9
9
  import uniqueId$2 from 'lodash-es/uniqueId';
10
- import { findScrollContainer, useUpdateEffect, focus, focusSelector, getFocusSelector, addBoundary, useCombinedRefs, usePrevious, EventEmitter, useMount, getLabel, getSpecificParent, customEvents, isChild, useUnmount, StatefulEmitter, shallowEqual as shallowEqual$1, getDateFormat, uniqueId as uniqueId$4, AudioRecorder, persistentStorage, disableChildrenFocus, enableChildrenFocus, decodeHTMLEntities, useDebouncedCallback, getIndex, noNaN, useLatest, useSubscription, arrayOrArray } from '@apia/util';
10
+ import { findScrollContainer, useUpdateEffect, focus, focusSelector, getFocusSelector, addBoundary, useCombinedRefs, usePrevious, EventEmitter, useMount, getLabel, getSpecificParent, customEvents, isChild, useUnmount, StatefulEmitter, shallowEqual as shallowEqual$1, getDateFormat, uniqueId as uniqueId$4, AudioRecorder, persistentStorage, disableChildrenFocus, enableChildrenFocus, decodeHTMLEntities, useDebouncedCallback, getIndex, noNaN, useLatest, useSubscription, useMatchScrollDirection, arrayOrArray } from '@apia/util';
11
11
  import usePortal from 'react-cool-portal';
12
12
  import { CSSTransition } from 'react-transition-group';
13
13
  import { uniqueId as uniqueId$1, defaultNotifier, NotificationsList } from '@apia/notifications';
@@ -19,8 +19,8 @@ import { isIconName, Icon as Icon$1, icons, FileIcon } from '@apia/icons';
19
19
  import { useMenuState, ControlledMenu, MenuItem, MenuDivider, SubMenu } from '@szhsin/react-menu';
20
20
  import { shallowEqual } from '@apia/store';
21
21
  import AnimateHeight from 'react-animate-height';
22
- import { useUpdateEffect as useUpdateEffect$1 } from 'ahooks';
23
- import { FaCalendarAlt } from '@meronex/icons/fa';
22
+ import { useUpdateEffect as useUpdateEffect$1, useScroll } from 'ahooks';
23
+ import { FaCalendarAlt, FaBars } from '@meronex/icons/fa';
24
24
  import dayjs from 'dayjs';
25
25
  import Calendar from 'react-calendar';
26
26
  import ReactInputMask from 'react-input-mask';
@@ -2022,7 +2022,8 @@ class TabsController {
2022
2022
  openTabsHistory: /* @__PURE__ */ new Set(),
2023
2023
  tabs: /* @__PURE__ */ new Map(),
2024
2024
  timestamp: 0,
2025
- showAtLeastOneTab: false
2025
+ showAtLeastOneTab: false,
2026
+ listenFocusEvents: true
2026
2027
  });
2027
2028
  Object.assign(this.state, props.initialState ?? {});
2028
2029
  props.initialTabs?.forEach((tab) => this.append(tab));
@@ -2135,6 +2136,9 @@ class TabsController {
2135
2136
  remove(tabId) {
2136
2137
  this.state.openTabsHistory.delete(this.state.tabs.get(tabId));
2137
2138
  this.state.tabs.delete(tabId);
2139
+ if (this.state.openTabsHistory.size === 0 && this.state.showAtLeastOneTab) {
2140
+ this.tabsList[0]?.open();
2141
+ }
2138
2142
  }
2139
2143
  async toggleTab(tabId, isShown) {
2140
2144
  const willBeOpen = isShown || !this.getTab(tabId)?.state.isOpen;
@@ -2335,7 +2339,9 @@ const InnerRenderer = observer(({ tab }) => {
2335
2339
  uns.current();
2336
2340
  if (el instanceof HTMLElement) {
2337
2341
  const handleFocus = () => {
2338
- tab.open();
2342
+ if (tab.controller.state.listenFocusEvents !== false) {
2343
+ tab.open();
2344
+ }
2339
2345
  };
2340
2346
  el.addEventListener(customEvents.focus, handleFocus);
2341
2347
  uns.current = () => {
@@ -6385,7 +6391,7 @@ const FileAttachment = observer(
6385
6391
  children: [
6386
6392
  /* @__PURE__ */ jsx("h1", { children: attachment.name }),
6387
6393
  /* @__PURE__ */ jsx("img", { src: attachment.base64 }),
6388
- attachment.description && /* @__PURE__ */ jsx(Label, { children: attachment.description })
6394
+ attachment.description && /* @__PURE__ */ jsx(Label$1, { children: attachment.description })
6389
6395
  ]
6390
6396
  }
6391
6397
  )
@@ -6684,7 +6690,7 @@ const TagReplacers = {
6684
6690
  h5: (props) => /* @__PURE__ */ jsx(Heading, { as: "h5", ...props }),
6685
6691
  h6: (props) => /* @__PURE__ */ jsx(Heading, { as: "h6", ...props }),
6686
6692
  img: Image,
6687
- label: Label,
6693
+ label: Label$1,
6688
6694
  input: Input,
6689
6695
  p: Paragraph,
6690
6696
  select: Select
@@ -8944,7 +8950,7 @@ const ProgressBar = ({
8944
8950
  }) => {
8945
8951
  return /* @__PURE__ */ jsxs(Fragment, { children: [
8946
8952
  /* @__PURE__ */ jsx(
8947
- Label,
8953
+ Label$1,
8948
8954
  {
8949
8955
  htmlFor: id,
8950
8956
  sx: {
@@ -10127,9 +10133,322 @@ const SortableList = makeStyledComponent(
10127
10133
  UnstyledSortableList
10128
10134
  );
10129
10135
 
10136
+ const NoMemoPagination = ({
10137
+ appliedFilters,
10138
+ areAllFiltersApplied,
10139
+ className,
10140
+ currentPage,
10141
+ disabled,
10142
+ disableReduced,
10143
+ hasMore,
10144
+ hideInfo,
10145
+ hideMaximizeButton,
10146
+ hideRefreshButton,
10147
+ isLoading,
10148
+ isPerforming,
10149
+ onDeleteFilters,
10150
+ onPageChange,
10151
+ onRefresh,
10152
+ pageCount,
10153
+ recordsCount: outerRecordsCount,
10154
+ reachedMax,
10155
+ showMaximizeOnSmallBreakpoints,
10156
+ variant = "primary",
10157
+ isMaximized,
10158
+ onMaximize
10159
+ }) => {
10160
+ const numberPageCount = Number(pageCount);
10161
+ const breakPoint = useBreakpointIndex();
10162
+ const numberCurrentPage = Number(currentPage);
10163
+ const recordsCount = outerRecordsCount;
10164
+ const [internCurrentPage, setCurrentPage] = useState(
10165
+ numberCurrentPage ?? 1
10166
+ );
10167
+ const [lastEmittedPage, setLastEmittedPage] = useState(
10168
+ numberCurrentPage ?? 1
10169
+ );
10170
+ const [hasNoValue, setHasNoValue] = useState(false);
10171
+ useEffect(() => {
10172
+ setCurrentPage(numberCurrentPage);
10173
+ }, [numberCurrentPage]);
10174
+ const setCurrentAndDispatch = useCallback(
10175
+ (page) => {
10176
+ setCurrentPage(page);
10177
+ onPageChange(page);
10178
+ setLastEmittedPage(page);
10179
+ },
10180
+ [onPageChange]
10181
+ );
10182
+ const InputRef = createRef();
10183
+ const options = [];
10184
+ for (let i = 1; i <= numberPageCount; i++) {
10185
+ options.push(i);
10186
+ }
10187
+ const [infoButtonRef, setInfoButtonRef] = React__default.useState(
10188
+ null
10189
+ );
10190
+ const recordsCountLabel = `${window.GNR_TOT_RECORDS}: ${recordsCount}`;
10191
+ const tooltipProps = React__default.useMemo(
10192
+ () => ({
10193
+ text: breakPoint <= 3 ? `${recordsCountLabel}.${!reachedMax && !hasMore ? "" : reachedMax && window.GNR_TOT_RECORDS_REACHED || hasMore && window.QUERY_MORE_DATA}` : `${!reachedMax && !hasMore ? "" : reachedMax && window.GNR_TOT_RECORDS_REACHED || hasMore && window.QUERY_MORE_DATA}`,
10194
+ attachToElement: { current: infoButtonRef },
10195
+ closeOnClickOut: true
10196
+ // closeOnClickOutChecker(element) {
10197
+ // return !getSpecificParent(element, (current) =>
10198
+ // current.classList.contains('pagination__information'),
10199
+ // );
10200
+ // },
10201
+ }),
10202
+ [breakPoint, hasMore, infoButtonRef, reachedMax, recordsCountLabel]
10203
+ );
10204
+ return /* @__PURE__ */ jsxs(
10205
+ Box,
10206
+ {
10207
+ as: "nav",
10208
+ variant: `layout.common.components.pagination.${variant}`,
10209
+ "aria-label": getLabel("lblQryParamPag").text,
10210
+ className: `pagination ${numberPageCount <= 1 && !disableReduced ? "onlyRefresh" : ""} ${className ?? ""}`,
10211
+ children: [
10212
+ /* @__PURE__ */ jsxs(Box, { className: "pagination__leftToolbar", children: [
10213
+ !hideMaximizeButton && (showMaximizeOnSmallBreakpoints || breakPoint > 4) && /* @__PURE__ */ jsx(
10214
+ IconButton,
10215
+ {
10216
+ variant: "icon",
10217
+ className: "pagination__fullScreenButton",
10218
+ onClick: onMaximize,
10219
+ icon: !isMaximized ? "Maximize" : "Minimize",
10220
+ title: !isMaximized ? window.LBL_MAXIMIZE : window.LBL_MINIMIZE,
10221
+ "aria-label": !isMaximized ? window.LBL_MAXIMIZE : window.LBL_MINIMIZE,
10222
+ iconSize: "Md"
10223
+ }
10224
+ ),
10225
+ !hideInfo && /* @__PURE__ */ jsxs(Fragment, { children: [
10226
+ ((reachedMax || hasMore) && breakPoint > 3 || breakPoint <= 3) && className !== "grid__pagination" ? /* @__PURE__ */ jsx(
10227
+ IconButton,
10228
+ {
10229
+ variant: "icon-primary",
10230
+ icon: "Info",
10231
+ className: `pagination__information ${reachedMax || hasMore ? "pagination__alertInfo" : ""}`,
10232
+ onClick: () => ApiaUtil.instance.tooltips.open(tooltipProps),
10233
+ ref: setInfoButtonRef,
10234
+ iconSize: "Md",
10235
+ "aria-label": window.BTN_FILE_INFO_TOOLTIP,
10236
+ title: window.BTN_FILE_INFO_TOOLTIP
10237
+ }
10238
+ ) : "",
10239
+ breakPoint > 3 && /* @__PURE__ */ jsx(
10240
+ Box,
10241
+ {
10242
+ as: "span",
10243
+ className: "recordsCounter pagination__deleteLabels",
10244
+ title: recordsCountLabel,
10245
+ children: recordsCount !== -1 && `${window.GNR_TOT_RECORDS}: ${recordsCount} `
10246
+ }
10247
+ )
10248
+ ] })
10249
+ ] }),
10250
+ /* @__PURE__ */ jsx(Box, { className: "pagination__controls", children: (numberPageCount > 0 || disableReduced) && /* @__PURE__ */ jsxs(Fragment, { children: [
10251
+ breakPoint > 2 && /* @__PURE__ */ jsx(
10252
+ IconButton,
10253
+ {
10254
+ variant: "icon-primary",
10255
+ disabled: disabled || internCurrentPage === 1 || isLoading || isPerforming,
10256
+ "aria-label": window.NAV_FIRST_PAGE,
10257
+ type: "button",
10258
+ onClick: () => {
10259
+ setCurrentAndDispatch(1);
10260
+ },
10261
+ icon: "First",
10262
+ iconSize: "Sm"
10263
+ }
10264
+ ),
10265
+ /* @__PURE__ */ jsx(
10266
+ IconButton,
10267
+ {
10268
+ variant: "icon-primary",
10269
+ disabled: disabled || internCurrentPage <= 1 || isLoading || isPerforming,
10270
+ "aria-label": window.NAV_PREVIOUS_PAGE,
10271
+ type: "button",
10272
+ onClick: () => {
10273
+ setCurrentAndDispatch(internCurrentPage - 1);
10274
+ },
10275
+ icon: "Previous",
10276
+ iconSize: "Sm"
10277
+ }
10278
+ ),
10279
+ breakPoint > 2 && /* @__PURE__ */ jsxs(Box, { className: "input", children: [
10280
+ /* @__PURE__ */ jsx(
10281
+ Input,
10282
+ {
10283
+ className: "pagination__controls__input",
10284
+ "aria-label": window.NAV_INPUT_LABEL,
10285
+ title: `${window.PAGE}: ${internCurrentPage} `,
10286
+ ref: InputRef,
10287
+ value: hasNoValue ? "" : internCurrentPage,
10288
+ onKeyDown: (ev) => {
10289
+ const regex = /([0-9])|(Backspace)|(Tab)/;
10290
+ if (!ev.key.match(regex)) {
10291
+ ev.stopPropagation();
10292
+ ev.preventDefault();
10293
+ }
10294
+ if (ev.key === "Enter") {
10295
+ ev.stopPropagation();
10296
+ ev.preventDefault();
10297
+ setCurrentAndDispatch(internCurrentPage);
10298
+ }
10299
+ },
10300
+ onBlur: () => {
10301
+ if (lastEmittedPage !== internCurrentPage) {
10302
+ setCurrentAndDispatch(internCurrentPage);
10303
+ }
10304
+ },
10305
+ onFocus: (ev) => {
10306
+ ev.currentTarget.select();
10307
+ },
10308
+ onChange: (ev) => {
10309
+ setHasNoValue(ev.target.value === "");
10310
+ setCurrentPage(
10311
+ Math.max(
10312
+ 1,
10313
+ Math.min(
10314
+ noNaN(Number(ev.currentTarget.value)),
10315
+ pageCount
10316
+ )
10317
+ )
10318
+ );
10319
+ },
10320
+ disabled: disabled || isLoading || isPerforming
10321
+ }
10322
+ ),
10323
+ " ",
10324
+ "/",
10325
+ " ",
10326
+ /* @__PURE__ */ jsx(
10327
+ Box,
10328
+ {
10329
+ as: "span",
10330
+ title: recordsCount !== -1 ? `${window.GNR_TOT_RECORDS} ${recordsCount}` : window.NAV_INPUT_LABEL,
10331
+ children: pageCount
10332
+ }
10333
+ )
10334
+ ] }),
10335
+ breakPoint <= 2 && /* @__PURE__ */ jsxs(
10336
+ Select,
10337
+ {
10338
+ className: "pagination__selectPage",
10339
+ value: internCurrentPage,
10340
+ onChange: (e) => {
10341
+ setCurrentAndDispatch(Number(e.target.value));
10342
+ },
10343
+ children: [
10344
+ /* @__PURE__ */ jsxs("option", { disabled: true, children: [
10345
+ "Total: ",
10346
+ numberPageCount
10347
+ ] }),
10348
+ options.map((current) => {
10349
+ return /* @__PURE__ */ jsx("option", { children: current }, current);
10350
+ })
10351
+ ]
10352
+ }
10353
+ ),
10354
+ /* @__PURE__ */ jsx(
10355
+ IconButton,
10356
+ {
10357
+ variant: "icon-primary",
10358
+ disabled: disabled || internCurrentPage >= numberPageCount || isLoading || isPerforming,
10359
+ "aria-label": window.NAV_NEXT_PAGE,
10360
+ type: "button",
10361
+ onClick: () => {
10362
+ setCurrentAndDispatch(internCurrentPage + 1);
10363
+ },
10364
+ icon: "Next",
10365
+ iconSize: "Sm"
10366
+ }
10367
+ ),
10368
+ breakPoint > 2 && /* @__PURE__ */ jsx(
10369
+ IconButton,
10370
+ {
10371
+ variant: "icon-primary",
10372
+ type: "button",
10373
+ "aria-label": window.NAV_LAST_PAGE,
10374
+ disabled: disabled || internCurrentPage >= numberPageCount || isLoading || isPerforming,
10375
+ onClick: () => {
10376
+ setCurrentAndDispatch(numberPageCount);
10377
+ },
10378
+ icon: "Last",
10379
+ iconSize: "Sm"
10380
+ }
10381
+ )
10382
+ ] }) }),
10383
+ /* @__PURE__ */ jsx(Box, { className: "pagination__rightToolbar", children: (!hideRefreshButton || onDeleteFilters) && /* @__PURE__ */ jsxs(Fragment, { children: [
10384
+ onDeleteFilters && /* @__PURE__ */ jsxs(
10385
+ SimpleButton,
10386
+ {
10387
+ disabled: isPerforming,
10388
+ className: "pagination__deleteFiltersButton",
10389
+ onClick: onDeleteFilters,
10390
+ children: [
10391
+ breakPoint > 3 && /* @__PURE__ */ jsx(Box, { as: "span", className: "pagination__deleteLabels", children: window.BTN_DELETE_FILTERS }),
10392
+ /* @__PURE__ */ jsx(
10393
+ Box,
10394
+ {
10395
+ as: "span",
10396
+ className: `pagination__appliedFiltersLabel ${areAllFiltersApplied ? "" : "withFilters"}`,
10397
+ children: appliedFilters
10398
+ }
10399
+ )
10400
+ ]
10401
+ }
10402
+ ),
10403
+ !hideRefreshButton && /* @__PURE__ */ jsx(
10404
+ IconButton,
10405
+ {
10406
+ "aria-label": window.NAV_REFRESH,
10407
+ onClick: () => onRefresh(numberCurrentPage),
10408
+ icon: "Refresh",
10409
+ iconSize: "Md",
10410
+ disabled: disabled || isLoading,
10411
+ variant: "icon-primary",
10412
+ isLoading: isPerforming,
10413
+ className: "pagiantion__refreshIcon"
10414
+ }
10415
+ )
10416
+ ] }) })
10417
+ ]
10418
+ }
10419
+ );
10420
+ };
10421
+ const Pagination = React__default.memo(NoMemoPagination);
10422
+
10423
+ const AsidePanel = ({
10424
+ title,
10425
+ toolTip,
10426
+ children,
10427
+ columns = 2,
10428
+ spacer,
10429
+ className
10430
+ }) => {
10431
+ const contentSx = React.useMemo(
10432
+ () => ({
10433
+ gridTemplateColumns: `${Array(columns).fill("1fr").join(" ")} `
10434
+ }),
10435
+ [columns]
10436
+ );
10437
+ return /* @__PURE__ */ jsxs(Box, { as: "fieldset", className: `asidePanel ${className ?? ""}`, children: [
10438
+ title && /* @__PURE__ */ jsx("legend", { title: toolTip, children: title }),
10439
+ spacer !== false && /* @__PURE__ */ jsx(Box, { className: "spacer" }),
10440
+ /* @__PURE__ */ jsx(Box, { className: "asidePanel__content", sx: contentSx, children })
10441
+ ] });
10442
+ };
10443
+
10130
10444
  function isFavoriteIcon() {
10131
10445
  return typeof window.functionId !== "undefined" || !!window.helpUrl;
10132
10446
  }
10447
+ const FavoriteIcon = () => {
10448
+ return /* @__PURE__ */ jsx(IconButton, { icon: "Star" });
10449
+ };
10450
+
10451
+ const Label = ({ variant, ...props }) => /* @__PURE__ */ jsx(Label$1, { sx: { variant }, ...props });
10133
10452
 
10134
10453
  var __accessCheck = (obj, member, msg) => {
10135
10454
  if (!member.has(obj))
@@ -10162,7 +10481,7 @@ class MenuController extends EventEmitter {
10162
10481
  __privateAdd(this, _menues, []);
10163
10482
  }
10164
10483
  on(eventName, fn) {
10165
- this.on(eventName, fn);
10484
+ super.on(eventName, fn);
10166
10485
  const currentMenu = __privateGet(this, _menues).find(
10167
10486
  (current) => current.stage === __privateGet(this, _currentStage)
10168
10487
  )?.menu;
@@ -10217,6 +10536,319 @@ function useMenu(breakPoints, initialMenu) {
10217
10536
  return menu;
10218
10537
  }
10219
10538
 
10539
+ const FooterButtons = (props) => {
10540
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Box, { ...props }) });
10541
+ };
10542
+
10543
+ const AccordionAside = () => {
10544
+ const children = useMenu([1, 2, 3]);
10545
+ return children;
10546
+ };
10547
+
10548
+ const Aside = () => {
10549
+ const children = useMenu([5, 6, 7]);
10550
+ return /* @__PURE__ */ jsx(Fragment, { children });
10551
+ };
10552
+
10553
+ const AsideLoader = (definition) => {
10554
+ React__default.useEffect(() => {
10555
+ const variant = definition.variant ?? "twoColumnsAside";
10556
+ const unregister = menuController.setMenu({
10557
+ menu: /* @__PURE__ */ jsx(Box, { className: "ApplicationMenu", variant: `layout.${variant}`, children: definition.menu ?? definition.children }),
10558
+ stage: definition.stage ?? uniqueId$3()
10559
+ });
10560
+ return () => {
10561
+ unregister();
10562
+ };
10563
+ }, [
10564
+ definition.children,
10565
+ definition.menu,
10566
+ definition.stage,
10567
+ definition.variant
10568
+ ]);
10569
+ return null;
10570
+ };
10571
+
10572
+ const BodyAside = () => {
10573
+ const children = useMenu([1, 2, 3]);
10574
+ return children;
10575
+ };
10576
+
10577
+ const FloatingAside = () => {
10578
+ const isScrollingUp = useMatchScrollDirection("up");
10579
+ const [hasScrolledEnough, setHasScrolledEnough] = React__default.useState(false);
10580
+ useScroll(document, ({ top }) => {
10581
+ const menu = document.getElementById("BodyAside");
10582
+ if (!menu)
10583
+ return false;
10584
+ let computedStyle = 0;
10585
+ if (window.getComputedStyle(menu).paddingTop.match(/\d+/)) {
10586
+ computedStyle = Number(
10587
+ window.getComputedStyle(menu).paddingTop.match(/\d+/)[0]
10588
+ ) + Number(
10589
+ window.getComputedStyle(menu).paddingBottom.match(/\d+/)[0]
10590
+ );
10591
+ }
10592
+ const boxTop = menu.offsetHeight + menu.offsetTop + computedStyle;
10593
+ if (hasScrolledEnough !== boxTop < top)
10594
+ setHasScrolledEnough(boxTop < top);
10595
+ return false;
10596
+ });
10597
+ const children = useMenu([1, 2, 3]);
10598
+ const { Portal } = usePortal({
10599
+ containerId: "NonControlledAppModals",
10600
+ clickOutsideToHide: false,
10601
+ autoRemoveContainer: false,
10602
+ defaultShow: true,
10603
+ escToHide: false
10604
+ });
10605
+ if (!children)
10606
+ return null;
10607
+ return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(
10608
+ Box,
10609
+ {
10610
+ ...getVariant("layout.twoColumnsAside.floatingResponsive"),
10611
+ className: isScrollingUp && hasScrolledEnough ? "" : "hidden",
10612
+ children: /* @__PURE__ */ jsx(
10613
+ AccordionItem,
10614
+ {
10615
+ defaultExpanded: false,
10616
+ buttonProps: {
10617
+ label: getLabel("lblMnuOpc").text,
10618
+ ariaLabel: getLabel("lblMnuOpc").title
10619
+ },
10620
+ id: "floatingMenuAccordion",
10621
+ ...getVariant("tabPrimary"),
10622
+ children: isScrollingUp && hasScrolledEnough && children
10623
+ }
10624
+ )
10625
+ }
10626
+ ) });
10627
+ };
10628
+
10629
+ const FooterResponsiveButtons = ({
10630
+ breakpoint = 4,
10631
+ children,
10632
+ className
10633
+ }) => {
10634
+ const { Portal } = usePortal({
10635
+ containerId: "NonControlledAppModals",
10636
+ clickOutsideToHide: false,
10637
+ autoRemoveContainer: false,
10638
+ defaultShow: true,
10639
+ escToHide: false
10640
+ });
10641
+ const appBreakpoint = useBreakpointIndex();
10642
+ const shouldShow = useMatchScrollDirection("down") && breakpoint >= appBreakpoint;
10643
+ if (Array.isArray(children) && children.length === 0)
10644
+ return null;
10645
+ return /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(
10646
+ Box,
10647
+ {
10648
+ as: "aside",
10649
+ ...getVariant("layout.footerResponsiveButtons"),
10650
+ className: `${className ?? ""} ${shouldShow ? "visible" : "hidden"}`,
10651
+ children
10652
+ }
10653
+ ) });
10654
+ };
10655
+
10656
+ const HamburguerMenu = ({
10657
+ container = ".TitleContainer",
10658
+ header = "MainHeader",
10659
+ forceVisibility
10660
+ }) => {
10661
+ const [hamburguerRef, setHamburguerRef] = React__default.useState(
10662
+ null
10663
+ );
10664
+ const [menuRef, setMenuRef] = React__default.useState(null);
10665
+ const [menuCoords, setMenuCoords] = React__default.useState(void 0);
10666
+ const [hamburguerCoords, setHamburguerCoords] = React__default.useState(null);
10667
+ const { Portal } = usePortal({
10668
+ containerId: "NonControlledAppModals",
10669
+ autoRemoveContainer: false,
10670
+ defaultShow: true,
10671
+ clickOutsideToHide: false,
10672
+ escToHide: false
10673
+ });
10674
+ React__default.useLayoutEffect(() => {
10675
+ const unsuscribers = [];
10676
+ if (hamburguerRef) {
10677
+ const resize = () => {
10678
+ const bounding = document.querySelector(container).getBoundingClientRect();
10679
+ if (!hamburguerRef || bounding.height === 0)
10680
+ return;
10681
+ const hamburguerHeight = Number(
10682
+ hamburguerRef.querySelector(".hamburguerIcon").clientHeight
10683
+ );
10684
+ const hamburguerTop = bounding.top + bounding.height / 2 - hamburguerHeight / 2 + window.scrollY;
10685
+ const shouldOpenBelow = bounding.top <= window.innerHeight / 3;
10686
+ const menuTop = shouldOpenBelow ? hamburguerTop + hamburguerHeight + 10 : 10;
10687
+ const menuRight = shouldOpenBelow ? 10 : 60;
10688
+ const maxHeight = shouldOpenBelow ? window.innerHeight - menuTop - 50 : window.innerHeight - 50;
10689
+ setMenuCoords({
10690
+ right: `${menuRight}px`,
10691
+ top: `${menuTop}px`,
10692
+ maxHeight: `${maxHeight}px`,
10693
+ overflow: "auto"
10694
+ });
10695
+ setHamburguerCoords({
10696
+ right: `${10}px`,
10697
+ top: `${hamburguerTop}px`
10698
+ });
10699
+ };
10700
+ const observer = new ResizeObserver(resize);
10701
+ observer.observe(document.getElementById(header));
10702
+ unsuscribers.push(() => void observer.disconnect());
10703
+ resize();
10704
+ }
10705
+ return () => unsuscribers.forEach((unsuscribe) => unsuscribe());
10706
+ }, [container, hamburguerRef, header, menuRef]);
10707
+ const children = useMenu([4, 5, 6, 7]);
10708
+ const iconSx = React__default.useMemo(
10709
+ () => hamburguerCoords ? {
10710
+ position: "fixed",
10711
+ zIndex: "menu",
10712
+ ...hamburguerCoords
10713
+ } : void 0,
10714
+ [hamburguerCoords]
10715
+ );
10716
+ const menuSx = React__default.useMemo(
10717
+ () => menuCoords ? {
10718
+ position: "fixed",
10719
+ zIndex: "menu",
10720
+ ...menuCoords
10721
+ } : void 0,
10722
+ [menuCoords]
10723
+ );
10724
+ const breakpoint = useBreakpointIndex({ defaultIndex: 5 });
10725
+ const [isVisible, setIsVisible] = useState(false);
10726
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
10727
+ /* @__PURE__ */ jsx(
10728
+ Box,
10729
+ {
10730
+ id: "HamburguerIconWrapper",
10731
+ className: "HamburguerIconWrapper",
10732
+ ref: setHamburguerRef,
10733
+ as: "aside",
10734
+ "aria-label": window.LBL_OPTIONS_VAR,
10735
+ children: /* @__PURE__ */ jsx(
10736
+ IconButton,
10737
+ {
10738
+ sx: iconSx,
10739
+ icon: "Hamburguer",
10740
+ className: "hamburguerIcon",
10741
+ onClick: () => setIsVisible((s) => !s),
10742
+ "aria-label": window.LBL_OPEN_MENU
10743
+ }
10744
+ )
10745
+ }
10746
+ ),
10747
+ /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
10748
+ CSSTransition,
10749
+ {
10750
+ in: isVisible,
10751
+ timeout: 150,
10752
+ classNames: "hamburguerMenu",
10753
+ children: /* @__PURE__ */ jsx(
10754
+ Box,
10755
+ {
10756
+ ref: setMenuRef,
10757
+ ...getVariant("layout.twoColumnsAside.hamburguerMenu"),
10758
+ className: "hamburguerMenu",
10759
+ sx: menuSx,
10760
+ as: "aside",
10761
+ "aria-label": window.LBL_OPTIONS_AND_TABS,
10762
+ children: (breakpoint === 4 || forceVisibility) && children
10763
+ }
10764
+ )
10765
+ }
10766
+ ) }) })
10767
+ ] });
10768
+ };
10769
+
10770
+ const HeaderButtons = () => {
10771
+ const breakPoint = useBreakpointIndex();
10772
+ const shouldShowAsFloat = breakPoint === 3;
10773
+ const { Portal: FloatPortal } = usePortal({
10774
+ containerId: "NonControlledAppModals",
10775
+ clickOutsideToHide: false,
10776
+ autoRemoveContainer: false,
10777
+ defaultShow: true,
10778
+ escToHide: false
10779
+ });
10780
+ return /* @__PURE__ */ jsxs(Box, { className: "iconsBar", children: [
10781
+ breakPoint >= 4 && /* @__PURE__ */ jsx(FavoriteIcon, {}),
10782
+ shouldShowAsFloat && /* @__PURE__ */ jsx(FloatPortal, { children: /* @__PURE__ */ jsx(Box, { ...getVariant("layout.twoColumnsAside.hamburguer"), children: /* @__PURE__ */ jsx(
10783
+ IconButton$1,
10784
+ {
10785
+ title: window.TOGGLE_MENU,
10786
+ "aria-label": window.TOGGLE_MENU,
10787
+ onClick: (ev) => {
10788
+ ev.stopPropagation();
10789
+ },
10790
+ className: "toggleMenu",
10791
+ children: /* @__PURE__ */ jsx(FaBars, {})
10792
+ }
10793
+ ) }) })
10794
+ ] });
10795
+ };
10796
+
10797
+ const Header = ({ title, description, image: imageUrl }) => {
10798
+ return /* @__PURE__ */ jsxs("header", { children: [
10799
+ /* @__PURE__ */ jsxs(Box, { className: "imageTitleAndDescription", children: [
10800
+ /* @__PURE__ */ jsx(Box, { className: "image", children: /* @__PURE__ */ jsx(Image, { src: imageUrl ?? "", role: "presentation", alt: "" }) }),
10801
+ /* @__PURE__ */ jsxs(Box, { className: "titleAndDescription", children: [
10802
+ /* @__PURE__ */ jsx(Heading, { ...getVariant("text.title"), as: "h1", children: /* @__PURE__ */ jsx(Box, { as: "span", children: title }) }),
10803
+ /* @__PURE__ */ jsx(Box, { as: "p", className: "description", children: description ?? "" })
10804
+ ] })
10805
+ ] }),
10806
+ /* @__PURE__ */ jsx(HeaderButtons, {})
10807
+ ] });
10808
+ };
10809
+
10810
+ const ShowResponsive = ({
10811
+ show = [true],
10812
+ children,
10813
+ display = "block"
10814
+ }) => {
10815
+ return /* @__PURE__ */ jsx(Box, { sx: { display: show.map((def) => def ? display : "none") }, children });
10816
+ };
10817
+
10818
+ const CenteredHeaderButtons = () => {
10819
+ const breakpoint = useBreakpointIndex({ defaultIndex: 4 });
10820
+ const { Portal: Portal1 } = usePortal({
10821
+ autoRemoveContainer: false,
10822
+ clickOutsideToHide: false,
10823
+ containerId: "ResponsiveButtons",
10824
+ defaultShow: true,
10825
+ escToHide: false,
10826
+ internalShowHide: true
10827
+ });
10828
+ const { Portal: Portal2 } = usePortal({
10829
+ autoRemoveContainer: false,
10830
+ clickOutsideToHide: false,
10831
+ containerId: "HamburguerIconWrapper",
10832
+ defaultShow: true,
10833
+ escToHide: false,
10834
+ internalShowHide: true
10835
+ });
10836
+ const { Portal: Portal3 } = usePortal({
10837
+ autoRemoveContainer: false,
10838
+ clickOutsideToHide: false,
10839
+ containerId: "RelatedButtonsContainer",
10840
+ defaultShow: true,
10841
+ escToHide: false,
10842
+ internalShowHide: true
10843
+ });
10844
+ const icon = React__default.useMemo(() => /* @__PURE__ */ jsx(FavoriteIcon, {}), []);
10845
+ if (breakpoint < 3)
10846
+ return /* @__PURE__ */ jsx(Portal1, { children: icon });
10847
+ if (breakpoint === 3)
10848
+ return /* @__PURE__ */ jsx(Portal2, { children: icon });
10849
+ return /* @__PURE__ */ jsx(Portal3, { children: icon });
10850
+ };
10851
+
10220
10852
  var __defProp$5 = Object.defineProperty;
10221
10853
  var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10222
10854
  var __publicField$5 = (obj, key, value) => {
@@ -11283,5 +11915,5 @@ const _FiltersStore = class _FiltersStore {
11283
11915
  __publicField(_FiltersStore, "instance", new _FiltersStore());
11284
11916
  let FiltersStore = _FiltersStore;
11285
11917
 
11286
- export { Accordion, AccordionContext, AccordionItem, AccordionItemButton, AccordionItemContent, AccordionItemContext, AlertModal, ApiaFilter, ApiaUtil, ApiaUtilModalHandler, ApiaUtilTooltip, AutoEllipsis, Autocomplete, AutocompleteController, AutogrowTextarea, AutoscrollContainer, BaseButton, CalendarModal, Captcha, ChatController, ChatMessage, Checkbox$1 as Checkbox, CollapsiblePanel, Confirm, ConfirmModal, ContainerWithHeader, DateInput, DeadSessionModal, DefaultIconRenderer, DefaultTabsLabelRenderer, DialogButtonBar, Dropzone, FieldErrorMessage, FieldLabel, FileCard, FilterConditionDTO, FilterDTO, FiltersStore, FloatingChatController, IconButton, IconInput, IconsList, LabelBox, LinearLoader, ListSkeletonLoader, Listbox, ListboxItem, LoaderSpinner, Modal, NumberInput, Overlay, Parameter, ParameterRender, Parameters, ParametersGroup, ParametersStore, ParametersTable, ProgressBar, RequiredMark, ScreenLocker, SimpleButton, SortableList, SortableListItem, Tab, Tabs, TabsContent, TabsController, TabsList, Templater, Toolbar, ToolbarController, ToolbarIconButton, ToolbarInput, ToolbarSelect, ToolbarSeparator, ToolbarTextButton, UnstyledSortableList, UploadHandler, Uploader, WaiTypeAhead, getBase64FromBlob, getBase64FromFile, getFieldErrorStyles, getFieldTouchedStyles, getFileExtension, importComponent, isFavoriteIcon, isImage, isParametersGroup, makeResponsiveComponent, parseNumberInputValueToNumber, parseNumberValueToNumberInput, useAccordionContext, useCurrentTab, useMenu, useModal, useModalContext, useOtherTagButton, useTabsContext };
11918
+ export { Accordion, AccordionAside, AccordionContext, AccordionItem, AccordionItemButton, AccordionItemContent, AccordionItemContext, AlertModal, ApiaFilter, ApiaUtil, ApiaUtilModalHandler, ApiaUtilTooltip, Aside, AsideLoader, AsidePanel, AutoEllipsis, Autocomplete, AutocompleteController, AutogrowTextarea, AutoscrollContainer, BaseButton, BodyAside, CalendarModal, Captcha, CenteredHeaderButtons, ChatController, ChatMessage, Checkbox$1 as Checkbox, CollapsiblePanel, Confirm, ConfirmModal, ContainerWithHeader, DateInput, DeadSessionModal, DefaultIconRenderer, DefaultTabsLabelRenderer, DialogButtonBar, Dropzone, FavoriteIcon, FieldErrorMessage, FieldLabel, FileCard, FilterConditionDTO, FilterDTO, FiltersStore, FloatingAside, FloatingChatController, FooterButtons, FooterResponsiveButtons, HamburguerMenu, Header, HeaderButtons, IconButton, IconInput, IconsList, Label, LabelBox, LinearLoader, ListSkeletonLoader, Listbox, ListboxItem, LoaderSpinner, Modal, NumberInput, Overlay, Pagination, Parameter, ParameterRender, Parameters, ParametersGroup, ParametersStore, ParametersTable, ProgressBar, RequiredMark, ScreenLocker, ShowResponsive, SimpleButton, SortableList, SortableListItem, Tab, Tabs, TabsContent, TabsController, TabsList, Templater, Toolbar, ToolbarController, ToolbarIconButton, ToolbarInput, ToolbarSelect, ToolbarSeparator, ToolbarTextButton, UnstyledSortableList, UploadHandler, Uploader, WaiTypeAhead, getBase64FromBlob, getBase64FromFile, getFieldErrorStyles, getFieldTouchedStyles, getFileExtension, importComponent, isFavoriteIcon, isImage, isParametersGroup, makeResponsiveComponent, menuController, parseNumberInputValueToNumber, parseNumberValueToNumberInput, useAccordionContext, useCurrentTab, useMenu, useModal, useModalContext, useOtherTagButton, useTabsContext };
11287
11919
  //# sourceMappingURL=index.js.map