@apia/components 4.0.27 → 4.0.29

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