@reykjavik/hanna-react 0.10.59 → 0.10.60
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 -28
- package/ActionCards.js +2 -4
- package/Alert.js +4 -29
- package/ArticleCards.js +2 -4
- package/ArticleCarousel/_ArticleCarouselCard.js +4 -6
- package/ArticleCarousel.js +3 -5
- package/ArticleMeta.js +3 -28
- package/Attention.js +3 -5
- package/BasicTable.js +5 -7
- package/BgBox.js +3 -5
- package/Bling.js +3 -5
- package/BlockBreak.js +2 -4
- package/BlockQuote.js +2 -4
- package/BreadCrumbs.js +2 -4
- package/ButtonBack.js +3 -5
- package/ButtonBar.js +3 -5
- package/ButtonPrimary.js +3 -5
- package/ButtonSecondary.js +3 -5
- package/ButtonTertiary.js +3 -5
- package/CHANGELOG.md +8 -0
- package/Carousel.js +3 -5
- package/CarouselStepper.js +3 -5
- package/CenterColumn.js +3 -5
- package/Checkbox.js +3 -5
- package/CheckboxButtonsGroup.js +4 -6
- package/CheckboxGroup.js +4 -6
- package/CityBlock.js +3 -5
- package/ContactBubble.js +4 -29
- package/ContentArticle.js +8 -10
- package/ContentImage.js +3 -5
- package/Datepicker.js +6 -31
- package/ExtraLinks.js +4 -17
- package/FeatureList.js +3 -5
- package/FieldGroup.js +3 -5
- package/FileInput.js +5 -41
- package/Foonote.js +2 -4
- package/FooterBadges.js +2 -4
- package/FooterInfo.js +3 -5
- package/Footnote.js +2 -4
- package/Form.js +3 -5
- package/FormField.js +3 -28
- package/Gallery/_GalleryItem.js +6 -42
- package/Gallery/_GalleryModal.js +6 -31
- package/Gallery/_GalleryModalContext.js +2 -4
- package/Gallery/_GalleryModalItem.js +4 -17
- package/Gallery.js +6 -31
- package/GridBlocks.js +5 -7
- package/Heading.js +3 -5
- package/HeroBlock.js +5 -7
- package/IframeBlock.d.ts +5 -1
- package/IframeBlock.js +6 -8
- package/Illustration.js +3 -5
- package/ImageCards.js +4 -17
- package/InfoBlock.js +2 -4
- package/InfoHero.js +7 -9
- package/IslandBlock.js +3 -5
- package/IslandPageBlock.js +3 -5
- package/LabeledTextBlock.js +4 -6
- package/Layout.js +4 -6
- package/MainMenu/_Auxiliary.js +2 -4
- package/MainMenu/_PrimaryPanel.js +3 -5
- package/MainMenu.js +5 -30
- package/MiniMetrics.js +4 -6
- package/Modal.js +3 -5
- package/NameCard.js +5 -7
- package/NameCards.js +3 -5
- package/NewsHero.js +6 -8
- package/PageFilter.js +4 -6
- package/PageHeading.js +3 -5
- package/Picture.js +4 -6
- package/ProcessOverview.js +3 -5
- package/PullQuote.js +2 -4
- package/RadioButtonsGroup.js +4 -6
- package/RadioGroup.js +4 -6
- package/RelatedLinks.js +2 -4
- package/RowBlock.js +3 -5
- package/RowBlockColumn.js +3 -5
- package/SearchInput.js +5 -41
- package/SearchResults/_SearchResultsItem.js +3 -5
- package/SearchResults.js +7 -32
- package/SeenEffect.js +3 -16
- package/Selectbox.js +6 -42
- package/ShareButtons.js +2 -24
- package/Sharpie.js +3 -5
- package/SiteSearchAutocomplete.js +5 -41
- package/SiteSearchCurtain.js +3 -28
- package/SiteSearchInput.d.ts +1 -1
- package/SiteSearchInput.js +4 -40
- package/Skeleton.js +4 -6
- package/SubHeading.js +3 -5
- package/Tabs.js +3 -28
- package/TagPill.js +5 -18
- package/TextBlock.js +3 -5
- package/TextButton.js +3 -5
- package/TextInput.js +5 -41
- package/VSpacer.js +3 -5
- package/VerticalTabsTOC.js +3 -28
- package/WizardLayout.js +3 -5
- package/WizardLayoutClose.js +3 -5
- package/WizardStepper.js +3 -5
- package/_abstract/_AbstractCarousel.js +7 -32
- package/_abstract/_Blings.js +3 -5
- package/_abstract/_Block.js +5 -7
- package/_abstract/_Button.js +4 -17
- package/_abstract/_CardList.js +4 -6
- package/_abstract/_Image.js +3 -5
- package/_abstract/_Link.js +2 -4
- package/_abstract/_Quote.js +2 -4
- package/_abstract/_TogglerGroup.js +8 -8
- package/_abstract/_TogglerGroupField.js +6 -19
- package/_abstract/_TogglerInput.js +4 -17
- package/_abstract/breakOnNL.js +2 -4
- package/package.json +4 -378
- package/utils/env.js +2 -4
- package/utils/useScrollbarWidthCSSVar.js +2 -4
- package/utils.js +3 -16
- package/esm/AccordionList.d.ts +0 -17
- package/esm/AccordionList.js +0 -24
- package/esm/ActionCards.d.ts +0 -5
- package/esm/ActionCards.js +0 -9
- package/esm/Alert.d.ts +0 -49
- package/esm/Alert.js +0 -92
- package/esm/ArticleCards.d.ts +0 -6
- package/esm/ArticleCards.js +0 -4
- package/esm/ArticleCarousel/_ArticleCarouselCard.d.ts +0 -27
- package/esm/ArticleCarousel/_ArticleCarouselCard.js +0 -24
- package/esm/ArticleCarousel.d.ts +0 -12
- package/esm/ArticleCarousel.js +0 -8
- package/esm/ArticleMeta.d.ts +0 -10
- package/esm/ArticleMeta.js +0 -19
- package/esm/Attention.d.ts +0 -7
- package/esm/Attention.js +0 -4
- package/esm/BasicTable.d.ts +0 -12
- package/esm/BasicTable.js +0 -29
- package/esm/BgBox.d.ts +0 -8
- package/esm/BgBox.js +0 -9
- package/esm/Bling.d.ts +0 -81
- package/esm/Bling.js +0 -44
- package/esm/BlockBreak.d.ts +0 -2
- package/esm/BlockBreak.js +0 -6
- package/esm/BlockQuote.d.ts +0 -4
- package/esm/BlockQuote.js +0 -4
- package/esm/BreadCrumbs.d.ts +0 -11
- package/esm/BreadCrumbs.js +0 -28
- package/esm/ButtonBack.d.ts +0 -7
- package/esm/ButtonBack.js +0 -4
- package/esm/ButtonBar.d.ts +0 -16
- package/esm/ButtonBar.js +0 -14
- package/esm/ButtonPrimary.d.ts +0 -7
- package/esm/ButtonPrimary.js +0 -4
- package/esm/ButtonSecondary.d.ts +0 -7
- package/esm/ButtonSecondary.js +0 -4
- package/esm/ButtonTertiary.d.ts +0 -12
- package/esm/ButtonTertiary.js +0 -15
- package/esm/Carousel.d.ts +0 -4
- package/esm/Carousel.js +0 -4
- package/esm/CarouselStepper.d.ts +0 -4
- package/esm/CarouselStepper.js +0 -4
- package/esm/CenterColumn.d.ts +0 -7
- package/esm/CenterColumn.js +0 -7
- package/esm/Checkbox.d.ts +0 -4
- package/esm/Checkbox.js +0 -4
- package/esm/CheckboxButtonsGroup.d.ts +0 -11
- package/esm/CheckboxButtonsGroup.js +0 -14
- package/esm/CheckboxGroup.d.ts +0 -9
- package/esm/CheckboxGroup.js +0 -7
- package/esm/CityBlock.d.ts +0 -23
- package/esm/CityBlock.js +0 -18
- package/esm/ContactBubble.d.ts +0 -58
- package/esm/ContactBubble.js +0 -148
- package/esm/ContentArticle.d.ts +0 -15
- package/esm/ContentArticle.js +0 -21
- package/esm/ContentImage.d.ts +0 -8
- package/esm/ContentImage.js +0 -18
- package/esm/Datepicker.d.ts +0 -39
- package/esm/Datepicker.js +0 -63
- package/esm/ExtraLinks.d.ts +0 -18
- package/esm/ExtraLinks.js +0 -34
- package/esm/FeatureList.d.ts +0 -12
- package/esm/FeatureList.js +0 -16
- package/esm/FieldGroup.d.ts +0 -9
- package/esm/FieldGroup.js +0 -9
- package/esm/FileInput.d.ts +0 -17
- package/esm/FileInput.js +0 -154
- package/esm/Foonote.d.ts +0 -12
- package/esm/Foonote.js +0 -7
- package/esm/FooterBadges.d.ts +0 -9
- package/esm/FooterBadges.js +0 -12
- package/esm/FooterInfo.d.ts +0 -18
- package/esm/FooterInfo.js +0 -9
- package/esm/Footnote.d.ts +0 -6
- package/esm/Footnote.js +0 -3
- package/esm/Form.d.ts +0 -7
- package/esm/Form.js +0 -10
- package/esm/FormField.d.ts +0 -65
- package/esm/FormField.js +0 -91
- package/esm/Gallery/_GalleryItem.d.ts +0 -8
- package/esm/Gallery/_GalleryItem.js +0 -30
- package/esm/Gallery/_GalleryModal.d.ts +0 -6
- package/esm/Gallery/_GalleryModal.js +0 -54
- package/esm/Gallery/_GalleryModalContext.d.ts +0 -9
- package/esm/Gallery/_GalleryModalContext.js +0 -3
- package/esm/Gallery/_GalleryModalItem.d.ts +0 -3
- package/esm/Gallery/_GalleryModalItem.js +0 -22
- package/esm/Gallery.d.ts +0 -17
- package/esm/Gallery.js +0 -27
- package/esm/GridBlocks.d.ts +0 -26
- package/esm/GridBlocks.js +0 -24
- package/esm/Heading.d.ts +0 -16
- package/esm/Heading.js +0 -17
- package/esm/HeroBlock.d.ts +0 -19
- package/esm/HeroBlock.js +0 -21
- package/esm/IframeBlock.d.ts +0 -23
- package/esm/IframeBlock.js +0 -26
- package/esm/Illustration.d.ts +0 -13
- package/esm/Illustration.js +0 -8
- package/esm/ImageCards.d.ts +0 -8
- package/esm/ImageCards.js +0 -22
- package/esm/InfoBlock.d.ts +0 -17
- package/esm/InfoBlock.js +0 -13
- package/esm/InfoHero.d.ts +0 -17
- package/esm/InfoHero.js +0 -82
- package/esm/IslandBlock.d.ts +0 -25
- package/esm/IslandBlock.js +0 -16
- package/esm/IslandPageBlock.d.ts +0 -24
- package/esm/IslandPageBlock.js +0 -16
- package/esm/LabeledTextBlock.d.ts +0 -11
- package/esm/LabeledTextBlock.js +0 -14
- package/esm/Layout.d.ts +0 -33
- package/esm/Layout.js +0 -52
- package/esm/MainMenu/_Auxiliary.d.ts +0 -6
- package/esm/MainMenu/_Auxiliary.js +0 -13
- package/esm/MainMenu/_PrimaryPanel.d.ts +0 -13
- package/esm/MainMenu/_PrimaryPanel.js +0 -22
- package/esm/MainMenu.d.ts +0 -48
- package/esm/MainMenu.js +0 -136
- package/esm/MiniMetrics.d.ts +0 -8
- package/esm/MiniMetrics.js +0 -12
- package/esm/Modal.d.ts +0 -10
- package/esm/Modal.js +0 -14
- package/esm/NameCard.d.ts +0 -64
- package/esm/NameCard.js +0 -82
- package/esm/NameCards.d.ts +0 -6
- package/esm/NameCards.js +0 -7
- package/esm/NewsHero.d.ts +0 -14
- package/esm/NewsHero.js +0 -86
- package/esm/PageFilter.d.ts +0 -17
- package/esm/PageFilter.js +0 -15
- package/esm/PageHeading.d.ts +0 -10
- package/esm/PageHeading.js +0 -12
- package/esm/Picture.d.ts +0 -7
- package/esm/Picture.js +0 -8
- package/esm/ProcessOverview.d.ts +0 -13
- package/esm/ProcessOverview.js +0 -17
- package/esm/PullQuote.d.ts +0 -4
- package/esm/PullQuote.js +0 -4
- package/esm/RadioButtonsGroup.d.ts +0 -11
- package/esm/RadioButtonsGroup.js +0 -14
- package/esm/RadioGroup.d.ts +0 -13
- package/esm/RadioGroup.js +0 -7
- package/esm/RelatedLinks.d.ts +0 -20
- package/esm/RelatedLinks.js +0 -26
- package/esm/RowBlock.d.ts +0 -12
- package/esm/RowBlock.js +0 -9
- package/esm/RowBlockColumn.d.ts +0 -8
- package/esm/RowBlockColumn.js +0 -11
- package/esm/SearchInput.d.ts +0 -18
- package/esm/SearchInput.js +0 -33
- package/esm/SearchResults/_SearchResultsItem.d.ts +0 -18
- package/esm/SearchResults/_SearchResultsItem.js +0 -15
- package/esm/SearchResults.d.ts +0 -33
- package/esm/SearchResults.js +0 -109
- package/esm/SeenEffect.d.ts +0 -4
- package/esm/SeenEffect.js +0 -19
- package/esm/Selectbox.d.ts +0 -8
- package/esm/Selectbox.js +0 -46
- package/esm/ShareButtons.d.ts +0 -9
- package/esm/ShareButtons.js +0 -51
- package/esm/Sharpie.d.ts +0 -23
- package/esm/Sharpie.js +0 -22
- package/esm/SiteSearchAutocomplete.d.ts +0 -40
- package/esm/SiteSearchAutocomplete.js +0 -58
- package/esm/SiteSearchCurtain.d.ts +0 -6
- package/esm/SiteSearchCurtain.js +0 -33
- package/esm/SiteSearchInput.d.ts +0 -24
- package/esm/SiteSearchInput.js +0 -40
- package/esm/Skeleton.d.ts +0 -25
- package/esm/Skeleton.js +0 -30
- package/esm/SubHeading.d.ts +0 -10
- package/esm/SubHeading.js +0 -13
- package/esm/Tabs.d.ts +0 -35
- package/esm/Tabs.js +0 -94
- package/esm/TagPill.d.ts +0 -27
- package/esm/TagPill.js +0 -43
- package/esm/TextBlock.d.ts +0 -15
- package/esm/TextBlock.js +0 -15
- package/esm/TextButton.d.ts +0 -9
- package/esm/TextButton.js +0 -9
- package/esm/TextInput.d.ts +0 -16
- package/esm/TextInput.js +0 -35
- package/esm/VSpacer.d.ts +0 -24
- package/esm/VSpacer.js +0 -41
- package/esm/VerticalTabsTOC.d.ts +0 -14
- package/esm/VerticalTabsTOC.js +0 -68
- package/esm/WizardLayout.d.ts +0 -15
- package/esm/WizardLayout.js +0 -30
- package/esm/WizardLayoutClose.d.ts +0 -3
- package/esm/WizardLayoutClose.js +0 -4
- package/esm/WizardStepper.d.ts +0 -36
- package/esm/WizardStepper.js +0 -25
- package/esm/_abstract/_AbstractCarousel.d.ts +0 -25
- package/esm/_abstract/_AbstractCarousel.js +0 -130
- package/esm/_abstract/_Blings.d.ts +0 -11
- package/esm/_abstract/_Blings.js +0 -12
- package/esm/_abstract/_Block.d.ts +0 -22
- package/esm/_abstract/_Block.js +0 -24
- package/esm/_abstract/_Button.d.ts +0 -40
- package/esm/_abstract/_Button.js +0 -47
- package/esm/_abstract/_CardList.d.ts +0 -30
- package/esm/_abstract/_CardList.js +0 -38
- package/esm/_abstract/_Image.d.ts +0 -36
- package/esm/_abstract/_Image.js +0 -27
- package/esm/_abstract/_Link.d.ts +0 -27
- package/esm/_abstract/_Link.js +0 -24
- package/esm/_abstract/_Quote.d.ts +0 -9
- package/esm/_abstract/_Quote.js +0 -8
- package/esm/_abstract/_TogglerGroup.d.ts +0 -31
- package/esm/_abstract/_TogglerGroup.js +0 -29
- package/esm/_abstract/_TogglerGroupField.d.ts +0 -17
- package/esm/_abstract/_TogglerGroupField.js +0 -22
- package/esm/_abstract/_TogglerInput.d.ts +0 -22
- package/esm/_abstract/_TogglerInput.js +0 -33
- package/esm/_abstract/breakOnNL.d.ts +0 -2
- package/esm/_abstract/breakOnNL.js +0 -8
- package/esm/assets.d.ts +0 -42
- package/esm/assets.js +0 -56
- package/esm/constants.d.ts +0 -39
- package/esm/constants.js +0 -22
- package/esm/focus-visible.d.ts +0 -1
- package/esm/focus-visible.js +0 -1
- package/esm/package.json +0 -1
- package/esm/utils/env.d.ts +0 -1
- package/esm/utils/env.js +0 -8
- package/esm/utils/seenEffect.d.ts +0 -28
- package/esm/utils/seenEffect.js +0 -73
- package/esm/utils/useFormatMonitor.d.ts +0 -38
- package/esm/utils/useFormatMonitor.js +0 -41
- package/esm/utils/useGetSVGtext.d.ts +0 -6
- package/esm/utils/useGetSVGtext.js +0 -19
- package/esm/utils/useMenuToggling.d.ts +0 -8
- package/esm/utils/useMenuToggling.js +0 -62
- package/esm/utils/useScrollbarWidthCSSVar.d.ts +0 -1
- package/esm/utils/useScrollbarWidthCSSVar.js +0 -3
- package/esm/utils.d.ts +0 -2
- package/esm/utils.js +0 -2
package/esm/_abstract/_Image.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
-
import { useGetSVGtext } from '../utils/useGetSVGtext';
|
|
4
|
-
// eslint-disable-next-line complexity
|
|
5
|
-
const Image = (props) => {
|
|
6
|
-
const { src, altText = '', sources = [], preloadSrc, className, inline, placeholder, focalPoint, } = props;
|
|
7
|
-
const _src = (sources.length && preloadSrc) || src;
|
|
8
|
-
const imageSrc = _src || (sources[0] != null ? sources[0].srcset.split(' ')[0] : undefined);
|
|
9
|
-
const imgLoading = preloadSrc ? 'eager' : 'lazy';
|
|
10
|
-
const inlineSvg = useGetSVGtext(inline ? imageSrc : undefined);
|
|
11
|
-
if (!imageSrc) {
|
|
12
|
-
return placeholder ? (React.createElement("span", { className: className && getBemClass(className, 'missing') }, placeholder !== true && placeholder())) : null;
|
|
13
|
-
}
|
|
14
|
-
if (inline && inlineSvg) {
|
|
15
|
-
const __html = inlineSvg.imageSrc === imageSrc ? inlineSvg.code : '';
|
|
16
|
-
return React.createElement("span", { className: className, dangerouslySetInnerHTML: { __html } });
|
|
17
|
-
}
|
|
18
|
-
return (React.createElement("picture", { className: className, style: focalPoint ? { '--focalPoint': focalPoint } : undefined },
|
|
19
|
-
' ',
|
|
20
|
-
sources.map((source, i) => (React.createElement(React.Fragment, null,
|
|
21
|
-
React.createElement("source", { key: i, srcSet: source.srcset, media: source.media }),
|
|
22
|
-
' '))),
|
|
23
|
-
' ',
|
|
24
|
-
React.createElement("img", { src: imageSrc, alt: altText, loading: imgLoading }),
|
|
25
|
-
' '));
|
|
26
|
-
};
|
|
27
|
-
export default Image;
|
package/esm/_abstract/_Link.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Props object ready to be ..spread onto an anchor element
|
|
3
|
-
* */
|
|
4
|
-
export declare type LinkProps = JSX.IntrinsicElements['a'] & {
|
|
5
|
-
href: string;
|
|
6
|
-
};
|
|
7
|
-
export declare type LinkRenderer = (props: LinkProps) => JSX.Element;
|
|
8
|
-
export declare let Link: LinkRenderer;
|
|
9
|
-
/**
|
|
10
|
-
* Allows you to set a callback function to wrapp <a href=""/> links with
|
|
11
|
-
* a custom routing component.
|
|
12
|
-
*
|
|
13
|
-
* Example use:
|
|
14
|
-
*
|
|
15
|
-
* ```js
|
|
16
|
-
* import { Link } from 'remix'; // or whatever :-)
|
|
17
|
-
*
|
|
18
|
-
* setLinkRenderer((linkProps) =>
|
|
19
|
-
* <Link to={linkProps.href}><a {...linkProps} /></Link>);
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* The Default linkrenderer defined as:
|
|
23
|
-
* ```js
|
|
24
|
-
* (linkProps) => React.createElement('a', linkProps);
|
|
25
|
-
* ```
|
|
26
|
-
*/
|
|
27
|
-
export declare const setLinkRenderer: (linkRenderer: LinkRenderer | undefined) => void;
|
package/esm/_abstract/_Link.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
const DefaultLinkRenderer = (props) => React.createElement('a', props);
|
|
3
|
-
export let Link = DefaultLinkRenderer;
|
|
4
|
-
/**
|
|
5
|
-
* Allows you to set a callback function to wrapp <a href=""/> links with
|
|
6
|
-
* a custom routing component.
|
|
7
|
-
*
|
|
8
|
-
* Example use:
|
|
9
|
-
*
|
|
10
|
-
* ```js
|
|
11
|
-
* import { Link } from 'remix'; // or whatever :-)
|
|
12
|
-
*
|
|
13
|
-
* setLinkRenderer((linkProps) =>
|
|
14
|
-
* <Link to={linkProps.href}><a {...linkProps} /></Link>);
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* The Default linkrenderer defined as:
|
|
18
|
-
* ```js
|
|
19
|
-
* (linkProps) => React.createElement('a', linkProps);
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export const setLinkRenderer = (linkRenderer) => {
|
|
23
|
-
Link = linkRenderer || DefaultLinkRenderer;
|
|
24
|
-
};
|
package/esm/_abstract/_Quote.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Link } from './_Link';
|
|
3
|
-
export const _Quote = (props) => {
|
|
4
|
-
const { bem, children, by, byHref } = props;
|
|
5
|
-
return (React.createElement("figure", { className: bem },
|
|
6
|
-
React.createElement("blockquote", { className: bem + '__quote' }, children),
|
|
7
|
-
by && (React.createElement("figcaption", { className: bem + '__by' }, byHref ? (React.createElement(Link, { href: byHref }, by)) : typeof by === 'string' ? (React.createElement("span", null, by)) : (by)))));
|
|
8
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { FormFieldInputProps } from '../FormField';
|
|
2
|
-
import { TogglerInputProps } from './_TogglerInput';
|
|
3
|
-
export declare type TogglerGroupOption = {
|
|
4
|
-
value: string;
|
|
5
|
-
label?: string | JSX.Element;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
id?: string;
|
|
8
|
-
};
|
|
9
|
-
export declare type TogglerGroupOptions = Array<TogglerGroupOption>;
|
|
10
|
-
declare type RestrictedInputProps = Omit<JSX.IntrinsicElements['input'], 'type' | 'value' | 'checked' | 'defaultChecked' | 'className' | 'id' | 'name' | 'children'>;
|
|
11
|
-
export declare type TogglerGroupProps = {
|
|
12
|
-
options: TogglerGroupOptions;
|
|
13
|
-
className?: string;
|
|
14
|
-
name: string;
|
|
15
|
-
children?: undefined;
|
|
16
|
-
disabled?: boolean | ReadonlyArray<number>;
|
|
17
|
-
inputProps?: RestrictedInputProps;
|
|
18
|
-
onSelected?: (payload: {
|
|
19
|
-
value: string;
|
|
20
|
-
checked: boolean;
|
|
21
|
-
option: TogglerGroupOption;
|
|
22
|
-
selectedValues: Array<string>;
|
|
23
|
-
}) => void;
|
|
24
|
-
} & Omit<FormFieldInputProps, 'disabled'>;
|
|
25
|
-
declare type _TogglerGroupProps = {
|
|
26
|
-
bem: string;
|
|
27
|
-
Toggler: (props: TogglerInputProps) => JSX.Element;
|
|
28
|
-
value?: ReadonlyArray<string>;
|
|
29
|
-
};
|
|
30
|
-
declare const TogglerGroup: (props: TogglerGroupProps & _TogglerGroupProps) => JSX.Element;
|
|
31
|
-
export default TogglerGroup;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
-
const TogglerGroup = (props) => {
|
|
4
|
-
const {
|
|
5
|
-
// id,
|
|
6
|
-
className, bem, name, disabled, Toggler, onSelected, options, inputProps = {}, } = props;
|
|
7
|
-
const values = props.value || [];
|
|
8
|
-
return (React.createElement("ul", { className: getBemClass(bem, null, className), role: "group", "aria-labelledby": props['aria-labelledby'], "aria-describedby": props['aria-describedby'], "aria-required": props.required }, options.map((option, i) => {
|
|
9
|
-
const isDisabled = option.disabled != null
|
|
10
|
-
? option.disabled
|
|
11
|
-
: disabled && typeof disabled !== 'boolean'
|
|
12
|
-
? disabled.includes(i)
|
|
13
|
-
: disabled;
|
|
14
|
-
const isChecked = values.includes(option.value);
|
|
15
|
-
return (React.createElement(Toggler, Object.assign({ key: i }, inputProps, { className: bem + '__item', name: name, Wrapper: "li" }, option, { label: option.label || option.value, onChange: onSelected
|
|
16
|
-
? (e) => {
|
|
17
|
-
const { value } = option;
|
|
18
|
-
const checked = e.currentTarget.checked;
|
|
19
|
-
inputProps.onChange && inputProps.onChange(e);
|
|
20
|
-
const selectedValues = values.filter((val) => val !== value);
|
|
21
|
-
if (checked) {
|
|
22
|
-
selectedValues.push(value);
|
|
23
|
-
}
|
|
24
|
-
onSelected({ value, checked, option, selectedValues });
|
|
25
|
-
}
|
|
26
|
-
: inputProps.onChange, disabled: isDisabled, "aria-invalid": props['aria-invalid'], checked: isChecked })));
|
|
27
|
-
})));
|
|
28
|
-
};
|
|
29
|
-
export default TogglerGroup;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import { BemPropsModifier } from '@hugsmidjan/react/types';
|
|
3
|
-
import { FormFieldGroupWrappingProps } from '../FormField';
|
|
4
|
-
import { TogglerGroupOption, TogglerGroupOptions, TogglerGroupProps } from './_TogglerGroup';
|
|
5
|
-
import { TogglerInputProps } from './_TogglerInput';
|
|
6
|
-
export declare type TogglerGroupFieldProps = {
|
|
7
|
-
className?: string;
|
|
8
|
-
} & FormFieldGroupWrappingProps & TogglerGroupProps;
|
|
9
|
-
declare type _TogglerGroupFieldProps = {
|
|
10
|
-
Toggler: (props: TogglerInputProps) => ReactElement;
|
|
11
|
-
value?: string | ReadonlyArray<string>;
|
|
12
|
-
bem: string;
|
|
13
|
-
} & BemPropsModifier;
|
|
14
|
-
export declare type TogglerGroupFieldOption = TogglerGroupOption;
|
|
15
|
-
export declare type TogglerGroupFieldOptions = TogglerGroupOptions;
|
|
16
|
-
declare const TogglerGroupField: (props: TogglerGroupFieldProps & _TogglerGroupFieldProps) => JSX.Element;
|
|
17
|
-
export default TogglerGroupField;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
14
|
-
import FormField from '../FormField';
|
|
15
|
-
import TogglerGroup from './_TogglerGroup';
|
|
16
|
-
const TogglerGroupField = (props) => {
|
|
17
|
-
const { bem, Toggler, className, modifier, label, LabelTag, assistText, hideLabel, disabled, readOnly, invalid, errorMessage, required, reqText, id, value } = props, togglerGroupProps = __rest(props, ["bem", "Toggler", "className", "modifier", "label", "LabelTag", "assistText", "hideLabel", "disabled", "readOnly", "invalid", "errorMessage", "required", "reqText", "id", "value"]);
|
|
18
|
-
return (React.createElement(FormField, { className: getBemClass(bem, modifier, className), group: true, label: label, LabelTag: LabelTag, assistText: assistText, hideLabel: hideLabel, disabled: disabled, readOnly: readOnly, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, id: id, renderInput: (className, inputProps) => {
|
|
19
|
-
return (React.createElement(TogglerGroup, Object.assign({ bem: className.options }, inputProps, togglerGroupProps, { value: Array.isArray(value) ? value : value != null ? [value] : undefined, Toggler: Toggler })));
|
|
20
|
-
} }));
|
|
21
|
-
};
|
|
22
|
-
export default TogglerGroupField;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { BemPropsModifier } from '@hugsmidjan/react/types';
|
|
2
|
-
export declare type TogglerInputProps = {
|
|
3
|
-
label: string | JSX.Element;
|
|
4
|
-
children?: undefined;
|
|
5
|
-
Wrapper?: 'div' | 'li';
|
|
6
|
-
invalid?: boolean;
|
|
7
|
-
/** Hidden label prefix text to indicate that the field is required.
|
|
8
|
-
*
|
|
9
|
-
* If your field is required but should not say so in its label
|
|
10
|
-
* then set this prop to `false`
|
|
11
|
-
*
|
|
12
|
-
* Default: `"Þarf að fylla út"`
|
|
13
|
-
* */
|
|
14
|
-
reqText?: string | false;
|
|
15
|
-
errorMessage?: string | JSX.Element;
|
|
16
|
-
} & BemPropsModifier & Omit<JSX.IntrinsicElements['input'], 'type'>;
|
|
17
|
-
declare type _TogglerInputProps = {
|
|
18
|
-
bem: string;
|
|
19
|
-
type: 'radio' | 'checkbox';
|
|
20
|
-
};
|
|
21
|
-
declare const TogglerInput: (props: TogglerInputProps & _TogglerInputProps) => JSX.Element;
|
|
22
|
-
export default TogglerInput;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import { useDomid } from '@hugsmidjan/react/hooks';
|
|
14
|
-
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
15
|
-
const TogglerInput = (props) => {
|
|
16
|
-
const { bem, modifier, className, label, invalid, errorMessage, Wrapper = 'div', required, reqText, type, id } = props, inputProps = __rest(props, ["bem", "modifier", "className", "label", "invalid", "errorMessage", "Wrapper", "required", "reqText", "type", "id"]);
|
|
17
|
-
const domid = useDomid(id);
|
|
18
|
-
const errorId = errorMessage && 'error' + domid;
|
|
19
|
-
const reqStar = required && reqText !== false && (React.createElement("abbr", { className: bem + '__label__reqstar',
|
|
20
|
-
// TODO: add mo-better i18n thinking
|
|
21
|
-
title: (reqText || 'Þarf að haka í') + ': ' }, "*"));
|
|
22
|
-
return (React.createElement(Wrapper, { className: getBemClass(bem, modifier, className) },
|
|
23
|
-
React.createElement("input", Object.assign({ className: bem + '__input', type: type, id: domid, "aria-invalid": invalid || !!errorMessage || undefined, "aria-describedby": errorId }, inputProps)),
|
|
24
|
-
' ',
|
|
25
|
-
React.createElement("label", { className: bem + '__label', htmlFor: domid },
|
|
26
|
-
' ',
|
|
27
|
-
reqStar,
|
|
28
|
-
" ",
|
|
29
|
-
label,
|
|
30
|
-
' '),
|
|
31
|
-
errorMessage && (React.createElement("div", { className: bem + '__error', id: errorId }, errorMessage))));
|
|
32
|
-
};
|
|
33
|
-
export default TogglerInput;
|
package/esm/assets.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { BlingType, Efnistakn, Formheimur, Illustration } from '@reykjavik/hanna-utils/assets';
|
|
2
|
-
import { blingTypes, efnistakn, getAssetUrl, getBlingUrl, getEfnistaknUrl, getFormheimurUrl, getIllustrationUrl, illustrations } from '@reykjavik/hanna-utils/assets';
|
|
3
|
-
export type {
|
|
4
|
-
/** @deprecated Instead `import type { BlingType } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
5
|
-
BlingType,
|
|
6
|
-
/** @deprecated Instead `import type { Efnistakn } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
7
|
-
Efnistakn,
|
|
8
|
-
/** @deprecated Instead `import type { Formheimur } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
9
|
-
Formheimur,
|
|
10
|
-
/** @deprecated Instead `import type { Illustration } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
11
|
-
Illustration, };
|
|
12
|
-
export {
|
|
13
|
-
/** @deprecated Instead `import type { blingTypes } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
14
|
-
blingTypes,
|
|
15
|
-
/** @deprecated Instead `import type { efnistakn } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
16
|
-
efnistakn,
|
|
17
|
-
/** @deprecated Instead `import type { getAssetUrl } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
18
|
-
getAssetUrl,
|
|
19
|
-
/** @deprecated Instead `import type { getBlingUrl } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
20
|
-
getBlingUrl,
|
|
21
|
-
/** @deprecated Instead `import type { getEfnistaknUrl } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
22
|
-
getEfnistaknUrl,
|
|
23
|
-
/** @deprecated Instead `import type { getFormheimurUrl } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
24
|
-
getFormheimurUrl,
|
|
25
|
-
/** @deprecated Instead `import type { getIllustrationUrl } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
26
|
-
getIllustrationUrl,
|
|
27
|
-
/** @deprecated Instead `import type { illustrations } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
28
|
-
illustrations, };
|
|
29
|
-
/** @deprecated Use `getCssBundleUrl` from '@reykjavik/hanna-css' instead (Will be reomved in v0.11) */
|
|
30
|
-
export declare const getCssBundleUrl: (cssTokens: string | Array<string>, version?: string | undefined) => string;
|
|
31
|
-
/** @deprecated (Will be removed in v0.11) */
|
|
32
|
-
export declare const efnistakn_menu: readonly ["menu/borgarstjori", "menu/borgarstjorn", "menu/bygg_framkv", "menu/fjarmal", "menu/fundargerdir", "menu/itrottir_aftreying", "menu/log_reglugerdir", "menu/mannaudur", "menu/menning", "menu/rad_nefndir", "menu/skipulag", "menu/skolar_fristund", "menu/svid_deildir", "menu/umhverfi_samgongur", "menu/velferd_fjolskylda"];
|
|
33
|
-
/** @deprecated (Will be removed in v0.11) */
|
|
34
|
-
export declare type Efnistakn_Menu = typeof efnistakn_menu[number];
|
|
35
|
-
/** @deprecated (Will be removed in v0.11) */
|
|
36
|
-
export declare const auxiliary_menu_images: Array<Illustration>;
|
|
37
|
-
/** @deprecated Instead `import type { AuxilaryPanelIllustration } from '@reykjavik/hanna-react/MainMenu';` (Will be removed in v0.11) */
|
|
38
|
-
export declare type Auxilary_MenuImages = typeof auxiliary_menu_images[number];
|
|
39
|
-
/** @deprecated Instead `import type { BlingType } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
40
|
-
export declare type BlingTypes = BlingType;
|
|
41
|
-
/** @deprecated Instead `import type { Illustration } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
42
|
-
export declare type Illustrations = Illustration;
|
package/esm/assets.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { getCssBundleUrl as _getCssBundleUrl } from '@reykjavik/hanna-css';
|
|
2
|
-
import { blingTypes, efnistakn, getAssetUrl, getBlingUrl, getEfnistaknUrl, getFormheimurUrl, getIllustrationUrl, illustrations, } from '@reykjavik/hanna-utils/assets';
|
|
3
|
-
export {
|
|
4
|
-
/** @deprecated Instead `import type { blingTypes } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
5
|
-
blingTypes,
|
|
6
|
-
/** @deprecated Instead `import type { efnistakn } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
7
|
-
efnistakn,
|
|
8
|
-
/** @deprecated Instead `import type { getAssetUrl } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
9
|
-
getAssetUrl,
|
|
10
|
-
/** @deprecated Instead `import type { getBlingUrl } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
11
|
-
getBlingUrl,
|
|
12
|
-
/** @deprecated Instead `import type { getEfnistaknUrl } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
13
|
-
getEfnistaknUrl,
|
|
14
|
-
/** @deprecated Instead `import type { getFormheimurUrl } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
15
|
-
getFormheimurUrl,
|
|
16
|
-
/** @deprecated Instead `import type { getIllustrationUrl } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
17
|
-
getIllustrationUrl,
|
|
18
|
-
/** @deprecated Instead `import type { illustrations } from '@reykjavik/hanna-utils/assets';` (Will be removed in v0.11) */
|
|
19
|
-
illustrations, };
|
|
20
|
-
/** @deprecated Use `getCssBundleUrl` from '@reykjavik/hanna-css' instead (Will be reomved in v0.11) */
|
|
21
|
-
export const getCssBundleUrl = (cssTokens,
|
|
22
|
-
/** If you want to pin your CSS files to a specific version */
|
|
23
|
-
version) => _getCssBundleUrl(cssTokens, { version });
|
|
24
|
-
// ---------------------------------------------------------------------------
|
|
25
|
-
// Based on "https://styles.reykjavik.is/assets/efnistakn/menu/files.json"
|
|
26
|
-
/** @deprecated (Will be removed in v0.11) */
|
|
27
|
-
export const efnistakn_menu = [
|
|
28
|
-
'menu/borgarstjori',
|
|
29
|
-
'menu/borgarstjorn',
|
|
30
|
-
'menu/bygg_framkv',
|
|
31
|
-
'menu/fjarmal',
|
|
32
|
-
'menu/fundargerdir',
|
|
33
|
-
'menu/itrottir_aftreying',
|
|
34
|
-
'menu/log_reglugerdir',
|
|
35
|
-
'menu/mannaudur',
|
|
36
|
-
'menu/menning',
|
|
37
|
-
'menu/rad_nefndir',
|
|
38
|
-
'menu/skipulag',
|
|
39
|
-
'menu/skolar_fristund',
|
|
40
|
-
'menu/svid_deildir',
|
|
41
|
-
'menu/umhverfi_samgongur',
|
|
42
|
-
'menu/velferd_fjolskylda',
|
|
43
|
-
];
|
|
44
|
-
// ---------------------------------------------------------------------------
|
|
45
|
-
/** @deprecated (Will be removed in v0.11) */
|
|
46
|
-
export const auxiliary_menu_images = [
|
|
47
|
-
'hanna-veitiggi',
|
|
48
|
-
'hanna-vandro',
|
|
49
|
-
'hanna-hugsi',
|
|
50
|
-
'hanna-hissa',
|
|
51
|
-
'hanna-hahaha',
|
|
52
|
-
'hanna-hae',
|
|
53
|
-
'hanna-god_spurning',
|
|
54
|
-
'hanna-gjuggiborg',
|
|
55
|
-
'hanna-benda',
|
|
56
|
-
];
|
package/esm/constants.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/** @depcrecated import `colorFamilies` from `@reykjavik/hanna-css` instead (Will be removed in v0.11) */
|
|
2
|
-
export declare const colorFamilies: readonly ["esja", "faxafloi", "nautholsvik", "heidmork", "ellidaardalur", "blafjoll", "sund", "rokkur", "suld"] & {
|
|
3
|
-
readonly esja: "esja";
|
|
4
|
-
readonly faxafloi: "faxafloi";
|
|
5
|
-
readonly nautholsvik: "nautholsvik";
|
|
6
|
-
readonly heidmork: "heidmork";
|
|
7
|
-
readonly ellidaardalur: "ellidaardalur";
|
|
8
|
-
readonly blafjoll: "blafjoll";
|
|
9
|
-
readonly sund: "sund";
|
|
10
|
-
readonly rokkur: "rokkur";
|
|
11
|
-
readonly suld: "suld";
|
|
12
|
-
} & {
|
|
13
|
-
/** @deprecated This is a typo (Will be removed in v0.11) */
|
|
14
|
-
ellidarardalur: string;
|
|
15
|
-
};
|
|
16
|
-
/** @depcrecated import type `ColorFamily` from `@reykjavik/hanna-css` instead (Will be removed in v0.11) */
|
|
17
|
-
export type { ColorFamily } from '@reykjavik/hanna-css';
|
|
18
|
-
/** @depcrecated import `colorThemes` from `@reykjavik/hanna-css` instead (Will be removed in v0.11) */
|
|
19
|
-
export declare const themeOptions: readonly ["trustworthy", "dependable", "friendly", "lively", "colorful"] & {
|
|
20
|
-
readonly trustworthy: "trustworthy";
|
|
21
|
-
readonly dependable: "dependable";
|
|
22
|
-
readonly friendly: "friendly";
|
|
23
|
-
readonly lively: "lively";
|
|
24
|
-
readonly colorful: "colorful";
|
|
25
|
-
};
|
|
26
|
-
/** @depcrecated import type `HannaColorTheme` from `@reykjavik/hanna-css` instead (Will be removed in v0.11) */
|
|
27
|
-
export type { HannaColorTheme as ThemeOption } from '@reykjavik/hanna-css';
|
|
28
|
-
export declare type Alignment = 'right' | 'left';
|
|
29
|
-
export declare const aligns: Record<string, true | undefined>;
|
|
30
|
-
export declare type ComponentLayoutProps<Align extends string = 'right'> = {
|
|
31
|
-
wide?: undefined;
|
|
32
|
-
align?: undefined;
|
|
33
|
-
} | {
|
|
34
|
-
wide: boolean;
|
|
35
|
-
align?: undefined;
|
|
36
|
-
} | {
|
|
37
|
-
wide?: undefined;
|
|
38
|
-
align: Align;
|
|
39
|
-
};
|
package/esm/constants.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { colorFamilies as _colorFamilies, colorThemes } from '@reykjavik/hanna-css';
|
|
2
|
-
/** @depcrecated import `colorFamilies` from `@reykjavik/hanna-css` instead (Will be removed in v0.11) */
|
|
3
|
-
export const colorFamilies = Object.assign([
|
|
4
|
-
'esja',
|
|
5
|
-
'faxafloi',
|
|
6
|
-
'nautholsvik',
|
|
7
|
-
'heidmork',
|
|
8
|
-
'ellidaardalur',
|
|
9
|
-
'blafjoll',
|
|
10
|
-
'sund',
|
|
11
|
-
'rokkur',
|
|
12
|
-
'suld',
|
|
13
|
-
], _colorFamilies, {
|
|
14
|
-
/** @deprecated This is a typo (Will be removed in v0.11) */
|
|
15
|
-
ellidarardalur: 'ellidaardalur',
|
|
16
|
-
});
|
|
17
|
-
/** @depcrecated import `colorThemes` from `@reykjavik/hanna-css` instead (Will be removed in v0.11) */
|
|
18
|
-
export const themeOptions = Object.assign(['trustworthy', 'dependable', 'friendly', 'lively', 'colorful'], colorThemes);
|
|
19
|
-
export const aligns = {
|
|
20
|
-
right: true,
|
|
21
|
-
left: true,
|
|
22
|
-
};
|
package/esm/focus-visible.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@reykjavik/hanna-utils/focus-visible';
|
package/esm/focus-visible.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@reykjavik/hanna-utils/focus-visible';
|
package/esm/package.json
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"type":"module"}
|
package/esm/utils/env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isPreact: true | undefined;
|
package/esm/utils/env.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export const isPreact =
|
|
3
|
-
// imported from 'preact'
|
|
4
|
-
'h' in React ||
|
|
5
|
-
// imported from 'preact/compat' (has all of `react-dom` bundled)
|
|
6
|
-
('hydrate' in React && 'render' in React) ||
|
|
7
|
-
// `undefined` instead of `false` for nicer prop usage
|
|
8
|
-
undefined;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { RefObject } from 'react';
|
|
2
|
-
export declare const DATA_ATTR_NAME = "is-seen";
|
|
3
|
-
export declare const getObserver: {
|
|
4
|
-
(target: Element, callback?: ((target: Element) => void) | undefined): (() => void) | undefined;
|
|
5
|
-
DATA_ATTR_NAME: string;
|
|
6
|
-
};
|
|
7
|
-
export declare const seenEffectOptOut: (target: Element, setFlag?: boolean) => void;
|
|
8
|
-
declare const effects: {
|
|
9
|
-
readonly fadein: 1;
|
|
10
|
-
readonly fadeup: 1;
|
|
11
|
-
readonly fadeleft: 1;
|
|
12
|
-
};
|
|
13
|
-
export declare type SeenEffectType = keyof typeof effects;
|
|
14
|
-
export declare type EffectProp = {
|
|
15
|
-
/** Should the component appear instantly, and not transition-in once seen */
|
|
16
|
-
effectType?: SeenEffectType | 'none';
|
|
17
|
-
};
|
|
18
|
-
/** Asserts that a prop value is a SeenEffectType and returns undefined otherwise */
|
|
19
|
-
export declare const assertEffectType: (maybeType?: string | undefined) => SeenEffectType | undefined;
|
|
20
|
-
export declare const getEffectAttr: (maybeType?: string | undefined) => {
|
|
21
|
-
'data-seen-effect': string | undefined;
|
|
22
|
-
};
|
|
23
|
-
export declare type SeenProp = {
|
|
24
|
-
/** Should the component appear instantly, and not transition-in once seen */
|
|
25
|
-
startSeen?: boolean;
|
|
26
|
-
};
|
|
27
|
-
export declare const useSeenEffect: <E extends Element = HTMLDivElement>(startSeen?: boolean | undefined, customRef?: RefObject<E> | undefined) => [RefObject<E> | undefined, true | undefined];
|
|
28
|
-
export {};
|
package/esm/utils/seenEffect.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from 'react';
|
|
2
|
-
export const DATA_ATTR_NAME = 'is-seen';
|
|
3
|
-
const STACKING_DELAY = 400; // ms
|
|
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
|
-
// root: window
|
|
8
|
-
rootMargin: '-100px 0px 0px 0px',
|
|
9
|
-
threshold: 0, // 0
|
|
10
|
-
};
|
|
11
|
-
let observer;
|
|
12
|
-
export const getObserver = (target, callback) => {
|
|
13
|
-
if (target.hasAttribute(dataAttr)) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
17
|
-
if (!observer) {
|
|
18
|
-
observer = new IntersectionObserver((entries, observer) => entries
|
|
19
|
-
.filter((e) => e.isIntersecting)
|
|
20
|
-
.sort(inTargetSourceOrder)
|
|
21
|
-
.forEach(({ target }, i) => {
|
|
22
|
-
setTimeout(() => {
|
|
23
|
-
target.setAttribute(dataAttr, 'true');
|
|
24
|
-
callback && callback(target);
|
|
25
|
-
observer.unobserve(target);
|
|
26
|
-
}, STACKING_DELAY * i);
|
|
27
|
-
}), options);
|
|
28
|
-
}
|
|
29
|
-
if (target.matches('[' + dataAttr + '] *')) {
|
|
30
|
-
// opt out if target is contained by another "seen-effect" element
|
|
31
|
-
target.setAttribute(dataAttr, '');
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
target.setAttribute(dataAttr, 'false');
|
|
35
|
-
observer.observe(target);
|
|
36
|
-
return () => observer.unobserve(target);
|
|
37
|
-
};
|
|
38
|
-
export const seenEffectOptOut = (target, setFlag = true) => {
|
|
39
|
-
setFlag ? target.setAttribute(dataAttr, '') : target.removeAttribute(dataAttr);
|
|
40
|
-
};
|
|
41
|
-
getObserver.DATA_ATTR_NAME = DATA_ATTR_NAME;
|
|
42
|
-
// ---------------------------------------------------------------------------
|
|
43
|
-
// ---------------------------------------------------------------------------
|
|
44
|
-
const effects = {
|
|
45
|
-
fadein: 1,
|
|
46
|
-
fadeup: 1,
|
|
47
|
-
fadeleft: 1,
|
|
48
|
-
};
|
|
49
|
-
/** Asserts that a prop value is a SeenEffectType and returns undefined otherwise */
|
|
50
|
-
export const assertEffectType = (maybeType) => maybeType && maybeType in effects ? maybeType : undefined;
|
|
51
|
-
export const getEffectAttr = (maybeType) => ({
|
|
52
|
-
'data-seen-effect': maybeType === 'none' ? undefined : assertEffectType(maybeType) || '',
|
|
53
|
-
});
|
|
54
|
-
export const useSeenEffect = (
|
|
55
|
-
/** Should the component appear instantly, and not transition-in once seen */
|
|
56
|
-
startSeen,
|
|
57
|
-
/** Bring Your Own RefObject */
|
|
58
|
-
customRef) => {
|
|
59
|
-
const localRef = useRef(null);
|
|
60
|
-
const [isSeen, setSeen] = useState(startSeen || undefined);
|
|
61
|
-
const ref = !startSeen && (customRef || localRef);
|
|
62
|
-
useEffect(() => {
|
|
63
|
-
setSeen(startSeen || undefined);
|
|
64
|
-
if (ref && ref.current) {
|
|
65
|
-
// NOTE: Given that `ref` is defined, then
|
|
66
|
-
// `startSeen` is implicily `false | undefined` at
|
|
67
|
-
// this point.
|
|
68
|
-
seenEffectOptOut(ref.current, false);
|
|
69
|
-
return getObserver(ref.current, () => setSeen(true));
|
|
70
|
-
}
|
|
71
|
-
}, [ref, startSeen]);
|
|
72
|
-
return [ref || undefined, isSeen];
|
|
73
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pass a callback that gets called whenever the browser window
|
|
3
|
-
* resizes past one of the preconfigured "media-format" breakpoints.
|
|
4
|
-
*
|
|
5
|
-
* Exmple use:
|
|
6
|
-
*
|
|
7
|
-
* ```ts
|
|
8
|
-
* useFormatMonitor((media) => {
|
|
9
|
-
* if (media.is === 'phone') {
|
|
10
|
-
* // do something clever because the window
|
|
11
|
-
* // just became "phone" sized.
|
|
12
|
-
* }
|
|
13
|
-
* if (media.was === 'phone') {
|
|
14
|
-
* // do something clever because the window
|
|
15
|
-
* // just stopped being "phone" sized.
|
|
16
|
-
* }
|
|
17
|
-
* })
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* The `media` argument has the following properties:
|
|
21
|
-
*
|
|
22
|
-
* ```ts
|
|
23
|
-
* // type Formats = 'phone' | 'phablet' | 'tablet' | 'netbook' | 'wide'
|
|
24
|
-
* media.is //: Format
|
|
25
|
-
* media.was //?: Format
|
|
26
|
-
* // Category/mode boolean flags
|
|
27
|
-
* // (Hamburger refers to the "mobile menu" mode)
|
|
28
|
-
* media.isTopmenu
|
|
29
|
-
* media.isHamburger
|
|
30
|
-
* media.wasTopmenu
|
|
31
|
-
* media.wasHamburger
|
|
32
|
-
* media.becameTopmenu
|
|
33
|
-
* media.becameHamburger
|
|
34
|
-
* media.leftTopmenu
|
|
35
|
-
* media.leftHamburger
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
export declare const useFormatMonitor: (callback: (media: import("formatchange").BaseMedia & Record<"isHamburger" | "isTopmenu" | "wasHamburger" | "wasTopmenu" | "becameHamburger" | "becameTopmenu" | "leftHamburger" | "leftTopmenu", boolean>) => void) => void;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { formatMonitor } from '@reykjavik/hanna-utils';
|
|
2
|
-
import { makeFormatMonitorHook } from 'formatchange/react';
|
|
3
|
-
// ==================================================
|
|
4
|
-
/**
|
|
5
|
-
* Pass a callback that gets called whenever the browser window
|
|
6
|
-
* resizes past one of the preconfigured "media-format" breakpoints.
|
|
7
|
-
*
|
|
8
|
-
* Exmple use:
|
|
9
|
-
*
|
|
10
|
-
* ```ts
|
|
11
|
-
* useFormatMonitor((media) => {
|
|
12
|
-
* if (media.is === 'phone') {
|
|
13
|
-
* // do something clever because the window
|
|
14
|
-
* // just became "phone" sized.
|
|
15
|
-
* }
|
|
16
|
-
* if (media.was === 'phone') {
|
|
17
|
-
* // do something clever because the window
|
|
18
|
-
* // just stopped being "phone" sized.
|
|
19
|
-
* }
|
|
20
|
-
* })
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* The `media` argument has the following properties:
|
|
24
|
-
*
|
|
25
|
-
* ```ts
|
|
26
|
-
* // type Formats = 'phone' | 'phablet' | 'tablet' | 'netbook' | 'wide'
|
|
27
|
-
* media.is //: Format
|
|
28
|
-
* media.was //?: Format
|
|
29
|
-
* // Category/mode boolean flags
|
|
30
|
-
* // (Hamburger refers to the "mobile menu" mode)
|
|
31
|
-
* media.isTopmenu
|
|
32
|
-
* media.isHamburger
|
|
33
|
-
* media.wasTopmenu
|
|
34
|
-
* media.wasHamburger
|
|
35
|
-
* media.becameTopmenu
|
|
36
|
-
* media.becameHamburger
|
|
37
|
-
* media.leftTopmenu
|
|
38
|
-
* media.leftHamburger
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
export const useFormatMonitor = makeFormatMonitorHook(formatMonitor);
|