@reykjavik/hanna-react 0.10.136 → 0.10.138
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/AccordionList.js +3 -3
- package/ActionCards.js +2 -2
- package/Alert.js +2 -2
- package/ArticleMeta.js +2 -2
- package/Attention.js +2 -2
- package/AutosuggestSearch.js +3 -3
- package/BasicTable.js +2 -2
- package/BgBox.js +2 -2
- package/Bling.js +2 -2
- package/BreadCrumbs.js +2 -2
- package/ButtonBar.js +3 -3
- package/CHANGELOG.md +13 -0
- package/CarouselStepper.js +2 -2
- package/CenterColumn.js +2 -2
- package/ContactBubble.js +3 -3
- package/ContentArticle.js +2 -2
- package/ContentImage.js +2 -2
- package/ExtraLinks.js +3 -3
- package/FeatureList.js +2 -2
- package/FieldGroup.js +2 -2
- package/FileInput.js +3 -3
- package/FooterInfo.js +3 -3
- package/Footnote.js +2 -2
- package/Form.js +2 -2
- package/FormField.js +2 -2
- package/GridBlocks.js +2 -2
- package/Heading.js +2 -2
- package/HeroBlock.js +2 -2
- package/IframeBlock.js +2 -2
- package/IframedLayout.js +2 -2
- package/ImageCards.js +2 -2
- package/InfoBlock.js +2 -2
- package/InfoHero.js +2 -2
- package/LabeledTextBlock.js +2 -2
- package/Layout.js +2 -2
- package/MainMenu/_Auxiliary.js +2 -2
- package/MainMenu/_PrimaryPanel.js +3 -3
- package/MainMenu.d.ts +2 -3
- package/MainMenu.js +4 -4
- package/MainMenu2.d.ts +2 -3
- package/MainMenu2.js +4 -4
- package/MiniMetrics.js +2 -2
- package/Multiselect.js +4 -5
- package/NameCard.js +3 -3
- package/NameCards.js +2 -2
- package/NewsHero.js +1 -2
- package/PageFilter.js +2 -2
- package/PageHeading.js +2 -2
- package/Pagination.js +4 -4
- package/ProcessOverview.js +2 -2
- package/README.md +1 -1
- package/ReadSpeakerPlayer.js +2 -2
- package/RelatedLinks.js +2 -2
- package/RowBlock.js +2 -2
- package/RowBlockColumn.js +2 -2
- package/SearchResults.js +2 -2
- package/ShareButtons.js +2 -2
- package/Sharpie.js +2 -2
- package/SiteSearchCurtain.js +2 -2
- package/Skeleton.js +2 -2
- package/SubHeading.js +2 -2
- package/Tabs.js +2 -2
- package/TagPill.js +3 -3
- package/TextBlock.js +2 -2
- package/TextInput.js +2 -2
- package/Tooltip.js +3 -3
- package/VSpacer.js +2 -2
- package/WizardLayout.js +2 -2
- package/WizardStepper.js +3 -3
- package/_abstract/_AbstractCarousel.js +1 -2
- package/_abstract/_AbstractModal.js +3 -3
- package/_abstract/_Block.js +2 -2
- package/_abstract/_Button.js +2 -2
- package/_abstract/_CardList.d.ts +3 -2
- package/_abstract/_CardList.js +4 -4
- package/_abstract/_CarouselPaging.js +2 -2
- package/_abstract/_Image.js +3 -3
- package/_abstract/_Quote.js +2 -2
- package/_abstract/_ScrollWrapper.js +2 -2
- package/_abstract/_Table.js +2 -3
- package/_abstract/_TogglerGroup.js +2 -2
- package/_abstract/_TogglerGroupField.js +2 -2
- package/_abstract/_TogglerInput.js +2 -2
- package/esm/AccordionList.js +1 -1
- package/esm/ActionCards.js +1 -1
- package/esm/Alert.js +1 -1
- package/esm/ArticleMeta.js +1 -1
- package/esm/Attention.js +1 -1
- package/esm/AutosuggestSearch.js +1 -1
- package/esm/BasicTable.js +1 -1
- package/esm/BgBox.js +1 -1
- package/esm/Bling.js +1 -1
- package/esm/BreadCrumbs.js +1 -1
- package/esm/ButtonBar.js +1 -1
- package/esm/CarouselStepper.js +1 -1
- package/esm/CenterColumn.js +1 -1
- package/esm/ContactBubble.js +1 -1
- package/esm/ContentArticle.js +1 -1
- package/esm/ContentImage.js +1 -1
- package/esm/ExtraLinks.js +1 -1
- package/esm/FeatureList.js +1 -1
- package/esm/FieldGroup.js +1 -1
- package/esm/FileInput.js +1 -1
- package/esm/FooterInfo.js +1 -1
- package/esm/Footnote.js +1 -1
- package/esm/Form.js +1 -1
- package/esm/FormField.js +1 -1
- package/esm/GridBlocks.js +1 -1
- package/esm/Heading.js +1 -1
- package/esm/HeroBlock.js +1 -1
- package/esm/IframeBlock.js +1 -1
- package/esm/IframedLayout.js +1 -1
- package/esm/ImageCards.js +1 -1
- package/esm/InfoBlock.js +1 -1
- package/esm/InfoHero.js +1 -1
- package/esm/LabeledTextBlock.js +1 -1
- package/esm/Layout.js +1 -1
- package/esm/MainMenu/_Auxiliary.js +1 -1
- package/esm/MainMenu/_PrimaryPanel.js +1 -1
- package/esm/MainMenu.d.ts +2 -3
- package/esm/MainMenu.js +1 -1
- package/esm/MainMenu2.d.ts +2 -3
- package/esm/MainMenu2.js +1 -1
- package/esm/MiniMetrics.js +1 -1
- package/esm/Multiselect.js +1 -2
- package/esm/NameCard.js +1 -1
- package/esm/NameCards.js +1 -1
- package/esm/NewsHero.js +1 -2
- package/esm/PageFilter.js +1 -1
- package/esm/PageHeading.js +1 -1
- package/esm/Pagination.js +2 -2
- package/esm/ProcessOverview.js +1 -1
- package/esm/ReadSpeakerPlayer.js +1 -1
- package/esm/RelatedLinks.js +1 -1
- package/esm/RowBlock.js +1 -1
- package/esm/RowBlockColumn.js +1 -1
- package/esm/SearchResults.js +1 -1
- package/esm/ShareButtons.js +1 -1
- package/esm/Sharpie.js +1 -1
- package/esm/SiteSearchCurtain.js +1 -1
- package/esm/Skeleton.js +1 -1
- package/esm/SubHeading.js +1 -1
- package/esm/Tabs.js +1 -1
- package/esm/TagPill.js +1 -1
- package/esm/TextBlock.js +1 -1
- package/esm/TextInput.js +1 -1
- package/esm/Tooltip.js +1 -1
- package/esm/VSpacer.js +1 -1
- package/esm/WizardLayout.js +1 -1
- package/esm/WizardStepper.js +1 -1
- package/esm/_abstract/_AbstractCarousel.js +1 -2
- package/esm/_abstract/_AbstractModal.js +1 -1
- package/esm/_abstract/_Block.js +1 -1
- package/esm/_abstract/_Button.js +1 -1
- package/esm/_abstract/_CardList.d.ts +3 -2
- package/esm/_abstract/_CardList.js +3 -3
- package/esm/_abstract/_CarouselPaging.js +1 -1
- package/esm/_abstract/_Image.js +1 -1
- package/esm/_abstract/_Quote.js +1 -1
- package/esm/_abstract/_ScrollWrapper.js +1 -1
- package/esm/_abstract/_Table.js +1 -2
- package/esm/_abstract/_TogglerGroup.js +1 -1
- package/esm/_abstract/_TogglerGroupField.js +1 -1
- package/esm/_abstract/_TogglerInput.js +1 -1
- package/esm/utils/types.d.ts +2 -2
- package/esm/utils/useScrollEdgeDetect.js +12 -8
- package/package.json +3 -3
- package/utils/types.d.ts +2 -2
- package/utils/useScrollEdgeDetect.js +11 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { modifiedClass } from '@
|
|
3
|
+
import { modifiedClass } from '@reykjavik/hanna-utils';
|
|
4
4
|
import { DEFAULT_LANG } from '@reykjavik/hanna-utils/i18n';
|
|
5
5
|
import { useDomid } from '../utils/useDomid.js';
|
|
6
6
|
const defaultReqText = {
|
package/esm/utils/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClassNameModifiers } from '@reykjavik/hanna-utils/_/classUtils';
|
|
2
2
|
export type BemModifierProps = {
|
|
3
3
|
/** List of CSS BEM --modifier's to add to the component's main wrapper.
|
|
4
4
|
*
|
|
5
5
|
* All falsy values are neatly skipped.
|
|
6
6
|
*/
|
|
7
|
-
modifier?:
|
|
7
|
+
modifier?: ClassNameModifiers;
|
|
8
8
|
};
|
|
9
9
|
export type BemProps<Required extends boolean = false> = BemModifierProps & (Required extends true ? {
|
|
10
10
|
/** CSS BEM class-name prefix to be used for this component. Defaults to the same as the original component's displayName */
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
1
|
+
import { useCallback, useEffect, useRef, useState, } from 'react';
|
|
2
2
|
import throttle from '@hugsmidjan/qj/throttle';
|
|
3
3
|
const tolerance = 8; // px
|
|
4
4
|
const throttleMs = 100;
|
|
5
5
|
export const useScrollEdgeDetect = (options, scrollerRef) => {
|
|
6
6
|
const opts = typeof options === 'string' ? { axis: options } : options;
|
|
7
|
-
const [at, setAt] = useState(opts.startAt || { start: true, end: true });
|
|
8
|
-
const
|
|
9
|
-
const setScrollerRefElm = (elm) => {
|
|
10
|
-
if (
|
|
7
|
+
const [at, setAt] = useState(() => opts.startAt || { start: true, end: true });
|
|
8
|
+
const _scrollerRef = useRef();
|
|
9
|
+
const setScrollerRefElm = useCallback((elm) => {
|
|
10
|
+
if (!elm) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (scrollerRef) {
|
|
11
14
|
scrollerRef.current = elm;
|
|
12
15
|
}
|
|
13
|
-
|
|
14
|
-
};
|
|
16
|
+
_scrollerRef.current = elm;
|
|
17
|
+
}, [scrollerRef]);
|
|
15
18
|
const { getElm, axis } = opts;
|
|
16
19
|
useEffect(() => {
|
|
20
|
+
const scrollerRefElm = _scrollerRef.current;
|
|
17
21
|
const scrollerElm = scrollerRefElm && getElm ? getElm(scrollerRefElm) : scrollerRefElm;
|
|
18
22
|
if (!(scrollerElm instanceof HTMLElement)) {
|
|
19
23
|
return;
|
|
@@ -46,6 +50,6 @@ export const useScrollEdgeDetect = (options, scrollerRef) => {
|
|
|
46
50
|
scrollerElm.removeEventListener('scroll', checkScroll);
|
|
47
51
|
window.removeEventListener('resize', checkScroll);
|
|
48
52
|
};
|
|
49
|
-
}, [
|
|
53
|
+
}, [getElm, axis]);
|
|
50
54
|
return [setScrollerRefElm, at];
|
|
51
55
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reykjavik/hanna-react",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.138",
|
|
4
4
|
"author": "Reykjavík (http://www.reykjavik.is)",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Hugsmiðjan ehf (http://www.hugsmidjan.is)",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"@floating-ui/react": "^0.19.2",
|
|
18
18
|
"@hugsmidjan/qj": "^4.22.1",
|
|
19
19
|
"@hugsmidjan/react": "^0.4.32",
|
|
20
|
-
"@reykjavik/hanna-css": "^0.4.
|
|
21
|
-
"@reykjavik/hanna-utils": "^0.2.
|
|
20
|
+
"@reykjavik/hanna-css": "^0.4.15",
|
|
21
|
+
"@reykjavik/hanna-utils": "^0.2.17",
|
|
22
22
|
"@types/react-autosuggest": "^10.1.0",
|
|
23
23
|
"@types/react-datepicker": "^4.8.0",
|
|
24
24
|
"@types/react-transition-group": "^4.4.0",
|
package/utils/types.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClassNameModifiers } from '@reykjavik/hanna-utils/_/classUtils';
|
|
2
2
|
export type BemModifierProps = {
|
|
3
3
|
/** List of CSS BEM --modifier's to add to the component's main wrapper.
|
|
4
4
|
*
|
|
5
5
|
* All falsy values are neatly skipped.
|
|
6
6
|
*/
|
|
7
|
-
modifier?:
|
|
7
|
+
modifier?: ClassNameModifiers;
|
|
8
8
|
};
|
|
9
9
|
export type BemProps<Required extends boolean = false> = BemModifierProps & (Required extends true ? {
|
|
10
10
|
/** CSS BEM class-name prefix to be used for this component. Defaults to the same as the original component's displayName */
|
|
@@ -8,16 +8,20 @@ const tolerance = 8; // px
|
|
|
8
8
|
const throttleMs = 100;
|
|
9
9
|
const useScrollEdgeDetect = (options, scrollerRef) => {
|
|
10
10
|
const opts = typeof options === 'string' ? { axis: options } : options;
|
|
11
|
-
const [at, setAt] = (0, react_1.useState)(opts.startAt || { start: true, end: true });
|
|
12
|
-
const
|
|
13
|
-
const setScrollerRefElm = (elm) => {
|
|
14
|
-
if (
|
|
11
|
+
const [at, setAt] = (0, react_1.useState)(() => opts.startAt || { start: true, end: true });
|
|
12
|
+
const _scrollerRef = (0, react_1.useRef)();
|
|
13
|
+
const setScrollerRefElm = (0, react_1.useCallback)((elm) => {
|
|
14
|
+
if (!elm) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (scrollerRef) {
|
|
15
18
|
scrollerRef.current = elm;
|
|
16
19
|
}
|
|
17
|
-
|
|
18
|
-
};
|
|
20
|
+
_scrollerRef.current = elm;
|
|
21
|
+
}, [scrollerRef]);
|
|
19
22
|
const { getElm, axis } = opts;
|
|
20
23
|
(0, react_1.useEffect)(() => {
|
|
24
|
+
const scrollerRefElm = _scrollerRef.current;
|
|
21
25
|
const scrollerElm = scrollerRefElm && getElm ? getElm(scrollerRefElm) : scrollerRefElm;
|
|
22
26
|
if (!(scrollerElm instanceof HTMLElement)) {
|
|
23
27
|
return;
|
|
@@ -50,7 +54,7 @@ const useScrollEdgeDetect = (options, scrollerRef) => {
|
|
|
50
54
|
scrollerElm.removeEventListener('scroll', checkScroll);
|
|
51
55
|
window.removeEventListener('resize', checkScroll);
|
|
52
56
|
};
|
|
53
|
-
}, [
|
|
57
|
+
}, [getElm, axis]);
|
|
54
58
|
return [setScrollerRefElm, at];
|
|
55
59
|
};
|
|
56
60
|
exports.useScrollEdgeDetect = useScrollEdgeDetect;
|