@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
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var seenEffect_exports = {};
|
|
19
|
+
__export(seenEffect_exports, {
|
|
20
|
+
DATA_ATTR_NAME: () => DATA_ATTR_NAME,
|
|
21
|
+
assertEffectType: () => assertEffectType,
|
|
22
|
+
getEffectAttr: () => getEffectAttr,
|
|
23
|
+
getObserver: () => getObserver,
|
|
24
|
+
seenEffectOptOut: () => seenEffectOptOut,
|
|
25
|
+
useSeenEffect: () => useSeenEffect
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(seenEffect_exports);
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
const DATA_ATTR_NAME = "is-seen";
|
|
30
|
+
const STACKING_DELAY = 400;
|
|
31
|
+
const dataAttr = "data-" + DATA_ATTR_NAME;
|
|
32
|
+
const inTargetSourceOrder = (a, b) => a.target.compareDocumentPosition(b.target) & Node.DOCUMENT_POSITION_PRECEDING ? 1 : -1;
|
|
33
|
+
const options = {
|
|
34
|
+
rootMargin: "-100px 0px 0px 0px",
|
|
35
|
+
threshold: 0
|
|
36
|
+
};
|
|
37
|
+
let observer;
|
|
38
|
+
const getObserver = (target, callback) => {
|
|
39
|
+
if (target.hasAttribute(dataAttr)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (!observer) {
|
|
43
|
+
observer = new IntersectionObserver((entries, observer2) => entries.filter((e) => e.isIntersecting).sort(inTargetSourceOrder).forEach(({ target: target2 }, i) => {
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
target2.setAttribute(dataAttr, "true");
|
|
46
|
+
callback && callback(target2);
|
|
47
|
+
observer2.unobserve(target2);
|
|
48
|
+
}, STACKING_DELAY * i);
|
|
49
|
+
}), options);
|
|
50
|
+
}
|
|
51
|
+
if (target.matches("[" + dataAttr + "] *")) {
|
|
52
|
+
target.setAttribute(dataAttr, "");
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
target.setAttribute(dataAttr, "false");
|
|
56
|
+
observer.observe(target);
|
|
57
|
+
return () => observer.unobserve(target);
|
|
58
|
+
};
|
|
59
|
+
const seenEffectOptOut = (target, setFlag = true) => {
|
|
60
|
+
setFlag ? target.setAttribute(dataAttr, "") : target.removeAttribute(dataAttr);
|
|
61
|
+
};
|
|
62
|
+
getObserver.DATA_ATTR_NAME = DATA_ATTR_NAME;
|
|
63
|
+
const effects = {
|
|
64
|
+
fadein: 1,
|
|
65
|
+
fadeup: 1,
|
|
66
|
+
fadeleft: 1
|
|
67
|
+
};
|
|
68
|
+
const assertEffectType = (maybeType) => maybeType && maybeType in effects ? maybeType : void 0;
|
|
69
|
+
const getEffectAttr = (maybeType) => ({
|
|
70
|
+
"data-seen-effect": assertEffectType(maybeType) || ""
|
|
71
|
+
});
|
|
72
|
+
const useSeenEffect = (startSeen, customRef) => {
|
|
73
|
+
const localRef = (0, import_react.useRef)(null);
|
|
74
|
+
const [isSeen, setSeen] = (0, import_react.useState)(startSeen || void 0);
|
|
75
|
+
const ref = !startSeen && (customRef || localRef);
|
|
76
|
+
(0, import_react.useEffect)(() => {
|
|
77
|
+
setSeen(startSeen || void 0);
|
|
78
|
+
if (ref && ref.current) {
|
|
79
|
+
seenEffectOptOut(ref.current, false);
|
|
80
|
+
return getObserver(ref.current, () => setSeen(true));
|
|
81
|
+
}
|
|
82
|
+
}, [ref, startSeen]);
|
|
83
|
+
return [ref || void 0, isSeen];
|
|
84
|
+
};
|
|
85
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
86
|
+
0 && (module.exports = {
|
|
87
|
+
DATA_ATTR_NAME,
|
|
88
|
+
assertEffectType,
|
|
89
|
+
getEffectAttr,
|
|
90
|
+
getObserver,
|
|
91
|
+
seenEffectOptOut,
|
|
92
|
+
useSeenEffect
|
|
93
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
const DATA_ATTR_NAME = "is-seen";
|
|
3
|
+
const STACKING_DELAY = 400;
|
|
4
|
+
const dataAttr = "data-" + DATA_ATTR_NAME;
|
|
5
|
+
const inTargetSourceOrder = (a, b) => a.target.compareDocumentPosition(b.target) & Node.DOCUMENT_POSITION_PRECEDING ? 1 : -1;
|
|
6
|
+
const options = {
|
|
7
|
+
rootMargin: "-100px 0px 0px 0px",
|
|
8
|
+
threshold: 0
|
|
9
|
+
};
|
|
10
|
+
let observer;
|
|
11
|
+
const getObserver = (target, callback) => {
|
|
12
|
+
if (target.hasAttribute(dataAttr)) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (!observer) {
|
|
16
|
+
observer = new IntersectionObserver((entries, observer2) => entries.filter((e) => e.isIntersecting).sort(inTargetSourceOrder).forEach(({ target: target2 }, i) => {
|
|
17
|
+
setTimeout(() => {
|
|
18
|
+
target2.setAttribute(dataAttr, "true");
|
|
19
|
+
callback && callback(target2);
|
|
20
|
+
observer2.unobserve(target2);
|
|
21
|
+
}, STACKING_DELAY * i);
|
|
22
|
+
}), options);
|
|
23
|
+
}
|
|
24
|
+
if (target.matches("[" + dataAttr + "] *")) {
|
|
25
|
+
target.setAttribute(dataAttr, "");
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
target.setAttribute(dataAttr, "false");
|
|
29
|
+
observer.observe(target);
|
|
30
|
+
return () => observer.unobserve(target);
|
|
31
|
+
};
|
|
32
|
+
const seenEffectOptOut = (target, setFlag = true) => {
|
|
33
|
+
setFlag ? target.setAttribute(dataAttr, "") : target.removeAttribute(dataAttr);
|
|
34
|
+
};
|
|
35
|
+
getObserver.DATA_ATTR_NAME = DATA_ATTR_NAME;
|
|
36
|
+
const effects = {
|
|
37
|
+
fadein: 1,
|
|
38
|
+
fadeup: 1,
|
|
39
|
+
fadeleft: 1
|
|
40
|
+
};
|
|
41
|
+
const assertEffectType = (maybeType) => maybeType && maybeType in effects ? maybeType : void 0;
|
|
42
|
+
const getEffectAttr = (maybeType) => ({
|
|
43
|
+
"data-seen-effect": assertEffectType(maybeType) || ""
|
|
44
|
+
});
|
|
45
|
+
const useSeenEffect = (startSeen, customRef) => {
|
|
46
|
+
const localRef = useRef(null);
|
|
47
|
+
const [isSeen, setSeen] = useState(startSeen || void 0);
|
|
48
|
+
const ref = !startSeen && (customRef || localRef);
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
setSeen(startSeen || void 0);
|
|
51
|
+
if (ref && ref.current) {
|
|
52
|
+
seenEffectOptOut(ref.current, false);
|
|
53
|
+
return getObserver(ref.current, () => setSeen(true));
|
|
54
|
+
}
|
|
55
|
+
}, [ref, startSeen]);
|
|
56
|
+
return [ref || void 0, isSeen];
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
DATA_ATTR_NAME,
|
|
60
|
+
assertEffectType,
|
|
61
|
+
getEffectAttr,
|
|
62
|
+
getObserver,
|
|
63
|
+
seenEffectOptOut,
|
|
64
|
+
useSeenEffect
|
|
65
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var useFormatMonitor_exports = {};
|
|
19
|
+
__export(useFormatMonitor_exports, {
|
|
20
|
+
useFormatMonitor: () => useFormatMonitor
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(useFormatMonitor_exports);
|
|
23
|
+
var import_hanna_utils = require("@reykjavik/hanna-utils");
|
|
24
|
+
var import_react = require("formatchange/react");
|
|
25
|
+
const useFormatMonitor = (0, import_react.makeFormatMonitorHook)(import_hanna_utils.formatMonitor);
|
|
26
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
27
|
+
0 && (module.exports = {
|
|
28
|
+
useFormatMonitor
|
|
29
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var useGetSVGtext_exports = {};
|
|
19
|
+
__export(useGetSVGtext_exports, {
|
|
20
|
+
useGetSVGtext: () => useGetSVGtext
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(useGetSVGtext_exports);
|
|
23
|
+
var import_react = require("react");
|
|
24
|
+
var import_hanna_utils = require("@reykjavik/hanna-utils");
|
|
25
|
+
const useGetSVGtext = (imageSrc) => {
|
|
26
|
+
const [inlineSvg, setInlineSvg] = (0, import_react.useState)();
|
|
27
|
+
const srcRef = (0, import_react.useRef)(imageSrc);
|
|
28
|
+
(0, import_react.useEffect)(() => {
|
|
29
|
+
if (imageSrc) {
|
|
30
|
+
(0, import_hanna_utils.getSVGtext)(imageSrc).then((code) => {
|
|
31
|
+
if (imageSrc === srcRef.current) {
|
|
32
|
+
setInlineSvg({ imageSrc, code });
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
srcRef.current = imageSrc;
|
|
37
|
+
setInlineSvg(void 0);
|
|
38
|
+
}, [imageSrc]);
|
|
39
|
+
return inlineSvg;
|
|
40
|
+
};
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
useGetSVGtext
|
|
44
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
import { getSVGtext } from "@reykjavik/hanna-utils";
|
|
3
|
+
const useGetSVGtext = (imageSrc) => {
|
|
4
|
+
const [inlineSvg, setInlineSvg] = useState();
|
|
5
|
+
const srcRef = useRef(imageSrc);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (imageSrc) {
|
|
8
|
+
getSVGtext(imageSrc).then((code) => {
|
|
9
|
+
if (imageSrc === srcRef.current) {
|
|
10
|
+
setInlineSvg({ imageSrc, code });
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
srcRef.current = imageSrc;
|
|
15
|
+
setInlineSvg(void 0);
|
|
16
|
+
}, [imageSrc]);
|
|
17
|
+
return inlineSvg;
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
useGetSVGtext
|
|
21
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var useMenuToggling_exports = {};
|
|
19
|
+
__export(useMenuToggling_exports, {
|
|
20
|
+
useMenuToggling: () => useMenuToggling
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(useMenuToggling_exports);
|
|
23
|
+
var import_react = require("react");
|
|
24
|
+
var import_hanna_utils = require("@reykjavik/hanna-utils");
|
|
25
|
+
var import_useFormatMonitor = require("./useFormatMonitor");
|
|
26
|
+
const htmlClass = (className, add) => {
|
|
27
|
+
document.documentElement.classList[add ? "add" : "remove"](className);
|
|
28
|
+
};
|
|
29
|
+
const noop = () => void 0;
|
|
30
|
+
const useMenuToggling = (doInitialize = true) => {
|
|
31
|
+
const [isMenuOpen, setIsMenuOpen] = (0, import_react.useState)(false);
|
|
32
|
+
const [isMenuActive, setIsMenuActive] = (0, import_react.useState)();
|
|
33
|
+
const state = { isMenuOpen, isMenuActive };
|
|
34
|
+
const stateRef = (0, import_react.useRef)(state);
|
|
35
|
+
stateRef.current = state;
|
|
36
|
+
const _openMenu = () => {
|
|
37
|
+
if (!stateRef.current.isMenuOpen) {
|
|
38
|
+
setIsMenuOpen(true);
|
|
39
|
+
htmlClass("menu-is-open", true);
|
|
40
|
+
htmlClass("menu-is-closed", false);
|
|
41
|
+
(0, import_hanna_utils.focusElement)("#pagenav");
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const _closeMenu = () => {
|
|
45
|
+
if (stateRef.current.isMenuOpen) {
|
|
46
|
+
setIsMenuOpen(false);
|
|
47
|
+
htmlClass("menu-is-closed", true);
|
|
48
|
+
htmlClass("menu-is-open", false);
|
|
49
|
+
(0, import_hanna_utils.focusElement)(".Layout__header__skiplink");
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
(0, import_useFormatMonitor.useFormatMonitor)(doInitialize ? (media) => {
|
|
53
|
+
if (media.becameHamburger) {
|
|
54
|
+
setIsMenuActive(true);
|
|
55
|
+
htmlClass("menu-is-active", true);
|
|
56
|
+
htmlClass("menu-is-closed", true);
|
|
57
|
+
}
|
|
58
|
+
if (media.leftHamburger) {
|
|
59
|
+
_closeMenu();
|
|
60
|
+
setIsMenuActive(void 0);
|
|
61
|
+
htmlClass("menu-is-active", false);
|
|
62
|
+
htmlClass("menu-is-closed", false);
|
|
63
|
+
}
|
|
64
|
+
} : noop);
|
|
65
|
+
const { toggleMenu, closeMenu } = (0, import_react.useRef)(doInitialize ? {
|
|
66
|
+
toggleMenu: () => {
|
|
67
|
+
if (stateRef.current.isMenuActive) {
|
|
68
|
+
stateRef.current.isMenuOpen ? _closeMenu() : _openMenu();
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
closeMenu: _closeMenu
|
|
72
|
+
} : { toggleMenu: noop, closeMenu: noop }).current;
|
|
73
|
+
return {
|
|
74
|
+
isMenuActive,
|
|
75
|
+
isMenuOpen,
|
|
76
|
+
toggleMenu,
|
|
77
|
+
closeMenu
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
81
|
+
0 && (module.exports = {
|
|
82
|
+
useMenuToggling
|
|
83
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useRef, useState } from "react";
|
|
2
|
+
import { focusElement } from "@reykjavik/hanna-utils";
|
|
3
|
+
import { useFormatMonitor } from "./useFormatMonitor";
|
|
4
|
+
const htmlClass = (className, add) => {
|
|
5
|
+
document.documentElement.classList[add ? "add" : "remove"](className);
|
|
6
|
+
};
|
|
7
|
+
const noop = () => void 0;
|
|
8
|
+
const useMenuToggling = (doInitialize = true) => {
|
|
9
|
+
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
|
10
|
+
const [isMenuActive, setIsMenuActive] = useState();
|
|
11
|
+
const state = { isMenuOpen, isMenuActive };
|
|
12
|
+
const stateRef = useRef(state);
|
|
13
|
+
stateRef.current = state;
|
|
14
|
+
const _openMenu = () => {
|
|
15
|
+
if (!stateRef.current.isMenuOpen) {
|
|
16
|
+
setIsMenuOpen(true);
|
|
17
|
+
htmlClass("menu-is-open", true);
|
|
18
|
+
htmlClass("menu-is-closed", false);
|
|
19
|
+
focusElement("#pagenav");
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const _closeMenu = () => {
|
|
23
|
+
if (stateRef.current.isMenuOpen) {
|
|
24
|
+
setIsMenuOpen(false);
|
|
25
|
+
htmlClass("menu-is-closed", true);
|
|
26
|
+
htmlClass("menu-is-open", false);
|
|
27
|
+
focusElement(".Layout__header__skiplink");
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
useFormatMonitor(doInitialize ? (media) => {
|
|
31
|
+
if (media.becameHamburger) {
|
|
32
|
+
setIsMenuActive(true);
|
|
33
|
+
htmlClass("menu-is-active", true);
|
|
34
|
+
htmlClass("menu-is-closed", true);
|
|
35
|
+
}
|
|
36
|
+
if (media.leftHamburger) {
|
|
37
|
+
_closeMenu();
|
|
38
|
+
setIsMenuActive(void 0);
|
|
39
|
+
htmlClass("menu-is-active", false);
|
|
40
|
+
htmlClass("menu-is-closed", false);
|
|
41
|
+
}
|
|
42
|
+
} : noop);
|
|
43
|
+
const { toggleMenu, closeMenu } = useRef(doInitialize ? {
|
|
44
|
+
toggleMenu: () => {
|
|
45
|
+
if (stateRef.current.isMenuActive) {
|
|
46
|
+
stateRef.current.isMenuOpen ? _closeMenu() : _openMenu();
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
closeMenu: _closeMenu
|
|
50
|
+
} : { toggleMenu: noop, closeMenu: noop }).current;
|
|
51
|
+
return {
|
|
52
|
+
isMenuActive,
|
|
53
|
+
isMenuOpen,
|
|
54
|
+
toggleMenu,
|
|
55
|
+
closeMenu
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export {
|
|
59
|
+
useMenuToggling
|
|
60
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
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));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var useScrollbarWidthCSSVar_exports = {};
|
|
22
|
+
__export(useScrollbarWidthCSSVar_exports, {
|
|
23
|
+
useScrollbarWidthCSSVar: () => useScrollbarWidthCSSVar
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(useScrollbarWidthCSSVar_exports);
|
|
26
|
+
var import_getScrollbarWidth = __toESM(require("@hugsmidjan/qj/getScrollbarWidth"));
|
|
27
|
+
var import_hooks = require("@hugsmidjan/react/hooks");
|
|
28
|
+
const useScrollbarWidthCSSVar = () => (0, import_hooks.useOnMount)(() => import_getScrollbarWidth.default.setCSSvar());
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
useScrollbarWidthCSSVar
|
|
32
|
+
});
|
package/lib/utils.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var utils_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(utils_exports);
|
|
17
|
+
__reExport(utils_exports, require("./utils/useFormatMonitor"), module.exports);
|
|
18
|
+
__reExport(utils_exports, require("./utils/useGetSVGtext"), module.exports);
|
package/lib/utils.mjs
ADDED