@reykjavik/hanna-react 0.10.57 → 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.d.ts +1 -1
- package/ActionCards.js +4 -6
- package/Alert.js +5 -30
- package/ArticleCards.d.ts +6 -0
- package/ArticleCards.js +7 -0
- package/ArticleCarousel/_ArticleCarouselCard.d.ts +1 -1
- package/ArticleCarousel/_ArticleCarouselCard.js +8 -10
- package/ArticleCarousel.js +3 -5
- package/ArticleMeta.d.ts +1 -0
- package/ArticleMeta.js +7 -28
- package/Attention.js +3 -5
- package/BasicTable.js +5 -7
- package/{esm/CenterColumn.d.ts → BgBox.d.ts} +4 -3
- package/BgBox.js +12 -0
- package/Bling.js +3 -5
- package/BlockBreak.js +2 -4
- package/BlockQuote.js +2 -4
- package/BreadCrumbs.js +4 -6
- package/ButtonBack.d.ts +1 -1
- package/ButtonBack.js +4 -6
- package/ButtonBar.js +3 -5
- package/ButtonPrimary.d.ts +1 -1
- package/ButtonPrimary.js +4 -6
- package/ButtonSecondary.d.ts +1 -1
- package/ButtonSecondary.js +4 -6
- package/ButtonTertiary.d.ts +1 -1
- package/ButtonTertiary.js +4 -6
- package/CHANGELOG.md +20 -1
- package/Carousel.js +3 -5
- package/CarouselStepper.js +3 -5
- package/CenterColumn.js +3 -5
- package/Checkbox.d.ts +1 -1
- package/Checkbox.js +4 -6
- package/CheckboxButtonsGroup.d.ts +1 -1
- package/CheckboxButtonsGroup.js +6 -8
- package/CheckboxGroup.d.ts +1 -1
- package/CheckboxGroup.js +5 -7
- package/CityBlock.d.ts +1 -1
- package/CityBlock.js +3 -5
- package/ContactBubble.js +6 -31
- package/ContentArticle.js +8 -10
- package/ContentImage.d.ts +1 -1
- package/ContentImage.js +4 -6
- package/Datepicker.js +6 -31
- package/ExtraLinks.d.ts +1 -1
- package/ExtraLinks.js +8 -21
- package/FeatureList.js +3 -5
- package/FieldGroup.js +3 -5
- package/FileInput.js +5 -41
- package/Foonote.js +2 -4
- package/FooterBadges.js +4 -6
- package/FooterInfo.js +3 -5
- package/Footnote.js +2 -4
- package/Form.js +3 -5
- package/FormField.js +3 -28
- package/Gallery/_GalleryItem.d.ts +1 -1
- package/Gallery/_GalleryItem.js +9 -45
- package/Gallery/_GalleryModal.js +6 -31
- package/Gallery/_GalleryModalContext.js +2 -4
- package/Gallery/_GalleryModalItem.js +5 -18
- package/Gallery.js +6 -31
- package/GridBlocks.d.ts +2 -2
- package/GridBlocks.js +8 -10
- package/Heading.d.ts +1 -1
- package/Heading.js +4 -6
- package/HeroBlock.d.ts +2 -2
- package/HeroBlock.js +6 -8
- package/IframeBlock.d.ts +5 -1
- package/IframeBlock.js +6 -8
- package/Illustration.d.ts +1 -1
- package/Illustration.js +4 -6
- package/ImageCards.d.ts +1 -1
- package/ImageCards.js +6 -19
- package/InfoBlock.js +2 -4
- package/InfoHero.d.ts +2 -2
- package/InfoHero.js +8 -10
- package/IslandBlock.d.ts +1 -1
- package/IslandBlock.js +3 -5
- package/IslandPageBlock.d.ts +1 -1
- package/IslandPageBlock.js +3 -5
- package/LabeledTextBlock.d.ts +1 -1
- package/LabeledTextBlock.js +4 -6
- package/Layout.js +9 -11
- package/MainMenu/_Auxiliary.js +4 -6
- package/MainMenu/_PrimaryPanel.js +5 -7
- package/MainMenu.js +7 -32
- package/MiniMetrics.d.ts +1 -1
- package/MiniMetrics.js +5 -7
- package/Modal.js +3 -5
- package/NameCard.js +6 -8
- package/NameCards.js +3 -5
- package/NewsHero.d.ts +1 -1
- package/NewsHero.js +7 -9
- package/PageFilter.js +4 -6
- package/PageHeading.js +3 -5
- package/Picture.d.ts +7 -0
- package/Picture.js +11 -0
- package/ProcessOverview.js +3 -5
- package/PullQuote.js +2 -4
- package/RadioButtonsGroup.d.ts +1 -1
- package/RadioButtonsGroup.js +6 -8
- package/RadioGroup.d.ts +2 -2
- package/RadioGroup.js +6 -8
- package/RelatedLinks.js +4 -6
- package/RowBlock.js +3 -5
- package/RowBlockColumn.js +3 -5
- package/SearchInput.js +5 -41
- package/SearchResults/_SearchResultsItem.js +6 -8
- package/SearchResults.js +7 -32
- package/SeenEffect.js +3 -16
- package/Selectbox.js +6 -42
- package/ShareButtons.js +4 -26
- 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.d.ts +1 -1
- package/TagPill.js +7 -20
- package/TextBlock.js +3 -5
- package/TextButton.d.ts +1 -1
- package/TextButton.js +4 -6
- package/TextInput.js +5 -41
- package/VSpacer.js +3 -5
- package/VerticalTabsTOC.js +3 -28
- package/WizardLayout.js +7 -9
- package/WizardLayoutClose.d.ts +1 -1
- package/WizardLayoutClose.js +4 -6
- package/WizardStepper.js +3 -5
- package/_abstract/_AbstractCarousel.js +7 -32
- package/_abstract/_Blings.js +3 -5
- package/_abstract/_Block.d.ts +2 -2
- package/_abstract/_Block.js +7 -9
- package/_abstract/{Button.d.ts → _Button.d.ts} +0 -0
- package/_abstract/{Button.js → _Button.js} +6 -19
- package/{esm/_abstract/CardList.d.ts → _abstract/_CardList.d.ts} +2 -1
- package/_abstract/{CardList.js → _CardList.js} +12 -12
- package/{esm/_abstract/Image.d.ts → _abstract/_Image.d.ts} +9 -5
- package/_abstract/{Image.js → _Image.js} +5 -7
- package/_abstract/{Link.d.ts → _Link.d.ts} +0 -0
- package/_abstract/{Link.js → _Link.js} +2 -4
- package/_abstract/_Quote.js +4 -6
- package/{esm/_abstract/TogglerGroup.d.ts → _abstract/_TogglerGroup.d.ts} +1 -1
- package/_abstract/{TogglerGroup.js → _TogglerGroup.js} +8 -8
- package/{esm/_abstract/TogglerGroupField.d.ts → _abstract/_TogglerGroupField.d.ts} +2 -2
- package/_abstract/_TogglerGroupField.js +14 -0
- package/_abstract/{TogglerInput.d.ts → _TogglerInput.d.ts} +0 -0
- package/_abstract/{TogglerInput.js → _TogglerInput.js} +4 -17
- package/_abstract/breakOnNL.js +2 -4
- package/package.json +6 -365
- package/utils/env.js +2 -4
- package/utils/seenEffect.d.ts +2 -2
- package/utils/seenEffect.js +1 -1
- package/utils/useScrollbarWidthCSSVar.js +2 -4
- package/utils.js +3 -16
- package/_abstract/CardList.d.ts +0 -29
- package/_abstract/Image.d.ts +0 -32
- package/_abstract/TogglerGroup.d.ts +0 -31
- package/_abstract/TogglerGroupField.d.ts +0 -17
- package/_abstract/TogglerGroupField.js +0 -27
- 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/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 -9
- package/esm/ArticleMeta.js +0 -18
- 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/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.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/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/Button.d.ts +0 -40
- package/esm/_abstract/Button.js +0 -47
- package/esm/_abstract/CardList.js +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/TogglerGroup.js +0 -29
- 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/_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/_Quote.d.ts +0 -9
- package/esm/_abstract/_Quote.js +0 -8
- 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/VerticalTabsTOC.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
|
-
import { setFrag } from '@hugsmidjan/qj/frag';
|
|
3
|
-
import { useDomid } from '@hugsmidjan/react/hooks';
|
|
4
|
-
import Tabs from './Tabs';
|
|
5
|
-
const getId = (url) => (url && decodeURIComponent(url.split('#')[1] || '')) || '';
|
|
6
|
-
const getItemId = (item) => getId(item && item.href);
|
|
7
|
-
const mapToItemsById = (items, domid) => {
|
|
8
|
-
const updatedItems = items.map((item) => {
|
|
9
|
-
return Object.assign(Object.assign({}, item), { 'aria-controls': item['aria-controls'] || domid });
|
|
10
|
-
});
|
|
11
|
-
const itemsById = {};
|
|
12
|
-
updatedItems.forEach((topItem, activeIdx) => {
|
|
13
|
-
const subItems = topItem.items;
|
|
14
|
-
if (!subItems) {
|
|
15
|
-
const itemId = getItemId(topItem);
|
|
16
|
-
itemsById[itemId] = { activeIdx };
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
subItems.forEach((subItem, idx) => {
|
|
20
|
-
itemsById[getItemId(subItem)] = {
|
|
21
|
-
activeIdx,
|
|
22
|
-
subTabs: {
|
|
23
|
-
activeIdx: idx,
|
|
24
|
-
'aria-label': topItem.longLabel || topItem.label,
|
|
25
|
-
id: topItem['aria-controls'],
|
|
26
|
-
tabs: subItems,
|
|
27
|
-
onSetActive: (_, item) => {
|
|
28
|
-
const newId = getItemId(item);
|
|
29
|
-
setFrag(newId);
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
if (idx === 0) {
|
|
34
|
-
topItem.href = topItem.href || '#' + getItemId(subItem);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
return { itemsById, updatedItems };
|
|
39
|
-
};
|
|
40
|
-
const VerticalTabsTOC = (props) => {
|
|
41
|
-
const { onItemSelect, items } = props;
|
|
42
|
-
const _domid = useDomid();
|
|
43
|
-
const domid = props.id || _domid;
|
|
44
|
-
const { itemsById, updatedItems } = useMemo(() => mapToItemsById(items, domid), [items, domid]);
|
|
45
|
-
const [state, setState] = useState(() => {
|
|
46
|
-
const initialId = typeof location !== 'undefined' ? getId(location.hash) : '';
|
|
47
|
-
return itemsById[initialId] || itemsById[getItemId(updatedItems[0])] || {};
|
|
48
|
-
});
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
const handleHash = () => {
|
|
51
|
-
const newId = getId(location.href);
|
|
52
|
-
const newState = itemsById[newId];
|
|
53
|
-
if (newState) {
|
|
54
|
-
setState(newState);
|
|
55
|
-
onItemSelect(newId);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
window.addEventListener('hashchange', handleHash);
|
|
59
|
-
return () => window.removeEventListener('hashchange', handleHash);
|
|
60
|
-
}, [itemsById, onItemSelect]);
|
|
61
|
-
return (React.createElement(Tabs, { id: domid, vertical: true, "aria-label": props['aria-label'], onSetActive: (_, item) => {
|
|
62
|
-
var _a;
|
|
63
|
-
const itemId = getItemId(item);
|
|
64
|
-
const newId = itemId || getItemId((_a = itemsById[itemId].subTabs) === null || _a === void 0 ? void 0 : _a.tabs[0]);
|
|
65
|
-
setFrag(newId);
|
|
66
|
-
}, tabs: updatedItems, role: "tablist", activeIdx: state.activeIdx, subTabs: state.subTabs }));
|
|
67
|
-
};
|
|
68
|
-
export default VerticalTabsTOC;
|
package/esm/WizardLayout.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { SSRSupport } from '@hugsmidjan/react/hooks';
|
|
3
|
-
import { HannaColorTheme } from '@reykjavik/hanna-css';
|
|
4
|
-
declare type WizardLayoutProps = {
|
|
5
|
-
wizardStepper?: ReactNode;
|
|
6
|
-
wizardFooter?: ReactNode;
|
|
7
|
-
colorTheme?: HannaColorTheme;
|
|
8
|
-
siteName?: string;
|
|
9
|
-
logoLink?: string;
|
|
10
|
-
globalAlerts?: ReactNode;
|
|
11
|
-
ssr?: SSRSupport;
|
|
12
|
-
children?: ReactNode;
|
|
13
|
-
};
|
|
14
|
-
declare const WizardLayout: (props: WizardLayoutProps) => JSX.Element;
|
|
15
|
-
export default WizardLayout;
|
package/esm/WizardLayout.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { useIsBrowserSide } from '@hugsmidjan/react/hooks';
|
|
3
|
-
import { getAssetUrl } from '@reykjavik/hanna-utils/assets';
|
|
4
|
-
import Image from './_abstract/Image';
|
|
5
|
-
import { Link } from './_abstract/Link';
|
|
6
|
-
import { useScrollbarWidthCSSVar } from './utils/useScrollbarWidthCSSVar';
|
|
7
|
-
const WizardLayout = (props) => {
|
|
8
|
-
useScrollbarWidthCSSVar();
|
|
9
|
-
const {
|
|
10
|
-
// ssr,
|
|
11
|
-
wizardStepper, wizardFooter, children, colorTheme, logoLink = '/', siteName = 'Reykjavík', globalAlerts, } = props;
|
|
12
|
-
const isBrowser = useIsBrowserSide( /* ssr */);
|
|
13
|
-
return (React.createElement("div", { className: "WizardLayout", "data-sprinkled": isBrowser, "data-color-theme": colorTheme },
|
|
14
|
-
globalAlerts && (React.createElement("div", { className: "WizardLayout__alerts", role: "alert" }, globalAlerts)),
|
|
15
|
-
React.createElement("div", { className: "WizardLayout__content" },
|
|
16
|
-
React.createElement("div", { className: "WizardLayout__header", role: "banner" },
|
|
17
|
-
React.createElement(Link, { className: "WizardLayout__header__logo", href: logoLink },
|
|
18
|
-
' ',
|
|
19
|
-
React.createElement(Image, { inline: true, src: getAssetUrl('reykjavik-logo.svg') }),
|
|
20
|
-
" ",
|
|
21
|
-
siteName,
|
|
22
|
-
' '),
|
|
23
|
-
' '),
|
|
24
|
-
React.createElement("div", { className: "WizardLayout__wrap" },
|
|
25
|
-
wizardStepper && (React.createElement("div", { className: "WizardLayout__stepper", role: "navigation" }, wizardStepper)),
|
|
26
|
-
React.createElement("div", { className: "WizardLayout__main", role: "main" }, children),
|
|
27
|
-
React.createElement("div", { className: "WizardLayout__deco WizardLayout__deco--geometry" })),
|
|
28
|
-
React.createElement("div", { className: "WizardLayout__footer", role: "complementary" }, wizardFooter))));
|
|
29
|
-
};
|
|
30
|
-
export default WizardLayout;
|
package/esm/WizardLayoutClose.js
DELETED
package/esm/WizardStepper.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
export declare type WizardStepperStep = {
|
|
2
|
-
label: string;
|
|
3
|
-
/**
|
|
4
|
-
* Should the step be clickable?
|
|
5
|
-
*
|
|
6
|
-
* * `true` = The items becomes clickable as allowed by the `activeStep`,
|
|
7
|
-
* `disableBacktrack` and `allowForwardSkip` props.
|
|
8
|
-
* * `false | undefined` = Never clickable, regardless of `activeStep`.
|
|
9
|
-
* * `"always"` = Always clickable regardless of `activeStep` or other props.
|
|
10
|
-
*/
|
|
11
|
-
clickable?: boolean | 'always';
|
|
12
|
-
/**
|
|
13
|
-
* Flags the item as having a non-default done state
|
|
14
|
-
*
|
|
15
|
-
* * `undefined` = automatically set "done" on items before `activeStep`
|
|
16
|
-
* * `true` = Always flag as "done", regardless of `activeStep`
|
|
17
|
-
* * `false` = Never flag as "done", regardless of `activeStep`
|
|
18
|
-
*/
|
|
19
|
-
done?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Flags the step as not part of the numbering scheme
|
|
22
|
-
*/
|
|
23
|
-
neutral?: boolean;
|
|
24
|
-
};
|
|
25
|
-
export declare type WizardStepperProps = {
|
|
26
|
-
steps: ReadonlyArray<WizardStepperStep>;
|
|
27
|
-
/** Zero-based index of the active (current) step */
|
|
28
|
-
activeStep?: number;
|
|
29
|
-
/** By default, clickable "done" steps remain clickable */
|
|
30
|
-
disableBacktrack?: boolean;
|
|
31
|
-
/** By default, clickable steps after the active step are not immediately clickable */
|
|
32
|
-
allowForwardSkip?: boolean;
|
|
33
|
-
onClick: (clickedIndex: number) => void;
|
|
34
|
-
};
|
|
35
|
-
declare const WizardStepper: (props: WizardStepperProps) => JSX.Element;
|
|
36
|
-
export default WizardStepper;
|
package/esm/WizardStepper.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
3
|
-
const WizardStepper = (props) => {
|
|
4
|
-
const { steps, activeStep = -1, allowForwardSkip, disableBacktrack, onClick } = props;
|
|
5
|
-
return (React.createElement("div", { className: getBemClass('WizardStepper', activeStep === -1 && 'preview') }, steps.map((step, i) => {
|
|
6
|
-
const { label, clickable, done, neutral } = step;
|
|
7
|
-
const stepClass = getBemClass('WizardStepper__step', [
|
|
8
|
-
(done || (done == null && i < activeStep)) && 'done',
|
|
9
|
-
neutral && 'neutral',
|
|
10
|
-
]);
|
|
11
|
-
const isClickable = clickable === 'always' ||
|
|
12
|
-
(clickable &&
|
|
13
|
-
(activeStep === i ||
|
|
14
|
-
(i > activeStep && allowForwardSkip) ||
|
|
15
|
-
(i < activeStep && !disableBacktrack)));
|
|
16
|
-
const ariaCurrent = activeStep === i ? 'step' : undefined;
|
|
17
|
-
return (React.createElement(React.Fragment, { key: i },
|
|
18
|
-
isClickable ? (React.createElement("button", { type: "button", className: stepClass, onClick: () => onClick(i), "aria-current": ariaCurrent }, label)) : (React.createElement("span", { className: stepClass, "aria-current": ariaCurrent },
|
|
19
|
-
' ',
|
|
20
|
-
label,
|
|
21
|
-
' ')),
|
|
22
|
-
' '));
|
|
23
|
-
})));
|
|
24
|
-
};
|
|
25
|
-
export default WizardStepper;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { BemProps, BemPropsModifier } from '@hugsmidjan/react/types';
|
|
3
|
-
declare type ButtonElmProps = {
|
|
4
|
-
href?: never;
|
|
5
|
-
} & BemPropsModifier & Omit<JSX.IntrinsicElements['button'], 'className' | 'style'>;
|
|
6
|
-
declare type AnchorElmProps = {
|
|
7
|
-
href: string;
|
|
8
|
-
type?: never;
|
|
9
|
-
name?: never;
|
|
10
|
-
value?: never;
|
|
11
|
-
} & BemPropsModifier & Omit<JSX.IntrinsicElements['a'], 'className' | 'style'>;
|
|
12
|
-
export declare type ButtonProps = {
|
|
13
|
-
/** Label takes preference over `children` */
|
|
14
|
-
label?: string | JSX.Element;
|
|
15
|
-
} & (ButtonElmProps | AnchorElmProps);
|
|
16
|
-
declare const sizes: {
|
|
17
|
-
readonly normal: "";
|
|
18
|
-
readonly small: "small";
|
|
19
|
-
readonly wide: "wide";
|
|
20
|
-
};
|
|
21
|
-
declare type ButtonSize = keyof typeof sizes;
|
|
22
|
-
declare const variants: {
|
|
23
|
-
readonly normal: "";
|
|
24
|
-
readonly destructive: "destructive";
|
|
25
|
-
};
|
|
26
|
-
declare type ButtonVariant = keyof typeof variants;
|
|
27
|
-
declare type NavigationFlag = 'none' | 'go-back' | 'go-forward';
|
|
28
|
-
declare type ButtonIcon = 'edit';
|
|
29
|
-
export declare type ButtonVariantProps = {
|
|
30
|
-
size?: ButtonSize;
|
|
31
|
-
variant?: ButtonVariant;
|
|
32
|
-
icon?: ButtonIcon | NavigationFlag;
|
|
33
|
-
/** @deprecated (Will be removed in v0.11) */
|
|
34
|
-
small?: boolean;
|
|
35
|
-
};
|
|
36
|
-
declare type _ButtonProps = ButtonProps & ButtonVariantProps & BemProps & {
|
|
37
|
-
children?: ReactNode;
|
|
38
|
-
};
|
|
39
|
-
declare const Button: (props: _ButtonProps) => JSX.Element;
|
|
40
|
-
export default Button;
|
package/esm/_abstract/Button.js
DELETED
|
@@ -1,47 +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 { Link } from './Link';
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
const sizes = {
|
|
17
|
-
normal: '',
|
|
18
|
-
small: 'small',
|
|
19
|
-
wide: 'wide',
|
|
20
|
-
};
|
|
21
|
-
// ---------------------------------------------------------------------------
|
|
22
|
-
const variants = {
|
|
23
|
-
normal: '',
|
|
24
|
-
destructive: 'destructive',
|
|
25
|
-
};
|
|
26
|
-
const navigationFlags = {
|
|
27
|
-
none: '',
|
|
28
|
-
'go-back': 'go--back',
|
|
29
|
-
'go-forward': 'go--forward',
|
|
30
|
-
};
|
|
31
|
-
const icons = {
|
|
32
|
-
// TODO: insert icons
|
|
33
|
-
edit: 'edit',
|
|
34
|
-
};
|
|
35
|
-
const Button = (props) => {
|
|
36
|
-
const { bem, small, size = 'normal', modifier, children, variant = 'normal', icon = 'none', label = children } = props, buttonProps = __rest(props, ["bem", "small", "size", "modifier", "children", "variant", "icon", "label"]);
|
|
37
|
-
const className = bem &&
|
|
38
|
-
getBemClass(bem, [modifier, variants[variant], sizes[size], navigationFlags[icon]]);
|
|
39
|
-
const iconProp = icons[icon] && { 'data-icon': icons[icon] };
|
|
40
|
-
if (buttonProps.href != null) {
|
|
41
|
-
return (React.createElement(Link, Object.assign({ className: className }, buttonProps, { style: undefined }, iconProp), label));
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
return (React.createElement("button", Object.assign({ className: className, type: "button" }, buttonProps, { style: undefined }, iconProp), label));
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
export default Button;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Button from './Button';
|
|
3
|
-
import Image from './Image';
|
|
4
|
-
const Card = (props) => {
|
|
5
|
-
const { bem, href, title, imgPlaceholder } = props;
|
|
6
|
-
const cardClass = `${bem}__card`;
|
|
7
|
-
const image = 'image' in props && props.image;
|
|
8
|
-
const meta = 'meta' in props && props.meta;
|
|
9
|
-
const summary = 'summary' in props && props.summary;
|
|
10
|
-
return (React.createElement(React.Fragment, null,
|
|
11
|
-
React.createElement(Button, { bem: cardClass, href: href },
|
|
12
|
-
' ',
|
|
13
|
-
React.createElement(Image, Object.assign({ className: `${bem}__image` }, image, { placeholder: imgPlaceholder })),
|
|
14
|
-
React.createElement("span", { className: `${cardClass}__title` }, title),
|
|
15
|
-
' ',
|
|
16
|
-
meta && React.createElement("span", { className: `${cardClass}__meta` }, meta),
|
|
17
|
-
' ',
|
|
18
|
-
summary && React.createElement("span", { className: `${cardClass}__summary` }, summary),
|
|
19
|
-
' '),
|
|
20
|
-
' '));
|
|
21
|
-
};
|
|
22
|
-
export const CardList = (props) => {
|
|
23
|
-
const { bemPrefix, title, summaryElement, cards, titleTag = 'h2', children, imgPlaceholder, } = props;
|
|
24
|
-
const TitleTag = titleTag;
|
|
25
|
-
const fallbackImage = (imgPlaceholder !== true && imgPlaceholder) || undefined;
|
|
26
|
-
const fallbackImageStyle = fallbackImage
|
|
27
|
-
? { '--ImageCards--fallback': `url("${fallbackImage}")` }
|
|
28
|
-
: undefined;
|
|
29
|
-
return (React.createElement(React.Fragment, null,
|
|
30
|
-
summaryElement ? (React.createElement("div", { className: bemPrefix + '__summary' },
|
|
31
|
-
title && React.createElement(TitleTag, { className: bemPrefix + '__title' }, title),
|
|
32
|
-
summaryElement)) : (title && React.createElement(TitleTag, { className: bemPrefix + '__title' }, title)),
|
|
33
|
-
React.createElement("ul", { className: bemPrefix + '__list', style: fallbackImageStyle }, cards.map((card, i) => (React.createElement("li", { key: i, className: bemPrefix + '__item' },
|
|
34
|
-
React.createElement(Card, Object.assign({}, card, { bem: bemPrefix, imgPlaceholder: !!imgPlaceholder })))))),
|
|
35
|
-
children));
|
|
36
|
-
};
|
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, } = 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 },
|
|
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
|
-
};
|
|
@@ -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,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;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import { SSRSupport } from '@hugsmidjan/react/hooks';
|
|
3
|
-
import { BemProps } from '@hugsmidjan/react/types';
|
|
4
|
-
import { SeenProp } from '../utils/seenEffect';
|
|
5
|
-
export declare type CarouselProps<I extends Record<string, unknown> = {}, P extends Record<string, unknown> | undefined = {}> = {
|
|
6
|
-
className?: string;
|
|
7
|
-
ssr?: SSRSupport;
|
|
8
|
-
/** @deprecated Ingored because never used (Will be removed in v0.11) */
|
|
9
|
-
scrollRight?: boolean;
|
|
10
|
-
} & ({
|
|
11
|
-
children?: never;
|
|
12
|
-
items: Array<I>;
|
|
13
|
-
Component: (props: P extends undefined ? I : I & P) => ReactElement | null;
|
|
14
|
-
ComponentProps?: P;
|
|
15
|
-
} | {
|
|
16
|
-
children: Array<ReactElement>;
|
|
17
|
-
items?: never;
|
|
18
|
-
Component?: never;
|
|
19
|
-
ComponentProps?: never;
|
|
20
|
-
}) & SeenProp;
|
|
21
|
-
declare type AbstractCarouselProps<I extends Record<string, unknown> = {}, P extends Record<string, unknown> | undefined = {}> = CarouselProps<I, P> & BemProps & {
|
|
22
|
-
title?: string;
|
|
23
|
-
};
|
|
24
|
-
declare const AbstractCarousel: <I extends Record<string, unknown> = {}, P extends Record<string, unknown> | undefined = {}>(props: AbstractCarouselProps<I, P>) => JSX.Element | null;
|
|
25
|
-
export default AbstractCarousel;
|