@reykjavik/hanna-react 0.10.53
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/CHANGELOG.md +795 -0
- package/README.md +69 -0
- package/lib/AccordionList.cjs +91 -0
- package/lib/AccordionList.mjs +69 -0
- package/lib/ActionCards.cjs +57 -0
- package/lib/ActionCards.mjs +35 -0
- package/lib/Alert.cjs +159 -0
- package/lib/Alert.mjs +139 -0
- package/lib/ArticleCarousel/_ArticleCarouselCard.cjs +75 -0
- package/lib/ArticleCarousel/_ArticleCarouselCard.mjs +51 -0
- package/lib/ArticleCarousel.cjs +43 -0
- package/lib/ArticleCarousel.mjs +21 -0
- package/lib/ArticleMeta.cjs +46 -0
- package/lib/ArticleMeta.mjs +22 -0
- package/lib/Attention.cjs +33 -0
- package/lib/Attention.mjs +9 -0
- package/lib/BasicTable.cjs +72 -0
- package/lib/BasicTable.mjs +50 -0
- package/lib/Bling.cjs +76 -0
- package/lib/Bling.mjs +52 -0
- package/lib/BlockBreak.cjs +32 -0
- package/lib/BlockBreak.mjs +8 -0
- package/lib/BlockQuote.cjs +47 -0
- package/lib/BlockQuote.mjs +25 -0
- package/lib/BreadCrumbs.cjs +67 -0
- package/lib/BreadCrumbs.mjs +43 -0
- package/lib/ButtonBack.cjs +47 -0
- package/lib/ButtonBack.mjs +25 -0
- package/lib/ButtonBar.cjs +45 -0
- package/lib/ButtonBar.mjs +18 -0
- package/lib/ButtonPrimary.cjs +47 -0
- package/lib/ButtonPrimary.mjs +25 -0
- package/lib/ButtonSecondary.cjs +47 -0
- package/lib/ButtonSecondary.mjs +25 -0
- package/lib/ButtonTertiary.cjs +64 -0
- package/lib/ButtonTertiary.mjs +42 -0
- package/lib/Carousel.cjs +52 -0
- package/lib/Carousel.mjs +30 -0
- package/lib/CarouselStepper.cjs +51 -0
- package/lib/CarouselStepper.mjs +29 -0
- package/lib/CenterColumn.cjs +40 -0
- package/lib/CenterColumn.mjs +16 -0
- package/lib/Checkbox.cjs +52 -0
- package/lib/Checkbox.mjs +30 -0
- package/lib/CheckboxButtonsGroup.cjs +65 -0
- package/lib/CheckboxButtonsGroup.mjs +43 -0
- package/lib/CheckboxGroup.cjs +55 -0
- package/lib/CheckboxGroup.mjs +33 -0
- package/lib/CityBlock.cjs +49 -0
- package/lib/CityBlock.mjs +25 -0
- package/lib/ContactBubble.cjs +200 -0
- package/lib/ContactBubble.mjs +173 -0
- package/lib/ContentArticle.cjs +63 -0
- package/lib/ContentArticle.mjs +41 -0
- package/lib/ContentImage.cjs +58 -0
- package/lib/ContentImage.mjs +36 -0
- package/lib/Datepicker.cjs +164 -0
- package/lib/Datepicker.mjs +142 -0
- package/lib/ExtraLinks.cjs +96 -0
- package/lib/ExtraLinks.mjs +74 -0
- package/lib/FeatureList.cjs +53 -0
- package/lib/FeatureList.mjs +29 -0
- package/lib/FieldGroup.cjs +40 -0
- package/lib/FieldGroup.mjs +16 -0
- package/lib/FileInput.cjs +256 -0
- package/lib/FileInput.mjs +234 -0
- package/lib/Foonote.cjs +30 -0
- package/lib/Foonote.mjs +6 -0
- package/lib/FooterBadges.cjs +49 -0
- package/lib/FooterBadges.mjs +25 -0
- package/lib/FooterInfo.cjs +47 -0
- package/lib/FooterInfo.mjs +23 -0
- package/lib/Footnote.cjs +32 -0
- package/lib/Footnote.mjs +8 -0
- package/lib/Form.cjs +56 -0
- package/lib/Form.mjs +34 -0
- package/lib/FormField.cjs +153 -0
- package/lib/FormField.mjs +131 -0
- package/lib/Gallery/_GalleryItem.cjs +83 -0
- package/lib/Gallery/_GalleryItem.mjs +61 -0
- package/lib/Gallery/_GalleryModal.cjs +104 -0
- package/lib/Gallery/_GalleryModal.mjs +82 -0
- package/lib/Gallery/_GalleryModalContext.cjs +30 -0
- package/lib/Gallery/_GalleryModalContext.mjs +6 -0
- package/lib/Gallery/_GalleryModalItem.cjs +59 -0
- package/lib/Gallery/_GalleryModalItem.mjs +36 -0
- package/lib/Gallery.cjs +79 -0
- package/lib/Gallery.mjs +57 -0
- package/lib/GridBlocks.cjs +81 -0
- package/lib/GridBlocks.mjs +59 -0
- package/lib/Heading.cjs +45 -0
- package/lib/Heading.mjs +21 -0
- package/lib/HeroBlock.cjs +74 -0
- package/lib/HeroBlock.mjs +52 -0
- package/lib/IframeBlock.cjs +48 -0
- package/lib/IframeBlock.mjs +24 -0
- package/lib/Illustration.cjs +51 -0
- package/lib/Illustration.mjs +31 -0
- package/lib/ImageCards.cjs +72 -0
- package/lib/ImageCards.mjs +52 -0
- package/lib/InfoBlock.cjs +51 -0
- package/lib/InfoBlock.mjs +27 -0
- package/lib/InfoHero.cjs +150 -0
- package/lib/InfoHero.mjs +128 -0
- package/lib/IslandBlock.cjs +63 -0
- package/lib/IslandBlock.mjs +41 -0
- package/lib/IslandPageBlock.cjs +49 -0
- package/lib/IslandPageBlock.mjs +25 -0
- package/lib/LabeledTextBlock.cjs +60 -0
- package/lib/LabeledTextBlock.mjs +38 -0
- package/lib/Layout.cjs +113 -0
- package/lib/Layout.mjs +87 -0
- package/lib/MainMenu/_Auxiliary.cjs +54 -0
- package/lib/MainMenu/_Auxiliary.mjs +28 -0
- package/lib/MainMenu/_PrimaryPanel.cjs +74 -0
- package/lib/MainMenu/_PrimaryPanel.mjs +48 -0
- package/lib/MainMenu.cjs +209 -0
- package/lib/MainMenu.mjs +187 -0
- package/lib/MiniMetrics.cjs +56 -0
- package/lib/MiniMetrics.mjs +34 -0
- package/lib/Modal.cjs +70 -0
- package/lib/Modal.mjs +48 -0
- package/lib/NameCard.cjs +115 -0
- package/lib/NameCard.mjs +91 -0
- package/lib/NameCards.cjs +52 -0
- package/lib/NameCards.mjs +30 -0
- package/lib/NewsHero.cjs +136 -0
- package/lib/NewsHero.mjs +114 -0
- package/lib/PageFilter.cjs +48 -0
- package/lib/PageFilter.mjs +24 -0
- package/lib/PageHeading.cjs +42 -0
- package/lib/PageHeading.mjs +18 -0
- package/lib/ProcessOverview.cjs +52 -0
- package/lib/ProcessOverview.mjs +28 -0
- package/lib/PullQuote.cjs +47 -0
- package/lib/PullQuote.mjs +25 -0
- package/lib/RadioButtonsGroup.cjs +64 -0
- package/lib/RadioButtonsGroup.mjs +42 -0
- package/lib/RadioGroup.cjs +58 -0
- package/lib/RadioGroup.mjs +36 -0
- package/lib/RelatedLinks.cjs +61 -0
- package/lib/RelatedLinks.mjs +37 -0
- package/lib/RowBlock.cjs +39 -0
- package/lib/RowBlock.mjs +15 -0
- package/lib/RowBlockColumn.cjs +40 -0
- package/lib/RowBlockColumn.mjs +16 -0
- package/lib/SearchInput.cjs +136 -0
- package/lib/SearchInput.mjs +114 -0
- package/lib/SearchResults/_SearchResultsItem.cjs +54 -0
- package/lib/SearchResults/_SearchResultsItem.mjs +30 -0
- package/lib/SearchResults.cjs +172 -0
- package/lib/SearchResults.mjs +150 -0
- package/lib/SeenEffect.cjs +66 -0
- package/lib/SeenEffect.mjs +44 -0
- package/lib/Selectbox.cjs +144 -0
- package/lib/Selectbox.mjs +122 -0
- package/lib/ShareButtons.cjs +101 -0
- package/lib/ShareButtons.mjs +83 -0
- package/lib/Sharpie.cjs +51 -0
- package/lib/Sharpie.mjs +27 -0
- package/lib/SiteSearchAutocomplete.cjs +150 -0
- package/lib/SiteSearchAutocomplete.mjs +126 -0
- package/lib/SiteSearchCurtain.cjs +78 -0
- package/lib/SiteSearchCurtain.mjs +56 -0
- package/lib/SiteSearchInput.cjs +119 -0
- package/lib/SiteSearchInput.mjs +97 -0
- package/lib/Skeleton.cjs +63 -0
- package/lib/Skeleton.mjs +39 -0
- package/lib/SubHeading.cjs +43 -0
- package/lib/SubHeading.mjs +19 -0
- package/lib/Tabs.cjs +166 -0
- package/lib/Tabs.mjs +144 -0
- package/lib/TagPill.cjs +113 -0
- package/lib/TagPill.mjs +91 -0
- package/lib/TextBlock.cjs +45 -0
- package/lib/TextBlock.mjs +21 -0
- package/lib/TextButton.cjs +55 -0
- package/lib/TextButton.mjs +33 -0
- package/lib/TextInput.cjs +136 -0
- package/lib/TextInput.mjs +114 -0
- package/lib/VSpacer.cjs +70 -0
- package/lib/VSpacer.mjs +46 -0
- package/lib/VerticalTabsTOC.cjs +123 -0
- package/lib/VerticalTabsTOC.mjs +101 -0
- package/lib/WizardLayout.cjs +79 -0
- package/lib/WizardLayout.mjs +55 -0
- package/lib/WizardLayoutClose.cjs +47 -0
- package/lib/WizardLayoutClose.mjs +25 -0
- package/lib/WizardStepper.cjs +55 -0
- package/lib/WizardStepper.mjs +31 -0
- package/lib/_abstract/Button.cjs +114 -0
- package/lib/_abstract/Button.mjs +92 -0
- package/lib/_abstract/CardList.cjs +100 -0
- package/lib/_abstract/CardList.mjs +76 -0
- package/lib/_abstract/Image.cjs +75 -0
- package/lib/_abstract/Image.mjs +51 -0
- package/lib/_abstract/Link.cjs +37 -0
- package/lib/_abstract/Link.mjs +10 -0
- package/lib/_abstract/TogglerGroup.cjs +92 -0
- package/lib/_abstract/TogglerGroup.mjs +70 -0
- package/lib/_abstract/TogglerGroupField.cjs +121 -0
- package/lib/_abstract/TogglerGroupField.mjs +99 -0
- package/lib/_abstract/TogglerInput.cjs +105 -0
- package/lib/_abstract/TogglerInput.mjs +83 -0
- package/lib/_abstract/_AbstractCarousel.cjs +170 -0
- package/lib/_abstract/_AbstractCarousel.mjs +152 -0
- package/lib/_abstract/_Blings.cjs +47 -0
- package/lib/_abstract/_Blings.mjs +23 -0
- package/lib/_abstract/_Block.cjs +73 -0
- package/lib/_abstract/_Block.mjs +51 -0
- package/lib/_abstract/_Quote.cjs +43 -0
- package/lib/_abstract/_Quote.mjs +17 -0
- package/lib/_abstract/breakOnNL.cjs +30 -0
- package/lib/_abstract/breakOnNL.mjs +6 -0
- package/lib/assets.cjs +77 -0
- package/lib/assets.mjs +53 -0
- package/lib/constants.cjs +49 -0
- package/lib/constants.mjs +24 -0
- package/lib/focus-visible.cjs +1 -0
- package/lib/focus-visible.mjs +1 -0
- package/lib/utils/config.cjs +27 -0
- package/lib/utils/config.mjs +4 -0
- package/lib/utils/detectEdgeScroll.cjs +95 -0
- package/lib/utils/detectEdgeScroll.mjs +71 -0
- package/lib/utils/env.cjs +31 -0
- package/lib/utils/env.mjs +5 -0
- package/lib/utils/seenEffect.cjs +93 -0
- package/lib/utils/seenEffect.mjs +65 -0
- package/lib/utils/useFormatMonitor.cjs +29 -0
- package/lib/utils/useFormatMonitor.mjs +6 -0
- package/lib/utils/useGetSVGtext.cjs +44 -0
- package/lib/utils/useGetSVGtext.mjs +21 -0
- package/lib/utils/useMenuToggling.cjs +83 -0
- package/lib/utils/useMenuToggling.mjs +60 -0
- package/lib/utils/useScrollbarWidthCSSVar.cjs +32 -0
- package/lib/utils/useScrollbarWidthCSSVar.mjs +6 -0
- package/lib/utils.cjs +18 -0
- package/lib/utils.mjs +2 -0
- package/package.json +491 -0
- package/types/AccordionList.d.ts +17 -0
- package/types/ActionCards.d.ts +5 -0
- package/types/Alert.d.ts +49 -0
- package/types/ArticleCarousel/_ArticleCarouselCard.d.ts +27 -0
- package/types/ArticleCarousel.d.ts +12 -0
- package/types/ArticleMeta.d.ts +9 -0
- package/types/Attention.d.ts +7 -0
- package/types/BasicTable.d.ts +12 -0
- package/types/Bling.d.ts +81 -0
- package/types/BlockBreak.d.ts +2 -0
- package/types/BlockQuote.d.ts +4 -0
- package/types/BreadCrumbs.d.ts +11 -0
- package/types/ButtonBack.d.ts +7 -0
- package/types/ButtonBar.d.ts +16 -0
- package/types/ButtonPrimary.d.ts +7 -0
- package/types/ButtonSecondary.d.ts +7 -0
- package/types/ButtonTertiary.d.ts +12 -0
- package/types/Carousel.d.ts +4 -0
- package/types/CarouselStepper.d.ts +4 -0
- package/types/CenterColumn.d.ts +7 -0
- package/types/Checkbox.d.ts +4 -0
- package/types/CheckboxButtonsGroup.d.ts +11 -0
- package/types/CheckboxGroup.d.ts +9 -0
- package/types/CityBlock.d.ts +23 -0
- package/types/ContactBubble.d.ts +58 -0
- package/types/ContentArticle.d.ts +15 -0
- package/types/ContentImage.d.ts +8 -0
- package/types/Datepicker.d.ts +39 -0
- package/types/ExtraLinks.d.ts +18 -0
- package/types/FeatureList.d.ts +12 -0
- package/types/FieldGroup.d.ts +9 -0
- package/types/FileInput.d.ts +17 -0
- package/types/Foonote.d.ts +12 -0
- package/types/FooterBadges.d.ts +9 -0
- package/types/FooterInfo.d.ts +18 -0
- package/types/Footnote.d.ts +6 -0
- package/types/Form.d.ts +7 -0
- package/types/FormField.d.ts +65 -0
- package/types/Gallery/_GalleryItem.d.ts +8 -0
- package/types/Gallery/_GalleryModal.d.ts +6 -0
- package/types/Gallery/_GalleryModalContext.d.ts +9 -0
- package/types/Gallery/_GalleryModalItem.d.ts +3 -0
- package/types/Gallery.d.ts +17 -0
- package/types/GridBlocks.d.ts +26 -0
- package/types/Heading.d.ts +16 -0
- package/types/HeroBlock.d.ts +19 -0
- package/types/IframeBlock.d.ts +23 -0
- package/types/Illustration.d.ts +13 -0
- package/types/ImageCards.d.ts +8 -0
- package/types/InfoBlock.d.ts +17 -0
- package/types/InfoHero.d.ts +17 -0
- package/types/IslandBlock.d.ts +25 -0
- package/types/IslandPageBlock.d.ts +24 -0
- package/types/LabeledTextBlock.d.ts +11 -0
- package/types/Layout.d.ts +33 -0
- package/types/MainMenu/_Auxiliary.d.ts +6 -0
- package/types/MainMenu/_PrimaryPanel.d.ts +13 -0
- package/types/MainMenu.d.ts +48 -0
- package/types/MiniMetrics.d.ts +8 -0
- package/types/Modal.d.ts +10 -0
- package/types/NameCard.d.ts +64 -0
- package/types/NameCards.d.ts +6 -0
- package/types/NewsHero.d.ts +14 -0
- package/types/PageFilter.d.ts +17 -0
- package/types/PageHeading.d.ts +10 -0
- package/types/ProcessOverview.d.ts +13 -0
- package/types/PullQuote.d.ts +4 -0
- package/types/RadioButtonsGroup.d.ts +11 -0
- package/types/RadioGroup.d.ts +13 -0
- package/types/RelatedLinks.d.ts +20 -0
- package/types/RowBlock.d.ts +12 -0
- package/types/RowBlockColumn.d.ts +8 -0
- package/types/SearchInput.d.ts +18 -0
- package/types/SearchResults/_SearchResultsItem.d.ts +18 -0
- package/types/SearchResults.d.ts +33 -0
- package/types/SeenEffect.d.ts +4 -0
- package/types/Selectbox.d.ts +8 -0
- package/types/ShareButtons.d.ts +9 -0
- package/types/Sharpie.d.ts +23 -0
- package/types/SiteSearchAutocomplete.d.ts +40 -0
- package/types/SiteSearchCurtain.d.ts +6 -0
- package/types/SiteSearchInput.d.ts +24 -0
- package/types/Skeleton.d.ts +25 -0
- package/types/SubHeading.d.ts +10 -0
- package/types/Tabs.d.ts +35 -0
- package/types/TagPill.d.ts +27 -0
- package/types/TextBlock.d.ts +15 -0
- package/types/TextButton.d.ts +9 -0
- package/types/TextInput.d.ts +16 -0
- package/types/VSpacer.d.ts +24 -0
- package/types/VerticalTabsTOC.d.ts +14 -0
- package/types/WizardLayout.d.ts +15 -0
- package/types/WizardLayoutClose.d.ts +3 -0
- package/types/WizardStepper.d.ts +36 -0
- package/types/_abstract/Button.d.ts +40 -0
- package/types/_abstract/CardList.d.ts +29 -0
- package/types/_abstract/Image.d.ts +32 -0
- package/types/_abstract/Link.d.ts +27 -0
- package/types/_abstract/TogglerGroup.d.ts +31 -0
- package/types/_abstract/TogglerGroupField.d.ts +17 -0
- package/types/_abstract/TogglerInput.d.ts +22 -0
- package/types/_abstract/_AbstractCarousel.d.ts +25 -0
- package/types/_abstract/_Blings.d.ts +11 -0
- package/types/_abstract/_Block.d.ts +22 -0
- package/types/_abstract/_Quote.d.ts +9 -0
- package/types/_abstract/breakOnNL.d.ts +2 -0
- package/types/assets.d.ts +42 -0
- package/types/constants.d.ts +39 -0
- package/types/focus-visible.d.ts +1 -0
- package/types/utils/config.d.ts +2 -0
- package/types/utils/detectEdgeScroll.d.ts +52 -0
- package/types/utils/env.d.ts +1 -0
- package/types/utils/seenEffect.d.ts +28 -0
- package/types/utils/useFormatMonitor.d.ts +38 -0
- package/types/utils/useGetSVGtext.d.ts +6 -0
- package/types/utils/useMenuToggling.d.ts +8 -0
- package/types/utils/useScrollbarWidthCSSVar.d.ts +1 -0
- package/types/utils.d.ts +2 -0
package/lib/MainMenu.cjs
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var MainMenu_exports = {};
|
|
39
|
+
__export(MainMenu_exports, {
|
|
40
|
+
default: () => MainMenu_default,
|
|
41
|
+
defaultMainMenuTexts: () => defaultMainMenuTexts
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(MainMenu_exports);
|
|
44
|
+
var import_react = __toESM(require("react"));
|
|
45
|
+
var import_focusElm = __toESM(require("@hugsmidjan/qj/focusElm"));
|
|
46
|
+
var import_hooks = require("@hugsmidjan/react/hooks");
|
|
47
|
+
var import_useShortState = __toESM(require("@hugsmidjan/react/hooks/useShortState"));
|
|
48
|
+
var import_getBemClass = __toESM(require("@hugsmidjan/react/utils/getBemClass"));
|
|
49
|
+
var import_hanna_utils = require("@reykjavik/hanna-utils");
|
|
50
|
+
var import_i18n = require("@reykjavik/hanna-utils/i18n");
|
|
51
|
+
var import_Link = require("./_abstract/Link");
|
|
52
|
+
var import_Auxiliary = require("./MainMenu/_Auxiliary");
|
|
53
|
+
var import_PrimaryPanel = require("./MainMenu/_PrimaryPanel");
|
|
54
|
+
var import_useFormatMonitor = require("./utils/useFormatMonitor");
|
|
55
|
+
const findActivePanel = (megaPanels, activeId) => activeId ? megaPanels.find((panel) => activeId === panel.id) : void 0;
|
|
56
|
+
const defaultMainMenuTexts = {
|
|
57
|
+
is: { lang: "is", backToMenu: "Loka", backToMenuLong: "Til baka \xED valmynd" },
|
|
58
|
+
en: { lang: "en", backToMenu: "Close", backToMenuLong: "Close and return to menu" }
|
|
59
|
+
};
|
|
60
|
+
const MainMenu = (props) => {
|
|
61
|
+
const { title, megaPanels = [], onItemClick, ssr, auxiliaryPanel } = props;
|
|
62
|
+
const isBrowser = (0, import_hooks.useIsBrowserSide)(ssr);
|
|
63
|
+
const menuElmRef = (0, import_react.useRef)(null);
|
|
64
|
+
const pressedLinkRef = (0, import_react.useRef)(null);
|
|
65
|
+
const activePanelRef = (0, import_react.useRef)(null);
|
|
66
|
+
const [activePanel, _setActivePanel] = (0, import_react.useState)(() => isBrowser && findActivePanel(megaPanels, props.activePanelId));
|
|
67
|
+
const [laggyActivePanel, setLaggyActivePanel] = (0, import_useShortState.default)();
|
|
68
|
+
const setActivePanel = (0, import_react.useCallback)((newActive, setFocus = true) => {
|
|
69
|
+
const htmlElmDataset = document.documentElement.dataset;
|
|
70
|
+
_setActivePanel((activePanel2) => {
|
|
71
|
+
const scrollElm = (0, import_hanna_utils.getPageScrollElm)();
|
|
72
|
+
if (!newActive) {
|
|
73
|
+
activePanel2 && setLaggyActivePanel(activePanel2, 1e3);
|
|
74
|
+
scrollElm.scrollTop = parseInt(htmlElmDataset.scrollTop || "") || 0;
|
|
75
|
+
delete htmlElmDataset.scrollTop;
|
|
76
|
+
delete htmlElmDataset.megaPanelActive;
|
|
77
|
+
} else {
|
|
78
|
+
setLaggyActivePanel(void 0, 0);
|
|
79
|
+
htmlElmDataset.scrollTop = String(scrollElm.scrollTop);
|
|
80
|
+
scrollElm.scrollTop = 0;
|
|
81
|
+
htmlElmDataset.megaPanelActive = "";
|
|
82
|
+
}
|
|
83
|
+
if (setFocus) {
|
|
84
|
+
const pressedLinkElm = pressedLinkRef.current;
|
|
85
|
+
setTimeout(() => {
|
|
86
|
+
if (!newActive) {
|
|
87
|
+
(0, import_focusElm.default)(pressedLinkElm);
|
|
88
|
+
} else if (newActive !== activePanel2) {
|
|
89
|
+
(0, import_focusElm.default)(activePanelRef.current);
|
|
90
|
+
}
|
|
91
|
+
}, 100);
|
|
92
|
+
}
|
|
93
|
+
return newActive;
|
|
94
|
+
});
|
|
95
|
+
}, [setLaggyActivePanel]);
|
|
96
|
+
(0, import_useFormatMonitor.useFormatMonitor)((media) => {
|
|
97
|
+
if (media.leftTopmenu) {
|
|
98
|
+
setActivePanel(void 0);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const hasActivePanel = !!activePanel;
|
|
102
|
+
(0, import_react.useEffect)(() => {
|
|
103
|
+
setActivePanel(findActivePanel(megaPanels, props.activePanelId));
|
|
104
|
+
}, [props.activePanelId, megaPanels, setActivePanel]);
|
|
105
|
+
(0, import_react.useEffect)(() => {
|
|
106
|
+
const menuElm = menuElmRef.current;
|
|
107
|
+
if (!hasActivePanel || !menuElm) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const escHandler = (e) => {
|
|
111
|
+
if (e.key === "Escape") {
|
|
112
|
+
setActivePanel(void 0);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const clickHandler = (e) => {
|
|
116
|
+
if (!menuElm.contains(e.target)) {
|
|
117
|
+
setActivePanel(void 0);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
document.addEventListener("keydown", escHandler);
|
|
121
|
+
document.addEventListener("click", clickHandler, true);
|
|
122
|
+
return () => {
|
|
123
|
+
document.removeEventListener("keydown", escHandler);
|
|
124
|
+
document.removeEventListener("click", clickHandler, true);
|
|
125
|
+
};
|
|
126
|
+
}, [hasActivePanel, setActivePanel]);
|
|
127
|
+
const menuItems = (0, import_react.useMemo)(() => props.items.map((item) => {
|
|
128
|
+
if (item === "---") {
|
|
129
|
+
return item;
|
|
130
|
+
}
|
|
131
|
+
const href = item.href;
|
|
132
|
+
const controlsId = item.controlsId || href && /^#/.test(href) && href.slice(1) || void 0;
|
|
133
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
134
|
+
controlsId,
|
|
135
|
+
megaPanel: controlsId && megaPanels.find((panel) => panel.id === controlsId)
|
|
136
|
+
});
|
|
137
|
+
}), [props.items, megaPanels]);
|
|
138
|
+
return /* @__PURE__ */ import_react.default.createElement("nav", {
|
|
139
|
+
className: "MainMenu",
|
|
140
|
+
"aria-label": title,
|
|
141
|
+
"data-sprinkled": isBrowser,
|
|
142
|
+
ref: menuElmRef
|
|
143
|
+
}, /* @__PURE__ */ import_react.default.createElement("h2", {
|
|
144
|
+
className: "MainMenu__title"
|
|
145
|
+
}, title), /* @__PURE__ */ import_react.default.createElement("ul", {
|
|
146
|
+
className: "MainMenu__items"
|
|
147
|
+
}, menuItems.map((item, i) => {
|
|
148
|
+
if (item === "---") {
|
|
149
|
+
return /* @__PURE__ */ import_react.default.createElement("li", {
|
|
150
|
+
key: i,
|
|
151
|
+
className: "MainMenu__separator",
|
|
152
|
+
"aria-hidden": "true"
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
const { label, labelLong, lang, controlsId, onClick } = item;
|
|
156
|
+
const pressed = activePanel && controlsId === activePanel.id || void 0;
|
|
157
|
+
return /* @__PURE__ */ import_react.default.createElement("li", {
|
|
158
|
+
key: i,
|
|
159
|
+
className: (0, import_getBemClass.default)("MainMenu__item", item.modifier),
|
|
160
|
+
"aria-current": item.current || void 0
|
|
161
|
+
}, onClick || !!item.megaPanel && (isBrowser || item.href != null) ? /* @__PURE__ */ import_react.default.createElement("button", {
|
|
162
|
+
className: "MainMenu__link",
|
|
163
|
+
onClick: () => {
|
|
164
|
+
item.megaPanel && setActivePanel(item.megaPanel);
|
|
165
|
+
onClick && onClick(i, item);
|
|
166
|
+
onItemClick && onItemClick(i, item);
|
|
167
|
+
},
|
|
168
|
+
ref: pressed && pressedLinkRef,
|
|
169
|
+
"aria-pressed": pressed,
|
|
170
|
+
"aria-controls": controlsId,
|
|
171
|
+
"aria-label": labelLong,
|
|
172
|
+
title: labelLong,
|
|
173
|
+
lang,
|
|
174
|
+
type: "button"
|
|
175
|
+
}, label) : item.href != null ? /* @__PURE__ */ import_react.default.createElement(import_Link.Link, {
|
|
176
|
+
className: "MainMenu__link",
|
|
177
|
+
href: item.href,
|
|
178
|
+
"aria-label": labelLong,
|
|
179
|
+
title: labelLong,
|
|
180
|
+
onClick: onItemClick && (() => onItemClick(i, item)),
|
|
181
|
+
lang
|
|
182
|
+
}, label) : void 0);
|
|
183
|
+
})), "\n\n", megaPanels.length > 0 && /* @__PURE__ */ import_react.default.createElement("div", {
|
|
184
|
+
className: (0, import_getBemClass.default)("MainMenu__panelsWrap", [activePanel && "active"])
|
|
185
|
+
}, /* @__PURE__ */ import_react.default.createElement("ul", {
|
|
186
|
+
className: "MainMenu__panels"
|
|
187
|
+
}, megaPanels.map((panel, i) => {
|
|
188
|
+
if (!panel.items.length) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const isActive = activePanel === panel || laggyActivePanel === panel || void 0;
|
|
192
|
+
const isParent = !!panel.items.find((item) => item.current);
|
|
193
|
+
return /* @__PURE__ */ import_react.default.createElement(import_PrimaryPanel.PrimaryPanel, {
|
|
194
|
+
key: i,
|
|
195
|
+
isParent,
|
|
196
|
+
isActive,
|
|
197
|
+
panel,
|
|
198
|
+
isBrowser,
|
|
199
|
+
setActivePanel,
|
|
200
|
+
texts: (0, import_i18n.getTexts)(props, defaultMainMenuTexts),
|
|
201
|
+
activeRef: activePanelRef
|
|
202
|
+
});
|
|
203
|
+
}), auxiliaryPanel && /* @__PURE__ */ import_react.default.createElement(import_Auxiliary.AuxiliaryPanel, __spreadValues({}, auxiliaryPanel)))));
|
|
204
|
+
};
|
|
205
|
+
var MainMenu_default = MainMenu;
|
|
206
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
207
|
+
0 && (module.exports = {
|
|
208
|
+
defaultMainMenuTexts
|
|
209
|
+
});
|
package/lib/MainMenu.mjs
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
21
|
+
import focusElm from "@hugsmidjan/qj/focusElm";
|
|
22
|
+
import { useIsBrowserSide } from "@hugsmidjan/react/hooks";
|
|
23
|
+
import useShortState from "@hugsmidjan/react/hooks/useShortState";
|
|
24
|
+
import getBemClass from "@hugsmidjan/react/utils/getBemClass";
|
|
25
|
+
import { getPageScrollElm } from "@reykjavik/hanna-utils";
|
|
26
|
+
import { getTexts } from "@reykjavik/hanna-utils/i18n";
|
|
27
|
+
import { Link } from "./_abstract/Link";
|
|
28
|
+
import {
|
|
29
|
+
AuxiliaryPanel
|
|
30
|
+
} from "./MainMenu/_Auxiliary";
|
|
31
|
+
import { PrimaryPanel } from "./MainMenu/_PrimaryPanel";
|
|
32
|
+
import { useFormatMonitor } from "./utils/useFormatMonitor";
|
|
33
|
+
const findActivePanel = (megaPanels, activeId) => activeId ? megaPanels.find((panel) => activeId === panel.id) : void 0;
|
|
34
|
+
const defaultMainMenuTexts = {
|
|
35
|
+
is: { lang: "is", backToMenu: "Loka", backToMenuLong: "Til baka \xED valmynd" },
|
|
36
|
+
en: { lang: "en", backToMenu: "Close", backToMenuLong: "Close and return to menu" }
|
|
37
|
+
};
|
|
38
|
+
const MainMenu = (props) => {
|
|
39
|
+
const { title, megaPanels = [], onItemClick, ssr, auxiliaryPanel } = props;
|
|
40
|
+
const isBrowser = useIsBrowserSide(ssr);
|
|
41
|
+
const menuElmRef = useRef(null);
|
|
42
|
+
const pressedLinkRef = useRef(null);
|
|
43
|
+
const activePanelRef = useRef(null);
|
|
44
|
+
const [activePanel, _setActivePanel] = useState(() => isBrowser && findActivePanel(megaPanels, props.activePanelId));
|
|
45
|
+
const [laggyActivePanel, setLaggyActivePanel] = useShortState();
|
|
46
|
+
const setActivePanel = useCallback((newActive, setFocus = true) => {
|
|
47
|
+
const htmlElmDataset = document.documentElement.dataset;
|
|
48
|
+
_setActivePanel((activePanel2) => {
|
|
49
|
+
const scrollElm = getPageScrollElm();
|
|
50
|
+
if (!newActive) {
|
|
51
|
+
activePanel2 && setLaggyActivePanel(activePanel2, 1e3);
|
|
52
|
+
scrollElm.scrollTop = parseInt(htmlElmDataset.scrollTop || "") || 0;
|
|
53
|
+
delete htmlElmDataset.scrollTop;
|
|
54
|
+
delete htmlElmDataset.megaPanelActive;
|
|
55
|
+
} else {
|
|
56
|
+
setLaggyActivePanel(void 0, 0);
|
|
57
|
+
htmlElmDataset.scrollTop = String(scrollElm.scrollTop);
|
|
58
|
+
scrollElm.scrollTop = 0;
|
|
59
|
+
htmlElmDataset.megaPanelActive = "";
|
|
60
|
+
}
|
|
61
|
+
if (setFocus) {
|
|
62
|
+
const pressedLinkElm = pressedLinkRef.current;
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
if (!newActive) {
|
|
65
|
+
focusElm(pressedLinkElm);
|
|
66
|
+
} else if (newActive !== activePanel2) {
|
|
67
|
+
focusElm(activePanelRef.current);
|
|
68
|
+
}
|
|
69
|
+
}, 100);
|
|
70
|
+
}
|
|
71
|
+
return newActive;
|
|
72
|
+
});
|
|
73
|
+
}, [setLaggyActivePanel]);
|
|
74
|
+
useFormatMonitor((media) => {
|
|
75
|
+
if (media.leftTopmenu) {
|
|
76
|
+
setActivePanel(void 0);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const hasActivePanel = !!activePanel;
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
setActivePanel(findActivePanel(megaPanels, props.activePanelId));
|
|
82
|
+
}, [props.activePanelId, megaPanels, setActivePanel]);
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
const menuElm = menuElmRef.current;
|
|
85
|
+
if (!hasActivePanel || !menuElm) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const escHandler = (e) => {
|
|
89
|
+
if (e.key === "Escape") {
|
|
90
|
+
setActivePanel(void 0);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const clickHandler = (e) => {
|
|
94
|
+
if (!menuElm.contains(e.target)) {
|
|
95
|
+
setActivePanel(void 0);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
document.addEventListener("keydown", escHandler);
|
|
99
|
+
document.addEventListener("click", clickHandler, true);
|
|
100
|
+
return () => {
|
|
101
|
+
document.removeEventListener("keydown", escHandler);
|
|
102
|
+
document.removeEventListener("click", clickHandler, true);
|
|
103
|
+
};
|
|
104
|
+
}, [hasActivePanel, setActivePanel]);
|
|
105
|
+
const menuItems = useMemo(() => props.items.map((item) => {
|
|
106
|
+
if (item === "---") {
|
|
107
|
+
return item;
|
|
108
|
+
}
|
|
109
|
+
const href = item.href;
|
|
110
|
+
const controlsId = item.controlsId || href && /^#/.test(href) && href.slice(1) || void 0;
|
|
111
|
+
return __spreadProps(__spreadValues({}, item), {
|
|
112
|
+
controlsId,
|
|
113
|
+
megaPanel: controlsId && megaPanels.find((panel) => panel.id === controlsId)
|
|
114
|
+
});
|
|
115
|
+
}), [props.items, megaPanels]);
|
|
116
|
+
return /* @__PURE__ */ React.createElement("nav", {
|
|
117
|
+
className: "MainMenu",
|
|
118
|
+
"aria-label": title,
|
|
119
|
+
"data-sprinkled": isBrowser,
|
|
120
|
+
ref: menuElmRef
|
|
121
|
+
}, /* @__PURE__ */ React.createElement("h2", {
|
|
122
|
+
className: "MainMenu__title"
|
|
123
|
+
}, title), /* @__PURE__ */ React.createElement("ul", {
|
|
124
|
+
className: "MainMenu__items"
|
|
125
|
+
}, menuItems.map((item, i) => {
|
|
126
|
+
if (item === "---") {
|
|
127
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
128
|
+
key: i,
|
|
129
|
+
className: "MainMenu__separator",
|
|
130
|
+
"aria-hidden": "true"
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
const { label, labelLong, lang, controlsId, onClick } = item;
|
|
134
|
+
const pressed = activePanel && controlsId === activePanel.id || void 0;
|
|
135
|
+
return /* @__PURE__ */ React.createElement("li", {
|
|
136
|
+
key: i,
|
|
137
|
+
className: getBemClass("MainMenu__item", item.modifier),
|
|
138
|
+
"aria-current": item.current || void 0
|
|
139
|
+
}, onClick || !!item.megaPanel && (isBrowser || item.href != null) ? /* @__PURE__ */ React.createElement("button", {
|
|
140
|
+
className: "MainMenu__link",
|
|
141
|
+
onClick: () => {
|
|
142
|
+
item.megaPanel && setActivePanel(item.megaPanel);
|
|
143
|
+
onClick && onClick(i, item);
|
|
144
|
+
onItemClick && onItemClick(i, item);
|
|
145
|
+
},
|
|
146
|
+
ref: pressed && pressedLinkRef,
|
|
147
|
+
"aria-pressed": pressed,
|
|
148
|
+
"aria-controls": controlsId,
|
|
149
|
+
"aria-label": labelLong,
|
|
150
|
+
title: labelLong,
|
|
151
|
+
lang,
|
|
152
|
+
type: "button"
|
|
153
|
+
}, label) : item.href != null ? /* @__PURE__ */ React.createElement(Link, {
|
|
154
|
+
className: "MainMenu__link",
|
|
155
|
+
href: item.href,
|
|
156
|
+
"aria-label": labelLong,
|
|
157
|
+
title: labelLong,
|
|
158
|
+
onClick: onItemClick && (() => onItemClick(i, item)),
|
|
159
|
+
lang
|
|
160
|
+
}, label) : void 0);
|
|
161
|
+
})), "\n\n", megaPanels.length > 0 && /* @__PURE__ */ React.createElement("div", {
|
|
162
|
+
className: getBemClass("MainMenu__panelsWrap", [activePanel && "active"])
|
|
163
|
+
}, /* @__PURE__ */ React.createElement("ul", {
|
|
164
|
+
className: "MainMenu__panels"
|
|
165
|
+
}, megaPanels.map((panel, i) => {
|
|
166
|
+
if (!panel.items.length) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const isActive = activePanel === panel || laggyActivePanel === panel || void 0;
|
|
170
|
+
const isParent = !!panel.items.find((item) => item.current);
|
|
171
|
+
return /* @__PURE__ */ React.createElement(PrimaryPanel, {
|
|
172
|
+
key: i,
|
|
173
|
+
isParent,
|
|
174
|
+
isActive,
|
|
175
|
+
panel,
|
|
176
|
+
isBrowser,
|
|
177
|
+
setActivePanel,
|
|
178
|
+
texts: getTexts(props, defaultMainMenuTexts),
|
|
179
|
+
activeRef: activePanelRef
|
|
180
|
+
});
|
|
181
|
+
}), auxiliaryPanel && /* @__PURE__ */ React.createElement(AuxiliaryPanel, __spreadValues({}, auxiliaryPanel)))));
|
|
182
|
+
};
|
|
183
|
+
var MainMenu_default = MainMenu;
|
|
184
|
+
export {
|
|
185
|
+
MainMenu_default as default,
|
|
186
|
+
defaultMainMenuTexts
|
|
187
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __export = (target, all) => {
|
|
22
|
+
for (var name in all)
|
|
23
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
24
|
+
};
|
|
25
|
+
var __copyProps = (to, from, except, desc) => {
|
|
26
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
|
+
for (let key of __getOwnPropNames(from))
|
|
28
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
29
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
30
|
+
}
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
33
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
+
var MiniMetrics_exports = {};
|
|
36
|
+
__export(MiniMetrics_exports, {
|
|
37
|
+
default: () => MiniMetrics_default
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(MiniMetrics_exports);
|
|
40
|
+
var import_react = __toESM(require("react"));
|
|
41
|
+
var import_Button = __toESM(require("./_abstract/Button"));
|
|
42
|
+
var import_SeenEffect = __toESM(require("./SeenEffect"));
|
|
43
|
+
const MiniMetrics = (props) => {
|
|
44
|
+
const { text, moreButton, startSeen } = props;
|
|
45
|
+
return /* @__PURE__ */ import_react.default.createElement(import_SeenEffect.default, {
|
|
46
|
+
className: "MiniMetrics",
|
|
47
|
+
startSeen
|
|
48
|
+
}, /* @__PURE__ */ import_react.default.createElement("strong", {
|
|
49
|
+
className: "MiniMetrics__text"
|
|
50
|
+
}, text), " ", "\n", /* @__PURE__ */ import_react.default.createElement(import_Button.default, __spreadValues({
|
|
51
|
+
bem: "MiniMetrics__more"
|
|
52
|
+
}, moreButton)));
|
|
53
|
+
};
|
|
54
|
+
var MiniMetrics_default = MiniMetrics;
|
|
55
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
56
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
import React from "react";
|
|
18
|
+
import Button from "./_abstract/Button";
|
|
19
|
+
import SeenEffect from "./SeenEffect";
|
|
20
|
+
const MiniMetrics = (props) => {
|
|
21
|
+
const { text, moreButton, startSeen } = props;
|
|
22
|
+
return /* @__PURE__ */ React.createElement(SeenEffect, {
|
|
23
|
+
className: "MiniMetrics",
|
|
24
|
+
startSeen
|
|
25
|
+
}, /* @__PURE__ */ React.createElement("strong", {
|
|
26
|
+
className: "MiniMetrics__text"
|
|
27
|
+
}, text), " ", "\n", /* @__PURE__ */ React.createElement(Button, __spreadValues({
|
|
28
|
+
bem: "MiniMetrics__more"
|
|
29
|
+
}, moreButton)));
|
|
30
|
+
};
|
|
31
|
+
var MiniMetrics_default = MiniMetrics;
|
|
32
|
+
export {
|
|
33
|
+
MiniMetrics_default as default
|
|
34
|
+
};
|
package/lib/Modal.cjs
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var Modal_exports = {};
|
|
39
|
+
__export(Modal_exports, {
|
|
40
|
+
default: () => Modal_default
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(Modal_exports);
|
|
43
|
+
var import_react = __toESM(require("react"));
|
|
44
|
+
var import_Modal = __toESM(require("@hugsmidjan/react/Modal"));
|
|
45
|
+
const Modal = (props) => {
|
|
46
|
+
const {
|
|
47
|
+
closeDelay = 500,
|
|
48
|
+
texts = {
|
|
49
|
+
closeButton: "Loka "
|
|
50
|
+
},
|
|
51
|
+
bling,
|
|
52
|
+
children,
|
|
53
|
+
render = () => children
|
|
54
|
+
} = props;
|
|
55
|
+
return /* @__PURE__ */ import_react.default.createElement(import_Modal.default, __spreadProps(__spreadValues({}, props), {
|
|
56
|
+
bodyWrap: false,
|
|
57
|
+
bem: "Modal",
|
|
58
|
+
closeDelay,
|
|
59
|
+
texts,
|
|
60
|
+
render: (args) => bling ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, render(args), /* @__PURE__ */ import_react.default.createElement("div", {
|
|
61
|
+
className: "Modal__blings"
|
|
62
|
+
}, /* @__PURE__ */ import_react.default.createElement("div", {
|
|
63
|
+
className: "Modal__blings__inner"
|
|
64
|
+
}, bling))) : render(args),
|
|
65
|
+
children: void 0
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
68
|
+
var Modal_default = Modal;
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {});
|
package/lib/Modal.mjs
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import React from "react";
|
|
21
|
+
import _Modal from "@hugsmidjan/react/Modal";
|
|
22
|
+
const Modal = (props) => {
|
|
23
|
+
const {
|
|
24
|
+
closeDelay = 500,
|
|
25
|
+
texts = {
|
|
26
|
+
closeButton: "Loka "
|
|
27
|
+
},
|
|
28
|
+
bling,
|
|
29
|
+
children,
|
|
30
|
+
render = () => children
|
|
31
|
+
} = props;
|
|
32
|
+
return /* @__PURE__ */ React.createElement(_Modal, __spreadProps(__spreadValues({}, props), {
|
|
33
|
+
bodyWrap: false,
|
|
34
|
+
bem: "Modal",
|
|
35
|
+
closeDelay,
|
|
36
|
+
texts,
|
|
37
|
+
render: (args) => bling ? /* @__PURE__ */ React.createElement(React.Fragment, null, render(args), /* @__PURE__ */ React.createElement("div", {
|
|
38
|
+
className: "Modal__blings"
|
|
39
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
40
|
+
className: "Modal__blings__inner"
|
|
41
|
+
}, bling))) : render(args),
|
|
42
|
+
children: void 0
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
45
|
+
var Modal_default = Modal;
|
|
46
|
+
export {
|
|
47
|
+
Modal_default as default
|
|
48
|
+
};
|